diff --git a/LICENSE b/LICENSE index 71bfc9eb4c..39d9ac1c11 100644 --- a/LICENSE +++ b/LICENSE @@ -46,7 +46,7 @@ embeddable runtime: * mono/utils/bsearch.c: BSD license. -* mono/io-layer/wapi_glob.h, wapi_glob.c: BSD license +* mono/metadata/w32file-unix-glob.c, w32file-unix-glob.h: BSD license Class Library code ================== diff --git a/Makefile.am b/Makefile.am index 12b27f14b0..f9dd1784c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,9 +11,15 @@ else tools_dir = tools endif -SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm +if BUILD_SUPPORT +support_dir = support +else +support_dir = +endif + +SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) $(support_dir) data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm # Keep in sync with SUBDIRS -DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm +DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native $(support_dir) data runtime scripts man samples tools msvc docs acceptance-tests llvm all: update_submodules diff --git a/Makefile.in b/Makefile.in index 9c6afa43c4..1bb91399bc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -444,9 +444,11 @@ MONOTOUCH_SUBDIRS = $(libgc_dir) mono # Some tools might not build when cross-compiling @CROSS_COMPILING_TRUE@tools_dir = -SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm +@BUILD_SUPPORT_FALSE@support_dir = +@BUILD_SUPPORT_TRUE@support_dir = support +SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) $(support_dir) data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm # Keep in sync with SUBDIRS -DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm +DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native $(support_dir) data runtime scripts man samples tools msvc docs acceptance-tests llvm SUBMODULE_ERROR = 'Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date' EXTRA_DIST = \ README.md \ diff --git a/README.md b/README.md index facec5b238..9ba3c4fc98 100644 --- a/README.md +++ b/README.md @@ -308,16 +308,6 @@ should be used. * Or you can specify a path to a libgdiplus. -* `--disable-shared-memory` - - * Use this option to disable the use of shared memory in -Mono (this is equivalent to setting the MONO_DISABLE_SHM -environment variable, although this removes the feature -completely). - - * Disabling the shared memory support will disable certain -features like cross-process named mutexes. - * `--enable-minimal=LIST` * Use this feature to specify optional runtime diff --git a/acceptance-tests/Makefile.am b/acceptance-tests/Makefile.am index 2e47df81bd..135e6968e6 100644 --- a/acceptance-tests/Makefile.am +++ b/acceptance-tests/Makefile.am @@ -14,6 +14,7 @@ RUNTIME = MONO_PATH=$(CLASS) $(abs_top_builddir)/runtime/mono-wrapper --debug TOOLS_RUNTIME = MONO_PATH=$(TOOLS_CLASS) $(abs_top_builddir)/runtime/mono-wrapper --debug MCS = $(TOOLS_RUNTIME) $(CSC) -nologo -noconfig -lib:$(CLASS) -r:System.dll -r:System.Core.dll -r:System.Xml.dll -r:Microsoft.CSharp.dll ILASM = $(TOOLS_RUNTIME) $(TOOLS_CLASS)/ilasm.exe +XUNIT = $(RUNTIME) $(abs_top_builddir)/external/xunit-binaries/xunit.console.exe include versions.mk include profiler-stress.mk diff --git a/acceptance-tests/Makefile.in.REMOVED.git-id b/acceptance-tests/Makefile.in.REMOVED.git-id index e068fc9583..2cface7357 100644 --- a/acceptance-tests/Makefile.in.REMOVED.git-id +++ b/acceptance-tests/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -fa3deb0e32592c4b1df3beb35a88ba20c203d4a3 \ No newline at end of file +1f1cceb22b20c4572e28fe691242ed1310de17b6 \ No newline at end of file diff --git a/acceptance-tests/SUBMODULES.json b/acceptance-tests/SUBMODULES.json index 4d70a4150a..2d8ac86e40 100644 --- a/acceptance-tests/SUBMODULES.json +++ b/acceptance-tests/SUBMODULES.json @@ -1,16 +1,16 @@ [ { "name": "roslyn", - "url": "git://github.com/dotnet/roslyn.git", - "rev": "322bd5b2bbf07df6a67de35cbcb2365484412f70", - "remote-branch": "origin/master", - "branch": "master", + "url": "git://github.com/mono/roslyn.git", + "rev": "1d9895045041925490038c5df0d8f947d8dcbd7f", + "remote-branch": "origin/mono-testing", + "branch": "mono-testing", "directory": "roslyn" }, { "name": "coreclr", "url": "git://github.com/mono/coreclr.git", - "rev": "d0e6a36f782f5ee1ca0b7d3ec0c55725c3571b1f", + "rev": "83d8279997d8ce4ad344ff9b937b2d13d074dcaa", "remote-branch": "origin/mono", "branch": "mono", "directory": "coreclr" @@ -18,7 +18,7 @@ { "name": "ms-test-suite", "url": "git@github.com:xamarin/ms-test-suite.git", - "rev": "25f495326e141163d59e52ef499227a2f38fe036", + "rev": "67f29dfc0741b5311dd746c75760963a2915e648", "remote-branch": "origin/master", "branch": "master", "directory": "ms-test-suite" diff --git a/acceptance-tests/coreclr.mk.REMOVED.git-id b/acceptance-tests/coreclr.mk.REMOVED.git-id index d31cc9abb7..8f6757275d 100644 --- a/acceptance-tests/coreclr.mk.REMOVED.git-id +++ b/acceptance-tests/coreclr.mk.REMOVED.git-id @@ -1 +1 @@ -6fc6a28236467657b04c41902a5452ebf4d475c2 \ No newline at end of file +4cc234e1abb16add35f675272bf36aa78fb4f1b9 \ No newline at end of file diff --git a/acceptance-tests/roslyn.mk b/acceptance-tests/roslyn.mk index a91c68d986..c4e8c86649 100644 --- a/acceptance-tests/roslyn.mk +++ b/acceptance-tests/roslyn.mk @@ -1,18 +1,5 @@ check-roslyn: @$(MAKE) validate-roslyn RESET_VERSIONS=1 - @if [ -z $$PREFIX ]; then echo "You need to set PREFIX to the prefix of the Mono installation that should be used for testing Roslyn." && exit 1; fi - sed -i -e 's/\\4.5-api"/\\4.5"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \ - export MSBuildExtensionsPath=$$PREFIX/lib/mono/xbuild; \ - MONO_DOTNET_PORTABLE_DIR=$$PREFIX/lib/mono/xbuild-frameworks/.NETPortable/; \ - if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v4.6" ]; then \ - mkdir -p $$MONO_DOTNET_PORTABLE_DIR; \ - curl -SL "http://download.mono-project.com/third-party/RoslynBuildDependencies.zip" > /tmp/RoslynBuildDependencies.zip; \ - unzip -o /tmp/RoslynBuildDependencies.zip -d /tmp/RoslynBuildDependencies; \ - cp -r /tmp/RoslynBuildDependencies/PortableReferenceAssemblies/* $$MONO_DOTNET_PORTABLE_DIR; \ - fi; \ cd $(ROSLYN_PATH); \ - sed -i -e 'N; s/bootstrapArg=".*\n.*"/bootstrapArg=""/g' cibuild.sh; \ - sed -i -e 's#-xml Binaries/\$$BUILD_CONFIGURATION/xUnitResults/#-nunit $(abs_top_builddir)/acceptance-tests/TestResult-#g' cibuild.sh; \ - ./cibuild.sh --mono-path $$PREFIX/bin || EXIT_CODE=1; \ - sed -i -e 's/\\4.5"/\\4.5-api"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \ - exit $$EXIT_CODE + ./mono-testing.sh "$(XUNIT)" || exit; \ + echo "done" diff --git a/config.h.in b/config.h.in index d947cfbca9..90d71a108f 100644 --- a/config.h.in +++ b/config.h.in @@ -42,7 +42,11 @@ /* Icall tables disabled */ #undef DISABLE_ICALL_TABLES -/* Disable the JIT, only full-aot mode will be supported by the runtime. */ +/* Disable the interpreter. */ +#undef DISABLE_INTERPRETER + +/* Disable the JIT, only full-aot mode or interpreter will be supported by the + runtime. */ #undef DISABLE_JIT /* Disable support for huge assemblies */ @@ -142,9 +146,6 @@ /* Icall symbol map enabled */ #undef ENABLE_ICALL_SYMBOL_MAP -/* Enable Interpreter */ -#undef ENABLE_INTERPRETER - /* Enable the LLVM back end */ #undef ENABLE_LLVM @@ -355,6 +356,9 @@ /* Define to 1 if you have the `getdomainname' function. */ #undef HAVE_GETDOMAINNAME +/* Define to 1 if you have the `getentropy' function. */ +#undef HAVE_GETENTROPY + /* Define to 1 if you have the `getfsstat' function. */ #undef HAVE_GETFSSTAT @@ -406,6 +410,9 @@ /* Define to 1 if you have the `getpwuid_r' function. */ #undef HAVE_GETPWUID_R +/* Define to 1 if you have the `getrandom' function. */ +#undef HAVE_GETRANDOM + /* Define to 1 if you have the `getresuid' function. */ #undef HAVE_GETRESUID @@ -917,6 +924,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PRCTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RANDOM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H diff --git a/configure.REMOVED.git-id b/configure.REMOVED.git-id index f4ee0921e0..92d39d92f3 100644 --- a/configure.REMOVED.git-id +++ b/configure.REMOVED.git-id @@ -1 +1 @@ -3f09b601878b3b0733df5bf60b63d9f073a2ddd9 \ No newline at end of file +d13f7ea6116e119ab479d11eb1c2998854e15762 \ No newline at end of file diff --git a/configure.ac.REMOVED.git-id b/configure.ac.REMOVED.git-id index 652633362c..ef34d9ebdf 100644 --- a/configure.ac.REMOVED.git-id +++ b/configure.ac.REMOVED.git-id @@ -1 +1 @@ -5c436fa207f4194311d1484a2af27b92af78515a \ No newline at end of file +c88fcfe91d4abdcba2e28a486d695c94df35b127 \ No newline at end of file diff --git a/data/lldb/monobt.py b/data/lldb/monobt.py index 8b2a973b82..162e30f2b6 100644 --- a/data/lldb/monobt.py +++ b/data/lldb/monobt.py @@ -11,9 +11,9 @@ def print_frames(thread, num_frames, current_thread): pc = str(frame.addr) var = frame function_name = frame.GetFunctionName() - if function_name == "ves_exec_method_with_context": + if function_name == "interp_exec_method_full": try: - s = 'frame->runtime_method->method' + s = 'frame->imethod->method' klassname = frame.EvaluateExpression('(char*) ' + s + '->klass->name').summary[1:-1] methodname = frame.EvaluateExpression('(char*) ' + s + '->name').summary[1:-1] diff --git a/data/net_4_5/machine.config b/data/net_4_5/machine.config index df27ec4003..d17369394e 100644 --- a/data/net_4_5/machine.config +++ b/data/net_4_5/machine.config @@ -11,11 +11,11 @@
-
+
diff --git a/docs/api-style.css b/docs/api-style.css index 1f6483919c..f8f9c27a4a 100644 --- a/docs/api-style.css +++ b/docs/api-style.css @@ -43,6 +43,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; diff --git a/docs/deploy/api-style.css b/docs/deploy/api-style.css index 1f6483919c..f8f9c27a4a 100644 --- a/docs/deploy/api-style.css +++ b/docs/deploy/api-style.css @@ -43,6 +43,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; diff --git a/docs/deploy/mono-api-assembly.html b/docs/deploy/mono-api-assembly.html index 123928bf7e..eb38d3faa9 100644 --- a/docs/deploy/mono-api-assembly.html +++ b/docs/deploy/mono-api-assembly.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -240,7 +250,10 @@ mono_assembly_close (MonoAssembly *assembly)

Parameters
assembly the assembly to release.
Description
-

This method releases a reference to the assembly. The assembly is only released when all the outstanding references to it are released.

+
+

+ This method releases a reference to the assembly. The assembly is + only released when all the outstanding references to it are released.

@@ -287,7 +300,11 @@ mono_assembly_load (MonoAssemblyName *aname, const char *basedir, MonoImageOpenS value pointed by status is updated with an error code.
Description
-

Loads the assembly referenced by aname, if the value of basedir is not NULL, it attempts to load the assembly from that directory before probing the standard locations.

+
+

+ Loads the assembly referenced by aname, if the value of basedir is not NULL, it + attempts to load the assembly from that directory before probing the standard locations. +

@@ -312,7 +329,14 @@ mono_assembly_load_full (MonoAssemblyName *aname, const char *basedir, MonoImage value pointed by status is updated with an error code.
Description
-

Loads the assembly referenced by aname, if the value of basedir is not NULL, it attempts to load the assembly from that directory before probing the standard locations.

If the assembly is being opened in reflection-only mode (refonly set to TRUE) then no assembly binding takes place.

+
+

+ Loads the assembly referenced by aname, if the value of basedir is not NULL, it + attempts to load the assembly from that directory before probing the standard locations. +

+ If the assembly is being opened in reflection-only mode (refonly set to TRUE) then no + assembly binding takes place. +

@@ -337,7 +361,10 @@ mono_assembly_loaded (MonoAssemblyName *aname) a MonoAssembly that matches the MonoAssemblyName specified.
Description
-

This is used to determine if the specified assembly has been loaded

+
+

+ This is used to determine if the specified assembly has been loaded +

@@ -368,7 +395,15 @@ mono_assembly_load_from (MonoImage *image, const char *fname, image did not contain an assembly reference table.

Description
-

If the provided image has an assembly reference, it will process the given image as an assembly with the given name.

Most likely you want to use the `api:mono_assembly_load_full` method instead.

This is equivalent to calling `api:mono_assembly_load_from_full` with the refonly parameter set to FALSE.

+
+

+ If the provided image has an assembly reference, it will process the given + image as an assembly with the given name. +

+ Most likely you want to use the `api:mono_assembly_load_full` method instead. +

+ This is equivalent to calling `api:mono_assembly_load_from_full` with the + refonly parameter set to FALSE.

@@ -398,7 +433,13 @@ mono_assembly_load_from_full (MonoImage *image, const char*fname, reason with status being set to MONO_IMAGE_INVALID if the image did not contain an assembly reference table.
Description
-

If the provided image has an assembly reference, it will process the given image as an assembly with the given name.

Most likely you want to use the `api:mono_assembly_load_full` method instead.

+
+

+ If the provided image has an assembly reference, it will process the given + image as an assembly with the given name. +

+ Most likely you want to use the `api:mono_assembly_load_full` method instead. +

@@ -422,7 +463,18 @@ mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *sta
NULL on failure, or a pointer to a MonoAssembly on success.
Description
-

Loads a MonoAssembly from a name. The name is parsed using `api:mono_assembly_name_parse`, so it might contain a qualified type name, version, culture and token.

This will load the assembly from the file whose name is derived from the assembly name by appending the .dll extension.

The assembly is loaded from either one of the extra Global Assembly Caches specified by the extra GAC paths (specified by the MONO_GAC_PREFIX environment variable) or if that fails from the GAC.

+
+

+ Loads a MonoAssembly from a name. The name is parsed using `api:mono_assembly_name_parse`, + so it might contain a qualified type name, version, culture and token. +

+ This will load the assembly from the file whose name is derived from the assembly name + by appending the .dll extension. +

+ The assembly is loaded from either one of the extra Global Assembly Caches specified + by the extra GAC paths (specified by the MONO_GAC_PREFIX environment variable) or + if that fails from the GAC. +

@@ -448,7 +500,21 @@ mono_assembly_open (const char *filename, MonoImageOpenStatus *status) assembly or NULL on error. Details about the error are stored in the status variable.
Description
-

This loads an assembly from the specified filename. The filename allows a local URL (starting with a file:// prefix). If a file prefix is used, the filename is interpreted as a URL, and the filename is URL-decoded. Otherwise the file is treated as a local path.

First, an attempt is made to load the assembly from the bundled executable (for those deployments that have been done with the mkbundle tool or for scenarios where the assembly has been registered as an embedded assembly). If this is not the case, then the assembly is loaded from disk using `api:mono_image_open_full`.

If the pointed assembly does not live in the Global Assembly Cache, a shadow copy of the assembly is made.

+
+

+ This loads an assembly from the specified filename. The filename allows + a local URL (starting with a file:// prefix). If a file prefix is used, the + filename is interpreted as a URL, and the filename is URL-decoded. Otherwise the file + is treated as a local path. +

+ First, an attempt is made to load the assembly from the bundled executable (for those + deployments that have been done with the mkbundle tool or for scenarios where the + assembly has been registered as an embedded assembly). If this is not the case, then + the assembly is loaded from disk using `api:mono_image_open_full`. +

+ If the pointed assembly does not live in the Global Assembly Cache, a shadow copy of + the assembly is made. +

@@ -473,7 +539,24 @@ mono_assembly_open_full (const char *filename, MonoImageOpenStatus *status, gboo to the assembly.
Description
-

This loads an assembly from the specified filename. The filename allows a local URL (starting with a file:// prefix). If a file prefix is used, the filename is interpreted as a URL, and the filename is URL-decoded. Otherwise the file is treated as a local path.

First, an attempt is made to load the assembly from the bundled executable (for those deployments that have been done with the mkbundle tool or for scenarios where the assembly has been registered as an embedded assembly). If this is not the case, then the assembly is loaded from disk using `api:mono_image_open_full`.

If the pointed assembly does not live in the Global Assembly Cache, a shadow copy of the assembly is made.

If refonly is set to true, then the assembly is loaded purely for inspection with the System.Reflection API.

+
+

+ This loads an assembly from the specified filename. The filename allows + a local URL (starting with a file:// prefix). If a file prefix is used, the + filename is interpreted as a URL, and the filename is URL-decoded. Otherwise the file + is treated as a local path. +

+ First, an attempt is made to load the assembly from the bundled executable (for those + deployments that have been done with the mkbundle tool or for scenarios where the + assembly has been registered as an embedded assembly). If this is not the case, then + the assembly is loaded from disk using `api:mono_image_open_full`. +

+ If the pointed assembly does not live in the Global Assembly Cache, a shadow copy of + the assembly is made. +

+ If refonly is set to true, then the assembly is loaded purely for inspection with + the System.Reflection API. +

@@ -494,7 +577,16 @@ mono_set_assemblies_path (const char* path)

Parameters
path list of paths that contain directories where Mono will look for assemblies
Description
-

Use this method to override the standard assembly lookup system and override any assemblies coming from the GAC. This is the method that supports the MONO_PATH variable.

Notice that MONO_PATH and this method are really a very bad idea as it prevents the GAC from working and it prevents the standard resolution mechanisms from working. Nonetheless, for some debugging situations and bootstrapping setups, this is useful to have.

+
+

+ Use this method to override the standard assembly lookup system and + override any assemblies coming from the GAC. This is the method + that supports the MONO_PATH variable. +

+ Notice that MONO_PATH and this method are really a very bad idea as + it prevents the GAC from working and it prevents the standard + resolution mechanisms from working. Nonetheless, for some debugging + situations and bootstrapping setups, this is useful to have.

@@ -514,7 +606,10 @@ mono_set_rootdir (void)

Description
-

Registers the root directory for the Mono runtime, for Linux and Solaris 10, this auto-detects the prefix where Mono was installed.

+
+

+ Registers the root directory for the Mono runtime, for Linux and Solaris 10, + this auto-detects the prefix where Mono was installed.

@@ -561,7 +656,14 @@ mono_assembly_foreach (GFunc func, gpointer user_data)

Parameters
func function to invoke for each assembly loaded
user_data data passed to the callback
Description
-

Invokes the provided func callback for each assembly loaded into the runtime. The first parameter passed to the callback is the MonoAssembly*, and the second parameter is the user_data.

This is done for all assemblies loaded in the runtime, not just those loaded in the current application domain.

+
+

+ Invokes the provided func callback for each assembly loaded into + the runtime. The first parameter passed to the callback is the + MonoAssembly*, and the second parameter is the user_data. +

+ This is done for all assemblies loaded in the runtime, not just + those loaded in the current application domain.

@@ -585,7 +687,8 @@ mono_assembly_get_image (MonoAssembly *assembly)
the MonoImage associated with this assembly.
Description
-

+
+

@@ -608,7 +711,8 @@ mono_assembly_get_main (void)
the assembly for the application, the first assembly that is loaded by the VM
Description
-

+
+

@@ -632,7 +736,10 @@ mono_assembly_get_name (MonoAssembly *assembly)
the MonoAssemblyName associated with this assembly.
Description
-

The returned name's lifetime is the same as assembly's.

+
+

+ The returned name's lifetime is the same as assembly's. +

@@ -655,7 +762,10 @@ mono_assembly_getrootdir (void)
a string with the directory, this string should not be freed.
Description
-

Obtains the root directory used for looking up assemblies.

+
+

+ Obtains the root directory used for looking up assemblies. +

@@ -676,7 +786,9 @@ mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *an

Parameters
image pointer to the MonoImage to extract the information from.
index index to the assembly reference in the image.
aname pointer to a MonoAssemblyName that will hold the returned value.
Description
-

Fills out the aname with the assembly name of the index assembly reference in image.

+
+

+ Fills out the aname with the assembly name of the index assembly reference in image.

@@ -701,7 +813,9 @@ mono_assembly_loaded_full (MonoAssemblyName *aname, gboolean refonly) a MonoAssembly that matches the MonoAssemblyName specified.
Description
-

This is used to determine if the specified assembly has been loaded

+
+

+ This is used to determine if the specified assembly has been loaded

@@ -740,7 +854,9 @@ mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status)

Parameters
image
status
Description
-

This method is now a no-op, it does nothing other than setting the status to MONO_IMAGE_OK

+
+

+ This method is now a no-op, it does nothing other than setting the status to MONO_IMAGE_OK

@@ -833,7 +949,14 @@ mono_assembly_setrootdir (const char *root_dir)

Parameters
root_dir The pathname of the root directory where we will locate assemblies
Description
-

This routine sets the internal default root directory for looking up assemblies.

This is used by Windows installations to compute dynamically the place where the Mono assemblies are located.

+
+

+ This routine sets the internal default root directory for looking up + assemblies. +

+ This is used by Windows installations to compute dynamically the + place where the Mono assemblies are located. +

@@ -904,7 +1027,11 @@ mono_assembly_name_new (const char *name)
a newly allocated structure or NULL if there was any failure.
Description
-

Allocate a new MonoAssemblyName and fill its values from the passed name.

+
+

+ Allocate a new MonoAssemblyName and fill its values from the + passed name. +

@@ -997,7 +1124,10 @@ mono_assembly_name_free (MonoAssemblyName *aname)

Parameters
aname assembly name to free
Description
-

Frees the provided assembly name object. (it does not frees the object itself, only the name members).

+
+

+ Frees the provided assembly name object. + (it does not frees the object itself, only the name members).

@@ -1022,7 +1152,11 @@ mono_stringify_assembly_name (MonoAssemblyName *aname) the assembly name.
Description
-

Convert aname into its string format. The returned string is dynamically allocated and should be freed by the caller.

+
+

+ Convert aname into its string format. The returned string is dynamically + allocated and should be freed by the caller. +

@@ -1046,7 +1180,13 @@ mono_assembly_names_equal (MonoAssemblyName *l, MonoAssemblyName *r)
TRUE if both assembly names are equal.
Description
-

Compares two MonoAssemblyName instances and returns whether they are equal.

This compares the names, the cultures, the release version and their public tokens.

+
+

+ Compares two MonoAssemblyName instances and returns whether they are equal. +

+ This compares the names, the cultures, the release version and their + public tokens. +

diff --git a/docs/deploy/mono-api-class.html b/docs/deploy/mono-api-class.html index 55f74024fd..00e66aa16e 100644 --- a/docs/deploy/mono-api-class.html +++ b/docs/deploy/mono-api-class.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -280,7 +290,14 @@ mono_class_from_name (MonoImage *image, const char* name_space, const char *name

Parameters
image The MonoImage where the type is looked up in
name_space the type namespace
name the type short name.
Description
-

Obtains a MonoClass with a given namespace and a given name which is located in the given MonoImage.

To reference nested classes, use the "/" character as a separator. For example use "Foo/Bar" to reference the class Bar that is nested inside Foo, like this: "class Foo { class Bar {} }".

+
+

+ Obtains a MonoClass with a given namespace and a given name which + is located in the given MonoImage. +

+ To reference nested classes, use the "/" character as a separator. + For example use "Foo/Bar" to reference the class Bar that is nested + inside Foo, like this: "class Foo { class Bar {} }".

@@ -301,7 +318,11 @@ mono_class_from_name_case (MonoImage *image, const char* name_space, const char

Parameters
image The MonoImage where the type is looked up in
name_space the type namespace
name the type short name.
Description
-

Obtains a MonoClass with a given namespace and a given name which is located in the given MonoImage. The namespace and name lookups are case insensitive.

+
+

+ Obtains a MonoClass with a given namespace and a given name which + is located in the given MonoImage. The namespace and name + lookups are case insensitive.

@@ -326,7 +347,10 @@ mono_class_from_typeref (MonoImage *image, guint32 type_token) not be loaded.
Description
-

Creates the MonoClass* structure representing the type defined by the typeref token valid inside image.

+
+

+ Creates the MonoClass* structure representing the type defined by + the typeref token valid inside image.

@@ -352,7 +376,11 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError not be loaded with the error value filled with the information about the error.
Description
-

Creates the MonoClass* structure representing the type defined by the typeref token valid inside image.

+
+

+ Creates the MonoClass* structure representing the type defined by + the typeref token valid inside image. +

@@ -398,7 +426,8 @@ mono_class_array_element_size (MonoClass *klass)
The number of bytes an element of type klass uses when stored into an array.
Description
-

+
+

@@ -422,7 +451,8 @@ mono_class_data_size (MonoClass *klass)
The size of the static class data
Description
-

+
+

@@ -446,7 +476,10 @@ mono_class_enum_basetype (MonoClass *klass)
The underlying type representation for an enumeration.
Description
-

Use this function to get the underlying type for an enumeration value.

+
+

+ Use this function to get the underlying type for an enumeration value. +

@@ -467,7 +500,9 @@ mono_class_get_byref_type (MonoClass *klass)

Parameters
klass the MonoClass to act on
Description
-

+
+

+

@@ -491,7 +526,10 @@ mono_class_get_element_class (MonoClass *klass)
The element class of an array.
Description
-

Use this function to get the element class of an array.

+
+

+ Use this function to get the element class of an array. +

@@ -535,7 +573,8 @@ mono_class_get_field (MonoClass *klass, guint32 field_token) the field, or a NULL value if the field does not belong to this class.
Description
-

+
+

@@ -559,7 +598,11 @@ mono_class_get_field_token (MonoClassField *field)
The token representing the field in the image it was loaded from.
Description
-

Get the token of a field. Note that the tokesn is only valid for the image the field was loaded from. Don't use this function for fields in dynamic types.

+
+

+ Get the token of a field. Note that the tokesn is only valid for the image + the field was loaded from. Don't use this function for fields in dynamic types. +

@@ -627,7 +670,10 @@ mono_class_get_image (MonoClass *klass)
The image where this class is defined.
Description
-

Use this method to get the MonoImage* where this class came from.

+
+

+ Use this method to get the MonoImage* where this class came from. +

@@ -651,7 +697,14 @@ mono_class_get_interfaces (MonoClass* klass, gpointer *iter)
a MonoClass* on each invocation, or NULL when no more are available.
Description
-

This routine is an iterator routine for retrieving the interfaces implemented by this class.

You must pass a gpointer that points to zero and is treated as an opaque handle to iterate over all of the elements. When no more values are available, the return value is NULL.

+
+

+ This routine is an iterator routine for retrieving the interfaces implemented by this class. +

+ You must pass a gpointer that points to zero and is treated as an opaque handle to + iterate over all of the elements. When no more values are + available, the return value is NULL. +

@@ -675,7 +728,8 @@ mono_class_get_name (MonoClass *klass)
The name of the class.
Description
-

+
+

@@ -699,7 +753,8 @@ mono_class_get_namespace (MonoClass *klass)
The namespace of the class.
Description
-

+
+

@@ -723,7 +778,12 @@ mono_class_get_nesting_type (MonoClass *klass)
The container type where this type is nested or NULL if this type is not a nested type.
Description
-

Use this function to obtain the class that the provided MonoClass* is nested on.

If the return is NULL, this indicates that this class is not nested.

+
+

+ Use this function to obtain the class that the provided MonoClass* is nested on. +

+ If the return is NULL, this indicates that this class is not nested. +

@@ -747,7 +807,8 @@ mono_class_get_parent (MonoClass *klass)
The parent class for this class.
Description
-

+
+

@@ -771,7 +832,8 @@ mono_class_get_property_token (MonoProperty *prop)
The ECMA token for the specified property.
Description
-

+
+

@@ -795,7 +857,8 @@ mono_class_get_rank (MonoClass *klass)
The rank for the array (the number of dimensions).
Description
-

+
+

@@ -819,7 +882,10 @@ mono_class_get_type (MonoClass *klass)
The MonoType from the class.
Description
-

This method returns the internal MonoType representation for the class.

+
+

+ This method returns the internal MonoType representation for the class. +

@@ -843,7 +909,10 @@ mono_class_get_type_token (MonoClass *klass)
The type token for the class.
Description
-

This method returns type token for the class.

+
+

+ This method returns type token for the class. +

@@ -867,7 +936,8 @@ mono_class_implements_interface (MonoClass* klass, MonoClass* iface)
TRUE if klass implements interface.
Description
-

+
+

@@ -891,7 +961,10 @@ mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *conte
The new instantiated method
Description
-

Instantiate the generic method method using the generics context context.

+
+

+ Instantiate the generic method method using the generics context context. +

@@ -916,7 +989,11 @@ mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context) on the heap and is owned by the caller. Returns NULL on error.
Description
-

If type is a generic type and context is not NULL, instantiate it using the generics context context.

+
+

+ If type is a generic type and context is not NULL, instantiate it using the + generics context context. +

@@ -941,7 +1018,18 @@ mono_class_init (MonoClass *klass) the type (incorrect assemblies, missing assemblies, methods, etc).
Description
-

Compute the instance_size, class_size and other infos that cannot be computed at mono_class_get time. Also compute vtable_size if possible. Initializes the following fields in klass: - all the fields initialized by mono_class_init_sizes - has_cctor - ghcimpl - inited

LOCKING: Acquires the loader lock.

+
+

+ Compute the instance_size, class_size and other infos that cannot be + computed at mono_class_get time. Also compute vtable_size if possible. + Initializes the following fields in klass: + - all the fields initialized by mono_class_init_sizes + - has_cctor + - ghcimpl + - inited +

+ LOCKING: Acquires the loader lock. +

@@ -965,7 +1053,10 @@ mono_class_instance_size (MonoClass *klass)
The size of an object instance
Description
-

Use to get the size of a class in bytes.

+
+

+ Use to get the size of a class in bytes. +

@@ -990,7 +1081,8 @@ mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass) instance of class klass
Description
-

+
+

@@ -1014,7 +1106,8 @@ mono_class_is_delegate (MonoClass *klass)
TRUE if the MonoClass represents a System.Delegate.
Description
-

+
+

@@ -1038,7 +1131,10 @@ mono_class_is_enum (MonoClass *klass)
TRUE if the MonoClass represents an enumeration.
Description
-

Use this function to determine if the provided MonoClass* represents an enumeration.

+
+

+ Use this function to determine if the provided MonoClass* represents an enumeration. +

@@ -1060,7 +1156,20 @@ mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc,

Parameters
klass class to probe if it is a subclass of another one
klassc the class we suspect is the base class
check_interfaces whether we should perform interface checks
Description
-

This method determines whether klass is a subclass of klassc.

If the check_interfaces flag is set, then if klassc is an interface this method return TRUE if the klass implements the interface or if klass is an interface, if one of its base classes is klass.

If check_interfaces is false, then if klass is not an interface, it returns TRUE if the klass is a subclass of klassc.

if klass is an interface and klassc is System.Object, then this function returns TRUE.

+
+

+ This method determines whether klass is a subclass of klassc. +

+ If the check_interfaces flag is set, then if klassc is an interface + this method return TRUE if the klass implements the interface or + if klass is an interface, if one of its base classes is klass. +

+ If check_interfaces is false, then if klass is not an interface, + it returns TRUE if the klass is a subclass of klassc. +

+ if klass is an interface and klassc is System.Object, then this function + returns TRUE. +

@@ -1084,7 +1193,11 @@ mono_class_is_valuetype (MonoClass *klass)
TRUE if the MonoClass represents a ValueType, FALSE if it represents a reference type.
Description
-

Use this method to determine if the provided MonoClass* represents a value type, or a reference type.

+
+

+ Use this method to determine if the provided MonoClass* represents a value type, + or a reference type. +

@@ -1108,7 +1221,10 @@ mono_class_min_align (MonoClass *klass)
minimum alignment requirements
Description
-

Use to get the computed minimum alignment requirements for the specified class.

+
+

+ Use to get the computed minimum alignment requirements for the specified class. +

@@ -1150,7 +1266,8 @@ mono_class_num_events (MonoClass *klass)
The number of events in the class.
Description
-

+
+

@@ -1174,7 +1291,8 @@ mono_class_num_fields (MonoClass *klass)
The number of static and instance fields in the class.
Description
-

+
+

@@ -1198,7 +1316,8 @@ mono_class_num_methods (MonoClass *klass)
The number of methods in the class.
Description
-

+
+

@@ -1222,7 +1341,8 @@ mono_class_num_properties (MonoClass *klass)
The number of properties in the class.
Description
-

+
+

@@ -1246,7 +1366,11 @@ mono_class_value_size (MonoClass *klass, guint32 *align)
the size of a value of kind klass
Description
-

This function is used for value types, and return the space and the alignment to store that kind of value object.

+
+

+ This function is used for value types, and return the + space and the alignment to store that kind of value object. +

@@ -1267,7 +1391,10 @@ mono_class_vtable (MonoDomain *domain, MonoClass *klass)

Parameters
domain the application domain
class the class to initialize
Description
-
VTables are domain specific because we create domain specific code, and they contain the domain specific static class data. On failure, NULL is returned, and class->exception_type is set.
+
+ VTables are domain specific because we create domain specific code, and + they contain the domain specific static class data. + On failure, NULL is returned, and class->exception_type is set.
@@ -1295,7 +1422,14 @@ mono_class_get_fields (MonoClass* klass, gpointer *iter)
a MonoClassField* on each iteration, or NULL when no more fields are available.
Description
-

This routine is an iterator routine for retrieving the fields in a class.

You must pass a gpointer that points to zero and is treated as an opaque handle to iterate over all of the elements. When no more values are available, the return value is NULL.

+
+

+ This routine is an iterator routine for retrieving the fields in a class. +

+ You must pass a gpointer that points to zero and is treated as an opaque handle to + iterate over all of the elements. When no more values are + available, the return value is NULL. +

@@ -1319,7 +1453,10 @@ mono_class_get_field_from_name (MonoClass *klass, const char *name)
The MonoClassField pointer of the named field or NULL
Description
-

Search the class klass and its parents for a field with the name name.

+
+

+ Search the class klass and its parents for a field with the name name. +

@@ -1343,7 +1480,14 @@ mono_class_get_methods (MonoClass* klass, gpointer *iter)
a MonoMethod on each iteration or NULL when no more methods are available.
Description
-

This routine is an iterator routine for retrieving the fields in a class.

You must pass a gpointer that points to zero and is treated as an opaque handle to iterate over all of the elements. When no more values are available, the return value is NULL.

+
+

+ This routine is an iterator routine for retrieving the fields in a class. +

+ You must pass a gpointer that points to zero and is treated as an opaque handle to + iterate over all of the elements. When no more values are + available, the return value is NULL. +

@@ -1364,7 +1508,10 @@ mono_class_get_method_from_name (MonoClass *klass, const char *name, int param_c

Parameters
klass where to look for the method
name name of the method
param_count number of parameters. -1 for any number.
Description
-

Obtains a MonoMethod with a given name and number of parameters. It only works if there are no multiple signatures for any given method name.

+
+

+ Obtains a MonoMethod with a given name and number of parameters. + It only works if there are no multiple signatures for any given method name.

@@ -1385,7 +1532,10 @@ mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int p

Parameters
klass where to look for the method
name_space name of the method
param_count number of parameters. -1 for any number.
flags flags which must be set in the method
Description
-

Obtains a MonoMethod with a given name and number of parameters. It only works if there are no multiple signatures for any given method name.

+
+

+ Obtains a MonoMethod with a given name and number of parameters. + It only works if there are no multiple signatures for any given method name.

@@ -1409,7 +1559,15 @@ mono_class_get_nested_types (MonoClass* klass, gpointer *iter)
a Monoclass* on each invocation, or NULL when no more are available.
Description
-

This routine is an iterator routine for retrieving the nested types of a class. This works only if klass is non-generic, or a generic type definition.

You must pass a gpointer that points to zero and is treated as an opaque handle to iterate over all of the elements. When no more values are available, the return value is NULL.

+
+

+ This routine is an iterator routine for retrieving the nested types of a class. + This works only if klass is non-generic, or a generic type definition. +

+ You must pass a gpointer that points to zero and is treated as an opaque handle to + iterate over all of the elements. When no more values are + available, the return value is NULL. +

@@ -1433,7 +1591,14 @@ mono_class_get_properties (MonoClass* klass, gpointer *iter)
a MonoProperty* on each invocation, or NULL when no more are available.
Description
-

This routine is an iterator routine for retrieving the properties in a class.

You must pass a gpointer that points to zero and is treated as an opaque handle to iterate over all of the elements. When no more values are available, the return value is NULL.

+
+

+ This routine is an iterator routine for retrieving the properties in a class. +

+ You must pass a gpointer that points to zero and is treated as an opaque handle to + iterate over all of the elements. When no more values are + available, the return value is NULL. +

@@ -1458,7 +1623,9 @@ mono_class_get_property_from_name (MonoClass *klass, const char *name) does not exist on the klass.
Description
-

Use this method to lookup a property in a class

+
+

+ Use this method to lookup a property in a class

@@ -1482,7 +1649,14 @@ mono_class_get_events (MonoClass* klass, gpointer *iter)
a MonoEvent* on each invocation, or NULL when no more are available.
Description
-

This routine is an iterator routine for retrieving the properties in a class.

You must pass a gpointer that points to zero and is treated as an opaque handle to iterate over all of the elements. When no more values are available, the return value is NULL.

+
+

+ This routine is an iterator routine for retrieving the properties in a class. +

+ You must pass a gpointer that points to zero and is treated as an opaque handle to + iterate over all of the elements. When no more values are + available, the return value is NULL. +

@@ -1511,7 +1685,8 @@ mono_field_get_data (MonoClassField *field) data if it has an RVA flag.
Description
-

+
+

@@ -1535,7 +1710,8 @@ mono_field_get_offset (MonoClassField *field)
The field offset.
Description
-

+
+

@@ -1585,7 +1761,10 @@ mono_method_can_access_field (MonoMethod *method, MonoClassField *field) the accessibility rules of the CLI.
Description
-

Used to determine if a method is allowed to access the specified field.

+
+

+ Used to determine if a method is allowed to access the specified field. +

@@ -1610,7 +1789,10 @@ mono_method_can_access_method (MonoMethod *method, MonoMethod *called) the accessibility rules of the CLI.
Description
-

Used to determine if the method is allowed to access the specified called method.

+
+

+ Used to determine if the method is allowed to access the specified called method. +

diff --git a/docs/deploy/mono-api-counters.html b/docs/deploy/mono-api-counters.html index d4894c3f93..51b4f8f122 100644 --- a/docs/deploy/mono-api-counters.html +++ b/docs/deploy/mono-api-counters.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -244,7 +254,10 @@ mono_counters_dump (int section_mask, FILE *outfile)

Parameters
section_mask The sections to dump counters for
outfile a FILE to dump the results to
Description
-
Displays the counts of all the enabled counters registered. To filter by variance, you can OR one or more variance with the specific section you want. Use MONO_COUNTER_SECTION_MASK to dump all categories of a specific variance.
+
+ Displays the counts of all the enabled counters registered. + To filter by variance, you can OR one or more variance with the specific section you want. + Use MONO_COUNTER_SECTION_MASK to dump all categories of a specific variance.
@@ -265,6 +278,7 @@ mono_counters_enable (int section_mask)

Parameters
sectionmask a mask listing the sections that will be displayed
Description
-
This is used to track which counters will be displayed.
+
+ This is used to track which counters will be displayed.
diff --git a/docs/deploy/mono-api-debug.html b/docs/deploy/mono-api-debug.html index 71fa231a7f..d83560fe1e 100644 --- a/docs/deploy/mono-api-debug.html +++ b/docs/deploy/mono-api-debug.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -259,7 +269,10 @@ mono_debug_symfile_free_location (MonoDebugSourceLocation *location)

Description
-

Free a MonoDebugSourceLocation returned by mono_debug_symfile_lookup_location

+
+

+ Free a MonoDebugSourceLocation returned by + mono_debug_symfile_lookup_location

@@ -297,7 +310,11 @@ mono_debug_symfile_lookup_locals (MonoDebugMethodInfo *minfo)

Description
-

Return information about the local variables of minfo from the symbol file. Return NULL if no information can be found. The result should be freed using mono_debug_symfile_free_locals.

+
+

+ Return information about the local variables of minfo from the symbol file. + Return NULL if no information can be found. + The result should be freed using mono_debug_symfile_free_locals.

@@ -318,7 +335,11 @@ mono_debug_symfile_lookup_location (MonoDebugMethodInfo *minfo, uint32_t offset)

Parameters
minfo A MonoDebugMethodInfo which can be retrieved by mono_debug_lookup_method.
offset IL offset within the corresponding method's CIL code.
Description
-

This function is similar to mono_debug_lookup_location, but we already looked up the method and also already did the native address -> IL offset mapping.

+
+

+ This function is similar to mono_debug_lookup_location, but we + already looked up the method and also already did the + native address -> IL offset mapping.

@@ -428,7 +449,9 @@ mono_debug_enabled (void)

Description
-

Returns true is debug information is enabled. This doesn't relate if a debugger is present or not.

+
+

+ Returns true is debug information is enabled. This doesn't relate if a debugger is present or not.

@@ -464,7 +487,8 @@ mono_debug_free_source_location (MonoDebugSourceLocation *location)

Parameters
location A MonoDebugSourceLocation
Description
-
Frees the location.
+
+ Frees the location.
@@ -499,7 +523,11 @@ mono_debug_lookup_method (MonoMethod *method)

Description
-

Lookup symbol file information for the method method. The returned MonoDebugMethodInfo is a private structure, but it can be passed to mono_debug_symfile_lookup_location.

+
+

+ Lookup symbol file information for the method method. The returned + MonoDebugMethodInfo is a private structure, but it can be passed to + mono_debug_symfile_lookup_location.

@@ -535,7 +563,12 @@ mono_debug_lookup_source_location (MonoMethod *method, guint32 address, MonoDoma

Parameters
address Native offset within the method's machine code.
Description
-
Lookup the source code corresponding to the machine instruction located at native offset address within method. The returned MonoDebugSourceLocation contains both file / line number information and the corresponding IL offset. It must be freed by mono_debug_free_source_location.
+
+ Lookup the source code corresponding to the machine instruction located at + native offset address within method. + The returned MonoDebugSourceLocation contains both file / line number + information and the corresponding IL offset. It must be freed by + mono_debug_free_source_location.
@@ -571,7 +604,9 @@ mono_debug_print_stack_frame (MonoMethod *method, guint32 native_offset, MonoDom

Parameters
native_offset Native offset within the method's machine code.
Description
-
Conventient wrapper around mono_debug_lookup_source_location which can be used if you only want to use the location to print a stack frame.
+
+ Conventient wrapper around mono_debug_lookup_source_location which can be + used if you only want to use the location to print a stack frame.
@@ -606,7 +641,10 @@ mono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, guint

Description
-

Compute the IL offset corresponding to native_offset inside the native code of method in domain.

+
+

+ Compute the IL offset corresponding to native_offset inside the native + code of method in domain.

diff --git a/docs/deploy/mono-api-domains.html b/docs/deploy/mono-api-domains.html index dc070b7418..c0f41a6b52 100644 --- a/docs/deploy/mono-api-domains.html +++ b/docs/deploy/mono-api-domains.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -257,7 +267,23 @@ mono_domain_create (void) loaded into it.
Description
-

Creates a new application domain, the unmanaged representation of the actual domain.

Application domains provide an isolation facilty for assemblies. You can load assemblies and execute code in them that will not be visible to other application domains. This is a runtime-based virtualization technology.

It is possible to unload domains, which unloads the assemblies and data that was allocated in that domain.

When a domain is created a mempool is allocated for domain-specific structures, along a dedicated code manager to hold code that is associated with the domain.

+
+

+ Creates a new application domain, the unmanaged representation + of the actual domain. +

+ Application domains provide an isolation facilty for assemblies. You + can load assemblies and execute code in them that will not be visible + to other application domains. This is a runtime-based virtualization + technology. +

+ It is possible to unload domains, which unloads the assemblies and + data that was allocated in that domain. +

+ When a domain is created a mempool is allocated for domain-specific + structures, along a dedicated code manager to hold code that is + associated with the domain. +

@@ -303,7 +329,11 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
TRUE if succeeded, FALSE if there was a timeout
Description
-

Request finalization of all finalizable objects inside domain. Wait timeout msecs for the finalization to complete.

+
+

+ Request finalization of all finalizable objects inside domain. Wait + timeout msecs for the finalization to complete. +

@@ -324,7 +354,12 @@ mono_domain_foreach (MonoDomainFunc func, gpointer user_data)

Parameters
func function to invoke with the domain data
user_data user-defined pointer that is passed to the supplied func fo reach domain
Description
-

Use this method to safely iterate over all the loaded application domains in the current runtime. The provided func is invoked with a pointer to the MonoDomain and is given the value of the user_data parameter which can be used to pass state to your called routine.

+
+

+ Use this method to safely iterate over all the loaded application + domains in the current runtime. The provided func is invoked with a + pointer to the MonoDomain and is given the value of the user_data + parameter which can be used to pass state to your called routine.

@@ -345,7 +380,11 @@ mono_domain_free (MonoDomain *domain, gboolean force)

Parameters
domain the domain to release
force if TRUE, it allows the root domain to be released (used at shutdown only).
Description
-

This releases the resources associated with the specific domain. This is a low-level function that is invoked by the AppDomain infrastructure when necessary.

+
+

+ This releases the resources associated with the specific domain. + This is a low-level function that is invoked by the AppDomain infrastructure + when necessary.

@@ -408,7 +447,11 @@ mono_domain_get_friendly_name (MonoDomain *domain)
The friendly name of domain. Can be NULL if not yet set.
Description
-

The returned string's lifetime is the same as domain's. Consider copying it if you need to store it somewhere.

+
+

+ The returned string's lifetime is the same as domain's. Consider + copying it if you need to store it somewhere. +

@@ -431,7 +474,12 @@ mono_domain_get_id (MonoDomain *domain)
The unique ID for domain.
Description
-

A domain ID is guaranteed to be unique for as long as the domain using it is alive. It may be reused later once the domain has been unloaded.

+
+

+ A domain ID is guaranteed to be unique for as long as the domain + using it is alive. It may be reused later once the domain has been + unloaded. +

@@ -454,7 +502,12 @@ mono_domain_get ()
the current domain
Description
-

This method returns the value of the current MonoDomain that this thread and code are running under. To obtain the root domain use mono_get_root_domain API.

+
+

+ This method returns the value of the current MonoDomain that this thread + and code are running under. To obtain the root domain use + mono_get_root_domain API. +

@@ -478,7 +531,8 @@ mono_domain_has_type_resolve (MonoDomain *domain)
TRUE if the AppDomain.TypeResolve field has been set.
Description
-

+
+

@@ -538,7 +592,13 @@ mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *co

Parameters
domain MonoDomain initialized with the appdomain we want to change
base_dir new base directory for the appdomain
config_file_name path to the new configuration for the app domain
Description
-

Used to set the system configuration for an appdomain

Without using this, embedded builds will get 'System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.' for some managed calls.

+
+

+ Used to set the system configuration for an appdomain +

+ Without using this, embedded builds will get 'System.Configuration.ConfigurationErrorsException: + Error Initializing the configuration system. ---> System.ArgumentException: + The 'ExeConfigFilename' argument cannot be null.' for some managed calls.

@@ -559,7 +619,9 @@ mono_domain_set_internal (MonoDomain *domain)

Parameters
domain the new domain
Description
-

Sets the current domain to domain.

+
+

+ Sets the current domain to domain.

@@ -583,7 +645,11 @@ mono_domain_set (MonoDomain *domain, gboolean force)
TRUE on success; FALSE if the domain is unloaded
Description
-

Set the current appdomain to domain. If force is set, set it even if it is being unloaded.

+
+

+ Set the current appdomain to domain. If force is set, set it even + if it is being unloaded. +

@@ -607,7 +673,13 @@ mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb)
A MonoReflectionAssembly or NULL if not found
Description
-

This routine invokes the internal System.AppDomain.DoTypeResolve and returns the assembly that matches name.

If name is null, the value of ((TypeBuilder)tb).FullName is used instead

+
+

+ This routine invokes the internal System.AppDomain.DoTypeResolve and returns + the assembly that matches name. +

+ If name is null, the value of ((TypeBuilder)tb).FullName is used instead +

@@ -643,7 +715,21 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)

Parameters
domain The domain to unload
exc Exception information
Description
-

Unloads an appdomain. Follows the process outlined in: http://blogs.gotdotnet.com/cbrumme

If doing things the 'right' way is too hard or complex, we do it the 'simple' way, which means do everything needed to avoid crashes and memory leaks, but not much else.

It is required to pass a valid reference to the exc argument, upon return from this function *exc will be set to the exception thrown, if any.

If this method is not called from an icall (embedded scenario for instance), it must not be called with any managed frames on the stack, since the unload process could end up trying to abort the current thread.

+
+

+ Unloads an appdomain. Follows the process outlined in: + http://blogs.gotdotnet.com/cbrumme +

+ If doing things the 'right' way is too hard or complex, we do it the + 'simple' way, which means do everything needed to avoid crashes and + memory leaks, but not much else. +

+ It is required to pass a valid reference to the exc argument, upon return + from this function *exc will be set to the exception thrown, if any. +

+ If this method is not called from an icall (embedded scenario for instance), + it must not be called with any managed frames on the stack, since the unload + process could end up trying to abort the current thread.

@@ -667,7 +753,8 @@ mono_context_init (MonoDomain *domain)

Parameters
domain The domain where the System.Runtime.Remoting.Context.Context is initialized
Description
-
Initializes the domain's default System.Runtime.Remoting 's Context.
+
+ Initializes the domain's default System.Runtime.Remoting 's Context.
@@ -690,7 +777,8 @@ mono_context_get (void)
the current Mono Application Context.
Description
-

+
+

@@ -736,7 +824,11 @@ mono_context_get_id (MonoAppContext *context)
The unique ID for context.
Description
-

Context IDs are guaranteed to be unique for the duration of a Mono process; they are never reused.

+
+

+ Context IDs are guaranteed to be unique for the duration of a Mono + process; they are never reused. +

diff --git a/docs/deploy/mono-api-dynamic-codegen.html b/docs/deploy/mono-api-dynamic-codegen.html index df445ae594..3cba3a70fd 100644 --- a/docs/deploy/mono-api-dynamic-codegen.html +++ b/docs/deploy/mono-api-dynamic-codegen.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -628,7 +638,8 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
the newly created method.
Description
-
Create a MonoMethod from this method builder.
+
+ Create a MonoMethod from this method builder.
@@ -746,7 +757,14 @@ mono_metadata_signature_alloc (MonoImage *m, guint32 nparams)
the new MonoMethodSignature structure.
Description
-

Allocate a MonoMethodSignature structure with the specified number of params. The return type and the params types need to be filled later. This is a Mono runtime internal function.

LOCKING: Assumes the loader lock is held.

+
+

+ Allocate a MonoMethodSignature structure with the specified number of params. + The return type and the params types need to be filled later. + This is a Mono runtime internal function. +

+ LOCKING: Assumes the loader lock is held. +

@@ -770,6 +788,10 @@ mono_metadata_signature_dup (MonoMethodSignature *sig)
the new MonoMethodSignature structure.
Description
-

Duplicate an existing MonoMethodSignature so it can be modified. This is a Mono runtime internal function.

+
+

+ Duplicate an existing MonoMethodSignature so it can be modified. + This is a Mono runtime internal function. +

diff --git a/docs/deploy/mono-api-embedding.html b/docs/deploy/mono-api-embedding.html index 4d40f910fe..fd7b4b5e07 100644 --- a/docs/deploy/mono-api-embedding.html +++ b/docs/deploy/mono-api-embedding.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -282,7 +292,10 @@ mono_jit_parse_options (int argc, char * argv[])

Description
-

Process the command line options in argv as done by the runtime executable. This should be called before mono_jit_init.

+
+

+ Process the command line options in argv as done by the runtime executable. + This should be called before mono_jit_init.

@@ -303,7 +316,8 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[

Parameters
assembly reference to an assembly
argc argument count
argv argument vector
Description
-
Start execution of a program.
+
+ Start execution of a program.
@@ -324,7 +338,27 @@ mono_set_dirs (const char *assembly_dir, const char *config_dir)

Parameters
assembly_dir the base directory for assemblies
config_dir the base directory for configuration files
Description
-

This routine is used internally and by developers embedding the runtime into their own applications.

There are a number of cases to consider: Mono as a system-installed package that is available on the location preconfigured or Mono in a relocated location.

If you are using a system-installed Mono, you can pass NULL to both parameters. If you are not, you should compute both directory values and call this routine.

The values for a given PREFIX are:

assembly_dir: PREFIX/lib config_dir: PREFIX/etc

Notice that embedders that use Mono in a relocated way must compute the location at runtime, as they will be in control of where Mono is installed.

+
+

+ This routine is used internally and by developers embedding + the runtime into their own applications. +

+ There are a number of cases to consider: Mono as a system-installed + package that is available on the location preconfigured or Mono in + a relocated location. +

+ If you are using a system-installed Mono, you can pass NULL + to both parameters. If you are not, you should compute both + directory values and call this routine. +

+ The values for a given PREFIX are: +

+ assembly_dir: PREFIX/lib + config_dir: PREFIX/etc +

+ Notice that embedders that use Mono in a relocated way must + compute the location at runtime, as they will be in control + of where Mono is installed.

@@ -363,7 +397,9 @@ mono_runtime_set_main_args (int argc, char* argv[])

Parameters
argc number of arguments from the command line
argv array of strings from the command line
Description
-
Set the command line arguments from an embedding application that doesn't otherwise call mono_runtime_run_main.
+
+ Set the command line arguments from an embedding application that doesn't otherwise call + mono_runtime_run_main.
@@ -405,7 +441,10 @@ mono_jit_set_trace_options (const char* options)
TRUE if the options were parsed and set correctly, FALSE otherwise.
Description
-
Set the options of the tracing engine. This function can be called before initializing the mono runtime. See the --trace mono(1) manpage for the options format.

+
+ Set the options of the tracing engine. This function can be called before initializing + the mono runtime. See the --trace mono(1) manpage for the options format. +

@@ -445,7 +484,39 @@ mono_add_internal_call (const char *name, gconstpointer method)

Parameters
name method specification to surface to the managed world
method pointer to a C method to invoke when the method is called
Description
-

This method surfaces the C function pointed by method as a method that has been surfaced in managed code with the method specified in name as an internal call.

Internal calls are surfaced to all app domains loaded and they are accessibly by a type with the specified name.

You must provide a fully qualified type name, that is namespaces and type name, followed by a colon and the method name, with an optional signature to bind.

For example, the following are all valid declarations:

MyApp.Services.ScriptService:Accelerate

MyApp.Services.ScriptService:Slowdown(int,bool)

You use method parameters in cases where there might be more than one surface method to managed code. That way you can register different internal calls for different method overloads.

The internal calls are invoked with no marshalling. This means that .NET types like System.String are exposed as MonoString* parameters. This is different than the way that strings are surfaced in P/Invoke.

For more information on how the parameters are marshalled, see the Mono Embedding page.

See the Method Description reference for more information on the format of method descriptions.

+
+

+ This method surfaces the C function pointed by method as a method + that has been surfaced in managed code with the method specified in + name as an internal call. +

+ Internal calls are surfaced to all app domains loaded and they are + accessibly by a type with the specified name. +

+ You must provide a fully qualified type name, that is namespaces + and type name, followed by a colon and the method name, with an + optional signature to bind. +

+ For example, the following are all valid declarations: +

+ MyApp.Services.ScriptService:Accelerate +

+ MyApp.Services.ScriptService:Slowdown(int,bool) +

+ You use method parameters in cases where there might be more than + one surface method to managed code. That way you can register different + internal calls for different method overloads. +

+ The internal calls are invoked with no marshalling. This means that .NET + types like System.String are exposed as MonoString* parameters. This is + different than the way that strings are surfaced in P/Invoke. +

+ For more information on how the parameters are marshalled, see the + Mono Embedding + page. +

+ See the Method Description + reference for more information on the format of method descriptions.

@@ -567,7 +638,9 @@ mono_config_parse (const char *filename)

Parameters
filename the filename to load the configuration variables from.
Description
-
Pass a NULL filename to parse the default config files (or the file in the MONO_CONFIG env var).
+
+ Pass a NULL filename to parse the default config files + (or the file in the MONO_CONFIG env var).
@@ -588,7 +661,8 @@ mono_config_parse_memory (const char *buffer)

Parameters
buffer a pointer to an string XML representation of the configuration
Description
-
Parses the configuration from a buffer
+
+ Parses the configuration from a buffer
@@ -698,7 +772,8 @@ mono_set_config_dir (const char *dir)

Description
-
Invoked during startup
+
+ Invoked during startup
@@ -728,7 +803,16 @@ mono_runtime_exec_managed_code (MonoDomain *domain,

Parameters
domain Application domain
main_func function to invoke from the execution thread
main_args parameter to the main_func
Description
-
Launch a new thread to execute a function

main_func is called back from the thread with main_args as the parameter. The callback function is expected to start Main eventually. This function then waits for all managed threads to finish. It is not necessary anymore to execute managed code in a subthread, so this function should not be used anymore by default: just execute the code and then call mono_thread_manage().

+
+ Launch a new thread to execute a function +

+ main_func is called back from the thread with main_args as the + parameter. The callback function is expected to start Main + eventually. This function then waits for all managed threads to + finish. + It is not necessary anymore to execute managed code in a subthread, + so this function should not be used anymore by default: just + execute the code and then call mono_thread_manage().

@@ -766,7 +850,14 @@ mono_init (const char *domain_name)
the initial domain.
Description
-

Creates the initial application domain and initializes the mono_defaults structure.

This function is guaranteed to not run any IL code. The runtime is initialized using the default runtime version.

+
+

+ Creates the initial application domain and initializes the mono_defaults + structure. +

+ This function is guaranteed to not run any IL code. + The runtime is initialized using the default runtime version. +

@@ -790,7 +881,17 @@ mono_init_from_assembly (const char *domain_name, const char *filename)
the initial domain.
Description
-

Used by the runtime, users should use mono_jit_init instead.

Creates the initial application domain and initializes the mono_defaults structure. This function is guaranteed to not run any IL code. The runtime is initialized using the runtime version required by the provided executable. The version is determined by looking at the exe configuration file and the version PE field)

+
+

+ Used by the runtime, users should use mono_jit_init instead. +

+ Creates the initial application domain and initializes the mono_defaults + structure. + This function is guaranteed to not run any IL code. + The runtime is initialized using the runtime version required by the + provided executable. The version is determined by looking at the exe + configuration file and the version PE field) +

@@ -813,7 +914,16 @@ mono_init_version (const char *domain_name, const char *version)
the initial domain.
Description
-

Used by the runtime, users should use mono_jit_init instead.

Creates the initial application domain and initializes the mono_defaults structure.

This function is guaranteed to not run any IL code. The runtime is initialized using the provided rutime version.

+
+

+ Used by the runtime, users should use mono_jit_init instead. +

+ Creates the initial application domain and initializes the mono_defaults + structure. +

+ This function is guaranteed to not run any IL code. + The runtime is initialized using the provided rutime version. +

@@ -834,7 +944,8 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[

Parameters
assembly reference to an assembly
argc argument count
argv argument vector
Description
-
Start execution of a program.
+
+ Start execution of a program.
@@ -873,7 +984,18 @@ mono_set_break_policy (MonoBreakPolicyFunc policy_callback)

Parameters
policy_callback the new callback function
Description
-

Allow embedders to decide whether to actually obey breakpoint instructions (both break IL instructions and Debugger.Break method calls), for example to not allow an app to be aborted by a perfectly valid IL opcode when executing untrusted or semi-trusted code.

policy_callback will be called every time a break point instruction needs to be inserted with the method argument being the method that calls Debugger.Break or has the IL break instruction. The callback should return MONO_BREAK_POLICY_NEVER if it wants the breakpoint to not be effective in the given method. MONO_BREAK_POLICY_ALWAYS is the default.

+
+

+ Allow embedders to decide whether to actually obey breakpoint instructions + (both break IL instructions and Debugger.Break method calls), for example + to not allow an app to be aborted by a perfectly valid IL opcode when executing + untrusted or semi-trusted code. +

+ policy_callback will be called every time a break point instruction needs to + be inserted with the method argument being the method that calls Debugger.Break + or has the IL break instruction. The callback should return MONO_BREAK_POLICY_NEVER + if it wants the breakpoint to not be effective in the given method. + MONO_BREAK_POLICY_ALWAYS is the default.

@@ -896,7 +1018,9 @@ mono_get_runtime_build_info (void)
the runtime version + build date in string format.
Description
-
The returned string is owned by the caller. The returned string format is VERSION (FULL_VERSION BUILD_DATE) and build date is optional.
+
+ The returned string is owned by the caller. The returned string + format is VERSION (FULL_VERSION BUILD_DATE) and build date is optional.
@@ -919,6 +1043,16 @@ mono_set_signal_chaining (gboolean chain_signals)

Description
-

Enable/disable signal chaining. This should be called before mono_jit_init. If signal chaining is enabled, the runtime saves the original signal handlers before installing its own handlers, and calls the original ones in the following cases: - a SIGSEGV / SIGABRT signal received while executing native (i.e. not JITted) code. - SIGPROF - SIGFPE - SIGQUIT - SIGUSR2 Signal chaining only works on POSIX platforms.

+
+

+ Enable/disable signal chaining. This should be called before mono_jit_init. + If signal chaining is enabled, the runtime saves the original signal handlers before + installing its own handlers, and calls the original ones in the following cases: + - a SIGSEGV / SIGABRT signal received while executing native (i.e. not JITted) code. + - SIGPROF + - SIGFPE + - SIGQUIT + - SIGUSR2 + Signal chaining only works on POSIX platforms.

diff --git a/docs/deploy/mono-api-exc.html b/docs/deploy/mono-api-exc.html index ae732178bc..4f007a6d7b 100644 --- a/docs/deploy/mono-api-exc.html +++ b/docs/deploy/mono-api-exc.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -221,13 +231,15 @@
Syntax
void -mono_reraise_exception (MonoException *ex) +mono_raise_exception (MonoException *ex)

Parameters
ex exception object
Description
-
Signal the runtime that the exception ex has been raised in unmanaged code.
+
+ Signal the runtime that the exception ex has been raised in unmanaged code. + DEPRECATED. DO NOT ADD NEW CALLERS FOR THIS FUNCTION.
@@ -248,7 +260,15 @@ mono_unhandled_exception_checked (MonoObjectHandle exc, MonoError *error)

Parameters
exc exception thrown
Description
-

This is a VM internal routine.

We call this function when we detect an unhandled exception in the default domain.

It invokes the * UnhandledException event in AppDomain or prints a warning to the console

+
+

+ This is a VM internal routine. +

+ We call this function when we detect an unhandled exception + in the default domain. +

+ It invokes the * UnhandledException event in AppDomain or prints + a warning to the console

@@ -269,7 +289,8 @@ mono_print_unhandled_exception (MonoObject *exc)

Parameters
exc The exception
Description
-
Prints the unhandled exception.
+
+ Prints the unhandled exception.
@@ -298,7 +319,11 @@ mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image,
the initialized exception instance.
Description
-

Creates an exception object of the given namespace/name class on the given domain.

+
+

+ Creates an exception object of the given namespace/name class on + the given domain. +

@@ -323,7 +348,11 @@ mono_exception_from_name (MonoImage *image, const char *name_space,
the initialized exception instance.
Description
-

Creates an exception of the given namespace/name class in the current domain.

+
+

+ Creates an exception of the given namespace/name class in the + current domain. +

@@ -348,7 +377,10 @@ mono_exception_from_name_msg (MonoImage *image, const char *name_space,
the initialized exception instance.
Description
-

Creates an exception and initializes its message field.

+
+

+ Creates an exception and initializes its message field. +

@@ -373,7 +405,11 @@ mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
the initialized exception instance.
Description
-

Creates an exception from a constructor that takes two string arguments.

+
+

+ Creates an exception from a constructor that takes two string + arguments. +

@@ -577,7 +613,8 @@ mono_get_exception_class (void)
The MonoClass* for the type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Exception .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Exception .
@@ -1096,7 +1133,10 @@ mono_exception_from_token_two_strings (MonoImage *image, guint32 token,

Description
-

Same as mono_exception_from_name_two_strings, but lookup the exception class using IMAGE and TOKEN.

+
+

+ Same as mono_exception_from_name_two_strings, but lookup the exception class using + IMAGE and TOKEN.

diff --git a/docs/deploy/mono-api-gc.html b/docs/deploy/mono-api-gc.html index d55073e455..c39b898e4c 100644 --- a/docs/deploy/mono-api-gc.html +++ b/docs/deploy/mono-api-gc.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -212,7 +222,15 @@ mono_gc_collect (int generation)

Parameters
generation GC generation identifier
Description
-

Perform a garbage collection for the given generation, higher numbers mean usually older objects. Collecting a high-numbered generation implies collecting also the lower-numbered generations. The maximum value for generation can be retrieved with a call to mono_gc_max_generation, so this function is usually called as:

mono_gc_collect (mono_gc_max_generation ());

+
+

+ Perform a garbage collection for the given generation, higher numbers + mean usually older objects. Collecting a high-numbered generation + implies collecting also the lower-numbered generations. + The maximum value for generation can be retrieved with a call to + mono_gc_max_generation, so this function is usually called as: +

+ mono_gc_collect (mono_gc_max_generation ());

@@ -236,7 +254,11 @@ mono_gc_collection_count (int generation)
the number of garbage collections
Description
-

Get how many times a garbage collection has been performed for the given generation number.

+
+

+ Get how many times a garbage collection has been performed + for the given generation number. +

@@ -259,7 +281,12 @@ mono_gc_max_generation (void)
the maximum generation number.
Description
-

Get the maximum generation number used by the current garbage collector. The value will be 0 for the Boehm collector, 1 or more for the generational collectors.

+
+

+ Get the maximum generation number used by the current garbage + collector. The value will be 0 for the Boehm collector, 1 or more + for the generational collectors. +

@@ -283,7 +310,11 @@ mono_gc_get_generation (MonoObject *object)
a garbage collector generation number
Description
-

Get the garbage collector's generation that object belongs to. Use this has a hint only.

+
+

+ Get the garbage collector's generation that object belongs to. + Use this has a hint only. +

@@ -306,7 +337,10 @@ mono_gc_get_heap_size (void)
the size of the heap in bytes
Description
-

Get the amount of memory used by the garbage collector.

+
+

+ Get the amount of memory used by the garbage collector. +

@@ -329,7 +363,10 @@ mono_gc_get_used_size (void)
the amount of memory used in bytes
Description
-

Get the approximate amount of memory used by managed objects.

+
+

+ Get the approximate amount of memory used by managed objects. +

@@ -353,7 +390,17 @@ mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data)
a non-zero value if the GC doesn't support heap walking
Description
-
This function can be used to iterate over all the live objects in the heap; for each object, callback is invoked, providing info about the object's location in memory, its class, its size and the objects it references. For each referenced object its offset from the object address is reported in the offsets array. The object references may be buffered, so the callback may be invoked multiple times for the same object: in all but the first call, the size argument will be zero. Note that this function can be only called in the MONO_GC_EVENT_PRE_START_WORLD profiler event handler.
+
+ This function can be used to iterate over all the live objects in the heap; + for each object, callback is invoked, providing info about the object's + location in memory, its class, its size and the objects it references. + For each referenced object its offset from the object address is + reported in the offsets array. + The object references may be buffered, so the callback may be invoked + multiple times for the same object: in all but the first call, the size + argument will be zero. + Note that this function can be only called in the MONO_GC_EVENT_PRE_START_WORLD + profiler event handler.
@@ -380,7 +427,12 @@ mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void *u
FALSE if the queue is scheduled to be freed.
Description
-

Queue an object to be watched for collection, when the obj is collected, the callback that was registered for the queue will be invoked with user_data as argument.

+
+

+ Queue an object to be watched for collection, when the obj is + collected, the callback that was registered for the queue will + be invoked with user_data as argument. +

@@ -401,7 +453,13 @@ mono_gc_reference_queue_free (MonoReferenceQueue *queue)

Parameters
queue the queue that should be freed.
Description
-

This operation signals that queue should be freed. This operation is deferred as it happens on the finalizer thread.

After this call, no further objects can be queued. It's the responsibility of the caller to make sure that no further attempt to access queue will be made.

+
+

+ This operation signals that queue should be freed. This operation is deferred + as it happens on the finalizer thread. +

+ After this call, no further objects can be queued. It's the responsibility of the + caller to make sure that no further attempt to access queue will be made.

@@ -425,7 +483,19 @@ mono_gc_reference_queue_new (mono_reference_queue_callback callback)
the new queue.
Description
-

Create a new reference queue used to process collected objects. A reference queue let you add a pair of (managed object, user data) using the mono_gc_reference_queue_add method.

Once the managed object is collected callback will be called in the finalizer thread with 'user data' as argument.

The callback is called from the finalizer thread without any locks held. When an AppDomain is unloaded, all callbacks for objects belonging to it will be invoked.

+
+

+ Create a new reference queue used to process collected objects. + A reference queue let you add a pair of (managed object, user data) + using the mono_gc_reference_queue_add method. +

+ Once the managed object is collected callback will be called + in the finalizer thread with 'user data' as argument. +

+ The callback is called from the finalizer thread without any locks held. + When an AppDomain is unloaded, all callbacks for objects belonging to it + will be invoked. +

@@ -622,7 +692,9 @@ mono_gc_wbarrier_generic_store_atomic (gpointer ptr, GCObject *value)

Description
-
Same as mono_gc_wbarrier_generic_store but performs the store as an atomic operation with release semantics.
+
+ Same as mono_gc_wbarrier_generic_store but performs the store + as an atomic operation with release semantics.
@@ -642,7 +714,9 @@ mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src)

Description
-

Write barrier to call when obj is the result of a clone or copy of an object.

+
+

+ Write barrier to call when obj is the result of a clone or copy of an object.

diff --git a/docs/deploy/mono-api-gchandle.html b/docs/deploy/mono-api-gchandle.html index 1bbb821503..6c9dac5d73 100644 --- a/docs/deploy/mono-api-gchandle.html +++ b/docs/deploy/mono-api-gchandle.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -295,7 +305,16 @@ mono_gchandle_new (MonoObject *obj, gboolean pinned)
a handle that can be used to access the object from unmanaged code.
Description
-
This returns a handle that wraps the object, this is used to keep a reference to a managed object from the unmanaged world and preventing the object from being disposed.

If pinned is false the address of the object can not be obtained, if it is true the address of the object can be obtained. This will also pin the object so it will not be possible by a moving garbage collector to move the object.

+
+ This returns a handle that wraps the object, this is used to keep a + reference to a managed object from the unmanaged world and preventing the + object from being disposed. +

+ If pinned is false the address of the object can not be obtained, if it is + true the address of the object can be obtained. This will also pin the + object so it will not be possible by a moving garbage collector to move the + object. +

@@ -320,7 +339,21 @@ mono_gchandle_new_weakref (GCObject *obj, gboolean track_resurrection) unmanaged code.
Description
-

This returns a weak handle that wraps the object, this is used to keep a reference to a managed object from the unmanaged world. Unlike the mono_gchandle_new the object can be reclaimed by the garbage collector. In this case the value of the GCHandle will be set to zero.

If track_resurrection is TRUE the object will be tracked through finalization and if the object is resurrected during the execution of the finalizer, then the returned weakref will continue to hold a reference to the object. If track_resurrection is FALSE, then the weak reference's target will become NULL as soon as the object is passed on to the finalizer.

+
+

+ This returns a weak handle that wraps the object, this is used to + keep a reference to a managed object from the unmanaged world. + Unlike the mono_gchandle_new the object can be reclaimed by the + garbage collector. In this case the value of the GCHandle will be + set to zero. +

+ If track_resurrection is TRUE the object will be tracked through + finalization and if the object is resurrected during the execution + of the finalizer, then the returned weakref will continue to hold + a reference to the object. If track_resurrection is FALSE, then + the weak reference's target will become NULL as soon as the object + is passed on to the finalizer. +

@@ -345,6 +378,10 @@ mono_gchandle_get_target (guint32 gchandle) NULL for a collected object if using a weakref handle.
Description
-

The handle was previously created by calling mono_gchandle_new or mono_gchandle_new_weakref.

+
+

+ The handle was previously created by calling mono_gchandle_new or + mono_gchandle_new_weakref. +

diff --git a/docs/deploy/mono-api-image.html b/docs/deploy/mono-api-image.html index 4627bf184d..b8f536f782 100644 --- a/docs/deploy/mono-api-image.html +++ b/docs/deploy/mono-api-image.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -311,7 +321,9 @@ mono_image_close (MonoImage *image)

Parameters
image The image file we wish to close
Description
-
Closes an image file, deallocates all memory consumed and unmaps all possible sections of the file
+
+ Closes an image file, deallocates all memory consumed and + unmaps all possible sections of the file
@@ -332,7 +344,8 @@ mono_image_addref (MonoImage *image)

Parameters
image The image file we wish to add a reference to
Description
-
Increases the reference count of an image.
+
+ Increases the reference count of an image.
@@ -431,7 +444,8 @@ mono_image_get_assembly (MonoImage *image)
the assembly that holds this image.
Description
-
Use this routine to get the assembly that owns this image.
+
+ Use this routine to get the assembly that owns this image.
@@ -455,7 +469,9 @@ mono_image_get_entry_point (MonoImage *image)
the token for the entry point method in the image
Description
-
Use this routine to determine the metadata token for method that has been flagged as the entry point.
+
+ Use this routine to determine the metadata token for method that + has been flagged as the entry point.
@@ -479,7 +495,8 @@ mono_image_get_filename (MonoImage *image)
the filename.
Description
-
Used to get the filename that hold the actual MonoImage
+
+ Used to get the filename that hold the actual MonoImage
@@ -525,7 +542,12 @@ mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size)
the pointer to the resource whose offset is offset.
Description
-

This is a low-level routine that fetches a resource from the metadata that starts at a given offset. The size parameter is filled with the data field as encoded in the metadata.

+
+

+ This is a low-level routine that fetches a resource from the + metadata that starts at a given offset. The size parameter is + filled with the data field as encoded in the metadata. +

@@ -585,7 +607,10 @@ mono_image_is_dynamic (MonoImage *image)
TRUE if the image was created dynamically, FALSE if not.
Description
-

Determines if the given image was created dynamically through the System.Reflection.Emit API

+
+

+ Determines if the given image was created dynamically through the + System.Reflection.Emit API

@@ -627,7 +652,8 @@ mono_image_loaded (const char *name)
the loaded MonoImage, or NULL on failure.
Description
-
This routine verifies that the given image is loaded. Reflection-only loads do not count.
+
+ This routine verifies that the given image is loaded. Reflection-only loads do not count.
@@ -699,7 +725,8 @@ mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constra as the function return value; and the original CIL-stream method as declared in cil_method. The latter is used for verification.
Description
-
This is used when JITing the constrained. opcode.
+
+ This is used when JITing the constrained. opcode.
@@ -727,7 +754,11 @@ mono_image_strong_name_position (MonoImage *image, guint32 *size) is stored.
Description
-

If the image has a strong name, and size is not NULL, the value pointed to by size will have the size of the strong name.

+
+

+ If the image has a strong name, and size is not NULL, the value + pointed to by size will have the size of the strong name. +

@@ -752,7 +783,13 @@ mono_image_get_public_key (MonoImage *image, guint32 *size) to the public key.
Description
-

This is used to obtain the public key in the image.

If the image has a public key, and size is not NULL, the value pointed to by size will have the size of the public key.

+
+

+ This is used to obtain the public key in the image. +

+ If the image has a public key, and size is not NULL, the value + pointed to by size will have the size of the public key. +

@@ -777,7 +814,11 @@ mono_image_get_strong_name (MonoImage *image, guint32 *size) pointer to the public key.
Description
-

If the image has a strong name, and size is not NULL, the value pointed to by size will have the size of the strong name.

+
+

+ If the image has a strong name, and size is not NULL, the value + pointed to by size will have the size of the strong name. +

@@ -802,7 +843,9 @@ mono_image_has_authenticode_entry (MonoImage *image) directory.
Description
-
Use this routine to determine if the image has a Authenticode Certificate Table.
+
+ Use this routine to determine if the image has a Authenticode + Certificate Table.
@@ -830,7 +873,11 @@ mono_image_rva_map (MonoImage *image, guint32 addr) RVA is not valid for this image.
Description
-

This is a low-level routine used by the runtime to map relative virtual address (RVA) into their location in memory.

+
+

+ This is a low-level routine used by the runtime to map relative + virtual address (RVA) into their location in memory. +

@@ -854,7 +901,11 @@ mono_image_ensure_section_idx (MonoImage *image, int section)
TRUE on success
Description
-

This routine makes sure that we have an in-memory copy of an image section (.text, .rsrc, .data).

+
+

+ This routine makes sure that we have an in-memory copy of + an image section (.text, .rsrc, .data). +

@@ -878,7 +929,11 @@ mono_image_ensure_section (MonoImage *image, const char *section)
TRUE on success
Description
-

This routine makes sure that we have an in-memory copy of an image section (.text, .rsrc, .data).

+
+

+ This routine makes sure that we have an in-memory copy of + an image section (.text, .rsrc, .data). +

@@ -916,7 +971,9 @@ mono_images_init (void)

Description
-

Initialize the global variables used by this module.

+
+

+ Initialize the global variables used by this module.

@@ -936,7 +993,9 @@ mono_images_cleanup (void)

Description
-

Free all resources used by this module.

+
+

+ Free all resources used by this module.

@@ -1015,6 +1074,10 @@ mono_image_loaded_full (const char *name, gboolean refonly)
the loaded MonoImage, or NULL on failure.
Description
-

This routine verifies that the given image is loaded. It checks either reflection-only loads only, or normal loads only, as specified by parameter.

+
+

+ This routine verifies that the given image is loaded. + It checks either reflection-only loads only, or normal loads only, as specified by parameter. +

diff --git a/docs/deploy/mono-api-internal.html b/docs/deploy/mono-api-internal.html index e9ef1605eb..842c01c23b 100644 --- a/docs/deploy/mono-api-internal.html +++ b/docs/deploy/mono-api-internal.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -228,7 +238,17 @@ mono_unicode_from_external (const gchar *in, gsize *bytes)

Parameters
in pointers to the buffer.
bytes number of bytes in the string.
Description
-
Tries to turn a NULL-terminated string into UTF-16.

First, see if it's valid UTF-8, in which case just turn it directly into UTF-16. Next, run through the colon-separated encodings in MONO_EXTERNAL_ENCODINGS and do an iconv conversion on each, returning the first successful conversion to UTF-16. If no conversion succeeds, return NULL.

Callers must free the returned string if not NULL. bytes holds the number of bytes in the returned string, not including the terminator.

+
+ Tries to turn a NULL-terminated string into UTF-16. +

+ First, see if it's valid UTF-8, in which case just turn it directly + into UTF-16. Next, run through the colon-separated encodings in + MONO_EXTERNAL_ENCODINGS and do an iconv conversion on each, + returning the first successful conversion to UTF-16. If no + conversion succeeds, return NULL. +

+ Callers must free the returned string if not NULL. bytes holds the number + of bytes in the returned string, not including the terminator.

@@ -248,7 +268,11 @@ mono_unicode_from_external (const gchar *in, gsize *bytes)

Parameters
uni a UTF-16 string to convert to an external representation.
Description
-
Turns NULL-terminated UTF-16 into either UTF-8, or the first working item in MONO_EXTERNAL_ENCODINGS if set. If no conversions work, then UTF-8 is returned. Callers must free the returned string.
+
+ Turns NULL-terminated UTF-16 into either UTF-8, or the first + working item in MONO_EXTERNAL_ENCODINGS if set. If no conversions + work, then UTF-8 is returned. + Callers must free the returned string.
@@ -268,7 +292,20 @@ mono_unicode_from_external (const gchar *in, gsize *bytes)

Parameters
in pointer to the string buffer.
Description
-
Tries to turn a NULL-terminated string into UTF8.

First, see if it's valid UTF-8, in which case there's nothing more to be done. Next, run through the colon-separated encodings in MONO_EXTERNAL_ENCODINGS and do an iconv conversion on each, returning the first successful conversion to UTF-8. If no conversion succeeds, return NULL.

Callers must free the returned string if not NULL.

This function is identical to mono_unicode_from_external, apart from returning UTF-8 not UTF-16; it's handy in a few places to work in UTF-8.

+
+ Tries to turn a NULL-terminated string into UTF8. +

+ First, see if it's valid UTF-8, in which case there's nothing more + to be done. Next, run through the colon-separated encodings in + MONO_EXTERNAL_ENCODINGS and do an iconv conversion on each, + returning the first successful conversion to UTF-8. If no + conversion succeeds, return NULL. +

+ Callers must free the returned string if not NULL. +

+ This function is identical to mono_unicode_from_external, apart + from returning UTF-8 not UTF-16; it's handy in a few places to work + in UTF-8.

@@ -309,7 +346,8 @@ mono_marshal_asany (MonoObject *o, MonoMarshalNative string_encoding, int param_

Description
-
This is a JIT icall, it sets the pending exception and returns NULL on error.
+
+ This is a JIT icall, it sets the pending exception and returns NULL on error.
@@ -347,7 +385,8 @@ mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_e

Description
-
This is a JIT icall, it sets the pending exception
+
+ This is a JIT icall, it sets the pending exception
@@ -436,7 +475,8 @@ mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del)

Description
-
The returned method invokes all methods in a multicast delegate.
+
+ The returned method invokes all methods in a multicast delegate.
@@ -456,7 +496,9 @@ mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gcon

Description
-
Generates IL code for the icall wrapper. The generated method calls the unmanaged code in func.
+
+ Generates IL code for the icall wrapper. The generated method + calls the unmanaged code in func.
@@ -492,7 +534,12 @@ mono_marshal_get_ldfld_wrapper (MonoType *type)

Parameters
type the type of the field
Description
-

This method generates a function which can be use to load a field with type type from an object. The generated function has the following signature:

type ldfld_wrapper (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, int offset)

+
+

+ This method generates a function which can be use to load a field with type + type from an object. The generated function has the following signature: +

+ type ldfld_wrapper (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, int offset)

@@ -512,7 +559,9 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,

Description
-
Generates IL code to call managed methods from unmanaged code If target_handle is 0, the wrapper info will be a WrapperInfo structure.
+
+ Generates IL code to call managed methods from unmanaged code + If target_handle is 0, the wrapper info will be a WrapperInfo structure.
@@ -533,7 +582,10 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,

Parameters
method The MonoMethod to wrap.
check_exceptions Whenever to check for pending exceptions
Description
-

Generates IL code for the pinvoke wrapper. The generated method calls the unmanaged code in piinfo->addr.

+
+

+ Generates IL code for the pinvoke wrapper. The generated method + calls the unmanaged code in piinfo->addr.

@@ -572,7 +624,8 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)

Parameters
klass MonoClass
Description
-
Generates IL code for PtrToStructure (IntPtr src, object structure)
+
+ Generates IL code for PtrToStructure (IntPtr src, object structure)
@@ -647,7 +700,15 @@ mono_marshal_get_runtime_invoke_full (MonoMethod *method, gboolean virtual_, gbo

Parameters
function
Description
-

MonoObject *runtime_invoke (MonoObject *this_obj, void **params, MonoObject **exc, void* method)

We also catch exceptions if exc is not NULL. If virtual is TRUE, then method is invoked virtually on this. This is useful since it means that the compiled code for method does not have to be looked up before calling the runtime invoke wrapper. In this case, the wrapper ignores its method argument.

+
+

+ MonoObject *runtime_invoke (MonoObject *this_obj, void **params, MonoObject **exc, void* method) +

+ We also catch exceptions if exc is not NULL. + If virtual is TRUE, then method is invoked virtually on this. This is useful since + it means that the compiled code for method does not have to be looked up + before calling the runtime invoke wrapper. In this case, the wrapper ignores + its method argument.

@@ -686,7 +747,12 @@ mono_marshal_get_stfld_wrapper (MonoType *type)

Parameters
type the type of the field
Description
-

This method generates a function which can be use to store a field with type type. The generated function has the following signature:

void stfld_wrapper (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, int offset, type val)

+
+

+ This method generates a function which can be use to store a field with type + type. The generated function has the following signature: +

+ void stfld_wrapper (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, int offset, type val)

@@ -707,7 +773,9 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)

Parameters
klass MonoClass
Description
-

Generates IL code for StructureToPtr (object structure, IntPtr ptr, bool fDeleteOld)

+
+

+ Generates IL code for StructureToPtr (object structure, IntPtr ptr, bool fDeleteOld)

@@ -728,7 +796,8 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)

Parameters
wrapper the generated method
Description
-
calls method while locking this or the parent type.
+
+ calls method while locking this or the parent type.
@@ -748,7 +817,8 @@ mono_marshal_get_unbox_wrapper (MonoMethod *method)

Description
-
The returned method calls method unboxing the this argument.
+
+ The returned method calls method unboxing the this argument.
@@ -768,7 +838,8 @@ mono_marshal_get_xappdomain_invoke (MonoMethod *method)

Description
-
Generates a fast remoting wrapper for cross app domain calls.
+
+ Generates a fast remoting wrapper for cross app domain calls.
@@ -788,7 +859,13 @@ mono_marshal_load_type_info (MonoClass* klass)

Description
-

Initialize klass::marshal_info using information from metadata. This function can recursively call itself, and the caller is responsible to avoid that by calling mono_marshal_is_loading_type_info beforehand.

LOCKING: Acquires the loader lock.

+
+

+ Initialize klass::marshal_info using information from metadata. This function can + recursively call itself, and the caller is responsible to avoid that by calling + mono_marshal_is_loading_type_info beforehand. +

+ LOCKING: Acquires the loader lock.

@@ -826,7 +903,10 @@ mono_marshal_set_last_error (void)

Description
-

This function is invoked to set the last error value from a P/Invoke call which has SetLastError set.

+
+

+ This function is invoked to set the last error value from a P/Invoke call + which has SetLastError set.

@@ -872,7 +952,9 @@ mono_loader_lock (void)

Description
-

See docs/thread-safety.txt for the locking strategy.

+
+

+ See docs/thread-safety.txt for the locking strategy.

diff --git a/docs/deploy/mono-api-jit.html b/docs/deploy/mono-api-jit.html index 4883610f22..3ee491f486 100644 --- a/docs/deploy/mono-api-jit.html +++ b/docs/deploy/mono-api-jit.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -225,7 +235,15 @@ mono_jit_info_table_find (MonoDomain *domain, char *addr) code or a trampoline) or a valid pointer to a MonoJitInfo* .
Description
-

Use this function to obtain a MonoJitInfo* object that can be used to get some statistics. You should provide both the domain on which you will be performing the probe, and an address. Since application domains can share code the same address can be in use by multiple domains at once.

This does not return any results for trampolines.

+
+

+ Use this function to obtain a MonoJitInfo* object that can be used to get + some statistics. You should provide both the domain on which you will be + performing the probe, and an address. Since application domains can share code + the same address can be in use by multiple domains at once. +

+ This does not return any results for trampolines. +

@@ -249,7 +267,12 @@ mono_jit_info_get_code_size (MonoJitInfo* ji)
Starting address with the native code.
Description
-

Use this function to get the code size for the method described by the ji object. You can use this plus the mono_jit_info_get_code_start to determine the start and end of the native code.

+
+

+ Use this function to get the code size for the method described by + the ji object. You can use this plus the mono_jit_info_get_code_start + to determine the start and end of the native code. +

@@ -273,7 +296,12 @@ mono_jit_info_get_code_start (MonoJitInfo* ji)
Starting address with the native code.
Description
-

Use this function to get the starting address for the method described by the ji object. You can use this plus the mono_jit_info_get_code_size to determine the start and end of the native code.

+
+

+ Use this function to get the starting address for the method described by + the ji object. You can use this plus the mono_jit_info_get_code_size + to determine the start and end of the native code. +

@@ -298,7 +326,11 @@ mono_jit_info_get_method (MonoJitInfo* ji) by ji.
Description
-

Use this function to get the MonoMethod* that backs the ji object.

+
+

+ Use this function to get the MonoMethod* that backs + the ji object. +

@@ -328,7 +360,14 @@ mono_pmip (void *ip)
the name of the method at address ip.
Description
-

This method is used from a debugger to get the name of the method at address ip. This routine is typically invoked from a debugger like this:

(gdb) print mono_pmip ($pc)

+
+

+ This method is used from a debugger to get the name of the + method at address ip. This routine is typically invoked from + a debugger like this: +

+ (gdb) print mono_pmip ($pc) +

@@ -349,7 +388,14 @@ mono_print_method_from_ip (void *ip)

Parameters
ip an instruction pointer address
Description
-

This method is used from a debugger to get the name of the method at address ip.

This prints the name of the method at address ip in the standard output. Unlike mono_pmip which returns a string, this routine prints the value on the standard output.

+
+

+ This method is used from a debugger to get the name of the + method at address ip. +

+ This prints the name of the method at address ip in the standard + output. Unlike mono_pmip which returns a string, this routine + prints the value on the standard output.

@@ -369,7 +415,10 @@ mono_print_thread_dump (void *sigctx)

Description
-

Print information about the current thread to stdout. sigctx can be NULL, allowing this to be called from gdb.

+
+

+ Print information about the current thread to stdout. + sigctx can be NULL, allowing this to be called from gdb.

@@ -389,7 +438,9 @@ mono_threads_request_thread_dump (void)

Description
-

Ask all threads except the current to print their stacktrace to stdout.

+
+

+ Ask all threads except the current to print their stacktrace to stdout.

@@ -412,7 +463,9 @@ mono_assemblies_init (void)

Description
-

Initialize global variables used by this module.

+
+

+ Initialize global variables used by this module.

@@ -432,7 +485,9 @@ mono_assemblies_cleanup (void)

Description
-

Free all resources used by this module.

+
+

+ Free all resources used by this module.

@@ -506,6 +561,9 @@ mono_runtime_set_shutting_down (void)

Description
-

Invoked by System.Environment.Exit to flag that the runtime is shutting down.

+
+

+ Invoked by System.Environment.Exit to flag that the runtime + is shutting down.

diff --git a/docs/deploy/mono-api-jitinternal.html b/docs/deploy/mono-api-jitinternal.html index 49ab7948ac..870398e307 100644 --- a/docs/deploy/mono-api-jitinternal.html +++ b/docs/deploy/mono-api-jitinternal.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -243,7 +253,12 @@ mono_sha1_get_digest_from_file (const gchar *filename, guchar digest [20])

Parameters
filename file name
digest 20-byte buffer receiving the hash code.
Description
-

Get the SHA-1 hash of a file. The result is put in the 20-byte buffer digest.

If an IO error happens the value in digest is not updated.

+
+

+ Get the SHA-1 hash of a file. The result is put in + the 20-byte buffer digest. +

+ If an IO error happens the value in digest is not updated.

@@ -339,7 +354,12 @@ mono_md5_get_digest_from_file (const gchar *filename, guchar digest[16])

Parameters
filename file name
digest 16-byte buffer receiving the hash code.
Description
-

Get the MD5 hash of a file. The result is put in the 16-byte buffer digest.

If an IO error happens the value in digest is not updated.

+
+

+ Get the MD5 hash of a file. The result is put in + the 16-byte buffer digest. +

+ If an IO error happens the value in digest is not updated.

@@ -360,7 +380,10 @@ mono_md5_get_digest (const guchar *buffer, gint buffer_size, guchar digest[16])

Parameters
buffer byte buffer
buffer_size buffer size (in bytes)
digest 16-byte buffer receiving the hash code.
Description
-

Get the MD5 hash of a buffer. The result is put in the 16-byte buffer digest.

+
+

+ Get the MD5 hash of a buffer. The result is put in + the 16-byte buffer digest.

@@ -399,7 +422,10 @@ mono_digest_get_public_token (guchar* token, const guchar *pubkey, guint32 len)

Description
-

Get the public token from public key data. token must point to at least 8 bytes of storage.

+
+

+ Get the public token from public key data. + token must point to at least 8 bytes of storage.

@@ -616,7 +642,8 @@ mono_mempool_new (void)
a new memory pool.
Description
-

+
+

@@ -637,7 +664,9 @@ mono_mempool_destroy (MonoMemPool *pool)

Parameters
pool the memory pool to destroy
Description
-

Free all memory associated with this pool.

+
+

+ Free all memory associated with this pool.

@@ -661,7 +690,10 @@ mono_mempool_alloc (MonoMemPool *pool, guint size)
the address of a newly allocated memory block.
Description
-

Allocates a new block of memory in pool .

+
+

+ Allocates a new block of memory in pool . +

@@ -681,7 +713,9 @@ mono_mempool_alloc0 (MonoMemPool *pool, guint size)

Description
-

same as mono_mempool_alloc, but fills memory with zero.

+
+

+ same as mono_mempool_alloc, but fills memory with zero.

@@ -702,7 +736,9 @@ mono_mempool_invalidate (MonoMemPool *pool)

Parameters
pool the memory pool to invalidate
Description
-

Fill the memory associated with this pool to 0x2a (42). Useful for debugging.

+
+

+ Fill the memory associated with this pool to 0x2a (42). Useful for debugging.

@@ -723,7 +759,12 @@ mono_mempool_stats (MonoMemPool *pool)

Parameters
pool the memory pool we need stats for
Description
-

Print a few stats about the mempool: - Total memory allocated (malloced) by mem pool - Number of chunks/blocks memory is allocated in - How much memory is available to dispense before a new malloc must occur?

+
+

+ Print a few stats about the mempool: + - Total memory allocated (malloced) by mem pool + - Number of chunks/blocks memory is allocated in + - How much memory is available to dispense before a new malloc must occur?

@@ -744,7 +785,9 @@ mono_mempool_contains_addr (MonoMemPool *pool,

Description
-

Determines whether addr is inside the memory used by the mempool.

+
+

+ Determines whether addr is inside the memory used by the mempool.

@@ -793,7 +836,9 @@ mono_bitset_clear (MonoBitSet *set, guint32 pos)

Parameters
set bitset ptr
pos unset bit at this pos
Description
-

Unset bit at pos, counting from 0.

+
+

+ Unset bit at pos, counting from 0.

@@ -813,7 +858,9 @@ mono_bitset_clear_all (MonoBitSet *set)

Parameters
set bitset ptr
Description
-

Unset all bits.

+
+

+ Unset all bits.

@@ -856,7 +903,9 @@ mono_bitset_copyto (const MonoBitSet *src, MonoBitSet *dest)

Parameters
src bitset ptr to copy from
dest bitset ptr to copy to
Description
-

Copy one bitset to another.

+
+

+ Copy one bitset to another.

@@ -960,7 +1009,8 @@ mono_bitset_find_start (const MonoBitSet *set)

Parameters
set bitset ptr
Description
-
Equivalent to mono_bitset_find_first (set, -1) but faster.
+
+ Equivalent to mono_bitset_find_first (set, -1) but faster.
@@ -981,7 +1031,9 @@ mono_bitset_foreach (MonoBitSet *set, MonoBitSetFunc func, gpointer data)

Parameters
set bitset ptr
func Function to call for every set bit
data pass this as second arg to func
Description
-
Calls func for every bit set in bitset. Argument 1 is the number of the bit set, argument 2 is data
+
+ Calls func for every bit set in bitset. Argument 1 is the number of + the bit set, argument 2 is data
@@ -1016,7 +1068,9 @@ mono_bitset_intersection (MonoBitSet *dest, const MonoBitSet *src)

Parameters
dest bitset ptr to hold intersection
src bitset ptr to copy
Description
-

Make intersection of one bitset and another.

+
+

+ Make intersection of one bitset and another.

@@ -1036,7 +1090,9 @@ mono_bitset_invert (MonoBitSet *set)

Parameters
set bitset ptr
Description
-

Flip all bits.

+
+

+ Flip all bits.

@@ -1056,7 +1112,11 @@ mono_bitset_mem_new (gpointer mem, guint32 max_size, guint32 flags)

Parameters
mem The location the bitset is stored
max_size The number of bits you want to hold
flags bitfield of flags
Description
-

Return mem, which is now a initialized bitset of size max_size. It is not freed even if called with mono_bitset_free. mem must be at least as big as mono_bitset_alloc_size returns for the same max_size.

+
+

+ Return mem, which is now a initialized bitset of size max_size. It is + not freed even if called with mono_bitset_free. mem must be at least + as big as mono_bitset_alloc_size returns for the same max_size.

@@ -1098,7 +1158,9 @@ mono_bitset_set (MonoBitSet *set, guint32 pos)

Parameters
set bitset ptr
pos set bit at this pos
Description
-

Set bit at pos, counting from 0.

+
+

+ Set bit at pos, counting from 0.

@@ -1118,7 +1180,9 @@ mono_bitset_set_all (MonoBitSet *set)

Parameters
set bitset ptr
Description
-

Set all bits.

+
+

+ Set all bits.

@@ -1159,7 +1223,9 @@ mono_bitset_sub (MonoBitSet *dest, const MonoBitSet *src)

Parameters
dest bitset ptr to hold bitset - src
src bitset ptr to copy
Description
-

Unset all bits in dest that are set in src.

+
+

+ Unset all bits in dest that are set in src.

@@ -1182,7 +1248,8 @@ mono_bitset_test (const MonoBitSet *set, guint32 pos)
a nonzero value if set, 0 otherwise.
Description
-
Test bit at pos, counting from 0.
+
+ Test bit at pos, counting from 0.
@@ -1224,7 +1291,9 @@ mono_bitset_union (MonoBitSet *dest, const MonoBitSet *src)

Parameters
dest bitset ptr to hold union
src bitset ptr to copy
Description
-

Make union of one bitset and another.

+
+

+ Make union of one bitset and another.

@@ -1264,7 +1333,9 @@ mono_bitset_intersection_2 (MonoBitSet *dest, const MonoBitSet *src1, const Mono

Parameters
dest bitset ptr to hold intersection
src1 first bitset
src2 second bitset
Description
-

Make intersection of two bitsets

+
+

+ Make intersection of two bitsets

@@ -1332,7 +1403,10 @@ mono_create_ftnptr (MonoDomain *domain, gpointer addr)

Description
-

Given a function address, create a function descriptor for it. This is only needed on some platforms.

+
+

+ Given a function address, create a function descriptor for it. + This is only needed on some platforms.

@@ -1360,8 +1434,32 @@ mono_create_ftnptr (MonoDomain *domain, gpointer addr)
Syntax
-
mono_profiler_load
+
void +mono_profiler_load (const char *desc) + +

+

Description
+
+

+ Loads a profiler module based on the specified description. desc can be + of the form name:args or just name. For example, log:sample and + log will both load libmono-profiler-log.so. The description is passed + to the module after it has been loaded. If the specified module has already + been loaded, this function has no effect. +

+ A module called foo should declare an entry point like so: +

+


+ void mono_profiler_init_foo (const char *desc)
+ {
+ }
+ 
+

+ This function is not async safe. +

+ This function may only be called by embedders prior to running managed + code.

diff --git a/docs/deploy/mono-api-metadata.html b/docs/deploy/mono-api-metadata.html index a693d88ec0..ea0ea63480 100644 --- a/docs/deploy/mono-api-metadata.html +++ b/docs/deploy/mono-api-metadata.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -341,7 +351,10 @@ mono_metadata_decode_blob_size (const char *xptr, const char **rptr)
the size of the blob object
Description
-

This decodes a compressed size as described by 24.2.4 (US and Blob a blob or user string object)

+
+

+ This decodes a compressed size as described by 24.2.4 (US and Blob a blob or user string object) +

@@ -963,7 +976,10 @@ mono_metadata_decode_row_col (const MonoTableInfo *t, int idx, guint col)

Parameters
t table to extract information from.
idx index for row in table.
col column in the row.
Description
-

This function returns the value of column col from the idx row in the table t .

+
+

+ This function returns the value of column col from the idx + row in the table t .

@@ -984,7 +1000,10 @@ mono_metadata_decode_row (const MonoTableInfo *t, int idx, guint32 *res, int res

Parameters
t table to extract information from.
idx index in table.
res array of res_size cols to store the results in
Description
-

This decompresses the metadata element idx in table t into the guint32 res array that has res_size elements

+
+

+ This decompresses the metadata element idx in table t + into the guint32 res array that has res_size elements

@@ -1005,7 +1024,14 @@ mono_metadata_compute_size (MonoImage *meta, int tableindex, guint32 *result_bit

Parameters
meta metadata context
tableindex metadata table number
result_bitfield pointer to guint32 where to store additional info
Description
-

mono_metadata_compute_size computes the length in bytes of a single row in a metadata table. The size of each column is encoded in the result_bitfield return value along with the number of columns in the table. the resulting bitfield should be handed to the mono_metadata_table_size and mono_metadata_table_count macros. This is a Mono runtime internal only function.

+
+

+ mono_metadata_compute_size computes the length in bytes of a single + row in a metadata table. The size of each column is encoded in the + result_bitfield return value along with the number of columns in the table. + the resulting bitfield should be handed to the mono_metadata_table_size + and mono_metadata_table_count macros. + This is a Mono runtime internal only function.

@@ -1026,7 +1052,9 @@ mono_metadata_custom_attrs_from_index (MonoImage *meta, guint32 index)

Parameters
meta metadata context
index token representing the parent
returns the 1-based index into the CustomAttribute table of the first
Description
-
attribute which belongs to the metadata object described by index. Returns 0 if no such attribute is found.
+
+ attribute which belongs to the metadata object described by index. + Returns 0 if no such attribute is found.
@@ -1050,7 +1078,11 @@ mono_metadata_decode_signed_value (const char *ptr, const char **rptr)
the decoded value
Description
-

This routine decompresses 32-bit signed values (not specified in the spec)

+
+

+ This routine decompresses 32-bit signed values + (not specified in the spec) +

@@ -1074,7 +1106,11 @@ mono_metadata_decode_value (const char *_ptr, const char **rptr)
the decoded value
Description
-

This routine decompresses 32-bit values as specified in the "Blob and Signature" section (23.2)

+
+

+ This routine decompresses 32-bit values as specified in the "Blob and + Signature" section (23.2) +

@@ -1165,7 +1201,12 @@ mono_metadata_decode_table_row (MonoImage *image, int table, int idx, guint32 *r

Description
-

Same as mono_metadata_decode_row, but takes an image + table ID pair, and takes uncompressed metadata into account, so it should be used to access the Method, Field, Param and Event tables when the access is made from metadata, i.e. idx is retrieved from a metadata table, like MONO_TYPEDEF_FIELD_LIST.

+
+

+ Same as mono_metadata_decode_row, but takes an image + table ID pair, and takes + uncompressed metadata into account, so it should be used to access the + Method, Field, Param and Event tables when the access is made from metadata, i.e. + idx is retrieved from a metadata table, like MONO_TYPEDEF_FIELD_LIST.

@@ -1184,7 +1225,11 @@ mono_metadata_decode_table_row (MonoImage *image, int table, int idx, guint32 *r

Description
-

Same as mono_metadata_decode_row_col, but takes an image + table ID pair, and takes uncompressed metadata into account, so it should be used to access the Method, Field, Param and Event tables.

+
+

+ Same as mono_metadata_decode_row_col, but takes an image + table ID pair, and takes + uncompressed metadata into account, so it should be used to access the + Method, Field, Param and Event tables.

@@ -1206,7 +1251,12 @@ mono_metadata_field_info (MonoImage *meta, guint32 index, guint32 *offset, guint

Parameters
meta the Image the field is defined in
index the index in the field table representing the field
offset a pointer to an integer where to store the offset that may have been specified for the field in a FieldLayout table
rva a pointer to the RVA of the field data in the image that may have been defined in a FieldRVA table
marshal_spec a pointer to the marshal spec that may have been defined for the field in a FieldMarshal table.
Description
-

Gather info for field index that may have been defined in the FieldLayout, FieldRVA and FieldMarshal tables. Either of offset, rva and marshal_spec can be NULL if you're not interested in the data.

+
+

+ Gather info for field index that may have been defined in the FieldLayout, + FieldRVA and FieldMarshal tables. + Either of offset, rva and marshal_spec can be NULL if you're not interested + in the data.

@@ -1227,7 +1277,9 @@ mono_metadata_free_array (MonoArrayType *array)

Parameters
array array description
Description
-

Frees the array description returned from mono_metadata_parse_array.

+
+

+ Frees the array description returned from mono_metadata_parse_array.

@@ -1266,7 +1318,9 @@ mono_metadata_free_mh (MonoMethodHeader *mh)

Parameters
mh a method header
Description
-

Free the memory allocated for the method header.

+
+

+ Free the memory allocated for the method header.

@@ -1287,7 +1341,9 @@ mono_metadata_free_type (MonoType *type)

Parameters
type type to free
Description
-

Free the memory allocated for type type which is allocated on the heap.

+
+

+ Free the memory allocated for type type which is allocated on the heap.

@@ -1311,7 +1367,10 @@ mono_metadata_get_constant_index (MonoImage *meta, guint32 token, guint32 hint)
the index into the Constants table or 0 if not found.
Description
-

token must be a FieldDef, ParamDef or PropertyDef token.

+
+

+ token must be a FieldDef, ParamDef or PropertyDef token. +

@@ -1371,7 +1430,14 @@ mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 index, guint *co
the interface array on success, NULL on failure.
Description
-

The array of interfaces that the index typedef token implements is returned in interfaces. The number of elements in the array is returned in count. The returned array is allocated with g_malloc and the caller must free it.

LOCKING: Acquires the loader lock .

+
+

+ The array of interfaces that the index typedef token implements is returned in + interfaces. The number of elements in the array is returned in count. The returned + array is allocated with g_malloc and the caller must free it. +

+ LOCKING: Acquires the loader lock . +

@@ -1396,7 +1462,8 @@ mono_metadata_locate (MonoImage *meta, int table, int idx) whose code is table.
Description
-

+
+

@@ -1421,7 +1488,8 @@ mono_metadata_locate_token (MonoImage *meta, guint32 token) token token .
Description
-

+
+

@@ -1589,7 +1657,12 @@ mono_metadata_token_from_dor (guint32 dor_index)
an expanded token
Description
-

dor_token is a TypeDefOrRef coded index: it contains either a TypeDef, TypeRef or TypeSpec in the lower bits, and the upper bits contain an index into the table.

+
+

+ dor_token is a TypeDefOrRef coded index: it contains either + a TypeDef, TypeRef or TypeSpec in the lower bits, and the upper + bits contain an index into the table. +

@@ -1609,7 +1682,12 @@ mono_metadata_translate_token_index (MonoImage *image, int table, guint32 idx)

Description
-
Translates the given 1-based index into the Method, Field, Event, or Param tables using the *Ptr tables in uncompressed metadata, if they are available.

FIXME: The caller is not forced to call this function, which is error-prone, since forgetting to call it would only show up as a bug on uncompressed metadata.

+
+ Translates the given 1-based index into the Method, Field, Event, or Param tables + using the *Ptr tables in uncompressed metadata, if they are available. +

+ FIXME: The caller is not forced to call this function, which is error-prone, since + forgetting to call it would only show up as a bug on uncompressed metadata.

@@ -1634,7 +1712,8 @@ mono_metadata_typedef_from_field (MonoImage *meta, guint32 index) declared the field described by index, or 0 if not found.
Description
-

+
+

@@ -1696,7 +1775,9 @@ mono_metadata_type_hash (MonoType *t1)

Parameters
t1 a type
Description
-
Computes a hash value for t1 to be used in GHashTable. The returned hash is guaranteed to be the same across executions.
+
+ Computes a hash value for t1 to be used in GHashTable. + The returned hash is guaranteed to be the same across executions.
@@ -1741,7 +1822,11 @@ mono_metadata_free_method_signature (MonoMethodSignature *sig)

Parameters
sig signature to destroy
Description
-

Free the memory allocated in the signature sig. This method needs to be robust and work also on partially-built signatures, so it does extra checks.

+
+

+ Free the memory allocated in the signature sig. + This method needs to be robust and work also on partially-built + signatures, so it does extra checks.

@@ -1786,7 +1871,10 @@ mono_metadata_parse_custom_mod (MonoImage *m, MonoCustomMod *dest, const char *p
TRUE if a custom modifier was found, FALSE if not.
Description
-

Checks if ptr points to a type custom modifier compressed representation.

+
+

+ Checks if ptr points to a type custom modifier compressed representation. +

@@ -1810,7 +1898,10 @@ mono_metadata_parse_field_type (MonoImage *m, short field_flags, const char *ptr
The MonoType that was extracted from ptr .
Description
-

Parses the field signature, and returns the type information for it.

+
+

+ Parses the field signature, and returns the type information for it. +

@@ -1852,7 +1943,13 @@ mono_metadata_parse_method_signature (MonoImage *m, int def, const char *ptr, co
a MonoMethodSignature describing the signature.
Description
-

Decode a method signature stored at ptr. This is a Mono runtime internal function.

LOCKING: Assumes the loader lock is held.

+
+

+ Decode a method signature stored at ptr. + This is a Mono runtime internal function. +

+ LOCKING: Assumes the loader lock is held. +

@@ -1876,7 +1973,11 @@ mono_metadata_parse_mh (MonoImage *m, const char *ptr)
a transient MonoMethodHeader allocated from the heap.
Description
-

Decode the method header at ptr, including pointer to the IL code, info about local variables and optional exception tables.

+
+

+ Decode the method header at ptr, including pointer to the IL code, + info about local variables and optional exception tables. +

@@ -1900,7 +2001,10 @@ mono_metadata_parse_param (MonoImage *m, const char *ptr, const char **rptr)
The MonoType that was extracted from ptr .
Description
-

Parses the param signature, and returns the type information for it.

+
+

+ Parses the param signature, and returns the type information for it. +

@@ -1924,7 +2028,10 @@ mono_metadata_parse_signature (MonoImage *image, guint32 token)
a MonoMethodSignature describing the signature.
Description
-

Decode a method signature stored in the StandAloneSig table

+
+

+ Decode a method signature stored in the StandAloneSig table +

@@ -1972,7 +2079,22 @@ mono_metadata_parse_type_internal (MonoImage *m, MonoGenericContainer *container
a MonoType structure representing the decoded type.
Description
-

Decode a compressed type description found at ptr in m . mode can be one of MONO_PARSE_MOD_TYPE, MONO_PARSE_PARAM, MONO_PARSE_RET, MONO_PARSE_FIELD, MONO_PARSE_LOCAL, MONO_PARSE_TYPE. This function can be used to decode type descriptions in method signatures, field signatures, locals signatures etc.

To parse a generic type, generic_container points to the current class'es (the generic_container field in the MonoClass) or the current generic method's (stored in image->property_hash) generic container. When we encounter a MONO_TYPE_VAR or MONO_TYPE_MVAR, it's looked up in this MonoGenericContainer.

LOCKING: Acquires the loader lock.

+
+

+ Decode a compressed type description found at ptr in m . + mode can be one of MONO_PARSE_MOD_TYPE, MONO_PARSE_PARAM, MONO_PARSE_RET, + MONO_PARSE_FIELD, MONO_PARSE_LOCAL, MONO_PARSE_TYPE. + This function can be used to decode type descriptions in method signatures, + field signatures, locals signatures etc. +

+ To parse a generic type, generic_container points to the current class'es + (the generic_container field in the MonoClass) or the current generic method's + (stored in image->property_hash) generic container. + When we encounter a MONO_TYPE_VAR or MONO_TYPE_MVAR, it's looked up in + this MonoGenericContainer. +

+ LOCKING: Acquires the loader lock. +

@@ -2039,7 +2161,8 @@ mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 idx)
a loaded string from the image / idx combination.
Description
-
Implementation for the ldstr opcode.
+
+ Implementation for the ldstr opcode.
@@ -2063,7 +2186,10 @@ mono_exception_from_token (MonoImage *image, guint32 token)
the initialized exception instance.
Description
-

Creates an exception of the type given by token.

+
+

+ Creates an exception of the type given by token. +

diff --git a/docs/deploy/mono-api-methods.html b/docs/deploy/mono-api-methods.html index cee6326a8a..264ea5b075 100644 --- a/docs/deploy/mono-api-methods.html +++ b/docs/deploy/mono-api-methods.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -333,7 +343,17 @@ mono_method_desc_new (const char *name, gboolean include_namespace)
a parsed representation of the method description.
Description
-

Creates a method description for name, which conforms to the following specification:

[namespace.]classname:methodname[(args...)]

in all the loaded assemblies.

Both classname and methodname can contain * which matches anything.

+
+

+ Creates a method description for name, which conforms to the following + specification: +

+ [namespace.]classname:methodname[(args...)] +

+ in all the loaded assemblies. +

+ Both classname and methodname can contain * which matches anything. +

@@ -354,7 +374,8 @@ mono_method_desc_free (MonoMethodDesc *desc)

Parameters
desc method description to be released
Description
-
Releases the MonoMethodDesc object desc.
+
+ Releases the MonoMethodDesc object desc.
@@ -414,7 +435,11 @@ mono_method_desc_match (MonoMethodDesc *desc, MonoMethod *method)
TRUE if the method matches the description, FALSE otherwise.
Description
-

Determines whether the specified method matches the provided desc description.

namespace and class are supposed to match already if this function is used.

+
+

+ Determines whether the specified method matches the provided desc description. +

+ namespace and class are supposed to match already if this function is used.

@@ -640,7 +665,10 @@ mono_method_get_signature (MonoMethod *method, MonoImage *image, guint32 token)

Description
-
token is the method_ref/def/spec token used in a call IL instruction. \deprecated use the _checked variant Notes: runtime code MUST not use this function
+
+ token is the method_ref/def/spec token used in a call IL instruction. + \deprecated use the _checked variant + Notes: runtime code MUST not use this function
@@ -660,7 +688,8 @@ mono_method_get_index (MonoMethod *method)

Description
-
Find the method index in the metadata MethodDef table.
+
+ Find the method index in the metadata MethodDef table.
@@ -680,7 +709,10 @@ mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 to

Description
-
token is the method ref/def/spec token used in a call IL instruction. \deprecated use the _checked variant Notes: runtime code MUST not use this function
+
+ token is the method ref/def/spec token used in a call IL instruction. + \deprecated use the _checked variant + Notes: runtime code MUST not use this function
@@ -719,7 +751,60 @@ mono_method_get_unmanaged_thunk (MonoMethod *method)

Parameters
method method to generate a thunk for.
Description
-

Returns an unmanaged->managed thunk that can be used to call a managed method directly from C.

The thunk's C signature closely matches the managed signature:

C#: public bool Equals (object obj);

C: typedef MonoBoolean (*Equals)(MonoObject*, MonoObject*, MonoException**);

The 1st (this) parameter must not be used with static methods:

C#: public static bool ReferenceEquals (object a, object b);

C: typedef MonoBoolean (*ReferenceEquals)(MonoObject*, MonoObject*, MonoException**);

The last argument must be a non-null MonoException* pointer. It has "out" semantics. After invoking the thunk, *ex will be NULL if no exception has been thrown in managed code. Otherwise it will point to the MonoException* caught by the thunk. In this case, the result of the thunk is undefined:

 	 MonoMethod *method = ... // MonoMethod* of System.Object.Equals 	

MonoException *ex = NULL;

Equals func = mono_method_get_unmanaged_thunk (method);

MonoBoolean res = func (thisObj, objToCompare, &ex);

if (ex) {

// handle exception

}

The calling convention of the thunk matches the platform's default convention. This means that under Windows, C declarations must contain the __stdcall attribute:

C: typedef MonoBoolean (__stdcall *Equals)(MonoObject*, MonoObject*, MonoException**);

LIMITATIONS

Value type arguments and return values are treated as they were objects:

C#: public static Rectangle Intersect (Rectangle a, Rectangle b); C: typedef MonoObject* (*Intersect)(MonoObject*, MonoObject*, MonoException**);

Arguments must be properly boxed upon trunk's invocation, while return values must be unboxed.

+
+

+ Returns an unmanaged->managed thunk that can be used to call + a managed method directly from C. +

+ The thunk's C signature closely matches the managed signature: +

+ C#: public bool Equals (object obj); +

+ C: typedef MonoBoolean (*Equals)(MonoObject*, MonoObject*, MonoException**); +

+ The 1st (this) parameter must not be used with static methods: +

+ C#: public static bool ReferenceEquals (object a, object b); +

+ C: typedef MonoBoolean (*ReferenceEquals)(MonoObject*, MonoObject*, MonoException**); +

+ The last argument must be a non-null MonoException* pointer. + It has "out" semantics. After invoking the thunk, *ex will be NULL if no + exception has been thrown in managed code. Otherwise it will point + to the MonoException* caught by the thunk. In this case, the result of + the thunk is undefined: +

+

+ MonoMethod *method = ... // MonoMethod* of System.Object.Equals
+

+ MonoException *ex = NULL; +

+ Equals func = mono_method_get_unmanaged_thunk (method); +

+ MonoBoolean res = func (thisObj, objToCompare, &ex); +

+ if (ex) { +

+ // handle exception +

+ } +

+

+ The calling convention of the thunk matches the platform's default + convention. This means that under Windows, C declarations must + contain the __stdcall attribute: +

+ C: typedef MonoBoolean (__stdcall *Equals)(MonoObject*, MonoObject*, MonoException**); +

+ LIMITATIONS +

+ Value type arguments and return values are treated as they were objects: +

+ C#: public static Rectangle Intersect (Rectangle a, Rectangle b); + C: typedef MonoObject* (*Intersect)(MonoObject*, MonoObject*, MonoException**); +

+ Arguments must be properly boxed upon trunk's invocation, while return + values must be unboxed.

@@ -757,7 +842,8 @@ mono_method_verify (MonoMethod *method, int level)

Description
-
Verify types for opcodes.
+
+ Verify types for opcodes.
@@ -782,7 +868,32 @@ mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **

Parameters
method method to invoke
obj object instance
params arguments to the method
exc exception information.
Description
-
Invokes the method represented by method on the object obj. obj is the this pointer, it should be NULL for static methods, a MonoObject* for object instances and a pointer to the value type for value types.

The params array contains the arguments to the method with the same convention: MonoObject* pointers for object instances and pointers to the value type otherwise.

From unmanaged code you'll usually use the mono_runtime_invoke variant.

Note that this function doesn't handle virtual methods for you, it will exec the exact method you pass: we still need to expose a function to lookup the derived class implementation of a virtual method (there are examples of this in the code, though).

You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function.

If the method returns a value type, it is boxed in an object reference.

+
+ Invokes the method represented by method on the object obj. + obj is the this pointer, it should be NULL for static + methods, a MonoObject* for object instances and a pointer to + the value type for value types. +

+ The params array contains the arguments to the method with the + same convention: MonoObject* pointers for object instances and + pointers to the value type otherwise. +

+ From unmanaged code you'll usually use the + mono_runtime_invoke variant. +

+ Note that this function doesn't handle virtual methods for + you, it will exec the exact method you pass: we still need to + expose a function to lookup the derived class implementation + of a virtual method (there are examples of this in the code, + though). +

+ You can pass NULL as the exc argument if you don't want to + catch exceptions, otherwise, *exc will be set to the exception + thrown, if any. if an exception is thrown, you can't use the + MonoObject* result from the function. +

+ If the method returns a value type, it is boxed in an object + reference.

@@ -826,7 +937,36 @@ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,

Parameters
method method to invoke
obj object instance
params arguments to the method
exc exception information.
Description
-
Invokes the method represented by method on the object obj.

obj is the this pointer, it should be NULL for static methods, a MonoObject* for object instances and a pointer to the value type for value types.

The params array contains the arguments to the method with the same convention: MonoObject* pointers for object instances and pointers to the value type otherwise. The _invoke_array variant takes a C# object[] as the params argument (MonoArray*): in this case the value types are boxed inside the respective reference representation.

From unmanaged code you'll usually use the mono_runtime_invoke_checked() variant.

Note that this function doesn't handle virtual methods for you, it will exec the exact method you pass: we still need to expose a function to lookup the derived class implementation of a virtual method (there are examples of this in the code, though).

You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function.

If the method returns a value type, it is boxed in an object reference.

+
+ Invokes the method represented by method on the object obj. +

+ obj is the this pointer, it should be NULL for static + methods, a MonoObject* for object instances and a pointer to + the value type for value types. +

+ The params array contains the arguments to the method with the + same convention: MonoObject* pointers for object instances and + pointers to the value type otherwise. The _invoke_array + variant takes a C# object[] as the params argument (MonoArray*): + in this case the value types are boxed inside the + respective reference representation. +

+ From unmanaged code you'll usually use the + mono_runtime_invoke_checked() variant. +

+ Note that this function doesn't handle virtual methods for + you, it will exec the exact method you pass: we still need to + expose a function to lookup the derived class implementation + of a virtual method (there are examples of this in the code, + though). +

+ You can pass NULL as the exc argument if you don't want to + catch exceptions, otherwise, *exc will be set to the exception + thrown, if any. if an exception is thrown, you can't use the + MonoObject* result from the function. +

+ If the method returns a value type, it is boxed in an object + reference.

@@ -847,7 +987,14 @@ mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **

Parameters
delegate pointer to a delegate object.
params parameters for the delegate.
exc Pointer to the exception result.
Description
-

Invokes the delegate method delegate with the parameters provided.

You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function.

+
+

+ Invokes the delegate method delegate with the parameters provided. +

+ You can pass NULL as the exc argument if you don't want to + catch exceptions, otherwise, *exc will be set to the exception + thrown, if any. if an exception is thrown, you can't use the + MonoObject* result from the function.

@@ -1005,7 +1152,11 @@ mono_signature_get_params (MonoMethodSignature *sig, gpointer *iter) NULL when finished.
Description
-
Iterates over the parameters for the method signature sig. A void* pointer must be initialized to NULL to start the iteration and its address is passed to this function repeteadly until it returns NULL.
+
+ Iterates over the parameters for the method signature sig. + A void* pointer must be initialized to NULL to start the iteration + and its address is passed to this function repeteadly until it returns + NULL.
@@ -1216,7 +1367,13 @@ mono_method_header_get_clauses (MonoMethodHeader *header, MonoMethod *method, gp clauses.
Description
-

Get the info about the exception clauses in the method. Set *iter to NULL to initiate the iteration, then call the method repeatedly until it returns FALSE. At each iteration, the structure pointed to by clause if filled with the exception clause information.

+
+

+ Get the info about the exception clauses in the method. Set *iter to NULL to + initiate the iteration, then call the method repeatedly until it returns FALSE. + At each iteration, the structure pointed to by clause if filled with the + exception clause information. +

@@ -1240,7 +1397,12 @@ mono_method_header_get_code (MonoMethodHeader *header, guint32* code_size, guint
pointer to the IL code represented by the method header.
Description
-

Method header accessor to retreive info about the IL code properties: a pointer to the IL code itself, the size of the code and the max number of stack slots used by the code.

+
+

+ Method header accessor to retreive info about the IL code properties: + a pointer to the IL code itself, the size of the code and the max number + of stack slots used by the code. +

@@ -1264,6 +1426,11 @@ mono_method_header_get_locals (MonoMethodHeader *header, guint32* num_locals, gb
pointer to an array of types of the local variables
Description
-

Method header accessor to retreive info about the local variables: an array of local types, the number of locals and whether the locals are supposed to be initialized to 0 on method entry

+
+

+ Method header accessor to retreive info about the local variables: + an array of local types, the number of locals and whether the locals + are supposed to be initialized to 0 on method entry +

diff --git a/docs/deploy/mono-api-object.html b/docs/deploy/mono-api-object.html index 78c9e3e608..cd348b014d 100644 --- a/docs/deploy/mono-api-object.html +++ b/docs/deploy/mono-api-object.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -311,7 +321,15 @@ mono_object_new_alloc_specific (MonoVTable *vtable)
the allocated object.
Description
-
This function allocates a new MonoObject with the type derived from the vtable information. If the class of this object has a finalizer, then the object will be tracked for finalization.

This method might raise an exception on errors. Use the mono_object_new_fast_checked method if you want to manually raise the exception.

+
+ This function allocates a new MonoObject with the type derived + from the vtable information. If the class of this object has a + finalizer, then the object will be tracked for finalization. +

+ This method might raise an exception on errors. Use the + mono_object_new_fast_checked method if you want to manually raise + the exception. +

@@ -335,7 +353,17 @@ mono_object_new_fast (MonoVTable *vtable)
the allocated object.
Description
-

This function allocates a new MonoObject with the type derived from the vtable information. The returned object is not tracked for finalization. If your object implements a finalizer, you should use mono_object_new_alloc_specific instead.

This method might raise an exception on errors. Use the mono_object_new_fast_checked method if you want to manually raise the exception.

+
+

+ This function allocates a new MonoObject with the type derived + from the vtable information. The returned object is not tracked + for finalization. If your object implements a finalizer, you should + use mono_object_new_alloc_specific instead. +

+ This method might raise an exception on errors. Use the + mono_object_new_fast_checked method if you want to manually raise + the exception. +

@@ -427,7 +455,8 @@ mono_object_get_class (MonoObject *obj)
the MonoClass of the object.
Description
-
Use this function to obtain the MonoClass* for a given MonoObject.
+
+ Use this function to obtain the MonoClass* for a given MonoObject.
@@ -470,7 +499,9 @@ mono_object_get_virtual_method (MonoObject *obj_raw, MonoMethod *method)

Parameters
obj object to operate on.
method method
Description
-
Retrieves the MonoMethod that would be called on obj if obj is passed as the instance of a callvirt of method.
+
+ Retrieves the MonoMethod that would be called on obj if obj is passed as + the instance of a callvirt of method.
@@ -663,7 +694,9 @@ mono_value_copy (gpointer dest, gpointer src, MonoClass *klass)

Parameters
dest destination pointer
src source pointer
klass a valuetype class
Description
-
Copy a valuetype from src to dest. This function must be used when klass contains reference fields.
+
+ Copy a valuetype from src to dest. This function must be used + when klass contains reference fields.
@@ -684,7 +717,10 @@ mono_value_copy_array (MonoArray *dest, int dest_idx, gpointer src, int count)

Parameters
dest destination array
dest_idx index in the dest array
src source pointer
count number of items
Description
-
Copy count valuetype items from src to the array dest at index dest_idx. This function must be used when klass contains references fields. Overlap is handled.
+
+ Copy count valuetype items from src to the array dest at index dest_idx. + This function must be used when klass contains references fields. + Overlap is handled.
@@ -731,7 +767,8 @@ mono_array_new (MonoDomain *domain, MonoClass *eclass, uintptr_t n)

Parameters
domain domain where the object is created
eclass element class
n number of array elements
Description
-
This routine creates a new szarray with n elements of type eclass.
+
+ This routine creates a new szarray with n elements of type eclass.
@@ -752,7 +789,9 @@ mono_array_new_full (MonoDomain *domain, MonoClass *array_class, uintptr_t *leng

Parameters
domain domain where the object is created
array_class array class
lengths lengths for each dimension in the array
lower_bounds lower bounds for each dimension in the array (may be NULL)
Description
-
This routine creates a new array object with the given dimensions, lower bounds and type.
+
+ This routine creates a new array object with the given dimensions, + lower bounds and type.
@@ -773,7 +812,9 @@ mono_array_new_specific (MonoVTable *vtable, uintptr_t n)

Parameters
vtable a vtable in the appropriate domain for an initialized class
n number of array elements
Description
-
This routine is a fast alternative to mono_array_new for code which can be sure about the domain it operates in.
+
+ This routine is a fast alternative to mono_array_new for code which + can be sure about the domain it operates in.
@@ -861,7 +902,18 @@ mono_array_clone (MonoArray *array)
The element at the index position in the array.
Description
-

Use this macro to retrieve the index element of an array and extract the value assuming that the elements of the array match the provided type value.

This method can be used with both arrays holding value types and reference types. For reference types, the type parameter should be a MonoObject* or any subclass of it, like MonoString*.

This macro does not attempt to perform type checking or bounds checking.

+
+

+ Use this macro to retrieve the index element of an array and + extract the value assuming that the elements of the array match + the provided type value. +

+ This method can be used with both arrays holding value types and + reference types. For reference types, the type parameter should + be a MonoObject* or any subclass of it, like MonoString*. +

+ This macro does not attempt to perform type checking or bounds checking. +

@@ -904,7 +956,12 @@ mono_array_length (MonoArray *array)

Parameters
array array to alter
element_type A C type name, this macro will use the sizeof(type) to determine the element size
index index into the array
value value to set
version This sets the index's element of the array
Description
-
with elements of size sizeof(type) to the provided value.

This macro does not attempt to perform type checking or bounds checking.

Use this to set value types in a MonoArray.

+
+ with elements of size sizeof(type) to the provided value. +

+ This macro does not attempt to perform type checking or bounds checking. +

+ Use this to set value types in a MonoArray.

@@ -924,7 +981,13 @@ mono_array_length (MonoArray *array)

Parameters
array array to alter
index index into the array
value value to set
Description
-
Reference Type version. This sets the index's element of the array with elements of size sizeof(type) to the provided value.

This macro does not attempt to perform type checking or bounds checking.

Use this to reference types in a MonoArray.

+
+ Reference Type version. This sets the index's element of the + array with elements of size sizeof(type) to the provided value. +

+ This macro does not attempt to perform type checking or bounds checking. +

+ Use this to reference types in a MonoArray.

@@ -963,7 +1026,11 @@ mono_array_addr_with_size (MonoArray *array, int size, uintptr_t idx)
the address of the idx element in the array.
Description
-
Use this function to obtain the address for the idx item on the array containing elements of size size.

This method performs no bounds checking or type checking.

+
+ Use this function to obtain the address for the idx item on the + array containing elements of size size. +

+ This method performs no bounds checking or type checking.

@@ -989,7 +1056,8 @@ mono_array_element_size (MonoClass *ac)

LOCKING: Acquires the loader lock.

Description
-

+
+

@@ -1051,7 +1119,8 @@ mono_field_get_name (MonoClassField *field)
The name of the field.
Description
-

+
+

@@ -1075,7 +1144,8 @@ mono_field_get_parent (MonoClassField *field)
MonoClass where the field was defined.
Description
-

+
+

@@ -1118,7 +1188,21 @@ mono_field_get_value (MonoObject *obj, MonoClassField *field, void *value)

Parameters
obj Object instance
field MonoClassField describing the field to fetch information from
value pointer to the location where the value will be stored
Description
-
Use this routine to get the value of the field field in the object passed.

The pointer provided by value must be of the field type, for reference types this is a MonoObject*, for value types its the actual pointer to the value type.

For example:

 	 int i; 	

mono_field_get_value (obj, int_field, &i);

+
+ Use this routine to get the value of the field field in the object + passed. +

+ The pointer provided by value must be of the field type, for reference + types this is a MonoObject*, for value types its the actual pointer to + the value type. +

+ For example: +

+

+ int i;
+

+ mono_field_get_value (obj, int_field, &i); +

@@ -1162,7 +1246,13 @@ mono_field_set_value (MonoObject *obj, MonoClassField *field, void *value)

Parameters
obj Instance object
field MonoClassField describing the field to set
value The value to be set
Description
-

Sets the value of the field described by field in the object instance obj to the value passed in value. This method should only be used for instance fields. For static fields, use mono_field_static_set_value.

The value must be in the native format of the field type.

+
+

+ Sets the value of the field described by field in the object instance obj + to the value passed in value. This method should only be used for instance + fields. For static fields, use mono_field_static_set_value. +

+ The value must be in the native format of the field type.

@@ -1183,7 +1273,20 @@ mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value)

Parameters
vt vtable to the object
field MonoClassField describing the field to fetch information from
value where the value is returned
Description
-
Use this routine to get the value of the static field field value.

The pointer provided by value must be of the field type, for reference types this is a MonoObject*, for value types its the actual pointer to the value type.

For example:

 	     int i; 	

mono_field_static_get_value (vt, int_field, &i);

+
+ Use this routine to get the value of the static field field value. +

+ The pointer provided by value must be of the field type, for reference + types this is a MonoObject*, for value types its the actual pointer to + the value type. +

+ For example: +

+

+     int i;
+

+ mono_field_static_get_value (vt, int_field, &i); +

@@ -1204,7 +1307,10 @@ mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value)

Parameters
field MonoClassField describing the field to set
value The value to be set
Description
-
Sets the value of the static field described by field to the value passed in value. The value must be in the native format of the field type.
+
+ Sets the value of the static field described by field + to the value passed in value. + The value must be in the native format of the field type.
@@ -1278,7 +1384,11 @@ mono_property_get_flags (MonoProperty *prop)
The flags for the property.
Description
-

The metadata flags for a property are encoded using the PROPERTY_ATTRIBUTE_* constants. See the tabledefs.h file for details.

+
+

+ The metadata flags for a property are encoded using the + PROPERTY_ATTRIBUTE_* constants. See the tabledefs.h file for details. +

@@ -1383,7 +1493,15 @@ mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObjec
the value from invoking the get method on the property.
Description
-
Invokes the property's get method with the given arguments on the object instance obj (or NULL for static properties).

You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function.

+
+ Invokes the property's get method with the given arguments on the + object instance obj (or NULL for static properties). +

+ You can pass NULL as the exc argument if you don't want to + catch exceptions, otherwise, *exc will be set to the exception + thrown, if any. if an exception is thrown, you can't use the + MonoObject* result from the function. +

@@ -1404,7 +1522,14 @@ mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObjec

Parameters
prop MonoProperty to set
obj instance object on which to act
params parameters to pass to the propery
exc optional exception
Description
-
Invokes the property's set method with the given arguments on the object instance obj (or NULL for static properties).

You can pass NULL as the exc argument if you don't want to catch exceptions, otherwise, *exc will be set to the exception thrown, if any. if an exception is thrown, you can't use the MonoObject* result from the function.

+
+ Invokes the property's set method with the given arguments on the + object instance obj (or NULL for static properties). +

+ You can pass NULL as the exc argument if you don't want to + catch exceptions, otherwise, *exc will be set to the exception + thrown, if any. if an exception is thrown, you can't use the + MonoObject* result from the function.

@@ -1477,7 +1602,11 @@ mono_event_get_flags (MonoEvent *event)
The flags for the event.
Description
-

The metadata flags for an event are encoded using the EVENT_* constants. See the tabledefs.h file for details.

+
+

+ The metadata flags for an event are encoded using the + EVENT_* constants. See the tabledefs.h file for details. +

@@ -1592,7 +1721,11 @@ mono_load_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *
an address pointing to the value of field.
Description
-
This method is called by the runtime on attempts to load fields of transparent proxy objects. this points to such TP, klass is the class of the object containing field. res is a storage location which can be used to store the result.
+
+ This method is called by the runtime on attempts to load fields of + transparent proxy objects. this points to such TP, klass is the class of + the object containing field. res is a storage location which can be + used to store the result.
@@ -1613,7 +1746,8 @@ mono_load_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassFie

Parameters
this
klass
field
Description
-
Missing documentation.
+
+ Missing documentation.
@@ -1634,7 +1768,10 @@ mono_store_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField

Parameters
this_obj pointer to an object
klass klass of the object containing field
field the field to load
val the value/object to store
Description
-
This method is called by the runtime on attempts to store fields of transparent proxy objects. this_obj points to such TP, klass is the class of the object containing field. val is the new value to store in field.
+
+ This method is called by the runtime on attempts to store fields of + transparent proxy objects. this_obj points to such TP, klass is the class of + the object containing field. val is the new value to store in field.
@@ -1655,7 +1792,8 @@ mono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassFi

Parameters
this_obj
klass
field
arg
Description
-
Missing documentation
+
+ Missing documentation
diff --git a/docs/deploy/mono-api-profiler.html b/docs/deploy/mono-api-profiler.html index c13ff9c00f..5dd79c8c44 100644 --- a/docs/deploy/mono-api-profiler.html +++ b/docs/deploy/mono-api-profiler.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -187,281 +197,736 @@
-

Profiling Interface

+

Runtime Profiler API

-

Profiler Operation

+

The profiler API can be used by dynamically loaded profiler + modules to monitor different aspects of a running program. The + API is also usable by embedders without having to compile a + profiler module. -

The following methods can be used by dynamic profiler - methods to monitor different aspects of the program. +

Profiler Modules

-

A custom profiler will have one public method defined in - the shared library which is the entry point that Mono calls at - startup, it has the following signature: +

A profiler module is simply a shared library with a single + exported function which is the entry point that Mono calls at + startup. It must have the following signature: -

-	void mono_profiler_startup (const char *desc)
-	
+

+void mono_profiler_startup_example (const char *desc)
+	
-

Where "desc" is the set of arguments that were passed from - the command line. This routine will call - mono_profiler_install to activate the profiler and - will install one or more filters (one of the various - mono_profiler_install_ functions). +

Here, the example portion of the function name is + the name of the profiler module. It must match the shared library + name (i.e. libmono-profiler-example.so). desc + is the set of arguments that were passed from the command line. -

In addition, a profiler developer will typically call - mono_profiler_set_events to register which kinds of - traces should be enabled, these can be an OR-ed combination of - the following: +

For example, a bare bones profiler module might look like this + (example.c): -

-	MONO_PROFILE_NONE
-        MONO_PROFILE_APPDOMAIN_EVENTS
-        MONO_PROFILE_ASSEMBLY_EVENTS
-        MONO_PROFILE_MODULE_EVENTS    
-        MONO_PROFILE_CLASS_EVENTS     
-        MONO_PROFILE_JIT_COMPILATION  
-        MONO_PROFILE_INLINING         
-        MONO_PROFILE_EXCEPTIONS       
-        MONO_PROFILE_ALLOCATIONS      
-        MONO_PROFILE_GC               
-        MONO_PROFILE_THREADS          
-        MONO_PROFILE_REMOTING         
-        MONO_PROFILE_TRANSITIONS      
-        MONO_PROFILE_ENTER_LEAVE      
-        MONO_PROFILE_COVERAGE         
-        MONO_PROFILE_INS_COVERAGE     
-        MONO_PROFILE_STATISTICAL      
-	
+

+#include <mono/metadata/profiler.h>
+#include <stdio.h>
 
-	

Developers can change the set of monitored events at - runtime by calling mono_profiler_set_events. - - +struct _MonoProfiler { + int dummy; +} + +static MonoProfiler profiler; + +static void +runtime_inited (MonoProfiler *prof) +{ + printf ("Hello World"); +} + +void +mono_profiler_init_example (const char *desc) +{ + MonoProfilerHandle handle = mono_profiler_create (&profiler); + mono_profiler_set_runtime_initialized_callback (handle, runtime_inited); +} +

+ +

To compile this module, a C compiler must be invoked in a + similar fashion to this, on Linux: + +


+gcc -fPIC -shared -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
+	
+ +

Or on OS X: + +


+gcc -undefined suppress -flat_namespace -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
+	
+ +

You can then load the module using: + +


+mono --profile=example hello.exe
+	
+ +

(Note that adjusting LD_LIBRARY_PATH may be + necessary in order for the dynamic linker to find the module.) + +

Profiler Functions

+ +

These are the functions usable for profiling programs. + +

Each function has a note indicating whether they're async + safe. An async safe function can be invoked in a signal handler + or when the world is stopped by the GC. Conversely, a function + that is not async safe must not be invoked in such a context or + undefined behavior can occur (crashes, deadlocks, etc). + +

Some functions may only be invoked from a profiler module's + init function (or prior to running managed code in the case of + embedding). This is noted explicitly only if applicable to a + function. + +

Basic Functions

+ +

These functions are used to load and install profilers. + +

-
mono_profiler_install
+
mono_profiler_load
Syntax
-
mono_profiler_install
+
void +mono_profiler_load (const char *desc) + +

+

Description
+
+

+ Loads a profiler module based on the specified description. desc can be + of the form name:args or just name. For example, log:sample and + log will both load libmono-profiler-log.so. The description is passed + to the module after it has been loaded. If the specified module has already + been loaded, this function has no effect. +

+ A module called foo should declare an entry point like so: +

+


+ void mono_profiler_init_foo (const char *desc)
+ {
+ }
+ 
+

+ This function is not async safe. +

+ This function may only be called by embedders prior to running managed + code.

- +
-
mono_profiler_install_allocation
+
mono_profiler_create
Syntax
-
mono_profiler_install_allocation
+
MonoProfilerHandle +mono_profiler_create (MonoProfiler *prof) + +

+

Description
+
+

+ Installs a profiler and returns a handle for it. The handle is used with the + other functions in the profiler API (e.g. for setting up callbacks). The + given structure pointer, prof, will be passed to all callbacks from the + profiler API. It can be NULL. +

+ Example usage: +

+


+ struct _MonoProfiler {
+ 	int my_stuff;
+ 	// ...
+ };
+
+ MonoProfiler *prof = malloc (sizeof (MonoProfiler));
+ prof->my_stuff = 42;
+ MonoProfilerHandle handle = mono_profiler_create (prof);
+ mono_profiler_set_shutdown_callback (handle, my_shutdown_cb);
+ 
+

+ This function is not async safe. +

+ This function may only be called from a profiler's init function or prior + to running managed code.

- +
-
mono_profiler_install_appdomain
+
mono_profiler_set_cleanup_callback
Syntax
-
mono_profiler_install_appdomain
+
void +mono_profiler_set_cleanup_callback (MonoProfilerHandle handle, MonoProfilerCleanupCallback cb) + +

+

Description
+
+

+ Sets a profiler cleanup function. This function will be invoked at shutdown + when the profiler API is cleaning up its internal structures. It's mainly + intended for a profiler to free the structure pointer that was passed to + mono_profiler_create, if necessary. +

+ This function is async safe.

+
+
+ +

Code Coverage

+ +

These functions provide access to the JIT compiler's code + coverage support. This functionality can be used to collect + information about how many times certain code paths have been + executed. + +

+ + +
+
mono_profiler_enable_coverage
+
+
+
+
+ +
Syntax
+
mono_bool +mono_profiler_enable_coverage (void) + +
+

+

Description
+
+

+ Enables support for code coverage instrumentation. At the moment, this means + enabling the debug info subsystem. If this function is not called, it will + not be possible to use mono_profiler_get_coverage_data. Returns TRUE + if code coverage support was enabled, or FALSE if the function was called + too late for this to be possible. +

+ This function is not async safe. +

+ This function may only be called from a profiler's init function or prior + to running managed code.

- +
-
mono_profiler_install_assembly
+
mono_profiler_set_coverage_filter_callback
Syntax
-
mono_profiler_install_assembly
+
void +mono_profiler_set_coverage_filter_callback (MonoProfilerHandle handle, MonoProfilerCoverageFilterCallback cb) + +

+

Description
+
+

+ Sets a code coverage filter function. The profiler API will invoke filter + functions from all installed profilers. If any of them return TRUE, then + the given method will be instrumented for coverage analysis. All filters are + guaranteed to be called at least once per method, even if an earlier filter + has already returned TRUE. +

+ Note that filter functions must be installed before a method is compiled in + order to have any effect, i.e. a filter should be registered in a profiler's + init function or prior to running managed code (if embedding). +

+ This function is async safe.

- +
-
mono_profiler_install_class
+
mono_profiler_get_coverage_data
Syntax
-
mono_profiler_install_class
+
mono_bool +mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb) + +

+

Description
+
+

+ Retrieves all coverage data for method and invokes cb for each entry. + Source location information will only be filled out if method has debug + info available. Returns TRUE if method was instrumented for code + coverage; otherwise, FALSE. +

+ Please note that the structure passed to cb is only valid for the + duration of the callback. +

+ This function is not async safe.

+
+
+ +

Statistical Sampling

+ +

Statistical sampling can be used to interrupt managed threads + based on a certain mode and frequency for the purpose of + collecting data about their current work. + +

One common use case for this functionality, usually referred + to as call sampling, is to collect a backtrace from every thread + when a sampling hit event arrives. This data can then be compiled + into a report indicating where a program spends most of its time. + +

+ + +
+
mono_profiler_enable_sampling
+
+
+
+
+ +
Syntax
+
mono_bool +mono_profiler_enable_sampling (MonoProfilerHandle handle) + +
+

+

Description
+
+

+ Enables the sampling thread. Users must call this function if they intend + to use statistical sampling; mono_profiler_set_sample_mode will have no + effect if this function has not been called. The first profiler to call this + function will get ownership over sampling settings (mode and frequency) so + that no other profiler can change those settings. Returns TRUE if the + sampling thread was enabled, or FALSE if the function was called too late + for this to be possible. +

+ Note that mono_profiler_set_sample_mode must still be called with a mode + other than MONO_PROFILER_SAMPLE_MODE_NONE to actually start sampling. +

+ This function is not async safe. +

+ This function may only be called from a profiler's init function or prior + to running managed code.

- +
-
mono_profiler_install_coverage_filter
+
mono_profiler_set_sample_mode
Syntax
-
mono_profiler_install_coverage_filter
+
mono_bool +mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint32_t freq) + +

+

Description
+
+

+ Sets the sampling mode and frequency (in Hz). freq must be a positive + number. If the calling profiler has ownership over sampling settings, the + settings will be changed and this function will return TRUE; otherwise, + it returns FALSE without changing any settings. +

+ This function is async safe.

- +
-
mono_profiler_install_enter_leave
+
mono_profiler_get_sample_mode
Syntax
-
mono_profiler_install_enter_leave
+
mono_bool +mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint32_t *freq) + +

+

Description
+
+

+ Retrieves the current sampling mode and/or frequency (in Hz). Returns + TRUE if the calling profiler is allowed to change the sampling settings; + otherwise, FALSE. +

+ This function is async safe.

+
+
+ +

A callback must be registered to receive sample hit events. + Please see the Callback Registration section below. + +

GC Allocations

+ +

Profilers can be notified about all GC allocations performed + by a program or the Mono runtime. + +

+ + +
+
mono_profiler_enable_allocations
+
+
+
+
+ +
Syntax
+
mono_bool +mono_profiler_enable_allocations (void) + +
+

+

Description
+
+

+ Enables instrumentation of GC allocations. This is necessary so that managed + allocators can be instrumented with a call into the profiler API. + Allocations will not be reported unless this function is called. Returns + TRUE if allocation instrumentation was enabled, or FALSE if the + function was called too late for this to be possible. +

+ This function is not async safe. +

+ This function may only be called from a profiler's init function or prior + to running managed code.

+
+
+ +

A callback must be registered to receive allocation events. + Please see the Callback Registration section below. + +

Call Instrumentation

+ +

The JIT compiler supports instrumenting managed method entry + and exit points so that a profiler callback will be invoked. + +

While such callbacks by themselves have traditionally only + been useful for call count profiling and the like, Mono gives + these callbacks access to the arguments, locals, and return + value of instrumented methods (together referred to as the 'call + context'). This enables many profiling scenarios that would + otherwise have required explicit hooks in the base class + libraries. + +

+ + +
+
mono_profiler_set_call_instrumentation_filter_callback
+
+
+
+
+ +
Syntax
+
void +mono_profiler_set_call_instrumentation_filter_callback (MonoProfilerHandle handle, MonoProfilerCallInstrumentationFilterCallback cb) + +
+

+

Description
+
+

+ Sets a call instrumentation filter function. The profiler API will invoke + filter functions from all installed profilers. If any of them return flags + other than MONO_PROFILER_CALL_INSTRUMENTATION_NONE, then the given method + will be instrumented as requested. All filters are guaranteed to be called + exactly once per method, even if earlier filters have already specified all + flags. +

+ Note that filter functions must be installed before a method is compiled in + order to have any effect, i.e. a filter should be registered in a profiler's + init function or prior to running managed code (if embedding). Also, to + instrument a method that's going to be AOT-compiled, a filter must be + installed at AOT time. This can be done in exactly the same way as one would + normally, i.e. by passing the --profile option on the command line, by + calling mono_profiler_load, or simply by using the profiler API as an + embedder. +

+ Indiscriminate method instrumentation is extremely heavy and will slow down + most applications to a crawl. Users should consider sampling as a possible + alternative to such heavy-handed instrumentation. +

+ This function is async safe.

- +
-
mono_profiler_install_jit_compile
+
mono_profiler_enable_call_context_introspection
Syntax
-
mono_profiler_install_jit_compile
+
mono_bool +mono_profiler_enable_call_context_introspection (void) + +

+

Description
+
+

+ Enables support for retrieving stack frame data from a call context. At the + moment, this means enabling the debug info subsystem. If this function is not + called, it will not be possible to use the call context introspection + functions (they will simply return NULL). Returns TRUE if call context + introspection was enabled, or FALSE if the function was called too late for + this to be possible. +

+ Please note: Mono's LLVM backend does not support this feature. This means + that methods with call context instrumentation will be handled by Mono's + JIT even in LLVM mode. There is also a special case when Mono is compiling + in LLVM-only mode: Since LLVM does not provide a way to implement call + contexts, a NULL context will always be passed to enter/leave events even + though this method returns TRUE. +

+ This function is not async safe. +

+ This function may only be called from a profiler's init function or prior + to running managed code.

- +
-
mono_profiler_install_module
+
mono_profiler_call_context_get_this
Syntax
-
mono_profiler_install_module
+
void* +mono_profiler_call_context_get_this (MonoProfilerCallContext *context) + +

+

Description
+
+

+ Given a valid call context from an enter/leave event, retrieves a pointer to + the this reference for the method. Returns NULL if none exists (i.e. + it's a static method) or if call context introspection was not enabled. +

+ The buffer returned by this function must be freed with + mono_profiler_call_context_free_buffer. +

+ Please note that a call context is only valid for the duration of the + enter/leave callback it was passed to. +

+ This function is not async safe.

- +
-
mono_profiler_install_thread
+
mono_profiler_call_context_get_argument
Syntax
-
mono_profiler_install_thread
+
void* +mono_profiler_call_context_get_argument (MonoProfilerCallContext *context, uint32_t position) + +

+

Description
+
+

+ Given a valid call context from an enter/leave event, retrieves a pointer to + the method argument at the given position. Returns NULL if position is + out of bounds or if call context introspection was not enabled. +

+ The buffer returned by this function must be freed with + mono_profiler_call_context_free_buffer. +

+ Please note that a call context is only valid for the duration of the + enter/leave callback it was passed to. +

+ This function is not async safe.

- +
-
mono_profiler_install_transition
+
mono_profiler_call_context_get_local
Syntax
-
mono_profiler_install_transition
+
void* +mono_profiler_call_context_get_local (MonoProfilerCallContext *context, uint32_t position) + +

+

Description
+
+

+ Given a valid call context from an enter/leave event, retrieves a pointer to + the local variable at the given position. Returns NULL if position is + out of bounds or if call context introspection was not enabled. +

+ The buffer returned by this function must be freed with + mono_profiler_call_context_free_buffer. +

+ Please note that a call context is only valid for the duration of the + enter/leave callback it was passed to. +

+ This function is not async safe.

- +
-
mono_profiler_install_gc
+
mono_profiler_call_context_get_result
Syntax
-
mono_profiler_install_gc
+
void* +mono_profiler_call_context_get_result (MonoProfilerCallContext *context) + +

+

Description
+
+

+ Given a valid call context from an enter/leave event, retrieves a pointer to + return value of a method. Returns NULL if the method has no return value + (i.e. it returns void), if the leave event was the result of a tail call, + if the function is called on a context from an enter event, or if call + context introspection was not enabled. +

+ The buffer returned by this function must be freed with + mono_profiler_call_context_free_buffer. +

+ Please note that a call context is only valid for the duration of the + enter/leave callback it was passed to. +

+ This function is not async safe.

- +
-
mono_profiler_install_statistical
+
mono_profiler_call_context_free_buffer
Syntax
-
mono_profiler_install_statistical
-

-

-
-
- - -
-
mono_profiler_set_events
-
-
-
-
- -
Syntax
-
mono_profiler_set_events
-

-

-
-
- - -
-
mono_profiler_get_events
-
-
-
-
- -
Syntax
-
mono_profiler_get_events
+
void +mono_profiler_call_context_free_buffer (void *buffer) + +

+

Description
+
+

+ Frees a buffer returned by one of the call context introspection functions. + Passing a NULL value for buffer is allowed, which makes this function + a no-op. +

+ This function is not async safe.

-

Coverage

+

Callbacks must be registered to receive method entry and exit + events. Please see the Callback Registration section + below. -

To support profiling modules that need to do code coverage - analysis, the following routines is provided: - +

Callback Registration

+ +

In addition to the above functions, there's a large set of + functions for installing generic profiler event callbacks. These + are generated from C macros and so are not documented here. + Please refer to the mono/metadata/profiler.h and + mono/metadata/profiler-events.h headers for a full + listing of these. + +

Callback registration functions are all async safe and can be + safely invoked from multiple threads at the same time, with the + caveat that altering a registered callback from one thread will + not immediately affect another thread that is already invoking + the current callback. + +

API Stability

+ +

The profiler API does not have the same API stability + garantees that the rest of the Mono embedding API does. While + a breaking change to the profiler API is extremely rare, it has + happened in the past when changing the API in a backwards + compatible way was deemed to be too much work for too little + gain. + +

Therefore, developers of profiler modules may rarely need to + update their code to work with new versions of the profiler API. + +

Developers who wish to support older versions of the API can + perform a compile time check of the + MONO_PROFILER_API_VERSION macro and maintain code + for both old and new versions. + +

To aid with transitioning to a new version of the profiler + API, the Mono runtime will detect and reject loading profiler diff --git a/docs/deploy/mono-api-reflection.html b/docs/deploy/mono-api-reflection.html index 97e48f58c6..23ec6ae18a 100644 --- a/docs/deploy/mono-api-reflection.html +++ b/docs/deploy/mono-api-reflection.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -266,7 +276,9 @@ mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObj

a Byte array representing the blob of data.
Description
-
Creates the blob of data that needs to be saved in the metadata and that represents the custom attributed described by ctor, ctorArgs etc.
+
+ Creates the blob of data that needs to be saved in the metadata and that represents + the custom attributed described by ctor, ctorArgs etc.
@@ -381,7 +393,10 @@ mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ig

Parameters
image a metadata context
info type description structure
ignorecase flag for case-insensitive string compares
type_resolve whenever type resolve was already tried
Description
-

Build a MonoType from the type description in info.

+
+

+ Build a MonoType from the type description in info. +

@@ -442,7 +457,12 @@ mono_reflection_type_from_name (char *name, MonoImage *image)

Parameters
name type name.
image a metadata context (can be NULL).
Description
-

Retrieves a MonoType from its name. If the name is not fully qualified, it defaults to get the type from image or, if image is NULL or loading from it fails, uses corlib.

+
+

+ Retrieves a MonoType from its name. If the name is not fully qualified, + it defaults to get the type from image or, if image is NULL or loading + from it fails, uses corlib. +

@@ -469,7 +489,8 @@ mono_reflection_get_custom_attrs_info (MonoObject *obj_raw)

FIXME this function leaks like a sieve for SRE objects.

Description
-

+
+

@@ -603,7 +624,8 @@ mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
NULL if no attributes are found or if a loading error occurs.
Description
-

+
+

@@ -645,7 +667,10 @@ mono_custom_attrs_from_param (MonoMethod *method, guint32 param)
the custom attribute object for the specified parameter, or NULL if there are none.
Description
-

The result must be released with mono_custom_attrs_free().

+
+

+ The result must be released with mono_custom_attrs_free(). +

diff --git a/docs/deploy/mono-api-security.html b/docs/deploy/mono-api-security.html index dd82b10124..f628a86a69 100644 --- a/docs/deploy/mono-api-security.html +++ b/docs/deploy/mono-api-security.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -210,7 +220,8 @@ mono_declsec_flags_from_assembly (MonoAssembly *assembly)
the declarative security flags for the assembly.
Description
-
Get the security actions (in the form of flags) associated with the specified assembly.
+
+ Get the security actions (in the form of flags) associated with the specified assembly.
@@ -234,7 +245,10 @@ mono_declsec_flags_from_class (MonoClass *klass)
the declarative security flags for the class.
Description
-
Get the security actions (in the form of flags) associated with the specified class. We cache the flags inside the MonoClass structure as this will get called very often (at least for each method).
+
+ Get the security actions (in the form of flags) associated with the specified class. + We cache the flags inside the MonoClass structure as this will get + called very often (at least for each method).
@@ -258,7 +272,10 @@ mono_declsec_flags_from_method (MonoMethod *method)
the declarative security flags for the method (only).
Description
-
Get the security actions (in the form of flags) associated with the specified method. To keep MonoMethod size down we do not cache the declarative security flags (except for the stack modifiers which are kept in the MonoJitInfo structure)
+
+ Get the security actions (in the form of flags) associated with the specified method. + To keep MonoMethod size down we do not cache the declarative security flags + (except for the stack modifiers which are kept in the MonoJitInfo structure)
@@ -314,7 +331,10 @@ mono_declsec_get_demands (MonoMethod *method, MonoDeclSecurityActions* demands)

Description
-
Collect all actions (that requires to generate code in mini) assigned for the specified method. Don't use the content of actions if the function return FALSE.
+
+ Collect all actions (that requires to generate code in mini) assigned for + the specified method. + Don't use the content of actions if the function return FALSE.
@@ -338,7 +358,9 @@ mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions
TRUE if inheritance demands (any kind) are present, FALSE otherwise.
Description
-
Collect all Inherit actions - InheritanceDemand, NonCasInheritanceDemand and InheritanceDemandChoice (2.0). Don't use the content of actions if the function return FALSE.
+
+ Collect all Inherit actions - InheritanceDemand, NonCasInheritanceDemand and InheritanceDemandChoice (2.0). + Don't use the content of actions if the function return FALSE.
@@ -359,7 +381,8 @@ mono_declsec_get_inheritdemands_method (MonoMethod *method, MonoDeclSecurityActi

Parameters
actions InheritanceDemand, NonCasInheritanceDemand and InheritanceDemandChoice (2.0).
Description
-
Don't use the content of actions if the function return FALSE.
+
+ Don't use the content of actions if the function return FALSE.
@@ -380,6 +403,7 @@ mono_declsec_get_linkdemands (MonoMethod *method, MonoDeclSecurityActions* klass

Parameters
actions LinkDemand, NonCasLinkDemand and LinkDemandChoice (2.0).
Description
-
Don't use the content of actions if the function return FALSE.
+
+ Don't use the content of actions if the function return FALSE.
diff --git a/docs/deploy/mono-api-string.html b/docs/deploy/mono-api-string.html index b8aa8e1726..4689a3d1de 100644 --- a/docs/deploy/mono-api-string.html +++ b/docs/deploy/mono-api-string.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -241,7 +251,8 @@ mono_string_new (MonoDomain *domain, const char *text)
A newly created string object which contains text.
Description
-
This function asserts if it cannot allocate a new string.
+
+ This function asserts if it cannot allocate a new string.
@@ -353,7 +364,8 @@ mono_string_from_utf16 (gunichar2 *data)
a MonoString.
Description
-
Converts a NULL-terminated UTF-16 string (LPWSTR) to a MonoString.
+
+ Converts a NULL-terminated UTF-16 string (LPWSTR) to a MonoString.
@@ -377,7 +389,8 @@ mono_string_from_utf32 (mono_unichar4 *data)
a MonoString.
Description
-
Converts a UTF-32 (UCS-4) string to a MonoString.
+
+ Converts a UTF-32 (UCS-4) string to a MonoString.
@@ -449,7 +462,10 @@ mono_string_to_utf8_checked (MonoString *s, MonoError *error)

Parameters
s a System.String
error a MonoError.
Description
-
Converts a MonoString to its UTF-8 representation. May fail; check error to determine whether the conversion was successful. The resulting buffer should be freed with mono_free().
+
+ Converts a MonoString to its UTF-8 representation. May fail; check + error to determine whether the conversion was successful. + The resulting buffer should be freed with mono_free().
@@ -499,7 +515,10 @@ mono_string_equal (MonoString *s1, MonoString *s2)
FALSE if the strings differ.
Description
-

Compares two MonoString* instances ordinally for equality.

+
+

+ Compares two MonoString* instances ordinally for equality. +

@@ -523,7 +542,9 @@ mono_string_hash (MonoString *s)
the hash for the string.
Description
-

Compute the hash for a MonoString*

+
+

+ Compute the hash for a MonoString*

@@ -547,7 +568,8 @@ mono_string_intern (MonoString *str)
The interned string.
Description
-
Interns the string passed.
+
+ Interns the string passed.
@@ -590,7 +612,8 @@ mono_string_new_wrapper (const char *text)

Parameters
text pointer to UTF-8 characters.
Description
-
Helper function to create a string object from text in the current domain.
+
+ Helper function to create a string object from text in the current domain.
diff --git a/docs/deploy/mono-api-threads.html b/docs/deploy/mono-api-threads.html index 2b4bd5ce0a..0a00a25546 100644 --- a/docs/deploy/mono-api-threads.html +++ b/docs/deploy/mono-api-threads.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -344,7 +354,11 @@ mono_thread_is_foreign (MonoThread *thread)
TRUE if thread was not created by the runtime.
Description
-

This function allows one to determine if a thread was created by the mono runtime and has a well defined lifecycle or it's a foreign one, created by the native environment.

+
+

+ This function allows one to determine if a thread was created by the mono runtime and has + a well defined lifecycle or it's a foreign one, created by the native environment. +

@@ -492,7 +506,11 @@ mono_thread_set_main (MonoThread *thread)

Parameters
thread thread to set as the main thread
Description
-
This function can be used to instruct the runtime to treat thread as the main thread, ie, the thread that would normally execute the Main method. This basically means that at the end of thread, the runtime will wait for the existing foreground threads to quit and other such details.
+
+ This function can be used to instruct the runtime to treat thread + as the main thread, ie, the thread that would normally execute the Main + method. This basically means that at the end of thread, the runtime will + wait for the existing foreground threads to quit and other such details.
@@ -608,6 +626,10 @@ mono_thread_detach_if_exiting (void)

Description
-

Detach the current thread from the runtime if it is exiting, i.e. it is running pthread dtors. This should be used at the end of embedding code which calls into managed code, and which can be called from pthread dtors, like dealloc: implementations in Objective-C.

+
+

+ Detach the current thread from the runtime if it is exiting, i.e. it is running pthread dtors. + This should be used at the end of embedding code which calls into managed code, and which + can be called from pthread dtors, like dealloc: implementations in Objective-C.

diff --git a/docs/deploy/mono-api-type.html b/docs/deploy/mono-api-type.html index 5d9277b6b0..55b50fbcdc 100644 --- a/docs/deploy/mono-api-type.html +++ b/docs/deploy/mono-api-type.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -241,7 +251,10 @@ mono_type_create_from_typespec (MonoImage *image, guint32 type_spec)

Parameters
image context where the image is created
type_spec typespec token
Description
-

Creates a MonoType representing the TypeSpec indexed by the type_spec token.

+
+

+ Creates a MonoType representing the TypeSpec indexed by the type_spec + token.

@@ -285,7 +298,8 @@ mono_type_get_array_type (MonoType *type) represents. The info includes details such as rank, array element type and the sizes and bounds of multidimensional arrays.
Description
-
It is only valid to call this function if type is a MONO_TYPE_ARRAY .
+
+ It is only valid to call this function if type is a MONO_TYPE_ARRAY .
@@ -309,7 +323,10 @@ mono_type_get_class (MonoType *type)
the MonoClass pointer that describes the class that type represents.
Description
-
It is only valid to call this function if type is a MONO_TYPE_CLASS or a MONO_TYPE_VALUETYPE . For more general functionality, use mono_class_from_mono_type, instead.
+
+ It is only valid to call this function if type is a MONO_TYPE_CLASS or a + MONO_TYPE_VALUETYPE . For more general functionality, use mono_class_from_mono_type, + instead.
@@ -373,7 +390,9 @@ mono_type_get_ptr_type (MonoType *type) represents a pointer to.
Description
-
\pararm type the MonoType operated on It is only valid to call this function if type is a MONO_TYPE_PTR .
+
+ \pararm type the MonoType operated on + It is only valid to call this function if type is a MONO_TYPE_PTR .
@@ -398,7 +417,8 @@ mono_type_get_signature (MonoType *type) of the function pointer type represents.
Description
-
It is only valid to call this function if type is a MONO_TYPE_FNPTR .
+
+ It is only valid to call this function if type is a MONO_TYPE_FNPTR .
@@ -627,6 +647,8 @@ mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, gboolean as_fiel describing the underlying native reprensetation of the type.
Description
-
The value pointed to by conv will contain the kind of marshalling required for this particular type one of the MONO_MARSHAL_CONV_ enumeration values.
+
+ The value pointed to by conv will contain the kind of marshalling required for this + particular type one of the MONO_MARSHAL_CONV_ enumeration values.
diff --git a/docs/deploy/mono-api-types.html b/docs/deploy/mono-api-types.html index 73f8400c3d..67d90b0f9a 100644 --- a/docs/deploy/mono-api-types.html +++ b/docs/deploy/mono-api-types.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -210,7 +220,8 @@ mono_get_object_class (void)
The MonoClass* for the System.Object type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Object .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Object .
@@ -233,7 +244,8 @@ mono_get_int16_class (void)
The MonoClass* for the System.Int16 type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Int16 .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Int16 .
@@ -256,7 +268,8 @@ mono_get_int32_class (void)
The MonoClass* for the System.Int32 type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Int32 .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Int32 .
@@ -279,7 +292,8 @@ mono_get_int64_class (void)
The MonoClass* for the System.Int64 type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Int64 .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Int64 .
@@ -302,7 +316,8 @@ mono_get_double_class (void)
The MonoClass* for the System.Double type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Double (64-bit floating points).
+
+ Use this function to get the MonoClass* that the runtime is using for System.Double (64-bit floating points).
@@ -325,7 +340,8 @@ mono_get_enum_class (void)
The MonoClass* for the System.Enum type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Enum .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Enum .
@@ -348,7 +364,8 @@ mono_get_intptr_class (void)
The MonoClass* for the System.IntPtr type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.IntPtr .
+
+ Use this function to get the MonoClass* that the runtime is using for System.IntPtr .
@@ -371,7 +388,8 @@ mono_get_sbyte_class (void)
The MonoClass* for the System.SByte type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.SByte.
+
+ Use this function to get the MonoClass* that the runtime is using for System.SByte.
@@ -394,7 +412,8 @@ mono_get_single_class (void)
The MonoClass* for the System.Single type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Single (32-bit floating points).
+
+ Use this function to get the MonoClass* that the runtime is using for System.Single (32-bit floating points).
@@ -417,7 +436,8 @@ mono_get_string_class (void)
The MonoClass* for the System.String type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.String .
+
+ Use this function to get the MonoClass* that the runtime is using for System.String .
@@ -440,7 +460,8 @@ mono_get_thread_class (void)
The MonoClass* for the System.Threading.Thread type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Threading.Thread .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Threading.Thread .
@@ -463,7 +484,8 @@ mono_get_uint16_class (void)
The MonoClass* for the System.UInt16 type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.UInt16 .
+
+ Use this function to get the MonoClass* that the runtime is using for System.UInt16 .
@@ -486,7 +508,8 @@ mono_get_uint32_class (void)
The MonoClass* for the System.UInt32 type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.UInt32 .
+
+ Use this function to get the MonoClass* that the runtime is using for System.UInt32 .
@@ -509,7 +532,8 @@ mono_get_uint64_class (void)
The MonoClass* for the System.UInt64 type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.UInt64 .
+
+ Use this function to get the MonoClass* that the runtime is using for System.UInt64 .
@@ -532,7 +556,8 @@ mono_get_uintptr_class (void)
The MonoClass* for the System.UIntPtr type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.UIntPtr .
+
+ Use this function to get the MonoClass* that the runtime is using for System.UIntPtr .
@@ -555,7 +580,8 @@ mono_get_void_class (void)
The MonoClass* for the System.Void type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Void .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Void .
@@ -578,7 +604,8 @@ mono_get_array_class (void)
The MonoClass* for the System.Array type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Array .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Array .
@@ -601,7 +628,8 @@ mono_get_boolean_class (void)
The MonoClass* for the System.Boolean type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Boolean .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Boolean .
@@ -624,7 +652,8 @@ mono_get_byte_class (void)
The MonoClass* for the System.Byte type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Byte .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Byte .
@@ -647,7 +676,8 @@ mono_get_char_class (void)
The MonoClass* for the System.Char type.
Description
-
Use this function to get the MonoClass* that the runtime is using for System.Char .
+
+ Use this function to get the MonoClass* that the runtime is using for System.Char .
diff --git a/docs/deploy/mono-api-unsorted.html b/docs/deploy/mono-api-unsorted.html index de3ffbf12b..5e9cd43730 100644 --- a/docs/deploy/mono-api-unsorted.html +++ b/docs/deploy/mono-api-unsorted.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -231,7 +241,8 @@ mono_check_corlib_version (void) allocated string with the error otherwise.
Description
-
Checks that the corlib that is loaded matches the version of this runtime.
+
+ Checks that the corlib that is loaded matches the version of this runtime.
@@ -252,7 +263,9 @@ mono_compile_method (MonoMethod *method)

Parameters
method The method to compile.
Description
-
This JIT-compiles the method, and returns the pointer to the native code produced.
+
+ This JIT-compiles the method, and returns the pointer to the native code + produced.
@@ -291,7 +304,29 @@ mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, cons

Parameters
assembly if NULL, this is a global mapping, otherwise the remapping of the dynamic library will only apply to the specified assembly
dll The name of the external library, as it would be found in the DllImport declaration. If prefixed with i: the matching of the library name is done without case sensitivity
func if not null, the mapping will only applied to the named function (the value of EntryPoint)
tdll The name of the library to map the specified dll if it matches.
tfunc The name of the function that replaces the invocation. If NULL, it is replaced with a copy of func.
Description
-

LOCKING: Acquires the loader lock.

This function is used to programatically add DllImport remapping in either a specific assembly, or as a global remapping. This is done by remapping references in a DllImport attribute from the dll library name into the tdll name. If the dll name contains the prefix i:, the comparison of the library name is done without case sensitivity.

If you pass func, this is the name of the EntryPoint in a DllImport if specified or the name of the function as determined by DllImport. If you pass func, you must also pass tfunc which is the name of the target function to invoke on a match.

Example:

mono_dllmap_insert (NULL, "i:libdemo.dll", NULL, relocated_demo_path, NULL);

The above will remap DllImport statements for libdemo.dll and LIBDEMO.DLL to the contents of relocated_demo_path for all assemblies in the Mono process.

NOTE: This can be called before the runtime is initialized, for example from mono_config_parse.

+
+

+ LOCKING: Acquires the loader lock. +

+ This function is used to programatically add DllImport remapping in either + a specific assembly, or as a global remapping. This is done by remapping + references in a DllImport attribute from the dll library name into the tdll + name. If the dll name contains the prefix i:, the comparison of the + library name is done without case sensitivity. +

+ If you pass func, this is the name of the EntryPoint in a DllImport if specified + or the name of the function as determined by DllImport. If you pass func, you + must also pass tfunc which is the name of the target function to invoke on a match. +

+ Example: +

+ mono_dllmap_insert (NULL, "i:libdemo.dll", NULL, relocated_demo_path, NULL); +

+ The above will remap DllImport statements for libdemo.dll and LIBDEMO.DLL to + the contents of relocated_demo_path for all assemblies in the Mono process. +

+ NOTE: This can be called before the runtime is initialized, for example from + mono_config_parse.

@@ -368,7 +403,8 @@ mono_get_corlib (void)
The MonoImage for mscorlib.dll
Description
-
Use this function to get the MonoImage* for the mscorlib.dll assembly
+
+ Use this function to get the MonoImage* for the mscorlib.dll assembly
@@ -450,7 +486,13 @@ mono_get_root_domain (void)
the root appdomain, to obtain the current domain, use mono_domain_get ()
Description
-

The root AppDomain is the initial domain created by the runtime when it is initialized. Programs execute on this AppDomain, but can create new ones later. Currently there is no unmanaged API to create new AppDomains, this must be done from managed code.

+
+

+ The root AppDomain is the initial domain created by the runtime when it is + initialized. Programs execute on this AppDomain, but can create new ones + later. Currently there is no unmanaged API to create new AppDomains, this + must be done from managed code. +

@@ -561,7 +603,8 @@ mono_runtime_class_init (MonoVTable *vtable)

Parameters
vtable vtable that needs to be initialized
Description
-
This routine calls the class constructor for vtable.
+
+ This routine calls the class constructor for vtable.
@@ -582,7 +625,12 @@ mono_runtime_cleanup (MonoDomain *domain)

Parameters
domain unused.
Description
-

Internal routine.

This must not be called while there are still running threads executing managed code.

+
+

+ Internal routine. +

+ This must not be called while there are still running threads executing + managed code.

@@ -624,7 +672,15 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb, MonoThreadAtt

Parameters
domain domain returned by mono_init
Description
-

Initialize the core AppDomain: this function will run also some IL initialization code, so it needs the execution engine to be fully operational.

AppDomain.SetupInformation is set up in mono_runtime_exec_main, where we know the entry_assembly.

+
+

+ Initialize the core AppDomain: this function will run also some + IL initialization code, so it needs the execution engine to be fully + operational. +

+ AppDomain.SetupInformation is set up in mono_runtime_exec_main, where + we know the entry_assembly. +

@@ -667,7 +723,9 @@ mono_runtime_object_init (MonoObject *this_obj)

Parameters
this_obj the object to initialize
Description
-
This function calls the zero-argument constructor (which must exist) for the given object.
+
+ This function calls the zero-argument constructor (which must + exist) for the given object.
@@ -707,7 +765,10 @@ mono_runtime_run_main (MonoMethod *method, int argc, char* argv[],

Parameters
method the method to start the application with (usually Main)
argc number of arguments from the command line
argv array of strings from the command line
exc excetption results
Description
-
Execute a standard Main method (argc / argv contains the executable name). This method also sets the command line argument value needed by System.Environment.
+
+ Execute a standard Main method (argc / argv contains the + executable name). This method also sets the command line argument value + needed by System.Environment.
diff --git a/docs/deploy/mono-api-utils.html b/docs/deploy/mono-api-utils.html index db1cfd205f..b37f830a6d 100644 --- a/docs/deploy/mono-api-utils.html +++ b/docs/deploy/mono-api-utils.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; @@ -266,7 +276,8 @@ mono_stack_walk_async_safe (MonoStackWalkAsyncSafe func, void *initial_sig_conte

Description
-
Async safe version callable from signal handlers.
+
+ Async safe version callable from signal handlers.
diff --git a/docs/deploy/mono-api-vm.html b/docs/deploy/mono-api-vm.html index ffdd3e56aa..e9be0fc0b0 100644 --- a/docs/deploy/mono-api-vm.html +++ b/docs/deploy/mono-api-vm.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; diff --git a/docs/deploy/mono-api-wapi.html b/docs/deploy/mono-api-wapi.html index 98a8b3d01c..6c18a3d9fe 100644 --- a/docs/deploy/mono-api-wapi.html +++ b/docs/deploy/mono-api-wapi.html @@ -48,6 +48,16 @@ line-height: 0px; } + .mapi-codeblock { + display: block; + padding: 5pt 5pt; + margin: 10pt; + white-space: pre; + font-family: monospace; + border: 1px solid rgba(233,233,233,1); + background-color: rgba(249,249,249,1); + } + .mapi-entry code { border: none; background-color: transparent; diff --git a/docs/exdoc b/docs/exdoc index 92027663e6..0fff1dc732 100644 --- a/docs/exdoc +++ b/docs/exdoc @@ -124,6 +124,7 @@ sub process_function { my $body = ''; my $returns = ''; my $prototype = ''; + my $codeblock = 'false'; while (<$file>) { @@ -156,7 +157,6 @@ sub process_function { if (defined($deprecated)) { process_formatting(\$deprecated, $file_path, $.); } - $body =~ s/\n/ /g; if (exists($docs->{body}->{$name})) { my $origin = $docs->{origin}->{$name}; @@ -180,8 +180,16 @@ sub process_function { chomp; s/^ +\*//; - # Replace blank lines with paragraph breaks. - $_ = '

' if /^\s*$/; + if (/\s*\\code$/) { + $codeblock = 'true'; + } elsif (/\s*\\endcode$/) { + $codeblock = 'false'; + } + + # Replace blank lines with paragraph breaks if we're not in a code block. + if (/^\s*$/) { + $_ = '

' if $codeblock eq 'false'; + } if ($section == $PARAMETER_SECTION) { if (/\s*\\param +(\w+)(.*)/) { @@ -210,7 +218,7 @@ sub process_function { $returns = "\t$_\n"; $section = $RETURN_SECTION; } else { - $body .= "\n\t$_"; + $body .= "\n$_"; } } elsif ($section == $RETURN_SECTION) { $returns .= "\n\t$_"; @@ -227,6 +235,12 @@ sub process_formatting { my ($content, $file_path, $current_line) = @_; $_ = $$content; + # General formatting + s{\\b +(\w+)}{$1}g; + s{\\a +(\w+)}{$1}g; + s{\\e +(\w+)}{$1}g; + s{\\em +(\w+)}{$1}g; + # Constants s{NULL}{NULL}g; s{TRUE}{TRUE}g; @@ -243,6 +257,8 @@ sub process_formatting { warn "$file_path:$current_line: Old-style monodoc notation '`code`' used\n" if s{\`((?!api:)[:.\w\*]+)\`}{$1}g && $WARNINGS; s{\\c +(\S+(?$1}g; + s{\\code}{

}g;
+    s{\\endcode}{
}g; $$content = $_; } diff --git a/docs/sources/mono-api-profiler.html b/docs/sources/mono-api-profiler.html index fb51ef2e0f..540a831471 100644 --- a/docs/sources/mono-api-profiler.html +++ b/docs/sources/mono-api-profiler.html @@ -1,73 +1,193 @@ -

Profiling Interface

+

Runtime Profiler API

-

Profiler Operation

+

The profiler API can be used by dynamically loaded profiler + modules to monitor different aspects of a running program. The + API is also usable by embedders without having to compile a + profiler module. -

The following methods can be used by dynamic profiler - methods to monitor different aspects of the program. +

Profiler Modules

-

A custom profiler will have one public method defined in - the shared library which is the entry point that Mono calls at - startup, it has the following signature: +

A profiler module is simply a shared library with a single + exported function which is the entry point that Mono calls at + startup. It must have the following signature: -

-	void mono_profiler_startup (const char *desc)
-	
+

+void mono_profiler_startup_example (const char *desc)
+	
-

Where "desc" is the set of arguments that were passed from - the command line. This routine will call - mono_profiler_install to activate the profiler and - will install one or more filters (one of the various - mono_profiler_install_ functions). +

Here, the example portion of the function name is + the name of the profiler module. It must match the shared library + name (i.e. libmono-profiler-example.so). desc + is the set of arguments that were passed from the command line. -

In addition, a profiler developer will typically call - mono_profiler_set_events to register which kinds of - traces should be enabled, these can be an OR-ed combination of - the following: +

For example, a bare bones profiler module might look like this + (example.c): -

-	MONO_PROFILE_NONE
-        MONO_PROFILE_APPDOMAIN_EVENTS
-        MONO_PROFILE_ASSEMBLY_EVENTS
-        MONO_PROFILE_MODULE_EVENTS    
-        MONO_PROFILE_CLASS_EVENTS     
-        MONO_PROFILE_JIT_COMPILATION  
-        MONO_PROFILE_INLINING         
-        MONO_PROFILE_EXCEPTIONS       
-        MONO_PROFILE_ALLOCATIONS      
-        MONO_PROFILE_GC               
-        MONO_PROFILE_THREADS          
-        MONO_PROFILE_REMOTING         
-        MONO_PROFILE_TRANSITIONS      
-        MONO_PROFILE_ENTER_LEAVE      
-        MONO_PROFILE_COVERAGE         
-        MONO_PROFILE_INS_COVERAGE     
-        MONO_PROFILE_STATISTICAL      
-	
+

+#include <mono/metadata/profiler.h>
+#include <stdio.h>
 
-	

Developers can change the set of monitored events at - runtime by calling mono_profiler_set_events. - -

mono_profiler_install

-

mono_profiler_install_allocation

-

mono_profiler_install_appdomain

-

mono_profiler_install_assembly

-

mono_profiler_install_class

-

mono_profiler_install_coverage_filter

-

mono_profiler_install_enter_leave

-

mono_profiler_install_jit_compile

-

mono_profiler_install_module

-

mono_profiler_install_thread

-

mono_profiler_install_transition

-

mono_profiler_install_gc

-

mono_profiler_install_statistical

-

mono_profiler_set_events

-

mono_profiler_get_events

+struct _MonoProfiler { + int dummy; +} -

Coverage

+static MonoProfiler profiler; -

To support profiling modules that need to do code coverage - analysis, the following routines is provided: - -

mono_profiler_coverage_get

+static void +runtime_inited (MonoProfiler *prof) +{ + printf ("Hello World"); +} +void +mono_profiler_init_example (const char *desc) +{ + MonoProfilerHandle handle = mono_profiler_create (&profiler); + mono_profiler_set_runtime_initialized_callback (handle, runtime_inited); +} +
+

To compile this module, a C compiler must be invoked in a + similar fashion to this, on Linux: + +


+gcc -fPIC -shared -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
+	
+ +

Or on OS X: + +


+gcc -undefined suppress -flat_namespace -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
+	
+ +

You can then load the module using: + +


+mono --profile=example hello.exe
+	
+ +

(Note that adjusting LD_LIBRARY_PATH may be + necessary in order for the dynamic linker to find the module.) + +

Profiler Functions

+ +

These are the functions usable for profiling programs. + +

Each function has a note indicating whether they're async + safe. An async safe function can be invoked in a signal handler + or when the world is stopped by the GC. Conversely, a function + that is not async safe must not be invoked in such a context or + undefined behavior can occur (crashes, deadlocks, etc). + +

Some functions may only be invoked from a profiler module's + init function (or prior to running managed code in the case of + embedding). This is noted explicitly only if applicable to a + function. + +

Basic Functions

+ +

These functions are used to load and install profilers. + +

mono_profiler_load

+

mono_profiler_create

+

mono_profiler_set_cleanup_callback

+ +

Code Coverage

+ +

These functions provide access to the JIT compiler's code + coverage support. This functionality can be used to collect + information about how many times certain code paths have been + executed. + +

mono_profiler_enable_coverage

+

mono_profiler_set_coverage_filter_callback

+

mono_profiler_get_coverage_data

+ +

Statistical Sampling

+ +

Statistical sampling can be used to interrupt managed threads + based on a certain mode and frequency for the purpose of + collecting data about their current work. + +

One common use case for this functionality, usually referred + to as call sampling, is to collect a backtrace from every thread + when a sampling hit event arrives. This data can then be compiled + into a report indicating where a program spends most of its time. + +

mono_profiler_enable_sampling

+

mono_profiler_set_sample_mode

+

mono_profiler_get_sample_mode

+ +

A callback must be registered to receive sample hit events. + Please see the Callback Registration section below. + +

GC Allocations

+ +

Profilers can be notified about all GC allocations performed + by a program or the Mono runtime. + +

mono_profiler_enable_allocations

+ +

A callback must be registered to receive allocation events. + Please see the Callback Registration section below. + +

Call Instrumentation

+ +

The JIT compiler supports instrumenting managed method entry + and exit points so that a profiler callback will be invoked. + +

While such callbacks by themselves have traditionally only + been useful for call count profiling and the like, Mono gives + these callbacks access to the arguments, locals, and return + value of instrumented methods (together referred to as the 'call + context'). This enables many profiling scenarios that would + otherwise have required explicit hooks in the base class + libraries. + +

mono_profiler_set_call_instrumentation_filter_callback

+

mono_profiler_enable_call_context_introspection

+

mono_profiler_call_context_get_this

+

mono_profiler_call_context_get_argument

+

mono_profiler_call_context_get_local

+

mono_profiler_call_context_get_result

+

mono_profiler_call_context_free_buffer

+ +

Callbacks must be registered to receive method entry and exit + events. Please see the Callback Registration section + below. + +

Callback Registration

+ +

In addition to the above functions, there's a large set of + functions for installing generic profiler event callbacks. These + are generated from C macros and so are not documented here. + Please refer to the mono/metadata/profiler.h and + mono/metadata/profiler-events.h headers for a full + listing of these. + +

Callback registration functions are all async safe and can be + safely invoked from multiple threads at the same time, with the + caveat that altering a registered callback from one thread will + not immediately affect another thread that is already invoking + the current callback. + +

API Stability

+ +

The profiler API does not have the same API stability + garantees that the rest of the Mono embedding API does. While + a breaking change to the profiler API is extremely rare, it has + happened in the past when changing the API in a backwards + compatible way was deemed to be too much work for too little + gain. + +

Therefore, developers of profiler modules may rarely need to + update their code to work with new versions of the profiler API. + +

Developers who wish to support older versions of the API can + perform a compile time check of the + MONO_PROFILER_API_VERSION macro and maintain code + for both old and new versions. + +

To aid with transitioning to a new version of the profiler + API, the Mono runtime will detect and reject loading profiler + modules which were compiled against older profiler API versions. diff --git a/external/api-snapshot/profiles/Makefile b/external/api-snapshot/profiles/Makefile new file mode 100644 index 0000000000..e1a3c09874 --- /dev/null +++ b/external/api-snapshot/profiles/Makefile @@ -0,0 +1,21 @@ + +CSC=csc -nostdlib -noconfig -unsafe -t:library -nologo -deterministic -publicsign -nowarn:436,618,809,3001 +ECMA_KEY:=ecma.pub +MS_KEY:=msfinal.pub +MOBILE_KEY:=silverlight.pub + +all: build-net_4_x build-mobile-monotouch build-mobile-monodroid + +build-mobile-%: + $(CSC) $*/mscorlib.cs /out:$*/mscorlib.dll -runtimemetadataversion:v4.0.30319 -keyfile:$(MOBILE_KEY) + $(CSC) $*/System.cs /out:$*/System.dll -keyfile:$(MOBILE_KEY) -r:$*/mscorlib.dll /r:System.Xml.dll + $(CSC) $*/System.Core.cs /out:$*/System.Core.dll -keyfile:$(MOBILE_KEY) -r:$*/mscorlib.dll -r:$*/System.dll + $(CSC) $*/System.Net.Http.cs /out:$*/System.Net.Http.dll -keyfile:$(MS_KEY) -r:$*/mscorlib.dll -r:$*/System.Core.dll -r:$*/System.dll + $(CSC) $*/System.Numerics.cs /out:$*/System.Numerics.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll -r:System.dll + +build-%: + $(CSC) $*/mscorlib.cs /out:$*/mscorlib.dll -runtimemetadataversion:v4.0.30319 -keyfile:$(ECMA_KEY) + $(CSC) $*/System.cs /out:$*/System.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll /r:System.Configuration.dll /r:System.Xml.dll + $(CSC) $*/System.Core.cs /out:$*/System.Core.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll -r:System.dll + $(CSC) $*/System.Net.Http.cs /out:$*/System.Net.Http.dll -keyfile:$(MS_KEY) -r:$*/mscorlib.dll -r:$*/System.Core.dll -r:System.dll + $(CSC) $*/System.Numerics.cs /out:$*/System.Numerics.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll -r:System.dll diff --git a/external/api-snapshot/profiles/ecma.pub b/external/api-snapshot/profiles/ecma.pub new file mode 100644 index 0000000000..efafe9240e Binary files /dev/null and b/external/api-snapshot/profiles/ecma.pub differ diff --git a/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Primitives.cs index 57e66dc7e0..57525ece5d 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Win32Exception))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.AccessControl.cs b/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.AccessControl.cs index 23edd84a66..c54e5611ea 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.AccessControl.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.RegistryAccessRule))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.cs b/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.cs index 38ae6c2e58..cc9e5c85dc 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/Microsoft.Win32.Registry.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.Registry))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.AppContext.cs b/external/api-snapshot/profiles/monodroid/Facades/System.AppContext.cs index 5e83192234..aafe2e3cad 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.AppContext.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.AppContext.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AppContext))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Concurrent.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Concurrent.cs index f2e11de407..9fc2c5e906 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Concurrent.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Concurrent.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.BlockingCollection<>))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.NonGeneric.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.NonGeneric.cs index c569299a6c..bdd1a82d4a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.NonGeneric.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.NonGeneric.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ArrayList))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Specialized.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Specialized.cs index 49e39d767b..1075efd4fb 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Specialized.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.Specialized.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.BitVector32))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.cs index d4ec598f9d..26b8d1af9f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Collections.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Collections.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.BitArray))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Annotations.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Annotations.cs index d92a3da980..182203ccaa 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Annotations.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Annotations.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.AssociationAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.EventBasedAsync.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.EventBasedAsync.cs index 055a4e6b4b..f7ab1f6cc3 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.EventBasedAsync.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.EventBasedAsync.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncCompletedEventArgs))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Primitives.cs index 1bae64e863..27d2ab0fe4 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BrowsableAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.TypeConverter.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.TypeConverter.cs index 8c8aee6e81..f3d63cd710 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.TypeConverter.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.TypeConverter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ArrayConverter))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.cs index bae6155793..a9ab112d4f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ComponentModel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CancelEventArgs))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Console.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Console.cs index 40cdbf1a8e..1bed3be297 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Console.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Console.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Console.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Console")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Console))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Data.Common.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Data.Common.cs index 6fc61c46e6..b28d817960 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Data.Common.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Data.Common.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.AcceptRejectRule))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Data.SqlClient.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Data.SqlClient.cs index bad0db170a..338002916f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Data.SqlClient.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Data.SqlClient.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.SqlClient.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.SqlClient.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.SqlClient")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.SqlClient")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.SqlClient.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.SqlClient")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.SqlServer.Server.SqlDataRecord))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Contracts.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Contracts.cs index de148cd82b..39e81e8e35 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Contracts.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Contracts.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.Contract))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Debug.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Debug.cs index 31ce2f9707..79ba237e0d 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Debug.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Debug.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Debug))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.FileVersionInfo.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.FileVersionInfo.cs index 995162b951..daa1901fa6 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.FileVersionInfo.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.FileVersionInfo.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.FileVersionInfo))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Process.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Process.cs index 2b1239eb69..82f3c7f3a3 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Process.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Process.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.StackTrace.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.StackTrace.cs index 065f0c625f..a4e48af644 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.StackTrace.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.StackTrace.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrame))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TextWriterTraceListener.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TextWriterTraceListener.cs index 5087e1d810..b961d7fa15 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TextWriterTraceListener.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TextWriterTraceListener.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DelimitedListTraceListener))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tools.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tools.cs index c6b0137fe1..ba57170f94 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tools.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tools.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceEvent.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceEvent.cs index b730695f18..2b404f6981 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceEvent.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceEvent.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceEvent.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceEvent.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceEvent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceEvent")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceEvent.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceEvent")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SourceLevels))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceSource.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceSource.cs index a239d7fedd..8eb0b77f2e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceSource.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.TraceSource.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.BooleanSwitch))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tracing.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tracing.cs index 6bcecc5343..a040368d5f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tracing.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Diagnostics.Tracing.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventActivityOptions))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Drawing.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Drawing.Primitives.cs index 740fa4a594..e9ce2ee899 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Drawing.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Drawing.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Point))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Dynamic.Runtime.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Dynamic.Runtime.cs index 81695c8abb..9d9b46cd27 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Dynamic.Runtime.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Dynamic.Runtime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BinaryOperationBinder))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Calendars.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Calendars.cs index b387abc26e..838f31c5ed 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Calendars.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Calendars.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.ChineseLunisolarCalendar))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Extensions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Extensions.cs index ae88e75195..a4ee0a672a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Extensions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.IdnMapping))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.cs index 5ed489ab9d..cc9ac2be9b 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Globalization.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.Calendar))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.Compression.ZipFile.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.Compression.ZipFile.cs index 4eca14f74c..ca8b744baf 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.Compression.ZipFile.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.Compression.ZipFile.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipFile))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.AccessControl.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.AccessControl.cs index 2fd37aa4ae..ed828426ec 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.AccessControl.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.DirectoryObjectSecurity))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.DriveInfo.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.DriveInfo.cs index 900bc58b06..8a2fe74703 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.DriveInfo.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.DriveInfo.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DriveInfo))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Primitives.cs index fa8793f662..79d213219f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileAccess))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Watcher.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Watcher.cs index 9db2eb82f7..a22eafac76 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Watcher.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.Watcher.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.ErrorEventArgs))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.cs index 5c528b6ac2..414e6238cf 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.FileSystem.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeFileHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.IsolatedStorage.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.IsolatedStorage.cs index e9364c21dd..a1a357860a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.IsolatedStorage.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.IsolatedStorage.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IsolatedStorage.IsolatedStorageException))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.MemoryMappedFiles.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.MemoryMappedFiles.cs index 0d34c27337..d2bb873531 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.MemoryMappedFiles.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.MemoryMappedFiles.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.Pipes.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.Pipes.cs index 866a8710ad..5b49c5e78a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.Pipes.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.Pipes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafePipeHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.UnmanagedMemoryStream.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.UnmanagedMemoryStream.cs index 0aa9706b57..1e9cfb31c3 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.UnmanagedMemoryStream.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.UnmanagedMemoryStream.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.UnmanagedMemoryAccessor))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.IO.cs b/external/api-snapshot/profiles/monodroid/Facades/System.IO.cs index 1058033576..da7986704f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.IO.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.IO.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BinaryReader))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Expressions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Expressions.cs index 7d993abf00..91fbf9c784 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Expressions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Expressions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BinaryExpression))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Parallel.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Parallel.cs index cf6dedb44b..db6abb97a2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Parallel.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Parallel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.OrderedParallelQuery<>))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Queryable.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Queryable.cs index 32bfcd08c0..3571c44377 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Queryable.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.Queryable.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableExecutor))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.cs index d534a3c0fe..bfb6a25915 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Linq.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Linq.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Enumerable))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.AuthenticationManager.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.AuthenticationManager.cs index 60acf72b1f..3297c78cf8 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.AuthenticationManager.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.AuthenticationManager.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.AuthenticationManager.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.AuthenticationManager.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.AuthenticationManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.AuthenticationManager")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.AuthenticationManager.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.AuthenticationManager")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationManager))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Cache.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Cache.cs index a86b8fa083..a62ef37b2a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Cache.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Cache.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Cache.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Cache.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Cache")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Cache")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Cache.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Cache")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Cache.HttpCacheAgeControl))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.HttpListener.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.HttpListener.cs index f0f6542f5f..7f19812c26 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.HttpListener.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.HttpListener.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.HttpListener.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.HttpListener.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.HttpListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.HttpListener")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.HttpListener.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.HttpListener")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemeSelector))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Mail.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Mail.cs index 28fafeaf6f..afbe75b57d 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Mail.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Mail.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Mail.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Mail.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Mail")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Mail")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Mail.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Mail")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.AlternateView))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.NameResolution.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.NameResolution.cs index 87af7fc209..270ab220f3 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.NameResolution.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.NameResolution.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Dns))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.NetworkInformation.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.NetworkInformation.cs index 4356c18b51..34f7e06d2b 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.NetworkInformation.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.NetworkInformation.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.DuplicateAddressDetectionState))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Ping.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Ping.cs index 4c24c795a7..d5715a9caa 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Ping.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Ping.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Ping.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Ping.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Ping")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Ping")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Ping.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Ping")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Primitives.cs index 679527db92..2b060ca265 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemes))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Requests.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Requests.cs index 2cc888a494..13cad0ab53 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Requests.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Requests.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Security.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Security.cs index 6ad86a9010..c35ca5a8c2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Security.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Security.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.AuthenticatedStream))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.ServicePoint.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.ServicePoint.cs index 91b227012a..d6dfff27b1 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.ServicePoint.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.ServicePoint.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.ServicePoint.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.ServicePoint.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.ServicePoint")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.ServicePoint")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.ServicePoint.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.ServicePoint")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.BindIPEndPoint))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Sockets.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Sockets.cs index e04209744e..cb6ace9997 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Sockets.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Sockets.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IOControlCode))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Utilities.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Utilities.cs index 28ae0164db..f29dc47d49 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.Utilities.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.Utilities.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Utilities.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Utilities.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Utilities")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Utilities")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Utilities.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Utilities")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebHeaderCollection.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebHeaderCollection.cs index 3f149b0750..537bd82d32 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebHeaderCollection.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebHeaderCollection.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.Client.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.Client.cs index d895e426d0..f66f11d05e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.Client.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.Client.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.ClientWebSocket))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.cs index 22a49256f7..34e6572ee5 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Net.WebSockets.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocket))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ObjectModel.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ObjectModel.cs index 7be48809ff..ce411730ca 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ObjectModel.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ObjectModel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.KeyedCollection<,>))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.DispatchProxy.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.DispatchProxy.cs index b4a91f87a2..0e6a6d633a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.DispatchProxy.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.DispatchProxy.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.DispatchProxy.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.DispatchProxy.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.DispatchProxy")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.DispatchProxy")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.DispatchProxy.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.DispatchProxy")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.ILGeneration.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.ILGeneration.cs index 941b32bf16..9687704105 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.ILGeneration.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.ILGeneration.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.CustomAttributeBuilder))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.Lightweight.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.Lightweight.cs index c823ce80f1..43d99bfcb9 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.Lightweight.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.Lightweight.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.DynamicMethod))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.cs index 8cafe71b4c..b4759997c1 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Emit.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.AssemblyBuilder))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Extensions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Extensions.cs index f021c43103..09ec72cfc6 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Extensions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeExtensions))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Primitives.cs index afdc4e5602..73b9e2dd0f 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CallingConventions))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.TypeExtensions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.TypeExtensions.cs index dbb0f6f496..1aea501417 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.TypeExtensions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.TypeExtensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.TypeExtensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.TypeExtensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.TypeExtensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.TypeExtensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.TypeExtensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.TypeExtensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.BindingFlags))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.cs index d69bd3e3d7..1d9b9f26c7 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Reflection.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AmbiguousMatchException))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ReaderWriter.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ReaderWriter.cs index 61f1ede6c5..e26ef94bc9 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ReaderWriter.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ReaderWriter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ReaderWriter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ReaderWriter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ReaderWriter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ResourceManager.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ResourceManager.cs index 2ea00e7ae2..566ad5a4a2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ResourceManager.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.ResourceManager.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.MissingManifestResourceException))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.CompilerServices.VisualC.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.CompilerServices.VisualC.cs index 18fc215291..9c029e22ad 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.CompilerServices.VisualC.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.CompilerServices.VisualC.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvCdecl))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Extensions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Extensions.cs index 24e05f7e54..9e447cba50 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Extensions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.BitConverter))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Handles.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Handles.cs index 4c1fbbc0b9..e44eda932a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Handles.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Handles.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeWaitHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.RuntimeInformation.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.RuntimeInformation.cs index 7931da9dd0..0381e2265a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.RuntimeInformation.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.RuntimeInformation.cs @@ -5,46 +5,16 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.CLSCompliantAttribute(true)] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] -namespace System.Runtime.InteropServices -{ - public enum Architecture - { - Arm = 2, - Arm64 = 3, - X64 = 1, - X86 = 0, - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct OSPlatform : System.IEquatable - { - public static System.Runtime.InteropServices.OSPlatform Linux { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform OSX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform Windows { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Runtime.InteropServices.OSPlatform other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; } - public static bool operator !=(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; } - public override string ToString() { throw null; } - } - public static partial class RuntimeInformation - { - public static string FrameworkDescription { get { throw null; } } - public static System.Runtime.InteropServices.Architecture OSArchitecture { get { throw null; } } - public static string OSDescription { get { throw null; } } - public static System.Runtime.InteropServices.Architecture ProcessArchitecture { get { throw null; } } - public static bool IsOSPlatform(System.Runtime.InteropServices.OSPlatform osPlatform) { throw null; } - } -} +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.Architecture))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.OSPlatform))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.RuntimeInformation))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.WindowsRuntime.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.WindowsRuntime.cs index a6af914340..2394531cf8 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.WindowsRuntime.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.WindowsRuntime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.DefaultInterfaceAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.cs index 29c06c2457..d48ab1bb81 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.InteropServices.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DataMisalignedException))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Loader.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Loader.cs index cadac3f5f1..95669b0def 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Loader.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Loader.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Loader.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Loader.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Loader")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Loader")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Loader.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Loader")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Numerics.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Numerics.cs index 0673cd2fca..06fe12762d 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Numerics.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Numerics.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.BigInteger))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Formatters.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Formatters.cs index d3b55f269a..dd13005228 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Formatters.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Formatters.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Formatters.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NonSerializedAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Json.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Json.cs index 73967f7d6f..95121dd8f7 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Json.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Json.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DateTimeFormat))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Primitives.cs index 908d93f31e..deeae7fd40 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.CollectionDataContractAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Xml.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Xml.cs index 982958ab5c..a67fcf45ac 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Xml.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.Serialization.Xml.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractResolver))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.cs index 837693bdf5..c8fd703379 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Runtime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(bool))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.AccessControl.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.AccessControl.cs index 67ba0eb415..173dd46508 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.AccessControl.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.AccessControlActions))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Claims.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Claims.cs index cb6ffe49eb..05e5159e6b 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Claims.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Claims.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.Claim))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Algorithms.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Algorithms.cs index 9782e615dc..f1efb453c2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Algorithms.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Algorithms.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.3.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Cng.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Cng.cs index f9fa0ae674..d247817d9c 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Cng.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Cng.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Cng.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Cng.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Cng")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Cng")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Cng.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Cng")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeNCryptHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Csp.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Csp.cs index 11368030e9..ad6934aee4 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Csp.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Csp.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Csp.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Csp.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Csp")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Csp.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Csp")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.DeriveBytes.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.DeriveBytes.cs index a50eee4af9..03db410b89 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.DeriveBytes.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.DeriveBytes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.DeriveBytes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.DeriveBytes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.DeriveBytes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.DeriveBytes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.DeriveBytes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.DeriveBytes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DeriveBytes))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encoding.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encoding.cs index c280b1ec5e..d9d173da56 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encoding.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encoding.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedData))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.Aes.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.Aes.cs index 56d9b72335..7d401c2a16 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.Aes.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.Aes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.Aes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.Aes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.Aes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.Aes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.Aes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.Aes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs index f76624054b..44cd48334a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDiffieHellmanPublicKey))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDsa.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDsa.cs index 82b4c3341c..5304ecac60 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDsa.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.ECDsa.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDsa")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDsa")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDsa")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsa))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.cs index 03d5aa8de6..4be22402c2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Encryption.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.Algorithms.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.Algorithms.cs index 1c89fb6804..01afd2ae2e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.Algorithms.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.Algorithms.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.Algorithms")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.Algorithms")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA1))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.cs index 070838d86e..5104dc3d61 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Hashing.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithm))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.OpenSsl.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.OpenSsl.cs index a09c7333f3..0962a0902a 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.OpenSsl.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.OpenSsl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.OpenSsl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.OpenSsl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.OpenSsl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.OpenSsl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.OpenSsl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.OpenSsl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System.Security.Cryptography diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Pkcs.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Pkcs.cs index 0538439922..b125761b01 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Pkcs.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Pkcs.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Pkcs.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Pkcs.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Pkcs")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Pkcs")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Pkcs.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Pkcs")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicAttributeObject))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Primitives.cs index 5008e0b7ad..28dd0a32b6 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.ProtectedData.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.ProtectedData.cs index 4f3351608f..e68b8a7605 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.ProtectedData.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.ProtectedData.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.ProtectedData.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.ProtectedData.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.ProtectedData")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.ProtectedData")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.ProtectedData.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.ProtectedData")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DataProtectionScope))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RSA.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RSA.cs index 0f2028e985..f1ebd7d8ae 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RSA.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RSA.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RSA.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RSA.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RSA")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RSA")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RSA.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RSA")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RandomNumberGenerator.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RandomNumberGenerator.cs index e8a2b2b134..bfba6413dc 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RandomNumberGenerator.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.RandomNumberGenerator.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RandomNumberGenerator")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RandomNumberGenerator")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RandomNumberGenerator")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RandomNumberGenerator))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.X509Certificates.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.X509Certificates.cs index 7e0a96a50c..c9f3c69abc 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.X509Certificates.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Cryptography.X509Certificates.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeX509ChainHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.Windows.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.Windows.cs index 2bdf57cc03..284b065ba7 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.Windows.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.Windows.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.Windows.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.Windows.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.Windows")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.Windows")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.Windows.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.Windows")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeAccessTokenHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.cs index b8462253e8..2f208d0cfc 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.Principal.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IIdentity))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Security.SecureString.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Security.SecureString.cs index c6de3de318..3f4ac56df5 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Security.SecureString.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Security.SecureString.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureString))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Duplex.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Duplex.cs index 3ebd4cfd9b..49010fe306 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Duplex.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Duplex.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CallbackBehaviorAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Http.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Http.cs index 60209b8da8..15a6270622 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Http.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Http.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpBinding))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.NetTcp.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.NetTcp.cs index 12ecd126d9..226828d87e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.NetTcp.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.NetTcp.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ConnectionOrientedTransportBindingElement))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Primitives.cs index b093a218c2..db147baed9 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.KeyedByTypeCollection<>))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Security.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Security.cs index b3d1186a4f..200ecf488d 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Security.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceModel.Security.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.LocalClientSecuritySettings))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceProcess.ServiceController.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceProcess.ServiceController.cs index 4bd54c830c..9b2761728e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ServiceProcess.ServiceController.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ServiceProcess.ServiceController.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.ServiceController.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.ServiceController.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.ServiceController")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.ServiceController")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.ServiceController.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.ServiceController")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.CodePages.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.CodePages.cs index 74e84a9042..f48577b4ba 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.CodePages.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.CodePages.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.CodePages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.CodePages.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.CodePages")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.CodePages")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.CodePages.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.CodePages")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System.Text diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.Extensions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.Extensions.cs index 93522f94b0..df226a3e43 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.Extensions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.ASCIIEncoding))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.cs index 24eba8bb5d..cba6d9433c 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Text.Encoding.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.Decoder))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Text.RegularExpressions.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Text.RegularExpressions.cs index a931bb1180..ae533aff64 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Text.RegularExpressions.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Text.RegularExpressions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Capture))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.AccessControl.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.AccessControl.cs index 37f642d714..6f311e2ba3 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.AccessControl.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.EventWaitHandleAccessRule))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Overlapped.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Overlapped.cs index c9b17005e7..f3361158c4 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Overlapped.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Overlapped.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.IOCompletionCallback))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.Parallel.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.Parallel.cs index 83dcdeb45e..3970af5914 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.Parallel.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.Parallel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Parallel))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.cs index 7fbec78cde..bd0227a667 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Tasks.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AggregateException))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Thread.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Thread.cs index 5cc04fcaa4..cd8e254cf4 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Thread.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Thread.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ParameterizedThreadStart))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.ThreadPool.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.ThreadPool.cs index e85520bd8d..eb4741e432 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.ThreadPool.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.ThreadPool.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.RegisteredWaitHandle))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Timer.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Timer.cs index 867347b605..af508a8714 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Timer.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.Timer.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Timer))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.cs index 83c715ee25..4cfcfac6aa 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Threading.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Threading.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AbandonedMutexException))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.ValueTuple.cs b/external/api-snapshot/profiles/monodroid/Facades/System.ValueTuple.cs index 2d0ed586c2..96662a4c0c 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.ValueTuple.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.ValueTuple.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TupleElementNamesAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.ReaderWriter.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.ReaderWriter.cs index fe94bde1b5..344a9b9b8e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.ReaderWriter.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.ReaderWriter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.ConformanceLevel))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XDocument.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XDocument.cs index d3e2fdbb5c..abbf799919 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XDocument.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.Extensions))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XDocument.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XDocument.cs index 2a487f014a..fb266a0bb2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XDocument.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.Extensions))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XmlDocument.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XmlDocument.cs index 798ec79b3a..d9a743fb9d 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XmlDocument.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.XmlDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XmlDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XmlDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XmlDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XmlDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.cs index 108c8d4628..9559926a7e 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XPath.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeOrder))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlDocument.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlDocument.cs index e0f0f788ed..a5bd5a2da0 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlDocument.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlAttribute))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlSerializer.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlSerializer.cs index bc95c5bb0c..63b2a09d0b 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlSerializer.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.XmlSerializer.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.Xsl.Primitives.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.Xsl.Primitives.cs index 15710617cf..64b09c7140 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Xml.Xsl.Primitives.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Xml.Xsl.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Xsl.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Xsl.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Xsl.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Xsl.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Xsl.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Xsl.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Xsl.IXsltContextFunction))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id index d6242130a6..839a060365 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id @@ -1 +1 @@ -3ea733368d5fe6244377e1926c288cb34a079285 \ No newline at end of file +8ffeb2ce2f964947f799e68f33977d6f1842b8c2 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id index 793d743fad..ad558307a0 100644 --- a/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id @@ -1 +1 @@ -489b8bff3b013a5979063d6a6e887c41a0cc6475 \ No newline at end of file +16c694a0175ec7eb00563855963fdf1d5a0b987c \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/System.Numerics.cs b/external/api-snapshot/profiles/monodroid/System.Numerics.cs index 50fdcbbecf..9a5c30d4fd 100644 --- a/external/api-snapshot/profiles/monodroid/System.Numerics.cs +++ b/external/api-snapshot/profiles/monodroid/System.Numerics.cs @@ -32,6 +32,7 @@ namespace System.Numerics public BigInteger(double value) { throw null;} public BigInteger(int value) { throw null;} public BigInteger(long value) { throw null;} + public BigInteger(System.ReadOnlySpan value) { throw null;} public BigInteger(float value) { throw null;} [System.CLSCompliantAttribute(false)] public BigInteger(uint value) { throw null;} @@ -60,6 +61,7 @@ namespace System.Numerics public override bool Equals(object obj) { throw null; } [System.CLSCompliantAttribute(false)] public bool Equals(ulong other) { throw null; } + public int GetByteCount() { throw null; } public override int GetHashCode() { throw null; } public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static double Log(System.Numerics.BigInteger value) { throw null; } @@ -157,6 +159,7 @@ namespace System.Numerics public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger value) { throw null; } public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Parse(System.ReadOnlySpan value, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { throw null; } public static System.Numerics.BigInteger Parse(string value) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } @@ -169,8 +172,10 @@ namespace System.Numerics public string ToString(System.IFormatProvider provider) { throw null; } public string ToString(string format) { throw null; } public string ToString(string format, System.IFormatProvider provider) { throw null; } + public static bool TryParse(System.ReadOnlySpan value, out System.Numerics.BigInteger result, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { result = default(System.Numerics.BigInteger); throw null; } public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } public static bool TryParse(string value, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public bool TryWriteBytes(System.Span destination, out int bytesWritten) { bytesWritten = default(int); throw null; } } [System.SerializableAttribute] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/external/api-snapshot/profiles/monodroid/System.Runtime.CompilerServices.Unsafe.cs b/external/api-snapshot/profiles/monodroid/System.Runtime.CompilerServices.Unsafe.cs new file mode 100644 index 0000000000..70b70ea055 --- /dev/null +++ b/external/api-snapshot/profiles/monodroid/System.Runtime.CompilerServices.Unsafe.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.4.0")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +namespace System.Runtime.CompilerServices +{ + public static partial class Unsafe + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T AddByteOffset(ref T source, System.IntPtr byteOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* Add(void* source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Add(ref T source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Add(ref T source, System.IntPtr elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool AreSame(ref T left, ref T right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* AsPointer(ref T value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static ref T AsRef(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T AsRef([System.Runtime.CompilerServices.IsReadOnlyAttribute]ref T source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static T As(object o) where T : class { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref TTo As(ref TFrom source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.IntPtr ByteOffset(ref T origin, ref T target) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Copy(void* destination, ref T source) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Copy(ref T destination, void* source) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static T ReadUnaligned(ref byte source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static T ReadUnaligned(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static T Read(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static int SizeOf() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T SubtractByteOffset(ref T source, System.IntPtr byteOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* Subtract(void* source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Subtract(ref T source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Subtract(ref T source, System.IntPtr elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void WriteUnaligned(ref byte destination, T value) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void WriteUnaligned(void* destination, T value) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Write(void* destination, T value) { } + } +} diff --git a/external/api-snapshot/profiles/monodroid/System.Xml.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/System.Xml.cs.REMOVED.git-id index b7606b1876..d5e7ef0704 100644 --- a/external/api-snapshot/profiles/monodroid/System.Xml.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/System.Xml.cs.REMOVED.git-id @@ -1 +1 @@ -c46c6603ef82b51334376e2a073aaf7ba3b4bb3b \ No newline at end of file +18fd42f83e863e9a7bf87ab8602ee718cce6066a \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id index 377ca36c4e..eaa6b5c82d 100644 --- a/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id @@ -1 +1 @@ -88bdb09e4e899136ad403209caac6d6753473c70 \ No newline at end of file +b197c51abc3c082dbda5c8adc28f62bae9c30032 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id index 3dc4146d98..5da68e0840 100644 --- a/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id @@ -1 +1 @@ -fb09b5268a317fd6d027847639be89438c37d0e5 \ No newline at end of file +f3174d13fff775c60031f68c928469a31d188436 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Primitives.cs index 57e66dc7e0..57525ece5d 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Win32Exception))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.AccessControl.cs b/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.AccessControl.cs index 23edd84a66..c54e5611ea 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.AccessControl.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.RegistryAccessRule))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.cs b/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.cs index 38ae6c2e58..cc9e5c85dc 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/Microsoft.Win32.Registry.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.Registry))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.AppContext.cs b/external/api-snapshot/profiles/monotouch/Facades/System.AppContext.cs index 5e83192234..aafe2e3cad 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.AppContext.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.AppContext.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AppContext))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Concurrent.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Concurrent.cs index f2e11de407..9fc2c5e906 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Concurrent.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Concurrent.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.BlockingCollection<>))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.NonGeneric.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.NonGeneric.cs index c569299a6c..bdd1a82d4a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.NonGeneric.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.NonGeneric.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ArrayList))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Specialized.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Specialized.cs index 49e39d767b..1075efd4fb 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Specialized.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.Specialized.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.BitVector32))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.cs index d4ec598f9d..26b8d1af9f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Collections.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Collections.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.BitArray))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Annotations.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Annotations.cs index d92a3da980..182203ccaa 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Annotations.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Annotations.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.AssociationAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.EventBasedAsync.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.EventBasedAsync.cs index 055a4e6b4b..f7ab1f6cc3 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.EventBasedAsync.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.EventBasedAsync.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncCompletedEventArgs))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Primitives.cs index 1bae64e863..27d2ab0fe4 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BrowsableAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.TypeConverter.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.TypeConverter.cs index 8c8aee6e81..f3d63cd710 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.TypeConverter.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.TypeConverter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ArrayConverter))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.cs index bae6155793..a9ab112d4f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ComponentModel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CancelEventArgs))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Console.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Console.cs index 40cdbf1a8e..1bed3be297 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Console.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Console.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Console.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Console")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Console))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Data.Common.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Data.Common.cs index 6fc61c46e6..b28d817960 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Data.Common.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Data.Common.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.AcceptRejectRule))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Data.SqlClient.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Data.SqlClient.cs index bad0db170a..338002916f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Data.SqlClient.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Data.SqlClient.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.SqlClient.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.SqlClient.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.SqlClient")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.SqlClient")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.SqlClient.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.SqlClient")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.SqlServer.Server.SqlDataRecord))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Contracts.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Contracts.cs index de148cd82b..39e81e8e35 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Contracts.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Contracts.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.Contract))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Debug.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Debug.cs index 31ce2f9707..79ba237e0d 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Debug.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Debug.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Debug))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.FileVersionInfo.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.FileVersionInfo.cs index 995162b951..daa1901fa6 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.FileVersionInfo.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.FileVersionInfo.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.FileVersionInfo))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Process.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Process.cs index 2b1239eb69..82f3c7f3a3 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Process.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Process.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.StackTrace.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.StackTrace.cs index 065f0c625f..a4e48af644 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.StackTrace.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.StackTrace.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrame))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TextWriterTraceListener.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TextWriterTraceListener.cs index 5087e1d810..b961d7fa15 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TextWriterTraceListener.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TextWriterTraceListener.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DelimitedListTraceListener))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tools.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tools.cs index c6b0137fe1..ba57170f94 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tools.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tools.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceEvent.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceEvent.cs index b730695f18..2b404f6981 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceEvent.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceEvent.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceEvent.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceEvent.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceEvent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceEvent")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceEvent.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceEvent")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SourceLevels))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceSource.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceSource.cs index a239d7fedd..8eb0b77f2e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceSource.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.TraceSource.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.BooleanSwitch))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tracing.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tracing.cs index 6bcecc5343..a040368d5f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tracing.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Diagnostics.Tracing.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventActivityOptions))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Drawing.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Drawing.Primitives.cs index 740fa4a594..e9ce2ee899 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Drawing.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Drawing.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Point))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Dynamic.Runtime.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Dynamic.Runtime.cs index 81695c8abb..9d9b46cd27 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Dynamic.Runtime.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Dynamic.Runtime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BinaryOperationBinder))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Calendars.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Calendars.cs index b387abc26e..838f31c5ed 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Calendars.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Calendars.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.ChineseLunisolarCalendar))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Extensions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Extensions.cs index ae88e75195..a4ee0a672a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Extensions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.IdnMapping))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.cs index 5ed489ab9d..cc9ac2be9b 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Globalization.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.Calendar))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.Compression.ZipFile.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.Compression.ZipFile.cs index 4eca14f74c..ca8b744baf 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.Compression.ZipFile.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.Compression.ZipFile.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipFile))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.AccessControl.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.AccessControl.cs index 2fd37aa4ae..ed828426ec 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.AccessControl.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.DirectoryObjectSecurity))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.DriveInfo.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.DriveInfo.cs index 900bc58b06..8a2fe74703 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.DriveInfo.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.DriveInfo.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DriveInfo))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Primitives.cs index fa8793f662..79d213219f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileAccess))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Watcher.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Watcher.cs index 9db2eb82f7..a22eafac76 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Watcher.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.Watcher.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.ErrorEventArgs))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.cs index 5c528b6ac2..414e6238cf 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.FileSystem.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeFileHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.IsolatedStorage.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.IsolatedStorage.cs index e9364c21dd..a1a357860a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.IsolatedStorage.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.IsolatedStorage.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IsolatedStorage.IsolatedStorageException))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.MemoryMappedFiles.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.MemoryMappedFiles.cs index 0d34c27337..d2bb873531 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.MemoryMappedFiles.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.MemoryMappedFiles.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.Pipes.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.Pipes.cs index 866a8710ad..5b49c5e78a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.Pipes.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.Pipes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafePipeHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.UnmanagedMemoryStream.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.UnmanagedMemoryStream.cs index 0aa9706b57..1e9cfb31c3 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.UnmanagedMemoryStream.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.UnmanagedMemoryStream.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.UnmanagedMemoryAccessor))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.IO.cs b/external/api-snapshot/profiles/monotouch/Facades/System.IO.cs index 1058033576..da7986704f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.IO.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.IO.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BinaryReader))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Expressions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Expressions.cs index 7d993abf00..91fbf9c784 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Expressions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Expressions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BinaryExpression))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Parallel.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Parallel.cs index cf6dedb44b..db6abb97a2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Parallel.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Parallel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.OrderedParallelQuery<>))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Queryable.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Queryable.cs index 32bfcd08c0..3571c44377 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Queryable.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.Queryable.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableExecutor))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.cs index d534a3c0fe..bfb6a25915 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Linq.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Linq.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Enumerable))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.AuthenticationManager.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.AuthenticationManager.cs index 60acf72b1f..3297c78cf8 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.AuthenticationManager.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.AuthenticationManager.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.AuthenticationManager.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.AuthenticationManager.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.AuthenticationManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.AuthenticationManager")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.AuthenticationManager.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.AuthenticationManager")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationManager))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Cache.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Cache.cs index a86b8fa083..a62ef37b2a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Cache.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Cache.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Cache.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Cache.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Cache")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Cache")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Cache.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Cache")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Cache.HttpCacheAgeControl))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.HttpListener.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.HttpListener.cs index f0f6542f5f..7f19812c26 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.HttpListener.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.HttpListener.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.HttpListener.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.HttpListener.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.HttpListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.HttpListener")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.HttpListener.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.HttpListener")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemeSelector))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Mail.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Mail.cs index 28fafeaf6f..afbe75b57d 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Mail.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Mail.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Mail.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Mail.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Mail")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Mail")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Mail.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Mail")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.AlternateView))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.NameResolution.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.NameResolution.cs index 87af7fc209..270ab220f3 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.NameResolution.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.NameResolution.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Dns))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.NetworkInformation.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.NetworkInformation.cs index 4356c18b51..34f7e06d2b 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.NetworkInformation.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.NetworkInformation.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.DuplicateAddressDetectionState))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Ping.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Ping.cs index 4c24c795a7..d5715a9caa 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Ping.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Ping.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Ping.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Ping.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Ping")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Ping")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Ping.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Ping")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Primitives.cs index 679527db92..2b060ca265 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemes))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Requests.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Requests.cs index 2cc888a494..13cad0ab53 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Requests.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Requests.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Security.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Security.cs index 6ad86a9010..c35ca5a8c2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Security.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Security.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.AuthenticatedStream))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.ServicePoint.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.ServicePoint.cs index 91b227012a..d6dfff27b1 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.ServicePoint.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.ServicePoint.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.ServicePoint.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.ServicePoint.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.ServicePoint")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.ServicePoint")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.ServicePoint.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.ServicePoint")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.BindIPEndPoint))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Sockets.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Sockets.cs index e04209744e..cb6ace9997 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Sockets.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Sockets.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IOControlCode))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Utilities.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Utilities.cs index 28ae0164db..f29dc47d49 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.Utilities.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.Utilities.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Utilities.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Utilities.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Utilities")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Utilities")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Utilities.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Utilities")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebHeaderCollection.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebHeaderCollection.cs index 3f149b0750..537bd82d32 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebHeaderCollection.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebHeaderCollection.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.Client.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.Client.cs index d895e426d0..f66f11d05e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.Client.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.Client.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.ClientWebSocket))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.cs index 22a49256f7..34e6572ee5 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Net.WebSockets.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocket))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ObjectModel.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ObjectModel.cs index 7be48809ff..ce411730ca 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ObjectModel.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ObjectModel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.KeyedCollection<,>))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.DispatchProxy.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.DispatchProxy.cs index b4a91f87a2..0e6a6d633a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.DispatchProxy.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.DispatchProxy.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.DispatchProxy.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.DispatchProxy.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.DispatchProxy")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.DispatchProxy")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.DispatchProxy.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.DispatchProxy")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.ILGeneration.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.ILGeneration.cs index 941b32bf16..9687704105 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.ILGeneration.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.ILGeneration.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.CustomAttributeBuilder))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.Lightweight.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.Lightweight.cs index b970672bef..27cd7b8b33 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.Lightweight.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.Lightweight.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System.Reflection.Emit diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.cs index 8cafe71b4c..b4759997c1 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Emit.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.AssemblyBuilder))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Extensions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Extensions.cs index f021c43103..09ec72cfc6 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Extensions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeExtensions))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Primitives.cs index afdc4e5602..73b9e2dd0f 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CallingConventions))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.TypeExtensions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.TypeExtensions.cs index dbb0f6f496..1aea501417 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.TypeExtensions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.TypeExtensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.TypeExtensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.TypeExtensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.TypeExtensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.TypeExtensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.TypeExtensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.TypeExtensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.BindingFlags))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.cs index d69bd3e3d7..1d9b9f26c7 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Reflection.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AmbiguousMatchException))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ReaderWriter.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ReaderWriter.cs index 61f1ede6c5..e26ef94bc9 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ReaderWriter.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ReaderWriter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ReaderWriter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ReaderWriter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ReaderWriter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ResourceManager.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ResourceManager.cs index 2ea00e7ae2..566ad5a4a2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ResourceManager.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.ResourceManager.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.MissingManifestResourceException))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.CompilerServices.VisualC.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.CompilerServices.VisualC.cs index 18fc215291..9c029e22ad 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.CompilerServices.VisualC.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.CompilerServices.VisualC.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvCdecl))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Extensions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Extensions.cs index 24e05f7e54..9e447cba50 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Extensions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.BitConverter))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Handles.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Handles.cs index 4c1fbbc0b9..e44eda932a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Handles.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Handles.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeWaitHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.RuntimeInformation.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.RuntimeInformation.cs index 7931da9dd0..0381e2265a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.RuntimeInformation.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.RuntimeInformation.cs @@ -5,46 +5,16 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.CLSCompliantAttribute(true)] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] -namespace System.Runtime.InteropServices -{ - public enum Architecture - { - Arm = 2, - Arm64 = 3, - X64 = 1, - X86 = 0, - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct OSPlatform : System.IEquatable - { - public static System.Runtime.InteropServices.OSPlatform Linux { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform OSX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform Windows { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Runtime.InteropServices.OSPlatform other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; } - public static bool operator !=(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; } - public override string ToString() { throw null; } - } - public static partial class RuntimeInformation - { - public static string FrameworkDescription { get { throw null; } } - public static System.Runtime.InteropServices.Architecture OSArchitecture { get { throw null; } } - public static string OSDescription { get { throw null; } } - public static System.Runtime.InteropServices.Architecture ProcessArchitecture { get { throw null; } } - public static bool IsOSPlatform(System.Runtime.InteropServices.OSPlatform osPlatform) { throw null; } - } -} +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.Architecture))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.OSPlatform))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.RuntimeInformation))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.WindowsRuntime.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.WindowsRuntime.cs index a6af914340..2394531cf8 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.WindowsRuntime.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.WindowsRuntime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.DefaultInterfaceAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.cs index 29c06c2457..d48ab1bb81 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.InteropServices.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DataMisalignedException))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Loader.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Loader.cs index cadac3f5f1..95669b0def 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Loader.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Loader.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Loader.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Loader.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Loader")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Loader")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Loader.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Loader")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Numerics.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Numerics.cs index 0673cd2fca..06fe12762d 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Numerics.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Numerics.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.BigInteger))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Formatters.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Formatters.cs index d3b55f269a..dd13005228 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Formatters.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Formatters.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Formatters.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NonSerializedAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Json.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Json.cs index 73967f7d6f..95121dd8f7 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Json.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Json.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DateTimeFormat))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Primitives.cs index 908d93f31e..deeae7fd40 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.CollectionDataContractAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Xml.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Xml.cs index 982958ab5c..a67fcf45ac 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Xml.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.Serialization.Xml.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractResolver))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.cs index 837693bdf5..c8fd703379 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Runtime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(bool))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.AccessControl.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.AccessControl.cs index 67ba0eb415..173dd46508 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.AccessControl.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.AccessControlActions))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Claims.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Claims.cs index cb6ffe49eb..05e5159e6b 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Claims.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Claims.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.Claim))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Algorithms.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Algorithms.cs index 9782e615dc..f1efb453c2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Algorithms.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Algorithms.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.3.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Cng.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Cng.cs index f9fa0ae674..d247817d9c 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Cng.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Cng.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Cng.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Cng.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Cng")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Cng")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Cng.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Cng")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeNCryptHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Csp.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Csp.cs index 11368030e9..ad6934aee4 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Csp.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Csp.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Csp.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Csp.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Csp")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Csp.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Csp")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.DeriveBytes.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.DeriveBytes.cs index a50eee4af9..03db410b89 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.DeriveBytes.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.DeriveBytes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.DeriveBytes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.DeriveBytes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.DeriveBytes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.DeriveBytes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.DeriveBytes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.DeriveBytes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DeriveBytes))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encoding.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encoding.cs index c280b1ec5e..d9d173da56 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encoding.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encoding.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedData))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.Aes.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.Aes.cs index 56d9b72335..7d401c2a16 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.Aes.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.Aes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.Aes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.Aes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.Aes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.Aes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.Aes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.Aes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs index f76624054b..44cd48334a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDiffieHellmanPublicKey))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDsa.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDsa.cs index 82b4c3341c..5304ecac60 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDsa.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.ECDsa.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDsa")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDsa")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDsa")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsa))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.cs index 03d5aa8de6..4be22402c2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Encryption.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.Algorithms.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.Algorithms.cs index 1c89fb6804..01afd2ae2e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.Algorithms.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.Algorithms.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.Algorithms")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.Algorithms")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA1))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.cs index 070838d86e..5104dc3d61 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Hashing.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithm))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.OpenSsl.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.OpenSsl.cs index a09c7333f3..0962a0902a 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.OpenSsl.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.OpenSsl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.OpenSsl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.OpenSsl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.OpenSsl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.OpenSsl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.OpenSsl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.OpenSsl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System.Security.Cryptography diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Pkcs.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Pkcs.cs index 0538439922..b125761b01 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Pkcs.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Pkcs.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Pkcs.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Pkcs.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Pkcs")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Pkcs")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Pkcs.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Pkcs")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicAttributeObject))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Primitives.cs index 5008e0b7ad..28dd0a32b6 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.ProtectedData.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.ProtectedData.cs index 4f3351608f..e68b8a7605 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.ProtectedData.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.ProtectedData.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.ProtectedData.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.ProtectedData.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.ProtectedData")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.ProtectedData")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.ProtectedData.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.ProtectedData")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DataProtectionScope))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RSA.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RSA.cs index 0f2028e985..f1ebd7d8ae 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RSA.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RSA.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RSA.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RSA.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RSA")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RSA")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RSA.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RSA")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RandomNumberGenerator.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RandomNumberGenerator.cs index e8a2b2b134..bfba6413dc 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RandomNumberGenerator.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.RandomNumberGenerator.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RandomNumberGenerator")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RandomNumberGenerator")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RandomNumberGenerator")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RandomNumberGenerator))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.X509Certificates.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.X509Certificates.cs index 7e0a96a50c..c9f3c69abc 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.X509Certificates.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Cryptography.X509Certificates.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeX509ChainHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.Windows.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.Windows.cs index 2bdf57cc03..284b065ba7 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.Windows.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.Windows.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.Windows.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.Windows.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.Windows")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.Windows")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.Windows.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.Windows")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeAccessTokenHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.cs index b8462253e8..2f208d0cfc 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.Principal.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IIdentity))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Security.SecureString.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Security.SecureString.cs index c6de3de318..3f4ac56df5 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Security.SecureString.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Security.SecureString.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureString))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Duplex.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Duplex.cs index 3ebd4cfd9b..49010fe306 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Duplex.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Duplex.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CallbackBehaviorAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Http.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Http.cs index 60209b8da8..15a6270622 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Http.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Http.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpBinding))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.NetTcp.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.NetTcp.cs index 12ecd126d9..226828d87e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.NetTcp.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.NetTcp.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ConnectionOrientedTransportBindingElement))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Primitives.cs index b093a218c2..db147baed9 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.KeyedByTypeCollection<>))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Security.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Security.cs index b3d1186a4f..200ecf488d 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Security.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceModel.Security.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.LocalClientSecuritySettings))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceProcess.ServiceController.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceProcess.ServiceController.cs index 4bd54c830c..9b2761728e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ServiceProcess.ServiceController.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ServiceProcess.ServiceController.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.ServiceController.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.ServiceController.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.ServiceController")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.ServiceController")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.ServiceController.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.ServiceController")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.CodePages.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.CodePages.cs index 74e84a9042..f48577b4ba 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.CodePages.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.CodePages.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.CodePages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.CodePages.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.CodePages")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.CodePages")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.CodePages.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.CodePages")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System.Text diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.Extensions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.Extensions.cs index 93522f94b0..df226a3e43 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.Extensions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.ASCIIEncoding))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.cs index 24eba8bb5d..cba6d9433c 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Text.Encoding.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.Decoder))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Text.RegularExpressions.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Text.RegularExpressions.cs index a931bb1180..ae533aff64 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Text.RegularExpressions.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Text.RegularExpressions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Capture))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.AccessControl.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.AccessControl.cs index 37f642d714..6f311e2ba3 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.AccessControl.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.EventWaitHandleAccessRule))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Overlapped.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Overlapped.cs index c9b17005e7..f3361158c4 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Overlapped.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Overlapped.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.IOCompletionCallback))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.Parallel.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.Parallel.cs index 83dcdeb45e..3970af5914 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.Parallel.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.Parallel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Parallel))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.cs index 7fbec78cde..bd0227a667 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Tasks.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AggregateException))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Thread.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Thread.cs index 5cc04fcaa4..cd8e254cf4 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Thread.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Thread.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ParameterizedThreadStart))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.ThreadPool.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.ThreadPool.cs index e85520bd8d..eb4741e432 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.ThreadPool.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.ThreadPool.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.RegisteredWaitHandle))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Timer.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Timer.cs index 867347b605..af508a8714 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Timer.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.Timer.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Timer))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.cs index 83c715ee25..4cfcfac6aa 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Threading.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Threading.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AbandonedMutexException))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.ValueTuple.cs b/external/api-snapshot/profiles/monotouch/Facades/System.ValueTuple.cs index 2d0ed586c2..96662a4c0c 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.ValueTuple.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.ValueTuple.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TupleElementNamesAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.ReaderWriter.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.ReaderWriter.cs index fe94bde1b5..344a9b9b8e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.ReaderWriter.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.ReaderWriter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.ConformanceLevel))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XDocument.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XDocument.cs index d3e2fdbb5c..abbf799919 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XDocument.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.Extensions))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XDocument.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XDocument.cs index 2a487f014a..fb266a0bb2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XDocument.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.Extensions))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XmlDocument.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XmlDocument.cs index 798ec79b3a..d9a743fb9d 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XmlDocument.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.XmlDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XmlDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XmlDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XmlDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XmlDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.cs index 108c8d4628..9559926a7e 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XPath.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeOrder))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlDocument.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlDocument.cs index e0f0f788ed..a5bd5a2da0 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlDocument.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlAttribute))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlSerializer.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlSerializer.cs index bc95c5bb0c..63b2a09d0b 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlSerializer.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.XmlSerializer.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.Xsl.Primitives.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.Xsl.Primitives.cs index 15710617cf..64b09c7140 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Xml.Xsl.Primitives.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Xml.Xsl.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Xsl.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Xsl.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Xsl.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Xsl.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Xsl.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Xsl.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Xsl.IXsltContextFunction))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/netstandard.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/Facades/netstandard.cs.REMOVED.git-id index d6242130a6..839a060365 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/netstandard.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/Facades/netstandard.cs.REMOVED.git-id @@ -1 +1 @@ -3ea733368d5fe6244377e1926c288cb34a079285 \ No newline at end of file +8ffeb2ce2f964947f799e68f33977d6f1842b8c2 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id index 793d743fad..ad558307a0 100644 --- a/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id @@ -1 +1 @@ -489b8bff3b013a5979063d6a6e887c41a0cc6475 \ No newline at end of file +16c694a0175ec7eb00563855963fdf1d5a0b987c \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/System.Numerics.cs b/external/api-snapshot/profiles/monotouch/System.Numerics.cs index 50fdcbbecf..9a5c30d4fd 100644 --- a/external/api-snapshot/profiles/monotouch/System.Numerics.cs +++ b/external/api-snapshot/profiles/monotouch/System.Numerics.cs @@ -32,6 +32,7 @@ namespace System.Numerics public BigInteger(double value) { throw null;} public BigInteger(int value) { throw null;} public BigInteger(long value) { throw null;} + public BigInteger(System.ReadOnlySpan value) { throw null;} public BigInteger(float value) { throw null;} [System.CLSCompliantAttribute(false)] public BigInteger(uint value) { throw null;} @@ -60,6 +61,7 @@ namespace System.Numerics public override bool Equals(object obj) { throw null; } [System.CLSCompliantAttribute(false)] public bool Equals(ulong other) { throw null; } + public int GetByteCount() { throw null; } public override int GetHashCode() { throw null; } public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static double Log(System.Numerics.BigInteger value) { throw null; } @@ -157,6 +159,7 @@ namespace System.Numerics public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger value) { throw null; } public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Parse(System.ReadOnlySpan value, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { throw null; } public static System.Numerics.BigInteger Parse(string value) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } @@ -169,8 +172,10 @@ namespace System.Numerics public string ToString(System.IFormatProvider provider) { throw null; } public string ToString(string format) { throw null; } public string ToString(string format, System.IFormatProvider provider) { throw null; } + public static bool TryParse(System.ReadOnlySpan value, out System.Numerics.BigInteger result, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { result = default(System.Numerics.BigInteger); throw null; } public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } public static bool TryParse(string value, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public bool TryWriteBytes(System.Span destination, out int bytesWritten) { bytesWritten = default(int); throw null; } } [System.SerializableAttribute] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/external/api-snapshot/profiles/monotouch/System.Runtime.CompilerServices.Unsafe.cs b/external/api-snapshot/profiles/monotouch/System.Runtime.CompilerServices.Unsafe.cs new file mode 100644 index 0000000000..70b70ea055 --- /dev/null +++ b/external/api-snapshot/profiles/monotouch/System.Runtime.CompilerServices.Unsafe.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.4.0")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +namespace System.Runtime.CompilerServices +{ + public static partial class Unsafe + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T AddByteOffset(ref T source, System.IntPtr byteOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* Add(void* source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Add(ref T source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Add(ref T source, System.IntPtr elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool AreSame(ref T left, ref T right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* AsPointer(ref T value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static ref T AsRef(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T AsRef([System.Runtime.CompilerServices.IsReadOnlyAttribute]ref T source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static T As(object o) where T : class { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref TTo As(ref TFrom source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.IntPtr ByteOffset(ref T origin, ref T target) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Copy(void* destination, ref T source) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Copy(ref T destination, void* source) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static T ReadUnaligned(ref byte source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static T ReadUnaligned(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static T Read(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static int SizeOf() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T SubtractByteOffset(ref T source, System.IntPtr byteOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* Subtract(void* source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Subtract(ref T source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Subtract(ref T source, System.IntPtr elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void WriteUnaligned(ref byte destination, T value) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void WriteUnaligned(void* destination, T value) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Write(void* destination, T value) { } + } +} diff --git a/external/api-snapshot/profiles/monotouch/System.Xml.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/System.Xml.cs.REMOVED.git-id index b7606b1876..d5e7ef0704 100644 --- a/external/api-snapshot/profiles/monotouch/System.Xml.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/System.Xml.cs.REMOVED.git-id @@ -1 +1 @@ -c46c6603ef82b51334376e2a073aaf7ba3b4bb3b \ No newline at end of file +18fd42f83e863e9a7bf87ab8602ee718cce6066a \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id index 000151e8b9..e20600a9e5 100644 --- a/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id @@ -1 +1 @@ -a5340a2f4168be8f4f2a4c154f3c896a29cf7f22 \ No newline at end of file +4752cd1a3db92b01de458920358a6c4513933104 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id index f7198bc479..5938d03e1c 100644 --- a/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id @@ -1 +1 @@ -8b587266a06e1313808d7c0ddb1c9b765640afc3 \ No newline at end of file +4106d7c02b3c5d2831e4f06e674c5197fba1d6d4 \ No newline at end of file diff --git a/external/api-snapshot/profiles/msfinal.pub b/external/api-snapshot/profiles/msfinal.pub new file mode 100644 index 0000000000..110b59c7b0 Binary files /dev/null and b/external/api-snapshot/profiles/msfinal.pub differ diff --git a/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Primitives.cs index 57e66dc7e0..57525ece5d 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Win32Exception))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.AccessControl.cs b/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.AccessControl.cs index 23edd84a66..c54e5611ea 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.AccessControl.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.RegistryAccessRule))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.cs b/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.cs index 38ae6c2e58..cc9e5c85dc 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/Microsoft.Win32.Registry.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Registry")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Registry")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Registry")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.Registry))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.AppContext.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.AppContext.cs index 5e83192234..aafe2e3cad 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.AppContext.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.AppContext.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AppContext))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Concurrent.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Concurrent.cs index f2e11de407..9fc2c5e906 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Concurrent.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Concurrent.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.BlockingCollection<>))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.NonGeneric.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.NonGeneric.cs index c569299a6c..bdd1a82d4a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.NonGeneric.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.NonGeneric.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ArrayList))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Specialized.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Specialized.cs index 49e39d767b..1075efd4fb 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Specialized.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.Specialized.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.BitVector32))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.cs index d4ec598f9d..26b8d1af9f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Collections.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.BitArray))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Annotations.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Annotations.cs index d92a3da980..182203ccaa 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Annotations.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Annotations.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.AssociationAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.EventBasedAsync.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.EventBasedAsync.cs index 055a4e6b4b..f7ab1f6cc3 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.EventBasedAsync.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.EventBasedAsync.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncCompletedEventArgs))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Primitives.cs index 1bae64e863..27d2ab0fe4 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BrowsableAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.TypeConverter.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.TypeConverter.cs index 8c8aee6e81..f3d63cd710 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.TypeConverter.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.TypeConverter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ArrayConverter))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.cs index bae6155793..a9ab112d4f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ComponentModel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CancelEventArgs))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Console.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Console.cs index 40cdbf1a8e..1bed3be297 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Console.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Console.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Console.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Console")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Console))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Data.Common.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Data.Common.cs index 6fc61c46e6..b28d817960 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Data.Common.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Data.Common.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.AcceptRejectRule))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Data.SqlClient.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Data.SqlClient.cs index bad0db170a..338002916f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Data.SqlClient.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Data.SqlClient.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.SqlClient.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.SqlClient.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.SqlClient")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.SqlClient")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.SqlClient.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.SqlClient")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.SqlServer.Server.SqlDataRecord))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Contracts.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Contracts.cs index de148cd82b..39e81e8e35 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Contracts.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Contracts.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.Contract))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Debug.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Debug.cs index 31ce2f9707..79ba237e0d 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Debug.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Debug.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Debug))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.FileVersionInfo.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.FileVersionInfo.cs index 995162b951..daa1901fa6 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.FileVersionInfo.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.FileVersionInfo.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.FileVersionInfo))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Process.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Process.cs index 2b1239eb69..82f3c7f3a3 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Process.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Process.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.StackTrace.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.StackTrace.cs index 065f0c625f..a4e48af644 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.StackTrace.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.StackTrace.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrame))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TextWriterTraceListener.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TextWriterTraceListener.cs index 5087e1d810..b961d7fa15 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TextWriterTraceListener.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TextWriterTraceListener.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DelimitedListTraceListener))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tools.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tools.cs index c6b0137fe1..ba57170f94 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tools.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tools.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceEvent.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceEvent.cs index b730695f18..2b404f6981 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceEvent.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceEvent.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceEvent.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceEvent.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceEvent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceEvent")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceEvent.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceEvent")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SourceLevels))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceSource.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceSource.cs index a239d7fedd..8eb0b77f2e 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceSource.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.TraceSource.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.BooleanSwitch))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tracing.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tracing.cs index 6bcecc5343..a040368d5f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tracing.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Diagnostics.Tracing.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventActivityOptions))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Drawing.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Drawing.Primitives.cs index 740fa4a594..e9ce2ee899 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Drawing.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Drawing.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Point))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Dynamic.Runtime.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Dynamic.Runtime.cs index 81695c8abb..9d9b46cd27 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Dynamic.Runtime.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Dynamic.Runtime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BinaryOperationBinder))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Calendars.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Calendars.cs index b387abc26e..838f31c5ed 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Calendars.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Calendars.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.ChineseLunisolarCalendar))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Extensions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Extensions.cs index ae88e75195..a4ee0a672a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Extensions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.IdnMapping))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.cs index 5ed489ab9d..cc9ac2be9b 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Globalization.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.Calendar))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Compression.ZipFile.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Compression.ZipFile.cs index 4eca14f74c..ca8b744baf 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Compression.ZipFile.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Compression.ZipFile.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipFile))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.AccessControl.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.AccessControl.cs index 2fd37aa4ae..ed828426ec 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.AccessControl.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.DirectoryObjectSecurity))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.DriveInfo.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.DriveInfo.cs index 900bc58b06..8a2fe74703 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.DriveInfo.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.DriveInfo.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DriveInfo))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Primitives.cs index fa8793f662..79d213219f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileAccess))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Watcher.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Watcher.cs index 9db2eb82f7..a22eafac76 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Watcher.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.Watcher.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.ErrorEventArgs))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.cs index 5c528b6ac2..414e6238cf 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.FileSystem.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeFileHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.IsolatedStorage.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.IsolatedStorage.cs index e9364c21dd..a1a357860a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.IsolatedStorage.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.IsolatedStorage.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IsolatedStorage.IsolatedStorageException))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.MemoryMappedFiles.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.MemoryMappedFiles.cs index 0d34c27337..d2bb873531 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.MemoryMappedFiles.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.MemoryMappedFiles.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Pipes.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Pipes.cs index 866a8710ad..5b49c5e78a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Pipes.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.Pipes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafePipeHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.UnmanagedMemoryStream.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.UnmanagedMemoryStream.cs index 0aa9706b57..1e9cfb31c3 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.UnmanagedMemoryStream.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.UnmanagedMemoryStream.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.UnmanagedMemoryAccessor))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.cs index 1058033576..da7986704f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.IO.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.IO.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BinaryReader))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Expressions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Expressions.cs index 7d993abf00..91fbf9c784 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Expressions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Expressions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BinaryExpression))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Parallel.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Parallel.cs index cf6dedb44b..db6abb97a2 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Parallel.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Parallel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.OrderedParallelQuery<>))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Queryable.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Queryable.cs index 32bfcd08c0..3571c44377 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Queryable.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.Queryable.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableExecutor))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.cs index d534a3c0fe..bfb6a25915 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Linq.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Enumerable))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.AuthenticationManager.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.AuthenticationManager.cs index 60acf72b1f..3297c78cf8 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.AuthenticationManager.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.AuthenticationManager.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.AuthenticationManager.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.AuthenticationManager.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.AuthenticationManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.AuthenticationManager")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.AuthenticationManager.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.AuthenticationManager")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationManager))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Cache.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Cache.cs index a86b8fa083..a62ef37b2a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Cache.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Cache.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Cache.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Cache.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Cache")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Cache")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Cache.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Cache")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Cache.HttpCacheAgeControl))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.HttpListener.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.HttpListener.cs index f0f6542f5f..7f19812c26 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.HttpListener.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.HttpListener.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.HttpListener.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.HttpListener.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.HttpListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.HttpListener")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.HttpListener.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.HttpListener")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemeSelector))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Mail.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Mail.cs index 28fafeaf6f..afbe75b57d 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Mail.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Mail.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Mail.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Mail.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Mail")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Mail")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Mail.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Mail")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Mail.AlternateView))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NameResolution.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NameResolution.cs index 87af7fc209..270ab220f3 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NameResolution.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NameResolution.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Dns))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NetworkInformation.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NetworkInformation.cs index 4356c18b51..34f7e06d2b 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NetworkInformation.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.NetworkInformation.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.DuplicateAddressDetectionState))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Primitives.cs index 679527db92..2b060ca265 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemes))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Requests.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Requests.cs index 2cc888a494..13cad0ab53 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Requests.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Requests.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Security.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Security.cs index 6ad86a9010..c35ca5a8c2 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Security.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Security.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.AuthenticatedStream))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.ServicePoint.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.ServicePoint.cs index 91b227012a..d6dfff27b1 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.ServicePoint.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.ServicePoint.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.ServicePoint.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.ServicePoint.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.ServicePoint")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.ServicePoint")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.ServicePoint.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.ServicePoint")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.BindIPEndPoint))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Sockets.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Sockets.cs index e04209744e..cb6ace9997 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Sockets.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Sockets.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IOControlCode))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Utilities.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Utilities.cs index 28ae0164db..f29dc47d49 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Utilities.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Utilities.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Utilities.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Utilities.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Utilities")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Utilities")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Utilities.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Utilities")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebHeaderCollection.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebHeaderCollection.cs index 3f149b0750..537bd82d32 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebHeaderCollection.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebHeaderCollection.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.Client.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.Client.cs index d895e426d0..f66f11d05e 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.Client.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.Client.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.ClientWebSocket))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.cs index 22a49256f7..34e6572ee5 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.WebSockets.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocket))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ObjectModel.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ObjectModel.cs index 7be48809ff..ce411730ca 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ObjectModel.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ObjectModel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.KeyedCollection<,>))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.ILGeneration.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.ILGeneration.cs index 941b32bf16..9687704105 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.ILGeneration.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.ILGeneration.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.CustomAttributeBuilder))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.Lightweight.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.Lightweight.cs index c823ce80f1..43d99bfcb9 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.Lightweight.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.Lightweight.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.DynamicMethod))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.cs index 8cafe71b4c..b4759997c1 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Emit.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.AssemblyBuilder))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Extensions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Extensions.cs index f021c43103..09ec72cfc6 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Extensions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeExtensions))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Primitives.cs index afdc4e5602..73b9e2dd0f 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CallingConventions))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.TypeExtensions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.TypeExtensions.cs index dbb0f6f496..1aea501417 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.TypeExtensions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.TypeExtensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.TypeExtensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.TypeExtensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.TypeExtensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.TypeExtensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.TypeExtensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.TypeExtensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.BindingFlags))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.cs index d69bd3e3d7..1d9b9f26c7 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Reflection.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AmbiguousMatchException))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ReaderWriter.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ReaderWriter.cs index 61f1ede6c5..e26ef94bc9 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ReaderWriter.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ReaderWriter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ReaderWriter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ReaderWriter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ReaderWriter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ResourceManager.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ResourceManager.cs index 2ea00e7ae2..566ad5a4a2 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ResourceManager.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.ResourceManager.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.MissingManifestResourceException))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.CompilerServices.VisualC.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.CompilerServices.VisualC.cs index 18fc215291..9c029e22ad 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.CompilerServices.VisualC.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.CompilerServices.VisualC.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvCdecl))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Extensions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Extensions.cs index 24e05f7e54..9e447cba50 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Extensions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.BitConverter))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Handles.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Handles.cs index 4c1fbbc0b9..e44eda932a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Handles.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Handles.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeWaitHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.RuntimeInformation.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.RuntimeInformation.cs index 7931da9dd0..0381e2265a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.RuntimeInformation.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.RuntimeInformation.cs @@ -5,46 +5,16 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.CLSCompliantAttribute(true)] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] -namespace System.Runtime.InteropServices -{ - public enum Architecture - { - Arm = 2, - Arm64 = 3, - X64 = 1, - X86 = 0, - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct OSPlatform : System.IEquatable - { - public static System.Runtime.InteropServices.OSPlatform Linux { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform OSX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform Windows { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Runtime.InteropServices.OSPlatform other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; } - public static bool operator !=(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; } - public override string ToString() { throw null; } - } - public static partial class RuntimeInformation - { - public static string FrameworkDescription { get { throw null; } } - public static System.Runtime.InteropServices.Architecture OSArchitecture { get { throw null; } } - public static string OSDescription { get { throw null; } } - public static System.Runtime.InteropServices.Architecture ProcessArchitecture { get { throw null; } } - public static bool IsOSPlatform(System.Runtime.InteropServices.OSPlatform osPlatform) { throw null; } - } -} +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.Architecture))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.OSPlatform))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.RuntimeInformation))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.WindowsRuntime.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.WindowsRuntime.cs index a6af914340..2394531cf8 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.WindowsRuntime.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.WindowsRuntime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.DefaultInterfaceAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.cs index 29c06c2457..d48ab1bb81 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.InteropServices.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DataMisalignedException))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Numerics.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Numerics.cs index 0673cd2fca..06fe12762d 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Numerics.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Numerics.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.BigInteger))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Json.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Json.cs index 73967f7d6f..95121dd8f7 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Json.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Json.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DateTimeFormat))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Primitives.cs index 908d93f31e..deeae7fd40 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.CollectionDataContractAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Xml.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Xml.cs index 982958ab5c..a67fcf45ac 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Xml.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Xml.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractResolver))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.cs index 837693bdf5..c8fd703379 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(bool))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.AccessControl.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.AccessControl.cs index 67ba0eb415..173dd46508 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.AccessControl.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.AccessControlActions))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Claims.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Claims.cs index cb6ffe49eb..05e5159e6b 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Claims.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Claims.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.Claim))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Algorithms.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Algorithms.cs index 9782e615dc..f1efb453c2 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Algorithms.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Algorithms.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.3.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.DeriveBytes.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.DeriveBytes.cs index a50eee4af9..03db410b89 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.DeriveBytes.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.DeriveBytes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.DeriveBytes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.DeriveBytes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.DeriveBytes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.DeriveBytes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.DeriveBytes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.DeriveBytes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DeriveBytes))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encoding.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encoding.cs index c280b1ec5e..d9d173da56 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encoding.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encoding.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedData))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.Aes.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.Aes.cs index 56d9b72335..7d401c2a16 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.Aes.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.Aes.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.Aes.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.Aes.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.Aes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.Aes")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.Aes.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.Aes")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs index f76624054b..44cd48334a 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDiffieHellman")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDiffieHellmanPublicKey))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDsa.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDsa.cs index 82b4c3341c..5304ecac60 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDsa.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.ECDsa.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.ECDsa")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.ECDsa")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDsa.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.ECDsa")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsa))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.cs index 03d5aa8de6..4be22402c2 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Encryption.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encryption")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encryption")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encryption")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.Algorithms.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.Algorithms.cs index 1c89fb6804..01afd2ae2e 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.Algorithms.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.Algorithms.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.Algorithms")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.Algorithms.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.Algorithms")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA1))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.cs index 070838d86e..5104dc3d61 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Hashing.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Hashing")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Hashing")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Hashing")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithm))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Primitives.cs index 5008e0b7ad..28dd0a32b6 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.ProtectedData.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.ProtectedData.cs index 4f3351608f..e68b8a7605 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.ProtectedData.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.ProtectedData.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.ProtectedData.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.ProtectedData.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.ProtectedData")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.ProtectedData")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.ProtectedData.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.ProtectedData")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DataProtectionScope))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RSA.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RSA.cs index 0f2028e985..f1ebd7d8ae 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RSA.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RSA.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RSA.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RSA.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RSA")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RSA")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RSA.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RSA")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RandomNumberGenerator.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RandomNumberGenerator.cs index e8a2b2b134..bfba6413dc 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RandomNumberGenerator.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.RandomNumberGenerator.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.RandomNumberGenerator")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.RandomNumberGenerator")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RandomNumberGenerator.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.RandomNumberGenerator")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RandomNumberGenerator))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.X509Certificates.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.X509Certificates.cs index 7e0a96a50c..c9f3c69abc 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.X509Certificates.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.X509Certificates.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeX509ChainHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.Windows.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.Windows.cs index 2bdf57cc03..284b065ba7 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.Windows.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.Windows.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.Windows.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.Windows.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.Windows")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.Windows")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.Windows.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.Windows")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeAccessTokenHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.cs index b8462253e8..2f208d0cfc 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Principal.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IIdentity))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.SecureString.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.SecureString.cs index c6de3de318..3f4ac56df5 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.SecureString.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.SecureString.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureString))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Duplex.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Duplex.cs index 3ebd4cfd9b..49010fe306 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Duplex.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Duplex.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CallbackBehaviorAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Http.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Http.cs index 60209b8da8..15a6270622 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Http.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Http.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpBinding))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.NetTcp.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.NetTcp.cs index 12ecd126d9..226828d87e 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.NetTcp.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.NetTcp.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ConnectionOrientedTransportBindingElement))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Primitives.cs index b093a218c2..db147baed9 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.KeyedByTypeCollection<>))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Security.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Security.cs index b3d1186a4f..200ecf488d 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Security.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceModel.Security.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.LocalClientSecuritySettings))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceProcess.ServiceController.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceProcess.ServiceController.cs index 7c4b897f94..03db0a0c4d 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceProcess.ServiceController.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ServiceProcess.ServiceController.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.2.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.ServiceController.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.ServiceController.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.ServiceController")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.ServiceController")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.ServiceController.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.ServiceController")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceProcess.ServiceController))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.CodePages.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.CodePages.cs index 74e84a9042..f48577b4ba 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.CodePages.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.CodePages.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.CodePages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.CodePages.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.CodePages")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.CodePages")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.CodePages.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.CodePages")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace System.Text diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.Extensions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.Extensions.cs index 93522f94b0..df226a3e43 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.Extensions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.Extensions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.ASCIIEncoding))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.cs index 24eba8bb5d..cba6d9433c 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.Encoding.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.Decoder))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.RegularExpressions.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.RegularExpressions.cs index a931bb1180..ae533aff64 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Text.RegularExpressions.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Text.RegularExpressions.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Capture))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.AccessControl.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.AccessControl.cs index 37f642d714..6f311e2ba3 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.AccessControl.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.AccessControl.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.AccessControl.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.AccessControl.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.AccessControl")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.AccessControl")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.AccessControl.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.AccessControl")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AccessControl.EventWaitHandleAccessRule))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Overlapped.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Overlapped.cs index c9b17005e7..f3361158c4 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Overlapped.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Overlapped.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.IOCompletionCallback))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.Parallel.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.Parallel.cs index 83dcdeb45e..3970af5914 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.Parallel.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.Parallel.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Parallel))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.cs index 7fbec78cde..bd0227a667 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Tasks.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AggregateException))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Thread.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Thread.cs index 5cc04fcaa4..cd8e254cf4 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Thread.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Thread.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ParameterizedThreadStart))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.ThreadPool.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.ThreadPool.cs index e85520bd8d..eb4741e432 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.ThreadPool.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.ThreadPool.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.RegisteredWaitHandle))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Timer.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Timer.cs index 867347b605..af508a8714 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Timer.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.Timer.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Timer))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.cs index 83c715ee25..4cfcfac6aa 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Threading.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AbandonedMutexException))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.ValueTuple.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.ValueTuple.cs index 2d0ed586c2..96662a4c0c 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.ValueTuple.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.ValueTuple.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TupleElementNamesAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.ReaderWriter.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.ReaderWriter.cs index fe94bde1b5..344a9b9b8e 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.ReaderWriter.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.ReaderWriter.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.ConformanceLevel))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XDocument.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XDocument.cs index d3e2fdbb5c..abbf799919 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XDocument.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.Extensions))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.XDocument.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.XDocument.cs index 2a487f014a..fb266a0bb2 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.XDocument.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.XDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.Extensions))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.cs index 108c8d4628..9559926a7e 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XPath.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeOrder))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlDocument.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlDocument.cs index e0f0f788ed..a5bd5a2da0 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlDocument.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlDocument.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlSerializer.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlSerializer.cs index bc95c5bb0c..63b2a09d0b 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlSerializer.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.XmlSerializer.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.Xsl.Primitives.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.Xsl.Primitives.cs index 15710617cf..64b09c7140 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.Xsl.Primitives.cs +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Xml.Xsl.Primitives.cs @@ -4,14 +4,14 @@ [assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] [assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Xamarin, Inc.")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Xsl.Primitives.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Xsl.Primitives.dll")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Xsl.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Xsl.Primitives")] [assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] [assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Xsl.Primitives.dll")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Xsl.Primitives")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Xsl.IXsltContextFunction))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/netstandard.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/Facades/netstandard.cs.REMOVED.git-id index 5893a5427e..f52cf6bfdd 100644 --- a/external/api-snapshot/profiles/net_4_x/Facades/netstandard.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/Facades/netstandard.cs.REMOVED.git-id @@ -1 +1 @@ -23a36ae1fc62037a8d821e74cc8dedad9290e46e \ No newline at end of file +24ecdefc0004fa8d23a5cda73a8075eb8cae0520 \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/ICSharpCode.SharpZipLib.cs b/external/api-snapshot/profiles/net_4_x/ICSharpCode.SharpZipLib.cs index afff5e9bc6..c011129772 100644 --- a/external/api-snapshot/profiles/net_4_x/ICSharpCode.SharpZipLib.cs +++ b/external/api-snapshot/profiles/net_4_x/ICSharpCode.SharpZipLib.cs @@ -16,6 +16,7 @@ [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace ICSharpCode.SharpZipLib { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class SharpZipBaseException : System.ApplicationException { public SharpZipBaseException() { } @@ -25,12 +26,14 @@ namespace ICSharpCode.SharpZipLib } namespace ICSharpCode.SharpZipLib.BZip2 { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class BZip2 { public BZip2() { } public static void Compress(System.IO.Stream instream, System.IO.Stream outstream, int blockSize) { } public static void Decompress(System.IO.Stream instream, System.IO.Stream outstream) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class BZip2Constants { internal BZip2Constants() { } @@ -46,11 +49,13 @@ namespace ICSharpCode.SharpZipLib.BZip2 public static readonly int RUNA; public static readonly int RUNB; } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class BZip2Exception : ICSharpCode.SharpZipLib.SharpZipBaseException { public BZip2Exception() { } public BZip2Exception(string message) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class BZip2InputStream : System.IO.Stream { public BZip2InputStream(System.IO.Stream stream) { } @@ -68,6 +73,7 @@ namespace ICSharpCode.SharpZipLib.BZip2 public override void Write(byte[] array, int offset, int count) { } public override void WriteByte(byte val) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class BZip2OutputStream : System.IO.Stream { public BZip2OutputStream(System.IO.Stream stream) { } @@ -90,6 +96,7 @@ namespace ICSharpCode.SharpZipLib.BZip2 } namespace ICSharpCode.SharpZipLib.Checksums { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class Adler32 : ICSharpCode.SharpZipLib.Checksums.IChecksum { public Adler32() { } @@ -99,6 +106,7 @@ namespace ICSharpCode.SharpZipLib.Checksums public void Update(byte[] buf, int off, int len) { } public void Update(int bval) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class Crc32 : ICSharpCode.SharpZipLib.Checksums.IChecksum { public Crc32() { } @@ -108,6 +116,7 @@ namespace ICSharpCode.SharpZipLib.Checksums public void Update(byte[] buf, int off, int len) { } public void Update(int bval) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface IChecksum { long Value { get; } @@ -116,6 +125,7 @@ namespace ICSharpCode.SharpZipLib.Checksums void Update(byte[] buf, int off, int len); void Update(int bval); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class StrangeCRC : ICSharpCode.SharpZipLib.Checksums.IChecksum { public StrangeCRC() { } @@ -128,13 +138,17 @@ namespace ICSharpCode.SharpZipLib.Checksums } namespace ICSharpCode.SharpZipLib.Core { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DirectoryEventArgs : ICSharpCode.SharpZipLib.Core.ScanEventArgs { public DirectoryEventArgs(string name, bool hasMatchingFiles) : base (default(string)) { } public bool HasMatchingFiles { get { throw null; } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void DirectoryFailureDelegate(object sender, ICSharpCode.SharpZipLib.Core.ScanFailureEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void FileFailureDelegate(object sender, ICSharpCode.SharpZipLib.Core.ScanFailureEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class FileSystemScanner { public ICSharpCode.SharpZipLib.Core.DirectoryFailureDelegate DirectoryFailure; @@ -151,15 +165,18 @@ namespace ICSharpCode.SharpZipLib.Core public void OnProcessFile(string file) { } public void Scan(string directory, bool recurse) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface INameTransform { string TransformDirectory(string name); string TransformFile(string name); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface IScanFilter { bool IsMatch(string name); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class NameAndSizeFilter : ICSharpCode.SharpZipLib.Core.PathFilter { public NameAndSizeFilter(string filter, long minSize, long maxSize) : base (default(string)) { } @@ -167,6 +184,7 @@ namespace ICSharpCode.SharpZipLib.Core public long MinSize { get { throw null; } set { } } public override bool IsMatch(string fileName) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class NameFilter { public NameFilter(string filter) { } @@ -177,19 +195,24 @@ namespace ICSharpCode.SharpZipLib.Core public static bool IsValidFilterExpression(string toTest) { throw null; } public override string ToString() { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class PathFilter : ICSharpCode.SharpZipLib.Core.IScanFilter { public PathFilter(string filter) { } public virtual bool IsMatch(string name) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void ProcessDirectoryDelegate(object Sender, ICSharpCode.SharpZipLib.Core.DirectoryEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void ProcessFileDelegate(object sender, ICSharpCode.SharpZipLib.Core.ScanEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ScanEventArgs : System.EventArgs { public ScanEventArgs(string name) { } public bool ContinueRunning { get { throw null; } set { } } public string Name { get { throw null; } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ScanFailureEventArgs { public ScanFailureEventArgs(string name, System.Exception e) { } @@ -200,11 +223,13 @@ namespace ICSharpCode.SharpZipLib.Core } namespace ICSharpCode.SharpZipLib.Encryption { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public abstract partial class PkzipClassic : System.Security.Cryptography.SymmetricAlgorithm { protected PkzipClassic() { } public static byte[] GenerateKeys(byte[] seed) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class PkzipClassicManaged : ICSharpCode.SharpZipLib.Encryption.PkzipClassic { public PkzipClassicManaged() { } @@ -220,6 +245,7 @@ namespace ICSharpCode.SharpZipLib.Encryption } namespace ICSharpCode.SharpZipLib.GZip { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipConstants { internal GZipConstants() { } @@ -230,11 +256,13 @@ namespace ICSharpCode.SharpZipLib.GZip public const int FTEXT = 1; public static readonly int GZIP_MAGIC; } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipException : ICSharpCode.SharpZipLib.SharpZipBaseException { public GZipException() { } public GZipException(string message) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipInputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream { protected ICSharpCode.SharpZipLib.Checksums.Crc32 crc; @@ -243,6 +271,7 @@ namespace ICSharpCode.SharpZipLib.GZip public GZipInputStream(System.IO.Stream baseInputStream, int size) : base (default(System.IO.Stream)) { } public override int Read(byte[] buf, int offset, int len) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipOutputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream { protected ICSharpCode.SharpZipLib.Checksums.Crc32 crc; @@ -257,12 +286,15 @@ namespace ICSharpCode.SharpZipLib.GZip } namespace ICSharpCode.SharpZipLib.Tar { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InvalidHeaderException : ICSharpCode.SharpZipLib.Tar.TarException { public InvalidHeaderException() { } public InvalidHeaderException(string msg) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void ProgressMessageHandler(ICSharpCode.SharpZipLib.Tar.TarArchive archive, ICSharpCode.SharpZipLib.Tar.TarEntry entry, string message); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarArchive { protected TarArchive() { } @@ -288,6 +320,7 @@ namespace ICSharpCode.SharpZipLib.Tar public void SetUserInfo(int userId, string userName, int groupId, string groupName) { } public void WriteEntry(ICSharpCode.SharpZipLib.Tar.TarEntry sourceEntry, bool recurse) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarBuffer { public const int BlockSize = 512; @@ -311,6 +344,7 @@ namespace ICSharpCode.SharpZipLib.Tar public void WriteBlock(byte[] block) { } public void WriteBlock(byte[] buf, int offset) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarEntry : System.ICloneable { public TarEntry(ICSharpCode.SharpZipLib.Tar.TarHeader header) { } @@ -339,11 +373,13 @@ namespace ICSharpCode.SharpZipLib.Tar public void SetNames(string userName, string groupName) { } public void WriteEntryHeader(byte[] outbuf) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarException : ICSharpCode.SharpZipLib.SharpZipBaseException { public TarException() { } public TarException(string message) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarHeader : System.ICloneable { public static readonly int CHKSUMLEN; @@ -418,6 +454,7 @@ namespace ICSharpCode.SharpZipLib.Tar public static void SetValueDefaults(int userId, string userName, int groupId, string groupName) { } public void WriteHeader(byte[] outbuf) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarInputStream : System.IO.Stream { protected ICSharpCode.SharpZipLib.Tar.TarBuffer buffer; @@ -451,6 +488,7 @@ namespace ICSharpCode.SharpZipLib.Tar public void Skip(long numToSkip) { } public override void Write(byte[] array, int offset, int count) { } public override void WriteByte(byte val) { } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class EntryFactoryAdapter : ICSharpCode.SharpZipLib.Tar.TarInputStream.IEntryFactory { public EntryFactoryAdapter() { } @@ -458,6 +496,7 @@ namespace ICSharpCode.SharpZipLib.Tar public ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntry(string name) { throw null; } public ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntryFromFile(string fileName) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface IEntryFactory { ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntry(byte[] headerBuf); @@ -465,6 +504,7 @@ namespace ICSharpCode.SharpZipLib.Tar ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntryFromFile(string fileName); } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarOutputStream : System.IO.Stream { protected byte[] assemBuf; @@ -498,6 +538,7 @@ namespace ICSharpCode.SharpZipLib.Tar } namespace ICSharpCode.SharpZipLib.Zip { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public enum CompressionMethod { BZip2 = 11, @@ -506,6 +547,7 @@ namespace ICSharpCode.SharpZipLib.Zip Stored = 0, WinZipAES = 99, } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class FastZip { public FastZip() { } @@ -524,6 +566,7 @@ namespace ICSharpCode.SharpZipLib.Zip Prompt = 0, } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class FastZipEvents { public ICSharpCode.SharpZipLib.Core.DirectoryFailureDelegate DirectoryFailure; @@ -536,6 +579,7 @@ namespace ICSharpCode.SharpZipLib.Zip public void OnProcessDirectory(string directory, bool hasMatchingFiles) { } public void OnProcessFile(string file) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class KeysRequiredEventArgs : System.EventArgs { public KeysRequiredEventArgs(string name) { } @@ -543,6 +587,7 @@ namespace ICSharpCode.SharpZipLib.Zip public string FileName { get { throw null; } } public byte[] Key { get { throw null; } set { } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class ZipConstants { public const int CENATT = 36; @@ -600,6 +645,7 @@ namespace ICSharpCode.SharpZipLib.Zip public static string ConvertToString(byte[] data) { throw null; } public static string ConvertToString(byte[] data, int length) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipEntry : System.ICloneable { public ZipEntry(ICSharpCode.SharpZipLib.Zip.ZipEntry e) { } @@ -629,11 +675,13 @@ namespace ICSharpCode.SharpZipLib.Zip public object Clone() { throw null; } public override string ToString() { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipException : ICSharpCode.SharpZipLib.SharpZipBaseException { public ZipException() { } public ZipException(string msg) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipFile : System.Collections.IEnumerable { public ICSharpCode.SharpZipLib.Zip.ZipFile.KeysRequiredEventHandler KeysRequired; @@ -655,6 +703,7 @@ namespace ICSharpCode.SharpZipLib.Zip public bool TestArchive(bool testData) { throw null; } public delegate void KeysRequiredEventHandler(object sender, ICSharpCode.SharpZipLib.Zip.KeysRequiredEventArgs e); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipInputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream { public ZipInputStream(System.IO.Stream baseInputStream) : base (default(System.IO.Stream)) { } @@ -668,6 +717,7 @@ namespace ICSharpCode.SharpZipLib.Zip public override int Read(byte[] destination, int index, int count) { throw null; } public override int ReadByte() { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipNameTransform : ICSharpCode.SharpZipLib.Core.INameTransform { public ZipNameTransform() { } @@ -677,6 +727,7 @@ namespace ICSharpCode.SharpZipLib.Zip public string TransformDirectory(string name) { throw null; } public string TransformFile(string name) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipOutputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream { public ZipOutputStream(System.IO.Stream baseOutputStream) : base (default(System.IO.Stream)) { } @@ -692,6 +743,7 @@ namespace ICSharpCode.SharpZipLib.Zip } namespace ICSharpCode.SharpZipLib.Zip.Compression { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class Deflater { public static int BEST_COMPRESSION; @@ -720,6 +772,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SetLevel(int lvl) { } public void SetStrategy(ICSharpCode.SharpZipLib.Zip.Compression.DeflateStrategy strategy) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterConstants { public static int[] COMPR_FUNC; @@ -751,6 +804,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public const int WSIZE = 32768; public DeflaterConstants() { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterEngine : ICSharpCode.SharpZipLib.Zip.Compression.DeflaterConstants { public DeflaterEngine(ICSharpCode.SharpZipLib.Zip.Compression.DeflaterPending pending) { } @@ -766,6 +820,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SetInput(byte[] buf, int off, int len) { } public void SetLevel(int lvl) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterHuffman { public ICSharpCode.SharpZipLib.Zip.Compression.DeflaterPending pending; @@ -779,6 +834,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SendAllTrees(int blTreeCodes) { } public bool TallyDist(int dist, int len) { throw null; } public bool TallyLit(int lit) { throw null; } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class Tree { public short[] freqs; @@ -797,16 +853,19 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void WriteTree(ICSharpCode.SharpZipLib.Zip.Compression.DeflaterHuffman.Tree blTree) { } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterPending : ICSharpCode.SharpZipLib.Zip.Compression.PendingBuffer { public DeflaterPending() { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public enum DeflateStrategy { Default = 0, Filtered = 1, HuffmanOnly = 2, } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class Inflater { public Inflater() { } @@ -826,6 +885,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SetInput(byte[] buf) { } public void SetInput(byte[] buffer, int offset, int length) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InflaterHuffmanTree { public static ICSharpCode.SharpZipLib.Zip.Compression.InflaterHuffmanTree defDistTree; @@ -833,6 +893,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public InflaterHuffmanTree(byte[] codeLengths) { } public int GetSymbol(ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator input) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class PendingBuffer { protected byte[] buf; @@ -854,6 +915,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression } namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterOutputStream : System.IO.Stream { protected System.IO.Stream baseOutputStream; @@ -887,6 +949,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public override void Write(byte[] buf, int off, int len) { } public override void WriteByte(byte bval) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InflaterInputBuffer { public InflaterInputBuffer(System.IO.Stream stream) { } @@ -906,6 +969,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public int ReadRawBuffer(byte[] outBuffer, int offset, int length) { throw null; } public void SetInflaterInput(ICSharpCode.SharpZipLib.Zip.Compression.Inflater inflater) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InflaterInputStream : System.IO.Stream { protected System.IO.Stream baseInputStream; @@ -934,6 +998,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public override void Write(byte[] array, int offset, int count) { } public override void WriteByte(byte val) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class OutputWindow { public OutputWindow() { } @@ -946,6 +1011,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public void Reset() { } public void Write(int abyte) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class StreamManipulator { public StreamManipulator() { } diff --git a/external/api-snapshot/profiles/net_4_x/System.Data.DataSetExtensions.cs b/external/api-snapshot/profiles/net_4_x/System.Data.DataSetExtensions.cs index 1997f4d6db..ca374a4ddf 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Data.DataSetExtensions.cs +++ b/external/api-snapshot/profiles/net_4_x/System.Data.DataSetExtensions.cs @@ -48,8 +48,6 @@ namespace System.Data } public static partial class DataTableExtensions { - public static System.Data.DataView AsDataView(this System.Data.DataTable table) { throw null; } - public static System.Data.DataView AsDataView(this System.Data.EnumerableRowCollection source) where T : System.Data.DataRow { throw null; } public static System.Data.EnumerableRowCollection AsEnumerable(this System.Data.DataTable source) { throw null; } public static System.Data.DataTable CopyToDataTable(this System.Collections.Generic.IEnumerable source) where T : System.Data.DataRow { throw null; } public static void CopyToDataTable(this System.Collections.Generic.IEnumerable source, System.Data.DataTable table, System.Data.LoadOption options) where T : System.Data.DataRow { } diff --git a/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id index 983ccedb57..f9b7f10a80 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id @@ -1 +1 @@ -7c90f1a5285b5ddfde7c83ef500fa2bee5d05366 \ No newline at end of file +c52ad21527ca17216e4412a711bd166d404dc32a \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.Drawing.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.Drawing.cs.REMOVED.git-id index 69b4216107..124e5bb9db 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Drawing.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.Drawing.cs.REMOVED.git-id @@ -1 +1 @@ -9ed1994c0846958c2c74d9156eb45162b8d2e899 \ No newline at end of file +1daaa964a2b17770072422022f356fc5dd99ef2a \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.Numerics.cs b/external/api-snapshot/profiles/net_4_x/System.Numerics.cs index 48df09a909..a6501e37e6 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Numerics.cs +++ b/external/api-snapshot/profiles/net_4_x/System.Numerics.cs @@ -32,6 +32,7 @@ namespace System.Numerics public BigInteger(double value) { throw null;} public BigInteger(int value) { throw null;} public BigInteger(long value) { throw null;} + public BigInteger(System.ReadOnlySpan value) { throw null;} public BigInteger(float value) { throw null;} [System.CLSCompliantAttribute(false)] public BigInteger(uint value) { throw null;} @@ -60,6 +61,7 @@ namespace System.Numerics public override bool Equals(object obj) { throw null; } [System.CLSCompliantAttribute(false)] public bool Equals(ulong other) { throw null; } + public int GetByteCount() { throw null; } public override int GetHashCode() { throw null; } public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static double Log(System.Numerics.BigInteger value) { throw null; } @@ -157,6 +159,7 @@ namespace System.Numerics public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger value) { throw null; } public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Parse(System.ReadOnlySpan value, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { throw null; } public static System.Numerics.BigInteger Parse(string value) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } @@ -169,8 +172,10 @@ namespace System.Numerics public string ToString(System.IFormatProvider provider) { throw null; } public string ToString(string format) { throw null; } public string ToString(string format, System.IFormatProvider provider) { throw null; } + public static bool TryParse(System.ReadOnlySpan value, out System.Numerics.BigInteger result, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { result = default(System.Numerics.BigInteger); throw null; } public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } public static bool TryParse(string value, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public bool TryWriteBytes(System.Span destination, out int bytesWritten) { bytesWritten = default(int); throw null; } } [System.SerializableAttribute] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/external/api-snapshot/profiles/net_4_x/System.Runtime.CompilerServices.Unsafe.cs b/external/api-snapshot/profiles/net_4_x/System.Runtime.CompilerServices.Unsafe.cs new file mode 100644 index 0000000000..70b70ea055 --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/System.Runtime.CompilerServices.Unsafe.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.4.0")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +namespace System.Runtime.CompilerServices +{ + public static partial class Unsafe + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T AddByteOffset(ref T source, System.IntPtr byteOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* Add(void* source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Add(ref T source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Add(ref T source, System.IntPtr elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool AreSame(ref T left, ref T right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* AsPointer(ref T value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static ref T AsRef(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T AsRef([System.Runtime.CompilerServices.IsReadOnlyAttribute]ref T source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static T As(object o) where T : class { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref TTo As(ref TFrom source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.IntPtr ByteOffset(ref T origin, ref T target) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Copy(void* destination, ref T source) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Copy(ref T destination, void* source) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static T ReadUnaligned(ref byte source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static T ReadUnaligned(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static T Read(void* source) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static int SizeOf() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T SubtractByteOffset(ref T source, System.IntPtr byteOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void* Subtract(void* source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Subtract(ref T source, int elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static ref T Subtract(ref T source, System.IntPtr elementOffset) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static void WriteUnaligned(ref byte destination, T value) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void WriteUnaligned(void* destination, T value) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public unsafe static void Write(void* destination, T value) { } + } +} diff --git a/external/api-snapshot/profiles/net_4_x/System.Security.cs b/external/api-snapshot/profiles/net_4_x/System.Security.cs index e29c283eb4..b3844fb730 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Security.cs +++ b/external/api-snapshot/profiles/net_4_x/System.Security.cs @@ -521,14 +521,12 @@ namespace System.Security.Cryptography.Xml protected EncryptedReference() { } protected EncryptedReference(string uri) { } protected EncryptedReference(string uri, System.Security.Cryptography.Xml.TransformChain transformChain) { } - [System.MonoTODOAttribute("Always returns false")] protected internal bool CacheValid { get { throw null; } } protected string ReferenceType { get { throw null; } set { } } public System.Security.Cryptography.Xml.TransformChain TransformChain { get { throw null; } set { } } public string Uri { get { throw null; } set { } } public void AddTransform(System.Security.Cryptography.Xml.Transform transform) { } public virtual System.Xml.XmlElement GetXml() { throw null; } - [System.MonoTODOAttribute("Make compliant.")] public virtual void LoadXml(System.Xml.XmlElement value) { } } public abstract partial class EncryptedType @@ -565,11 +563,8 @@ namespace System.Security.Cryptography.Xml public const string XmlEncSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512"; public const string XmlEncTripleDESKeyWrapUrl = "http://www.w3.org/2001/04/xmlenc#kw-tripledes"; public const string XmlEncTripleDESUrl = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"; - [System.MonoTODOAttribute] public EncryptedXml() { } - [System.MonoTODOAttribute] public EncryptedXml(System.Xml.XmlDocument document) { } - [System.MonoTODOAttribute] public EncryptedXml(System.Xml.XmlDocument document, System.Security.Policy.Evidence evidence) { } public System.Security.Policy.Evidence DocumentEvidence { get { throw null; } set { } } public System.Text.Encoding Encoding { get { throw null; } set { } } @@ -577,20 +572,18 @@ namespace System.Security.Cryptography.Xml public System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } public string Recipient { get { throw null; } set { } } public System.Xml.XmlResolver Resolver { get { throw null; } set { } } + public int XmlDSigSearchDepth { get { throw null; } set { } } public void AddKeyNameMapping(string keyName, object keyObject) { } public void ClearKeyNameMappings() { } public byte[] DecryptData(System.Security.Cryptography.Xml.EncryptedData encryptedData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } public void DecryptDocument() { } public virtual byte[] DecryptEncryptedKey(System.Security.Cryptography.Xml.EncryptedKey encryptedKey) { throw null; } - [System.MonoTODOAttribute("Test this.")] public static byte[] DecryptKey(byte[] keyData, System.Security.Cryptography.RSA rsa, bool useOAEP) { throw null; } public static byte[] DecryptKey(byte[] keyData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } - [System.MonoTODOAttribute] public System.Security.Cryptography.Xml.EncryptedData Encrypt(System.Xml.XmlElement inputElement, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { throw null; } public System.Security.Cryptography.Xml.EncryptedData Encrypt(System.Xml.XmlElement inputElement, string keyName) { throw null; } public byte[] EncryptData(byte[] plaintext, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } public byte[] EncryptData(System.Xml.XmlElement inputElement, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm, bool content) { throw null; } - [System.MonoTODOAttribute("Test this.")] public static byte[] EncryptKey(byte[] keyData, System.Security.Cryptography.RSA rsa, bool useOAEP) { throw null; } public static byte[] EncryptKey(byte[] keyData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } public virtual byte[] GetDecryptionIV(System.Security.Cryptography.Xml.EncryptedData encryptedData, string symmetricAlgorithmUri) { throw null; } @@ -613,7 +606,6 @@ namespace System.Security.Cryptography.Xml public EncryptionProperty() { } public EncryptionProperty(System.Xml.XmlElement elementProperty) { } public string Id { get { throw null; } } - [System.MonoTODOAttribute("Always returns null")] public System.Xml.XmlElement PropertyElement { get { throw null; } set { } } public string Target { get { throw null; } } public System.Xml.XmlElement GetXml() { throw null; } @@ -697,7 +689,6 @@ namespace System.Security.Cryptography.Xml public KeyInfoRetrievalMethod() { } public KeyInfoRetrievalMethod(string strUri) { } public KeyInfoRetrievalMethod(string strUri, string typeName) { } - [System.Runtime.InteropServices.ComVisibleAttribute(false)] public string Type { get { throw null; } set { } } public string Uri { get { throw null; } set { } } public override System.Xml.XmlElement GetXml() { throw null; } diff --git a/external/api-snapshot/profiles/net_4_x/System.Web.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.Web.cs.REMOVED.git-id index 5e148ed26b..1fcc8a58c1 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Web.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.Web.cs.REMOVED.git-id @@ -1 +1 @@ -64e5ab039501727a6636d9256bfd51c1511dc05b \ No newline at end of file +85b4fe7cb23ce5f6389688c19d60bad3e4db8485 \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.Xml.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.Xml.cs.REMOVED.git-id index fe94049777..5130909a95 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Xml.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.Xml.cs.REMOVED.git-id @@ -1 +1 @@ -1ba10406f9bf59e0c33134f17555a8fe1e27cd1f \ No newline at end of file +ad518075aa60a8c202019573eecb8975ea5dbe22 \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id index 7e2460c834..9cd13c854c 100644 --- a/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id @@ -1 +1 @@ -cb4a30213b1a3b0679a6160dd52fcb65893cfc2d \ No newline at end of file +59368e66d91c68d9e8972da9211f67ce3484cfa8 \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id index 203e19907c..58f2b20662 100644 --- a/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id @@ -1 +1 @@ -c91cf068c4ca8bc15cd73317e469c4b769240029 \ No newline at end of file +44f15a763ed2458ee79e0b610407d136b27f1825 \ No newline at end of file diff --git a/external/api-snapshot/profiles/silverlight.pub b/external/api-snapshot/profiles/silverlight.pub new file mode 100644 index 0000000000..60146e8891 Binary files /dev/null and b/external/api-snapshot/profiles/silverlight.pub differ diff --git a/external/binary-reference-assemblies/Makefile b/external/binary-reference-assemblies/Makefile index 5c79efd0fa..e54e8b70ff 100644 --- a/external/binary-reference-assemblies/Makefile +++ b/external/binary-reference-assemblies/Makefile @@ -9,6 +9,7 @@ all: $(MAKE) -C v4.6.1 $(MAKE) -C v4.6.2 $(MAKE) -C v4.7 + $(MAKE) -C v4.7.1 $(MAKE) -C mono clean: @@ -22,6 +23,7 @@ clean: $(MAKE) -C v4.6.1 clean $(MAKE) -C v4.6.2 clean $(MAKE) -C v4.7 clean + $(MAKE) -C v4.7.1 clean $(MAKE) -C mono clean .PHONY: all clean diff --git a/external/binary-reference-assemblies/README.md b/external/binary-reference-assemblies/README.md index 870e30e0a7..395983f00f 100644 --- a/external/binary-reference-assemblies/README.md +++ b/external/binary-reference-assemblies/README.md @@ -1,3 +1,28 @@ -Mono binary reference assemblies repository. +Mono binary reference assemblies +================================ Built using csc 2.1.0. + +Adding a new .NET profile +------------------------- + +Use the following steps (we're using 4.7.1 as example): + +1. Copy existing `v4.7/Makefile` and `src/v4.7/*` to new folders and commit +2. Update `PROFILE` variable in `v4.7.1/Makefile` +3. Wire up new profile in `Makefile` in repo root +4. Run the generation script `./generate-refasm-sources.sh v4.7.1 some/path/to/netfx/referenceassemblies` +5. Revert deletion of `*.extra.cs` +6. Revert changes that remove `#if / #endif` +7. Revert suspicious changes to: + - `Accessibility.cs` (bug in GenApi) + - `Microsoft.VisualBasic.cs` (bug in GenApi and wrong AssemblyCopyright/Product attribute) + - `Microsoft.VisualC.cs` (bug in GenApi) + - `System.Data.Linq.cs` (bug in GenApi) + - `System.Deployment.cs` (we only have stub assemblies) + - `System.Runtime.DurableInstancing.cs` (bug in GenApi) + - `System.Security.cs` (bug in GenApi) + - `System.Web.Mobile.cs` (we only have stub assemblies) + - `System.Workflow.*.cs` (we only have stub assemblies) +8. Add new assemblies/facades to `v4.7.1/Makefile` +9. Run `make -C v4.7.1` and ensure everything compiles diff --git a/external/binary-reference-assemblies/build/monodroid/System.Core.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monodroid/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..c097a5403f --- /dev/null +++ b/external/binary-reference-assemblies/build/monodroid/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +b7d5412e62d6c806925f45ce5333cfc86dd77d86 \ No newline at end of file diff --git a/external/binary-reference-assemblies/build/monodroid/System.Net.Http.dll b/external/binary-reference-assemblies/build/monodroid/System.Net.Http.dll new file mode 100644 index 0000000000..07ea09b0f4 Binary files /dev/null and b/external/binary-reference-assemblies/build/monodroid/System.Net.Http.dll differ diff --git a/external/binary-reference-assemblies/build/monodroid/System.Numerics.dll b/external/binary-reference-assemblies/build/monodroid/System.Numerics.dll new file mode 100644 index 0000000000..b681a5d013 Binary files /dev/null and b/external/binary-reference-assemblies/build/monodroid/System.Numerics.dll differ diff --git a/external/binary-reference-assemblies/build/monodroid/System.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monodroid/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..aa150aa282 --- /dev/null +++ b/external/binary-reference-assemblies/build/monodroid/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +e0ad6056d5db3df5d135a154b1b4008b6e6157b9 \ No newline at end of file diff --git a/external/binary-reference-assemblies/build/monodroid/mscorlib.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monodroid/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..8275521c4d --- /dev/null +++ b/external/binary-reference-assemblies/build/monodroid/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +aee20813f648653163f86ec38e8c8b07ab1e55bb \ No newline at end of file diff --git a/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..fd4353694e --- /dev/null +++ b/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +ccbd12b051399f2f8e07bd15fef473c0e2479e5d \ No newline at end of file diff --git a/external/binary-reference-assemblies/build/monotouch/System.Net.Http.dll b/external/binary-reference-assemblies/build/monotouch/System.Net.Http.dll new file mode 100644 index 0000000000..07ea09b0f4 Binary files /dev/null and b/external/binary-reference-assemblies/build/monotouch/System.Net.Http.dll differ diff --git a/external/binary-reference-assemblies/build/monotouch/System.Numerics.dll b/external/binary-reference-assemblies/build/monotouch/System.Numerics.dll new file mode 100644 index 0000000000..b681a5d013 Binary files /dev/null and b/external/binary-reference-assemblies/build/monotouch/System.Numerics.dll differ diff --git a/external/binary-reference-assemblies/build/monotouch/System.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monotouch/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..13a35bb7d5 --- /dev/null +++ b/external/binary-reference-assemblies/build/monotouch/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +fc992f59d8a96ed747a04e484fe6a08cc23b8f2b \ No newline at end of file diff --git a/external/binary-reference-assemblies/build/monotouch/mscorlib.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monotouch/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..9f6a6f3891 --- /dev/null +++ b/external/binary-reference-assemblies/build/monotouch/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +68b2f6d06b515d8cb9e48c7470402595924d35cf \ No newline at end of file diff --git a/external/binary-reference-assemblies/generate-refasm-sources.sh b/external/binary-reference-assemblies/generate-refasm-sources.sh new file mode 100755 index 0000000000..078389623c --- /dev/null +++ b/external/binary-reference-assemblies/generate-refasm-sources.sh @@ -0,0 +1,33 @@ +#!/bin/bash -e + +REPODIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd ) +NETFXPROFILE=$1 +NETFXSOURCE=$( cd "$2" && pwd ) + +if [ "x$NETFXPROFILE" = "x" ]; then echo "No profile specified."; exit 1; fi +if [ ! -d "$NETFXSOURCE" ]; then echo "Reference assemblies folder doesn't exist."; exit 1; fi + +rm -f "$REPODIR/src/$NETFXPROFILE"/*.cs +rm -f "$REPODIR/src/$NETFXPROFILE/Facades"/*.cs + +cd "$NETFXSOURCE" +for i in *.dll Facades/*.dll; do + if [ "$i" = "System.EnterpriseServices.Thunk.dll" ] || [ "$i" = "System.EnterpriseServices.Wrapper.dll" ]; then continue; fi; + + outpath="$REPODIR/src/$NETFXPROFILE" + if [[ "$i" = "Facades"* ]]; then outpath="$outpath/Facades"; fi + + echo "Processing $i" + mono "$REPODIR/../api-snapshot/tools/genapi/GenAPI.exe" -assembly:"$i" -out:"$outpath" -typeforwardedTo -assemblyVersion -assemblyAttributes -headerFile:"$REPODIR/../api-snapshot/profiles/license-header.txt" -libPath:"$NETFXSOURCE" +done + +cd "$REPODIR/src/$NETFXPROFILE" +for i in *.cs Facades/*.cs; do sed -i "" 's/AssemblyCompanyAttribute("Microsoft Corporation")/AssemblyCompanyAttribute("Mono development team")/g' "$i"; done +for i in *.cs Facades/*.cs; do sed -i "" 's/AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")/AssemblyCopyrightAttribute("(c) Various Mono authors")/g' "$i"; done +for i in *.cs Facades/*.cs; do sed -i "" 's/AssemblyProductAttribute("Microsoft® .NET Framework")/AssemblyProductAttribute("Mono Common Language Infrastructure")/g' "$i"; done +for i in *.cs Facades/*.cs; do sed -i "" '/.*AssemblySignatureKeyAttribute(.*]/d' "$i"; done +for i in *.cs Facades/*.cs; do sed -i "" '/.*InternalsVisibleToAttribute(.*]/d' "$i"; done +for i in *.cs Facades/*.cs; do sed -i "" '/.*DependencyAttribute(.*]/d' "$i"; done + +# remove assembly that we don't have in Mono +rm ISymWrapper.cs Microsoft.Activities.Build.cs Microsoft.Build.Conversion.v4.0.cs Microsoft.JScript.cs Microsoft.VisualBasic.Compatibility.cs Microsoft.VisualBasic.Compatibility.Data.cs Microsoft.VisualC.STLCLR.cs PresentationBuildTasks.cs PresentationCore.cs PresentationFramework.Aero.cs PresentationFramework.Aero2.cs PresentationFramework.AeroLite.cs PresentationFramework.Classic.cs PresentationFramework.cs PresentationFramework.Luna.cs PresentationFramework.Royale.cs ReachFramework.cs sysglobl.cs System.Activities.Core.Presentation.cs System.Activities.cs System.Activities.DurableInstancing.cs System.Activities.Presentation.cs System.AddIn.Contract.cs System.AddIn.cs System.ComponentModel.Composition.Registration.cs System.Data.Entity.Design.cs System.Data.Services.Design.cs System.Data.SqlXml.cs System.Device.cs System.DirectoryServices.AccountManagement.cs System.IdentityModel.Services.cs System.IO.Log.cs System.Management.Instrumentation.cs System.Printing.cs System.ServiceModel.Activities.cs System.ServiceModel.Channels.cs System.Speech.cs System.Web.DataVisualization.cs System.Web.DataVisualization.Design.cs System.Web.DynamicData.Design.cs System.Web.Entity.cs System.Web.Entity.Design.cs System.Windows.Controls.Ribbon.cs System.Windows.Forms.DataVisualization.Design.cs System.Windows.Input.Manipulations.cs System.Windows.Presentation.cs System.WorkflowServices.cs UIAutomationClient.cs UIAutomationClientsideProviders.cs UIAutomationProvider.cs UIAutomationTypes.cs WindowsFormsIntegration.cs XamlBuildTask.cs diff --git a/external/binary-reference-assemblies/mono/ICSharpCode.SharpZipLib.dll b/external/binary-reference-assemblies/mono/ICSharpCode.SharpZipLib.dll index de19452d29..b45d2432ca 100644 Binary files a/external/binary-reference-assemblies/mono/ICSharpCode.SharpZipLib.dll and b/external/binary-reference-assemblies/mono/ICSharpCode.SharpZipLib.dll differ diff --git a/external/binary-reference-assemblies/mono/Makefile b/external/binary-reference-assemblies/mono/Makefile index a50759fad9..2885898e19 100644 --- a/external/binary-reference-assemblies/mono/Makefile +++ b/external/binary-reference-assemblies/mono/Makefile @@ -1,19 +1,25 @@ PROFILE := mono SOURCEDIR := ../src/$(PROFILE)/ -BCL_PROFILE := ../v4.7/ +BCL_PROFILE := ../v4.6/ CSC ?= csc CSC_COMMON_ARGS := -nologo -noconfig -optimize -nostdlib -unsafe -deterministic -publicsign -debug- -target:library -nowarn:612 -nowarn:618 Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) -ASSEMBLIES := Commons.Xml.Relaxng I18N.CJK I18N.MidEast I18N.Other I18N.Rare I18N.West I18N IBM.Data.DB2 ICSharpCode.SharpZipLib \ - Mono.C5 Mono.CSharp Mono.Cairo Mono.CodeContracts Mono.CompilerServices.SymbolWriter Mono.Data.Sqlite \ +ASSEMBLIES := cscompmgd Commons.Xml.Relaxng I18N.CJK I18N.MidEast I18N.Other I18N.Rare I18N.West I18N IBM.Data.DB2 ICSharpCode.SharpZipLib \ + Microsoft.Web.Infrastructure Mono.C5 Mono.CSharp Mono.Cairo Mono.CodeContracts Mono.CompilerServices.SymbolWriter Mono.Data.Sqlite \ Mono.Data.Tds Mono.Debugger.Soft Mono.Http Mono.Management Mono.Messaging.RabbitMQ Mono.Messaging \ Mono.Options Mono.Parallel Mono.Posix Mono.Security.Win32 Mono.Security Mono.Simd Mono.Tasklets Mono.WebBrowser \ - Novell.Directory.Ldap PEAPI RabbitMQ.Client WebMatrix.Data bare/Mono.Cecil + Novell.Directory.Ldap PEAPI RabbitMQ.Client WebMatrix.Data bare/Mono.Cecil \ + SMDiagnostics System.Json.Microsoft System.Json System.Net.Http.Formatting System.Numerics.Vectors \ + System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ + System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ + System.Threading.Tasks.Dataflow System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor \ + System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages # generated with (and then slightly tweaked): # for i in *.dll; do ikdasm --assemblyref $i | grep Name= | sed 's/.*Name=//g' | sed -e $'s/$/\\\n/g' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' -e "s/^/${i%.*}_REFS := /"; done +cscompmgd_REFS := mscorlib System Commons.Xml.Relaxng_REFS := mscorlib System.Xml System I18N.CJK_REFS := mscorlib I18N.MidEast_REFS := mscorlib @@ -23,6 +29,7 @@ I18N.West_REFS := mscorlib I18N_REFS := mscorlib IBM.Data.DB2_REFS := mscorlib System System.Data ICSharpCode.SharpZipLib_REFS := mscorlib System +Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web Mono.C5_REFS := mscorlib Mono.CSharp_REFS := mscorlib System System.Core System.Xml Mono.Cairo_REFS := mscorlib @@ -47,6 +54,31 @@ Novell.Directory.Ldap_REFS := mscorlib System PEAPI_REFS := mscorlib RabbitMQ.Client_REFS := mscorlib System.Xml System WebMatrix.Data_REFS := mscorlib System.Data System.Core System System.Configuration +SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml +System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core +System.Json_REFS := mscorlib System System.Core +System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration +System.Numerics.Vectors_REFS := mscorlib System.Numerics +System.Reactive.Core_REFS := mscorlib System System.Core +System.Reactive.Debugger_REFS := mscorlib +System.Reactive.Experimental_REFS := mscorlib System.Core System +System.Reactive.Interfaces_REFS := mscorlib System.Core +System.Reactive.Linq_REFS := mscorlib System.Core System +System.Reactive.Observable.Aliases_REFS := mscorlib System.Core +System.Reactive.PlatformServices_REFS := mscorlib System System.Core +System.Reactive.Providers_REFS := mscorlib System.Core System +System.Reactive.Runtime.Remoting_REFS := mscorlib System.Core +System.Reactive.Windows.Forms_REFS := mscorlib System.Windows.Forms +System.Reactive.Windows.Threading_REFS := mscorlib System WindowsBase +System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System +System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.IdentityModel System.Runtime.Serialization System.Configuration System.Xml +System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Xml +System.Web.Http_REFS := mscorlib System System.Net.Http System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq +System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Runtime.Caching System.Xml System.Data.Linq +System.Web.Razor_REFS := mscorlib System System.Core +System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core +System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Configuration System.Core +System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.CSharp bare/Mono.Cecil_REFS := mscorlib @@ -57,13 +89,32 @@ I18N.Rare_MONOREFS := I18N I18N.West_MONOREFS := I18N Mono.Debugger.Soft_MONOREFS := bare/Mono.Cecil Mono.Messaging.RabbitMQ_MONOREFS := Mono.Messaging RabbitMQ.Client +System.Reactive.Core_MONOREFS := System.Reactive.Interfaces +System.Reactive.Debugger_MONOREFS := System.Reactive.Linq +System.Reactive.Experimental_MONOREFS := System.Reactive.Linq System.Reactive.Core System.Reactive.Interfaces +System.Reactive.Linq_MONOREFS :=System.Reactive.Interfaces System.Reactive.Core +System.Reactive.Observable.Aliases_MONOREFS := System.Reactive.Interfaces System.Reactive.Providers System.Reactive.Linq +System.Reactive.PlatformServices_MONOREFS := System.Reactive.Core System.Reactive.Interfaces System.Reactive.Linq +System.Reactive.Providers_MONOREFS := System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq +System.Reactive.Runtime.Remoting_MONOREFS := System.Reactive.Interfaces System.Reactive.Core +System.Reactive.Windows.Forms_MONOREFS := System.Reactive.Core System.Reactive.Interfaces +System.Reactive.Windows.Threading_MONOREFS := System.Reactive.Core System.Reactive.Interfaces +System.Web.Http.SelfHost_MONOREFS := System.Web.Http System.Net.Http.Formatting +System.Web.Http.WebHost_MONOREFS := System.Web.Http Microsoft.Web.Infrastructure +System.Web.Http_MONOREFS := System.Net.Http.Formatting +System.Web.Mvc_MONOREFS := System.Web.WebPages.Razor System.Web.WebPages System.Web.Razor Microsoft.Web.Infrastructure +System.Web.WebPages.Deployment_MONOREFS := Microsoft.Web.Infrastructure +System.Web.WebPages.Razor_MONOREFS := System.Web.Razor System.Web.WebPages +System.Web.WebPages_MONOREFS := System.Web.Razor Microsoft.Web.Infrastructure System.Web.WebPages.Deployment MONO_KEY := ../../../mcs/class/mono.pub # Public Key Token: 0738eb9f132ed756 +ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934e089 +WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 +MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a IBM.Data.DB2_KEYFILE := ../../../mcs/class/IBM.Data.DB2/ibm.pub ICSharpCode.SharpZipLib_KEYFILE := ../../../mcs/class/ICSharpCode.SharpZipLib/SharpZipLib.pub Mono.C5_KEYFILE := ../../../mcs/class/Mono.C5/c5.pub -RabbitMQ.Client_KEYFILE := ../../../mcs/class/msfinal.pub MONO_KEY_ASSEMBLIES := Commons.Xml.Relaxng I18N.CJK I18N.MidEast I18N.Other I18N.Rare I18N.West I18N \ Mono.CSharp Mono.Cairo Mono.CodeContracts Mono.CompilerServices.SymbolWriter Mono.Data.Sqlite \ @@ -71,6 +122,17 @@ MONO_KEY_ASSEMBLIES := Commons.Xml.Relaxng I18N.CJK I18N.MidEast I18N.Other I18N Mono.Options Mono.Parallel Mono.Posix Mono.Security.Win32 Mono.Security Mono.Simd Mono.Tasklets Mono.WebBrowser \ Novell.Directory.Ldap PEAPI WebMatrix.Data bare/Mono.Cecil +ECMA_KEY_ASSEMBLIES := SMDiagnostics System.Threading.Tasks.Dataflow + +WINFX_KEY_ASSEMBLIES := Microsoft.Web.Infrastructure System.Json.Microsoft System.Json System.Net.Http.Formatting \ + System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ + System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ + System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ + System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor \ + System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages + +MSFINAL_KEY_ASSEMBLIES := cscompmgd RabbitMQ.Client System.Numerics.Vectors + all: $(addsuffix .dll, $(ASSEMBLIES)) clean: @@ -88,5 +150,8 @@ $(1).dll: $(addprefix $(SOURCEDIR),$(subst bare/,,$(1)).cs) $(wildcard $(SOURCED endef $(foreach asm, $(MONO_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(MONO_KEY)))) +$(foreach asm, $(ECMA_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(ECMA_KEY)))) +$(foreach asm, $(WINFX_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(WINFX_KEY)))) +$(foreach asm, $(MSFINAL_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(MSFINAL_KEY)))) $(foreach asm, $(ASSEMBLIES), $(eval $(call ASSEMBLY_TEMPLATE,$(asm)))) diff --git a/external/binary-reference-assemblies/v4.6.1/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/mono/Microsoft.Web.Infrastructure.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/Microsoft.Web.Infrastructure.dll rename to external/binary-reference-assemblies/mono/Microsoft.Web.Infrastructure.dll diff --git a/external/binary-reference-assemblies/mono/Mono.C5.dll b/external/binary-reference-assemblies/mono/Mono.C5.dll index 2ffc9738cd..36e7f477a2 100644 Binary files a/external/binary-reference-assemblies/mono/Mono.C5.dll and b/external/binary-reference-assemblies/mono/Mono.C5.dll differ diff --git a/external/binary-reference-assemblies/mono/Mono.Options.dll b/external/binary-reference-assemblies/mono/Mono.Options.dll index 8b225cec67..b49ff93da3 100644 Binary files a/external/binary-reference-assemblies/mono/Mono.Options.dll and b/external/binary-reference-assemblies/mono/Mono.Options.dll differ diff --git a/external/binary-reference-assemblies/mono/SMDiagnostics.dll b/external/binary-reference-assemblies/mono/SMDiagnostics.dll new file mode 100644 index 0000000000..ebedd96115 Binary files /dev/null and b/external/binary-reference-assemblies/mono/SMDiagnostics.dll differ diff --git a/external/binary-reference-assemblies/v4.7/System.Json.Microsoft.dll b/external/binary-reference-assemblies/mono/System.Json.Microsoft.dll similarity index 100% rename from external/binary-reference-assemblies/v4.7/System.Json.Microsoft.dll rename to external/binary-reference-assemblies/mono/System.Json.Microsoft.dll diff --git a/external/binary-reference-assemblies/v4.7/System.Json.dll b/external/binary-reference-assemblies/mono/System.Json.dll similarity index 100% rename from external/binary-reference-assemblies/v4.7/System.Json.dll rename to external/binary-reference-assemblies/mono/System.Json.dll diff --git a/external/binary-reference-assemblies/mono/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/mono/System.Net.Http.Formatting.dll new file mode 100644 index 0000000000..6eb847d522 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Net.Http.Formatting.dll differ diff --git a/external/binary-reference-assemblies/v4.7/System.Numerics.Vectors.dll b/external/binary-reference-assemblies/mono/System.Numerics.Vectors.dll similarity index 100% rename from external/binary-reference-assemblies/v4.7/System.Numerics.Vectors.dll rename to external/binary-reference-assemblies/mono/System.Numerics.Vectors.dll diff --git a/external/binary-reference-assemblies/mono/System.Reactive.Core.dll b/external/binary-reference-assemblies/mono/System.Reactive.Core.dll new file mode 100644 index 0000000000..237d5fd1a5 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Reactive.Core.dll differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/mono/System.Reactive.Debugger.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Debugger.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Debugger.dll diff --git a/external/binary-reference-assemblies/mono/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/mono/System.Reactive.Experimental.dll new file mode 100644 index 0000000000..b992c5199b Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Reactive.Experimental.dll differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/mono/System.Reactive.Interfaces.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Interfaces.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Interfaces.dll diff --git a/external/binary-reference-assemblies/mono/System.Reactive.Linq.dll b/external/binary-reference-assemblies/mono/System.Reactive.Linq.dll new file mode 100644 index 0000000000..cad1ecc9f8 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Reactive.Linq.dll differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/mono/System.Reactive.Observable.Aliases.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Observable.Aliases.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Observable.Aliases.dll diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/mono/System.Reactive.PlatformServices.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.PlatformServices.dll rename to external/binary-reference-assemblies/mono/System.Reactive.PlatformServices.dll diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Providers.dll b/external/binary-reference-assemblies/mono/System.Reactive.Providers.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Providers.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Providers.dll diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/mono/System.Reactive.Runtime.Remoting.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Runtime.Remoting.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Runtime.Remoting.dll diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/mono/System.Reactive.Windows.Forms.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Windows.Forms.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Windows.Forms.dll diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/mono/System.Reactive.Windows.Threading.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Reactive.Windows.Threading.dll rename to external/binary-reference-assemblies/mono/System.Reactive.Windows.Threading.dll diff --git a/external/binary-reference-assemblies/v4.7/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/mono/System.Threading.Tasks.Dataflow.dll similarity index 100% rename from external/binary-reference-assemblies/v4.7/System.Threading.Tasks.Dataflow.dll rename to external/binary-reference-assemblies/mono/System.Threading.Tasks.Dataflow.dll diff --git a/external/binary-reference-assemblies/mono/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/mono/System.Web.Http.SelfHost.dll new file mode 100644 index 0000000000..59a0a5b46c Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.Http.SelfHost.dll differ diff --git a/external/binary-reference-assemblies/mono/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/mono/System.Web.Http.WebHost.dll new file mode 100644 index 0000000000..017abb444f Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.Http.WebHost.dll differ diff --git a/external/binary-reference-assemblies/mono/System.Web.Http.dll b/external/binary-reference-assemblies/mono/System.Web.Http.dll new file mode 100644 index 0000000000..543f45ae2b Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.Http.dll differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.Mvc.dll b/external/binary-reference-assemblies/mono/System.Web.Mvc.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/System.Web.Mvc.dll rename to external/binary-reference-assemblies/mono/System.Web.Mvc.dll diff --git a/external/binary-reference-assemblies/mono/System.Web.Razor.dll b/external/binary-reference-assemblies/mono/System.Web.Razor.dll new file mode 100644 index 0000000000..61979163e5 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.Razor.dll differ diff --git a/external/binary-reference-assemblies/mono/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/mono/System.Web.WebPages.Deployment.dll new file mode 100644 index 0000000000..274f39fc70 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.WebPages.Deployment.dll differ diff --git a/external/binary-reference-assemblies/mono/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/mono/System.Web.WebPages.Razor.dll new file mode 100644 index 0000000000..5241a6c4f9 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.WebPages.Razor.dll differ diff --git a/external/binary-reference-assemblies/mono/System.Web.WebPages.dll b/external/binary-reference-assemblies/mono/System.Web.WebPages.dll new file mode 100644 index 0000000000..5445099bc2 Binary files /dev/null and b/external/binary-reference-assemblies/mono/System.Web.WebPages.dll differ diff --git a/external/binary-reference-assemblies/v4.6.1/cscompmgd.dll b/external/binary-reference-assemblies/mono/cscompmgd.dll similarity index 100% rename from external/binary-reference-assemblies/v4.6.1/cscompmgd.dll rename to external/binary-reference-assemblies/mono/cscompmgd.dll diff --git a/external/binary-reference-assemblies/src/mono/ICSharpCode.SharpZipLib.cs b/external/binary-reference-assemblies/src/mono/ICSharpCode.SharpZipLib.cs index 887a092baa..0f338cd2e9 100644 --- a/external/binary-reference-assemblies/src/mono/ICSharpCode.SharpZipLib.cs +++ b/external/binary-reference-assemblies/src/mono/ICSharpCode.SharpZipLib.cs @@ -17,6 +17,7 @@ [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] namespace ICSharpCode.SharpZipLib { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class SharpZipBaseException : System.ApplicationException { public SharpZipBaseException() { } @@ -26,12 +27,14 @@ namespace ICSharpCode.SharpZipLib } namespace ICSharpCode.SharpZipLib.BZip2 { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class BZip2 { public BZip2() { } public static void Compress(System.IO.Stream instream, System.IO.Stream outstream, int blockSize) { } public static void Decompress(System.IO.Stream instream, System.IO.Stream outstream) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class BZip2Constants { internal BZip2Constants() { } @@ -47,11 +50,13 @@ namespace ICSharpCode.SharpZipLib.BZip2 public static readonly int RUNA; public static readonly int RUNB; } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class BZip2Exception : ICSharpCode.SharpZipLib.SharpZipBaseException { public BZip2Exception() { } public BZip2Exception(string message) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class BZip2InputStream : System.IO.Stream { public BZip2InputStream(System.IO.Stream stream) { } @@ -69,6 +74,7 @@ namespace ICSharpCode.SharpZipLib.BZip2 public override void Write(byte[] array, int offset, int count) { } public override void WriteByte(byte val) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class BZip2OutputStream : System.IO.Stream { public BZip2OutputStream(System.IO.Stream stream) { } @@ -91,6 +97,7 @@ namespace ICSharpCode.SharpZipLib.BZip2 } namespace ICSharpCode.SharpZipLib.Checksums { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class Adler32 : ICSharpCode.SharpZipLib.Checksums.IChecksum { public Adler32() { } @@ -100,6 +107,7 @@ namespace ICSharpCode.SharpZipLib.Checksums public void Update(byte[] buf, int off, int len) { } public void Update(int bval) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class Crc32 : ICSharpCode.SharpZipLib.Checksums.IChecksum { public Crc32() { } @@ -109,6 +117,7 @@ namespace ICSharpCode.SharpZipLib.Checksums public void Update(byte[] buf, int off, int len) { } public void Update(int bval) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface IChecksum { long Value { get; } @@ -117,6 +126,7 @@ namespace ICSharpCode.SharpZipLib.Checksums void Update(byte[] buf, int off, int len); void Update(int bval); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class StrangeCRC : ICSharpCode.SharpZipLib.Checksums.IChecksum { public StrangeCRC() { } @@ -129,13 +139,17 @@ namespace ICSharpCode.SharpZipLib.Checksums } namespace ICSharpCode.SharpZipLib.Core { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DirectoryEventArgs : ICSharpCode.SharpZipLib.Core.ScanEventArgs { public DirectoryEventArgs(string name, bool hasMatchingFiles) : base (default(string)) { } public bool HasMatchingFiles { get { throw null; } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void DirectoryFailureDelegate(object sender, ICSharpCode.SharpZipLib.Core.ScanFailureEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void FileFailureDelegate(object sender, ICSharpCode.SharpZipLib.Core.ScanFailureEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class FileSystemScanner { public ICSharpCode.SharpZipLib.Core.DirectoryFailureDelegate DirectoryFailure; @@ -152,15 +166,18 @@ namespace ICSharpCode.SharpZipLib.Core public void OnProcessFile(string file) { } public void Scan(string directory, bool recurse) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface INameTransform { string TransformDirectory(string name); string TransformFile(string name); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface IScanFilter { bool IsMatch(string name); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class NameAndSizeFilter : ICSharpCode.SharpZipLib.Core.PathFilter { public NameAndSizeFilter(string filter, long minSize, long maxSize) : base (default(string)) { } @@ -168,6 +185,7 @@ namespace ICSharpCode.SharpZipLib.Core public long MinSize { get { throw null; } set { } } public override bool IsMatch(string fileName) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class NameFilter { public NameFilter(string filter) { } @@ -178,19 +196,24 @@ namespace ICSharpCode.SharpZipLib.Core public static bool IsValidFilterExpression(string toTest) { throw null; } public override string ToString() { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class PathFilter : ICSharpCode.SharpZipLib.Core.IScanFilter { public PathFilter(string filter) { } public virtual bool IsMatch(string name) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void ProcessDirectoryDelegate(object Sender, ICSharpCode.SharpZipLib.Core.DirectoryEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void ProcessFileDelegate(object sender, ICSharpCode.SharpZipLib.Core.ScanEventArgs e); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ScanEventArgs : System.EventArgs { public ScanEventArgs(string name) { } public bool ContinueRunning { get { throw null; } set { } } public string Name { get { throw null; } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ScanFailureEventArgs { public ScanFailureEventArgs(string name, System.Exception e) { } @@ -201,11 +224,13 @@ namespace ICSharpCode.SharpZipLib.Core } namespace ICSharpCode.SharpZipLib.Encryption { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public abstract partial class PkzipClassic : System.Security.Cryptography.SymmetricAlgorithm { protected PkzipClassic() { } public static byte[] GenerateKeys(byte[] seed) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class PkzipClassicManaged : ICSharpCode.SharpZipLib.Encryption.PkzipClassic { public PkzipClassicManaged() { } @@ -221,6 +246,7 @@ namespace ICSharpCode.SharpZipLib.Encryption } namespace ICSharpCode.SharpZipLib.GZip { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipConstants { internal GZipConstants() { } @@ -231,11 +257,13 @@ namespace ICSharpCode.SharpZipLib.GZip public const int FTEXT = 1; public static readonly int GZIP_MAGIC; } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipException : ICSharpCode.SharpZipLib.SharpZipBaseException { public GZipException() { } public GZipException(string message) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipInputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream { protected ICSharpCode.SharpZipLib.Checksums.Crc32 crc; @@ -244,6 +272,7 @@ namespace ICSharpCode.SharpZipLib.GZip public GZipInputStream(System.IO.Stream baseInputStream, int size) : base (default(System.IO.Stream)) { } public override int Read(byte[] buf, int offset, int len) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class GZipOutputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream { protected ICSharpCode.SharpZipLib.Checksums.Crc32 crc; @@ -258,12 +287,15 @@ namespace ICSharpCode.SharpZipLib.GZip } namespace ICSharpCode.SharpZipLib.Tar { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InvalidHeaderException : ICSharpCode.SharpZipLib.Tar.TarException { public InvalidHeaderException() { } public InvalidHeaderException(string msg) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public delegate void ProgressMessageHandler(ICSharpCode.SharpZipLib.Tar.TarArchive archive, ICSharpCode.SharpZipLib.Tar.TarEntry entry, string message); + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarArchive { protected TarArchive() { } @@ -289,6 +321,7 @@ namespace ICSharpCode.SharpZipLib.Tar public void SetUserInfo(int userId, string userName, int groupId, string groupName) { } public void WriteEntry(ICSharpCode.SharpZipLib.Tar.TarEntry sourceEntry, bool recurse) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarBuffer { public const int BlockSize = 512; @@ -312,6 +345,7 @@ namespace ICSharpCode.SharpZipLib.Tar public void WriteBlock(byte[] block) { } public void WriteBlock(byte[] buf, int offset) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarEntry : System.ICloneable { public TarEntry(ICSharpCode.SharpZipLib.Tar.TarHeader header) { } @@ -340,11 +374,13 @@ namespace ICSharpCode.SharpZipLib.Tar public void SetNames(string userName, string groupName) { } public void WriteEntryHeader(byte[] outbuf) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarException : ICSharpCode.SharpZipLib.SharpZipBaseException { public TarException() { } public TarException(string message) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarHeader : System.ICloneable { public static readonly int CHKSUMLEN; @@ -419,6 +455,7 @@ namespace ICSharpCode.SharpZipLib.Tar public static void SetValueDefaults(int userId, string userName, int groupId, string groupName) { } public void WriteHeader(byte[] outbuf) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarInputStream : System.IO.Stream { protected ICSharpCode.SharpZipLib.Tar.TarBuffer buffer; @@ -452,6 +489,7 @@ namespace ICSharpCode.SharpZipLib.Tar public void Skip(long numToSkip) { } public override void Write(byte[] array, int offset, int count) { } public override void WriteByte(byte val) { } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class EntryFactoryAdapter : ICSharpCode.SharpZipLib.Tar.TarInputStream.IEntryFactory { public EntryFactoryAdapter() { } @@ -459,6 +497,7 @@ namespace ICSharpCode.SharpZipLib.Tar public ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntry(string name) { throw null; } public ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntryFromFile(string fileName) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial interface IEntryFactory { ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntry(byte[] headerBuf); @@ -466,6 +505,7 @@ namespace ICSharpCode.SharpZipLib.Tar ICSharpCode.SharpZipLib.Tar.TarEntry CreateEntryFromFile(string fileName); } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class TarOutputStream : System.IO.Stream { protected byte[] assemBuf; @@ -499,6 +539,7 @@ namespace ICSharpCode.SharpZipLib.Tar } namespace ICSharpCode.SharpZipLib.Zip { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public enum CompressionMethod { BZip2 = 11, @@ -507,6 +548,7 @@ namespace ICSharpCode.SharpZipLib.Zip Stored = 0, WinZipAES = 99, } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class FastZip { public FastZip() { } @@ -525,6 +567,7 @@ namespace ICSharpCode.SharpZipLib.Zip Prompt = 0, } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class FastZipEvents { public ICSharpCode.SharpZipLib.Core.DirectoryFailureDelegate DirectoryFailure; @@ -537,6 +580,7 @@ namespace ICSharpCode.SharpZipLib.Zip public void OnProcessDirectory(string directory, bool hasMatchingFiles) { } public void OnProcessFile(string file) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class KeysRequiredEventArgs : System.EventArgs { public KeysRequiredEventArgs(string name) { } @@ -544,6 +588,7 @@ namespace ICSharpCode.SharpZipLib.Zip public string FileName { get { throw null; } } public byte[] Key { get { throw null; } set { } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public sealed partial class ZipConstants { public const int CENATT = 36; @@ -601,6 +646,7 @@ namespace ICSharpCode.SharpZipLib.Zip public static string ConvertToString(byte[] data) { throw null; } public static string ConvertToString(byte[] data, int length) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipEntry : System.ICloneable { public ZipEntry(ICSharpCode.SharpZipLib.Zip.ZipEntry e) { } @@ -630,11 +676,13 @@ namespace ICSharpCode.SharpZipLib.Zip public object Clone() { throw null; } public override string ToString() { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipException : ICSharpCode.SharpZipLib.SharpZipBaseException { public ZipException() { } public ZipException(string msg) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipFile : System.Collections.IEnumerable { public ICSharpCode.SharpZipLib.Zip.ZipFile.KeysRequiredEventHandler KeysRequired; @@ -656,6 +704,7 @@ namespace ICSharpCode.SharpZipLib.Zip public bool TestArchive(bool testData) { throw null; } public delegate void KeysRequiredEventHandler(object sender, ICSharpCode.SharpZipLib.Zip.KeysRequiredEventArgs e); } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipInputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream { public ZipInputStream(System.IO.Stream baseInputStream) : base (default(System.IO.Stream)) { } @@ -669,6 +718,7 @@ namespace ICSharpCode.SharpZipLib.Zip public override int Read(byte[] destination, int index, int count) { throw null; } public override int ReadByte() { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipNameTransform : ICSharpCode.SharpZipLib.Core.INameTransform { public ZipNameTransform() { } @@ -678,6 +728,7 @@ namespace ICSharpCode.SharpZipLib.Zip public string TransformDirectory(string name) { throw null; } public string TransformFile(string name) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class ZipOutputStream : ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream { public ZipOutputStream(System.IO.Stream baseOutputStream) : base (default(System.IO.Stream)) { } @@ -693,6 +744,7 @@ namespace ICSharpCode.SharpZipLib.Zip } namespace ICSharpCode.SharpZipLib.Zip.Compression { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class Deflater { public static int BEST_COMPRESSION; @@ -721,6 +773,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SetLevel(int lvl) { } public void SetStrategy(ICSharpCode.SharpZipLib.Zip.Compression.DeflateStrategy strategy) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterConstants { public static int[] COMPR_FUNC; @@ -752,6 +805,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public const int WSIZE = 32768; public DeflaterConstants() { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterEngine : ICSharpCode.SharpZipLib.Zip.Compression.DeflaterConstants { public DeflaterEngine(ICSharpCode.SharpZipLib.Zip.Compression.DeflaterPending pending) { } @@ -767,6 +821,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SetInput(byte[] buf, int off, int len) { } public void SetLevel(int lvl) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterHuffman { public ICSharpCode.SharpZipLib.Zip.Compression.DeflaterPending pending; @@ -780,6 +835,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SendAllTrees(int blTreeCodes) { } public bool TallyDist(int dist, int len) { throw null; } public bool TallyLit(int lit) { throw null; } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class Tree { public short[] freqs; @@ -798,16 +854,19 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void WriteTree(ICSharpCode.SharpZipLib.Zip.Compression.DeflaterHuffman.Tree blTree) { } } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterPending : ICSharpCode.SharpZipLib.Zip.Compression.PendingBuffer { public DeflaterPending() { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public enum DeflateStrategy { Default = 0, Filtered = 1, HuffmanOnly = 2, } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class Inflater { public Inflater() { } @@ -827,6 +886,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public void SetInput(byte[] buf) { } public void SetInput(byte[] buffer, int offset, int length) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InflaterHuffmanTree { public static ICSharpCode.SharpZipLib.Zip.Compression.InflaterHuffmanTree defDistTree; @@ -834,6 +894,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression public InflaterHuffmanTree(byte[] codeLengths) { } public int GetSymbol(ICSharpCode.SharpZipLib.Zip.Compression.Streams.StreamManipulator input) { throw null; } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class PendingBuffer { protected byte[] buf; @@ -855,6 +916,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression } namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams { + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class DeflaterOutputStream : System.IO.Stream { protected System.IO.Stream baseOutputStream; @@ -888,6 +950,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public override void Write(byte[] buf, int off, int len) { } public override void WriteByte(byte bval) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InflaterInputBuffer { public InflaterInputBuffer(System.IO.Stream stream) { } @@ -907,6 +970,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public int ReadRawBuffer(byte[] outBuffer, int offset, int length) { throw null; } public void SetInflaterInput(ICSharpCode.SharpZipLib.Zip.Compression.Inflater inflater) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class InflaterInputStream : System.IO.Stream { protected System.IO.Stream baseInputStream; @@ -935,6 +999,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public override void Write(byte[] array, int offset, int count) { } public override void WriteByte(byte val) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class OutputWindow { public OutputWindow() { } @@ -947,6 +1012,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression.Streams public void Reset() { } public void Write(int abyte) { } } + [System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")] public partial class StreamManipulator { public StreamManipulator() { } diff --git a/external/binary-reference-assemblies/src/v4.6.1/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/mono/Microsoft.Web.Infrastructure.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/Microsoft.Web.Infrastructure.cs rename to external/binary-reference-assemblies/src/mono/Microsoft.Web.Infrastructure.cs diff --git a/external/binary-reference-assemblies/src/mono/Mono.C5.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/Mono.C5.cs.REMOVED.git-id index e16862c07c..4dda55ceae 100644 --- a/external/binary-reference-assemblies/src/mono/Mono.C5.cs.REMOVED.git-id +++ b/external/binary-reference-assemblies/src/mono/Mono.C5.cs.REMOVED.git-id @@ -1 +1 @@ -b06a0a4020c92b5bd5ebd5bb862d245b67ec5ba3 \ No newline at end of file +3ba3519beb12c6f8f84db698f983cc19b35b9319 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/mono/Mono.Options.cs b/external/binary-reference-assemblies/src/mono/Mono.Options.cs index fd85635dc1..bc86c96640 100644 --- a/external/binary-reference-assemblies/src/mono/Mono.Options.cs +++ b/external/binary-reference-assemblies/src/mono/Mono.Options.cs @@ -8,6 +8,7 @@ [assembly:System.Reflection.AssemblyDescriptionAttribute("Command Line Parsing Utilities")] [assembly:System.Reflection.AssemblyTitleAttribute("Mono.Options.dll")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] namespace Mono.Options diff --git a/external/binary-reference-assemblies/src/mono/SMDiagnostics.cs b/external/binary-reference-assemblies/src/mono/SMDiagnostics.cs new file mode 100644 index 0000000000..02a286d5f5 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/SMDiagnostics.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2046.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] +[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] diff --git a/external/binary-reference-assemblies/src/v4.7/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/mono/System.Json.Microsoft.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.7/System.Json.Microsoft.cs rename to external/binary-reference-assemblies/src/mono/System.Json.Microsoft.cs diff --git a/external/binary-reference-assemblies/src/v4.7/System.Json.cs b/external/binary-reference-assemblies/src/mono/System.Json.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.7/System.Json.cs rename to external/binary-reference-assemblies/src/mono/System.Json.cs diff --git a/external/binary-reference-assemblies/src/mono/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/System.Net.Http.Formatting.cs.REMOVED.git-id new file mode 100644 index 0000000000..5938b25ab4 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Net.Http.Formatting.cs.REMOVED.git-id @@ -0,0 +1 @@ +d3866494fd815e8c32a5b02a4ade6c57c2607d8c \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Numerics.Vectors.cs b/external/binary-reference-assemblies/src/mono/System.Numerics.Vectors.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.7/System.Numerics.Vectors.cs rename to external/binary-reference-assemblies/src/mono/System.Numerics.Vectors.cs diff --git a/external/binary-reference-assemblies/src/mono/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Core.cs new file mode 100644 index 0000000000..5d5cdb40fe --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Reactive.Core.cs @@ -0,0 +1,473 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +namespace System +{ + public static partial class ObservableExtensions + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } + public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } + public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } + public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } + public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } + public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } + public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } + public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } + public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } + public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } + public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } + public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } + } +} +namespace System.Reactive +{ + public sealed partial class AnonymousObservable : System.Reactive.ObservableBase + { + public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } + protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } + } + public sealed partial class AnonymousObserver : System.Reactive.ObserverBase + { + public AnonymousObserver(System.Action onNext) { } + public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } + public AnonymousObserver(System.Action onNext, System.Action onError) { } + public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } + protected override void OnCompletedCore() { } + protected override void OnErrorCore(System.Exception error) { } + protected override void OnNextCore(T value) { } + } + public static partial class Notification + { + public static System.Reactive.Notification CreateOnCompleted() { throw null; } + public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } + public static System.Reactive.Notification CreateOnNext(T value) { throw null; } + } + public enum NotificationKind + { + OnCompleted = 2, + OnError = 1, + OnNext = 0, + } + [System.SerializableAttribute] + public abstract partial class Notification : System.IEquatable> + { + protected internal Notification() { } + public abstract System.Exception Exception { get; } + public abstract bool HasValue { get; } + public abstract System.Reactive.NotificationKind Kind { get; } + public abstract T Value { get; } + public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); + public abstract void Accept(System.IObserver observer); + public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); + public abstract TResult Accept(System.Reactive.IObserver observer); + public override bool Equals(object obj) { throw null; } + public abstract bool Equals(System.Reactive.Notification other); + public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } + public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } + public System.IObservable ToObservable() { throw null; } + public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + } + public abstract partial class ObservableBase : System.IObservable + { + protected ObservableBase() { } + public System.IDisposable Subscribe(System.IObserver observer) { throw null; } + protected abstract System.IDisposable SubscribeCore(System.IObserver observer); + } + public static partial class Observer + { + public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } + public static System.IObserver Checked(this System.IObserver observer) { throw null; } + public static System.IObserver Create(System.Action onNext) { throw null; } + public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } + public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } + public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } + public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } + public static System.IObserver Synchronize(System.IObserver observer) { throw null; } + public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } + public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } + public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } + public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } + public static System.IObserver ToObserver(this System.Action> handler) { throw null; } + } + public abstract partial class ObserverBase : System.IDisposable, System.IObserver + { + protected ObserverBase() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public void OnCompleted() { } + protected abstract void OnCompletedCore(); + public void OnError(System.Exception error) { } + protected abstract void OnErrorCore(System.Exception error); + public void OnNext(T value) { } + protected abstract void OnNextCore(T value); + } + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] + public partial struct Unit : System.IEquatable + { + public static System.Reactive.Unit Default { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.Reactive.Unit other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } + public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } + public override string ToString() { throw null; } + } +} +namespace System.Reactive.Concurrency +{ + public sealed partial class AsyncLock : System.IDisposable + { + public AsyncLock() { } + public void Dispose() { } + public void Wait(System.Action action) { } + } + public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler + { + internal CurrentThreadScheduler() { } + public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + public static bool IsScheduleRequired { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] + public bool ScheduleRequired { get { throw null; } } + public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } + } + public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic + { + internal DefaultScheduler() { } + public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } + protected override object GetService(System.Type serviceType) { throw null; } + public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } + public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } + public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial interface IConcurrencyAbstractionLayer + { + bool SupportsLongRunning { get; } + System.IDisposable QueueUserWorkItem(System.Action action, object state); + void Sleep(System.TimeSpan timeout); + System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); + System.Reactive.Concurrency.IStopwatch StartStopwatch(); + void StartThread(System.Action action, object state); + System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); + } + public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler + { + internal ImmediateScheduler() { } + public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } + public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } + public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } + } + public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider + { + protected LocalScheduler() { } + public virtual System.DateTimeOffset Now { get { throw null; } } + protected virtual object GetService(System.Type serviceType) { throw null; } + public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } + public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } + public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); + public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } + object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } + } + public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable + { + protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } + public TAbsolute DueTime { get { throw null; } } + public bool IsCanceled { get { throw null; } } + public void Cancel() { } + public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public void Invoke() { } + protected abstract System.IDisposable InvokeCore(); + public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } + public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } + public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } + public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } + public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } + public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } + } + public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable + { + public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } + public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } + protected override System.IDisposable InvokeCore() { throw null; } + } + public static partial class Scheduler + { + public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } + public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } + public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } + [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] + public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } + public static System.DateTimeOffset Now { get { throw null; } } + [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] + public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } + [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] + public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } + public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } + public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } + public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } + public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } + public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } + public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } + public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } + public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } + public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } + public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } + public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } + public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } + public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } + public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public sealed partial class SchedulerOperation + { + internal SchedulerOperation() { } + public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } + public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion + { + internal SchedulerOperationAwaiter() { } + public bool IsCompleted { get { throw null; } } + public void GetResult() { } + public void OnCompleted(System.Action continuation) { } + } + public partial class SchedulerQueue where TAbsolute : System.IComparable + { + public SchedulerQueue() { } + public SchedulerQueue(int capacity) { } + public int Count { get { throw null; } } + public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } + public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } + public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } + public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + public static partial class Synchronization + { + public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } + public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } + public static System.IObservable Synchronize(System.IObservable source) { throw null; } + public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } + } + public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler + { + public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } + public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } + public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } + public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } + } +} +namespace System.Reactive.Disposables +{ + public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public BooleanDisposable() { } + public bool IsDisposed { get { throw null; } } + public void Dispose() { } + } + public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public CancellationDisposable() { } + public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } + public bool IsDisposed { get { throw null; } } + public System.Threading.CancellationToken Token { get { throw null; } } + public void Dispose() { } + } + public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable + { + public CompositeDisposable() { } + public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } + public CompositeDisposable(params System.IDisposable[] disposables) { } + public CompositeDisposable(int capacity) { } + public int Count { get { throw null; } } + public bool IsDisposed { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public void Add(System.IDisposable item) { } + public void Clear() { } + public bool Contains(System.IDisposable item) { throw null; } + public void CopyTo(System.IDisposable[] array, int arrayIndex) { } + public void Dispose() { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public bool Remove(System.IDisposable item) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } + public System.Threading.SynchronizationContext Context { get { throw null; } } + public bool IsDisposed { get { throw null; } } + public void Dispose() { } + } + public static partial class Disposable + { + public static System.IDisposable Empty { get { throw null; } } + public static System.IDisposable Create(System.Action dispose) { throw null; } + } + public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public MultipleAssignmentDisposable() { } + public System.IDisposable Disposable { get { throw null; } set { } } + public bool IsDisposed { get { throw null; } } + public void Dispose() { } + } + public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public RefCountDisposable(System.IDisposable disposable) { } + public bool IsDisposed { get { throw null; } } + public void Dispose() { } + public System.IDisposable GetDisposable() { throw null; } + } + public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } + public System.IDisposable Disposable { get { throw null; } } + public bool IsDisposed { get { throw null; } } + public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } + public void Dispose() { } + } + public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public SerialDisposable() { } + public System.IDisposable Disposable { get { throw null; } set { } } + public bool IsDisposed { get { throw null; } } + public void Dispose() { } + } + public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable + { + public SingleAssignmentDisposable() { } + public System.IDisposable Disposable { get { throw null; } set { } } + public bool IsDisposed { get { throw null; } } + public void Dispose() { } + } +} +namespace System.Reactive.PlatformServices +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock + { + public DefaultSystemClock() { } + public System.DateTimeOffset UtcNow { get { throw null; } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class HostLifecycleService + { + public static event System.EventHandler Resuming { add { } remove { } } + public static event System.EventHandler Suspending { add { } remove { } } + public static void AddRef() { } + public static void Release() { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial class HostResumingEventArgs : System.EventArgs + { + public HostResumingEventArgs() { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial class HostSuspendingEventArgs : System.EventArgs + { + public HostSuspendingEventArgs() { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial interface IExceptionServices + { + void Rethrow(System.Exception exception); + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial interface IHostLifecycleNotifications + { + event System.EventHandler Resuming; + event System.EventHandler Suspending; + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial interface INotifySystemClockChanged + { + event System.EventHandler SystemClockChanged; + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial interface IPlatformEnlightenmentProvider + { + T GetService(params object[] args) where T : class; + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial interface ISystemClock + { + System.DateTimeOffset UtcNow { get; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged + { + public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } + public event System.EventHandler SystemClockChanged { add { } remove { } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class PlatformEnlightenmentProvider + { + public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class SystemClock + { + public static System.DateTimeOffset UtcNow { get { throw null; } } + public static event System.EventHandler SystemClockChanged { add { } remove { } } + public static void AddRef() { } + public static void Release() { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial class SystemClockChangedEventArgs : System.EventArgs + { + public SystemClockChangedEventArgs() { } + public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } + public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Debugger.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Debugger.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.Debugger.cs diff --git a/external/binary-reference-assemblies/src/mono/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Experimental.cs new file mode 100644 index 0000000000..eb97137fe3 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Reactive.Experimental.cs @@ -0,0 +1,102 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reactive.ExperimentalAttribute] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +namespace System.Reactive +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] + [System.Reactive.ExperimentalAttribute] + public sealed partial class ExperimentalAttribute : System.Attribute + { + public ExperimentalAttribute() { } + } + [System.Reactive.ExperimentalAttribute] + public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable + { + public ListObservable(System.IObservable source) { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public T this[int index] { get { throw null; } set { } } + public T Value { get { throw null; } } + public void Add(T item) { } + public void Clear() { } + public bool Contains(T item) { throw null; } + public void CopyTo(T[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public int IndexOf(T item) { throw null; } + public void Insert(int index, T item) { } + public bool Remove(T item) { throw null; } + public void RemoveAt(int index) { } + public System.IDisposable Subscribe(System.IObserver observer) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } +} +namespace System.Reactive.Linq +{ + public static partial class ObservableEx + { + [System.Reactive.ExperimentalAttribute] + public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } + } + [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] + public static partial class QbservableEx + { + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } + [System.Reactive.ExperimentalAttribute] + public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Interfaces.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Interfaces.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.Interfaces.cs diff --git a/external/binary-reference-assemblies/src/mono/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/System.Reactive.Linq.cs.REMOVED.git-id new file mode 100644 index 0000000000..8a53b08091 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Reactive.Linq.cs.REMOVED.git-id @@ -0,0 +1 @@ +938fd0bbf95b13fff86cad6ef21d61c9ef51e92e \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Observable.Aliases.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Observable.Aliases.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.Observable.Aliases.cs diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.PlatformServices.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.PlatformServices.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.PlatformServices.cs diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/System.Reactive.Providers.cs.REMOVED.git-id similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Providers.cs.REMOVED.git-id rename to external/binary-reference-assemblies/src/mono/System.Reactive.Providers.cs.REMOVED.git-id diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Runtime.Remoting.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Runtime.Remoting.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.Runtime.Remoting.cs diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Windows.Forms.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Windows.Forms.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.Windows.Forms.cs diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/mono/System.Reactive.Windows.Threading.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Windows.Threading.cs rename to external/binary-reference-assemblies/src/mono/System.Reactive.Windows.Threading.cs diff --git a/external/binary-reference-assemblies/src/v4.7/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/mono/System.Threading.Tasks.Dataflow.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.7/System.Threading.Tasks.Dataflow.cs rename to external/binary-reference-assemblies/src/mono/System.Threading.Tasks.Dataflow.cs diff --git a/external/binary-reference-assemblies/src/mono/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/mono/System.Web.Http.SelfHost.cs new file mode 100644 index 0000000000..440476654c --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.Http.SelfHost.cs @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] +[assembly:System.Reflection.AssemblyTrademarkAttribute("")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace System.Net.Http +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class HttpRequestMessageExtensions + { + public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } + } +} +namespace System.Web.Http.SelfHost +{ + public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration + { + public HttpSelfHostConfiguration(string baseAddress) { } + public HttpSelfHostConfiguration(System.Uri baseAddress) { } + public System.Uri BaseAddress { get { throw null; } } + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + public int MaxBufferSize { get { throw null; } set { } } + public int MaxConcurrentRequests { get { throw null; } set { } } + public long MaxReceivedMessageSize { get { throw null; } set { } } + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } + public bool UseWindowsAuthentication { get { throw null; } set { } } + protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } + } + public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer + { + public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } + public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } + public System.Threading.Tasks.Task CloseAsync() { throw null; } + protected override void Dispose(bool disposing) { } + public System.Threading.Tasks.Task OpenAsync() { throw null; } + } +} +namespace System.Web.Http.SelfHost.Channels +{ + public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences + { + public HttpBinding() { } + public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } + public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((long)524288)] + public long MaxBufferPoolSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(65536)] + public int MaxBufferSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((long)65536)] + public long MaxReceivedMessageSize { get { throw null; } set { } } + public override string Scheme { get { throw null; } } + public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } + bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } + } + public sealed partial class HttpBindingSecurity + { + public HttpBindingSecurity() { } + public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } + public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } + } + public enum HttpBindingSecurityMode + { + None = 0, + Transport = 1, + TransportCredentialOnly = 2, + } +} diff --git a/external/binary-reference-assemblies/src/mono/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/mono/System.Web.Http.WebHost.cs new file mode 100644 index 0000000000..e4b7e07242 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.Http.WebHost.cs @@ -0,0 +1,76 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] +[assembly:System.Reflection.AssemblyTrademarkAttribute("")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] +namespace System.Web.Http +{ + public static partial class GlobalConfiguration + { + public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } + public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class RouteCollectionExtensions + { + public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } + public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } + public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } + } +} +namespace System.Web.Http.WebHost +{ + public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler + { + public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } + protected virtual bool IsReusable { get { throw null; } } + bool System.Web.IHttpHandler.IsReusable { get { throw null; } } + protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } + protected virtual void EndProcessRequest(System.IAsyncResult result) { } + protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } + System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } + void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } + void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } + } + public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler + { + protected HttpControllerRouteHandler() { } + public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } + protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } + System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class PreApplicationStartCode + { + public static void Start() { } + } +} +namespace System.Web.Http.WebHost.Routing +{ + public partial class HttpWebRoute : System.Web.Routing.Route + { + public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } + public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } + public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } + public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } + public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } + protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/mono/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/System.Web.Http.cs.REMOVED.git-id new file mode 100644 index 0000000000..f5bc2f7c28 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.Http.cs.REMOVED.git-id @@ -0,0 +1 @@ +81432231ba6091ba8df302fca33f7d71ae513ed7 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/System.Web.Mvc.cs.REMOVED.git-id similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/System.Web.Mvc.cs.REMOVED.git-id rename to external/binary-reference-assemblies/src/mono/System.Web.Mvc.cs.REMOVED.git-id diff --git a/external/binary-reference-assemblies/src/mono/System.Web.Mvc.extra.cs b/external/binary-reference-assemblies/src/mono/System.Web.Mvc.extra.cs new file mode 100644 index 0000000000..9eb02f921c --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.Mvc.extra.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Web.Mvc +{ + [System.Web.UI.FileLevelControlBuilder(typeof(ViewMasterPageControlBuilder))] + partial class ViewMasterPage { } + [System.Web.UI.FileLevelControlBuilder(typeof(ViewPageControlBuilder))] + partial class ViewPage { } + [System.Web.UI.ControlBuilderAttribute(typeof(ViewTypeControlBuilder))] + partial class ViewType { } + [System.Web.UI.FileLevelControlBuilder(typeof(ViewUserControlBuilder))] + partial class ViewUserControl { } + internal partial class ViewMasterPageControlBuilder { } + internal partial class ViewPageControlBuilder { } + internal partial class ViewTypeControlBuilder { } + internal partial class ViewUserControlBuilder { } +} diff --git a/external/binary-reference-assemblies/src/mono/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/mono/System.Web.Razor.cs.REMOVED.git-id new file mode 100644 index 0000000000..690ca9a2f0 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.Razor.cs.REMOVED.git-id @@ -0,0 +1 @@ +eab738bb7a21ce7f9e852ff67bfcd3e205c6e070 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/mono/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/mono/System.Web.WebPages.Deployment.cs new file mode 100644 index 0000000000..06624db1a0 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.WebPages.Deployment.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] +[assembly:System.Reflection.AssemblyTrademarkAttribute("")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] +namespace System.Web.WebPages.Deployment +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class PreApplicationStartCode + { + public static void Start() { } + } + public static partial class WebPagesDeployment + { + public static string GetAssemblyPath(System.Version version) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } + public static System.Version GetMaxVersion() { throw null; } + [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] + public static System.Version GetVersion(string path) { throw null; } + public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } + public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } + public static bool IsEnabled(string path) { throw null; } + public static bool IsExplicitlyDisabled(string path) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/mono/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/mono/System.Web.WebPages.Razor.cs new file mode 100644 index 0000000000..fcb9bf13fa --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.WebPages.Razor.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] +[assembly:System.Reflection.AssemblyTrademarkAttribute("")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] +namespace System.Web.WebPages.Razor +{ + public partial class CompilingPathEventArgs : System.EventArgs + { + public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } + public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class PreApplicationStartCode + { + public static void Start() { } + } + [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] + public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider + { + public RazorBuildProvider() { } + public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } + public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } + public new string VirtualPath { get { throw null; } } + public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } + public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } + public static event System.EventHandler CodeGenerationStarted { add { } remove { } } + public static event System.EventHandler CompilingPath { add { } remove { } } + public void AddVirtualPathDependency(string dependency) { } + protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } + public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } + public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } + protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } + protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } + protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } + } + public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost + { + public WebCodeRazorHost(string virtualPath) : base (default(string)) { } + public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } + protected override string GetClassName(string virtualPath) { throw null; } + public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } + } + public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost + { + public WebPageRazorHost(string virtualPath) { } + public WebPageRazorHost(string virtualPath, string physicalPath) { } + public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } + public override string DefaultBaseClass { get { throw null; } set { } } + public override string DefaultClassName { get { throw null; } set { } } + public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override string InstrumentedSourceFilePath { get { throw null; } set { } } + public bool IsSpecialPage { get { throw null; } } + public string PhysicalPath { get { throw null; } set { } } + public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public static void AddGlobalImport(string ns) { } + public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } + protected virtual string GetClassName(string virtualPath) { throw null; } + protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } + public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } + public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } + protected void RegisterSpecialFile(string fileName, string baseTypeName) { } + protected void RegisterSpecialFile(string fileName, System.Type baseType) { } + } + public partial class WebRazorHostFactory + { + public WebRazorHostFactory() { } + public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } + public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } + public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } + public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } + public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } + public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } + public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } + public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } + } +} +namespace System.Web.WebPages.Razor.Configuration +{ + public partial class HostSection : System.Configuration.ConfigurationSection + { + public static readonly string SectionName; + public HostSection() { } + [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] + public string FactoryType { get { throw null; } set { } } + } + public partial class RazorPagesSection : System.Configuration.ConfigurationSection + { + public static readonly string SectionName; + public RazorPagesSection() { } + [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] + public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] + public string PageBaseType { get { throw null; } set { } } + } + public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup + { + public static readonly string GroupName; + public RazorWebSectionGroup() { } + [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] + public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] + public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } + } +} diff --git a/external/binary-reference-assemblies/src/mono/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/mono/System.Web.WebPages.cs new file mode 100644 index 0000000000..1b50f92b61 --- /dev/null +++ b/external/binary-reference-assemblies/src/mono/System.Web.WebPages.cs @@ -0,0 +1,771 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] +[assembly:System.Reflection.AssemblyConfigurationAttribute("")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] +[assembly:System.Reflection.AssemblyTrademarkAttribute("")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] +namespace System.Web.Helpers +{ + public static partial class AntiForgery + { + public static System.Web.HtmlString GetHtml() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] + public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } + public static void Validate() { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + public static void Validate(string cookieToken, string formToken) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] + public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } + } + public static partial class AntiForgeryConfig + { + public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public static string CookieName { get { throw null; } set { } } + public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } + } + public partial interface IAntiForgeryAdditionalDataProvider + { + string GetAdditionalData(System.Web.HttpContextBase context); + bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); + } + public sealed partial class UnvalidatedRequestValues + { + internal UnvalidatedRequestValues() { } + public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } + public string this[string key] { get { throw null; } } + public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } + } + public static partial class Validation + { + public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } + public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } + public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } + public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } + } +} +namespace System.Web.Mvc +{ + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.SerializableAttribute] + public sealed partial class HttpAntiForgeryException : System.Web.HttpException + { + public HttpAntiForgeryException() { } + public HttpAntiForgeryException(string message) { } + public HttpAntiForgeryException(string message, System.Exception innerException) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule + { + public ModelClientValidationEqualToRule(string errorMessage, object other) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule + { + public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule + { + public ModelClientValidationRegexRule(string errorMessage, string pattern) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule + { + public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule + { + public ModelClientValidationRequiredRule(string errorMessage) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationRule + { + public ModelClientValidationRule() { } + public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } + public string ValidationType { get { throw null; } set { } } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule + { + public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class TagBuilder + { + public TagBuilder(string tagName) { } + public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string IdAttributeDotReplacement { get { throw null; } set { } } + public string InnerHtml { get { throw null; } set { } } + public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public void AddCssClass(string value) { } + public static string CreateSanitizedId(string originalId) { throw null; } + public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } + public void GenerateId(string name) { } + public void MergeAttribute(string key, string value) { } + public void MergeAttribute(string key, string value, bool replaceExisting) { } + public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } + public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } + public void SetInnerText(string innerText) { } + public override string ToString() { throw null; } + public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public enum TagRenderMode + { + EndTag = 2, + Normal = 0, + SelfClosing = 3, + StartTag = 1, + } + public static partial class UnobtrusiveValidationAttributesGenerator + { + public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } + } +} +namespace System.Web.WebPages +{ + public partial class ApplicationPart + { + public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } + public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } + public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } + } + public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase + { + public static readonly string CacheKeyPrefix; + public static readonly string StartPageVirtualPath; + protected ApplicationStartPage() { } + public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Web.HttpContextBase Context { get { throw null; } } + public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override string VirtualPath { get { throw null; } set { } } + protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } + public override void Write(object value) { } + public override void Write(System.Web.WebPages.HelperResult result) { } + public override void WriteLiteral(object value) { } + } + public partial class AttributeValue + { + public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } + public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } + public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } + public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } + public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } + } + public static partial class BrowserHelpers + { + public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } + public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } + public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } + public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } + public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } + public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } + public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } + } + public enum BrowserOverride + { + Desktop = 0, + Mobile = 1, + } + public abstract partial class BrowserOverrideStore + { + protected BrowserOverrideStore() { } + public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); + public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); + } + public partial class BrowserOverrideStores + { + public BrowserOverrideStores() { } + public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } + } + public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore + { + public CookieBrowserOverrideStore() { } + public CookieBrowserOverrideStore(int daysToExpire) { } + public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } + public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } + } + public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode + { + public DefaultDisplayMode() { } + public DefaultDisplayMode(string suffix) { } + public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual string DisplayModeId { get { throw null; } } + public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } + public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } + protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } + } + public partial class DisplayInfo + { + public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } + public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public sealed partial class DisplayModeProvider + { + internal DisplayModeProvider() { } + public static readonly string DefaultDisplayModeId; + public static readonly string MobileDisplayModeId; + public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } + public System.Collections.Generic.IList Modes { get { throw null; } } + public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } + public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } + } + public partial class HelperPage + { + public HelperPage() { } + public static dynamic App { get { throw null; } } + public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } + public static System.Web.Caching.Cache Cache { get { throw null; } } + public static System.Web.HttpContextBase Context { get { throw null; } } + public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } + protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } + public static bool IsAjax { get { throw null; } } + public static bool IsPost { get { throw null; } } + public static dynamic Model { get { throw null; } } + public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } + public static dynamic Page { get { throw null; } } + public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } + public static System.Collections.Generic.IDictionary PageData { get { throw null; } } + public static System.Web.HttpRequestBase Request { get { throw null; } } + public static System.Web.HttpResponseBase Response { get { throw null; } } + public static System.Web.HttpServerUtilityBase Server { get { throw null; } } + public static System.Web.HttpSessionStateBase Session { get { throw null; } } + public static System.Collections.Generic.IList UrlData { get { throw null; } } + public static System.Security.Principal.IPrincipal User { get { throw null; } } + public static string VirtualPath { get { throw null; } } + public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } + public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } + public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } + public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } + public static string Href(string path, params object[] pathParts) { throw null; } + public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } + public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } + public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } + public static void WriteTo(System.IO.TextWriter writer, object value) { } + public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } + } + public partial class HelperResult : System.Web.IHtmlString + { + public HelperResult(System.Action action) { } + public string ToHtmlString() { throw null; } + public override string ToString() { throw null; } + public void WriteTo(System.IO.TextWriter writer) { } + } + public static partial class HttpContextExtensions + { + public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } + public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } + } + public partial interface IDisplayMode + { + string DisplayModeId { get; } + bool CanHandleContext(System.Web.HttpContextBase httpContext); + System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); + } + public partial interface ITemplateFile + { + System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } + } + public partial interface IValidator + { + System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } + System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); + } + public partial interface IVirtualPathFactory + { + object CreateInstance(string virtualPath); + bool Exists(string virtualPath); + } + public partial interface IWebPageRequestExecutor + { + bool Execute(System.Web.WebPages.WebPage page); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class PageVirtualPathAttribute : System.Attribute + { + public PageVirtualPathAttribute(string virtualPath) { } + public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class PreApplicationStartCode + { + public static void Start() { } + } + public static partial class RequestExtensions + { + public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } + } + public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator + { + protected RequestFieldValidatorBase(string errorMessage) { } + protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } + public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } + protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } + protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } + protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); + public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } + } + public static partial class ResponseExtensions + { + public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } + public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } + public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } + public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } + public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } + } + public delegate void SectionWriter(); + public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase + { + protected StartPage() { } + public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override System.Web.HttpContextBase Context { get { throw null; } set { } } + public override string Layout { get { throw null; } set { } } + public override dynamic Page { get { throw null; } } + public override System.Collections.Generic.IDictionary PageData { get { throw null; } } + public override void ExecutePageHierarchy() { } + protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } + public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } + public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } + public void RunPage() { } + public override void Write(object value) { } + public override void Write(System.Web.WebPages.HelperResult result) { } + public override void WriteLiteral(object value) { } + } + public static partial class StringExtensions + { + public static bool AsBool(this string value) { throw null; } + public static bool AsBool(this string value, bool defaultValue) { throw null; } + public static System.DateTime AsDateTime(this string value) { throw null; } + public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } + public static decimal AsDecimal(this string value) { throw null; } + public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } + public static float AsFloat(this string value) { throw null; } + public static float AsFloat(this string value, float defaultValue) { throw null; } + public static int AsInt(this string value) { throw null; } + public static int AsInt(this string value, int defaultValue) { throw null; } + public static TValue As(this string value) { throw null; } + public static TValue As(this string value, TValue defaultValue) { throw null; } + public static bool IsBool(this string value) { throw null; } + public static bool IsDateTime(this string value) { throw null; } + public static bool IsDecimal(this string value) { throw null; } + public static bool IsEmpty(this string value) { throw null; } + public static bool IsFloat(this string value) { throw null; } + public static bool IsInt(this string value) { throw null; } + public static bool Is(this string value) { throw null; } + } + public partial class TemplateFileInfo + { + public TemplateFileInfo(string virtualPath) { } + public string VirtualPath { get { throw null; } } + } + public static partial class TemplateStack + { + public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } + public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } + public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } + } + public sealed partial class ValidationHelper + { + internal ValidationHelper() { } + public string FormField { get { throw null; } } + public static string InvalidCssClass { get { throw null; } set { } } + public static string ValidCssClass { get { throw null; } set { } } + public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } + public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } + public void AddFormError(string errorMessage) { } + public System.Web.HtmlString ClassFor(string field) { throw null; } + public System.Web.HtmlString For(string field) { throw null; } + public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } + public bool IsValid(params string[] fields) { throw null; } + public void RequireField(string field) { } + public void RequireField(string field, string errorMessage) { } + public void RequireFields(params string[] fields) { } + public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } + } + public abstract partial class Validator + { + protected Validator() { } + public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } + public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } + } + public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory + { + internal VirtualPathFactoryManager() { } + public object CreateInstance(string virtualPath) { throw null; } + public bool Exists(string virtualPath) { throw null; } + public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } + } + public abstract partial class WebPage : System.Web.WebPages.WebPageBase + { + protected WebPage() { } + public override System.Web.HttpContextBase Context { get { throw null; } set { } } + public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public dynamic Model { get { throw null; } } + public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } + public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } + public override void ExecutePageHierarchy() { } + protected override void InitializePage() { } + public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } + public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } + } + public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase + { + protected WebPageBase() { } + public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.IO.TextWriter Output { get { throw null; } } + public System.Collections.Generic.Stack OutputStack { get { throw null; } } + public override dynamic Page { get { throw null; } } + public override System.Collections.Generic.IDictionary PageData { get { throw null; } } + protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } + public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } + public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } + public override void ExecutePageHierarchy() { } + public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } + public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } + protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } + protected virtual void InitializePage() { } + public bool IsSectionDefined(string name) { throw null; } + public void PopContext() { } + public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } + public System.Web.WebPages.HelperResult RenderBody() { throw null; } + public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } + public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } + public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } + public override void Write(object value) { } + public override void Write(System.Web.WebPages.HelperResult result) { } + public override void WriteLiteral(object value) { } + } + public partial class WebPageContext + { + public WebPageContext() { } + public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } + public static System.Web.WebPages.WebPageContext Current { get { throw null; } } + public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary PageData { get { throw null; } } + } + public abstract partial class WebPageExecutingBase + { + protected WebPageExecutingBase() { } + public virtual dynamic App { get { throw null; } } + public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } + public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } + protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } + protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } + protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } + protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } + protected internal void EndContext(int startPosition, int length, bool isLiteral) { } + protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } + protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } + protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public abstract void Execute(); + protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } + public virtual string Href(string path, params object[] pathParts) { throw null; } + public virtual string NormalizePath(string path) { throw null; } + public abstract void Write(object value); + public abstract void Write(System.Web.WebPages.HelperResult result); + public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } + public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } + protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } + public abstract void WriteLiteral(object value); + public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } + public static void WriteTo(System.IO.TextWriter writer, object content) { } + public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } + } + public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState + { + public static readonly string WebPagesVersionHeaderName; + public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } + public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual bool IsReusable { get { throw null; } } + public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } + public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } + public virtual void ProcessRequest(System.Web.HttpContext context) { } + public static void RegisterExtension(string extension) { } + } + public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile + { + protected WebPageRenderingBase() { } + public virtual System.Web.Caching.Cache Cache { get { throw null; } } + public string Culture { get { throw null; } set { } } + protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } + public virtual bool IsAjax { get { throw null; } } + public virtual bool IsPost { get { throw null; } } + public abstract string Layout { get; set; } + public abstract dynamic Page { get; } + public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public abstract System.Collections.Generic.IDictionary PageData { get; } + public System.Web.Profile.ProfileBase Profile { get { throw null; } } + public virtual System.Web.HttpRequestBase Request { get { throw null; } } + public virtual System.Web.HttpResponseBase Response { get { throw null; } } + public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } + public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } + public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } + public string UICulture { get { throw null; } set { } } + public virtual System.Collections.Generic.IList UrlData { get { throw null; } } + public virtual System.Security.Principal.IPrincipal User { get { throw null; } } + public abstract void ExecutePageHierarchy(); + public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); + } +} +namespace System.Web.WebPages.Html +{ + public partial class HtmlHelper + { + internal HtmlHelper() { } + public static string IdAttributeDotReplacement { get { throw null; } set { } } + public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } + public static string ValidationInputCssClassName { get { throw null; } set { } } + public static string ValidationInputValidCssClassName { get { throw null; } set { } } + public static string ValidationMessageCssClassName { get { throw null; } set { } } + public static string ValidationMessageValidCssClassName { get { throw null; } set { } } + public static string ValidationSummaryClass { get { throw null; } set { } } + public static string ValidationSummaryValidClass { get { throw null; } set { } } + public string AttributeEncode(object value) { throw null; } + public string AttributeEncode(string value) { throw null; } + public System.Web.IHtmlString CheckBox(string name) { throw null; } + public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } + public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } + public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } + public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } + public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } + public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } + public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } + public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } + public string Encode(object value) { throw null; } + public string Encode(string value) { throw null; } + public System.Web.IHtmlString Hidden(string name) { throw null; } + public System.Web.IHtmlString Hidden(string name, object value) { throw null; } + public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } + public System.Web.IHtmlString Label(string labelText) { throw null; } + public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } + public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } + public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } + public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } + public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } + public System.Web.IHtmlString Password(string name) { throw null; } + public System.Web.IHtmlString Password(string name, object value) { throw null; } + public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } + public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } + public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } + public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } + public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } + public System.Web.IHtmlString Raw(object value) { throw null; } + public System.Web.IHtmlString Raw(string value) { throw null; } + public System.Web.IHtmlString TextArea(string name) { throw null; } + public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } + public System.Web.IHtmlString TextArea(string name, string value) { throw null; } + public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } + public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } + public System.Web.IHtmlString TextBox(string name) { throw null; } + public System.Web.IHtmlString TextBox(string name, object value) { throw null; } + public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationMessage(string name) { throw null; } + public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } + public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationSummary() { throw null; } + public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } + public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationSummary(string message) { throw null; } + public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } + public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } + } + public partial class ModelState + { + public ModelState() { } + public System.Collections.Generic.IList Errors { get { throw null; } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + { + public ModelStateDictionary() { } + public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public bool IsValid { get { throw null; } } + public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } + public System.Collections.Generic.ICollection Keys { get { throw null; } } + public System.Collections.Generic.ICollection Values { get { throw null; } } + public void Add(System.Collections.Generic.KeyValuePair item) { } + public void Add(string key, System.Web.WebPages.Html.ModelState value) { } + public void AddError(string key, string errorMessage) { } + public void AddFormError(string errorMessage) { } + public void Clear() { } + public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } + public bool ContainsKey(string key) { throw null; } + public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + public bool IsValidField(string key) { throw null; } + public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } + public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } + public bool Remove(string key) { throw null; } + public void SetModelValue(string key, object value) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } + } + public partial class SelectListItem + { + public SelectListItem() { } + public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } + public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } +} +namespace System.Web.WebPages.Instrumentation +{ + public partial class InstrumentationService + { + public InstrumentationService() { } + public bool IsAvailable { get { throw null; } } + public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } + public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } + } + [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] + public partial class PositionTagged + { + public PositionTagged(T value, int offset) { } + public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } + public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } + public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } + public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } + public override string ToString() { throw null; } + } +} +namespace System.Web.WebPages.Scope +{ + public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider + { + public AspNetRequestScopeStorageProvider() { } + public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } + public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } + public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } + } + public partial interface IScopeStorageProvider + { + System.Collections.Generic.IDictionary CurrentScope { get; set; } + System.Collections.Generic.IDictionary GlobalScope { get; } + } + public static partial class ScopeStorage + { + public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } + public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } + public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } + public static System.IDisposable CreateTransientScope() { throw null; } + public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } + } + public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + { + public ScopeStorageDictionary() { } + public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } + protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } + protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } + public virtual int Count { get { throw null; } } + public virtual bool IsReadOnly { get { throw null; } } + public object this[object key] { get { throw null; } set { } } + public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } + public virtual System.Collections.Generic.ICollection Values { get { throw null; } } + public virtual void Add(System.Collections.Generic.KeyValuePair item) { } + public virtual void Add(object key, object value) { } + public virtual void Clear() { } + public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } + public virtual bool ContainsKey(object key) { throw null; } + public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } + public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } + public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } + public virtual bool Remove(object key) { throw null; } + public virtual void SetValue(object key, object value) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } + } + public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider + { + public StaticScopeStorageProvider() { } + public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } + public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.6.1/cscompmgd.cs b/external/binary-reference-assemblies/src/mono/cscompmgd.cs similarity index 100% rename from external/binary-reference-assemblies/src/v4.6.1/cscompmgd.cs rename to external/binary-reference-assemblies/src/mono/cscompmgd.cs diff --git a/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id new file mode 100644 index 0000000000..e3fba8c5e0 --- /dev/null +++ b/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id @@ -0,0 +1 @@ +1677ef1e7504f41839769cf611c93149e1d4800f \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monodroid/System.Net.Http.cs b/external/binary-reference-assemblies/src/monodroid/System.Net.Http.cs new file mode 100644 index 0000000000..c29201fb67 --- /dev/null +++ b/external/binary-reference-assemblies/src/monodroid/System.Net.Http.cs @@ -0,0 +1,647 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Http.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Http.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Http.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Net.Http.WebRequest, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +namespace System.Net.Http +{ + public partial class ByteArrayContent : System.Net.Http.HttpContent + { + public ByteArrayContent(byte[] content) { } + public ByteArrayContent(byte[] content, int offset, int count) { } + protected override System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public enum ClientCertificateOption + { + Automatic = 1, + Manual = 0, + } + public abstract partial class DelegatingHandler : System.Net.Http.HttpMessageHandler + { + protected DelegatingHandler() { } + protected DelegatingHandler(System.Net.Http.HttpMessageHandler innerHandler) { } + public System.Net.Http.HttpMessageHandler InnerHandler { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class FormUrlEncodedContent : System.Net.Http.ByteArrayContent + { + public FormUrlEncodedContent(System.Collections.Generic.IEnumerable> nameValueCollection) : base (default(byte[])) { } + } + public partial class HttpClient : System.Net.Http.HttpMessageInvoker + { + public HttpClient() : base (default(System.Net.Http.HttpMessageHandler)) { } + public HttpClient(System.Net.Http.HttpMessageHandler handler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public HttpClient(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public System.Uri BaseAddress { get { throw null; } set { } } + public System.Net.Http.Headers.HttpRequestHeaders DefaultRequestHeaders { get { throw null; } } + public long MaxResponseContentBufferSize { get { throw null; } set { } } + public System.TimeSpan Timeout { get { throw null; } set { } } + public void CancelPendingRequests() { } + public System.Threading.Tasks.Task DeleteAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(string requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(System.Uri requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + protected override void Dispose(bool disposing) { } + public System.Threading.Tasks.Task GetAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetByteArrayAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetByteArrayAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetStreamAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetStreamAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetStringAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetStringAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task PostAsync(string requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PostAsync(string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PostAsync(System.Uri requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PostAsync(System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PutAsync(string requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PutAsync(string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PutAsync(System.Uri requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PutAsync(System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class HttpClientHandler : System.Net.Http.HttpMessageHandler + { + public HttpClientHandler() { } + public bool AllowAutoRedirect { get { throw null; } set { } } + public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } } + public bool CheckCertificateRevocationList { get { throw null; } set { } } + public System.Net.Http.ClientCertificateOption ClientCertificateOptions { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } } + public System.Net.CookieContainer CookieContainer { get { throw null; } set { } } + public System.Net.ICredentials Credentials { get { throw null; } set { } } + public System.Net.ICredentials DefaultProxyCredentials { get { throw null; } set { } } + public int MaxAutomaticRedirections { get { throw null; } set { } } + public int MaxConnectionsPerServer { get { throw null; } set { } } + public long MaxRequestContentBufferSize { get { throw null; } set { } } + public int MaxResponseHeadersLength { get { throw null; } set { } } + public bool PreAuthenticate { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Properties { get { throw null; } } + public System.Net.IWebProxy Proxy { get { throw null; } set { } } + public System.Func ServerCertificateCustomValidationCallback { get { throw null; } set { } } + public System.Security.Authentication.SslProtocols SslProtocols { get { throw null; } set { } } + public virtual bool SupportsAutomaticDecompression { get { throw null; } } + public virtual bool SupportsProxy { get { throw null; } } + public virtual bool SupportsRedirectConfiguration { get { throw null; } } + public bool UseCookies { get { throw null; } set { } } + public bool UseDefaultCredentials { get { throw null; } set { } } + public bool UseProxy { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public enum HttpCompletionOption + { + ResponseContentRead = 0, + ResponseHeadersRead = 1, + } + public abstract partial class HttpContent : System.IDisposable + { + protected HttpContent() { } + public System.Net.Http.Headers.HttpContentHeaders Headers { get { throw null; } } + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream stream) { throw null; } + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected virtual System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.Threading.Tasks.Task LoadIntoBufferAsync() { throw null; } + public System.Threading.Tasks.Task LoadIntoBufferAsync(long maxBufferSize) { throw null; } + public System.Threading.Tasks.Task ReadAsByteArrayAsync() { throw null; } + public System.Threading.Tasks.Task ReadAsStreamAsync() { throw null; } + public System.Threading.Tasks.Task ReadAsStringAsync() { throw null; } + protected internal abstract System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context); + protected internal abstract bool TryComputeLength(out long length); + } + public abstract partial class HttpMessageHandler : System.IDisposable + { + protected HttpMessageHandler() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected internal abstract System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); + } + public partial class HttpMessageInvoker : System.IDisposable + { + public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler) { } + public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public virtual System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class HttpMethod : System.IEquatable + { + public HttpMethod(string method) { } + public static System.Net.Http.HttpMethod Delete { get { throw null; } } + public static System.Net.Http.HttpMethod Get { get { throw null; } } + public static System.Net.Http.HttpMethod Head { get { throw null; } } + public string Method { get { throw null; } } + public static System.Net.Http.HttpMethod Options { get { throw null; } } + public static System.Net.Http.HttpMethod Post { get { throw null; } } + public static System.Net.Http.HttpMethod Put { get { throw null; } } + public static System.Net.Http.HttpMethod Trace { get { throw null; } } + public bool Equals(System.Net.Http.HttpMethod other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Net.Http.HttpMethod left, System.Net.Http.HttpMethod right) { throw null; } + public static bool operator !=(System.Net.Http.HttpMethod left, System.Net.Http.HttpMethod right) { throw null; } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class HttpRequestException : System.Exception + { + public HttpRequestException() { } + public HttpRequestException(string message) { } + public HttpRequestException(string message, System.Exception inner) { } + } + public partial class HttpRequestMessage : System.IDisposable + { + public HttpRequestMessage() { } + public HttpRequestMessage(System.Net.Http.HttpMethod method, string requestUri) { } + public HttpRequestMessage(System.Net.Http.HttpMethod method, System.Uri requestUri) { } + public System.Net.Http.HttpContent Content { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Net.Http.Headers.HttpRequestHeaders Headers { get { throw null; } } + public System.Net.Http.HttpMethod Method { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Properties { get { throw null; } } + public System.Uri RequestUri { get { throw null; } set { } } + public System.Version Version { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public override string ToString() { throw null; } + } + public partial class HttpResponseMessage : System.IDisposable + { + public HttpResponseMessage() { } + public HttpResponseMessage(System.Net.HttpStatusCode statusCode) { } + public System.Net.Http.HttpContent Content { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Net.Http.Headers.HttpResponseHeaders Headers { get { throw null; } } + public bool IsSuccessStatusCode { get { throw null; } } + public string ReasonPhrase { get { throw null; } set { } } + public System.Net.Http.HttpRequestMessage RequestMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Net.HttpStatusCode StatusCode { get { throw null; } set { } } + public System.Version Version { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.Net.Http.HttpResponseMessage EnsureSuccessStatusCode() { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class MessageProcessingHandler : System.Net.Http.DelegatingHandler + { + protected MessageProcessingHandler() { } + protected MessageProcessingHandler(System.Net.Http.HttpMessageHandler innerHandler) { } + protected abstract System.Net.Http.HttpRequestMessage ProcessRequest(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); + protected abstract System.Net.Http.HttpResponseMessage ProcessResponse(System.Net.Http.HttpResponseMessage response, System.Threading.CancellationToken cancellationToken); + protected internal sealed override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class MultipartContent : System.Net.Http.HttpContent, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public MultipartContent() { } + public MultipartContent(string subtype) { } + public MultipartContent(string subtype, string boundary) { } + public virtual void Add(System.Net.Http.HttpContent content) { } + protected override void Dispose(bool disposing) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public partial class MultipartFormDataContent : System.Net.Http.MultipartContent + { + public MultipartFormDataContent() { } + public MultipartFormDataContent(string boundary) { } + public override void Add(System.Net.Http.HttpContent content) { } + public void Add(System.Net.Http.HttpContent content, string name) { } + public void Add(System.Net.Http.HttpContent content, string name, string fileName) { } + } + public partial class StreamContent : System.Net.Http.HttpContent + { + public StreamContent(System.IO.Stream content) { } + public StreamContent(System.IO.Stream content, int bufferSize) { } + protected override System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public partial class StringContent : System.Net.Http.ByteArrayContent + { + public StringContent(string content) : base (default(byte[])) { } + public StringContent(string content, System.Text.Encoding encoding) : base (default(byte[])) { } + public StringContent(string content, System.Text.Encoding encoding, string mediaType) : base (default(byte[])) { } + } +} +namespace System.Net.Http.Headers +{ + public partial class AuthenticationHeaderValue : System.ICloneable + { + public AuthenticationHeaderValue(string scheme) { } + public AuthenticationHeaderValue(string scheme, string parameter) { } + public string Parameter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.AuthenticationHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.AuthenticationHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.AuthenticationHeaderValue); throw null; } + } + public partial class CacheControlHeaderValue : System.ICloneable + { + public CacheControlHeaderValue() { } + public System.Collections.Generic.ICollection Extensions { get { throw null; } } + public System.Nullable MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool MaxStale { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable MaxStaleLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable MinFresh { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool MustRevalidate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool NoCache { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.ICollection NoCacheHeaders { get { throw null; } } + public bool NoStore { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool NoTransform { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool OnlyIfCached { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool Private { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.ICollection PrivateHeaders { get { throw null; } } + public bool ProxyRevalidate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool Public { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable SharedMaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.CacheControlHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.CacheControlHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.CacheControlHeaderValue); throw null; } + } + public partial class ContentDispositionHeaderValue : System.ICloneable + { + protected ContentDispositionHeaderValue(System.Net.Http.Headers.ContentDispositionHeaderValue source) { } + public ContentDispositionHeaderValue(string dispositionType) { } + public System.Nullable CreationDate { get { throw null; } set { } } + public string DispositionType { get { throw null; } set { } } + public string FileName { get { throw null; } set { } } + public string FileNameStar { get { throw null; } set { } } + public System.Nullable ModificationDate { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public System.Nullable ReadDate { get { throw null; } set { } } + public System.Nullable Size { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ContentDispositionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ContentDispositionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ContentDispositionHeaderValue); throw null; } + } + public partial class ContentRangeHeaderValue : System.ICloneable + { + public ContentRangeHeaderValue(long length) { } + public ContentRangeHeaderValue(long from, long to) { } + public ContentRangeHeaderValue(long from, long to, long length) { } + public System.Nullable From { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool HasLength { get { throw null; } } + public bool HasRange { get { throw null; } } + public System.Nullable Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable To { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Unit { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ContentRangeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ContentRangeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ContentRangeHeaderValue); throw null; } + } + public partial class EntityTagHeaderValue : System.ICloneable + { + public EntityTagHeaderValue(string tag) { } + public EntityTagHeaderValue(string tag, bool isWeak) { } + public static System.Net.Http.Headers.EntityTagHeaderValue Any { get { throw null; } } + public bool IsWeak { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Tag { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.EntityTagHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.EntityTagHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.EntityTagHeaderValue); throw null; } + } + public sealed partial class HttpContentHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpContentHeaders() { } + public System.Collections.Generic.ICollection Allow { get { throw null; } } + public System.Net.Http.Headers.ContentDispositionHeaderValue ContentDisposition { get { throw null; } set { } } + public System.Collections.Generic.ICollection ContentEncoding { get { throw null; } } + public System.Collections.Generic.ICollection ContentLanguage { get { throw null; } } + public System.Nullable ContentLength { get { throw null; } set { } } + public System.Uri ContentLocation { get { throw null; } set { } } + public byte[] ContentMD5 { get { throw null; } set { } } + public System.Net.Http.Headers.ContentRangeHeaderValue ContentRange { get { throw null; } set { } } + public System.Net.Http.Headers.MediaTypeHeaderValue ContentType { get { throw null; } set { } } + public System.Nullable Expires { get { throw null; } set { } } + public System.Nullable LastModified { get { throw null; } set { } } + } + public abstract partial class HttpHeaders : System.Collections.Generic.IEnumerable>>, System.Collections.IEnumerable + { + protected HttpHeaders() { } + public void Add(string name, System.Collections.Generic.IEnumerable values) { } + public void Add(string name, string value) { } + public void Clear() { } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator>> GetEnumerator() { throw null; } + public System.Collections.Generic.IEnumerable GetValues(string name) { throw null; } + public bool Remove(string name) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + public bool TryAddWithoutValidation(string name, System.Collections.Generic.IEnumerable values) { throw null; } + public bool TryAddWithoutValidation(string name, string value) { throw null; } + public bool TryGetValues(string name, out System.Collections.Generic.IEnumerable values) { values = default(System.Collections.Generic.IEnumerable); throw null; } + } + public sealed partial class HttpHeaderValueCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : class + { + internal HttpHeaderValueCollection() { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public void Add(T item) { } + public void Clear() { } + public bool Contains(T item) { throw null; } + public void CopyTo(T[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public void ParseAdd(string input) { } + public bool Remove(T item) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + public bool TryParseAdd(string input) { throw null; } + } + public sealed partial class HttpRequestHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpRequestHeaders() { } + public System.Net.Http.Headers.HttpHeaderValueCollection Accept { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptCharset { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptEncoding { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptLanguage { get { throw null; } } + public System.Net.Http.Headers.AuthenticationHeaderValue Authorization { get { throw null; } set { } } + public System.Net.Http.Headers.CacheControlHeaderValue CacheControl { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Connection { get { throw null; } } + public System.Nullable ConnectionClose { get { throw null; } set { } } + public System.Nullable Date { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Expect { get { throw null; } } + public System.Nullable ExpectContinue { get { throw null; } set { } } + public string From { get { throw null; } set { } } + public string Host { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection IfMatch { get { throw null; } } + public System.Nullable IfModifiedSince { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection IfNoneMatch { get { throw null; } } + public System.Net.Http.Headers.RangeConditionHeaderValue IfRange { get { throw null; } set { } } + public System.Nullable IfUnmodifiedSince { get { throw null; } set { } } + public System.Nullable MaxForwards { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Pragma { get { throw null; } } + public System.Net.Http.Headers.AuthenticationHeaderValue ProxyAuthorization { get { throw null; } set { } } + public System.Net.Http.Headers.RangeHeaderValue Range { get { throw null; } set { } } + public System.Uri Referrer { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection TE { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Trailer { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection TransferEncoding { get { throw null; } } + public System.Nullable TransferEncodingChunked { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Upgrade { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection UserAgent { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Via { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Warning { get { throw null; } } + } + public sealed partial class HttpResponseHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpResponseHeaders() { } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptRanges { get { throw null; } } + public System.Nullable Age { get { throw null; } set { } } + public System.Net.Http.Headers.CacheControlHeaderValue CacheControl { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Connection { get { throw null; } } + public System.Nullable ConnectionClose { get { throw null; } set { } } + public System.Nullable Date { get { throw null; } set { } } + public System.Net.Http.Headers.EntityTagHeaderValue ETag { get { throw null; } set { } } + public System.Uri Location { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Pragma { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection ProxyAuthenticate { get { throw null; } } + public System.Net.Http.Headers.RetryConditionHeaderValue RetryAfter { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Server { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Trailer { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection TransferEncoding { get { throw null; } } + public System.Nullable TransferEncodingChunked { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Upgrade { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Vary { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Via { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Warning { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection WwwAuthenticate { get { throw null; } } + } + public partial class MediaTypeHeaderValue : System.ICloneable + { + protected MediaTypeHeaderValue(System.Net.Http.Headers.MediaTypeHeaderValue source) { } + public MediaTypeHeaderValue(string mediaType) { } + public string CharSet { get { throw null; } set { } } + public string MediaType { get { throw null; } set { } } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.MediaTypeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.MediaTypeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.MediaTypeHeaderValue); throw null; } + } + public sealed partial class MediaTypeWithQualityHeaderValue : System.Net.Http.Headers.MediaTypeHeaderValue + { + public MediaTypeWithQualityHeaderValue(string mediaType) : base (default(string)) { } + public MediaTypeWithQualityHeaderValue(string mediaType, double quality) : base (default(string)) { } + public System.Nullable Quality { get { throw null; } set { } } + public static new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue Parse(string input) { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.MediaTypeWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue); throw null; } + } + public partial class NameValueHeaderValue : System.ICloneable + { + protected internal NameValueHeaderValue(System.Net.Http.Headers.NameValueHeaderValue source) { } + public NameValueHeaderValue(string name) { } + public NameValueHeaderValue(string name, string value) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Value { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.NameValueHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.NameValueHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.NameValueHeaderValue); throw null; } + } + public partial class NameValueWithParametersHeaderValue : System.Net.Http.Headers.NameValueHeaderValue, System.ICloneable + { + protected NameValueWithParametersHeaderValue(System.Net.Http.Headers.NameValueWithParametersHeaderValue source) : base (default(string)) { } + public NameValueWithParametersHeaderValue(string name) : base (default(string)) { } + public NameValueWithParametersHeaderValue(string name, string value) : base (default(string)) { } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static new System.Net.Http.Headers.NameValueWithParametersHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.NameValueWithParametersHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.NameValueWithParametersHeaderValue); throw null; } + } + public partial class ProductHeaderValue : System.ICloneable + { + public ProductHeaderValue(string name) { } + public ProductHeaderValue(string name, string version) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ProductHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ProductHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ProductHeaderValue); throw null; } + } + public partial class ProductInfoHeaderValue : System.ICloneable + { + public ProductInfoHeaderValue(System.Net.Http.Headers.ProductHeaderValue product) { } + public ProductInfoHeaderValue(string comment) { } + public ProductInfoHeaderValue(string productName, string productVersion) { } + public string Comment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Net.Http.Headers.ProductHeaderValue Product { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ProductInfoHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ProductInfoHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ProductInfoHeaderValue); throw null; } + } + public partial class RangeConditionHeaderValue : System.ICloneable + { + public RangeConditionHeaderValue(System.DateTimeOffset date) { } + public RangeConditionHeaderValue(System.Net.Http.Headers.EntityTagHeaderValue entityTag) { } + public RangeConditionHeaderValue(string entityTag) { } + public System.Nullable Date { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Net.Http.Headers.EntityTagHeaderValue EntityTag { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RangeConditionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RangeConditionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RangeConditionHeaderValue); throw null; } + } + public partial class RangeHeaderValue : System.ICloneable + { + public RangeHeaderValue() { } + public RangeHeaderValue(System.Nullable from, System.Nullable to) { } + public System.Collections.Generic.ICollection Ranges { get { throw null; } } + public string Unit { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RangeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RangeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RangeHeaderValue); throw null; } + } + public partial class RangeItemHeaderValue : System.ICloneable + { + public RangeItemHeaderValue(System.Nullable from, System.Nullable to) { } + public System.Nullable From { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable To { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + } + public partial class RetryConditionHeaderValue : System.ICloneable + { + public RetryConditionHeaderValue(System.DateTimeOffset date) { } + public RetryConditionHeaderValue(System.TimeSpan delta) { } + public System.Nullable Date { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable Delta { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RetryConditionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RetryConditionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RetryConditionHeaderValue); throw null; } + } + public partial class StringWithQualityHeaderValue : System.ICloneable + { + public StringWithQualityHeaderValue(string value) { } + public StringWithQualityHeaderValue(string value, double quality) { } + public System.Nullable Quality { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.StringWithQualityHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.StringWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.StringWithQualityHeaderValue); throw null; } + } + public partial class TransferCodingHeaderValue : System.ICloneable + { + protected TransferCodingHeaderValue(System.Net.Http.Headers.TransferCodingHeaderValue source) { } + public TransferCodingHeaderValue(string value) { } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public string Value { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.TransferCodingHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.TransferCodingHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.TransferCodingHeaderValue); throw null; } + } + public sealed partial class TransferCodingWithQualityHeaderValue : System.Net.Http.Headers.TransferCodingHeaderValue + { + public TransferCodingWithQualityHeaderValue(string value) : base (default(string)) { } + public TransferCodingWithQualityHeaderValue(string value, double quality) : base (default(string)) { } + public System.Nullable Quality { get { throw null; } set { } } + public static new System.Net.Http.Headers.TransferCodingWithQualityHeaderValue Parse(string input) { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.TransferCodingWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.TransferCodingWithQualityHeaderValue); throw null; } + } + public partial class ViaHeaderValue : System.ICloneable + { + public ViaHeaderValue(string protocolVersion, string receivedBy) { } + public ViaHeaderValue(string protocolVersion, string receivedBy, string protocolName) { } + public ViaHeaderValue(string protocolVersion, string receivedBy, string protocolName, string comment) { } + public string Comment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ProtocolName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ProtocolVersion { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ReceivedBy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ViaHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ViaHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ViaHeaderValue); throw null; } + } + public partial class WarningHeaderValue : System.ICloneable + { + public WarningHeaderValue(int code, string agent, string text) { } + public WarningHeaderValue(int code, string agent, string text, System.DateTimeOffset date) { } + public string Agent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int Code { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable Date { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.WarningHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.WarningHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.WarningHeaderValue); throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/monodroid/System.Numerics.cs b/external/binary-reference-assemblies/src/monodroid/System.Numerics.cs new file mode 100644 index 0000000000..9a5c30d4fd --- /dev/null +++ b/external/binary-reference-assemblies/src/monodroid/System.Numerics.cs @@ -0,0 +1,608 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.0.5.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Numerics.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Numerics.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Numerics.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("2.0.5.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Numerics +{ + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct BigInteger : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable + { + [System.CLSCompliantAttribute(false)] + public BigInteger(byte[] value) { throw null;} + public BigInteger(decimal value) { throw null;} + public BigInteger(double value) { throw null;} + public BigInteger(int value) { throw null;} + public BigInteger(long value) { throw null;} + public BigInteger(System.ReadOnlySpan value) { throw null;} + public BigInteger(float value) { throw null;} + [System.CLSCompliantAttribute(false)] + public BigInteger(uint value) { throw null;} + [System.CLSCompliantAttribute(false)] + public BigInteger(ulong value) { throw null;} + public bool IsEven { get { throw null; } } + public bool IsOne { get { throw null; } } + public bool IsPowerOfTwo { get { throw null; } } + public bool IsZero { get { throw null; } } + public static System.Numerics.BigInteger MinusOne { get { throw null; } } + public static System.Numerics.BigInteger One { get { throw null; } } + public int Sign { get { throw null; } } + public static System.Numerics.BigInteger Zero { get { throw null; } } + public static System.Numerics.BigInteger Abs(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Add(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static int Compare(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public int CompareTo(long other) { throw null; } + public int CompareTo(System.Numerics.BigInteger other) { throw null; } + public int CompareTo(object obj) { throw null; } + [System.CLSCompliantAttribute(false)] + public int CompareTo(ulong other) { throw null; } + public static System.Numerics.BigInteger Divide(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger DivRem(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor, out System.Numerics.BigInteger remainder) { remainder = default(System.Numerics.BigInteger); throw null; } + public bool Equals(long other) { throw null; } + public bool Equals(System.Numerics.BigInteger other) { throw null; } + public override bool Equals(object obj) { throw null; } + [System.CLSCompliantAttribute(false)] + public bool Equals(ulong other) { throw null; } + public int GetByteCount() { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static double Log(System.Numerics.BigInteger value) { throw null; } + public static double Log(System.Numerics.BigInteger value, double baseValue) { throw null; } + public static double Log10(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Max(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger Min(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger ModPow(System.Numerics.BigInteger value, System.Numerics.BigInteger exponent, System.Numerics.BigInteger modulus) { throw null; } + public static System.Numerics.BigInteger Multiply(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger Negate(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator &(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator |(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator --(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator /(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static bool operator ==(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator ==(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator ==(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator ==(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator ==(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator ^(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static explicit operator System.Numerics.BigInteger (decimal value) { throw null; } + public static explicit operator System.Numerics.BigInteger (double value) { throw null; } + public static explicit operator byte (System.Numerics.BigInteger value) { throw null; } + public static explicit operator decimal (System.Numerics.BigInteger value) { throw null; } + public static explicit operator double (System.Numerics.BigInteger value) { throw null; } + public static explicit operator short (System.Numerics.BigInteger value) { throw null; } + public static explicit operator int (System.Numerics.BigInteger value) { throw null; } + public static explicit operator long (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator sbyte (System.Numerics.BigInteger value) { throw null; } + public static explicit operator float (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ushort (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Numerics.BigInteger value) { throw null; } + public static explicit operator System.Numerics.BigInteger (float value) { throw null; } + public static bool operator >(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator >(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >(ulong left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator >=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static implicit operator System.Numerics.BigInteger (byte value) { throw null; } + public static implicit operator System.Numerics.BigInteger (short value) { throw null; } + public static implicit operator System.Numerics.BigInteger (int value) { throw null; } + public static implicit operator System.Numerics.BigInteger (long value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (sbyte value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (ulong value) { throw null; } + public static System.Numerics.BigInteger operator ++(System.Numerics.BigInteger value) { throw null; } + public static bool operator !=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator !=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator !=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator !=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator !=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator <<(System.Numerics.BigInteger value, int shift) { throw null; } + public static bool operator <(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator <(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <(ulong left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator <=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator %(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger operator *(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator ~(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator >>(System.Numerics.BigInteger value, int shift) { throw null; } + public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Parse(System.ReadOnlySpan value, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { throw null; } + public static System.Numerics.BigInteger Parse(string value) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Pow(System.Numerics.BigInteger value, int exponent) { throw null; } + public static System.Numerics.BigInteger Remainder(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger Subtract(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public byte[] ToByteArray() { throw null; } + public override string ToString() { throw null; } + public string ToString(System.IFormatProvider provider) { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider provider) { throw null; } + public static bool TryParse(System.ReadOnlySpan value, out System.Numerics.BigInteger result, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { result = default(System.Numerics.BigInteger); throw null; } + public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public static bool TryParse(string value, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public bool TryWriteBytes(System.Span destination, out int bytesWritten) { bytesWritten = default(int); throw null; } + } + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Complex : System.IEquatable, System.IFormattable + { + public static readonly System.Numerics.Complex ImaginaryOne; + public static readonly System.Numerics.Complex One; + public static readonly System.Numerics.Complex Zero; + public Complex(double real, double imaginary) { throw null;} + public double Imaginary { get { throw null; } } + public double Magnitude { get { throw null; } } + public double Phase { get { throw null; } } + public double Real { get { throw null; } } + public static double Abs(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Acos(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Add(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Asin(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Atan(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Conjugate(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Cos(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Cosh(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Divide(System.Numerics.Complex dividend, System.Numerics.Complex divisor) { throw null; } + public bool Equals(System.Numerics.Complex value) { throw null; } + public override bool Equals(object obj) { throw null; } + public static System.Numerics.Complex Exp(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex FromPolarCoordinates(double magnitude, double phase) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.Complex Log(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Log(System.Numerics.Complex value, double baseValue) { throw null; } + public static System.Numerics.Complex Log10(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Multiply(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Negate(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex operator +(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator /(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static bool operator ==(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static explicit operator System.Numerics.Complex (decimal value) { throw null; } + public static explicit operator System.Numerics.Complex (System.Numerics.BigInteger value) { throw null; } + public static implicit operator System.Numerics.Complex (byte value) { throw null; } + public static implicit operator System.Numerics.Complex (double value) { throw null; } + public static implicit operator System.Numerics.Complex (short value) { throw null; } + public static implicit operator System.Numerics.Complex (int value) { throw null; } + public static implicit operator System.Numerics.Complex (long value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (sbyte value) { throw null; } + public static implicit operator System.Numerics.Complex (float value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (ulong value) { throw null; } + public static bool operator !=(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator *(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator -(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator -(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Pow(System.Numerics.Complex value, double power) { throw null; } + public static System.Numerics.Complex Pow(System.Numerics.Complex value, System.Numerics.Complex power) { throw null; } + public static System.Numerics.Complex Reciprocal(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sin(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sinh(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sqrt(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Subtract(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Tan(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Tanh(System.Numerics.Complex value) { throw null; } + public override string ToString() { throw null; } + public string ToString(System.IFormatProvider provider) { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider provider) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Matrix3x2 : System.IEquatable + { + public float M11; + public float M12; + public float M21; + public float M22; + public float M31; + public float M32; + public Matrix3x2(float m11, float m12, float m21, float m22, float m31, float m32) { throw null;} + public static System.Numerics.Matrix3x2 Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public System.Numerics.Vector2 Translation { get { throw null; } set { } } + public static System.Numerics.Matrix3x2 Add(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 CreateRotation(float radians) { throw null; } + public static System.Numerics.Matrix3x2 CreateRotation(float radians, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(System.Numerics.Vector2 scales) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(System.Numerics.Vector2 scales, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float scale) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float scale, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float xScale, float yScale) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float xScale, float yScale, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateSkew(float radiansX, float radiansY) { throw null; } + public static System.Numerics.Matrix3x2 CreateSkew(float radiansX, float radiansY, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateTranslation(System.Numerics.Vector2 position) { throw null; } + public static System.Numerics.Matrix3x2 CreateTranslation(float xPosition, float yPosition) { throw null; } + public bool Equals(System.Numerics.Matrix3x2 other) { throw null; } + public override bool Equals(object obj) { throw null; } + public float GetDeterminant() { throw null; } + public override int GetHashCode() { throw null; } + public static bool Invert(System.Numerics.Matrix3x2 matrix, out System.Numerics.Matrix3x2 result) { result = default(System.Numerics.Matrix3x2); throw null; } + public static System.Numerics.Matrix3x2 Lerp(System.Numerics.Matrix3x2 matrix1, System.Numerics.Matrix3x2 matrix2, float amount) { throw null; } + public static System.Numerics.Matrix3x2 Multiply(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 Multiply(System.Numerics.Matrix3x2 value1, float value2) { throw null; } + public static System.Numerics.Matrix3x2 Negate(System.Numerics.Matrix3x2 value) { throw null; } + public static System.Numerics.Matrix3x2 operator +(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static bool operator ==(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static bool operator !=(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator *(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator *(System.Numerics.Matrix3x2 value1, float value2) { throw null; } + public static System.Numerics.Matrix3x2 operator -(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator -(System.Numerics.Matrix3x2 value) { throw null; } + public static System.Numerics.Matrix3x2 Subtract(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Matrix4x4 : System.IEquatable + { + public float M11; + public float M12; + public float M13; + public float M14; + public float M21; + public float M22; + public float M23; + public float M24; + public float M31; + public float M32; + public float M33; + public float M34; + public float M41; + public float M42; + public float M43; + public float M44; + public Matrix4x4(System.Numerics.Matrix3x2 value) { throw null;} + public Matrix4x4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) { throw null;} + public static System.Numerics.Matrix4x4 Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public System.Numerics.Vector3 Translation { get { throw null; } set { } } + public static System.Numerics.Matrix4x4 Add(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 CreateBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraUpVector, System.Numerics.Vector3 cameraForwardVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateConstrainedBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 rotateAxis, System.Numerics.Vector3 cameraForwardVector, System.Numerics.Vector3 objectForwardVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromQuaternion(System.Numerics.Quaternion quaternion) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; } + public static System.Numerics.Matrix4x4 CreateLookAt(System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraTarget, System.Numerics.Vector3 cameraUpVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane) { throw null; } + public static System.Numerics.Matrix4x4 CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreateReflection(System.Numerics.Plane value) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationX(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationX(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationY(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationY(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationZ(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationZ(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(System.Numerics.Vector3 scales) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(System.Numerics.Vector3 scales, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float scale) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float scale, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float xScale, float yScale, float zScale) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float xScale, float yScale, float zScale, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateShadow(System.Numerics.Vector3 lightDirection, System.Numerics.Plane plane) { throw null; } + public static System.Numerics.Matrix4x4 CreateTranslation(System.Numerics.Vector3 position) { throw null; } + public static System.Numerics.Matrix4x4 CreateTranslation(float xPosition, float yPosition, float zPosition) { throw null; } + public static System.Numerics.Matrix4x4 CreateWorld(System.Numerics.Vector3 position, System.Numerics.Vector3 forward, System.Numerics.Vector3 up) { throw null; } + public static bool Decompose(System.Numerics.Matrix4x4 matrix, out System.Numerics.Vector3 scale, out System.Numerics.Quaternion rotation, out System.Numerics.Vector3 translation) { scale = default(System.Numerics.Vector3); rotation = default(System.Numerics.Quaternion); translation = default(System.Numerics.Vector3); throw null; } + public bool Equals(System.Numerics.Matrix4x4 other) { throw null; } + public override bool Equals(object obj) { throw null; } + public float GetDeterminant() { throw null; } + public override int GetHashCode() { throw null; } + public static bool Invert(System.Numerics.Matrix4x4 matrix, out System.Numerics.Matrix4x4 result) { result = default(System.Numerics.Matrix4x4); throw null; } + public static System.Numerics.Matrix4x4 Lerp(System.Numerics.Matrix4x4 matrix1, System.Numerics.Matrix4x4 matrix2, float amount) { throw null; } + public static System.Numerics.Matrix4x4 Multiply(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 Multiply(System.Numerics.Matrix4x4 value1, float value2) { throw null; } + public static System.Numerics.Matrix4x4 Negate(System.Numerics.Matrix4x4 value) { throw null; } + public static System.Numerics.Matrix4x4 operator +(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static bool operator ==(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static bool operator !=(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator *(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator *(System.Numerics.Matrix4x4 value1, float value2) { throw null; } + public static System.Numerics.Matrix4x4 operator -(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator -(System.Numerics.Matrix4x4 value) { throw null; } + public static System.Numerics.Matrix4x4 Subtract(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public override string ToString() { throw null; } + public static System.Numerics.Matrix4x4 Transform(System.Numerics.Matrix4x4 value, System.Numerics.Quaternion rotation) { throw null; } + public static System.Numerics.Matrix4x4 Transpose(System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Plane : System.IEquatable + { + public float D; + public System.Numerics.Vector3 Normal; + public Plane(System.Numerics.Vector3 normal, float d) { throw null;} + public Plane(System.Numerics.Vector4 value) { throw null;} + public Plane(float x, float y, float z, float d) { throw null;} + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane CreateFromVertices(System.Numerics.Vector3 point1, System.Numerics.Vector3 point2, System.Numerics.Vector3 point3) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Plane plane, System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DotCoordinate(System.Numerics.Plane plane, System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DotNormal(System.Numerics.Plane plane, System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Equals(System.Numerics.Plane other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Normalize(System.Numerics.Plane value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Plane value1, System.Numerics.Plane value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Plane value1, System.Numerics.Plane value2) { throw null; } + public override string ToString() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Transform(System.Numerics.Plane plane, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Transform(System.Numerics.Plane plane, System.Numerics.Quaternion rotation) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Quaternion : System.IEquatable + { + public float W; + public float X; + public float Y; + public float Z; + public Quaternion(System.Numerics.Vector3 vectorPart, float scalarPart) { throw null;} + public Quaternion(float x, float y, float z, float w) { throw null;} + public static System.Numerics.Quaternion Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public static System.Numerics.Quaternion Add(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Concatenate(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Conjugate(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; } + public static System.Numerics.Quaternion CreateFromRotationMatrix(System.Numerics.Matrix4x4 matrix) { throw null; } + public static System.Numerics.Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; } + public static System.Numerics.Quaternion Divide(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static float Dot(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2) { throw null; } + public bool Equals(System.Numerics.Quaternion other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.Quaternion Inverse(System.Numerics.Quaternion value) { throw null; } + public float Length() { throw null; } + public float LengthSquared() { throw null; } + public static System.Numerics.Quaternion Lerp(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2, float amount) { throw null; } + public static System.Numerics.Quaternion Multiply(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Multiply(System.Numerics.Quaternion value1, float value2) { throw null; } + public static System.Numerics.Quaternion Negate(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion Normalize(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion operator +(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator /(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static bool operator ==(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static bool operator !=(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator *(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator *(System.Numerics.Quaternion value1, float value2) { throw null; } + public static System.Numerics.Quaternion operator -(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator -(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion Slerp(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2, float amount) { throw null; } + public static System.Numerics.Quaternion Subtract(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector2 : System.IEquatable, System.IFormattable + { + public float X; + public float Y; + public Vector2(float value) { throw null;} + public Vector2(float x, float y) { throw null;} + public static System.Numerics.Vector2 One { get { throw null; } } + public static System.Numerics.Vector2 UnitX { get { throw null; } } + public static System.Numerics.Vector2 UnitY { get { throw null; } } + public static System.Numerics.Vector2 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Abs(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Add(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Clamp(System.Numerics.Vector2 value1, System.Numerics.Vector2 min, System.Numerics.Vector2 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Divide(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Divide(System.Numerics.Vector2 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + public bool Equals(System.Numerics.Vector2 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Lerp(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Max(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Min(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(System.Numerics.Vector2 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(float left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Negate(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Normalize(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator +(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator /(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator /(System.Numerics.Vector2 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(System.Numerics.Vector2 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(float left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator -(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator -(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Reflect(System.Numerics.Vector2 vector, System.Numerics.Vector2 normal) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 SquareRoot(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Subtract(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix3x2 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 TransformNormal(System.Numerics.Vector2 normal, System.Numerics.Matrix3x2 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 TransformNormal(System.Numerics.Vector2 normal, System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector3 : System.IEquatable, System.IFormattable + { + public float X; + public float Y; + public float Z; + public Vector3(System.Numerics.Vector2 value, float z) { throw null;} + public Vector3(float value) { throw null;} + public Vector3(float x, float y, float z) { throw null;} + public static System.Numerics.Vector3 One { get { throw null; } } + public static System.Numerics.Vector3 UnitX { get { throw null; } } + public static System.Numerics.Vector3 UnitY { get { throw null; } } + public static System.Numerics.Vector3 UnitZ { get { throw null; } } + public static System.Numerics.Vector3 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Abs(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Add(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Clamp(System.Numerics.Vector3 value1, System.Numerics.Vector3 min, System.Numerics.Vector3 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Cross(System.Numerics.Vector3 vector1, System.Numerics.Vector3 vector2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Divide(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Divide(System.Numerics.Vector3 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector3 vector1, System.Numerics.Vector3 vector2) { throw null; } + public bool Equals(System.Numerics.Vector3 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Lerp(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Max(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + public static System.Numerics.Vector3 Min(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(System.Numerics.Vector3 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(float left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Negate(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Normalize(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator +(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator /(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator /(System.Numerics.Vector3 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(System.Numerics.Vector3 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(float left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator -(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator -(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Reflect(System.Numerics.Vector3 vector, System.Numerics.Vector3 normal) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 SquareRoot(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Subtract(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Transform(System.Numerics.Vector3 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Transform(System.Numerics.Vector3 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 TransformNormal(System.Numerics.Vector3 normal, System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector4 : System.IEquatable, System.IFormattable + { + public float W; + public float X; + public float Y; + public float Z; + public Vector4(System.Numerics.Vector2 value, float z, float w) { throw null;} + public Vector4(System.Numerics.Vector3 value, float w) { throw null;} + public Vector4(float value) { throw null;} + public Vector4(float x, float y, float z, float w) { throw null;} + public static System.Numerics.Vector4 One { get { throw null; } } + public static System.Numerics.Vector4 UnitW { get { throw null; } } + public static System.Numerics.Vector4 UnitX { get { throw null; } } + public static System.Numerics.Vector4 UnitY { get { throw null; } } + public static System.Numerics.Vector4 UnitZ { get { throw null; } } + public static System.Numerics.Vector4 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Abs(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Add(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Clamp(System.Numerics.Vector4 value1, System.Numerics.Vector4 min, System.Numerics.Vector4 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Divide(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Divide(System.Numerics.Vector4 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector4 vector1, System.Numerics.Vector4 vector2) { throw null; } + public bool Equals(System.Numerics.Vector4 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Lerp(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Max(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Min(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(System.Numerics.Vector4 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(float left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Negate(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Normalize(System.Numerics.Vector4 vector) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator +(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator /(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator /(System.Numerics.Vector4 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(System.Numerics.Vector4 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(float left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator -(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator -(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 SquareRoot(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Subtract(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector2 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector3 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector3 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector4 vector, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector4 value, System.Numerics.Quaternion rotation) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/monodroid/System.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monodroid/System.cs.REMOVED.git-id new file mode 100644 index 0000000000..871c923544 --- /dev/null +++ b/external/binary-reference-assemblies/src/monodroid/System.cs.REMOVED.git-id @@ -0,0 +1 @@ +6276c46020f5d881970a04b436c4d2f8285baf9c \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monodroid/mscorlib.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monodroid/mscorlib.cs.REMOVED.git-id new file mode 100644 index 0000000000..d0f079c4a3 --- /dev/null +++ b/external/binary-reference-assemblies/src/monodroid/mscorlib.cs.REMOVED.git-id @@ -0,0 +1 @@ +092a609dfec64b92e85d514141cb81884965ca68 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id new file mode 100644 index 0000000000..9ef115c4eb --- /dev/null +++ b/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id @@ -0,0 +1 @@ +7beebcc3cdb0bf41205daab75b21a8a91b5f1c0d \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monotouch/System.Net.Http.cs b/external/binary-reference-assemblies/src/monotouch/System.Net.Http.cs new file mode 100644 index 0000000000..c29201fb67 --- /dev/null +++ b/external/binary-reference-assemblies/src/monotouch/System.Net.Http.cs @@ -0,0 +1,647 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Http.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Http.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Http.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Net.Http.WebRequest, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +namespace System.Net.Http +{ + public partial class ByteArrayContent : System.Net.Http.HttpContent + { + public ByteArrayContent(byte[] content) { } + public ByteArrayContent(byte[] content, int offset, int count) { } + protected override System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public enum ClientCertificateOption + { + Automatic = 1, + Manual = 0, + } + public abstract partial class DelegatingHandler : System.Net.Http.HttpMessageHandler + { + protected DelegatingHandler() { } + protected DelegatingHandler(System.Net.Http.HttpMessageHandler innerHandler) { } + public System.Net.Http.HttpMessageHandler InnerHandler { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class FormUrlEncodedContent : System.Net.Http.ByteArrayContent + { + public FormUrlEncodedContent(System.Collections.Generic.IEnumerable> nameValueCollection) : base (default(byte[])) { } + } + public partial class HttpClient : System.Net.Http.HttpMessageInvoker + { + public HttpClient() : base (default(System.Net.Http.HttpMessageHandler)) { } + public HttpClient(System.Net.Http.HttpMessageHandler handler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public HttpClient(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public System.Uri BaseAddress { get { throw null; } set { } } + public System.Net.Http.Headers.HttpRequestHeaders DefaultRequestHeaders { get { throw null; } } + public long MaxResponseContentBufferSize { get { throw null; } set { } } + public System.TimeSpan Timeout { get { throw null; } set { } } + public void CancelPendingRequests() { } + public System.Threading.Tasks.Task DeleteAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(string requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(System.Uri requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + protected override void Dispose(bool disposing) { } + public System.Threading.Tasks.Task GetAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetByteArrayAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetByteArrayAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetStreamAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetStreamAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetStringAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetStringAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task PostAsync(string requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PostAsync(string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PostAsync(System.Uri requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PostAsync(System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PutAsync(string requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PutAsync(string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PutAsync(System.Uri requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PutAsync(System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class HttpClientHandler : System.Net.Http.HttpMessageHandler + { + public HttpClientHandler() { } + public bool AllowAutoRedirect { get { throw null; } set { } } + public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } } + public bool CheckCertificateRevocationList { get { throw null; } set { } } + public System.Net.Http.ClientCertificateOption ClientCertificateOptions { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } } + public System.Net.CookieContainer CookieContainer { get { throw null; } set { } } + public System.Net.ICredentials Credentials { get { throw null; } set { } } + public System.Net.ICredentials DefaultProxyCredentials { get { throw null; } set { } } + public int MaxAutomaticRedirections { get { throw null; } set { } } + public int MaxConnectionsPerServer { get { throw null; } set { } } + public long MaxRequestContentBufferSize { get { throw null; } set { } } + public int MaxResponseHeadersLength { get { throw null; } set { } } + public bool PreAuthenticate { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Properties { get { throw null; } } + public System.Net.IWebProxy Proxy { get { throw null; } set { } } + public System.Func ServerCertificateCustomValidationCallback { get { throw null; } set { } } + public System.Security.Authentication.SslProtocols SslProtocols { get { throw null; } set { } } + public virtual bool SupportsAutomaticDecompression { get { throw null; } } + public virtual bool SupportsProxy { get { throw null; } } + public virtual bool SupportsRedirectConfiguration { get { throw null; } } + public bool UseCookies { get { throw null; } set { } } + public bool UseDefaultCredentials { get { throw null; } set { } } + public bool UseProxy { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public enum HttpCompletionOption + { + ResponseContentRead = 0, + ResponseHeadersRead = 1, + } + public abstract partial class HttpContent : System.IDisposable + { + protected HttpContent() { } + public System.Net.Http.Headers.HttpContentHeaders Headers { get { throw null; } } + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream stream) { throw null; } + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected virtual System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.Threading.Tasks.Task LoadIntoBufferAsync() { throw null; } + public System.Threading.Tasks.Task LoadIntoBufferAsync(long maxBufferSize) { throw null; } + public System.Threading.Tasks.Task ReadAsByteArrayAsync() { throw null; } + public System.Threading.Tasks.Task ReadAsStreamAsync() { throw null; } + public System.Threading.Tasks.Task ReadAsStringAsync() { throw null; } + protected internal abstract System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context); + protected internal abstract bool TryComputeLength(out long length); + } + public abstract partial class HttpMessageHandler : System.IDisposable + { + protected HttpMessageHandler() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected internal abstract System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); + } + public partial class HttpMessageInvoker : System.IDisposable + { + public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler) { } + public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public virtual System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class HttpMethod : System.IEquatable + { + public HttpMethod(string method) { } + public static System.Net.Http.HttpMethod Delete { get { throw null; } } + public static System.Net.Http.HttpMethod Get { get { throw null; } } + public static System.Net.Http.HttpMethod Head { get { throw null; } } + public string Method { get { throw null; } } + public static System.Net.Http.HttpMethod Options { get { throw null; } } + public static System.Net.Http.HttpMethod Post { get { throw null; } } + public static System.Net.Http.HttpMethod Put { get { throw null; } } + public static System.Net.Http.HttpMethod Trace { get { throw null; } } + public bool Equals(System.Net.Http.HttpMethod other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Net.Http.HttpMethod left, System.Net.Http.HttpMethod right) { throw null; } + public static bool operator !=(System.Net.Http.HttpMethod left, System.Net.Http.HttpMethod right) { throw null; } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class HttpRequestException : System.Exception + { + public HttpRequestException() { } + public HttpRequestException(string message) { } + public HttpRequestException(string message, System.Exception inner) { } + } + public partial class HttpRequestMessage : System.IDisposable + { + public HttpRequestMessage() { } + public HttpRequestMessage(System.Net.Http.HttpMethod method, string requestUri) { } + public HttpRequestMessage(System.Net.Http.HttpMethod method, System.Uri requestUri) { } + public System.Net.Http.HttpContent Content { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Net.Http.Headers.HttpRequestHeaders Headers { get { throw null; } } + public System.Net.Http.HttpMethod Method { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Properties { get { throw null; } } + public System.Uri RequestUri { get { throw null; } set { } } + public System.Version Version { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public override string ToString() { throw null; } + } + public partial class HttpResponseMessage : System.IDisposable + { + public HttpResponseMessage() { } + public HttpResponseMessage(System.Net.HttpStatusCode statusCode) { } + public System.Net.Http.HttpContent Content { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Net.Http.Headers.HttpResponseHeaders Headers { get { throw null; } } + public bool IsSuccessStatusCode { get { throw null; } } + public string ReasonPhrase { get { throw null; } set { } } + public System.Net.Http.HttpRequestMessage RequestMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Net.HttpStatusCode StatusCode { get { throw null; } set { } } + public System.Version Version { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.Net.Http.HttpResponseMessage EnsureSuccessStatusCode() { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class MessageProcessingHandler : System.Net.Http.DelegatingHandler + { + protected MessageProcessingHandler() { } + protected MessageProcessingHandler(System.Net.Http.HttpMessageHandler innerHandler) { } + protected abstract System.Net.Http.HttpRequestMessage ProcessRequest(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); + protected abstract System.Net.Http.HttpResponseMessage ProcessResponse(System.Net.Http.HttpResponseMessage response, System.Threading.CancellationToken cancellationToken); + protected internal sealed override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class MultipartContent : System.Net.Http.HttpContent, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public MultipartContent() { } + public MultipartContent(string subtype) { } + public MultipartContent(string subtype, string boundary) { } + public virtual void Add(System.Net.Http.HttpContent content) { } + protected override void Dispose(bool disposing) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public partial class MultipartFormDataContent : System.Net.Http.MultipartContent + { + public MultipartFormDataContent() { } + public MultipartFormDataContent(string boundary) { } + public override void Add(System.Net.Http.HttpContent content) { } + public void Add(System.Net.Http.HttpContent content, string name) { } + public void Add(System.Net.Http.HttpContent content, string name, string fileName) { } + } + public partial class StreamContent : System.Net.Http.HttpContent + { + public StreamContent(System.IO.Stream content) { } + public StreamContent(System.IO.Stream content, int bufferSize) { } + protected override System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public partial class StringContent : System.Net.Http.ByteArrayContent + { + public StringContent(string content) : base (default(byte[])) { } + public StringContent(string content, System.Text.Encoding encoding) : base (default(byte[])) { } + public StringContent(string content, System.Text.Encoding encoding, string mediaType) : base (default(byte[])) { } + } +} +namespace System.Net.Http.Headers +{ + public partial class AuthenticationHeaderValue : System.ICloneable + { + public AuthenticationHeaderValue(string scheme) { } + public AuthenticationHeaderValue(string scheme, string parameter) { } + public string Parameter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.AuthenticationHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.AuthenticationHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.AuthenticationHeaderValue); throw null; } + } + public partial class CacheControlHeaderValue : System.ICloneable + { + public CacheControlHeaderValue() { } + public System.Collections.Generic.ICollection Extensions { get { throw null; } } + public System.Nullable MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool MaxStale { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable MaxStaleLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable MinFresh { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool MustRevalidate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool NoCache { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.ICollection NoCacheHeaders { get { throw null; } } + public bool NoStore { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool NoTransform { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool OnlyIfCached { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool Private { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.ICollection PrivateHeaders { get { throw null; } } + public bool ProxyRevalidate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool Public { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable SharedMaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.CacheControlHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.CacheControlHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.CacheControlHeaderValue); throw null; } + } + public partial class ContentDispositionHeaderValue : System.ICloneable + { + protected ContentDispositionHeaderValue(System.Net.Http.Headers.ContentDispositionHeaderValue source) { } + public ContentDispositionHeaderValue(string dispositionType) { } + public System.Nullable CreationDate { get { throw null; } set { } } + public string DispositionType { get { throw null; } set { } } + public string FileName { get { throw null; } set { } } + public string FileNameStar { get { throw null; } set { } } + public System.Nullable ModificationDate { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public System.Nullable ReadDate { get { throw null; } set { } } + public System.Nullable Size { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ContentDispositionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ContentDispositionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ContentDispositionHeaderValue); throw null; } + } + public partial class ContentRangeHeaderValue : System.ICloneable + { + public ContentRangeHeaderValue(long length) { } + public ContentRangeHeaderValue(long from, long to) { } + public ContentRangeHeaderValue(long from, long to, long length) { } + public System.Nullable From { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool HasLength { get { throw null; } } + public bool HasRange { get { throw null; } } + public System.Nullable Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable To { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Unit { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ContentRangeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ContentRangeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ContentRangeHeaderValue); throw null; } + } + public partial class EntityTagHeaderValue : System.ICloneable + { + public EntityTagHeaderValue(string tag) { } + public EntityTagHeaderValue(string tag, bool isWeak) { } + public static System.Net.Http.Headers.EntityTagHeaderValue Any { get { throw null; } } + public bool IsWeak { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Tag { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.EntityTagHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.EntityTagHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.EntityTagHeaderValue); throw null; } + } + public sealed partial class HttpContentHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpContentHeaders() { } + public System.Collections.Generic.ICollection Allow { get { throw null; } } + public System.Net.Http.Headers.ContentDispositionHeaderValue ContentDisposition { get { throw null; } set { } } + public System.Collections.Generic.ICollection ContentEncoding { get { throw null; } } + public System.Collections.Generic.ICollection ContentLanguage { get { throw null; } } + public System.Nullable ContentLength { get { throw null; } set { } } + public System.Uri ContentLocation { get { throw null; } set { } } + public byte[] ContentMD5 { get { throw null; } set { } } + public System.Net.Http.Headers.ContentRangeHeaderValue ContentRange { get { throw null; } set { } } + public System.Net.Http.Headers.MediaTypeHeaderValue ContentType { get { throw null; } set { } } + public System.Nullable Expires { get { throw null; } set { } } + public System.Nullable LastModified { get { throw null; } set { } } + } + public abstract partial class HttpHeaders : System.Collections.Generic.IEnumerable>>, System.Collections.IEnumerable + { + protected HttpHeaders() { } + public void Add(string name, System.Collections.Generic.IEnumerable values) { } + public void Add(string name, string value) { } + public void Clear() { } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator>> GetEnumerator() { throw null; } + public System.Collections.Generic.IEnumerable GetValues(string name) { throw null; } + public bool Remove(string name) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + public bool TryAddWithoutValidation(string name, System.Collections.Generic.IEnumerable values) { throw null; } + public bool TryAddWithoutValidation(string name, string value) { throw null; } + public bool TryGetValues(string name, out System.Collections.Generic.IEnumerable values) { values = default(System.Collections.Generic.IEnumerable); throw null; } + } + public sealed partial class HttpHeaderValueCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : class + { + internal HttpHeaderValueCollection() { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public void Add(T item) { } + public void Clear() { } + public bool Contains(T item) { throw null; } + public void CopyTo(T[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public void ParseAdd(string input) { } + public bool Remove(T item) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + public bool TryParseAdd(string input) { throw null; } + } + public sealed partial class HttpRequestHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpRequestHeaders() { } + public System.Net.Http.Headers.HttpHeaderValueCollection Accept { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptCharset { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptEncoding { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptLanguage { get { throw null; } } + public System.Net.Http.Headers.AuthenticationHeaderValue Authorization { get { throw null; } set { } } + public System.Net.Http.Headers.CacheControlHeaderValue CacheControl { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Connection { get { throw null; } } + public System.Nullable ConnectionClose { get { throw null; } set { } } + public System.Nullable Date { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Expect { get { throw null; } } + public System.Nullable ExpectContinue { get { throw null; } set { } } + public string From { get { throw null; } set { } } + public string Host { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection IfMatch { get { throw null; } } + public System.Nullable IfModifiedSince { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection IfNoneMatch { get { throw null; } } + public System.Net.Http.Headers.RangeConditionHeaderValue IfRange { get { throw null; } set { } } + public System.Nullable IfUnmodifiedSince { get { throw null; } set { } } + public System.Nullable MaxForwards { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Pragma { get { throw null; } } + public System.Net.Http.Headers.AuthenticationHeaderValue ProxyAuthorization { get { throw null; } set { } } + public System.Net.Http.Headers.RangeHeaderValue Range { get { throw null; } set { } } + public System.Uri Referrer { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection TE { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Trailer { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection TransferEncoding { get { throw null; } } + public System.Nullable TransferEncodingChunked { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Upgrade { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection UserAgent { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Via { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Warning { get { throw null; } } + } + public sealed partial class HttpResponseHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpResponseHeaders() { } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptRanges { get { throw null; } } + public System.Nullable Age { get { throw null; } set { } } + public System.Net.Http.Headers.CacheControlHeaderValue CacheControl { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Connection { get { throw null; } } + public System.Nullable ConnectionClose { get { throw null; } set { } } + public System.Nullable Date { get { throw null; } set { } } + public System.Net.Http.Headers.EntityTagHeaderValue ETag { get { throw null; } set { } } + public System.Uri Location { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Pragma { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection ProxyAuthenticate { get { throw null; } } + public System.Net.Http.Headers.RetryConditionHeaderValue RetryAfter { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Server { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Trailer { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection TransferEncoding { get { throw null; } } + public System.Nullable TransferEncodingChunked { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Upgrade { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Vary { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Via { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Warning { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection WwwAuthenticate { get { throw null; } } + } + public partial class MediaTypeHeaderValue : System.ICloneable + { + protected MediaTypeHeaderValue(System.Net.Http.Headers.MediaTypeHeaderValue source) { } + public MediaTypeHeaderValue(string mediaType) { } + public string CharSet { get { throw null; } set { } } + public string MediaType { get { throw null; } set { } } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.MediaTypeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.MediaTypeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.MediaTypeHeaderValue); throw null; } + } + public sealed partial class MediaTypeWithQualityHeaderValue : System.Net.Http.Headers.MediaTypeHeaderValue + { + public MediaTypeWithQualityHeaderValue(string mediaType) : base (default(string)) { } + public MediaTypeWithQualityHeaderValue(string mediaType, double quality) : base (default(string)) { } + public System.Nullable Quality { get { throw null; } set { } } + public static new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue Parse(string input) { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.MediaTypeWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue); throw null; } + } + public partial class NameValueHeaderValue : System.ICloneable + { + protected internal NameValueHeaderValue(System.Net.Http.Headers.NameValueHeaderValue source) { } + public NameValueHeaderValue(string name) { } + public NameValueHeaderValue(string name, string value) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Value { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.NameValueHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.NameValueHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.NameValueHeaderValue); throw null; } + } + public partial class NameValueWithParametersHeaderValue : System.Net.Http.Headers.NameValueHeaderValue, System.ICloneable + { + protected NameValueWithParametersHeaderValue(System.Net.Http.Headers.NameValueWithParametersHeaderValue source) : base (default(string)) { } + public NameValueWithParametersHeaderValue(string name) : base (default(string)) { } + public NameValueWithParametersHeaderValue(string name, string value) : base (default(string)) { } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static new System.Net.Http.Headers.NameValueWithParametersHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.NameValueWithParametersHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.NameValueWithParametersHeaderValue); throw null; } + } + public partial class ProductHeaderValue : System.ICloneable + { + public ProductHeaderValue(string name) { } + public ProductHeaderValue(string name, string version) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ProductHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ProductHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ProductHeaderValue); throw null; } + } + public partial class ProductInfoHeaderValue : System.ICloneable + { + public ProductInfoHeaderValue(System.Net.Http.Headers.ProductHeaderValue product) { } + public ProductInfoHeaderValue(string comment) { } + public ProductInfoHeaderValue(string productName, string productVersion) { } + public string Comment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Net.Http.Headers.ProductHeaderValue Product { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ProductInfoHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ProductInfoHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ProductInfoHeaderValue); throw null; } + } + public partial class RangeConditionHeaderValue : System.ICloneable + { + public RangeConditionHeaderValue(System.DateTimeOffset date) { } + public RangeConditionHeaderValue(System.Net.Http.Headers.EntityTagHeaderValue entityTag) { } + public RangeConditionHeaderValue(string entityTag) { } + public System.Nullable Date { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Net.Http.Headers.EntityTagHeaderValue EntityTag { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RangeConditionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RangeConditionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RangeConditionHeaderValue); throw null; } + } + public partial class RangeHeaderValue : System.ICloneable + { + public RangeHeaderValue() { } + public RangeHeaderValue(System.Nullable from, System.Nullable to) { } + public System.Collections.Generic.ICollection Ranges { get { throw null; } } + public string Unit { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RangeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RangeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RangeHeaderValue); throw null; } + } + public partial class RangeItemHeaderValue : System.ICloneable + { + public RangeItemHeaderValue(System.Nullable from, System.Nullable to) { } + public System.Nullable From { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable To { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + } + public partial class RetryConditionHeaderValue : System.ICloneable + { + public RetryConditionHeaderValue(System.DateTimeOffset date) { } + public RetryConditionHeaderValue(System.TimeSpan delta) { } + public System.Nullable Date { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable Delta { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RetryConditionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RetryConditionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RetryConditionHeaderValue); throw null; } + } + public partial class StringWithQualityHeaderValue : System.ICloneable + { + public StringWithQualityHeaderValue(string value) { } + public StringWithQualityHeaderValue(string value, double quality) { } + public System.Nullable Quality { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.StringWithQualityHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.StringWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.StringWithQualityHeaderValue); throw null; } + } + public partial class TransferCodingHeaderValue : System.ICloneable + { + protected TransferCodingHeaderValue(System.Net.Http.Headers.TransferCodingHeaderValue source) { } + public TransferCodingHeaderValue(string value) { } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public string Value { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.TransferCodingHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.TransferCodingHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.TransferCodingHeaderValue); throw null; } + } + public sealed partial class TransferCodingWithQualityHeaderValue : System.Net.Http.Headers.TransferCodingHeaderValue + { + public TransferCodingWithQualityHeaderValue(string value) : base (default(string)) { } + public TransferCodingWithQualityHeaderValue(string value, double quality) : base (default(string)) { } + public System.Nullable Quality { get { throw null; } set { } } + public static new System.Net.Http.Headers.TransferCodingWithQualityHeaderValue Parse(string input) { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.TransferCodingWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.TransferCodingWithQualityHeaderValue); throw null; } + } + public partial class ViaHeaderValue : System.ICloneable + { + public ViaHeaderValue(string protocolVersion, string receivedBy) { } + public ViaHeaderValue(string protocolVersion, string receivedBy, string protocolName) { } + public ViaHeaderValue(string protocolVersion, string receivedBy, string protocolName, string comment) { } + public string Comment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ProtocolName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ProtocolVersion { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ReceivedBy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ViaHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ViaHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ViaHeaderValue); throw null; } + } + public partial class WarningHeaderValue : System.ICloneable + { + public WarningHeaderValue(int code, string agent, string text) { } + public WarningHeaderValue(int code, string agent, string text, System.DateTimeOffset date) { } + public string Agent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int Code { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Nullable Date { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.WarningHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.WarningHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.WarningHeaderValue); throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/monotouch/System.Numerics.cs b/external/binary-reference-assemblies/src/monotouch/System.Numerics.cs new file mode 100644 index 0000000000..9a5c30d4fd --- /dev/null +++ b/external/binary-reference-assemblies/src/monotouch/System.Numerics.cs @@ -0,0 +1,608 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("2.0.5.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Numerics.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Numerics.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.50524.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Numerics.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("2.0.5.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Numerics +{ + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct BigInteger : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable + { + [System.CLSCompliantAttribute(false)] + public BigInteger(byte[] value) { throw null;} + public BigInteger(decimal value) { throw null;} + public BigInteger(double value) { throw null;} + public BigInteger(int value) { throw null;} + public BigInteger(long value) { throw null;} + public BigInteger(System.ReadOnlySpan value) { throw null;} + public BigInteger(float value) { throw null;} + [System.CLSCompliantAttribute(false)] + public BigInteger(uint value) { throw null;} + [System.CLSCompliantAttribute(false)] + public BigInteger(ulong value) { throw null;} + public bool IsEven { get { throw null; } } + public bool IsOne { get { throw null; } } + public bool IsPowerOfTwo { get { throw null; } } + public bool IsZero { get { throw null; } } + public static System.Numerics.BigInteger MinusOne { get { throw null; } } + public static System.Numerics.BigInteger One { get { throw null; } } + public int Sign { get { throw null; } } + public static System.Numerics.BigInteger Zero { get { throw null; } } + public static System.Numerics.BigInteger Abs(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Add(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static int Compare(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public int CompareTo(long other) { throw null; } + public int CompareTo(System.Numerics.BigInteger other) { throw null; } + public int CompareTo(object obj) { throw null; } + [System.CLSCompliantAttribute(false)] + public int CompareTo(ulong other) { throw null; } + public static System.Numerics.BigInteger Divide(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger DivRem(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor, out System.Numerics.BigInteger remainder) { remainder = default(System.Numerics.BigInteger); throw null; } + public bool Equals(long other) { throw null; } + public bool Equals(System.Numerics.BigInteger other) { throw null; } + public override bool Equals(object obj) { throw null; } + [System.CLSCompliantAttribute(false)] + public bool Equals(ulong other) { throw null; } + public int GetByteCount() { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static double Log(System.Numerics.BigInteger value) { throw null; } + public static double Log(System.Numerics.BigInteger value, double baseValue) { throw null; } + public static double Log10(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Max(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger Min(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger ModPow(System.Numerics.BigInteger value, System.Numerics.BigInteger exponent, System.Numerics.BigInteger modulus) { throw null; } + public static System.Numerics.BigInteger Multiply(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger Negate(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator &(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator |(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator --(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator /(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static bool operator ==(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator ==(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator ==(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator ==(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator ==(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator ^(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static explicit operator System.Numerics.BigInteger (decimal value) { throw null; } + public static explicit operator System.Numerics.BigInteger (double value) { throw null; } + public static explicit operator byte (System.Numerics.BigInteger value) { throw null; } + public static explicit operator decimal (System.Numerics.BigInteger value) { throw null; } + public static explicit operator double (System.Numerics.BigInteger value) { throw null; } + public static explicit operator short (System.Numerics.BigInteger value) { throw null; } + public static explicit operator int (System.Numerics.BigInteger value) { throw null; } + public static explicit operator long (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator sbyte (System.Numerics.BigInteger value) { throw null; } + public static explicit operator float (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ushort (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Numerics.BigInteger value) { throw null; } + public static explicit operator System.Numerics.BigInteger (float value) { throw null; } + public static bool operator >(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator >(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >(ulong left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator >=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static implicit operator System.Numerics.BigInteger (byte value) { throw null; } + public static implicit operator System.Numerics.BigInteger (short value) { throw null; } + public static implicit operator System.Numerics.BigInteger (int value) { throw null; } + public static implicit operator System.Numerics.BigInteger (long value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (sbyte value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (ulong value) { throw null; } + public static System.Numerics.BigInteger operator ++(System.Numerics.BigInteger value) { throw null; } + public static bool operator !=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator !=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator !=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator !=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator !=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator <<(System.Numerics.BigInteger value, int shift) { throw null; } + public static bool operator <(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator <(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <(ulong left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator <=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator %(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger operator *(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator ~(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator >>(System.Numerics.BigInteger value, int shift) { throw null; } + public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Parse(System.ReadOnlySpan value, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { throw null; } + public static System.Numerics.BigInteger Parse(string value) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Pow(System.Numerics.BigInteger value, int exponent) { throw null; } + public static System.Numerics.BigInteger Remainder(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger Subtract(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public byte[] ToByteArray() { throw null; } + public override string ToString() { throw null; } + public string ToString(System.IFormatProvider provider) { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider provider) { throw null; } + public static bool TryParse(System.ReadOnlySpan value, out System.Numerics.BigInteger result, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { result = default(System.Numerics.BigInteger); throw null; } + public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public static bool TryParse(string value, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public bool TryWriteBytes(System.Span destination, out int bytesWritten) { bytesWritten = default(int); throw null; } + } + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Complex : System.IEquatable, System.IFormattable + { + public static readonly System.Numerics.Complex ImaginaryOne; + public static readonly System.Numerics.Complex One; + public static readonly System.Numerics.Complex Zero; + public Complex(double real, double imaginary) { throw null;} + public double Imaginary { get { throw null; } } + public double Magnitude { get { throw null; } } + public double Phase { get { throw null; } } + public double Real { get { throw null; } } + public static double Abs(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Acos(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Add(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Asin(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Atan(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Conjugate(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Cos(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Cosh(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Divide(System.Numerics.Complex dividend, System.Numerics.Complex divisor) { throw null; } + public bool Equals(System.Numerics.Complex value) { throw null; } + public override bool Equals(object obj) { throw null; } + public static System.Numerics.Complex Exp(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex FromPolarCoordinates(double magnitude, double phase) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.Complex Log(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Log(System.Numerics.Complex value, double baseValue) { throw null; } + public static System.Numerics.Complex Log10(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Multiply(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Negate(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex operator +(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator /(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static bool operator ==(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static explicit operator System.Numerics.Complex (decimal value) { throw null; } + public static explicit operator System.Numerics.Complex (System.Numerics.BigInteger value) { throw null; } + public static implicit operator System.Numerics.Complex (byte value) { throw null; } + public static implicit operator System.Numerics.Complex (double value) { throw null; } + public static implicit operator System.Numerics.Complex (short value) { throw null; } + public static implicit operator System.Numerics.Complex (int value) { throw null; } + public static implicit operator System.Numerics.Complex (long value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (sbyte value) { throw null; } + public static implicit operator System.Numerics.Complex (float value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (ulong value) { throw null; } + public static bool operator !=(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator *(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator -(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator -(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Pow(System.Numerics.Complex value, double power) { throw null; } + public static System.Numerics.Complex Pow(System.Numerics.Complex value, System.Numerics.Complex power) { throw null; } + public static System.Numerics.Complex Reciprocal(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sin(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sinh(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sqrt(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Subtract(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Tan(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Tanh(System.Numerics.Complex value) { throw null; } + public override string ToString() { throw null; } + public string ToString(System.IFormatProvider provider) { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider provider) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Matrix3x2 : System.IEquatable + { + public float M11; + public float M12; + public float M21; + public float M22; + public float M31; + public float M32; + public Matrix3x2(float m11, float m12, float m21, float m22, float m31, float m32) { throw null;} + public static System.Numerics.Matrix3x2 Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public System.Numerics.Vector2 Translation { get { throw null; } set { } } + public static System.Numerics.Matrix3x2 Add(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 CreateRotation(float radians) { throw null; } + public static System.Numerics.Matrix3x2 CreateRotation(float radians, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(System.Numerics.Vector2 scales) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(System.Numerics.Vector2 scales, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float scale) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float scale, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float xScale, float yScale) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float xScale, float yScale, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateSkew(float radiansX, float radiansY) { throw null; } + public static System.Numerics.Matrix3x2 CreateSkew(float radiansX, float radiansY, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateTranslation(System.Numerics.Vector2 position) { throw null; } + public static System.Numerics.Matrix3x2 CreateTranslation(float xPosition, float yPosition) { throw null; } + public bool Equals(System.Numerics.Matrix3x2 other) { throw null; } + public override bool Equals(object obj) { throw null; } + public float GetDeterminant() { throw null; } + public override int GetHashCode() { throw null; } + public static bool Invert(System.Numerics.Matrix3x2 matrix, out System.Numerics.Matrix3x2 result) { result = default(System.Numerics.Matrix3x2); throw null; } + public static System.Numerics.Matrix3x2 Lerp(System.Numerics.Matrix3x2 matrix1, System.Numerics.Matrix3x2 matrix2, float amount) { throw null; } + public static System.Numerics.Matrix3x2 Multiply(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 Multiply(System.Numerics.Matrix3x2 value1, float value2) { throw null; } + public static System.Numerics.Matrix3x2 Negate(System.Numerics.Matrix3x2 value) { throw null; } + public static System.Numerics.Matrix3x2 operator +(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static bool operator ==(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static bool operator !=(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator *(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator *(System.Numerics.Matrix3x2 value1, float value2) { throw null; } + public static System.Numerics.Matrix3x2 operator -(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator -(System.Numerics.Matrix3x2 value) { throw null; } + public static System.Numerics.Matrix3x2 Subtract(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Matrix4x4 : System.IEquatable + { + public float M11; + public float M12; + public float M13; + public float M14; + public float M21; + public float M22; + public float M23; + public float M24; + public float M31; + public float M32; + public float M33; + public float M34; + public float M41; + public float M42; + public float M43; + public float M44; + public Matrix4x4(System.Numerics.Matrix3x2 value) { throw null;} + public Matrix4x4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) { throw null;} + public static System.Numerics.Matrix4x4 Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public System.Numerics.Vector3 Translation { get { throw null; } set { } } + public static System.Numerics.Matrix4x4 Add(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 CreateBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraUpVector, System.Numerics.Vector3 cameraForwardVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateConstrainedBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 rotateAxis, System.Numerics.Vector3 cameraForwardVector, System.Numerics.Vector3 objectForwardVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromQuaternion(System.Numerics.Quaternion quaternion) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; } + public static System.Numerics.Matrix4x4 CreateLookAt(System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraTarget, System.Numerics.Vector3 cameraUpVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane) { throw null; } + public static System.Numerics.Matrix4x4 CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreateReflection(System.Numerics.Plane value) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationX(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationX(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationY(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationY(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationZ(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationZ(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(System.Numerics.Vector3 scales) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(System.Numerics.Vector3 scales, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float scale) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float scale, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float xScale, float yScale, float zScale) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float xScale, float yScale, float zScale, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateShadow(System.Numerics.Vector3 lightDirection, System.Numerics.Plane plane) { throw null; } + public static System.Numerics.Matrix4x4 CreateTranslation(System.Numerics.Vector3 position) { throw null; } + public static System.Numerics.Matrix4x4 CreateTranslation(float xPosition, float yPosition, float zPosition) { throw null; } + public static System.Numerics.Matrix4x4 CreateWorld(System.Numerics.Vector3 position, System.Numerics.Vector3 forward, System.Numerics.Vector3 up) { throw null; } + public static bool Decompose(System.Numerics.Matrix4x4 matrix, out System.Numerics.Vector3 scale, out System.Numerics.Quaternion rotation, out System.Numerics.Vector3 translation) { scale = default(System.Numerics.Vector3); rotation = default(System.Numerics.Quaternion); translation = default(System.Numerics.Vector3); throw null; } + public bool Equals(System.Numerics.Matrix4x4 other) { throw null; } + public override bool Equals(object obj) { throw null; } + public float GetDeterminant() { throw null; } + public override int GetHashCode() { throw null; } + public static bool Invert(System.Numerics.Matrix4x4 matrix, out System.Numerics.Matrix4x4 result) { result = default(System.Numerics.Matrix4x4); throw null; } + public static System.Numerics.Matrix4x4 Lerp(System.Numerics.Matrix4x4 matrix1, System.Numerics.Matrix4x4 matrix2, float amount) { throw null; } + public static System.Numerics.Matrix4x4 Multiply(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 Multiply(System.Numerics.Matrix4x4 value1, float value2) { throw null; } + public static System.Numerics.Matrix4x4 Negate(System.Numerics.Matrix4x4 value) { throw null; } + public static System.Numerics.Matrix4x4 operator +(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static bool operator ==(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static bool operator !=(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator *(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator *(System.Numerics.Matrix4x4 value1, float value2) { throw null; } + public static System.Numerics.Matrix4x4 operator -(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator -(System.Numerics.Matrix4x4 value) { throw null; } + public static System.Numerics.Matrix4x4 Subtract(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public override string ToString() { throw null; } + public static System.Numerics.Matrix4x4 Transform(System.Numerics.Matrix4x4 value, System.Numerics.Quaternion rotation) { throw null; } + public static System.Numerics.Matrix4x4 Transpose(System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Plane : System.IEquatable + { + public float D; + public System.Numerics.Vector3 Normal; + public Plane(System.Numerics.Vector3 normal, float d) { throw null;} + public Plane(System.Numerics.Vector4 value) { throw null;} + public Plane(float x, float y, float z, float d) { throw null;} + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane CreateFromVertices(System.Numerics.Vector3 point1, System.Numerics.Vector3 point2, System.Numerics.Vector3 point3) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Plane plane, System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DotCoordinate(System.Numerics.Plane plane, System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DotNormal(System.Numerics.Plane plane, System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Equals(System.Numerics.Plane other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Normalize(System.Numerics.Plane value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Plane value1, System.Numerics.Plane value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Plane value1, System.Numerics.Plane value2) { throw null; } + public override string ToString() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Transform(System.Numerics.Plane plane, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Transform(System.Numerics.Plane plane, System.Numerics.Quaternion rotation) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Quaternion : System.IEquatable + { + public float W; + public float X; + public float Y; + public float Z; + public Quaternion(System.Numerics.Vector3 vectorPart, float scalarPart) { throw null;} + public Quaternion(float x, float y, float z, float w) { throw null;} + public static System.Numerics.Quaternion Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public static System.Numerics.Quaternion Add(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Concatenate(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Conjugate(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; } + public static System.Numerics.Quaternion CreateFromRotationMatrix(System.Numerics.Matrix4x4 matrix) { throw null; } + public static System.Numerics.Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; } + public static System.Numerics.Quaternion Divide(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static float Dot(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2) { throw null; } + public bool Equals(System.Numerics.Quaternion other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.Quaternion Inverse(System.Numerics.Quaternion value) { throw null; } + public float Length() { throw null; } + public float LengthSquared() { throw null; } + public static System.Numerics.Quaternion Lerp(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2, float amount) { throw null; } + public static System.Numerics.Quaternion Multiply(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Multiply(System.Numerics.Quaternion value1, float value2) { throw null; } + public static System.Numerics.Quaternion Negate(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion Normalize(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion operator +(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator /(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static bool operator ==(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static bool operator !=(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator *(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator *(System.Numerics.Quaternion value1, float value2) { throw null; } + public static System.Numerics.Quaternion operator -(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator -(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion Slerp(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2, float amount) { throw null; } + public static System.Numerics.Quaternion Subtract(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector2 : System.IEquatable, System.IFormattable + { + public float X; + public float Y; + public Vector2(float value) { throw null;} + public Vector2(float x, float y) { throw null;} + public static System.Numerics.Vector2 One { get { throw null; } } + public static System.Numerics.Vector2 UnitX { get { throw null; } } + public static System.Numerics.Vector2 UnitY { get { throw null; } } + public static System.Numerics.Vector2 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Abs(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Add(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Clamp(System.Numerics.Vector2 value1, System.Numerics.Vector2 min, System.Numerics.Vector2 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Divide(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Divide(System.Numerics.Vector2 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + public bool Equals(System.Numerics.Vector2 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Lerp(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Max(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Min(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(System.Numerics.Vector2 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(float left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Negate(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Normalize(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator +(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator /(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator /(System.Numerics.Vector2 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(System.Numerics.Vector2 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(float left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator -(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator -(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Reflect(System.Numerics.Vector2 vector, System.Numerics.Vector2 normal) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 SquareRoot(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Subtract(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix3x2 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 TransformNormal(System.Numerics.Vector2 normal, System.Numerics.Matrix3x2 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 TransformNormal(System.Numerics.Vector2 normal, System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector3 : System.IEquatable, System.IFormattable + { + public float X; + public float Y; + public float Z; + public Vector3(System.Numerics.Vector2 value, float z) { throw null;} + public Vector3(float value) { throw null;} + public Vector3(float x, float y, float z) { throw null;} + public static System.Numerics.Vector3 One { get { throw null; } } + public static System.Numerics.Vector3 UnitX { get { throw null; } } + public static System.Numerics.Vector3 UnitY { get { throw null; } } + public static System.Numerics.Vector3 UnitZ { get { throw null; } } + public static System.Numerics.Vector3 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Abs(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Add(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Clamp(System.Numerics.Vector3 value1, System.Numerics.Vector3 min, System.Numerics.Vector3 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Cross(System.Numerics.Vector3 vector1, System.Numerics.Vector3 vector2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Divide(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Divide(System.Numerics.Vector3 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector3 vector1, System.Numerics.Vector3 vector2) { throw null; } + public bool Equals(System.Numerics.Vector3 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Lerp(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Max(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + public static System.Numerics.Vector3 Min(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(System.Numerics.Vector3 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(float left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Negate(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Normalize(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator +(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator /(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator /(System.Numerics.Vector3 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(System.Numerics.Vector3 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(float left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator -(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator -(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Reflect(System.Numerics.Vector3 vector, System.Numerics.Vector3 normal) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 SquareRoot(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Subtract(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Transform(System.Numerics.Vector3 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Transform(System.Numerics.Vector3 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 TransformNormal(System.Numerics.Vector3 normal, System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector4 : System.IEquatable, System.IFormattable + { + public float W; + public float X; + public float Y; + public float Z; + public Vector4(System.Numerics.Vector2 value, float z, float w) { throw null;} + public Vector4(System.Numerics.Vector3 value, float w) { throw null;} + public Vector4(float value) { throw null;} + public Vector4(float x, float y, float z, float w) { throw null;} + public static System.Numerics.Vector4 One { get { throw null; } } + public static System.Numerics.Vector4 UnitW { get { throw null; } } + public static System.Numerics.Vector4 UnitX { get { throw null; } } + public static System.Numerics.Vector4 UnitY { get { throw null; } } + public static System.Numerics.Vector4 UnitZ { get { throw null; } } + public static System.Numerics.Vector4 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Abs(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Add(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Clamp(System.Numerics.Vector4 value1, System.Numerics.Vector4 min, System.Numerics.Vector4 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Divide(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Divide(System.Numerics.Vector4 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector4 vector1, System.Numerics.Vector4 vector2) { throw null; } + public bool Equals(System.Numerics.Vector4 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Lerp(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Max(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Min(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(System.Numerics.Vector4 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(float left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Negate(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Normalize(System.Numerics.Vector4 vector) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator +(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator /(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator /(System.Numerics.Vector4 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(System.Numerics.Vector4 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(float left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator -(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator -(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 SquareRoot(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Subtract(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector2 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector3 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector3 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector4 vector, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector4 value, System.Numerics.Quaternion rotation) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/monotouch/System.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monotouch/System.cs.REMOVED.git-id new file mode 100644 index 0000000000..eadc6ae9bf --- /dev/null +++ b/external/binary-reference-assemblies/src/monotouch/System.cs.REMOVED.git-id @@ -0,0 +1 @@ +782919ed52352fcfea0615489852913a2cfde8fd \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monotouch/mscorlib.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monotouch/mscorlib.cs.REMOVED.git-id new file mode 100644 index 0000000000..7e7abc2b8c --- /dev/null +++ b/external/binary-reference-assemblies/src/monotouch/mscorlib.cs.REMOVED.git-id @@ -0,0 +1 @@ +b1471311af9e81d7ae6ecabb1fb47f52143c5d4e \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v2.0/System.Json.cs b/external/binary-reference-assemblies/src/v2.0/System.Json.cs deleted file mode 100644 index e844939a52..0000000000 --- a/external/binary-reference-assemblies/src/v2.0/System.Json.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.50727.1433")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.0.50727.1433")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("2.0.0.0")] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v2.0/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v2.0/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index cf3b18f098..0000000000 --- a/external/binary-reference-assemblies/src/v2.0/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -ccba711f6bf1ea4610211f52d0a8bf00d997d689 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v2.0/cscompmgd.cs b/external/binary-reference-assemblies/src/v2.0/cscompmgd.cs deleted file mode 100644 index 7872de1ada..0000000000 --- a/external/binary-reference-assemblies/src/v2.0/cscompmgd.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("8.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("8.0.50727.1433")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("8.0.50727.1433")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("8.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.0/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.0/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index 94b4519b69..0000000000 --- a/external/binary-reference-assemblies/src/v4.0/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.0/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.0/System.Json.Microsoft.cs deleted file mode 100644 index c5f7daad8f..0000000000 --- a/external/binary-reference-assemblies/src/v4.0/System.Json.Microsoft.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.1")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - [System.Diagnostics.DebuggerHiddenAttribute] - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - [System.Diagnostics.DebuggerHiddenAttribute] - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.0/System.Json.cs b/external/binary-reference-assemblies/src/v4.0/System.Json.cs deleted file mode 100644 index a17d2376bf..0000000000 --- a/external/binary-reference-assemblies/src/v4.0/System.Json.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.1")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.1")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.0/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.0/cscompmgd.cs deleted file mode 100644 index 8fc7ef3a12..0000000000 --- a/external/binary-reference-assemblies/src/v4.0/cscompmgd.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("10.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("10.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.5.1/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index fcaebd00c0..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.5.1/SMDiagnostics.cs deleted file mode 100644 index a08170f163..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/SMDiagnostics.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Runtime.Serialization, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -[assembly:System.Security.SecurityCriticalAttribute((System.Security.SecurityCriticalScope)(0))] diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Json.Microsoft.cs deleted file mode 100644 index 3b9b1cbe8f..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Json.Microsoft.cs +++ /dev/null @@ -1,245 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Json.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Json.cs deleted file mode 100644 index 8bb42a07f7..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Json.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.1/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index b41dda8efe..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -712477a5e4ee265b8762b60f3181d3c52cfe5332 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Core.cs deleted file mode 100644 index 1c379a70cd..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Core.cs +++ /dev/null @@ -1,476 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Debugger.cs deleted file mode 100644 index 126c47a7af..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Debugger.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Debugger")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public partial class QueryDebugger - { - public QueryDebugger() { } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Experimental.cs deleted file mode 100644 index 79c150e566..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Experimental.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Interfaces.cs deleted file mode 100644 index c56f515cbd..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Interfaces.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Interfaces Library containing essential interfaces.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Interfaces")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] -namespace System.Reactive -{ - public partial interface IEventPatternSource where TEventArgs : System.EventArgs - { - event System.EventHandler OnNext; - } - public partial interface IEventPattern where TEventArgs : System.EventArgs - { - TEventArgs EventArgs { get; } - TSender Sender { get; } - } - public partial interface IEventSource - { - event System.Action OnNext; - } - public partial interface IObserver - { - TResult OnCompleted(); - TResult OnError(System.Exception exception); - TResult OnNext(TValue value); - } -} -namespace System.Reactive.Concurrency -{ - public partial interface IScheduledItem - { - TAbsolute DueTime { get; } - void Invoke(); - } - public partial interface IScheduler - { - System.DateTimeOffset Now { get; } - System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action); - System.IDisposable Schedule(TState state, System.Func action); - System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - } - public partial interface ISchedulerLongRunning - { - System.IDisposable ScheduleLongRunning(TState state, System.Action action); - } - public partial interface ISchedulerPeriodic - { - System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action); - } - public partial interface IStopwatch - { - System.TimeSpan Elapsed { get; } - } - public partial interface IStopwatchProvider - { - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - } -} -namespace System.Reactive.Disposables -{ - public partial interface ICancelable : System.IDisposable - { - bool IsDisposed { get; } - } -} -namespace System.Reactive.Linq -{ - public partial interface IGroupedObservable : System.IObservable - { - TKey Key { get; } - } - public partial interface IQbservable - { - System.Type ElementType { get; } - System.Linq.Expressions.Expression Expression { get; } - System.Reactive.Linq.IQbservableProvider Provider { get; } - } - public partial interface IQbservableProvider - { - System.Reactive.Linq.IQbservable CreateQuery(System.Linq.Expressions.Expression expression); - } - public partial interface IQbservable : System.IObservable, System.Reactive.Linq.IQbservable - { - } -} -namespace System.Reactive.Subjects -{ - public partial interface IConnectableObservable : System.IObservable - { - System.IDisposable Connect(); - } - public partial interface ISubject : System.IObservable, System.IObserver, System.Reactive.Subjects.ISubject - { - } - public partial interface ISubject : System.IObservable, System.IObserver - { - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 0a6ea03467..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -034f97f0bca4197688187c94df3b16608e647fa9 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Observable.Aliases.cs deleted file mode 100644 index fda237cf4d..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Observable.Aliases.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -namespace System.Reactive.Linq -{ - public static partial class QbservableAliases - { - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.IObservable other) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - } -} -namespace System.Reactive.Observable.Aliases -{ - public static partial class QueryLanguage - { - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.IObservable other) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.PlatformServices.cs deleted file mode 100644 index 2c1100ef00..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.PlatformServices.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.PlatformServices")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public sealed partial class EventLoopScheduler : System.Reactive.Concurrency.LocalScheduler, System.IDisposable, System.Reactive.Concurrency.ISchedulerPeriodic - { - public EventLoopScheduler() { } - public EventLoopScheduler(System.Func threadFactory) { } - public void Dispose() { } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class NewThreadScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public NewThreadScheduler() { } - public NewThreadScheduler(System.Func threadFactory) { } - public static System.Reactive.Concurrency.NewThreadScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class TaskPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public TaskPoolScheduler(System.Threading.Tasks.TaskFactory taskFactory) { } - public static System.Reactive.Concurrency.TaskPoolScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class ThreadPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal ThreadPoolScheduler() { } - public static System.Reactive.Concurrency.ThreadPoolScheduler Instance { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class CurrentPlatformEnlightenmentProvider : System.Reactive.PlatformServices.IPlatformEnlightenmentProvider - { - public CurrentPlatformEnlightenmentProvider() { } - public virtual T GetService(object[] args) where T : class { throw null; } - } - public static partial class EnlightenmentProvider - { - public static bool EnsureLoaded() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Providers.cs.REMOVED.git-id deleted file mode 100644 index a562387e36..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Providers.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -16cd508bb59390035b86224679d33d19fa41e79d \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Runtime.Remoting.cs deleted file mode 100644 index 7e1342eca5..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Runtime.Remoting.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Runtime.Remoting")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public static partial class RemotingObservable - { - public static System.IObservable Remotable(this System.IObservable source) { throw null; } - public static System.IObservable Remotable(this System.IObservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Windows.Forms.cs deleted file mode 100644 index d1b8bcfecc..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Windows.Forms.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Forms")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class ControlScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public ControlScheduler(System.Windows.Forms.Control control) { } - public System.Windows.Forms.Control Control { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ControlObservable - { - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Windows.Threading.cs deleted file mode 100644 index 288cd36c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Reactive.Windows.Threading.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Threading")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class DispatcherScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) { } - public static System.Reactive.Concurrency.DispatcherScheduler Current { get { throw null; } } - public System.Windows.Threading.Dispatcher Dispatcher { get { throw null; } } - [System.ObsoleteAttribute("Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.DispatcherScheduler Instance { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class DispatcherObservable - { - public static System.IObservable ObserveOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - public static System.IObservable SubscribeOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Threading.Tasks.Dataflow.cs deleted file mode 100644 index 4545f9224d..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Threading.Tasks.Dataflow.cs +++ /dev/null @@ -1,385 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} -namespace System.Threading.Tasks.Dataflow -{ - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.ActionBlock.DebugView")] - public sealed partial class ActionBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public ActionBlock(System.Action action) { } - public ActionBlock(System.Action action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public ActionBlock(System.Func action) { } - public ActionBlock(System.Func action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public void Complete() { } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Post(TInput item) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchBlock.DebugView")] - public sealed partial class BatchBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BatchBlock(int batchSize) { } - public BatchBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T[] System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public void TriggerBatch() { } - public bool TryReceive(System.Predicate filter, out T[] item) { item = default(T[]); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BroadcastBlock.DebugView")] - public sealed partial class BroadcastBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BroadcastBlock(System.Func cloningFunction) { } - public BroadcastBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BufferBlock.DebugView")] - public sealed partial class BufferBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BufferBlock() { } - public BufferBlock(System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int Count { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - public static partial class DataflowBlock - { - public static System.IObservable AsObservable(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IObserver AsObserver(this System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Dataflow.IPropagatorBlock Encapsulate(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Predicate predicate) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions, System.Predicate predicate) { throw null; } - public static System.Threading.Tasks.Dataflow.ITargetBlock NullTarget() { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool Post(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool TryReceive(this System.Threading.Tasks.Dataflow.IReceivableSourceBlock source, out TOutput item) { item = default(TOutput); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}")] - public partial class DataflowBlockOptions - { - public const int Unbounded = -1; - public DataflowBlockOptions() { } - public int BoundedCapacity { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } } - public int MaxMessagesPerTask { get { throw null; } set { } } - public string NameFormat { get { throw null; } set { } } - public System.Threading.Tasks.TaskScheduler TaskScheduler { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("PropagateCompletion = {PropagateCompletion}, MaxMessages = {MaxMessages}, Append = {Append}")] - public partial class DataflowLinkOptions - { - public DataflowLinkOptions() { } - public bool Append { get { throw null; } set { } } - public int MaxMessages { get { throw null; } set { } } - public bool PropagateCompletion { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}")] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct DataflowMessageHeader : System.IEquatable - { - public DataflowMessageHeader(long id) { throw null;} - public long Id { get { throw null; } } - public bool IsValid { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Threading.Tasks.Dataflow.DataflowMessageHeader other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - public static bool operator !=(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - } - public enum DataflowMessageStatus - { - Accepted = 0, - Declined = 1, - DecliningPermanently = 4, - NotAvailable = 3, - Postponed = 2, - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, MaxDegreeOfParallelism = {MaxDegreeOfParallelism}")] - public partial class ExecutionDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public ExecutionDataflowBlockOptions() { } - public int MaxDegreeOfParallelism { get { throw null; } set { } } - public bool SingleProducerConstrained { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, Greedy = {Greedy}, MaxNumberOfGroups = {MaxNumberOfGroups}")] - public partial class GroupingDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public GroupingDataflowBlockOptions() { } - public bool Greedy { get { throw null; } set { } } - public long MaxNumberOfGroups { get { throw null; } set { } } - } - public partial interface IDataflowBlock - { - System.Threading.Tasks.Task Completion { get; } - void Complete(); - void Fault(System.Exception exception); - } - public partial interface IPropagatorBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - } - public partial interface IReceivableSourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock - { - bool TryReceive(System.Predicate filter, out TOutput item); - bool TryReceiveAll(out System.Collections.Generic.IList items); - } - public partial interface ISourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - TOutput ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed); - System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions); - void ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - bool ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - } - public partial interface ITargetBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept); - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformBlock.DebugView")] - public sealed partial class TransformBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformBlock(System.Func> transform) { } - public TransformBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformBlock(System.Func transform) { } - public TransformBlock(System.Func transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformManyBlock.DebugView")] - public sealed partial class TransformManyBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformManyBlock(System.Func> transform) { } - public TransformManyBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformManyBlock(System.Func>> transform) { } - public TransformManyBlock(System.Func>> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.WriteOnceBlock.DebugView")] - public sealed partial class WriteOnceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public WriteOnceBlock(System.Func cloningFunction) { } - public WriteOnceBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.SelfHost.cs deleted file mode 100644 index 06219a761f..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.WebHost.cs deleted file mode 100644 index 99738e712c..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index fc96f29767..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5a06c1423d79532c153032b25d30893e7c067452 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.1/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index 117638ad6c..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -86e739f370da931a17896b50f7531cb5ad5a817c \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.1/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index bb6eb7cc08..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5b0d2e52b8cbace3e8f19aac6769de94fea3082b \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.Deployment.cs deleted file mode 100644 index bfa8dfa514..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.Razor.cs deleted file mode 100644 index b1cf33ce27..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.cs deleted file mode 100644 index 3d40dbae2a..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/System.Web.WebPages.cs +++ /dev/null @@ -1,775 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.1/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.5.1/cscompmgd.cs deleted file mode 100644 index c5aa294454..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.1/cscompmgd.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.5.2/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index fcaebd00c0..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.5.2/SMDiagnostics.cs deleted file mode 100644 index a08170f163..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/SMDiagnostics.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Runtime.Serialization, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -[assembly:System.Security.SecurityCriticalAttribute((System.Security.SecurityCriticalScope)(0))] diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Json.Microsoft.cs deleted file mode 100644 index 3b9b1cbe8f..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Json.Microsoft.cs +++ /dev/null @@ -1,245 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Json.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Json.cs deleted file mode 100644 index 8bb42a07f7..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Json.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.2/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index b41dda8efe..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -712477a5e4ee265b8762b60f3181d3c52cfe5332 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Core.cs deleted file mode 100644 index 1c379a70cd..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Core.cs +++ /dev/null @@ -1,476 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Debugger.cs deleted file mode 100644 index 126c47a7af..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Debugger.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Debugger")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public partial class QueryDebugger - { - public QueryDebugger() { } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Experimental.cs deleted file mode 100644 index 79c150e566..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Experimental.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Interfaces.cs deleted file mode 100644 index c56f515cbd..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Interfaces.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Interfaces Library containing essential interfaces.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Interfaces")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] -namespace System.Reactive -{ - public partial interface IEventPatternSource where TEventArgs : System.EventArgs - { - event System.EventHandler OnNext; - } - public partial interface IEventPattern where TEventArgs : System.EventArgs - { - TEventArgs EventArgs { get; } - TSender Sender { get; } - } - public partial interface IEventSource - { - event System.Action OnNext; - } - public partial interface IObserver - { - TResult OnCompleted(); - TResult OnError(System.Exception exception); - TResult OnNext(TValue value); - } -} -namespace System.Reactive.Concurrency -{ - public partial interface IScheduledItem - { - TAbsolute DueTime { get; } - void Invoke(); - } - public partial interface IScheduler - { - System.DateTimeOffset Now { get; } - System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action); - System.IDisposable Schedule(TState state, System.Func action); - System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - } - public partial interface ISchedulerLongRunning - { - System.IDisposable ScheduleLongRunning(TState state, System.Action action); - } - public partial interface ISchedulerPeriodic - { - System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action); - } - public partial interface IStopwatch - { - System.TimeSpan Elapsed { get; } - } - public partial interface IStopwatchProvider - { - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - } -} -namespace System.Reactive.Disposables -{ - public partial interface ICancelable : System.IDisposable - { - bool IsDisposed { get; } - } -} -namespace System.Reactive.Linq -{ - public partial interface IGroupedObservable : System.IObservable - { - TKey Key { get; } - } - public partial interface IQbservable - { - System.Type ElementType { get; } - System.Linq.Expressions.Expression Expression { get; } - System.Reactive.Linq.IQbservableProvider Provider { get; } - } - public partial interface IQbservableProvider - { - System.Reactive.Linq.IQbservable CreateQuery(System.Linq.Expressions.Expression expression); - } - public partial interface IQbservable : System.IObservable, System.Reactive.Linq.IQbservable - { - } -} -namespace System.Reactive.Subjects -{ - public partial interface IConnectableObservable : System.IObservable - { - System.IDisposable Connect(); - } - public partial interface ISubject : System.IObservable, System.IObserver, System.Reactive.Subjects.ISubject - { - } - public partial interface ISubject : System.IObservable, System.IObserver - { - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 0a6ea03467..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -034f97f0bca4197688187c94df3b16608e647fa9 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Observable.Aliases.cs deleted file mode 100644 index fda237cf4d..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Observable.Aliases.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -namespace System.Reactive.Linq -{ - public static partial class QbservableAliases - { - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.IObservable other) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - } -} -namespace System.Reactive.Observable.Aliases -{ - public static partial class QueryLanguage - { - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.IObservable other) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.PlatformServices.cs deleted file mode 100644 index 2c1100ef00..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.PlatformServices.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.PlatformServices")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public sealed partial class EventLoopScheduler : System.Reactive.Concurrency.LocalScheduler, System.IDisposable, System.Reactive.Concurrency.ISchedulerPeriodic - { - public EventLoopScheduler() { } - public EventLoopScheduler(System.Func threadFactory) { } - public void Dispose() { } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class NewThreadScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public NewThreadScheduler() { } - public NewThreadScheduler(System.Func threadFactory) { } - public static System.Reactive.Concurrency.NewThreadScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class TaskPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public TaskPoolScheduler(System.Threading.Tasks.TaskFactory taskFactory) { } - public static System.Reactive.Concurrency.TaskPoolScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class ThreadPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal ThreadPoolScheduler() { } - public static System.Reactive.Concurrency.ThreadPoolScheduler Instance { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class CurrentPlatformEnlightenmentProvider : System.Reactive.PlatformServices.IPlatformEnlightenmentProvider - { - public CurrentPlatformEnlightenmentProvider() { } - public virtual T GetService(object[] args) where T : class { throw null; } - } - public static partial class EnlightenmentProvider - { - public static bool EnsureLoaded() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Providers.cs.REMOVED.git-id deleted file mode 100644 index a562387e36..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Providers.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -16cd508bb59390035b86224679d33d19fa41e79d \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Runtime.Remoting.cs deleted file mode 100644 index 7e1342eca5..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Runtime.Remoting.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Runtime.Remoting")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public static partial class RemotingObservable - { - public static System.IObservable Remotable(this System.IObservable source) { throw null; } - public static System.IObservable Remotable(this System.IObservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Windows.Forms.cs deleted file mode 100644 index d1b8bcfecc..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Windows.Forms.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Forms")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class ControlScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public ControlScheduler(System.Windows.Forms.Control control) { } - public System.Windows.Forms.Control Control { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ControlObservable - { - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Windows.Threading.cs deleted file mode 100644 index 288cd36c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Reactive.Windows.Threading.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Threading")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class DispatcherScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) { } - public static System.Reactive.Concurrency.DispatcherScheduler Current { get { throw null; } } - public System.Windows.Threading.Dispatcher Dispatcher { get { throw null; } } - [System.ObsoleteAttribute("Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.DispatcherScheduler Instance { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class DispatcherObservable - { - public static System.IObservable ObserveOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - public static System.IObservable SubscribeOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Threading.Tasks.Dataflow.cs deleted file mode 100644 index 4545f9224d..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Threading.Tasks.Dataflow.cs +++ /dev/null @@ -1,385 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} -namespace System.Threading.Tasks.Dataflow -{ - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.ActionBlock.DebugView")] - public sealed partial class ActionBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public ActionBlock(System.Action action) { } - public ActionBlock(System.Action action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public ActionBlock(System.Func action) { } - public ActionBlock(System.Func action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public void Complete() { } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Post(TInput item) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchBlock.DebugView")] - public sealed partial class BatchBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BatchBlock(int batchSize) { } - public BatchBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T[] System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public void TriggerBatch() { } - public bool TryReceive(System.Predicate filter, out T[] item) { item = default(T[]); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BroadcastBlock.DebugView")] - public sealed partial class BroadcastBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BroadcastBlock(System.Func cloningFunction) { } - public BroadcastBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BufferBlock.DebugView")] - public sealed partial class BufferBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BufferBlock() { } - public BufferBlock(System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int Count { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - public static partial class DataflowBlock - { - public static System.IObservable AsObservable(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IObserver AsObserver(this System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Dataflow.IPropagatorBlock Encapsulate(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Predicate predicate) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions, System.Predicate predicate) { throw null; } - public static System.Threading.Tasks.Dataflow.ITargetBlock NullTarget() { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool Post(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool TryReceive(this System.Threading.Tasks.Dataflow.IReceivableSourceBlock source, out TOutput item) { item = default(TOutput); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}")] - public partial class DataflowBlockOptions - { - public const int Unbounded = -1; - public DataflowBlockOptions() { } - public int BoundedCapacity { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } } - public int MaxMessagesPerTask { get { throw null; } set { } } - public string NameFormat { get { throw null; } set { } } - public System.Threading.Tasks.TaskScheduler TaskScheduler { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("PropagateCompletion = {PropagateCompletion}, MaxMessages = {MaxMessages}, Append = {Append}")] - public partial class DataflowLinkOptions - { - public DataflowLinkOptions() { } - public bool Append { get { throw null; } set { } } - public int MaxMessages { get { throw null; } set { } } - public bool PropagateCompletion { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}")] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct DataflowMessageHeader : System.IEquatable - { - public DataflowMessageHeader(long id) { throw null;} - public long Id { get { throw null; } } - public bool IsValid { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Threading.Tasks.Dataflow.DataflowMessageHeader other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - public static bool operator !=(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - } - public enum DataflowMessageStatus - { - Accepted = 0, - Declined = 1, - DecliningPermanently = 4, - NotAvailable = 3, - Postponed = 2, - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, MaxDegreeOfParallelism = {MaxDegreeOfParallelism}")] - public partial class ExecutionDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public ExecutionDataflowBlockOptions() { } - public int MaxDegreeOfParallelism { get { throw null; } set { } } - public bool SingleProducerConstrained { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, Greedy = {Greedy}, MaxNumberOfGroups = {MaxNumberOfGroups}")] - public partial class GroupingDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public GroupingDataflowBlockOptions() { } - public bool Greedy { get { throw null; } set { } } - public long MaxNumberOfGroups { get { throw null; } set { } } - } - public partial interface IDataflowBlock - { - System.Threading.Tasks.Task Completion { get; } - void Complete(); - void Fault(System.Exception exception); - } - public partial interface IPropagatorBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - } - public partial interface IReceivableSourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock - { - bool TryReceive(System.Predicate filter, out TOutput item); - bool TryReceiveAll(out System.Collections.Generic.IList items); - } - public partial interface ISourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - TOutput ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed); - System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions); - void ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - bool ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - } - public partial interface ITargetBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept); - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformBlock.DebugView")] - public sealed partial class TransformBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformBlock(System.Func> transform) { } - public TransformBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformBlock(System.Func transform) { } - public TransformBlock(System.Func transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformManyBlock.DebugView")] - public sealed partial class TransformManyBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformManyBlock(System.Func> transform) { } - public TransformManyBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformManyBlock(System.Func>> transform) { } - public TransformManyBlock(System.Func>> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.WriteOnceBlock.DebugView")] - public sealed partial class WriteOnceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public WriteOnceBlock(System.Func cloningFunction) { } - public WriteOnceBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.SelfHost.cs deleted file mode 100644 index 06219a761f..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.WebHost.cs deleted file mode 100644 index 99738e712c..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index fc96f29767..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5a06c1423d79532c153032b25d30893e7c067452 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.2/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index 117638ad6c..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -86e739f370da931a17896b50f7531cb5ad5a817c \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5.2/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index bb6eb7cc08..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5b0d2e52b8cbace3e8f19aac6769de94fea3082b \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.Deployment.cs deleted file mode 100644 index bfa8dfa514..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.Razor.cs deleted file mode 100644 index b1cf33ce27..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.cs deleted file mode 100644 index 3d40dbae2a..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/System.Web.WebPages.cs +++ /dev/null @@ -1,775 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5.2/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.5.2/cscompmgd.cs deleted file mode 100644 index c5aa294454..0000000000 --- a/external/binary-reference-assemblies/src/v4.5.2/cscompmgd.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.5/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index fcaebd00c0..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.5/SMDiagnostics.cs deleted file mode 100644 index a08170f163..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/SMDiagnostics.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Runtime.Serialization, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -[assembly:System.Security.SecurityCriticalAttribute((System.Security.SecurityCriticalScope)(0))] diff --git a/external/binary-reference-assemblies/src/v4.5/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.5/System.Json.Microsoft.cs deleted file mode 100644 index 3b9b1cbe8f..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Json.Microsoft.cs +++ /dev/null @@ -1,245 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Json.cs b/external/binary-reference-assemblies/src/v4.5/System.Json.cs deleted file mode 100644 index 8bb42a07f7..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Json.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index b41dda8efe..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -712477a5e4ee265b8762b60f3181d3c52cfe5332 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Core.cs deleted file mode 100644 index 1c379a70cd..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Core.cs +++ /dev/null @@ -1,476 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Debugger.cs deleted file mode 100644 index 126c47a7af..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Debugger.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Debugger")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public partial class QueryDebugger - { - public QueryDebugger() { } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Experimental.cs deleted file mode 100644 index 79c150e566..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Experimental.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Interfaces.cs deleted file mode 100644 index c56f515cbd..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Interfaces.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Interfaces Library containing essential interfaces.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Interfaces")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] -namespace System.Reactive -{ - public partial interface IEventPatternSource where TEventArgs : System.EventArgs - { - event System.EventHandler OnNext; - } - public partial interface IEventPattern where TEventArgs : System.EventArgs - { - TEventArgs EventArgs { get; } - TSender Sender { get; } - } - public partial interface IEventSource - { - event System.Action OnNext; - } - public partial interface IObserver - { - TResult OnCompleted(); - TResult OnError(System.Exception exception); - TResult OnNext(TValue value); - } -} -namespace System.Reactive.Concurrency -{ - public partial interface IScheduledItem - { - TAbsolute DueTime { get; } - void Invoke(); - } - public partial interface IScheduler - { - System.DateTimeOffset Now { get; } - System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action); - System.IDisposable Schedule(TState state, System.Func action); - System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - } - public partial interface ISchedulerLongRunning - { - System.IDisposable ScheduleLongRunning(TState state, System.Action action); - } - public partial interface ISchedulerPeriodic - { - System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action); - } - public partial interface IStopwatch - { - System.TimeSpan Elapsed { get; } - } - public partial interface IStopwatchProvider - { - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - } -} -namespace System.Reactive.Disposables -{ - public partial interface ICancelable : System.IDisposable - { - bool IsDisposed { get; } - } -} -namespace System.Reactive.Linq -{ - public partial interface IGroupedObservable : System.IObservable - { - TKey Key { get; } - } - public partial interface IQbservable - { - System.Type ElementType { get; } - System.Linq.Expressions.Expression Expression { get; } - System.Reactive.Linq.IQbservableProvider Provider { get; } - } - public partial interface IQbservableProvider - { - System.Reactive.Linq.IQbservable CreateQuery(System.Linq.Expressions.Expression expression); - } - public partial interface IQbservable : System.IObservable, System.Reactive.Linq.IQbservable - { - } -} -namespace System.Reactive.Subjects -{ - public partial interface IConnectableObservable : System.IObservable - { - System.IDisposable Connect(); - } - public partial interface ISubject : System.IObservable, System.IObserver, System.Reactive.Subjects.ISubject - { - } - public partial interface ISubject : System.IObservable, System.IObserver - { - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 0a6ea03467..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -034f97f0bca4197688187c94df3b16608e647fa9 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Observable.Aliases.cs deleted file mode 100644 index fda237cf4d..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Observable.Aliases.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -namespace System.Reactive.Linq -{ - public static partial class QbservableAliases - { - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.IObservable other) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - } -} -namespace System.Reactive.Observable.Aliases -{ - public static partial class QueryLanguage - { - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.IObservable other) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.PlatformServices.cs deleted file mode 100644 index 2c1100ef00..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.PlatformServices.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.PlatformServices")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public sealed partial class EventLoopScheduler : System.Reactive.Concurrency.LocalScheduler, System.IDisposable, System.Reactive.Concurrency.ISchedulerPeriodic - { - public EventLoopScheduler() { } - public EventLoopScheduler(System.Func threadFactory) { } - public void Dispose() { } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class NewThreadScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public NewThreadScheduler() { } - public NewThreadScheduler(System.Func threadFactory) { } - public static System.Reactive.Concurrency.NewThreadScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class TaskPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public TaskPoolScheduler(System.Threading.Tasks.TaskFactory taskFactory) { } - public static System.Reactive.Concurrency.TaskPoolScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class ThreadPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal ThreadPoolScheduler() { } - public static System.Reactive.Concurrency.ThreadPoolScheduler Instance { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class CurrentPlatformEnlightenmentProvider : System.Reactive.PlatformServices.IPlatformEnlightenmentProvider - { - public CurrentPlatformEnlightenmentProvider() { } - public virtual T GetService(object[] args) where T : class { throw null; } - } - public static partial class EnlightenmentProvider - { - public static bool EnsureLoaded() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Providers.cs.REMOVED.git-id deleted file mode 100644 index a562387e36..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Providers.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -16cd508bb59390035b86224679d33d19fa41e79d \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Runtime.Remoting.cs deleted file mode 100644 index 7e1342eca5..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Runtime.Remoting.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Runtime.Remoting")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public static partial class RemotingObservable - { - public static System.IObservable Remotable(this System.IObservable source) { throw null; } - public static System.IObservable Remotable(this System.IObservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Windows.Forms.cs deleted file mode 100644 index d1b8bcfecc..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Windows.Forms.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Forms")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class ControlScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public ControlScheduler(System.Windows.Forms.Control control) { } - public System.Windows.Forms.Control Control { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ControlObservable - { - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/v4.5/System.Reactive.Windows.Threading.cs deleted file mode 100644 index 288cd36c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Reactive.Windows.Threading.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Threading")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class DispatcherScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) { } - public static System.Reactive.Concurrency.DispatcherScheduler Current { get { throw null; } } - public System.Windows.Threading.Dispatcher Dispatcher { get { throw null; } } - [System.ObsoleteAttribute("Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.DispatcherScheduler Instance { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class DispatcherObservable - { - public static System.IObservable ObserveOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - public static System.IObservable SubscribeOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/v4.5/System.Threading.Tasks.Dataflow.cs deleted file mode 100644 index 4545f9224d..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Threading.Tasks.Dataflow.cs +++ /dev/null @@ -1,385 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} -namespace System.Threading.Tasks.Dataflow -{ - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.ActionBlock.DebugView")] - public sealed partial class ActionBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public ActionBlock(System.Action action) { } - public ActionBlock(System.Action action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public ActionBlock(System.Func action) { } - public ActionBlock(System.Func action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public void Complete() { } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Post(TInput item) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchBlock.DebugView")] - public sealed partial class BatchBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BatchBlock(int batchSize) { } - public BatchBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T[] System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public void TriggerBatch() { } - public bool TryReceive(System.Predicate filter, out T[] item) { item = default(T[]); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BroadcastBlock.DebugView")] - public sealed partial class BroadcastBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BroadcastBlock(System.Func cloningFunction) { } - public BroadcastBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BufferBlock.DebugView")] - public sealed partial class BufferBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BufferBlock() { } - public BufferBlock(System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int Count { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - public static partial class DataflowBlock - { - public static System.IObservable AsObservable(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IObserver AsObserver(this System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Dataflow.IPropagatorBlock Encapsulate(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Predicate predicate) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions, System.Predicate predicate) { throw null; } - public static System.Threading.Tasks.Dataflow.ITargetBlock NullTarget() { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool Post(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool TryReceive(this System.Threading.Tasks.Dataflow.IReceivableSourceBlock source, out TOutput item) { item = default(TOutput); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}")] - public partial class DataflowBlockOptions - { - public const int Unbounded = -1; - public DataflowBlockOptions() { } - public int BoundedCapacity { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } } - public int MaxMessagesPerTask { get { throw null; } set { } } - public string NameFormat { get { throw null; } set { } } - public System.Threading.Tasks.TaskScheduler TaskScheduler { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("PropagateCompletion = {PropagateCompletion}, MaxMessages = {MaxMessages}, Append = {Append}")] - public partial class DataflowLinkOptions - { - public DataflowLinkOptions() { } - public bool Append { get { throw null; } set { } } - public int MaxMessages { get { throw null; } set { } } - public bool PropagateCompletion { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}")] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct DataflowMessageHeader : System.IEquatable - { - public DataflowMessageHeader(long id) { throw null;} - public long Id { get { throw null; } } - public bool IsValid { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Threading.Tasks.Dataflow.DataflowMessageHeader other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - public static bool operator !=(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - } - public enum DataflowMessageStatus - { - Accepted = 0, - Declined = 1, - DecliningPermanently = 4, - NotAvailable = 3, - Postponed = 2, - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, MaxDegreeOfParallelism = {MaxDegreeOfParallelism}")] - public partial class ExecutionDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public ExecutionDataflowBlockOptions() { } - public int MaxDegreeOfParallelism { get { throw null; } set { } } - public bool SingleProducerConstrained { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, Greedy = {Greedy}, MaxNumberOfGroups = {MaxNumberOfGroups}")] - public partial class GroupingDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public GroupingDataflowBlockOptions() { } - public bool Greedy { get { throw null; } set { } } - public long MaxNumberOfGroups { get { throw null; } set { } } - } - public partial interface IDataflowBlock - { - System.Threading.Tasks.Task Completion { get; } - void Complete(); - void Fault(System.Exception exception); - } - public partial interface IPropagatorBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - } - public partial interface IReceivableSourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock - { - bool TryReceive(System.Predicate filter, out TOutput item); - bool TryReceiveAll(out System.Collections.Generic.IList items); - } - public partial interface ISourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - TOutput ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed); - System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions); - void ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - bool ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - } - public partial interface ITargetBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept); - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformBlock.DebugView")] - public sealed partial class TransformBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformBlock(System.Func> transform) { } - public TransformBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformBlock(System.Func transform) { } - public TransformBlock(System.Func transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformManyBlock.DebugView")] - public sealed partial class TransformManyBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformManyBlock(System.Func> transform) { } - public TransformManyBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformManyBlock(System.Func>> transform) { } - public TransformManyBlock(System.Func>> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.WriteOnceBlock.DebugView")] - public sealed partial class WriteOnceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public WriteOnceBlock(System.Func cloningFunction) { } - public WriteOnceBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.5/System.Web.Http.SelfHost.cs deleted file mode 100644 index 06219a761f..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.5/System.Web.Http.WebHost.cs deleted file mode 100644 index 99738e712c..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index fc96f29767..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5a06c1423d79532c153032b25d30893e7c067452 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index 117638ad6c..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -86e739f370da931a17896b50f7531cb5ad5a817c \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.5/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index bb6eb7cc08..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5b0d2e52b8cbace3e8f19aac6769de94fea3082b \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.Deployment.cs deleted file mode 100644 index bfa8dfa514..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.Razor.cs deleted file mode 100644 index b1cf33ce27..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.cs deleted file mode 100644 index 3d40dbae2a..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/System.Web.WebPages.cs +++ /dev/null @@ -1,775 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.17020")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.5/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.5/cscompmgd.cs deleted file mode 100644 index c5aa294454..0000000000 --- a/external/binary-reference-assemblies/src/v4.5/cscompmgd.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(258))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.6.1/SMDiagnostics.cs deleted file mode 100644 index bcccb3d202..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/SMDiagnostics.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Json.Microsoft.cs deleted file mode 100644 index 1b06151d3c..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Json.Microsoft.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Json.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Json.cs deleted file mode 100644 index 4d716466cd..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Json.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.1/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index 17df69285b..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bae8733212ee6cf090c0ef3b915c4d0129ca88fe \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Numerics.Vectors.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Numerics.Vectors.cs deleted file mode 100644 index db256cfd6f..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Numerics.Vectors.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Matrix3x2))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Matrix4x4))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Plane))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Quaternion))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector2))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector3))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector4))] diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Core.cs deleted file mode 100644 index 56d5789d40..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Core.cs +++ /dev/null @@ -1,477 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Experimental.cs deleted file mode 100644 index e6abcf6c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Experimental.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 6f7a384401..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f5b7e1f5e8f18e2e491af44627106e374224ab40 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Threading.Tasks.Dataflow.cs deleted file mode 100644 index 2fe1d34bc3..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Threading.Tasks.Dataflow.cs +++ /dev/null @@ -1,386 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} -namespace System.Threading.Tasks.Dataflow -{ - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.ActionBlock.DebugView")] - public sealed partial class ActionBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public ActionBlock(System.Action action) { } - public ActionBlock(System.Action action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public ActionBlock(System.Func action) { } - public ActionBlock(System.Func action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public void Complete() { } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Post(TInput item) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchBlock.DebugView")] - public sealed partial class BatchBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BatchBlock(int batchSize) { } - public BatchBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T[] System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public void TriggerBatch() { } - public bool TryReceive(System.Predicate filter, out T[] item) { item = default(T[]); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BroadcastBlock.DebugView")] - public sealed partial class BroadcastBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BroadcastBlock(System.Func cloningFunction) { } - public BroadcastBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BufferBlock.DebugView")] - public sealed partial class BufferBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BufferBlock() { } - public BufferBlock(System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int Count { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - public static partial class DataflowBlock - { - public static System.IObservable AsObservable(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IObserver AsObserver(this System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Dataflow.IPropagatorBlock Encapsulate(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Predicate predicate) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions, System.Predicate predicate) { throw null; } - public static System.Threading.Tasks.Dataflow.ITargetBlock NullTarget() { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool Post(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool TryReceive(this System.Threading.Tasks.Dataflow.IReceivableSourceBlock source, out TOutput item) { item = default(TOutput); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}")] - public partial class DataflowBlockOptions - { - public const int Unbounded = -1; - public DataflowBlockOptions() { } - public int BoundedCapacity { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } } - public int MaxMessagesPerTask { get { throw null; } set { } } - public string NameFormat { get { throw null; } set { } } - public System.Threading.Tasks.TaskScheduler TaskScheduler { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("PropagateCompletion = {PropagateCompletion}, MaxMessages = {MaxMessages}, Append = {Append}")] - public partial class DataflowLinkOptions - { - public DataflowLinkOptions() { } - public bool Append { get { throw null; } set { } } - public int MaxMessages { get { throw null; } set { } } - public bool PropagateCompletion { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}")] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct DataflowMessageHeader : System.IEquatable - { - public DataflowMessageHeader(long id) { throw null;} - public long Id { get { throw null; } } - public bool IsValid { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Threading.Tasks.Dataflow.DataflowMessageHeader other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - public static bool operator !=(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - } - public enum DataflowMessageStatus - { - Accepted = 0, - Declined = 1, - DecliningPermanently = 4, - NotAvailable = 3, - Postponed = 2, - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, MaxDegreeOfParallelism = {MaxDegreeOfParallelism}")] - public partial class ExecutionDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public ExecutionDataflowBlockOptions() { } - public int MaxDegreeOfParallelism { get { throw null; } set { } } - public bool SingleProducerConstrained { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, Greedy = {Greedy}, MaxNumberOfGroups = {MaxNumberOfGroups}")] - public partial class GroupingDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public GroupingDataflowBlockOptions() { } - public bool Greedy { get { throw null; } set { } } - public long MaxNumberOfGroups { get { throw null; } set { } } - } - public partial interface IDataflowBlock - { - System.Threading.Tasks.Task Completion { get; } - void Complete(); - void Fault(System.Exception exception); - } - public partial interface IPropagatorBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - } - public partial interface IReceivableSourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock - { - bool TryReceive(System.Predicate filter, out TOutput item); - bool TryReceiveAll(out System.Collections.Generic.IList items); - } - public partial interface ISourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - TOutput ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed); - System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions); - void ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - bool ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - } - public partial interface ITargetBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept); - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformBlock.DebugView")] - public sealed partial class TransformBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformBlock(System.Func> transform) { } - public TransformBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformBlock(System.Func transform) { } - public TransformBlock(System.Func transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformManyBlock.DebugView")] - public sealed partial class TransformManyBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformManyBlock(System.Func> transform) { } - public TransformManyBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformManyBlock(System.Func>> transform) { } - public TransformManyBlock(System.Func>> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.WriteOnceBlock.DebugView")] - public sealed partial class WriteOnceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public WriteOnceBlock(System.Func cloningFunction) { } - public WriteOnceBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.SelfHost.cs deleted file mode 100644 index a4291c06a6..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.WebHost.cs deleted file mode 100644 index f597301777..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index 745e684454..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -fe44ff1016ed9ae87ab211c14696686eb050f2eb \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.1/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index fc84720be3..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -94acbffb2222940a920562ec77e60b02323dc392 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.Deployment.cs deleted file mode 100644 index 1991df0aea..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.Razor.cs deleted file mode 100644 index 1a404139b4..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.cs deleted file mode 100644 index e5ae55ad80..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.1/System.Web.WebPages.cs +++ /dev/null @@ -1,776 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.6.2/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index dfc3ce0ab2..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.6.2/SMDiagnostics.cs deleted file mode 100644 index bcccb3d202..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/SMDiagnostics.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Json.Microsoft.cs deleted file mode 100644 index 1b06151d3c..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Json.Microsoft.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Json.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Json.cs deleted file mode 100644 index 4d716466cd..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Json.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.2/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index 17df69285b..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bae8733212ee6cf090c0ef3b915c4d0129ca88fe \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Numerics.Vectors.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Numerics.Vectors.cs deleted file mode 100644 index db256cfd6f..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Numerics.Vectors.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Matrix3x2))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Matrix4x4))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Plane))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Quaternion))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector2))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector3))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector4))] diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Core.cs deleted file mode 100644 index 56d5789d40..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Core.cs +++ /dev/null @@ -1,477 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Debugger.cs deleted file mode 100644 index 947bd7811a..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Debugger.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Debugger")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public partial class QueryDebugger - { - public QueryDebugger() { } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Experimental.cs deleted file mode 100644 index e6abcf6c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Experimental.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Interfaces.cs deleted file mode 100644 index 6053fabe3b..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Interfaces.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Interfaces Library containing essential interfaces.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Interfaces")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] -namespace System.Reactive -{ - public partial interface IEventPatternSource where TEventArgs : System.EventArgs - { - event System.EventHandler OnNext; - } - public partial interface IEventPattern where TEventArgs : System.EventArgs - { - TEventArgs EventArgs { get; } - TSender Sender { get; } - } - public partial interface IEventSource - { - event System.Action OnNext; - } - public partial interface IObserver - { - TResult OnCompleted(); - TResult OnError(System.Exception exception); - TResult OnNext(TValue value); - } -} -namespace System.Reactive.Concurrency -{ - public partial interface IScheduledItem - { - TAbsolute DueTime { get; } - void Invoke(); - } - public partial interface IScheduler - { - System.DateTimeOffset Now { get; } - System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action); - System.IDisposable Schedule(TState state, System.Func action); - System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - } - public partial interface ISchedulerLongRunning - { - System.IDisposable ScheduleLongRunning(TState state, System.Action action); - } - public partial interface ISchedulerPeriodic - { - System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action); - } - public partial interface IStopwatch - { - System.TimeSpan Elapsed { get; } - } - public partial interface IStopwatchProvider - { - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - } -} -namespace System.Reactive.Disposables -{ - public partial interface ICancelable : System.IDisposable - { - bool IsDisposed { get; } - } -} -namespace System.Reactive.Linq -{ - public partial interface IGroupedObservable : System.IObservable - { - TKey Key { get; } - } - public partial interface IQbservable - { - System.Type ElementType { get; } - System.Linq.Expressions.Expression Expression { get; } - System.Reactive.Linq.IQbservableProvider Provider { get; } - } - public partial interface IQbservableProvider - { - System.Reactive.Linq.IQbservable CreateQuery(System.Linq.Expressions.Expression expression); - } - public partial interface IQbservable : System.IObservable, System.Reactive.Linq.IQbservable - { - } -} -namespace System.Reactive.Subjects -{ - public partial interface IConnectableObservable : System.IObservable - { - System.IDisposable Connect(); - } - public partial interface ISubject : System.IObservable, System.IObserver, System.Reactive.Subjects.ISubject - { - } - public partial interface ISubject : System.IObservable, System.IObserver - { - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 6f7a384401..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f5b7e1f5e8f18e2e491af44627106e374224ab40 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Observable.Aliases.cs deleted file mode 100644 index dad78a51ad..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Observable.Aliases.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -namespace System.Reactive.Linq -{ - public static partial class QbservableAliases - { - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.IObservable other) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - } -} -namespace System.Reactive.Observable.Aliases -{ - public static partial class QueryLanguage - { - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.IObservable other) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.PlatformServices.cs deleted file mode 100644 index f73d1beba5..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.PlatformServices.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.PlatformServices")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public sealed partial class EventLoopScheduler : System.Reactive.Concurrency.LocalScheduler, System.IDisposable, System.Reactive.Concurrency.ISchedulerPeriodic - { - public EventLoopScheduler() { } - public EventLoopScheduler(System.Func threadFactory) { } - public void Dispose() { } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class NewThreadScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public NewThreadScheduler() { } - public NewThreadScheduler(System.Func threadFactory) { } - public static System.Reactive.Concurrency.NewThreadScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class TaskPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public TaskPoolScheduler(System.Threading.Tasks.TaskFactory taskFactory) { } - public static System.Reactive.Concurrency.TaskPoolScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class ThreadPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal ThreadPoolScheduler() { } - public static System.Reactive.Concurrency.ThreadPoolScheduler Instance { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class CurrentPlatformEnlightenmentProvider : System.Reactive.PlatformServices.IPlatformEnlightenmentProvider - { - public CurrentPlatformEnlightenmentProvider() { } - public virtual T GetService(object[] args) where T : class { throw null; } - } - public static partial class EnlightenmentProvider - { - public static bool EnsureLoaded() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Providers.cs.REMOVED.git-id deleted file mode 100644 index 9f8860276f..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Providers.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b241864ce9a6cb4a07386f059712e11501571c24 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Runtime.Remoting.cs deleted file mode 100644 index b1f6e4fe88..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Runtime.Remoting.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Runtime.Remoting")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public static partial class RemotingObservable - { - public static System.IObservable Remotable(this System.IObservable source) { throw null; } - public static System.IObservable Remotable(this System.IObservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Windows.Forms.cs deleted file mode 100644 index 9bee832064..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Windows.Forms.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Forms")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class ControlScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public ControlScheduler(System.Windows.Forms.Control control) { } - public System.Windows.Forms.Control Control { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ControlObservable - { - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Windows.Threading.cs deleted file mode 100644 index 05157c7f24..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Reactive.Windows.Threading.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Threading")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class DispatcherScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) { } - public static System.Reactive.Concurrency.DispatcherScheduler Current { get { throw null; } } - public System.Windows.Threading.Dispatcher Dispatcher { get { throw null; } } - [System.ObsoleteAttribute("Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.DispatcherScheduler Instance { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class DispatcherObservable - { - public static System.IObservable ObserveOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - public static System.IObservable SubscribeOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Threading.Tasks.Dataflow.cs deleted file mode 100644 index 2fe1d34bc3..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Threading.Tasks.Dataflow.cs +++ /dev/null @@ -1,386 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} -namespace System.Threading.Tasks.Dataflow -{ - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.ActionBlock.DebugView")] - public sealed partial class ActionBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public ActionBlock(System.Action action) { } - public ActionBlock(System.Action action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public ActionBlock(System.Func action) { } - public ActionBlock(System.Func action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public void Complete() { } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Post(TInput item) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchBlock.DebugView")] - public sealed partial class BatchBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BatchBlock(int batchSize) { } - public BatchBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T[] System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public void TriggerBatch() { } - public bool TryReceive(System.Predicate filter, out T[] item) { item = default(T[]); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BroadcastBlock.DebugView")] - public sealed partial class BroadcastBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BroadcastBlock(System.Func cloningFunction) { } - public BroadcastBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BufferBlock.DebugView")] - public sealed partial class BufferBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BufferBlock() { } - public BufferBlock(System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int Count { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - public static partial class DataflowBlock - { - public static System.IObservable AsObservable(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IObserver AsObserver(this System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Dataflow.IPropagatorBlock Encapsulate(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Predicate predicate) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions, System.Predicate predicate) { throw null; } - public static System.Threading.Tasks.Dataflow.ITargetBlock NullTarget() { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool Post(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool TryReceive(this System.Threading.Tasks.Dataflow.IReceivableSourceBlock source, out TOutput item) { item = default(TOutput); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}")] - public partial class DataflowBlockOptions - { - public const int Unbounded = -1; - public DataflowBlockOptions() { } - public int BoundedCapacity { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } } - public int MaxMessagesPerTask { get { throw null; } set { } } - public string NameFormat { get { throw null; } set { } } - public System.Threading.Tasks.TaskScheduler TaskScheduler { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("PropagateCompletion = {PropagateCompletion}, MaxMessages = {MaxMessages}, Append = {Append}")] - public partial class DataflowLinkOptions - { - public DataflowLinkOptions() { } - public bool Append { get { throw null; } set { } } - public int MaxMessages { get { throw null; } set { } } - public bool PropagateCompletion { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}")] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct DataflowMessageHeader : System.IEquatable - { - public DataflowMessageHeader(long id) { throw null;} - public long Id { get { throw null; } } - public bool IsValid { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Threading.Tasks.Dataflow.DataflowMessageHeader other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - public static bool operator !=(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - } - public enum DataflowMessageStatus - { - Accepted = 0, - Declined = 1, - DecliningPermanently = 4, - NotAvailable = 3, - Postponed = 2, - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, MaxDegreeOfParallelism = {MaxDegreeOfParallelism}")] - public partial class ExecutionDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public ExecutionDataflowBlockOptions() { } - public int MaxDegreeOfParallelism { get { throw null; } set { } } - public bool SingleProducerConstrained { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, Greedy = {Greedy}, MaxNumberOfGroups = {MaxNumberOfGroups}")] - public partial class GroupingDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public GroupingDataflowBlockOptions() { } - public bool Greedy { get { throw null; } set { } } - public long MaxNumberOfGroups { get { throw null; } set { } } - } - public partial interface IDataflowBlock - { - System.Threading.Tasks.Task Completion { get; } - void Complete(); - void Fault(System.Exception exception); - } - public partial interface IPropagatorBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - } - public partial interface IReceivableSourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock - { - bool TryReceive(System.Predicate filter, out TOutput item); - bool TryReceiveAll(out System.Collections.Generic.IList items); - } - public partial interface ISourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - TOutput ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed); - System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions); - void ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - bool ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - } - public partial interface ITargetBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept); - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformBlock.DebugView")] - public sealed partial class TransformBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformBlock(System.Func> transform) { } - public TransformBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformBlock(System.Func transform) { } - public TransformBlock(System.Func transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformManyBlock.DebugView")] - public sealed partial class TransformManyBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformManyBlock(System.Func> transform) { } - public TransformManyBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformManyBlock(System.Func>> transform) { } - public TransformManyBlock(System.Func>> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.WriteOnceBlock.DebugView")] - public sealed partial class WriteOnceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public WriteOnceBlock(System.Func cloningFunction) { } - public WriteOnceBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.SelfHost.cs deleted file mode 100644 index a4291c06a6..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.WebHost.cs deleted file mode 100644 index f597301777..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index 745e684454..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -fe44ff1016ed9ae87ab211c14696686eb050f2eb \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.2/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index c9be32f181..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7d7fc3daa8f6707479cbab03b6eb09c830d567dc \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6.2/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index fc84720be3..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -94acbffb2222940a920562ec77e60b02323dc392 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.Deployment.cs deleted file mode 100644 index 1991df0aea..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.Razor.cs deleted file mode 100644 index 1a404139b4..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.cs deleted file mode 100644 index e5ae55ad80..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/System.Web.WebPages.cs +++ /dev/null @@ -1,776 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6.2/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.6.2/cscompmgd.cs deleted file mode 100644 index 1785b32f39..0000000000 --- a/external/binary-reference-assemblies/src/v4.6.2/cscompmgd.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.6/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index dfc3ce0ab2..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.6/SMDiagnostics.cs deleted file mode 100644 index bcccb3d202..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/SMDiagnostics.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] diff --git a/external/binary-reference-assemblies/src/v4.6/System.Json.Microsoft.cs b/external/binary-reference-assemblies/src/v4.6/System.Json.Microsoft.cs deleted file mode 100644 index 1b06151d3c..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Json.Microsoft.cs +++ /dev/null @@ -1,246 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.Microsoft.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.InteropServices.GuidAttribute("6fd72360-ebfc-4097-96fa-2ee418c04f7b")] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Json -{ - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override System.Json.JsonValue ValueOrDefault(int index) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - protected override System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - protected override void OnSaveEnded() { } - protected override void OnSaveStarted() { } - public bool Remove(string key) { throw null; } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - public override System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - [System.Runtime.Serialization.DataContractAttribute] - public sealed partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ushort value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(uint value) { } - [System.CLSCompliantAttribute(false)] - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public object Value { get { throw null; } } - public override object ReadAs(System.Type type) { throw null; } - public static bool TryCreate(object value, out System.Json.JsonPrimitive result) { result = default(System.Json.JsonPrimitive); throw null; } - public override bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Default = 5, - Number = 1, - Object = 2, - String = 0, - } - [System.Runtime.Serialization.DataContractAttribute] - public partial class JsonValue : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Dynamic.IDynamicMetaObjectProvider - { - internal JsonValue() { } - protected int ChangedListenersCount { get { throw null; } } - protected int ChangingListenersCount { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public virtual System.Json.JsonType JsonType { get { throw null; } } - public event System.EventHandler Changed { add { } remove { } } - public event System.EventHandler Changing { add { } remove { } } - public dynamic AsDynamic() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static T CastValue(System.Json.JsonValue value) { throw null; } - public virtual bool ContainsKey(string key) { throw null; } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerator> GetKeyValuePairEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(int index) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue GetValue(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - protected virtual void OnSaveEnded() { } - protected virtual void OnSaveStarted() { } - public static explicit operator bool (System.Json.JsonValue value) { throw null; } - public static explicit operator byte (System.Json.JsonValue value) { throw null; } - public static explicit operator char (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static explicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static explicit operator decimal (System.Json.JsonValue value) { throw null; } - public static explicit operator double (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static explicit operator short (System.Json.JsonValue value) { throw null; } - public static explicit operator int (System.Json.JsonValue value) { throw null; } - public static explicit operator long (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static explicit operator float (System.Json.JsonValue value) { throw null; } - public static explicit operator string (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ushort (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator uint (System.Json.JsonValue value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static explicit operator ulong (System.Json.JsonValue value) { throw null; } - public static explicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - [System.CLSCompliantAttribute(false)] - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string json) { throw null; } - protected void RaiseChangedEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - protected void RaiseChangingEvent(object sender, System.Json.JsonValueChangeEventArgs eventArgs) { } - public virtual object ReadAs(System.Type type) { throw null; } - public object ReadAs(System.Type type, object fallback) { throw null; } - public T ReadAs() { throw null; } - public T ReadAs(T fallback) { throw null; } - public void Save(System.IO.Stream stream) { } - public void Save(System.IO.TextWriter textWriter) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(int index, object value) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Json.JsonValue SetValue(string key, object value) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - System.Dynamic.DynamicMetaObject System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(System.Linq.Expressions.Expression parameter) { throw null; } - public override string ToString() { throw null; } - public virtual bool TryReadAs(System.Type type, out object value) { value = default(object); throw null; } - public bool TryReadAs(out T valueOfT) { valueOfT = default(T); throw null; } - public virtual System.Json.JsonValue ValueOrDefault(int index) { throw null; } - public System.Json.JsonValue ValueOrDefault(params object[] indexes) { throw null; } - public virtual System.Json.JsonValue ValueOrDefault(string key) { throw null; } - } - public enum JsonValueChange - { - Add = 0, - Clear = 3, - Remove = 1, - Replace = 2, - } - public partial class JsonValueChangeEventArgs : System.EventArgs - { - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, int index) { } - public JsonValueChangeEventArgs(System.Json.JsonValue child, System.Json.JsonValueChange change, string key) { } - public System.Json.JsonValueChange Change { get { throw null; } } - public System.Json.JsonValue Child { get { throw null; } } - public int Index { get { throw null; } } - public string Key { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueLinqExtensions - { - public static System.Json.JsonArray ToJsonArray(this System.Collections.Generic.IEnumerable items) { throw null; } - public static System.Json.JsonObject ToJsonObject(this System.Collections.Generic.IEnumerable> items) { throw null; } - } -} -namespace System.Runtime.Serialization.Json -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class JsonValueExtensions - { - public static System.Json.JsonValue CreateFrom(object value) { throw null; } - public static object ReadAsType(this System.Json.JsonValue jsonValue, System.Type type) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue) { throw null; } - public static T ReadAsType(this System.Json.JsonValue jsonValue, T fallback) { throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, System.Type type, out object value) { value = default(object); throw null; } - public static bool TryReadAsType(this System.Json.JsonValue jsonValue, out T valueOfT) { valueOfT = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Json.cs b/external/binary-reference-assemblies/src/v4.6/System.Json.cs deleted file mode 100644 index 4d716466cd..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Json.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Json.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Json.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -namespace System.Json -{ - public partial class JsonArray : System.Json.JsonValue, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable - { - public JsonArray(System.Collections.Generic.IEnumerable items) { } - public JsonArray(params System.Json.JsonValue[] items) { } - public override int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public sealed override System.Json.JsonValue this[int index] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public void Add(System.Json.JsonValue item) { } - public void AddRange(System.Collections.Generic.IEnumerable items) { } - public void AddRange(params System.Json.JsonValue[] items) { } - public void Clear() { } - public bool Contains(System.Json.JsonValue item) { throw null; } - public void CopyTo(System.Json.JsonValue[] array, int arrayIndex) { } - public int IndexOf(System.Json.JsonValue item) { throw null; } - public void Insert(int index, System.Json.JsonValue item) { } - public bool Remove(System.Json.JsonValue item) { throw null; } - public void RemoveAt(int index) { } - public override void Save(System.IO.Stream stream) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class JsonObject : System.Json.JsonValue, System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public JsonObject(System.Collections.Generic.IEnumerable> items) { } - public JsonObject(params System.Collections.Generic.KeyValuePair[] items) { } - public override int Count { get { throw null; } } - public sealed override System.Json.JsonValue this[string key] { get { throw null; } set { } } - public override System.Json.JsonType JsonType { get { throw null; } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - bool System.Collections.Generic.ICollection>.IsReadOnly { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair pair) { } - public void Add(string key, System.Json.JsonValue value) { } - public void AddRange(System.Collections.Generic.IEnumerable> items) { } - public void AddRange(params System.Collections.Generic.KeyValuePair[] items) { } - public void Clear() { } - public override bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool Remove(string key) { throw null; } - public override void Save(System.IO.Stream stream) { } - bool System.Collections.Generic.ICollection>.Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - bool System.Collections.Generic.ICollection>.Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Json.JsonValue value) { value = default(System.Json.JsonValue); throw null; } - } - public partial class JsonPrimitive : System.Json.JsonValue - { - public JsonPrimitive(bool value) { } - public JsonPrimitive(byte value) { } - public JsonPrimitive(char value) { } - public JsonPrimitive(System.DateTime value) { } - public JsonPrimitive(System.DateTimeOffset value) { } - public JsonPrimitive(decimal value) { } - public JsonPrimitive(double value) { } - public JsonPrimitive(System.Guid value) { } - public JsonPrimitive(short value) { } - public JsonPrimitive(int value) { } - public JsonPrimitive(long value) { } - public JsonPrimitive(sbyte value) { } - public JsonPrimitive(float value) { } - public JsonPrimitive(string value) { } - public JsonPrimitive(System.TimeSpan value) { } - public JsonPrimitive(ushort value) { } - public JsonPrimitive(uint value) { } - public JsonPrimitive(ulong value) { } - public JsonPrimitive(System.Uri value) { } - public override System.Json.JsonType JsonType { get { throw null; } } - public override void Save(System.IO.Stream stream) { } - } - public enum JsonType - { - Array = 3, - Boolean = 4, - Number = 1, - Object = 2, - String = 0, - } - public abstract partial class JsonValue : System.Collections.IEnumerable - { - protected JsonValue() { } - public virtual int Count { get { throw null; } } - public virtual System.Json.JsonValue this[int index] { get { throw null; } set { } } - public virtual System.Json.JsonValue this[string key] { get { throw null; } set { } } - public abstract System.Json.JsonType JsonType { get; } - public virtual bool ContainsKey(string key) { throw null; } - public static System.Json.JsonValue Load(System.IO.Stream stream) { throw null; } - public static System.Json.JsonValue Load(System.IO.TextReader textReader) { throw null; } - public static implicit operator System.Json.JsonValue (bool value) { throw null; } - public static implicit operator System.Json.JsonValue (byte value) { throw null; } - public static implicit operator System.Json.JsonValue (char value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTime value) { throw null; } - public static implicit operator System.Json.JsonValue (System.DateTimeOffset value) { throw null; } - public static implicit operator System.Json.JsonValue (decimal value) { throw null; } - public static implicit operator System.Json.JsonValue (double value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Guid value) { throw null; } - public static implicit operator System.Json.JsonValue (short value) { throw null; } - public static implicit operator System.Json.JsonValue (int value) { throw null; } - public static implicit operator System.Json.JsonValue (long value) { throw null; } - public static implicit operator bool (System.Json.JsonValue value) { throw null; } - public static implicit operator byte (System.Json.JsonValue value) { throw null; } - public static implicit operator char (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTime (System.Json.JsonValue value) { throw null; } - public static implicit operator System.DateTimeOffset (System.Json.JsonValue value) { throw null; } - public static implicit operator decimal (System.Json.JsonValue value) { throw null; } - public static implicit operator double (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Guid (System.Json.JsonValue value) { throw null; } - public static implicit operator short (System.Json.JsonValue value) { throw null; } - public static implicit operator int (System.Json.JsonValue value) { throw null; } - public static implicit operator long (System.Json.JsonValue value) { throw null; } - public static implicit operator sbyte (System.Json.JsonValue value) { throw null; } - public static implicit operator float (System.Json.JsonValue value) { throw null; } - public static implicit operator string (System.Json.JsonValue value) { throw null; } - public static implicit operator System.TimeSpan (System.Json.JsonValue value) { throw null; } - public static implicit operator ushort (System.Json.JsonValue value) { throw null; } - public static implicit operator uint (System.Json.JsonValue value) { throw null; } - public static implicit operator ulong (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Uri (System.Json.JsonValue value) { throw null; } - public static implicit operator System.Json.JsonValue (sbyte value) { throw null; } - public static implicit operator System.Json.JsonValue (float value) { throw null; } - public static implicit operator System.Json.JsonValue (string value) { throw null; } - public static implicit operator System.Json.JsonValue (System.TimeSpan value) { throw null; } - public static implicit operator System.Json.JsonValue (ushort value) { throw null; } - public static implicit operator System.Json.JsonValue (uint value) { throw null; } - public static implicit operator System.Json.JsonValue (ulong value) { throw null; } - public static implicit operator System.Json.JsonValue (System.Uri value) { throw null; } - public static System.Json.JsonValue Parse(string jsonString) { throw null; } - public virtual void Save(System.IO.Stream stream) { } - public virtual void Save(System.IO.TextWriter textWriter) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public override string ToString() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index 17df69285b..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bae8733212ee6cf090c0ef3b915c4d0129ca88fe \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6/System.Numerics.Vectors.cs b/external/binary-reference-assemblies/src/v4.6/System.Numerics.Vectors.cs deleted file mode 100644 index db256cfd6f..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Numerics.Vectors.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Numerics.Vectors.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityCriticalAttribute] -[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Matrix3x2))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Matrix4x4))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Plane))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Quaternion))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector2))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector3))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Vector4))] diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Core.cs deleted file mode 100644 index 56d5789d40..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Core.cs +++ /dev/null @@ -1,477 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Debugger.cs deleted file mode 100644 index 947bd7811a..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Debugger.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Debugger")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public partial class QueryDebugger - { - public QueryDebugger() { } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Experimental.cs deleted file mode 100644 index e6abcf6c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Experimental.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Interfaces.cs deleted file mode 100644 index 6053fabe3b..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Interfaces.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Interfaces Library containing essential interfaces.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Interfaces")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] -namespace System.Reactive -{ - public partial interface IEventPatternSource where TEventArgs : System.EventArgs - { - event System.EventHandler OnNext; - } - public partial interface IEventPattern where TEventArgs : System.EventArgs - { - TEventArgs EventArgs { get; } - TSender Sender { get; } - } - public partial interface IEventSource - { - event System.Action OnNext; - } - public partial interface IObserver - { - TResult OnCompleted(); - TResult OnError(System.Exception exception); - TResult OnNext(TValue value); - } -} -namespace System.Reactive.Concurrency -{ - public partial interface IScheduledItem - { - TAbsolute DueTime { get; } - void Invoke(); - } - public partial interface IScheduler - { - System.DateTimeOffset Now { get; } - System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action); - System.IDisposable Schedule(TState state, System.Func action); - System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - } - public partial interface ISchedulerLongRunning - { - System.IDisposable ScheduleLongRunning(TState state, System.Action action); - } - public partial interface ISchedulerPeriodic - { - System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action); - } - public partial interface IStopwatch - { - System.TimeSpan Elapsed { get; } - } - public partial interface IStopwatchProvider - { - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - } -} -namespace System.Reactive.Disposables -{ - public partial interface ICancelable : System.IDisposable - { - bool IsDisposed { get; } - } -} -namespace System.Reactive.Linq -{ - public partial interface IGroupedObservable : System.IObservable - { - TKey Key { get; } - } - public partial interface IQbservable - { - System.Type ElementType { get; } - System.Linq.Expressions.Expression Expression { get; } - System.Reactive.Linq.IQbservableProvider Provider { get; } - } - public partial interface IQbservableProvider - { - System.Reactive.Linq.IQbservable CreateQuery(System.Linq.Expressions.Expression expression); - } - public partial interface IQbservable : System.IObservable, System.Reactive.Linq.IQbservable - { - } -} -namespace System.Reactive.Subjects -{ - public partial interface IConnectableObservable : System.IObservable - { - System.IDisposable Connect(); - } - public partial interface ISubject : System.IObservable, System.IObserver, System.Reactive.Subjects.ISubject - { - } - public partial interface ISubject : System.IObservable, System.IObserver - { - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 6f7a384401..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f5b7e1f5e8f18e2e491af44627106e374224ab40 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Observable.Aliases.cs deleted file mode 100644 index dad78a51ad..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Observable.Aliases.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -namespace System.Reactive.Linq -{ - public static partial class QbservableAliases - { - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.IObservable other) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - } -} -namespace System.Reactive.Observable.Aliases -{ - public static partial class QueryLanguage - { - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.IObservable other) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.PlatformServices.cs deleted file mode 100644 index f73d1beba5..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.PlatformServices.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.PlatformServices")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public sealed partial class EventLoopScheduler : System.Reactive.Concurrency.LocalScheduler, System.IDisposable, System.Reactive.Concurrency.ISchedulerPeriodic - { - public EventLoopScheduler() { } - public EventLoopScheduler(System.Func threadFactory) { } - public void Dispose() { } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class NewThreadScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public NewThreadScheduler() { } - public NewThreadScheduler(System.Func threadFactory) { } - public static System.Reactive.Concurrency.NewThreadScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class TaskPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public TaskPoolScheduler(System.Threading.Tasks.TaskFactory taskFactory) { } - public static System.Reactive.Concurrency.TaskPoolScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class ThreadPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal ThreadPoolScheduler() { } - public static System.Reactive.Concurrency.ThreadPoolScheduler Instance { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class CurrentPlatformEnlightenmentProvider : System.Reactive.PlatformServices.IPlatformEnlightenmentProvider - { - public CurrentPlatformEnlightenmentProvider() { } - public virtual T GetService(object[] args) where T : class { throw null; } - } - public static partial class EnlightenmentProvider - { - public static bool EnsureLoaded() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Providers.cs.REMOVED.git-id deleted file mode 100644 index 9f8860276f..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Providers.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b241864ce9a6cb4a07386f059712e11501571c24 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Runtime.Remoting.cs deleted file mode 100644 index b1f6e4fe88..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Runtime.Remoting.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Runtime.Remoting")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public static partial class RemotingObservable - { - public static System.IObservable Remotable(this System.IObservable source) { throw null; } - public static System.IObservable Remotable(this System.IObservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Windows.Forms.cs deleted file mode 100644 index 9bee832064..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Windows.Forms.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Forms")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class ControlScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public ControlScheduler(System.Windows.Forms.Control control) { } - public System.Windows.Forms.Control Control { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ControlObservable - { - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/v4.6/System.Reactive.Windows.Threading.cs deleted file mode 100644 index 05157c7f24..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Reactive.Windows.Threading.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Threading")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class DispatcherScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) { } - public static System.Reactive.Concurrency.DispatcherScheduler Current { get { throw null; } } - public System.Windows.Threading.Dispatcher Dispatcher { get { throw null; } } - [System.ObsoleteAttribute("Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.DispatcherScheduler Instance { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class DispatcherObservable - { - public static System.IObservable ObserveOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - public static System.IObservable SubscribeOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Threading.Tasks.Dataflow.cs b/external/binary-reference-assemblies/src/v4.6/System.Threading.Tasks.Dataflow.cs deleted file mode 100644 index 2fe1d34bc3..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Threading.Tasks.Dataflow.cs +++ /dev/null @@ -1,386 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Dataflow.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} -namespace System.Threading.Tasks.Dataflow -{ - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.ActionBlock.DebugView")] - public sealed partial class ActionBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public ActionBlock(System.Action action) { } - public ActionBlock(System.Action action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public ActionBlock(System.Func action) { } - public ActionBlock(System.Func action, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public void Complete() { } - [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Post(TInput item) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchBlock.DebugView")] - public sealed partial class BatchBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BatchBlock(int batchSize) { } - public BatchBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T[] System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public void TriggerBatch() { } - public bool TryReceive(System.Predicate filter, out T[] item) { item = default(T[]); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BatchedJoinBlock.DebugView")] - public sealed partial class BatchedJoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>>, System.Threading.Tasks.Dataflow.ISourceBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> - { - public BatchedJoinBlock(int batchSize) { } - public BatchedJoinBlock(int batchSize, System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public int BatchSize { get { throw null; } } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock,System.Collections.Generic.IList,System.Collections.Generic.IList>>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock, System.Collections.Generic.IList, System.Collections.Generic.IList>> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate, System.Collections.Generic.IList, System.Collections.Generic.IList>> filter, out System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList> item) { item = default(System.Tuple, System.Collections.Generic.IList, System.Collections.Generic.IList>); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>> items) { items = default(System.Collections.Generic.IList, System.Collections.Generic.IList, System.Collections.Generic.IList>>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BroadcastBlock.DebugView")] - public sealed partial class BroadcastBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BroadcastBlock(System.Func cloningFunction) { } - public BroadcastBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.BufferBlock.DebugView")] - public sealed partial class BufferBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public BufferBlock() { } - public BufferBlock(System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int Count { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - public static partial class DataflowBlock - { - public static System.IObservable AsObservable(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IObserver AsObserver(this System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3) { throw null; } - public static System.Threading.Tasks.Task Choose(System.Threading.Tasks.Dataflow.ISourceBlock source1, System.Action action1, System.Threading.Tasks.Dataflow.ISourceBlock source2, System.Action action2, System.Threading.Tasks.Dataflow.ISourceBlock source3, System.Action action3, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { throw null; } - public static System.Threading.Tasks.Dataflow.IPropagatorBlock Encapsulate(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Predicate predicate) { throw null; } - public static System.IDisposable LinkTo(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions, System.Predicate predicate) { throw null; } - public static System.Threading.Tasks.Dataflow.ITargetBlock NullTarget() { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task OutputAvailableAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool Post(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static System.Threading.Tasks.Task ReceiveAsync(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.Threading.CancellationToken cancellationToken) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout) { throw null; } - public static TOutput Receive(this System.Threading.Tasks.Dataflow.ISourceBlock source, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item) { throw null; } - public static System.Threading.Tasks.Task SendAsync(this System.Threading.Tasks.Dataflow.ITargetBlock target, TInput item, System.Threading.CancellationToken cancellationToken) { throw null; } - public static bool TryReceive(this System.Threading.Tasks.Dataflow.IReceivableSourceBlock source, out TOutput item) { item = default(TOutput); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}")] - public partial class DataflowBlockOptions - { - public const int Unbounded = -1; - public DataflowBlockOptions() { } - public int BoundedCapacity { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } } - public int MaxMessagesPerTask { get { throw null; } set { } } - public string NameFormat { get { throw null; } set { } } - public System.Threading.Tasks.TaskScheduler TaskScheduler { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("PropagateCompletion = {PropagateCompletion}, MaxMessages = {MaxMessages}, Append = {Append}")] - public partial class DataflowLinkOptions - { - public DataflowLinkOptions() { } - public bool Append { get { throw null; } set { } } - public int MaxMessages { get { throw null; } set { } } - public bool PropagateCompletion { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}")] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct DataflowMessageHeader : System.IEquatable - { - public DataflowMessageHeader(long id) { throw null;} - public long Id { get { throw null; } } - public bool IsValid { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Threading.Tasks.Dataflow.DataflowMessageHeader other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - public static bool operator !=(System.Threading.Tasks.Dataflow.DataflowMessageHeader left, System.Threading.Tasks.Dataflow.DataflowMessageHeader right) { throw null; } - } - public enum DataflowMessageStatus - { - Accepted = 0, - Declined = 1, - DecliningPermanently = 4, - NotAvailable = 3, - Postponed = 2, - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, MaxDegreeOfParallelism = {MaxDegreeOfParallelism}")] - public partial class ExecutionDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public ExecutionDataflowBlockOptions() { } - public int MaxDegreeOfParallelism { get { throw null; } set { } } - public bool SingleProducerConstrained { get { throw null; } set { } } - } - [System.Diagnostics.DebuggerDisplayAttribute("TaskScheduler = {TaskScheduler}, MaxMessagesPerTask = {MaxMessagesPerTask}, BoundedCapacity = {BoundedCapacity}, Greedy = {Greedy}, MaxNumberOfGroups = {MaxNumberOfGroups}")] - public partial class GroupingDataflowBlockOptions : System.Threading.Tasks.Dataflow.DataflowBlockOptions - { - public GroupingDataflowBlockOptions() { } - public bool Greedy { get { throw null; } set { } } - public long MaxNumberOfGroups { get { throw null; } set { } } - } - public partial interface IDataflowBlock - { - System.Threading.Tasks.Task Completion { get; } - void Complete(); - void Fault(System.Exception exception); - } - public partial interface IPropagatorBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - } - public partial interface IReceivableSourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.ISourceBlock - { - bool TryReceive(System.Predicate filter, out TOutput item); - bool TryReceiveAll(out System.Collections.Generic.IList items); - } - public partial interface ISourceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - TOutput ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed); - System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions); - void ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - bool ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target); - } - public partial interface ITargetBlock : System.Threading.Tasks.Dataflow.IDataflowBlock - { - System.Threading.Tasks.Dataflow.DataflowMessageStatus OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept); - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.JoinBlock.DebugView")] - public sealed partial class JoinBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock>, System.Threading.Tasks.Dataflow.ISourceBlock> - { - public JoinBlock() { } - public JoinBlock(System.Threading.Tasks.Dataflow.GroupingDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int OutputCount { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target1 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target2 { get { throw null; } } - public System.Threading.Tasks.Dataflow.ITargetBlock Target3 { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock> target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - System.Tuple System.Threading.Tasks.Dataflow.ISourceBlock>.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock>.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock>.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock> target) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate> filter, out System.Tuple item) { item = default(System.Tuple); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList> items) { items = default(System.Collections.Generic.IList>); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformBlock.DebugView")] - public sealed partial class TransformBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformBlock(System.Func> transform) { } - public TransformBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformBlock(System.Func transform) { } - public TransformBlock(System.Func transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.TransformManyBlock.DebugView")] - public sealed partial class TransformManyBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public TransformManyBlock(System.Func> transform) { } - public TransformManyBlock(System.Func> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public TransformManyBlock(System.Func>> transform) { } - public TransformManyBlock(System.Func>> transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public int InputCount { get { throw null; } } - public int OutputCount { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - TOutput System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, TInput messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out TOutput item) { item = default(TOutput); throw null; } - public bool TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - } - [System.Diagnostics.DebuggerDisplayAttribute("{DebuggerDisplayContent,nq}")] - [System.Diagnostics.DebuggerTypeProxyAttribute("System.Threading.Tasks.Dataflow.WriteOnceBlock.DebugView")] - public sealed partial class WriteOnceBlock : System.Threading.Tasks.Dataflow.IDataflowBlock, System.Threading.Tasks.Dataflow.IPropagatorBlock, System.Threading.Tasks.Dataflow.IReceivableSourceBlock, System.Threading.Tasks.Dataflow.ISourceBlock, System.Threading.Tasks.Dataflow.ITargetBlock - { - public WriteOnceBlock(System.Func cloningFunction) { } - public WriteOnceBlock(System.Func cloningFunction, System.Threading.Tasks.Dataflow.DataflowBlockOptions dataflowBlockOptions) { } - public System.Threading.Tasks.Task Completion { get { throw null; } } - public void Complete() { } - public System.IDisposable LinkTo(System.Threading.Tasks.Dataflow.ITargetBlock target, System.Threading.Tasks.Dataflow.DataflowLinkOptions linkOptions) { throw null; } - void System.Threading.Tasks.Dataflow.IDataflowBlock.Fault(System.Exception exception) { } - bool System.Threading.Tasks.Dataflow.IReceivableSourceBlock.TryReceiveAll(out System.Collections.Generic.IList items) { items = default(System.Collections.Generic.IList); throw null; } - T System.Threading.Tasks.Dataflow.ISourceBlock.ConsumeMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target, out bool messageConsumed) { messageConsumed = default(bool); throw null; } - void System.Threading.Tasks.Dataflow.ISourceBlock.ReleaseReservation(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { } - bool System.Threading.Tasks.Dataflow.ISourceBlock.ReserveMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, System.Threading.Tasks.Dataflow.ITargetBlock target) { throw null; } - System.Threading.Tasks.Dataflow.DataflowMessageStatus System.Threading.Tasks.Dataflow.ITargetBlock.OfferMessage(System.Threading.Tasks.Dataflow.DataflowMessageHeader messageHeader, T messageValue, System.Threading.Tasks.Dataflow.ISourceBlock source, bool consumeToAccept) { throw null; } - public override string ToString() { throw null; } - public bool TryReceive(System.Predicate filter, out T item) { item = default(T); throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.6/System.Web.Http.SelfHost.cs deleted file mode 100644 index a4291c06a6..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.6/System.Web.Http.WebHost.cs deleted file mode 100644 index f597301777..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index 745e684454..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -fe44ff1016ed9ae87ab211c14696686eb050f2eb \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index c9be32f181..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7d7fc3daa8f6707479cbab03b6eb09c830d567dc \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.6/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index fc84720be3..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -94acbffb2222940a920562ec77e60b02323dc392 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.Deployment.cs deleted file mode 100644 index 1991df0aea..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.Razor.cs deleted file mode 100644 index 1a404139b4..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.cs deleted file mode 100644 index e5ae55ad80..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/System.Web.WebPages.cs +++ /dev/null @@ -1,776 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.6.57.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.6/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.6/cscompmgd.cs deleted file mode 100644 index 1785b32f39..0000000000 --- a/external/binary-reference-assemblies/src/v4.6/cscompmgd.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7.1/Accessibility.cs b/external/binary-reference-assemblies/src/v4.7.1/Accessibility.cs new file mode 100644 index 0000000000..aa22f29dcc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Accessibility.cs @@ -0,0 +1,144 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(257))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Accessibility.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Accessibility.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Accessibility.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(true)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.InteropServices.GuidAttribute("1EA4DBF0-3C3B-11CF-810C-00AA00389B71")] +[assembly:System.Runtime.InteropServices.ImportedFromTypeLibAttribute("Accessibility")] +[assembly:System.Runtime.InteropServices.TypeLibVersionAttribute(1, 1)] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +namespace Accessibility +{ + public enum AnnoScope + { + ANNO_CONTAINER = 1, + ANNO_THIS = 0, + } + [System.Runtime.InteropServices.CoClassAttribute(typeof(Accessibility.CAccPropServicesClass))] + [System.Runtime.InteropServices.GuidAttribute("6E26E776-04F0-495D-80E4-3330352E3169")] + public partial interface CAccPropServices : Accessibility.IAccPropServices + { + } + [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))] + [System.Runtime.InteropServices.ComConversionLossAttribute] + [System.Runtime.InteropServices.GuidAttribute("B5F8350B-0548-48B1-A6EE-88BD00B4A5E7")] + [System.Runtime.InteropServices.TypeLibTypeAttribute((System.Runtime.InteropServices.TypeLibTypeFlags)(2))] + public partial class CAccPropServicesClass : Accessibility.CAccPropServices, Accessibility.IAccPropServices + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public CAccPropServicesClass() { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void ClearHmenuProps([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void ClearHwndProps([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void ClearProps([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void ComposeHmenuIdentityString([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.Out]System.IntPtr ppIDString, out uint pdwIDStringLen) { ppIDString = default(System.IntPtr); pdwIDStringLen = default(uint); } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void ComposeHwndIdentityString([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.Out]System.IntPtr ppIDString, out uint pdwIDStringLen) { ppIDString = default(System.IntPtr); pdwIDStringLen = default(uint); } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void DecomposeHmenuIdentityString([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.Out]System.IntPtr phmenu, out uint pidChild) { phmenu = default(System.IntPtr); pidChild = default(uint); } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void DecomposeHwndIdentityString([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.Out]System.IntPtr phwnd, out uint pidObject, out uint pidChild) { phwnd = default(System.IntPtr); pidObject = default(uint); pidChild = default(uint); } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetHmenuProp([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]object var) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetHmenuPropServer([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]Accessibility.IAccPropServer pServer, [System.Runtime.InteropServices.In]Accessibility.AnnoScope AnnoScope) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetHmenuPropStr([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]string str) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetHwndProp([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]object var) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetHwndPropServer([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]Accessibility.IAccPropServer pServer, [System.Runtime.InteropServices.In]Accessibility.AnnoScope AnnoScope) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetHwndPropStr([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]string str) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetPropServer([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]Accessibility.IAccPropServer pServer, [System.Runtime.InteropServices.In]Accessibility.AnnoScope AnnoScope) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public virtual void SetPropValue([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]object var) { } + } + [System.Runtime.InteropServices.GuidAttribute("618736E0-3C3D-11CF-810C-00AA00389B71")] + [System.Runtime.InteropServices.TypeLibTypeAttribute((System.Runtime.InteropServices.TypeLibTypeFlags)(4176))] + public partial interface IAccessible + { + int accChildCount { get; } + object accFocus { get; } + object accParent { get; } + object accSelection { get; } + void accDoDefaultAction(object childID); + object accHitTest(int xLeft, int yTop); + void accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID); + object accNavigate(int navDir, object childID); + void accSelect(int flagsSelect, object childID); + object get_accChild(object childID); + string get_accDefaultAction(object childID); + string get_accDescription(object childID); + string get_accHelp(object childID); + int get_accHelpTopic(out string pszHelpFile, object childID); + string get_accKeyboardShortcut(object childID); + string get_accName(object childID); + object get_accRole(object childID); + object get_accState(object childID); + string get_accValue(object childID); + void set_accName(object childID, string newName); + void set_accValue(object childID, string newValue); + } + [System.Runtime.InteropServices.GuidAttribute("03022430-ABC4-11D0-BDE2-00AA001A1953")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + [System.Runtime.InteropServices.TypeLibTypeAttribute((System.Runtime.InteropServices.TypeLibTypeFlags)(272))] + public partial interface IAccessibleHandler + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void AccessibleObjectFromID([System.Runtime.InteropServices.In]int hwnd, [System.Runtime.InteropServices.In]int lObjectID, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]out Accessibility.IAccessible pIAccessible); + } + [System.Runtime.InteropServices.ComConversionLossAttribute] + [System.Runtime.InteropServices.GuidAttribute("7852B78D-1CFD-41C1-A615-9C0C85960B5F")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IAccIdentity + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void GetIdentityString([System.Runtime.InteropServices.In]uint dwIDChild, [System.Runtime.InteropServices.Out]System.IntPtr ppIDString, out uint pdwIDStringLen); + } + [System.Runtime.InteropServices.GuidAttribute("76C0DBBB-15E0-4E7B-B61B-20EEEA2001E0")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IAccPropServer + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void GetPropValue([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]out object pvarValue, out int pfHasProp); + } + [System.Runtime.InteropServices.ComConversionLossAttribute] + [System.Runtime.InteropServices.GuidAttribute("6E26E776-04F0-495D-80E4-3330352E3169")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IAccPropServices + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void ClearHmenuProps([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void ClearHwndProps([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void ClearProps([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void ComposeHmenuIdentityString([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.Out]System.IntPtr ppIDString, out uint pdwIDStringLen); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void ComposeHwndIdentityString([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.Out]System.IntPtr ppIDString, out uint pdwIDStringLen); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void DecomposeHmenuIdentityString([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.Out]System.IntPtr phmenu, out uint pidChild); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void DecomposeHwndIdentityString([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.Out]System.IntPtr phwnd, out uint pidObject, out uint pidChild); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetHmenuProp([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]object var); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetHmenuPropServer([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]Accessibility.IAccPropServer pServer, [System.Runtime.InteropServices.In]Accessibility.AnnoScope AnnoScope); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetHmenuPropStr([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHMENU")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hmenu, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]string str); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetHwndProp([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]object var); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetHwndPropServer([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]Accessibility.IAccPropServer pServer, [System.Runtime.InteropServices.In]Accessibility.AnnoScope AnnoScope); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetHwndPropStr([System.Runtime.InteropServices.ComAliasNameAttribute("Accessibility.wireHWND")][System.Runtime.InteropServices.In]ref Accessibility._RemotableHandle hwnd, [System.Runtime.InteropServices.In]uint idObject, [System.Runtime.InteropServices.In]uint idChild, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]string str); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetPropServer([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]ref System.Guid paProps, [System.Runtime.InteropServices.In]int cProps, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Interface)]Accessibility.IAccPropServer pServer, [System.Runtime.InteropServices.In]Accessibility.AnnoScope AnnoScope); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]void SetPropValue([System.Runtime.InteropServices.In]ref byte pIDString, [System.Runtime.InteropServices.In]uint dwIDStringLen, [System.Runtime.InteropServices.In]System.Guid idProp, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)]object var); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=4)] + public partial struct _RemotableHandle + { + public int fContext; + public Accessibility.__MIDL_IWinTypes_0009 u; + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Explicit, Size=4, Pack=4)] + public partial struct __MIDL_IWinTypes_0009 + { + [System.Runtime.InteropServices.FieldOffsetAttribute(0)] + public int hInproc; + [System.Runtime.InteropServices.FieldOffsetAttribute(0)] + public int hRemote; + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/CustomMarshalers.cs b/external/binary-reference-assemblies/src/v4.7.1/CustomMarshalers.cs new file mode 100644 index 0000000000..58047ce504 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/CustomMarshalers.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("CustomMarshalers.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("CustomMarshalers.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.30319.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("CustomMarshalers.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Runtime.InteropServices.CustomMarshalers +{ + public partial class EnumerableToDispatchMarshaler : System.Runtime.InteropServices.ICustomMarshaler + { + internal EnumerableToDispatchMarshaler() { } + public virtual void CleanUpManagedData(object pManagedObj) { } + public virtual void CleanUpNativeData(System.IntPtr pNativeData) { } + public static System.Runtime.InteropServices.ICustomMarshaler GetInstance(string pstrCookie) { throw null; } + public virtual int GetNativeDataSize() { throw null; } + public virtual System.IntPtr MarshalManagedToNative(object pManagedObj) { throw null; } + public virtual object MarshalNativeToManaged(System.IntPtr pNativeData) { throw null; } + } + public partial class EnumeratorToEnumVariantMarshaler : System.Runtime.InteropServices.ICustomMarshaler + { + internal EnumeratorToEnumVariantMarshaler() { } + public virtual void CleanUpManagedData(object pManagedObj) { } + public virtual void CleanUpNativeData(System.IntPtr pNativeData) { } + public static System.Runtime.InteropServices.ICustomMarshaler GetInstance(string pstrCookie) { throw null; } + public virtual int GetNativeDataSize() { throw null; } + public virtual System.IntPtr MarshalManagedToNative(object pManagedObj) { throw null; } + public virtual object MarshalNativeToManaged(System.IntPtr pNativeData) { throw null; } + } + public partial class ExpandoToDispatchExMarshaler : System.Runtime.InteropServices.ICustomMarshaler + { + internal ExpandoToDispatchExMarshaler() { } + public virtual void CleanUpManagedData(object pManagedObj) { } + public virtual void CleanUpNativeData(System.IntPtr pNativeData) { } + public static System.Runtime.InteropServices.ICustomMarshaler GetInstance(string pstrCookie) { throw null; } + public virtual int GetNativeDataSize() { throw null; } + public virtual System.IntPtr MarshalManagedToNative(object pManagedObj) { throw null; } + public virtual object MarshalNativeToManaged(System.IntPtr pNativeData) { throw null; } + } + public partial class TypeToTypeInfoMarshaler : System.Runtime.InteropServices.ICustomMarshaler + { + internal TypeToTypeInfoMarshaler() { } + public virtual void CleanUpManagedData(object pManagedObj) { } + public virtual void CleanUpNativeData(System.IntPtr pNativeData) { } + public static System.Runtime.InteropServices.ICustomMarshaler GetInstance(string pstrCookie) { throw null; } + public virtual int GetNativeDataSize() { throw null; } + public virtual System.IntPtr MarshalManagedToNative(object pManagedObj) { throw null; } + public virtual object MarshalNativeToManaged(System.IntPtr pNativeData) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/Microsoft.Win32.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/Microsoft.Win32.Primitives.cs new file mode 100644 index 0000000000..5f4b39d914 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/Microsoft.Win32.Primitives.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Win32.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Win32.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Win32.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Win32Exception))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.AppContext.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.AppContext.cs new file mode 100644 index 0000000000..dd27c57c66 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.AppContext.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.AppContext")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.AppContext")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.AppContext")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AppContext))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.Concurrent.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.Concurrent.cs new file mode 100644 index 0000000000..b7300c69a4 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.Concurrent.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Concurrent")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Concurrent")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Concurrent")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.BlockingCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.ConcurrentBag<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.ConcurrentDictionary<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.ConcurrentQueue<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.ConcurrentStack<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.EnumerablePartitionerOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.IProducerConsumerCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.OrderablePartitioner<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.Partitioner))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Concurrent.Partitioner<>))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.NonGeneric.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.NonGeneric.cs new file mode 100644 index 0000000000..452a9deb54 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.NonGeneric.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.NonGeneric")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.NonGeneric")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.NonGeneric")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ArrayList))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.CaseInsensitiveComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.CollectionBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Comparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.DictionaryBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Hashtable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Queue))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ReadOnlyCollectionBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.SortedList))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.CollectionsUtil))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Stack))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.Specialized.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.Specialized.cs new file mode 100644 index 0000000000..93b2731f38 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.Specialized.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections.Specialized")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections.Specialized")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections.Specialized")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.BitVector32))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.HybridDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.IOrderedDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.ListDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NameObjectCollectionBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NameValueCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.OrderedDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.StringCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.StringDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.StringEnumerator))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.cs new file mode 100644 index 0000000000..64f6714de8 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Collections.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Collections")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Collections")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Collections")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.BitArray))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.Comparer<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.Dictionary<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.EqualityComparer<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.HashSet<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.LinkedList<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.LinkedListNode<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.List<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.Queue<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.SortedDictionary<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.SortedList<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.SortedSet<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.Stack<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.StructuralComparisons))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.Annotations.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.Annotations.cs new file mode 100644 index 0000000000..a3d0c4f514 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.Annotations.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Annotations")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Annotations")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Annotations")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.AssociationAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.CompareAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.ConcurrencyCheckAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.CreditCardAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.CustomValidationAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.DataType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.DataTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.DisplayAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.DisplayColumnAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.DisplayFormatAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.EditableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.EmailAddressAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.EnumDataTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.FileExtensionsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.FilterUIHintAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.IValidatableObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.KeyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.MaxLengthAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.MinLengthAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.PhoneAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.RangeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.RegularExpressionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.RequiredAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.ScaffoldColumnAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.ColumnAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.ComplexTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.ForeignKeyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.InversePropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.NotMappedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.TableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.StringLengthAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.TimestampAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.UIHintAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.UrlAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.ValidationAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.ValidationContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.ValidationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.ValidationResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataAnnotations.Validator))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.EventBasedAsync.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.EventBasedAsync.cs new file mode 100644 index 0000000000..7edf62d0cf --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.EventBasedAsync.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.EventBasedAsync")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.EventBasedAsync")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.EventBasedAsync")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncCompletedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncCompletedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncOperation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AsyncOperationManager))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BackgroundWorker))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DoWorkEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DoWorkEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ProgressChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ProgressChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RunWorkerCompletedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RunWorkerCompletedEventHandler))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.Primitives.cs new file mode 100644 index 0000000000..9ef04acb31 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.Primitives.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BrowsableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CategoryAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ComponentCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DescriptionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignerCategoryAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignerSerializationVisibility))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignerSerializationVisibilityAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DesignOnlyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DisplayNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EventHandlerList))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IComponent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IContainer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ImmutableObjectAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.InitializationEventAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ISite))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.LocalizableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.MergablePropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.NotifyParentPropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ParenthesizePropertyNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ReadOnlyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshProperties))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshPropertiesAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.TypeConverter.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.TypeConverter.cs new file mode 100644 index 0000000000..946c780eb9 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.TypeConverter.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.TypeConverter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.TypeConverter")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.TypeConverter")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ArrayConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AttributeCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.AttributeProviderAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BaseNumberConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.BooleanConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ByteConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CancelEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CharConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionChangeAction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionChangeEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionChangeEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CollectionConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CustomTypeDescriptor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DateTimeConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DateTimeOffsetConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DecimalConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DefaultEventAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DefaultPropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DoubleConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EnumConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EventDescriptor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EventDescriptorCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ExtenderProvidedPropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.GuidConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.HandledEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.HandledEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ICustomTypeDescriptor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IExtenderProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IListSource))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Int16Converter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Int32Converter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.Int64Converter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.InvalidAsynchronousStateException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ITypeDescriptorContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ITypedList))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.MemberDescriptor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.MultilineStringConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.NullableConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyDescriptor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyDescriptorCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.ProvidePropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.RefreshEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.SByteConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.SingleConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.StringConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TimeSpanConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeConverterAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeDescriptionProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeDescriptionProviderAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeDescriptor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.TypeListConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.UInt16Converter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.UInt32Converter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.UInt64Converter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTypeConverter))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.cs new file mode 100644 index 0000000000..3fcc19de7c --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ComponentModel.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.CancelEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IChangeTracking))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IEditableObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.IRevertibleChangeTracking))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IServiceProvider))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Console.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Console.cs new file mode 100644 index 0000000000..fc1d36e163 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Console.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Console")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Console")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Console")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Console))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleCancelEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleCancelEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleColor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleKey))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleKeyInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleModifiers))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ConsoleSpecialKey))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Data.Common.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Data.Common.cs new file mode 100644 index 0000000000..6abc2026ff --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Data.Common.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Common")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Common")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Common")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.CommandBehavior))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.CommandType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbColumn))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbCommand))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbConnection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbConnectionStringBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataReaderExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbDataRecord))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbParameter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbParameterCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbProviderFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.DbTransaction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.Common.IDbColumnSchemaGenerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ConnectionState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataRowVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DataTable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.DbType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataParameter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataParameterCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDataRecord))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbCommand))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbConnection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbDataParameter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IDbTransaction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.IsolationLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.ParameterDirection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StateChangeEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.StateChangeEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.UpdateRowSource))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DBNull))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Contracts.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Contracts.cs new file mode 100644 index 0000000000..0302a16bd1 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Contracts.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Contracts")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Contracts")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Contracts")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.Contract))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractAbbreviatorAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractArgumentValidatorAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractClassAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractClassForAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractFailedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractFailureKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractInvariantMethodAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractOptionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractPublicPropertyNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractReferenceAssemblyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractRuntimeIgnoredAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.ContractVerificationAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Contracts.PureAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ContractHelper))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Debug.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Debug.cs new file mode 100644 index 0000000000..9d1d6d1946 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Debug.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Debug")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Debug")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Debug")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Debug))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Debugger))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerBrowsableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerBrowsableState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerDisplayAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerHiddenAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerNonUserCodeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerStepThroughAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggerTypeProxyAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.FileVersionInfo.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.FileVersionInfo.cs new file mode 100644 index 0000000000..a9aae64fb5 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.FileVersionInfo.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.FileVersionInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.FileVersionInfo")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.FileVersionInfo")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.FileVersionInfo))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Process.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Process.cs new file mode 100644 index 0000000000..ada19e6d21 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Process.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Process")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Process")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Process")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeProcessHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DataReceivedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DataReceivedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Process))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ProcessModule))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ProcessModuleCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ProcessPriorityClass))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ProcessStartInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ProcessThread))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ProcessThreadCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ThreadPriorityLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ThreadState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ThreadWaitReason))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.StackTrace.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.StackTrace.cs new file mode 100644 index 0000000000..f67df93607 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.StackTrace.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.4.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.StackTrace")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.StackTrace")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.StackTrace")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrame))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackFrameExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.StackTrace))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.TextWriterTraceListener.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.TextWriterTraceListener.cs new file mode 100644 index 0000000000..e0e3a6cf01 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.TextWriterTraceListener.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TextWriterTraceListener")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TextWriterTraceListener")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TextWriterTraceListener")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DelimitedListTraceListener))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TextWriterTraceListener))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Tools.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Tools.cs new file mode 100644 index 0000000000..ddbc5131dd --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.Tools.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tools")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tools")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tools")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.CodeAnalysis.SuppressMessageAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.TraceSource.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.TraceSource.cs new file mode 100644 index 0000000000..10509ca49a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Diagnostics.TraceSource.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.TraceSource")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.TraceSource")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.TraceSource")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.BooleanSwitch))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DefaultTraceListener))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.EventTypeFilter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SourceFilter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SourceLevels))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.SourceSwitch))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Switch))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Trace))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceEventCache))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceEventType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceFilter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceListener))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceListenerCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceSource))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.TraceSwitch))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Drawing.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Drawing.Primitives.cs new file mode 100644 index 0000000000..9e4392622b --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Drawing.Primitives.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Point))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.PointF))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Rectangle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.RectangleF))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Size))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SizeF))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Dynamic.Runtime.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Dynamic.Runtime.cs new file mode 100644 index 0000000000..fa6c958955 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Dynamic.Runtime.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.Runtime")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.Runtime")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BinaryOperationBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BindingRestrictions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.CallInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.ConvertBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.CreateInstanceBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.DeleteIndexBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.DeleteMemberBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.DynamicMetaObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.DynamicMetaObjectBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.DynamicObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.ExpandoObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.GetIndexBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.GetMemberBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.IDynamicMetaObjectProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.IInvokeOnGetBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.InvokeBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.InvokeMemberBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.SetIndexBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.SetMemberBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.UnaryOperationBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.DynamicExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.DynamicExpressionVisitor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSite))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSite<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSiteBinder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSiteHelpers))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConditionalWeakTable<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DynamicAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.Calendars.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.Calendars.cs new file mode 100644 index 0000000000..12e7916c23 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.Calendars.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Calendars")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Calendars")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Calendars")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.ChineseLunisolarCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.EastAsianLunisolarCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.GregorianCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.GregorianCalendarTypes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.HebrewCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.HijriCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.JapaneseCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.JapaneseLunisolarCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.JulianCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.KoreanCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.KoreanLunisolarCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.PersianCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.TaiwanCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.TaiwanLunisolarCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.ThaiBuddhistCalendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.UmAlQuraCalendar))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.Extensions.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.Extensions.cs new file mode 100644 index 0000000000..7a6ca61feb --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.Extensions.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization.Extensions")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization.Extensions")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.GlobalizationExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.IdnMapping))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.StringNormalizationExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.NormalizationForm))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.cs new file mode 100644 index 0000000000..56eb107af0 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Globalization.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Globalization")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Globalization")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Globalization")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.Calendar))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.CalendarWeekRule))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.CharUnicodeInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.CompareInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.CompareOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.CultureInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.CultureNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.DateTimeFormatInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.NumberFormatInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.RegionInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.StringInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.TextElementEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.TextInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.UnicodeCategory))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.Compression.ZipFile.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.Compression.ZipFile.cs new file mode 100644 index 0000000000..c5db051c10 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.Compression.ZipFile.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.ZipFile")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.ZipFile")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.ZipFile")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipFile))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.ZipFileExtensions))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.DriveInfo.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.DriveInfo.cs new file mode 100644 index 0000000000..3ea8d4b71b --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.DriveInfo.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.DriveInfo")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.DriveInfo")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.DriveInfo")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DriveInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DriveNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DriveType))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.Primitives.cs new file mode 100644 index 0000000000..73355a1466 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.Primitives.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileAccess))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileShare))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.Watcher.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.Watcher.cs new file mode 100644 index 0000000000..364c843def --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.Watcher.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem.Watcher")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem.Watcher")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem.Watcher")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.ErrorEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.ErrorEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileSystemEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileSystemEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileSystemWatcher))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.NotifyFilters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.RenamedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.RenamedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.WaitForChangedResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.WatcherChangeTypes))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.cs new file mode 100644 index 0000000000..4be49c847d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.FileSystem.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.FileSystem")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.FileSystem")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.FileSystem")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeFileHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Directory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DirectoryInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.File))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileSystemInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.SearchOption))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.IsolatedStorage.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.IsolatedStorage.cs new file mode 100644 index 0000000000..df85596538 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.IsolatedStorage.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.IsolatedStorage")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.IsolatedStorage")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.IsolatedStorage")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IsolatedStorage.IsolatedStorageException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IsolatedStorage.IsolatedStorageFile))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IsolatedStorage.IsolatedStorageFileStream))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.MemoryMappedFiles.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.MemoryMappedFiles.cs new file mode 100644 index 0000000000..f268ae5380 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.MemoryMappedFiles.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.MemoryMappedFiles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.MemoryMappedFiles")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.MemoryMappedFiles")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeMemoryMappedFileHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeMemoryMappedViewHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryMappedFiles.MemoryMappedFile))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryMappedFiles.MemoryMappedFileAccess))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryMappedFiles.MemoryMappedFileOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryMappedFiles.MemoryMappedFileRights))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryMappedFiles.MemoryMappedViewAccessor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryMappedFiles.MemoryMappedViewStream))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.Pipes.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.Pipes.cs new file mode 100644 index 0000000000..8b36126afd --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.Pipes.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Pipes")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Pipes")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Pipes")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafePipeHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.AnonymousPipeClientStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.AnonymousPipeServerStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.NamedPipeClientStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.NamedPipeServerStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.PipeDirection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.PipeOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.PipeStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Pipes.PipeTransmissionMode))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.UnmanagedMemoryStream.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.UnmanagedMemoryStream.cs new file mode 100644 index 0000000000..a78c1020c4 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.UnmanagedMemoryStream.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.UnmanagedMemoryStream")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.UnmanagedMemoryStream")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.UnmanagedMemoryStream")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.UnmanagedMemoryAccessor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.UnmanagedMemoryStream))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.cs new file mode 100644 index 0000000000..ddc4d5214f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.IO.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BinaryReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BinaryWriter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.BufferedStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.EndOfStreamException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.InvalidDataException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IOException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.MemoryStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.SeekOrigin))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Stream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.StreamReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.StreamWriter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.StringReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.StringWriter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.TextReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.TextWriter))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Expressions.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Expressions.cs new file mode 100644 index 0000000000..7c388d9506 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Expressions.cs @@ -0,0 +1,61 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Expressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Expressions")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Expressions")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BinaryExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.BlockExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.CatchBlock))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ConditionalExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ConstantExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.DebugInfoExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.DefaultExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ElementInit))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.Expression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.Expression<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ExpressionType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ExpressionVisitor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.GotoExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.GotoExpressionKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IArgumentProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IDynamicExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.IndexExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.InvocationExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.LabelExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.LabelTarget))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.LambdaExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ListInitExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.LoopExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberAssignment))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberBindingType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberInitExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberListBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MemberMemberBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.MethodCallExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.NewArrayExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.NewExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.ParameterExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.RuntimeVariablesExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.SwitchCase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.SwitchExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.SymbolDocumentInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.TryExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.TypeBinaryExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Expressions.UnaryExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IOrderedQueryable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IOrderedQueryable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IQueryable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IQueryable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IQueryProvider))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Parallel.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Parallel.cs new file mode 100644 index 0000000000..894a33b2c0 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Parallel.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Parallel")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Parallel")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.OrderedParallelQuery<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.ParallelEnumerable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.ParallelExecutionMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.ParallelMergeOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.ParallelQuery))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.ParallelQuery<>))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Queryable.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Queryable.cs new file mode 100644 index 0000000000..9dc63fea3c --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.Queryable.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq.Queryable")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq.Queryable")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq.Queryable")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableExecutor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableExecutor<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableQuery))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.EnumerableQuery<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Queryable))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.cs new file mode 100644 index 0000000000..6930064d4d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Linq.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Linq")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Linq")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Linq")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Enumerable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IGrouping<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.ILookup<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.IOrderedEnumerable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Linq.Lookup<,>))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Http.Rtc.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Http.Rtc.cs new file mode 100644 index 0000000000..69f3786dc6 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Http.Rtc.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Http.Rtc.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Http.Rtc.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Http.Rtc.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +#if false // it is forwarded to System.Net.Http.WebRequest.dll but doesn't actually exist there in the .NET 4.7.1 reference assemblies ... +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Http.RtcRequestFactory))] +#endif diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.NameResolution.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.NameResolution.cs new file mode 100644 index 0000000000..73ea2ca36a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.NameResolution.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NameResolution")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NameResolution")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NameResolution")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Dns))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IPHostEntry))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.NetworkInformation.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.NetworkInformation.cs new file mode 100644 index 0000000000..471a59b8ed --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.NetworkInformation.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.NetworkInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.NetworkInformation")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.NetworkInformation")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.DuplicateAddressDetectionState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.GatewayIPAddressInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.GatewayIPAddressInformationCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IcmpV4Statistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IcmpV6Statistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPAddressInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPAddressInformationCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPGlobalProperties))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPGlobalStatistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPInterfaceProperties))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPInterfaceStatistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPv4InterfaceProperties))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPv4InterfaceStatistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPv6InterfaceProperties))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.MulticastIPAddressInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.MulticastIPAddressInformationCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetBiosNodeType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkAddressChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkChange))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkInformationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkInterface))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkInterfaceComponent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkInterfaceType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.OperationalStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PhysicalAddress))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PrefixOrigin))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.ScopeLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.SuffixOrigin))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.TcpConnectionInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.TcpState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.TcpStatistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.UdpStatistics))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.UnicastIPAddressInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.UnicastIPAddressInformationCollection))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Ping.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Ping.cs new file mode 100644 index 0000000000..69b0da77dc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Ping.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Ping")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Ping")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Ping")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.Ping))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingReply))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Primitives.cs new file mode 100644 index 0000000000..510e23eb9d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Primitives.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.AuthenticationSchemes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Cookie))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CookieCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CookieContainer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CookieException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CredentialCache))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DecompressionMethods))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DnsEndPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.EndPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpStatusCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.ICredentials))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.ICredentialsByHost))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IPAddress))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IPEndPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IWebProxy))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkCredential))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPAddressCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.AuthenticationLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.SslPolicyErrors))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.SocketAddress))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.AddressFamily))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketError))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.TransportContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.CipherAlgorithmType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExchangeAlgorithmType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ChannelBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ChannelBindingKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.HashAlgorithmType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.SslProtocols))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Requests.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Requests.cs new file mode 100644 index 0000000000..f0eb8a7e3c --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Requests.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Requests")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Requests")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Requests")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpWebRequest))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpWebResponse))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IWebRequestCreate))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.ProtocolViolationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebExceptionStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebHeaderCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebRequest))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebResponse))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Security.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Security.cs new file mode 100644 index 0000000000..0a399748b3 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Security.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Security")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Security")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Security")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.AuthenticatedStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.EncryptionPolicy))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.LocalCertificateSelectionCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.NegotiateStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.ProtectionLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.RemoteCertificateValidationCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Security.SslStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.AuthenticationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.PolicyEnforcement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ProtectionScenario))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.ExtendedProtection.ServiceNameCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Authentication.InvalidCredentialException))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Sockets.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Sockets.cs new file mode 100644 index 0000000000..c9a1b91ca7 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.Sockets.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Sockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Sockets")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Sockets")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IOControlCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IPPacketInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IPProtectionLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.IPv6MulticastOption))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.LingerOption))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.MulticastOption))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.NetworkStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.ProtocolType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SelectMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SendPacketsElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.Socket))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketAsyncEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketAsyncOperation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketOptionLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketOptionName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketReceiveFromResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketReceiveMessageFromResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketShutdown))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketTaskExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.TcpClient))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.TcpListener))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.UdpClient))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.UdpReceiveResult))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebHeaderCollection.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebHeaderCollection.cs new file mode 100644 index 0000000000..ca17c41061 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebHeaderCollection.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebHeaderCollection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebHeaderCollection")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebHeaderCollection")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpResponseHeader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebHeaderCollection))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebSockets.Client.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebSockets.Client.cs new file mode 100644 index 0000000000..4251b167a4 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebSockets.Client.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets.Client")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets.Client")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets.Client")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.ClientWebSocket))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.ClientWebSocketOptions))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebSockets.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebSockets.cs new file mode 100644 index 0000000000..3e21b160a2 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Net.WebSockets.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.WebSockets")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.WebSockets")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.WebSockets")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocket))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocketCloseStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocketError))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocketException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocketMessageType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocketReceiveResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebSockets.WebSocketState))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ObjectModel.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ObjectModel.cs new file mode 100644 index 0000000000..ac7c2035dc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ObjectModel.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ObjectModel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ObjectModel")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ObjectModel")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.KeyedCollection<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ReadOnlyDictionary<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.INotifyCollectionChanged))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedAction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataErrorsChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.INotifyDataErrorInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.INotifyPropertyChanged))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.INotifyPropertyChanging))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyChangingEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.PropertyChangingEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Windows.Input.ICommand))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.ILGeneration.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.ILGeneration.cs new file mode 100644 index 0000000000..64763fac4f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.ILGeneration.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.ILGeneration.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.CustomAttributeBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.ILGenerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.Label))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.LocalBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.ParameterBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.SignatureHelper))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.Lightweight.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.Lightweight.cs new file mode 100644 index 0000000000..0a55df6354 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.Lightweight.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit.Lightweight.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.DynamicMethod))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.cs new file mode 100644 index 0000000000..1dbad6fc3a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Emit.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Emit")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Emit")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Emit")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.AssemblyBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.AssemblyBuilderAccess))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.ConstructorBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.EnumBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.EventBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.FieldBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.GenericTypeParameterBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.MethodBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.ModuleBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.PropertyBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.TypeBuilder))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Extensions.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Extensions.cs new file mode 100644 index 0000000000..06108a2d82 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Extensions.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Extensions")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Extensions")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.InterfaceMapping))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.RuntimeReflectionExtensions))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Primitives.cs new file mode 100644 index 0000000000..52e395eccc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.Primitives.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CallingConventions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.FlowControl))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OpCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OpCodes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OpCodeType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.OperandType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.PackingSize))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Emit.StackBehaviour))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.EventAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.FieldAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.GenericParameterAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MethodAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MethodImplAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ParameterAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.PropertyAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TypeAttributes))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.cs new file mode 100644 index 0000000000..f1f2f32a5a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Reflection.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AmbiguousMatchException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Assembly))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyContentType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.BindingFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ConstructorInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeData))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeNamedArgument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.CustomAttributeTypedArgument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.EventInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.FieldInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ICustomAttributeProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.IntrospectionExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.InvalidFilterCriteriaException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.IReflectableType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.LocalVariableInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ManifestResourceInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MemberFilter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MemberInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MemberTypes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MethodBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.MethodInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Module))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ParameterInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ParameterModifier))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.PropertyInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ReflectionContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ReflectionTypeLoadException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ResourceLocation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TargetException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TargetInvocationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TargetParameterCountException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TypeFilter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.TypeInfo))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.Reader.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.Reader.cs new file mode 100644 index 0000000000..4623f62114 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.Reader.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Reader")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.ResourceManager.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.ResourceManager.cs new file mode 100644 index 0000000000..f0c7ef7e78 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.ResourceManager.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.ResourceManager")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.ResourceManager")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.ResourceManager")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.MissingManifestResourceException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.NeutralResourcesLanguageAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceManager))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.SatelliteContractVersionAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.Writer.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.Writer.cs new file mode 100644 index 0000000000..b5c7c9063b --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Resources.Writer.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Writer")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.CompilerServices.VisualC.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.CompilerServices.VisualC.cs new file mode 100644 index 0000000000..34d8f26554 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.CompilerServices.VisualC.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.CompilerServices.VisualC")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.CompilerServices.VisualC")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.CompilerServices.VisualC")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvCdecl))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvFastcall))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvStdcall))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallConvThiscall))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsBoxed))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsByValue))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsCopyConstructed))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsExplicitlyDereferenced))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsImplicitlyDereferenced))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsJitIntrinsic))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsLong))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsSignUnspecifiedByte))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsUdtReturn))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.NativeCppClassAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.RequiredAttributeAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Extensions.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Extensions.cs new file mode 100644 index 0000000000..b23a3a2cd0 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Extensions.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Extensions")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Extensions")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.BitConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Convert))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Stopwatch))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Environment))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Path))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Math))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MidpointRounding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebUtility))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Progress<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Random))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Versioning.FrameworkName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.StringComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriBuilder))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Handles.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Handles.cs new file mode 100644 index 0000000000..df25efea18 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Handles.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Handles")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Handles")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Handles")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeWaitHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.HandleInheritability))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CriticalHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SafeHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitHandleExtensions))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.RuntimeInformation.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.RuntimeInformation.cs new file mode 100644 index 0000000000..4a74791283 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.RuntimeInformation.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.RuntimeInformation")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.RuntimeInformation")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.RuntimeInformation")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.Architecture))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.OSPlatform))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.RuntimeInformation))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.WindowsRuntime.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.WindowsRuntime.cs new file mode 100644 index 0000000000..15e8413694 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.WindowsRuntime.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices.WindowsRuntime.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.DefaultInterfaceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationTokenTable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.IActivationFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.InterfaceImplementedInVersionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.ReturnValueNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.cs new file mode 100644 index 0000000000..5012e2e910 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.InteropServices.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.InteropServices")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.InteropServices")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.InteropServices")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DataMisalignedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DllNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.Missing))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ArrayWithOffset))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.BestFitMappingAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.BStrWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CallingConvention))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ClassInterfaceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ClassInterfaceType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CoClassAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComAwareEventInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComDefaultInterfaceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComEventInterfaceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComEventsHelper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.COMException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComImportAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComInterfaceType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComMemberType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComSourceInterfacesAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ADVF))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.BINDPTR))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.BIND_OPTS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.CALLCONV))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.CONNECTDATA))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DATADIR))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DESCKIND))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DISPPARAMS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.DVASPECT))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ELEMDESC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.EXCEPINFO))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FILETIME))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FORMATETC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FUNCDESC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FUNCFLAGS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.FUNCKIND))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IAdviseSink))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IBindCtx))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IConnectionPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IConnectionPointContainer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IDLDESC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IDLFLAG))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumConnections))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumFORMATETC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumMoniker))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumString))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IEnumVARIANT))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IMoniker))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IMPLTYPEFLAGS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.INVOKEKIND))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IPersistFile))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IRunningObjectTable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.IStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeComp))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeInfo2))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeLib))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.ITypeLib2))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.LIBFLAGS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.PARAMDESC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.PARAMFLAG))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATDATA))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STATSTG))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.STGMEDIUM))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.SYSKIND))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYMED))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEATTR))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEDESC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEFLAGS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPEKIND))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.TYPELIBATTR))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.VARDESC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.VARFLAGS))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComTypes.VARKIND))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CriticalHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CurrencyWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CustomQueryInterfaceResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DefaultCharSetAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DefaultParameterValueAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DispatchWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DispIdAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DllImportAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.DllImportSearchPath))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ErrorWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GCHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GCHandleType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.GuidAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.HandleCollector))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ICustomAdapter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ICustomQueryInterface))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.InAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.InterfaceTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.InvalidComObjectException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.InvalidOleVariantTypeException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.Marshal))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.MarshalAsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.MarshalDirectiveException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.OptionalAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.PreserveSigAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SafeArrayRankMismatchException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SafeArrayTypeMismatchException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SafeBuffer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SafeHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.SEHException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.TypeIdentifierAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.UnknownWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.UnmanagedType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.VarEnum))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.VariantWrapper))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Numerics.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Numerics.cs new file mode 100644 index 0000000000..bfab5a263c --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Numerics.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Numerics")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Numerics")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Numerics")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.BigInteger))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Numerics.Complex))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Formatters.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Formatters.cs new file mode 100644 index 0000000000..c373aaf3fb --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Formatters.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NonSerializedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IDeserializationCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IFormatterConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ISerializable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationEntry))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationInfoEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.SerializableAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Json.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Json.cs new file mode 100644 index 0000000000..cffe1e4264 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Json.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Json")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Json")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Json")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DateTimeFormat))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.EmitTypeInformation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.Json.DataContractJsonSerializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.Json.DataContractJsonSerializerSettings))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Primitives.cs new file mode 100644 index 0000000000..d45e5a576d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Primitives.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.CollectionDataContractAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ContractNamespaceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataMemberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.EnumMemberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IgnoreDataMemberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.InvalidDataContractException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ISerializationSurrogateProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.KnownTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnDeserializedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnDeserializingAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnSerializedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.OnSerializingAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.StreamingContext))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Xml.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Xml.cs new file mode 100644 index 0000000000..ee5d991f2e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.Serialization.Xml.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Xml")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Xml")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Xml")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractResolver))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractSerializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractSerializerExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.DataContractSerializerSettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.InvalidDataContractException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.XmlObjectSerializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.OnXmlDictionaryReaderClose))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.UniqueId))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlBinaryReaderSession))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlBinaryWriterSession))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryReaderQuotas))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryReaderQuotaTypes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryString))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDictionaryWriter))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.cs new file mode 100644 index 0000000000..9c267af7d2 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Runtime.cs @@ -0,0 +1,288 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(bool))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(byte))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(char))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(decimal))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(double))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(float))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(int))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(long))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(object))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(sbyte))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(short))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(string))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Action<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Activator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ArgumentException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ArgumentNullException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ArgumentOutOfRangeException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ArithmeticException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Array))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ArraySegment<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ArrayTypeMismatchException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AsyncCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Attribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AttributeTargets))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AttributeUsageAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.BadImageFormatException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.CLSCompliantAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.DictionaryEntry))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.ICollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IComparer<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IDictionary<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IEnumerable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IEnumerator<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IEqualityComparer<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IList<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IReadOnlyCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IReadOnlyDictionary<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.IReadOnlyList<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.ISet<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.KeyNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Generic.KeyValuePair<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ICollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IDictionaryEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IEnumerable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IEqualityComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IList))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IStructuralComparable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.IStructuralEquatable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.Collection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ReadOnlyCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Comparison<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DefaultValueAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EditorBrowsableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.EditorBrowsableState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DateTime))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DateTimeKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DateTimeOffset))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DayOfWeek))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Delegate))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.ConditionalAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.DebuggableAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.DivideByZeroException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Enum))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.EventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.EventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.EventHandler<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Exception))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.FieldAccessException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.FlagsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.FormatException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.FormattableString))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Func<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.GC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.GCCollectionMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.DateTimeStyles))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.NumberStyles))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Globalization.TimeSpanStyles))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Guid))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IAsyncResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IComparable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IComparable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IConvertible))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ICustomFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IDisposable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IEquatable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IFormatProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IFormattable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IndexOutOfRangeException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.InsufficientExecutionStackException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IntPtr))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.InvalidCastException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.InvalidOperationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.InvalidProgramException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.InvalidTimeZoneException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.DirectoryNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileLoadException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.FileNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.IOException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.PathTooLongException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IProgress<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Lazy<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Lazy<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MemberAccessException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MethodAccessException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MissingFieldException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MissingMemberException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MissingMethodException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MTAThreadAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MulticastDelegate))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NotImplementedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NotSupportedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Nullable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Nullable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NullReferenceException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ObjectDisposedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ObsoleteAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.OutOfMemoryException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.OverflowException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ParamArrayAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.PlatformNotSupportedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Predicate<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.RankException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyCompanyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyConfigurationAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyCopyrightAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyCultureAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyDefaultAliasAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyDelaySignAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyDescriptionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyFileVersionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyFlagsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyInformationalVersionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyKeyFileAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyKeyNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyMetadataAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyNameFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyProductAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblySignatureKeyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyTitleAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyTrademarkAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.AssemblyVersionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.DefaultMemberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Reflection.ProcessorArchitecture))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AccessedThroughPropertyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncStateMachineAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallerFilePathAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallerLineNumberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallerMemberNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CompilationRelaxationsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConditionalWeakTable<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CustomConstantAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DateTimeConstantAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DecimalConstantAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DisablePrivateReflectionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ExtensionAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.FixedBufferAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.FormattableStringFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IndexerNameAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.InternalsVisibleToAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsConst))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IStrongBox))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IsVolatile))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IteratorStateMachineAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.MethodImplAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.MethodImplOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ReferenceAssemblyAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.RuntimeCompatibilityAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.RuntimeHelpers))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.StateMachineAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.StrongBox<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TypeForwardedFromAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TypeForwardedToAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.UnsafeValueTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.ExceptionServices.ExceptionDispatchInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.GCLargeObjectHeapCompactionMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.GCLatencyMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.GCSettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.CharSet))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.ComVisibleAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.FieldOffsetAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.LayoutKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.OutAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.StructLayoutAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Versioning.TargetFrameworkAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.RuntimeFieldHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.RuntimeMethodHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.RuntimeTypeHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.AllowPartiallyTrustedCallersAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecurityCriticalAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecurityException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecuritySafeCriticalAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecurityTransparentAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.VerificationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.STAThreadAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.StringComparison))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.StringSplitOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.StringBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.LazyThreadSafetyMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Timeout))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ThreadStaticAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TimeoutException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TimeSpan))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TimeZoneInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Tuple<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Type))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TypeAccessException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TypeCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TypeInitializationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TypeLoadException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UIntPtr))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UnauthorizedAccessException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Uri))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriComponents))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriFormat))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriFormatException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriHostNameType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Version))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.WeakReference))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.WeakReference<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(uint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(ulong))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(ushort))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(void))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Claims.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Claims.cs new file mode 100644 index 0000000000..0900a8bb88 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Claims.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Claims")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Claims")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Claims")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.Claim))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.ClaimsIdentity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.ClaimsPrincipal))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.ClaimTypes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Claims.ClaimValueTypes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.GenericIdentity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.GenericPrincipal))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Algorithms.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Algorithms.cs new file mode 100644 index 0000000000..0e5e3569bc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Algorithms.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.2.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Algorithms")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Algorithms")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Algorithms")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Aes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DeriveBytes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECCurve))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsa))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACMD5))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA1))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA256))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA384))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMACSHA512))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.IncrementalHash))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.MD5))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RandomNumberGenerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Rfc2898DeriveBytes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSA))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAEncryptionPadding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAEncryptionPaddingMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSAParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSASignaturePadding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSASignaturePaddingMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA1))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA256))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA384))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SHA512))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.TripleDES))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Csp.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Csp.cs new file mode 100644 index 0000000000..fcf31adc42 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Csp.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspProviderFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ICspAsymmetricAlgorithm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeyNumber))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSACryptoServiceProvider))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Encoding.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Encoding.cs new file mode 100644 index 0000000000..fe9ee75952 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Encoding.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Encoding")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Encoding")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedData))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedDataCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsnEncodedDataEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.Oid))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.OidCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.OidEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.OidGroup))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Primitives.cs new file mode 100644 index 0000000000..d51039c85f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.Primitives.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.Primitives")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Primitives")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Primitives")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.AsymmetricAlgorithm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CipherMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptographicException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptoStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CryptoStreamMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HashAlgorithmName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.HMAC))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ICryptoTransform))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeyedHashAlgorithm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeySizes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.PaddingMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.SymmetricAlgorithm))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.X509Certificates.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.X509Certificates.cs new file mode 100644 index 0000000000..818934da39 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Cryptography.X509Certificates.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Cryptography.X509Certificates")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.X509Certificates")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.X509Certificates")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(Microsoft.Win32.SafeHandles.SafeX509ChainHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.ECDsaCertificateExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.OpenFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.PublicKey))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.RSACertificateExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.StoreLocation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.StoreName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X500DistinguishedName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X500DistinguishedNameFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Certificate))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Certificate2))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Certificate2Collection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Certificate2Enumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509CertificateCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Chain))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ChainElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ChainElementCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ChainElementEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ChainPolicy))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ChainStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ChainStatusFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ContentType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Extension))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ExtensionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509ExtensionEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509FindType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509KeyStorageFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509KeyUsageExtension))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509KeyUsageFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509NameType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509RevocationFlag))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509RevocationMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509Store))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierHashAlgorithm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.X509Certificates.X509VerificationFlags))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Principal.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Principal.cs new file mode 100644 index 0000000000..d4a91602b0 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.Principal.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.Principal")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Principal")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Principal")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IIdentity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.IPrincipal))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Principal.TokenImpersonationLevel))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.SecureString.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.SecureString.cs new file mode 100644 index 0000000000..a2eb458e11 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Security.SecureString.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.SecureString")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.SecureString")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.SecureString")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureString))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.SecureStringMarshal))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Duplex.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Duplex.cs new file mode 100644 index 0000000000..4a6f343077 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Duplex.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Duplex.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Duplex.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Duplex.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CallbackBehaviorAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DuplexChannelFactory<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DuplexClientBase<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.InstanceContext))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Http.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Http.cs new file mode 100644 index 0000000000..e403309667 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Http.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.10.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Http")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Http")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpMessageCredentialType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpSecurity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.BasicHttpSecurityMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpRequestMessageProperty))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpResponseMessageProperty))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpsTransportBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.HttpTransportBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IHttpCookieContainerManager))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.WebSocketTransportSettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.WebSocketTransportUsage))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpBindingBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpClientCredentialType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpTransportSecurity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpMessageEncoding))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.NetTcp.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.NetTcp.cs new file mode 100644 index 0000000000..007027ec76 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.NetTcp.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.NetTcp.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.NetTcp.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.NetTcp.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ConnectionOrientedTransportBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.SslStreamSecurityBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TcpConnectionPoolSettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TcpTransportBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.WindowsStreamSecurityBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageSecurityOverTcp))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetTcpBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetTcpSecurity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.TcpClientCredentialType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.TcpTransportSecurity))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Primitives.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Primitives.cs new file mode 100644 index 0000000000..29bc247d23 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Primitives.cs @@ -0,0 +1,151 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Primitives.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ActionNotSupportedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ChannelFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ChannelFactory<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.AddressHeader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.AddressHeaderCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.AddressingVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BinaryMessageEncodingBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.Binding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BindingContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BindingElementCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BindingParameterCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BodyWriter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.BufferManager))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ChannelBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ChannelFactoryBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ChannelFactoryBase<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ChannelManagerBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ChannelParameterCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.CommunicationObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.CompressionFormat))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.CustomBinding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.FaultConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IChannelFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IChannelFactory<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IDuplexChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IDuplexSession))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IDuplexSessionChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IInputChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IInputSession))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IInputSessionChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IMessageProperty))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IOutputChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IOutputSession))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IOutputSessionChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IRequestChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.IRequestSessionChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ISession))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.ISessionChannel<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.Message))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageBuffer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageEncoder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageEncoderFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageEncodingBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageFault))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageHeader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageHeaderInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageHeaders))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageProperties))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.MessageVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.RequestContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TextMessageEncodingBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TransportBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ClientBase<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CommunicationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CommunicationObjectAbortedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CommunicationObjectFaultedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.CommunicationState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DataContractFormatAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.ClientCredentials))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.ContractDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.DataContractSerializerOperationBehavior))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.FaultDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.FaultDescriptionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.IContractBehavior))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.IEndpointBehavior))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.IOperationBehavior))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessageBodyDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessageDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessageDescriptionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessageDirection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessageHeaderDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessageHeaderDescriptionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessagePartDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessagePartDescriptionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessagePropertyDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.MessagePropertyDescriptionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.OperationDescription))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.OperationDescriptionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Description.ServiceEndpoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.ClientOperation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.ClientRuntime))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.DispatchOperation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.DispatchRuntime))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.EndpointDispatcher))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.IClientMessageFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.IClientMessageInspector))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.IClientOperationSelector))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Dispatcher.IParameterInspector))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.EndpointAddress))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.EndpointAddressBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.EndpointIdentity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.EndpointNotFoundException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.EnvelopeVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ExceptionDetail))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.FaultCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.FaultContractAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.FaultException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.FaultException<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.FaultReason))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.FaultReasonText))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.IClientChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ICommunicationObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.IContextChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.IDefaultCommunicationTimeouts))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.IExtensibleObject<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.IExtension<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.IExtensionCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.InvalidMessageContractException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageBodyMemberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageContractAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageContractMemberAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageCredentialType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageHeader<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageHeaderException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageParameterAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.OperationContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.OperationContextScope))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.OperationContractAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.OperationFormatStyle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ProtocolException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.QuotaExceededException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.HttpDigestClientCredential))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.MessageSecurityException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecurityAccessDeniedException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.UserNamePasswordClientCredential))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.WindowsClientCredential))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.SecurityMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ServerTooBusyException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ServiceActivationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ServiceContractAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.ServiceKnownTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.TransferMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UnknownMessageReceivedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.XmlSerializerFormatAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Security.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Security.cs new file mode 100644 index 0000000000..4f18024668 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ServiceModel.Security.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Security.dll")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.LocalClientSecuritySettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.SecurityBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.SecurityHeaderLayout))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TransportSecurityBindingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DnsEndpointIdentity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageSecurityVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.BasicSecurityProfileVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecureConversationVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecurityPolicyVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecurityVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SecureConversationSecurityTokenParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SecurityTokenParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SupportingTokenParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.UserNameSecurityTokenParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.TrustVersion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.SpnEndpointIdentity))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UpnEndpointIdentity))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.Encoding.Extensions.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.Encoding.Extensions.cs new file mode 100644 index 0000000000..3c43dafec7 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.Encoding.Extensions.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding.Extensions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding.Extensions")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding.Extensions")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.ASCIIEncoding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.UnicodeEncoding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.UTF32Encoding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.UTF7Encoding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.UTF8Encoding))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.Encoding.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.Encoding.cs new file mode 100644 index 0000000000..03d21d143b --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.Encoding.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.Encoding")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.Encoding")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.Encoding")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.Decoder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.DecoderExceptionFallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.DecoderFallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.DecoderFallbackBuffer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.DecoderFallbackException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.DecoderReplacementFallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.Encoder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.EncoderExceptionFallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.EncoderFallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.EncoderFallbackBuffer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.EncoderFallbackException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.EncoderReplacementFallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.Encoding))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.EncodingProvider))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.RegularExpressions.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.RegularExpressions.cs new file mode 100644 index 0000000000..247920f6bd --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Text.RegularExpressions.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Text.RegularExpressions")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Text.RegularExpressions")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Text.RegularExpressions")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Capture))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.CaptureCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Group))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.GroupCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Match))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.MatchCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.MatchEvaluator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.Regex))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexMatchTimeoutException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexRunner))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Text.RegularExpressions.RegexRunnerFactory))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Overlapped.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Overlapped.cs new file mode 100644 index 0000000000..b26f315b66 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Overlapped.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Overlapped")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Overlapped")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Overlapped")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.IOCompletionCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.NativeOverlapped))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.PreAllocatedOverlapped))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadPoolBoundHandle))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Tasks.Parallel.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Tasks.Parallel.cs new file mode 100644 index 0000000000..1edd0c898f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Tasks.Parallel.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks.Parallel")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks.Parallel")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks.Parallel")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Parallel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.ParallelLoopResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.ParallelLoopState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.ParallelOptions))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Tasks.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Tasks.cs new file mode 100644 index 0000000000..8f428e9c60 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Tasks.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Tasks")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Tasks")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Tasks")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.AggregateException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.OperationCanceledException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncTaskMethodBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncTaskMethodBuilder<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncVoidMethodBuilder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConfiguredTaskAwaitable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IAsyncStateMachine))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ICriticalNotifyCompletion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.INotifyCompletion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TaskAwaiter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TaskAwaiter<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.YieldAwaitable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.CancellationToken))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.CancellationTokenRegistration))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.CancellationTokenSource))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.ConcurrentExclusiveSchedulerPair))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Task))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Task<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskCanceledException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskCompletionSource<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskContinuationOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskCreationOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskFactory<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskScheduler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskSchedulerException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.TaskStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.UnobservedTaskExceptionEventArgs))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Thread.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Thread.cs new file mode 100644 index 0000000000..63444856b7 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Thread.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Thread")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Thread")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Thread")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ParameterizedThreadStart))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Thread))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadStart))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadStartException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadStateException))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.ThreadPool.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.ThreadPool.cs new file mode 100644 index 0000000000..97ca723cdb --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.ThreadPool.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.12.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.ThreadPool")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.ThreadPool")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.ThreadPool")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.RegisteredWaitHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadPool))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitOrTimerCallback))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Timer.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Timer.cs new file mode 100644 index 0000000000..a605268db7 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.Timer.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading.Timer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading.Timer")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading.Timer")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Timer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.TimerCallback))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.cs new file mode 100644 index 0000000000..3440b85122 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Threading.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Threading")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Threading")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Threading")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AbandonedMutexException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AsyncLocal<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AsyncLocalValueChangedArgs<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AutoResetEvent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Barrier))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.BarrierPostPhaseException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ContextCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.CountdownEvent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.EventResetMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.EventWaitHandle))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ExecutionContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Interlocked))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.LazyInitializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.LockRecursionException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.LockRecursionPolicy))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ManualResetEvent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ManualResetEventSlim))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Monitor))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Mutex))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ReaderWriterLockSlim))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Semaphore))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SemaphoreFullException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SemaphoreSlim))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SendOrPostCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SpinLock))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SpinWait))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SynchronizationContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SynchronizationLockException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ThreadLocal<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Volatile))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitHandleCannotBeOpenedException))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ValueTuple.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ValueTuple.cs new file mode 100644 index 0000000000..9da750c084 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.ValueTuple.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ValueTuple")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ValueTuple")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ValueTuple")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.TupleElementNamesAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.TupleExtensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<,>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ValueTuple<>))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.ReaderWriter.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.ReaderWriter.cs new file mode 100644 index 0000000000..93b601eedc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.ReaderWriter.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.1.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.ReaderWriter")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.ReaderWriter")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.ReaderWriter")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.ConformanceLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.DtdProcessing))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlLineInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.IXmlNamespaceResolver))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.NamespaceHandling))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.NameTable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.NewLineHandling))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.ReadState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Schema.XmlSchema))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Schema.XmlSchemaForm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSchemaProviderAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.WriteState))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlConvert))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDateTimeSerializationMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNamespaceManager))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNamespaceScope))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNameTable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlParserContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlQualifiedName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlReader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlReaderSettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlSpace))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlWriter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlWriterSettings))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XDocument.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XDocument.cs new file mode 100644 index 0000000000..41fa407697 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XDocument.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XDocument")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XDocument")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.Extensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.LoadOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.ReaderOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.SaveOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XCData))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XComment))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XContainer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XDeclaration))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XDocumentType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XName))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XNamespace))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XNode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XNodeDocumentOrderComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XNodeEqualityComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XObject))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XObjectChange))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XObjectChangeEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XProcessingInstruction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XStreamingElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Linq.XText))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XPath.XDocument.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XPath.XDocument.cs new file mode 100644 index 0000000000..7781f04a02 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XPath.XDocument.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath.XDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath.XDocument")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath.XDocument")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.Extensions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XDocumentExtensions))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XPath.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XPath.cs new file mode 100644 index 0000000000..4c5bce2659 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XPath.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XPath")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XPath")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XPath")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeOrder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.IXPathNavigable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XmlCaseOrder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XmlDataType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XmlSortOrder))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathExpression))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathItem))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathNamespaceScope))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathNavigator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathNodeIterator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathNodeType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XPath.XPathResultType))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XmlDocument.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XmlDocument.cs new file mode 100644 index 0000000000..3bd1ceafb6 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XmlDocument.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.3.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlDocument")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlDocument")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlDocument")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlAttributeCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlCDataSection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlCharacterData))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlComment))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDeclaration))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlDocumentFragment))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlElement))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlImplementation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlLinkedNode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNamedNodeMap))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeChangedAction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlNodeList))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlProcessingInstruction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlSignificantWhitespace))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlText))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.XmlWhitespace))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XmlSerializer.cs b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XmlSerializer.cs new file mode 100644 index 0000000000..c8cedb4a9e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/System.Xml.XmlSerializer.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.11.0")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.XmlSerializer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.XmlSerializer")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyMetadataAttribute("", "")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.XmlSerializer")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyAttributeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyElementAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyElementAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayItemAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayItemAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributeOverrides))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlChoiceIdentifierAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlElementAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlElementAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlEnumAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlIgnoreAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlIncludeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlNamespaceDeclarationsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlRootAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSchemaProviderAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializerNamespaces))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTextAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTypeAttribute))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/Facades/netstandard.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/Facades/netstandard.cs.REMOVED.git-id new file mode 100644 index 0000000000..2ca8c3874f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Facades/netstandard.cs.REMOVED.git-id @@ -0,0 +1 @@ +d3518818afeecc52fb879d824a0b031b8db47028 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Engine.cs b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Engine.cs new file mode 100644 index 0000000000..62f97d02b5 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Engine.cs @@ -0,0 +1,500 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Build.Engine.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Build.Engine.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Build.Engine.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Flags=(System.Security.Permissions.SecurityPermissionFlag)(8))] +namespace Microsoft.Build.BuildEngine +{ + [System.Diagnostics.DebuggerDisplayAttribute("BuildItem (Name = { Name }, Include = { Include }, FinalItemSpec = { FinalItemSpec }, Condition = { Condition } )")] + public partial class BuildItem + { + public BuildItem(string itemName, Microsoft.Build.Framework.ITaskItem taskItem) { } + public BuildItem(string itemName, string itemInclude) { } + public string Condition { get { throw null; } set { } } + public int CustomMetadataCount { get { throw null; } } + public System.Collections.ICollection CustomMetadataNames { get { throw null; } } + public string Exclude { get { throw null; } set { } } + public string FinalItemSpec { get { throw null; } } + public string Include { get { throw null; } set { } } + public bool IsImported { get { throw null; } } + public int MetadataCount { get { throw null; } } + public System.Collections.ICollection MetadataNames { get { throw null; } } + public string Name { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.BuildItem Clone() { throw null; } + public void CopyCustomMetadataTo(Microsoft.Build.BuildEngine.BuildItem destinationItem) { } + public string GetEvaluatedMetadata(string metadataName) { throw null; } + public string GetMetadata(string metadataName) { throw null; } + public bool HasMetadata(string metadataName) { throw null; } + public void RemoveMetadata(string metadataName) { } + public void SetMetadata(string metadataName, string metadataValue) { } + public void SetMetadata(string metadataName, string metadataValue, bool treatMetadataValueAsLiteral) { } + } + [System.Diagnostics.DebuggerDisplayAttribute("BuildItemGroup (Count = { Count }, Condition = { Condition })")] + public partial class BuildItemGroup : System.Collections.IEnumerable + { + public BuildItemGroup() { } + public string Condition { get { throw null; } set { } } + public int Count { get { throw null; } } + public bool IsImported { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildItem this[int index] { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildItem AddNewItem(string itemName, string itemInclude) { throw null; } + public Microsoft.Build.BuildEngine.BuildItem AddNewItem(string itemName, string itemInclude, bool treatItemIncludeAsLiteral) { throw null; } + public void Clear() { } + public Microsoft.Build.BuildEngine.BuildItemGroup Clone(bool deepClone) { throw null; } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void RemoveItem(Microsoft.Build.BuildEngine.BuildItem itemToRemove) { } + public void RemoveItemAt(int index) { } + public Microsoft.Build.BuildEngine.BuildItem[] ToArray() { throw null; } + } + public partial class BuildItemGroupCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal BuildItemGroupCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("BuildProperty (Name = { Name }, Value = { Value }, FinalValue = { FinalValue }, Condition = { Condition })")] + public partial class BuildProperty + { + public BuildProperty(string propertyName, string propertyValue) { } + public string Condition { get { throw null; } set { } } + public string FinalValue { get { throw null; } } + public bool IsImported { get { throw null; } } + public string Name { get { throw null; } } + public string Value { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.BuildProperty Clone(bool deepClone) { throw null; } + public static explicit operator string (Microsoft.Build.BuildEngine.BuildProperty propertyToCast) { throw null; } + public override string ToString() { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("BuildPropertyGroup (Count = { Count }, Condition = { Condition })")] + public partial class BuildPropertyGroup : System.Collections.IEnumerable + { + public BuildPropertyGroup() { } + public BuildPropertyGroup(Microsoft.Build.BuildEngine.Project parentProject) { } + public string Condition { get { throw null; } set { } } + public int Count { get { throw null; } } + public bool IsImported { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildProperty this[string propertyName] { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.BuildProperty AddNewProperty(string propertyName, string propertyValue) { throw null; } + public Microsoft.Build.BuildEngine.BuildProperty AddNewProperty(string propertyName, string propertyValue, bool treatPropertyValueAsLiteral) { throw null; } + public void Clear() { } + public Microsoft.Build.BuildEngine.BuildPropertyGroup Clone(bool deepClone) { throw null; } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void RemoveProperty(Microsoft.Build.BuildEngine.BuildProperty property) { } + public void RemoveProperty(string propertyName) { } + public void SetImportedPropertyGroupCondition(string condition) { } + public void SetProperty(string propertyName, string propertyValue) { } + public void SetProperty(string propertyName, string propertyValue, bool treatPropertyValueAsLiteral) { } + } + public partial class BuildPropertyGroupCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal BuildPropertyGroupCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + } + [System.FlagsAttribute] + public enum BuildSettings + { + DoNotResetPreviouslyBuiltTargets = 1, + None = 0, + } + public partial class BuildTask + { + internal BuildTask() { } + public string Condition { get { throw null; } set { } } + public bool ContinueOnError { get { throw null; } set { } } + public Microsoft.Build.Framework.ITaskHost HostObject { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Type Type { get { throw null; } } + public void AddOutputItem(string taskParameter, string itemName) { } + public void AddOutputProperty(string taskParameter, string propertyName) { } + public bool Execute() { throw null; } + public string[] GetParameterNames() { throw null; } + public string GetParameterValue(string attributeName) { throw null; } + public void SetParameterValue(string parameterName, string parameterValue) { } + public void SetParameterValue(string parameterName, string parameterValue, bool treatParameterValueAsLiteral) { } + } + public delegate void ColorResetter(); + public delegate void ColorSetter(System.ConsoleColor color); + public partial class ConfigurableForwardingLogger : Microsoft.Build.Framework.IForwardingLogger, Microsoft.Build.Framework.ILogger, Microsoft.Build.Framework.INodeLogger + { + public ConfigurableForwardingLogger() { } + public Microsoft.Build.Framework.IEventRedirector BuildEventRedirector { get { throw null; } set { } } + public int NodeId { get { throw null; } set { } } + public string Parameters { get { throw null; } set { } } + public Microsoft.Build.Framework.LoggerVerbosity Verbosity { get { throw null; } set { } } + protected virtual void ForwardToCentralLogger(Microsoft.Build.Framework.BuildEventArgs e) { } + public virtual void Initialize(Microsoft.Build.Framework.IEventSource eventSource) { } + public void Initialize(Microsoft.Build.Framework.IEventSource eventSource, int nodeCount) { } + public virtual void Shutdown() { } + } + public partial class ConsoleLogger : Microsoft.Build.Framework.ILogger, Microsoft.Build.Framework.INodeLogger + { + public ConsoleLogger() { } + public ConsoleLogger(Microsoft.Build.Framework.LoggerVerbosity verbosity) { } + public ConsoleLogger(Microsoft.Build.Framework.LoggerVerbosity verbosity, Microsoft.Build.BuildEngine.WriteHandler write, Microsoft.Build.BuildEngine.ColorSetter colorSet, Microsoft.Build.BuildEngine.ColorResetter colorReset) { } + public string Parameters { get { throw null; } set { } } + public bool ShowSummary { get { throw null; } set { } } + public bool SkipProjectStartedText { get { throw null; } set { } } + public Microsoft.Build.Framework.LoggerVerbosity Verbosity { get { throw null; } set { } } + protected Microsoft.Build.BuildEngine.WriteHandler WriteHandler { get { throw null; } set { } } + public void ApplyParameter(string parameterName, string parameterValue) { } + public void BuildFinishedHandler(object sender, Microsoft.Build.Framework.BuildFinishedEventArgs e) { } + public void BuildStartedHandler(object sender, Microsoft.Build.Framework.BuildStartedEventArgs e) { } + public void CustomEventHandler(object sender, Microsoft.Build.Framework.CustomBuildEventArgs e) { } + public void ErrorHandler(object sender, Microsoft.Build.Framework.BuildErrorEventArgs e) { } + public virtual void Initialize(Microsoft.Build.Framework.IEventSource eventSource) { } + public virtual void Initialize(Microsoft.Build.Framework.IEventSource eventSource, int nodeCount) { } + public void MessageHandler(object sender, Microsoft.Build.Framework.BuildMessageEventArgs e) { } + public void ProjectFinishedHandler(object sender, Microsoft.Build.Framework.ProjectFinishedEventArgs e) { } + public void ProjectStartedHandler(object sender, Microsoft.Build.Framework.ProjectStartedEventArgs e) { } + public virtual void Shutdown() { } + public void TargetFinishedHandler(object sender, Microsoft.Build.Framework.TargetFinishedEventArgs e) { } + public void TargetStartedHandler(object sender, Microsoft.Build.Framework.TargetStartedEventArgs e) { } + public void TaskFinishedHandler(object sender, Microsoft.Build.Framework.TaskFinishedEventArgs e) { } + public void TaskStartedHandler(object sender, Microsoft.Build.Framework.TaskStartedEventArgs e) { } + public void WarningHandler(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e) { } + } + public partial class DistributedFileLogger : Microsoft.Build.Framework.IForwardingLogger, Microsoft.Build.Framework.ILogger, Microsoft.Build.Framework.INodeLogger + { + public DistributedFileLogger() { } + public Microsoft.Build.Framework.IEventRedirector BuildEventRedirector { get { throw null; } set { } } + public int NodeId { get { throw null; } set { } } + public string Parameters { get { throw null; } set { } } + public Microsoft.Build.Framework.LoggerVerbosity Verbosity { get { throw null; } set { } } + public void Initialize(Microsoft.Build.Framework.IEventSource eventSource) { } + public void Initialize(Microsoft.Build.Framework.IEventSource eventSource, int nodeCount) { } + public void Shutdown() { } + } + [System.ObsoleteAttribute("This class has been deprecated. Please use Microsoft.Build.Evaluation.ProjectCollection from the Microsoft.Build assembly instead.")] + public partial class Engine + { + public Engine() { } + public Engine(Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties) { } + public Engine(Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, Microsoft.Build.BuildEngine.ToolsetDefinitionLocations locations) { } + public Engine(Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, Microsoft.Build.BuildEngine.ToolsetDefinitionLocations locations, int numberOfCpus, string localNodeProviderParameters) { } + public Engine(Microsoft.Build.BuildEngine.ToolsetDefinitionLocations locations) { } + [System.ObsoleteAttribute("If you were simply passing in the .NET Framework location as the BinPath, just change to the parameterless Engine() constructor. Otherwise, you can define custom toolsets in the registry or config file, or by adding elements to the Engine's ToolsetCollection. Then use either the Engine() or Engine(ToolsetLocations) constructor instead.")] + public Engine(string binPath) { } + [System.ObsoleteAttribute("Avoid setting BinPath. If you were simply passing in the .NET Framework location as the BinPath, no other action is necessary. Otherwise, define Toolsets instead in the registry or config file, or by adding elements to the Engine's ToolsetCollection, in order to use a custom BinPath.")] + public string BinPath { get { throw null; } set { } } + public bool BuildEnabled { get { throw null; } set { } } + public string DefaultToolsVersion { get { throw null; } set { } } + public static Microsoft.Build.BuildEngine.Engine GlobalEngine { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildPropertyGroup GlobalProperties { get { throw null; } set { } } + public bool IsBuilding { get { throw null; } } + public bool OnlyLogCriticalEvents { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.ToolsetCollection Toolsets { get { throw null; } } + public static System.Version Version { get { throw null; } } + public bool BuildProject(Microsoft.Build.BuildEngine.Project project) { throw null; } + public bool BuildProject(Microsoft.Build.BuildEngine.Project project, string targetName) { throw null; } + public bool BuildProject(Microsoft.Build.BuildEngine.Project project, string[] targetNames) { throw null; } + public bool BuildProject(Microsoft.Build.BuildEngine.Project project, string[] targetNames, System.Collections.IDictionary targetOutputs) { throw null; } + public bool BuildProject(Microsoft.Build.BuildEngine.Project project, string[] targetNames, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags) { throw null; } + public bool BuildProjectFile(string projectFile) { throw null; } + public bool BuildProjectFile(string projectFile, string targetName) { throw null; } + public bool BuildProjectFile(string projectFile, string[] targetNames) { throw null; } + public bool BuildProjectFile(string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties) { throw null; } + public bool BuildProjectFile(string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs) { throw null; } + public bool BuildProjectFile(string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags) { throw null; } + public bool BuildProjectFile(string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags, string toolsVersion) { throw null; } + public bool BuildProjectFiles(string[] projectFiles, string[][] targetNamesPerProject, Microsoft.Build.BuildEngine.BuildPropertyGroup[] globalPropertiesPerProject, System.Collections.IDictionary[] targetOutputsPerProject, Microsoft.Build.BuildEngine.BuildSettings buildFlags, string[] toolsVersions) { throw null; } + public Microsoft.Build.BuildEngine.Project CreateNewProject() { throw null; } + public Microsoft.Build.BuildEngine.Project GetLoadedProject(string projectFullFileName) { throw null; } + public void RegisterDistributedLogger(Microsoft.Build.Framework.ILogger centralLogger, Microsoft.Build.BuildEngine.LoggerDescription forwardingLogger) { } + public void RegisterLogger(Microsoft.Build.Framework.ILogger logger) { } + public void Shutdown() { } + public void UnloadAllProjects() { } + public void UnloadProject(Microsoft.Build.BuildEngine.Project project) { } + public void UnregisterAllLoggers() { } + } + public partial class FileLogger : Microsoft.Build.BuildEngine.ConsoleLogger + { + public FileLogger() { } + public override void Initialize(Microsoft.Build.Framework.IEventSource eventSource) { } + public override void Initialize(Microsoft.Build.Framework.IEventSource eventSource, int nodeCount) { } + public override void Shutdown() { } + } + public partial class Import + { + internal Import() { } + public string Condition { get { throw null; } set { } } + public string EvaluatedProjectPath { get { throw null; } } + public bool IsImported { get { throw null; } } + public string ProjectPath { get { throw null; } set { } } + } + public partial class ImportCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal ImportCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void AddNewImport(string projectFile, string condition) { } + public void CopyTo(Microsoft.Build.BuildEngine.Import[] array, int index) { } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void RemoveImport(Microsoft.Build.BuildEngine.Import importToRemove) { } + } + [System.SerializableAttribute] + public sealed partial class InternalLoggerException : System.Exception + { + public InternalLoggerException() { } + public InternalLoggerException(string message) { } + public InternalLoggerException(string message, System.Exception innerException) { } + public Microsoft.Build.Framework.BuildEventArgs BuildEventArgs { get { throw null; } } + public string ErrorCode { get { throw null; } } + public string HelpKeyword { get { throw null; } } + public bool InitializationException { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public sealed partial class InvalidProjectFileException : System.Exception + { + public InvalidProjectFileException() { } + public InvalidProjectFileException(string message) { } + public InvalidProjectFileException(string message, System.Exception innerException) { } + public InvalidProjectFileException(string projectFile, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string errorSubcategory, string errorCode, string helpKeyword) { } + public InvalidProjectFileException(System.Xml.XmlNode xmlNode, string message, string errorSubcategory, string errorCode, string helpKeyword) { } + public string BaseMessage { get { throw null; } } + public int ColumnNumber { get { throw null; } } + public int EndColumnNumber { get { throw null; } } + public int EndLineNumber { get { throw null; } } + public string ErrorCode { get { throw null; } } + public string ErrorSubcategory { get { throw null; } } + public string HelpKeyword { get { throw null; } } + public int LineNumber { get { throw null; } } + public override string Message { get { throw null; } } + public string ProjectFile { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class InvalidToolsetDefinitionException : System.Exception + { + public InvalidToolsetDefinitionException() { } + protected InvalidToolsetDefinitionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InvalidToolsetDefinitionException(string message) { } + public InvalidToolsetDefinitionException(string message, System.Exception innerException) { } + public InvalidToolsetDefinitionException(string message, string errorCode) { } + public InvalidToolsetDefinitionException(string message, string errorCode, System.Exception innerException) { } + public string ErrorCode { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class LocalNode + { + internal LocalNode() { } + public static void StartLocalNodeServer(int nodeNumber) { } + } + public partial class LoggerDescription + { + public LoggerDescription(string loggerClassName, string loggerAssemblyName, string loggerAssemblyFile, string loggerSwitchParameters, Microsoft.Build.Framework.LoggerVerbosity verbosity) { } + public string LoggerSwitchParameters { get { throw null; } } + public Microsoft.Build.Framework.LoggerVerbosity Verbosity { get { throw null; } } + } + [System.ObsoleteAttribute("This class has been deprecated. Please use Microsoft.Build.Evaluation.Project from the Microsoft.Build assembly instead.")] + public partial class Project + { + public Project() { } + public Project(Microsoft.Build.BuildEngine.Engine engine) { } + public Project(Microsoft.Build.BuildEngine.Engine engine, string toolsVersion) { } + public bool BuildEnabled { get { throw null; } set { } } + public string DefaultTargets { get { throw null; } set { } } + public string DefaultToolsVersion { get { throw null; } set { } } + public System.Text.Encoding Encoding { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildItemGroup EvaluatedItems { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildItemGroup EvaluatedItemsIgnoringCondition { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildPropertyGroup EvaluatedProperties { get { throw null; } } + public string FullFileName { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.BuildPropertyGroup GlobalProperties { get { throw null; } set { } } + public bool HasToolsVersionAttribute { get { throw null; } } + public Microsoft.Build.BuildEngine.ImportCollection Imports { get { throw null; } } + public string InitialTargets { get { throw null; } set { } } + public bool IsDirty { get { throw null; } } + public bool IsValidated { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.BuildItemGroupCollection ItemGroups { get { throw null; } } + public Microsoft.Build.BuildEngine.Engine ParentEngine { get { throw null; } } + public Microsoft.Build.BuildEngine.BuildPropertyGroupCollection PropertyGroups { get { throw null; } } + public string SchemaFile { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.TargetCollection Targets { get { throw null; } } + public System.DateTime TimeOfLastDirty { get { throw null; } } + public string ToolsVersion { get { throw null; } } + public Microsoft.Build.BuildEngine.UsingTaskCollection UsingTasks { get { throw null; } } + public string Xml { get { throw null; } } + public void AddNewImport(string projectFile, string condition) { } + public Microsoft.Build.BuildEngine.BuildItem AddNewItem(string itemName, string itemInclude) { throw null; } + public Microsoft.Build.BuildEngine.BuildItem AddNewItem(string itemName, string itemInclude, bool treatItemIncludeAsLiteral) { throw null; } + public Microsoft.Build.BuildEngine.BuildItemGroup AddNewItemGroup() { throw null; } + public Microsoft.Build.BuildEngine.BuildPropertyGroup AddNewPropertyGroup(bool insertAtEndOfProject) { throw null; } + public void AddNewUsingTaskFromAssemblyFile(string taskName, string assemblyFile) { } + public void AddNewUsingTaskFromAssemblyName(string taskName, string assemblyName) { } + public bool Build() { throw null; } + public bool Build(string targetName) { throw null; } + public bool Build(string[] targetNames) { throw null; } + public bool Build(string[] targetNames, System.Collections.IDictionary targetOutputs) { throw null; } + public bool Build(string[] targetNames, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags) { throw null; } + public string[] GetConditionedPropertyValues(string propertyName) { throw null; } + public Microsoft.Build.BuildEngine.BuildItemGroup GetEvaluatedItemsByName(string itemName) { throw null; } + public Microsoft.Build.BuildEngine.BuildItemGroup GetEvaluatedItemsByNameIgnoringCondition(string itemName) { throw null; } + public string GetEvaluatedProperty(string propertyName) { throw null; } + public string GetProjectExtensions(string id) { throw null; } + public void Load(System.IO.TextReader textReader) { } + public void Load(System.IO.TextReader textReader, Microsoft.Build.BuildEngine.ProjectLoadSettings projectLoadSettings) { } + public void Load(string projectFileName) { } + public void Load(string projectFileName, Microsoft.Build.BuildEngine.ProjectLoadSettings projectLoadSettings) { } + public void LoadXml(string projectXml) { } + public void LoadXml(string projectXml, Microsoft.Build.BuildEngine.ProjectLoadSettings projectLoadSettings) { } + public void MarkProjectAsDirty() { } + public void RemoveAllItemGroups() { } + public void RemoveAllPropertyGroups() { } + public void RemoveImportedPropertyGroup(Microsoft.Build.BuildEngine.BuildPropertyGroup propertyGroupToRemove) { } + public void RemoveItem(Microsoft.Build.BuildEngine.BuildItem itemToRemove) { } + public void RemoveItemGroup(Microsoft.Build.BuildEngine.BuildItemGroup itemGroupToRemove) { } + public void RemoveItemGroupsWithMatchingCondition(string matchCondition) { } + public void RemoveItemsByName(string itemName) { } + public void RemovePropertyGroup(Microsoft.Build.BuildEngine.BuildPropertyGroup propertyGroupToRemove) { } + public void RemovePropertyGroupsWithMatchingCondition(string matchCondition) { } + public void RemovePropertyGroupsWithMatchingCondition(string matchCondition, bool includeImportedPropertyGroups) { } + public void ResetBuildStatus() { } + public void Save(System.IO.TextWriter textWriter) { } + public void Save(string projectFileName) { } + public void Save(string projectFileName, System.Text.Encoding encoding) { } + public void SetImportedProperty(string propertyName, string propertyValue, string condition, Microsoft.Build.BuildEngine.Project importProject) { } + public void SetImportedProperty(string propertyName, string propertyValue, string condition, Microsoft.Build.BuildEngine.Project importedProject, Microsoft.Build.BuildEngine.PropertyPosition position) { } + public void SetImportedProperty(string propertyName, string propertyValue, string condition, Microsoft.Build.BuildEngine.Project importedProject, Microsoft.Build.BuildEngine.PropertyPosition position, bool treatPropertyValueAsLiteral) { } + public void SetProjectExtensions(string id, string content) { } + public void SetProperty(string propertyName, string propertyValue) { } + public void SetProperty(string propertyName, string propertyValue, string condition) { } + public void SetProperty(string propertyName, string propertyValue, string condition, Microsoft.Build.BuildEngine.PropertyPosition position) { } + public void SetProperty(string propertyName, string propertyValue, string condition, Microsoft.Build.BuildEngine.PropertyPosition position, bool treatPropertyValueAsLiteral) { } + } + [System.FlagsAttribute] + public enum ProjectLoadSettings + { + IgnoreMissingImports = 1, + None = 0, + } + public enum PropertyPosition + { + UseExistingOrCreateAfterLastImport = 1, + UseExistingOrCreateAfterLastPropertyGroup = 0, + } + [System.SerializableAttribute] + public sealed partial class RemoteErrorException : System.Exception + { + internal RemoteErrorException() { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public static partial class SolutionWrapperProject + { + public static string Generate(string solutionPath, string toolsVersionOverride, Microsoft.Build.Framework.BuildEventContext projectBuildEventContext) { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("Target (Name = { Name }, Condition = { Condition })")] + public partial class Target : System.Collections.IEnumerable + { + internal Target() { } + public string Condition { get { throw null; } set { } } + public string DependsOnTargets { get { throw null; } set { } } + public string Inputs { get { throw null; } set { } } + public bool IsImported { get { throw null; } } + public string Name { get { throw null; } } + public string Outputs { get { throw null; } set { } } + public Microsoft.Build.BuildEngine.BuildTask AddNewTask(string taskName) { throw null; } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void RemoveTask(Microsoft.Build.BuildEngine.BuildTask taskElement) { } + } + public partial class TargetCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal TargetCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public Microsoft.Build.BuildEngine.Target this[string index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public Microsoft.Build.BuildEngine.Target AddNewTarget(string targetName) { throw null; } + public void CopyTo(System.Array array, int index) { } + public bool Exists(string targetName) { throw null; } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void RemoveTarget(Microsoft.Build.BuildEngine.Target targetToRemove) { } + } + public partial class Toolset + { + public Toolset(string toolsVersion, string toolsPath) { } + public Toolset(string toolsVersion, string toolsPath, Microsoft.Build.BuildEngine.BuildPropertyGroup buildProperties) { } + public Microsoft.Build.BuildEngine.BuildPropertyGroup BuildProperties { get { throw null; } } + public string ToolsPath { get { throw null; } } + public string ToolsVersion { get { throw null; } } + public Microsoft.Build.BuildEngine.Toolset Clone() { throw null; } + } + public partial class ToolsetCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + internal ToolsetCollection() { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public Microsoft.Build.BuildEngine.Toolset this[string toolsVersion] { get { throw null; } } + public System.Collections.Generic.IEnumerable ToolsVersions { get { throw null; } } + public void Add(Microsoft.Build.BuildEngine.Toolset item) { } + public void Clear() { } + public bool Contains(Microsoft.Build.BuildEngine.Toolset item) { throw null; } + public bool Contains(string toolsVersion) { throw null; } + public void CopyTo(Microsoft.Build.BuildEngine.Toolset[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public bool Remove(Microsoft.Build.BuildEngine.Toolset item) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + [System.FlagsAttribute] + public enum ToolsetDefinitionLocations + { + ConfigurationFile = 1, + None = 0, + Registry = 2, + } + public partial class UsingTask + { + internal UsingTask() { } + public string AssemblyFile { get { throw null; } } + public string AssemblyName { get { throw null; } } + public string Condition { get { throw null; } } + public bool IsImported { get { throw null; } } + public string TaskName { get { throw null; } } + } + public partial class UsingTaskCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal UsingTaskCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(Microsoft.Build.BuildEngine.UsingTask[] array, int index) { } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + } + public static partial class Utilities + { + public static string Escape(string unescapedExpression) { throw null; } + } + public delegate void WriteHandler(string message); +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Framework.cs b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Framework.cs new file mode 100644 index 0000000000..1b9643d14c --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Framework.cs @@ -0,0 +1,776 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Build.Framework.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Build.Framework.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Build.Framework.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(4096))] +[assembly:System.Runtime.InteropServices.GuidAttribute("D8A9BA71-4724-481d-9CA7-0DA23A1D615C")] +#if false +[assembly:System.Windows.Markup.XmlnsDefinitionAttribute("http://schemas.microsoft.com/build/2009/properties", "Microsoft.Build.Framework.XamlTypes")] +#endif +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Flags=(System.Security.Permissions.SecurityPermissionFlag)(8))] +namespace Microsoft.Build.Framework +{ + public delegate void AnyEventHandler(object sender, Microsoft.Build.Framework.BuildEventArgs e); + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct BuildEngineResult + { + public BuildEngineResult(bool result, System.Collections.Generic.List> targetOutputsPerProject) { throw null;} + public bool Result { get { throw null; } } + public System.Collections.Generic.IList> TargetOutputsPerProject { get { throw null; } } + } + [System.SerializableAttribute] + public partial class BuildErrorEventArgs : Microsoft.Build.Framework.LazyFormattedBuildEventArgs + { + protected BuildErrorEventArgs() { } + public BuildErrorEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName) { } + public BuildErrorEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, System.DateTime eventTimestamp) { } + public BuildErrorEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, System.DateTime eventTimestamp, params object[] messageArgs) { } + public string Code { get { throw null; } } + public int ColumnNumber { get { throw null; } } + public int EndColumnNumber { get { throw null; } } + public int EndLineNumber { get { throw null; } } + public string File { get { throw null; } } + public int LineNumber { get { throw null; } } + public string ProjectFile { get { throw null; } set { } } + public string Subcategory { get { throw null; } } + } + public delegate void BuildErrorEventHandler(object sender, Microsoft.Build.Framework.BuildErrorEventArgs e); + [System.SerializableAttribute] + public abstract partial class BuildEventArgs : System.EventArgs + { + protected BuildEventArgs() { } + protected BuildEventArgs(string message, string helpKeyword, string senderName) { } + protected BuildEventArgs(string message, string helpKeyword, string senderName, System.DateTime eventTimestamp) { } + public Microsoft.Build.Framework.BuildEventContext BuildEventContext { get { throw null; } set { } } + public string HelpKeyword { get { throw null; } } + public virtual string Message { get { throw null; } protected set { } } + public string SenderName { get { throw null; } } + public int ThreadId { get { throw null; } } + public System.DateTime Timestamp { get { throw null; } } + } + [System.SerializableAttribute] + public partial class BuildEventContext + { + public const int InvalidNodeId = -2; + public const int InvalidProjectContextId = -2; + public const int InvalidProjectInstanceId = -1; + public const int InvalidSubmissionId = -1; + public const int InvalidTargetId = -1; + public const int InvalidTaskId = -1; + public BuildEventContext(int nodeId, int targetId, int projectContextId, int taskId) { } + public BuildEventContext(int nodeId, int projectInstanceId, int projectContextId, int targetId, int taskId) { } + public BuildEventContext(int submissionId, int nodeId, int projectInstanceId, int projectContextId, int targetId, int taskId) { } + public long BuildRequestId { get { throw null; } } + public static Microsoft.Build.Framework.BuildEventContext Invalid { get { throw null; } } + public int NodeId { get { throw null; } } + public int ProjectContextId { get { throw null; } } + public int ProjectInstanceId { get { throw null; } } + public int SubmissionId { get { throw null; } } + public int TargetId { get { throw null; } } + public int TaskId { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Microsoft.Build.Framework.BuildEventContext left, Microsoft.Build.Framework.BuildEventContext right) { throw null; } + public static bool operator !=(Microsoft.Build.Framework.BuildEventContext left, Microsoft.Build.Framework.BuildEventContext right) { throw null; } + } + [System.SerializableAttribute] + public partial class BuildFinishedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected BuildFinishedEventArgs() { } + public BuildFinishedEventArgs(string message, string helpKeyword, bool succeeded) { } + public BuildFinishedEventArgs(string message, string helpKeyword, bool succeeded, System.DateTime eventTimestamp) { } + public BuildFinishedEventArgs(string message, string helpKeyword, bool succeeded, System.DateTime eventTimestamp, params object[] messageArgs) { } + public bool Succeeded { get { throw null; } } + } + public delegate void BuildFinishedEventHandler(object sender, Microsoft.Build.Framework.BuildFinishedEventArgs e); + [System.SerializableAttribute] + public partial class BuildMessageEventArgs : Microsoft.Build.Framework.LazyFormattedBuildEventArgs + { + protected BuildMessageEventArgs() { } + public BuildMessageEventArgs(string message, string helpKeyword, string senderName, Microsoft.Build.Framework.MessageImportance importance) { } + public BuildMessageEventArgs(string message, string helpKeyword, string senderName, Microsoft.Build.Framework.MessageImportance importance, System.DateTime eventTimestamp) { } + public BuildMessageEventArgs(string message, string helpKeyword, string senderName, Microsoft.Build.Framework.MessageImportance importance, System.DateTime eventTimestamp, params object[] messageArgs) { } + public BuildMessageEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, Microsoft.Build.Framework.MessageImportance importance) { } + public BuildMessageEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, Microsoft.Build.Framework.MessageImportance importance, System.DateTime eventTimestamp) { } + public BuildMessageEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, Microsoft.Build.Framework.MessageImportance importance, System.DateTime eventTimestamp, params object[] messageArgs) { } + public string Code { get { throw null; } } + public int ColumnNumber { get { throw null; } } + public int EndColumnNumber { get { throw null; } } + public int EndLineNumber { get { throw null; } } + public string File { get { throw null; } } + public Microsoft.Build.Framework.MessageImportance Importance { get { throw null; } } + public int LineNumber { get { throw null; } } + public string ProjectFile { get { throw null; } set { } } + public string Subcategory { get { throw null; } } + } + public delegate void BuildMessageEventHandler(object sender, Microsoft.Build.Framework.BuildMessageEventArgs e); + [System.SerializableAttribute] + public partial class BuildStartedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected BuildStartedEventArgs() { } + public BuildStartedEventArgs(string message, string helpKeyword) { } + public BuildStartedEventArgs(string message, string helpKeyword, System.Collections.Generic.IDictionary environmentOfBuild) { } + public BuildStartedEventArgs(string message, string helpKeyword, System.DateTime eventTimestamp) { } + public BuildStartedEventArgs(string message, string helpKeyword, System.DateTime eventTimestamp, params object[] messageArgs) { } + public System.Collections.Generic.IDictionary BuildEnvironment { get { throw null; } } + } + public delegate void BuildStartedEventHandler(object sender, Microsoft.Build.Framework.BuildStartedEventArgs e); + [System.SerializableAttribute] + public abstract partial class BuildStatusEventArgs : Microsoft.Build.Framework.LazyFormattedBuildEventArgs + { + protected BuildStatusEventArgs() { } + protected BuildStatusEventArgs(string message, string helpKeyword, string senderName) { } + protected BuildStatusEventArgs(string message, string helpKeyword, string senderName, System.DateTime eventTimestamp) { } + protected BuildStatusEventArgs(string message, string helpKeyword, string senderName, System.DateTime eventTimestamp, params object[] messageArgs) { } + } + public delegate void BuildStatusEventHandler(object sender, Microsoft.Build.Framework.BuildStatusEventArgs e); + [System.SerializableAttribute] + public partial class BuildWarningEventArgs : Microsoft.Build.Framework.LazyFormattedBuildEventArgs + { + protected BuildWarningEventArgs() { } + public BuildWarningEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName) { } + public BuildWarningEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, System.DateTime eventTimestamp) { } + public BuildWarningEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, System.DateTime eventTimestamp, params object[] messageArgs) { } + public string Code { get { throw null; } } + public int ColumnNumber { get { throw null; } } + public int EndColumnNumber { get { throw null; } } + public int EndLineNumber { get { throw null; } } + public string File { get { throw null; } } + public int LineNumber { get { throw null; } } + public string ProjectFile { get { throw null; } set { } } + public string Subcategory { get { throw null; } } + } + public delegate void BuildWarningEventHandler(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e); + [System.SerializableAttribute] + public partial class CriticalBuildMessageEventArgs : Microsoft.Build.Framework.BuildMessageEventArgs + { + protected CriticalBuildMessageEventArgs() { } + public CriticalBuildMessageEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName) { } + public CriticalBuildMessageEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, System.DateTime eventTimestamp) { } + public CriticalBuildMessageEventArgs(string subcategory, string code, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, string helpKeyword, string senderName, System.DateTime eventTimestamp, params object[] messageArgs) { } + } + [System.SerializableAttribute] + public abstract partial class CustomBuildEventArgs : Microsoft.Build.Framework.LazyFormattedBuildEventArgs + { + protected CustomBuildEventArgs() { } + protected CustomBuildEventArgs(string message, string helpKeyword, string senderName) { } + protected CustomBuildEventArgs(string message, string helpKeyword, string senderName, System.DateTime eventTimestamp) { } + protected CustomBuildEventArgs(string message, string helpKeyword, string senderName, System.DateTime eventTimestamp, params object[] messageArgs) { } + } + public delegate void CustomBuildEventHandler(object sender, Microsoft.Build.Framework.CustomBuildEventArgs e); + [System.SerializableAttribute] + public partial class ExternalProjectFinishedEventArgs : Microsoft.Build.Framework.CustomBuildEventArgs + { + protected ExternalProjectFinishedEventArgs() { } + public ExternalProjectFinishedEventArgs(string message, string helpKeyword, string senderName, string projectFile, bool succeeded) { } + public ExternalProjectFinishedEventArgs(string message, string helpKeyword, string senderName, string projectFile, bool succeeded, System.DateTime eventTimestamp) { } + public string ProjectFile { get { throw null; } } + public bool Succeeded { get { throw null; } } + } + [System.SerializableAttribute] + public partial class ExternalProjectStartedEventArgs : Microsoft.Build.Framework.CustomBuildEventArgs + { + protected ExternalProjectStartedEventArgs() { } + public ExternalProjectStartedEventArgs(string message, string helpKeyword, string senderName, string projectFile, string targetNames) { } + public ExternalProjectStartedEventArgs(string message, string helpKeyword, string senderName, string projectFile, string targetNames, System.DateTime eventTimestamp) { } + public string ProjectFile { get { throw null; } } + public string TargetNames { get { throw null; } } + } + public partial interface IBuildEngine + { + int ColumnNumberOfTaskNode { get; } + bool ContinueOnError { get; } + int LineNumberOfTaskNode { get; } + string ProjectFileOfTaskNode { get; } + bool BuildProjectFile(string projectFileName, string[] targetNames, System.Collections.IDictionary globalProperties, System.Collections.IDictionary targetOutputs); + void LogCustomEvent(Microsoft.Build.Framework.CustomBuildEventArgs e); + void LogErrorEvent(Microsoft.Build.Framework.BuildErrorEventArgs e); + void LogMessageEvent(Microsoft.Build.Framework.BuildMessageEventArgs e); + void LogWarningEvent(Microsoft.Build.Framework.BuildWarningEventArgs e); + } + public partial interface IBuildEngine2 : Microsoft.Build.Framework.IBuildEngine + { + bool IsRunningMultipleNodes { get; } + bool BuildProjectFile(string projectFileName, string[] targetNames, System.Collections.IDictionary globalProperties, System.Collections.IDictionary targetOutputs, string toolsVersion); + bool BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames, System.Collections.IDictionary[] globalProperties, System.Collections.IDictionary[] targetOutputsPerProject, string[] toolsVersion, bool useResultsCache, bool unloadProjectsOnCompletion); + } + public partial interface IBuildEngine3 : Microsoft.Build.Framework.IBuildEngine, Microsoft.Build.Framework.IBuildEngine2 + { + Microsoft.Build.Framework.BuildEngineResult BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames, System.Collections.IDictionary[] globalProperties, System.Collections.Generic.IList[] removeGlobalProperties, string[] toolsVersion, bool returnTargetOutputs); + void Reacquire(); + void Yield(); + } + public partial interface IBuildEngine4 : Microsoft.Build.Framework.IBuildEngine, Microsoft.Build.Framework.IBuildEngine2, Microsoft.Build.Framework.IBuildEngine3 + { + object GetRegisteredTaskObject(object key, Microsoft.Build.Framework.RegisteredTaskObjectLifetime lifetime); + void RegisterTaskObject(object key, object obj, Microsoft.Build.Framework.RegisteredTaskObjectLifetime lifetime, bool allowEarlyCollection); + object UnregisterTaskObject(object key, Microsoft.Build.Framework.RegisteredTaskObjectLifetime lifetime); + } + public partial interface ICancelableTask : Microsoft.Build.Framework.ITask + { + void Cancel(); + } + public partial interface IEventRedirector + { + void ForwardEvent(Microsoft.Build.Framework.BuildEventArgs buildEvent); + } + public partial interface IEventSource + { + event Microsoft.Build.Framework.AnyEventHandler AnyEventRaised; + event Microsoft.Build.Framework.BuildFinishedEventHandler BuildFinished; + event Microsoft.Build.Framework.BuildStartedEventHandler BuildStarted; + event Microsoft.Build.Framework.CustomBuildEventHandler CustomEventRaised; + event Microsoft.Build.Framework.BuildErrorEventHandler ErrorRaised; + event Microsoft.Build.Framework.BuildMessageEventHandler MessageRaised; + event Microsoft.Build.Framework.ProjectFinishedEventHandler ProjectFinished; + event Microsoft.Build.Framework.ProjectStartedEventHandler ProjectStarted; + event Microsoft.Build.Framework.BuildStatusEventHandler StatusEventRaised; + event Microsoft.Build.Framework.TargetFinishedEventHandler TargetFinished; + event Microsoft.Build.Framework.TargetStartedEventHandler TargetStarted; + event Microsoft.Build.Framework.TaskFinishedEventHandler TaskFinished; + event Microsoft.Build.Framework.TaskStartedEventHandler TaskStarted; + event Microsoft.Build.Framework.BuildWarningEventHandler WarningRaised; + } + public partial interface IForwardingLogger : Microsoft.Build.Framework.ILogger, Microsoft.Build.Framework.INodeLogger + { + Microsoft.Build.Framework.IEventRedirector BuildEventRedirector { get; set; } + int NodeId { get; set; } + } + public partial interface IGeneratedTask : Microsoft.Build.Framework.ITask + { + object GetPropertyValue(Microsoft.Build.Framework.TaskPropertyInfo property); + void SetPropertyValue(Microsoft.Build.Framework.TaskPropertyInfo property, object value); + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + public partial interface ILogger + { + string Parameters { get; set; } + Microsoft.Build.Framework.LoggerVerbosity Verbosity { get; set; } + void Initialize(Microsoft.Build.Framework.IEventSource eventSource); + void Shutdown(); + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + public partial interface INodeLogger : Microsoft.Build.Framework.ILogger + { + void Initialize(Microsoft.Build.Framework.IEventSource eventSource, int nodeCount); + } + public partial interface ITask + { + Microsoft.Build.Framework.IBuildEngine BuildEngine { get; set; } + Microsoft.Build.Framework.ITaskHost HostObject { get; set; } + bool Execute(); + } + public partial interface ITaskFactory + { + string FactoryName { get; } + System.Type TaskType { get; } + void CleanupTask(Microsoft.Build.Framework.ITask task); + Microsoft.Build.Framework.ITask CreateTask(Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost); + Microsoft.Build.Framework.TaskPropertyInfo[] GetTaskParameters(); + bool Initialize(string taskName, System.Collections.Generic.IDictionary parameterGroup, string taskBody, Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost); + } + public partial interface ITaskFactory2 : Microsoft.Build.Framework.ITaskFactory + { + Microsoft.Build.Framework.ITask CreateTask(Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost, System.Collections.Generic.IDictionary taskIdentityParameters); + bool Initialize(string taskName, System.Collections.Generic.IDictionary factoryIdentityParameters, System.Collections.Generic.IDictionary parameterGroup, string taskBody, Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost); + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + [System.Runtime.InteropServices.GuidAttribute("9049A481-D0E9-414f-8F92-D4F67A0359A6")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface ITaskHost + { + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + [System.Runtime.InteropServices.GuidAttribute("8661674F-2148-4F71-A92A-49875511C528")] + public partial interface ITaskItem + { + string ItemSpec { get; set; } + int MetadataCount { get; } + System.Collections.ICollection MetadataNames { get; } + System.Collections.IDictionary CloneCustomMetadata(); + void CopyMetadataTo(Microsoft.Build.Framework.ITaskItem destinationItem); + string GetMetadata(string metadataName); + void RemoveMetadata(string metadataName); + void SetMetadata(string metadataName, string metadataValue); + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + [System.Runtime.InteropServices.GuidAttribute("ac6d5a59-f877-461b-88e3-b2f06fce0cb9")] + public partial interface ITaskItem2 : Microsoft.Build.Framework.ITaskItem + { + string EvaluatedIncludeEscaped { get; set; } + System.Collections.IDictionary CloneCustomMetadataEscaped(); + string GetMetadataValueEscaped(string metadataName); + void SetMetadataValueLiteral(string metadataName, string metadataValue); + } + [System.SerializableAttribute] + public partial class LazyFormattedBuildEventArgs : Microsoft.Build.Framework.BuildEventArgs + { + protected LazyFormattedBuildEventArgs() { } + public LazyFormattedBuildEventArgs(string message, string helpKeyword, string senderName) { } + public LazyFormattedBuildEventArgs(string message, string helpKeyword, string senderName, System.DateTime eventTimestamp, params object[] messageArgs) { } + public override string Message { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class LoadInSeparateAppDomainAttribute : System.Attribute + { + public LoadInSeparateAppDomainAttribute() { } + } + [System.SerializableAttribute] + public partial class LoggerException : System.Exception + { + public LoggerException() { } + protected LoggerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public LoggerException(string message) { } + public LoggerException(string message, System.Exception innerException) { } + public LoggerException(string message, System.Exception innerException, string errorCode, string helpKeyword) { } + public string ErrorCode { get { throw null; } } + public string HelpKeyword { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + public enum LoggerVerbosity + { + Detailed = 3, + Diagnostic = 4, + Minimal = 1, + Normal = 2, + Quiet = 0, + } + [System.SerializableAttribute] + public enum MessageImportance + { + High = 0, + Low = 2, + Normal = 1, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128), AllowMultiple=false, Inherited=false)] + public sealed partial class OutputAttribute : System.Attribute + { + public OutputAttribute() { } + } + [System.SerializableAttribute] + public partial class ProjectFinishedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected ProjectFinishedEventArgs() { } + public ProjectFinishedEventArgs(string message, string helpKeyword, string projectFile, bool succeeded) { } + public ProjectFinishedEventArgs(string message, string helpKeyword, string projectFile, bool succeeded, System.DateTime eventTimestamp) { } + public string ProjectFile { get { throw null; } } + public bool Succeeded { get { throw null; } } + } + public delegate void ProjectFinishedEventHandler(object sender, Microsoft.Build.Framework.ProjectFinishedEventArgs e); + [System.SerializableAttribute] + public partial class ProjectStartedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + public const int InvalidProjectId = -1; + protected ProjectStartedEventArgs() { } + public ProjectStartedEventArgs(int projectId, string message, string helpKeyword, string projectFile, string targetNames, System.Collections.IEnumerable properties, System.Collections.IEnumerable items, Microsoft.Build.Framework.BuildEventContext parentBuildEventContext) { } + public ProjectStartedEventArgs(int projectId, string message, string helpKeyword, string projectFile, string targetNames, System.Collections.IEnumerable properties, System.Collections.IEnumerable items, Microsoft.Build.Framework.BuildEventContext parentBuildEventContext, System.Collections.Generic.IDictionary globalProperties, string toolsVersion) { } + public ProjectStartedEventArgs(int projectId, string message, string helpKeyword, string projectFile, string targetNames, System.Collections.IEnumerable properties, System.Collections.IEnumerable items, Microsoft.Build.Framework.BuildEventContext parentBuildEventContext, System.DateTime eventTimestamp) { } + public ProjectStartedEventArgs(string message, string helpKeyword, string projectFile, string targetNames, System.Collections.IEnumerable properties, System.Collections.IEnumerable items) { } + public ProjectStartedEventArgs(string message, string helpKeyword, string projectFile, string targetNames, System.Collections.IEnumerable properties, System.Collections.IEnumerable items, System.DateTime eventTimestamp) { } + public System.Collections.Generic.IDictionary GlobalProperties { get { throw null; } } + public System.Collections.IEnumerable Items { get { throw null; } } + public Microsoft.Build.Framework.BuildEventContext ParentProjectBuildEventContext { get { throw null; } } + public string ProjectFile { get { throw null; } } + public int ProjectId { get { throw null; } } + public System.Collections.IEnumerable Properties { get { throw null; } } + public string TargetNames { get { throw null; } } + public string ToolsVersion { get { throw null; } } + } + public delegate void ProjectStartedEventHandler(object sender, Microsoft.Build.Framework.ProjectStartedEventArgs e); + public enum RegisteredTaskObjectLifetime + { + AppDomain = 1, + Build = 0, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128), AllowMultiple=false, Inherited=false)] + public sealed partial class RequiredAttribute : System.Attribute + { + public RequiredAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)] + public sealed partial class RequiredRuntimeAttribute : System.Attribute + { + public RequiredRuntimeAttribute(string runtimeVersion) { } + public string RuntimeVersion { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)] + public sealed partial class RunInMTAAttribute : System.Attribute + { + public RunInMTAAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)] + public sealed partial class RunInSTAAttribute : System.Attribute + { + public RunInSTAAttribute() { } + } + [System.SerializableAttribute] + public partial class TargetFinishedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected TargetFinishedEventArgs() { } + public TargetFinishedEventArgs(string message, string helpKeyword, string targetName, string projectFile, string targetFile, bool succeeded) { } + public TargetFinishedEventArgs(string message, string helpKeyword, string targetName, string projectFile, string targetFile, bool succeeded, System.Collections.IEnumerable targetOutputs) { } + public TargetFinishedEventArgs(string message, string helpKeyword, string targetName, string projectFile, string targetFile, bool succeeded, System.DateTime eventTimestamp, System.Collections.IEnumerable targetOutputs) { } + public string ProjectFile { get { throw null; } } + public bool Succeeded { get { throw null; } } + public string TargetFile { get { throw null; } } + public string TargetName { get { throw null; } } + public System.Collections.IEnumerable TargetOutputs { get { throw null; } set { } } + } + public delegate void TargetFinishedEventHandler(object sender, Microsoft.Build.Framework.TargetFinishedEventArgs e); + [System.SerializableAttribute] + public partial class TargetStartedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected TargetStartedEventArgs() { } + public TargetStartedEventArgs(string message, string helpKeyword, string targetName, string projectFile, string targetFile) { } + public TargetStartedEventArgs(string message, string helpKeyword, string targetName, string projectFile, string targetFile, string parentTarget, System.DateTime eventTimestamp) { } + public string ParentTarget { get { throw null; } } + public string ProjectFile { get { throw null; } } + public string TargetFile { get { throw null; } } + public string TargetName { get { throw null; } } + } + public delegate void TargetStartedEventHandler(object sender, Microsoft.Build.Framework.TargetStartedEventArgs e); + [System.SerializableAttribute] + public partial class TaskCommandLineEventArgs : Microsoft.Build.Framework.BuildMessageEventArgs + { + protected TaskCommandLineEventArgs() { } + public TaskCommandLineEventArgs(string commandLine, string taskName, Microsoft.Build.Framework.MessageImportance importance) { } + public TaskCommandLineEventArgs(string commandLine, string taskName, Microsoft.Build.Framework.MessageImportance importance, System.DateTime eventTimestamp) { } + public string CommandLine { get { throw null; } } + public string TaskName { get { throw null; } } + } + [System.SerializableAttribute] + public partial class TaskFinishedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected TaskFinishedEventArgs() { } + public TaskFinishedEventArgs(string message, string helpKeyword, string projectFile, string taskFile, string taskName, bool succeeded) { } + public TaskFinishedEventArgs(string message, string helpKeyword, string projectFile, string taskFile, string taskName, bool succeeded, System.DateTime eventTimestamp) { } + public string ProjectFile { get { throw null; } } + public bool Succeeded { get { throw null; } } + public string TaskFile { get { throw null; } } + public string TaskName { get { throw null; } } + } + public delegate void TaskFinishedEventHandler(object sender, Microsoft.Build.Framework.TaskFinishedEventArgs e); + [System.SerializableAttribute] + public partial class TaskPropertyInfo + { + public TaskPropertyInfo(string name, System.Type typeOfParameter, bool output, bool required) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Type PropertyType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool Required { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.SerializableAttribute] + public partial class TaskStartedEventArgs : Microsoft.Build.Framework.BuildStatusEventArgs + { + protected TaskStartedEventArgs() { } + public TaskStartedEventArgs(string message, string helpKeyword, string projectFile, string taskFile, string taskName) { } + public TaskStartedEventArgs(string message, string helpKeyword, string projectFile, string taskFile, string taskName, System.DateTime eventTimestamp) { } + public string ProjectFile { get { throw null; } } + public string TaskFile { get { throw null; } } + public string TaskName { get { throw null; } } + } + public delegate void TaskStartedEventHandler(object sender, Microsoft.Build.Framework.TaskStartedEventArgs e); +} +namespace Microsoft.Build.Framework.XamlTypes +{ + public sealed partial class Argument : System.ComponentModel.ISupportInitialize + { + public Argument() { } + public bool IsRequired { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Property { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Separator { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("Arguments")] +#endif + public abstract partial class BaseProperty : System.ComponentModel.ISupportInitialize + { + protected BaseProperty() { } + public System.Collections.Generic.List Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Category { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.Build.Framework.XamlTypes.Rule ContainingRule { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public Microsoft.Build.Framework.XamlTypes.DataSource DataSource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string Default { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { get { throw null; } set { } } + [System.ComponentModel.LocalizableAttribute(false)] + public string F1Keyword { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public int HelpContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(false)] + public string HelpFile { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(false)] + public string HelpUrl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IncludeInCommandLine { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IsRequired { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool MultipleValuesAllowed { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool ReadOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Separator { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Subcategory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Switch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string SwitchPrefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List ValueEditors { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool Visible { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual void BeginInit() { } + public virtual void EndInit() { } + } + public sealed partial class BoolProperty : Microsoft.Build.Framework.XamlTypes.BaseProperty + { + public BoolProperty() { } + public string ReverseSwitch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public sealed partial class Category : Microsoft.Build.Framework.XamlTypes.CategorySchema, System.ComponentModel.ISupportInitialize + { + public Category() { } + [System.ComponentModel.LocalizableAttribute(true)] + public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { get { throw null; } set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string HelpString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Subtype { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + } + public abstract partial class CategorySchema + { + protected CategorySchema() { } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("Metadata")] +#endif + public sealed partial class ContentType : Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode, System.ComponentModel.ISupportInitialize + { + public ContentType() { } + public bool DefaultContentTypeForItemType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ObsoleteAttribute("Unused. Use ItemType property instead.", true)] + public string ItemGroupName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ItemType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + public string GetMetadata(string metadataName) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjectTypes() { throw null; } + } + public sealed partial class DataSource : System.ComponentModel.ISupportInitialize + { + public DataSource() { } + public bool HasConfigurationCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ItemType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Label { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string MSBuildTarget { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string PersistedName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Persistence { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.Build.Framework.XamlTypes.DefaultValueSourceLocation SourceOfDefaultValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string SourceType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + } + public enum DefaultValueSourceLocation + { + AfterContext = 1, + BeforeContext = 0, + } + public sealed partial class DynamicEnumProperty : Microsoft.Build.Framework.XamlTypes.BaseProperty + { + public DynamicEnumProperty() { } + public string EnumProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List ProviderSettings { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("AdmissibleValues")] +#endif + public sealed partial class EnumProperty : Microsoft.Build.Framework.XamlTypes.BaseProperty + { + public EnumProperty() { } + public System.Collections.Generic.List AdmissibleValues { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override void EndInit() { } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("Arguments")] +#endif + public sealed partial class EnumValue + { + public EnumValue() { } + public System.Collections.Generic.List Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { get { throw null; } set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string HelpString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IsDefault { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Switch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string SwitchPrefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public sealed partial class FileExtension : Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode + { + public FileExtension() { } + public string ContentType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjectTypes() { throw null; } + } + public sealed partial class IntProperty : Microsoft.Build.Framework.XamlTypes.BaseProperty + { + public IntProperty() { } + public System.Nullable MaxValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Nullable MinValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override void EndInit() { } + } + public partial interface IProjectSchemaNode + { + System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type); + System.Collections.Generic.IEnumerable GetSchemaObjectTypes(); + } + public sealed partial class ItemType : Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode, System.ComponentModel.ISupportInitialize + { + public ItemType() { } + public string DefaultContentType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool UpToDateCheckInput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + public System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjectTypes() { throw null; } + } + public partial class NameValuePair + { + public NameValuePair() { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("Nodes")] +#endif + public sealed partial class ProjectSchemaDefinitions : Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode + { + public ProjectSchemaDefinitions() { } + public System.Collections.Generic.List Nodes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjectTypes() { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("Rule: {Name}")] +#if false + [System.Windows.Markup.ContentPropertyAttribute("Properties")] +#endif + public sealed partial class Rule : Microsoft.Build.Framework.XamlTypes.RuleSchema, Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode, System.ComponentModel.ISupportInitialize + { + public Rule() { } + public string AdditionalInputs { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List Categories { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string CommandLine { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.Build.Framework.XamlTypes.DataSource DataSource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { get { throw null; } set { } } + public System.Collections.Generic.List EvaluatedCategories { get { throw null; } } + public string ExecutionDescription { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string FileExtension { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.LocalizableAttribute(true)] + public string HelpString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.Dictionary Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public int Order { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Outputs { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.Build.Framework.XamlTypes.RuleOverrideMode OverrideMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string PageTemplate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool PropertyPagesHidden { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Separator { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool ShowOnlyRuleProperties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SupportsFileBatching { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string SwitchPrefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ToolName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + public System.Collections.Specialized.OrderedDictionary GetPropertiesByCategory() { throw null; } + public System.Collections.Generic.IList GetPropertiesInCategory(string categoryName) { throw null; } + public Microsoft.Build.Framework.XamlTypes.BaseProperty GetProperty(string propertyName) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjectTypes() { throw null; } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("Rules")] +#endif + public sealed partial class RuleBag : Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode, System.ComponentModel.ISupportInitialize + { + public RuleBag() { } + public System.Collections.Generic.List Rules { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + public System.Collections.Generic.IEnumerable GetSchemaObjects(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable GetSchemaObjectTypes() { throw null; } + } + public enum RuleOverrideMode + { + Extend = 1, + Replace = 0, + } + public abstract partial class RuleSchema + { + protected RuleSchema() { } + } + public sealed partial class StringListProperty : Microsoft.Build.Framework.XamlTypes.BaseProperty + { + public StringListProperty() { } + public string CommandLineValueSeparator { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string RendererValueSeparator { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Subtype { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public sealed partial class StringProperty : Microsoft.Build.Framework.XamlTypes.BaseProperty + { + public StringProperty() { } + public string Subtype { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } +#if false + [System.Windows.Markup.ContentPropertyAttribute("Metadata")] +#endif + public sealed partial class ValueEditor : System.ComponentModel.ISupportInitialize + { + public ValueEditor() { } + [System.ComponentModel.LocalizableAttribute(true)] + public string DisplayName { get { throw null; } set { } } + public string EditorType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.List Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void BeginInit() { } + public void EndInit() { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Tasks.v4.0.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Tasks.v4.0.cs.REMOVED.git-id new file mode 100644 index 0000000000..a2ef09fb05 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Tasks.v4.0.cs.REMOVED.git-id @@ -0,0 +1 @@ +7f4092bc6227081eb136eb7d12fb4ac43ef15079 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Utilities.v4.0.cs b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Utilities.v4.0.cs new file mode 100644 index 0000000000..29324dd803 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.Utilities.v4.0.cs @@ -0,0 +1,479 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.Build.Utilities.v4.0.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.Build.Utilities.v4.0.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Build.Utilities.v4.0.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(4096))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Flags=(System.Security.Permissions.SecurityPermissionFlag)(8))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace Microsoft.Build.Utilities +{ + [Microsoft.Build.Framework.LoadInSeparateAppDomainAttribute] + public abstract partial class AppDomainIsolatedTask : System.MarshalByRefObject, Microsoft.Build.Framework.ITask + { + protected AppDomainIsolatedTask() { } + protected AppDomainIsolatedTask(System.Resources.ResourceManager taskResources) { } + protected AppDomainIsolatedTask(System.Resources.ResourceManager taskResources, string helpKeywordPrefix) { } + public Microsoft.Build.Framework.IBuildEngine BuildEngine { get { throw null; } set { } } + protected string HelpKeywordPrefix { get { throw null; } set { } } + public Microsoft.Build.Framework.ITaskHost HostObject { get { throw null; } set { } } + public Microsoft.Build.Utilities.TaskLoggingHelper Log { get { throw null; } } + protected System.Resources.ResourceManager TaskResources { get { throw null; } set { } } + public abstract bool Execute(); + [System.Security.SecurityCriticalAttribute] + public override object InitializeLifetimeService() { throw null; } + } + public partial class AssemblyFoldersExInfo + { + public AssemblyFoldersExInfo(Microsoft.Win32.RegistryHive hive, Microsoft.Win32.RegistryView view, string registryKey, string directoryPath, System.Version targetFrameworkVersion) { } + public string DirectoryPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public Microsoft.Win32.RegistryHive Hive { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Key { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Version TargetFrameworkVersion { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public Microsoft.Win32.RegistryView View { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class CanonicalTrackedInputFiles + { + public CanonicalTrackedInputFiles(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem sourceFile, Microsoft.Build.Framework.ITaskItem[] excludedInputPaths, Microsoft.Build.Utilities.CanonicalTrackedOutputFiles outputs, bool useMinimalRebuildOptimization, bool maintainCompositeRootingMarkers) { } + public CanonicalTrackedInputFiles(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem[] sourceFiles, Microsoft.Build.Framework.ITaskItem[] excludedInputPaths, Microsoft.Build.Framework.ITaskItem[] outputs, bool useMinimalRebuildOptimization, bool maintainCompositeRootingMarkers) { } + public CanonicalTrackedInputFiles(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem[] sourceFiles, Microsoft.Build.Framework.ITaskItem[] excludedInputPaths, Microsoft.Build.Utilities.CanonicalTrackedOutputFiles outputs, bool useMinimalRebuildOptimization, bool maintainCompositeRootingMarkers) { } + public CanonicalTrackedInputFiles(Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem[] sourceFiles, Microsoft.Build.Framework.ITaskItem[] excludedInputPaths, Microsoft.Build.Utilities.CanonicalTrackedOutputFiles outputs, bool useMinimalRebuildOptimization, bool maintainCompositeRootingMarkers) { } + public CanonicalTrackedInputFiles(Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem[] sourceFiles, Microsoft.Build.Utilities.CanonicalTrackedOutputFiles outputs, bool useMinimalRebuildOptimization, bool maintainCompositeRootingMarkers) { } + public System.Collections.Generic.Dictionary> DependencyTable { get { throw null; } } + public Microsoft.Build.Framework.ITaskItem[] ComputeSourcesNeedingCompilation() { throw null; } + public Microsoft.Build.Framework.ITaskItem[] ComputeSourcesNeedingCompilation(bool searchForSubRootsInCompositeRootingMarkers) { throw null; } + public bool FileIsExcludedFromDependencyCheck(string fileName) { throw null; } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem source) { } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem source, Microsoft.Build.Framework.ITaskItem correspondingOutput) { } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem[] source) { } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem[] source, Microsoft.Build.Framework.ITaskItem[] correspondingOutputs) { } + public void RemoveDependencyFromEntry(Microsoft.Build.Framework.ITaskItem source, Microsoft.Build.Framework.ITaskItem dependencyToRemove) { } + public void RemoveDependencyFromEntry(Microsoft.Build.Framework.ITaskItem[] sources, Microsoft.Build.Framework.ITaskItem dependencyToRemove) { } + public void RemoveEntriesForSource(Microsoft.Build.Framework.ITaskItem source) { } + public void RemoveEntriesForSource(Microsoft.Build.Framework.ITaskItem[] source) { } + public void RemoveEntryForSourceRoot(string rootingMarker) { } + public void SaveTlog() { } + public void SaveTlog(Microsoft.Build.Utilities.DependencyFilter includeInTLog) { } + } + public partial class CanonicalTrackedOutputFiles + { + public CanonicalTrackedOutputFiles(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles) { } + public CanonicalTrackedOutputFiles(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles, bool constructOutputsFromTLogs) { } + public CanonicalTrackedOutputFiles(Microsoft.Build.Framework.ITaskItem[] tlogFiles) { } + public System.Collections.Generic.Dictionary> DependencyTable { get { throw null; } } + public void AddComputedOutputForSourceRoot(string sourceKey, string computedOutput) { } + public void AddComputedOutputsForSourceRoot(string sourceKey, Microsoft.Build.Framework.ITaskItem[] computedOutputs) { } + public void AddComputedOutputsForSourceRoot(string sourceKey, string[] computedOutputs) { } + public Microsoft.Build.Framework.ITaskItem[] OutputsForNonCompositeSource(params Microsoft.Build.Framework.ITaskItem[] sources) { throw null; } + public Microsoft.Build.Framework.ITaskItem[] OutputsForSource(params Microsoft.Build.Framework.ITaskItem[] sources) { throw null; } + public Microsoft.Build.Framework.ITaskItem[] OutputsForSource(Microsoft.Build.Framework.ITaskItem[] sources, bool searchForSubRootsInCompositeRootingMarkers) { throw null; } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem source) { } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem source, Microsoft.Build.Framework.ITaskItem correspondingOutput) { } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem[] source) { } + public void RemoveDependenciesFromEntryIfMissing(Microsoft.Build.Framework.ITaskItem[] source, Microsoft.Build.Framework.ITaskItem[] correspondingOutputs) { } + public void RemoveDependencyFromEntry(Microsoft.Build.Framework.ITaskItem source, Microsoft.Build.Framework.ITaskItem dependencyToRemove) { } + public void RemoveDependencyFromEntry(Microsoft.Build.Framework.ITaskItem[] sources, Microsoft.Build.Framework.ITaskItem dependencyToRemove) { } + public void RemoveEntriesForSource(Microsoft.Build.Framework.ITaskItem source) { } + public void RemoveEntriesForSource(Microsoft.Build.Framework.ITaskItem source, Microsoft.Build.Framework.ITaskItem correspondingOutput) { } + public void RemoveEntriesForSource(Microsoft.Build.Framework.ITaskItem[] source) { } + public void RemoveEntriesForSource(Microsoft.Build.Framework.ITaskItem[] source, Microsoft.Build.Framework.ITaskItem[] correspondingOutputs) { } + public bool RemoveOutputForSourceRoot(string sourceRoot, string outputPathToRemove) { throw null; } + public string[] RemoveRootsWithSharedOutputs(Microsoft.Build.Framework.ITaskItem[] sources) { throw null; } + public void SaveTlog() { } + public void SaveTlog(Microsoft.Build.Utilities.DependencyFilter includeInTLog) { } + } + public partial class CommandLineBuilder + { + public CommandLineBuilder() { } + public CommandLineBuilder(bool quoteHyphensOnCommandLine) { } + protected System.Text.StringBuilder CommandLine { get { throw null; } } + public int Length { get { throw null; } } + public void AppendFileNameIfNotNull(Microsoft.Build.Framework.ITaskItem fileItem) { } + public void AppendFileNameIfNotNull(string fileName) { } + public void AppendFileNamesIfNotNull(Microsoft.Build.Framework.ITaskItem[] fileItems, string delimiter) { } + public void AppendFileNamesIfNotNull(string[] fileNames, string delimiter) { } + protected void AppendFileNameWithQuoting(string fileName) { } + protected void AppendQuotedTextToBuffer(System.Text.StringBuilder buffer, string unquotedTextToAppend) { } + protected void AppendSpaceIfNotEmpty() { } + public void AppendSwitch(string switchName) { } + public void AppendSwitchIfNotNull(string switchName, Microsoft.Build.Framework.ITaskItem parameter) { } + public void AppendSwitchIfNotNull(string switchName, Microsoft.Build.Framework.ITaskItem[] parameters, string delimiter) { } + public void AppendSwitchIfNotNull(string switchName, string parameter) { } + public void AppendSwitchIfNotNull(string switchName, string[] parameters, string delimiter) { } + public void AppendSwitchUnquotedIfNotNull(string switchName, Microsoft.Build.Framework.ITaskItem parameter) { } + public void AppendSwitchUnquotedIfNotNull(string switchName, Microsoft.Build.Framework.ITaskItem[] parameters, string delimiter) { } + public void AppendSwitchUnquotedIfNotNull(string switchName, string parameter) { } + public void AppendSwitchUnquotedIfNotNull(string switchName, string[] parameters, string delimiter) { } + public void AppendTextUnquoted(string textToAppend) { } + protected void AppendTextWithQuoting(string textToAppend) { } + protected virtual bool IsQuotingRequired(string parameter) { throw null; } + public override string ToString() { throw null; } + protected virtual void VerifyThrowNoEmbeddedDoubleQuotes(string switchName, string parameter) { } + } + public delegate bool DependencyFilter(string fullPath); + public enum DotNetFrameworkArchitecture + { + Bitness32 = 1, + Bitness64 = 2, + Current = 0, + } + public enum ExecutableType + { + Managed32Bit = 3, + Managed64Bit = 4, + ManagedIL = 2, + Native32Bit = 0, + Native64Bit = 1, + SameAsCurrentProcess = 5, + } + public static partial class FileTracker + { + public static string CreateRootingMarkerResponseFile(Microsoft.Build.Framework.ITaskItem[] sources) { throw null; } + public static string CreateRootingMarkerResponseFile(string rootMarker) { throw null; } + public static void EndTrackingContext() { } + public static string EnsureFileTrackerOnPath() { throw null; } + public static string EnsureFileTrackerOnPath(string rootPath) { throw null; } + public static bool FileIsExcludedFromDependencies(string fileName) { throw null; } + public static bool FileIsUnderPath(string fileName, string path) { throw null; } + public static string FindTrackerOnPath() { throw null; } + public static bool ForceOutOfProcTracking(Microsoft.Build.Utilities.ExecutableType toolType) { throw null; } + public static bool ForceOutOfProcTracking(Microsoft.Build.Utilities.ExecutableType toolType, string dllName, string cancelEventName) { throw null; } + public static string FormatRootingMarker(Microsoft.Build.Framework.ITaskItem source) { throw null; } + public static string FormatRootingMarker(Microsoft.Build.Framework.ITaskItem source, Microsoft.Build.Framework.ITaskItem output) { throw null; } + public static string FormatRootingMarker(Microsoft.Build.Framework.ITaskItem[] sources) { throw null; } + public static string FormatRootingMarker(Microsoft.Build.Framework.ITaskItem[] sources, Microsoft.Build.Framework.ITaskItem[] outputs) { throw null; } + public static string GetFileTrackerPath(Microsoft.Build.Utilities.ExecutableType toolType) { throw null; } + public static string GetFileTrackerPath(Microsoft.Build.Utilities.ExecutableType toolType, string rootPath) { throw null; } + public static string GetTrackerPath(Microsoft.Build.Utilities.ExecutableType toolType) { throw null; } + public static string GetTrackerPath(Microsoft.Build.Utilities.ExecutableType toolType, string rootPath) { throw null; } + public static void ResumeTracking() { } + public static void SetThreadCount(int threadCount) { } + public static System.Diagnostics.Process StartProcess(string command, string arguments, Microsoft.Build.Utilities.ExecutableType toolType) { throw null; } + public static System.Diagnostics.Process StartProcess(string command, string arguments, Microsoft.Build.Utilities.ExecutableType toolType, string rootFiles) { throw null; } + public static System.Diagnostics.Process StartProcess(string command, string arguments, Microsoft.Build.Utilities.ExecutableType toolType, string intermediateDirectory, string rootFiles) { throw null; } + public static System.Diagnostics.Process StartProcess(string command, string arguments, Microsoft.Build.Utilities.ExecutableType toolType, string dllName, string intermediateDirectory, string rootFiles) { throw null; } + public static System.Diagnostics.Process StartProcess(string command, string arguments, Microsoft.Build.Utilities.ExecutableType toolType, string dllName, string intermediateDirectory, string rootFiles, string cancelEventName) { throw null; } + public static void StartTrackingContext(string intermediateDirectory, string taskName) { } + public static void StartTrackingContextWithRoot(string intermediateDirectory, string taskName, string rootMarkerResponseFile) { } + public static void StopTrackingAndCleanup() { } + public static void SuspendTracking() { } + public static string TrackerArguments(string command, string arguments, string dllName, string intermediateDirectory, string rootFiles) { throw null; } + public static string TrackerArguments(string command, string arguments, string dllName, string intermediateDirectory, string rootFiles, string cancelEventName) { throw null; } + public static string TrackerCommandArguments(string command, string arguments) { throw null; } + public static string TrackerResponseFileArguments(string dllName, string intermediateDirectory, string rootFiles) { throw null; } + public static string TrackerResponseFileArguments(string dllName, string intermediateDirectory, string rootFiles, string cancelEventName) { throw null; } + public static void WriteAllTLogs(string intermediateDirectory, string taskName) { } + public static void WriteContextTLogs(string intermediateDirectory, string taskName) { } + } + public partial class FlatTrackingData + { + public FlatTrackingData(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles, bool skipMissingFiles) { } + public FlatTrackingData(Microsoft.Build.Framework.ITask ownerTask, Microsoft.Build.Framework.ITaskItem[] tlogFiles, System.DateTime missingFileTimeUtc) { } + public FlatTrackingData(Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem[] tlogFilesToIgnore, System.DateTime missingFileTimeUtc) { } + public FlatTrackingData(Microsoft.Build.Framework.ITaskItem[] tlogFiles, Microsoft.Build.Framework.ITaskItem[] tlogFilesToIgnore, System.DateTime missingFileTimeUtc, string[] excludedInputPaths, System.Collections.Generic.IDictionary sharedLastWriteTimeUtcCache) { } + public FlatTrackingData(Microsoft.Build.Framework.ITaskItem[] tlogFiles, bool skipMissingFiles) { } + public FlatTrackingData(Microsoft.Build.Framework.ITaskItem[] tlogFiles, System.DateTime missingFileTimeUtc) { } + public System.Collections.Generic.IDictionary DependencyTable { get { throw null; } } + public System.Collections.Generic.List MissingFiles { get { throw null; } set { } } + public string NewestFileName { get { throw null; } set { } } + public System.DateTime NewestFileTime { get { throw null; } set { } } + public System.DateTime NewestFileTimeUtc { get { throw null; } set { } } + public string NewestTLogFileName { get { throw null; } set { } } + public System.DateTime NewestTLogTime { get { throw null; } set { } } + public System.DateTime NewestTLogTimeUtc { get { throw null; } set { } } + public string OldestFileName { get { throw null; } set { } } + public System.DateTime OldestFileTime { get { throw null; } set { } } + public System.DateTime OldestFileTimeUtc { get { throw null; } set { } } + public bool SkipMissingFiles { get { throw null; } set { } } + public Microsoft.Build.Framework.ITaskItem[] TlogFiles { get { throw null; } set { } } + public bool TlogsAvailable { get { throw null; } set { } } + public bool TreatRootMarkersAsEntries { get { throw null; } set { } } + public bool FileIsExcludedFromDependencyCheck(string fileName) { throw null; } + public static void FinalizeTLogs(bool trackedOperationsSucceeded, Microsoft.Build.Framework.ITaskItem[] readTLogNames, Microsoft.Build.Framework.ITaskItem[] writeTLogNames, Microsoft.Build.Framework.ITaskItem[] trackedFilesToRemoveFromTLogs) { } + public System.DateTime GetLastWriteTimeUtc(string file) { throw null; } + public static bool IsUpToDate(Microsoft.Build.Utilities.Task hostTask, Microsoft.Build.Utilities.UpToDateCheckType upToDateCheckType, Microsoft.Build.Framework.ITaskItem[] readTLogNames, Microsoft.Build.Framework.ITaskItem[] writeTLogNames) { throw null; } + public static bool IsUpToDate(Microsoft.Build.Utilities.TaskLoggingHelper Log, Microsoft.Build.Utilities.UpToDateCheckType upToDateCheckType, Microsoft.Build.Utilities.FlatTrackingData inputs, Microsoft.Build.Utilities.FlatTrackingData outputs) { throw null; } + public void SaveTlog() { } + public void SaveTlog(Microsoft.Build.Utilities.DependencyFilter includeInTLog) { } + public void UpdateFileEntryDetails() { } + } + public enum HostObjectInitializationStatus + { + NoActionReturnFailure = 3, + NoActionReturnSuccess = 2, + UseAlternateToolToExecute = 1, + UseHostObjectToExecute = 0, + } + public abstract partial class Logger : Microsoft.Build.Framework.ILogger + { + protected Logger() { } + public virtual string Parameters { get { throw null; } set { } } + public virtual Microsoft.Build.Framework.LoggerVerbosity Verbosity { get { throw null; } set { } } + public virtual string FormatErrorEvent(Microsoft.Build.Framework.BuildErrorEventArgs args) { throw null; } + public virtual string FormatWarningEvent(Microsoft.Build.Framework.BuildWarningEventArgs args) { throw null; } + public abstract void Initialize(Microsoft.Build.Framework.IEventSource eventSource); + public bool IsVerbosityAtLeast(Microsoft.Build.Framework.LoggerVerbosity checkVerbosity) { throw null; } + public virtual void Shutdown() { } + } + public partial class MuxLogger : Microsoft.Build.Framework.ILogger, Microsoft.Build.Framework.INodeLogger + { + public MuxLogger() { } + public string Parameters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public Microsoft.Build.Framework.LoggerVerbosity Verbosity { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void Initialize(Microsoft.Build.Framework.IEventSource eventSource) { } + public void Initialize(Microsoft.Build.Framework.IEventSource eventSource, int maxNodeCount) { } + public void RegisterLogger(int submissionId, Microsoft.Build.Framework.ILogger logger) { } + public void Shutdown() { } + public bool UnregisterLoggers(int submissionId) { throw null; } + } + public static partial class ProcessorArchitecture + { + public const string AMD64 = "AMD64"; + public const string ARM = "ARM"; + public const string IA64 = "IA64"; + public const string MSIL = "MSIL"; + public const string X86 = "x86"; + public static string CurrentProcessArchitecture { get { throw null; } } + } + public enum TargetDotNetFrameworkVersion + { + Version11 = 0, + Version20 = 1, + Version30 = 2, + Version35 = 3, + Version40 = 4, + Version45 = 5, + VersionLatest = 5, + } + public partial class TargetPlatformSDK : System.IEquatable + { + public TargetPlatformSDK(string targetPlatformIdentifier, System.Version targetPlatformVersion, string path) { } + public string Path { get { throw null; } set { } } + public string TargetPlatformIdentifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Version TargetPlatformVersion { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool Equals(Microsoft.Build.Utilities.TargetPlatformSDK other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public abstract partial class Task : Microsoft.Build.Framework.ITask + { + protected Task() { } + protected Task(System.Resources.ResourceManager taskResources) { } + protected Task(System.Resources.ResourceManager taskResources, string helpKeywordPrefix) { } + public Microsoft.Build.Framework.IBuildEngine BuildEngine { get { throw null; } set { } } + public Microsoft.Build.Framework.IBuildEngine2 BuildEngine2 { get { throw null; } } + public Microsoft.Build.Framework.IBuildEngine3 BuildEngine3 { get { throw null; } } + public Microsoft.Build.Framework.IBuildEngine4 BuildEngine4 { get { throw null; } } + protected string HelpKeywordPrefix { get { throw null; } set { } } + public Microsoft.Build.Framework.ITaskHost HostObject { get { throw null; } set { } } + public Microsoft.Build.Utilities.TaskLoggingHelper Log { get { throw null; } } + protected System.Resources.ResourceManager TaskResources { get { throw null; } set { } } + public abstract bool Execute(); + } + public sealed partial class TaskItem : System.MarshalByRefObject, Microsoft.Build.Framework.ITaskItem, Microsoft.Build.Framework.ITaskItem2 + { + public TaskItem() { } + public TaskItem(Microsoft.Build.Framework.ITaskItem sourceItem) { } + public TaskItem(string itemSpec) { } + public TaskItem(string itemSpec, System.Collections.IDictionary itemMetadata) { } + public string ItemSpec { get { throw null; } set { } } + public int MetadataCount { get { throw null; } } + public System.Collections.ICollection MetadataNames { get { throw null; } } + string Microsoft.Build.Framework.ITaskItem2.EvaluatedIncludeEscaped { get { throw null; } set { } } + public System.Collections.IDictionary CloneCustomMetadata() { throw null; } + public void CopyMetadataTo(Microsoft.Build.Framework.ITaskItem destinationItem) { } + public string GetMetadata(string metadataName) { throw null; } + [System.Security.SecurityCriticalAttribute] + public override object InitializeLifetimeService() { throw null; } + System.Collections.IDictionary Microsoft.Build.Framework.ITaskItem2.CloneCustomMetadataEscaped() { throw null; } + string Microsoft.Build.Framework.ITaskItem2.GetMetadataValueEscaped(string metadataName) { throw null; } + void Microsoft.Build.Framework.ITaskItem2.SetMetadataValueLiteral(string metadataName, string metadataValue) { } + public static explicit operator string (Microsoft.Build.Utilities.TaskItem taskItemToCast) { throw null; } + public void RemoveMetadata(string metadataName) { } + public void SetMetadata(string metadataName, string metadataValue) { } + public override string ToString() { throw null; } + } + public partial class TaskLoggingHelper : System.MarshalByRefObject + { + public TaskLoggingHelper(Microsoft.Build.Framework.IBuildEngine buildEngine, string taskName) { } + public TaskLoggingHelper(Microsoft.Build.Framework.ITask taskInstance) { } + protected Microsoft.Build.Framework.IBuildEngine BuildEngine { get { throw null; } } + public bool HasLoggedErrors { get { throw null; } } + public string HelpKeywordPrefix { get { throw null; } set { } } + protected string TaskName { get { throw null; } } + public System.Resources.ResourceManager TaskResources { get { throw null; } set { } } + public string ExtractMessageCode(string message, out string messageWithoutCodePrefix) { messageWithoutCodePrefix = default(string); throw null; } + public virtual string FormatResourceString(string resourceName, params object[] args) { throw null; } + public virtual string FormatString(string unformatted, params object[] args) { throw null; } + public virtual string GetResourceMessage(string resourceName) { throw null; } + public override object InitializeLifetimeService() { throw null; } + public void LogCommandLine(Microsoft.Build.Framework.MessageImportance importance, string commandLine) { } + public void LogCommandLine(string commandLine) { } + public void LogCriticalMessage(string subcategory, string code, string helpKeyword, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, params object[] messageArgs) { } + public void LogError(string message, params object[] messageArgs) { } + public void LogError(string subcategory, string errorCode, string helpKeyword, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, params object[] messageArgs) { } + public void LogErrorFromException(System.Exception exception) { } + public void LogErrorFromException(System.Exception exception, bool showStackTrace) { } + public void LogErrorFromException(System.Exception exception, bool showStackTrace, bool showDetail, string file) { } + public void LogErrorFromResources(string messageResourceName, params object[] messageArgs) { } + public void LogErrorFromResources(string subcategoryResourceName, string errorCode, string helpKeyword, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string messageResourceName, params object[] messageArgs) { } + public void LogErrorWithCodeFromResources(string messageResourceName, params object[] messageArgs) { } + public void LogErrorWithCodeFromResources(string subcategoryResourceName, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string messageResourceName, params object[] messageArgs) { } + public void LogExternalProjectFinished(string message, string helpKeyword, string projectFile, bool succeeded) { } + public void LogExternalProjectStarted(string message, string helpKeyword, string projectFile, string targetNames) { } + public void LogMessage(Microsoft.Build.Framework.MessageImportance importance, string message, params object[] messageArgs) { } + public void LogMessage(string message, params object[] messageArgs) { } + public void LogMessage(string subcategory, string code, string helpKeyword, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, Microsoft.Build.Framework.MessageImportance importance, string message, params object[] messageArgs) { } + public void LogMessageFromResources(Microsoft.Build.Framework.MessageImportance importance, string messageResourceName, params object[] messageArgs) { } + public void LogMessageFromResources(string messageResourceName, params object[] messageArgs) { } + public bool LogMessageFromText(string lineOfText, Microsoft.Build.Framework.MessageImportance messageImportance) { throw null; } + public bool LogMessagesFromFile(string fileName) { throw null; } + public bool LogMessagesFromFile(string fileName, Microsoft.Build.Framework.MessageImportance messageImportance) { throw null; } + public bool LogMessagesFromStream(System.IO.TextReader stream, Microsoft.Build.Framework.MessageImportance messageImportance) { throw null; } + public void LogWarning(string message, params object[] messageArgs) { } + public void LogWarning(string subcategory, string warningCode, string helpKeyword, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string message, params object[] messageArgs) { } + public void LogWarningFromException(System.Exception exception) { } + public void LogWarningFromException(System.Exception exception, bool showStackTrace) { } + public void LogWarningFromResources(string messageResourceName, params object[] messageArgs) { } + public void LogWarningFromResources(string subcategoryResourceName, string warningCode, string helpKeyword, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string messageResourceName, params object[] messageArgs) { } + public void LogWarningWithCodeFromResources(string messageResourceName, params object[] messageArgs) { } + public void LogWarningWithCodeFromResources(string subcategoryResourceName, string file, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, string messageResourceName, params object[] messageArgs) { } + public void MarkAsInactive() { } + } + public static partial class ToolLocationHelper + { + public static string PathToSystem { get { throw null; } } + public static void ClearSDKStaticCache() { } + public static System.Collections.Generic.IList GetAssemblyFoldersExInfo(string registryRoot, string targetFrameworkVersion, string registryKeySuffix, string osVersion, string platform, System.Reflection.ProcessorArchitecture targetProcessorArchitecture) { throw null; } + public static string GetDisplayNameForTargetFrameworkDirectory(string targetFrameworkDirectory, System.Runtime.Versioning.FrameworkName frameworkName) { throw null; } + public static string GetDotNetFrameworkRootRegistryKey(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetDotNetFrameworkSdkInstallKeyValue(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetDotNetFrameworkSdkInstallKeyValue(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion) { throw null; } + public static string GetDotNetFrameworkSdkRootRegistryKey(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetDotNetFrameworkSdkRootRegistryKey(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion) { throw null; } + public static string GetDotNetFrameworkVersionFolderPrefix(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetPathToDotNetFramework(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetPathToDotNetFramework(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { throw null; } + public static string GetPathToDotNetFrameworkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetPathToDotNetFrameworkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { throw null; } + public static string GetPathToDotNetFrameworkReferenceAssemblies(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetPathToDotNetFrameworkSdk(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetPathToDotNetFrameworkSdk(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion) { throw null; } + public static string GetPathToDotNetFrameworkSdkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version) { throw null; } + public static string GetPathToDotNetFrameworkSdkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { throw null; } + public static string GetPathToDotNetFrameworkSdkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion) { throw null; } + public static string GetPathToDotNetFrameworkSdkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { throw null; } + public static System.Collections.Generic.IList GetPathToReferenceAssemblies(System.Runtime.Versioning.FrameworkName frameworkName) { throw null; } + public static System.Collections.Generic.IList GetPathToReferenceAssemblies(string targetFrameworkRootPath, System.Runtime.Versioning.FrameworkName frameworkName) { throw null; } + public static System.Collections.Generic.IList GetPathToReferenceAssemblies(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile) { throw null; } + public static string GetPathToStandardLibraries(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile) { throw null; } + public static string GetPathToStandardLibraries(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetFrameworkProfile, string platformTarget) { throw null; } + public static string GetPathToSystemFile(string fileName) { throw null; } + public static string GetPathToWindowsSdk(Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion) { throw null; } + public static string GetPathToWindowsSdkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion) { throw null; } + public static string GetPathToWindowsSdkFile(string fileName, Microsoft.Build.Utilities.TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.VisualStudioVersion visualStudioVersion, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { throw null; } + public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, string targetPlatformVersion) { throw null; } + public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, string targetPlatformVersion, string diskRoots, string registryRoot) { throw null; } + public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, System.Version targetPlatformVersion) { throw null; } + public static string GetPlatformExtensionSDKLocation(string sdkMoniker, string targetPlatformIdentifier, System.Version targetPlatformVersion, string[] diskRoots, string registryRoot) { throw null; } + public static System.Collections.Generic.IDictionary GetPlatformExtensionSDKLocations(string targetPlatformIdentifier, System.Version targetPlatformVersion) { throw null; } + public static System.Collections.Generic.IDictionary GetPlatformExtensionSDKLocations(string[] diskRoots, string registryRoot, string targetPlatformIdentifier, System.Version targetPlatformVersion) { throw null; } + public static string GetPlatformSDKLocation(string targetPlatformIdentifier, string targetPlatformVersion) { throw null; } + public static string GetPlatformSDKLocation(string targetPlatformIdentifier, string targetPlatformVersion, string diskRoots, string registryRoot) { throw null; } + public static string GetPlatformSDKLocation(string targetPlatformIdentifier, System.Version targetPlatformVersion) { throw null; } + public static string GetPlatformSDKLocation(string targetPlatformIdentifier, System.Version targetPlatformVersion, string[] diskRoots, string registryRoot) { throw null; } + public static string GetProgramFilesReferenceAssemblyRoot() { throw null; } + public static System.Collections.Generic.IList GetSDKDesignTimeFolders(string sdkRoot) { throw null; } + public static System.Collections.Generic.IList GetSDKDesignTimeFolders(string sdkRoot, string targetConfiguration, string targetArchitecture) { throw null; } + public static System.Collections.Generic.IList GetSDKRedistFolders(string sdkRoot) { throw null; } + public static System.Collections.Generic.IList GetSDKRedistFolders(string sdkRoot, string targetConfiguration, string targetArchitecture) { throw null; } + public static System.Collections.Generic.IList GetSDKReferenceFolders(string sdkRoot) { throw null; } + public static System.Collections.Generic.IList GetSDKReferenceFolders(string sdkRoot, string targetConfiguration, string targetArchitecture) { throw null; } + public static System.Collections.Generic.IList GetSupportedTargetFrameworks() { throw null; } + public static System.Collections.Generic.IList GetTargetPlatformSdks() { throw null; } + public static System.Collections.Generic.IList GetTargetPlatformSdks(string[] diskRoots, string registryRoot) { throw null; } + public static System.Runtime.Versioning.FrameworkName HighestVersionOfTargetFrameworkIdentifier(string targetFrameworkRootDirectory, string frameworkIdentifier) { throw null; } + } + public abstract partial class ToolTask : Microsoft.Build.Utilities.Task, Microsoft.Build.Framework.ICancelableTask, Microsoft.Build.Framework.ITask + { + protected ToolTask() { } + protected ToolTask(System.Resources.ResourceManager taskResources) { } + protected ToolTask(System.Resources.ResourceManager taskResources, string helpKeywordPrefix) { } + public bool EchoOff { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ObsoleteAttribute("Use EnvironmentVariables property")] + protected virtual System.Collections.Specialized.StringDictionary EnvironmentOverride { get { throw null; } } + public string[] EnvironmentVariables { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [Microsoft.Build.Framework.OutputAttribute] + public int ExitCode { get { throw null; } } + protected virtual bool HasLoggedErrors { get { throw null; } } + public bool LogStandardErrorAsError { get { throw null; } set { } } + protected virtual System.Text.Encoding ResponseFileEncoding { get { throw null; } } + protected virtual System.Text.Encoding StandardErrorEncoding { get { throw null; } } + public string StandardErrorImportance { get { throw null; } set { } } + protected Microsoft.Build.Framework.MessageImportance StandardErrorImportanceToUse { get { throw null; } } + protected virtual Microsoft.Build.Framework.MessageImportance StandardErrorLoggingImportance { get { throw null; } } + protected virtual System.Text.Encoding StandardOutputEncoding { get { throw null; } } + public string StandardOutputImportance { get { throw null; } set { } } + protected Microsoft.Build.Framework.MessageImportance StandardOutputImportanceToUse { get { throw null; } } + protected virtual Microsoft.Build.Framework.MessageImportance StandardOutputLoggingImportance { get { throw null; } } + protected int TaskProcessTerminationTimeout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual int Timeout { get { throw null; } set { } } + protected System.Threading.ManualResetEvent ToolCanceled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public virtual string ToolExe { get { throw null; } set { } } + protected abstract string ToolName { get; } + public string ToolPath { get { throw null; } set { } } + public bool UseCommandProcessor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool YieldDuringToolExecution { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected virtual bool CallHostObjectToExecute() { throw null; } + public virtual void Cancel() { } + protected void DeleteTempFile(string fileName) { } + public override bool Execute() { throw null; } + protected virtual int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) { throw null; } + protected virtual string GenerateCommandLineCommands() { throw null; } + protected abstract string GenerateFullPathToTool(); + protected virtual string GenerateResponseFileCommands() { throw null; } + protected System.Diagnostics.ProcessStartInfo GetProcessStartInfo(string pathToTool, string commandLineCommands, string responseFileSwitch) { throw null; } + protected virtual string GetResponseFileSwitch(string responseFilePath) { throw null; } + protected virtual string GetWorkingDirectory() { throw null; } + protected virtual bool HandleTaskExecutionErrors() { throw null; } + protected virtual Microsoft.Build.Utilities.HostObjectInitializationStatus InitializeHostObject() { throw null; } + protected virtual void LogEventsFromTextOutput(string singleLine, Microsoft.Build.Framework.MessageImportance messageImportance) { } + protected virtual void LogPathToTool(string toolName, string pathToTool) { } + protected virtual void LogToolCommand(string message) { } + protected virtual string ResponseFileEscape(string responseString) { throw null; } + protected virtual bool SkipTaskExecution() { throw null; } + protected internal virtual bool ValidateParameters() { throw null; } + } + public static partial class TrackedDependencies + { + public static Microsoft.Build.Framework.ITaskItem[] ExpandWildcards(Microsoft.Build.Framework.ITaskItem[] expand) { throw null; } + } + public enum UpToDateCheckType + { + InputNewerThanOutput = 0, + InputNewerThanTracking = 2, + InputOrOutputNewerThanTracking = 1, + } + public enum VisualStudioVersion + { + Version100 = 0, + Version110 = 1, + VersionLatest = 1, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.cs.REMOVED.git-id new file mode 100644 index 0000000000..e6dec15b35 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.Build.cs.REMOVED.git-id @@ -0,0 +1 @@ +a856a227c5701ba844edc85de7873f0ad61099f5 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.CSharp.cs b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.CSharp.cs new file mode 100644 index 0000000000..3ba4d4db0b --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.CSharp.cs @@ -0,0 +1,92 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Microsoft.CSharp.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Microsoft.CSharp.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.CSharp.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace Microsoft.CSharp.RuntimeBinder +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class Binder + { + public static System.Runtime.CompilerServices.CallSiteBinder BinaryOperation(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Linq.Expressions.ExpressionType operation, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Type type, System.Type context) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder GetIndex(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder GetMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, string name, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder Invoke(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder InvokeConstructor(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, string name, System.Collections.Generic.IEnumerable typeArguments, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder IsEvent(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, string name, System.Type context) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder SetIndex(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder SetMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, string name, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + public static System.Runtime.CompilerServices.CallSiteBinder UnaryOperation(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags flags, System.Linq.Expressions.ExpressionType operation, System.Type context, System.Collections.Generic.IEnumerable argumentInfo) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class CSharpArgumentInfo + { + internal CSharpArgumentInfo() { } + public static Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags flags, string name) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.FlagsAttribute] + public enum CSharpArgumentInfoFlags + { + Constant = 2, + IsOut = 16, + IsRef = 8, + IsStaticType = 32, + NamedArgument = 4, + None = 0, + UseCompileTimeType = 1, + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.FlagsAttribute] + public enum CSharpBinderFlags + { + BinaryOperationLogical = 8, + CheckedContext = 1, + ConvertArrayIndex = 32, + ConvertExplicit = 16, + InvokeSimpleName = 2, + InvokeSpecialName = 4, + None = 0, + ResultDiscarded = 256, + ResultIndexed = 64, + ValueFromCompoundAssignment = 128, + } + [System.SerializableAttribute] + public partial class RuntimeBinderException : System.Exception + { + public RuntimeBinderException() { } + protected RuntimeBinderException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public RuntimeBinderException(string message) { } + public RuntimeBinderException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class RuntimeBinderInternalCompilerException : System.Exception + { + public RuntimeBinderInternalCompilerException() { } + protected RuntimeBinderInternalCompilerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public RuntimeBinderInternalCompilerException(string message) { } + public RuntimeBinderInternalCompilerException(string message, System.Exception innerException) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.VisualBasic.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.VisualBasic.cs.REMOVED.git-id new file mode 100644 index 0000000000..a72da9bbe6 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.VisualBasic.cs.REMOVED.git-id @@ -0,0 +1 @@ +cc3f77c6046ae7aff01b75cb35c5de063583c4b3 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/Microsoft.VisualC.cs b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.VisualC.cs new file mode 100644 index 0000000000..c2432e7b3d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/Microsoft.VisualC.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("10.0.0.0")] +[assembly:System.CLSCompliantAttribute(false)] +[assembly:System.Runtime.AssemblyTargetedPatchBandAttribute("1.0.23-245435169")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.TypeLibVersionAttribute(8, 0)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace Microsoft.VisualC +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(32767))] + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class DebugInfoInPDBAttribute : System.Attribute + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public DebugInfoInPDBAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32767))] + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class DecoratedNameAttribute : System.Attribute + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public DecoratedNameAttribute() { } + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public DecoratedNameAttribute(string decoratedName) { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class IsConstModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public IsConstModifier() { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class IsCXXReferenceModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public IsCXXReferenceModifier() { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class IsLongModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public IsLongModifier() { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class IsSignedModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public IsSignedModifier() { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class IsVolatileModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public IsVolatileModifier() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32767))] + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class MiscellaneousBitsAttribute : System.Attribute + { + public int m_dwAttrs; + public MiscellaneousBitsAttribute(int miscellaneousBits) { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class NeedsCopyConstructorModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public NeedsCopyConstructorModifier() { } + } + [System.ObsoleteAttribute("Microsoft.VisualC.dll is an obsolete assembly and exists only for backwards compatibility.")] + public sealed partial class NoSignSpecifiedModifier + { + [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline this type of method across NGen image boundaries")] + public NoSignSpecifiedModifier() { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ComponentModel.Composition.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ComponentModel.Composition.cs new file mode 100644 index 0000000000..2ab0aecf1d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ComponentModel.Composition.cs @@ -0,0 +1,690 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.Composition.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.Composition.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.Composition.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +namespace System +{ + [System.SerializableAttribute] + public partial class Lazy : System.Lazy + { + public Lazy(System.Func valueFactory, TMetadata metadata) { } + public Lazy(System.Func valueFactory, TMetadata metadata, bool isThreadSafe) { } + public Lazy(System.Func valueFactory, TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { } + public Lazy(TMetadata metadata) { } + public Lazy(TMetadata metadata, bool isThreadSafe) { } + public Lazy(TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { } + public TMetadata Metadata { get { throw null; } } + } +} +namespace System.ComponentModel.Composition +{ + public static partial class AttributedModelServices + { + public static System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue(this System.ComponentModel.Composition.Hosting.CompositionBatch batch, string contractName, T exportedValue) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePart AddExportedValue(this System.ComponentModel.Composition.Hosting.CompositionBatch batch, T exportedValue) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePart AddPart(this System.ComponentModel.Composition.Hosting.CompositionBatch batch, object attributedPart) { throw null; } + public static void ComposeExportedValue(this System.ComponentModel.Composition.Hosting.CompositionContainer container, string contractName, T exportedValue) { } + public static void ComposeExportedValue(this System.ComponentModel.Composition.Hosting.CompositionContainer container, T exportedValue) { } + public static void ComposeParts(this System.ComponentModel.Composition.Hosting.CompositionContainer container, params object[] attributedParts) { } + public static System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition, object attributedPart) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(object attributedPart) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(object attributedPart, System.Reflection.ReflectionContext reflectionContext) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition(System.Type type, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition(System.Type type, System.ComponentModel.Composition.Primitives.ICompositionElement origin, bool ensureIsDiscoverable) { throw null; } + public static bool Exports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, System.Type contractType) { throw null; } + public static bool Exports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part) { throw null; } + public static string GetContractName(System.Type type) { throw null; } + public static TMetadataView GetMetadataView(System.Collections.Generic.IDictionary metadata) { throw null; } + public static string GetTypeIdentity(System.Reflection.MethodInfo method) { throw null; } + public static string GetTypeIdentity(System.Type type) { throw null; } + public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, System.Type contractType) { throw null; } + public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, System.Type contractType, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) { throw null; } + public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part) { throw null; } + public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce(this System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePart SatisfyImportsOnce(this System.ComponentModel.Composition.ICompositionService compositionService, object attributedPart, System.Reflection.ReflectionContext reflectionContext) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=true)] + public partial class CatalogReflectionContextAttribute : System.Attribute + { + public CatalogReflectionContextAttribute(System.Type reflectionContextType) { } + public System.Reflection.ReflectionContext CreateReflectionContext() { throw null; } + } + [System.SerializableAttribute] + public partial class ChangeRejectedException : System.ComponentModel.Composition.CompositionException + { + public ChangeRejectedException() { } + public ChangeRejectedException(System.Collections.Generic.IEnumerable errors) { } + public ChangeRejectedException(string message) { } + public ChangeRejectedException(string message, System.Exception innerException) { } + public override string Message { get { throw null; } } + } + [System.SerializableAttribute] + public partial class CompositionContractMismatchException : System.Exception + { + public CompositionContractMismatchException() { } + [System.Security.SecuritySafeCriticalAttribute] + protected CompositionContractMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public CompositionContractMismatchException(string message) { } + public CompositionContractMismatchException(string message, System.Exception innerException) { } + } + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.CompositionErrorDebuggerProxy")] + [System.SerializableAttribute] + public partial class CompositionError + { + public CompositionError(string message) { } + public CompositionError(string message, System.ComponentModel.Composition.Primitives.ICompositionElement element) { } + public CompositionError(string message, System.ComponentModel.Composition.Primitives.ICompositionElement element, System.Exception exception) { } + public CompositionError(string message, System.Exception exception) { } + public string Description { get { throw null; } } + public System.ComponentModel.Composition.Primitives.ICompositionElement Element { get { throw null; } } + public System.Exception Exception { get { throw null; } } + public override string ToString() { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("{Message}")] + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.CompositionExceptionDebuggerProxy")] + [System.SerializableAttribute] + public partial class CompositionException : System.Exception + { + public CompositionException() { } + public CompositionException(System.Collections.Generic.IEnumerable errors) { } + public CompositionException(string message) { } + public CompositionException(string message, System.Exception innerException) { } + public System.Collections.ObjectModel.ReadOnlyCollection Errors { get { throw null; } } + public override string Message { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection RootCauses { get { throw null; } } + } + public enum CreationPolicy + { + Any = 0, + NonShared = 2, + Shared = 1, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(452), AllowMultiple=true, Inherited=false)] + public partial class ExportAttribute : System.Attribute + { + public ExportAttribute() { } + public ExportAttribute(string contractName) { } + public ExportAttribute(string contractName, System.Type contractType) { } + public ExportAttribute(System.Type contractType) { } + public string ContractName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Type ContractType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class ExportFactory + { + public ExportFactory(System.Func> exportLifetimeContextCreator) { } + public System.ComponentModel.Composition.ExportLifetimeContext CreateExport() { throw null; } + } + public partial class ExportFactory : System.ComponentModel.Composition.ExportFactory + { + public ExportFactory(System.Func> exportLifetimeContextCreator, TMetadata metadata) : base (default(System.Func>)) { } + public TMetadata Metadata { get { throw null; } } + } + public sealed partial class ExportLifetimeContext : System.IDisposable + { + public ExportLifetimeContext(T value, System.Action disposeAction) { } + public T Value { get { throw null; } } + public void Dispose() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1476), AllowMultiple=true, Inherited=false)] + public sealed partial class ExportMetadataAttribute : System.Attribute + { + public ExportMetadataAttribute(string name, object value) { } + public bool IsMultiple { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial interface ICompositionService + { + void SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart part); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false, Inherited=false)] + public partial class ImportAttribute : System.Attribute + { + public ImportAttribute() { } + public ImportAttribute(string contractName) { } + public ImportAttribute(string contractName, System.Type contractType) { } + public ImportAttribute(System.Type contractType) { } + public bool AllowDefault { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool AllowRecomposition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ContractName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Type ContractType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.ComponentModel.Composition.ImportSource Source { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.Diagnostics.DebuggerDisplayAttribute("{Message}")] + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.ImportCardinalityMismatchExceptionDebuggerProxy")] + [System.SerializableAttribute] + public partial class ImportCardinalityMismatchException : System.Exception + { + public ImportCardinalityMismatchException() { } + [System.Security.SecuritySafeCriticalAttribute] + protected ImportCardinalityMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ImportCardinalityMismatchException(string message) { } + public ImportCardinalityMismatchException(string message, System.Exception innerException) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32), AllowMultiple=false, Inherited=false)] + public partial class ImportingConstructorAttribute : System.Attribute + { + public ImportingConstructorAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false, Inherited=false)] + public partial class ImportManyAttribute : System.Attribute + { + public ImportManyAttribute() { } + public ImportManyAttribute(string contractName) { } + public ImportManyAttribute(string contractName, System.Type contractType) { } + public ImportManyAttribute(System.Type contractType) { } + public bool AllowRecomposition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ContractName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Type ContractType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.ComponentModel.Composition.ImportSource Source { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public enum ImportSource + { + Any = 0, + Local = 1, + NonLocal = 2, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1028), AllowMultiple=true, Inherited=true)] + public partial class InheritedExportAttribute : System.ComponentModel.Composition.ExportAttribute + { + public InheritedExportAttribute() { } + public InheritedExportAttribute(string contractName) { } + public InheritedExportAttribute(string contractName, System.Type contractType) { } + public InheritedExportAttribute(System.Type contractType) { } + } + public partial interface IPartImportsSatisfiedNotification + { + void OnImportsSatisfied(); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class MetadataAttributeAttribute : System.Attribute + { + public MetadataAttributeAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1024), AllowMultiple=false, Inherited=false)] + public sealed partial class MetadataViewImplementationAttribute : System.Attribute + { + public MetadataViewImplementationAttribute(System.Type implementationType) { } + public System.Type ImplementationType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)] + public sealed partial class PartCreationPolicyAttribute : System.Attribute + { + public PartCreationPolicyAttribute(System.ComponentModel.Composition.CreationPolicy creationPolicy) { } + public System.ComponentModel.Composition.CreationPolicy CreationPolicy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=true, Inherited=false)] + public sealed partial class PartMetadataAttribute : System.Attribute + { + public PartMetadataAttribute(string name, object value) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)] + public sealed partial class PartNotDiscoverableAttribute : System.Attribute + { + public PartNotDiscoverableAttribute() { } + } +} +namespace System.ComponentModel.Composition.Hosting +{ + public partial class AggregateCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged + { + public AggregateCatalog() { } + public AggregateCatalog(System.Collections.Generic.IEnumerable catalogs) { } + public AggregateCatalog(params System.ComponentModel.Composition.Primitives.ComposablePartCatalog[] catalogs) { } + public System.Collections.Generic.ICollection Catalogs { get { throw null; } } + public event System.EventHandler Changed { add { } remove { } } + public event System.EventHandler Changing { add { } remove { } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + protected virtual void OnChanged(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + protected virtual void OnChanging(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + } + public partial class AggregateExportProvider : System.ComponentModel.Composition.Hosting.ExportProvider, System.IDisposable + { + public AggregateExportProvider(System.Collections.Generic.IEnumerable providers) { } + public AggregateExportProvider(params System.ComponentModel.Composition.Hosting.ExportProvider[] providers) { } + public System.Collections.ObjectModel.ReadOnlyCollection Providers { get { throw null; } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected override System.Collections.Generic.IEnumerable GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { throw null; } + } + public partial class ApplicationCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Primitives.ICompositionElement + { + public ApplicationCatalog() { } + public ApplicationCatalog(System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public ApplicationCatalog(System.Reflection.ReflectionContext reflectionContext) { } + public ApplicationCatalog(System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get { throw null; } } + System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get { throw null; } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + public override string ToString() { throw null; } + } + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.Hosting.AssemblyCatalogDebuggerProxy")] + public partial class AssemblyCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Primitives.ICompositionElement + { + public AssemblyCatalog(System.Reflection.Assembly assembly) { } + public AssemblyCatalog(System.Reflection.Assembly assembly, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public AssemblyCatalog(System.Reflection.Assembly assembly, System.Reflection.ReflectionContext reflectionContext) { } + public AssemblyCatalog(System.Reflection.Assembly assembly, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public AssemblyCatalog(string codeBase) { } + public AssemblyCatalog(string codeBase, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public AssemblyCatalog(string codeBase, System.Reflection.ReflectionContext reflectionContext) { } + public AssemblyCatalog(string codeBase, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public System.Reflection.Assembly Assembly { get { throw null; } } + string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get { throw null; } } + System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get { throw null; } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + public override string ToString() { throw null; } + } + public partial class AtomicComposition : System.IDisposable + { + public AtomicComposition() { } + public AtomicComposition(System.ComponentModel.Composition.Hosting.AtomicComposition outerAtomicComposition) { } + public void AddCompleteAction(System.Action completeAction) { } + public void AddRevertAction(System.Action revertAction) { } + public void Complete() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public void SetValue(object key, object value) { } + public bool TryGetValue(object key, bool localAtomicCompositionOnly, out T value) { value = default(T); throw null; } + public bool TryGetValue(object key, out T value) { value = default(T); throw null; } + } + public partial class CatalogExportProvider : System.ComponentModel.Composition.Hosting.ExportProvider, System.IDisposable + { + public CatalogExportProvider(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog) { } + public CatalogExportProvider(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, bool isThreadSafe) { } + public CatalogExportProvider(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions) { } + public System.ComponentModel.Composition.Primitives.ComposablePartCatalog Catalog { get { throw null; } } + public System.ComponentModel.Composition.Hosting.ExportProvider SourceProvider { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected override System.Collections.Generic.IEnumerable GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { throw null; } + } + public static partial class CatalogExtensions + { + public static System.ComponentModel.Composition.Hosting.CompositionService CreateCompositionService(this System.ComponentModel.Composition.Primitives.ComposablePartCatalog composablePartCatalog) { throw null; } + } + public partial class ComposablePartCatalogChangeEventArgs : System.EventArgs + { + public ComposablePartCatalogChangeEventArgs(System.Collections.Generic.IEnumerable addedDefinitions, System.Collections.Generic.IEnumerable removedDefinitions, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { } + public System.Collections.Generic.IEnumerable AddedDefinitions { get { throw null; } } + public System.ComponentModel.Composition.Hosting.AtomicComposition AtomicComposition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IEnumerable RemovedDefinitions { get { throw null; } } + } + public partial class ComposablePartExportProvider : System.ComponentModel.Composition.Hosting.ExportProvider, System.IDisposable + { + public ComposablePartExportProvider() { } + public ComposablePartExportProvider(bool isThreadSafe) { } + public ComposablePartExportProvider(System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions) { } + public System.ComponentModel.Composition.Hosting.ExportProvider SourceProvider { get { throw null; } set { } } + public void Compose(System.ComponentModel.Composition.Hosting.CompositionBatch batch) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected override System.Collections.Generic.IEnumerable GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { throw null; } + } + public partial class CompositionBatch + { + public CompositionBatch() { } + public CompositionBatch(System.Collections.Generic.IEnumerable partsToAdd, System.Collections.Generic.IEnumerable partsToRemove) { } + public System.Collections.ObjectModel.ReadOnlyCollection PartsToAdd { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection PartsToRemove { get { throw null; } } + public System.ComponentModel.Composition.Primitives.ComposablePart AddExport(System.ComponentModel.Composition.Primitives.Export export) { throw null; } + public void AddPart(System.ComponentModel.Composition.Primitives.ComposablePart part) { } + public void RemovePart(System.ComponentModel.Composition.Primitives.ComposablePart part) { } + } + public static partial class CompositionConstants + { + public const string ExportTypeIdentityMetadataName = "ExportTypeIdentity"; + public const string GenericContractMetadataName = "System.ComponentModel.Composition.GenericContractName"; + public const string GenericParametersMetadataName = "System.ComponentModel.Composition.GenericParameters"; + public const string ImportSourceMetadataName = "System.ComponentModel.Composition.ImportSource"; + public const string IsGenericPartMetadataName = "System.ComponentModel.Composition.IsGenericPart"; + public const string PartCreationPolicyMetadataName = "System.ComponentModel.Composition.CreationPolicy"; + } + public partial class CompositionContainer : System.ComponentModel.Composition.Hosting.ExportProvider, System.ComponentModel.Composition.ICompositionService, System.IDisposable + { + public CompositionContainer() { } + public CompositionContainer(System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions, params System.ComponentModel.Composition.Hosting.ExportProvider[] providers) { } + public CompositionContainer(params System.ComponentModel.Composition.Hosting.ExportProvider[] providers) { } + public CompositionContainer(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, bool isThreadSafe, params System.ComponentModel.Composition.Hosting.ExportProvider[] providers) { } + public CompositionContainer(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions, params System.ComponentModel.Composition.Hosting.ExportProvider[] providers) { } + public CompositionContainer(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, params System.ComponentModel.Composition.Hosting.ExportProvider[] providers) { } + public System.ComponentModel.Composition.Primitives.ComposablePartCatalog Catalog { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection Providers { get { throw null; } } + public void Compose(System.ComponentModel.Composition.Hosting.CompositionBatch batch) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected override System.Collections.Generic.IEnumerable GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { throw null; } + public void ReleaseExport(System.ComponentModel.Composition.Primitives.Export export) { } + public void ReleaseExports(System.Collections.Generic.IEnumerable exports) { } + public void ReleaseExports(System.Collections.Generic.IEnumerable> exports) { } + public void ReleaseExports(System.Collections.Generic.IEnumerable> exports) { } + public void ReleaseExport(System.Lazy export) { } + public void SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart part) { } + } + [System.FlagsAttribute] + public enum CompositionOptions + { + Default = 0, + DisableSilentRejection = 1, + ExportCompositionService = 4, + IsThreadSafe = 2, + } + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.Hosting.CompositionScopeDefinitionDebuggerProxy")] + public partial class CompositionScopeDefinition : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged + { + protected CompositionScopeDefinition() { } + public CompositionScopeDefinition(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.Collections.Generic.IEnumerable children) { } + public CompositionScopeDefinition(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.Collections.Generic.IEnumerable children, System.Collections.Generic.IEnumerable publicSurface) { } + public virtual System.Collections.Generic.IEnumerable Children { get { throw null; } } + public virtual System.Collections.Generic.IEnumerable PublicSurface { get { throw null; } } + public event System.EventHandler Changed { add { } remove { } } + public event System.EventHandler Changing { add { } remove { } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + protected virtual void OnChanged(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + protected virtual void OnChanging(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + } + public partial class CompositionService : System.ComponentModel.Composition.ICompositionService, System.IDisposable + { + internal CompositionService() { } + public void Dispose() { } + public void SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart part) { } + } + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.Hosting.DirectoryCatalog.DirectoryCatalogDebuggerProxy")] + public partial class DirectoryCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged, System.ComponentModel.Composition.Primitives.ICompositionElement + { + public DirectoryCatalog(string path) { } + public DirectoryCatalog(string path, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public DirectoryCatalog(string path, System.Reflection.ReflectionContext reflectionContext) { } + public DirectoryCatalog(string path, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public DirectoryCatalog(string path, string searchPattern) { } + public DirectoryCatalog(string path, string searchPattern, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public DirectoryCatalog(string path, string searchPattern, System.Reflection.ReflectionContext reflectionContext) { } + public DirectoryCatalog(string path, string searchPattern, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public string FullPath { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection LoadedFiles { get { throw null; } } + public string Path { get { throw null; } } + public string SearchPattern { get { throw null; } } + string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get { throw null; } } + System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get { throw null; } } + public event System.EventHandler Changed { add { } remove { } } + public event System.EventHandler Changing { add { } remove { } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + protected virtual void OnChanged(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + protected virtual void OnChanging(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + public void Refresh() { } + public override string ToString() { throw null; } + } + public abstract partial class ExportProvider + { + protected ExportProvider() { } + public event System.EventHandler ExportsChanged { add { } remove { } } + public event System.EventHandler ExportsChanging { add { } remove { } } + public T GetExportedValueOrDefault() { throw null; } + public T GetExportedValueOrDefault(string contractName) { throw null; } + public System.Collections.Generic.IEnumerable GetExportedValues() { throw null; } + public System.Collections.Generic.IEnumerable GetExportedValues(string contractName) { throw null; } + public T GetExportedValue() { throw null; } + public T GetExportedValue(string contractName) { throw null; } + public System.Collections.Generic.IEnumerable GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + public System.Collections.Generic.IEnumerable GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { throw null; } + public System.Collections.Generic.IEnumerable> GetExports(System.Type type, System.Type metadataViewType, string contractName) { throw null; } + protected abstract System.Collections.Generic.IEnumerable GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition); + public System.Collections.Generic.IEnumerable> GetExports() { throw null; } + public System.Collections.Generic.IEnumerable> GetExports(string contractName) { throw null; } + public System.Collections.Generic.IEnumerable> GetExports() { throw null; } + public System.Collections.Generic.IEnumerable> GetExports(string contractName) { throw null; } + public System.Lazy GetExport() { throw null; } + public System.Lazy GetExport(string contractName) { throw null; } + public System.Lazy GetExport() { throw null; } + public System.Lazy GetExport(string contractName) { throw null; } + protected virtual void OnExportsChanged(System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs e) { } + protected virtual void OnExportsChanging(System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs e) { } + public bool TryGetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition, out System.Collections.Generic.IEnumerable exports) { exports = default(System.Collections.Generic.IEnumerable); throw null; } + } + public partial class ExportsChangeEventArgs : System.EventArgs + { + public ExportsChangeEventArgs(System.Collections.Generic.IEnumerable addedExports, System.Collections.Generic.IEnumerable removedExports, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { } + public System.Collections.Generic.IEnumerable AddedExports { get { throw null; } } + public System.ComponentModel.Composition.Hosting.AtomicComposition AtomicComposition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IEnumerable ChangedContractNames { get { throw null; } } + public System.Collections.Generic.IEnumerable RemovedExports { get { throw null; } } + } + public partial class FilteredCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Hosting.INotifyComposablePartCatalogChanged + { + public FilteredCatalog(System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.Func filter) { } + public System.ComponentModel.Composition.Hosting.FilteredCatalog Complement { get { throw null; } } + public event System.EventHandler Changed { add { } remove { } } + public event System.EventHandler Changing { add { } remove { } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependencies() { throw null; } + public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependencies(System.Func importFilter) { throw null; } + public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependents() { throw null; } + public System.ComponentModel.Composition.Hosting.FilteredCatalog IncludeDependents(System.Func importFilter) { throw null; } + protected virtual void OnChanged(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + protected virtual void OnChanging(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs e) { } + } + public partial class ImportEngine : System.ComponentModel.Composition.ICompositionService, System.IDisposable + { + public ImportEngine(System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider) { } + public ImportEngine(System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider, bool isThreadSafe) { } + public ImportEngine(System.ComponentModel.Composition.Hosting.ExportProvider sourceProvider, System.ComponentModel.Composition.Hosting.CompositionOptions compositionOptions) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public void PreviewImports(System.ComponentModel.Composition.Primitives.ComposablePart part, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { } + public void ReleaseImports(System.ComponentModel.Composition.Primitives.ComposablePart part, System.ComponentModel.Composition.Hosting.AtomicComposition atomicComposition) { } + public void SatisfyImports(System.ComponentModel.Composition.Primitives.ComposablePart part) { } + public void SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart part) { } + } + public partial interface INotifyComposablePartCatalogChanged + { + event System.EventHandler Changed; + event System.EventHandler Changing; + } + public static partial class ScopingExtensions + { + public static bool ContainsPartMetadataWithKey(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key) { throw null; } + public static bool ContainsPartMetadata(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string key, T value) { throw null; } + public static bool Exports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName) { throw null; } + public static System.ComponentModel.Composition.Hosting.FilteredCatalog Filter(this System.ComponentModel.Composition.Primitives.ComposablePartCatalog catalog, System.Func filter) { throw null; } + public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName) { throw null; } + public static bool Imports(this System.ComponentModel.Composition.Primitives.ComposablePartDefinition part, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality importCardinality) { throw null; } + } + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy")] + public partial class TypeCatalog : System.ComponentModel.Composition.Primitives.ComposablePartCatalog, System.ComponentModel.Composition.Primitives.ICompositionElement + { + public TypeCatalog(System.Collections.Generic.IEnumerable types) { } + public TypeCatalog(System.Collections.Generic.IEnumerable types, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public TypeCatalog(System.Collections.Generic.IEnumerable types, System.Reflection.ReflectionContext reflectionContext) { } + public TypeCatalog(System.Collections.Generic.IEnumerable types, System.Reflection.ReflectionContext reflectionContext, System.ComponentModel.Composition.Primitives.ICompositionElement definitionOrigin) { } + public TypeCatalog(params System.Type[] types) { } + string System.ComponentModel.Composition.Primitives.ICompositionElement.DisplayName { get { throw null; } } + System.ComponentModel.Composition.Primitives.ICompositionElement System.ComponentModel.Composition.Primitives.ICompositionElement.Origin { get { throw null; } } + protected override void Dispose(bool disposing) { } + public override System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public override string ToString() { throw null; } + } +} +namespace System.ComponentModel.Composition.Primitives +{ + public abstract partial class ComposablePart + { + protected ComposablePart() { } + public abstract System.Collections.Generic.IEnumerable ExportDefinitions { get; } + public abstract System.Collections.Generic.IEnumerable ImportDefinitions { get; } + public virtual System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public virtual void Activate() { } + public abstract object GetExportedValue(System.ComponentModel.Composition.Primitives.ExportDefinition definition); + public abstract void SetImport(System.ComponentModel.Composition.Primitives.ImportDefinition definition, System.Collections.Generic.IEnumerable exports); + } + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy")] + public abstract partial class ComposablePartCatalog : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable + { + protected ComposablePartCatalog() { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public virtual System.Linq.IQueryable Parts { get { throw null; } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public virtual System.Collections.Generic.IEnumerable> GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition definition) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public abstract partial class ComposablePartDefinition + { + protected ComposablePartDefinition() { } + public abstract System.Collections.Generic.IEnumerable ExportDefinitions { get; } + public abstract System.Collections.Generic.IEnumerable ImportDefinitions { get; } + public virtual System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public abstract System.ComponentModel.Composition.Primitives.ComposablePart CreatePart(); + } + [System.Diagnostics.DebuggerDisplayAttribute("{Message}")] + [System.Diagnostics.DebuggerTypeProxyAttribute("System.ComponentModel.Composition.Primitives.ComposablePartExceptionDebuggerProxy")] + [System.SerializableAttribute] + public partial class ComposablePartException : System.Exception + { + public ComposablePartException() { } + [System.Security.SecuritySafeCriticalAttribute] + protected ComposablePartException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ComposablePartException(string message) { } + public ComposablePartException(string message, System.ComponentModel.Composition.Primitives.ICompositionElement element) { } + public ComposablePartException(string message, System.ComponentModel.Composition.Primitives.ICompositionElement element, System.Exception innerException) { } + public ComposablePartException(string message, System.Exception innerException) { } + public System.ComponentModel.Composition.Primitives.ICompositionElement Element { get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class ContractBasedImportDefinition : System.ComponentModel.Composition.Primitives.ImportDefinition + { + protected ContractBasedImportDefinition() { } + public ContractBasedImportDefinition(string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy) { } + public ContractBasedImportDefinition(string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary metadata) { } + public override System.Linq.Expressions.Expression> Constraint { get { throw null; } } + public virtual System.ComponentModel.Composition.CreationPolicy RequiredCreationPolicy { get { throw null; } } + public virtual System.Collections.Generic.IEnumerable> RequiredMetadata { get { throw null; } } + public virtual string RequiredTypeIdentity { get { throw null; } } + public override bool IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition) { throw null; } + public override string ToString() { throw null; } + } + public partial class Export + { + protected Export() { } + public Export(System.ComponentModel.Composition.Primitives.ExportDefinition definition, System.Func exportedValueGetter) { } + public Export(string contractName, System.Collections.Generic.IDictionary metadata, System.Func exportedValueGetter) { } + public Export(string contractName, System.Func exportedValueGetter) { } + public virtual System.ComponentModel.Composition.Primitives.ExportDefinition Definition { get { throw null; } } + public System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public object Value { get { throw null; } } + protected virtual object GetExportedValueCore() { throw null; } + } + public partial class ExportDefinition + { + protected ExportDefinition() { } + public ExportDefinition(string contractName, System.Collections.Generic.IDictionary metadata) { } + public virtual string ContractName { get { throw null; } } + public virtual System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public override string ToString() { throw null; } + } + public partial class ExportedDelegate + { + protected ExportedDelegate() { } + [System.Security.SecurityCriticalAttribute] + public ExportedDelegate(object instance, System.Reflection.MethodInfo method) { } + public virtual System.Delegate CreateDelegate(System.Type delegateType) { throw null; } + } + public partial interface ICompositionElement + { + string DisplayName { get; } + System.ComponentModel.Composition.Primitives.ICompositionElement Origin { get; } + } + public enum ImportCardinality + { + ExactlyOne = 1, + ZeroOrMore = 2, + ZeroOrOne = 0, + } + public partial class ImportDefinition + { + protected ImportDefinition() { } + public ImportDefinition(System.Linq.Expressions.Expression> constraint, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite) { } + public ImportDefinition(System.Linq.Expressions.Expression> constraint, string contractName, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, System.Collections.Generic.IDictionary metadata) { } + public virtual System.ComponentModel.Composition.Primitives.ImportCardinality Cardinality { get { throw null; } } + public virtual System.Linq.Expressions.Expression> Constraint { get { throw null; } } + public virtual string ContractName { get { throw null; } } + public virtual bool IsPrerequisite { get { throw null; } } + public virtual bool IsRecomposable { get { throw null; } } + public virtual System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public virtual bool IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition) { throw null; } + public override string ToString() { throw null; } + } +} +namespace System.ComponentModel.Composition.ReflectionModel +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct LazyMemberInfo + { + public LazyMemberInfo(System.Reflection.MemberInfo member) { throw null;} + public LazyMemberInfo(System.Reflection.MemberTypes memberType, System.Func accessorsCreator) { throw null;} + public LazyMemberInfo(System.Reflection.MemberTypes memberType, params System.Reflection.MemberInfo[] accessors) { throw null;} + public System.Reflection.MemberTypes MemberType { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public System.Reflection.MemberInfo[] GetAccessors() { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo left, System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo right) { throw null; } + public static bool operator !=(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo left, System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo right) { throw null; } + } + [System.Security.SecurityCriticalAttribute] + public static partial class ReflectionModelServices + { + public static System.ComponentModel.Composition.Primitives.ExportDefinition CreateExportDefinition(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo exportingMember, string contractName, System.Lazy> metadata, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, bool isPreRequisite, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary metadata, bool isExportFactory, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary metadata, bool isExportFactory, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo importingMember, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, bool isRecomposable, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(System.Lazy parameter, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.Collections.Generic.IDictionary metadata, bool isExportFactory, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition CreateImportDefinition(System.Lazy parameter, string contractName, string requiredTypeIdentity, System.Collections.Generic.IEnumerable> requiredMetadata, System.ComponentModel.Composition.Primitives.ImportCardinality cardinality, System.ComponentModel.Composition.CreationPolicy requiredCreationPolicy, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ComposablePartDefinition CreatePartDefinition(System.Lazy partType, bool isDisposalRequired, System.Lazy> imports, System.Lazy> exports, System.Lazy> metadata, System.ComponentModel.Composition.Primitives.ICompositionElement origin) { throw null; } + public static System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition GetExportFactoryProductImportDefinition(System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) { throw null; } + public static System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo GetExportingMember(System.ComponentModel.Composition.Primitives.ExportDefinition exportDefinition) { throw null; } + public static System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo GetImportingMember(System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) { throw null; } + public static System.Lazy GetImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) { throw null; } + public static System.Lazy GetPartType(System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition) { throw null; } + public static bool IsDisposalRequired(System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition) { throw null; } + public static bool IsExportFactoryImportDefinition(System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) { throw null; } + public static bool IsImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition importDefinition) { throw null; } + public static bool TryMakeGenericPartDefinition(System.ComponentModel.Composition.Primitives.ComposablePartDefinition partDefinition, System.Collections.Generic.IEnumerable genericParameters, out System.ComponentModel.Composition.Primitives.ComposablePartDefinition specialization) { specialization = default(System.ComponentModel.Composition.Primitives.ComposablePartDefinition); throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ComponentModel.DataAnnotations.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ComponentModel.DataAnnotations.cs new file mode 100644 index 0000000000..e36385f9f4 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ComponentModel.DataAnnotations.cs @@ -0,0 +1,426 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ComponentModel.DataAnnotations.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ComponentModel.DataAnnotations.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ComponentModel.DataAnnotations.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +namespace System.ComponentModel.DataAnnotations +{ + public partial class AssociatedMetadataTypeTypeDescriptionProvider : System.ComponentModel.TypeDescriptionProvider + { + public AssociatedMetadataTypeTypeDescriptionProvider(System.Type type) { } + public AssociatedMetadataTypeTypeDescriptionProvider(System.Type type, System.Type associatedMetadataType) { } + public override System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor(System.Type objectType, object instance) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false, Inherited=true)] + public sealed partial class AssociationAttribute : System.Attribute + { + public AssociationAttribute(string name, string thisKey, string otherKey) { } + public bool IsForeignKey { get { throw null; } set { } } + public string Name { get { throw null; } } + public string OtherKey { get { throw null; } } + public System.Collections.Generic.IEnumerable OtherKeyMembers { get { throw null; } } + public string ThisKey { get { throw null; } } + public System.Collections.Generic.IEnumerable ThisKeyMembers { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(28), AllowMultiple=false, Inherited=true)] + public sealed partial class BindableTypeAttribute : System.Attribute + { + public BindableTypeAttribute() { } + public bool IsBindable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128), AllowMultiple=false)] + public partial class CompareAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public CompareAttribute(string otherProperty) { } + public string OtherProperty { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string OtherPropertyDisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool RequiresValidationContext { get { throw null; } } + public override string FormatErrorMessage(string name) { throw null; } + protected override System.ComponentModel.DataAnnotations.ValidationResult IsValid(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false, Inherited=true)] + public sealed partial class ConcurrencyCheckAttribute : System.Attribute + { + public ConcurrencyCheckAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public sealed partial class CreditCardAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute + { + public CreditCardAttribute() : base (default(System.ComponentModel.DataAnnotations.DataType)) { } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2500), AllowMultiple=true)] + public sealed partial class CustomValidationAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public CustomValidationAttribute(System.Type validatorType, string method) { } + public string Method { get { throw null; } } + public override object TypeId { get { throw null; } } + public System.Type ValidatorType { get { throw null; } } + public override string FormatErrorMessage(string name) { throw null; } + protected override System.ComponentModel.DataAnnotations.ValidationResult IsValid(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } + } + public enum DataType + { + CreditCard = 14, + Currency = 6, + Custom = 0, + Date = 2, + DateTime = 1, + Duration = 4, + EmailAddress = 10, + Html = 8, + ImageUrl = 13, + MultilineText = 9, + Password = 11, + PhoneNumber = 5, + PostalCode = 15, + Text = 7, + Time = 3, + Upload = 16, + Url = 12, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2496), AllowMultiple=false)] + public partial class DataTypeAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public DataTypeAttribute(System.ComponentModel.DataAnnotations.DataType dataType) { } + public DataTypeAttribute(string customDataType) { } + public string CustomDataType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.DataAnnotations.DataType DataType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.DataAnnotations.DisplayFormatAttribute DisplayFormat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual string GetDataTypeName() { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2496), AllowMultiple=false)] + public sealed partial class DisplayAttribute : System.Attribute + { + public DisplayAttribute() { } + public bool AutoGenerateField { get { throw null; } set { } } + public bool AutoGenerateFilter { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public string GroupName { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public int Order { get { throw null; } set { } } + public string Prompt { get { throw null; } set { } } + public System.Type ResourceType { get { throw null; } set { } } + public string ShortName { get { throw null; } set { } } + public System.Nullable GetAutoGenerateField() { throw null; } + public System.Nullable GetAutoGenerateFilter() { throw null; } + public string GetDescription() { throw null; } + public string GetGroupName() { throw null; } + public string GetName() { throw null; } + public System.Nullable GetOrder() { throw null; } + public string GetPrompt() { throw null; } + public string GetShortName() { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true, AllowMultiple=false)] + public partial class DisplayColumnAttribute : System.Attribute + { + public DisplayColumnAttribute(string displayColumn) { } + public DisplayColumnAttribute(string displayColumn, string sortColumn) { } + public DisplayColumnAttribute(string displayColumn, string sortColumn, bool sortDescending) { } + public string DisplayColumn { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string SortColumn { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool SortDescending { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public partial class DisplayFormatAttribute : System.Attribute + { + public DisplayFormatAttribute() { } + public bool ApplyFormatInEditMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool ConvertEmptyStringToNull { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string DataFormatString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool HtmlEncode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string NullDisplayText { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false, Inherited=true)] + public sealed partial class EditableAttribute : System.Attribute + { + public EditableAttribute(bool allowEdit) { } + public bool AllowEdit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool AllowInitialValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public sealed partial class EmailAddressAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute + { + public EmailAddressAttribute() : base (default(System.ComponentModel.DataAnnotations.DataType)) { } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2496), AllowMultiple=false)] + public sealed partial class EnumDataTypeAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute + { + public EnumDataTypeAttribute(System.Type enumType) : base (default(System.ComponentModel.DataAnnotations.DataType)) { } + public System.Type EnumType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public sealed partial class FileExtensionsAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute + { + public FileExtensionsAttribute() : base (default(System.ComponentModel.DataAnnotations.DataType)) { } + public string Extensions { get { throw null; } set { } } + public override string FormatErrorMessage(string name) { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public sealed partial class FilterUIHintAttribute : System.Attribute + { + public FilterUIHintAttribute(string filterUIHint) { } + public FilterUIHintAttribute(string filterUIHint, string presentationLayer) { } + public FilterUIHintAttribute(string filterUIHint, string presentationLayer, params object[] controlParameters) { } + public System.Collections.Generic.IDictionary ControlParameters { get { throw null; } } + public string FilterUIHint { get { throw null; } } + public string PresentationLayer { get { throw null; } } + public override object TypeId { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public partial interface IValidatableObject + { + System.Collections.Generic.IEnumerable Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false, Inherited=true)] + public sealed partial class KeyAttribute : System.Attribute + { + public KeyAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public partial class MaxLengthAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public MaxLengthAttribute() { } + public MaxLengthAttribute(int length) { } + public int Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override string FormatErrorMessage(string name) { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class MetadataTypeAttribute : System.Attribute + { + public MetadataTypeAttribute(System.Type metadataClassType) { } + public System.Type MetadataClassType { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public partial class MinLengthAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public MinLengthAttribute(int length) { } + public int Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override string FormatErrorMessage(string name) { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public sealed partial class PhoneAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute + { + public PhoneAttribute() : base (default(System.ComponentModel.DataAnnotations.DataType)) { } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public partial class RangeAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public RangeAttribute(double minimum, double maximum) { } + public RangeAttribute(int minimum, int maximum) { } + public RangeAttribute(System.Type type, string minimum, string maximum) { } + public object Maximum { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Minimum { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Type OperandType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override string FormatErrorMessage(string name) { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public partial class RegularExpressionAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public RegularExpressionAttribute(string pattern) { } + public int MatchTimeoutInMilliseconds { get { throw null; } set { } } + public string Pattern { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override string FormatErrorMessage(string name) { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public partial class RequiredAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public RequiredAttribute() { } + public bool AllowEmptyStrings { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public partial class ScaffoldColumnAttribute : System.Attribute + { + public ScaffoldColumnAttribute(bool scaffold) { } + public bool Scaffold { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public partial class ScaffoldTableAttribute : System.Attribute + { + public ScaffoldTableAttribute(bool scaffold) { } + public bool Scaffold { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public partial class StringLengthAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute + { + public StringLengthAttribute(int maximumLength) { } + public int MaximumLength { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int MinimumLength { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override string FormatErrorMessage(string name) { throw null; } + public override bool IsValid(object value) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false, Inherited=true)] + public sealed partial class TimestampAttribute : System.Attribute + { + public TimestampAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=true)] + public partial class UIHintAttribute : System.Attribute + { + public UIHintAttribute(string uiHint) { } + public UIHintAttribute(string uiHint, string presentationLayer) { } + public UIHintAttribute(string uiHint, string presentationLayer, params object[] controlParameters) { } + public System.Collections.Generic.IDictionary ControlParameters { get { throw null; } } + public string PresentationLayer { get { throw null; } } + public override object TypeId { get { throw null; } } + public string UIHint { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(2432), AllowMultiple=false)] + public sealed partial class UrlAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute + { + public UrlAttribute() : base (default(System.ComponentModel.DataAnnotations.DataType)) { } + public override bool IsValid(object value) { throw null; } + } + public abstract partial class ValidationAttribute : System.Attribute + { + protected ValidationAttribute() { } + protected ValidationAttribute(System.Func errorMessageAccessor) { } + protected ValidationAttribute(string errorMessage) { } + public string ErrorMessage { get { throw null; } set { } } + public string ErrorMessageResourceName { get { throw null; } set { } } + public System.Type ErrorMessageResourceType { get { throw null; } set { } } + protected string ErrorMessageString { get { throw null; } } + public virtual bool RequiresValidationContext { get { throw null; } } + public virtual string FormatErrorMessage(string name) { throw null; } + public System.ComponentModel.DataAnnotations.ValidationResult GetValidationResult(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } + public virtual bool IsValid(object value) { throw null; } + protected virtual System.ComponentModel.DataAnnotations.ValidationResult IsValid(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } + public void Validate(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { } + public void Validate(object value, string name) { } + } + public sealed partial class ValidationContext : System.IServiceProvider + { + public ValidationContext(object instance) { } + public ValidationContext(object instance, System.Collections.Generic.IDictionary items) { } + public ValidationContext(object instance, System.IServiceProvider serviceProvider, System.Collections.Generic.IDictionary items) { } + public string DisplayName { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Items { get { throw null; } } + public string MemberName { get { throw null; } set { } } + public object ObjectInstance { get { throw null; } } + public System.Type ObjectType { get { throw null; } } + public System.ComponentModel.Design.IServiceContainer ServiceContainer { get { throw null; } } + public object GetService(System.Type serviceType) { throw null; } + public void InitializeServiceProvider(System.Func serviceProvider) { } + } + [System.SerializableAttribute] + public partial class ValidationException : System.Exception + { + public ValidationException() { } + public ValidationException(System.ComponentModel.DataAnnotations.ValidationResult validationResult, System.ComponentModel.DataAnnotations.ValidationAttribute validatingAttribute, object value) { } + protected ValidationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ValidationException(string message) { } + public ValidationException(string errorMessage, System.ComponentModel.DataAnnotations.ValidationAttribute validatingAttribute, object value) { } + public ValidationException(string message, System.Exception innerException) { } + public System.ComponentModel.DataAnnotations.ValidationAttribute ValidationAttribute { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.DataAnnotations.ValidationResult ValidationResult { get { throw null; } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class ValidationResult + { + public static readonly System.ComponentModel.DataAnnotations.ValidationResult Success; + protected ValidationResult(System.ComponentModel.DataAnnotations.ValidationResult validationResult) { } + public ValidationResult(string errorMessage) { } + public ValidationResult(string errorMessage, System.Collections.Generic.IEnumerable memberNames) { } + public string ErrorMessage { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable MemberNames { get { throw null; } } + public override string ToString() { throw null; } + } + public static partial class Validator + { + public static bool TryValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection validationResults) { throw null; } + public static bool TryValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection validationResults, bool validateAllProperties) { throw null; } + public static bool TryValidateProperty(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection validationResults) { throw null; } + public static bool TryValidateValue(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.ICollection validationResults, System.Collections.Generic.IEnumerable validationAttributes) { throw null; } + public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { } + public static void ValidateObject(object instance, System.ComponentModel.DataAnnotations.ValidationContext validationContext, bool validateAllProperties) { } + public static void ValidateProperty(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { } + public static void ValidateValue(object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext, System.Collections.Generic.IEnumerable validationAttributes) { } + } +} +namespace System.ComponentModel.DataAnnotations.Schema +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public partial class ColumnAttribute : System.Attribute + { + public ColumnAttribute() { } + public ColumnAttribute(string name) { } + public string Name { get { throw null; } } + public int Order { get { throw null; } set { } } + public string TypeName { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public partial class ComplexTypeAttribute : System.Attribute + { + public ComplexTypeAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public partial class DatabaseGeneratedAttribute : System.Attribute + { + public DatabaseGeneratedAttribute(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption databaseGeneratedOption) { } + public System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption DatabaseGeneratedOption { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public enum DatabaseGeneratedOption + { + Computed = 2, + Identity = 1, + None = 0, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public partial class ForeignKeyAttribute : System.Attribute + { + public ForeignKeyAttribute(string name) { } + public string Name { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public partial class InversePropertyAttribute : System.Attribute + { + public InversePropertyAttribute(string property) { } + public string Property { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(388), AllowMultiple=false)] + public partial class NotMappedAttribute : System.Attribute + { + public NotMappedAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public partial class TableAttribute : System.Attribute + { + public TableAttribute(string name) { } + public string Name { get { throw null; } } + public string Schema { get { throw null; } set { } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Configuration.Install.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Configuration.Install.cs new file mode 100644 index 0000000000..b8cd28e671 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Configuration.Install.cs @@ -0,0 +1,201 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Configuration.Install.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Configuration.Install.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Configuration.Install.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +namespace System.Configuration.Install +{ + public partial class AssemblyInstaller : System.Configuration.Install.Installer + { + public AssemblyInstaller() { } + public AssemblyInstaller(System.Reflection.Assembly assembly, string[] commandLine) { } + public AssemblyInstaller(string fileName, string[] commandLine) { } + public System.Reflection.Assembly Assembly { get { throw null; } set { } } + public string[] CommandLine { get { throw null; } set { } } + public override string HelpText { get { throw null; } } + public string Path { get { throw null; } set { } } + public bool UseNewContext { get { throw null; } set { } } + public static void CheckIfInstallable(string assemblyName) { } + public override void Commit(System.Collections.IDictionary savedState) { } + public override void Install(System.Collections.IDictionary savedState) { } + public override void Rollback(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } + public abstract partial class ComponentInstaller : System.Configuration.Install.Installer + { + protected ComponentInstaller() { } + public abstract void CopyFromComponent(System.ComponentModel.IComponent component); + public virtual bool IsEquivalentInstaller(System.Configuration.Install.ComponentInstaller otherInstaller) { throw null; } + } + [System.Runtime.InteropServices.GuidAttribute("1E233FE7-C16D-4512-8C3B-2E9988F08D38")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IManagedInstaller + { + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.I4)] + int ManagedInstall([System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string commandLine, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.I4)]int hInstall); + } + public partial class InstallContext + { + public InstallContext() { } + public InstallContext(string logFilePath, string[] commandLine) { } + public System.Collections.Specialized.StringDictionary Parameters { get { throw null; } } + public bool IsParameterTrue(string paramName) { throw null; } + public void LogMessage(string message) { } + protected static System.Collections.Specialized.StringDictionary ParseCommandLine(string[] args) { throw null; } + } + [System.ComponentModel.DefaultEventAttribute("AfterInstall")] + public partial class Installer : System.ComponentModel.Component + { + public Installer() { } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public System.Configuration.Install.InstallContext Context { get { throw null; } set { } } + public virtual string HelpText { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(2))] + public System.Configuration.Install.InstallerCollection Installers { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(true)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.TypeConverterAttribute("System.Configuration.Install.InstallerParentConverter")] + public System.Configuration.Install.Installer Parent { get { throw null; } set { } } + public event System.Configuration.Install.InstallEventHandler AfterInstall { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler AfterRollback { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler AfterUninstall { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler BeforeInstall { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler BeforeRollback { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler BeforeUninstall { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler Committed { add { } remove { } } + public event System.Configuration.Install.InstallEventHandler Committing { add { } remove { } } + public virtual void Commit(System.Collections.IDictionary savedState) { } + public virtual void Install(System.Collections.IDictionary stateSaver) { } + protected virtual void OnAfterInstall(System.Collections.IDictionary savedState) { } + protected virtual void OnAfterRollback(System.Collections.IDictionary savedState) { } + protected virtual void OnAfterUninstall(System.Collections.IDictionary savedState) { } + protected virtual void OnBeforeInstall(System.Collections.IDictionary savedState) { } + protected virtual void OnBeforeRollback(System.Collections.IDictionary savedState) { } + protected virtual void OnBeforeUninstall(System.Collections.IDictionary savedState) { } + protected virtual void OnCommitted(System.Collections.IDictionary savedState) { } + protected virtual void OnCommitting(System.Collections.IDictionary savedState) { } + public virtual void Rollback(System.Collections.IDictionary savedState) { } + public virtual void Uninstall(System.Collections.IDictionary savedState) { } + } + public partial class InstallerCollection : System.Collections.CollectionBase + { + internal InstallerCollection() { } + public System.Configuration.Install.Installer this[int index] { get { throw null; } set { } } + public int Add(System.Configuration.Install.Installer value) { throw null; } + public void AddRange(System.Configuration.Install.InstallerCollection value) { } + public void AddRange(System.Configuration.Install.Installer[] value) { } + public bool Contains(System.Configuration.Install.Installer value) { throw null; } + public void CopyTo(System.Configuration.Install.Installer[] array, int index) { } + public int IndexOf(System.Configuration.Install.Installer value) { throw null; } + public void Insert(int index, System.Configuration.Install.Installer value) { } + protected override void OnInsert(int index, object value) { } + protected override void OnRemove(int index, object value) { } + protected override void OnSet(int index, object oldValue, object newValue) { } + public void Remove(System.Configuration.Install.Installer value) { } + } + public partial class InstallEventArgs : System.EventArgs + { + public InstallEventArgs() { } + public InstallEventArgs(System.Collections.IDictionary savedState) { } + public System.Collections.IDictionary SavedState { get { throw null; } } + } + public delegate void InstallEventHandler(object sender, System.Configuration.Install.InstallEventArgs e); + [System.SerializableAttribute] + public partial class InstallException : System.SystemException + { + public InstallException() { } + protected InstallException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstallException(string message) { } + public InstallException(string message, System.Exception innerException) { } + } + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + [System.Runtime.InteropServices.GuidAttribute("42EB0342-0393-448f-84AA-D4BEB0283595")] + public partial class ManagedInstallerClass : System.Configuration.Install.IManagedInstaller + { + public ManagedInstallerClass() { } + public static void InstallHelper(string[] args) { } + int System.Configuration.Install.IManagedInstaller.ManagedInstall(string argString, int hInstall) { throw null; } + } + public partial class TransactedInstaller : System.Configuration.Install.Installer + { + public TransactedInstaller() { } + public override void Install(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } + public enum UninstallAction + { + NoAction = 1, + Remove = 0, + } +} +namespace System.Diagnostics +{ + public partial class EventLogInstaller : System.Configuration.Install.ComponentInstaller + { + public EventLogInstaller() { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public int CategoryCount { get { throw null; } set { } } + [System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.FileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public string CategoryResourceFile { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public string Log { get { throw null; } set { } } + [System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.FileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public string MessageResourceFile { get { throw null; } set { } } + [System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.FileNameEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public string ParameterResourceFile { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public string Source { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Configuration.Install.UninstallAction)(0))] + public System.Configuration.Install.UninstallAction UninstallAction { get { throw null; } set { } } + public override void CopyFromComponent(System.ComponentModel.IComponent component) { } + public override void Install(System.Collections.IDictionary stateSaver) { } + public override bool IsEquivalentInstaller(System.Configuration.Install.ComponentInstaller otherInstaller) { throw null; } + public override void Rollback(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } + public partial class PerformanceCounterInstaller : System.Configuration.Install.ComponentInstaller + { + public PerformanceCounterInstaller() { } + [System.ComponentModel.DefaultValueAttribute("")] + public string CategoryHelp { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public string CategoryName { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Diagnostics.PerformanceCounterCategoryType)(-1))] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Diagnostics.PerformanceCounterCategoryType CategoryType { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(2))] + public System.Diagnostics.CounterCreationDataCollection Counters { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute((System.Configuration.Install.UninstallAction)(0))] + public System.Configuration.Install.UninstallAction UninstallAction { get { throw null; } set { } } + public override void CopyFromComponent(System.ComponentModel.IComponent component) { } + public override void Install(System.Collections.IDictionary stateSaver) { } + public override void Rollback(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Configuration.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Configuration.cs new file mode 100644 index 0000000000..1d3cf2c38e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Configuration.cs @@ -0,0 +1,1209 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Configuration.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Configuration.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Configuration.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Configuration +{ + public sealed partial class AppSettingsSection : System.Configuration.ConfigurationSection + { + public AppSettingsSection() { } + [System.Configuration.ConfigurationPropertyAttribute("file", DefaultValue="")] + public string File { get { throw null; } set { } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("", IsDefaultCollection=true)] + public System.Configuration.KeyValueConfigurationCollection Settings { get { throw null; } } + protected internal override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { } + protected internal override object GetRuntimeObject() { throw null; } + protected internal override bool IsModified() { throw null; } + protected internal override void Reset(System.Configuration.ConfigurationElement parentSection) { } + protected internal override string SerializeSection(System.Configuration.ConfigurationElement parentElement, string name, System.Configuration.ConfigurationSaveMode saveMode) { throw null; } + } + public sealed partial class CallbackValidator : System.Configuration.ConfigurationValidatorBase + { + public CallbackValidator(System.Type type, System.Configuration.ValidatorCallback callback) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class CallbackValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public CallbackValidatorAttribute() { } + public string CallbackMethodName { get { throw null; } set { } } + public System.Type Type { get { throw null; } set { } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + public sealed partial class CommaDelimitedStringCollection : System.Collections.Specialized.StringCollection + { + public CommaDelimitedStringCollection() { } + public bool IsModified { get { throw null; } } + public new bool IsReadOnly { get { throw null; } } + public new string this[int index] { get { throw null; } set { } } + public new void Add(string value) { } + public new void AddRange(string[] range) { } + public new void Clear() { } + public System.Configuration.CommaDelimitedStringCollection Clone() { throw null; } + public new void Insert(int index, string value) { } + public new void Remove(string value) { } + public void SetReadOnly() { } + public override string ToString() { throw null; } + } + public sealed partial class CommaDelimitedStringCollectionConverter : System.Configuration.ConfigurationConverterBase + { + public CommaDelimitedStringCollectionConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public sealed partial class Configuration + { + internal Configuration() { } + public System.Configuration.AppSettingsSection AppSettings { get { throw null; } } + public System.Func AssemblyStringTransformer { get { throw null; } [System.Configuration.ConfigurationPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)]set { } } + public System.Configuration.ConnectionStringsSection ConnectionStrings { get { throw null; } } + public System.Configuration.ContextInformation EvaluationContext { get { throw null; } } + public string FilePath { get { throw null; } } + public bool HasFile { get { throw null; } } + public System.Configuration.ConfigurationLocationCollection Locations { get { throw null; } } + public bool NamespaceDeclared { get { throw null; } set { } } + public System.Configuration.ConfigurationSectionGroup RootSectionGroup { get { throw null; } } + public System.Configuration.ConfigurationSectionGroupCollection SectionGroups { get { throw null; } } + public System.Configuration.ConfigurationSectionCollection Sections { get { throw null; } } + public System.Runtime.Versioning.FrameworkName TargetFramework { get { throw null; } [System.Configuration.ConfigurationPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)]set { } } + public System.Func TypeStringTransformer { get { throw null; } [System.Configuration.ConfigurationPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)]set { } } + public System.Configuration.ConfigurationSection GetSection(string sectionName) { throw null; } + public System.Configuration.ConfigurationSectionGroup GetSectionGroup(string sectionGroupName) { throw null; } + public void Save() { } + public void Save(System.Configuration.ConfigurationSaveMode saveMode) { } + public void Save(System.Configuration.ConfigurationSaveMode saveMode, bool forceSaveAll) { } + public void SaveAs(string filename) { } + public void SaveAs(string filename, System.Configuration.ConfigurationSaveMode saveMode) { } + public void SaveAs(string filename, System.Configuration.ConfigurationSaveMode saveMode, bool forceSaveAll) { } + } + public enum ConfigurationAllowDefinition + { + Everywhere = 300, + MachineOnly = 0, + MachineToApplication = 200, + MachineToWebRoot = 100, + } + public enum ConfigurationAllowExeDefinition + { + MachineOnly = 0, + MachineToApplication = 100, + MachineToLocalUser = 300, + MachineToRoamingUser = 200, + } + public abstract partial class ConfigurationBuilder : System.Configuration.Provider.ProviderBase + { + protected ConfigurationBuilder() { } + public virtual System.Configuration.ConfigurationSection ProcessConfigurationSection(System.Configuration.ConfigurationSection configSection) { throw null; } + public virtual System.Xml.XmlNode ProcessRawXml(System.Xml.XmlNode rawXml) { throw null; } + } + public partial class ConfigurationBuilderCollection : System.Configuration.Provider.ProviderCollection + { + public ConfigurationBuilderCollection() { } + public new System.Configuration.ConfigurationBuilder this[string name] { get { throw null; } } + public override void Add(System.Configuration.Provider.ProviderBase builder) { } + } + public partial class ConfigurationBuilderSettings : System.Configuration.ConfigurationElement + { + public ConfigurationBuilderSettings() { } + [System.Configuration.ConfigurationPropertyAttribute("", IsDefaultCollection=true, Options=(System.Configuration.ConfigurationPropertyOptions)(1))] + public System.Configuration.ProviderSettingsCollection Builders { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + public sealed partial class ConfigurationBuildersSection : System.Configuration.ConfigurationSection + { + public ConfigurationBuildersSection() { } + [System.Configuration.ConfigurationPropertyAttribute("builders")] + public System.Configuration.ProviderSettingsCollection Builders { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + public System.Configuration.ConfigurationBuilder GetBuilderFromName(string builderName) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(132))] + public sealed partial class ConfigurationCollectionAttribute : System.Attribute + { + public ConfigurationCollectionAttribute(System.Type itemType) { } + public string AddItemName { get { throw null; } set { } } + public string ClearItemsName { get { throw null; } set { } } + public System.Configuration.ConfigurationElementCollectionType CollectionType { get { throw null; } set { } } + public System.Type ItemType { get { throw null; } } + public string RemoveItemName { get { throw null; } set { } } + } + public abstract partial class ConfigurationConverterBase : System.ComponentModel.TypeConverter + { + protected ConfigurationConverterBase() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Type type) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Type type) { throw null; } + } + public abstract partial class ConfigurationElement + { + protected ConfigurationElement() { } + public System.Configuration.Configuration CurrentConfiguration { get { throw null; } } + public System.Configuration.ElementInformation ElementInformation { get { throw null; } } + protected internal virtual System.Configuration.ConfigurationElementProperty ElementProperty { get { throw null; } } + protected System.Configuration.ContextInformation EvaluationContext { get { throw null; } } + protected bool HasContext { get { throw null; } } + protected internal object this[System.Configuration.ConfigurationProperty prop] { get { throw null; } set { } } + protected internal object this[string propertyName] { get { throw null; } set { } } + public System.Configuration.ConfigurationLockCollection LockAllAttributesExcept { get { throw null; } } + public System.Configuration.ConfigurationLockCollection LockAllElementsExcept { get { throw null; } } + public System.Configuration.ConfigurationLockCollection LockAttributes { get { throw null; } } + public System.Configuration.ConfigurationLockCollection LockElements { get { throw null; } } + public bool LockItem { get { throw null; } set { } } + protected internal virtual System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal virtual void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { } + public override bool Equals(object compareTo) { throw null; } + public override int GetHashCode() { throw null; } + protected virtual string GetTransformedAssemblyString(string assemblyName) { throw null; } + protected virtual string GetTransformedTypeString(string typeName) { throw null; } + protected internal virtual void Init() { } + protected internal virtual void InitializeDefault() { } + protected internal virtual bool IsModified() { throw null; } + public virtual bool IsReadOnly() { throw null; } + protected virtual void ListErrors(System.Collections.IList errorList) { } + protected virtual bool OnDeserializeUnrecognizedAttribute(string name, string value) { throw null; } + protected virtual bool OnDeserializeUnrecognizedElement(string elementName, System.Xml.XmlReader reader) { throw null; } + protected virtual object OnRequiredPropertyNotFound(string name) { throw null; } + protected virtual void PostDeserialize() { } + protected virtual void PreSerialize(System.Xml.XmlWriter writer) { } + protected internal virtual void Reset(System.Configuration.ConfigurationElement parentElement) { } + protected internal virtual void ResetModified() { } + protected internal virtual bool SerializeElement(System.Xml.XmlWriter writer, bool serializeCollectionKey) { throw null; } + protected internal virtual bool SerializeToXmlElement(System.Xml.XmlWriter writer, string elementName) { throw null; } + protected void SetPropertyValue(System.Configuration.ConfigurationProperty prop, object value, bool ignoreLocks) { } + protected internal virtual void SetReadOnly() { } + protected internal virtual void Unmerge(System.Configuration.ConfigurationElement sourceElement, System.Configuration.ConfigurationElement parentElement, System.Configuration.ConfigurationSaveMode saveMode) { } + } + [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")] + public abstract partial class ConfigurationElementCollection : System.Configuration.ConfigurationElement, System.Collections.ICollection, System.Collections.IEnumerable + { + protected ConfigurationElementCollection() { } + protected ConfigurationElementCollection(System.Collections.IComparer comparer) { } + protected internal string AddElementName { get { throw null; } set { } } + protected internal string ClearElementName { get { throw null; } set { } } + public virtual System.Configuration.ConfigurationElementCollectionType CollectionType { get { throw null; } } + public int Count { get { throw null; } } + protected virtual string ElementName { get { throw null; } } + public bool EmitClear { get { throw null; } set { } } + public bool IsSynchronized { get { throw null; } } + protected internal string RemoveElementName { get { throw null; } set { } } + public object SyncRoot { get { throw null; } } + protected virtual bool ThrowOnDuplicate { get { throw null; } } + protected virtual void BaseAdd(System.Configuration.ConfigurationElement element) { } + protected internal void BaseAdd(System.Configuration.ConfigurationElement element, bool throwIfExists) { } + protected virtual void BaseAdd(int index, System.Configuration.ConfigurationElement element) { } + protected internal void BaseClear() { } + protected internal System.Configuration.ConfigurationElement BaseGet(int index) { throw null; } + protected internal System.Configuration.ConfigurationElement BaseGet(object key) { throw null; } + protected internal object[] BaseGetAllKeys() { throw null; } + protected internal object BaseGetKey(int index) { throw null; } + protected int BaseIndexOf(System.Configuration.ConfigurationElement element) { throw null; } + protected internal bool BaseIsRemoved(object key) { throw null; } + protected internal void BaseRemove(object key) { } + protected internal void BaseRemoveAt(int index) { } + public void CopyTo(System.Configuration.ConfigurationElement[] array, int index) { } + protected abstract System.Configuration.ConfigurationElement CreateNewElement(); + protected virtual System.Configuration.ConfigurationElement CreateNewElement(string elementName) { throw null; } + public override bool Equals(object compareTo) { throw null; } + protected abstract object GetElementKey(System.Configuration.ConfigurationElement element); + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public override int GetHashCode() { throw null; } + protected virtual bool IsElementName(string elementName) { throw null; } + protected virtual bool IsElementRemovable(System.Configuration.ConfigurationElement element) { throw null; } + protected internal override bool IsModified() { throw null; } + public override bool IsReadOnly() { throw null; } + protected override bool OnDeserializeUnrecognizedElement(string elementName, System.Xml.XmlReader reader) { throw null; } + protected internal override void Reset(System.Configuration.ConfigurationElement parentElement) { } + protected internal override void ResetModified() { } + protected internal override bool SerializeElement(System.Xml.XmlWriter writer, bool serializeCollectionKey) { throw null; } + protected internal override void SetReadOnly() { } + void System.Collections.ICollection.CopyTo(System.Array arr, int index) { } + protected internal override void Unmerge(System.Configuration.ConfigurationElement sourceElement, System.Configuration.ConfigurationElement parentElement, System.Configuration.ConfigurationSaveMode saveMode) { } + } + public enum ConfigurationElementCollectionType + { + AddRemoveClearMap = 1, + AddRemoveClearMapAlternate = 3, + BasicMap = 0, + BasicMapAlternate = 2, + } + public sealed partial class ConfigurationElementProperty + { + public ConfigurationElementProperty(System.Configuration.ConfigurationValidatorBase validator) { } + public System.Configuration.ConfigurationValidatorBase Validator { get { throw null; } } + } +#if CONFIG_DEP + [System.SerializableAttribute] + public partial class ConfigurationErrorsException : System.Configuration.ConfigurationException + { + public ConfigurationErrorsException() { } + protected ConfigurationErrorsException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ConfigurationErrorsException(string message) { } + public ConfigurationErrorsException(string message, System.Exception inner) { } + public ConfigurationErrorsException(string message, System.Exception inner, string filename, int line) { } + public ConfigurationErrorsException(string message, System.Exception inner, System.Xml.XmlNode node) { } + public ConfigurationErrorsException(string message, System.Exception inner, System.Xml.XmlReader reader) { } + public ConfigurationErrorsException(string message, string filename, int line) { } + public ConfigurationErrorsException(string message, System.Xml.XmlNode node) { } + public ConfigurationErrorsException(string message, System.Xml.XmlReader reader) { } + public override string BareMessage { get { throw null; } } + public System.Collections.ICollection Errors { get { throw null; } } + public override string Filename { get { throw null; } } + public override int Line { get { throw null; } } + public override string Message { get { throw null; } } + public static string GetFilename(System.Xml.XmlNode node) { throw null; } + public static string GetFilename(System.Xml.XmlReader reader) { throw null; } + public static int GetLineNumber(System.Xml.XmlNode node) { throw null; } + public static int GetLineNumber(System.Xml.XmlReader reader) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } +#endif + public partial class ConfigurationFileMap : System.ICloneable + { + public ConfigurationFileMap() { } + public ConfigurationFileMap(string machineConfigFilename) { } + public string MachineConfigFilename { get { throw null; } set { } } + public virtual object Clone() { throw null; } + } + public partial class ConfigurationLocation + { + internal ConfigurationLocation() { } + public string Path { get { throw null; } } + public System.Configuration.Configuration OpenConfiguration() { throw null; } + } + public partial class ConfigurationLocationCollection : System.Collections.ReadOnlyCollectionBase + { + internal ConfigurationLocationCollection() { } + public System.Configuration.ConfigurationLocation this[int index] { get { throw null; } } + } + public sealed partial class ConfigurationLockCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal ConfigurationLockCollection() { } + public string AttributeList { get { throw null; } } + public int Count { get { throw null; } } + public bool HasParentElements { get { throw null; } } + public bool IsModified { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void Add(string name) { } + public void Clear() { } + public bool Contains(string name) { throw null; } + public void CopyTo(string[] array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public bool IsReadOnly(string name) { throw null; } + public void Remove(string name) { } + public void SetFromList(string attributeList) { } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + } + public static partial class ConfigurationManager + { + public static System.Collections.Specialized.NameValueCollection AppSettings { get { throw null; } } + public static System.Configuration.ConnectionStringSettingsCollection ConnectionStrings { get { throw null; } } + public static object GetSection(string sectionName) { throw null; } + public static System.Configuration.Configuration OpenExeConfiguration(System.Configuration.ConfigurationUserLevel userLevel) { throw null; } + public static System.Configuration.Configuration OpenExeConfiguration(string exePath) { throw null; } + public static System.Configuration.Configuration OpenMachineConfiguration() { throw null; } + public static System.Configuration.Configuration OpenMappedExeConfiguration(System.Configuration.ExeConfigurationFileMap fileMap, System.Configuration.ConfigurationUserLevel userLevel) { throw null; } + public static System.Configuration.Configuration OpenMappedExeConfiguration(System.Configuration.ExeConfigurationFileMap fileMap, System.Configuration.ConfigurationUserLevel userLevel, bool preLoad) { throw null; } + public static System.Configuration.Configuration OpenMappedMachineConfiguration(System.Configuration.ConfigurationFileMap fileMap) { throw null; } + public static void RefreshSection(string sectionName) { } + } + [System.SerializableAttribute] + public sealed partial class ConfigurationPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public ConfigurationPermission(System.Security.Permissions.PermissionState state) { } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement securityElement) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true, Inherited=false)] + [System.SerializableAttribute] + public sealed partial class ConfigurationPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public ConfigurationPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public override System.Security.IPermission CreatePermission() { throw null; } + } + public sealed partial class ConfigurationProperty + { + public ConfigurationProperty(string name, System.Type type) { } + public ConfigurationProperty(string name, System.Type type, object defaultValue) { } + public ConfigurationProperty(string name, System.Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options) { } + public ConfigurationProperty(string name, System.Type type, object defaultValue, System.ComponentModel.TypeConverter typeConverter, System.Configuration.ConfigurationValidatorBase validator, System.Configuration.ConfigurationPropertyOptions options, string description) { } + public ConfigurationProperty(string name, System.Type type, object defaultValue, System.Configuration.ConfigurationPropertyOptions options) { } + public System.ComponentModel.TypeConverter Converter { get { throw null; } } + public object DefaultValue { get { throw null; } } + public string Description { get { throw null; } } + public bool IsAssemblyStringTransformationRequired { get { throw null; } } + public bool IsDefaultCollection { get { throw null; } } + public bool IsKey { get { throw null; } } + public bool IsRequired { get { throw null; } } + public bool IsTypeStringTransformationRequired { get { throw null; } } + public bool IsVersionCheckRequired { get { throw null; } } + public string Name { get { throw null; } } + public System.Type Type { get { throw null; } } + public System.Configuration.ConfigurationValidatorBase Validator { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class ConfigurationPropertyAttribute : System.Attribute + { + public ConfigurationPropertyAttribute(string name) { } + public object DefaultValue { get { throw null; } set { } } + public bool IsDefaultCollection { get { throw null; } set { } } + public bool IsKey { get { throw null; } set { } } + public bool IsRequired { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Configuration.ConfigurationPropertyOptions Options { get { throw null; } set { } } + } + public partial class ConfigurationPropertyCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + public ConfigurationPropertyCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Configuration.ConfigurationProperty this[string name] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void Add(System.Configuration.ConfigurationProperty property) { } + public void Clear() { } + public bool Contains(string name) { throw null; } + public void CopyTo(System.Configuration.ConfigurationProperty[] array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public bool Remove(string name) { throw null; } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + } + [System.FlagsAttribute] + public enum ConfigurationPropertyOptions + { + IsAssemblyStringTransformationRequired = 16, + IsDefaultCollection = 1, + IsKey = 4, + IsRequired = 2, + IsTypeStringTransformationRequired = 8, + IsVersionCheckRequired = 32, + None = 0, + } + public enum ConfigurationSaveMode + { + Full = 2, + Minimal = 1, + Modified = 0, + } + public abstract partial class ConfigurationSection : System.Configuration.ConfigurationElement + { + protected ConfigurationSection() { } + public System.Configuration.SectionInformation SectionInformation { get { throw null; } } + protected internal virtual void DeserializeSection(System.Xml.XmlReader reader) { } + protected internal virtual object GetRuntimeObject() { throw null; } + protected internal override bool IsModified() { throw null; } + protected internal override void ResetModified() { } + protected internal virtual string SerializeSection(System.Configuration.ConfigurationElement parentElement, string name, System.Configuration.ConfigurationSaveMode saveMode) { throw null; } + protected internal virtual bool ShouldSerializeElementInTargetVersion(System.Configuration.ConfigurationElement element, string elementName, System.Runtime.Versioning.FrameworkName targetFramework) { throw null; } + protected internal virtual bool ShouldSerializePropertyInTargetVersion(System.Configuration.ConfigurationProperty property, string propertyName, System.Runtime.Versioning.FrameworkName targetFramework, System.Configuration.ConfigurationElement parentConfigurationElement) { throw null; } + protected internal virtual bool ShouldSerializeSectionInTargetVersion(System.Runtime.Versioning.FrameworkName targetFramework) { throw null; } + } + [System.SerializableAttribute] + public sealed partial class ConfigurationSectionCollection : System.Collections.Specialized.NameObjectCollectionBase + { + internal ConfigurationSectionCollection() { } + public override int Count { get { throw null; } } + public System.Configuration.ConfigurationSection this[int index] { get { throw null; } } + public System.Configuration.ConfigurationSection this[string name] { get { throw null; } } + public override System.Collections.Specialized.NameObjectCollectionBase.KeysCollection Keys { get { throw null; } } + public void Add(string name, System.Configuration.ConfigurationSection section) { } + public void Clear() { } + public void CopyTo(System.Configuration.ConfigurationSection[] array, int index) { } + public System.Configuration.ConfigurationSection Get(int index) { throw null; } + public System.Configuration.ConfigurationSection Get(string name) { throw null; } + public override System.Collections.IEnumerator GetEnumerator() { throw null; } + public string GetKey(int index) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public void Remove(string name) { } + public void RemoveAt(int index) { } + } + public partial class ConfigurationSectionGroup + { + public ConfigurationSectionGroup() { } + public bool IsDeclarationRequired { get { throw null; } } + public bool IsDeclared { get { throw null; } } + public string Name { get { throw null; } } + public string SectionGroupName { get { throw null; } } + public System.Configuration.ConfigurationSectionGroupCollection SectionGroups { get { throw null; } } + public System.Configuration.ConfigurationSectionCollection Sections { get { throw null; } } + public string Type { get { throw null; } set { } } + public void ForceDeclaration() { } + public void ForceDeclaration(bool force) { } + protected internal virtual bool ShouldSerializeSectionGroupInTargetVersion(System.Runtime.Versioning.FrameworkName targetFramework) { throw null; } + } + [System.SerializableAttribute] + public sealed partial class ConfigurationSectionGroupCollection : System.Collections.Specialized.NameObjectCollectionBase + { + internal ConfigurationSectionGroupCollection() { } + public override int Count { get { throw null; } } + public System.Configuration.ConfigurationSectionGroup this[int index] { get { throw null; } } + public System.Configuration.ConfigurationSectionGroup this[string name] { get { throw null; } } + public override System.Collections.Specialized.NameObjectCollectionBase.KeysCollection Keys { get { throw null; } } + public void Add(string name, System.Configuration.ConfigurationSectionGroup sectionGroup) { } + public void Clear() { } + public void CopyTo(System.Configuration.ConfigurationSectionGroup[] array, int index) { } + public System.Configuration.ConfigurationSectionGroup Get(int index) { throw null; } + public System.Configuration.ConfigurationSectionGroup Get(string name) { throw null; } + public override System.Collections.IEnumerator GetEnumerator() { throw null; } + public string GetKey(int index) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public void Remove(string name) { } + public void RemoveAt(int index) { } + } + public enum ConfigurationUserLevel + { + None = 0, + PerUserRoaming = 10, + PerUserRoamingAndLocal = 20, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public partial class ConfigurationValidatorAttribute : System.Attribute + { + protected ConfigurationValidatorAttribute() { } + public ConfigurationValidatorAttribute(System.Type validator) { } + public virtual System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + public System.Type ValidatorType { get { throw null; } } + } + public abstract partial class ConfigurationValidatorBase + { + protected ConfigurationValidatorBase() { } + public virtual bool CanValidate(System.Type type) { throw null; } + public abstract void Validate(object value); + } + public sealed partial class ConnectionStringSettings : System.Configuration.ConfigurationElement + { + public ConnectionStringSettings() { } + public ConnectionStringSettings(string name, string connectionString) { } + public ConnectionStringSettings(string name, string connectionString, string providerName) { } + [System.Configuration.ConfigurationPropertyAttribute("connectionString", Options=(System.Configuration.ConfigurationPropertyOptions)(2), DefaultValue="")] + public string ConnectionString { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("name", Options=(System.Configuration.ConfigurationPropertyOptions)(6), DefaultValue="")] + public string Name { get { throw null; } set { } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("providerName", DefaultValue="System.Data.SqlClient")] + public string ProviderName { get { throw null; } set { } } + public override string ToString() { throw null; } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Configuration.ConnectionStringSettings))] + public sealed partial class ConnectionStringSettingsCollection : System.Configuration.ConfigurationElementCollection + { + public ConnectionStringSettingsCollection() { } + public System.Configuration.ConnectionStringSettings this[int index] { get { throw null; } set { } } + public new System.Configuration.ConnectionStringSettings this[string name] { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + public void Add(System.Configuration.ConnectionStringSettings settings) { } + protected override void BaseAdd(int index, System.Configuration.ConfigurationElement element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public int IndexOf(System.Configuration.ConnectionStringSettings settings) { throw null; } + public void Remove(System.Configuration.ConnectionStringSettings settings) { } + public void Remove(string name) { } + public void RemoveAt(int index) { } + } + public sealed partial class ConnectionStringsSection : System.Configuration.ConfigurationSection + { + public ConnectionStringsSection() { } + [System.Configuration.ConfigurationPropertyAttribute("", Options=(System.Configuration.ConfigurationPropertyOptions)(1))] + public System.Configuration.ConnectionStringSettingsCollection ConnectionStrings { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override object GetRuntimeObject() { throw null; } + } + public sealed partial class ContextInformation + { + internal ContextInformation() { } + public object HostingContext { get { throw null; } } + public bool IsMachineLevel { get { throw null; } } + public object GetSection(string sectionName) { throw null; } + } + public sealed partial class DefaultSection : System.Configuration.ConfigurationSection + { + public DefaultSection() { } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override void DeserializeSection(System.Xml.XmlReader xmlReader) { } + protected internal override bool IsModified() { throw null; } + protected internal override void Reset(System.Configuration.ConfigurationElement parentSection) { } + protected internal override void ResetModified() { } + protected internal override string SerializeSection(System.Configuration.ConfigurationElement parentSection, string name, System.Configuration.ConfigurationSaveMode saveMode) { throw null; } + } + public sealed partial class DefaultValidator : System.Configuration.ConfigurationValidatorBase + { + public DefaultValidator() { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] + public sealed partial class DpapiProtectedConfigurationProvider : System.Configuration.ProtectedConfigurationProvider + { + public DpapiProtectedConfigurationProvider() { } + public bool UseMachineProtection { get { throw null; } } + public override System.Xml.XmlNode Decrypt(System.Xml.XmlNode encryptedNode) { throw null; } + public override System.Xml.XmlNode Encrypt(System.Xml.XmlNode node) { throw null; } + public override void Initialize(string name, System.Collections.Specialized.NameValueCollection configurationValues) { } + } + public sealed partial class ElementInformation + { + internal ElementInformation() { } + public System.Collections.ICollection Errors { get { throw null; } } + public bool IsCollection { get { throw null; } } + public bool IsLocked { get { throw null; } } + public bool IsPresent { get { throw null; } } + public int LineNumber { get { throw null; } } + public System.Configuration.PropertyInformationCollection Properties { get { throw null; } } + public string Source { get { throw null; } } + public System.Type Type { get { throw null; } } + public System.Configuration.ConfigurationValidatorBase Validator { get { throw null; } } + } + public sealed partial class ExeConfigurationFileMap : System.Configuration.ConfigurationFileMap + { + public ExeConfigurationFileMap() { } + public ExeConfigurationFileMap(string machineConfigFileName) { } + public string ExeConfigFilename { get { throw null; } set { } } + public string LocalUserConfigFilename { get { throw null; } set { } } + public string RoamingUserConfigFilename { get { throw null; } set { } } + public override object Clone() { throw null; } + } + public sealed partial class ExeContext + { + internal ExeContext() { } + public string ExePath { get { throw null; } } + public System.Configuration.ConfigurationUserLevel UserLevel { get { throw null; } } + } + public sealed partial class GenericEnumConverter : System.Configuration.ConfigurationConverterBase + { + public GenericEnumConverter(System.Type typeEnum) { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public sealed partial class IgnoreSection : System.Configuration.ConfigurationSection + { + public IgnoreSection() { } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override void DeserializeSection(System.Xml.XmlReader xmlReader) { } + protected internal override bool IsModified() { throw null; } + protected internal override void Reset(System.Configuration.ConfigurationElement parentSection) { } + protected internal override void ResetModified() { } + protected internal override string SerializeSection(System.Configuration.ConfigurationElement parentSection, string name, System.Configuration.ConfigurationSaveMode saveMode) { throw null; } + } + public sealed partial class InfiniteIntConverter : System.Configuration.ConfigurationConverterBase + { + public InfiniteIntConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public sealed partial class InfiniteTimeSpanConverter : System.Configuration.ConfigurationConverterBase + { + public InfiniteTimeSpanConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public partial class IntegerValidator : System.Configuration.ConfigurationValidatorBase + { + public IntegerValidator(int minValue, int maxValue) { } + public IntegerValidator(int minValue, int maxValue, bool rangeIsExclusive) { } + public IntegerValidator(int minValue, int maxValue, bool rangeIsExclusive, int resolution) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class IntegerValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public IntegerValidatorAttribute() { } + public bool ExcludeRange { get { throw null; } set { } } + public int MaxValue { get { throw null; } set { } } + public int MinValue { get { throw null; } set { } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Configuration.KeyValueConfigurationElement))] + public partial class KeyValueConfigurationCollection : System.Configuration.ConfigurationElementCollection + { + public KeyValueConfigurationCollection() { } + public string[] AllKeys { get { throw null; } } + public new System.Configuration.KeyValueConfigurationElement this[string key] { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected override bool ThrowOnDuplicate { get { throw null; } } + public void Add(System.Configuration.KeyValueConfigurationElement keyValue) { } + public void Add(string key, string value) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(string key) { } + } + public partial class KeyValueConfigurationElement : System.Configuration.ConfigurationElement + { + public KeyValueConfigurationElement(string key, string value) { } + [System.Configuration.ConfigurationPropertyAttribute("key", Options=(System.Configuration.ConfigurationPropertyOptions)(4), DefaultValue="")] + public string Key { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("value", DefaultValue="")] + public string Value { get { throw null; } set { } } + protected internal override void Init() { } + } + public partial class LongValidator : System.Configuration.ConfigurationValidatorBase + { + public LongValidator(long minValue, long maxValue) { } + public LongValidator(long minValue, long maxValue, bool rangeIsExclusive) { } + public LongValidator(long minValue, long maxValue, bool rangeIsExclusive, long resolution) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class LongValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public LongValidatorAttribute() { } + public bool ExcludeRange { get { throw null; } set { } } + public long MaxValue { get { throw null; } set { } } + public long MinValue { get { throw null; } set { } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Configuration.NameValueConfigurationElement))] + public sealed partial class NameValueConfigurationCollection : System.Configuration.ConfigurationElementCollection + { + public NameValueConfigurationCollection() { } + public string[] AllKeys { get { throw null; } } + public new System.Configuration.NameValueConfigurationElement this[string name] { get { throw null; } set { } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + public void Add(System.Configuration.NameValueConfigurationElement nameValue) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(System.Configuration.NameValueConfigurationElement nameValue) { } + public void Remove(string name) { } + } + public sealed partial class NameValueConfigurationElement : System.Configuration.ConfigurationElement + { + public NameValueConfigurationElement(string name, string value) { } + [System.Configuration.ConfigurationPropertyAttribute("name", IsKey=true, DefaultValue="")] + public string Name { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("value", DefaultValue="")] + public string Value { get { throw null; } set { } } + } + public enum OverrideMode + { + Allow = 1, + Deny = 2, + Inherit = 0, + } + public partial class PositiveTimeSpanValidator : System.Configuration.ConfigurationValidatorBase + { + public PositiveTimeSpanValidator() { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class PositiveTimeSpanValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public PositiveTimeSpanValidatorAttribute() { } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + public sealed partial class PropertyInformation + { + internal PropertyInformation() { } + public System.ComponentModel.TypeConverter Converter { get { throw null; } } + public object DefaultValue { get { throw null; } } + public string Description { get { throw null; } } + public bool IsKey { get { throw null; } } + public bool IsLocked { get { throw null; } } + public bool IsModified { get { throw null; } } + public bool IsRequired { get { throw null; } } + public int LineNumber { get { throw null; } } + public string Name { get { throw null; } } + public string Source { get { throw null; } } + public System.Type Type { get { throw null; } } + public System.Configuration.ConfigurationValidatorBase Validator { get { throw null; } } + public object Value { get { throw null; } set { } } + public System.Configuration.PropertyValueOrigin ValueOrigin { get { throw null; } } + } + [System.SerializableAttribute] + public sealed partial class PropertyInformationCollection : System.Collections.Specialized.NameObjectCollectionBase + { + internal PropertyInformationCollection() { } + public System.Configuration.PropertyInformation this[string propertyName] { get { throw null; } } + public void CopyTo(System.Configuration.PropertyInformation[] array, int index) { } + public override System.Collections.IEnumerator GetEnumerator() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public enum PropertyValueOrigin + { + Default = 0, + Inherited = 1, + SetHere = 2, + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public static partial class ProtectedConfiguration + { + public const string DataProtectionProviderName = "DataProtectionConfigurationProvider"; + public const string ProtectedDataSectionName = "configProtectedData"; + public const string RsaProviderName = "RsaProtectedConfigurationProvider"; + public static string DefaultProvider { get { throw null; } } + public static System.Configuration.ProtectedConfigurationProviderCollection Providers { get { throw null; } } + } + public abstract partial class ProtectedConfigurationProvider : System.Configuration.Provider.ProviderBase + { + protected ProtectedConfigurationProvider() { } + public abstract System.Xml.XmlNode Decrypt(System.Xml.XmlNode encryptedNode); + public abstract System.Xml.XmlNode Encrypt(System.Xml.XmlNode node); + } + public partial class ProtectedConfigurationProviderCollection : System.Configuration.Provider.ProviderCollection + { + public ProtectedConfigurationProviderCollection() { } + public new System.Configuration.ProtectedConfigurationProvider this[string name] { get { throw null; } } + public override void Add(System.Configuration.Provider.ProviderBase provider) { } + } + public sealed partial class ProtectedConfigurationSection : System.Configuration.ConfigurationSection + { + public ProtectedConfigurationSection() { } + [System.Configuration.ConfigurationPropertyAttribute("defaultProvider", DefaultValue="RsaProtectedConfigurationProvider")] + public string DefaultProvider { get { throw null; } set { } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("providers")] + public System.Configuration.ProviderSettingsCollection Providers { get { throw null; } } + } + public partial class ProtectedProviderSettings : System.Configuration.ConfigurationElement + { + public ProtectedProviderSettings() { } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("", IsDefaultCollection=true, Options=(System.Configuration.ConfigurationPropertyOptions)(1))] + public System.Configuration.ProviderSettingsCollection Providers { get { throw null; } } + } + public sealed partial class ProviderSettings : System.Configuration.ConfigurationElement + { + public ProviderSettings() { } + public ProviderSettings(string name, string type) { } + [System.Configuration.ConfigurationPropertyAttribute("name", IsRequired=true, IsKey=true)] + public string Name { get { throw null; } set { } } + public System.Collections.Specialized.NameValueCollection Parameters { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("type", IsRequired=true)] + public string Type { get { throw null; } set { } } + protected internal override bool IsModified() { throw null; } + protected override bool OnDeserializeUnrecognizedAttribute(string name, string value) { throw null; } + protected internal override void Reset(System.Configuration.ConfigurationElement parentElement) { } + protected internal override void Unmerge(System.Configuration.ConfigurationElement sourceElement, System.Configuration.ConfigurationElement parentElement, System.Configuration.ConfigurationSaveMode saveMode) { } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Configuration.ProviderSettings))] + public sealed partial class ProviderSettingsCollection : System.Configuration.ConfigurationElementCollection + { + public ProviderSettingsCollection() { } + public System.Configuration.ProviderSettings this[int index] { get { throw null; } set { } } + public new System.Configuration.ProviderSettings this[string key] { get { throw null; } } + protected internal override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + public void Add(System.Configuration.ProviderSettings provider) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(string name) { } + } + public partial class RegexStringValidator : System.Configuration.ConfigurationValidatorBase + { + public RegexStringValidator(string regex) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class RegexStringValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public RegexStringValidatorAttribute(string regex) { } + public string Regex { get { throw null; } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] + public sealed partial class RsaProtectedConfigurationProvider : System.Configuration.ProtectedConfigurationProvider + { + public RsaProtectedConfigurationProvider() { } + public string CspProviderName { get { throw null; } } + public string KeyContainerName { get { throw null; } } + public System.Security.Cryptography.RSAParameters RsaPublicKey { get { throw null; } } + public bool UseFIPS { get { throw null; } } + public bool UseMachineContainer { get { throw null; } } + public bool UseOAEP { get { throw null; } } + public void AddKey(int keySize, bool exportable) { } + public override System.Xml.XmlNode Decrypt(System.Xml.XmlNode encryptedNode) { throw null; } + public void DeleteKey() { } + public override System.Xml.XmlNode Encrypt(System.Xml.XmlNode node) { throw null; } + public void ExportKey(string xmlFileName, bool includePrivateParameters) { } + public void ImportKey(string xmlFileName, bool exportable) { } + public override void Initialize(string name, System.Collections.Specialized.NameValueCollection configurationValues) { } + } + public sealed partial class SectionInformation + { + internal SectionInformation() { } + public System.Configuration.ConfigurationAllowDefinition AllowDefinition { get { throw null; } set { } } + public System.Configuration.ConfigurationAllowExeDefinition AllowExeDefinition { get { throw null; } set { } } + public bool AllowLocation { get { throw null; } set { } } + public bool AllowOverride { get { throw null; } set { } } + public string ConfigSource { get { throw null; } set { } } + public System.Configuration.ConfigurationBuilder ConfigurationBuilder { get { throw null; } } + public bool ForceSave { get { throw null; } set { } } + public bool InheritInChildApplications { get { throw null; } set { } } + public bool IsDeclarationRequired { get { throw null; } } + public bool IsDeclared { get { throw null; } } + public bool IsLocked { get { throw null; } } + public bool IsProtected { get { throw null; } } + public string Name { get { throw null; } } + public System.Configuration.OverrideMode OverrideMode { get { throw null; } set { } } + public System.Configuration.OverrideMode OverrideModeDefault { get { throw null; } set { } } + public System.Configuration.OverrideMode OverrideModeEffective { get { throw null; } } + public System.Configuration.ProtectedConfigurationProvider ProtectionProvider { get { throw null; } } + public bool RequirePermission { get { throw null; } set { } } + public bool RestartOnExternalChanges { get { throw null; } set { } } + public string SectionName { get { throw null; } } + public string Type { get { throw null; } set { } } + public void ForceDeclaration() { } + public void ForceDeclaration(bool force) { } + public System.Configuration.ConfigurationSection GetParentSection() { throw null; } + public string GetRawXml() { throw null; } + public void ProtectSection(string protectionProvider) { } + public void RevertToParent() { } + public void SetRawXml(string rawXml) { } + public void UnprotectSection() { } + } + public partial class StringValidator : System.Configuration.ConfigurationValidatorBase + { + public StringValidator(int minLength) { } + public StringValidator(int minLength, int maxLength) { } + public StringValidator(int minLength, int maxLength, string invalidCharacters) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class StringValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public StringValidatorAttribute() { } + public string InvalidCharacters { get { throw null; } set { } } + public int MaxLength { get { throw null; } set { } } + public int MinLength { get { throw null; } set { } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + public sealed partial class SubclassTypeValidator : System.Configuration.ConfigurationValidatorBase + { + public SubclassTypeValidator(System.Type baseClass) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class SubclassTypeValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public SubclassTypeValidatorAttribute(System.Type baseClass) { } + public System.Type BaseClass { get { throw null; } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + public partial class TimeSpanMinutesConverter : System.Configuration.ConfigurationConverterBase + { + public TimeSpanMinutesConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public sealed partial class TimeSpanMinutesOrInfiniteConverter : System.Configuration.TimeSpanMinutesConverter + { + public TimeSpanMinutesOrInfiniteConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public partial class TimeSpanSecondsConverter : System.Configuration.ConfigurationConverterBase + { + public TimeSpanSecondsConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public sealed partial class TimeSpanSecondsOrInfiniteConverter : System.Configuration.TimeSpanSecondsConverter + { + public TimeSpanSecondsOrInfiniteConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public partial class TimeSpanValidator : System.Configuration.ConfigurationValidatorBase + { + public TimeSpanValidator(System.TimeSpan minValue, System.TimeSpan maxValue) { } + public TimeSpanValidator(System.TimeSpan minValue, System.TimeSpan maxValue, bool rangeIsExclusive) { } + public TimeSpanValidator(System.TimeSpan minValue, System.TimeSpan maxValue, bool rangeIsExclusive, long resolutionInSeconds) { } + public override bool CanValidate(System.Type type) { throw null; } + public override void Validate(object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128))] + public sealed partial class TimeSpanValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute + { + public const string TimeSpanMaxValue = "10675199.02:48:05.4775807"; + public const string TimeSpanMinValue = "-10675199.02:48:05.4775808"; + public TimeSpanValidatorAttribute() { } + public bool ExcludeRange { get { throw null; } set { } } + public System.TimeSpan MaxValue { get { throw null; } } + public string MaxValueString { get { throw null; } set { } } + public System.TimeSpan MinValue { get { throw null; } } + public string MinValueString { get { throw null; } set { } } + public override System.Configuration.ConfigurationValidatorBase ValidatorInstance { get { throw null; } } + } + public sealed partial class TypeNameConverter : System.Configuration.ConfigurationConverterBase + { + public TypeNameConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } + public delegate void ValidatorCallback(object value); + public sealed partial class WhiteSpaceTrimStringConverter : System.Configuration.ConfigurationConverterBase + { + public WhiteSpaceTrimStringConverter() { } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object data) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext ctx, System.Globalization.CultureInfo ci, object value, System.Type type) { throw null; } + } +} +namespace System.Configuration.Internal +{ + public partial class DelegatingConfigHost : System.Configuration.Internal.IInternalConfigHost, System.Configuration.Internal.IInternalConfigurationBuilderHost + { + protected DelegatingConfigHost() { } + protected System.Configuration.Internal.IInternalConfigurationBuilderHost ConfigBuilderHost { get { throw null; } } + protected System.Configuration.Internal.IInternalConfigHost Host { get { throw null; } set { } } + public virtual bool IsRemote { get { throw null; } } + public virtual bool SupportsChangeNotifications { get { throw null; } } + public virtual bool SupportsLocation { get { throw null; } } + public virtual bool SupportsPath { get { throw null; } } + public virtual bool SupportsRefresh { get { throw null; } } + public virtual object CreateConfigurationContext(string configPath, string locationSubPath) { throw null; } + public virtual object CreateDeprecatedConfigContext(string configPath) { throw null; } + public virtual string DecryptSection(string encryptedXml, System.Configuration.ProtectedConfigurationProvider protectionProvider, System.Configuration.ProtectedConfigurationSection protectedConfigSection) { throw null; } + public virtual void DeleteStream(string streamName) { } + public virtual string EncryptSection(string clearTextXml, System.Configuration.ProtectedConfigurationProvider protectionProvider, System.Configuration.ProtectedConfigurationSection protectedConfigSection) { throw null; } + public virtual string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath) { throw null; } + public virtual System.Type GetConfigType(string typeName, bool throwOnError) { throw null; } + public virtual string GetConfigTypeName(System.Type t) { throw null; } + public virtual void GetRestrictedPermissions(System.Configuration.Internal.IInternalConfigRecord configRecord, out System.Security.PermissionSet permissionSet, out bool isHostReady) { permissionSet = default(System.Security.PermissionSet); isHostReady = default(bool); } + public virtual string GetStreamName(string configPath) { throw null; } + public virtual string GetStreamNameForConfigSource(string streamName, string configSource) { throw null; } + public virtual object GetStreamVersion(string streamName) { throw null; } + public virtual System.IDisposable Impersonate() { throw null; } + public virtual void Init(System.Configuration.Internal.IInternalConfigRoot configRoot, params object[] hostInitParams) { } + public virtual void InitForConfiguration(ref string locationSubPath, out string configPath, out string locationConfigPath, System.Configuration.Internal.IInternalConfigRoot configRoot, params object[] hostInitConfigurationParams) { configPath = default(string); locationConfigPath = default(string); } + public virtual bool IsAboveApplication(string configPath) { throw null; } + public virtual bool IsConfigRecordRequired(string configPath) { throw null; } + public virtual bool IsDefinitionAllowed(string configPath, System.Configuration.ConfigurationAllowDefinition allowDefinition, System.Configuration.ConfigurationAllowExeDefinition allowExeDefinition) { throw null; } + public virtual bool IsFile(string streamName) { throw null; } + public virtual bool IsFullTrustSectionWithoutAptcaAllowed(System.Configuration.Internal.IInternalConfigRecord configRecord) { throw null; } + public virtual bool IsInitDelayed(System.Configuration.Internal.IInternalConfigRecord configRecord) { throw null; } + public virtual bool IsLocationApplicable(string configPath) { throw null; } + public virtual bool IsSecondaryRoot(string configPath) { throw null; } + public virtual bool IsTrustedConfigPath(string configPath) { throw null; } + public virtual System.IO.Stream OpenStreamForRead(string streamName) { throw null; } + public virtual System.IO.Stream OpenStreamForRead(string streamName, bool assertPermissions) { throw null; } + public virtual System.IO.Stream OpenStreamForWrite(string streamName, string templateStreamName, ref object writeContext) { throw null; } + public virtual System.IO.Stream OpenStreamForWrite(string streamName, string templateStreamName, ref object writeContext, bool assertPermissions) { throw null; } + public virtual bool PrefetchAll(string configPath, string streamName) { throw null; } + public virtual bool PrefetchSection(string sectionGroupName, string sectionName) { throw null; } + public virtual System.Configuration.ConfigurationSection ProcessConfigurationSection(System.Configuration.ConfigurationSection configSection, System.Configuration.ConfigurationBuilder builder) { throw null; } + public virtual System.Xml.XmlNode ProcessRawXml(System.Xml.XmlNode rawXml, System.Configuration.ConfigurationBuilder builder) { throw null; } + public virtual void RequireCompleteInit(System.Configuration.Internal.IInternalConfigRecord configRecord) { } + public virtual object StartMonitoringStreamForChanges(string streamName, System.Configuration.Internal.StreamChangeCallback callback) { throw null; } + public virtual void StopMonitoringStreamForChanges(string streamName, System.Configuration.Internal.StreamChangeCallback callback) { } + public virtual void VerifyDefinitionAllowed(string configPath, System.Configuration.ConfigurationAllowDefinition allowDefinition, System.Configuration.ConfigurationAllowExeDefinition allowExeDefinition, System.Configuration.Internal.IConfigErrorInfo errorInfo) { } + public virtual void WriteCompleted(string streamName, bool success, object writeContext) { } + public virtual void WriteCompleted(string streamName, bool success, object writeContext, bool assertPermissions) { } + } + public partial interface IConfigErrorInfo + { + string Filename { get; } + int LineNumber { get; } + } + public partial interface IConfigSystem + { + System.Configuration.Internal.IInternalConfigHost Host { get; } + System.Configuration.Internal.IInternalConfigRoot Root { get; } + void Init(System.Type typeConfigHost, params object[] hostInitParams); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IConfigurationManagerHelper + { + void EnsureNetConfigLoaded(); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IConfigurationManagerInternal + { + string ApplicationConfigUri { get; } + string ExeLocalConfigDirectory { get; } + string ExeLocalConfigPath { get; } + string ExeProductName { get; } + string ExeProductVersion { get; } + string ExeRoamingConfigDirectory { get; } + string ExeRoamingConfigPath { get; } + string MachineConfigPath { get; } + bool SetConfigurationSystemInProgress { get; } + bool SupportsUserConfig { get; } + string UserConfigFilename { get; } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigClientHost + { + string GetExeConfigPath(); + string GetLocalUserConfigPath(); + string GetRoamingUserConfigPath(); + bool IsExeConfig(string configPath); + bool IsLocalUserConfig(string configPath); + bool IsRoamingUserConfig(string configPath); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigConfigurationFactory + { + System.Configuration.Configuration Create(System.Type typeConfigHost, params object[] hostInitConfigurationParams); + string NormalizeLocationSubPath(string subPath, System.Configuration.Internal.IConfigErrorInfo errorInfo); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigHost + { + bool IsRemote { get; } + bool SupportsChangeNotifications { get; } + bool SupportsLocation { get; } + bool SupportsPath { get; } + bool SupportsRefresh { get; } + object CreateConfigurationContext(string configPath, string locationSubPath); + object CreateDeprecatedConfigContext(string configPath); + string DecryptSection(string encryptedXml, System.Configuration.ProtectedConfigurationProvider protectionProvider, System.Configuration.ProtectedConfigurationSection protectedConfigSection); + void DeleteStream(string streamName); + string EncryptSection(string clearTextXml, System.Configuration.ProtectedConfigurationProvider protectionProvider, System.Configuration.ProtectedConfigurationSection protectedConfigSection); + string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath); + System.Type GetConfigType(string typeName, bool throwOnError); + string GetConfigTypeName(System.Type t); + void GetRestrictedPermissions(System.Configuration.Internal.IInternalConfigRecord configRecord, out System.Security.PermissionSet permissionSet, out bool isHostReady); + string GetStreamName(string configPath); + string GetStreamNameForConfigSource(string streamName, string configSource); + object GetStreamVersion(string streamName); + System.IDisposable Impersonate(); + void Init(System.Configuration.Internal.IInternalConfigRoot configRoot, params object[] hostInitParams); + void InitForConfiguration(ref string locationSubPath, out string configPath, out string locationConfigPath, System.Configuration.Internal.IInternalConfigRoot configRoot, params object[] hostInitConfigurationParams); + bool IsAboveApplication(string configPath); + bool IsConfigRecordRequired(string configPath); + bool IsDefinitionAllowed(string configPath, System.Configuration.ConfigurationAllowDefinition allowDefinition, System.Configuration.ConfigurationAllowExeDefinition allowExeDefinition); + bool IsFile(string streamName); + bool IsFullTrustSectionWithoutAptcaAllowed(System.Configuration.Internal.IInternalConfigRecord configRecord); + bool IsInitDelayed(System.Configuration.Internal.IInternalConfigRecord configRecord); + bool IsLocationApplicable(string configPath); + bool IsSecondaryRoot(string configPath); + bool IsTrustedConfigPath(string configPath); + System.IO.Stream OpenStreamForRead(string streamName); + System.IO.Stream OpenStreamForRead(string streamName, bool assertPermissions); + System.IO.Stream OpenStreamForWrite(string streamName, string templateStreamName, ref object writeContext); + System.IO.Stream OpenStreamForWrite(string streamName, string templateStreamName, ref object writeContext, bool assertPermissions); + bool PrefetchAll(string configPath, string streamName); + bool PrefetchSection(string sectionGroupName, string sectionName); + void RequireCompleteInit(System.Configuration.Internal.IInternalConfigRecord configRecord); + object StartMonitoringStreamForChanges(string streamName, System.Configuration.Internal.StreamChangeCallback callback); + void StopMonitoringStreamForChanges(string streamName, System.Configuration.Internal.StreamChangeCallback callback); + void VerifyDefinitionAllowed(string configPath, System.Configuration.ConfigurationAllowDefinition allowDefinition, System.Configuration.ConfigurationAllowExeDefinition allowExeDefinition, System.Configuration.Internal.IConfigErrorInfo errorInfo); + void WriteCompleted(string streamName, bool success, object writeContext); + void WriteCompleted(string streamName, bool success, object writeContext, bool assertPermissions); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigRecord + { + string ConfigPath { get; } + bool HasInitErrors { get; } + string StreamName { get; } + object GetLkgSection(string configKey); + object GetSection(string configKey); + void RefreshSection(string configKey); + void Remove(); + void ThrowIfInitErrors(); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigRoot + { + bool IsDesignTime { get; } + event System.Configuration.Internal.InternalConfigEventHandler ConfigChanged; + event System.Configuration.Internal.InternalConfigEventHandler ConfigRemoved; + System.Configuration.Internal.IInternalConfigRecord GetConfigRecord(string configPath); + object GetSection(string section, string configPath); + string GetUniqueConfigPath(string configPath); + System.Configuration.Internal.IInternalConfigRecord GetUniqueConfigRecord(string configPath); + void Init(System.Configuration.Internal.IInternalConfigHost host, bool isDesignTime); + void RemoveConfig(string configPath); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigSettingsFactory + { + void CompleteInit(); + void SetConfigurationSystem(System.Configuration.Internal.IInternalConfigSystem internalConfigSystem, bool initComplete); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigSystem + { + bool SupportsUserConfig { get; } + object GetSection(string configKey); + void RefreshConfig(string sectionName); + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public partial interface IInternalConfigurationBuilderHost + { + System.Configuration.ConfigurationSection ProcessConfigurationSection(System.Configuration.ConfigurationSection configSection, System.Configuration.ConfigurationBuilder builder); + System.Xml.XmlNode ProcessRawXml(System.Xml.XmlNode rawXml, System.Configuration.ConfigurationBuilder builder); + } + public sealed partial class InternalConfigEventArgs : System.EventArgs + { + public InternalConfigEventArgs(string configPath) { } + public string ConfigPath { get { throw null; } set { } } + } + public delegate void InternalConfigEventHandler(object sender, System.Configuration.Internal.InternalConfigEventArgs e); + public delegate void StreamChangeCallback(string streamName); +} +namespace System.Configuration.Provider +{ + public abstract partial class ProviderBase + { + protected ProviderBase() { } + public virtual string Description { get { throw null; } } + public virtual string Name { get { throw null; } } + public virtual void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { } + } + public partial class ProviderCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + public ProviderCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Configuration.Provider.ProviderBase this[string name] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public virtual void Add(System.Configuration.Provider.ProviderBase provider) { } + public void Clear() { } + public void CopyTo(System.Configuration.Provider.ProviderBase[] array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void Remove(string name) { } + public void SetReadOnly() { } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + } + [System.SerializableAttribute] + public partial class ProviderException : System.Exception + { + public ProviderException() { } + protected ProviderException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ProviderException(string message) { } + public ProviderException(string message, System.Exception innerException) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Core.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Core.cs.REMOVED.git-id new file mode 100644 index 0000000000..8ccd8f57e4 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Core.cs.REMOVED.git-id @@ -0,0 +1 @@ +c2326f36f5006caa96a72f19b0fff05aa338e9d6 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.DataSetExtensions.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Data.DataSetExtensions.cs new file mode 100644 index 0000000000..9e0aa542d5 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.DataSetExtensions.cs @@ -0,0 +1,110 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.DataSetExtensions.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.DataSetExtensions.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.DataSetExtensions.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +namespace System.Data +{ + public static partial class DataRowComparer + { + public static System.Data.DataRowComparer Default { get { throw null; } } + } + public sealed partial class DataRowComparer : System.Collections.Generic.IEqualityComparer where TRow : System.Data.DataRow + { + internal DataRowComparer() { } + public static System.Data.DataRowComparer Default { get { throw null; } } + public bool Equals(TRow leftRow, TRow rightRow) { throw null; } + public int GetHashCode(TRow row) { throw null; } + } + public static partial class DataRowExtensions + { + public static T Field(this System.Data.DataRow row, System.Data.DataColumn column) { throw null; } + public static T Field(this System.Data.DataRow row, System.Data.DataColumn column, System.Data.DataRowVersion version) { throw null; } + public static T Field(this System.Data.DataRow row, int columnIndex) { throw null; } + public static T Field(this System.Data.DataRow row, int columnIndex, System.Data.DataRowVersion version) { throw null; } + public static T Field(this System.Data.DataRow row, string columnName) { throw null; } + public static T Field(this System.Data.DataRow row, string columnName, System.Data.DataRowVersion version) { throw null; } + public static void SetField(this System.Data.DataRow row, System.Data.DataColumn column, T value) { } + public static void SetField(this System.Data.DataRow row, int columnIndex, T value) { } + public static void SetField(this System.Data.DataRow row, string columnName, T value) { } + } + public static partial class DataTableExtensions + { + public static System.Data.DataView AsDataView(this System.Data.DataTable table) { throw null; } + public static System.Data.DataView AsDataView(this System.Data.EnumerableRowCollection source) where T : System.Data.DataRow { throw null; } + public static System.Data.EnumerableRowCollection AsEnumerable(this System.Data.DataTable source) { throw null; } + public static System.Data.DataTable CopyToDataTable(this System.Collections.Generic.IEnumerable source) where T : System.Data.DataRow { throw null; } + public static void CopyToDataTable(this System.Collections.Generic.IEnumerable source, System.Data.DataTable table, System.Data.LoadOption options) where T : System.Data.DataRow { } + public static void CopyToDataTable(this System.Collections.Generic.IEnumerable source, System.Data.DataTable table, System.Data.LoadOption options, System.Data.FillErrorEventHandler errorHandler) where T : System.Data.DataRow { } + } + public abstract partial class EnumerableRowCollection : System.Collections.IEnumerable + { + internal EnumerableRowCollection() { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public static partial class EnumerableRowCollectionExtensions + { + public static System.Data.EnumerableRowCollection Cast(this System.Data.EnumerableRowCollection source) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.EnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.EnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.EnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.EnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.EnumerableRowCollection Select(this System.Data.EnumerableRowCollection source, System.Func selector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenByDescending(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenByDescending(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenBy(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenBy(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.EnumerableRowCollection Where(this System.Data.EnumerableRowCollection source, System.Func predicate) { throw null; } + } + public partial class EnumerableRowCollection : System.Data.EnumerableRowCollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + internal EnumerableRowCollection() { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public sealed partial class OrderedEnumerableRowCollection : System.Data.EnumerableRowCollection + { + internal OrderedEnumerableRowCollection() { } + } + public static partial class TypedTableBaseExtensions + { + public static System.Data.EnumerableRowCollection AsEnumerable(this System.Data.TypedTableBase source) where TRow : System.Data.DataRow { throw null; } + public static TRow ElementAtOrDefault(this System.Data.TypedTableBase source, int index) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.TypedTableBase source, System.Func keySelector) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.TypedTableBase source, System.Func keySelector, System.Collections.Generic.IComparer comparer) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.TypedTableBase source, System.Func keySelector) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.TypedTableBase source, System.Func keySelector, System.Collections.Generic.IComparer comparer) where TRow : System.Data.DataRow { throw null; } + public static System.Data.EnumerableRowCollection Select(this System.Data.TypedTableBase source, System.Func selector) where TRow : System.Data.DataRow { throw null; } + public static System.Data.EnumerableRowCollection Where(this System.Data.TypedTableBase source, System.Func predicate) where TRow : System.Data.DataRow { throw null; } + } + [System.SerializableAttribute] + public abstract partial class TypedTableBase : System.Data.DataTable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : System.Data.DataRow + { + protected TypedTableBase() { } + protected TypedTableBase(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.Data.EnumerableRowCollection Cast() { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.Entity.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Entity.cs.REMOVED.git-id new file mode 100644 index 0000000000..6397f9973a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Entity.cs.REMOVED.git-id @@ -0,0 +1 @@ +0f897698c0229494b0def6f4870c1d9ac2df87a4 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.Linq.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Linq.cs new file mode 100644 index 0000000000..685278151a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Linq.cs @@ -0,0 +1,703 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Linq.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Linq.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Linq.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace System.Data.Linq +{ + [System.Runtime.Serialization.DataContractAttribute] + [System.SerializableAttribute] + public sealed partial class Binary : System.IEquatable + { + public Binary(byte[] value) { } + public int Length { get { throw null; } } + public bool Equals(System.Data.Linq.Binary other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Data.Linq.Binary binary1, System.Data.Linq.Binary binary2) { throw null; } + public static implicit operator System.Data.Linq.Binary (byte[] value) { throw null; } + public static bool operator !=(System.Data.Linq.Binary binary1, System.Data.Linq.Binary binary2) { throw null; } + public byte[] ToArray() { throw null; } + public override string ToString() { throw null; } + } + public enum ChangeAction + { + Delete = 1, + Insert = 2, + None = 0, + Update = 3, + } + public sealed partial class ChangeConflictCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.ICollection, System.Collections.IEnumerable + { + internal ChangeConflictCollection() { } + public int Count { get { throw null; } } + public System.Data.Linq.ObjectChangeConflict this[int index] { get { throw null; } } + bool System.Collections.Generic.ICollection.IsReadOnly { get { throw null; } } + bool System.Collections.ICollection.IsSynchronized { get { throw null; } } + object System.Collections.ICollection.SyncRoot { get { throw null; } } + public void Clear() { } + public bool Contains(System.Data.Linq.ObjectChangeConflict item) { throw null; } + public void CopyTo(System.Data.Linq.ObjectChangeConflict[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public bool Remove(System.Data.Linq.ObjectChangeConflict item) { throw null; } + public void ResolveAll(System.Data.Linq.RefreshMode mode) { } + public void ResolveAll(System.Data.Linq.RefreshMode mode, bool autoResolveDeletes) { } + void System.Collections.Generic.ICollection.Add(System.Data.Linq.ObjectChangeConflict item) { } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ChangeConflictException : System.Exception + { + public ChangeConflictException() { } + public ChangeConflictException(string message) { } + public ChangeConflictException(string message, System.Exception innerException) { } + } + public sealed partial class ChangeSet + { + internal ChangeSet() { } + public System.Collections.Generic.IList Deletes { get { throw null; } } + public System.Collections.Generic.IList Inserts { get { throw null; } } + public System.Collections.Generic.IList Updates { get { throw null; } } + public override string ToString() { throw null; } + } + public sealed partial class CompiledQuery + { + internal CompiledQuery() { } + public System.Linq.Expressions.LambdaExpression Expression { get { throw null; } } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + public static System.Func Compile(System.Linq.Expressions.Expression> query) where TArg0 : System.Data.Linq.DataContext { throw null; } + } + public enum ConflictMode + { + ContinueOnConflict = 1, + FailOnFirstConflict = 0, + } + public partial class DataContext : System.IDisposable + { + public DataContext(System.Data.IDbConnection connection) { } + public DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mapping) { } + public DataContext(string fileOrServerOrConnection) { } + public DataContext(string fileOrServerOrConnection, System.Data.Linq.Mapping.MappingSource mapping) { } + public System.Data.Linq.ChangeConflictCollection ChangeConflicts { get { throw null; } } + public int CommandTimeout { get { throw null; } set { } } + public System.Data.Common.DbConnection Connection { get { throw null; } } + public bool DeferredLoadingEnabled { get { throw null; } set { } } + public System.Data.Linq.DataLoadOptions LoadOptions { get { throw null; } set { } } + public System.IO.TextWriter Log { get { throw null; } set { } } + public System.Data.Linq.Mapping.MetaModel Mapping { get { throw null; } } + public bool ObjectTrackingEnabled { get { throw null; } set { } } + public System.Data.Common.DbTransaction Transaction { get { throw null; } set { } } + public void CreateDatabase() { } + protected internal System.Linq.IQueryable CreateMethodCallQuery(object instance, System.Reflection.MethodInfo methodInfo, params object[] parameters) { throw null; } + public bool DatabaseExists() { throw null; } + public void DeleteDatabase() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public int ExecuteCommand(string command, params object[] parameters) { throw null; } + protected internal void ExecuteDynamicDelete(object entity) { } + protected internal void ExecuteDynamicInsert(object entity) { } + protected internal void ExecuteDynamicUpdate(object entity) { } + protected internal System.Data.Linq.IExecuteResult ExecuteMethodCall(object instance, System.Reflection.MethodInfo methodInfo, params object[] parameters) { throw null; } + public System.Collections.IEnumerable ExecuteQuery(System.Type elementType, string query, params object[] parameters) { throw null; } + public System.Collections.Generic.IEnumerable ExecuteQuery(string query, params object[] parameters) { throw null; } + public System.Data.Linq.ChangeSet GetChangeSet() { throw null; } + public System.Data.Common.DbCommand GetCommand(System.Linq.IQueryable query) { throw null; } + public System.Data.Linq.ITable GetTable(System.Type type) { throw null; } + public System.Data.Linq.Table GetTable() where TEntity : class { throw null; } + public void Refresh(System.Data.Linq.RefreshMode mode, System.Collections.IEnumerable entities) { } + public void Refresh(System.Data.Linq.RefreshMode mode, object entity) { } + public void Refresh(System.Data.Linq.RefreshMode mode, params object[] entities) { } + public void SubmitChanges() { } + public virtual void SubmitChanges(System.Data.Linq.ConflictMode failureMode) { } + public System.Data.Linq.IMultipleResults Translate(System.Data.Common.DbDataReader reader) { throw null; } + public System.Collections.IEnumerable Translate(System.Type elementType, System.Data.Common.DbDataReader reader) { throw null; } + public System.Collections.Generic.IEnumerable Translate(System.Data.Common.DbDataReader reader) { throw null; } + } + public sealed partial class DataLoadOptions + { + public DataLoadOptions() { } + public void AssociateWith(System.Linq.Expressions.LambdaExpression expression) { } + public void AssociateWith(System.Linq.Expressions.Expression> expression) { } + public void LoadWith(System.Linq.Expressions.LambdaExpression expression) { } + public void LoadWith(System.Linq.Expressions.Expression> expression) { } + } + public static partial class DBConvert + { + public static object ChangeType(object value, System.Type type) { throw null; } + public static T ChangeType(object value) { throw null; } + } + public partial class DuplicateKeyException : System.InvalidOperationException + { + public DuplicateKeyException(object duplicate) { } + public DuplicateKeyException(object duplicate, string message) { } + public DuplicateKeyException(object duplicate, string message, System.Exception innerException) { } + public object Object { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct EntityRef where TEntity : class + { + public EntityRef(System.Collections.Generic.IEnumerable source) { throw null;} + public EntityRef(System.Data.Linq.EntityRef entityRef) { throw null;} + public EntityRef(TEntity entity) { throw null;} + public TEntity Entity { get { throw null; } set { } } + public bool HasLoadedOrAssignedValue { get { throw null; } } + } + public sealed partial class EntitySet : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ComponentModel.IListSource where TEntity : class + { + public EntitySet() { } + public EntitySet(System.Action onAdd, System.Action onRemove) { } + public int Count { get { throw null; } } + public bool HasLoadedOrAssignedValues { get { throw null; } } + public bool IsDeferred { get { throw null; } } + public TEntity this[int index] { get { throw null; } set { } } + bool System.Collections.Generic.ICollection.IsReadOnly { get { throw null; } } + bool System.Collections.ICollection.IsSynchronized { get { throw null; } } + object System.Collections.ICollection.SyncRoot { get { throw null; } } + bool System.Collections.IList.IsFixedSize { get { throw null; } } + bool System.Collections.IList.IsReadOnly { get { throw null; } } + object System.Collections.IList.this[int index] { get { throw null; } set { } } + bool System.ComponentModel.IListSource.ContainsListCollection { get { throw null; } } + public event System.ComponentModel.ListChangedEventHandler ListChanged { add { } remove { } } + public void Add(TEntity entity) { } + public void AddRange(System.Collections.Generic.IEnumerable collection) { } + public void Assign(System.Collections.Generic.IEnumerable entitySource) { } + public void Clear() { } + public bool Contains(TEntity entity) { throw null; } + public void CopyTo(TEntity[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public System.ComponentModel.IBindingList GetNewBindingList() { throw null; } + public int IndexOf(TEntity entity) { throw null; } + public void Insert(int index, TEntity entity) { } + public void Load() { } + public bool Remove(TEntity entity) { throw null; } + public void RemoveAt(int index) { } + public void SetSource(System.Collections.Generic.IEnumerable entitySource) { } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + int System.Collections.IList.Add(object value) { throw null; } + bool System.Collections.IList.Contains(object value) { throw null; } + int System.Collections.IList.IndexOf(object value) { throw null; } + void System.Collections.IList.Insert(int index, object value) { } + void System.Collections.IList.Remove(object value) { } + System.Collections.IList System.ComponentModel.IListSource.GetList() { throw null; } + } + public partial class ForeignKeyReferenceAlreadyHasValueException : System.InvalidOperationException + { + public ForeignKeyReferenceAlreadyHasValueException() { } + public ForeignKeyReferenceAlreadyHasValueException(string message) { } + public ForeignKeyReferenceAlreadyHasValueException(string message, System.Exception innerException) { } + } + public partial interface IExecuteResult : System.IDisposable + { + object ReturnValue { get; } + object GetParameterValue(int parameterIndex); + } + public partial interface IFunctionResult + { + object ReturnValue { get; } + } + public partial interface IMultipleResults : System.Data.Linq.IFunctionResult, System.IDisposable + { + System.Collections.Generic.IEnumerable GetResult(); + } + public partial interface ISingleResult : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Data.Linq.IFunctionResult, System.IDisposable + { + } + public partial interface ITable : System.Collections.IEnumerable, System.Linq.IQueryable + { + System.Data.Linq.DataContext Context { get; } + bool IsReadOnly { get; } + void Attach(object entity); + void Attach(object entity, bool asModified); + void Attach(object entity, object original); + void AttachAll(System.Collections.IEnumerable entities); + void AttachAll(System.Collections.IEnumerable entities, bool asModified); + void DeleteAllOnSubmit(System.Collections.IEnumerable entities); + void DeleteOnSubmit(object entity); + System.Data.Linq.ModifiedMemberInfo[] GetModifiedMembers(object entity); + object GetOriginalEntityState(object entity); + void InsertAllOnSubmit(System.Collections.IEnumerable entities); + void InsertOnSubmit(object entity); + } + public partial interface ITable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Linq.IQueryable, System.Linq.IQueryable where TEntity : class + { + void Attach(TEntity entity); + void DeleteOnSubmit(TEntity entity); + void InsertOnSubmit(TEntity entity); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Link + { + public Link(System.Collections.Generic.IEnumerable source) { throw null;} + public Link(System.Data.Linq.Link link) { throw null;} + public Link(T value) { throw null;} + public bool HasLoadedOrAssignedValue { get { throw null; } } + public bool HasValue { get { throw null; } } + public T Value { get { throw null; } set { } } + } + public sealed partial class MemberChangeConflict + { + internal MemberChangeConflict() { } + public object CurrentValue { get { throw null; } } + public object DatabaseValue { get { throw null; } } + public bool IsModified { get { throw null; } } + public bool IsResolved { get { throw null; } } + public System.Reflection.MemberInfo Member { get { throw null; } } + public object OriginalValue { get { throw null; } } + public void Resolve(System.Data.Linq.RefreshMode refreshMode) { } + public void Resolve(object value) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct ModifiedMemberInfo + { + public object CurrentValue { get { throw null; } } + public System.Reflection.MemberInfo Member { get { throw null; } } + public object OriginalValue { get { throw null; } } + } + public sealed partial class ObjectChangeConflict + { + internal ObjectChangeConflict() { } + public bool IsDeleted { get { throw null; } } + public bool IsResolved { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection MemberConflicts { get { throw null; } } + public object Object { get { throw null; } } + public void Resolve() { } + public void Resolve(System.Data.Linq.RefreshMode refreshMode) { } + public void Resolve(System.Data.Linq.RefreshMode refreshMode, bool autoResolveDeletes) { } + } + public enum RefreshMode + { + KeepChanges = 1, + KeepCurrentValues = 0, + OverwriteCurrentValues = 2, + } + public sealed partial class Table : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.ComponentModel.IListSource, System.Data.Linq.ITable, System.Data.Linq.ITable, System.Linq.IQueryable, System.Linq.IQueryable, System.Linq.IQueryProvider where TEntity : class + { + internal Table() { } + public System.Data.Linq.DataContext Context { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + bool System.ComponentModel.IListSource.ContainsListCollection { get { throw null; } } + System.Type System.Linq.IQueryable.ElementType { get { throw null; } } + System.Linq.Expressions.Expression System.Linq.IQueryable.Expression { get { throw null; } } + System.Linq.IQueryProvider System.Linq.IQueryable.Provider { get { throw null; } } + public void Attach(TEntity entity) { } + public void Attach(TEntity entity, bool asModified) { } + public void Attach(TEntity entity, TEntity original) { } + public void AttachAll(System.Collections.Generic.IEnumerable entities) where TSubEntity : TEntity { } + public void AttachAll(System.Collections.Generic.IEnumerable entities, bool asModified) where TSubEntity : TEntity { } + public void DeleteAllOnSubmit(System.Collections.Generic.IEnumerable entities) where TSubEntity : TEntity { } + public void DeleteOnSubmit(TEntity entity) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public System.Data.Linq.ModifiedMemberInfo[] GetModifiedMembers(TEntity entity) { throw null; } + public System.ComponentModel.IBindingList GetNewBindingList() { throw null; } + public TEntity GetOriginalEntityState(TEntity entity) { throw null; } + public void InsertAllOnSubmit(System.Collections.Generic.IEnumerable entities) where TSubEntity : TEntity { } + public void InsertOnSubmit(TEntity entity) { } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IList System.ComponentModel.IListSource.GetList() { throw null; } + void System.Data.Linq.ITable.Attach(object entity) { } + void System.Data.Linq.ITable.Attach(object entity, bool asModified) { } + void System.Data.Linq.ITable.Attach(object entity, object original) { } + void System.Data.Linq.ITable.AttachAll(System.Collections.IEnumerable entities) { } + void System.Data.Linq.ITable.AttachAll(System.Collections.IEnumerable entities, bool asModified) { } + void System.Data.Linq.ITable.DeleteAllOnSubmit(System.Collections.IEnumerable entities) { } + void System.Data.Linq.ITable.DeleteOnSubmit(object entity) { } + System.Data.Linq.ModifiedMemberInfo[] System.Data.Linq.ITable.GetModifiedMembers(object entity) { throw null; } + object System.Data.Linq.ITable.GetOriginalEntityState(object entity) { throw null; } + void System.Data.Linq.ITable.InsertAllOnSubmit(System.Collections.IEnumerable entities) { } + void System.Data.Linq.ITable.InsertOnSubmit(object entity) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining | System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]System.Linq.IQueryable System.Linq.IQueryProvider.CreateQuery(System.Linq.Expressions.Expression expression) { throw null; } + System.Linq.IQueryable System.Linq.IQueryProvider.CreateQuery(System.Linq.Expressions.Expression expression) { throw null; } + object System.Linq.IQueryProvider.Execute(System.Linq.Expressions.Expression expression) { throw null; } + TResult System.Linq.IQueryProvider.Execute(System.Linq.Expressions.Expression expression) { throw null; } + public override string ToString() { throw null; } + } +} +namespace System.Data.Linq.Mapping +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public sealed partial class AssociationAttribute : System.Data.Linq.Mapping.DataAttribute + { + public AssociationAttribute() { } + public bool DeleteOnNull { get { throw null; } set { } } + public string DeleteRule { get { throw null; } set { } } + public bool IsForeignKey { get { throw null; } set { } } + public bool IsUnique { get { throw null; } set { } } + public string OtherKey { get { throw null; } set { } } + public string ThisKey { get { throw null; } set { } } + } + public sealed partial class AttributeMappingSource : System.Data.Linq.Mapping.MappingSource + { + public AttributeMappingSource() { } + protected override System.Data.Linq.Mapping.MetaModel CreateModel(System.Type dataContextType) { throw null; } + } + public enum AutoSync + { + Always = 1, + Default = 0, + Never = 2, + OnInsert = 3, + OnUpdate = 4, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)] + public sealed partial class ColumnAttribute : System.Data.Linq.Mapping.DataAttribute + { + public ColumnAttribute() { } + public System.Data.Linq.Mapping.AutoSync AutoSync { get { throw null; } set { } } + public bool CanBeNull { get { throw null; } set { } } + public string DbType { get { throw null; } set { } } + public string Expression { get { throw null; } set { } } + public bool IsDbGenerated { get { throw null; } set { } } + public bool IsDiscriminator { get { throw null; } set { } } + public bool IsPrimaryKey { get { throw null; } set { } } + public bool IsVersion { get { throw null; } set { } } + public System.Data.Linq.Mapping.UpdateCheck UpdateCheck { get { throw null; } set { } } + } + public abstract partial class DataAttribute : System.Attribute + { + protected DataAttribute() { } + public string Name { get { throw null; } set { } } + public string Storage { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class DatabaseAttribute : System.Attribute + { + public DatabaseAttribute() { } + public string Name { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false)] + public sealed partial class FunctionAttribute : System.Attribute + { + public FunctionAttribute() { } + public bool IsComposable { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=true, Inherited=false)] + public sealed partial class InheritanceMappingAttribute : System.Attribute + { + public InheritanceMappingAttribute() { } + public object Code { get { throw null; } set { } } + public bool IsDefault { get { throw null; } set { } } + public System.Type Type { get { throw null; } set { } } + } + public abstract partial class MappingSource + { + protected MappingSource() { } + protected abstract System.Data.Linq.Mapping.MetaModel CreateModel(System.Type dataContextType); + public System.Data.Linq.Mapping.MetaModel GetModel(System.Type dataContextType) { throw null; } + } + public abstract partial class MetaAccessor + { + protected MetaAccessor() { } + public abstract System.Type Type { get; } + public abstract object GetBoxedValue(object instance); + public virtual bool HasAssignedValue(object instance) { throw null; } + public virtual bool HasLoadedValue(object instance) { throw null; } + public virtual bool HasValue(object instance) { throw null; } + public abstract void SetBoxedValue(ref object instance, object value); + } + public abstract partial class MetaAccessor : System.Data.Linq.Mapping.MetaAccessor + { + protected MetaAccessor() { } + public override System.Type Type { get { throw null; } } + public override object GetBoxedValue(object instance) { throw null; } + public abstract TMember GetValue(TEntity instance); + public override void SetBoxedValue(ref object instance, object value) { } + public abstract void SetValue(ref TEntity instance, TMember value); + } + public abstract partial class MetaAssociation + { + protected MetaAssociation() { } + public abstract bool DeleteOnNull { get; } + public abstract string DeleteRule { get; } + public abstract bool IsForeignKey { get; } + public abstract bool IsMany { get; } + public abstract bool IsNullable { get; } + public abstract bool IsUnique { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection OtherKey { get; } + public abstract bool OtherKeyIsPrimaryKey { get; } + public abstract System.Data.Linq.Mapping.MetaDataMember OtherMember { get; } + public abstract System.Data.Linq.Mapping.MetaType OtherType { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection ThisKey { get; } + public abstract bool ThisKeyIsPrimaryKey { get; } + public abstract System.Data.Linq.Mapping.MetaDataMember ThisMember { get; } + } + public abstract partial class MetaDataMember + { + protected MetaDataMember() { } + public abstract System.Data.Linq.Mapping.MetaAssociation Association { get; } + public abstract System.Data.Linq.Mapping.AutoSync AutoSync { get; } + public abstract bool CanBeNull { get; } + public abstract string DbType { get; } + public abstract System.Data.Linq.Mapping.MetaType DeclaringType { get; } + public abstract System.Data.Linq.Mapping.MetaAccessor DeferredSourceAccessor { get; } + public abstract System.Data.Linq.Mapping.MetaAccessor DeferredValueAccessor { get; } + public abstract string Expression { get; } + public abstract bool IsAssociation { get; } + public abstract bool IsDbGenerated { get; } + public abstract bool IsDeferred { get; } + public abstract bool IsDiscriminator { get; } + public abstract bool IsPersistent { get; } + public abstract bool IsPrimaryKey { get; } + public abstract bool IsVersion { get; } + public abstract System.Reflection.MethodInfo LoadMethod { get; } + public abstract string MappedName { get; } + public abstract System.Reflection.MemberInfo Member { get; } + public abstract System.Data.Linq.Mapping.MetaAccessor MemberAccessor { get; } + public abstract string Name { get; } + public abstract int Ordinal { get; } + public abstract System.Data.Linq.Mapping.MetaAccessor StorageAccessor { get; } + public abstract System.Reflection.MemberInfo StorageMember { get; } + public abstract System.Type Type { get; } + public abstract System.Data.Linq.Mapping.UpdateCheck UpdateCheck { get; } + public abstract bool IsDeclaredBy(System.Data.Linq.Mapping.MetaType type); + } + public abstract partial class MetaFunction + { + protected MetaFunction() { } + public abstract bool HasMultipleResults { get; } + public abstract bool IsComposable { get; } + public abstract string MappedName { get; } + public abstract System.Reflection.MethodInfo Method { get; } + public abstract System.Data.Linq.Mapping.MetaModel Model { get; } + public abstract string Name { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection Parameters { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection ResultRowTypes { get; } + public abstract System.Data.Linq.Mapping.MetaParameter ReturnParameter { get; } + } + public abstract partial class MetaModel + { + protected MetaModel() { } + public abstract System.Type ContextType { get; } + public abstract string DatabaseName { get; } + public abstract System.Data.Linq.Mapping.MappingSource MappingSource { get; } + public abstract System.Type ProviderType { get; } + public abstract System.Data.Linq.Mapping.MetaFunction GetFunction(System.Reflection.MethodInfo method); + public abstract System.Collections.Generic.IEnumerable GetFunctions(); + public abstract System.Data.Linq.Mapping.MetaType GetMetaType(System.Type type); + public abstract System.Data.Linq.Mapping.MetaTable GetTable(System.Type rowType); + public abstract System.Collections.Generic.IEnumerable GetTables(); + } + public abstract partial class MetaParameter + { + protected MetaParameter() { } + public abstract string DbType { get; } + public abstract string MappedName { get; } + public abstract string Name { get; } + public abstract System.Reflection.ParameterInfo Parameter { get; } + public abstract System.Type ParameterType { get; } + } + public abstract partial class MetaTable + { + protected MetaTable() { } + public abstract System.Reflection.MethodInfo DeleteMethod { get; } + public abstract System.Reflection.MethodInfo InsertMethod { get; } + public abstract System.Data.Linq.Mapping.MetaModel Model { get; } + public abstract System.Data.Linq.Mapping.MetaType RowType { get; } + public abstract string TableName { get; } + public abstract System.Reflection.MethodInfo UpdateMethod { get; } + } + public abstract partial class MetaType + { + protected MetaType() { } + public abstract System.Collections.ObjectModel.ReadOnlyCollection Associations { get; } + public abstract bool CanInstantiate { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection DataMembers { get; } + public abstract System.Data.Linq.Mapping.MetaDataMember DBGeneratedIdentityMember { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection DerivedTypes { get; } + public abstract System.Data.Linq.Mapping.MetaDataMember Discriminator { get; } + public abstract bool HasAnyLoadMethod { get; } + public abstract bool HasAnyValidateMethod { get; } + public abstract bool HasInheritance { get; } + public abstract bool HasInheritanceCode { get; } + public abstract bool HasUpdateCheck { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection IdentityMembers { get; } + public abstract System.Data.Linq.Mapping.MetaType InheritanceBase { get; } + public abstract object InheritanceCode { get; } + public abstract System.Data.Linq.Mapping.MetaType InheritanceDefault { get; } + public abstract System.Data.Linq.Mapping.MetaType InheritanceRoot { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection InheritanceTypes { get; } + public abstract bool IsEntity { get; } + public abstract bool IsInheritanceDefault { get; } + public abstract System.Data.Linq.Mapping.MetaModel Model { get; } + public abstract string Name { get; } + public abstract System.Reflection.MethodInfo OnLoadedMethod { get; } + public abstract System.Reflection.MethodInfo OnValidateMethod { get; } + public abstract System.Collections.ObjectModel.ReadOnlyCollection PersistentDataMembers { get; } + public abstract System.Data.Linq.Mapping.MetaTable Table { get; } + public abstract System.Type Type { get; } + public abstract System.Data.Linq.Mapping.MetaDataMember VersionMember { get; } + public abstract System.Data.Linq.Mapping.MetaDataMember GetDataMember(System.Reflection.MemberInfo member); + public abstract System.Data.Linq.Mapping.MetaType GetInheritanceType(System.Type type); + public abstract System.Data.Linq.Mapping.MetaType GetTypeForInheritanceCode(object code); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(10240), AllowMultiple=false)] + public sealed partial class ParameterAttribute : System.Attribute + { + public ParameterAttribute() { } + public string DbType { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class ProviderAttribute : System.Attribute + { + public ProviderAttribute() { } + public ProviderAttribute(System.Type type) { } + public System.Type Type { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=true)] + public sealed partial class ResultTypeAttribute : System.Attribute + { + public ResultTypeAttribute(System.Type type) { } + public System.Type Type { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)] + public sealed partial class TableAttribute : System.Attribute + { + public TableAttribute() { } + public string Name { get { throw null; } set { } } + } + public enum UpdateCheck + { + Always = 0, + Never = 1, + WhenChanged = 2, + } + public sealed partial class XmlMappingSource : System.Data.Linq.Mapping.MappingSource + { + internal XmlMappingSource() { } + protected override System.Data.Linq.Mapping.MetaModel CreateModel(System.Type dataContextType) { throw null; } + public static System.Data.Linq.Mapping.XmlMappingSource FromReader(System.Xml.XmlReader reader) { throw null; } + public static System.Data.Linq.Mapping.XmlMappingSource FromStream(System.IO.Stream stream) { throw null; } + public static System.Data.Linq.Mapping.XmlMappingSource FromUrl(string url) { throw null; } + public static System.Data.Linq.Mapping.XmlMappingSource FromXml(string xml) { throw null; } + } +} +namespace System.Data.Linq.SqlClient +{ + public sealed partial class Sql2000Provider : System.Data.Linq.SqlClient.SqlProvider + { + public Sql2000Provider() { } + } + public sealed partial class Sql2005Provider : System.Data.Linq.SqlClient.SqlProvider + { + public Sql2005Provider() { } + } + public sealed partial class Sql2008Provider : System.Data.Linq.SqlClient.SqlProvider + { + public Sql2008Provider() { } + } + public static partial class SqlHelpers + { + public static string GetStringContainsPattern(string text, char escape) { throw null; } + public static string GetStringEndsWithPattern(string text, char escape) { throw null; } + public static string GetStringStartsWithPattern(string text, char escape) { throw null; } + public static string TranslateVBLikePattern(string pattern, char escape) { throw null; } + } + public static partial class SqlMethods + { + public static int DateDiffDay(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffDay(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffDay(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffDay(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffHour(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffHour(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffHour(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffHour(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffMicrosecond(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffMicrosecond(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffMicrosecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffMicrosecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffMillisecond(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffMillisecond(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffMillisecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffMillisecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffMinute(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffMinute(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffMinute(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffMinute(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffMonth(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffMonth(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffMonth(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffMonth(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffNanosecond(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffNanosecond(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffNanosecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffNanosecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffSecond(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffSecond(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffSecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffSecond(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static int DateDiffYear(System.DateTime startDate, System.DateTime endDate) { throw null; } + public static int DateDiffYear(System.DateTimeOffset startDate, System.DateTimeOffset endDate) { throw null; } + public static System.Nullable DateDiffYear(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static System.Nullable DateDiffYear(System.Nullable startDate, System.Nullable endDate) { throw null; } + public static bool Like(string matchExpression, string pattern) { throw null; } + public static bool Like(string matchExpression, string pattern, char escapeCharacter) { throw null; } + } + public partial class SqlProvider : System.IDisposable + { + public SqlProvider() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + } +} +namespace System.Data.Linq.SqlClient.Implementation +{ + public abstract partial class ObjectMaterializer where TDataReader : System.Data.Common.DbDataReader + { + public object[] Arguments; + public System.Data.Common.DbDataReader BufferReader; + public TDataReader DataReader; + public object[] Globals; + public object[] Locals; + public int[] Ordinals; + public ObjectMaterializer() { } + public abstract bool CanDeferLoad { get; } + public static System.Collections.Generic.IEnumerable Convert(System.Collections.IEnumerable source) { throw null; } + public static System.Linq.IGrouping CreateGroup(TKey key, System.Collections.Generic.IEnumerable items) { throw null; } + public static System.Linq.IOrderedEnumerable CreateOrderedEnumerable(System.Collections.Generic.IEnumerable items) { throw null; } + public static System.Exception ErrorAssignmentToNull(System.Type type) { throw null; } + public abstract System.Collections.IEnumerable ExecuteSubQuery(int iSubQuery, object[] args); + public abstract System.Collections.Generic.IEnumerable GetLinkSource(int globalLink, int localFactory, object[] keyValues); + public abstract System.Collections.Generic.IEnumerable GetNestedLinkSource(int globalLink, int localFactory, object instance); + public abstract object InsertLookup(int globalMetaType, object instance); + public abstract bool Read(); + public abstract void SendEntityMaterialized(int globalMetaType, object instance); + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.OracleClient.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Data.OracleClient.cs new file mode 100644 index 0000000000..0c2b211936 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.OracleClient.cs @@ -0,0 +1,875 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.OracleClient.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.OracleClient.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.OracleClient.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Data.OracleClient +{ + public sealed partial class OracleBFile : System.IO.Stream, System.Data.SqlTypes.INullable, System.ICloneable, System.IDisposable + { + internal OracleBFile() { } + public static readonly new System.Data.OracleClient.OracleBFile Null; + public override bool CanRead { get { throw null; } } + public override bool CanSeek { get { throw null; } } + public override bool CanWrite { get { throw null; } } + public System.Data.OracleClient.OracleConnection Connection { get { throw null; } } + public string DirectoryName { get { throw null; } } + public bool FileExists { get { throw null; } } + public string FileName { get { throw null; } } + public bool IsNull { get { throw null; } } + public override long Length { get { throw null; } } + public override long Position { get { throw null; } set { } } + public object Value { get { throw null; } } + public object Clone() { throw null; } + public long CopyTo(System.Data.OracleClient.OracleLob destination) { throw null; } + public long CopyTo(System.Data.OracleClient.OracleLob destination, long destinationOffset) { throw null; } + public long CopyTo(long sourceOffset, System.Data.OracleClient.OracleLob destination, long destinationOffset, long amount) { throw null; } + protected override void Dispose(bool disposing) { } + public override void Flush() { } + public override int Read(byte[] buffer, int offset, int count) { throw null; } + public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; } + public void SetFileName(string directory, string file) { } + public override void SetLength(long value) { } + public override void Write(byte[] buffer, int offset, int count) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct OracleBinary : System.Data.SqlTypes.INullable, System.IComparable + { + public static readonly System.Data.OracleClient.OracleBinary Null; + public OracleBinary(byte[] b) { throw null;} + public bool IsNull { get { throw null; } } + public byte this[int index] { get { throw null; } } + public int Length { get { throw null; } } + public byte[] Value { get { throw null; } } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleBinary Concat(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public override bool Equals(object value) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThan(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThanOrEqual(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThan(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThanOrEqual(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBinary operator +(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static explicit operator byte[] (System.Data.OracleClient.OracleBinary x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >=(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static implicit operator System.Data.OracleClient.OracleBinary (byte[] b) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <=(System.Data.OracleClient.OracleBinary x, System.Data.OracleClient.OracleBinary y) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct OracleBoolean : System.IComparable + { + public static readonly System.Data.OracleClient.OracleBoolean False; + public static readonly System.Data.OracleClient.OracleBoolean Null; + public static readonly System.Data.OracleClient.OracleBoolean One; + public static readonly System.Data.OracleClient.OracleBoolean True; + public static readonly System.Data.OracleClient.OracleBoolean Zero; + public OracleBoolean(bool value) { throw null;} + public OracleBoolean(int value) { throw null;} + public bool IsFalse { get { throw null; } } + public bool IsNull { get { throw null; } } + public bool IsTrue { get { throw null; } } + public bool Value { get { throw null; } } + public static System.Data.OracleClient.OracleBoolean And(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public override bool Equals(object value) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static System.Data.OracleClient.OracleBoolean OnesComplement(System.Data.OracleClient.OracleBoolean x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator &(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator |(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ^(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static explicit operator bool (System.Data.OracleClient.OracleBoolean x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleBoolean (System.Data.OracleClient.OracleNumber x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleBoolean (string x) { throw null; } + public static bool operator false(System.Data.OracleClient.OracleBoolean x) { throw null; } + public static implicit operator System.Data.OracleClient.OracleBoolean (bool x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !(System.Data.OracleClient.OracleBoolean x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ~(System.Data.OracleClient.OracleBoolean x) { throw null; } + public static bool operator true(System.Data.OracleClient.OracleBoolean x) { throw null; } + public static System.Data.OracleClient.OracleBoolean Or(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + public static System.Data.OracleClient.OracleBoolean Parse(string s) { throw null; } + public override string ToString() { throw null; } + public static System.Data.OracleClient.OracleBoolean Xor(System.Data.OracleClient.OracleBoolean x, System.Data.OracleClient.OracleBoolean y) { throw null; } + } + [System.ObsoleteAttribute("OracleClientFactory has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + public sealed partial class OracleClientFactory : System.Data.Common.DbProviderFactory + { + internal OracleClientFactory() { } + public static readonly System.Data.OracleClient.OracleClientFactory Instance; + public override System.Data.Common.DbCommand CreateCommand() { throw null; } + public override System.Data.Common.DbCommandBuilder CreateCommandBuilder() { throw null; } + public override System.Data.Common.DbConnection CreateConnection() { throw null; } + public override System.Data.Common.DbConnectionStringBuilder CreateConnectionStringBuilder() { throw null; } + public override System.Data.Common.DbDataAdapter CreateDataAdapter() { throw null; } + public override System.Data.Common.DbParameter CreateParameter() { throw null; } + public override System.Security.CodeAccessPermission CreatePermission(System.Security.Permissions.PermissionState state) { throw null; } + } + [System.ComponentModel.DefaultEventAttribute("RecordsAffected")] + [System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.Data.VS.OracleCommandDesigner, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.ToolboxItemAttribute(true)] + [System.ObsoleteAttribute("OracleCommand has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + public sealed partial class OracleCommand : System.Data.Common.DbCommand, System.ICloneable + { + public OracleCommand() { } + public OracleCommand(string commandText) { } + public OracleCommand(string commandText, System.Data.OracleClient.OracleConnection connection) { } + public OracleCommand(string commandText, System.Data.OracleClient.OracleConnection connection, System.Data.OracleClient.OracleTransaction tx) { } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Oracle.Design.OracleCommandTextEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public override string CommandText { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override int CommandTimeout { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Data.CommandType)(1))] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public override System.Data.CommandType CommandType { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public new System.Data.OracleClient.OracleConnection Connection { get { throw null; } set { } } + protected override System.Data.Common.DbConnection DbConnection { get { throw null; } set { } } + protected override System.Data.Common.DbParameterCollection DbParameterCollection { get { throw null; } } + protected override System.Data.Common.DbTransaction DbTransaction { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(true)] + [System.ComponentModel.DesignOnlyAttribute(true)] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override bool DesignTimeVisible { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(2))] + public new System.Data.OracleClient.OracleParameterCollection Parameters { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public new System.Data.OracleClient.OracleTransaction Transaction { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Data.UpdateRowSource)(3))] + public override System.Data.UpdateRowSource UpdatedRowSource { get { throw null; } set { } } + public override void Cancel() { } + public object Clone() { throw null; } + protected override System.Data.Common.DbParameter CreateDbParameter() { throw null; } + public new System.Data.OracleClient.OracleParameter CreateParameter() { throw null; } + protected override System.Data.Common.DbDataReader ExecuteDbDataReader(System.Data.CommandBehavior behavior) { throw null; } + public override int ExecuteNonQuery() { throw null; } + public int ExecuteOracleNonQuery(out System.Data.OracleClient.OracleString rowid) { rowid = default(System.Data.OracleClient.OracleString); throw null; } + public object ExecuteOracleScalar() { throw null; } + public new System.Data.OracleClient.OracleDataReader ExecuteReader() { throw null; } + public new System.Data.OracleClient.OracleDataReader ExecuteReader(System.Data.CommandBehavior behavior) { throw null; } + public override object ExecuteScalar() { throw null; } + public override void Prepare() { } + public void ResetCommandTimeout() { } + } + [System.ObsoleteAttribute("OracleCommandBuilder has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + public sealed partial class OracleCommandBuilder : System.Data.Common.DbCommandBuilder + { + public OracleCommandBuilder() { } + public OracleCommandBuilder(System.Data.OracleClient.OracleDataAdapter adapter) { } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override System.Data.Common.CatalogLocation CatalogLocation { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override string CatalogSeparator { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + public new System.Data.OracleClient.OracleDataAdapter DataAdapter { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override string SchemaSeparator { get { throw null; } set { } } + protected override void ApplyParameterInfo(System.Data.Common.DbParameter parameter, System.Data.DataRow datarow, System.Data.StatementType statementType, bool whereClause) { } + public static void DeriveParameters(System.Data.OracleClient.OracleCommand command) { } + public new System.Data.OracleClient.OracleCommand GetDeleteCommand() { throw null; } + public new System.Data.OracleClient.OracleCommand GetDeleteCommand(bool useColumnsForParameterNames) { throw null; } + public new System.Data.OracleClient.OracleCommand GetInsertCommand() { throw null; } + public new System.Data.OracleClient.OracleCommand GetInsertCommand(bool useColumnsForParameterNames) { throw null; } + protected override string GetParameterName(int parameterOrdinal) { throw null; } + protected override string GetParameterName(string parameterName) { throw null; } + protected override string GetParameterPlaceholder(int parameterOrdinal) { throw null; } + public new System.Data.OracleClient.OracleCommand GetUpdateCommand() { throw null; } + public new System.Data.OracleClient.OracleCommand GetUpdateCommand(bool useColumnsForParameterNames) { throw null; } + public override string QuoteIdentifier(string unquotedIdentifier) { throw null; } + protected override void SetRowUpdatingHandler(System.Data.Common.DbDataAdapter adapter) { } + public override string UnquoteIdentifier(string quotedIdentifier) { throw null; } + } + [System.ComponentModel.DefaultEventAttribute("InfoMessage")] + [System.ObsoleteAttribute("OracleConnection has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + public sealed partial class OracleConnection : System.Data.Common.DbConnection, System.ICloneable + { + public OracleConnection() { } + public OracleConnection(string connectionString) { } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Oracle.Design.OracleConnectionStringEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.RecommendedAsConfigurableAttribute(true)] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + [System.ComponentModel.SettingsBindableAttribute(true)] + public override string ConnectionString { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override int ConnectionTimeout { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override string Database { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public override string DataSource { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public override string ServerVersion { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public override System.Data.ConnectionState State { get { throw null; } } + public event System.Data.OracleClient.OracleInfoMessageEventHandler InfoMessage { add { } remove { } } + protected override System.Data.Common.DbTransaction BeginDbTransaction(System.Data.IsolationLevel isolationLevel) { throw null; } + public new System.Data.OracleClient.OracleTransaction BeginTransaction() { throw null; } + public new System.Data.OracleClient.OracleTransaction BeginTransaction(System.Data.IsolationLevel il) { throw null; } + public override void ChangeDatabase(string value) { } + public static void ClearAllPools() { } + public static void ClearPool(System.Data.OracleClient.OracleConnection connection) { } + public override void Close() { } + public new System.Data.OracleClient.OracleCommand CreateCommand() { throw null; } + protected override System.Data.Common.DbCommand CreateDbCommand() { throw null; } + protected override void Dispose(bool disposing) { } + public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction distributedTransaction) { } + public override void EnlistTransaction(System.Transactions.Transaction transaction) { } + public override System.Data.DataTable GetSchema() { throw null; } + public override System.Data.DataTable GetSchema(string collectionName) { throw null; } + public override System.Data.DataTable GetSchema(string collectionName, string[] restrictionValues) { throw null; } + public override void Open() { } + object System.ICloneable.Clone() { throw null; } + } + [System.ComponentModel.DefaultPropertyAttribute("DataSource")] + [System.ComponentModel.TypeConverterAttribute("System.Data.OracleClient.OracleConnectionStringBuilder.OracleConnectionStringBuilderConverter")] + [System.ObsoleteAttribute("OracleConnectionStringBuilder has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + public sealed partial class OracleConnectionStringBuilder : System.Data.Common.DbConnectionStringBuilder + { + public OracleConnectionStringBuilder() { } + public OracleConnectionStringBuilder(string connectionString) { } + [System.ComponentModel.DisplayNameAttribute("Data Source")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string DataSource { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Enlist")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public bool Enlist { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Integrated Security")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public bool IntegratedSecurity { get { throw null; } set { } } + public override bool IsFixedSize { get { throw null; } } + public override object this[string keyword] { get { throw null; } set { } } + public override System.Collections.ICollection Keys { get { throw null; } } + [System.ComponentModel.DisplayNameAttribute("Load Balance Timeout")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public int LoadBalanceTimeout { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Max Pool Size")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public int MaxPoolSize { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Min Pool Size")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public int MinPoolSize { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Omit Oracle Connection Name")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public bool OmitOracleConnectionName { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Password")] + [System.ComponentModel.PasswordPropertyTextAttribute(true)] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string Password { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Persist Security Info")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public bool PersistSecurityInfo { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Pooling")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public bool Pooling { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("Unicode")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public bool Unicode { get { throw null; } set { } } + [System.ComponentModel.DisplayNameAttribute("User ID")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string UserID { get { throw null; } set { } } + public override System.Collections.ICollection Values { get { throw null; } } + public override void Clear() { } + public override bool ContainsKey(string keyword) { throw null; } + protected override void GetProperties(System.Collections.Hashtable propertyDescriptors) { } + public override bool Remove(string keyword) { throw null; } + public override bool ShouldSerialize(string keyword) { throw null; } + public override bool TryGetValue(string keyword, out object value) { value = default(object); throw null; } + } + [System.ComponentModel.DefaultEventAttribute("RowUpdated")] + [System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.Data.VS.OracleDataAdapterDesigner, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.ToolboxItemAttribute("Microsoft.VSDesigner.Data.VS.OracleDataAdapterToolboxItem, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ObsoleteAttribute("OracleDataAdapter has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + public sealed partial class OracleDataAdapter : System.Data.Common.DbDataAdapter, System.Data.IDataAdapter, System.Data.IDbDataAdapter, System.ICloneable + { + public OracleDataAdapter() { } + public OracleDataAdapter(System.Data.OracleClient.OracleCommand selectCommand) { } + public OracleDataAdapter(string selectCommandText, System.Data.OracleClient.OracleConnection selectConnection) { } + public OracleDataAdapter(string selectCommandText, string selectConnectionString) { } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public new System.Data.OracleClient.OracleCommand DeleteCommand { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public new System.Data.OracleClient.OracleCommand InsertCommand { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public new System.Data.OracleClient.OracleCommand SelectCommand { get { throw null; } set { } } + System.Data.IDbCommand System.Data.IDbDataAdapter.DeleteCommand { get { throw null; } set { } } + System.Data.IDbCommand System.Data.IDbDataAdapter.InsertCommand { get { throw null; } set { } } + System.Data.IDbCommand System.Data.IDbDataAdapter.SelectCommand { get { throw null; } set { } } + System.Data.IDbCommand System.Data.IDbDataAdapter.UpdateCommand { get { throw null; } set { } } + public override int UpdateBatchSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public new System.Data.OracleClient.OracleCommand UpdateCommand { get { throw null; } set { } } + public event System.Data.OracleClient.OracleRowUpdatedEventHandler RowUpdated { add { } remove { } } + public event System.Data.OracleClient.OracleRowUpdatingEventHandler RowUpdating { add { } remove { } } + protected override int AddToBatch(System.Data.IDbCommand command) { throw null; } + protected override void ClearBatch() { } + protected override System.Data.Common.RowUpdatedEventArgs CreateRowUpdatedEvent(System.Data.DataRow dataRow, System.Data.IDbCommand command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) { throw null; } + protected override System.Data.Common.RowUpdatingEventArgs CreateRowUpdatingEvent(System.Data.DataRow dataRow, System.Data.IDbCommand command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) { throw null; } + protected override int ExecuteBatch() { throw null; } + protected override System.Data.IDataParameter GetBatchedParameter(int commandIdentifier, int parameterIndex) { throw null; } + protected override bool GetBatchedRecordsAffected(int commandIdentifier, out int recordsAffected, out System.Exception error) { recordsAffected = default(int); error = default(System.Exception); throw null; } + protected override void InitializeBatching() { } + protected override void OnRowUpdated(System.Data.Common.RowUpdatedEventArgs value) { } + protected override void OnRowUpdating(System.Data.Common.RowUpdatingEventArgs value) { } + object System.ICloneable.Clone() { throw null; } + protected override void TerminateBatching() { } + } + public sealed partial class OracleDataReader : System.Data.Common.DbDataReader + { + internal OracleDataReader() { } + public override int Depth { get { throw null; } } + public override int FieldCount { get { throw null; } } + public override bool HasRows { get { throw null; } } + public override bool IsClosed { get { throw null; } } + public override object this[int i] { get { throw null; } } + public override object this[string name] { get { throw null; } } + public override int RecordsAffected { get { throw null; } } + public override void Close() { } + public override bool GetBoolean(int i) { throw null; } + public override byte GetByte(int i) { throw null; } + public override long GetBytes(int i, long fieldOffset, byte[] buffer2, int bufferoffset, int length) { throw null; } + public override char GetChar(int i) { throw null; } + public override long GetChars(int i, long fieldOffset, char[] buffer2, int bufferoffset, int length) { throw null; } + public override string GetDataTypeName(int i) { throw null; } + public override System.DateTime GetDateTime(int i) { throw null; } + public override decimal GetDecimal(int i) { throw null; } + public override double GetDouble(int i) { throw null; } + public override System.Collections.IEnumerator GetEnumerator() { throw null; } + public override System.Type GetFieldType(int i) { throw null; } + public override float GetFloat(int i) { throw null; } + public override System.Guid GetGuid(int i) { throw null; } + public override short GetInt16(int i) { throw null; } + public override int GetInt32(int i) { throw null; } + public override long GetInt64(int i) { throw null; } + public override string GetName(int i) { throw null; } + public System.Data.OracleClient.OracleBFile GetOracleBFile(int i) { throw null; } + public System.Data.OracleClient.OracleBinary GetOracleBinary(int i) { throw null; } + public System.Data.OracleClient.OracleDateTime GetOracleDateTime(int i) { throw null; } + public System.Data.OracleClient.OracleLob GetOracleLob(int i) { throw null; } + public System.Data.OracleClient.OracleMonthSpan GetOracleMonthSpan(int i) { throw null; } + public System.Data.OracleClient.OracleNumber GetOracleNumber(int i) { throw null; } + public System.Data.OracleClient.OracleString GetOracleString(int i) { throw null; } + public System.Data.OracleClient.OracleTimeSpan GetOracleTimeSpan(int i) { throw null; } + public object GetOracleValue(int i) { throw null; } + public int GetOracleValues(object[] values) { throw null; } + public override int GetOrdinal(string name) { throw null; } + public override System.Type GetProviderSpecificFieldType(int i) { throw null; } + public override object GetProviderSpecificValue(int i) { throw null; } + public override int GetProviderSpecificValues(object[] values) { throw null; } + public override System.Data.DataTable GetSchemaTable() { throw null; } + public override string GetString(int i) { throw null; } + public System.TimeSpan GetTimeSpan(int i) { throw null; } + public override object GetValue(int i) { throw null; } + public override int GetValues(object[] values) { throw null; } + public override bool IsDBNull(int i) { throw null; } + public override bool NextResult() { throw null; } + public override bool Read() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1)] + public partial struct OracleDateTime : System.Data.SqlTypes.INullable, System.IComparable + { + public static readonly System.Data.OracleClient.OracleDateTime MaxValue; + public static readonly System.Data.OracleClient.OracleDateTime MinValue; + public static readonly System.Data.OracleClient.OracleDateTime Null; + public OracleDateTime(System.Data.OracleClient.OracleDateTime from) { throw null;} + public OracleDateTime(System.DateTime dt) { throw null;} + public OracleDateTime(int year, int month, int day) { throw null;} + public OracleDateTime(int year, int month, int day, System.Globalization.Calendar calendar) { throw null;} + public OracleDateTime(int year, int month, int day, int hour, int minute, int second) { throw null;} + public OracleDateTime(int year, int month, int day, int hour, int minute, int second, System.Globalization.Calendar calendar) { throw null;} + public OracleDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null;} + public OracleDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar) { throw null;} + public OracleDateTime(long ticks) { throw null;} + public int Day { get { throw null; } } + public int Hour { get { throw null; } } + public bool IsNull { get { throw null; } } + public int Millisecond { get { throw null; } } + public int Minute { get { throw null; } } + public int Month { get { throw null; } } + public int Second { get { throw null; } } + public System.DateTime Value { get { throw null; } } + public int Year { get { throw null; } } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public override bool Equals(object value) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThan(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThanOrEqual(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThan(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThanOrEqual(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static explicit operator System.DateTime (System.Data.OracleClient.OracleDateTime x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleDateTime (string x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >=(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <=(System.Data.OracleClient.OracleDateTime x, System.Data.OracleClient.OracleDateTime y) { throw null; } + public static System.Data.OracleClient.OracleDateTime Parse(string s) { throw null; } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public sealed partial class OracleException : System.Data.Common.DbException + { + internal OracleException() { } + public int Code { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class OracleInfoMessageEventArgs : System.EventArgs + { + internal OracleInfoMessageEventArgs() { } + public int Code { get { throw null; } } + public string Message { get { throw null; } } + public string Source { get { throw null; } } + public override string ToString() { throw null; } + } + public delegate void OracleInfoMessageEventHandler(object sender, System.Data.OracleClient.OracleInfoMessageEventArgs e); + public sealed partial class OracleLob : System.IO.Stream, System.Data.SqlTypes.INullable, System.ICloneable, System.IDisposable + { + internal OracleLob() { } + public static readonly new System.Data.OracleClient.OracleLob Null; + public override bool CanRead { get { throw null; } } + public override bool CanSeek { get { throw null; } } + public override bool CanWrite { get { throw null; } } + public int ChunkSize { get { throw null; } } + public System.Data.OracleClient.OracleConnection Connection { get { throw null; } } + public bool IsBatched { get { throw null; } } + public bool IsNull { get { throw null; } } + public bool IsTemporary { get { throw null; } } + public override long Length { get { throw null; } } + public System.Data.OracleClient.OracleType LobType { get { throw null; } } + public override long Position { get { throw null; } set { } } + public object Value { get { throw null; } } + public void Append(System.Data.OracleClient.OracleLob source) { } + public void BeginBatch() { } + public void BeginBatch(System.Data.OracleClient.OracleLobOpenMode mode) { } + public object Clone() { throw null; } + public long CopyTo(System.Data.OracleClient.OracleLob destination) { throw null; } + public long CopyTo(System.Data.OracleClient.OracleLob destination, long destinationOffset) { throw null; } + public long CopyTo(long sourceOffset, System.Data.OracleClient.OracleLob destination, long destinationOffset, long amount) { throw null; } + protected override void Dispose(bool disposing) { } + public void EndBatch() { } + public long Erase() { throw null; } + public long Erase(long offset, long amount) { throw null; } + public override void Flush() { } + public override int Read(byte[] buffer, int offset, int count) { throw null; } + public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; } + public override void SetLength(long value) { } + public override void Write(byte[] buffer, int offset, int count) { } + public override void WriteByte(byte value) { } + } + public enum OracleLobOpenMode + { + ReadOnly = 1, + ReadWrite = 2, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1)] + public partial struct OracleMonthSpan : System.Data.SqlTypes.INullable, System.IComparable + { + public static readonly System.Data.OracleClient.OracleMonthSpan MaxValue; + public static readonly System.Data.OracleClient.OracleMonthSpan MinValue; + public static readonly System.Data.OracleClient.OracleMonthSpan Null; + public OracleMonthSpan(System.Data.OracleClient.OracleMonthSpan from) { throw null;} + public OracleMonthSpan(int months) { throw null;} + public OracleMonthSpan(int years, int months) { throw null;} + public bool IsNull { get { throw null; } } + public int Value { get { throw null; } } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public override bool Equals(object value) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThan(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThanOrEqual(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThan(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThanOrEqual(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static explicit operator int (System.Data.OracleClient.OracleMonthSpan x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleMonthSpan (string x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >=(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <=(System.Data.OracleClient.OracleMonthSpan x, System.Data.OracleClient.OracleMonthSpan y) { throw null; } + public static System.Data.OracleClient.OracleMonthSpan Parse(string s) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1)] + public partial struct OracleNumber : System.Data.SqlTypes.INullable, System.IComparable + { + public static readonly System.Data.OracleClient.OracleNumber E; + public static readonly int MaxPrecision; + public static readonly int MaxScale; + public static readonly System.Data.OracleClient.OracleNumber MaxValue; + public static readonly int MinScale; + public static readonly System.Data.OracleClient.OracleNumber MinusOne; + public static readonly System.Data.OracleClient.OracleNumber MinValue; + public static readonly System.Data.OracleClient.OracleNumber Null; + public static readonly System.Data.OracleClient.OracleNumber One; + public static readonly System.Data.OracleClient.OracleNumber PI; + public static readonly System.Data.OracleClient.OracleNumber Zero; + public OracleNumber(System.Data.OracleClient.OracleNumber from) { throw null;} + public OracleNumber(decimal decValue) { throw null;} + public OracleNumber(double dblValue) { throw null;} + public OracleNumber(int intValue) { throw null;} + public OracleNumber(long longValue) { throw null;} + public bool IsNull { get { throw null; } } + public decimal Value { get { throw null; } } + public static System.Data.OracleClient.OracleNumber Abs(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Acos(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Add(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Asin(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Atan(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Atan2(System.Data.OracleClient.OracleNumber y, System.Data.OracleClient.OracleNumber x) { throw null; } + public static System.Data.OracleClient.OracleNumber Ceiling(System.Data.OracleClient.OracleNumber n) { throw null; } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleNumber Cos(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Cosh(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Divide(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public override bool Equals(object value) { throw null; } + public static System.Data.OracleClient.OracleNumber Exp(System.Data.OracleClient.OracleNumber p) { throw null; } + public static System.Data.OracleClient.OracleNumber Floor(System.Data.OracleClient.OracleNumber n) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThan(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThanOrEqual(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThan(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThanOrEqual(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Log(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Log(System.Data.OracleClient.OracleNumber n, System.Data.OracleClient.OracleNumber newBase) { throw null; } + public static System.Data.OracleClient.OracleNumber Log(System.Data.OracleClient.OracleNumber n, int newBase) { throw null; } + public static System.Data.OracleClient.OracleNumber Log10(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Max(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Min(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Modulo(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Multiply(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Negate(System.Data.OracleClient.OracleNumber x) { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber operator +(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber operator /(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static explicit operator decimal (System.Data.OracleClient.OracleNumber x) { throw null; } + public static explicit operator double (System.Data.OracleClient.OracleNumber x) { throw null; } + public static explicit operator int (System.Data.OracleClient.OracleNumber x) { throw null; } + public static explicit operator long (System.Data.OracleClient.OracleNumber x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleNumber (decimal x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleNumber (double x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleNumber (int x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleNumber (long x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleNumber (string x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >=(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <=(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber operator %(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber operator *(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber operator -(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber operator -(System.Data.OracleClient.OracleNumber x) { throw null; } + public static System.Data.OracleClient.OracleNumber Parse(string s) { throw null; } + public static System.Data.OracleClient.OracleNumber Pow(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Pow(System.Data.OracleClient.OracleNumber x, int y) { throw null; } + public static System.Data.OracleClient.OracleNumber Round(System.Data.OracleClient.OracleNumber n, int position) { throw null; } + public static System.Data.OracleClient.OracleNumber Shift(System.Data.OracleClient.OracleNumber n, int digits) { throw null; } + public static System.Data.OracleClient.OracleNumber Sign(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Sin(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Sinh(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Sqrt(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Subtract(System.Data.OracleClient.OracleNumber x, System.Data.OracleClient.OracleNumber y) { throw null; } + public static System.Data.OracleClient.OracleNumber Tan(System.Data.OracleClient.OracleNumber n) { throw null; } + public static System.Data.OracleClient.OracleNumber Tanh(System.Data.OracleClient.OracleNumber n) { throw null; } + public override string ToString() { throw null; } + public static System.Data.OracleClient.OracleNumber Truncate(System.Data.OracleClient.OracleNumber n, int position) { throw null; } + } + [System.ComponentModel.TypeConverterAttribute("System.Data.OracleClient.OracleParameter.OracleParameterConverter")] + public sealed partial class OracleParameter : System.Data.Common.DbParameter, System.Data.IDataParameter, System.Data.IDbDataParameter, System.ICloneable + { + public OracleParameter() { } + public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType) { } + public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size) { } + public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size, System.Data.ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, System.Data.DataRowVersion srcVersion, object value) { } + public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size, System.Data.ParameterDirection direction, string sourceColumn, System.Data.DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value) { } + public OracleParameter(string name, System.Data.OracleClient.OracleType oracleType, int size, string srcColumn) { } + public OracleParameter(string name, object value) { } + public override System.Data.DbType DbType { get { throw null; } set { } } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public override System.Data.ParameterDirection Direction { get { throw null; } set { } } + public override bool IsNullable { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + public int Offset { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Data.OracleClient.OracleType)(22))] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + [System.Data.Common.DbProviderSpecificTypePropertyAttribute(true)] + public System.Data.OracleClient.OracleType OracleType { get { throw null; } set { } } + public override string ParameterName { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("Precision has been deprecated. Use the Math classes to explicitly set the precision of a decimal. http://go.microsoft.com/fwlink/?linkid=14202")] + public new byte Precision { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("Scale has been deprecated. Use the Math classes to explicitly set the scale of a decimal. http://go.microsoft.com/fwlink/?linkid=14202")] + public new byte Scale { get { throw null; } set { } } + public override int Size { get { throw null; } set { } } + public override string SourceColumn { get { throw null; } set { } } + public override bool SourceColumnNullMapping { get { throw null; } set { } } + public override System.Data.DataRowVersion SourceVersion { get { throw null; } set { } } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + [System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.StringConverter))] + public override object Value { get { throw null; } set { } } + public override void ResetDbType() { } + public void ResetOracleType() { } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + } + [System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.Data.Design.DBParametersEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.ListBindableAttribute(false)] + public sealed partial class OracleParameterCollection : System.Data.Common.DbParameterCollection + { + public OracleParameterCollection() { } + public override int Count { get { throw null; } } + public override bool IsFixedSize { get { throw null; } } + public override bool IsReadOnly { get { throw null; } } + public override bool IsSynchronized { get { throw null; } } + public new System.Data.OracleClient.OracleParameter this[int index] { get { throw null; } set { } } + public new System.Data.OracleClient.OracleParameter this[string parameterName] { get { throw null; } set { } } + public override object SyncRoot { get { throw null; } } + public System.Data.OracleClient.OracleParameter Add(System.Data.OracleClient.OracleParameter value) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override int Add(object value) { throw null; } + public System.Data.OracleClient.OracleParameter Add(string parameterName, System.Data.OracleClient.OracleType dataType) { throw null; } + public System.Data.OracleClient.OracleParameter Add(string parameterName, System.Data.OracleClient.OracleType dataType, int size) { throw null; } + public System.Data.OracleClient.OracleParameter Add(string parameterName, System.Data.OracleClient.OracleType dataType, int size, string srcColumn) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("Add(String parameterName, Object value) has been deprecated. Use AddWithValue(String parameterName, Object value). http://go.microsoft.com/fwlink/?linkid=14202", false)] + public System.Data.OracleClient.OracleParameter Add(string parameterName, object value) { throw null; } + public override void AddRange(System.Array values) { } + public void AddRange(System.Data.OracleClient.OracleParameter[] values) { } + public System.Data.OracleClient.OracleParameter AddWithValue(string parameterName, object value) { throw null; } + public override void Clear() { } + public bool Contains(System.Data.OracleClient.OracleParameter value) { throw null; } + public override bool Contains(object value) { throw null; } + public override bool Contains(string parameterName) { throw null; } + public override void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Data.OracleClient.OracleParameter[] array, int index) { } + public override System.Collections.IEnumerator GetEnumerator() { throw null; } + protected override System.Data.Common.DbParameter GetParameter(int index) { throw null; } + protected override System.Data.Common.DbParameter GetParameter(string parameterName) { throw null; } + public int IndexOf(System.Data.OracleClient.OracleParameter value) { throw null; } + public override int IndexOf(object value) { throw null; } + public override int IndexOf(string parameterName) { throw null; } + public void Insert(int index, System.Data.OracleClient.OracleParameter value) { } + public override void Insert(int index, object value) { } + public void Remove(System.Data.OracleClient.OracleParameter value) { } + public override void Remove(object value) { } + public override void RemoveAt(int index) { } + public override void RemoveAt(string parameterName) { } + protected override void SetParameter(int index, System.Data.Common.DbParameter value) { } + protected override void SetParameter(string parameterName, System.Data.Common.DbParameter value) { } + } + [System.ObsoleteAttribute("OraclePermission has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + [System.SerializableAttribute] + public sealed partial class OraclePermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public OraclePermission(System.Security.Permissions.PermissionState state) { } + public bool AllowBlankPassword { get { throw null; } set { } } + public void Add(string connectionString, string restrictions, System.Data.KeyRestrictionBehavior behavior) { } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement securityElement) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(109), AllowMultiple=true, Inherited=false)] + [System.ObsoleteAttribute("OraclePermissionAttribute has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)] + [System.SerializableAttribute] + public sealed partial class OraclePermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public OraclePermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public bool AllowBlankPassword { get { throw null; } set { } } + public string ConnectionString { get { throw null; } set { } } + public System.Data.KeyRestrictionBehavior KeyRestrictionBehavior { get { throw null; } set { } } + public string KeyRestrictions { get { throw null; } set { } } + public override System.Security.IPermission CreatePermission() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeConnectionString() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeKeyRestrictions() { throw null; } + } + public sealed partial class OracleRowUpdatedEventArgs : System.Data.Common.RowUpdatedEventArgs + { + public OracleRowUpdatedEventArgs(System.Data.DataRow row, System.Data.IDbCommand command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) : base (default(System.Data.DataRow), default(System.Data.IDbCommand), default(System.Data.StatementType), default(System.Data.Common.DataTableMapping)) { } + public new System.Data.OracleClient.OracleCommand Command { get { throw null; } } + } + public delegate void OracleRowUpdatedEventHandler(object sender, System.Data.OracleClient.OracleRowUpdatedEventArgs e); + public sealed partial class OracleRowUpdatingEventArgs : System.Data.Common.RowUpdatingEventArgs + { + public OracleRowUpdatingEventArgs(System.Data.DataRow row, System.Data.IDbCommand command, System.Data.StatementType statementType, System.Data.Common.DataTableMapping tableMapping) : base (default(System.Data.DataRow), default(System.Data.IDbCommand), default(System.Data.StatementType), default(System.Data.Common.DataTableMapping)) { } + protected override System.Data.IDbCommand BaseCommand { get { throw null; } set { } } + public new System.Data.OracleClient.OracleCommand Command { get { throw null; } set { } } + } + public delegate void OracleRowUpdatingEventHandler(object sender, System.Data.OracleClient.OracleRowUpdatingEventArgs e); + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct OracleString : System.Data.SqlTypes.INullable, System.IComparable + { + public static readonly System.Data.OracleClient.OracleString Empty; + public static readonly System.Data.OracleClient.OracleString Null; + public OracleString(string s) { throw null;} + public bool IsNull { get { throw null; } } + public char this[int index] { get { throw null; } } + public int Length { get { throw null; } } + public string Value { get { throw null; } } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleString Concat(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public override bool Equals(object value) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThan(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThanOrEqual(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThan(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThanOrEqual(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleString operator +(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static explicit operator string (System.Data.OracleClient.OracleString x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >=(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static implicit operator System.Data.OracleClient.OracleString (string s) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <=(System.Data.OracleClient.OracleString x, System.Data.OracleClient.OracleString y) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1)] + public partial struct OracleTimeSpan : System.Data.SqlTypes.INullable, System.IComparable + { + public static readonly System.Data.OracleClient.OracleTimeSpan MaxValue; + public static readonly System.Data.OracleClient.OracleTimeSpan MinValue; + public static readonly System.Data.OracleClient.OracleTimeSpan Null; + public OracleTimeSpan(System.Data.OracleClient.OracleTimeSpan from) { throw null;} + public OracleTimeSpan(int hours, int minutes, int seconds) { throw null;} + public OracleTimeSpan(int days, int hours, int minutes, int seconds) { throw null;} + public OracleTimeSpan(int days, int hours, int minutes, int seconds, int milliseconds) { throw null;} + public OracleTimeSpan(long ticks) { throw null;} + public OracleTimeSpan(System.TimeSpan ts) { throw null;} + public int Days { get { throw null; } } + public int Hours { get { throw null; } } + public bool IsNull { get { throw null; } } + public int Milliseconds { get { throw null; } } + public int Minutes { get { throw null; } } + public int Seconds { get { throw null; } } + public System.TimeSpan Value { get { throw null; } } + public int CompareTo(object obj) { throw null; } + public static System.Data.OracleClient.OracleBoolean Equals(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public override bool Equals(object value) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThan(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean GreaterThanOrEqual(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThan(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean LessThanOrEqual(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean NotEquals(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator ==(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static explicit operator System.TimeSpan (System.Data.OracleClient.OracleTimeSpan x) { throw null; } + public static explicit operator System.Data.OracleClient.OracleTimeSpan (string x) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator >=(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator !=(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleBoolean operator <=(System.Data.OracleClient.OracleTimeSpan x, System.Data.OracleClient.OracleTimeSpan y) { throw null; } + public static System.Data.OracleClient.OracleTimeSpan Parse(string s) { throw null; } + public override string ToString() { throw null; } + } + public sealed partial class OracleTransaction : System.Data.Common.DbTransaction + { + internal OracleTransaction() { } + public new System.Data.OracleClient.OracleConnection Connection { get { throw null; } } + protected override System.Data.Common.DbConnection DbConnection { get { throw null; } } + public override System.Data.IsolationLevel IsolationLevel { get { throw null; } } + public override void Commit() { } + protected override void Dispose(bool disposing) { } + public override void Rollback() { } + } + public enum OracleType + { + BFile = 1, + Blob = 2, + Byte = 23, + Char = 3, + Clob = 4, + Cursor = 5, + DateTime = 6, + Double = 30, + Float = 29, + Int16 = 27, + Int32 = 28, + IntervalDayToSecond = 7, + IntervalYearToMonth = 8, + LongRaw = 9, + LongVarChar = 10, + NChar = 11, + NClob = 12, + Number = 13, + NVarChar = 14, + Raw = 15, + RowId = 16, + SByte = 26, + Timestamp = 18, + TimestampLocal = 19, + TimestampWithTZ = 20, + UInt16 = 24, + UInt32 = 25, + VarChar = 22, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.Services.Client.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Services.Client.cs new file mode 100644 index 0000000000..5cee1dbbd3 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Services.Client.cs @@ -0,0 +1,427 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Services.Client.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Services.Client.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Services.Client.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +namespace System.Data.Services.Client +{ + public sealed partial class ChangeOperationResponse : System.Data.Services.Client.OperationResponse + { + internal ChangeOperationResponse() { } + public System.Data.Services.Client.Descriptor Descriptor { get { throw null; } } + } + [System.Diagnostics.DebuggerDisplayAttribute("{Message}")] + [System.SerializableAttribute] + public sealed partial class DataServiceClientException : System.InvalidOperationException + { + public DataServiceClientException() { } + protected DataServiceClientException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext context) { } + public DataServiceClientException(string message) { } + public DataServiceClientException(string message, System.Exception innerException) { } + public DataServiceClientException(string message, System.Exception innerException, int statusCode) { } + public DataServiceClientException(string message, int statusCode) { } + public int StatusCode { get { throw null; } } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class DataServiceCollection : System.Collections.ObjectModel.ObservableCollection + { + public DataServiceCollection() { } + public DataServiceCollection(System.Collections.Generic.IEnumerable items) { } + public DataServiceCollection(System.Collections.Generic.IEnumerable items, System.Data.Services.Client.TrackingMode trackingMode) { } + public DataServiceCollection(System.Collections.Generic.IEnumerable items, System.Data.Services.Client.TrackingMode trackingMode, string entitySetName, System.Func entityChangedCallback, System.Func collectionChangedCallback) { } + public DataServiceCollection(System.Data.Services.Client.DataServiceContext context) { } + public DataServiceCollection(System.Data.Services.Client.DataServiceContext context, System.Collections.Generic.IEnumerable items, System.Data.Services.Client.TrackingMode trackingMode, string entitySetName, System.Func entityChangedCallback, System.Func collectionChangedCallback) { } + public DataServiceCollection(System.Data.Services.Client.DataServiceContext context, string entitySetName, System.Func entityChangedCallback, System.Func collectionChangedCallback) { } + public System.Data.Services.Client.DataServiceQueryContinuation Continuation { get { throw null; } set { } } + public void Clear(bool stopTracking) { } + public void Detach() { } + protected override void InsertItem(int index, T item) { } + public void Load(System.Collections.Generic.IEnumerable items) { } + public void Load(T item) { } + } + public partial class DataServiceContext + { + public DataServiceContext(System.Uri serviceRoot) { } + public bool ApplyingChanges { get { throw null; } } + public System.Uri BaseUri { get { throw null; } } + public System.Net.ICredentials Credentials { get { throw null; } set { } } + public string DataNamespace { get { throw null; } set { } } + public System.Collections.ObjectModel.ReadOnlyCollection Entities { get { throw null; } } + public bool IgnoreMissingProperties { get { throw null; } set { } } + public bool IgnoreResourceNotFoundException { get { throw null; } set { } } + public System.Collections.ObjectModel.ReadOnlyCollection Links { get { throw null; } } + public System.Data.Services.Client.MergeOption MergeOption { get { throw null; } set { } } + public System.Func ResolveName { get { throw null; } set { } } + public System.Func ResolveType { get { throw null; } set { } } + public System.Data.Services.Client.SaveChangesOptions SaveChangesDefaultOptions { get { throw null; } set { } } + public int Timeout { get { throw null; } set { } } + public System.Uri TypeScheme { get { throw null; } set { } } + public bool UsePostTunneling { get { throw null; } set { } } + public event System.EventHandler ReadingEntity { add { } remove { } } + public event System.EventHandler SendingRequest { add { } remove { } } + public event System.EventHandler WritingEntity { add { } remove { } } + public void AddLink(object source, string sourceProperty, object target) { } + public void AddObject(string entitySetName, object entity) { } + public void AddRelatedObject(object source, string sourceProperty, object target) { } + public void AttachLink(object source, string sourceProperty, object target) { } + public void AttachTo(string entitySetName, object entity) { } + public void AttachTo(string entitySetName, object entity, string etag) { } + public System.IAsyncResult BeginExecuteBatch(System.AsyncCallback callback, object state, params System.Data.Services.Client.DataServiceRequest[] queries) { throw null; } + public System.IAsyncResult BeginExecute(System.Data.Services.Client.DataServiceQueryContinuation continuation, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginExecute(System.Uri requestUri, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginGetReadStream(object entity, System.Data.Services.Client.DataServiceRequestArgs args, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginLoadProperty(object entity, string propertyName, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginLoadProperty(object entity, string propertyName, System.Data.Services.Client.DataServiceQueryContinuation continuation, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginLoadProperty(object entity, string propertyName, System.Uri nextLinkUri, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginSaveChanges(System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginSaveChanges(System.Data.Services.Client.SaveChangesOptions options, System.AsyncCallback callback, object state) { throw null; } + public void CancelRequest(System.IAsyncResult asyncResult) { } + public System.Data.Services.Client.DataServiceQuery CreateQuery(string entitySetName) { throw null; } + public void DeleteLink(object source, string sourceProperty, object target) { } + public void DeleteObject(object entity) { } + public bool Detach(object entity) { throw null; } + public bool DetachLink(object source, string sourceProperty, object target) { throw null; } + public System.Data.Services.Client.DataServiceResponse EndExecuteBatch(System.IAsyncResult asyncResult) { throw null; } + public System.Collections.Generic.IEnumerable EndExecute(System.IAsyncResult asyncResult) { throw null; } + public System.Data.Services.Client.DataServiceStreamResponse EndGetReadStream(System.IAsyncResult asyncResult) { throw null; } + public System.Data.Services.Client.QueryOperationResponse EndLoadProperty(System.IAsyncResult asyncResult) { throw null; } + public System.Data.Services.Client.DataServiceResponse EndSaveChanges(System.IAsyncResult asyncResult) { throw null; } + public System.Data.Services.Client.DataServiceResponse ExecuteBatch(params System.Data.Services.Client.DataServiceRequest[] queries) { throw null; } + public System.Data.Services.Client.QueryOperationResponse Execute(System.Data.Services.Client.DataServiceQueryContinuation continuation) { throw null; } + public System.Collections.Generic.IEnumerable Execute(System.Uri requestUri) { throw null; } + public System.Data.Services.Client.EntityDescriptor GetEntityDescriptor(object entity) { throw null; } + public System.Data.Services.Client.LinkDescriptor GetLinkDescriptor(object source, string sourceProperty, object target) { throw null; } + public System.Uri GetMetadataUri() { throw null; } + public System.Data.Services.Client.DataServiceStreamResponse GetReadStream(object entity) { throw null; } + public System.Data.Services.Client.DataServiceStreamResponse GetReadStream(object entity, System.Data.Services.Client.DataServiceRequestArgs args) { throw null; } + public System.Data.Services.Client.DataServiceStreamResponse GetReadStream(object entity, string acceptContentType) { throw null; } + public System.Uri GetReadStreamUri(object entity) { throw null; } + public System.Data.Services.Client.QueryOperationResponse LoadProperty(object entity, string propertyName) { throw null; } + public System.Data.Services.Client.QueryOperationResponse LoadProperty(object entity, string propertyName, System.Data.Services.Client.DataServiceQueryContinuation continuation) { throw null; } + public System.Data.Services.Client.QueryOperationResponse LoadProperty(object entity, string propertyName, System.Uri nextLinkUri) { throw null; } + public System.Data.Services.Client.QueryOperationResponse LoadProperty(object entity, string propertyName, System.Data.Services.Client.DataServiceQueryContinuation continuation) { throw null; } + public System.Data.Services.Client.DataServiceResponse SaveChanges() { throw null; } + public System.Data.Services.Client.DataServiceResponse SaveChanges(System.Data.Services.Client.SaveChangesOptions options) { throw null; } + public void SetLink(object source, string sourceProperty, object target) { } + public void SetSaveStream(object entity, System.IO.Stream stream, bool closeStream, System.Data.Services.Client.DataServiceRequestArgs args) { } + public void SetSaveStream(object entity, System.IO.Stream stream, bool closeStream, string contentType, string slug) { } + public bool TryGetEntity(System.Uri identity, out TEntity entity) where TEntity : class { entity = default(TEntity); throw null; } + public bool TryGetUri(object entity, out System.Uri identity) { identity = default(System.Uri); throw null; } + public void UpdateObject(object entity) { } + } + public abstract partial class DataServiceQuery : System.Data.Services.Client.DataServiceRequest, System.Collections.IEnumerable, System.Linq.IQueryable + { + internal DataServiceQuery() { } + public abstract System.Linq.Expressions.Expression Expression { get; } + public abstract System.Linq.IQueryProvider Provider { get; } + public System.IAsyncResult BeginExecute(System.AsyncCallback callback, object state) { throw null; } + public System.Collections.IEnumerable EndExecute(System.IAsyncResult asyncResult) { throw null; } + public System.Collections.IEnumerable Execute() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("{NextLinkUri}")] + public abstract partial class DataServiceQueryContinuation + { + internal DataServiceQueryContinuation() { } + public System.Uri NextLinkUri { get { throw null; } } + public override string ToString() { throw null; } + } + public sealed partial class DataServiceQueryContinuation : System.Data.Services.Client.DataServiceQueryContinuation + { + internal DataServiceQueryContinuation() { } + } + [System.Diagnostics.DebuggerDisplayAttribute("{Message}")] + [System.SerializableAttribute] + public sealed partial class DataServiceQueryException : System.InvalidOperationException + { + public DataServiceQueryException() { } + protected DataServiceQueryException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public DataServiceQueryException(string message) { } + public DataServiceQueryException(string message, System.Exception innerException) { } + public DataServiceQueryException(string message, System.Exception innerException, System.Data.Services.Client.QueryOperationResponse response) { } + public System.Data.Services.Client.QueryOperationResponse Response { get { throw null; } } + } + public partial class DataServiceQuery : System.Data.Services.Client.DataServiceQuery, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.Linq.IQueryable, System.Linq.IQueryable + { + internal DataServiceQuery() { } + public override System.Type ElementType { get { throw null; } } + public override System.Linq.Expressions.Expression Expression { get { throw null; } } + public override System.Linq.IQueryProvider Provider { get { throw null; } } + public override System.Uri RequestUri { get { throw null; } } + public System.Data.Services.Client.DataServiceQuery AddQueryOption(string name, object value) { throw null; } + public new System.IAsyncResult BeginExecute(System.AsyncCallback callback, object state) { throw null; } + public new System.Collections.Generic.IEnumerable EndExecute(System.IAsyncResult asyncResult) { throw null; } + public new System.Collections.Generic.IEnumerable Execute() { throw null; } + public System.Data.Services.Client.DataServiceQuery Expand(string path) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public System.Data.Services.Client.DataServiceQuery IncludeTotalCount() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class DataServiceRequest + { + internal DataServiceRequest() { } + public abstract System.Type ElementType { get; } + public abstract System.Uri RequestUri { get; } + public override string ToString() { throw null; } + } + public partial class DataServiceRequestArgs + { + public DataServiceRequestArgs() { } + public string AcceptContentType { get { throw null; } set { } } + public string ContentType { get { throw null; } set { } } + public System.Collections.Generic.Dictionary Headers { get { throw null; } } + public string Slug { get { throw null; } set { } } + } + [System.Diagnostics.DebuggerDisplayAttribute("{Message}")] + [System.SerializableAttribute] + public sealed partial class DataServiceRequestException : System.InvalidOperationException + { + public DataServiceRequestException() { } + protected DataServiceRequestException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public DataServiceRequestException(string message) { } + public DataServiceRequestException(string message, System.Exception innerException) { } + public DataServiceRequestException(string message, System.Exception innerException, System.Data.Services.Client.DataServiceResponse response) { } + public System.Data.Services.Client.DataServiceResponse Response { get { throw null; } } + } + public sealed partial class DataServiceRequest : System.Data.Services.Client.DataServiceRequest + { + public DataServiceRequest(System.Uri requestUri) { } + public override System.Type ElementType { get { throw null; } } + public override System.Uri RequestUri { get { throw null; } } + } + public sealed partial class DataServiceResponse : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + internal DataServiceResponse() { } + public System.Collections.Generic.IDictionary BatchHeaders { get { throw null; } } + public int BatchStatusCode { get { throw null; } } + public bool IsBatchResponse { get { throw null; } } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public sealed partial class DataServiceStreamResponse : System.IDisposable + { + internal DataServiceStreamResponse() { } + public string ContentDisposition { get { throw null; } } + public string ContentType { get { throw null; } } + public System.Collections.Generic.Dictionary Headers { get { throw null; } } + public System.IO.Stream Stream { get { throw null; } } + public void Dispose() { } + } + public abstract partial class Descriptor + { + internal Descriptor() { } + public System.Data.Services.Client.EntityStates State { get { throw null; } } + } + public sealed partial class EntityChangedParams + { + internal EntityChangedParams() { } + public System.Data.Services.Client.DataServiceContext Context { get { throw null; } } + public object Entity { get { throw null; } } + public string PropertyName { get { throw null; } } + public object PropertyValue { get { throw null; } } + public string SourceEntitySet { get { throw null; } } + public string TargetEntitySet { get { throw null; } } + } + public sealed partial class EntityCollectionChangedParams + { + internal EntityCollectionChangedParams() { } + public System.Collections.Specialized.NotifyCollectionChangedAction Action { get { throw null; } } + public System.Collections.ICollection Collection { get { throw null; } } + public System.Data.Services.Client.DataServiceContext Context { get { throw null; } } + public string PropertyName { get { throw null; } } + public object SourceEntity { get { throw null; } } + public string SourceEntitySet { get { throw null; } } + public object TargetEntity { get { throw null; } } + public string TargetEntitySet { get { throw null; } } + } + [System.Diagnostics.DebuggerDisplayAttribute("State = {state}, Uri = {editLink}, Element = {entity.GetType().ToString()}")] + public sealed partial class EntityDescriptor : System.Data.Services.Client.Descriptor + { + internal EntityDescriptor() { } + public System.Uri EditLink { get { throw null; } } + public System.Uri EditStreamUri { get { throw null; } } + public object Entity { get { throw null; } } + public string ETag { get { throw null; } } + public string Identity { get { throw null; } } + public System.Data.Services.Client.EntityDescriptor ParentForInsert { get { throw null; } } + public string ParentPropertyForInsert { get { throw null; } } + public System.Uri ReadStreamUri { get { throw null; } } + public System.Uri SelfLink { get { throw null; } } + public string ServerTypeName { get { throw null; } } + public string StreamETag { get { throw null; } } + } + [System.FlagsAttribute] + public enum EntityStates + { + Added = 4, + Deleted = 8, + Detached = 1, + Modified = 16, + Unchanged = 2, + } + [System.Diagnostics.DebuggerDisplayAttribute("State = {state}")] + public sealed partial class LinkDescriptor : System.Data.Services.Client.Descriptor + { + internal LinkDescriptor() { } + public object Source { get { throw null; } } + public string SourceProperty { get { throw null; } } + public object Target { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class MediaEntryAttribute : System.Attribute + { + public MediaEntryAttribute(string mediaMemberName) { } + public string MediaMemberName { get { throw null; } } + } + public enum MergeOption + { + AppendOnly = 0, + NoTracking = 3, + OverwriteChanges = 1, + PreserveChanges = 2, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class MimeTypePropertyAttribute : System.Attribute + { + public MimeTypePropertyAttribute(string dataPropertyName, string mimeTypePropertyName) { } + public string DataPropertyName { get { throw null; } } + public string MimeTypePropertyName { get { throw null; } } + } + public abstract partial class OperationResponse + { + internal OperationResponse() { } + public System.Exception Error { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Headers { get { throw null; } } + public int StatusCode { get { throw null; } } + } + public partial class QueryOperationResponse : System.Data.Services.Client.OperationResponse, System.Collections.IEnumerable + { + internal QueryOperationResponse() { } + public System.Data.Services.Client.DataServiceRequest Query { get { throw null; } } + public virtual long TotalCount { get { throw null; } } + public System.Data.Services.Client.DataServiceQueryContinuation GetContinuation() { throw null; } + public System.Data.Services.Client.DataServiceQueryContinuation GetContinuation(System.Collections.IEnumerable collection) { throw null; } + public System.Data.Services.Client.DataServiceQueryContinuation GetContinuation(System.Collections.Generic.IEnumerable collection) { throw null; } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + } + public sealed partial class QueryOperationResponse : System.Data.Services.Client.QueryOperationResponse, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + internal QueryOperationResponse() { } + public override long TotalCount { get { throw null; } } + public new System.Data.Services.Client.DataServiceQueryContinuation GetContinuation() { throw null; } + public new System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + } + public sealed partial class ReadingWritingEntityEventArgs : System.EventArgs + { + internal ReadingWritingEntityEventArgs() { } + public System.Xml.Linq.XElement Data { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public object Entity { get { throw null; } } + } + [System.FlagsAttribute] + public enum SaveChangesOptions + { + Batch = 1, + ContinueOnError = 2, + None = 0, + ReplaceOnUpdate = 4, + } + public partial class SendingRequestEventArgs : System.EventArgs + { + internal SendingRequestEventArgs() { } + public System.Net.WebRequest Request { get { throw null; } set { } } + public System.Net.WebHeaderCollection RequestHeaders { get { throw null; } } + } + public enum TrackingMode + { + AutoChangeTracking = 1, + None = 0, + } +} +namespace System.Data.Services.Common +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class DataServiceEntityAttribute : System.Attribute + { + public DataServiceEntityAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class DataServiceKeyAttribute : System.Attribute + { + public DataServiceKeyAttribute(string keyName) { } + public DataServiceKeyAttribute(params string[] keyNames) { } + public System.Collections.ObjectModel.ReadOnlyCollection KeyNames { get { throw null; } } + } + public enum DataServiceProtocolVersion + { + V1 = 0, + V2 = 1, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=true, Inherited=true)] + public sealed partial class EntityPropertyMappingAttribute : System.Attribute + { + public EntityPropertyMappingAttribute(string sourcePath, System.Data.Services.Common.SyndicationItemProperty targetSyndicationItem, System.Data.Services.Common.SyndicationTextContentKind targetTextContentKind, bool keepInContent) { } + public EntityPropertyMappingAttribute(string sourcePath, string targetPath, string targetNamespacePrefix, string targetNamespaceUri, bool keepInContent) { } + public bool KeepInContent { get { throw null; } } + public string SourcePath { get { throw null; } } + public string TargetNamespacePrefix { get { throw null; } } + public string TargetNamespaceUri { get { throw null; } } + public string TargetPath { get { throw null; } } + public System.Data.Services.Common.SyndicationItemProperty TargetSyndicationItem { get { throw null; } } + public System.Data.Services.Common.SyndicationTextContentKind TargetTextContentKind { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class EntitySetAttribute : System.Attribute + { + public EntitySetAttribute(string entitySet) { } + public string EntitySet { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true, AllowMultiple=false)] + public sealed partial class HasStreamAttribute : System.Attribute + { + public HasStreamAttribute() { } + } + public enum SyndicationItemProperty + { + AuthorEmail = 1, + AuthorName = 2, + AuthorUri = 3, + ContributorEmail = 4, + ContributorName = 5, + ContributorUri = 6, + CustomProperty = 0, + Published = 8, + Rights = 9, + Summary = 10, + Title = 11, + Updated = 7, + } + public enum SyndicationTextContentKind + { + Html = 1, + Plaintext = 0, + Xhtml = 2, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.Services.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Services.cs new file mode 100644 index 0000000000..32dba1d88e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.Services.cs @@ -0,0 +1,816 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Data.Services.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Data.Services.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Data.Services.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +namespace System.Data.Services +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=true, Inherited=true)] + public sealed partial class ChangeInterceptorAttribute : System.Attribute + { + public ChangeInterceptorAttribute(string entitySetName) { } + public string EntitySetName { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + } + public sealed partial class DataServiceBehavior + { + internal DataServiceBehavior() { } + public bool AcceptCountRequests { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool AcceptProjectionRequests { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool AcceptReplaceFunctionInQuery { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool InvokeInterceptorsOnLinkDelete { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Data.Services.Common.DataServiceProtocolVersion MaxProtocolVersion { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public sealed partial class DataServiceConfiguration : System.Data.Services.IDataServiceConfiguration + { + internal DataServiceConfiguration() { } + public System.Data.Services.DataServiceBehavior DataServiceBehavior { get { throw null; } } + public bool EnableTypeConversion { get { throw null; } set { } } + public int MaxBatchCount { get { throw null; } set { } } + public int MaxChangesetCount { get { throw null; } set { } } + public int MaxExpandCount { get { throw null; } set { } } + public int MaxExpandDepth { get { throw null; } set { } } + public int MaxObjectCountOnInsert { get { throw null; } set { } } + public int MaxResultsPerCollection { get { throw null; } set { } } + public bool UseVerboseErrors { get { throw null; } set { } } + public void EnableTypeAccess(string typeName) { } + public void RegisterKnownType(System.Type type) { } + public void SetEntitySetAccessRule(string name, System.Data.Services.EntitySetRights rights) { } + public void SetEntitySetPageSize(string name, int size) { } + public void SetServiceOperationAccessRule(string name, System.Data.Services.ServiceOperationRights rights) { } + } + [System.Diagnostics.DebuggerDisplayAttribute("{statusCode}: {Message}")] + [System.SerializableAttribute] + public sealed partial class DataServiceException : System.InvalidOperationException + { + public DataServiceException() { } + public DataServiceException(int statusCode, string message) { } + public DataServiceException(int statusCode, string errorCode, string message, string messageXmlLang, System.Exception innerException) { } + protected DataServiceException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + public DataServiceException(string message) { } + public DataServiceException(string message, System.Exception innerException) { } + public string ErrorCode { get { throw null; } } + public string MessageLanguage { get { throw null; } } + public int StatusCode { get { throw null; } } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.CLSCompliantAttribute(false)] + public partial class DataServiceHost : System.ServiceModel.Web.WebServiceHost + { + public DataServiceHost(System.Type serviceType, System.Uri[] baseAddresses) { } + } + public partial class DataServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactory + { + public DataServiceHostFactory() { } + protected override System.ServiceModel.ServiceHost CreateServiceHost(System.Type serviceType, System.Uri[] baseAddresses) { throw null; } + } + public sealed partial class DataServiceOperationContext + { + internal DataServiceOperationContext() { } + public System.Uri AbsoluteRequestUri { get { throw null; } } + public System.Uri AbsoluteServiceUri { get { throw null; } } + public bool IsBatchRequest { get { throw null; } } + public System.Net.WebHeaderCollection RequestHeaders { get { throw null; } } + public string RequestMethod { get { throw null; } } + public System.Net.WebHeaderCollection ResponseHeaders { get { throw null; } } + public int ResponseStatusCode { get { throw null; } set { } } + } + public sealed partial class DataServiceProcessingPipeline + { + public DataServiceProcessingPipeline() { } + public event System.EventHandler ProcessedChangeset { add { } remove { } } + public event System.EventHandler ProcessedRequest { add { } remove { } } + public event System.EventHandler ProcessingChangeset { add { } remove { } } + public event System.EventHandler ProcessingRequest { add { } remove { } } + } + public sealed partial class DataServiceProcessingPipelineEventArgs : System.EventArgs + { + internal DataServiceProcessingPipelineEventArgs() { } + public System.Data.Services.DataServiceOperationContext OperationContext { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + } + [System.ServiceModel.Activation.AspNetCompatibilityRequirementsAttribute(RequirementsMode=(System.ServiceModel.Activation.AspNetCompatibilityRequirementsMode)(1))] + [System.ServiceModel.ServiceBehaviorAttribute(InstanceContextMode=(System.ServiceModel.InstanceContextMode)(1))] + public partial class DataService : System.Data.Services.IRequestHandler + { + public DataService() { } + protected T CurrentDataSource { get { throw null; } } + public System.Data.Services.DataServiceProcessingPipeline ProcessingPipeline { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public void AttachHost(System.Data.Services.IDataServiceHost host) { } + protected virtual T CreateDataSource() { throw null; } + protected virtual void HandleException(System.Data.Services.HandleExceptionArgs args) { } + protected virtual void OnStartProcessingRequest(System.Data.Services.ProcessRequestArgs args) { } + public void ProcessRequest() { } + public System.ServiceModel.Channels.Message ProcessRequestForMessage(System.IO.Stream messageBody) { throw null; } + } + [System.FlagsAttribute] + public enum EntitySetRights + { + All = 63, + AllRead = 3, + AllWrite = 60, + None = 0, + ReadMultiple = 2, + ReadSingle = 1, + WriteAppend = 4, + WriteDelete = 16, + WriteMerge = 32, + WriteReplace = 8, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class ETagAttribute : System.Attribute + { + public ETagAttribute(string propertyName) { } + public ETagAttribute(params string[] propertyNames) { } + public System.Collections.ObjectModel.ReadOnlyCollection PropertyNames { get { throw null; } } + } + [System.Diagnostics.DebuggerDisplayAttribute("ExpandSegment ({name},Filter={filter})]")] + public partial class ExpandSegment + { + public ExpandSegment(string name, System.Linq.Expressions.Expression filter) { } + public System.Data.Services.Providers.ResourceProperty ExpandedProperty { get { throw null; } } + public System.Linq.Expressions.Expression Filter { get { throw null; } } + public bool HasFilter { get { throw null; } } + public int MaxResultsExpected { get { throw null; } } + public string Name { get { throw null; } } + public static bool PathHasFilter(System.Collections.Generic.IEnumerable path) { throw null; } + } + public partial class ExpandSegmentCollection : System.Collections.Generic.List + { + public ExpandSegmentCollection() { } + public ExpandSegmentCollection(int capacity) { } + public bool HasFilter { get { throw null; } } + } + public partial class HandleExceptionArgs + { + internal HandleExceptionArgs() { } + public System.Exception Exception { get { throw null; } set { } } + public string ResponseContentType { get { throw null; } } + public int ResponseStatusCode { get { throw null; } } + public bool ResponseWritten { get { throw null; } } + public bool UseVerboseErrors { get { throw null; } set { } } + } + public partial interface IDataServiceConfiguration + { + int MaxBatchCount { get; set; } + int MaxChangesetCount { get; set; } + int MaxExpandCount { get; set; } + int MaxExpandDepth { get; set; } + int MaxObjectCountOnInsert { get; set; } + int MaxResultsPerCollection { get; set; } + bool UseVerboseErrors { get; set; } + void RegisterKnownType(System.Type type); + void SetEntitySetAccessRule(string name, System.Data.Services.EntitySetRights rights); + void SetServiceOperationAccessRule(string name, System.Data.Services.ServiceOperationRights rights); + } + public partial interface IDataServiceHost + { + System.Uri AbsoluteRequestUri { get; } + System.Uri AbsoluteServiceUri { get; } + string RequestAccept { get; } + string RequestAcceptCharSet { get; } + string RequestContentType { get; } + string RequestHttpMethod { get; } + string RequestIfMatch { get; } + string RequestIfNoneMatch { get; } + string RequestMaxVersion { get; } + System.IO.Stream RequestStream { get; } + string RequestVersion { get; } + string ResponseCacheControl { get; set; } + string ResponseContentType { get; set; } + string ResponseETag { get; set; } + string ResponseLocation { get; set; } + int ResponseStatusCode { get; set; } + System.IO.Stream ResponseStream { get; } + string ResponseVersion { get; set; } + string GetQueryStringItem(string item); + void ProcessException(System.Data.Services.HandleExceptionArgs args); + } + public partial interface IDataServiceHost2 : System.Data.Services.IDataServiceHost + { + System.Net.WebHeaderCollection RequestHeaders { get; } + System.Net.WebHeaderCollection ResponseHeaders { get; } + } + public partial interface IExpandedResult + { + object ExpandedElement { get; } + object GetExpandedPropertyValue(string name); + } + public partial interface IExpandProvider + { + System.Collections.IEnumerable ApplyExpansions(System.Linq.IQueryable queryable, System.Collections.Generic.ICollection expandPaths); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class IgnorePropertiesAttribute : System.Attribute + { + public IgnorePropertiesAttribute(string propertyName) { } + public IgnorePropertiesAttribute(params string[] propertyNames) { } + public System.Collections.ObjectModel.ReadOnlyCollection PropertyNames { get { throw null; } } + } + [System.ServiceModel.ServiceContractAttribute] + public partial interface IRequestHandler + { + [System.ServiceModel.OperationContractAttribute] + [System.ServiceModel.Web.WebInvokeAttribute(UriTemplate="*", Method="*")] + System.ServiceModel.Channels.Message ProcessRequestForMessage(System.IO.Stream messageBody); + } + public partial interface IUpdatable + { + void AddReferenceToCollection(object targetResource, string propertyName, object resourceToBeAdded); + void ClearChanges(); + object CreateResource(string containerName, string fullTypeName); + void DeleteResource(object targetResource); + object GetResource(System.Linq.IQueryable query, string fullTypeName); + object GetValue(object targetResource, string propertyName); + void RemoveReferenceFromCollection(object targetResource, string propertyName, object resourceToBeRemoved); + object ResetResource(object resource); + object ResolveResource(object resource); + void SaveChanges(); + void SetReference(object targetResource, string propertyName, object propertyValue); + void SetValue(object targetResource, string propertyName, object propertyValue); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class MimeTypeAttribute : System.Attribute + { + public MimeTypeAttribute(string memberName, string mimeType) { } + public string MemberName { get { throw null; } } + public string MimeType { get { throw null; } } + } + public sealed partial class ProcessRequestArgs + { + internal ProcessRequestArgs() { } + public bool IsBatchOperation { get { throw null; } } + public System.Data.Services.DataServiceOperationContext OperationContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Uri RequestUri { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=true, Inherited=true)] + public sealed partial class QueryInterceptorAttribute : System.Attribute + { + public QueryInterceptorAttribute(string entitySetName) { } + public string EntitySetName { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + } + [System.FlagsAttribute] + public enum ServiceOperationRights + { + All = 3, + AllRead = 3, + None = 0, + OverrideEntitySetRights = 4, + ReadMultiple = 2, + ReadSingle = 1, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false, Inherited=true)] + public sealed partial class SingleResultAttribute : System.Attribute + { + public SingleResultAttribute() { } + } + [System.FlagsAttribute] + public enum UpdateOperations + { + Add = 1, + Change = 2, + Delete = 4, + None = 0, + } +} +namespace System.Data.Services.Configuration +{ + public sealed partial class DataServicesFeaturesSection : System.Configuration.ConfigurationSection + { + public DataServicesFeaturesSection() { } + [System.Configuration.ConfigurationPropertyAttribute("replaceFunction")] + public System.Data.Services.Configuration.DataServicesReplaceFunctionFeature ReplaceFunction { get { throw null; } set { } } + } + public partial class DataServicesReplaceFunctionFeature : System.Configuration.ConfigurationElement + { + public DataServicesReplaceFunctionFeature() { } + [System.Configuration.ConfigurationPropertyAttribute("enable")] + public bool Enable { get { throw null; } set { } } + } + public sealed partial class DataServicesSectionGroup : System.Configuration.ConfigurationSectionGroup + { + public DataServicesSectionGroup() { } + [System.Configuration.ConfigurationPropertyAttribute("features")] + public System.Data.Services.Configuration.DataServicesFeaturesSection Features { get { throw null; } } + } +} +namespace System.Data.Services.Internal +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public abstract partial class ExpandedWrapper : System.Data.Services.IExpandedResult + { + protected ExpandedWrapper() { } + public string Description { get { throw null; } set { } } + public TExpandedElement ExpandedElement { get { throw null; } set { } } + object System.Data.Services.IExpandedResult.ExpandedElement { get { throw null; } } + public object GetExpandedPropertyValue(string name) { throw null; } + protected abstract object InternalGetExpandedPropertyValue(int nameIndex); + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty6 ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty7 ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty8 ProjectedProperty8 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty6 ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty7 ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty8 ProjectedProperty8 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty9 ProjectedProperty9 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty10 ProjectedProperty10 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty6 ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty7 ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty8 ProjectedProperty8 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty9 ProjectedProperty9 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty10 ProjectedProperty10 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty11 ProjectedProperty11 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty6 ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty7 ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty8 ProjectedProperty8 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty9 ProjectedProperty9 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty6 ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ExpandedWrapper : System.Data.Services.Internal.ExpandedWrapper + { + public ExpandedWrapper() { } + public TProperty0 ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty1 ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty2 ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty3 ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty4 ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty5 ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty6 ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public TProperty7 ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetExpandedPropertyValue(int nameIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public abstract partial class ProjectedWrapper + { + protected ProjectedWrapper() { } + public string PropertyNameList { get { throw null; } set { } } + public string ResourceTypeName { get { throw null; } set { } } + public object GetProjectedPropertyValue(string propertyName) { throw null; } + protected abstract object InternalGetProjectedPropertyValue(int propertyIndex); + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper0 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper0() { } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper1 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper1() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper2 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper2() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper3 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper3() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper4 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper4() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper5 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper5() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper6 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper6() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper7 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper7() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapper8 : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapper8() { } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public partial class ProjectedWrapperMany : System.Data.Services.Internal.ProjectedWrapper + { + public ProjectedWrapperMany() { } + public System.Data.Services.Internal.ProjectedWrapperMany Next { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty0 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty1 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty2 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty3 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty4 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty5 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty6 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object ProjectedProperty7 { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public sealed partial class ProjectedWrapperManyEnd : System.Data.Services.Internal.ProjectedWrapperMany + { + public ProjectedWrapperManyEnd() { } + protected override object InternalGetProjectedPropertyValue(int propertyIndex) { throw null; } + } +} +namespace System.Data.Services.Providers +{ + public static partial class DataServiceProviderMethods + { + public static int Compare(bool left, bool right) { throw null; } + public static int Compare(System.Guid left, System.Guid right) { throw null; } + public static int Compare(System.Nullable left, System.Nullable right) { throw null; } + public static int Compare(System.Nullable left, System.Nullable right) { throw null; } + public static int Compare(string left, string right) { throw null; } + public static object Convert(object value, System.Data.Services.Providers.ResourceType type) { throw null; } + public static System.Collections.Generic.IEnumerable GetSequenceValue(object value, System.Data.Services.Providers.ResourceProperty property) { throw null; } + public static object GetValue(object value, System.Data.Services.Providers.ResourceProperty property) { throw null; } + public static bool TypeIs(object value, System.Data.Services.Providers.ResourceType type) { throw null; } + } + public partial interface IDataServiceMetadataProvider + { + string ContainerName { get; } + string ContainerNamespace { get; } + System.Collections.Generic.IEnumerable ResourceSets { get; } + System.Collections.Generic.IEnumerable ServiceOperations { get; } + System.Collections.Generic.IEnumerable Types { get; } + System.Collections.Generic.IEnumerable GetDerivedTypes(System.Data.Services.Providers.ResourceType resourceType); + System.Data.Services.Providers.ResourceAssociationSet GetResourceAssociationSet(System.Data.Services.Providers.ResourceSet resourceSet, System.Data.Services.Providers.ResourceType resourceType, System.Data.Services.Providers.ResourceProperty resourceProperty); + bool HasDerivedTypes(System.Data.Services.Providers.ResourceType resourceType); + bool TryResolveResourceSet(string name, out System.Data.Services.Providers.ResourceSet resourceSet); + bool TryResolveResourceType(string name, out System.Data.Services.Providers.ResourceType resourceType); + bool TryResolveServiceOperation(string name, out System.Data.Services.Providers.ServiceOperation serviceOperation); + } + public partial interface IDataServicePagingProvider + { + object[] GetContinuationToken(System.Collections.IEnumerator enumerator); + void SetContinuationToken(System.Linq.IQueryable query, System.Data.Services.Providers.ResourceType resourceType, object[] continuationToken); + } + public partial interface IDataServiceQueryProvider + { + object CurrentDataSource { get; set; } + bool IsNullPropagationRequired { get; } + object GetOpenPropertyValue(object target, string propertyName); + System.Collections.Generic.IEnumerable> GetOpenPropertyValues(object target); + object GetPropertyValue(object target, System.Data.Services.Providers.ResourceProperty resourceProperty); + System.Linq.IQueryable GetQueryRootForResourceSet(System.Data.Services.Providers.ResourceSet resourceSet); + System.Data.Services.Providers.ResourceType GetResourceType(object target); + object InvokeServiceOperation(System.Data.Services.Providers.ServiceOperation serviceOperation, object[] parameters); + } + public partial interface IDataServiceStreamProvider + { + int StreamBufferSize { get; } + void DeleteStream(object entity, System.Data.Services.DataServiceOperationContext operationContext); + System.IO.Stream GetReadStream(object entity, string etag, System.Nullable checkETagForEquality, System.Data.Services.DataServiceOperationContext operationContext); + System.Uri GetReadStreamUri(object entity, System.Data.Services.DataServiceOperationContext operationContext); + string GetStreamContentType(object entity, System.Data.Services.DataServiceOperationContext operationContext); + string GetStreamETag(object entity, System.Data.Services.DataServiceOperationContext operationContext); + System.IO.Stream GetWriteStream(object entity, string etag, System.Nullable checkETagForEquality, System.Data.Services.DataServiceOperationContext operationContext); + string ResolveType(string entitySetName, System.Data.Services.DataServiceOperationContext operationContext); + } + public partial interface IDataServiceUpdateProvider : System.Data.Services.IUpdatable + { + void SetConcurrencyValues(object resourceCookie, System.Nullable checkForEquality, System.Collections.Generic.IEnumerable> concurrencyValues); + } + public static partial class OpenTypeMethods + { + public static object Add(object left, object right) { throw null; } + public static object AndAlso(object left, object right) { throw null; } + public static object Ceiling(object value) { throw null; } + public static object Concat(object first, object second) { throw null; } + public static object Convert(object value, System.Data.Services.Providers.ResourceType type) { throw null; } + public static object Day(object dateTime) { throw null; } + public static object Divide(object left, object right) { throw null; } + public static object EndsWith(object targetString, object substring) { throw null; } + public static object Equal(object left, object right) { throw null; } + public static object Floor(object value) { throw null; } + public static object GetValue(object value, string propertyName) { throw null; } + public static object GreaterThan(object left, object right) { throw null; } + public static object GreaterThanOrEqual(object left, object right) { throw null; } + public static object Hour(object dateTime) { throw null; } + public static object IndexOf(object targetString, object substring) { throw null; } + public static object Length(object value) { throw null; } + public static object LessThan(object left, object right) { throw null; } + public static object LessThanOrEqual(object left, object right) { throw null; } + public static object Minute(object dateTime) { throw null; } + public static object Modulo(object left, object right) { throw null; } + public static object Month(object dateTime) { throw null; } + public static object Multiply(object left, object right) { throw null; } + public static object Negate(object value) { throw null; } + public static object Not(object value) { throw null; } + public static object NotEqual(object left, object right) { throw null; } + public static object OrElse(object left, object right) { throw null; } + public static object Replace(object targetString, object substring, object newString) { throw null; } + public static object Round(object value) { throw null; } + public static object Second(object dateTime) { throw null; } + public static object StartsWith(object targetString, object substring) { throw null; } + public static object Substring(object targetString, object startIndex) { throw null; } + public static object Substring(object targetString, object startIndex, object length) { throw null; } + public static object SubstringOf(object substring, object targetString) { throw null; } + public static object Subtract(object left, object right) { throw null; } + public static object ToLower(object targetString) { throw null; } + public static object ToUpper(object targetString) { throw null; } + public static object Trim(object targetString) { throw null; } + public static object TypeIs(object value, System.Data.Services.Providers.ResourceType type) { throw null; } + public static object Year(object dateTime) { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("ResourceAssociationSet: ({End1.ResourceSet.Name}, {End1.ResourceType.Name}, {End1.ResourceProperty.Name}) <-> ({End2.ResourceSet.Name}, {End2.ResourceType.Name}, {End2.ResourceProperty.Name})")] + public sealed partial class ResourceAssociationSet + { + public ResourceAssociationSet(string name, System.Data.Services.Providers.ResourceAssociationSetEnd end1, System.Data.Services.Providers.ResourceAssociationSetEnd end2) { } + public System.Data.Services.Providers.ResourceAssociationSetEnd End1 { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public System.Data.Services.Providers.ResourceAssociationSetEnd End2 { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public string Name { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + } + [System.Diagnostics.DebuggerDisplayAttribute("ResourceAssociationSetEnd: {Name}: ({ResourceSet.Name}, {ResourceType.Name}, {ResourceProperty.Name})")] + public sealed partial class ResourceAssociationSetEnd + { + public ResourceAssociationSetEnd(System.Data.Services.Providers.ResourceSet resourceSet, System.Data.Services.Providers.ResourceType resourceType, System.Data.Services.Providers.ResourceProperty resourceProperty) { } + public System.Data.Services.Providers.ResourceProperty ResourceProperty { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public System.Data.Services.Providers.ResourceSet ResourceSet { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public System.Data.Services.Providers.ResourceType ResourceType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + } + [System.Diagnostics.DebuggerDisplayAttribute("{kind}: {name}")] + public partial class ResourceProperty + { + public ResourceProperty(string name, System.Data.Services.Providers.ResourcePropertyKind kind, System.Data.Services.Providers.ResourceType propertyResourceType) { } + public bool CanReflectOnInstanceTypeProperty { get { throw null; } set { } } + public object CustomState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IsReadOnly { get { throw null; } } + public System.Data.Services.Providers.ResourcePropertyKind Kind { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public string MimeType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } set { } } + public string Name { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public System.Data.Services.Providers.ResourceType ResourceType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public void SetReadOnly() { } + } + [System.FlagsAttribute] + public enum ResourcePropertyKind + { + ComplexType = 4, + ETag = 32, + Key = 2, + Primitive = 1, + ResourceReference = 8, + ResourceSetReference = 16, + } + [System.Diagnostics.DebuggerDisplayAttribute("{Name}: {ResourceType}")] + public partial class ResourceSet + { + public ResourceSet(string name, System.Data.Services.Providers.ResourceType elementType) { } + public object CustomState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IsReadOnly { get { throw null; } } + public string Name { get { throw null; } } + public System.Data.Services.Providers.ResourceType ResourceType { get { throw null; } } + public void SetReadOnly() { } + } + [System.Diagnostics.DebuggerDisplayAttribute("{Name}: {InstanceType}, {ResourceTypeKind}")] + public partial class ResourceType + { + public ResourceType(System.Type instanceType, System.Data.Services.Providers.ResourceTypeKind resourceTypeKind, System.Data.Services.Providers.ResourceType baseType, string namespaceName, string name, bool isAbstract) { } + public System.Data.Services.Providers.ResourceType BaseType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public bool CanReflectOnInstanceType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } set { } } + public object CustomState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.ObjectModel.ReadOnlyCollection ETagProperties { get { throw null; } } + public string FullName { get { throw null; } } + public System.Type InstanceType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public bool IsAbstract { get { throw null; } } + public bool IsMediaLinkEntry { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } set { } } + public bool IsOpenType { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } set { } } + public bool IsReadOnly { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection KeyProperties { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection Properties { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection PropertiesDeclaredOnThisType { get { throw null; } } + public System.Data.Services.Providers.ResourceTypeKind ResourceTypeKind { [System.Diagnostics.DebuggerStepThroughAttribute]get { throw null; } } + public void AddEntityPropertyMappingAttribute(System.Data.Services.Common.EntityPropertyMappingAttribute attribute) { } + public void AddProperty(System.Data.Services.Providers.ResourceProperty property) { } + public static System.Data.Services.Providers.ResourceType GetPrimitiveResourceType(System.Type type) { throw null; } + protected virtual System.Collections.Generic.IEnumerable LoadPropertiesDeclaredOnThisType() { throw null; } + public void SetReadOnly() { } + } + public enum ResourceTypeKind + { + ComplexType = 1, + EntityType = 0, + Primitive = 2, + } + [System.Diagnostics.DebuggerVisualizerAttribute("ServiceOperation={Name}")] + public partial class ServiceOperation + { + public ServiceOperation(string name, System.Data.Services.Providers.ServiceOperationResultKind resultKind, System.Data.Services.Providers.ResourceType resultType, System.Data.Services.Providers.ResourceSet resultSet, string method, System.Collections.Generic.IEnumerable parameters) { } + public object CustomState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IsReadOnly { get { throw null; } } + public string Method { get { throw null; } } + public string MimeType { get { throw null; } set { } } + public string Name { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection Parameters { get { throw null; } } + public System.Data.Services.Providers.ResourceSet ResourceSet { get { throw null; } } + public System.Data.Services.Providers.ServiceOperationResultKind ResultKind { get { throw null; } } + public System.Data.Services.Providers.ResourceType ResultType { get { throw null; } } + public void SetReadOnly() { } + } + [System.Diagnostics.DebuggerVisualizerAttribute("ServiceOperationParameter={Name}")] + public partial class ServiceOperationParameter + { + public ServiceOperationParameter(string name, System.Data.Services.Providers.ResourceType parameterType) { } + public object CustomState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IsReadOnly { get { throw null; } } + public string Name { get { throw null; } } + public System.Data.Services.Providers.ResourceType ParameterType { get { throw null; } } + public void SetReadOnly() { } + } + public enum ServiceOperationResultKind + { + DirectValue = 0, + Enumeration = 1, + QueryWithMultipleResults = 2, + QueryWithSingleResult = 3, + Void = 4, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Data.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Data.cs.REMOVED.git-id new file mode 100644 index 0000000000..12ff218373 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Data.cs.REMOVED.git-id @@ -0,0 +1 @@ +bd7cf5b5fd5aff34a37a56c42cbb83f0f2cef4b9 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Deployment.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Deployment.cs new file mode 100644 index 0000000000..f6888a859c --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Deployment.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Deployment.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Deployment.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Deployment.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Design.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Design.cs.REMOVED.git-id new file mode 100644 index 0000000000..d6f416bf4e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Design.cs.REMOVED.git-id @@ -0,0 +1 @@ +c9ca46e1e94aae8e70f47e34b4c5989eb7ab8629 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Diagnostics.Tracing.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Diagnostics.Tracing.cs new file mode 100644 index 0000000000..4b8af20bfc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Diagnostics.Tracing.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.1.2.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Diagnostics.Tracing.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventActivityOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventChannel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventCommand))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventCommandEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventDataAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventFieldAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventFieldFormat))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventFieldTags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventIgnoreAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventKeywords))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventListener))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventManifestOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventOpcode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSource))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventSourceSettings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventTask))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.EventWrittenEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Diagnostics.Tracing.NonEventAttribute))] +namespace System.Diagnostics.Tracing +{ + public partial class EventCounter + { + public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { } + public void WriteMetric(float value) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.DirectoryServices.Protocols.cs b/external/binary-reference-assemblies/src/v4.7.1/System.DirectoryServices.Protocols.cs new file mode 100644 index 0000000000..bd14ea1282 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.DirectoryServices.Protocols.cs @@ -0,0 +1,962 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.DirectoryServices.Protocols.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.DirectoryServices.Protocols.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.DirectoryServices.Protocols.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Net.WebPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Unrestricted=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, UnmanagedCode=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +[assembly:System.Security.Permissions.EnvironmentPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Unrestricted=true)] +[assembly:System.Net.NetworkInformation.NetworkInformationPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Unrestricted=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.DirectoryServices.Protocols +{ + public partial class AddRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public AddRequest() { } + public AddRequest(string distinguishedName, params System.DirectoryServices.Protocols.DirectoryAttribute[] attributes) { } + public AddRequest(string distinguishedName, string objectClass) { } + public System.DirectoryServices.Protocols.DirectoryAttributeCollection Attributes { get { throw null; } } + public string DistinguishedName { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class AddResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal AddResponse() { } + } + public partial class AsqRequestControl : System.DirectoryServices.Protocols.DirectoryControl + { + public AsqRequestControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public AsqRequestControl(string attributeName) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public string AttributeName { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class AsqResponseControl : System.DirectoryServices.Protocols.DirectoryControl + { + internal AsqResponseControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public System.DirectoryServices.Protocols.ResultCode Result { get { throw null; } } + } + public enum AuthType + { + Anonymous = 0, + Basic = 1, + Digest = 4, + Dpa = 6, + External = 8, + Kerberos = 9, + Msn = 7, + Negotiate = 2, + Ntlm = 3, + Sicily = 5, + } + [System.SerializableAttribute] + public partial class BerConversionException : System.DirectoryServices.Protocols.DirectoryException + { + public BerConversionException() { } + protected BerConversionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public BerConversionException(string message) { } + public BerConversionException(string message, System.Exception inner) { } + } + public sealed partial class BerConverter + { + internal BerConverter() { } + public static object[] Decode(string format, byte[] value) { throw null; } + public static byte[] Encode(string format, params object[] value) { throw null; } + } + public partial class CompareRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public CompareRequest() { } + public CompareRequest(string distinguishedName, System.DirectoryServices.Protocols.DirectoryAttribute assertion) { } + public CompareRequest(string distinguishedName, string attributeName, byte[] value) { } + public CompareRequest(string distinguishedName, string attributeName, string value) { } + public CompareRequest(string distinguishedName, string attributeName, System.Uri value) { } + public System.DirectoryServices.Protocols.DirectoryAttribute Assertion { get { throw null; } } + public string DistinguishedName { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class CompareResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal CompareResponse() { } + } + public partial class CrossDomainMoveControl : System.DirectoryServices.Protocols.DirectoryControl + { + public CrossDomainMoveControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public CrossDomainMoveControl(string targetDomainController) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public string TargetDomainController { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class DeleteRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public DeleteRequest() { } + public DeleteRequest(string distinguishedName) { } + public string DistinguishedName { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class DeleteResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal DeleteResponse() { } + } + public enum DereferenceAlias + { + Always = 3, + FindingBaseObject = 2, + InSearching = 1, + Never = 0, + } + public delegate void DereferenceConnectionCallback(System.DirectoryServices.Protocols.LdapConnection primaryConnection, System.DirectoryServices.Protocols.LdapConnection connectionToDereference); + public partial class DirectoryAttribute : System.Collections.CollectionBase + { + public DirectoryAttribute() { } + public DirectoryAttribute(string name, byte[] value) { } + public DirectoryAttribute(string name, params object[] values) { } + public DirectoryAttribute(string name, string value) { } + public DirectoryAttribute(string name, System.Uri value) { } + public object this[int index] { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public int Add(byte[] value) { throw null; } + public int Add(string value) { throw null; } + public int Add(System.Uri value) { throw null; } + public void AddRange(object[] values) { } + public bool Contains(object value) { throw null; } + public void CopyTo(object[] array, int index) { } + public object[] GetValues(System.Type valuesType) { throw null; } + public int IndexOf(object value) { throw null; } + public void Insert(int index, byte[] value) { } + public void Insert(int index, string value) { } + public void Insert(int index, System.Uri value) { } + protected override void OnValidate(object value) { } + public void Remove(object value) { } + } + public partial class DirectoryAttributeCollection : System.Collections.CollectionBase + { + public DirectoryAttributeCollection() { } + public System.DirectoryServices.Protocols.DirectoryAttribute this[int index] { get { throw null; } set { } } + public int Add(System.DirectoryServices.Protocols.DirectoryAttribute attribute) { throw null; } + public void AddRange(System.DirectoryServices.Protocols.DirectoryAttributeCollection attributeCollection) { } + public void AddRange(System.DirectoryServices.Protocols.DirectoryAttribute[] attributes) { } + public bool Contains(System.DirectoryServices.Protocols.DirectoryAttribute value) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.DirectoryAttribute[] array, int index) { } + public int IndexOf(System.DirectoryServices.Protocols.DirectoryAttribute value) { throw null; } + public void Insert(int index, System.DirectoryServices.Protocols.DirectoryAttribute value) { } + protected override void OnValidate(object value) { } + public void Remove(System.DirectoryServices.Protocols.DirectoryAttribute value) { } + } + public partial class DirectoryAttributeModification : System.DirectoryServices.Protocols.DirectoryAttribute + { + public DirectoryAttributeModification() { } + public System.DirectoryServices.Protocols.DirectoryAttributeOperation Operation { get { throw null; } set { } } + } + public partial class DirectoryAttributeModificationCollection : System.Collections.CollectionBase + { + public DirectoryAttributeModificationCollection() { } + public System.DirectoryServices.Protocols.DirectoryAttributeModification this[int index] { get { throw null; } set { } } + public int Add(System.DirectoryServices.Protocols.DirectoryAttributeModification attribute) { throw null; } + public void AddRange(System.DirectoryServices.Protocols.DirectoryAttributeModificationCollection attributeCollection) { } + public void AddRange(System.DirectoryServices.Protocols.DirectoryAttributeModification[] attributes) { } + public bool Contains(System.DirectoryServices.Protocols.DirectoryAttributeModification value) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.DirectoryAttributeModification[] array, int index) { } + public int IndexOf(System.DirectoryServices.Protocols.DirectoryAttributeModification value) { throw null; } + public void Insert(int index, System.DirectoryServices.Protocols.DirectoryAttributeModification value) { } + protected override void OnValidate(object value) { } + public void Remove(System.DirectoryServices.Protocols.DirectoryAttributeModification value) { } + } + public enum DirectoryAttributeOperation + { + Add = 0, + Delete = 1, + Replace = 2, + } + public abstract partial class DirectoryConnection + { + protected DirectoryConnection() { } + public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } } + public virtual System.Net.NetworkCredential Credential { [System.Security.Permissions.EnvironmentPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true), System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2)), System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)]set { } } + public virtual System.DirectoryServices.Protocols.DirectoryIdentifier Directory { get { throw null; } } + public virtual System.TimeSpan Timeout { get { throw null; } set { } } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public abstract System.DirectoryServices.Protocols.DirectoryResponse SendRequest(System.DirectoryServices.Protocols.DirectoryRequest request); + } + public partial class DirectoryControl + { + public DirectoryControl(string type, byte[] value, bool isCritical, bool serverSide) { } + public bool IsCritical { get { throw null; } set { } } + public bool ServerSide { get { throw null; } set { } } + public string Type { get { throw null; } } + public virtual byte[] GetValue() { throw null; } + } + public partial class DirectoryControlCollection : System.Collections.CollectionBase + { + public DirectoryControlCollection() { } + public System.DirectoryServices.Protocols.DirectoryControl this[int index] { get { throw null; } set { } } + public int Add(System.DirectoryServices.Protocols.DirectoryControl control) { throw null; } + public void AddRange(System.DirectoryServices.Protocols.DirectoryControlCollection controlCollection) { } + public void AddRange(System.DirectoryServices.Protocols.DirectoryControl[] controls) { } + public bool Contains(System.DirectoryServices.Protocols.DirectoryControl value) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.DirectoryControl[] array, int index) { } + public int IndexOf(System.DirectoryServices.Protocols.DirectoryControl value) { throw null; } + public void Insert(int index, System.DirectoryServices.Protocols.DirectoryControl value) { } + protected override void OnValidate(object value) { } + public void Remove(System.DirectoryServices.Protocols.DirectoryControl value) { } + } + [System.SerializableAttribute] + public partial class DirectoryException : System.Exception + { + public DirectoryException() { } + protected DirectoryException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public DirectoryException(string message) { } + public DirectoryException(string message, System.Exception inner) { } + } + public abstract partial class DirectoryIdentifier + { + protected DirectoryIdentifier() { } + } + public partial class DirectoryNotificationControl : System.DirectoryServices.Protocols.DirectoryControl + { + public DirectoryNotificationControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + } + public abstract partial class DirectoryOperation + { + protected DirectoryOperation() { } + } + [System.SerializableAttribute] + public partial class DirectoryOperationException : System.DirectoryServices.Protocols.DirectoryException, System.Runtime.Serialization.ISerializable + { + public DirectoryOperationException() { } + public DirectoryOperationException(System.DirectoryServices.Protocols.DirectoryResponse response) { } + public DirectoryOperationException(System.DirectoryServices.Protocols.DirectoryResponse response, string message) { } + public DirectoryOperationException(System.DirectoryServices.Protocols.DirectoryResponse response, string message, System.Exception inner) { } + protected DirectoryOperationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public DirectoryOperationException(string message) { } + public DirectoryOperationException(string message, System.Exception inner) { } + public System.DirectoryServices.Protocols.DirectoryResponse Response { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + } + public abstract partial class DirectoryRequest : System.DirectoryServices.Protocols.DirectoryOperation + { + internal DirectoryRequest() { } + public System.DirectoryServices.Protocols.DirectoryControlCollection Controls { get { throw null; } } + public string RequestId { get { throw null; } set { } } + protected abstract System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc); + } + public abstract partial class DirectoryResponse : System.DirectoryServices.Protocols.DirectoryOperation + { + internal DirectoryResponse() { } + public virtual System.DirectoryServices.Protocols.DirectoryControl[] Controls { get { throw null; } } + public virtual string ErrorMessage { get { throw null; } } + public virtual string MatchedDN { get { throw null; } } + public virtual System.Uri[] Referral { get { throw null; } } + public string RequestId { get { throw null; } } + public virtual System.DirectoryServices.Protocols.ResultCode ResultCode { get { throw null; } } + } + [System.FlagsAttribute] + public enum DirectorySynchronizationOptions : long + { + IncrementalValues = (long)2147483648, + None = (long)0, + ObjectSecurity = (long)1, + ParentsFirst = (long)2048, + PublicDataOnly = (long)8192, + } + public partial class DirSyncRequestControl : System.DirectoryServices.Protocols.DirectoryControl + { + public DirSyncRequestControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public DirSyncRequestControl(byte[] cookie) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public DirSyncRequestControl(byte[] cookie, System.DirectoryServices.Protocols.DirectorySynchronizationOptions option) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public DirSyncRequestControl(byte[] cookie, System.DirectoryServices.Protocols.DirectorySynchronizationOptions option, int attributeCount) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public int AttributeCount { get { throw null; } set { } } + public byte[] Cookie { get { throw null; } set { } } + public System.DirectoryServices.Protocols.DirectorySynchronizationOptions Option { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class DirSyncResponseControl : System.DirectoryServices.Protocols.DirectoryControl + { + internal DirSyncResponseControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public byte[] Cookie { get { throw null; } } + public bool MoreData { get { throw null; } } + public int ResultSize { get { throw null; } } + } + public partial class DomainScopeControl : System.DirectoryServices.Protocols.DirectoryControl + { + public DomainScopeControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + } + public partial class DsmlAuthRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public DsmlAuthRequest() { } + public DsmlAuthRequest(string principal) { } + public string Principal { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class DsmlAuthResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal DsmlAuthResponse() { } + } + public partial class DsmlDirectoryIdentifier : System.DirectoryServices.Protocols.DirectoryIdentifier + { + public DsmlDirectoryIdentifier(System.Uri serverUri) { } + public System.Uri ServerUri { get { throw null; } } + } + public abstract partial class DsmlDocument + { + protected DsmlDocument() { } + public abstract System.Xml.XmlDocument ToXml(); + } + public enum DsmlDocumentProcessing + { + Parallel = 1, + Sequential = 0, + } + public enum DsmlErrorProcessing + { + Exit = 1, + Resume = 0, + } + public partial class DsmlErrorResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal DsmlErrorResponse() { } + public override System.DirectoryServices.Protocols.DirectoryControl[] Controls { get { throw null; } } + public string Detail { get { throw null; } } + public override string ErrorMessage { get { throw null; } } + public override string MatchedDN { get { throw null; } } + public string Message { get { throw null; } } + public override System.Uri[] Referral { get { throw null; } } + public override System.DirectoryServices.Protocols.ResultCode ResultCode { get { throw null; } } + public System.DirectoryServices.Protocols.ErrorResponseCategory Type { get { throw null; } } + } + [System.SerializableAttribute] + public partial class DsmlInvalidDocumentException : System.DirectoryServices.Protocols.DirectoryException + { + public DsmlInvalidDocumentException() { } + protected DsmlInvalidDocumentException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public DsmlInvalidDocumentException(string message) { } + public DsmlInvalidDocumentException(string message, System.Exception inner) { } + } + public partial class DsmlRequestDocument : System.DirectoryServices.Protocols.DsmlDocument, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList + { + public DsmlRequestDocument() { } + public int Count { get { throw null; } } + public System.DirectoryServices.Protocols.DsmlDocumentProcessing DocumentProcessing { get { throw null; } set { } } + public System.DirectoryServices.Protocols.DsmlErrorProcessing ErrorProcessing { get { throw null; } set { } } + protected bool IsFixedSize { get { throw null; } } + protected bool IsReadOnly { get { throw null; } } + protected bool IsSynchronized { get { throw null; } } + public System.DirectoryServices.Protocols.DirectoryRequest this[int index] { get { throw null; } set { } } + public string RequestId { get { throw null; } set { } } + public System.DirectoryServices.Protocols.DsmlResponseOrder ResponseOrder { get { throw null; } set { } } + protected object SyncRoot { get { throw null; } } + int System.Collections.ICollection.Count { get { throw null; } } + bool System.Collections.ICollection.IsSynchronized { get { throw null; } } + object System.Collections.ICollection.SyncRoot { get { throw null; } } + bool System.Collections.IList.IsFixedSize { get { throw null; } } + bool System.Collections.IList.IsReadOnly { get { throw null; } } + object System.Collections.IList.this[int index] { get { throw null; } set { } } + public int Add(System.DirectoryServices.Protocols.DirectoryRequest request) { throw null; } + public void Clear() { } + public bool Contains(System.DirectoryServices.Protocols.DirectoryRequest value) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.DirectoryRequest[] value, int i) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public int IndexOf(System.DirectoryServices.Protocols.DirectoryRequest value) { throw null; } + public void Insert(int index, System.DirectoryServices.Protocols.DirectoryRequest value) { } + public void Remove(System.DirectoryServices.Protocols.DirectoryRequest value) { } + public void RemoveAt(int index) { } + void System.Collections.ICollection.CopyTo(System.Array value, int i) { } + int System.Collections.IList.Add(object request) { throw null; } + void System.Collections.IList.Clear() { } + bool System.Collections.IList.Contains(object value) { throw null; } + int System.Collections.IList.IndexOf(object value) { throw null; } + void System.Collections.IList.Insert(int index, object value) { } + void System.Collections.IList.Remove(object value) { } + void System.Collections.IList.RemoveAt(int index) { } + public override System.Xml.XmlDocument ToXml() { throw null; } + } + public partial class DsmlResponseDocument : System.DirectoryServices.Protocols.DsmlDocument, System.Collections.ICollection, System.Collections.IEnumerable + { + internal DsmlResponseDocument() { } + public int Count { get { throw null; } } + public bool IsErrorResponse { get { throw null; } } + public bool IsOperationError { get { throw null; } } + protected bool IsSynchronized { get { throw null; } } + public System.DirectoryServices.Protocols.DirectoryResponse this[int index] { get { throw null; } } + public string RequestId { get { throw null; } } + protected object SyncRoot { get { throw null; } } + int System.Collections.ICollection.Count { get { throw null; } } + bool System.Collections.ICollection.IsSynchronized { get { throw null; } } + object System.Collections.ICollection.SyncRoot { get { throw null; } } + public void CopyTo(System.DirectoryServices.Protocols.DirectoryResponse[] value, int i) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + void System.Collections.ICollection.CopyTo(System.Array value, int i) { } + public override System.Xml.XmlDocument ToXml() { throw null; } + } + public enum DsmlResponseOrder + { + Sequential = 0, + Unordered = 1, + } + public abstract partial class DsmlSoapConnection : System.DirectoryServices.Protocols.DirectoryConnection + { + protected DsmlSoapConnection() { } + public abstract string SessionId { get; } + public System.Xml.XmlNode SoapRequestHeader { get { throw null; } set { } } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public abstract void BeginSession(); + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public abstract void EndSession(); + } + public partial class DsmlSoapHttpConnection : System.DirectoryServices.Protocols.DsmlSoapConnection + { + [System.Net.WebPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public DsmlSoapHttpConnection(System.DirectoryServices.Protocols.DsmlDirectoryIdentifier identifier) { } + [System.Security.Permissions.EnvironmentPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public DsmlSoapHttpConnection(System.DirectoryServices.Protocols.DsmlDirectoryIdentifier identifier, System.Net.NetworkCredential credential) { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public DsmlSoapHttpConnection(System.DirectoryServices.Protocols.DsmlDirectoryIdentifier identifier, System.Net.NetworkCredential credential, System.DirectoryServices.Protocols.AuthType authType) { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public DsmlSoapHttpConnection(System.Uri uri) { } + public System.DirectoryServices.Protocols.AuthType AuthType { get { throw null; } set { } } + public override string SessionId { get { throw null; } } + public string SoapActionHeader { get { throw null; } set { } } + public override System.TimeSpan Timeout { get { throw null; } set { } } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public void Abort(System.IAsyncResult asyncResult) { } + [System.Net.WebPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.Net.NetworkInformation.NetworkInformationPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public System.IAsyncResult BeginSendRequest(System.DirectoryServices.Protocols.DsmlRequestDocument request, System.AsyncCallback callback, object state) { throw null; } + [System.Net.WebPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.Net.NetworkInformation.NetworkInformationPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override void BeginSession() { } + public System.DirectoryServices.Protocols.DsmlResponseDocument EndSendRequest(System.IAsyncResult asyncResult) { throw null; } + [System.Net.WebPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.Net.NetworkInformation.NetworkInformationPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override void EndSession() { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override System.DirectoryServices.Protocols.DirectoryResponse SendRequest(System.DirectoryServices.Protocols.DirectoryRequest request) { throw null; } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public System.DirectoryServices.Protocols.DsmlResponseDocument SendRequest(System.DirectoryServices.Protocols.DsmlRequestDocument request) { throw null; } + } + public enum ErrorResponseCategory + { + AuthenticationFailed = 5, + ConnectionClosed = 2, + CouldNotConnect = 1, + GatewayInternalError = 4, + MalformedRequest = 3, + NotAttempted = 0, + Other = 7, + UnresolvableUri = 6, + } + [System.SerializableAttribute] + public partial class ErrorResponseException : System.DirectoryServices.Protocols.DirectoryException, System.Runtime.Serialization.ISerializable + { + public ErrorResponseException() { } + public ErrorResponseException(System.DirectoryServices.Protocols.DsmlErrorResponse response) { } + public ErrorResponseException(System.DirectoryServices.Protocols.DsmlErrorResponse response, string message) { } + public ErrorResponseException(System.DirectoryServices.Protocols.DsmlErrorResponse response, string message, System.Exception inner) { } + protected ErrorResponseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ErrorResponseException(string message) { } + public ErrorResponseException(string message, System.Exception inner) { } + public System.DirectoryServices.Protocols.DsmlErrorResponse Response { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + } + public partial class ExtendedDNControl : System.DirectoryServices.Protocols.DirectoryControl + { + public ExtendedDNControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public ExtendedDNControl(System.DirectoryServices.Protocols.ExtendedDNFlag flag) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public System.DirectoryServices.Protocols.ExtendedDNFlag Flag { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public enum ExtendedDNFlag + { + HexString = 0, + StandardString = 1, + } + public partial class ExtendedRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public ExtendedRequest() { } + public ExtendedRequest(string requestName) { } + public ExtendedRequest(string requestName, byte[] requestValue) { } + public string RequestName { get { throw null; } set { } } + public byte[] RequestValue { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class ExtendedResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal ExtendedResponse() { } + public string ResponseName { get { throw null; } } + public byte[] ResponseValue { get { throw null; } } + } + public partial class LazyCommitControl : System.DirectoryServices.Protocols.DirectoryControl + { + public LazyCommitControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + } + public partial class LdapConnection : System.DirectoryServices.Protocols.DirectoryConnection, System.IDisposable + { + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public LdapConnection(System.DirectoryServices.Protocols.LdapDirectoryIdentifier identifier) { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public LdapConnection(System.DirectoryServices.Protocols.LdapDirectoryIdentifier identifier, System.Net.NetworkCredential credential) { } + [System.Security.Permissions.EnvironmentPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true)] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public LdapConnection(System.DirectoryServices.Protocols.LdapDirectoryIdentifier identifier, System.Net.NetworkCredential credential, System.DirectoryServices.Protocols.AuthType authType) { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public LdapConnection(string server) { } + public System.DirectoryServices.Protocols.AuthType AuthType { get { throw null; } set { } } + public bool AutoBind { get { throw null; } set { } } + public override System.Net.NetworkCredential Credential { [System.Security.Permissions.EnvironmentPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Unrestricted=true), System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2)), System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)]set { } } + public System.DirectoryServices.Protocols.LdapSessionOptions SessionOptions { get { throw null; } } + public override System.TimeSpan Timeout { get { throw null; } set { } } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public void Abort(System.IAsyncResult asyncResult) { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public System.IAsyncResult BeginSendRequest(System.DirectoryServices.Protocols.DirectoryRequest request, System.DirectoryServices.Protocols.PartialResultProcessing partialMode, System.AsyncCallback callback, object state) { throw null; } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public System.IAsyncResult BeginSendRequest(System.DirectoryServices.Protocols.DirectoryRequest request, System.TimeSpan requestTimeout, System.DirectoryServices.Protocols.PartialResultProcessing partialMode, System.AsyncCallback callback, object state) { throw null; } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public void Bind() { } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public void Bind(System.Net.NetworkCredential newCredential) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.DirectoryServices.Protocols.DirectoryResponse EndSendRequest(System.IAsyncResult asyncResult) { throw null; } + ~LdapConnection() { } + public System.DirectoryServices.Protocols.PartialResultsCollection GetPartialResults(System.IAsyncResult asyncResult) { throw null; } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override System.DirectoryServices.Protocols.DirectoryResponse SendRequest(System.DirectoryServices.Protocols.DirectoryRequest request) { throw null; } + [System.DirectoryServices.DirectoryServicesPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public System.DirectoryServices.Protocols.DirectoryResponse SendRequest(System.DirectoryServices.Protocols.DirectoryRequest request, System.TimeSpan requestTimeout) { throw null; } + } + public partial class LdapDirectoryIdentifier : System.DirectoryServices.Protocols.DirectoryIdentifier + { + public LdapDirectoryIdentifier(string server) { } + public LdapDirectoryIdentifier(string server, bool fullyQualifiedDnsHostName, bool connectionless) { } + public LdapDirectoryIdentifier(string server, int portNumber) { } + public LdapDirectoryIdentifier(string server, int portNumber, bool fullyQualifiedDnsHostName, bool connectionless) { } + public LdapDirectoryIdentifier(string[] servers, bool fullyQualifiedDnsHostName, bool connectionless) { } + public LdapDirectoryIdentifier(string[] servers, int portNumber, bool fullyQualifiedDnsHostName, bool connectionless) { } + public bool Connectionless { get { throw null; } } + public bool FullyQualifiedDnsHostName { get { throw null; } } + public int PortNumber { get { throw null; } } + public string[] Servers { get { throw null; } } + } + [System.SerializableAttribute] + public partial class LdapException : System.DirectoryServices.Protocols.DirectoryException, System.Runtime.Serialization.ISerializable + { + public LdapException() { } + public LdapException(int errorCode) { } + public LdapException(int errorCode, string message) { } + public LdapException(int errorCode, string message, System.Exception inner) { } + public LdapException(int errorCode, string message, string serverErrorMessage) { } + protected LdapException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public LdapException(string message) { } + public LdapException(string message, System.Exception inner) { } + public int ErrorCode { get { throw null; } } + public System.DirectoryServices.Protocols.PartialResultsCollection PartialResults { get { throw null; } } + public string ServerErrorMessage { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + } + public partial class LdapSessionOptions + { + internal LdapSessionOptions() { } + public bool AutoReconnect { get { throw null; } set { } } + public string DomainName { get { throw null; } set { } } + public string HostName { get { throw null; } set { } } + public bool HostReachable { get { throw null; } } + public System.DirectoryServices.Protocols.LocatorFlags LocatorFlag { get { throw null; } set { } } + public System.TimeSpan PingKeepAliveTimeout { get { throw null; } set { } } + public int PingLimit { get { throw null; } set { } } + public System.TimeSpan PingWaitTimeout { get { throw null; } set { } } + public int ProtocolVersion { get { throw null; } set { } } + public System.DirectoryServices.Protocols.QueryClientCertificateCallback QueryClientCertificate { get { throw null; } set { } } + public System.DirectoryServices.Protocols.ReferralCallback ReferralCallback { get { throw null; } set { } } + public System.DirectoryServices.Protocols.ReferralChasingOptions ReferralChasing { get { throw null; } set { } } + public int ReferralHopLimit { get { throw null; } set { } } + public bool RootDseCache { get { throw null; } set { } } + public string SaslMethod { get { throw null; } set { } } + public bool Sealing { get { throw null; } set { } } + public bool SecureSocketLayer { get { throw null; } set { } } + public object SecurityContext { get { throw null; } } + public System.TimeSpan SendTimeout { get { throw null; } set { } } + public bool Signing { get { throw null; } set { } } + public System.DirectoryServices.Protocols.SecurityPackageContextConnectionInformation SslInformation { get { throw null; } } + public int SspiFlag { get { throw null; } set { } } + public bool TcpKeepAlive { get { throw null; } set { } } + public System.DirectoryServices.Protocols.VerifyServerCertificateCallback VerifyServerCertificate { get { throw null; } set { } } + public void FastConcurrentBind() { } + public void StartTransportLayerSecurity(System.DirectoryServices.Protocols.DirectoryControlCollection controls) { } + public void StopTransportLayerSecurity() { } + } + [System.FlagsAttribute] + public enum LocatorFlags : long + { + AvoidSelf = (long)16384, + DirectoryServicesPreferred = (long)32, + DirectoryServicesRequired = (long)16, + ForceRediscovery = (long)1, + GCRequired = (long)64, + GoodTimeServerPreferred = (long)8192, + IPRequired = (long)512, + IsDnsName = (long)131072, + IsFlatName = (long)65536, + KdcRequired = (long)1024, + None = (long)0, + OnlyLdapNeeded = (long)32768, + PdcRequired = (long)128, + ReturnDnsName = (long)1073741824, + ReturnFlatName = (long)2147483648, + TimeServerRequired = (long)2048, + WriteableRequired = (long)4096, + } + public partial class ModifyDNRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public ModifyDNRequest() { } + public ModifyDNRequest(string distinguishedName, string newParentDistinguishedName, string newName) { } + public bool DeleteOldRdn { get { throw null; } set { } } + public string DistinguishedName { get { throw null; } set { } } + public string NewName { get { throw null; } set { } } + public string NewParentDistinguishedName { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class ModifyDNResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal ModifyDNResponse() { } + } + public partial class ModifyRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public ModifyRequest() { } + public ModifyRequest(string distinguishedName, params System.DirectoryServices.Protocols.DirectoryAttributeModification[] modifications) { } + public ModifyRequest(string distinguishedName, System.DirectoryServices.Protocols.DirectoryAttributeOperation operation, string attributeName, params object[] values) { } + public string DistinguishedName { get { throw null; } set { } } + public System.DirectoryServices.Protocols.DirectoryAttributeModificationCollection Modifications { get { throw null; } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class ModifyResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal ModifyResponse() { } + } + public delegate bool NotifyOfNewConnectionCallback(System.DirectoryServices.Protocols.LdapConnection primaryConnection, System.DirectoryServices.Protocols.LdapConnection referralFromConnection, string newDistinguishedName, System.DirectoryServices.Protocols.LdapDirectoryIdentifier identifier, System.DirectoryServices.Protocols.LdapConnection newConnection, System.Net.NetworkCredential credential, long currentUserToken, int errorCodeFromBind); + public partial class PageResultRequestControl : System.DirectoryServices.Protocols.DirectoryControl + { + public PageResultRequestControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public PageResultRequestControl(byte[] cookie) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public PageResultRequestControl(int pageSize) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public byte[] Cookie { get { throw null; } set { } } + public int PageSize { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class PageResultResponseControl : System.DirectoryServices.Protocols.DirectoryControl + { + internal PageResultResponseControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public byte[] Cookie { get { throw null; } } + public int TotalCount { get { throw null; } } + } + public enum PartialResultProcessing + { + NoPartialResultSupport = 0, + ReturnPartialResults = 1, + ReturnPartialResultsAndNotifyCallback = 2, + } + public partial class PartialResultsCollection : System.Collections.ReadOnlyCollectionBase + { + internal PartialResultsCollection() { } + public object this[int index] { get { throw null; } } + public bool Contains(object value) { throw null; } + public void CopyTo(object[] values, int index) { } + public int IndexOf(object value) { throw null; } + } + public partial class PermissiveModifyControl : System.DirectoryServices.Protocols.DirectoryControl + { + public PermissiveModifyControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + } + public delegate System.Security.Cryptography.X509Certificates.X509Certificate QueryClientCertificateCallback(System.DirectoryServices.Protocols.LdapConnection connection, byte[][] trustedCAs); + public delegate System.DirectoryServices.Protocols.LdapConnection QueryForConnectionCallback(System.DirectoryServices.Protocols.LdapConnection primaryConnection, System.DirectoryServices.Protocols.LdapConnection referralFromConnection, string newDistinguishedName, System.DirectoryServices.Protocols.LdapDirectoryIdentifier identifier, System.Net.NetworkCredential credential, long currentUserToken); + public partial class QuotaControl : System.DirectoryServices.Protocols.DirectoryControl + { + public QuotaControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public QuotaControl(System.Security.Principal.SecurityIdentifier querySid) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public System.Security.Principal.SecurityIdentifier QuerySid { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public sealed partial class ReferralCallback + { + public ReferralCallback() { } + public System.DirectoryServices.Protocols.DereferenceConnectionCallback DereferenceConnection { get { throw null; } set { } } + public System.DirectoryServices.Protocols.NotifyOfNewConnectionCallback NotifyNewConnection { get { throw null; } set { } } + public System.DirectoryServices.Protocols.QueryForConnectionCallback QueryForConnection { get { throw null; } set { } } + } + [System.FlagsAttribute] + public enum ReferralChasingOptions + { + All = 96, + External = 64, + None = 0, + Subordinate = 32, + } + public enum ResultCode + { + AdminLimitExceeded = 11, + AffectsMultipleDsas = 71, + AliasDereferencingProblem = 36, + AliasProblem = 33, + AttributeOrValueExists = 20, + AuthMethodNotSupported = 7, + Busy = 51, + CompareFalse = 5, + CompareTrue = 6, + ConfidentialityRequired = 13, + ConstraintViolation = 19, + EntryAlreadyExists = 68, + InappropriateAuthentication = 48, + InappropriateMatching = 18, + InsufficientAccessRights = 50, + InvalidAttributeSyntax = 21, + InvalidDNSyntax = 34, + LoopDetect = 54, + NamingViolation = 64, + NoSuchAttribute = 16, + NoSuchObject = 32, + NotAllowedOnNonLeaf = 66, + NotAllowedOnRdn = 67, + ObjectClassModificationsProhibited = 69, + ObjectClassViolation = 65, + OffsetRangeError = 61, + OperationsError = 1, + Other = 80, + ProtocolError = 2, + Referral = 10, + ReferralV2 = 9, + ResultsTooLarge = 70, + SaslBindInProgress = 14, + SizeLimitExceeded = 4, + SortControlMissing = 60, + StrongAuthRequired = 8, + Success = 0, + TimeLimitExceeded = 3, + Unavailable = 52, + UnavailableCriticalExtension = 12, + UndefinedAttributeType = 17, + UnwillingToPerform = 53, + VirtualListViewError = 76, + } + public enum SearchOption + { + DomainScope = 1, + PhantomRoot = 2, + } + public partial class SearchOptionsControl : System.DirectoryServices.Protocols.DirectoryControl + { + public SearchOptionsControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public SearchOptionsControl(System.DirectoryServices.Protocols.SearchOption flags) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public System.DirectoryServices.Protocols.SearchOption SearchOption { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class SearchRequest : System.DirectoryServices.Protocols.DirectoryRequest + { + public SearchRequest() { } + public SearchRequest(string distinguishedName, string ldapFilter, System.DirectoryServices.Protocols.SearchScope searchScope, params string[] attributeList) { } + public SearchRequest(string distinguishedName, System.Xml.XmlDocument filter, System.DirectoryServices.Protocols.SearchScope searchScope, params string[] attributeList) { } + public System.DirectoryServices.Protocols.DereferenceAlias Aliases { get { throw null; } set { } } + public System.Collections.Specialized.StringCollection Attributes { get { throw null; } } + public string DistinguishedName { get { throw null; } set { } } + public object Filter { get { throw null; } set { } } + public System.DirectoryServices.Protocols.SearchScope Scope { get { throw null; } set { } } + public int SizeLimit { get { throw null; } set { } } + public System.TimeSpan TimeLimit { get { throw null; } set { } } + public bool TypesOnly { get { throw null; } set { } } + protected override System.Xml.XmlElement ToXmlNode(System.Xml.XmlDocument doc) { throw null; } + } + public partial class SearchResponse : System.DirectoryServices.Protocols.DirectoryResponse + { + internal SearchResponse() { } + public override System.DirectoryServices.Protocols.DirectoryControl[] Controls { get { throw null; } } + public System.DirectoryServices.Protocols.SearchResultEntryCollection Entries { get { throw null; } } + public override string ErrorMessage { get { throw null; } } + public override string MatchedDN { get { throw null; } } + public System.DirectoryServices.Protocols.SearchResultReferenceCollection References { get { throw null; } } + public override System.Uri[] Referral { get { throw null; } } + public override System.DirectoryServices.Protocols.ResultCode ResultCode { get { throw null; } } + } + public partial class SearchResultAttributeCollection : System.Collections.DictionaryBase + { + internal SearchResultAttributeCollection() { } + public System.Collections.ICollection AttributeNames { get { throw null; } } + public System.DirectoryServices.Protocols.DirectoryAttribute this[string attributeName] { get { throw null; } } + public System.Collections.ICollection Values { get { throw null; } } + public bool Contains(string attributeName) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.DirectoryAttribute[] array, int index) { } + } + public partial class SearchResultEntry + { + internal SearchResultEntry() { } + public System.DirectoryServices.Protocols.SearchResultAttributeCollection Attributes { get { throw null; } } + public System.DirectoryServices.Protocols.DirectoryControl[] Controls { get { throw null; } } + public string DistinguishedName { get { throw null; } } + } + public partial class SearchResultEntryCollection : System.Collections.ReadOnlyCollectionBase + { + internal SearchResultEntryCollection() { } + public System.DirectoryServices.Protocols.SearchResultEntry this[int index] { get { throw null; } } + public bool Contains(System.DirectoryServices.Protocols.SearchResultEntry value) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.SearchResultEntry[] values, int index) { } + public int IndexOf(System.DirectoryServices.Protocols.SearchResultEntry value) { throw null; } + } + public partial class SearchResultReference + { + internal SearchResultReference() { } + public System.DirectoryServices.Protocols.DirectoryControl[] Controls { get { throw null; } } + public System.Uri[] Reference { get { throw null; } } + } + public partial class SearchResultReferenceCollection : System.Collections.ReadOnlyCollectionBase + { + internal SearchResultReferenceCollection() { } + public System.DirectoryServices.Protocols.SearchResultReference this[int index] { get { throw null; } } + public bool Contains(System.DirectoryServices.Protocols.SearchResultReference value) { throw null; } + public void CopyTo(System.DirectoryServices.Protocols.SearchResultReference[] values, int index) { } + public int IndexOf(System.DirectoryServices.Protocols.SearchResultReference value) { throw null; } + } + public enum SearchScope + { + Base = 0, + OneLevel = 1, + Subtree = 2, + } + public partial class SecurityDescriptorFlagControl : System.DirectoryServices.Protocols.DirectoryControl + { + public SecurityDescriptorFlagControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public SecurityDescriptorFlagControl(System.DirectoryServices.Protocols.SecurityMasks masks) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public System.DirectoryServices.Protocols.SecurityMasks SecurityMasks { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + [System.FlagsAttribute] + public enum SecurityMasks + { + Dacl = 4, + Group = 2, + None = 0, + Owner = 1, + Sacl = 8, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet=System.Runtime.InteropServices.CharSet.Unicode)] + public partial class SecurityPackageContextConnectionInformation + { + internal SecurityPackageContextConnectionInformation() { } + public System.Security.Authentication.CipherAlgorithmType AlgorithmIdentifier { get { throw null; } } + public int CipherStrength { get { throw null; } } + public int ExchangeStrength { get { throw null; } } + public System.Security.Authentication.HashAlgorithmType Hash { get { throw null; } } + public int HashStrength { get { throw null; } } + public int KeyExchangeAlgorithm { get { throw null; } } + public System.DirectoryServices.Protocols.SecurityProtocol Protocol { get { throw null; } } + } + public enum SecurityProtocol + { + Pct1Client = 2, + Pct1Server = 1, + Ssl2Client = 8, + Ssl2Server = 4, + Ssl3Client = 32, + Ssl3Server = 16, + Tls1Client = 128, + Tls1Server = 64, + } + public partial class ShowDeletedControl : System.DirectoryServices.Protocols.DirectoryControl + { + public ShowDeletedControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet=System.Runtime.InteropServices.CharSet.Unicode)] + public partial class SortKey + { + public SortKey() { } + public SortKey(string attributeName, string matchingRule, bool reverseOrder) { } + public string AttributeName { get { throw null; } set { } } + public string MatchingRule { get { throw null; } set { } } + public bool ReverseOrder { get { throw null; } set { } } + } + public partial class SortRequestControl : System.DirectoryServices.Protocols.DirectoryControl + { + public SortRequestControl(params System.DirectoryServices.Protocols.SortKey[] sortKeys) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public SortRequestControl(string attributeName, bool reverseOrder) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public SortRequestControl(string attributeName, string matchingRule, bool reverseOrder) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public System.DirectoryServices.Protocols.SortKey[] SortKeys { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class SortResponseControl : System.DirectoryServices.Protocols.DirectoryControl + { + internal SortResponseControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public string AttributeName { get { throw null; } } + public System.DirectoryServices.Protocols.ResultCode Result { get { throw null; } } + } + [System.SerializableAttribute] + public partial class TlsOperationException : System.DirectoryServices.Protocols.DirectoryOperationException + { + public TlsOperationException() { } + public TlsOperationException(System.DirectoryServices.Protocols.DirectoryResponse response) { } + public TlsOperationException(System.DirectoryServices.Protocols.DirectoryResponse response, string message) { } + public TlsOperationException(System.DirectoryServices.Protocols.DirectoryResponse response, string message, System.Exception inner) { } + protected TlsOperationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TlsOperationException(string message) { } + public TlsOperationException(string message, System.Exception inner) { } + } + public partial class TreeDeleteControl : System.DirectoryServices.Protocols.DirectoryControl + { + public TreeDeleteControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + } + public partial class VerifyNameControl : System.DirectoryServices.Protocols.DirectoryControl + { + public VerifyNameControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public VerifyNameControl(string serverName) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public VerifyNameControl(string serverName, int flag) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public int Flag { get { throw null; } set { } } + public string ServerName { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public delegate bool VerifyServerCertificateCallback(System.DirectoryServices.Protocols.LdapConnection connection, System.Security.Cryptography.X509Certificates.X509Certificate certificate); + public partial class VlvRequestControl : System.DirectoryServices.Protocols.DirectoryControl + { + public VlvRequestControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public VlvRequestControl(int beforeCount, int afterCount, byte[] target) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public VlvRequestControl(int beforeCount, int afterCount, int offset) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public VlvRequestControl(int beforeCount, int afterCount, string target) : base (default(string), default(byte[]), default(bool), default(bool)) { } + public int AfterCount { get { throw null; } set { } } + public int BeforeCount { get { throw null; } set { } } + public byte[] ContextId { get { throw null; } set { } } + public int EstimateCount { get { throw null; } set { } } + public int Offset { get { throw null; } set { } } + public byte[] Target { get { throw null; } set { } } + public override byte[] GetValue() { throw null; } + } + public partial class VlvResponseControl : System.DirectoryServices.Protocols.DirectoryControl + { + internal VlvResponseControl() : base (default(string), default(byte[]), default(bool), default(bool)) { } + public int ContentCount { get { throw null; } } + public byte[] ContextId { get { throw null; } } + public System.DirectoryServices.Protocols.ResultCode Result { get { throw null; } } + public int TargetPosition { get { throw null; } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.DirectoryServices.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.DirectoryServices.cs.REMOVED.git-id new file mode 100644 index 0000000000..e34edcc1ae --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.DirectoryServices.cs.REMOVED.git-id @@ -0,0 +1 @@ +a0e8de3882bc4d6f389208a110e6f7ed5e609eda \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Drawing.Design.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Drawing.Design.cs new file mode 100644 index 0000000000..100f699caf --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Drawing.Design.cs @@ -0,0 +1,199 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Drawing.Design.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Drawing.Design.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Drawing.Design.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +namespace System.Drawing.Design +{ + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + public partial class BitmapEditor : System.Drawing.Design.ImageEditor + { + public BitmapEditor() { } + protected override string[] GetExtensions() { throw null; } + protected override string GetFileDialogDescription() { throw null; } + protected override System.Drawing.Image LoadFromStream(System.IO.Stream stream) { throw null; } + } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + public partial class ColorEditor : System.Drawing.Design.UITypeEditor + { + public ColorEditor() { } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e) { } + } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + public partial class ContentAlignmentEditor : System.Drawing.Design.UITypeEditor + { + public ContentAlignmentEditor() { } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + public partial class CursorEditor : System.Drawing.Design.UITypeEditor + { + public CursorEditor() { } + public override bool IsDropDownResizable { get { throw null; } } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + public partial class FontEditor : System.Drawing.Design.UITypeEditor + { + public FontEditor() { } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + public partial class FontNameEditor : System.Drawing.Design.UITypeEditor + { + public FontNameEditor() { } + public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e) { } + } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + public partial class IconEditor : System.Drawing.Design.UITypeEditor + { + public IconEditor() { } + protected static string CreateExtensionsString(string[] extensions, string sep) { throw null; } + protected static string CreateFilterEntry(System.Drawing.Design.IconEditor e) { throw null; } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + protected virtual string[] GetExtensions() { throw null; } + protected virtual string GetFileDialogDescription() { throw null; } + public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + protected virtual System.Drawing.Icon LoadFromStream(System.IO.Stream stream) { throw null; } + public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e) { } + } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + public partial class ImageEditor : System.Drawing.Design.UITypeEditor + { + public ImageEditor() { } + protected static string CreateExtensionsString(string[] extensions, string sep) { throw null; } + protected static string CreateFilterEntry(System.Drawing.Design.ImageEditor e) { throw null; } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + protected virtual string[] GetExtensions() { throw null; } + protected virtual string GetFileDialogDescription() { throw null; } + protected virtual System.Type[] GetImageExtenders() { throw null; } + public override bool GetPaintValueSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + protected virtual System.Drawing.Image LoadFromStream(System.IO.Stream stream) { throw null; } + public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e) { } + } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(2))] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + public partial class MetafileEditor : System.Drawing.Design.ImageEditor + { + public MetafileEditor() { } + protected override string[] GetExtensions() { throw null; } + protected override string GetFileDialogDescription() { throw null; } + protected override System.Drawing.Image LoadFromStream(System.IO.Stream stream) { throw null; } + } + [System.SerializableAttribute] + public partial class ToolboxItemContainer : System.Runtime.Serialization.ISerializable + { + public ToolboxItemContainer(System.Drawing.Design.ToolboxItem item) { } + protected ToolboxItemContainer(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ToolboxItemContainer(System.Windows.Forms.IDataObject data) { } + public bool IsCreated { get { throw null; } } + public bool IsTransient { get { throw null; } } + public virtual System.Windows.Forms.IDataObject ToolboxData { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public virtual System.Collections.ICollection GetFilter(System.Collections.ICollection creators) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.SecurityCriticalAttribute] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public virtual System.Drawing.Design.ToolboxItem GetToolboxItem(System.Collections.ICollection creators) { throw null; } + [System.Security.SecurityCriticalAttribute] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public void UpdateFilter(System.Drawing.Design.ToolboxItem item) { } + } + public sealed partial class ToolboxItemCreator + { + internal ToolboxItemCreator() { } + public string Format { get { throw null; } } + public System.Drawing.Design.ToolboxItem Create(System.Windows.Forms.IDataObject data) { throw null; } + } + [System.Security.SecurityCriticalAttribute] + public abstract partial class ToolboxService : System.ComponentModel.Design.IComponentDiscoveryService, System.Drawing.Design.IToolboxService + { + protected ToolboxService() { } + protected abstract System.Drawing.Design.CategoryNameCollection CategoryNames { get; } + protected abstract string SelectedCategory { get; set; } + protected abstract System.Drawing.Design.ToolboxItemContainer SelectedItemContainer { get; set; } + System.Drawing.Design.CategoryNameCollection System.Drawing.Design.IToolboxService.CategoryNames { get { throw null; } } + string System.Drawing.Design.IToolboxService.SelectedCategory { get { throw null; } set { } } + protected virtual System.Drawing.Design.ToolboxItemContainer CreateItemContainer(System.Drawing.Design.ToolboxItem item, System.ComponentModel.Design.IDesignerHost link) { throw null; } + protected virtual System.Drawing.Design.ToolboxItemContainer CreateItemContainer(System.Windows.Forms.IDataObject dataObject) { throw null; } + protected virtual void FilterChanged() { } + protected abstract System.Collections.IList GetItemContainers(); + protected abstract System.Collections.IList GetItemContainers(string categoryName); + public static System.Drawing.Design.ToolboxItem GetToolboxItem(System.Type toolType) { throw null; } + public static System.Drawing.Design.ToolboxItem GetToolboxItem(System.Type toolType, bool nonPublic) { throw null; } + public static System.Collections.ICollection GetToolboxItems(System.Reflection.Assembly a, string newCodeBase) { throw null; } + public static System.Collections.ICollection GetToolboxItems(System.Reflection.Assembly a, string newCodeBase, bool throwOnError) { throw null; } + public static System.Collections.ICollection GetToolboxItems(System.Reflection.AssemblyName an) { throw null; } + public static System.Collections.ICollection GetToolboxItems(System.Reflection.AssemblyName an, bool throwOnError) { throw null; } + protected virtual bool IsItemContainer(System.Windows.Forms.IDataObject dataObject, System.ComponentModel.Design.IDesignerHost host) { throw null; } + protected bool IsItemContainerSupported(System.Drawing.Design.ToolboxItemContainer container, System.ComponentModel.Design.IDesignerHost host) { throw null; } + protected abstract void Refresh(); + protected virtual void SelectedItemContainerUsed() { } + protected virtual bool SetCursor() { throw null; } + System.Collections.ICollection System.ComponentModel.Design.IComponentDiscoveryService.GetComponentTypes(System.ComponentModel.Design.IDesignerHost designerHost, System.Type baseType) { throw null; } + void System.Drawing.Design.IToolboxService.AddCreator(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format) { } + void System.Drawing.Design.IToolboxService.AddCreator(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format, System.ComponentModel.Design.IDesignerHost host) { } + void System.Drawing.Design.IToolboxService.AddLinkedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, System.ComponentModel.Design.IDesignerHost host) { } + void System.Drawing.Design.IToolboxService.AddLinkedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category, System.ComponentModel.Design.IDesignerHost host) { } + void System.Drawing.Design.IToolboxService.AddToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem) { } + void System.Drawing.Design.IToolboxService.AddToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category) { } + System.Drawing.Design.ToolboxItem System.Drawing.Design.IToolboxService.DeserializeToolboxItem(object serializedObject) { throw null; } + System.Drawing.Design.ToolboxItem System.Drawing.Design.IToolboxService.DeserializeToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host) { throw null; } + System.Drawing.Design.ToolboxItem System.Drawing.Design.IToolboxService.GetSelectedToolboxItem() { throw null; } + System.Drawing.Design.ToolboxItem System.Drawing.Design.IToolboxService.GetSelectedToolboxItem(System.ComponentModel.Design.IDesignerHost host) { throw null; } + System.Drawing.Design.ToolboxItemCollection System.Drawing.Design.IToolboxService.GetToolboxItems() { throw null; } + System.Drawing.Design.ToolboxItemCollection System.Drawing.Design.IToolboxService.GetToolboxItems(System.ComponentModel.Design.IDesignerHost host) { throw null; } + System.Drawing.Design.ToolboxItemCollection System.Drawing.Design.IToolboxService.GetToolboxItems(string category) { throw null; } + System.Drawing.Design.ToolboxItemCollection System.Drawing.Design.IToolboxService.GetToolboxItems(string category, System.ComponentModel.Design.IDesignerHost host) { throw null; } + bool System.Drawing.Design.IToolboxService.IsSupported(object serializedObject, System.Collections.ICollection filterAttributes) { throw null; } + bool System.Drawing.Design.IToolboxService.IsSupported(object serializedObject, System.ComponentModel.Design.IDesignerHost host) { throw null; } + bool System.Drawing.Design.IToolboxService.IsToolboxItem(object serializedObject) { throw null; } + bool System.Drawing.Design.IToolboxService.IsToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host) { throw null; } + void System.Drawing.Design.IToolboxService.Refresh() { } + void System.Drawing.Design.IToolboxService.RemoveCreator(string format) { } + void System.Drawing.Design.IToolboxService.RemoveCreator(string format, System.ComponentModel.Design.IDesignerHost host) { } + void System.Drawing.Design.IToolboxService.RemoveToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem) { } + void System.Drawing.Design.IToolboxService.RemoveToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem, string category) { } + void System.Drawing.Design.IToolboxService.SelectedToolboxItemUsed() { } + object System.Drawing.Design.IToolboxService.SerializeToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem) { throw null; } + bool System.Drawing.Design.IToolboxService.SetCursor() { throw null; } + void System.Drawing.Design.IToolboxService.SetSelectedToolboxItem(System.Drawing.Design.ToolboxItem toolboxItem) { } + public static void UnloadToolboxItems() { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Drawing.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Drawing.cs.REMOVED.git-id new file mode 100644 index 0000000000..b6df57fc10 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Drawing.cs.REMOVED.git-id @@ -0,0 +1 @@ +90c687c3e1908f3db4d3afad02fabfb65f3c4b49 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Dynamic.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Dynamic.cs new file mode 100644 index 0000000000..90729d8ba2 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Dynamic.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Dynamic.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Dynamic.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Dynamic.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.EnterpriseServices.cs b/external/binary-reference-assemblies/src/v4.7.1/System.EnterpriseServices.cs new file mode 100644 index 0000000000..fc8f6b2b7a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.EnterpriseServices.cs @@ -0,0 +1,992 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.EnterpriseServices.ApplicationIDAttribute("1e246775-2281-484f-8ad4-044c15b86eb7")] +[assembly:System.EnterpriseServices.ApplicationNameAttribute(".NET Utilities")] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.EnterpriseServices.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.EnterpriseServices.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.EnterpriseServices.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(true)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.InteropServices.GuidAttribute("4fb2d46f-efc8-4643-bcd0-6e5bfa6a174c")] +[assembly:System.Runtime.InteropServices.TypeLibVersionAttribute(2, 4)] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.EnterpriseServices +{ + [System.SerializableAttribute] + public enum AccessChecksLevelOption + { + Application = 0, + ApplicationComponent = 1, + } + [System.SerializableAttribute] + public enum ActivationOption + { + Library = 0, + Server = 1, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class Activity + { + public Activity(System.EnterpriseServices.ServiceConfig cfg) { } + public void AsynchronousCall(System.EnterpriseServices.IServiceCall serviceCall) { } + public void BindToCurrentThread() { } + public void SynchronousCall(System.EnterpriseServices.IServiceCall serviceCall) { } + public void UnbindFromThread() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ApplicationAccessControlAttribute : System.Attribute + { + public ApplicationAccessControlAttribute() { } + public ApplicationAccessControlAttribute(bool val) { } + public System.EnterpriseServices.AccessChecksLevelOption AccessChecksLevel { get { throw null; } set { } } + public System.EnterpriseServices.AuthenticationOption Authentication { get { throw null; } set { } } + public System.EnterpriseServices.ImpersonationLevelOption ImpersonationLevel { get { throw null; } set { } } + public bool Value { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ApplicationActivationAttribute : System.Attribute + { + public ApplicationActivationAttribute(System.EnterpriseServices.ActivationOption opt) { } + public string SoapMailbox { get { throw null; } set { } } + public string SoapVRoot { get { throw null; } set { } } + public System.EnterpriseServices.ActivationOption Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ApplicationIDAttribute : System.Attribute + { + public ApplicationIDAttribute(string guid) { } + public System.Guid Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ApplicationNameAttribute : System.Attribute + { + public ApplicationNameAttribute(string name) { } + public string Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ApplicationQueuingAttribute : System.Attribute + { + public ApplicationQueuingAttribute() { } + public bool Enabled { get { throw null; } set { } } + public int MaxListenerThreads { get { throw null; } set { } } + public bool QueueListenerEnabled { get { throw null; } set { } } + } + [System.SerializableAttribute] + public enum AuthenticationOption + { + Call = 3, + Connect = 2, + Default = 0, + Integrity = 5, + None = 1, + Packet = 4, + Privacy = 6, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class AutoCompleteAttribute : System.Attribute + { + public AutoCompleteAttribute() { } + public AutoCompleteAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum BindingOption + { + BindingToPoolThread = 1, + NoBinding = 0, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=1)] + public partial struct BOID + { + [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray)] + public byte[] rgb; + } + public sealed partial class BYOT + { + internal BYOT() { } + public static object CreateWithTipTransaction(string url, System.Type t) { throw null; } + public static object CreateWithTransaction(object transaction, System.Type t) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ComponentAccessControlAttribute : System.Attribute + { + public ComponentAccessControlAttribute() { } + public ComponentAccessControlAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class COMTIIntrinsicsAttribute : System.Attribute + { + public COMTIIntrinsicsAttribute() { } + public COMTIIntrinsicsAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ConstructionEnabledAttribute : System.Attribute + { + public ConstructionEnabledAttribute() { } + public ConstructionEnabledAttribute(bool val) { } + public string Default { get { throw null; } set { } } + public bool Enabled { get { throw null; } set { } } + } + public sealed partial class ContextUtil + { + internal ContextUtil() { } + public static System.Guid ActivityId { get { throw null; } } + public static System.Guid ApplicationId { get { throw null; } } + public static System.Guid ApplicationInstanceId { get { throw null; } } + public static System.Guid ContextId { get { throw null; } } + public static bool DeactivateOnReturn { get { throw null; } set { } } + public static bool IsInTransaction { get { throw null; } } + public static bool IsSecurityEnabled { get { throw null; } } + public static System.EnterpriseServices.TransactionVote MyTransactionVote { get { throw null; } set { } } + public static System.Guid PartitionId { get { throw null; } } + public static System.Transactions.Transaction SystemTransaction { get { throw null; } } + public static object Transaction { get { throw null; } } + public static System.Guid TransactionId { get { throw null; } } + public static void DisableCommit() { } + public static void EnableCommit() { } + public static object GetNamedProperty(string name) { throw null; } + public static bool IsCallerInRole(string role) { throw null; } + public static bool IsDefaultContext() { throw null; } + public static void SetAbort() { } + public static void SetComplete() { } + public static void SetNamedProperty(string name, object value) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1093), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class DescriptionAttribute : System.Attribute + { + public DescriptionAttribute(string desc) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class EventClassAttribute : System.Attribute + { + public EventClassAttribute() { } + public bool AllowInprocSubscribers { get { throw null; } set { } } + public bool FireInParallel { get { throw null; } set { } } + public string PublisherFilter { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class EventTrackingEnabledAttribute : System.Attribute + { + public EventTrackingEnabledAttribute() { } + public EventTrackingEnabledAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ExceptionClassAttribute : System.Attribute + { + public ExceptionClassAttribute(string name) { } + public string Value { get { throw null; } } + } + [System.Runtime.InteropServices.GuidAttribute("FE6777FB-A674-4177-8F32-6D707E113484")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IAsyncErrorNotify + { + void OnError(int hresult); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class IISIntrinsicsAttribute : System.Attribute + { + public IISIntrinsicsAttribute() { } + public IISIntrinsicsAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.SerializableAttribute] + public enum ImpersonationLevelOption + { + Anonymous = 1, + Default = 0, + Delegate = 4, + Identify = 2, + Impersonate = 3, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum InheritanceOption + { + Ignore = 1, + Inherit = 0, + } + [System.FlagsAttribute] + [System.SerializableAttribute] + public enum InstallationFlags + { + Configure = 1024, + ConfigureComponentsOnly = 16, + CreateTargetApplication = 2, + Default = 0, + ExpectExistingTypeLib = 1, + FindOrCreateTargetApplication = 4, + Install = 512, + ReconfigureExistingApplication = 8, + Register = 256, + ReportWarningsToConsole = 32, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1028), Inherited=true, AllowMultiple=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class InterfaceQueuingAttribute : System.Attribute + { + public InterfaceQueuingAttribute() { } + public InterfaceQueuingAttribute(bool enabled) { } + public bool Enabled { get { throw null; } set { } } + public string Interface { get { throw null; } set { } } + } + [System.Runtime.InteropServices.GuidAttribute("51372AFD-CAE7-11CF-BE81-00AA00A2FA25")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IPlaybackControl + { + void FinalClientRetry(); + void FinalServerRetry(); + } + [System.Runtime.InteropServices.GuidAttribute("72380d55-8d2b-43a3-8513-2b6ef31434e9")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IProcessInitControl + { + void ResetInitializerTimeout(int dwSecondsRemaining); + } + [System.Runtime.InteropServices.GuidAttribute("1113f52d-dc7f-4943-aed6-88d04027e32a")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IProcessInitializer + { + void Shutdown(); + void Startup([System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IUnknown)]object punkProcessControl); + } + [System.Runtime.InteropServices.GuidAttribute("55e3ea25-55cb-4650-8887-18e8d30bb4bc")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IRegistrationHelper + { + void InstallAssembly([System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string assembly, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.Out][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]ref string application, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.Out][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]ref string tlb, [System.Runtime.InteropServices.In]System.EnterpriseServices.InstallationFlags installFlags); + void UninstallAssembly([System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string assembly, [System.Runtime.InteropServices.In][System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string application); + } + [System.Runtime.InteropServices.GuidAttribute("6619a740-8154-43be-a186-0319578e02db")] + public partial interface IRemoteDispatch + { + [System.EnterpriseServices.AutoCompleteAttribute(true)] + string RemoteDispatchAutoDone(string s); + [System.EnterpriseServices.AutoCompleteAttribute(false)] + string RemoteDispatchNotAutoDone(string s); + } + [System.Runtime.InteropServices.GuidAttribute("BD3E2E12-42DD-40f4-A09A-95A50C58304B")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IServiceCall + { + void OnCall(); + } + [System.Runtime.InteropServices.GuidAttribute("8165B19E-8D3A-4d0b-80C8-97DE310DB583")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IServicedComponentInfo + { + void GetComponentInfo(ref int infoMask, out string[] infoArray); + } + [System.Runtime.InteropServices.GuidAttribute("0FB15084-AF41-11CE-BD2B-204C4F4F5020")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface ITransaction + { + void Abort(ref System.EnterpriseServices.BOID pboidReason, int fRetaining, int fAsync); + void Commit(int fRetaining, int grfTC, int grfRM); + void GetTransactionInfo(out System.EnterpriseServices.XACTTRANSINFO pinfo); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class JustInTimeActivationAttribute : System.Attribute + { + public JustInTimeActivationAttribute() { } + public JustInTimeActivationAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class LoadBalancingSupportedAttribute : System.Attribute + { + public LoadBalancingSupportedAttribute() { } + public LoadBalancingSupportedAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class MustRunInClientContextAttribute : System.Attribute + { + public MustRunInClientContextAttribute() { } + public MustRunInClientContextAttribute(bool val) { } + public bool Value { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ObjectPoolingAttribute : System.Attribute + { + public ObjectPoolingAttribute() { } + public ObjectPoolingAttribute(bool enable) { } + public ObjectPoolingAttribute(bool enable, int minPoolSize, int maxPoolSize) { } + public ObjectPoolingAttribute(int minPoolSize, int maxPoolSize) { } + public int CreationTimeout { get { throw null; } set { } } + public bool Enabled { get { throw null; } set { } } + public int MaxPoolSize { get { throw null; } set { } } + public int MinPoolSize { get { throw null; } set { } } + public bool AfterSaveChanges(System.Collections.Hashtable info) { throw null; } + public bool Apply(System.Collections.Hashtable info) { throw null; } + public bool IsValidTarget(string s) { throw null; } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum PartitionOption + { + Ignore = 0, + Inherit = 1, + New = 2, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class PrivateComponentAttribute : System.Attribute + { + public PrivateComponentAttribute() { } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum PropertyLockMode + { + Method = 1, + SetGet = 0, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum PropertyReleaseMode + { + Process = 1, + Standard = 0, + } + [System.Runtime.InteropServices.GuidAttribute("36dcda30-dc3b-4d93-be42-90b2d74c64e7")] + [System.SerializableAttribute] + public partial class RegistrationConfig + { + public RegistrationConfig() { } + public string Application { get { throw null; } set { } } + public string ApplicationRootDirectory { get { throw null; } set { } } + public string AssemblyFile { get { throw null; } set { } } + public System.EnterpriseServices.InstallationFlags InstallationFlags { get { throw null; } set { } } + public string Partition { get { throw null; } set { } } + public string TypeLibrary { get { throw null; } set { } } + } + [System.SerializableAttribute] + public sealed partial class RegistrationErrorInfo + { + internal RegistrationErrorInfo() { } + public int ErrorCode { get { throw null; } } + public string ErrorString { get { throw null; } } + public string MajorRef { get { throw null; } } + public string MinorRef { get { throw null; } } + public string Name { get { throw null; } } + } + [System.SerializableAttribute] + public sealed partial class RegistrationException : System.SystemException + { + public RegistrationException() { } + public RegistrationException(string msg) { } + public RegistrationException(string msg, System.Exception inner) { } + public System.EnterpriseServices.RegistrationErrorInfo[] ErrorInfo { get { throw null; } } + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx) { } + } + [System.Runtime.InteropServices.GuidAttribute("89a86e7b-c229-4008-9baa-2f5c8411d7e0")] + public sealed partial class RegistrationHelper : System.MarshalByRefObject, System.EnterpriseServices.IRegistrationHelper + { + public RegistrationHelper() { } + public void InstallAssembly(string assembly, ref string application, string partition, ref string tlb, System.EnterpriseServices.InstallationFlags installFlags) { } + public void InstallAssembly(string assembly, ref string application, ref string tlb, System.EnterpriseServices.InstallationFlags installFlags) { } + public void InstallAssemblyFromConfig([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IUnknown)]ref System.EnterpriseServices.RegistrationConfig regConfig) { } + public void UninstallAssembly(string assembly, string application) { } + public void UninstallAssembly(string assembly, string application, string partition) { } + public void UninstallAssemblyFromConfig([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IUnknown)]ref System.EnterpriseServices.RegistrationConfig regConfig) { } + } + [System.EnterpriseServices.TransactionAttribute((System.EnterpriseServices.TransactionOption)(4))] + [System.ObsoleteAttribute("The RegistrationHelperTx class has been deprecated.")] + [System.Runtime.InteropServices.GuidAttribute("c89ac250-e18a-4fc7-abd5-b8897b6a78a5")] + public sealed partial class RegistrationHelperTx : System.EnterpriseServices.ServicedComponent + { + public RegistrationHelperTx() { } + protected internal override void Activate() { } + protected internal override void Deactivate() { } + public void InstallAssembly(string assembly, ref string application, string partition, ref string tlb, System.EnterpriseServices.InstallationFlags installFlags, object sync) { } + public void InstallAssembly(string assembly, ref string application, ref string tlb, System.EnterpriseServices.InstallationFlags installFlags, object sync) { } + public void InstallAssemblyFromConfig([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IUnknown)]ref System.EnterpriseServices.RegistrationConfig regConfig, object sync) { } + public bool IsInTransaction() { throw null; } + public void UninstallAssembly(string assembly, string application, object sync) { } + public void UninstallAssembly(string assembly, string application, string partition, object sync) { } + public void UninstallAssemblyFromConfig([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IUnknown)]ref System.EnterpriseServices.RegistrationConfig regConfig, object sync) { } + } + public sealed partial class ResourcePool + { + public ResourcePool(System.EnterpriseServices.ResourcePool.TransactionEndDelegate cb) { } + public object GetResource() { throw null; } + public bool PutResource(object resource) { throw null; } + public delegate void TransactionEndDelegate(object resource); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(68), Inherited=true, AllowMultiple=false)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class SecureMethodAttribute : System.Attribute + { + public SecureMethodAttribute() { } + } + public sealed partial class SecurityCallContext + { + internal SecurityCallContext() { } + public System.EnterpriseServices.SecurityCallers Callers { get { throw null; } } + public static System.EnterpriseServices.SecurityCallContext CurrentCall { get { throw null; } } + public System.EnterpriseServices.SecurityIdentity DirectCaller { get { throw null; } } + public bool IsSecurityEnabled { get { throw null; } } + public int MinAuthenticationLevel { get { throw null; } } + public int NumCallers { get { throw null; } } + public System.EnterpriseServices.SecurityIdentity OriginalCaller { get { throw null; } } + public bool IsCallerInRole(string role) { throw null; } + public bool IsUserInRole(string user, string role) { throw null; } + } + public sealed partial class SecurityCallers : System.Collections.IEnumerable + { + internal SecurityCallers() { } + public int Count { get { throw null; } } + public System.EnterpriseServices.SecurityIdentity this[int idx] { get { throw null; } } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + } + public sealed partial class SecurityIdentity + { + internal SecurityIdentity() { } + public string AccountName { get { throw null; } } + public System.EnterpriseServices.AuthenticationOption AuthenticationLevel { get { throw null; } } + public int AuthenticationService { get { throw null; } } + public System.EnterpriseServices.ImpersonationLevelOption ImpersonationLevel { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1093), Inherited=true, AllowMultiple=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class SecurityRoleAttribute : System.Attribute + { + public SecurityRoleAttribute(string role) { } + public SecurityRoleAttribute(string role, bool everyone) { } + public string Description { get { throw null; } set { } } + public string Role { get { throw null; } set { } } + public bool SetEveryoneAccess { get { throw null; } set { } } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ServiceConfig + { + public ServiceConfig() { } + public System.EnterpriseServices.BindingOption Binding { get { throw null; } set { } } + public System.Transactions.Transaction BringYourOwnSystemTransaction { get { throw null; } set { } } + public System.EnterpriseServices.ITransaction BringYourOwnTransaction { get { throw null; } set { } } + public bool COMTIIntrinsicsEnabled { get { throw null; } set { } } + public bool IISIntrinsicsEnabled { get { throw null; } set { } } + public System.EnterpriseServices.InheritanceOption Inheritance { get { throw null; } set { } } + public System.EnterpriseServices.TransactionIsolationLevel IsolationLevel { get { throw null; } set { } } + public System.Guid PartitionId { get { throw null; } set { } } + public System.EnterpriseServices.PartitionOption PartitionOption { get { throw null; } set { } } + public string SxsDirectory { get { throw null; } set { } } + public string SxsName { get { throw null; } set { } } + public System.EnterpriseServices.SxsOption SxsOption { get { throw null; } set { } } + public System.EnterpriseServices.SynchronizationOption Synchronization { get { throw null; } set { } } + public System.EnterpriseServices.ThreadPoolOption ThreadPool { get { throw null; } set { } } + public string TipUrl { get { throw null; } set { } } + public string TrackingAppName { get { throw null; } set { } } + public string TrackingComponentName { get { throw null; } set { } } + public bool TrackingEnabled { get { throw null; } set { } } + public System.EnterpriseServices.TransactionOption Transaction { get { throw null; } set { } } + public string TransactionDescription { get { throw null; } set { } } + public int TransactionTimeout { get { throw null; } set { } } + } + [System.SerializableAttribute] + public abstract partial class ServicedComponent : System.ContextBoundObject, System.EnterpriseServices.IRemoteDispatch, System.EnterpriseServices.IServicedComponentInfo, System.IDisposable + { + public ServicedComponent() { } + protected internal virtual void Activate() { } + protected internal virtual bool CanBePooled() { throw null; } + protected internal virtual void Construct(string s) { } + protected internal virtual void Deactivate() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public static void DisposeObject(System.EnterpriseServices.ServicedComponent sc) { } + [System.EnterpriseServices.AutoCompleteAttribute(true)] + string System.EnterpriseServices.IRemoteDispatch.RemoteDispatchAutoDone(string s) { throw null; } + [System.EnterpriseServices.AutoCompleteAttribute(false)] + string System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(string s) { throw null; } + void System.EnterpriseServices.IServicedComponentInfo.GetComponentInfo(ref int infoMask, out string[] infoArray) { infoArray = default(string[]); } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public sealed partial class ServicedComponentException : System.SystemException + { + public ServicedComponentException() { } + public ServicedComponentException(string message) { } + public ServicedComponentException(string message, System.Exception innerException) { } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class ServiceDomain + { + internal ServiceDomain() { } + public static void Enter(System.EnterpriseServices.ServiceConfig cfg) { } + public static System.EnterpriseServices.TransactionStatus Leave() { throw null; } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class SharedProperty + { + internal SharedProperty() { } + public object Value { get { throw null; } set { } } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class SharedPropertyGroup + { + internal SharedPropertyGroup() { } + public System.EnterpriseServices.SharedProperty CreateProperty(string name, out bool fExists) { fExists = default(bool); throw null; } + public System.EnterpriseServices.SharedProperty CreatePropertyByPosition(int position, out bool fExists) { fExists = default(bool); throw null; } + public System.EnterpriseServices.SharedProperty Property(string name) { throw null; } + public System.EnterpriseServices.SharedProperty PropertyByPosition(int position) { throw null; } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class SharedPropertyGroupManager : System.Collections.IEnumerable + { + public SharedPropertyGroupManager() { } + public System.EnterpriseServices.SharedPropertyGroup CreatePropertyGroup(string name, ref System.EnterpriseServices.PropertyLockMode dwIsoMode, ref System.EnterpriseServices.PropertyReleaseMode dwRelMode, out bool fExist) { fExist = default(bool); throw null; } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public System.EnterpriseServices.SharedPropertyGroup Group(string name) { throw null; } + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum SxsOption + { + Ignore = 0, + Inherit = 1, + New = 2, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class SynchronizationAttribute : System.Attribute + { + public SynchronizationAttribute() { } + public SynchronizationAttribute(System.EnterpriseServices.SynchronizationOption val) { } + public System.EnterpriseServices.SynchronizationOption Value { get { throw null; } } + } + [System.SerializableAttribute] + public enum SynchronizationOption + { + Disabled = 0, + NotSupported = 1, + Required = 3, + RequiresNew = 4, + Supported = 2, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum ThreadPoolOption + { + Inherit = 1, + MTA = 3, + None = 0, + STA = 2, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public sealed partial class TransactionAttribute : System.Attribute + { + public TransactionAttribute() { } + public TransactionAttribute(System.EnterpriseServices.TransactionOption val) { } + public System.EnterpriseServices.TransactionIsolationLevel Isolation { get { throw null; } set { } } + public int Timeout { get { throw null; } set { } } + public System.EnterpriseServices.TransactionOption Value { get { throw null; } } + } + [System.SerializableAttribute] + public enum TransactionIsolationLevel + { + Any = 0, + ReadCommitted = 2, + ReadUncommitted = 1, + RepeatableRead = 3, + Serializable = 4, + } + [System.SerializableAttribute] + public enum TransactionOption + { + Disabled = 0, + NotSupported = 1, + Required = 3, + RequiresNew = 4, + Supported = 2, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum TransactionStatus + { + Aborted = 4, + Aborting = 3, + Commited = 0, + LocallyOk = 1, + NoTransaction = 2, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.SerializableAttribute] + public enum TransactionVote + { + Abort = 1, + Commit = 0, + } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Pack=4)] + public partial struct XACTTRANSINFO + { + public int grfRMSupported; + public int grfRMSupportedRetaining; + public int grfTCSupported; + public int grfTCSupportedRetaining; + public int isoFlags; + public int isoLevel; + public System.EnterpriseServices.BOID uow; + } +} +namespace System.EnterpriseServices.CompensatingResourceManager +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=true)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.Runtime.InteropServices.ProgIdAttribute("System.EnterpriseServices.Crm.ApplicationCrmEnabledAttribute")] + public sealed partial class ApplicationCrmEnabledAttribute : System.Attribute + { + public ApplicationCrmEnabledAttribute() { } + public ApplicationCrmEnabledAttribute(bool val) { } + public bool Value { get { throw null; } } + } + public sealed partial class Clerk + { + public Clerk(string compensator, string description, System.EnterpriseServices.CompensatingResourceManager.CompensatorOptions flags) { } + public Clerk(System.Type compensator, string description, System.EnterpriseServices.CompensatingResourceManager.CompensatorOptions flags) { } + public int LogRecordCount { get { throw null; } } + public string TransactionUOW { get { throw null; } } + ~Clerk() { } + public void ForceLog() { } + public void ForceTransactionToAbort() { } + public void ForgetLogRecord() { } + public void WriteLogRecord(object record) { } + } + public sealed partial class ClerkInfo + { + internal ClerkInfo() { } + public string ActivityId { get { throw null; } } + public System.EnterpriseServices.CompensatingResourceManager.Clerk Clerk { get { throw null; } } + public string Compensator { get { throw null; } } + public string Description { get { throw null; } } + public string InstanceId { get { throw null; } } + public string TransactionUOW { get { throw null; } } + ~ClerkInfo() { } + } + public sealed partial class ClerkMonitor : System.Collections.IEnumerable + { + public ClerkMonitor() { } + public int Count { get { throw null; } } + public System.EnterpriseServices.CompensatingResourceManager.ClerkInfo this[int index] { get { throw null; } } + public System.EnterpriseServices.CompensatingResourceManager.ClerkInfo this[string index] { get { throw null; } } + ~ClerkMonitor() { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void Populate() { } + } + public partial class Compensator : System.EnterpriseServices.ServicedComponent + { + public Compensator() { } + public System.EnterpriseServices.CompensatingResourceManager.Clerk Clerk { get { throw null; } } + public virtual bool AbortRecord(System.EnterpriseServices.CompensatingResourceManager.LogRecord rec) { throw null; } + public virtual void BeginAbort(bool fRecovery) { } + public virtual void BeginCommit(bool fRecovery) { } + public virtual void BeginPrepare() { } + public virtual bool CommitRecord(System.EnterpriseServices.CompensatingResourceManager.LogRecord rec) { throw null; } + public virtual void EndAbort() { } + public virtual void EndCommit() { } + public virtual bool EndPrepare() { throw null; } + public virtual bool PrepareRecord(System.EnterpriseServices.CompensatingResourceManager.LogRecord rec) { throw null; } + } + [System.FlagsAttribute] + [System.SerializableAttribute] + public enum CompensatorOptions + { + AbortPhase = 4, + AllPhases = 7, + CommitPhase = 2, + FailIfInDoubtsRemain = 16, + PreparePhase = 1, + } + public sealed partial class LogRecord + { + internal LogRecord() { } + public System.EnterpriseServices.CompensatingResourceManager.LogRecordFlags Flags { get { throw null; } } + public object Record { get { throw null; } } + public int Sequence { get { throw null; } } + } + [System.FlagsAttribute] + [System.SerializableAttribute] + public enum LogRecordFlags + { + ForgetTarget = 1, + ReplayInProgress = 64, + WrittenDuringAbort = 8, + WrittenDuringCommit = 4, + WrittenDuringPrepare = 2, + WrittenDuringReplay = 32, + WrittenDurringRecovery = 16, + } + [System.SerializableAttribute] + public enum TransactionState + { + Aborted = 2, + Active = 0, + Committed = 1, + Indoubt = 3, + } +} +namespace System.EnterpriseServices.Internal +{ + [System.Runtime.InteropServices.GuidAttribute("ef24f689-14f8-4d92-b4af-d7b1f0e70fd4")] + public partial class AppDomainHelper + { + public AppDomainHelper() { } + ~AppDomainHelper() { } + } + [System.Runtime.InteropServices.GuidAttribute("458aa3b5-265a-4b75-bc05-9bea4630cf18")] + public partial class AssemblyLocator : System.MarshalByRefObject + { + public AssemblyLocator() { } + } + public partial class ClientRemotingConfig + { + public ClientRemotingConfig() { } + public static bool Write(string DestinationDirectory, string VRoot, string BaseUrl, string AssemblyName, string TypeName, string ProgId, string Mode, string Transport) { throw null; } + } + [System.Runtime.InteropServices.GuidAttribute("ecabafd1-7f19-11d2-978e-0000f8757e2a")] + public partial class ClrObjectFactory : System.EnterpriseServices.Internal.IClrObjectFactory + { + public ClrObjectFactory() { } + public object CreateFromAssembly(string AssemblyName, string TypeName, string Mode) { throw null; } + public object CreateFromMailbox(string Mailbox, string Mode) { throw null; } + public object CreateFromVroot(string VrootUrl, string Mode) { throw null; } + public object CreateFromWsdl(string WsdlUrl, string Mode) { throw null; } + } + [System.Runtime.InteropServices.GuidAttribute("3b0398c9-7812-4007-85cb-18c771f2206f")] + public partial class ComManagedImportUtil : System.EnterpriseServices.Internal.IComManagedImportUtil + { + public ComManagedImportUtil() { } + public void GetComponentInfo(string assemblyPath, out string numComponents, out string componentInfo) { numComponents = default(string); componentInfo = default(string); } + public void InstallAssembly(string asmpath, string parname, string appname) { } + } + public partial class ComSoapPublishError + { + public ComSoapPublishError() { } + public static void Report(string s) { } + } + [System.Runtime.InteropServices.GuidAttribute("d8013ff1-730b-45e2-ba24-874b7242c425")] + public partial class GenerateMetadata : System.EnterpriseServices.Internal.IComSoapMetadata + { + public GenerateMetadata() { } + public string Generate(string strSrcTypeLib, string outPath) { throw null; } + public string GenerateMetaData(string strSrcTypeLib, string outPath, byte[] PublicKey, System.Reflection.StrongNameKeyPair KeyPair) { throw null; } + public string GenerateSigned(string strSrcTypeLib, string outPath, bool InstallGac, out string Error) { Error = default(string); throw null; } + [System.Runtime.InteropServices.DllImport("kernel32.dll")][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]public static extern int SearchPath(string path, string fileName, string extension, int numBufferChars, string buffer, int[] filePart); + } + [System.Runtime.InteropServices.GuidAttribute("ecabafd2-7f19-11d2-978e-0000f8757e2a")] + public partial interface IClrObjectFactory + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IDispatch)] + object CreateFromAssembly(string assembly, string type, string mode); + [System.Runtime.InteropServices.DispIdAttribute(4)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IDispatch)] + object CreateFromMailbox(string Mailbox, string Mode); + [System.Runtime.InteropServices.DispIdAttribute(2)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IDispatch)] + object CreateFromVroot(string VrootUrl, string Mode); + [System.Runtime.InteropServices.DispIdAttribute(3)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IDispatch)] + object CreateFromWsdl(string WsdlUrl, string Mode); + } + [System.Runtime.InteropServices.GuidAttribute("c3f8f66b-91be-4c99-a94f-ce3b0a951039")] + public partial interface IComManagedImportUtil + { + [System.Runtime.InteropServices.DispIdAttribute(4)] + void GetComponentInfo([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string assemblyPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string numComponents, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string componentInfo); + [System.Runtime.InteropServices.DispIdAttribute(5)] + void InstallAssembly([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string filename, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string parname, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string appname); + } + [System.Runtime.InteropServices.GuidAttribute("d8013ef0-730b-45e2-ba24-874b7242c425")] + public partial interface IComSoapIISVRoot + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + void Create([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string RootWeb, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string PhysicalDirectory, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string VirtualDirectory, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(2)] + void Delete([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string RootWeb, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string PhysicalDirectory, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string VirtualDirectory, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + } + [System.Runtime.InteropServices.GuidAttribute("d8013ff0-730b-45e2-ba24-874b7242c425")] + public partial interface IComSoapMetadata + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)] + string Generate([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string SrcTypeLibFileName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string OutPath); + [System.Runtime.InteropServices.DispIdAttribute(2)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)] + string GenerateSigned([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string SrcTypeLibFileName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string OutPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]bool InstallGac, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + } + [System.Runtime.InteropServices.GuidAttribute("d8013eee-730b-45e2-ba24-874b7242c425")] + public partial interface IComSoapPublisher + { + [System.Runtime.InteropServices.DispIdAttribute(6)] + void CreateMailBox([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string RootMailServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string MailBox, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string SmtpName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Domain, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string PhysicalPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(4)] + void CreateVirtualRoot([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string Operation, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string FullUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string BaseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string VirtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string PhysicalPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(7)] + void DeleteMailBox([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string RootMailServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string MailBox, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(5)] + void DeleteVirtualRoot([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string RootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string FullUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(13)] + void GacInstall([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string AssemblyPath); + [System.Runtime.InteropServices.DispIdAttribute(14)] + void GacRemove([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string AssemblyPath); + [System.Runtime.InteropServices.DispIdAttribute(15)] + void GetAssemblyNameForCache([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string TypeLibPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string CachePath); + [System.Runtime.InteropServices.DispIdAttribute(10)] + [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)] + string GetTypeNameFromProgId([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string AssemblyPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string ProgId); + [System.Runtime.InteropServices.DispIdAttribute(9)] + void ProcessClientTlb([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string ProgId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string SrcTlbPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string PhysicalPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string VRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string BaseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string Mode, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string Transport, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string AssemblyName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string TypeName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(8)] + void ProcessServerTlb([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string ProgId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string SrcTlbPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string PhysicalPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string Operation, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string AssemblyName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string TypeName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(11)] + void RegisterAssembly([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string AssemblyPath); + [System.Runtime.InteropServices.DispIdAttribute(12)] + void UnRegisterAssembly([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string AssemblyPath); + } + [System.Runtime.InteropServices.GuidAttribute("d8013ef1-730b-45e2-ba24-874b7242c425")] + public partial class IISVirtualRoot : System.EnterpriseServices.Internal.IComSoapIISVRoot + { + public IISVirtualRoot() { } + public void Create(string RootWeb, string inPhysicalDirectory, string VirtualDirectory, out string Error) { Error = default(string); } + public void Delete(string RootWeb, string PhysicalDirectory, string VirtualDirectory, out string Error) { Error = default(string); } + } + [System.Runtime.InteropServices.GuidAttribute("6261e4b5-572a-4142-a2f9-1fe1a0c97097")] + public partial interface IServerWebConfig + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + void AddElement([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string FilePath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string AssemblyName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string TypeName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string ProgId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string Mode, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + [System.Runtime.InteropServices.DispIdAttribute(2)] + void Create([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string FilePath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string FileRootName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string Error); + } + [System.Runtime.InteropServices.GuidAttribute("E7F0F021-9201-47e4-94DA-1D1416DEC27A")] + public partial interface ISoapClientImport + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + void ProcessClientTlbEx([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string progId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string virtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string baseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string authentication, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string assemblyName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string typeName); + } + [System.Runtime.InteropServices.GuidAttribute("1E7BA9F7-21DB-4482-929E-21BDE2DFE51C")] + public partial interface ISoapServerTlb + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + void AddServerTlb([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string progId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string classId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string interfaceId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string srcTlbPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string baseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string virtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string clientActivated, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string wellKnown, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string discoFile, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string operation, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string assemblyName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string typeName); + [System.Runtime.InteropServices.DispIdAttribute(2)] + void DeleteServerTlb([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string progId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string classId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string interfaceId, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string srcTlbPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string baseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string virtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string operation, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string assemblyName, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string typeName); + } + [System.Runtime.InteropServices.GuidAttribute("A31B6577-71D2-4344-AEDF-ADC1B0DC5347")] + public partial interface ISoapServerVRoot + { + [System.Runtime.InteropServices.DispIdAttribute(1)] + void CreateVirtualRootEx([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inBaseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inVirtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string homePage, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string discoFile, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string secureSockets, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string authentication, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string operation, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string baseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string virtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string physicalPath); + [System.Runtime.InteropServices.DispIdAttribute(2)] + void DeleteVirtualRootEx([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string baseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string virtualRoot); + [System.Runtime.InteropServices.DispIdAttribute(3)] + void GetVirtualRootStatus([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inBaseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inVirtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string exists, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string secureSockets, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string windowsAuth, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string anonymous, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string homePage, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string discoFile, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string physicalPath, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string baseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string virtualRoot); + } + [System.Runtime.InteropServices.GuidAttribute("5AC4CB7E-F89F-429b-926B-C7F940936BF4")] + public partial interface ISoapUtility + { + [System.Runtime.InteropServices.DispIdAttribute(2)] + void GetServerBinPath([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inBaseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inVirtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string binPath); + [System.Runtime.InteropServices.DispIdAttribute(1)] + void GetServerPhysicalPath([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string rootWebServer, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inBaseUrl, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]string inVirtualRoot, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]out string physicalPath); + [System.Runtime.InteropServices.DispIdAttribute(3)] + void Present(); + } + [System.Runtime.InteropServices.GuidAttribute("d8013eef-730b-45e2-ba24-874b7242c425")] + public partial class Publish : System.EnterpriseServices.Internal.IComSoapPublisher + { + public Publish() { } + public void CreateMailBox(string RootMailServer, string MailBox, out string SmtpName, out string Domain, out string PhysicalPath, out string Error) { SmtpName = default(string); Domain = default(string); PhysicalPath = default(string); Error = default(string); } + public void CreateVirtualRoot(string Operation, string FullUrl, out string BaseUrl, out string VirtualRoot, out string PhysicalPath, out string Error) { BaseUrl = default(string); VirtualRoot = default(string); PhysicalPath = default(string); Error = default(string); } + public void DeleteMailBox(string RootMailServer, string MailBox, out string Error) { Error = default(string); } + public void DeleteVirtualRoot(string RootWebServer, string FullUrl, out string Error) { Error = default(string); } + public void GacInstall(string AssemblyPath) { } + public void GacRemove(string AssemblyPath) { } + public void GetAssemblyNameForCache(string TypeLibPath, out string CachePath) { CachePath = default(string); } + public static string GetClientPhysicalPath(bool CreateDir) { throw null; } + public string GetTypeNameFromProgId(string AssemblyPath, string ProgId) { throw null; } + public static void ParseUrl(string FullUrl, out string BaseUrl, out string VirtualRoot) { BaseUrl = default(string); VirtualRoot = default(string); } + public void ProcessClientTlb(string ProgId, string SrcTlbPath, string PhysicalPath, string VRoot, string BaseUrl, string Mode, string Transport, out string AssemblyName, out string TypeName, out string Error) { AssemblyName = default(string); TypeName = default(string); Error = default(string); } + public void ProcessServerTlb(string ProgId, string SrcTlbPath, string PhysicalPath, string Operation, out string strAssemblyName, out string TypeName, out string Error) { strAssemblyName = default(string); TypeName = default(string); Error = default(string); } + public void RegisterAssembly(string AssemblyPath) { } + public void UnRegisterAssembly(string AssemblyPath) { } + } + public partial class ServerWebConfig : System.EnterpriseServices.Internal.IServerWebConfig + { + public ServerWebConfig() { } + public void AddElement(string FilePath, string AssemblyName, string TypeName, string ProgId, string WkoMode, out string Error) { Error = default(string); } + public void Create(string FilePath, string FilePrefix, out string Error) { Error = default(string); } + } + [System.Runtime.InteropServices.GuidAttribute("346D5B9F-45E1-45c0-AADF-1B7D221E9063")] + public sealed partial class SoapClientImport : System.EnterpriseServices.Internal.ISoapClientImport + { + public SoapClientImport() { } + public void ProcessClientTlbEx(string progId, string virtualRoot, string baseUrl, string authentication, string assemblyName, string typeName) { } + } + [System.Runtime.InteropServices.GuidAttribute("F6B6768F-F99E-4152-8ED2-0412F78517FB")] + public sealed partial class SoapServerTlb : System.EnterpriseServices.Internal.ISoapServerTlb + { + public SoapServerTlb() { } + public void AddServerTlb(string progId, string classId, string interfaceId, string srcTlbPath, string rootWebServer, string inBaseUrl, string inVirtualRoot, string clientActivated, string wellKnown, string discoFile, string operation, out string strAssemblyName, out string typeName) { strAssemblyName = default(string); typeName = default(string); } + public void DeleteServerTlb(string progId, string classId, string interfaceId, string srcTlbPath, string rootWebServer, string baseUrl, string virtualRoot, string operation, string assemblyName, string typeName) { } + } + [System.Runtime.InteropServices.GuidAttribute("CAA817CC-0C04-4d22-A05C-2B7E162F4E8F")] + public sealed partial class SoapServerVRoot : System.EnterpriseServices.Internal.ISoapServerVRoot + { + public SoapServerVRoot() { } + public void CreateVirtualRootEx(string rootWebServer, string inBaseUrl, string inVirtualRoot, string homePage, string discoFile, string secureSockets, string authentication, string operation, out string baseUrl, out string virtualRoot, out string physicalPath) { baseUrl = default(string); virtualRoot = default(string); physicalPath = default(string); } + public void DeleteVirtualRootEx(string rootWebServer, string inBaseUrl, string inVirtualRoot) { } + public void GetVirtualRootStatus(string RootWebServer, string inBaseUrl, string inVirtualRoot, out string Exists, out string SSL, out string WindowsAuth, out string Anonymous, out string HomePage, out string DiscoFile, out string PhysicalPath, out string BaseUrl, out string VirtualRoot) { Exists = default(string); SSL = default(string); WindowsAuth = default(string); Anonymous = default(string); HomePage = default(string); DiscoFile = default(string); PhysicalPath = default(string); BaseUrl = default(string); VirtualRoot = default(string); } + } + [System.Runtime.InteropServices.GuidAttribute("5F9A955F-AA55-4127-A32B-33496AA8A44E")] + public sealed partial class SoapUtility : System.EnterpriseServices.Internal.ISoapUtility + { + public SoapUtility() { } + public void GetServerBinPath(string rootWebServer, string inBaseUrl, string inVirtualRoot, out string binPath) { binPath = default(string); } + public void GetServerPhysicalPath(string rootWebServer, string inBaseUrl, string inVirtualRoot, out string physicalPath) { physicalPath = default(string); } + public void Present() { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.IO.Compression.FileSystem.cs b/external/binary-reference-assemblies/src/v4.7.1/System.IO.Compression.FileSystem.cs new file mode 100644 index 0000000000..a46d0b10d8 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.IO.Compression.FileSystem.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.FileSystem.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.FileSystem.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.FileSystem.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace System.IO.Compression +{ + public static partial class ZipFile + { + public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName) { } + public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory) { } + public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding) { } + public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName) { } + public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding entryNameEncoding) { } + public static System.IO.Compression.ZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode) { throw null; } + public static System.IO.Compression.ZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode, System.Text.Encoding entryNameEncoding) { throw null; } + public static System.IO.Compression.ZipArchive OpenRead(string archiveFileName) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class ZipFileExtensions + { + public static System.IO.Compression.ZipArchiveEntry CreateEntryFromFile(this System.IO.Compression.ZipArchive destination, string sourceFileName, string entryName) { throw null; } + public static System.IO.Compression.ZipArchiveEntry CreateEntryFromFile(this System.IO.Compression.ZipArchive destination, string sourceFileName, string entryName, System.IO.Compression.CompressionLevel compressionLevel) { throw null; } + public static void ExtractToDirectory(this System.IO.Compression.ZipArchive source, string destinationDirectoryName) { } + public static void ExtractToFile(this System.IO.Compression.ZipArchiveEntry source, string destinationFileName) { } + public static void ExtractToFile(this System.IO.Compression.ZipArchiveEntry source, string destinationFileName, bool overwrite) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.IO.Compression.cs b/external/binary-reference-assemblies/src/v4.7.1/System.IO.Compression.cs new file mode 100644 index 0000000000..acd56e031a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.IO.Compression.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IO.Compression.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IO.Compression.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IO.Compression.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.CompressionLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.CompressionMode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.DeflateStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.GZipStream))] +namespace System.IO.Compression +{ + public partial class ZipArchive : System.IDisposable + { + public ZipArchive(System.IO.Stream stream) { } + public ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode) { } + public ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen) { } + public ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding entryNameEncoding) { } + public System.Collections.ObjectModel.ReadOnlyCollection Entries { get { throw null; } } + public System.IO.Compression.ZipArchiveMode Mode { get { throw null; } } + public System.IO.Compression.ZipArchiveEntry CreateEntry(string entryName) { throw null; } + public System.IO.Compression.ZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel) { throw null; } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.IO.Compression.ZipArchiveEntry GetEntry(string entryName) { throw null; } + } + public partial class ZipArchiveEntry + { + internal ZipArchiveEntry() { } + public System.IO.Compression.ZipArchive Archive { get { throw null; } } + public long CompressedLength { get { throw null; } } + public string FullName { get { throw null; } } + public System.DateTimeOffset LastWriteTime { get { throw null; } set { } } + public long Length { get { throw null; } } + public string Name { get { throw null; } } + public void Delete() { } + public System.IO.Stream Open() { throw null; } + public override string ToString() { throw null; } + } + public enum ZipArchiveMode + { + Create = 1, + Read = 0, + Update = 2, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.Selectors.cs b/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.Selectors.cs new file mode 100644 index 0000000000..1f4b11ff2f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.Selectors.cs @@ -0,0 +1,115 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.IdentityModel.Selectors.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.IdentityModel.Selectors.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.IdentityModel.Selectors.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.IdentityModel.Selectors +{ + [System.SerializableAttribute] + public partial class CardSpaceException : System.Exception + { + public CardSpaceException() { } + protected CardSpaceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public CardSpaceException(string message) { } + public CardSpaceException(string message, System.Exception innerException) { } + } + public partial class CardSpacePolicyElement + { + public CardSpacePolicyElement(System.Xml.XmlElement target, System.Xml.XmlElement issuer, System.Collections.ObjectModel.Collection parameters, System.Uri privacyNoticeLink, int privacyNoticeVersion, bool isManagedIssuer) { } + public bool IsManagedIssuer { get { throw null; } set { } } + public System.Xml.XmlElement Issuer { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Parameters { get { throw null; } } + public System.Uri PolicyNoticeLink { get { throw null; } set { } } + public int PolicyNoticeVersion { get { throw null; } set { } } + public System.Xml.XmlElement Target { get { throw null; } set { } } + } + public static partial class CardSpaceSelector + { + public static System.IdentityModel.Tokens.GenericXmlSecurityToken GetToken(System.IdentityModel.Selectors.CardSpacePolicyElement[] policyChain, System.IdentityModel.Selectors.SecurityTokenSerializer tokenSerializer) { throw null; } + public static System.IdentityModel.Tokens.GenericXmlSecurityToken GetToken(System.Xml.XmlElement endpoint, System.Collections.Generic.IEnumerable policy, System.Xml.XmlElement requiredRemoteTokenIssuer, System.IdentityModel.Selectors.SecurityTokenSerializer tokenSerializer) { throw null; } + public static void Import(string fileName) { } + public static void Manage() { } + } + [System.SerializableAttribute] + public partial class IdentityValidationException : System.Exception + { + public IdentityValidationException() { } + protected IdentityValidationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public IdentityValidationException(string message) { } + public IdentityValidationException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class PolicyValidationException : System.Exception + { + public PolicyValidationException() { } + protected PolicyValidationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public PolicyValidationException(string message) { } + public PolicyValidationException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class ServiceBusyException : System.Exception + { + public ServiceBusyException() { } + protected ServiceBusyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ServiceBusyException(string message) { } + public ServiceBusyException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class ServiceNotStartedException : System.Exception + { + public ServiceNotStartedException() { } + protected ServiceNotStartedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ServiceNotStartedException(string message) { } + public ServiceNotStartedException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class StsCommunicationException : System.Exception + { + public StsCommunicationException() { } + protected StsCommunicationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public StsCommunicationException(string message) { } + public StsCommunicationException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class UnsupportedPolicyOptionsException : System.Exception + { + public UnsupportedPolicyOptionsException() { } + protected UnsupportedPolicyOptionsException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public UnsupportedPolicyOptionsException(string message) { } + public UnsupportedPolicyOptionsException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class UntrustedRecipientException : System.Exception + { + public UntrustedRecipientException() { } + protected UntrustedRecipientException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public UntrustedRecipientException(string message) { } + public UntrustedRecipientException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class UserCancellationException : System.Exception + { + public UserCancellationException() { } + protected UserCancellationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public UserCancellationException(string message) { } + public UserCancellationException(string message, System.Exception innerException) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.cs.REMOVED.git-id new file mode 100644 index 0000000000..d0e56d4179 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.cs.REMOVED.git-id @@ -0,0 +1 @@ +02806caf88ab0d84fb464eaeaf26a4b67ea3efea \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.extra.cs b/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.extra.cs new file mode 100644 index 0000000000..aca2195f00 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.IdentityModel.extra.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] + +namespace System.ServiceModel.Security +{ + internal partial class EncryptedKey { } + internal partial class EncryptedKeyHashIdentifierClause { } + internal partial class EncryptedType { } + internal partial interface ISspiNegotiation { } + internal partial interface ISspiNegotiationInfo { } + internal partial class ReferenceList { } + internal partial class RelAssertionDirectKeyIdentifierClause { } + internal partial class SamlAssertionDirectKeyIdentifierClause { } +} +namespace System.ServiceModel.Security.Tokens +{ + internal partial class BufferedGenericXmlSecurityToken { } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Management.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Management.cs new file mode 100644 index 0000000000..a2c1b9f4a7 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Management.cs @@ -0,0 +1,875 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Management.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Management.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Management.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, UnmanagedCode=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Management +{ + public enum AuthenticationLevel + { + Call = 3, + Connect = 2, + Default = 0, + None = 1, + Packet = 4, + PacketIntegrity = 5, + PacketPrivacy = 6, + Unchanged = -1, + } + public enum CimType + { + Boolean = 11, + Char16 = 103, + DateTime = 101, + None = 0, + Object = 13, + Real32 = 4, + Real64 = 5, + Reference = 102, + SInt16 = 2, + SInt32 = 3, + SInt64 = 20, + SInt8 = 16, + String = 8, + UInt16 = 18, + UInt32 = 19, + UInt64 = 21, + UInt8 = 17, + } + public enum CodeLanguage + { + CSharp = 0, + JScript = 1, + Mcpp = 4, + VB = 2, + VJSharp = 3, + } + [System.FlagsAttribute] + public enum ComparisonSettings + { + IgnoreCase = 16, + IgnoreClass = 8, + IgnoreDefaultValues = 4, + IgnoreFlavor = 32, + IgnoreObjectSource = 2, + IgnoreQualifiers = 1, + IncludeAll = 0, + } + public partial class CompletedEventArgs : System.Management.ManagementEventArgs + { + internal CompletedEventArgs() { } + public System.Management.ManagementStatus Status { get { throw null; } } + public System.Management.ManagementBaseObject StatusObject { get { throw null; } } + } + public delegate void CompletedEventHandler(object sender, System.Management.CompletedEventArgs e); + public partial class ConnectionOptions : System.Management.ManagementOptions + { + public ConnectionOptions() { } + public ConnectionOptions(string locale, string username, System.Security.SecureString password, string authority, System.Management.ImpersonationLevel impersonation, System.Management.AuthenticationLevel authentication, bool enablePrivileges, System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { } + public ConnectionOptions(string locale, string username, string password, string authority, System.Management.ImpersonationLevel impersonation, System.Management.AuthenticationLevel authentication, bool enablePrivileges, System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { } + public System.Management.AuthenticationLevel Authentication { get { throw null; } set { } } + public string Authority { get { throw null; } set { } } + public bool EnablePrivileges { get { throw null; } set { } } + public System.Management.ImpersonationLevel Impersonation { get { throw null; } set { } } + public string Locale { get { throw null; } set { } } + public string Password { set { } } + public System.Security.SecureString SecurePassword { set { } } + public string Username { get { throw null; } set { } } + public override object Clone() { throw null; } + } + public partial class DeleteOptions : System.Management.ManagementOptions + { + public DeleteOptions() { } + public DeleteOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { } + public override object Clone() { throw null; } + } + public partial class EnumerationOptions : System.Management.ManagementOptions + { + public EnumerationOptions() { } + public EnumerationOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep) { } + public int BlockSize { get { throw null; } set { } } + public bool DirectRead { get { throw null; } set { } } + public bool EnsureLocatable { get { throw null; } set { } } + public bool EnumerateDeep { get { throw null; } set { } } + public bool PrototypeOnly { get { throw null; } set { } } + public bool ReturnImmediately { get { throw null; } set { } } + public bool Rewindable { get { throw null; } set { } } + public bool UseAmendedQualifiers { get { throw null; } set { } } + public override object Clone() { throw null; } + } + public partial class EventArrivedEventArgs : System.Management.ManagementEventArgs + { + internal EventArrivedEventArgs() { } + public System.Management.ManagementBaseObject NewEvent { get { throw null; } } + } + public delegate void EventArrivedEventHandler(object sender, System.Management.EventArrivedEventArgs e); + public partial class EventQuery : System.Management.ManagementQuery + { + public EventQuery() { } + public EventQuery(string query) { } + public EventQuery(string language, string query) { } + public override object Clone() { throw null; } + } + public partial class EventWatcherOptions : System.Management.ManagementOptions + { + public EventWatcherOptions() { } + public EventWatcherOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, int blockSize) { } + public int BlockSize { get { throw null; } set { } } + public override object Clone() { throw null; } + } + public enum ImpersonationLevel + { + Anonymous = 1, + Default = 0, + Delegate = 4, + Identify = 2, + Impersonate = 3, + } + public partial class InvokeMethodOptions : System.Management.ManagementOptions + { + public InvokeMethodOptions() { } + public InvokeMethodOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { } + public override object Clone() { throw null; } + } + [System.ComponentModel.ToolboxItemAttribute(false)] + [System.SerializableAttribute] + public partial class ManagementBaseObject : System.ComponentModel.Component, System.ICloneable, System.Runtime.Serialization.ISerializable + { + protected ManagementBaseObject(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public virtual System.Management.ManagementPath ClassPath { get { throw null; } } + public object this[string propertyName] { get { throw null; } set { } } + public virtual System.Management.PropertyDataCollection Properties { get { throw null; } } + public virtual System.Management.QualifierDataCollection Qualifiers { get { throw null; } } + public virtual System.Management.PropertyDataCollection SystemProperties { get { throw null; } } + public virtual object Clone() { throw null; } + public bool CompareTo(System.Management.ManagementBaseObject otherObject, System.Management.ComparisonSettings settings) { throw null; } + public new void Dispose() { } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public object GetPropertyQualifierValue(string propertyName, string qualifierName) { throw null; } + public object GetPropertyValue(string propertyName) { throw null; } + public object GetQualifierValue(string qualifierName) { throw null; } + public string GetText(System.Management.TextFormat format) { throw null; } + public static explicit operator System.IntPtr (System.Management.ManagementBaseObject managementObject) { throw null; } + public void SetPropertyQualifierValue(string propertyName, string qualifierName, object qualifierValue) { } + public void SetPropertyValue(string propertyName, object propertyValue) { } + public void SetQualifierValue(string qualifierName, object qualifierValue) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class ManagementClass : System.Management.ManagementObject + { + public ManagementClass() { } + public ManagementClass(System.Management.ManagementPath path) { } + public ManagementClass(System.Management.ManagementPath path, System.Management.ObjectGetOptions options) { } + public ManagementClass(System.Management.ManagementScope scope, System.Management.ManagementPath path, System.Management.ObjectGetOptions options) { } + protected ManagementClass(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ManagementClass(string path) { } + public ManagementClass(string path, System.Management.ObjectGetOptions options) { } + public ManagementClass(string scope, string path, System.Management.ObjectGetOptions options) { } + public System.Collections.Specialized.StringCollection Derivation { get { throw null; } } + public System.Management.MethodDataCollection Methods { get { throw null; } } + public override System.Management.ManagementPath Path { get { throw null; } set { } } + public override object Clone() { throw null; } + public System.Management.ManagementObject CreateInstance() { throw null; } + public System.Management.ManagementClass Derive(string newClassName) { throw null; } + public System.Management.ManagementObjectCollection GetInstances() { throw null; } + public System.Management.ManagementObjectCollection GetInstances(System.Management.EnumerationOptions options) { throw null; } + public void GetInstances(System.Management.ManagementOperationObserver watcher) { } + public void GetInstances(System.Management.ManagementOperationObserver watcher, System.Management.EnumerationOptions options) { } + protected override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.Management.ManagementObjectCollection GetRelatedClasses() { throw null; } + public void GetRelatedClasses(System.Management.ManagementOperationObserver watcher) { } + public void GetRelatedClasses(System.Management.ManagementOperationObserver watcher, string relatedClass) { } + public void GetRelatedClasses(System.Management.ManagementOperationObserver watcher, string relatedClass, string relationshipClass, string relationshipQualifier, string relatedQualifier, string relatedRole, string thisRole, System.Management.EnumerationOptions options) { } + public System.Management.ManagementObjectCollection GetRelatedClasses(string relatedClass) { throw null; } + public System.Management.ManagementObjectCollection GetRelatedClasses(string relatedClass, string relationshipClass, string relationshipQualifier, string relatedQualifier, string relatedRole, string thisRole, System.Management.EnumerationOptions options) { throw null; } + public System.Management.ManagementObjectCollection GetRelationshipClasses() { throw null; } + public void GetRelationshipClasses(System.Management.ManagementOperationObserver watcher) { } + public void GetRelationshipClasses(System.Management.ManagementOperationObserver watcher, string relationshipClass) { } + public void GetRelationshipClasses(System.Management.ManagementOperationObserver watcher, string relationshipClass, string relationshipQualifier, string thisRole, System.Management.EnumerationOptions options) { } + public System.Management.ManagementObjectCollection GetRelationshipClasses(string relationshipClass) { throw null; } + public System.Management.ManagementObjectCollection GetRelationshipClasses(string relationshipClass, string relationshipQualifier, string thisRole, System.Management.EnumerationOptions options) { throw null; } + public System.CodeDom.CodeTypeDeclaration GetStronglyTypedClassCode(bool includeSystemClassInClassDef, bool systemPropertyClass) { throw null; } + public bool GetStronglyTypedClassCode(System.Management.CodeLanguage lang, string filePath, string classNamespace) { throw null; } + public System.Management.ManagementObjectCollection GetSubclasses() { throw null; } + public System.Management.ManagementObjectCollection GetSubclasses(System.Management.EnumerationOptions options) { throw null; } + public void GetSubclasses(System.Management.ManagementOperationObserver watcher) { } + public void GetSubclasses(System.Management.ManagementOperationObserver watcher, System.Management.EnumerationOptions options) { } + } + public sealed partial class ManagementDateTimeConverter + { + internal ManagementDateTimeConverter() { } + public static System.DateTime ToDateTime(string dmtfDate) { throw null; } + public static string ToDmtfDateTime(System.DateTime date) { throw null; } + public static string ToDmtfTimeInterval(System.TimeSpan timespan) { throw null; } + public static System.TimeSpan ToTimeSpan(string dmtfTimespan) { throw null; } + } + public abstract partial class ManagementEventArgs : System.EventArgs + { + internal ManagementEventArgs() { } + public object Context { get { throw null; } } + } + [System.ComponentModel.ToolboxItemAttribute(false)] + public partial class ManagementEventWatcher : System.ComponentModel.Component + { + public ManagementEventWatcher() { } + public ManagementEventWatcher(System.Management.EventQuery query) { } + public ManagementEventWatcher(System.Management.ManagementScope scope, System.Management.EventQuery query) { } + public ManagementEventWatcher(System.Management.ManagementScope scope, System.Management.EventQuery query, System.Management.EventWatcherOptions options) { } + public ManagementEventWatcher(string query) { } + public ManagementEventWatcher(string scope, string query) { } + public ManagementEventWatcher(string scope, string query, System.Management.EventWatcherOptions options) { } + public System.Management.EventWatcherOptions Options { get { throw null; } set { } } + public System.Management.EventQuery Query { get { throw null; } set { } } + public System.Management.ManagementScope Scope { get { throw null; } set { } } + public event System.Management.EventArrivedEventHandler EventArrived { add { } remove { } } + public event System.Management.StoppedEventHandler Stopped { add { } remove { } } + ~ManagementEventWatcher() { } + public void Start() { } + public void Stop() { } + public System.Management.ManagementBaseObject WaitForNextEvent() { throw null; } + } + [System.SerializableAttribute] + public partial class ManagementException : System.SystemException + { + public ManagementException() { } + protected ManagementException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ManagementException(string message) { } + public ManagementException(string message, System.Exception innerException) { } + public System.Management.ManagementStatus ErrorCode { get { throw null; } } + public System.Management.ManagementBaseObject ErrorInformation { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class ManagementNamedValueCollection : System.Collections.Specialized.NameObjectCollectionBase + { + public ManagementNamedValueCollection() { } + protected ManagementNamedValueCollection(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public object this[string name] { get { throw null; } } + public void Add(string name, object value) { } + public System.Management.ManagementNamedValueCollection Clone() { throw null; } + public void Remove(string name) { } + public void RemoveAll() { } + } + [System.SerializableAttribute] + public partial class ManagementObject : System.Management.ManagementBaseObject, System.ICloneable + { + public ManagementObject() : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public ManagementObject(System.Management.ManagementPath path) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public ManagementObject(System.Management.ManagementPath path, System.Management.ObjectGetOptions options) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public ManagementObject(System.Management.ManagementScope scope, System.Management.ManagementPath path, System.Management.ObjectGetOptions options) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + protected ManagementObject(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public ManagementObject(string path) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public ManagementObject(string path, System.Management.ObjectGetOptions options) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public ManagementObject(string scopeString, string pathString, System.Management.ObjectGetOptions options) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public override System.Management.ManagementPath ClassPath { get { throw null; } } + public System.Management.ObjectGetOptions Options { get { throw null; } set { } } + public virtual System.Management.ManagementPath Path { get { throw null; } set { } } + public System.Management.ManagementScope Scope { get { throw null; } set { } } + public override object Clone() { throw null; } + public void CopyTo(System.Management.ManagementOperationObserver watcher, System.Management.ManagementPath path) { } + public void CopyTo(System.Management.ManagementOperationObserver watcher, System.Management.ManagementPath path, System.Management.PutOptions options) { } + public void CopyTo(System.Management.ManagementOperationObserver watcher, string path) { } + public void CopyTo(System.Management.ManagementOperationObserver watcher, string path, System.Management.PutOptions options) { } + public System.Management.ManagementPath CopyTo(System.Management.ManagementPath path) { throw null; } + public System.Management.ManagementPath CopyTo(System.Management.ManagementPath path, System.Management.PutOptions options) { throw null; } + public System.Management.ManagementPath CopyTo(string path) { throw null; } + public System.Management.ManagementPath CopyTo(string path, System.Management.PutOptions options) { throw null; } + public void Delete() { } + public void Delete(System.Management.DeleteOptions options) { } + public void Delete(System.Management.ManagementOperationObserver watcher) { } + public void Delete(System.Management.ManagementOperationObserver watcher, System.Management.DeleteOptions options) { } + public new void Dispose() { } + public void Get() { } + public void Get(System.Management.ManagementOperationObserver watcher) { } + public System.Management.ManagementBaseObject GetMethodParameters(string methodName) { throw null; } + protected override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.Management.ManagementObjectCollection GetRelated() { throw null; } + public void GetRelated(System.Management.ManagementOperationObserver watcher) { } + public void GetRelated(System.Management.ManagementOperationObserver watcher, string relatedClass) { } + public void GetRelated(System.Management.ManagementOperationObserver watcher, string relatedClass, string relationshipClass, string relationshipQualifier, string relatedQualifier, string relatedRole, string thisRole, bool classDefinitionsOnly, System.Management.EnumerationOptions options) { } + public System.Management.ManagementObjectCollection GetRelated(string relatedClass) { throw null; } + public System.Management.ManagementObjectCollection GetRelated(string relatedClass, string relationshipClass, string relationshipQualifier, string relatedQualifier, string relatedRole, string thisRole, bool classDefinitionsOnly, System.Management.EnumerationOptions options) { throw null; } + public System.Management.ManagementObjectCollection GetRelationships() { throw null; } + public void GetRelationships(System.Management.ManagementOperationObserver watcher) { } + public void GetRelationships(System.Management.ManagementOperationObserver watcher, string relationshipClass) { } + public void GetRelationships(System.Management.ManagementOperationObserver watcher, string relationshipClass, string relationshipQualifier, string thisRole, bool classDefinitionsOnly, System.Management.EnumerationOptions options) { } + public System.Management.ManagementObjectCollection GetRelationships(string relationshipClass) { throw null; } + public System.Management.ManagementObjectCollection GetRelationships(string relationshipClass, string relationshipQualifier, string thisRole, bool classDefinitionsOnly, System.Management.EnumerationOptions options) { throw null; } + public void InvokeMethod(System.Management.ManagementOperationObserver watcher, string methodName, System.Management.ManagementBaseObject inParameters, System.Management.InvokeMethodOptions options) { } + public void InvokeMethod(System.Management.ManagementOperationObserver watcher, string methodName, object[] args) { } + public System.Management.ManagementBaseObject InvokeMethod(string methodName, System.Management.ManagementBaseObject inParameters, System.Management.InvokeMethodOptions options) { throw null; } + public object InvokeMethod(string methodName, object[] args) { throw null; } + public System.Management.ManagementPath Put() { throw null; } + public void Put(System.Management.ManagementOperationObserver watcher) { } + public void Put(System.Management.ManagementOperationObserver watcher, System.Management.PutOptions options) { } + public System.Management.ManagementPath Put(System.Management.PutOptions options) { throw null; } + public override string ToString() { throw null; } + } + public partial class ManagementObjectCollection : System.Collections.ICollection, System.Collections.IEnumerable, System.IDisposable + { + internal ManagementObjectCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Management.ManagementBaseObject[] objectCollection, int index) { } + public void Dispose() { } + ~ManagementObjectCollection() { } + public System.Management.ManagementObjectCollection.ManagementObjectEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public partial class ManagementObjectEnumerator : System.Collections.IEnumerator, System.IDisposable + { + internal ManagementObjectEnumerator() { } + public System.Management.ManagementBaseObject Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public void Dispose() { } + ~ManagementObjectEnumerator() { } + public bool MoveNext() { throw null; } + public void Reset() { } + } + } + [System.ComponentModel.ToolboxItemAttribute(false)] + public partial class ManagementObjectSearcher : System.ComponentModel.Component + { + public ManagementObjectSearcher() { } + public ManagementObjectSearcher(System.Management.ManagementScope scope, System.Management.ObjectQuery query) { } + public ManagementObjectSearcher(System.Management.ManagementScope scope, System.Management.ObjectQuery query, System.Management.EnumerationOptions options) { } + public ManagementObjectSearcher(System.Management.ObjectQuery query) { } + public ManagementObjectSearcher(string queryString) { } + public ManagementObjectSearcher(string scope, string queryString) { } + public ManagementObjectSearcher(string scope, string queryString, System.Management.EnumerationOptions options) { } + public System.Management.EnumerationOptions Options { get { throw null; } set { } } + public System.Management.ObjectQuery Query { get { throw null; } set { } } + public System.Management.ManagementScope Scope { get { throw null; } set { } } + public System.Management.ManagementObjectCollection Get() { throw null; } + public void Get(System.Management.ManagementOperationObserver watcher) { } + } + public partial class ManagementOperationObserver + { + public ManagementOperationObserver() { } + public event System.Management.CompletedEventHandler Completed { add { } remove { } } + public event System.Management.ObjectPutEventHandler ObjectPut { add { } remove { } } + public event System.Management.ObjectReadyEventHandler ObjectReady { add { } remove { } } + public event System.Management.ProgressEventHandler Progress { add { } remove { } } + public void Cancel() { } + } + [System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))] + public abstract partial class ManagementOptions : System.ICloneable + { + internal ManagementOptions() { } + public static readonly System.TimeSpan InfiniteTimeout; + public System.Management.ManagementNamedValueCollection Context { get { throw null; } set { } } + public System.TimeSpan Timeout { get { throw null; } set { } } + public abstract object Clone(); + } + [System.ComponentModel.TypeConverterAttribute("System.Management.ManagementPathConverter")] + public partial class ManagementPath : System.ICloneable + { + public ManagementPath() { } + public ManagementPath(string path) { } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string ClassName { get { throw null; } set { } } + public static System.Management.ManagementPath DefaultPath { get { throw null; } set { } } + public bool IsClass { get { throw null; } } + public bool IsInstance { get { throw null; } } + public bool IsSingleton { get { throw null; } } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string NamespacePath { get { throw null; } set { } } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string Path { get { throw null; } set { } } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string RelativePath { get { throw null; } set { } } + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + public string Server { get { throw null; } set { } } + public System.Management.ManagementPath Clone() { throw null; } + public void SetAsClass() { } + public void SetAsSingleton() { } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + } + [System.ComponentModel.TypeConverterAttribute("System.Management.ManagementQueryConverter")] + public abstract partial class ManagementQuery : System.ICloneable + { + internal ManagementQuery() { } + public virtual string QueryLanguage { get { throw null; } set { } } + public virtual string QueryString { get { throw null; } set { } } + public abstract object Clone(); + protected internal virtual void ParseQuery(string query) { } + } + [System.ComponentModel.TypeConverterAttribute("System.Management.ManagementScopeConverter")] + public partial class ManagementScope : System.ICloneable + { + public ManagementScope() { } + public ManagementScope(System.Management.ManagementPath path) { } + public ManagementScope(System.Management.ManagementPath path, System.Management.ConnectionOptions options) { } + public ManagementScope(string path) { } + public ManagementScope(string path, System.Management.ConnectionOptions options) { } + public bool IsConnected { get { throw null; } } + public System.Management.ConnectionOptions Options { get { throw null; } set { } } + public System.Management.ManagementPath Path { get { throw null; } set { } } + public System.Management.ManagementScope Clone() { throw null; } + public void Connect() { } + object System.ICloneable.Clone() { throw null; } + } + public enum ManagementStatus + { + AccessDenied = -2147217405, + AggregatingByObject = -2147217315, + AlreadyExists = -2147217383, + AmendedObject = -2147217306, + BackupRestoreWinmgmtRunning = -2147217312, + BufferTooSmall = -2147217348, + CallCanceled = -2147217358, + CannotBeAbstract = -2147217307, + CannotBeKey = -2147217377, + CannotBeSingleton = -2147217364, + CannotChangeIndexInheritance = -2147217328, + CannotChangeKeyInheritance = -2147217335, + CircularReference = -2147217337, + ClassHasChildren = -2147217371, + ClassHasInstances = -2147217370, + ClientTooSlow = -2147217305, + CriticalError = -2147217398, + Different = 262147, + DuplicateObjects = 262152, + Failed = -2147217407, + False = 1, + IllegalNull = -2147217368, + IllegalOperation = -2147217378, + IncompleteClass = -2147217376, + InitializationFailure = -2147217388, + InvalidCimType = -2147217363, + InvalidClass = -2147217392, + InvalidContext = -2147217401, + InvalidDuplicateParameter = -2147217341, + InvalidFlavor = -2147217338, + InvalidMethod = -2147217362, + InvalidMethodParameters = -2147217361, + InvalidNamespace = -2147217394, + InvalidObject = -2147217393, + InvalidObjectPath = -2147217350, + InvalidOperation = -2147217386, + InvalidOperator = -2147217309, + InvalidParameter = -2147217400, + InvalidParameterID = -2147217353, + InvalidProperty = -2147217359, + InvalidPropertyType = -2147217366, + InvalidProviderRegistration = -2147217390, + InvalidQualifier = -2147217342, + InvalidQualifierType = -2147217367, + InvalidQuery = -2147217385, + InvalidQueryType = -2147217384, + InvalidStream = -2147217397, + InvalidSuperclass = -2147217395, + InvalidSyntax = -2147217375, + LocalCredentials = -2147217308, + MarshalInvalidSignature = -2147217343, + MarshalVersionMismatch = -2147217344, + MethodDisabled = -2147217322, + MethodNotImplemented = -2147217323, + MissingAggregationList = -2147217317, + MissingGroupWithin = -2147217318, + MissingParameterID = -2147217354, + NoError = 0, + NoMoreData = 262149, + NonconsecutiveParameterIDs = -2147217352, + NondecoratedObject = -2147217374, + NotAvailable = -2147217399, + NotEventClass = -2147217319, + NotFound = -2147217406, + NotSupported = -2147217396, + OperationCanceled = 262150, + OutOfDiskSpace = -2147217349, + OutOfMemory = -2147217402, + OverrideNotAllowed = -2147217382, + ParameterIDOnRetval = -2147217351, + PartialResults = 262160, + Pending = 262151, + PrivilegeNotHeld = -2147217310, + PropagatedMethod = -2147217356, + PropagatedProperty = -2147217380, + PropagatedQualifier = -2147217381, + PropertyNotAnObject = -2147217316, + ProviderFailure = -2147217404, + ProviderLoadFailure = -2147217389, + ProviderNotCapable = -2147217372, + ProviderNotFound = -2147217391, + QueryNotImplemented = -2147217369, + QueueOverflow = -2147217311, + ReadOnly = -2147217373, + RefresherBusy = -2147217321, + RegistrationTooBroad = -2147213311, + RegistrationTooPrecise = -2147213310, + ResetToDefault = 262146, + ServerTooBusy = -2147217339, + ShuttingDown = -2147217357, + SystemProperty = -2147217360, + Timedout = 262148, + TooManyProperties = -2147217327, + TooMuchData = -2147217340, + TransportFailure = -2147217387, + TypeMismatch = -2147217403, + Unexpected = -2147217379, + UninterpretableProviderQuery = -2147217313, + UnknownObjectType = -2147217346, + UnknownPacketType = -2147217345, + UnparsableQuery = -2147217320, + UnsupportedClassUpdate = -2147217336, + UnsupportedParameter = -2147217355, + UnsupportedPutExtension = -2147217347, + UpdateOverrideNotAllowed = -2147217325, + UpdatePropagatedMethod = -2147217324, + UpdateTypeMismatch = -2147217326, + ValueOutOfRange = -2147217365, + } + public partial class MethodData + { + internal MethodData() { } + public System.Management.ManagementBaseObject InParameters { get { throw null; } } + public string Name { get { throw null; } } + public string Origin { get { throw null; } } + public System.Management.ManagementBaseObject OutParameters { get { throw null; } } + public System.Management.QualifierDataCollection Qualifiers { get { throw null; } } + } + public partial class MethodDataCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal MethodDataCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public virtual System.Management.MethodData this[string methodName] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public virtual void Add(string methodName) { } + public virtual void Add(string methodName, System.Management.ManagementBaseObject inParameters, System.Management.ManagementBaseObject outParameters) { } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Management.MethodData[] methodArray, int index) { } + public System.Management.MethodDataCollection.MethodDataEnumerator GetEnumerator() { throw null; } + public virtual void Remove(string methodName) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public partial class MethodDataEnumerator : System.Collections.IEnumerator + { + internal MethodDataEnumerator() { } + public System.Management.MethodData Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + } + public partial class ObjectGetOptions : System.Management.ManagementOptions + { + public ObjectGetOptions() { } + public ObjectGetOptions(System.Management.ManagementNamedValueCollection context) { } + public ObjectGetOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, bool useAmendedQualifiers) { } + public bool UseAmendedQualifiers { get { throw null; } set { } } + public override object Clone() { throw null; } + } + public partial class ObjectPutEventArgs : System.Management.ManagementEventArgs + { + internal ObjectPutEventArgs() { } + public System.Management.ManagementPath Path { get { throw null; } } + } + public delegate void ObjectPutEventHandler(object sender, System.Management.ObjectPutEventArgs e); + public partial class ObjectQuery : System.Management.ManagementQuery + { + public ObjectQuery() { } + public ObjectQuery(string query) { } + public ObjectQuery(string language, string query) { } + public override object Clone() { throw null; } + } + public partial class ObjectReadyEventArgs : System.Management.ManagementEventArgs + { + internal ObjectReadyEventArgs() { } + public System.Management.ManagementBaseObject NewObject { get { throw null; } } + } + public delegate void ObjectReadyEventHandler(object sender, System.Management.ObjectReadyEventArgs e); + public partial class ProgressEventArgs : System.Management.ManagementEventArgs + { + internal ProgressEventArgs() { } + public int Current { get { throw null; } } + public string Message { get { throw null; } } + public int UpperBound { get { throw null; } } + } + public delegate void ProgressEventHandler(object sender, System.Management.ProgressEventArgs e); + public partial class PropertyData + { + internal PropertyData() { } + public bool IsArray { get { throw null; } } + public bool IsLocal { get { throw null; } } + public string Name { get { throw null; } } + public string Origin { get { throw null; } } + public System.Management.QualifierDataCollection Qualifiers { get { throw null; } } + public System.Management.CimType Type { get { throw null; } } + public object Value { get { throw null; } set { } } + } + public partial class PropertyDataCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal PropertyDataCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public virtual System.Management.PropertyData this[string propertyName] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void Add(string propertyName, System.Management.CimType propertyType, bool isArray) { } + public virtual void Add(string propertyName, object propertyValue) { } + public void Add(string propertyName, object propertyValue, System.Management.CimType propertyType) { } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Management.PropertyData[] propertyArray, int index) { } + public System.Management.PropertyDataCollection.PropertyDataEnumerator GetEnumerator() { throw null; } + public virtual void Remove(string propertyName) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public partial class PropertyDataEnumerator : System.Collections.IEnumerator + { + internal PropertyDataEnumerator() { } + public System.Management.PropertyData Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + } + public partial class PutOptions : System.Management.ManagementOptions + { + public PutOptions() { } + public PutOptions(System.Management.ManagementNamedValueCollection context) { } + public PutOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, bool useAmendedQualifiers, System.Management.PutType putType) { } + public System.Management.PutType Type { get { throw null; } set { } } + public bool UseAmendedQualifiers { get { throw null; } set { } } + public override object Clone() { throw null; } + } + public enum PutType + { + CreateOnly = 2, + None = 0, + UpdateOnly = 1, + UpdateOrCreate = 3, + } + public partial class QualifierData + { + internal QualifierData() { } + public bool IsAmended { get { throw null; } set { } } + public bool IsLocal { get { throw null; } } + public bool IsOverridable { get { throw null; } set { } } + public string Name { get { throw null; } } + public bool PropagatesToInstance { get { throw null; } set { } } + public bool PropagatesToSubclass { get { throw null; } set { } } + public object Value { get { throw null; } set { } } + } + public partial class QualifierDataCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal QualifierDataCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public virtual System.Management.QualifierData this[string qualifierName] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public virtual void Add(string qualifierName, object qualifierValue) { } + public virtual void Add(string qualifierName, object qualifierValue, bool isAmended, bool propagatesToInstance, bool propagatesToSubclass, bool isOverridable) { } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Management.QualifierData[] qualifierArray, int index) { } + public System.Management.QualifierDataCollection.QualifierDataEnumerator GetEnumerator() { throw null; } + public virtual void Remove(string qualifierName) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public partial class QualifierDataEnumerator : System.Collections.IEnumerator + { + internal QualifierDataEnumerator() { } + public System.Management.QualifierData Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + } + public partial class RelatedObjectQuery : System.Management.WqlObjectQuery + { + public RelatedObjectQuery() { } + public RelatedObjectQuery(bool isSchemaQuery, string sourceObject, string relatedClass, string relationshipClass, string relatedQualifier, string relationshipQualifier, string relatedRole, string thisRole) { } + public RelatedObjectQuery(string queryOrSourceObject) { } + public RelatedObjectQuery(string sourceObject, string relatedClass) { } + public RelatedObjectQuery(string sourceObject, string relatedClass, string relationshipClass, string relatedQualifier, string relationshipQualifier, string relatedRole, string thisRole, bool classDefinitionsOnly) { } + public bool ClassDefinitionsOnly { get { throw null; } set { } } + public bool IsSchemaQuery { get { throw null; } set { } } + public string RelatedClass { get { throw null; } set { } } + public string RelatedQualifier { get { throw null; } set { } } + public string RelatedRole { get { throw null; } set { } } + public string RelationshipClass { get { throw null; } set { } } + public string RelationshipQualifier { get { throw null; } set { } } + public string SourceObject { get { throw null; } set { } } + public string ThisRole { get { throw null; } set { } } + protected internal void BuildQuery() { } + public override object Clone() { throw null; } + protected internal override void ParseQuery(string query) { } + } + public partial class RelationshipQuery : System.Management.WqlObjectQuery + { + public RelationshipQuery() { } + public RelationshipQuery(bool isSchemaQuery, string sourceObject, string relationshipClass, string relationshipQualifier, string thisRole) { } + public RelationshipQuery(string queryOrSourceObject) { } + public RelationshipQuery(string sourceObject, string relationshipClass) { } + public RelationshipQuery(string sourceObject, string relationshipClass, string relationshipQualifier, string thisRole, bool classDefinitionsOnly) { } + public bool ClassDefinitionsOnly { get { throw null; } set { } } + public bool IsSchemaQuery { get { throw null; } set { } } + public string RelationshipClass { get { throw null; } set { } } + public string RelationshipQualifier { get { throw null; } set { } } + public string SourceObject { get { throw null; } set { } } + public string ThisRole { get { throw null; } set { } } + protected internal void BuildQuery() { } + public override object Clone() { throw null; } + protected internal override void ParseQuery(string query) { } + } + public partial class SelectQuery : System.Management.WqlObjectQuery + { + public SelectQuery() { } + public SelectQuery(bool isSchemaQuery, string condition) { } + public SelectQuery(string queryOrClassName) { } + public SelectQuery(string className, string condition) { } + public SelectQuery(string className, string condition, string[] selectedProperties) { } + public string ClassName { get { throw null; } set { } } + public string Condition { get { throw null; } set { } } + public bool IsSchemaQuery { get { throw null; } set { } } + public override string QueryString { get { throw null; } set { } } + public System.Collections.Specialized.StringCollection SelectedProperties { get { throw null; } set { } } + protected internal void BuildQuery() { } + public override object Clone() { throw null; } + protected internal override void ParseQuery(string query) { } + } + public partial class StoppedEventArgs : System.Management.ManagementEventArgs + { + internal StoppedEventArgs() { } + public System.Management.ManagementStatus Status { get { throw null; } } + } + public delegate void StoppedEventHandler(object sender, System.Management.StoppedEventArgs e); + public enum TextFormat + { + CimDtd20 = 1, + Mof = 0, + WmiDtd20 = 2, + } + public partial class WqlEventQuery : System.Management.EventQuery + { + public WqlEventQuery() { } + public WqlEventQuery(string queryOrEventClassName) { } + public WqlEventQuery(string eventClassName, string condition) { } + public WqlEventQuery(string eventClassName, string condition, System.TimeSpan groupWithinInterval) { } + public WqlEventQuery(string eventClassName, string condition, System.TimeSpan groupWithinInterval, string[] groupByPropertyList) { } + public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval) { } + public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval, string condition) { } + public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval, string condition, System.TimeSpan groupWithinInterval, string[] groupByPropertyList, string havingCondition) { } + public string Condition { get { throw null; } set { } } + public string EventClassName { get { throw null; } set { } } + public System.Collections.Specialized.StringCollection GroupByPropertyList { get { throw null; } set { } } + public System.TimeSpan GroupWithinInterval { get { throw null; } set { } } + public string HavingCondition { get { throw null; } set { } } + public override string QueryLanguage { get { throw null; } } + public override string QueryString { get { throw null; } set { } } + public System.TimeSpan WithinInterval { get { throw null; } set { } } + protected internal void BuildQuery() { } + public override object Clone() { throw null; } + protected internal override void ParseQuery(string query) { } + } + public partial class WqlObjectQuery : System.Management.ObjectQuery + { + public WqlObjectQuery() { } + public WqlObjectQuery(string query) { } + public override string QueryLanguage { get { throw null; } } + public override object Clone() { throw null; } + } +} +namespace System.Management.Instrumentation +{ + [System.Management.Instrumentation.InstrumentationClassAttribute((System.Management.Instrumentation.InstrumentationType)(1))] + public abstract partial class BaseEvent : System.Management.Instrumentation.IEvent + { + protected BaseEvent() { } + public void Fire() { } + } + public partial class DefaultManagementProjectInstaller : System.Configuration.Install.Installer + { + public DefaultManagementProjectInstaller() { } + } + public partial interface IEvent + { + void Fire(); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(448))] + public partial class IgnoreMemberAttribute : System.Attribute + { + public IgnoreMemberAttribute() { } + } + public partial interface IInstance + { + bool Published { get; set; } + } + [System.Management.Instrumentation.InstrumentationClassAttribute((System.Management.Instrumentation.InstrumentationType)(0))] + public abstract partial class Instance : System.Management.Instrumentation.IInstance + { + protected Instance() { } + [System.Management.Instrumentation.IgnoreMemberAttribute] + public bool Published { get { throw null; } set { } } + } + public partial class Instrumentation + { + public Instrumentation() { } + public static void Fire(object eventData) { } + public static bool IsAssemblyRegistered(System.Reflection.Assembly assemblyToRegister) { throw null; } + public static void Publish(object instanceData) { } + public static void RegisterAssembly(System.Reflection.Assembly assemblyToRegister) { } + public static void Revoke(object instanceData) { } + public static void SetBatchSize(System.Type instrumentationClass, int batchSize) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(12))] + public partial class InstrumentationClassAttribute : System.Attribute + { + public InstrumentationClassAttribute(System.Management.Instrumentation.InstrumentationType instrumentationType) { } + public InstrumentationClassAttribute(System.Management.Instrumentation.InstrumentationType instrumentationType, string managedBaseClassName) { } + public System.Management.Instrumentation.InstrumentationType InstrumentationType { get { throw null; } } + public string ManagedBaseClassName { get { throw null; } } + } + public enum InstrumentationType + { + Abstract = 2, + Event = 1, + Instance = 0, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1))] + public partial class InstrumentedAttribute : System.Attribute + { + public InstrumentedAttribute() { } + public InstrumentedAttribute(string namespaceName) { } + public InstrumentedAttribute(string namespaceName, string securityDescriptor) { } + public string NamespaceName { get { throw null; } } + public string SecurityDescriptor { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(460))] + public partial class ManagedNameAttribute : System.Attribute + { + public ManagedNameAttribute(string name) { } + public string Name { get { throw null; } } + } + public partial class ManagementInstaller : System.Configuration.Install.Installer + { + public ManagementInstaller() { } + public override string HelpText { get { throw null; } } + public override void Commit(System.Collections.IDictionary savedState) { } + public override void Install(System.Collections.IDictionary savedState) { } + public override void Rollback(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Messaging.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Messaging.cs new file mode 100644 index 0000000000..a643c65e4d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Messaging.cs @@ -0,0 +1,1213 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Messaging.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Messaging.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Messaging.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Messaging +{ + public partial class AccessControlEntry + { + public AccessControlEntry() { } + public AccessControlEntry(System.Messaging.Trustee trustee) { } + public AccessControlEntry(System.Messaging.Trustee trustee, System.Messaging.GenericAccessRights genericAccessRights, System.Messaging.StandardAccessRights standardAccessRights, System.Messaging.AccessControlEntryType entryType) { } + protected int CustomAccessRights { get { throw null; } set { } } + public System.Messaging.AccessControlEntryType EntryType { get { throw null; } set { } } + public System.Messaging.GenericAccessRights GenericAccessRights { get { throw null; } set { } } + public System.Messaging.StandardAccessRights StandardAccessRights { get { throw null; } set { } } + public System.Messaging.Trustee Trustee { get { throw null; } set { } } + } + public enum AccessControlEntryType + { + Allow = 1, + Deny = 3, + Revoke = 4, + Set = 2, + } + public partial class AccessControlList : System.Collections.CollectionBase + { + public AccessControlList() { } + public int Add(System.Messaging.AccessControlEntry entry) { throw null; } + public bool Contains(System.Messaging.AccessControlEntry entry) { throw null; } + public void CopyTo(System.Messaging.AccessControlEntry[] array, int index) { } + public int IndexOf(System.Messaging.AccessControlEntry entry) { throw null; } + public void Insert(int index, System.Messaging.AccessControlEntry entry) { } + public void Remove(System.Messaging.AccessControlEntry entry) { } + } + [System.FlagsAttribute] + public enum AcknowledgeTypes + { + FullReachQueue = 5, + FullReceive = 14, + NegativeReceive = 8, + None = 0, + NotAcknowledgeReachQueue = 4, + NotAcknowledgeReceive = 12, + PositiveArrival = 1, + PositiveReceive = 2, + } + public enum Acknowledgment + { + AccessDenied = 32772, + BadDestinationQueue = 32768, + BadEncryption = 32775, + BadSignature = 32774, + CouldNotEncrypt = 32776, + HopCountExceeded = 32773, + None = 0, + NotTransactionalMessage = 32778, + NotTransactionalQueue = 32777, + Purged = 32769, + QueueDeleted = 49152, + QueueExceedMaximumSize = 32771, + QueuePurged = 49153, + ReachQueue = 2, + ReachQueueTimeout = 32770, + Receive = 16384, + ReceiveTimeout = 49154, + } + public partial class ActiveXMessageFormatter : System.ICloneable, System.Messaging.IMessageFormatter + { + public ActiveXMessageFormatter() { } + public bool CanRead(System.Messaging.Message message) { throw null; } + public object Clone() { throw null; } + public static void InitStreamedObject(object streamedObject) { } + public object Read(System.Messaging.Message message) { throw null; } + public void Write(System.Messaging.Message message, object obj) { } + } + public partial class BinaryMessageFormatter : System.ICloneable, System.Messaging.IMessageFormatter + { + public BinaryMessageFormatter() { } + public BinaryMessageFormatter(System.Runtime.Serialization.Formatters.FormatterAssemblyStyle topObjectFormat, System.Runtime.Serialization.Formatters.FormatterTypeStyle typeFormat) { } + [System.ComponentModel.DefaultValueAttribute((System.Runtime.Serialization.Formatters.FormatterAssemblyStyle)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgTopObjectFormat")] + public System.Runtime.Serialization.Formatters.FormatterAssemblyStyle TopObjectFormat { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Runtime.Serialization.Formatters.FormatterTypeStyle)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgTypeFormat")] + public System.Runtime.Serialization.Formatters.FormatterTypeStyle TypeFormat { get { throw null; } set { } } + public bool CanRead(System.Messaging.Message message) { throw null; } + public object Clone() { throw null; } + public object Read(System.Messaging.Message message) { throw null; } + public void Write(System.Messaging.Message message, object obj) { } + } + public enum CryptographicProviderType + { + Dss = 3, + Fortezza = 4, + MicrosoftExchange = 5, + None = 0, + RsaFull = 1, + RsqSig = 2, + Ssl = 6, + SttAcq = 8, + SttBrnd = 9, + SttIss = 11, + SttMer = 7, + SttRoot = 10, + } + public sealed partial class Cursor : System.IDisposable + { + internal Cursor() { } + public void Close() { } + public void Dispose() { } + } + [System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))] + public partial class DefaultPropertiesToSend + { + public DefaultPropertiesToSend() { } + [System.ComponentModel.DefaultValueAttribute((System.Messaging.AcknowledgeTypes)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgAcknowledgeType")] + public System.Messaging.AcknowledgeTypes AcknowledgeType { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Messaging.MessagingDescriptionAttribute("MsgAdministrationQueue")] + public System.Messaging.MessageQueue AdministrationQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(0)] + [System.Messaging.MessagingDescriptionAttribute("MsgAppSpecific")] + public int AppSpecific { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAttachSenderId")] + public bool AttachSenderId { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Messaging.EncryptionAlgorithm)(26114))] + [System.Messaging.MessagingDescriptionAttribute("MsgEncryptionAlgorithm")] + public System.Messaging.EncryptionAlgorithm EncryptionAlgorithm { get { throw null; } set { } } + [System.ComponentModel.EditorAttribute("System.ComponentModel.Design.ArrayEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.Messaging.MessagingDescriptionAttribute("MsgExtension")] + public byte[] Extension { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Messaging.HashAlgorithm)(32771))] + [System.Messaging.MessagingDescriptionAttribute("MsgHashAlgorithm")] + public System.Messaging.HashAlgorithm HashAlgorithm { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.Messaging.MessagingDescriptionAttribute("MsgLabel")] + public string Label { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Messaging.MessagePriority)(3))] + [System.Messaging.MessagingDescriptionAttribute("MsgPriority")] + public System.Messaging.MessagePriority Priority { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgRecoverable")] + public bool Recoverable { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Messaging.MessagingDescriptionAttribute("MsgResponseQueue")] + public System.Messaging.MessageQueue ResponseQueue { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.TimeoutConverter")] + [System.Messaging.MessagingDescriptionAttribute("MsgTimeToBeReceived")] + public System.TimeSpan TimeToBeReceived { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.TimeoutConverter")] + [System.Messaging.MessagingDescriptionAttribute("MsgTimeToReachQueue")] + public System.TimeSpan TimeToReachQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Messaging.MessagingDescriptionAttribute("MsgTransactionStatusQueue")] + public System.Messaging.MessageQueue TransactionStatusQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseAuthentication")] + public bool UseAuthentication { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseDeadLetterQueue")] + public bool UseDeadLetterQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseEncryption")] + public bool UseEncryption { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseJournalQueue")] + public bool UseJournalQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseTracing")] + public bool UseTracing { get { throw null; } set { } } + } + public enum EncryptionAlgorithm + { + None = 0, + Rc2 = 26114, + Rc4 = 26625, + } + public enum EncryptionRequired + { + Body = 2, + None = 0, + Optional = 1, + } + [System.FlagsAttribute] + public enum GenericAccessRights + { + All = 268435456, + Execute = 536870912, + None = 0, + Read = -2147483648, + Write = 1073741824, + } + public enum HashAlgorithm + { + Mac = 32773, + Md2 = 32769, + Md4 = 32770, + Md5 = 32771, + None = 0, + Sha = 32772, + Sha256 = 32780, + Sha384 = 32781, + Sha512 = 32782, + } + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.MessageFormatterConverter")] + public partial interface IMessageFormatter : System.ICloneable + { + bool CanRead(System.Messaging.Message message); + object Read(System.Messaging.Message message); + void Write(System.Messaging.Message message, object obj); + } + [System.ComponentModel.DesignerAttribute("System.Messaging.Design.MessageDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public partial class Message : System.ComponentModel.Component + { + public static readonly System.TimeSpan InfiniteTimeout; + public Message() { } + public Message(object body) { } + public Message(object body, System.Messaging.IMessageFormatter formatter) { } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAcknowledgeType")] + public System.Messaging.AcknowledgeTypes AcknowledgeType { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAcknowledgement")] + public System.Messaging.Acknowledgment Acknowledgment { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAdministrationQueue")] + public System.Messaging.MessageQueue AdministrationQueue { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAppSpecific")] + public int AppSpecific { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgArrivedTime")] + public System.DateTime ArrivedTime { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAttachSenderId")] + public bool AttachSenderId { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgAuthenticated")] + public bool Authenticated { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAuthenticationProviderName")] + public string AuthenticationProviderName { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAuthenticationProviderType")] + public System.Messaging.CryptographicProviderType AuthenticationProviderType { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public object Body { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorAttribute("System.ComponentModel.Design.BinaryEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgBodyStream")] + public System.IO.Stream BodyStream { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgBodyType")] + public int BodyType { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgConnectorType")] + public System.Guid ConnectorType { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgCorrelationId")] + public string CorrelationId { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgDestinationQueue")] + public System.Messaging.MessageQueue DestinationQueue { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgDestinationSymmetricKey")] + public byte[] DestinationSymmetricKey { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgDigitalSignature")] + public byte[] DigitalSignature { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgEncryptionAlgorithm")] + public System.Messaging.EncryptionAlgorithm EncryptionAlgorithm { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgExtension")] + public byte[] Extension { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public System.Messaging.IMessageFormatter Formatter { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgHashAlgorithm")] + public System.Messaging.HashAlgorithm HashAlgorithm { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgId")] + public string Id { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgIsFirstInTransaction")] + public bool IsFirstInTransaction { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgIsLastInTransaction")] + public bool IsLastInTransaction { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgLabel")] + public string Label { get { throw null; } set { } } + public long LookupId { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgMessageType")] + public System.Messaging.MessageType MessageType { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgPriority")] + public System.Messaging.MessagePriority Priority { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgRecoverable")] + public bool Recoverable { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgResponseQueue")] + public System.Messaging.MessageQueue ResponseQueue { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + public System.Messaging.SecurityContext SecurityContext { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgSenderCertificate")] + public byte[] SenderCertificate { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgSenderId")] + public byte[] SenderId { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgSenderVersion")] + public long SenderVersion { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgSentTime")] + public System.DateTime SentTime { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgSourceMachine")] + public string SourceMachine { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.TimeoutConverter")] + [System.Messaging.MessagingDescriptionAttribute("MsgTimeToBeReceived")] + public System.TimeSpan TimeToBeReceived { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.TimeoutConverter")] + [System.Messaging.MessagingDescriptionAttribute("MsgTimeToReachQueue")] + public System.TimeSpan TimeToReachQueue { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MsgTransactionId")] + public string TransactionId { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgTransactionStatusQueue")] + public System.Messaging.MessageQueue TransactionStatusQueue { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseAuthentication")] + public bool UseAuthentication { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseDeadLetterQueue")] + public bool UseDeadLetterQueue { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseEncryption")] + public bool UseEncryption { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseJournalQueue")] + public bool UseJournalQueue { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseTracing")] + public bool UseTracing { get { throw null; } set { } } + } + public partial class MessageEnumerator : System.MarshalByRefObject, System.Collections.IEnumerator, System.IDisposable + { + internal MessageEnumerator() { } + public System.Messaging.Message Current { get { throw null; } } + public System.IntPtr CursorHandle { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public void Close() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public bool MoveNext() { throw null; } + public bool MoveNext(System.TimeSpan timeout) { throw null; } + public System.Messaging.Message RemoveCurrent() { throw null; } + public System.Messaging.Message RemoveCurrent(System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message RemoveCurrent(System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message RemoveCurrent(System.TimeSpan timeout) { throw null; } + public System.Messaging.Message RemoveCurrent(System.TimeSpan timeout, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message RemoveCurrent(System.TimeSpan timeout, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public void Reset() { } + } + public enum MessageLookupAction + { + Current = 0, + First = 4, + Last = 8, + Next = 1, + Previous = 2, + } + public enum MessagePriority + { + AboveNormal = 4, + High = 5, + Highest = 7, + Low = 2, + Lowest = 0, + Normal = 3, + VeryHigh = 6, + VeryLow = 1, + } + [System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))] + public partial class MessagePropertyFilter : System.ICloneable + { + public MessagePropertyFilter() { } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAcknowledgeType")] + public bool AcknowledgeType { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAcknowledgement")] + public bool Acknowledgment { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgAdministrationQueue")] + public bool AdministrationQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgAppSpecific")] + public bool AppSpecific { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgArrivedTime")] + public bool ArrivedTime { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgAttachSenderId")] + public bool AttachSenderId { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgAuthenticated")] + public bool Authenticated { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgAuthenticationProviderName")] + public bool AuthenticationProviderName { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgAuthenticationProviderType")] + public bool AuthenticationProviderType { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgBody")] + public bool Body { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgConnectorType")] + public bool ConnectorType { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgCorrelationId")] + public bool CorrelationId { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(1024)] + [System.Messaging.MessagingDescriptionAttribute("MsgDefaultBodySize")] + public int DefaultBodySize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(255)] + [System.Messaging.MessagingDescriptionAttribute("MsgDefaultExtensionSize")] + public int DefaultExtensionSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(255)] + [System.Messaging.MessagingDescriptionAttribute("MsgDefaultLabelSize")] + public int DefaultLabelSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgDestinationQueue")] + public bool DestinationQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgDestinationSymmetricKey")] + public bool DestinationSymmetricKey { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgDigitalSignature")] + public bool DigitalSignature { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgEncryptionAlgorithm")] + public bool EncryptionAlgorithm { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgExtension")] + public bool Extension { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgHashAlgorithm")] + public bool HashAlgorithm { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgId")] + public bool Id { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgIsFirstInTransaction")] + public bool IsFirstInTransaction { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgIsLastInTransaction")] + public bool IsLastInTransaction { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgLabel")] + public bool Label { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgLookupId")] + public bool LookupId { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgMessageType")] + public bool MessageType { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgPriority")] + public bool Priority { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgRecoverable")] + public bool Recoverable { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgResponseQueue")] + public bool ResponseQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgSenderCertificate")] + public bool SenderCertificate { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgSenderId")] + public bool SenderId { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgSenderVersion")] + public bool SenderVersion { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgSentTime")] + public bool SentTime { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgSourceMachine")] + public bool SourceMachine { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgTimeToBeReceived")] + public bool TimeToBeReceived { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgTimeToReachQueue")] + public bool TimeToReachQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgTransactionId")] + public bool TransactionId { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgTransactionStatusQueue")] + public bool TransactionStatusQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseAuthentication")] + public bool UseAuthentication { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseDeadLetterQueue")] + public bool UseDeadLetterQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseEncryption")] + public bool UseEncryption { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseJournalQueue")] + public bool UseJournalQueue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MsgUseTracing")] + public bool UseTracing { get { throw null; } set { } } + public void ClearAll() { } + public virtual object Clone() { throw null; } + public void SetAll() { } + public void SetDefaults() { } + } + [System.ComponentModel.DefaultEventAttribute("ReceiveCompleted")] + [System.ComponentModel.EditorAttribute("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.InstallerTypeAttribute(typeof(System.Messaging.MessageQueueInstaller))] + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.MessageQueueConverter")] + [System.Messaging.MessagingDescriptionAttribute("MessageQueueDesc")] + public partial class MessageQueue : System.ComponentModel.Component, System.Collections.IEnumerable + { + public static readonly long InfiniteQueueSize; + public static readonly System.TimeSpan InfiniteTimeout; + public MessageQueue() { } + public MessageQueue(string path) { } + public MessageQueue(string path, bool sharedModeDenyReceive) { } + public MessageQueue(string path, bool sharedModeDenyReceive, bool enableCache) { } + public MessageQueue(string path, bool sharedModeDenyReceive, bool enableCache, System.Messaging.QueueAccessMode accessMode) { } + public MessageQueue(string path, System.Messaging.QueueAccessMode accessMode) { } + public System.Messaging.QueueAccessMode AccessMode { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_Authenticate")] + public bool Authenticate { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_BasePriority")] + public short BasePriority { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_CanRead")] + public bool CanRead { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_CanWrite")] + public bool CanWrite { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_Category")] + public System.Guid Category { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_CreateTime")] + public System.DateTime CreateTime { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(2))] + [System.Messaging.MessagingDescriptionAttribute("MQ_DefaultPropertiesToSend")] + public System.Messaging.DefaultPropertiesToSend DefaultPropertiesToSend { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Messaging.MessagingDescriptionAttribute("MQ_DenySharedReceive")] + public bool DenySharedReceive { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + public static bool EnableConnectionCache { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_EncryptionRequired")] + public System.Messaging.EncryptionRequired EncryptionRequired { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_FormatName")] + public string FormatName { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.MessageFormatterConverter")] + [System.Messaging.MessagingDescriptionAttribute("MQ_Formatter")] + public System.Messaging.IMessageFormatter Formatter { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_GuidId")] + public System.Guid Id { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_Label")] + public string Label { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_LastModifyTime")] + public System.DateTime LastModifyTime { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_MachineName")] + public string MachineName { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.SizeConverter")] + [System.Messaging.MessagingDescriptionAttribute("MQ_MaximumJournalSize")] + public long MaximumJournalSize { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.SizeConverter")] + [System.Messaging.MessagingDescriptionAttribute("MQ_MaximumQueueSize")] + public long MaximumQueueSize { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(2))] + [System.Messaging.MessagingDescriptionAttribute("MQ_MessageReadPropertyFilter")] + public System.Messaging.MessagePropertyFilter MessageReadPropertyFilter { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_MulticastAddress")] + public string MulticastAddress { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.EditorAttribute("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.RefreshPropertiesAttribute((System.ComponentModel.RefreshProperties)(1))] + [System.ComponentModel.SettingsBindableAttribute(true)] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.Messaging.MessagingDescriptionAttribute("MQ_Path")] + public string Path { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_QueueName")] + public string QueueName { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_ReadHandle")] + public System.IntPtr ReadHandle { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Messaging.MessagingDescriptionAttribute("MQ_SynchronizingObject")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_Transactional")] + public bool Transactional { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_UseJournalQueue")] + public bool UseJournalQueue { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("MQ_WriteHandle")] + public System.IntPtr WriteHandle { get { throw null; } } + [System.Messaging.MessagingDescriptionAttribute("MQ_PeekCompleted")] + public event System.Messaging.PeekCompletedEventHandler PeekCompleted { add { } remove { } } + [System.Messaging.MessagingDescriptionAttribute("MQ_ReceiveCompleted")] + public event System.Messaging.ReceiveCompletedEventHandler ReceiveCompleted { add { } remove { } } + public System.IAsyncResult BeginPeek() { throw null; } + public System.IAsyncResult BeginPeek(System.TimeSpan timeout) { throw null; } + public System.IAsyncResult BeginPeek(System.TimeSpan timeout, System.Messaging.Cursor cursor, System.Messaging.PeekAction action, object state, System.AsyncCallback callback) { throw null; } + public System.IAsyncResult BeginPeek(System.TimeSpan timeout, object stateObject) { throw null; } + public System.IAsyncResult BeginPeek(System.TimeSpan timeout, object stateObject, System.AsyncCallback callback) { throw null; } + public System.IAsyncResult BeginReceive() { throw null; } + public System.IAsyncResult BeginReceive(System.TimeSpan timeout) { throw null; } + public System.IAsyncResult BeginReceive(System.TimeSpan timeout, System.Messaging.Cursor cursor, object state, System.AsyncCallback callback) { throw null; } + public System.IAsyncResult BeginReceive(System.TimeSpan timeout, object stateObject) { throw null; } + public System.IAsyncResult BeginReceive(System.TimeSpan timeout, object stateObject, System.AsyncCallback callback) { throw null; } + public static void ClearConnectionCache() { } + public void Close() { } + public static System.Messaging.MessageQueue Create(string path) { throw null; } + public static System.Messaging.MessageQueue Create(string path, bool transactional) { throw null; } + public System.Messaging.Cursor CreateCursor() { throw null; } + public static void Delete(string path) { } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SharedState=true)] + protected override void Dispose(bool disposing) { } + public System.Messaging.Message EndPeek(System.IAsyncResult asyncResult) { throw null; } + public System.Messaging.Message EndReceive(System.IAsyncResult asyncResult) { throw null; } + public static bool Exists(string path) { throw null; } + public System.Messaging.Message[] GetAllMessages() { throw null; } + [System.ObsoleteAttribute("This method returns a MessageEnumerator that implements RemoveCurrent family of methods incorrectly. Please use GetMessageEnumerator2 instead.")] + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public static System.Guid GetMachineId(string machineName) { throw null; } + [System.ObsoleteAttribute("This method returns a MessageEnumerator that implements RemoveCurrent family of methods incorrectly. Please use GetMessageEnumerator2 instead.")] + public System.Messaging.MessageEnumerator GetMessageEnumerator() { throw null; } + public System.Messaging.MessageEnumerator GetMessageEnumerator2() { throw null; } + public static System.Messaging.MessageQueueEnumerator GetMessageQueueEnumerator() { throw null; } + public static System.Messaging.MessageQueueEnumerator GetMessageQueueEnumerator(System.Messaging.MessageQueueCriteria criteria) { throw null; } + public static System.Messaging.MessageQueue[] GetPrivateQueuesByMachine(string machineName) { throw null; } + public static System.Messaging.MessageQueue[] GetPublicQueues() { throw null; } + public static System.Messaging.MessageQueue[] GetPublicQueues(System.Messaging.MessageQueueCriteria criteria) { throw null; } + public static System.Messaging.MessageQueue[] GetPublicQueuesByCategory(System.Guid category) { throw null; } + public static System.Messaging.MessageQueue[] GetPublicQueuesByLabel(string label) { throw null; } + public static System.Messaging.MessageQueue[] GetPublicQueuesByMachine(string machineName) { throw null; } + public static System.Messaging.SecurityContext GetSecurityContext() { throw null; } + public System.Messaging.Message Peek() { throw null; } + public System.Messaging.Message Peek(System.TimeSpan timeout) { throw null; } + public System.Messaging.Message Peek(System.TimeSpan timeout, System.Messaging.Cursor cursor, System.Messaging.PeekAction action) { throw null; } + public System.Messaging.Message PeekByCorrelationId(string correlationId) { throw null; } + public System.Messaging.Message PeekByCorrelationId(string correlationId, System.TimeSpan timeout) { throw null; } + public System.Messaging.Message PeekById(string id) { throw null; } + public System.Messaging.Message PeekById(string id, System.TimeSpan timeout) { throw null; } + public System.Messaging.Message PeekByLookupId(long lookupId) { throw null; } + public System.Messaging.Message PeekByLookupId(System.Messaging.MessageLookupAction action, long lookupId) { throw null; } + public void Purge() { } + public System.Messaging.Message Receive() { throw null; } + public System.Messaging.Message Receive(System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message Receive(System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message Receive(System.TimeSpan timeout) { throw null; } + public System.Messaging.Message Receive(System.TimeSpan timeout, System.Messaging.Cursor cursor) { throw null; } + public System.Messaging.Message Receive(System.TimeSpan timeout, System.Messaging.Cursor cursor, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message Receive(System.TimeSpan timeout, System.Messaging.Cursor cursor, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message Receive(System.TimeSpan timeout, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message Receive(System.TimeSpan timeout, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message ReceiveByCorrelationId(string correlationId) { throw null; } + public System.Messaging.Message ReceiveByCorrelationId(string correlationId, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message ReceiveByCorrelationId(string correlationId, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message ReceiveByCorrelationId(string correlationId, System.TimeSpan timeout) { throw null; } + public System.Messaging.Message ReceiveByCorrelationId(string correlationId, System.TimeSpan timeout, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message ReceiveByCorrelationId(string correlationId, System.TimeSpan timeout, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message ReceiveById(string id) { throw null; } + public System.Messaging.Message ReceiveById(string id, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message ReceiveById(string id, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message ReceiveById(string id, System.TimeSpan timeout) { throw null; } + public System.Messaging.Message ReceiveById(string id, System.TimeSpan timeout, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message ReceiveById(string id, System.TimeSpan timeout, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public System.Messaging.Message ReceiveByLookupId(long lookupId) { throw null; } + public System.Messaging.Message ReceiveByLookupId(System.Messaging.MessageLookupAction action, long lookupId, System.Messaging.MessageQueueTransaction transaction) { throw null; } + public System.Messaging.Message ReceiveByLookupId(System.Messaging.MessageLookupAction action, long lookupId, System.Messaging.MessageQueueTransactionType transactionType) { throw null; } + public void Refresh() { } + public void ResetPermissions() { } + public void Send(object obj) { } + public void Send(object obj, System.Messaging.MessageQueueTransaction transaction) { } + public void Send(object obj, System.Messaging.MessageQueueTransactionType transactionType) { } + public void Send(object obj, string label) { } + public void Send(object obj, string label, System.Messaging.MessageQueueTransaction transaction) { } + public void Send(object obj, string label, System.Messaging.MessageQueueTransactionType transactionType) { } + public void SetPermissions(System.Messaging.AccessControlList dacl) { } + public void SetPermissions(System.Messaging.MessageQueueAccessControlEntry ace) { } + public void SetPermissions(string user, System.Messaging.MessageQueueAccessRights rights) { } + public void SetPermissions(string user, System.Messaging.MessageQueueAccessRights rights, System.Messaging.AccessControlEntryType entryType) { } + } + public partial class MessageQueueAccessControlEntry : System.Messaging.AccessControlEntry + { + public MessageQueueAccessControlEntry(System.Messaging.Trustee trustee, System.Messaging.MessageQueueAccessRights rights) { } + public MessageQueueAccessControlEntry(System.Messaging.Trustee trustee, System.Messaging.MessageQueueAccessRights rights, System.Messaging.AccessControlEntryType entryType) { } + public System.Messaging.MessageQueueAccessRights MessageQueueAccessRights { get { throw null; } set { } } + } + [System.FlagsAttribute] + public enum MessageQueueAccessRights + { + ChangeQueuePermissions = 262144, + DeleteJournalMessage = 8, + DeleteMessage = 1, + DeleteQueue = 65536, + FullControl = 983103, + GenericRead = 131115, + GenericWrite = 131108, + GetQueuePermissions = 131072, + GetQueueProperties = 32, + PeekMessage = 2, + ReceiveJournalMessage = 10, + ReceiveMessage = 3, + SetQueueProperties = 16, + TakeQueueOwnership = 524288, + WriteMessage = 4, + } + public partial class MessageQueueCriteria + { + public MessageQueueCriteria() { } + public System.Guid Category { get { throw null; } set { } } + public System.DateTime CreatedAfter { get { throw null; } set { } } + public System.DateTime CreatedBefore { get { throw null; } set { } } + public string Label { get { throw null; } set { } } + public string MachineName { get { throw null; } set { } } + public System.DateTime ModifiedAfter { get { throw null; } set { } } + public System.DateTime ModifiedBefore { get { throw null; } set { } } + public void ClearAll() { } + } + public partial class MessageQueueEnumerator : System.MarshalByRefObject, System.Collections.IEnumerator, System.IDisposable + { + internal MessageQueueEnumerator() { } + public System.Messaging.MessageQueue Current { get { throw null; } } + public System.IntPtr LocatorHandle { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public void Close() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public bool MoveNext() { throw null; } + public void Reset() { } + } + public enum MessageQueueErrorCode + { + AccessDenied = -1072824283, + BadSecurityContext = -1072824267, + Base = -1072824320, + BufferOverflow = -1072824294, + CannotCreateCertificateStore = -1072824209, + CannotCreateHashEx = -1072824191, + CannotCreateOnGlobalCatalog = -1072824201, + CannotGetDistinguishedName = -1072824194, + CannotGrantAddGuid = -1072824206, + CannotHashDataEx = -1072824193, + CannotImpersonateClient = -1072824284, + CannotJoinDomain = -1072824202, + CannotLoadMsmqOcm = -1072824205, + CannotOpenCertificateStore = -1072824208, + CannotSetCryptographicSecurityDescriptor = -1072824212, + CannotSignDataEx = -1072824192, + CertificateNotProvided = -1072824211, + ComputerDoesNotSupportEncryption = -1072824269, + CorruptedInternalCertificate = -1072824275, + CorruptedPersonalCertStore = -1072824271, + CorruptedQueueWasDeleted = -1072824216, + CorruptedSecurityData = -1072824272, + CouldNotGetAccountInfo = -1072824265, + CouldNotGetUserSid = -1072824266, + DeleteConnectedNetworkInUse = -1072824248, + DependentClientLicenseOverflow = -1072824217, + DsError = -1072824253, + DsIsFull = -1072824254, + DtcConnect = -1072824244, + EncryptionProviderNotSupported = -1072824213, + FailVerifySignatureEx = -1072824190, + FormatNameBufferTooSmall = -1072824289, + Generic = -1072824319, + GuidNotMatching = -1072824200, + IllegalContext = -1072824229, + IllegalCriteriaColumns = -1072824264, + IllegalCursorAction = -1072824292, + IllegalEnterpriseOperation = -1072824207, + IllegalFormatName = -1072824290, + IllegalMessageProperties = -1072824255, + IllegalOperation = -1072824220, + IllegalPrivateProperties = -1072824197, + IllegalPropertyId = -1072824263, + IllegalPropertySize = -1072824261, + IllegalPropertyValue = -1072824296, + IllegalPropertyVt = -1072824295, + IllegalQueuePathName = -1072824300, + IllegalQueueProperties = -1072824259, + IllegalRelation = -1072824262, + IllegalRestrictionPropertyId = -1072824260, + IllegalSecurityDescriptor = -1072824287, + IllegalSort = -1072824304, + IllegalSortPropertyId = -1072824228, + IllegalUser = -1072824303, + InsufficientProperties = -1072824257, + InsufficientResources = -1072824281, + InvalidCertificate = -1072824276, + InvalidHandle = -1072824313, + InvalidOwner = -1072824252, + InvalidParameter = -1072824314, + IOTimeout = -1072824293, + LabelBufferTooSmall = -1072824226, + MachineExists = -1072824256, + MachineNotFound = -1072824307, + MessageAlreadyReceived = -1072824291, + MessageNotFound = -1072824184, + MessageStorageFailed = -1072824278, + MissingConnectorType = -1072824235, + MqisReadOnlyMode = -1072824224, + MqisServerEmpty = -1072824225, + NoDs = -1072824301, + NoEntryPointMsmqOcm = -1072824204, + NoGlobalCatalogInDomain = -1072824196, + NoInternalUserCertificate = -1072824273, + NoMsmqServersOnDc = -1072824203, + NoMsmqServersOnGlobalCatalog = -1072824195, + NoResponseFromObjectServer = -1072824247, + ObjectServerNotAvailable = -1072824246, + OperationCanceled = -1072824312, + PrivilegeNotHeld = -1072824282, + Property = -1072824318, + PropertyNotAllowed = -1072824258, + ProviderNameBufferTooSmall = -1072824221, + PublicKeyDoesNotExist = -1072824198, + PublicKeyNotFound = -1072824199, + QDnsPropertyNotSupported = -1072824210, + QueueDeleted = -1072824230, + QueueExists = -1072824315, + QueueNotAvailable = -1072824245, + QueueNotFound = -1072824317, + RemoteMachineNotAvailable = -1072824215, + ResultBufferTooSmall = -1072824250, + SecurityDescriptorBufferTooSmall = -1072824285, + SenderCertificateBufferTooSmall = -1072824277, + SenderIdBufferTooSmall = -1072824286, + ServiceNotAvailable = -1072824309, + SharingViolation = -1072824311, + SignatureBufferTooSmall = -1072824222, + StaleHandle = -1072824234, + SymmetricKeyBufferTooSmall = -1072824223, + TransactionEnlist = -1072824232, + TransactionImport = -1072824242, + TransactionSequence = -1072824239, + TransactionUsage = -1072824240, + UnsupportedAccessMode = -1072824251, + UnsupportedFormatNameOperation = -1072824288, + UnsupportedOperation = -1072824214, + UserBufferTooSmall = -1072824280, + WksCantServeClient = -1072824218, + WriteNotAllowed = -1072824219, + } + [System.SerializableAttribute] + public partial class MessageQueueException : System.Runtime.InteropServices.ExternalException, System.Runtime.Serialization.ISerializable + { + protected MessageQueueException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string Message { get { throw null; } } + public System.Messaging.MessageQueueErrorCode MessageQueueErrorCode { get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class MessageQueueInstaller : System.Configuration.Install.ComponentInstaller + { + public MessageQueueInstaller() { } + public MessageQueueInstaller(System.Messaging.MessageQueue componentToCopy) { } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool Authenticate { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(0)] + public short BasePriority { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.ComponentModel.GuidConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public System.Guid Category { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Messaging.EncryptionRequired)(1))] + public System.Messaging.EncryptionRequired EncryptionRequired { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + public string Label { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.SizeConverter")] + public long MaximumJournalSize { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.Messaging.Design.SizeConverter")] + public long MaximumQueueSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + public string MulticastAddress { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.EditorAttribute("System.Messaging.Design.QueuePathEditor", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public string Path { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public System.Messaging.AccessControlList Permissions { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool Transactional { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.Configuration.Install.UninstallAction)(0))] + public System.Configuration.Install.UninstallAction UninstallAction { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool UseJournalQueue { get { throw null; } set { } } + public override void Commit(System.Collections.IDictionary savedState) { } + public override void CopyFromComponent(System.ComponentModel.IComponent component) { } + public override void Install(System.Collections.IDictionary stateSaver) { } + public override bool IsEquivalentInstaller(System.Configuration.Install.ComponentInstaller otherInstaller) { throw null; } + public override void Rollback(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } + [System.SerializableAttribute] + public sealed partial class MessageQueuePermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public MessageQueuePermission() { } + public MessageQueuePermission(System.Messaging.MessageQueuePermissionAccess permissionAccess, string path) { } + public MessageQueuePermission(System.Messaging.MessageQueuePermissionAccess permissionAccess, string machineName, string label, string category) { } + public MessageQueuePermission(System.Messaging.MessageQueuePermissionEntry[] permissionAccessEntries) { } + public MessageQueuePermission(System.Security.Permissions.PermissionState state) { } + public System.Messaging.MessageQueuePermissionEntryCollection PermissionEntries { get { throw null; } } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement securityElement) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.FlagsAttribute] + [System.SerializableAttribute] + public enum MessageQueuePermissionAccess + { + Administer = 62, + Browse = 2, + None = 0, + Peek = 10, + Receive = 26, + Send = 6, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(621), AllowMultiple=true, Inherited=false)] + [System.SerializableAttribute] + public partial class MessageQueuePermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public MessageQueuePermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public string Category { get { throw null; } set { } } + public string Label { get { throw null; } set { } } + public string MachineName { get { throw null; } set { } } + public string Path { get { throw null; } set { } } + public System.Messaging.MessageQueuePermissionAccess PermissionAccess { get { throw null; } set { } } + public override System.Security.IPermission CreatePermission() { throw null; } + } + [System.SerializableAttribute] + public partial class MessageQueuePermissionEntry + { + public MessageQueuePermissionEntry(System.Messaging.MessageQueuePermissionAccess permissionAccess, string path) { } + public MessageQueuePermissionEntry(System.Messaging.MessageQueuePermissionAccess permissionAccess, string machineName, string label, string category) { } + public string Category { get { throw null; } } + public string Label { get { throw null; } } + public string MachineName { get { throw null; } } + public string Path { get { throw null; } } + public System.Messaging.MessageQueuePermissionAccess PermissionAccess { get { throw null; } } + } + [System.SerializableAttribute] + public partial class MessageQueuePermissionEntryCollection : System.Collections.CollectionBase + { + internal MessageQueuePermissionEntryCollection() { } + public System.Messaging.MessageQueuePermissionEntry this[int index] { get { throw null; } set { } } + public int Add(System.Messaging.MessageQueuePermissionEntry value) { throw null; } + public void AddRange(System.Messaging.MessageQueuePermissionEntryCollection value) { } + public void AddRange(System.Messaging.MessageQueuePermissionEntry[] value) { } + public bool Contains(System.Messaging.MessageQueuePermissionEntry value) { throw null; } + public void CopyTo(System.Messaging.MessageQueuePermissionEntry[] array, int index) { } + public int IndexOf(System.Messaging.MessageQueuePermissionEntry value) { throw null; } + public void Insert(int index, System.Messaging.MessageQueuePermissionEntry value) { } + protected override void OnClear() { } + protected override void OnInsert(int index, object value) { } + protected override void OnRemove(int index, object value) { } + protected override void OnSet(int index, object oldValue, object newValue) { } + public void Remove(System.Messaging.MessageQueuePermissionEntry value) { } + } + public partial class MessageQueueTransaction : System.IDisposable + { + public MessageQueueTransaction() { } + public System.Messaging.MessageQueueTransactionStatus Status { get { throw null; } } + public void Abort() { } + public void Begin() { } + public void Commit() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + ~MessageQueueTransaction() { } + } + public enum MessageQueueTransactionStatus + { + Aborted = 0, + Committed = 1, + Initialized = 2, + Pending = 3, + } + public enum MessageQueueTransactionType + { + Automatic = 1, + None = 0, + Single = 3, + } + public enum MessageType + { + Acknowledgment = 1, + Normal = 2, + Report = 3, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32767))] + public partial class MessagingDescriptionAttribute : System.ComponentModel.DescriptionAttribute + { + public MessagingDescriptionAttribute(string description) { } + public override string Description { [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SharedState=true)]get { throw null; } } + } + public enum PeekAction + { + Current = -2147483648, + Next = -2147483647, + } + public partial class PeekCompletedEventArgs : System.EventArgs + { + internal PeekCompletedEventArgs() { } + public System.IAsyncResult AsyncResult { get { throw null; } set { } } + public System.Messaging.Message Message { get { throw null; } } + } + public delegate void PeekCompletedEventHandler(object sender, System.Messaging.PeekCompletedEventArgs e); + public enum QueueAccessMode + { + Peek = 32, + PeekAndAdmin = 160, + Receive = 1, + ReceiveAndAdmin = 129, + Send = 2, + SendAndReceive = 3, + } + public partial class ReceiveCompletedEventArgs : System.EventArgs + { + internal ReceiveCompletedEventArgs() { } + public System.IAsyncResult AsyncResult { get { throw null; } set { } } + public System.Messaging.Message Message { get { throw null; } } + } + public delegate void ReceiveCompletedEventHandler(object sender, System.Messaging.ReceiveCompletedEventArgs e); + public sealed partial class SecurityContext : System.IDisposable + { + internal SecurityContext() { } + public void Dispose() { } + } + [System.FlagsAttribute] + public enum StandardAccessRights + { + All = 2031616, + Delete = 65536, + Execute = 131072, + ModifyOwner = 524288, + None = 0, + Read = 131072, + ReadSecurity = 131072, + Required = 851968, + Synchronize = 1048576, + Write = 131072, + WriteSecurity = 262144, + } + public partial class Trustee + { + public Trustee() { } + public Trustee(string name) { } + public Trustee(string name, string systemName) { } + public Trustee(string name, string systemName, System.Messaging.TrusteeType trusteeType) { } + public string Name { get { throw null; } set { } } + public string SystemName { get { throw null; } set { } } + public System.Messaging.TrusteeType TrusteeType { get { throw null; } set { } } + } + public enum TrusteeType + { + Alias = 4, + Computer = 5, + Domain = 3, + Group = 2, + Unknown = 0, + User = 1, + } + public partial class XmlMessageFormatter : System.ICloneable, System.Messaging.IMessageFormatter + { + public XmlMessageFormatter() { } + public XmlMessageFormatter(string[] targetTypeNames) { } + public XmlMessageFormatter(System.Type[] targetTypes) { } + [System.Messaging.MessagingDescriptionAttribute("XmlMsgTargetTypeNames")] + public string[] TargetTypeNames { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Messaging.MessagingDescriptionAttribute("XmlMsgTargetTypes")] + public System.Type[] TargetTypes { get { throw null; } set { } } + public bool CanRead(System.Messaging.Message message) { throw null; } + public object Clone() { throw null; } + public object Read(System.Messaging.Message message) { throw null; } + public void Write(System.Messaging.Message message, object obj) { } + } +} +namespace System.Messaging.Design +{ + public partial class QueuePathDialog : System.Windows.Forms.Form + { + public QueuePathDialog(System.IServiceProvider provider) { } + public QueuePathDialog(System.Windows.Forms.Design.IUIService uiService) { } + public string Path { get { throw null; } } + public void ChoosePath() { } + public void DoubleClicked(object source, System.EventArgs e) { } + protected override void OnFormClosing(System.Windows.Forms.FormClosingEventArgs e) { } + protected override void OnHandleCreated(System.EventArgs e) { } + public void SelectQueue(System.Messaging.MessageQueue queue) { } + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public partial class QueuePathEditor : System.Drawing.Design.UITypeEditor + { + public QueuePathEditor() { } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Net.Http.WebRequest.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Net.Http.WebRequest.cs new file mode 100644 index 0000000000..d674b3a60e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Net.Http.WebRequest.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Http.WebRequest.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Http.WebRequest.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Http.WebRequest.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Net.Http +{ + public partial class WebRequestHandler : System.Net.Http.HttpClientHandler + { + public WebRequestHandler() { } + public bool AllowPipelining { get { throw null; } set { } } + public System.Net.Security.AuthenticationLevel AuthenticationLevel { get { throw null; } set { } } + public System.Net.Cache.RequestCachePolicy CachePolicy { get { throw null; } set { } } + public new System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } } + public System.TimeSpan ContinueTimeout { get { throw null; } set { } } + public System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get { throw null; } set { } } + public new int MaxResponseHeadersLength { get { throw null; } set { } } + public int ReadWriteTimeout { get { throw null; } set { } } + public System.Net.Security.RemoteCertificateValidationCallback ServerCertificateValidationCallback { get { throw null; } set { } } + public bool UnsafeAuthenticatedConnectionSharing { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Net.Http.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Net.Http.cs new file mode 100644 index 0000000000..ecc8ca3573 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Net.Http.cs @@ -0,0 +1,653 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.Http.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Http.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Http.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Net.Http +{ + public partial class ByteArrayContent : System.Net.Http.HttpContent + { + public ByteArrayContent(byte[] content) { } + public ByteArrayContent(byte[] content, int offset, int count) { } + protected override System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public enum ClientCertificateOption + { + Automatic = 1, + Manual = 0, + } + public abstract partial class DelegatingHandler : System.Net.Http.HttpMessageHandler + { + protected DelegatingHandler() { } + protected DelegatingHandler(System.Net.Http.HttpMessageHandler innerHandler) { } + public System.Net.Http.HttpMessageHandler InnerHandler { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class FormUrlEncodedContent : System.Net.Http.ByteArrayContent + { + public FormUrlEncodedContent(System.Collections.Generic.IEnumerable> nameValueCollection) : base (default(byte[])) { } + } + public partial class HttpClient : System.Net.Http.HttpMessageInvoker + { + public HttpClient() : base (default(System.Net.Http.HttpMessageHandler)) { } + public HttpClient(System.Net.Http.HttpMessageHandler handler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public HttpClient(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public System.Uri BaseAddress { get { throw null; } set { } } + public System.Net.Http.Headers.HttpRequestHeaders DefaultRequestHeaders { get { throw null; } } + public long MaxResponseContentBufferSize { get { throw null; } set { } } + public System.TimeSpan Timeout { get { throw null; } set { } } + public void CancelPendingRequests() { } + public System.Threading.Tasks.Task DeleteAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(string requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task DeleteAsync(System.Uri requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + protected override void Dispose(bool disposing) { } + public System.Threading.Tasks.Task GetAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(string requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetAsync(System.Uri requestUri, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task GetByteArrayAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetByteArrayAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetStreamAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetStreamAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task GetStringAsync(string requestUri) { throw null; } + public System.Threading.Tasks.Task GetStringAsync(System.Uri requestUri) { throw null; } + public System.Threading.Tasks.Task PostAsync(string requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PostAsync(string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PostAsync(System.Uri requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PostAsync(System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PutAsync(string requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PutAsync(string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task PutAsync(System.Uri requestUri, System.Net.Http.HttpContent content) { throw null; } + public System.Threading.Tasks.Task PutAsync(System.Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption) { throw null; } + public System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class HttpClientHandler : System.Net.Http.HttpMessageHandler + { + public HttpClientHandler() { } + public bool AllowAutoRedirect { get { throw null; } set { } } + public System.Net.DecompressionMethods AutomaticDecompression { get { throw null; } set { } } + public bool CheckCertificateRevocationList { get { throw null; } set { } } + public System.Net.Http.ClientCertificateOption ClientCertificateOptions { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509CertificateCollection ClientCertificates { get { throw null; } } + public System.Net.CookieContainer CookieContainer { get { throw null; } set { } } + public System.Net.ICredentials Credentials { get { throw null; } set { } } + public System.Net.ICredentials DefaultProxyCredentials { get { throw null; } set { } } + public int MaxAutomaticRedirections { get { throw null; } set { } } + public int MaxConnectionsPerServer { get { throw null; } set { } } + public long MaxRequestContentBufferSize { get { throw null; } set { } } + public int MaxResponseHeadersLength { get { throw null; } set { } } + public bool PreAuthenticate { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Properties { get { throw null; } } + public System.Net.IWebProxy Proxy { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } } + public System.Func ServerCertificateCustomValidationCallback { get { throw null; } set { } } + public System.Security.Authentication.SslProtocols SslProtocols { get { throw null; } set { } } + public virtual bool SupportsAutomaticDecompression { get { throw null; } } + public virtual bool SupportsProxy { get { throw null; } } + public virtual bool SupportsRedirectConfiguration { get { throw null; } } + public bool UseCookies { get { throw null; } set { } } + public bool UseDefaultCredentials { get { throw null; } set { } } + public bool UseProxy { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected internal override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public enum HttpCompletionOption + { + ResponseContentRead = 0, + ResponseHeadersRead = 1, + } + public abstract partial class HttpContent : System.IDisposable + { + protected HttpContent() { } + public System.Net.Http.Headers.HttpContentHeaders Headers { get { throw null; } } + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream stream) { throw null; } + public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected virtual System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.Threading.Tasks.Task LoadIntoBufferAsync() { throw null; } + public System.Threading.Tasks.Task LoadIntoBufferAsync(long maxBufferSize) { throw null; } + public System.Threading.Tasks.Task ReadAsByteArrayAsync() { throw null; } + public System.Threading.Tasks.Task ReadAsStreamAsync() { throw null; } + public System.Threading.Tasks.Task ReadAsStringAsync() { throw null; } + protected abstract System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context); + protected internal abstract bool TryComputeLength(out long length); + } + public abstract partial class HttpMessageHandler : System.IDisposable + { + protected HttpMessageHandler() { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + protected internal abstract System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); + } + public partial class HttpMessageInvoker : System.IDisposable + { + public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler) { } + public HttpMessageInvoker(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) { } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public virtual System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class HttpMethod : System.IEquatable + { + public HttpMethod(string method) { } + public static System.Net.Http.HttpMethod Delete { get { throw null; } } + public static System.Net.Http.HttpMethod Get { get { throw null; } } + public static System.Net.Http.HttpMethod Head { get { throw null; } } + public string Method { get { throw null; } } + public static System.Net.Http.HttpMethod Options { get { throw null; } } + public static System.Net.Http.HttpMethod Post { get { throw null; } } + public static System.Net.Http.HttpMethod Put { get { throw null; } } + public static System.Net.Http.HttpMethod Trace { get { throw null; } } + public bool Equals(System.Net.Http.HttpMethod other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Net.Http.HttpMethod left, System.Net.Http.HttpMethod right) { throw null; } + public static bool operator !=(System.Net.Http.HttpMethod left, System.Net.Http.HttpMethod right) { throw null; } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class HttpRequestException : System.Exception + { + public HttpRequestException() { } + public HttpRequestException(string message) { } + public HttpRequestException(string message, System.Exception inner) { } + } + public partial class HttpRequestMessage : System.IDisposable + { + public HttpRequestMessage() { } + public HttpRequestMessage(System.Net.Http.HttpMethod method, string requestUri) { } + public HttpRequestMessage(System.Net.Http.HttpMethod method, System.Uri requestUri) { } + public System.Net.Http.HttpContent Content { get { throw null; } set { } } + public System.Net.Http.Headers.HttpRequestHeaders Headers { get { throw null; } } + public System.Net.Http.HttpMethod Method { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Properties { get { throw null; } } + public System.Uri RequestUri { get { throw null; } set { } } + public System.Version Version { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public override string ToString() { throw null; } + } + public partial class HttpResponseMessage : System.IDisposable + { + public HttpResponseMessage() { } + public HttpResponseMessage(System.Net.HttpStatusCode statusCode) { } + public System.Net.Http.HttpContent Content { get { throw null; } set { } } + public System.Net.Http.Headers.HttpResponseHeaders Headers { get { throw null; } } + public bool IsSuccessStatusCode { get { throw null; } } + public string ReasonPhrase { get { throw null; } set { } } + public System.Net.Http.HttpRequestMessage RequestMessage { get { throw null; } set { } } + public System.Net.HttpStatusCode StatusCode { get { throw null; } set { } } + public System.Version Version { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public System.Net.Http.HttpResponseMessage EnsureSuccessStatusCode() { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class MessageProcessingHandler : System.Net.Http.DelegatingHandler + { + protected MessageProcessingHandler() { } + protected MessageProcessingHandler(System.Net.Http.HttpMessageHandler innerHandler) { } + protected abstract System.Net.Http.HttpRequestMessage ProcessRequest(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken); + protected abstract System.Net.Http.HttpResponseMessage ProcessResponse(System.Net.Http.HttpResponseMessage response, System.Threading.CancellationToken cancellationToken); + protected internal sealed override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public partial class MultipartContent : System.Net.Http.HttpContent, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + public MultipartContent() { } + public MultipartContent(string subtype) { } + public MultipartContent(string subtype, string boundary) { } + public virtual void Add(System.Net.Http.HttpContent content) { } + protected override void Dispose(bool disposing) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public partial class MultipartFormDataContent : System.Net.Http.MultipartContent + { + public MultipartFormDataContent() { } + public MultipartFormDataContent(string boundary) { } + public override void Add(System.Net.Http.HttpContent content) { } + public void Add(System.Net.Http.HttpContent content, string name) { } + public void Add(System.Net.Http.HttpContent content, string name, string fileName) { } + } + public partial class StreamContent : System.Net.Http.HttpContent + { + public StreamContent(System.IO.Stream content) { } + public StreamContent(System.IO.Stream content, int bufferSize) { } + protected override System.Threading.Tasks.Task CreateContentReadStreamAsync() { throw null; } + protected override void Dispose(bool disposing) { } + protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) { throw null; } + protected internal override bool TryComputeLength(out long length) { length = default(long); throw null; } + } + public partial class StringContent : System.Net.Http.ByteArrayContent + { + public StringContent(string content) : base (default(byte[])) { } + public StringContent(string content, System.Text.Encoding encoding) : base (default(byte[])) { } + public StringContent(string content, System.Text.Encoding encoding, string mediaType) : base (default(byte[])) { } + } +} +namespace System.Net.Http.Headers +{ + public partial class AuthenticationHeaderValue : System.ICloneable + { + public AuthenticationHeaderValue(string scheme) { } + public AuthenticationHeaderValue(string scheme, string parameter) { } + public string Parameter { get { throw null; } } + public string Scheme { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.AuthenticationHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.AuthenticationHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.AuthenticationHeaderValue); throw null; } + } + public partial class CacheControlHeaderValue : System.ICloneable + { + public CacheControlHeaderValue() { } + public System.Collections.Generic.ICollection Extensions { get { throw null; } } + public System.Nullable MaxAge { get { throw null; } set { } } + public bool MaxStale { get { throw null; } set { } } + public System.Nullable MaxStaleLimit { get { throw null; } set { } } + public System.Nullable MinFresh { get { throw null; } set { } } + public bool MustRevalidate { get { throw null; } set { } } + public bool NoCache { get { throw null; } set { } } + public System.Collections.Generic.ICollection NoCacheHeaders { get { throw null; } } + public bool NoStore { get { throw null; } set { } } + public bool NoTransform { get { throw null; } set { } } + public bool OnlyIfCached { get { throw null; } set { } } + public bool Private { get { throw null; } set { } } + public System.Collections.Generic.ICollection PrivateHeaders { get { throw null; } } + public bool ProxyRevalidate { get { throw null; } set { } } + public bool Public { get { throw null; } set { } } + public System.Nullable SharedMaxAge { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.CacheControlHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.CacheControlHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.CacheControlHeaderValue); throw null; } + } + public partial class ContentDispositionHeaderValue : System.ICloneable + { + protected ContentDispositionHeaderValue(System.Net.Http.Headers.ContentDispositionHeaderValue source) { } + public ContentDispositionHeaderValue(string dispositionType) { } + public System.Nullable CreationDate { get { throw null; } set { } } + public string DispositionType { get { throw null; } set { } } + public string FileName { get { throw null; } set { } } + public string FileNameStar { get { throw null; } set { } } + public System.Nullable ModificationDate { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public System.Nullable ReadDate { get { throw null; } set { } } + public System.Nullable Size { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ContentDispositionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ContentDispositionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ContentDispositionHeaderValue); throw null; } + } + public partial class ContentRangeHeaderValue : System.ICloneable + { + public ContentRangeHeaderValue(long length) { } + public ContentRangeHeaderValue(long from, long to) { } + public ContentRangeHeaderValue(long from, long to, long length) { } + public System.Nullable From { get { throw null; } } + public bool HasLength { get { throw null; } } + public bool HasRange { get { throw null; } } + public System.Nullable Length { get { throw null; } } + public System.Nullable To { get { throw null; } } + public string Unit { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ContentRangeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ContentRangeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ContentRangeHeaderValue); throw null; } + } + public partial class EntityTagHeaderValue : System.ICloneable + { + public EntityTagHeaderValue(string tag) { } + public EntityTagHeaderValue(string tag, bool isWeak) { } + public static System.Net.Http.Headers.EntityTagHeaderValue Any { get { throw null; } } + public bool IsWeak { get { throw null; } } + public string Tag { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.EntityTagHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.EntityTagHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.EntityTagHeaderValue); throw null; } + } + public sealed partial class HttpContentHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpContentHeaders() { } + public System.Collections.Generic.ICollection Allow { get { throw null; } } + public System.Net.Http.Headers.ContentDispositionHeaderValue ContentDisposition { get { throw null; } set { } } + public System.Collections.Generic.ICollection ContentEncoding { get { throw null; } } + public System.Collections.Generic.ICollection ContentLanguage { get { throw null; } } + public System.Nullable ContentLength { get { throw null; } set { } } + public System.Uri ContentLocation { get { throw null; } set { } } + public byte[] ContentMD5 { get { throw null; } set { } } + public System.Net.Http.Headers.ContentRangeHeaderValue ContentRange { get { throw null; } set { } } + public System.Net.Http.Headers.MediaTypeHeaderValue ContentType { get { throw null; } set { } } + public System.Nullable Expires { get { throw null; } set { } } + public System.Nullable LastModified { get { throw null; } set { } } + } + public abstract partial class HttpHeaders : System.Collections.Generic.IEnumerable>>, System.Collections.IEnumerable + { + protected HttpHeaders() { } + public void Add(string name, System.Collections.Generic.IEnumerable values) { } + public void Add(string name, string value) { } + public void Clear() { } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator>> GetEnumerator() { throw null; } + public System.Collections.Generic.IEnumerable GetValues(string name) { throw null; } + public bool Remove(string name) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + public bool TryAddWithoutValidation(string name, System.Collections.Generic.IEnumerable values) { throw null; } + public bool TryAddWithoutValidation(string name, string value) { throw null; } + public bool TryGetValues(string name, out System.Collections.Generic.IEnumerable values) { values = default(System.Collections.Generic.IEnumerable); throw null; } + } + public sealed partial class HttpHeaderValueCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : class + { + internal HttpHeaderValueCollection() { } + public int Count { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public void Add(T item) { } + public void Clear() { } + public bool Contains(T item) { throw null; } + public void CopyTo(T[] array, int arrayIndex) { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public void ParseAdd(string input) { } + public bool Remove(T item) { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public override string ToString() { throw null; } + public bool TryParseAdd(string input) { throw null; } + } + public sealed partial class HttpRequestHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpRequestHeaders() { } + public System.Net.Http.Headers.HttpHeaderValueCollection Accept { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptCharset { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptEncoding { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptLanguage { get { throw null; } } + public System.Net.Http.Headers.AuthenticationHeaderValue Authorization { get { throw null; } set { } } + public System.Net.Http.Headers.CacheControlHeaderValue CacheControl { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Connection { get { throw null; } } + public System.Nullable ConnectionClose { get { throw null; } set { } } + public System.Nullable Date { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Expect { get { throw null; } } + public System.Nullable ExpectContinue { get { throw null; } set { } } + public string From { get { throw null; } set { } } + public string Host { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection IfMatch { get { throw null; } } + public System.Nullable IfModifiedSince { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection IfNoneMatch { get { throw null; } } + public System.Net.Http.Headers.RangeConditionHeaderValue IfRange { get { throw null; } set { } } + public System.Nullable IfUnmodifiedSince { get { throw null; } set { } } + public System.Nullable MaxForwards { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Pragma { get { throw null; } } + public System.Net.Http.Headers.AuthenticationHeaderValue ProxyAuthorization { get { throw null; } set { } } + public System.Net.Http.Headers.RangeHeaderValue Range { get { throw null; } set { } } + public System.Uri Referrer { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection TE { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Trailer { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection TransferEncoding { get { throw null; } } + public System.Nullable TransferEncodingChunked { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Upgrade { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection UserAgent { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Via { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Warning { get { throw null; } } + } + public sealed partial class HttpResponseHeaders : System.Net.Http.Headers.HttpHeaders + { + internal HttpResponseHeaders() { } + public System.Net.Http.Headers.HttpHeaderValueCollection AcceptRanges { get { throw null; } } + public System.Nullable Age { get { throw null; } set { } } + public System.Net.Http.Headers.CacheControlHeaderValue CacheControl { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Connection { get { throw null; } } + public System.Nullable ConnectionClose { get { throw null; } set { } } + public System.Nullable Date { get { throw null; } set { } } + public System.Net.Http.Headers.EntityTagHeaderValue ETag { get { throw null; } set { } } + public System.Uri Location { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Pragma { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection ProxyAuthenticate { get { throw null; } } + public System.Net.Http.Headers.RetryConditionHeaderValue RetryAfter { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Server { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Trailer { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection TransferEncoding { get { throw null; } } + public System.Nullable TransferEncodingChunked { get { throw null; } set { } } + public System.Net.Http.Headers.HttpHeaderValueCollection Upgrade { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Vary { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Via { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection Warning { get { throw null; } } + public System.Net.Http.Headers.HttpHeaderValueCollection WwwAuthenticate { get { throw null; } } + } + public partial class MediaTypeHeaderValue : System.ICloneable + { + protected MediaTypeHeaderValue(System.Net.Http.Headers.MediaTypeHeaderValue source) { } + public MediaTypeHeaderValue(string mediaType) { } + public string CharSet { get { throw null; } set { } } + public string MediaType { get { throw null; } set { } } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.MediaTypeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.MediaTypeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.MediaTypeHeaderValue); throw null; } + } + public sealed partial class MediaTypeWithQualityHeaderValue : System.Net.Http.Headers.MediaTypeHeaderValue, System.ICloneable + { + public MediaTypeWithQualityHeaderValue(string mediaType) : base (default(System.Net.Http.Headers.MediaTypeHeaderValue)) { } + public MediaTypeWithQualityHeaderValue(string mediaType, double quality) : base (default(System.Net.Http.Headers.MediaTypeHeaderValue)) { } + public System.Nullable Quality { get { throw null; } set { } } + public static new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.MediaTypeWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue); throw null; } + } + public partial class NameValueHeaderValue : System.ICloneable + { + protected NameValueHeaderValue(System.Net.Http.Headers.NameValueHeaderValue source) { } + public NameValueHeaderValue(string name) { } + public NameValueHeaderValue(string name, string value) { } + public string Name { get { throw null; } } + public string Value { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.NameValueHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.NameValueHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.NameValueHeaderValue); throw null; } + } + public partial class NameValueWithParametersHeaderValue : System.Net.Http.Headers.NameValueHeaderValue, System.ICloneable + { + protected NameValueWithParametersHeaderValue(System.Net.Http.Headers.NameValueWithParametersHeaderValue source) : base (default(string)) { } + public NameValueWithParametersHeaderValue(string name) : base (default(string)) { } + public NameValueWithParametersHeaderValue(string name, string value) : base (default(string)) { } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static new System.Net.Http.Headers.NameValueWithParametersHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.NameValueWithParametersHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.NameValueWithParametersHeaderValue); throw null; } + } + public partial class ProductHeaderValue : System.ICloneable + { + public ProductHeaderValue(string name) { } + public ProductHeaderValue(string name, string version) { } + public string Name { get { throw null; } } + public string Version { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ProductHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ProductHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ProductHeaderValue); throw null; } + } + public partial class ProductInfoHeaderValue : System.ICloneable + { + public ProductInfoHeaderValue(System.Net.Http.Headers.ProductHeaderValue product) { } + public ProductInfoHeaderValue(string comment) { } + public ProductInfoHeaderValue(string productName, string productVersion) { } + public string Comment { get { throw null; } } + public System.Net.Http.Headers.ProductHeaderValue Product { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ProductInfoHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ProductInfoHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ProductInfoHeaderValue); throw null; } + } + public partial class RangeConditionHeaderValue : System.ICloneable + { + public RangeConditionHeaderValue(System.DateTimeOffset date) { } + public RangeConditionHeaderValue(System.Net.Http.Headers.EntityTagHeaderValue entityTag) { } + public RangeConditionHeaderValue(string entityTag) { } + public System.Nullable Date { get { throw null; } } + public System.Net.Http.Headers.EntityTagHeaderValue EntityTag { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RangeConditionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RangeConditionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RangeConditionHeaderValue); throw null; } + } + public partial class RangeHeaderValue : System.ICloneable + { + public RangeHeaderValue() { } + public RangeHeaderValue(System.Nullable from, System.Nullable to) { } + public System.Collections.Generic.ICollection Ranges { get { throw null; } } + public string Unit { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RangeHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RangeHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RangeHeaderValue); throw null; } + } + public partial class RangeItemHeaderValue : System.ICloneable + { + public RangeItemHeaderValue(System.Nullable from, System.Nullable to) { } + public System.Nullable From { get { throw null; } } + public System.Nullable To { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + } + public partial class RetryConditionHeaderValue : System.ICloneable + { + public RetryConditionHeaderValue(System.DateTimeOffset date) { } + public RetryConditionHeaderValue(System.TimeSpan delta) { } + public System.Nullable Date { get { throw null; } } + public System.Nullable Delta { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.RetryConditionHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.RetryConditionHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.RetryConditionHeaderValue); throw null; } + } + public partial class StringWithQualityHeaderValue : System.ICloneable + { + public StringWithQualityHeaderValue(string value) { } + public StringWithQualityHeaderValue(string value, double quality) { } + public System.Nullable Quality { get { throw null; } } + public string Value { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.StringWithQualityHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.StringWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.StringWithQualityHeaderValue); throw null; } + } + public partial class TransferCodingHeaderValue : System.ICloneable + { + protected TransferCodingHeaderValue(System.Net.Http.Headers.TransferCodingHeaderValue source) { } + public TransferCodingHeaderValue(string value) { } + public System.Collections.Generic.ICollection Parameters { get { throw null; } } + public string Value { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.TransferCodingHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.TransferCodingHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.TransferCodingHeaderValue); throw null; } + } + public sealed partial class TransferCodingWithQualityHeaderValue : System.Net.Http.Headers.TransferCodingHeaderValue, System.ICloneable + { + public TransferCodingWithQualityHeaderValue(string value) : base (default(System.Net.Http.Headers.TransferCodingHeaderValue)) { } + public TransferCodingWithQualityHeaderValue(string value, double quality) : base (default(System.Net.Http.Headers.TransferCodingHeaderValue)) { } + public System.Nullable Quality { get { throw null; } set { } } + public static new System.Net.Http.Headers.TransferCodingWithQualityHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.TransferCodingWithQualityHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.TransferCodingWithQualityHeaderValue); throw null; } + } + public partial class ViaHeaderValue : System.ICloneable + { + public ViaHeaderValue(string protocolVersion, string receivedBy) { } + public ViaHeaderValue(string protocolVersion, string receivedBy, string protocolName) { } + public ViaHeaderValue(string protocolVersion, string receivedBy, string protocolName, string comment) { } + public string Comment { get { throw null; } } + public string ProtocolName { get { throw null; } } + public string ProtocolVersion { get { throw null; } } + public string ReceivedBy { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.ViaHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.ViaHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.ViaHeaderValue); throw null; } + } + public partial class WarningHeaderValue : System.ICloneable + { + public WarningHeaderValue(int code, string agent, string text) { } + public WarningHeaderValue(int code, string agent, string text, System.DateTimeOffset date) { } + public string Agent { get { throw null; } } + public int Code { get { throw null; } } + public System.Nullable Date { get { throw null; } } + public string Text { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Net.Http.Headers.WarningHeaderValue Parse(string input) { throw null; } + object System.ICloneable.Clone() { throw null; } + public override string ToString() { throw null; } + public static bool TryParse(string input, out System.Net.Http.Headers.WarningHeaderValue parsedValue) { parsedValue = default(System.Net.Http.Headers.WarningHeaderValue); throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Net.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Net.cs new file mode 100644 index 0000000000..1ded5346d4 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Net.cs @@ -0,0 +1,938 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(263))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Net.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Cookie))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CookieCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CookieContainer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.CookieException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DnsEndPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DownloadProgressChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DownloadProgressChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DownloadStringCompletedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.DownloadStringCompletedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.EndPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpRequestHeader))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpStatusCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpWebRequest))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.HttpWebResponse))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.ICredentials))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IPAddress))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IPEndPoint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.IWebRequestCreate))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkCredential))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkAddressChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkChange))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.NetworkInterface))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.OpenReadCompletedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.OpenReadCompletedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.OpenWriteCompletedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.OpenWriteCompletedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.ProtocolViolationException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.SocketAddress))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.AddressFamily))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.ProtocolType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.Socket))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketAsyncEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketAsyncOperation))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketError))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketShutdown))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Sockets.SocketType))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.UploadProgressChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.UploadProgressChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.UploadStringCompletedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.UploadStringCompletedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebClient))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebExceptionStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebHeaderCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebRequest))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WebResponse))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WriteStreamClosedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.WriteStreamClosedEventHandler))] +namespace System.Net +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial interface INetworkProgress + { + event System.EventHandler ProgressChanged; + event System.EventHandler ProgressCompleted; + event System.EventHandler ProgressFailed; + } + [System.SerializableAttribute] + public partial class IPEndPointCollection : System.Collections.ObjectModel.Collection + { + public IPEndPointCollection() { } + protected override void InsertItem(int index, System.Net.IPEndPoint item) { } + protected override void SetItem(int index, System.Net.IPEndPoint item) { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial interface IUnsafeWebRequestCreate + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + System.Net.WebRequest Create(System.Uri uri); + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial class NetworkProgressChangedEventArgs : System.ComponentModel.ProgressChangedEventArgs + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public NetworkProgressChangedEventArgs(int percentage, int processedBytes, int totalBytes, object userState) : base (default(int), default(object)) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int ProcessedBytes { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int TotalBytes { get { throw null; } } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public static partial class UiSynchronizationContext + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public static System.Threading.SynchronizationContext Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public static int ManagedUiThreadId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } +} +namespace System.Net.PeerToPeer +{ + [System.SerializableAttribute] + public partial class Cloud : System.IEquatable, System.Runtime.Serialization.ISerializable + { + public static readonly System.Net.PeerToPeer.Cloud AllLinkLocal; + public static readonly System.Net.PeerToPeer.Cloud Available; + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected Cloud(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public static System.Net.PeerToPeer.Cloud Global { get { throw null; } } + public string Name { get { throw null; } } + public System.Net.PeerToPeer.PnrpScope Scope { get { throw null; } } + public int ScopeId { get { throw null; } } + public bool Equals(System.Net.PeerToPeer.Cloud other) { throw null; } + public override bool Equals(object obj) { throw null; } + public static System.Net.PeerToPeer.CloudCollection GetAvailableClouds() { throw null; } + public static System.Net.PeerToPeer.Cloud GetCloudByName(string cloudName) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class CloudCollection : System.Collections.ObjectModel.Collection + { + public CloudCollection() { } + protected override void InsertItem(int index, System.Net.PeerToPeer.Cloud item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.Cloud item) { } + } + [System.SerializableAttribute] + public partial class PeerName : System.IEquatable, System.Runtime.Serialization.ISerializable + { + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerName(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public PeerName(string remotePeerName) { } + [System.Security.SecurityCriticalAttribute] + public PeerName(string classifier, System.Net.PeerToPeer.PeerNameType peerNameType) { } + public string Authority { get { throw null; } } + public string Classifier { get { throw null; } } + public bool IsSecured { get { throw null; } } + public string PeerHostName { [System.Security.SecurityCriticalAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.PeerName CreateFromPeerHostName(string peerHostName) { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.PeerName CreateRelativePeerName(System.Net.PeerToPeer.PeerName peerName, string classifier) { throw null; } + public bool Equals(System.Net.PeerToPeer.PeerName other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerNameRecord : System.Runtime.Serialization.ISerializable + { + public PeerNameRecord() { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerNameRecord(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public string Comment { get { throw null; } set { } } + public byte[] Data { get { throw null; } set { } } + public System.Net.IPEndPointCollection EndPointCollection { get { throw null; } } + public System.Net.PeerToPeer.PeerName PeerName { get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class PeerNameRecordCollection : System.Collections.ObjectModel.Collection + { + public PeerNameRecordCollection() { } + protected override void InsertItem(int index, System.Net.PeerToPeer.PeerNameRecord item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.PeerNameRecord item) { } + } + [System.SerializableAttribute] + public partial class PeerNameRegistration : System.IDisposable, System.Runtime.Serialization.ISerializable + { + public PeerNameRegistration() { } + public PeerNameRegistration(System.Net.PeerToPeer.PeerName name, int port) { } + public PeerNameRegistration(System.Net.PeerToPeer.PeerName name, int port, System.Net.PeerToPeer.Cloud cloud) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerNameRegistration(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.Net.PeerToPeer.Cloud Cloud { get { throw null; } set { } } + public string Comment { get { throw null; } set { } } + public byte[] Data { get { throw null; } set { } } + public System.Net.IPEndPointCollection EndPointCollection { get { throw null; } } + public System.Net.PeerToPeer.PeerName PeerName { get { throw null; } set { } } + public int Port { get { throw null; } set { } } + public bool UseAutoEndPointSelection { get { throw null; } set { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public bool IsRegistered() { throw null; } + [System.Security.SecurityCriticalAttribute] + public void Start() { } + [System.Security.SecurityCriticalAttribute] + public void Stop() { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + public void Update() { } + } + public partial class PeerNameResolver + { + public PeerNameResolver() { } + public event System.EventHandler ResolveCompleted { add { } remove { } } + public event System.EventHandler ResolveProgressChanged { add { } remove { } } + protected void OnResolveCompleted(System.Net.PeerToPeer.ResolveCompletedEventArgs e) { } + protected void OnResolveProgressChanged(System.Net.PeerToPeer.ResolveProgressChangedEventArgs e) { } + public System.Net.PeerToPeer.PeerNameRecordCollection Resolve(System.Net.PeerToPeer.PeerName peerName) { throw null; } + public System.Net.PeerToPeer.PeerNameRecordCollection Resolve(System.Net.PeerToPeer.PeerName peerName, int maxRecords) { throw null; } + public System.Net.PeerToPeer.PeerNameRecordCollection Resolve(System.Net.PeerToPeer.PeerName peerName, System.Net.PeerToPeer.Cloud cloud) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.PeerNameRecordCollection Resolve(System.Net.PeerToPeer.PeerName peerName, System.Net.PeerToPeer.Cloud cloud, int maxRecords) { throw null; } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, ExternalThreading=true)] + public void ResolveAsync(System.Net.PeerToPeer.PeerName peerName, int maxRecords, object userState) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, ExternalThreading=true)] + public void ResolveAsync(System.Net.PeerToPeer.PeerName peerName, System.Net.PeerToPeer.Cloud cloud, int maxRecords, object userState) { } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, ExternalThreading=true)] + public void ResolveAsync(System.Net.PeerToPeer.PeerName peerName, System.Net.PeerToPeer.Cloud cloud, object userState) { } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, ExternalThreading=true)] + public void ResolveAsync(System.Net.PeerToPeer.PeerName peerName, object userState) { } + [System.Security.SecurityCriticalAttribute] + public void ResolveAsyncCancel(object userState) { } + } + public enum PeerNameType + { + Secured = 0, + Unsecured = 1, + } + [System.SerializableAttribute] + public partial class PeerToPeerException : System.Exception, System.Runtime.Serialization.ISerializable + { + public PeerToPeerException() { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerToPeerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public PeerToPeerException(string message) { } + public PeerToPeerException(string message, System.Exception innerException) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public sealed partial class PnrpPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public PnrpPermission(System.Security.Permissions.PermissionState state) { } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement e) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(109), AllowMultiple=true, Inherited=false)] + [System.SerializableAttribute] + public sealed partial class PnrpPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public PnrpPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public override System.Security.IPermission CreatePermission() { throw null; } + } + public enum PnrpScope + { + All = 0, + Global = 1, + LinkLocal = 3, + SiteLocal = 2, + } + public partial class ResolveCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + public ResolveCompletedEventArgs(System.Net.PeerToPeer.PeerNameRecordCollection peerNameRecordCollection, System.Exception error, bool canceled, object userToken) : base (default(System.Exception), default(bool), default(object)) { } + public System.Net.PeerToPeer.PeerNameRecordCollection PeerNameRecordCollection { get { throw null; } } + } + public partial class ResolveProgressChangedEventArgs : System.ComponentModel.ProgressChangedEventArgs + { + public ResolveProgressChangedEventArgs(System.Net.PeerToPeer.PeerNameRecord peerNameRecord, object userToken) : base (default(int), default(object)) { } + public System.Net.PeerToPeer.PeerNameRecord PeerNameRecord { get { throw null; } } + } +} +namespace System.Net.PeerToPeer.Collaboration +{ + public partial class ApplicationChangedEventArgs : System.EventArgs + { + internal ApplicationChangedEventArgs() { } + public System.Net.PeerToPeer.Collaboration.PeerApplication PeerApplication { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerChangeType PeerChangeType { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + } + public sealed partial class ContactManager : System.IDisposable + { + internal ContactManager() { } + public static System.Net.PeerToPeer.Collaboration.PeerContact LocalContact { [System.Security.SecurityCriticalAttribute]get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DescriptionAttribute("SynchronizingObject")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + public event System.EventHandler ApplicationChanged { add { } remove { } } + public event System.EventHandler CreateContactCompleted { add { } remove { } } + public event System.EventHandler NameChanged { add { } remove { } } + public event System.EventHandler ObjectChanged { add { } remove { } } + public event System.EventHandler PresenceChanged { add { } remove { } } + public event System.EventHandler SubscriptionListChanged { add { } remove { } } + [System.Security.SecurityCriticalAttribute] + public void AddContact(System.Net.PeerToPeer.Collaboration.PeerContact peerContact) { } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerContact CreateContact(System.Net.PeerToPeer.Collaboration.PeerNearMe peerNearMe) { throw null; } + public void CreateContactAsync(System.Net.PeerToPeer.Collaboration.PeerNearMe peerNearMe, object userToken) { } + public void DeleteContact(System.Net.PeerToPeer.Collaboration.PeerContact peerContact) { } + [System.Security.SecurityCriticalAttribute] + public void DeleteContact(System.Net.PeerToPeer.PeerName peerName) { } + [System.Security.SecurityCriticalAttribute] + public void Dispose() { } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerContact GetContact(System.Net.PeerToPeer.PeerName peerName) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerContactCollection GetContacts() { throw null; } + [System.Security.SecurityCriticalAttribute] + public void UpdateContact(System.Net.PeerToPeer.Collaboration.PeerContact peerContact) { } + } + public partial class CreateContactCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + internal CreateContactCompletedEventArgs() : base (default(System.Exception), default(bool), default(object)) { } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + } + public partial class InviteCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + internal InviteCompletedEventArgs() : base (default(System.Exception), default(bool), default(object)) { } + public System.Net.PeerToPeer.Collaboration.PeerInvitationResponse InviteResponse { get { throw null; } } + } + public partial class NameChangedEventArgs : System.EventArgs + { + internal NameChangedEventArgs() { } + public string Name { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + } + public partial class ObjectChangedEventArgs : System.EventArgs + { + internal ObjectChangedEventArgs() { } + public System.Net.PeerToPeer.Collaboration.PeerChangeType PeerChangeType { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerObject PeerObject { get { throw null; } } + } + [System.SerializableAttribute] + public abstract partial class Peer : System.IDisposable, System.IEquatable, System.Runtime.Serialization.ISerializable + { + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected Peer(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + public bool IsOnline { get { throw null; } } + public virtual System.Net.PeerToPeer.Collaboration.PeerEndPointCollection PeerEndPoints { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DescriptionAttribute("SynchronizingObject")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + public event System.EventHandler InviteCompleted { add { } remove { } } + public void Dispose() { } + protected virtual void Dispose(bool disposing) { } + public bool Equals(System.Net.PeerToPeer.Collaboration.Peer other) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerObjectCollection GetObjects() { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerObjectCollection GetObjects(System.Guid objectId) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerPresenceInfo GetPresenceInfo(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint) { throw null; } + public abstract System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite(); + public abstract System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite(System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData); + public abstract void InviteAsync(System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData, object userToken); + public abstract void InviteAsync(object userToken); + [System.Security.SecurityCriticalAttribute] + public void InviteAsyncCancel(object userToken) { } + protected virtual void OnInviteCompleted(System.Net.PeerToPeer.Collaboration.InviteCompletedEventArgs e) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerApplication : System.IDisposable, System.IEquatable, System.Runtime.Serialization.ISerializable + { + public PeerApplication() { } + public PeerApplication(System.Guid id, string description, byte[] data, string path, string commandLineArgs, System.Net.PeerToPeer.Collaboration.PeerScope peerScope) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerApplication(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + public string CommandLineArgs { get { throw null; } set { } } + public byte[] Data { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public System.Guid Id { get { throw null; } set { } } + public string Path { get { throw null; } set { } } + public System.Net.PeerToPeer.Collaboration.PeerScope PeerScope { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DescriptionAttribute("SynchronizingObject")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + public event System.EventHandler ApplicationChanged { add { } remove { } } + [System.Security.SecurityCriticalAttribute] + public void Dispose() { } + [System.Security.SecurityCriticalAttribute] + protected virtual void Dispose(bool disposing) { } + public bool Equals(System.Net.PeerToPeer.Collaboration.PeerApplication other) { throw null; } + public override bool Equals(object obj) { throw null; } + public static new bool Equals(object objA, object objB) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + protected virtual void OnApplicationChanged(System.Net.PeerToPeer.Collaboration.ApplicationChangedEventArgs appChangedArgs) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerApplicationCollection : System.Collections.ObjectModel.Collection + { + internal PeerApplicationCollection() { } + protected override void InsertItem(int index, System.Net.PeerToPeer.Collaboration.PeerApplication item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.Collaboration.PeerApplication item) { } + public override string ToString() { throw null; } + } + public partial class PeerApplicationLaunchInfo + { + internal PeerApplicationLaunchInfo() { } + public byte[] Data { get { throw null; } } + public string Message { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerApplication PeerApplication { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + } + public enum PeerApplicationRegistrationType + { + AllUsers = 1, + CurrentUser = 0, + } + public enum PeerChangeType + { + Added = 0, + Deleted = 1, + Updated = 2, + } + public static partial class PeerCollaboration + { + public static System.Net.PeerToPeer.Collaboration.PeerApplicationLaunchInfo ApplicationLaunchInfo { [System.Security.SecurityCriticalAttribute]get { throw null; } } + public static System.Net.PeerToPeer.Collaboration.ContactManager ContactManager { [System.Security.SecurityCriticalAttribute]get { throw null; } } + public static string LocalEndPointName { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } } + public static System.Net.PeerToPeer.Collaboration.PeerPresenceInfo LocalPresenceInfo { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } } + public static System.Net.PeerToPeer.Collaboration.PeerScope SignInScope { [System.Security.SecurityCriticalAttribute]get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DescriptionAttribute("SynchronizingObject")] + public static System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + public static event System.EventHandler LocalApplicationChanged { add { } remove { } } + public static event System.EventHandler LocalNameChanged { add { } remove { } } + public static event System.EventHandler LocalObjectChanged { add { } remove { } } + public static event System.EventHandler LocalPresenceChanged { add { } remove { } } + [System.Security.SecurityCriticalAttribute] + public static void DeleteObject(System.Net.PeerToPeer.Collaboration.PeerObject peerObject) { } + public static System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetLocalRegisteredApplications() { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetLocalRegisteredApplications(System.Net.PeerToPeer.Collaboration.PeerApplicationRegistrationType type) { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.Collaboration.PeerObjectCollection GetLocalSetObjects() { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.Collaboration.PeerNearMeCollection GetPeersNearMe() { throw null; } + [System.Security.SecurityCriticalAttribute] + public static void RegisterApplication(System.Net.PeerToPeer.Collaboration.PeerApplication application, System.Net.PeerToPeer.Collaboration.PeerApplicationRegistrationType type) { } + [System.Security.SecurityCriticalAttribute] + public static void SetObject(System.Net.PeerToPeer.Collaboration.PeerObject peerObject) { } + [System.Security.SecurityCriticalAttribute] + public static void SignIn(System.Net.PeerToPeer.Collaboration.PeerScope peerScope) { } + [System.Security.SecurityCriticalAttribute] + public static void SignOut(System.Net.PeerToPeer.Collaboration.PeerScope peerScope) { } + [System.Security.SecurityCriticalAttribute] + public static void UnregisterApplication(System.Net.PeerToPeer.Collaboration.PeerApplication application, System.Net.PeerToPeer.Collaboration.PeerApplicationRegistrationType type) { } + } + [System.SerializableAttribute] + public sealed partial class PeerCollaborationPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public PeerCollaborationPermission(System.Security.Permissions.PermissionState state) { } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement e) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(109), AllowMultiple=true, Inherited=false)] + [System.SerializableAttribute] + public sealed partial class PeerCollaborationPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public PeerCollaborationPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public override System.Security.IPermission CreatePermission() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerContact : System.Net.PeerToPeer.Collaboration.Peer, System.IEquatable, System.Runtime.Serialization.ISerializable + { + [System.Security.SecurityCriticalAttribute] + protected PeerContact(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Credentials { get { throw null; } } + public string DisplayName { get { throw null; } set { } } + public System.Net.Mail.MailAddress EmailAddress { get { throw null; } set { } } + public bool IsSubscribed { get { throw null; } } + public string Nickname { get { throw null; } set { } } + public override System.Net.PeerToPeer.Collaboration.PeerEndPointCollection PeerEndPoints { [System.Security.SecurityCriticalAttribute]get { throw null; } } + public System.Net.PeerToPeer.PeerName PeerName { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.SubscriptionType SubscribeAllowed { get { throw null; } set { } } + public event System.EventHandler ApplicationChanged { add { } remove { } } + public event System.EventHandler ObjectChanged { add { } remove { } } + public event System.EventHandler PresenceChanged { add { } remove { } } + public event System.EventHandler SubscribeCompleted { add { } remove { } } + [System.Security.SecurityCriticalAttribute] + protected override void Dispose(bool disposing) { } + public bool Equals(System.Net.PeerToPeer.Collaboration.PeerContact other) { throw null; } + public override bool Equals(object obj) { throw null; } + public static new bool Equals(object objA, object objB) { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.Collaboration.PeerContact FromXml(string peerContactXml) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetApplications() { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetApplications(System.Guid applicationId) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetApplications(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetApplications(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint, System.Guid applicationId) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerObjectCollection GetObjects(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerObjectCollection GetObjects(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint, System.Guid objectId) { throw null; } + [System.Security.SecurityCriticalAttribute] + public override System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite() { throw null; } + [System.Security.SecurityCriticalAttribute] + public override System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite(System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint) { throw null; } + [System.Security.SecurityCriticalAttribute] + public System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint, System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData) { throw null; } + [System.Security.SecurityCriticalAttribute] + public override void InviteAsync(System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData, object userToken) { } + [System.Security.SecurityCriticalAttribute] + public void InviteAsync(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint, object userToken) { } + [System.Security.SecurityCriticalAttribute] + public void InviteAsync(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint, string message, byte[] invitationData, System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, object userToken) { } + [System.Security.SecurityCriticalAttribute] + public override void InviteAsync(object userToken) { } + protected virtual void OnApplicationChanged(System.Net.PeerToPeer.Collaboration.ApplicationChangedEventArgs appChangedArgs) { } + protected virtual void OnObjectChanged(System.Net.PeerToPeer.Collaboration.ObjectChangedEventArgs objChangedArgs) { } + protected virtual void OnPresenceChanged(System.Net.PeerToPeer.Collaboration.PresenceChangedEventArgs presenceChangedArgs) { } + protected void OnSubscribeCompleted(System.Net.PeerToPeer.Collaboration.SubscribeCompletedEventArgs e) { } + public virtual void Subscribe() { } + public virtual void SubscribeAsync(object userToken) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + [System.Security.SecurityCriticalAttribute] + public string ToXml() { throw null; } + public virtual void Unsubscribe() { } + } + [System.SerializableAttribute] + public partial class PeerContactCollection : System.Collections.ObjectModel.Collection + { + internal PeerContactCollection() { } + protected override void InsertItem(int index, System.Net.PeerToPeer.Collaboration.PeerContact item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.Collaboration.PeerContact item) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerEndPoint : System.IDisposable, System.IEquatable, System.Runtime.Serialization.ISerializable + { + public PeerEndPoint() { } + public PeerEndPoint(System.Net.IPEndPoint endPoint) { } + public PeerEndPoint(System.Net.IPEndPoint endPoint, string endPointName) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerEndPoint(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + public System.Net.IPEndPoint EndPoint { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DescriptionAttribute("SynchronizingObject")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + public event System.EventHandler NameChanged { add { } remove { } } + [System.Security.SecurityCriticalAttribute] + public void Dispose() { } + [System.Security.SecurityCriticalAttribute] + protected virtual void Dispose(bool disposing) { } + public bool Equals(System.Net.PeerToPeer.Collaboration.PeerEndPoint other) { throw null; } + public override bool Equals(object obj) { throw null; } + public static new bool Equals(object objA, object objB) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + protected void OnNameChanged(System.Net.PeerToPeer.Collaboration.NameChangedEventArgs nameChangedArgs) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerEndPointCollection : System.Collections.ObjectModel.Collection, System.IEquatable + { + internal PeerEndPointCollection() { } + public bool Equals(System.Net.PeerToPeer.Collaboration.PeerEndPointCollection other) { throw null; } + protected override void InsertItem(int index, System.Net.PeerToPeer.Collaboration.PeerEndPoint item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.Collaboration.PeerEndPoint item) { } + public override string ToString() { throw null; } + } + public partial class PeerInvitationResponse + { + internal PeerInvitationResponse() { } + public System.Net.PeerToPeer.Collaboration.PeerInvitationResponseType PeerInvitationResponseType { get { throw null; } } + } + public enum PeerInvitationResponseType + { + Accepted = 1, + Declined = 0, + Expired = 2, + } + [System.SerializableAttribute] + public partial class PeerNearMe : System.Net.PeerToPeer.Collaboration.Peer, System.IEquatable, System.Runtime.Serialization.ISerializable + { + public PeerNearMe() : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerNearMe(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) : base (default(System.Runtime.Serialization.SerializationInfo), default(System.Runtime.Serialization.StreamingContext)) { } + public string Nickname { get { throw null; } } + public static event System.EventHandler PeerNearMeChanged { add { } remove { } } + public event System.EventHandler RefreshDataCompleted { add { } remove { } } + public System.Net.PeerToPeer.Collaboration.PeerContact AddToContactManager() { throw null; } + public System.Net.PeerToPeer.Collaboration.PeerContact AddToContactManager(string displayName, string nickname, System.Net.Mail.MailAddress emailAddress) { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Net.PeerToPeer.Collaboration.PeerNearMe CreateFromPeerEndPoint(System.Net.PeerToPeer.Collaboration.PeerEndPoint peerEndPoint) { throw null; } + protected override void Dispose(bool disposing) { } + public bool Equals(System.Net.PeerToPeer.Collaboration.PeerNearMe other) { throw null; } + public override bool Equals(object obj) { throw null; } + public static new bool Equals(object objA, object objB) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + [System.Security.SecurityCriticalAttribute] + protected internal void InternalRefreshData(object state) { } + [System.Security.SecurityCriticalAttribute] + public override System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite() { throw null; } + [System.Security.SecurityCriticalAttribute] + public override System.Net.PeerToPeer.Collaboration.PeerInvitationResponse Invite(System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData) { throw null; } + [System.Security.SecurityCriticalAttribute] + public override void InviteAsync(System.Net.PeerToPeer.Collaboration.PeerApplication applicationToInvite, string message, byte[] invitationData, object userToken) { } + [System.Security.SecurityCriticalAttribute] + public override void InviteAsync(object userToken) { } + protected void OnRefreshDataCompleted(System.Net.PeerToPeer.Collaboration.RefreshDataCompletedEventArgs e) { } + [System.Security.SecurityCriticalAttribute] + public void RefreshData() { } + [System.Security.SecurityCriticalAttribute] + public void RefreshDataAsync(object userToken) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + public partial class PeerNearMeChangedEventArgs : System.EventArgs + { + internal PeerNearMeChangedEventArgs() { } + public System.Net.PeerToPeer.Collaboration.PeerChangeType PeerChangeType { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerNearMe PeerNearMe { get { throw null; } } + } + [System.SerializableAttribute] + public partial class PeerNearMeCollection : System.Collections.ObjectModel.Collection + { + internal PeerNearMeCollection() { } + protected override void InsertItem(int index, System.Net.PeerToPeer.Collaboration.PeerNearMe item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.Collaboration.PeerNearMe item) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerObject : System.IDisposable, System.IEquatable, System.Runtime.Serialization.ISerializable + { + public PeerObject() { } + public PeerObject(System.Guid Id, byte[] data, System.Net.PeerToPeer.Collaboration.PeerScope peerScope) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + protected PeerObject(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } + public byte[] Data { get { throw null; } set { } } + public System.Guid Id { get { throw null; } set { } } + public System.Net.PeerToPeer.Collaboration.PeerScope PeerScope { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DescriptionAttribute("SynchronizingObject")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } } + public event System.EventHandler ObjectChanged { add { } remove { } } + [System.Security.SecurityCriticalAttribute] + public void Dispose() { } + [System.Security.SecurityCriticalAttribute] + protected virtual void Dispose(bool disposing) { } + public bool Equals(System.Net.PeerToPeer.Collaboration.PeerObject other) { throw null; } + public override bool Equals(object obj) { throw null; } + public static new bool Equals(object objA, object objB) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + protected virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + protected virtual void OnObjectChanged(System.Net.PeerToPeer.Collaboration.ObjectChangedEventArgs objChangedArgs) { } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128), SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class PeerObjectCollection : System.Collections.ObjectModel.Collection + { + internal PeerObjectCollection() { } + protected override void InsertItem(int index, System.Net.PeerToPeer.Collaboration.PeerObject item) { } + protected override void SetItem(int index, System.Net.PeerToPeer.Collaboration.PeerObject item) { } + public override string ToString() { throw null; } + } + public partial class PeerPresenceInfo + { + public PeerPresenceInfo() { } + public PeerPresenceInfo(System.Net.PeerToPeer.Collaboration.PeerPresenceStatus presenceStatus, string description) { } + public string DescriptiveText { get { throw null; } set { } } + public System.Net.PeerToPeer.Collaboration.PeerPresenceStatus PresenceStatus { get { throw null; } set { } } + } + public enum PeerPresenceStatus + { + Away = 2, + BeRightBack = 3, + Busy = 5, + Idle = 4, + Offline = 0, + Online = 7, + OnThePhone = 6, + OutToLunch = 1, + } + public enum PeerScope + { + All = 3, + Internet = 2, + NearMe = 1, + None = 0, + } + public partial class PresenceChangedEventArgs : System.EventArgs + { + internal PresenceChangedEventArgs() { } + public System.Net.PeerToPeer.Collaboration.PeerChangeType PeerChangeType { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerPresenceInfo PeerPresenceInfo { get { throw null; } } + } + public partial class RefreshDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + internal RefreshDataCompletedEventArgs() : base (default(System.Exception), default(bool), default(object)) { } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + } + public partial class SubscribeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + internal SubscribeCompletedEventArgs() : base (default(System.Exception), default(bool), default(object)) { } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerNearMe PeerNearMe { get { throw null; } } + } + public partial class SubscriptionListChangedEventArgs : System.EventArgs + { + internal SubscriptionListChangedEventArgs() { } + public System.Net.PeerToPeer.Collaboration.PeerChangeType PeerChangeType { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerContact PeerContact { get { throw null; } } + public System.Net.PeerToPeer.Collaboration.PeerEndPoint PeerEndPoint { get { throw null; } } + } + public enum SubscriptionType + { + Allowed = 1, + Blocked = 0, + } +} +namespace System.Net.Sockets +{ + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial class HttpPolicyDownloaderProtocol + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public HttpPolicyDownloaderProtocol(System.Uri appUri, System.Net.IPAddress address) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.Net.Sockets.SocketPolicy Result { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void Abort() { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void BeginDownload(System.Net.Sockets.SecurityCriticalAction callback) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void DownloadCallback(System.IAsyncResult ar) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void ReadCallback(System.IAsyncResult ar) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public static void RegisterUnsafeWebRequestCreator(System.Net.IUnsafeWebRequestCreate creator) { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public delegate void SecurityCriticalAction(); + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial class SocketPolicy + { + public SocketPolicy() { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial class UdpAnySourceMulticastClient : System.IDisposable + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public UdpAnySourceMulticastClient(System.Net.IPAddress groupAddress, int localPort) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public bool MulticastLoopback { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int ReceiveBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int SendBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginJoinGroup(System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginReceiveFromGroup(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginSendTo(byte[] buffer, int offset, int count, System.Net.IPEndPoint remoteEndPoint, System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginSendToGroup(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void BlockSource(System.Net.IPAddress sourceAddress) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void Dispose() { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void EndJoinGroup(System.IAsyncResult result) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int EndReceiveFromGroup(System.IAsyncResult result, out System.Net.IPEndPoint source) { source = default(System.Net.IPEndPoint); throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void EndSendTo(System.IAsyncResult result) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void EndSendToGroup(System.IAsyncResult result) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void UnblockSource(System.Net.IPAddress sourceAddress) { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public partial class UdpSingleSourceMulticastClient : System.IDisposable + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public UdpSingleSourceMulticastClient(System.Net.IPAddress sourceAddress, System.Net.IPAddress groupAddress, int localPort) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int ReceiveBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int SendBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginJoinGroup(System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginReceiveFromSource(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public System.IAsyncResult BeginSendToSource(byte[] buffer, int offset, int count, int remotePort, System.AsyncCallback callback, object state) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void Dispose() { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void EndJoinGroup(System.IAsyncResult result) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public int EndReceiveFromSource(System.IAsyncResult result, out int sourcePort) { sourcePort = default(int); throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.ObsoleteAttribute("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)] + public void EndSendToSource(System.IAsyncResult result) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Numerics.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Numerics.cs new file mode 100644 index 0000000000..3fe9c48e7e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Numerics.cs @@ -0,0 +1,607 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Numerics.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Numerics.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Numerics.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Numerics +{ + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct BigInteger : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable + { + [System.CLSCompliantAttribute(false)] + public BigInteger(byte[] value) { throw null;} + public BigInteger(decimal value) { throw null;} + public BigInteger(double value) { throw null;} + public BigInteger(int value) { throw null;} + public BigInteger(long value) { throw null;} + public BigInteger(float value) { throw null;} + [System.CLSCompliantAttribute(false)] + public BigInteger(uint value) { throw null;} + [System.CLSCompliantAttribute(false)] + public BigInteger(ulong value) { throw null;} + public bool IsEven { get { throw null; } } + public bool IsOne { get { throw null; } } + public bool IsPowerOfTwo { get { throw null; } } + public bool IsZero { get { throw null; } } + public static System.Numerics.BigInteger MinusOne { get { throw null; } } + public static System.Numerics.BigInteger One { get { throw null; } } + public int Sign { get { throw null; } } + public static System.Numerics.BigInteger Zero { get { throw null; } } + public static System.Numerics.BigInteger Abs(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Add(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static int Compare(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public int CompareTo(long other) { throw null; } + public int CompareTo(System.Numerics.BigInteger other) { throw null; } + public int CompareTo(object obj) { throw null; } + [System.CLSCompliantAttribute(false)] + public int CompareTo(ulong other) { throw null; } + public static System.Numerics.BigInteger Divide(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger DivRem(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor, out System.Numerics.BigInteger remainder) { remainder = default(System.Numerics.BigInteger); throw null; } + public bool Equals(long other) { throw null; } + public bool Equals(System.Numerics.BigInteger other) { throw null; } + public override bool Equals(object obj) { throw null; } + [System.CLSCompliantAttribute(false)] + public bool Equals(ulong other) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static double Log(System.Numerics.BigInteger value) { throw null; } + public static double Log(System.Numerics.BigInteger value, double baseValue) { throw null; } + public static double Log10(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Max(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger Min(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger ModPow(System.Numerics.BigInteger value, System.Numerics.BigInteger exponent, System.Numerics.BigInteger modulus) { throw null; } + public static System.Numerics.BigInteger Multiply(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger Negate(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator &(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator |(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator --(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator /(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static bool operator ==(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator ==(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator ==(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator ==(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator ==(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator ^(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static explicit operator System.Numerics.BigInteger (decimal value) { throw null; } + public static explicit operator System.Numerics.BigInteger (double value) { throw null; } + public static explicit operator byte (System.Numerics.BigInteger value) { throw null; } + public static explicit operator decimal (System.Numerics.BigInteger value) { throw null; } + public static explicit operator double (System.Numerics.BigInteger value) { throw null; } + public static explicit operator short (System.Numerics.BigInteger value) { throw null; } + public static explicit operator int (System.Numerics.BigInteger value) { throw null; } + public static explicit operator long (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator sbyte (System.Numerics.BigInteger value) { throw null; } + public static explicit operator float (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ushort (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Numerics.BigInteger value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Numerics.BigInteger value) { throw null; } + public static explicit operator System.Numerics.BigInteger (float value) { throw null; } + public static bool operator >(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator >(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >(ulong left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator >=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator >=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator >=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static implicit operator System.Numerics.BigInteger (byte value) { throw null; } + public static implicit operator System.Numerics.BigInteger (short value) { throw null; } + public static implicit operator System.Numerics.BigInteger (int value) { throw null; } + public static implicit operator System.Numerics.BigInteger (long value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (sbyte value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.BigInteger (ulong value) { throw null; } + public static System.Numerics.BigInteger operator ++(System.Numerics.BigInteger value) { throw null; } + public static bool operator !=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator !=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator !=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator !=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator !=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator <<(System.Numerics.BigInteger value, int shift) { throw null; } + public static bool operator <(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator <(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <(ulong left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <=(long left, System.Numerics.BigInteger right) { throw null; } + public static bool operator <=(System.Numerics.BigInteger left, long right) { throw null; } + public static bool operator <=(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <=(System.Numerics.BigInteger left, ulong right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static bool operator <=(ulong left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator %(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger operator *(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator ~(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator >>(System.Numerics.BigInteger value, int shift) { throw null; } + public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public static System.Numerics.BigInteger operator -(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger operator +(System.Numerics.BigInteger value) { throw null; } + public static System.Numerics.BigInteger Parse(string value) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Parse(string value, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Pow(System.Numerics.BigInteger value, int exponent) { throw null; } + public static System.Numerics.BigInteger Remainder(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } + public static System.Numerics.BigInteger Subtract(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } + public byte[] ToByteArray() { throw null; } + public override string ToString() { throw null; } + public string ToString(System.IFormatProvider provider) { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider provider) { throw null; } + public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + public static bool TryParse(string value, out System.Numerics.BigInteger result) { result = default(System.Numerics.BigInteger); throw null; } + } + [System.SerializableAttribute] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Complex : System.IEquatable, System.IFormattable + { + public static readonly System.Numerics.Complex ImaginaryOne; + public static readonly System.Numerics.Complex One; + public static readonly System.Numerics.Complex Zero; + public Complex(double real, double imaginary) { throw null;} + public double Imaginary { get { throw null; } } + public double Magnitude { get { throw null; } } + public double Phase { get { throw null; } } + public double Real { get { throw null; } } + public static double Abs(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Acos(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Add(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Asin(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Atan(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Conjugate(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Cos(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Cosh(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Divide(System.Numerics.Complex dividend, System.Numerics.Complex divisor) { throw null; } + public bool Equals(System.Numerics.Complex value) { throw null; } + public override bool Equals(object obj) { throw null; } + public static System.Numerics.Complex Exp(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex FromPolarCoordinates(double magnitude, double phase) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.Complex Log(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Log(System.Numerics.Complex value, double baseValue) { throw null; } + public static System.Numerics.Complex Log10(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Multiply(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Negate(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex operator +(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator /(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static bool operator ==(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static explicit operator System.Numerics.Complex (decimal value) { throw null; } + public static explicit operator System.Numerics.Complex (System.Numerics.BigInteger value) { throw null; } + public static implicit operator System.Numerics.Complex (byte value) { throw null; } + public static implicit operator System.Numerics.Complex (double value) { throw null; } + public static implicit operator System.Numerics.Complex (short value) { throw null; } + public static implicit operator System.Numerics.Complex (int value) { throw null; } + public static implicit operator System.Numerics.Complex (long value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (sbyte value) { throw null; } + public static implicit operator System.Numerics.Complex (float value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (ushort value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (uint value) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Numerics.Complex (ulong value) { throw null; } + public static bool operator !=(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator *(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator -(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex operator -(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Pow(System.Numerics.Complex value, double power) { throw null; } + public static System.Numerics.Complex Pow(System.Numerics.Complex value, System.Numerics.Complex power) { throw null; } + public static System.Numerics.Complex Reciprocal(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sin(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sinh(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Sqrt(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Subtract(System.Numerics.Complex left, System.Numerics.Complex right) { throw null; } + public static System.Numerics.Complex Tan(System.Numerics.Complex value) { throw null; } + public static System.Numerics.Complex Tanh(System.Numerics.Complex value) { throw null; } + public override string ToString() { throw null; } + public string ToString(System.IFormatProvider provider) { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider provider) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Matrix3x2 : System.IEquatable + { + public float M11; + public float M12; + public float M21; + public float M22; + public float M31; + public float M32; + public Matrix3x2(float m11, float m12, float m21, float m22, float m31, float m32) { throw null;} + public static System.Numerics.Matrix3x2 Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public System.Numerics.Vector2 Translation { get { throw null; } set { } } + public static System.Numerics.Matrix3x2 Add(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 CreateRotation(float radians) { throw null; } + public static System.Numerics.Matrix3x2 CreateRotation(float radians, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(System.Numerics.Vector2 scales) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(System.Numerics.Vector2 scales, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float scale) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float scale, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float xScale, float yScale) { throw null; } + public static System.Numerics.Matrix3x2 CreateScale(float xScale, float yScale, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateSkew(float radiansX, float radiansY) { throw null; } + public static System.Numerics.Matrix3x2 CreateSkew(float radiansX, float radiansY, System.Numerics.Vector2 centerPoint) { throw null; } + public static System.Numerics.Matrix3x2 CreateTranslation(System.Numerics.Vector2 position) { throw null; } + public static System.Numerics.Matrix3x2 CreateTranslation(float xPosition, float yPosition) { throw null; } + public bool Equals(System.Numerics.Matrix3x2 other) { throw null; } + public override bool Equals(object obj) { throw null; } + public float GetDeterminant() { throw null; } + public override int GetHashCode() { throw null; } + public static bool Invert(System.Numerics.Matrix3x2 matrix, out System.Numerics.Matrix3x2 result) { result = default(System.Numerics.Matrix3x2); throw null; } + public static System.Numerics.Matrix3x2 Lerp(System.Numerics.Matrix3x2 matrix1, System.Numerics.Matrix3x2 matrix2, float amount) { throw null; } + public static System.Numerics.Matrix3x2 Multiply(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 Multiply(System.Numerics.Matrix3x2 value1, float value2) { throw null; } + public static System.Numerics.Matrix3x2 Negate(System.Numerics.Matrix3x2 value) { throw null; } + public static System.Numerics.Matrix3x2 operator +(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static bool operator ==(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static bool operator !=(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator *(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator *(System.Numerics.Matrix3x2 value1, float value2) { throw null; } + public static System.Numerics.Matrix3x2 operator -(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public static System.Numerics.Matrix3x2 operator -(System.Numerics.Matrix3x2 value) { throw null; } + public static System.Numerics.Matrix3x2 Subtract(System.Numerics.Matrix3x2 value1, System.Numerics.Matrix3x2 value2) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Matrix4x4 : System.IEquatable + { + public float M11; + public float M12; + public float M13; + public float M14; + public float M21; + public float M22; + public float M23; + public float M24; + public float M31; + public float M32; + public float M33; + public float M34; + public float M41; + public float M42; + public float M43; + public float M44; + public Matrix4x4(System.Numerics.Matrix3x2 value) { throw null;} + public Matrix4x4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) { throw null;} + public static System.Numerics.Matrix4x4 Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public System.Numerics.Vector3 Translation { get { throw null; } set { } } + public static System.Numerics.Matrix4x4 Add(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 CreateBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraUpVector, System.Numerics.Vector3 cameraForwardVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateConstrainedBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 rotateAxis, System.Numerics.Vector3 cameraForwardVector, System.Numerics.Vector3 objectForwardVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromQuaternion(System.Numerics.Quaternion quaternion) { throw null; } + public static System.Numerics.Matrix4x4 CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; } + public static System.Numerics.Matrix4x4 CreateLookAt(System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraTarget, System.Numerics.Vector3 cameraUpVector) { throw null; } + public static System.Numerics.Matrix4x4 CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane) { throw null; } + public static System.Numerics.Matrix4x4 CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspective(float width, float height, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance) { throw null; } + public static System.Numerics.Matrix4x4 CreateReflection(System.Numerics.Plane value) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationX(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationX(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationY(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationY(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationZ(float radians) { throw null; } + public static System.Numerics.Matrix4x4 CreateRotationZ(float radians, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(System.Numerics.Vector3 scales) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(System.Numerics.Vector3 scales, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float scale) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float scale, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float xScale, float yScale, float zScale) { throw null; } + public static System.Numerics.Matrix4x4 CreateScale(float xScale, float yScale, float zScale, System.Numerics.Vector3 centerPoint) { throw null; } + public static System.Numerics.Matrix4x4 CreateShadow(System.Numerics.Vector3 lightDirection, System.Numerics.Plane plane) { throw null; } + public static System.Numerics.Matrix4x4 CreateTranslation(System.Numerics.Vector3 position) { throw null; } + public static System.Numerics.Matrix4x4 CreateTranslation(float xPosition, float yPosition, float zPosition) { throw null; } + public static System.Numerics.Matrix4x4 CreateWorld(System.Numerics.Vector3 position, System.Numerics.Vector3 forward, System.Numerics.Vector3 up) { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + public static bool Decompose(System.Numerics.Matrix4x4 matrix, out System.Numerics.Vector3 scale, out System.Numerics.Quaternion rotation, out System.Numerics.Vector3 translation) { scale = default(System.Numerics.Vector3); rotation = default(System.Numerics.Quaternion); translation = default(System.Numerics.Vector3); throw null; } + public bool Equals(System.Numerics.Matrix4x4 other) { throw null; } + public override bool Equals(object obj) { throw null; } + public float GetDeterminant() { throw null; } + public override int GetHashCode() { throw null; } + public static bool Invert(System.Numerics.Matrix4x4 matrix, out System.Numerics.Matrix4x4 result) { result = default(System.Numerics.Matrix4x4); throw null; } + public static System.Numerics.Matrix4x4 Lerp(System.Numerics.Matrix4x4 matrix1, System.Numerics.Matrix4x4 matrix2, float amount) { throw null; } + public static System.Numerics.Matrix4x4 Multiply(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 Multiply(System.Numerics.Matrix4x4 value1, float value2) { throw null; } + public static System.Numerics.Matrix4x4 Negate(System.Numerics.Matrix4x4 value) { throw null; } + public static System.Numerics.Matrix4x4 operator +(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static bool operator ==(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static bool operator !=(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator *(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator *(System.Numerics.Matrix4x4 value1, float value2) { throw null; } + public static System.Numerics.Matrix4x4 operator -(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public static System.Numerics.Matrix4x4 operator -(System.Numerics.Matrix4x4 value) { throw null; } + public static System.Numerics.Matrix4x4 Subtract(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; } + public override string ToString() { throw null; } + public static System.Numerics.Matrix4x4 Transform(System.Numerics.Matrix4x4 value, System.Numerics.Quaternion rotation) { throw null; } + public static System.Numerics.Matrix4x4 Transpose(System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Plane : System.IEquatable + { + public float D; + public System.Numerics.Vector3 Normal; + public Plane(System.Numerics.Vector3 normal, float d) { throw null;} + public Plane(System.Numerics.Vector4 value) { throw null;} + public Plane(float x, float y, float z, float d) { throw null;} + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane CreateFromVertices(System.Numerics.Vector3 point1, System.Numerics.Vector3 point2, System.Numerics.Vector3 point3) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Plane plane, System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DotCoordinate(System.Numerics.Plane plane, System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DotNormal(System.Numerics.Plane plane, System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool Equals(System.Numerics.Plane other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Normalize(System.Numerics.Plane value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Plane value1, System.Numerics.Plane value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Plane value1, System.Numerics.Plane value2) { throw null; } + public override string ToString() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Transform(System.Numerics.Plane plane, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Plane Transform(System.Numerics.Plane plane, System.Numerics.Quaternion rotation) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Quaternion : System.IEquatable + { + public float W; + public float X; + public float Y; + public float Z; + public Quaternion(System.Numerics.Vector3 vectorPart, float scalarPart) { throw null;} + public Quaternion(float x, float y, float z, float w) { throw null;} + public static System.Numerics.Quaternion Identity { get { throw null; } } + public bool IsIdentity { get { throw null; } } + public static System.Numerics.Quaternion Add(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Concatenate(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Conjugate(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; } + public static System.Numerics.Quaternion CreateFromRotationMatrix(System.Numerics.Matrix4x4 matrix) { throw null; } + public static System.Numerics.Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; } + public static System.Numerics.Quaternion Divide(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static float Dot(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2) { throw null; } + public bool Equals(System.Numerics.Quaternion other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static System.Numerics.Quaternion Inverse(System.Numerics.Quaternion value) { throw null; } + public float Length() { throw null; } + public float LengthSquared() { throw null; } + public static System.Numerics.Quaternion Lerp(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2, float amount) { throw null; } + public static System.Numerics.Quaternion Multiply(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion Multiply(System.Numerics.Quaternion value1, float value2) { throw null; } + public static System.Numerics.Quaternion Negate(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion Normalize(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion operator +(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator /(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static bool operator ==(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static bool operator !=(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator *(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator *(System.Numerics.Quaternion value1, float value2) { throw null; } + public static System.Numerics.Quaternion operator -(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public static System.Numerics.Quaternion operator -(System.Numerics.Quaternion value) { throw null; } + public static System.Numerics.Quaternion Slerp(System.Numerics.Quaternion quaternion1, System.Numerics.Quaternion quaternion2, float amount) { throw null; } + public static System.Numerics.Quaternion Subtract(System.Numerics.Quaternion value1, System.Numerics.Quaternion value2) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector2 : System.IEquatable, System.IFormattable + { + public float X; + public float Y; + public Vector2(float value) { throw null;} + public Vector2(float x, float y) { throw null;} + public static System.Numerics.Vector2 One { get { throw null; } } + public static System.Numerics.Vector2 UnitX { get { throw null; } } + public static System.Numerics.Vector2 UnitY { get { throw null; } } + public static System.Numerics.Vector2 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Abs(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Add(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Clamp(System.Numerics.Vector2 value1, System.Numerics.Vector2 min, System.Numerics.Vector2 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Divide(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Divide(System.Numerics.Vector2 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + public bool Equals(System.Numerics.Vector2 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Lerp(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Max(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Min(System.Numerics.Vector2 value1, System.Numerics.Vector2 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(System.Numerics.Vector2 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Multiply(float left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Negate(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Normalize(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator +(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator /(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator /(System.Numerics.Vector2 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(System.Numerics.Vector2 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator *(float left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator -(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 operator -(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Reflect(System.Numerics.Vector2 vector, System.Numerics.Vector2 normal) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 SquareRoot(System.Numerics.Vector2 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Subtract(System.Numerics.Vector2 left, System.Numerics.Vector2 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix3x2 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 Transform(System.Numerics.Vector2 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 TransformNormal(System.Numerics.Vector2 normal, System.Numerics.Matrix3x2 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector2 TransformNormal(System.Numerics.Vector2 normal, System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector3 : System.IEquatable, System.IFormattable + { + public float X; + public float Y; + public float Z; + public Vector3(System.Numerics.Vector2 value, float z) { throw null;} + public Vector3(float value) { throw null;} + public Vector3(float x, float y, float z) { throw null;} + public static System.Numerics.Vector3 One { get { throw null; } } + public static System.Numerics.Vector3 UnitX { get { throw null; } } + public static System.Numerics.Vector3 UnitY { get { throw null; } } + public static System.Numerics.Vector3 UnitZ { get { throw null; } } + public static System.Numerics.Vector3 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Abs(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Add(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Clamp(System.Numerics.Vector3 value1, System.Numerics.Vector3 min, System.Numerics.Vector3 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Cross(System.Numerics.Vector3 vector1, System.Numerics.Vector3 vector2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Divide(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Divide(System.Numerics.Vector3 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector3 vector1, System.Numerics.Vector3 vector2) { throw null; } + public bool Equals(System.Numerics.Vector3 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Lerp(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Max(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + public static System.Numerics.Vector3 Min(System.Numerics.Vector3 value1, System.Numerics.Vector3 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(System.Numerics.Vector3 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Multiply(float left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Negate(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Normalize(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator +(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator /(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator /(System.Numerics.Vector3 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(System.Numerics.Vector3 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator *(float left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator -(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 operator -(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Reflect(System.Numerics.Vector3 vector, System.Numerics.Vector3 normal) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 SquareRoot(System.Numerics.Vector3 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Subtract(System.Numerics.Vector3 left, System.Numerics.Vector3 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Transform(System.Numerics.Vector3 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 Transform(System.Numerics.Vector3 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector3 TransformNormal(System.Numerics.Vector3 normal, System.Numerics.Matrix4x4 matrix) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct Vector4 : System.IEquatable, System.IFormattable + { + public float W; + public float X; + public float Y; + public float Z; + public Vector4(System.Numerics.Vector2 value, float z, float w) { throw null;} + public Vector4(System.Numerics.Vector3 value, float w) { throw null;} + public Vector4(float value) { throw null;} + public Vector4(float x, float y, float z, float w) { throw null;} + public static System.Numerics.Vector4 One { get { throw null; } } + public static System.Numerics.Vector4 UnitW { get { throw null; } } + public static System.Numerics.Vector4 UnitX { get { throw null; } } + public static System.Numerics.Vector4 UnitY { get { throw null; } } + public static System.Numerics.Vector4 UnitZ { get { throw null; } } + public static System.Numerics.Vector4 Zero { get { throw null; } } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Abs(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Add(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Clamp(System.Numerics.Vector4 value1, System.Numerics.Vector4 min, System.Numerics.Vector4 max) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void CopyTo(float[] array, int index) { } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Distance(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float DistanceSquared(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Divide(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Divide(System.Numerics.Vector4 left, float divisor) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static float Dot(System.Numerics.Vector4 vector1, System.Numerics.Vector4 vector2) { throw null; } + public bool Equals(System.Numerics.Vector4 other) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float Length() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public float LengthSquared() { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Lerp(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2, float amount) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Max(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Min(System.Numerics.Vector4 value1, System.Numerics.Vector4 value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(System.Numerics.Vector4 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Multiply(float left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Negate(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Normalize(System.Numerics.Vector4 vector) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator +(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator /(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator /(System.Numerics.Vector4 value1, float value2) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator ==(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static bool operator !=(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(System.Numerics.Vector4 left, float right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator *(float left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator -(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 operator -(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 SquareRoot(System.Numerics.Vector4 value) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Subtract(System.Numerics.Vector4 left, System.Numerics.Vector4 right) { throw null; } + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + public string ToString(string format, System.IFormatProvider formatProvider) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector2 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector2 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector3 position, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector3 value, System.Numerics.Quaternion rotation) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector4 vector, System.Numerics.Matrix4x4 matrix) { throw null; } + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public static System.Numerics.Vector4 Transform(System.Numerics.Vector4 value, System.Numerics.Quaternion rotation) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Reflection.Context.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Reflection.Context.cs new file mode 100644 index 0000000000..302125d412 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Reflection.Context.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Reflection.Context.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Reflection.Context.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Reflection.Context.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace System.Reflection.Context +{ + public abstract partial class CustomReflectionContext : System.Reflection.ReflectionContext + { + protected CustomReflectionContext() { } + protected CustomReflectionContext(System.Reflection.ReflectionContext source) { } + protected virtual System.Collections.Generic.IEnumerable AddProperties(System.Type type) { throw null; } + protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func getter, System.Action setter) { throw null; } + protected System.Reflection.PropertyInfo CreateProperty(System.Type propertyType, string name, System.Func getter, System.Action setter, System.Collections.Generic.IEnumerable propertyCustomAttributes, System.Collections.Generic.IEnumerable getterCustomAttributes, System.Collections.Generic.IEnumerable setterCustomAttributes) { throw null; } + protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.MemberInfo member, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } + protected virtual System.Collections.Generic.IEnumerable GetCustomAttributes(System.Reflection.ParameterInfo parameter, System.Collections.Generic.IEnumerable declaredAttributes) { throw null; } + public override System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly) { throw null; } + public override System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Caching.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Caching.cs new file mode 100644 index 0000000000..b4736b3b61 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Caching.cs @@ -0,0 +1,262 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Caching.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Caching.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Caching.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +namespace System.Runtime.Caching +{ + public abstract partial class CacheEntryChangeMonitor : System.Runtime.Caching.ChangeMonitor + { + protected CacheEntryChangeMonitor() { } + public abstract System.Collections.ObjectModel.ReadOnlyCollection CacheKeys { get; } + public abstract System.DateTimeOffset LastModified { get; } + public abstract string RegionName { get; } + } + public partial class CacheEntryRemovedArguments + { + public CacheEntryRemovedArguments(System.Runtime.Caching.ObjectCache source, System.Runtime.Caching.CacheEntryRemovedReason reason, System.Runtime.Caching.CacheItem cacheItem) { } + public System.Runtime.Caching.CacheItem CacheItem { get { throw null; } } + public System.Runtime.Caching.CacheEntryRemovedReason RemovedReason { get { throw null; } } + public System.Runtime.Caching.ObjectCache Source { get { throw null; } } + } + public delegate void CacheEntryRemovedCallback(System.Runtime.Caching.CacheEntryRemovedArguments arguments); + public enum CacheEntryRemovedReason + { + CacheSpecificEviction = 4, + ChangeMonitorChanged = 3, + Evicted = 2, + Expired = 1, + Removed = 0, + } + public partial class CacheEntryUpdateArguments + { + public CacheEntryUpdateArguments(System.Runtime.Caching.ObjectCache source, System.Runtime.Caching.CacheEntryRemovedReason reason, string key, string regionName) { } + public string Key { get { throw null; } } + public string RegionName { get { throw null; } } + public System.Runtime.Caching.CacheEntryRemovedReason RemovedReason { get { throw null; } } + public System.Runtime.Caching.ObjectCache Source { get { throw null; } } + public System.Runtime.Caching.CacheItem UpdatedCacheItem { get { throw null; } set { } } + public System.Runtime.Caching.CacheItemPolicy UpdatedCacheItemPolicy { get { throw null; } set { } } + } + public delegate void CacheEntryUpdateCallback(System.Runtime.Caching.CacheEntryUpdateArguments arguments); + public partial class CacheItem + { + public CacheItem(string key) { } + public CacheItem(string key, object value) { } + public CacheItem(string key, object value, string regionName) { } + public string Key { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string RegionName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class CacheItemPolicy + { + public CacheItemPolicy() { } + public System.DateTimeOffset AbsoluteExpiration { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection ChangeMonitors { get { throw null; } } + public System.Runtime.Caching.CacheItemPriority Priority { get { throw null; } set { } } + public System.Runtime.Caching.CacheEntryRemovedCallback RemovedCallback { get { throw null; } set { } } + public System.TimeSpan SlidingExpiration { get { throw null; } set { } } + public System.Runtime.Caching.CacheEntryUpdateCallback UpdateCallback { get { throw null; } set { } } + } + public enum CacheItemPriority + { + Default = 0, + NotRemovable = 1, + } + public abstract partial class ChangeMonitor : System.IDisposable + { + protected ChangeMonitor() { } + public bool HasChanged { get { throw null; } } + public bool IsDisposed { get { throw null; } } + public abstract string UniqueId { get; } + public void Dispose() { } + protected abstract void Dispose(bool disposing); + protected void InitializationComplete() { } + public void NotifyOnChanged(System.Runtime.Caching.OnChangedCallback onChangedCallback) { } + protected void OnChanged(object state) { } + } + [System.FlagsAttribute] + public enum DefaultCacheCapabilities + { + AbsoluteExpirations = 8, + CacheEntryChangeMonitors = 4, + CacheEntryRemovedCallback = 64, + CacheEntryUpdateCallback = 32, + CacheRegions = 128, + InMemoryProvider = 1, + None = 0, + OutOfProcessProvider = 2, + SlidingExpirations = 16, + } + public abstract partial class FileChangeMonitor : System.Runtime.Caching.ChangeMonitor + { + protected FileChangeMonitor() { } + public abstract System.Collections.ObjectModel.ReadOnlyCollection FilePaths { get; } + public abstract System.DateTimeOffset LastModified { get; } + } + public sealed partial class HostFileChangeMonitor : System.Runtime.Caching.FileChangeMonitor + { + public HostFileChangeMonitor(System.Collections.Generic.IList filePaths) { } + public override System.Collections.ObjectModel.ReadOnlyCollection FilePaths { get { throw null; } } + public override System.DateTimeOffset LastModified { get { throw null; } } + public override string UniqueId { get { throw null; } } + protected override void Dispose(bool disposing) { } + } + public partial class MemoryCache : System.Runtime.Caching.ObjectCache, System.Collections.IEnumerable, System.IDisposable + { + public MemoryCache(string name, System.Collections.Specialized.NameValueCollection config=null) { } + public MemoryCache(string name, System.Collections.Specialized.NameValueCollection config, bool ignoreConfigSection) { } + public long CacheMemoryLimit { get { throw null; } } + public static System.Runtime.Caching.MemoryCache Default { get { throw null; } } + public override System.Runtime.Caching.DefaultCacheCapabilities DefaultCacheCapabilities { get { throw null; } } + public override object this[string key] { get { throw null; } set { } } + public override string Name { get { throw null; } } + public long PhysicalMemoryLimit { get { throw null; } } + public System.TimeSpan PollingInterval { get { throw null; } } + public override bool Add(System.Runtime.Caching.CacheItem item, System.Runtime.Caching.CacheItemPolicy policy) { throw null; } + public override System.Runtime.Caching.CacheItem AddOrGetExisting(System.Runtime.Caching.CacheItem item, System.Runtime.Caching.CacheItemPolicy policy) { throw null; } + public override object AddOrGetExisting(string key, object value, System.DateTimeOffset absoluteExpiration, string regionName=null) { throw null; } + public override object AddOrGetExisting(string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName=null) { throw null; } + public override bool Contains(string key, string regionName=null) { throw null; } + public override System.Runtime.Caching.CacheEntryChangeMonitor CreateCacheEntryChangeMonitor(System.Collections.Generic.IEnumerable keys, string regionName=null) { throw null; } + public void Dispose() { } + public override object Get(string key, string regionName=null) { throw null; } + public override System.Runtime.Caching.CacheItem GetCacheItem(string key, string regionName=null) { throw null; } + public override long GetCount(string regionName=null) { throw null; } + protected override System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } + public long GetLastSize(string regionName=null) { throw null; } + public override System.Collections.Generic.IDictionary GetValues(System.Collections.Generic.IEnumerable keys, string regionName=null) { throw null; } + public object Remove(string key, System.Runtime.Caching.CacheEntryRemovedReason reason, string regionName=null) { throw null; } + public override object Remove(string key, string regionName=null) { throw null; } + public override void Set(System.Runtime.Caching.CacheItem item, System.Runtime.Caching.CacheItemPolicy policy) { } + public override void Set(string key, object value, System.DateTimeOffset absoluteExpiration, string regionName=null) { } + public override void Set(string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName=null) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public long Trim(int percent) { throw null; } + } + public abstract partial class ObjectCache : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable + { + public static readonly System.DateTimeOffset InfiniteAbsoluteExpiration; + public static readonly System.TimeSpan NoSlidingExpiration; + protected ObjectCache() { } + public abstract System.Runtime.Caching.DefaultCacheCapabilities DefaultCacheCapabilities { get; } + public static System.IServiceProvider Host { [System.Security.SecurityCriticalAttribute][System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)]get { throw null; } [System.Security.SecurityCriticalAttribute][System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)]set { } } + public abstract object this[string key] { get; set; } + public abstract string Name { get; } + public virtual bool Add(System.Runtime.Caching.CacheItem item, System.Runtime.Caching.CacheItemPolicy policy) { throw null; } + public virtual bool Add(string key, object value, System.DateTimeOffset absoluteExpiration, string regionName=null) { throw null; } + public virtual bool Add(string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName=null) { throw null; } + public abstract System.Runtime.Caching.CacheItem AddOrGetExisting(System.Runtime.Caching.CacheItem value, System.Runtime.Caching.CacheItemPolicy policy); + public abstract object AddOrGetExisting(string key, object value, System.DateTimeOffset absoluteExpiration, string regionName=null); + public abstract object AddOrGetExisting(string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName=null); + public abstract bool Contains(string key, string regionName=null); + public abstract System.Runtime.Caching.CacheEntryChangeMonitor CreateCacheEntryChangeMonitor(System.Collections.Generic.IEnumerable keys, string regionName=null); + public abstract object Get(string key, string regionName=null); + public abstract System.Runtime.Caching.CacheItem GetCacheItem(string key, string regionName=null); + public abstract long GetCount(string regionName=null); + protected abstract System.Collections.Generic.IEnumerator> GetEnumerator(); + public abstract System.Collections.Generic.IDictionary GetValues(System.Collections.Generic.IEnumerable keys, string regionName=null); + public virtual System.Collections.Generic.IDictionary GetValues(string regionName, params string[] keys) { throw null; } + public abstract object Remove(string key, string regionName=null); + public abstract void Set(System.Runtime.Caching.CacheItem item, System.Runtime.Caching.CacheItemPolicy policy); + public abstract void Set(string key, object value, System.DateTimeOffset absoluteExpiration, string regionName=null); + public abstract void Set(string key, object value, System.Runtime.Caching.CacheItemPolicy policy, string regionName=null); + System.Collections.Generic.IEnumerator> System.Collections.Generic.IEnumerable>.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public delegate void OnChangedCallback(object state); + public sealed partial class SqlChangeMonitor : System.Runtime.Caching.ChangeMonitor + { + public SqlChangeMonitor(System.Data.SqlClient.SqlDependency dependency) { } + public override string UniqueId { get { throw null; } } + protected override void Dispose(bool disposing) { } + } +} +namespace System.Runtime.Caching.Configuration +{ + public sealed partial class CachingSectionGroup : System.Configuration.ConfigurationSectionGroup + { + public CachingSectionGroup() { } + [System.Configuration.ConfigurationPropertyAttribute("memoryCache")] + public System.Runtime.Caching.Configuration.MemoryCacheSection MemoryCaches { get { throw null; } } + } + public sealed partial class MemoryCacheElement : System.Configuration.ConfigurationElement + { + public MemoryCacheElement(string name) { } + [System.Configuration.ConfigurationPropertyAttribute("cacheMemoryLimitMegabytes", DefaultValue=0)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0)] + public int CacheMemoryLimitMegabytes { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Configuration.WhiteSpaceTrimStringConverter))] + [System.Configuration.ConfigurationPropertyAttribute("name", DefaultValue="", IsRequired=true, IsKey=true)] + [System.Configuration.StringValidatorAttribute(MinLength=1)] + public string Name { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("physicalMemoryLimitPercentage", DefaultValue=0)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0, MaxValue=100)] + public int PhysicalMemoryLimitPercentage { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Configuration.InfiniteTimeSpanConverter))] + [System.Configuration.ConfigurationPropertyAttribute("pollingInterval", DefaultValue="00:02:00")] + public System.TimeSpan PollingInterval { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + public sealed partial class MemoryCacheSection : System.Configuration.ConfigurationSection + { + public MemoryCacheSection() { } + [System.Configuration.ConfigurationPropertyAttribute("namedCaches")] + public System.Runtime.Caching.Configuration.MemoryCacheSettingsCollection NamedCaches { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Runtime.Caching.Configuration.MemoryCacheElement), CollectionType=(System.Configuration.ConfigurationElementCollectionType)(1))] + public sealed partial class MemoryCacheSettingsCollection : System.Configuration.ConfigurationElementCollection + { + public MemoryCacheSettingsCollection() { } + public override System.Configuration.ConfigurationElementCollectionType CollectionType { get { throw null; } } + public System.Runtime.Caching.Configuration.MemoryCacheElement this[int index] { get { throw null; } set { } } + public new System.Runtime.Caching.Configuration.MemoryCacheElement this[string key] { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + public void Add(System.Runtime.Caching.Configuration.MemoryCacheElement cache) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override System.Configuration.ConfigurationElement CreateNewElement(string elementName) { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public int IndexOf(System.Runtime.Caching.Configuration.MemoryCacheElement cache) { throw null; } + public void Remove(System.Runtime.Caching.Configuration.MemoryCacheElement cache) { } + public void RemoveAt(int index) { } + } +} +namespace System.Runtime.Caching.Hosting +{ + public partial interface IApplicationIdentifier + { + string GetApplicationId(); + } + public partial interface IFileChangeNotificationSystem + { + void StartMonitoring(string filePath, System.Runtime.Caching.OnChangedCallback onChangedCallback, out object state, out System.DateTimeOffset lastWriteTime, out long fileSize); + void StopMonitoring(string filePath, object state); + } + public partial interface IMemoryCacheManager + { + void ReleaseCache(System.Runtime.Caching.MemoryCache cache); + void UpdateCacheSize(long size, System.Runtime.Caching.MemoryCache cache); + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.DurableInstancing.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.DurableInstancing.cs new file mode 100644 index 0000000000..94f3ac8bb1 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.DurableInstancing.cs @@ -0,0 +1,441 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.DurableInstancing.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.DurableInstancing.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.DurableInstancing.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.InteropServices.GuidAttribute("a9b8c4b5-b4a9-4800-8268-e8ec3b93d9ac")] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +#if false // these are forwarded to System.ServiceModel.Internals.dll but this assembly doesn't actually exist in the .NET 4.7.1 reference assemblies ... +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.ActionItem))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.AsyncResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.AsyncResult.AsyncCompletion))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.BufferedOutputStream))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompletedAsyncResult))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Diagnostics.DiagnosticsEventProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Diagnostics.DiagnosticsEventProvider.WriteEventErrorCode))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Diagnostics.EtwProvider))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Diagnostics.EventLogger))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Diagnostics.StringTraceRecord))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Diagnostics.TraceRecord))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.ExceptionTrace))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.ExceptionHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.BlockingAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.BlocksUsing))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.CacheAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.CacheAttrition))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.ExternalResourceAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.FriendAccessAllowedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.GuaranteeNonBlockingAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.InheritThrowsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.KnownXamlExternalAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.Location))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.NonThrowingAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.QueueAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.SecurityNoteAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.Strings))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.SynchronizationKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.SynchronizationObjectAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.SynchronizationPrimitiveAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.ThrottleAction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.ThrottleAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.ThrottleMetric))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.Throws))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.Throws.TimeoutAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.ThrowsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Fx.Tag.XamlVisibleAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.IOThreadScheduler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.PartialTrustHelpers))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.SynchronizedPool))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.TraceEventLevel))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.TracePayload))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.TypeHelper))] +#endif +namespace System.Runtime.DurableInstancing +{ + [System.SerializableAttribute] + public partial class InstanceCollisionException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceCollisionException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceCollisionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceCollisionException(string message) { } + public InstanceCollisionException(string message, System.Exception innerException) { } + public InstanceCollisionException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstanceCollisionException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstanceCollisionException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class InstanceCompleteException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceCompleteException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceCompleteException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceCompleteException(string message) { } + public InstanceCompleteException(string message, System.Exception innerException) { } + public InstanceCompleteException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstanceCompleteException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstanceCompleteException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + } + public sealed partial class InstanceHandle + { + internal InstanceHandle() { } + public bool IsValid { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public void Free() { } + } + [System.SerializableAttribute] + public partial class InstanceHandleConflictException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceHandleConflictException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceHandleConflictException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceHandleConflictException(string message) { } + public InstanceHandleConflictException(string message, System.Exception innerException) { } + public InstanceHandleConflictException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstanceHandleConflictException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstanceHandleConflictException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + } + [System.Runtime.Serialization.DataContractAttribute] + public partial class InstanceKey + { + public InstanceKey(System.Guid value) { } + public InstanceKey(System.Guid value, System.Collections.Generic.IDictionary metadata) { } + public static System.Runtime.DurableInstancing.InstanceKey InvalidKey { get { throw null; } } + public bool IsValid { get { throw null; } } + public System.Collections.Generic.IDictionary Metadata { get { throw null; } } + public System.Guid Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + } + [System.SerializableAttribute] + public partial class InstanceKeyCollisionException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceKeyCollisionException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceKeyCollisionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceKeyCollisionException(string message) { } + public InstanceKeyCollisionException(string message, System.Exception innerException) { } + public InstanceKeyCollisionException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Runtime.DurableInstancing.InstanceKey instanceKey, System.Guid conflictingInstanceId) { } + public InstanceKeyCollisionException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Runtime.DurableInstancing.InstanceKey instanceKey, System.Guid conflictingInstanceId, System.Exception innerException) { } + public InstanceKeyCollisionException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Runtime.DurableInstancing.InstanceKey instanceKey, System.Guid conflictingInstanceId, string message, System.Exception innerException) { } + public System.Guid ConflictingInstanceId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Runtime.DurableInstancing.InstanceKey InstanceKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class InstanceKeyCompleteException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceKeyCompleteException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceKeyCompleteException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceKeyCompleteException(string message) { } + public InstanceKeyCompleteException(string message, System.Exception innerException) { } + public InstanceKeyCompleteException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Runtime.DurableInstancing.InstanceKey instanceKey, string message, System.Exception innerException) { } + public InstanceKeyCompleteException(System.Xml.Linq.XName commandName, System.Runtime.DurableInstancing.InstanceKey instanceKey) { } + public InstanceKeyCompleteException(System.Xml.Linq.XName commandName, System.Runtime.DurableInstancing.InstanceKey instanceKey, System.Exception innerException) { } + public System.Runtime.DurableInstancing.InstanceKey InstanceKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class InstanceKeyNotReadyException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceKeyNotReadyException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceKeyNotReadyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceKeyNotReadyException(string message) { } + public InstanceKeyNotReadyException(string message, System.Exception innerException) { } + public InstanceKeyNotReadyException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Runtime.DurableInstancing.InstanceKey instanceKey, string message, System.Exception innerException) { } + public InstanceKeyNotReadyException(System.Xml.Linq.XName commandName, System.Runtime.DurableInstancing.InstanceKey instanceKey) { } + public InstanceKeyNotReadyException(System.Xml.Linq.XName commandName, System.Runtime.DurableInstancing.InstanceKey instanceKey, System.Exception innerException) { } + public System.Runtime.DurableInstancing.InstanceKey InstanceKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public enum InstanceKeyState + { + Associated = 1, + Completed = 2, + Unknown = 0, + } + public sealed partial class InstanceKeyView + { + internal InstanceKeyView() { } + public System.Guid InstanceKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary InstanceKeyMetadata { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceValueConsistency InstanceKeyMetadataConsistency { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Runtime.DurableInstancing.InstanceKeyState InstanceKeyState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.SerializableAttribute] + public partial class InstanceLockedException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceLockedException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceLockedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceLockedException(string message) { } + public InstanceLockedException(string message, System.Exception innerException) { } + public InstanceLockedException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstanceLockedException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstanceLockedException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Guid instanceOwnerId, System.Collections.Generic.IDictionary serializableInstanceOwnerMetadata) { } + public InstanceLockedException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Guid instanceOwnerId, System.Collections.Generic.IDictionary serializableInstanceOwnerMetadata, System.Exception innerException) { } + public InstanceLockedException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Guid instanceOwnerId, System.Collections.Generic.IDictionary serializableInstanceOwnerMetadata, string message, System.Exception innerException) { } + public InstanceLockedException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + public System.Guid InstanceOwnerId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary SerializableInstanceOwnerMetadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class InstanceLockLostException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceLockLostException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceLockLostException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceLockLostException(string message) { } + public InstanceLockLostException(string message, System.Exception innerException) { } + public InstanceLockLostException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstanceLockLostException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstanceLockLostException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + } + public sealed partial class InstanceLockQueryResult : System.Runtime.DurableInstancing.InstanceStoreQueryResult + { + public InstanceLockQueryResult() { } + public InstanceLockQueryResult(System.Collections.Generic.IDictionary instanceOwnerIds) { } + public InstanceLockQueryResult(System.Guid instanceId, System.Guid instanceOwnerId) { } + public System.Collections.Generic.IDictionary InstanceOwnerIds { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.SerializableAttribute] + public partial class InstanceNotReadyException : System.Runtime.DurableInstancing.InstancePersistenceCommandException + { + public InstanceNotReadyException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceNotReadyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceNotReadyException(string message) { } + public InstanceNotReadyException(string message, System.Exception innerException) { } + public InstanceNotReadyException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstanceNotReadyException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstanceNotReadyException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + } + public sealed partial class InstanceOwner + { + internal InstanceOwner() { } + public System.Guid InstanceOwnerId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.SerializableAttribute] + public partial class InstanceOwnerException : System.Runtime.DurableInstancing.InstancePersistenceException + { + public InstanceOwnerException() { } + [System.Security.SecurityCriticalAttribute] + protected InstanceOwnerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstanceOwnerException(string message) { } + public InstanceOwnerException(string message, System.Exception innerException) { } + public InstanceOwnerException(System.Xml.Linq.XName commandName, System.Guid instanceOwnerId) { } + public InstanceOwnerException(System.Xml.Linq.XName commandName, System.Guid instanceOwnerId, System.Exception innerException) { } + public InstanceOwnerException(System.Xml.Linq.XName commandName, System.Guid instanceOwnerId, string message, System.Exception innerException) { } + public System.Guid InstanceOwnerId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class InstanceOwnerQueryResult : System.Runtime.DurableInstancing.InstanceStoreQueryResult + { + public InstanceOwnerQueryResult() { } + public InstanceOwnerQueryResult(System.Collections.Generic.IDictionary> instanceOwners) { } + public InstanceOwnerQueryResult(System.Guid instanceOwnerId, System.Collections.Generic.IDictionary metadata) { } + public System.Collections.Generic.IDictionary> InstanceOwners { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public abstract partial class InstancePersistenceCommand + { + protected InstancePersistenceCommand(System.Xml.Linq.XName name) { } + protected internal virtual bool AutomaticallyAcquiringLock { get { throw null; } } + protected internal virtual bool IsTransactionEnlistmentOptional { get { throw null; } } + public System.Xml.Linq.XName Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + protected internal virtual void Validate(System.Runtime.DurableInstancing.InstanceView view) { } + } + [System.SerializableAttribute] + public partial class InstancePersistenceCommandException : System.Runtime.DurableInstancing.InstancePersistenceException + { + public InstancePersistenceCommandException() { } + [System.Security.SecurityCriticalAttribute] + protected InstancePersistenceCommandException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstancePersistenceCommandException(string message) { } + public InstancePersistenceCommandException(string message, System.Exception innerException) { } + public InstancePersistenceCommandException(System.Xml.Linq.XName commandName) { } + public InstancePersistenceCommandException(System.Xml.Linq.XName commandName, System.Exception innerException) { } + public InstancePersistenceCommandException(System.Xml.Linq.XName commandName, System.Guid instanceId) { } + public InstancePersistenceCommandException(System.Xml.Linq.XName commandName, System.Guid instanceId, System.Exception innerException) { } + public InstancePersistenceCommandException(System.Xml.Linq.XName commandName, System.Guid instanceId, string message, System.Exception innerException) { } + public InstancePersistenceCommandException(System.Xml.Linq.XName commandName, string message, System.Exception innerException) { } + public System.Guid InstanceId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class InstancePersistenceContext + { + internal InstancePersistenceContext() { } + public System.Runtime.DurableInstancing.InstanceHandle InstanceHandle { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public long InstanceVersion { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceView InstanceView { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Guid LockToken { get { throw null; } } + public object UserContext { get { throw null; } } + public void AssociatedInstanceKey(System.Guid key) { } + public System.IAsyncResult BeginBindReclaimedLock(long instanceVersion, System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginExecute(System.Runtime.DurableInstancing.InstancePersistenceCommand command, System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + public void BindAcquiredLock(long instanceVersion) { } + public void BindEvent(System.Runtime.DurableInstancing.InstancePersistenceEvent persistenceEvent) { } + public void BindInstance(System.Guid instanceId) { } + public void BindInstanceOwner(System.Guid instanceOwnerId, System.Guid lockToken) { } + public void BindReclaimedLock(long instanceVersion, System.TimeSpan timeout) { } + public void CompletedInstance() { } + public void CompletedInstanceKey(System.Guid key) { } + public System.Exception CreateBindReclaimedLockException(long instanceVersion) { throw null; } + public void EndBindReclaimedLock(System.IAsyncResult result) { } + public void EndExecute(System.IAsyncResult result) { } + public void Execute(System.Runtime.DurableInstancing.InstancePersistenceCommand command, System.TimeSpan timeout) { } + public void LoadedInstance(System.Runtime.DurableInstancing.InstanceState state, System.Collections.Generic.IDictionary instanceData, System.Collections.Generic.IDictionary instanceMetadata, System.Collections.Generic.IDictionary> associatedInstanceKeyMetadata, System.Collections.Generic.IDictionary> completedInstanceKeyMetadata) { } + public void PersistedInstance(System.Collections.Generic.IDictionary data) { } + public void QueriedInstanceStore(System.Runtime.DurableInstancing.InstanceStoreQueryResult queryResult) { } + public void ReadInstanceKeyMetadata(System.Guid key, System.Collections.Generic.IDictionary metadata, bool complete) { } + public void ReadInstanceMetadata(System.Collections.Generic.IDictionary metadata, bool complete) { } + public void ReadInstanceOwnerMetadata(System.Collections.Generic.IDictionary metadata, bool complete) { } + public void SetCancellationHandler(System.Action cancellationHandler) { } + public void UnassociatedInstanceKey(System.Guid key) { } + public void WroteInstanceKeyMetadataValue(System.Guid key, System.Xml.Linq.XName name, System.Runtime.DurableInstancing.InstanceValue value) { } + public void WroteInstanceMetadataValue(System.Xml.Linq.XName name, System.Runtime.DurableInstancing.InstanceValue value) { } + public void WroteInstanceOwnerMetadataValue(System.Xml.Linq.XName name, System.Runtime.DurableInstancing.InstanceValue value) { } + } + public abstract partial class InstancePersistenceEvent : System.IEquatable + { + internal InstancePersistenceEvent() { } + public System.Xml.Linq.XName Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.Runtime.DurableInstancing.InstancePersistenceEvent persistenceEvent) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Runtime.DurableInstancing.InstancePersistenceEvent left, System.Runtime.DurableInstancing.InstancePersistenceEvent right) { throw null; } + public static bool operator !=(System.Runtime.DurableInstancing.InstancePersistenceEvent left, System.Runtime.DurableInstancing.InstancePersistenceEvent right) { throw null; } + } + public abstract partial class InstancePersistenceEvent : System.Runtime.DurableInstancing.InstancePersistenceEvent where T : System.Runtime.DurableInstancing.InstancePersistenceEvent, new() + { + protected InstancePersistenceEvent(System.Xml.Linq.XName name) { } + public static T Value { get { throw null; } } + } + [System.SerializableAttribute] + public partial class InstancePersistenceException : System.Exception + { + public InstancePersistenceException() { } + [System.Security.SecurityCriticalAttribute] + protected InstancePersistenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InstancePersistenceException(string message) { } + public InstancePersistenceException(string message, System.Exception innerException) { } + public InstancePersistenceException(System.Xml.Linq.XName commandName) { } + public InstancePersistenceException(System.Xml.Linq.XName commandName, System.Exception innerException) { } + public InstancePersistenceException(System.Xml.Linq.XName commandName, string message) { } + public InstancePersistenceException(System.Xml.Linq.XName commandName, string message, System.Exception innerException) { } + public System.Xml.Linq.XName CommandName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public enum InstanceState + { + Completed = 3, + Initialized = 2, + Uninitialized = 1, + Unknown = 0, + } + public abstract partial class InstanceStore + { + protected InstanceStore() { } + public System.Runtime.DurableInstancing.InstanceOwner DefaultInstanceOwner { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.IAsyncResult BeginExecute(System.Runtime.DurableInstancing.InstanceHandle handle, System.Runtime.DurableInstancing.InstancePersistenceCommand command, System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + protected internal virtual System.IAsyncResult BeginTryCommand(System.Runtime.DurableInstancing.InstancePersistenceContext context, System.Runtime.DurableInstancing.InstancePersistenceCommand command, System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginWaitForEvents(System.Runtime.DurableInstancing.InstanceHandle handle, System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + public System.Runtime.DurableInstancing.InstanceHandle CreateInstanceHandle() { throw null; } + public System.Runtime.DurableInstancing.InstanceHandle CreateInstanceHandle(System.Guid instanceId) { throw null; } + public System.Runtime.DurableInstancing.InstanceHandle CreateInstanceHandle(System.Runtime.DurableInstancing.InstanceOwner owner) { throw null; } + public System.Runtime.DurableInstancing.InstanceHandle CreateInstanceHandle(System.Runtime.DurableInstancing.InstanceOwner owner, System.Guid instanceId) { throw null; } + public System.Runtime.DurableInstancing.InstanceView EndExecute(System.IAsyncResult result) { throw null; } + protected internal virtual bool EndTryCommand(System.IAsyncResult result) { throw null; } + public System.Collections.Generic.List EndWaitForEvents(System.IAsyncResult result) { throw null; } + public System.Runtime.DurableInstancing.InstanceView Execute(System.Runtime.DurableInstancing.InstanceHandle handle, System.Runtime.DurableInstancing.InstancePersistenceCommand command, System.TimeSpan timeout) { throw null; } + protected System.Runtime.DurableInstancing.InstancePersistenceEvent[] GetEvents(System.Runtime.DurableInstancing.InstanceOwner owner) { throw null; } + protected System.Runtime.DurableInstancing.InstanceOwner[] GetInstanceOwners() { throw null; } + protected virtual void OnFreeInstanceHandle(System.Runtime.DurableInstancing.InstanceHandle instanceHandle, object userContext) { } + protected virtual object OnNewInstanceHandle(System.Runtime.DurableInstancing.InstanceHandle instanceHandle) { throw null; } + protected void ResetEvent(System.Runtime.DurableInstancing.InstancePersistenceEvent persistenceEvent, System.Runtime.DurableInstancing.InstanceOwner owner) { } + protected void SignalEvent(System.Runtime.DurableInstancing.InstancePersistenceEvent persistenceEvent, System.Runtime.DurableInstancing.InstanceOwner owner) { } + protected internal virtual bool TryCommand(System.Runtime.DurableInstancing.InstancePersistenceContext context, System.Runtime.DurableInstancing.InstancePersistenceCommand command, System.TimeSpan timeout) { throw null; } + public System.Collections.Generic.List WaitForEvents(System.Runtime.DurableInstancing.InstanceHandle handle, System.TimeSpan timeout) { throw null; } + } + public abstract partial class InstanceStoreQueryResult + { + protected InstanceStoreQueryResult() { } + } + [System.Runtime.Serialization.DataContractAttribute] + public sealed partial class InstanceValue + { + public InstanceValue(object value) { } + public InstanceValue(object value, System.Runtime.DurableInstancing.InstanceValueOptions options) { } + public static System.Runtime.DurableInstancing.InstanceValue DeletedValue { get { throw null; } } + public bool IsDeletedValue { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceValueOptions Options { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.FlagsAttribute] + public enum InstanceValueConsistency + { + InDoubt = 1, + None = 0, + Partial = 2, + } + [System.FlagsAttribute] + [System.Runtime.Serialization.DataContractAttribute] + public enum InstanceValueOptions + { + [System.Runtime.Serialization.EnumMemberAttribute] + None = 0, + [System.Runtime.Serialization.EnumMemberAttribute] + Optional = 1, + [System.Runtime.Serialization.EnumMemberAttribute] + WriteOnly = 2, + } + public sealed partial class InstanceView + { + internal InstanceView() { } + public System.Collections.Generic.IDictionary InstanceData { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceValueConsistency InstanceDataConsistency { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Guid InstanceId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary InstanceKeys { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceValueConsistency InstanceKeysConsistency { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary InstanceMetadata { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceValueConsistency InstanceMetadataConsistency { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Runtime.DurableInstancing.InstanceOwner InstanceOwner { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.Generic.IDictionary InstanceOwnerMetadata { get { throw null; } } + public System.Runtime.DurableInstancing.InstanceValueConsistency InstanceOwnerMetadataConsistency { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Runtime.DurableInstancing.InstanceState InstanceState { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection InstanceStoreQueryResults { get { throw null; } } + public bool IsBoundToInstance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool IsBoundToInstanceOwner { get { throw null; } } + public bool IsBoundToLock { get { throw null; } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Remoting.cs new file mode 100644 index 0000000000..44a14afdb7 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Remoting.cs @@ -0,0 +1,463 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(false)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Remoting.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Remoting.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Remoting.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.InteropServices.TypeLibVersionAttribute(4, 0)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Runtime.Remoting.Channels +{ + public partial class BinaryClientFormatterSink : System.Runtime.Remoting.Channels.IChannelSinkBase, System.Runtime.Remoting.Channels.IClientChannelSink, System.Runtime.Remoting.Channels.IClientFormatterSink, System.Runtime.Remoting.Messaging.IMessageSink + { + public BinaryClientFormatterSink(System.Runtime.Remoting.Channels.IClientChannelSink nextSink) { } + public System.Runtime.Remoting.Channels.IClientChannelSink NextChannelSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Runtime.Remoting.Messaging.IMessageSink NextSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Collections.IDictionary Properties { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessageCtrl AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Messaging.IMessageSink replySink) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessRequest(System.Runtime.Remoting.Channels.IClientChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessResponse(System.Runtime.Remoting.Channels.IClientResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.IO.Stream GetRequestStream(System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void ProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { responseHeaders = default(System.Runtime.Remoting.Channels.ITransportHeaders); responseStream = default(System.IO.Stream); } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessage SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg) { throw null; } + } + public partial class BinaryClientFormatterSinkProvider : System.Runtime.Remoting.Channels.IClientChannelSinkProvider, System.Runtime.Remoting.Channels.IClientFormatterSinkProvider + { + public BinaryClientFormatterSinkProvider() { } + public BinaryClientFormatterSinkProvider(System.Collections.IDictionary properties, System.Collections.ICollection providerData) { } + public System.Runtime.Remoting.Channels.IClientChannelSinkProvider Next { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.IClientChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelSender channel, string url, object remoteChannelData) { throw null; } + } + public partial class BinaryServerFormatterSink : System.Runtime.Remoting.Channels.IChannelSinkBase, System.Runtime.Remoting.Channels.IServerChannelSink + { + public BinaryServerFormatterSink(System.Runtime.Remoting.Channels.BinaryServerFormatterSink.Protocol protocol, System.Runtime.Remoting.Channels.IServerChannelSink nextSink, System.Runtime.Remoting.Channels.IChannelReceiver receiver) { } + public System.Runtime.Remoting.Channels.IServerChannelSink NextChannelSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Collections.IDictionary Properties { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Runtime.Serialization.Formatters.TypeFilterLevel TypeFilterLevel { get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessResponse(System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.IO.Stream GetResponseStream(System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.ServerProcessing ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Messaging.IMessage responseMsg, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { responseMsg = default(System.Runtime.Remoting.Messaging.IMessage); responseHeaders = default(System.Runtime.Remoting.Channels.ITransportHeaders); responseStream = default(System.IO.Stream); throw null; } + [System.SerializableAttribute] + public enum Protocol + { + Http = 0, + Other = 1, + } + } + public partial class BinaryServerFormatterSinkProvider : System.Runtime.Remoting.Channels.IServerChannelSinkProvider, System.Runtime.Remoting.Channels.IServerFormatterSinkProvider + { + public BinaryServerFormatterSinkProvider() { } + public BinaryServerFormatterSinkProvider(System.Collections.IDictionary properties, System.Collections.ICollection providerData) { } + public System.Runtime.Remoting.Channels.IServerChannelSinkProvider Next { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Runtime.Serialization.Formatters.TypeFilterLevel TypeFilterLevel { get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.IServerChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelReceiver channel) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void GetChannelData(System.Runtime.Remoting.Channels.IChannelDataStore channelData) { } + } + public partial class CommonTransportKeys + { + public const string ConnectionId = "__ConnectionId"; + public const string IPAddress = "__IPAddress"; + public const string RequestUri = "__RequestUri"; + public CommonTransportKeys() { } + } + public partial interface IAuthorizeRemotingConnection + { + bool IsConnectingEndPointAuthorized(System.Net.EndPoint endPoint); + bool IsConnectingIdentityAuthorized(System.Security.Principal.IIdentity identity); + } + public partial class SoapClientFormatterSink : System.Runtime.Remoting.Channels.IChannelSinkBase, System.Runtime.Remoting.Channels.IClientChannelSink, System.Runtime.Remoting.Channels.IClientFormatterSink, System.Runtime.Remoting.Messaging.IMessageSink + { + public SoapClientFormatterSink(System.Runtime.Remoting.Channels.IClientChannelSink nextSink) { } + public System.Runtime.Remoting.Channels.IClientChannelSink NextChannelSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Runtime.Remoting.Messaging.IMessageSink NextSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Collections.IDictionary Properties { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessageCtrl AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Messaging.IMessageSink replySink) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessRequest(System.Runtime.Remoting.Channels.IClientChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessResponse(System.Runtime.Remoting.Channels.IClientResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.IO.Stream GetRequestStream(System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void ProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { responseHeaders = default(System.Runtime.Remoting.Channels.ITransportHeaders); responseStream = default(System.IO.Stream); } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessage SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg) { throw null; } + } + public partial class SoapClientFormatterSinkProvider : System.Runtime.Remoting.Channels.IClientChannelSinkProvider, System.Runtime.Remoting.Channels.IClientFormatterSinkProvider + { + public SoapClientFormatterSinkProvider() { } + public SoapClientFormatterSinkProvider(System.Collections.IDictionary properties, System.Collections.ICollection providerData) { } + public System.Runtime.Remoting.Channels.IClientChannelSinkProvider Next { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.IClientChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelSender channel, string url, object remoteChannelData) { throw null; } + } + public partial class SoapServerFormatterSink : System.Runtime.Remoting.Channels.IChannelSinkBase, System.Runtime.Remoting.Channels.IServerChannelSink + { + public SoapServerFormatterSink(System.Runtime.Remoting.Channels.SoapServerFormatterSink.Protocol protocol, System.Runtime.Remoting.Channels.IServerChannelSink nextSink, System.Runtime.Remoting.Channels.IChannelReceiver receiver) { } + public System.Runtime.Remoting.Channels.IServerChannelSink NextChannelSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Collections.IDictionary Properties { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Runtime.Serialization.Formatters.TypeFilterLevel TypeFilterLevel { get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessResponse(System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.IO.Stream GetResponseStream(System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.ServerProcessing ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Messaging.IMessage responseMsg, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { responseMsg = default(System.Runtime.Remoting.Messaging.IMessage); responseHeaders = default(System.Runtime.Remoting.Channels.ITransportHeaders); responseStream = default(System.IO.Stream); throw null; } + [System.SerializableAttribute] + public enum Protocol + { + Http = 0, + Other = 1, + } + } + public partial class SoapServerFormatterSinkProvider : System.Runtime.Remoting.Channels.IServerChannelSinkProvider, System.Runtime.Remoting.Channels.IServerFormatterSinkProvider + { + public SoapServerFormatterSinkProvider() { } + public SoapServerFormatterSinkProvider(System.Collections.IDictionary properties, System.Collections.ICollection providerData) { } + public System.Runtime.Remoting.Channels.IServerChannelSinkProvider Next { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Runtime.Serialization.Formatters.TypeFilterLevel TypeFilterLevel { get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.IServerChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelReceiver channel) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void GetChannelData(System.Runtime.Remoting.Channels.IChannelDataStore channelData) { } + } + public enum SocketCachePolicy + { + AbsoluteTimeout = 1, + Default = 0, + } +} +namespace System.Runtime.Remoting.Channels.Http +{ + public partial class HttpChannel : System.Runtime.Remoting.Channels.BaseChannelWithProperties, System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelReceiver, System.Runtime.Remoting.Channels.IChannelReceiverHook, System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel + { + public HttpChannel() { } + public HttpChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider) { } + public HttpChannel(int port) { } + public object ChannelData { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelScheme { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Runtime.Remoting.Channels.IServerChannelSink ChannelSinkChain { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + public override object this[object key] { get { throw null; } set { } } + public override System.Collections.ICollection Keys { get { throw null; } } + public override System.Collections.IDictionary Properties { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool WantsToListen { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AddHookChannelUri(string channelUri) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string[] GetUrlsForUri(string objectURI) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StartListening(object data) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StopListening(object data) { } + } + public partial class HttpClientChannel : System.Runtime.Remoting.Channels.BaseChannelWithProperties, System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel + { + public HttpClientChannel() { } + public HttpClientChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider) { } + public HttpClientChannel(string name, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider) { } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + public override object this[object key] { get { throw null; } set { } } + public override System.Collections.ICollection Keys { get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public virtual System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + } + public partial class HttpRemotingHandler : System.Web.IHttpHandler + { + public HttpRemotingHandler() { } + public HttpRemotingHandler(System.Type type, object srvID) { } + public bool IsReusable { get { throw null; } } + public void ProcessRequest(System.Web.HttpContext context) { } + } + public partial class HttpRemotingHandlerFactory : System.Web.IHttpHandlerFactory + { + public HttpRemotingHandlerFactory() { } + public System.Web.IHttpHandler GetHandler(System.Web.HttpContext context, string verb, string url, string filePath) { throw null; } + public void ReleaseHandler(System.Web.IHttpHandler handler) { } + } + public partial class HttpServerChannel : System.Runtime.Remoting.Channels.BaseChannelWithProperties, System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelReceiver, System.Runtime.Remoting.Channels.IChannelReceiverHook + { + public HttpServerChannel() { } + public HttpServerChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider) { } + public HttpServerChannel(int port) { } + public HttpServerChannel(string name, int port) { } + public HttpServerChannel(string name, int port, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider) { } + public object ChannelData { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelScheme { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096))]get { throw null; } } + public System.Runtime.Remoting.Channels.IServerChannelSink ChannelSinkChain { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096))]get { throw null; } } + public override object this[object key] { get { throw null; } set { } } + public override System.Collections.ICollection Keys { get { throw null; } } + public bool WantsToListen { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AddHookChannelUri(string channelUri) { } + public string GetChannelUri() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public virtual string[] GetUrlsForUri(string objectUri) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StartListening(object data) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StopListening(object data) { } + } +} +namespace System.Runtime.Remoting.Channels.Ipc +{ + public partial class IpcChannel : System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelReceiver, System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel + { + public IpcChannel() { } + public IpcChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider) { } + public IpcChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider, System.Security.AccessControl.CommonSecurityDescriptor securityDescriptor) { } + public IpcChannel(string portName) { } + public object ChannelData { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string[] GetUrlsForUri(string objectURI) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StartListening(object data) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StopListening(object data) { } + } + public partial class IpcClientChannel : System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel + { + public IpcClientChannel() { } + public IpcClientChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider) { } + public IpcClientChannel(string name, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider) { } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public virtual System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + } + public partial class IpcServerChannel : System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelReceiver, System.Runtime.Remoting.Channels.ISecurableChannel + { + public IpcServerChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider) { } + public IpcServerChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider, System.Security.AccessControl.CommonSecurityDescriptor securityDescriptor) { } + public IpcServerChannel(string portName) { } + public IpcServerChannel(string name, string portName) { } + public IpcServerChannel(string name, string portName, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider) { } + public object ChannelData { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + public string GetChannelUri() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public virtual string[] GetUrlsForUri(string objectUri) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StartListening(object data) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StopListening(object data) { } + } +} +namespace System.Runtime.Remoting.Channels.Tcp +{ + public partial class TcpChannel : System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelReceiver, System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel + { + public TcpChannel() { } + public TcpChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider clientSinkProvider, System.Runtime.Remoting.Channels.IServerChannelSinkProvider serverSinkProvider) { } + public TcpChannel(int port) { } + public object ChannelData { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string[] GetUrlsForUri(string objectURI) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StartListening(object data) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StopListening(object data) { } + } + public partial class TcpClientChannel : System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelSender, System.Runtime.Remoting.Channels.ISecurableChannel + { + public TcpClientChannel() { } + public TcpClientChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider) { } + public TcpClientChannel(string name, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider) { } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public virtual System.Runtime.Remoting.Messaging.IMessageSink CreateMessageSink(string url, object remoteChannelData, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + } + public partial class TcpServerChannel : System.Runtime.Remoting.Channels.IChannel, System.Runtime.Remoting.Channels.IChannelReceiver, System.Runtime.Remoting.Channels.ISecurableChannel + { + public TcpServerChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider) { } + public TcpServerChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider, System.Runtime.Remoting.Channels.IAuthorizeRemotingConnection authorizeCallback) { } + public TcpServerChannel(int port) { } + public TcpServerChannel(string name, int port) { } + public TcpServerChannel(string name, int port, System.Runtime.Remoting.Channels.IServerChannelSinkProvider sinkProvider) { } + public object ChannelData { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public string ChannelName { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public int ChannelPriority { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public bool IsSecured { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + public string GetChannelUri() { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public virtual string[] GetUrlsForUri(string objectUri) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public string Parse(string url, out string objectURI) { objectURI = default(string); throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StartListening(object data) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void StopListening(object data) { } + } +} +namespace System.Runtime.Remoting.MetadataServices +{ + public partial class MetaData + { + public MetaData() { } + public static void ConvertCodeSourceFileToAssemblyFile(string codePath, string assemblyPath, string strongNameFilename) { } + public static void ConvertCodeSourceStreamToAssemblyFile(System.Collections.ArrayList outCodeStreamList, string assemblyPath, string strongNameFilename) { } + public static void ConvertSchemaStreamToCodeSourceStream(bool clientProxy, string outputDirectory, System.IO.Stream inputStream, System.Collections.ArrayList outCodeStreamList) { } + public static void ConvertSchemaStreamToCodeSourceStream(bool clientProxy, string outputDirectory, System.IO.Stream inputStream, System.Collections.ArrayList outCodeStreamList, string proxyUrl) { } + public static void ConvertSchemaStreamToCodeSourceStream(bool clientProxy, string outputDirectory, System.IO.Stream inputStream, System.Collections.ArrayList outCodeStreamList, string proxyUrl, string proxyNamespace) { } + public static void ConvertTypesToSchemaToFile(System.Runtime.Remoting.MetadataServices.ServiceType[] types, System.Runtime.Remoting.MetadataServices.SdlType sdlType, string path) { } + public static void ConvertTypesToSchemaToFile(System.Type[] types, System.Runtime.Remoting.MetadataServices.SdlType sdlType, string path) { } + public static void ConvertTypesToSchemaToStream(System.Runtime.Remoting.MetadataServices.ServiceType[] serviceTypes, System.Runtime.Remoting.MetadataServices.SdlType sdlType, System.IO.Stream outputStream) { } + public static void ConvertTypesToSchemaToStream(System.Type[] types, System.Runtime.Remoting.MetadataServices.SdlType sdlType, System.IO.Stream outputStream) { } + public static void RetrieveSchemaFromUrlToFile(string url, string path) { } + public static void RetrieveSchemaFromUrlToStream(string url, System.IO.Stream outputStream) { } + public static void SaveStreamToFile(System.IO.Stream inputStream, string path) { } + } + public partial class SdlChannelSink : System.Runtime.Remoting.Channels.IChannelSinkBase, System.Runtime.Remoting.Channels.IServerChannelSink + { + public SdlChannelSink(System.Runtime.Remoting.Channels.IChannelReceiver receiver, System.Runtime.Remoting.Channels.IServerChannelSink nextSink) { } + public System.Runtime.Remoting.Channels.IServerChannelSink NextChannelSink { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + public System.Collections.IDictionary Properties { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void AsyncProcessResponse(System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers, System.IO.Stream stream) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.IO.Stream GetResponseStream(System.Runtime.Remoting.Channels.IServerResponseChannelSinkStack sinkStack, object state, System.Runtime.Remoting.Messaging.IMessage msg, System.Runtime.Remoting.Channels.ITransportHeaders headers) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.ServerProcessing ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, out System.Runtime.Remoting.Messaging.IMessage responseMsg, out System.Runtime.Remoting.Channels.ITransportHeaders responseHeaders, out System.IO.Stream responseStream) { responseMsg = default(System.Runtime.Remoting.Messaging.IMessage); responseHeaders = default(System.Runtime.Remoting.Channels.ITransportHeaders); responseStream = default(System.IO.Stream); throw null; } + } + public partial class SdlChannelSinkProvider : System.Runtime.Remoting.Channels.IServerChannelSinkProvider + { + public SdlChannelSinkProvider() { } + public SdlChannelSinkProvider(System.Collections.IDictionary properties, System.Collections.ICollection providerData) { } + public System.Runtime.Remoting.Channels.IServerChannelSinkProvider Next { [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]get { throw null; } [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)]set { } } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public System.Runtime.Remoting.Channels.IServerChannelSink CreateSink(System.Runtime.Remoting.Channels.IChannelReceiver channel) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(4096), Infrastructure=true)] + public void GetChannelData(System.Runtime.Remoting.Channels.IChannelDataStore localChannelData) { } + } + [System.SerializableAttribute] + public enum SdlType + { + Sdl = 0, + Wsdl = 1, + } + public partial class ServiceType + { + public ServiceType(System.Type type) { } + public ServiceType(System.Type type, string url) { } + public System.Type ObjectType { get { throw null; } } + public string Url { get { throw null; } } + } + [System.SerializableAttribute] + public partial class SUDSGeneratorException : System.Exception + { + protected SUDSGeneratorException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class SUDSParserException : System.Exception + { + protected SUDSParserException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } +} +namespace System.Runtime.Remoting.Services +{ + [System.Runtime.InteropServices.ComVisibleAttribute(true)] + public abstract partial class RemotingClientProxy : System.ComponentModel.Component + { + protected object _tp; + protected System.Type _type; + protected string _url; + protected RemotingClientProxy() { } + public bool AllowAutoRedirect { get { throw null; } set { } } + public object Cookies { get { throw null; } } + public string Domain { get { throw null; } set { } } + public bool EnableCookies { get { throw null; } set { } } + public string Password { get { throw null; } set { } } + public string Path { get { throw null; } set { } } + public bool PreAuthenticate { get { throw null; } set { } } + public string ProxyName { get { throw null; } set { } } + public int ProxyPort { get { throw null; } set { } } + public int Timeout { get { throw null; } set { } } + public string Url { get { throw null; } set { } } + public string UserAgent { get { throw null; } set { } } + public string Username { get { throw null; } set { } } + protected void ConfigureProxy(System.Type type, string url) { } + protected void ConnectProxy() { } + } + public partial class RemotingService : System.ComponentModel.Component + { + public RemotingService() { } + public System.Web.HttpApplicationState Application { get { throw null; } } + public System.Web.HttpContext Context { get { throw null; } } + public System.Web.HttpServerUtility Server { get { throw null; } } + public System.Web.SessionState.HttpSessionState Session { get { throw null; } } + public System.Security.Principal.IPrincipal User { get { throw null; } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Serialization.Formatters.Soap.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Serialization.Formatters.Soap.cs new file mode 100644 index 0000000000..c5d2e89d0a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Serialization.Formatters.Soap.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.Formatters.Soap.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters.Soap.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters.Soap.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(true)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +namespace System.Runtime.Serialization.Formatters.Soap +{ + public sealed partial class SoapFormatter : System.Runtime.Remoting.Messaging.IRemotingFormatter, System.Runtime.Serialization.IFormatter + { + public SoapFormatter() { } + public SoapFormatter(System.Runtime.Serialization.ISurrogateSelector selector, System.Runtime.Serialization.StreamingContext context) { } + public System.Runtime.Serialization.Formatters.FormatterAssemblyStyle AssemblyFormat { get { throw null; } set { } } + public System.Runtime.Serialization.SerializationBinder Binder { get { throw null; } set { } } + public System.Runtime.Serialization.StreamingContext Context { get { throw null; } set { } } + public System.Runtime.Serialization.Formatters.TypeFilterLevel FilterLevel { get { throw null; } set { } } + public System.Runtime.Serialization.ISurrogateSelector SurrogateSelector { get { throw null; } set { } } + public System.Runtime.Serialization.Formatters.ISoapMessage TopObject { get { throw null; } set { } } + public System.Runtime.Serialization.Formatters.FormatterTypeStyle TypeFormat { get { throw null; } set { } } + public object Deserialize(System.IO.Stream serializationStream) { throw null; } + public object Deserialize(System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) { throw null; } + public void Serialize(System.IO.Stream serializationStream, object graph) { } + public void Serialize(System.IO.Stream serializationStream, object graph, System.Runtime.Remoting.Messaging.Header[] headers) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Serialization.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Serialization.cs new file mode 100644 index 0000000000..08c9ae7d6b --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Runtime.Serialization.cs @@ -0,0 +1,836 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Runtime.Serialization.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Runtime.Serialization +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited=false, AllowMultiple=false)] + public sealed partial class CollectionDataContractAttribute : System.Attribute + { + public CollectionDataContractAttribute() { } + public bool IsItemNameSetExplicitly { get { throw null; } } + public bool IsKeyNameSetExplicitly { get { throw null; } } + public bool IsNameSetExplicitly { get { throw null; } } + public bool IsNamespaceSetExplicitly { get { throw null; } } + public bool IsReference { get { throw null; } set { } } + public bool IsReferenceSetExplicitly { get { throw null; } } + public bool IsValueNameSetExplicitly { get { throw null; } } + public string ItemName { get { throw null; } set { } } + public string KeyName { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Namespace { get { throw null; } set { } } + public string ValueName { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(3), Inherited=false, AllowMultiple=true)] + public sealed partial class ContractNamespaceAttribute : System.Attribute + { + public ContractNamespaceAttribute(string contractNamespace) { } + public string ClrNamespace { get { throw null; } set { } } + public string ContractNamespace { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(28), Inherited=false, AllowMultiple=false)] + public sealed partial class DataContractAttribute : System.Attribute + { + public DataContractAttribute() { } + public bool IsNameSetExplicitly { get { throw null; } } + public bool IsNamespaceSetExplicitly { get { throw null; } } + public bool IsReference { get { throw null; } set { } } + public bool IsReferenceSetExplicitly { get { throw null; } } + public string Name { get { throw null; } set { } } + public string Namespace { get { throw null; } set { } } + } + public abstract partial class DataContractResolver + { + protected DataContractResolver() { } + public abstract System.Type ResolveName(string typeName, string typeNamespace, System.Type declaredType, System.Runtime.Serialization.DataContractResolver knownTypeResolver); + public abstract bool TryResolveType(System.Type type, System.Type declaredType, System.Runtime.Serialization.DataContractResolver knownTypeResolver, out System.Xml.XmlDictionaryString typeName, out System.Xml.XmlDictionaryString typeNamespace); + } + public sealed partial class DataContractSerializer : System.Runtime.Serialization.XmlObjectSerializer + { + public DataContractSerializer(System.Type type) { } + public DataContractSerializer(System.Type type, System.Collections.Generic.IEnumerable knownTypes) { } + public DataContractSerializer(System.Type type, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate) { } + public DataContractSerializer(System.Type type, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver) { } + public DataContractSerializer(System.Type type, System.Runtime.Serialization.DataContractSerializerSettings settings) { } + public DataContractSerializer(System.Type type, string rootName, string rootNamespace) { } + public DataContractSerializer(System.Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable knownTypes) { } + public DataContractSerializer(System.Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate) { } + public DataContractSerializer(System.Type type, string rootName, string rootNamespace, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver) { } + public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace) { } + public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable knownTypes) { } + public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate) { } + public DataContractSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, System.Runtime.Serialization.DataContractResolver dataContractResolver) { } + public System.Runtime.Serialization.DataContractResolver DataContractResolver { get { throw null; } } + public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } } + public bool IgnoreExtensionDataObject { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection KnownTypes { get { throw null; } } + public int MaxItemsInObjectGraph { get { throw null; } } + public bool PreserveObjectReferences { get { throw null; } } + public bool SerializeReadOnlyTypes { get { throw null; } } + public override bool IsStartObject(System.Xml.XmlDictionaryReader reader) { throw null; } + public override bool IsStartObject(System.Xml.XmlReader reader) { throw null; } + public override object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName) { throw null; } + public object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName, System.Runtime.Serialization.DataContractResolver dataContractResolver) { throw null; } + public override object ReadObject(System.Xml.XmlReader reader) { throw null; } + public override object ReadObject(System.Xml.XmlReader reader, bool verifyObjectName) { throw null; } + public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer) { } + public override void WriteEndObject(System.Xml.XmlWriter writer) { } + public void WriteObject(System.Xml.XmlDictionaryWriter writer, object graph, System.Runtime.Serialization.DataContractResolver dataContractResolver) { } + public override void WriteObject(System.Xml.XmlWriter writer, object graph) { } + public override void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteObjectContent(System.Xml.XmlWriter writer, object graph) { } + public override void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteStartObject(System.Xml.XmlWriter writer, object graph) { } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class DataContractSerializerExtensions + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static System.Runtime.Serialization.ISerializationSurrogateProvider GetSerializationSurrogateProvider(this System.Runtime.Serialization.DataContractSerializer serializer) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static void SetSerializationSurrogateProvider(this System.Runtime.Serialization.DataContractSerializer serializer, System.Runtime.Serialization.ISerializationSurrogateProvider provider) { } + } + public partial class DataContractSerializerSettings + { + public DataContractSerializerSettings() { } + public System.Runtime.Serialization.DataContractResolver DataContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IgnoreExtensionDataObject { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IEnumerable KnownTypes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public int MaxItemsInObjectGraph { get { throw null; } set { } } + public bool PreserveObjectReferences { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Xml.XmlDictionaryString RootName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Xml.XmlDictionaryString RootNamespace { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SerializeReadOnlyTypes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), Inherited=false, AllowMultiple=false)] + public sealed partial class DataMemberAttribute : System.Attribute + { + public DataMemberAttribute() { } + public bool EmitDefaultValue { get { throw null; } set { } } + public bool IsNameSetExplicitly { get { throw null; } } + public bool IsRequired { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public int Order { get { throw null; } set { } } + } + public partial class DateTimeFormat + { + public DateTimeFormat(string formatString) { } + public DateTimeFormat(string formatString, System.IFormatProvider formatProvider) { } + public System.Globalization.DateTimeStyles DateTimeStyles { get { throw null; } set { } } + public System.IFormatProvider FormatProvider { get { throw null; } } + public string FormatString { get { throw null; } } + } + public enum EmitTypeInformation + { + Always = 1, + AsNeeded = 0, + Never = 2, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false, AllowMultiple=false)] + public sealed partial class EnumMemberAttribute : System.Attribute + { + public EnumMemberAttribute() { } + public bool IsValueSetExplicitly { get { throw null; } } + public string Value { get { throw null; } set { } } + } + public partial class ExportOptions + { + public ExportOptions() { } + public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection KnownTypes { get { throw null; } } + } + public sealed partial class ExtensionDataObject + { + internal ExtensionDataObject() { } + } + public partial interface IDataContractSurrogate + { + object GetCustomDataToExport(System.Reflection.MemberInfo memberInfo, System.Type dataContractType); + object GetCustomDataToExport(System.Type clrType, System.Type dataContractType); + System.Type GetDataContractType(System.Type type); + object GetDeserializedObject(object obj, System.Type targetType); + void GetKnownCustomDataTypes(System.Collections.ObjectModel.Collection customDataTypes); + object GetObjectToSerialize(object obj, System.Type targetType); + System.Type GetReferencedTypeOnImport(string typeName, string typeNamespace, object customData); + System.CodeDom.CodeTypeDeclaration ProcessImportedType(System.CodeDom.CodeTypeDeclaration typeDeclaration, System.CodeDom.CodeCompileUnit compileUnit); + } + public partial interface IExtensibleDataObject + { + System.Runtime.Serialization.ExtensionDataObject ExtensionData { get; set; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(384), Inherited=false, AllowMultiple=false)] + public sealed partial class IgnoreDataMemberAttribute : System.Attribute + { + public IgnoreDataMemberAttribute() { } + } + public partial class ImportOptions + { + public ImportOptions() { } + public System.CodeDom.Compiler.CodeDomProvider CodeProvider { get { throw null; } set { } } + public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } set { } } + public bool EnableDataBinding { get { throw null; } set { } } + public bool GenerateInternal { get { throw null; } set { } } + public bool GenerateSerializable { get { throw null; } set { } } + public bool ImportXmlType { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Namespaces { get { throw null; } } + public System.Collections.Generic.ICollection ReferencedCollectionTypes { get { throw null; } } + public System.Collections.Generic.ICollection ReferencedTypes { get { throw null; } } + } + [System.SerializableAttribute] + public partial class InvalidDataContractException : System.Exception + { + public InvalidDataContractException() { } + protected InvalidDataContractException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public InvalidDataContractException(string message) { } + public InvalidDataContractException(string message, System.Exception innerException) { } + } + public partial interface ISerializationSurrogateProvider + { + object GetDeserializedObject(object obj, System.Type targetType); + object GetObjectToSerialize(object obj, System.Type targetType); + System.Type GetSurrogateType(System.Type type); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited=true, AllowMultiple=true)] + public sealed partial class KnownTypeAttribute : System.Attribute + { + public KnownTypeAttribute(string methodName) { } + public KnownTypeAttribute(System.Type type) { } + public string MethodName { get { throw null; } } + public System.Type Type { get { throw null; } } + } + public sealed partial class NetDataContractSerializer : System.Runtime.Serialization.XmlObjectSerializer, System.Runtime.Serialization.IFormatter + { + public NetDataContractSerializer() { } + public NetDataContractSerializer(System.Runtime.Serialization.StreamingContext context) { } + public NetDataContractSerializer(System.Runtime.Serialization.StreamingContext context, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.Formatters.FormatterAssemblyStyle assemblyFormat, System.Runtime.Serialization.ISurrogateSelector surrogateSelector) { } + public NetDataContractSerializer(string rootName, string rootNamespace) { } + public NetDataContractSerializer(string rootName, string rootNamespace, System.Runtime.Serialization.StreamingContext context, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.Formatters.FormatterAssemblyStyle assemblyFormat, System.Runtime.Serialization.ISurrogateSelector surrogateSelector) { } + public NetDataContractSerializer(System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace) { } + public NetDataContractSerializer(System.Xml.XmlDictionaryString rootName, System.Xml.XmlDictionaryString rootNamespace, System.Runtime.Serialization.StreamingContext context, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.Formatters.FormatterAssemblyStyle assemblyFormat, System.Runtime.Serialization.ISurrogateSelector surrogateSelector) { } + public System.Runtime.Serialization.Formatters.FormatterAssemblyStyle AssemblyFormat { get { throw null; } set { } } + public System.Runtime.Serialization.SerializationBinder Binder { get { throw null; } set { } } + public System.Runtime.Serialization.StreamingContext Context { get { throw null; } set { } } + public bool IgnoreExtensionDataObject { get { throw null; } } + public int MaxItemsInObjectGraph { get { throw null; } } + public System.Runtime.Serialization.ISurrogateSelector SurrogateSelector { get { throw null; } set { } } + public object Deserialize(System.IO.Stream stream) { throw null; } + public override bool IsStartObject(System.Xml.XmlDictionaryReader reader) { throw null; } + public override bool IsStartObject(System.Xml.XmlReader reader) { throw null; } + public override object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName) { throw null; } + public override object ReadObject(System.Xml.XmlReader reader) { throw null; } + public override object ReadObject(System.Xml.XmlReader reader, bool verifyObjectName) { throw null; } + public void Serialize(System.IO.Stream stream, object graph) { } + public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer) { } + public override void WriteEndObject(System.Xml.XmlWriter writer) { } + public override void WriteObject(System.Xml.XmlWriter writer, object graph) { } + public override void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteObjectContent(System.Xml.XmlWriter writer, object graph) { } + public override void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteStartObject(System.Xml.XmlWriter writer, object graph) { } + } + public abstract partial class XmlObjectSerializer + { + protected XmlObjectSerializer() { } + public abstract bool IsStartObject(System.Xml.XmlDictionaryReader reader); + public virtual bool IsStartObject(System.Xml.XmlReader reader) { throw null; } + public virtual object ReadObject(System.IO.Stream stream) { throw null; } + public virtual object ReadObject(System.Xml.XmlDictionaryReader reader) { throw null; } + public abstract object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName); + public virtual object ReadObject(System.Xml.XmlReader reader) { throw null; } + public virtual object ReadObject(System.Xml.XmlReader reader, bool verifyObjectName) { throw null; } + public abstract void WriteEndObject(System.Xml.XmlDictionaryWriter writer); + public virtual void WriteEndObject(System.Xml.XmlWriter writer) { } + public virtual void WriteObject(System.IO.Stream stream, object graph) { } + public virtual void WriteObject(System.Xml.XmlDictionaryWriter writer, object graph) { } + public virtual void WriteObject(System.Xml.XmlWriter writer, object graph) { } + public abstract void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph); + public virtual void WriteObjectContent(System.Xml.XmlWriter writer, object graph) { } + public abstract void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph); + public virtual void WriteStartObject(System.Xml.XmlWriter writer, object graph) { } + } + public static partial class XmlSerializableServices + { + public static void AddDefaultSchema(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeQName) { } + public static System.Xml.XmlNode[] ReadNodes(System.Xml.XmlReader xmlReader) { throw null; } + public static void WriteNodes(System.Xml.XmlWriter xmlWriter, System.Xml.XmlNode[] nodes) { } + } + public static partial class XPathQueryGenerator + { + public static string CreateFromDataContractSerializer(System.Type type, System.Reflection.MemberInfo[] pathToMember, System.Text.StringBuilder rootElementXpath, out System.Xml.XmlNamespaceManager namespaces) { namespaces = default(System.Xml.XmlNamespaceManager); throw null; } + public static string CreateFromDataContractSerializer(System.Type type, System.Reflection.MemberInfo[] pathToMember, out System.Xml.XmlNamespaceManager namespaces) { namespaces = default(System.Xml.XmlNamespaceManager); throw null; } + } + public partial class XsdDataContractExporter + { + public XsdDataContractExporter() { } + public XsdDataContractExporter(System.Xml.Schema.XmlSchemaSet schemas) { } + public System.Runtime.Serialization.ExportOptions Options { get { throw null; } set { } } + public System.Xml.Schema.XmlSchemaSet Schemas { get { throw null; } } + public bool CanExport(System.Collections.Generic.ICollection assemblies) { throw null; } + public bool CanExport(System.Collections.Generic.ICollection types) { throw null; } + public bool CanExport(System.Type type) { throw null; } + public void Export(System.Collections.Generic.ICollection assemblies) { } + public void Export(System.Collections.Generic.ICollection types) { } + public void Export(System.Type type) { } + public System.Xml.XmlQualifiedName GetRootElementName(System.Type type) { throw null; } + public System.Xml.Schema.XmlSchemaType GetSchemaType(System.Type type) { throw null; } + public System.Xml.XmlQualifiedName GetSchemaTypeName(System.Type type) { throw null; } + } + public partial class XsdDataContractImporter + { + public XsdDataContractImporter() { } + public XsdDataContractImporter(System.CodeDom.CodeCompileUnit codeCompileUnit) { } + public System.CodeDom.CodeCompileUnit CodeCompileUnit { get { throw null; } } + public System.Runtime.Serialization.ImportOptions Options { get { throw null; } set { } } + public bool CanImport(System.Xml.Schema.XmlSchemaSet schemas) { throw null; } + public bool CanImport(System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.ICollection typeNames) { throw null; } + public bool CanImport(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element) { throw null; } + public bool CanImport(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName) { throw null; } + public System.CodeDom.CodeTypeReference GetCodeTypeReference(System.Xml.XmlQualifiedName typeName) { throw null; } + public System.CodeDom.CodeTypeReference GetCodeTypeReference(System.Xml.XmlQualifiedName typeName, System.Xml.Schema.XmlSchemaElement element) { throw null; } + public System.Collections.Generic.ICollection GetKnownTypeReferences(System.Xml.XmlQualifiedName typeName) { throw null; } + public void Import(System.Xml.Schema.XmlSchemaSet schemas) { } + public void Import(System.Xml.Schema.XmlSchemaSet schemas, System.Collections.Generic.ICollection typeNames) { } + public System.Xml.XmlQualifiedName Import(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.XmlSchemaElement element) { throw null; } + public void Import(System.Xml.Schema.XmlSchemaSet schemas, System.Xml.XmlQualifiedName typeName) { } + } +} +namespace System.Runtime.Serialization.Configuration +{ + public sealed partial class DataContractSerializerSection : System.Configuration.ConfigurationSection + { + public DataContractSerializerSection() { } + [System.Configuration.ConfigurationPropertyAttribute("declaredTypes", DefaultValue=null)] + public System.Runtime.Serialization.Configuration.DeclaredTypeElementCollection DeclaredTypes { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + public sealed partial class DeclaredTypeElement : System.Configuration.ConfigurationElement + { + public DeclaredTypeElement() { } + public DeclaredTypeElement(string typeName) { } + [System.Configuration.ConfigurationPropertyAttribute("", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(1))] + public System.Runtime.Serialization.Configuration.TypeElementCollection KnownTypes { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("type", DefaultValue="", Options=(System.Configuration.ConfigurationPropertyOptions)(4))] + public string Type { get { throw null; } set { } } + [System.Security.SecuritySafeCriticalAttribute] + protected override void PostDeserialize() { } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Runtime.Serialization.Configuration.DeclaredTypeElement))] + public sealed partial class DeclaredTypeElementCollection : System.Configuration.ConfigurationElementCollection + { + public DeclaredTypeElementCollection() { } + public System.Runtime.Serialization.Configuration.DeclaredTypeElement this[int index] { get { throw null; } set { } } + public new System.Runtime.Serialization.Configuration.DeclaredTypeElement this[string typeName] { get { throw null; } set { } } + public void Add(System.Runtime.Serialization.Configuration.DeclaredTypeElement element) { } + public void Clear() { } + public bool Contains(string typeName) { throw null; } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public int IndexOf(System.Runtime.Serialization.Configuration.DeclaredTypeElement element) { throw null; } + public void Remove(System.Runtime.Serialization.Configuration.DeclaredTypeElement element) { } + public void Remove(string typeName) { } + public void RemoveAt(int index) { } + } + public sealed partial class NetDataContractSerializerSection : System.Configuration.ConfigurationSection + { + public NetDataContractSerializerSection() { } + [System.Configuration.ConfigurationPropertyAttribute("enableUnsafeTypeForwarding", DefaultValue=false)] + public bool EnableUnsafeTypeForwarding { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + public sealed partial class ParameterElement : System.Configuration.ConfigurationElement + { + public ParameterElement() { } + public ParameterElement(int index) { } + public ParameterElement(string typeName) { } + [System.Configuration.ConfigurationPropertyAttribute("index", DefaultValue=0)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0)] + public int Index { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(1))] + public System.Runtime.Serialization.Configuration.ParameterElementCollection Parameters { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("type", DefaultValue="")] + [System.Configuration.StringValidatorAttribute(MinLength=0)] + public string Type { get { throw null; } set { } } + protected override void PostDeserialize() { } + protected override void PreSerialize(System.Xml.XmlWriter writer) { } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Runtime.Serialization.Configuration.ParameterElement), AddItemName="parameter", CollectionType=(System.Configuration.ConfigurationElementCollectionType)(0))] + public sealed partial class ParameterElementCollection : System.Configuration.ConfigurationElementCollection + { + public ParameterElementCollection() { } + public override System.Configuration.ConfigurationElementCollectionType CollectionType { get { throw null; } } + protected override string ElementName { get { throw null; } } + public System.Runtime.Serialization.Configuration.ParameterElement this[int index] { get { throw null; } set { } } + public void Add(System.Runtime.Serialization.Configuration.ParameterElement element) { } + public void Clear() { } + public bool Contains(string typeName) { throw null; } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public int IndexOf(System.Runtime.Serialization.Configuration.ParameterElement element) { throw null; } + public void Remove(System.Runtime.Serialization.Configuration.ParameterElement element) { } + public void RemoveAt(int index) { } + } + public sealed partial class SerializationSectionGroup : System.Configuration.ConfigurationSectionGroup + { + public SerializationSectionGroup() { } + public System.Runtime.Serialization.Configuration.DataContractSerializerSection DataContractSerializer { get { throw null; } } + public System.Runtime.Serialization.Configuration.NetDataContractSerializerSection NetDataContractSerializer { get { throw null; } } + public static System.Runtime.Serialization.Configuration.SerializationSectionGroup GetSectionGroup(System.Configuration.Configuration config) { throw null; } + } + public sealed partial class TypeElement : System.Configuration.ConfigurationElement + { + public TypeElement() { } + public TypeElement(string typeName) { } + [System.Configuration.ConfigurationPropertyAttribute("index", DefaultValue=0)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0)] + public int Index { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(1))] + public System.Runtime.Serialization.Configuration.ParameterElementCollection Parameters { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("type", DefaultValue="")] + [System.Configuration.StringValidatorAttribute(MinLength=0)] + public string Type { get { throw null; } set { } } + protected override void Reset(System.Configuration.ConfigurationElement parentElement) { } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.Runtime.Serialization.Configuration.TypeElement), CollectionType=(System.Configuration.ConfigurationElementCollectionType)(0))] + public sealed partial class TypeElementCollection : System.Configuration.ConfigurationElementCollection + { + public TypeElementCollection() { } + public override System.Configuration.ConfigurationElementCollectionType CollectionType { get { throw null; } } + protected override string ElementName { get { throw null; } } + public System.Runtime.Serialization.Configuration.TypeElement this[int index] { get { throw null; } set { } } + public void Add(System.Runtime.Serialization.Configuration.TypeElement element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public int IndexOf(System.Runtime.Serialization.Configuration.TypeElement element) { throw null; } + public void Remove(System.Runtime.Serialization.Configuration.TypeElement element) { } + public void RemoveAt(int index) { } + } +} +namespace System.Runtime.Serialization.Json +{ + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class DataContractJsonSerializer : System.Runtime.Serialization.XmlObjectSerializer + { + public DataContractJsonSerializer(System.Type type) { } + public DataContractJsonSerializer(System.Type type, System.Collections.Generic.IEnumerable knownTypes) { } + public DataContractJsonSerializer(System.Type type, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation) { } + public DataContractJsonSerializer(System.Type type, System.Runtime.Serialization.Json.DataContractJsonSerializerSettings settings) { } + public DataContractJsonSerializer(System.Type type, string rootName) { } + public DataContractJsonSerializer(System.Type type, string rootName, System.Collections.Generic.IEnumerable knownTypes) { } + public DataContractJsonSerializer(System.Type type, string rootName, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation) { } + public DataContractJsonSerializer(System.Type type, System.Xml.XmlDictionaryString rootName) { } + public DataContractJsonSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Collections.Generic.IEnumerable knownTypes) { } + public DataContractJsonSerializer(System.Type type, System.Xml.XmlDictionaryString rootName, System.Collections.Generic.IEnumerable knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, System.Runtime.Serialization.IDataContractSurrogate dataContractSurrogate, bool alwaysEmitTypeInformation) { } + public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { get { throw null; } } + public System.Runtime.Serialization.DateTimeFormat DateTimeFormat { get { throw null; } } + public System.Runtime.Serialization.EmitTypeInformation EmitTypeInformation { get { throw null; } } + public bool IgnoreExtensionDataObject { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection KnownTypes { get { throw null; } } + public int MaxItemsInObjectGraph { get { throw null; } } + public bool SerializeReadOnlyTypes { get { throw null; } } + public bool UseSimpleDictionaryFormat { get { throw null; } } + public override bool IsStartObject(System.Xml.XmlDictionaryReader reader) { throw null; } + public override bool IsStartObject(System.Xml.XmlReader reader) { throw null; } + public override object ReadObject(System.IO.Stream stream) { throw null; } + public override object ReadObject(System.Xml.XmlDictionaryReader reader) { throw null; } + public override object ReadObject(System.Xml.XmlDictionaryReader reader, bool verifyObjectName) { throw null; } + public override object ReadObject(System.Xml.XmlReader reader) { throw null; } + public override object ReadObject(System.Xml.XmlReader reader, bool verifyObjectName) { throw null; } + public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer) { } + public override void WriteEndObject(System.Xml.XmlWriter writer) { } + public override void WriteObject(System.IO.Stream stream, object graph) { } + public override void WriteObject(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteObject(System.Xml.XmlWriter writer, object graph) { } + public override void WriteObjectContent(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteObjectContent(System.Xml.XmlWriter writer, object graph) { } + public override void WriteStartObject(System.Xml.XmlDictionaryWriter writer, object graph) { } + public override void WriteStartObject(System.Xml.XmlWriter writer, object graph) { } + } + public partial class DataContractJsonSerializerSettings + { + public DataContractJsonSerializerSettings() { } + public System.Runtime.Serialization.IDataContractSurrogate DataContractSurrogate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Runtime.Serialization.DateTimeFormat DateTimeFormat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Runtime.Serialization.EmitTypeInformation EmitTypeInformation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IgnoreExtensionDataObject { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IEnumerable KnownTypes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public int MaxItemsInObjectGraph { get { throw null; } set { } } + public string RootName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SerializeReadOnlyTypes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool UseSimpleDictionaryFormat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IXmlJsonReaderInitializer + { + void SetInput(byte[] buffer, int offset, int count, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose); + void SetInput(System.IO.Stream stream, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IXmlJsonWriterInitializer + { + void SetOutput(System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public static partial class JsonReaderWriterFactory + { + public static System.Xml.XmlDictionaryReader CreateJsonReader(byte[] buffer, int offset, int count, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateJsonReader(byte[] buffer, int offset, int count, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateJsonReader(byte[] buffer, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateJsonReader(System.IO.Stream stream, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateJsonReader(System.IO.Stream stream, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateJsonWriter(System.IO.Stream stream) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateJsonWriter(System.IO.Stream stream, System.Text.Encoding encoding) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateJsonWriter(System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateJsonWriter(System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream, bool indent) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateJsonWriter(System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream, bool indent, string indentChars) { throw null; } + } +} +namespace System.Xml +{ + public partial interface IFragmentCapableXmlDictionaryWriter + { + bool CanFragment { get; } + void EndFragment(); + void StartFragment(System.IO.Stream stream, bool generateSelfContainedTextFragment); + void WriteFragment(byte[] buffer, int offset, int count); + } + public partial interface IStreamProvider + { + System.IO.Stream GetStream(); + void ReleaseStream(System.IO.Stream stream); + } + public partial interface IXmlBinaryReaderInitializer + { + void SetInput(byte[] buffer, int offset, int count, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.XmlBinaryReaderSession session, System.Xml.OnXmlDictionaryReaderClose onClose); + void SetInput(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.XmlBinaryReaderSession session, System.Xml.OnXmlDictionaryReaderClose onClose); + } + public partial interface IXmlBinaryWriterInitializer + { + void SetOutput(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlBinaryWriterSession session, bool ownsStream); + } + public partial interface IXmlDictionary + { + bool TryLookup(int key, out System.Xml.XmlDictionaryString result); + bool TryLookup(string value, out System.Xml.XmlDictionaryString result); + bool TryLookup(System.Xml.XmlDictionaryString value, out System.Xml.XmlDictionaryString result); + } + public partial interface IXmlMtomReaderInitializer + { + void SetInput(byte[] buffer, int offset, int count, System.Text.Encoding[] encodings, string contentType, System.Xml.XmlDictionaryReaderQuotas quotas, int maxBufferSize, System.Xml.OnXmlDictionaryReaderClose onClose); + void SetInput(System.IO.Stream stream, System.Text.Encoding[] encodings, string contentType, System.Xml.XmlDictionaryReaderQuotas quotas, int maxBufferSize, System.Xml.OnXmlDictionaryReaderClose onClose); + } + public partial interface IXmlMtomWriterInitializer + { + void SetOutput(System.IO.Stream stream, System.Text.Encoding encoding, int maxSizeInBytes, string startInfo, string boundary, string startUri, bool writeMessageHeaders, bool ownsStream); + } + public partial interface IXmlTextReaderInitializer + { + void SetInput(byte[] buffer, int offset, int count, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose); + void SetInput(System.IO.Stream stream, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose); + } + public partial interface IXmlTextWriterInitializer + { + void SetOutput(System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream); + } + public delegate void OnXmlDictionaryReaderClose(System.Xml.XmlDictionaryReader reader); + public partial class UniqueId + { + public UniqueId() { } + public UniqueId(byte[] guid) { } + [System.Security.SecuritySafeCriticalAttribute] + public UniqueId(byte[] guid, int offset) { } + [System.Security.SecuritySafeCriticalAttribute] + public UniqueId(char[] chars, int offset, int count) { } + public UniqueId(System.Guid guid) { } + [System.Security.SecuritySafeCriticalAttribute] + public UniqueId(string value) { } + public int CharArrayLength { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public bool IsGuid { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Xml.UniqueId id1, System.Xml.UniqueId id2) { throw null; } + public static bool operator !=(System.Xml.UniqueId id1, System.Xml.UniqueId id2) { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + public int ToCharArray(char[] chars, int offset) { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + public override string ToString() { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + public bool TryGetGuid(byte[] buffer, int offset) { throw null; } + public bool TryGetGuid(out System.Guid guid) { guid = default(System.Guid); throw null; } + } + public partial class XmlBinaryReaderSession : System.Xml.IXmlDictionary + { + public XmlBinaryReaderSession() { } + public System.Xml.XmlDictionaryString Add(int id, string value) { throw null; } + public void Clear() { } + public bool TryLookup(int key, out System.Xml.XmlDictionaryString result) { result = default(System.Xml.XmlDictionaryString); throw null; } + public bool TryLookup(string value, out System.Xml.XmlDictionaryString result) { result = default(System.Xml.XmlDictionaryString); throw null; } + public bool TryLookup(System.Xml.XmlDictionaryString value, out System.Xml.XmlDictionaryString result) { result = default(System.Xml.XmlDictionaryString); throw null; } + } + public partial class XmlBinaryWriterSession + { + public XmlBinaryWriterSession() { } + public void Reset() { } + public virtual bool TryAdd(System.Xml.XmlDictionaryString value, out int key) { key = default(int); throw null; } + } + public partial class XmlDictionary : System.Xml.IXmlDictionary + { + public XmlDictionary() { } + public XmlDictionary(int capacity) { } + public static System.Xml.IXmlDictionary Empty { get { throw null; } } + public virtual System.Xml.XmlDictionaryString Add(string value) { throw null; } + public virtual bool TryLookup(int key, out System.Xml.XmlDictionaryString result) { result = default(System.Xml.XmlDictionaryString); throw null; } + public virtual bool TryLookup(string value, out System.Xml.XmlDictionaryString result) { result = default(System.Xml.XmlDictionaryString); throw null; } + public virtual bool TryLookup(System.Xml.XmlDictionaryString value, out System.Xml.XmlDictionaryString result) { result = default(System.Xml.XmlDictionaryString); throw null; } + } + public abstract partial class XmlDictionaryReader : System.Xml.XmlReader + { + protected XmlDictionaryReader() { } + public virtual bool CanCanonicalize { get { throw null; } } + public virtual System.Xml.XmlDictionaryReaderQuotas Quotas { get { throw null; } } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(byte[] buffer, int offset, int count, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(byte[] buffer, int offset, int count, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.XmlBinaryReaderSession session) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(byte[] buffer, int offset, int count, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.XmlBinaryReaderSession session, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(byte[] buffer, int offset, int count, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(byte[] buffer, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.XmlBinaryReaderSession session) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.XmlBinaryReaderSession session, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateBinaryReader(System.IO.Stream stream, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateDictionaryReader(System.Xml.XmlReader reader) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(byte[] buffer, int offset, int count, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(byte[] buffer, int offset, int count, System.Text.Encoding[] encodings, string contentType, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(byte[] buffer, int offset, int count, System.Text.Encoding[] encodings, string contentType, System.Xml.XmlDictionaryReaderQuotas quotas, int maxBufferSize, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(byte[] buffer, int offset, int count, System.Text.Encoding[] encodings, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(System.IO.Stream stream, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(System.IO.Stream stream, System.Text.Encoding[] encodings, string contentType, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(System.IO.Stream stream, System.Text.Encoding[] encodings, string contentType, System.Xml.XmlDictionaryReaderQuotas quotas, int maxBufferSize, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateMtomReader(System.IO.Stream stream, System.Text.Encoding[] encodings, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateTextReader(byte[] buffer, int offset, int count, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateTextReader(byte[] buffer, int offset, int count, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateTextReader(byte[] buffer, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public static System.Xml.XmlDictionaryReader CreateTextReader(System.IO.Stream stream, System.Text.Encoding encoding, System.Xml.XmlDictionaryReaderQuotas quotas, System.Xml.OnXmlDictionaryReaderClose onClose) { throw null; } + public static System.Xml.XmlDictionaryReader CreateTextReader(System.IO.Stream stream, System.Xml.XmlDictionaryReaderQuotas quotas) { throw null; } + public virtual void EndCanonicalization() { } + public virtual string GetAttribute(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual void GetNonAtomizedNames(out string localName, out string namespaceUri) { localName = default(string); namespaceUri = default(string); } + public virtual int IndexOfLocalName(string[] localNames, string namespaceUri) { throw null; } + public virtual int IndexOfLocalName(System.Xml.XmlDictionaryString[] localNames, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual bool IsLocalName(string localName) { throw null; } + public virtual bool IsLocalName(System.Xml.XmlDictionaryString localName) { throw null; } + public virtual bool IsNamespaceUri(string namespaceUri) { throw null; } + public virtual bool IsNamespaceUri(System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual bool IsStartArray(out System.Type type) { type = default(System.Type); throw null; } + public virtual bool IsStartElement(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + protected bool IsTextNode(System.Xml.XmlNodeType nodeType) { throw null; } + public virtual void MoveToStartElement() { } + public virtual void MoveToStartElement(string name) { } + public virtual void MoveToStartElement(string localName, string namespaceUri) { } + public virtual void MoveToStartElement(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public virtual int ReadArray(string localName, string namespaceUri, bool[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, System.DateTime[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, decimal[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, double[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, System.Guid[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, short[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, int[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, long[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, float[] array, int offset, int count) { throw null; } + public virtual int ReadArray(string localName, string namespaceUri, System.TimeSpan[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, bool[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, System.DateTime[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, decimal[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, double[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, System.Guid[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, short[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, int[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, long[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, float[] array, int offset, int count) { throw null; } + public virtual int ReadArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, System.TimeSpan[] array, int offset, int count) { throw null; } + public virtual bool[] ReadBooleanArray(string localName, string namespaceUri) { throw null; } + public virtual bool[] ReadBooleanArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public override object ReadContentAs(System.Type type, System.Xml.IXmlNamespaceResolver namespaceResolver) { throw null; } + public virtual byte[] ReadContentAsBase64() { throw null; } + public virtual byte[] ReadContentAsBinHex() { throw null; } + protected byte[] ReadContentAsBinHex(int maxByteArrayContentLength) { throw null; } + public virtual int ReadContentAsChars(char[] chars, int offset, int count) { throw null; } + public override decimal ReadContentAsDecimal() { throw null; } + public override float ReadContentAsFloat() { throw null; } + public virtual System.Guid ReadContentAsGuid() { throw null; } + public virtual void ReadContentAsQualifiedName(out string localName, out string namespaceUri) { localName = default(string); namespaceUri = default(string); } + public override string ReadContentAsString() { throw null; } + protected string ReadContentAsString(int maxStringContentLength) { throw null; } + public virtual string ReadContentAsString(string[] strings, out int index) { index = default(int); throw null; } + public virtual string ReadContentAsString(System.Xml.XmlDictionaryString[] strings, out int index) { index = default(int); throw null; } + public virtual System.TimeSpan ReadContentAsTimeSpan() { throw null; } + public virtual System.Xml.UniqueId ReadContentAsUniqueId() { throw null; } + public virtual System.DateTime[] ReadDateTimeArray(string localName, string namespaceUri) { throw null; } + public virtual System.DateTime[] ReadDateTimeArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual decimal[] ReadDecimalArray(string localName, string namespaceUri) { throw null; } + public virtual decimal[] ReadDecimalArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual double[] ReadDoubleArray(string localName, string namespaceUri) { throw null; } + public virtual double[] ReadDoubleArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual byte[] ReadElementContentAsBase64() { throw null; } + public virtual byte[] ReadElementContentAsBinHex() { throw null; } + public override bool ReadElementContentAsBoolean() { throw null; } + public override System.DateTime ReadElementContentAsDateTime() { throw null; } + public override decimal ReadElementContentAsDecimal() { throw null; } + public override double ReadElementContentAsDouble() { throw null; } + public override float ReadElementContentAsFloat() { throw null; } + public virtual System.Guid ReadElementContentAsGuid() { throw null; } + public override int ReadElementContentAsInt() { throw null; } + public override long ReadElementContentAsLong() { throw null; } + public override string ReadElementContentAsString() { throw null; } + public virtual System.TimeSpan ReadElementContentAsTimeSpan() { throw null; } + public virtual System.Xml.UniqueId ReadElementContentAsUniqueId() { throw null; } + public virtual void ReadFullStartElement() { } + public virtual void ReadFullStartElement(string name) { } + public virtual void ReadFullStartElement(string localName, string namespaceUri) { } + public virtual void ReadFullStartElement(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public virtual System.Guid[] ReadGuidArray(string localName, string namespaceUri) { throw null; } + public virtual System.Guid[] ReadGuidArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual short[] ReadInt16Array(string localName, string namespaceUri) { throw null; } + public virtual short[] ReadInt16Array(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual int[] ReadInt32Array(string localName, string namespaceUri) { throw null; } + public virtual int[] ReadInt32Array(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual long[] ReadInt64Array(string localName, string namespaceUri) { throw null; } + public virtual long[] ReadInt64Array(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual float[] ReadSingleArray(string localName, string namespaceUri) { throw null; } + public virtual float[] ReadSingleArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual void ReadStartElement(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public override string ReadString() { throw null; } + protected string ReadString(int maxStringContentLength) { throw null; } + public virtual System.TimeSpan[] ReadTimeSpanArray(string localName, string namespaceUri) { throw null; } + public virtual System.TimeSpan[] ReadTimeSpanArray(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { throw null; } + public virtual int ReadValueAsBase64(byte[] buffer, int offset, int count) { throw null; } + public virtual void StartCanonicalization(System.IO.Stream stream, bool includeComments, string[] inclusivePrefixes) { } + public virtual bool TryGetArrayLength(out int count) { count = default(int); throw null; } + public virtual bool TryGetBase64ContentLength(out int length) { length = default(int); throw null; } + public virtual bool TryGetLocalNameAsDictionaryString(out System.Xml.XmlDictionaryString localName) { localName = default(System.Xml.XmlDictionaryString); throw null; } + public virtual bool TryGetNamespaceUriAsDictionaryString(out System.Xml.XmlDictionaryString namespaceUri) { namespaceUri = default(System.Xml.XmlDictionaryString); throw null; } + public virtual bool TryGetValueAsDictionaryString(out System.Xml.XmlDictionaryString value) { value = default(System.Xml.XmlDictionaryString); throw null; } + } + public sealed partial class XmlDictionaryReaderQuotas + { + public XmlDictionaryReaderQuotas() { } + public static System.Xml.XmlDictionaryReaderQuotas Max { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute(16384)] + public int MaxArrayLength { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(4096)] + public int MaxBytesPerRead { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(32)] + public int MaxDepth { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(16384)] + public int MaxNameTableCharCount { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(8192)] + public int MaxStringContentLength { get { throw null; } set { } } + public System.Xml.XmlDictionaryReaderQuotaTypes ModifiedQuotas { get { throw null; } } + public void CopyTo(System.Xml.XmlDictionaryReaderQuotas quotas) { } + } + [System.FlagsAttribute] + public enum XmlDictionaryReaderQuotaTypes + { + MaxArrayLength = 4, + MaxBytesPerRead = 8, + MaxDepth = 1, + MaxNameTableCharCount = 16, + MaxStringContentLength = 2, + } + public partial class XmlDictionaryString + { + public XmlDictionaryString(System.Xml.IXmlDictionary dictionary, string value, int key) { } + public System.Xml.IXmlDictionary Dictionary { get { throw null; } } + public static System.Xml.XmlDictionaryString Empty { get { throw null; } } + public int Key { get { throw null; } } + public string Value { get { throw null; } } + public override string ToString() { throw null; } + } + public abstract partial class XmlDictionaryWriter : System.Xml.XmlWriter + { + protected XmlDictionaryWriter() { } + public virtual bool CanCanonicalize { get { throw null; } } + public static System.Xml.XmlDictionaryWriter CreateBinaryWriter(System.IO.Stream stream) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateBinaryWriter(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateBinaryWriter(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlBinaryWriterSession session) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateBinaryWriter(System.IO.Stream stream, System.Xml.IXmlDictionary dictionary, System.Xml.XmlBinaryWriterSession session, bool ownsStream) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateDictionaryWriter(System.Xml.XmlWriter writer) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateMtomWriter(System.IO.Stream stream, System.Text.Encoding encoding, int maxSizeInBytes, string startInfo) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateMtomWriter(System.IO.Stream stream, System.Text.Encoding encoding, int maxSizeInBytes, string startInfo, string boundary, string startUri, bool writeMessageHeaders, bool ownsStream) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateTextWriter(System.IO.Stream stream) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateTextWriter(System.IO.Stream stream, System.Text.Encoding encoding) { throw null; } + public static System.Xml.XmlDictionaryWriter CreateTextWriter(System.IO.Stream stream, System.Text.Encoding encoding, bool ownsStream) { throw null; } + public virtual void EndCanonicalization() { } + public virtual void StartCanonicalization(System.IO.Stream stream, bool includeComments, string[] inclusivePrefixes) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, bool[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, System.DateTime[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, decimal[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, double[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, System.Guid[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, short[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, int[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, long[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, float[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, string localName, string namespaceUri, System.TimeSpan[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, bool[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, System.DateTime[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, decimal[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, double[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, System.Guid[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, short[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, int[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, long[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, float[] array, int offset, int count) { } + public virtual void WriteArray(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, System.TimeSpan[] array, int offset, int count) { } + public void WriteAttributeString(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, string value) { } + public void WriteAttributeString(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, string value) { } + public override System.Threading.Tasks.Task WriteBase64Async(byte[] buffer, int index, int count) { throw null; } + public void WriteElementString(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, string value) { } + public void WriteElementString(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri, string value) { } + public virtual void WriteNode(System.Xml.XmlDictionaryReader reader, bool defattr) { } + public override void WriteNode(System.Xml.XmlReader reader, bool defattr) { } + public virtual void WriteQualifiedName(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public virtual void WriteStartAttribute(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public void WriteStartAttribute(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public virtual void WriteStartElement(string prefix, System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public void WriteStartElement(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString namespaceUri) { } + public virtual void WriteString(System.Xml.XmlDictionaryString value) { } + protected virtual void WriteTextNode(System.Xml.XmlDictionaryReader reader, bool isAttribute) { } + public virtual void WriteValue(System.Guid value) { } + public virtual void WriteValue(System.TimeSpan value) { } + public virtual void WriteValue(System.Xml.IStreamProvider value) { } + public virtual void WriteValue(System.Xml.UniqueId value) { } + public virtual void WriteValue(System.Xml.XmlDictionaryString value) { } + public virtual System.Threading.Tasks.Task WriteValueAsync(System.Xml.IStreamProvider value) { throw null; } + public virtual void WriteXmlAttribute(string localName, string value) { } + public virtual void WriteXmlAttribute(System.Xml.XmlDictionaryString localName, System.Xml.XmlDictionaryString value) { } + public virtual void WriteXmlnsAttribute(string prefix, string namespaceUri) { } + public virtual void WriteXmlnsAttribute(string prefix, System.Xml.XmlDictionaryString namespaceUri) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Security.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Security.cs new file mode 100644 index 0000000000..3b8184548d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Security.cs @@ -0,0 +1,1103 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Security.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Security.Cryptography +{ + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CryptographicAttributeObject + { + public CryptographicAttributeObject(System.Security.Cryptography.Oid oid) { } + public CryptographicAttributeObject(System.Security.Cryptography.Oid oid, System.Security.Cryptography.AsnEncodedDataCollection values) { } + public System.Security.Cryptography.Oid Oid { get { throw null; } } + public System.Security.Cryptography.AsnEncodedDataCollection Values { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CryptographicAttributeObjectCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + public CryptographicAttributeObjectCollection() { } + public CryptographicAttributeObjectCollection(System.Security.Cryptography.CryptographicAttributeObject attribute) { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObject this[int index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public int Add(System.Security.Cryptography.AsnEncodedData asnEncodedData) { throw null; } + public int Add(System.Security.Cryptography.CryptographicAttributeObject attribute) { throw null; } + public void CopyTo(System.Security.Cryptography.CryptographicAttributeObject[] array, int index) { } + public System.Security.Cryptography.CryptographicAttributeObjectEnumerator GetEnumerator() { throw null; } + public void Remove(System.Security.Cryptography.CryptographicAttributeObject attribute) { } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CryptographicAttributeObjectEnumerator : System.Collections.IEnumerator + { + internal CryptographicAttributeObjectEnumerator() { } + public System.Security.Cryptography.CryptographicAttributeObject Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + public enum DataProtectionScope + { + CurrentUser = 0, + LocalMachine = 1, + } + public abstract partial class DataProtector + { + protected DataProtector(string applicationName, string primaryPurpose, string[] specificPurposes) { } + protected string ApplicationName { get { throw null; } } + protected virtual bool PrependHashedPurposeToPlaintext { get { throw null; } } + protected string PrimaryPurpose { get { throw null; } } + protected System.Collections.Generic.IEnumerable SpecificPurposes { get { throw null; } } + public static System.Security.Cryptography.DataProtector Create(string providerClass, string applicationName, string primaryPurpose, params string[] specificPurposes) { throw null; } + protected virtual byte[] GetHashedPurpose() { throw null; } + public abstract bool IsReprotectRequired(byte[] encryptedData); + public byte[] Protect(byte[] userData) { throw null; } + protected abstract byte[] ProviderProtect(byte[] userData); + protected abstract byte[] ProviderUnprotect(byte[] encryptedData); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining | System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public byte[] Unprotect(byte[] encryptedData) { throw null; } + } + public sealed partial class DpapiDataProtector : System.Security.Cryptography.DataProtector + { + [System.Security.SecuritySafeCriticalAttribute] + [System.Security.Permissions.DataProtectionPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Unrestricted=true)] + public DpapiDataProtector(string appName, string primaryPurpose, params string[] specificPurpose) : base (default(string), default(string), default(string[])) { } + protected override bool PrependHashedPurposeToPlaintext { get { throw null; } } + public System.Security.Cryptography.DataProtectionScope Scope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override bool IsReprotectRequired(byte[] encryptedData) { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + [System.Security.Permissions.DataProtectionPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, ProtectData=true)] + protected override byte[] ProviderProtect(byte[] userData) { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + [System.Security.Permissions.DataProtectionPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, UnprotectData=true)] + protected override byte[] ProviderUnprotect(byte[] encryptedData) { throw null; } + } + public enum MemoryProtectionScope + { + CrossProcess = 1, + SameLogon = 2, + SameProcess = 0, + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public static partial class ProtectedData + { + [System.Security.SecuritySafeCriticalAttribute] + public static byte[] Protect(byte[] userData, byte[] optionalEntropy, System.Security.Cryptography.DataProtectionScope scope) { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + public static byte[] Unprotect(byte[] encryptedData, byte[] optionalEntropy, System.Security.Cryptography.DataProtectionScope scope) { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public static partial class ProtectedMemory + { + [System.Security.SecuritySafeCriticalAttribute] + public static void Protect(byte[] userData, System.Security.Cryptography.MemoryProtectionScope scope) { } + [System.Security.SecuritySafeCriticalAttribute] + public static void Unprotect(byte[] encryptedData, System.Security.Cryptography.MemoryProtectionScope scope) { } + } +} +namespace System.Security.Cryptography.Pkcs +{ + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class AlgorithmIdentifier + { + public AlgorithmIdentifier() { } + public AlgorithmIdentifier(System.Security.Cryptography.Oid oid) { } + public AlgorithmIdentifier(System.Security.Cryptography.Oid oid, int keyLength) { } + public int KeyLength { get { throw null; } set { } } + public System.Security.Cryptography.Oid Oid { get { throw null; } set { } } + public byte[] Parameters { get { throw null; } set { } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CmsRecipient + { + public CmsRecipient(System.Security.Cryptography.Pkcs.SubjectIdentifierType recipientIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public CmsRecipient(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifierType RecipientIdentifierType { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CmsRecipientCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + public CmsRecipientCollection() { } + public CmsRecipientCollection(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { } + public CmsRecipientCollection(System.Security.Cryptography.Pkcs.SubjectIdentifierType recipientIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2Collection certificates) { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Security.Cryptography.Pkcs.CmsRecipient this[int index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public int Add(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { throw null; } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Security.Cryptography.Pkcs.CmsRecipient[] array, int index) { } + public System.Security.Cryptography.Pkcs.CmsRecipientEnumerator GetEnumerator() { throw null; } + public void Remove(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CmsRecipientEnumerator : System.Collections.IEnumerator + { + internal CmsRecipientEnumerator() { } + public System.Security.Cryptography.Pkcs.CmsRecipient Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CmsSigner + { + public CmsSigner() { } + [System.Security.SecuritySafeCriticalAttribute] + public CmsSigner(System.Security.Cryptography.CspParameters parameters) { } + public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } + public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public CmsSigner(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } + public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509IncludeOption IncludeOption { get { throw null; } set { } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifierType SignerIdentifierType { get { throw null; } set { } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class ContentInfo + { + public ContentInfo(byte[] content) { } + public ContentInfo(System.Security.Cryptography.Oid contentType, byte[] content) { } + public byte[] Content { get { throw null; } } + public System.Security.Cryptography.Oid ContentType { get { throw null; } } + [System.Security.SecuritySafeCriticalAttribute] + ~ContentInfo() { } + [System.Security.SecuritySafeCriticalAttribute] + public static System.Security.Cryptography.Oid GetContentType(byte[] encodedMessage) { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class EnvelopedCms + { + public EnvelopedCms() { } + public EnvelopedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + public EnvelopedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo, System.Security.Cryptography.Pkcs.AlgorithmIdentifier encryptionAlgorithm) { } + public EnvelopedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType recipientIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + [System.Security.SecuritySafeCriticalAttribute] + public EnvelopedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType recipientIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo, System.Security.Cryptography.Pkcs.AlgorithmIdentifier encryptionAlgorithm) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } + public System.Security.Cryptography.Pkcs.AlgorithmIdentifier ContentEncryptionAlgorithm { get { throw null; } } + public System.Security.Cryptography.Pkcs.ContentInfo ContentInfo { get { throw null; } } + public System.Security.Cryptography.Pkcs.RecipientInfoCollection RecipientInfos { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnprotectedAttributes { get { throw null; } } + public int Version { get { throw null; } } + [System.Security.SecuritySafeCriticalAttribute] + public void Decode(byte[] encodedMessage) { } + public void Decrypt() { } + public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo) { } + public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } + public void Decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } + [System.Security.SecuritySafeCriticalAttribute] + public byte[] Encode() { throw null; } + public void Encrypt() { } + public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { } + public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipientCollection recipients) { } + } + public enum KeyAgreeKeyChoice + { + EphemeralKey = 1, + StaticKey = 2, + Unknown = 0, + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class KeyAgreeRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo + { + internal KeyAgreeRecipientInfo() { } + public System.DateTime Date { get { throw null; } } + public override byte[] EncryptedKey { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public override System.Security.Cryptography.Pkcs.AlgorithmIdentifier KeyEncryptionAlgorithm { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifierOrKey OriginatorIdentifierOrKey { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObject OtherKeyAttribute { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public override System.Security.Cryptography.Pkcs.SubjectIdentifier RecipientIdentifier { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public override int Version { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class KeyTransRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo + { + internal KeyTransRecipientInfo() { } + public override byte[] EncryptedKey { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public override System.Security.Cryptography.Pkcs.AlgorithmIdentifier KeyEncryptionAlgorithm { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public override System.Security.Cryptography.Pkcs.SubjectIdentifier RecipientIdentifier { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public override int Version { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class Pkcs9AttributeObject : System.Security.Cryptography.AsnEncodedData + { + public Pkcs9AttributeObject() { } + public Pkcs9AttributeObject(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + public Pkcs9AttributeObject(System.Security.Cryptography.Oid oid, byte[] encodedData) { } + public Pkcs9AttributeObject(string oid, byte[] encodedData) { } + public new System.Security.Cryptography.Oid Oid { get { throw null; } } + public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class Pkcs9ContentType : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject + { + public Pkcs9ContentType() { } + public System.Security.Cryptography.Oid ContentType { get { throw null; } } + public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class Pkcs9DocumentDescription : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject + { + public Pkcs9DocumentDescription() { } + public Pkcs9DocumentDescription(byte[] encodedDocumentDescription) { } + public Pkcs9DocumentDescription(string documentDescription) { } + public string DocumentDescription { get { throw null; } } + public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class Pkcs9DocumentName : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject + { + public Pkcs9DocumentName() { } + public Pkcs9DocumentName(byte[] encodedDocumentName) { } + public Pkcs9DocumentName(string documentName) { } + public string DocumentName { get { throw null; } } + public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class Pkcs9MessageDigest : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject + { + public Pkcs9MessageDigest() { } + public byte[] MessageDigest { get { throw null; } } + public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class Pkcs9SigningTime : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject + { + public Pkcs9SigningTime() { } + public Pkcs9SigningTime(byte[] encodedSigningTime) { } + public Pkcs9SigningTime(System.DateTime signingTime) { } + public System.DateTime SigningTime { get { throw null; } } + public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class PublicKeyInfo + { + internal PublicKeyInfo() { } + public System.Security.Cryptography.Pkcs.AlgorithmIdentifier Algorithm { get { throw null; } } + public byte[] KeyValue { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public abstract partial class RecipientInfo + { + internal RecipientInfo() { } + public abstract byte[] EncryptedKey { get; } + public abstract System.Security.Cryptography.Pkcs.AlgorithmIdentifier KeyEncryptionAlgorithm { get; } + public abstract System.Security.Cryptography.Pkcs.SubjectIdentifier RecipientIdentifier { get; } + public System.Security.Cryptography.Pkcs.RecipientInfoType Type { get { throw null; } } + public abstract int Version { get; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class RecipientInfoCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal RecipientInfoCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Security.Cryptography.Pkcs.RecipientInfo this[int index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Security.Cryptography.Pkcs.RecipientInfo[] array, int index) { } + public System.Security.Cryptography.Pkcs.RecipientInfoEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class RecipientInfoEnumerator : System.Collections.IEnumerator + { + internal RecipientInfoEnumerator() { } + public System.Security.Cryptography.Pkcs.RecipientInfo Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + public enum RecipientInfoType + { + KeyAgreement = 2, + KeyTransport = 1, + Unknown = 0, + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class SignedCms + { + public SignedCms() { } + public SignedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + public SignedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo, bool detached) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + [System.Security.SecuritySafeCriticalAttribute] + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo, bool detached) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Security.Cryptography.Pkcs.ContentInfo ContentInfo { get { throw null; } } + public bool Detached { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfoCollection SignerInfos { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public int Version { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + [System.Security.SecuritySafeCriticalAttribute] + public void CheckHash() { } + public void CheckSignature(bool verifySignatureOnly) { } + [System.Security.SecuritySafeCriticalAttribute] + public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } + public void ComputeSignature() { } + public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } + [System.Security.SecuritySafeCriticalAttribute] + public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer, bool silent) { } + [System.Security.SecuritySafeCriticalAttribute] + public void Decode(byte[] encodedMessage) { } + [System.Security.SecuritySafeCriticalAttribute] + public byte[] Encode() { throw null; } + [System.Security.SecuritySafeCriticalAttribute] + public void RemoveSignature(int index) { } + [System.Security.SecuritySafeCriticalAttribute] + public void RemoveSignature(System.Security.Cryptography.Pkcs.SignerInfo signerInfo) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class SignerInfo + { + internal SignerInfo() { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfoCollection CounterSignerInfos { get { throw null; } } + public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifier SignerIdentifier { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public int Version { get { throw null; } } + [System.Security.SecuritySafeCriticalAttribute] + public void CheckHash() { } + public void CheckSignature(bool verifySignatureOnly) { } + public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } + public void ComputeCounterSignature() { } + public void ComputeCounterSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } + [System.Security.SecuritySafeCriticalAttribute] + public void RemoveCounterSignature(int index) { } + [System.Security.SecuritySafeCriticalAttribute] + public void RemoveCounterSignature(System.Security.Cryptography.Pkcs.SignerInfo counterSignerInfo) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class SignerInfoCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal SignerInfoCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfo this[int index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Security.Cryptography.Pkcs.SignerInfo[] array, int index) { } + public System.Security.Cryptography.Pkcs.SignerInfoEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class SignerInfoEnumerator : System.Collections.IEnumerator + { + internal SignerInfoEnumerator() { } + public System.Security.Cryptography.Pkcs.SignerInfo Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class SubjectIdentifier + { + internal SubjectIdentifier() { } + public System.Security.Cryptography.Pkcs.SubjectIdentifierType Type { get { throw null; } } + public object Value { get { throw null; } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class SubjectIdentifierOrKey + { + internal SubjectIdentifierOrKey() { } + public System.Security.Cryptography.Pkcs.SubjectIdentifierOrKeyType Type { get { throw null; } } + public object Value { get { throw null; } } + } + public enum SubjectIdentifierOrKeyType + { + IssuerAndSerialNumber = 1, + PublicKeyInfo = 3, + SubjectKeyIdentifier = 2, + Unknown = 0, + } + public enum SubjectIdentifierType + { + IssuerAndSerialNumber = 1, + NoSignature = 3, + SubjectKeyIdentifier = 2, + Unknown = 0, + } +} +namespace System.Security.Cryptography.X509Certificates +{ + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public static partial class X509Certificate2UI + { + [System.Security.SecuritySafeCriticalAttribute] + public static void DisplayCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + [System.Security.SecurityCriticalAttribute] + public static void DisplayCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.IntPtr hwndParent) { } + public static System.Security.Cryptography.X509Certificates.X509Certificate2Collection SelectFromCollection(System.Security.Cryptography.X509Certificates.X509Certificate2Collection certificates, string title, string message, System.Security.Cryptography.X509Certificates.X509SelectionFlag selectionFlag) { throw null; } + [System.Security.SecurityCriticalAttribute] + public static System.Security.Cryptography.X509Certificates.X509Certificate2Collection SelectFromCollection(System.Security.Cryptography.X509Certificates.X509Certificate2Collection certificates, string title, string message, System.Security.Cryptography.X509Certificates.X509SelectionFlag selectionFlag, System.IntPtr hwndParent) { throw null; } + } + public enum X509SelectionFlag + { + MultiSelection = 1, + SingleSelection = 0, + } +} +namespace System.Security.Cryptography.Xml +{ + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CipherData + { + public CipherData() { } + public CipherData(byte[] cipherValue) { } + public CipherData(System.Security.Cryptography.Xml.CipherReference cipherReference) { } + public System.Security.Cryptography.Xml.CipherReference CipherReference { get { throw null; } set { } } + public byte[] CipherValue { get { throw null; } set { } } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class CipherReference : System.Security.Cryptography.Xml.EncryptedReference + { + public CipherReference() { } + public CipherReference(string uri) { } + public CipherReference(string uri, System.Security.Cryptography.Xml.TransformChain transformChain) { } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class DataObject + { + public DataObject() { } + public DataObject(string id, string mimeType, string encoding, System.Xml.XmlElement data) { } + public System.Xml.XmlNodeList Data { get { throw null; } set { } } + public string Encoding { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public string MimeType { get { throw null; } set { } } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class DataReference : System.Security.Cryptography.Xml.EncryptedReference + { + public DataReference() { } + public DataReference(string uri) { } + public DataReference(string uri, System.Security.Cryptography.Xml.TransformChain transformChain) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class DSAKeyValue : System.Security.Cryptography.Xml.KeyInfoClause + { + public DSAKeyValue() { } + public DSAKeyValue(System.Security.Cryptography.DSA key) { } + public System.Security.Cryptography.DSA Key { get { throw null; } set { } } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class EncryptedData : System.Security.Cryptography.Xml.EncryptedType + { + public EncryptedData() { } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class EncryptedKey : System.Security.Cryptography.Xml.EncryptedType + { + public EncryptedKey() { } + public string CarriedKeyName { get { throw null; } set { } } + public string Recipient { get { throw null; } set { } } + public System.Security.Cryptography.Xml.ReferenceList ReferenceList { get { throw null; } } + public void AddReference(System.Security.Cryptography.Xml.DataReference dataReference) { } + public void AddReference(System.Security.Cryptography.Xml.KeyReference keyReference) { } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public abstract partial class EncryptedReference + { + protected EncryptedReference() { } + protected EncryptedReference(string uri) { } + protected EncryptedReference(string uri, System.Security.Cryptography.Xml.TransformChain transformChain) { } + protected internal bool CacheValid { get { throw null; } } + protected string ReferenceType { get { throw null; } set { } } + public System.Security.Cryptography.Xml.TransformChain TransformChain { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + public void AddTransform(System.Security.Cryptography.Xml.Transform transform) { } + public virtual System.Xml.XmlElement GetXml() { throw null; } + public virtual void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public abstract partial class EncryptedType + { + protected EncryptedType() { } + public virtual System.Security.Cryptography.Xml.CipherData CipherData { get { throw null; } set { } } + public virtual string Encoding { get { throw null; } set { } } + public virtual System.Security.Cryptography.Xml.EncryptionMethod EncryptionMethod { get { throw null; } set { } } + public virtual System.Security.Cryptography.Xml.EncryptionPropertyCollection EncryptionProperties { get { throw null; } } + public virtual string Id { get { throw null; } set { } } + public System.Security.Cryptography.Xml.KeyInfo KeyInfo { get { throw null; } set { } } + public virtual string MimeType { get { throw null; } set { } } + public virtual string Type { get { throw null; } set { } } + public void AddProperty(System.Security.Cryptography.Xml.EncryptionProperty ep) { } + public abstract System.Xml.XmlElement GetXml(); + public abstract void LoadXml(System.Xml.XmlElement value); + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class EncryptedXml + { + public const string XmlEncAES128KeyWrapUrl = "http://www.w3.org/2001/04/xmlenc#kw-aes128"; + public const string XmlEncAES128Url = "http://www.w3.org/2001/04/xmlenc#aes128-cbc"; + public const string XmlEncAES192KeyWrapUrl = "http://www.w3.org/2001/04/xmlenc#kw-aes192"; + public const string XmlEncAES192Url = "http://www.w3.org/2001/04/xmlenc#aes192-cbc"; + public const string XmlEncAES256KeyWrapUrl = "http://www.w3.org/2001/04/xmlenc#kw-aes256"; + public const string XmlEncAES256Url = "http://www.w3.org/2001/04/xmlenc#aes256-cbc"; + public const string XmlEncDESUrl = "http://www.w3.org/2001/04/xmlenc#des-cbc"; + public const string XmlEncElementContentUrl = "http://www.w3.org/2001/04/xmlenc#Content"; + public const string XmlEncElementUrl = "http://www.w3.org/2001/04/xmlenc#Element"; + public const string XmlEncEncryptedKeyUrl = "http://www.w3.org/2001/04/xmlenc#EncryptedKey"; + public const string XmlEncNamespaceUrl = "http://www.w3.org/2001/04/xmlenc#"; + public const string XmlEncRSA15Url = "http://www.w3.org/2001/04/xmlenc#rsa-1_5"; + public const string XmlEncRSAOAEPUrl = "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"; + public const string XmlEncSHA256Url = "http://www.w3.org/2001/04/xmlenc#sha256"; + public const string XmlEncSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512"; + public const string XmlEncTripleDESKeyWrapUrl = "http://www.w3.org/2001/04/xmlenc#kw-tripledes"; + public const string XmlEncTripleDESUrl = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"; + public EncryptedXml() { } + public EncryptedXml(System.Xml.XmlDocument document) { } + public EncryptedXml(System.Xml.XmlDocument document, System.Security.Policy.Evidence evidence) { } + public System.Security.Policy.Evidence DocumentEvidence { get { throw null; } set { } } + public System.Text.Encoding Encoding { get { throw null; } set { } } + public System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } } + public System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } + public string Recipient { get { throw null; } set { } } + public System.Xml.XmlResolver Resolver { get { throw null; } set { } } + public int XmlDSigSearchDepth { get { throw null; } set { } } + public void AddKeyNameMapping(string keyName, object keyObject) { } + public void ClearKeyNameMappings() { } + public byte[] DecryptData(System.Security.Cryptography.Xml.EncryptedData encryptedData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } + public void DecryptDocument() { } + public virtual byte[] DecryptEncryptedKey(System.Security.Cryptography.Xml.EncryptedKey encryptedKey) { throw null; } + public static byte[] DecryptKey(byte[] keyData, System.Security.Cryptography.RSA rsa, bool useOAEP) { throw null; } + public static byte[] DecryptKey(byte[] keyData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } + public System.Security.Cryptography.Xml.EncryptedData Encrypt(System.Xml.XmlElement inputElement, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { throw null; } + public System.Security.Cryptography.Xml.EncryptedData Encrypt(System.Xml.XmlElement inputElement, string keyName) { throw null; } + public byte[] EncryptData(byte[] plaintext, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } + public byte[] EncryptData(System.Xml.XmlElement inputElement, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm, bool content) { throw null; } + public static byte[] EncryptKey(byte[] keyData, System.Security.Cryptography.RSA rsa, bool useOAEP) { throw null; } + public static byte[] EncryptKey(byte[] keyData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm) { throw null; } + public virtual byte[] GetDecryptionIV(System.Security.Cryptography.Xml.EncryptedData encryptedData, string symmetricAlgorithmUri) { throw null; } + public virtual System.Security.Cryptography.SymmetricAlgorithm GetDecryptionKey(System.Security.Cryptography.Xml.EncryptedData encryptedData, string symmetricAlgorithmUri) { throw null; } + public virtual System.Xml.XmlElement GetIdElement(System.Xml.XmlDocument document, string idValue) { throw null; } + public void ReplaceData(System.Xml.XmlElement inputElement, byte[] decryptedData) { } + public static void ReplaceElement(System.Xml.XmlElement inputElement, System.Security.Cryptography.Xml.EncryptedData encryptedData, bool content) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class EncryptionMethod + { + public EncryptionMethod() { } + public EncryptionMethod(string algorithm) { } + public string KeyAlgorithm { get { throw null; } set { } } + public int KeySize { get { throw null; } set { } } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class EncryptionProperty + { + public EncryptionProperty() { } + public EncryptionProperty(System.Xml.XmlElement elementProperty) { } + public string Id { get { throw null; } } + public System.Xml.XmlElement PropertyElement { get { throw null; } set { } } + public string Target { get { throw null; } } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class EncryptionPropertyCollection : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList + { + public EncryptionPropertyCollection() { } + public int Count { get { throw null; } } + public bool IsFixedSize { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + [System.Runtime.CompilerServices.IndexerName("ItemOf")] + public System.Security.Cryptography.Xml.EncryptionProperty this[int index] { get { throw null; } set { } } + public object SyncRoot { get { throw null; } } + object System.Collections.IList.this[int index] { get { throw null; } set { } } + public int Add(System.Security.Cryptography.Xml.EncryptionProperty value) { throw null; } + public void Clear() { } + public bool Contains(System.Security.Cryptography.Xml.EncryptionProperty value) { throw null; } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Security.Cryptography.Xml.EncryptionProperty[] array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public int IndexOf(System.Security.Cryptography.Xml.EncryptionProperty value) { throw null; } + public void Insert(int index, System.Security.Cryptography.Xml.EncryptionProperty value) { } + public System.Security.Cryptography.Xml.EncryptionProperty Item(int index) { throw null; } + public void Remove(System.Security.Cryptography.Xml.EncryptionProperty value) { } + public void RemoveAt(int index) { } + int System.Collections.IList.Add(object value) { throw null; } + bool System.Collections.IList.Contains(object value) { throw null; } + int System.Collections.IList.IndexOf(object value) { throw null; } + void System.Collections.IList.Insert(int index, object value) { } + void System.Collections.IList.Remove(object value) { } + } + public partial interface IRelDecryptor + { + System.IO.Stream Decrypt(System.Security.Cryptography.Xml.EncryptionMethod encryptionMethod, System.Security.Cryptography.Xml.KeyInfo keyInfo, System.IO.Stream toDecrypt); + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class KeyInfo : System.Collections.IEnumerable + { + public KeyInfo() { } + public int Count { get { throw null; } } + public string Id { get { throw null; } set { } } + public void AddClause(System.Security.Cryptography.Xml.KeyInfoClause clause) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public System.Collections.IEnumerator GetEnumerator(System.Type requestedObjectType) { throw null; } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public abstract partial class KeyInfoClause + { + protected KeyInfoClause() { } + public abstract System.Xml.XmlElement GetXml(); + public abstract void LoadXml(System.Xml.XmlElement element); + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class KeyInfoEncryptedKey : System.Security.Cryptography.Xml.KeyInfoClause + { + public KeyInfoEncryptedKey() { } + public KeyInfoEncryptedKey(System.Security.Cryptography.Xml.EncryptedKey encryptedKey) { } + public System.Security.Cryptography.Xml.EncryptedKey EncryptedKey { get { throw null; } set { } } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class KeyInfoName : System.Security.Cryptography.Xml.KeyInfoClause + { + public KeyInfoName() { } + public KeyInfoName(string keyName) { } + public string Value { get { throw null; } set { } } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class KeyInfoNode : System.Security.Cryptography.Xml.KeyInfoClause + { + public KeyInfoNode() { } + public KeyInfoNode(System.Xml.XmlElement node) { } + public System.Xml.XmlElement Value { get { throw null; } set { } } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class KeyInfoRetrievalMethod : System.Security.Cryptography.Xml.KeyInfoClause + { + public KeyInfoRetrievalMethod() { } + public KeyInfoRetrievalMethod(string strUri) { } + public KeyInfoRetrievalMethod(string strUri, string typeName) { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public string Type { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class KeyInfoX509Data : System.Security.Cryptography.Xml.KeyInfoClause + { + public KeyInfoX509Data() { } + public KeyInfoX509Data(byte[] rgbCert) { } + public KeyInfoX509Data(System.Security.Cryptography.X509Certificates.X509Certificate cert) { } + [System.Security.SecuritySafeCriticalAttribute] + public KeyInfoX509Data(System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Security.Cryptography.X509Certificates.X509IncludeOption includeOption) { } + public System.Collections.ArrayList Certificates { get { throw null; } } + public byte[] CRL { get { throw null; } set { } } + public System.Collections.ArrayList IssuerSerials { get { throw null; } } + public System.Collections.ArrayList SubjectKeyIds { get { throw null; } } + public System.Collections.ArrayList SubjectNames { get { throw null; } } + public void AddCertificate(System.Security.Cryptography.X509Certificates.X509Certificate certificate) { } + public void AddIssuerSerial(string issuerName, string serialNumber) { } + public void AddSubjectKeyId(byte[] subjectKeyId) { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void AddSubjectKeyId(string subjectKeyId) { } + public void AddSubjectName(string subjectName) { } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement element) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class KeyReference : System.Security.Cryptography.Xml.EncryptedReference + { + public KeyReference() { } + public KeyReference(string uri) { } + public KeyReference(string uri, System.Security.Cryptography.Xml.TransformChain transformChain) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class Reference + { + public Reference() { } + public Reference(System.IO.Stream stream) { } + public Reference(string uri) { } + public string DigestMethod { get { throw null; } set { } } + public byte[] DigestValue { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public System.Security.Cryptography.Xml.TransformChain TransformChain { get { throw null; } [System.Runtime.InteropServices.ComVisibleAttribute(false)]set { } } + public string Type { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + public void AddTransform(System.Security.Cryptography.Xml.Transform transform) { } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public sealed partial class ReferenceList : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList + { + public ReferenceList() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + [System.Runtime.CompilerServices.IndexerName("ItemOf")] + public System.Security.Cryptography.Xml.EncryptedReference this[int index] { get { throw null; } set { } } + public object SyncRoot { get { throw null; } } + bool System.Collections.IList.IsFixedSize { get { throw null; } } + bool System.Collections.IList.IsReadOnly { get { throw null; } } + object System.Collections.IList.this[int index] { get { throw null; } set { } } + public int Add(object value) { throw null; } + public void Clear() { } + public bool Contains(object value) { throw null; } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public int IndexOf(object value) { throw null; } + public void Insert(int index, object value) { } + public System.Security.Cryptography.Xml.EncryptedReference Item(int index) { throw null; } + public void Remove(object value) { } + public void RemoveAt(int index) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class RSAKeyValue : System.Security.Cryptography.Xml.KeyInfoClause + { + public RSAKeyValue() { } + public RSAKeyValue(System.Security.Cryptography.RSA key) { } + public System.Security.Cryptography.RSA Key { get { throw null; } set { } } + public override System.Xml.XmlElement GetXml() { throw null; } + public override void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class Signature + { + public Signature() { } + public string Id { get { throw null; } set { } } + public System.Security.Cryptography.Xml.KeyInfo KeyInfo { get { throw null; } set { } } + public System.Collections.IList ObjectList { get { throw null; } set { } } + public byte[] SignatureValue { get { throw null; } set { } } + public System.Security.Cryptography.Xml.SignedInfo SignedInfo { get { throw null; } set { } } + public void AddObject(System.Security.Cryptography.Xml.DataObject dataObject) { } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class SignedInfo : System.Collections.ICollection, System.Collections.IEnumerable + { + public SignedInfo() { } + public string CanonicalizationMethod { get { throw null; } set { } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Security.Cryptography.Xml.Transform CanonicalizationMethodObject { get { throw null; } } + public int Count { get { throw null; } } + public string Id { get { throw null; } set { } } + public bool IsReadOnly { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Collections.ArrayList References { get { throw null; } } + public string SignatureLength { get { throw null; } set { } } + public string SignatureMethod { get { throw null; } set { } } + public object SyncRoot { get { throw null; } } + public void AddReference(System.Security.Cryptography.Xml.Reference reference) { } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class SignedXml + { + protected System.Security.Cryptography.Xml.Signature m_signature; + protected string m_strSigningKeyName; + public const string XmlDecryptionTransformUrl = "http://www.w3.org/2002/07/decrypt#XML"; + public const string XmlDsigBase64TransformUrl = "http://www.w3.org/2000/09/xmldsig#base64"; + public const string XmlDsigC14NTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + public const string XmlDsigC14NWithCommentsTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; + public const string XmlDsigCanonicalizationUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + public const string XmlDsigCanonicalizationWithCommentsUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; + public const string XmlDsigDSAUrl = "http://www.w3.org/2000/09/xmldsig#dsa-sha1"; + public const string XmlDsigEnvelopedSignatureTransformUrl = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"; + public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#"; + public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; + public const string XmlDsigHMACSHA1Url = "http://www.w3.org/2000/09/xmldsig#hmac-sha1"; + public const string XmlDsigMinimalCanonicalizationUrl = "http://www.w3.org/2000/09/xmldsig#minimal"; + public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#"; + public const string XmlDsigRSASHA1Url = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; + public const string XmlDsigRSASHA256Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"; + public const string XmlDsigRSASHA384Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"; + public const string XmlDsigRSASHA512Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"; + public const string XmlDsigSHA1Url = "http://www.w3.org/2000/09/xmldsig#sha1"; + public const string XmlDsigSHA256Url = "http://www.w3.org/2001/04/xmlenc#sha256"; + public const string XmlDsigSHA384Url = "http://www.w3.org/2001/04/xmldsig-more#sha384"; + public const string XmlDsigSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512"; + public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116"; + public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116"; + public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform"; + public SignedXml() { } + public SignedXml(System.Xml.XmlDocument document) { } + public SignedXml(System.Xml.XmlElement elem) { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Security.Cryptography.Xml.EncryptedXml EncryptedXml { get { throw null; } set { } } + public System.Security.Cryptography.Xml.KeyInfo KeyInfo { get { throw null; } set { } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Xml.XmlResolver Resolver { set { } } + public System.Collections.ObjectModel.Collection SafeCanonicalizationMethods { get { throw null; } } + public System.Security.Cryptography.Xml.Signature Signature { get { throw null; } } + public System.Func SignatureFormatValidator { get { throw null; } set { } } + public string SignatureLength { get { throw null; } } + public string SignatureMethod { get { throw null; } } + public byte[] SignatureValue { get { throw null; } } + public System.Security.Cryptography.Xml.SignedInfo SignedInfo { get { throw null; } } + public System.Security.Cryptography.AsymmetricAlgorithm SigningKey { get { throw null; } set { } } + public string SigningKeyName { get { throw null; } set { } } + public void AddObject(System.Security.Cryptography.Xml.DataObject dataObject) { } + public void AddReference(System.Security.Cryptography.Xml.Reference reference) { } + public bool CheckSignature() { throw null; } + public bool CheckSignature(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; } + public bool CheckSignature(System.Security.Cryptography.KeyedHashAlgorithm macAlg) { throw null; } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.Security.SecuritySafeCriticalAttribute] + public bool CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, bool verifySignatureOnly) { throw null; } + public bool CheckSignatureReturningKey(out System.Security.Cryptography.AsymmetricAlgorithm signingKey) { signingKey = default(System.Security.Cryptography.AsymmetricAlgorithm); throw null; } + public void ComputeSignature() { } + public void ComputeSignature(System.Security.Cryptography.KeyedHashAlgorithm macAlg) { } + public virtual System.Xml.XmlElement GetIdElement(System.Xml.XmlDocument document, string idValue) { throw null; } + protected virtual System.Security.Cryptography.AsymmetricAlgorithm GetPublicKey() { throw null; } + public System.Xml.XmlElement GetXml() { throw null; } + public void LoadXml(System.Xml.XmlElement value) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public abstract partial class Transform + { + protected Transform() { } + public string Algorithm { get { throw null; } set { } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Xml.XmlElement Context { get { throw null; } set { } } + public abstract System.Type[] InputTypes { get; } + public abstract System.Type[] OutputTypes { get; } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Collections.Hashtable PropagatedNamespaces { get { throw null; } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Xml.XmlResolver Resolver { set { } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public virtual byte[] GetDigestedOutput(System.Security.Cryptography.HashAlgorithm hash) { throw null; } + protected abstract System.Xml.XmlNodeList GetInnerXml(); + public abstract object GetOutput(); + public abstract object GetOutput(System.Type type); + public System.Xml.XmlElement GetXml() { throw null; } + public abstract void LoadInnerXml(System.Xml.XmlNodeList nodeList); + public abstract void LoadInput(object obj); + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class TransformChain + { + public TransformChain() { } + public int Count { get { throw null; } } + public System.Security.Cryptography.Xml.Transform this[int index] { get { throw null; } } + public void Add(System.Security.Cryptography.Xml.Transform transform) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct X509IssuerSerial + { + public string IssuerName { get { throw null; } set { } } + public string SerialNumber { get { throw null; } set { } } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDecryptionTransform : System.Security.Cryptography.Xml.Transform + { + public XmlDecryptionTransform() { } + public System.Security.Cryptography.Xml.EncryptedXml EncryptedXml { get { throw null; } set { } } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + public void AddExceptUri(string uri) { } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + protected virtual bool IsTargetElement(System.Xml.XmlElement inputElement, string idValue) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigBase64Transform : System.Security.Cryptography.Xml.Transform + { + public XmlDsigBase64Transform() { } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigC14NTransform : System.Security.Cryptography.Xml.Transform + { + public XmlDsigC14NTransform() { } + public XmlDsigC14NTransform(bool includeComments) { } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public override byte[] GetDigestedOutput(System.Security.Cryptography.HashAlgorithm hash) { throw null; } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigC14NWithCommentsTransform : System.Security.Cryptography.Xml.XmlDsigC14NTransform + { + public XmlDsigC14NWithCommentsTransform() { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigEnvelopedSignatureTransform : System.Security.Cryptography.Xml.Transform + { + public XmlDsigEnvelopedSignatureTransform() { } + public XmlDsigEnvelopedSignatureTransform(bool includeComments) { } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigExcC14NTransform : System.Security.Cryptography.Xml.Transform + { + public XmlDsigExcC14NTransform() { } + public XmlDsigExcC14NTransform(bool includeComments) { } + public XmlDsigExcC14NTransform(bool includeComments, string inclusiveNamespacesPrefixList) { } + public XmlDsigExcC14NTransform(string inclusiveNamespacesPrefixList) { } + public string InclusiveNamespacesPrefixList { get { throw null; } set { } } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + public override byte[] GetDigestedOutput(System.Security.Cryptography.HashAlgorithm hash) { throw null; } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigExcC14NWithCommentsTransform : System.Security.Cryptography.Xml.XmlDsigExcC14NTransform + { + public XmlDsigExcC14NWithCommentsTransform() { } + public XmlDsigExcC14NWithCommentsTransform(string inclusiveNamespacesPrefixList) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigXPathTransform : System.Security.Cryptography.Xml.Transform + { + public XmlDsigXPathTransform() { } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlDsigXsltTransform : System.Security.Cryptography.Xml.Transform + { + public XmlDsigXsltTransform() { } + public XmlDsigXsltTransform(bool includeComments) { } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + public partial class XmlLicenseTransform : System.Security.Cryptography.Xml.Transform + { + public XmlLicenseTransform() { } + public System.Security.Cryptography.Xml.IRelDecryptor Decryptor { get { throw null; } set { } } + public override System.Type[] InputTypes { get { throw null; } } + public override System.Type[] OutputTypes { get { throw null; } } + protected override System.Xml.XmlNodeList GetInnerXml() { throw null; } + public override object GetOutput() { throw null; } + public override object GetOutput(System.Type type) { throw null; } + public override void LoadInnerXml(System.Xml.XmlNodeList nodeList) { } + public override void LoadInput(object obj) { } + } +} +namespace System.Security.Permissions +{ + [System.SerializableAttribute] + public sealed partial class DataProtectionPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public DataProtectionPermission(System.Security.Permissions.DataProtectionPermissionFlags flag) { } + public DataProtectionPermission(System.Security.Permissions.PermissionState state) { } + public System.Security.Permissions.DataProtectionPermissionFlags Flags { get { throw null; } set { } } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement securityElement) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(109), AllowMultiple=true, Inherited=false)] + [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, MayLeakOnAbort=true)] + [System.SerializableAttribute] + public sealed partial class DataProtectionPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public DataProtectionPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public System.Security.Permissions.DataProtectionPermissionFlags Flags { get { throw null; } set { } } + public bool ProtectData { get { throw null; } set { } } + public bool ProtectMemory { get { throw null; } set { } } + public bool UnprotectData { get { throw null; } set { } } + public bool UnprotectMemory { get { throw null; } set { } } + public override System.Security.IPermission CreatePermission() { throw null; } + } + [System.FlagsAttribute] + [System.SerializableAttribute] + public enum DataProtectionPermissionFlags + { + AllFlags = 15, + NoFlags = 0, + ProtectData = 1, + ProtectMemory = 4, + UnprotectData = 2, + UnprotectMemory = 8, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Activation.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Activation.cs new file mode 100644 index 0000000000..575a2ae502 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Activation.cs @@ -0,0 +1,111 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Activation.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Activation.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Activation.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +namespace System.ServiceModel +{ + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public static partial class ServiceHostingEnvironment + { + public static bool AspNetCompatibilityEnabled { get { throw null; } } + public static bool MultipleSiteBindingsEnabled { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static void EnsureInitialized() { } + public static void EnsureServiceAvailable(string virtualPath) { } + } +} +namespace System.ServiceModel.Activation +{ + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public abstract partial class HostedTransportConfiguration + { + protected HostedTransportConfiguration() { } + public abstract System.Uri[] GetBaseAddresses(string virtualPath); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4))] + public sealed partial class ServiceActivationBuildProviderAttribute : System.Attribute + { + public ServiceActivationBuildProviderAttribute() { } + } + [System.Security.SecurityCriticalAttribute((System.Security.SecurityCriticalScope)(1))] +#if SERVICEMODEL_DEP + [System.ServiceModel.Activation.ServiceActivationBuildProviderAttribute] +#endif +#if WEB_DEP + [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(1))] + public sealed partial class ServiceBuildProvider : System.Web.Compilation.BuildProvider +#else + public sealed partial class ServiceBuildProvider +#endif + { + public ServiceBuildProvider() { } +#if WEB_DEP + public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } + public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } + public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } + protected override System.CodeDom.CodeCompileUnit GetCodeCompileUnit(out System.Collections.IDictionary linePragmasTable) { linePragmasTable = default(System.Collections.IDictionary); throw null; } + public override string GetCustomString(System.CodeDom.Compiler.CompilerResults results) { throw null; } + public override System.Web.Compilation.BuildProviderResultFlags GetResultFlags(System.CodeDom.Compiler.CompilerResults results) { throw null; } +#endif + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#if SERVICEMODEL_DEP + public partial class ServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactoryBase +#else + public partial class ServiceHostFactory +#endif + { + public ServiceHostFactory() { } +#if SERVICEMODEL_DEP + public override System.ServiceModel.ServiceHostBase CreateServiceHost(string constructorString, System.Uri[] baseAddresses) { throw null; } + protected virtual System.ServiceModel.ServiceHost CreateServiceHost(System.Type serviceType, System.Uri[] baseAddresses) { throw null; } +#endif + } +#if SERVICEMODEL_DEP + public partial class ServiceRoute : System.Web.Routing.Route +#else + public partial class ServiceRoute +#endif + { +#if SERVICEMODEL_DEP + public ServiceRoute(string routePrefix, System.ServiceModel.Activation.ServiceHostFactoryBase serviceHostFactory, System.Type serviceType) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } +#endif + } +} +namespace System.ServiceModel.Activities.Activation +{ +#if WORKFLOW_DEP + public partial class WorkflowServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactoryBase +#else + public partial class WorkflowServiceHostFactory +#endif + { + public WorkflowServiceHostFactory() { } +#if WORKFLOW_DEP + public override System.ServiceModel.ServiceHostBase CreateServiceHost(string constructorString, System.Uri[] baseAddresses) { throw null; } + protected virtual System.ServiceModel.Activities.WorkflowServiceHost CreateWorkflowServiceHost(System.Activities.Activity activity, System.Uri[] baseAddresses) { throw null; } + protected virtual System.ServiceModel.Activities.WorkflowServiceHost CreateWorkflowServiceHost(System.ServiceModel.Activities.WorkflowService service, System.Uri[] baseAddresses) { throw null; } +#endif + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Discovery.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Discovery.cs new file mode 100644 index 0000000000..a6ec70a876 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Discovery.cs @@ -0,0 +1,795 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Discovery.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Discovery.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Discovery.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +namespace System.ServiceModel.Discovery +{ + public sealed partial class AnnouncementClient : System.IDisposable, System.ServiceModel.ICommunicationObject + { + public AnnouncementClient() { } + public AnnouncementClient(System.ServiceModel.Discovery.AnnouncementEndpoint announcementEndpoint) { } + public AnnouncementClient(string endpointConfigurationName) { } + public System.ServiceModel.ChannelFactory ChannelFactory { get { throw null; } } + public System.ServiceModel.Description.ClientCredentials ClientCredentials { get { throw null; } } + public System.ServiceModel.Description.ServiceEndpoint Endpoint { get { throw null; } } + public System.ServiceModel.IClientChannel InnerChannel { get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryMessageSequenceGenerator MessageSequenceGenerator { get { throw null; } set { } } + System.ServiceModel.CommunicationState System.ServiceModel.ICommunicationObject.State { get { throw null; } } + public event System.EventHandler AnnounceOfflineCompleted { add { } remove { } } + public event System.EventHandler AnnounceOnlineCompleted { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Closed { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Closing { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Faulted { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Opened { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Opening { add { } remove { } } + public void AnnounceOffline(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) { } + public void AnnounceOfflineAsync(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) { } + public void AnnounceOfflineAsync(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata, object userState) { } + public System.Threading.Tasks.Task AnnounceOfflineTaskAsync(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) { throw null; } + public void AnnounceOnline(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) { } + public void AnnounceOnlineAsync(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) { } + public void AnnounceOnlineAsync(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata, object userState) { } + public System.Threading.Tasks.Task AnnounceOnlineTaskAsync(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata) { throw null; } + public System.IAsyncResult BeginAnnounceOffline(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata, System.AsyncCallback callback, object state) { throw null; } + public System.IAsyncResult BeginAnnounceOnline(System.ServiceModel.Discovery.EndpointDiscoveryMetadata discoveryMetadata, System.AsyncCallback callback, object state) { throw null; } + public void Close() { } + public void EndAnnounceOffline(System.IAsyncResult result) { } + public void EndAnnounceOnline(System.IAsyncResult result) { } + public void Open() { } + void System.IDisposable.Dispose() { } + void System.ServiceModel.ICommunicationObject.Abort() { } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginClose(System.AsyncCallback callback, object state) { throw null; } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginOpen(System.AsyncCallback callback, object state) { throw null; } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + void System.ServiceModel.ICommunicationObject.Close() { } + void System.ServiceModel.ICommunicationObject.Close(System.TimeSpan timeout) { } + void System.ServiceModel.ICommunicationObject.EndClose(System.IAsyncResult result) { } + void System.ServiceModel.ICommunicationObject.EndOpen(System.IAsyncResult result) { } + void System.ServiceModel.ICommunicationObject.Open() { } + void System.ServiceModel.ICommunicationObject.Open(System.TimeSpan timeout) { } + } + public partial class AnnouncementEndpoint : System.ServiceModel.Description.ServiceEndpoint + { + public AnnouncementEndpoint() : base (default(System.ServiceModel.Description.ContractDescription)) { } + public AnnouncementEndpoint(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public AnnouncementEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public AnnouncementEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress address) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public System.ServiceModel.Discovery.DiscoveryVersion DiscoveryVersion { get { throw null; } } + public System.TimeSpan MaxAnnouncementDelay { get { throw null; } set { } } + } + public partial class AnnouncementEventArgs : System.EventArgs + { + internal AnnouncementEventArgs() { } + public System.ServiceModel.Discovery.EndpointDiscoveryMetadata EndpointDiscoveryMetadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryMessageSequence MessageSequence { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.ServiceModel.ServiceBehaviorAttribute(InstanceContextMode=(System.ServiceModel.InstanceContextMode)(2), ConcurrencyMode=(System.ServiceModel.ConcurrencyMode)(2))] + public partial class AnnouncementService + { + public AnnouncementService() { } + public AnnouncementService(int duplicateMessageHistoryLength) { } + public event System.EventHandler OfflineAnnouncementReceived { add { } remove { } } + public event System.EventHandler OnlineAnnouncementReceived { add { } remove { } } + protected virtual System.IAsyncResult OnBeginOfflineAnnouncement(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence, System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata, System.AsyncCallback callback, object state) { throw null; } + protected virtual System.IAsyncResult OnBeginOnlineAnnouncement(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence, System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata, System.AsyncCallback callback, object state) { throw null; } + protected virtual void OnEndOfflineAnnouncement(System.IAsyncResult result) { } + protected virtual void OnEndOnlineAnnouncement(System.IAsyncResult result) { } + } + public sealed partial class DiscoveryClient : System.IDisposable, System.ServiceModel.ICommunicationObject + { + public DiscoveryClient() { } + public DiscoveryClient(System.ServiceModel.Discovery.DiscoveryEndpoint discoveryEndpoint) { } + public DiscoveryClient(string endpointConfigurationName) { } + public System.ServiceModel.ChannelFactory ChannelFactory { get { throw null; } } + public System.ServiceModel.Description.ClientCredentials ClientCredentials { get { throw null; } } + public System.ServiceModel.Description.ServiceEndpoint Endpoint { get { throw null; } } + public System.ServiceModel.IClientChannel InnerChannel { get { throw null; } } + System.ServiceModel.CommunicationState System.ServiceModel.ICommunicationObject.State { get { throw null; } } + public event System.EventHandler FindCompleted { add { } remove { } } + public event System.EventHandler FindProgressChanged { add { } remove { } } + public event System.EventHandler ProxyAvailable { add { } remove { } } + public event System.EventHandler ResolveCompleted { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Closed { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Closing { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Faulted { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Opened { add { } remove { } } + event System.EventHandler System.ServiceModel.ICommunicationObject.Opening { add { } remove { } } + public void CancelAsync(object userState) { } + public void Close() { } + public System.ServiceModel.Discovery.FindResponse Find(System.ServiceModel.Discovery.FindCriteria criteria) { throw null; } + public void FindAsync(System.ServiceModel.Discovery.FindCriteria criteria) { } + public void FindAsync(System.ServiceModel.Discovery.FindCriteria criteria, object userState) { } + public System.Threading.Tasks.Task FindTaskAsync(System.ServiceModel.Discovery.FindCriteria criteria) { throw null; } + public System.Threading.Tasks.Task FindTaskAsync(System.ServiceModel.Discovery.FindCriteria criteria, System.Threading.CancellationToken cancellationToken) { throw null; } + public void Open() { } + public System.ServiceModel.Discovery.ResolveResponse Resolve(System.ServiceModel.Discovery.ResolveCriteria criteria) { throw null; } + public void ResolveAsync(System.ServiceModel.Discovery.ResolveCriteria criteria) { } + public void ResolveAsync(System.ServiceModel.Discovery.ResolveCriteria criteria, object userState) { } + public System.Threading.Tasks.Task ResolveTaskAsync(System.ServiceModel.Discovery.ResolveCriteria criteria) { throw null; } + public System.Threading.Tasks.Task ResolveTaskAsync(System.ServiceModel.Discovery.ResolveCriteria criteria, System.Threading.CancellationToken cancellationToken) { throw null; } + void System.IDisposable.Dispose() { } + void System.ServiceModel.ICommunicationObject.Abort() { } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginClose(System.AsyncCallback callback, object state) { throw null; } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginOpen(System.AsyncCallback callback, object state) { throw null; } + System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { throw null; } + void System.ServiceModel.ICommunicationObject.Close() { } + void System.ServiceModel.ICommunicationObject.Close(System.TimeSpan timeout) { } + void System.ServiceModel.ICommunicationObject.EndClose(System.IAsyncResult result) { } + void System.ServiceModel.ICommunicationObject.EndOpen(System.IAsyncResult result) { } + void System.ServiceModel.ICommunicationObject.Open() { } + void System.ServiceModel.ICommunicationObject.Open(System.TimeSpan timeout) { } + } + public sealed partial class DiscoveryClientBindingElement : System.ServiceModel.Channels.BindingElement + { + public static readonly System.ServiceModel.EndpointAddress DiscoveryEndpointAddress; + public DiscoveryClientBindingElement() { } + public DiscoveryClientBindingElement(System.ServiceModel.Discovery.DiscoveryEndpointProvider discoveryEndpointProvider, System.ServiceModel.Discovery.FindCriteria findCriteria) { } + public System.ServiceModel.Discovery.DiscoveryEndpointProvider DiscoveryEndpointProvider { get { throw null; } set { } } + public System.ServiceModel.Discovery.FindCriteria FindCriteria { get { throw null; } set { } } + public override System.ServiceModel.Channels.IChannelFactory BuildChannelFactory(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override System.ServiceModel.Channels.IChannelListener BuildChannelListener(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override bool CanBuildChannelFactory(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override bool CanBuildChannelListener(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override System.ServiceModel.Channels.BindingElement Clone() { throw null; } + public override T GetProperty(System.ServiceModel.Channels.BindingContext context) { throw null; } + } + public partial class DiscoveryEndpoint : System.ServiceModel.Description.ServiceEndpoint + { + public DiscoveryEndpoint() : base (default(System.ServiceModel.Description.ContractDescription)) { } + public DiscoveryEndpoint(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress endpointAddress) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public DiscoveryEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, System.ServiceModel.Discovery.ServiceDiscoveryMode discoveryMode) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public DiscoveryEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, System.ServiceModel.Discovery.ServiceDiscoveryMode discoveryMode, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress endpointAddress) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public System.ServiceModel.Discovery.ServiceDiscoveryMode DiscoveryMode { get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryVersion DiscoveryVersion { get { throw null; } } + public System.TimeSpan MaxResponseDelay { get { throw null; } set { } } + } + public abstract partial class DiscoveryEndpointProvider + { + protected DiscoveryEndpointProvider() { } + public abstract System.ServiceModel.Discovery.DiscoveryEndpoint GetDiscoveryEndpoint(); + } + public partial class DiscoveryMessageSequence : System.IComparable, System.IEquatable + { + internal DiscoveryMessageSequence() { } + public long InstanceId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public long MessageNumber { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Uri SequenceId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool CanCompareTo(System.ServiceModel.Discovery.DiscoveryMessageSequence other) { throw null; } + public int CompareTo(System.ServiceModel.Discovery.DiscoveryMessageSequence other) { throw null; } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.ServiceModel.Discovery.DiscoveryMessageSequence other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence1, System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence2) { throw null; } + public static bool operator !=(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence1, System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence2) { throw null; } + public override string ToString() { throw null; } + } + public partial class DiscoveryMessageSequenceGenerator + { + public DiscoveryMessageSequenceGenerator() { } + public DiscoveryMessageSequenceGenerator(long instanceId, System.Uri sequenceId) { } + public System.ServiceModel.Discovery.DiscoveryMessageSequence Next() { throw null; } + } + public partial class DiscoveryOperationContextExtension : System.ServiceModel.IExtension + { + internal DiscoveryOperationContextExtension() { } + public System.ServiceModel.Discovery.ServiceDiscoveryMode DiscoveryMode { get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryVersion DiscoveryVersion { get { throw null; } } + public System.TimeSpan MaxResponseDelay { get { throw null; } } + void System.ServiceModel.IExtension.Attach(System.ServiceModel.OperationContext owner) { } + void System.ServiceModel.IExtension.Detach(System.ServiceModel.OperationContext owner) { } + } + public abstract partial class DiscoveryProxy + { + protected DiscoveryProxy() { } + protected DiscoveryProxy(System.ServiceModel.Discovery.DiscoveryMessageSequenceGenerator messageSequenceGenerator) { } + protected DiscoveryProxy(System.ServiceModel.Discovery.DiscoveryMessageSequenceGenerator messageSequenceGenerator, int duplicateMessageHistoryLength) { } + protected virtual System.IAsyncResult BeginShouldRedirectFind(System.ServiceModel.Discovery.FindCriteria resolveCriteria, System.AsyncCallback callback, object state) { throw null; } + protected virtual System.IAsyncResult BeginShouldRedirectResolve(System.ServiceModel.Discovery.ResolveCriteria findCriteria, System.AsyncCallback callback, object state) { throw null; } + protected virtual bool EndShouldRedirectFind(System.IAsyncResult result, out System.Collections.ObjectModel.Collection redirectionEndpoints) { redirectionEndpoints = default(System.Collections.ObjectModel.Collection); throw null; } + protected virtual bool EndShouldRedirectResolve(System.IAsyncResult result, out System.Collections.ObjectModel.Collection redirectionEndpoints) { redirectionEndpoints = default(System.Collections.ObjectModel.Collection); throw null; } + protected abstract System.IAsyncResult OnBeginFind(System.ServiceModel.Discovery.FindRequestContext findRequestContext, System.AsyncCallback callback, object state); + protected abstract System.IAsyncResult OnBeginOfflineAnnouncement(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence, System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata, System.AsyncCallback callback, object state); + protected abstract System.IAsyncResult OnBeginOnlineAnnouncement(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence, System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata, System.AsyncCallback callback, object state); + protected abstract System.IAsyncResult OnBeginResolve(System.ServiceModel.Discovery.ResolveCriteria resolveCriteria, System.AsyncCallback callback, object state); + protected abstract void OnEndFind(System.IAsyncResult result); + protected abstract void OnEndOfflineAnnouncement(System.IAsyncResult result); + protected abstract void OnEndOnlineAnnouncement(System.IAsyncResult result); + protected abstract System.ServiceModel.Discovery.EndpointDiscoveryMetadata OnEndResolve(System.IAsyncResult result); + } + public abstract partial class DiscoveryService + { + protected DiscoveryService() { } + protected DiscoveryService(System.ServiceModel.Discovery.DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator) { } + protected DiscoveryService(System.ServiceModel.Discovery.DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength) { } + protected abstract System.IAsyncResult OnBeginFind(System.ServiceModel.Discovery.FindRequestContext findRequestContext, System.AsyncCallback callback, object state); + protected abstract System.IAsyncResult OnBeginResolve(System.ServiceModel.Discovery.ResolveCriteria resolveCriteria, System.AsyncCallback callback, object state); + protected abstract void OnEndFind(System.IAsyncResult result); + protected abstract System.ServiceModel.Discovery.EndpointDiscoveryMetadata OnEndResolve(System.IAsyncResult result); + } + public abstract partial class DiscoveryServiceExtension : System.ServiceModel.IExtension + { + protected DiscoveryServiceExtension() { } + public System.Collections.ObjectModel.ReadOnlyCollection PublishedEndpoints { get { throw null; } } + protected abstract System.ServiceModel.Discovery.DiscoveryService GetDiscoveryService(); + void System.ServiceModel.IExtension.Attach(System.ServiceModel.ServiceHostBase owner) { } + void System.ServiceModel.IExtension.Detach(System.ServiceModel.ServiceHostBase owner) { } + } + public sealed partial class DiscoveryVersion + { + internal DiscoveryVersion() { } + public System.Uri AdhocAddress { get { throw null; } } + public System.ServiceModel.Channels.MessageVersion MessageVersion { get { throw null; } } + public string Name { get { throw null; } } + public string Namespace { get { throw null; } } + public static System.ServiceModel.Discovery.DiscoveryVersion WSDiscovery11 { get { throw null; } } + public static System.ServiceModel.Discovery.DiscoveryVersion WSDiscoveryApril2005 { get { throw null; } } + public static System.ServiceModel.Discovery.DiscoveryVersion WSDiscoveryCD1 { get { throw null; } } + public static System.ServiceModel.Discovery.DiscoveryVersion FromName(string name) { throw null; } + public override string ToString() { throw null; } + } + public partial class DynamicEndpoint : System.ServiceModel.Description.ServiceEndpoint + { + public DynamicEndpoint(System.ServiceModel.Description.ContractDescription contract, System.ServiceModel.Channels.Binding binding) : base (default(System.ServiceModel.Description.ContractDescription)) { } + public System.ServiceModel.Discovery.DiscoveryEndpointProvider DiscoveryEndpointProvider { get { throw null; } set { } } + public System.ServiceModel.Discovery.FindCriteria FindCriteria { get { throw null; } set { } } + } + public partial class EndpointDiscoveryBehavior : System.ServiceModel.Description.IEndpointBehavior + { + public EndpointDiscoveryBehavior() { } + public System.Collections.ObjectModel.Collection ContractTypeNames { get { throw null; } } + public bool Enabled { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Extensions { get { throw null; } } + public System.Collections.ObjectModel.Collection Scopes { get { throw null; } } + void System.ServiceModel.Description.IEndpointBehavior.AddBindingParameters(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + void System.ServiceModel.Description.IEndpointBehavior.ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + void System.ServiceModel.Description.IEndpointBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { } + void System.ServiceModel.Description.IEndpointBehavior.Validate(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + } + public partial class EndpointDiscoveryMetadata + { + public EndpointDiscoveryMetadata() { } + public System.ServiceModel.EndpointAddress Address { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection ContractTypeNames { get { throw null; } } + public System.Collections.ObjectModel.Collection Extensions { get { throw null; } } + public System.Collections.ObjectModel.Collection ListenUris { get { throw null; } } + public System.Collections.ObjectModel.Collection Scopes { get { throw null; } } + public int Version { get { throw null; } set { } } + public static System.ServiceModel.Discovery.EndpointDiscoveryMetadata FromServiceEndpoint(System.ServiceModel.Description.ServiceEndpoint endpoint) { throw null; } + public static System.ServiceModel.Discovery.EndpointDiscoveryMetadata FromServiceEndpoint(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { throw null; } + } + public partial class FindCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + internal FindCompletedEventArgs() : base (default(System.Exception), default(bool), default(object)) { } + public System.ServiceModel.Discovery.FindResponse Result { get { throw null; } } + } + public partial class FindCriteria + { + public static readonly System.Uri ScopeMatchByExact; + public static readonly System.Uri ScopeMatchByLdap; + public static readonly System.Uri ScopeMatchByNone; + public static readonly System.Uri ScopeMatchByPrefix; + public static readonly System.Uri ScopeMatchByUuid; + public FindCriteria() { } + public FindCriteria(System.Type contractType) { } + public System.Collections.ObjectModel.Collection ContractTypeNames { get { throw null; } } + public System.TimeSpan Duration { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Extensions { get { throw null; } } + public int MaxResults { get { throw null; } set { } } + public System.Uri ScopeMatchBy { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Scopes { get { throw null; } } + public static System.ServiceModel.Discovery.FindCriteria CreateMetadataExchangeEndpointCriteria() { throw null; } + public static System.ServiceModel.Discovery.FindCriteria CreateMetadataExchangeEndpointCriteria(System.Collections.Generic.IEnumerable contractTypeNames) { throw null; } + public static System.ServiceModel.Discovery.FindCriteria CreateMetadataExchangeEndpointCriteria(System.Type contractType) { throw null; } + public bool IsMatch(System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata) { throw null; } + } + public partial class FindProgressChangedEventArgs : System.ComponentModel.ProgressChangedEventArgs + { + internal FindProgressChangedEventArgs() : base (default(int), default(object)) { } + public System.ServiceModel.Discovery.EndpointDiscoveryMetadata EndpointDiscoveryMetadata { get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryMessageSequence MessageSequence { get { throw null; } } + } + public partial class FindRequestContext + { + protected FindRequestContext(System.ServiceModel.Discovery.FindCriteria criteria) { } + public System.ServiceModel.Discovery.FindCriteria Criteria { get { throw null; } } + public void AddMatchingEndpoint(System.ServiceModel.Discovery.EndpointDiscoveryMetadata matchingEndpoint) { } + protected virtual void OnAddMatchingEndpoint(System.ServiceModel.Discovery.EndpointDiscoveryMetadata matchingEndpoint) { } + } + public partial class FindResponse + { + internal FindResponse() { } + public System.Collections.ObjectModel.Collection Endpoints { get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryMessageSequence GetMessageSequence(System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata) { throw null; } + } + public partial class ResolveCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs + { + internal ResolveCompletedEventArgs() : base (default(System.Exception), default(bool), default(object)) { } + public System.ServiceModel.Discovery.ResolveResponse Result { get { throw null; } } + } + public partial class ResolveCriteria + { + public ResolveCriteria() { } + public ResolveCriteria(System.ServiceModel.EndpointAddress address) { } + public System.ServiceModel.EndpointAddress Address { get { throw null; } set { } } + public System.TimeSpan Duration { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Extensions { get { throw null; } } + } + public partial class ResolveResponse + { + internal ResolveResponse() { } + public System.ServiceModel.Discovery.EndpointDiscoveryMetadata EndpointDiscoveryMetadata { get { throw null; } } + public System.ServiceModel.Discovery.DiscoveryMessageSequence MessageSequence { get { throw null; } } + } + public partial class ServiceDiscoveryBehavior : System.ServiceModel.Description.IServiceBehavior + { + public ServiceDiscoveryBehavior() { } + public System.Collections.ObjectModel.Collection AnnouncementEndpoints { get { throw null; } } + void System.ServiceModel.Description.IServiceBehavior.AddBindingParameters(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + void System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) { } + void System.ServiceModel.Description.IServiceBehavior.Validate(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) { } + } + public enum ServiceDiscoveryMode + { + Adhoc = 0, + Managed = 1, + } + public partial class UdpAnnouncementEndpoint : System.ServiceModel.Discovery.AnnouncementEndpoint + { + public static readonly System.Uri DefaultIPv4MulticastAddress; + public static readonly System.Uri DefaultIPv6MulticastAddress; + public UdpAnnouncementEndpoint() { } + public UdpAnnouncementEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion) { } + public UdpAnnouncementEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, string multicastAddress) { } + public UdpAnnouncementEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, System.Uri multicastAddress) { } + public UdpAnnouncementEndpoint(string multicastAddress) { } + public UdpAnnouncementEndpoint(System.Uri multicastAddress) { } + public System.Uri MulticastAddress { get { throw null; } set { } } + [System.ObsoleteAttribute("TranportSettings property in System.SerivceModel.Discovery.UdpAnnouncementEndpoint is obsolete. Consider using System.ServiceModel.Channels.UdpTransportBindingElement for setting the transport properties.")] + public System.ServiceModel.Discovery.UdpTransportSettings TransportSettings { get { throw null; } } + } + public partial class UdpDiscoveryEndpoint : System.ServiceModel.Discovery.DiscoveryEndpoint + { + public static readonly System.Uri DefaultIPv4MulticastAddress; + public static readonly System.Uri DefaultIPv6MulticastAddress; + public UdpDiscoveryEndpoint() { } + public UdpDiscoveryEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion) { } + public UdpDiscoveryEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, string multicastAddress) { } + public UdpDiscoveryEndpoint(System.ServiceModel.Discovery.DiscoveryVersion discoveryVersion, System.Uri multicastAddress) { } + public UdpDiscoveryEndpoint(string multicastAddress) { } + public UdpDiscoveryEndpoint(System.Uri multicastAddress) { } + public System.Uri MulticastAddress { get { throw null; } set { } } + [System.ObsoleteAttribute("TranportSettings property in System.SerivceModel.Discovery.UdpDiscoveryEndpoint is obsolete. Consider using System.ServiceModel.Channels.UdpTransportBindingElement for setting the transport properties.")] + public System.ServiceModel.Discovery.UdpTransportSettings TransportSettings { get { throw null; } } + } + public partial class UdpTransportSettings + { + internal UdpTransportSettings() { } + public int DuplicateMessageHistoryLength { get { throw null; } set { } } + public long MaxBufferPoolSize { get { throw null; } set { } } + public int MaxMulticastRetransmitCount { get { throw null; } set { } } + public int MaxPendingMessageCount { get { throw null; } set { } } + public long MaxReceivedMessageSize { get { throw null; } set { } } + public int MaxUnicastRetransmitCount { get { throw null; } set { } } + public string MulticastInterfaceId { get { throw null; } set { } } + public int SocketReceiveBufferSize { get { throw null; } set { } } + public int TimeToLive { get { throw null; } set { } } + } +} +namespace System.ServiceModel.Discovery.Configuration +{ + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Configuration.ChannelEndpointElement), AddItemName="endpoint")] + public sealed partial class AnnouncementChannelEndpointElementCollection : System.ServiceModel.Configuration.ServiceModelConfigurationElementCollection + { + public AnnouncementChannelEndpointElementCollection() { } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + } + public partial class AnnouncementEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public AnnouncementEndpointCollectionElement() { } + } + public partial class AnnouncementEndpointElement : System.ServiceModel.Configuration.StandardEndpointElement + { + public AnnouncementEndpointElement() { } + [System.ComponentModel.TypeConverterAttribute(typeof(System.ServiceModel.Discovery.Configuration.DiscoveryVersionConverter))] + [System.Configuration.ConfigurationPropertyAttribute("discoveryVersion", DefaultValue="WSDiscovery11")] + public System.ServiceModel.Discovery.DiscoveryVersion DiscoveryVersion { get { throw null; } set { } } + protected internal override System.Type EndpointType { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter")] + [System.Configuration.ConfigurationPropertyAttribute("maxAnnouncementDelay", DefaultValue="00:00:00")] + public System.TimeSpan MaxAnnouncementDelay { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected internal override void InitializeFrom(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } + public sealed partial class ContractTypeNameElement : System.Configuration.ConfigurationElement + { + public ContractTypeNameElement() { } + public ContractTypeNameElement(string name, string ns) { } + [System.Configuration.ConfigurationPropertyAttribute("name", Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + [System.Configuration.StringValidatorAttribute(MinLength=1)] + public string Name { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("namespace", DefaultValue="http://tempuri.org/", Options=(System.Configuration.ConfigurationPropertyOptions)(4))] + public string Namespace { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Discovery.Configuration.ContractTypeNameElement))] + public sealed partial class ContractTypeNameElementCollection : System.ServiceModel.Configuration.ServiceModelConfigurationElementCollection + { + public ContractTypeNameElementCollection() { } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + } + public sealed partial class DiscoveryClientElement : System.ServiceModel.Configuration.BindingElementExtensionElement + { + public DiscoveryClientElement() { } + public override System.Type BindingElementType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("endpoint")] + public System.ServiceModel.Configuration.ChannelEndpointElement DiscoveryEndpoint { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("findCriteria")] + public System.ServiceModel.Discovery.Configuration.FindCriteriaElement FindCriteria { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + public override void ApplyConfiguration(System.ServiceModel.Channels.BindingElement bindingElement) { } + public override void CopyFrom(System.ServiceModel.Configuration.ServiceModelExtensionElement from) { } + protected internal override System.ServiceModel.Channels.BindingElement CreateBindingElement() { throw null; } + protected internal override void InitializeFrom(System.ServiceModel.Channels.BindingElement bindingElement) { } + } + public sealed partial class DiscoveryClientSettingsElement : System.Configuration.ConfigurationElement + { + public DiscoveryClientSettingsElement() { } + [System.Configuration.ConfigurationPropertyAttribute("endpoint")] + public System.ServiceModel.Configuration.ChannelEndpointElement DiscoveryEndpoint { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("findCriteria")] + public System.ServiceModel.Discovery.Configuration.FindCriteriaElement FindCriteria { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + public partial class DiscoveryEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public DiscoveryEndpointCollectionElement() { } + } + public partial class DiscoveryEndpointElement : System.ServiceModel.Configuration.StandardEndpointElement + { + public DiscoveryEndpointElement() { } + [System.Configuration.ConfigurationPropertyAttribute("discoveryMode", DefaultValue=(System.ServiceModel.Discovery.ServiceDiscoveryMode)(1))] + public System.ServiceModel.Discovery.ServiceDiscoveryMode DiscoveryMode { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute(typeof(System.ServiceModel.Discovery.Configuration.DiscoveryVersionConverter))] + [System.Configuration.ConfigurationPropertyAttribute("discoveryVersion", DefaultValue="WSDiscovery11")] + public System.ServiceModel.Discovery.DiscoveryVersion DiscoveryVersion { get { throw null; } set { } } + protected internal override System.Type EndpointType { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter")] + [System.Configuration.ConfigurationPropertyAttribute("maxResponseDelay", DefaultValue="00:00:00")] + public System.TimeSpan MaxResponseDelay { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected internal override void InitializeFrom(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } + public partial class DiscoveryVersionConverter : System.ComponentModel.TypeConverter + { + public DiscoveryVersionConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + public partial class DynamicEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public DynamicEndpointCollectionElement() { } + } + public sealed partial class DynamicEndpointElement : System.ServiceModel.Configuration.StandardEndpointElement + { + public DynamicEndpointElement() { } + [System.Configuration.ConfigurationPropertyAttribute("discoveryClientSettings")] + public System.ServiceModel.Discovery.Configuration.DiscoveryClientSettingsElement DiscoveryClientSettings { get { throw null; } } + protected internal override System.Type EndpointType { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } + public sealed partial class EndpointDiscoveryElement : System.ServiceModel.Configuration.BehaviorExtensionElement + { + public EndpointDiscoveryElement() { } + public override System.Type BehaviorType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("types")] + public System.ServiceModel.Discovery.Configuration.ContractTypeNameElementCollection ContractTypeNames { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("enabled", DefaultValue=true)] + public bool Enabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("extensions")] + public System.ServiceModel.Configuration.XmlElementElementCollection Extensions { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("scopes")] + public System.ServiceModel.Discovery.Configuration.ScopeElementCollection Scopes { get { throw null; } } + protected internal override object CreateBehavior() { throw null; } + } + public sealed partial class FindCriteriaElement : System.Configuration.ConfigurationElement + { + public FindCriteriaElement() { } + [System.Configuration.ConfigurationPropertyAttribute("types")] + public System.ServiceModel.Discovery.Configuration.ContractTypeNameElementCollection ContractTypeNames { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter")] + [System.Configuration.ConfigurationPropertyAttribute("duration", DefaultValue="00:00:20")] + public System.TimeSpan Duration { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("extensions")] + public System.ServiceModel.Configuration.XmlElementElementCollection Extensions { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("maxResults", DefaultValue=2147483647)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1, MaxValue=2147483647)] + public int MaxResults { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("scopeMatchBy")] + public System.Uri ScopeMatchBy { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("scopes")] + public System.ServiceModel.Discovery.Configuration.ScopeElementCollection Scopes { get { throw null; } } + } + public sealed partial class ScopeElement : System.Configuration.ConfigurationElement + { + public ScopeElement() { } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.CallbackValidatorAttribute(CallbackMethodName="ScopeValidatorCallback", Type=typeof(System.ServiceModel.Discovery.Configuration.ScopeElement))] + [System.Configuration.ConfigurationPropertyAttribute("scope", Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public System.Uri Scope { get { throw null; } set { } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Discovery.Configuration.ScopeElement))] + public sealed partial class ScopeElementCollection : System.ServiceModel.Configuration.ServiceModelConfigurationElementCollection + { + public ScopeElementCollection() { } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + } + public sealed partial class ServiceDiscoveryElement : System.ServiceModel.Configuration.BehaviorExtensionElement + { + public ServiceDiscoveryElement() { } + [System.Configuration.ConfigurationPropertyAttribute("announcementEndpoints")] + public System.ServiceModel.Discovery.Configuration.AnnouncementChannelEndpointElementCollection AnnouncementEndpoints { get { throw null; } } + public override System.Type BehaviorType { get { throw null; } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override object CreateBehavior() { throw null; } + } + public partial class UdpAnnouncementEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public UdpAnnouncementEndpointCollectionElement() { } + } + public partial class UdpAnnouncementEndpointElement : System.ServiceModel.Discovery.Configuration.AnnouncementEndpointElement + { + public UdpAnnouncementEndpointElement() { } + protected internal override System.Type EndpointType { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter")] + [System.Configuration.ConfigurationPropertyAttribute("maxAnnouncementDelay", DefaultValue="00:00:00.500")] + public new System.TimeSpan MaxAnnouncementDelay { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("multicastAddress", DefaultValue="soap.udp://239.255.255.250:3702")] + public System.Uri MulticastAddress { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("transportSettings")] + public System.ServiceModel.Discovery.Configuration.UdpTransportSettingsElement TransportSettings { get { throw null; } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected internal override void InitializeFrom(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } + public partial class UdpDiscoveryEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public UdpDiscoveryEndpointCollectionElement() { } + } + public partial class UdpDiscoveryEndpointElement : System.ServiceModel.Discovery.Configuration.DiscoveryEndpointElement + { + public UdpDiscoveryEndpointElement() { } + [System.Configuration.ConfigurationPropertyAttribute("discoveryMode", DefaultValue=(System.ServiceModel.Discovery.ServiceDiscoveryMode)(0))] + public new System.ServiceModel.Discovery.ServiceDiscoveryMode DiscoveryMode { get { throw null; } set { } } + protected internal override System.Type EndpointType { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter")] + [System.Configuration.ConfigurationPropertyAttribute("maxResponseDelay", DefaultValue="00:00:00.500")] + public new System.TimeSpan MaxResponseDelay { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("multicastAddress", DefaultValue="soap.udp://239.255.255.250:3702")] + public System.Uri MulticastAddress { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("transportSettings")] + public System.ServiceModel.Discovery.Configuration.UdpTransportSettingsElement TransportSettings { get { throw null; } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected internal override void InitializeFrom(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } + public sealed partial class UdpTransportSettingsElement : System.Configuration.ConfigurationElement + { + public UdpTransportSettingsElement() { } + [System.Configuration.ConfigurationPropertyAttribute("duplicateMessageHistoryLength", DefaultValue=4112)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0, MaxValue=2147483647)] + public int DuplicateMessageHistoryLength { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferPoolSize", DefaultValue=(long)524288)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)1, MaxValue=(long)9223372036854775807)] + public long MaxBufferPoolSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxMulticastRetransmitCount", DefaultValue=2)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0, MaxValue=2147483647)] + public int MaxMulticastRetransmitCount { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxPendingMessageCount", DefaultValue=32)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1, MaxValue=2147483647)] + public int MaxPendingMessageCount { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxReceivedMessageSize", DefaultValue=(long)65536)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)1, MaxValue=(long)65536)] + public long MaxReceivedMessageSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxUnicastRetransmitCount", DefaultValue=1)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0, MaxValue=2147483647)] + public int MaxUnicastRetransmitCount { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("multicastInterfaceId")] + public string MulticastInterfaceId { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("socketReceiveBufferSize", DefaultValue=65536)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1, MaxValue=2147483647)] + public int SocketReceiveBufferSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("timeToLive", DefaultValue=1)] + [System.Configuration.IntegerValidatorAttribute(MinValue=0, MaxValue=255)] + public int TimeToLive { get { throw null; } set { } } + } +} +namespace System.ServiceModel.Discovery.Version11 +{ + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class DiscoveryMessageSequence11 : System.Xml.Serialization.IXmlSerializable + { + internal DiscoveryMessageSequence11() { } + public static System.ServiceModel.Discovery.Version11.DiscoveryMessageSequence11 FromDiscoveryMessageSequence(System.ServiceModel.Discovery.DiscoveryMessageSequence discoveryMessageSequence) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.DiscoveryMessageSequence ToDiscoveryMessageSequence() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class EndpointDiscoveryMetadata11 : System.Xml.Serialization.IXmlSerializable + { + internal EndpointDiscoveryMetadata11() { } + public static System.ServiceModel.Discovery.Version11.EndpointDiscoveryMetadata11 FromEndpointDiscoveryMetadata(System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.EndpointDiscoveryMetadata ToEndpointDiscoveryMetadata() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class FindCriteria11 : System.Xml.Serialization.IXmlSerializable + { + internal FindCriteria11() { } + public static System.ServiceModel.Discovery.Version11.FindCriteria11 FromFindCriteria(System.ServiceModel.Discovery.FindCriteria findCriteria) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.FindCriteria ToFindCriteria() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class ResolveCriteria11 : System.Xml.Serialization.IXmlSerializable + { + internal ResolveCriteria11() { } + public static System.ServiceModel.Discovery.Version11.ResolveCriteria11 FromResolveCriteria(System.ServiceModel.Discovery.ResolveCriteria resolveCriteria) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.ResolveCriteria ToResolveCriteria() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } +} +namespace System.ServiceModel.Discovery.VersionApril2005 +{ + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class DiscoveryMessageSequenceApril2005 : System.Xml.Serialization.IXmlSerializable + { + internal DiscoveryMessageSequenceApril2005() { } + public static System.ServiceModel.Discovery.VersionApril2005.DiscoveryMessageSequenceApril2005 FromDiscoveryMessageSequence(System.ServiceModel.Discovery.DiscoveryMessageSequence discoveryMessageSequence) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.DiscoveryMessageSequence ToDiscoveryMessageSequence() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class EndpointDiscoveryMetadataApril2005 : System.Xml.Serialization.IXmlSerializable + { + internal EndpointDiscoveryMetadataApril2005() { } + public static System.ServiceModel.Discovery.VersionApril2005.EndpointDiscoveryMetadataApril2005 FromEndpointDiscoveryMetadata(System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.EndpointDiscoveryMetadata ToEndpointDiscoveryMetadata() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class FindCriteriaApril2005 : System.Xml.Serialization.IXmlSerializable + { + internal FindCriteriaApril2005() { } + public static System.ServiceModel.Discovery.VersionApril2005.FindCriteriaApril2005 FromFindCriteria(System.ServiceModel.Discovery.FindCriteria findCriteria) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.FindCriteria ToFindCriteria() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class ResolveCriteriaApril2005 : System.Xml.Serialization.IXmlSerializable + { + internal ResolveCriteriaApril2005() { } + public static System.ServiceModel.Discovery.VersionApril2005.ResolveCriteriaApril2005 FromResolveCriteria(System.ServiceModel.Discovery.ResolveCriteria resolveCriteria) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.ResolveCriteria ToResolveCriteria() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } +} +namespace System.ServiceModel.Discovery.VersionCD1 +{ + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class DiscoveryMessageSequenceCD1 : System.Xml.Serialization.IXmlSerializable + { + internal DiscoveryMessageSequenceCD1() { } + public static System.ServiceModel.Discovery.VersionCD1.DiscoveryMessageSequenceCD1 FromDiscoveryMessageSequence(System.ServiceModel.Discovery.DiscoveryMessageSequence discoveryMessageSequence) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.DiscoveryMessageSequence ToDiscoveryMessageSequence() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class EndpointDiscoveryMetadataCD1 : System.Xml.Serialization.IXmlSerializable + { + internal EndpointDiscoveryMetadataCD1() { } + public static System.ServiceModel.Discovery.VersionCD1.EndpointDiscoveryMetadataCD1 FromEndpointDiscoveryMetadata(System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.EndpointDiscoveryMetadata ToEndpointDiscoveryMetadata() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class FindCriteriaCD1 : System.Xml.Serialization.IXmlSerializable + { + internal FindCriteriaCD1() { } + public static System.ServiceModel.Discovery.VersionCD1.FindCriteriaCD1 FromFindCriteria(System.ServiceModel.Discovery.FindCriteria findCriteria) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.FindCriteria ToFindCriteria() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } + [System.Xml.Serialization.XmlSchemaProviderAttribute("GetSchema")] + public partial class ResolveCriteriaCD1 : System.Xml.Serialization.IXmlSerializable + { + internal ResolveCriteriaCD1() { } + public static System.ServiceModel.Discovery.VersionCD1.ResolveCriteriaCD1 FromResolveCriteria(System.ServiceModel.Discovery.ResolveCriteria resolveCriteria) { throw null; } + public System.Xml.Schema.XmlSchema GetSchema() { throw null; } + public static System.Xml.XmlQualifiedName GetSchema(System.Xml.Schema.XmlSchemaSet schemaSet) { throw null; } + public void ReadXml(System.Xml.XmlReader reader) { } + public System.ServiceModel.Discovery.ResolveCriteria ToResolveCriteria() { throw null; } + public void WriteXml(System.Xml.XmlWriter writer) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Routing.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Routing.cs new file mode 100644 index 0000000000..81a02e39c9 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Routing.cs @@ -0,0 +1,285 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Routing.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Routing.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Routing.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +namespace System.ServiceModel.Dispatcher +{ + public partial class EndpointNameMessageFilter : System.ServiceModel.Dispatcher.MessageFilter + { + public EndpointNameMessageFilter(string endpointName) { } + public override bool Match(System.ServiceModel.Channels.Message message) { throw null; } + public override bool Match(System.ServiceModel.Channels.MessageBuffer buffer) { throw null; } + } + public partial class StrictAndMessageFilter : System.ServiceModel.Dispatcher.MessageFilter + { + public StrictAndMessageFilter(System.ServiceModel.Dispatcher.MessageFilter filter1, System.ServiceModel.Dispatcher.MessageFilter filter2) { } + protected internal override System.ServiceModel.Dispatcher.IMessageFilterTable CreateFilterTable() { throw null; } + public override bool Match(System.ServiceModel.Channels.Message message) { throw null; } + public override bool Match(System.ServiceModel.Channels.MessageBuffer buffer) { throw null; } + } +} +namespace System.ServiceModel.Routing +{ + [System.ServiceModel.ServiceContractAttribute(Namespace="http://schemas.microsoft.com/netfx/2009/05/routing", SessionMode=(System.ServiceModel.SessionMode)(1), CallbackContract=typeof(System.ServiceModel.Routing.IDuplexRouterCallback))] + public partial interface IDuplexSessionRouter + { + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, IsOneWay=true, Action="*")] + System.IAsyncResult BeginProcessMessage(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state); + void EndProcessMessage(System.IAsyncResult result); + } + [System.ServiceModel.ServiceContractAttribute(Namespace="http://schemas.microsoft.com/netfx/2009/05/routing", SessionMode=(System.ServiceModel.SessionMode)(0))] + public partial interface IRequestReplyRouter + { + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, IsOneWay=false, Action="*", ReplyAction="*")] + System.IAsyncResult BeginProcessRequest(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state); + System.ServiceModel.Channels.Message EndProcessRequest(System.IAsyncResult result); + } + [System.ServiceModel.ServiceContractAttribute(Namespace="http://schemas.microsoft.com/netfx/2009/05/routing", SessionMode=(System.ServiceModel.SessionMode)(0))] + public partial interface ISimplexDatagramRouter + { + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, IsOneWay=true, Action="*")] + System.IAsyncResult BeginProcessMessage(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state); + void EndProcessMessage(System.IAsyncResult result); + } + [System.ServiceModel.ServiceContractAttribute(Namespace="http://schemas.microsoft.com/netfx/2009/05/routing", SessionMode=(System.ServiceModel.SessionMode)(1))] + public partial interface ISimplexSessionRouter + { + [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, IsOneWay=true, Action="*")] + System.IAsyncResult BeginProcessMessage(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state); + void EndProcessMessage(System.IAsyncResult result); + } + public sealed partial class RoutingBehavior : System.ServiceModel.Description.IServiceBehavior + { + public RoutingBehavior(System.ServiceModel.Routing.RoutingConfiguration routingConfiguration) { } + public static System.Type GetContractForDescription(System.ServiceModel.Description.ContractDescription description) { throw null; } + void System.ServiceModel.Description.IServiceBehavior.AddBindingParameters(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + void System.ServiceModel.Description.IServiceBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) { } + void System.ServiceModel.Description.IServiceBehavior.Validate(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) { } + } + public sealed partial class RoutingConfiguration + { + public RoutingConfiguration() { } + public RoutingConfiguration(System.ServiceModel.Dispatcher.MessageFilterTable> filterTable, bool routeOnHeadersOnly) { } + public bool EnsureOrderedDispatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.ServiceModel.Dispatcher.MessageFilterTable> FilterTable { get { throw null; } } + public bool RouteOnHeadersOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SoapProcessingEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public sealed partial class RoutingExtension : System.ServiceModel.IExtension + { + internal RoutingExtension() { } + public void ApplyConfiguration(System.ServiceModel.Routing.RoutingConfiguration routingConfiguration) { } + void System.ServiceModel.IExtension.Attach(System.ServiceModel.ServiceHostBase owner) { } + void System.ServiceModel.IExtension.Detach(System.ServiceModel.ServiceHostBase owner) { } + } + [System.ServiceModel.Activation.AspNetCompatibilityRequirementsAttribute(RequirementsMode=(System.ServiceModel.Activation.AspNetCompatibilityRequirementsMode)(1))] + [System.ServiceModel.ServiceBehaviorAttribute(AddressFilterMode=(System.ServiceModel.AddressFilterMode)(2), InstanceContextMode=(System.ServiceModel.InstanceContextMode)(0), UseSynchronizationContext=false, ValidateMustUnderstand=false)] + public sealed partial class RoutingService : System.IDisposable, System.ServiceModel.Routing.IDuplexSessionRouter, System.ServiceModel.Routing.IRequestReplyRouter, System.ServiceModel.Routing.ISimplexDatagramRouter, System.ServiceModel.Routing.ISimplexSessionRouter + { + internal RoutingService() { } + void System.IDisposable.Dispose() { } + [System.ServiceModel.OperationBehaviorAttribute(Impersonation=(System.ServiceModel.ImpersonationOption)(1))] + System.IAsyncResult System.ServiceModel.Routing.IDuplexSessionRouter.BeginProcessMessage(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state) { throw null; } + void System.ServiceModel.Routing.IDuplexSessionRouter.EndProcessMessage(System.IAsyncResult result) { } + [System.ServiceModel.OperationBehaviorAttribute(Impersonation=(System.ServiceModel.ImpersonationOption)(1))] + System.IAsyncResult System.ServiceModel.Routing.IRequestReplyRouter.BeginProcessRequest(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state) { throw null; } + System.ServiceModel.Channels.Message System.ServiceModel.Routing.IRequestReplyRouter.EndProcessRequest(System.IAsyncResult result) { throw null; } + [System.ServiceModel.OperationBehaviorAttribute(Impersonation=(System.ServiceModel.ImpersonationOption)(1))] + System.IAsyncResult System.ServiceModel.Routing.ISimplexDatagramRouter.BeginProcessMessage(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state) { throw null; } + void System.ServiceModel.Routing.ISimplexDatagramRouter.EndProcessMessage(System.IAsyncResult result) { } + [System.ServiceModel.OperationBehaviorAttribute(Impersonation=(System.ServiceModel.ImpersonationOption)(1))] + System.IAsyncResult System.ServiceModel.Routing.ISimplexSessionRouter.BeginProcessMessage(System.ServiceModel.Channels.Message message, System.AsyncCallback callback, object state) { throw null; } + void System.ServiceModel.Routing.ISimplexSessionRouter.EndProcessMessage(System.IAsyncResult result) { } + } + public partial class SoapProcessingBehavior : System.ServiceModel.Description.IEndpointBehavior + { + public SoapProcessingBehavior() { } + public bool ProcessMessages { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void AddBindingParameters(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + public void ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + public void ApplyDispatchBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { } + public void Validate(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + } +} +namespace System.ServiceModel.Routing.Configuration +{ + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Routing.Configuration.BackupEndpointElement))] + public partial class BackupEndpointCollection : System.Configuration.ConfigurationElementCollection + { + public BackupEndpointCollection() { } + [System.Configuration.ConfigurationPropertyAttribute("name", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public string Name { get { throw null; } set { } } + public void Add(System.ServiceModel.Routing.Configuration.BackupEndpointElement element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(System.ServiceModel.Routing.Configuration.BackupEndpointElement element) { } + } + public partial class BackupEndpointElement : System.Configuration.ConfigurationElement + { + public BackupEndpointElement() { } + [System.Configuration.ConfigurationPropertyAttribute("endpointName", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(2))] + public string EndpointName { get { throw null; } set { } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Routing.Configuration.BackupEndpointCollection), AddItemName="backupList")] + public partial class BackupListCollection : System.Configuration.ConfigurationElementCollection + { + public BackupListCollection() { } + public new System.ServiceModel.Routing.Configuration.BackupEndpointCollection this[string name] { get { throw null; } } + public void Add(System.ServiceModel.Routing.Configuration.BackupEndpointCollection element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(System.ServiceModel.Routing.Configuration.BackupEndpointCollection element) { } + } + public partial class FilterElement : System.Configuration.ConfigurationElement + { + public FilterElement() { } + [System.Configuration.ConfigurationPropertyAttribute("customType", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public string CustomType { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("filter1", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public string Filter1 { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("filter2", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public string Filter2 { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("filterData", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public string FilterData { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("filterType", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(2))] + public System.ServiceModel.Routing.Configuration.FilterType FilterType { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("name", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public string Name { get { throw null; } set { } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Routing.Configuration.FilterElement), AddItemName="filter")] + public partial class FilterElementCollection : System.Configuration.ConfigurationElementCollection + { + public FilterElementCollection() { } + public System.ServiceModel.Routing.Configuration.FilterElement this[int index] { get { throw null; } set { } } + public new System.ServiceModel.Routing.Configuration.FilterElement this[string name] { get { throw null; } } + public void Add(System.ServiceModel.Routing.Configuration.FilterElement element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + protected override bool IsElementRemovable(System.Configuration.ConfigurationElement element) { throw null; } + public override bool IsReadOnly() { throw null; } + public void Remove(System.ServiceModel.Routing.Configuration.FilterElement element) { } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Routing.Configuration.FilterTableEntryCollection), AddItemName="filterTable")] + public partial class FilterTableCollection : System.Configuration.ConfigurationElementCollection + { + public FilterTableCollection() { } + public new System.ServiceModel.Routing.Configuration.FilterTableEntryCollection this[string name] { get { throw null; } } + public void Add(System.ServiceModel.Routing.Configuration.FilterTableEntryCollection element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(System.ServiceModel.Routing.Configuration.FilterTableEntryCollection element) { } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Routing.Configuration.FilterTableEntryElement))] + public partial class FilterTableEntryCollection : System.Configuration.ConfigurationElementCollection + { + public FilterTableEntryCollection() { } + [System.Configuration.ConfigurationPropertyAttribute("name", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public string Name { get { throw null; } set { } } + public void Add(System.ServiceModel.Routing.Configuration.FilterTableEntryElement element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(System.ServiceModel.Routing.Configuration.FilterTableEntryElement element) { } + } + public partial class FilterTableEntryElement : System.Configuration.ConfigurationElement + { + public FilterTableEntryElement() { } + [System.Configuration.ConfigurationPropertyAttribute("backupList", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public string BackupList { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("endpointName", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public string EndpointName { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("filterName", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public string FilterName { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("priority", DefaultValue=0, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public int Priority { get { throw null; } set { } } + } + public enum FilterType + { + Action = 0, + And = 3, + Custom = 4, + EndpointAddress = 1, + EndpointName = 5, + MatchAll = 6, + PrefixEndpointAddress = 2, + XPath = 7, + } + public partial class NamespaceElement : System.Configuration.ConfigurationElement + { + public NamespaceElement() { } + [System.Configuration.ConfigurationPropertyAttribute("namespace", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(2))] + public string Namespace { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("prefix", DefaultValue=null, Options=(System.Configuration.ConfigurationPropertyOptions)(6))] + public string Prefix { get { throw null; } set { } } + } + [System.Configuration.ConfigurationCollectionAttribute(typeof(System.ServiceModel.Routing.Configuration.NamespaceElement))] + public partial class NamespaceElementCollection : System.Configuration.ConfigurationElementCollection + { + public NamespaceElementCollection() { } + public System.ServiceModel.Routing.Configuration.NamespaceElement this[int index] { get { throw null; } set { } } + public new System.ServiceModel.Routing.Configuration.NamespaceElement this[string name] { get { throw null; } } + public void Add(System.ServiceModel.Routing.Configuration.NamespaceElement element) { } + public void Clear() { } + protected override System.Configuration.ConfigurationElement CreateNewElement() { throw null; } + protected override object GetElementKey(System.Configuration.ConfigurationElement element) { throw null; } + public void Remove(System.ServiceModel.Routing.Configuration.NamespaceElement element) { } + } + public sealed partial class RoutingExtensionElement : System.ServiceModel.Configuration.BehaviorExtensionElement + { + public RoutingExtensionElement() { } + public override System.Type BehaviorType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("ensureOrderedDispatch", DefaultValue=false)] + public bool EnsureOrderedDispatch { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("filterTableName", DefaultValue=null)] + public string FilterTableName { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("routeOnHeadersOnly", DefaultValue=true, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public bool RouteOnHeadersOnly { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("soapProcessingEnabled", DefaultValue=true)] + public bool SoapProcessingEnabled { get { throw null; } set { } } + protected internal override object CreateBehavior() { throw null; } + } + public partial class RoutingSection : System.Configuration.ConfigurationSection + { + public RoutingSection() { } + [System.Configuration.ConfigurationPropertyAttribute("backupLists", Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public System.ServiceModel.Routing.Configuration.BackupListCollection BackupLists { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("filters", Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public System.ServiceModel.Routing.Configuration.FilterElementCollection Filters { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("filterTables", Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public System.ServiceModel.Routing.Configuration.FilterTableCollection FilterTables { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("namespaceTable", Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public System.ServiceModel.Routing.Configuration.NamespaceElementCollection NamespaceTable { get { throw null; } } + public static System.ServiceModel.Dispatcher.MessageFilterTable> CreateFilterTable(string name) { throw null; } + } + public partial class SoapProcessingExtensionElement : System.ServiceModel.Configuration.BehaviorExtensionElement + { + public SoapProcessingExtensionElement() { } + public override System.Type BehaviorType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("processMessages", DefaultValue=true, Options=(System.Configuration.ConfigurationPropertyOptions)(0))] + public bool ProcessMessages { get { throw null; } set { } } + protected internal override object CreateBehavior() { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Routing.extra.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Routing.extra.cs new file mode 100644 index 0000000000..28e38317d1 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Routing.extra.cs @@ -0,0 +1,8 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Routing +{ + interface IDuplexRouterCallback {} +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Web.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Web.cs new file mode 100644 index 0000000000..70aab5f653 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.Web.cs @@ -0,0 +1,721 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.Web.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceModel.Web.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceModel.Web.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.Json.DataContractJsonSerializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.Json.IXmlJsonReaderInitializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.Json.IXmlJsonWriterInitializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.Json.JsonReaderWriterFactory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Atom10FeedFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Atom10FeedFormatter<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Atom10ItemFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Atom10ItemFormatter<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.AtomPub10CategoriesDocumentFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.AtomPub10ServiceDocumentFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.AtomPub10ServiceDocumentFormatter<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.CategoriesDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.CategoriesDocumentFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.InlineCategoriesDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.ReferencedCategoriesDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.ResourceCollectionInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Rss20FeedFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Rss20FeedFormatter<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Rss20ItemFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Rss20ItemFormatter<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.ServiceDocument))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.ServiceDocumentFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationCategory))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationContent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationElementExtension))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationElementExtensionCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationFeed))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationFeedFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationItem))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationItemFormatter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationLink))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationPerson))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.SyndicationVersions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.TextSyndicationContent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.TextSyndicationContentKind))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.UrlSyndicationContent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.Workspace))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Syndication.XmlSyndicationContent))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTemplate))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTemplateEquivalenceComparer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTemplateMatch))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTemplateMatchException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.UriTemplateTable))] +namespace System.ServiceModel +{ + public partial class WebHttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences + { + public WebHttpBinding() { } + public WebHttpBinding(System.ServiceModel.WebHttpSecurityMode securityMode) { } + public WebHttpBinding(string configurationName) { } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool AllowCookies { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool BypassProxyOnLocal { get { throw null; } set { } } + public System.ServiceModel.Channels.WebContentTypeMapper ContentTypeMapper { get { throw null; } set { } } + public bool CrossDomainScriptAccessEnabled { get { throw null; } set { } } + public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((long)524288)] + public long MaxBufferPoolSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(65536)] + public int MaxBufferSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((long)65536)] + public long MaxReceivedMessageSize { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + public System.Uri ProxyAddress { get { throw null; } set { } } + public System.Xml.XmlDictionaryReaderQuotas ReaderQuotas { get { throw null; } set { } } + public override string Scheme { get { throw null; } } + public System.ServiceModel.WebHttpSecurity Security { get { throw null; } set { } } + bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + public bool UseDefaultWebProxy { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.EncodingConverter")] + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + public override System.ServiceModel.Channels.IChannelFactory BuildChannelFactory(System.ServiceModel.Channels.BindingParameterCollection parameters) { throw null; } + public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeReaderQuotas() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeSecurity() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeWriteEncoding() { throw null; } + } + public sealed partial class WebHttpSecurity + { + public WebHttpSecurity() { } + public System.ServiceModel.WebHttpSecurityMode Mode { get { throw null; } set { } } + public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeMode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public bool ShouldSerializeTransport() { throw null; } + } + public enum WebHttpSecurityMode + { + None = 0, + Transport = 1, + TransportCredentialOnly = 2, + } +} +namespace System.ServiceModel.Activation +{ + public partial class WebScriptServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactory + { + public WebScriptServiceHostFactory() { } + protected override System.ServiceModel.ServiceHost CreateServiceHost(System.Type serviceType, System.Uri[] baseAddresses) { throw null; } + } + public partial class WebServiceHostFactory : System.ServiceModel.Activation.ServiceHostFactory + { + public WebServiceHostFactory() { } + protected override System.ServiceModel.ServiceHost CreateServiceHost(System.Type serviceType, System.Uri[] baseAddresses) { throw null; } + } +} +namespace System.ServiceModel.Channels +{ + public sealed partial class JavascriptCallbackResponseMessageProperty + { + public JavascriptCallbackResponseMessageProperty() { } + public string CallbackFunctionName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public static string Name { get { throw null; } } + public System.Nullable StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public abstract partial class StreamBodyWriter : System.ServiceModel.Channels.BodyWriter + { + protected StreamBodyWriter(bool isBuffered) : base (default(bool)) { } + protected override System.ServiceModel.Channels.BodyWriter OnCreateBufferedCopy(int maxBufferSize) { throw null; } + protected abstract void OnWriteBodyContents(System.IO.Stream stream); + protected override void OnWriteBodyContents(System.Xml.XmlDictionaryWriter writer) { } + } + public sealed partial class WebBodyFormatMessageProperty : System.ServiceModel.Channels.IMessageProperty + { + public const string Name = "WebBodyFormatMessageProperty"; + public WebBodyFormatMessageProperty(System.ServiceModel.Channels.WebContentFormat format) { } + public System.ServiceModel.Channels.WebContentFormat Format { get { throw null; } } + public System.ServiceModel.Channels.IMessageProperty CreateCopy() { throw null; } + public override string ToString() { throw null; } + } + public enum WebContentFormat + { + Default = 0, + Json = 2, + Raw = 3, + Xml = 1, + } + public abstract partial class WebContentTypeMapper + { + protected WebContentTypeMapper() { } + public abstract System.ServiceModel.Channels.WebContentFormat GetMessageFormatForContentType(string contentType); + } + public sealed partial class WebMessageEncodingBindingElement : System.ServiceModel.Channels.MessageEncodingBindingElement, System.ServiceModel.Description.IWsdlExportExtension + { + public WebMessageEncodingBindingElement() { } + public WebMessageEncodingBindingElement(System.Text.Encoding writeEncoding) { } + public System.ServiceModel.Channels.WebContentTypeMapper ContentTypeMapper { get { throw null; } set { } } + public bool CrossDomainScriptAccessEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public int MaxReadPoolSize { get { throw null; } set { } } + public int MaxWritePoolSize { get { throw null; } set { } } + public override System.ServiceModel.Channels.MessageVersion MessageVersion { get { throw null; } set { } } + public System.Xml.XmlDictionaryReaderQuotas ReaderQuotas { get { throw null; } } + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + public override System.ServiceModel.Channels.IChannelFactory BuildChannelFactory(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override System.ServiceModel.Channels.IChannelListener BuildChannelListener(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override bool CanBuildChannelListener(System.ServiceModel.Channels.BindingContext context) { throw null; } + public override System.ServiceModel.Channels.BindingElement Clone() { throw null; } + public override System.ServiceModel.Channels.MessageEncoderFactory CreateMessageEncoderFactory() { throw null; } + public override T GetProperty(System.ServiceModel.Channels.BindingContext context) { throw null; } + void System.ServiceModel.Description.IWsdlExportExtension.ExportContract(System.ServiceModel.Description.WsdlExporter exporter, System.ServiceModel.Description.WsdlContractConversionContext context) { } + void System.ServiceModel.Description.IWsdlExportExtension.ExportEndpoint(System.ServiceModel.Description.WsdlExporter exporter, System.ServiceModel.Description.WsdlEndpointConversionContext context) { } + } +} +namespace System.ServiceModel.Configuration +{ + public partial class WebHttpBindingCollectionElement : System.ServiceModel.Configuration.StandardBindingCollectionElement + { + public WebHttpBindingCollectionElement() { } + protected internal override System.ServiceModel.Channels.Binding GetDefault() { throw null; } + } + public partial class WebHttpBindingElement : System.ServiceModel.Configuration.StandardBindingElement + { + public WebHttpBindingElement() { } + public WebHttpBindingElement(string name) { } + [System.Configuration.ConfigurationPropertyAttribute("allowCookies", DefaultValue=false)] + public bool AllowCookies { get { throw null; } set { } } + protected override System.Type BindingElementType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("bypassProxyOnLocal", DefaultValue=false)] + public bool BypassProxyOnLocal { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("contentTypeMapper", DefaultValue="")] + [System.Configuration.StringValidatorAttribute(MinLength=0)] + public string ContentTypeMapper { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("crossDomainScriptAccessEnabled", DefaultValue=false)] + public bool CrossDomainScriptAccessEnabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("hostNameComparisonMode", DefaultValue=(System.ServiceModel.HostNameComparisonMode)(0))] + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferPoolSize", DefaultValue=(long)524288)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)0)] + public long MaxBufferPoolSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferSize", DefaultValue=65536)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1)] + public int MaxBufferSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxReceivedMessageSize", DefaultValue=(long)65536)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)1)] + public long MaxReceivedMessageSize { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("proxyAddress", DefaultValue=null)] + public System.Uri ProxyAddress { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("readerQuotas")] + public System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement ReaderQuotas { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("security")] + public System.ServiceModel.Configuration.WebHttpSecurityElement Security { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("transferMode", DefaultValue=(System.ServiceModel.TransferMode)(0))] + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("useDefaultWebProxy", DefaultValue=true)] + public bool UseDefaultWebProxy { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.EncodingConverter")] + [System.Configuration.ConfigurationPropertyAttribute("writeEncoding", DefaultValue="utf-8")] + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + protected internal override void InitializeFrom(System.ServiceModel.Channels.Binding binding) { } + protected override void OnApplyConfiguration(System.ServiceModel.Channels.Binding binding) { } + } + public sealed partial class WebHttpElement : System.ServiceModel.Configuration.BehaviorExtensionElement + { + public WebHttpElement() { } + [System.Configuration.ConfigurationPropertyAttribute("automaticFormatSelectionEnabled")] + public bool AutomaticFormatSelectionEnabled { get { throw null; } set { } } + public override System.Type BehaviorType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("defaultBodyStyle")] + public System.ServiceModel.Web.WebMessageBodyStyle DefaultBodyStyle { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("defaultOutgoingResponseFormat")] + public System.ServiceModel.Web.WebMessageFormat DefaultOutgoingResponseFormat { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("faultExceptionEnabled")] + public bool FaultExceptionEnabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("helpEnabled")] + public bool HelpEnabled { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + protected internal override object CreateBehavior() { throw null; } + } + public partial class WebHttpEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public WebHttpEndpointCollectionElement() { } + } + public partial class WebHttpEndpointElement : System.ServiceModel.Configuration.StandardEndpointElement + { + public WebHttpEndpointElement() { } + [System.Configuration.ConfigurationPropertyAttribute("automaticFormatSelectionEnabled", DefaultValue=false)] + public bool AutomaticFormatSelectionEnabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("contentTypeMapper", DefaultValue="")] + [System.Configuration.StringValidatorAttribute(MinLength=0)] + public string ContentTypeMapper { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("crossDomainScriptAccessEnabled", DefaultValue=false)] + public bool CrossDomainScriptAccessEnabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("defaultOutgoingResponseFormat", DefaultValue=(System.ServiceModel.Web.WebMessageFormat)(0))] + public System.ServiceModel.Web.WebMessageFormat DefaultOutgoingResponseFormat { get { throw null; } set { } } + protected internal override System.Type EndpointType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("faultExceptionEnabled", DefaultValue=false)] + public bool FaultExceptionEnabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("helpEnabled", DefaultValue=false)] + public bool HelpEnabled { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("hostNameComparisonMode", DefaultValue=(System.ServiceModel.HostNameComparisonMode)(0))] + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferPoolSize", DefaultValue=(long)524288)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)0)] + public long MaxBufferPoolSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferSize", DefaultValue=65536)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1)] + public int MaxBufferSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxReceivedMessageSize", DefaultValue=(long)65536)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)1)] + public long MaxReceivedMessageSize { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("readerQuotas")] + public System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement ReaderQuotas { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("security")] + public System.ServiceModel.Configuration.WebHttpSecurityElement Security { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("transferMode", DefaultValue=(System.ServiceModel.TransferMode)(0))] + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.EncodingConverter")] + [System.Configuration.ConfigurationPropertyAttribute("writeEncoding", DefaultValue="utf-8")] + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } + public sealed partial class WebHttpSecurityElement : System.ServiceModel.Configuration.ServiceModelConfigurationElement + { + public WebHttpSecurityElement() { } + [System.Configuration.ConfigurationPropertyAttribute("mode", DefaultValue=(System.ServiceModel.WebHttpSecurityMode)(0))] + public System.ServiceModel.WebHttpSecurityMode Mode { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("transport")] + public System.ServiceModel.Configuration.HttpTransportSecurityElement Transport { get { throw null; } } + } + public sealed partial class WebMessageEncodingElement : System.ServiceModel.Configuration.BindingElementExtensionElement + { + public WebMessageEncodingElement() { } + public override System.Type BindingElementType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("maxReadPoolSize", DefaultValue=64)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1)] + public int MaxReadPoolSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxWritePoolSize", DefaultValue=16)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1)] + public int MaxWritePoolSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("readerQuotas")] + public System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement ReaderQuotas { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("webContentTypeMapperType", DefaultValue="")] + [System.Configuration.StringValidatorAttribute(MinLength=0)] + public string WebContentTypeMapperType { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.EncodingConverter")] + [System.Configuration.ConfigurationPropertyAttribute("writeEncoding", DefaultValue="utf-8")] + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + public override void ApplyConfiguration(System.ServiceModel.Channels.BindingElement bindingElement) { } + public override void CopyFrom(System.ServiceModel.Configuration.ServiceModelExtensionElement from) { } + protected internal override System.ServiceModel.Channels.BindingElement CreateBindingElement() { throw null; } + } + public sealed partial class WebScriptEnablingElement : System.ServiceModel.Configuration.BehaviorExtensionElement + { + public WebScriptEnablingElement() { } + public override System.Type BehaviorType { get { throw null; } } + protected internal override object CreateBehavior() { throw null; } + } + public partial class WebScriptEndpointCollectionElement : System.ServiceModel.Configuration.StandardEndpointCollectionElement + { + public WebScriptEndpointCollectionElement() { } + } + public partial class WebScriptEndpointElement : System.ServiceModel.Configuration.StandardEndpointElement + { + public WebScriptEndpointElement() { } + [System.Configuration.ConfigurationPropertyAttribute("contentTypeMapper", DefaultValue="")] + [System.Configuration.StringValidatorAttribute(MinLength=0)] + public string ContentTypeMapper { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("crossDomainScriptAccessEnabled", DefaultValue=false)] + public bool CrossDomainScriptAccessEnabled { get { throw null; } set { } } + protected internal override System.Type EndpointType { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("hostNameComparisonMode", DefaultValue=(System.ServiceModel.HostNameComparisonMode)(0))] + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferPoolSize", DefaultValue=(long)524288)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)0)] + public long MaxBufferPoolSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxBufferSize", DefaultValue=65536)] + [System.Configuration.IntegerValidatorAttribute(MinValue=1)] + public int MaxBufferSize { get { throw null; } set { } } + [System.Configuration.ConfigurationPropertyAttribute("maxReceivedMessageSize", DefaultValue=(long)65536)] + [System.Configuration.LongValidatorAttribute(MinValue=(long)1)] + public long MaxReceivedMessageSize { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("readerQuotas")] + public System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement ReaderQuotas { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("security")] + public System.ServiceModel.Configuration.WebHttpSecurityElement Security { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("transferMode", DefaultValue=(System.ServiceModel.TransferMode)(0))] + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + [System.ComponentModel.TypeConverterAttribute("System.ServiceModel.Configuration.EncodingConverter")] + [System.Configuration.ConfigurationPropertyAttribute("writeEncoding", DefaultValue="utf-8")] + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + protected internal override System.ServiceModel.Description.ServiceEndpoint CreateServiceEndpoint(System.ServiceModel.Description.ContractDescription contractDescription) { throw null; } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ChannelEndpointElement serviceEndpointElement) { } + protected override void OnApplyConfiguration(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ChannelEndpointElement channelEndpointElement) { } + protected override void OnInitializeAndValidate(System.ServiceModel.Configuration.ServiceEndpointElement serviceEndpointElement) { } + } +} +namespace System.ServiceModel.Description +{ + [System.Runtime.Serialization.DataContractAttribute] + public partial class JsonFaultDetail + { + public JsonFaultDetail() { } + [System.Runtime.Serialization.DataMemberAttribute(Name="ExceptionDetail")] + public System.ServiceModel.ExceptionDetail ExceptionDetail { get { throw null; } set { } } + [System.Runtime.Serialization.DataMemberAttribute(Name="ExceptionType")] + public string ExceptionType { get { throw null; } set { } } + [System.Runtime.Serialization.DataMemberAttribute(Name="Message")] + public string Message { get { throw null; } set { } } + [System.Runtime.Serialization.DataMemberAttribute(Name="StackTrace")] + public string StackTrace { get { throw null; } set { } } + } + public partial class WebHttpBehavior : System.ServiceModel.Description.IEndpointBehavior + { + public WebHttpBehavior() { } + public virtual bool AutomaticFormatSelectionEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual System.ServiceModel.Web.WebMessageBodyStyle DefaultBodyStyle { get { throw null; } set { } } + public virtual System.ServiceModel.Web.WebMessageFormat DefaultOutgoingRequestFormat { get { throw null; } set { } } + public virtual System.ServiceModel.Web.WebMessageFormat DefaultOutgoingResponseFormat { get { throw null; } set { } } + public virtual bool FaultExceptionEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual bool HelpEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected internal string JavascriptCallbackParameterName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public virtual void AddBindingParameters(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + protected virtual void AddClientErrorInspector(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + protected virtual void AddServerErrorHandlers(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { } + public virtual void ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + public virtual void ApplyDispatchBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { } + protected virtual System.ServiceModel.Dispatcher.WebHttpDispatchOperationSelector GetOperationSelector(System.ServiceModel.Description.ServiceEndpoint endpoint) { throw null; } + protected virtual System.ServiceModel.Dispatcher.QueryStringConverter GetQueryStringConverter(System.ServiceModel.Description.OperationDescription operationDescription) { throw null; } + protected virtual System.ServiceModel.Dispatcher.IClientMessageFormatter GetReplyClientFormatter(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Description.ServiceEndpoint endpoint) { throw null; } + protected virtual System.ServiceModel.Dispatcher.IDispatchMessageFormatter GetReplyDispatchFormatter(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Description.ServiceEndpoint endpoint) { throw null; } + protected virtual System.ServiceModel.Dispatcher.IClientMessageFormatter GetRequestClientFormatter(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Description.ServiceEndpoint endpoint) { throw null; } + protected virtual System.ServiceModel.Dispatcher.IDispatchMessageFormatter GetRequestDispatchFormatter(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Description.ServiceEndpoint endpoint) { throw null; } + public virtual void Validate(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + protected virtual void ValidateBinding(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + } + [System.Diagnostics.DebuggerDisplayAttribute("Address={address}")] + [System.Diagnostics.DebuggerDisplayAttribute("Name={name}")] + public partial class WebHttpEndpoint : System.ServiceModel.Description.WebServiceEndpoint + { + public WebHttpEndpoint(System.ServiceModel.Description.ContractDescription contract) { } + public WebHttpEndpoint(System.ServiceModel.Description.ContractDescription contract, System.ServiceModel.EndpointAddress address) { } + public bool AutomaticFormatSelectionEnabled { get { throw null; } set { } } + public System.ServiceModel.Web.WebMessageFormat DefaultOutgoingResponseFormat { get { throw null; } set { } } + public bool FaultExceptionEnabled { get { throw null; } set { } } + public bool HelpEnabled { get { throw null; } set { } } + protected override System.Type WebEndpointType { get { throw null; } } + } + public sealed partial class WebScriptEnablingBehavior : System.ServiceModel.Description.WebHttpBehavior + { + public WebScriptEnablingBehavior() { } + public override bool AutomaticFormatSelectionEnabled { get { throw null; } set { } } + public override System.ServiceModel.Web.WebMessageBodyStyle DefaultBodyStyle { get { throw null; } set { } } + public override System.ServiceModel.Web.WebMessageFormat DefaultOutgoingRequestFormat { get { throw null; } set { } } + public override System.ServiceModel.Web.WebMessageFormat DefaultOutgoingResponseFormat { get { throw null; } set { } } + public override bool FaultExceptionEnabled { get { throw null; } set { } } + public override bool HelpEnabled { get { throw null; } set { } } + protected override void AddClientErrorInspector(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + protected override void AddServerErrorHandlers(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { } + public override void ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + public override void ApplyDispatchBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { } + protected override System.ServiceModel.Dispatcher.QueryStringConverter GetQueryStringConverter(System.ServiceModel.Description.OperationDescription operationDescription) { throw null; } + public override void Validate(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + } + [System.Diagnostics.DebuggerDisplayAttribute("Address={address}")] + [System.Diagnostics.DebuggerDisplayAttribute("Name={name}")] + public partial class WebScriptEndpoint : System.ServiceModel.Description.WebServiceEndpoint + { + public WebScriptEndpoint(System.ServiceModel.Description.ContractDescription contract) { } + public WebScriptEndpoint(System.ServiceModel.Description.ContractDescription contract, System.ServiceModel.EndpointAddress address) { } + protected override System.Type WebEndpointType { get { throw null; } } + } + public abstract partial class WebServiceEndpoint : System.ServiceModel.Description.ServiceEndpoint + { + internal WebServiceEndpoint() : base (default(System.ServiceModel.Description.ContractDescription)) { } + public System.ServiceModel.Channels.WebContentTypeMapper ContentTypeMapper { get { throw null; } set { } } + public bool CrossDomainScriptAccessEnabled { get { throw null; } set { } } + public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } + public long MaxBufferPoolSize { get { throw null; } set { } } + public int MaxBufferSize { get { throw null; } set { } } + public long MaxReceivedMessageSize { get { throw null; } set { } } + public System.Xml.XmlDictionaryReaderQuotas ReaderQuotas { get { throw null; } set { } } + public System.ServiceModel.WebHttpSecurity Security { get { throw null; } } + public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } + protected abstract System.Type WebEndpointType { get; } + public System.Text.Encoding WriteEncoding { get { throw null; } set { } } + } +} +namespace System.ServiceModel.Dispatcher +{ + public partial class JsonQueryStringConverter : System.ServiceModel.Dispatcher.QueryStringConverter + { + public JsonQueryStringConverter() { } + public override bool CanConvert(System.Type type) { throw null; } + public override object ConvertStringToValue(string parameter, System.Type parameterType) { throw null; } + public override string ConvertValueToString(object parameter, System.Type parameterType) { throw null; } + } + public partial class QueryStringConverter + { + public QueryStringConverter() { } + public virtual bool CanConvert(System.Type type) { throw null; } + public virtual object ConvertStringToValue(string parameter, System.Type parameterType) { throw null; } + public virtual string ConvertValueToString(object parameter, System.Type parameterType) { throw null; } + } + public partial class WebHttpDispatchOperationSelector : System.ServiceModel.Dispatcher.IDispatchOperationSelector + { + public const string HttpOperationNamePropertyName = "HttpOperationName"; + public const string HttpOperationSelectorUriMatchedPropertyName = "UriMatched"; + protected WebHttpDispatchOperationSelector() { } + public WebHttpDispatchOperationSelector(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + public virtual System.UriTemplate GetUriTemplate(string operationName) { throw null; } + public string SelectOperation(ref System.ServiceModel.Channels.Message message) { throw null; } + protected virtual string SelectOperation(ref System.ServiceModel.Channels.Message message, out bool uriMatched) { uriMatched = default(bool); throw null; } + } +} +namespace System.ServiceModel.Web +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(64))] + public sealed partial class AspNetCacheProfileAttribute : System.Attribute, System.ServiceModel.Description.IOperationBehavior + { + public AspNetCacheProfileAttribute(string cacheProfileName) { } + public string CacheProfileName { get { throw null; } } + public void AddBindingParameters(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + public void ApplyClientBehavior(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Dispatcher.ClientOperation clientOperation) { } + public void ApplyDispatchBehavior(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Dispatcher.DispatchOperation dispatchOperation) { } + public void Validate(System.ServiceModel.Description.OperationDescription operationDescription) { } + } + public partial class IncomingWebRequestContext + { + internal IncomingWebRequestContext() { } + public string Accept { get { throw null; } } + public long ContentLength { get { throw null; } } + public string ContentType { get { throw null; } } + public System.Net.WebHeaderCollection Headers { get { throw null; } } + public System.Collections.Generic.IEnumerable IfMatch { get { throw null; } } + public System.Nullable IfModifiedSince { get { throw null; } } + public System.Collections.Generic.IEnumerable IfNoneMatch { get { throw null; } } + public System.Nullable IfUnmodifiedSince { get { throw null; } } + public string Method { get { throw null; } } + public System.UriTemplateMatch UriTemplateMatch { get { throw null; } set { } } + public string UserAgent { get { throw null; } } + public void CheckConditionalRetrieve(System.DateTime lastModified) { } + public void CheckConditionalRetrieve(System.Guid entityTag) { } + public void CheckConditionalRetrieve(int entityTag) { } + public void CheckConditionalRetrieve(long entityTag) { } + public void CheckConditionalRetrieve(string entityTag) { } + public void CheckConditionalUpdate(System.Guid entityTag) { } + public void CheckConditionalUpdate(int entityTag) { } + public void CheckConditionalUpdate(long entityTag) { } + public void CheckConditionalUpdate(string entityTag) { } + public System.Collections.ObjectModel.Collection GetAcceptHeaderElements() { throw null; } + } + public partial class IncomingWebResponseContext + { + internal IncomingWebResponseContext() { } + public long ContentLength { get { throw null; } } + public string ContentType { get { throw null; } } + public string ETag { get { throw null; } } + public System.Net.WebHeaderCollection Headers { get { throw null; } } + public string Location { get { throw null; } } + public System.Net.HttpStatusCode StatusCode { get { throw null; } } + public string StatusDescription { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class JavascriptCallbackBehaviorAttribute : System.Attribute, System.ServiceModel.Description.IContractBehavior + { + public JavascriptCallbackBehaviorAttribute() { } + public string UrlParameterName { get { throw null; } set { } } + public void AddBindingParameters(System.ServiceModel.Description.ContractDescription contractDescription, System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + public void ApplyClientBehavior(System.ServiceModel.Description.ContractDescription contractDescription, System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { } + public void ApplyDispatchBehavior(System.ServiceModel.Description.ContractDescription contractDescription, System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.DispatchRuntime dispatchRuntime) { } + public void Validate(System.ServiceModel.Description.ContractDescription contractDescription, System.ServiceModel.Description.ServiceEndpoint endpoint) { } + } + public partial class OutgoingWebRequestContext + { + internal OutgoingWebRequestContext() { } + public string Accept { get { throw null; } set { } } + public long ContentLength { get { throw null; } set { } } + public string ContentType { get { throw null; } set { } } + public System.Net.WebHeaderCollection Headers { get { throw null; } } + public string IfMatch { get { throw null; } set { } } + public string IfModifiedSince { get { throw null; } set { } } + public string IfNoneMatch { get { throw null; } set { } } + public string IfUnmodifiedSince { get { throw null; } set { } } + public string Method { get { throw null; } set { } } + public bool SuppressEntityBody { get { throw null; } set { } } + public string UserAgent { get { throw null; } set { } } + } + public partial class OutgoingWebResponseContext + { + internal OutgoingWebResponseContext() { } + public System.Text.Encoding BindingWriteEncoding { get { throw null; } } + public long ContentLength { get { throw null; } set { } } + public string ContentType { get { throw null; } set { } } + public string ETag { get { throw null; } set { } } + public System.Nullable Format { get { throw null; } set { } } + public System.Net.WebHeaderCollection Headers { get { throw null; } } + public System.DateTime LastModified { get { throw null; } set { } } + public string Location { get { throw null; } set { } } + public System.Net.HttpStatusCode StatusCode { get { throw null; } set { } } + public string StatusDescription { get { throw null; } set { } } + public bool SuppressEntityBody { get { throw null; } set { } } + public void SetETag(System.Guid entityTag) { } + public void SetETag(int entityTag) { } + public void SetETag(long entityTag) { } + public void SetETag(string entityTag) { } + public void SetStatusAsCreated(System.Uri locationUri) { } + public void SetStatusAsNotFound() { } + public void SetStatusAsNotFound(string description) { } + } + public partial class WebChannelFactory : System.ServiceModel.ChannelFactory where TChannel : class + { + public WebChannelFactory() { } + public WebChannelFactory(System.ServiceModel.Channels.Binding binding) { } + public WebChannelFactory(System.ServiceModel.Channels.Binding binding, System.Uri remoteAddress) { } + public WebChannelFactory(System.ServiceModel.Description.ServiceEndpoint endpoint) { } + public WebChannelFactory(string endpointConfigurationName) { } + public WebChannelFactory(string endpointConfigurationName, System.Uri remoteAddress) { } + public WebChannelFactory(System.Type channelType) { } + public WebChannelFactory(System.Uri remoteAddress) { } + protected override void OnOpening() { } + } + [System.SerializableAttribute] + public partial class WebFaultException : System.ServiceModel.FaultException + { + public WebFaultException(System.Net.HttpStatusCode statusCode) { } + protected WebFaultException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.Net.HttpStatusCode StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class WebFaultException : System.ServiceModel.FaultException + { + protected WebFaultException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base (default(T)) { } + public WebFaultException(T detail, System.Net.HttpStatusCode statusCode) : base (default(T)) { } + public WebFaultException(T detail, System.Net.HttpStatusCode statusCode, System.Collections.Generic.IEnumerable knownTypes) : base (default(T)) { } + public System.Net.HttpStatusCode StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.Security.SecurityCriticalAttribute] + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64))] + public sealed partial class WebGetAttribute : System.Attribute, System.ServiceModel.Description.IOperationBehavior + { + public WebGetAttribute() { } + public System.ServiceModel.Web.WebMessageBodyStyle BodyStyle { get { throw null; } set { } } + public bool IsBodyStyleSetExplicitly { get { throw null; } } + public bool IsRequestFormatSetExplicitly { get { throw null; } } + public bool IsResponseFormatSetExplicitly { get { throw null; } } + public System.ServiceModel.Web.WebMessageFormat RequestFormat { get { throw null; } set { } } + public System.ServiceModel.Web.WebMessageFormat ResponseFormat { get { throw null; } set { } } + public string UriTemplate { get { throw null; } set { } } + void System.ServiceModel.Description.IOperationBehavior.AddBindingParameters(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + void System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Dispatcher.ClientOperation clientOperation) { } + void System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Dispatcher.DispatchOperation dispatchOperation) { } + void System.ServiceModel.Description.IOperationBehavior.Validate(System.ServiceModel.Description.OperationDescription operationDescription) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(64))] + public sealed partial class WebInvokeAttribute : System.Attribute, System.ServiceModel.Description.IOperationBehavior + { + public WebInvokeAttribute() { } + public System.ServiceModel.Web.WebMessageBodyStyle BodyStyle { get { throw null; } set { } } + public bool IsBodyStyleSetExplicitly { get { throw null; } } + public bool IsRequestFormatSetExplicitly { get { throw null; } } + public bool IsResponseFormatSetExplicitly { get { throw null; } } + public string Method { get { throw null; } set { } } + public System.ServiceModel.Web.WebMessageFormat RequestFormat { get { throw null; } set { } } + public System.ServiceModel.Web.WebMessageFormat ResponseFormat { get { throw null; } set { } } + public string UriTemplate { get { throw null; } set { } } + void System.ServiceModel.Description.IOperationBehavior.AddBindingParameters(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { } + void System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Dispatcher.ClientOperation clientOperation) { } + void System.ServiceModel.Description.IOperationBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.OperationDescription operationDescription, System.ServiceModel.Dispatcher.DispatchOperation dispatchOperation) { } + void System.ServiceModel.Description.IOperationBehavior.Validate(System.ServiceModel.Description.OperationDescription operationDescription) { } + } + public enum WebMessageBodyStyle + { + Bare = 0, + Wrapped = 1, + WrappedRequest = 2, + WrappedResponse = 3, + } + public enum WebMessageFormat + { + Json = 1, + Xml = 0, + } + public partial class WebOperationContext : System.ServiceModel.IExtension + { + public WebOperationContext(System.ServiceModel.OperationContext operationContext) { } + public static System.ServiceModel.Web.WebOperationContext Current { get { throw null; } } + public System.ServiceModel.Web.IncomingWebRequestContext IncomingRequest { get { throw null; } } + public System.ServiceModel.Web.IncomingWebResponseContext IncomingResponse { get { throw null; } } + public System.ServiceModel.Web.OutgoingWebRequestContext OutgoingRequest { get { throw null; } } + public System.ServiceModel.Web.OutgoingWebResponseContext OutgoingResponse { get { throw null; } } + public void Attach(System.ServiceModel.OperationContext owner) { } + public System.ServiceModel.Channels.Message CreateAtom10Response(System.ServiceModel.Syndication.ServiceDocument document) { throw null; } + public System.ServiceModel.Channels.Message CreateAtom10Response(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + public System.ServiceModel.Channels.Message CreateAtom10Response(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + public System.ServiceModel.Channels.Message CreateJsonResponse(T instance) { throw null; } + public System.ServiceModel.Channels.Message CreateJsonResponse(T instance, System.Runtime.Serialization.Json.DataContractJsonSerializer serializer) { throw null; } + public System.ServiceModel.Channels.Message CreateStreamResponse(System.Action streamWriter, string contentType) { throw null; } + public System.ServiceModel.Channels.Message CreateStreamResponse(System.IO.Stream stream, string contentType) { throw null; } + public System.ServiceModel.Channels.Message CreateStreamResponse(System.ServiceModel.Channels.StreamBodyWriter bodyWriter, string contentType) { throw null; } + public System.ServiceModel.Channels.Message CreateTextResponse(System.Action textWriter, string contentType) { throw null; } + public System.ServiceModel.Channels.Message CreateTextResponse(System.Action textWriter, string contentType, System.Text.Encoding encoding) { throw null; } + public System.ServiceModel.Channels.Message CreateTextResponse(string text) { throw null; } + public System.ServiceModel.Channels.Message CreateTextResponse(string text, string contentType) { throw null; } + public System.ServiceModel.Channels.Message CreateTextResponse(string text, string contentType, System.Text.Encoding encoding) { throw null; } + public System.ServiceModel.Channels.Message CreateXmlResponse(System.Xml.Linq.XDocument document) { throw null; } + public System.ServiceModel.Channels.Message CreateXmlResponse(System.Xml.Linq.XElement element) { throw null; } + public System.ServiceModel.Channels.Message CreateXmlResponse(T instance) { throw null; } + public System.ServiceModel.Channels.Message CreateXmlResponse(T instance, System.Runtime.Serialization.XmlObjectSerializer serializer) { throw null; } + public System.ServiceModel.Channels.Message CreateXmlResponse(T instance, System.Xml.Serialization.XmlSerializer serializer) { throw null; } + public void Detach(System.ServiceModel.OperationContext owner) { } + public System.UriTemplate GetUriTemplate(string operationName) { throw null; } + } + public partial class WebServiceHost : System.ServiceModel.ServiceHost + { + public WebServiceHost() { } + public WebServiceHost(object singletonInstance, params System.Uri[] baseAddresses) { } + public WebServiceHost(System.Type serviceType, params System.Uri[] baseAddresses) { } + protected override void OnOpening() { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.cs.REMOVED.git-id new file mode 100644 index 0000000000..22749ed80d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.cs.REMOVED.git-id @@ -0,0 +1 @@ +1815970e2717f20ef72ac1b82c4278a24288cfea \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.extra.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.extra.cs new file mode 100644 index 0000000000..3c5fa1c367 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceModel.extra.cs @@ -0,0 +1,7 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Discovery, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Routing, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.ServiceProcess.cs b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceProcess.cs new file mode 100644 index 0000000000..9cb1445c6e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.ServiceProcess.cs @@ -0,0 +1,338 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceProcess.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.ServiceProcess.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.ServiceProcess.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.ServiceProcess +{ + public enum PowerBroadcastStatus + { + BatteryLow = 9, + OemEvent = 11, + PowerStatusChange = 10, + QuerySuspend = 0, + QuerySuspendFailed = 2, + ResumeAutomatic = 18, + ResumeCritical = 6, + ResumeSuspend = 7, + Suspend = 4, + } + public enum ServiceAccount + { + LocalService = 0, + LocalSystem = 2, + NetworkService = 1, + User = 3, + } + [System.ComponentModel.InstallerTypeAttribute(typeof(System.ServiceProcess.ServiceProcessInstaller))] + public partial class ServiceBase : System.ComponentModel.Component + { + public const int MaxNameLength = 80; + public ServiceBase() { } + [System.ComponentModel.DefaultValueAttribute(true)] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SBAutoLog")] + public bool AutoLog { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanHandlePowerEvent { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public bool CanHandleSessionChangeEvent { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanPauseAndContinue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanShutdown { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + public bool CanStop { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public virtual System.Diagnostics.EventLog EventLog { get { throw null; } } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public int ExitCode { get { throw null; } set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + protected System.IntPtr ServiceHandle { get { throw null; } } + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SBServiceName")] + public string ServiceName { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected virtual void OnContinue() { } + protected virtual void OnCustomCommand(int command) { } + protected virtual void OnPause() { } + protected virtual bool OnPowerEvent(System.ServiceProcess.PowerBroadcastStatus powerStatus) { throw null; } + protected virtual void OnSessionChange(System.ServiceProcess.SessionChangeDescription changeDescription) { } + protected virtual void OnShutdown() { } + protected virtual void OnStart(string[] args) { } + protected virtual void OnStop() { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void RequestAdditionalTime(int milliseconds) { } + public static void Run(System.ServiceProcess.ServiceBase service) { } + public static void Run(System.ServiceProcess.ServiceBase[] services) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void ServiceMainCallback(int argCount, System.IntPtr argPointer) { } + public void Stop() { } + } + [System.ComponentModel.DesignerAttribute("System.ServiceProcess.Design.ServiceControllerDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceControllerDesc")] + public partial class ServiceController : System.ComponentModel.Component + { + public ServiceController() { } + public ServiceController(string name) { } + public ServiceController(string name, string machineName) { } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPCanPauseAndContinue")] + public bool CanPauseAndContinue { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPCanShutdown")] + public bool CanShutdown { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPCanStop")] + public bool CanStop { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPDependentServices")] + public System.ServiceProcess.ServiceController[] DependentServices { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPDisplayName")] + public string DisplayName { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(".")] + [System.ComponentModel.SettingsBindableAttribute(true)] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPMachineName")] + public string MachineName { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public System.Runtime.InteropServices.SafeHandle ServiceHandle { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ComponentModel.SettingsBindableAttribute(true)] + [System.ComponentModel.TypeConverterAttribute("System.ServiceProcess.Design.ServiceNameConverter")] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPServiceName")] + public string ServiceName { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPServicesDependedOn")] + public System.ServiceProcess.ServiceController[] ServicesDependedOn { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPServiceType")] + public System.ServiceProcess.ServiceType ServiceType { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPStartType")] + public System.ServiceProcess.ServiceStartMode StartType { get { throw null; } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("SPStatus")] + public System.ServiceProcess.ServiceControllerStatus Status { get { throw null; } } + public void Close() { } + public void Continue() { } + protected override void Dispose(bool disposing) { } + public void ExecuteCommand(int command) { } + public static System.ServiceProcess.ServiceController[] GetDevices() { throw null; } + public static System.ServiceProcess.ServiceController[] GetDevices(string machineName) { throw null; } + public static System.ServiceProcess.ServiceController[] GetServices() { throw null; } + public static System.ServiceProcess.ServiceController[] GetServices(string machineName) { throw null; } + public void Pause() { } + public void Refresh() { } + public void Start() { } + public void Start(string[] args) { } + public void Stop() { } + public void WaitForStatus(System.ServiceProcess.ServiceControllerStatus desiredStatus) { } + public void WaitForStatus(System.ServiceProcess.ServiceControllerStatus desiredStatus, System.TimeSpan timeout) { } + } + [System.SerializableAttribute] + public sealed partial class ServiceControllerPermission : System.Security.Permissions.ResourcePermissionBase + { + public ServiceControllerPermission() { } + public ServiceControllerPermission(System.Security.Permissions.PermissionState state) { } + public ServiceControllerPermission(System.ServiceProcess.ServiceControllerPermissionAccess permissionAccess, string machineName, string serviceName) { } + public ServiceControllerPermission(System.ServiceProcess.ServiceControllerPermissionEntry[] permissionAccessEntries) { } + public System.ServiceProcess.ServiceControllerPermissionEntryCollection PermissionEntries { get { throw null; } } + } + [System.FlagsAttribute] + public enum ServiceControllerPermissionAccess + { + Browse = 2, + Control = 6, + None = 0, + } + [System.AttributeUsageAttribute((System.AttributeTargets)(621), AllowMultiple=true, Inherited=false)] + [System.SerializableAttribute] + public partial class ServiceControllerPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public ServiceControllerPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public string MachineName { get { throw null; } set { } } + public System.ServiceProcess.ServiceControllerPermissionAccess PermissionAccess { get { throw null; } set { } } + public string ServiceName { get { throw null; } set { } } + public override System.Security.IPermission CreatePermission() { throw null; } + } + [System.SerializableAttribute] + public partial class ServiceControllerPermissionEntry + { + public ServiceControllerPermissionEntry() { } + public ServiceControllerPermissionEntry(System.ServiceProcess.ServiceControllerPermissionAccess permissionAccess, string machineName, string serviceName) { } + public string MachineName { get { throw null; } } + public System.ServiceProcess.ServiceControllerPermissionAccess PermissionAccess { get { throw null; } } + public string ServiceName { get { throw null; } } + } + [System.SerializableAttribute] + public partial class ServiceControllerPermissionEntryCollection : System.Collections.CollectionBase + { + internal ServiceControllerPermissionEntryCollection() { } + public System.ServiceProcess.ServiceControllerPermissionEntry this[int index] { get { throw null; } set { } } + public int Add(System.ServiceProcess.ServiceControllerPermissionEntry value) { throw null; } + public void AddRange(System.ServiceProcess.ServiceControllerPermissionEntryCollection value) { } + public void AddRange(System.ServiceProcess.ServiceControllerPermissionEntry[] value) { } + public bool Contains(System.ServiceProcess.ServiceControllerPermissionEntry value) { throw null; } + public void CopyTo(System.ServiceProcess.ServiceControllerPermissionEntry[] array, int index) { } + public int IndexOf(System.ServiceProcess.ServiceControllerPermissionEntry value) { throw null; } + public void Insert(int index, System.ServiceProcess.ServiceControllerPermissionEntry value) { } + protected override void OnClear() { } + protected override void OnInsert(int index, object value) { } + protected override void OnRemove(int index, object value) { } + protected override void OnSet(int index, object oldValue, object newValue) { } + public void Remove(System.ServiceProcess.ServiceControllerPermissionEntry value) { } + } + public enum ServiceControllerStatus + { + ContinuePending = 5, + Paused = 7, + PausePending = 6, + Running = 4, + StartPending = 2, + Stopped = 1, + StopPending = 3, + } + public partial class ServiceInstaller : System.Configuration.Install.ComponentInstaller + { + public ServiceInstaller() { } + [System.ComponentModel.DefaultValueAttribute(false)] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceInstallerDelayedAutoStart")] + public bool DelayedAutoStart { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceInstallerDescription")] + public string Description { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceInstallerDisplayName")] + public string DisplayName { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceInstallerServiceName")] + public string ServiceName { get { throw null; } set { } } + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceInstallerServicesDependedOn")] + public string[] ServicesDependedOn { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute((System.ServiceProcess.ServiceStartMode)(3))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceInstallerStartType")] + public System.ServiceProcess.ServiceStartMode StartType { get { throw null; } set { } } + public override void CopyFromComponent(System.ComponentModel.IComponent component) { } + public override void Install(System.Collections.IDictionary stateSaver) { } + public override bool IsEquivalentInstaller(System.Configuration.Install.ComponentInstaller otherInstaller) { throw null; } + public override void Rollback(System.Collections.IDictionary savedState) { } + public override void Uninstall(System.Collections.IDictionary savedState) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32767))] + public partial class ServiceProcessDescriptionAttribute : System.ComponentModel.DescriptionAttribute + { + public ServiceProcessDescriptionAttribute(string description) { } + public override string Description { get { throw null; } } + } + public partial class ServiceProcessInstaller : System.Configuration.Install.ComponentInstaller + { + public ServiceProcessInstaller() { } + [System.ComponentModel.DefaultValueAttribute((System.ServiceProcess.ServiceAccount)(3))] + [System.ServiceProcess.ServiceProcessDescriptionAttribute("ServiceProcessInstallerAccount")] + public System.ServiceProcess.ServiceAccount Account { get { throw null; } set { } } + public override string HelpText { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public string Password { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.TypeConverterAttribute("System.Diagnostics.Design.StringValueConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public string Username { get { throw null; } set { } } + public override void CopyFromComponent(System.ComponentModel.IComponent comp) { } + public override void Install(System.Collections.IDictionary stateSaver) { } + public override void Rollback(System.Collections.IDictionary savedState) { } + } + public enum ServiceStartMode + { + Automatic = 2, + Boot = 0, + Disabled = 4, + Manual = 3, + System = 1, + } + [System.FlagsAttribute] + public enum ServiceType + { + Adapter = 4, + FileSystemDriver = 2, + InteractiveProcess = 256, + KernelDriver = 1, + RecognizerDriver = 8, + Win32OwnProcess = 16, + Win32ShareProcess = 32, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct SessionChangeDescription + { + public System.ServiceProcess.SessionChangeReason Reason { get { throw null; } } + public int SessionId { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.ServiceProcess.SessionChangeDescription changeDescription) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.ServiceProcess.SessionChangeDescription a, System.ServiceProcess.SessionChangeDescription b) { throw null; } + public static bool operator !=(System.ServiceProcess.SessionChangeDescription a, System.ServiceProcess.SessionChangeDescription b) { throw null; } + } + public enum SessionChangeReason + { + ConsoleConnect = 1, + ConsoleDisconnect = 2, + RemoteConnect = 3, + RemoteDisconnect = 4, + SessionLock = 7, + SessionLogoff = 6, + SessionLogon = 5, + SessionRemoteControl = 9, + SessionUnlock = 8, + } + [System.SerializableAttribute] + public partial class TimeoutException : System.SystemException + { + public TimeoutException() { } + protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TimeoutException(string message) { } + public TimeoutException(string message, System.Exception innerException) { } + } +} +namespace System.ServiceProcess.Design +{ + public partial class ServiceInstallerDialog : System.Windows.Forms.Form + { + public ServiceInstallerDialog() { } + public string Password { get { throw null; } set { } } + public System.ServiceProcess.Design.ServiceInstallerDialogResult Result { get { throw null; } } + public string Username { get { throw null; } set { } } + [System.STAThreadAttribute] + public static void Main() { } + } + public enum ServiceInstallerDialogResult + { + Canceled = 2, + OK = 0, + UseSystem = 1, + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Transactions.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Transactions.cs new file mode 100644 index 0000000000..97cc769285 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Transactions.cs @@ -0,0 +1,349 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Transactions.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Transactions.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Transactions.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.BestFitMappingAttribute(false)] +[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum)] +namespace System.Transactions +{ + [System.SerializableAttribute] + public sealed partial class CommittableTransaction : System.Transactions.Transaction, System.IAsyncResult + { + public CommittableTransaction() { } + public CommittableTransaction(System.TimeSpan timeout) { } + public CommittableTransaction(System.Transactions.TransactionOptions options) { } + object System.IAsyncResult.AsyncState { get { throw null; } } + System.Threading.WaitHandle System.IAsyncResult.AsyncWaitHandle { get { throw null; } } + bool System.IAsyncResult.CompletedSynchronously { get { throw null; } } + bool System.IAsyncResult.IsCompleted { get { throw null; } } + public System.IAsyncResult BeginCommit(System.AsyncCallback asyncCallback, object asyncState) { throw null; } + public void Commit() { } + public void EndCommit(System.IAsyncResult asyncResult) { } + } + public enum DependentCloneOption + { + BlockCommitUntilComplete = 0, + RollbackIfNotComplete = 1, + } + [System.SerializableAttribute] + public sealed partial class DependentTransaction : System.Transactions.Transaction + { + internal DependentTransaction() { } + public void Complete() { } + } + [System.SerializableAttribute] + public sealed partial class DistributedTransactionPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public DistributedTransactionPermission(System.Security.Permissions.PermissionState state) { } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement securityElement) { } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission target) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] + public sealed partial class DistributedTransactionPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute + { + public DistributedTransactionPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { } + public new bool Unrestricted { get { throw null; } set { } } + public override System.Security.IPermission CreatePermission() { throw null; } + } + public partial class Enlistment + { + internal Enlistment() { } + public void Done() { } + } + [System.FlagsAttribute] + public enum EnlistmentOptions + { + EnlistDuringPrepareRequired = 1, + None = 0, + } + public enum EnterpriseServicesInteropOption + { + Automatic = 1, + Full = 2, + None = 0, + } + public delegate System.Transactions.Transaction HostCurrentTransactionCallback(); + [System.Runtime.InteropServices.GuidAttribute("0fb15084-af41-11ce-bd2b-204c4f4f5020")] + [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))] + public partial interface IDtcTransaction + { + void Abort(System.IntPtr reason, int retaining, int async); + void Commit(int retaining, [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.I4)]int commitType, int reserved); + void GetTransactionInfo(System.IntPtr transactionInformation); + } + public partial interface IEnlistmentNotification + { + void Commit(System.Transactions.Enlistment enlistment); + void InDoubt(System.Transactions.Enlistment enlistment); + void Prepare(System.Transactions.PreparingEnlistment preparingEnlistment); + void Rollback(System.Transactions.Enlistment enlistment); + } + public partial interface IPromotableSinglePhaseNotification : System.Transactions.ITransactionPromoter + { + void Initialize(); + void Rollback(System.Transactions.SinglePhaseEnlistment singlePhaseEnlistment); + void SinglePhaseCommit(System.Transactions.SinglePhaseEnlistment singlePhaseEnlistment); + } + public partial interface ISimpleTransactionSuperior : System.Transactions.ITransactionPromoter + { + void Rollback(); + } + public partial interface ISinglePhaseNotification : System.Transactions.IEnlistmentNotification + { + void SinglePhaseCommit(System.Transactions.SinglePhaseEnlistment singlePhaseEnlistment); + } + public enum IsolationLevel + { + Chaos = 5, + ReadCommitted = 2, + ReadUncommitted = 3, + RepeatableRead = 1, + Serializable = 0, + Snapshot = 4, + Unspecified = 6, + } + public partial interface ITransactionPromoter + { + byte[] Promote(); + } + public partial class PreparingEnlistment : System.Transactions.Enlistment + { + internal PreparingEnlistment() { } + public void ForceRollback() { } + public void ForceRollback(System.Exception e) { } + public void Prepared() { } + public byte[] RecoveryInformation() { throw null; } + } + public partial class SinglePhaseEnlistment : System.Transactions.Enlistment + { + internal SinglePhaseEnlistment() { } + public void Aborted() { } + public void Aborted(System.Exception e) { } + public void Committed() { } + public void InDoubt() { } + public void InDoubt(System.Exception e) { } + } + [System.SerializableAttribute] + public sealed partial class SubordinateTransaction : System.Transactions.Transaction + { + public SubordinateTransaction(System.Transactions.IsolationLevel isoLevel, System.Transactions.ISimpleTransactionSuperior superior) { } + } + [System.SerializableAttribute] + public partial class Transaction : System.IDisposable, System.Runtime.Serialization.ISerializable + { + internal Transaction() { } + public static System.Transactions.Transaction Current { get { throw null; } set { } } + public System.Transactions.IsolationLevel IsolationLevel { get { throw null; } } + public System.Guid PromoterType { get { throw null; } } + public System.Transactions.TransactionInformation TransactionInformation { get { throw null; } } + public event System.Transactions.TransactionCompletedEventHandler TransactionCompleted { add { } remove { } } + public System.Transactions.Transaction Clone() { throw null; } + public System.Transactions.DependentTransaction DependentClone(System.Transactions.DependentCloneOption cloneOption) { throw null; } + public void Dispose() { } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public System.Transactions.Enlistment EnlistDurable(System.Guid resourceManagerIdentifier, System.Transactions.IEnlistmentNotification enlistmentNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public System.Transactions.Enlistment EnlistDurable(System.Guid resourceManagerIdentifier, System.Transactions.ISinglePhaseNotification singlePhaseNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public bool EnlistPromotableSinglePhase(System.Transactions.IPromotableSinglePhaseNotification promotableSinglePhaseNotification) { throw null; } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public bool EnlistPromotableSinglePhase(System.Transactions.IPromotableSinglePhaseNotification promotableSinglePhaseNotification, System.Guid promoterType) { throw null; } + public System.Transactions.Enlistment EnlistVolatile(System.Transactions.IEnlistmentNotification enlistmentNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; } + public System.Transactions.Enlistment EnlistVolatile(System.Transactions.ISinglePhaseNotification singlePhaseNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public byte[] GetPromotedToken() { throw null; } + public static bool operator ==(System.Transactions.Transaction x, System.Transactions.Transaction y) { throw null; } + public static bool operator !=(System.Transactions.Transaction x, System.Transactions.Transaction y) { throw null; } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public System.Transactions.Enlistment PromoteAndEnlistDurable(System.Guid resourceManagerIdentifier, System.Transactions.IPromotableSinglePhaseNotification promotableNotification, System.Transactions.ISinglePhaseNotification enlistmentNotification, System.Transactions.EnlistmentOptions enlistmentOptions) { throw null; } + public void Rollback() { } + public void Rollback(System.Exception e) { } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public void SetDistributedTransactionIdentifier(System.Transactions.IPromotableSinglePhaseNotification promotableNotification, System.Guid distributedTransactionIdentifier) { } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class TransactionAbortedException : System.Transactions.TransactionException + { + public TransactionAbortedException() { } + protected TransactionAbortedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TransactionAbortedException(string message) { } + public TransactionAbortedException(string message, System.Exception innerException) { } + } + public delegate void TransactionCompletedEventHandler(object sender, System.Transactions.TransactionEventArgs e); + public partial class TransactionEventArgs : System.EventArgs + { + public TransactionEventArgs() { } + public System.Transactions.Transaction Transaction { get { throw null; } } + } + [System.SerializableAttribute] + public partial class TransactionException : System.SystemException + { + public TransactionException() { } + protected TransactionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TransactionException(string message) { } + public TransactionException(string message, System.Exception innerException) { } + } + [System.SerializableAttribute] + public partial class TransactionInDoubtException : System.Transactions.TransactionException + { + public TransactionInDoubtException() { } + protected TransactionInDoubtException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TransactionInDoubtException(string message) { } + public TransactionInDoubtException(string message, System.Exception innerException) { } + } + public partial class TransactionInformation + { + internal TransactionInformation() { } + public System.DateTime CreationTime { get { throw null; } } + public System.Guid DistributedIdentifier { get { throw null; } } + public string LocalIdentifier { get { throw null; } } + public System.Transactions.TransactionStatus Status { get { throw null; } } + } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public static partial class TransactionInterop + { + public static readonly System.Guid PromoterTypeDtc; + public static System.Transactions.IDtcTransaction GetDtcTransaction(System.Transactions.Transaction transaction) { throw null; } + public static byte[] GetExportCookie(System.Transactions.Transaction transaction, byte[] whereabouts) { throw null; } + public static System.Transactions.Transaction GetTransactionFromDtcTransaction(System.Transactions.IDtcTransaction transactionNative) { throw null; } + public static System.Transactions.Transaction GetTransactionFromExportCookie(byte[] cookie) { throw null; } + public static System.Transactions.Transaction GetTransactionFromTransmitterPropagationToken(byte[] propagationToken) { throw null; } + public static byte[] GetTransmitterPropagationToken(System.Transactions.Transaction transaction) { throw null; } + public static byte[] GetWhereabouts() { throw null; } + } + public static partial class TransactionManager + { + public static System.TimeSpan DefaultTimeout { get { throw null; } } + public static System.Transactions.HostCurrentTransactionCallback HostCurrentCallback { [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]get { throw null; } [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]set { } } + public static System.TimeSpan MaximumTimeout { get { throw null; } } + public static event System.Transactions.TransactionStartedEventHandler DistributedTransactionStarted { add { } remove { } } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public static void RecoveryComplete(System.Guid resourceManagerIdentifier) { } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public static System.Transactions.Enlistment Reenlist(System.Guid resourceManagerIdentifier, byte[] recoveryInformation, System.Transactions.IEnlistmentNotification enlistmentNotification) { throw null; } + } + [System.SerializableAttribute] + public partial class TransactionManagerCommunicationException : System.Transactions.TransactionException + { + public TransactionManagerCommunicationException() { } + protected TransactionManagerCommunicationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TransactionManagerCommunicationException(string message) { } + public TransactionManagerCommunicationException(string message, System.Exception innerException) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct TransactionOptions + { + public System.Transactions.IsolationLevel IsolationLevel { get { throw null; } set { } } + public System.TimeSpan Timeout { get { throw null; } set { } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Transactions.TransactionOptions x, System.Transactions.TransactionOptions y) { throw null; } + public static bool operator !=(System.Transactions.TransactionOptions x, System.Transactions.TransactionOptions y) { throw null; } + } + [System.SerializableAttribute] + public partial class TransactionPromotionException : System.Transactions.TransactionException + { + public TransactionPromotionException() { } + protected TransactionPromotionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TransactionPromotionException(string message) { } + public TransactionPromotionException(string message, System.Exception innerException) { } + } + public sealed partial class TransactionScope : System.IDisposable + { + public TransactionScope() { } + public TransactionScope(System.Transactions.Transaction transactionToUse) { } + public TransactionScope(System.Transactions.Transaction transactionToUse, System.TimeSpan scopeTimeout) { } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public TransactionScope(System.Transactions.Transaction transactionToUse, System.TimeSpan scopeTimeout, System.Transactions.EnterpriseServicesInteropOption interopOption) { } + public TransactionScope(System.Transactions.Transaction transactionToUse, System.TimeSpan scopeTimeout, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { } + public TransactionScope(System.Transactions.Transaction transactionToUse, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { } + public TransactionScope(System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { } + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption) { } + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.TimeSpan scopeTimeout) { } + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.TimeSpan scopeTimeout, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { } + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions) { } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions, System.Transactions.EnterpriseServicesInteropOption interopOption) { } + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionOptions transactionOptions, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { } + public TransactionScope(System.Transactions.TransactionScopeOption scopeOption, System.Transactions.TransactionScopeAsyncFlowOption asyncFlowOption) { } + public void Complete() { } + public void Dispose() { } + } + public enum TransactionScopeAsyncFlowOption + { + Enabled = 1, + Suppress = 0, + } + public enum TransactionScopeOption + { + Required = 0, + RequiresNew = 1, + Suppress = 2, + } + public delegate void TransactionStartedEventHandler(object sender, System.Transactions.TransactionEventArgs e); + public enum TransactionStatus + { + Aborted = 2, + Active = 0, + Committed = 1, + InDoubt = 3, + } +} +namespace System.Transactions.Configuration +{ + public sealed partial class DefaultSettingsSection : System.Configuration.ConfigurationSection + { + public DefaultSettingsSection() { } + [System.Configuration.ConfigurationPropertyAttribute("distributedTransactionManagerName", DefaultValue="")] + public string DistributedTransactionManagerName { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("timeout", DefaultValue="00:01:00")] + [System.Configuration.TimeSpanValidatorAttribute(MinValueString="00:00:00", MaxValueString="10675199.02:48:05.4775807")] + public System.TimeSpan Timeout { get { throw null; } set { } } + } + public sealed partial class MachineSettingsSection : System.Configuration.ConfigurationSection + { + public MachineSettingsSection() { } + [System.Configuration.ConfigurationPropertyAttribute("maxTimeout", DefaultValue="00:10:00")] + [System.Configuration.TimeSpanValidatorAttribute(MinValueString="00:00:00", MaxValueString="10675199.02:48:05.4775807")] + public System.TimeSpan MaxTimeout { get { throw null; } set { } } + protected override System.Configuration.ConfigurationPropertyCollection Properties { get { throw null; } } + } + public sealed partial class TransactionsSectionGroup : System.Configuration.ConfigurationSectionGroup + { + public TransactionsSectionGroup() { } + [System.Configuration.ConfigurationPropertyAttribute("defaultSettings")] + public System.Transactions.Configuration.DefaultSettingsSection DefaultSettings { get { throw null; } } + [System.Configuration.ConfigurationPropertyAttribute("machineSettings")] + public System.Transactions.Configuration.MachineSettingsSection MachineSettings { get { throw null; } } + public static System.Transactions.Configuration.TransactionsSectionGroup GetSectionGroup(System.Configuration.Configuration config) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.Abstractions.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Abstractions.cs new file mode 100644 index 0000000000..d80f53401a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Abstractions.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.Abstractions.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.Abstractions.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Abstractions.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute(PartialTrustVisibilityLevel=(System.Security.PartialTrustVisibilityLevel)(1))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpApplicationStateBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpApplicationStateWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpBrowserCapabilitiesBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpBrowserCapabilitiesWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpCachePolicyBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpCachePolicyWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpContextBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpContextWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpFileCollectionBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpFileCollectionWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpPostedFileBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpPostedFileWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpRequestBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpRequestWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpResponseBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpResponseWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpServerUtilityBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpServerUtilityWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpSessionStateBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpSessionStateWrapper))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpStaticObjectsCollectionBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.HttpStaticObjectsCollectionWrapper))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.ApplicationServices.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.ApplicationServices.cs new file mode 100644 index 0000000000..7e164658fb --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.ApplicationServices.cs @@ -0,0 +1,208 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.ApplicationServices.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.ApplicationServices.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.ApplicationServices.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute(PartialTrustVisibilityLevel=(System.Security.PartialTrustVisibilityLevel)(1))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +namespace System.Web.Configuration +{ + public enum MembershipPasswordCompatibilityMode + { + Framework20 = 0, + Framework40 = 1, + } +} +namespace System.Web.Hosting +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=false)] + public sealed partial class CustomLoaderAttribute : System.Attribute + { + public CustomLoaderAttribute(System.Type customLoaderType) { } + public System.Type CustomLoaderType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } +} +namespace System.Web.Security +{ + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public enum MembershipCreateStatus + { + DuplicateEmail = 7, + DuplicateProviderUserKey = 10, + DuplicateUserName = 6, + InvalidAnswer = 4, + InvalidEmail = 5, + InvalidPassword = 2, + InvalidProviderUserKey = 9, + InvalidQuestion = 3, + InvalidUserName = 1, + ProviderError = 11, + Success = 0, + UserRejected = 8, + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.SerializableAttribute] + public partial class MembershipCreateUserException : System.Exception + { + public MembershipCreateUserException() { } + protected MembershipCreateUserException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public MembershipCreateUserException(string message) { } + public MembershipCreateUserException(string message, System.Exception innerException) { } + public MembershipCreateUserException(System.Web.Security.MembershipCreateStatus statusCode) { } + public System.Web.Security.MembershipCreateStatus StatusCode { get { throw null; } } + [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted=true)] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.SerializableAttribute] + public partial class MembershipPasswordException : System.Exception + { + public MembershipPasswordException() { } + protected MembershipPasswordException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public MembershipPasswordException(string message) { } + public MembershipPasswordException(string message, System.Exception innerException) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public enum MembershipPasswordFormat + { + Clear = 0, + Encrypted = 2, + Hashed = 1, + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public abstract partial class MembershipProvider : System.Configuration.Provider.ProviderBase + { + protected MembershipProvider() { } + public abstract string ApplicationName { get; set; } + public abstract bool EnablePasswordReset { get; } + public abstract bool EnablePasswordRetrieval { get; } + public abstract int MaxInvalidPasswordAttempts { get; } + public abstract int MinRequiredNonAlphanumericCharacters { get; } + public abstract int MinRequiredPasswordLength { get; } + public abstract int PasswordAttemptWindow { get; } + public abstract System.Web.Security.MembershipPasswordFormat PasswordFormat { get; } + public abstract string PasswordStrengthRegularExpression { get; } + public abstract bool RequiresQuestionAndAnswer { get; } + public abstract bool RequiresUniqueEmail { get; } + public event System.Web.Security.MembershipValidatePasswordEventHandler ValidatingPassword { add { } remove { } } + public abstract bool ChangePassword(string username, string oldPassword, string newPassword); + public abstract bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer); + public abstract System.Web.Security.MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status); + protected virtual byte[] DecryptPassword(byte[] encodedPassword) { throw null; } + public abstract bool DeleteUser(string username, bool deleteAllRelatedData); + protected virtual byte[] EncryptPassword(byte[] password) { throw null; } + protected virtual byte[] EncryptPassword(byte[] password, System.Web.Configuration.MembershipPasswordCompatibilityMode legacyPasswordCompatibilityMode) { throw null; } + public abstract System.Web.Security.MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords); + public abstract System.Web.Security.MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords); + public abstract System.Web.Security.MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords); + public abstract int GetNumberOfUsersOnline(); + public abstract string GetPassword(string username, string answer); + public abstract System.Web.Security.MembershipUser GetUser(object providerUserKey, bool userIsOnline); + public abstract System.Web.Security.MembershipUser GetUser(string username, bool userIsOnline); + public abstract string GetUserNameByEmail(string email); + protected virtual void OnValidatingPassword(System.Web.Security.ValidatePasswordEventArgs e) { } + public abstract string ResetPassword(string username, string answer); + public abstract bool UnlockUser(string userName); + public abstract void UpdateUser(System.Web.Security.MembershipUser user); + public abstract bool ValidateUser(string username, string password); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public sealed partial class MembershipProviderCollection : System.Configuration.Provider.ProviderCollection + { + public MembershipProviderCollection() { } + public new System.Web.Security.MembershipProvider this[string name] { get { throw null; } } + public override void Add(System.Configuration.Provider.ProviderBase provider) { } + public void CopyTo(System.Web.Security.MembershipProvider[] array, int index) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.SerializableAttribute] + public partial class MembershipUser + { + protected MembershipUser() { } + public MembershipUser(string providerName, string name, object providerUserKey, string email, string passwordQuestion, string comment, bool isApproved, bool isLockedOut, System.DateTime creationDate, System.DateTime lastLoginDate, System.DateTime lastActivityDate, System.DateTime lastPasswordChangedDate, System.DateTime lastLockoutDate) { } + public virtual string Comment { get { throw null; } set { } } + public virtual System.DateTime CreationDate { get { throw null; } } + public virtual string Email { get { throw null; } set { } } + public virtual bool IsApproved { get { throw null; } set { } } + public virtual bool IsLockedOut { get { throw null; } } + public virtual bool IsOnline { get { throw null; } } + public virtual System.DateTime LastActivityDate { get { throw null; } set { } } + public virtual System.DateTime LastLockoutDate { get { throw null; } } + public virtual System.DateTime LastLoginDate { get { throw null; } set { } } + public virtual System.DateTime LastPasswordChangedDate { get { throw null; } } + public virtual string PasswordQuestion { get { throw null; } } + public virtual string ProviderName { get { throw null; } } + public virtual object ProviderUserKey { get { throw null; } } + public virtual string UserName { get { throw null; } } + public virtual bool ChangePassword(string oldPassword, string newPassword) { throw null; } + public virtual bool ChangePasswordQuestionAndAnswer(string password, string newPasswordQuestion, string newPasswordAnswer) { throw null; } + public virtual string GetPassword() { throw null; } + public virtual string GetPassword(string passwordAnswer) { throw null; } + public virtual string ResetPassword() { throw null; } + public virtual string ResetPassword(string passwordAnswer) { throw null; } + public override string ToString() { throw null; } + public virtual bool UnlockUser() { throw null; } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + [System.SerializableAttribute] + public sealed partial class MembershipUserCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + public MembershipUserCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Web.Security.MembershipUser this[string name] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void Add(System.Web.Security.MembershipUser user) { } + public void Clear() { } + public void CopyTo(System.Web.Security.MembershipUser[] array, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + public void Remove(string name) { } + public void SetReadOnly() { } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public delegate void MembershipValidatePasswordEventHandler(object sender, System.Web.Security.ValidatePasswordEventArgs e); + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public abstract partial class RoleProvider : System.Configuration.Provider.ProviderBase + { + protected RoleProvider() { } + public abstract string ApplicationName { get; set; } + public abstract void AddUsersToRoles(string[] usernames, string[] roleNames); + public abstract void CreateRole(string roleName); + public abstract bool DeleteRole(string roleName, bool throwOnPopulatedRole); + public abstract string[] FindUsersInRole(string roleName, string usernameToMatch); + public abstract string[] GetAllRoles(); + public abstract string[] GetRolesForUser(string username); + public abstract string[] GetUsersInRole(string roleName); + public abstract bool IsUserInRole(string username, string roleName); + public abstract void RemoveUsersFromRoles(string[] usernames, string[] roleNames); + public abstract bool RoleExists(string roleName); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")] + public sealed partial class ValidatePasswordEventArgs : System.EventArgs + { + public ValidatePasswordEventArgs(string userName, string password, bool isNewUser) { } + public bool Cancel { get { throw null; } set { } } + public System.Exception FailureInformation { get { throw null; } set { } } + public bool IsNewUser { get { throw null; } } + public string Password { get { throw null; } } + public string UserName { get { throw null; } } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.DynamicData.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.DynamicData.cs new file mode 100644 index 0000000000..0d00a2ada3 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.DynamicData.cs @@ -0,0 +1,816 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.DynamicData.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.DynamicData.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.DynamicData.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute(PartialTrustVisibilityLevel=(System.Security.PartialTrustVisibilityLevel)(1))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +namespace System.Web.DynamicData +{ + public enum ContainerType + { + Item = 1, + List = 0, + } + public partial class ContextConfiguration + { + public ContextConfiguration() { } + public System.Func MetadataProviderFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool ScaffoldAllTables { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class ControlFilterExpression : System.Web.UI.WebControls.Expressions.DataSourceExpression + { + public ControlFilterExpression() { } + public string Column { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ControlID { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override System.Linq.IQueryable GetQueryable(System.Linq.IQueryable source) { throw null; } + protected override void LoadViewState(object savedState) { } + protected override object SaveViewState() { throw null; } + public override void SetContext(System.Web.UI.Control owner, System.Web.HttpContext context, System.Web.UI.WebControls.IQueryableDataSource dataSource) { } + protected override void TrackViewState() { } + } + public partial class DataControlReference + { + public DataControlReference() { } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.TypeConverterAttribute("System.Web.DynamicData.Design.DataControlReferenceIDConverter, System.Web.DynamicData.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.Web.UI.IDReferencePropertyAttribute] + public string ControlID { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.DynamicDataManager Owner { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override string ToString() { throw null; } + } + public partial class DataControlReferenceCollection : System.Collections.ObjectModel.Collection + { + public DataControlReferenceCollection(System.Web.DynamicData.DynamicDataManager owner) { } + public System.Web.DynamicData.DynamicDataManager Owner { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + protected override void InsertItem(int index, System.Web.DynamicData.DataControlReference item) { } + protected override void RemoveItem(int index) { } + protected override void SetItem(int index, System.Web.DynamicData.DataControlReference item) { } + } + public partial class DefaultAutoFieldGenerator : System.Web.UI.IAutoFieldGenerator + { + public DefaultAutoFieldGenerator(System.Web.DynamicData.MetaTable table) { } + protected virtual System.Web.DynamicData.DynamicField CreateField(System.Web.DynamicData.MetaColumn column, System.Web.DynamicData.ContainerType containerType, System.Web.UI.WebControls.DataBoundControlMode mode) { throw null; } + public System.Collections.ICollection GenerateFields(System.Web.UI.Control control) { throw null; } + } + [System.Drawing.ToolboxBitmapAttribute(typeof(System.Web.DynamicData.DynamicControl), "DynamicControl.bmp")] + public partial class DynamicControl : System.Web.UI.Control, System.Web.DynamicData.IFieldFormattingOptions, System.Web.DynamicData.IFieldTemplateHost, System.Web.UI.IAttributeAccessor + { + public DynamicControl() { } + public DynamicControl(System.Web.UI.WebControls.DataBoundControlMode mode) { } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(false)] + public bool ApplyFormatInEditMode { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.MetaColumn Column { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(false)] + public bool ConvertEmptyStringToNull { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Appearance")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.Web.UI.CssClassPropertyAttribute] + public virtual string CssClass { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + public string DataField { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + public string DataFormatString { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.UI.Control FieldTemplate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(true)] + public bool HtmlEncode { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute((System.Web.UI.WebControls.DataBoundControlMode)(0))] + public System.Web.UI.WebControls.DataBoundControlMode Mode { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public string NullDisplayText { get { throw null; } set { } } + System.Web.DynamicData.IFieldFormattingOptions System.Web.DynamicData.IFieldTemplateHost.FormattingOptions { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual System.Web.DynamicData.MetaTable Table { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public virtual string UIHint { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.Web.UI.ThemeableAttribute(false)] + public virtual string ValidationGroup { get { throw null; } set { } } + public string GetAttribute(string key) { throw null; } + protected override void OnInit(System.EventArgs e) { } + protected override void Render(System.Web.UI.HtmlTextWriter writer) { } + public void SetAttribute(string key, string value) { } + } + public partial class DynamicControlParameter : System.Web.UI.WebControls.Parameter, System.Web.DynamicData.IWhereParametersProvider + { + public DynamicControlParameter() { } + public DynamicControlParameter(string controlId) { } + public string ControlId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override object Evaluate(System.Web.HttpContext context, System.Web.UI.Control control) { throw null; } + public virtual System.Collections.Generic.IEnumerable GetWhereParameters(System.Web.DynamicData.IDynamicDataSource dataSource) { throw null; } + } + public static partial class DynamicDataExtensions + { + public static object ConvertEditedValue(this System.Web.DynamicData.IFieldFormattingOptions formattingOptions, string value) { throw null; } + [System.ObsoleteAttribute("Use the EnablePersistedSelection property on a databound control such as GridView or ListView.")] + public static void EnablePersistedSelection(this System.Web.UI.WebControls.BaseDataBoundControl dataBoundControl) { } + public static void ExpandDynamicWhereParameters(this System.Web.DynamicData.IDynamicDataSource dataSource) { } + public static System.Web.DynamicData.IDynamicDataSource FindDataSourceControl(this System.Web.UI.Control current) { throw null; } + public static System.Web.UI.Control FindFieldTemplate(this System.Web.UI.Control control, string columnName) { throw null; } + public static System.Web.DynamicData.MetaTable FindMetaTable(this System.Web.UI.Control current) { throw null; } + public static string FormatEditValue(this System.Web.DynamicData.IFieldFormattingOptions formattingOptions, object fieldValue) { throw null; } + public static string FormatValue(this System.Web.DynamicData.IFieldFormattingOptions formattingOptions, object fieldValue) { throw null; } + public static System.Collections.Generic.IDictionary GetDefaultValues(this System.Web.UI.IDataSource dataSource) { throw null; } + public static System.Collections.Generic.IDictionary GetDefaultValues(this System.Web.UI.INamingContainer control) { throw null; } + public static System.Type GetEnumType(this System.Web.DynamicData.MetaColumn column) { throw null; } + public static System.Web.DynamicData.MetaTable GetMetaTable(this System.Web.UI.IDataSource dataSource) { throw null; } + public static System.Web.DynamicData.MetaTable GetMetaTable(this System.Web.UI.INamingContainer control) { throw null; } + public static System.Web.DynamicData.MetaTable GetTable(this System.Web.DynamicData.IDynamicDataSource dataSource) { throw null; } + public static void LoadWithForeignKeys(this System.Web.UI.WebControls.LinqDataSource dataSource, System.Type rowType) { } + public static void LoadWith(this System.Web.UI.WebControls.LinqDataSource dataSource) { } + public static void SetMetaTable(this System.Web.UI.INamingContainer control, System.Web.DynamicData.MetaTable table) { } + public static void SetMetaTable(this System.Web.UI.INamingContainer control, System.Web.DynamicData.MetaTable table, System.Collections.Generic.IDictionary defaultValues) { } + public static void SetMetaTable(this System.Web.UI.INamingContainer control, System.Web.DynamicData.MetaTable table, object defaultValues) { } + public static bool TryGetMetaTable(this System.Web.UI.IDataSource dataSource, out System.Web.DynamicData.MetaTable table) { table = default(System.Web.DynamicData.MetaTable); throw null; } + public static bool TryGetMetaTable(this System.Web.UI.INamingContainer control, out System.Web.DynamicData.MetaTable table) { table = default(System.Web.DynamicData.MetaTable); throw null; } + } + [System.ComponentModel.DesignerAttribute("System.Web.DynamicData.Design.DynamicDataManagerDesigner, System.Web.DynamicData.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.Drawing.ToolboxBitmapAttribute(typeof(System.Web.DynamicData.DynamicDataManager), "DynamicDataManager.bmp")] + [System.Web.UI.NonVisualControlAttribute] + [System.Web.UI.ParseChildrenAttribute(true)] + [System.Web.UI.PersistChildrenAttribute(false)] + public partial class DynamicDataManager : System.Web.UI.Control + { + public DynamicDataManager() { } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(false)] + public bool AutoLoadForeignKeys { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override string ClientID { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override System.Web.UI.ClientIDMode ClientIDMode { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.MergablePropertyAttribute(false)] + [System.Web.UI.PersistenceModeAttribute((System.Web.UI.PersistenceMode)(1))] + public System.Web.DynamicData.DataControlReferenceCollection DataControls { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public override bool Visible { get { throw null; } set { } } + protected override void OnInit(System.EventArgs e) { } + protected override void OnLoad(System.EventArgs e) { } + public void RegisterControl(System.Web.UI.Control control) { } + public void RegisterControl(System.Web.UI.Control control, bool setSelectionFromUrl) { } + } + public partial class DynamicDataRoute : System.Web.Routing.Route + { + public DynamicDataRoute(string url) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } + public string Action { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Web.DynamicData.MetaModel Model { get { throw null; } set { } } + public new System.Web.DynamicData.DynamicDataRouteHandler RouteHandler { get { throw null; } set { } } + public string Table { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ViewName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string GetActionFromRouteData(System.Web.Routing.RouteData routeData) { throw null; } + public override System.Web.Routing.RouteData GetRouteData(System.Web.HttpContextBase httpContext) { throw null; } + public System.Web.DynamicData.MetaTable GetTableFromRouteData(System.Web.Routing.RouteData routeData) { throw null; } + public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } + } + public partial class DynamicDataRouteHandler : System.Web.Routing.IRouteHandler + { + public DynamicDataRouteHandler() { } + public System.Web.DynamicData.MetaModel Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public virtual System.Web.IHttpHandler CreateHandler(System.Web.DynamicData.DynamicDataRoute route, System.Web.DynamicData.MetaTable table, string action) { throw null; } + protected virtual string GetCustomPageVirtualPath(System.Web.DynamicData.MetaTable table, string viewName) { throw null; } + public static System.Web.Routing.RequestContext GetRequestContext(System.Web.HttpContext httpContext) { throw null; } + public static System.Web.DynamicData.MetaTable GetRequestMetaTable(System.Web.HttpContext httpContext) { throw null; } + protected virtual string GetScaffoldPageVirtualPath(System.Web.DynamicData.MetaTable table, string viewName) { throw null; } + public static void SetRequestMetaTable(System.Web.HttpContext httpContext, System.Web.DynamicData.MetaTable table) { } + System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } + } + [System.Drawing.ToolboxBitmapAttribute(typeof(System.Web.DynamicData.DynamicEntity), "DynamicEntity.bmp")] + public partial class DynamicEntity : System.Web.UI.Control + { + public DynamicEntity() { } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute((System.Web.UI.WebControls.DataBoundControlMode)(0))] + public System.Web.UI.WebControls.DataBoundControlMode Mode { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public string UIHint { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.Web.UI.ThemeableAttribute(false)] + public string ValidationGroup { get { throw null; } set { } } + protected override void OnLoad(System.EventArgs e) { } + protected override void Render(System.Web.UI.HtmlTextWriter writer) { } + } + [System.ComponentModel.DesignerAttribute("System.Web.DynamicData.Design.DynamicFieldDesigner, System.Web.DynamicData.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class DynamicField : System.Web.UI.WebControls.DataControlField, System.Web.DynamicData.IFieldFormattingOptions, System.Web.UI.IAttributeAccessor + { + public DynamicField() { } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(false)] + public bool ApplyFormatInEditMode { get { throw null; } set { } } + protected System.Web.DynamicData.MetaColumn Column { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(false)] + public bool ConvertEmptyStringToNull { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + public virtual string DataField { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + public string DataFormatString { get { throw null; } set { } } + public override string HeaderText { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(true)] + public bool HtmlEncode { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public string NullDisplayText { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute(false)] + public virtual bool ReadOnly { get { throw null; } set { } } + public override string SortExpression { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public virtual string UIHint { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute((System.Web.UI.ValidateRequestMode)(0))] + public new System.Web.UI.ValidateRequestMode ValidateRequestMode { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public virtual string ValidationGroup { get { throw null; } set { } } + protected virtual void ConfigureDynamicControl(System.Web.DynamicData.DynamicControl control) { } + protected override void CopyProperties(System.Web.UI.WebControls.DataControlField newField) { } + protected virtual System.Web.DynamicData.DynamicControl CreateDynamicControl() { throw null; } + protected override System.Web.UI.WebControls.DataControlField CreateField() { throw null; } + public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, System.Web.UI.WebControls.DataControlFieldCell cell, System.Web.UI.WebControls.DataControlRowState rowState, bool includeReadOnly) { } + public string GetAttribute(string key) { throw null; } + public override void InitializeCell(System.Web.UI.WebControls.DataControlFieldCell cell, System.Web.UI.WebControls.DataControlCellType cellType, System.Web.UI.WebControls.DataControlRowState rowState, int rowIndex) { } + public void SetAttribute(string key, string value) { } + } + public partial class DynamicFilter : System.Web.UI.Control, System.Web.DynamicData.IFilterExpressionProvider + { + public DynamicFilter() { } + protected internal System.Web.DynamicData.MetaColumn Column { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + public string DataField { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public System.Web.UI.Control FilterTemplate { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("")] + public string FilterUIHint { get { throw null; } set { } } + public event System.EventHandler FilterChanged { add { } remove { } } + protected override void Render(System.Web.UI.HtmlTextWriter writer) { } + System.Linq.IQueryable System.Web.DynamicData.IFilterExpressionProvider.GetQueryable(System.Linq.IQueryable source) { throw null; } + void System.Web.DynamicData.IFilterExpressionProvider.Initialize(System.Web.UI.WebControls.IQueryableDataSource dataSource) { } + } + public partial class DynamicFilterExpression : System.Web.UI.WebControls.Expressions.DataSourceExpression + { + public DynamicFilterExpression() { } + public string ControlID { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override System.Linq.IQueryable GetQueryable(System.Linq.IQueryable source) { throw null; } + public override void SetContext(System.Web.UI.Control owner, System.Web.HttpContext context, System.Web.UI.WebControls.IQueryableDataSource dataSource) { } + } + [System.ComponentModel.DefaultPropertyAttribute("Action")] + [System.Drawing.ToolboxBitmapAttribute(typeof(System.Web.DynamicData.DynamicHyperLink), "DynamicHyperLink.bmp")] + public partial class DynamicHyperLink : System.Web.UI.WebControls.HyperLink, System.Web.UI.IAttributeAccessor + { + public DynamicHyperLink() { } + [System.ComponentModel.CategoryAttribute("Navigation")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.TypeConverterAttribute("System.Web.DynamicData.ActionConverter")] + public string Action { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Navigation")] + [System.ComponentModel.DefaultValueAttribute("")] + public string ContextTypeName { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Navigation")] + [System.ComponentModel.DefaultValueAttribute("")] + public string DataField { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Navigation")] + [System.ComponentModel.DefaultValueAttribute("")] + public string TableName { get { throw null; } set { } } + protected override void OnDataBinding(System.EventArgs e) { } + protected override void OnPreRender(System.EventArgs e) { } + string System.Web.UI.IAttributeAccessor.GetAttribute(string key) { throw null; } + void System.Web.UI.IAttributeAccessor.SetAttribute(string key, string value) { } + } + public partial class DynamicQueryStringParameter : System.Web.UI.WebControls.Parameter, System.Web.DynamicData.IWhereParametersProvider + { + public DynamicQueryStringParameter() { } + protected override object Evaluate(System.Web.HttpContext context, System.Web.UI.Control control) { throw null; } + public virtual System.Collections.Generic.IEnumerable GetWhereParameters(System.Web.DynamicData.IDynamicDataSource dataSource) { throw null; } + } + public partial class DynamicRouteExpression : System.Web.UI.WebControls.Expressions.DataSourceExpression + { + public DynamicRouteExpression() { } + [System.ComponentModel.DefaultValueAttribute("")] + public string ColumnName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override System.Linq.IQueryable GetQueryable(System.Linq.IQueryable source) { throw null; } + public override void SetContext(System.Web.UI.Control owner, System.Web.HttpContext context, System.Web.UI.WebControls.IQueryableDataSource dataSource) { } + } + [System.Drawing.ToolboxBitmapAttribute(typeof(System.Web.DynamicData.DynamicValidator), "DynamicValidator.bmp")] + public partial class DynamicValidator : System.Web.UI.WebControls.BaseValidator + { + public DynamicValidator() { } + [System.ComponentModel.BrowsableAttribute(false)] + [System.Web.UI.ThemeableAttribute(false)] + public System.Web.DynamicData.MetaColumn Column { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.Web.UI.ThemeableAttribute(false)] + public string ColumnName { get { throw null; } } + protected virtual System.Exception ValidationException { get { throw null; } set { } } + protected override bool ControlPropertiesValid() { throw null; } + protected override bool EvaluateIsValid() { throw null; } + protected override void OnInit(System.EventArgs e) { } + protected virtual void ValidateException(System.Exception exception) { } + } + [System.Web.UI.ParseChildrenAttribute(true)] + [System.Web.UI.PersistChildrenAttribute(false)] + public partial class EntityTemplate : System.Web.UI.Control + { + public EntityTemplate() { } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Web.UI.PersistenceModeAttribute((System.Web.UI.PersistenceMode)(1))] + [System.Web.UI.TemplateContainerAttribute(typeof(System.Web.UI.INamingContainer))] + public virtual System.Web.UI.ITemplate ItemTemplate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class EntityTemplateFactory + { + public EntityTemplateFactory() { } + public virtual string BuildEntityTemplateVirtualPath(string templateName, System.Web.UI.WebControls.DataBoundControlMode mode) { throw null; } + public virtual System.Web.DynamicData.EntityTemplateUserControl CreateEntityTemplate(System.Web.DynamicData.MetaTable table, System.Web.UI.WebControls.DataBoundControlMode mode, string uiHint) { throw null; } + public virtual string GetEntityTemplateVirtualPath(System.Web.DynamicData.MetaTable table, System.Web.UI.WebControls.DataBoundControlMode mode, string uiHint) { throw null; } + } + public partial class EntityTemplateUserControl : System.Web.UI.UserControl + { + public EntityTemplateUserControl() { } + public virtual System.Web.DynamicData.ContainerType ContainerType { get { throw null; } } + public System.Web.UI.WebControls.DataBoundControlMode Mode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Web.DynamicData.MetaTable Table { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ValidationGroup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class FieldTemplateFactory : System.Web.DynamicData.IFieldTemplateFactory + { + public FieldTemplateFactory() { } + public System.Web.DynamicData.MetaModel Model { get { throw null; } } + public string TemplateFolderVirtualPath { get { throw null; } set { } } + public virtual string BuildVirtualPath(string templateName, System.Web.DynamicData.MetaColumn column, System.Web.UI.WebControls.DataBoundControlMode mode) { throw null; } + public virtual System.Web.DynamicData.IFieldTemplate CreateFieldTemplate(System.Web.DynamicData.MetaColumn column, System.Web.UI.WebControls.DataBoundControlMode mode, string uiHint) { throw null; } + public virtual string GetFieldTemplateVirtualPath(System.Web.DynamicData.MetaColumn column, System.Web.UI.WebControls.DataBoundControlMode mode, string uiHint) { throw null; } + public virtual void Initialize(System.Web.DynamicData.MetaModel model) { } + public virtual System.Web.UI.WebControls.DataBoundControlMode PreprocessMode(System.Web.DynamicData.MetaColumn column, System.Web.UI.WebControls.DataBoundControlMode mode) { throw null; } + } + public partial class FieldTemplateUserControl : System.Web.UI.UserControl, System.Web.DynamicData.IFieldTemplate, System.Web.UI.IBindableControl + { + public FieldTemplateUserControl() { } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.MetaChildrenColumn ChildrenColumn { get { throw null; } } + protected string ChildrenPath { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.MetaColumn Column { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual System.Web.DynamicData.ContainerType ContainerType { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual System.Web.UI.Control DataControl { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual object FieldValue { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual string FieldValueEditString { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual string FieldValueString { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.MetaForeignKeyColumn ForeignKeyColumn { get { throw null; } } + protected string ForeignKeyPath { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.IFieldFormattingOptions FormattingOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.IFieldTemplateHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.ComponentModel.AttributeCollection MetadataAttributes { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.UI.WebControls.DataBoundControlMode Mode { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public virtual object Row { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + public System.Web.DynamicData.MetaTable Table { get { throw null; } } + protected string BuildChildrenPath(string path) { throw null; } + protected string BuildForeignKeyPath(string path) { throw null; } + protected virtual object ConvertEditedValue(string value) { throw null; } + protected virtual void ExtractForeignKey(System.Collections.IDictionary dictionary, string selectedValue) { } + protected virtual void ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary) { } + protected System.Web.DynamicData.FieldTemplateUserControl FindOtherFieldTemplate(string columnName) { throw null; } + public virtual string FormatFieldValue(object fieldValue) { throw null; } + protected virtual object GetColumnValue(System.Web.DynamicData.MetaColumn column) { throw null; } + protected string GetSelectedValueString() { throw null; } + protected void IgnoreModelValidationAttribute(System.Type attributeType) { } + protected void PopulateListControl(System.Web.UI.WebControls.ListControl listControl) { } + protected virtual void SetUpValidator(System.Web.UI.WebControls.BaseValidator validator) { } + protected virtual void SetUpValidator(System.Web.UI.WebControls.BaseValidator validator, System.Web.DynamicData.MetaColumn column) { } + void System.Web.DynamicData.IFieldTemplate.SetHost(System.Web.DynamicData.IFieldTemplateHost host) { } + void System.Web.UI.IBindableControl.ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary) { } + } + public partial class FilterFactory + { + public FilterFactory() { } + public virtual System.Web.DynamicData.QueryableFilterUserControl CreateFilterControl(System.Web.DynamicData.MetaColumn column, string filterUIHint) { throw null; } + public virtual string GetFilterVirtualPath(System.Web.DynamicData.MetaColumn column, string filterUIHint) { throw null; } + } + [System.ComponentModel.ToolboxItemAttribute(false)] + [System.Web.UI.ParseChildrenAttribute(true)] + public partial class FilterRepeater : System.Web.UI.WebControls.Repeater, System.Web.DynamicData.IWhereParametersProvider + { + public FilterRepeater() { } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Web.UI.ThemeableAttribute(false)] + public string ContextTypeName { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("DynamicFilter")] + [System.Web.UI.IDReferencePropertyAttribute(typeof(System.Web.DynamicData.FilterUserControlBase))] + [System.Web.UI.ThemeableAttribute(false)] + public string DynamicFilterContainerId { get { throw null; } set { } } + public System.Web.DynamicData.MetaTable Table { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Web.UI.ThemeableAttribute(false)] + public string TableName { get { throw null; } set { } } + public override bool Visible { get { throw null; } set { } } + public override void DataBind() { } + protected internal virtual System.Collections.Generic.IEnumerable GetFilteredColumns() { throw null; } + public virtual System.Collections.Generic.IEnumerable GetWhereParameters(System.Web.DynamicData.IDynamicDataSource dataSource) { throw null; } + protected virtual void OnFilterItemCreated(System.Web.UI.WebControls.RepeaterItem item) { } + protected override void OnInit(System.EventArgs e) { } + protected override void OnItemCreated(System.Web.UI.WebControls.RepeaterItemEventArgs e) { } + } + public partial class FilterUserControlBase : System.Web.UI.UserControl, System.Web.DynamicData.IControlParameterTarget + { + public FilterUserControlBase() { } + public System.Web.DynamicData.MetaColumn Column { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + public string ContextTypeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + public string DataField { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string InitialValue { get { throw null; } } + public virtual System.Web.UI.WebControls.DataKey SelectedDataKey { get { throw null; } } + public virtual string SelectedValue { get { throw null; } } + System.Web.DynamicData.MetaColumn System.Web.DynamicData.IControlParameterTarget.FilteredColumn { get { throw null; } } + System.Web.DynamicData.MetaTable System.Web.DynamicData.IControlParameterTarget.Table { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + public string TableName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public void PopulateListControl(System.Web.UI.WebControls.ListControl listControl) { } + string System.Web.DynamicData.IControlParameterTarget.GetPropertyNameExpression(string columnName) { throw null; } + } + public partial interface IControlParameterTarget + { + System.Web.DynamicData.MetaColumn FilteredColumn { get; } + System.Web.DynamicData.MetaTable Table { get; } + string GetPropertyNameExpression(string columnName); + } + public partial interface IFieldFormattingOptions + { + bool ApplyFormatInEditMode { get; } + bool ConvertEmptyStringToNull { get; } + string DataFormatString { get; } + bool HtmlEncode { get; } + string NullDisplayText { get; } + } + public partial interface IFieldTemplate + { + void SetHost(System.Web.DynamicData.IFieldTemplateHost host); + } + public partial interface IFieldTemplateFactory + { + System.Web.DynamicData.IFieldTemplate CreateFieldTemplate(System.Web.DynamicData.MetaColumn column, System.Web.UI.WebControls.DataBoundControlMode mode, string uiHint); + void Initialize(System.Web.DynamicData.MetaModel model); + } + public partial interface IFieldTemplateHost + { + System.Web.DynamicData.MetaColumn Column { get; } + System.Web.DynamicData.IFieldFormattingOptions FormattingOptions { get; } + System.Web.UI.WebControls.DataBoundControlMode Mode { get; } + string ValidationGroup { get; } + } + public partial interface IFilterExpressionProvider + { + System.Linq.IQueryable GetQueryable(System.Linq.IQueryable source); + void Initialize(System.Web.UI.WebControls.IQueryableDataSource dataSource); + } + public partial interface IWhereParametersProvider + { + System.Collections.Generic.IEnumerable GetWhereParameters(System.Web.DynamicData.IDynamicDataSource dataSource); + } + public partial class MetaChildrenColumn : System.Web.DynamicData.MetaColumn + { + public MetaChildrenColumn(System.Web.DynamicData.MetaTable table, System.Web.DynamicData.ModelProviders.ColumnProvider entityMember) : base (default(System.Web.DynamicData.MetaTable), default(System.Web.DynamicData.ModelProviders.ColumnProvider)) { } + public System.Web.DynamicData.MetaTable ChildTable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Web.DynamicData.MetaColumn ColumnInOtherTable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool IsManyToMany { get { throw null; } } + public string GetChildrenListPath(object row) { throw null; } + public string GetChildrenPath(string action, object row) { throw null; } + public string GetChildrenPath(string action, object row, string path) { throw null; } + protected internal override void Initialize() { } + } + public partial class MetaColumn : System.Web.DynamicData.IFieldFormattingOptions + { + public MetaColumn(System.Web.DynamicData.MetaTable table, System.Web.DynamicData.ModelProviders.ColumnProvider columnProvider) { } + public bool AllowInitialValue { get { throw null; } } + public bool ApplyFormatInEditMode { get { throw null; } } + public System.ComponentModel.AttributeCollection Attributes { get { throw null; } } + public System.Type ColumnType { get { throw null; } } + public bool ConvertEmptyStringToNull { get { throw null; } } + public string DataFormatString { get { throw null; } } + public System.ComponentModel.DataAnnotations.DataTypeAttribute DataTypeAttribute { get { throw null; } } + public object DefaultValue { get { throw null; } } + public virtual string Description { get { throw null; } } + public virtual string DisplayName { get { throw null; } } + public System.Reflection.PropertyInfo EntityTypeProperty { get { throw null; } } + public string FilterUIHint { get { throw null; } } + public bool HtmlEncode { get { throw null; } } + public bool IsBinaryData { get { throw null; } } + public bool IsCustomProperty { get { throw null; } } + public bool IsFloatingPoint { get { throw null; } } + public bool IsForeignKeyComponent { get { throw null; } } + public bool IsGenerated { get { throw null; } } + public bool IsInteger { get { throw null; } } + public bool IsLongString { get { throw null; } } + public bool IsPrimaryKey { get { throw null; } } + public virtual bool IsReadOnly { get { throw null; } } + public bool IsRequired { get { throw null; } } + public bool IsString { get { throw null; } } + public int MaxLength { get { throw null; } } + public System.Web.DynamicData.MetaModel Model { get { throw null; } } + public string Name { get { throw null; } } + public string NullDisplayText { get { throw null; } } + public virtual string Prompt { get { throw null; } } + public System.Web.DynamicData.ModelProviders.ColumnProvider Provider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string RequiredErrorMessage { get { throw null; } } + public virtual bool Scaffold { get { throw null; } set { } } + public virtual string ShortDisplayName { get { throw null; } } + public string SortExpression { get { throw null; } } + public System.Web.DynamicData.MetaTable Table { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.TypeCode TypeCode { get { throw null; } } + public virtual string UIHint { get { throw null; } } + protected virtual System.ComponentModel.AttributeCollection BuildAttributeCollection() { throw null; } + protected internal virtual void Initialize() { } + public void ResetMetadata() { } + public override string ToString() { throw null; } + } + public partial class MetaForeignKeyColumn : System.Web.DynamicData.MetaColumn + { + public MetaForeignKeyColumn(System.Web.DynamicData.MetaTable table, System.Web.DynamicData.ModelProviders.ColumnProvider entityMember) : base (default(System.Web.DynamicData.MetaTable), default(System.Web.DynamicData.ModelProviders.ColumnProvider)) { } + public System.Collections.ObjectModel.ReadOnlyCollection ForeignKeyNames { get { throw null; } } + public bool IsPrimaryKeyInThisTable { get { throw null; } } + public System.Web.DynamicData.MetaTable ParentTable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public void ExtractForeignKey(System.Collections.IDictionary dictionary, string value) { } + public string GetFilterExpression(string foreignKeyName) { throw null; } + public string GetForeignKeyDetailsPath(object row) { throw null; } + public string GetForeignKeyPath(string action, object row) { throw null; } + public string GetForeignKeyPath(string action, object row, string path) { throw null; } + public string GetForeignKeyString(object row) { throw null; } + public System.Collections.Generic.IList GetForeignKeyValues(object row) { throw null; } + protected internal override void Initialize() { } + } + public partial class MetaModel + { + public MetaModel() { } + public MetaModel(bool registerGlobally) { } + public static System.Web.DynamicData.MetaModel Default { get { throw null; } } + public string DynamicDataFolderVirtualPath { get { throw null; } set { } } + public System.Web.DynamicData.EntityTemplateFactory EntityTemplateFactory { get { throw null; } set { } } + public System.Web.DynamicData.IFieldTemplateFactory FieldTemplateFactory { get { throw null; } set { } } + public System.Web.DynamicData.FilterFactory FilterFactory { get { throw null; } set { } } + public System.Collections.ObjectModel.ReadOnlyCollection Tables { get { throw null; } } + public System.Collections.Generic.List VisibleTables { get { throw null; } } + protected virtual System.Web.DynamicData.MetaTable CreateTable(System.Web.DynamicData.ModelProviders.TableProvider provider) { throw null; } + public string GetActionPath(string tableName, string action, object row) { throw null; } + public static System.Web.DynamicData.MetaModel GetModel(System.Type contextType) { throw null; } + public System.Web.DynamicData.MetaTable GetTable(string uniqueTableName) { throw null; } + public System.Web.DynamicData.MetaTable GetTable(string tableName, System.Type contextType) { throw null; } + public System.Web.DynamicData.MetaTable GetTable(System.Type entityType) { throw null; } + public void RegisterContext(System.Func contextFactory) { } + public void RegisterContext(System.Func contextFactory, System.Web.DynamicData.ContextConfiguration configuration) { } + public void RegisterContext(System.Type contextType) { } + public void RegisterContext(System.Type contextType, System.Web.DynamicData.ContextConfiguration configuration) { } + public void RegisterContext(System.Web.DynamicData.ModelProviders.DataModelProvider dataModelProvider) { } + public virtual void RegisterContext(System.Web.DynamicData.ModelProviders.DataModelProvider dataModelProvider, System.Web.DynamicData.ContextConfiguration configuration) { } + public static void ResetRegistrationException() { } + public bool TryGetTable(string uniqueTableName, out System.Web.DynamicData.MetaTable table) { table = default(System.Web.DynamicData.MetaTable); throw null; } + public bool TryGetTable(System.Type entityType, out System.Web.DynamicData.MetaTable table) { table = default(System.Web.DynamicData.MetaTable); throw null; } + } + public partial class MetaTable + { + public MetaTable(System.Web.DynamicData.MetaModel metaModel, System.Web.DynamicData.ModelProviders.TableProvider tableProvider) { } + public System.ComponentModel.AttributeCollection Attributes { get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection Columns { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string DataContextPropertyName { get { throw null; } } + public System.Type DataContextType { get { throw null; } } + public virtual System.Web.DynamicData.MetaColumn DisplayColumn { get { throw null; } } + public virtual string DisplayName { get { throw null; } } + public System.Type EntityType { get { throw null; } } + public string ForeignKeyColumnsNames { get { throw null; } } + public bool HasPrimaryKey { get { throw null; } } + public virtual bool IsReadOnly { get { throw null; } } + public string ListActionPath { get { throw null; } } + public System.Web.DynamicData.MetaModel Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Collections.ObjectModel.ReadOnlyCollection PrimaryKeyColumns { get { throw null; } } + public System.Web.DynamicData.ModelProviders.TableProvider Provider { get { throw null; } } + public System.Type RootEntityType { get { throw null; } } + public virtual bool Scaffold { get { throw null; } } + public virtual System.Web.DynamicData.MetaColumn SortColumn { get { throw null; } } + public virtual bool SortDescending { get { throw null; } } + protected virtual System.ComponentModel.AttributeCollection BuildAttributeCollection() { throw null; } + public virtual bool CanDelete(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual bool CanInsert(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual bool CanRead(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual bool CanUpdate(System.Security.Principal.IPrincipal principal) { throw null; } + protected virtual System.Web.DynamicData.MetaChildrenColumn CreateChildrenColumn(System.Web.DynamicData.ModelProviders.ColumnProvider columnProvider) { throw null; } + protected virtual System.Web.DynamicData.MetaColumn CreateColumn(System.Web.DynamicData.ModelProviders.ColumnProvider columnProvider) { throw null; } + public virtual object CreateContext() { throw null; } + protected virtual System.Web.DynamicData.MetaForeignKeyColumn CreateForeignKeyColumn(System.Web.DynamicData.ModelProviders.ColumnProvider columnProvider) { throw null; } + public static System.Web.DynamicData.MetaTable CreateTable(System.ComponentModel.ICustomTypeDescriptor typeDescriptor) { throw null; } + public static System.Web.DynamicData.MetaTable CreateTable(System.Type entityType) { throw null; } + public string GetActionPath(string action) { throw null; } + public string GetActionPath(string action, System.Collections.Generic.IList primaryKeyValues) { throw null; } + public string GetActionPath(string action, System.Collections.Generic.IList primaryKeyValues, string path) { throw null; } + public string GetActionPath(string action, object row) { throw null; } + public string GetActionPath(string action, object row, string path) { throw null; } + public string GetActionPath(string action, System.Web.Routing.RouteValueDictionary routeValues) { throw null; } + public System.Web.DynamicData.MetaColumn GetColumn(string columnName) { throw null; } + public System.Collections.Generic.IDictionary GetColumnValuesFromRoute(System.Web.HttpContext context) { throw null; } + public System.Web.UI.WebControls.DataKey GetDataKeyFromRoute() { throw null; } + public virtual string GetDisplayString(object row) { throw null; } + public virtual System.Collections.Generic.IEnumerable GetFilteredColumns() { throw null; } + public System.Collections.Generic.IDictionary GetPrimaryKeyDictionary(object row) { throw null; } + public string GetPrimaryKeyString(System.Collections.Generic.IList primaryKeyValues) { throw null; } + public string GetPrimaryKeyString(object row) { throw null; } + public System.Collections.Generic.IList GetPrimaryKeyValues(object row) { throw null; } + public System.Linq.IQueryable GetQuery() { throw null; } + public virtual System.Linq.IQueryable GetQuery(object context) { throw null; } + public virtual System.Collections.Generic.IEnumerable GetScaffoldColumns(System.Web.UI.WebControls.DataBoundControlMode mode, System.Web.DynamicData.ContainerType containerType) { throw null; } + public static System.Web.DynamicData.MetaTable GetTable(System.Type entityType) { throw null; } + protected internal virtual void Initialize() { } + public void ResetMetadata() { } + public override string ToString() { throw null; } + public bool TryGetColumn(string columnName, out System.Web.DynamicData.MetaColumn column) { column = default(System.Web.DynamicData.MetaColumn); throw null; } + public static bool TryGetTable(System.Type entityType, out System.Web.DynamicData.MetaTable table) { table = default(System.Web.DynamicData.MetaTable); throw null; } + } + public static partial class PageAction + { + public static string Details { get { throw null; } } + public static string Edit { get { throw null; } } + public static string Insert { get { throw null; } } + public static string List { get { throw null; } } + } + [System.Web.UI.ParseChildrenAttribute(true)] + [System.Web.UI.PersistChildrenAttribute(false)] + public partial class QueryableFilterRepeater : System.Web.UI.Control, System.Web.DynamicData.IFilterExpressionProvider + { + public QueryableFilterRepeater() { } + [System.ComponentModel.CategoryAttribute("Behavior")] + [System.ComponentModel.DefaultValueAttribute("DynamicFilter")] + [System.Web.UI.IDReferencePropertyAttribute(typeof(System.Web.DynamicData.QueryableFilterUserControl))] + [System.Web.UI.ThemeableAttribute(false)] + public string DynamicFilterContainerId { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Web.UI.PersistenceModeAttribute((System.Web.UI.PersistenceMode)(1))] + [System.Web.UI.TemplateContainerAttribute(typeof(System.Web.UI.INamingContainer))] + public virtual System.Web.UI.ITemplate ItemTemplate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + protected override void OnPreRender(System.EventArgs e) { } + System.Linq.IQueryable System.Web.DynamicData.IFilterExpressionProvider.GetQueryable(System.Linq.IQueryable source) { throw null; } + void System.Web.DynamicData.IFilterExpressionProvider.Initialize(System.Web.UI.WebControls.IQueryableDataSource dataSource) { } + } + public abstract partial class QueryableFilterUserControl : System.Web.UI.UserControl + { + protected QueryableFilterUserControl() { } + protected internal System.Web.DynamicData.MetaColumn Column { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string DefaultValue { get { throw null; } } + public System.Collections.Generic.IDictionary DefaultValues { get { throw null; } } + public virtual System.Web.UI.Control FilterControl { get { throw null; } } + public event System.EventHandler FilterChanged { add { } remove { } } + public static System.Linq.IQueryable ApplyEqualityFilter(System.Linq.IQueryable source, string propertyName, object value) { throw null; } + public abstract System.Linq.IQueryable GetQueryable(System.Linq.IQueryable source); + protected void OnFilterChanged() { } + public void PopulateListControl(System.Web.UI.WebControls.ListControl listControl) { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + public sealed partial class TableNameAttribute : System.Attribute + { + public TableNameAttribute(string name) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } +} +namespace System.Web.DynamicData.ModelProviders +{ + public enum AssociationDirection + { + ManyToMany = 3, + ManyToOne = 2, + OneToMany = 1, + OneToOne = 0, + } + public abstract partial class AssociationProvider + { + protected AssociationProvider() { } + public virtual System.Web.DynamicData.ModelProviders.AssociationDirection Direction { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Collections.ObjectModel.ReadOnlyCollection ForeignKeyNames { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Web.DynamicData.ModelProviders.ColumnProvider FromColumn { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool IsPrimaryKeyInThisTable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Web.DynamicData.ModelProviders.ColumnProvider ToColumn { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Web.DynamicData.ModelProviders.TableProvider ToTable { get { throw null; } protected set { } } + public virtual string GetSortExpression(System.Web.DynamicData.ModelProviders.ColumnProvider sortColumn) { throw null; } + } + public abstract partial class ColumnProvider + { + protected ColumnProvider(System.Web.DynamicData.ModelProviders.TableProvider table) { } + public virtual System.Web.DynamicData.ModelProviders.AssociationProvider Association { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.ComponentModel.AttributeCollection Attributes { get { throw null; } } + public virtual System.Type ColumnType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Reflection.PropertyInfo EntityTypeProperty { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool IsCustomProperty { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool IsForeignKeyComponent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool IsGenerated { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool IsPrimaryKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool IsReadOnly { get { throw null; } protected set { } } + public virtual bool IsSortable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual int MaxLength { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual bool Nullable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public System.Web.DynamicData.ModelProviders.TableProvider Table { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + protected static System.ComponentModel.AttributeCollection AddDefaultAttributes(System.Web.DynamicData.ModelProviders.ColumnProvider columnProvider, System.ComponentModel.AttributeCollection attributes) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class DataModelProvider + { + protected DataModelProvider() { } + public virtual System.Type ContextType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public abstract System.Collections.ObjectModel.ReadOnlyCollection Tables { get; } + public abstract object CreateContext(); + } + public abstract partial class TableProvider + { + protected TableProvider(System.Web.DynamicData.ModelProviders.DataModelProvider model) { } + public virtual System.ComponentModel.AttributeCollection Attributes { get { throw null; } } + public abstract System.Collections.ObjectModel.ReadOnlyCollection Columns { get; } + public virtual string DataContextPropertyName { get { throw null; } protected set { } } + public System.Web.DynamicData.ModelProviders.DataModelProvider DataModel { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public virtual System.Type EntityType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Type ParentEntityType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public virtual System.Type RootEntityType { get { throw null; } protected set { } } + public virtual bool CanDelete(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual bool CanInsert(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual bool CanRead(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual bool CanUpdate(System.Security.Principal.IPrincipal principal) { throw null; } + public virtual object EvaluateForeignKey(object row, string foreignKeyName) { throw null; } + public abstract System.Linq.IQueryable GetQuery(object context); + public virtual System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor() { throw null; } + public override string ToString() { throw null; } + } +} +namespace System.Web.UI +{ + public static partial class DataControlExtensions + { + public static void EnableDynamicData(this System.Web.UI.INamingContainer control, System.Type entityType) { } + public static void EnableDynamicData(this System.Web.UI.INamingContainer control, System.Type entityType, System.Collections.Generic.IDictionary defaultValues) { } + public static void EnableDynamicData(this System.Web.UI.INamingContainer control, System.Type entityType, object defaults) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.Extensions.Design.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Extensions.Design.cs new file mode 100644 index 0000000000..8a0d41d027 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Extensions.Design.cs @@ -0,0 +1,253 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.Extensions.Design.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.Extensions.Design.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Extensions.Design.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Web.UI.WebResourceAttribute("System.Web.Resources.Design.Background.gif", "image/gif")] +namespace System.Web.UI.Design +{ + public partial class AsyncPostBackTriggerControlIDConverter : System.ComponentModel.StringConverter + { + public AsyncPostBackTriggerControlIDConverter() { } + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + public partial class AsyncPostBackTriggerEventNameConverter : System.ComponentModel.StringConverter + { + public AsyncPostBackTriggerEventNameConverter() { } + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + public partial class CollectionEditorBase : System.ComponentModel.Design.CollectionEditor + { + public CollectionEditorBase(System.Type type) : base (default(System.Type)) { } + protected override System.ComponentModel.Design.CollectionEditor.CollectionForm CreateCollectionForm() { throw null; } + } + public partial class ExtenderControlDesigner : System.Web.UI.Design.ControlDesigner + { + public ExtenderControlDesigner() { } + protected override bool Visible { get { throw null; } } + protected override void Dispose(bool disposing) { } + public override string GetDesignTimeHtml() { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + protected override void PreFilterProperties(System.Collections.IDictionary properties) { } + } + [System.SerializableAttribute] + public partial class ExtenderControlToolboxItem : System.Web.UI.Design.WebControlToolboxItem + { + public ExtenderControlToolboxItem() { } + protected ExtenderControlToolboxItem(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public ExtenderControlToolboxItem(System.Type type) { } + public System.Collections.ObjectModel.ReadOnlyCollection GetTargetControlTypes(System.ComponentModel.Design.IDesignerHost host) { throw null; } + public override void Initialize(System.Type type) { } + } + public partial class PostBackTriggerControlIDConverter : System.ComponentModel.StringConverter + { + public PostBackTriggerControlIDConverter() { } + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + public partial class QueryExtenderDesigner : System.Web.UI.Design.ControlDesigner + { + public QueryExtenderDesigner() { } + public override string GetDesignTimeHtml() { throw null; } + } + public partial class ScriptManagerDesigner : System.Web.UI.Design.ControlDesigner + { + public ScriptManagerDesigner() { } + public static string GetApplicationServices(System.Web.UI.ScriptManager scriptManager, System.Collections.Generic.IEnumerable proxies) { throw null; } + public override string GetDesignTimeHtml() { throw null; } + public static string GetProxyScript(System.Web.UI.ScriptManager scriptManager, System.Web.UI.ServiceReference serviceReference) { throw null; } + public static string GetProxyUrl(System.Web.UI.ScriptManager scriptManager, System.Web.UI.ServiceReference serviceReference) { throw null; } + public static string GetScriptFromWebResource(System.Reflection.Assembly assembly, string resourceName, System.Globalization.CultureInfo culture) { throw null; } + public static System.Collections.ObjectModel.ReadOnlyCollection GetScriptReferences(System.Web.UI.ScriptManager scriptManager, System.Collections.Generic.IEnumerable proxies) { throw null; } + public static System.Collections.ObjectModel.ReadOnlyCollection GetServiceReferences(System.Web.UI.ScriptManager scriptManager, System.Collections.Generic.IEnumerable proxies) { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + } + public partial class ScriptManagerProxyDesigner : System.Web.UI.Design.ControlDesigner + { + public ScriptManagerProxyDesigner() { } + public override string GetDesignTimeHtml() { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + } + public partial class ServiceReferenceCollectionEditor : System.Web.UI.Design.CollectionEditorBase + { + public ServiceReferenceCollectionEditor(System.Type type) : base (default(System.Type)) { } + protected override bool CanSelectMultipleInstances() { throw null; } + protected override System.Type[] CreateNewItemTypes() { throw null; } + } + public partial class TimerDesigner : System.Web.UI.Design.ControlDesigner + { + public TimerDesigner() { } + public override string GetDesignTimeHtml() { throw null; } + } + public partial class UpdatePanelDesigner : System.Web.UI.Design.ControlDesigner + { + public UpdatePanelDesigner() { } + protected override bool UsePreviewControl { get { throw null; } } + public override string GetDesignTimeHtml(System.Web.UI.Design.DesignerRegionCollection regions) { throw null; } + public override string GetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region) { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + public override void OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) { } + public override void SetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region, string content) { } + } + public partial class UpdatePanelTriggerCollectionEditor : System.Web.UI.Design.CollectionEditorBase + { + public UpdatePanelTriggerCollectionEditor(System.Type type) : base (default(System.Type)) { } + protected override bool CanSelectMultipleInstances() { throw null; } + protected override System.Type CreateCollectionItemType() { throw null; } + protected override System.Type[] CreateNewItemTypes() { throw null; } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + } + public partial class UpdateProgressAssociatedUpdatePanelIDConverter : System.ComponentModel.StringConverter + { + public UpdateProgressAssociatedUpdatePanelIDConverter() { } + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + public partial class UpdateProgressDesigner : System.Web.UI.Design.ControlDesigner + { + public UpdateProgressDesigner() { } + protected override bool UsePreviewControl { get { throw null; } } + public override string GetDesignTimeHtml(System.Web.UI.Design.DesignerRegionCollection regions) { throw null; } + public override string GetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region) { throw null; } + public override void SetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region, string content) { } + } +} +namespace System.Web.UI.Design.WebControls +{ + public partial class DataPagerDesigner : System.Web.UI.Design.ControlDesigner + { + public DataPagerDesigner() { } + public override System.ComponentModel.Design.DesignerActionListCollection ActionLists { get { throw null; } } + public string PagedControlID { get { throw null; } set { } } + public override System.Web.UI.Design.TemplateGroupCollection TemplateGroups { get { throw null; } } + protected override bool UsePreviewControl { get { throw null; } } + public override string GetDesignTimeHtml() { throw null; } + protected override string GetEmptyDesignTimeHtml() { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + protected override void PreFilterProperties(System.Collections.IDictionary properties) { } + } + [System.Security.SecurityCriticalAttribute] + public partial class DataPagerFieldTypeEditor : System.Drawing.Design.UITypeEditor + { + public DataPagerFieldTypeEditor() { } + public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { throw null; } + public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { throw null; } + } + public partial class LinqDataSourceDesigner : System.Web.UI.Design.DataSourceDesigner + { + public LinqDataSourceDesigner() { } + public override System.ComponentModel.Design.DesignerActionListCollection ActionLists { get { throw null; } } + public override bool CanConfigure { get { throw null; } } + public override bool CanRefreshSchema { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.MergablePropertyAttribute(false)] + [System.ComponentModel.TypeConverterAttribute("System.Web.UI.Design.WebControls.LinqDataSourceContextTypeConverter")] + public string ContextTypeName { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.MergablePropertyAttribute(false)] + [System.ComponentModel.TypeConverterAttribute("System.Web.UI.Design.WebControls.LinqDataSourceInsertUpdateDeleteStatementConverter")] + public string Delete { get { throw null; } set { } } + public bool EnableDelete { get { throw null; } set { } } + public bool EnableInsert { get { throw null; } set { } } + public bool EnableUpdate { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.MergablePropertyAttribute(false)] + public string GroupBy { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.MergablePropertyAttribute(false)] + [System.ComponentModel.TypeConverterAttribute("System.Web.UI.Design.WebControls.LinqDataSourceInsertUpdateDeleteStatementConverter")] + public string Insert { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.MergablePropertyAttribute(false)] + public string OrderBy { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.MergablePropertyAttribute(false)] + public string OrderGroupsBy { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.MergablePropertyAttribute(false)] + public string Select { get { throw null; } set { } } + public System.IServiceProvider ServiceProvider { get { throw null; } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.MergablePropertyAttribute(false)] + [System.ComponentModel.TypeConverterAttribute("System.Web.UI.Design.WebControls.LinqDataSourceTableConverter")] + public string TableName { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.ComponentModel.MergablePropertyAttribute(false)] + [System.ComponentModel.TypeConverterAttribute("System.Web.UI.Design.WebControls.LinqDataSourceInsertUpdateDeleteStatementConverter")] + public string Update { get { throw null; } set { } } + [System.ComponentModel.CategoryAttribute("Data")] + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.MergablePropertyAttribute(false)] + public string Where { get { throw null; } set { } } + public override void Configure() { } + public override System.Web.UI.Design.DesignerDataSourceView GetView(string viewName) { throw null; } + public override string[] GetViewNames() { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + protected override void PreFilterProperties(System.Collections.IDictionary properties) { } + public override void RefreshSchema(bool preferSilent) { } + } + public partial class LinqDesignerDataSourceView : System.Web.UI.Design.DesignerDataSourceView + { + public LinqDesignerDataSourceView(System.Web.UI.Design.WebControls.LinqDataSourceDesigner owner) : base (default(System.Web.UI.Design.IDataSourceDesigner), default(string)) { } + public override bool CanDelete { get { throw null; } } + public override bool CanInsert { get { throw null; } } + public override bool CanPage { get { throw null; } } + public override bool CanSort { get { throw null; } } + public override bool CanUpdate { get { throw null; } } + public bool IsDataContext { get { throw null; } } + public bool IsTableTypeTable { get { throw null; } } + public override System.Web.UI.Design.IDataSourceViewSchema Schema { get { throw null; } } + public override System.Collections.IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { isSampleData = default(bool); throw null; } + } + public partial class ListViewDesigner : System.Web.UI.Design.WebControls.DataBoundControlDesigner + { + public ListViewDesigner() { } + public override System.ComponentModel.Design.DesignerActionListCollection ActionLists { get { throw null; } } + protected override int SampleRowCount { get { throw null; } } + protected override bool UsePreviewControl { get { throw null; } } + public override string GetDesignTimeHtml() { throw null; } + public override string GetDesignTimeHtml(System.Web.UI.Design.DesignerRegionCollection regions) { throw null; } + public override string GetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region) { throw null; } + protected override string GetEmptyDesignTimeHtml() { throw null; } + public override void Initialize(System.ComponentModel.IComponent component) { } + public override void OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) { } + protected override void OnSchemaRefreshed() { } + public override void SetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region, string content) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.Extensions.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Extensions.cs.REMOVED.git-id new file mode 100644 index 0000000000..a3ffa9db6e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Extensions.cs.REMOVED.git-id @@ -0,0 +1 @@ +fe1682bceab4c7694174e9f47c4f040e06194fe3 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.Mobile.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Mobile.cs new file mode 100644 index 0000000000..0ddefe646e --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Mobile.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.Mobile.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.Mobile.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Mobile.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.RegularExpressions.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.RegularExpressions.cs new file mode 100644 index 0000000000..f0a2c1b605 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.RegularExpressions.cs @@ -0,0 +1,111 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.RegularExpressions.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.RegularExpressions.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +namespace System.Web.RegularExpressions +{ + public partial class AspCodeRegex : System.Text.RegularExpressions.Regex + { + public AspCodeRegex() { } + public AspCodeRegex(System.TimeSpan A_1) { } + } + public partial class AspEncodedExprRegex : System.Text.RegularExpressions.Regex + { + public AspEncodedExprRegex() { } + public AspEncodedExprRegex(System.TimeSpan A_1) { } + } + public partial class AspExprRegex : System.Text.RegularExpressions.Regex + { + public AspExprRegex() { } + public AspExprRegex(System.TimeSpan A_1) { } + } + public partial class CommentRegex : System.Text.RegularExpressions.Regex + { + public CommentRegex() { } + public CommentRegex(System.TimeSpan A_1) { } + } + public partial class DatabindExprRegex : System.Text.RegularExpressions.Regex + { + public DatabindExprRegex() { } + public DatabindExprRegex(System.TimeSpan A_1) { } + } + public partial class DataBindRegex : System.Text.RegularExpressions.Regex + { + public DataBindRegex() { } + public DataBindRegex(System.TimeSpan A_1) { } + } + public partial class DirectiveRegex : System.Text.RegularExpressions.Regex + { + public DirectiveRegex() { } + public DirectiveRegex(System.TimeSpan A_1) { } + } + public partial class EndTagRegex : System.Text.RegularExpressions.Regex + { + public EndTagRegex() { } + public EndTagRegex(System.TimeSpan A_1) { } + } + public partial class GTRegex : System.Text.RegularExpressions.Regex + { + public GTRegex() { } + public GTRegex(System.TimeSpan A_1) { } + } + public partial class IncludeRegex : System.Text.RegularExpressions.Regex + { + public IncludeRegex() { } + public IncludeRegex(System.TimeSpan A_1) { } + } + public partial class LTRegex : System.Text.RegularExpressions.Regex + { + public LTRegex() { } + public LTRegex(System.TimeSpan A_1) { } + } + public partial class RunatServerRegex : System.Text.RegularExpressions.Regex + { + public RunatServerRegex() { } + public RunatServerRegex(System.TimeSpan A_1) { } + } + public partial class ServerTagsRegex : System.Text.RegularExpressions.Regex + { + public ServerTagsRegex() { } + public ServerTagsRegex(System.TimeSpan A_1) { } + } + public partial class SimpleDirectiveRegex : System.Text.RegularExpressions.Regex + { + public SimpleDirectiveRegex() { } + public SimpleDirectiveRegex(System.TimeSpan A_1) { } + } + public partial class TagRegex : System.Text.RegularExpressions.Regex + { + public TagRegex() { } + public TagRegex(System.TimeSpan A_1) { } + } + public partial class TagRegex35 : System.Text.RegularExpressions.Regex + { + public TagRegex35() { } + public TagRegex35(System.TimeSpan A_1) { } + } + public partial class TextRegex : System.Text.RegularExpressions.Regex + { + public TextRegex() { } + public TextRegex(System.TimeSpan A_1) { } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.Routing.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Routing.cs new file mode 100644 index 0000000000..2bf03f8b27 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Routing.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.Routing.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Web.Routing.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Routing.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute(PartialTrustVisibilityLevel=(System.Security.PartialTrustVisibilityLevel)(1))] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Security.SecurityTransparentAttribute] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.HttpMethodConstraint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.IRouteConstraint))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.IRouteHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RequestContext))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.Route))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RouteBase))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RouteCollection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RouteData))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RouteDirection))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RouteTable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.RouteValueDictionary))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.StopRoutingHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.UrlRoutingHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.UrlRoutingModule))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Web.Routing.VirtualPathData))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.Services.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Services.cs.REMOVED.git-id new file mode 100644 index 0000000000..1e1b2199ba --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.Services.cs.REMOVED.git-id @@ -0,0 +1 @@ +a7f9b6acb5e6104d6def1065c66e831dbceab7c1 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Web.cs.REMOVED.git-id new file mode 100644 index 0000000000..79708e8512 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.cs.REMOVED.git-id @@ -0,0 +1 @@ +30396592542e04793e4b67371dfb9af8ed92a285 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Web.extra.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Web.extra.cs new file mode 100644 index 0000000000..862c4b2307 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Web.extra.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] + +namespace System.Web.UI.WebControls +{ + [System.Web.UI.ControlBuilderAttribute(typeof(ContentBuilderInternal))] + partial class Content { } + [System.Web.UI.ControlBuilder(typeof(ContentPlaceHolderBuilder))] + partial class ContentPlaceHolder { } + internal partial class ContentBuilderInternal { } + internal partial class ContentPlaceHolderBuilder { } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Windows.Forms.DataVisualization.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Windows.Forms.DataVisualization.cs.REMOVED.git-id new file mode 100644 index 0000000000..c33dc7967f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Windows.Forms.DataVisualization.cs.REMOVED.git-id @@ -0,0 +1 @@ +612060c64bc74abe1c78e6c831f858dbffc0be4d \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Windows.Forms.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Windows.Forms.cs.REMOVED.git-id new file mode 100644 index 0000000000..a98bff6de3 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Windows.Forms.cs.REMOVED.git-id @@ -0,0 +1 @@ +84e543e06ed3e5e935a09a04f3073133d41ff2d2 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Windows.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Windows.cs new file mode 100644 index 0000000000..1d25413cf1 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Windows.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Windows.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Windows.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Windows.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.INotifyCollectionChanged))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedAction))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventHandler))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataErrorsChangedEventArgs))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.INotifyDataErrorInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Windows.Input.ICommand))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.Activities.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.Activities.cs new file mode 100644 index 0000000000..6fe4083fa9 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.Activities.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Workflow.Activities.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Workflow.Activities.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Workflow.Activities.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +#if false +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities.Rules")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Activities.Rules.Design")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsPrefixAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "wf")] +#endif diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.ComponentModel.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.ComponentModel.cs new file mode 100644 index 0000000000..57e1221fbc --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.ComponentModel.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Workflow.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Workflow.ComponentModel.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Workflow.ComponentModel.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +#if false +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml", "System.Workflow.ComponentModel.Serialization")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel.Compiler")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.ComponentModel.Design")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsPrefixAttribute("http://schemas.microsoft.com/winfx/2006/xaml", "x")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsPrefixAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "wf")] +#endif diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.Runtime.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.Runtime.cs new file mode 100644 index 0000000000..7b1543e36d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Workflow.Runtime.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Workflow.Runtime.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Workflow.Runtime.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Workflow.Runtime.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +#if false +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Configuration")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Hosting")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "System.Workflow.Runtime.Tracking")] +[assembly:System.Workflow.ComponentModel.Serialization.XmlnsPrefixAttribute("http://schemas.microsoft.com/winfx/2006/xaml/workflow", "wf")] +#endif +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Flags=(System.Security.Permissions.SecurityPermissionFlag)(136))] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Xaml.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Xaml.cs new file mode 100644 index 0000000000..5e44835e3a --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Xaml.cs @@ -0,0 +1,1210 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xaml.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xaml.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xaml.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(2), SkipVerificationInFullTrust=true)] +[assembly:System.Windows.Markup.XmlnsDefinitionAttribute("http://schemas.microsoft.com/winfx/2006/xaml", "System.Windows.Markup")] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, Execution=true)] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Windows.Markup.ValueSerializerAttribute))] +namespace System.Windows.Markup +{ + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=true, Inherited=true)] + [System.ObsoleteAttribute("This is not used by the XAML parser. Please look at XamlSetMarkupExtensionAttribute.")] + public partial class AcceptedMarkupExtensionExpressionTypeAttribute : System.Attribute + { + public AcceptedMarkupExtensionExpressionTypeAttribute(System.Type type) { } + public System.Type Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(196), Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class AmbientAttribute : System.Attribute + { + public AmbientAttribute() { } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.Windows.Markup.ContentPropertyAttribute("Items")] + [System.Windows.Markup.MarkupExtensionReturnTypeAttribute(typeof(System.Array))] + public partial class ArrayExtension : System.Windows.Markup.MarkupExtension + { + public ArrayExtension() { } + public ArrayExtension(System.Array elements) { } + public ArrayExtension(System.Type arrayType) { } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(2))] + public System.Collections.IList Items { get { throw null; } } + [System.Windows.Markup.ConstructorArgumentAttribute("type")] + public System.Type Type { get { throw null; } set { } } + public void AddChild(object value) { } + public void AddText(string text) { } + public override object ProvideValue(System.IServiceProvider serviceProvider) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128), AllowMultiple=false, Inherited=false)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class ConstructorArgumentAttribute : System.Attribute + { + public ConstructorArgumentAttribute(string argumentName) { } + public string ArgumentName { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class ContentPropertyAttribute : System.Attribute + { + public ContentPropertyAttribute() { } + public ContentPropertyAttribute(string name) { } + public string Name { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=true, Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class ContentWrapperAttribute : System.Attribute + { + public ContentWrapperAttribute(System.Type contentWrapper) { } + public System.Type ContentWrapper { get { throw null; } } + public override object TypeId { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial class DateTimeValueSerializer : System.Windows.Markup.ValueSerializer + { + public DateTimeValueSerializer() { } + public override bool CanConvertFromString(string value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public override bool CanConvertToString(object value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public override object ConvertFromString(string value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public override string ConvertToString(object value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(192), AllowMultiple=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class DependsOnAttribute : System.Attribute + { + public DependsOnAttribute(string name) { } + public string Name { get { throw null; } } + public override object TypeId { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class DictionaryKeyPropertyAttribute : System.Attribute + { + public DictionaryKeyPropertyAttribute(string name) { } + public string Name { get { throw null; } } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IComponentConnector + { + void Connect(int connectionId, object target); + void InitializeComponent(); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface INameScope + { + object FindName(string name); + void RegisterName(string name, object scopedElement); + void UnregisterName(string name); + } + public partial interface INameScopeDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable, System.Windows.Markup.INameScope + { + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IProvideValueTarget + { + object TargetObject { get; } + object TargetProperty { get; } + } + public partial interface IQueryAmbient + { + bool IsAmbientPropertyAvailable(string propertyName); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("PresentationCore, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IUriContext + { + System.Uri BaseUri { get; set; } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IValueSerializerContext : System.ComponentModel.ITypeDescriptorContext, System.IServiceProvider + { + System.Windows.Markup.ValueSerializer GetValueSerializerFor(System.ComponentModel.PropertyDescriptor descriptor); + System.Windows.Markup.ValueSerializer GetValueSerializerFor(System.Type type); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public partial interface IXamlTypeResolver + { + System.Type Resolve(string qualifiedTypeName); + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public abstract partial class MarkupExtension + { + protected MarkupExtension() { } + public abstract object ProvideValue(System.IServiceProvider serviceProvider); + } + [System.AttributeUsageAttribute((System.AttributeTargets)(128), AllowMultiple=true, Inherited=false)] + public sealed partial class MarkupExtensionBracketCharactersAttribute : System.Attribute + { + public MarkupExtensionBracketCharactersAttribute(char openingBracket, char closingBracket) { } + public char ClosingBracket { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public char OpeningBracket { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class MarkupExtensionReturnTypeAttribute : System.Attribute + { + public MarkupExtensionReturnTypeAttribute() { } + public MarkupExtensionReturnTypeAttribute(System.Type returnType) { } + [System.ObsoleteAttribute("The expressionType argument is not used by the XAML parser. To specify the expected return type, use MarkupExtensionReturnTypeAttribute(Type). To specify custom handling for expression types, use XamlSetMarkupExtensionAttribute.")] + public MarkupExtensionReturnTypeAttribute(System.Type returnType, System.Type expressionType) { } + [System.ObsoleteAttribute("This is not used by the XAML parser. Please look at XamlSetMarkupExtensionAttribute.")] + public System.Type ExpressionType { get { throw null; } } + public System.Type ReturnType { get { throw null; } } + } + public abstract partial class MemberDefinition + { + protected MemberDefinition() { } + public abstract string Name { get; set; } + } + public partial class NameReferenceConverter : System.ComponentModel.TypeConverter + { + public NameReferenceConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class NameScopePropertyAttribute : System.Attribute + { + public NameScopePropertyAttribute(string name) { } + public NameScopePropertyAttribute(string name, System.Type type) { } + public string Name { get { throw null; } } + public System.Type Type { get { throw null; } } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.Windows.Markup.MarkupExtensionReturnTypeAttribute(typeof(object))] + public partial class NullExtension : System.Windows.Markup.MarkupExtension + { + public NullExtension() { } + public override object ProvideValue(System.IServiceProvider serviceProvider) { throw null; } + } + public partial class PropertyDefinition : System.Windows.Markup.MemberDefinition + { + public PropertyDefinition() { } + public System.Collections.Generic.IList Attributes { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute(null)] + public string Modifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.ComponentModel.TypeConverterAttribute(typeof(System.Xaml.Schema.XamlTypeTypeConverter))] + public System.Xaml.XamlType Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.Windows.Markup.ContentPropertyAttribute("Name")] + public partial class Reference : System.Windows.Markup.MarkupExtension + { + public Reference() { } + public Reference(string name) { } + [System.Windows.Markup.ConstructorArgumentAttribute("name")] + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public override object ProvideValue(System.IServiceProvider serviceProvider) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1))] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class RootNamespaceAttribute : System.Attribute + { + public RootNamespaceAttribute(string nameSpace) { } + public string Namespace { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4))] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class RuntimeNamePropertyAttribute : System.Attribute + { + public RuntimeNamePropertyAttribute(string name) { } + public string Name { get { throw null; } } + } + [System.ComponentModel.TypeConverterAttribute("System.Windows.Markup.StaticExtensionConverter")] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.Windows.Markup.MarkupExtensionReturnTypeAttribute(typeof(object))] + public partial class StaticExtension : System.Windows.Markup.MarkupExtension + { + public StaticExtension() { } + public StaticExtension(string member) { } + [System.Windows.Markup.ConstructorArgumentAttribute("member")] + public string Member { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(null)] + public System.Type MemberType { get { throw null; } set { } } + public override object ProvideValue(System.IServiceProvider serviceProvider) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class TrimSurroundingWhitespaceAttribute : System.Attribute + { + public TrimSurroundingWhitespaceAttribute() { } + } + [System.ComponentModel.TypeConverterAttribute("System.Windows.Markup.TypeExtensionConverter")] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + [System.Windows.Markup.MarkupExtensionReturnTypeAttribute(typeof(System.Type))] + public partial class TypeExtension : System.Windows.Markup.MarkupExtension + { + public TypeExtension() { } + public TypeExtension(string typeName) { } + public TypeExtension(System.Type type) { } + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Windows.Markup.ConstructorArgumentAttribute("type")] + public System.Type Type { get { throw null; } set { } } + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + public string TypeName { get { throw null; } set { } } + public override object ProvideValue(System.IServiceProvider serviceProvider) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class UidPropertyAttribute : System.Attribute + { + public UidPropertyAttribute(string name) { } + public string Name { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + public sealed partial class UsableDuringInitializationAttribute : System.Attribute + { + public UsableDuringInitializationAttribute(bool usable) { } + public bool Usable { get { throw null; } } + } + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public abstract partial class ValueSerializer + { + protected ValueSerializer() { } + public virtual bool CanConvertFromString(string value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public virtual bool CanConvertToString(object value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public virtual object ConvertFromString(string value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public virtual string ConvertToString(object value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + protected System.Exception GetConvertFromException(object value) { throw null; } + protected System.Exception GetConvertToException(object value, System.Type destinationType) { throw null; } + public static System.Windows.Markup.ValueSerializer GetSerializerFor(System.ComponentModel.PropertyDescriptor descriptor) { throw null; } + public static System.Windows.Markup.ValueSerializer GetSerializerFor(System.ComponentModel.PropertyDescriptor descriptor, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public static System.Windows.Markup.ValueSerializer GetSerializerFor(System.Type type) { throw null; } + public static System.Windows.Markup.ValueSerializer GetSerializerFor(System.Type type, System.Windows.Markup.IValueSerializerContext context) { throw null; } + public virtual System.Collections.Generic.IEnumerable TypeReferences(object value, System.Windows.Markup.IValueSerializerContext context) { throw null; } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class WhitespaceSignificantCollectionAttribute : System.Attribute + { + public WhitespaceSignificantCollectionAttribute() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(132), AllowMultiple=false, Inherited=true)] + public sealed partial class XamlDeferLoadAttribute : System.Attribute + { + public XamlDeferLoadAttribute(string loaderType, string contentType) { } + public XamlDeferLoadAttribute(System.Type loaderType, System.Type contentType) { } + public System.Type ContentType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string ContentTypeName { get { throw null; } } + public System.Type LoaderType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string LoaderTypeName { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true, AllowMultiple=false)] + public sealed partial class XamlSetMarkupExtensionAttribute : System.Attribute + { + public XamlSetMarkupExtensionAttribute(string xamlSetMarkupExtensionHandler) { } + public string XamlSetMarkupExtensionHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class XamlSetMarkupExtensionEventArgs : System.Windows.Markup.XamlSetValueEventArgs + { + public XamlSetMarkupExtensionEventArgs(System.Xaml.XamlMember member, System.Windows.Markup.MarkupExtension value, System.IServiceProvider serviceProvider) : base (default(System.Xaml.XamlMember), default(object)) { } + public System.Windows.Markup.MarkupExtension MarkupExtension { get { throw null; } } + public System.IServiceProvider ServiceProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override void CallBase() { } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true, AllowMultiple=false)] + public sealed partial class XamlSetTypeConverterAttribute : System.Attribute + { + public XamlSetTypeConverterAttribute(string xamlSetTypeConverterHandler) { } + public string XamlSetTypeConverterHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class XamlSetTypeConverterEventArgs : System.Windows.Markup.XamlSetValueEventArgs + { + public XamlSetTypeConverterEventArgs(System.Xaml.XamlMember member, System.ComponentModel.TypeConverter typeConverter, object value, System.ComponentModel.ITypeDescriptorContext serviceProvider, System.Globalization.CultureInfo cultureInfo) : base (default(System.Xaml.XamlMember), default(object)) { } + public System.Globalization.CultureInfo CultureInfo { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.ITypeDescriptorContext ServiceProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.ComponentModel.TypeConverter TypeConverter { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override void CallBase() { } + } + public partial class XamlSetValueEventArgs : System.EventArgs + { + public XamlSetValueEventArgs(System.Xaml.XamlMember member, object value) { } + public bool Handled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Xaml.XamlMember Member { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public virtual void CallBase() { } + } + [System.Windows.Markup.ContentPropertyAttribute("Text")] + public sealed partial class XData + { + public XData() { } + public string Text { get { throw null; } set { } } + public object XmlReader { get { throw null; } set { } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class XmlLangPropertyAttribute : System.Attribute + { + public XmlLangPropertyAttribute(string name) { } + public string Name { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class XmlnsCompatibleWithAttribute : System.Attribute + { + public XmlnsCompatibleWithAttribute(string oldNamespace, string newNamespace) { } + public string NewNamespace { get { throw null; } } + public string OldNamespace { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class XmlnsDefinitionAttribute : System.Attribute + { + public XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace) { } + public string AssemblyName { get { throw null; } set { } } + public string ClrNamespace { get { throw null; } } + public string XmlNamespace { get { throw null; } } + } + [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true)] + [System.Runtime.CompilerServices.TypeForwardedFromAttribute("WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] + public sealed partial class XmlnsPrefixAttribute : System.Attribute + { + public XmlnsPrefixAttribute(string xmlNamespace, string prefix) { } + public string Prefix { get { throw null; } } + public string XmlNamespace { get { throw null; } } + } +} +namespace System.Xaml +{ + public partial class AmbientPropertyValue + { + public AmbientPropertyValue(System.Xaml.XamlMember property, object value) { } + public System.Xaml.XamlMember RetrievedProperty { get { throw null; } } + public object Value { get { throw null; } } + } + public partial class AttachableMemberIdentifier : System.IEquatable + { + public AttachableMemberIdentifier(System.Type declaringType, string memberName) { } + public System.Type DeclaringType { get { throw null; } } + public string MemberName { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.Xaml.AttachableMemberIdentifier other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Xaml.AttachableMemberIdentifier left, System.Xaml.AttachableMemberIdentifier right) { throw null; } + public static bool operator !=(System.Xaml.AttachableMemberIdentifier left, System.Xaml.AttachableMemberIdentifier right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class AttachablePropertyServices + { + public static void CopyPropertiesTo(object instance, System.Collections.Generic.KeyValuePair[] array, int index) { } + public static int GetAttachedPropertyCount(object instance) { throw null; } + public static bool RemoveProperty(object instance, System.Xaml.AttachableMemberIdentifier name) { throw null; } + public static void SetProperty(object instance, System.Xaml.AttachableMemberIdentifier name, object value) { } + public static bool TryGetProperty(object instance, System.Xaml.AttachableMemberIdentifier name, out object value) { value = default(object); throw null; } + public static bool TryGetProperty(object instance, System.Xaml.AttachableMemberIdentifier name, out T value) { value = default(T); throw null; } + } + public partial interface IAmbientProvider + { + System.Collections.Generic.IEnumerable GetAllAmbientValues(System.Collections.Generic.IEnumerable ceilingTypes, bool searchLiveStackOnly, System.Collections.Generic.IEnumerable types, params System.Xaml.XamlMember[] properties); + System.Collections.Generic.IEnumerable GetAllAmbientValues(System.Collections.Generic.IEnumerable ceilingTypes, params System.Xaml.XamlMember[] properties); + System.Collections.Generic.IEnumerable GetAllAmbientValues(params System.Xaml.XamlType[] types); + System.Xaml.AmbientPropertyValue GetFirstAmbientValue(System.Collections.Generic.IEnumerable ceilingTypes, params System.Xaml.XamlMember[] properties); + object GetFirstAmbientValue(params System.Xaml.XamlType[] types); + } + public partial interface IAttachedPropertyStore + { + int PropertyCount { get; } + void CopyPropertiesTo(System.Collections.Generic.KeyValuePair[] array, int index); + bool RemoveProperty(System.Xaml.AttachableMemberIdentifier attachableMemberIdentifier); + void SetProperty(System.Xaml.AttachableMemberIdentifier attachableMemberIdentifier, object value); + bool TryGetProperty(System.Xaml.AttachableMemberIdentifier attachableMemberIdentifier, out object value); + } + public partial interface IDestinationTypeProvider + { + System.Type GetDestinationType(); + } + public partial interface INamespacePrefixLookup + { + string LookupPrefix(string ns); + } + public partial interface IRootObjectProvider + { + object RootObject { get; } + } + public partial interface IXamlIndexingReader + { + int Count { get; } + int CurrentIndex { get; set; } + } + public partial interface IXamlLineInfo + { + bool HasLineInfo { get; } + int LineNumber { get; } + int LinePosition { get; } + } + public partial interface IXamlLineInfoConsumer + { + bool ShouldProvideLineInfo { get; } + void SetLineInfo(int lineNumber, int linePosition); + } + public partial interface IXamlNameProvider + { + string GetName(object value); + } + public partial interface IXamlNameResolver + { + bool IsFixupTokenAvailable { get; } + event System.EventHandler OnNameScopeInitializationComplete; + System.Collections.Generic.IEnumerable> GetAllNamesAndValuesInScope(); + object GetFixupToken(System.Collections.Generic.IEnumerable names); + object GetFixupToken(System.Collections.Generic.IEnumerable names, bool canAssignDirectly); + object Resolve(string name); + object Resolve(string name, out bool isFullyInitialized); + } + public partial interface IXamlNamespaceResolver + { + string GetNamespace(string prefix); + System.Collections.Generic.IEnumerable GetNamespacePrefixes(); + } + public partial interface IXamlObjectWriterFactory + { + System.Xaml.XamlObjectWriterSettings GetParentSettings(); + System.Xaml.XamlObjectWriter GetXamlObjectWriter(System.Xaml.XamlObjectWriterSettings settings); + } + public partial interface IXamlSchemaContextProvider + { + System.Xaml.XamlSchemaContext SchemaContext { get; } + } + [System.Diagnostics.DebuggerDisplayAttribute("Prefix={Prefix} Namespace={Namespace}")] + public partial class NamespaceDeclaration + { + public NamespaceDeclaration(string ns, string prefix) { } + public string Namespace { get { throw null; } } + public string Prefix { get { throw null; } } + } + public partial class XamlBackgroundReader : System.Xaml.XamlReader, System.Xaml.IXamlLineInfo + { + public XamlBackgroundReader(System.Xaml.XamlReader wrappedReader) { } + public bool HasLineInfo { get { throw null; } } + public override bool IsEof { get { throw null; } } + public int LineNumber { get { throw null; } } + public int LinePosition { get { throw null; } } + public override System.Xaml.XamlMember Member { get { throw null; } } + public override System.Xaml.NamespaceDeclaration Namespace { get { throw null; } } + public override System.Xaml.XamlNodeType NodeType { get { throw null; } } + public override System.Xaml.XamlSchemaContext SchemaContext { get { throw null; } } + public override System.Xaml.XamlType Type { get { throw null; } } + public override object Value { get { throw null; } } + protected override void Dispose(bool disposing) { } + public override bool Read() { throw null; } + public void StartThread() { } + public void StartThread(string threadName) { } + } + public abstract partial class XamlDeferringLoader + { + protected XamlDeferringLoader() { } + public abstract object Load(System.Xaml.XamlReader xamlReader, System.IServiceProvider serviceProvider); + public abstract System.Xaml.XamlReader Save(object value, System.IServiceProvider serviceProvider); + } + public partial class XamlDirective : System.Xaml.XamlMember + { + public XamlDirective(System.Collections.Generic.IEnumerable xamlNamespaces, string name, System.Xaml.XamlType xamlType, System.Xaml.Schema.XamlValueConverter typeConverter, System.Xaml.Schema.AllowedMemberLocations allowedLocation) : base (default(string), default(System.Xaml.XamlType), default(bool)) { } + public XamlDirective(string xamlNamespace, string name) : base (default(string), default(System.Xaml.XamlType), default(bool)) { } + public System.Xaml.Schema.AllowedMemberLocations AllowedLocation { get { throw null; } } + public override int GetHashCode() { throw null; } + public override System.Collections.Generic.IList GetXamlNamespaces() { throw null; } + protected sealed override System.Reflection.ICustomAttributeProvider LookupCustomAttributeProvider() { throw null; } + protected sealed override System.Xaml.Schema.XamlValueConverter LookupDeferringLoader() { throw null; } + protected sealed override System.Collections.Generic.IList LookupDependsOn() { throw null; } + protected sealed override System.Xaml.Schema.XamlMemberInvoker LookupInvoker() { throw null; } + protected sealed override bool LookupIsAmbient() { throw null; } + protected sealed override bool LookupIsEvent() { throw null; } + protected sealed override bool LookupIsReadOnly() { throw null; } + protected sealed override bool LookupIsReadPublic() { throw null; } + protected sealed override bool LookupIsUnknown() { throw null; } + protected sealed override bool LookupIsWriteOnly() { throw null; } + protected sealed override bool LookupIsWritePublic() { throw null; } + protected sealed override System.Xaml.XamlType LookupTargetType() { throw null; } + protected sealed override System.Xaml.XamlType LookupType() { throw null; } + protected sealed override System.Xaml.Schema.XamlValueConverter LookupTypeConverter() { throw null; } + protected sealed override System.Reflection.MethodInfo LookupUnderlyingGetter() { throw null; } + protected sealed override System.Reflection.MemberInfo LookupUnderlyingMember() { throw null; } + protected sealed override System.Reflection.MethodInfo LookupUnderlyingSetter() { throw null; } + public override string ToString() { throw null; } + } + [System.SerializableAttribute] + public partial class XamlDuplicateMemberException : System.Xaml.XamlException + { + public XamlDuplicateMemberException() { } + protected XamlDuplicateMemberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlDuplicateMemberException(string message) { } + public XamlDuplicateMemberException(string message, System.Exception innerException) { } + public XamlDuplicateMemberException(System.Xaml.XamlMember member, System.Xaml.XamlType type) { } + public System.Xaml.XamlMember DuplicateMember { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Xaml.XamlType ParentType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class XamlException : System.Exception + { + public XamlException() { } + protected XamlException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlException(string message) { } + public XamlException(string message, System.Exception innerException) { } + public XamlException(string message, System.Exception innerException, int lineNumber, int linePosition) { } + public int LineNumber { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public int LinePosition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } } + public override string Message { get { throw null; } } + [System.Security.SecurityCriticalAttribute] + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + [System.SerializableAttribute] + public partial class XamlInternalException : System.Xaml.XamlException + { + public XamlInternalException() { } + protected XamlInternalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlInternalException(string message) { } + public XamlInternalException(string message, System.Exception innerException) { } + } + public static partial class XamlLanguage + { + public const string Xaml2006Namespace = "http://schemas.microsoft.com/winfx/2006/xaml"; + public const string Xml1998Namespace = "http://www.w3.org/XML/1998/namespace"; + public static System.Collections.ObjectModel.ReadOnlyCollection AllDirectives { get { throw null; } } + public static System.Collections.ObjectModel.ReadOnlyCollection AllTypes { get { throw null; } } + public static System.Xaml.XamlDirective Arguments { get { throw null; } } + public static System.Xaml.XamlType Array { get { throw null; } } + public static System.Xaml.XamlDirective AsyncRecords { get { throw null; } } + public static System.Xaml.XamlDirective Base { get { throw null; } } + public static System.Xaml.XamlType Boolean { get { throw null; } } + public static System.Xaml.XamlType Byte { get { throw null; } } + public static System.Xaml.XamlType Char { get { throw null; } } + public static System.Xaml.XamlDirective Class { get { throw null; } } + public static System.Xaml.XamlDirective ClassAttributes { get { throw null; } } + public static System.Xaml.XamlDirective ClassModifier { get { throw null; } } + public static System.Xaml.XamlDirective Code { get { throw null; } } + public static System.Xaml.XamlDirective ConnectionId { get { throw null; } } + public static System.Xaml.XamlType Decimal { get { throw null; } } + public static System.Xaml.XamlType Double { get { throw null; } } + public static System.Xaml.XamlDirective FactoryMethod { get { throw null; } } + public static System.Xaml.XamlDirective FieldModifier { get { throw null; } } + public static System.Xaml.XamlDirective Initialization { get { throw null; } } + public static System.Xaml.XamlType Int16 { get { throw null; } } + public static System.Xaml.XamlType Int32 { get { throw null; } } + public static System.Xaml.XamlType Int64 { get { throw null; } } + public static System.Xaml.XamlDirective Items { get { throw null; } } + public static System.Xaml.XamlDirective Key { get { throw null; } } + public static System.Xaml.XamlDirective Lang { get { throw null; } } + public static System.Xaml.XamlType Member { get { throw null; } } + public static System.Xaml.XamlDirective Members { get { throw null; } } + public static System.Xaml.XamlDirective Name { get { throw null; } } + public static System.Xaml.XamlType Null { get { throw null; } } + public static System.Xaml.XamlType Object { get { throw null; } } + public static System.Xaml.XamlDirective PositionalParameters { get { throw null; } } + public static System.Xaml.XamlType Property { get { throw null; } } + public static System.Xaml.XamlType Reference { get { throw null; } } + public static System.Xaml.XamlDirective Shared { get { throw null; } } + public static System.Xaml.XamlType Single { get { throw null; } } + public static System.Xaml.XamlDirective Space { get { throw null; } } + public static System.Xaml.XamlType Static { get { throw null; } } + public static System.Xaml.XamlType String { get { throw null; } } + public static System.Xaml.XamlDirective Subclass { get { throw null; } } + public static System.Xaml.XamlDirective SynchronousMode { get { throw null; } } + public static System.Xaml.XamlType TimeSpan { get { throw null; } } + public static System.Xaml.XamlType Type { get { throw null; } } + public static System.Xaml.XamlDirective TypeArguments { get { throw null; } } + public static System.Xaml.XamlDirective Uid { get { throw null; } } + public static System.Xaml.XamlDirective UnknownContent { get { throw null; } } + public static System.Xaml.XamlType Uri { get { throw null; } } + public static System.Collections.Generic.IList XamlNamespaces { get { throw null; } } + public static System.Xaml.XamlType XData { get { throw null; } } + public static System.Collections.Generic.IList XmlNamespaces { get { throw null; } } + } + public partial class XamlMember : System.IEquatable + { + public XamlMember(System.Reflection.EventInfo eventInfo, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlMember(System.Reflection.EventInfo eventInfo, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.Schema.XamlMemberInvoker invoker) { } + public XamlMember(System.Reflection.PropertyInfo propertyInfo, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlMember(System.Reflection.PropertyInfo propertyInfo, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.Schema.XamlMemberInvoker invoker) { } + public XamlMember(string attachablePropertyName, System.Reflection.MethodInfo getter, System.Reflection.MethodInfo setter, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlMember(string attachablePropertyName, System.Reflection.MethodInfo getter, System.Reflection.MethodInfo setter, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.Schema.XamlMemberInvoker invoker) { } + public XamlMember(string attachableEventName, System.Reflection.MethodInfo adder, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlMember(string attachableEventName, System.Reflection.MethodInfo adder, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.Schema.XamlMemberInvoker invoker) { } + public XamlMember(string name, System.Xaml.XamlType declaringType, bool isAttachable) { } + public System.Xaml.XamlType DeclaringType { get { throw null; } } + public System.Xaml.Schema.XamlValueConverter DeferringLoader { get { throw null; } } + public System.Collections.Generic.IList DependsOn { get { throw null; } } + public System.Xaml.Schema.XamlMemberInvoker Invoker { get { throw null; } } + public bool IsAmbient { get { throw null; } } + public bool IsAttachable { get { throw null; } } + public bool IsDirective { get { throw null; } } + public bool IsEvent { get { throw null; } } + public bool IsNameValid { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public bool IsReadPublic { get { throw null; } } + public bool IsUnknown { get { throw null; } } + public bool IsWriteOnly { get { throw null; } } + public bool IsWritePublic { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary MarkupExtensionBracketCharacters { get { throw null; } } + public string Name { get { throw null; } } + public string PreferredXamlNamespace { get { throw null; } } + public System.ComponentModel.DesignerSerializationVisibility SerializationVisibility { get { throw null; } } + public System.Xaml.XamlType TargetType { get { throw null; } } + public System.Xaml.XamlType Type { get { throw null; } } + public System.Xaml.Schema.XamlValueConverter TypeConverter { get { throw null; } } + public System.Reflection.MemberInfo UnderlyingMember { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Xaml.Schema.XamlValueConverter ValueSerializer { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.Xaml.XamlMember other) { throw null; } + public override int GetHashCode() { throw null; } + public virtual System.Collections.Generic.IList GetXamlNamespaces() { throw null; } + protected virtual System.Reflection.ICustomAttributeProvider LookupCustomAttributeProvider() { throw null; } + protected virtual System.Xaml.Schema.XamlValueConverter LookupDeferringLoader() { throw null; } + protected virtual System.Collections.Generic.IList LookupDependsOn() { throw null; } + protected virtual System.Xaml.Schema.XamlMemberInvoker LookupInvoker() { throw null; } + protected virtual bool LookupIsAmbient() { throw null; } + protected virtual bool LookupIsEvent() { throw null; } + protected virtual bool LookupIsReadOnly() { throw null; } + protected virtual bool LookupIsReadPublic() { throw null; } + protected virtual bool LookupIsUnknown() { throw null; } + protected virtual bool LookupIsWriteOnly() { throw null; } + protected virtual bool LookupIsWritePublic() { throw null; } + protected virtual System.Collections.Generic.IReadOnlyDictionary LookupMarkupExtensionBracketCharacters() { throw null; } + protected virtual System.Xaml.XamlType LookupTargetType() { throw null; } + protected virtual System.Xaml.XamlType LookupType() { throw null; } + protected virtual System.Xaml.Schema.XamlValueConverter LookupTypeConverter() { throw null; } + protected virtual System.Reflection.MethodInfo LookupUnderlyingGetter() { throw null; } + protected virtual System.Reflection.MemberInfo LookupUnderlyingMember() { throw null; } + protected virtual System.Reflection.MethodInfo LookupUnderlyingSetter() { throw null; } + protected virtual System.Xaml.Schema.XamlValueConverter LookupValueSerializer() { throw null; } + public static bool operator ==(System.Xaml.XamlMember xamlMember1, System.Xaml.XamlMember xamlMember2) { throw null; } + public static bool operator !=(System.Xaml.XamlMember xamlMember1, System.Xaml.XamlMember xamlMember2) { throw null; } + public override string ToString() { throw null; } + } + public partial class XamlNodeList + { + public XamlNodeList(System.Xaml.XamlSchemaContext schemaContext) { } + public XamlNodeList(System.Xaml.XamlSchemaContext schemaContext, int size) { } + public int Count { get { throw null; } } + public System.Xaml.XamlWriter Writer { get { throw null; } } + public void Clear() { } + public System.Xaml.XamlReader GetReader() { throw null; } + } + public partial class XamlNodeQueue + { + public XamlNodeQueue(System.Xaml.XamlSchemaContext schemaContext) { } + public int Count { get { throw null; } } + public bool IsEmpty { get { throw null; } } + public System.Xaml.XamlReader Reader { get { throw null; } } + public System.Xaml.XamlWriter Writer { get { throw null; } } + } + public enum XamlNodeType : byte + { + EndMember = (byte)5, + EndObject = (byte)3, + GetObject = (byte)2, + NamespaceDeclaration = (byte)7, + None = (byte)0, + StartMember = (byte)4, + StartObject = (byte)1, + Value = (byte)6, + } + public partial class XamlObjectEventArgs : System.EventArgs + { + public XamlObjectEventArgs(object instance) { } + public int ElementLineNumber { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public int ElementLinePosition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public object Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Uri SourceBamlUri { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + } + public partial class XamlObjectReader : System.Xaml.XamlReader + { + public XamlObjectReader(object instance) { } + public XamlObjectReader(object instance, System.Xaml.XamlObjectReaderSettings settings) { } + public XamlObjectReader(object instance, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlObjectReader(object instance, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlObjectReaderSettings settings) { } + public virtual object Instance { get { throw null; } } + public override bool IsEof { get { throw null; } } + public override System.Xaml.XamlMember Member { get { throw null; } } + public override System.Xaml.NamespaceDeclaration Namespace { get { throw null; } } + public override System.Xaml.XamlNodeType NodeType { get { throw null; } } + public override System.Xaml.XamlSchemaContext SchemaContext { get { throw null; } } + public override System.Xaml.XamlType Type { get { throw null; } } + public override object Value { get { throw null; } } + public override bool Read() { throw null; } + } + [System.SerializableAttribute] + public partial class XamlObjectReaderException : System.Xaml.XamlException + { + public XamlObjectReaderException() { } + protected XamlObjectReaderException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlObjectReaderException(string message) { } + public XamlObjectReaderException(string message, System.Exception innerException) { } + } + public partial class XamlObjectReaderSettings : System.Xaml.XamlReaderSettings + { + public XamlObjectReaderSettings() { } + public bool RequireExplicitContentVisibility { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class XamlObjectWriter : System.Xaml.XamlWriter, System.Xaml.IXamlLineInfoConsumer + { + public XamlObjectWriter(System.Xaml.XamlSchemaContext schemaContext) { } + public XamlObjectWriter(System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlObjectWriterSettings settings) { } + public virtual object Result { get { throw null; } } + public System.Windows.Markup.INameScope RootNameScope { get { throw null; } } + public override System.Xaml.XamlSchemaContext SchemaContext { get { throw null; } } + public bool ShouldProvideLineInfo { get { throw null; } } + public void Clear() { } + protected override void Dispose(bool disposing) { } + protected virtual void OnAfterBeginInit(object value) { } + protected virtual void OnAfterEndInit(object value) { } + protected virtual void OnAfterProperties(object value) { } + protected virtual void OnBeforeProperties(object value) { } + protected virtual bool OnSetValue(object eventSender, System.Xaml.XamlMember member, object value) { throw null; } + public void SetLineInfo(int lineNumber, int linePosition) { } + public override void WriteEndMember() { } + public override void WriteEndObject() { } + public override void WriteGetObject() { } + public override void WriteNamespace(System.Xaml.NamespaceDeclaration namespaceDeclaration) { } + public override void WriteStartMember(System.Xaml.XamlMember property) { } + public override void WriteStartObject(System.Xaml.XamlType xamlType) { } + public override void WriteValue(object value) { } + } + [System.SerializableAttribute] + public partial class XamlObjectWriterException : System.Xaml.XamlException + { + public XamlObjectWriterException() { } + protected XamlObjectWriterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlObjectWriterException(string message) { } + public XamlObjectWriterException(string message, System.Exception innerException) { } + } + public partial class XamlObjectWriterSettings : System.Xaml.XamlWriterSettings + { + public XamlObjectWriterSettings() { } + public XamlObjectWriterSettings(System.Xaml.XamlObjectWriterSettings settings) { } + public System.Xaml.Permissions.XamlAccessLevel AccessLevel { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.EventHandler AfterBeginInitHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.EventHandler AfterEndInitHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.EventHandler AfterPropertiesHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.EventHandler BeforePropertiesHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Windows.Markup.INameScope ExternalNameScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IgnoreCanConvert { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool PreferUnconvertedDictionaryKeys { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool RegisterNamesOnExternalNamescope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public object RootObjectInstance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SkipDuplicatePropertyCheck { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SkipProvideValueOnRoot { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Uri SourceBamlUri { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.EventHandler XamlSetValueHandler { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.SerializableAttribute] + public partial class XamlParseException : System.Xaml.XamlException + { + public XamlParseException() { } + protected XamlParseException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlParseException(string message) { } + public XamlParseException(string message, System.Exception innerException) { } + } + public abstract partial class XamlReader : System.IDisposable + { + protected XamlReader() { } + protected bool IsDisposed { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public abstract bool IsEof { get; } + public abstract System.Xaml.XamlMember Member { get; } + public abstract System.Xaml.NamespaceDeclaration Namespace { get; } + public abstract System.Xaml.XamlNodeType NodeType { get; } + public abstract System.Xaml.XamlSchemaContext SchemaContext { get; } + public abstract System.Xaml.XamlType Type { get; } + public abstract object Value { get; } + public void Close() { } + protected virtual void Dispose(bool disposing) { } + public abstract bool Read(); + public virtual System.Xaml.XamlReader ReadSubtree() { throw null; } + public virtual void Skip() { } + void System.IDisposable.Dispose() { } + } + public partial class XamlReaderSettings + { + public XamlReaderSettings() { } + public XamlReaderSettings(System.Xaml.XamlReaderSettings settings) { } + public bool AllowProtectedMembersOnRoot { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Uri BaseUri { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool IgnoreUidsOnPropertyElements { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Reflection.Assembly LocalAssembly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool ProvideLineInfo { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool ValuesMustBeString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class XamlSchemaContext + { + public XamlSchemaContext() { } + public XamlSchemaContext(System.Collections.Generic.IEnumerable referenceAssemblies) { } + public XamlSchemaContext(System.Collections.Generic.IEnumerable referenceAssemblies, System.Xaml.XamlSchemaContextSettings settings) { } + public XamlSchemaContext(System.Xaml.XamlSchemaContextSettings settings) { } + public bool FullyQualifyAssemblyNamesInClrNamespaces { get { throw null; } } + public System.Collections.Generic.IList ReferenceAssemblies { get { throw null; } } + public bool SupportMarkupExtensionsWithDuplicateArity { get { throw null; } } + ~XamlSchemaContext() { } + public virtual System.Collections.Generic.IEnumerable GetAllXamlNamespaces() { throw null; } + public virtual System.Collections.Generic.ICollection GetAllXamlTypes(string xamlNamespace) { throw null; } + public virtual string GetPreferredPrefix(string xmlns) { throw null; } + protected internal System.Xaml.Schema.XamlValueConverter GetValueConverter(System.Type converterType, System.Xaml.XamlType targetType) where TConverterBase : class { throw null; } + public virtual System.Xaml.XamlDirective GetXamlDirective(string xamlNamespace, string name) { throw null; } + protected internal virtual System.Xaml.XamlType GetXamlType(string xamlNamespace, string name, params System.Xaml.XamlType[] typeArguments) { throw null; } + public virtual System.Xaml.XamlType GetXamlType(System.Type type) { throw null; } + public System.Xaml.XamlType GetXamlType(System.Xaml.Schema.XamlTypeName xamlTypeName) { throw null; } + protected internal virtual System.Reflection.Assembly OnAssemblyResolve(string assemblyName) { throw null; } + public virtual bool TryGetCompatibleXamlNamespace(string xamlNamespace, out string compatibleNamespace) { compatibleNamespace = default(string); throw null; } + } + public partial class XamlSchemaContextSettings + { + public XamlSchemaContextSettings() { } + public XamlSchemaContextSettings(System.Xaml.XamlSchemaContextSettings settings) { } + public bool FullyQualifyAssemblyNamesInClrNamespaces { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SupportMarkupExtensionsWithDuplicateArity { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + [System.SerializableAttribute] + public partial class XamlSchemaException : System.Xaml.XamlException + { + public XamlSchemaException() { } + protected XamlSchemaException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlSchemaException(string message) { } + public XamlSchemaException(string message, System.Exception innerException) { } + } + public static partial class XamlServices + { + public static object Load(System.IO.Stream stream) { throw null; } + public static object Load(System.IO.TextReader textReader) { throw null; } + public static object Load(string fileName) { throw null; } + public static object Load(System.Xaml.XamlReader xamlReader) { throw null; } + public static object Load(System.Xml.XmlReader xmlReader) { throw null; } + public static object Parse(string xaml) { throw null; } + public static void Save(System.IO.Stream stream, object instance) { } + public static void Save(System.IO.TextWriter writer, object instance) { } + public static string Save(object instance) { throw null; } + public static void Save(string fileName, object instance) { } + public static void Save(System.Xaml.XamlWriter writer, object instance) { } + public static void Save(System.Xml.XmlWriter writer, object instance) { } + public static void Transform(System.Xaml.XamlReader xamlReader, System.Xaml.XamlWriter xamlWriter) { } + public static void Transform(System.Xaml.XamlReader xamlReader, System.Xaml.XamlWriter xamlWriter, bool closeWriter) { } + } + public partial class XamlType : System.IEquatable + { + protected XamlType(string typeName, System.Collections.Generic.IList typeArguments, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlType(string unknownTypeNamespace, string unknownTypeName, System.Collections.Generic.IList typeArguments, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlType(System.Type underlyingType, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlType(System.Type underlyingType, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.Schema.XamlTypeInvoker invoker) { } + public System.Collections.Generic.IList AllowedContentTypes { get { throw null; } } + public System.Xaml.XamlType BaseType { get { throw null; } } + public bool ConstructionRequiresArguments { get { throw null; } } + public System.Xaml.XamlMember ContentProperty { get { throw null; } } + public System.Collections.Generic.IList ContentWrappers { get { throw null; } } + public System.Xaml.Schema.XamlValueConverter DeferringLoader { get { throw null; } } + public System.Xaml.Schema.XamlTypeInvoker Invoker { get { throw null; } } + public bool IsAmbient { get { throw null; } } + public bool IsArray { get { throw null; } } + public bool IsCollection { get { throw null; } } + public bool IsConstructible { get { throw null; } } + public bool IsDictionary { get { throw null; } } + public bool IsGeneric { get { throw null; } } + public bool IsMarkupExtension { get { throw null; } } + public bool IsNameScope { get { throw null; } } + public bool IsNameValid { get { throw null; } } + public bool IsNullable { get { throw null; } } + public bool IsPublic { get { throw null; } } + public bool IsUnknown { get { throw null; } } + public bool IsUsableDuringInitialization { get { throw null; } } + public bool IsWhitespaceSignificantCollection { get { throw null; } } + public bool IsXData { get { throw null; } } + public System.Xaml.XamlType ItemType { get { throw null; } } + public System.Xaml.XamlType KeyType { get { throw null; } } + public System.Xaml.XamlType MarkupExtensionReturnType { get { throw null; } } + public string Name { get { throw null; } } + public string PreferredXamlNamespace { get { throw null; } } + public System.Xaml.XamlSchemaContext SchemaContext { get { throw null; } } + public bool TrimSurroundingWhitespace { get { throw null; } } + public System.Collections.Generic.IList TypeArguments { get { throw null; } } + public System.Xaml.Schema.XamlValueConverter TypeConverter { get { throw null; } } + public System.Type UnderlyingType { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } } + public System.Xaml.Schema.XamlValueConverter ValueSerializer { get { throw null; } } + public virtual bool CanAssignTo(System.Xaml.XamlType xamlType) { throw null; } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.Xaml.XamlType other) { throw null; } + public System.Xaml.XamlMember GetAliasedProperty(System.Xaml.XamlDirective directive) { throw null; } + public System.Collections.Generic.ICollection GetAllAttachableMembers() { throw null; } + public System.Collections.Generic.ICollection GetAllMembers() { throw null; } + public System.Xaml.XamlMember GetAttachableMember(string name) { throw null; } + public override int GetHashCode() { throw null; } + public System.Xaml.XamlMember GetMember(string name) { throw null; } + public System.Collections.Generic.IList GetPositionalParameters(int parameterCount) { throw null; } + public virtual System.Collections.Generic.IList GetXamlNamespaces() { throw null; } + protected virtual System.Xaml.XamlMember LookupAliasedProperty(System.Xaml.XamlDirective directive) { throw null; } + protected virtual System.Collections.Generic.IEnumerable LookupAllAttachableMembers() { throw null; } + protected virtual System.Collections.Generic.IEnumerable LookupAllMembers() { throw null; } + protected virtual System.Collections.Generic.IList LookupAllowedContentTypes() { throw null; } + protected virtual System.Xaml.XamlMember LookupAttachableMember(string name) { throw null; } + protected virtual System.Xaml.XamlType LookupBaseType() { throw null; } + protected virtual System.Xaml.Schema.XamlCollectionKind LookupCollectionKind() { throw null; } + protected virtual bool LookupConstructionRequiresArguments() { throw null; } + protected virtual System.Xaml.XamlMember LookupContentProperty() { throw null; } + protected virtual System.Collections.Generic.IList LookupContentWrappers() { throw null; } + protected virtual System.Reflection.ICustomAttributeProvider LookupCustomAttributeProvider() { throw null; } + protected virtual System.Xaml.Schema.XamlValueConverter LookupDeferringLoader() { throw null; } + protected virtual System.Xaml.Schema.XamlTypeInvoker LookupInvoker() { throw null; } + protected virtual bool LookupIsAmbient() { throw null; } + protected virtual bool LookupIsConstructible() { throw null; } + protected virtual bool LookupIsMarkupExtension() { throw null; } + protected virtual bool LookupIsNameScope() { throw null; } + protected virtual bool LookupIsNullable() { throw null; } + protected virtual bool LookupIsPublic() { throw null; } + protected virtual bool LookupIsUnknown() { throw null; } + protected virtual bool LookupIsWhitespaceSignificantCollection() { throw null; } + protected virtual bool LookupIsXData() { throw null; } + protected virtual System.Xaml.XamlType LookupItemType() { throw null; } + protected virtual System.Xaml.XamlType LookupKeyType() { throw null; } + protected virtual System.Xaml.XamlType LookupMarkupExtensionReturnType() { throw null; } + protected virtual System.Xaml.XamlMember LookupMember(string name, bool skipReadOnlyCheck) { throw null; } + protected virtual System.Collections.Generic.IList LookupPositionalParameters(int parameterCount) { throw null; } + protected virtual System.EventHandler LookupSetMarkupExtensionHandler() { throw null; } + protected virtual System.EventHandler LookupSetTypeConverterHandler() { throw null; } + protected virtual bool LookupTrimSurroundingWhitespace() { throw null; } + protected virtual System.Xaml.Schema.XamlValueConverter LookupTypeConverter() { throw null; } + protected virtual System.Type LookupUnderlyingType() { throw null; } + protected virtual bool LookupUsableDuringInitialization() { throw null; } + protected virtual System.Xaml.Schema.XamlValueConverter LookupValueSerializer() { throw null; } + public static bool operator ==(System.Xaml.XamlType xamlType1, System.Xaml.XamlType xamlType2) { throw null; } + public static bool operator !=(System.Xaml.XamlType xamlType1, System.Xaml.XamlType xamlType2) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class XamlWriter : System.IDisposable + { + protected XamlWriter() { } + protected bool IsDisposed { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public abstract System.Xaml.XamlSchemaContext SchemaContext { get; } + public void Close() { } + protected virtual void Dispose(bool disposing) { } + void System.IDisposable.Dispose() { } + public abstract void WriteEndMember(); + public abstract void WriteEndObject(); + public abstract void WriteGetObject(); + public abstract void WriteNamespace(System.Xaml.NamespaceDeclaration namespaceDeclaration); + public void WriteNode(System.Xaml.XamlReader reader) { } + public abstract void WriteStartMember(System.Xaml.XamlMember xamlMember); + public abstract void WriteStartObject(System.Xaml.XamlType type); + public abstract void WriteValue(object value); + } + public partial class XamlWriterSettings + { + public XamlWriterSettings() { } + public XamlWriterSettings(System.Xaml.XamlWriterSettings settings) { } + } + public partial class XamlXmlReader : System.Xaml.XamlReader, System.Xaml.IXamlLineInfo + { + public XamlXmlReader(System.IO.Stream stream) { } + public XamlXmlReader(System.IO.Stream stream, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlReader(System.IO.Stream stream, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(System.IO.Stream stream, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(System.IO.TextReader textReader) { } + public XamlXmlReader(System.IO.TextReader textReader, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlReader(System.IO.TextReader textReader, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(System.IO.TextReader textReader, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(string fileName) { } + public XamlXmlReader(string fileName, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlReader(string fileName, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(string fileName, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(System.Xml.XmlReader xmlReader) { } + public XamlXmlReader(System.Xml.XmlReader xmlReader, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlReader(System.Xml.XmlReader xmlReader, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlReaderSettings settings) { } + public XamlXmlReader(System.Xml.XmlReader xmlReader, System.Xaml.XamlXmlReaderSettings settings) { } + public bool HasLineInfo { get { throw null; } } + public override bool IsEof { get { throw null; } } + public int LineNumber { get { throw null; } } + public int LinePosition { get { throw null; } } + public override System.Xaml.XamlMember Member { get { throw null; } } + public override System.Xaml.NamespaceDeclaration Namespace { get { throw null; } } + public override System.Xaml.XamlNodeType NodeType { get { throw null; } } + public override System.Xaml.XamlSchemaContext SchemaContext { get { throw null; } } + public override System.Xaml.XamlType Type { get { throw null; } } + public override object Value { get { throw null; } } + public override bool Read() { throw null; } + } + public partial class XamlXmlReaderSettings : System.Xaml.XamlReaderSettings + { + public XamlXmlReaderSettings() { } + public XamlXmlReaderSettings(System.Xaml.XamlXmlReaderSettings settings) { } + public bool CloseInput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool SkipXmlCompatibilityProcessing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string XmlLang { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool XmlSpacePreserve { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } + public partial class XamlXmlWriter : System.Xaml.XamlWriter + { + public XamlXmlWriter(System.IO.Stream stream, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlWriter(System.IO.Stream stream, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlWriterSettings settings) { } + public XamlXmlWriter(System.IO.TextWriter textWriter, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlWriter(System.IO.TextWriter textWriter, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlWriterSettings settings) { } + public XamlXmlWriter(System.Xml.XmlWriter xmlWriter, System.Xaml.XamlSchemaContext schemaContext) { } + public XamlXmlWriter(System.Xml.XmlWriter xmlWriter, System.Xaml.XamlSchemaContext schemaContext, System.Xaml.XamlXmlWriterSettings settings) { } + public override System.Xaml.XamlSchemaContext SchemaContext { get { throw null; } } + public System.Xaml.XamlXmlWriterSettings Settings { get { throw null; } } + protected override void Dispose(bool disposing) { } + public void Flush() { } + public override void WriteEndMember() { } + public override void WriteEndObject() { } + public override void WriteGetObject() { } + public override void WriteNamespace(System.Xaml.NamespaceDeclaration namespaceDeclaration) { } + public override void WriteStartMember(System.Xaml.XamlMember property) { } + public override void WriteStartObject(System.Xaml.XamlType type) { } + public override void WriteValue(object value) { } + } + [System.SerializableAttribute] + public partial class XamlXmlWriterException : System.Xaml.XamlException + { + public XamlXmlWriterException() { } + protected XamlXmlWriterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public XamlXmlWriterException(string message) { } + public XamlXmlWriterException(string message, System.Exception innerException) { } + } + public partial class XamlXmlWriterSettings : System.Xaml.XamlWriterSettings + { + public XamlXmlWriterSettings() { } + public bool AssumeValidInput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public bool CloseOutput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Xaml.XamlXmlWriterSettings Copy() { throw null; } + } +} +namespace System.Xaml.Permissions +{ + [System.SerializableAttribute] + public partial class XamlAccessLevel + { + internal XamlAccessLevel() { } + public System.Reflection.AssemblyName AssemblyAccessToAssemblyName { get { throw null; } } + public string PrivateAccessToTypeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public static System.Xaml.Permissions.XamlAccessLevel AssemblyAccessTo(System.Reflection.Assembly assembly) { throw null; } + public static System.Xaml.Permissions.XamlAccessLevel AssemblyAccessTo(System.Reflection.AssemblyName assemblyName) { throw null; } + public static System.Xaml.Permissions.XamlAccessLevel PrivateAccessTo(string assemblyQualifiedTypeName) { throw null; } + public static System.Xaml.Permissions.XamlAccessLevel PrivateAccessTo(System.Type type) { throw null; } + } + [System.SerializableAttribute] + public sealed partial class XamlLoadPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission + { + public XamlLoadPermission(System.Collections.Generic.IEnumerable allowedAccess) { } + public XamlLoadPermission(System.Security.Permissions.PermissionState state) { } + public XamlLoadPermission(System.Xaml.Permissions.XamlAccessLevel allowedAccess) { } + public System.Collections.Generic.IList AllowedAccess { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public override System.Security.IPermission Copy() { throw null; } + public override void FromXml(System.Security.SecurityElement elem) { } + public bool Includes(System.Xaml.Permissions.XamlAccessLevel requestedAccess) { throw null; } + public override System.Security.IPermission Intersect(System.Security.IPermission target) { throw null; } + public override bool IsSubsetOf(System.Security.IPermission target) { throw null; } + public bool IsUnrestricted() { throw null; } + public override System.Security.SecurityElement ToXml() { throw null; } + public override System.Security.IPermission Union(System.Security.IPermission other) { throw null; } + } +} +namespace System.Xaml.Schema +{ + [System.FlagsAttribute] + public enum AllowedMemberLocations + { + Any = 3, + Attribute = 1, + MemberElement = 2, + None = 0, + } + public enum ShouldSerializeResult + { + Default = 0, + False = 2, + True = 1, + } + public enum XamlCollectionKind : byte + { + Array = (byte)3, + Collection = (byte)1, + Dictionary = (byte)2, + None = (byte)0, + } + public partial class XamlMemberInvoker + { + protected XamlMemberInvoker() { } + public XamlMemberInvoker(System.Xaml.XamlMember member) { } + public System.Reflection.MethodInfo UnderlyingGetter { get { throw null; } } + public System.Reflection.MethodInfo UnderlyingSetter { get { throw null; } } + public static System.Xaml.Schema.XamlMemberInvoker UnknownInvoker { get { throw null; } } + public virtual object GetValue(object instance) { throw null; } + public virtual void SetValue(object instance, object value) { } + public virtual System.Xaml.Schema.ShouldSerializeResult ShouldSerializeValue(object instance) { throw null; } + } + public partial class XamlTypeInvoker + { + protected XamlTypeInvoker() { } + public XamlTypeInvoker(System.Xaml.XamlType type) { } + public System.EventHandler SetMarkupExtensionHandler { get { throw null; } } + public System.EventHandler SetTypeConverterHandler { get { throw null; } } + public static System.Xaml.Schema.XamlTypeInvoker UnknownInvoker { get { throw null; } } + public virtual void AddToCollection(object instance, object item) { } + public virtual void AddToDictionary(object instance, object key, object item) { } + public virtual object CreateInstance(object[] arguments) { throw null; } + public virtual System.Reflection.MethodInfo GetAddMethod(System.Xaml.XamlType contentType) { throw null; } + public virtual System.Reflection.MethodInfo GetEnumeratorMethod() { throw null; } + public virtual System.Collections.IEnumerator GetItems(object instance) { throw null; } + } + [System.Diagnostics.DebuggerDisplayAttribute("{{{Namespace}}}{Name}{TypeArgStringForDebugger}")] + public partial class XamlTypeName + { + public XamlTypeName() { } + public XamlTypeName(string xamlNamespace, string name) { } + public XamlTypeName(string xamlNamespace, string name, System.Collections.Generic.IEnumerable typeArguments) { } + public XamlTypeName(System.Xaml.XamlType xamlType) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Namespace { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public System.Collections.Generic.IList TypeArguments { get { throw null; } } + public static System.Xaml.Schema.XamlTypeName Parse(string typeName, System.Xaml.IXamlNamespaceResolver namespaceResolver) { throw null; } + public static System.Collections.Generic.IList ParseList(string typeNameList, System.Xaml.IXamlNamespaceResolver namespaceResolver) { throw null; } + public override string ToString() { throw null; } + public static string ToString(System.Collections.Generic.IList typeNameList, System.Xaml.INamespacePrefixLookup prefixLookup) { throw null; } + public string ToString(System.Xaml.INamespacePrefixLookup prefixLookup) { throw null; } + public static bool TryParse(string typeName, System.Xaml.IXamlNamespaceResolver namespaceResolver, out System.Xaml.Schema.XamlTypeName result) { result = default(System.Xaml.Schema.XamlTypeName); throw null; } + public static bool TryParseList(string typeNameList, System.Xaml.IXamlNamespaceResolver namespaceResolver, out System.Collections.Generic.IList result) { result = default(System.Collections.Generic.IList); throw null; } + } + public partial class XamlTypeTypeConverter : System.ComponentModel.TypeConverter + { + public XamlTypeTypeConverter() { } + public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type sourceType) { throw null; } + public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; } + public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { throw null; } + public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; } + } + public partial class XamlValueConverter : System.IEquatable> where TConverterBase : class + { + public XamlValueConverter(System.Type converterType, System.Xaml.XamlType targetType) { } + public XamlValueConverter(System.Type converterType, System.Xaml.XamlType targetType, string name) { } + public TConverterBase ConverterInstance { get { throw null; } } + public System.Type ConverterType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Xaml.XamlType TargetType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + protected virtual TConverterBase CreateInstance() { throw null; } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.Xaml.Schema.XamlValueConverter other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Xaml.Schema.XamlValueConverter converter1, System.Xaml.Schema.XamlValueConverter converter2) { throw null; } + public static bool operator !=(System.Xaml.Schema.XamlValueConverter converter1, System.Xaml.Schema.XamlValueConverter converter2) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Linq.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Linq.cs new file mode 100644 index 0000000000..658869b8c9 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Linq.cs @@ -0,0 +1,521 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Linq.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Linq.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Linq.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] +[assembly:System.Security.SecurityRulesAttribute((System.Security.SecurityRuleSet)(1), SkipVerificationInFullTrust=true)] +namespace System.Xml.Linq +{ + public static partial class Extensions + { + public static System.Collections.Generic.IEnumerable AncestorsAndSelf(this System.Collections.Generic.IEnumerable source) { throw null; } + public static System.Collections.Generic.IEnumerable AncestorsAndSelf(this System.Collections.Generic.IEnumerable source, System.Xml.Linq.XName name) { throw null; } + public static System.Collections.Generic.IEnumerable Ancestors(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XNode { throw null; } + public static System.Collections.Generic.IEnumerable Ancestors(this System.Collections.Generic.IEnumerable source, System.Xml.Linq.XName name) where T : System.Xml.Linq.XNode { throw null; } + public static System.Collections.Generic.IEnumerable Attributes(this System.Collections.Generic.IEnumerable source) { throw null; } + public static System.Collections.Generic.IEnumerable Attributes(this System.Collections.Generic.IEnumerable source, System.Xml.Linq.XName name) { throw null; } + public static System.Collections.Generic.IEnumerable DescendantNodesAndSelf(this System.Collections.Generic.IEnumerable source) { throw null; } + public static System.Collections.Generic.IEnumerable DescendantNodes(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XContainer { throw null; } + public static System.Collections.Generic.IEnumerable DescendantsAndSelf(this System.Collections.Generic.IEnumerable source) { throw null; } + public static System.Collections.Generic.IEnumerable DescendantsAndSelf(this System.Collections.Generic.IEnumerable source, System.Xml.Linq.XName name) { throw null; } + public static System.Collections.Generic.IEnumerable Descendants(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XContainer { throw null; } + public static System.Collections.Generic.IEnumerable Descendants(this System.Collections.Generic.IEnumerable source, System.Xml.Linq.XName name) where T : System.Xml.Linq.XContainer { throw null; } + public static System.Collections.Generic.IEnumerable Elements(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XContainer { throw null; } + public static System.Collections.Generic.IEnumerable Elements(this System.Collections.Generic.IEnumerable source, System.Xml.Linq.XName name) where T : System.Xml.Linq.XContainer { throw null; } + public static System.Collections.Generic.IEnumerable InDocumentOrder(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XNode { throw null; } + public static System.Collections.Generic.IEnumerable Nodes(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XContainer { throw null; } + public static void Remove(this System.Collections.Generic.IEnumerable source) { } + public static void Remove(this System.Collections.Generic.IEnumerable source) where T : System.Xml.Linq.XNode { } + } + [System.FlagsAttribute] + public enum LoadOptions + { + None = 0, + PreserveWhitespace = 1, + SetBaseUri = 2, + SetLineInfo = 4, + } + [System.FlagsAttribute] + public enum ReaderOptions + { + None = 0, + OmitDuplicateNamespaces = 1, + } + [System.FlagsAttribute] + public enum SaveOptions + { + DisableFormatting = 1, + None = 0, + OmitDuplicateNamespaces = 2, + } + [System.ComponentModel.TypeDescriptionProviderAttribute("MS.Internal.Xml.Linq.ComponentModel.XTypeDescriptionProvider")] + public partial class XAttribute : System.Xml.Linq.XObject + { + public XAttribute(System.Xml.Linq.XAttribute other) { } + public XAttribute(System.Xml.Linq.XName name, object value) { } + public static System.Collections.Generic.IEnumerable EmptySequence { get { throw null; } } + public bool IsNamespaceDeclaration { get { throw null; } } + public System.Xml.Linq.XName Name { get { throw null; } } + public System.Xml.Linq.XAttribute NextAttribute { get { throw null; } } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public System.Xml.Linq.XAttribute PreviousAttribute { get { throw null; } } + public string Value { get { throw null; } set { } } + [System.CLSCompliantAttribute(false)] + public static explicit operator bool (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.DateTime (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.DateTimeOffset (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator decimal (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator double (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Guid (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator int (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator long (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator float (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator string (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.TimeSpan (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Xml.Linq.XAttribute attribute) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Xml.Linq.XAttribute attribute) { throw null; } + public void Remove() { } + public void SetValue(object value) { } + public override string ToString() { throw null; } + } + public partial class XCData : System.Xml.Linq.XText + { + public XCData(string value) : base (default(string)) { } + public XCData(System.Xml.Linq.XCData other) : base (default(string)) { } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class XComment : System.Xml.Linq.XNode + { + public XComment(string value) { } + public XComment(System.Xml.Linq.XComment other) { } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public string Value { get { throw null; } set { } } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public abstract partial class XContainer : System.Xml.Linq.XNode + { + internal XContainer() { } + public System.Xml.Linq.XNode FirstNode { get { throw null; } } + public System.Xml.Linq.XNode LastNode { get { throw null; } } + public void Add(object content) { } + public void Add(params object[] content) { } + public void AddFirst(object content) { } + public void AddFirst(params object[] content) { } + public System.Xml.XmlWriter CreateWriter() { throw null; } + public System.Collections.Generic.IEnumerable DescendantNodes() { throw null; } + public System.Collections.Generic.IEnumerable Descendants() { throw null; } + public System.Collections.Generic.IEnumerable Descendants(System.Xml.Linq.XName name) { throw null; } + public System.Xml.Linq.XElement Element(System.Xml.Linq.XName name) { throw null; } + public System.Collections.Generic.IEnumerable Elements() { throw null; } + public System.Collections.Generic.IEnumerable Elements(System.Xml.Linq.XName name) { throw null; } + public System.Collections.Generic.IEnumerable Nodes() { throw null; } + public void RemoveNodes() { } + public void ReplaceNodes(object content) { } + public void ReplaceNodes(params object[] content) { } + } + public partial class XDeclaration + { + public XDeclaration(string version, string encoding, string standalone) { } + public XDeclaration(System.Xml.Linq.XDeclaration other) { } + public string Encoding { get { throw null; } set { } } + public string Standalone { get { throw null; } set { } } + public string Version { get { throw null; } set { } } + public override string ToString() { throw null; } + } + public partial class XDocument : System.Xml.Linq.XContainer + { + public XDocument() { } + public XDocument(params object[] content) { } + public XDocument(System.Xml.Linq.XDeclaration declaration, params object[] content) { } + public XDocument(System.Xml.Linq.XDocument other) { } + public System.Xml.Linq.XDeclaration Declaration { get { throw null; } set { } } + public System.Xml.Linq.XDocumentType DocumentType { get { throw null; } } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public System.Xml.Linq.XElement Root { get { throw null; } } + public static System.Xml.Linq.XDocument Load(System.IO.Stream stream) { throw null; } + public static System.Xml.Linq.XDocument Load(System.IO.Stream stream, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XDocument Load(System.IO.TextReader textReader) { throw null; } + public static System.Xml.Linq.XDocument Load(System.IO.TextReader textReader, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XDocument Load(string uri) { throw null; } + public static System.Xml.Linq.XDocument Load(string uri, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XDocument Load(System.Xml.XmlReader reader) { throw null; } + public static System.Xml.Linq.XDocument Load(System.Xml.XmlReader reader, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XDocument Parse(string text) { throw null; } + public static System.Xml.Linq.XDocument Parse(string text, System.Xml.Linq.LoadOptions options) { throw null; } + public void Save(System.IO.Stream stream) { } + public void Save(System.IO.Stream stream, System.Xml.Linq.SaveOptions options) { } + public void Save(System.IO.TextWriter textWriter) { } + public void Save(System.IO.TextWriter textWriter, System.Xml.Linq.SaveOptions options) { } + public void Save(string fileName) { } + public void Save(string fileName, System.Xml.Linq.SaveOptions options) { } + public void Save(System.Xml.XmlWriter writer) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class XDocumentType : System.Xml.Linq.XNode + { + public XDocumentType(string name, string publicId, string systemId, string internalSubset) { } + public XDocumentType(System.Xml.Linq.XDocumentType other) { } + public string InternalSubset { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public string PublicId { get { throw null; } set { } } + public string SystemId { get { throw null; } set { } } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + [System.ComponentModel.TypeDescriptionProviderAttribute("MS.Internal.Xml.Linq.ComponentModel.XTypeDescriptionProvider")] + [System.Xml.Serialization.XmlSchemaProviderAttribute(null, IsAny=true)] + public partial class XElement : System.Xml.Linq.XContainer, System.Xml.Serialization.IXmlSerializable + { + public XElement(System.Xml.Linq.XElement other) { } + public XElement(System.Xml.Linq.XName name) { } + public XElement(System.Xml.Linq.XName name, object content) { } + public XElement(System.Xml.Linq.XName name, params object[] content) { } + public XElement(System.Xml.Linq.XStreamingElement other) { } + public static System.Collections.Generic.IEnumerable EmptySequence { get { throw null; } } + public System.Xml.Linq.XAttribute FirstAttribute { get { throw null; } } + public bool HasAttributes { get { throw null; } } + public bool HasElements { get { throw null; } } + public bool IsEmpty { get { throw null; } } + public System.Xml.Linq.XAttribute LastAttribute { get { throw null; } } + public System.Xml.Linq.XName Name { get { throw null; } set { } } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public string Value { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable AncestorsAndSelf() { throw null; } + public System.Collections.Generic.IEnumerable AncestorsAndSelf(System.Xml.Linq.XName name) { throw null; } + public System.Xml.Linq.XAttribute Attribute(System.Xml.Linq.XName name) { throw null; } + public System.Collections.Generic.IEnumerable Attributes() { throw null; } + public System.Collections.Generic.IEnumerable Attributes(System.Xml.Linq.XName name) { throw null; } + public System.Collections.Generic.IEnumerable DescendantNodesAndSelf() { throw null; } + public System.Collections.Generic.IEnumerable DescendantsAndSelf() { throw null; } + public System.Collections.Generic.IEnumerable DescendantsAndSelf(System.Xml.Linq.XName name) { throw null; } + public System.Xml.Linq.XNamespace GetDefaultNamespace() { throw null; } + public System.Xml.Linq.XNamespace GetNamespaceOfPrefix(string prefix) { throw null; } + public string GetPrefixOfNamespace(System.Xml.Linq.XNamespace ns) { throw null; } + public static System.Xml.Linq.XElement Load(System.IO.Stream stream) { throw null; } + public static System.Xml.Linq.XElement Load(System.IO.Stream stream, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XElement Load(System.IO.TextReader textReader) { throw null; } + public static System.Xml.Linq.XElement Load(System.IO.TextReader textReader, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XElement Load(string uri) { throw null; } + public static System.Xml.Linq.XElement Load(string uri, System.Xml.Linq.LoadOptions options) { throw null; } + public static System.Xml.Linq.XElement Load(System.Xml.XmlReader reader) { throw null; } + public static System.Xml.Linq.XElement Load(System.Xml.XmlReader reader, System.Xml.Linq.LoadOptions options) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator bool (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.DateTime (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.DateTimeOffset (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator decimal (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator double (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Guid (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator int (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator long (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.Nullable (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator float (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator string (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator System.TimeSpan (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator uint (System.Xml.Linq.XElement element) { throw null; } + [System.CLSCompliantAttribute(false)] + public static explicit operator ulong (System.Xml.Linq.XElement element) { throw null; } + public static System.Xml.Linq.XElement Parse(string text) { throw null; } + public static System.Xml.Linq.XElement Parse(string text, System.Xml.Linq.LoadOptions options) { throw null; } + public void RemoveAll() { } + public void RemoveAttributes() { } + public void ReplaceAll(object content) { } + public void ReplaceAll(params object[] content) { } + public void ReplaceAttributes(object content) { } + public void ReplaceAttributes(params object[] content) { } + public void Save(System.IO.Stream stream) { } + public void Save(System.IO.Stream stream, System.Xml.Linq.SaveOptions options) { } + public void Save(System.IO.TextWriter textWriter) { } + public void Save(System.IO.TextWriter textWriter, System.Xml.Linq.SaveOptions options) { } + public void Save(string fileName) { } + public void Save(string fileName, System.Xml.Linq.SaveOptions options) { } + public void Save(System.Xml.XmlWriter writer) { } + public void SetAttributeValue(System.Xml.Linq.XName name, object value) { } + public void SetElementValue(System.Xml.Linq.XName name, object value) { } + public void SetValue(object value) { } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + [System.SerializableAttribute] + public sealed partial class XName : System.IEquatable, System.Runtime.Serialization.ISerializable + { + internal XName() { } + public string LocalName { get { throw null; } } + public System.Xml.Linq.XNamespace Namespace { get { throw null; } } + public string NamespaceName { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public static System.Xml.Linq.XName Get(string expandedName) { throw null; } + public static System.Xml.Linq.XName Get(string localName, string namespaceName) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.Xml.Linq.XName left, System.Xml.Linq.XName right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Xml.Linq.XName (string expandedName) { throw null; } + public static bool operator !=(System.Xml.Linq.XName left, System.Xml.Linq.XName right) { throw null; } + bool System.IEquatable.Equals(System.Xml.Linq.XName other) { throw null; } + [System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags=(System.Security.Permissions.SecurityPermissionFlag)(128))] + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public override string ToString() { throw null; } + } + public sealed partial class XNamespace + { + internal XNamespace() { } + public string NamespaceName { get { throw null; } } + public static System.Xml.Linq.XNamespace None { get { throw null; } } + public static System.Xml.Linq.XNamespace Xml { get { throw null; } } + public static System.Xml.Linq.XNamespace Xmlns { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public static System.Xml.Linq.XNamespace Get(string namespaceName) { throw null; } + public override int GetHashCode() { throw null; } + public System.Xml.Linq.XName GetName(string localName) { throw null; } + public static System.Xml.Linq.XName operator +(System.Xml.Linq.XNamespace ns, string localName) { throw null; } + public static bool operator ==(System.Xml.Linq.XNamespace left, System.Xml.Linq.XNamespace right) { throw null; } + [System.CLSCompliantAttribute(false)] + public static implicit operator System.Xml.Linq.XNamespace (string namespaceName) { throw null; } + public static bool operator !=(System.Xml.Linq.XNamespace left, System.Xml.Linq.XNamespace right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class XNode : System.Xml.Linq.XObject + { + internal XNode() { } + public static System.Xml.Linq.XNodeDocumentOrderComparer DocumentOrderComparer { get { throw null; } } + public static System.Xml.Linq.XNodeEqualityComparer EqualityComparer { get { throw null; } } + public System.Xml.Linq.XNode NextNode { get { throw null; } } + public System.Xml.Linq.XNode PreviousNode { get { throw null; } } + public void AddAfterSelf(object content) { } + public void AddAfterSelf(params object[] content) { } + public void AddBeforeSelf(object content) { } + public void AddBeforeSelf(params object[] content) { } + public System.Collections.Generic.IEnumerable Ancestors() { throw null; } + public System.Collections.Generic.IEnumerable Ancestors(System.Xml.Linq.XName name) { throw null; } + public static int CompareDocumentOrder(System.Xml.Linq.XNode n1, System.Xml.Linq.XNode n2) { throw null; } + public System.Xml.XmlReader CreateReader() { throw null; } + public System.Xml.XmlReader CreateReader(System.Xml.Linq.ReaderOptions readerOptions) { throw null; } + public static bool DeepEquals(System.Xml.Linq.XNode n1, System.Xml.Linq.XNode n2) { throw null; } + public System.Collections.Generic.IEnumerable ElementsAfterSelf() { throw null; } + public System.Collections.Generic.IEnumerable ElementsAfterSelf(System.Xml.Linq.XName name) { throw null; } + public System.Collections.Generic.IEnumerable ElementsBeforeSelf() { throw null; } + public System.Collections.Generic.IEnumerable ElementsBeforeSelf(System.Xml.Linq.XName name) { throw null; } + public bool IsAfter(System.Xml.Linq.XNode node) { throw null; } + public bool IsBefore(System.Xml.Linq.XNode node) { throw null; } + public System.Collections.Generic.IEnumerable NodesAfterSelf() { throw null; } + public System.Collections.Generic.IEnumerable NodesBeforeSelf() { throw null; } + public static System.Xml.Linq.XNode ReadFrom(System.Xml.XmlReader reader) { throw null; } + public void Remove() { } + public void ReplaceWith(object content) { } + public void ReplaceWith(params object[] content) { } + public override string ToString() { throw null; } + public string ToString(System.Xml.Linq.SaveOptions options) { throw null; } + public abstract void WriteTo(System.Xml.XmlWriter writer); + } + public sealed partial class XNodeDocumentOrderComparer : System.Collections.Generic.IComparer, System.Collections.IComparer + { + public XNodeDocumentOrderComparer() { } + public int Compare(System.Xml.Linq.XNode x, System.Xml.Linq.XNode y) { throw null; } + int System.Collections.IComparer.Compare(object x, object y) { throw null; } + } + public sealed partial class XNodeEqualityComparer : System.Collections.Generic.IEqualityComparer, System.Collections.IEqualityComparer + { + public XNodeEqualityComparer() { } + public bool Equals(System.Xml.Linq.XNode x, System.Xml.Linq.XNode y) { throw null; } + public int GetHashCode(System.Xml.Linq.XNode obj) { throw null; } + bool System.Collections.IEqualityComparer.Equals(object x, object y) { throw null; } + int System.Collections.IEqualityComparer.GetHashCode(object obj) { throw null; } + } + public abstract partial class XObject : System.Xml.IXmlLineInfo + { + internal XObject() { } + public string BaseUri { get { throw null; } } + public System.Xml.Linq.XDocument Document { get { throw null; } } + public abstract System.Xml.XmlNodeType NodeType { get; } + public System.Xml.Linq.XElement Parent { get { throw null; } } + int System.Xml.IXmlLineInfo.LineNumber { get { throw null; } } + int System.Xml.IXmlLineInfo.LinePosition { get { throw null; } } + public event System.EventHandler Changed { add { } remove { } } + public event System.EventHandler Changing { add { } remove { } } + public void AddAnnotation(object annotation) { } + public object Annotation(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable Annotations(System.Type type) { throw null; } + public System.Collections.Generic.IEnumerable Annotations() where T : class { throw null; } + public T Annotation() where T : class { throw null; } + public void RemoveAnnotations(System.Type type) { } + public void RemoveAnnotations() where T : class { } + bool System.Xml.IXmlLineInfo.HasLineInfo() { throw null; } + } + public enum XObjectChange + { + Add = 0, + Name = 2, + Remove = 1, + Value = 3, + } + public partial class XObjectChangeEventArgs : System.EventArgs + { + public static readonly System.Xml.Linq.XObjectChangeEventArgs Add; + public static readonly System.Xml.Linq.XObjectChangeEventArgs Name; + public static readonly System.Xml.Linq.XObjectChangeEventArgs Remove; + public static readonly System.Xml.Linq.XObjectChangeEventArgs Value; + public XObjectChangeEventArgs(System.Xml.Linq.XObjectChange objectChange) { } + public System.Xml.Linq.XObjectChange ObjectChange { get { throw null; } } + } + public partial class XProcessingInstruction : System.Xml.Linq.XNode + { + public XProcessingInstruction(string target, string data) { } + public XProcessingInstruction(System.Xml.Linq.XProcessingInstruction other) { } + public string Data { get { throw null; } set { } } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public string Target { get { throw null; } set { } } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class XStreamingElement + { + public XStreamingElement(System.Xml.Linq.XName name) { } + public XStreamingElement(System.Xml.Linq.XName name, object content) { } + public XStreamingElement(System.Xml.Linq.XName name, params object[] content) { } + public System.Xml.Linq.XName Name { get { throw null; } set { } } + public void Add(object content) { } + public void Add(params object[] content) { } + public void Save(System.IO.Stream stream) { } + public void Save(System.IO.Stream stream, System.Xml.Linq.SaveOptions options) { } + public void Save(System.IO.TextWriter textWriter) { } + public void Save(System.IO.TextWriter textWriter, System.Xml.Linq.SaveOptions options) { } + public void Save(string fileName) { } + public void Save(string fileName, System.Xml.Linq.SaveOptions options) { } + public void Save(System.Xml.XmlWriter writer) { } + public override string ToString() { throw null; } + public string ToString(System.Xml.Linq.SaveOptions options) { throw null; } + public void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class XText : System.Xml.Linq.XNode + { + public XText(string value) { } + public XText(System.Xml.Linq.XText other) { } + public override System.Xml.XmlNodeType NodeType { get { throw null; } } + public string Value { get { throw null; } set { } } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } +} +namespace System.Xml.Schema +{ + public static partial class Extensions + { + public static System.Xml.Schema.IXmlSchemaInfo GetSchemaInfo(this System.Xml.Linq.XAttribute source) { throw null; } + public static System.Xml.Schema.IXmlSchemaInfo GetSchemaInfo(this System.Xml.Linq.XElement source) { throw null; } + public static void Validate(this System.Xml.Linq.XAttribute source, System.Xml.Schema.XmlSchemaObject partialValidationType, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler) { } + public static void Validate(this System.Xml.Linq.XAttribute source, System.Xml.Schema.XmlSchemaObject partialValidationType, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler, bool addSchemaInfo) { } + public static void Validate(this System.Xml.Linq.XDocument source, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler) { } + public static void Validate(this System.Xml.Linq.XDocument source, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler, bool addSchemaInfo) { } + public static void Validate(this System.Xml.Linq.XElement source, System.Xml.Schema.XmlSchemaObject partialValidationType, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler) { } + public static void Validate(this System.Xml.Linq.XElement source, System.Xml.Schema.XmlSchemaObject partialValidationType, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler, bool addSchemaInfo) { } + } +} +namespace System.Xml.XPath +{ + public static partial class Extensions + { + public static System.Xml.XPath.XPathNavigator CreateNavigator(this System.Xml.Linq.XNode node) { throw null; } + public static System.Xml.XPath.XPathNavigator CreateNavigator(this System.Xml.Linq.XNode node, System.Xml.XmlNameTable nameTable) { throw null; } + public static object XPathEvaluate(this System.Xml.Linq.XNode node, string expression) { throw null; } + public static object XPathEvaluate(this System.Xml.Linq.XNode node, string expression, System.Xml.IXmlNamespaceResolver resolver) { throw null; } + public static System.Xml.Linq.XElement XPathSelectElement(this System.Xml.Linq.XNode node, string expression) { throw null; } + public static System.Xml.Linq.XElement XPathSelectElement(this System.Xml.Linq.XNode node, string expression, System.Xml.IXmlNamespaceResolver resolver) { throw null; } + public static System.Collections.Generic.IEnumerable XPathSelectElements(this System.Xml.Linq.XNode node, string expression) { throw null; } + public static System.Collections.Generic.IEnumerable XPathSelectElements(this System.Xml.Linq.XNode node, string expression, System.Xml.IXmlNamespaceResolver resolver) { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static partial class XDocumentExtensions + { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public static System.Xml.XPath.IXPathNavigable ToXPathNavigable(this System.Xml.Linq.XNode node) { throw null; } + } +} diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Linq.extra.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Linq.extra.cs new file mode 100644 index 0000000000..439c9421a0 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Linq.extra.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Xml.Linq +{ + [System.Runtime.Serialization.KnownTypeAttribute(typeof(NameSerializer))] + partial class XName { } + internal partial class NameSerializer { } +} + diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Serialization.cs b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Serialization.cs new file mode 100644 index 0000000000..fe9bc30451 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.Serialization.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Xml.Serialization.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Xml.Serialization.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2558.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Xml.Serialization.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Runtime.InteropServices.DefaultDllImportSearchPathsAttribute((System.Runtime.InteropServices.DllImportSearchPath)(2050))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.XmlSerializerFormatAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.IXmlSerializable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyAttributeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyElementAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyElementAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayItemAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayItemAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributeOverrides))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlChoiceIdentifierAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlElementAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlElementAttributes))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlEnumAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlIgnoreAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlIncludeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlMapping))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlMappingAccess))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlNamespaceDeclarationsAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlReflectionImporter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlRootAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSchemaProviderAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializer))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializerNamespaces))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTextAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTypeAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTypeMapping))] diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.Xml.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.cs.REMOVED.git-id new file mode 100644 index 0000000000..d9cf0f6d26 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.Xml.cs.REMOVED.git-id @@ -0,0 +1 @@ +42a84d6511b4f1705ca565cf3ca74386f5257ca0 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/System.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/System.cs.REMOVED.git-id new file mode 100644 index 0000000000..4bf0ad474d --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/System.cs.REMOVED.git-id @@ -0,0 +1 @@ +2a68828e1d77e0c328deb56e2a81d938a5c2b129 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/WindowsBase.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/WindowsBase.cs.REMOVED.git-id new file mode 100644 index 0000000000..ade04ee06f --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/WindowsBase.cs.REMOVED.git-id @@ -0,0 +1 @@ +951098fd0033f9db067b6598a1a033d8cf41b77e \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/mscorlib.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7.1/mscorlib.cs.REMOVED.git-id new file mode 100644 index 0000000000..210d8d0b58 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/mscorlib.cs.REMOVED.git-id @@ -0,0 +1 @@ +a196c6b0788a58bd69da6085e55300cd9bcded48 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7.1/mscorlib.extra.cs b/external/binary-reference-assemblies/src/v4.7.1/mscorlib.extra.cs new file mode 100644 index 0000000000..d3e6ac39e9 --- /dev/null +++ b/external/binary-reference-assemblies/src/v4.7.1/mscorlib.extra.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)] + partial struct DateTime { } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)] + partial struct DateTimeOffset { } +} diff --git a/external/binary-reference-assemblies/src/v4.7/Microsoft.Web.Infrastructure.cs b/external/binary-reference-assemblies/src/v4.7/Microsoft.Web.Infrastructure.cs deleted file mode 100644 index dfc3ce0ab2..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/Microsoft.Web.Infrastructure.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Novell, Inc")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Novell, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.20105.407")] -[assembly:System.Reflection.AssemblyProductAttribute("ASP.Net WebPages")] -[assembly:System.Reflection.AssemblyTitleAttribute("Microsoft.Web.Infrastructure")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace Microsoft.Web.Infrastructure -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpContextHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static void ExecuteInNullContext(System.Action action) { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class InfrastructureHelper - { - [System.Security.SecuritySafeCriticalAttribute] - public static bool IsCodeDomDefinedExtension(string extension) { throw null; } - [System.Security.SecuritySafeCriticalAttribute] - public static void UnloadAppDomain() { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicModuleHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class DynamicModuleUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void RegisterModule(System.Type moduleType) { } - } -} -namespace Microsoft.Web.Infrastructure.DynamicValidationHelper -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class ValidationUtility - { - [System.Security.SecuritySafeCriticalAttribute] - public static void EnableDynamicValidation(System.Web.HttpContext context) { } - [System.Security.SecuritySafeCriticalAttribute] - public static void GetUnvalidatedCollections(System.Web.HttpContext context, out System.Func formGetter, out System.Func queryStringGetter) { formGetter = default(System.Func); queryStringGetter = default(System.Func); } - [System.Security.SecuritySafeCriticalAttribute] - public static System.Nullable IsValidationEnabled(System.Web.HttpContext context) { throw null; } - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/SMDiagnostics.cs b/external/binary-reference-assemblies/src/v4.7/SMDiagnostics.cs deleted file mode 100644 index deeee04357..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/SMDiagnostics.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.ServiceModel.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Contains share code for some System.ServiceModel libraries")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.7.2046.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] -[assembly:System.Reflection.AssemblyTitleAttribute("SMDiagnostics.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.IdentityModel.Selectors, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=00000000000000000400000000000000")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComCompatibleVersionAttribute(1, 0, 3300, 0)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.AllowPartiallyTrustedCallersAttribute] diff --git a/external/binary-reference-assemblies/src/v4.7/System.Net.Http.Formatting.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7/System.Net.Http.Formatting.cs.REMOVED.git-id deleted file mode 100644 index 17df69285b..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Net.Http.Formatting.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bae8733212ee6cf090c0ef3b915c4d0129ca88fe \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Core.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Core.cs deleted file mode 100644 index 56d5789d40..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Core.cs +++ /dev/null @@ -1,477 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Core Library containing base classes and scheduler infrastructure.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Core")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Experimental, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Linq, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.PlatformServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System -{ - public static partial class ObservableExtensions - { - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static System.IDisposable SubscribeSafe(this System.IObservable source, System.IObserver observer) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError) { throw null; } - public static System.IDisposable Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Action onCompleted, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Action onError, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Action onNext, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.IObserver observer, System.Threading.CancellationToken token) { } - public static void Subscribe(this System.IObservable source, System.Threading.CancellationToken token) { } - } -} -namespace System.Reactive -{ - public sealed partial class AnonymousObservable : System.Reactive.ObservableBase - { - public AnonymousObservable(System.Func, System.IDisposable> subscribe) { } - protected override System.IDisposable SubscribeCore(System.IObserver observer) { throw null; } - } - public sealed partial class AnonymousObserver : System.Reactive.ObserverBase - { - public AnonymousObserver(System.Action onNext) { } - public AnonymousObserver(System.Action onNext, System.Action onCompleted) { } - public AnonymousObserver(System.Action onNext, System.Action onError) { } - public AnonymousObserver(System.Action onNext, System.Action onError, System.Action onCompleted) { } - protected override void OnCompletedCore() { } - protected override void OnErrorCore(System.Exception error) { } - protected override void OnNextCore(T value) { } - } - public static partial class Notification - { - public static System.Reactive.Notification CreateOnCompleted() { throw null; } - public static System.Reactive.Notification CreateOnError(System.Exception error) { throw null; } - public static System.Reactive.Notification CreateOnNext(T value) { throw null; } - } - public enum NotificationKind - { - OnCompleted = 2, - OnError = 1, - OnNext = 0, - } - [System.SerializableAttribute] - public abstract partial class Notification : System.IEquatable> - { - protected internal Notification() { } - public abstract System.Exception Exception { get; } - public abstract bool HasValue { get; } - public abstract System.Reactive.NotificationKind Kind { get; } - public abstract T Value { get; } - public abstract void Accept(System.Action onNext, System.Action onError, System.Action onCompleted); - public abstract void Accept(System.IObserver observer); - public abstract TResult Accept(System.Func onNext, System.Func onError, System.Func onCompleted); - public abstract TResult Accept(System.Reactive.IObserver observer); - public override bool Equals(object obj) { throw null; } - public abstract bool Equals(System.Reactive.Notification other); - public static bool operator ==(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public static bool operator !=(System.Reactive.Notification left, System.Reactive.Notification right) { throw null; } - public System.IObservable ToObservable() { throw null; } - public System.IObservable ToObservable(System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } - public abstract partial class ObservableBase : System.IObservable - { - protected ObservableBase() { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - protected abstract System.IDisposable SubscribeCore(System.IObserver observer); - } - public static partial class Observer - { - public static System.IObserver AsObserver(this System.IObserver observer) { throw null; } - public static System.IObserver Checked(this System.IObserver observer) { throw null; } - public static System.IObserver Create(System.Action onNext) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onCompleted) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError) { throw null; } - public static System.IObserver Create(System.Action onNext, System.Action onError, System.Action onCompleted) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObserver NotifyOn(this System.IObserver observer, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, bool preventReentrancy) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, object gate) { throw null; } - public static System.IObserver Synchronize(System.IObserver observer, System.Reactive.Concurrency.AsyncLock asyncLock) { throw null; } - public static System.Action> ToNotifier(this System.IObserver observer) { throw null; } - public static System.IObserver ToObserver(this System.Action> handler) { throw null; } - } - public abstract partial class ObserverBase : System.IDisposable, System.IObserver - { - protected ObserverBase() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } - public void OnCompleted() { } - protected abstract void OnCompletedCore(); - public void OnError(System.Exception error) { } - protected abstract void OnErrorCore(System.Exception error); - public void OnNext(T value) { } - protected abstract void OnNextCore(T value); - } - [System.SerializableAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)] - public partial struct Unit : System.IEquatable - { - public static System.Reactive.Unit Default { get { throw null; } } - public override bool Equals(object obj) { throw null; } - public bool Equals(System.Reactive.Unit other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public static bool operator !=(System.Reactive.Unit first, System.Reactive.Unit second) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Reactive.Concurrency -{ - public sealed partial class AsyncLock : System.IDisposable - { - public AsyncLock() { } - public void Dispose() { } - public void Wait(System.Action action) { } - } - public sealed partial class CurrentThreadScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal CurrentThreadScheduler() { } - public static System.Reactive.Concurrency.CurrentThreadScheduler Instance { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static bool IsScheduleRequired { get { throw null; } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This instance property is no longer supported. Use CurrentThreadScheduler.IsScheduleRequired instead. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public bool ScheduleRequired { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public sealed partial class DefaultScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal DefaultScheduler() { } - public static System.Reactive.Concurrency.DefaultScheduler Instance { get { throw null; } } - protected override object GetService(System.Type serviceType) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IConcurrencyAbstractionLayer - { - bool SupportsLongRunning { get; } - System.IDisposable QueueUserWorkItem(System.Action action, object state); - void Sleep(System.TimeSpan timeout); - System.IDisposable StartPeriodicTimer(System.Action action, System.TimeSpan period); - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - void StartThread(System.Action action, object state); - System.IDisposable StartTimer(System.Action action, object state, System.TimeSpan dueTime); - } - public sealed partial class ImmediateScheduler : System.Reactive.Concurrency.LocalScheduler - { - internal ImmediateScheduler() { } - public static System.Reactive.Concurrency.ImmediateScheduler Instance { get { throw null; } } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } - public abstract partial class LocalScheduler : System.IServiceProvider, System.Reactive.Concurrency.IScheduler, System.Reactive.Concurrency.IStopwatchProvider - { - protected LocalScheduler() { } - public virtual System.DateTimeOffset Now { get { throw null; } } - protected virtual object GetService(System.Type serviceType) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public virtual System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public abstract System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - public virtual System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - object System.IServiceProvider.GetService(System.Type serviceType) { throw null; } - } - public abstract partial class ScheduledItem : System.IComparable>, System.Reactive.Concurrency.IScheduledItem where TAbsolute : System.IComparable - { - protected ScheduledItem(TAbsolute dueTime, System.Collections.Generic.IComparer comparer) { } - public TAbsolute DueTime { get { throw null; } } - public bool IsCanceled { get { throw null; } } - public void Cancel() { } - public int CompareTo(System.Reactive.Concurrency.ScheduledItem other) { throw null; } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public void Invoke() { } - protected abstract System.IDisposable InvokeCore(); - public static bool operator ==(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator >=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator !=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - public static bool operator <=(System.Reactive.Concurrency.ScheduledItem left, System.Reactive.Concurrency.ScheduledItem right) { throw null; } - } - public sealed partial class ScheduledItem : System.Reactive.Concurrency.ScheduledItem where TAbsolute : System.IComparable - { - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - public ScheduledItem(System.Reactive.Concurrency.IScheduler scheduler, TValue state, System.Func action, TAbsolute dueTime, System.Collections.Generic.IComparer comparer) : base (default(TAbsolute), default(System.Collections.Generic.IComparer)) { } - protected override System.IDisposable InvokeCore() { throw null; } - } - public static partial class Scheduler - { - public static System.Reactive.Concurrency.CurrentThreadScheduler CurrentThread { get { throw null; } } - public static System.Reactive.Concurrency.DefaultScheduler Default { get { throw null; } } - public static System.Reactive.Concurrency.ImmediateScheduler Immediate { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use NewThreadScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler NewThread { get { throw null; } } - public static System.DateTimeOffset Now { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use TaskPoolScheduler.Default to obtain an instance of this scheduler type. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler TaskPool { get { throw null; } } - [System.ObsoleteAttribute("This property is no longer supported due to refactoring of the API surface and elimination of platform-specific dependencies. Consider using Scheduler.Default to obtain the platform's most appropriate pool-based scheduler. In order to access a specific pool-based scheduler, please add a reference to the System.Reactive.PlatformServices assembly for your target platform and use the appropriate scheduler in the System.Reactive.Concurrency namespace. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.IScheduler ThreadPool { get { throw null; } } - public static System.Reactive.Concurrency.ISchedulerLongRunning AsLongRunning(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.ISchedulerPeriodic AsPeriodic(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IStopwatchProvider AsStopwatchProvider(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler Catch(this System.Reactive.Concurrency.IScheduler scheduler, System.Func handler) where TException : System.Exception { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.IScheduler DisableOptimizations(this System.Reactive.Concurrency.IScheduler scheduler, params System.Type[] optimizationInterfaces) { throw null; } - public static System.TimeSpan Normalize(System.TimeSpan timeSpan) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Func action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func> action) { throw null; } - public static System.IDisposable ScheduleAsync(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public static System.IDisposable ScheduleLongRunning(this System.Reactive.Concurrency.ISchedulerLongRunning scheduler, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Action action) { throw null; } - public static System.IDisposable SchedulePeriodic(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan period, System.Func action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.DateTimeOffset dueTime, System.Action> action) { throw null; } - public static System.IDisposable Schedule(this System.Reactive.Concurrency.IScheduler scheduler, TState state, System.TimeSpan dueTime, System.Action> action) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.DateTimeOffset dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Sleep(this System.Reactive.Concurrency.IScheduler scheduler, System.TimeSpan dueTime, System.Threading.CancellationToken cancellationToken) { throw null; } - public static System.Reactive.Concurrency.IStopwatch StartStopwatch(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.Reactive.Concurrency.SchedulerOperation Yield(this System.Reactive.Concurrency.IScheduler scheduler, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public sealed partial class SchedulerOperation - { - internal SchedulerOperation() { } - public System.Reactive.Concurrency.SchedulerOperation ConfigureAwait(bool continueOnCapturedContext) { throw null; } - public System.Reactive.Concurrency.SchedulerOperationAwaiter GetAwaiter() { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public sealed partial class SchedulerOperationAwaiter : System.Runtime.CompilerServices.INotifyCompletion - { - internal SchedulerOperationAwaiter() { } - public bool IsCompleted { get { throw null; } } - public void GetResult() { } - public void OnCompleted(System.Action continuation) { } - } - public partial class SchedulerQueue where TAbsolute : System.IComparable - { - public SchedulerQueue() { } - public SchedulerQueue(int capacity) { } - public int Count { get { throw null; } } - public System.Reactive.Concurrency.ScheduledItem Dequeue() { throw null; } - public void Enqueue(System.Reactive.Concurrency.ScheduledItem scheduledItem) { } - public System.Reactive.Concurrency.ScheduledItem Peek() { throw null; } - public bool Remove(System.Reactive.Concurrency.ScheduledItem scheduledItem) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static partial class Synchronization - { - public static System.IObservable ObserveOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(System.IObservable source, System.Threading.SynchronizationContext context) { throw null; } - public static System.IObservable Synchronize(System.IObservable source) { throw null; } - public static System.IObservable Synchronize(System.IObservable source, object gate) { throw null; } - } - public partial class SynchronizationContextScheduler : System.Reactive.Concurrency.LocalScheduler - { - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context) { } - public SynchronizationContextScheduler(System.Threading.SynchronizationContext context, bool alwaysPost) { } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Disposables -{ - public sealed partial class BooleanDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public BooleanDisposable() { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CancellationDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CancellationDisposable() { } - public CancellationDisposable(System.Threading.CancellationTokenSource cts) { } - public bool IsDisposed { get { throw null; } } - public System.Threading.CancellationToken Token { get { throw null; } } - public void Dispose() { } - } - public sealed partial class CompositeDisposable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable, System.IDisposable, System.Reactive.Disposables.ICancelable - { - public CompositeDisposable() { } - public CompositeDisposable(System.Collections.Generic.IEnumerable disposables) { } - public CompositeDisposable(params System.IDisposable[] disposables) { } - public CompositeDisposable(int capacity) { } - public int Count { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public void Add(System.IDisposable item) { } - public void Clear() { } - public bool Contains(System.IDisposable item) { throw null; } - public void CopyTo(System.IDisposable[] array, int arrayIndex) { } - public void Dispose() { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(System.IDisposable item) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public sealed partial class ContextDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ContextDisposable(System.Threading.SynchronizationContext context, System.IDisposable disposable) { } - public System.Threading.SynchronizationContext Context { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public static partial class Disposable - { - public static System.IDisposable Empty { get { throw null; } } - public static System.IDisposable Create(System.Action dispose) { throw null; } - } - public sealed partial class MultipleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public MultipleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class RefCountDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public RefCountDisposable(System.IDisposable disposable) { } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - public System.IDisposable GetDisposable() { throw null; } - } - public sealed partial class ScheduledDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public ScheduledDisposable(System.Reactive.Concurrency.IScheduler scheduler, System.IDisposable disposable) { } - public System.IDisposable Disposable { get { throw null; } } - public bool IsDisposed { get { throw null; } } - public System.Reactive.Concurrency.IScheduler Scheduler { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SerialDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SerialDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } - public sealed partial class SingleAssignmentDisposable : System.IDisposable, System.Reactive.Disposables.ICancelable - { - public SingleAssignmentDisposable() { } - public System.IDisposable Disposable { get { throw null; } set { } } - public bool IsDisposed { get { throw null; } } - public void Dispose() { } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class DefaultSystemClock : System.Reactive.PlatformServices.ISystemClock - { - public DefaultSystemClock() { } - public System.DateTimeOffset UtcNow { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HostLifecycleService - { - public static event System.EventHandler Resuming { add { } remove { } } - public static event System.EventHandler Suspending { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostResumingEventArgs : System.EventArgs - { - public HostResumingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class HostSuspendingEventArgs : System.EventArgs - { - public HostSuspendingEventArgs() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IExceptionServices - { - void Rethrow(System.Exception exception); - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IHostLifecycleNotifications - { - event System.EventHandler Resuming; - event System.EventHandler Suspending; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface INotifySystemClockChanged - { - event System.EventHandler SystemClockChanged; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface IPlatformEnlightenmentProvider - { - T GetService(params object[] args) where T : class; - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial interface ISystemClock - { - System.DateTimeOffset UtcNow { get; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class PeriodicTimerSystemClockMonitor : System.Reactive.PlatformServices.INotifySystemClockChanged - { - public PeriodicTimerSystemClockMonitor(System.TimeSpan period) { } - public event System.EventHandler SystemClockChanged { add { } remove { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PlatformEnlightenmentProvider - { - public static System.Reactive.PlatformServices.IPlatformEnlightenmentProvider Current { get { throw null; } set { } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class SystemClock - { - public static System.DateTimeOffset UtcNow { get { throw null; } } - public static event System.EventHandler SystemClockChanged { add { } remove { } } - public static void AddRef() { } - public static void Release() { } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class SystemClockChangedEventArgs : System.EventArgs - { - public SystemClockChangedEventArgs() { } - public SystemClockChangedEventArgs(System.DateTimeOffset oldTime, System.DateTimeOffset newTime) { } - public System.DateTimeOffset NewTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.DateTimeOffset OldTime { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Debugger.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Debugger.cs deleted file mode 100644 index 947bd7811a..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Debugger.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Debugger Library containing runtime hooks for query operators to allow debugging and tracing.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Debugger")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public partial class QueryDebugger - { - public QueryDebugger() { } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Experimental.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Experimental.cs deleted file mode 100644 index e6abcf6c85..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Experimental.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reactive.ExperimentalAttribute] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Experimental Library containing unstable and infrequently used functionality.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Experimental")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Reactive.Debugger, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=false, Inherited=true)] - [System.Reactive.ExperimentalAttribute] - public sealed partial class ExperimentalAttribute : System.Attribute - { - public ExperimentalAttribute() { } - } - [System.Reactive.ExperimentalAttribute] - public partial class ListObservable : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable, System.IObservable - { - public ListObservable(System.IObservable source) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public T this[int index] { get { throw null; } set { } } - public T Value { get { throw null; } } - public void Add(T item) { } - public void Clear() { } - public bool Contains(T item) { throw null; } - public void CopyTo(T[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public int IndexOf(T item) { throw null; } - public void Insert(int index, T item) { } - public bool Remove(T item) { throw null; } - public void RemoveAt(int index) { } - public System.IDisposable Subscribe(System.IObserver observer) { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ObservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Create(System.Func, System.Collections.Generic.IEnumerable>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Expand(this System.IObservable source, System.Func> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ForkJoin(this System.IObservable first, System.IObservable second, System.Func resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable Let(this System.IObservable source, System.Func, System.IObservable> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.IObservable ManySelect(this System.IObservable source, System.Func, TResult> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.ListObservable ToListObservable(this System.IObservable source) { throw null; } - } - [System.Reactive.Linq.LocalQueryMethodImplementationTypeAttribute(typeof(System.Reactive.Linq.ObservableEx))] - public static partial class QbservableEx - { - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Create(this System.Reactive.Linq.IQbservableProvider provider, System.Linq.Expressions.Expression, System.Collections.Generic.IEnumerable>>> iteratorMethod) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Expand(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, System.Collections.Generic.IEnumerable> sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservableProvider provider, params System.IObservable[] sources) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ForkJoin(this System.Reactive.Linq.IQbservable first, System.IObservable second, System.Linq.Expressions.Expression> resultSelector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable Let(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, System.IObservable>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector) { throw null; } - [System.Reactive.ExperimentalAttribute] - public static System.Reactive.Linq.IQbservable ManySelect(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression, TResult>> selector, System.Reactive.Concurrency.IScheduler scheduler) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Interfaces.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Interfaces.cs deleted file mode 100644 index 6053fabe3b..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Interfaces.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Interfaces Library containing essential interfaces.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Interfaces")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObservable<>))] -[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IObserver<>))] -namespace System.Reactive -{ - public partial interface IEventPatternSource where TEventArgs : System.EventArgs - { - event System.EventHandler OnNext; - } - public partial interface IEventPattern where TEventArgs : System.EventArgs - { - TEventArgs EventArgs { get; } - TSender Sender { get; } - } - public partial interface IEventSource - { - event System.Action OnNext; - } - public partial interface IObserver - { - TResult OnCompleted(); - TResult OnError(System.Exception exception); - TResult OnNext(TValue value); - } -} -namespace System.Reactive.Concurrency -{ - public partial interface IScheduledItem - { - TAbsolute DueTime { get; } - void Invoke(); - } - public partial interface IScheduler - { - System.DateTimeOffset Now { get; } - System.IDisposable Schedule(TState state, System.DateTimeOffset dueTime, System.Func action); - System.IDisposable Schedule(TState state, System.Func action); - System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action); - } - public partial interface ISchedulerLongRunning - { - System.IDisposable ScheduleLongRunning(TState state, System.Action action); - } - public partial interface ISchedulerPeriodic - { - System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action); - } - public partial interface IStopwatch - { - System.TimeSpan Elapsed { get; } - } - public partial interface IStopwatchProvider - { - System.Reactive.Concurrency.IStopwatch StartStopwatch(); - } -} -namespace System.Reactive.Disposables -{ - public partial interface ICancelable : System.IDisposable - { - bool IsDisposed { get; } - } -} -namespace System.Reactive.Linq -{ - public partial interface IGroupedObservable : System.IObservable - { - TKey Key { get; } - } - public partial interface IQbservable - { - System.Type ElementType { get; } - System.Linq.Expressions.Expression Expression { get; } - System.Reactive.Linq.IQbservableProvider Provider { get; } - } - public partial interface IQbservableProvider - { - System.Reactive.Linq.IQbservable CreateQuery(System.Linq.Expressions.Expression expression); - } - public partial interface IQbservable : System.IObservable, System.Reactive.Linq.IQbservable - { - } -} -namespace System.Reactive.Subjects -{ - public partial interface IConnectableObservable : System.IObservable - { - System.IDisposable Connect(); - } - public partial interface ISubject : System.IObservable, System.IObserver, System.Reactive.Subjects.ISubject - { - } - public partial interface ISubject : System.IObservable, System.IObserver - { - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Linq.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Linq.cs.REMOVED.git-id deleted file mode 100644 index 6f7a384401..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Linq.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f5b7e1f5e8f18e2e491af44627106e374224ab40 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Observable.Aliases.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Observable.Aliases.cs deleted file mode 100644 index dad78a51ad..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Observable.Aliases.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -namespace System.Reactive.Linq -{ - public static partial class QbservableAliases - { - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable Filter(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> predicate) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.IObservable other) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> onNext, System.Linq.Expressions.Expression>> onError, System.Linq.Expressions.Expression>> onCompleted) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> selector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> collectionSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable FlatMap(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression>> taskSelector, System.Linq.Expressions.Expression> resultSelector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - public static System.Reactive.Linq.IQbservable Map(this System.Reactive.Linq.IQbservable source, System.Linq.Expressions.Expression> selector) { throw null; } - } -} -namespace System.Reactive.Observable.Aliases -{ - public static partial class QueryLanguage - { - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable Filter(this System.IObservable source, System.Func predicate) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> onNext, System.Func> onError, System.Func> onCompleted) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> selector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.IObservable other) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> collectionSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable FlatMap(this System.IObservable source, System.Func> taskSelector, System.Func resultSelector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - public static System.IObservable Map(this System.IObservable source, System.Func selector) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.PlatformServices.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.PlatformServices.cs deleted file mode 100644 index f73d1beba5..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.PlatformServices.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Platform Services Library used to access platform-specific functionality and enlightenment services.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.PlatformServices")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public sealed partial class EventLoopScheduler : System.Reactive.Concurrency.LocalScheduler, System.IDisposable, System.Reactive.Concurrency.ISchedulerPeriodic - { - public EventLoopScheduler() { } - public EventLoopScheduler(System.Func threadFactory) { } - public void Dispose() { } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class NewThreadScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public NewThreadScheduler() { } - public NewThreadScheduler(System.Func threadFactory) { } - public static System.Reactive.Concurrency.NewThreadScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class TaskPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - public TaskPoolScheduler(System.Threading.Tasks.TaskFactory taskFactory) { } - public static System.Reactive.Concurrency.TaskPoolScheduler Default { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } - public sealed partial class ThreadPoolScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerLongRunning, System.Reactive.Concurrency.ISchedulerPeriodic - { - internal ThreadPoolScheduler() { } - public static System.Reactive.Concurrency.ThreadPoolScheduler Instance { get { throw null; } } - public System.IDisposable ScheduleLongRunning(TState state, System.Action action) { throw null; } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { throw null; } - } -} -namespace System.Reactive.PlatformServices -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public partial class CurrentPlatformEnlightenmentProvider : System.Reactive.PlatformServices.IPlatformEnlightenmentProvider - { - public CurrentPlatformEnlightenmentProvider() { } - public virtual T GetService(object[] args) where T : class { throw null; } - } - public static partial class EnlightenmentProvider - { - public static bool EnsureLoaded() { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Providers.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Providers.cs.REMOVED.git-id deleted file mode 100644 index 9f8860276f..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Providers.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b241864ce9a6cb4a07386f059712e11501571c24 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Runtime.Remoting.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Runtime.Remoting.cs deleted file mode 100644 index b1f6e4fe88..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Runtime.Remoting.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Reactive Extensions Remoting Library used to expose observable sequences through .NET Remoting.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Runtime.Remoting")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Linq -{ - public static partial class RemotingObservable - { - public static System.IObservable Remotable(this System.IObservable source) { throw null; } - public static System.IObservable Remotable(this System.IObservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source) { throw null; } - public static System.Reactive.Linq.IQbservable Remotable(this System.Reactive.Linq.IQbservable source, System.Runtime.Remoting.Lifetime.ILease lease) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Windows.Forms.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Windows.Forms.cs deleted file mode 100644 index 9bee832064..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Windows.Forms.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Forms extensions library for Rx. Contains scheduler functionality for the Windows Forms UI loop.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Forms")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class ControlScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public ControlScheduler(System.Windows.Forms.Control control) { } - public System.Windows.Forms.Control Control { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class ControlObservable - { - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Forms.Control control) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Windows.Threading.cs b/external/binary-reference-assemblies/src/v4.7/System.Reactive.Windows.Threading.cs deleted file mode 100644 index 05157c7f24..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Reactive.Windows.Threading.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.2.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Open Technologies, Inc.")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("Retail")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Open Technologies, Inc. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("Windows Presentation Foundation extensions library for Rx. Contains scheduler functionality for the WPF Dispatcher.")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("2.2.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Reactive Extensions")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Reactive.Windows.Threading")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace System.Reactive.Concurrency -{ - public partial class DispatcherScheduler : System.Reactive.Concurrency.LocalScheduler, System.Reactive.Concurrency.ISchedulerPeriodic - { - public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher) { } - public static System.Reactive.Concurrency.DispatcherScheduler Current { get { throw null; } } - public System.Windows.Threading.Dispatcher Dispatcher { get { throw null; } } - [System.ObsoleteAttribute("Use the Current property to retrieve the DispatcherScheduler instance for the current thread's Dispatcher object. See http://go.microsoft.com/fwlink/?LinkID=260866 for more information.")] - public static System.Reactive.Concurrency.DispatcherScheduler Instance { get { throw null; } } - public System.IDisposable SchedulePeriodic(TState state, System.TimeSpan period, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.Func action) { throw null; } - public override System.IDisposable Schedule(TState state, System.TimeSpan dueTime, System.Func action) { throw null; } - } -} -namespace System.Reactive.Linq -{ - public static partial class DispatcherObservable - { - public static System.IObservable ObserveOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable ObserveOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - public static System.IObservable SubscribeOnDispatcher(this System.IObservable source) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Reactive.Concurrency.DispatcherScheduler scheduler) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.Dispatcher dispatcher) { throw null; } - public static System.IObservable SubscribeOn(this System.IObservable source, System.Windows.Threading.DispatcherObject dispatcherObject) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.Http.SelfHost.cs b/external/binary-reference-assemblies/src/v4.7/System.Web.Http.SelfHost.cs deleted file mode 100644 index a4291c06a6..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.Http.SelfHost.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.SelfHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.SelfHost.Test.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -namespace System.Net.Http -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class HttpRequestMessageExtensions - { - public static System.ServiceModel.Security.SecurityMessageProperty GetSecurityMessageProperty(this System.Net.Http.HttpRequestMessage request) { throw null; } - } -} -namespace System.Web.Http.SelfHost -{ - public partial class HttpSelfHostConfiguration : System.Web.Http.HttpConfiguration - { - public HttpSelfHostConfiguration(string baseAddress) { } - public HttpSelfHostConfiguration(System.Uri baseAddress) { } - public System.Uri BaseAddress { get { throw null; } } - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - public int MaxBufferSize { get { throw null; } set { } } - public int MaxConcurrentRequests { get { throw null; } set { } } - public long MaxReceivedMessageSize { get { throw null; } set { } } - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public System.IdentityModel.Selectors.UserNamePasswordValidator UserNamePasswordValidator { get { throw null; } set { } } - public bool UseWindowsAuthentication { get { throw null; } set { } } - protected virtual System.ServiceModel.Channels.BindingParameterCollection OnConfigureBinding(System.Web.Http.SelfHost.Channels.HttpBinding httpBinding) { throw null; } - } - public sealed partial class HttpSelfHostServer : System.Web.Http.HttpServer - { - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration) { } - public HttpSelfHostServer(System.Web.Http.SelfHost.HttpSelfHostConfiguration configuration, System.Net.Http.HttpMessageHandler dispatcher) { } - public System.Threading.Tasks.Task CloseAsync() { throw null; } - protected override void Dispose(bool disposing) { } - public System.Threading.Tasks.Task OpenAsync() { throw null; } - } -} -namespace System.Web.Http.SelfHost.Channels -{ - public partial class HttpBinding : System.ServiceModel.Channels.Binding, System.ServiceModel.Channels.IBindingRuntimePreferences - { - public HttpBinding() { } - public HttpBinding(System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode securityMode) { } - public System.ServiceModel.EnvelopeVersion EnvelopeVersion { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.HostNameComparisonMode)(0))] - public System.ServiceModel.HostNameComparisonMode HostNameComparisonMode { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)524288)] - public long MaxBufferPoolSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(65536)] - public int MaxBufferSize { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute((long)65536)] - public long MaxReceivedMessageSize { get { throw null; } set { } } - public override string Scheme { get { throw null; } } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurity Security { get { throw null; } set { } } - bool System.ServiceModel.Channels.IBindingRuntimePreferences.ReceiveSynchronously { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.ServiceModel.TransferMode)(0))] - public System.ServiceModel.TransferMode TransferMode { get { throw null; } set { } } - public override System.ServiceModel.Channels.BindingElementCollection CreateBindingElements() { throw null; } - } - public sealed partial class HttpBindingSecurity - { - public HttpBindingSecurity() { } - public System.Web.Http.SelfHost.Channels.HttpBindingSecurityMode Mode { get { throw null; } set { } } - public System.ServiceModel.HttpTransportSecurity Transport { get { throw null; } set { } } - } - public enum HttpBindingSecurityMode - { - None = 0, - Transport = 1, - TransportCredentialOnly = 2, - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.Http.WebHost.cs b/external/binary-reference-assemblies/src/v4.7/System.Web.Http.WebHost.cs deleted file mode 100644 index f597301777..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.Http.WebHost.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("4.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET MVC")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.Http.WebHost")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Http.WebHost.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.Http.WebHost.PreApplicationStartCode), "Start")] -namespace System.Web.Http -{ - public static partial class GlobalConfiguration - { - public static System.Web.Http.HttpConfiguration Configuration { get { throw null; } } - public static System.Web.Http.Dispatcher.HttpControllerDispatcher Dispatcher { get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class RouteCollectionExtensions - { - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults) { throw null; } - public static System.Web.Routing.Route MapHttpRoute(this System.Web.Routing.RouteCollection routes, string name, string routeTemplate, object defaults, object constraints) { throw null; } - } -} -namespace System.Web.Http.WebHost -{ - public partial class HttpControllerHandler : System.Web.IHttpAsyncHandler, System.Web.IHttpHandler - { - public HttpControllerHandler(System.Web.Routing.RouteData routeData) { } - protected virtual bool IsReusable { get { throw null; } } - bool System.Web.IHttpHandler.IsReusable { get { throw null; } } - protected virtual System.IAsyncResult BeginProcessRequest(System.Web.HttpContextBase httpContextBase, System.AsyncCallback callback, object state) { throw null; } - protected virtual void EndProcessRequest(System.IAsyncResult result) { } - protected virtual void ProcessRequest(System.Web.HttpContextBase httpContextBase) { } - System.IAsyncResult System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext httpContext, System.AsyncCallback callback, object state) { throw null; } - void System.Web.IHttpAsyncHandler.EndProcessRequest(System.IAsyncResult result) { } - void System.Web.IHttpHandler.ProcessRequest(System.Web.HttpContext httpContext) { } - } - public partial class HttpControllerRouteHandler : System.Web.Routing.IRouteHandler - { - protected HttpControllerRouteHandler() { } - public static System.Web.Http.WebHost.HttpControllerRouteHandler Instance { get { throw null; } } - protected virtual System.Web.IHttpHandler GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - System.Web.IHttpHandler System.Web.Routing.IRouteHandler.GetHttpHandler(System.Web.Routing.RequestContext requestContext) { throw null; } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } -} -namespace System.Web.Http.WebHost.Routing -{ - public partial class HttpWebRoute : System.Web.Routing.Route - { - public HttpWebRoute(string url, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public HttpWebRoute(string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler) : base (default(string), default(System.Web.Routing.IRouteHandler)) { } - public override System.Web.Routing.VirtualPathData GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values) { throw null; } - protected override bool ProcessConstraint(System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.Http.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7/System.Web.Http.cs.REMOVED.git-id deleted file mode 100644 index 745e684454..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.Http.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -fe44ff1016ed9ae87ab211c14696686eb050f2eb \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.Mvc.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7/System.Web.Mvc.cs.REMOVED.git-id deleted file mode 100644 index c9be32f181..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.Mvc.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7d7fc3daa8f6707479cbab03b6eb09c830d567dc \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.Razor.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/v4.7/System.Web.Razor.cs.REMOVED.git-id deleted file mode 100644 index 89cf0d4fc1..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.Razor.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -cf2437bd0e6520acc43ddacdf25f16502d380f5b \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.Deployment.cs b/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.Deployment.cs deleted file mode 100644 index b6a6073595..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.Deployment.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Deployment.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Deployment")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Deployment.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Deployment.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Deployment -{ - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class WebPagesDeployment - { - public static string GetAssemblyPath(System.Version version) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static System.Collections.Generic.IDictionary GetIncompatibleDependencies(string appPath) { throw null; } - public static System.Version GetMaxVersion() { throw null; } - [System.ObsoleteAttribute("This method is obsolete and is meant for legacy code. Use GetVersionWithoutEnabled instead.")] - public static System.Version GetVersion(string path) { throw null; } - public static System.Version GetVersionWithoutEnabledCheck(string path) { throw null; } - public static System.Collections.Generic.IEnumerable GetWebPagesAssemblies() { throw null; } - public static bool IsEnabled(string path) { throw null; } - public static bool IsExplicitlyDisabled(string path) { throw null; } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.Razor.cs b/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.Razor.cs deleted file mode 100644 index c09eee0f4d..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.Razor.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.Razor.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages.Razor")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.Razor.PreApplicationStartCode), "Start")] -namespace System.Web.WebPages.Razor -{ - public partial class CompilingPathEventArgs : System.EventArgs - { - public CompilingPathEventArgs(string virtualPath, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public System.Web.WebPages.Razor.WebPageRazorHost Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - [System.Web.Compilation.BuildProviderAppliesToAttribute((System.Web.Compilation.BuildProviderAppliesTo)(3))] - public partial class RazorBuildProvider : System.Web.Compilation.BuildProvider - { - public RazorBuildProvider() { } - public System.Web.Compilation.AssemblyBuilder AssemblyBuilder { get { throw null; } } - public override System.Web.Compilation.CompilerType CodeCompilerType { get { throw null; } } - public new string VirtualPath { get { throw null; } } - public override System.Collections.ICollection VirtualPathDependencies { get { throw null; } } - public static event System.EventHandler CodeGenerationCompleted { add { } remove { } } - public static event System.EventHandler CodeGenerationStarted { add { } remove { } } - public static event System.EventHandler CompilingPath { add { } remove { } } - public void AddVirtualPathDependency(string dependency) { } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost() { throw null; } - public override void GenerateCode(System.Web.Compilation.AssemblyBuilder assemblyBuilder) { } - public override System.Type GetGeneratedType(System.CodeDom.Compiler.CompilerResults results) { throw null; } - protected internal virtual System.Web.WebPages.Razor.WebPageRazorHost GetHostFromConfig() { throw null; } - protected internal virtual System.IO.TextReader InternalOpenReader() { throw null; } - protected virtual void OnBeforeCompilePath(System.Web.WebPages.Razor.CompilingPathEventArgs args) { } - } - public partial class WebCodeRazorHost : System.Web.WebPages.Razor.WebPageRazorHost - { - public WebCodeRazorHost(string virtualPath) : base (default(string)) { } - public WebCodeRazorHost(string virtualPath, string physicalPath) : base (default(string)) { } - protected override string GetClassName(string virtualPath) { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - } - public partial class WebPageRazorHost : System.Web.Razor.RazorEngineHost - { - public WebPageRazorHost(string virtualPath) { } - public WebPageRazorHost(string virtualPath, string physicalPath) { } - public override System.Web.Razor.RazorCodeLanguage CodeLanguage { get { throw null; } protected set { } } - public override string DefaultBaseClass { get { throw null; } set { } } - public override string DefaultClassName { get { throw null; } set { } } - public bool DefaultDebugCompilation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string DefaultPageBaseClass { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override string InstrumentedSourceFilePath { get { throw null; } set { } } - public bool IsSpecialPage { get { throw null; } } - public string PhysicalPath { get { throw null; } set { } } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static void AddGlobalImport(string ns) { } - public override System.Web.Razor.Parser.ParserBase CreateMarkupParser() { throw null; } - protected virtual string GetClassName(string virtualPath) { throw null; } - protected virtual System.Web.Razor.RazorCodeLanguage GetCodeLanguage() { throw null; } - public static System.Collections.Generic.IEnumerable GetGlobalImports() { throw null; } - public override void PostProcessGeneratedCode(System.Web.Razor.Generator.CodeGeneratorContext context) { } - protected void RegisterSpecialFile(string fileName, string baseTypeName) { } - protected void RegisterSpecialFile(string fileName, System.Type baseType) { } - } - public partial class WebRazorHostFactory - { - public WebRazorHostFactory() { } - public static void ApplyConfigurationToHost(System.Web.WebPages.Razor.Configuration.RazorPagesSection config, System.Web.WebPages.Razor.WebPageRazorHost host) { } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateDefaultHost(string virtualPath, string physicalPath) { throw null; } - public virtual System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(string virtualPath, string physicalPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath) { throw null; } - public static System.Web.WebPages.Razor.WebPageRazorHost CreateHostFromConfig(System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup config, string virtualPath, string physicalPath) { throw null; } - } -} -namespace System.Web.WebPages.Razor.Configuration -{ - public partial class HostSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public HostSection() { } - [System.Configuration.ConfigurationPropertyAttribute("factoryType", IsRequired=true, DefaultValue=null)] - public string FactoryType { get { throw null; } set { } } - } - public partial class RazorPagesSection : System.Configuration.ConfigurationSection - { - public static readonly string SectionName; - public RazorPagesSection() { } - [System.Configuration.ConfigurationPropertyAttribute("namespaces", IsRequired=true)] - public System.Web.Configuration.NamespaceCollection Namespaces { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pageBaseType", IsRequired=true)] - public string PageBaseType { get { throw null; } set { } } - } - public partial class RazorWebSectionGroup : System.Configuration.ConfigurationSectionGroup - { - public static readonly string GroupName; - public RazorWebSectionGroup() { } - [System.Configuration.ConfigurationPropertyAttribute("host", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.HostSection Host { get { throw null; } set { } } - [System.Configuration.ConfigurationPropertyAttribute("pages", IsRequired=false)] - public System.Web.WebPages.Razor.Configuration.RazorPagesSection Pages { get { throw null; } set { } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.cs b/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.cs deleted file mode 100644 index f730416895..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/System.Web.WebPages.cs +++ /dev/null @@ -1,776 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("2.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")] -[assembly:System.Reflection.AssemblyConfigurationAttribute("")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("System.Web.WebPages.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.7.2046.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Microsoft ASP.NET Web Pages")] -[assembly:System.Reflection.AssemblyTitleAttribute("System.Web.WebPages")] -[assembly:System.Reflection.AssemblyTrademarkAttribute("")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("4.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Helpers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.Mvc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Administration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.InternalsVisibleToAttribute("System.Web.WebPages.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly:System.Security.SecurityTransparentAttribute] -[assembly:System.Web.PreApplicationStartMethodAttribute(typeof(System.Web.WebPages.PreApplicationStartCode), "Start")] -namespace System.Web.Helpers -{ - public static partial class AntiForgery - { - public static System.Web.HtmlString GetHtml() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)] - public static System.Web.HtmlString GetHtml(System.Web.HttpContextBase httpContext, string salt, string domain, string path) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void GetTokens(string oldCookieToken, out string newCookieToken, out string formToken) { newCookieToken = default(string); formToken = default(string); } - public static void Validate() { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] - public static void Validate(string cookieToken, string formToken) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("This method is deprecated. Use the Validate() method instead.", true)] - public static void Validate(System.Web.HttpContextBase httpContext, string salt) { } - } - public static partial class AntiForgeryConfig - { - public static System.Web.Helpers.IAntiForgeryAdditionalDataProvider AdditionalDataProvider { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string CookieName { get { throw null; } set { } } - public static bool RequireSsl { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static bool SuppressIdentityHeuristicChecks { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static string UniqueClaimTypeIdentifier { get { throw null; } set { } } - } - public partial interface IAntiForgeryAdditionalDataProvider - { - string GetAdditionalData(System.Web.HttpContextBase context); - bool ValidateAdditionalData(System.Web.HttpContextBase context, string additionalData); - } - public sealed partial class UnvalidatedRequestValues - { - internal UnvalidatedRequestValues() { } - public System.Collections.Specialized.NameValueCollection Form { get { throw null; } } - public string this[string key] { get { throw null; } } - public System.Collections.Specialized.NameValueCollection QueryString { get { throw null; } } - } - public static partial class Validation - { - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequest request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequest request, string key) { throw null; } - public static System.Web.Helpers.UnvalidatedRequestValues Unvalidated(this System.Web.HttpRequestBase request) { throw null; } - public static string Unvalidated(this System.Web.HttpRequestBase request, string key) { throw null; } - } -} -namespace System.Web.Mvc -{ - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - [System.SerializableAttribute] - public sealed partial class HttpAntiForgeryException : System.Web.HttpException - { - public HttpAntiForgeryException() { } - public HttpAntiForgeryException(string message) { } - public HttpAntiForgeryException(string message, System.Exception innerException) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationEqualToRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationEqualToRule(string errorMessage, object other) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRangeRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRangeRule(string errorMessage, object minValue, object maxValue) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRegexRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRegexRule(string errorMessage, string pattern) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRemoteRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRemoteRule(string errorMessage, string url, string httpMethod, string additionalFields) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRequiredRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationRequiredRule(string errorMessage) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationRule - { - public ModelClientValidationRule() { } - public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IDictionary ValidationParameters { get { throw null; } } - public string ValidationType { get { throw null; } set { } } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class ModelClientValidationStringLengthRule : System.Web.Mvc.ModelClientValidationRule - { - public ModelClientValidationStringLengthRule(string errorMessage, int minimumLength, int maximumLength) { } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public partial class TagBuilder - { - public TagBuilder(string tagName) { } - public System.Collections.Generic.IDictionary Attributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string IdAttributeDotReplacement { get { throw null; } set { } } - public string InnerHtml { get { throw null; } set { } } - public string TagName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public void AddCssClass(string value) { } - public static string CreateSanitizedId(string originalId) { throw null; } - public static string CreateSanitizedId(string originalId, string invalidCharReplacement) { throw null; } - public void GenerateId(string name) { } - public void MergeAttribute(string key, string value) { } - public void MergeAttribute(string key, string value, bool replaceExisting) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes) { } - public void MergeAttributes(System.Collections.Generic.IDictionary attributes, bool replaceExisting) { } - public void SetInnerText(string innerText) { } - public override string ToString() { throw null; } - public string ToString(System.Web.Mvc.TagRenderMode renderMode) { throw null; } - } - [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] - public enum TagRenderMode - { - EndTag = 2, - Normal = 0, - SelfClosing = 3, - StartTag = 1, - } - public static partial class UnobtrusiveValidationAttributesGenerator - { - public static void GetValidationAttributes(System.Collections.Generic.IEnumerable clientRules, System.Collections.Generic.IDictionary results) { } - } -} -namespace System.Web.WebPages -{ - public partial class ApplicationPart - { - public ApplicationPart(System.Reflection.Assembly assembly, string rootVirtualPath) { } - public static string ProcessVirtualPath(System.Reflection.Assembly assembly, string baseVirtualPath, string virtualPath) { throw null; } - public static void Register(System.Web.WebPages.ApplicationPart applicationPart) { } - } - public abstract partial class ApplicationStartPage : System.Web.WebPages.WebPageExecutingBase - { - public static readonly string CacheKeyPrefix; - public static readonly string StartPageVirtualPath; - protected ApplicationStartPage() { } - public System.Web.HttpApplication Application { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.HtmlString Markup { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.IO.TextWriter Output { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override string VirtualPath { get { throw null; } set { } } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class AttributeValue - { - public AttributeValue(System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged value, bool literal) { } - public bool Literal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Prefix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.Instrumentation.PositionTagged Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static System.Web.WebPages.AttributeValue FromTuple(System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - public static implicit operator System.Web.WebPages.AttributeValue (System.Tuple, System.Tuple, bool> value) { throw null; } - } - public static partial class BrowserHelpers - { - public static void ClearOverriddenBrowser(this System.Web.HttpContextBase httpContext) { } - public static System.Web.HttpBrowserCapabilitiesBase GetOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetOverriddenUserAgent(this System.Web.HttpContextBase httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContext httpContext) { throw null; } - public static string GetVaryByCustomStringForOverriddenBrowser(this System.Web.HttpContextBase httpContext) { throw null; } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, string userAgent) { } - public static void SetOverriddenBrowser(this System.Web.HttpContextBase httpContext, System.Web.WebPages.BrowserOverride browserOverride) { } - } - public enum BrowserOverride - { - Desktop = 0, - Mobile = 1, - } - public abstract partial class BrowserOverrideStore - { - protected BrowserOverrideStore() { } - public abstract string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext); - public abstract void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent); - } - public partial class BrowserOverrideStores - { - public BrowserOverrideStores() { } - public static System.Web.WebPages.BrowserOverrideStore Current { get { throw null; } set { } } - } - public partial class CookieBrowserOverrideStore : System.Web.WebPages.BrowserOverrideStore - { - public CookieBrowserOverrideStore() { } - public CookieBrowserOverrideStore(int daysToExpire) { } - public override string GetOverriddenUserAgent(System.Web.HttpContextBase httpContext) { throw null; } - public override void SetOverriddenUserAgent(System.Web.HttpContextBase httpContext, string userAgent) { } - } - public partial class DefaultDisplayMode : System.Web.WebPages.IDisplayMode - { - public DefaultDisplayMode() { } - public DefaultDisplayMode(string suffix) { } - public System.Func ContextCondition { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string DisplayModeId { get { throw null; } } - public bool CanHandleContext(System.Web.HttpContextBase httpContext) { throw null; } - public virtual System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists) { throw null; } - protected virtual string TransformPath(string virtualPath, string suffix) { throw null; } - } - public partial class DisplayInfo - { - public DisplayInfo(string filePath, System.Web.WebPages.IDisplayMode displayMode) { } - public System.Web.WebPages.IDisplayMode DisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public string FilePath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - public sealed partial class DisplayModeProvider - { - internal DisplayModeProvider() { } - public static readonly string DefaultDisplayModeId; - public static readonly string MobileDisplayModeId; - public static System.Web.WebPages.DisplayModeProvider Instance { get { throw null; } } - public System.Collections.Generic.IList Modes { get { throw null; } } - public bool RequireConsistentDisplayMode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.Collections.Generic.IEnumerable GetAvailableDisplayModesForContext(System.Web.HttpContextBase httpContext, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - public System.Web.WebPages.DisplayInfo GetDisplayInfoForVirtualPath(string virtualPath, System.Web.HttpContextBase httpContext, System.Func virtualPathExists, System.Web.WebPages.IDisplayMode currentDisplayMode) { throw null; } - } - public partial class HelperPage - { - public HelperPage() { } - public static dynamic App { get { throw null; } } - public static System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public static System.Web.Caching.Cache Cache { get { throw null; } } - public static System.Web.HttpContextBase Context { get { throw null; } } - public static System.Web.WebPages.WebPageRenderingBase CurrentPage { get { throw null; } } - protected static string HelperVirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public static System.Web.WebPages.Html.HtmlHelper Html { get { throw null; } } - public static bool IsAjax { get { throw null; } } - public static bool IsPost { get { throw null; } } - public static dynamic Model { get { throw null; } } - public static System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public static dynamic Page { get { throw null; } } - public static System.Web.WebPages.WebPageContext PageContext { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary PageData { get { throw null; } } - public static System.Web.HttpRequestBase Request { get { throw null; } } - public static System.Web.HttpResponseBase Response { get { throw null; } } - public static System.Web.HttpServerUtilityBase Server { get { throw null; } } - public static System.Web.HttpSessionStateBase Session { get { throw null; } } - public static System.Collections.Generic.IList UrlData { get { throw null; } } - public static System.Security.Principal.IPrincipal User { get { throw null; } } - public static string VirtualPath { get { throw null; } } - public static void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - public static void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - public static string Href(string path, params object[] pathParts) { throw null; } - public static void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, object value) { } - public static void WriteLiteralTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - public static void WriteTo(System.IO.TextWriter writer, object value) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult value) { } - } - public partial class HelperResult : System.Web.IHtmlString - { - public HelperResult(System.Action action) { } - public string ToHtmlString() { throw null; } - public override string ToString() { throw null; } - public void WriteTo(System.IO.TextWriter writer) { } - } - public static partial class HttpContextExtensions - { - public static void RedirectLocal(this System.Web.HttpContextBase context, string url) { } - public static void RegisterForDispose(this System.Web.HttpContextBase context, System.IDisposable resource) { } - } - public partial interface IDisplayMode - { - string DisplayModeId { get; } - bool CanHandleContext(System.Web.HttpContextBase httpContext); - System.Web.WebPages.DisplayInfo GetDisplayInfo(System.Web.HttpContextBase httpContext, string virtualPath, System.Func virtualPathExists); - } - public partial interface ITemplateFile - { - System.Web.WebPages.TemplateFileInfo TemplateInfo { get; } - } - public partial interface IValidator - { - System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get; } - System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext); - } - public partial interface IVirtualPathFactory - { - object CreateInstance(string virtualPath); - bool Exists(string virtualPath); - } - public partial interface IWebPageRequestExecutor - { - bool Execute(System.Web.WebPages.WebPage page); - } - [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=true)] - public sealed partial class PageVirtualPathAttribute : System.Attribute - { - public PageVirtualPathAttribute(string virtualPath) { } - public string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public static partial class PreApplicationStartCode - { - public static void Start() { } - } - public static partial class RequestExtensions - { - public static bool IsUrlLocalToHost(this System.Web.HttpRequestBase request, string url) { throw null; } - } - public abstract partial class RequestFieldValidatorBase : System.Web.WebPages.IValidator - { - protected RequestFieldValidatorBase(string errorMessage) { } - protected RequestFieldValidatorBase(string errorMessage, bool useUnvalidatedValues) { } - public virtual System.Web.Mvc.ModelClientValidationRule ClientValidationRule { get { throw null; } } - protected static System.Web.HttpContextBase GetHttpContext(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - protected string GetRequestValue(System.Web.HttpRequestBase request, string field) { throw null; } - protected abstract bool IsValid(System.Web.HttpContextBase httpContext, string value); - public virtual System.ComponentModel.DataAnnotations.ValidationResult Validate(System.ComponentModel.DataAnnotations.ValidationContext validationContext) { throw null; } - } - public static partial class ResponseExtensions - { - public static void OutputCache(this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding=false, System.Collections.Generic.IEnumerable varyByParams=null, System.Collections.Generic.IEnumerable varyByHeaders=null, System.Collections.Generic.IEnumerable varyByContentEncodings=null, System.Web.HttpCacheability cacheability=(System.Web.HttpCacheability)(4)) { } - public static void SetStatus(this System.Web.HttpResponseBase response, int httpStatusCode) { } - public static void SetStatus(this System.Web.HttpResponseBase response, System.Net.HttpStatusCode httpStatusCode) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data) { } - public static void WriteBinary(this System.Web.HttpResponseBase response, byte[] data, string mimeType) { } - } - public delegate void SectionWriter(); - public abstract partial class StartPage : System.Web.WebPages.WebPageRenderingBase - { - protected StartPage() { } - public System.Web.WebPages.WebPageRenderingBase ChildPage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public override string Layout { get { throw null; } set { } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - public static System.Web.WebPages.WebPageRenderingBase GetStartPage(System.Web.WebPages.WebPageRenderingBase page, string fileName, System.Collections.Generic.IEnumerable supportedExtensions) { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public void RunPage() { } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public static partial class StringExtensions - { - public static bool AsBool(this string value) { throw null; } - public static bool AsBool(this string value, bool defaultValue) { throw null; } - public static System.DateTime AsDateTime(this string value) { throw null; } - public static System.DateTime AsDateTime(this string value, System.DateTime defaultValue) { throw null; } - public static decimal AsDecimal(this string value) { throw null; } - public static decimal AsDecimal(this string value, decimal defaultValue) { throw null; } - public static float AsFloat(this string value) { throw null; } - public static float AsFloat(this string value, float defaultValue) { throw null; } - public static int AsInt(this string value) { throw null; } - public static int AsInt(this string value, int defaultValue) { throw null; } - public static TValue As(this string value) { throw null; } - public static TValue As(this string value, TValue defaultValue) { throw null; } - public static bool IsBool(this string value) { throw null; } - public static bool IsDateTime(this string value) { throw null; } - public static bool IsDecimal(this string value) { throw null; } - public static bool IsEmpty(this string value) { throw null; } - public static bool IsFloat(this string value) { throw null; } - public static bool IsInt(this string value) { throw null; } - public static bool Is(this string value) { throw null; } - } - public partial class TemplateFileInfo - { - public TemplateFileInfo(string virtualPath) { } - public string VirtualPath { get { throw null; } } - } - public static partial class TemplateStack - { - public static System.Web.WebPages.ITemplateFile GetCurrentTemplate(System.Web.HttpContextBase httpContext) { throw null; } - public static System.Web.WebPages.ITemplateFile Pop(System.Web.HttpContextBase httpContext) { throw null; } - public static void Push(System.Web.HttpContextBase httpContext, System.Web.WebPages.ITemplateFile templateFile) { } - } - public sealed partial class ValidationHelper - { - internal ValidationHelper() { } - public string FormField { get { throw null; } } - public static string InvalidCssClass { get { throw null; } set { } } - public static string ValidCssClass { get { throw null; } set { } } - public void Add(System.Collections.Generic.IEnumerable fields, params System.Web.WebPages.IValidator[] validators) { } - public void Add(string field, params System.Web.WebPages.IValidator[] validators) { } - public void AddFormError(string errorMessage) { } - public System.Web.HtmlString ClassFor(string field) { throw null; } - public System.Web.HtmlString For(string field) { throw null; } - public System.Collections.Generic.IEnumerable GetErrors(params string[] fields) { throw null; } - public bool IsValid(params string[] fields) { throw null; } - public void RequireField(string field) { } - public void RequireField(string field, string errorMessage) { } - public void RequireFields(params string[] fields) { } - public System.Collections.Generic.IEnumerable Validate(params string[] fields) { throw null; } - } - public abstract partial class Validator - { - protected Validator() { } - public static System.Web.WebPages.IValidator DateTime(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Decimal(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator EqualsTo(string otherFieldName, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Float(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Integer(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(double minValue, double maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Range(int minValue, int maxValue, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Regex(string pattern, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Required(string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator StringLength(int maxLength, int minLength=0, string errorMessage=null) { throw null; } - public static System.Web.WebPages.IValidator Url(string errorMessage=null) { throw null; } - } - public partial class VirtualPathFactoryManager : System.Web.WebPages.IVirtualPathFactory - { - internal VirtualPathFactoryManager() { } - public object CreateInstance(string virtualPath) { throw null; } - public bool Exists(string virtualPath) { throw null; } - public static void RegisterVirtualPathFactory(System.Web.WebPages.IVirtualPathFactory virtualPathFactory) { } - } - public abstract partial class WebPage : System.Web.WebPages.WebPageBase - { - protected WebPage() { } - public override System.Web.HttpContextBase Context { get { throw null; } set { } } - public System.Web.WebPages.Html.HtmlHelper Html { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public dynamic Model { get { throw null; } } - public System.Web.WebPages.Html.ModelStateDictionary ModelState { get { throw null; } } - public System.Web.WebPages.ValidationHelper Validation { get { throw null; } } - public override void ExecutePageHierarchy() { } - protected override void InitializePage() { } - public static void RegisterPageExecutor(System.Web.WebPages.IWebPageRequestExecutor executor) { } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - } - public abstract partial class WebPageBase : System.Web.WebPages.WebPageRenderingBase - { - protected WebPageBase() { } - public override string Layout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public System.IO.TextWriter Output { get { throw null; } } - public System.Collections.Generic.Stack OutputStack { get { throw null; } } - public override dynamic Page { get { throw null; } } - public override System.Collections.Generic.IDictionary PageData { get { throw null; } } - protected virtual void ConfigurePage(System.Web.WebPages.WebPageBase parentPage) { } - public static System.Web.WebPages.WebPageBase CreateInstanceFromVirtualPath(string virtualPath) { throw null; } - public void DefineSection(string name, System.Web.WebPages.SectionWriter action) { } - public override void ExecutePageHierarchy() { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public void ExecutePageHierarchy(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer, System.Web.WebPages.WebPageRenderingBase startPage) { } - protected internal override System.IO.TextWriter GetOutputWriter() { throw null; } - protected virtual void InitializePage() { } - public bool IsSectionDefined(string name) { throw null; } - public void PopContext() { } - public void PushContext(System.Web.WebPages.WebPageContext pageContext, System.IO.TextWriter writer) { } - public System.Web.WebPages.HelperResult RenderBody() { throw null; } - public override System.Web.WebPages.HelperResult RenderPage(string path, params object[] data) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name) { throw null; } - public System.Web.WebPages.HelperResult RenderSection(string name, bool required) { throw null; } - public override void Write(object value) { } - public override void Write(System.Web.WebPages.HelperResult result) { } - public override void WriteLiteral(object value) { } - } - public partial class WebPageContext - { - public WebPageContext() { } - public WebPageContext(System.Web.HttpContextBase context, System.Web.WebPages.WebPageRenderingBase page, object model) { } - public static System.Web.WebPages.WebPageContext Current { get { throw null; } } - public object Model { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Web.WebPages.WebPageRenderingBase Page { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary PageData { get { throw null; } } - } - public abstract partial class WebPageExecutingBase - { - protected WebPageExecutingBase() { } - public virtual dynamic App { get { throw null; } } - public virtual System.Web.HttpApplicationStateBase AppState { get { throw null; } } - public virtual System.Web.HttpContextBase Context { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual string VirtualPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public virtual System.Web.WebPages.IVirtualPathFactory VirtualPathFactory { get { throw null; } set { } } - protected internal void BeginContext(int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void BeginContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(System.IO.TextWriter writer, string virtualPath, int startPosition, int length, bool isLiteral) { } - protected internal void EndContext(string virtualPath, int startPosition, int length, bool isLiteral) { } - [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - public abstract void Execute(); - protected internal virtual System.IO.TextWriter GetOutputWriter() { throw null; } - public virtual string Href(string path, params object[] pathParts) { throw null; } - public virtual string NormalizePath(string path) { throw null; } - public abstract void Write(object value); - public abstract void Write(System.Web.WebPages.HelperResult result); - public virtual void WriteAttribute(string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public virtual void WriteAttributeTo(System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - protected internal virtual void WriteAttributeTo(string pageVirtualPath, System.IO.TextWriter writer, string name, System.Web.WebPages.Instrumentation.PositionTagged prefix, System.Web.WebPages.Instrumentation.PositionTagged suffix, params System.Web.WebPages.AttributeValue[] values) { } - public abstract void WriteLiteral(object value); - public static void WriteLiteralTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, object content) { } - public static void WriteTo(System.IO.TextWriter writer, System.Web.WebPages.HelperResult content) { } - } - public partial class WebPageHttpHandler : System.Web.IHttpHandler, System.Web.SessionState.IRequiresSessionState - { - public static readonly string WebPagesVersionHeaderName; - public WebPageHttpHandler(System.Web.WebPages.WebPage webPage) { } - public static bool DisableWebPagesResponseHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public virtual bool IsReusable { get { throw null; } } - public static System.Web.IHttpHandler CreateFromVirtualPath(string virtualPath) { throw null; } - public static System.Collections.ObjectModel.ReadOnlyCollection GetRegisteredExtensions() { throw null; } - public virtual void ProcessRequest(System.Web.HttpContext context) { } - public static void RegisterExtension(string extension) { } - } - public abstract partial class WebPageRenderingBase : System.Web.WebPages.WebPageExecutingBase, System.Web.WebPages.ITemplateFile - { - protected WebPageRenderingBase() { } - public virtual System.Web.Caching.Cache Cache { get { throw null; } } - public string Culture { get { throw null; } set { } } - protected internal System.Web.WebPages.IDisplayMode DisplayMode { get { throw null; } } - public virtual bool IsAjax { get { throw null; } } - public virtual bool IsPost { get { throw null; } } - public abstract string Layout { get; set; } - public abstract dynamic Page { get; } - public System.Web.WebPages.WebPageContext PageContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public abstract System.Collections.Generic.IDictionary PageData { get; } - public System.Web.Profile.ProfileBase Profile { get { throw null; } } - public virtual System.Web.HttpRequestBase Request { get { throw null; } } - public virtual System.Web.HttpResponseBase Response { get { throw null; } } - public virtual System.Web.HttpServerUtilityBase Server { get { throw null; } } - public virtual System.Web.HttpSessionStateBase Session { get { throw null; } } - public virtual System.Web.WebPages.TemplateFileInfo TemplateInfo { get { throw null; } } - public string UICulture { get { throw null; } set { } } - public virtual System.Collections.Generic.IList UrlData { get { throw null; } } - public virtual System.Security.Principal.IPrincipal User { get { throw null; } } - public abstract void ExecutePageHierarchy(); - public abstract System.Web.WebPages.HelperResult RenderPage(string path, params object[] data); - } -} -namespace System.Web.WebPages.Html -{ - public partial class HtmlHelper - { - internal HtmlHelper() { } - public static string IdAttributeDotReplacement { get { throw null; } set { } } - public static bool UnobtrusiveJavaScriptEnabled { get { throw null; } set { } } - public static string ValidationInputCssClassName { get { throw null; } set { } } - public static string ValidationInputValidCssClassName { get { throw null; } set { } } - public static string ValidationMessageCssClassName { get { throw null; } set { } } - public static string ValidationMessageValidCssClassName { get { throw null; } set { } } - public static string ValidationSummaryClass { get { throw null; } set { } } - public static string ValidationSummaryValidClass { get { throw null; } set { } } - public string AttributeEncode(object value) { throw null; } - public string AttributeEncode(string value) { throw null; } - public System.Web.IHtmlString CheckBox(string name) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString CheckBox(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString DropDownList(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValue, object htmlAttributes) { throw null; } - public string Encode(object value) { throw null; } - public string Encode(string value) { throw null; } - public System.Web.IHtmlString Hidden(string name) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Hidden(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Label(string labelText) { throw null; } - public System.Web.IHtmlString Label(string labelText, object attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, System.Collections.Generic.IDictionary attributes) { throw null; } - public System.Web.IHtmlString Label(string labelText, string labelFor, object attributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, int size, bool allowMultiple, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ListBox(string name, string defaultOption, System.Collections.Generic.IEnumerable selectList, object selectedValues, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name) { throw null; } - public System.Web.IHtmlString Password(string name, object value) { throw null; } - public System.Web.IHtmlString Password(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString Password(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, bool isChecked, object htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString RadioButton(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString Raw(object value) { throw null; } - public System.Web.IHtmlString Raw(string value) { throw null; } - public System.Web.IHtmlString TextArea(string name) { throw null; } - public System.Web.IHtmlString TextArea(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextArea(string name, string value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString TextBox(string name, object value, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationMessage(string name, string message, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary() { throw null; } - public System.Web.IHtmlString ValidationSummary(bool excludeFieldErrors) { throw null; } - public System.Web.IHtmlString ValidationSummary(System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, bool excludeFieldErrors, object htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, System.Collections.Generic.IDictionary htmlAttributes) { throw null; } - public System.Web.IHtmlString ValidationSummary(string message, object htmlAttributes) { throw null; } - } - public partial class ModelState - { - public ModelState() { } - public System.Collections.Generic.IList Errors { get { throw null; } } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class ModelStateDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ModelStateDictionary() { } - public ModelStateDictionary(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public int Count { get { throw null; } } - public bool IsReadOnly { get { throw null; } } - public bool IsValid { get { throw null; } } - public System.Web.WebPages.Html.ModelState this[string key] { get { throw null; } set { } } - public System.Collections.Generic.ICollection Keys { get { throw null; } } - public System.Collections.Generic.ICollection Values { get { throw null; } } - public void Add(System.Collections.Generic.KeyValuePair item) { } - public void Add(string key, System.Web.WebPages.Html.ModelState value) { } - public void AddError(string key, string errorMessage) { } - public void AddFormError(string errorMessage) { } - public void Clear() { } - public bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool ContainsKey(string key) { throw null; } - public void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - public bool IsValidField(string key) { throw null; } - public void Merge(System.Web.WebPages.Html.ModelStateDictionary dictionary) { } - public bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public bool Remove(string key) { throw null; } - public void SetModelValue(string key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string key, out System.Web.WebPages.Html.ModelState value) { value = default(System.Web.WebPages.Html.ModelState); throw null; } - } - public partial class SelectListItem - { - public SelectListItem() { } - public SelectListItem(System.Web.WebPages.Html.SelectListItem item) { } - public bool Selected { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Text { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } -} -namespace System.Web.WebPages.Instrumentation -{ - public partial class InstrumentationService - { - public InstrumentationService() { } - public bool IsAvailable { get { throw null; } } - public void BeginContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - public void EndContext(System.Web.HttpContextBase context, string virtualPath, System.IO.TextWriter writer, int startPosition, int length, bool isLiteral) { } - } - [System.Diagnostics.DebuggerDisplayAttribute("({Position})\"{Value}\"")] - public partial class PositionTagged - { - public PositionTagged(T value, int offset) { } - public int Position { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public T Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public override bool Equals(object obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public static implicit operator System.Web.WebPages.Instrumentation.PositionTagged (System.Tuple value) { throw null; } - public static implicit operator T (System.Web.WebPages.Instrumentation.PositionTagged value) { throw null; } - public static bool operator !=(System.Web.WebPages.Instrumentation.PositionTagged left, System.Web.WebPages.Instrumentation.PositionTagged right) { throw null; } - public override string ToString() { throw null; } - } -} -namespace System.Web.WebPages.Scope -{ - public partial class AspNetRequestScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public AspNetRequestScopeStorageProvider() { } - public System.Collections.Generic.IDictionary ApplicationScope { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public System.Collections.Generic.IDictionary RequestScope { get { throw null; } } - } - public partial interface IScopeStorageProvider - { - System.Collections.Generic.IDictionary CurrentScope { get; set; } - System.Collections.Generic.IDictionary GlobalScope { get; } - } - public static partial class ScopeStorage - { - public static System.Web.WebPages.Scope.IScopeStorageProvider CurrentProvider { get { throw null; } set { } } - public static System.Collections.Generic.IDictionary CurrentScope { get { throw null; } } - public static System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - public static System.IDisposable CreateTransientScope() { throw null; } - public static System.IDisposable CreateTransientScope(System.Collections.Generic.IDictionary context) { throw null; } - } - public partial class ScopeStorageDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable - { - public ScopeStorageDictionary() { } - public ScopeStorageDictionary(System.Collections.Generic.IDictionary baseScope) { } - protected System.Collections.Generic.IDictionary BackingStore { get { throw null; } } - protected System.Collections.Generic.IDictionary BaseScope { get { throw null; } } - public virtual int Count { get { throw null; } } - public virtual bool IsReadOnly { get { throw null; } } - public object this[object key] { get { throw null; } set { } } - public virtual System.Collections.Generic.ICollection Keys { get { throw null; } } - public virtual System.Collections.Generic.ICollection Values { get { throw null; } } - public virtual void Add(System.Collections.Generic.KeyValuePair item) { } - public virtual void Add(object key, object value) { } - public virtual void Clear() { } - public virtual bool Contains(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool ContainsKey(object key) { throw null; } - public virtual void CopyTo(System.Collections.Generic.KeyValuePair[] array, int arrayIndex) { } - public virtual System.Collections.Generic.IEnumerator> GetEnumerator() { throw null; } - protected virtual System.Collections.Generic.IEnumerable> GetItems() { throw null; } - public virtual bool Remove(System.Collections.Generic.KeyValuePair item) { throw null; } - public virtual bool Remove(object key) { throw null; } - public virtual void SetValue(object key, object value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public virtual bool TryGetValue(object key, out object value) { value = default(object); throw null; } - } - public partial class StaticScopeStorageProvider : System.Web.WebPages.Scope.IScopeStorageProvider - { - public StaticScopeStorageProvider() { } - public System.Collections.Generic.IDictionary CurrentScope { get { throw null; } set { } } - public System.Collections.Generic.IDictionary GlobalScope { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/src/v4.7/cscompmgd.cs b/external/binary-reference-assemblies/src/v4.7/cscompmgd.cs deleted file mode 100644 index 1785b32f39..0000000000 --- a/external/binary-reference-assemblies/src/v4.7/cscompmgd.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] -[assembly:System.CLSCompliantAttribute(true)] -[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] -[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] -[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] -[assembly:System.Reflection.AssemblyDefaultAliasAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyDescriptionAttribute("cscompmgd.dll")] -[assembly:System.Reflection.AssemblyFileVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyInformationalVersionAttribute("11.0.0.0")] -[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] -[assembly:System.Reflection.AssemblyTitleAttribute("cscompmgd.dll")] -[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] -[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] -[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute((System.Runtime.CompilerServices.CompilationRelaxations)(8))] -[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] -[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] -[assembly:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(0), (System.Runtime.ConstrainedExecution.Cer)(0))] -[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] -namespace Microsoft.CSharp -{ - [System.ObsoleteAttribute] - public partial class Compiler - { - internal Compiler() { } - [System.MonoTODOAttribute("Have not implemented bugreports")] - public static Microsoft.CSharp.CompilerError[] Compile(string[] sourceTexts, string[] sourceTextNames, string target, string[] imports, System.Collections.IDictionary options) { throw null; } - } - [System.ObsoleteAttribute] - public partial class CompilerError - { - public Microsoft.CSharp.ErrorLevel ErrorLevel; - public string ErrorMessage; - public int ErrorNumber; - public int SourceColumn; - public string SourceFile; - public int SourceLine; - public CompilerError() { } - public override string ToString() { throw null; } - } - [System.ObsoleteAttribute] - public enum ErrorLevel - { - Error = 2, - FatalError = 3, - None = 0, - Warning = 1, - } -} -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} diff --git a/external/binary-reference-assemblies/v2.0/Makefile b/external/binary-reference-assemblies/v2.0/Makefile index 00fccf7378..cc9e74ff20 100644 --- a/external/binary-reference-assemblies/v2.0/Makefile +++ b/external/binary-reference-assemblies/v2.0/Makefile @@ -13,12 +13,12 @@ ASSEMBLIES := Accessibility CustomMarshalers \ System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.Design System.DirectoryServices.Protocols System.DirectoryServices \ System.Drawing.Design System.Drawing System.EnterpriseServices System.IdentityModel.Selectors \ - System.IdentityModel System.Json System.Management System.Messaging System.Net System.Runtime.Remoting \ + System.IdentityModel System.Management System.Messaging System.Net System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security \ System.ServiceModel.Web System.ServiceModel System.ServiceProcess System.Transactions \ System.Web.Abstractions System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Mvc System.Web.Routing System.Web.Services System.Web System.Windows.Forms \ - System.Xml.Linq System.Xml System WindowsBase cscompmgd mscorlib + System.Web.Routing System.Web.Services System.Web System.Windows.Forms \ + System.Xml.Linq System.Xml System WindowsBase mscorlib ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.Web @@ -50,7 +50,6 @@ System.Drawing_REFS := mscorlib System System.EnterpriseServices_REFS := mscorlib System.Transactions System.IdentityModel.Selectors_REFS := System.Xml mscorlib System System.IdentityModel System.IdentityModel_REFS := mscorlib System System.Web System.Xml System.Runtime.Serialization System.Security -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Configuration.Install System.Xml System.Windows.Forms System.Drawing System.Net_REFS := mscorlib System @@ -66,7 +65,6 @@ System.Web.Abstractions_REFS := System.Web mscorlib System System.Web.DynamicData_REFS := mscorlib System.Core System.Data.Linq System System.Web System.Web.Extensions System.Web.Routing System.ComponentModel.DataAnnotations System.Drawing System.Web.Abstractions System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions_REFS := mscorlib System.Core System System.Web System.Configuration System.Web.Services System.Xml System.ServiceModel System.Data.Linq System.Drawing -System.Web.Mvc_REFS := mscorlib System.Core System.Web.Abstractions System.Web.Routing System.Web System.ComponentModel.DataAnnotations System System.Web.Extensions System.Data.Linq System.Xml System.Web.Routing_REFS := mscorlib System.Web.Abstractions System System.Core System.Web System.Web.Services_REFS := System.EnterpriseServices bare/System.Web System.Configuration mscorlib System System.Xml System.Web_REFS := mscorlib System.Drawing System System.Xml System.Core System.Configuration System.Data System.Runtime.Serialization.Formatters.Soap System.Web.Services System.EnterpriseServices @@ -75,7 +73,6 @@ System.Xml.Linq_REFS := mscorlib System.Xml System.Runtime.Serialization System. System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := System mscorlib System.Xml -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -98,16 +95,16 @@ ECMA_KEY_ASSEMBLIES := System.Core System.Data.DataSetExtensions System.Data.Lin System.IdentityModel System.Net System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel \ System.Transactions System.Windows.Forms System.Xml.Linq System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations System.Json System.ServiceModel.Web \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations System.ServiceModel.Web \ System.Web.Abstractions System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Mvc System.Web.Routing WindowsBase + System.Web.Routing WindowsBase MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ Microsoft.Build.Tasks Microsoft.Build.Utilities Microsoft.VisualC Microsoft.VisualBasic \ System.Configuration.Install System.Configuration System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.EnterpriseServices System.Management \ System.Messaging System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess \ - System.Web.Services System.Web cscompmgd bare/System.Configuration bare/System.Web + System.Web.Services System.Web bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v2.0/System.Json.dll b/external/binary-reference-assemblies/v2.0/System.Json.dll deleted file mode 100644 index d70ae3f187..0000000000 Binary files a/external/binary-reference-assemblies/v2.0/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v2.0/System.Web.Mvc.dll b/external/binary-reference-assemblies/v2.0/System.Web.Mvc.dll deleted file mode 100644 index 99a27b74f2..0000000000 Binary files a/external/binary-reference-assemblies/v2.0/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v2.0/cscompmgd.dll b/external/binary-reference-assemblies/v2.0/cscompmgd.dll deleted file mode 100644 index 4330a83519..0000000000 Binary files a/external/binary-reference-assemblies/v2.0/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.0/Makefile b/external/binary-reference-assemblies/v4.0/Makefile index 0e2c300c9b..dbac63b29b 100644 --- a/external/binary-reference-assemblies/v4.0/Makefile +++ b/external/binary-reference-assemblies/v4.0/Makefile @@ -7,20 +7,20 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ - System.IdentityModel.Selectors System.IdentityModel System.Json.Microsoft System.Json System.Management System.Messaging \ + System.IdentityModel.Selectors System.IdentityModel System.Management System.Messaging \ System.Net System.Numerics System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Routing System.ServiceModel.Web \ System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ System.Web.Routing System.Web.Services System.Web System.Windows.Forms.DataVisualization System.Windows.Forms System.Xaml System.Xml.Linq \ - System.Xml System WindowsBase cscompmgd mscorlib + System.Xml System WindowsBase mscorlib ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -36,7 +36,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System System.Xml Sys Microsoft.CSharp_REFS := mscorlib System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := System.Web mscorlib System System.ComponentModel.Composition_REFS := mscorlib System.Core System System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -57,8 +56,6 @@ System.Dynamic_REFS := mscorlib System.Core System System.EnterpriseServices_REFS := mscorlib System.Transactions System.IdentityModel.Selectors_REFS := System.Xml mscorlib System System.IdentityModel System.IdentityModel_REFS := mscorlib System System.Web.ApplicationServices System.Xml System.Runtime.Serialization System.Security -System.Json.Microsoft_REFS := System.Core mscorlib System System.Runtime.Serialization System.Xml -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Configuration.Install System.Xml System.Windows.Forms System.Drawing System.Net_REFS := mscorlib System @@ -91,7 +88,6 @@ System.Xml.Linq_REFS := mscorlib System.Xml System.Core System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System System.Xml System.Xaml -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -118,8 +114,8 @@ ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ + System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ System.Web.Extensions.Design System.Web.Extensions System.Web.Routing \ System.Windows.Forms.DataVisualization WindowsBase bare/System.ServiceModel.Activation @@ -130,7 +126,7 @@ MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine System.DirectoryServices System.Drawing.Design System.Drawing System.EnterpriseServices System.Management \ System.Messaging System.Net System.Runtime.Caching \ System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web cscompmgd bare/System.Configuration bare/System.Web + System.Web bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.0/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.0/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 207b1d0b09..0000000000 Binary files a/external/binary-reference-assemblies/v4.0/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.0/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.0/System.Json.Microsoft.dll deleted file mode 100644 index 617e5ee028..0000000000 Binary files a/external/binary-reference-assemblies/v4.0/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.0/System.Json.dll b/external/binary-reference-assemblies/v4.0/System.Json.dll deleted file mode 100644 index 005109ba40..0000000000 Binary files a/external/binary-reference-assemblies/v4.0/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.0/cscompmgd.dll b/external/binary-reference-assemblies/v4.0/cscompmgd.dll deleted file mode 100644 index ad41ac0119..0000000000 Binary files a/external/binary-reference-assemblies/v4.0/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/Makefile b/external/binary-reference-assemblies/v4.5.1/Makefile index a19ce9eef2..c046c808fa 100644 --- a/external/binary-reference-assemblies/v4.5.1/Makefile +++ b/external/binary-reference-assemblies/v4.5.1/Makefile @@ -7,26 +7,23 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib + System.Xml.Serialization System.Xml System WindowsBase mscorlib ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -62,8 +59,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -87,26 +82,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration System.Runtime.DurableInstancing_REFS := mscorlib System.Xml.Linq System.ServiceModel.Internals System.Transactions System.Core System.Runtime.Serialization System System.Runtime.Remoting_REFS := mscorlib System System.Web System.Xml System.Runtime.Serialization.Formatters.Soap @@ -120,23 +101,14 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -147,7 +119,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -218,22 +189,19 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ @@ -242,7 +210,7 @@ MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.5.1/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.5.1/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 35c427cdca..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.5.1/SMDiagnostics.dll deleted file mode 100644 index c72730fa64..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.5.1/System.Json.Microsoft.dll deleted file mode 100644 index 8efbc3731c..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Json.dll b/external/binary-reference-assemblies/v4.5.1/System.Json.dll deleted file mode 100644 index e25b69c9ff..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.5.1/System.Net.Http.Formatting.dll deleted file mode 100644 index 096dfcd331..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Core.dll deleted file mode 100644 index 8d960e6179..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Debugger.dll deleted file mode 100644 index c60dd57ef7..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Debugger.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Experimental.dll deleted file mode 100644 index de121d377d..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Interfaces.dll deleted file mode 100644 index 3187e6809b..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Interfaces.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Linq.dll deleted file mode 100644 index 5f1c6ba9bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Observable.Aliases.dll deleted file mode 100644 index 9bc9eed8e1..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Observable.Aliases.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.PlatformServices.dll deleted file mode 100644 index 6902587208..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.PlatformServices.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Providers.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Providers.dll deleted file mode 100644 index 85db123663..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Providers.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Runtime.Remoting.dll deleted file mode 100644 index 26b7c39315..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Runtime.Remoting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Windows.Forms.dll deleted file mode 100644 index 3587bd8bd3..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Windows.Forms.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/v4.5.1/System.Reactive.Windows.Threading.dll deleted file mode 100644 index af612e062a..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Reactive.Windows.Threading.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/v4.5.1/System.Threading.Tasks.Dataflow.dll deleted file mode 100644 index 8356d5044e..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Threading.Tasks.Dataflow.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.Http.SelfHost.dll deleted file mode 100644 index 7698cf4c85..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.Http.WebHost.dll deleted file mode 100644 index 67b4315a6f..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.Http.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.Http.dll deleted file mode 100644 index 4b012c937e..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.Mvc.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.Mvc.dll deleted file mode 100644 index 3d1b4daf2d..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.Razor.dll deleted file mode 100644 index 1f6752418a..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.Deployment.dll deleted file mode 100644 index 4d7208021b..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.Razor.dll deleted file mode 100644 index 36b03f45e0..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.dll deleted file mode 100644 index 8bd4b18e76..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.1/cscompmgd.dll b/external/binary-reference-assemblies/v4.5.1/cscompmgd.dll deleted file mode 100644 index 44a168aacc..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.1/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/Makefile b/external/binary-reference-assemblies/v4.5.2/Makefile index 4ce2f24ab1..ecc2cacc1a 100644 --- a/external/binary-reference-assemblies/v4.5.2/Makefile +++ b/external/binary-reference-assemblies/v4.5.2/Makefile @@ -7,26 +7,23 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib + System.Xml.Serialization System.Xml System WindowsBase mscorlib ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -62,8 +59,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -87,26 +82,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration System.Runtime.DurableInstancing_REFS := mscorlib System.Xml.Linq System.ServiceModel.Internals System.Transactions System.Core System.Runtime.Serialization System System.Runtime.Remoting_REFS := mscorlib System System.Web System.Xml System.Runtime.Serialization.Formatters.Soap @@ -120,23 +101,14 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -147,7 +119,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -218,22 +189,19 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ @@ -242,7 +210,7 @@ MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.5.2/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.5.2/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 35c427cdca..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.5.2/SMDiagnostics.dll deleted file mode 100644 index c72730fa64..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.5.2/System.Json.Microsoft.dll deleted file mode 100644 index 8efbc3731c..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Json.dll b/external/binary-reference-assemblies/v4.5.2/System.Json.dll deleted file mode 100644 index e25b69c9ff..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.5.2/System.Net.Http.Formatting.dll deleted file mode 100644 index 096dfcd331..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Core.dll deleted file mode 100644 index 8d960e6179..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Debugger.dll deleted file mode 100644 index c60dd57ef7..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Debugger.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Experimental.dll deleted file mode 100644 index de121d377d..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Interfaces.dll deleted file mode 100644 index 3187e6809b..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Interfaces.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Linq.dll deleted file mode 100644 index 5f1c6ba9bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Observable.Aliases.dll deleted file mode 100644 index 9bc9eed8e1..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Observable.Aliases.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.PlatformServices.dll deleted file mode 100644 index 6902587208..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.PlatformServices.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Providers.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Providers.dll deleted file mode 100644 index 85db123663..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Providers.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Runtime.Remoting.dll deleted file mode 100644 index 26b7c39315..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Runtime.Remoting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Windows.Forms.dll deleted file mode 100644 index 3587bd8bd3..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Windows.Forms.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/v4.5.2/System.Reactive.Windows.Threading.dll deleted file mode 100644 index af612e062a..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Reactive.Windows.Threading.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/v4.5.2/System.Threading.Tasks.Dataflow.dll deleted file mode 100644 index 8356d5044e..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Threading.Tasks.Dataflow.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.Http.SelfHost.dll deleted file mode 100644 index 7698cf4c85..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.Http.WebHost.dll deleted file mode 100644 index 67b4315a6f..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.Http.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.Http.dll deleted file mode 100644 index 4b012c937e..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.Mvc.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.Mvc.dll deleted file mode 100644 index 3d1b4daf2d..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.Razor.dll deleted file mode 100644 index 1f6752418a..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.Deployment.dll deleted file mode 100644 index 4d7208021b..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.Razor.dll deleted file mode 100644 index 36b03f45e0..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.dll deleted file mode 100644 index 8bd4b18e76..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5.2/cscompmgd.dll b/external/binary-reference-assemblies/v4.5.2/cscompmgd.dll deleted file mode 100644 index 44a168aacc..0000000000 Binary files a/external/binary-reference-assemblies/v4.5.2/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/Makefile b/external/binary-reference-assemblies/v4.5/Makefile index 884a3f7b8e..af63664ffb 100644 --- a/external/binary-reference-assemblies/v4.5/Makefile +++ b/external/binary-reference-assemblies/v4.5/Makefile @@ -7,26 +7,23 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib + System.Xml.Serialization System.Xml System WindowsBase mscorlib ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -62,8 +59,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -87,26 +82,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration System.Runtime.DurableInstancing_REFS := mscorlib System.Xml.Linq System.ServiceModel.Internals System.Transactions System.Core System.Runtime.Serialization System System.Runtime.Remoting_REFS := mscorlib System System.Web System.Xml System.Runtime.Serialization.Formatters.Soap @@ -120,23 +101,14 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -147,7 +119,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -218,22 +189,19 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ @@ -242,7 +210,7 @@ MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.5/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.5/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 35c427cdca..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.5/SMDiagnostics.dll deleted file mode 100644 index c72730fa64..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.5/System.Json.Microsoft.dll deleted file mode 100644 index 8efbc3731c..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Json.dll b/external/binary-reference-assemblies/v4.5/System.Json.dll deleted file mode 100644 index e25b69c9ff..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.5/System.Net.Http.Formatting.dll deleted file mode 100644 index 096dfcd331..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Core.dll deleted file mode 100644 index 8d960e6179..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Debugger.dll deleted file mode 100644 index c60dd57ef7..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Debugger.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Experimental.dll deleted file mode 100644 index de121d377d..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Interfaces.dll deleted file mode 100644 index 3187e6809b..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Interfaces.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Linq.dll deleted file mode 100644 index 5f1c6ba9bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Observable.Aliases.dll deleted file mode 100644 index 9bc9eed8e1..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Observable.Aliases.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.PlatformServices.dll deleted file mode 100644 index 6902587208..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.PlatformServices.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Providers.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Providers.dll deleted file mode 100644 index 85db123663..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Providers.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Runtime.Remoting.dll deleted file mode 100644 index 26b7c39315..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Runtime.Remoting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Windows.Forms.dll deleted file mode 100644 index 3587bd8bd3..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Windows.Forms.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/v4.5/System.Reactive.Windows.Threading.dll deleted file mode 100644 index af612e062a..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Reactive.Windows.Threading.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/v4.5/System.Threading.Tasks.Dataflow.dll deleted file mode 100644 index 8356d5044e..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Threading.Tasks.Dataflow.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.5/System.Web.Http.SelfHost.dll deleted file mode 100644 index 7698cf4c85..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.5/System.Web.Http.WebHost.dll deleted file mode 100644 index 67b4315a6f..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.Http.dll b/external/binary-reference-assemblies/v4.5/System.Web.Http.dll deleted file mode 100644 index 4b012c937e..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.Mvc.dll b/external/binary-reference-assemblies/v4.5/System.Web.Mvc.dll deleted file mode 100644 index 3d1b4daf2d..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.5/System.Web.Razor.dll deleted file mode 100644 index 1f6752418a..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.5/System.Web.WebPages.Deployment.dll deleted file mode 100644 index 4d7208021b..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.5/System.Web.WebPages.Razor.dll deleted file mode 100644 index 36b03f45e0..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.5/System.Web.WebPages.dll deleted file mode 100644 index 8bd4b18e76..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.5/cscompmgd.dll b/external/binary-reference-assemblies/v4.5/cscompmgd.dll deleted file mode 100644 index 44a168aacc..0000000000 Binary files a/external/binary-reference-assemblies/v4.5/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/Makefile b/external/binary-reference-assemblies/v4.6.1/Makefile index afd0dc9c5d..d0a2995801 100644 --- a/external/binary-reference-assemblies/v4.6.1/Makefile +++ b/external/binary-reference-assemblies/v4.6.1/Makefile @@ -7,27 +7,24 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib \ - System.Deployment System.Numerics.Vectors System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ + System.Xml.Serialization System.Xml System WindowsBase mscorlib \ + System.Deployment System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ System.Web.Mobile System.Web.RegularExpressions System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -65,8 +62,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -91,27 +86,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System -System.Numerics.Vectors_REFS := mscorlib System.Numerics System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Reflection.Context_REFS := mscorlib System.Reflection.Metadata_REFS := System.Runtime System.Resources.ResourceManager System.Collections.Immutable System.Reflection.Primitives System.Diagnostics.Debug System.Collections System.IO System.IO.Compression System.Text.Encoding System.Runtime.InteropServices System.Linq System.Reflection System.Threading System.Runtime.Extensions System.Text.Encoding.Extensions System.Reflection.Extensions System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration @@ -128,25 +108,16 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq System.Web.Mobile_REFS := mscorlib -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.RegularExpressions_REFS := mscorlib System System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -160,7 +131,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -234,31 +204,28 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Reflection.Context System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ Microsoft.Build.Tasks.v4.0 Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ System.Configuration.Install System.Configuration System.Deployment System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ - System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics.Vectors System.Runtime.Caching \ + System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.InteropServices.RuntimeInformation System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.6.1/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.6.1/SMDiagnostics.dll deleted file mode 100644 index 4ba5630dcc..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.6.1/System.Json.Microsoft.dll deleted file mode 100644 index 496df2eb66..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Json.dll b/external/binary-reference-assemblies/v4.6.1/System.Json.dll deleted file mode 100644 index 618a39c5a4..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.6.1/System.Net.Http.Formatting.dll deleted file mode 100644 index 2d6cd850bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Numerics.Vectors.dll b/external/binary-reference-assemblies/v4.6.1/System.Numerics.Vectors.dll deleted file mode 100644 index cb3bec6c6f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Numerics.Vectors.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.6.1/System.Reactive.Core.dll deleted file mode 100644 index 0364ab08f5..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.6.1/System.Reactive.Experimental.dll deleted file mode 100644 index a0403cb7ea..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.6.1/System.Reactive.Linq.dll deleted file mode 100644 index 07229f487c..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/v4.6.1/System.Threading.Tasks.Dataflow.dll deleted file mode 100644 index 823225c80f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Threading.Tasks.Dataflow.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.Http.SelfHost.dll deleted file mode 100644 index bc491f01ca..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.Http.WebHost.dll deleted file mode 100644 index 33ceea6fd6..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.Http.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.Http.dll deleted file mode 100644 index 4bde3d2b95..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.Razor.dll deleted file mode 100644 index 7de2614803..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.Deployment.dll deleted file mode 100644 index cd75e79e63..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.Razor.dll deleted file mode 100644 index 0a62e9f8fe..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.dll deleted file mode 100644 index b3e9d41b03..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.1/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/Makefile b/external/binary-reference-assemblies/v4.6.2/Makefile index 0719700017..fa702a13ba 100644 --- a/external/binary-reference-assemblies/v4.6.2/Makefile +++ b/external/binary-reference-assemblies/v4.6.2/Makefile @@ -7,27 +7,24 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib \ - System.Deployment System.Numerics.Vectors System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ + System.Xml.Serialization System.Xml System WindowsBase mscorlib \ + System.Deployment System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ System.Web.Mobile System.Web.RegularExpressions System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -65,8 +62,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -91,27 +86,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System -System.Numerics.Vectors_REFS := mscorlib System.Numerics System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Reflection.Context_REFS := mscorlib System.Reflection.Metadata_REFS := System.Runtime System.Resources.ResourceManager System.Collections.Immutable System.Reflection.Primitives System.Diagnostics.Debug System.Collections System.IO System.IO.Compression System.Text.Encoding System.Runtime.InteropServices System.Linq System.Reflection System.Threading System.Runtime.Extensions System.Text.Encoding.Extensions System.Reflection.Extensions System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration @@ -128,25 +108,16 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq System.Web.Mobile_REFS := mscorlib -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.RegularExpressions_REFS := mscorlib System System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -160,7 +131,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -234,31 +204,28 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Reflection.Context System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ Microsoft.Build.Tasks.v4.0 Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ System.Configuration.Install System.Configuration System.Deployment System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ - System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics.Vectors System.Runtime.Caching \ + System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.InteropServices.RuntimeInformation System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.6.2/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.6.2/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 35e35d2c85..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.6.2/SMDiagnostics.dll deleted file mode 100644 index 4ba5630dcc..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.6.2/System.Json.Microsoft.dll deleted file mode 100644 index 496df2eb66..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Json.dll b/external/binary-reference-assemblies/v4.6.2/System.Json.dll deleted file mode 100644 index 618a39c5a4..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.6.2/System.Net.Http.Formatting.dll deleted file mode 100644 index 2d6cd850bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Numerics.Vectors.dll b/external/binary-reference-assemblies/v4.6.2/System.Numerics.Vectors.dll deleted file mode 100644 index cb3bec6c6f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Numerics.Vectors.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Core.dll deleted file mode 100644 index 0364ab08f5..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Debugger.dll deleted file mode 100644 index 690723e00f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Debugger.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Experimental.dll deleted file mode 100644 index a0403cb7ea..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Interfaces.dll deleted file mode 100644 index d3ed5cc3d1..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Interfaces.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Linq.dll deleted file mode 100644 index 07229f487c..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Observable.Aliases.dll deleted file mode 100644 index 9cbf577ade..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Observable.Aliases.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.PlatformServices.dll deleted file mode 100644 index f869a70acb..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.PlatformServices.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Providers.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Providers.dll deleted file mode 100644 index 60802f307e..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Providers.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Runtime.Remoting.dll deleted file mode 100644 index 7b87308407..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Runtime.Remoting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Windows.Forms.dll deleted file mode 100644 index 00dcaee3b8..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Windows.Forms.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/v4.6.2/System.Reactive.Windows.Threading.dll deleted file mode 100644 index 749f4ab958..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Reactive.Windows.Threading.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/v4.6.2/System.Threading.Tasks.Dataflow.dll deleted file mode 100644 index 823225c80f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Threading.Tasks.Dataflow.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.Http.SelfHost.dll deleted file mode 100644 index bc491f01ca..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.Http.WebHost.dll deleted file mode 100644 index 33ceea6fd6..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.Http.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.Http.dll deleted file mode 100644 index 4bde3d2b95..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.Mvc.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.Mvc.dll deleted file mode 100644 index 4dcd718940..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.Razor.dll deleted file mode 100644 index 7de2614803..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.Deployment.dll deleted file mode 100644 index cd75e79e63..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.Razor.dll deleted file mode 100644 index 0a62e9f8fe..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.dll deleted file mode 100644 index b3e9d41b03..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6.2/cscompmgd.dll b/external/binary-reference-assemblies/v4.6.2/cscompmgd.dll deleted file mode 100644 index f87fcde104..0000000000 Binary files a/external/binary-reference-assemblies/v4.6.2/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/Makefile b/external/binary-reference-assemblies/v4.6/Makefile index 0f824237cb..9fb9639c4d 100644 --- a/external/binary-reference-assemblies/v4.6/Makefile +++ b/external/binary-reference-assemblies/v4.6/Makefile @@ -7,27 +7,24 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib \ - System.Deployment System.Numerics.Vectors System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ + System.Xml.Serialization System.Xml System WindowsBase mscorlib \ + System.Deployment System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ System.Web.Mobile System.Web.RegularExpressions System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -65,8 +62,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -91,27 +86,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System -System.Numerics.Vectors_REFS := mscorlib System.Numerics System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Reflection.Context_REFS := mscorlib System.Reflection.Metadata_REFS := System.Runtime System.Resources.ResourceManager System.Collections.Immutable System.Reflection.Primitives System.Diagnostics.Debug System.Collections System.IO System.IO.Compression System.Text.Encoding System.Runtime.InteropServices System.Linq System.Reflection System.Threading System.Runtime.Extensions System.Text.Encoding.Extensions System.Reflection.Extensions System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration @@ -128,25 +108,16 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq System.Web.Mobile_REFS := mscorlib -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.RegularExpressions_REFS := mscorlib System System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -160,7 +131,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -234,31 +204,28 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Reflection.Context System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ Microsoft.Build.Tasks.v4.0 Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ System.Configuration.Install System.Configuration System.Deployment System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ - System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics.Vectors System.Runtime.Caching \ + System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.InteropServices.RuntimeInformation System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.6/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.6/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 35e35d2c85..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.6/SMDiagnostics.dll deleted file mode 100644 index 4ba5630dcc..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Json.Microsoft.dll b/external/binary-reference-assemblies/v4.6/System.Json.Microsoft.dll deleted file mode 100644 index 496df2eb66..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Json.Microsoft.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Json.dll b/external/binary-reference-assemblies/v4.6/System.Json.dll deleted file mode 100644 index 618a39c5a4..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Json.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.6/System.Net.Http.Formatting.dll deleted file mode 100644 index 2d6cd850bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Numerics.Vectors.dll b/external/binary-reference-assemblies/v4.6/System.Numerics.Vectors.dll deleted file mode 100644 index cb3bec6c6f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Numerics.Vectors.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Core.dll deleted file mode 100644 index 0364ab08f5..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Debugger.dll deleted file mode 100644 index 690723e00f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Debugger.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Experimental.dll deleted file mode 100644 index a0403cb7ea..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Interfaces.dll deleted file mode 100644 index d3ed5cc3d1..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Interfaces.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Linq.dll deleted file mode 100644 index 07229f487c..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Observable.Aliases.dll deleted file mode 100644 index 9cbf577ade..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Observable.Aliases.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.PlatformServices.dll deleted file mode 100644 index f869a70acb..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.PlatformServices.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Providers.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Providers.dll deleted file mode 100644 index 60802f307e..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Providers.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Runtime.Remoting.dll deleted file mode 100644 index 7b87308407..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Runtime.Remoting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Windows.Forms.dll deleted file mode 100644 index 00dcaee3b8..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Windows.Forms.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/v4.6/System.Reactive.Windows.Threading.dll deleted file mode 100644 index 749f4ab958..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Reactive.Windows.Threading.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Threading.Tasks.Dataflow.dll b/external/binary-reference-assemblies/v4.6/System.Threading.Tasks.Dataflow.dll deleted file mode 100644 index 823225c80f..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Threading.Tasks.Dataflow.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.6/System.Web.Http.SelfHost.dll deleted file mode 100644 index bc491f01ca..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.6/System.Web.Http.WebHost.dll deleted file mode 100644 index 33ceea6fd6..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.Http.dll b/external/binary-reference-assemblies/v4.6/System.Web.Http.dll deleted file mode 100644 index 4bde3d2b95..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.Mvc.dll b/external/binary-reference-assemblies/v4.6/System.Web.Mvc.dll deleted file mode 100644 index 4dcd718940..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.6/System.Web.Razor.dll deleted file mode 100644 index 7de2614803..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.6/System.Web.WebPages.Deployment.dll deleted file mode 100644 index cd75e79e63..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.6/System.Web.WebPages.Razor.dll deleted file mode 100644 index 0a62e9f8fe..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.6/System.Web.WebPages.dll deleted file mode 100644 index b3e9d41b03..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.6/cscompmgd.dll b/external/binary-reference-assemblies/v4.6/cscompmgd.dll deleted file mode 100644 index f87fcde104..0000000000 Binary files a/external/binary-reference-assemblies/v4.6/cscompmgd.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7.1/Accessibility.dll b/external/binary-reference-assemblies/v4.7.1/Accessibility.dll new file mode 100644 index 0000000000..fdd9dd7a03 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Accessibility.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/CustomMarshalers.dll b/external/binary-reference-assemblies/v4.7.1/CustomMarshalers.dll new file mode 100644 index 0000000000..df1fbc2d9e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/CustomMarshalers.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/Microsoft.Win32.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/Microsoft.Win32.Primitives.dll new file mode 100644 index 0000000000..039021e216 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/Microsoft.Win32.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.AppContext.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.AppContext.dll new file mode 100644 index 0000000000..75531892c8 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.AppContext.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.Concurrent.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.Concurrent.dll new file mode 100644 index 0000000000..740e69c456 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.Concurrent.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.NonGeneric.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.NonGeneric.dll new file mode 100644 index 0000000000..0e7b010245 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.NonGeneric.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.Specialized.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.Specialized.dll new file mode 100644 index 0000000000..9aa69dd729 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.Specialized.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.dll new file mode 100644 index 0000000000..a0488d7ab1 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Collections.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.Annotations.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.Annotations.dll new file mode 100644 index 0000000000..0cd98a4dc7 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.Annotations.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.EventBasedAsync.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.EventBasedAsync.dll new file mode 100644 index 0000000000..9698ba7a45 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.EventBasedAsync.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.Primitives.dll new file mode 100644 index 0000000000..67a656dbac Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.TypeConverter.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.TypeConverter.dll new file mode 100644 index 0000000000..666ee021a7 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.TypeConverter.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.dll new file mode 100644 index 0000000000..9411a2db2e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ComponentModel.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Console.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Console.dll new file mode 100644 index 0000000000..e83ce8348e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Console.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Data.Common.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Data.Common.dll new file mode 100644 index 0000000000..f47118e383 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Data.Common.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Contracts.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Contracts.dll new file mode 100644 index 0000000000..21cf049f25 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Contracts.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Debug.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Debug.dll new file mode 100644 index 0000000000..2dd640e4ba Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Debug.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.FileVersionInfo.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.FileVersionInfo.dll new file mode 100644 index 0000000000..10951aa3bc Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.FileVersionInfo.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Process.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Process.dll new file mode 100644 index 0000000000..a16b21689b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Process.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.StackTrace.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.StackTrace.dll new file mode 100644 index 0000000000..c0b0a67fc2 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.StackTrace.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.TextWriterTraceListener.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.TextWriterTraceListener.dll new file mode 100644 index 0000000000..952993266d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.TextWriterTraceListener.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Tools.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Tools.dll new file mode 100644 index 0000000000..f2ca264e6c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.Tools.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.TraceSource.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.TraceSource.dll new file mode 100644 index 0000000000..138c7a086c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Diagnostics.TraceSource.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Drawing.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Drawing.Primitives.dll new file mode 100644 index 0000000000..8c4b7b055d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Drawing.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Dynamic.Runtime.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Dynamic.Runtime.dll new file mode 100644 index 0000000000..096ac6b57d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Dynamic.Runtime.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.Calendars.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.Calendars.dll new file mode 100644 index 0000000000..35f6c55c33 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.Calendars.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.Extensions.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.Extensions.dll new file mode 100644 index 0000000000..148f29490f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.Extensions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.dll new file mode 100644 index 0000000000..a289e20c8c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Globalization.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.Compression.ZipFile.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.Compression.ZipFile.dll new file mode 100644 index 0000000000..320c63573b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.Compression.ZipFile.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.DriveInfo.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.DriveInfo.dll new file mode 100644 index 0000000000..5a07fb935f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.DriveInfo.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.Primitives.dll new file mode 100644 index 0000000000..7cb4d59aa4 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.Watcher.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.Watcher.dll new file mode 100644 index 0000000000..ffdec01981 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.Watcher.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.dll new file mode 100644 index 0000000000..bdfcb20dad Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.FileSystem.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.IsolatedStorage.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.IsolatedStorage.dll new file mode 100644 index 0000000000..6e486a39c5 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.IsolatedStorage.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.MemoryMappedFiles.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.MemoryMappedFiles.dll new file mode 100644 index 0000000000..e781cecb33 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.MemoryMappedFiles.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.Pipes.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.Pipes.dll new file mode 100644 index 0000000000..ac5ab68d71 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.Pipes.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.UnmanagedMemoryStream.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.UnmanagedMemoryStream.dll new file mode 100644 index 0000000000..d594cd2496 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.UnmanagedMemoryStream.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.dll new file mode 100644 index 0000000000..51d14c0c21 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.IO.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Expressions.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Expressions.dll new file mode 100644 index 0000000000..7f3d26cf44 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Expressions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Parallel.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Parallel.dll new file mode 100644 index 0000000000..69e9d1cc21 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Parallel.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Queryable.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Queryable.dll new file mode 100644 index 0000000000..89f01631b0 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.Queryable.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.dll new file mode 100644 index 0000000000..5f09b136c3 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Linq.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Http.Rtc.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Http.Rtc.dll new file mode 100644 index 0000000000..bff69edf78 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Http.Rtc.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.NameResolution.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.NameResolution.dll new file mode 100644 index 0000000000..660597858f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.NameResolution.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.NetworkInformation.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.NetworkInformation.dll new file mode 100644 index 0000000000..54613a7d23 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.NetworkInformation.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Ping.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Ping.dll new file mode 100644 index 0000000000..c4ed4c78a5 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Ping.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Primitives.dll new file mode 100644 index 0000000000..ba690446b4 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Requests.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Requests.dll new file mode 100644 index 0000000000..60d568bb04 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Requests.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Security.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Security.dll new file mode 100644 index 0000000000..26fad4d1bf Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Security.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Sockets.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Sockets.dll new file mode 100644 index 0000000000..19d800df5f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.Sockets.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebHeaderCollection.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebHeaderCollection.dll new file mode 100644 index 0000000000..1e23b1277a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebHeaderCollection.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebSockets.Client.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebSockets.Client.dll new file mode 100644 index 0000000000..db980c25b5 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebSockets.Client.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebSockets.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebSockets.dll new file mode 100644 index 0000000000..19afd6dc3e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Net.WebSockets.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ObjectModel.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ObjectModel.dll new file mode 100644 index 0000000000..1521364984 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ObjectModel.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.ILGeneration.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.ILGeneration.dll new file mode 100644 index 0000000000..825ac9f9da Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.ILGeneration.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.Lightweight.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.Lightweight.dll new file mode 100644 index 0000000000..81645ca73a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.Lightweight.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.dll new file mode 100644 index 0000000000..bff404f6b3 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Emit.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Extensions.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Extensions.dll new file mode 100644 index 0000000000..597e2329e7 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Extensions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Primitives.dll new file mode 100644 index 0000000000..036ba14056 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.dll new file mode 100644 index 0000000000..28b7271a1b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Reflection.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.Reader.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.Reader.dll new file mode 100644 index 0000000000..03aafba688 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.Reader.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.ResourceManager.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.ResourceManager.dll new file mode 100644 index 0000000000..e85d5936cf Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.ResourceManager.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.Writer.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.Writer.dll new file mode 100644 index 0000000000..44c3f52b23 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Resources.Writer.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.CompilerServices.VisualC.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.CompilerServices.VisualC.dll new file mode 100644 index 0000000000..5d2718bfec Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.CompilerServices.VisualC.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Extensions.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Extensions.dll new file mode 100644 index 0000000000..420a4e23aa Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Extensions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Handles.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Handles.dll new file mode 100644 index 0000000000..a1329a11df Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Handles.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.RuntimeInformation.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.RuntimeInformation.dll new file mode 100644 index 0000000000..63c0ebba6a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.RuntimeInformation.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.WindowsRuntime.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.WindowsRuntime.dll new file mode 100644 index 0000000000..a19c875cc1 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.WindowsRuntime.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.dll new file mode 100644 index 0000000000..6f26ef5d01 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.InteropServices.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Numerics.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Numerics.dll new file mode 100644 index 0000000000..5a35cde264 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Numerics.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Formatters.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Formatters.dll new file mode 100644 index 0000000000..17473bfbde Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Formatters.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Json.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Json.dll new file mode 100644 index 0000000000..ff1c2d1949 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Json.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Primitives.dll new file mode 100644 index 0000000000..5f9337800a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Xml.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Xml.dll new file mode 100644 index 0000000000..b1de269b26 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.Serialization.Xml.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.dll new file mode 100644 index 0000000000..c19dfb8c4f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Runtime.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Claims.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Claims.dll new file mode 100644 index 0000000000..dfa3dc7151 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Claims.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Algorithms.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Algorithms.dll new file mode 100644 index 0000000000..a450894dd2 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Algorithms.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Csp.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Csp.dll new file mode 100644 index 0000000000..fc50076f69 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Csp.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Encoding.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Encoding.dll new file mode 100644 index 0000000000..8d361096ec Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Encoding.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Primitives.dll new file mode 100644 index 0000000000..e73dbb867d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.X509Certificates.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.X509Certificates.dll new file mode 100644 index 0000000000..d6c48b94b0 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Cryptography.X509Certificates.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Principal.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Principal.dll new file mode 100644 index 0000000000..0ce699a306 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.Principal.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.SecureString.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.SecureString.dll new file mode 100644 index 0000000000..1be31df5d1 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Security.SecureString.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Duplex.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Duplex.dll new file mode 100644 index 0000000000..02a3822c77 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Duplex.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Http.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Http.dll new file mode 100644 index 0000000000..c0b9a35586 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Http.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.NetTcp.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.NetTcp.dll new file mode 100644 index 0000000000..e6d044b69a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.NetTcp.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Primitives.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Primitives.dll new file mode 100644 index 0000000000..3b929e6cb1 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Primitives.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Security.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Security.dll new file mode 100644 index 0000000000..713a57a46b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ServiceModel.Security.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.Encoding.Extensions.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.Encoding.Extensions.dll new file mode 100644 index 0000000000..21b4b31814 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.Encoding.Extensions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.Encoding.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.Encoding.dll new file mode 100644 index 0000000000..6ca6b6e18b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.Encoding.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.RegularExpressions.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.RegularExpressions.dll new file mode 100644 index 0000000000..d4782b12ad Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Text.RegularExpressions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Overlapped.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Overlapped.dll new file mode 100644 index 0000000000..0aa46f31da Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Overlapped.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Tasks.Parallel.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Tasks.Parallel.dll new file mode 100644 index 0000000000..7e307d2783 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Tasks.Parallel.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Tasks.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Tasks.dll new file mode 100644 index 0000000000..98f5b19a50 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Tasks.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Thread.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Thread.dll new file mode 100644 index 0000000000..fc0d9e7d5a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Thread.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.ThreadPool.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.ThreadPool.dll new file mode 100644 index 0000000000..cf65185835 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.ThreadPool.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Timer.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Timer.dll new file mode 100644 index 0000000000..e13f5793bc Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.Timer.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.dll new file mode 100644 index 0000000000..30a56d7d82 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Threading.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.ValueTuple.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.ValueTuple.dll new file mode 100644 index 0000000000..1f3c3ab659 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.ValueTuple.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.ReaderWriter.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.ReaderWriter.dll new file mode 100644 index 0000000000..b5732517a5 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.ReaderWriter.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XDocument.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XDocument.dll new file mode 100644 index 0000000000..f7fece36ad Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XDocument.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XPath.XDocument.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XPath.XDocument.dll new file mode 100644 index 0000000000..852c93fd99 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XPath.XDocument.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XPath.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XPath.dll new file mode 100644 index 0000000000..8cce8c60b6 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XPath.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XmlDocument.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XmlDocument.dll new file mode 100644 index 0000000000..b1c87f87ec Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XmlDocument.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XmlSerializer.dll b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XmlSerializer.dll new file mode 100644 index 0000000000..19358e86ba Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/System.Xml.XmlSerializer.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Facades/netstandard.dll b/external/binary-reference-assemblies/v4.7.1/Facades/netstandard.dll new file mode 100644 index 0000000000..293b336228 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Facades/netstandard.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Makefile b/external/binary-reference-assemblies/v4.7.1/Makefile new file mode 100644 index 0000000000..47e22f78af --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/Makefile @@ -0,0 +1,316 @@ +PROFILE := v4.7.1 +SOURCEDIR := ../src/$(PROFILE)/ + +CSC ?= csc +CSC_COMMON_ARGS := -nologo -noconfig -optimize -nostdlib -unsafe -deterministic -publicsign -debug- -target:library -nowarn:612 -nowarn:618 +Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) + +ASSEMBLIES := Accessibility CustomMarshalers \ + Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ + System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ + System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ + System.Data.Services.Client System.Data.Services System.Data System.Design System.Diagnostics.Tracing System.DirectoryServices.Protocols \ + System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ + System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ + System.ServiceModel.Discovery System.ServiceModel.Routing System.ServiceModel.Web \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ + System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing System.Web.Services System.Web \ + System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ + System.Xml.Serialization System.Xml System WindowsBase mscorlib \ + System.Deployment System.Reflection.Context \ + System.Web.Mobile System.Web.RegularExpressions System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime + +ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web + +FACADE_ASSEMBLIES := Facades/Microsoft.Win32.Primitives Facades/System.AppContext Facades/System.Collections.Concurrent \ + Facades/System.Collections.NonGeneric Facades/System.Collections.Specialized Facades/System.Collections \ + Facades/System.ComponentModel.Annotations Facades/System.ComponentModel.EventBasedAsync Facades/System.ComponentModel.Primitives \ + Facades/System.ComponentModel.TypeConverter Facades/System.ComponentModel Facades/System.Console Facades/System.Data.Common \ + Facades/System.Diagnostics.Contracts Facades/System.Diagnostics.Debug Facades/System.Diagnostics.FileVersionInfo \ + Facades/System.Diagnostics.Process Facades/System.Diagnostics.StackTrace Facades/System.Diagnostics.TextWriterTraceListener \ + Facades/System.Diagnostics.Tools Facades/System.Diagnostics.TraceSource Facades/System.Drawing.Primitives \ + Facades/System.Dynamic.Runtime Facades/System.Globalization.Calendars Facades/System.Globalization.Extensions \ + Facades/System.Globalization Facades/System.IO.Compression.ZipFile Facades/System.IO.FileSystem.DriveInfo \ + Facades/System.IO.FileSystem.Primitives Facades/System.IO.FileSystem.Watcher Facades/System.IO.FileSystem \ + Facades/System.IO.IsolatedStorage Facades/System.IO.MemoryMappedFiles Facades/System.IO.Pipes \ + Facades/System.IO.UnmanagedMemoryStream Facades/System.IO Facades/System.Linq.Expressions Facades/System.Linq.Parallel \ + Facades/System.Linq.Queryable Facades/System.Linq Facades/System.Net.Http.Rtc Facades/System.Net.NameResolution \ + Facades/System.Net.NetworkInformation Facades/System.Net.Ping Facades/System.Net.Primitives Facades/System.Net.Requests \ + Facades/System.Net.Security Facades/System.Net.Sockets Facades/System.Net.WebHeaderCollection Facades/System.Net.WebSockets.Client \ + Facades/System.Net.WebSockets Facades/System.ObjectModel Facades/System.Reflection.Emit.ILGeneration \ + Facades/System.Reflection.Emit.Lightweight Facades/System.Reflection.Emit Facades/System.Reflection.Extensions \ + Facades/System.Reflection.Primitives Facades/System.Reflection Facades/System.Resources.Reader \ + Facades/System.Resources.ResourceManager Facades/System.Resources.Writer Facades/System.Runtime.CompilerServices.VisualC \ + Facades/System.Runtime.Extensions Facades/System.Runtime.Handles Facades/System.Runtime.InteropServices.RuntimeInformation \ + Facades/System.Runtime.InteropServices.WindowsRuntime Facades/System.Runtime.InteropServices Facades/System.Runtime.Numerics \ + Facades/System.Runtime.Serialization.Formatters Facades/System.Runtime.Serialization.Json \ + Facades/System.Runtime.Serialization.Primitives Facades/System.Runtime.Serialization.Xml Facades/System.Runtime \ + Facades/System.Security.Claims Facades/System.Security.Cryptography.Algorithms Facades/System.Security.Cryptography.Csp \ + Facades/System.Security.Cryptography.Encoding Facades/System.Security.Cryptography.Primitives \ + Facades/System.Security.Cryptography.X509Certificates Facades/System.Security.Principal Facades/System.Security.SecureString \ + Facades/System.ServiceModel.Duplex Facades/System.ServiceModel.Http Facades/System.ServiceModel.NetTcp \ + Facades/System.ServiceModel.Primitives Facades/System.ServiceModel.Security Facades/System.Text.Encoding.Extensions \ + Facades/System.Text.Encoding Facades/System.Text.RegularExpressions Facades/System.Threading.Overlapped \ + Facades/System.Threading.Tasks.Parallel Facades/System.Threading.Tasks Facades/System.Threading.Thread \ + Facades/System.Threading.ThreadPool Facades/System.Threading.Timer Facades/System.Threading Facades/System.ValueTuple \ + Facades/System.Xml.ReaderWriter Facades/System.Xml.XDocument Facades/System.Xml.XPath.XDocument Facades/System.Xml.XPath \ + Facades/System.Xml.XmlDocument Facades/System.Xml.XmlSerializer Facades/netstandard + +ASSEMBLIES += $(FACADE_ASSEMBLIES) + +# generated with (and then slightly tweaked): +# for i in *.dll; do ikdasm --assemblyref $i | grep Name= | sed 's/.*Name=//g' | sed -e $'s/$/\\\n/g' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' -e "s/^/${i%.*}_REFS := /"; done +Accessibility_REFS := mscorlib +CustomMarshalers_REFS := mscorlib +Microsoft.Build.Engine_REFS := mscorlib System.Xml Microsoft.Build.Framework Microsoft.Build.Utilities.v4.0 System System.Core +Microsoft.Build.Framework_REFS := mscorlib System +Microsoft.Build.Tasks.v4.0_REFS := mscorlib Microsoft.Build.Framework Microsoft.Build.Utilities.v4.0 System Microsoft.Build.Engine System.Xml System.Core +Microsoft.Build.Utilities.v4.0_REFS := mscorlib Microsoft.Build.Framework System System.Xml +Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System System.Core +Microsoft.CSharp_REFS := mscorlib System System.Core +Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing +Microsoft.VisualC_REFS := mscorlib +System.ComponentModel.Composition_REFS := mscorlib System System.Core +System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core +System.Configuration.Install_REFS := mscorlib System +System.Configuration_REFS := mscorlib bare/System.Xml System +System.Core_REFS := mscorlib System +System.Data.DataSetExtensions_REFS := mscorlib System.Data System System.Core +System.Data.Entity_REFS := mscorlib System.Core System System.Data System.Runtime.Serialization System.ComponentModel.DataAnnotations System.Xml System.Xml.Linq System.Transactions System.Configuration +System.Data.Linq_REFS := mscorlib System.Data System.Core System System.Xml System.Runtime.Serialization +System.Data.OracleClient_REFS := mscorlib System.Data System System.Drawing System.EnterpriseServices System.Transactions +System.Data.Services.Client_REFS := mscorlib System System.Xml System.Core System.Xml.Linq +System.Data.Services_REFS := mscorlib System.Configuration System.ServiceModel System.ServiceModel.Web System System.ServiceModel.Activation System.Core System.Data.Services.Client +System.Data_REFS := mscorlib System.Configuration System.Xml System System.Numerics System.Core System.Transactions System.EnterpriseServices +System.Deployment_REFS := mscorlib +System.Design_REFS := mscorlib System.Drawing System.Drawing.Design System System.Windows.Forms System.Data bare/System.Web System.Configuration System.Xml +System.Diagnostics.Tracing_REFS := mscorlib +System.DirectoryServices.Protocols_REFS := mscorlib System.Xml System System.DirectoryServices +System.DirectoryServices_REFS := mscorlib System +System.Drawing.Design_REFS := mscorlib System.Drawing System.Windows.Forms System +System.Drawing_REFS := mscorlib System +System.Dynamic_REFS := mscorlib System.Core System +System.EnterpriseServices_REFS := mscorlib System.Transactions +System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System +System.IO.Compression_REFS := mscorlib System +System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel +System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices +System.Management_REFS := mscorlib System System.Configuration.Install +System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms +System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System +System.Net.Http_REFS := mscorlib System System.Core +System.Net_REFS := mscorlib System +System.Numerics_REFS := mscorlib +System.Reflection.Context_REFS := mscorlib +System.Reflection.Metadata_REFS := System.Runtime System.Resources.ResourceManager System.Collections.Immutable System.Reflection.Primitives System.Diagnostics.Debug System.Collections System.IO System.IO.Compression System.Text.Encoding System.Runtime.InteropServices System.Linq System.Reflection System.Threading System.Runtime.Extensions System.Text.Encoding.Extensions System.Reflection.Extensions +System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration +System.Runtime.DurableInstancing_REFS := mscorlib System.Xml.Linq System.Transactions System.Core System.Runtime.Serialization System +System.Runtime.Remoting_REFS := mscorlib System System.Web System.Xml System.Runtime.Serialization.Formatters.Soap +System.Runtime.Serialization.Formatters.Soap_REFS := mscorlib System.Xml +System.Runtime.Serialization_REFS := mscorlib System.Xml System System.Configuration System.Core +System.Security_REFS := mscorlib System System.Xml +System.ServiceModel.Activation_REFS := mscorlib System.ServiceModel System System.Web +System.ServiceModel.Discovery_REFS := mscorlib System.ServiceModel System System.Xml System.Xml.Linq System.Runtime.Serialization System.Configuration System.Core +System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configuration System System.Runtime.Serialization +System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions +System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation +System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms +System.Transactions_REFS := mscorlib System.Configuration +System.Web.Abstractions_REFS := mscorlib System.Web +System.Web.ApplicationServices_REFS := mscorlib System System.Configuration +System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq +System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web System.Web.Extensions +System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Design System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration +System.Web.Mobile_REFS := mscorlib +System.Web.RegularExpressions_REFS := mscorlib System +System.Web.Routing_REFS := mscorlib System.Web +System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data +System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services +System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core +System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data +System.Windows_REFS := mscorlib System +System.Workflow.Activities_REFS := mscorlib +System.Workflow.ComponentModel_REFS := mscorlib +System.Workflow.Runtime_REFS := mscorlib +System.Xaml_REFS := mscorlib System System.Xml System.Core +System.Xml.Linq_REFS := mscorlib System System.Runtime.Serialization System.Xml System.Core +System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml +System.Xml_REFS := mscorlib System System.Configuration +System_REFS := mscorlib bare/System.Configuration bare/System.Xml +WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security +mscorlib_REFS := + +bare/System_REFS := mscorlib +bare/System.Xml_REFS := mscorlib bare/System +bare/System.Configuration_REFS := mscorlib bare/System bare/System.Xml +bare/System.ServiceModel.Activation_REFS := mscorlib System +bare/System.Web_REFS := mscorlib System.Drawing System System.Xml System.Core System.Configuration System.Data System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.EnterpriseServices + +Facades/Microsoft.Win32.Primitives_REFS := mscorlib System +Facades/System.AppContext_REFS := mscorlib +Facades/System.Collections.Concurrent_REFS := mscorlib System +Facades/System.Collections.NonGeneric_REFS := mscorlib System +Facades/System.Collections.Specialized_REFS := mscorlib System +Facades/System.Collections_REFS := mscorlib System.Core System +Facades/System.ComponentModel.Annotations_REFS := mscorlib System.ComponentModel.DataAnnotations +Facades/System.ComponentModel.EventBasedAsync_REFS := mscorlib System +Facades/System.ComponentModel.Primitives_REFS := mscorlib System +Facades/System.ComponentModel.TypeConverter_REFS := mscorlib System +Facades/System.ComponentModel_REFS := mscorlib System +Facades/System.Console_REFS := mscorlib +Facades/System.Data.Common_REFS := mscorlib System.Data +Facades/System.Diagnostics.Contracts_REFS := mscorlib +Facades/System.Diagnostics.Debug_REFS := mscorlib System +Facades/System.Diagnostics.FileVersionInfo_REFS := mscorlib System +Facades/System.Diagnostics.Process_REFS := mscorlib System +Facades/System.Diagnostics.StackTrace_REFS := mscorlib System +Facades/System.Diagnostics.TextWriterTraceListener_REFS := mscorlib System +Facades/System.Diagnostics.Tools_REFS := mscorlib System +Facades/System.Diagnostics.TraceSource_REFS := mscorlib System +Facades/System.Drawing.Primitives_REFS := mscorlib System.Drawing +Facades/System.Dynamic.Runtime_REFS := mscorlib System.Core +Facades/System.Globalization.Calendars_REFS := mscorlib +Facades/System.Globalization.Extensions_REFS := mscorlib System +Facades/System.Globalization_REFS := mscorlib +Facades/System.IO.Compression.ZipFile_REFS := mscorlib System.IO.Compression.FileSystem +Facades/System.IO.FileSystem.DriveInfo_REFS := mscorlib +Facades/System.IO.FileSystem.Primitives_REFS := mscorlib +Facades/System.IO.FileSystem.Watcher_REFS := mscorlib System +Facades/System.IO.FileSystem_REFS := mscorlib +Facades/System.IO.IsolatedStorage_REFS := mscorlib +Facades/System.IO.MemoryMappedFiles_REFS := mscorlib System.Core +Facades/System.IO.Pipes_REFS := mscorlib System.Core +Facades/System.IO.UnmanagedMemoryStream_REFS := mscorlib +Facades/System.IO_REFS := mscorlib System +Facades/System.Linq.Expressions_REFS := mscorlib System.Core +Facades/System.Linq.Parallel_REFS := mscorlib System.Core +Facades/System.Linq.Queryable_REFS := mscorlib System.Core +Facades/System.Linq_REFS := mscorlib System.Core +Facades/System.Net.Http.Rtc_REFS := mscorlib +Facades/System.Net.NameResolution_REFS := mscorlib System +Facades/System.Net.NetworkInformation_REFS := mscorlib System +Facades/System.Net.Ping_REFS := mscorlib System +Facades/System.Net.Primitives_REFS := mscorlib System +Facades/System.Net.Requests_REFS := mscorlib System +Facades/System.Net.Security_REFS := mscorlib System +Facades/System.Net.Sockets_REFS := mscorlib System +Facades/System.Net.WebHeaderCollection_REFS := mscorlib System +Facades/System.Net.WebSockets.Client_REFS := mscorlib System +Facades/System.Net.WebSockets_REFS := mscorlib System +Facades/System.ObjectModel_REFS := mscorlib System +Facades/System.Reflection.Emit.ILGeneration_REFS := mscorlib +Facades/System.Reflection.Emit.Lightweight_REFS := mscorlib +Facades/System.Reflection.Emit_REFS := mscorlib +Facades/System.Reflection.Extensions_REFS := mscorlib +Facades/System.Reflection.Primitives_REFS := mscorlib +Facades/System.Reflection_REFS := mscorlib +Facades/System.Resources.Reader_REFS := mscorlib +Facades/System.Resources.ResourceManager_REFS := mscorlib +Facades/System.Resources.Writer_REFS := mscorlib +Facades/System.Runtime.CompilerServices.VisualC_REFS := mscorlib +Facades/System.Runtime.Extensions_REFS := mscorlib System +Facades/System.Runtime.Handles_REFS := mscorlib System.Core +Facades/System.Runtime.InteropServices.RuntimeInformation_REFS := mscorlib +Facades/System.Runtime.InteropServices.WindowsRuntime_REFS := mscorlib +Facades/System.Runtime.InteropServices_REFS := mscorlib System.Core System +Facades/System.Runtime.Numerics_REFS := mscorlib System.Numerics +Facades/System.Runtime.Serialization.Formatters_REFS := mscorlib +Facades/System.Runtime.Serialization.Json_REFS := mscorlib System.Runtime.Serialization +Facades/System.Runtime.Serialization.Primitives_REFS := mscorlib System.Runtime.Serialization +Facades/System.Runtime.Serialization.Xml_REFS := mscorlib System.Runtime.Serialization System Facades/System.Runtime.Serialization.Primitives +Facades/System.Runtime_REFS := mscorlib System.Core System System.ComponentModel.Composition +Facades/System.Security.Claims_REFS := mscorlib +Facades/System.Security.Cryptography.Algorithms_REFS := mscorlib System.Core +Facades/System.Security.Cryptography.Csp_REFS := mscorlib +Facades/System.Security.Cryptography.Encoding_REFS := mscorlib System +Facades/System.Security.Cryptography.Primitives_REFS := mscorlib +Facades/System.Security.Cryptography.X509Certificates_REFS := mscorlib System System.Core +Facades/System.Security.Principal_REFS := mscorlib +Facades/System.Security.SecureString_REFS := mscorlib System +Facades/System.ServiceModel.Duplex_REFS := mscorlib System.ServiceModel +Facades/System.ServiceModel.Http_REFS := mscorlib System.ServiceModel +Facades/System.ServiceModel.NetTcp_REFS := mscorlib System.ServiceModel +Facades/System.ServiceModel.Primitives_REFS := mscorlib System.IdentityModel System.ServiceModel +Facades/System.ServiceModel.Security_REFS := mscorlib System.ServiceModel +Facades/System.Text.Encoding.Extensions_REFS := mscorlib +Facades/System.Text.Encoding_REFS := mscorlib +Facades/System.Text.RegularExpressions_REFS := mscorlib System +Facades/System.Threading.Overlapped_REFS := mscorlib +Facades/System.Threading.Tasks.Parallel_REFS := mscorlib +Facades/System.Threading.Tasks_REFS := mscorlib System.Core +Facades/System.Threading.Thread_REFS := mscorlib +Facades/System.Threading.ThreadPool_REFS := mscorlib +Facades/System.Threading.Timer_REFS := mscorlib +Facades/System.Threading_REFS := mscorlib System System.Core +Facades/System.ValueTuple_REFS := mscorlib +Facades/System.Xml.ReaderWriter_REFS := mscorlib System.Xml +Facades/System.Xml.XDocument_REFS := mscorlib System.Xml.Linq +Facades/System.Xml.XPath.XDocument_REFS := mscorlib System.Xml.Linq +Facades/System.Xml.XPath_REFS := mscorlib System.Xml +Facades/System.Xml.XmlDocument_REFS := mscorlib System.Xml +Facades/System.Xml.XmlSerializer_REFS := mscorlib System.Xml +Facades/netstandard_REFS := mscorlib System System.Core System.Data System.Diagnostics.Tracing System.Drawing System.IO.Compression System.IO.Compression.FileSystem System.ComponentModel.Composition System.Net.Http System.Numerics System.Runtime.Serialization System.Transactions System.Web System.Xml System.Xml.Linq + +mscorlib_CSC_ARGS := -runtimemetadataversion:v4.0.30319 +System_CSC_ARGS := -d:CONFIG_DEP -d:XML_DEP +System.Configuration_CSC_ARGS := -d:CONFIG_DEP +System.Xml_CSC_ARGS := -d:CONFIG_DEP +System.ServiceModel.Activation_CSC_ARGS := -d:SERVICEMODEL_DEP -d:WEB_DEP +System.Web_CSC_ARGS := -d:SERVICES_DEP + +ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934e089 +WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 +MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a + +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ + System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ + System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ + System.Numerics System.Reflection.Context System.Runtime.Remoting System.Runtime.Serialization \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ + System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml + +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ + System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ + System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ + System.Web.Extensions.Design System.Web.Extensions System.Web.Routing \ + System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ + WindowsBase bare/System.ServiceModel.Activation + +MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ + Microsoft.Build.Tasks.v4.0 Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.Configuration.Install System.Configuration System.Deployment System.Design System.Diagnostics.Tracing System.DirectoryServices.Protocols \ + System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ + System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ + System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ + System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows bare/System.Configuration bare/System.Web + +all: $(addsuffix .dll, $(ASSEMBLIES)) + +clean: + rm -f *.dll + rm -f bare/*.dll + rm -f Facades/*.dll + +define KEYFILE_TEMPLATE +$(1)_KEYFILE := $(2) +endef + +define ASSEMBLY_TEMPLATE +$(1).dll: $(addprefix $(SOURCEDIR),$(subst bare/,,$(1)).cs) $(wildcard $(SOURCEDIR)$(1).extra.cs) $(addsuffix .dll, $($(1)_REFS)) $($(1)_KEYFILE) + @mkdir -p bare/ + @mkdir -p Facades/ + $(Q_CSC) $(CSC) -out:$(1).dll $(CSC_COMMON_ARGS) -keyfile:$($(1)_KEYFILE) $($(1)_CSC_ARGS) $(addprefix -r:, $(addsuffix .dll, $($(1)_REFS))) $(wildcard $(SOURCEDIR)$(1).extra.cs) $$< +endef + +$(foreach asm, $(ECMA_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(ECMA_KEY)))) +$(foreach asm, $(WINFX_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(WINFX_KEY)))) +$(foreach asm, $(MSFINAL_KEY_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(MSFINAL_KEY)))) +$(foreach asm, $(FACADE_ASSEMBLIES), $(eval $(call KEYFILE_TEMPLATE,$(asm), $(MSFINAL_KEY)))) + +$(foreach asm, $(ASSEMBLIES), $(eval $(call ASSEMBLY_TEMPLATE,$(asm)))) diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Engine.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Engine.dll new file mode 100644 index 0000000000..88e7c46c07 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Engine.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Framework.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Framework.dll new file mode 100644 index 0000000000..44f081c36c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Framework.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Tasks.v4.0.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Tasks.v4.0.dll.REMOVED.git-id new file mode 100644 index 0000000000..d0a803c905 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Tasks.v4.0.dll.REMOVED.git-id @@ -0,0 +1 @@ +48a489d6a78a7df567985f79be83987716da4da5 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Utilities.v4.0.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Utilities.v4.0.dll new file mode 100644 index 0000000000..b414a73856 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.Utilities.v4.0.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.dll new file mode 100644 index 0000000000..08796e380d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.Build.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.CSharp.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.CSharp.dll new file mode 100644 index 0000000000..d022c8d59a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.CSharp.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.VisualBasic.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.VisualBasic.dll new file mode 100644 index 0000000000..8bd7747c18 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.VisualBasic.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/Microsoft.VisualC.dll b/external/binary-reference-assemblies/v4.7.1/Microsoft.VisualC.dll new file mode 100644 index 0000000000..2546b2b11f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/Microsoft.VisualC.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ComponentModel.Composition.dll b/external/binary-reference-assemblies/v4.7.1/System.ComponentModel.Composition.dll new file mode 100644 index 0000000000..d719c9ba7a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ComponentModel.Composition.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ComponentModel.DataAnnotations.dll b/external/binary-reference-assemblies/v4.7.1/System.ComponentModel.DataAnnotations.dll new file mode 100644 index 0000000000..1846f6b75d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ComponentModel.DataAnnotations.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Configuration.Install.dll b/external/binary-reference-assemblies/v4.7.1/System.Configuration.Install.dll new file mode 100644 index 0000000000..1079638003 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Configuration.Install.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Configuration.dll b/external/binary-reference-assemblies/v4.7.1/System.Configuration.dll new file mode 100644 index 0000000000..d14757a3ad Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Configuration.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Core.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..8a08bb53cc --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +7eee6c1bcdceb41196eb7f1d975cf201347d5946 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.DataSetExtensions.dll b/external/binary-reference-assemblies/v4.7.1/System.Data.DataSetExtensions.dll new file mode 100644 index 0000000000..4cc2453fb6 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Data.DataSetExtensions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.Entity.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Data.Entity.dll.REMOVED.git-id new file mode 100644 index 0000000000..fc66735029 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Data.Entity.dll.REMOVED.git-id @@ -0,0 +1 @@ +86528ac3b19364d3baa5911a4fe3139f4fb33446 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.Linq.dll b/external/binary-reference-assemblies/v4.7.1/System.Data.Linq.dll new file mode 100644 index 0000000000..509ee78475 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Data.Linq.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.OracleClient.dll b/external/binary-reference-assemblies/v4.7.1/System.Data.OracleClient.dll new file mode 100644 index 0000000000..b117c38d51 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Data.OracleClient.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.Services.Client.dll b/external/binary-reference-assemblies/v4.7.1/System.Data.Services.Client.dll new file mode 100644 index 0000000000..50fd1106b2 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Data.Services.Client.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.Services.dll b/external/binary-reference-assemblies/v4.7.1/System.Data.Services.dll new file mode 100644 index 0000000000..14eae48365 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Data.Services.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Data.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Data.dll.REMOVED.git-id new file mode 100644 index 0000000000..7b7d38c5d6 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Data.dll.REMOVED.git-id @@ -0,0 +1 @@ +33b714b7adc8c96386cec07ab1d4a4ab277441bf \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Deployment.dll b/external/binary-reference-assemblies/v4.7.1/System.Deployment.dll new file mode 100644 index 0000000000..1b42a76d91 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Deployment.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Design.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Design.dll.REMOVED.git-id new file mode 100644 index 0000000000..f3d5c61dca --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Design.dll.REMOVED.git-id @@ -0,0 +1 @@ +654433d7f5fc9db3f457cc74ece4605133e30012 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Diagnostics.Tracing.dll b/external/binary-reference-assemblies/v4.7.1/System.Diagnostics.Tracing.dll new file mode 100644 index 0000000000..70211c180b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Diagnostics.Tracing.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.DirectoryServices.Protocols.dll b/external/binary-reference-assemblies/v4.7.1/System.DirectoryServices.Protocols.dll new file mode 100644 index 0000000000..4719eb36a5 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.DirectoryServices.Protocols.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.DirectoryServices.dll b/external/binary-reference-assemblies/v4.7.1/System.DirectoryServices.dll new file mode 100644 index 0000000000..7e61c3af2a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.DirectoryServices.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Drawing.Design.dll b/external/binary-reference-assemblies/v4.7.1/System.Drawing.Design.dll new file mode 100644 index 0000000000..06c983324c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Drawing.Design.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Drawing.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Drawing.dll.REMOVED.git-id new file mode 100644 index 0000000000..845f77bb44 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Drawing.dll.REMOVED.git-id @@ -0,0 +1 @@ +201d85b0cae38c07eaf738f62e4f37b317683db4 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Dynamic.dll b/external/binary-reference-assemblies/v4.7.1/System.Dynamic.dll new file mode 100644 index 0000000000..fd3fc29b3c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Dynamic.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.EnterpriseServices.dll b/external/binary-reference-assemblies/v4.7.1/System.EnterpriseServices.dll new file mode 100644 index 0000000000..645ec7e302 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.EnterpriseServices.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.IO.Compression.FileSystem.dll b/external/binary-reference-assemblies/v4.7.1/System.IO.Compression.FileSystem.dll new file mode 100644 index 0000000000..b36a9eef15 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.IO.Compression.FileSystem.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.IO.Compression.dll b/external/binary-reference-assemblies/v4.7.1/System.IO.Compression.dll new file mode 100644 index 0000000000..5bfea18b7f Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.IO.Compression.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.IdentityModel.Selectors.dll b/external/binary-reference-assemblies/v4.7.1/System.IdentityModel.Selectors.dll new file mode 100644 index 0000000000..bbbf76985c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.IdentityModel.Selectors.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.IdentityModel.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.IdentityModel.dll.REMOVED.git-id new file mode 100644 index 0000000000..be3349fc71 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.IdentityModel.dll.REMOVED.git-id @@ -0,0 +1 @@ +4e5781ce5524d8fb3e9438db1699cd257e7443fb \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Management.dll b/external/binary-reference-assemblies/v4.7.1/System.Management.dll new file mode 100644 index 0000000000..13ed6bee36 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Management.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Messaging.dll b/external/binary-reference-assemblies/v4.7.1/System.Messaging.dll new file mode 100644 index 0000000000..dd523b2ea9 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Messaging.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Net.Http.WebRequest.dll b/external/binary-reference-assemblies/v4.7.1/System.Net.Http.WebRequest.dll new file mode 100644 index 0000000000..fbf3c4c759 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Net.Http.WebRequest.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Net.Http.dll b/external/binary-reference-assemblies/v4.7.1/System.Net.Http.dll new file mode 100644 index 0000000000..ac13cc21ec Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Net.Http.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Net.dll b/external/binary-reference-assemblies/v4.7.1/System.Net.dll new file mode 100644 index 0000000000..6dca873600 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Net.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Numerics.dll b/external/binary-reference-assemblies/v4.7.1/System.Numerics.dll new file mode 100644 index 0000000000..65077629e0 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Numerics.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Reflection.Context.dll b/external/binary-reference-assemblies/v4.7.1/System.Reflection.Context.dll new file mode 100644 index 0000000000..2bf79b324d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Reflection.Context.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Runtime.Caching.dll b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Caching.dll new file mode 100644 index 0000000000..944001b263 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Caching.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Runtime.DurableInstancing.dll b/external/binary-reference-assemblies/v4.7.1/System.Runtime.DurableInstancing.dll new file mode 100644 index 0000000000..e902989a7b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Runtime.DurableInstancing.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Remoting.dll new file mode 100644 index 0000000000..501fc0f10e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Remoting.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Runtime.Serialization.Formatters.Soap.dll b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Serialization.Formatters.Soap.dll new file mode 100644 index 0000000000..9483417408 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Serialization.Formatters.Soap.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Runtime.Serialization.dll b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Serialization.dll new file mode 100644 index 0000000000..b2db773b72 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Runtime.Serialization.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Security.dll b/external/binary-reference-assemblies/v4.7.1/System.Security.dll new file mode 100644 index 0000000000..517eb3ebd3 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Security.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Activation.dll b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Activation.dll new file mode 100644 index 0000000000..f098ca916a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Activation.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Discovery.dll b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Discovery.dll new file mode 100644 index 0000000000..a772a3fbd6 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Discovery.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Routing.dll b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Routing.dll new file mode 100644 index 0000000000..24e51b83b9 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Routing.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Web.dll b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Web.dll new file mode 100644 index 0000000000..e5374e0b7b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.Web.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.dll.REMOVED.git-id new file mode 100644 index 0000000000..fb04329a59 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.ServiceModel.dll.REMOVED.git-id @@ -0,0 +1 @@ +7ba16fd8d844e1869be2fe4a44c32d97e5a7f215 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.ServiceProcess.dll b/external/binary-reference-assemblies/v4.7.1/System.ServiceProcess.dll new file mode 100644 index 0000000000..317b735011 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.ServiceProcess.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Transactions.dll b/external/binary-reference-assemblies/v4.7.1/System.Transactions.dll new file mode 100644 index 0000000000..032824074a Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Transactions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.Abstractions.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.Abstractions.dll new file mode 100644 index 0000000000..35d36b8c1d Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.Abstractions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.ApplicationServices.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.ApplicationServices.dll new file mode 100644 index 0000000000..68b287cbba Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.ApplicationServices.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.DynamicData.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.DynamicData.dll new file mode 100644 index 0000000000..0676eacdb3 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.DynamicData.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.Extensions.Design.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.Extensions.Design.dll new file mode 100644 index 0000000000..814dd986f7 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.Extensions.Design.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.Extensions.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Web.Extensions.dll.REMOVED.git-id new file mode 100644 index 0000000000..66a810c094 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Web.Extensions.dll.REMOVED.git-id @@ -0,0 +1 @@ +36163fdd57be91c95e7e1757adcdefc473db414c \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.Mobile.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.Mobile.dll new file mode 100644 index 0000000000..a6ef8c7986 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.Mobile.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.RegularExpressions.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.RegularExpressions.dll new file mode 100644 index 0000000000..5f3e8a0127 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.RegularExpressions.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.Routing.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.Routing.dll new file mode 100644 index 0000000000..705bf6ae95 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.Routing.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.Services.dll b/external/binary-reference-assemblies/v4.7.1/System.Web.Services.dll new file mode 100644 index 0000000000..1046ed8f7e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Web.Services.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Web.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Web.dll.REMOVED.git-id new file mode 100644 index 0000000000..67d5d2f074 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Web.dll.REMOVED.git-id @@ -0,0 +1 @@ +f6a91fe656f6a99a464e7b4a50b0dfd8a8b79d6f \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Windows.Forms.DataVisualization.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Windows.Forms.DataVisualization.dll.REMOVED.git-id new file mode 100644 index 0000000000..a54c61c55d --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Windows.Forms.DataVisualization.dll.REMOVED.git-id @@ -0,0 +1 @@ +e8497f6417519ece8f3ecfcb22972ed2c02c198b \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Windows.Forms.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Windows.Forms.dll.REMOVED.git-id new file mode 100644 index 0000000000..e600684ce1 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Windows.Forms.dll.REMOVED.git-id @@ -0,0 +1 @@ +43dada0d23b3441989831f46ace0dc3fa0b0d26a \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.Windows.dll b/external/binary-reference-assemblies/v4.7.1/System.Windows.dll new file mode 100644 index 0000000000..4ce253aca0 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Windows.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Workflow.Activities.dll b/external/binary-reference-assemblies/v4.7.1/System.Workflow.Activities.dll new file mode 100644 index 0000000000..e264df948b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Workflow.Activities.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Workflow.ComponentModel.dll b/external/binary-reference-assemblies/v4.7.1/System.Workflow.ComponentModel.dll new file mode 100644 index 0000000000..789e41cd07 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Workflow.ComponentModel.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Workflow.Runtime.dll b/external/binary-reference-assemblies/v4.7.1/System.Workflow.Runtime.dll new file mode 100644 index 0000000000..fe1141bb04 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Workflow.Runtime.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Xaml.dll b/external/binary-reference-assemblies/v4.7.1/System.Xaml.dll new file mode 100644 index 0000000000..7e70a4ab8b Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Xaml.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Xml.Linq.dll b/external/binary-reference-assemblies/v4.7.1/System.Xml.Linq.dll new file mode 100644 index 0000000000..ad3a4f062e Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Xml.Linq.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Xml.Serialization.dll b/external/binary-reference-assemblies/v4.7.1/System.Xml.Serialization.dll new file mode 100644 index 0000000000..4d752ba69c Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/System.Xml.Serialization.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/System.Xml.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.Xml.dll.REMOVED.git-id new file mode 100644 index 0000000000..2c39af363d --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.Xml.dll.REMOVED.git-id @@ -0,0 +1 @@ +55ac5245bdeeea66fe42d1004653707cfa6876c3 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/System.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..840b8f072b --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +a30decf6496151191fbebdc8c0ea6709870a4ed3 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/WindowsBase.dll b/external/binary-reference-assemblies/v4.7.1/WindowsBase.dll new file mode 100644 index 0000000000..bf729e4454 Binary files /dev/null and b/external/binary-reference-assemblies/v4.7.1/WindowsBase.dll differ diff --git a/external/binary-reference-assemblies/v4.7.1/mscorlib.dll.REMOVED.git-id b/external/binary-reference-assemblies/v4.7.1/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..42c3767a11 --- /dev/null +++ b/external/binary-reference-assemblies/v4.7.1/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +3b49735dd3b9800ff990ce156dc26b94ed4920e7 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7/Makefile b/external/binary-reference-assemblies/v4.7/Makefile index aa0fb8caf0..ed752a4c1a 100644 --- a/external/binary-reference-assemblies/v4.7/Makefile +++ b/external/binary-reference-assemblies/v4.7/Makefile @@ -7,27 +7,24 @@ Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) ASSEMBLIES := Accessibility CustomMarshalers \ Microsoft.Build.Engine Microsoft.Build.Framework Microsoft.Build.Tasks.v4.0 \ - Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC Microsoft.Web.Infrastructure \ - SMDiagnostics System.ComponentModel.Composition \ + Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ + System.ComponentModel.Composition \ System.ComponentModel.DataAnnotations System.Configuration.Install System.Configuration System.Core \ System.Data.DataSetExtensions System.Data.Entity System.Data.Linq System.Data.OracleClient \ System.Data.Services.Client System.Data.Services System.Data System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices \ System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ - System.Json.Microsoft System.Json System.Management System.Messaging System.Net.Http.Formatting \ - System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics System.Reactive.Core System.Reactive.Debugger \ - System.Reactive.Experimental System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases \ - System.Reactive.PlatformServices System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms \ - System.Reactive.Windows.Threading System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ + System.Management System.Messaging \ + System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics \ + System.Runtime.Caching System.Runtime.DurableInstancing System.Runtime.Remoting \ System.Runtime.Serialization.Formatters.Soap System.Runtime.Serialization System.Security System.ServiceModel.Activation \ System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.Web \ - System.ServiceModel System.ServiceProcess System.Threading.Tasks.Dataflow System.Transactions System.Web.Abstractions \ + System.ServiceModel System.ServiceProcess System.Transactions System.Web.Abstractions \ System.Web.ApplicationServices System.Web.DynamicData System.Web.Extensions.Design System.Web.Extensions \ - System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http System.Web.Mvc System.Web.Razor System.Web.Routing \ - System.Web.Services System.Web.WebPages.Deployment System.Web.WebPages.Razor System.Web.WebPages System.Web \ + System.Web.Routing System.Web.Services System.Web \ System.Windows.Forms.DataVisualization System.Windows.Forms System.Windows System.Xaml System.Xml.Linq \ - System.Xml.Serialization System.Xml System WindowsBase cscompmgd mscorlib \ - System.Deployment System.Numerics.Vectors System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ + System.Xml.Serialization System.Xml System WindowsBase mscorlib \ + System.Deployment System.Reflection.Context System.Runtime.InteropServices.RuntimeInformation \ System.Web.Mobile System.Web.RegularExpressions System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime ASSEMBLIES += bare/System bare/System.Xml bare/System.Configuration bare/System.ServiceModel.Activation bare/System.Web @@ -65,8 +62,6 @@ Microsoft.Build_REFS := mscorlib Microsoft.Build.Framework System.Xml System Sys Microsoft.CSharp_REFS := mscorlib System System.Core Microsoft.VisualBasic_REFS := mscorlib System System.Windows.Forms System.Drawing Microsoft.VisualC_REFS := mscorlib -Microsoft.Web.Infrastructure_REFS := mscorlib System System.Web -SMDiagnostics_REFS := mscorlib System.Configuration System System.Xml System.ServiceModel.Internals System.ComponentModel.Composition_REFS := mscorlib System System.Core System.ComponentModel.DataAnnotations_REFS := mscorlib System System.Core System.Configuration.Install_REFS := mscorlib System @@ -91,27 +86,12 @@ System.IO.Compression.FileSystem_REFS := mscorlib System.IO.Compression System System.IO.Compression_REFS := mscorlib System System.IdentityModel.Selectors_REFS := mscorlib System.Xml System System.IdentityModel System.IdentityModel_REFS := mscorlib System.Configuration System.Runtime.Serialization System.Security System System.Xml System.Web.ApplicationServices -System.Json.Microsoft_REFS := mscorlib System.Runtime.Serialization System System.Xml System.Core -System.Json_REFS := mscorlib System System.Core System.Management_REFS := mscorlib System System.Configuration.Install System.Messaging_REFS := mscorlib System System.Drawing System.Configuration.Install System.Xml System.Windows.Forms -System.Net.Http.Formatting_REFS := mscorlib System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Data System.Net.Http System.Configuration System.Net.Http.WebRequest_REFS := mscorlib System.Net.Http System System.Net.Http_REFS := mscorlib System System.Core System.Net_REFS := mscorlib System -System.Numerics.Vectors_REFS := mscorlib System.Numerics System.Numerics_REFS := mscorlib -System.Reactive.Core_REFS := mscorlib System System.Reactive.Interfaces System.Core -System.Reactive.Debugger_REFS := mscorlib System.Reactive.Linq -System.Reactive.Experimental_REFS := mscorlib System.Reactive.Linq System.Reactive.Core System.Core System.Reactive.Interfaces System -System.Reactive.Interfaces_REFS := mscorlib System.Core -System.Reactive.Linq_REFS := mscorlib System.Core System System.Reactive.Interfaces System.Reactive.Core -System.Reactive.Observable.Aliases_REFS := mscorlib System.Reactive.Interfaces System.Core System.Reactive.Providers System.Reactive.Linq -System.Reactive.PlatformServices_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces System.Core System.Reactive.Linq -System.Reactive.Providers_REFS := mscorlib System.Core System.Reactive.Interfaces System System.Reactive.Core System.Reactive.Linq -System.Reactive.Runtime.Remoting_REFS := mscorlib System.Reactive.Interfaces System.Reactive.Core System.Core -System.Reactive.Windows.Forms_REFS := mscorlib System.Reactive.Core System.Reactive.Interfaces System.Windows.Forms -System.Reactive.Windows.Threading_REFS := mscorlib System System.Reactive.Core System.Reactive.Interfaces WindowsBase System.Reflection.Context_REFS := mscorlib System.Reflection.Metadata_REFS := System.Runtime System.Resources.ResourceManager System.Collections.Immutable System.Reflection.Primitives System.Diagnostics.Debug System.Collections System.IO System.IO.Compression System.Text.Encoding System.Runtime.InteropServices System.Linq System.Reflection System.Threading System.Runtime.Extensions System.Text.Encoding.Extensions System.Reflection.Extensions System.Runtime.Caching_REFS := mscorlib System System.Data System.Configuration @@ -128,25 +108,16 @@ System.ServiceModel.Routing_REFS := mscorlib System.ServiceModel System.Configur System.ServiceModel.Web_REFS := mscorlib System.ServiceModel System System.Runtime.Serialization System.Xml System.Xml.Linq System.Configuration System.ServiceModel.Activation System.Core System.Web.Extensions System.ServiceModel_REFS := mscorlib System.Xml System.Xml.Linq System.Xaml System System.EnterpriseServices System.Transactions System.IdentityModel System.Runtime.Serialization System.Runtime.DurableInstancing System.Security System.Web.ApplicationServices System.Messaging System.Net.Http System.IdentityModel.Selectors System.Web.Services System.Configuration System.Web System.Core bare/System.ServiceModel.Activation System.ServiceProcess_REFS := mscorlib System System.Configuration.Install System.Windows.Forms -System.Threading.Tasks.Dataflow_REFS := mscorlib System.Core System System.Transactions_REFS := mscorlib System.Configuration System.Web.Abstractions_REFS := mscorlib System.Web System.Web.ApplicationServices_REFS := mscorlib System System.Configuration System.Web.DynamicData_REFS := mscorlib System System.Drawing System.Web System.Web.Extensions System.Core System.ComponentModel.DataAnnotations System.Data.Linq System.Web.Extensions.Design_REFS := mscorlib System System.Design System.Drawing System.Web.Extensions System.Web.Extensions_REFS := mscorlib System.Web System System.Xml System.Drawing System.Design System.Data.Linq System.Web.Services System.ServiceModel System.ServiceModel.Activation System.Runtime.Serialization System.Web.ApplicationServices System.Core System.Configuration -System.Web.Http.SelfHost_REFS := mscorlib System System.ServiceModel System.Net.Http System.Core System.Web.Http System.IdentityModel System.Runtime.Serialization System.Net.Http.Formatting System.Configuration System.Xml -System.Web.Http.WebHost_REFS := mscorlib System.Web System.Core System System.Net.Http System.Web.Http System.Xml Microsoft.Web.Infrastructure -System.Web.Http_REFS := mscorlib System System.Net.Http System.Net.Http.Formatting System.Core System.ComponentModel.DataAnnotations System.Runtime.Serialization System.Xml System.Data.Linq System.Web.Mobile_REFS := mscorlib -System.Web.Mvc_REFS := mscorlib System.Web System System.Core System.ComponentModel.DataAnnotations System.Web.Extensions System.Web.WebPages.Razor System.Runtime.Caching System.Web.WebPages System.Xml System.Web.Razor System.Data.Linq Microsoft.Web.Infrastructure -System.Web.Razor_REFS := mscorlib System System.Core System.Web.RegularExpressions_REFS := mscorlib System System.Web.Routing_REFS := mscorlib System.Web System.Web.Services_REFS := mscorlib System System.Configuration System.EnterpriseServices System.Xml bare/System.Web System.DirectoryServices System.Design System.Data -System.Web.WebPages.Deployment_REFS := mscorlib System.Web System System.Configuration System.Core Microsoft.Web.Infrastructure -System.Web.WebPages.Razor_REFS := mscorlib System.Web System System.Web.Razor System.Configuration System.Core System.Web.WebPages -System.Web.WebPages_REFS := mscorlib System.Web System System.Core System.Xml.Linq System.Web.Razor System.ComponentModel.DataAnnotations System.Data.Linq Microsoft.Web.Infrastructure Microsoft.CSharp System.Web.WebPages.Deployment System.Web_REFS := mscorlib System.Configuration System.Xml System System.Data System.Drawing System.Runtime.Serialization.Formatters.Soap System.Core System.EnterpriseServices System.Web.ApplicationServices System.ComponentModel.DataAnnotations System.Web.Services System.Windows.Forms.DataVisualization_REFS := mscorlib System.Drawing System.Windows.Forms System System.Xml System.Data System.Core System.Windows.Forms_REFS := mscorlib System System.Xml System.Drawing System.Runtime.Serialization.Formatters.Soap Accessibility System.Configuration System.Data @@ -160,7 +131,6 @@ System.Xml.Serialization_REFS := mscorlib System.ServiceModel System.Xml System.Xml_REFS := mscorlib System System.Configuration System_REFS := mscorlib bare/System.Configuration bare/System.Xml WindowsBase_REFS := mscorlib System.Xaml System System.Xml System.Security -cscompmgd_REFS := mscorlib System mscorlib_REFS := bare/System_REFS := mscorlib @@ -234,31 +204,28 @@ ECMA_KEY := ../../../mcs/class/ecma.pub # Public Key Token: b77a5c561934 WINFX_KEY := ../../../mcs/class/winfx.pub # Public Key Token: 31bf3856ad364e35 MSFINAL_KEY := ../../../mcs/class/msfinal.pub # Public Key Token: b03f5f7f11d50a3a -ECMA_KEY_ASSEMBLIES := SMDiagnostics System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ +ECMA_KEY_ASSEMBLIES := System.ComponentModel.Composition System.Core System.Data.DataSetExtensions \ System.Data.Entity System.Data.Linq System.Data.OracleClient System.Data.Services.Client System.Data.Services \ System.Data System.IO.Compression.FileSystem System.IO.Compression System.IdentityModel.Selectors System.IdentityModel \ System.Numerics System.Reflection.Context System.Runtime.Remoting System.Runtime.Serialization System.ServiceModel.Internals \ - System.ServiceModel System.Threading.Tasks.Dataflow System.Transactions System.Windows.Forms System.Xaml \ + System.ServiceModel System.Transactions System.Windows.Forms System.Xaml \ System.Xml.Linq System.Xml.Serialization System.Xml System mscorlib bare/System bare/System.Xml -WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations Microsoft.Web.Infrastructure System.Json.Microsoft \ - System.Json System.Net.Http.Formatting System.Reactive.Core System.Reactive.Debugger System.Reactive.Experimental \ - System.Reactive.Interfaces System.Reactive.Linq System.Reactive.Observable.Aliases System.Reactive.PlatformServices \ - System.Reactive.Providers System.Reactive.Runtime.Remoting System.Reactive.Windows.Forms System.Reactive.Windows.Threading \ +WINFX_KEY_ASSEMBLIES := System.ComponentModel.DataAnnotations \ System.Runtime.DurableInstancing System.ServiceModel.Activation System.ServiceModel.Discovery System.ServiceModel.Routing \ System.ServiceModel.Web System.Web.Abstractions System.Web.ApplicationServices System.Web.DynamicData \ - System.Web.Extensions.Design System.Web.Extensions System.Web.Http.SelfHost System.Web.Http.WebHost System.Web.Http \ - System.Web.Mvc System.Web.Razor System.Web.Routing System.Web.WebPages.Deployment System.Web.WebPages.Razor \ - System.Web.WebPages System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ + System.Web.Extensions.Design System.Web.Extensions \ + System.Web.Routing \ + System.Windows.Forms.DataVisualization System.Workflow.Activities System.Workflow.ComponentModel System.Workflow.Runtime \ WindowsBase bare/System.ServiceModel.Activation MSFINAL_KEY_ASSEMBLIES := Accessibility CustomMarshalers Microsoft.Build.Engine Microsoft.Build.Framework \ Microsoft.Build.Tasks.v4.0 Microsoft.Build.Utilities.v4.0 Microsoft.Build Microsoft.CSharp Microsoft.VisualBasic Microsoft.VisualC \ System.Configuration.Install System.Configuration System.Deployment System.Design System.DirectoryServices.Protocols \ System.DirectoryServices System.Drawing.Design System.Drawing System.Dynamic System.EnterpriseServices System.Management \ - System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Numerics.Vectors System.Runtime.Caching \ + System.Messaging System.Net.Http.WebRequest System.Net.Http System.Net System.Runtime.Caching \ System.Runtime.InteropServices.RuntimeInformation System.Runtime.Serialization.Formatters.Soap System.Security System.ServiceProcess System.Web.Services \ - System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows cscompmgd bare/System.Configuration bare/System.Web + System.Web System.Web.Mobile System.Web.RegularExpressions System.Windows bare/System.Configuration bare/System.Web all: $(addsuffix .dll, $(ASSEMBLIES)) diff --git a/external/binary-reference-assemblies/v4.7/Microsoft.Web.Infrastructure.dll b/external/binary-reference-assemblies/v4.7/Microsoft.Web.Infrastructure.dll deleted file mode 100644 index 35e35d2c85..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/Microsoft.Web.Infrastructure.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/SMDiagnostics.dll b/external/binary-reference-assemblies/v4.7/SMDiagnostics.dll deleted file mode 100644 index 13b8e2bc26..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/SMDiagnostics.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Net.Http.Formatting.dll b/external/binary-reference-assemblies/v4.7/System.Net.Http.Formatting.dll deleted file mode 100644 index 2d6cd850bc..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Net.Http.Formatting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Core.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Core.dll deleted file mode 100644 index 0364ab08f5..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Core.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Debugger.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Debugger.dll deleted file mode 100644 index 690723e00f..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Debugger.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Experimental.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Experimental.dll deleted file mode 100644 index a0403cb7ea..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Experimental.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Interfaces.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Interfaces.dll deleted file mode 100644 index d3ed5cc3d1..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Interfaces.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Linq.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Linq.dll deleted file mode 100644 index 07229f487c..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Linq.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Observable.Aliases.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Observable.Aliases.dll deleted file mode 100644 index 9cbf577ade..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Observable.Aliases.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.PlatformServices.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.PlatformServices.dll deleted file mode 100644 index f869a70acb..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.PlatformServices.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Providers.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Providers.dll deleted file mode 100644 index 60802f307e..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Providers.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Runtime.Remoting.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Runtime.Remoting.dll deleted file mode 100644 index 7b87308407..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Runtime.Remoting.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Windows.Forms.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Windows.Forms.dll deleted file mode 100644 index 00dcaee3b8..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Windows.Forms.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Reactive.Windows.Threading.dll b/external/binary-reference-assemblies/v4.7/System.Reactive.Windows.Threading.dll deleted file mode 100644 index 749f4ab958..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Reactive.Windows.Threading.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.Http.SelfHost.dll b/external/binary-reference-assemblies/v4.7/System.Web.Http.SelfHost.dll deleted file mode 100644 index bc491f01ca..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.Http.SelfHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.Http.WebHost.dll b/external/binary-reference-assemblies/v4.7/System.Web.Http.WebHost.dll deleted file mode 100644 index 33ceea6fd6..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.Http.WebHost.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.Http.dll b/external/binary-reference-assemblies/v4.7/System.Web.Http.dll deleted file mode 100644 index 4bde3d2b95..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.Http.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.Mvc.dll b/external/binary-reference-assemblies/v4.7/System.Web.Mvc.dll deleted file mode 100644 index 4dcd718940..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.Mvc.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.Razor.dll b/external/binary-reference-assemblies/v4.7/System.Web.Razor.dll deleted file mode 100644 index 1251bd13db..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.WebPages.Deployment.dll b/external/binary-reference-assemblies/v4.7/System.Web.WebPages.Deployment.dll deleted file mode 100644 index 4c94fc894b..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.WebPages.Deployment.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.WebPages.Razor.dll b/external/binary-reference-assemblies/v4.7/System.Web.WebPages.Razor.dll deleted file mode 100644 index 21aaa386ad..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.WebPages.Razor.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/System.Web.WebPages.dll b/external/binary-reference-assemblies/v4.7/System.Web.WebPages.dll deleted file mode 100644 index 2a8f28ff5c..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/System.Web.WebPages.dll and /dev/null differ diff --git a/external/binary-reference-assemblies/v4.7/cscompmgd.dll b/external/binary-reference-assemblies/v4.7/cscompmgd.dll deleted file mode 100644 index f87fcde104..0000000000 Binary files a/external/binary-reference-assemblies/v4.7/cscompmgd.dll and /dev/null differ diff --git a/external/bockbuild/bockbuild/darwinprofile.py b/external/bockbuild/bockbuild/darwinprofile.py index 87fda1b970..1f6da4aebe 100644 --- a/external/bockbuild/bockbuild/darwinprofile.py +++ b/external/bockbuild/bockbuild/darwinprofile.py @@ -43,6 +43,7 @@ class DarwinProfile (UnixProfile): # ccache uses a different CC since it's not installed yet # every thing after ccache needs a working ccache default_toolchain = [ + 'cmake', 'autoconf', 'automake', 'ccache', diff --git a/external/bockbuild/bockbuild/package.py b/external/bockbuild/bockbuild/package.py index b338d78946..f719d17e35 100644 --- a/external/bockbuild/bockbuild/package.py +++ b/external/bockbuild/bockbuild/package.py @@ -359,10 +359,17 @@ class Package: clean_func = None # what to run if the workspace needs to be redone - if self.sources is None: - return None - expand_macros(self.sources, self) + + if not self.sources: + def clean_nop (dir): + pass + self.sources = [] + self.desc = '%s %s' % (self.name, self.version) + self.buildstring.extend( + ['%s md5: %s' % (os.path.basename(self._path), md5(self._path))]) + clean_func = clean_nop + local_sources = [] try: @@ -441,8 +448,6 @@ class Package: if clean_func is None: error('workspace cleaning function (clean_func) must be set') - self.buildstring.extend( - ['%s md5: %s' % (os.path.basename(self._path), md5(self._path))]) self.local_sources = local_sources self.clean = clean_func @@ -542,14 +547,15 @@ class Package: files = list() size = 0 - for path in iterate_dir(artifact_stage, summary=False): + for path in iterate_dir(artifact_stage, with_links = True, summary=False): relpath = os.path.relpath(path, artifact_stage) destpath = os.path.join(dest, relpath) if os.path.exists(destpath) and not identical_files(path, destpath): warn( 'Different file exists in package already: ''%s''' % relpath ) files.append(relpath) - size = size + os.path.getsize(path) + if not os.path.islink(path): + size = size + os.path.getsize(path) files.sort() is_changed(files, artifact + '.files') diff --git a/external/bockbuild/packages/cmake.py b/external/bockbuild/packages/cmake.py new file mode 100644 index 0000000000..a970692c63 --- /dev/null +++ b/external/bockbuild/packages/cmake.py @@ -0,0 +1,23 @@ +from distutils.version import LooseVersion, StrictVersion + + +class SystemCMake (Package): + + def __init__(self): + Package.__init__(self, 'cmake', 'system', sources=None) + cmake_path = which('cmake') + if cmake_path is None: + error('cmake not found in PATH') + self.cmake_path = cmake_path + cmake_version_str = backtick('%s --version' % self.cmake_path)[0].split(' ')[2] + cmake_version = StrictVersion(cmake_version_str) + self.version = str(cmake_version) + + def build(self): + pass + + def install(self): + self.sh('mkdir -p "%{staged_prefix}/bin"') + self.sh('ln -s -F %{cmake_path} "%{staged_prefix}/bin/cmake"') + +SystemCMake() diff --git a/external/bockbuild/packages/expat.py b/external/bockbuild/packages/expat.py index 57b52d656f..6658da7ab3 100644 --- a/external/bockbuild/packages/expat.py +++ b/external/bockbuild/packages/expat.py @@ -1 +1,2 @@ -SourceForgePackage('expat', 'expat', '2.0.1') +Package('expat', '2.2.5', sources=[ + 'https://github.com/libexpat/libexpat/releases/download/R_2_2_5/expat-2.2.5.tar.bz2']) diff --git a/external/bockbuild/packages/gtk-sharp.py b/external/bockbuild/packages/gtk-sharp.py index 5bc9a69704..1d52bf0872 100644 --- a/external/bockbuild/packages/gtk-sharp.py +++ b/external/bockbuild/packages/gtk-sharp.py @@ -4,7 +4,7 @@ class GtkSharp212ReleasePackage (Package): Package.__init__(self, 'gtk-sharp', sources=['git://github.com/mono/gtk-sharp.git'], git_branch='gtk-sharp-2-12-branch', - revision='43d38a806de8efe62a09a3284178880f2ae36a56', + revision='ae7bbb340c0e4baad27264727f6ca80ebbc882c0', override_properties={ 'configure': './bootstrap-2.12 --prefix=%{package_prefix}', } diff --git a/external/corefx/BuildToolsVersion.txt b/external/corefx/BuildToolsVersion.txt index 55ddf34fae..aba00a2c97 100644 --- a/external/corefx/BuildToolsVersion.txt +++ b/external/corefx/BuildToolsVersion.txt @@ -1 +1 @@ -2.0.0-prerelease-01822-01 +2.0.0-prerelease-02118-01 diff --git a/external/corefx/Documentation/building/cross-platform-testing.md b/external/corefx/Documentation/building/cross-platform-testing.md index fde3606835..51bc3b7dff 100644 --- a/external/corefx/Documentation/building/cross-platform-testing.md +++ b/external/corefx/Documentation/building/cross-platform-testing.md @@ -15,11 +15,11 @@ instructions assume you are building for Linux, but are easily modifiable for OS of debug CoreCLR since it is much faster at actually running XUnit, but debug will work if you have the time. - From the root of your CoreCLR enlistment on Linux, run `./build.sh Release` in + From the root of your CoreCLR repo on Linux, run `./build.sh Release` in order to build. 2. A corresponding version of System.Private.Corelib.dll. Depending on your platform, this may be produced when you run `build.sh`. Otherwise, this can be produced by - running `build.cmd linuxmscorlib Release` (it's `mscorlib` for historical reasons) from a CoreCLR enlistment on + running `build.cmd linuxmscorlib Release` (it's `mscorlib` for historical reasons) from a CoreCLR repo on Windows. Remember that the runtime and System.Private.Corelib are tightly coupled with respect to object sizes and layout so you need to ensure you have either a release coreclr and release System.Private.Corelib or debug coreclr and debug System.Private.Corelib. @@ -30,7 +30,7 @@ instructions assume you are building for Linux, but are easily modifiable for OS * Build the managed parts of CoreFX on Windows. To do so run `build-managed.cmd -os=Linux`. It is okay to build a Debug version of CoreFX and run it on top of a release CoreCLR (which is exactly what we do in Jenkins). - * Build the native parts of CoreFX on Linux. To do so run `./build-native.sh` from the root of your CoreFX enlistment. + * Build the native parts of CoreFX on Linux. To do so run `./build-native.sh` from the root of your CoreFX repo. 4. The packages folder which contains all the packages restored from NuGet and MyGet when building CoreFX. diff --git a/external/corefx/Documentation/building/unix-instructions.md b/external/corefx/Documentation/building/unix-instructions.md index 74c4eeaedc..813576ddf2 100644 --- a/external/corefx/Documentation/building/unix-instructions.md +++ b/external/corefx/Documentation/building/unix-instructions.md @@ -25,7 +25,7 @@ For Ubuntu 14.04, the following packages should be installed to build the native components * git -* clang-3.5 +* clang-3.9 * cmake * make * libc6-dev @@ -34,7 +34,7 @@ components * libcurl4-openssl-dev * zlib1g-dev -`sudo apt-get install git clang-3.5 cmake make libc6-dev libssl-dev libkrb5-dev +`sudo apt-get install git clang-3.9 cmake make libc6-dev libssl-dev libkrb5-dev libcurl4-openssl-dev zlib1g-dev` #### Managed build @@ -47,7 +47,8 @@ For Ubuntu 14.04, install the following packages: `sudo apt-get install libunwind8 libicu52 curl` -For Ubuntu 16.04 LTS / Bash on Ubuntu on Windows you may need to replace libicu52 with libicu55. Ubuntu 16.10 will require libcu57. +For Ubuntu 16.04 LTS / Bash on Ubuntu on Windows you may need to replace libicu52 with libicu55. +Ubuntu 16.10 and Ubuntu 17.04 will require libicu57. `sudo apt-get install libunwind8 libicu55 curl` diff --git a/external/corefx/Documentation/building/windows-instructions.md b/external/corefx/Documentation/building/windows-instructions.md index dd8d07974c..7e77f8fc7f 100644 --- a/external/corefx/Documentation/building/windows-instructions.md +++ b/external/corefx/Documentation/building/windows-instructions.md @@ -5,27 +5,37 @@ You can build .NET Core either via the command line or by using Visual Studio. ## Required Software -Visual Studio must be installed. Supported versions: -* [Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) (Community, Professional, Enterprise). The community version is completely free. -* [Visual Studio 2017](https://www.visualstudio.com/downloads/) (Community, Professional, Enterprise). The community version is completely free. +1. **Visual Studio** must be installed. Supported versions: + * [Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) (Community, Professional, Enterprise). The Community version is completely free. + * [Visual Studio 2017](https://www.visualstudio.com/downloads/) (Community, Professional, Enterprise). The Community version is completely free. +2. **[CMake](https://cmake.org/)** must be installed from [the CMake download page](https://cmake.org/download/#latest) and added to your path. -For Visual Studio 2015: -* In order to build our C++ projects be sure to select "Programming Languages | Visual C++ | Common Tools for Visual C++ 2015" while installing VS 2015 (or modify your install to include it). -* We also require that [Visual Studio 2015 Update 1](https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx) be installed. +### Visual Studio 2015 -For Visual Studio 2017: -* When doing a 'Workloads' based install, the following are the minimum requirements: - * .NET Desktop Development +* [Visual Studio 2015 Update 1](https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx) is required. +* You must select **Programming Languages | Visual C++ | Common Tools for Visual C++ 2015** while installing VS 2015 (or modify your install to include it). + +### Visual Studio 2017 + +#### Visual Studio 2017 - 'Workloads' based install + +The following are the minimum requirements: + * .NET desktop development * All Required Components * .NET Framework 4-4.6 Development Tools - * Desktop Development with C++ + * Desktop development with C++ * All Required Components * VC++ 2017 v141 Toolset (x86, x64) * Windows 8.1 SDK and UCRT SDK * VC++ 2015.3 v140 Toolset (x86, x64) * .NET Core cross-platform development * All Required Components -* When doing an 'Individual Components' based install, the following are the minimum requirements: + +Note: If you have both VS 2017 and 2015 installed, you need to copy DIA SDK directory from VS 2015 installation into VS 2017 (VS installer bug). + +#### Visual Studio 2017 - 'Individual components' based install + +The following are the minimum requirements: * C# and Visual Basic Roslyn Compilers * Static Analysis Tools * .NET Portable Library Targeting Pack @@ -36,13 +46,12 @@ For Visual Studio 2017: * .NET Framework 4.6 Targeting Pack * Windows Universal CRT SDK * VC++ 2015.3 v140 Toolset (x86, x64) -* Ensure you are running from the "Developer Command Prompt for VS2017"; Otherwise, the build will attempt to locate and use the VS2015 toolset. - -[CMake](https://cmake.org/) is required to build the native libraries for Windows. To build these libraries cmake must be installed from [the CMake download page](https://cmake.org/download/#latest) and added to your path. ## Building From the Command Line -Open a [Visual Studio Command Prompt](http://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx). +You must use the Developer Command Prompt. It will have a name like "Developer Command Prompt for VS 2017" or similar in your start menu. + +From a (non-admin) Developer Command Prompt window: - `build.cmd` - Will cause basic tool initialization and build the default configuration for refs, libs, and packages. - `build-tests.cmd` - Will build and run tests for the default configuration. @@ -93,6 +102,11 @@ Once you've built the source code for netfx from the root (`build.cmd -framework For advanced debugging using WinDBG see [Debugging CoreFX on Windows](https://github.com/dotnet/corefx/blob/master/Documentation/debugging/windows-instructions.md) ### Notes +* At any given time, the corefx repo might be configured to use a more recent compiler than +the one used by the most recent Visual Studio IDE release. This means the corefx codebase might +be using language features that are not understood by the IDE, which might result in errors that +show up as red squiggles while writing code. Such errors should, however, not affect the actual compilation. + * Running tests from using the VS test explorer does not currently work after we switched to running on CoreCLR. [We will be working on enabling full VS test integration](https://github.com/dotnet/corefx/issues/1318) but we don't have an ETA yet. In the meantime, use the steps above to launch/debug the tests using the console runner. * VS 2015 is required to debug tests running on CoreCLR as the CoreCLR diff --git a/external/corefx/Documentation/debugging/unix-instructions.md b/external/corefx/Documentation/debugging/unix-instructions.md index 3dc8f47974..b088094881 100644 --- a/external/corefx/Documentation/debugging/unix-instructions.md +++ b/external/corefx/Documentation/debugging/unix-instructions.md @@ -6,7 +6,7 @@ CoreFX can be debugged on unix using both lldb and visual studio code ## Using lldb and SOS - Run the test using msbuild at least once with `/t:BuildAndTest`. -- Install version 3.6 of lldb and launch lldb with dotnet as the process and arguments matching the arguments used when running the test through msbuild. +- Install version 3.9 of lldb and launch lldb with dotnet as the process and arguments matching the arguments used when running the test through msbuild. - Load the sos plugin using `plugin load libsosplugin.so`. - Type `soshelp` to get help. You can now use all sos commands like `bpmd`. @@ -21,8 +21,8 @@ It is also possible to debug .NET Core crash dumps using lldb and SOS. In order - Matching runtime bits from the crash. To get these, you should either: - Download the matching Jenkins archive onto your repro machine. - Check out the corefx repository at the appropriate commit and re-build the necessary portions. -- lldb version 3.8+. Versions 3.6+ of lldb work with regular debugging, but not core debugging. Make sure the version of lldb you have installed is >= 3.8. -- libsosplugin.so built against a matching version of lldb. Unfortunately, the one that is included in the CoreCLR nuget package is built against version 3.6. You will need to build coreclr from source to get the correct version. Luckily, this will help you get the next file: +- lldb version 3.9. +- libsosplugin.so built against a matching version of lldb. The official libsosplugin.so is now built against 3.9. - Symbols for libcoreclr.so. libcoreclr.so.dbg should be copied to your "runtime" folder. To get this file, you can: - Build coreclr at the matching commit. In order to determine which commit was used to build a version of libcoreclr.so, run the following command: `strings libcoreclr.so | grep "@(#)"` diff --git a/external/corefx/Documentation/project-docs/dogfooding.md b/external/corefx/Documentation/project-docs/dogfooding.md index 782548381a..b5c284bb98 100644 --- a/external/corefx/Documentation/project-docs/dogfooding.md +++ b/external/corefx/Documentation/project-docs/dogfooding.md @@ -117,19 +117,6 @@ $ dotnet publish $ bin\Debug\netcoreapp2.0\win7-x64\publish\App.exe ``` -Note #1: There is a [bug](https://github.com/dotnet/sdk/issues/791) with `dotnet run` and -self-contained applications. If you `dotnet run` and see an error `The library 'hostpolicy.dll' -required to execute the application...`, you've hit this bug. - -Note #2: On non-Windows platforms, self-contained applications aren't runnable by default. You will -see an error "Permission denied" when running the application. This is because of a -[breaking change in the .NET Core runtime](https://github.com/dotnet/corefx/issues/15516) between 1.0 and 2.0. -Either this breaking change needs to be fixed, or [NuGet will have to workaround the change] -(https://github.com/NuGet/Home/issues/4424). - -To workaround this issue, run `chmod u+x bin/Debug/netcoreapp2.0/RID/publish/App` before executing -your application. - ## Using your local CoreFx build To use your local built corefx packages you will need to be a self-contained application and so you will @@ -148,6 +135,17 @@ Once you find the version number (for this example assume it is `4.4.0-beta-2510 ``` +Because assets in `Microsoft.Private.CoreFx.NETCoreApp` conflict with the normal `Microsoft.NETCore.App` package, +you need to tell the tooling to use the assets from your local package. To do this, add the following property to your project file: + +```xml + + Microsoft.Private.CoreFx.NETCoreApp;runtime.win-x64.Microsoft.Private.CoreFx.NETCoreApp;$(PackageConflictPreferredPackages) + +``` + +Replacing the RID in `runtime.win-x64.Microsoft.Private.CoreFx.NETCoreApp` with the RID of your current build. + #### 2 - Add your bin directory to the Nuget feed list By default the dogfooding dotnet SDK will create a Nuget.Config file next to your project, if it doesn't diff --git a/external/corefx/Documentation/project-docs/issue-guide.md b/external/corefx/Documentation/project-docs/issue-guide.md index c39f010da6..48a9d490a0 100644 --- a/external/corefx/Documentation/project-docs/issue-guide.md +++ b/external/corefx/Documentation/project-docs/issue-guide.md @@ -42,59 +42,60 @@ Areas are tracked by labels area-* (e.g. area-System.Collections). Each area | Area | Owners / experts | Description | |-----------------------------------------------------------------------------------------------|------------------|-------------| -| [area-Infrastructure](https://github.com/dotnet/corefx/labels/area-Infrastructure) | [@mellinoe](https://github.com/mellinoe), [@ericstj](https://github.com/ericstj), [@weshaggard](https://github.com/weshaggard) |Covers:
  • Packaging
  • Build and test infra for CoreFX repo
  • VS integration

| +| [area-Infrastructure](https://github.com/dotnet/corefx/labels/area-Infrastructure) | [@weshaggard](https://github.com/weshaggard), [@ericstj](https://github.com/ericstj) |Covers:
  • Packaging
  • Build and test infra for CoreFX repo
  • VS integration

| | [area-Meta](https://github.com/dotnet/corefx/labels/area-Meta) | [@tarekgh](https://github.com/tarekgh) | Issues without clear association to any specific API/contract, e.g.
  • new contract proposals
  • cross-cutting code/test pattern changes (e.g. FxCop failures)
  • project-wide docs

| | [area-Serialization](https://github.com/dotnet/corefx/labels/area-Serialization) | [@shmao](https://github.com/shmao), [@zhenlan](https://github.com/zhenlan) | Packages:
  • System.Runtime.Serialization.Xml
  • System.Runtime.Serialization.Json
  • System.Private.DataContractSerialization
  • System.Xml.XmlSerializer
Excluded:
  • System.Runtime.Serialization.Formatters
| | **System contract assemblies** | | | | [System.AppContext](https://github.com/dotnet/corefx/labels/area-System.AppContext) | [@AlexGhiondea](https://github.com/AlexGhiondea) | | | | [System.Buffers](https://github.com/dotnet/corefx/labels/area-System.Buffers) | [@safern](https://github.com/safern) | | -| [System.CodeDom](https://github.com/dotnet/corefx/labels/area-System.CodeDom) | [@Priya91](https://github.com/Priya91) | | -| [System.Collections](https://github.com/dotnet/corefx/labels/area-System.Collections) | [@ianhays](https://github.com/ianhays), [@safern](https://github.com/safern) | Excluded:
  • System.Array -> System.Runtime
| -| [System.ComponentModel](https://github.com/dotnet/corefx/labels/area-System.ComponentModel) | [@safern](https://github.com/safern), [@AlexGhiondea](https://github.com/AlexGhiondea) | | +| [System.CodeDom](https://github.com/dotnet/corefx/labels/area-System.CodeDom) | [@pjanotti](https://github.com/pjanotti) | | +| [System.Collections](https://github.com/dotnet/corefx/labels/area-System.Collections) |**[@safern](https://github.com/safern)**, [@ianhays](https://github.com/ianhays) | Excluded:
  • System.Array -> System.Runtime
| +| [System.ComponentModel](https://github.com/dotnet/corefx/labels/area-System.ComponentModel) | **[@maryamariyan](https://github.com/maryamariyan)**, [@safern](https://github.com/safern) | | | [System.ComponentModel.DataAnnotations](https://github.com/dotnet/corefx/labels/area-System.ComponentModel.DataAnnotations) | [@lajones](https://github.com/lajones), [@divega](https://github.com/divega), [@ajcvickers](https://github.com/ajcvickers) | | -| [System.Composition](https://github.com/dotnet/corefx/labels/area-System.Composition) | [@AlexGhiondea](https://github.com/AlexGhiondea) | | -| [System.Configuration](https://github.com/dotnet/corefx/labels/area-System.Configuration) | [@JeremyKuhne](https://github.com/JeremyKuhne) | | -| [System.Console](https://github.com/dotnet/corefx/labels/area-System.Console) | [@ianhays](https://github.com/ianhays) | | +| [System.Composition](https://github.com/dotnet/corefx/labels/area-System.Composition) | [@ViktorHofer](https://github.com/ViktorHofer) | | +| [System.Configuration](https://github.com/dotnet/corefx/labels/area-System.Configuration) | [@maryamariyan](https://github.com/maryamariyan) | | +| [System.Console](https://github.com/dotnet/corefx/labels/area-System.Console) | **[@joperezr](https://github.com/joperezr)**, [@ianhays](https://github.com/ianhays) | | | [System.Data](https://github.com/dotnet/corefx/labels/area-System.Data) | [@saurabh500](https://github.com/saurabh500), [@corivera](https://github.com/corivera) | | | [System.Data.SqlClient](https://github.com/dotnet/corefx/labels/area-System.Data.SqlClient) | [@saurabh500](https://github.com/saurabh500), [@corivera](https://github.com/corivera) | | -| [System.Diagnostics](https://github.com/dotnet/corefx/labels/area-System.Diagnostics) | [@joperezr](https://github.com/joperezr) | | -| [System.Diagnostics.Process](https://github.com/dotnet/corefx/labels/area-System.Diagnostics.Process) | [@Priya91](https://github.com/Priya91) | | +| [System.Diagnostics](https://github.com/dotnet/corefx/labels/area-System.Diagnostics) | **[@joperezr](https://github.com/joperezr)**, [@wtgodbe](https://github.com/wtgodbe) | | +| [System.Diagnostics.Process](https://github.com/dotnet/corefx/labels/area-System.Diagnostics.Process) | **[@joperezr](https://github.com/joperezr)**, [@wtgodbe](https://github.com/wtgodbe) | | | [System.Diagnostics.Tracing](https://github.com/dotnet/corefx/labels/area-System.Diagnostics.Tracing) | [@brianrob](https://github.com/brianrob), [@vancem](https://github.com/vancem), [@valenis](https://github.com/valenis)| Packages:
  • System.Diagnostics.DiagnosticSource
  • System.Diagnostics.PerformanceCounter
  • System.Diagnostics.Tracing
  • System.Diagnostics.TraceSource

| | [System.DirectoryServices](https://github.com/dotnet/corefx/labels/area-System.DirectoryServices) | [@tquerec](https://github.com/tquerec) | | -| [System.Drawing](https://github.com/dotnet/corefx/labels/area-System.Drawing) | [@mellinoe](https://github.com/mellinoe) | | +| [System.Drawing](https://github.com/dotnet/corefx/labels/area-System.Drawing) | [@safern](https://github.com/safern) | | | [System.Dynamic.Runtime](https://github.com/dotnet/corefx/labels/area-System.Dynamic.Runtime) | [@VSadov](https://github.com/VSadov), [@OmarTawfik](https://github.com/OmarTawfik) | | -| [System.Globalization](https://github.com/dotnet/corefx/labels/area-System.Globalization) | [@krwq](https://github.com/krwq), [@tarekgh](https://github.com/tarekgh) | | -| [System.IO](https://github.com/dotnet/corefx/labels/area-System.IO) | [@JeremyKuhne](https://github.com/JeremyKuhne), [@ianhays](https://github.com/ianhays) | | -| [System.IO.Compression](https://github.com/dotnet/corefx/labels/area-System.IO.Compression) | [@ianhays](https://github.com/ianhays) | | +| [System.Globalization](https://github.com/dotnet/corefx/labels/area-System.Globalization) | **[@krwq](https://github.com/krwq)**, [@tarekgh](https://github.com/tarekgh) | | +| [System.IO](https://github.com/dotnet/corefx/labels/area-System.IO) | **[@JeremyKuhne](https://github.com/JeremyKuhne)**, [@pjanotti](https://github.com/pjanotti) | | +| [System.IO.Compression](https://github.com/dotnet/corefx/labels/area-System.IO.Compression) | **[@ViktorHofer](https://github.com/ViktorHofer)**, [@ianhays](https://github.com/ianhays) | | | [System.Linq](https://github.com/dotnet/corefx/labels/area-System.Linq) | [@VSadov](https://github.com/VSadov), [@OmarTawfik](https://github.com/OmarTawfik) | | | [System.Linq.Expressions](https://github.com/dotnet/corefx/labels/area-System.Linq.Expressions) | [@VSadov](https://github.com/VSadov), [@OmarTawfik](https://github.com/OmarTawfik) | | | [System.Linq.Parallel](https://github.com/dotnet/corefx/labels/area-System.Linq.Parallel) | [@kouvel](https://github.com/kouvel) | | -| [System.Memory](https://github.com/dotnet/corefx/labels/area-System.Memory) | [@KrzysztofCwalina](https://github.com/KrzysztofCwalina), [@ahsonkhan](https://github.com/ahsonkhan), [@shiftylogic](https://github.com/shiftylogic) | | -| [System.Net](https://github.com/dotnet/corefx/labels/area-System.Net) | [@davidsh](https://github.com/davidsh), [@CIPop](https://github.com/CIPop), [@Priya91](https://github.com/Priya91) | Included:
  • System.Uri
| -| [System.Net.Http](https://github.com/dotnet/corefx/labels/area-System.Net.Http) | [@davidsh](https://github.com/davidsh), [@CIPop](https://github.com/CIPop), [@Priya91](https://github.com/Priya91) | | -| [System.Net.Security](https://github.com/dotnet/corefx/labels/area-System.Net.Security) | [@davidsh](https://github.com/davidsh), [@CIPop](https://github.com/CIPop), [@Priya91](https://github.com/Priya91) | | -| [System.Net.Sockets](https://github.com/dotnet/corefx/labels/area-System.Net.Sockets) | [@davidsh](https://github.com/davidsh), [@CIPop](https://github.com/CIPop), [@Priya91](https://github.com/Priya91) | | -| [System.Numerics](https://github.com/dotnet/corefx/labels/area-System.Numerics) | [@mellinoe](https://github.com/mellinoe) | | +| [System.Memory](https://github.com/dotnet/corefx/labels/area-System.Memory) | [@KrzysztofCwalina](https://github.com/KrzysztofCwalina), [@ahsonkhan](https://github.com/ahsonkhan) | | +| [System.Net](https://github.com/dotnet/corefx/labels/area-System.Net) | [@davidsh](https://github.com/davidsh), [@Priya91](https://github.com/Priya91), [@wfurt](https://github.com/wfurt) | Included:
  • System.Uri
| +| [System.Net.Http](https://github.com/dotnet/corefx/labels/area-System.Net.Http) | [@davidsh](https://github.com/davidsh), [@Priya91](https://github.com/Priya91), [@wfurt](https://github.com/wfurt) | | +| [System.Net.Security](https://github.com/dotnet/corefx/labels/area-System.Net.Security) | [@davidsh](https://github.com/davidsh), [@Priya91](https://github.com/Priya91), [@wfurt](https://github.com/wfurt) | | +| [System.Net.Sockets](https://github.com/dotnet/corefx/labels/area-System.Net.Sockets) | [@davidsh](https://github.com/davidsh), [@Priya91](https://github.com/Priya91), [@wfurt](https://github.com/wfurt) | | +| [System.Numerics](https://github.com/dotnet/corefx/labels/area-System.Numerics) | [@eerhardt](https://github.com/eerhardt), [@ViktorHofer](https://github.com/ViktorHofer) | | | [System.Reflection](https://github.com/dotnet/corefx/labels/area-System.Reflection) | [@dnlharvey](https://github.com/dnlharvey), [@AtsushiKan](https://github.com/AtsushiKan) | | | [System.Reflection.Emit](https://github.com/dotnet/corefx/labels/area-System.Reflection.Emit) | [@dnlharvey](https://github.com/dnlharvey), [@AtsushiKan](https://github.com/AtsushiKan) | | | [System.Reflection.Metadata](https://github.com/dotnet/corefx/labels/area-System.Reflection.Metadata) | [@tmat](https://github.com/tmat), [@nguerrera](https://github.com/nguerrera) | | -| [System.Resources](https://github.com/dotnet/corefx/labels/area-System.Resources) | [@tarekgh](https://github.com/tarekgh) | | -| [System.Runtime](https://github.com/dotnet/corefx/labels/area-System.Runtime) | [@AlexGhiondea](https://github.com/AlexGhiondea), [@joperezr](https://github.com/joperezr) | Included:
  • System.Runtime.Serialization.Formatters
  • System.Runtime.InteropServices.RuntimeInfo
  • System.Array
Excluded:
  • Path -> System.IO
  • StopWatch -> System.Diagnostics
  • Uri -> System.Net
  • WebUtility -> System.Net
| -| [System.Runtime.CompilerServices](https://github.com/dotnet/corefx/labels/area-System.Runtime.CompilerServices) | [@AlexGhiondea](https://github.com/AlexGhiondea), [@joperezr](https://github.com/joperezr) | | -| [System.Runtime.Extensions](https://github.com/dotnet/corefx/labels/area-System.Runtime.Extensions) | [@AlexGhiondea](https://github.com/AlexGhiondea), [@joperezr](https://github.com/joperezr) | | -| [System.Runtime.InteropServices](https://github.com/dotnet/corefx/labels/area-System.Runtime.InteropServices) | [@tijoytom](https://github.com/tijoytom), [@yizhang82](https://github.com/yizhang82) | Excluded:
  • System.Runtime.InteropServices.RuntimeInfo
| +| [System.Resources](https://github.com/dotnet/corefx/labels/area-System.Resources) | **[@krwq](https://github.com/krwq)**, [@tarekgh](https://github.com/tarekgh) | | +| [System.Runtime](https://github.com/dotnet/corefx/labels/area-System.Runtime) | **[@joperezr](https://github.com/joperezr)**, [@AlexGhiondea](https://github.com/AlexGhiondea) | Included:
  • System.Runtime.Serialization.Formatters
  • System.Runtime.InteropServices.RuntimeInfo
  • System.Array
Excluded:
  • Path -> System.IO
  • StopWatch -> System.Diagnostics
  • Uri -> System.Net
  • WebUtility -> System.Net
| +| [System.Runtime.CompilerServices](https://github.com/dotnet/corefx/labels/area-System.Runtime.CompilerServices) | **[@joperezr](https://github.com/joperezr)**, [@AlexGhiondea](https://github.com/AlexGhiondea) | | +| [System.Runtime.Extensions](https://github.com/dotnet/corefx/labels/area-System.Runtime.Extensions) | **[@joperezr](https://github.com/joperezr)**, [@AlexGhiondea](https://github.com/AlexGhiondea) | | +| [System.Runtime.InteropServices](https://github.com/dotnet/corefx/labels/area-System.Runtime.InteropServices) | [@tijoytom](https://github.com/tijoytom), [@luqunl](https://github.com/luqunl) | Excluded:
  • System.Runtime.InteropServices.RuntimeInfo
| | [System.Security](https://github.com/dotnet/corefx/labels/area-System.Security) | [@bartonjs](https://github.com/bartonjs), [@ianhays](https://github.com/ianhays) | | -| System.ServiceModel | N/A | [dotnet/wcf](https://github.com/dotnet/wcf) | -| [System.ServiceProcess](https://github.com/dotnet/corefx/labels/area-System.ServiceProcess) | [@Priya91](https://github.com/Priya91) | | -| [System.Text.Encoding](https://github.com/dotnet/corefx/labels/area-System.Text.Encoding) | [@krwq](https://github.com/krwq), [@tarekgh](https://github.com/tarekgh) | Included:
  • System.Text.Encoding**s**.Web
| -| [System.Text.RegularExpressions](https://github.com/dotnet/corefx/labels/area-System.Text.RegularExpressions) | [@Priya91](https://github.com/Priya91) | | +| System.ServiceModel | N/A | [dotnet/wcf](https://github.com/dotnet/wcf) (except System.ServiceModel.Syndication) | +| [System.ServiceModel.Syndication](https://github.com/dotnet/corefx/labels/area-System.ServiceModel.Syndication) | [@shmao](https://github.com/shmao), [@zhenlan](https://github.com/zhenlan) | | +| [System.ServiceProcess](https://github.com/dotnet/corefx/labels/area-System.ServiceProcess) | [@maryamariyan](https://github.com/maryamariyan) | | +| [System.Text.Encoding](https://github.com/dotnet/corefx/labels/area-System.Text.Encoding) | **[@krwq](https://github.com/krwq)**, [@tarekgh](https://github.com/tarekgh) | Included:
  • System.Text.Encoding**s**.Web
| +| [System.Text.RegularExpressions](https://github.com/dotnet/corefx/labels/area-System.Text.RegularExpressions) | **[@ViktorHofer](https://github.com/ViktorHofer)**, [@Priya91](https://github.com/Priya91) | | | [System.Threading](https://github.com/dotnet/corefx/labels/area-System.Threading) | [@kouvel](https://github.com/kouvel) | | | [System.Transactions](https://github.com/dotnet/corefx/labels/area-System.Transactions) | [@jimcarley](https://github.com/jimcarley), [@qizhanMS](https://github.com/qizhanMS), [@dmetzgar](https://github.com/dmetzgar) | | -| [System.Xml](https://github.com/dotnet/corefx/labels/area-System.Xml) | [@sepidehMS](https://github.com/sepidehMS), [@krwq](https://github.com/krwq) | | +| [System.Xml](https://github.com/dotnet/corefx/labels/area-System.Xml) | **[@krwq](https://github.com/krwq)**, [@pjanotti](https://github.com/pjanotti) | | | **Microsoft contract assemblies** | | | | [Microsoft.CSharp](https://github.com/dotnet/corefx/labels/area-Microsoft.CSharp) | [@VSadov](https://github.com/VSadov), [@OmarTawfik](https://github.com/OmarTawfik) | | | [Microsoft.VisualBasic](https://github.com/dotnet/corefx/labels/area-Microsoft.VisualBasic) | [@VSadov](https://github.com/VSadov), [@OmarTawfik](https://github.com/OmarTawfik) | | -| [Microsoft.Win32](https://github.com/dotnet/corefx/labels/area-Microsoft.Win32) | [@sepidehMS](https://github.com/sepidehMS) | | +| [Microsoft.Win32](https://github.com/dotnet/corefx/labels/area-Microsoft.Win32) | [@maryamariyan](https://github.com/maryamariyan) | | Note: Area triage will apply the new scheme (issue types and assignee) throughout 2016. diff --git a/external/corefx/Documentation/project-docs/target-dotnetcore-with-msbuild.md b/external/corefx/Documentation/project-docs/target-dotnetcore-with-msbuild.md index 73da0878b7..e7692793fa 100644 --- a/external/corefx/Documentation/project-docs/target-dotnetcore-with-msbuild.md +++ b/external/corefx/Documentation/project-docs/target-dotnetcore-with-msbuild.md @@ -47,7 +47,7 @@ Creating a .NET Core console application Building a console application for .NET Core requires some customization of the MSBuild build process. A sample project for a .NET Core console application is [CoreApp](https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample/CoreApp) in the [corefxlab](https://github.com/dotnet/corefxlab) repo. Another good option is to start with [coretemplate](https://github.com/mellinoe/coretemplate), which uses separate MSBuild targets files to target .NET Core -instead of putting the the changes directly in the project file. +instead of putting the changes directly in the project file. It is also possible to start by creating a project in Visual Studio and modify it to target .NET Core. The instructions below show the minimal steps to get this working. In contrast to CoreApp or coretemplate, a project created this way won't include configurations for targeting Linux and Mac OS. diff --git a/external/corefx/DotnetCLIVersion.txt b/external/corefx/DotnetCLIVersion.txt index 170f3fc4f5..227cea2156 100644 --- a/external/corefx/DotnetCLIVersion.txt +++ b/external/corefx/DotnetCLIVersion.txt @@ -1 +1 @@ -2.0.0-preview1-005977 +2.0.0 diff --git a/external/corefx/Packaging.props b/external/corefx/Packaging.props index 61f368b7ca..bffa5713dd 100644 --- a/external/corefx/Packaging.props +++ b/external/corefx/Packaging.props @@ -1,6 +1,6 @@ - preview2 + preview1 $(ProjectDir)pkg/descriptions.json $(ProjectDir)LICENSE.TXT $(ProjectDir)THIRD-PARTY-NOTICES.TXT diff --git a/external/corefx/README.md b/external/corefx/README.md index 9f0a05cf89..8c61a927dd 100644 --- a/external/corefx/README.md +++ b/external/corefx/README.md @@ -1,9 +1,3 @@ -### Latest News and Announcements - -* [Announcement: Driving towards zero 2.0 bugs by **2017/5/10** (ZBB)](https://github.com/dotnet/corefx/issues/17619) - - - # .NET Core Libraries (CoreFX) This repo contains the library implementation (called "CoreFX") for .NET Core. It includes System.Collections, System.IO, System.Xml, and many other components. @@ -14,7 +8,7 @@ Runtime-specific library code ([mscorlib](https://github.com/dotnet/coreclr/tree ## .NET Core -Great starting page: http://dotnet.github.io +Official Starting Page: http://dotnet.github.io * [How to use .NET Core](https://github.com/dotnet/core/#get-started) (with VS, VS Code, command-line CLI) * [Install official releases](https://www.microsoft.com/net/core) @@ -69,7 +63,7 @@ Also see info about related [Microsoft .NET Core and ASP.NET Core Bug Bounty Pro ## License -.NET Core (including the corefx repo) is licensed under the [MIT license](LICENSE). +.NET Core (including the corefx repo) is licensed under the [MIT license](LICENSE.TXT). @@ -100,7 +94,6 @@ Note: See officially supported [OS versions](https://github.com/dotnet/core/blob |**CentOS 7.1**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/centos7.1_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/centos7.1_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/centos7.1_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/centos7.1_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_centos7.1_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_centos7.1_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_centos7.1_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_centos7.1_release/lastCompletedBuild/testReport)| |**Debian 8**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/debian8.4_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/debian8.4_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/debian8.4_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/debian8.4_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_debian8.4_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_debian8.4_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_debian8.4_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_debian8.4_release/lastCompletedBuild/testReport)| |**Fedora 24**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/fedora24_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/fedora24_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/fedora24_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/fedora24_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_fedora24_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_fedora24_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_fedora24_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_fedora24_release/lastCompletedBuild/testReport)| -|**openSUSE 42.1**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/opensuse42.1_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/opensuse42.1_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/opensuse42.1_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/opensuse42.1_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_opensuse42.1_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_opensuse42.1_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_opensuse42.1_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_opensuse42.1_release/lastCompletedBuild/testReport)| |**OS X 10.12**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/osx10.12_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/osx10.12_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/osx10.12_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/osx10.12_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_osx_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_osx_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_osx_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_osx_release/lastCompletedBuild/testReport)| |**Red Hat 7.2**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/rhel7.2_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/rhel7.2_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/rhel7.2_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/rhel7.2_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_rhel7.2_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_rhel7.2_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_rhel7.2_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_rhel7.2_release/lastCompletedBuild/testReport)| |**Ubuntu 14.04**|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/ubuntu14.04_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/ubuntu14.04_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/ubuntu14.04_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/ubuntu14.04_release/lastCompletedBuild/testReport)|[![x64-debug](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_ubuntu14.04_debug/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_ubuntu14.04_debug/lastCompletedBuild/testReport)|[![x64-release](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_ubuntu14.04_release/badge/icon)](https://ci.dot.net/job/dotnet_corefx/job/master/job/outerloop_netcoreapp_ubuntu14.04_release/lastCompletedBuild/testReport)| diff --git a/external/corefx/build.proj b/external/corefx/build.proj index e00c9826dc..b1a793952c 100644 --- a/external/corefx/build.proj +++ b/external/corefx/build.proj @@ -60,9 +60,6 @@ <_projectsToUpdate Include="$(MSBuildThisFileDirectory)src/**/*.*ilproj" Exclude="@(_projectsToExcludeFromUpdate)" /> <_solutionsToUpdateFiles Include="$(MSBuildThisFileDirectory)src/*/dir.props" /> <_solutionsToUpdate Include="@(_solutionsToUpdateFiles->'%(RootDir)%(Directory)')" Exclude="@(_solutionsToExcludeFromUpdate)" /> - <_solutionsToUpdate Include="$(MSBuildThisFileDirectory)src/System.ServiceProcess.ServiceController/" > - TestNativeService - diff --git a/external/corefx/build.sh b/external/corefx/build.sh index 6aea9dd0a1..e739d7f231 100755 --- a/external/corefx/build.sh +++ b/external/corefx/build.sh @@ -17,14 +17,17 @@ usage() echo } -if [ "$1" == "-?" ]; then +if [ "$1" == "-?" ] || [ "$1" == "-h" ]; then usage + if [ "$1" == "-h" ]; then + set -- "-?" + fi fi __scriptpath=$(cd "$(dirname "$0")"; pwd -P) __workingDir=$(pwd -P) -if [ "$1" != "" ]; then +if [ "$1" != "" ] && [[ "$1" != -* ]]; then if [ -d $__workingDir/$1 ]; then $__scriptpath/run.sh build-directory -directory:$__workingDir/$* exit $? diff --git a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json index a189c04748..4ab48e9fb7 100644 --- a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json +++ b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux-Crossbuild.json @@ -1,11 +1,13 @@ { "build": [ { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Change permissions to agent folder for cleanup steps", "timeoutInMinutes": 0, + "refName": "Task1", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -19,11 +21,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Delete files from $(PB_GitDirectory)", "timeoutInMinutes": 0, + "refName": "Task2", "task": { "id": "b7e8b412-0437-4065-9371-edc5881de25b", "versionSpec": "1.*", @@ -35,11 +39,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git clone", "timeoutInMinutes": 0, + "refName": "Task3", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -53,11 +59,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git checkout", "timeoutInMinutes": 0, + "refName": "Task4", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -71,11 +79,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Initialize tools", "timeoutInMinutes": 0, + "refName": "Task5", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -89,11 +99,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Initialize Docker", "timeoutInMinutes": 0, + "refName": "Task6", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -107,11 +119,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Generate Version Assets", "timeoutInMinutes": 0, + "refName": "Task7", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -125,11 +139,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run sync.sh", "timeoutInMinutes": 0, + "refName": "Task8", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -143,11 +159,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run build.sh", "timeoutInMinutes": 0, + "refName": "Task9", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -161,11 +179,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run publish-packages.sh", "timeoutInMinutes": 0, + "refName": "Task10", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -179,30 +199,57 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": true, - "displayName": "Copy Publish Artifact: BuildLogs", + "displayName": "Copy Files to: $(Build.StagingDirectory)\\BuildLogs", "timeoutInMinutes": 0, + "refName": "CopyFiles1", "task": { - "id": "1d341bb0-2106-458c-8422-d00bcea6512a", + "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "SourceFolder": "$(PB_GitDirectory)", + "Contents": "*.log", + "TargetFolder": "$(Build.StagingDirectory)\\BuildLogs", + "CleanTargetFolder": "false", + "OverWrite": "false", + "flattenFolders": "false" + } + }, + { + "environment": {}, + "enabled": true, + "continueOnError": true, + "alwaysRun": true, + "displayName": "Publish Artifact: BuildLogs", + "timeoutInMinutes": 0, + "refName": "PublishBuildArtifacts2", + "task": { + "id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "CopyRoot": "$(PB_GitDirectory)", - "Contents": "*.log", + "PathtoPublish": "$(Build.StagingDirectory)\\BuildLogs", "ArtifactName": "BuildLogs", "ArtifactType": "Container", - "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)" + "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)", + "Parallel": "false", + "ParallelCount": "8" } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": true, "displayName": "Cleanup Docker", "timeoutInMinutes": 0, + "refName": "Task12", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -216,11 +263,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": true, "displayName": "Cleanup VSTS Agent", "timeoutInMinutes": 0, + "refName": "Task13", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -245,27 +294,6 @@ "additionalFields": "{}" } }, - { - "enabled": false, - "definition": { - "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" - }, - "inputs": { - "additionalFields": "{}" - } - }, - { - "enabled": false, - "definition": { - "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" - }, - "inputs": { - "multipliers": "[]", - "parallel": "false", - "continueOnError": "true", - "additionalFields": "{}" - } - }, { "enabled": false, "definition": { @@ -329,7 +357,7 @@ "value": "microsoft/dotnet-buildtools-prereqs" }, "PB_DockerTag": { - "value": "ubuntu-14.04-cross-0cd4667-20172211042239", + "value": "ubuntu-14.04-cross-0cd4667-20170319080304", "allowOverride": true }, "PB_DockerVolumeName": { @@ -426,13 +454,14 @@ "name": "DotNet-CoreFx-Trusted-Linux-Crossbuild", "path": "\\", "type": "build", + "queueStatus": "enabled", "project": { "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", "name": "DevDiv", "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", "state": "wellFormed", - "revision": 418097767, - "visibility": "private" + "revision": 418098167, + "visibility": "organization" } -} \ No newline at end of file +} diff --git a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux.json b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux.json index f5469b2e3c..5eaeb4717e 100644 --- a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux.json +++ b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Linux.json @@ -1,11 +1,13 @@ { "build": [ { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Change permissions to agent folder for cleanup steps", "timeoutInMinutes": 0, + "refName": "Task1", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -19,11 +21,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": false, "displayName": "Delete files from $(PB_GitDirectory)", "timeoutInMinutes": 0, + "refName": "Task2", "task": { "id": "b7e8b412-0437-4065-9371-edc5881de25b", "versionSpec": "1.*", @@ -35,11 +39,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git clone", "timeoutInMinutes": 0, + "refName": "Task3", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -53,11 +59,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git checkout", "timeoutInMinutes": 0, + "refName": "Task4", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -71,47 +79,73 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Initialize tools", + "displayName": "Create host machine tools sandbox", "timeoutInMinutes": 0, "task": { - "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", - "versionSpec": "1.*", + "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c", + "versionSpec": "2.*", "definitionType": "task" }, "inputs": { - "filename": "$(PB_GitDirectory)/init-tools.sh", - "arguments": "", - "workingFolder": "$(PB_GitDirectory)", - "failOnStandardError": "false" + "SourceFolder": "$(PB_GitDirectory)", + "Contents": "init-tools.sh\nBuildToolsVersion.txt\nDotnetCLIVersion.txt\ninit-tools.msbuild", + "TargetFolder": "$(DockerHost_Sandbox)", + "CleanTargetFolder": "false", + "OverWrite": "false", + "flattenFolders": "false" } }, { "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Initialize Docker", + "displayName": "Initialize tools in sandbox for host machine", "timeoutInMinutes": 0, + "refName": "Task5", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "filename": "$(Build.SourcesDirectory)/corefx/Tools/scripts/docker/init-docker.sh", + "filename": "$(DockerHost_Sandbox)/init-tools.sh", + "arguments": "", + "workingFolder": "", + "failOnStandardError": "false" + } + }, + { + "environment": {}, + "enabled": true, + "continueOnError": false, + "alwaysRun": false, + "displayName": "Initialize Docker", + "timeoutInMinutes": 0, + "refName": "Task6", + "task": { + "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", + "versionSpec": "1.*", + "definitionType": "task" + }, + "inputs": { + "filename": "$(DockerHost_ToolsDirectory)/scripts/docker/init-docker.sh", "arguments": "$(PB_DockerImageName)", "workingFolder": "", "failOnStandardError": "false" } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Generate version assets", "timeoutInMinutes": 0, + "refName": "Task7", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -125,11 +159,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run sync", "timeoutInMinutes": 0, + "refName": "Task8", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -143,11 +179,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run build.sh", "timeoutInMinutes": 0, + "refName": "Task9", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -161,11 +199,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Build tests", "timeoutInMinutes": 0, + "refName": "Task10", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -179,11 +219,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Create Helix Test Jobs", "timeoutInMinutes": 0, + "refName": "Task11", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -197,11 +239,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Push packages to Azure", "timeoutInMinutes": 0, + "refName": "Task12", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -215,57 +259,86 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": true, - "displayName": "Copy Publish Artifact: BuildLogs", + "displayName": "Copy Files to: $(Build.StagingDirectory)\\BuildLogs", "timeoutInMinutes": 0, + "refName": "CopyFiles1", "task": { - "id": "1d341bb0-2106-458c-8422-d00bcea6512a", + "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "SourceFolder": "$(PB_GitDirectory)", + "Contents": "*.log", + "TargetFolder": "$(Build.StagingDirectory)\\BuildLogs", + "CleanTargetFolder": "false", + "OverWrite": "false", + "flattenFolders": "false" + } + }, + { + "environment": {}, + "enabled": true, + "continueOnError": true, + "alwaysRun": true, + "displayName": "Publish Artifact: BuildLogs", + "timeoutInMinutes": 0, + "refName": "PublishBuildArtifacts2", + "task": { + "id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "CopyRoot": "$(PB_GitDirectory)", - "Contents": "*.log", + "PathtoPublish": "$(Build.StagingDirectory)\\BuildLogs", "ArtifactName": "BuildLogs", "ArtifactType": "Container", - "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)" + "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)", + "Parallel": "false", + "ParallelCount": "8" } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": true, "displayName": "Cleanup Docker", "timeoutInMinutes": 0, + "refName": "Task14", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "filename": "$(PB_GitDirectory)/Tools/scripts/docker/cleanup-docker.sh", + "filename": "$(DockerHost_ToolsDirectory)/scripts/docker/cleanup-docker.sh", "arguments": "", "workingFolder": "", "failOnStandardError": "false" } }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": true, "displayName": "Cleanup VSTS Agent", "timeoutInMinutes": 0, + "refName": "Task15", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "filename": "$(PB_GitDirectory)/Tools/msbuild.sh", + "filename": "$(DockerHost_ToolsDirectory)/msbuild.sh", "arguments": "cleanupagent.proj /p:AgentDirectory=$(Agent.HomeDirectory) /p:DoClean=$(PB_CleanAgent)", - "workingFolder": "$(PB_GitDirectory)/Tools/scripts/vstsagent/", + "workingFolder": "$(DockerHost_ToolsDirectory)/scripts/vstsagent/", "failOnStandardError": "false" } } @@ -281,27 +354,6 @@ "additionalFields": "{}" } }, - { - "enabled": false, - "definition": { - "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" - }, - "inputs": { - "additionalFields": "{}" - } - }, - { - "enabled": false, - "definition": { - "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" - }, - "inputs": { - "multipliers": "[]", - "parallel": "false", - "continueOnError": "true", - "additionalFields": "{}" - } - }, { "enabled": false, "definition": { @@ -328,6 +380,12 @@ "value": null, "isSecret": true }, + "DockerHost_Sandbox": { + "value": "$(Build.StagingDirectory)/HostSandbox" + }, + "DockerHost_ToolsDirectory": { + "value": "$(DockerHost_Sandbox)/Tools" + }, "OfficialBuildId": { "value": "$(Build.BuildNumber)", "allowOverride": true @@ -373,7 +431,7 @@ "value": "microsoft/dotnet-buildtools-prereqs" }, "PB_DockerTag": { - "value": "rhel7_prereqs_2", + "value": "centos-7-d485f41-20173404063424", "allowOverride": true }, "PB_DockerVolumeName": { @@ -391,7 +449,7 @@ "allowOverride": true }, "PB_TargetQueue": { - "value": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1610.Amd64+Ubuntu.1704.Amd64+suse.422.amd64+SLES.12.Amd64+fedora.25.amd64+Fedora.26.Amd64" + "value": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1704.Amd64+suse.422.amd64+SLES.12.Amd64+fedora.25.amd64+Fedora.26.Amd64" }, "PB_VsoAccountName": { "value": "dn-bot" @@ -444,7 +502,9 @@ "fetchDepth": "0", "gitLfsSupport": "false", "skipSyncSource": "true", - "cleanOptions": "0" + "cleanOptions": "0", + "checkoutNestedSubmodules": "false", + "labelSourcesFormat": "$(build.buildNumber)" }, "id": "58fa2458-e392-4373-ba2b-dd3ef0c2d7ce", "type": "TfsGit", @@ -468,13 +528,14 @@ "name": "DotNet-CoreFx-Trusted-Linux", "path": "\\", "type": "build", + "queueStatus": "enabled", "project": { "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", "name": "DevDiv", "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", "state": "wellFormed", - "revision": 418097767, - "visibility": "private" + "revision": 418098167, + "visibility": "organization" } -} \ No newline at end of file +} diff --git a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-OSX.json b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-OSX.json index 0835a0e643..c7bba81ce2 100644 --- a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-OSX.json +++ b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-OSX.json @@ -1,11 +1,13 @@ { "build": [ { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Delete files from $(Agent.BuildDirectory)/s", "timeoutInMinutes": 0, + "refName": "Task1", "task": { "id": "b7e8b412-0437-4065-9371-edc5881de25b", "versionSpec": "1.*", @@ -17,11 +19,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git clone", "timeoutInMinutes": 0, + "refName": "Task2", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -35,11 +39,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git checkout", "timeoutInMinutes": 0, + "refName": "Task3", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -53,11 +59,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Agent.BuildDirectory)/s/corefx/clean.sh", "timeoutInMinutes": 0, + "refName": "Task4", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -71,11 +79,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Agent.BuildDirectory)/s/corefx/sync.sh", "timeoutInMinutes": 0, + "refName": "Task5", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -89,11 +99,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Generate Native Version Assets", "timeoutInMinutes": 0, + "refName": "Task6", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -107,11 +119,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Agent.BuildDirectory)/s/corefx/build.sh", "timeoutInMinutes": 0, + "refName": "Task7", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -125,11 +139,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Agent.BuildDirectory)/s/corefx/build-tests.sh", "timeoutInMinutes": 0, + "refName": "Task8", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -143,11 +159,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Create Helix Test Jobs", "timeoutInMinutes": 0, + "refName": "Task9", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -161,11 +179,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Push packages to Azure", "timeoutInMinutes": 0, + "refName": "Task10", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -179,38 +199,51 @@ } }, { + "environment": {}, "enabled": true, - "continueOnError": false, + "continueOnError": true, "alwaysRun": true, - "displayName": "Copy Publish Artifact: BuildLogs", + "displayName": "Copy Files to: $(Build.StagingDirectory)\\BuildLogs", "timeoutInMinutes": 0, + "refName": "CopyFiles1", "task": { - "id": "1d341bb0-2106-458c-8422-d00bcea6512a", + "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "SourceFolder": "", + "Contents": "*.log\n$(Agent.BuildDirectory)/s/corefx/*.log", + "TargetFolder": "$(Build.StagingDirectory)\\BuildLogs", + "CleanTargetFolder": "false", + "OverWrite": "false", + "flattenFolders": "false" + } + }, + { + "environment": {}, + "enabled": true, + "continueOnError": true, + "alwaysRun": true, + "displayName": "Publish Artifact: BuildLogs", + "timeoutInMinutes": 0, + "refName": "PublishBuildArtifacts2", + "task": { + "id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "CopyRoot": "", - "Contents": "*.log\n$(Agent.BuildDirectory)/s/corefx/*.log", + "PathtoPublish": "$(Build.StagingDirectory)\\BuildLogs", "ArtifactName": "BuildLogs", "ArtifactType": "Container", - "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)" + "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)", + "Parallel": "false", + "ParallelCount": "8" } } ], "options": [ - { - "enabled": false, - "definition": { - "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" - }, - "inputs": { - "multipliers": "[]", - "parallel": "false", - "continueOnError": "true", - "additionalFields": "{}" - } - }, { "enabled": false, "definition": { @@ -230,6 +263,16 @@ "inputs": { "additionalFields": "{}" } + }, + { + "enabled": false, + "definition": { + "id": "5d58cc01-7c75-450c-be18-a388ddb129ec" + }, + "inputs": { + "branchFilters": "[\"+refs/heads/*\"]", + "additionalFields": "{}" + } } ], "variables": { @@ -308,6 +351,7 @@ "buildNumberFormat": "$(date:yyyyMMdd)$(rev:-rr)", "jobAuthorizationScope": "projectCollection", "jobTimeoutInMinutes": 60, + "jobCancelTimeoutInMinutes": 5, "repository": { "properties": { "labelSources": "0", @@ -315,7 +359,9 @@ "fetchDepth": "0", "gitLfsSupport": "false", "skipSyncSource": "true", - "cleanOptions": "3" + "cleanOptions": "3", + "checkoutNestedSubmodules": "false", + "labelSourcesFormat": "$(build.buildNumber)" }, "id": "0a2b2664-c1be-429c-9b40-8a24dee27a4a", "type": "TfsGit", @@ -325,25 +371,28 @@ "clean": "false", "checkoutSubmodules": false }, + "processParameters": {}, "quality": "definition", "queue": { + "id": 330, + "name": "DotNetCore-Build", "pool": { "id": 97, "name": "DotNetCore-Build" - }, - "id": 330, - "name": "DotNetCore-Build" + } }, - "path": "\\", - "type": "build", "id": 1053, "name": "DotNet-CoreFx-Trusted-OSX", + "path": "\\", + "type": "build", + "queueStatus": "enabled", "project": { "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", "name": "DevDiv", "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", "state": "wellFormed", - "revision": 418097459 + "revision": 418098167, + "visibility": "organization" } -} +} \ No newline at end of file diff --git a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json index 6f51006a96..f980cf4753 100644 --- a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json +++ b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows-NoTest.json @@ -1,11 +1,13 @@ { "build": [ { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Delete 'corefx'", "timeoutInMinutes": 0, + "refName": "Task1", "task": { "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", "versionSpec": "1.*", @@ -15,17 +17,19 @@ "scriptType": "inlineScript", "scriptName": "", "arguments": "-path $(build.SourcesDirectory)\\corefx", - "inlineScript": "param($path)\n\nif (Test-Path $path){\n Stop-Process -processname msbuild -ErrorAction Ignore -Verbose\n Stop-Process -processname dotnet -ErrorAction Ignore -Verbose\n Stop-Process -processname vbcscompiler -ErrorAction Ignore -Verbose\n # this will print out an error each time a file can't be deleted.\n Remove-Item -Recurse -Force $path\n }\n", "workingFolder": "", + "inlineScript": "param($path)\n\nif (Test-Path $path){\n Stop-Process -processname msbuild -ErrorAction Ignore -Verbose\n Stop-Process -processname dotnet -ErrorAction Ignore -Verbose\n Stop-Process -processname vbcscompiler -ErrorAction Ignore -Verbose\n # this will print out an error each time a file can't be deleted.\n Remove-Item -Recurse -Force $path\n }\n", "failOnStandardError": "true" } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git clone", "timeoutInMinutes": 0, + "refName": "Task2", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -39,11 +43,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git checkout", "timeoutInMinutes": 0, + "refName": "Task3", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -57,29 +63,34 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Install Signing Plugin", "timeoutInMinutes": 0, + "condition": "ne(variables['PB_SignType'], 'oss')", + "refName": "Task4", "task": { "id": "30666190-6959-11e5-9f96-f56098202fef", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "signType": "$(PB_SignType)", + "signType": "real", "zipSources": "false", "version": "", "feedSource": "https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json" } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\clean.cmd", "timeoutInMinutes": 0, + "refName": "Task5", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -93,11 +104,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\sync.cmd", "timeoutInMinutes": 0, + "refName": "Task6", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -111,11 +124,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Generate Version Assets", "timeoutInMinutes": 0, + "refName": "Task7", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -129,11 +144,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\build.cmd", "timeoutInMinutes": 0, + "refName": "Task8", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -147,11 +164,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Push packages to Azure", "timeoutInMinutes": 0, + "refName": "Task9", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -165,30 +184,57 @@ } }, { + "environment": {}, "enabled": true, - "continueOnError": false, + "continueOnError": true, "alwaysRun": true, - "displayName": "Copy Publish Artifact: BuildLogs", + "displayName": "Copy Files to: $(Build.StagingDirectory)\\BuildLogs", "timeoutInMinutes": 0, + "refName": "CopyFiles1", "task": { - "id": "1d341bb0-2106-458c-8422-d00bcea6512a", + "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "SourceFolder": "$(Build.SourcesDirectory)\\corefx", + "Contents": "*.log", + "TargetFolder": "$(Build.StagingDirectory)\\BuildLogs", + "CleanTargetFolder": "false", + "OverWrite": "false", + "flattenFolders": "false" + } + }, + { + "environment": {}, + "enabled": true, + "continueOnError": true, + "alwaysRun": true, + "displayName": "Publish Artifact: BuildLogs", + "timeoutInMinutes": 0, + "refName": "PublishBuildArtifacts2", + "task": { + "id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "CopyRoot": "", - "Contents": "*.log\ncorefx\\*.log\ncorefx\\src\\*.log", + "PathtoPublish": "$(Build.StagingDirectory)\\BuildLogs", "ArtifactName": "BuildLogs", "ArtifactType": "Container", - "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)" + "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)", + "Parallel": "false", + "ParallelCount": "8" } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Index symbol sources", "timeoutInMinutes": 0, + "refName": "Task11", "task": { "id": "0675668a-7bba-4ccb-901d-5ad6554ca653", "versionSpec": "1.*", @@ -207,11 +253,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, - "alwaysRun": true, + "alwaysRun": false, "displayName": "Execute cleanup tasks", "timeoutInMinutes": 0, + "refName": "Task12", "task": { "id": "521a94ea-9e68-468a-8167-6dcf361ea776", "versionSpec": "1.*", @@ -220,11 +268,13 @@ "inputs": {} }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": false, "displayName": "Final clean to remove any lingering process", "timeoutInMinutes": 0, + "refName": "Task13", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -238,11 +288,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": true, - "alwaysRun": true, + "alwaysRun": false, "displayName": "Build solution corefx\\Tools\\scripts\\vstsagent\\cleanupagent.proj", "timeoutInMinutes": 0, + "refName": "Task14", "task": { "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", "versionSpec": "1.*", @@ -250,6 +302,10 @@ }, "inputs": { "solution": "corefx\\Tools\\scripts\\vstsagent\\cleanupagent.proj", + "msbuildLocationMethod": "version", + "msbuildVersion": "14.0", + "msbuildArchitecture": "x86", + "msbuildLocation": "", "platform": "", "configuration": "", "msbuildArguments": "/p:AgentDirectory=$(Agent.HomeDirectory) /p:DoClean=$(PB_CleanAgent)", @@ -257,27 +313,11 @@ "maximumCpuCount": "false", "restoreNugetPackages": "false", "logProjectEvents": "false", - "createLogFile": "false", - "msbuildLocationMethod": "version", - "msbuildVersion": "14.0", - "msbuildArchitecture": "x86", - "msbuildLocation": "" + "createLogFile": "false" } } ], "options": [ - { - "enabled": false, - "definition": { - "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" - }, - "inputs": { - "multipliers": "[]", - "parallel": "false", - "continueOnError": "true", - "additionalFields": "{}" - } - }, { "enabled": false, "definition": { @@ -297,6 +337,16 @@ "inputs": { "additionalFields": "{}" } + }, + { + "enabled": false, + "definition": { + "id": "5d58cc01-7c75-450c-be18-a388ddb129ec" + }, + "inputs": { + "branchFilters": "[\"+refs/heads/*\"]", + "additionalFields": "{}" + } } ], "variables": { @@ -366,7 +416,11 @@ "allowOverride": true }, "PB_BuildArguments": { - "value": "-buildArch=x64 -Release -- /p:SignType=test /p:RuntimeOS=win10", + "value": "-buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", + "allowOverride": true + }, + "PB_SignType": { + "value": "real", "allowOverride": true } }, @@ -392,6 +446,7 @@ "buildNumberFormat": "$(date:yyyyMMdd)$(rev:-rr)", "jobAuthorizationScope": "projectCollection", "jobTimeoutInMinutes": 180, + "jobCancelTimeoutInMinutes": 5, "repository": { "properties": { "labelSources": "0", @@ -399,7 +454,9 @@ "fetchDepth": "0", "gitLfsSupport": "false", "skipSyncSource": "true", - "cleanOptions": "3" + "cleanOptions": "3", + "checkoutNestedSubmodules": "false", + "labelSourcesFormat": "$(build.buildNumber)" }, "id": "0a2b2664-c1be-429c-9b40-8a24dee27a4a", "type": "TfsGit", @@ -409,26 +466,28 @@ "clean": "false", "checkoutSubmodules": false }, + "processParameters": {}, "quality": "definition", "queue": { + "id": 36, + "name": "DotNet-Build", "pool": { "id": 39, "name": "DotNet-Build" - }, - "id": 36, - "name": "DotNet-Build" + } }, - "path": "\\", - "type": "build", "id": 5308, "name": "DotNet-CoreFx-Trusted-Windows-NoTest", - "url": "https://devdiv.visualstudio.com/DefaultCollection/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_apis/build/Definitions/5308", + "path": "\\", + "type": "build", + "queueStatus": "enabled", "project": { "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", "name": "DevDiv", "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", "state": "wellFormed", - "revision": 418097529 + "revision": 418098167, + "visibility": "organization" } -} \ No newline at end of file +} diff --git a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows.json b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows.json index 6f762a7d45..207cd5d247 100644 --- a/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows.json +++ b/external/corefx/buildpipeline/DotNet-CoreFx-Trusted-Windows.json @@ -1,11 +1,13 @@ { "build": [ { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Delete 'corefx'", "timeoutInMinutes": 0, + "refName": "Task1", "task": { "id": "e213ff0f-5d5c-4791-802d-52ea3e7be1f1", "versionSpec": "1.*", @@ -21,11 +23,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git clone", "timeoutInMinutes": 0, + "refName": "Task2", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -39,11 +43,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "git checkout", "timeoutInMinutes": 0, + "refName": "Task3", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -57,29 +63,34 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Install Signing Plugin", "timeoutInMinutes": 0, + "condition": "ne(variables['PB_SignType'], 'oss')", + "refName": "Task4", "task": { "id": "30666190-6959-11e5-9f96-f56098202fef", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "signType": "$(PB_SignType)", + "signType": "real", "zipSources": "false", "version": "", "feedSource": "https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json" } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\clean.cmd", "timeoutInMinutes": 0, + "refName": "Task5", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -93,11 +104,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\sync.cmd", "timeoutInMinutes": 0, + "refName": "Task6", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -111,11 +124,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Generate Version Assets", "timeoutInMinutes": 0, + "refName": "Task7", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -129,11 +144,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\build.cmd", "timeoutInMinutes": 0, + "refName": "Task8", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -147,11 +164,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Run $(Build.SourcesDirectory)\\corefx\\build-tests.cmd", "timeoutInMinutes": 0, + "refName": "Task9", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -165,11 +184,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Create Helix Test Jobs", "timeoutInMinutes": 0, + "refName": "Task10", "task": { "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", "versionSpec": "1.*", @@ -183,7 +204,7 @@ "msbuildLocation": "", "platform": "", "configuration": "", - "msbuildArguments": "$(PB_CreateHelixArguments) /p:\"Branch=$(SourceBranch)\" /p:\"CloudDropConnectionString=DefaultEndpointsProtocol=https;AccountName=$(PB_CloudDropAccountName);AccountKey=$(CloudDropAccessToken);EndpointSuffix=core.windows.net\" /p:\"CloudResultsConnectionString=DefaultEndpointsProtocol=https;AccountName=$(PB_CloudResultsAccountName);AccountKey=$(OutputCloudResultsAccessToken);EndpointSuffix=core.windows.net\" /p:\"HelixApiAccessKey=$(HelixApiAccessKey)\" /p:\"HelixApiEndpoint=$(PB_HelixApiEndPoint)\" /p:\"OfficialBuildId=$(OfficialBuildId)\"", + "msbuildArguments": "$(PB_CreateHelixArguments) /p:\"Branch=$(SourceBranch)\" /p:\"CloudDropConnectionString=DefaultEndpointsProtocol=https;AccountName=$(PB_CloudDropAccountName);AccountKey=$(CloudDropAccessToken);EndpointSuffix=core.windows.net\" /p:\"CloudResultsConnectionString=DefaultEndpointsProtocol=https;AccountName=$(PB_CloudResultsAccountName);AccountKey=$(OutputCloudResultsAccessToken);EndpointSuffix=core.windows.net\" /p:\"HelixApiAccessKey=$(HelixApiAccessKey)\" /p:\"HelixApiEndpoint=$(PB_HelixApiEndPoint)\" /p:TargetQueues=$(PB_TargetQueue) /p:\"OfficialBuildId=$(OfficialBuildId)\"", "clean": "false", "maximumCpuCount": "false", "restoreNugetPackages": "false", @@ -192,11 +213,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Push packages to Azure", "timeoutInMinutes": 0, + "refName": "Task11", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -210,30 +233,57 @@ } }, { + "environment": {}, "enabled": true, - "continueOnError": false, - "alwaysRun": false, - "displayName": "Copy Publish Artifact: BuildLogs", + "continueOnError": true, + "alwaysRun": true, + "displayName": "Copy Files to: $(Build.StagingDirectory)\\BuildLogs", "timeoutInMinutes": 0, + "refName": "CopyFiles1", "task": { - "id": "1d341bb0-2106-458c-8422-d00bcea6512a", + "id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c", + "versionSpec": "2.*", + "definitionType": "task" + }, + "inputs": { + "SourceFolder": "$(Build.SourcesDirectory)\\corefx", + "Contents": "*.log", + "TargetFolder": "$(Build.StagingDirectory)\\BuildLogs", + "CleanTargetFolder": "false", + "OverWrite": "false", + "flattenFolders": "false" + } + }, + { + "environment": {}, + "enabled": true, + "continueOnError": true, + "alwaysRun": true, + "displayName": "Publish Artifact: BuildLogs", + "timeoutInMinutes": 0, + "refName": "PublishBuildArtifacts2", + "task": { + "id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe", "versionSpec": "1.*", "definitionType": "task" }, "inputs": { - "CopyRoot": "", - "Contents": "*.log\ncorefx\\*.log\ncorefx\\src\\*.log", + "PathtoPublish": "$(Build.StagingDirectory)\\BuildLogs", "ArtifactName": "BuildLogs", "ArtifactType": "Container", - "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)" + "TargetPath": "\\\\my\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)", + "Parallel": "false", + "ParallelCount": "8" } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Index symbol sources", "timeoutInMinutes": 0, + "refName": "Task13", "task": { "id": "0675668a-7bba-4ccb-901d-5ad6554ca653", "versionSpec": "1.*", @@ -252,11 +302,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": false, "alwaysRun": false, "displayName": "Execute cleanup tasks", "timeoutInMinutes": 0, + "refName": "Task14", "task": { "id": "521a94ea-9e68-468a-8167-6dcf361ea776", "versionSpec": "1.*", @@ -265,11 +317,13 @@ "inputs": {} }, { + "environment": {}, "enabled": true, "continueOnError": true, "alwaysRun": false, "displayName": "Final clean to remove any lingering process", "timeoutInMinutes": 0, + "refName": "Task15", "task": { "id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9", "versionSpec": "1.*", @@ -283,11 +337,13 @@ } }, { + "environment": {}, "enabled": true, "continueOnError": true, - "alwaysRun": true, + "alwaysRun": false, "displayName": "Build solution corefx\\Tools\\scripts\\vstsagent\\cleanupagent.proj", "timeoutInMinutes": 0, + "refName": "Task16", "task": { "id": "c6c4c611-aa2e-4a33-b606-5eaba2196824", "versionSpec": "1.*", @@ -321,27 +377,6 @@ "additionalFields": "{}" } }, - { - "enabled": false, - "definition": { - "id": "5bc3cfb7-6b54-4a4b-b5d2-a3905949f8a6" - }, - "inputs": { - "additionalFields": "{}" - } - }, - { - "enabled": false, - "definition": { - "id": "7c555368-ca64-4199-add6-9ebaf0b0137d" - }, - "inputs": { - "multipliers": "[]", - "parallel": "false", - "continueOnError": "true", - "additionalFields": "{}" - } - }, { "enabled": false, "definition": { @@ -373,7 +408,7 @@ "allowOverride": true }, "PB_BuildArguments": { - "value": "-buildArch=x64 -Release -- /p:SignType=test /p:RuntimeOS=win10", + "value": "-buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "allowOverride": true }, "PB_BuildTestsArguments": { @@ -390,8 +425,11 @@ "value": "Debug", "allowOverride": true }, + "PB_TargetQueue": { + "value": "Windows.10.Amd64" + }, "PB_CreateHelixArguments": { - "value": "/t:CloudBuild /p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=true\" /p:\"BuildMoniker=none\" /p:\"TargetQueue=Windows.10.Amd64\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:FilterToOSGroup=Windows_NT", + "value": "/t:CloudBuild /p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"EnableCloudTest=true\" /p:\"BuildMoniker=none\" /p:\"TargetQueue=$(PB_TargetQueue)\" /p:\"TestProduct=corefx\" /p:\"TimeoutInSeconds=1200\" /p:\"TargetOS=Windows_NT\" /p:FilterToOSGroup=Windows_NT", "allowOverride": true }, "PB_Git": { @@ -463,7 +501,8 @@ "isSecret": true }, "PB_SignType": { - "value": "real" + "value": "real", + "allowOverride": true } }, "demands": [ @@ -521,13 +560,14 @@ "name": "DotNet-CoreFx-Trusted-Windows", "path": "\\", "type": "build", + "queueStatus": "enabled", "project": { "id": "0bdbc590-a062-4c3f-b0f6-9383f67865ee", "name": "DevDiv", "description": "Visual Studio and DevDiv team project for git source code repositories. Work items will be added for Adams, Dev14 work items are tracked in vstfdevdiv. ", "url": "https://devdiv.visualstudio.com/DefaultCollection/_apis/projects/0bdbc590-a062-4c3f-b0f6-9383f67865ee", "state": "wellFormed", - "revision": 418097767, - "visibility": "private" + "revision": 418098167, + "visibility": "organization" } -} \ No newline at end of file +} diff --git a/external/corefx/buildpipeline/DotNet-Trusted-Publish.json b/external/corefx/buildpipeline/DotNet-Trusted-Publish.json index 505173c672..9d04c76464 100644 --- a/external/corefx/buildpipeline/DotNet-Trusted-Publish.json +++ b/external/corefx/buildpipeline/DotNet-Trusted-Publish.json @@ -6,7 +6,7 @@ "alwaysRun": false, "displayName": "Install Signing Plugin", "timeoutInMinutes": 0, - "condition": "succeeded()", + "condition": "and(succeeded(), ne(variables['PB_SignType'], 'oss'))", "task": { "id": "30666190-6959-11e5-9f96-f56098202fef", "versionSpec": "1.*", @@ -113,9 +113,9 @@ "inputs": { "scriptType": "inlineScript", "scriptName": "", - "arguments": "-ConfigGroup $(PB_ConfigurationGroup) -SymPkgGlob $(PB_AzureContainerSymbolPackageGlob) -PipelineSrcDir $(Pipeline.SourcesDirectory)", + "arguments": "-ConfigGroup $(PB_ConfigurationGroup) -SymPkgGlob $(PB_AzureContainerSymbolPackageGlob) -PipelineSrcDir $(Pipeline.SourcesDirectory) -SignType $(PB_SignType)", "workingFolder": "$(Pipeline.SourcesDirectory)", - "inlineScript": "param($ConfigGroup, $SymPkgGlob, $PipelineSrcDir)\n\n.\\build-managed.cmd -- /t:InjectSignedSymbolCatalogIntoSymbolPackages `\n/p:SymbolPackagesToPublishGlob=$PipelineSrcDir\\packages\\AzureTransfer\\$ConfigGroup\\$SymPkgGlob `\n/p:SymbolCatalogCertificateId=400", + "inlineScript": "param($ConfigGroup, $SymPkgGlob, $PipelineSrcDir, $SignType=\"unset\" )\n\nif ($SignType.ToLower() -ne \"real\" ) { Write-host \"Chose not to sign symbol catalogs\"; exit }\n\n\n.\\build-managed.cmd -- /t:InjectSignedSymbolCatalogIntoSymbolPackages `\n/p:SymbolPackagesToPublishGlob=$PipelineSrcDir\\packages\\AzureTransfer\\$ConfigGroup\\$SymPkgGlob `\n/p:SymbolCatalogCertificateId=400", "failOnStandardError": "true" } }, @@ -175,7 +175,7 @@ "scriptName": "", "arguments": "-ApiKey $(MyGetApiKey) -ConfigurationGroup $(PB_ConfigurationGroup) -PackagesGlob $(Pipeline.SourcesDirectory)\\packages\\AzureTransfer\\$(PB_ConfigurationGroup)\\$(PB_AzureContainerPackageGlob) -MyGetFeedUrl $(PB_MyGetFeedUrl)", "workingFolder": "$(Pipeline.SourcesDirectory)", - "inlineScript": "param($ApiKey, $ConfigurationGroup, $PackagesGlob, $MyGetFeedUrl)\n\nif ($ConfigurationGroup -ne \"Release\") { exit }\n\n.\\build-managed.cmd -- /t:NuGetPush /v:Normal `\n/p:NuGetExePath=$env:CustomNuGetPath `\n/p:NuGetApiKey=$ApiKey `\n/p:NuGetSource=$MyGetFeedUrl `\n/p:PackagesGlob=$PackagesGlob", + "inlineScript": "param($ApiKey, $ConfigurationGroup, $PackagesGlob, $MyGetFeedUrl, $SignType=\"unset\")\n\nif ($ConfigurationGroup.ToLower() -ne \"release\" ) { Write-host \"Chose not to publish\"; exit }\n\n.\\build-managed.cmd -- /t:NuGetPush /v:Normal `\n/p:NuGetExePath=$env:CustomNuGetPath `\n/p:NuGetApiKey=$ApiKey `\n/p:NuGetSource=$MyGetFeedUrl `\n/p:PackagesGlob=$PackagesGlob", "failOnStandardError": "true" } }, @@ -195,7 +195,7 @@ "scriptName": "", "arguments": "-ApiKey $(MyGetApiKey) -ConfigurationGroup $(PB_ConfigurationGroup) -PackagesGlob $(Build.StagingDirectory)\\IndexedSymbolPackages\\*.nupkg -MyGetFeedUrl $(PB_MyGetFeedUrl)", "workingFolder": "$(Pipeline.SourcesDirectory)", - "inlineScript": "param($ApiKey, $ConfigurationGroup, $PackagesGlob, $MyGetFeedUrl)\n\nif ($ConfigurationGroup -ne \"Release\") { exit }\nif ($env:SourceBranch.StartsWith(\"release/\")) { exit }\n\n.\\build-managed.cmd -- /t:NuGetPush /v:Normal `\n/p:NuGetExePath=$env:CustomNuGetPath `\n/p:NuGetApiKey=$ApiKey `\n/p:NuGetSource=$MyGetFeedUrl `\n/p:PackagesGlob=$PackagesGlob", + "inlineScript": "param($ApiKey, $ConfigurationGroup, $PackagesGlob, $MyGetFeedUrl, $SignType=\"unset\")\n\nif ($ConfigurationGroup.ToLower() -ne \"release\" ) { Write-host \"Chose not to publish\"; exit }\nif ($env:SourceBranch.StartsWith(\"release/\")) { exit }\n\n.\\build-managed.cmd -- /t:NuGetPush /v:Normal `\n/p:NuGetExePath=$env:CustomNuGetPath `\n/p:NuGetApiKey=$ApiKey `\n/p:NuGetSource=$MyGetFeedUrl `\n/p:PackagesGlob=$PackagesGlob", "failOnStandardError": "true" } }, @@ -213,8 +213,8 @@ "inputs": { "scriptType": "inlineScript", "scriptName": "", - "arguments": "-ghAuthToken $(PB_DotNetBuildBotAccessToken) -root $(Pipeline.SourcesDirectory) -cg $(PB_ConfigurationGroup) -fullPkgGlob $(Pipeline.SourcesDirectory)\\packages\\AzureTransfer\\$(PB_ConfigurationGroup)\\$(PB_AzureContainerPackageGlob)", - "inlineScript": "param($ghAuthToken, $root, $cg, $fullPkgGlob)\nif ($cg -ne \"Release\") { exit }\ncd $root\n. $root\\build-managed.cmd -- /t:UpdatePublishedVersions `\n/p:GitHubUser=dotnet-helix-bot `\n/p:GitHubEmail=dotnet-helix-bot@microsoft.com `\n/p:GitHubAuthToken=$ghAuthToken `\n/p:VersionsRepoOwner=$env:PB_VersionsRepoOwner `\n/p:VersionsRepo=versions `\n/p:VersionsRepoPath=build-info/dotnet/$env:PB_GitHubRepositoryName/$env:SourceBranch `\n/p:ShippedNuGetPackageGlobPath=$fullPkgGlob", + "arguments": "-ghAuthToken $(PB_DotNetBuildBotAccessToken) -root $(Pipeline.SourcesDirectory) -cg $(PB_ConfigurationGroup) -fullPkgGlob $(Pipeline.SourcesDirectory)\\packages\\AzureTransfer\\$(PB_ConfigurationGroup)\\$(PB_AzureContainerPackageGlob) ", + "inlineScript": "param($ghAuthToken, $root, $cg, $fullPkgGlob, $SignType=\"unset\")\nif ($cg -ne \"Release\" ) { exit }\ncd $root\n. $root\\build-managed.cmd -- /t:UpdatePublishedVersions `\n/p:GitHubUser=dotnet-helix-bot `\n/p:GitHubEmail=dotnet-helix-bot@microsoft.com `\n/p:GitHubAuthToken=$ghAuthToken `\n/p:VersionsRepoOwner=$env:PB_VersionsRepoOwner `\n/p:VersionsRepo=versions `\n/p:VersionsRepoPath=build-info/dotnet/$env:PB_GitHubRepositoryName/$env:SourceBranch `\n/p:ShippedNuGetPackageGlobPath=$fullPkgGlob", "workingFolder": "", "failOnStandardError": "true" } diff --git a/external/corefx/buildpipeline/centos.6.groovy b/external/corefx/buildpipeline/centos.6.groovy new file mode 100644 index 0000000000..ac14c59bc9 --- /dev/null +++ b/external/corefx/buildpipeline/centos.6.groovy @@ -0,0 +1,68 @@ +@Library('dotnet-ci') _ + +// Incoming parameters. Access with "params.". +// Note that the parameters will be set as env variables so we cannot use names that conflict +// with the engineering system parameter names. +// CGroup - Build configuration. +// TestOuter - If true, runs outerloop, if false runs just innerloop + +def submittedHelixJson = null + +simpleDockerNode('microsoft/dotnet-buildtools-prereqs:centos-6-376e1a3-20174311014331') { + stage ('Checkout source') { + checkoutRepo() + } + + def logFolder = getLogFolder() + + stage ('Initialize tools') { + // Init tools + sh 'LD_LIBRARY_PATH=/usr/local/lib ./init-tools.sh' + } + stage ('Generate version assets') { + // Generate the version assets. Do we need to even do this for non-official builds? + sh "LD_LIBRARY_PATH=/usr/local/lib ./build-managed.sh -runtimeos=rhel.6 -- /t:GenerateVersionSourceFile /p:GenerateVersionSourceFile=true /p:PortableBuild=false" + } + stage ('Sync') { + sh "LD_LIBRARY_PATH=/usr/local/lib ./sync.sh -p -runtimeos=rhel.6 -- /p:ArchGroup=x64 /p:PortableBuild=false" + } + stage ('Build Product') { + sh "LD_LIBRARY_PATH=/usr/local/lib ./build.sh -buildArch=x64 -runtimeos=rhel.6 -${params.CGroup} -- /p:PortableBuild=false" + } + stage ('Build Tests') { + def additionalArgs = '' + if (params.TestOuter) { + additionalArgs = '-Outerloop' + } + sh "LD_LIBRARY_PATH=/usr/local/lib ./build-tests.sh -buildArch=x64 -${params.CGroup} -SkipTests ${additionalArgs} -- /p:ArchiveTests=true /p:EnableDumpling=true /p:PortableBuild=false" + } + stage ('Submit To Helix For Testing') { + // Bind the credentials + withCredentials([string(credentialsId: 'CloudDropAccessToken', variable: 'CloudDropAccessToken'), + string(credentialsId: 'OutputCloudResultsAccessToken', variable: 'OutputCloudResultsAccessToken')]) { + // Ask the CI SDK for a Helix source that makes sense. This ensures that this pipeline works for both PR and non-PR cases + def helixSource = getHelixSource() + // Ask the CI SDK for a Build that makes sense. We currently use the hash for the build + def helixBuild = getCommit() + // Get the user that should be associated with the submission + def helixCreator = getUser() + // Target queues + def targetHelixQueues = ['RedHat.69.Amd64.Open'] + + sh "LD_LIBRARY_PATH=/usr/local/lib ./Tools/msbuild.sh src/upload-tests.proj /p:ArchGroup=x64 /p:ConfigurationGroup=${params.CGroup} /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux /p:HelixJobType=test/functional/cli/ /p:HelixSource=${helixSource} /p:BuildMoniker=${helixBuild} /p:HelixCreator=${helixCreator} /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken=\$CloudDropAccessToken /p:CloudResultsAccessToken=\$OutputCloudResultsAccessToken /p:HelixApiEndpoint=https://helix.dot.net/api/2017-04-14/jobs /p:TargetQueues=${targetHelixQueues.join('+')} /p:HelixLogFolder=${WORKSPACE}/${logFolder}/ /p:HelixCorrelationInfoFileName=SubmittedHelixRuns.txt" + + submittedHelixJson = readJSON file: "${logFolder}/SubmittedHelixRuns.txt" + } + } +} + +stage ('Execute Tests') { + def contextBase + if (params.TestOuter) { + contextBase = "RHEL.6 x64 Tests w/outer - ${params.CGroup}" + } + else { + contextBase = "RHEL.6 x64 Tests - ${params.CGroup}" + } + waitForHelixRuns(submittedHelixJson, contextBase) +} diff --git a/external/corefx/buildpipeline/linux.groovy b/external/corefx/buildpipeline/linux.groovy index 15f1689585..f664cc8f26 100644 --- a/external/corefx/buildpipeline/linux.groovy +++ b/external/corefx/buildpipeline/linux.groovy @@ -10,7 +10,7 @@ def submittedHelixJson = null simpleDockerNode('microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2') { stage ('Checkout source') { - checkout scm + checkoutRepo() } def logFolder = getLogFolder() @@ -52,7 +52,6 @@ simpleDockerNode('microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2') { 'Debian.87.Amd64.Open', 'Ubuntu.1404.Amd64.Open', 'Ubuntu.1604.Amd64.Open', - 'Ubuntu.1610.Amd64.Open', 'suse.422.amd64.Open', 'fedora.25.amd64.Open',] if (params.TestOuter) { diff --git a/external/corefx/buildpipeline/osx.groovy b/external/corefx/buildpipeline/osx.groovy index 113899ab83..075f2ee5ee 100644 --- a/external/corefx/buildpipeline/osx.groovy +++ b/external/corefx/buildpipeline/osx.groovy @@ -10,7 +10,7 @@ def submittedHelixJson = null simpleNode('OSX10.12','latest') { stage ('Checkout source') { - checkout scm + checkoutRepo() } def logFolder = getLogFolder() @@ -35,6 +35,36 @@ simpleNode('OSX10.12','latest') { if (params.TestOuter) { additionalArgs = '-Outerloop' } - sh "HOME=\$WORKSPACE/tempHome ./build-tests.sh -buildArch=x64 -${params.CGroup} ${additionalArgs} -- /p:ArchiveTests=true /p:EnableDumpling=true" + sh "HOME=\$WORKSPACE/tempHome ./build-tests.sh -buildArch=x64 -${params.CGroup} -SkipTests ${additionalArgs} -- /p:ArchiveTests=true /p:EnableDumpling=true" + } + stage ('Submit To Helix For Testing') { + // Bind the credentials + withCredentials([string(credentialsId: 'CloudDropAccessToken', variable: 'CloudDropAccessToken'), + string(credentialsId: 'OutputCloudResultsAccessToken', variable: 'OutputCloudResultsAccessToken')]) { + // Ask the CI SDK for a Helix source that makes sense. This ensures that this pipeline works for both PR and non-PR cases + def helixSource = getHelixSource() + // Ask the CI SDK for a Build that makes sense. We currently use the hash for the build + def helixBuild = getCommit() + // Get the user that should be associated with the submission + def helixCreator = getUser() + // Target queues + def targetHelixQueues = ['OSX.1012.Amd64.Open', + 'OSX.1013.Amd64.Open',] + + sh "HOME=\$WORKSPACE/tempHome ./Tools/msbuild.sh src/upload-tests.proj /p:ArchGroup=x64 /p:ConfigurationGroup=${params.CGroup} /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=OSX /p:HelixJobType=test/functional/cli/ /p:HelixSource=${helixSource} /p:BuildMoniker=${helixBuild} /p:HelixCreator=${helixCreator} /p:CloudDropAccountName=dotnetbuilddrops /p:CloudResultsAccountName=dotnetjobresults /p:CloudDropAccessToken=\$CloudDropAccessToken /p:CloudResultsAccessToken=\$OutputCloudResultsAccessToken /p:HelixApiEndpoint=https://helix.dot.net/api/2017-04-14/jobs /p:TargetQueues=${targetHelixQueues.join('+')} /p:HelixLogFolder=${WORKSPACE}/${logFolder}/ /p:HelixCorrelationInfoFileName=SubmittedHelixRuns.txt" + + submittedHelixJson = readJSON file: "${logFolder}/SubmittedHelixRuns.txt" + } } } + +stage ('Execute Tests') { + def contextBase + if (params.TestOuter) { + contextBase = "OSX x64 Tests w/outer - ${params.CGroup}" + } + else { + contextBase = "OSX x64 Tests - ${params.CGroup}" + } + waitForHelixRuns(submittedHelixJson, contextBase) +} diff --git a/external/corefx/buildpipeline/pipeline.json b/external/corefx/buildpipeline/pipeline.json index 8523ce86cd..2210ed41ee 100644 --- a/external/corefx/buildpipeline/pipeline.json +++ b/external/corefx/buildpipeline/pipeline.json @@ -17,11 +17,11 @@ "Definitions": [{ "Name": "DotNet-CoreFx-Trusted-Linux", "Parameters": { - "PB_DockerTag": "rhel7_prereqs_2", + "PB_DockerTag": "centos-7-d485f41-20173404063424", "PB_BuildArguments": "-buildArch=x64 -Release -stripSymbols", "PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -- /p:ArchiveTests=true /p:EnableDumpling=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64", - "PB_TargetQueue": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1610.Amd64+Ubuntu.1704.Amd64+suse.422.amd64+SLES.12.Amd64+fedora.25.amd64+Fedora.26.Amd64", + "PB_TargetQueue": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1704.Amd64+Ubuntu.1710.Amd64+suse.422.amd64+SLES.12.Amd64+fedora.25.amd64+Fedora.26.Amd64", "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux" }, "ReportingParameters": { @@ -31,10 +31,27 @@ "ConfigurationGroup": "Release" } }, + { + "Name": "DotNet-CoreFx-Trusted-Linux", + "Parameters": { + "PB_DockerTag": "centos-6-376e1a3-20174311014331", + "PB_BuildArguments": "-buildArch=x64 -Release -stripSymbols -RuntimeOS=rhel.6 -- /p:PortableBuild=false", + "PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -RuntimeOS=rhel.6 -- /p:ArchiveTests=true /p:EnableDumpling=true /p:PortableBuild=false", + "PB_SyncArguments": "-p -RuntimeOS=rhel.6 -- /p:ArchGroup=x64 /p:PortableBuild=false", + "PB_TargetQueue": "RedHat.69.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux" + }, + "ReportingParameters": { + "OperatingSystem": "RedHat6", + "Platform": "x64", + "Type": "build/product/", + "ConfigurationGroup": "Release" + } + }, { "Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild", "Parameters": { - "PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239", + "PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20170319080304", "PB_Architecture": "arm", "PB_BuildArguments": "-buildArch=arm -Release -stripSymbols", "PB_SyncArguments": "-p -- /p:ArchGroup=arm" @@ -90,7 +107,7 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "arm", - "PB_BuildArguments": "-buildArch=arm -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-buildArch=arm -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-buildArch=arm -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10", "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:ConfigurationGroup=Release /p:EnableCloudTest=false /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT" @@ -107,7 +124,7 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "arm64", - "PB_BuildArguments": "-buildArch=arm64 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-buildArch=arm64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-buildArch=arm64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=arm64 /p:RuntimeOS=win10", "PB_CreateHelixArguments": "/p:ArchGroup=arm64 /p:ConfigurationGroup=Release /p:EnableCloudTest=false /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT" @@ -124,10 +141,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-buildArch=x64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10", - "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64,Windows.10.Nano.Amd64,Windows.7.Amd64,Windows.81.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT" + "PB_TargetQueue": "Windows.10.Amd64+Windows.10.Nano.Amd64+Windows.10.Amd64.Core+Windows.7.Amd64+Windows.81.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -141,11 +159,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_TargetQueue": "Windows.10.Amd64", - "PB_BuildArguments": "-buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-buildArch=x86 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-buildArch=x86 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10", - "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64,Windows.7.Amd64,Windows.81.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT" + "PB_TargetQueue": "Windows.10.Amd64+Windows.10.Amd64.Core+Windows.7.Amd64+Windows.81.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -159,10 +177,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "arm", - "PB_BuildArguments": "-framework=uap -buildArch=arm -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uap -buildArch=arm -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uap -buildArch=arm -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10 /p:TargetGroup=uap", - "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Arm64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" + "PB_TargetQueue": "Windows.10.Arm64", + "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -176,10 +195,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-framework=uap -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uap -buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uap -buildArch=x64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uap", - "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -193,10 +213,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_BuildArguments": "-framework=uap -buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uap -buildArch=x86 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uap -buildArch=x86 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10 /p:TargetGroup=uap", - "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uap /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -210,10 +231,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "arm", - "PB_BuildArguments": "-framework=uapaot -buildArch=arm -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uapaot -buildArch=arm -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uapaot -buildArch=arm -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10 /p:TargetGroup=uapaot", - "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:TargetQueues=Windows.10.Amd64 /p:SecondaryQueue=Windows.10.Arm64 /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" + "PB_TargetQueue": "Windows.10.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:SecondaryQueue=Windows.10.Arm64 /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -227,10 +249,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-framework=uapaot -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uapaot -buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uapaot -buildArch=x64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uapaot", - "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -244,10 +267,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_BuildArguments": "-framework=uapaot -buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uapaot -buildArch=x86 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uapaot -buildArch=x86 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10", - "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -261,7 +285,7 @@ "Name": "DotNet-CoreFx-Trusted-Windows-NoTest", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-allConfigurations -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-allConfigurations -buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10" }, "ReportingParameters": { @@ -276,10 +300,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-framework=netfx -buildArch=x64 -Release -- /p:SignType=real /p:RuntimeOS=win10", - "PB_BuildTestsArguments": "-framework=netfx -buildArch=x64 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", + "PB_BuildArguments": "-framework=netfx -buildArch=x64 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", + "PB_BuildTestsArguments": "-framework=netfx -buildArch=x64 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=netfx", - "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" + "PB_TargetQueue": "Windows.10.Amd64", + "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -293,10 +318,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_BuildArguments": "-framework=netfx -buildArch=x86 -Release -- /p:SignType=real /p:RuntimeOS=win10", - "PB_BuildTestsArguments": "-framework=netfx -buildArch=x86 -Release -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", + "PB_BuildArguments": "-framework=netfx -buildArch=x86 -Release -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", + "PB_BuildTestsArguments": "-framework=netfx -buildArch=x86 -Release -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10 /p:TargetGroup=netfx", - "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" + "PB_TargetQueue": "Windows.10.Amd64", + "PB_CreateHelixArguments": "/p:EnableCloudTest=false /p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Release /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -319,11 +345,11 @@ "Definitions": [{ "Name": "DotNet-CoreFx-Trusted-Linux", "Parameters": { - "PB_DockerTag": "rhel7_prereqs_2", + "PB_DockerTag": "centos-7-34f1db9-20171620021620", "PB_BuildArguments": "-buildArch=x64 -Debug", "PB_BuildTestsArguments": "-buildArch=x64 -Debug -SkipTests -Outerloop -- /p:ArchiveTests=true /p:EnableDumpling=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64", - "PB_TargetQueue": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1610.Amd64+Ubuntu.1704.Amd64+suse.422.amd64+SLES.12.Amd64+fedora.25.amd64+Fedora.26.Amd64", + "PB_TargetQueue": "Centos.73.Amd64+RedHat.72.Amd64+RedHat.73.Amd64+Debian.87.Amd64+Debian.90.Amd64+Ubuntu.1404.Amd64+Ubuntu.1604.Amd64+Ubuntu.1704.Amd64+Ubuntu.1710.Amd64+suse.422.amd64+SLES.12.Amd64+fedora.25.amd64+Fedora.26.Amd64", "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux" }, "ReportingParameters": { @@ -333,10 +359,27 @@ "ConfigurationGroup": "Debug" } }, + { + "Name": "DotNet-CoreFx-Trusted-Linux", + "Parameters": { + "PB_DockerTag": "centos-6-c8c9b08-20174310104313", + "PB_BuildArguments": "-buildArch=x64 -Debug -RuntimeOS=rhel.6 -- /p:PortableBuild=false", + "PB_BuildTestsArguments": "-buildArch=x64 -Debug -SkipTests -Outerloop -RuntimeOS=rhel.6 -- /p:ArchiveTests=true /p:EnableDumpling=true /p:PortableBuild=false", + "PB_SyncArguments": "-p -RuntimeOS=rhel.6 -- /p:ArchGroup=x64 /p:PortableBuild=false", + "PB_TargetQueue": "RedHat.69.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Linux" + }, + "ReportingParameters": { + "OperatingSystem": "RedHat6", + "Platform": "x64", + "Type": "build/product/", + "ConfigurationGroup": "Debug" + } + }, { "Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild", "Parameters": { - "PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239", + "PB_DockerTag": "ubuntu-14.04-cross-0cd4667-20170319080304", "PB_Architecture": "arm", "PB_BuildArguments": "-buildArch=arm -Debug", "PB_SyncArguments": "-p -- /p:ArchGroup=arm" @@ -387,10 +430,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "arm", - "PB_BuildArguments": "-framework=uap -buildArch=arm -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uap -buildArch=arm -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uap -buildArch=arm -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10 /p:TargetGroup=uap", - "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Arm64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" + "PB_TargetQueue": "Windows.10.Arm64", + "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -404,10 +448,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-framework=uap -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uap -buildArch=x64 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uap -buildArch=x64 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uap", - "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -421,10 +466,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_BuildArguments": "-framework=uap -buildArch=x86 -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uap -buildArch=x86 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uap -buildArch=x86 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10 /p:TargetGroup=uap", - "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uap /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/uwp/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -438,10 +484,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "arm", - "PB_BuildArguments": "-framework=uapaot -buildArch=arm -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework=uapaot -buildArch=arm -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uapaot -buildArch=arm -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=arm /p:RuntimeOS=win10 /p:TargetGroup=uapaot", - "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:TargetQueues=Windows.10.Amd64 /p:SecondaryQueue=Windows.10.Arm64 /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" + "PB_TargetQueue": "Windows.10.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=arm /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:SecondaryQueue=Windows.10.Arm64 /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -455,10 +502,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-framework:uapaot -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework:uapaot -buildArch=x64 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uapaot -buildArch=x64 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=uapaot", - "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -472,11 +520,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_TargetQueue": "Windows.10.Amd64", - "PB_BuildArguments": "-framework:uapaot -buildArch=x86 -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-framework:uapaot -buildArch=x86 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_BuildTestsArguments": "-framework=uapaot -buildArch=x86 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10", - "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64.ClientRS3\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" + "PB_TargetQueue": "Windows.10.Amd64.ClientRS3", + "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=uapaot /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/ilc/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -490,7 +538,7 @@ "Name": "DotNet-CoreFx-Trusted-Windows-NoTest", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-allConfigurations -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10", + "PB_BuildArguments": "-allConfigurations -buildArch=x64 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10" }, "ReportingParameters": { @@ -505,10 +553,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x64", - "PB_BuildArguments": "-framework=netfx -buildArch=x64 -Debug -- /p:SignType=real /p:RuntimeOS=win10", - "PB_BuildTestsArguments": "-framework=netfx -buildArch=x64 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", + "PB_BuildArguments": "-framework=netfx -buildArch=x64 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", + "PB_BuildTestsArguments": "-framework=netfx -buildArch=x64 -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x64 /p:RuntimeOS=win10 /p:TargetGroup=netfx", - "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" + "PB_TargetQueue": "Windows.10.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=x64 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -522,10 +571,11 @@ "Name": "DotNet-CoreFx-Trusted-Windows", "Parameters": { "PB_Platform": "x86", - "PB_BuildArguments": "-framework=netfx -buildArch=x86 -Debug -- /p:SignType=real /p:RuntimeOS=win10", - "PB_BuildTestsArguments": "-framework=netfx -buildArch=x86 -Debug -SkipTests -- /p:RuntimeOS=win10 /p:ArchiveTests=true", + "PB_BuildArguments": "-framework=netfx -buildArch=x86 -Debug -- /p:SignType=$(PB_SignType) /p:RuntimeOS=win10", + "PB_BuildTestsArguments": "-framework=netfx -buildArch=x86 -Debug -SkipTests -Outerloop -- /p:RuntimeOS=win10 /p:ArchiveTests=true", "PB_SyncArguments": "-p -- /p:ArchGroup=x86 /p:RuntimeOS=win10 /p:TargetGroup=netfx", - "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:\"TargetQueues=Windows.10.Amd64\" /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" + "PB_TargetQueue": "Windows.10.Amd64", + "PB_CreateHelixArguments": "/p:ArchGroup=x86 /p:TargetGroup=netfx /p:ConfigurationGroup=Debug /p:TestProduct=corefx /p:TimeoutInSeconds=1200 /p:TargetOS=Windows_NT /p:\"HelixJobType=test/functional/desktop/cli/\"" }, "ReportingParameters": { "OperatingSystem": "Windows", @@ -615,4 +665,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/external/corefx/buildpipeline/pipelinejobs.groovy b/external/corefx/buildpipeline/pipelinejobs.groovy index 69778eb356..f91ded76ca 100644 --- a/external/corefx/buildpipeline/pipelinejobs.groovy +++ b/external/corefx/buildpipeline/pipelinejobs.groovy @@ -15,11 +15,13 @@ def branch = GithubBranchName // ************************** def linPipeline = Pipeline.createPipelineForGithub(this, project, branch, 'buildpipeline/linux.groovy') +def centos6Pipeline = Pipeline.createPipelineForGithub(this, project, branch, 'buildpipeline/centos.6.groovy') def osxPipeline = Pipeline.createPipelineForGithub(this, project, branch, 'buildpipeline/osx.groovy') def winPipeline = Pipeline.createPipelineForGithub(this, project, branch, 'buildpipeline/windows.groovy') def configurations = [ ['TGroup':"netcoreapp", 'Pipeline':linPipeline, 'Name':'Linux' ,'ForPR':"Release-x64", 'Arch':['x64']], + ['TGroup':"netcoreapp", 'Pipeline':centos6Pipeline, 'Name':'CentOS.6' ,'ForPR':"", 'Arch':['x64']], ['TGroup':"netcoreapp", 'Pipeline':osxPipeline, 'Name':'OSX', 'ForPR':"Debug-x64", 'Arch':['x64']], ['TGroup':"netcoreapp", 'Pipeline':winPipeline, 'Name':'Windows' , 'ForPR':"Debug-x64|Release-x86"], ['TGroup':"netfx", 'Pipeline':winPipeline, 'Name':'NETFX', 'ForPR':"Release-x86"], diff --git a/external/corefx/buildpipeline/windows.groovy b/external/corefx/buildpipeline/windows.groovy index 6b042f8c68..a5b9b758e6 100644 --- a/external/corefx/buildpipeline/windows.groovy +++ b/external/corefx/buildpipeline/windows.groovy @@ -12,9 +12,7 @@ def submitToHelix = (params.TGroup == 'netcoreapp' || params.TGroup == 'uap') simpleNode('Windows_NT','latest') { stage ('Checkout source') { - retry (10) { - checkout scm - } + checkoutRepo() } def logFolder = getLogFolder() diff --git a/external/corefx/config.json b/external/corefx/config.json index 5d56835827..44fe6989e2 100644 --- a/external/corefx/config.json +++ b/external/corefx/config.json @@ -246,6 +246,12 @@ "values": [], "defaultValue": "Please-Specify-A-Directory" }, + "Clang": { + "description": "Specific version of Clang to use e.g. clang3.7, clang3.8, etc ...", + "valueType": "property", + "values": [], + "defaultValue": "" + }, }, "commands": { "build-directory": { diff --git a/external/corefx/cross/armel/tizen-fetch.sh b/external/corefx/cross/armel/tizen-fetch.sh index a0fa72b7d7..c7a509a750 100755 --- a/external/corefx/cross/armel/tizen-fetch.sh +++ b/external/corefx/cross/armel/tizen-fetch.sh @@ -155,7 +155,7 @@ fetch_tizen_pkgs() } Inform "Initialize base" -fetch_tizen_pkgs_init arm base +fetch_tizen_pkgs_init standard base Inform "fetch common packages" fetch_tizen_pkgs armv7l gcc glibc glibc-devel fetch_tizen_pkgs noarch linux-glibc-devel diff --git a/external/corefx/dependencies.props b/external/corefx/dependencies.props index 0c9e7e7949..d49037fd17 100644 --- a/external/corefx/dependencies.props +++ b/external/corefx/dependencies.props @@ -9,28 +9,29 @@ These ref versions are pulled from https://github.com/dotnet/versions. --> - ae4ab8c72e4a023a3f0027dff80bff099e535904 - ae4ab8c72e4a023a3f0027dff80bff099e535904 - ae4ab8c72e4a023a3f0027dff80bff099e535904 - 5a0606fccb09fce4b47545ae9896139acca547f5 - ae4ab8c72e4a023a3f0027dff80bff099e535904 - ae4ab8c72e4a023a3f0027dff80bff099e535904 + 3a5b9d25514fe788eeeb6ecdca6c5b187703d5f3 + 41cec0941b3e81e30e69648c44110acc2a069bba + 41cec0941b3e81e30e69648c44110acc2a069bba + 96dc7805f5df4a70a55783964ce69dcd91bfca80 + 20f0758de84e9de4a31912d79333a34b16017a21 + 20f0758de84e9de4a31912d79333a34b16017a21 8bd1ec5fac9f0eec34ff6b34b1d878b4359e02dd - ae4ab8c72e4a023a3f0027dff80bff099e535904 + 3814b0d53f4139b68c2fac85c28030fe8fa50a9d + 075b515e3dfb615b45182c033af48abed349eea5 - 2.1.0-preview1-25324-02 - preview2-25524-02 - 2.1.0-preview2-25524-01 - beta-25322-00 - beta-25524-00 - beta-25524-00 - 1.0.0-beta-25524-00 - 2.1.0-preview1-25524-01 + 2.1.0-preview1-25819-01 + preview1-25819-01 + 2.1.0-preview1-25818-04 + beta-25627-00 + beta-25813-00 + beta-25813-00 + 1.0.0-beta-25813-00 + 2.1.0-preview1-25818-01 NETStandard.Library - 2.1.0-preview2-25523-02 + 2.1.0-preview1-25818-02 4.4.0 @@ -40,7 +41,7 @@ 1.0.3-prerelease-00921-01 1.0.0-beta-build0007 1.0.3-alpha-experimental - 1.0.1-prerelease-01726-01 + 1.0.1-prerelease-02118-01 @@ -83,6 +84,10 @@ $(BaseDotNetBuildInfo)projectn-tfs-testilc/$(DependencyBranch) $(ProjectNTfsTestILCCurrentRef) + + $(BaseDotNetBuildInfo)buildtools/$(DependencyBranch) + $(BuildToolsCurrentRef) + https://raw.githubusercontent.com/dotnet/versions @@ -138,6 +143,16 @@ MicrosoftNETCoreAppPackageVersion Microsoft.NETCore.App + + File + $(MSBuildThisFileDirectory)BuildToolsVersion.txt + Microsoft.DotNet.BuildTools + + + $(MSBuildThisFileFullPath) + XunitNetcoreExtensionsVersion + Microsoft.xunit.netcore.extensions + @@ -157,7 +172,7 @@ - 1.0.3 + 1.0.5 diff --git a/external/corefx/dir.props b/external/corefx/dir.props index 573a6d9f4c..ece69a00a9 100644 --- a/external/corefx/dir.props +++ b/external/corefx/dir.props @@ -28,6 +28,9 @@ $(MSBuildThisFileDirectory) $(ProjectDir)src\ + + corefx + $(ProjectDir)bin/ @@ -118,11 +121,6 @@ $(BinDir)$(OSGroup).$(ArchGroup).$(ConfigurationGroup)/native - - - $(AdditionalBuildConfigurations);net462-$(OSGroup)-$(ConfigurationGroup)-$(ArchGroup);net47-$(OSGroup)-$(ConfigurationGroup)-$(ArchGroup) - - <_runtimeOSVersionIndex>$(RuntimeOS.IndexOfAny(".-0123456789")) @@ -147,6 +145,12 @@ $(_packageRID) $(RuntimeOS)-$(ArchGroup) + + + + true + true + @@ -205,9 +209,10 @@ false false - - + + + latest 4 true @@ -232,6 +237,7 @@ $(IntermediateOutputRootPath)$(MSBuildProjectName)/$(TargetOutputRelPath) $(BinDir)runtime/$(BuildConfiguration)/ + $(TestWorkingDir)$(MSBuildProjectName)/$(BuildConfiguration)/ $(BinDir)ref/ $(RefRootPath)$(_bc_TargetGroup)/ $(RefRootPath)$(_bc_TargetGroup.TrimEnd('aot'))/ @@ -253,7 +259,7 @@ $(BinDir)pkg\netfx\lib - true + true true true true @@ -269,6 +275,8 @@ true + + false $(BinDir)$(OSPlatformConfig) $(PackageOutputRoot)$(ConfigurationGroup)/ @@ -278,7 +286,8 @@ - true + @@ -291,6 +300,6 @@ - - + + diff --git a/external/corefx/dir.targets b/external/corefx/dir.targets index 0938077faf..8d899afd8f 100644 --- a/external/corefx/dir.targets +++ b/external/corefx/dir.targets @@ -3,9 +3,9 @@ + Text="The tools directory [$(ToolsDir)] does not exist. Please run sync in your repo to ensure the tools are installed before attempting to build an individual project." /> + Text="The tools directory [$(ToolsDir)] does not exist. Please run init-tools.cmd in your repo to ensure the tools are installed before attempting to build an individual project." /> @@ -22,6 +22,7 @@ true true + true @@ -29,6 +30,8 @@ $(BuildConfigurationRefPath) $(RuntimePath) + + $(TestPath) @@ -47,11 +50,6 @@ $(UAPAOTPackageRuntimePath) - - $(NetFxPackageRefPath) - $(NetFxPackageRuntimePath) - @@ -73,6 +71,10 @@ $(RefRootPath)netstandard/ + + + $(RefRootPath)netcoreapp2.0/ + <_TargetGroupsWithIsAot Condition="'$(BuildAllConfigurations)' == 'true'" Include="@(TargetGroups)"> $([System.String]::new('%(Identity)').Contains('aot')) diff --git a/external/corefx/external/ILLink/ILLink.depproj b/external/corefx/external/ILLink/ILLink.depproj index 18808d3e64..2a5ea0be96 100644 --- a/external/corefx/external/ILLink/ILLink.depproj +++ b/external/corefx/external/ILLink/ILLink.depproj @@ -8,21 +8,30 @@ false $(ToolRuntimeRID) true + illink.tasks + 0.1.4-preview-981901 - - 0.1.9-preview - Analyzers;Build;ContentFiles;Native;Runtime + + $(ILLinkTasksPackageVersion) - - PreserveNewest - - - + + $(ILLinkTasksPackageId) + $(ILLinkTasksPackageVersion) + /netcoreapp2.0/ + + + + + $(ILLinkTasksPackageId) + $(ILLinkTasksPackageVersion) + /net46/ + - \ No newline at end of file + diff --git a/external/corefx/external/ILLink/illink.runtimeconfig.json b/external/corefx/external/ILLink/illink.runtimeconfig.json index 51d6286475..31f899f501 100644 --- a/external/corefx/external/ILLink/illink.runtimeconfig.json +++ b/external/corefx/external/ILLink/illink.runtimeconfig.json @@ -3,7 +3,7 @@ "tfm": "netcoreapp1.1", "framework": { "name": "Microsoft.NETCore.App", - "version": "2.0.0-preview1-001913-00" + "version": "2.0.0" } } } diff --git a/external/corefx/external/dir.proj b/external/corefx/external/dir.proj index aefe37664c..55f28134c5 100644 --- a/external/corefx/external/dir.proj +++ b/external/corefx/external/dir.proj @@ -7,12 +7,12 @@ + - - + diff --git a/external/corefx/external/harvestPackages/harvestPackages.depproj b/external/corefx/external/harvestPackages/harvestPackages.depproj new file mode 100644 index 0000000000..7902fc5d6b --- /dev/null +++ b/external/corefx/external/harvestPackages/harvestPackages.depproj @@ -0,0 +1,51 @@ + + + + + + + netstandard2.0 + + + + + + + + + + + + 255.255.255 + + + + + + + + <_Lines Include="<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">" /> + <_Lines Include="<!-- The versions can be updated by running UpdateToLatestStablePackages target in harvestPackages.depproj -->" /> + <_Lines Include="<ItemGroup>" /> + <_Lines Include="<PackageReference Include="%(_NewPackageReferences.Identity)"> <Version>%(_NewPackageReferences.Version)</Version> </PackageReference>" /> + <_Lines Include="</ItemGroup>" /> + <_Lines Include="</Project>" /> + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/external/harvestPackages/harvestPackages.netstandard1.6.depproj b/external/corefx/external/harvestPackages/harvestPackages.netstandard1.6.depproj deleted file mode 100644 index aebc38af9c..0000000000 --- a/external/corefx/external/harvestPackages/harvestPackages.netstandard1.6.depproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - netstandard1.6 - - - - - 4.3.0 - - - 10.1.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 1.3.0 - - - 1.0.31 - - - 1.0.31 - - - 1.0.31 - - - 1.0.31 - - - 1.0.31 - - - 1.0.31 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 1.4.1 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.3.0 - - - 4.7.0 - - - 4.3.0 - - - 4.3.0 - - - - - - \ No newline at end of file diff --git a/external/corefx/external/harvestPackages/harvestPackages.props b/external/corefx/external/harvestPackages/harvestPackages.props new file mode 100644 index 0000000000..3ca6e13963 --- /dev/null +++ b/external/corefx/external/harvestPackages/harvestPackages.props @@ -0,0 +1,48 @@ + + + + 4.4.0 + 10.2.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 1.4.0 + 4.4.0 + 1.1.0 + 1.1.0 + 1.1.0 + 1.1.0 + 1.1.0 + 1.1.0 + 4.4.0 + 4.4.0 + 4.4.1 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 1.5.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.4.0 + 4.8.0 + 4.4.0 + 4.4.0 + + diff --git a/external/corefx/external/harvestPackages/harvestPackages.uap10.0.depproj b/external/corefx/external/harvestPackages/harvestPackages.uap10.0.depproj deleted file mode 100644 index f4288e2b4a..0000000000 --- a/external/corefx/external/harvestPackages/harvestPackages.uap10.0.depproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - uap10.0 - - - - - 4.3.0 - - - - - - \ No newline at end of file diff --git a/external/corefx/external/netcoreapp/Configurations.props b/external/corefx/external/netcoreapp/Configurations.props new file mode 100644 index 0000000000..7b75ea543a --- /dev/null +++ b/external/corefx/external/netcoreapp/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp2.0 + + + \ No newline at end of file diff --git a/external/corefx/external/netcoreapp/netcoreapp.depproj b/external/corefx/external/netcoreapp/netcoreapp.depproj new file mode 100644 index 0000000000..d4dcfcfa70 --- /dev/null +++ b/external/corefx/external/netcoreapp/netcoreapp.depproj @@ -0,0 +1,27 @@ + + + + + + true + Reference + 2.0.0 + netcoreapp2.0 + + + + + $(NETCoreAppPackageVersion) + + + + + + + $(RefPath) + + + + + diff --git a/external/corefx/external/netfx-conflicts/Configurations.props b/external/corefx/external/netfx-conflicts/Configurations.props deleted file mode 100644 index 064de9fd71..0000000000 --- a/external/corefx/external/netfx-conflicts/Configurations.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - netfx; - - - \ No newline at end of file diff --git a/external/corefx/external/netfx-conflicts/netfx-conflicts.depproj b/external/corefx/external/netfx-conflicts/netfx-conflicts.depproj deleted file mode 100644 index 51fc85b5d1..0000000000 --- a/external/corefx/external/netfx-conflicts/netfx-conflicts.depproj +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - netstandard1.0 - .NETStandard,Version=v1.0 - netstandard1.1;netstandard1.2;netstandard1.3 - Reference - false - - - - <_contract Include="Microsoft.CSharp"/> - <_contract Include="System.Collections.Concurrent"/> - <_contract Include="System.Collections"/> - <_contract Include="System.ComponentModel.Annotations"/> - <_contract Include="System.ComponentModel"/> - <_contract Include="System.ComponentModel.EventBasedAsync"/> - <_contract Include="System.Diagnostics.Contracts"/> - <_contract Include="System.Diagnostics.Debug"/> - <_contract Include="System.Diagnostics.Tools"/> - <_contract Include="System.Diagnostics.Tracing"/> - <_contract Include="System.Dynamic.Runtime"/> - <_contract Include="System.Globalization"/> - <_contract Include="System.IO"/> - <_contract Include="System.IO.Compression"/> - <_contract Include="System.Linq"/> - <_contract Include="System.Linq.Expressions"/> - <_contract Include="System.Linq.Parallel"/> - <_contract Include="System.Linq.Queryable"/> - <_contract Include="System.Net.Http"/> - <_contract Include="System.Net.NetworkInformation"/> - <_contract Include="System.Net.Primitives"/> - <_contract Include="System.Net.Requests"/> - <_contract Include="System.Net.WebHeaderCollection"/> - <_contract Include="System.ObjectModel"/> - <_contract Include="System.Reflection"/> - <_contract Include="System.Reflection.Context"/> - <_contract Include="System.Reflection.Emit"/> - <_contract Include="System.Reflection.Emit.ILGeneration"/> - <_contract Include="System.Reflection.Emit.Lightweight"/> - <_contract Include="System.Reflection.Extensions"/> - <_contract Include="System.Reflection.Primitives"/> - <_contract Include="System.Resources.ResourceManager"/> - <_contract Include="System.Runtime"/> - <_contract Include="System.Runtime.Extensions"/> - <_contract Include="System.Runtime.Handles"/> - <_contract Include="System.Runtime.InteropServices"/> - <_contract Include="System.Runtime.InteropServices.WindowsRuntime"/> - <_contract Include="System.Runtime.Numerics"/> - <_contract Include="System.Runtime.Serialization.Json"/> - <_contract Include="System.Runtime.Serialization.Primitives"/> - <_contract Include="System.Runtime.Serialization.Xml"/> - <_contract Include="System.Security.Principal"/> - <_contract Include="System.ServiceModel.Duplex"/> - <_contract Include="System.ServiceModel.Http"/> - <_contract Include="System.ServiceModel.NetTcp"/> - <_contract Include="System.ServiceModel.Primitives"/> - <_contract Include="System.ServiceModel.Security"/> - <_contract Include="System.Text.Encoding"/> - <_contract Include="System.Text.Encoding.Extensions"/> - <_contract Include="System.Text.RegularExpressions"/> - <_contract Include="System.Threading"/> - <_contract Include="System.Threading.Tasks"/> - <_contract Include="System.Threading.Tasks.Parallel"/> - <_contract Include="System.Threading.Timer"/> - <_contract Include="System.Xml.ReaderWriter"/> - <_contract Include="System.Xml.XDocument"/> - <_contract Include="System.Xml.XmlSerializer"/> - - 4.3.0 - - - 10.1.0 - - - - - - - - - diff --git a/external/corefx/external/netfx/Configurations.props b/external/corefx/external/netfx/Configurations.props index 47bdffcb28..93e6478e90 100644 --- a/external/corefx/external/netfx/Configurations.props +++ b/external/corefx/external/netfx/Configurations.props @@ -8,8 +8,8 @@ net46; net461; net462; - net463; net47; + net471; netfx; netcoreapp; uap; diff --git a/external/corefx/external/netfx/netfx.depproj b/external/corefx/external/netfx/netfx.depproj index a860b41ed9..4f35754e7b 100644 --- a/external/corefx/external/netfx/netfx.depproj +++ b/external/corefx/external/netfx/netfx.depproj @@ -4,58 +4,98 @@ true + true Reference - $(RefPath) + NETStandard.Library.NETFramework + 2.0.0-preview2-25405-01 + $(PackagesDir)$(NETStandardSupportPackageId.ToLower())\$(NETStandardSupportPackageVersion)\build + true + + true - - - Microsoft.TargetingPack.NETFramework.v4.6.2 - - + .NETFramework,Version=v4.6.1 net461 Microsoft.TargetingPack.NETFramework.v4.6.1 - $(NetFxRefPath) + + + Microsoft.TargetingPack.NETFramework.v4.7 + + + + + + $(NetFxRefPath) + + + + + $(RefPath) + + + + + NetStandardSupportLib + $(TestHostRootPath) + + + NetStandardSupportLib + $(RuntimePath) + + + 1.0.1 - - $(NETStandardPackageVersion) + + $(NETStandardSupportPackageVersion) - - - - $(RefOutputPath) - - - - <_NETStandardRefFolder>$(PackagesDir)$(NETStandardPackageId.ToLower())\$(NETStandardPackageVersion)\build\netstandard2.0\ref - - - <_excludeForNetFx Include="@(NetFxReference);netstandard" /> - <_netstandardShimAssemblies Include="$(_NETStandardRefFolder)\*.dll" Exclude="@(_excludeForNetFx->'$(_NETStandardRefFolder)\%(Identity).dll')" /> - - - - + Condition="'$(AddNetStandardSupportPackage)' == 'true'"> - + <_netStandardReference Condition="'$(TargetGroup)' != 'net461' AND '$(TargetGroup)' != 'net462'" + Include="$(NETStandardSupportRoot)\net47\ref\*.dll" + Exclude="@(_netStandardReference->'$(NETStandardSupportRoot)\net47\ref\%(FileName).dll')" /> + <_netStandardReference Condition="'$(TargetGroup)' != 'net461'" + Include="$(NETStandardSupportRoot)\net462\ref\*.dll" + Exclude="@(_netStandardReference->'$(NETStandardSupportRoot)\net462\ref\%(FileName).dll')" /> + <_netStandardReference Include="$(NETStandardSupportRoot)\net461\ref\*.dll" + Exclude="@(_netStandardReference->'$(NETStandardSupportRoot)\net461\ref\%(FileName).dll')" /> + + + + + + <_netStandardReference> False - $(NETStandardPackageId) - $(NETStandardPackageVersion) - + $(NETStandardSupportPackageId) + $(NETStandardSupportPackageVersion) + + + <_referenceByFileName Include="@(Reference->'%(FileName)%(Extension)')"> + %(Identity) + + <_netStandardReferenceByFileName Include="@(_netStandardReference->'%(FileName)%(Extension)')" /> + + <_remainingReferenceByFileName Include="@(_referenceByFileName)" Exclude="@(_netStandardReferenceByFileName)" /> + <_remainingReference Include="@(_remainingReferenceByFileName->'%(OriginalIdentity)')" /> + + + diff --git a/external/corefx/external/runtime/Configurations.props b/external/corefx/external/runtime/Configurations.props index 7d40e785db..903d22de95 100644 --- a/external/corefx/external/runtime/Configurations.props +++ b/external/corefx/external/runtime/Configurations.props @@ -4,6 +4,8 @@ netcoreapp-Windows_NT; netcoreapp-Unix; + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; uap; uapaot; mono; diff --git a/external/corefx/external/runtime/runtime.depproj b/external/corefx/external/runtime/runtime.depproj index fbf223dff3..7a3c76cf90 100644 --- a/external/corefx/external/runtime/runtime.depproj +++ b/external/corefx/external/runtime/runtime.depproj @@ -4,6 +4,8 @@ $(PackageRID) true + 2.0.0 + $(NoWarn);NU1603;NU1605 @@ -36,10 +38,10 @@ $(PackageVersion)-$(CoreFxExpectedPrerelease) - 2.0.0-preview2-25310-02 + 2.0.1-servicing-25615-03 - 2.0.0-preview2-25310-02 + 2.0.1-servicing-25615-03 @@ -68,6 +70,42 @@ SkipUnchangedFiles="true" UseHardlinksIfPossible="true" /> + + + + + $(PackagesDir)symbolpackages/ + + + + + + <_CoreCLRSymbolPackagesToDownload Include="@(ReferenceCopyLocalPaths->'%(NuGetPackageId)')" Condition="$([System.String]::Copy('%(Identity)').EndsWith('System.Private.CoreLib.dll'))"> + https://dotnet.myget.org/F/dotnet-core/symbols/%(NuGetPackageId)/%(NuGetPackageVersion)/ + %(NuGetPackageId).%(NuGetPackageVersion).symbols.nupkg.zip + $(SymbolPackagesDir)/%(NuGetPackageId).%(NuGetPackageVersion) + + + + + + + + + + + + + + + <_CoreCLRSymbolFiles Include="%(_CoreCLRSymbolPackagesToDownload.UnzipDestinationDir)/runtimes/$(NugetRuntimeIdentifier)/native/*.pdb" /> + <_CoreCLRSymbolFiles Include="%(_CoreCLRSymbolPackagesToDownload.UnzipDestinationDir)/runtimes/$(NugetRuntimeIdentifier)/native/*.dbg" /> + + win10-$(ArchGroup) + + win10-arm true $(RuntimePath) xunit.console.netcore @@ -13,6 +15,8 @@ netstandard2.0 .NETStandard,Version=v2.0 netstandard2.0 + + $(NoWarn);NU1603 @@ -59,7 +63,7 @@ 4.6.519 - 2.5.0 + 3.0.1 1.0.5-prerelease @@ -74,7 +78,7 @@ 1.0.0-prerelease - 1.0.2 + 1.0.6 @@ -83,6 +87,7 @@ + @@ -94,7 +99,7 @@ - 1.0.14 + 1.0.17 diff --git a/external/corefx/external/test-runtime/optional.json b/external/corefx/external/test-runtime/optional.json index a0ffd06514..11ee6b5e4d 100644 --- a/external/corefx/external/test-runtime/optional.json +++ b/external/corefx/external/test-runtime/optional.json @@ -3,9 +3,9 @@ "net45": { "dependencies": { "Microsoft.DotNet.IBCMerge": "4.6.0-alpha-00001", - "TestILC.amd64ret": "1.0.0-beta-25524-00", - "TestILC.armret": "1.0.0-beta-25524-00", - "TestILC.x86ret": "1.0.0-beta-25524-00" + "TestILC.amd64ret": "1.0.0-beta-25813-00", + "TestILC.armret": "1.0.0-beta-25813-00", + "TestILC.x86ret": "1.0.0-beta-25813-00" } } } diff --git a/external/corefx/external/winrt/winrt.depproj b/external/corefx/external/winrt/winrt.depproj index 4fc7a6203b..95a9ed5c4f 100644 --- a/external/corefx/external/winrt/winrt.depproj +++ b/external/corefx/external/winrt/winrt.depproj @@ -9,7 +9,7 @@ - 1.0.4 + 1.0.5 diff --git a/external/corefx/illink.targets b/external/corefx/illink.targets index 203a606060..7501e2925a 100644 --- a/external/corefx/illink.targets +++ b/external/corefx/illink.targets @@ -10,7 +10,8 @@ - $(ToolsDir)ILLink/illink.dll + $(ToolsDir)ILLink/netcoreapp2.0/ILLink.Tasks.dll + $(ToolsDir)ILLink/net46/ILLink.Tasks.dll $(IntermediateOutputPath)$(TargetName)$(TargetExt) $(IntermediateOutputPath)$(TargetName).pdb $(IntermediateOutputPath)PreTrim/ @@ -55,26 +56,15 @@ Examines the "input assembly" for IL that is unreachable from public API and trims that, rewriting the assembly to an "output assembly" --> + - - - <_ILLinkReferenceDirectory Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" /> - - - - $(ILLinkArgs) -r $(TargetName) - $(ILLinkArgs) -d $(ILLinkTrimInputPath) - - $(ILLinkArgs) @(_ILLinkReferenceDirectory->'-d %(Identity)', ' ') + $(ILLinkArgs)-r $(TargetName) $(ILLinkArgs) -c skip $(ILLinkArgs) -p skip netstandard $(ILLinkArgs) -t - $(ILLinkArgs) -out $(ILLinkTrimOutputPath) $(ILLinkArgs) -x $(ILLinkTrimXml) $(ILLinkArgs) -b true @@ -96,11 +86,11 @@ Condition="'$(ILLinkRewritePDBs)' == 'true' AND Exists('$(ILLinkTrimAssemblySymbols)')" /> - - $(OverrideToolHost) "$(ILLinkToolPath)" - + - false @@ -17,5 +17,7 @@ + + \ No newline at end of file diff --git a/external/corefx/pkg/Microsoft.NETCore.Platforms/readme.md b/external/corefx/pkg/Microsoft.NETCore.Platforms/readme.md index 774cf7c8ea..a4b7b667bd 100644 --- a/external/corefx/pkg/Microsoft.NETCore.Platforms/readme.md +++ b/external/corefx/pkg/Microsoft.NETCore.Platforms/readme.md @@ -86,6 +86,49 @@ If you're prototyping on a platform that is compatible with an existing platform `Microsoft.NETCore.Platforms` attempts to define all RIDs that packages may need, and as such will define RIDs for platforms that we don't actually cross compile for. This is to support higher-level packages, 3rd party packages, that may need to cross-compile for that RID. +### Adding a new OS +Add a new `RuntimeGroup` item in `runtimeGroups.props`. + +For example: +```xml + + linux + x86;x64;arm + 42.0;43.0 + +``` + +This will create a new RID for `myLinuxDistro` where `myLinuxDistro` should be the string used for the `ID=` value in the `/etc/os-release` file. + +Whenever modifying the `runtimeGroups.props` you should rebuild the project with `/p:UpdateRuntimeFiles=true` so that your changes will be regenerated in the checked-in `runtime.json`. + +RuntimeGroup items have the following format: +- `Identity`: the base string for the RID, without version architecture, or qualifiers. +- `Parent`: the base string for the parent of this RID. This RID will be imported by the baseRID, architecture-specific, and qualifier-specific RIDs (with the latter two appending appropriate architecture and qualifiers). +- `Versions`: A list of strings delimited by semi-colons that represent the versions for this RID. +- `TreatVersionsAsCompatible`: Default is true. When true, version-specific RIDs will import the previous version-specific RID in the Versions list, with the first version importing the version-less RID. When false all version-specific RIDs will import the version-less RID (bypassing previous version-specific RIDs) +- `OmitVersionDelimiter`: Default is false. When true no characters will separate the base RID and version (EG: win7). When false a '.' will separate the base RID and version (EG: osx.10.12). +- `ApplyVersionsToParent`: Default is false. When true, version-specific RIDs will import version-specific Parent RIDs similar to is done for architecture and qualifier (see Parent above). +- `Architectures`: A list of strings delimited by semi-colons that represent the architectures for this RID. +- `AdditionalQualifiers`: A list of strings delimited by semi-colons that represent the additional qualifiers for this RID. Additional qualifers do not stack, each only applies to the qualifier-less RIDs (so as not to cause combinatorial exponential growth of RIDs). + +### Adding a new version to an existing OS +Find the existing `RuntimeGroup` in `runtimeGroups.props` and add the version to the list of `Versions`, separated by a semi-colon. + +If the version you are adding needs to be treated as not-compatible with previous versions and the `RuntimeGroup` has not set `TreatVersionsAsCompatible`=`false` then you may create a new `RuntimeGroup` to represent the new compatibility band. + +### Checking your work +After making a change to `runtimeGroups.props` you can examine the resulting changes in `runtime.json` and `runtime.compatibility.json`. + +`runtime.json` is the graph representation of the RIDs and is what ships in the package. + +`runtime.compatibility.json` is a flattened version of the graph that shows the RID precedence for each RID in the graph. + +### Version compatibility +Version compatibility is represented through imports. If a platform is considered compatible with another version of the same platform, or a specific version of another platform, then it can import that platform. This permits packages to reuse assets that were built for the imported platform on the compatible platform. Compatibility here is a bit nebulous because inevitably different platforms will have observable differences that can cause compatibility problems. For the purposes of RIDs we'll try to represent compatibility as versions of a platform that are explicitly advertised as being compatible with a previous version and/or another platform and don't have any known broad breaking changes. It is usually better to opt to treat platforms as compatible since that enables the scenario of building an asset for a particular version and using that in future versions, otherwise you force people to cross-compile for all future versions the moment they target a specific version. + +## Appendix : details of RID graph generation + ### Naming convention We use the following convention in all newly-defined RIDs. Some RIDs (win7-x64, win8-x64) predate this convention and don't follow it, but all new RIDs should follow it. `[os name].[version]-[architecture]-[additional qualifiers]`, for example `osx.10.10-x64` or `ubuntu.14.04-x64` @@ -96,9 +139,6 @@ We use the following convention in all newly-defined RIDs. Some RIDs (win7-x64, For all of these we strive to make them something that can be uniquely discoverable at runtime, so that a RID may be computed from an executing application. As such these properties should be derivable from `/etc/os-release` or similar platform APIs / data. -### Binary compatibility -Binary compatibility is represented through imports. If a platform is considered binary compatible with another version of the same platform, or a specific version of another platform, then it can import that platform. This permits packages to reuse assets that were built for the imported platform on the compatible platform. Binary compatibility here is a bit nebulous because inevietably different platforms will have observable differences that can cause compatibility problems. For the purposes of RIDs we'll try to represent compatibility as versions of a platform that are explicitly advertised as being compatible with a previous version and/or another platform and don't have any known broad breaking changes. - ### Import convention Imports should be used when the added RID is considered compatible with an existing RID. @@ -107,4 +147,9 @@ Imports should be used when the added RID is considered compatible with an exist 3. Architecture-less RIDs that are compatible with a previous version RID for the same OS should then import the previous version, architecture neutral RID. EG: `osx.10.11` should import `osx.10.10`. If there is no earlier compatible/supported version, then a versionless RID should be imported. EG: `osx.10.10` should import `osx`. 4. Version-less RIDs should import an OS category. EG: `osx-x64` should import `unix-x64`, `osx` should import `unix`. +### Advanced RuntimeGroup metadata +The following options can be used under special circumstances but break the normal precedence rules we try to establish by generating the RID graph from common logic. These options make it possible to create a RID fallback chain that doesn't match the rest of the RIDs and therefore is hard for developers/package authors to reason about. Only use these options for cases where you know what you are doing and have carefully reviewed the resulting RID fallbacks using the CompatibliltyMap. +- `OmitRIDs`: A list of strings delimited by semi-colons that represent RIDs calculated from this RuntimeGroup that should be omitted from the RuntimeGraph. These RIDs will not be referenced nor defined. +- `OmitRIDDefinitions`: A list of strings delimited by semi-colons that represent RIDs calculated from this RuntimeGroup that should be omitted from the RuntimeGraph. These RIDs will not be defined by this RuntimeGroup, but will be referenced: useful in case some other RuntimeGroup (or runtime.json template) defines them. +- `OmitRIDReferences`: A list of strings delimited by semi-colons that represent RIDs calculated from this RuntimeGroup that should be omitted from the RuntimeGraph. These RIDs will be defined but not referenced by this RuntimeGroup. diff --git a/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json b/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json new file mode 100644 index 0000000000..8ff708f2ec --- /dev/null +++ b/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json @@ -0,0 +1,5203 @@ +{ + "alpine": [ + "alpine", + "any", + "base" + ], + "alpine-corert": [ + "alpine-corert", + "alpine", + "corert", + "any", + "base" + ], + "alpine-x64": [ + "alpine-x64", + "alpine", + "any", + "base" + ], + "alpine-x64-corert": [ + "alpine-x64-corert", + "alpine-corert", + "alpine-x64", + "alpine", + "corert", + "any", + "base" + ], + "alpine.3.6": [ + "alpine.3.6", + "alpine", + "any", + "base" + ], + "alpine.3.6-corert": [ + "alpine.3.6-corert", + "alpine.3.6", + "alpine-corert", + "alpine", + "corert", + "any", + "base" + ], + "alpine.3.6-x64": [ + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64", + "alpine", + "any", + "base" + ], + "alpine.3.6-x64-corert": [ + "alpine.3.6-x64-corert", + "alpine.3.6-corert", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64-corert", + "alpine-corert", + "alpine-x64", + "alpine", + "corert", + "any", + "base" + ], + "android": [ + "android", + "any", + "base" + ], + "android-arm": [ + "android-arm", + "android", + "any", + "base" + ], + "android-arm-corert": [ + "android-arm-corert", + "android-corert", + "android-arm", + "android", + "corert", + "any", + "base" + ], + "android-arm64": [ + "android-arm64", + "android", + "any", + "base" + ], + "android-arm64-corert": [ + "android-arm64-corert", + "android-corert", + "android-arm64", + "android", + "corert", + "any", + "base" + ], + "android-corert": [ + "android-corert", + "android", + "corert", + "any", + "base" + ], + "android.21": [ + "android.21", + "android", + "any", + "base" + ], + "android.21-arm": [ + "android.21-arm", + "android.21", + "android-arm", + "android", + "any", + "base" + ], + "android.21-arm-corert": [ + "android.21-arm-corert", + "android.21-corert", + "android.21-arm", + "android.21", + "android-arm-corert", + "android-corert", + "android-arm", + "android", + "corert", + "any", + "base" + ], + "android.21-arm64": [ + "android.21-arm64", + "android.21", + "android-arm64", + "android", + "any", + "base" + ], + "android.21-arm64-corert": [ + "android.21-arm64-corert", + "android.21-corert", + "android.21-arm64", + "android.21", + "android-arm64-corert", + "android-corert", + "android-arm64", + "android", + "corert", + "any", + "base" + ], + "android.21-corert": [ + "android.21-corert", + "android.21", + "android-corert", + "android", + "corert", + "any", + "base" + ], + "any": [ + "any", + "base" + ], + "aot": [ + "aot", + "any", + "base" + ], + "base": [ + "base" + ], + "centos": [ + "centos", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "centos-corert": [ + "centos-corert", + "centos", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "centos-x64": [ + "centos-x64", + "centos", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "centos-x64-corert": [ + "centos-x64-corert", + "centos-corert", + "centos-x64", + "rhel-x64-corert", + "centos", + "rhel-corert", + "rhel-x64", + "linux-x64-corert", + "rhel", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "centos.7": [ + "centos.7", + "centos", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "centos.7-corert": [ + "centos.7-corert", + "centos.7", + "centos-corert", + "rhel.7-corert", + "centos", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "centos.7-x64": [ + "centos.7-x64", + "centos.7", + "centos-x64", + "rhel.7-x64", + "centos", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "centos.7-x64-corert": [ + "centos.7-x64-corert", + "centos.7-corert", + "centos.7-x64", + "centos.7", + "centos-x64-corert", + "centos-corert", + "rhel.7-corert", + "centos-x64", + "rhel.7-x64", + "centos", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "corert": [ + "corert", + "any", + "base" + ], + "debian": [ + "debian", + "linux", + "unix", + "any", + "base" + ], + "debian-arm": [ + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "debian-arm-corert": [ + "debian-arm-corert", + "debian-corert", + "debian-arm", + "linux-arm-corert", + "debian", + "linux-corert", + "linux-arm", + "unix-arm-corert", + "linux", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "debian-arm64": [ + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "debian-arm64-corert": [ + "debian-arm64-corert", + "debian-corert", + "debian-arm64", + "linux-arm64-corert", + "debian", + "linux-corert", + "linux-arm64", + "unix-arm64-corert", + "linux", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "debian-armel": [ + "debian-armel", + "debian", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "debian-armel-corert": [ + "debian-armel-corert", + "debian-corert", + "debian-armel", + "linux-armel-corert", + "debian", + "linux-corert", + "linux-armel", + "unix-armel-corert", + "linux", + "unix-corert", + "unix-armel", + "unix", + "corert", + "any", + "base" + ], + "debian-corert": [ + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "debian-x64": [ + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "debian-x64-corert": [ + "debian-x64-corert", + "debian-corert", + "debian-x64", + "linux-x64-corert", + "debian", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "debian-x86": [ + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "debian-x86-corert": [ + "debian-x86-corert", + "debian-corert", + "debian-x86", + "linux-x86-corert", + "debian", + "linux-corert", + "linux-x86", + "unix-x86-corert", + "linux", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "debian.8": [ + "debian.8", + "debian", + "linux", + "unix", + "any", + "base" + ], + "debian.8-arm": [ + "debian.8-arm", + "debian.8", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "debian.8-arm-corert": [ + "debian.8-arm-corert", + "debian.8-corert", + "debian.8-arm", + "debian.8", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "debian.8-arm64": [ + "debian.8-arm64", + "debian.8", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "debian.8-arm64-corert": [ + "debian.8-arm64-corert", + "debian.8-corert", + "debian.8-arm64", + "debian.8", + "debian-arm64-corert", + "debian-corert", + "debian-arm64", + "debian", + "linux-arm64-corert", + "linux-corert", + "linux-arm64", + "linux", + "unix-arm64-corert", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "debian.8-armel": [ + "debian.8-armel", + "debian.8", + "debian-armel", + "debian", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "debian.8-armel-corert": [ + "debian.8-armel-corert", + "debian.8-corert", + "debian.8-armel", + "debian.8", + "debian-armel-corert", + "debian-corert", + "debian-armel", + "debian", + "linux-armel-corert", + "linux-corert", + "linux-armel", + "linux", + "unix-armel-corert", + "unix-corert", + "unix-armel", + "unix", + "corert", + "any", + "base" + ], + "debian.8-corert": [ + "debian.8-corert", + "debian.8", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "debian.8-x64": [ + "debian.8-x64", + "debian.8", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "debian.8-x64-corert": [ + "debian.8-x64-corert", + "debian.8-corert", + "debian.8-x64", + "debian.8", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "debian.8-x86": [ + "debian.8-x86", + "debian.8", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "debian.8-x86-corert": [ + "debian.8-x86-corert", + "debian.8-corert", + "debian.8-x86", + "debian.8", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "fedora": [ + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora-corert": [ + "fedora-corert", + "fedora", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "fedora-x64": [ + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora-x64-corert": [ + "fedora-x64-corert", + "fedora-corert", + "fedora-x64", + "linux-x64-corert", + "fedora", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "fedora.23": [ + "fedora.23", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.23-corert": [ + "fedora.23-corert", + "fedora.23", + "fedora-corert", + "fedora", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "fedora.23-x64": [ + "fedora.23-x64", + "fedora.23", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.23-x64-corert": [ + "fedora.23-x64-corert", + "fedora.23-corert", + "fedora.23-x64", + "fedora.23", + "fedora-x64-corert", + "fedora-corert", + "fedora-x64", + "fedora", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "fedora.24": [ + "fedora.24", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.24-corert": [ + "fedora.24-corert", + "fedora.24", + "fedora-corert", + "fedora", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "fedora.24-x64": [ + "fedora.24-x64", + "fedora.24", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.24-x64-corert": [ + "fedora.24-x64-corert", + "fedora.24-corert", + "fedora.24-x64", + "fedora.24", + "fedora-x64-corert", + "fedora-corert", + "fedora-x64", + "fedora", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "fedora.25": [ + "fedora.25", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.25-corert": [ + "fedora.25-corert", + "fedora.25", + "fedora-corert", + "fedora", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "fedora.25-x64": [ + "fedora.25-x64", + "fedora.25", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.25-x64-corert": [ + "fedora.25-x64-corert", + "fedora.25-corert", + "fedora.25-x64", + "fedora.25", + "fedora-x64-corert", + "fedora-corert", + "fedora-x64", + "fedora", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "fedora.26": [ + "fedora.26", + "fedora", + "linux", + "unix", + "any", + "base" + ], + "fedora.26-corert": [ + "fedora.26-corert", + "fedora.26", + "fedora-corert", + "fedora", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "fedora.26-x64": [ + "fedora.26-x64", + "fedora.26", + "fedora-x64", + "fedora", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "fedora.26-x64-corert": [ + "fedora.26-x64-corert", + "fedora.26-corert", + "fedora.26-x64", + "fedora.26", + "fedora-x64-corert", + "fedora-corert", + "fedora-x64", + "fedora", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "gentoo": [ + "gentoo", + "linux", + "unix", + "any", + "base" + ], + "gentoo-corert": [ + "gentoo-corert", + "gentoo", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "gentoo-x64": [ + "gentoo-x64", + "gentoo", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "gentoo-x64-corert": [ + "gentoo-x64-corert", + "gentoo-corert", + "gentoo-x64", + "linux-x64-corert", + "gentoo", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linux": [ + "linux", + "unix", + "any", + "base" + ], + "linux-arm": [ + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "linux-arm-corert": [ + "linux-arm-corert", + "linux-corert", + "linux-arm", + "unix-arm-corert", + "linux", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "linux-arm64": [ + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "linux-arm64-corert": [ + "linux-arm64-corert", + "linux-corert", + "linux-arm64", + "unix-arm64-corert", + "linux", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "linux-armel": [ + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "linux-armel-corert": [ + "linux-armel-corert", + "linux-corert", + "linux-armel", + "unix-armel-corert", + "linux", + "unix-corert", + "unix-armel", + "unix", + "corert", + "any", + "base" + ], + "linux-corert": [ + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linux-x64": [ + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linux-x64-corert": [ + "linux-x64-corert", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linux-x86": [ + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "linux-x86-corert": [ + "linux-x86-corert", + "linux-corert", + "linux-x86", + "unix-x86-corert", + "linux", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17": [ + "linuxmint.17", + "ubuntu.14.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "linuxmint.17-corert": [ + "linuxmint.17-corert", + "linuxmint.17", + "ubuntu.14.04-corert", + "ubuntu.14.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17-x64": [ + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linuxmint.17-x64-corert": [ + "linuxmint.17-x64-corert", + "linuxmint.17-corert", + "linuxmint.17-x64", + "ubuntu.14.04-x64-corert", + "linuxmint.17", + "ubuntu.14.04-corert", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17.1": [ + "linuxmint.17.1", + "linuxmint.17", + "ubuntu.14.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "linuxmint.17.1-corert": [ + "linuxmint.17.1-corert", + "linuxmint.17.1", + "linuxmint.17-corert", + "linuxmint.17", + "ubuntu.14.04-corert", + "ubuntu.14.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17.1-x64": [ + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linuxmint.17.1-x64-corert": [ + "linuxmint.17.1-x64-corert", + "linuxmint.17.1-corert", + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64-corert", + "linuxmint.17-corert", + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64-corert", + "ubuntu.14.04-corert", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17.2": [ + "linuxmint.17.2", + "linuxmint.17.1", + "linuxmint.17", + "ubuntu.14.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "linuxmint.17.2-corert": [ + "linuxmint.17.2-corert", + "linuxmint.17.2", + "linuxmint.17.1-corert", + "linuxmint.17.1", + "linuxmint.17-corert", + "linuxmint.17", + "ubuntu.14.04-corert", + "ubuntu.14.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17.2-x64": [ + "linuxmint.17.2-x64", + "linuxmint.17.2", + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linuxmint.17.2-x64-corert": [ + "linuxmint.17.2-x64-corert", + "linuxmint.17.2-corert", + "linuxmint.17.2-x64", + "linuxmint.17.2", + "linuxmint.17.1-x64-corert", + "linuxmint.17.1-corert", + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64-corert", + "linuxmint.17-corert", + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64-corert", + "ubuntu.14.04-corert", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17.3": [ + "linuxmint.17.3", + "linuxmint.17.2", + "linuxmint.17.1", + "linuxmint.17", + "ubuntu.14.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "linuxmint.17.3-corert": [ + "linuxmint.17.3-corert", + "linuxmint.17.3", + "linuxmint.17.2-corert", + "linuxmint.17.2", + "linuxmint.17.1-corert", + "linuxmint.17.1", + "linuxmint.17-corert", + "linuxmint.17", + "ubuntu.14.04-corert", + "ubuntu.14.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.17.3-x64": [ + "linuxmint.17.3-x64", + "linuxmint.17.3", + "linuxmint.17.2-x64", + "linuxmint.17.2", + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linuxmint.17.3-x64-corert": [ + "linuxmint.17.3-x64-corert", + "linuxmint.17.3-corert", + "linuxmint.17.3-x64", + "linuxmint.17.3", + "linuxmint.17.2-x64-corert", + "linuxmint.17.2-corert", + "linuxmint.17.2-x64", + "linuxmint.17.2", + "linuxmint.17.1-x64-corert", + "linuxmint.17.1-corert", + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64-corert", + "linuxmint.17-corert", + "linuxmint.17-x64", + "linuxmint.17", + "ubuntu.14.04-x64-corert", + "ubuntu.14.04-corert", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.18": [ + "linuxmint.18", + "ubuntu.16.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "linuxmint.18-corert": [ + "linuxmint.18-corert", + "linuxmint.18", + "ubuntu.16.04-corert", + "ubuntu.16.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.18-x64": [ + "linuxmint.18-x64", + "linuxmint.18", + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linuxmint.18-x64-corert": [ + "linuxmint.18-x64-corert", + "linuxmint.18-corert", + "linuxmint.18-x64", + "ubuntu.16.04-x64-corert", + "linuxmint.18", + "ubuntu.16.04-corert", + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.18.1": [ + "linuxmint.18.1", + "linuxmint.18", + "ubuntu.16.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "linuxmint.18.1-corert": [ + "linuxmint.18.1-corert", + "linuxmint.18.1", + "linuxmint.18-corert", + "linuxmint.18", + "ubuntu.16.04-corert", + "ubuntu.16.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "linuxmint.18.1-x64": [ + "linuxmint.18.1-x64", + "linuxmint.18.1", + "linuxmint.18-x64", + "linuxmint.18", + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "linuxmint.18.1-x64-corert": [ + "linuxmint.18.1-x64-corert", + "linuxmint.18.1-corert", + "linuxmint.18.1-x64", + "linuxmint.18.1", + "linuxmint.18-x64-corert", + "linuxmint.18-corert", + "linuxmint.18-x64", + "linuxmint.18", + "ubuntu.16.04-x64-corert", + "ubuntu.16.04-corert", + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ol": [ + "ol", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "ol-corert": [ + "ol-corert", + "ol", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ol-x64": [ + "ol-x64", + "ol", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ol-x64-corert": [ + "ol-x64-corert", + "ol-corert", + "ol-x64", + "rhel-x64-corert", + "ol", + "rhel-corert", + "rhel-x64", + "linux-x64-corert", + "rhel", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ol.7": [ + "ol.7", + "ol", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "ol.7-corert": [ + "ol.7-corert", + "ol.7", + "ol-corert", + "rhel.7-corert", + "ol", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ol.7-x64": [ + "ol.7-x64", + "ol.7", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ol.7-x64-corert": [ + "ol.7-x64-corert", + "ol.7-corert", + "ol.7-x64", + "ol.7", + "ol-x64-corert", + "ol-corert", + "rhel.7-corert", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ol.7.0": [ + "ol.7.0", + "ol.7", + "rhel.7.0", + "ol", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "ol.7.0-corert": [ + "ol.7.0-corert", + "ol.7.0", + "ol.7-corert", + "rhel.7.0-corert", + "ol.7", + "rhel.7.0", + "ol-corert", + "rhel.7-corert", + "ol", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ol.7.0-x64": [ + "ol.7.0-x64", + "ol.7.0", + "ol.7-x64", + "rhel.7.0-x64", + "ol.7", + "rhel.7.0", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ol.7.0-x64-corert": [ + "ol.7.0-x64-corert", + "ol.7.0-corert", + "ol.7.0-x64", + "ol.7.0", + "ol.7-x64-corert", + "ol.7-corert", + "rhel.7.0-corert", + "ol.7-x64", + "rhel.7.0-x64", + "ol.7", + "rhel.7.0", + "ol-x64-corert", + "ol-corert", + "rhel.7-corert", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ol.7.1": [ + "ol.7.1", + "ol.7.0", + "rhel.7.1", + "ol.7", + "rhel.7.0", + "ol", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "ol.7.1-corert": [ + "ol.7.1-corert", + "ol.7.1", + "ol.7.0-corert", + "rhel.7.1-corert", + "ol.7.0", + "rhel.7.1", + "ol.7-corert", + "rhel.7.0-corert", + "ol.7", + "rhel.7.0", + "ol-corert", + "rhel.7-corert", + "ol", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ol.7.1-x64": [ + "ol.7.1-x64", + "ol.7.1", + "ol.7.0-x64", + "rhel.7.1-x64", + "ol.7.0", + "rhel.7.1", + "ol.7-x64", + "rhel.7.0-x64", + "ol.7", + "rhel.7.0", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ol.7.1-x64-corert": [ + "ol.7.1-x64-corert", + "ol.7.1-corert", + "ol.7.1-x64", + "ol.7.1", + "ol.7.0-x64-corert", + "ol.7.0-corert", + "rhel.7.1-corert", + "ol.7.0-x64", + "rhel.7.1-x64", + "ol.7.0", + "rhel.7.1", + "ol.7-x64-corert", + "ol.7-corert", + "rhel.7.0-corert", + "ol.7-x64", + "rhel.7.0-x64", + "ol.7", + "rhel.7.0", + "ol-x64-corert", + "ol-corert", + "rhel.7-corert", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ol.7.2": [ + "ol.7.2", + "ol.7.1", + "rhel.7.2", + "ol.7.0", + "rhel.7.1", + "ol.7", + "rhel.7.0", + "ol", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "ol.7.2-corert": [ + "ol.7.2-corert", + "ol.7.2", + "ol.7.1-corert", + "rhel.7.2-corert", + "ol.7.1", + "rhel.7.2", + "ol.7.0-corert", + "rhel.7.1-corert", + "ol.7.0", + "rhel.7.1", + "ol.7-corert", + "rhel.7.0-corert", + "ol.7", + "rhel.7.0", + "ol-corert", + "rhel.7-corert", + "ol", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ol.7.2-x64": [ + "ol.7.2-x64", + "ol.7.2", + "ol.7.1-x64", + "rhel.7.2-x64", + "ol.7.1", + "rhel.7.2", + "ol.7.0-x64", + "rhel.7.1-x64", + "ol.7.0", + "rhel.7.1", + "ol.7-x64", + "rhel.7.0-x64", + "ol.7", + "rhel.7.0", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ol.7.2-x64-corert": [ + "ol.7.2-x64-corert", + "ol.7.2-corert", + "ol.7.2-x64", + "ol.7.2", + "ol.7.1-x64-corert", + "ol.7.1-corert", + "rhel.7.2-corert", + "ol.7.1-x64", + "rhel.7.2-x64", + "ol.7.1", + "rhel.7.2", + "ol.7.0-x64-corert", + "ol.7.0-corert", + "rhel.7.1-corert", + "ol.7.0-x64", + "rhel.7.1-x64", + "ol.7.0", + "rhel.7.1", + "ol.7-x64-corert", + "ol.7-corert", + "rhel.7.0-corert", + "ol.7-x64", + "rhel.7.0-x64", + "ol.7", + "rhel.7.0", + "ol-x64-corert", + "ol-corert", + "rhel.7-corert", + "ol-x64", + "rhel.7-x64", + "ol", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "opensuse": [ + "opensuse", + "linux", + "unix", + "any", + "base" + ], + "opensuse-corert": [ + "opensuse-corert", + "opensuse", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "opensuse-x64": [ + "opensuse-x64", + "opensuse", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "opensuse-x64-corert": [ + "opensuse-x64-corert", + "opensuse-corert", + "opensuse-x64", + "linux-x64-corert", + "opensuse", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "opensuse.13.2": [ + "opensuse.13.2", + "opensuse", + "linux", + "unix", + "any", + "base" + ], + "opensuse.13.2-corert": [ + "opensuse.13.2-corert", + "opensuse.13.2", + "opensuse-corert", + "opensuse", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "opensuse.13.2-x64": [ + "opensuse.13.2-x64", + "opensuse.13.2", + "opensuse-x64", + "opensuse", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "opensuse.13.2-x64-corert": [ + "opensuse.13.2-x64-corert", + "opensuse.13.2-corert", + "opensuse.13.2-x64", + "opensuse.13.2", + "opensuse-x64-corert", + "opensuse-corert", + "opensuse-x64", + "opensuse", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "opensuse.42.1": [ + "opensuse.42.1", + "opensuse", + "linux", + "unix", + "any", + "base" + ], + "opensuse.42.1-corert": [ + "opensuse.42.1-corert", + "opensuse.42.1", + "opensuse-corert", + "opensuse", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "opensuse.42.1-x64": [ + "opensuse.42.1-x64", + "opensuse.42.1", + "opensuse-x64", + "opensuse", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "opensuse.42.1-x64-corert": [ + "opensuse.42.1-x64-corert", + "opensuse.42.1-corert", + "opensuse.42.1-x64", + "opensuse.42.1", + "opensuse-x64-corert", + "opensuse-corert", + "opensuse-x64", + "opensuse", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "osx": [ + "osx", + "unix", + "any", + "base" + ], + "osx-corert": [ + "osx-corert", + "osx", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "osx-x64": [ + "osx-x64", + "osx", + "unix-x64", + "unix", + "any", + "base" + ], + "osx-x64-corert": [ + "osx-x64-corert", + "osx-corert", + "osx-x64", + "unix-x64-corert", + "osx", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "osx.10.10": [ + "osx.10.10", + "osx", + "unix", + "any", + "base" + ], + "osx.10.10-corert": [ + "osx.10.10-corert", + "osx.10.10", + "osx-corert", + "osx", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "osx.10.10-x64": [ + "osx.10.10-x64", + "osx.10.10", + "osx-x64", + "osx", + "unix-x64", + "unix", + "any", + "base" + ], + "osx.10.10-x64-corert": [ + "osx.10.10-x64-corert", + "osx.10.10-corert", + "osx.10.10-x64", + "osx.10.10", + "osx-x64-corert", + "osx-corert", + "osx-x64", + "osx", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "osx.10.11": [ + "osx.10.11", + "osx.10.10", + "osx", + "unix", + "any", + "base" + ], + "osx.10.11-corert": [ + "osx.10.11-corert", + "osx.10.11", + "osx.10.10-corert", + "osx.10.10", + "osx-corert", + "osx", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "osx.10.11-x64": [ + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64", + "osx.10.10", + "osx-x64", + "osx", + "unix-x64", + "unix", + "any", + "base" + ], + "osx.10.11-x64-corert": [ + "osx.10.11-x64-corert", + "osx.10.11-corert", + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64-corert", + "osx.10.10-corert", + "osx.10.10-x64", + "osx.10.10", + "osx-x64-corert", + "osx-corert", + "osx-x64", + "osx", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "osx.10.12": [ + "osx.10.12", + "osx.10.11", + "osx.10.10", + "osx", + "unix", + "any", + "base" + ], + "osx.10.12-corert": [ + "osx.10.12-corert", + "osx.10.12", + "osx.10.11-corert", + "osx.10.11", + "osx.10.10-corert", + "osx.10.10", + "osx-corert", + "osx", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "osx.10.12-x64": [ + "osx.10.12-x64", + "osx.10.12", + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64", + "osx.10.10", + "osx-x64", + "osx", + "unix-x64", + "unix", + "any", + "base" + ], + "osx.10.12-x64-corert": [ + "osx.10.12-x64-corert", + "osx.10.12-corert", + "osx.10.12-x64", + "osx.10.12", + "osx.10.11-x64-corert", + "osx.10.11-corert", + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64-corert", + "osx.10.10-corert", + "osx.10.10-x64", + "osx.10.10", + "osx-x64-corert", + "osx-corert", + "osx-x64", + "osx", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel": [ + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel-corert": [ + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel-x64": [ + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel-x64-corert": [ + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "linux-x64-corert", + "rhel", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.6": [ + "rhel.6", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.6-corert": [ + "rhel.6-corert", + "rhel.6", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.6-x64": [ + "rhel.6-x64", + "rhel.6", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.6-x64-corert": [ + "rhel.6-x64-corert", + "rhel.6-corert", + "rhel.6-x64", + "rhel.6", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.7": [ + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.7-corert": [ + "rhel.7-corert", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.7-x64": [ + "rhel.7-x64", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.7-x64-corert": [ + "rhel.7-x64-corert", + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.0": [ + "rhel.7.0", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.7.0-corert": [ + "rhel.7.0-corert", + "rhel.7.0", + "rhel.7-corert", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.0-x64": [ + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.7.0-x64-corert": [ + "rhel.7.0-x64-corert", + "rhel.7.0-corert", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64-corert", + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.1": [ + "rhel.7.1", + "rhel.7.0", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.7.1-corert": [ + "rhel.7.1-corert", + "rhel.7.1", + "rhel.7.0-corert", + "rhel.7.0", + "rhel.7-corert", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.1-x64": [ + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.7.1-x64-corert": [ + "rhel.7.1-x64-corert", + "rhel.7.1-corert", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64-corert", + "rhel.7.0-corert", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64-corert", + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.2": [ + "rhel.7.2", + "rhel.7.1", + "rhel.7.0", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.7.2-corert": [ + "rhel.7.2-corert", + "rhel.7.2", + "rhel.7.1-corert", + "rhel.7.1", + "rhel.7.0-corert", + "rhel.7.0", + "rhel.7-corert", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.2-x64": [ + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.7.2-x64-corert": [ + "rhel.7.2-x64-corert", + "rhel.7.2-corert", + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64-corert", + "rhel.7.1-corert", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64-corert", + "rhel.7.0-corert", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64-corert", + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.3": [ + "rhel.7.3", + "rhel.7.2", + "rhel.7.1", + "rhel.7.0", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.7.3-corert": [ + "rhel.7.3-corert", + "rhel.7.3", + "rhel.7.2-corert", + "rhel.7.2", + "rhel.7.1-corert", + "rhel.7.1", + "rhel.7.0-corert", + "rhel.7.0", + "rhel.7-corert", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.3-x64": [ + "rhel.7.3-x64", + "rhel.7.3", + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.7.3-x64-corert": [ + "rhel.7.3-x64-corert", + "rhel.7.3-corert", + "rhel.7.3-x64", + "rhel.7.3", + "rhel.7.2-x64-corert", + "rhel.7.2-corert", + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64-corert", + "rhel.7.1-corert", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64-corert", + "rhel.7.0-corert", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64-corert", + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.4": [ + "rhel.7.4", + "rhel.7.3", + "rhel.7.2", + "rhel.7.1", + "rhel.7.0", + "rhel.7", + "rhel", + "linux", + "unix", + "any", + "base" + ], + "rhel.7.4-corert": [ + "rhel.7.4-corert", + "rhel.7.4", + "rhel.7.3-corert", + "rhel.7.3", + "rhel.7.2-corert", + "rhel.7.2", + "rhel.7.1-corert", + "rhel.7.1", + "rhel.7.0-corert", + "rhel.7.0", + "rhel.7-corert", + "rhel.7", + "rhel-corert", + "rhel", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "rhel.7.4-x64": [ + "rhel.7.4-x64", + "rhel.7.4", + "rhel.7.3-x64", + "rhel.7.3", + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64", + "rhel.7", + "rhel-x64", + "rhel", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "rhel.7.4-x64-corert": [ + "rhel.7.4-x64-corert", + "rhel.7.4-corert", + "rhel.7.4-x64", + "rhel.7.4", + "rhel.7.3-x64-corert", + "rhel.7.3-corert", + "rhel.7.3-x64", + "rhel.7.3", + "rhel.7.2-x64-corert", + "rhel.7.2-corert", + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64-corert", + "rhel.7.1-corert", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64-corert", + "rhel.7.0-corert", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64-corert", + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert", + "rhel-corert", + "rhel-x64", + "rhel", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "tizen": [ + "tizen", + "linux", + "unix", + "any", + "base" + ], + "tizen-armel": [ + "tizen-armel", + "tizen", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "tizen-armel-corert": [ + "tizen-armel-corert", + "tizen-corert", + "tizen-armel", + "linux-armel-corert", + "tizen", + "linux-corert", + "linux-armel", + "unix-armel-corert", + "linux", + "unix-corert", + "unix-armel", + "unix", + "corert", + "any", + "base" + ], + "tizen-corert": [ + "tizen-corert", + "tizen", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "tizen.4.0.0": [ + "tizen.4.0.0", + "tizen", + "linux", + "unix", + "any", + "base" + ], + "tizen.4.0.0-armel": [ + "tizen.4.0.0-armel", + "tizen.4.0.0", + "tizen-armel", + "tizen", + "linux-armel", + "linux", + "unix-armel", + "unix", + "any", + "base" + ], + "tizen.4.0.0-armel-corert": [ + "tizen.4.0.0-armel-corert", + "tizen.4.0.0-corert", + "tizen.4.0.0-armel", + "tizen.4.0.0", + "tizen-armel-corert", + "tizen-corert", + "tizen-armel", + "tizen", + "linux-armel-corert", + "linux-corert", + "linux-armel", + "linux", + "unix-armel-corert", + "unix-corert", + "unix-armel", + "unix", + "corert", + "any", + "base" + ], + "tizen.4.0.0-corert": [ + "tizen.4.0.0-corert", + "tizen.4.0.0", + "tizen-corert", + "tizen", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu": [ + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu-arm": [ + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu-arm-corert": [ + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "debian-arm-corert", + "ubuntu", + "debian-corert", + "debian-arm", + "linux-arm-corert", + "debian", + "linux-corert", + "linux-arm", + "unix-arm-corert", + "linux", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu-arm64": [ + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu-arm64-corert": [ + "ubuntu-arm64-corert", + "ubuntu-corert", + "ubuntu-arm64", + "debian-arm64-corert", + "ubuntu", + "debian-corert", + "debian-arm64", + "linux-arm64-corert", + "debian", + "linux-corert", + "linux-arm64", + "unix-arm64-corert", + "linux", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu-corert": [ + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu-x64": [ + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu-x64-corert": [ + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "debian-x64-corert", + "ubuntu", + "debian-corert", + "debian-x64", + "linux-x64-corert", + "debian", + "linux-corert", + "linux-x64", + "unix-x64-corert", + "linux", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu-x86": [ + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu-x86-corert": [ + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "debian-x86-corert", + "ubuntu", + "debian-corert", + "debian-x86", + "linux-x86-corert", + "debian", + "linux-corert", + "linux-x86", + "unix-x86-corert", + "linux", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.04": [ + "ubuntu.14.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.14.04-arm": [ + "ubuntu.14.04-arm", + "ubuntu.14.04", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.14.04-arm-corert": [ + "ubuntu.14.04-arm-corert", + "ubuntu.14.04-corert", + "ubuntu.14.04-arm", + "ubuntu.14.04", + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "ubuntu", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.04-corert": [ + "ubuntu.14.04-corert", + "ubuntu.14.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.04-x64": [ + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.14.04-x64-corert": [ + "ubuntu.14.04-x64-corert", + "ubuntu.14.04-corert", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.04-x86": [ + "ubuntu.14.04-x86", + "ubuntu.14.04", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.14.04-x86-corert": [ + "ubuntu.14.04-x86-corert", + "ubuntu.14.04-corert", + "ubuntu.14.04-x86", + "ubuntu.14.04", + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "ubuntu", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.10": [ + "ubuntu.14.10", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.14.10-arm": [ + "ubuntu.14.10-arm", + "ubuntu.14.10", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.14.10-arm-corert": [ + "ubuntu.14.10-arm-corert", + "ubuntu.14.10-corert", + "ubuntu.14.10-arm", + "ubuntu.14.10", + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "ubuntu", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.10-corert": [ + "ubuntu.14.10-corert", + "ubuntu.14.10", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.10-x64": [ + "ubuntu.14.10-x64", + "ubuntu.14.10", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.14.10-x64-corert": [ + "ubuntu.14.10-x64-corert", + "ubuntu.14.10-corert", + "ubuntu.14.10-x64", + "ubuntu.14.10", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.14.10-x86": [ + "ubuntu.14.10-x86", + "ubuntu.14.10", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.14.10-x86-corert": [ + "ubuntu.14.10-x86-corert", + "ubuntu.14.10-corert", + "ubuntu.14.10-x86", + "ubuntu.14.10", + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "ubuntu", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.04": [ + "ubuntu.15.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.15.04-arm": [ + "ubuntu.15.04-arm", + "ubuntu.15.04", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.15.04-arm-corert": [ + "ubuntu.15.04-arm-corert", + "ubuntu.15.04-corert", + "ubuntu.15.04-arm", + "ubuntu.15.04", + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "ubuntu", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.04-corert": [ + "ubuntu.15.04-corert", + "ubuntu.15.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.04-x64": [ + "ubuntu.15.04-x64", + "ubuntu.15.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.15.04-x64-corert": [ + "ubuntu.15.04-x64-corert", + "ubuntu.15.04-corert", + "ubuntu.15.04-x64", + "ubuntu.15.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.04-x86": [ + "ubuntu.15.04-x86", + "ubuntu.15.04", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.15.04-x86-corert": [ + "ubuntu.15.04-x86-corert", + "ubuntu.15.04-corert", + "ubuntu.15.04-x86", + "ubuntu.15.04", + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "ubuntu", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.10": [ + "ubuntu.15.10", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.15.10-arm": [ + "ubuntu.15.10-arm", + "ubuntu.15.10", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.15.10-arm-corert": [ + "ubuntu.15.10-arm-corert", + "ubuntu.15.10-corert", + "ubuntu.15.10-arm", + "ubuntu.15.10", + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "ubuntu", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.10-corert": [ + "ubuntu.15.10-corert", + "ubuntu.15.10", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.10-x64": [ + "ubuntu.15.10-x64", + "ubuntu.15.10", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.15.10-x64-corert": [ + "ubuntu.15.10-x64-corert", + "ubuntu.15.10-corert", + "ubuntu.15.10-x64", + "ubuntu.15.10", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.15.10-x86": [ + "ubuntu.15.10-x86", + "ubuntu.15.10", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.15.10-x86-corert": [ + "ubuntu.15.10-x86-corert", + "ubuntu.15.10-corert", + "ubuntu.15.10-x86", + "ubuntu.15.10", + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "ubuntu", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.04": [ + "ubuntu.16.04", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.16.04-arm": [ + "ubuntu.16.04-arm", + "ubuntu.16.04", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.16.04-arm-corert": [ + "ubuntu.16.04-arm-corert", + "ubuntu.16.04-corert", + "ubuntu.16.04-arm", + "ubuntu.16.04", + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "ubuntu", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.04-arm64": [ + "ubuntu.16.04-arm64", + "ubuntu.16.04", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.16.04-arm64-corert": [ + "ubuntu.16.04-arm64-corert", + "ubuntu.16.04-corert", + "ubuntu.16.04-arm64", + "ubuntu.16.04", + "ubuntu-arm64-corert", + "ubuntu-corert", + "ubuntu-arm64", + "ubuntu", + "debian-arm64-corert", + "debian-corert", + "debian-arm64", + "debian", + "linux-arm64-corert", + "linux-corert", + "linux-arm64", + "linux", + "unix-arm64-corert", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.04-corert": [ + "ubuntu.16.04-corert", + "ubuntu.16.04", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.04-x64": [ + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.16.04-x64-corert": [ + "ubuntu.16.04-x64-corert", + "ubuntu.16.04-corert", + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.04-x86": [ + "ubuntu.16.04-x86", + "ubuntu.16.04", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.16.04-x86-corert": [ + "ubuntu.16.04-x86-corert", + "ubuntu.16.04-corert", + "ubuntu.16.04-x86", + "ubuntu.16.04", + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "ubuntu", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.10": [ + "ubuntu.16.10", + "ubuntu", + "debian", + "linux", + "unix", + "any", + "base" + ], + "ubuntu.16.10-arm": [ + "ubuntu.16.10-arm", + "ubuntu.16.10", + "ubuntu-arm", + "ubuntu", + "debian-arm", + "debian", + "linux-arm", + "linux", + "unix-arm", + "unix", + "any", + "base" + ], + "ubuntu.16.10-arm-corert": [ + "ubuntu.16.10-arm-corert", + "ubuntu.16.10-corert", + "ubuntu.16.10-arm", + "ubuntu.16.10", + "ubuntu-arm-corert", + "ubuntu-corert", + "ubuntu-arm", + "ubuntu", + "debian-arm-corert", + "debian-corert", + "debian-arm", + "debian", + "linux-arm-corert", + "linux-corert", + "linux-arm", + "linux", + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.10-arm64": [ + "ubuntu.16.10-arm64", + "ubuntu.16.10", + "ubuntu-arm64", + "ubuntu", + "debian-arm64", + "debian", + "linux-arm64", + "linux", + "unix-arm64", + "unix", + "any", + "base" + ], + "ubuntu.16.10-arm64-corert": [ + "ubuntu.16.10-arm64-corert", + "ubuntu.16.10-corert", + "ubuntu.16.10-arm64", + "ubuntu.16.10", + "ubuntu-arm64-corert", + "ubuntu-corert", + "ubuntu-arm64", + "ubuntu", + "debian-arm64-corert", + "debian-corert", + "debian-arm64", + "debian", + "linux-arm64-corert", + "linux-corert", + "linux-arm64", + "linux", + "unix-arm64-corert", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.10-corert": [ + "ubuntu.16.10-corert", + "ubuntu.16.10", + "ubuntu-corert", + "ubuntu", + "debian-corert", + "debian", + "linux-corert", + "linux", + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.10-x64": [ + "ubuntu.16.10-x64", + "ubuntu.16.10", + "ubuntu-x64", + "ubuntu", + "debian-x64", + "debian", + "linux-x64", + "linux", + "unix-x64", + "unix", + "any", + "base" + ], + "ubuntu.16.10-x64-corert": [ + "ubuntu.16.10-x64-corert", + "ubuntu.16.10-corert", + "ubuntu.16.10-x64", + "ubuntu.16.10", + "ubuntu-x64-corert", + "ubuntu-corert", + "ubuntu-x64", + "ubuntu", + "debian-x64-corert", + "debian-corert", + "debian-x64", + "debian", + "linux-x64-corert", + "linux-corert", + "linux-x64", + "linux", + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "ubuntu.16.10-x86": [ + "ubuntu.16.10-x86", + "ubuntu.16.10", + "ubuntu-x86", + "ubuntu", + "debian-x86", + "debian", + "linux-x86", + "linux", + "unix-x86", + "unix", + "any", + "base" + ], + "ubuntu.16.10-x86-corert": [ + "ubuntu.16.10-x86-corert", + "ubuntu.16.10-corert", + "ubuntu.16.10-x86", + "ubuntu.16.10", + "ubuntu-x86-corert", + "ubuntu-corert", + "ubuntu-x86", + "ubuntu", + "debian-x86-corert", + "debian-corert", + "debian-x86", + "debian", + "linux-x86-corert", + "linux-corert", + "linux-x86", + "linux", + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "unix": [ + "unix", + "any", + "base" + ], + "unix-arm": [ + "unix-arm", + "unix", + "any", + "base" + ], + "unix-arm-corert": [ + "unix-arm-corert", + "unix-corert", + "unix-arm", + "unix", + "corert", + "any", + "base" + ], + "unix-arm64": [ + "unix-arm64", + "unix", + "any", + "base" + ], + "unix-arm64-corert": [ + "unix-arm64-corert", + "unix-corert", + "unix-arm64", + "unix", + "corert", + "any", + "base" + ], + "unix-armel": [ + "unix-armel", + "unix", + "any", + "base" + ], + "unix-armel-corert": [ + "unix-armel-corert", + "unix-corert", + "unix-armel", + "unix", + "corert", + "any", + "base" + ], + "unix-corert": [ + "unix-corert", + "unix", + "corert", + "any", + "base" + ], + "unix-x64": [ + "unix-x64", + "unix", + "any", + "base" + ], + "unix-x64-corert": [ + "unix-x64-corert", + "unix-corert", + "unix-x64", + "unix", + "corert", + "any", + "base" + ], + "unix-x86": [ + "unix-x86", + "unix", + "any", + "base" + ], + "unix-x86-corert": [ + "unix-x86-corert", + "unix-corert", + "unix-x86", + "unix", + "corert", + "any", + "base" + ], + "win": [ + "win", + "any", + "base" + ], + "win-aot": [ + "win-aot", + "win", + "aot", + "any", + "base" + ], + "win-arm": [ + "win-arm", + "win", + "any", + "base" + ], + "win-arm-aot": [ + "win-arm-aot", + "win-aot", + "win-arm", + "win", + "aot", + "any", + "base" + ], + "win-arm-corert": [ + "win-arm-corert", + "win-corert", + "win-arm", + "win", + "corert", + "any", + "base" + ], + "win-arm64": [ + "win-arm64", + "win", + "any", + "base" + ], + "win-arm64-aot": [ + "win-arm64-aot", + "win-aot", + "win-arm64", + "win", + "aot", + "any", + "base" + ], + "win-arm64-corert": [ + "win-arm64-corert", + "win-corert", + "win-arm64", + "win", + "corert", + "any", + "base" + ], + "win-corert": [ + "win-corert", + "win", + "corert", + "any", + "base" + ], + "win-x64": [ + "win-x64", + "win", + "any", + "base" + ], + "win-x64-aot": [ + "win-x64-aot", + "win-aot", + "win-x64", + "win", + "aot", + "any", + "base" + ], + "win-x64-corert": [ + "win-x64-corert", + "win-corert", + "win-x64", + "win", + "corert", + "any", + "base" + ], + "win-x86": [ + "win-x86", + "win", + "any", + "base" + ], + "win-x86-aot": [ + "win-x86-aot", + "win-aot", + "win-x86", + "win", + "aot", + "any", + "base" + ], + "win-x86-corert": [ + "win-x86-corert", + "win-corert", + "win-x86", + "win", + "corert", + "any", + "base" + ], + "win10": [ + "win10", + "win81", + "win8", + "win7", + "win", + "any", + "base" + ], + "win10-aot": [ + "win10-aot", + "win10", + "win81-aot", + "win81", + "win8-aot", + "win8", + "win7-aot", + "win7", + "win-aot", + "win", + "aot", + "any", + "base" + ], + "win10-arm": [ + "win10-arm", + "win10", + "win81-arm", + "win81", + "win8-arm", + "win8", + "win7-arm", + "win7", + "win-arm", + "win", + "any", + "base" + ], + "win10-arm-aot": [ + "win10-arm-aot", + "win10-aot", + "win10-arm", + "win10", + "win81-arm-aot", + "win81-aot", + "win81-arm", + "win81", + "win8-arm-aot", + "win8-aot", + "win8-arm", + "win8", + "win7-arm-aot", + "win7-aot", + "win7-arm", + "win7", + "win-arm-aot", + "win-aot", + "win-arm", + "win", + "aot", + "any", + "base" + ], + "win10-arm-corert": [ + "win10-arm-corert", + "win10-corert", + "win10-arm", + "win10", + "win81-arm-corert", + "win81-corert", + "win81-arm", + "win81", + "win8-arm-corert", + "win8-corert", + "win8-arm", + "win8", + "win7-arm-corert", + "win7-corert", + "win7-arm", + "win7", + "win-arm-corert", + "win-corert", + "win-arm", + "win", + "corert", + "any", + "base" + ], + "win10-arm64": [ + "win10-arm64", + "win10", + "win81-arm64", + "win81", + "win8-arm64", + "win8", + "win7-arm64", + "win7", + "win-arm64", + "win", + "any", + "base" + ], + "win10-arm64-aot": [ + "win10-arm64-aot", + "win10-aot", + "win10-arm64", + "win10", + "win81-arm64-aot", + "win81-aot", + "win81-arm64", + "win81", + "win8-arm64-aot", + "win8-aot", + "win8-arm64", + "win8", + "win7-arm64-aot", + "win7-aot", + "win7-arm64", + "win7", + "win-arm64-aot", + "win-aot", + "win-arm64", + "win", + "aot", + "any", + "base" + ], + "win10-arm64-corert": [ + "win10-arm64-corert", + "win10-corert", + "win10-arm64", + "win10", + "win81-arm64-corert", + "win81-corert", + "win81-arm64", + "win81", + "win8-arm64-corert", + "win8-corert", + "win8-arm64", + "win8", + "win7-arm64-corert", + "win7-corert", + "win7-arm64", + "win7", + "win-arm64-corert", + "win-corert", + "win-arm64", + "win", + "corert", + "any", + "base" + ], + "win10-corert": [ + "win10-corert", + "win10", + "win81-corert", + "win81", + "win8-corert", + "win8", + "win7-corert", + "win7", + "win-corert", + "win", + "corert", + "any", + "base" + ], + "win10-x64": [ + "win10-x64", + "win10", + "win81-x64", + "win81", + "win8-x64", + "win8", + "win7-x64", + "win7", + "win-x64", + "win", + "any", + "base" + ], + "win10-x64-aot": [ + "win10-x64-aot", + "win10-aot", + "win10-x64", + "win10", + "win81-x64-aot", + "win81-aot", + "win81-x64", + "win81", + "win8-x64-aot", + "win8-aot", + "win8-x64", + "win8", + "win7-x64-aot", + "win7-aot", + "win7-x64", + "win7", + "win-x64-aot", + "win-aot", + "win-x64", + "win", + "aot", + "any", + "base" + ], + "win10-x64-corert": [ + "win10-x64-corert", + "win10-corert", + "win10-x64", + "win10", + "win81-x64-corert", + "win81-corert", + "win81-x64", + "win81", + "win8-x64-corert", + "win8-corert", + "win8-x64", + "win8", + "win7-x64-corert", + "win7-corert", + "win7-x64", + "win7", + "win-x64-corert", + "win-corert", + "win-x64", + "win", + "corert", + "any", + "base" + ], + "win10-x86": [ + "win10-x86", + "win10", + "win81-x86", + "win81", + "win8-x86", + "win8", + "win7-x86", + "win7", + "win-x86", + "win", + "any", + "base" + ], + "win10-x86-aot": [ + "win10-x86-aot", + "win10-aot", + "win10-x86", + "win10", + "win81-x86-aot", + "win81-aot", + "win81-x86", + "win81", + "win8-x86-aot", + "win8-aot", + "win8-x86", + "win8", + "win7-x86-aot", + "win7-aot", + "win7-x86", + "win7", + "win-x86-aot", + "win-aot", + "win-x86", + "win", + "aot", + "any", + "base" + ], + "win10-x86-corert": [ + "win10-x86-corert", + "win10-corert", + "win10-x86", + "win10", + "win81-x86-corert", + "win81-corert", + "win81-x86", + "win81", + "win8-x86-corert", + "win8-corert", + "win8-x86", + "win8", + "win7-x86-corert", + "win7-corert", + "win7-x86", + "win7", + "win-x86-corert", + "win-corert", + "win-x86", + "win", + "corert", + "any", + "base" + ], + "win7": [ + "win7", + "win", + "any", + "base" + ], + "win7-aot": [ + "win7-aot", + "win7", + "win-aot", + "win", + "aot", + "any", + "base" + ], + "win7-arm": [ + "win7-arm", + "win7", + "win-arm", + "win", + "any", + "base" + ], + "win7-arm-aot": [ + "win7-arm-aot", + "win7-aot", + "win7-arm", + "win7", + "win-arm-aot", + "win-aot", + "win-arm", + "win", + "aot", + "any", + "base" + ], + "win7-arm-corert": [ + "win7-arm-corert", + "win7-corert", + "win7-arm", + "win7", + "win-arm-corert", + "win-corert", + "win-arm", + "win", + "corert", + "any", + "base" + ], + "win7-arm64": [ + "win7-arm64", + "win7", + "win-arm64", + "win", + "any", + "base" + ], + "win7-arm64-aot": [ + "win7-arm64-aot", + "win7-aot", + "win7-arm64", + "win7", + "win-arm64-aot", + "win-aot", + "win-arm64", + "win", + "aot", + "any", + "base" + ], + "win7-arm64-corert": [ + "win7-arm64-corert", + "win7-corert", + "win7-arm64", + "win7", + "win-arm64-corert", + "win-corert", + "win-arm64", + "win", + "corert", + "any", + "base" + ], + "win7-corert": [ + "win7-corert", + "win7", + "win-corert", + "win", + "corert", + "any", + "base" + ], + "win7-x64": [ + "win7-x64", + "win7", + "win-x64", + "win", + "any", + "base" + ], + "win7-x64-aot": [ + "win7-x64-aot", + "win7-aot", + "win7-x64", + "win7", + "win-x64-aot", + "win-aot", + "win-x64", + "win", + "aot", + "any", + "base" + ], + "win7-x64-corert": [ + "win7-x64-corert", + "win7-corert", + "win7-x64", + "win7", + "win-x64-corert", + "win-corert", + "win-x64", + "win", + "corert", + "any", + "base" + ], + "win7-x86": [ + "win7-x86", + "win7", + "win-x86", + "win", + "any", + "base" + ], + "win7-x86-aot": [ + "win7-x86-aot", + "win7-aot", + "win7-x86", + "win7", + "win-x86-aot", + "win-aot", + "win-x86", + "win", + "aot", + "any", + "base" + ], + "win7-x86-corert": [ + "win7-x86-corert", + "win7-corert", + "win7-x86", + "win7", + "win-x86-corert", + "win-corert", + "win-x86", + "win", + "corert", + "any", + "base" + ], + "win8": [ + "win8", + "win7", + "win", + "any", + "base" + ], + "win8-aot": [ + "win8-aot", + "win8", + "win7-aot", + "win7", + "win-aot", + "win", + "aot", + "any", + "base" + ], + "win8-arm": [ + "win8-arm", + "win8", + "win7-arm", + "win7", + "win-arm", + "win", + "any", + "base" + ], + "win8-arm-aot": [ + "win8-arm-aot", + "win8-aot", + "win8-arm", + "win8", + "win7-arm-aot", + "win7-aot", + "win7-arm", + "win7", + "win-arm-aot", + "win-aot", + "win-arm", + "win", + "aot", + "any", + "base" + ], + "win8-arm-corert": [ + "win8-arm-corert", + "win8-corert", + "win8-arm", + "win8", + "win7-arm-corert", + "win7-corert", + "win7-arm", + "win7", + "win-arm-corert", + "win-corert", + "win-arm", + "win", + "corert", + "any", + "base" + ], + "win8-arm64": [ + "win8-arm64", + "win8", + "win7-arm64", + "win7", + "win-arm64", + "win", + "any", + "base" + ], + "win8-arm64-aot": [ + "win8-arm64-aot", + "win8-aot", + "win8-arm64", + "win8", + "win7-arm64-aot", + "win7-aot", + "win7-arm64", + "win7", + "win-arm64-aot", + "win-aot", + "win-arm64", + "win", + "aot", + "any", + "base" + ], + "win8-arm64-corert": [ + "win8-arm64-corert", + "win8-corert", + "win8-arm64", + "win8", + "win7-arm64-corert", + "win7-corert", + "win7-arm64", + "win7", + "win-arm64-corert", + "win-corert", + "win-arm64", + "win", + "corert", + "any", + "base" + ], + "win8-corert": [ + "win8-corert", + "win8", + "win7-corert", + "win7", + "win-corert", + "win", + "corert", + "any", + "base" + ], + "win8-x64": [ + "win8-x64", + "win8", + "win7-x64", + "win7", + "win-x64", + "win", + "any", + "base" + ], + "win8-x64-aot": [ + "win8-x64-aot", + "win8-aot", + "win8-x64", + "win8", + "win7-x64-aot", + "win7-aot", + "win7-x64", + "win7", + "win-x64-aot", + "win-aot", + "win-x64", + "win", + "aot", + "any", + "base" + ], + "win8-x64-corert": [ + "win8-x64-corert", + "win8-corert", + "win8-x64", + "win8", + "win7-x64-corert", + "win7-corert", + "win7-x64", + "win7", + "win-x64-corert", + "win-corert", + "win-x64", + "win", + "corert", + "any", + "base" + ], + "win8-x86": [ + "win8-x86", + "win8", + "win7-x86", + "win7", + "win-x86", + "win", + "any", + "base" + ], + "win8-x86-aot": [ + "win8-x86-aot", + "win8-aot", + "win8-x86", + "win8", + "win7-x86-aot", + "win7-aot", + "win7-x86", + "win7", + "win-x86-aot", + "win-aot", + "win-x86", + "win", + "aot", + "any", + "base" + ], + "win8-x86-corert": [ + "win8-x86-corert", + "win8-corert", + "win8-x86", + "win8", + "win7-x86-corert", + "win7-corert", + "win7-x86", + "win7", + "win-x86-corert", + "win-corert", + "win-x86", + "win", + "corert", + "any", + "base" + ], + "win81": [ + "win81", + "win8", + "win7", + "win", + "any", + "base" + ], + "win81-aot": [ + "win81-aot", + "win81", + "win8-aot", + "win8", + "win7-aot", + "win7", + "win-aot", + "win", + "aot", + "any", + "base" + ], + "win81-arm": [ + "win81-arm", + "win81", + "win8-arm", + "win8", + "win7-arm", + "win7", + "win-arm", + "win", + "any", + "base" + ], + "win81-arm-aot": [ + "win81-arm-aot", + "win81-aot", + "win81-arm", + "win81", + "win8-arm-aot", + "win8-aot", + "win8-arm", + "win8", + "win7-arm-aot", + "win7-aot", + "win7-arm", + "win7", + "win-arm-aot", + "win-aot", + "win-arm", + "win", + "aot", + "any", + "base" + ], + "win81-arm-corert": [ + "win81-arm-corert", + "win81-corert", + "win81-arm", + "win81", + "win8-arm-corert", + "win8-corert", + "win8-arm", + "win8", + "win7-arm-corert", + "win7-corert", + "win7-arm", + "win7", + "win-arm-corert", + "win-corert", + "win-arm", + "win", + "corert", + "any", + "base" + ], + "win81-arm64": [ + "win81-arm64", + "win81", + "win8-arm64", + "win8", + "win7-arm64", + "win7", + "win-arm64", + "win", + "any", + "base" + ], + "win81-arm64-aot": [ + "win81-arm64-aot", + "win81-aot", + "win81-arm64", + "win81", + "win8-arm64-aot", + "win8-aot", + "win8-arm64", + "win8", + "win7-arm64-aot", + "win7-aot", + "win7-arm64", + "win7", + "win-arm64-aot", + "win-aot", + "win-arm64", + "win", + "aot", + "any", + "base" + ], + "win81-arm64-corert": [ + "win81-arm64-corert", + "win81-corert", + "win81-arm64", + "win81", + "win8-arm64-corert", + "win8-corert", + "win8-arm64", + "win8", + "win7-arm64-corert", + "win7-corert", + "win7-arm64", + "win7", + "win-arm64-corert", + "win-corert", + "win-arm64", + "win", + "corert", + "any", + "base" + ], + "win81-corert": [ + "win81-corert", + "win81", + "win8-corert", + "win8", + "win7-corert", + "win7", + "win-corert", + "win", + "corert", + "any", + "base" + ], + "win81-x64": [ + "win81-x64", + "win81", + "win8-x64", + "win8", + "win7-x64", + "win7", + "win-x64", + "win", + "any", + "base" + ], + "win81-x64-aot": [ + "win81-x64-aot", + "win81-aot", + "win81-x64", + "win81", + "win8-x64-aot", + "win8-aot", + "win8-x64", + "win8", + "win7-x64-aot", + "win7-aot", + "win7-x64", + "win7", + "win-x64-aot", + "win-aot", + "win-x64", + "win", + "aot", + "any", + "base" + ], + "win81-x64-corert": [ + "win81-x64-corert", + "win81-corert", + "win81-x64", + "win81", + "win8-x64-corert", + "win8-corert", + "win8-x64", + "win8", + "win7-x64-corert", + "win7-corert", + "win7-x64", + "win7", + "win-x64-corert", + "win-corert", + "win-x64", + "win", + "corert", + "any", + "base" + ], + "win81-x86": [ + "win81-x86", + "win81", + "win8-x86", + "win8", + "win7-x86", + "win7", + "win-x86", + "win", + "any", + "base" + ], + "win81-x86-aot": [ + "win81-x86-aot", + "win81-aot", + "win81-x86", + "win81", + "win8-x86-aot", + "win8-aot", + "win8-x86", + "win8", + "win7-x86-aot", + "win7-aot", + "win7-x86", + "win7", + "win-x86-aot", + "win-aot", + "win-x86", + "win", + "aot", + "any", + "base" + ], + "win81-x86-corert": [ + "win81-x86-corert", + "win81-corert", + "win81-x86", + "win81", + "win8-x86-corert", + "win8-corert", + "win8-x86", + "win8", + "win7-x86-corert", + "win7-corert", + "win7-x86", + "win7", + "win-x86-corert", + "win-corert", + "win-x86", + "win", + "corert", + "any", + "base" + ] +} \ No newline at end of file diff --git a/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.json b/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.json index 319bd6a18a..8e16fcdd96 100644 --- a/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.json +++ b/external/corefx/pkg/Microsoft.NETCore.Platforms/runtime.json @@ -1,935 +1,2259 @@ { - "runtimes": { - "base": { - }, - - "any": { - "#import": [ "base" ] - }, - - "android": { - "#import": [ "any" ] - }, - "android-arm": { - "#import": [ "any" ] - }, - "android-arm64": { - "#import": [ "any" ] - }, - - "android.21": { - "#import": [ "android" ] - }, - "android.21-arm": { - "#import": [ "android.21", "android-arm" ] - }, - "android.21-arm64": { - "#import": [ "android.21", "android-arm64" ] - }, - - "win": { - "#import": [ "any" ] - }, - "win-x86": { - "#import": [ "win" ] - }, - "win-x64": { - "#import": [ "win" ] - }, - "win-arm": { - "#import": [ "win" ] - }, - "win-arm64": { - "#import": [ "win" ] - }, - - "win7": { - "#import": [ "win" ] - }, - "win7-x86": { - "#import": [ "win7", "win-x86" ] - }, - "win7-x64": { - "#import": [ "win7", "win-x64" ] - }, - - "win8": { - "#import": [ "win7" ] - }, - "win8-x86": { - "#import": [ "win8", "win7-x86" ] - }, - "win8-x64": { - "#import": [ "win8", "win7-x64" ] - }, - "win8-arm": { - "#import": [ "win8", "win-arm" ] - }, - - "win81": { - "#import": [ "win8" ] - }, - "win81-x86": { - "#import": [ "win81", "win8-x86" ] - }, - "win81-x64": { - "#import": [ "win81", "win8-x64" ] - }, - "win81-arm": { - "#import": [ "win81", "win8-arm" ] - }, - - "win10": { - "#import": [ "win81" ] - }, - "win10-x86": { - "#import": [ "win10", "win81-x86" ] - }, - "win10-x64": { - "#import": [ "win10", "win81-x64" ] - }, - "win10-arm": { - "#import": [ "win10", "win81-arm" ] - }, - "win10-arm64": { - "#import": [ "win10", "win-arm64" ] - }, - - "aot": { - "#import": [ "any" ] - }, - - "win-aot": { - "#import": [ "win", "aot" ] - }, - "win-x86-aot": { - "#import": [ "win-aot", "win-x86" ] - }, - "win-x64-aot": { - "#import": [ "win-aot", "win-x64" ] - }, - - "win7-aot": { - "#import": [ "win-aot", "win7" ] - }, - "win7-x86-aot": { - "#import": [ "win7-aot", "win7-x86" ] - }, - "win7-x64-aot": { - "#import": [ "win7-aot", "win7-x64" ] - }, - - "win8-aot": { - "#import": [ "win8", "win7-aot" ] - }, - "win8-x86-aot": { - "#import": [ "win8-aot", "win8-x86", "win7-x86-aot" ] - }, - "win8-x64-aot": { - "#import": [ "win8-aot", "win8-x64", "win7-x64-aot" ] - }, - "win8-arm-aot": { - "#import": [ "win8-aot", "win8-arm" ] - }, - - "win81-aot": { - "#import": [ "win81", "win8-aot" ] - }, - "win81-x86-aot": { - "#import": [ "win81-aot", "win81-x86", "win8-x86-aot" ] - }, - "win81-x64-aot": { - "#import": [ "win81-aot", "win81-x64", "win8-x64-aot" ] - }, - "win81-arm-aot": { - "#import": [ "win81-aot", "win81-arm", "win8-arm-aot" ] - }, - - "win10-aot": { - "#import": [ "win10", "win81-aot" ] - }, - "win10-x86-aot": { - "#import": [ "win10-aot", "win10-x86", "win81-x86-aot" ] - }, - "win10-x64-aot": { - "#import": [ "win10-aot", "win10-x64", "win81-x64-aot" ] - }, - "win10-arm-aot": { - "#import": [ "win10-aot", "win10-arm", "win81-arm-aot" ] - }, - "win10-arm64-aot": { - "#import": [ "win10-aot", "win10-arm64" ] - }, - - "unix": { - "#import": [ "any" ] - }, - "unix-x64": { - "#import": [ "unix" ] - }, - "unix-x86": { - "#import": [ "unix" ] - }, - "unix-arm": { - "#import": [ "unix" ] - }, - "unix-armel": { - "#import": [ "unix" ] - }, - "unix-arm64": { - "#import": [ "unix" ] - }, - - "osx": { - "#import": [ "unix" ] - }, - "osx-x64": { - "#import": [ "osx", "unix-x64" ] - }, - - "osx.10.10": { - "#import": [ "osx" ] - }, - "osx.10.10-x64": { - "#import": [ "osx.10.10", "osx-x64" ] - }, - - "osx.10.11": { - "#import": [ "osx.10.10" ] - }, - "osx.10.11-x64": { - "#import": [ "osx.10.11", "osx.10.10-x64" ] - }, - - "osx.10.12": { - "#import": [ "osx.10.11" ] - }, - "osx.10.12-x64": { - "#import": [ "osx.10.12", "osx.10.11-x64" ] - }, - - "linux": { - "#import": [ "unix" ] - }, - "linux-x64": { - "#import": [ "linux", "unix-x64" ] - }, - "linux-x86": { - "#import": [ "linux", "unix-x86" ] - }, - "linux-arm": { - "#import": [ "linux", "unix-arm" ] - }, - "linux-armel": { - "#import": [ "linux", "unix-armel" ] - }, - "linux-arm64": { - "#import": [ "linux", "unix-arm64" ] - }, - - "rhel": { - "#import": [ "linux" ] - }, - "rhel-x64": { - "#import": [ "rhel", "linux-x64" ] - }, - - "rhel.7": { - "#import": [ "rhel" ] - }, - "rhel.7-x64": { - "#import": [ "rhel.7", "rhel-x64" ] - }, - - "rhel.7.0": { - "#import": [ "rhel.7" ] - }, - "rhel.7.0-x64": { - "#import": [ "rhel.7.0", "rhel.7-x64" ] - }, - - "rhel.7.1": { - "#import": [ "rhel.7.0" ] - }, - "rhel.7.1-x64": { - "#import": [ "rhel.7.1", "rhel.7.0-x64" ] - }, - - "rhel.7.2": { - "#import": [ "rhel.7.1" ] - }, - "rhel.7.2-x64": { - "#import": [ "rhel.7.2", "rhel.7.1-x64" ] - }, - - "rhel.7.3": { - "#import": [ "rhel.7.2" ] - }, - "rhel.7.3-x64": { - "#import": [ "rhel.7.3", "rhel.7.2-x64" ] - }, - - "rhel.7.4": { - "#import": [ "rhel.7.3" ] - }, - "rhel.7.4-x64": { - "#import": [ "rhel.7.4", "rhel.7.3-x64" ] - }, - - "ol": { - "#import": [ "rhel" ] - }, - "ol-x64": { - "#import": [ "ol", "rhel-x64" ] - }, - - "ol.7": { - "#import": [ "ol", "rhel.7" ] - }, - "ol.7-x64": { - "#import": [ "ol.7", "ol-x64", "rhel.7-x64" ] - }, - - "ol.7.0": { - "#import": [ "ol.7", "rhel.7.0" ] - }, - "ol.7.0-x64": { - "#import": [ "ol.7.0", "ol.7-x64", "rhel.7.0-x64" ] - }, - - "ol.7.1": { - "#import": [ "ol.7.0", "rhel.7.1" ] - }, - "ol.7.1-x64": { - "#import": [ "ol.7.1", "ol.7.0-x64", "rhel.7.1-x64" ] - }, - - "ol.7.2": { - "#import": [ "ol.7.1", "rhel.7.2" ] - }, - "ol.7.2-x64": { - "#import": [ "ol.7.2", "ol.7.1-x64", "rhel.7.2-x64" ] - }, - - "centos": { - "#import": [ "rhel" ] - }, - "centos-x64": { - "#import": [ "centos", "rhel-x64" ] - }, - - "centos.7": { - "#import": [ "centos", "rhel.7" ] - }, - "centos.7-x64": { - "#import": [ "centos.7", "centos-x64", "rhel.7-x64" ] - }, - - "debian": { - "#import": [ "linux" ] - }, - "debian-x64": { - "#import": [ "debian", "linux-x64" ] - }, - "debian-x86": { - "#import": [ "debian", "linux-x86" ] - }, - "debian-arm": { - "#import": [ "debian", "linux-arm" ] - }, - "debian-armel": { - "#import": [ "debian", "linux-armel" ] - }, - "debian-arm64": { - "#import": [ "debian", "linux-arm64" ] - }, - - "debian.8": { - "#import": [ "debian" ] - }, - "debian.8-x64": { - "#import": [ "debian.8", "debian-x64" ] - }, - "debian.8-x86": { - "#import": [ "debian.8", "debian-x86" ] - }, - "debian.8-arm": { - "#import": [ "debian.8", "debian-arm" ] - }, - "debian.8-armel": { - "#import": [ "debian.8", "debian-armel" ] - }, - "debian.8-arm64": { - "#import": [ "debian.8", "debian-arm64" ] - }, - - "tizen": { - "#import": [ "linux" ] - }, - "tizen-armel": { - "#import": [ "tizen", "linux-armel" ] - }, - "tizen.4.0.0-armel": { - "#import": [ "tizen.4.0.0", "tizen-armel" ] - }, - - "ubuntu": { - "#import": [ "debian" ] - }, - - "ubuntu-x64": { - "#import": [ "ubuntu", "debian-x64" ] - }, - - "ubuntu-x86": { - "#import": [ "ubuntu", "debian-x86" ] - }, - - "ubuntu-arm": { - "#import": [ "ubuntu", "debian-arm" ] - }, - - "ubuntu-arm64": { - "#import": [ "ubuntu", "debian-arm64" ] - }, - - "ubuntu.14.04": { - "#import": [ "ubuntu" ] - }, - "ubuntu.14.04-x64": { - "#import": [ "ubuntu.14.04", "ubuntu-x64" ] - }, - "ubuntu.14.04-x86": { - "#import": [ "ubuntu.14.04", "ubuntu-x86" ] - }, - "ubuntu.14.04-arm": { - "#import": [ "ubuntu.14.04", "ubuntu-arm" ] - }, - - "ubuntu.14.10": { - "#import": [ "ubuntu" ] - }, - "ubuntu.14.10-x64": { - "#import": [ "ubuntu.14.10", "ubuntu-x64" ] - }, - "ubuntu.14.10-x86": { - "#import": [ "ubuntu.14.10", "ubuntu-x86" ] - }, - "ubuntu.14.10-arm": { - "#import": [ "ubuntu.14.10", "ubuntu-arm" ] - }, - - "ubuntu.15.04": { - "#import": [ "ubuntu" ] - }, - "ubuntu.15.04-x64": { - "#import": [ "ubuntu.15.04", "ubuntu-x64" ] - }, - "ubuntu.15.04-x86": { - "#import": [ "ubuntu.15.04", "ubuntu-x86" ] - }, - "ubuntu.15.04-arm": { - "#import": [ "ubuntu.15.04", "ubuntu-arm" ] - }, - - "ubuntu.15.10": { - "#import": [ "ubuntu" ] - }, - "ubuntu.15.10-x64": { - "#import": [ "ubuntu.15.10", "ubuntu-x64" ] - }, - "ubuntu.15.10-x86": { - "#import": [ "ubuntu.15.10", "ubuntu-x86" ] - }, - "ubuntu.15.10-arm": { - "#import": [ "ubuntu.15.10", "ubuntu-arm" ] - }, - - "ubuntu.16.04": { - "#import": [ "ubuntu" ] - }, - "ubuntu.16.04-x64": { - "#import": [ "ubuntu.16.04", "ubuntu-x64" ] - }, - "ubuntu.16.04-x86": { - "#import": [ "ubuntu.16.04", "ubuntu-x86" ] - }, - "ubuntu.16.04-arm": { - "#import": [ "ubuntu.16.04", "ubuntu-arm" ] - }, - "ubuntu.16.04-arm64": { - "#import": [ "ubuntu.16.04", "ubuntu-arm64" ] - }, - - "ubuntu.16.10": { - "#import": [ "ubuntu" ] - }, - "ubuntu.16.10-x64": { - "#import": [ "ubuntu.16.10", "ubuntu-x64" ] - }, - "ubuntu.16.10-x86": { - "#import": [ "ubuntu.16.10", "ubuntu-x86" ] - }, - "ubuntu.16.10-arm": { - "#import": [ "ubuntu.16.10", "ubuntu-arm" ] - }, - "ubuntu.16.10-arm64": { - "#import": [ "ubuntu.16.10", "ubuntu-arm64" ] - }, - - "linuxmint.17": { - "#import": [ "ubuntu.14.04" ] - }, - "linuxmint.17-x64": { - "#import": [ "linuxmint.17", "ubuntu.14.04-x64" ] - }, - - "linuxmint.17.1": { - "#import": [ "linuxmint.17" ] - }, - "linuxmint.17.1-x64": { - "#import": [ "linuxmint.17.1", "linuxmint.17-x64" ] - }, - - "linuxmint.17.2": { - "#import": [ "linuxmint.17.1" ] - }, - "linuxmint.17.2-x64": { - "#import": [ "linuxmint.17.2", "linuxmint.17.1-x64" ] - }, - - "linuxmint.17.3": { - "#import": [ "linuxmint.17.2" ] - }, - "linuxmint.17.3-x64": { - "#import": [ "linuxmint.17.3", "linuxmint.17.2-x64" ] - }, - - "linuxmint.18": { - "#import": [ "ubuntu.16.04" ] - }, - "linuxmint.18-x64": { - "#import": [ "linuxmint.18", "ubuntu.16.04-x64" ] - }, - "linuxmint.18.1": { - "#import": [ "linuxmint.18" ] - }, - "linuxmint.18.1-x64": { - "#import": [ "linuxmint.18.1", "linuxmint.18-x64" ] - }, - - "fedora": { - "#import": [ "linux" ] - }, - "fedora-x64": { - "#import": [ "fedora", "linux-x64" ] - }, - - "fedora.23": { - "#import": [ "fedora" ] - }, - "fedora.23-x64": { - "#import": [ "fedora.23", "fedora-x64" ] - }, - - "fedora.24": { - "#import": [ "fedora" ] - }, - "fedora.24-x64": { - "#import": [ "fedora.24", "fedora-x64" ] - }, - - "fedora.25": { - "#import": [ "fedora" ] - }, - "fedora.25-x64": { - "#import": [ "fedora.25", "fedora-x64" ] - }, - - "fedora.26": { - "#import": [ "fedora" ] - }, - "fedora.26-x64": { - "#import": [ "fedora.26", "fedora-x64" ] - }, - - "opensuse": { - "#import": [ "linux" ] - }, - "opensuse-x64": { - "#import": [ "opensuse", "linux-x64" ] - }, - - "opensuse.13.2": { - "#import": [ "opensuse" ] - }, - "opensuse.13.2-x64": { - "#import": [ "opensuse.13.2", "opensuse-x64" ] - }, - - "opensuse.42.1": { - "#import": [ "opensuse" ] - }, - "opensuse.42.1-x64": { - "#import": [ "opensuse.42.1", "opensuse-x64" ] - }, - - "gentoo": { - "#import": [ "linux" ] - }, - "gentoo-x64": { - "#import": [ "gentoo", "linux-x64" ] - }, - - "corert": { - "#import": [ "any" ] - }, - - "win-corert": { - "#import": [ "corert", "win" ] - }, - "win-x86-corert": { - "#import": [ "win-corert", "win-x86" ] - }, - "win-x64-corert": { - "#import": [ "win-corert", "win-x64" ] - }, - - "win7-corert": { - "#import": [ "win-corert", "win7" ] - }, - "win7-x86-corert": { - "#import": [ "win7-corert", "win7-x86" ] - }, - "win7-x64-corert": { - "#import": [ "win7-corert", "win7-x64" ] - }, - - "win8-corert": { - "#import": [ "win7-corert", "win8" ] - }, - "win8-x86-corert": { - "#import": [ "win8-corert", "win7-x86-corert", "win8-x86" ] - }, - "win8-x64-corert": { - "#import": [ "win8-corert", "win7-x64-corert", "win8-x64" ] - }, - "win8-arm-corert": { - "#import": [ "win8-corert", "win8-arm" ] - }, - - "win81-corert": { - "#import": [ "win8-corert", "win81" ] - }, - "win81-x86-corert": { - "#import": [ "win81-corert", "win8-x86-corert", "win81-x86" ] - }, - "win81-x64-corert": { - "#import": [ "win81-corert", "win8-x64-corert", "win81-x64" ] - }, - "win81-arm-corert": { - "#import": [ "win81-corert", "win8-arm-corert", "win81-arm" ] - }, - - "win10-corert": { - "#import": [ "win81-corert", "win10" ] - }, - "win10-x86-corert": { - "#import": [ "win10-corert", "win81-x86-corert", "win10-x86" ] - }, - "win10-x64-corert": { - "#import": [ "win10-corert", "win81-x64-corert", "win10-x64" ] - }, - "win10-arm-corert": { - "#import": [ "win10-corert", "win81-arm-corert", "win10-arm" ] - }, - "win10-arm64-corert": { - "#import": [ "win10-corert", "win10-arm64" ] - }, - - "unix-corert": { - "#import": [ "corert", "unix" ] - }, - "unix-x64-corert": { - "#import": [ "unix-corert", "unix-x64" ] - }, - "unix-arm-corert": { - "#import": [ "unix-corert", "unix-arm" ] - }, - "unix-arm64-corert": { - "#import": [ "unix-corert", "unix-arm64" ] - }, - - "osx-corert": { - "#import": [ "unix-corert", "osx" ] - }, - "osx-x64-corert": { - "#import": [ "osx-corert", "unix-x64-corert", "osx-x64" ] - }, - - "osx.10.10-corert": { - "#import": [ "osx-corert", "osx.10.10" ] - }, - "osx.10.10-x64-corert": { - "#import": [ "osx.10.10-corert", "osx-x64-corert", "osx.10.10-x64" ] - }, - - "osx.10.11-corert": { - "#import": [ "osx.10.10-corert", "osx.10.11" ] - }, - "osx.10.11-x64-corert": { - "#import": [ "osx.10.11-corert", "osx.10.10-x64-corert", "osx.10.11-x64" ] - }, - - "osx.10.12-corert": { - "#import": [ "osx.10.11-corert", "osx.10.12" ] - }, - "osx.10.12-x64-corert": { - "#import": [ "osx.10.12-corert", "osx.10.11-x64-corert", "osx.10.12-x64" ] - }, - - "linux-corert": { - "#import": [ "corert", "linux", "unix-corert" ] - }, - "linux-x64-corert": { - "#import": [ "linux-corert", "linux-x64" ] - }, - "linux-arm-corert": { - "#import": [ "linux-corert", "linux-arm" ] - }, - "linux-arm64-corert": { - "#import": [ "linux-corert", "linux-arm64" ] - }, - - "rhel-corert": { - "#import": [ "corert", "rhel" ] - }, - "rhel-x64-corert": { - "#import": [ "rhel-corert", "linux-x64-corert", "rhel-x64" ] - }, - - "rhel.7-corert": { - "#import": [ "rhel-corert", "rhel.7" ] - }, - "rhel.7-x64-corert": { - "#import": [ "rhel.7-corert", "rhel-x64-corert", "rhel.7-x64" ] - }, - - "rhel.7.0-corert": { - "#import": [ "rhel.7-corert", "rhel.7.0" ] - }, - "rhel.7.0-x64-corert": { - "#import": [ "rhel.7.0-corert", "rhel.7-x64-corert", "rhel.7.0-x64" ] - }, - - "rhel.7.1-corert": { - "#import": [ "rhel.7.0-corert", "rhel.7.1" ] - }, - "rhel.7.1-x64-corert": { - "#import": [ "rhel.7.1-corert", "rhel.7.0-x64-corert", "rhel.7.1-x64" ] - }, - - "rhel.7.2-corert": { - "#import": [ "rhel.7.1-corert", "rhel.7.2" ] - }, - "rhel.7.2-x64-corert": { - "#import": [ "rhel.7.2-corert", "rhel.7.1-x64-corert", "rhel.7.2-x64" ] - }, - - "ol-corert": { - "#import": [ "rhel-corert", "ol" ] - }, - "ol-x64-corert": { - "#import": [ "ol-corert", "rhel-x64-corert", "ol-x64" ] - }, - - "ol.7-corert": { - "#import": [ "ol-corert", "ol.7" ] - }, - "ol.7-x64-corert": { - "#import": [ "ol.7-corert", "rhel.7-x64-corert", "ol.7-x64" ] - }, - - "ol.7.0-corert": { - "#import": [ "ol.7-corert", "ol.7.0" ] - }, - "ol.7.0-x64-corert": { - "#import": [ "ol.7.0-corert", "rhel.7.0-corert", "ol.7.0-x64" ] - }, - - "ol.7.1-corert": { - "#import": [ "ol.7.0-corert", "ol.7.1" ] - }, - "ol.7.1-x64-corert": { - "#import": [ "ol.7.1-corert", "rhel.7.1-x64-corert", "ol.7.1-x64" ] - }, - - "centos-corert": { - "#import": [ "rel-corert", "centos" ] - }, - "centos-x64-corert": { - "#import": [ "centos-corert", "rhel-x64-corert", "centos-x64" ] - }, - - "centos.7-corert": { - "#import": [ "centos-corert", "centos.7" ] - }, - "centos.7-x64-corert": { - "#import": [ "centos.7-corert", "centos-x64-corert", "centos.7-x64" ] - }, - - "debian-corert": { - "#import": [ "linux-corert", "debian" ] - }, - "debian-x64-corert": { - "#import": [ "debian-corert", "linux-x64-corert", "debian-x64" ] - }, - "debian-arm-corert": { - "#import": [ "debian-corert", "debian-arm" ] - }, - "debian-arm64-corert": { - "#import": [ "debian-corert", "debian-arm64" ] - }, - - "debian.8-corert": { - "#import": [ "debian-corert", "debian.8" ] - }, - "debian.8-x64-corert": { - "#import": [ "debian.8-corert", "debian-x64-corert", "debian.8-x64" ] - }, - "debian.8-arm-corert": { - "#import": [ "debian.8-corert", "debian-arm-corert", "debian.8-arm" ] - }, - "debian.8-arm64-corert": { - "#import": [ "debian.8-corert", "debian-arm64-corert", "debian.8-arm64" ] - }, - - "ubuntu-corert": { - "#import": [ "debian-corert", "ubuntu" ] - }, - - "ubuntu-x64-corert": { - "#import": [ "ubuntu-corert", "debian-x64-corert", "ubuntu-x64" ] - }, - - "ubuntu.14.04-corert": { - "#import": [ "ubuntu-corert", "ubuntu.14.06" ] - }, - "ubuntu.14.04-x64-corert": { - "#import": [ "ubuntu.14.04-corert", "ubuntu-x64-corert", "ubuntu-14.04-x64" ] - }, - - "ubuntu.14.10-corert": { - "#import": [ "ubuntu.14.04-corert", "ubuntu-14.10" ] - }, - "ubuntu.14.10-x64-corert": { - "#import": [ "ubuntu.14.10-corert", "ubuntu.14.04-x64-corert", "ubuntu.14.10-x64" ] - }, - - "ubuntu.15.04-corert": { - "#import": [ "ubuntu.14.10-corert", "ubuntu-15.04" ] - }, - "ubuntu.15.04-x64-corert": { - "#import": [ "ubuntu.15.04-corert", "ubuntu.14.10-x64-corert", "ubuntu.15.04-x64" ] - }, - - "ubuntu.15.10-corert": { - "#import": [ "ubuntu.15.04-corert", "ubuntu-15.10" ] - }, - "ubuntu.15.10-x64-corert": { - "#import": [ "ubuntu.15.10-corert", "ubuntu.15.04-x64-corert", "ubuntu.15.10-x64" ] - }, - - "ubuntu.16.04-corert": { - "#import": [ "ubuntu.15.10-corert", "ubuntu-16.04" ] - }, - "ubuntu.16.04-x64-corert": { - "#import": [ "ubuntu.16.04-corert", "ubuntu.15.10-x64-corert", "ubuntu.16.04-x64" ] - }, - - "ubuntu.16.10-corert": { - "#import": [ "ubuntu.16.04-corert", "ubuntu.16.10" ] - }, - "ubuntu.16.10-x64-corert": { - "#import": [ "ubuntu.16.10-corert", "ubuntu.16.04-x64-corert", "ubuntu.16.10-x64" ] - }, - - "linuxmint.17-corert": { - "#import": [ "ubuntu.14.04-corert", "linuxmint.17" ] - }, - "linuxmint.17-x64-corert": { - "#import": [ "linuxmint.17-corert", "ubuntu.14.04-x64-corert", "linuxmint.17-x64" ] - }, - - "linuxmint.17.1-corert": { - "#import": [ "linuxmint.17-corert", "linuxmint.17.1" ] - }, - "linuxmint.17.1-x64-corert": { - "#import": [ "linuxmint.17.1-corert", "linuxmint.17-x64-corert", "linuxmint.17.1-x64" ] - }, - - "linuxmint.17.2-corert": { - "#import": [ "linuxmint.17.1-corert", "linuxmint.17.2" ] - }, - "linuxmint.17.2-x64-corert": { - "#import": [ "linuxmint.17.2-corert", "linuxmint.17.1-x64-corert", "linuxmint.17.2-x64" ] - }, - - "linuxmint.17.3-corert": { - "#import": [ "linuxmint.17.2-corert", "linuxmint.17.3" ] - }, - "linuxmint.17.3-x64-corert": { - "#import": [ "linuxmint.17.3-corert", "linuxmint.17.2-x64-corert", "linuxmint.17.3-x64" ] - }, - - "linuxmint.18-corert": { - "#import": [ "ubuntu.16.04-corert", "linuxmint.18" ] - }, - "linuxmint.18-x64-corert": { - "#import": [ "linuxmint.18-corert", "ubuntu.16.04-x64-corert", "linuxmint.18-x64" ] - }, - - "fedora-corert": { - "#import": [ "linux-corert", "fedora" ] - }, - "fedora-x64-corert": { - "#import": [ "fedora-corert", "linux-x64-corert", "fedora-x64" ] - }, - - "fedora.23-corert": { - "#import": [ "fedora-corert", "fedora.23" ] - }, - "fedora.23-x64-corert": { - "#import": [ "fedora.23-corert", "fedora-x64-corert", "fedora.23-x64" ] - }, - - "fedora.24-corert": { - "#import": [ "fedora.23-corert", "fedora.24" ] - }, - "fedora.24-x64-corert": { - "#import": [ "fedora.24-corert", "fedora.23-x64-corert", "fedora.24-x64" ] - }, - - "opensuse-corert": { - "#import": [ "linux-corert", "opensuse" ] - }, - "opensuse-x64-corert": { - "#import": [ "opensuse-corert", "linux-x64-corert", "opensuste-x64" ] - }, - - "opensuse.13.2-corert": { - "#import": [ "opensuse-corert", "opensuse.13.2" ] - }, - "opensuse.13.2-x64-corert": { - "#import": [ "opensuse.13.2-corert", "opensuse-x64-corert", "opensuse.13.2-x64" ] - }, - - "opensuse.42.1-corert": { - "#import": [ "opensuse.13.2-corert", "opensuse.42.1" ] - }, - "opensuse.42.1-x64-corert": { - "#import": [ "opensuse.42.1-corert", "opensuse.13.2-x64-corert", "opensuse.42.1-x64" ] - }, - + "runtimes": { + "alpine": { + "#import": [ + "any" + ] + }, + "alpine-corert": { + "#import": [ + "alpine", + "corert" + ] + }, + "alpine-x64": { + "#import": [ + "alpine" + ] + }, + "alpine-x64-corert": { + "#import": [ + "alpine-corert", + "alpine-x64" + ] + }, + "alpine.3.6": { + "#import": [ + "alpine" + ] + }, + "alpine.3.6-corert": { + "#import": [ + "alpine.3.6", + "alpine-corert" + ] + }, + "alpine.3.6-x64": { + "#import": [ + "alpine.3.6", + "alpine-x64" + ] + }, + "alpine.3.6-x64-corert": { + "#import": [ + "alpine.3.6-corert", + "alpine.3.6-x64", + "alpine.3.6", + "alpine-x64-corert" + ] + }, + "android": { + "#import": [ + "any" + ] + }, + "android-arm": { + "#import": [ + "android" + ] + }, + "android-arm-corert": { + "#import": [ + "android-corert", + "android-arm" + ] + }, + "android-arm64": { + "#import": [ + "android" + ] + }, + "android-arm64-corert": { + "#import": [ + "android-corert", + "android-arm64" + ] + }, + "android-corert": { + "#import": [ + "android", + "corert" + ] + }, + "android.21": { + "#import": [ + "android" + ] + }, + "android.21-arm": { + "#import": [ + "android.21", + "android-arm" + ] + }, + "android.21-arm-corert": { + "#import": [ + "android.21-corert", + "android.21-arm", + "android.21", + "android-arm-corert" + ] + }, + "android.21-arm64": { + "#import": [ + "android.21", + "android-arm64" + ] + }, + "android.21-arm64-corert": { + "#import": [ + "android.21-corert", + "android.21-arm64", + "android.21", + "android-arm64-corert" + ] + }, + "android.21-corert": { + "#import": [ + "android.21", + "android-corert" + ] + }, + "any": { + "#import": [ + "base" + ] + }, + "aot": { + "#import": [ + "any" + ] + }, + "base": { + "#import": [] + }, + "centos": { + "#import": [ + "rhel" + ] + }, + "centos-corert": { + "#import": [ + "centos", + "rhel-corert" + ] + }, + "centos-x64": { + "#import": [ + "centos", + "rhel-x64" + ] + }, + "centos-x64-corert": { + "#import": [ + "centos-corert", + "centos-x64", + "rhel-x64-corert" + ] + }, + "centos.7": { + "#import": [ + "centos", + "rhel.7" + ] + }, + "centos.7-corert": { + "#import": [ + "centos.7", + "centos-corert", + "rhel.7-corert" + ] + }, + "centos.7-x64": { + "#import": [ + "centos.7", + "centos-x64", + "rhel.7-x64" + ] + }, + "centos.7-x64-corert": { + "#import": [ + "centos.7-corert", + "centos.7-x64", + "centos.7", + "centos-x64-corert" + ] + }, + "corert": { + "#import": [ + "any" + ] + }, + "debian": { + "#import": [ + "linux" + ] + }, + "debian-arm": { + "#import": [ + "debian", + "linux-arm" + ] + }, + "debian-arm-corert": { + "#import": [ + "debian-corert", + "debian-arm", + "linux-arm-corert" + ] + }, + "debian-arm64": { + "#import": [ + "debian", + "linux-arm64" + ] + }, + "debian-arm64-corert": { + "#import": [ + "debian-corert", + "debian-arm64", + "linux-arm64-corert" + ] + }, + "debian-armel": { + "#import": [ + "debian", + "linux-armel" + ] + }, + "debian-armel-corert": { + "#import": [ + "debian-corert", + "debian-armel", + "linux-armel-corert" + ] + }, + "debian-corert": { + "#import": [ + "debian", + "linux-corert" + ] + }, + "debian-x64": { + "#import": [ + "debian", + "linux-x64" + ] + }, + "debian-x64-corert": { + "#import": [ + "debian-corert", + "debian-x64", + "linux-x64-corert" + ] + }, + "debian-x86": { + "#import": [ + "debian", + "linux-x86" + ] + }, + "debian-x86-corert": { + "#import": [ + "debian-corert", + "debian-x86", + "linux-x86-corert" + ] + }, + "debian.8": { + "#import": [ + "debian" + ] + }, + "debian.8-arm": { + "#import": [ + "debian.8", + "debian-arm" + ] + }, + "debian.8-arm-corert": { + "#import": [ + "debian.8-corert", + "debian.8-arm", + "debian.8", + "debian-arm-corert" + ] + }, + "debian.8-arm64": { + "#import": [ + "debian.8", + "debian-arm64" + ] + }, + "debian.8-arm64-corert": { + "#import": [ + "debian.8-corert", + "debian.8-arm64", + "debian.8", + "debian-arm64-corert" + ] + }, + "debian.8-armel": { + "#import": [ + "debian.8", + "debian-armel" + ] + }, + "debian.8-armel-corert": { + "#import": [ + "debian.8-corert", + "debian.8-armel", + "debian.8", + "debian-armel-corert" + ] + }, + "debian.8-corert": { + "#import": [ + "debian.8", + "debian-corert" + ] + }, + "debian.8-x64": { + "#import": [ + "debian.8", + "debian-x64" + ] + }, + "debian.8-x64-corert": { + "#import": [ + "debian.8-corert", + "debian.8-x64", + "debian.8", + "debian-x64-corert" + ] + }, + "debian.8-x86": { + "#import": [ + "debian.8", + "debian-x86" + ] + }, + "debian.8-x86-corert": { + "#import": [ + "debian.8-corert", + "debian.8-x86", + "debian.8", + "debian-x86-corert" + ] + }, + "fedora": { + "#import": [ + "linux" + ] + }, + "fedora-corert": { + "#import": [ + "fedora", + "linux-corert" + ] + }, + "fedora-x64": { + "#import": [ + "fedora", + "linux-x64" + ] + }, + "fedora-x64-corert": { + "#import": [ + "fedora-corert", + "fedora-x64", + "linux-x64-corert" + ] + }, + "fedora.23": { + "#import": [ + "fedora" + ] + }, + "fedora.23-corert": { + "#import": [ + "fedora.23", + "fedora-corert" + ] + }, + "fedora.23-x64": { + "#import": [ + "fedora.23", + "fedora-x64" + ] + }, + "fedora.23-x64-corert": { + "#import": [ + "fedora.23-corert", + "fedora.23-x64", + "fedora.23", + "fedora-x64-corert" + ] + }, + "fedora.24": { + "#import": [ + "fedora" + ] + }, + "fedora.24-corert": { + "#import": [ + "fedora.24", + "fedora-corert" + ] + }, + "fedora.24-x64": { + "#import": [ + "fedora.24", + "fedora-x64" + ] + }, + "fedora.24-x64-corert": { + "#import": [ + "fedora.24-corert", + "fedora.24-x64", + "fedora.24", + "fedora-x64-corert" + ] + }, + "fedora.25": { + "#import": [ + "fedora" + ] + }, + "fedora.25-corert": { + "#import": [ + "fedora.25", + "fedora-corert" + ] + }, + "fedora.25-x64": { + "#import": [ + "fedora.25", + "fedora-x64" + ] + }, + "fedora.25-x64-corert": { + "#import": [ + "fedora.25-corert", + "fedora.25-x64", + "fedora.25", + "fedora-x64-corert" + ] + }, + "fedora.26": { + "#import": [ + "fedora" + ] + }, + "fedora.26-corert": { + "#import": [ + "fedora.26", + "fedora-corert" + ] + }, + "fedora.26-x64": { + "#import": [ + "fedora.26", + "fedora-x64" + ] + }, + "fedora.26-x64-corert": { + "#import": [ + "fedora.26-corert", + "fedora.26-x64", + "fedora.26", + "fedora-x64-corert" + ] + }, + "gentoo": { + "#import": [ + "linux" + ] + }, + "gentoo-corert": { + "#import": [ + "gentoo", + "linux-corert" + ] + }, + "gentoo-x64": { + "#import": [ + "gentoo", + "linux-x64" + ] + }, + "gentoo-x64-corert": { + "#import": [ + "gentoo-corert", + "gentoo-x64", + "linux-x64-corert" + ] + }, + "linux": { + "#import": [ + "unix" + ] + }, + "linux-arm": { + "#import": [ + "linux", + "unix-arm" + ] + }, + "linux-arm-corert": { + "#import": [ + "linux-corert", + "linux-arm", + "unix-arm-corert" + ] + }, + "linux-arm64": { + "#import": [ + "linux", + "unix-arm64" + ] + }, + "linux-arm64-corert": { + "#import": [ + "linux-corert", + "linux-arm64", + "unix-arm64-corert" + ] + }, + "linux-armel": { + "#import": [ + "linux", + "unix-armel" + ] + }, + "linux-armel-corert": { + "#import": [ + "linux-corert", + "linux-armel", + "unix-armel-corert" + ] + }, + "linux-corert": { + "#import": [ + "linux", + "unix-corert" + ] + }, + "linux-x64": { + "#import": [ + "linux", + "unix-x64" + ] + }, + "linux-x64-corert": { + "#import": [ + "linux-corert", + "linux-x64", + "unix-x64-corert" + ] + }, + "linux-x86": { + "#import": [ + "linux", + "unix-x86" + ] + }, + "linux-x86-corert": { + "#import": [ + "linux-corert", + "linux-x86", + "unix-x86-corert" + ] + }, + "linuxmint.17": { + "#import": [ + "ubuntu.14.04" + ] + }, + "linuxmint.17-corert": { + "#import": [ + "linuxmint.17", + "ubuntu.14.04-corert" + ] + }, + "linuxmint.17-x64": { + "#import": [ + "linuxmint.17", + "ubuntu.14.04-x64" + ] + }, + "linuxmint.17-x64-corert": { + "#import": [ + "linuxmint.17-corert", + "linuxmint.17-x64", + "ubuntu.14.04-x64-corert" + ] + }, + "linuxmint.17.1": { + "#import": [ + "linuxmint.17" + ] + }, + "linuxmint.17.1-corert": { + "#import": [ + "linuxmint.17.1", + "linuxmint.17-corert" + ] + }, + "linuxmint.17.1-x64": { + "#import": [ + "linuxmint.17.1", + "linuxmint.17-x64" + ] + }, + "linuxmint.17.1-x64-corert": { + "#import": [ + "linuxmint.17.1-corert", + "linuxmint.17.1-x64", + "linuxmint.17.1", + "linuxmint.17-x64-corert" + ] + }, + "linuxmint.17.2": { + "#import": [ + "linuxmint.17.1" + ] + }, + "linuxmint.17.2-corert": { + "#import": [ + "linuxmint.17.2", + "linuxmint.17.1-corert" + ] + }, + "linuxmint.17.2-x64": { + "#import": [ + "linuxmint.17.2", + "linuxmint.17.1-x64" + ] + }, + "linuxmint.17.2-x64-corert": { + "#import": [ + "linuxmint.17.2-corert", + "linuxmint.17.2-x64", + "linuxmint.17.2", + "linuxmint.17.1-x64-corert" + ] + }, + "linuxmint.17.3": { + "#import": [ + "linuxmint.17.2" + ] + }, + "linuxmint.17.3-corert": { + "#import": [ + "linuxmint.17.3", + "linuxmint.17.2-corert" + ] + }, + "linuxmint.17.3-x64": { + "#import": [ + "linuxmint.17.3", + "linuxmint.17.2-x64" + ] + }, + "linuxmint.17.3-x64-corert": { + "#import": [ + "linuxmint.17.3-corert", + "linuxmint.17.3-x64", + "linuxmint.17.3", + "linuxmint.17.2-x64-corert" + ] + }, + "linuxmint.18": { + "#import": [ + "ubuntu.16.04" + ] + }, + "linuxmint.18-corert": { + "#import": [ + "linuxmint.18", + "ubuntu.16.04-corert" + ] + }, + "linuxmint.18-x64": { + "#import": [ + "linuxmint.18", + "ubuntu.16.04-x64" + ] + }, + "linuxmint.18-x64-corert": { + "#import": [ + "linuxmint.18-corert", + "linuxmint.18-x64", + "ubuntu.16.04-x64-corert" + ] + }, + "linuxmint.18.1": { + "#import": [ + "linuxmint.18" + ] + }, + "linuxmint.18.1-corert": { + "#import": [ + "linuxmint.18.1", + "linuxmint.18-corert" + ] + }, + "linuxmint.18.1-x64": { + "#import": [ + "linuxmint.18.1", + "linuxmint.18-x64" + ] + }, + "linuxmint.18.1-x64-corert": { + "#import": [ + "linuxmint.18.1-corert", + "linuxmint.18.1-x64", + "linuxmint.18.1", + "linuxmint.18-x64-corert" + ] + }, + "ol": { + "#import": [ + "rhel" + ] + }, + "ol-corert": { + "#import": [ + "ol", + "rhel-corert" + ] + }, + "ol-x64": { + "#import": [ + "ol", + "rhel-x64" + ] + }, + "ol-x64-corert": { + "#import": [ + "ol-corert", + "ol-x64", + "rhel-x64-corert" + ] + }, + "ol.7": { + "#import": [ + "ol", + "rhel.7" + ] + }, + "ol.7-corert": { + "#import": [ + "ol.7", + "ol-corert", + "rhel.7-corert" + ] + }, + "ol.7-x64": { + "#import": [ + "ol.7", + "ol-x64", + "rhel.7-x64" + ] + }, + "ol.7-x64-corert": { + "#import": [ + "ol.7-corert", + "ol.7-x64", + "ol.7", + "ol-x64-corert" + ] + }, + "ol.7.0": { + "#import": [ + "ol.7", + "rhel.7.0" + ] + }, + "ol.7.0-corert": { + "#import": [ + "ol.7.0", + "ol.7-corert", + "rhel.7.0-corert" + ] + }, + "ol.7.0-x64": { + "#import": [ + "ol.7.0", + "ol.7-x64", + "rhel.7.0-x64" + ] + }, + "ol.7.0-x64-corert": { + "#import": [ + "ol.7.0-corert", + "ol.7.0-x64", + "ol.7.0", + "ol.7-x64-corert" + ] + }, + "ol.7.1": { + "#import": [ + "ol.7.0", + "rhel.7.1" + ] + }, + "ol.7.1-corert": { + "#import": [ + "ol.7.1", + "ol.7.0-corert", + "rhel.7.1-corert" + ] + }, + "ol.7.1-x64": { + "#import": [ + "ol.7.1", + "ol.7.0-x64", + "rhel.7.1-x64" + ] + }, + "ol.7.1-x64-corert": { + "#import": [ + "ol.7.1-corert", + "ol.7.1-x64", + "ol.7.1", + "ol.7.0-x64-corert" + ] + }, + "ol.7.2": { + "#import": [ + "ol.7.1", + "rhel.7.2" + ] + }, + "ol.7.2-corert": { + "#import": [ + "ol.7.2", + "ol.7.1-corert", + "rhel.7.2-corert" + ] + }, + "ol.7.2-x64": { + "#import": [ + "ol.7.2", + "ol.7.1-x64", + "rhel.7.2-x64" + ] + }, + "ol.7.2-x64-corert": { + "#import": [ + "ol.7.2-corert", + "ol.7.2-x64", + "ol.7.2", + "ol.7.1-x64-corert" + ] + }, + "opensuse": { + "#import": [ + "linux" + ] + }, + "opensuse-corert": { + "#import": [ + "opensuse", + "linux-corert" + ] + }, + "opensuse-x64": { + "#import": [ + "opensuse", + "linux-x64" + ] + }, + "opensuse-x64-corert": { + "#import": [ + "opensuse-corert", + "opensuse-x64", + "linux-x64-corert" + ] + }, + "opensuse.13.2": { + "#import": [ + "opensuse" + ] + }, + "opensuse.13.2-corert": { + "#import": [ + "opensuse.13.2", + "opensuse-corert" + ] + }, + "opensuse.13.2-x64": { + "#import": [ + "opensuse.13.2", + "opensuse-x64" + ] + }, + "opensuse.13.2-x64-corert": { + "#import": [ + "opensuse.13.2-corert", + "opensuse.13.2-x64", + "opensuse.13.2", + "opensuse-x64-corert" + ] + }, + "opensuse.42.1": { + "#import": [ + "opensuse" + ] + }, + "opensuse.42.1-corert": { + "#import": [ + "opensuse.42.1", + "opensuse-corert" + ] + }, + "opensuse.42.1-x64": { + "#import": [ + "opensuse.42.1", + "opensuse-x64" + ] + }, + "opensuse.42.1-x64-corert": { + "#import": [ + "opensuse.42.1-corert", + "opensuse.42.1-x64", + "opensuse.42.1", + "opensuse-x64-corert" + ] + }, + "osx": { + "#import": [ + "unix" + ] + }, + "osx-corert": { + "#import": [ + "osx", + "unix-corert" + ] + }, + "osx-x64": { + "#import": [ + "osx", + "unix-x64" + ] + }, + "osx-x64-corert": { + "#import": [ + "osx-corert", + "osx-x64", + "unix-x64-corert" + ] + }, + "osx.10.10": { + "#import": [ + "osx" + ] + }, + "osx.10.10-corert": { + "#import": [ + "osx.10.10", + "osx-corert" + ] + }, + "osx.10.10-x64": { + "#import": [ + "osx.10.10", + "osx-x64" + ] + }, + "osx.10.10-x64-corert": { + "#import": [ + "osx.10.10-corert", + "osx.10.10-x64", + "osx.10.10", + "osx-x64-corert" + ] + }, + "osx.10.11": { + "#import": [ + "osx.10.10" + ] + }, + "osx.10.11-corert": { + "#import": [ + "osx.10.11", + "osx.10.10-corert" + ] + }, + "osx.10.11-x64": { + "#import": [ + "osx.10.11", + "osx.10.10-x64" + ] + }, + "osx.10.11-x64-corert": { + "#import": [ + "osx.10.11-corert", + "osx.10.11-x64", + "osx.10.11", + "osx.10.10-x64-corert" + ] + }, + "osx.10.12": { + "#import": [ + "osx.10.11" + ] + }, + "osx.10.12-corert": { + "#import": [ + "osx.10.12", + "osx.10.11-corert" + ] + }, + "osx.10.12-x64": { + "#import": [ + "osx.10.12", + "osx.10.11-x64" + ] + }, + "osx.10.12-x64-corert": { + "#import": [ + "osx.10.12-corert", + "osx.10.12-x64", + "osx.10.12", + "osx.10.11-x64-corert" + ] + }, + "rhel": { + "#import": [ + "linux" + ] + }, + "rhel-corert": { + "#import": [ + "rhel", + "linux-corert" + ] + }, + "rhel-x64": { + "#import": [ + "rhel", + "linux-x64" + ] + }, + "rhel-x64-corert": { + "#import": [ + "rhel-corert", + "rhel-x64", + "linux-x64-corert" + ] + }, + "rhel.6": { + "#import": [ + "rhel" + ] + }, + "rhel.6-corert": { + "#import": [ + "rhel.6", + "rhel-corert" + ] + }, + "rhel.6-x64": { + "#import": [ + "rhel.6", + "rhel-x64" + ] + }, + "rhel.6-x64-corert": { + "#import": [ + "rhel.6-corert", + "rhel.6-x64", + "rhel.6", + "rhel-x64-corert" + ] + }, + "rhel.7": { + "#import": [ + "rhel" + ] + }, + "rhel.7-corert": { + "#import": [ + "rhel.7", + "rhel-corert" + ] + }, + "rhel.7-x64": { + "#import": [ + "rhel.7", + "rhel-x64" + ] + }, + "rhel.7-x64-corert": { + "#import": [ + "rhel.7-corert", + "rhel.7-x64", + "rhel.7", + "rhel-x64-corert" + ] + }, + "rhel.7.0": { + "#import": [ + "rhel.7" + ] + }, + "rhel.7.0-corert": { + "#import": [ + "rhel.7.0", + "rhel.7-corert" + ] + }, + "rhel.7.0-x64": { + "#import": [ + "rhel.7.0", + "rhel.7-x64" + ] + }, + "rhel.7.0-x64-corert": { + "#import": [ + "rhel.7.0-corert", + "rhel.7.0-x64", + "rhel.7.0", + "rhel.7-x64-corert" + ] + }, + "rhel.7.1": { + "#import": [ + "rhel.7.0" + ] + }, + "rhel.7.1-corert": { + "#import": [ + "rhel.7.1", + "rhel.7.0-corert" + ] + }, + "rhel.7.1-x64": { + "#import": [ + "rhel.7.1", + "rhel.7.0-x64" + ] + }, + "rhel.7.1-x64-corert": { + "#import": [ + "rhel.7.1-corert", + "rhel.7.1-x64", + "rhel.7.1", + "rhel.7.0-x64-corert" + ] + }, + "rhel.7.2": { + "#import": [ + "rhel.7.1" + ] + }, + "rhel.7.2-corert": { + "#import": [ + "rhel.7.2", + "rhel.7.1-corert" + ] + }, + "rhel.7.2-x64": { + "#import": [ + "rhel.7.2", + "rhel.7.1-x64" + ] + }, + "rhel.7.2-x64-corert": { + "#import": [ + "rhel.7.2-corert", + "rhel.7.2-x64", + "rhel.7.2", + "rhel.7.1-x64-corert" + ] + }, + "rhel.7.3": { + "#import": [ + "rhel.7.2" + ] + }, + "rhel.7.3-corert": { + "#import": [ + "rhel.7.3", + "rhel.7.2-corert" + ] + }, + "rhel.7.3-x64": { + "#import": [ + "rhel.7.3", + "rhel.7.2-x64" + ] + }, + "rhel.7.3-x64-corert": { + "#import": [ + "rhel.7.3-corert", + "rhel.7.3-x64", + "rhel.7.3", + "rhel.7.2-x64-corert" + ] + }, + "rhel.7.4": { + "#import": [ + "rhel.7.3" + ] + }, + "rhel.7.4-corert": { + "#import": [ + "rhel.7.4", + "rhel.7.3-corert" + ] + }, + "rhel.7.4-x64": { + "#import": [ + "rhel.7.4", + "rhel.7.3-x64" + ] + }, + "rhel.7.4-x64-corert": { + "#import": [ + "rhel.7.4-corert", + "rhel.7.4-x64", + "rhel.7.4", + "rhel.7.3-x64-corert" + ] + }, + "tizen": { + "#import": [ + "linux" + ] + }, + "tizen-armel": { + "#import": [ + "tizen", + "linux-armel" + ] + }, + "tizen-armel-corert": { + "#import": [ + "tizen-corert", + "tizen-armel", + "linux-armel-corert" + ] + }, + "tizen-corert": { + "#import": [ + "tizen", + "linux-corert" + ] + }, + "tizen.4.0.0": { + "#import": [ + "tizen" + ] + }, + "tizen.4.0.0-armel": { + "#import": [ + "tizen.4.0.0", + "tizen-armel" + ] + }, + "tizen.4.0.0-armel-corert": { + "#import": [ + "tizen.4.0.0-corert", + "tizen.4.0.0-armel", + "tizen.4.0.0", + "tizen-armel-corert" + ] + }, + "tizen.4.0.0-corert": { + "#import": [ + "tizen.4.0.0", + "tizen-corert" + ] + }, + "ubuntu": { + "#import": [ + "debian" + ] + }, + "ubuntu-arm": { + "#import": [ + "ubuntu", + "debian-arm" + ] + }, + "ubuntu-arm-corert": { + "#import": [ + "ubuntu-corert", + "ubuntu-arm", + "debian-arm-corert" + ] + }, + "ubuntu-arm64": { + "#import": [ + "ubuntu", + "debian-arm64" + ] + }, + "ubuntu-arm64-corert": { + "#import": [ + "ubuntu-corert", + "ubuntu-arm64", + "debian-arm64-corert" + ] + }, + "ubuntu-corert": { + "#import": [ + "ubuntu", + "debian-corert" + ] + }, + "ubuntu-x64": { + "#import": [ + "ubuntu", + "debian-x64" + ] + }, + "ubuntu-x64-corert": { + "#import": [ + "ubuntu-corert", + "ubuntu-x64", + "debian-x64-corert" + ] + }, + "ubuntu-x86": { + "#import": [ + "ubuntu", + "debian-x86" + ] + }, + "ubuntu-x86-corert": { + "#import": [ + "ubuntu-corert", + "ubuntu-x86", + "debian-x86-corert" + ] + }, + "ubuntu.14.04": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.14.04-arm": { + "#import": [ + "ubuntu.14.04", + "ubuntu-arm" + ] + }, + "ubuntu.14.04-arm-corert": { + "#import": [ + "ubuntu.14.04-corert", + "ubuntu.14.04-arm", + "ubuntu.14.04", + "ubuntu-arm-corert" + ] + }, + "ubuntu.14.04-corert": { + "#import": [ + "ubuntu.14.04", + "ubuntu-corert" + ] + }, + "ubuntu.14.04-x64": { + "#import": [ + "ubuntu.14.04", + "ubuntu-x64" + ] + }, + "ubuntu.14.04-x64-corert": { + "#import": [ + "ubuntu.14.04-corert", + "ubuntu.14.04-x64", + "ubuntu.14.04", + "ubuntu-x64-corert" + ] + }, + "ubuntu.14.04-x86": { + "#import": [ + "ubuntu.14.04", + "ubuntu-x86" + ] + }, + "ubuntu.14.04-x86-corert": { + "#import": [ + "ubuntu.14.04-corert", + "ubuntu.14.04-x86", + "ubuntu.14.04", + "ubuntu-x86-corert" + ] + }, + "ubuntu.14.10": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.14.10-arm": { + "#import": [ + "ubuntu.14.10", + "ubuntu-arm" + ] + }, + "ubuntu.14.10-arm-corert": { + "#import": [ + "ubuntu.14.10-corert", + "ubuntu.14.10-arm", + "ubuntu.14.10", + "ubuntu-arm-corert" + ] + }, + "ubuntu.14.10-corert": { + "#import": [ + "ubuntu.14.10", + "ubuntu-corert" + ] + }, + "ubuntu.14.10-x64": { + "#import": [ + "ubuntu.14.10", + "ubuntu-x64" + ] + }, + "ubuntu.14.10-x64-corert": { + "#import": [ + "ubuntu.14.10-corert", + "ubuntu.14.10-x64", + "ubuntu.14.10", + "ubuntu-x64-corert" + ] + }, + "ubuntu.14.10-x86": { + "#import": [ + "ubuntu.14.10", + "ubuntu-x86" + ] + }, + "ubuntu.14.10-x86-corert": { + "#import": [ + "ubuntu.14.10-corert", + "ubuntu.14.10-x86", + "ubuntu.14.10", + "ubuntu-x86-corert" + ] + }, + "ubuntu.15.04": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.15.04-arm": { + "#import": [ + "ubuntu.15.04", + "ubuntu-arm" + ] + }, + "ubuntu.15.04-arm-corert": { + "#import": [ + "ubuntu.15.04-corert", + "ubuntu.15.04-arm", + "ubuntu.15.04", + "ubuntu-arm-corert" + ] + }, + "ubuntu.15.04-corert": { + "#import": [ + "ubuntu.15.04", + "ubuntu-corert" + ] + }, + "ubuntu.15.04-x64": { + "#import": [ + "ubuntu.15.04", + "ubuntu-x64" + ] + }, + "ubuntu.15.04-x64-corert": { + "#import": [ + "ubuntu.15.04-corert", + "ubuntu.15.04-x64", + "ubuntu.15.04", + "ubuntu-x64-corert" + ] + }, + "ubuntu.15.04-x86": { + "#import": [ + "ubuntu.15.04", + "ubuntu-x86" + ] + }, + "ubuntu.15.04-x86-corert": { + "#import": [ + "ubuntu.15.04-corert", + "ubuntu.15.04-x86", + "ubuntu.15.04", + "ubuntu-x86-corert" + ] + }, + "ubuntu.15.10": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.15.10-arm": { + "#import": [ + "ubuntu.15.10", + "ubuntu-arm" + ] + }, + "ubuntu.15.10-arm-corert": { + "#import": [ + "ubuntu.15.10-corert", + "ubuntu.15.10-arm", + "ubuntu.15.10", + "ubuntu-arm-corert" + ] + }, + "ubuntu.15.10-corert": { + "#import": [ + "ubuntu.15.10", + "ubuntu-corert" + ] + }, + "ubuntu.15.10-x64": { + "#import": [ + "ubuntu.15.10", + "ubuntu-x64" + ] + }, + "ubuntu.15.10-x64-corert": { + "#import": [ + "ubuntu.15.10-corert", + "ubuntu.15.10-x64", + "ubuntu.15.10", + "ubuntu-x64-corert" + ] + }, + "ubuntu.15.10-x86": { + "#import": [ + "ubuntu.15.10", + "ubuntu-x86" + ] + }, + "ubuntu.15.10-x86-corert": { + "#import": [ + "ubuntu.15.10-corert", + "ubuntu.15.10-x86", + "ubuntu.15.10", + "ubuntu-x86-corert" + ] + }, + "ubuntu.16.04": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.16.04-arm": { + "#import": [ + "ubuntu.16.04", + "ubuntu-arm" + ] + }, + "ubuntu.16.04-arm-corert": { + "#import": [ + "ubuntu.16.04-corert", + "ubuntu.16.04-arm", + "ubuntu.16.04", + "ubuntu-arm-corert" + ] + }, + "ubuntu.16.04-arm64": { + "#import": [ + "ubuntu.16.04", + "ubuntu-arm64" + ] + }, + "ubuntu.16.04-arm64-corert": { + "#import": [ + "ubuntu.16.04-corert", + "ubuntu.16.04-arm64", + "ubuntu.16.04", + "ubuntu-arm64-corert" + ] + }, + "ubuntu.16.04-corert": { + "#import": [ + "ubuntu.16.04", + "ubuntu-corert" + ] + }, + "ubuntu.16.04-x64": { + "#import": [ + "ubuntu.16.04", + "ubuntu-x64" + ] + }, + "ubuntu.16.04-x64-corert": { + "#import": [ + "ubuntu.16.04-corert", + "ubuntu.16.04-x64", + "ubuntu.16.04", + "ubuntu-x64-corert" + ] + }, + "ubuntu.16.04-x86": { + "#import": [ + "ubuntu.16.04", + "ubuntu-x86" + ] + }, + "ubuntu.16.04-x86-corert": { + "#import": [ + "ubuntu.16.04-corert", + "ubuntu.16.04-x86", + "ubuntu.16.04", + "ubuntu-x86-corert" + ] + }, + "ubuntu.16.10": { + "#import": [ + "ubuntu" + ] + }, + "ubuntu.16.10-arm": { + "#import": [ + "ubuntu.16.10", + "ubuntu-arm" + ] + }, + "ubuntu.16.10-arm-corert": { + "#import": [ + "ubuntu.16.10-corert", + "ubuntu.16.10-arm", + "ubuntu.16.10", + "ubuntu-arm-corert" + ] + }, + "ubuntu.16.10-arm64": { + "#import": [ + "ubuntu.16.10", + "ubuntu-arm64" + ] + }, + "ubuntu.16.10-arm64-corert": { + "#import": [ + "ubuntu.16.10-corert", + "ubuntu.16.10-arm64", + "ubuntu.16.10", + "ubuntu-arm64-corert" + ] + }, + "ubuntu.16.10-corert": { + "#import": [ + "ubuntu.16.10", + "ubuntu-corert" + ] + }, + "ubuntu.16.10-x64": { + "#import": [ + "ubuntu.16.10", + "ubuntu-x64" + ] + }, + "ubuntu.16.10-x64-corert": { + "#import": [ + "ubuntu.16.10-corert", + "ubuntu.16.10-x64", + "ubuntu.16.10", + "ubuntu-x64-corert" + ] + }, + "ubuntu.16.10-x86": { + "#import": [ + "ubuntu.16.10", + "ubuntu-x86" + ] + }, + "ubuntu.16.10-x86-corert": { + "#import": [ + "ubuntu.16.10-corert", + "ubuntu.16.10-x86", + "ubuntu.16.10", + "ubuntu-x86-corert" + ] + }, + "unix": { + "#import": [ + "any" + ] + }, + "unix-arm": { + "#import": [ + "unix" + ] + }, + "unix-arm-corert": { + "#import": [ + "unix-corert", + "unix-arm" + ] + }, + "unix-arm64": { + "#import": [ + "unix" + ] + }, + "unix-arm64-corert": { + "#import": [ + "unix-corert", + "unix-arm64" + ] + }, + "unix-armel": { + "#import": [ + "unix" + ] + }, + "unix-armel-corert": { + "#import": [ + "unix-corert", + "unix-armel" + ] + }, + "unix-corert": { + "#import": [ + "unix", + "corert" + ] + }, + "unix-x64": { + "#import": [ + "unix" + ] + }, + "unix-x64-corert": { + "#import": [ + "unix-corert", + "unix-x64" + ] + }, + "unix-x86": { + "#import": [ + "unix" + ] + }, + "unix-x86-corert": { + "#import": [ + "unix-corert", + "unix-x86" + ] + }, + "win": { + "#import": [ + "any" + ] + }, + "win-aot": { + "#import": [ + "win", + "aot" + ] + }, + "win-arm": { + "#import": [ + "win" + ] + }, + "win-arm-aot": { + "#import": [ + "win-aot", + "win-arm" + ] + }, + "win-arm-corert": { + "#import": [ + "win-corert", + "win-arm" + ] + }, + "win-arm64": { + "#import": [ + "win" + ] + }, + "win-arm64-aot": { + "#import": [ + "win-aot", + "win-arm64" + ] + }, + "win-arm64-corert": { + "#import": [ + "win-corert", + "win-arm64" + ] + }, + "win-corert": { + "#import": [ + "win", + "corert" + ] + }, + "win-x64": { + "#import": [ + "win" + ] + }, + "win-x64-aot": { + "#import": [ + "win-aot", + "win-x64" + ] + }, + "win-x64-corert": { + "#import": [ + "win-corert", + "win-x64" + ] + }, + "win-x86": { + "#import": [ + "win" + ] + }, + "win-x86-aot": { + "#import": [ + "win-aot", + "win-x86" + ] + }, + "win-x86-corert": { + "#import": [ + "win-corert", + "win-x86" + ] + }, + "win10": { + "#import": [ + "win81" + ] + }, + "win10-aot": { + "#import": [ + "win10", + "win81-aot" + ] + }, + "win10-arm": { + "#import": [ + "win10", + "win81-arm" + ] + }, + "win10-arm-aot": { + "#import": [ + "win10-aot", + "win10-arm", + "win10", + "win81-arm-aot" + ] + }, + "win10-arm-corert": { + "#import": [ + "win10-corert", + "win10-arm", + "win10", + "win81-arm-corert" + ] + }, + "win10-arm64": { + "#import": [ + "win10", + "win81-arm64" + ] + }, + "win10-arm64-aot": { + "#import": [ + "win10-aot", + "win10-arm64", + "win10", + "win81-arm64-aot" + ] + }, + "win10-arm64-corert": { + "#import": [ + "win10-corert", + "win10-arm64", + "win10", + "win81-arm64-corert" + ] + }, + "win10-corert": { + "#import": [ + "win10", + "win81-corert" + ] + }, + "win10-x64": { + "#import": [ + "win10", + "win81-x64" + ] + }, + "win10-x64-aot": { + "#import": [ + "win10-aot", + "win10-x64", + "win10", + "win81-x64-aot" + ] + }, + "win10-x64-corert": { + "#import": [ + "win10-corert", + "win10-x64", + "win10", + "win81-x64-corert" + ] + }, + "win10-x86": { + "#import": [ + "win10", + "win81-x86" + ] + }, + "win10-x86-aot": { + "#import": [ + "win10-aot", + "win10-x86", + "win10", + "win81-x86-aot" + ] + }, + "win10-x86-corert": { + "#import": [ + "win10-corert", + "win10-x86", + "win10", + "win81-x86-corert" + ] + }, + "win7": { + "#import": [ + "win" + ] + }, + "win7-aot": { + "#import": [ + "win7", + "win-aot" + ] + }, + "win7-arm": { + "#import": [ + "win7", + "win-arm" + ] + }, + "win7-arm-aot": { + "#import": [ + "win7-aot", + "win7-arm", + "win7", + "win-arm-aot" + ] + }, + "win7-arm-corert": { + "#import": [ + "win7-corert", + "win7-arm", + "win7", + "win-arm-corert" + ] + }, + "win7-arm64": { + "#import": [ + "win7", + "win-arm64" + ] + }, + "win7-arm64-aot": { + "#import": [ + "win7-aot", + "win7-arm64", + "win7", + "win-arm64-aot" + ] + }, + "win7-arm64-corert": { + "#import": [ + "win7-corert", + "win7-arm64", + "win7", + "win-arm64-corert" + ] + }, + "win7-corert": { + "#import": [ + "win7", + "win-corert" + ] + }, + "win7-x64": { + "#import": [ + "win7", + "win-x64" + ] + }, + "win7-x64-aot": { + "#import": [ + "win7-aot", + "win7-x64", + "win7", + "win-x64-aot" + ] + }, + "win7-x64-corert": { + "#import": [ + "win7-corert", + "win7-x64", + "win7", + "win-x64-corert" + ] + }, + "win7-x86": { + "#import": [ + "win7", + "win-x86" + ] + }, + "win7-x86-aot": { + "#import": [ + "win7-aot", + "win7-x86", + "win7", + "win-x86-aot" + ] + }, + "win7-x86-corert": { + "#import": [ + "win7-corert", + "win7-x86", + "win7", + "win-x86-corert" + ] + }, + "win8": { + "#import": [ + "win7" + ] + }, + "win8-aot": { + "#import": [ + "win8", + "win7-aot" + ] + }, + "win8-arm": { + "#import": [ + "win8", + "win7-arm" + ] + }, + "win8-arm-aot": { + "#import": [ + "win8-aot", + "win8-arm", + "win8", + "win7-arm-aot" + ] + }, + "win8-arm-corert": { + "#import": [ + "win8-corert", + "win8-arm", + "win8", + "win7-arm-corert" + ] + }, + "win8-arm64": { + "#import": [ + "win8", + "win7-arm64" + ] + }, + "win8-arm64-aot": { + "#import": [ + "win8-aot", + "win8-arm64", + "win8", + "win7-arm64-aot" + ] + }, + "win8-arm64-corert": { + "#import": [ + "win8-corert", + "win8-arm64", + "win8", + "win7-arm64-corert" + ] + }, + "win8-corert": { + "#import": [ + "win8", + "win7-corert" + ] + }, + "win8-x64": { + "#import": [ + "win8", + "win7-x64" + ] + }, + "win8-x64-aot": { + "#import": [ + "win8-aot", + "win8-x64", + "win8", + "win7-x64-aot" + ] + }, + "win8-x64-corert": { + "#import": [ + "win8-corert", + "win8-x64", + "win8", + "win7-x64-corert" + ] + }, + "win8-x86": { + "#import": [ + "win8", + "win7-x86" + ] + }, + "win8-x86-aot": { + "#import": [ + "win8-aot", + "win8-x86", + "win8", + "win7-x86-aot" + ] + }, + "win8-x86-corert": { + "#import": [ + "win8-corert", + "win8-x86", + "win8", + "win7-x86-corert" + ] + }, + "win81": { + "#import": [ + "win8" + ] + }, + "win81-aot": { + "#import": [ + "win81", + "win8-aot" + ] + }, + "win81-arm": { + "#import": [ + "win81", + "win8-arm" + ] + }, + "win81-arm-aot": { + "#import": [ + "win81-aot", + "win81-arm", + "win81", + "win8-arm-aot" + ] + }, + "win81-arm-corert": { + "#import": [ + "win81-corert", + "win81-arm", + "win81", + "win8-arm-corert" + ] + }, + "win81-arm64": { + "#import": [ + "win81", + "win8-arm64" + ] + }, + "win81-arm64-aot": { + "#import": [ + "win81-aot", + "win81-arm64", + "win81", + "win8-arm64-aot" + ] + }, + "win81-arm64-corert": { + "#import": [ + "win81-corert", + "win81-arm64", + "win81", + "win8-arm64-corert" + ] + }, + "win81-corert": { + "#import": [ + "win81", + "win8-corert" + ] + }, + "win81-x64": { + "#import": [ + "win81", + "win8-x64" + ] + }, + "win81-x64-aot": { + "#import": [ + "win81-aot", + "win81-x64", + "win81", + "win8-x64-aot" + ] + }, + "win81-x64-corert": { + "#import": [ + "win81-corert", + "win81-x64", + "win81", + "win8-x64-corert" + ] + }, + "win81-x86": { + "#import": [ + "win81", + "win8-x86" + ] + }, + "win81-x86-aot": { + "#import": [ + "win81-aot", + "win81-x86", + "win81", + "win8-x86-aot" + ] + }, + "win81-x86-corert": { + "#import": [ + "win81-corert", + "win81-x86", + "win81", + "win8-x86-corert" + ] } -} + } +} \ No newline at end of file diff --git a/external/corefx/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props b/external/corefx/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props new file mode 100644 index 0000000000..0f2b4a4197 --- /dev/null +++ b/external/corefx/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props @@ -0,0 +1,154 @@ + + + + + any + x64;x86;arm;armel;arm64 + + + unix + x64;x86;arm;armel;arm64 + + + + any + x64 + 3.6 + + + + any + arm;arm64 + 21 + + + + rhel + x64 + 7 + true + + + + linux + x64;x86;arm;armel;arm64 + 8 + + + + linux + x64 + 23;24;25;26 + false + + + + linux + x64 + + + + ubuntu.14.04 + x64 + 1;2;3 + + + ubuntu.16.04 + x64 + 1 + + + + rhel + x64 + 7;7.0;7.1;7.2 + true + + + + + linux + x64 + 13.2;42.1 + false + + + + unix + x64 + 10.10;10.11;10.12 + + + + + linux + x64 + 6 + + + + linux + x64 + 7;7.0;7.1;7.2;7.3;7.4 + + + + linux + armel + 4.0.0 + + + + + debian + x64;x86;arm + 14.04;14.10;15.04;15.10 + false + + + debian + x64;x86;arm;arm64 + 16.04;16.10 + false + + + + any + true + aot + x64;x86;arm;arm64 + 7;8;81;10 + + + + + %(AdditionalQualifiers);corert + + + + + + base + + + + + any + + + any + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/pkg/Microsoft.NETFramework.Compatibility/Microsoft.NETFramework.Compatibility.builds b/external/corefx/pkg/Microsoft.NETFramework.Compatibility/Microsoft.NETFramework.Compatibility.builds new file mode 100644 index 0000000000..6d6d97a476 --- /dev/null +++ b/external/corefx/pkg/Microsoft.NETFramework.Compatibility/Microsoft.NETFramework.Compatibility.builds @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/pkg/Microsoft.NETFramework.Compatibility/Microsoft.NETFramework.Compatibility.pkgproj b/external/corefx/pkg/Microsoft.NETFramework.Compatibility/Microsoft.NETFramework.Compatibility.pkgproj new file mode 100644 index 0000000000..c2e8ce256a --- /dev/null +++ b/external/corefx/pkg/Microsoft.NETFramework.Compatibility/Microsoft.NETFramework.Compatibility.pkgproj @@ -0,0 +1,57 @@ + + + + + + 2.1.0 + + + + + 4.4.0 + + + 4.5.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/corefx/pkg/Microsoft.NETFramework.Compatibility/externalIndex.json b/external/corefx/pkg/Microsoft.NETFramework.Compatibility/externalIndex.json new file mode 100644 index 0000000000..5c1e00340c --- /dev/null +++ b/external/corefx/pkg/Microsoft.NETFramework.Compatibility/externalIndex.json @@ -0,0 +1,34 @@ +{ + "Packages": { + "System.ServiceModel.Primitives": { + "StableVersions": [ + "4.4.0", + "4.3.0" + ] + }, + "System.ServiceModel.Duplex": { + "StableVersions": [ + "4.4.0", + "4.3.0" + ] + }, + "System.ServiceModel.Http": { + "StableVersions": [ + "4.4.0", + "4.3.0" + ] + }, + "System.ServiceModel.NetTcp": { + "StableVersions": [ + "4.4.0", + "4.3.0" + ] + }, + "System.ServiceModel.Security": { + "StableVersions": [ + "4.4.0", + "4.3.0" + ] + } + } +} \ No newline at end of file diff --git a/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/Microsoft.Private.CoreFx.NETCoreApp.pkgproj b/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/Microsoft.Private.CoreFx.NETCoreApp.pkgproj index e985b086a4..dea59cc037 100644 --- a/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/Microsoft.Private.CoreFx.NETCoreApp.pkgproj +++ b/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/Microsoft.Private.CoreFx.NETCoreApp.pkgproj @@ -4,7 +4,7 @@ netcoreapp - 2.0 + 2.1 $(TargetFrameworkName)$(TargetFrameworkVersion) $(NETCoreAppPackageRefPath) @@ -28,6 +28,7 @@ + diff --git a/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props b/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props index ef4618d15b..4a90ea6c7b 100644 --- a/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props +++ b/external/corefx/pkg/Microsoft.Private.CoreFx.NETCoreApp/netcoreapp.rids.props @@ -4,7 +4,12 @@ arm + + arm64 + + + arm @@ -24,4 +29,4 @@ armel - \ No newline at end of file + diff --git a/external/corefx/pkg/Microsoft.Private.CoreFx.UAP/Microsoft.Private.CoreFx.UAP.pkgproj b/external/corefx/pkg/Microsoft.Private.CoreFx.UAP/Microsoft.Private.CoreFx.UAP.pkgproj index d7723c7a2a..b15f7bf8f9 100644 --- a/external/corefx/pkg/Microsoft.Private.CoreFx.UAP/Microsoft.Private.CoreFx.UAP.pkgproj +++ b/external/corefx/pkg/Microsoft.Private.CoreFx.UAP/Microsoft.Private.CoreFx.UAP.pkgproj @@ -3,6 +3,7 @@ + 4.6.0 uap $(UAPvNextVersion) $(TargetFrameworkName)$(TargetFrameworkVersion) @@ -35,6 +36,7 @@ + diff --git a/external/corefx/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj b/external/corefx/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj index 6796f7c7e7..5c9dd1f1be 100644 --- a/external/corefx/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj +++ b/external/corefx/pkg/Microsoft.Private.PackageBaseline/Microsoft.Private.PackageBaseline.pkgproj @@ -3,7 +3,7 @@ - 2.1.0 + 2.2.0 false true packageIndex.json diff --git a/external/corefx/pkg/Microsoft.Private.PackageBaseline/packageIndex.json.REMOVED.git-id b/external/corefx/pkg/Microsoft.Private.PackageBaseline/packageIndex.json.REMOVED.git-id index 7c1ddd53c1..e20776917e 100644 --- a/external/corefx/pkg/Microsoft.Private.PackageBaseline/packageIndex.json.REMOVED.git-id +++ b/external/corefx/pkg/Microsoft.Private.PackageBaseline/packageIndex.json.REMOVED.git-id @@ -1 +1 @@ -a11ac2ff955dec38fa844ef93c18de3dbe4e0fec \ No newline at end of file +f3f128e745dd276fe999ccec1dd9d48f056ecb9f \ No newline at end of file diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/Configurations.props b/external/corefx/pkg/NETStandard.Library.NETFramework/Configurations.props deleted file mode 100644 index 064de9fd71..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/Configurations.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - netfx; - - - \ No newline at end of file diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.builds b/external/corefx/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.builds deleted file mode 100644 index 17bb6bfebc..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.builds +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj b/external/corefx/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj deleted file mode 100644 index 4b1ccc68e0..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/NETStandard.Library.NETFramework.pkgproj +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - 2.1.0 - net - 461 - $(TargetFrameworkName)$(TargetFrameworkVersion) - - $(NetFxPackageRefPath) - $(NetFxPackageRuntimePath) - - true - true - - - true - - - - - build - - - build/%(RecursiveDir) - - - build/net471 - - - - - - - - - - - - - <_refFileNames Include="@(RefFile->'%(FileName)')" Condition="'%(Extension)' == '.dll'" /> - <_libFileNames Include="@(LibFile->'%(FileName)')" Condition="'%(Extension)' == '.dll'" /> - - - <_netFxReference Include="@(NetFxReference)" Exclude="@(_refFileNames);@(_libFileNames)" /> - - - - - - - <_excludeShimsRef Include="@(_netFxReference);@(_refFileNames)"/> - <_excludeShimsLib Include="@(_netFxReference);@(_libFileNames)"/> - - - - $(TargetFramework) - - - $(TargetFramework) - - - - - - - - $(IntermediateOutputPath)%(StampFile.RelativeDir)%(StampFile.FileName)%(StampFile.Extension) - - - - - - - - - - - - - - - - - $(NETStandardPackageVersion) - $(TargetFramework) - - - - - - - - reference-net461 - - - runtime-net461 - - - reference-net462 - - - runtime-net462 - - - reference-net47 - - - runtime-net47 - - - - - - - <_closureFileByFileName Include="@(ClosureFile->'%(FileName)')"> - %(Identity) - - - - - <_closureFileNet461 Include="@(_closureFileByFileName)" Condition="'%(_closureFileByFileName.TargetFramework)' == 'net461'" /> - <_closureFileNet462 Include="@(_closureFileByFileName)" Condition="'%(_closureFileByFileName.TargetFramework)' == 'net462'" /> - <_closureFileNet462 Include="@(_closureFileNet461)" Exclude="@(_closureFileNet462)" /> - <_closureFileNet47 Include="@(_closureFileByFileName)" Condition="'%(_closureFileByFileName.TargetFramework)' == 'net47'" /> - <_closureFileNet47 Include="@(_closureFileNet462)" Exclude="@(_closureFileNet47)" /> - - - - - - %(FileSet)-net461 - - - - %(FileSet)-net462 - - - - %(FileSet)-net47 - - - - - - - - - - <_projectDirLength>$(ProjectDir.Length) - - - - - - build/%(RefFile.TargetFramework)/ref%(RefFile.SubFolder) - - - - - build/%(LibFile.TargetFramework)/lib%(LibFile.SubFolder) - - - - - - - src - src/$([System.String]::Copy('%(FullPath)').Substring($(_projectDirLength)).Replace('\', '/')) - - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.props b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.props deleted file mode 100644 index 1019c11442..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.props +++ /dev/null @@ -1,7 +0,0 @@ - - - {PACKAGE_VERSION} - NETStandard.Library.NETFramework;$(PackageConflictPreferredPackages) - true - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.targets b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.targets deleted file mode 100644 index a8454df011..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/NETStandard.Library.NETFramework.common.targets +++ /dev/null @@ -1,63 +0,0 @@ - - - true - - - - - - - - - ResolveLockFileReferences - - - - - - ResolveNuGetPackageAssets - - - - - - ImplicitlyExpandNETStandardFacades;$(ResolveAssemblyReferencesDependsOn) - ImplicitlyExpandNETStandardFacades;$(PrepareResourcesDependsOn) - - - - - - - ImplicitlyExpandNETStandardFacades;$(HandlePackageFileConflictsDependsOn) - - - - - - - - - - - - - - - false - NETStandard.Library.NETFramework - $(NETStandardLibraryNETFrameworkPackageVersion) - - - - false - NETStandard.Library.NETFramework - $(NETStandardLibraryPackageVersion) - - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.props b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.props deleted file mode 100644 index e94b13d20f..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.props +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets deleted file mode 100644 index a01175375e..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net461/NETStandard.Library.NETFramework.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - <_NETStandardLibraryNETFrameworkReference Include="$(MSBuildThisFileDirectory)\ref\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll')" /> - - <_NETStandardLibraryNETFrameworkLib Include="$(MSBuildThisFileDirectory)\lib\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkLib->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll')" /> - - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.props b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.props deleted file mode 100644 index e94b13d20f..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.props +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets deleted file mode 100644 index 2d0419841b..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net462/NETStandard.Library.NETFramework.targets +++ /dev/null @@ -1,12 +0,0 @@ - - - <_NETStandardLibraryNETFrameworkReference Include="$(MSBuildThisFileDirectory)\ref\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll')" /> - - <_NETStandardLibraryNETFrameworkLib Include="$(MSBuildThisFileDirectory)\lib\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkLib->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll')" /> - - - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.props b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.props deleted file mode 100644 index e94b13d20f..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.props +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets b/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets deleted file mode 100644 index a27d071d79..0000000000 --- a/external/corefx/pkg/NETStandard.Library.NETFramework/targets/net47/NETStandard.Library.NETFramework.targets +++ /dev/null @@ -1,12 +0,0 @@ - - - <_NETStandardLibraryNETFrameworkReference Include="$(MSBuildThisFileDirectory)\ref\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkReference->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll')" /> - - <_NETStandardLibraryNETFrameworkLib Include="$(MSBuildThisFileDirectory)\lib\*.dll" - Exclude="@(_NETStandardLibraryNETFrameworkLib->'$(MSBuildThisFileDirectory)\ref\%(FileName).dll')" /> - - - - - diff --git a/external/corefx/pkg/descriptions.json b/external/corefx/pkg/descriptions.json index f8fec250f2..9a7e1c5b18 100644 --- a/external/corefx/pkg/descriptions.json +++ b/external/corefx/pkg/descriptions.json @@ -25,6 +25,19 @@ "Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags" ] }, + { + "Name": "Microsoft.Diagnostics.Tracing.EventSource.Redist", + "Description": "This package includes the class Microsoft.Diagnostics.Tracing.EventSource which enables firing ETW events from managed code. This is the \"runtime\" or \"redist\" EventSource package and should be referenced directly only by other NuGet packages that need the EventSource functionality. Application developers that need this functionality should instead reference the Microsoft.Diagnostics.Tracing.EventSource NuGet package which provides an enhanced developer experience. + + This package enables defining a strongly typed specification of an ETW provider that can be called by managed code. The EventSource class is also included in the .NET Framework. This package provides a newer version that has more features. It is meant to be used as a stop gap until those features it contains are ported to System.Diagnostics.Tracing.EventSource. + + For more details, have a look at http://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.aspx. + +", + "CommonTypes": [ + "Microsoft.Diagnostics.Tracing.EventSource" + ] + }, { "Name": "Microsoft.NETCore", "Description": "Provides a set of packages that can be used when building portable libraries on .NETCore based platforms.", @@ -50,6 +63,11 @@ "Description": "Enables compatibility with portable libraries targeting previous .NET releases like .NET Framework 4.0 and Silverlight.\nThis package supports retargeting references to classic reference assemblies (mscorlib.dll, system.dll, etc) to new contract assemblies (System.Runtime.dll, System.IO, etc). It does this in a pay-for-play way to prevent consuming assemblies from having to reference all of the contracts that happen to overlap with mscorlib. As such, when using this package you may encounter errors like\n\terror CS0012: The type 'WebRequest' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Requests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.\nTo resolve these errors install the package with the same name as the missing assembly.", "CommonTypes": [] }, + { + "Name": "Microsoft.NETFramework.Compatibility", + "Description": "References a number of .NET Core libraries that are intended to provide support for more APIs that exist on .NET Framework.", + "CommonTypes": [] + }, { "Name": "Microsoft.NETCore.Runtime", "Description": "The .NET Core runtime.", @@ -148,6 +166,11 @@ "Description": "Provides SGen tool to generate Xml serialization code for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types", "CommonTypes": [] }, + { + "Name": "System.ServiceModel.Syndication", + "Description": "Provides classes related to service model syndication.", + "CommonTypes": [] + }, { "Name": "NETStandard.Library.NETFramework", "Description": "Adds NETStandard2.0 support to .NET Framework.", @@ -435,6 +458,33 @@ "System.Data.Common.DbProviderFactory" ] }, + { + "Name": "System.Data.DataSetExtensions", + "Description": "Provides extensions to form LINQ expressions and method queries against DataTable objects.", + "CommonTypes": [ + "System.Data.DataRowComparer", + "System.Data.DataRowExtensions", + "System.Data.DataTableExtensions", + "System.Data.EnumerableRowCollection", + "System.Data.EnumerableRowCollectionExtensions", + "System.Data.OrderedEnumerableRowCollection", + "System.Data.TypedTableBase", + "System.Data.TypedTableBaseExtensions" + ] + }, + { + "Name": "System.Data.Odbc", + "Description": "Provides a collection of classes used to access an ODBC data source in the managed space", + "CommonTypes": [ + "System.Data.Odbc.OdbcCommand", + "System.Data.Odbc.OdbcConnection", + "System.Data.Odbc.OdbcDataReader", + "System.Data.Odbc.OdbcDataAdapter", + "System.Data.Odbc.OdbcParameter", + "System.Data.Odbc.OdbcParameterCollection", + "System.Data.Odbc.OdbcTransaction" + ] + }, { "Name": "System.Data.SqlClient", "Description": "Provides the data provider for SQL Server. These classes provide access to versions of SQL Server and encapsulate database-specific protocols, including tabular data stream (TDS)", @@ -607,6 +657,18 @@ "System.Drawing.RectangleF" ] }, + { + "Name": "System.Drawing.Common", + "Description": "Provides access to GDI+ graphics functionality.", + "CommonTypes": [ + "System.Drawing.Bitmap", + "System.Drawing.BitmapData", + "System.Drawing.Brush", + "System.Drawing.Font", + "System.Drawing.Graphics", + "System.Drawing.Icon" + ] + }, { "Name": "System.Dynamic.Runtime", "Description": "Provides classes and interfaces that support the Dynamic Language Runtime (DLR).", @@ -882,7 +944,7 @@ "Name": "System.Memory", "Description": "Provides types for efficient low-allocation access to memory.", "CommonTypes": [ - "System.Span", + "System.Span" ] }, { @@ -1565,7 +1627,7 @@ { "Name": "System.Security.Cryptography.Xml", "Description": "Provides classes to support the creation and validation of XML digital signatures. The classes in this namespace implement the World Wide Web Consortium Recommendation, \"XML-Signature Syntax and Processing\", described at http://www.w3.org/TR/xmldsig-core/.", - "CommonTypes": [ + "CommonTypes": [ "System.Security.Cryptography.Xml.CipherData", "System.Security.Cryptography.Xml.CipherReference", "System.Security.Cryptography.Xml.DataObject", diff --git a/external/corefx/referenceFromRuntime.targets b/external/corefx/referenceFromRuntime.targets index 9a736e4bd7..cc68e43d82 100644 --- a/external/corefx/referenceFromRuntime.targets +++ b/external/corefx/referenceFromRuntime.targets @@ -6,6 +6,7 @@ + diff --git a/external/corefx/run-test.sh b/external/corefx/run-test.sh index 3610d10091..1fdc2d7991 100755 --- a/external/corefx/run-test.sh +++ b/external/corefx/run-test.sh @@ -31,7 +31,7 @@ usage() echo " default: Debug" echo " --os OS to run (FreeBSD, Linux, NetBSD or OSX)" echo " default: detect current OS" - echo " --arch Architecture to run (x64, arm, x86, arm64)" + echo " --arch Architecture to run (x64, arm, armel, x86, arm64)" echo " default: detect current architecture" echo echo "Execution options:" @@ -197,14 +197,10 @@ run_test() exit 0 fi - dirName="$1/netcoreapp" - + dirName="$1/netcoreapp-$OS-$ConfigurationGroup-$__Arch" if [ ! -d "$dirName" ]; then - dirName="$1/netstandard" - if [ ! -d "$dirName" ]; then - echo "Nothing to test in $testProject" - return - fi + echo "Nothing to test in $testProject" + return fi if [ ! -e "$dirName/RunTests.sh" ]; then @@ -308,6 +304,9 @@ do --os) OS=$2 ;; + --arch) + __Arch=$2 + ;; --coreclr-coverage) CoreClrCoverage=ON ;; @@ -397,9 +396,7 @@ if [ -n "$TestDirFile" ] || [ -n "$TestDir" ] then run_selected_tests else - run_all_tests "$CoreFxTests/AnyOS.AnyCPU.$ConfigurationGroup/"*.Tests - run_all_tests "$CoreFxTests/Unix.AnyCPU.$ConfigurationGroup/"*.Tests - run_all_tests "$CoreFxTests/$OS.AnyCPU.$ConfigurationGroup/"*.Tests + run_all_tests "$CoreFxTests/tests/"*.Tests fi if [ "$CoreClrCoverage" == "ON" ] diff --git a/external/corefx/run.cmd b/external/corefx/run.cmd index 55e8bb5318..eca223aaa9 100644 --- a/external/corefx/run.cmd +++ b/external/corefx/run.cmd @@ -16,19 +16,22 @@ setlocal :: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015 :: toolset if it is installed. Finally, we will fail the script if no supported VS instance :: can be found. -if not defined VisualStudioVersion ( - if defined VS150COMNTOOLS ( - call "%VS150COMNTOOLS%\VsDevCmd.bat" - goto :Run - ) else if defined VS140COMNTOOLS ( - call "%VS140COMNTOOLS%\VsDevCmd.bat" - goto :Run - ) + +if defined VisualStudioVersion goto :Run + +set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if exist %_VSWHERE% ( + for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools +) +if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% +if not exist "%_VSCOMNTOOLS%" ( echo Error: Visual Studio 2015 or 2017 required. echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. exit /b 1 ) +call "%_VSCOMNTOOLS%\VsDevCmd.bat" + :Run :: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and :: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69). diff --git a/external/corefx/src/Common/Common.Tests.sln b/external/corefx/src/Common/Common.Tests.sln index 5f88183bd5..b27aff0580 100644 --- a/external/corefx/src/Common/Common.Tests.sln +++ b/external/corefx/src/Common/Common.Tests.sln @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C72FD34C-539A-4447-9796-62A229571199}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU - {C72FD34C-539A-4447-9796-62A229571199}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU - {C72FD34C-539A-4447-9796-62A229571199}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU - {C72FD34C-539A-4447-9796-62A229571199}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU + {C72FD34C-539A-4447-9796-62A229571199}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {C72FD34C-539A-4447-9796-62A229571199}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {C72FD34C-539A-4447-9796-62A229571199}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {C72FD34C-539A-4447-9796-62A229571199}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs b/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs index d86b09e0da..060f640e68 100644 --- a/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs @@ -17,9 +17,8 @@ namespace Internal.Cryptography /// /// Convert Ieee1363 format of (r, s) to Der format /// - public static byte[] ConvertIeee1363ToDer(byte[] input) + public static byte[] ConvertIeee1363ToDer(ReadOnlySpan input) { - Debug.Assert(input != null); Debug.Assert(input.Length % 2 == 0); Debug.Assert(input.Length > 1); @@ -27,8 +26,8 @@ namespace Internal.Cryptography // Output is the DER encoded value of CONSTRUCTEDSEQUENCE(INTEGER(r), INTEGER(s)). int halfLength = input.Length / 2; - byte[][] rEncoded = DerEncoder.SegmentedEncodeUnsignedInteger(input, 0, halfLength); - byte[][] sEncoded = DerEncoder.SegmentedEncodeUnsignedInteger(input, halfLength, halfLength); + byte[][] rEncoded = DerEncoder.SegmentedEncodeUnsignedInteger(input.Slice(0, halfLength)); + byte[][] sEncoded = DerEncoder.SegmentedEncodeUnsignedInteger(input.Slice(halfLength, halfLength)); return DerEncoder.ConstructSequence(rEncoded, sEncoded); } diff --git a/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs b/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs index 90e38ea4d1..881fb4e8a1 100644 --- a/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Hash.cs @@ -40,38 +40,25 @@ namespace Internal.Cryptography } } + public static bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + // The classes that call us are sealed and their base class has checked this already. + Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name)); + + using (HashAlgorithm hasher = GetHashAlgorithm(hashAlgorithm)) + { + return hasher.TryComputeHash(source, destination, out bytesWritten); + } + } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "MD5 is used when the user asks for it.")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 is used when the user asks for it.")] - private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithmName) - { - HashAlgorithm hasher; - - if (hashAlgorithmName == HashAlgorithmName.MD5) - { - hasher = MD5.Create(); - } - else if (hashAlgorithmName == HashAlgorithmName.SHA1) - { - hasher = SHA1.Create(); - } - else if (hashAlgorithmName == HashAlgorithmName.SHA256) - { - hasher = SHA256.Create(); - } - else if (hashAlgorithmName == HashAlgorithmName.SHA384) - { - hasher = SHA384.Create(); - } - else if (hashAlgorithmName == HashAlgorithmName.SHA512) - { - hasher = SHA512.Create(); - } - else - { - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmName.Name); - } - - return hasher; - } + private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithmName) => + hashAlgorithmName == HashAlgorithmName.MD5 ? MD5.Create() : + hashAlgorithmName == HashAlgorithmName.SHA1 ? SHA1.Create() : + hashAlgorithmName == HashAlgorithmName.SHA256 ? SHA256.Create() : + hashAlgorithmName == HashAlgorithmName.SHA384 ? SHA384.Create() : + hashAlgorithmName == HashAlgorithmName.SHA512 ? (HashAlgorithm)SHA512.Create() : + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmName.Name); } } diff --git a/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.Hash.cs b/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.Hash.cs index 17287ba0c6..8240a01887 100644 --- a/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.Hash.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.Hash.cs @@ -19,11 +19,27 @@ namespace Internal.Cryptography Debug.Assert(count >= 0 && count <= data.Length); Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name)); - using (HashProviderCng hashProvider = new HashProviderCng(hashAlgorithm.Name, null)) + using (var hashProvider = new HashProviderCng(hashAlgorithm.Name, null)) { hashProvider.AppendHashData(data, offset, count); - byte[] hash = hashProvider.FinalizeHashAndReset(); - return hash; + return hashProvider.FinalizeHashAndReset(); + } + } + + public static bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name)); + + using (var hashProvider = new HashProviderCng(hashAlgorithm.Name, null)) + { + if (destination.Length < hashProvider.HashSizeInBytes) + { + bytesWritten = 0; + return false; + } + + hashProvider.AppendHashData(source); + return hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); } } @@ -33,7 +49,7 @@ namespace Internal.Cryptography Debug.Assert(data != null); Debug.Assert(!string.IsNullOrEmpty(hashAlgorithm.Name)); - using (HashProviderCng hashProvider = new HashProviderCng(hashAlgorithm.Name, null)) + using (var hashProvider = new HashProviderCng(hashAlgorithm.Name, null)) { // Default the buffer size to 4K. byte[] buffer = new byte[4096]; diff --git a/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs b/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs index 410e62e339..6f19f69ae1 100644 --- a/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/CngCommon.SignVerify.cs @@ -3,11 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics; -using System.Security.Cryptography; - using Microsoft.Win32.SafeHandles; - using ErrorCode = Interop.NCrypt.ErrorCode; using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode; @@ -15,7 +11,7 @@ namespace Internal.Cryptography { internal static partial class CngCommon { - public static unsafe byte[] SignHash(this SafeNCryptKeyHandle keyHandle, byte[] hash, AsymmetricPaddingMode paddingMode, void* pPaddingInfo, int estimatedSize) + public static unsafe byte[] SignHash(this SafeNCryptKeyHandle keyHandle, ReadOnlySpan hash, AsymmetricPaddingMode paddingMode, void* pPaddingInfo, int estimatedSize) { #if DEBUG estimatedSize = 2; // Make sure the NTE_BUFFER_TOO_SMALL scenario gets exercised. @@ -35,11 +31,28 @@ namespace Internal.Cryptography return signature; } - public static unsafe bool VerifyHash(this SafeNCryptKeyHandle keyHandle, byte[] hash, byte[] signature, AsymmetricPaddingMode paddingMode, void* pPaddingInfo) + public static unsafe bool TrySignHash(this SafeNCryptKeyHandle keyHandle, ReadOnlySpan hash, Span signature, AsymmetricPaddingMode paddingMode, void* pPaddingInfo, out int bytesWritten) + { + ErrorCode error = Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, out int numBytesNeeded, paddingMode); + switch (error) + { + case ErrorCode.ERROR_SUCCESS: + bytesWritten = numBytesNeeded; + return true; + + case ErrorCode.NTE_BUFFER_TOO_SMALL: + bytesWritten = 0; + return false; + + default: + throw error.ToCryptographicException(); + } + } + + public static unsafe bool VerifyHash(this SafeNCryptKeyHandle keyHandle, ReadOnlySpan hash, ReadOnlySpan signature, AsymmetricPaddingMode paddingMode, void* pPaddingInfo) { ErrorCode errorCode = Interop.NCrypt.NCryptVerifySignature(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, paddingMode); - bool verified = (errorCode == ErrorCode.ERROR_SUCCESS); // For consistency with other AsymmetricAlgorithm-derived classes, return "false" for any error code rather than making the caller catch an exception. - return verified; + return errorCode == ErrorCode.ERROR_SUCCESS; // For consistency with other AsymmetricAlgorithm-derived classes, return "false" for any error code rather than making the caller catch an exception. } } } diff --git a/external/corefx/src/Common/src/Internal/Cryptography/HashProvider.cs b/external/corefx/src/Common/src/Internal/Cryptography/HashProvider.cs index f76b6f654f..17cf3cca9c 100644 --- a/external/corefx/src/Common/src/Internal/Cryptography/HashProvider.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/HashProvider.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics; namespace Internal.Cryptography { @@ -29,16 +28,16 @@ namespace Internal.Cryptography if (data.Length - offset < count) throw new ArgumentException(SR.Argument_InvalidOffLen); - AppendHashDataCore(data, offset, count); + AppendHashData(new ReadOnlySpan(data, offset, count)); } - // Adds new data to be hashed. This can be called repeatedly in order to hash data from noncontiguous sources. - // Argument validation is handled by AppendHashData. - public abstract void AppendHashDataCore(byte[] data, int offset, int count); - + public abstract void AppendHashData(ReadOnlySpan data); + // Compute the hash based on the appended data and resets the HashProvider for more hashing. public abstract byte[] FinalizeHashAndReset(); + public abstract bool TryFinalizeHashAndReset(Span destination, out int bytesWritten); + // Returns the length of the byte array returned by FinalizeHashAndReset. public abstract int HashSizeInBytes { get; } @@ -53,4 +52,3 @@ namespace Internal.Cryptography public abstract void Dispose(bool disposing); } } - diff --git a/external/corefx/src/Common/src/Internal/Cryptography/HashProviderCng.cs b/external/corefx/src/Common/src/Internal/Cryptography/HashProviderCng.cs index 81fb02d3d3..83e117dcd5 100644 --- a/external/corefx/src/Common/src/Internal/Cryptography/HashProviderCng.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/HashProviderCng.cs @@ -4,8 +4,6 @@ using System; using System.Diagnostics; -using System.Security.Cryptography; - using Microsoft.Win32.SafeHandles; using NTSTATUS = Interop.BCrypt.NTSTATUS; using BCryptOpenAlgorithmProviderFlags = Interop.BCrypt.BCryptOpenAlgorithmProviderFlags; @@ -68,30 +66,43 @@ namespace Internal.Cryptography return; } - public sealed override void AppendHashDataCore(byte[] data, int offset, int count) + public sealed override unsafe void AppendHashData(ReadOnlySpan source) { - unsafe + NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hHash, source, source.Length, 0); + if (ntStatus != NTSTATUS.STATUS_SUCCESS) { - fixed (byte* pRgb = data) - { - NTSTATUS ntStatus = Interop.BCrypt.BCryptHashData(_hHash, pRgb + offset, count, 0); - if (ntStatus != NTSTATUS.STATUS_SUCCESS) - throw Interop.BCrypt.CreateCryptographicException(ntStatus); - } + throw Interop.BCrypt.CreateCryptographicException(ntStatus); } } public sealed override byte[] FinalizeHashAndReset() { - byte[] hash = new byte[_hashSize]; - NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hHash, hash, hash.Length, 0); - if (ntStatus != NTSTATUS.STATUS_SUCCESS) - throw Interop.BCrypt.CreateCryptographicException(ntStatus); - - ResetHashObject(); + var hash = new byte[_hashSize]; + bool success = TryFinalizeHashAndReset(hash, out int bytesWritten); + Debug.Assert(success); + Debug.Assert(hash.Length == bytesWritten); return hash; } + public override bool TryFinalizeHashAndReset(Span destination, out int bytesWritten) + { + if (destination.Length < _hashSize) + { + bytesWritten = 0; + return false; + } + + NTSTATUS ntStatus = Interop.BCrypt.BCryptFinishHash(_hHash, destination, _hashSize, 0); + if (ntStatus != NTSTATUS.STATUS_SUCCESS) + { + throw Interop.BCrypt.CreateCryptographicException(ntStatus); + } + + bytesWritten = _hashSize; + ResetHashObject(); + return true; + } + public sealed override void Dispose(bool disposing) { if (disposing) @@ -106,13 +117,7 @@ namespace Internal.Cryptography } } - public sealed override int HashSizeInBytes - { - get - { - return _hashSize; - } - } + public sealed override int HashSizeInBytes => _hashSize; private void ResetHashObject() { diff --git a/external/corefx/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs b/external/corefx/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs index d9d713d4c4..2b87afa3c7 100644 --- a/external/corefx/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs +++ b/external/corefx/src/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.cs @@ -14,13 +14,15 @@ internal static partial class Interop internal static partial class procfs { internal const string RootPath = "/proc/"; - internal const string SelfExeFilePath = RootPath + "self/exe"; - internal const string ProcUptimeFilePath = RootPath + "uptime"; + private const string ExeFileName = "/exe"; private const string StatFileName = "/stat"; private const string MapsFileName = "/maps"; private const string FileDescriptorDirectoryName = "/fd/"; private const string TaskDirectoryName = "/task/"; + internal const string SelfExeFilePath = RootPath + "self" + ExeFileName; + internal const string ProcUptimeFilePath = RootPath + "uptime"; + internal struct ParsedStat { // Commented out fields are available in the stat data file but @@ -80,6 +82,11 @@ internal static partial class Interop internal KeyValuePair AddressRange; } + internal static string GetExeFilePathForProcess(int pid) + { + return RootPath + pid.ToString(CultureInfo.InvariantCulture) + ExeFileName; + } + internal static string GetStatFilePathForProcess(int pid) { return RootPath + pid.ToString(CultureInfo.InvariantCulture) + StatFileName; diff --git a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs index 9e8e05fa2b..0e736a4d0a 100644 --- a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs +++ b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs @@ -46,6 +46,38 @@ internal static partial class Interop } } } + + internal static unsafe bool TryCFWriteData(SafeCFDataHandle cfData, Span destination, out int bytesWritten) + { + bool addedRef = false; + try + { + cfData.DangerousAddRef(ref addedRef); + + long length = CFDataGetLength(cfData).ToInt64(); + if (destination.Length < length) + { + bytesWritten = 0; + return false; + } + + byte* dataBytes = CFDataGetBytePtr(cfData); + fixed (byte* destinationPtr = &destination.DangerousGetPinnableReference()) + { + Buffer.MemoryCopy(dataBytes, destinationPtr, destination.Length, length); + } + + bytesWritten = (int)length; + return true; + } + finally + { + if (addedRef) + { + cfData.DangerousRelease(); + } + } + } } } diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs index ff3857a603..8d8b13aeb3 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs @@ -16,11 +16,17 @@ internal static partial class Interop [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestCreate")] internal static extern SafeDigestCtxHandle DigestCreate(PAL_HashAlgorithm algorithm, out int cbDigest); + internal static int DigestUpdate(SafeDigestCtxHandle ctx, ReadOnlySpan pbData, int cbData) => + DigestUpdate(ctx, ref pbData.DangerousGetPinnableReference(), cbData); + [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestUpdate")] - internal static extern unsafe int DigestUpdate(SafeDigestCtxHandle ctx, byte* pbData, int cbData); + private static extern int DigestUpdate(SafeDigestCtxHandle ctx, ref byte pbData, int cbData); + + internal static int DigestFinal(SafeDigestCtxHandle ctx, Span pbOutput, int cbOutput) => + DigestFinal(ctx, ref pbOutput.DangerousGetPinnableReference(), cbOutput); [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_DigestFinal")] - internal static extern unsafe int DigestFinal(SafeDigestCtxHandle ctx, byte* pbOutput, int cbOutput); + private static extern int DigestFinal(SafeDigestCtxHandle ctx, ref byte pbOutput, int cbOutput); } } diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs index 117d3b4bcf..6dc7d97d71 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs @@ -17,13 +17,19 @@ internal static partial class Interop internal static extern SafeHmacHandle HmacCreate(PAL_HashAlgorithm algorithm, ref int cbDigest); [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacInit")] - internal static extern unsafe int HmacInit(SafeHmacHandle ctx, byte* pbKey, int cbKey); + internal static extern unsafe int HmacInit(SafeHmacHandle ctx, [In] byte[] pbKey, int cbKey); + + internal static int HmacUpdate(SafeHmacHandle ctx, ReadOnlySpan pbData, int cbData) => + HmacUpdate(ctx, ref pbData.DangerousGetPinnableReference(), cbData); [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacUpdate")] - internal static extern unsafe int HmacUpdate(SafeHmacHandle ctx, byte* pbData, int cbData); + private static extern int HmacUpdate(SafeHmacHandle ctx, ref byte pbData, int cbData); + + internal static int HmacFinal(SafeHmacHandle ctx, ReadOnlySpan pbOutput, int cbOutput) => + HmacFinal(ctx, ref pbOutput.DangerousGetPinnableReference(), cbOutput); [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_HmacFinal")] - internal static extern unsafe int HmacFinal(SafeHmacHandle ctx, byte* pbOutput, int cbOutput); + private static extern unsafe int HmacFinal(SafeHmacHandle ctx, ref byte pbOutput, int cbOutput); } } diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs index 06ce4bdc59..06d8685909 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.RSA.cs @@ -21,36 +21,70 @@ internal static partial class Interop out SafeSecKeyRefHandle pPrivateKey, out int pOSStatus); + private static int RsaEncryptOaep( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbData, + int cbData, + PAL_HashAlgorithm mgfAlgorithm, + out SafeCFDataHandle pEncryptedOut, + out SafeCFErrorHandle pErrorOut) => + RsaEncryptOaep(publicKey, ref pbData.DangerousGetPinnableReference(), cbData, mgfAlgorithm, out pEncryptedOut, out pErrorOut); + [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_RsaEncryptOaep")] private static extern int RsaEncryptOaep( SafeSecKeyRefHandle publicKey, - byte[] pbData, + ref byte pbData, int cbData, PAL_HashAlgorithm mgfAlgorithm, out SafeCFDataHandle pEncryptedOut, out SafeCFErrorHandle pErrorOut); + private static int RsaEncryptPkcs( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbData, + int cbData, + out SafeCFDataHandle pEncryptedOut, + out SafeCFErrorHandle pErrorOut) => + RsaEncryptPkcs(publicKey, ref pbData.DangerousGetPinnableReference(), cbData, out pEncryptedOut, out pErrorOut); + [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_RsaEncryptPkcs")] private static extern int RsaEncryptPkcs( SafeSecKeyRefHandle publicKey, - byte[] pbData, + ref byte pbData, int cbData, out SafeCFDataHandle pEncryptedOut, out SafeCFErrorHandle pErrorOut); + private static int RsaDecryptOaep( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbData, + int cbData, + PAL_HashAlgorithm mgfAlgorithm, + out SafeCFDataHandle pEncryptedOut, + out SafeCFErrorHandle pErrorOut) => + RsaDecryptOaep(publicKey, ref pbData.DangerousGetPinnableReference(), cbData, mgfAlgorithm, out pEncryptedOut, out pErrorOut); + [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_RsaDecryptOaep")] private static extern int RsaDecryptOaep( SafeSecKeyRefHandle publicKey, - byte[] pbData, + ref byte pbData, int cbData, PAL_HashAlgorithm mgfAlgorithm, out SafeCFDataHandle pEncryptedOut, out SafeCFErrorHandle pErrorOut); + private static int RsaDecryptPkcs( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbData, + int cbData, + out SafeCFDataHandle pEncryptedOut, + out SafeCFErrorHandle pErrorOut) => + RsaDecryptPkcs(publicKey, ref pbData.DangerousGetPinnableReference(), cbData, out pEncryptedOut, out pErrorOut); + [DllImport(Libraries.AppleCryptoNative, EntryPoint = "AppleCryptoNative_RsaDecryptPkcs")] private static extern int RsaDecryptPkcs( SafeSecKeyRefHandle publicKey, - byte[] pbData, + ref byte pbData, int cbData, out SafeCFDataHandle pEncryptedOut, out SafeCFErrorHandle pErrorOut); @@ -100,24 +134,44 @@ internal static partial class Interop RSAEncryptionPadding padding) { return ExecuteTransform( - (out SafeCFDataHandle encrypted, out SafeCFErrorHandle error) => + data, + (ReadOnlySpan source, out SafeCFDataHandle encrypted, out SafeCFErrorHandle error) => { if (padding == RSAEncryptionPadding.Pkcs1) { - return RsaEncryptPkcs(publicKey, data, data.Length, out encrypted, out error); + return RsaEncryptPkcs(publicKey, source, source.Length, out encrypted, out error); } Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Oaep); return RsaEncryptOaep( publicKey, - data, - data.Length, + source, + source.Length, PalAlgorithmFromAlgorithmName(padding.OaepHashAlgorithm), out encrypted, out error); }); + } + internal static bool TryRsaEncrypt( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan source, + Span destination, + RSAEncryptionPadding padding, + out int bytesWritten) + { + Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Pkcs1 || padding.Mode == RSAEncryptionPaddingMode.Oaep); + return TryExecuteTransform( + source, + destination, + out bytesWritten, + delegate (ReadOnlySpan innerSource, out SafeCFDataHandle outputHandle, out SafeCFErrorHandle errorHandle) + { + return padding.Mode == RSAEncryptionPaddingMode.Pkcs1 ? + RsaEncryptPkcs(publicKey, innerSource, innerSource.Length, out outputHandle, out errorHandle) : + RsaEncryptOaep(publicKey, innerSource, innerSource.Length, PalAlgorithmFromAlgorithmName(padding.OaepHashAlgorithm), out outputHandle, out errorHandle); + }); } internal static byte[] RsaDecrypt( @@ -126,50 +180,52 @@ internal static partial class Interop RSAEncryptionPadding padding) { return ExecuteTransform( - (out SafeCFDataHandle decrypted, out SafeCFErrorHandle error) => + data, + (ReadOnlySpan source, out SafeCFDataHandle decrypted, out SafeCFErrorHandle error) => { if (padding == RSAEncryptionPadding.Pkcs1) { - return RsaDecryptPkcs(privateKey, data, data.Length, out decrypted, out error); + return RsaDecryptPkcs(privateKey, source, source.Length, out decrypted, out error); } Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Oaep); return RsaDecryptOaep( privateKey, - data, - data.Length, + source, + source.Length, PalAlgorithmFromAlgorithmName(padding.OaepHashAlgorithm), out decrypted, out error); }); } - private static Interop.AppleCrypto.PAL_HashAlgorithm PalAlgorithmFromAlgorithmName( - HashAlgorithmName hashAlgorithmName) + internal static bool TryRsaDecrypt( + SafeSecKeyRefHandle privateKey, + ReadOnlySpan source, + Span destination, + RSAEncryptionPadding padding, + out int bytesWritten) { - if (hashAlgorithmName == HashAlgorithmName.MD5) - { - return Interop.AppleCrypto.PAL_HashAlgorithm.Md5; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA1) - { - return Interop.AppleCrypto.PAL_HashAlgorithm.Sha1; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA256) - { - return Interop.AppleCrypto.PAL_HashAlgorithm.Sha256; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA384) - { - return Interop.AppleCrypto.PAL_HashAlgorithm.Sha384; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA512) - { - return Interop.AppleCrypto.PAL_HashAlgorithm.Sha512; - } - - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmName.Name); + Debug.Assert(padding.Mode == RSAEncryptionPaddingMode.Pkcs1 || padding.Mode == RSAEncryptionPaddingMode.Oaep); + return TryExecuteTransform( + source, + destination, + out bytesWritten, + delegate (ReadOnlySpan innerSource, out SafeCFDataHandle outputHandle, out SafeCFErrorHandle errorHandle) + { + return padding.Mode == RSAEncryptionPaddingMode.Pkcs1 ? + RsaDecryptPkcs(privateKey, innerSource, innerSource.Length, out outputHandle, out errorHandle) : + RsaDecryptOaep(privateKey, innerSource, innerSource.Length, PalAlgorithmFromAlgorithmName(padding.OaepHashAlgorithm), out outputHandle, out errorHandle); + }); } + + private static PAL_HashAlgorithm PalAlgorithmFromAlgorithmName(HashAlgorithmName hashAlgorithmName) => + hashAlgorithmName == HashAlgorithmName.MD5 ? PAL_HashAlgorithm.Md5 : + hashAlgorithmName == HashAlgorithmName.SHA1 ? PAL_HashAlgorithm.Sha1 : + hashAlgorithmName == HashAlgorithmName.SHA256 ? PAL_HashAlgorithm.Sha256 : + hashAlgorithmName == HashAlgorithmName.SHA384 ? PAL_HashAlgorithm.Sha384 : + hashAlgorithmName == HashAlgorithmName.SHA512 ? PAL_HashAlgorithm.Sha512 : + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithmName.Name); } } diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs index 68b9501fcc..e9945864f4 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs @@ -10,13 +10,12 @@ internal static partial class Interop { internal static partial class AppleCrypto { - internal static unsafe void GetRandomBytes(byte* pbBuffer, int count) + internal static void GetRandomBytes(ref byte pbBuffer, int count) { - Debug.Assert(pbBuffer != null); Debug.Assert(count >= 0); int errorCode; - int ret = AppleCryptoNative_GetRandomBytes(pbBuffer, count, out errorCode); + int ret = AppleCryptoNative_GetRandomBytes(ref pbBuffer, count, out errorCode); if (ret == 0) { @@ -30,6 +29,6 @@ internal static partial class Interop } [DllImport(Libraries.AppleCryptoNative)] - private static extern unsafe int AppleCryptoNative_GetRandomBytes(byte* buf, int num, out int errorCode); + private static extern int AppleCryptoNative_GetRandomBytes(ref byte buf, int num, out int errorCode); } } diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs index e516af3324..83fa6433ca 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.SecKeyRef.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Security.Cryptography; @@ -20,38 +21,89 @@ internal static partial class Interop out SafeSecKeyRefHandle ppKeyOut, out int pOSStatus); + private static int AppleCryptoNative_GenerateSignature( + SafeSecKeyRefHandle privateKey, + ReadOnlySpan pbDataHash, + int cbDataHash, + out SafeCFDataHandle pSignatureOut, + out SafeCFErrorHandle pErrorOut) => + AppleCryptoNative_GenerateSignature( + privateKey, ref pbDataHash.DangerousGetPinnableReference(), cbDataHash, out pSignatureOut, out pErrorOut); + [DllImport(Libraries.AppleCryptoNative)] private static extern int AppleCryptoNative_GenerateSignature( SafeSecKeyRefHandle privateKey, - byte[] pbDataHash, + ref byte pbDataHash, int cbDataHash, out SafeCFDataHandle pSignatureOut, out SafeCFErrorHandle pErrorOut); + private static int AppleCryptoNative_GenerateSignatureWithHashAlgorithm( + SafeSecKeyRefHandle privateKey, + ReadOnlySpan pbDataHash, + int cbDataHash, + PAL_HashAlgorithm hashAlgorithm, + out SafeCFDataHandle pSignatureOut, + out SafeCFErrorHandle pErrorOut) => + AppleCryptoNative_GenerateSignatureWithHashAlgorithm( + privateKey, ref pbDataHash.DangerousGetPinnableReference(), cbDataHash, hashAlgorithm, out pSignatureOut, out pErrorOut); + [DllImport(Libraries.AppleCryptoNative)] private static extern int AppleCryptoNative_GenerateSignatureWithHashAlgorithm( SafeSecKeyRefHandle privateKey, - byte[] pbDataHash, + ref byte pbDataHash, int cbDataHash, PAL_HashAlgorithm hashAlgorithm, out SafeCFDataHandle pSignatureOut, out SafeCFErrorHandle pErrorOut); + private static int AppleCryptoNative_VerifySignature( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbDataHash, + int cbDataHash, + ReadOnlySpan pbSignature, + int cbSignature, + out SafeCFErrorHandle pErrorOut) => + AppleCryptoNative_VerifySignature( + publicKey, + ref pbDataHash.DangerousGetPinnableReference(), + cbDataHash, + ref pbSignature.DangerousGetPinnableReference(), + cbSignature, + out pErrorOut); + [DllImport(Libraries.AppleCryptoNative)] private static extern int AppleCryptoNative_VerifySignature( SafeSecKeyRefHandle publicKey, - byte[] pbDataHash, + ref byte pbDataHash, int cbDataHash, - byte[] pbSignature, + ref byte pbSignature, int cbSignature, out SafeCFErrorHandle pErrorOut); + private static int AppleCryptoNative_VerifySignatureWithHashAlgorithm( + SafeSecKeyRefHandle publicKey, + ReadOnlySpan pbDataHash, + int cbDataHash, + ReadOnlySpan pbSignature, + int cbSignature, + PAL_HashAlgorithm hashAlgorithm, + out SafeCFErrorHandle pErrorOut) => + AppleCryptoNative_VerifySignatureWithHashAlgorithm( + publicKey, + ref pbDataHash.DangerousGetPinnableReference(), + cbDataHash, + ref pbSignature.DangerousGetPinnableReference(), + cbSignature, + hashAlgorithm, + out pErrorOut); + [DllImport(Libraries.AppleCryptoNative)] private static extern int AppleCryptoNative_VerifySignatureWithHashAlgorithm( SafeSecKeyRefHandle publicKey, - byte[] pbDataHash, + ref byte pbDataHash, int cbDataHash, - byte[] pbSignature, + ref byte pbSignature, int cbSignature, PAL_HashAlgorithm hashAlgorithm, out SafeCFErrorHandle pErrorOut); @@ -59,9 +111,9 @@ internal static partial class Interop [DllImport(Libraries.AppleCryptoNative)] private static extern ulong AppleCryptoNative_SecKeyGetSimpleKeySizeInBytes(SafeSecKeyRefHandle publicKey); - private delegate int SecKeyTransform(out SafeCFDataHandle data, out SafeCFErrorHandle error); + private delegate int SecKeyTransform(ReadOnlySpan source, out SafeCFDataHandle outputHandle, out SafeCFErrorHandle errorHandle); - private static byte[] ExecuteTransform(SecKeyTransform transform) + private static byte[] ExecuteTransform(ReadOnlySpan source, SecKeyTransform transform) { const int Success = 1; const int kErrorSeeError = -2; @@ -69,7 +121,7 @@ internal static partial class Interop SafeCFDataHandle data; SafeCFErrorHandle error; - int ret = transform(out data, out error); + int ret = transform(source, out data, out error); using (error) using (data) @@ -89,6 +141,35 @@ internal static partial class Interop } } + private static bool TryExecuteTransform( + ReadOnlySpan source, + Span destination, + out int bytesWritten, + SecKeyTransform transform) + { + SafeCFDataHandle outputHandle; + SafeCFErrorHandle errorHandle; + + int ret = transform(source, out outputHandle, out errorHandle); + + using (errorHandle) + using (outputHandle) + { + const int Success = 1; + const int kErrorSeeError = -2; + switch (ret) + { + case Success: + return CoreFoundation.TryCFWriteData(outputHandle, destination, out bytesWritten); + case kErrorSeeError: + throw CreateExceptionForCFError(errorHandle); + default: + Debug.Fail($"transform returned {ret}"); + throw new CryptographicException(); + } + } + } + internal static int GetSimpleKeySizeInBits(SafeSecKeyRefHandle publicKey) { ulong keySizeInBytes = AppleCryptoNative_SecKeyGetSimpleKeySizeInBytes(publicKey); @@ -127,49 +208,68 @@ internal static partial class Interop throw new CryptographicException(); } - internal static byte[] GenerateSignature(SafeSecKeyRefHandle privateKey, byte[] dataHash) + internal static byte[] GenerateSignature(SafeSecKeyRefHandle privateKey, ReadOnlySpan dataHash) { Debug.Assert(privateKey != null, "privateKey != null"); - Debug.Assert(dataHash != null, "dataHash != null"); return ExecuteTransform( - (out SafeCFDataHandle signature, out SafeCFErrorHandle error) => + dataHash, + (ReadOnlySpan source, out SafeCFDataHandle signature, out SafeCFErrorHandle error) => AppleCryptoNative_GenerateSignature( privateKey, - dataHash, - dataHash.Length, + source, + source.Length, out signature, out error)); } internal static byte[] GenerateSignature( SafeSecKeyRefHandle privateKey, - byte[] dataHash, + ReadOnlySpan dataHash, PAL_HashAlgorithm hashAlgorithm) { Debug.Assert(privateKey != null, "privateKey != null"); - Debug.Assert(dataHash != null, "dataHash != null"); Debug.Assert(hashAlgorithm != PAL_HashAlgorithm.Unknown, "hashAlgorithm != PAL_HashAlgorithm.Unknown"); return ExecuteTransform( - (out SafeCFDataHandle signature, out SafeCFErrorHandle error) => + dataHash, + (ReadOnlySpan source, out SafeCFDataHandle signature, out SafeCFErrorHandle error) => AppleCryptoNative_GenerateSignatureWithHashAlgorithm( privateKey, - dataHash, - dataHash.Length, + source, + source.Length, hashAlgorithm, out signature, out error)); } + internal static bool TryGenerateSignature( + SafeSecKeyRefHandle privateKey, + ReadOnlySpan source, + Span destination, + PAL_HashAlgorithm hashAlgorithm, + out int bytesWritten) + { + Debug.Assert(privateKey != null, "privateKey != null"); + Debug.Assert(hashAlgorithm != PAL_HashAlgorithm.Unknown, "hashAlgorithm != PAL_HashAlgorithm.Unknown"); + + return TryExecuteTransform( + source, + destination, + out bytesWritten, + delegate (ReadOnlySpan innerSource, out SafeCFDataHandle outputHandle, out SafeCFErrorHandle errorHandle) + { + return AppleCryptoNative_GenerateSignatureWithHashAlgorithm( + privateKey, innerSource, innerSource.Length, hashAlgorithm, out outputHandle, out errorHandle); + }); + } + internal static bool VerifySignature( SafeSecKeyRefHandle publicKey, - byte[] dataHash, - byte[] signature) + ReadOnlySpan dataHash, + ReadOnlySpan signature) { Debug.Assert(publicKey != null, "publicKey != null"); - Debug.Assert(dataHash != null, "dataHash != null"); - Debug.Assert(signature != null, "signature != null"); SafeCFErrorHandle error; @@ -204,13 +304,11 @@ internal static partial class Interop internal static bool VerifySignature( SafeSecKeyRefHandle publicKey, - byte[] dataHash, - byte[] signature, + ReadOnlySpan dataHash, + ReadOnlySpan signature, PAL_HashAlgorithm hashAlgorithm) { Debug.Assert(publicKey != null, "publicKey != null"); - Debug.Assert(dataHash != null, "dataHash != null"); - Debug.Assert(signature != null, "signature != null"); Debug.Assert(hashAlgorithm != PAL_HashAlgorithm.Unknown); SafeCFErrorHandle error; diff --git a/external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs b/external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs index e6d9078450..df9955f9de 100644 --- a/external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs +++ b/external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs @@ -13,5 +13,6 @@ internal static partial class Interop internal const string CryptoNative = "System.Security.Cryptography.Native.OpenSsl"; internal const string GlobalizationNative = "System.Globalization.Native"; internal const string CompressionNative = "System.IO.Compression.Native"; + internal const string Libdl = "libdl"; } } diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ForkAndExecProcess.cs b/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ForkAndExecProcess.cs index 1e01ac23ae..8667e21a9c 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ForkAndExecProcess.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ForkAndExecProcess.cs @@ -15,14 +15,15 @@ internal static partial class Interop internal static unsafe void ForkAndExecProcess( string filename, string[] argv, string[] envp, string cwd, bool redirectStdin, bool redirectStdout, bool redirectStderr, - out int lpChildPid, out int stdinFd, out int stdoutFd, out int stderrFd) + out int lpChildPid, out int stdinFd, out int stdoutFd, out int stderrFd, bool shouldThrow = true) { byte** argvPtr = null, envpPtr = null; + int result = -1; try { AllocNullTerminatedArray(argv, ref argvPtr); AllocNullTerminatedArray(envp, ref envpPtr); - int result = ForkAndExecProcess( + result = ForkAndExecProcess( filename, argvPtr, envpPtr, cwd, redirectStdin ? 1 : 0, redirectStdout ? 1 : 0, redirectStderr ? 1 :0, out lpChildPid, out stdinFd, out stdoutFd, out stderrFd); diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs b/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs index a2f601eb43..b8a610af19 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs @@ -21,53 +21,101 @@ internal static partial class Interop /// internal enum UnixFileSystemTypes : long { - adfs = 0xadf5, + adfs = 0xADF5, affs = 0xADFF, + afs = 0x5346414F, + anoninode = 0x09041934, + aufs = 0x61756673, + autofs = 0x0187, befs = 0x42465331, + bdevfs = 0x62646576, bfs = 0x1BADFACE, + binfmt_misc = 0x42494E4D, + btrfs = 0x9123683E, + ceph = 0x00C36400, + cgroupfs = 0x0027E0EB, cifs = 0xFF534D42, coda = 0x73757245, coherent = 0x012FF7B7, - cramfs = 0x28cd3d45, + cramfs = 0x28CD3D45, + debugfs = 0x64626720, devfs = 0x1373, + devpts = 0x1CD1, + ecryptfs = 0xF15F, efs = 0x00414A53, ext = 0x137D, ext2_old = 0xEF51, ext2 = 0xEF53, ext3 = 0xEF53, ext4 = 0xEF53, + fat = 0x4006, + fhgfs = 0x19830326, + fuseblk = 0x65735546, + fusectl = 0x65735543, + futexfs = 0x0BAD1DEA, + gfsgfs2 = 0x1161970, + gpfs = 0x47504653, hfs = 0x4244, hpfs = 0xF995E849, - hugetlbfs = 0x958458f6, + hugetlbfs = 0x958458F6, + inodefs = 0x11307854, + inotifyfs = 0x2BAD1DEA, isofs = 0x9660, - jffs2 = 0x72b6, - jfs = 0x3153464a, + // isofs = 0x4004, // R_WIN + // isofs = 0x4000, // WIN + jffs = 0x07C0, + jffs2 = 0x72B6, + jfs = 0x3153464A, + kafs = 0x6B414653, + lustre = 0x0BD00BD0, minix_old = 0x137F, /* orig. minix */ minix = 0x138F, /* 30 char minix */ minix2 = 0x2468, /* minix V2 */ - minix2v2 = 0x2478, /* minix V2, 30 char names */ - msdos = 0x4d44, - ncpfs = 0x564c, + minix2v2 = 0x2478, /* MINIX V2, 30 char names */ + minix3 = 0x4D5A, + mqueue = 0x19800202, + msdos = 0x4D44, nfs = 0x6969, - ntfs = 0x5346544e, - openprom = 0x9fa1, - overlay = 0x794c7630, - overlayfs = 0x794c764f, - proc = 0x9fa0, - qnx4 = 0x002f, + nfsd = 0x6E667364, + nilfs = 0x3434, + novell = 0x564C, + ntfs = 0x5346544E, + openprom = 0x9FA1, + ocfs2 = 0x7461636F, + overlay = 0x794C7630, + overlayfs = 0x794C764F, + panfs = 0xAAD7AAEA, + pipefs = 0x50495045, + proc = 0x9FA0, + pstorefs = 0x6165676C, + qnx4 = 0x002F, + qnx6 = 0x68191122, + ramfs = 0x858458F6, reiserfs = 0x52654973, romfs = 0x7275, + rpc_pipefs = 0x67596969, + securityfs = 0x73636673, + selinux = 0xF97CFF8C, smb = 0x517B, + sockfs = 0x534F434B, + squashfs = 0x73717368, + sysfs = 0x62656572, sysv2 = 0x012FF7B6, sysv4 = 0x012FF7B5, tmpfs = 0x01021994, udf = 0x15013346, ufs = 0x00011954, - usbdevice = 0x9fa2, - vxfs = 0xa501FCF5, + // ufs = 0x54190100, // byteswapped + usbdevice = 0x9FA2, + v9fs = 0x01021997, + vmhgfs = 0xBACBACBC, + vxfs = 0xA501FCF5, + vzfs = 0x565A4653, + xenfs = 0xABBA1974, xenix = 0x012FF7B4, xfs = 0x58465342, - xiafs = 0x012FD16D, + xia = 0x012FD16D, + zfs = 0x2FC12FC1, } [StructLayout(LayoutKind.Sequential)] @@ -130,7 +178,7 @@ internal static partial class Interop /// The recognized drive type. private static DriveType GetDriveType(string fileSystemName) { - // This list is based primarily on "man fs", "man mount", "mntent.h", "/proc/filesystems", + // This list is based primarily on "man fs", "man mount", "mntent.h", "/proc/filesystems", coreutils "stat.c", // and "wiki.debian.org/FileSystem". It can be extended over time as we // find additional file systems that should be recognized as a particular drive type. switch (fileSystemName) @@ -143,91 +191,154 @@ internal static partial class Interop case "umview-mod-umfuseiso9660": return DriveType.CDRom; + case "aafs": case "adfs": case "affs": + case "anoninode": + case "anon-inode FS": case "apfs": + case "autofs": + case "balloon-kvm-fs": + case "bdevfs": case "befs": case "bfs": + case "bpf_fs": case "btrfs": + case "btrfs_test": + case "cgroup2fs": + case "cgroupfs": + case "coh": + case "cramfs": + case "cramfs-wend": + case "daxfs": case "drvfs": case "ecryptfs": + case "efivarfs": case "efs": + case "exofs": case "ext": case "ext2": case "ext2_old": case "ext3": + case "ext2/ext3": case "ext4": case "ext4dev": + case "f2fs": case "fat": - case "fuseblk": case "fuseext2": case "fusefat": + case "futexfs": case "hfs": + case "hfs+": case "hfsplus": + case "hfsx": + case "hostfs": case "hpfs": + case "inodefs": + case "inotifyfs": case "jbd": case "jbd2": - case "jfs": case "jffs": case "jffs2": + case "jfs": + case "logfs": case "lxfs": + case "minix (30 char.)": + case "minix v2 (30 char.)": + case "minix v2": case "minix": case "minix_old": case "minix2": case "minix2v2": + case "minix3": + case "mlfs": case "msdos": + case "nilfs": + case "nsfs": + case "ntfs": case "ocfs2": case "omfs": case "openprom": case "overlay": case "overlayfs": - case "ntfs": + case "pstorefs": case "qnx4": + case "qnx6": case "reiserfs": + case "rpc_pipefs": + case "selinux": + case "smackfs": case "squashfs": case "swap": + case "sysfs": case "sysv": + case "sysv2": + case "sysv4": + case "tracefs": case "ubifs": case "udf": case "ufs": case "umsdos": case "umview-mod-umfuseext2": + case "usbdevfs": + case "v9fs": + case "vzfs": + case "wslfs": + case "xenfs": case "xenix": case "xfs": + case "xia": case "xiafs": case "xmount": + case "zfs": case "zfs-fuse": + case "zsmallocfs": return DriveType.Fixed; case "9p": - case "autofs": + case "acfs": + case "afs": + case "aufs": case "autofs4": case "beaglefs": + case "ceph": case "cifs": case "coda": case "coherent": case "curlftpfs": case "davfs2": case "dlm": + case "fhgfs": case "flickrfs": + case "fuseblk": case "fusedav": case "fusesmb": + case "gfsgfs2": + case "gfs/gfs2": case "gfs2": case "glusterfs-client": case "gmailfs": + case "gpfs": + case "ibrix": + case "k-afs": case "kafs": case "ltspfs": + case "lustre": case "ncpfs": case "nfs": case "nfs4": + case "nfsd": + case "novell": case "obexfs": + case "panfs": + case "prl_fs": case "s3ql": case "smb": + case "smb2": case "smbfs": + case "snfs": case "sshfs": - case "sysfs": - case "sysv2": - case "sysv4": + case "vmhgfs": case "vxfs": case "wikipediafs": return DriveType.Network; @@ -239,7 +350,6 @@ internal static partial class Interop case "binfmt_misc": case "cgroup": case "configfs": - case "cramfs": case "cryptkeeper": case "cpuset": case "debugfs": diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs b/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs index 69e39b30d2..ad8b73aed2 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.PosixFAdvise.cs @@ -16,7 +16,7 @@ internal static partial class Interop POSIX_FADV_SEQUENTIAL = 2, /* sequential I/O access */ POSIX_FADV_WILLNEED = 3, /* will need specified pages */ POSIX_FADV_DONTNEED = 4, /* don't need the specified pages */ - POSIX_FADV_NOREUSE = 5, /* data will only be acessed once */ + POSIX_FADV_NOREUSE = 5, /* data will only be accessed once */ } /// diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs index 0dfde2ae94..4144e9d710 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs @@ -66,13 +66,19 @@ internal static partial class Interop return keySize; } + internal static bool DsaSign(SafeDsaHandle dsa, ReadOnlySpan hash, int hashLength, ReadOnlySpan refSignature, out int outSignatureLength) => + DsaSign(dsa, ref hash.DangerousGetPinnableReference(), hashLength, ref refSignature.DangerousGetPinnableReference(), out outSignatureLength); + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_DsaSign")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool DsaSign(SafeDsaHandle dsa, byte[] hash, int hashLength, byte[] refSignature, out int outSignatureLength); + private static extern bool DsaSign(SafeDsaHandle dsa, ref byte hash, int hashLength, ref byte refSignature, out int outSignatureLength); + + internal static bool DsaVerify(SafeDsaHandle dsa, ReadOnlySpan hash, int hashLength, ReadOnlySpan signature, int signatureLength) => + DsaVerify(dsa, ref hash.DangerousGetPinnableReference(), hashLength, ref signature.DangerousGetPinnableReference(), signatureLength); [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_DsaVerify")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool DsaVerify(SafeDsaHandle dsa, byte[] hash, int hashLength, byte[] signature, int signatureLength); + private static extern bool DsaVerify(SafeDsaHandle dsa, ref byte hash, int hashLength, ref byte signature, int signatureLength); internal static DSAParameters ExportDsaParameters(SafeDsaHandle key, bool includePrivateParameters) { diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.cs index b3e4417026..b2ce394c75 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.cs @@ -19,11 +19,14 @@ internal static partial class Interop [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpDigestReset")] internal extern static int EvpDigestReset(SafeEvpMdCtxHandle ctx, IntPtr type); + internal static int EvpDigestUpdate(SafeEvpMdCtxHandle ctx, ReadOnlySpan d, int cnt) => + EvpDigestUpdate(ctx, ref d.DangerousGetPinnableReference(), cnt); + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpDigestUpdate")] - internal extern static unsafe int EvpDigestUpdate(SafeEvpMdCtxHandle ctx, byte* d, int cnt); + private extern static int EvpDigestUpdate(SafeEvpMdCtxHandle ctx, ref byte d, int cnt); [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpDigestFinalEx")] - internal extern static unsafe int EvpDigestFinalEx(SafeEvpMdCtxHandle ctx, byte* md, ref uint s); + internal extern static int EvpDigestFinalEx(SafeEvpMdCtxHandle ctx, ref byte md, ref uint s); [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpMdSize")] internal extern static int EvpMdSize(IntPtr md); diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs index 20adf88fab..acd32d3cf5 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs @@ -97,7 +97,7 @@ internal static partial class Interop [DllImport(Libraries.CryptoNative)] - private static extern bool CryptoNative_GetECKeyParameters( + private static extern int CryptoNative_GetECKeyParameters( SafeEcKeyHandle key, bool includePrivate, out SafeBignumHandle qx_bn, out int x_cb, @@ -117,12 +117,18 @@ internal static partial class Interop try { key.DangerousAddRef(ref refAdded); // Protect access to d_bn_not_owned - if (!CryptoNative_GetECKeyParameters( + int rc = CryptoNative_GetECKeyParameters( key, includePrivate, out qx_bn, out qx_cb, out qy_bn, out qy_cb, - out d_bn_not_owned, out d_cb)) + out d_bn_not_owned, out d_cb); + + if (rc == -1) + { + throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey); + } + else if (rc != 1) { throw Interop.Crypto.CreateOpenSslCryptographicException(); } @@ -160,7 +166,7 @@ internal static partial class Interop } [DllImport(Libraries.CryptoNative)] - private static extern bool CryptoNative_GetECCurveParameters( + private static extern int CryptoNative_GetECCurveParameters( SafeEcKeyHandle key, bool includePrivate, out ECCurve.ECCurveType curveType, @@ -189,7 +195,7 @@ internal static partial class Interop try { key.DangerousAddRef(ref refAdded); // Protect access to d_bn_not_owned - if (!CryptoNative_GetECCurveParameters( + int rc = CryptoNative_GetECCurveParameters( key, includePrivate, out curveType, @@ -203,7 +209,13 @@ internal static partial class Interop out gy_bn, out gy_cb, out order_bn, out order_cb, out cofactor_bn, out cofactor_cb, - out seed_bn, out seed_cb)) + out seed_bn, out seed_cb); + + if (rc == -1) + { + throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey); + } + else if (rc != 1) { throw Interop.Crypto.CreateOpenSslCryptographicException(); } diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs index 0a82bc3e80..d466797e71 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -9,9 +10,15 @@ internal static partial class Interop { internal static partial class Crypto { + internal static bool EcDsaSign(ReadOnlySpan dgst, int dlen, Span sig, [In, Out] ref int siglen, SafeEcKeyHandle ecKey) => + EcDsaSign(ref dgst.DangerousGetPinnableReference(), dlen, ref sig.DangerousGetPinnableReference(), ref siglen, ecKey); + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EcDsaSign")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool EcDsaSign([In] byte[] dgst, int dlen, [Out] byte[] sig, [In, Out] ref int siglen, SafeEcKeyHandle ecKey); + private static extern bool EcDsaSign(ref byte dgst, int dlen, ref byte sig, [In, Out] ref int siglen, SafeEcKeyHandle ecKey); + + internal static unsafe int EcDsaVerify(ReadOnlySpan dgst, int dgst_len, ReadOnlySpan sigbuf, int sig_len, SafeEcKeyHandle ecKey) => + EcDsaVerify(ref dgst.DangerousGetPinnableReference(), dgst_len, ref sigbuf.DangerousGetPinnableReference(), sig_len, ecKey); /*- * returns @@ -20,7 +27,7 @@ internal static partial class Interop * -1: error */ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EcDsaVerify")] - internal static extern int EcDsaVerify([In] byte[] dgst, int dgst_len, [In] byte[] sigbuf, int sig_len, SafeEcKeyHandle ecKey); + private static extern int EcDsaVerify(ref byte dgst, int dgst_len, ref byte sigbuf, int sig_len, SafeEcKeyHandle ecKey); // returns the maximum length of a DER encoded ECDSA signature created with this key. [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EcDsaSize")] diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs index f57ebfb0a6..bf151fa0ae 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Hmac.cs @@ -11,7 +11,7 @@ internal static partial class Interop internal static partial class Crypto { [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacCreate")] - internal extern static unsafe SafeHmacCtxHandle HmacCreate(byte* key, int keyLen, IntPtr md); + internal extern static SafeHmacCtxHandle HmacCreate(ref byte key, int keyLen, IntPtr md); [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacDestroy")] internal extern static void HmacDestroy(IntPtr ctx); @@ -19,10 +19,13 @@ internal static partial class Interop [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacReset")] internal extern static int HmacReset(SafeHmacCtxHandle ctx); + internal static int HmacUpdate(SafeHmacCtxHandle ctx, ReadOnlySpan data, int len) => + HmacUpdate(ctx, ref data.DangerousGetPinnableReference(), len); + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacUpdate")] - internal extern static unsafe int HmacUpdate(SafeHmacCtxHandle ctx, byte* data, int len); + private extern static int HmacUpdate(SafeHmacCtxHandle ctx, ref byte data, int len); [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HmacFinal")] - internal extern static unsafe int HmacFinal(SafeHmacCtxHandle ctx, byte* data, ref int len); + internal extern static int HmacFinal(SafeHmacCtxHandle ctx, ref byte data, ref int len); } } diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs index 5ac8a42b59..8ecb2c0ced 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Buffers; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -181,29 +182,22 @@ internal static partial class Interop return stateOk; } - internal static int Encrypt(SafeSslHandle context, byte[] input, int offset, int count, ref byte[] output, out Ssl.SslErrorCode errorCode) + internal static int Encrypt(SafeSslHandle context, ReadOnlyMemory input, ref byte[] output, out Ssl.SslErrorCode errorCode) { - Debug.Assert(input != null); - Debug.Assert(offset >= 0); - Debug.Assert(count > 0); - Debug.Assert(offset <= input.Length); - Debug.Assert(input.Length - offset >= count); - errorCode = Ssl.SslErrorCode.SSL_ERROR_NONE; int retVal; unsafe { - fixed (byte* fixedBuffer = input) + using (MemoryHandle handle = input.Retain(pin: true)) { - retVal = Ssl.SslWrite(context, fixedBuffer + offset, count); + retVal = Ssl.SslWrite(context, (byte*)handle.PinnedPointer, input.Length); } } - if (retVal != count) + if (retVal != input.Length) { - Exception innerError; - errorCode = GetSslError(context, retVal, out innerError); + errorCode = GetSslError(context, retVal, out Exception innerError); retVal = 0; switch (errorCode) diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.RAND.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.RAND.cs index d179fd7373..ef5f09e542 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.RAND.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.RAND.cs @@ -9,16 +9,15 @@ internal static partial class Interop { internal static partial class Crypto { - internal static unsafe bool GetRandomBytes(byte* pbBuffer, int count) + internal static bool GetRandomBytes(ref byte pbBuffer, int count) { - Debug.Assert(pbBuffer != null); Debug.Assert(count >= 0); - return CryptoNative_GetRandomBytes(pbBuffer, count); + return CryptoNative_GetRandomBytes(ref pbBuffer, count); } [DllImport(Libraries.CryptoNative)] [return: MarshalAs(UnmanagedType.Bool)] - private static extern unsafe bool CryptoNative_GetRandomBytes(byte* buf, int num); + private static extern bool CryptoNative_GetRandomBytes(ref byte buf, int num); } } diff --git a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Rsa.cs b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Rsa.cs index 8f8829c81f..549727b31d 100644 --- a/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Rsa.cs +++ b/external/corefx/src/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Rsa.cs @@ -25,19 +25,35 @@ internal static partial class Interop [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_DecodeRsaPublicKey")] internal static extern SafeRsaHandle DecodeRsaPublicKey(byte[] buf, int len); - [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaPublicEncrypt")] - internal extern static int RsaPublicEncrypt( + internal static int RsaPublicEncrypt( int flen, - byte[] from, - byte[] to, + ReadOnlySpan from, + Span to, + SafeRsaHandle rsa, + RsaPadding padding) => + RsaPublicEncrypt(flen, ref from.DangerousGetPinnableReference(), ref to.DangerousGetPinnableReference(), rsa, padding); + + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaPublicEncrypt")] + private extern static int RsaPublicEncrypt( + int flen, + ref byte from, + ref byte to, SafeRsaHandle rsa, RsaPadding padding); - [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaPrivateDecrypt")] - internal extern static int RsaPrivateDecrypt( + internal static int RsaPrivateDecrypt( int flen, - byte[] from, - byte[] to, + ReadOnlySpan from, + Span to, + SafeRsaHandle rsa, + RsaPadding padding) => + RsaPrivateDecrypt(flen, ref from.DangerousGetPinnableReference(), ref to.DangerousGetPinnableReference(), rsa, padding); + + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaPrivateDecrypt")] + private extern static int RsaPrivateDecrypt( + int flen, + ref byte from, + ref byte to, SafeRsaHandle rsa, RsaPadding padding); @@ -47,13 +63,19 @@ internal static partial class Interop [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaGenerateKeyEx")] internal static extern int RsaGenerateKeyEx(SafeRsaHandle rsa, int bits, SafeBignumHandle e); + internal static bool RsaSign(int type, ReadOnlySpan m, int m_len, Span sigret, out int siglen, SafeRsaHandle rsa) => + RsaSign(type, ref m.DangerousGetPinnableReference(), m_len, ref sigret.DangerousGetPinnableReference(), out siglen, rsa); + [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaSign")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool RsaSign(int type, byte[] m, int m_len, byte[] sigret, out int siglen, SafeRsaHandle rsa); + private static extern bool RsaSign(int type, ref byte m, int m_len, ref byte sigret, out int siglen, SafeRsaHandle rsa); + + internal static bool RsaVerify(int type, ReadOnlySpan m, int m_len, ReadOnlySpan sigbuf, int siglen, SafeRsaHandle rsa) => + RsaVerify(type, ref m.DangerousGetPinnableReference(), m_len, ref sigbuf.DangerousGetPinnableReference(), siglen, rsa); [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_RsaVerify")] [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool RsaVerify(int type, byte[] m, int m_len, byte[] sigbuf, int siglen, SafeRsaHandle rsa); + private static extern bool RsaVerify(int type, ref byte m, int m_len, ref byte sigbuf, int siglen, SafeRsaHandle rsa); internal static RSAParameters ExportRsaParameters(SafeRsaHandle key, bool includePrivateParameters) { diff --git a/external/corefx/src/Common/src/Interop/Unix/libdl/Interop.dlopen.cs b/external/corefx/src/Common/src/Interop/Unix/libdl/Interop.dlopen.cs new file mode 100644 index 0000000000..4a4c31f035 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Unix/libdl/Interop.dlopen.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Libdl + { + public const int RTLD_NOW = 0x002; + + [DllImport(Libraries.Libdl)] + public static extern IntPtr dlopen(string fileName, int flag); + } +} diff --git a/external/corefx/src/Common/src/Interop/Unix/libdl/Interop.dlsym.cs b/external/corefx/src/Common/src/Interop/Unix/libdl/Interop.dlsym.cs new file mode 100644 index 0000000000..2ea7a98e98 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Unix/libdl/Interop.dlsym.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Libdl + { + [DllImport(Libraries.Libdl)] + public static extern IntPtr dlsym(IntPtr handle, string symbol); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptFinishHash.cs b/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptFinishHash.cs index 3736964b6a..3bf2877685 100644 --- a/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptFinishHash.cs +++ b/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptFinishHash.cs @@ -3,17 +3,17 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics; using System.Runtime.InteropServices; - using Microsoft.Win32.SafeHandles; internal partial class Interop { internal partial class BCrypt { + internal static NTSTATUS BCryptFinishHash(SafeBCryptHashHandle hHash, Span pbOutput, int cbOutput, int dwFlags) => + BCryptFinishHash(hHash, ref pbOutput.DangerousGetPinnableReference(), cbOutput, dwFlags); + [DllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)] - internal static extern NTSTATUS BCryptFinishHash(SafeBCryptHashHandle hHash, [Out] byte[] pbOutput, int cbOutput, int dwFlags); + private static extern NTSTATUS BCryptFinishHash(SafeBCryptHashHandle hHash, ref byte pbOutput, int cbOutput, int dwFlags); } } - diff --git a/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs b/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs index 2431265e41..92bc507fab 100644 --- a/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs +++ b/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs @@ -10,17 +10,15 @@ internal partial class Interop { internal partial class BCrypt { - internal static unsafe NTSTATUS BCryptGenRandom(byte* pbBuffer, int count) + internal static NTSTATUS BCryptGenRandom(ref byte pbBuffer, int count) { - Debug.Assert(pbBuffer != null); Debug.Assert(count >= 0); - - return BCryptGenRandom(IntPtr.Zero, pbBuffer, count, BCRYPT_USE_SYSTEM_PREFERRED_RNG); + return BCryptGenRandom(IntPtr.Zero, ref pbBuffer, count, BCRYPT_USE_SYSTEM_PREFERRED_RNG); } private const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002; [DllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)] - private static extern unsafe NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags); + private static extern NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, ref byte pbBuffer, int cbBuffer, int dwFlags); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptHashData.cs b/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptHashData.cs index f8b0a12af2..1ea3ade6ec 100644 --- a/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptHashData.cs +++ b/external/corefx/src/Common/src/Interop/Windows/BCrypt/Interop.BCryptHashData.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -12,8 +11,10 @@ internal partial class Interop { internal partial class BCrypt { + internal static NTSTATUS BCryptHashData(SafeBCryptHashHandle hHash, ReadOnlySpan pbInput, int cbInput, int dwFlags) => + BCryptHashData(hHash, ref pbInput.DangerousGetPinnableReference(), cbInput, dwFlags); + [DllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe NTSTATUS BCryptHashData(SafeBCryptHashHandle hHash, byte* pbInput, int cbInput, int dwFlags); + private static extern NTSTATUS BCryptHashData(SafeBCryptHashHandle hHash, ref byte pbInput, int cbInput, int dwFlags); } } - diff --git a/external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs b/external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs index 1042440400..ecdb6076e0 100644 --- a/external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs @@ -13,11 +13,13 @@ internal static partial class Interop internal const string HttpApi = "httpapi.dll"; internal const string IpHlpApi = "iphlpapi.dll"; internal const string Kernel32 = "kernel32.dll"; + internal const string KernelBase = "kernelbase.dll"; internal const string Memory_L1_3 = "api-ms-win-core-memory-l1-1-3.dll"; internal const string Mswsock = "mswsock.dll"; internal const string NCrypt = "ncrypt.dll"; internal const string NtDll = "ntdll.dll"; internal const string OleAut32 = "oleaut32.dll"; + internal const string PerfCounter = "perfcounter.dll"; internal const string RoBuffer = "api-ms-win-core-winrt-robuffer-l1-1-0.dll"; internal const string Secur32 = "secur32.dll"; internal const string Shell32 = "shell32.dll"; diff --git a/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.EncryptDecrypt.cs b/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.EncryptDecrypt.cs index 673b392af4..1690876e8b 100644 --- a/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.EncryptDecrypt.cs +++ b/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.EncryptDecrypt.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -9,17 +10,16 @@ internal static partial class Interop { internal static partial class NCrypt { + internal static unsafe ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, ReadOnlySpan pbInput, int cbInput, void* pPaddingInfo, Span pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags) => + NCryptEncrypt(hKey, ref pbInput.DangerousGetPinnableReference(), cbInput, pPaddingInfo, ref pbOutput.DangerousGetPinnableReference(), cbOutput, out pcbResult, dwFlags); [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, [In] byte[] pbInput, int cbInput, void* pPaddingInfo, [Out] byte[] pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); + private static extern unsafe ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, ref byte pbInput, int cbInput, void* pPaddingInfo, ref byte pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); + + internal static unsafe ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, ReadOnlySpan pbInput, int cbInput, void* pPaddingInfo, Span pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags) => + NCryptDecrypt(hKey, ref pbInput.DangerousGetPinnableReference(), cbInput, pPaddingInfo, ref pbOutput.DangerousGetPinnableReference(), cbOutput, out pcbResult, dwFlags); [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, byte* pbInput, int cbInput, void* pPaddingInfo, byte* pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); - - [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, [In] byte[] pbInput, int cbInput, void* pPaddingInfo, [Out] byte[] pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); - - [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, byte* pbInput, int cbInput, void* pPaddingInfo, byte* pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); + private static extern unsafe ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, ref byte pbInput, int cbInput, void* pPaddingInfo, ref byte pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.SignVerify.cs b/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.SignVerify.cs index 8a56d24995..ddbaa508c1 100644 --- a/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.SignVerify.cs +++ b/external/corefx/src/Common/src/Interop/Windows/NCrypt/Interop.SignVerify.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; @@ -9,10 +10,16 @@ internal static partial class Interop { internal static partial class NCrypt { - [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, [In] byte[] pbHashValue, int cbHashValue, [Out] byte[] pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags); + internal static unsafe ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan pbHashValue, int cbHashValue, Span pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags) => + NCryptSignHash(hKey, pPaddingInfo, ref pbHashValue.DangerousGetPinnableReference(), cbHashValue, ref pbSignature.DangerousGetPinnableReference(), cbSignature, out pcbResult, dwFlags); - [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void *pPaddingInfo, [In] byte[] pbHashValue, int cbHashValue, [In] byte[] pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags); + [DllImport(Libraries.NCrypt, CharSet = CharSet.Unicode)] + private static extern unsafe ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ref byte pbHashValue, int cbHashValue, ref byte pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags); + + internal static unsafe ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan pbHashValue, int cbHashValue, ReadOnlySpan pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags) => + NCryptVerifySignature(hKey, pPaddingInfo, ref pbHashValue.DangerousGetPinnableReference(), cbHashValue, ref pbSignature.DangerousGetPinnableReference(), cbSignature, dwFlags); + + [DllImport(Libraries.NCrypt, CharSet = CharSet.Unicode)] + private static extern unsafe ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ref byte pbHashValue, int cbHashValue, ref byte pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.RtlGetVersion.cs b/external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.RtlGetVersion.cs index 1dd6c9e6e0..763a015641 100644 --- a/external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.RtlGetVersion.cs +++ b/external/corefx/src/Common/src/Interop/Windows/NtDll/Interop.RtlGetVersion.cs @@ -10,7 +10,7 @@ internal partial class Interop { internal partial class NtDll { - [DllImport(Libraries.NtDll)] + [DllImport(Libraries.NtDll, ExactSpelling=true)] private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation); internal static string RtlGetVersion() diff --git a/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.IntPtr.cs b/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.IntPtr.cs new file mode 100644 index 0000000000..f3d53c92fc --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.IntPtr.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Net.Security; +using System.Runtime.InteropServices; +using System.Security.Cryptography.X509Certificates; + +namespace System.Net +{ + internal static unsafe partial class UnmanagedCertificateContext + { + internal static X509Certificate2Collection GetRemoteCertificatesFromStoreContext(IntPtr certContext) + { + X509Certificate2Collection result = new X509Certificate2Collection(); + + if (certContext == IntPtr.Zero) + { + return result; + } + + Interop.Crypt32.CERT_CONTEXT context = + Marshal.PtrToStructure(certContext); + + if (context.hCertStore != IntPtr.Zero) + { + Interop.Crypt32.CERT_CONTEXT* last = null; + + while (true) + { + Interop.Crypt32.CERT_CONTEXT* next = + Interop.Crypt32.CertEnumCertificatesInStore(context.hCertStore, last); + + if (next == null) + { + break; + } + + var cert = new X509Certificate2(new IntPtr(next)); + if (NetEventSource.IsEnabled) NetEventSource.Info(certContext, $"Adding remote certificate:{cert}"); + + result.Add(cert); + last = next; + } + } + + return result; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.cs b/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.cs index 66c4a60c5d..73b856ff21 100644 --- a/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.cs +++ b/external/corefx/src/Common/src/Interop/Windows/SChannel/UnmanagedCertificateContext.cs @@ -9,43 +9,16 @@ using System.Security.Cryptography.X509Certificates; namespace System.Net { - internal static unsafe class UnmanagedCertificateContext + internal static unsafe partial class UnmanagedCertificateContext { internal static X509Certificate2Collection GetRemoteCertificatesFromStoreContext(SafeFreeCertContext certContext) { - X509Certificate2Collection result = new X509Certificate2Collection(); - if (certContext.IsInvalid) { - return result; + return new X509Certificate2Collection(); } - Interop.Crypt32.CERT_CONTEXT context = - Marshal.PtrToStructure(certContext.DangerousGetHandle()); - - if (context.hCertStore != IntPtr.Zero) - { - Interop.Crypt32.CERT_CONTEXT* last = null; - - while (true) - { - Interop.Crypt32.CERT_CONTEXT* next = - Interop.Crypt32.CertEnumCertificatesInStore(context.hCertStore, last); - - if (next == null) - { - break; - } - - var cert = new X509Certificate2(new IntPtr(next)); - if (NetEventSource.IsEnabled) NetEventSource.Info(certContext, $"Adding remote certificate:{cert}"); - - result.Add(cert); - last = next; - } - } - - return result; + return GetRemoteCertificatesFromStoreContext(certContext.DangerousGetHandle()); } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ChangeServiceConfig2.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ChangeServiceConfig2.cs new file mode 100644 index 0000000000..9b92147954 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ChangeServiceConfig2.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool ChangeServiceConfig2(IntPtr serviceHandle, uint infoLevel, ref SERVICE_DESCRIPTION serviceDesc); + + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool ChangeServiceConfig2(IntPtr serviceHandle, uint infoLevel, ref SERVICE_DELAYED_AUTOSTART_INFO serviceDesc); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs new file mode 100644 index 0000000000..0c745ebaae --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)] + internal static extern unsafe bool ConvertStringSecurityDescriptorToSecurityDescriptor( + string StringSecurityDescriptor, + int StringSDRevision, + out SafeLocalMemHandle pSecurityDescriptor, + IntPtr SecurityDescriptorSize); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.CreateService.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.CreateService.cs new file mode 100644 index 0000000000..9bb9a73678 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.CreateService.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public extern static IntPtr CreateService(IntPtr databaseHandle, string serviceName, string displayName, int access, int serviceType, + int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies, + string servicesStartName, string password); + + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.DeleteService.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.DeleteService.cs new file mode 100644 index 0000000000..4bd1b9801b --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.DeleteService.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public extern static bool DeleteService(IntPtr serviceHandle); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation.cs index f618f1892c..40da1dacef 100644 --- a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation.cs +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation.cs @@ -25,5 +25,13 @@ internal static partial class Interop SafeLocalAllocHandle TokenInformation, uint TokenInformationLength, out uint ReturnLength); + + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + internal static extern bool GetTokenInformation( + IntPtr TokenHandle, + uint TokenInformationClass, + IntPtr TokenInformation, + uint TokenInformationLength, + out uint ReturnLength); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation_void.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation_void.cs new file mode 100644 index 0000000000..3430c2d2c0 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.GetTokenInformation_void.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Advapi32 + { + [DllImport(Interop.Libraries.Advapi32, SetLastError = true)] + internal unsafe static extern bool GetTokenInformation( + SafeAccessTokenHandle TokenHandle, + TOKEN_INFORMATION_CLASS TokenInformationClass, + void* TokenInformation, + uint TokenInformationLength, + out uint ReturnLength); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegisterServiceCtrlHandler.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegisterServiceCtrlHandler.cs new file mode 100644 index 0000000000..cbf6a99eb9 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegisterServiceCtrlHandler.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public extern static IntPtr RegisterServiceCtrlHandler(string serviceName, Delegate callback); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegisterServiceCtrlHandlerEx.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegisterServiceCtrlHandlerEx.cs new file mode 100644 index 0000000000..f2b494abf3 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RegisterServiceCtrlHandlerEx.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public extern static IntPtr RegisterServiceCtrlHandlerEx(string serviceName, Delegate callback, IntPtr userData); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_DELAYED_AUTOSTART_INFO.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_DELAYED_AUTOSTART_INFO.cs new file mode 100644 index 0000000000..249230d7dd --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_DELAYED_AUTOSTART_INFO.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct SERVICE_DELAYED_AUTOSTART_INFO + { + public bool fDelayedAutostart; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_DESCRIPTION.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_DESCRIPTION.cs new file mode 100644 index 0000000000..53f1bfd4b8 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_DESCRIPTION.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct SERVICE_DESCRIPTION + { + public IntPtr description; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_TABLE_ENTRY.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_TABLE_ENTRY.cs new file mode 100644 index 0000000000..59ab422f87 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SERVICE_TABLE_ENTRY.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [StructLayout(LayoutKind.Sequential)] + public class SERVICE_TABLE_ENTRY + { + public IntPtr name; + public Delegate callback; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceControlDelegates.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceControlDelegates.cs new file mode 100644 index 0000000000..8c4034b9b4 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceControlDelegates.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + public delegate void ServiceMainCallback(int argCount, IntPtr argPointer); + public delegate void ServiceControlCallback(int control); + public delegate int ServiceControlCallbackEx(int control, int eventType, IntPtr eventData, IntPtr eventContext); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceProcessOptions.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceProcessOptions.cs index 20eaa5e77f..5e4a93b38f 100644 --- a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceProcessOptions.cs +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ServiceProcessOptions.cs @@ -2,13 +2,18 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using System.Runtime.InteropServices; + internal partial class Interop { internal partial class Advapi32 { internal partial class AcceptOptions { + internal const int ACCEPT_POWEREVENT = 0x00000040; internal const int ACCEPT_PAUSE_CONTINUE = 0x00000002; + internal const int ACCEPT_SESSIONCHANGE = 0x00000080; internal const int ACCEPT_SHUTDOWN = 0x00000004; internal const int ACCEPT_STOP = 0x00000001; } @@ -16,10 +21,21 @@ internal partial class Interop internal partial class ControlOptions { internal const int CONTROL_CONTINUE = 0x00000003; + internal const int CONTROL_INTERROGATE = 0x00000004; internal const int CONTROL_PAUSE = 0x00000002; + internal const int CONTROL_POWEREVENT = 0x0000000D; + internal const int CONTROL_SESSIONCHANGE = 0x0000000E; + internal const int CONTROL_SHUTDOWN = 0x00000005; internal const int CONTROL_STOP = 0x00000001; } + internal partial class ServiceConfigOptions + { + internal const int SERVICE_CONFIG_DESCRIPTION = 0x00000001; + internal const int SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002; + internal const int SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 0x00000003; + } + internal partial class ServiceOptions { internal const int SERVICE_QUERY_CONFIG = 0x0001; @@ -44,6 +60,7 @@ internal partial class Interop SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL; + internal const int STANDARD_RIGHTS_DELETE = 0x00010000; internal const int STANDARD_RIGHTS_REQUIRED = 0x000F0000; } @@ -70,6 +87,30 @@ internal partial class Interop SERVICE_TYPE_INTERACTIVE_PROCESS; } + internal partial class ServiceAccessOptions + { + internal const int ACCESS_TYPE_CHANGE_CONFIG = 0x0002; + internal const int ACCESS_TYPE_ENUMERATE_DEPENDENTS = 0x0008; + internal const int ACCESS_TYPE_INTERROGATE = 0x0080; + internal const int ACCESS_TYPE_PAUSE_CONTINUE = 0x0040; + internal const int ACCESS_TYPE_QUERY_CONFIG = 0x0001; + internal const int ACCESS_TYPE_QUERY_STATUS = 0x0004; + internal const int ACCESS_TYPE_START = 0x0010; + internal const int ACCESS_TYPE_STOP = 0x0020; + internal const int ACCESS_TYPE_USER_DEFINED_CONTROL = 0x0100; + internal const int ACCESS_TYPE_ALL = + ServiceOptions.STANDARD_RIGHTS_REQUIRED | + ACCESS_TYPE_QUERY_CONFIG | + ACCESS_TYPE_CHANGE_CONFIG | + ACCESS_TYPE_QUERY_STATUS | + ACCESS_TYPE_ENUMERATE_DEPENDENTS | + ACCESS_TYPE_START | + ACCESS_TYPE_STOP | + ACCESS_TYPE_PAUSE_CONTINUE | + ACCESS_TYPE_INTERROGATE | + ACCESS_TYPE_USER_DEFINED_CONTROL; + } + internal partial class ServiceStartModes { internal const int START_TYPE_BOOT = 0x00000000; @@ -104,11 +145,57 @@ internal partial class Interop internal const int STATE_STOP_PENDING = 0x00000003; } + internal partial class ServiceStartErrorModes + { + internal const int ERROR_CONTROL_CRITICAL = 0x00000003; + internal const int ERROR_CONTROL_IGNORE = 0x00000000; + internal const int ERROR_CONTROL_NORMAL = 0x00000001; + internal const int ERROR_CONTROL_SEVERE = 0x00000002; + } + internal partial class ServiceControllerOptions { - internal const int SC_MANAGER_CONNECT = 0x0001; - internal const int SC_MANAGER_ENUMERATE_SERVICE = 0x0004; internal const int SC_ENUM_PROCESS_INFO = 0; + internal const int SC_MANAGER_CONNECT = 0x0001; + internal const int SC_MANAGER_CREATE_SERVICE = 0x0002; + internal const int SC_MANAGER_ENUMERATE_SERVICE = 0x0004; + internal const int SC_MANAGER_LOCK = 0x0008; + internal const int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020; + internal const int SC_MANAGER_QUERY_LOCK_STATUS = 0x0010; + internal const int SC_MANAGER_ALL = + ServiceOptions.STANDARD_RIGHTS_REQUIRED | + SC_MANAGER_CONNECT | + SC_MANAGER_CREATE_SERVICE | + SC_MANAGER_ENUMERATE_SERVICE | + SC_MANAGER_LOCK | + SC_MANAGER_QUERY_LOCK_STATUS | + SC_MANAGER_MODIFY_BOOT_CONFIG; + } + + internal partial class PowerBroadcastStatus + { + internal const int PBT_APMBATTERYLOW = 0x0009; + internal const int PBT_APMOEMEVENT = 0x000B; + internal const int PBT_APMPOWERSTATUSCHANGE = 0x000A; + internal const int PBT_APMQUERYSUSPEND = 0x0000; + internal const int PBT_APMQUERYSUSPENDFAILED = 0x0002; + internal const int PBT_APMRESUMEAUTOMATIC = 0x0012; + internal const int PBT_APMRESUMECRITICAL = 0x0006; + internal const int PBT_APMRESUMESUSPEND = 0x0007; + internal const int PBT_APMSUSPEND = 0x0004; + } + + internal partial class SessionStateChange + { + internal const int WTS_CONSOLE_CONNECT = 0x1; + internal const int WTS_CONSOLE_DISCONNECT = 0x2; + internal const int WTS_REMOTE_CONNECT = 0x3; + internal const int WTS_REMOTE_DISCONNECT = 0x4; + internal const int WTS_SESSION_LOGON = 0x5; + internal const int WTS_SESSION_LOGOFF = 0x6; + internal const int WTS_SESSION_LOCK = 0x7; + internal const int WTS_SESSION_UNLOCK = 0x8; + internal const int WTS_SESSION_REMOTE_CONTROL = 0x9; } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SetServiceStatus.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SetServiceStatus.cs new file mode 100644 index 0000000000..e20f22006f --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.SetServiceStatus.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public unsafe extern static bool SetServiceStatus(IntPtr serviceStatusHandle, SERVICE_STATUS* status); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.StartServiceCtrlDispatcher.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.StartServiceCtrlDispatcher.cs new file mode 100644 index 0000000000..a6773ae5ef --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.StartServiceCtrlDispatcher.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public extern static bool StartServiceCtrlDispatcher(IntPtr entry); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.TOKEN_ELEVATION.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.TOKEN_ELEVATION.cs new file mode 100644 index 0000000000..55b49c9df3 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.TOKEN_ELEVATION.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +internal static partial class Interop +{ + internal static partial class Advapi32 + { + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb530717.aspx + internal struct TOKEN_ELEVATION + { + public BOOL TokenIsElevated; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.TOKEN_INFORMATION_CLASS.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.TOKEN_INFORMATION_CLASS.cs new file mode 100644 index 0000000000..89c36b694a --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.TOKEN_INFORMATION_CLASS.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +internal static partial class Interop +{ + internal static partial class Advapi32 + { + /// + /// TOKEN_INFORMATION_CLASS enumeration. + /// + internal enum TOKEN_INFORMATION_CLASS : uint + { + TokenUser = 1, + TokenGroups, + TokenPrivileges, + TokenOwner, + TokenPrimaryGroup, + TokenDefaultDacl, + TokenSource, + TokenType, + TokenImpersonationLevel, + TokenStatistics, + TokenRestrictedSids, + TokenSessionId, + TokenGroupsAndPrivileges, + TokenSessionReference, + TokenSandBoxInert, + TokenAuditPolicy, + TokenOrigin, + TokenElevationType, + TokenLinkedToken, + TokenElevation, + TokenHasRestrictions, + TokenAccessInformation, + TokenVirtualizationAllowed, + TokenVirtualizationEnabled, + TokenIntegrityLevel, + TokenUIAccess, + TokenMandatoryPolicy, + TokenLogonSid, + TokenIsAppContainer, + TokenCapabilities, + TokenAppContainerSid, + TokenAppContainerNumber, + TokenUserClaimAttributes, + TokenDeviceClaimAttributes, + TokenRestrictedUserClaimAttributes, + TokenRestrictedDeviceClaimAttributes, + TokenDeviceGroups, + TokenRestrictedDeviceGroups, + TokenSecurityAttributes, + TokenIsRestricted, + MaxTokenInfoClass + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.WTSSESSION_NOTIFICATION.cs b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.WTSSESSION_NOTIFICATION.cs new file mode 100644 index 0000000000..86503af47a --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.WTSSESSION_NOTIFICATION.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Advapi32 + { + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public class WTSSESSION_NOTIFICATION + { + public int size; + public int sessionId; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.COPYFILE2_EXTENDED_PARAMETERS.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.COPYFILE2_EXTENDED_PARAMETERS.cs new file mode 100644 index 0000000000..041deef6be --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.COPYFILE2_EXTENDED_PARAMETERS.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + [StructLayout(LayoutKind.Sequential)] + internal struct COPYFILE2_EXTENDED_PARAMETERS + { + internal uint dwSize; + internal uint dwCopyFlags; + internal IntPtr pfCancel; + internal IntPtr pProgressRoutine; + internal IntPtr pvCallbackContext; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs new file mode 100644 index 0000000000..e89fbff9dd --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal struct CREATEFILE2_EXTENDED_PARAMETERS + { + internal uint dwSize; + internal uint dwFileAttributes; + internal uint dwFileFlags; + internal uint dwSecurityQosFlags; + internal IntPtr lpSecurityAttributes; + internal IntPtr hTemplateFile; + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CopyFile2.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CopyFile2.cs index 26914d9bf1..9c03b4283c 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CopyFile2.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CopyFile2.cs @@ -11,14 +11,5 @@ internal partial class Interop { [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)] internal static extern int CopyFile2(string pwszExistingFileName, string pwszNewFileName, ref COPYFILE2_EXTENDED_PARAMETERS pExtendedParameters); - - internal struct COPYFILE2_EXTENDED_PARAMETERS - { - internal uint dwSize; - internal uint dwCopyFlags; - internal IntPtr pfCancel; - internal IntPtr pProgressRoutine; - internal IntPtr pvCallbackContext; - } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs index 631bd5589c..cc0585cf1e 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs @@ -14,7 +14,7 @@ internal partial class Interop /// /// WARNING: The private methods do not implicitly handle long paths. Use CreateFile. /// - [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] + [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] private static extern SafeFileHandle CreateFilePrivate( string lpFileName, int dwDesiredAccess, diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile2.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile2.cs index 8f3a5a2e3a..7650364dd8 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile2.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile2.cs @@ -17,15 +17,5 @@ internal partial class Interop System.IO.FileShare dwShareMode, System.IO.FileMode dwCreationDisposition, [In] ref CREATEFILE2_EXTENDED_PARAMETERS parameters); - - internal struct CREATEFILE2_EXTENDED_PARAMETERS - { - internal uint dwSize; - internal uint dwFileAttributes; - internal uint dwFileFlags; - internal uint dwSecurityQosFlags; - internal IntPtr lpSecurityAttributes; - internal IntPtr hTemplateFile; - } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateNamedPipeClient.Uap.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateNamedPipeClient.Uap.cs new file mode 100644 index 0000000000..e5890ce0b8 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateNamedPipeClient.Uap.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System; +using System.IO; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + [DllImport(Libraries.Kernel32, EntryPoint = "CreateFile2", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] + private static extern SafePipeHandle CreateNamedPipeClientPrivate( + string lpFileName, + int dwDesiredAccess, + System.IO.FileShare dwShareMode, + System.IO.FileMode dwCreationDisposition, + [In] ref CREATEFILE2_EXTENDED_PARAMETERS parameters); + + internal static unsafe SafePipeHandle CreateNamedPipeClient( + string lpFileName, + int dwDesiredAccess, + System.IO.FileShare dwShareMode, + ref SECURITY_ATTRIBUTES secAttrs, + FileMode dwCreationDisposition, + int dwFlagsAndAttributes, + IntPtr hTemplateFile) + { + Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS parameters; + parameters.dwSize = (uint)Marshal.SizeOf(); + + // The dwFlagsAndAttributes is carrying a combination of flags that are mapped to different fields of the extended + // parameters. The possible range of values for dwFileAttributes, dwSecurityQosFlags, and dwFileFlags cannot be fully + // covered coming from a single int but are enough for correction creation of the named pipe client. The SECURITY_VALID_SQOS_FLAGS + // needs to be all available for proper impersonation. + const uint SECURITY_VALID_SQOS_FLAGS = 0x001F0000; + + parameters.dwFileAttributes = (uint)dwFlagsAndAttributes & 0x0000FFFF; + parameters.dwSecurityQosFlags = (uint)dwFlagsAndAttributes & SECURITY_VALID_SQOS_FLAGS; + parameters.dwFileFlags = (uint)dwFlagsAndAttributes & 0xFFF00000; + + parameters.hTemplateFile = hTemplateFile; + fixed (Interop.Kernel32.SECURITY_ATTRIBUTES* lpSecurityAttributes = &secAttrs) + { + parameters.lpSecurityAttributes = (IntPtr)lpSecurityAttributes; + return CreateNamedPipeClientPrivate(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, ref parameters); + } + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FILE_TIME.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FILE_TIME.cs new file mode 100644 index 0000000000..02cdef199f --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FILE_TIME.cs @@ -0,0 +1,31 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System; +using System.IO; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal struct FILE_TIME + { + internal uint dwLowDateTime; + internal uint dwHighDateTime; + + internal FILE_TIME(long fileTime) + { + dwLowDateTime = (uint)fileTime; + dwHighDateTime = (uint)(fileTime >> 32); + } + + internal long ToTicks() + { + return ((long)dwHighDateTime << 32) + dwLowDateTime; + } + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_INFO_LEVELS.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_INFO_LEVELS.cs new file mode 100644 index 0000000000..c317ef9967 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_INFO_LEVELS.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal enum FINDEX_INFO_LEVELS : uint + { + FindExInfoStandard = 0x0u, + FindExInfoBasic = 0x1u, + FindExInfoMaxInfoLevel = 0x2u, + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_SEARCH_OPS.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_SEARCH_OPS.cs new file mode 100644 index 0000000000..1756bedb0a --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FINDEX_SEARCH_OPS.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal enum FINDEX_SEARCH_OPS : uint + { + FindExSearchNameMatch = 0x0u, + FindExSearchLimitToDirectories = 0x1u, + FindExSearchLimitToDevices = 0x2u, + FindExSearchMaxSearchOp = 0x3u, + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FindFirstFileEx.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FindFirstFileEx.cs index 27e9040f21..2d1ecefd98 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FindFirstFileEx.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FindFirstFileEx.cs @@ -24,20 +24,5 @@ internal partial class Interop // use FindExInfoBasic since we don't care about short name and it has better perf return FindFirstFileExPrivate(fileName, FINDEX_INFO_LEVELS.FindExInfoBasic, ref data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0); } - - internal enum FINDEX_INFO_LEVELS : uint - { - FindExInfoStandard = 0x0u, - FindExInfoBasic = 0x1u, - FindExInfoMaxInfoLevel = 0x2u, - } - - internal enum FINDEX_SEARCH_OPS : uint - { - FindExSearchNameMatch = 0x0u, - FindExSearchLimitToDirectories = 0x1u, - FindExSearchLimitToDevices = 0x2u, - FindExSearchMaxSearchOp = 0x3u, - } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FlushViewOfFile.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FlushViewOfFile.cs index c6ba2496be..053d7e824f 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FlushViewOfFile.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FlushViewOfFile.cs @@ -9,7 +9,7 @@ internal partial class Interop { internal partial class Kernel32 { - [DllImport(Libraries.Kernel32)] - internal extern static int FlushViewOfFile(IntPtr lpBaseAddress, UIntPtr dwNumberOfBytesToFlush); + [DllImport(Libraries.Kernel32, SetLastError = true)] + internal extern static bool FlushViewOfFile(IntPtr lpBaseAddress, UIntPtr dwNumberOfBytesToFlush); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage.cs index 2f63a76545..8de0bc0627 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage.cs @@ -14,9 +14,11 @@ internal partial class Interop private const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800; private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000; - - + private const int ERROR_INSUFFICIENT_BUFFER = 0x7A; + private const int InitialBufferSize = 256; + private const int BufferSizeIncreaseFactor = 4; + private const int MaxAllowedBufferSize = 65 * 1024; [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "FormatMessageW", SetLastError = true, BestFitMapping = true)] private static extern int FormatMessage( @@ -105,8 +107,5 @@ internal partial class Interop // // As a result we use the following approach. // We initially call the API with a buffer size of 256 and then gradually increase the size in case of failure until we reach the maximum allowed limit of 65K. - private const int InitialBufferSize = 256; - private const int BufferSizeIncreaseFactor = 4; - private const int MaxAllowedBufferSize = 65 * 1024; } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage_SafeLibraryHandle.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage_SafeLibraryHandle.cs new file mode 100644 index 0000000000..be3293ca1c --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage_SafeLibraryHandle.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Text; +using Microsoft.Win32.SafeHandles; + +internal partial class Interop +{ + internal partial class Kernel32 + { + public const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200; + public const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800; + public const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; + public const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000; + public const int ERROR_INSUFFICIENT_BUFFER = 0x7A; + + [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = true)] + public static unsafe extern int FormatMessage( + int dwFlags, + SafeLibraryHandle lpSource, + uint dwMessageId, + int dwLanguageId, + StringBuilder lpBuffer, + int nSize, + IntPtr[] arguments); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs new file mode 100644 index 0000000000..76e43f64af --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal enum GET_FILEEX_INFO_LEVELS : uint + { + GetFileExInfoStandard = 0x0u, + GetFileExMaxInfoLevel = 0x1u, + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetComputerName.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetComputerName.cs index fd003f4e46..e0f8857bda 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetComputerName.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetComputerName.cs @@ -9,18 +9,19 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameW")] - private extern static int GetComputerName(char[] lpBuffer, ref uint nSize); + private static extern unsafe int GetComputerName(char* lpBuffer, ref uint nSize); - private const int MacMachineNameLength = 256; + // maximum length of the NETBIOS name (not including NULL) + private const int MAX_COMPUTERNAME_LENGTH = 15; - internal static string GetComputerName() + internal static unsafe string GetComputerName() { - char[] buffer = new char[MacMachineNameLength]; - uint length = (uint)buffer.Length; + uint length = MAX_COMPUTERNAME_LENGTH + 1; + char* buffer = stackalloc char[(int)length]; - Interop.Kernel32.GetComputerName(buffer, ref length); - return new string(buffer, 0, (int)length); + return GetComputerName(buffer, ref length) != 0 ? + new string(buffer, 0, checked((int)length)) : + null; } - } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetFileAttributesEx.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetFileAttributesEx.cs index 958c98c851..1bd3bed103 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetFileAttributesEx.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetFileAttributesEx.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Win32.SafeHandles; -using System; using System.IO; using System.Runtime.InteropServices; @@ -22,73 +20,5 @@ internal partial class Interop name = PathInternal.EnsureExtendedPrefixOverMaxPath(name); return GetFileAttributesExPrivate(name, fileInfoLevel, ref lpFileInformation); } - - internal enum GET_FILEEX_INFO_LEVELS : uint - { - GetFileExInfoStandard = 0x0u, - GetFileExMaxInfoLevel = 0x1u, - } - - internal struct WIN32_FILE_ATTRIBUTE_DATA - { - internal int fileAttributes; - internal uint ftCreationTimeLow; - internal uint ftCreationTimeHigh; - internal uint ftLastAccessTimeLow; - internal uint ftLastAccessTimeHigh; - internal uint ftLastWriteTimeLow; - internal uint ftLastWriteTimeHigh; - internal uint fileSizeHigh; - internal uint fileSizeLow; - - internal void PopulateFrom(ref WIN32_FIND_DATA findData) - { - // Copy the information to data - fileAttributes = (int)findData.dwFileAttributes; - ftCreationTimeLow = findData.ftCreationTime.dwLowDateTime; - ftCreationTimeHigh = findData.ftCreationTime.dwHighDateTime; - ftLastAccessTimeLow = findData.ftLastAccessTime.dwLowDateTime; - ftLastAccessTimeHigh = findData.ftLastAccessTime.dwHighDateTime; - ftLastWriteTimeLow = findData.ftLastWriteTime.dwLowDateTime; - ftLastWriteTimeHigh = findData.ftLastWriteTime.dwHighDateTime; - fileSizeHigh = findData.nFileSizeHigh; - fileSizeLow = findData.nFileSizeLow; - } - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - [BestFitMapping(false)] - internal unsafe struct WIN32_FIND_DATA - { - internal uint dwFileAttributes; - internal FILE_TIME ftCreationTime; - internal FILE_TIME ftLastAccessTime; - internal FILE_TIME ftLastWriteTime; - internal uint nFileSizeHigh; - internal uint nFileSizeLow; - internal uint dwReserved0; - internal uint dwReserved1; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - internal string cFileName; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] - internal string cAlternateFileName; - } - - internal struct FILE_TIME - { - internal uint dwLowDateTime; - internal uint dwHighDateTime; - - internal FILE_TIME(long fileTime) - { - dwLowDateTime = (uint)fileTime; - dwHighDateTime = (uint)(fileTime >> 32); - } - - internal long ToTicks() - { - return ((long)dwHighDateTime << 32) + dwLowDateTime; - } - } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetProcAddress.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetProcAddress.cs index fd3e8d9f84..4178eba4e7 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetProcAddress.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetProcAddress.cs @@ -13,5 +13,8 @@ internal partial class Interop { [DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false)] public static extern IntPtr GetProcAddress(SafeLibraryHandle hModule, string lpProcName); + + [DllImport(Libraries.Kernel32, CharSet = CharSet.Ansi, BestFitMapping = false)] + public static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetSystemDirectoryW.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetSystemDirectoryW.cs index d33c58c8f1..25c59d743b 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetSystemDirectoryW.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetSystemDirectoryW.cs @@ -2,14 +2,22 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Runtime.InteropServices; -using System.Text; internal static partial class Interop { internal static partial class Kernel32 { [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern int GetSystemDirectoryW([Out] StringBuilder lpBuffer, int jSize); + private static extern unsafe int GetSystemDirectoryW(char* lpBuffer, int uSize); + + internal static unsafe int GetSystemDirectoryW(Span buffer) + { + fixed (char* bufferPtr = &buffer.DangerousGetPinnableReference()) + { + return GetSystemDirectoryW(bufferPtr, buffer.Length); + } + } } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibrary.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibrary.cs new file mode 100644 index 0000000000..fcaf78cd5d --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibrary.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern IntPtr LoadLibrary(string libFilename); + } +} + diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibraryEx.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibraryEx.cs index 6a69e151cc..4ba2fd65a4 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibraryEx.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LoadLibraryEx.cs @@ -11,6 +11,8 @@ internal partial class Interop { internal partial class Kernel32 { + public const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002; + [DllImport(Libraries.Kernel32, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)] public static extern SafeLibraryHandle LoadLibraryExW([In] string lpwLibFileName, [In] IntPtr hFile, [In] uint dwFlags); } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LookupAccountSid.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LookupAccountSid.cs new file mode 100644 index 0000000000..b866a3ae27 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.LookupAccountSid.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +internal partial class Interop +{ + internal partial class Kernel32 + { + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public extern static int LookupAccountSid( + string systemName, + byte[] pSid, + StringBuilder szUserName, + ref int userNameSize, + StringBuilder szDomainName, + ref int domainNameSize, + ref int eUse); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.PerformanceCounterOptions.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.PerformanceCounterOptions.cs new file mode 100644 index 0000000000..aaf4c281a1 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.PerformanceCounterOptions.cs @@ -0,0 +1,387 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal partial class PerformanceCounterOptions + { + internal const int SDDL_REVISION_1 = 1; + + public const int PERF_NO_INSTANCES = -1; // no instances (see NumInstances above) + + public const int PERF_SIZE_DWORD = 0x00000000; + public const int PERF_SIZE_LARGE = 0x00000100; + public const int PERF_SIZE_ZERO = 0x00000200; // for Zero Length fields + public const int PERF_SIZE_VARIABLE_LEN = 0x00000300; // length is In CounterLength field + + public const int PERF_NO_UNIQUE_ID = -1; + + // + // select one of the following values to indicate the counter field usage + // + public const int PERF_TYPE_NUMBER = 0x00000000; // a number (not a counter) + public const int PERF_TYPE_COUNTER = 0x00000400; // an increasing numeric value + public const int PERF_TYPE_TEXT = 0x00000800; // a text field + public const int PERF_TYPE_ZERO = 0x00000C00; // displays a zero + + // + // If the PERF_TYPE_NUMBER field was selected, then select one of the + // following to describe the Number + // + public const int PERF_NUMBER_HEX = 0x00000000; // display as HEX value + public const int PERF_NUMBER_DECIMAL = 0x00010000; // display as a decimal integer + public const int PERF_NUMBER_DEC_1000 = 0x00020000; // display as a decimal/1000 + + // + // If the PERF_TYPE_COUNTER value was selected then select one of the + // following to indicate the type of counter + // + public const int PERF_COUNTER_VALUE = 0x00000000; // display counter value + public const int PERF_COUNTER_RATE = 0x00010000; // divide ctr / delta time + public const int PERF_COUNTER_FRACTION = 0x00020000; // divide ctr / base + public const int PERF_COUNTER_BASE = 0x00030000; // base value used In fractions + public const int PERF_COUNTER_ELAPSED = 0x00040000; // subtract counter from current time + public const int PERF_COUNTER_QUEUELEN = 0x00050000; // Use Queuelen processing func. + public const int PERF_COUNTER_HISTOGRAM = 0x00060000; // Counter begins or ends a histogram + public const int PERF_COUNTER_PRECISION = 0x00070000; // divide ctr / private clock + + // + // If the PERF_TYPE_TEXT value was selected, then select one of the + // following to indicate the type of TEXT data. + // + public const int PERF_TEXT_UNICODE = 0x00000000; // type of text In text field + public const int PERF_TEXT_ASCII = 0x00010000; // ASCII using the CodePage field + + // + // Timer SubTypes + // + public const int PERF_TIMER_TICK = 0x00000000; // use system perf. freq for base + public const int PERF_TIMER_100NS = 0x00100000; // use 100 NS timer time base units + public const int PERF_OBJECT_TIMER = 0x00200000; // use the object timer freq + + // + // Any types that have calculations performed can use one or more of + // the following calculation modification flags listed here + // + public const int PERF_DELTA_COUNTER = 0x00400000; // compute difference first + public const int PERF_DELTA_BASE = 0x00800000; // compute base diff as well + public const int PERF_INVERSE_COUNTER = 0x01000000; // show as 1.00-value (assumes: + public const int PERF_MULTI_COUNTER = 0x02000000; // sum of multiple instances + + // + // Select one of the following values to indicate the display suffix (if any) + // + public const int PERF_DISPLAY_NO_SUFFIX = 0x00000000; // no suffix + public const int PERF_DISPLAY_PER_SEC = 0x10000000; // "/sec" + public const int PERF_DISPLAY_PERCENT = 0x20000000; // "%" + public const int PERF_DISPLAY_SECONDS = 0x30000000; // "secs" + public const int PERF_DISPLAY_NOSHOW = 0x40000000; // value is not displayed + + // + // Predefined counter types + // + + // 32-bit Counter. Divide delta by delta time. Display suffix: "/sec" + public const int PERF_COUNTER_COUNTER = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PER_SEC); + + + // 64-bit Timer. Divide delta by delta time. Display suffix: "%" + public const int PERF_COUNTER_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + + // Queue Length Space-Time Product. Divide delta by delta time. No Display Suffix. + public const int PERF_COUNTER_QUEUELEN_TYPE = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_QUEUELEN | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + // Queue Length Space-Time Product. Divide delta by delta time. No Display Suffix. + public const int PERF_COUNTER_LARGE_QUEUELEN_TYPE = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_QUEUELEN | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + // Queue Length Space-Time Product using 100 Ns timebase. + // Divide delta by delta time. No Display Suffix. + public const int PERF_COUNTER_100NS_QUEUELEN_TYPE = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_QUEUELEN | + PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + // Queue Length Space-Time Product using Object specific timebase. + // Divide delta by delta time. No Display Suffix. + public const int PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_QUEUELEN | + PERF_OBJECT_TIMER | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + // 64-bit Counter. Divide delta by delta time. Display Suffix: "/sec" + public const int PERF_COUNTER_BULK_COUNT = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PER_SEC); + + // Indicates the counter is not a counter but rather Unicode text Display as text. + public const int PERF_COUNTER_TEXT = + (PERF_SIZE_VARIABLE_LEN | PERF_TYPE_TEXT | PERF_TEXT_UNICODE | + PERF_DISPLAY_NO_SUFFIX); + + // Indicates the data is a counter which should not be + // time averaged on display (such as an error counter on a serial line) + // Display as is. No Display Suffix. + public const int PERF_COUNTER_RAWCOUNT = + (PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | + PERF_DISPLAY_NO_SUFFIX); + + // Same as PERF_COUNTER_RAWCOUNT except its size is a large integer + public const int PERF_COUNTER_LARGE_RAWCOUNT = + (PERF_SIZE_LARGE | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | + PERF_DISPLAY_NO_SUFFIX); + + // Special case for RAWCOUNT that want to be displayed In hex + // Indicates the data is a counter which should not be + // time averaged on display (such as an error counter on a serial line) + // Display as is. No Display Suffix. + public const int PERF_COUNTER_RAWCOUNT_HEX = + (PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_HEX | + PERF_DISPLAY_NO_SUFFIX); + + // Same as PERF_COUNTER_RAWCOUNT_HEX except its size is a large integer + public const int PERF_COUNTER_LARGE_RAWCOUNT_HEX = + (PERF_SIZE_LARGE | PERF_TYPE_NUMBER | PERF_NUMBER_HEX | + PERF_DISPLAY_NO_SUFFIX); + + // A count which is either 1 or 0 on each sampling interrupt (% busy) + // Divide delta by delta base. Display Suffix: "%" + public const int PERF_SAMPLE_FRACTION = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | + PERF_DELTA_COUNTER | PERF_DELTA_BASE | PERF_DISPLAY_PERCENT); + + // A count which is sampled on each sampling interrupt (queue length) + // Divide delta by delta time. No Display Suffix. + public const int PERF_SAMPLE_COUNTER = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + // A label: no data is associated with this counter (it has 0 length) + // Do not display. + public const int PERF_COUNTER_NODATA = + (PERF_SIZE_ZERO | PERF_DISPLAY_NOSHOW); + + // 64-bit Timer inverse (e.g., idle is measured, but display busy %) + // Display 100 - delta divided by delta time. Display suffix: "%" + public const int PERF_COUNTER_TIMER_INV = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_INVERSE_COUNTER | + PERF_DISPLAY_PERCENT); + + // The divisor for a sample, used with the previous counter to form a + // sampled %. You must check for >0 before dividing by this! This + // counter will directly follow the numerator counter. It should not + // be displayed to the user. + public const int PERF_SAMPLE_BASE = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | + PERF_DISPLAY_NOSHOW | + 0x00000001); // for compatibility with pre-beta versions + + // A timer which, when divided by an average base, produces a time + // In seconds which is the average time of some operation. This + // timer times total operations, and the base is the number of opera- + // tions. Display Suffix: "sec" + public const int PERF_AVERAGE_TIMER = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | + PERF_DISPLAY_SECONDS); + + // Used as the denominator In the computation of time or count + // averages. Must directly follow the numerator counter. Not dis- + // played to the user. + public const int PERF_AVERAGE_BASE = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | + PERF_DISPLAY_NOSHOW | + 0x00000002); // for compatibility with pre-beta versions + + + // 64-bit Timer in object specific units. Display delta divided by + // delta time as returned in the object type header structure. Display suffix: "%" + public const int PERF_OBJ_TIME_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_OBJECT_TIMER | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + + // A bulk count which, when divided (typically) by the number of + // operations, gives (typically) the number of bytes per operation. + // No Display Suffix. + public const int PERF_AVERAGE_BULK = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | + PERF_DISPLAY_NOSHOW); + + // 64-bit Timer in object specific units. Display delta divided by + // delta time as returned in the object type header structure. Display suffix: "%" + public const int PERF_OBJ_TIME_TIME = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_OBJECT_TIMER | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + + // 64-bit Timer In 100 nsec units. Display delta divided by + // delta time. Display suffix: "%" + public const int PERF_100NSEC_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + + // 64-bit Timer inverse (e.g., idle is measured, but display busy %) + // Display 100 - delta divided by delta time. Display suffix: "%" + public const int PERF_100NSEC_TIMER_INV = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_INVERSE_COUNTER | + PERF_DISPLAY_PERCENT); + + // 64-bit Timer. Divide delta by delta time. Display suffix: "%" + // Timer for multiple instances, so result can exceed 100%. + public const int PERF_COUNTER_MULTI_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_DELTA_COUNTER | PERF_TIMER_TICK | PERF_MULTI_COUNTER | + PERF_DISPLAY_PERCENT); + + // 64-bit Timer inverse (e.g., idle is measured, but display busy %) + // Display 100 * _MULTI_BASE - delta divided by delta time. + // Display suffix: "%" Timer for multiple instances, so result + // can exceed 100%. Followed by a counter of type _MULTI_BASE. + public const int PERF_COUNTER_MULTI_TIMER_INV = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | + PERF_DELTA_COUNTER | PERF_MULTI_COUNTER | PERF_TIMER_TICK | + PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT); + + // Number of instances to which the preceding _MULTI_..._INV counter + // applies. Used as a factor to get the percentage. + public const int PERF_COUNTER_MULTI_BASE = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | + PERF_MULTI_COUNTER | PERF_DISPLAY_NOSHOW); + + // 64-bit Timer In 100 nsec units. Display delta divided by delta time. + // Display suffix: "%" Timer for multiple instances, so result can exceed 100%. + public const int PERF_100NSEC_MULTI_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_DELTA_COUNTER | + PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_MULTI_COUNTER | + PERF_DISPLAY_PERCENT); + + // 64-bit Timer inverse (e.g., idle is measured, but display busy %) + // Display 100 * _MULTI_BASE - delta divided by delta time. + // Display suffix: "%" Timer for multiple instances, so result + // can exceed 100%. Followed by a counter of type _MULTI_BASE. + public const int PERF_100NSEC_MULTI_TIMER_INV = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_DELTA_COUNTER | + PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_MULTI_COUNTER | + PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT); + + // Indicates the data is a fraction of the following counter which + // should not be time averaged on display (such as free space over + // total space.) Display as is. Display the quotient as "%". + public const int PERF_RAW_FRACTION = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | + PERF_DISPLAY_PERCENT); + + public const int PERF_LARGE_RAW_FRACTION = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | + PERF_DISPLAY_PERCENT); + + // Indicates the data is a base for the preceding counter which should + // not be time averaged on display (such as free space over total space.) + public const int PERF_RAW_BASE = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | + PERF_DISPLAY_NOSHOW | + 0x00000003); // for compatibility with pre-beta versions + + public const int PERF_LARGE_RAW_BASE = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | + PERF_DISPLAY_NOSHOW); + + // The data collected In this counter is actually the start time of the + // item being measured. For display, this data is subtracted from the + // sample time to yield the elapsed time as the difference between the two. + // In the definition below, the PerfTime field of the Object contains + // the sample time as indicated by the PERF_OBJECT_TIMER bit and the + // difference is scaled by the PerfFreq of the Object to convert the time + // units into seconds. + public const int PERF_ELAPSED_TIME = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED | + PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS); + + // + // The following counter type can be used with the preceding types to + // define a range of values to be displayed In a histogram. + // + + // + // This counter is used to display the difference from one sample + // to the next. The counter value is a constantly increasing number + // and the value displayed is the difference between the current + // value and the previous value. Negative numbers are not allowed + // which shouldn't be a problem as long as the counter value is + // increasing or unchanged. + // + public const int PERF_COUNTER_DELTA = + (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_VALUE | + PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + public const int PERF_COUNTER_LARGE_DELTA = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_VALUE | + PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX); + + // The timer used has the same frequency as the System Performance Timer + public const int PERF_PRECISION_SYSTEM_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_PRECISION | + PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + + // + // The timer used has the same frequency as the 100 NanoSecond Timer + public const int PERF_PRECISION_100NS_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_PRECISION | + PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + // + // The timer used is of the frequency specified in the Object header's + // PerfFreq field (PerfTime is ignored) + public const int PERF_PRECISION_OBJECT_TIMER = + (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_PRECISION | + PERF_OBJECT_TIMER | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT); + + public const uint PDH_FMT_DOUBLE = 0x00000200; + public const uint PDH_FMT_NOSCALE = 0x00001000; + public const uint PDH_FMT_NOCAP100 = 0x00008000; + + + + [StructLayout(LayoutKind.Sequential)] + public class PDH_RAW_COUNTER + { + public int CStatus = 0; + public long TimeStamp = 0; + public long FirstValue = 0; + public long SecondValue = 0; + public int MultiCount = 0; + } + + [StructLayout(LayoutKind.Sequential)] + public class PDH_FMT_COUNTERVALUE + { + public int CStatus = 0; + public double data = 0; + } + + public const int PDH_NO_DATA = unchecked((int)0x800007D5); + public const int PDH_CALC_NEGATIVE_DENOMINATOR = unchecked((int)0x800007D6); + public const int PDH_CALC_NEGATIVE_VALUE = unchecked((int)0x800007D8); + + // + // The following are used to determine the level of detail associated + // with the counter. The user will be setting the level of detail + // that should be displayed at any given time. + // + public const int PERF_DETAIL_NOVICE = 100; // The uninformed can understand it + public const int PERF_DETAIL_ADVANCED = 200; // For the advanced user + public const int PERF_DETAIL_EXPERT = 300; // For the expert user + public const int PERF_DETAIL_WIZARD = 400; // For the system designer + } + } +} + diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ProcessWaitHandle.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ProcessWaitHandle.cs new file mode 100644 index 0000000000..8fab26c279 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ProcessWaitHandle.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System.Runtime.InteropServices; +using System.Threading; + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal sealed class ProcessWaitHandle : WaitHandle + { + internal ProcessWaitHandle(SafeProcessHandle processHandle) + { + SafeWaitHandle waitHandle = null; + SafeProcessHandle currentProcHandle = Interop.Kernel32.GetCurrentProcess(); + bool succeeded = Interop.Kernel32.DuplicateHandle( + currentProcHandle, + processHandle, + currentProcHandle, + out waitHandle, + 0, + false, + Interop.Kernel32.HandleOptions.DUPLICATE_SAME_ACCESS); + + if (!succeeded) + { + Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); + } + + this.SetSafeWaitHandle(waitHandle); + } + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReplaceFile.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReplaceFile.cs index c1fafe6771..8c9dee4da7 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReplaceFile.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReplaceFile.cs @@ -21,17 +21,13 @@ internal partial class Interop { replacedFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(replacedFileName); replacementFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(replacementFileName); - if (backupFileName != null) - { - backupFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(backupFileName); - } + backupFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(backupFileName); return ReplaceFilePrivate( replacedFileName, replacementFileName, backupFileName, dwReplaceFlags, lpExclude, lpReserved); } - internal const int REPLACEFILE_WRITE_THROUGH = 0x1; internal const int REPLACEFILE_IGNORE_MERGE_ERRORS = 0x2; } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.UnmapViewOfFile.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.UnmapViewOfFile.cs index 8895ac80e6..2a1879fa30 100644 --- a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.UnmapViewOfFile.cs +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.UnmapViewOfFile.cs @@ -9,7 +9,7 @@ internal partial class Interop { internal partial class Kernel32 { - [DllImport(Libraries.Kernel32)] - internal extern static int UnmapViewOfFile(IntPtr lpBaseAddress); + [DllImport(Libraries.Kernel32, SetLastError = true)] + internal extern static bool UnmapViewOfFile(IntPtr lpBaseAddress); } } diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs new file mode 100644 index 0000000000..8e09555477 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +internal partial class Interop +{ + internal partial class Kernel32 + { + internal struct WIN32_FILE_ATTRIBUTE_DATA + { + internal int fileAttributes; + internal uint ftCreationTimeLow; + internal uint ftCreationTimeHigh; + internal uint ftLastAccessTimeLow; + internal uint ftLastAccessTimeHigh; + internal uint ftLastWriteTimeLow; + internal uint ftLastWriteTimeHigh; + internal uint fileSizeHigh; + internal uint fileSizeLow; + + internal void PopulateFrom(ref WIN32_FIND_DATA findData) + { + // Copy the information to data + fileAttributes = (int)findData.dwFileAttributes; + ftCreationTimeLow = findData.ftCreationTime.dwLowDateTime; + ftCreationTimeHigh = findData.ftCreationTime.dwHighDateTime; + ftLastAccessTimeLow = findData.ftLastAccessTime.dwLowDateTime; + ftLastAccessTimeHigh = findData.ftLastAccessTime.dwHighDateTime; + ftLastWriteTimeLow = findData.ftLastWriteTime.dwLowDateTime; + ftLastWriteTimeHigh = findData.ftLastWriteTime.dwHighDateTime; + fileSizeHigh = findData.nFileSizeHigh; + fileSizeLow = findData.nFileSizeLow; + } + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FIND_DATA.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FIND_DATA.cs new file mode 100644 index 0000000000..c8d319d766 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WIN32_FIND_DATA.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal unsafe struct WIN32_FIND_DATA + { + internal uint dwFileAttributes; + internal FILE_TIME ftCreationTime; + internal FILE_TIME ftLastAccessTime; + internal FILE_TIME ftLastWriteTime; + internal uint nFileSizeHigh; + internal uint nFileSizeLow; + internal uint dwReserved0; + internal uint dwReserved1; + private fixed char _cFileName[MAX_PATH]; + private fixed char _cAlternateFileName[14]; + + internal ReadOnlySpan cFileName + { + get { fixed (char* c = _cFileName) return new ReadOnlySpan(c, MAX_PATH); } + } + } + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WaitForSingleObject.cs b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WaitForSingleObject.cs new file mode 100644 index 0000000000..ce5268cb9c --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WaitForSingleObject.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using Microsoft.Win32.SafeHandles; + +internal partial class Interop +{ + internal partial class Kernel32 + { + [DllImport(Libraries.Kernel32, ExactSpelling=true, SetLastError=true)] + internal static extern int WaitForSingleObject(SafeWaitHandle handle, int timeout); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/kernelbase/Interop.OpenCommPort.cs b/external/corefx/src/Common/src/Interop/Windows/kernelbase/Interop.OpenCommPort.cs new file mode 100644 index 0000000000..e1bbbc2388 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/kernelbase/Interop.OpenCommPort.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System; +using System.IO; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class KernelBase + { + [DllImport(Libraries.KernelBase, SetLastError = true)] + internal static extern SafeFileHandle OpenCommPort( + uint uPortNumber, + int dwDesiredAccess, + int dwFlagsAndAttributes); + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/perfcounter/Interop.FormatFromRawValue.cs b/external/corefx/src/Common/src/Interop/Windows/perfcounter/Interop.FormatFromRawValue.cs new file mode 100644 index 0000000000..eb52202ab3 --- /dev/null +++ b/external/corefx/src/Common/src/Interop/Windows/perfcounter/Interop.FormatFromRawValue.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class PerfCounter + { +#pragma warning disable BCL0015 // Invalid Pinvoke call + [DllImport(Libraries.PerfCounter, CharSet = CharSet.Unicode)] + public static unsafe extern int FormatFromRawValue( + uint dwCounterType, + uint dwFormat, + ref long pTimeBase, + Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue1, + Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER pRawValue2, + Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pFmtValue + ); +#pragma warning restore BCL0015 + } +} diff --git a/external/corefx/src/Common/src/Interop/Windows/shell32/Interop.SHGetKnownFolderPath.cs b/external/corefx/src/Common/src/Interop/Windows/shell32/Interop.SHGetKnownFolderPath.cs index beb95d7b54..1090805c0e 100644 --- a/external/corefx/src/Common/src/Interop/Windows/shell32/Interop.SHGetKnownFolderPath.cs +++ b/external/corefx/src/Common/src/Interop/Windows/shell32/Interop.SHGetKnownFolderPath.cs @@ -76,7 +76,7 @@ internal partial class Interop internal const string ComputerFolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"; /// - /// (CSIDL_CONNECTIONS) Network Conections virtual folder + /// (CSIDL_CONNECTIONS) Network Connections virtual folder /// internal const string ConnectionsFolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"; @@ -317,4 +317,4 @@ internal partial class Interop internal const string Windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"; } } -} \ No newline at end of file +} diff --git a/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs index 475f70e4f9..6e37ed68af 100644 --- a/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs +++ b/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs @@ -8,11 +8,11 @@ namespace Microsoft.Win32.SafeHandles { internal sealed class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid { - private SafeLibraryHandle() : base(true) + internal SafeLibraryHandle() : base(true) { } - private SafeLibraryHandle(bool ownsHandle) : base(ownsHandle) + internal SafeLibraryHandle(bool ownsHandle) : base(ownsHandle) { } diff --git a/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLocalMemHandle.cs b/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLocalMemHandle.cs new file mode 100644 index 0000000000..3b0bad0307 --- /dev/null +++ b/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeLocalMemHandle.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Microsoft.Win32.SafeHandles +{ + internal sealed class SafeLocalMemHandle : SafeHandleZeroOrMinusOneIsInvalid + { + internal SafeLocalMemHandle() : base(true) { } + + internal SafeLocalMemHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) + { + SetHandle(existingHandle); + } + + protected override bool ReleaseHandle() + { + return Interop.Kernel32.LocalFree(handle) == IntPtr.Zero; + } + } +} \ No newline at end of file diff --git a/external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs b/external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs index fd17c34b10..a3337032e8 100644 --- a/external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs +++ b/external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs @@ -42,6 +42,20 @@ namespace System.Collections.Generic /// internal int Column { get; } + /// + /// If this position is at the end of the current buffer, returns the position + /// at the start of the next buffer. Otherwise, returns this position. + /// + /// The length of the current buffer. + public CopyPosition Normalize(int endColumn) + { + Debug.Assert(Column <= endColumn); + + return Column == endColumn ? + new CopyPosition(Row + 1, 0) : + this; + } + /// /// Gets a string suitable for display in the debugger. /// @@ -197,9 +211,10 @@ namespace System.Collections.Generic /// The position in this builder that was copied up to. public CopyPosition CopyTo(CopyPosition position, T[] array, int arrayIndex, int count) { + Debug.Assert(array != null); Debug.Assert(arrayIndex >= 0); - Debug.Assert(count >= 0 && count <= Count); - Debug.Assert(array?.Length - arrayIndex >= count); + Debug.Assert(count > 0 && count <= Count); + Debug.Assert(array.Length - arrayIndex >= count); // Go through each buffer, which contains one 'row' of items. // The index in each buffer is referred to as the 'column'. @@ -216,27 +231,56 @@ namespace System.Collections.Generic int row = position.Row; int column = position.Column; - for (; count > 0; row++, column = 0) + T[] buffer = GetBuffer(row); + int copied = +#if __MonoCS__ + CopyToCore(buffer, column, array, arrayIndex, count); +#else + CopyToCore(buffer, column); +#endif + + if (count == 0) { - T[] buffer = GetBuffer(index: row); - - // During this iteration, copy until we satisfy `count` or reach the - // end of the current buffer. - int copyCount = Math.Min(buffer.Length, count); - - if (copyCount > 0) - { - Array.Copy(buffer, column, array, arrayIndex, copyCount); - - arrayIndex += copyCount; - count -= copyCount; - column += copyCount; - } + return new CopyPosition(row, column + copied).Normalize(buffer.Length); } - return new CopyPosition(row: row, column: column); + do + { + buffer = GetBuffer(++row); + copied = +#if __MonoCS__ + CopyToCore(buffer, column, array, arrayIndex, count); +#else + CopyToCore(buffer, column); +#endif + } while (count > 0); + + return new CopyPosition(row, copied).Normalize(buffer.Length); + +#if __MonoCS__ } + static int CopyToCore(T[] sourceBuffer, int sourceIndex, T[] array, int arrayIndex, int count) +#else + int CopyToCore(T[] sourceBuffer, int sourceIndex) +#endif + { + Debug.Assert(sourceBuffer.Length > sourceIndex); + + // Copy until we satisfy `count` or reach the end of the current buffer. + int copyCount = Math.Min(sourceBuffer.Length - sourceIndex, count); + Array.Copy(sourceBuffer, sourceIndex, array, arrayIndex, copyCount); + + arrayIndex += copyCount; + count -= copyCount; + + return copyCount; + } + +#if !__MonoCS__ + } +#endif + /// /// Retrieves the buffer at the specified index. /// diff --git a/external/corefx/src/Common/src/System/Collections/Generic/SparseArrayBuilder.cs b/external/corefx/src/Common/src/System/Collections/Generic/SparseArrayBuilder.cs index 57eeeb90b6..4829a9ce46 100644 --- a/external/corefx/src/Common/src/System/Collections/Generic/SparseArrayBuilder.cs +++ b/external/corefx/src/Common/src/System/Collections/Generic/SparseArrayBuilder.cs @@ -113,9 +113,10 @@ namespace System.Collections.Generic /// The number of items to copy. public void CopyTo(T[] array, int arrayIndex, int count) { + Debug.Assert(array != null); Debug.Assert(arrayIndex >= 0); Debug.Assert(count >= 0 && count <= Count); - Debug.Assert(array?.Length - arrayIndex >= count); + Debug.Assert(array.Length - arrayIndex >= count); int copied = 0; var position = CopyPosition.Start; @@ -149,8 +150,11 @@ namespace System.Collections.Generic count -= reservedCount; } - // Finish copying after the final marker. - _builder.CopyTo(position, array, arrayIndex, count); + if (count > 0) + { + // Finish copying after the final marker. + _builder.CopyTo(position, array, arrayIndex, count); + } } /// diff --git a/external/corefx/src/Common/src/System/Data/Common/AdapterUtil.cs b/external/corefx/src/Common/src/System/Data/Common/AdapterUtil.cs index 2da62fd3e7..575e22f25d 100644 --- a/external/corefx/src/Common/src/System/Data/Common/AdapterUtil.cs +++ b/external/corefx/src/Common/src/System/Data/Common/AdapterUtil.cs @@ -130,6 +130,61 @@ namespace System.Data.Common return e; } + // the return value is true if the string was quoted and false if it was not + // this allows the caller to determine if it is an error or not for the quotedString to not be quoted + internal static bool RemoveStringQuotes(string quotePrefix, string quoteSuffix, string quotedString, out string unquotedString) + { + int prefixLength = quotePrefix != null ? quotePrefix.Length : 0; + int suffixLength = quoteSuffix != null ? quoteSuffix.Length : 0; + + if ((suffixLength + prefixLength) == 0) + { + unquotedString = quotedString; + return true; + } + + if (quotedString == null) + { + unquotedString = quotedString; + return false; + } + + int quotedStringLength = quotedString.Length; + + // is the source string too short to be quoted + if (quotedStringLength < prefixLength + suffixLength) + { + unquotedString = quotedString; + return false; + } + + // is the prefix present? + if (prefixLength > 0) + { + if (!quotedString.StartsWith(quotePrefix, StringComparison.Ordinal)) + { + unquotedString = quotedString; + return false; + } + } + + // is the suffix present? + if (suffixLength > 0) + { + if (!quotedString.EndsWith(quoteSuffix, StringComparison.Ordinal)) + { + unquotedString = quotedString; + return false; + } + unquotedString = quotedString.Substring(prefixLength, quotedStringLength - (prefixLength + suffixLength)).Replace(quoteSuffix + quoteSuffix, quoteSuffix); + } + else + { + unquotedString = quotedString.Substring(prefixLength, quotedStringLength - prefixLength); + } + return true; + } + internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, string value, string method) { return ArgumentOutOfRange(SR.Format(SR.ADP_NotSupportedEnumerationValue, type.Name, value, method), type.Name); diff --git a/external/corefx/src/Common/src/System/Data/Common/MultipartIdentifier.cs b/external/corefx/src/Common/src/System/Data/Common/MultipartIdentifier.cs index 7722345d89..4bf59ad4ab 100644 --- a/external/corefx/src/Common/src/System/Data/Common/MultipartIdentifier.cs +++ b/external/corefx/src/Common/src/System/Data/Common/MultipartIdentifier.cs @@ -208,7 +208,7 @@ namespace System.Data.Common case MPIState.MPI_RightQuote: { if (testchar == rightQuoteChar) - { // If the next char is a another right quote then we were escaping the right quote + { // If the next char is another right quote then we were escaping the right quote sb.Append(testchar); state = MPIState.MPI_ParseQuote; } diff --git a/external/corefx/src/Common/src/System/Data/Common/NameValuePair.cs b/external/corefx/src/Common/src/System/Data/Common/NameValuePair.cs index f0b3a99b4f..0d9d569e50 100644 --- a/external/corefx/src/Common/src/System/Data/Common/NameValuePair.cs +++ b/external/corefx/src/Common/src/System/Data/Common/NameValuePair.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Runtime.Serialization; namespace System.Data.Common { @@ -12,7 +11,6 @@ namespace System.Data.Common { readonly private string _name; readonly private string _value; - [OptionalField(VersionAdded = 2)] readonly private int _length; private NameValuePair _next; @@ -28,10 +26,6 @@ namespace System.Data.Common { get { - // this property won't exist when deserialized from Everett to Whidbey - // it shouldn't matter for DbConnectionString - // which should only use Length during construction - // not deserialization or post-ctor runtime Debug.Assert(0 < _length, "NameValuePair zero Length usage"); return _length; } diff --git a/external/corefx/src/Common/src/System/Drawing/ColorTable.cs b/external/corefx/src/Common/src/System/Drawing/ColorTable.cs index 04e69025fd..69e9b8dfbc 100644 --- a/external/corefx/src/Common/src/System/Drawing/ColorTable.cs +++ b/external/corefx/src/Common/src/System/Drawing/ColorTable.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Reflection; namespace System.Drawing @@ -23,17 +24,13 @@ namespace System.Drawing private static void FillConstants(Dictionary colors, Type enumType) { const MethodAttributes attrs = MethodAttributes.Public | MethodAttributes.Static; - PropertyInfo[] props = enumType.GetProperties(); - - foreach (PropertyInfo prop in props) + foreach (PropertyInfo prop in enumType.GetProperties()) { if (prop.PropertyType == typeof(Color)) { - MethodInfo method = prop.GetGetMethod(); - if (method != null && (method.Attributes & attrs) == attrs) - { - colors[prop.Name] = (Color)prop.GetValue(null, null); - } + Debug.Assert(prop.GetGetMethod() != null); + Debug.Assert((prop.GetGetMethod().Attributes & attrs) == attrs); + colors[prop.Name] = (Color)prop.GetValue(null, null); } } } diff --git a/external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp20.cs b/external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp20.cs new file mode 100644 index 0000000000..259c9ae52f --- /dev/null +++ b/external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp20.cs @@ -0,0 +1,98 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Reflection; + +namespace System.Drawing +{ + // System.Drawing.Common uses several members on System.Drawing.Common which are implemented in .NET Core 2.0, but + // not exposed. This is a helper class which allows System.Drawing.Common to access those members through reflection. + internal static class ColorUtil + { + private const short StateKnownColorValid = 0x0001; + private const short StateNameValid = 0x0008; + private const long NotDefinedValue = 0; + + private static readonly ConstructorInfo s_ctorKnownColor; // internal Color(KnownColor knownColor) + private static readonly ConstructorInfo s_ctorAllValues; // private Color(long value, short state, string name, KnownColor knownColor) + private static readonly FieldInfo s_fieldKnownColor; // private readonly short knownColor + private static readonly FieldInfo s_fieldState; // private readonly short state + + static ColorUtil() + { + Type colorType = typeof(Color); + Type knownColorType = colorType.Assembly.GetType("System.Drawing.KnownColor", true); + Debug.Assert(knownColorType != null); + const BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance; + s_ctorKnownColor = colorType.GetConstructor(bindingFlags, null, new Type[] { knownColorType }, null); + Debug.Assert(s_ctorKnownColor != null); + + s_ctorAllValues = colorType.GetConstructor(bindingFlags, null, new Type[] { typeof(long), typeof(short), typeof(string), knownColorType }, null); + Debug.Assert(s_ctorAllValues != null); + + s_fieldKnownColor = colorType.GetField("knownColor", bindingFlags); + Debug.Assert(s_fieldKnownColor != null); + + s_fieldState = colorType.GetField("state", bindingFlags); + Debug.Assert(s_fieldState != null); + } + + public static Color FromKnownColor(KnownColor color) + { + var value = (int)color; + if (value < (int)KnownColor.ActiveBorder || value > (int)KnownColor.MenuHighlight) + { + return FromName(color.ToString()); + } + + return (Color)s_ctorKnownColor.Invoke(new object[] { value }); + } + + public static Color FromName(string name) + { + // try to get a known color first + Color color; + if (ColorTable.TryGetNamedColor(name, out color)) + { + return color; + } + // otherwise treat it as a named color + return (Color)s_ctorAllValues.Invoke(new object[] { NotDefinedValue, StateNameValid, name, 0 }); + } + + public static bool IsSystemColor(this Color color) + { + short knownColor = GetKnownColor(color); + return GetIsKnownColor(color) && ((((KnownColor)knownColor) <= KnownColor.WindowText) || (((KnownColor)knownColor) > KnownColor.YellowGreen)); + } + + public static short GetKnownColor(this Color color) + { + return (short)s_fieldKnownColor.GetValue(color); + } + + public static short GetState(this Color color) + { + return (short)s_fieldState.GetValue(color); + } + + public static bool GetIsSystemColor(this Color color) + { + short knownColor = color.GetKnownColor(); + return GetIsKnownColor(color) && ((((KnownColor)knownColor) <= KnownColor.WindowText) || (((KnownColor)knownColor) > KnownColor.YellowGreen)); + } + + public static bool GetIsKnownColor(this Color color) + { + short state = GetState(color); + return ((state & StateKnownColorValid) != 0); + } + + public static KnownColor ToKnownColor(this Color c) + { + return (KnownColor)GetKnownColor(c); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp21.cs b/external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp21.cs new file mode 100644 index 0000000000..e65f14c839 --- /dev/null +++ b/external/corefx/src/Common/src/System/Drawing/ColorUtil.netcoreapp21.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Reflection; + +namespace System.Drawing +{ + internal static class ColorUtil + { + public static Color FromKnownColor(KnownColor color) => Color.FromKnownColor(color); + public static bool IsSystemColor(this Color color) => color.IsSystemColor; + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs b/external/corefx/src/Common/src/System/Drawing/KnownColor.cs similarity index 99% rename from external/corefx/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs rename to external/corefx/src/Common/src/System/Drawing/KnownColor.cs index dbd287dd06..01497e7933 100644 --- a/external/corefx/src/System.Drawing.Primitives/src/System/Drawing/KnownColor.cs +++ b/external/corefx/src/Common/src/System/Drawing/KnownColor.cs @@ -15,9 +15,7 @@ namespace System.Drawing // Do not modify this enum without updating KnownColorTable. // - // 0 - reserved for "not a known color" - FirstColor = 0, // "System" colors /// /// @@ -893,7 +891,6 @@ namespace System.Drawing /// /// [To be supplied.] /// - MenuHighlight, - LastColor = MenuHighlight, + MenuHighlight } } \ No newline at end of file diff --git a/external/corefx/src/Common/src/System/Drawing/KnownColorTable.cs b/external/corefx/src/Common/src/System/Drawing/KnownColorTable.cs index 7b3ee71410..6681be42aa 100644 --- a/external/corefx/src/Common/src/System/Drawing/KnownColorTable.cs +++ b/external/corefx/src/Common/src/System/Drawing/KnownColorTable.cs @@ -2,12 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; + namespace System.Drawing { -#if FEATURE_SYSTEM_EVENTS - using System.Drawing.Internal; -#endif - static internal class KnownColorTable { private static int[] s_colorTable; @@ -33,8 +31,8 @@ namespace System.Drawing int argb = s_colorTable[index]; if (argb == targetARGB) { - Color color = Color.FromKnownColor((KnownColor)index); - if (!color.IsSystemColor) + Color color = ColorUtil.FromKnownColor((KnownColor)index); + if (!ColorUtil.IsSystemColor(color)) return color; } } @@ -55,10 +53,6 @@ namespace System.Drawing private static void InitColorTable() { int[] values = new int[(unchecked((int)KnownColor.MenuHighlight)) + 1]; - -#if FEATURE_SYSTEM_EVENTS - SystemEvents.UserPreferenceChanging += new UserPreferenceChangingEventHandler(OnUserPreferenceChanging); -#endif UpdateSystemColors(values); // just consts... @@ -403,28 +397,16 @@ namespace System.Drawing public static int KnownColorToArgb(KnownColor color) { + Debug.Assert(color > 0 && color <= KnownColor.MenuHighlight); EnsureColorTable(); - if (color <= KnownColor.MenuHighlight) - { - return s_colorTable[unchecked((int)color)]; - } - else - { - return 0; - } + return s_colorTable[unchecked((int)color)]; } public static string KnownColorToName(KnownColor color) { + Debug.Assert(color > 0 && color <= KnownColor.MenuHighlight); EnsureColorNameTable(); - if (color <= KnownColor.MenuHighlight) - { - return s_colorNameTable[unchecked((int)color)]; - } - else - { - return null; - } + return s_colorNameTable[unchecked((int)color)]; } #if FEATURE_WINDOWS_SYSTEM_COLORS @@ -447,16 +429,6 @@ namespace System.Drawing } #endif -#if FEATURE_SYSTEM_EVENTS - private static void OnUserPreferenceChanging(object sender, UserPreferenceChangingEventArgs e) - { - if (e.Category == UserPreferenceCategory.Color && colorTable != null) - { - UpdateSystemColors(colorTable); - } - } -#endif - private static void UpdateSystemColors(int[] colorTable) { #if FEATURE_WINDOWS_SYSTEM_COLORS diff --git a/external/corefx/src/Common/src/System/Globalization/FormatProvider.Number.cs b/external/corefx/src/Common/src/System/Globalization/FormatProvider.Number.cs index 969d4793ab..ccd74e3a65 100644 --- a/external/corefx/src/Common/src/System/Globalization/FormatProvider.Number.cs +++ b/external/corefx/src/Common/src/System/Globalization/FormatProvider.Number.cs @@ -542,7 +542,7 @@ namespace System.Globalization return false; } - private static bool TrailingZeros(string s, int index) + private static bool TrailingZeros(ReadOnlySpan s, int index) { // For compatibility, we need to allow trailing zeros at the end of a number string for (int i = index; i < s.Length; i++) @@ -555,15 +555,11 @@ namespace System.Globalization return true; } - internal static unsafe bool TryStringToNumber(string str, NumberStyles options, ref NumberBuffer number, StringBuilder sb, NumberFormatInfo numfmt, bool parseDecimal) + internal static unsafe bool TryStringToNumber(ReadOnlySpan str, NumberStyles options, ref NumberBuffer number, StringBuilder sb, NumberFormatInfo numfmt, bool parseDecimal) { - if (str == null) - { - return false; - } Debug.Assert(numfmt != null); - fixed (char* stringPointer = str) + fixed (char* stringPointer = &str.DangerousGetPinnableReference()) { char* p = stringPointer; if (!ParseNumber(ref p, options, ref number, sb, numfmt, parseDecimal) diff --git a/external/corefx/src/Common/src/System/IO/DelegatingStream.cs b/external/corefx/src/Common/src/System/IO/DelegatingStream.cs index 31dd400cd5..fb514e9b78 100644 --- a/external/corefx/src/Common/src/System/IO/DelegatingStream.cs +++ b/external/corefx/src/Common/src/System/IO/DelegatingStream.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Diagnostics; using System.IO; using System.Threading; @@ -94,6 +93,11 @@ namespace System.Net.Http return _innerStream.Read(buffer, offset, count); } + public override int Read(Span destination) + { + return _innerStream.Read(destination); + } + public override int ReadByte() { return _innerStream.ReadByte(); @@ -104,6 +108,11 @@ namespace System.Net.Http return _innerStream.ReadAsync(buffer, offset, count, cancellationToken); } + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) + { + return _innerStream.ReadAsync(destination, cancellationToken); + } + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { return _innerStream.BeginRead(buffer, offset, count, callback, state); @@ -138,6 +147,11 @@ namespace System.Net.Http _innerStream.Write(buffer, offset, count); } + public override void Write(ReadOnlySpan source) + { + _innerStream.Write(source); + } + public override void WriteByte(byte value) { _innerStream.WriteByte(value); @@ -148,6 +162,11 @@ namespace System.Net.Http return _innerStream.WriteAsync(buffer, offset, count, cancellationToken); } + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + return _innerStream.WriteAsync(source, cancellationToken); + } + public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { return _innerStream.BeginWrite(buffer, offset, count, callback, state); diff --git a/external/corefx/src/Common/src/System/IO/ReadOnlyMemoryStream.cs b/external/corefx/src/Common/src/System/IO/ReadOnlyMemoryStream.cs new file mode 100644 index 0000000000..9c240b8e56 --- /dev/null +++ b/external/corefx/src/Common/src/System/IO/ReadOnlyMemoryStream.cs @@ -0,0 +1,155 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; + +namespace System.IO +{ + /// Provides a for the contents of a . + internal sealed class ReadOnlyMemoryStream : Stream + { + private readonly ReadOnlyMemory _content; + private int _position; + + public ReadOnlyMemoryStream(ReadOnlyMemory content) + { + _content = content; + } + + public override bool CanRead => true; + public override bool CanSeek => true; + public override bool CanWrite => false; + + public override long Length => _content.Length; + + public override long Position + { + get => _position; + set + { + if (value < 0 || value > int.MaxValue) + { + throw new ArgumentOutOfRangeException(nameof(value)); + } + _position = (int)value; + } + } + + public override long Seek(long offset, SeekOrigin origin) + { + long pos = + origin == SeekOrigin.Begin ? offset : + origin == SeekOrigin.Current ? _position + offset : + origin == SeekOrigin.End ? _content.Length + offset : + throw new ArgumentOutOfRangeException(nameof(origin)); + + if (pos > int.MaxValue) + { + throw new ArgumentOutOfRangeException(nameof(offset)); + } + else if (pos < 0) + { + throw new IOException(SR.IO_SeekBeforeBegin); + } + + _position = (int)pos; + return _position; + } + + public override int ReadByte() + { + ReadOnlySpan s = _content.Span; + return _position < s.Length ? s[_position++] : -1; + } + + public override int Read(byte[] buffer, int offset, int count) + { + ValidateReadArrayArguments(buffer, offset, count); + return Read(new Span(buffer, offset, count)); + } + + public override int Read(Span destination) + { + int remaining = _content.Length - _position; + + if (remaining <= 0 || destination.Length == 0) + { + return 0; + } + else if (remaining <= destination.Length) + { + _content.Span.Slice(_position).CopyTo(destination); + _position = _content.Length; + return remaining; + } + else + { + _content.Span.Slice(_position, destination.Length).CopyTo(destination); + _position += destination.Length; + return destination.Length; + } + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateReadArrayArguments(buffer, offset, count); + return cancellationToken.IsCancellationRequested ? + Task.FromCanceled(cancellationToken) : + Task.FromResult(Read(new Span(buffer, offset, count))); + } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) => + cancellationToken.IsCancellationRequested ? + new ValueTask(Task.FromCanceled(cancellationToken)) : + new ValueTask(Read(destination.Span)); + + public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) => + TaskToApm.Begin(ReadAsync(buffer, offset, count), callback, state); + + public override int EndRead(IAsyncResult asyncResult) => + TaskToApm.End(asyncResult); + + public override void CopyTo(Stream destination, int bufferSize) + { + StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize); + if (_content.Length > _position) + { + destination.Write(_content.Span.Slice(_position)); + } + } + + public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize); + return _content.Length > _position ? + destination.WriteAsync(_content.Slice(_position), cancellationToken) : + Task.CompletedTask; + } + + public override void Flush() { } + + public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask; + + public override void SetLength(long value) => throw new NotSupportedException(); + + public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); + + private static void ValidateReadArrayArguments(byte[] buffer, int offset, int count) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + if (offset < 0) + { + throw new ArgumentOutOfRangeException(nameof(offset)); + } + if (count < 0 || buffer.Length - offset < count) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + } + } +} diff --git a/external/corefx/src/Common/src/System/IO/TempFileCollection.cs b/external/corefx/src/Common/src/System/IO/TempFileCollection.cs index 9f08f69d96..1a5d2ac035 100644 --- a/external/corefx/src/Common/src/System/IO/TempFileCollection.cs +++ b/external/corefx/src/Common/src/System/IO/TempFileCollection.cs @@ -15,6 +15,10 @@ namespace System.IO.Internal // Explicitly not [Serializable], so as to avoid accidentally deleting // files specified in a serialized payload. +#if MONO + [Serializable] +#endif + #if CODEDOM public #else diff --git a/external/corefx/src/Common/src/System/Marvin.cs b/external/corefx/src/Common/src/System/Marvin.cs new file mode 100644 index 0000000000..fde7d2be57 --- /dev/null +++ b/external/corefx/src/Common/src/System/Marvin.cs @@ -0,0 +1,139 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Security.Cryptography; + +namespace System +{ + internal static class Marvin + { + /// + /// Convenience method to compute a Marvin hash and collapse it into a 32-bit hash. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static int ComputeHash32(ref byte data, int count, ulong seed) + { + long hash64 = ComputeHash(ref data, count, seed); + return ((int)(hash64 >> 32)) ^ (int)hash64; + } + + /// + /// Computes a 64-hash using the Marvin algorithm. + /// + public static long ComputeHash(ref byte data, int count, ulong seed) + { + uint ucount = (uint)count; + uint p0 = (uint)seed; + uint p1 = (uint)(seed >> 32); + + int byteOffset = 0; // declared as signed int so we don't have to cast everywhere (it's passed to Unsafe.Add() and used for nothing else.) + + while (ucount >= 8) + { + p0 += Unsafe.As(ref Unsafe.Add(ref data, byteOffset)); + Block(ref p0, ref p1); + + p0 += Unsafe.As(ref Unsafe.Add(ref data, byteOffset + 4)); + Block(ref p0, ref p1); + + byteOffset += 8; + ucount -= 8; + } + + switch (ucount) + { + case 4: + p0 += Unsafe.As(ref Unsafe.Add(ref data, byteOffset)); + Block(ref p0, ref p1); + goto case 0; + + case 0: + p0 += 0x80u; + break; + + case 5: + p0 += Unsafe.As(ref Unsafe.Add(ref data, byteOffset)); + byteOffset += 4; + Block(ref p0, ref p1); + goto case 1; + + case 1: + p0 += 0x8000u | Unsafe.Add(ref data, byteOffset); + break; + + case 6: + p0 += Unsafe.As(ref Unsafe.Add(ref data, byteOffset)); + byteOffset += 4; + Block(ref p0, ref p1); + goto case 2; + + case 2: + p0 += 0x800000u | Unsafe.As(ref Unsafe.Add(ref data, byteOffset)); + break; + + case 7: + p0 += Unsafe.As(ref Unsafe.Add(ref data, byteOffset)); + byteOffset += 4; + Block(ref p0, ref p1); + goto case 3; + + case 3: + p0 += 0x80000000u | (((uint)(Unsafe.Add(ref data, byteOffset + 2))) << 16)| (uint)(Unsafe.As(ref Unsafe.Add(ref data, byteOffset))); + break; + + default: + Debug.Fail("Should not get here."); + break; + } + + Block(ref p0, ref p1); + Block(ref p0, ref p1); + + return (((long)p1) << 32) | p0; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static void Block(ref uint rp0, ref uint rp1) + { + uint p0 = rp0; + uint p1 = rp1; + + p1 ^= p0; + p0 = _rotl(p0, 20); + + p0 += p1; + p1 = _rotl(p1, 9); + + p1 ^= p0; + p0 = _rotl(p0, 27); + + p0 += p1; + p1 = _rotl(p1, 19); + + rp0 = p0; + rp1 = p1; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint _rotl(uint value, int shift) + { + // This is expected to be optimized into a single rol (or ror with negated shift value) instruction + return (value << shift) | (value >> (32 - shift)); + } + + public static ulong DefaultSeed { get; } = GenerateSeed(); + + private static ulong GenerateSeed() + { + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + var bytes = new byte[sizeof(ulong)]; + rng.GetBytes(bytes); + return BitConverter.ToUInt64(bytes, 0); + } + } + } +} diff --git a/external/corefx/src/Common/src/System/Memory/FixedBufferExtensions.cs b/external/corefx/src/Common/src/System/Memory/FixedBufferExtensions.cs new file mode 100644 index 0000000000..08cb16fe1f --- /dev/null +++ b/external/corefx/src/Common/src/System/Memory/FixedBufferExtensions.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System +{ + internal static class FixedBufferExtensions + { + /// + /// Returns a string from the given span, terminating the string at null if present. + /// + internal unsafe static string GetStringFromFixedBuffer(this ReadOnlySpan span) + { + fixed (char* c = &span.DangerousGetPinnableReference()) + { + return new string(c, 0, span.GetFixedBufferStringLength()); + } + } + + /// + /// Gets the null-terminated string length of the given span. + /// + internal unsafe static int GetFixedBufferStringLength(this ReadOnlySpan span) + { + int length = span.IndexOf('\0'); + return length < 0 ? span.Length : length; + } + + /// + /// Returns true if the given string equals the given span. + /// The span's logical length is to the first null if present. + /// + internal unsafe static bool FixedBufferEqualsString(this ReadOnlySpan span, string value) + { + if (value == null || value.Length > span.Length) + return false; + + int i = 0; + for (; i < value.Length; i++) + { + // Strings with embedded nulls can never match as the fixed buffer always null terminates. + if (value[i] == '\0' || value[i] != span[i]) + return false; + } + + // If we've maxed out the buffer or reached the + // null terminator, we're equal. + return i == span.Length || span[i] == '\0'; + } + } +} diff --git a/external/corefx/src/Common/src/System/Net/CookieParser.cs b/external/corefx/src/Common/src/System/Net/CookieParser.cs index e6fdd7eb98..3a8d5e104e 100644 --- a/external/corefx/src/Common/src/System/Net/CookieParser.cs +++ b/external/corefx/src/Common/src/System/Net/CookieParser.cs @@ -282,7 +282,8 @@ namespace System.Net } ++_index; } - else + + if (Eof) { _cookieLength = _index - _cookieStartIndex; } diff --git a/external/corefx/src/Common/src/System/Net/Http/WinHttpException.cs b/external/corefx/src/Common/src/System/Net/Http/WinHttpException.cs index 1a4bcf8f52..d77e347135 100644 --- a/external/corefx/src/Common/src/System/Net/Http/WinHttpException.cs +++ b/external/corefx/src/Common/src/System/Net/Http/WinHttpException.cs @@ -15,6 +15,11 @@ namespace System.Net.Http this.HResult = ConvertErrorCodeToHR(error); } + public WinHttpException(int error, string message, Exception innerException) : base(message, innerException) + { + this.HResult = ConvertErrorCodeToHR(error); + } + public static int ConvertErrorCodeToHR(int error) { // This method allows common error detection code to be used by consumers @@ -52,6 +57,13 @@ namespace System.Net.Http return e; } + public static WinHttpException CreateExceptionUsingError(int error, Exception innerException) + { + var e = new WinHttpException(error, GetErrorMessage(error), innerException); + ExceptionStackTrace.AddCurrentStack(e); + return e; + } + public static string GetErrorMessage(int error) { // Look up specific error message in WINHTTP.DLL since it is not listed in default system resources diff --git a/external/corefx/src/Common/src/System/Net/Internals/IPAddressExtensions.cs b/external/corefx/src/Common/src/System/Net/Internals/IPAddressExtensions.cs index dd127dc413..1ad0048d56 100644 --- a/external/corefx/src/Common/src/System/Net/Internals/IPAddressExtensions.cs +++ b/external/corefx/src/Common/src/System/Net/Internals/IPAddressExtensions.cs @@ -18,17 +18,13 @@ namespace System.Net.Sockets #pragma warning restore CS0618 case AddressFamily.InterNetworkV6: - return new IPAddress(original.GetAddressBytes(), (uint)original.ScopeId); + Span addressBytes = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes]; + original.TryWriteBytes(addressBytes, out int bytesWritten); + Debug.Assert(bytesWritten == IPAddressParserStatics.IPv6AddressBytes); + return new IPAddress(addressBytes, (uint)original.ScopeId); } throw new InternalException(); } - - public static long GetAddress(this IPAddress thisObj) - { - byte[] addressBytes = thisObj.GetAddressBytes(); - Debug.Assert(addressBytes.Length == 4); - return (long)BitConverter.ToInt32(addressBytes, 0); - } } } diff --git a/external/corefx/src/Common/src/System/Net/InteropIPAddressExtensions.Unix.cs b/external/corefx/src/Common/src/System/Net/InteropIPAddressExtensions.Unix.cs index b707ae54de..359a9cb19b 100644 --- a/external/corefx/src/Common/src/System/Net/InteropIPAddressExtensions.Unix.cs +++ b/external/corefx/src/Common/src/System/Net/InteropIPAddressExtensions.Unix.cs @@ -13,14 +13,9 @@ namespace System.Net { var nativeIPAddress = default(Interop.Sys.IPAddress); - byte[] bytes = ipAddress.GetAddressBytes(); - Debug.Assert(bytes.Length == sizeof(uint) || bytes.Length == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytes.Length}"); + ipAddress.TryWriteBytes(new Span(nativeIPAddress.Address, Interop.Sys.IPv6AddressBytes), out int bytesWritten); + Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytesWritten}"); - for (int i = 0; i < bytes.Length && i < Interop.Sys.IPv6AddressBytes; i++) - { - nativeIPAddress.Address[i] = bytes[i]; - } - if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6) { nativeIPAddress.IsIPv6 = true; @@ -39,13 +34,9 @@ namespace System.Net } else { - byte[] address = new byte[Interop.Sys.IPv6AddressBytes]; - for (int b = 0; b < Interop.Sys.IPv6AddressBytes; b++) - { - address[b] = nativeIPAddress.Address[b]; - } - - return new IPAddress(address, (long)nativeIPAddress.ScopeId); + return new IPAddress( + new Span(nativeIPAddress.Address, Interop.Sys.IPv6AddressBytes), + (long)nativeIPAddress.ScopeId); } } } diff --git a/external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs b/external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs index 233eb55632..de61e61aac 100644 --- a/external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs +++ b/external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs @@ -287,7 +287,7 @@ namespace System.Net { DumpBuffer(thisOrContextObject, buffer, 0, buffer.Length, memberName); } - + /// Logs the contents of a buffer. /// `this`, or another object that serves to provide context for the operation. /// The buffer to be logged. diff --git a/external/corefx/src/Common/src/System/Net/SafeCloseSocket.Unix.cs b/external/corefx/src/Common/src/System/Net/SafeCloseSocket.Unix.cs index 8ad756be87..510ac6aef7 100644 --- a/external/corefx/src/Common/src/System/Net/SafeCloseSocket.Unix.cs +++ b/external/corefx/src/Common/src/System/Net/SafeCloseSocket.Unix.cs @@ -20,6 +20,7 @@ namespace System.Net.Sockets private int _receiveTimeout = -1; private int _sendTimeout = -1; private bool _nonBlocking; + private bool _underlyingHandleNonBlocking; private SocketAsyncContext _asyncContext; private TrackedSocketOptions _trackedOptions; @@ -111,6 +112,18 @@ namespace System.Net.Sockets } } + // This will set the underlying OS handle to be nonblocking, for whatever reason -- + // performing an async operation or using a timeout will cause this to happen. + // Once the OS handle is nonblocking, it never transitions back to blocking. + private void SetHandleNonBlocking() + { + // We don't care about synchronization because this is idempotent + if (!_underlyingHandleNonBlocking) + { + AsyncContext.SetNonBlocking(); + _underlyingHandleNonBlocking = true; + } + } public bool IsNonBlocking { @@ -130,7 +143,7 @@ namespace System.Net.Sockets // if (value) { - AsyncContext.SetNonBlocking(); + SetHandleNonBlocking(); } } } @@ -144,7 +157,15 @@ namespace System.Net.Sockets set { Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}"); - _receiveTimeout = value;; + + // We always implement timeouts using nonblocking I/O and AsyncContext, + // to avoid issues when switching from blocking I/O to nonblocking. + if (value != -1) + { + SetHandleNonBlocking(); + } + + _receiveTimeout = value; } } @@ -157,6 +178,14 @@ namespace System.Net.Sockets set { Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}"); + + // We always implement timeouts using nonblocking I/O and AsyncContext, + // to avoid issues when switching from blocking I/O to nonblocking. + if (value != -1) + { + SetHandleNonBlocking(); + } + _sendTimeout = value; } } diff --git a/external/corefx/src/Common/src/System/Net/SafeCloseSocket.cs b/external/corefx/src/Common/src/System/Net/SafeCloseSocket.cs index 7c9ca0244b..6e0d5b8457 100644 --- a/external/corefx/src/Common/src/System/Net/SafeCloseSocket.cs +++ b/external/corefx/src/Common/src/System/Net/SafeCloseSocket.cs @@ -141,15 +141,17 @@ namespace System.Net.Sockets _released = true; InnerSafeCloseSocket innerSocket = _innerSocket == null ? null : Interlocked.Exchange(ref _innerSocket, null); - + if (innerSocket != null) + { #if DEBUG - // On AppDomain unload we may still have pending Overlapped operations. - // ThreadPoolBoundHandle should handle this scenario by canceling them. - innerSocket?.LogRemainingOperations(); + // On AppDomain unload we may still have pending Overlapped operations. + // ThreadPoolBoundHandle should handle this scenario by canceling them. + innerSocket.LogRemainingOperations(); #endif - InnerReleaseHandle(); - innerSocket?.DangerousRelease(); + InnerReleaseHandle(); + innerSocket.DangerousRelease(); + } return true; } @@ -175,11 +177,12 @@ namespace System.Net.Sockets sw.SpinOnce(); } + InnerReleaseHandle(); + // Now free it with blocking. innerSocket.BlockingRelease(); } - InnerReleaseHandle(); #if DEBUG } catch (Exception exception) when (!ExceptionCheck.IsFatal(exception)) diff --git a/external/corefx/src/Common/src/System/Net/SocketAddress.cs b/external/corefx/src/Common/src/System/Net/SocketAddress.cs index 2d2fd9f4b4..1115c84f15 100644 --- a/external/corefx/src/Common/src/System/Net/SocketAddress.cs +++ b/external/corefx/src/Common/src/System/Net/SocketAddress.cs @@ -103,7 +103,11 @@ namespace System.Net.Internals if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6) { - SocketAddressPal.SetIPv6Address(Buffer, ipAddress.GetAddressBytes(), (uint)ipAddress.ScopeId); + Span addressBytes = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes]; + ipAddress.TryWriteBytes(addressBytes, out int bytesWritten); + Debug.Assert(bytesWritten == IPAddressParserStatics.IPv6AddressBytes); + + SocketAddressPal.SetIPv6Address(Buffer, addressBytes, (uint)ipAddress.ScopeId); } else { @@ -128,7 +132,7 @@ namespace System.Net.Internals { Debug.Assert(Size >= IPv6AddressSize); - byte[] address = new byte[IPAddressParserStatics.IPv6AddressBytes]; + Span address = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes]; uint scope; SocketAddressPal.GetIPv6Address(Buffer, address, out scope); diff --git a/external/corefx/src/Common/src/System/Net/SocketAddressPal.Unix.cs b/external/corefx/src/Common/src/System/Net/SocketAddressPal.Unix.cs index 718672d38d..93f3377939 100644 --- a/external/corefx/src/Common/src/System/Net/SocketAddressPal.Unix.cs +++ b/external/corefx/src/Common/src/System/Net/SocketAddressPal.Unix.cs @@ -114,12 +114,12 @@ namespace System.Net return ipAddress; } - public static unsafe void GetIPv6Address(byte[] buffer, byte[] address, out uint scope) + public static unsafe void GetIPv6Address(byte[] buffer, Span address, out uint scope) { uint localScope; Interop.Error err; fixed (byte* rawAddress = buffer) - fixed (byte* ipAddress = address) + fixed (byte* ipAddress = &address.DangerousGetPinnableReference()) { err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); } @@ -145,9 +145,9 @@ namespace System.Net SetIPv4Address(buffer, addr); } - public static unsafe void SetIPv6Address(byte[] buffer, byte[] address, uint scope) + public static unsafe void SetIPv6Address(byte[] buffer, Span address, uint scope) { - fixed (byte* rawInput = address) + fixed (byte* rawInput = &address.DangerousGetPinnableReference()) { SetIPv6Address(buffer, rawInput, address.Length, scope); } diff --git a/external/corefx/src/Common/src/System/Net/SocketAddressPal.Windows.cs b/external/corefx/src/Common/src/System/Net/SocketAddressPal.Windows.cs index 875cb91f27..32685d4882 100644 --- a/external/corefx/src/Common/src/System/Net/SocketAddressPal.Windows.cs +++ b/external/corefx/src/Common/src/System/Net/SocketAddressPal.Windows.cs @@ -49,7 +49,7 @@ namespace System.Net } } - public static unsafe void GetIPv6Address(byte[] buffer, byte[] address, out uint scope) + public static unsafe void GetIPv6Address(byte[] buffer, Span address, out uint scope) { for (int i = 0; i < address.Length; i++) { @@ -72,7 +72,7 @@ namespace System.Net buffer[7] = unchecked((byte)(address >> 24)); } - public static unsafe void SetIPv6Address(byte[] buffer, byte[] address, uint scope) + public static unsafe void SetIPv6Address(byte[] buffer, Span address, uint scope) { // No handling for Flow Information buffer[4] = (byte)0; diff --git a/external/corefx/src/Common/src/System/Net/WebSockets/ManagedWebSocket.cs b/external/corefx/src/Common/src/System/Net/WebSockets/ManagedWebSocket.cs index 0da9a9924b..f4dcd9bbc3 100644 --- a/external/corefx/src/Common/src/System/Net/WebSockets/ManagedWebSocket.cs +++ b/external/corefx/src/Common/src/System/Net/WebSockets/ManagedWebSocket.cs @@ -22,7 +22,7 @@ namespace System.Net.WebSockets /// Thread-safety: /// - It's acceptable to call ReceiveAsync and SendAsync in parallel. One of each may run concurrently. /// - It's acceptable to have a pending ReceiveAsync while CloseOutputAsync or CloseAsync is called. - /// - Attemping to invoke any other operations in parallel may corrupt the instance. Attempting to invoke + /// - Attempting to invoke any other operations in parallel may corrupt the instance. Attempting to invoke /// a send operation while another is in progress or a receive operation while another is in progress will /// result in an exception. /// @@ -42,10 +42,6 @@ namespace System.Net.WebSockets return new ManagedWebSocket(stream, isServer, subprotocol, keepAliveInterval, receiveBufferSize, receiveBuffer); } - /// Per-thread cached 4-byte mask byte array. - [ThreadStatic] - private static byte[] t_headerMask; - /// Thread-safe random number generator used to generate masks for each send. private static readonly RandomNumberGenerator s_random = RandomNumberGenerator.Create(); /// Encoding for the payload of text messages: UTF8 encoding that throws if invalid bytes are discovered, per the RFC. @@ -403,12 +399,11 @@ namespace System.Net.WebSockets writeTask = _stream.WriteAsync(_sendBuffer, 0, sendBytes, CancellationToken.None); // If the operation happens to complete synchronously (or, more specifically, by - // the time we get from the previous line to here, release the semaphore, propagate - // exceptions, and we're done. + // the time we get from the previous line to here), release the semaphore, return + // the task, and we're done. if (writeTask.IsCompleted) { - writeTask.GetAwaiter().GetResult(); // propagate any exceptions - return Task.CompletedTask; + return writeTask; } // Up until this point, if an exception occurred (such as when accessing _stream or when @@ -520,7 +515,16 @@ namespace System.Net.WebSockets { // This exists purely to keep the connection alive; don't wait for the result, and ignore any failures. // The call will handle releasing the lock. - SendFrameLockAcquiredNonCancelableAsync(MessageOpcode.Ping, true, new ArraySegment(Array.Empty())); + Task t = SendFrameLockAcquiredNonCancelableAsync(MessageOpcode.Ping, true, new ArraySegment(Array.Empty())); + + // "Observe" any exception, ignoring it to prevent the unobserved exception event from being raised. + if (!t.IsCompletedSuccessfully) + { + t.ContinueWith(p => { Exception ignored = p.Exception; }, + CancellationToken.None, + TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously, + TaskScheduler.Default); + } } else { @@ -600,13 +604,8 @@ namespace System.Net.WebSockets /// Writes a 4-byte random mask to the specified buffer at the specified offset. /// The buffer to which to write the mask. /// The offset into the buffer at which to write the mask. - private static void WriteRandomMask(byte[] buffer, int offset) - { - byte[] mask = t_headerMask ?? (t_headerMask = new byte[MaskLength]); - Debug.Assert(mask.Length == MaskLength, $"Expected mask of length {MaskLength}, got {mask.Length}"); - s_random.GetBytes(mask); - Buffer.BlockCopy(mask, 0, buffer, offset, MaskLength); - } + private static void WriteRandomMask(byte[] buffer, int offset) => + s_random.GetBytes(buffer, offset, MaskLength); /// /// Receive the next text, binary, continuation, or close message, returning information about it and diff --git a/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.Unix.cs b/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.Unix.cs new file mode 100644 index 0000000000..244bab028d --- /dev/null +++ b/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.Unix.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.InteropServices +{ + internal static partial class FunctionWrapper + { + public static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName) + => Interop.Libdl.dlsym(nativeLibraryHandle, functionName); + } +} diff --git a/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.Windows.cs b/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.Windows.cs new file mode 100644 index 0000000000..745821171e --- /dev/null +++ b/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.Windows.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.InteropServices +{ + internal static partial class FunctionWrapper + { + private static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName) + => Interop.Kernel32.GetProcAddress(nativeLibraryHandle, functionName); + } +} diff --git a/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.cs b/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.cs new file mode 100644 index 0000000000..c2723952a4 --- /dev/null +++ b/external/corefx/src/Common/src/System/Runtime/InteropServices/FunctionWrapper.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.Runtime.InteropServices +{ + /// + /// Utility class which lazily loads function pointers and throws a DllNotFoundException or + /// an EntryPointNotFoundException at usage-time if the function pointer can not be loaded. + /// + /// The type of the function to wrap. + internal class FunctionWrapper where T : class + { + private string _libraryName; + private string _functionName; + private Lazy> _lazyDelegate; + + public FunctionWrapper(Lazy> lazyDelegate, string libName, string funcName) + { + _lazyDelegate = lazyDelegate; + _libraryName = libName; + _functionName = funcName; + } + + public T Delegate + { + get + { + FunctionLoadResult loadResult = _lazyDelegate.Value; + switch (loadResult.ResultKind) + { + case FunctionLoadResultKind.Success: + return loadResult.Delegate; + case FunctionLoadResultKind.LibraryNotFound: + throw new DllNotFoundException(SR.Format(SR.DllNotFoundExceptionMessage, _libraryName)); + case FunctionLoadResultKind.FunctionNotFound: + throw new EntryPointNotFoundException(SR.Format(SR.EntryPointNotFoundExceptionMessage, _functionName, _libraryName)); + default: + Debug.Fail("Illegal FunctionLoadResultKind: " + loadResult.ResultKind); + return null; + } + } + } + } + + public enum FunctionLoadResultKind { Success, LibraryNotFound, FunctionNotFound } + + public struct FunctionLoadResult + { + public FunctionLoadResultKind ResultKind { get; } + public T Delegate { get; } + public FunctionLoadResult(FunctionLoadResultKind kind, T del) { ResultKind = kind; Delegate = del; } + } + + internal static partial class FunctionWrapper + { + public static FunctionWrapper Load(IntPtr nativeLibraryHandle, string funcName, string libName) where T : class + { + Lazy> lazyDelegate = new Lazy>(() => + { + if (nativeLibraryHandle == IntPtr.Zero) + { + return new FunctionLoadResult(FunctionLoadResultKind.LibraryNotFound, null); + } + + IntPtr funcPtr = LoadFunctionPointer(nativeLibraryHandle, funcName); + if (funcPtr == IntPtr.Zero) + { + return new FunctionLoadResult(FunctionLoadResultKind.FunctionNotFound, null); + } + else + { + return new FunctionLoadResult(FunctionLoadResultKind.Success, Marshal.GetDelegateForFunctionPointer(funcPtr)); + } + }); + + return new FunctionWrapper(lazyDelegate, libName, funcName); + } + } +} diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.SignVerify.cs b/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.SignVerify.cs index 24a9b47959..81425529bf 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.SignVerify.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.SignVerify.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using Internal.Cryptography; using Microsoft.Win32.SafeHandles; -using System.Diagnostics; using static Interop.BCrypt; using static Interop.NCrypt; @@ -19,15 +19,48 @@ namespace System.Security.Cryptography public override byte[] CreateSignature(byte[] rgbHash) { if (rgbHash == null) - throw new ArgumentNullException(nameof(rgbHash)); - - rgbHash = AdjustHashSizeIfNecessary(rgbHash); - using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) { - unsafe + throw new ArgumentNullException(nameof(rgbHash)); + } + + ReadOnlySpan source = rgbHash; + byte[] arrayToReturnToArrayPool = AdjustHashSizeIfNecessaryWithArrayPool(ref source); + try + { + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) { - byte[] signature = CngCommon.SignHash(keyHandle, rgbHash, AsymmetricPaddingMode.None, null, rgbHash.Length * 2); - return signature; + unsafe + { + return CngCommon.SignHash(keyHandle, source, AsymmetricPaddingMode.None, null, source.Length * 2); + } + } + } + finally + { + if (arrayToReturnToArrayPool != null) + { + Array.Clear(arrayToReturnToArrayPool, 0, source.Length); + ArrayPool.Shared.Return(arrayToReturnToArrayPool); + } + } + } + + public override unsafe bool TryCreateSignature(ReadOnlySpan source, Span destination, out int bytesWritten) + { + byte[] arrayToReturnToArrayPool = AdjustHashSizeIfNecessaryWithArrayPool(ref source); + try + { + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + return CngCommon.TrySignHash(keyHandle, source, destination, AsymmetricPaddingMode.None, null, out bytesWritten); + } + } + finally + { + if (arrayToReturnToArrayPool != null) + { + Array.Clear(arrayToReturnToArrayPool, 0, source.Length); + ArrayPool.Shared.Return(arrayToReturnToArrayPool); } } } @@ -35,29 +68,42 @@ namespace System.Security.Cryptography public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { if (rgbHash == null) - throw new ArgumentNullException(nameof(rgbHash)); - - if (rgbSignature == null) - throw new ArgumentNullException(nameof(rgbSignature)); - - rgbHash = AdjustHashSizeIfNecessary(rgbHash); - - using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) { - unsafe + throw new ArgumentNullException(nameof(rgbHash)); + } + if (rgbSignature == null) + { + throw new ArgumentNullException(nameof(rgbSignature)); + } + + return VerifySignature((ReadOnlySpan)rgbHash, (ReadOnlySpan)rgbSignature); + } + + public override bool VerifySignature(ReadOnlySpan rgbHash, ReadOnlySpan rgbSignature) + { + byte[] arrayToReturnToArrayPool = AdjustHashSizeIfNecessaryWithArrayPool(ref rgbHash); + try + { + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) { - bool verified = CngCommon.VerifyHash(keyHandle, rgbHash, rgbSignature, AsymmetricPaddingMode.None, null); - return verified; + unsafe + { + return CngCommon.VerifyHash(keyHandle, rgbHash, rgbSignature, AsymmetricPaddingMode.None, null); + } + } + } + finally + { + if (arrayToReturnToArrayPool != null) + { + Array.Clear(arrayToReturnToArrayPool, 0, rgbHash.Length); + ArrayPool.Shared.Return(arrayToReturnToArrayPool); } } } - private byte[] AdjustHashSizeIfNecessary(byte[] hash) + private byte[] AdjustHashSizeIfNecessaryWithArrayPool(ref ReadOnlySpan hash) { - Debug.Assert(hash != null); - - int qLength = ComputeQLength(); - // Windows CNG requires that the hash output and q match sizes, but we can better // interoperate with other FIPS 186-3 implementations if we perform truncation // here, before sending it to CNG. Since this is a scenario presented in the @@ -67,20 +113,24 @@ namespace System.Security.Cryptography // (since it gets treated as a big-endian number). Since this is also a scenario // presented in the CAVP reference test suite, we can confirm our implementation. + int qLength = ComputeQLength(); + if (qLength == hash.Length) { - return hash; + return null; } - - if (qLength < hash.Length) + else if (qLength < hash.Length) { - Array.Resize(ref hash, qLength); - return hash; + hash = hash.Slice(0, qLength); + return null; + } + else + { + byte[] arrayPoolPaddedHash = ArrayPool.Shared.Rent(qLength); + hash.CopyTo(new Span(arrayPoolPaddedHash, qLength - hash.Length, hash.Length)); + hash = new ReadOnlySpan(arrayPoolPaddedHash, 0, qLength); + return arrayPoolPaddedHash; } - - byte[] paddedHash = new byte[qLength]; - Buffer.BlockCopy(hash, 0, paddedHash, qLength - hash.Length, hash.Length); - return paddedHash; } private int ComputeQLength() diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.cs b/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.cs index 8010719372..7cb5764057 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/DSACng.cs @@ -48,15 +48,14 @@ namespace System.Security.Cryptography public override string KeyExchangeAlgorithm => null; // Need to override since base methods throw a "override me" exception: makes SignData/VerifyData function. - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return CngCommon.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + CngCommon.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return CngCommon.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + CngCommon.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + CngCommon.TryHashData(source, destination, hashAlgorithm, out bytesWritten); private void ForceSetKeySize(int newKeySize) { diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/DSAOpenSsl.cs b/external/corefx/src/Common/src/System/Security/Cryptography/DSAOpenSsl.cs index 161cc3a7fe..9610621ec1 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/DSAOpenSsl.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/DSAOpenSsl.cs @@ -2,10 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Internal.Cryptography; -using Microsoft.Win32.SafeHandles; +using System.Buffers; using System.Diagnostics; using System.IO; +using Internal.Cryptography; +using Microsoft.Win32.SafeHandles; namespace System.Security.Cryptography { @@ -175,11 +176,12 @@ namespace System.Security.Cryptography return AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); } + + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - } + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); public override byte[] CreateSignature(byte[] rgbHash) { @@ -187,25 +189,74 @@ namespace System.Security.Cryptography throw new ArgumentNullException(nameof(rgbHash)); SafeDsaHandle key = _key.Value; - byte[] signature = new byte[Interop.Crypto.DsaEncodedSignatureSize(key)]; - - int signatureSize; - bool success = Interop.Crypto.DsaSign(key, rgbHash, rgbHash.Length, signature, out signatureSize); - if (!success) + int signatureSize = Interop.Crypto.DsaEncodedSignatureSize(key); + byte[] signature = ArrayPool.Shared.Rent(signatureSize); + try { - throw Interop.Crypto.CreateOpenSslCryptographicException(); + bool success = Interop.Crypto.DsaSign(key, rgbHash, rgbHash.Length, new Span(signature, 0, signatureSize), out signatureSize); + if (!success) + { + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + + Debug.Assert( + signatureSize <= signature.Length, + "DSA_sign reported an unexpected signature size", + "DSA_sign reported signatureSize was {0}, when <= {1} was expected", + signatureSize, + signature.Length); + + int signatureFieldSize = Interop.Crypto.DsaSignatureFieldSize(key) * BitsPerByte; + return AsymmetricAlgorithmHelpers.ConvertDerToIeee1363(signature, 0, signatureSize, signatureFieldSize); + } + finally + { + Array.Clear(signature, 0, signatureSize); + ArrayPool.Shared.Return(signature); + } + } + + public override bool TryCreateSignature(ReadOnlySpan source, Span destination, out int bytesWritten) + { + byte[] converted; + SafeDsaHandle key = _key.Value; + int signatureSize = Interop.Crypto.DsaEncodedSignatureSize(key); + byte[] signature = ArrayPool.Shared.Rent(signatureSize); + try + { + bool success = Interop.Crypto.DsaSign(key, source, source.Length, new Span(signature, 0, signatureSize), out signatureSize); + if (!success) + { + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + + Debug.Assert( + signatureSize <= signature.Length, + "DSA_sign reported an unexpected signature size", + "DSA_sign reported signatureSize was {0}, when <= {1} was expected", + signatureSize, + signature.Length); + + int signatureFieldSize = Interop.Crypto.DsaSignatureFieldSize(key) * BitsPerByte; + converted = AsymmetricAlgorithmHelpers.ConvertDerToIeee1363(signature, 0, signatureSize, signatureFieldSize); + } + finally + { + Array.Clear(signature, 0, signatureSize); + ArrayPool.Shared.Return(signature); } - Debug.Assert( - signatureSize <= signature.Length, - "DSA_sign reported an unexpected signature size", - "DSA_sign reported signatureSize was {0}, when <= {1} was expected", - signatureSize, - signature.Length); - - int signatureFieldSize = Interop.Crypto.DsaSignatureFieldSize(key) * BitsPerByte; - byte[] converted = AsymmetricAlgorithmHelpers.ConvertDerToIeee1363(signature, 0, signatureSize, signatureFieldSize); - return converted; + if (converted.Length <= destination.Length) + { + new ReadOnlySpan(converted).CopyTo(destination); + bytesWritten = converted.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } } public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) @@ -215,6 +266,11 @@ namespace System.Security.Cryptography if (rgbSignature == null) throw new ArgumentNullException(nameof(rgbSignature)); + return VerifySignature((ReadOnlySpan)rgbHash, (ReadOnlySpan)rgbSignature); + } + + public override bool VerifySignature(ReadOnlySpan rgbHash, ReadOnlySpan rgbSignature) + { SafeDsaHandle key = _key.Value; int expectedSignatureBytes = Interop.Crypto.DsaSignatureFieldSize(key) * 2; @@ -235,13 +291,10 @@ namespace System.Security.Cryptography // with the already loaded key. ForceSetKeySize(BitsPerByte * Interop.Crypto.DsaKeySize(newKey)); - _key = new Lazy(() => newKey, isThreadSafe:true); - - // Have Lazy consider the key to be loaded - var dummy = _key.Value; + _key = new Lazy(newKey); } - private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(minSize: 512, maxSize: 3072, skipSize: 64) }; + private static readonly KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(minSize: 512, maxSize: 3072, skipSize: 64) }; } #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS } diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/DSASecurityTransforms.cs b/external/corefx/src/Common/src/System/Security/Cryptography/DSASecurityTransforms.cs index f94d6cf004..e06058c2b3 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/DSASecurityTransforms.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/DSASecurityTransforms.cs @@ -176,10 +176,10 @@ namespace System.Security.Cryptography return Interop.AppleCrypto.ImportEphemeralKey(blob, hasPrivateKey); } - public override byte[] CreateSignature(byte[] hash) + public override byte[] CreateSignature(byte[] rgbHash) { - if (hash == null) - throw new ArgumentNullException(nameof(hash)); + if (rgbHash == null) + throw new ArgumentNullException(nameof(rgbHash)); SecKeyPair keys = GetKeys(); @@ -188,7 +188,7 @@ namespace System.Security.Cryptography throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey); } - byte[] derFormatSignature = Interop.AppleCrypto.GenerateSignature(keys.PrivateKey, hash); + byte[] derFormatSignature = Interop.AppleCrypto.GenerateSignature(keys.PrivateKey, rgbHash); // Since the AppleCrypto implementation is limited to FIPS 186-2, signature field sizes // are always 160 bits / 20 bytes (the size of SHA-1, and the only legal length for Q). @@ -208,6 +208,11 @@ namespace System.Security.Cryptography if (signature == null) throw new ArgumentNullException(nameof(signature)); + return VerifySignature((ReadOnlySpan)hash, (ReadOnlySpan)signature); + } + + public override bool VerifySignature(ReadOnlySpan hash, ReadOnlySpan signature) + { byte[] derFormatSignature = AsymmetricAlgorithmHelpers.ConvertIeee1363ToDer(signature); return Interop.AppleCrypto.VerifySignature( @@ -227,10 +232,11 @@ namespace System.Security.Cryptography return AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); } - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); protected override void Dispose(bool disposing) { diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/DerEncoder.cs b/external/corefx/src/Common/src/System/Security/Cryptography/DerEncoder.cs index 88e63fa7a0..bf9dca7edd 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/DerEncoder.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/DerEncoder.cs @@ -135,30 +135,12 @@ namespace System.Security.Cryptography /// /// The value to encode, in big integer representation. /// The encoded segments { tag, length, value } - internal static byte[][] SegmentedEncodeUnsignedInteger(byte[] bigEndianBytes) + internal static byte[][] SegmentedEncodeUnsignedInteger(ReadOnlySpan bigEndianBytes) { - Debug.Assert(bigEndianBytes != null); + Debug.Assert(!bigEndianBytes.IsEmpty, "The span must not be empty."); - return SegmentedEncodeUnsignedInteger(bigEndianBytes, 0, bigEndianBytes.Length); - } - - /// - /// Encode the segments { tag, length, value } of an unsigned integer represented within a bounded array. - /// - /// The value to encode, in big integer representation. - /// The offset into bigEndianBytes to read - /// The count of bytes to read, must be greater than 0 - /// The encoded segments { tag, length, value } - internal static byte[][] SegmentedEncodeUnsignedInteger(byte[] bigEndianBytes, int offset, int count) - { - Debug.Assert(bigEndianBytes != null); - Debug.Assert(offset >= 0); - Debug.Assert(count > 0); - Debug.Assert(bigEndianBytes.Length > 0); - Debug.Assert(bigEndianBytes.Length >= count - offset); - - int start = offset; - int end = start + count; + int start = 0; + int end = start + bigEndianBytes.Length; // Remove any leading zeroes. while (start < end && bigEndianBytes[start] == 0) @@ -170,26 +152,15 @@ namespace System.Security.Cryptography if (start == end) { start--; - Debug.Assert(start >= offset); + Debug.Assert(start >= 0); } - int length = end - start; - byte[] dataBytes; - int writeStart = 0; - // If the first byte is bigger than 0x7F it will look like a negative number, since // we're unsigned, insert a zero-padding byte. - if (bigEndianBytes[start] > 0x7F) - { - dataBytes = new byte[length + 1]; - writeStart = 1; - } - else - { - dataBytes = new byte[length]; - } - - Buffer.BlockCopy(bigEndianBytes, start, dataBytes, writeStart, length); + int length = end - start; + int writeStart = bigEndianBytes[start] > 0x7F ? 1 : 0; + var dataBytes = new byte[length + writeStart]; + bigEndianBytes.Slice(start, length).CopyTo(new Span(dataBytes).Slice(writeStart)); return new[] { diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.HashData.cs b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.HashData.cs index 17194c5b75..1fec4fe283 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.HashData.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.HashData.cs @@ -16,15 +16,14 @@ namespace System.Security.Cryptography #endif public sealed partial class ECDsaCng : ECDsa { - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return CngCommon.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + CngCommon.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return CngCommon.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + CngCommon.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + CngCommon.TryHashData(source, destination, hashAlgorithm, out bytesWritten); } #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS } diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.SignVerify.cs b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.SignVerify.cs index eeb853564e..1c9b6db8f1 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.SignVerify.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaCng.SignVerify.cs @@ -51,6 +51,14 @@ namespace System.Security.Cryptography } } + public override unsafe bool TrySignHash(ReadOnlySpan source, Span destination, out int bytesWritten) + { + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + return keyHandle.TrySignHash(source, destination, AsymmetricPaddingMode.None, null, out bytesWritten); + } + } + /// /// Verifies that alleged signature of a hash is, in fact, a valid signature of that hash. /// @@ -61,13 +69,14 @@ namespace System.Security.Cryptography if (signature == null) throw new ArgumentNullException(nameof(signature)); - unsafe + return VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature); + } + + public override unsafe bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature) + { + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) { - using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) - { - bool verified = keyHandle.VerifyHash(hash, signature, AsymmetricPaddingMode.None, null); - return verified; - } + return keyHandle.VerifyHash(hash, signature, AsymmetricPaddingMode.None, null); } } } diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs index 370bb75c08..1f490ce6e3 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs @@ -2,10 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; +using System.IO; using Internal.Cryptography; using Microsoft.Win32.SafeHandles; -using System.Diagnostics; -using System.IO; namespace System.Security.Cryptography { @@ -89,6 +89,41 @@ namespace System.Security.Cryptography return converted; } + public override bool TrySignHash(ReadOnlySpan source, Span destination, out int bytesWritten) + { + SafeEcKeyHandle key = _key.Value; + + byte[] converted; + int signatureLength = Interop.Crypto.EcDsaSize(key); + byte[] signature = ArrayPool.Shared.Rent(signatureLength); + try + { + if (!Interop.Crypto.EcDsaSign(source, source.Length, new Span(signature, 0, signatureLength), ref signatureLength, key)) + { + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + + converted = AsymmetricAlgorithmHelpers.ConvertDerToIeee1363(signature, 0, signatureLength, KeySize); + } + finally + { + Array.Clear(signature, 0, signatureLength); + ArrayPool.Shared.Return(signature); + } + + if (converted.Length <= destination.Length) + { + new ReadOnlySpan(converted).CopyTo(destination); + bytesWritten = converted.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } + } + public override bool VerifyHash(byte[] hash, byte[] signature) { if (hash == null) @@ -96,6 +131,11 @@ namespace System.Security.Cryptography if (signature == null) throw new ArgumentNullException(nameof(signature)); + return VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature); + } + + public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature) + { // The signature format for .NET is r.Concat(s). Each of r and s are of length BitsToBytes(KeySize), even // when they would have leading zeroes. If it's the correct size, then we need to encode it from // r.Concat(s) to SEQUENCE(INTEGER(r), INTEGER(s)), because that's the format that OpenSSL expects. @@ -113,15 +153,14 @@ namespace System.Security.Cryptography return verifyResult == 1; } - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); protected override void Dispose(bool disposing) { @@ -233,10 +272,7 @@ namespace System.Security.Cryptography // with the already loaded key. ForceSetKeySize(Interop.Crypto.EcKeyGetSize(newKey)); - _key = new Lazy(() => newKey, isThreadSafe: true); - - // Have Lazy consider the key to be loaded - var dummy = _key.Value; + _key = new Lazy(newKey); } } #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs index 7d41d3a0cd..e8b9f0d03b 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs @@ -123,6 +123,34 @@ namespace System.Security.Cryptography return ieeeFormatSignature; } + public override bool TrySignHash(ReadOnlySpan source, Span destination, out int bytesWritten) + { + SecKeyPair keys = GetKeys(); + if (keys.PrivateKey == null) + { + throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey); + } + + byte[] derFormatSignature = Interop.AppleCrypto.GenerateSignature(keys.PrivateKey, source); + byte[] ieeeFormatSignature = AsymmetricAlgorithmHelpers.ConvertDerToIeee1363( + derFormatSignature, + 0, + derFormatSignature.Length, + KeySize); + + if (ieeeFormatSignature.Length <= destination.Length) + { + new ReadOnlySpan(ieeeFormatSignature).CopyTo(destination); + bytesWritten = ieeeFormatSignature.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } + } + public override bool VerifyHash(byte[] hash, byte[] signature) { if (hash == null) @@ -130,23 +158,23 @@ namespace System.Security.Cryptography if (signature == null) throw new ArgumentNullException(nameof(signature)); - byte[] derFormatSignature = AsymmetricAlgorithmHelpers.ConvertIeee1363ToDer(signature); + return VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature); + } - return Interop.AppleCrypto.VerifySignature( + public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature) => + Interop.AppleCrypto.VerifySignature( GetKeys().PublicKey, hash, - derFormatSignature); - } + AsymmetricAlgorithmHelpers.ConvertIeee1363ToDer(signature)); - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); protected override void Dispose(bool disposing) { diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs b/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs index 6bfb8ed4cc..0df93cb0b4 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.EncryptDecrypt.cs @@ -2,8 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; - using Internal.Cryptography; using ErrorCode = Interop.NCrypt.ErrorCode; @@ -18,76 +18,108 @@ namespace System.Security.Cryptography #endif public sealed partial class RSACng : RSA { - /// - /// Encrypts data using the public key. - /// - public override byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) - { - unsafe - { - return EncryptOrDecrypt(data, padding, Interop.NCrypt.NCryptEncrypt); - } - } + /// Encrypts data using the public key. + public override unsafe byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) => + EncryptOrDecrypt(data, padding, encrypt: true); - /// - /// Decrypts data using the private key. - /// - public override byte[] Decrypt(byte[] data, RSAEncryptionPadding padding) - { - unsafe - { - return EncryptOrDecrypt(data, padding, Interop.NCrypt.NCryptDecrypt); - } - } + /// Decrypts data using the private key. + public override unsafe byte[] Decrypt(byte[] data, RSAEncryptionPadding padding) => + EncryptOrDecrypt(data, padding, encrypt: false); + + /// Encrypts data using the public key. + public override bool TryEncrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) => + TryEncryptOrDecrypt(source, destination, padding, encrypt: true, bytesWritten: out bytesWritten); + + /// Decrypts data using the private key. + public override bool TryDecrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) => + TryEncryptOrDecrypt(source, destination, padding, encrypt: false, bytesWritten: out bytesWritten); - // // Conveniently, Encrypt() and Decrypt() are identical save for the actual P/Invoke call to CNG. Thus, both - // APIs invoke this common helper with the "transform" parameter determining whether encryption or decryption is done. - // - private byte[] EncryptOrDecrypt(byte[] data, RSAEncryptionPadding padding, EncryptOrDecryptAction encryptOrDecrypt) + // array-based APIs invoke this common helper with the "encrypt" parameter determining whether encryption or decryption is done. + private unsafe byte[] EncryptOrDecrypt(byte[] data, RSAEncryptionPadding padding, bool encrypt) { if (data == null) - throw new ArgumentNullException(nameof(data)); - - if (padding == null) - throw new ArgumentNullException(nameof(padding)); - - unsafe { - using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + throw new ArgumentNullException(nameof(data)); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + switch (padding.Mode) { - switch (padding.Mode) - { - case RSAEncryptionPaddingMode.Pkcs1: - return EncryptOrDecrypt(keyHandle, data, AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, null, encryptOrDecrypt); + case RSAEncryptionPaddingMode.Pkcs1: + return EncryptOrDecrypt(keyHandle, data, AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, null, encrypt); - case RSAEncryptionPaddingMode.Oaep: + case RSAEncryptionPaddingMode.Oaep: + IntPtr namePtr = Marshal.StringToHGlobalUni(padding.OaepHashAlgorithm.Name); + try + { + var paddingInfo = new BCRYPT_OAEP_PADDING_INFO() { - using (SafeUnicodeStringHandle safeHashAlgorithmName = new SafeUnicodeStringHandle(padding.OaepHashAlgorithm.Name)) - { - BCRYPT_OAEP_PADDING_INFO paddingInfo = new BCRYPT_OAEP_PADDING_INFO() - { - pszAlgId = safeHashAlgorithmName.DangerousGetHandle(), + pszAlgId = namePtr, - // It would nice to put randomized data here but RSAEncryptionPadding does not at this point provide support for this. - pbLabel = IntPtr.Zero, - cbLabel = 0, - }; - return EncryptOrDecrypt(keyHandle, data, AsymmetricPaddingMode.NCRYPT_PAD_OAEP_FLAG, &paddingInfo, encryptOrDecrypt); - } - } + // It would nice to put randomized data here but RSAEncryptionPadding does not at this point provide support for this. + pbLabel = IntPtr.Zero, + cbLabel = 0, + }; + return EncryptOrDecrypt(keyHandle, data, AsymmetricPaddingMode.NCRYPT_PAD_OAEP_FLAG, &paddingInfo, encrypt); + } + finally + { + Marshal.FreeHGlobal(namePtr); + } - default: - throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); - } + default: + throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); + } + } + } + + // Conveniently, Encrypt() and Decrypt() are identical save for the actual P/Invoke call to CNG. Thus, both + // span-based APIs invoke this common helper with the "encrypt" parameter determining whether encryption or decryption is done. + private unsafe bool TryEncryptOrDecrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, bool encrypt, out int bytesWritten) + { + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + switch (padding.Mode) + { + case RSAEncryptionPaddingMode.Pkcs1: + return TryEncryptOrDecrypt(keyHandle, source, destination, AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, null, encrypt, out bytesWritten); + + case RSAEncryptionPaddingMode.Oaep: + IntPtr namePtr = Marshal.StringToHGlobalUni(padding.OaepHashAlgorithm.Name); + try + { + var paddingInfo = new BCRYPT_OAEP_PADDING_INFO() + { + pszAlgId = namePtr, + pbLabel = IntPtr.Zero, // It would nice to put randomized data here but RSAEncryptionPadding does not at this point provide support for this. + cbLabel = 0, + }; + return TryEncryptOrDecrypt(keyHandle, source, destination, AsymmetricPaddingMode.NCRYPT_PAD_OAEP_FLAG, &paddingInfo, encrypt, out bytesWritten); + } + finally + { + Marshal.FreeHGlobal(namePtr); + } + + default: + throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); } } } - // // Now that the padding mode and information have been marshaled to their native counterparts, perform the encryption or decryption. - // - private unsafe byte[] EncryptOrDecrypt(SafeNCryptKeyHandle key, byte[] input, AsymmetricPaddingMode paddingMode, void* paddingInfo, EncryptOrDecryptAction encryptOrDecrypt) + private unsafe byte[] EncryptOrDecrypt(SafeNCryptKeyHandle key, byte[] input, AsymmetricPaddingMode paddingMode, void* paddingInfo, bool encrypt) { int estimatedSize = KeySize / 8; #if DEBUG @@ -96,21 +128,47 @@ namespace System.Security.Cryptography byte[] output = new byte[estimatedSize]; int numBytesNeeded; - ErrorCode errorCode = encryptOrDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode); + ErrorCode errorCode = encrypt ? + Interop.NCrypt.NCryptEncrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode) : + Interop.NCrypt.NCryptDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode); + if (errorCode == ErrorCode.NTE_BUFFER_TOO_SMALL) { output = new byte[numBytesNeeded]; - errorCode = encryptOrDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode); + errorCode = encrypt ? + Interop.NCrypt.NCryptEncrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode) : + Interop.NCrypt.NCryptDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode); + } if (errorCode != ErrorCode.ERROR_SUCCESS) + { throw errorCode.ToCryptographicException(); + } Array.Resize(ref output, numBytesNeeded); return output; } - // Delegate binds to either NCryptEncrypt() or NCryptDecrypt() depending on which api was called. - private unsafe delegate ErrorCode EncryptOrDecryptAction(SafeNCryptKeyHandle hKey, byte[] pbInput, int cbInput, void* pPaddingInfo, byte[] pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags); + // Now that the padding mode and information have been marshaled to their native counterparts, perform the encryption or decryption. + private unsafe bool TryEncryptOrDecrypt(SafeNCryptKeyHandle key, ReadOnlySpan input, Span output, AsymmetricPaddingMode paddingMode, void* paddingInfo, bool encrypt, out int bytesWritten) + { + int numBytesNeeded; + ErrorCode errorCode = encrypt ? + Interop.NCrypt.NCryptEncrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode) : + Interop.NCrypt.NCryptDecrypt(key, input, input.Length, paddingInfo, output, output.Length, out numBytesNeeded, paddingMode); + + switch (errorCode) + { + case ErrorCode.ERROR_SUCCESS: + bytesWritten = numBytesNeeded; + return true; + case ErrorCode.NTE_BUFFER_TOO_SMALL: + bytesWritten = 0; + return false; + default: + throw errorCode.ToCryptographicException(); + } + } } #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS } diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs b/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs index 04b84dbe91..5da42605df 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.SignVerify.cs @@ -2,14 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Diagnostics; - +using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; - using Internal.Cryptography; -using ErrorCode = Interop.NCrypt.ErrorCode; using AsymmetricPaddingMode = Interop.NCrypt.AsymmetricPaddingMode; using BCRYPT_PKCS1_PADDING_INFO = Interop.BCrypt.BCRYPT_PKCS1_PADDING_INFO; using BCRYPT_PSS_PADDING_INFO = Interop.BCrypt.BCRYPT_PSS_PADDING_INFO; @@ -28,22 +24,85 @@ namespace System.Security.Cryptography public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { if (hash == null) - throw new ArgumentNullException(nameof(hash)); - - unsafe { - byte[] signature = null; - SignOrVerify(padding, hashAlgorithm, hash, - delegate (AsymmetricPaddingMode paddingMode, void* pPaddingInfo) + throw new ArgumentNullException(nameof(hash)); + } + + string hashAlgorithmName = hashAlgorithm.Name; + if (string.IsNullOrEmpty(hashAlgorithmName)) + { + throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm)); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + IntPtr namePtr = Marshal.StringToHGlobalUni(hashAlgorithmName); + try + { + unsafe { int estimatedSize = KeySize / 8; - using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + switch (padding.Mode) { - signature = keyHandle.SignHash(hash, paddingMode, pPaddingInfo, estimatedSize); + case RSASignaturePaddingMode.Pkcs1: + var pkcsPaddingInfo = new BCRYPT_PKCS1_PADDING_INFO() { pszAlgId = namePtr }; + return keyHandle.SignHash(hash, AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, &pkcsPaddingInfo, estimatedSize); + + case RSASignaturePaddingMode.Pss: + var pssPaddingInfo = new BCRYPT_PSS_PADDING_INFO() { pszAlgId = namePtr, cbSalt = hash.Length }; + return keyHandle.SignHash(hash, AsymmetricPaddingMode.NCRYPT_PAD_PSS_FLAG, &pssPaddingInfo, estimatedSize); + + default: + throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); } } - ); - return signature; + } + finally + { + Marshal.FreeHGlobal(namePtr); + } + } + } + + public override unsafe bool TrySignHash(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) + { + string hashAlgorithmName = hashAlgorithm.Name; + if (string.IsNullOrEmpty(hashAlgorithmName)) + { + throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm)); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + IntPtr namePtr = Marshal.StringToHGlobalUni(hashAlgorithmName); + try + { + switch (padding.Mode) + { + case RSASignaturePaddingMode.Pkcs1: + var pkcs1PaddingInfo = new BCRYPT_PKCS1_PADDING_INFO() { pszAlgId = namePtr }; + return keyHandle.TrySignHash(source, destination, AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, &pkcs1PaddingInfo, out bytesWritten); + + case RSASignaturePaddingMode.Pss: + var pssPaddingInfo = new BCRYPT_PSS_PADDING_INFO() { pszAlgId = namePtr, cbSalt = source.Length }; + return keyHandle.TrySignHash(source, destination, AsymmetricPaddingMode.NCRYPT_PAD_PSS_FLAG, &pssPaddingInfo, out bytesWritten); + + default: + throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); + } + } + finally + { + Marshal.FreeHGlobal(namePtr); + } } } @@ -53,74 +112,54 @@ namespace System.Security.Cryptography public override bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { if (hash == null) - throw new ArgumentNullException(nameof(hash)); - if (signature == null) - throw new ArgumentNullException(nameof(signature)); - - unsafe { - bool verified = false; - SignOrVerify(padding, hashAlgorithm, hash, - delegate (AsymmetricPaddingMode paddingMode, void* pPaddingInfo) - { - using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) - { - verified = keyHandle.VerifyHash(hash, signature, paddingMode, pPaddingInfo); - } - } - ); - return verified; + throw new ArgumentNullException(nameof(hash)); } + if (signature == null) + { + throw new ArgumentNullException(nameof(signature)); + } + + return VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature, hashAlgorithm, padding); } - // - // Common helper for SignHash() and VerifyHash(). Creates the necessary PADDING_INFO structure based on the chosen padding mode and then passes it - // to "signOrVerify" which performs the actual signing or verification. - // - private static unsafe void SignOrVerify(RSASignaturePadding padding, HashAlgorithmName hashAlgorithm, byte[] hash, SignOrVerifyAction signOrVerify) + public override unsafe bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { string hashAlgorithmName = hashAlgorithm.Name; if (string.IsNullOrEmpty(hashAlgorithmName)) - throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm)); - - if (padding == null) - throw new ArgumentNullException(nameof(padding)); - - switch (padding.Mode) { - case RSASignaturePaddingMode.Pkcs1: - { - using (SafeUnicodeStringHandle safeHashAlgorithmName = new SafeUnicodeStringHandle(hashAlgorithmName)) - { - BCRYPT_PKCS1_PADDING_INFO paddingInfo = new BCRYPT_PKCS1_PADDING_INFO() - { - pszAlgId = safeHashAlgorithmName.DangerousGetHandle(), - }; - signOrVerify(AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, &paddingInfo); - } - break; - } + throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm)); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } - case RSASignaturePaddingMode.Pss: + using (SafeNCryptKeyHandle keyHandle = GetDuplicatedKeyHandle()) + { + IntPtr namePtr = Marshal.StringToHGlobalUni(hashAlgorithmName); + try + { + switch (padding.Mode) { - using (SafeUnicodeStringHandle safeHashAlgorithmName = new SafeUnicodeStringHandle(hashAlgorithmName)) - { - BCRYPT_PSS_PADDING_INFO paddingInfo = new BCRYPT_PSS_PADDING_INFO() - { - pszAlgId = safeHashAlgorithmName.DangerousGetHandle(), - cbSalt = hash.Length, - }; - signOrVerify(AsymmetricPaddingMode.NCRYPT_PAD_PSS_FLAG, &paddingInfo); - } - break; - } + case RSASignaturePaddingMode.Pkcs1: + var pkcs1PaddingInfo = new BCRYPT_PKCS1_PADDING_INFO() { pszAlgId = namePtr }; + return keyHandle.VerifyHash(hash, signature, AsymmetricPaddingMode.NCRYPT_PAD_PKCS1_FLAG, &pkcs1PaddingInfo); - default: - throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); + case RSASignaturePaddingMode.Pss: + var pssPaddingInfo = new BCRYPT_PSS_PADDING_INFO() { pszAlgId = namePtr, cbSalt = hash.Length }; + return keyHandle.VerifyHash(hash, signature, AsymmetricPaddingMode.NCRYPT_PAD_PSS_FLAG, &pssPaddingInfo); + + default: + throw new CryptographicException(SR.Cryptography_UnsupportedPaddingMode); + } + } + finally + { + Marshal.FreeHGlobal(namePtr); + } } } - - private unsafe delegate void SignOrVerifyAction(AsymmetricPaddingMode paddingMode, void* pPaddingInfo); } #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS } diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.cs b/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.cs index 83305d1289..2899ab70dc 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/RSACng.cs @@ -47,15 +47,14 @@ namespace System.Security.Cryptography } } - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return CngCommon.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + CngCommon.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return CngCommon.HashData(data, hashAlgorithm); - } + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + CngCommon.TryHashData(source, destination, hashAlgorithm, out bytesWritten); + + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + CngCommon.HashData(data, hashAlgorithm); private void ForceSetKeySize(int newKeySize) { diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/RSAOpenSsl.cs b/external/corefx/src/Common/src/System/Security/Cryptography/RSAOpenSsl.cs index a2a68937d0..d2d6268fa2 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/RSAOpenSsl.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/RSAOpenSsl.cs @@ -13,10 +13,7 @@ namespace System.Security.Cryptography #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS public partial class RSA : AsymmetricAlgorithm { - public static new RSA Create() - { - return new RSAImplementation.RSAOpenSsl(); - } + public static new RSA Create() => new RSAImplementation.RSAOpenSsl(); } internal static partial class RSAImplementation @@ -123,6 +120,35 @@ namespace System.Security.Cryptography return plainBytes; } + public override bool TryDecrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) + { + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + Interop.Crypto.RsaPadding rsaPadding = GetInteropPadding(padding); + SafeRsaHandle key = _key.Value; + CheckInvalidKey(key); + + if (destination.Length < Interop.Crypto.RsaSize(key)) + { + bytesWritten = 0; + return false; + } + + int returnValue = Interop.Crypto.RsaPrivateDecrypt(source.Length, source, destination, key, rsaPadding); + CheckReturn(returnValue); + + // If the padding mode is RSA_NO_PADDING then the size of the decrypted block + // will be RSA_size. If any padding was used, then some amount (determined by the padding algorithm) + // will have been reduced, and only returnValue bytes were part of the decrypted + // body. Either way, we can just use returnValue, but some additional bytes may have been overwritten + // in the destination span. + bytesWritten = returnValue; + return true; + } + public override byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) { if (data == null) @@ -148,22 +174,35 @@ namespace System.Security.Cryptography return buf; } - private static Interop.Crypto.RsaPadding GetInteropPadding(RSAEncryptionPadding padding) + public override bool TryEncrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) { - if (padding == RSAEncryptionPadding.Pkcs1) + if (padding == null) { - return Interop.Crypto.RsaPadding.Pkcs1; + throw new ArgumentNullException(nameof(padding)); } - else if (padding == RSAEncryptionPadding.OaepSHA1) + + Interop.Crypto.RsaPadding rsaPadding = GetInteropPadding(padding); + SafeRsaHandle key = _key.Value; + CheckInvalidKey(key); + + if (destination.Length < Interop.Crypto.RsaSize(key)) { - return Interop.Crypto.RsaPadding.OaepSHA1; - } - else - { - throw PaddingModeNotSupported(); + bytesWritten = 0; + return false; } + + int returnValue = Interop.Crypto.RsaPublicEncrypt(source.Length, source, destination, key, rsaPadding); + CheckReturn(returnValue); + + bytesWritten = returnValue; + return true; } + private static Interop.Crypto.RsaPadding GetInteropPadding(RSAEncryptionPadding padding) => + padding == RSAEncryptionPadding.Pkcs1 ? Interop.Crypto.RsaPadding.Pkcs1 : + padding == RSAEncryptionPadding.OaepSHA1 ? Interop.Crypto.RsaPadding.OaepSHA1 : + throw PaddingModeNotSupported(); + public override RSAParameters ExportParameters(bool includePrivateParameters) { // It's entirely possible that this line will cause the key to be generated in the first place. @@ -223,7 +262,7 @@ namespace System.Security.Cryptography } FreeKey(); - _key = new Lazy(() => key, isThreadSafe:true); + _key = new Lazy(key); // Use ForceSet instead of the property setter to ensure that LegalKeySizes doesn't interfere // with the already loaded key. @@ -245,11 +284,7 @@ namespace System.Security.Cryptography if (_key != null && _key.IsValueCreated) { SafeRsaHandle handle = _key.Value; - - if (handle != null) - { - handle.Dispose(); - } + handle?.Dispose(); } } @@ -308,12 +343,10 @@ namespace System.Security.Cryptography private static void CheckBoolReturn(int returnValue) { - if (returnValue == 1) + if (returnValue != 1) { - return; + throw Interop.Crypto.CreateOpenSslCryptographicException(); } - - throw Interop.Crypto.CreateOpenSslCryptographicException(); } private SafeRsaHandle GenerateKey() @@ -350,15 +383,14 @@ namespace System.Security.Cryptography return key; } - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { @@ -404,6 +436,42 @@ namespace System.Security.Cryptography return signature; } + public override bool TrySignHash(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + if (padding != RSASignaturePadding.Pkcs1) + { + throw PaddingModeNotSupported(); + } + + int algorithmNid = GetAlgorithmNid(hashAlgorithm); + SafeRsaHandle rsa = _key.Value; + + int bytesRequired = Interop.Crypto.RsaSize(rsa); + if (destination.Length < bytesRequired) + { + bytesWritten = 0; + return false; + } + + int signatureSize; + if (!Interop.Crypto.RsaSign(algorithmNid, source, source.Length, destination, out signatureSize, rsa)) + { + throw Interop.Crypto.CreateOpenSslCryptographicException(); + } + + Debug.Assert(signatureSize == bytesRequired, $"RSA_sign reported signatureSize was {signatureSize}, when {bytesRequired} was expected"); + bytesWritten = signatureSize; + return true; + } + public override bool VerifyHash( byte[] hash, byte[] signature, @@ -411,29 +479,35 @@ namespace System.Security.Cryptography RSASignaturePadding padding) { if (hash == null) + { throw new ArgumentNullException(nameof(hash)); - if (string.IsNullOrEmpty(hashAlgorithm.Name)) - throw HashAlgorithmNameNullOrEmpty(); - if (padding == null) - throw new ArgumentNullException(nameof(padding)); - if (padding != RSASignaturePadding.Pkcs1) - throw PaddingModeNotSupported(); + } + if (signature == null) + { + throw new ArgumentNullException(nameof(signature)); + } - return VerifyHash(hash, signature, hashAlgorithm); + return VerifyHash(new ReadOnlySpan(hash), new ReadOnlySpan(signature), hashAlgorithm, padding); } - private bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithmName) + public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { - int algorithmNid = GetAlgorithmNid(hashAlgorithmName); - SafeRsaHandle rsa = _key.Value; + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + if (padding != RSASignaturePadding.Pkcs1) + { + throw PaddingModeNotSupported(); + } - return Interop.Crypto.RsaVerify( - algorithmNid, - hash, - hash.Length, - signature, - signature.Length, - rsa); + int algorithmNid = GetAlgorithmNid(hashAlgorithm); + SafeRsaHandle rsa = _key.Value; + return Interop.Crypto.RsaVerify(algorithmNid, hash, hash.Length, signature, signature.Length, rsa); } private static int GetAlgorithmNid(HashAlgorithmName hashAlgorithmName) @@ -452,15 +526,11 @@ namespace System.Security.Cryptography return nid; } - private static Exception PaddingModeNotSupported() - { - return new CryptographicException(SR.Cryptography_InvalidPaddingMode); - } + private static Exception PaddingModeNotSupported() => + new CryptographicException(SR.Cryptography_InvalidPaddingMode); - private static Exception HashAlgorithmNameNullOrEmpty() - { - return new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); - } + private static Exception HashAlgorithmNameNullOrEmpty() => + new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); } #if INTERNAL_ASYMMETRIC_IMPLEMENTATIONS } diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs b/external/corefx/src/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs index e70a4d6aa4..23ba66fcdb 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs @@ -157,11 +157,39 @@ namespace System.Security.Cryptography public override byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + return Interop.AppleCrypto.RsaEncrypt(GetKeys().PublicKey, data, padding); } + public override bool TryEncrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) + { + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + return Interop.AppleCrypto.TryRsaEncrypt(GetKeys().PublicKey, source, destination, padding, out bytesWritten); + } + public override byte[] Decrypt(byte[] data, RSAEncryptionPadding padding) { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + SecKeyPair keys = GetKeys(); if (keys.PrivateKey == null) @@ -172,10 +200,29 @@ namespace System.Security.Cryptography return Interop.AppleCrypto.RsaDecrypt(keys.PrivateKey, data, padding); } + public override bool TryDecrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) + { + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + SecKeyPair keys = GetKeys(); + + if (keys.PrivateKey == null) + { + throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey); + } + + return Interop.AppleCrypto.TryRsaDecrypt(keys.PrivateKey, source, destination, padding, out bytesWritten); + } + public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { if (hash == null) throw new ArgumentNullException(nameof(hash)); + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + throw HashAlgorithmNameNullOrEmpty(); if (padding == null) throw new ArgumentNullException(nameof(padding)); if (padding != RSASignaturePadding.Pkcs1) @@ -210,35 +257,89 @@ namespace System.Security.Cryptography palAlgId); } + public override bool TrySignHash(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + if (padding != RSASignaturePadding.Pkcs1) + { + throw new CryptographicException(SR.Cryptography_InvalidPaddingMode); + } + + SecKeyPair keys = GetKeys(); + + if (keys.PrivateKey == null) + { + throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey); + } + + Interop.AppleCrypto.PAL_HashAlgorithm palAlgId = PalAlgorithmFromAlgorithmName(hashAlgorithm, out int expectedSize); + if (source.Length != expectedSize) + { + // Windows: NTE_BAD_DATA ("Bad Data.") + // OpenSSL: RSA_R_INVALID_MESSAGE_LENGTH ("invalid message length") + throw new CryptographicException( + SR.Format( + SR.Cryptography_BadHashSize_ForAlgorithm, + source.Length, + expectedSize, + hashAlgorithm.Name)); + } + + return Interop.AppleCrypto.TryGenerateSignature(keys.PrivateKey, source, destination, palAlgId, out bytesWritten); + } + public override bool VerifyHash( byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { + if (hash == null) + { + throw new ArgumentNullException(nameof(hash)); + } + if (signature == null) + { + throw new ArgumentNullException(nameof(signature)); + } + + return VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature, hashAlgorithm, padding); + } + + public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } if (padding != RSASignaturePadding.Pkcs1) + { throw new CryptographicException(SR.Cryptography_InvalidPaddingMode); + } - int expectedSize; - Interop.AppleCrypto.PAL_HashAlgorithm palAlgId = - PalAlgorithmFromAlgorithmName(hashAlgorithm, out expectedSize); - - return Interop.AppleCrypto.VerifySignature( - GetKeys().PublicKey, - hash, - signature, - palAlgId); + Interop.AppleCrypto.PAL_HashAlgorithm palAlgId = PalAlgorithmFromAlgorithmName(hashAlgorithm, out int expectedSize); + return Interop.AppleCrypto.VerifySignature(GetKeys().PublicKey, hash, signature, palAlgId); } - protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - } + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); - protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) - { - return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); - } + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); + + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); protected override void Dispose(bool disposing) { @@ -326,6 +427,9 @@ namespace System.Security.Cryptography return Interop.AppleCrypto.ImportEphemeralKey(pkcs1Blob, isPrivateKey); } } + + private static Exception HashAlgorithmNameNullOrEmpty() => + new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); } internal static class RsaKeyBlobHelpers diff --git a/external/corefx/src/Common/tests/Common.Tests.csproj b/external/corefx/src/Common/tests/Common.Tests.csproj index 97970dc36e..17d4fd760d 100644 --- a/external/corefx/src/Common/tests/Common.Tests.csproj +++ b/external/corefx/src/Common/tests/Common.Tests.csproj @@ -7,10 +7,10 @@ true - - - - + + + + @@ -18,12 +18,18 @@ Common\System\Collections\DictionaryExtensions.cs + + Common\System\Security\Cryptography\ByteUtils.cs + Common\Interop\Linux\procfs\Interop.ProcFsStat.cs Common\System\CharArrayHelpers.cs + + Common\System\Marvin.cs + Common\System\StringExtensions.cs @@ -64,6 +70,7 @@ + diff --git a/external/corefx/src/Common/tests/Configurations.props b/external/corefx/src/Common/tests/Configurations.props index cfc57211a4..17d3231f8e 100644 --- a/external/corefx/src/Common/tests/Configurations.props +++ b/external/corefx/src/Common/tests/Configurations.props @@ -2,8 +2,8 @@ - netstandard-Unix; - netstandard-Windows_NT; + netcoreapp-Unix; + netcoreapp-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/Common/tests/System/Buffers/NativeOwnedMemory.cs b/external/corefx/src/Common/tests/System/Buffers/NativeOwnedMemory.cs new file mode 100644 index 0000000000..31d90b35bf --- /dev/null +++ b/external/corefx/src/Common/tests/System/Buffers/NativeOwnedMemory.cs @@ -0,0 +1,110 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace System.IO.Tests +{ + internal sealed class NativeOwnedMemory : OwnedMemory + { + private readonly int _length; + private IntPtr _ptr; + private int _retainedCount; + private bool _disposed; + + public NativeOwnedMemory(int length) + { + _length = length; + _ptr = Marshal.AllocHGlobal(length); + } + + ~NativeOwnedMemory() + { + Debug.WriteLine($"{nameof(NativeOwnedMemory)} being finalized"); + Dispose(false); + } + + public override bool IsDisposed + { + get + { + lock (this) + { + return _disposed && _retainedCount == 0; + } + } + } + + public override int Length => _length; + + protected override bool IsRetained + { + get + { + lock (this) + { + return _retainedCount > 0; + } + } + } + + public override unsafe Span Span => new Span((void*)_ptr, _length); + + public override unsafe MemoryHandle Pin() => new MemoryHandle(this, (void*)_ptr); + + public override bool Release() + { + lock (this) + { + if (_retainedCount > 0) + { + _retainedCount--; + if (_retainedCount == 0) + { + if (_disposed) + { + Marshal.FreeHGlobal(_ptr); + _ptr = IntPtr.Zero; + } + return true; + } + } + } + return false; + } + + public override void Retain() + { + lock (this) + { + if (_retainedCount == 0 && _disposed) + { + throw new Exception(); + } + _retainedCount++; + } + } + + protected override void Dispose(bool disposing) + { + lock (this) + { + _disposed = true; + if (_retainedCount == 0) + { + Marshal.FreeHGlobal(_ptr); + _ptr = IntPtr.Zero; + } + } + } + + protected override bool TryGetArray(out ArraySegment arraySegment) + { + arraySegment = default(ArraySegment); + return false; + } + } +} diff --git a/external/corefx/src/Common/tests/System/Collections/DebugView.Tests.cs b/external/corefx/src/Common/tests/System/Collections/DebugView.Tests.cs index c45b876c3d..d6abd27cd9 100644 --- a/external/corefx/src/Common/tests/System/Collections/DebugView.Tests.cs +++ b/external/corefx/src/Common/tests/System/Collections/DebugView.Tests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Reflection; using Xunit; @@ -29,6 +30,35 @@ namespace System.Collections.Tests yield return new object[] { new SortedDictionary().Values }; yield return new object[] { new SortedList().Keys }; yield return new object[] { new SortedList().Values }; + + yield return new object[] { new Dictionary{{1, "One"}, {2, "Two"}} }; + yield return new object[] { new HashSet{"One", "Two"} }; + + LinkedList linkedList = new LinkedList(); + linkedList.AddFirst(1); + linkedList.AddLast(2); + yield return new object[] { linkedList }; + yield return new object[] { new List{1, 2} }; + + Queue queue = new Queue(); + queue.Enqueue(1); + queue.Enqueue(2); + yield return new object[] { queue }; + yield return new object[] { new SortedDictionary{{"One", 1}, {"Two", 2}} }; + yield return new object[] { new SortedList{{1, "One"}, {2, "Two"}} }; + yield return new object[] { new SortedSet{1, 2} }; + + var stack = new Stack(); + stack.Push(1); + stack.Push(2); + yield return new object[] { stack }; + + yield return new object[] { new Dictionary{{1.0, 1.0f}, {2.0, 2.0f}}.Keys }; + yield return new object[] { new Dictionary{{1.0f, 1.0}, {2.0f, 2.0}}.Values }; + yield return new object[] { new SortedDictionary{{Guid.NewGuid(), "One"}, {Guid.NewGuid(), "Two"}}.Keys }; + yield return new object[] { new SortedDictionary{{1L, Guid.NewGuid()}, {2L, Guid.NewGuid()}}.Values }; + yield return new object[] { new SortedList{{"One", 1}, {"Two", 2}}.Keys }; + yield return new object[] { new SortedList{{1f, 1L}, {2f, 2L}}.Values }; } [Theory] @@ -37,7 +67,10 @@ namespace System.Collections.Tests public static void TestDebuggerAttributes(object obj) { DebuggerAttributes.ValidateDebuggerDisplayReferences(obj); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(obj); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(obj); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + Array items = itemProperty.GetValue(info.Instance) as Array; + Assert.Equal((obj as IEnumerable).Cast().ToArray(), items.Cast()); } [Theory] @@ -46,7 +79,8 @@ namespace System.Collections.Tests public static void TestDebuggerAttributes_Null(object obj) { Type proxyType = DebuggerAttributes.GetProxyType(obj); - Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } } } diff --git a/external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs b/external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs index f8cb724125..1f8e60884b 100644 --- a/external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs +++ b/external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs @@ -208,7 +208,7 @@ namespace System.Collections.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] [MemberData(nameof(ValidCollectionSizes))] public virtual void ICollection_NonGeneric_CopyTo_NonZeroLowerBound(int count) { diff --git a/external/corefx/src/Common/tests/System/Collections/ICollectionTest.cs b/external/corefx/src/Common/tests/System/Collections/ICollectionTest.cs index a976fffad1..a70ead4128 100644 --- a/external/corefx/src/Common/tests/System/Collections/ICollectionTest.cs +++ b/external/corefx/src/Common/tests/System/Collections/ICollectionTest.cs @@ -122,7 +122,7 @@ namespace Tests.Collections CollectionAssert.Equal(items, items2); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public void CopyToArrayWithNonZeroBounds() { object[] items = GenerateItems(16); diff --git a/external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs b/external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs index 49ab60dfb8..664edc34a1 100644 --- a/external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs +++ b/external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs @@ -3,8 +3,11 @@ // See the LICENSE file in the project root for more information. using System; +using System.IO; using System.Reflection; +using System.Text; using System.Threading.Tasks; +using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; namespace RemoteExecutorConsoleApp @@ -19,9 +22,9 @@ namespace RemoteExecutorConsoleApp // The program expects to be passed the target assembly name to load, the type // from that assembly to find, and the method from that assembly to invoke. // Any additional arguments are passed as strings to the method. - if (args.Length < 3) + if (args.Length < 4) { - Console.Error.WriteLine("Usage: {0} assemblyName typeName methodName", typeof(Program).GetTypeInfo().Assembly.GetName().Name); + Console.Error.WriteLine("Usage: {0} assemblyName typeName methodName exceptionFile [additionalArgs]", typeof(Program).GetTypeInfo().Assembly.GetName().Name); Environment.Exit(-1); return -1; } @@ -29,8 +32,9 @@ namespace RemoteExecutorConsoleApp string assemblyName = args[0]; string typeName = args[1]; string methodName = args[2]; - string[] additionalArgs = args.Length > 3 ? - args.Subarray(3, args.Length - 3) : + string exceptionFile = args[3]; + string[] additionalArgs = args.Length > 4 ? + args.Subarray(4, args.Length - 4) : Array.Empty(); // Load the specified assembly, type, and method, then invoke the method. @@ -39,7 +43,7 @@ namespace RemoteExecutorConsoleApp Type t = null; MethodInfo mi = null; object instance = null; - int exitCode; + int exitCode = int.MaxValue; try { // Create the test class if necessary @@ -59,12 +63,27 @@ namespace RemoteExecutorConsoleApp } catch (Exception exc) { - Console.Error.WriteLine("Exception from RemoteExecutorConsoleApp({0}):", string.Join(", ", args)); - Console.Error.WriteLine("Assembly: {0}", a); - Console.Error.WriteLine("Type: {0}", t); - Console.Error.WriteLine("Method: {0}", mi); - Console.Error.WriteLine("Exception: {0}", exc); - throw exc; + if (exc is TargetInvocationException && exc.InnerException != null) + exc = exc.InnerException; + + var output = new StringBuilder(); + output.AppendLine(); + output.AppendLine("Child exception:"); + output.AppendLine(" " + exc); + output.AppendLine(); + output.AppendLine("Child process:"); + output.AppendLine(String.Format(" {0} {1} {2}", a, t, mi)); + output.AppendLine(); + + if (additionalArgs.Length > 0) + { + output.AppendLine("Child arguments:"); + output.AppendLine(" " + string.Join(", ", additionalArgs)); + } + + File.WriteAllText(exceptionFile, output.ToString()); + + ExceptionDispatchInfo.Capture(exc).Throw(); } finally { diff --git a/external/corefx/src/Common/tests/System/DirectoryServices/LdapConfiguration.cs b/external/corefx/src/Common/tests/System/DirectoryServices/LdapConfiguration.cs new file mode 100644 index 0000000000..b571d42170 --- /dev/null +++ b/external/corefx/src/Common/tests/System/DirectoryServices/LdapConfiguration.cs @@ -0,0 +1,156 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Xml.Linq; + +namespace System.DirectoryServices.Tests +{ + internal class LdapConfiguration + { + private LdapConfiguration(string serverName, string domain, string userName, string password, string port, AuthenticationTypes at) + { + ServerName = serverName; + Domain = domain; + UserName = userName; + Password = password; + Port = port; + AuthenticationTypes = at; + } + + private static LdapConfiguration s_ldapConfiguration = GetConfiguration("LDAP.Configuration.xml"); + + internal static LdapConfiguration Configuration => s_ldapConfiguration; + + internal string ServerName { get; set; } + internal string UserName { get; set; } + internal string Password { get; set; } + internal string Port { get; set; } + internal string Domain { get; set; } + internal AuthenticationTypes AuthenticationTypes { get; set; } + internal string LdapPath => String.IsNullOrEmpty(Port) ? $"LDAP://{ServerName}/{Domain}" : $"LDAP://{ServerName}:{Port}/{Domain}"; + internal string RootDSEPath => String.IsNullOrEmpty(Port) ? $"LDAP://{ServerName}/rootDSE" : $"LDAP://{ServerName}:{Port}/rootDSE"; + internal string UserNameWithNoDomain + { + get + { + string [] parts = UserName.Split('\\'); + if (parts.Length > 1) + return parts[parts.Length - 1]; + + parts = UserName.Split('@'); + if (parts.Length > 1) + return parts[0]; + + return UserName; + } + } + + internal string GetLdapPath(string prefix) // like "ou=something" + { + return String.IsNullOrEmpty(Port) ? $"LDAP://{ServerName}/{prefix},{Domain}" : $"LDAP://{ServerName}:{Port}/{prefix},{Domain}"; + } + + private const string LDAP_CAP_ACTIVE_DIRECTORY_OID = "1.2.840.113556.1.4.800"; + + internal bool IsActiveDirectoryServer + { + get + { + try + { + using (DirectoryEntry rootDse = new DirectoryEntry(LdapConfiguration.Configuration.RootDSEPath, + LdapConfiguration.Configuration.UserName, + LdapConfiguration.Configuration.Password, + LdapConfiguration.Configuration.AuthenticationTypes)) + { + return rootDse.Properties["supportedCapabilities"].Contains(LDAP_CAP_ACTIVE_DIRECTORY_OID); + } + } + catch + { + return false; + } + } + } + + internal static LdapConfiguration GetConfiguration(string configFile) + { + if (!File.Exists(configFile)) + return null; + + LdapConfiguration ldapConfig = null; + try + { + string serverName = ""; + string domain = ""; + string port = ""; + string user = ""; + string password = ""; + AuthenticationTypes at = AuthenticationTypes.None; + + XElement config = XDocument.Load(configFile).Element("Configuration"); + if (config != null) + { + XElement child = config.Element("ServerName"); + if (child != null) + serverName = child.Value; + + child = config.Element("Domain"); + if (child != null) + domain = child.Value; + + child = config.Element("Port"); + if (child != null) + port = child.Value; + + child = config.Element("User"); + if (child != null) + user = child.Value; + + child = config.Element("Password"); + if (child != null) + password = child.Value; + + child = config.Element("AuthenticationTypes"); + if (child != null) + { + string[] parts = child.Value.Split(','); + foreach (string p in parts) + { + string s = p.Trim(); + if (s.Equals("Anonymous", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.Anonymous; + if (s.Equals("Delegation", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.Delegation; + if (s.Equals("Encryption", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.FastBind; + if (s.Equals("FastBind", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.FastBind; + if (s.Equals("ReadonlyServer", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.ReadonlyServer; + if (s.Equals("Sealing", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.Sealing; + if (s.Equals("Secure", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.Secure; + if (s.Equals("SecureSocketsLayer", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.SecureSocketsLayer; + if (s.Equals("ServerBind", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.ServerBind; + if (s.Equals("Signing", StringComparison.OrdinalIgnoreCase)) + at |= AuthenticationTypes.Signing; + } + } + + ldapConfig = new LdapConfiguration(serverName, domain, user, password, port, at); + } + } + catch + { + // Couldn't read the configurations, usually we'll skip the tests which depend on that + } + return ldapConfig; + } + } +} \ No newline at end of file diff --git a/external/corefx/src/Common/tests/System/IO/Compression/ZipTestHelper.cs b/external/corefx/src/Common/tests/System/IO/Compression/ZipTestHelper.cs index d00979c95a..4ae8d40efa 100644 --- a/external/corefx/src/Common/tests/System/IO/Compression/ZipTestHelper.cs +++ b/external/corefx/src/Common/tests/System/IO/Compression/ZipTestHelper.cs @@ -279,7 +279,7 @@ namespace System.IO.Compression.Tests } } - public static async Task CreateFromDir(string directory, Stream archiveStream, ZipArchiveMode mode) + public static async Task CreateFromDir(string directory, Stream archiveStream, ZipArchiveMode mode, bool useSpansForWriting = false) { var files = FileData.InPath(directory); using (ZipArchive archive = new ZipArchive(archiveStream, mode, true)) @@ -309,7 +309,22 @@ namespace System.IO.Compression.Tests e.LastWriteTime = i.LastModifiedDate; using (Stream entryStream = e.Open()) { - installStream.CopyTo(entryStream); + int bytesRead; + var buffer = new byte[1024]; + if (useSpansForWriting) + { + while ((bytesRead = installStream.Read(new Span(buffer))) != 0) + { + entryStream.Write(new ReadOnlySpan(buffer, 0, bytesRead)); + } + } + else + { + while ((bytesRead = installStream.Read(buffer, 0, buffer.Length)) != 0) + { + entryStream.Write(buffer, 0, bytesRead); + } + } } } } diff --git a/external/corefx/src/Common/tests/System/IO/DelegateStream.cs b/external/corefx/src/Common/tests/System/IO/DelegateStream.cs index 29aa5559ad..8af013cac9 100644 --- a/external/corefx/src/Common/tests/System/IO/DelegateStream.cs +++ b/external/corefx/src/Common/tests/System/IO/DelegateStream.cs @@ -52,16 +52,12 @@ namespace System.IO _positionSetFunc = positionSetFunc ?? (_ => { throw new NotSupportedException(); }); _positionGetFunc = positionGetFunc ?? (() => { throw new NotSupportedException(); }); - if (readAsyncFunc != null && readFunc == null) - throw new InvalidOperationException("If reads are supported, must provide a synchronous read implementation"); _readFunc = readFunc; _readAsyncFunc = readAsyncFunc ?? ((buffer, offset, count, token) => base.ReadAsync(buffer, offset, count, token)); _seekFunc = seekFunc ?? ((_, __) => { throw new NotSupportedException(); }); _setLengthFunc = setLengthFunc ?? (_ => { throw new NotSupportedException(); }); - if (writeAsyncFunc != null && writeFunc == null) - throw new InvalidOperationException("If writes are supported, must provide a synchronous write implementation"); _writeFunc = writeFunc; _writeAsyncFunc = writeAsyncFunc ?? ((buffer, offset, count, token) => base.WriteAsync(buffer, offset, count, token)); } diff --git a/external/corefx/src/Common/tests/System/IO/StreamSpanExtensions.netstandard.cs b/external/corefx/src/Common/tests/System/IO/StreamSpanExtensions.netstandard.cs new file mode 100644 index 0000000000..f7520a3611 --- /dev/null +++ b/external/corefx/src/Common/tests/System/IO/StreamSpanExtensions.netstandard.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +/// Extensions to enable the tests to use the span-based Read/Write methods that only exist in netcoreapp. +internal static class StreamSpanExtensions +{ + // These implementations are inefficient and are just for testing purposes. + + public static int Read(this Stream stream, Span destination) + { + byte[] array = new byte[destination.Length]; + int bytesRead = stream.Read(array, 0, array.Length); + new Span(array, 0, bytesRead).CopyTo(destination); + return bytesRead; + } + + public static void Write(this Stream stream, ReadOnlySpan source) => + stream.Write(source.ToArray(), 0, source.Length); + + public static ValueTask ReadAsync(this Stream stream, Memory destination, CancellationToken cancellationToken = default(CancellationToken)) + { + byte[] array = new byte[destination.Length]; + return new ValueTask(stream.ReadAsync(array, 0, array.Length, cancellationToken).ContinueWith(t => + { + int bytesRead = t.GetAwaiter().GetResult(); + new Span(array, 0, bytesRead).CopyTo(destination.Span); + return bytesRead; + })); + } + + public static Task WriteAsync(this Stream stream, ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) => + stream.WriteAsync(source.ToArray(), 0, source.Length, cancellationToken); +} diff --git a/external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs b/external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs index 4acd18b86f..b930eff7e3 100644 --- a/external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs +++ b/external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections; using System.Collections.Generic; namespace System.Linq.Tests @@ -11,7 +10,7 @@ namespace System.Linq.Tests { public static IEnumerable EnumerableData() { - IEnumerable sourceCounts = new[] { 1, 2, 3, 5, 8, 13, 55, 100, 250 }; + IEnumerable sourceCounts = new[] { 0, 1, 2, 3, 5, 8, 13, 55, 100, 250 }; IEnumerable counts = new[] { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 100, 250, 500, int.MaxValue }; counts = counts.Concat(counts.Select(c => -c)).Append(0).Append(int.MinValue); @@ -36,4 +35,4 @@ namespace System.Linq.Tests }); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/Common/tests/System/Net/Http/LoopbackServer.cs b/external/corefx/src/Common/tests/System/Net/Http/LoopbackServer.cs index f4578d1191..25f6fcb451 100644 --- a/external/corefx/src/Common/tests/System/Net/Http/LoopbackServer.cs +++ b/external/corefx/src/Common/tests/System/Net/Http/LoopbackServer.cs @@ -29,6 +29,7 @@ namespace System.Net.Test.Common public bool UseSsl { get; set; } = false; public SslProtocols SslProtocols { get; set; } = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; public bool WebSocketEndpoint { get; set; } = false; + public Func ResponseStreamWrapper { get; set; } } public static Task CreateServerAsync(Func funcAsync, Options options = null) @@ -174,7 +175,7 @@ namespace System.Net.Test.Common } using (var reader = new StreamReader(stream, Encoding.ASCII)) - using (var writer = new StreamWriter(stream, Encoding.ASCII) { AutoFlush = true }) + using (var writer = new StreamWriter(options?.ResponseStreamWrapper?.Invoke(stream) ?? stream, Encoding.ASCII) { AutoFlush = true }) { return await funcAsync(s, stream, reader, writer).ConfigureAwait(false); } diff --git a/external/corefx/src/Common/tests/System/Net/Prerequisites/Deployment/config.ps1 b/external/corefx/src/Common/tests/System/Net/Prerequisites/Deployment/config.ps1 index 04a224379e..b36d461871 100644 --- a/external/corefx/src/Common/tests/System/Net/Prerequisites/Deployment/config.ps1 +++ b/external/corefx/src/Common/tests/System/Net/Prerequisites/Deployment/config.ps1 @@ -28,7 +28,7 @@ $COREFX_NET_AD_MachineIP = "" #Example: "192.168.0.1" - must be a Stat $COREFX_NET_IISSERVER_Machine = "" #Example: "TESTIIS" $COREFX_NET_IISSERVER_MachineIP = "" #Example: "192.168.0.1" - must be a Static IPv4 address. -# A Windows Client or Server SKU hosting the corefx enlistment. This machine will be joined to the Domain. +# A Windows Client or Server SKU hosting the corefx repo. This machine will be joined to the Domain. $COREFX_NET_CLIENT_Machine = "" #Example: "TESTCLIENT" # -- Test Parameters diff --git a/external/corefx/src/Common/tests/System/Net/Sockets/SocketTestExtensions.cs b/external/corefx/src/Common/tests/System/Net/Sockets/SocketTestExtensions.cs index acad26234f..dacf426409 100644 --- a/external/corefx/src/Common/tests/System/Net/Sockets/SocketTestExtensions.cs +++ b/external/corefx/src/Common/tests/System/Net/Sockets/SocketTestExtensions.cs @@ -23,5 +23,18 @@ namespace System.Net.Sockets.Tests port = ((IPEndPoint)listener.LocalEndpoint).Port; return listener; } + + // On non-Windows platforms, once non-blocking is turned on (either explicitly + // or by performing an async operation), we always stay in non-blocking mode. + // Therefore, sync operation have to be simulated via async and explicit blocking. + // Force us into this mode for testing purposes. + public static void ForceNonBlocking(this Socket socket, bool force) + { + if (force) + { + socket.Blocking = false; + socket.Blocking = true; + } + } } } diff --git a/external/corefx/src/Common/tests/System/Net/Sockets/TestSettings.cs b/external/corefx/src/Common/tests/System/Net/Sockets/TestSettings.cs index c0c7b9a270..1f20fc816e 100644 --- a/external/corefx/src/Common/tests/System/Net/Sockets/TestSettings.cs +++ b/external/corefx/src/Common/tests/System/Net/Sockets/TestSettings.cs @@ -7,7 +7,7 @@ namespace System.Net.Sockets.Tests public static class TestSettings { // Timeout values in milliseconds. - public const int PassingTestTimeout = 5000; + public const int PassingTestTimeout = 10000; public const int FailingTestTimeout = 100; // Number of redundant UDP packets to send to increase test reliability diff --git a/external/corefx/src/Common/tests/System/PlatformDetection.Unix.cs b/external/corefx/src/Common/tests/System/PlatformDetection.Unix.cs deleted file mode 100644 index d55f8fb12a..0000000000 --- a/external/corefx/src/Common/tests/System/PlatformDetection.Unix.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; -using Xunit; - -namespace System -{ - public static partial class PlatformDetection - { - public static Version OSXKernelVersion { get; } = GetOSXKernelVersion(); - - private static Version GetOSXKernelVersion() - { - if (IsOSX) - { - byte[] bytes = new byte[256]; - IntPtr bytesLength = new IntPtr(bytes.Length); - Assert.Equal(0, sysctlbyname("kern.osrelease", bytes, ref bytesLength, null, IntPtr.Zero)); - string versionString = Encoding.UTF8.GetString(bytes); - return Version.Parse(versionString); - } - - return new Version(0, 0, 0); - } - - [DllImport("libc", SetLastError = true)] - private static extern int sysctlbyname(string ctlName, byte[] oldp, ref IntPtr oldpLen, byte[] newp, IntPtr newpLen); - - [DllImport("libc", SetLastError = true)] - internal static extern unsafe uint geteuid(); - - public static bool IsSuperUser => geteuid() == 0; - } -} \ No newline at end of file diff --git a/external/corefx/src/Common/tests/System/PlatformDetection.cs b/external/corefx/src/Common/tests/System/PlatformDetection.cs deleted file mode 100644 index 541933d130..0000000000 --- a/external/corefx/src/Common/tests/System/PlatformDetection.cs +++ /dev/null @@ -1,475 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; -using Xunit; - -namespace System -{ - public static partial class PlatformDetection - { - // - // Do not use the " { get; } = " pattern here. Having all the initialization happen in the type initializer - // means that one exception anywhere means all tests using PlatformDetection fail. If you feel a value is worth latching, - // do it in a way that failures don't cascade. - // - - public static bool IsUap => IsWinRT || IsNetNative; - public static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); - public static bool IsNetNative => RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.OrdinalIgnoreCase); - public static bool IsNetCore => RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); - - public static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - public static bool IsWindows7 => IsWindows && GetWindowsVersion() == 6 && GetWindowsMinorVersion() == 1; - public static bool IsWindows8x => IsWindows && GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3); - public static bool IsNotWindows8x => !IsWindows8x; - public static bool IsOSX => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); - public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); - public static bool IsOpenSUSE => IsDistroAndVersion("opensuse"); - public static bool IsUbuntu => IsDistroAndVersion("ubuntu"); - public static bool IsWindowsNanoServer => (IsWindows && !File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "regedit.exe"))); - public static bool IsNotWindowsNanoServer => !IsWindowsNanoServer; - public static bool IsWindows10Version1607OrGreater => IsWindows && - GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 14393; - public static bool IsWindows10Version1703OrGreater => IsWindows && - GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 15063; - public static bool IsWindows10InsiderPreviewBuild16215OrGreater => IsWindows && - GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 16215; - public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; - public static bool IsNotArmProcess => !IsArmProcess; - - // Windows OneCoreUAP SKU doesn't have httpapi.dll - public static bool IsNotOneCoreUAP => (!IsWindows || - File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "httpapi.dll"))); - - public static int WindowsVersion => GetWindowsVersion(); - - public static bool IsNetfx462OrNewer() - { - if (!IsFullFramework) - { - return false; - } - - Version net462 = new Version(4, 6, 2); - Version runningVersion = GetFrameworkVersion(); - return runningVersion != null && runningVersion >= net462; - } - - public static bool IsNetfx470OrNewer() - { - if (!IsFullFramework) - { - return false; - } - - Version net470 = new Version(4, 7, 0); - Version runningVersion = GetFrameworkVersion(); - return runningVersion != null && runningVersion >= net470; - } - - public static bool IsNetfx471OrNewer() - { - if (!IsFullFramework) - { - return false; - } - - Version net471 = new Version(4, 7, 1); - Version runningVersion = GetFrameworkVersion(); - return runningVersion != null && runningVersion >= net471; - } - - public static Version GetFrameworkVersion() - { - string[] descriptionArray = RuntimeInformation.FrameworkDescription.Split(' '); - if (descriptionArray.Length < 3) - return null; - - if (!Version.TryParse(descriptionArray[2], out Version actualVersion)) - return null; - - foreach (Range currentRange in FrameworkRanges) - { - if (currentRange.IsInRange(actualVersion)) - return currentRange.FrameworkVersion; - } - - return null; - } - - private static int s_isWinRT = -1; - - public static bool IsWinRT - { - get - { - if (s_isWinRT != -1) - return s_isWinRT == 1; - - if (!IsWindows || IsWindows7) - { - s_isWinRT = 0; - return false; - } - - byte[] buffer = new byte[0]; - uint bufferSize = 0; - try - { - int result = GetCurrentApplicationUserModelId(ref bufferSize, buffer); - switch (result) - { - case 15703: // APPMODEL_ERROR_NO_APPLICATION - s_isWinRT = 0; - break; - case 0: // ERROR_SUCCESS - case 122: // ERROR_INSUFFICIENT_BUFFER - // Success is actually insufficent buffer as we're really only looking for - // not NO_APPLICATION and we're not actually giving a buffer here. The - // API will always return NO_APPLICATION if we're not running under a - // WinRT process, no matter what size the buffer is. - s_isWinRT = 1; - break; - default: - throw new InvalidOperationException($"Failed to get AppId, result was {result}."); - } - } - catch (Exception e) - { - // We could catch this here, being friendly with older portable surface area should we - // desire to use this method elsewhere. - if (e.GetType().FullName.Equals("System.EntryPointNotFoundException", StringComparison.Ordinal)) - { - // API doesn't exist, likely pre Win8 - s_isWinRT = 0; - } - else - { - throw; - } - } - - return s_isWinRT == 1; - } - } - - public static bool IsNotWinRT => !IsWinRT; - public static bool IsWinRTSupported => IsWinRT || (IsWindows && !IsWindows7); - public static bool IsNotWinRTSupported => !IsWinRTSupported; - - private static Lazy m_isWindowsSubsystemForLinux = new Lazy(GetIsWindowsSubsystemForLinux); - - public static bool IsWindowsSubsystemForLinux => m_isWindowsSubsystemForLinux.Value; - public static bool IsNotWindowsSubsystemForLinux => !IsWindowsSubsystemForLinux; - - public static bool IsNotFedoraOrRedHatOrCentos => !IsDistroAndVersion("fedora") && !IsDistroAndVersion("rhel") && !IsDistroAndVersion("centos"); - - public static bool IsFedora => IsDistroAndVersion("fedora"); - - private static bool GetIsWindowsSubsystemForLinux() - { - // https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364 - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - const string versionFile = "/proc/version"; - if (File.Exists(versionFile)) - { - string s = File.ReadAllText(versionFile); - - if (s.Contains("Microsoft") || s.Contains("WSL")) - { - return true; - } - } - } - - return false; - } - - public static bool IsDebian => IsDistroAndVersion("debian"); - public static bool IsDebian8 => IsDistroAndVersion("debian", "8"); - public static bool IsUbuntu1404 => IsDistroAndVersion("ubuntu", "14.04"); - public static bool IsCentos7 => IsDistroAndVersion("centos", "7"); - public static bool IsTizen => IsDistroAndVersion("tizen"); - - // If we need this long-term hopefully we can come up with a better detection than the kernel verison. - public static bool IsMacOsHighSierra { get; } = - IsOSX && RuntimeInformation.OSDescription.StartsWith("Darwin 17.0.0"); - - /// - /// Get whether the OS platform matches the given Linux distro and optional version. - /// - /// The distribution id. - /// The distro version. If omitted, compares the distro only. - /// Whether the OS platform matches the given Linux distro and optional version. - private static bool IsDistroAndVersion(string distroId, string versionId = null) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - DistroInfo v = ParseOsReleaseFile(); - if (v.Id == distroId && (versionId == null || v.VersionId == versionId)) - { - return true; - } - } - - return false; - } - - public static string GetDistroVersionString() - { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - return ""; - } - - DistroInfo v = ParseOsReleaseFile(); - - return "Distro=" + v.Id + " VersionId=" + v.VersionId + " Pretty=" + v.PrettyName + " Version=" + v.Version; - } - - private static DistroInfo ParseOsReleaseFile() - { - Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)); - - DistroInfo ret = new DistroInfo(); - ret.Id = ""; - ret.VersionId = ""; - ret.Version = ""; - ret.PrettyName = ""; - - if (File.Exists("/etc/os-release")) - { - foreach (string line in File.ReadLines("/etc/os-release")) - { - if (line.StartsWith("ID=", System.StringComparison.Ordinal)) - { - ret.Id = RemoveQuotes(line.Substring("ID=".Length)); - } - else if (line.StartsWith("VERSION_ID=", System.StringComparison.Ordinal)) - { - ret.VersionId = RemoveQuotes(line.Substring("VERSION_ID=".Length)); - } - else if (line.StartsWith("VERSION=", System.StringComparison.Ordinal)) - { - ret.Version = RemoveQuotes(line.Substring("VERSION=".Length)); - } - else if (line.StartsWith("PRETTY_NAME=", System.StringComparison.Ordinal)) - { - ret.PrettyName = RemoveQuotes(line.Substring("PRETTY_NAME=".Length)); - } - } - } - - return ret; - } - - private static string RemoveQuotes(string s) - { - s = s.Trim(); - if (s.Length >= 2 && s[0] == '"' && s[s.Length - 1] == '"') - { - // Remove quotes. - s = s.Substring(1, s.Length - 2); - } - - return s; - } - - private struct DistroInfo - { - public string Id { get; set; } - public string VersionId { get; set; } - public string Version { get; set; } - public string PrettyName { get; set; } - } - - private static int GetWindowsVersion() - { - if (IsWindows) - { - RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX(); - osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi); - Assert.Equal(0, RtlGetVersion(out osvi)); - return (int)osvi.dwMajorVersion; - } - - return -1; - } - - private static int GetWindowsMinorVersion() - { - if (IsWindows) - { - RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX(); - osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi); - Assert.Equal(0, RtlGetVersion(out osvi)); - return (int)osvi.dwMinorVersion; - } - - return -1; - } - - private static int GetWindowsBuildNumber() - { - if (IsWindows) - { - RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX(); - osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi); - Assert.Equal(0, RtlGetVersion(out osvi)); - return (int)osvi.dwBuildNumber; - } - - return -1; - } - - [DllImport("ntdll.dll")] - private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation); - - [StructLayout(LayoutKind.Sequential)] - private struct RTL_OSVERSIONINFOEX - { - internal uint dwOSVersionInfoSize; - internal uint dwMajorVersion; - internal uint dwMinorVersion; - internal uint dwBuildNumber; - internal uint dwPlatformId; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - internal string szCSDVersion; - } - - private static int s_isWindowsElevated = -1; - - public static bool IsWindowsAndElevated - { - get - { - if (s_isWindowsElevated != -1) - return s_isWindowsElevated == 1; - - if (!IsWindows || IsWinRT) - { - s_isWindowsElevated = 0; - return false; - } - - IntPtr processToken; - Assert.True(OpenProcessToken(GetCurrentProcess(), TOKEN_READ, out processToken)); - - try - { - uint tokenInfo; - uint returnLength; - Assert.True(GetTokenInformation( - processToken, TokenElevation, out tokenInfo, sizeof(uint), out returnLength)); - - s_isWindowsElevated = tokenInfo == 0 ? 0 : 1; - } - finally - { - CloseHandle(processToken); - } - - return s_isWindowsElevated == 1; - } - } - - private const uint TokenElevation = 20; - private const uint STANDARD_RIGHTS_READ = 0x00020000; - private const uint TOKEN_QUERY = 0x0008; - private const uint TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY; - - [DllImport("advapi32.dll", SetLastError = true, ExactSpelling = true)] - public static extern bool GetTokenInformation( - IntPtr TokenHandle, - uint TokenInformationClass, - out uint TokenInformation, - uint TokenInformationLength, - out uint ReturnLength); - - [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] - public static extern bool CloseHandle( - IntPtr handle); - - [DllImport("advapi32.dll", SetLastError = true, ExactSpelling = true)] - public static extern bool OpenProcessToken( - IntPtr ProcessHandle, - uint DesiredAccesss, - out IntPtr TokenHandle); - - // The process handle does NOT need closing - [DllImport("kernel32.dll", ExactSpelling = true)] - public static extern IntPtr GetCurrentProcess(); - - [DllImport("kernel32.dll", ExactSpelling = true)] - public static extern int GetCurrentApplicationUserModelId( - ref uint applicationUserModelIdLength, - byte[] applicationUserModelId); - - public static bool IsNonZeroLowerBoundArraySupported - { - get - { - if (s_lazyNonZeroLowerBoundArraySupported == null) - { - bool nonZeroLowerBoundArraysSupported = false; - try - { - Array.CreateInstance(typeof(int), new int[] { 5 }, new int[] { 5 }); - nonZeroLowerBoundArraysSupported = true; - } - catch (PlatformNotSupportedException) - { - } - s_lazyNonZeroLowerBoundArraySupported = Tuple.Create(nonZeroLowerBoundArraysSupported); - } - return s_lazyNonZeroLowerBoundArraySupported.Item1; - } - } - - private static volatile Tuple s_lazyNonZeroLowerBoundArraySupported; - - public static bool IsReflectionEmitSupported = !PlatformDetection.IsNetNative; - - // Tracked in: https://github.com/dotnet/corert/issues/3643 in case we change our mind about this. - public static bool IsInvokingStaticConstructorsSupported => !PlatformDetection.IsNetNative; - - // System.Security.Cryptography.Xml.XmlDsigXsltTransform.GetOutput() relies on XslCompiledTransform which relies - // heavily on Reflection.Emit - public static bool IsXmlDsigXsltTransformSupported => !PlatformDetection.IsUap; - - public static Range[] FrameworkRanges => new Range[]{ - new Range(new Version(4, 7, 2500, 0), null, new Version(4, 7, 1)), - new Range(new Version(4, 6, 2000, 0), new Version(4, 7, 2090, 0), new Version(4, 7, 0)), - new Range(new Version(4, 6, 1500, 0), new Version(4, 6, 1999, 0), new Version(4, 6, 2)), - new Range(new Version(4, 6, 1000, 0), new Version(4, 6, 1499, 0), new Version(4, 6, 1)), - new Range(new Version(4, 6, 55, 0), new Version(4, 6, 999, 0), new Version(4, 6, 0)), - new Range(new Version(4, 0, 30319, 0), new Version(4, 0, 52313, 36313), new Version(4, 5, 2)) - }; - - public class Range - { - public Version Start { get; private set; } - public Version Finish { get; private set; } - public Version FrameworkVersion { get; private set; } - - public Range(Version start, Version finish, Version frameworkVersion) - { - Start = start; - Finish = finish; - FrameworkVersion = frameworkVersion; - } - - public bool IsInRange(Version version) - { - return version >= Start && (Finish == null || version <= Finish); - } - } - } -} diff --git a/external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs b/external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs index 51383d4c6c..e3019a7842 100644 --- a/external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs +++ b/external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs @@ -4,7 +4,6 @@ using System.IO; using System.Reflection; -using System.Runtime.InteropServices; using System.Runtime.Serialization.Formatters.Binary; using Xunit; @@ -13,66 +12,37 @@ namespace System.Runtime.Serialization.Formatters.Tests { public static class BinaryFormatterHelpers { - internal static T Clone(T obj) + internal static T Clone(T obj, + ISerializationSurrogate surrogate = null, + FormatterAssemblyStyle assemblyFormat = FormatterAssemblyStyle.Full, + TypeFilterLevel filterLevel = TypeFilterLevel.Full, + FormatterTypeStyle typeFormat = FormatterTypeStyle.TypesAlways) { - // https://github.com/dotnet/corefx/issues/18942 - Binary serialization still WIP on AOT platforms. - if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - return obj; + BinaryFormatter f; + if (surrogate == null) + { + f = new BinaryFormatter(); + } + else + { + var c = new StreamingContext(); + var s = new SurrogateSelector(); + s.AddSurrogate(obj.GetType(), c, surrogate); + f = new BinaryFormatter(s, c); + } + f.AssemblyFormat = assemblyFormat; + f.FilterLevel = filterLevel; + f.TypeFormat = typeFormat; - var f = new BinaryFormatter(); using (var s = new MemoryStream()) { f.Serialize(s, obj); + Assert.NotEqual(0, s.Position); s.Position = 0; return (T)f.Deserialize(s); } } - internal static Lazy Clone(Lazy lazy) - { - // https://github.com/dotnet/corefx/issues/18942 - Binary serialization still WIP on AOT platforms. - if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Native")) - { - T ignore = lazy.Value; - return lazy; - } - - return Clone>(lazy); - } - - public static void AssertRoundtrips(T expected, params Func[] additionalGetters) - where T : Exception - { - for (int i = 0; i < 2; i++) - { - if (i > 0) // first time without stack trace, second time with - { - try { throw expected; } - catch { } - } - - // Serialize/deserialize the exception - T actual = Clone(expected); - - // Verify core state - if (!PlatformDetection.IsFullFramework) // On full framework, line number may be method body start - { - Assert.Equal(expected.StackTrace, actual.StackTrace); - Assert.Equal(expected.ToString(), actual.ToString()); // includes stack trace - } - Assert.Equal(expected.Data, actual.Data); - Assert.Equal(expected.Message, actual.Message); - Assert.Equal(expected.Source, actual.Source); - Assert.Equal(expected.HResult, actual.HResult); - - // Verify optional additional state - foreach (Func getter in additionalGetters) - { - Assert.Equal(getter(expected), getter(actual)); - } - } - } - public static void AssertExceptionDeserializationFails() where T : Exception { // .NET Core and .NET Native throw PlatformNotSupportedExceptions when deserializing many exceptions. @@ -118,5 +88,42 @@ namespace System.Runtime.Serialization.Formatters.Tests Exception ex = Assert.Throws(() => constructor.Invoke(new object[] { info, new StreamingContext() })); Assert.IsType(ex.InnerException); } + + public static byte[] ToByteArray(object obj, + FormatterAssemblyStyle assemblyStyle = FormatterAssemblyStyle.Full) + { + BinaryFormatter bf = new BinaryFormatter(); + bf.AssemblyFormat = assemblyStyle; + using (MemoryStream ms = new MemoryStream()) + { + bf.Serialize(ms, obj); + return ms.ToArray(); + } + } + + public static string ToBase64String(object obj, + FormatterAssemblyStyle assemblyStyle = FormatterAssemblyStyle.Full) + { + byte[] raw = ToByteArray(obj, assemblyStyle); + return Convert.ToBase64String(raw); + } + + public static object FromByteArray(byte[] raw, + FormatterAssemblyStyle assemblyStyle = FormatterAssemblyStyle.Full) + { + var binaryFormatter = new BinaryFormatter(); + binaryFormatter.AssemblyFormat = assemblyStyle; + using (var serializedStream = new MemoryStream(raw)) + { + return binaryFormatter.Deserialize(serializedStream); + } + } + + public static object FromBase64String(string base64Str, + FormatterAssemblyStyle assemblyStyle = FormatterAssemblyStyle.Full) + { + byte[] raw = Convert.FromBase64String(base64Str); + return FromByteArray(raw, assemblyStyle); + } } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs index f3b8a6c036..8b5b36a946 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; +using System.Text; using Test.Cryptography; using Xunit; @@ -629,5 +630,85 @@ namespace System.Security.Cryptography.Encryption.Aes.Tests return output.ToArray(); } } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void EncryptWithLargeOutputBuffer(bool blockAlignedOutput) + { + using (Aes alg = AesFactory.Create()) + using (ICryptoTransform xform = alg.CreateEncryptor()) + { + // 8 blocks, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize + outputPadding]; + // 2 blocks of 0x00 + byte[] input = new byte[alg.BlockSize / 4]; + int outputOffset = 0; + + outputOffset += xform.TransformBlock(input, 0, input.Length, output, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, output, outputOffset, overflow.Length); + outputOffset += overflow.Length; + + Assert.Equal(3 * (alg.BlockSize / 8), outputOffset); + string outputAsHex = output.ByteArrayToHex(); + Assert.NotEqual(new string('0', outputOffset * 2), outputAsHex.Substring(0, outputOffset * 2)); + Assert.Equal(new string('0', (output.Length - outputOffset) * 2), outputAsHex.Substring(outputOffset * 2)); + } + } + + [Theory] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] + public static void TransformWithTooShortOutputBuffer(bool encrypt, bool blockAlignedOutput) + { + // The CreateDecryptor call reads the Key/IV property to initialize them, bypassing an + // uninitialized state protection. + using (Aes alg = AesFactory.Create()) + using (ICryptoTransform xform = encrypt ? alg.CreateEncryptor() : alg.CreateDecryptor(alg.Key, alg.IV)) + { + // 1 block, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize / 8 + outputPadding]; + // 3 blocks of 0x00 + byte[] input = new byte[3 * (alg.BlockSize / 8)]; + + Assert.Throws( + () => xform.TransformBlock(input, 0, input.Length, output, 0)); + + Assert.Equal(new byte[output.Length], output); + } + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void MultipleBlockDecryptTransform(bool blockAlignedOutput) + { + const string ExpectedOutput = "This is a 128-bit block test"; + + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] key = "0123456789ABCDEFFEDCBA9876543210".HexToByteArray(); + byte[] iv = "0123456789ABCDEF0123456789ABCDEF".HexToByteArray(); + byte[] outputBytes = new byte[iv.Length * 2 + outputPadding]; + byte[] input = "D1BF87C650FCD10B758445BE0E0A99D14652480DF53423A8B727D30C8C010EDE".HexToByteArray(); + int outputOffset = 0; + + using (Aes alg = AesFactory.Create()) + using (ICryptoTransform xform = alg.CreateDecryptor(key, iv)) + { + Assert.Equal(2 * alg.BlockSize, (outputBytes.Length - outputPadding) * 8); + outputOffset += xform.TransformBlock(input, 0, input.Length, outputBytes, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, outputBytes, outputOffset, overflow.Length); + outputOffset += overflow.Length; + } + + string decrypted = Encoding.ASCII.GetString(outputBytes, 0, outputOffset); + Assert.Equal(ExpectedOutput, decrypted); + } } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DES/DESCipherTests.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DES/DESCipherTests.cs index 338fb7c2ac..e01f2e555a 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DES/DESCipherTests.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DES/DESCipherTests.cs @@ -225,5 +225,83 @@ namespace System.Security.Cryptography.Encryption.Des.Tests } } } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void EncryptWithLargeOutputBuffer(bool blockAlignedOutput) + { + using (DES alg = DESFactory.Create()) + using (ICryptoTransform xform = alg.CreateEncryptor()) + { + // 8 blocks, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize + outputPadding]; + // 2 blocks of 0x00 + byte[] input = new byte[alg.BlockSize / 4]; + int outputOffset = 0; + + outputOffset += xform.TransformBlock(input, 0, input.Length, output, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, output, outputOffset, overflow.Length); + outputOffset += overflow.Length; + + Assert.Equal(3 * (alg.BlockSize / 8), outputOffset); + string outputAsHex = output.ByteArrayToHex(); + Assert.NotEqual(new string('0', outputOffset * 2), outputAsHex.Substring(0, outputOffset * 2)); + Assert.Equal(new string('0', (output.Length - outputOffset) * 2), outputAsHex.Substring(outputOffset * 2)); + } + } + + [Theory] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] + public static void TransformWithTooShortOutputBuffer(bool encrypt, bool blockAlignedOutput) + { + using (DES alg = DESFactory.Create()) + using (ICryptoTransform xform = encrypt ? alg.CreateEncryptor() : alg.CreateDecryptor()) + { + // 1 block, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize / 8 + outputPadding]; + // 3 blocks of 0x00 + byte[] input = new byte[3 * (alg.BlockSize / 8)]; + + Assert.Throws( + () => xform.TransformBlock(input, 0, input.Length, output, 0)); + + Assert.Equal(new byte[output.Length], output); + } + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void MultipleBlockDecryptTransform(bool blockAlignedOutput) + { + const string ExpectedOutput = "This is a test"; + + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] key = "87FF0737F868378F".HexToByteArray(); + byte[] iv = "0123456789ABCDEF".HexToByteArray(); + byte[] outputBytes = new byte[iv.Length * 2 + outputPadding]; + byte[] input = "CB67F70BA8B50EED2C0691298988865F".HexToByteArray(); + int outputOffset = 0; + + using (DES alg = DESFactory.Create()) + using (ICryptoTransform xform = alg.CreateDecryptor(key, iv)) + { + Assert.Equal(2 * alg.BlockSize, (outputBytes.Length - outputPadding) * 8); + outputOffset += xform.TransformBlock(input, 0, input.Length, outputBytes, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, outputBytes, outputOffset, overflow.Length); + outputOffset += overflow.Length; + } + + string decrypted = Encoding.ASCII.GetString(outputBytes, 0, outputOffset); + Assert.Equal(ExpectedOutput, decrypted); + } } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.NistValidation.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.NistValidation.cs index e6c11c31fa..34a96371a8 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.NistValidation.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.NistValidation.cs @@ -7,10 +7,10 @@ using Xunit; namespace System.Security.Cryptography.Dsa.Tests { - public partial class DSASignVerify + public abstract partial class DSASignVerify { [Fact] - public static void Fips186_2_1() + public void Fips186_2_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-2dsatestvectors.zip // SigGen.txt, first case @@ -49,7 +49,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L1024_N160_SHA256_1() + public void Fips186_3_L1024_N160_SHA256_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -89,7 +89,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L1024_N160_SHA384_1() + public void Fips186_3_L1024_N160_SHA384_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -129,7 +129,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L1024_N160_SHA384_4() + public void Fips186_3_L1024_N160_SHA384_4() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -169,7 +169,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L1024_N160_SHA512_1() + public void Fips186_3_L1024_N160_SHA512_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -209,7 +209,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L1024_N160_SHA512_4() + public void Fips186_3_L1024_N160_SHA512_4() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -249,7 +249,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L2048_N256_SHA256_1() + public void Fips186_3_L2048_N256_SHA256_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -306,7 +306,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L2048_N256_SHA384_1() + public void Fips186_3_L2048_N256_SHA384_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -363,7 +363,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L2048_N256_SHA1_1() + public void Fips186_3_L2048_N256_SHA1_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -420,7 +420,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L2048_N256_SHA384_3() + public void Fips186_3_L2048_N256_SHA384_3() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -477,7 +477,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L3072_N256_SHA256_1() + public void Fips186_3_L3072_N256_SHA256_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -546,7 +546,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L3072_N256_SHA384_1() + public void Fips186_3_L3072_N256_SHA384_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -615,7 +615,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L3072_N256_SHA512_1() + public void Fips186_3_L3072_N256_SHA512_1() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -684,7 +684,7 @@ namespace System.Security.Cryptography.Dsa.Tests } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Fips186_3_L3072_N256_SHA512_12() + public void Fips186_3_L3072_N256_SHA512_12() { // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3dsatestvectors.zip // SigGen.txt @@ -752,7 +752,7 @@ namespace System.Security.Cryptography.Dsa.Tests Validate(p, q, g, x, y, msg, r, s, HashAlgorithmName.SHA512); } - private static void Validate( + private void Validate( string p, string q, string g, @@ -779,10 +779,10 @@ namespace System.Security.Cryptography.Dsa.Tests byte[] message = msg.HexToByteArray(); byte[] signature = (r + s).HexToByteArray(); - Assert.True(dsa.VerifyData(message, signature, hashAlgorithm), "Public+Private Valid Signature"); + Assert.True(VerifyData(dsa, message, signature, hashAlgorithm), "Public+Private Valid Signature"); signature[0] ^= 0xFF; - Assert.False(dsa.VerifyData(message, signature, hashAlgorithm), "Public+Private Tampered Signature"); + Assert.False(VerifyData(dsa, message, signature, hashAlgorithm), "Public+Private Tampered Signature"); } // Public only @@ -801,10 +801,10 @@ namespace System.Security.Cryptography.Dsa.Tests byte[] message = msg.HexToByteArray(); byte[] signature = (r + s).HexToByteArray(); - Assert.True(dsa.VerifyData(message, signature, hashAlgorithm), "Public-Only Valid Signature"); + Assert.True(VerifyData(dsa, message, signature, hashAlgorithm), "Public-Only Valid Signature"); signature[0] ^= 0xFF; - Assert.False(dsa.VerifyData(message, signature, hashAlgorithm), "Public-Only Tampered Signature"); + Assert.False(VerifyData(dsa, message, signature, hashAlgorithm), "Public-Only Tampered Signature"); } } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs index f48f51eb49..1bb8a31baf 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs @@ -2,40 +2,124 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.IO; using Test.Cryptography; using Xunit; namespace System.Security.Cryptography.Dsa.Tests { - public partial class DSASignVerify + public sealed class DSASignVerify_Array : DSASignVerify { + public override byte[] SignData(DSA dsa, byte[] data, HashAlgorithmName hashAlgorithm) => + dsa.SignData(data, hashAlgorithm); + public override bool VerifyData(DSA dsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm) => + dsa.VerifyData(data, signature, hashAlgorithm); + + [Fact] + public void InvalidStreamArrayArguments_Throws() + { + using (DSA dsa = DSAFactory.Create(1024)) + { + AssertExtensions.Throws("rgbHash", () => dsa.CreateSignature(null)); + + AssertExtensions.Throws("data", () => dsa.SignData((byte[])null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => dsa.SignData(null, 0, 0, HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("offset", () => dsa.SignData(new byte[1], -1, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => dsa.SignData(new byte[1], 2, 0, HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("count", () => dsa.SignData(new byte[1], 0, -1, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => dsa.SignData(new byte[1], 0, 2, HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("data", () => dsa.VerifyData((byte[])null, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => dsa.VerifyData(null, 0, 0, null, HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("signature", () => dsa.VerifyData(new byte[1], null, HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("offset", () => dsa.VerifyData(new byte[1], -1, 0, new byte[1], HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => dsa.VerifyData(new byte[1], 2, 0, new byte[1], HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("count", () => dsa.VerifyData(new byte[1], 0, -1, new byte[1], HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => dsa.VerifyData(new byte[1], 0, 2, new byte[1], HashAlgorithmName.SHA1)); + } + } + } + + public sealed class DSASignVerify_Stream : DSASignVerify + { + public override byte[] SignData(DSA dsa, byte[] data, HashAlgorithmName hashAlgorithm) => + dsa.SignData(new MemoryStream(data), hashAlgorithm); + public override bool VerifyData(DSA dsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm) => + dsa.VerifyData(new MemoryStream(data), signature, hashAlgorithm); + + [Fact] + public void InvalidArrayArguments_Throws() + { + using (DSA dsa = DSAFactory.Create(1024)) + { + AssertExtensions.Throws("data", () => dsa.SignData((Stream)null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => dsa.VerifyData((Stream)null, null, HashAlgorithmName.SHA1)); + + AssertExtensions.Throws("signature", () => dsa.VerifyData(new MemoryStream(), null, HashAlgorithmName.SHA1)); + } + } + } + + public sealed class DSASignVerify_Span : DSASignVerify + { + public override byte[] SignData(DSA dsa, byte[] data, HashAlgorithmName hashAlgorithm) => + TryWithOutputArray(dest => dsa.TrySignData(data, dest, hashAlgorithm, out int bytesWritten) ? (true, bytesWritten) : (false, 0)); + + public override bool VerifyData(DSA dsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm) => + dsa.VerifyData((ReadOnlySpan)data, (ReadOnlySpan)signature, hashAlgorithm); + + private static byte[] TryWithOutputArray(Func func) + { + for (int length = 1; ; length = checked(length * 2)) + { + var result = new byte[length]; + var (success, bytesWritten) = func(result); + if (success) + { + Array.Resize(ref result, bytesWritten); + return result; + } + } + } + } + + public abstract partial class DSASignVerify + { + public abstract byte[] SignData(DSA dsa, byte[] data, HashAlgorithmName hashAlgorithm); + public abstract bool VerifyData(DSA dsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm); + [ConditionalFact(nameof(SupportsKeyGeneration))] - public static void InvalidKeySize_DoesNotInvalidateKey() + public void InvalidKeySize_DoesNotInvalidateKey() { using (DSA dsa = DSAFactory.Create()) { - byte[] signature = dsa.SignData(DSATestData.HelloBytes, HashAlgorithmName.SHA1); + byte[] signature = SignData(dsa, DSATestData.HelloBytes, HashAlgorithmName.SHA1); // A 2049-bit key is hard to describe, none of the providers support it. Assert.ThrowsAny(() => dsa.KeySize = 2049); - Assert.True(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA1)); + Assert.True(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA1)); } } [ConditionalFact(nameof(SupportsKeyGeneration))] - public static void SignAndVerifyDataNew1024() + public void SignAndVerifyDataNew1024() { using (DSA dsa = DSAFactory.Create(1024)) { - byte[] signature = dsa.SignData(DSATestData.HelloBytes, new HashAlgorithmName("SHA1")); - bool signatureMatched = dsa.VerifyData(DSATestData.HelloBytes, signature, new HashAlgorithmName("SHA1")); + byte[] signature = SignData(dsa, DSATestData.HelloBytes, new HashAlgorithmName("SHA1")); + bool signatureMatched = VerifyData(dsa, DSATestData.HelloBytes, signature, new HashAlgorithmName("SHA1")); Assert.True(signatureMatched); } } [Fact] - public static void VerifyKnown_512() + public void VerifyKnown_512() { byte[] signature = ( // r: @@ -46,12 +130,12 @@ namespace System.Security.Cryptography.Dsa.Tests using (DSA dsa = DSAFactory.Create()) { dsa.ImportParameters(DSATestData.Dsa512Parameters); - Assert.True(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA1)); + Assert.True(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA1)); } } [Fact] - public static void VerifyKnown_576() + public void VerifyKnown_576() { byte[] signature = ( // r: @@ -62,12 +146,12 @@ namespace System.Security.Cryptography.Dsa.Tests using (DSA dsa = DSAFactory.Create()) { dsa.ImportParameters(DSATestData.Dsa576Parameters); - Assert.True(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA1)); + Assert.True(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA1)); } } [Fact] - public static void PublicKey_CannotSign() + public void PublicKey_CannotSign() { DSAParameters keyParameters = DSATestData.GetDSA1024Params(); keyParameters.X = null; @@ -77,24 +161,24 @@ namespace System.Security.Cryptography.Dsa.Tests dsa.ImportParameters(keyParameters); Assert.ThrowsAny( - () => dsa.SignData(DSATestData.HelloBytes, HashAlgorithmName.SHA1)); + () => SignData(dsa, DSATestData.HelloBytes, HashAlgorithmName.SHA1)); } } [Fact] - public static void SignAndVerifyDataExplicit1024() + public void SignAndVerifyDataExplicit1024() { SignAndVerify(DSATestData.HelloBytes, "SHA1", DSATestData.GetDSA1024Params(), 40); } [ConditionalFact(nameof(SupportsFips186_3))] - public static void SignAndVerifyDataExplicit2048() + public void SignAndVerifyDataExplicit2048() { SignAndVerify(DSATestData.HelloBytes, "SHA256", DSATestData.GetDSA2048Params(), 64); } [ConditionalFact(nameof(SupportsFips186_3))] - public static void VerifyKnown_2048_SHA256() + public void VerifyKnown_2048_SHA256() { byte[] signature = { @@ -111,14 +195,14 @@ namespace System.Security.Cryptography.Dsa.Tests using (DSA dsa = DSAFactory.Create()) { dsa.ImportParameters(DSATestData.GetDSA2048Params()); - Assert.True(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA256)); - Assert.False(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA384)); - Assert.False(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA512)); + Assert.True(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA256)); + Assert.False(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA384)); + Assert.False(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA512)); } } [ConditionalFact(nameof(SupportsFips186_3))] - public static void VerifyKnown_2048_SHA384() + public void VerifyKnown_2048_SHA384() { byte[] signature = { @@ -135,14 +219,14 @@ namespace System.Security.Cryptography.Dsa.Tests using (DSA dsa = DSAFactory.Create()) { dsa.ImportParameters(DSATestData.GetDSA2048Params()); - Assert.True(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA384)); - Assert.False(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA256)); - Assert.False(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA512)); + Assert.True(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA384)); + Assert.False(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA256)); + Assert.False(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA512)); } } [ConditionalFact(nameof(SupportsFips186_3))] - public static void VerifyKnown_2048_SHA512() + public void VerifyKnown_2048_SHA512() { byte[] signature = { @@ -159,14 +243,14 @@ namespace System.Security.Cryptography.Dsa.Tests using (DSA dsa = DSAFactory.Create()) { dsa.ImportParameters(DSATestData.GetDSA2048Params()); - Assert.True(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA512)); - Assert.False(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA256)); - Assert.False(dsa.VerifyData(DSATestData.HelloBytes, signature, HashAlgorithmName.SHA384)); + Assert.True(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA512)); + Assert.False(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA256)); + Assert.False(VerifyData(dsa, DSATestData.HelloBytes, signature, HashAlgorithmName.SHA384)); } } [Fact] - public static void VerifyKnownSignature() + public void VerifyKnownSignature() { using (DSA dsa = DSAFactory.Create()) { @@ -176,16 +260,16 @@ namespace System.Security.Cryptography.Dsa.Tests DSATestData.GetDSA1024_186_2(out dsaParameters, out signature, out data); dsa.ImportParameters(dsaParameters); - Assert.True(dsa.VerifyData(data, signature, HashAlgorithmName.SHA1)); + Assert.True(VerifyData(dsa, data, signature, HashAlgorithmName.SHA1)); // Negative case signature[signature.Length - 1] ^= 0xff; - Assert.False(dsa.VerifyData(data, signature, HashAlgorithmName.SHA1)); + Assert.False(VerifyData(dsa, data, signature, HashAlgorithmName.SHA1)); } } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Sign2048WithSha1() + public void Sign2048WithSha1() { byte[] data = { 1, 2, 3, 4 }; @@ -193,14 +277,14 @@ namespace System.Security.Cryptography.Dsa.Tests { dsa.ImportParameters(DSATestData.GetDSA2048Params()); - byte[] signature = dsa.SignData(data, HashAlgorithmName.SHA1); + byte[] signature = SignData(dsa, data, HashAlgorithmName.SHA1); - Assert.True(dsa.VerifyData(data, signature, HashAlgorithmName.SHA1)); + Assert.True(VerifyData(dsa, data, signature, HashAlgorithmName.SHA1)); } } [ConditionalFact(nameof(SupportsFips186_3))] - public static void Verify2048WithSha1() + public void Verify2048WithSha1() { byte[] data = { 1, 2, 3, 4 }; @@ -212,25 +296,25 @@ namespace System.Security.Cryptography.Dsa.Tests { dsa.ImportParameters(DSATestData.GetDSA2048Params()); - Assert.True(dsa.VerifyData(data, signature, HashAlgorithmName.SHA1), "Untampered data verifies"); + Assert.True(VerifyData(dsa, data, signature, HashAlgorithmName.SHA1), "Untampered data verifies"); data[0] ^= 0xFF; - Assert.False(dsa.VerifyData(data, signature, HashAlgorithmName.SHA1), "Tampered data verifies"); + Assert.False(VerifyData(dsa, data, signature, HashAlgorithmName.SHA1), "Tampered data verifies"); data[0] ^= 0xFF; signature[signature.Length - 1] ^= 0xFF; - Assert.False(dsa.VerifyData(data, signature, HashAlgorithmName.SHA1), "Tampered signature verifies"); + Assert.False(VerifyData(dsa, data, signature, HashAlgorithmName.SHA1), "Tampered signature verifies"); } } - private static void SignAndVerify(byte[] data, string hashAlgorithmName, DSAParameters dsaParameters, int expectedSignatureLength) + private void SignAndVerify(byte[] data, string hashAlgorithmName, DSAParameters dsaParameters, int expectedSignatureLength) { using (DSA dsa = DSAFactory.Create()) { dsa.ImportParameters(dsaParameters); - byte[] signature = dsa.SignData(data, new HashAlgorithmName(hashAlgorithmName)); + byte[] signature = SignData(dsa, data, new HashAlgorithmName(hashAlgorithmName)); Assert.Equal(expectedSignatureLength, signature.Length); - bool signatureMatched = dsa.VerifyData(data, signature, new HashAlgorithmName(hashAlgorithmName)); + bool signatureMatched = VerifyData(dsa, data, signature, new HashAlgorithmName(hashAlgorithmName)); Assert.True(signatureMatched); } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs index 2742746b07..2703972da9 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Xunit; +using Test.Cryptography; namespace System.Security.Cryptography.EcDsa.Tests { @@ -265,6 +266,32 @@ namespace System.Security.Cryptography.EcDsa.Tests } } + [ConditionalFact(nameof(ECExplicitCurvesSupported))] + public static void ExportIncludingPrivateOnPublicOnlyKey() + { + ECParameters iutParameters = new ECParameters + { + Curve = ECCurve.NamedCurves.nistP521, + Q = + { + X = "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray(), + Y = "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray(), + }, + D = "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray(), + }; + + using (ECDsa iut = ECDsaFactory.Create()) + using (ECDsa cavs = ECDsaFactory.Create()) + { + iut.ImportParameters(iutParameters); + cavs.ImportParameters(iut.ExportParameters(false)); + + // Linux throws an Interop.Crypto.OpenSslCryptographicException : CryptographicException + Assert.ThrowsAny(() => cavs.ExportExplicitParameters(true)); + Assert.ThrowsAny(() => cavs.ExportParameters(true)); + } + } + private static void VerifyNamedCurve(ECParameters parameters, ECDsa ec, int keySize, bool includePrivate) { parameters.Validate(); diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.NistValidation.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.NistValidation.cs index e5eea92769..4156395a51 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.NistValidation.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.NistValidation.cs @@ -12,7 +12,7 @@ using Test.Cryptography; namespace System.Security.Cryptography.EcDsa.Tests { - public partial class ECDsaTests : ECDsaTestsBase + public abstract partial class ECDsaTests : ECDsaTestsBase { // These test cases are from http://csrc.nist.gov/groups/STM/cavp/digital-signatures.html#test-vectors // FIPS 186-4 ECDSA test vectors diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.cs index 216dcd7661..d0111b23f3 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.cs @@ -11,478 +11,124 @@ using Xunit; namespace System.Security.Cryptography.EcDsa.Tests { - public partial class ECDsaTests : ECDsaTestsBase + public sealed class ECDsaTests_Array : ECDsaTests { -#if netcoreapp - [Fact] - public void KeySizeProp() + protected override bool VerifyData(ECDsa ecdsa, byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm) => + ecdsa.VerifyData(data, offset, count, signature, hashAlgorithm); + protected override byte[] SignData(ECDsa ecdsa, byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + ecdsa.SignData(data, offset, count, hashAlgorithm); + + [Theory, MemberData(nameof(RealImplementations))] + public void SignData_InvalidArguments_Throws(ECDsa ecdsa) { - using (ECDsa e = ECDsaFactory.Create()) - { - e.KeySize = 384; - Assert.Equal(384, e.KeySize); - ECParameters p384 = e.ExportParameters(false); - Assert.True(p384.Curve.IsNamed); - p384.Validate(); + AssertExtensions.Throws("data", () => ecdsa.SignData((byte[])null, default(HashAlgorithmName))); + AssertExtensions.Throws("data", () => ecdsa.SignData(null, -1, -1, default(HashAlgorithmName))); - e.KeySize = 521; - Assert.Equal(521, e.KeySize); - ECParameters p521 = e.ExportParameters(false); - Assert.True(p521.Curve.IsNamed); - p521.Validate(); + AssertExtensions.Throws("offset", () => ecdsa.SignData(new byte[0], -1, -1, default(HashAlgorithmName))); + AssertExtensions.Throws("offset", () => ecdsa.SignData(new byte[0], 2, 1, default(HashAlgorithmName))); - // Ensure the key was regenerated - Assert.NotEqual(p384.Curve.Oid.FriendlyName, p521.Curve.Oid.FriendlyName); - } + AssertExtensions.Throws("count", () => ecdsa.SignData(new byte[0], 0, -1, default(HashAlgorithmName))); + AssertExtensions.Throws("count", () => ecdsa.SignData(new byte[0], 0, 1, default(HashAlgorithmName))); + + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new byte[0], default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new byte[0], 0, 0, default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new byte[0], 0, 0, default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new byte[10], 0, 10, new HashAlgorithmName(""))); + + Assert.Throws(() => ecdsa.SignData(new byte[0], new HashAlgorithmName(Guid.NewGuid().ToString("N")))); + Assert.Throws(() => ecdsa.SignData(new byte[0], 0, 0, new HashAlgorithmName(Guid.NewGuid().ToString("N")))); } - [Theory, MemberData(nameof(TestNewCurves))] - public void TestRegenKeyExplicit(CurveDef curveDef) + [Theory, MemberData(nameof(RealImplementations))] + public void VerifyData_InvalidArguments_Throws(ECDsa ecdsa) { - ECParameters param, param2; - ECDsa ec, newEc; + AssertExtensions.Throws("data", () => ecdsa.VerifyData((byte[])null, null, default(HashAlgorithmName))); + AssertExtensions.Throws("data", () => ecdsa.VerifyData(null, -1, -1, null, default(HashAlgorithmName))); - using (ec = ECDsaFactory.Create(curveDef.Curve)) - { - param = ec.ExportExplicitParameters(true); - Assert.NotEqual(null, param.D); - using (newEc = ECDsaFactory.Create()) - { - newEc.ImportParameters(param); + AssertExtensions.Throws("signature", () => ecdsa.VerifyData(new byte[0], null, default(HashAlgorithmName))); + AssertExtensions.Throws("signature", () => ecdsa.VerifyData(new byte[0], 0, 0, null, default(HashAlgorithmName))); - // The curve name is not flowed on explicit export\import (by design) so this excercises logic - // that regenerates based on current curve values - newEc.GenerateKey(param.Curve); - param2 = newEc.ExportExplicitParameters(true); + AssertExtensions.Throws("offset", () => ecdsa.VerifyData(new byte[0], -1, -1, null, default(HashAlgorithmName))); + AssertExtensions.Throws("offset", () => ecdsa.VerifyData(new byte[0], 2, 1, null, default(HashAlgorithmName))); - // Only curve should match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - CompareCurve(param.Curve, param2.Curve); + AssertExtensions.Throws("count", () => ecdsa.VerifyData(new byte[0], 0, -1, null, default(HashAlgorithmName))); + AssertExtensions.Throws("count", () => ecdsa.VerifyData(new byte[0], 0, 1, null, default(HashAlgorithmName))); - // Specify same curve name - newEc.GenerateKey(curveDef.Curve); - Assert.Equal(curveDef.KeySize, newEc.KeySize); - param2 = newEc.ExportExplicitParameters(true); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new byte[0], new byte[0], default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new byte[0], 0, 0, new byte[0], default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new byte[10], new byte[0], new HashAlgorithmName(""))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new byte[10], 0, 10, new byte[0], new HashAlgorithmName(""))); - // Only curve should match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - CompareCurve(param.Curve, param2.Curve); - - // Specify different curve than current - if (param.Curve.IsPrime) - { - if (curveDef.Curve.IsNamed && - curveDef.Curve.Oid.FriendlyName != ECCurve.NamedCurves.nistP256.Oid.FriendlyName) - { - // Specify different curve (nistP256) by explicit value - newEc.GenerateKey(ECCurve.NamedCurves.nistP256); - Assert.Equal(256, newEc.KeySize); - param2 = newEc.ExportExplicitParameters(true); - // Keys should should not match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - // P,X,Y (and others) should not match - Assert.True(param2.Curve.IsPrime); - Assert.NotEqual(param.Curve.Prime, param2.Curve.Prime); - Assert.NotEqual(param.Curve.G.X, param2.Curve.G.X); - Assert.NotEqual(param.Curve.G.Y, param2.Curve.G.Y); - - // Reset back to original - newEc.GenerateKey(param.Curve); - Assert.Equal(curveDef.KeySize, newEc.KeySize); - ECParameters copyOfParam1 = newEc.ExportExplicitParameters(true); - // Only curve should match - ComparePrivateKey(param, copyOfParam1, false); - ComparePublicKey(param.Q, copyOfParam1.Q, false); - CompareCurve(param.Curve, copyOfParam1.Curve); - - // Set back to nistP256 - newEc.GenerateKey(param2.Curve); - Assert.Equal(256, newEc.KeySize); - param2 = newEc.ExportExplicitParameters(true); - // Keys should should not match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - // P,X,Y (and others) should not match - Assert.True(param2.Curve.IsPrime); - Assert.NotEqual(param.Curve.Prime, param2.Curve.Prime); - Assert.NotEqual(param.Curve.G.X, param2.Curve.G.X); - Assert.NotEqual(param.Curve.G.Y, param2.Curve.G.Y); - } - } - else if (param.Curve.IsCharacteristic2) - { - if (curveDef.Curve.Oid.Value != ECDSA_Sect193r1_OID_VALUE) - { - if (ECDsaFactory.IsCurveValid(new Oid(ECDSA_Sect193r1_OID_VALUE))) - { - // Specify different curve by name - newEc.GenerateKey(ECCurve.CreateFromValue(ECDSA_Sect193r1_OID_VALUE)); - Assert.Equal(193, newEc.KeySize); - param2 = newEc.ExportExplicitParameters(true); - // Keys should should not match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - // Polynomial,X,Y (and others) should not match - Assert.True(param2.Curve.IsCharacteristic2); - Assert.NotEqual(param.Curve.Polynomial, param2.Curve.Polynomial); - Assert.NotEqual(param.Curve.G.X, param2.Curve.G.X); - Assert.NotEqual(param.Curve.G.Y, param2.Curve.G.Y); - } - } - } - } - } + Assert.Throws(() => ecdsa.VerifyData(new byte[0], new byte[0], new HashAlgorithmName(Guid.NewGuid().ToString("N")))); + Assert.Throws(() => ecdsa.VerifyData(new byte[0], 0, 0, new byte[0], new HashAlgorithmName(Guid.NewGuid().ToString("N")))); } - [Theory] - [MemberData(nameof(TestCurves))] - public void TestRegenKeyNamed(CurveDef curveDef) + [Theory, MemberData(nameof(RealImplementations))] + public void SignHash_InvalidArguments_Throws(ECDsa ecdsa) { - ECParameters param, param2; - ECDsa ec; - - using (ec = ECDsaFactory.Create(curveDef.Curve)) - { - param = ec.ExportParameters(true); - Assert.NotEqual(param.D, null); - param.Validate(); - - ec.GenerateKey(param.Curve); - param2 = ec.ExportParameters(true); - param2.Validate(); - - // Only curve should match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - CompareCurve(param.Curve, param2.Curve); - } + AssertExtensions.Throws("hash", () => ecdsa.SignHash(null)); } - [ConditionalFact(nameof(ECExplicitCurvesSupported))] - public void TestRegenKeyNistP256() + [Theory, MemberData(nameof(RealImplementations))] + public void VerifyHash_InvalidArguments_Throws(ECDsa ecdsa) { - ECParameters param, param2; - ECDsa ec; - - using (ec = ECDsaFactory.Create(256)) - { - param = ec.ExportExplicitParameters(true); - Assert.NotEqual(param.D, null); - - ec.GenerateKey(param.Curve); - param2 = ec.ExportExplicitParameters(true); - - // Only curve should match - ComparePrivateKey(param, param2, false); - ComparePublicKey(param.Q, param2.Q, false); - CompareCurve(param.Curve, param2.Curve); - } + AssertExtensions.Throws("hash", () => ecdsa.VerifyHash(null, null)); + AssertExtensions.Throws("signature", () => ecdsa.VerifyHash(new byte[0], null)); + } + } + + public sealed class ECDsaTests_Stream : ECDsaTests + { + protected override bool VerifyData(ECDsa ecdsa, byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm) + { + var stream = new MemoryStream(data, offset, count); + bool result = ecdsa.VerifyData(stream, signature, hashAlgorithm); + Assert.Equal(stream.Length, stream.Position); + return result; } - [Theory] - [MemberData(nameof(TestCurves))] - public void TestChangeFromNamedCurveToKeySize(CurveDef curveDef) + protected override byte[] SignData(ECDsa ecdsa, byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) { - if (!curveDef.Curve.IsNamed) - return; - - using (ECDsa ec = ECDsaFactory.Create(curveDef.Curve)) - { - ECParameters param = ec.ExportParameters(false); - - // Avoid comparing against same key as in curveDef - if (ec.KeySize != 384 && ec.KeySize != 521) - { - ec.KeySize = 384; - ECParameters param384 = ec.ExportParameters(false); - Assert.NotEqual(param.Curve.Oid.FriendlyName, param384.Curve.Oid.FriendlyName); - Assert.Equal(384, ec.KeySize); - - ec.KeySize = 521; - ECParameters param521 = ec.ExportParameters(false); - Assert.NotEqual(param384.Curve.Oid.FriendlyName, param521.Curve.Oid.FriendlyName); - Assert.Equal(521, ec.KeySize); - } - } + var stream = new MemoryStream(data, offset, count); + byte[] result = ecdsa.SignData(stream, hashAlgorithm); + Assert.Equal(stream.Length, stream.Position); + return result; } - [ConditionalFact(nameof(ECExplicitCurvesSupported))] - public void TestPositive256WithExplicitParameters() + [Theory, MemberData(nameof(RealImplementations))] + public void SignData_InvalidArguments_Throws(ECDsa ecdsa) { - using (ECDsa ecdsa = ECDsaFactory.Create()) - { - ecdsa.ImportParameters(ECDsaTestData.GetNistP256ExplicitTestData()); - Verify256(ecdsa, true); - } + AssertExtensions.Throws("data", () => ecdsa.SignData((Stream)null, default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new MemoryStream(), default(HashAlgorithmName))); + Assert.Throws(() => ecdsa.SignData(new MemoryStream(), new HashAlgorithmName(Guid.NewGuid().ToString("N")))); } - [Fact] - public void TestNegative256WithRandomKey() + [Theory, MemberData(nameof(RealImplementations))] + public void VerifyData_InvalidArguments_Throws(ECDsa ecdsa) { - using (ECDsa ecdsa = ECDsaFactory.Create(ECCurve.NamedCurves.nistP256)) - { - Verify256(ecdsa, false); // will not match because of randomness - } + AssertExtensions.Throws("data", () => ecdsa.VerifyData((Stream)null, null, default(HashAlgorithmName))); + AssertExtensions.Throws("signature", () => ecdsa.VerifyData(new MemoryStream(), null, default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new MemoryStream(), new byte[0], default(HashAlgorithmName))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new MemoryStream(), new byte[0], new HashAlgorithmName(""))); + Assert.Throws(() => ecdsa.VerifyData(new MemoryStream(), new byte[0], new HashAlgorithmName(Guid.NewGuid().ToString("N")))); } -#endif // netcoreapp + } - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArray_NullData_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("data", - () => ecdsa.SignData((byte[])null, default(HashAlgorithmName))); - } + public abstract partial class ECDsaTests : ECDsaTestsBase + { + protected bool VerifyData(ECDsa ecdsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm) => + VerifyData(ecdsa, data, 0, data.Length, signature, hashAlgorithm); + protected abstract bool VerifyData(ECDsa ecdsa, byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm); - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArray_DefaultHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.SignData(new byte[0], default(HashAlgorithmName))); - } + protected byte[] SignData(ECDsa ecdsa, byte[] data, HashAlgorithmName hashAlgorithm) => + SignData(ecdsa, data, 0, data.Length, hashAlgorithm); + protected abstract byte[] SignData(ECDsa ecdsa, byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm); - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_NullData_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("data", - () => ecdsa.SignData(null, -1, -1, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_NegativeOffset_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("offset", - () => ecdsa.SignData(new byte[0], -1, -1, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_OffsetGreaterThanCount_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("offset", - () => ecdsa.SignData(new byte[0], 2, 1, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_NegativeCount_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("count", - () => ecdsa.SignData(new byte[0], 0, -1, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_CountGreaterThanLengthMinusOffset_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("count", - () => ecdsa.SignData(new byte[0], 0, 1, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_DefaultHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.SignData(new byte[0], 0, 0, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataByteArraySpan_EmptyHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.SignData(new byte[10], 0, 10, new HashAlgorithmName(""))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataStream_NullData_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("data", - () => ecdsa.SignData((Stream)null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void SignDataStream_DefaultHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.SignData(new MemoryStream(), default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArray_NullData_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("data", - () => ecdsa.VerifyData((byte[])null, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArray_NullSignature_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("signature", - () => ecdsa.VerifyData(new byte[0], null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArray_DefaultHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.VerifyData(new byte[0], new byte[0], default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_NullData_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("data", - () => ecdsa.VerifyData((byte[])null, -1, -1, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_NegativeOffset_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("offset", - () => ecdsa.VerifyData(new byte[0], -1, -1, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_OffsetGreaterThanCount_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("offset", - () => ecdsa.VerifyData(new byte[0], 2, 1, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_NegativeCount_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("count", - () => ecdsa.VerifyData(new byte[0], 0, -1, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_CountGreaterThanLengthMinusOffset_ThrowsArgumentOutOfRangeException(ECDsa ecdsa) - { - AssertExtensions.Throws("count", - () => ecdsa.VerifyData(new byte[0], 0, 1, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_NullSignature_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("signature", - () => ecdsa.VerifyData(new byte[0], 0, 0, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataByteArraySpan_EmptyHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.VerifyData(new byte[10], 0, 10, new byte[0], new HashAlgorithmName(""))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataStream_NullData_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("data", - () => ecdsa.VerifyData((Stream)null, null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataStream_NullSignature_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws("signature", - () => ecdsa.VerifyData(new MemoryStream(), null, default(HashAlgorithmName))); - } - - [Theory, MemberData(nameof(AllImplementations))] - public void VerifyDataStream_DefaultHashAlgorithm_ThrowsArgumentException(ECDsa ecdsa) - { - AssertExtensions.Throws("hashAlgorithm", - () => ecdsa.VerifyData(new MemoryStream(), new byte[0], default(HashAlgorithmName))); - } - - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public static IEnumerable AllImplementations() - { - return new[] { - new ECDsa[] { ECDsaFactory.Create() }, - new ECDsa[] { new ECDsaStub() }, - }; - } - - public static IEnumerable RealImplementations() - { - return new[] { + public static IEnumerable RealImplementations() => + new[] { new ECDsa[] { ECDsaFactory.Create() }, }; - } - [Theory, MemberData(nameof(RealImplementations))] - public void SignHash_NullHash_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws( - "hash", - () => ecdsa.SignHash(null)); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void VerifyHash_NullHash_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws( - "hash", - () => ecdsa.VerifyHash(null, null)); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void VerifyHash_NullSignature_ThrowsArgumentNullException(ECDsa ecdsa) - { - AssertExtensions.Throws( - "signature", - () => ecdsa.VerifyHash(new byte[0], null)); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - [Theory, MemberData(nameof(RealImplementations))] - public void SignDataByteArray_UnsupportedHashAlgorithm_ThrowsCryptographicException(ECDsa ecdsa) - { - Assert.Throws( - () => ecdsa.SignData(new byte[0], new HashAlgorithmName("NOT_A_REAL_HASH_ALGORITHM"))); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void SignDataByteArraySpan_UnsupportedHashAlgorithm_ThrowsCryptographicException(ECDsa ecdsa) - { - Assert.Throws( - () => ecdsa.SignData(new byte[0], 0, 0, new HashAlgorithmName("NOT_A_REAL_HASH_ALGORITHM"))); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void SignDataStream_UnsupportedHashAlgorithm_ThrowsCryptographicException(ECDsa ecdsa) - { - Assert.Throws( - () => ecdsa.SignData(new MemoryStream(), new HashAlgorithmName("NOT_A_REAL_HASH_ALGORITHM"))); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void VerifyDataByteArray_UnsupportedHashAlgorithm_ThrowsCryptographicException(ECDsa ecdsa) - { - Assert.Throws( - () => ecdsa.VerifyData(new byte[0], new byte[0], new HashAlgorithmName("NOT_A_REAL_HASH_ALGORITHM"))); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void VerifyDataByteArraySpan_UnsupportedHashAlgorithm_ThrowsCryptographicException(ECDsa ecdsa) - { - Assert.Throws( - () => ecdsa.VerifyData(new byte[0], 0, 0, new byte[0], new HashAlgorithmName("NOT_A_REAL_HASH_ALGORITHM"))); - } - - [Theory, MemberData(nameof(RealImplementations))] - public void VerifyDataStream_UnsupportedHashAlgorithm_ThrowsCryptographicException(ECDsa ecdsa) - { - Assert.Throws( - () => ecdsa.VerifyData(new MemoryStream(), new byte[0], new HashAlgorithmName("NOT_A_REAL_HASH_ALGORITHM"))); - } - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [Theory] @@ -491,9 +137,9 @@ namespace System.Security.Cryptography.EcDsa.Tests { // Explicitly larger than Array.Empty byte[] data = new byte[10]; - byte[] signature = ecdsa.SignData(data, data.Length, 0, HashAlgorithmName.SHA256); + byte[] signature = SignData(ecdsa, data, data.Length, 0, HashAlgorithmName.SHA256); - Assert.True(ecdsa.VerifyData(Array.Empty(), signature, HashAlgorithmName.SHA256)); + Assert.True(VerifyData(ecdsa, Array.Empty(), signature, HashAlgorithmName.SHA256)); } [Theory] @@ -502,9 +148,9 @@ namespace System.Security.Cryptography.EcDsa.Tests { // Explicitly larger than Array.Empty byte[] data = new byte[10]; - byte[] signature = ecdsa.SignData(Array.Empty(), HashAlgorithmName.SHA256); + byte[] signature = SignData(ecdsa, Array.Empty(), HashAlgorithmName.SHA256); - Assert.True(ecdsa.VerifyData(data, data.Length, 0, signature, HashAlgorithmName.SHA256)); + Assert.True(VerifyData(ecdsa, data, data.Length, 0, signature, HashAlgorithmName.SHA256)); } [Theory] @@ -514,30 +160,14 @@ namespace System.Security.Cryptography.EcDsa.Tests byte[] data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; byte[] halfData = { 5, 6, 7, 8, 9 }; - byte[] dataSignature = ecdsa.SignData(data, 5, data.Length - 5, HashAlgorithmName.SHA256); - byte[] halfDataSignature = ecdsa.SignData(halfData, HashAlgorithmName.SHA256); + byte[] dataSignature = SignData(ecdsa, data, 5, data.Length - 5, HashAlgorithmName.SHA256); + byte[] halfDataSignature = SignData(ecdsa, halfData, HashAlgorithmName.SHA256); // Cross-feed the VerifyData calls to prove that both offsets work - Assert.True(ecdsa.VerifyData(data, 5, data.Length - 5, halfDataSignature, HashAlgorithmName.SHA256)); - Assert.True(ecdsa.VerifyData(halfData, dataSignature, HashAlgorithmName.SHA256)); + Assert.True(VerifyData(ecdsa, data, 5, data.Length - 5, halfDataSignature, HashAlgorithmName.SHA256)); + Assert.True(VerifyData(ecdsa, halfData, dataSignature, HashAlgorithmName.SHA256)); } -#if netcoreapp // uses ECParameters not available in desktop. - [Fact] - public void PublicKey_CannotSign() - { - using (ECDsa ecdsaPriv = ECDsaFactory.Create()) - using (ECDsa ecdsa = ECDsaFactory.Create()) - { - ECParameters keyParameters = ecdsaPriv.ExportParameters(false); - ecdsa.ImportParameters(keyParameters); - - Assert.ThrowsAny( - () => ecdsa.SignData(new byte[] { 1, 2, 3, 4, 5 }, HashAlgorithmName.SHA256)); - } - } -#endif - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [Theory] @@ -552,7 +182,7 @@ namespace System.Security.Cryptography.EcDsa.Tests ecdsa.KeySize = keySize; // Step 2, ensure the key was generated without throwing. - ecdsa.SignData(Array.Empty(), HashAlgorithmName.SHA256); + SignData(ecdsa, Array.Empty(), HashAlgorithmName.SHA256); } } @@ -579,18 +209,9 @@ namespace System.Security.Cryptography.EcDsa.Tests // large enough to make hashing work though multiple iterations and not a multiple of 4KB it uses. byte[] dataArray = new byte[33333]; - MemoryStream dataStream = new MemoryStream(dataArray, true); - - while (dataStream.Position < dataArray.Length - data.Length) - { - dataStream.Write(data, 0, data.Length); - } - - dataStream.Position = 0; byte[] dataArray2 = new byte[dataArray.Length + 2]; dataArray.CopyTo(dataArray2, 1); - ArraySegment dataSpan = new ArraySegment(dataArray2, 1, dataArray.Length); HashAlgorithm halg; if (hashAlgorithm == HashAlgorithmName.MD5) @@ -613,37 +234,14 @@ namespace System.Security.Cryptography.EcDsa.Tests // // Then, verify that VerifyHash fails if the data is tampered with. - signatures.Add(ecdsa.SignData(dataArray, hashAlgorithm)); - - signatures.Add(ecdsa.SignData(dataSpan.Array, dataSpan.Offset, dataSpan.Count, hashAlgorithm)); - - signatures.Add(ecdsa.SignData(dataStream, hashAlgorithm)); - dataStream.Position = 0; + signatures.Add(SignData(ecdsa, dataArray, hashAlgorithm)); signatures.Add(ecdsa.SignHash(halg.ComputeHash(dataArray))); - signatures.Add(ecdsa.SignHash(halg.ComputeHash(dataSpan.Array, dataSpan.Offset, dataSpan.Count))); - - signatures.Add(ecdsa.SignHash(halg.ComputeHash(dataStream))); - dataStream.Position = 0; - foreach (byte[] signature in signatures) { - Assert.True(ecdsa.VerifyData(dataArray, signature, hashAlgorithm), "Verify 1"); - - Assert.True(ecdsa.VerifyData(dataSpan.Array, dataSpan.Offset, dataSpan.Count, signature, hashAlgorithm), "Verify 2"); - - Assert.True(ecdsa.VerifyData(dataStream, signature, hashAlgorithm), "Verify 3"); - Assert.True(dataStream.Position == dataArray.Length, "Check stream read 3A"); - dataStream.Position = 0; - + Assert.True(VerifyData(ecdsa, dataArray, signature, hashAlgorithm), "Verify 1"); Assert.True(ecdsa.VerifyHash(halg.ComputeHash(dataArray), signature), "Verify 4"); - - Assert.True(ecdsa.VerifyHash(halg.ComputeHash(dataSpan.Array, dataSpan.Offset, dataSpan.Count), signature), "Verify 5"); - - Assert.True(ecdsa.VerifyHash(halg.ComputeHash(dataStream), signature), "Verify 6"); - Assert.True(dataStream.Position == dataArray.Length, "Check stream read 6A"); - dataStream.Position = 0; } int distinctSignatures = signatures.Distinct(new ByteArrayComparer()).Count(); @@ -652,22 +250,8 @@ namespace System.Security.Cryptography.EcDsa.Tests foreach (byte[] signature in signatures) { signature[signature.Length - 1] ^= 0xFF; // flip some bits - - Assert.False(ecdsa.VerifyData(dataArray, signature, hashAlgorithm), "Verify Tampered 1"); - - Assert.False(ecdsa.VerifyData(dataSpan.Array, dataSpan.Offset, dataSpan.Count, signature, hashAlgorithm), "Verify Tampered 2"); - - Assert.False(ecdsa.VerifyData(dataStream, signature, hashAlgorithm), "Verify Tampered 3"); - Assert.True(dataStream.Position == dataArray.Length, "Check stream read 3B"); - dataStream.Position = 0; - + Assert.False(VerifyData(ecdsa, dataArray, signature, hashAlgorithm), "Verify Tampered 1"); Assert.False(ecdsa.VerifyHash(halg.ComputeHash(dataArray), signature), "Verify Tampered 4"); - - Assert.False(ecdsa.VerifyHash(halg.ComputeHash(dataSpan.Array, dataSpan.Offset, dataSpan.Count), signature), "Verify Tampered 5"); - - Assert.False(ecdsa.VerifyHash(halg.ComputeHash(dataStream), signature), "Verify Tampered 6"); - Assert.True(dataStream.Position == dataArray.Length, "Check stream read 6B"); - dataStream.Position = 0; } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs new file mode 100644 index 0000000000..9b464840e5 --- /dev/null +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs @@ -0,0 +1,278 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Security.Cryptography.EcDsa.Tests +{ + public sealed class ECDsaTests_Span : ECDsaTests + { + protected override bool VerifyData(ECDsa ecdsa, byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm) => + ecdsa.VerifyData(new ReadOnlySpan(data, offset, count), signature, hashAlgorithm); + + protected override byte[] SignData(ECDsa ecdsa, byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + TryWithOutputArray(dest => ecdsa.TrySignData(new ReadOnlySpan(data, offset, count), dest, hashAlgorithm, out int bytesWritten) ? (true, bytesWritten) : (false, 0)); + + [Theory, MemberData(nameof(RealImplementations))] + public void SignData_InvalidArguments_Throws(ECDsa ecdsa) + { + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.TrySignData(ReadOnlySpan.Empty, Span.Empty, new HashAlgorithmName(null), out int bytesWritten)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.TrySignData(ReadOnlySpan.Empty, Span.Empty, new HashAlgorithmName(""), out int bytesWritten)); + Assert.Throws(() => ecdsa.TrySignData(ReadOnlySpan.Empty, Span.Empty, new HashAlgorithmName(Guid.NewGuid().ToString("N")), out int bytesWritten)); + } + + [Theory, MemberData(nameof(RealImplementations))] + public void VerifyData_InvalidArguments_Throws(ECDsa ecdsa) + { + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(ReadOnlySpan.Empty, ReadOnlySpan.Empty, new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(ReadOnlySpan.Empty, ReadOnlySpan.Empty, new HashAlgorithmName(""))); + Assert.Throws(() => ecdsa.VerifyData(ReadOnlySpan.Empty, Span.Empty, new HashAlgorithmName(Guid.NewGuid().ToString("N")))); + } + + private static byte[] TryWithOutputArray(Func func) + { + for (int length = 1; ; length = checked(length * 2)) + { + var result = new byte[length]; + var (success, bytesWritten) = func(result); + if (success) + { + Array.Resize(ref result, bytesWritten); + return result; + } + } + } + } + + public abstract partial class ECDsaTests : ECDsaTestsBase + { + [Fact] + public void KeySizeProp() + { + using (ECDsa e = ECDsaFactory.Create()) + { + e.KeySize = 384; + Assert.Equal(384, e.KeySize); + ECParameters p384 = e.ExportParameters(false); + Assert.True(p384.Curve.IsNamed); + p384.Validate(); + + e.KeySize = 521; + Assert.Equal(521, e.KeySize); + ECParameters p521 = e.ExportParameters(false); + Assert.True(p521.Curve.IsNamed); + p521.Validate(); + + // Ensure the key was regenerated + Assert.NotEqual(p384.Curve.Oid.FriendlyName, p521.Curve.Oid.FriendlyName); + } + } + + [Theory, MemberData(nameof(TestNewCurves))] + public void TestRegenKeyExplicit(CurveDef curveDef) + { + ECParameters param, param2; + ECDsa ec, newEc; + + using (ec = ECDsaFactory.Create(curveDef.Curve)) + { + param = ec.ExportExplicitParameters(true); + Assert.NotEqual(null, param.D); + using (newEc = ECDsaFactory.Create()) + { + newEc.ImportParameters(param); + + // The curve name is not flowed on explicit export\import (by design) so this excercises logic + // that regenerates based on current curve values + newEc.GenerateKey(param.Curve); + param2 = newEc.ExportExplicitParameters(true); + + // Only curve should match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + CompareCurve(param.Curve, param2.Curve); + + // Specify same curve name + newEc.GenerateKey(curveDef.Curve); + Assert.Equal(curveDef.KeySize, newEc.KeySize); + param2 = newEc.ExportExplicitParameters(true); + + // Only curve should match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + CompareCurve(param.Curve, param2.Curve); + + // Specify different curve than current + if (param.Curve.IsPrime) + { + if (curveDef.Curve.IsNamed && + curveDef.Curve.Oid.FriendlyName != ECCurve.NamedCurves.nistP256.Oid.FriendlyName) + { + // Specify different curve (nistP256) by explicit value + newEc.GenerateKey(ECCurve.NamedCurves.nistP256); + Assert.Equal(256, newEc.KeySize); + param2 = newEc.ExportExplicitParameters(true); + // Keys should should not match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + // P,X,Y (and others) should not match + Assert.True(param2.Curve.IsPrime); + Assert.NotEqual(param.Curve.Prime, param2.Curve.Prime); + Assert.NotEqual(param.Curve.G.X, param2.Curve.G.X); + Assert.NotEqual(param.Curve.G.Y, param2.Curve.G.Y); + + // Reset back to original + newEc.GenerateKey(param.Curve); + Assert.Equal(curveDef.KeySize, newEc.KeySize); + ECParameters copyOfParam1 = newEc.ExportExplicitParameters(true); + // Only curve should match + ComparePrivateKey(param, copyOfParam1, false); + ComparePublicKey(param.Q, copyOfParam1.Q, false); + CompareCurve(param.Curve, copyOfParam1.Curve); + + // Set back to nistP256 + newEc.GenerateKey(param2.Curve); + Assert.Equal(256, newEc.KeySize); + param2 = newEc.ExportExplicitParameters(true); + // Keys should should not match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + // P,X,Y (and others) should not match + Assert.True(param2.Curve.IsPrime); + Assert.NotEqual(param.Curve.Prime, param2.Curve.Prime); + Assert.NotEqual(param.Curve.G.X, param2.Curve.G.X); + Assert.NotEqual(param.Curve.G.Y, param2.Curve.G.Y); + } + } + else if (param.Curve.IsCharacteristic2) + { + if (curveDef.Curve.Oid.Value != ECDSA_Sect193r1_OID_VALUE) + { + if (ECDsaFactory.IsCurveValid(new Oid(ECDSA_Sect193r1_OID_VALUE))) + { + // Specify different curve by name + newEc.GenerateKey(ECCurve.CreateFromValue(ECDSA_Sect193r1_OID_VALUE)); + Assert.Equal(193, newEc.KeySize); + param2 = newEc.ExportExplicitParameters(true); + // Keys should should not match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + // Polynomial,X,Y (and others) should not match + Assert.True(param2.Curve.IsCharacteristic2); + Assert.NotEqual(param.Curve.Polynomial, param2.Curve.Polynomial); + Assert.NotEqual(param.Curve.G.X, param2.Curve.G.X); + Assert.NotEqual(param.Curve.G.Y, param2.Curve.G.Y); + } + } + } + } + } + } + + [Theory] + [MemberData(nameof(TestCurves))] + public void TestRegenKeyNamed(CurveDef curveDef) + { + ECParameters param, param2; + ECDsa ec; + + using (ec = ECDsaFactory.Create(curveDef.Curve)) + { + param = ec.ExportParameters(true); + Assert.NotEqual(param.D, null); + param.Validate(); + + ec.GenerateKey(param.Curve); + param2 = ec.ExportParameters(true); + param2.Validate(); + + // Only curve should match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + CompareCurve(param.Curve, param2.Curve); + } + } + + [ConditionalFact(nameof(ECExplicitCurvesSupported))] + public void TestRegenKeyNistP256() + { + ECParameters param, param2; + ECDsa ec; + + using (ec = ECDsaFactory.Create(256)) + { + param = ec.ExportExplicitParameters(true); + Assert.NotEqual(param.D, null); + + ec.GenerateKey(param.Curve); + param2 = ec.ExportExplicitParameters(true); + + // Only curve should match + ComparePrivateKey(param, param2, false); + ComparePublicKey(param.Q, param2.Q, false); + CompareCurve(param.Curve, param2.Curve); + } + } + + [Theory] + [MemberData(nameof(TestCurves))] + public void TestChangeFromNamedCurveToKeySize(CurveDef curveDef) + { + if (!curveDef.Curve.IsNamed) + return; + + using (ECDsa ec = ECDsaFactory.Create(curveDef.Curve)) + { + ECParameters param = ec.ExportParameters(false); + + // Avoid comparing against same key as in curveDef + if (ec.KeySize != 384 && ec.KeySize != 521) + { + ec.KeySize = 384; + ECParameters param384 = ec.ExportParameters(false); + Assert.NotEqual(param.Curve.Oid.FriendlyName, param384.Curve.Oid.FriendlyName); + Assert.Equal(384, ec.KeySize); + + ec.KeySize = 521; + ECParameters param521 = ec.ExportParameters(false); + Assert.NotEqual(param384.Curve.Oid.FriendlyName, param521.Curve.Oid.FriendlyName); + Assert.Equal(521, ec.KeySize); + } + } + } + + [ConditionalFact(nameof(ECExplicitCurvesSupported))] + public void TestPositive256WithExplicitParameters() + { + using (ECDsa ecdsa = ECDsaFactory.Create()) + { + ecdsa.ImportParameters(ECDsaTestData.GetNistP256ExplicitTestData()); + Verify256(ecdsa, true); + } + } + + [Fact] + public void TestNegative256WithRandomKey() + { + using (ECDsa ecdsa = ECDsaFactory.Create(ECCurve.NamedCurves.nistP256)) + { + Verify256(ecdsa, false); // will not match because of randomness + } + } + + [Fact] + public void PublicKey_CannotSign() + { + using (ECDsa ecdsaPriv = ECDsaFactory.Create()) + using (ECDsa ecdsa = ECDsaFactory.Create()) + { + ECParameters keyParameters = ecdsaPriv.ExportParameters(false); + ecdsa.ImportParameters(keyParameters); + + Assert.ThrowsAny( + () => SignData(ecdsa, new byte[] { 1, 2, 3, 4, 5 }, HashAlgorithmName.SHA256)); + } + } + } +} diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherTests.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherTests.cs index 1e27d1902a..082fa40a5b 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherTests.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RC2/RC2CipherTests.cs @@ -241,5 +241,83 @@ namespace System.Security.Cryptography.Encryption.RC2.Tests } } } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void EncryptWithLargeOutputBuffer(bool blockAlignedOutput) + { + using (RC2 alg = RC2Factory.Create()) + using (ICryptoTransform xform = alg.CreateEncryptor()) + { + // 8 blocks, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize + outputPadding]; + // 2 blocks of 0x00 + byte[] input = new byte[alg.BlockSize / 4]; + int outputOffset = 0; + + outputOffset += xform.TransformBlock(input, 0, input.Length, output, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, output, outputOffset, overflow.Length); + outputOffset += overflow.Length; + + Assert.Equal(3 * (alg.BlockSize / 8), outputOffset); + string outputAsHex = output.ByteArrayToHex(); + Assert.NotEqual(new string('0', outputOffset * 2), outputAsHex.Substring(0, outputOffset * 2)); + Assert.Equal(new string('0', (output.Length - outputOffset) * 2), outputAsHex.Substring(outputOffset * 2)); + } + } + + [Theory] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] + public static void TransformWithTooShortOutputBuffer(bool encrypt, bool blockAlignedOutput) + { + using (RC2 alg = RC2Factory.Create()) + using (ICryptoTransform xform = encrypt ? alg.CreateEncryptor() : alg.CreateDecryptor()) + { + // 1 block, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize / 8 + outputPadding]; + // 3 blocks of 0x00 + byte[] input = new byte[3 * (alg.BlockSize / 8)]; + + Assert.Throws( + () => xform.TransformBlock(input, 0, input.Length, output, 0)); + + Assert.Equal(new byte[output.Length], output); + } + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void MultipleBlockDecryptTransform(bool blockAlignedOutput) + { + const string ExpectedOutput = "This is a test"; + + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] key = "0123456789ABCDEF".HexToByteArray(); + byte[] iv = "0123456789ABCDEF".HexToByteArray(); + byte[] outputBytes = new byte[iv.Length * 2 + outputPadding]; + byte[] input = "DB5400368C7E67FF5F9E1FA99641EB69".HexToByteArray(); + int outputOffset = 0; + + using (RC2 alg = RC2Factory.Create()) + using (ICryptoTransform xform = alg.CreateDecryptor(key, iv)) + { + Assert.Equal(2 * alg.BlockSize, (outputBytes.Length - outputPadding) * 8); + outputOffset += xform.TransformBlock(input, 0, input.Length, outputBytes, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, outputBytes, outputOffset, overflow.Length); + outputOffset += overflow.Length; + } + + string decrypted = Encoding.ASCII.GetString(outputBytes, 0, outputOffset); + Assert.Equal(ExpectedOutput, decrypted); + } } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs index 19d56555bc..028a908597 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs @@ -6,12 +6,43 @@ using Xunit; namespace System.Security.Cryptography.Rsa.Tests { - public class EncryptDecrypt + public sealed class EncryptDecrypt_Array : EncryptDecrypt + { + protected override byte[] Encrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding) => + rsa.Encrypt(data, padding); + protected override byte[] Decrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding) => + rsa.Decrypt(data, padding); + + [Fact] + public void NullArray_Throws() + { + using (RSA rsa = RSAFactory.Create()) + { + AssertExtensions.Throws("data", () => rsa.Encrypt(null, RSAEncryptionPadding.OaepSHA1)); + AssertExtensions.Throws("data", () => rsa.Decrypt(null, RSAEncryptionPadding.OaepSHA1)); + } + } + } + + public abstract class EncryptDecrypt { private static bool EphemeralKeysAreExportable => !PlatformDetection.IsFullFramework || PlatformDetection.IsNetfx462OrNewer(); + protected abstract byte[] Encrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding); + protected abstract byte[] Decrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding); + [Fact] - public static void DecryptSavedAnswer() + public void NullPadding_Throws() + { + using (RSA rsa = RSAFactory.Create()) + { + AssertExtensions.Throws("padding", () => Encrypt(rsa, new byte[1], null)); + AssertExtensions.Throws("padding", () => Decrypt(rsa, new byte[1], null)); + } + } + + [Fact] + public void DecryptSavedAnswer() { byte[] cipherBytes = { @@ -38,14 +69,14 @@ namespace System.Security.Cryptography.Rsa.Tests using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.RSA1024Params); - output = rsa.Decrypt(cipherBytes, RSAEncryptionPadding.OaepSHA1); + output = Decrypt(rsa, cipherBytes, RSAEncryptionPadding.OaepSHA1); } Assert.Equal(TestData.HelloBytes, output); } [Fact] - public static void DecryptWithPublicKey_Fails() + public void DecryptWithPublicKey_Fails() { byte[] cipherBytes = { @@ -79,12 +110,12 @@ namespace System.Security.Cryptography.Rsa.Tests rsa.ImportParameters(pubParameters); Assert.ThrowsAny( - () => rsa.Decrypt(cipherBytes, RSAEncryptionPadding.OaepSHA1)); + () => Decrypt(rsa, cipherBytes, RSAEncryptionPadding.OaepSHA1)); } } [Fact] - public static void DecryptSavedAnswer_OaepSHA384() + public void DecryptSavedAnswer_OaepSHA384() { byte[] cipherBytes = { @@ -130,12 +161,12 @@ namespace System.Security.Cryptography.Rsa.Tests if (RSAFactory.SupportsSha2Oaep) { - output = rsa.Decrypt(cipherBytes, RSAEncryptionPadding.OaepSHA384); + output = Decrypt(rsa, cipherBytes, RSAEncryptionPadding.OaepSHA384); } else { Assert.ThrowsAny( - () => rsa.Decrypt(cipherBytes, RSAEncryptionPadding.OaepSHA384)); + () => Decrypt(rsa, cipherBytes, RSAEncryptionPadding.OaepSHA384)); return; } @@ -145,7 +176,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void DecryptSavedAnswerUnusualExponent() + public void DecryptSavedAnswerUnusualExponent() { byte[] cipherBytes = { @@ -172,22 +203,22 @@ namespace System.Security.Cryptography.Rsa.Tests using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.UnusualExponentParameters); - output = rsa.Decrypt(cipherBytes, RSAEncryptionPadding.OaepSHA1); + output = Decrypt(rsa, cipherBytes, RSAEncryptionPadding.OaepSHA1); } Assert.Equal(TestData.HelloBytes, output); } [Fact] - public static void RsaCryptRoundtrip() + public void RsaCryptRoundtrip() { byte[] crypt; byte[] output; using (RSA rsa = RSAFactory.Create()) { - crypt = rsa.Encrypt(TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); - output = rsa.Decrypt(crypt, RSAEncryptionPadding.OaepSHA1); + crypt = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); + output = Decrypt(rsa, crypt, RSAEncryptionPadding.OaepSHA1); } Assert.NotEqual(crypt, output); @@ -195,24 +226,24 @@ namespace System.Security.Cryptography.Rsa.Tests } [ConditionalFact(nameof(EphemeralKeysAreExportable))] - public static void RsaDecryptAfterExport() + public void RsaDecryptAfterExport() { byte[] output; using (RSA rsa = RSAFactory.Create()) { - byte[] crypt = rsa.Encrypt(TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); + byte[] crypt = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); // Export the key, this should not clear/destroy the key. RSAParameters ignored = rsa.ExportParameters(true); - output = rsa.Decrypt(crypt, RSAEncryptionPadding.OaepSHA1); + output = Decrypt(rsa, crypt, RSAEncryptionPadding.OaepSHA1); } Assert.Equal(TestData.HelloBytes, output); } [Fact] - public static void LargeKeyCryptRoundtrip() + public void LargeKeyCryptRoundtrip() { byte[] output; @@ -228,18 +259,18 @@ namespace System.Security.Cryptography.Rsa.Tests return; } - byte[] crypt = rsa.Encrypt(TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); + byte[] crypt = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); Assert.Equal(rsa.KeySize, crypt.Length * 8); - output = rsa.Decrypt(crypt, RSAEncryptionPadding.OaepSHA1); + output = Decrypt(rsa, crypt, RSAEncryptionPadding.OaepSHA1); } Assert.Equal(TestData.HelloBytes, output); } [Fact] - public static void UnusualExponentCryptRoundtrip() + public void UnusualExponentCryptRoundtrip() { byte[] crypt; byte[] output; @@ -248,8 +279,8 @@ namespace System.Security.Cryptography.Rsa.Tests { rsa.ImportParameters(TestData.UnusualExponentParameters); - crypt = rsa.Encrypt(TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); - output = rsa.Decrypt(crypt, RSAEncryptionPadding.OaepSHA1); + crypt = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); + output = Decrypt(rsa, crypt, RSAEncryptionPadding.OaepSHA1); } Assert.NotEqual(crypt, output); @@ -257,7 +288,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void NotSupportedValueMethods() + public void NotSupportedValueMethods() { using (RSA rsa = RSAFactory.Create()) { diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs new file mode 100644 index 0000000000..9f53f53c3e --- /dev/null +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs @@ -0,0 +1,98 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Security.Cryptography.Rsa.Tests +{ + public sealed class EncryptDecrypt_Span : EncryptDecrypt + { + protected override byte[] Encrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding) => + TryWithOutputArray(dest => rsa.TryEncrypt(data, dest, padding, out int bytesWritten) ? (true, bytesWritten) : (false, 0)); + + protected override byte[] Decrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding) => + TryWithOutputArray(dest => rsa.TryDecrypt(data, dest, padding, out int bytesWritten) ? (true, bytesWritten) : (false, 0)); + + private static byte[] TryWithOutputArray(Func func) + { + for (int length = 1; ; length = checked(length * 2)) + { + var result = new byte[length]; + var (success, bytesWritten) = func(result); + if (success) + { + Array.Resize(ref result, bytesWritten); + return result; + } + } + } + + [Fact] + public void Decrypt_VariousSizeSpans_Success() + { + using (RSA rsa = RSAFactory.Create()) + { + rsa.ImportParameters(TestData.RSA1024Params); + byte[] cipherBytes = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); + byte[] actual; + int bytesWritten; + + // Too small + actual = new byte[TestData.HelloBytes.Length - 1]; + Assert.False(rsa.TryDecrypt(cipherBytes, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(0, bytesWritten); + Assert.Equal(new byte[actual.Length], actual); + + // Just right... but that may be insufficient on Unix, where with padding the output destination + // may need to be larger than the actual decrypted content. + actual = new byte[TestData.HelloBytes.Length]; + bool decrypted = rsa.TryDecrypt(cipherBytes, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten); + if (RSAFactory.SupportsDecryptingIntoExactSpaceRequired || decrypted) + { + Assert.True(decrypted); + Assert.Equal(TestData.HelloBytes.Length, bytesWritten); + Assert.Equal(TestData.HelloBytes, actual); + } + else + { + Assert.Equal(0, bytesWritten); + Assert.Equal(new byte[actual.Length], actual); + } + + // Bigger than needed + actual = new byte[TestData.HelloBytes.Length + 1000]; + Assert.True(rsa.TryDecrypt(cipherBytes, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(TestData.HelloBytes.Length, bytesWritten); + Assert.Equal(TestData.HelloBytes, actual.AsSpan().Slice(0, TestData.HelloBytes.Length).ToArray()); + } + } + + [Fact] + public void Encrypt_VariousSizeSpans_Success() + { + using (RSA rsa = RSAFactory.Create()) + { + rsa.ImportParameters(TestData.RSA1024Params); + byte[] cipherBytes = Encrypt(rsa, TestData.HelloBytes, RSAEncryptionPadding.OaepSHA1); + byte[] actual; + int bytesWritten; + + // Too small + actual = new byte[cipherBytes.Length - 1]; + Assert.False(rsa.TryEncrypt(TestData.HelloBytes, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(0, bytesWritten); + + // Just right + actual = new byte[cipherBytes.Length]; + Assert.True(rsa.TryEncrypt(TestData.HelloBytes, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(cipherBytes.Length, bytesWritten); + + // Bigger than needed + actual = new byte[cipherBytes.Length + 1]; + Assert.True(rsa.TryEncrypt(TestData.HelloBytes, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(cipherBytes.Length, bytesWritten); + } + } + } +} diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs index dbaaf0d73e..a34642a234 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs @@ -10,6 +10,7 @@ namespace System.Security.Cryptography.Rsa.Tests RSA Create(int keySize); bool Supports384PrivateKey { get; } bool SupportsSha2Oaep { get; } + bool SupportsDecryptingIntoExactSpaceRequired { get; } } public static partial class RSAFactory @@ -27,5 +28,7 @@ namespace System.Security.Cryptography.Rsa.Tests public static bool Supports384PrivateKey => s_provider.Supports384PrivateKey; public static bool SupportsSha2Oaep => s_provider.SupportsSha2Oaep; + + public static bool SupportsDecryptingIntoExactSpaceRequired => s_provider.SupportsDecryptingIntoExactSpaceRequired; } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs index a7e712b111..b2b7e1a459 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs @@ -8,27 +8,87 @@ using Xunit; namespace System.Security.Cryptography.Rsa.Tests { - public class SignVerify + public sealed class SignVerify_Array : SignVerify + { + protected override byte[] SignData(RSA rsa, byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + rsa.SignData(data, hashAlgorithm, padding); + protected override byte[] SignHash(RSA rsa, byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + rsa.SignHash(hash, hashAlgorithm, padding); + protected override bool VerifyData(RSA rsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + rsa.VerifyData(data, signature, hashAlgorithm, padding); + protected override bool VerifyHash(RSA rsa, byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + rsa.VerifyHash(hash, signature, hashAlgorithm, padding); + + [Fact] + public void NullArray_Throws() + { + using (RSA rsa = RSAFactory.Create()) + { + AssertExtensions.Throws("data", () => SignData(rsa, null, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + AssertExtensions.Throws("hash", () => SignHash(rsa, null, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + + AssertExtensions.Throws("data", () => VerifyData(rsa, null, new byte[1], HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + AssertExtensions.Throws("hash", () => VerifyHash(rsa, null, new byte[1], HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + + AssertExtensions.Throws("signature", () => VerifyData(rsa, new byte[1], null, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + AssertExtensions.Throws("signature", () => VerifyHash(rsa, new byte[1], null, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + } + } + } + + public abstract class SignVerify { public static bool BadKeyFormatDoesntThrow => !PlatformDetection.IsFullFramework || PlatformDetection.IsNetfx462OrNewer(); public static bool InvalidKeySizeDoesntThrow => !PlatformDetection.IsFullFramework || PlatformDetection.IsNetfx462OrNewer(); - [Fact] - public static void InvalidKeySize_DoesNotInvalidateKey() + protected abstract byte[] SignData(RSA rsa, byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding); + protected abstract byte[] SignHash(RSA rsa, byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding); + protected abstract bool VerifyData(RSA rsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding); + protected abstract bool VerifyHash(RSA rsa, byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding); + + [Theory] + [InlineData(null)] + [InlineData("")] + public void InvalidHashAlgorithmName_Throws(string name) { using (RSA rsa = RSAFactory.Create()) { - byte[] signature = rsa.SignData(TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); - - // A 2049-bit key is hard to describe, none of the providers support it. - Assert.ThrowsAny(() => rsa.KeySize = 2049); - - Assert.True(rsa.VerifyData(TestData.HelloBytes, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + var invalidName = new HashAlgorithmName(name); + AssertExtensions.Throws("hashAlgorithm", () => SignData(rsa, new byte[1], invalidName, RSASignaturePadding.Pkcs1)); + AssertExtensions.Throws("hashAlgorithm", () => SignHash(rsa, new byte[1], invalidName, RSASignaturePadding.Pkcs1)); + AssertExtensions.Throws("hashAlgorithm", () => VerifyData(rsa, new byte[1], new byte[1], invalidName, RSASignaturePadding.Pkcs1)); + AssertExtensions.Throws("hashAlgorithm", () => VerifyHash(rsa, new byte[1], new byte[1], invalidName, RSASignaturePadding.Pkcs1)); } } [Fact] - public static void PublicKey_CannotSign() + public void NullPadding_Throws() + { + using (RSA rsa = RSAFactory.Create()) + { + AssertExtensions.Throws("padding", () => SignData(rsa, new byte[1], HashAlgorithmName.SHA1, null)); + AssertExtensions.Throws("padding", () => SignHash(rsa, new byte[1], HashAlgorithmName.SHA1, null)); + AssertExtensions.Throws("padding", () => VerifyData(rsa, new byte[1], new byte[1], HashAlgorithmName.SHA1, null)); + AssertExtensions.Throws("padding", () => VerifyHash(rsa, new byte[1], new byte[1], HashAlgorithmName.SHA1, null)); + } + } + + [Fact] + public void InvalidKeySize_DoesNotInvalidateKey() + { + using (RSA rsa = RSAFactory.Create()) + { + byte[] signature = SignData(rsa, TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + + // A 2049-bit key is hard to describe, none of the providers support it. + Assert.ThrowsAny(() => rsa.KeySize = 2049); + + Assert.True(VerifyData(rsa, TestData.HelloBytes, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + } + } + + [Fact] + public void PublicKey_CannotSign() { using (RSA rsa = RSAFactory.Create()) using (RSA rsaPub = RSAFactory.Create()) @@ -41,27 +101,17 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void SignEmptyHash() + public void SignEmptyHash() { using (RSA rsa = RSAFactory.Create()) { Assert.ThrowsAny( - () => rsa.SignHash(Array.Empty(), HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); - } - } - - [Fact] - public static void SignNullHash() - { - using (RSA rsa = RSAFactory.Create()) - { - Assert.ThrowsAny( - () => rsa.SignHash(null, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); + () => SignHash(rsa, Array.Empty(), HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1)); } } [ConditionalFact(nameof(InvalidKeySizeDoesntThrow))] - public static void ExpectedSignature_SHA1_384() + public void ExpectedSignature_SHA1_384() { byte[] expectedSignature = { @@ -92,7 +142,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [ConditionalFact(nameof(InvalidKeySizeDoesntThrow))] - public static void ExpectedSignature_SHA1_1032() + public void ExpectedSignature_SHA1_1032() { byte[] expectedSignature = { @@ -119,7 +169,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void ExpectedSignature_SHA1_2048() + public void ExpectedSignature_SHA1_2048() { byte[] expectedSignature = new byte[] { @@ -161,7 +211,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void ExpectedSignature_SHA256_1024() + public void ExpectedSignature_SHA256_1024() { byte[] expectedSignature = new byte[] { @@ -187,7 +237,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void ExpectedSignature_SHA256_2048() + public void ExpectedSignature_SHA256_2048() { byte[] expectedSignature = new byte[] { @@ -229,7 +279,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void ExpectSignature_SHA256_1024_Stream() + public void ExpectSignature_SHA256_1024_Stream() { byte[] expectedSignature = new byte[] { @@ -264,7 +314,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [ConditionalFact(nameof(InvalidKeySizeDoesntThrow))] - public static void VerifySignature_SHA1_384() + public void VerifySignature_SHA1_384() { byte[] signature = { @@ -280,7 +330,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [ConditionalFact(nameof(InvalidKeySizeDoesntThrow))] - public static void VerifySignature_SHA1_1032() + public void VerifySignature_SHA1_1032() { byte[] signature = { @@ -307,7 +357,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void VerifySignature_SHA1_2048() + public void VerifySignature_SHA1_2048() { byte[] signature = new byte[] { @@ -349,7 +399,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void VerifySignature_SHA256_1024() + public void VerifySignature_SHA256_1024() { byte[] signature = new byte[] { @@ -375,7 +425,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void VerifySignature_SHA256_2048() + public void VerifySignature_SHA256_2048() { byte[] signature = new byte[] { @@ -417,86 +467,86 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void SignAndVerify_SHA1_1024() + public void SignAndVerify_SHA1_1024() { SignAndVerify(TestData.HelloBytes, "SHA1", TestData.RSA1024Params); } [Fact] - public static void SignAndVerify_SHA1_2048() + public void SignAndVerify_SHA1_2048() { SignAndVerify(TestData.HelloBytes, "SHA1", TestData.RSA2048Params); } [Fact] - public static void SignAndVerify_SHA256_1024() + public void SignAndVerify_SHA256_1024() { SignAndVerify(TestData.HelloBytes, "SHA256", TestData.RSA1024Params); } [Fact] - public static void NegativeVerify_WrongAlgorithm() + public void NegativeVerify_WrongAlgorithm() { using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.RSA2048Params); - byte[] signature = rsa.SignData(TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); - bool signatureMatched = rsa.VerifyData(TestData.HelloBytes, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + byte[] signature = SignData(rsa, TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + bool signatureMatched = VerifyData(rsa, TestData.HelloBytes, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); Assert.False(signatureMatched); } } [Fact] - public static void NegativeVerify_WrongSignature() + public void NegativeVerify_WrongSignature() { using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.RSA2048Params); - byte[] signature = rsa.SignData(TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + byte[] signature = SignData(rsa, TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); // Invalidate the signature. signature[0] = unchecked((byte)~signature[0]); - bool signatureMatched = rsa.VerifyData(TestData.HelloBytes, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + bool signatureMatched = VerifyData(rsa, TestData.HelloBytes, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); Assert.False(signatureMatched); } } [Fact] - public static void NegativeVerify_TamperedData() + public void NegativeVerify_TamperedData() { using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.RSA2048Params); - byte[] signature = rsa.SignData(TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); - bool signatureMatched = rsa.VerifyData(Array.Empty(), signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + byte[] signature = SignData(rsa, TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + bool signatureMatched = VerifyData(rsa, Array.Empty(), signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); Assert.False(signatureMatched); } } [ConditionalFact(nameof(BadKeyFormatDoesntThrow))] - public static void NegativeVerify_BadKeysize() + public void NegativeVerify_BadKeysize() { byte[] signature; using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.RSA2048Params); - signature = rsa.SignData(TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + signature = SignData(rsa, TestData.HelloBytes, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); } using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(TestData.RSA1024Params); - bool signatureMatched = rsa.VerifyData(TestData.HelloBytes, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + bool signatureMatched = VerifyData(rsa, TestData.HelloBytes, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); Assert.False(signatureMatched); } } [Fact] - public static void ExpectedHashSignature_SHA1_2048() + public void ExpectedHashSignature_SHA1_2048() { byte[] expectedHashSignature = new byte[] { @@ -545,7 +595,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void ExpectedHashSignature_SHA256_1024() + public void ExpectedHashSignature_SHA256_1024() { byte[] expectedHashSignature = new byte[] { @@ -578,7 +628,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void ExpectedHashSignature_SHA256_2048() + public void ExpectedHashSignature_SHA256_2048() { byte[] expectedHashSignature = new byte[] { @@ -627,7 +677,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void VerifyHashSignature_SHA1_2048() + public void VerifyHashSignature_SHA1_2048() { byte[] hashSignature = new byte[] { @@ -676,7 +726,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void VerifyHashSignature_SHA256_1024() + public void VerifyHashSignature_SHA256_1024() { byte[] hashSignature = new byte[] { @@ -709,7 +759,7 @@ namespace System.Security.Cryptography.Rsa.Tests } [Fact] - public static void VerifyHashSignature_SHA256_2048() + public void VerifyHashSignature_SHA256_2048() { byte[] hashSignature = new byte[] { @@ -757,7 +807,7 @@ namespace System.Security.Cryptography.Rsa.Tests VerifyHashSignature(hashSignature, dataHash, "SHA256", TestData.RSA2048Params); } - private static void ExpectSignature( + private void ExpectSignature( byte[] expectedSignature, byte[] data, string hashAlgorithmName, @@ -772,13 +822,13 @@ namespace System.Security.Cryptography.Rsa.Tests using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(rsaParameters); - signature = rsa.SignData(data, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); + signature = SignData(rsa, data, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); } Assert.Equal(expectedSignature, signature); } - private static void ExpectHashSignature( + private void ExpectHashSignature( byte[] expectedSignature, byte[] dataHash, string hashAlgorithmName, @@ -793,13 +843,13 @@ namespace System.Security.Cryptography.Rsa.Tests using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(rsaParameters); - signature = rsa.SignHash(dataHash, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); + signature = SignHash(rsa, dataHash, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); } Assert.Equal(expectedSignature, signature); } - private static void VerifySignature( + private void VerifySignature( byte[] signature, byte[] data, string hashAlgorithmName, @@ -816,13 +866,13 @@ namespace System.Security.Cryptography.Rsa.Tests using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(publicOnly); - signatureMatched = rsa.VerifyData(data, signature, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); + signatureMatched = VerifyData(rsa, data, signature, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); } Assert.True(signatureMatched); } - private static void VerifyHashSignature( + private void VerifyHashSignature( byte[] signature, byte[] dataHash, string hashAlgorithmName, @@ -839,19 +889,19 @@ namespace System.Security.Cryptography.Rsa.Tests using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(publicOnly); - signatureMatched = rsa.VerifyHash(dataHash, signature, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); + signatureMatched = VerifyHash(rsa, dataHash, signature, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); } Assert.True(signatureMatched); } - private static void SignAndVerify(byte[] data, string hashAlgorithmName, RSAParameters rsaParameters) + private void SignAndVerify(byte[] data, string hashAlgorithmName, RSAParameters rsaParameters) { using (RSA rsa = RSAFactory.Create()) { rsa.ImportParameters(rsaParameters); - byte[] signature = rsa.SignData(data, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); - bool signatureMatched = rsa.VerifyData(data, signature, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); + byte[] signature = SignData(rsa, data, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); + bool signatureMatched = VerifyData(rsa, data, signature, new HashAlgorithmName(hashAlgorithmName), RSASignaturePadding.Pkcs1); Assert.True(signatureMatched); } } diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs new file mode 100644 index 0000000000..21e080e873 --- /dev/null +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Security.Cryptography.Rsa.Tests +{ + public sealed class SignVerify_Span : SignVerify + { + protected override byte[] SignData(RSA rsa, byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + TryWithOutputArray(dest => rsa.TrySignData(data, dest, hashAlgorithm, padding, out int bytesWritten) ? (true, bytesWritten) : (false, 0)); + + protected override byte[] SignHash(RSA rsa, byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + TryWithOutputArray(dest => rsa.TrySignHash(hash, dest, hashAlgorithm, padding, out int bytesWritten) ? (true, bytesWritten) : (false, 0)); + + protected override bool VerifyData(RSA rsa, byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + rsa.VerifyData((ReadOnlySpan)data, (ReadOnlySpan)signature, hashAlgorithm, padding); + + protected override bool VerifyHash(RSA rsa, byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + rsa.VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature, hashAlgorithm, padding); + + private static byte[] TryWithOutputArray(Func func) + { + for (int length = 1; ; length = checked(length * 2)) + { + var result = new byte[length]; + var (success, bytesWritten) = func(result); + if (success) + { + Array.Resize(ref result, bytesWritten); + return result; + } + } + } + } +} diff --git a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs index 351e0f1563..25d452fc21 100644 --- a/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs +++ b/external/corefx/src/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Text; using Test.Cryptography; using Xunit; @@ -288,5 +289,93 @@ namespace System.Security.Cryptography.Encryption.TripleDes.Tests Assert.Equal(expectedDecrypted, decrypted); } } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void EncryptWithLargeOutputBuffer(bool blockAlignedOutput) + { + using (TripleDES alg = TripleDESFactory.Create()) + using (ICryptoTransform xform = alg.CreateEncryptor()) + { + // 8 blocks, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize + outputPadding]; + // 2 blocks of 0x00 + byte[] input = new byte[alg.BlockSize / 4]; + int outputOffset = 0; + + outputOffset += xform.TransformBlock(input, 0, input.Length, output, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, output, outputOffset, overflow.Length); + outputOffset += overflow.Length; + + Assert.Equal(3 * (alg.BlockSize / 8), outputOffset); + string outputAsHex = output.ByteArrayToHex(); + Assert.NotEqual(new string('0', outputOffset * 2), outputAsHex.Substring(0, outputOffset * 2)); + Assert.Equal(new string('0', (output.Length - outputOffset) * 2), outputAsHex.Substring(outputOffset * 2)); + } + } + + [Theory] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] + public static void TransformWithTooShortOutputBuffer(bool encrypt, bool blockAlignedOutput) + { + using (TripleDES alg = TripleDESFactory.Create()) + using (ICryptoTransform xform = encrypt ? alg.CreateEncryptor() : alg.CreateDecryptor()) + { + // 1 block, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize / 8 + outputPadding]; + // 3 blocks of 0x00 + byte[] input = new byte[3 * (alg.BlockSize / 8)]; + + Type exceptionType = typeof(ArgumentOutOfRangeException); + + // TripleDESCryptoServiceProvider doesn't throw the ArgumentOutOfRangeException, + // giving a CryptographicException when CAPI reports the destination too small. + if (PlatformDetection.IsFullFramework) + { + exceptionType = typeof(CryptographicException); + } + + Assert.Throws( + exceptionType, + () => xform.TransformBlock(input, 0, input.Length, output, 0)); + + Assert.Equal(new byte[output.Length], output); + } + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void MultipleBlockDecryptTransform(bool blockAlignedOutput) + { + const string ExpectedOutput = "This is a test"; + + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] key = "0123456789ABCDEFFEDCBA9876543210ABCDEF0123456789".HexToByteArray(); + byte[] iv = "0123456789ABCDEF".HexToByteArray(); + byte[] outputBytes = new byte[iv.Length * 2 + outputPadding]; + byte[] input = "A61C8F1D393202E1E3C71DCEAB9B08DB".HexToByteArray(); + int outputOffset = 0; + + using (TripleDES alg = TripleDESFactory.Create()) + using (ICryptoTransform xform = alg.CreateDecryptor(key, iv)) + { + Assert.Equal(2 * alg.BlockSize, (outputBytes.Length - outputPadding) * 8); + outputOffset += xform.TransformBlock(input, 0, input.Length, outputBytes, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, outputBytes, outputOffset, overflow.Length); + outputOffset += overflow.Length; + } + + string decrypted = Encoding.ASCII.GetString(outputBytes, 0, outputOffset); + Assert.Equal(ExpectedOutput, decrypted); + } } } diff --git a/external/corefx/src/Common/tests/System/Xml/DisableParallelization.cs b/external/corefx/src/Common/tests/System/Xml/DisableParallelization.cs new file mode 100644 index 0000000000..5814b2aced --- /dev/null +++ b/external/corefx/src/Common/tests/System/Xml/DisableParallelization.cs @@ -0,0 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Tests are old and depend on the static state +[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)] diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ModuleCore.csproj b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ModuleCore.csproj index fa46d46471..e1ca5c022f 100644 --- a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ModuleCore.csproj +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ModuleCore.csproj @@ -22,6 +22,8 @@ Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + - \ No newline at end of file + diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/XunitRunner.cs b/external/corefx/src/Common/tests/System/Xml/ModuleCore/XunitRunner.cs new file mode 100644 index 0000000000..62526d2e0e --- /dev/null +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/XunitRunner.cs @@ -0,0 +1,100 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace OLEDB.Test.ModuleCore +{ + public class XmlInlineDataDiscoverer : IDataDiscoverer + { + public static IEnumerable GenerateTestCases(Func moduleGenerator) + { + CModInfo.CommandLine = ""; + foreach (object[] testCase in GenerateTestCasesForModule(moduleGenerator())) + { + yield return testCase; + } + + CModInfo.CommandLine = "/async"; + foreach (object[] testCase in GenerateTestCasesForModule(moduleGenerator())) + { + yield return testCase; + } + } + + private static IEnumerable GenerateTestCasesForModule(CTestModule module) + { + foreach (OLEDB.Test.ModuleCore.XunitTestCase testCase in module.TestCases()) + { + yield return new object[] { testCase }; + } + } + + private static Type ToRuntimeType(ITypeInfo typeInfo) + { + var reflectionTypeInfo = typeInfo as IReflectionTypeInfo; + if (reflectionTypeInfo != null) + return reflectionTypeInfo.Type; + + Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.FullName == typeInfo.Assembly.Name); + if (assembly != null) + { + return assembly.GetType(typeInfo.Name); + } + + throw new Exception($"Could not find runtime type `{typeInfo.Name}`"); + } + + private static Type GetDeclaringType(IMethodInfo methodInfo) + { + var reflectionMethodInfo = methodInfo as IReflectionMethodInfo; + if (reflectionMethodInfo != null) + return reflectionMethodInfo.MethodInfo.DeclaringType; + + return ToRuntimeType(methodInfo.Type); + } + + public virtual IEnumerable GetData(IAttributeInfo dataAttribute, IMethodInfo testMethod) + { + string methodName = (string)dataAttribute.GetConstructorArguments().Single(); + Func moduleGenerator = XmlTestsAttribute.GetGenerator(GetDeclaringType(testMethod), methodName); + return GenerateTestCases(moduleGenerator); + } + + public virtual bool SupportsDiscoveryEnumeration(IAttributeInfo dataAttribute, IMethodInfo testMethod) => true; + } + + [DataDiscoverer("OLEDB.Test.ModuleCore.XmlInlineDataDiscoverer", "ModuleCore")] + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] + public sealed class XmlTestsAttribute : DataAttribute + { + private delegate CTestModule ModuleGenerator(); + + private string _methodName; + + public XmlTestsAttribute(string methodName) + { + _methodName = methodName; + } + + public static Func GetGenerator(Type type, string methodName) + { + ModuleGenerator moduleGenerator = (ModuleGenerator)type.GetMethod(methodName).CreateDelegate(typeof(ModuleGenerator)); + return new Func(moduleGenerator); + } + + public override IEnumerable GetData(MethodInfo testMethod) + { + Func moduleGenerator = GetGenerator(testMethod.DeclaringType, _methodName); + return XmlInlineDataDiscoverer.GenerateTestCases(moduleGenerator); + } + } +} diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/XunitTestCase.cs b/external/corefx/src/Common/tests/System/Xml/ModuleCore/XunitTestCase.cs new file mode 100644 index 0000000000..f5bcaf0f86 --- /dev/null +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/XunitTestCase.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace OLEDB.Test.ModuleCore +{ + public class XunitTestCase + { + public string DisplayName { get; set; } + public Func Test { get; set; } + + public XunitTestCase(string displayName, Func test) + { + DisplayName = displayName; + Test = test; + } + + public override string ToString() + { + return DisplayName; + } + + public void Run() + { + try + { + tagVARIATION_STATUS result = (tagVARIATION_STATUS)Test(); + Assert.NotEqual(tagVARIATION_STATUS.eVariationStatusFailed, result); + } + catch (CTestSkippedException) { } + } + } +} diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestbase.cs b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestbase.cs index 274b7d38c8..11899baec9 100644 --- a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestbase.cs +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestbase.cs @@ -316,6 +316,9 @@ namespace OLEDB.Test.ModuleCore { return tagVARIATION_STATUS.eVariationStatusPassed; } + + public abstract IEnumerable TestCases(); + public int CompareTo(object o) { return this.id.CompareTo(((CTestBase)o).id); diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestcase.cs b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestcase.cs index 6c7f7bda5a..8e9a317fcd 100644 --- a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestcase.cs +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestcase.cs @@ -101,6 +101,44 @@ namespace OLEDB.Test.ModuleCore return tagVARIATION_STATUS.eVariationStatusPassed; } + public override IEnumerable TestCases() + { + List children = Children; + if (children != null && children.Count > 0) + { + foreach (object child in children) + { + CTestCase childTc = child as CTestCase; + if (childTc != null) + { + childTc.Init(); + + foreach (XunitTestCase testCase in childTc.TestCases()) + { + yield return testCase; + } + + continue; + } + + CVariation var = child as CVariation; + if (var != null && CModInfo.IsVariationSelected(var.Desc)) + { + foreach (var testCase in var.TestCases()) + { + Func test = testCase.Test; + testCase.Test = () => { + CurVariation = var; + return test(); + }; + + yield return testCase; + } + } + } + } + } + public void RunVariation(dlgtTestVariation testmethod, Variation curVar) { if (!CModInfo.IsVariationSelected(curVar.Desc)) diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestmodule.cs b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestmodule.cs index 935bb8a972..2762c4f23f 100644 --- a/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestmodule.cs +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/ctestmodule.cs @@ -266,5 +266,28 @@ namespace OLEDB.Test.ModuleCore Console.WriteLine("Pass:{0}, Fail:{1}, Skip:{2}", PassCount, FailCount, SkipCount); return tagVARIATION_STATUS.eVariationStatusPassed; } + + public override IEnumerable TestCases() + { + List children = Children; + if (children != null && children.Count > 0) + { + foreach (object child in children) + { + CTestCase tc = child as CTestCase; + if (tc != null) + { + if (CModInfo.IsTestCaseSelected(tc.Name)) + { + tc.Init(); + foreach (XunitTestCase testCase in tc.TestCases()) + { + yield return testCase; + } + } + } + } + } + } } } diff --git a/external/corefx/src/Common/tests/System/Xml/ModuleCore/cvariation.cs b/external/corefx/src/Common/tests/System/Xml/ModuleCore/cvariation.cs index d23a8884fd..03b2b2c2c2 100644 --- a/external/corefx/src/Common/tests/System/Xml/ModuleCore/cvariation.cs +++ b/external/corefx/src/Common/tests/System/Xml/ModuleCore/cvariation.cs @@ -3,7 +3,9 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; using System.Reflection; +using System.Text; namespace OLEDB.Test.ModuleCore { @@ -75,7 +77,20 @@ namespace OLEDB.Test.ModuleCore int ret = _pfunc(); return (tagVARIATION_STATUS)ret; } + throw new Exception("test method is null in CVariation"); } + + public override IEnumerable TestCases() + { + var sb = new StringBuilder(); + + if (!string.IsNullOrWhiteSpace(Name)) + sb.Append(Name); + + sb.Append(Desc); + + yield return new XunitTestCase(sb.ToString(), Execute); + } } } diff --git a/external/corefx/src/Common/tests/System/Xml/XPath/CoreFunctionLibrary/NodeSetFunctionsTests.cs b/external/corefx/src/Common/tests/System/Xml/XPath/CoreFunctionLibrary/NodeSetFunctionsTests.cs index 629e61aecd..954106115e 100644 --- a/external/corefx/src/Common/tests/System/Xml/XPath/CoreFunctionLibrary/NodeSetFunctionsTests.cs +++ b/external/corefx/src/Common/tests/System/Xml/XPath/CoreFunctionLibrary/NodeSetFunctionsTests.cs @@ -717,7 +717,7 @@ namespace XPathTests.FunctionalTests.CoreFunctionLibrary } /// - /// Expected: QName of the of the context node. + /// Expected: QName of the context node. /// name() (with prefix, element node) /// [Fact] @@ -736,7 +736,7 @@ namespace XPathTests.FunctionalTests.CoreFunctionLibrary } /// - /// Expected: QName of the of the context node. + /// Expected: QName of the context node. /// name() (with prefix, attribute node) /// [Fact] @@ -793,7 +793,7 @@ namespace XPathTests.FunctionalTests.CoreFunctionLibrary } /// - /// Expected: QName of the of the context node. + /// Expected: QName of the context node. /// local-name() (with prefix, element node) /// [Fact] @@ -812,7 +812,7 @@ namespace XPathTests.FunctionalTests.CoreFunctionLibrary } /// - /// Expected: QName of the of the context node. + /// Expected: QName of the context node. /// local-name() (with prefix, attribute node) /// [Fact] diff --git a/external/corefx/src/Common/tests/System/Xml/XPath/FuncLocation/PathAxeComplexExprMatchesTests.cs b/external/corefx/src/Common/tests/System/Xml/XPath/FuncLocation/PathAxeComplexExprMatchesTests.cs index c9c60eefd5..1dde75d763 100644 --- a/external/corefx/src/Common/tests/System/Xml/XPath/FuncLocation/PathAxeComplexExprMatchesTests.cs +++ b/external/corefx/src/Common/tests/System/Xml/XPath/FuncLocation/PathAxeComplexExprMatchesTests.cs @@ -16,7 +16,7 @@ namespace XPathTests.FunctionalTests.Location.Paths.Axes.ComplexExpressions public static partial class MatchesTests { /// - /// Context node has a ancestor 'publication' so matches should return true + /// Context node has an ancestor 'publication' so matches should return true /// node()[starts-with(string(name()),'p')]//node()[local-name()=""] /// [Fact] diff --git a/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/ManagedNodeWriter.cs b/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/ManagedNodeWriter.cs index 86b55fd2e6..7d22604d45 100644 --- a/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/ManagedNodeWriter.cs +++ b/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/ManagedNodeWriter.cs @@ -327,7 +327,7 @@ namespace XmlCoreTest.Common } /// - /// This method is a conveinience method and a shortcut to create an XML string. Each character in the pattern + /// This method is a convenience method and a shortcut to create an XML string. Each character in the pattern /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement, /// PutAttribute, PutAttribute and CloseElement for you. /// The following is the list of all allowed characters and their function mappings : diff --git a/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/WriterFactory.cs b/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/WriterFactory.cs index bebbbf0d70..386286f89c 100644 --- a/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/WriterFactory.cs +++ b/external/corefx/src/Common/tests/System/Xml/XmlCoreTest/WriterFactory.cs @@ -17,22 +17,31 @@ namespace XmlCoreTest.Common * Helper class used by all test frameworks to create an instance of XmlWriter * Supports the following writer types */ - + [Flags] public enum WriterType { - UTF8Writer, // V2 writer with Encoding.UTF8 - UnicodeWriter, // V2 writer with Encoding.Unicode - CustomWriter, // CustomWriter implemented in this same folder - CharCheckingWriter, // CharCheckingWriter implemented in this same folder - UTF8WriterIndent, // UTF8WriterIndent implemented in this same folder - UnicodeWriterIndent, // UnicodeWriterIndent implemented in this same folder - WrappedWriter // WrappedWriter implemented in this same folder + All = UTF8Writer | UnicodeWriter | CustomWriter | CharCheckingWriter | UTF8WriterIndent | UnicodeWriterIndent | WrappedWriter | Async | NoAsync, + AllButCustom = All & ~CustomWriter, + AllButIndenting = All & ~UTF8WriterIndent & ~UnicodeWriterIndent, + + Async = 1024, + NoAsync = 2048, + + UTF8Writer = 1, // V2 writer with Encoding.UTF8 + UnicodeWriter = 2, // V2 writer with Encoding.Unicode + CustomWriter = 4, // CustomWriter implemented in this same folder + CharCheckingWriter = 8, // CharCheckingWriter implemented in this same folder + UTF8WriterIndent = 16, // UTF8WriterIndent implemented in this same folder + UnicodeWriterIndent = 32, // UnicodeWriterIndent implemented in this same folder + WrappedWriter = 64 // WrappedWriter implemented in this same folder } public class WriterFactory { private string _fileName; + private bool _overrideAsync = false; + private bool _async; protected WriterType writerType1; public WriterType WriterType @@ -43,9 +52,11 @@ namespace XmlCoreTest.Common } } - public WriterFactory(WriterType t) + public WriterFactory(WriterType t, bool overrideAsync = false, bool async = false) { writerType1 = t; + _overrideAsync = overrideAsync; + _async = async; } private XmlWriterSettings _wSettings = null; @@ -64,7 +75,7 @@ namespace XmlCoreTest.Common _wSettings.CloseOutput = false; _wSettings.Encoding = Encoding.UTF8; _wSettings.NamespaceHandling = NamespaceHandling.Default; - _xmlWriter = WriterHelper.Create(_writerStream, _wSettings); + _xmlWriter = WriterHelper.Create(_writerStream, _wSettings, _overrideAsync, _async); FilePathUtil.addStream(_fileName, _writerStream); break; case WriterType.UnicodeWriter: @@ -72,12 +83,15 @@ namespace XmlCoreTest.Common _wSettings.CloseOutput = false; _wSettings.Encoding = Encoding.Unicode; _wSettings.NamespaceHandling = NamespaceHandling.OmitDuplicates; - _xmlWriter = WriterHelper.Create(_writerStream, _wSettings); + _xmlWriter = WriterHelper.Create(_writerStream, _wSettings, _overrideAsync, _async); FilePathUtil.addStream(_fileName, _writerStream); break; case WriterType.CustomWriter: _writerStream = new MemoryStream(); _wSettings.CloseOutput = false; + if (_overrideAsync) + _wSettings.Async = _async; + FilePathUtil.addStream(_fileName, _writerStream); _xmlWriter = new CustomWriter(_fileName, _wSettings); break; @@ -86,7 +100,7 @@ namespace XmlCoreTest.Common _wSettings.CloseOutput = false; _wSettings.Encoding = Encoding.UTF8; _wSettings.Indent = true; - _xmlWriter = WriterHelper.Create(_writerStream, _wSettings); + _xmlWriter = WriterHelper.Create(_writerStream, _wSettings, _overrideAsync, _async); FilePathUtil.addStream(_fileName, _writerStream); break; case WriterType.UnicodeWriterIndent: @@ -94,25 +108,25 @@ namespace XmlCoreTest.Common _wSettings.CloseOutput = false; _wSettings.Encoding = Encoding.Unicode; _wSettings.Indent = true; - _xmlWriter = WriterHelper.Create(_writerStream, _wSettings); + _xmlWriter = WriterHelper.Create(_writerStream, _wSettings, _overrideAsync, _async); FilePathUtil.addStream(_fileName, _writerStream); break; case WriterType.CharCheckingWriter: _writerStream = new MemoryStream(); _wSettings.CloseOutput = false; _wSettings.CheckCharacters = false; - XmlWriter ww = WriterHelper.Create(_writerStream, _wSettings); + XmlWriter ww = WriterHelper.Create(_writerStream, _wSettings, _overrideAsync, _async); FilePathUtil.addStream(_fileName, _writerStream); XmlWriterSettings ws = _wSettings.Clone(); ws.CheckCharacters = true; - _xmlWriter = WriterHelper.Create(ww, ws); + _xmlWriter = WriterHelper.Create(ww, ws, _overrideAsync, _async); break; case WriterType.WrappedWriter: _writerStream = new MemoryStream(); _wSettings.CloseOutput = false; - XmlWriter w = WriterHelper.Create(_writerStream, _wSettings); + XmlWriter w = WriterHelper.Create(_writerStream, _wSettings, _overrideAsync, _async); FilePathUtil.addStream(_fileName, _writerStream); - _xmlWriter = WriterHelper.Create(w, _wSettings); + _xmlWriter = WriterHelper.Create(w, _wSettings, _overrideAsync, _async); break; default: throw new Exception("Incorrect writer type"); @@ -419,10 +433,15 @@ namespace XmlCoreTest.Common public static class WriterHelper { - public static XmlWriter Create(string outputFileName) + private static bool ShouldEnableAsync(bool overrideAsync, bool async) + { + return overrideAsync ? async : AsyncUtil.IsAsyncEnabled; + } + + public static XmlWriter Create(string outputFileName, bool overrideAsync = false, bool async = false) { FilePathUtil.addStream(outputFileName, new MemoryStream()); - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(FilePathUtil.getStream(outputFileName)); } @@ -432,10 +451,10 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(string outputFileName, XmlWriterSettings settings) + public static XmlWriter Create(string outputFileName, XmlWriterSettings settings, bool overrideAsync = false, bool async = false) { FilePathUtil.addStream(outputFileName, new MemoryStream()); - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(FilePathUtil.getStream(outputFileName), settings); } @@ -445,9 +464,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(Stream output) + public static XmlWriter Create(Stream output, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output); } @@ -457,9 +476,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(Stream output, XmlWriterSettings settings) + public static XmlWriter Create(Stream output, XmlWriterSettings settings, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output, settings); } @@ -469,9 +488,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(TextWriter output) + public static XmlWriter Create(TextWriter output, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output); } @@ -481,9 +500,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(TextWriter output, XmlWriterSettings settings) + public static XmlWriter Create(TextWriter output, XmlWriterSettings settings, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output, settings); } @@ -493,9 +512,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(StringBuilder output) + public static XmlWriter Create(StringBuilder output, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output); } @@ -505,9 +524,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(StringBuilder output, XmlWriterSettings settings) + public static XmlWriter Create(StringBuilder output, XmlWriterSettings settings, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output, settings); } @@ -517,9 +536,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(XmlWriter output) + public static XmlWriter Create(XmlWriter output, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output); } @@ -529,9 +548,9 @@ namespace XmlCoreTest.Common } } - public static XmlWriter Create(XmlWriter output, XmlWriterSettings settings) + public static XmlWriter Create(XmlWriter output, XmlWriterSettings settings, bool overrideAsync = false, bool async = false) { - if (AsyncUtil.IsAsyncEnabled) + if (ShouldEnableAsync(overrideAsync, async)) { return XmlWriterAsync.Create(output, settings); } diff --git a/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Tests.cs b/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Tests.cs index 0310cebdd8..b030fa800f 100644 --- a/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Tests.cs +++ b/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Tests.cs @@ -40,31 +40,30 @@ namespace Tests.System.IO } [Theory, - InlineData("", "", true, 0) - InlineData("", "", false, 0) - InlineData("a", "", true, 0) - InlineData("a", "", false, 0) - InlineData("", "b", true, 0) - InlineData("", "b", false, 0) - InlineData("\0", "\0", true, 1) - InlineData("\0", "\0", false, 1) - InlineData("ABcd", "ABCD", true, 4) - InlineData("ABCD", "ABcd", true, 4) - InlineData("ABcd", "ABCD", false, 2) - InlineData("ABCD", "ABcd", false, 2) - InlineData("AB\0cd", "AB\0CD", true, 5) - InlineData("AB\0CD", "AB\0cd", true, 5) - InlineData("AB\0cd", "AB\0CD", false, 3) - InlineData("AB\0CD", "AB\0cd", false, 3) - InlineData("ABc\0", "ABC\0", true, 4) - InlineData("ABC\0", "ABc\0", true, 4) - InlineData("ABc\0", "ABC\0", false, 2) - InlineData("ABC\0", "ABc\0", false, 2) - InlineData("ABcdxyzl", "ABCDpdq", true, 4) - InlineData("ABCDxyz", "ABcdpdql", true, 4) - InlineData("ABcdxyz", "ABCDpdq", false, 2) - InlineData("ABCDxyzoo", "ABcdpdq", false, 2) - ] + InlineData("", "", true, 0), + InlineData("", "", false, 0), + InlineData("a", "", true, 0), + InlineData("a", "", false, 0), + InlineData("", "b", true, 0), + InlineData("", "b", false, 0), + InlineData("\0", "\0", true, 1), + InlineData("\0", "\0", false, 1), + InlineData("ABcd", "ABCD", true, 4), + InlineData("ABCD", "ABcd", true, 4), + InlineData("ABcd", "ABCD", false, 2), + InlineData("ABCD", "ABcd", false, 2), + InlineData("AB\0cd", "AB\0CD", true, 5), + InlineData("AB\0CD", "AB\0cd", true, 5), + InlineData("AB\0cd", "AB\0CD", false, 3), + InlineData("AB\0CD", "AB\0cd", false, 3), + InlineData("ABc\0", "ABC\0", true, 4), + InlineData("ABC\0", "ABc\0", true, 4), + InlineData("ABc\0", "ABC\0", false, 2), + InlineData("ABC\0", "ABc\0", false, 2), + InlineData("ABcdxyzl", "ABCDpdq", true, 4), + InlineData("ABCDxyz", "ABcdpdql", true, 4), + InlineData("ABcdxyz", "ABCDpdq", false, 2), + InlineData("ABCDxyzoo", "ABcdpdq", false, 2)] public void EqualStartingCharacterCount(string first, string second, bool ignoreCase, int expected) { Assert.Equal(expected, PathInternal.EqualStartingCharacterCount(first, second, ignoreCase)); @@ -72,25 +71,24 @@ namespace Tests.System.IO [Theory, - InlineData(@"", @"", true, 0) - InlineData(@"", @"", false, 0) - InlineData(@"a", @"A", true, 1) - InlineData(@"A", @"a", true, 1) - InlineData(@"a", @"A", false, 0) - InlineData(@"A", @"a", false, 0) - InlineData(@"foo", @"foobar", true, 0) - InlineData(@"foo", @"foobar", false, 0) - InlineData(@"foo", @"foo/bar", true, 3) - InlineData(@"foo", @"foo/bar", false, 3) - InlineData(@"foo/", @"foo/bar", true, 4) - InlineData(@"foo/", @"foo/bar", false, 4) - InlineData(@"foo/bar", @"foo/bar", true, 7) - InlineData(@"foo/bar", @"foo/bar", false, 7) - InlineData(@"foo/bar", @"foo/BAR", true, 7) - InlineData(@"foo/bar", @"foo/BAR", false, 4) - InlineData(@"foo/bar", @"foo/barb", true, 4) - InlineData(@"foo/bar", @"foo/barb", false, 4) - ] + InlineData(@"", @"", true, 0), + InlineData(@"", @"", false, 0), + InlineData(@"a", @"A", true, 1), + InlineData(@"A", @"a", true, 1), + InlineData(@"a", @"A", false, 0), + InlineData(@"A", @"a", false, 0), + InlineData(@"foo", @"foobar", true, 0), + InlineData(@"foo", @"foobar", false, 0), + InlineData(@"foo", @"foo/bar", true, 3), + InlineData(@"foo", @"foo/bar", false, 3), + InlineData(@"foo/", @"foo/bar", true, 4), + InlineData(@"foo/", @"foo/bar", false, 4), + InlineData(@"foo/bar", @"foo/bar", true, 7), + InlineData(@"foo/bar", @"foo/bar", false, 7), + InlineData(@"foo/bar", @"foo/BAR", true, 7), + InlineData(@"foo/bar", @"foo/BAR", false, 4), + InlineData(@"foo/bar", @"foo/barb", true, 4), + InlineData(@"foo/bar", @"foo/barb", false, 4)] public void GetCommonPathLength(string first, string second, bool ignoreCase, int expected) { Assert.Equal(expected, PathInternal.GetCommonPathLength(first, second, ignoreCase)); diff --git a/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs b/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs index 950cf15892..be77b533a2 100644 --- a/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs +++ b/external/corefx/src/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs @@ -9,14 +9,14 @@ using Xunit; public class PathInternal_Windows_Tests { - [Theory - InlineData(@"\\?\", false) - InlineData(@"\\?\?", true) - InlineData(@"//?/", false) - InlineData(@"//?/*", true) - InlineData(@"\\.\>", true) - InlineData(@"C:\", false) - InlineData(@"C:\<", true) + [Theory, + InlineData(@"\\?\", false), + InlineData(@"\\?\?", true), + InlineData(@"//?/", false), + InlineData(@"//?/*", true), + InlineData(@"\\.\>", true), + InlineData(@"C:\", false), + InlineData(@"C:\<", true), InlineData("\"MyFile\"", true) ] [PlatformSpecific(TestPlatforms.Windows)] @@ -25,14 +25,14 @@ public class PathInternal_Windows_Tests Assert.Equal(expected, PathInternal.HasWildCardCharacters(path)); } - [Theory - InlineData(PathInternal.ExtendedPathPrefix, PathInternal.ExtendedPathPrefix) - InlineData(@"Foo", @"Foo") - InlineData(@"C:\Foo", @"\\?\C:\Foo") - InlineData(@"\\.\Foo", @"\\.\Foo") - InlineData(@"\\?\Foo", @"\\?\Foo") - InlineData(@"\??\Foo", @"\??\Foo") - InlineData(@"//?/Foo", @"//?/Foo") + [Theory, + InlineData(PathInternal.ExtendedPathPrefix, PathInternal.ExtendedPathPrefix), + InlineData(@"Foo", @"Foo"), + InlineData(@"C:\Foo", @"\\?\C:\Foo"), + InlineData(@"\\.\Foo", @"\\.\Foo"), + InlineData(@"\\?\Foo", @"\\?\Foo"), + InlineData(@"\??\Foo", @"\??\Foo"), + InlineData(@"//?/Foo", @"//?/Foo"), InlineData(@"\\Server\Share", PathInternal.UncExtendedPathPrefix + @"Server\Share") ] [PlatformSpecific(TestPlatforms.Windows)] @@ -41,14 +41,14 @@ public class PathInternal_Windows_Tests Assert.Equal(expected, PathInternal.EnsureExtendedPrefix(path)); } - [Theory - InlineData(@"", false) - InlineData(@"\\?\", true) - InlineData(@"\??\", true) - InlineData(@"\\.\", false) - InlineData(@"\\?", false) - InlineData(@"\??", false) - InlineData(@"//?/", false) + [Theory, + InlineData(@"", false), + InlineData(@"\\?\", true), + InlineData(@"\??\", true), + InlineData(@"\\.\", false), + InlineData(@"\\?", false), + InlineData(@"\??", false), + InlineData(@"//?/", false), InlineData(@"/??/", false) ] [PlatformSpecific(TestPlatforms.Windows)] @@ -57,14 +57,14 @@ public class PathInternal_Windows_Tests Assert.Equal(expected, PathInternal.IsExtended(path)); } - [Theory - InlineData(@"", false) - InlineData(@"\\?\", true) - InlineData(@"\??\", true) - InlineData(@"\\.\", true) - InlineData(@"\\?", false) - InlineData(@"\??", false) - InlineData(@"//?/", true) + [Theory, + InlineData(@"", false), + InlineData(@"\\?\", true), + InlineData(@"\??\", true), + InlineData(@"\\.\", true), + InlineData(@"\\?", false), + InlineData(@"\??", false), + InlineData(@"//?/", true), InlineData(@"/??/", false) ] [PlatformSpecific(TestPlatforms.Windows)] @@ -73,26 +73,26 @@ public class PathInternal_Windows_Tests Assert.Equal(expected, PathInternal.IsDevice(path)); } - [Theory - InlineData("", true) - InlineData("C:", true) - InlineData("**", true) - InlineData(@"\\.\path", false) - InlineData(@"\\?\path", false) - InlineData(@"\\.", false) - InlineData(@"\\?", false) - InlineData(@"\?", false) - InlineData(@"/?", false) - InlineData(@"\\", false) - InlineData(@"//", false) - InlineData(@"\a", true) - InlineData(@"/a", true) - InlineData(@"\", true) - InlineData(@"/", true) - InlineData(@"C:Path", true) - InlineData(@"C:\Path", false) - InlineData(@"\\?\C:\Path", false) - InlineData(@"Path", true) + [Theory, + InlineData("", true), + InlineData("C:", true), + InlineData("**", true), + InlineData(@"\\.\path", false), + InlineData(@"\\?\path", false), + InlineData(@"\\.", false), + InlineData(@"\\?", false), + InlineData(@"\?", false), + InlineData(@"/?", false), + InlineData(@"\\", false), + InlineData(@"//", false), + InlineData(@"\a", true), + InlineData(@"/a", true), + InlineData(@"\", true), + InlineData(@"/", true), + InlineData(@"C:Path", true), + InlineData(@"C:\Path", false), + InlineData(@"\\?\C:\Path", false), + InlineData(@"Path", true), InlineData(@"X", true) ] [PlatformSpecific(TestPlatforms.Windows)] @@ -111,7 +111,7 @@ public class PathInternal_Windows_Tests InlineData(@" \", 2), InlineData(@" 8:", 0), InlineData(@" \\", 4), - InlineData(@"\\", 0), + InlineData(@"\\", 0) ] [PlatformSpecific(TestPlatforms.Windows)] public void PathStartSkipTest(string path, int expected) @@ -154,7 +154,7 @@ public class PathInternal_Windows_Tests InlineData(@" /", @"\"), InlineData(@" 8:", @" 8:"), InlineData(@" \\", @"\\"), - InlineData(@" //", @"\\"), + InlineData(@" //", @"\\") ] [PlatformSpecific(TestPlatforms.Windows)] public void NormalizeDirectorySeparatorTests(string path, string expected) @@ -181,11 +181,11 @@ public class PathInternal_Windows_Tests } [Theory, - InlineData(@"", @"", StringComparison.OrdinalIgnoreCase, true) - InlineData(@"", @"", StringComparison.Ordinal, true) - InlineData(@"A", @"a", StringComparison.OrdinalIgnoreCase, true) - InlineData(@"A", @"a", StringComparison.Ordinal, true) - InlineData(@"C:\", @"c:\", StringComparison.OrdinalIgnoreCase, true) + InlineData(@"", @"", StringComparison.OrdinalIgnoreCase, true), + InlineData(@"", @"", StringComparison.Ordinal, true), + InlineData(@"A", @"a", StringComparison.OrdinalIgnoreCase, true), + InlineData(@"A", @"a", StringComparison.Ordinal, true), + InlineData(@"C:\", @"c:\", StringComparison.OrdinalIgnoreCase, true), InlineData(@"C:\", @"c:\", StringComparison.Ordinal, false) ] [PlatformSpecific(TestPlatforms.Windows)] diff --git a/external/corefx/src/Common/tests/Tests/System/MarvinTests.cs b/external/corefx/src/Common/tests/Tests/System/MarvinTests.cs new file mode 100644 index 0000000000..5498b0a8e6 --- /dev/null +++ b/external/corefx/src/Common/tests/Tests/System/MarvinTests.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Test.Cryptography; + +using Xunit; + +namespace Tests.System +{ + public class MarvinTests + { + private const ulong Seed1 = 0x4FB61A001BDBCCLU; + private const ulong Seed2 = 0x804FB61A001BDBCCLU; + private const ulong Seed3 = 0x804FB61A801BDBCCLU; + + private const string TestDataString0Byte = ""; + private const string TestDataString1Byte = "af"; + private const string TestDataString2Byte = "e70f"; + private const string TestDataString3Byte = "37f495"; + private const string TestDataString4Byte = "8642dc59"; + private const string TestDataString5Byte = "153fb79826"; + private const string TestDataString6Byte = "0932e6246c47"; + private const string TestDataString7Byte = "ab427ea8d10fc7"; + + [Theory] + [MemberData(nameof(TestDataAndExpectedHashes))] + public void ComputeHash_Success(ulong seed, string testDataString, ulong expectedHash) + { + var testDataSpan = new Span(testDataString.HexToByteArray()); + long hash = Marvin.ComputeHash(ref testDataSpan.DangerousGetPinnableReference(), testDataSpan.Length, seed); + Assert.Equal((long)expectedHash, hash); + } + + public static object[][] TestDataAndExpectedHashes = + { + new object[] { Seed1, TestDataString0Byte, 0x30ED35C100CD3C7DLU }, + new object[] { Seed1, TestDataString1Byte, 0x48E73FC77D75DDC1LU }, + new object[] { Seed1, TestDataString2Byte, 0xB5F6E1FC485DBFF8LU }, + new object[] { Seed1, TestDataString3Byte, 0xF0B07C789B8CF7E8LU }, + new object[] { Seed1, TestDataString4Byte, 0x7008F2E87E9CF556LU }, + new object[] { Seed1, TestDataString5Byte, 0xE6C08C6DA2AFA997LU }, + new object[] { Seed1, TestDataString6Byte, 0x6F04BF1A5EA24060LU }, + new object[] { Seed1, TestDataString7Byte, 0xE11847E4F0678C41LU }, + + new object[] { Seed2, TestDataString0Byte, 0x10A9D5D3996FD65DLU }, + new object[] { Seed2, TestDataString1Byte, 0x68201F91960EBF91LU }, + new object[] { Seed2, TestDataString2Byte, 0x64B581631F6AB378LU }, + new object[] { Seed2, TestDataString3Byte, 0xE1F2DFA6E5131408LU }, + new object[] { Seed2, TestDataString4Byte, 0x36289D9654FB49F6LU }, + new object[] { Seed2, TestDataString5Byte, 0xA06114B13464DBDLU }, + new object[] { Seed2, TestDataString6Byte, 0xD6DD5E40AD1BC2EDLU }, + new object[] { Seed2, TestDataString7Byte, 0xE203987DBA252FB3LU }, + + new object[] { Seed3, "00", 0xA37FB0DA2ECAE06CLU }, + new object[] { Seed3, "FF", 0xFECEF370701AE054LU }, + new object[] { Seed3, "00FF", 0xA638E75700048880LU }, + new object[] { Seed3, "FF00", 0xBDFB46D969730E2ALU }, + new object[] { Seed3, "FF00FF", 0x9D8577C0FE0D30BFLU }, + new object[] { Seed3, "00FF00", 0x4F9FBDDE15099497LU }, + new object[] { Seed3, "00FF00FF", 0x24EAA279D9A529CALU }, + new object[] { Seed3, "FF00FF00", 0xD3BEC7726B057943LU }, + new object[] { Seed3, "FF00FF00FF", 0x920B62BBCA3E0B72LU }, + new object[] { Seed3, "00FF00FF00", 0x1D7DDF9DFDF3C1BFLU }, + new object[] { Seed3, "00FF00FF00FF", 0xEC21276A17E821A5LU }, + new object[] { Seed3, "FF00FF00FF00", 0x6911A53CA8C12254LU }, + new object[] { Seed3, "FF00FF00FF00FF", 0xFDFD187B1D3CE784LU }, + new object[] { Seed3, "00FF00FF00FF00", 0x71876F2EFB1B0EE8LU }, + }; + } +} diff --git a/external/corefx/src/Common/tests/Tests/System/Security/IdentityHelperTests.cs b/external/corefx/src/Common/tests/Tests/System/Security/IdentityHelperTests.cs index 03aff2f7ae..9eafbc3e62 100644 --- a/external/corefx/src/Common/tests/Tests/System/Security/IdentityHelperTests.cs +++ b/external/corefx/src/Common/tests/Tests/System/Security/IdentityHelperTests.cs @@ -11,11 +11,11 @@ namespace Tests.System.Security { public class IdentityHelperTests { - [Theory - InlineData(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00 }, @"aaaaaaaa") - InlineData(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, @"55555555") - InlineData(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @"aaaaaaaaaaaaaaaa") - InlineData(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 }, @"abcdeaaafghijaaa") + [Theory, + InlineData(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00 }, @"aaaaaaaa"), + InlineData(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, @"55555555"), + InlineData(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @"aaaaaaaaaaaaaaaa"), + InlineData(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 }, @"abcdeaaafghijaaa"), InlineData( new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs b/external/corefx/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs index 61b5aefd8c..9f9f65465c 100644 --- a/external/corefx/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs +++ b/external/corefx/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs @@ -10,47 +10,111 @@ using Xunit; namespace System { - public static class AdminHelpers + public static partial class AdminHelpers { - public static int RunAsSudo(string commandLine) => throw null; + public static bool IsProcessElevated() { throw null; } + public static int RunAsSudo(string commandLine) { throw null; } } - - public static class AssertExtensions + public static partial class AssertExtensions { - public static void Throws(System.Action action, string message) where T : System.Exception { } - public static void Throws(string netCoreParamName, string netFxParamName, Action action) where T : System.ArgumentException { } - public static T Throws(string paramName, System.Action action) where T : System.ArgumentException { throw null; } - public static T Throws(string paramName, Func testCode) where T : System.ArgumentException { throw null; } - public static System.Threading.Tasks.Task ThrowsAsync(string paramName, System.Func testCode) where T : System.ArgumentException { throw null; } - public static void Throws(string paramName, System.Action action) - where TNetCoreExceptionType : System.ArgumentException - where TNetFxExceptionType : System.ArgumentException - { } - public static void Throws(string netCoreParamName, string netFxParamName, System.Action action) - where TNetCoreExceptionType : System.ArgumentException - where TNetFxExceptionType : System.ArgumentException - { } - public static void ThrowsAny(System.Type firstExceptionType, System.Type secondExceptionType, System.Action action) { } - public static void ThrowsAny(System.Action action) - where TFirstExceptionType : System.Exception - where TSecondExceptionType : System.Exception - { } - public static void ThrowsAny(Action action) - where TFirstExceptionType : Exception - where TSecondExceptionType : Exception - where TThirdExceptionType : Exception - { } - public static void ThrowsIf(bool condition, System.Action action) where T : System.Exception { } - public static void GreaterThan(T actual, T greaterThan, string userMessage = null) where T : System.IComparable { } - public static void LessThan(T actual, T lessThan, string userMessage = null) where T : System.IComparable { } - public static void LessThanOrEqualTo(T actual, T lessThanOrEqualTo, string userMessage = null) where T : System.IComparable { } - public static void GreaterThanOrEqualTo(T actual, T greaterThanOrEqualTo, string userMessage = null) where T : System.IComparable { } public static void Equal(byte[] expected, byte[] actual) { } + public static void GreaterThanOrEqualTo(T actual, T greaterThanOrEqualTo, string userMessage=null) where T : System.IComparable { } + public static void GreaterThan(T actual, T greaterThan, string userMessage=null) where T : System.IComparable { } + public static void LessThanOrEqualTo(T actual, T lessThanOrEqualTo, string userMessage=null) where T : System.IComparable { } + public static void LessThan(T actual, T lessThan, string userMessage=null) where T : System.IComparable { } + public static void ThrowsAny(System.Type firstExceptionType, System.Type secondExceptionType, System.Action action) { } + public static void ThrowsAny(System.Action action) where TFirstExceptionType : System.Exception where TSecondExceptionType : System.Exception { } + public static void ThrowsAny(System.Action action) where TFirstExceptionType : System.Exception where TSecondExceptionType : System.Exception where TThirdExceptionType : System.Exception { } + public static System.Threading.Tasks.Task ThrowsAsync(string paramName, System.Func testCode) where T : System.ArgumentException { throw null; } + public static void ThrowsIf(bool condition, System.Action action) where T : System.Exception { } + public static void Throws(System.Action action, string message) where T : System.Exception { } + public static T Throws(string paramName, System.Action action) where T : System.ArgumentException { throw null; } + public static T Throws(string paramName, System.Func testCode) where T : System.ArgumentException { throw null; } + public static void Throws(string netCoreParamName, string netFxParamName, System.Action action) where T : System.ArgumentException { } + public static void Throws(string paramName, System.Action action) where TNetCoreExceptionType : System.ArgumentException where TNetFxExceptionType : System.ArgumentException { } + public static void Throws(string netCoreParamName, string netFxParamName, System.Action action) where TNetCoreExceptionType : System.ArgumentException where TNetFxExceptionType : System.ArgumentException { } } - public static class TheoryExtensions + public static partial class PlatformDetection + { + public static bool IsReflectionEmitSupported; + public static bool ClientWebSocketPartialMessagesSupported { get { throw null; } } + public static System.PlatformDetection.Range[] FrameworkRanges { get { throw null; } } + public static bool HasWindowsShell { get { throw null; } } + public static bool IsArmProcess { get { throw null; } } + public static bool IsCentos7 { get { throw null; } } + public static bool IsDebian { get { throw null; } } + public static bool IsDebian8 { get { throw null; } } + public static bool IsDrawingSupported { get { throw null; } } + public static bool IsFedora { get { throw null; } } + public static bool IsFullFramework { get { throw null; } } + public static bool IsInvokingStaticConstructorsSupported { get { throw null; } } + public static bool IsMacOsHighSierraOrHigher { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public static bool IsNetBSD { get { throw null; } } + public static bool IsNetCore { get { throw null; } } + public static bool IsNetNative { get { throw null; } } + public static bool IsNonZeroLowerBoundArraySupported { get { throw null; } } + public static bool IsNotArmProcess { get { throw null; } } + public static bool IsNotFedoraOrRedHatOrCentos { get { throw null; } } + public static bool IsNotMacOsHighSierraOrHigher { get { throw null; } } + public static bool IsNotNetNativeRunningAsConsoleApp { get { throw null; } } + public static bool IsNotOneCoreUAP { get { throw null; } } + public static bool IsNotWindows8x { get { throw null; } } + public static bool IsNotWindowsIoTCore { get { throw null; } } + public static bool IsNotWindowsNanoServer { get { throw null; } } + public static bool IsNotWindowsServerCore { get { throw null; } } + public static bool IsNotWindowsSubsystemForLinux { get { throw null; } } + public static bool IsNotInAppContainer { get { throw null; } } + public static bool IsNotWinRTSupported { get { throw null; } } + public static bool IsOpenSUSE { get { throw null; } } + public static bool IsOSX { get { throw null; } } + public static bool IsSuperUser { get { throw null; } } + public static bool IsTizen { get { throw null; } } + public static bool IsRedHat { get { throw null; } } + public static bool IsNotRedHat { get { throw null; } } + public static bool IsRedHat69 { get { throw null; } } + public static bool IsNotRedHat69 { get { throw null; } } + public static bool IsUap { get { throw null; } } + public static Version ICUVersion { get { return null; } } + public static bool IsUbuntu { get { throw null; } } + public static bool IsUbuntu1404 { get { throw null; } } + public static bool IsUbuntu1604 { get { throw null; } } + public static bool IsUbuntu1704 { get { throw null; } } + public static bool IsUbuntu1710 { get { throw null; } } + public static bool IsWindows { get { throw null; } } + public static bool IsWindows10InsiderPreviewBuild16215OrGreater { get { throw null; } } + public static bool IsWindows10Version1607OrGreater { get { throw null; } } + public static bool IsWindows10Version16251OrGreater { get { throw null; } } + public static bool IsWindows10Version1703OrGreater { get { throw null; } } + public static bool IsWindowsRedStone2 { get { throw null; } } + public static bool IsWindows7 { get { throw null; } } + public static bool IsWindows8x { get { throw null; } } + public static bool IsWindowsAndElevated { get { throw null; } } + public static bool IsWindowsIoTCore { get { throw null; } } + public static bool IsWindowsNanoServer { get { throw null; } } + public static bool IsWindowsServerCore { get { throw null; } } + public static bool IsWindowsSubsystemForLinux { get { throw null; } } + public static bool IsInAppContainer { get { throw null; } } + public static bool IsWinRTSupported { get { throw null; } } + public static bool IsXmlDsigXsltTransformSupported { get { throw null; } } + public static System.Version OSXKernelVersion { get { throw null; } } + public static int WindowsVersion { get { throw null; } } + public static string GetDistroVersionString() { throw null; } + public static bool IsNetfx462OrNewer() { throw null; } + public static bool IsNetfx470OrNewer() { throw null; } + public static bool IsNetfx471OrNewer() { throw null; } + public partial class Range + { + public Range(System.Version start, System.Version finish, System.Version frameworkVersion) { } + public System.Version Finish { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Version FrameworkVersion { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public System.Version Start { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } + public bool IsInRange(System.Version version) { throw null; } + } + } + public static partial class TheoryExtensions { [CLSCompliant(false)] - public static TheoryData ToTheoryData(this IEnumerable data) { throw null; } + public static Xunit.TheoryData ToTheoryData(this System.Collections.Generic.IEnumerable data) { throw null; } } } namespace System.Diagnostics @@ -70,12 +134,13 @@ namespace System.Diagnostics public static System.Diagnostics.RemoteExecutorTestBase.RemoteInvokeHandle RemoteInvoke(System.Func method, string arg1, string arg2, string arg3, string arg4, System.Diagnostics.RemoteInvokeOptions options=null) { throw null; } public static System.Diagnostics.RemoteExecutorTestBase.RemoteInvokeHandle RemoteInvoke(System.Func method, string arg1, string arg2, string arg3, string arg4, string arg5, System.Diagnostics.RemoteInvokeOptions options=null) { throw null; } public static System.Diagnostics.RemoteExecutorTestBase.RemoteInvokeHandle RemoteInvoke(System.Func> method, System.Diagnostics.RemoteInvokeOptions options=null) { throw null; } + public static System.Diagnostics.RemoteExecutorTestBase.RemoteInvokeHandle RemoteInvoke(System.Func> method, string arg, System.Diagnostics.RemoteInvokeOptions options=null) { throw null; } public static System.Diagnostics.RemoteExecutorTestBase.RemoteInvokeHandle RemoteInvokeRaw(System.Delegate method, string unparsedArg, System.Diagnostics.RemoteInvokeOptions options=null) { throw null; } public sealed partial class RemoteInvokeHandle : System.IDisposable { public RemoteInvokeHandle(System.Diagnostics.Process process, System.Diagnostics.RemoteInvokeOptions options) { } public System.Diagnostics.RemoteInvokeOptions Options { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - public System.Diagnostics.Process Process { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } + public System.Diagnostics.Process Process { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public void Dispose() { } } } @@ -84,6 +149,7 @@ namespace System.Diagnostics public RemoteInvokeOptions() { } public bool CheckExitCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool EnableProfiling { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string ExceptionFile { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public int ExpectedExitCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool Start { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public System.Diagnostics.ProcessStartInfo StartInfo { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -102,4 +168,4 @@ namespace System.IO protected string GetTestFileName(System.Nullable index=default(System.Nullable), [System.Runtime.CompilerServices.CallerMemberNameAttribute]string memberName=null, [System.Runtime.CompilerServices.CallerLineNumberAttribute]int lineNumber=0) { throw null; } protected string GetTestFilePath(System.Nullable index=default(System.Nullable), [System.Runtime.CompilerServices.CallerMemberNameAttribute]string memberName=null, [System.Runtime.CompilerServices.CallerLineNumberAttribute]int lineNumber=0) { throw null; } } -} \ No newline at end of file +} diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj b/external/corefx/src/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj index f67502b3ff..92739a998d 100644 --- a/external/corefx/src/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/CoreFx.Private.TestUtilities.csproj @@ -7,26 +7,32 @@ $(ProjectDir)\external\test-runtime\XUnit.Runtime.depproj false false + true + false + + - - + + + + Common\System\PasteArguments.cs @@ -34,19 +40,64 @@ + + + + + + + + + + + + Common\Interop\Windows\kernel32\Interop.GetCurrentProcess_IntPtr.cs + + + Common\Interop\Windows\advapi32\Interop.OpenProcessToken_SafeAccessTokenHandle.cs + + + Common\Interop\Windows\Interop.Libraries.cs + + + Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + + Common\Interop\Windows\advapi32\Interop.TOKEN_INFORMATION_CLASS.cs + + + Common\Interop\Windows\advapi32\Interop.GetTokenInformation_void.cs + + + Common\Interop\Windows\advapi32\Interop.TOKEN_ELEVATION.cs + + + Common\Interop\Windows\Interop.BOOL.cs + + + + + + + Common\Interop\Unix\Interop.GetEUid.cs + + + Common\Interop\Unix\Interop.Libraries.cs + + @@ -57,5 +108,8 @@ + + + \ No newline at end of file diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/Resources/CoreFx.Private.TestUtilities.rd.xml b/external/corefx/src/CoreFx.Private.TestUtilities/src/Resources/CoreFx.Private.TestUtilities.rd.xml new file mode 100644 index 0000000000..05a1597d16 --- /dev/null +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/Resources/CoreFx.Private.TestUtilities.rd.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.Unix.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.Unix.cs new file mode 100644 index 0000000000..dd20faab20 --- /dev/null +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.Unix.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace System +{ + /// + /// Returns true if the current process is elevated (in Unix). + /// + public static partial class AdminHelpers + { + public unsafe static bool IsProcessElevated() + { + uint userId = Interop.Sys.GetEUid(); + return(userId == 0); + } + } +} diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.Windows.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.Windows.cs new file mode 100644 index 0000000000..64173a9448 --- /dev/null +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.Windows.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Security.Principal; +using Microsoft.Win32.SafeHandles; + +namespace System +{ + public static partial class AdminHelpers + { + /// + /// Returns true if the current process is elevated (in Windows). + /// + public unsafe static bool IsProcessElevated() + { + IntPtr processHandle = Interop.Kernel32.GetCurrentProcess(); + SafeAccessTokenHandle token; + if (!Interop.Advapi32.OpenProcessToken(processHandle, TokenAccessLevels.Read, out token)) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "Open process token failed"); + } + + using (token) + { + Interop.Advapi32.TOKEN_ELEVATION elevation = new Interop.Advapi32.TOKEN_ELEVATION(); + uint ignore; + if (!Interop.Advapi32.GetTokenInformation( + token, + Interop.Advapi32.TOKEN_INFORMATION_CLASS.TokenElevation, + &elevation, + (uint)sizeof(Interop.Advapi32.TOKEN_ELEVATION), + out ignore)) + { + throw new Win32Exception(Marshal.GetLastWin32Error(), "Get token information failed"); + } + return elevation.TokenIsElevated != Interop.BOOL.FALSE; + } + } + + } +} diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs index ca13f24382..526e6bd500 100644 --- a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/AdminHelpers.cs @@ -7,9 +7,8 @@ using Xunit; namespace System { - public static class AdminHelpers + public static partial class AdminHelpers { - /// /// Runs the given command as sudo (for Unix). /// diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs index 49ff3d9ffb..896f424dd6 100644 --- a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs @@ -19,7 +19,7 @@ namespace System.Diagnostics /// The arguments to pass to the method. /// true if this function should Start the Process; false if that responsibility is left up to the caller. /// The ProcessStartInfo to use, or null for a default. - /// true if this function should paste the arguments (e.g. surrounding with quotes); false if that reponsibility is left up to the caller. + /// true if this function should paste the arguments (e.g. surrounding with quotes); false if that responsibility is left up to the caller. private static RemoteInvokeHandle RemoteInvoke(MethodInfo method, string[] args, RemoteInvokeOptions options, bool pasteArguments = true) { options = options ?? new RemoteInvokeOptions(); @@ -51,7 +51,7 @@ namespace System.Diagnostics } // If we need the host (if it exists), use it, otherwise target the console app directly. - string metadataArgs = PasteArguments.Paste(new string[] { a.FullName, t.FullName, method.Name }, pasteFirstArgumentUsingArgV0Rules: false); + string metadataArgs = PasteArguments.Paste(new string[] { a.FullName, t.FullName, method.Name, options.ExceptionFile }, pasteFirstArgumentUsingArgV0Rules: false); string passedArgs = pasteArguments ? PasteArguments.Paste(args, pasteFirstArgumentUsingArgV0Rules: false) : string.Join(" ", args); string testConsoleAppArgs = ExtraParameter + " " + metadataArgs + " " + passedArgs; diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs index 84641484e5..9ff440256c 100644 --- a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Threading.Tasks; using Xunit; +using Xunit.Sdk; namespace System.Diagnostics { @@ -21,7 +22,6 @@ namespace System.Diagnostics /// The name of the test console app. protected static readonly string TestConsoleApp = "RemoteExecutorConsoleApp.exe"; - /// Invokes the method from this assembly in another process using the specified arguments. /// The method to invoke. /// Options to use for the invocation. @@ -42,6 +42,17 @@ namespace System.Diagnostics return RemoteInvoke(GetMethodInfo(method), Array.Empty(), options); } + /// Invokes the method from this assembly in another process using the specified arguments. + /// The method to invoke. + /// Options to use for the invocation. + public static RemoteInvokeHandle RemoteInvoke( + Func> method, + string arg, + RemoteInvokeOptions options = null) + { + return RemoteInvoke(GetMethodInfo(method), new[] { arg }, options); + } + /// Invokes the method from this assembly in another process using the specified arguments. /// The method to invoke. /// The first argument to pass to the method. @@ -167,16 +178,26 @@ namespace System.Diagnostics Assert.True(Process.WaitForExit(Options.TimeOut), $"Timed out after {Options.TimeOut}ms waiting for remote process {Process.Id}"); + if (File.Exists(Options.ExceptionFile)) + { + throw new RemoteExecutionException(File.ReadAllText(Options.ExceptionFile)); + } + if (Options.CheckExitCode) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - Assert.Equal(Options.ExpectedExitCode, Process.ExitCode); - else - Assert.Equal(unchecked((sbyte)Options.ExpectedExitCode), unchecked((sbyte)Process.ExitCode)); + int expected = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Options.ExpectedExitCode : unchecked((sbyte)Options.ExpectedExitCode); + int actual = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? Process.ExitCode : unchecked((sbyte)Process.ExitCode); + + Assert.True(expected == actual, $"Exit code was {Process.ExitCode} but it should have been {Options.ExpectedExitCode}"); } } finally { + if (File.Exists(Options.ExceptionFile)) + { + File.Delete(Options.ExceptionFile); + } + // Cleanup try { Process.Kill(); } catch { } // ignore all cleanup errors @@ -186,6 +207,11 @@ namespace System.Diagnostics } } } + + private sealed class RemoteExecutionException : XunitException + { + internal RemoteExecutionException(string stackTrace) : base("Remote process failed with an unhandled exception.", stackTrace) { } + } } } @@ -199,5 +225,6 @@ namespace System.Diagnostics public int TimeOut {get; set; } = RemoteExecutorTestBase.FailWaitTimeoutMilliseconds; public int ExpectedExitCode { get; set; } = RemoteExecutorTestBase.SuccessExitCode; + public string ExceptionFile { get; } = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); } } diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs index eab1de6a3f..67c5b91721 100644 --- a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs @@ -11,6 +11,10 @@ namespace System.IO /// Base class for test classes the use temporary files that need to be cleaned up. public abstract class FileCleanupTestBase : IDisposable { + private static readonly Lazy s_isElevated = new Lazy(() => AdminHelpers.IsProcessElevated()); + + protected static bool IsProcessElevated => s_isElevated.Value; + /// Initialize the test class base. This creates the associated test directory. protected FileCleanupTestBase() { diff --git a/external/corefx/src/Common/tests/System/Net/PlatformDetection.Networking.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/Net/PlatformDetection.Networking.cs similarity index 100% rename from external/corefx/src/Common/tests/System/Net/PlatformDetection.Networking.cs rename to external/corefx/src/CoreFx.Private.TestUtilities/src/System/Net/PlatformDetection.Networking.cs diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs new file mode 100644 index 0000000000..abb86f9399 --- /dev/null +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs @@ -0,0 +1,306 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Xml.Linq; +using System.Runtime.InteropServices; +using System.Text; +using Xunit; + +namespace System +{ + public static partial class PlatformDetection + { + public static bool IsWindowsIoTCore => false; + public static bool IsWindows => false; + public static bool IsWindows7 => false; + public static bool IsWindows8x => false; + public static bool IsWindows10Version1607OrGreater => false; + public static bool IsWindows10Version1703OrGreater => false; + public static bool IsWindows10InsiderPreviewBuild16215OrGreater => false; + public static bool IsWindows10Version16251OrGreater => false; + public static bool IsNotOneCoreUAP => true; + public static bool IsNetfx462OrNewer() { return false; } + public static bool IsNetfx470OrNewer() { return false; } + public static bool IsNetfx471OrNewer() { return false; } + public static bool IsInAppContainer => false; + public static int WindowsVersion => -1; + + public static bool IsOpenSUSE => IsDistroAndVersion("opensuse"); + public static bool IsUbuntu => IsDistroAndVersion("ubuntu"); + public static bool IsDebian => IsDistroAndVersion("debian"); + public static bool IsDebian8 => IsDistroAndVersion("debian", "8"); + public static bool IsUbuntu1404 => IsDistroAndVersion("ubuntu", "14.04"); + public static bool IsUbuntu1604 => IsDistroAndVersion("ubuntu", "16.04"); + public static bool IsUbuntu1704 => IsDistroAndVersion("ubuntu", "17.04"); + public static bool IsUbuntu1710 => IsDistroAndVersion("ubuntu", "17.10"); + public static bool IsCentos7 => IsDistroAndVersion("centos", "7"); + public static bool IsTizen => IsDistroAndVersion("tizen"); + public static bool IsNotFedoraOrRedHatOrCentos => !IsDistroAndVersion("fedora") && !IsDistroAndVersion("rhel") && !IsDistroAndVersion("centos"); + public static bool IsFedora => IsDistroAndVersion("fedora"); + public static bool IsWindowsNanoServer => false; + public static bool IsWindowsServerCore => false; + public static bool IsWindowsAndElevated => false; + public static bool IsWindowsRedStone2 => false; + + public static bool IsRedHat => IsDistroAndVersion("rhel") || IsDistroAndVersion("rhl"); + public static bool IsNotRedHat => !IsRedHat; + public static bool IsRedHat69 => IsDistroAndVersion("rhel", "6.9") || IsDistroAndVersion("rhl", "6.9"); + public static bool IsNotRedHat69 => !IsRedHat69; + + public static Version OSXKernelVersion { get; } = GetOSXKernelVersion(); + + public static string GetDistroVersionString() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + return "OSX Version=" + s_osxProductVersion.ToString(); + } + + DistroInfo v = ParseOsReleaseFile(); + + return "Distro=" + v.Id + " VersionId=" + v.VersionId + " Pretty=" + v.PrettyName + " Version=" + v.Version; + } + + private static readonly Version s_osxProductVersion = GetOSXProductVersion(); + + public static bool IsMacOsHighSierraOrHigher { get; } = + IsOSX && (s_osxProductVersion.Major > 10 || (s_osxProductVersion.Major == 10 && s_osxProductVersion.Minor >= 13)); + + private static readonly Version s_icuVersion = GetICUVersion(); + public static Version ICUVersion => s_icuVersion; + + private static Version GetICUVersion() + { + int ver = GlobalizationNative_GetICUVersion(); + return new Version( ver & 0xFF, + (ver >> 8) & 0xFF, + (ver >> 16) & 0xFF, + ver >> 24); + } + + private static DistroInfo ParseOsReleaseFile() + { + Debug.Assert(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)); + + DistroInfo ret = new DistroInfo(); + ret.Id = ""; + ret.VersionId = ""; + ret.Version = ""; + ret.PrettyName = ""; + + if (File.Exists("/etc/os-release")) + { + foreach (string line in File.ReadLines("/etc/os-release")) + { + if (line.StartsWith("ID=", System.StringComparison.Ordinal)) + { + ret.Id = RemoveQuotes(line.Substring("ID=".Length)); + } + else if (line.StartsWith("VERSION_ID=", System.StringComparison.Ordinal)) + { + ret.VersionId = RemoveQuotes(line.Substring("VERSION_ID=".Length)); + } + else if (line.StartsWith("VERSION=", System.StringComparison.Ordinal)) + { + ret.Version = RemoveQuotes(line.Substring("VERSION=".Length)); + } + else if (line.StartsWith("PRETTY_NAME=", System.StringComparison.Ordinal)) + { + ret.PrettyName = RemoveQuotes(line.Substring("PRETTY_NAME=".Length)); + } + } + } + else + { + string fileName = null; + if (File.Exists("/etc/redhat-release")) + fileName = "/etc/redhat-release"; + + if (fileName == null && File.Exists("/etc/system-release")) + fileName = "/etc/system-release"; + + if (fileName != null) + { + // Parse the format like the following line: + // Red Hat Enterprise Linux Server release 7.3 (Maipo) + using (StreamReader file = new StreamReader(fileName)) + { + string line = file.ReadLine(); + if (!String.IsNullOrEmpty(line)) + { + if (line.StartsWith("Red Hat Enterprise Linux", StringComparison.OrdinalIgnoreCase)) + { + ret.Id = "rhel"; + } + else if (line.StartsWith("Centos", StringComparison.OrdinalIgnoreCase)) + { + ret.Id = "centos"; + } + else if (line.StartsWith("Red Hat", StringComparison.OrdinalIgnoreCase)) + { + ret.Id = "rhl"; + } + else + { + // automatically generate the distro label + string [] words = line.Split(' '); + StringBuilder sb = new StringBuilder(); + + foreach (string word in words) + { + if (word.Length > 0) + { + if (Char.IsNumber(word[0]) || + word.Equals("release", StringComparison.OrdinalIgnoreCase) || + word.Equals("server", StringComparison.OrdinalIgnoreCase)) + { + break; + } + sb.Append(Char.ToLower(word[0])); + } + } + ret.Id = sb.ToString(); + } + + int i = 0; + while (i < line.Length && !Char.IsNumber(line[i])) // stop at first number + i++; + + if (i < line.Length) + { + int j = i + 1; + while (j < line.Length && (Char.IsNumber(line[j]) || line[j] == '.')) + j++; + + ret.VersionId = line.Substring(i, j - i); + ret.Version = line.Substring(i, line.Length - i); + } + + ret.PrettyName = line; + } + } + } + } + + return ret; + } + + private static string RemoveQuotes(string s) + { + s = s.Trim(); + if (s.Length >= 2 && s[0] == '"' && s[s.Length - 1] == '"') + { + // Remove quotes. + s = s.Substring(1, s.Length - 2); + } + + return s; + } + + private struct DistroInfo + { + public string Id { get; set; } + public string VersionId { get; set; } + public string Version { get; set; } + public string PrettyName { get; set; } + } + + /// + /// Get whether the OS platform matches the given Linux distro and optional version. + /// + /// The distribution id. + /// The distro version. If omitted, compares the distro only. + /// Whether the OS platform matches the given Linux distro and optional version. + private static bool IsDistroAndVersion(string distroId, string versionId = null) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + DistroInfo v = ParseOsReleaseFile(); + if (v.Id == distroId && (versionId == null || v.VersionId == versionId)) + { + return true; + } + } + + return false; + } + + private static Version GetOSXKernelVersion() + { + if (IsOSX) + { + byte[] bytes = new byte[256]; + IntPtr bytesLength = new IntPtr(bytes.Length); + Assert.Equal(0, sysctlbyname("kern.osrelease", bytes, ref bytesLength, null, IntPtr.Zero)); + string versionString = Encoding.UTF8.GetString(bytes); + return Version.Parse(versionString); + } + + return new Version(0, 0, 0); + } + + private static Version GetOSXProductVersion() + { + try + { + if (IsOSX) + { + // + // + // ProductBuildVersion + // 17A330h + // ProductCopyright + // 1983-2017 Apple Inc. + // ProductName + // Mac OS X + // ProductUserVisibleVersion + // 10.13 + // ProductVersion + // 10.13 + // + // + + XElement dict = XDocument.Load("/System/Library/CoreServices/SystemVersion.plist").Root.Element("dict"); + if (dict != null) + { + foreach (XElement key in dict.Elements("key")) + { + if ("ProductVersion".Equals(key.Value)) + { + XElement stringElement = key.NextNode as XElement; + if (stringElement != null && stringElement.Name.LocalName.Equals("string")) + { + string versionString = stringElement.Value; + if (versionString != null) + { + return Version.Parse(versionString); + } + } + } + } + } + } + } + catch + { + } + + // In case of exception or couldn't get the version + return new Version(0, 0, 0); + } + + [DllImport("libc", SetLastError = true)] + private static extern int sysctlbyname(string ctlName, byte[] oldp, ref IntPtr oldpLen, byte[] newp, IntPtr newpLen); + + [DllImport("libc", SetLastError = true)] + internal static extern unsafe uint geteuid(); + + [DllImport("System.Globalization.Native", SetLastError = true)] + private static extern int GlobalizationNative_GetICUVersion(); + + public static bool IsSuperUser => geteuid() == 0; + } +} diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs new file mode 100644 index 0000000000..ce31c9965a --- /dev/null +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs @@ -0,0 +1,325 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Text; +using Xunit; + +namespace System +{ + public static partial class PlatformDetection + { + public static Version OSXKernelVersion => throw new PlatformNotSupportedException(); + public static bool IsSuperUser => throw new PlatformNotSupportedException(); + public static bool IsOpenSUSE => false; + public static bool IsUbuntu => false; + public static bool IsDebian => false; + public static bool IsDebian8 => false; + public static bool IsUbuntu1404 => false; + public static bool IsUbuntu1604 => false; + public static bool IsUbuntu1704 => false; + public static bool IsUbuntu1710 => false; + public static bool IsCentos7 => false; + public static bool IsTizen => false; + public static bool IsNotFedoraOrRedHatOrCentos => true; + public static bool IsFedora => false; + public static bool IsWindowsNanoServer => (IsNotWindowsIoTCore && GetInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase)); + public static bool IsWindowsServerCore => GetInstallationType().Equals("Server Core", StringComparison.OrdinalIgnoreCase); + public static int WindowsVersion => GetWindowsVersion(); + public static bool IsMacOsHighSierraOrHigher { get; } = false; + public static Version ICUVersion => new Version(0, 0, 0, 0); + public static bool IsRedHat => false; + public static bool IsNotRedHat => true; + public static bool IsRedHat69 => false; + public static bool IsNotRedHat69 => true; + + public static bool IsWindows10Version1607OrGreater => + GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 14393; + public static bool IsWindows10Version1703OrGreater => + GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 15063; + public static bool IsWindows10InsiderPreviewBuild16215OrGreater => + GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 16215; + public static bool IsWindows10Version16251OrGreater => + GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildNumber() >= 16251; + public static bool IsWindowsRedStone2 => // Creators Update version + GetWindowsVersion() == 10 && (GetWindowsBuildNumber() / 1000) == 15; // any build with 15xxx. e.g 15063 + + // Windows OneCoreUAP SKU doesn't have httpapi.dll + public static bool IsNotOneCoreUAP => + File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "System32", "httpapi.dll")); + + public static bool IsWindowsIoTCore + { + get + { + int productType = GetWindowsProductType(); + if ((productType == PRODUCT_IOTUAPCOMMERCIAL) || + (productType == PRODUCT_IOTUAP)) + { + return true; + } + return false; + } + } + + public static bool IsWindows => true; + public static bool IsWindows7 => GetWindowsVersion() == 6 && GetWindowsMinorVersion() == 1; + public static bool IsWindows8x => GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3); + + public static bool IsNetfx462OrNewer() + { + if (!IsFullFramework) + { + return false; + } + + Version net462 = new Version(4, 6, 2); + Version runningVersion = GetFrameworkVersion(); + return runningVersion != null && runningVersion >= net462; + } + + public static bool IsNetfx470OrNewer() + { + if (!IsFullFramework) + { + return false; + } + + Version net470 = new Version(4, 7, 0); + Version runningVersion = GetFrameworkVersion(); + return runningVersion != null && runningVersion >= net470; + } + + public static bool IsNetfx471OrNewer() + { + if (!IsFullFramework) + { + return false; + } + + Version net471 = new Version(4, 7, 1); + Version runningVersion = GetFrameworkVersion(); + return runningVersion != null && runningVersion >= net471; + } + + private static Version GetFrameworkVersion() + { + string[] descriptionArray = RuntimeInformation.FrameworkDescription.Split(' '); + if (descriptionArray.Length < 3) + return null; + + if (!Version.TryParse(descriptionArray[2], out Version actualVersion)) + return null; + + foreach (Range currentRange in FrameworkRanges) + { + if (currentRange.IsInRange(actualVersion)) + return currentRange.FrameworkVersion; + } + + return null; + } + + public static string GetDistroVersionString() { return "ProductType=" + GetWindowsProductType() + "InstallationType=" + GetInstallationType(); } + + private static int s_isInAppContainer = -1; + + public static bool IsInAppContainer + { + // This actually checks whether code is running in a modern app. + // Currently this is the only situation where we run in app container. + // If we want to distinguish the two cases in future, + // EnvironmentHelpers.IsAppContainerProcess in desktop code shows how to check for the AC token. + get + { + if (s_isInAppContainer != -1) + return s_isInAppContainer == 1; + + if (!IsWindows || IsWindows7) + { + s_isInAppContainer = 0; + return false; + } + + byte[] buffer = new byte[0]; + uint bufferSize = 0; + try + { + int result = GetCurrentApplicationUserModelId(ref bufferSize, buffer); + switch (result) + { + case 15703: // APPMODEL_ERROR_NO_APPLICATION + s_isInAppContainer = 0; + break; + case 0: // ERROR_SUCCESS + case 122: // ERROR_INSUFFICIENT_BUFFER + // Success is actually insufficent buffer as we're really only looking for + // not NO_APPLICATION and we're not actually giving a buffer here. The + // API will always return NO_APPLICATION if we're not running under a + // WinRT process, no matter what size the buffer is. + s_isInAppContainer = 1; + break; + default: + throw new InvalidOperationException($"Failed to get AppId, result was {result}."); + } + } + catch (Exception e) + { + // We could catch this here, being friendly with older portable surface area should we + // desire to use this method elsewhere. + if (e.GetType().FullName.Equals("System.EntryPointNotFoundException", StringComparison.Ordinal)) + { + // API doesn't exist, likely pre Win8 + s_isInAppContainer = 0; + } + else + { + throw; + } + } + + return s_isInAppContainer == 1; + } + } + + private static int s_isWindowsElevated = -1; + + public static bool IsWindowsAndElevated + { + get + { + if (s_isWindowsElevated != -1) + return s_isWindowsElevated == 1; + + if (!IsWindows || IsInAppContainer) + { + s_isWindowsElevated = 0; + return false; + } + + IntPtr processToken; + Assert.True(OpenProcessToken(GetCurrentProcess(), TOKEN_READ, out processToken)); + + try + { + uint tokenInfo; + uint returnLength; + Assert.True(GetTokenInformation( + processToken, TokenElevation, out tokenInfo, sizeof(uint), out returnLength)); + + s_isWindowsElevated = tokenInfo == 0 ? 0 : 1; + } + finally + { + CloseHandle(processToken); + } + + return s_isWindowsElevated == 1; + } + } + + private static string GetInstallationType() + { + string key = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"; + string value = ""; + + try + { + value = (string)Registry.GetValue(key, "InstallationType", defaultValue: ""); + } + catch (Exception e) when (e is SecurityException || e is InvalidCastException || e is PlatformNotSupportedException /* UAP */) + { + } + + return value; + } + + private static int GetWindowsProductType() + { + Assert.True(GetProductInfo(Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, 0, 0, out int productType)); + return productType; + } + + private static int GetWindowsMinorVersion() + { + RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX(); + osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi); + Assert.Equal(0, RtlGetVersion(out osvi)); + return (int)osvi.dwMinorVersion; + } + + private static int GetWindowsBuildNumber() + { + RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX(); + osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi); + Assert.Equal(0, RtlGetVersion(out osvi)); + return (int)osvi.dwBuildNumber; + } + + private const uint TokenElevation = 20; + private const uint STANDARD_RIGHTS_READ = 0x00020000; + private const uint TOKEN_QUERY = 0x0008; + private const uint TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY; + + [DllImport("advapi32.dll", SetLastError = true, ExactSpelling = true)] + private static extern bool GetTokenInformation( + IntPtr TokenHandle, + uint TokenInformationClass, + out uint TokenInformation, + uint TokenInformationLength, + out uint ReturnLength); + + private const int PRODUCT_IOTUAP = 0x0000007B; + private const int PRODUCT_IOTUAPCOMMERCIAL = 0x00000083; + + [DllImport("kernel32.dll", SetLastError = false)] + private static extern bool GetProductInfo( + int dwOSMajorVersion, + int dwOSMinorVersion, + int dwSpMajorVersion, + int dwSpMinorVersion, + out int pdwReturnedProductType + ); + + [DllImport("ntdll.dll")] + private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation); + + [StructLayout(LayoutKind.Sequential)] + private struct RTL_OSVERSIONINFOEX + { + internal uint dwOSVersionInfoSize; + internal uint dwMajorVersion; + internal uint dwMinorVersion; + internal uint dwBuildNumber; + internal uint dwPlatformId; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + internal string szCSDVersion; + } + + private static int GetWindowsVersion() + { + RTL_OSVERSIONINFOEX osvi = new RTL_OSVERSIONINFOEX(); + osvi.dwOSVersionInfoSize = (uint)Marshal.SizeOf(osvi); + Assert.Equal(0, RtlGetVersion(out osvi)); + return (int)osvi.dwMajorVersion; + } + + [DllImport("kernel32.dll", ExactSpelling = true)] + private static extern int GetCurrentApplicationUserModelId(ref uint applicationUserModelIdLength, byte[] applicationUserModelId); + + [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] + private static extern bool CloseHandle(IntPtr handle); + + [DllImport("advapi32.dll", SetLastError = true, ExactSpelling = true)] + private static extern bool OpenProcessToken(IntPtr ProcessHandle, uint DesiredAccess, out IntPtr TokenHandle); + + // The process handle does NOT need closing + [DllImport("kernel32.dll", ExactSpelling = true)] + private static extern IntPtr GetCurrentProcess(); + } +} diff --git a/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs new file mode 100644 index 0000000000..db9816cdd7 --- /dev/null +++ b/external/corefx/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs @@ -0,0 +1,133 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; +using Xunit; + +namespace System +{ + public static partial class PlatformDetection + { + // + // Do not use the " { get; } = " pattern here. Having all the initialization happen in the type initializer + // means that one exception anywhere means all tests using PlatformDetection fail. If you feel a value is worth latching, + // do it in a way that failures don't cascade. + // + + public static bool HasWindowsShell => IsNotWindowsServerCore && IsNotWindowsNanoServer && IsNotWindowsIoTCore; + public static bool IsUap => IsInAppContainer || IsNetNative; + public static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); + public static bool IsNetNative => RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.OrdinalIgnoreCase); + public static bool IsNetCore => RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase); + public static bool IsOSX => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); + public static bool IsNotWindows8x => !IsWindows8x; + public static bool IsNotWindowsNanoServer => !IsWindowsNanoServer; + public static bool IsNotWindowsServerCore => !IsWindowsServerCore; + public static bool IsNotWindowsIoTCore => !IsWindowsIoTCore; + public static bool IsDrawingSupported => (IsNotWindowsNanoServer && IsNotWindowsIoTCore); + public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; + public static bool IsNotArmProcess => !IsArmProcess; + + public static bool IsNotInAppContainer => !IsInAppContainer; + public static bool IsWinRTSupported => IsWindows && !IsWindows7; + public static bool IsNotWinRTSupported => !IsWinRTSupported; + public static bool IsNotMacOsHighSierraOrHigher => !IsMacOsHighSierraOrHigher; + + // Officially, .Net Native only supports processes running in an AppContainer. However, the majority of tests still work fine + // in a normal Win32 process and we often do so as running in an AppContainer imposes a substantial tax in debuggability + // and investigatability. This predicate is used in ConditionalFacts to disable the specific tests that really need to be + // running in AppContainer when running on .NetNative. + public static bool IsNotNetNativeRunningAsConsoleApp => !(IsNetNative && !IsInAppContainer); + + private static Lazy m_isWindowsSubsystemForLinux = new Lazy(GetIsWindowsSubsystemForLinux); + + public static bool IsWindowsSubsystemForLinux => m_isWindowsSubsystemForLinux.Value; + public static bool IsNotWindowsSubsystemForLinux => !IsWindowsSubsystemForLinux; + + private static bool GetIsWindowsSubsystemForLinux() + { + // https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364 + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + const string versionFile = "/proc/version"; + if (File.Exists(versionFile)) + { + string s = File.ReadAllText(versionFile); + + if (s.Contains("Microsoft") || s.Contains("WSL")) + { + return true; + } + } + } + + return false; + } + + public static bool IsNonZeroLowerBoundArraySupported + { + get + { + if (s_lazyNonZeroLowerBoundArraySupported == null) + { + bool nonZeroLowerBoundArraysSupported = false; + try + { + Array.CreateInstance(typeof(int), new int[] { 5 }, new int[] { 5 }); + nonZeroLowerBoundArraysSupported = true; + } + catch (PlatformNotSupportedException) + { + } + s_lazyNonZeroLowerBoundArraySupported = Tuple.Create(nonZeroLowerBoundArraysSupported); + } + return s_lazyNonZeroLowerBoundArraySupported.Item1; + } + } + + private static volatile Tuple s_lazyNonZeroLowerBoundArraySupported; + + public static bool IsReflectionEmitSupported = !PlatformDetection.IsNetNative; + + // Tracked in: https://github.com/dotnet/corert/issues/3643 in case we change our mind about this. + public static bool IsInvokingStaticConstructorsSupported => !PlatformDetection.IsNetNative; + + // System.Security.Cryptography.Xml.XmlDsigXsltTransform.GetOutput() relies on XslCompiledTransform which relies + // heavily on Reflection.Emit + public static bool IsXmlDsigXsltTransformSupported => !PlatformDetection.IsUap; + + public static Range[] FrameworkRanges => new Range[]{ + new Range(new Version(4, 7, 2500, 0), null, new Version(4, 7, 1)), + new Range(new Version(4, 6, 2000, 0), new Version(4, 7, 2090, 0), new Version(4, 7, 0)), + new Range(new Version(4, 6, 1500, 0), new Version(4, 6, 1999, 0), new Version(4, 6, 2)), + new Range(new Version(4, 6, 1000, 0), new Version(4, 6, 1499, 0), new Version(4, 6, 1)), + new Range(new Version(4, 6, 55, 0), new Version(4, 6, 999, 0), new Version(4, 6, 0)), + new Range(new Version(4, 0, 30319, 0), new Version(4, 0, 52313, 36313), new Version(4, 5, 2)) + }; + + public class Range + { + public Version Start { get; private set; } + public Version Finish { get; private set; } + public Version FrameworkVersion { get; private set; } + + public Range(Version start, Version finish, Version frameworkVersion) + { + Start = start; + Finish = finish; + FrameworkVersion = frameworkVersion; + } + + public bool IsInRange(Version version) + { + return version >= Start && (Finish == null || version <= Finish); + } + } + } +} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj b/external/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj index afe197b988..c65e276ef8 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj @@ -33,15 +33,10 @@ - - - - - @@ -49,7 +44,6 @@ - @@ -77,7 +71,6 @@ - @@ -97,7 +90,6 @@ - @@ -110,9 +102,7 @@ - - @@ -126,7 +116,6 @@ - @@ -140,7 +129,6 @@ - @@ -158,12 +146,10 @@ - - diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs index 288557628a..f118d86f90 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs @@ -37,11 +37,7 @@ namespace Microsoft.CSharp.RuntimeBinder // Our contract with the DLR is such that we will not enter a bind unless we have // values for the meta-objects involved. - if (!o.HasValue) - { - Debug.Assert(false, "The runtime binder is being asked to bind a metaobject without a value"); - throw Error.InternalCompilerError(); - } + Debug.Assert(o.HasValue); CSharpArgumentInfo info = arginfosEnum.MoveNext() ? arginfosEnum.Current : null; @@ -139,13 +135,37 @@ namespace Microsoft.CSharp.RuntimeBinder typeof(RuntimeBinderException).GetConstructor(new Type[] { typeof(string) }), Expression.Constant(e.Message) ), - GetTypeForErrorMetaObject(action, args.Length == 0 ? null : args[0]) + GetTypeForErrorMetaObject(action, args) ), restrictions ); } } + public static void ValidateBindArgument(DynamicMetaObject argument, string paramName) + { + if (argument == null) + { + throw Error.ArgumentNull(paramName); + } + + if (!argument.HasValue) + { + throw Error.DynamicArgumentNeedsValue(paramName); + } + } + + public static void ValidateBindArgument(DynamicMetaObject[] arguments, string paramName) + { + if (arguments != null) // null is treated as empty, so not invalid + { + for (int i = 0; i != arguments.Length; ++i) + { + ValidateBindArgument(arguments[i], $"{paramName}[{i}]"); + } + } + } + ///////////////////////////////////////////////////////////////////////////////// private static bool IsTypeOfStaticCall( @@ -304,21 +324,16 @@ namespace Microsoft.CSharp.RuntimeBinder ///////////////////////////////////////////////////////////////////////////////// - private static Type GetTypeForErrorMetaObject(DynamicMetaObjectBinder action, DynamicMetaObject arg0) + private static Type GetTypeForErrorMetaObject(DynamicMetaObjectBinder action, DynamicMetaObject[] args) { // This is similar to ConvertResult but has fewer things to worry about. - var invokeConstructor = action as CSharpInvokeConstructorBinder; - if (invokeConstructor != null) + if (action is CSharpInvokeConstructorBinder) { - Type result = arg0.Value as Type; - if (result == null) - { - Debug.Assert(false); - return typeof(object); - } - - return result; + Debug.Assert(args != null); + Debug.Assert(args.Length != 0); + Debug.Assert(args[0].Value is Type); + return args[0].Value as Type; } return action.ReturnType; @@ -365,15 +380,7 @@ namespace Microsoft.CSharp.RuntimeBinder ///////////////////////////////////////////////////////////////////////////////// - internal static List ToList(IEnumerable source) - { - if (source == null) - { - return new List(); - } - - return source.ToList(); - } + internal static T[] ToArray(IEnumerable source) => source == null ? Array.Empty() : source.ToArray(); ///////////////////////////////////////////////////////////////////////////////// diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationBinder.cs index 17a83254be..36f2d39fb9 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationBinder.cs @@ -51,7 +51,7 @@ namespace Microsoft.CSharp.RuntimeBinder public Type CallingContext { get; } - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -78,8 +78,8 @@ namespace Microsoft.CSharp.RuntimeBinder IsChecked = isChecked; _binopFlags = binaryOperationFlags; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); - Debug.Assert(_argumentInfo.Count == 2); + _argumentInfo = BinderHelper.ToArray(argumentInfo); + Debug.Assert(_argumentInfo.Length == 2); _binder = RuntimeBinder.GetInstance(); } @@ -92,6 +92,8 @@ namespace Microsoft.CSharp.RuntimeBinder /// The representing the result of the binding. public override DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion) { + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(arg, nameof(arg)); return BinderHelper.Bind(this, _binder, new [] {target, arg}, _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationFlags.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationFlags.cs index dd2c5bc87a..f0026d0727 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationFlags.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationFlags.cs @@ -2,12 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; + namespace Microsoft.CSharp.RuntimeBinder { /// /// Represents the set of binary operation flags in C# for use with instances. /// Instances of this enum are generated by the C# compiler. /// + [Flags] internal enum CSharpBinaryOperationFlags { None = 0, diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpCallFlags.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpCallFlags.cs index 520b26b6c0..bd89be5348 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpCallFlags.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpCallFlags.cs @@ -2,12 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; + namespace Microsoft.CSharp.RuntimeBinder { /// /// Represents information about a or that /// is not specific to any particular argument given to those operations. /// + [Flags] internal enum CSharpCallFlags { /// diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpConvertBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpConvertBinder.cs index 78f412dd8d..a45684eac3 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpConvertBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpConvertBinder.cs @@ -90,6 +90,7 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); return BinderHelper.Bind(this, _binder, new[] { target }, null, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetIndexBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetIndexBinder.cs index 5ac83fcd6e..142210d121 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetIndexBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetIndexBinder.cs @@ -22,7 +22,7 @@ namespace Microsoft.CSharp.RuntimeBinder public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { Expr indexerArguments = runtimeBinder.CreateArgumentListEXPR(arguments, locals, 1, arguments.Length); - return runtimeBinder.BindProperty(this, arguments[0], locals[0], indexerArguments, false); + return runtimeBinder.BindProperty(this, arguments[0], locals[0], indexerArguments); } public void PopulateSymbolTableWithName(SymbolTable symbolTable, Type callingType, ArgumentObject[] arguments) @@ -34,7 +34,7 @@ namespace Microsoft.CSharp.RuntimeBinder public bool IsChecked => false; - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -51,7 +51,7 @@ namespace Microsoft.CSharp.RuntimeBinder base(BinderHelper.CreateCallInfo(argumentInfo, 1)) // discard 1 argument: the target object { CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } @@ -71,6 +71,8 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(indexes, nameof(indexes)); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, indexes), _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetMemberBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetMemberBinder.cs index 28069a740b..19290ddfc3 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetMemberBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetMemberBinder.cs @@ -21,7 +21,7 @@ namespace Microsoft.CSharp.RuntimeBinder public Expr DispatchPayload(RuntimeBinder runtimeBinder, ArgumentObject[] arguments, LocalVariableSymbol[] locals) { Debug.Assert(arguments.Length == 1); - return runtimeBinder.BindProperty(this, arguments[0], locals[0], null, false); + return runtimeBinder.BindProperty(this, arguments[0], locals[0], null); } public void PopulateSymbolTableWithName(SymbolTable symbolTable, Type callingType, ArgumentObject[] arguments) @@ -33,7 +33,7 @@ namespace Microsoft.CSharp.RuntimeBinder public bool IsChecked => false; - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -59,7 +59,7 @@ namespace Microsoft.CSharp.RuntimeBinder { ResultIndexed = resultIndexed; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } @@ -78,6 +78,7 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); return BinderHelper.Bind(this, _binder, new[] { target }, _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeBinder.cs index 65684234ad..edf6249cb2 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeBinder.cs @@ -29,7 +29,7 @@ namespace Microsoft.CSharp.RuntimeBinder string ICSharpBinder.Name => "Invoke"; - IList ICSharpInvokeOrInvokeMemberBinder.TypeArguments => Array.Empty(); + Type[] ICSharpInvokeOrInvokeMemberBinder.TypeArguments => Array.Empty(); CSharpCallFlags ICSharpInvokeOrInvokeMemberBinder.Flags => _flags; @@ -39,7 +39,7 @@ namespace Microsoft.CSharp.RuntimeBinder public bool IsChecked => false; - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -61,7 +61,7 @@ namespace Microsoft.CSharp.RuntimeBinder { _flags = flags; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } @@ -82,6 +82,8 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(args, nameof(args)); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeConstructorBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeConstructorBinder.cs index 6218be8ec3..5d61c0cfc6 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeConstructorBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeConstructorBinder.cs @@ -27,13 +27,13 @@ namespace Microsoft.CSharp.RuntimeBinder public bool IsChecked => false; - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; public bool StaticCall => true; - public IList TypeArguments => Array.Empty(); + public Type[] TypeArguments => Array.Empty(); public string Name => ".ctor"; @@ -48,12 +48,14 @@ namespace Microsoft.CSharp.RuntimeBinder { Flags = flags; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } public override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(args, nameof(args)); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, null); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeMemberBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeMemberBinder.cs index 74e6bba035..b12f3523cd 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeMemberBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeMemberBinder.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Dynamic; using Microsoft.CSharp.RuntimeBinder.Semantics; @@ -33,15 +34,18 @@ namespace Microsoft.CSharp.RuntimeBinder public bool IsChecked => false; - public IList TypeArguments => _typeArguments.AsReadOnly(); + public Type[] TypeArguments { get; } - private readonly List _typeArguments; - - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; public CSharpArgumentInfo GetArgumentInfo(int index) => _argumentInfo[index]; - public CSharpArgumentInfo[] ArgumentInfoArray() => _argumentInfo.ToArray(); + public CSharpArgumentInfo[] ArgumentInfoArray() + { + CSharpArgumentInfo[] array = new CSharpArgumentInfo[_argumentInfo.Length]; + _argumentInfo.CopyTo(array, 0); + return array; + } bool ICSharpInvokeOrInvokeMemberBinder.ResultDiscarded => (Flags & CSharpCallFlags.ResultDiscarded) != 0; @@ -65,8 +69,8 @@ namespace Microsoft.CSharp.RuntimeBinder { Flags = flags; CallingContext = callingContext; - _typeArguments = BinderHelper.ToList(typeArguments); - _argumentInfo = BinderHelper.ToList(argumentInfo); + TypeArguments = BinderHelper.ToArray(typeArguments); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } @@ -86,6 +90,8 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(args, nameof(args)); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, errorSuggestion); } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpIsEventBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpIsEventBinder.cs index 94f0f69e53..742588018e 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpIsEventBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpIsEventBinder.cs @@ -60,7 +60,8 @@ namespace Microsoft.CSharp.RuntimeBinder /// The representing the result of the binding. public override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - return BinderHelper.Bind(this, _binder, new DynamicMetaObject[] { target }, null, null); + BinderHelper.ValidateBindArgument(target, nameof(target)); + return BinderHelper.Bind(this, _binder, new [] { target }, null, null); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetIndexBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetIndexBinder.cs index 51ab8ad4d7..39228ad914 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetIndexBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetIndexBinder.cs @@ -33,7 +33,7 @@ namespace Microsoft.CSharp.RuntimeBinder public Type CallingContext { get; } - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -58,7 +58,7 @@ namespace Microsoft.CSharp.RuntimeBinder IsCompoundAssignment = isCompoundAssignment; IsChecked = isChecked; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } @@ -79,6 +79,9 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(indexes, nameof(indexes)); + BinderHelper.ValidateBindArgument(value, nameof(value)); return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, indexes, value), _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetMemberBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetMemberBinder.cs index d33eef09a0..ddf4611e0f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetMemberBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetMemberBinder.cs @@ -31,7 +31,7 @@ namespace Microsoft.CSharp.RuntimeBinder public Type CallingContext { get; } - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -59,7 +59,7 @@ namespace Microsoft.CSharp.RuntimeBinder IsCompoundAssignment = isCompoundAssignment; IsChecked = isChecked; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); + _argumentInfo = BinderHelper.ToArray(argumentInfo); _binder = RuntimeBinder.GetInstance(); } @@ -79,6 +79,8 @@ namespace Microsoft.CSharp.RuntimeBinder return com; } #endif + BinderHelper.ValidateBindArgument(target, nameof(target)); + BinderHelper.ValidateBindArgument(value, nameof(value)); return BinderHelper.Bind(this, _binder, new[] { target, value }, _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpUnaryOperationBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpUnaryOperationBinder.cs index 90e6e7a2f6..2b94e5c122 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpUnaryOperationBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpUnaryOperationBinder.cs @@ -43,7 +43,7 @@ namespace Microsoft.CSharp.RuntimeBinder public Type CallingContext { get; } - private readonly List _argumentInfo; + private readonly CSharpArgumentInfo[] _argumentInfo; CSharpArgumentInfo ICSharpBinder.GetArgumentInfo(int index) => _argumentInfo[index]; @@ -65,8 +65,8 @@ namespace Microsoft.CSharp.RuntimeBinder { IsChecked = isChecked; CallingContext = callingContext; - _argumentInfo = BinderHelper.ToList(argumentInfo); - Debug.Assert(_argumentInfo.Count == 1); + _argumentInfo = BinderHelper.ToArray(argumentInfo); + Debug.Assert(_argumentInfo.Length == 1); _binder = RuntimeBinder.GetInstance(); } @@ -78,6 +78,7 @@ namespace Microsoft.CSharp.RuntimeBinder /// The representing the result of the binding. public override DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { + BinderHelper.ValidateBindArgument(target, nameof(target)); return BinderHelper.Bind(this, _binder, new[] {target}, _argumentInfo, errorSuggestion); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Error.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Error.cs index a2bb697440..0fd09edc81 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Error.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Error.cs @@ -75,5 +75,12 @@ namespace Microsoft.CSharp.RuntimeBinder { return new RuntimeBinderException(SR.BindToVoidMethodButExpectResult); } + + internal static Exception ArgumentNull(string paramName) => new ArgumentNullException(paramName); + + internal static Exception DynamicArgumentNeedsValue(string paramName) => + new ArgumentException(SR.DynamicArgumentNeedsValue, paramName); + + internal static Exception BindingNameCollision() => new RuntimeBinderException(SR.BindingNameCollision); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CController.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CController.cs deleted file mode 100644 index 7db9b945ad..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CController.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Errors -{ - //////////////////////////////////////////////////////////////////////////////// - // - // This is the "controller" for compiler objects. The controller is the object - // that exposes/implements ICSCompiler for external consumption. Compiler - // options are configured through this object, and for an actual compilation, - // this object instantiates a LangCompiler, feeds it the appropriate information, - // tells it to compile, and then destroys it. - - internal abstract class CController - { - private readonly CErrorFactory _errorFactory; - - protected CController() - { - _errorFactory = new CErrorFactory(); - } - - //////////////////////////////////////////////////////////////////////////////// - // - // This function places a fully-constructed CError object into an error container - // and sends it to the compiler host (this would be the place to batch these guys - // up if we decide to. - // - // Note that if the error can't be put into a container (if, for example, we - // can't create a container) the error is destroyed and the host is notified via - // exception. - - public abstract void SubmitError(CError pError); - - public CErrorFactory GetErrorFactory() - { - return _errorFactory; - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CError.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CError.cs deleted file mode 100644 index cb60909c16..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CError.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; - -namespace Microsoft.CSharp.RuntimeBinder.Errors -{ - //////////////////////////////////////////////////////////////////////////////// - // CError - // - // This object is the implementation of ICSError for all compiler errors, - // including lexer, parser, and compiler errors. - - internal sealed class CError - { - private string _text; - - private static string ComputeString(ErrorCode code, string[] args) - { - return string.Format(CultureInfo.InvariantCulture, ErrorFacts.GetMessage(code), args); - } - - public void Initialize(ErrorCode code, string[] args) - { - _text = ComputeString(code, args); - } - - public string Text { get { return _text; } } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CErrorFactory.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CErrorFactory.cs deleted file mode 100644 index 3dd23085e0..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CErrorFactory.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Errors -{ - internal sealed class CErrorFactory - { - public CError CreateError(ErrorCode iErrorIndex, params string[] args) - { - CError output = new CError(); - output.Initialize(iErrorIndex, args); - return output; - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CParameterizedError.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CParameterizedError.cs deleted file mode 100644 index 0bca8fe4d8..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CParameterizedError.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Errors -{ - //////////////////////////////////////////////////////////////////////////////// - // CParameterizedError - // - // This object is the unrealized error that is generated prior to - // becoming a CError. It only has the spans, error number, and parameters. - - internal sealed class CParameterizedError - { - private ErrorCode _errorNumber; - private ErrArg[] _arguments; - - public void Initialize(ErrorCode errorNumber, ErrArg[] arguments) - { - _errorNumber = errorNumber; - _arguments = (ErrArg[])arguments.Clone(); - } - - public int GetParameterCount() - { - return _arguments.Length; - } - - public ErrArg GetParameter(int index) - { - return _arguments[index]; - } - - public ErrorCode GetErrorNumber() - { - return _errorNumber; - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs index ba257895ef..4e6263721d 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs @@ -24,7 +24,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ERR_MethDelegateMismatch = 123, ERR_AssgLvalueExpected = 131, ERR_NoConstructors = 143, - ERR_BadDelegateConstructor = 148, ERR_PropertyLacksGet = 154, ERR_ObjectProhibited = 176, ERR_AssgReadonly = 191, @@ -32,51 +31,33 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ERR_AssgReadonlyStatic = 198, ERR_RefReadonlyStatic = 199, ERR_AssgReadonlyProp = 200, - ERR_AbstractBaseCall = 205, ERR_RefProperty = 206, ERR_UnsafeNeeded = 214, ERR_BadBoolOp = 217, ERR_MustHaveOpTF = 218, ERR_ConstOutOfRangeChecked = 221, ERR_AmbigMember = 229, - ERR_SizeofUnsafe = 233, - ERR_CallingFinalizeDepracated = 245, - ERR_CallingBaseFinalizeDeprecated = 250, ERR_NoImplicitConvCast = 266, ERR_InaccessibleGetter = 271, ERR_InaccessibleSetter = 272, ERR_BadArity = 305, - ERR_BadTypeArgument = 306, ERR_TypeArgsNotAllowed = 307, ERR_HasNoTypeVars = 308, ERR_NewConstraintNotSatisfied = 310, ERR_GenericConstraintNotSatisfiedRefType = 311, ERR_GenericConstraintNotSatisfiedNullableEnum = 312, ERR_GenericConstraintNotSatisfiedNullableInterface = 313, - ERR_GenericConstraintNotSatisfiedTyVar = 314, ERR_GenericConstraintNotSatisfiedValType = 315, - ERR_TypeVarCantBeNull = 403, - ERR_BadRetType = 407, ERR_CantInferMethTypeArgs = 411, - ERR_MethGrpToNonDel = 428, ERR_RefConstraintNotSatisfied = 452, ERR_ValConstraintNotSatisfied = 453, ERR_AmbigUDConv = 457, - ERR_PredefinedTypeNotFound = 518, ERR_BindToBogus = 570, ERR_CantCallSpecialMethod = 571, - ERR_BogusType = 648, - ERR_MissingPredefinedMember = 656, - ERR_LiteralDoubleCast = 664, ERR_ConvertToStaticClass = 716, - ERR_GenericArgIsStaticClass = 718, - ERR_PartialMethodToDelegate = 762, ERR_IncrementLvalueExpected = 1059, - ERR_NoSuchMemberOrExtension = 1061, - ERR_ValueTypeExtDelegate = 1113, ERR_BadArgCount = 1501, ERR_BadArgTypes = 1502, - ERR_BadArgType = 1503, ERR_RefLvalueExpected = 1510, ERR_BadProtectedAccess = 1540, ERR_BindToBogusProp2 = 1545, @@ -86,20 +67,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ERR_AssgReadonlyLocal = 1604, ERR_RefReadonlyLocal = 1605, ERR_ReturnNotLValue = 1612, - ERR_BadArgExtraRef = 1615, - ERR_BadArgRef = 1620, ERR_AssgReadonly2 = 1648, ERR_RefReadonly2 = 1649, ERR_AssgReadonlyStatic2 = 1650, ERR_RefReadonlyStatic2 = 1651, ERR_AssgReadonlyLocalCause = 1656, ERR_RefReadonlyLocalCause = 1657, - ERR_DelegateOnNullable = 1728, ERR_BadCtorArgCount = 1729, - ERR_BadExtensionArgTypes = 1928, - ERR_BadInstanceArgType = 1929, - ERR_BadArgTypesForCollectionAdd = 1950, - ERR_InitializerAddHasParamModifiers = 1954, ERR_NonInvocableMemberCalled = 1955, ERR_NamedArgumentSpecificationBeforeFixedArgument = 5002, ERR_BadNamedArgument = 5003, diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs index bd4f0e5cbe..930ef573c6 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs @@ -68,9 +68,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_NoConstructors: codeStr = SR.NoConstructors; break; - case ErrorCode.ERR_BadDelegateConstructor: - codeStr = SR.BadDelegateConstructor; - break; case ErrorCode.ERR_PropertyLacksGet: codeStr = SR.PropertyLacksGet; break; @@ -92,9 +89,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_AssgReadonlyProp: codeStr = SR.AssgReadonlyProp; break; - case ErrorCode.ERR_AbstractBaseCall: - codeStr = SR.AbstractBaseCall; - break; case ErrorCode.ERR_RefProperty: codeStr = SR.RefProperty; break; @@ -113,15 +107,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_AmbigMember: codeStr = SR.AmbigMember; break; - case ErrorCode.ERR_SizeofUnsafe: - codeStr = SR.SizeofUnsafe; - break; - case ErrorCode.ERR_CallingFinalizeDepracated: - codeStr = SR.CallingFinalizeDepracated; - break; - case ErrorCode.ERR_CallingBaseFinalizeDeprecated: - codeStr = SR.CallingBaseFinalizeDeprecated; - break; case ErrorCode.ERR_NoImplicitConvCast: codeStr = SR.NoImplicitConvCast; break; @@ -134,9 +119,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_BadArity: codeStr = SR.BadArity; break; - case ErrorCode.ERR_BadTypeArgument: - codeStr = SR.BadTypeArgument; - break; case ErrorCode.ERR_TypeArgsNotAllowed: codeStr = SR.TypeArgsNotAllowed; break; @@ -155,24 +137,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_GenericConstraintNotSatisfiedNullableInterface: codeStr = SR.GenericConstraintNotSatisfiedNullableInterface; break; - case ErrorCode.ERR_GenericConstraintNotSatisfiedTyVar: - codeStr = SR.GenericConstraintNotSatisfiedTyVar; - break; case ErrorCode.ERR_GenericConstraintNotSatisfiedValType: codeStr = SR.GenericConstraintNotSatisfiedValType; break; - case ErrorCode.ERR_TypeVarCantBeNull: - codeStr = SR.TypeVarCantBeNull; - break; - case ErrorCode.ERR_BadRetType: - codeStr = SR.BadRetType; - break; case ErrorCode.ERR_CantInferMethTypeArgs: codeStr = SR.CantInferMethTypeArgs; break; - case ErrorCode.ERR_MethGrpToNonDel: - codeStr = SR.MethGrpToNonDel; - break; case ErrorCode.ERR_RefConstraintNotSatisfied: codeStr = SR.RefConstraintNotSatisfied; break; @@ -182,51 +152,24 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_AmbigUDConv: codeStr = SR.AmbigUDConv; break; - case ErrorCode.ERR_PredefinedTypeNotFound: - codeStr = SR.PredefinedTypeNotFound; - break; case ErrorCode.ERR_BindToBogus: codeStr = SR.BindToBogus; break; case ErrorCode.ERR_CantCallSpecialMethod: codeStr = SR.CantCallSpecialMethod; break; - case ErrorCode.ERR_BogusType: - codeStr = SR.BogusType; - break; - case ErrorCode.ERR_MissingPredefinedMember: - codeStr = SR.MissingPredefinedMember; - break; - case ErrorCode.ERR_LiteralDoubleCast: - codeStr = SR.LiteralDoubleCast; - break; case ErrorCode.ERR_ConvertToStaticClass: codeStr = SR.ConvertToStaticClass; break; - case ErrorCode.ERR_GenericArgIsStaticClass: - codeStr = SR.GenericArgIsStaticClass; - break; - case ErrorCode.ERR_PartialMethodToDelegate: - codeStr = SR.PartialMethodToDelegate; - break; case ErrorCode.ERR_IncrementLvalueExpected: codeStr = SR.IncrementLvalueExpected; break; - case ErrorCode.ERR_NoSuchMemberOrExtension: - codeStr = SR.NoSuchMemberOrExtension; - break; - case ErrorCode.ERR_ValueTypeExtDelegate: - codeStr = SR.ValueTypeExtDelegate; - break; case ErrorCode.ERR_BadArgCount: codeStr = SR.BadArgCount; break; case ErrorCode.ERR_BadArgTypes: codeStr = SR.BadArgTypes; break; - case ErrorCode.ERR_BadArgType: - codeStr = SR.BadArgType; - break; case ErrorCode.ERR_RefLvalueExpected: codeStr = SR.RefLvalueExpected; break; @@ -254,12 +197,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_ReturnNotLValue: codeStr = SR.ReturnNotLValue; break; - case ErrorCode.ERR_BadArgExtraRef: - codeStr = SR.BadArgExtraRef; - break; - case ErrorCode.ERR_BadArgRef: - codeStr = SR.BadArgRef; - break; case ErrorCode.ERR_AssgReadonly2: codeStr = SR.AssgReadonly2; break; @@ -278,24 +215,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case ErrorCode.ERR_RefReadonlyLocalCause: codeStr = SR.RefReadonlyLocalCause; break; - case ErrorCode.ERR_DelegateOnNullable: - codeStr = SR.DelegateOnNullable; - break; case ErrorCode.ERR_BadCtorArgCount: codeStr = SR.BadCtorArgCount; break; - case ErrorCode.ERR_BadExtensionArgTypes: - codeStr = SR.BadExtensionArgTypes; - break; - case ErrorCode.ERR_BadInstanceArgType: - codeStr = SR.BadInstanceArgType; - break; - case ErrorCode.ERR_BadArgTypesForCollectionAdd: - codeStr = SR.BadArgTypesForCollectionAdd; - break; - case ErrorCode.ERR_InitializerAddHasParamModifiers: - codeStr = SR.InitializerAddHasParamModifiers; - break; case ErrorCode.ERR_NonInvocableMemberCalled: codeStr = SR.NonInvocableMemberCalled; break; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFmt.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFmt.cs index 7db67f484f..80beda422b 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFmt.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFmt.cs @@ -37,9 +37,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors internal enum ErrArgFlags { None = 0x0000, - Ref = 0x0001, // The arg's location should be included in the error message NoStr = 0x0002, // The arg should NOT be included in the error message, just the location - RefOnly = Ref | NoStr, Unique = 0x0004, // The string should be distinct from other args marked with Unique UseGetErrorInfo = 0x0008, } @@ -166,87 +164,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors } } - internal class ErrArgRef : ErrArg - { - protected ErrArgRef() - { - } - - private ErrArgRef(int n) - : base(n) - { - } - - private ErrArgRef(Name name) - : base(name) - { - this.eaf = ErrArgFlags.Ref; - } - - public ErrArgRef(Symbol sym) - : base(sym) - { - this.eaf = ErrArgFlags.Ref; - } - - private ErrArgRef(CType pType) - : base(pType) - { - this.eaf = ErrArgFlags.Ref; - } - - private ErrArgRef(SymWithType swt) - : base(swt) - { - this.eaf = ErrArgFlags.Ref; - } - private ErrArgRef(MethPropWithInst mpwi) - : base(mpwi) - { - this.eaf = ErrArgFlags.Ref; - } - public ErrArgRef(CType pType, ErrArgFlags eaf) - : base(pType) - { - this.eaf = eaf | ErrArgFlags.Ref; - } - public static implicit operator ErrArgRef(Name name) - { - return new ErrArgRef(name); - } - public static implicit operator ErrArgRef(int n) - { - return new ErrArgRef(n); - } - public static implicit operator ErrArgRef(Symbol sym) - { - return new ErrArgRef(sym); - } - public static implicit operator ErrArgRef(CType type) - { - return new ErrArgRef(type); - } - public static implicit operator ErrArgRef(SymWithType swt) - { - return new ErrArgRef(swt); - } - public static implicit operator ErrArgRef(MethPropWithInst mpwi) - { - return new ErrArgRef(mpwi); - } - } - - internal sealed class ErrArgRefOnly : ErrArgRef + internal sealed class ErrArgRefOnly : ErrArg { public ErrArgRefOnly(Symbol sym) : base(sym) { - eaf = ErrArgFlags.RefOnly; + eaf = ErrArgFlags.NoStr; } } // This is used with COMPILER_BASE::ErrorRef to indicate no reference. - internal sealed class ErrArgNoRef : ErrArgRef + internal sealed class ErrArgNoRef : ErrArg { public ErrArgNoRef(CType pType) { @@ -256,7 +184,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors } } - internal sealed class ErrArgIds : ErrArgRef + internal sealed class ErrArgIds : ErrArg { public ErrArgIds(MessageID ids) { @@ -266,27 +194,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors } } - internal sealed class ErrArgSymKind : ErrArgRef + internal sealed class ErrArgSymKind : ErrArg { public ErrArgSymKind(Symbol sym) { eak = ErrArgKind.SymKind; eaf = ErrArgFlags.None; sk = sym.getKind(); - if (sk == SYMKIND.SK_AssemblyQualifiedNamespaceSymbol) - { - if (!string.IsNullOrEmpty(sym.AsAssemblyQualifiedNamespaceSymbol().GetNS().name.Text)) - { - // Non-empty namespace name means it's not the root - // so treat it like a namespace instead of an alias - sk = SYMKIND.SK_NamespaceSymbol; - } - else - { - // An empty namespace name means it's just an alias for the root - sk = SYMKIND.SK_ExternalAliasDefinitionSymbol; - } - } } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorHandling.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorHandling.cs index 38b619ab3d..ded6351a7f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorHandling.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorHandling.cs @@ -9,114 +9,35 @@ using Microsoft.CSharp.RuntimeBinder.Semantics; namespace Microsoft.CSharp.RuntimeBinder.Errors { - // Collection of error reporting code. This class contains among other things ptrs to - // interfaces for constructing error locations (EE doesn't need locations), submitting errors - // (EE and compiler have different destinations), and error construction (again EE and - // compiler differ). Further decoupling would be enabled if the construction of substitution - // strings (the values that replace the placeholders in resource-defined error strings) were - // done at the location in which the error is detected. Right now an ErrArg is constructed - // and later is used to construct a string. I can't see any reason why the string creation - // must be deferred, thus causing the error formatting/reporting subsystem to understand a - // whole host of types, many of which may not be relevant to the EE. - internal sealed class ErrorHandling { - private readonly IErrorSink _errorSink; private readonly UserStringBuilder _userStringBuilder; - private readonly CErrorFactory _errorFactory; - // By default these DO NOT add related locations. To add a related location, pass an ErrArgRef. - public void Error(ErrorCode id, params ErrArg[] args) + public ErrorHandling(GlobalSymbolContext globalSymbols) { - ErrorTreeArgs(id, args); + _userStringBuilder = new UserStringBuilder(globalSymbols); } - // By default these DO add related locations. - public void ErrorRef(ErrorCode id, params ErrArgRef[] args) + public RuntimeBinderException Error(ErrorCode id, params ErrArg[] args) { - ErrorTreeArgs(id, args); - } - - //////////////////////////////////////////////////////////////////////////////// - // - // This function submits the given error to the controller, and if it's a fatal - // error, throws the fatal exception. - - public void SubmitError(CParameterizedError error) - { - _errorSink?.SubmitError(error); - } - - private void MakeErrorLocArgs(out CParameterizedError error, ErrorCode id, ErrArg[] prgarg) - { - error = new CParameterizedError(); - error.Initialize(id, prgarg); - } - - public void AddRelatedSymLoc(CParameterizedError err, Symbol sym) - { - } - - public void AddRelatedTypeLoc(CParameterizedError err, CType pType) - { - } - - private void MakeErrorTreeArgs(out CParameterizedError error, ErrorCode id, ErrArg[] prgarg) - { - MakeErrorLocArgs(out error, id, prgarg); - } - - // By default these DO NOT add related locations. To add a related location, pass an ErrArgRef. - - public void MakeError(out CParameterizedError error, ErrorCode id, params ErrArg[] args) - { - MakeErrorTreeArgs(out error, id, args); - } - - public ErrorHandling( - UserStringBuilder strBldr, - IErrorSink sink, - CErrorFactory factory) - { - Debug.Assert(factory != null); - - _userStringBuilder = strBldr; - _errorSink = sink; - _errorFactory = factory; - } - - private CError CreateError(ErrorCode iErrorIndex, string[] args) - { - return _errorFactory.CreateError(iErrorIndex, args); - } - private void ErrorTreeArgs(ErrorCode id, ErrArg[] prgarg) - { - CParameterizedError error; - MakeErrorTreeArgs(out error, id, prgarg); - SubmitError(error); - } - - public CError RealizeError(CParameterizedError parameterizedError) - { - // Create an arg array manually using the type information in the ErrArgs. - string[] prgpsz = new string[parameterizedError.GetParameterCount()]; - int[] prgiarg = new int[parameterizedError.GetParameterCount()]; + // Create an argument array manually using the type information in the ErrArgs. + string[] prgpsz = new string[args.Length]; + int[] prgiarg = new int[args.Length]; int ppsz = 0; int piarg = 0; int cargUnique = 0; - for (int iarg = 0; iarg < parameterizedError.GetParameterCount(); iarg++) + for (int iarg = 0; iarg < args.Length; iarg++) { - ErrArg arg = parameterizedError.GetParameter(iarg); + ErrArg arg = args[iarg]; // If the NoStr bit is set we don't add it to prgpsz. if (0 != (arg.eaf & ErrArgFlags.NoStr)) continue; - bool fUserStrings = false; - if (!_userStringBuilder.ErrArgToString(out prgpsz[ppsz], arg, out fUserStrings)) + if (!_userStringBuilder.ErrArgToString(out prgpsz[ppsz], arg, out bool fUserStrings)) { if (arg.eak == ErrArgKind.Int) { @@ -152,7 +73,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors if (prgiarg[i] < 0 || prgpszNew[i] != prgpsz[i]) continue; - ErrArg arg = parameterizedError.GetParameter(prgiarg[i]); + ErrArg arg = args[prgiarg[i]]; Debug.Assert(0 != (arg.eaf & ErrArgFlags.Unique) && 0 == (arg.eaf & ErrArgFlags.NoStr)); Symbol sym = null; @@ -183,7 +104,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors { if (prgiarg[j] < 0) continue; - Debug.Assert(0 != (parameterizedError.GetParameter(prgiarg[j]).eaf & ErrArgFlags.Unique)); + Debug.Assert(0 != (args[prgiarg[j]].eaf & ErrArgFlags.Unique)); if (prgpsz[i] != prgpsz[j]) continue; @@ -196,7 +117,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors continue; } - ErrArg arg2 = parameterizedError.GetParameter(prgiarg[j]); + ErrArg arg2 = args[prgiarg[j]]; Debug.Assert(0 != (arg2.eaf & ErrArgFlags.Unique) && 0 == (arg2.eaf & ErrArgFlags.NoStr)); Symbol sym2 = null; @@ -239,8 +160,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors prgpsz = prgpszNew; } - CError err = CreateError(parameterizedError.GetErrorNumber(), prgpsz); - return err; + return new RuntimeBinderException(string.Format(CultureInfo.InvariantCulture, ErrorFacts.GetMessage(id), prgpsz)); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/IErrorSink.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/IErrorSink.cs deleted file mode 100644 index d2c2056b6d..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/IErrorSink.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Errors -{ - // This interface is used to decouple the error reporting - // implementation from the error detection source. - internal interface IErrorSink - { - void SubmitError(CParameterizedError error); - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/UserStringBuilder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/UserStringBuilder.cs index 6d03d6b5f8..0c9b94e586 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/UserStringBuilder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/UserStringBuilder.cs @@ -68,10 +68,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case SYMKIND.SK_TypeParameterSymbol: id = MessageID.SK_TYVAR; break; - case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: - Debug.Assert(false, "Illegal sk"); - id = MessageID.SK_ALIAS; - break; default: Debug.Assert(false, "impossible sk"); id = MessageID.SK_UNKNOWN; @@ -154,31 +150,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendParentCore(sym.parent, pctx); } - private void ErrAppendParentType(CType pType, SubstContext pctx) - { - if (pType.IsErrorType()) - { - if (pType.AsErrorType().HasTypeParent()) - { - ErrAppendType(pType.AsErrorType().GetTypeParent(), null); - ErrAppendChar('.'); - } - else - { - ErrAppendParentCore(pType.AsErrorType().GetNSParent(), pctx); - } - } - else if (pType.IsAggregateType()) - { - ErrAppendParentCore(pType.AsAggregateType().GetOwningAggregate(), pctx); - } - else if (pType.GetBaseOrParameterOrElementType() != null) - { - ErrAppendType(pType.GetBaseOrParameterOrElementType(), null); - ErrAppendChar('.'); - } - } - private void ErrAppendParentCore(Symbol parent, SubstContext pctx) { if (null == parent) @@ -187,9 +158,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors if (parent == getBSymmgr().GetRootNS()) return; - if (pctx != null && !pctx.FNop() && parent.IsAggregateSymbol() && 0 != parent.AsAggregateSymbol().GetTypeVarsAll().Count) + if (pctx != null && !pctx.FNop() && parent is AggregateSymbol agg && 0 != agg.GetTypeVarsAll().Count) { - CType pType = GetTypeManager().SubstType(parent.AsAggregateSymbol().getThisType(), pctx); + CType pType = GetTypeManager().SubstType(agg.getThisType(), pctx); ErrAppendType(pType, null); } else @@ -221,7 +192,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendParentSym(meth, pctx); // Get the type args from the explicit impl type and substitute using pctx (if there is one). - SubstContext ctx = new SubstContext(GetTypeManager().SubstType(meth.swtSlot.GetType(), pctx).AsAggregateType()); + SubstContext ctx = new SubstContext(GetTypeManager().SubstType(meth.swtSlot.GetType(), pctx) as AggregateType); ErrAppendSym(meth.swtSlot.Sym, ctx, fArgs); // args already added @@ -236,13 +207,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendSym(prop, pctx); // add accessor name - if (prop.methGet == meth) + if (prop.GetterMethod == meth) { ErrAppendString(".get"); } else { - Debug.Assert(meth == prop.methSet); + Debug.Assert(meth == prop.SetterMethod); ErrAppendString(".set"); } @@ -299,32 +270,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors // handle user defined operators // map from CLS predefined names to "operator " ErrAppendString("operator "); - - // - // This is kinda slow, but the alternative is to add bits to methsym. - // - string operatorName; - OperatorKind op = Operators.OperatorOfMethodName(meth.name); - if (Operators.HasDisplayName(op)) - { - operatorName = Operators.GetDisplayName(op); - } - else - { - // - // either equals or compare - // - if (meth.name == NameManager.GetPredefinedName(PredefinedName.PN_OPEQUALS)) - { - operatorName = "equals"; - } - else - { - Debug.Assert(meth.name == NameManager.GetPredefinedName(PredefinedName.PN_OPCOMPARE)); - operatorName = "compare"; - } - } - ErrAppendString(operatorName); + ErrAppendString(Operators.OperatorOfMethodName(meth.name)); } else if (meth.IsExpImpl()) { @@ -347,14 +293,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors // append argument types ErrAppendChar('('); - if (!meth.computeCurrentBogusState()) - { - ErrAppendParamList(GetTypeManager().SubstTypeArray(meth.Params, pctx), meth.isVarargs, meth.isParamArray); - } + ErrAppendParamList(GetTypeManager().SubstTypeArray(meth.Params, pctx), meth.isVarargs, meth.isParamArray); ErrAppendChar(')'); } } + private void ErrAppendIndexer(IndexerSymbol indexer, SubstContext pctx) { ErrAppendString("this["); @@ -366,22 +310,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendParentSym(prop, pctx); if (prop.IsExpImpl() && prop.swtSlot.Sym != null) { - SubstContext ctx = new SubstContext(GetTypeManager().SubstType(prop.swtSlot.GetType(), pctx).AsAggregateType()); + SubstContext ctx = new SubstContext(GetTypeManager().SubstType(prop.swtSlot.GetType(), pctx) as AggregateType); ErrAppendSym(prop.swtSlot.Sym, ctx); } else if (prop.IsExpImpl()) { if (prop.errExpImpl != null) ErrAppendType(prop.errExpImpl, pctx, false); - if (prop.isIndexer()) + if (prop is IndexerSymbol indexer) { ErrAppendChar('.'); - ErrAppendIndexer(prop.AsIndexerSymbol(), pctx); + ErrAppendIndexer(indexer, pctx); } } - else if (prop.isIndexer()) + else if (prop is IndexerSymbol indexer) { - ErrAppendIndexer(prop.AsIndexerSymbol(), pctx); + ErrAppendIndexer(indexer, pctx); } else { @@ -413,14 +357,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors switch (sym.getKind()) { case SYMKIND.SK_AggregateDeclaration: - ErrAppendSym(sym.AsAggregateDeclaration().Agg(), pctx); + ErrAppendSym(((AggregateDeclaration)sym).Agg(), pctx); break; case SYMKIND.SK_AggregateSymbol: { // Check for a predefined class with a special "nice" name for // error reported. - string text = PredefinedTypes.GetNiceName(sym.AsAggregateSymbol()); + string text = PredefinedTypes.GetNiceName(sym as AggregateSymbol); if (text != null) { // Found a nice name. @@ -430,21 +374,21 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors { ErrAppendParentSym(sym, pctx); ErrAppendName(sym.name); - ErrAppendTypeParameters(sym.AsAggregateSymbol().GetTypeVars(), pctx, true); + ErrAppendTypeParameters(((AggregateSymbol)sym).GetTypeVars(), pctx, true); } break; } case SYMKIND.SK_MethodSymbol: - ErrAppendMethod(sym.AsMethodSymbol(), pctx, fArgs); + ErrAppendMethod((MethodSymbol)sym, pctx, fArgs); break; case SYMKIND.SK_PropertySymbol: - ErrAppendProperty(sym.AsPropertySymbol(), pctx); + ErrAppendProperty((PropertySymbol)sym, pctx); break; case SYMKIND.SK_EventSymbol: - ErrAppendEvent(sym.AsEventSymbol(), pctx); + ErrAppendEvent((EventSymbol)sym, pctx); break; case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: @@ -468,11 +412,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case SYMKIND.SK_TypeParameterSymbol: if (null == sym.name) { + var parSym = (TypeParameterSymbol)sym; // It's a standard type variable. - if (sym.AsTypeParameterSymbol().IsMethodTypeParameter()) + if (parSym.IsMethodTypeParameter()) ErrAppendChar('!'); ErrAppendChar('!'); - ErrAppendPrintf("{0}", sym.AsTypeParameterSymbol().GetIndexInTotalParameters()); + ErrAppendPrintf("{0}", parSym.GetIndexInTotalParameters()); } else ErrAppendName(sym.name); @@ -483,8 +428,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendName(sym.name); break; - case SYMKIND.SK_Scope: - case SYMKIND.SK_LambdaScope: default: // Shouldn't happen. Debug.Assert(false, $"Bad symbol kind: {sym.getKind()}"); @@ -513,7 +456,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors { case TypeKind.TK_AggregateType: { - AggregateType pAggType = pType.AsAggregateType(); + AggregateType pAggType = (AggregateType)pType; // Check for a predefined class with a special "nice" name for // error reported. @@ -544,13 +487,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case TypeKind.TK_TypeParameterType: if (null == pType.GetName()) { + var tpType = (TypeParameterType)pType; // It's a standard type variable. - if (pType.AsTypeParameterType().IsMethodTypeParameter()) + if (tpType.IsMethodTypeParameter()) { ErrAppendChar('!'); } ErrAppendChar('!'); - ErrAppendPrintf("{0}", pType.AsTypeParameterType().GetIndexInTotalParameters()); + ErrAppendPrintf("{0}", tpType.GetIndexInTotalParameters()); } else { @@ -559,17 +503,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors break; case TypeKind.TK_ErrorType: - if (pType.AsErrorType().HasParent()) + ErrorType err = (ErrorType)pType; + if (err.HasParent) { - Debug.Assert(pType.AsErrorType().nameText != null && pType.AsErrorType().typeArgs != null); - ErrAppendParentType(pType, pctx); - ErrAppendName(pType.AsErrorType().nameText); - ErrAppendTypeParameters(pType.AsErrorType().typeArgs, pctx, true); + Debug.Assert(err.nameText != null && err.typeArgs != null); + ErrAppendName(err.nameText); + ErrAppendTypeParameters(err.typeArgs, pctx, true); } else { // Load the string "". - Debug.Assert(null == pType.AsErrorType().typeArgs); + Debug.Assert(null == err.typeArgs); ErrAppendId(MessageID.ERRORSYM); } break; @@ -579,18 +523,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendId(MessageID.NULL); break; - case TypeKind.TK_OpenTypePlaceholderType: - // Leave blank. - break; - - case TypeKind.TK_BoundLambdaType: - ErrAppendId(MessageID.AnonMethod); - break; - - case TypeKind.TK_UnboundLambdaType: - ErrAppendId(MessageID.Lambda); - break; - case TypeKind.TK_MethodGroupType: ErrAppendId(MessageID.MethodGroup); break; @@ -601,7 +533,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors case TypeKind.TK_ArrayType: { - CType elementType = pType.AsArrayType().GetBaseElementType(); + CType elementType = ((ArrayType)pType).GetBaseElementType(); if (null == elementType) { @@ -612,10 +544,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors ErrAppendType(elementType, pctx); for (elementType = pType; - elementType != null && elementType.IsArrayType(); - elementType = elementType.AsArrayType().GetElementType()) + elementType is ArrayType arrType; + elementType = arrType.GetElementType()) { - int rank = elementType.AsArrayType().rank; + int rank = arrType.rank; // Add [] with (rank-1) commas inside ErrAppendChar('['); @@ -623,7 +555,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors // known rank. if (rank == 1) { - if (!elementType.AsArrayType().IsSZArray) + if (!arrType.IsSZArray) { ErrAppendChar('*'); } @@ -646,16 +578,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors break; case TypeKind.TK_ParameterModifierType: + ParameterModifierType mod = (ParameterModifierType)pType; // add ref or out - ErrAppendString(pType.AsParameterModifierType().isOut ? "out " : "ref "); + ErrAppendString(mod.isOut ? "out " : "ref "); // add base type name - ErrAppendType(pType.AsParameterModifierType().GetParameterType(), pctx); + ErrAppendType(mod.GetParameterType(), pctx); break; case TypeKind.TK_PointerType: // Generate the base type. - ErrAppendType(pType.AsPointerType().GetReferentType(), pctx); + ErrAppendType(((PointerType)pType).GetReferentType(), pctx); { // add the trailing * ErrAppendChar('*'); @@ -663,11 +596,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Errors break; case TypeKind.TK_NullableType: - ErrAppendType(pType.AsNullableType().GetUnderlyingType(), pctx); + ErrAppendType(((NullableType)pType).GetUnderlyingType(), pctx); ErrAppendChar('?'); break; - case TypeKind.TK_NaturalIntegerType: default: // Shouldn't happen. Debug.Assert(false, "Bad type kind"); diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs index aa8afa5a1b..8f3018d1dd 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs @@ -90,7 +90,7 @@ namespace Microsoft.CSharp.RuntimeBinder protected override Expr VisitCALL(ExprCall pExpr) { - if (pExpr.PredefinedMethod == PREDEFMETH.PM_FIRST) + if (pExpr.PredefinedMethod == PREDEFMETH.PM_COUNT) { return pExpr; } @@ -683,7 +683,7 @@ namespace Microsoft.CSharp.RuntimeBinder } else if (pExpr is ExprConstant) { - Debug.Assert(pExpr.Type.IsNullType()); + Debug.Assert(pExpr.Type is NullType); return null; } else @@ -893,7 +893,7 @@ namespace Microsoft.CSharp.RuntimeBinder CType underlyingType = pExpr.Type; object objval; - if (pExpr.Type.IsNullType()) + if (pExpr.Type is NullType) { return null; } @@ -956,10 +956,7 @@ namespace Microsoft.CSharp.RuntimeBinder } else if (pExpr is ExprZeroInit zeroInit) { - if ((pExpr = zeroInit.OptionalArgument) == null) - { - return Activator.CreateInstance(zeroInit.Type.AssociatedSystemType); - } + return Activator.CreateInstance(zeroInit.Type.AssociatedSystemType); } else { diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ICSharpInvokeOrInvokeMemberBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ICSharpInvokeOrInvokeMemberBinder.cs index f9574b0388..fb8751e480 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ICSharpInvokeOrInvokeMemberBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ICSharpInvokeOrInvokeMemberBinder.cs @@ -15,6 +15,6 @@ namespace Microsoft.CSharp.RuntimeBinder // Members. CSharpCallFlags Flags { get; } - IList TypeArguments { get; } + Type[] TypeArguments { get; } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs index a623bfc0bf..86325352dd 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs @@ -32,11 +32,11 @@ namespace Microsoft.CSharp.RuntimeBinder private SymbolTable _symbolTable; private CSemanticChecker _semanticChecker; - private SymbolLoader SymbolLoader { get { return _semanticChecker.GetSymbolLoader(); } } + private SymbolLoader SymbolLoader => _semanticChecker.SymbolLoader; + private ExprFactory _exprFactory; private BindingContext _bindingContext; private ExpressionBinder _binder; - private RuntimeBinderController _controller; private readonly object _bindLock = new object(); @@ -51,8 +51,7 @@ namespace Microsoft.CSharp.RuntimeBinder private void Reset() { - _controller = new RuntimeBinderController(); - _semanticChecker = new LangCompiler(_controller, new NameManager()); + _semanticChecker = new CSemanticChecker(); BSYMMGR bsymmgr = _semanticChecker.getBSymmgr(); NameManager nameManager = _semanticChecker.GetNameManager(); @@ -69,7 +68,7 @@ namespace Microsoft.CSharp.RuntimeBinder SymbolLoader.getPredefinedMembers().RuntimeBinderSymbolTable = _symbolTable; SymbolLoader.SetSymbolTable(_symbolTable); - _exprFactory = new ExprFactory(_semanticChecker.GetSymbolLoader().GetGlobalSymbolContext()); + _exprFactory = new ExprFactory(_semanticChecker.SymbolLoader.GetGlobalSymbolContext()); _bindingContext = new BindingContext(_semanticChecker, _exprFactory); _binder = new ExpressionBinder(_bindingContext); } @@ -118,7 +117,7 @@ namespace Microsoft.CSharp.RuntimeBinder // In order to make this work, we have to reset the symbol table and begin // the second binding over again when we detect the collision. So this is // something like a longjmp to the beginning of binding. For a single binding, - // if we have to do this more than once, we give an ICE--this would be a + // if we have to do this more than once, we give an RBE--this would be a // scenario that needs to know about both N.T's simultaneously to work. // See SymbolTable.LoadSymbolsFromType for more information. @@ -137,8 +136,7 @@ namespace Microsoft.CSharp.RuntimeBinder catch (ResetBindException) { Reset(); - Debug.Assert(false, "More than one symbol table name collision in a single binding"); - throw Error.InternalCompilerError(); + throw Error.BindingNameCollision(); } } } @@ -185,7 +183,7 @@ namespace Microsoft.CSharp.RuntimeBinder // Linq expression tree for the whole thing and return it. // (1) - Create the locals - Scope pScope = _semanticChecker.GetGlobalMiscSymFactory().CreateScope(null); + Scope pScope = _semanticChecker.GetGlobalSymbolFactory().CreateScope(null); LocalVariableSymbol[] locals = PopulateLocalScope(payload, pScope, arguments, parameters); // (1.5) - Check to see if we need to defer. @@ -225,7 +223,7 @@ namespace Microsoft.CSharp.RuntimeBinder CSharpInvokeMemberBinder callPayload = payload as CSharpInvokeMemberBinder; if (callPayload != null) { - int arity = callPayload.TypeArguments?.Count ?? 0; + int arity = callPayload.TypeArguments?.Length ?? 0; MemberLookup mem = new MemberLookup(); Expr callingObject = CreateCallingObjectForCall(callPayload, arguments, locals); @@ -270,7 +268,7 @@ namespace Microsoft.CSharp.RuntimeBinder if (t != null) { - AggregateSymbol agg = _symbolTable.GetCTypeFromType(t).AsAggregateType().GetOwningAggregate(); + AggregateSymbol agg = ((AggregateType)_symbolTable.GetCTypeFromType(t)).GetOwningAggregate(); bindingContext.ContextForMemberLookup = _semanticChecker.GetGlobalSymbolFactory().CreateAggregateDecl(agg, null); } else @@ -475,7 +473,7 @@ namespace Microsoft.CSharp.RuntimeBinder { // We don't actually need the real delegate type here - we just need SOME delegate type. // This is because we never attempt any conversions on the lambda itself. - AggregateType delegateType = _symbolTable.GetCTypeFromType(typeof(Func<>)).AsAggregateType(); + AggregateType delegateType = _symbolTable.GetCTypeFromType(typeof(Func<>)) as AggregateType; LocalVariableSymbol thisLocal = _semanticChecker.GetGlobalSymbolFactory().CreateLocalVar(_semanticChecker.GetNameManager().Add("this"), pScope, _symbolTable.GetCTypeFromType(typeof(object))); thisLocal.isThis = true; ExprBoundLambda boundLambda = _exprFactory.CreateAnonymousMethod(delegateType, pScope); @@ -494,10 +492,9 @@ namespace Microsoft.CSharp.RuntimeBinder CType ctype = _symbolTable.GetCTypeFromType(type); if (bIsOut) { - Debug.Assert(ctype.IsParameterModifierType()); - ctype = _semanticChecker.GetTypeManager().GetParameterModifier( - ctype.AsParameterModifierType().GetParameterType(), - true); + Debug.Assert(ctype is ParameterModifierType); + ctype = _semanticChecker.GetTypeManager() + .GetParameterModifier(((ParameterModifierType)ctype).GetParameterType(), true); } // If we can convert, do that. If not, cast it. @@ -617,40 +614,39 @@ namespace Microsoft.CSharp.RuntimeBinder private ExprMemberGroup CreateMemberGroupEXPR( string Name, - IList typeArguments, + Type[] typeArguments, Expr callingObject, SYMKIND kind) { Name name = _semanticChecker.GetNameManager().Add(Name); AggregateType callingType; - if (callingObject.Type.IsArrayType()) + CType callingObjectType = callingObject.Type; + if (callingObjectType is ArrayType) { - callingType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_ARRAY); + callingType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_ARRAY); } - else if (callingObject.Type.IsNullableType()) + else if (callingObjectType is NullableType callingNub) { - callingType = callingObject.Type.AsNullableType().GetAts(_semanticChecker.GetSymbolLoader().GetErrorContext()); - } - else if (callingObject.Type.IsAggregateType()) - { - callingType = callingObject.Type.AsAggregateType(); + callingType = callingNub.GetAts(); } else { - callingType = null; - Debug.Assert(false, "MemberGroup on non-array, non-aggregate"); + callingType = (AggregateType)callingObjectType; } - List callingTypes = new List(); - // The C# binder expects that only the base virtual method is inserted // into the list of candidates, and only the type containing the base // virtual method is inserted into the list of types. However, since we // don't want to do all the logic, we're just going to insert every type // that has a member of the given name, and allow the C# binder to filter // out all overrides. - // + + // CONSIDER: using a hashset to filter out duplicate interface types. + // Adopt a smarter algorithm to filter types before creating the exception. + HashSet distinctCallingTypes = new HashSet(); + List callingTypes = new List(); + // Find that set of types now. symbmask_t mask = symbmask_t.MASK_MethodSymbol; switch (kind) @@ -671,7 +667,7 @@ namespace Microsoft.CSharp.RuntimeBinder bool bIsConstructor = name == NameManager.GetPredefinedName(PredefinedName.PN_CTOR); foreach(AggregateType t in callingType.TypeHierarchy) { - if (_symbolTable.AggregateContainsMethod(t.GetOwningAggregate(), Name, mask)) + if (_symbolTable.AggregateContainsMethod(t.GetOwningAggregate(), Name, mask) && distinctCallingTypes.Add(t)) { callingTypes.Add(t); } @@ -689,13 +685,9 @@ namespace Microsoft.CSharp.RuntimeBinder { TypeArray collectioniFaces = callingType.GetWinRTCollectionIfacesAll(SymbolLoader); - for (int i = 0; i < collectioniFaces.Count; i++) + foreach (AggregateType t in callingType.GetWinRTCollectionIfacesAll(SymbolLoader).Items) { - CType t = collectioniFaces[i]; - // Collection interfaces will be aggregates. - Debug.Assert(t.IsAggregateType()); - - if (_symbolTable.AggregateContainsMethod(t.AsAggregateType().GetOwningAggregate(), Name, mask)) + if (_symbolTable.AggregateContainsMethod(t.GetOwningAggregate(), Name, mask) && distinctCallingTypes.Add(t)) { callingTypes.Add(t); } @@ -722,7 +714,7 @@ namespace Microsoft.CSharp.RuntimeBinder } TypeArray typeArgumentsAsTypeArray = BSYMMGR.EmptyTypeArray(); - if (typeArguments != null && typeArguments.Count > 0) + if (typeArguments != null && typeArguments.Length > 0) { typeArgumentsAsTypeArray = _semanticChecker.getBSymmgr().AllocParams( _symbolTable.GetCTypeArrayFromTypes(typeArguments)); @@ -777,7 +769,7 @@ namespace Microsoft.CSharp.RuntimeBinder private Expr CreateArray(Expr callingObject, Expr optionalIndexerArguments) { - return _binder.BindArrayIndexCore(0, callingObject, optionalIndexerArguments); + return _binder.BindArrayIndexCore(callingObject, optionalIndexerArguments); } ///////////////////////////////////////////////////////////////////////////////// @@ -799,14 +791,6 @@ namespace Microsoft.CSharp.RuntimeBinder ///////////////////////////////////////////////////////////////////////////////// - private ExprEvent CreateEvent( - SymWithType swt, - Expr callingObject) - { - EventSymbol eventSymbol = swt.Event(); - ExprEvent e = _exprFactory.CreateEvent(eventSymbol.type, callingObject, new EventWithType(eventSymbol, swt.GetType())); - return e; - } #endregion #endregion @@ -863,7 +847,7 @@ namespace Microsoft.CSharp.RuntimeBinder throw Error.BindInvokeFailedNonDelegate(); } - int arity = payload.TypeArguments?.Count ?? 0; + int arity = payload.TypeArguments?.Length ?? 0; MemberLookup mem = new MemberLookup(); Debug.Assert(_bindingContext.ContextForMemberLookup != null); @@ -877,8 +861,7 @@ namespace Microsoft.CSharp.RuntimeBinder true); if (swt == null) { - mem.ReportErrors(); - Debug.Assert(false, "Why didn't member lookup report an error?"); + throw mem.ReportErrors(); } if (swt.Sym.getKind() != SYMKIND.SK_MethodSymbol) @@ -920,8 +903,7 @@ namespace Microsoft.CSharp.RuntimeBinder true); if (swtEvent == null) { - mem.ReportErrors(); - Debug.Assert(false, "Why didn't member lookup report an error?"); + throw mem.ReportErrors(); } CType eventCType = null; @@ -956,8 +938,8 @@ namespace Microsoft.CSharp.RuntimeBinder // Check if we have a potential call to an indexed property accessor. // If so, we'll flag overload resolution to let us call non-callables. - if ((payload.Name.StartsWith("set_", StringComparison.Ordinal) && swt.Sym.AsMethodSymbol().Params.Count > 1) || - (payload.Name.StartsWith("get_", StringComparison.Ordinal) && swt.Sym.AsMethodSymbol().Params.Count > 0)) + if ((payload.Name.StartsWith("set_", StringComparison.Ordinal) && ((MethodSymbol)swt.Sym).Params.Count > 1) || + (payload.Name.StartsWith("get_", StringComparison.Ordinal) && ((MethodSymbol)swt.Sym).Params.Count > 0)) { memGroup.Flags &= ~EXPRFLAG.EXF_USERCALLABLE; } @@ -1019,7 +1001,7 @@ namespace Microsoft.CSharp.RuntimeBinder Type windowsRuntimeMarshalType = SymbolTable.WindowsRuntimeMarshalType; _symbolTable.PopulateSymbolTableWithName(methodName, new List { evtType }, windowsRuntimeMarshalType); ExprClass marshalClass = _exprFactory.CreateClass(_symbolTable.GetCTypeFromType(windowsRuntimeMarshalType)); - ExprMemberGroup addEventGrp = CreateMemberGroupEXPR(methodName, new List { evtType }, marshalClass, SYMKIND.SK_MethodSymbol); + ExprMemberGroup addEventGrp = CreateMemberGroupEXPR(methodName, new [] { evtType }, marshalClass, SYMKIND.SK_MethodSymbol); Expr expr = _binder.BindMethodGroupToArguments( BindingFlag.BIND_RVALUEREQUIRED | BindingFlag.BIND_STMTEXPRONLY, addEventGrp, @@ -1190,7 +1172,7 @@ namespace Microsoft.CSharp.RuntimeBinder { // For true and false, we try to convert to bool first. If that // doesn't work, then we look for user defined operators. - Expr result = _binder.tryConvert(arg1, SymbolLoader.GetReqPredefType(PredefinedType.PT_BOOL)); + Expr result = _binder.tryConvert(arg1, SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL)); if (result != null && op == OperatorKind.OP_FALSE) { // If we can convert to bool, we need to negate the thing if we're looking for false. @@ -1207,7 +1189,7 @@ namespace Microsoft.CSharp.RuntimeBinder // the error. if (result == null) { - result = _binder.mustConvert(arg1, SymbolLoader.GetReqPredefType(PredefinedType.PT_BOOL)); + result = _binder.mustConvert(arg1, SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL)); } return result; } @@ -1348,8 +1330,7 @@ namespace Microsoft.CSharp.RuntimeBinder ICSharpBinder payload, ArgumentObject argument, LocalVariableSymbol local, - Expr optionalIndexerArguments, - bool fEventsPermitted) + Expr optionalIndexerArguments) { // If our argument is a static type, then we're calling a static property. Expr callingObject = argument.Info.IsStaticType ? @@ -1379,18 +1360,19 @@ namespace Microsoft.CSharp.RuntimeBinder int numIndexArguments = ExpressionIterator.Count(optionalIndexerArguments); // We could have an array access here. See if its just an array. Type type = argument.Type; - if (type.IsArray || type == typeof(string)) + Debug.Assert(type != typeof(string)); + if (type.IsArray) { if (type.IsArray && type.GetArrayRank() != numIndexArguments) { - _semanticChecker.GetErrorContext().Error(ErrorCode.ERR_BadIndexCount, type.GetArrayRank()); + throw _semanticChecker.ErrorContext.Error(ErrorCode.ERR_BadIndexCount, type.GetArrayRank()); } - + + Debug.Assert(callingObject.Type is ArrayType); return CreateArray(callingObject, optionalIndexerArguments); } } - mem.ReportErrors(); - Debug.Assert(false, "Why didn't member lookup report an error?"); + throw mem.ReportErrors(); } switch (swt.Sym.getKind()) @@ -1414,14 +1396,7 @@ namespace Microsoft.CSharp.RuntimeBinder return CreateField(swt, callingObject); case SYMKIND.SK_EventSymbol: - if (fEventsPermitted) - { - return CreateEvent(swt, callingObject); - } - else - { - throw Error.BindPropertyFailedEvent(name); - } + throw Error.BindPropertyFailedEvent(name); default: Debug.Assert(false, "Unexpected type returned from lookup"); @@ -1460,12 +1435,7 @@ namespace Microsoft.CSharp.RuntimeBinder // user defined conversions (since the convert is guaranteed to return one of // the primitive types), and we check for overflow since we don't want truncation. - CType pDestType = _binder.chooseArrayIndexType(argument); - if (null == pDestType) - { - pDestType = SymbolLoader.GetReqPredefType(PredefinedType.PT_INT); - } - + CType pDestType = _binder.ChooseArrayIndexType(argument); return _binder.mustCast( _binder.mustConvert(argument, pDestType), destinationType, @@ -1525,7 +1495,7 @@ namespace Microsoft.CSharp.RuntimeBinder bIsCompound = (payload as CSharpSetMemberBinder).IsCompoundAssignment; } _symbolTable.PopulateSymbolTableWithName(name, null, arguments[0].Type); - Expr lhs = BindProperty(payload, arguments[0], locals[0], indexerArguments, false); + Expr lhs = BindProperty(payload, arguments[0], locals[0], indexerArguments); int indexOfLast = arguments.Length - 1; Expr rhs = CreateArgumentEXPR(arguments[indexOfLast], locals[indexOfLast]); @@ -1552,7 +1522,7 @@ namespace Microsoft.CSharp.RuntimeBinder Expr callingObject = CreateLocal(arguments[0].Type, false, locals[0]); MemberLookup mem = new MemberLookup(); - CType boolType = SymbolLoader.GetReqPredefType(PredefinedType.PT_BOOL); + CType boolType = SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL); bool result = false; if (arguments[0].Value == null) @@ -1570,19 +1540,22 @@ namespace Microsoft.CSharp.RuntimeBinder false, false); - // If lookup returns an actual event, then this is an event. - if (swt != null && swt.Sym.getKind() == SYMKIND.SK_EventSymbol) + if (swt != null) { - result = true; - } + // If lookup returns an actual event, then this is an event. + if (swt.Sym.getKind() == SYMKIND.SK_EventSymbol) + { + result = true; + } - // If lookup returns the backing field of a field-like event, then - // this is an event. This is due to the Dev10 design change around - // the binding of +=, and the fact that the "IsEvent" binding question - // is only ever asked about the LHS of a += or -=. - if (swt != null && swt.Sym.getKind() == SYMKIND.SK_FieldSymbol && swt.Sym.AsFieldSymbol().isEvent) - { - result = true; + // If lookup returns the backing field of a field-like event, then + // this is an event. This is due to the Dev10 design change around + // the binding of +=, and the fact that the "IsEvent" binding question + // is only ever asked about the LHS of a += or -=. + if (swt.Sym is FieldSymbol field && field.isEvent) + { + result = true; + } } return _exprFactory.CreateConstant(boolType, ConstVal.Get(result)); diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderController.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderController.cs deleted file mode 100644 index 2b2a1a7901..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderController.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.CSharp.RuntimeBinder.Errors; - -namespace Microsoft.CSharp.RuntimeBinder -{ - ///////////////////////////////////////////////////////////////////////////////// - // This class merely wraps a controller and throws a runtime binder exception - // whenever we get an error during binding. - - internal sealed class RuntimeBinderController : CController - { - public override void SubmitError(CError pError) - { - throw new RuntimeBinderException(pError.Text); - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderExtensions.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderExtensions.cs index abf386aa7c..53aaf42d98 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderExtensions.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderExtensions.cs @@ -308,5 +308,41 @@ namespace Microsoft.CSharp.RuntimeBinder return mi1.Module.Equals(mi2.Module) && s_MemberEquivalence(mi1, mi2); #endif } + + public static string GetIndexerName(this Type type) + { + Debug.Assert(type != null); + string name = GetTypeIndexerName(type); + if (name == null && type.IsInterface) + { + foreach (Type iface in type.GetInterfaces()) + { + name = GetTypeIndexerName(iface); + if (name != null) + { + break; + } + } + } + + return name; + } + + private static string GetTypeIndexerName(Type type) + { + Debug.Assert(type != null); + string name = type.GetCustomAttribute()?.MemberName; + if (name != null) + { + if (type.GetProperties( + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance) + .Any(p => p.Name == name && p.GetIndexParameters().Length != 0)) + { + return name; + } + } + + return null; + } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpKind.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpKind.cs index 820f8de897..6353784971 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpKind.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpKind.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; + namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal enum BinOpKind @@ -17,6 +19,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Logical, Lim } + + [Flags] internal enum BinOpMask { None = 0, diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpSig.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpSig.cs index e8b37759bc..db41f04f30 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpSig.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpSig.cs @@ -85,8 +85,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics this.grfos = bos.grfos; this.fnkind = bos.fnkind; - _type1 = pt1 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetOptPDT(pt1) : null; - _type2 = pt2 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetOptPDT(pt2) : null; + _type1 = pt1 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetPredefindType(pt1) : null; + _type2 = pt2 != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetPredefindType(pt2) : null; _grflt = LiftFlags.None; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs index cebfcd94e1..565294a4b4 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs @@ -20,22 +20,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private static readonly byte[][] s_betterConversionTable = { // BYTE SHORT INT LONG FLOAT DOUBLE DECIMAL CHAR BOOL SBYTE USHORT UINT ULONG IPTR UIPTR OBJECT - new byte[] /* BYTE*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, - new byte[] /* SHORT*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, - new byte[] /* INT*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0}, - new byte[] /* LONG*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0}, - new byte[] /* FLOAT*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* DOUBLE*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* DECIMAL*/{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* CHAR*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* BOOL*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* SBYTE*/ {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}, - new byte[] /* USHORT*/ {0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, - new byte[] /* UINT*/ {0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, - new byte[] /* ULONG*/ {0, 2, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0}, - new byte[] /* IPTR*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* UIPTR*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - new byte[] /* OBJECT*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + new byte[] /* BYTE*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3}, + new byte[] /* SHORT*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3}, + new byte[] /* INT*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3}, + new byte[] /* LONG*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3}, + new byte[] /* FLOAT*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* DOUBLE*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* DECIMAL*/{3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* CHAR*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* BOOL*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* SBYTE*/ {1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3}, + new byte[] /* USHORT*/ {3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3}, + new byte[] /* UINT*/ {3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3}, + new byte[] /* ULONG*/ {3, 2, 2, 2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3}, + new byte[] /* IPTR*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* UIPTR*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + new byte[] /* OBJECT*/ {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3} }; private BetterType WhichMethodIsBetterTieBreaker( @@ -235,17 +235,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // conversion from Ex to Qx. BetterType betterMethod = BetterType.Neither; - CType type1 = pTypeThrough != null ? pTypeThrough : mpwi1.GetType(); - CType type2 = pTypeThrough != null ? pTypeThrough : mpwi2.GetType(); - MethodOrPropertySymbol methProp1 = GroupToArgsBinder.FindMostDerivedMethod(GetSymbolLoader(), mpwi1.MethProp(), type1); - MethodOrPropertySymbol methProp2 = GroupToArgsBinder.FindMostDerivedMethod(GetSymbolLoader(), mpwi2.MethProp(), type2); - List names1 = methProp1.ParameterNames; - List names2 = methProp2.ParameterNames; - - for (int i = 0; i < args.carg; i++) + int carg = args.carg; + for (int i = 0; i < carg; i++) { Expr arg = args.fHasExprs ? args.prgexpr[i] : null; - CType argType = args.types[i]; CType p1 = pta1[i]; CType p2 = pta2[i]; @@ -256,29 +249,33 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // We need to consider conversions from the actual runtime type // since we could have private interfaces that we are converting - if (arg.RuntimeObjectActualType != null) - { - argType = arg.RuntimeObjectActualType; - } + CType argType = arg?.RuntimeObjectActualType ?? args.types[i]; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // END RUNTIME BINDER ONLY CHANGE // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - BetterType betterConversion = WhichConversionIsBetter(arg, argType, p1, p2); + BetterType betterConversion = WhichConversionIsBetter(argType, p1, p2); - if (betterMethod == BetterType.Right && betterConversion == BetterType.Left) + if (betterMethod == BetterType.Right) { - betterMethod = BetterType.Neither; - break; + if (betterConversion == BetterType.Left) + { + betterMethod = BetterType.Neither; + break; + } } - else if (betterMethod == BetterType.Left && betterConversion == BetterType.Right) + else if (betterMethod == BetterType.Left) { - betterMethod = BetterType.Neither; - break; + if (betterConversion == BetterType.Right) + { + betterMethod = BetterType.Neither; + break; + } } - else if (betterMethod == BetterType.Neither) + else { + Debug.Assert(betterMethod == BetterType.Neither); if (betterConversion == BetterType.Right || betterConversion == BetterType.Left) { betterMethod = betterConversion; @@ -291,11 +288,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // expanded. If so, the one with more parameters wins (ie option beats expanded). if (pta1.Count != pta2.Count && betterMethod == BetterType.Neither) { - if (node1.fExpanded && !node2.fExpanded) + if (node1.fExpanded) { - return BetterType.Right; + if (!node2.fExpanded) + { + return BetterType.Right; + } } - else if (node2.fExpanded && !node1.fExpanded) + else if (node2.fExpanded) { return BetterType.Left; } @@ -304,22 +304,23 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // then we are ambiguous. Otherwise, take the one that didn't need any // optionals. - if (pta1.Count == args.carg) + if (pta1.Count == carg) { return BetterType.Left; } - else if (pta2.Count == args.carg) + + if (pta2.Count == carg) { return BetterType.Right; } + return BetterType.Neither; } return betterMethod; } - private BetterType WhichConversionIsBetter(Expr arg, CType argType, - CType p1, CType p2) + private BetterType WhichConversionIsBetter(CType argType, CType p1, CType p2) { Debug.Assert(argType != null); Debug.Assert(p1 != null); @@ -349,12 +350,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return BetterType.Same; } - return WhichConversionIsBetter(argType, p1, p2); - } - private BetterType WhichConversionIsBetter(CType argType, - CType p1, CType p2) - { // 7.4.2.4 Better conversion from type // // Given a conversion C1 that converts from a type S to a type T1 and a conversion C2 @@ -370,11 +366,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // [Otherwise, see table above for better integral type conversions.] - if (p1 == p2) - { - return BetterType.Same; - } - if (argType == p1) { return BetterType.Left; @@ -388,28 +379,21 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics bool a2b = canConvert(p1, p2); bool b2a = canConvert(p2, p1); - if (a2b && !b2a) + if (a2b != b2a) { - return BetterType.Left; - } - if (b2a && !a2b) - { - return BetterType.Right; + return a2b ? BetterType.Left : BetterType.Right; } - Debug.Assert(b2a == a2b); - - if (p1.isPredefined() && p2.isPredefined() && - p1.getPredefType() <= PredefinedType.PT_OBJECT && p2.getPredefType() <= PredefinedType.PT_OBJECT) + if (p1.isPredefined() && p2.isPredefined()) { - int c = s_betterConversionTable[(int)p1.getPredefType()][(int)p2.getPredefType()]; - if (c == 1) + PredefinedType pt1 = p1.getPredefType(); + if (pt1 <= PredefinedType.PT_OBJECT) { - return BetterType.Left; - } - else if (c == 2) - { - return BetterType.Right; + PredefinedType pt2 = p2.getPredefType(); + if (pt2 <= PredefinedType.PT_OBJECT) + { + return (BetterType)s_betterConversionTable[(int)pt1][(int)pt2]; + } } } @@ -455,64 +439,69 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics CandidateFunctionMember contender = list[i]; Debug.Assert(candidate != contender); - BetterType result = WhichMethodIsBetter(candidate, contender, pTypeThrough, args); - if (result == BetterType.Left) + switch (WhichMethodIsBetter(candidate, contender, pTypeThrough, args)) { - ambiguous = false; - continue; // (meaning m1 is better...) - } - else if (result == BetterType.Right) - { - ambiguous = false; - candidate = contender; - } - else - { - // in case of tie we don't want to bother with the contender who tied... - ambig1 = candidate; - ambig2 = contender; + case BetterType.Left: + ambiguous = false; // (meaning m1 is better...) + break; - i++; - if (i < list.Count) - { - contender = list[i]; + case BetterType.Right: + ambiguous = false; candidate = contender; - } - else - { - ambiguous = true; - } + break; + + default: + + // in case of tie we don't want to bother with the contender who tied... + ambig1 = candidate; + ambig2 = contender; + + i++; + if (i < list.Count) + { + contender = list[i]; + candidate = contender; + } + else + { + ambiguous = true; + } + break; } } - if (ambiguous) - goto AMBIG; - // Now, compare the candidate with items previous to it... - foreach (CandidateFunctionMember contender in list) + if (!ambiguous) { - if (contender == candidate) + // Now, compare the candidate with items previous to it... + foreach (CandidateFunctionMember contender in list) { - // We hit our winner, so its good enough... - methAmbig1 = null; - methAmbig2 = null; - return candidate; + if (contender == candidate) + { + // We hit our winner, so its good enough... + methAmbig1 = null; + methAmbig2 = null; + return candidate; + } + + switch (WhichMethodIsBetter(contender, candidate, pTypeThrough, args)) + { + case BetterType.Right: + + // meaning m2 is better + continue; + case BetterType.Same: + case BetterType.Neither: + ambig1 = candidate; + ambig2 = contender; + break; + } + + break; } - BetterType result = WhichMethodIsBetter(contender, candidate, pTypeThrough, args); - if (result == BetterType.Right) - { // meaning m2 is better - continue; - } - else if (result == BetterType.Same || result == BetterType.Neither) - { - ambig1 = candidate; - ambig2 = contender; - } - break; } - AMBIG: - // an ambig call. Return two of the ambiguous set. - if (ambig1 != null && ambig2 != null) + // an ambiguous call. Return two of the ambiguous set. + if (ambig1 != null & ambig2 != null) { methAmbig1 = ambig1; methAmbig2 = ambig2; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs index c406af43de..6c91d04060 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Diagnostics; using Microsoft.CSharp.RuntimeBinder.Errors; @@ -15,7 +16,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ErrorCode.ERR_AssgReadonlyLocal, }; - private void ReportLocalError(LocalVariableSymbol local, CheckLvalueKind kind, bool isNested) + private RuntimeBinderException ReportLocalError(LocalVariableSymbol local, CheckLvalueKind kind, bool isNested) { Debug.Assert(local != null); @@ -28,7 +29,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ErrorCode err = s_ReadOnlyLocalErrors[index]; - ErrorContext.Error(err, local.name); + return ErrorContext.Error(err, local.name); } private static readonly ErrorCode[] s_ReadOnlyErrors = @@ -43,7 +44,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ErrorCode.ERR_AssgReadonlyStatic2 }; - private void ReportReadOnlyError(ExprField field, CheckLvalueKind kind, bool isNested) + private RuntimeBinderException ReportReadOnlyError(ExprField field, CheckLvalueKind kind, bool isNested) { Debug.Assert(field != null); @@ -52,18 +53,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics int index = (isNested ? 4 : 0) + (isStatic ? 2 : 0) + (kind == CheckLvalueKind.OutParameter ? 0 : 1); ErrorCode err = s_ReadOnlyErrors[index]; - if (isNested) - { - ErrorContext.Error(err, field.FieldWithType); - } - else - { - ErrorContext.Error(err); - } + return ErrorContext.Error(err, isNested ? new ErrArg[]{field.FieldWithType} : Array.Empty()); } // Return true if we actually report a failure. - private bool TryReportLvalueFailure(Expr expr, CheckLvalueKind kind) + private void TryReportLvalueFailure(Expr expr, CheckLvalueKind kind) { Debug.Assert(expr != null); @@ -78,8 +72,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (expr is ExprLocal local && local.IsOK) { - ReportLocalError(local.Local, kind, isNested); - return true; + throw ReportLocalError(local.Local, kind, isNested); } Expr pObject = null; @@ -94,8 +87,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { if (field.FieldWithType.Field().isReadOnly) { - ReportReadOnlyError(field, kind, isNested); - return true; + throw ReportReadOnlyError(field, kind, isNested); } if (!field.FieldWithType.Field().isStatic) { @@ -109,8 +101,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // assigning to RHS of method or property getter returning a value-type on the stack or // passing RHS of method or property getter returning a value-type on the stack, as ref or out - ErrorContext.Error(ErrorCode.ERR_ReturnNotLValue, withArgs.GetSymWithType()); - return true; + throw ErrorContext.Error(ErrorCode.ERR_ReturnNotLValue, withArgs.GetSymWithType()); } if (pObject is ExprCast) { @@ -122,7 +113,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // But in the runtime, we allow this - mark that we're doing an // unbox here, so that we gen the correct expression tree for it. pObject.Flags |= EXPRFLAG.EXF_UNBOXRUNTIME; - return false; + return; } } @@ -134,16 +125,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } else { - ErrorContext.Error(GetStandardLvalueError(kind)); - return true; + throw ErrorContext.Error(GetStandardLvalueError(kind)); } + isNested = true; } } - - public static void ReportTypeArgsNotAllowedError(SymbolLoader symbolLoader, int arity, ErrArgRef argName, ErrArgRef argKind) - { - symbolLoader.ErrorContext.ErrorRef(ErrorCode.ERR_TypeArgsNotAllowed, argName, argKind); - } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingContext.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingContext.cs index 1139f2dc85..de778f76ee 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingContext.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingContext.cs @@ -18,18 +18,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(semanticChecker != null); ExprFactory = exprFactory; SemanticChecker = semanticChecker; - SymbolLoader = semanticChecker.GetSymbolLoader(); + SymbolLoader = semanticChecker.SymbolLoader; } public BindingContext(BindingContext parent) { Debug.Assert(parent.SemanticChecker != null); ExprFactory = parent.ExprFactory; - ReportUnsafeErrors = parent.ReportUnsafeErrors; ContextForMemberLookup = parent.ContextForMemberLookup; CheckedNormal = parent.CheckedNormal; CheckedConstant = parent.CheckedConstant; - SymbolLoader = (SemanticChecker = parent.SemanticChecker).GetSymbolLoader(); + SymbolLoader = (SemanticChecker = parent.SemanticChecker).SymbolLoader; } @@ -42,8 +41,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public AggregateDeclaration ContextForMemberLookup { get; set; } - public bool ReportUnsafeErrors { get; set; } = true; - public CSemanticChecker SemanticChecker { get; } public ExprFactory ExprFactory { get; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingFlag.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingFlag.cs index 95662ebf9a..24fa608fb9 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingFlag.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingFlag.cs @@ -2,8 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; + namespace Microsoft.CSharp.RuntimeBinder.Semantics { + [Flags] internal enum BindingFlag { BIND_RVALUEREQUIRED = 0x0001, // this is a get of expr, not an assignment to expr diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/COperators.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/COperators.cs index bcf813e2b9..b4de94360e 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/COperators.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/COperators.cs @@ -3,145 +3,127 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using System.Diagnostics; using Microsoft.CSharp.RuntimeBinder.Syntax; namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal static class Operators { - private sealed class OPINFO + private sealed class OperatorInfo { - public OPINFO(TokenKind t, PredefinedName pn, ExpressionKind e, int c) + public readonly TokenKind TokenKind; + public readonly PredefinedName MethodName; + public readonly ExpressionKind ExpressionKind; + + public OperatorInfo(TokenKind kind, PredefinedName pn, ExpressionKind e) { - iToken = t; - methodName = pn; - expressionKind = e; + TokenKind = kind; + MethodName = pn; + ExpressionKind = e; } - public readonly TokenKind iToken; - public readonly PredefinedName methodName; - public readonly ExpressionKind expressionKind; } - private static readonly Dictionary s_rgOpInfo = new Dictionary() - { -{OperatorKind.OP_NONE, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_ASSIGN, new OPINFO(TokenKind.Equal , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_ADDEQ, new OPINFO(TokenKind.PlusEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Add , 2)}, -{OperatorKind.OP_SUBEQ, new OPINFO(TokenKind.MinusEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Subtract , 2)}, -{OperatorKind.OP_MULEQ, new OPINFO(TokenKind.SplatEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Multiply , 2)}, -{OperatorKind.OP_DIVEQ, new OPINFO(TokenKind.SlashEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Divide , 2)}, -{OperatorKind.OP_MODEQ, new OPINFO(TokenKind.PercentEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Modulo , 2)}, -{OperatorKind.OP_ANDEQ, new OPINFO(TokenKind.AndEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.BitwiseAnd, 2)}, -{OperatorKind.OP_XOREQ, new OPINFO(TokenKind.HatEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.BitwiseExclusiveOr, 2)}, -{OperatorKind.OP_OREQ, new OPINFO(TokenKind.BarEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.BitwiseOr , 2)}, -{OperatorKind.OP_LSHIFTEQ, new OPINFO(TokenKind.LeftShiftEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.LeftShirt, 2)}, -{OperatorKind.OP_RSHIFTEQ, new OPINFO(TokenKind.RightShiftEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.RightShift, 2)}, -{OperatorKind.OP_QUESTION, new OPINFO(TokenKind.Question , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_VALORDEF, new OPINFO(TokenKind.QuestionQuestion , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_LOGOR, new OPINFO(TokenKind.LogicalOr , PredefinedName.PN_COUNT , ExpressionKind.LogicalOr , 2)}, -{OperatorKind.OP_LOGAND, new OPINFO(TokenKind.LogicalAnd , PredefinedName.PN_COUNT , ExpressionKind.LogicalAnd , 2)}, -{OperatorKind.OP_BITOR, new OPINFO(TokenKind.Bar , PredefinedName.PN_OPBITWISEOR , ExpressionKind.BitwiseOr , 2)}, -{OperatorKind.OP_BITXOR, new OPINFO(TokenKind.Hat , PredefinedName.PN_OPXOR , ExpressionKind.BitwiseExclusiveOr , 2)}, -{OperatorKind.OP_BITAND, new OPINFO(TokenKind.Ampersand , PredefinedName.PN_OPBITWISEAND , ExpressionKind.BitwiseAnd , 2)}, -{OperatorKind.OP_EQ, new OPINFO(TokenKind.EqualEqual , PredefinedName.PN_OPEQUALITY , ExpressionKind.Eq , 2)}, -{OperatorKind.OP_NEQ, new OPINFO(TokenKind.NotEqual , PredefinedName.PN_OPINEQUALITY , ExpressionKind.NotEq , 2)}, -{OperatorKind.OP_LT, new OPINFO(TokenKind.LessThan , PredefinedName.PN_OPLESSTHAN , ExpressionKind.LessThan , 2)}, -{OperatorKind.OP_LE, new OPINFO(TokenKind.LessThanEqual , PredefinedName.PN_OPLESSTHANOREQUAL , ExpressionKind.LessThanOrEqual , 2)}, -{OperatorKind.OP_GT, new OPINFO(TokenKind.GreaterThan , PredefinedName.PN_OPGREATERTHAN , ExpressionKind.GreaterThan , 2)}, -{OperatorKind.OP_GE, new OPINFO(TokenKind.GreaterThanEqual , PredefinedName.PN_OPGREATERTHANOREQUAL , ExpressionKind.GreaterThanOrEqual , 2)}, -{OperatorKind.OP_IS, new OPINFO(TokenKind.Is , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_AS, new OPINFO(TokenKind.As , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_LSHIFT, new OPINFO(TokenKind.LeftShift , PredefinedName.PN_OPLEFTSHIFT , ExpressionKind.LeftShirt , 2)}, -{OperatorKind.OP_RSHIFT, new OPINFO(TokenKind.RightShift , PredefinedName.PN_OPRIGHTSHIFT , ExpressionKind.RightShift , 2)}, -{OperatorKind.OP_ADD, new OPINFO(TokenKind.Plus , PredefinedName.PN_OPPLUS , ExpressionKind.Add , 2)}, -{OperatorKind.OP_SUB, new OPINFO(TokenKind.Minus , PredefinedName.PN_OPMINUS , ExpressionKind.Subtract , 2)}, -{OperatorKind.OP_MUL, new OPINFO(TokenKind.Splat , PredefinedName.PN_OPMULTIPLY , ExpressionKind.Multiply , 2)}, -{OperatorKind.OP_DIV, new OPINFO(TokenKind.Slash , PredefinedName.PN_OPDIVISION , ExpressionKind.Divide , 2)}, -{OperatorKind.OP_MOD, new OPINFO(TokenKind.Percent , PredefinedName.PN_OPMODULUS , ExpressionKind.Modulo , 2)}, -{OperatorKind.OP_NOP, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_UPLUS, new OPINFO(TokenKind.Plus , PredefinedName.PN_OPUNARYPLUS , ExpressionKind.UnaryPlus , 1)}, -{OperatorKind.OP_NEG, new OPINFO(TokenKind.Minus , PredefinedName.PN_OPUNARYMINUS , ExpressionKind.Negate , 1)}, -{OperatorKind.OP_BITNOT, new OPINFO(TokenKind.Tilde , PredefinedName.PN_OPCOMPLEMENT , ExpressionKind.BitwiseNot , 1)}, -{OperatorKind.OP_LOGNOT, new OPINFO(TokenKind.Bang , PredefinedName.PN_OPNEGATION , ExpressionKind.LogicalNot , 1)}, -{OperatorKind.OP_PREINC, new OPINFO(TokenKind.PlusPlus , PredefinedName.PN_OPINCREMENT , ExpressionKind.Add , 1)}, -{OperatorKind.OP_PREDEC, new OPINFO(TokenKind.MinusMinus , PredefinedName.PN_OPDECREMENT , ExpressionKind.Subtract , 1)}, -{OperatorKind.OP_TYPEOF, new OPINFO(TokenKind.TypeOf , PredefinedName.PN_COUNT , ExpressionKind.TypeOf , 1)}, -{OperatorKind.OP_CHECKED, new OPINFO(TokenKind.Checked , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_UNCHECKED, new OPINFO(TokenKind.Unchecked , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_MAKEREFANY, new OPINFO(TokenKind.MakeRef , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_REFVALUE, new OPINFO(TokenKind.RefValue , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_REFTYPE, new OPINFO(TokenKind.RefType , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_ARGS, new OPINFO(TokenKind.ArgList , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_CAST, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_INDIR, new OPINFO(TokenKind.Splat , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_ADDR, new OPINFO(TokenKind.Ampersand , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_COLON, new OPINFO(TokenKind.Colon , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_THIS, new OPINFO(TokenKind.This , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_BASE, new OPINFO(TokenKind.Base , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_NULL, new OPINFO(TokenKind.Null , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_TRUE, new OPINFO(TokenKind.True , PredefinedName.PN_OPTRUE , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_FALSE, new OPINFO(TokenKind.False , PredefinedName.PN_OPFALSE , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_CALL, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_DEREF, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_PAREN, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)}, -{OperatorKind.OP_POSTINC, new OPINFO(TokenKind.PlusPlus , PredefinedName.PN_COUNT , ExpressionKind.Add , 1)}, -{OperatorKind.OP_POSTDEC, new OPINFO(TokenKind.MinusMinus , PredefinedName.PN_COUNT , ExpressionKind.Subtract , 1)}, -{OperatorKind.OP_DOT, new OPINFO(TokenKind.Dot , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_IMPLICIT, new OPINFO(TokenKind.Implicit , PredefinedName.PN_OPIMPLICITMN , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_EXPLICIT, new OPINFO(TokenKind.Explicit , PredefinedName.PN_OPEXPLICITMN , ExpressionKind.ExpressionKindCount , 1)}, -{OperatorKind.OP_EQUALS, new OPINFO(TokenKind.Unknown , PredefinedName.PN_OPEQUALS , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_COMPARE, new OPINFO(TokenKind.Unknown , PredefinedName.PN_OPCOMPARE , ExpressionKind.ExpressionKindCount , 2)}, -{OperatorKind.OP_DEFAULT, new OPINFO(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount , 0)} + private static readonly OperatorInfo[] s_operatorInfos = { + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Equal , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.PlusEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Add ), + new OperatorInfo(TokenKind.MinusEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Subtract ), + new OperatorInfo(TokenKind.SplatEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Multiply ), + new OperatorInfo(TokenKind.SlashEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Divide ), + new OperatorInfo(TokenKind.PercentEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.Modulo ), + new OperatorInfo(TokenKind.AndEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.BitwiseAnd ), + new OperatorInfo(TokenKind.HatEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.BitwiseExclusiveOr), + new OperatorInfo(TokenKind.BarEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.BitwiseOr ), + new OperatorInfo(TokenKind.LeftShiftEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.LeftShirt ), + new OperatorInfo(TokenKind.RightShiftEqual , PredefinedName.PN_COUNT , ExpressionKind.MultiOffset + (int)ExpressionKind.RightShift ), + new OperatorInfo(TokenKind.Question , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.QuestionQuestion, PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.LogicalOr , PredefinedName.PN_COUNT , ExpressionKind.LogicalOr ), + new OperatorInfo(TokenKind.LogicalAnd , PredefinedName.PN_COUNT , ExpressionKind.LogicalAnd ), + new OperatorInfo(TokenKind.Bar , PredefinedName.PN_OPBITWISEOR , ExpressionKind.BitwiseOr ), + new OperatorInfo(TokenKind.Hat , PredefinedName.PN_OPXOR , ExpressionKind.BitwiseExclusiveOr ), + new OperatorInfo(TokenKind.Ampersand , PredefinedName.PN_OPBITWISEAND , ExpressionKind.BitwiseAnd ), + new OperatorInfo(TokenKind.EqualEqual , PredefinedName.PN_OPEQUALITY , ExpressionKind.Eq ), + new OperatorInfo(TokenKind.NotEqual , PredefinedName.PN_OPINEQUALITY , ExpressionKind.NotEq ), + new OperatorInfo(TokenKind.LessThan , PredefinedName.PN_OPLESSTHAN , ExpressionKind.LessThan ), + new OperatorInfo(TokenKind.LessThanEqual , PredefinedName.PN_OPLESSTHANOREQUAL , ExpressionKind.LessThanOrEqual ), + new OperatorInfo(TokenKind.GreaterThan , PredefinedName.PN_OPGREATERTHAN , ExpressionKind.GreaterThan ), + new OperatorInfo(TokenKind.GreaterThanEqual, PredefinedName.PN_OPGREATERTHANOREQUAL, ExpressionKind.GreaterThanOrEqual ), + new OperatorInfo(TokenKind.Is , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.As , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.LeftShift , PredefinedName.PN_OPLEFTSHIFT , ExpressionKind.LeftShirt ), + new OperatorInfo(TokenKind.RightShift , PredefinedName.PN_OPRIGHTSHIFT , ExpressionKind.RightShift ), + new OperatorInfo(TokenKind.Plus , PredefinedName.PN_OPPLUS , ExpressionKind.Add ), + new OperatorInfo(TokenKind.Minus , PredefinedName.PN_OPMINUS , ExpressionKind.Subtract ), + new OperatorInfo(TokenKind.Splat , PredefinedName.PN_OPMULTIPLY , ExpressionKind.Multiply ), + new OperatorInfo(TokenKind.Slash , PredefinedName.PN_OPDIVISION , ExpressionKind.Divide ), + new OperatorInfo(TokenKind.Percent , PredefinedName.PN_OPMODULUS , ExpressionKind.Modulo ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Plus , PredefinedName.PN_OPUNARYPLUS , ExpressionKind.UnaryPlus ), + new OperatorInfo(TokenKind.Minus , PredefinedName.PN_OPUNARYMINUS , ExpressionKind.Negate ), + new OperatorInfo(TokenKind.Tilde , PredefinedName.PN_OPCOMPLEMENT , ExpressionKind.BitwiseNot ), + new OperatorInfo(TokenKind.Bang , PredefinedName.PN_OPNEGATION , ExpressionKind.LogicalNot ), + new OperatorInfo(TokenKind.PlusPlus , PredefinedName.PN_OPINCREMENT , ExpressionKind.Add ), + new OperatorInfo(TokenKind.MinusMinus , PredefinedName.PN_OPDECREMENT , ExpressionKind.Subtract ), + new OperatorInfo(TokenKind.TypeOf , PredefinedName.PN_COUNT , ExpressionKind.TypeOf ), + new OperatorInfo(TokenKind.Checked , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unchecked , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.MakeRef , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.RefValue , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.RefType , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.ArgList , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Splat , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Ampersand , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Colon , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.This , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Base , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Null , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.True , PredefinedName.PN_OPTRUE , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.False , PredefinedName.PN_OPFALSE , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.PlusPlus , PredefinedName.PN_COUNT , ExpressionKind.Add ), + new OperatorInfo(TokenKind.MinusMinus , PredefinedName.PN_COUNT , ExpressionKind.Subtract ), + new OperatorInfo(TokenKind.Dot , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Implicit , PredefinedName.PN_OPIMPLICITMN , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Explicit , PredefinedName.PN_OPEXPLICITMN , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_OPEQUALS , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_OPCOMPARE , ExpressionKind.ExpressionKindCount ), + new OperatorInfo(TokenKind.Unknown , PredefinedName.PN_COUNT , ExpressionKind.ExpressionKindCount ) }; + private static Dictionary s_operatorsByName; - private static OPINFO GetInfo(OperatorKind op) + private static Dictionary GetOperatorByName() { - //Debug.Assert(IsValid(op)); - return s_rgOpInfo[op]; - } - public static OperatorKind OperatorOfMethodName(Name name) - { - Debug.Assert(name != null); - - for (OperatorKind i = OperatorKind.OP_NONE; i < OperatorKind.OP_LAST; i = (i + 1)) + Dictionary dict = new Dictionary(28) { - if (HasMethodName(i) && (name == NameManager.GetPredefinedName(GetMethodName(i)))) + {NameManager.GetPredefinedName(PredefinedName.PN_OPEQUALS), "equals"}, + {NameManager.GetPredefinedName(PredefinedName.PN_OPCOMPARE), "compare" } + }; + + foreach (OperatorInfo opInfo in s_operatorInfos) + { + PredefinedName predefName = opInfo.MethodName; + TokenKind token = opInfo.TokenKind; + if (predefName != PredefinedName.PN_COUNT && token != TokenKind.Unknown) { - return i; + dict.Add(NameManager.GetPredefinedName(predefName), TokenFacts.GetText(token)); } } - return OperatorKind.OP_NONE; + return dict; } - private static bool HasMethodName(OperatorKind op) - { - //Debug.Assert(IsValid(op)); - return GetMethodName(op) != PredefinedName.PN_COUNT; - } + private static OperatorInfo GetInfo(OperatorKind op) => s_operatorInfos[(int)op]; - private static PredefinedName GetMethodName(OperatorKind op) - { - //Debug.Assert(IsValid(op)); - return GetInfo(op).methodName; - } + public static string OperatorOfMethodName(Name name) => + (s_operatorsByName ?? (s_operatorsByName = GetOperatorByName()))[name]; - public static bool HasDisplayName(OperatorKind op) - { - //Debug.Assert(IsValid(op)); - return GetInfo(op).iToken != TokenKind.Unknown; - } - public static string GetDisplayName(OperatorKind op) - { - Debug.Assert(HasDisplayName(op)); - return TokenFacts.GetText(GetInfo(op).iToken); - } - public static ExpressionKind GetExpressionKind(OperatorKind op) - { - //Debug.Assert(IsValid(op)); - return GetInfo(op).expressionKind; - } + public static string GetDisplayName(OperatorKind op) => TokenFacts.GetText(GetInfo(op).TokenKind); + + public static ExpressionKind GetExpressionKind(OperatorKind op) => GetInfo(op).ExpressionKind; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs index 2756538770..2804a15311 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs @@ -21,6 +21,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // Flags for bindImplicitConversion/bindExplicitConversion + [Flags] internal enum CONVERTTYPE { NOUDC = 0x01, // Do not consider user defined conversions. @@ -226,10 +227,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics (s_simpleTypeBetter[i][j] == right && s_simpleTypeBetter[j][i] == left) || (s_simpleTypeBetter[i][j] == neither && s_simpleTypeBetter[j][i] == neither)); Debug.Assert( - GetOptPDT((PredefinedType)i) == null || - GetOptPDT((PredefinedType)j) == null || - (!canConvert(GetOptPDT((PredefinedType)i), GetOptPDT((PredefinedType)j), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[i][j] == left) && - (!canConvert(GetOptPDT((PredefinedType)j), GetOptPDT((PredefinedType)i), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[j][i] == left)); + GetPredefindType((PredefinedType)i) == null || + GetPredefindType((PredefinedType)j) == null || + (!canConvert(GetPredefindType((PredefinedType)i), GetPredefindType((PredefinedType)j), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[i][j] == left) && + (!canConvert(GetPredefindType((PredefinedType)j), GetPredefindType((PredefinedType)i), CONVERTTYPE.NOUDC) || s_simpleTypeBetter[j][i] == left)); } } s_fCheckedBetter = true; @@ -279,7 +280,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return BetterType.Right; } - return WhichTypeIsBetter(GetOptPDT(pt1), GetOptPDT(pt2), typeGiven); + return WhichTypeIsBetter(GetPredefindType(pt1), GetPredefindType(pt2), typeGiven); } @@ -311,9 +312,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return f12 ? BetterType.Left : BetterType.Right; } - if (!type1.IsNullableType() || !type2.IsNullableType() || - !type1.AsNullableType().UnderlyingType.isPredefined() || - !type2.AsNullableType().UnderlyingType.isPredefined()) + if (!(type1 is NullableType nub1) || !(type2 is NullableType nub2) || + !nub1.UnderlyingType.isPredefined() || + !nub2.UnderlyingType.isPredefined()) { return BetterType.Neither; } @@ -362,6 +363,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Expr mustConvertCore(Expr expr, ExprClass destExpr, CONVERTTYPE flags) { + Debug.Assert(!(expr is ExprMemberGroup)); Expr exprResult; CType dest = destExpr.Type; @@ -373,7 +375,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return exprResult; } - if (expr.IsOK && !dest.IsErrorType()) + if (expr.IsOK && !(dest is ErrorType)) { // don't report cascading error. @@ -390,43 +392,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // Failed because value was out of range. Report nifty error message. string value = constant.Int64Value.ToString(CultureInfo.InvariantCulture); - ErrorContext.Error(ErrorCode.ERR_ConstOutOfRange, value, dest); - exprResult = ExprFactory.CreateCast(0, destExpr, expr); - exprResult.SetError(); - return exprResult; - } - else if (ftSrc == FUNDTYPE.FT_R8 && (0 != (expr.Flags & EXPRFLAG.EXF_LITERALCONST)) && - (dest.isPredefType(PredefinedType.PT_FLOAT) || dest.isPredefType(PredefinedType.PT_DECIMAL))) - { - // Tried to assign a literal of type double (the default) to a float or decimal. Suggest use - // of a 'F' or 'M' suffix. - ErrorContext.Error(ErrorCode.ERR_LiteralDoubleCast, dest.isPredefType(PredefinedType.PT_DECIMAL) ? "M" : "F", dest); - exprResult = ExprFactory.CreateCast(0, destExpr, expr); - exprResult.SetError(); - return exprResult; + throw ErrorContext.Error(ErrorCode.ERR_ConstOutOfRange, value, dest); } } if (expr.Type is NullType && dest.fundType() != FUNDTYPE.FT_REF) { - ErrorContext.Error(dest is TypeParameterType ? ErrorCode.ERR_TypeVarCantBeNull : ErrorCode.ERR_ValueCantBeNull, dest); + throw ErrorContext.Error(ErrorCode.ERR_ValueCantBeNull, dest); } - else if (expr is ExprMemberGroup memGrp) - { - BindGrpConversion(memGrp, dest, true); - } - else if (canCast(expr.Type, dest, flags)) - { - // can't convert, but explicit exists and can be specified by the user (no anonymous types). - ErrorContext.Error(ErrorCode.ERR_NoImplicitConvCast, new ErrArg(expr.Type, ErrArgFlags.Unique), new ErrArg(dest, ErrArgFlags.Unique)); - } - else - { - // Generic "can't convert" error. - ErrorContext.Error(ErrorCode.ERR_NoImplicitConv, new ErrArg(expr.Type, ErrArgFlags.Unique), new ErrArg(dest, ErrArgFlags.Unique)); - } + // canCast => can't convert, but explicit exists and can be specified by the user (no anonymous types). + // !canCast => Generic "can't convert" error. + throw ErrorContext.Error(canCast(expr.Type, dest, flags) ? ErrorCode.ERR_NoImplicitConvCast : ErrorCode.ERR_NoImplicitConv, new ErrArg(expr.Type, ErrArgFlags.Unique), new ErrArg(dest, ErrArgFlags.Unique)); } + exprResult = ExprFactory.CreateCast(0, destExpr, expr); exprResult.SetError(); return exprResult; @@ -480,6 +459,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // performs an explicit conversion if its possible. otherwise displays an error. private Expr mustCastCore(Expr expr, ExprClass destExpr, CONVERTTYPE flags) { + Debug.Assert(!(expr is ExprMemberGroup)); Expr exprResult; CType dest = destExpr.Type; @@ -508,7 +488,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // We have a constant decimal that is out of range of the destination type. // In both checked and unchecked contexts we issue an error. No need to recheck conversion in unchecked context. // Decimal is a SimpleType represented in a FT_STRUCT - ErrorContext.Error(ErrorCode.ERR_ConstOutOfRange, ((ExprConstant)exprConst).Val.DecimalVal.ToString(CultureInfo.InvariantCulture), dest); + throw ErrorContext.Error(ErrorCode.ERR_ConstOutOfRange, ((ExprConstant)exprConst).Val.DecimalVal.ToString(CultureInfo.InvariantCulture), dest); } else if (simpleConstToSimpleDestination && Context.CheckedConstant) { @@ -539,21 +519,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(expr_type == FUNDTYPE.FT_STRUCT); Debug.Assert(false, "Error in constant conversion logic!"); } - ErrorContext.Error(ErrorCode.ERR_ConstOutOfRangeChecked, value, dest); + + throw ErrorContext.Error(ErrorCode.ERR_ConstOutOfRangeChecked, value, dest); } - else if (expr.Type is NullType && dest.fundType() != FUNDTYPE.FT_REF) + if (expr.Type is NullType && dest.fundType() != FUNDTYPE.FT_REF) { - ErrorContext.Error(ErrorCode.ERR_ValueCantBeNull, dest); - } - else if (expr is ExprMemberGroup memGrp) - { - BindGrpConversion(memGrp, dest, true); - } - else - { - CantConvert(expr, dest); + throw ErrorContext.Error(ErrorCode.ERR_ValueCantBeNull, dest); } + + CantConvert(expr, dest); } } CANTCONVERT: @@ -568,7 +543,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Only report if we don't have an error type. if (expr.Type != null && !(expr.Type is ErrorType)) { - ErrorContext.Error(ErrorCode.ERR_NoExplicitConv, new ErrArg(expr.Type, ErrArgFlags.Unique), new ErrArg(dest, ErrArgFlags.Unique)); + throw ErrorContext.Error(ErrorCode.ERR_NoExplicitConv, new ErrArg(expr.Type, ErrArgFlags.Unique), new ErrArg(dest, ErrArgFlags.Unique)); } } public Expr mustCast(Expr expr, CType dest) @@ -593,243 +568,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return BindExplicitConversion(null, src, destExpr, dest, flags); } - /*************************************************************************************************** - Convert a method group to a delegate type. - - NOTE: Currently it is not well defined when there is an implicit conversion from a method - group to a delegate type. There are several possibilities. On the two extremes are: - - (1) (Most permissive) When there is at least one applicable method in the method group. - - (2) (Most restrictive) When all of the following are satisfied: - * Overload resolution does not produce an error - * The method's parameter types don't require any conversions other than implicit reference - conversions. - * The method's return type is compatible. - * The method's constraints are satisfied. - * The method is not conditional. - - For (1), it may be the case that an error is produced whenever the conversion is actually used. - For example, if the result of overload resolution is ambiguous or if the result of overload - resolution is a method with the wrong return result or with unsatisfied constraints. - - For (2), the intent is that if the answer is yes, then an error is never produced. - - Note that (2) is not monotone: adding a method to the method group may cause the answer - to go from yes to no. This has a very odd effect in certain situations: - - Suppose: - * I1 and J1 are interfaces with I1 : J1. - * I2, J2 and K2 are interfaces with I2 : J2, K2. - * Di is a delegate type with signature void Di(Ii). - * A method group named F contains F(D1(I1)) and F(D2(I2)). - * There is another method group named M containing a subset of: - void M(J1) - void M(J2) - void M(K2) - - Under any of the definitions we're considering: - - * If M is { M(J1), M(J2) } then F(M) is an error (ambiguous between F(D1) and F(D2)). - * If M is { M(J1), M(K2) } then F(M) is an error (ambiguous between F(D1) and F(D2)). - * If M is { M(J2), M(K2) } then F(M) is an error (M -> D2 is ambiguous). - - If M is { M(J1), M(J2), M(K2) } what should F(M) be? It seems logical for F(M) to be ambiguous - in this case as well. However, under definition (2), there is no implicit conversion from M - to D2 (since overload resolution is ambiguous). Thus F(M) is unambiguously taken to mean - F(D1) applied to M(J1). Note that the user has just made the situation more ambiguous by having - all three methods in the method group, but we ignore this additional ambiguity and pick a - winner (rather arbitrarily). - - We currently implement (1). The spec needs to be tightened up. - ***************************************************************************************************/ - private bool BindGrpConversion(ExprMemberGroup grp, CType typeDst, bool fReportErrors) - { - ExprCall dummy; - return BindGrpConversion(grp, typeDst, false, out dummy, fReportErrors); - } - - private bool BindGrpConversion(ExprMemberGroup grp, CType typeDst, bool needDest, out ExprCall pexprDst, bool fReportErrors) - { - pexprDst = null; - - if (!typeDst.isDelegateType()) - { - if (fReportErrors) - ErrorContext.Error(ErrorCode.ERR_MethGrpToNonDel, grp.Name, typeDst); - return false; - } - AggregateType type = typeDst.AsAggregateType(); - MethodSymbol methCtor = SymbolLoader.PredefinedMembers.FindDelegateConstructor(type.getAggregate(), fReportErrors); - if (methCtor == null) - return false; - // Now, find the invoke function on the delegate. - MethodSymbol methInvoke = SymbolLoader.LookupInvokeMeth(type.getAggregate()); - Debug.Assert(methInvoke != null && methInvoke.isInvoke()); - TypeArray @params = GetTypes().SubstTypeArray(methInvoke.Params, type); - CType typeRet = GetTypes().SubstType(methInvoke.RetType, type); - // Next, verify that the function has a suitable type for the invoke method. - MethPropWithInst mpwiWrap; - MethPropWithInst mpwiAmbig; - - if (!BindGrpConversionCore(out mpwiWrap, BindingFlag.BIND_NOPARAMS, grp, ref @params, type, fReportErrors, out mpwiAmbig)) - { - return false; - } - - MethWithInst mwiWrap = new MethWithInst(mpwiWrap); - MethWithInst mwiAmbig = new MethWithInst(mpwiAmbig); - - bool isExtensionMethod = false; - // If the method we have bound to is an extension method and we are using it as an extension and not as a static method - if (methInvoke.Params.Count < @params.Count && mwiWrap.Meth().IsExtension()) - { - isExtensionMethod = true; - TypeArray extParams = GetTypes().SubstTypeArray(mwiWrap.Meth().Params, mwiWrap.GetType()); - // The this parameter must be a reference type. - if (extParams[0].IsTypeParameterType() ? !@params[0].IsRefType() : !extParams[0].IsRefType()) - { - // We should issue a better message here. - // We were only disallowing value types, hence the error message specific to value types. - // Now we are issuing the same error message for not-known to be reference types, not just value types. - ErrorContext.Error(ErrorCode.ERR_ValueTypeExtDelegate, mwiWrap, extParams[0].IsTypeParameterType() ? @params[0] : extParams[0]); - } - } - - // From here on we should only return true. - if (!fReportErrors && !needDest) - return true; - - // Note: We report errors below even if fReportErrors is false. Note however that we only - // get here if pexprDst is non-null and we'll return true even if we report an error, so this - // is really the only chance we'll get to report the error. - bool fError = (bool)mwiAmbig; - - if (mwiAmbig && !fReportErrors) - { - // Report the ambiguity, since BindGrpConversionCore didn't. - ErrorContext.Error(ErrorCode.ERR_AmbigCall, mwiWrap, mwiAmbig); - } - CType typeRetReal = GetTypes().SubstType(mwiWrap.Meth().RetType, mwiWrap.Ats, mwiWrap.TypeArgs); - if (typeRet != typeRetReal && !CConversions.FImpRefConv(GetSymbolLoader(), typeRetReal, typeRet)) - { - ErrorContext.ErrorRef(ErrorCode.ERR_BadRetType, mwiWrap, typeRetReal); - fError = true; - } - - TypeArray paramsReal = GetTypes().SubstTypeArray(mwiWrap.Meth().Params, mwiWrap.Ats, mwiWrap.TypeArgs); - if (paramsReal != @params) - { - for (int i = 0; i < paramsReal.Count; i++) - { - CType param = @params[i]; - CType paramReal = paramsReal[i]; - - if (param != paramReal && !CConversions.FImpRefConv(GetSymbolLoader(), param, paramReal)) - { - ErrorContext.ErrorRef(ErrorCode.ERR_MethDelegateMismatch, mwiWrap, typeDst); - fError = true; - break; - } - } - } - - Expr obj = !isExtensionMethod ? grp.OptionalObject: null; - bool bIsMatchingStatic; - bool constrained; - PostBindMethod(0 != (grp.Flags & EXPRFLAG.EXF_BASECALL), ref mwiWrap, obj); - obj = AdjustMemberObject(mwiWrap, obj, out constrained, out bIsMatchingStatic); - if (!bIsMatchingStatic) - { - grp.SetMismatchedStaticBit(); - } - obj = isExtensionMethod ? grp.OptionalObject: obj; - Debug.Assert(mwiWrap.Meth().getKind() == SYMKIND.SK_MethodSymbol); - if (mwiWrap.TypeArgs.Count > 0) - { - // Check method type variable constraints. - TypeBind.CheckMethConstraints(GetSemanticChecker(), GetErrorContext(), mwiWrap); - } - if (mwiWrap.Meth().MethKind() == MethodKindEnum.Latent) - { - ErrorContext.ErrorRef(ErrorCode.ERR_PartialMethodToDelegate, mwiWrap); - } - - if (!needDest) - return true; - - ExprFuncPtr funcPtr = ExprFactory.CreateFunctionPointer(grp.Flags & EXPRFLAG.EXF_BASECALL, getVoidType(), null, mwiWrap); - if (!mwiWrap.Meth().isStatic || isExtensionMethod) - { - if (mwiWrap.Meth().getClass().isPredefAgg(PredefinedType.PT_G_OPTIONAL)) - { - ErrorContext.Error(ErrorCode.ERR_DelegateOnNullable, mwiWrap); - } - funcPtr.OptionalObject = obj; - if (obj != null && obj.Type.fundType() != FUNDTYPE.FT_REF) - { - // Must box the object before creating a delegate to it. - obj = mustConvert(obj, GetReqPDT(PredefinedType.PT_OBJECT)); - } - } - else - { - funcPtr.OptionalObject = null; - obj = ExprFactory.CreateNull(); - } - - MethWithInst mwi = new MethWithInst(methCtor, type); - grp.OptionalObject = null; - ExprCall call = ExprFactory.CreateCall(EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CANTBENULL, type, ExprFactory.CreateList(obj, funcPtr), grp/*pMemGroup*/, mwi); - - pexprDst = call; - return true; - } - - private bool BindGrpConversionCore(out MethPropWithInst pmpwi, BindingFlag bindFlags, ExprMemberGroup grp, ref TypeArray args, AggregateType atsDelegate, bool fReportErrors, out MethPropWithInst pmpwiAmbig) - { - bool retval = false; - int carg = args.Count; - - ArgInfos argParam = new ArgInfos(); - argParam.carg = args.Count; - argParam.types = args; - argParam.fHasExprs = false; - GroupToArgsBinder binder = new GroupToArgsBinder(this, bindFlags, grp, argParam, null, false, atsDelegate); - retval = binder.Bind(fReportErrors); - GroupToArgsBinderResult result = binder.GetResultsOfBind(); - pmpwi = result.GetBestResult(); - pmpwiAmbig = result.GetAmbiguousResult(); - return retval; - } - /* - * bindInstanceParamForExtension - * - * This method is called by canConvert for the case of the instance parameter on the extension method - * - */ - private bool canConvertInstanceParamForExtension(Expr exprSrc, CType typeDest) - { - CType typeSrc = exprSrc?.Type; - return typeSrc != null && canConvertInstanceParamForExtension(typeSrc, typeDest); - } - - private bool canConvertInstanceParamForExtension(CType typeSrc, CType typeDest) - { - // 26.2.3 Extension method invocations - // - // The following conversions are defined of instance params on Extension methods - // - // * Identity conversions - // * Implicit reference conversions - // * Boxing conversions - - // Always make sure both types are declared. - return CConversions.FIsSameType(typeSrc, typeDest) || - CConversions.FImpRefConv(GetSymbolLoader(), typeSrc, typeDest) || - CConversions.FBoxingConv(GetSymbolLoader(), typeSrc, typeDest); - } - private bool BindImplicitConversion(Expr pSourceExpr, CType pSourceType, ExprClass pDestinationTypeExpr, CType pDestinationTypeForLambdaErrorReporting, CONVERTTYPE flags) { ImplicitConversion binder = new ImplicitConversion(this, pSourceExpr, pSourceType, pDestinationTypeExpr, false, flags); @@ -928,7 +666,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // true exactly when both the source and destination types are nullable. bool fLiftSrc = typeSrcBase != typeSrc; bool fLiftDst = typeDstBase != typeDst; - bool fDstHasNull = fLiftDst || typeDst.IsRefType() || typeDst.IsPointerType(); + bool fDstHasNull = fLiftDst || typeDst.IsRefType() || typeDst is PointerType; AggregateType[] rgats = new AggregateType[2]; int cats = 0; @@ -942,44 +680,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics bool fIntPtrOverride2 = false; // Get the list of operators from the source. - if (typeSrcBase.IsTypeParameterType()) + if (typeSrcBase is AggregateType atSrcBase && atSrcBase.getAggregate().HasConversion(GetSymbolLoader())) { - AggregateType atsBase = typeSrcBase.AsTypeParameterType().GetEffectiveBaseClass(); - if (atsBase != null && atsBase.getAggregate().HasConversion(GetSymbolLoader())) - { - rgats[cats++] = atsBase; - } - - // If an implicit conversion exists from the class bound to typeDst, then - // an implicit conversion exists from typeSrc to typeDst. An explicit from - // the class bound to typeDst doesn't buy us anything. - // We can still use an explicit conversion that has this type variable (or - // nullable of it) as its from-type. - fImplicitOrExactSrc = true; - } - else if (typeSrcBase.IsAggregateType() && typeSrcBase.getAggregate().HasConversion(GetSymbolLoader())) - { - rgats[cats++] = typeSrcBase.AsAggregateType(); - fIntPtrOverride2 = typeSrcBase.isPredefType(PredefinedType.PT_INTPTR) || typeSrcBase.isPredefType(PredefinedType.PT_UINTPTR); + rgats[cats++] = atSrcBase; + fIntPtrOverride2 = atSrcBase.isPredefType(PredefinedType.PT_INTPTR) || atSrcBase.isPredefType(PredefinedType.PT_UINTPTR); } // Get the list of operators from the destination. - if (typeDstBase.IsTypeParameterType()) - { - // If an explicit conversion exists from typeSrc to the class bound, then - // an explicit conversion exists from typeSrc to typeDst. An implicit is no better - // than an explicit. - AggregateType atsBase; - if (!fImplicitOnly && (atsBase = typeDstBase.AsTypeParameterType().GetEffectiveBaseClass()).getAggregate().HasConversion(GetSymbolLoader())) - { - rgats[cats++] = atsBase; - } - } - else if (typeDstBase.IsAggregateType()) + if (typeDstBase is AggregateType atDstBase) { if (typeDstBase.getAggregate().HasConversion(GetSymbolLoader())) { - rgats[cats++] = typeDstBase.AsAggregateType(); + rgats[cats++] = atDstBase; } if (fIntPtrOverride2 && !typeDstBase.isPredefType(PredefinedType.PT_LONG) && !typeDstBase.isPredefType(PredefinedType.PT_ULONG)) @@ -1035,8 +747,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (fImplicitOnly && !convCur.isImplicit()) continue; - if (GetSemanticChecker().CheckBogus(convCur)) - continue; // Get the substituted src and dst types. typeFrom = GetTypes().SubstType(convCur.Params[0], atsCur); @@ -1081,7 +791,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics !canConvert(typeFrom, typeSrc, CONVERTTYPE.STANDARDANDNOUDC) && // We allow IntPtr and UIntPtr to use non-standard explicit casts as long as they don't involve pointer types. // This is because the framework uses it and RTM allowed it. - (!fIntPtrStandard || typeSrc.IsPointerType() || typeFrom.IsPointerType() || !canCast(typeSrc, typeFrom, CONVERTTYPE.NOUDC)))) + (!fIntPtrStandard || typeSrc is PointerType || typeFrom is PointerType || !canCast(typeSrc, typeFrom, CONVERTTYPE.NOUDC)))) { continue; } @@ -1090,7 +800,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics !canConvert(typeDst, typeTo, CONVERTTYPE.STANDARDANDNOUDC) && // We allow IntPtr and UIntPtr to use non-standard explicit casts as long as they don't involve pointer types. // This is because the framework uses it and RTM allowed it. - (!fIntPtrStandard || typeDst.IsPointerType() || typeTo.IsPointerType() || !canCast(typeTo, typeDst, CONVERTTYPE.NOUDC)))) + (!fIntPtrStandard || typeDst is PointerType || typeTo is PointerType || !canCast(typeTo, typeDst, CONVERTTYPE.NOUDC)))) { continue; } @@ -1307,7 +1017,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Expr exprDst; Expr pTransformedArgument = exprSrc; - if (ctypeLiftBest > 0 && !typeFrom.IsNullableType() && fDstHasNull) + if (ctypeLiftBest > 0 && !(typeFrom is NullableType) && fDstHasNull) { // Create the memgroup. ExprMemberGroup pMemGroup = ExprFactory.CreateMemGroup(null, mwiBest); @@ -1340,7 +1050,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } else { - if (typeTo.IsNullableType()) + if (typeTo is NullableType) { // We need to generate a nullable value access, the conversion will be used without lifting. pConversionArgument = mustCast(exprSrc, typeFrom); @@ -1375,11 +1085,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(0 <= iuciBestSrc && iuciBestSrc < prguci.Count); Debug.Assert(0 <= iuciBestDst && iuciBestDst < prguci.Count); - ErrorContext.Error(ErrorCode.ERR_AmbigUDConv, prguci[iuciBestSrc].mwt, prguci[iuciBestDst].mwt, typeSrc, typeDst); - ExprClass exprClass = ExprFactory.CreateClass(typeDst); - Expr pexprDst = ExprFactory.CreateCast(0, exprClass, exprSrc); - pexprDst.SetError(); - return pexprDst; + throw ErrorContext.Error(ErrorCode.ERR_AmbigUDConv, prguci[iuciBestSrc].mwt, prguci[iuciBestDst].mwt, typeSrc, typeDst); } private void MarkAsIntermediateConversion(Expr pExpr) @@ -1696,7 +1402,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Expr bindDecimalConstCast(ExprClass exprDestType, CType srcType, ExprConstant src) { CType destType = exprDestType.Type; - CType typeDecimal = SymbolLoader.GetOptPredefType(PredefinedType.PT_DECIMAL); + CType typeDecimal = SymbolLoader.GetPredefindType(PredefinedType.PT_DECIMAL); ConstVal cv; if (typeDecimal == null) diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversions.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversions.cs index dfa5710c82..d16f7580d2 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversions.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversions.cs @@ -90,11 +90,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // For a type-parameter T that is known to be a reference type (§25.7), the following explicit reference conversions exist: // • From any interface-type to T. // • From T to any interface-type I provided there isn’t already an implicit reference conversion from T to I. - if (typeSrc.isInterfaceType() && typeDst.IsTypeParameterType()) + if (typeSrc.isInterfaceType() && typeDst is TypeParameterType) { return true; } - if (typeSrc.IsTypeParameterType() && typeDst.isInterfaceType()) + if (typeSrc is TypeParameterType && typeDst.isInterfaceType()) { return true; } @@ -102,10 +102,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // * From any class-type S to any interface-type T, provided S is not sealed // * From any interface-type S to any class-type T, provided T is not sealed // * From any interface-type S to any interface-type T, provided S is not derived from T. - if (typeSrc.IsAggregateType() && typeDst.IsAggregateType()) + if (typeSrc is AggregateType atSrc && typeDst is AggregateType atDst) { - AggregateSymbol aggSrc = typeSrc.AsAggregateType().getAggregate(); - AggregateSymbol aggDest = typeDst.AsAggregateType().getAggregate(); + AggregateSymbol aggSrc = atSrc.getAggregate(); + AggregateSymbol aggDest = atDst.getAggregate(); if ((aggSrc.IsClass() && !aggSrc.IsSealed() && aggDest.IsInterface()) || (aggSrc.IsInterface() && aggDest.IsClass() && !aggDest.IsSealed()) || @@ -115,44 +115,52 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - // * From an array-type S with an element type SE to an array-type T with an element type TE, provided all of the following are true: - // o S and T differ only in element type. (In other words, S and T have the same number of dimensions.) - // o An explicit reference conversion exists from SE to TE. - if (typeSrc.IsArrayType() && typeDst.IsArrayType()) + if (typeSrc is ArrayType arrSrc) { - return typeSrc.AsArrayType().rank == typeDst.AsArrayType().rank - && typeSrc.AsArrayType().IsSZArray == typeDst.AsArrayType().IsSZArray - && FExpRefConv(loader, typeSrc.AsArrayType().GetElementType(), typeDst.AsArrayType().GetElementType()); - } + // * From an array-type S with an element type SE to an array-type T with an element type TE, provided all of the following are true: + // o S and T differ only in element type. (In other words, S and T have the same number of dimensions.) + // o An explicit reference conversion exists from SE to TE. + if (typeDst is ArrayType arrDst) + { + return arrSrc.rank == arrDst.rank + && arrSrc.IsSZArray == arrDst.IsSZArray + && FExpRefConv(loader, arrSrc.GetElementType(), arrDst.GetElementType()); + } - // * From a one-dimensional array-type S[] to System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyList - // and their base interfaces, provided there is an explicit reference conversion from S to T. - if (typeSrc.IsArrayType()) - { - if (!typeSrc.AsArrayType().IsSZArray || - !typeDst.isInterfaceType() || typeDst.AsAggregateType().GetTypeArgsAll().Count != 1) + // * From a one-dimensional array-type S[] to System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyList + // and their base interfaces, provided there is an explicit reference conversion from S to T. + if (!arrSrc.IsSZArray || + !typeDst.isInterfaceType()) { return false; } - AggregateSymbol aggIList = loader.GetOptPredefAgg(PredefinedType.PT_G_ILIST); - AggregateSymbol aggIReadOnlyList = loader.GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST); + AggregateType aggDst = (AggregateType)typeDst; + TypeArray typeArgsAll = aggDst.GetTypeArgsAll(); + + if (typeArgsAll.Count != 1) + { + return false; + } + + AggregateSymbol aggIList = loader.GetPredefAgg(PredefinedType.PT_G_ILIST); + AggregateSymbol aggIReadOnlyList = loader.GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST); if ((aggIList == null || - !loader.IsBaseAggregate(aggIList, typeDst.AsAggregateType().getAggregate())) && + !loader.IsBaseAggregate(aggIList, aggDst.getAggregate())) && (aggIReadOnlyList == null || - !loader.IsBaseAggregate(aggIReadOnlyList, typeDst.AsAggregateType().getAggregate()))) + !loader.IsBaseAggregate(aggIReadOnlyList, aggDst.getAggregate()))) { return false; } - return FExpRefConv(loader, typeSrc.AsArrayType().GetElementType(), typeDst.AsAggregateType().GetTypeArgsAll()[0]); + return FExpRefConv(loader, arrSrc.GetElementType(), typeArgsAll[0]); } - if (typeDst.IsArrayType() && typeSrc.IsAggregateType()) + if (typeDst is ArrayType arrayDest && typeSrc is AggregateType aggtypeSrc) { // * From System.Array and the interfaces it implements, to any array-type. - if (loader.HasIdentityOrImplicitReferenceConversion(loader.GetReqPredefType(PredefinedType.PT_ARRAY), typeSrc)) + if (loader.HasIdentityOrImplicitReferenceConversion(loader.GetPredefindType(PredefinedType.PT_ARRAY), typeSrc)) { return true; } @@ -161,16 +169,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // one-dimensional array-type S[], provided there is an implicit or explicit reference conversion from S[] to // System.Collections.Generic.IList or System.Collections.Generic.IReadOnlyList. This is precisely when either S and T // are the same type or there is an implicit or explicit reference conversion from S to T. - ArrayType arrayDest = typeDst.AsArrayType(); - AggregateType aggtypeSrc = typeSrc.AsAggregateType(); if (!arrayDest.IsSZArray || !typeSrc.isInterfaceType() || aggtypeSrc.GetTypeArgsAll().Count != 1) { return false; } - AggregateSymbol aggIList = loader.GetOptPredefAgg(PredefinedType.PT_G_ILIST); - AggregateSymbol aggIReadOnlyList = loader.GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST); + AggregateSymbol aggIList = loader.GetPredefAgg(PredefinedType.PT_G_ILIST); + AggregateSymbol aggIReadOnlyList = loader.GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST); if ((aggIList == null || !loader.IsBaseAggregate(aggIList, aggtypeSrc.getAggregate())) && @@ -229,8 +235,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } TypeArray pTypeParams = pSource.getAggregate().GetTypeVarsAll(); - TypeArray pSourceArgs = pSource.AsAggregateType().GetTypeArgsAll(); - TypeArray pTargetArgs = pTarget.AsAggregateType().GetTypeArgsAll(); + TypeArray pSourceArgs = ((AggregateType)pSource).GetTypeArgsAll(); + TypeArray pTargetArgs = ((AggregateType)pTarget).GetTypeArgsAll(); Debug.Assert(pTypeParams.Count == pSourceArgs.Count); Debug.Assert(pTypeParams.Count == pTargetArgs.Count); @@ -242,11 +248,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // If they're identical then this one is automatically good, so skip it. // If we have an error type, then we're in some fault tolerance. Let it through. - if (pSourceArg == pTargetArg || pTargetArg.IsErrorType() || pSourceArg.IsErrorType()) + if (pSourceArg == pTargetArg || pTargetArg is ErrorType || pSourceArg is ErrorType) { continue; } - TypeParameterType pParam = pTypeParams[iParam].AsTypeParameterType(); + TypeParameterType pParam = (TypeParameterType)pTypeParams[iParam]; if (pParam.Invariant) { return false; @@ -278,10 +284,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Always returns false if the types are error, anonymous method, or method group ***************************************************************************************************/ - public static bool FIsSameType(CType typeSrc, CType typeDst) - { - return typeSrc == typeDst && !typeSrc.IsNeverSameType(); - } + /*************************************************************************************************** Determines whether there is a boxing conversion from typeSrc to typeDst @@ -309,11 +312,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics interface of I. ***************************************************************************************************/ - public static bool FBoxingConv(SymbolLoader loader, CType typeSrc, CType typeDst) - { - return loader.HasImplicitBoxingConversion(typeSrc, typeDst); - } - /*************************************************************************************************** Determines whether there is a wrapping conversion from typeSrc to typeDst @@ -325,7 +323,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ***************************************************************************************************/ public static bool FWrappingConv(CType typeSrc, CType typeDst) { - return typeDst.IsNullableType() && typeSrc == typeDst.AsNullableType().GetUnderlyingType(); + return typeDst is NullableType nubDst && typeSrc == nubDst.GetUnderlyingType(); } /*************************************************************************************************** diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/AggregateDeclaration.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/AggregateDeclaration.cs index 32ed93e6d0..8dbc7213c6 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/AggregateDeclaration.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/AggregateDeclaration.cs @@ -10,7 +10,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // AggregateDeclaration // - // AggregateDeclaration - represents a declaration of a aggregate type. With partial classes, + // AggregateDeclaration - represents a declaration of an aggregate type. With partial classes, // an aggregate type might be declared in multiple places. This symbol represents // on of the declarations. // @@ -26,7 +26,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public AggregateSymbol Agg() { - return bag.AsAggregateSymbol(); + return bag as AggregateSymbol; } public Assembly GetAssembly() diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs index b55cf07078..78b895bfaf 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs @@ -105,19 +105,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - if (_typeSrc == null || _typeDest == null || _typeSrc.IsErrorType() || - _typeDest.IsErrorType() || _typeDest.IsNeverSameType()) + if (_typeSrc == null || _typeDest == null || _typeSrc is ErrorType || + _typeDest is ErrorType || _typeDest.IsNeverSameType()) { return false; } - if (_typeDest.IsNullableType()) + if (_typeDest is NullableType) { // This is handled completely by BindImplicitConversion. return false; } - if (_typeSrc.IsNullableType()) + if (_typeSrc is NullableType) { return bindExplicitConversionFromNub(); } @@ -135,42 +135,45 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (_typeDest.GetTypeKind()) { default: - VSFAIL("Bad type kind"); + Debug.Fail($"Bad type kind: {_typeDest.GetTypeKind()}"); return false; + case TypeKind.TK_VoidType: return false; // Can't convert to a method group or anon method. + case TypeKind.TK_NullType: return false; // Can never convert TO the null type. - case TypeKind.TK_TypeParameterType: - if (bindExplicitConversionToTypeVar()) - { - return true; - } - break; + case TypeKind.TK_ArrayType: - if (bindExplicitConversionToArray(_typeDest.AsArrayType())) + if (bindExplicitConversionToArray((ArrayType)_typeDest)) { return true; } + break; + case TypeKind.TK_PointerType: if (bindExplicitConversionToPointer()) { return true; } + break; + case TypeKind.TK_AggregateType: { - AggCastResult result = bindExplicitConversionToAggregate(_typeDest.AsAggregateType()); + AggCastResult result = bindExplicitConversionToAggregate(_typeDest as AggregateType); if (result == AggCastResult.Success) { return true; } + if (result == AggCastResult.Abort) { return false; } + break; } } @@ -180,6 +183,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return _binder.bindUserDefinedConversion(_exprSrc, _typeSrc, _typeDest, _needsExprDest, out _exprDest, false); } + return false; } @@ -195,16 +199,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (_needsExprDest) { Expr valueSrc = _exprSrc; - // This is a holdover from the days when you could have nullable of nullable. - // Can we remove this loop? - while (valueSrc.Type.IsNullableType()) + if (valueSrc.Type is NullableType) { valueSrc = _binder.BindNubValue(valueSrc); } + Debug.Assert(valueSrc.Type == _typeSrc.StripNubs()); if (!_binder.BindExplicitConversion(valueSrc, valueSrc.Type, _exprTypeDest, _pDestinationTypeForLambdaErrorReporting, _needsExprDest, out _exprDest, _flags | CONVERTTYPE.NOUDC)) { - VSFAIL("BindExplicitConversion failed unexpectedly"); + Debug.Fail("BindExplicitConversion failed unexpectedly"); return false; } if (_exprDest is ExprUserDefinedConversion udc) @@ -234,25 +237,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(_typeSrc != null); Debug.Assert(_typeDest != null); - if (!_typeSrc.IsArrayType() || !_typeSrc.AsArrayType().IsSZArray || - !_typeDest.isInterfaceType() || _typeDest.AsAggregateType().GetTypeArgsAll().Count != 1) + if (!(_typeSrc is ArrayType arrSrc) || !arrSrc.IsSZArray || !(_typeDest is AggregateType aggDest) + || !aggDest.isInterfaceType() || aggDest.GetTypeArgsAll().Count != 1) { return false; } - AggregateSymbol aggIList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_ILIST); - AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST); + AggregateSymbol aggIList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_ILIST); + AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST); if ((aggIList == null || - !GetSymbolLoader().IsBaseAggregate(aggIList, _typeDest.AsAggregateType().getAggregate())) && + !GetSymbolLoader().IsBaseAggregate(aggIList, aggDest.getAggregate())) && (aggIReadOnlyList == null || - !GetSymbolLoader().IsBaseAggregate(aggIReadOnlyList, _typeDest.AsAggregateType().getAggregate()))) + !GetSymbolLoader().IsBaseAggregate(aggIReadOnlyList, aggDest.getAggregate()))) { return false; } - CType typeArr = _typeSrc.AsArrayType().GetElementType(); - CType typeLst = _typeDest.AsAggregateType().GetTypeArgsAll()[0]; + CType typeArr = arrSrc.GetElementType(); + CType typeLst = aggDest.GetTypeArgsAll()[0]; if (!CConversions.FExpRefConv(GetSymbolLoader(), typeArr, typeLst)) { @@ -264,50 +267,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - private bool bindExplicitConversionToTypeVar() - { - // 13.2.3 Explicit reference conversions - // - // For a type-parameter T that is known to be a reference type (25.7), the following - // explicit reference conversions exist: - // - // * From the effective base class C of T to T and from any base class of C to T. - // * From any interface-type to T. - // * From a type-parameter U to T provided that T depends on U (25.7). - - Debug.Assert(_typeSrc != null); - Debug.Assert(_typeDest != null); - - // NOTE: for the flags, we have to use EXPRFLAG.EXF_FORCE_UNBOX (not EXPRFLAG.EXF_REFCHECK) even when - // we know that the type is a reference type. The verifier expects all code for - // type parameters to behave as if the type parameter is a value type. - // The jitter should be smart about it.... - if (_typeSrc.isInterfaceType() || _binder.canConvert(_typeDest, _typeSrc, CONVERTTYPE.NOUDC)) - { - if (!_needsExprDest) - { - return true; - } - - // There is an explicit, possibly unboxing, conversion from Object or any interface to - // a type variable. This will involve a type check and possibly an unbox. - // There is an explicit conversion from non-interface X to the type var iff there is an - // implicit conversion from the type var to X. - if (_typeSrc.IsTypeParameterType()) - { - // Need to box first before unboxing. - Expr exprT; - ExprClass exprObj = GetExprFactory().CreateClass(_binder.GetReqPDT(PredefinedType.PT_OBJECT)); - _binder.bindSimpleCast(_exprSrc, exprObj, out exprT, EXPRFLAG.EXF_FORCE_BOX); - _exprSrc = exprT; - } - if (_needsExprDest) - _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_FORCE_UNBOX); - return true; - } - return false; - } - private bool bindExplicitConversionFromIListToArray(ArrayType arrayDest) { // 13.2.2 @@ -319,25 +278,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // S[] to System.Collections.Generic.IList or System.Collections.Generic.IReadOnlyList. This is precisely when either S and T // are the same type or there is an implicit or explicit reference conversion from S to T. - if (!arrayDest.IsSZArray || !_typeSrc.isInterfaceType() || - _typeSrc.AsAggregateType().GetTypeArgsAll().Count != 1) + if (!arrayDest.IsSZArray || !(_typeSrc is AggregateType aggSrc) || !aggSrc.isInterfaceType() || + aggSrc.GetTypeArgsAll().Count != 1) { return false; } - AggregateSymbol aggIList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_ILIST); - AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetOptPredefAgg(PredefinedType.PT_G_IREADONLYLIST); + AggregateSymbol aggIList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_ILIST); + AggregateSymbol aggIReadOnlyList = GetSymbolLoader().GetPredefAgg(PredefinedType.PT_G_IREADONLYLIST); if ((aggIList == null || - !GetSymbolLoader().IsBaseAggregate(aggIList, _typeSrc.AsAggregateType().getAggregate())) && + !GetSymbolLoader().IsBaseAggregate(aggIList, aggSrc.getAggregate())) && (aggIReadOnlyList == null || - !GetSymbolLoader().IsBaseAggregate(aggIReadOnlyList, _typeSrc.AsAggregateType().getAggregate()))) + !GetSymbolLoader().IsBaseAggregate(aggIReadOnlyList, aggSrc.getAggregate()))) { return false; } CType typeArr = arrayDest.GetElementType(); - CType typeLst = _typeSrc.AsAggregateType().GetTypeArgsAll()[0]; + CType typeLst = aggSrc.GetTypeArgsAll()[0]; Debug.Assert(!typeArr.IsNeverSameType()); if (typeArr != typeLst && !CConversions.FExpRefConv(GetSymbolLoader(), typeArr, typeLst)) @@ -383,9 +342,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(_typeSrc != null); Debug.Assert(arrayDest != null); - if (_typeSrc.IsArrayType()) + if (_typeSrc is ArrayType arrSrc) { - return bindExplicitConversionFromArrayToArray(_typeSrc.AsArrayType(), arrayDest); + return bindExplicitConversionFromArrayToArray(arrSrc, arrayDest); } if (bindExplicitConversionFromIListToArray(arrayDest)) @@ -399,7 +358,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // * From System.Array and the interfaces it implements, to any array-type. - if (_binder.canConvert(_binder.GetReqPDT(PredefinedType.PT_ARRAY), _typeSrc, CONVERTTYPE.NOUDC)) + if (_binder.canConvert(_binder.GetPredefindType(PredefinedType.PT_ARRAY), _typeSrc, CONVERTTYPE.NOUDC)) { if (_needsExprDest) _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_REFCHECK); @@ -418,7 +377,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // * From any pointer-type to any other pointer-type. // * From sbyte, byte, short, ushort, int, uint, long, or ulong to any pointer-type. - if (_typeSrc.IsPointerType() || _typeSrc.fundType() <= FUNDTYPE.FT_LASTINTEGRAL && _typeSrc.isNumericType()) + if (_typeSrc is PointerType || _typeSrc.fundType() <= FUNDTYPE.FT_LASTINTEGRAL && _typeSrc.isNumericType()) { if (_needsExprDest) _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest); @@ -531,7 +490,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(aggTypeDest != null); Debug.Assert(aggTypeDest.isPredefType(PredefinedType.PT_DECIMAL)); - AggregateType underlyingType = _typeSrc.underlyingType().AsAggregateType(); + AggregateType underlyingType = _typeSrc.underlyingType() as AggregateType; // Need to first cast the source expr to its underlying type. @@ -708,15 +667,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(_typeSrc != null); Debug.Assert(aggTypeDest != null); - if (!_typeSrc.IsAggregateType()) + if (!(_typeSrc is AggregateType atSrc)) { return AggCastResult.Failure; } - AggregateSymbol aggSrc = _typeSrc.AsAggregateType().getAggregate(); + AggregateSymbol aggSrc = atSrc.getAggregate(); AggregateSymbol aggDest = aggTypeDest.getAggregate(); - if (GetSymbolLoader().HasBaseConversion(aggTypeDest, _typeSrc.AsAggregateType())) + if (GetSymbolLoader().HasBaseConversion(aggTypeDest, atSrc)) { if (_needsExprDest) { @@ -752,7 +711,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // * From any pointer-type to sbyte, byte, short, ushort, int, uint, long, or ulong. - if (!_typeSrc.IsPointerType() || aggTypeDest.fundType() > FUNDTYPE.FT_LASTINTEGRAL || !aggTypeDest.isNumericType()) + if (!(_typeSrc is PointerType) || aggTypeDest.fundType() > FUNDTYPE.FT_LASTINTEGRAL || !aggTypeDest.isNumericType()) { return AggCastResult.Failure; } @@ -761,30 +720,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return AggCastResult.Success; } - private AggCastResult bindExplicitConversionFromTypeVarToAggregate(AggregateType aggTypeDest) - { - // 13.2.3 Explicit reference conversions - // - // For a type-parameter T that is known to be a reference type (25.7), the following - // explicit reference conversions exist: - // - // * From T to any interface-type I provided there isn't already an implicit reference - // conversion from T to I. - - if (!_typeSrc.IsTypeParameterType()) - { - return AggCastResult.Failure; - } - if (aggTypeDest.getAggregate().IsInterface()) - { - // Explicit conversion of type variables to interfaces. - if (_needsExprDest) - _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_FORCE_BOX | EXPRFLAG.EXF_REFCHECK); - return AggCastResult.Success; - } - return AggCastResult.Failure; - } - private AggCastResult bindExplicitConversionToAggregate(AggregateType aggTypeDest) { Debug.Assert(_typeSrc != null); @@ -820,19 +755,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return result; } - if (_typeSrc.IsVoidType()) + if (_typeSrc is VoidType) { // No conversion is allowed to or from a void type (user defined or otherwise) // This is most likely the result of a failed anonymous method or member group conversion return AggCastResult.Abort; } - result = bindExplicitConversionFromTypeVarToAggregate(aggTypeDest); - if (result != AggCastResult.Failure) - { - return result; - } - return AggCastResult.Failure; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs index 159f157f43..99814e51ea 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs @@ -27,21 +27,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public ExprField CreateField(CType type, Expr optionalObject, FieldWithType field, bool isLValue) => new ExprField(type, optionalObject, field, isLValue); - public ExprFuncPtr CreateFunctionPointer(EXPRFLAG flags, CType type, Expr obj, MethWithInst method) => - new ExprFuncPtr(type, flags, obj, method); - public ExprArrayInit CreateArrayInit(CType type, Expr arguments, Expr argumentDimensions, int[] dimSizes, int dimSize) => new ExprArrayInit(type, arguments, argumentDimensions, dimSizes, dimSize); - public ExprProperty CreateProperty(CType type, Expr optionalObject) => - CreateProperty(type, null, null, CreateMemGroup(optionalObject, new MethPropWithInst()), null, null); - public ExprProperty CreateProperty(CType type, Expr optionalObjectThrough, Expr arguments, ExprMemberGroup memberGroup, PropWithType property, MethWithType setMethod) => new ExprProperty(type, optionalObjectThrough, arguments, memberGroup, property, setMethod); - public ExprEvent CreateEvent(CType type, Expr optionalObject, EventWithType eventWithType) => - new ExprEvent(type, optionalObject, eventWithType); - public ExprMemberGroup CreateMemGroup(EXPRFLAG flags, Name name, TypeArray typeArgs, SYMKIND symKind, CType parentType, MethodOrPropertySymbol memberSymbol, Expr obj, CMemberLookupResults memberLookupResults) => new ExprMemberGroup(Types.GetMethGrpType(), flags, name, typeArgs, symKind, parentType, memberSymbol, obj, memberLookupResults); @@ -72,7 +63,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics new ExprBoundLambda(delegateType, argumentScope); public ExprHoistedLocalExpr CreateHoistedLocalInExpression() => - new ExprHoistedLocalExpr(Types.GetOptPredefAgg(PredefinedType.PT_EXPRESSION).getThisType()); + new ExprHoistedLocalExpr(Types.GetPredefAgg(PredefinedType.PT_EXPRESSION).getThisType()); public ExprMethodInfo CreateMethodInfo(MethPropWithInst mwi) => CreateMethodInfo(mwi.Meth(), mwi.GetType(), mwi.TypeArgs); @@ -80,35 +71,28 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public ExprMethodInfo CreateMethodInfo(MethodSymbol method, AggregateType methodType, TypeArray methodParameters) { return new ExprMethodInfo( - Types.GetOptPredefAgg(method.IsConstructor() ? PredefinedType.PT_CONSTRUCTORINFO : PredefinedType.PT_METHODINFO).getThisType(), + Types.GetPredefAgg(method.IsConstructor() ? PredefinedType.PT_CONSTRUCTORINFO : PredefinedType.PT_METHODINFO).getThisType(), method, methodType, methodParameters); } public ExprPropertyInfo CreatePropertyInfo(PropertySymbol prop, AggregateType propertyType) => - new ExprPropertyInfo(Types.GetOptPredefAgg(PredefinedType.PT_PROPERTYINFO).getThisType(), prop, propertyType); + new ExprPropertyInfo(Types.GetPredefAgg(PredefinedType.PT_PROPERTYINFO).getThisType(), prop, propertyType); public ExprFieldInfo CreateFieldInfo(FieldSymbol field, AggregateType fieldType) => - new ExprFieldInfo(field, fieldType, Types.GetOptPredefAgg(PredefinedType.PT_FIELDINFO).getThisType()); + new ExprFieldInfo(field, fieldType, Types.GetPredefAgg(PredefinedType.PT_FIELDINFO).getThisType()); private ExprTypeOf CreateTypeOf(ExprClass sourceType) => - new ExprTypeOf(Types.GetReqPredefAgg(PredefinedType.PT_TYPE).getThisType(), sourceType); + new ExprTypeOf(Types.GetPredefAgg(PredefinedType.PT_TYPE).getThisType(), sourceType); public ExprTypeOf CreateTypeOf(CType sourceType) => CreateTypeOf(CreateClass(sourceType)); public ExprUserLogicalOp CreateUserLogOp(CType type, Expr trueFalseCall, ExprCall operatorCall) => new ExprUserLogicalOp(type, trueFalseCall, operatorCall); - public ExprUserLogicalOp CreateUserLogOpError(CType type, Expr trueFalseCall, ExprCall operatorCall) - { - ExprUserLogicalOp rval = CreateUserLogOp(type, trueFalseCall, operatorCall); - rval.SetError(); - return rval; - } - public ExprConcat CreateConcat(Expr first, Expr second) => new ExprConcat(first, second); public ExprConstant CreateStringConstant(string str) => - CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_STRING).getThisType(), ConstVal.Get(str)); + CreateConstant(Types.GetPredefAgg(PredefinedType.PT_STRING).getThisType(), ConstVal.Get(str)); public ExprMultiGet CreateMultiGet(EXPRFLAG flags, CType type, ExprMulti multi) => new ExprMultiGet(type, flags, multi); @@ -124,13 +108,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // This returns a null for reference types and an EXPRZEROINIT for all others. - public Expr CreateZeroInit(CType type) => CreateZeroInit(CreateClass(type), null, false); - - private Expr CreateZeroInit(ExprClass typeExpr, Expr originalConstructorCall, bool isConstructor) + public Expr CreateZeroInit(CType type) { - Debug.Assert(typeExpr != null); - CType type = typeExpr.Type; - bool isError = false; + Debug.Assert(type != null); if (type.isEnumType()) { @@ -139,78 +119,44 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return CreateConstant(type, ConstVal.Get(Activator.CreateInstance(type.AssociatedSystemType))); } + Debug.Assert(type.fundType() > FUNDTYPE.FT_NONE); + Debug.Assert(type.fundType() < FUNDTYPE.FT_COUNT); switch (type.fundType()) { case FUNDTYPE.FT_PTR: { - CType nullType = Types.GetNullType(); - - // It looks like this if is always false ... - if (nullType.fundType() == type.fundType()) - { - // Create a constant here. - return CreateConstant(type, ConstVal.GetDefaultValue(ConstValKind.IntPtr)); - } - // Just allocate a new node and fill it in. - return CreateCast(0, typeExpr, CreateNull()); + return CreateCast(0, CreateClass(type), CreateNull()); } - case FUNDTYPE.FT_REF: - case FUNDTYPE.FT_I1: - case FUNDTYPE.FT_U1: - case FUNDTYPE.FT_I2: - case FUNDTYPE.FT_U2: - case FUNDTYPE.FT_I4: - case FUNDTYPE.FT_U4: - case FUNDTYPE.FT_I8: - case FUNDTYPE.FT_U8: - case FUNDTYPE.FT_R4: - case FUNDTYPE.FT_R8: - return CreateConstant(type, ConstVal.GetDefaultValue(type.constValKind())); case FUNDTYPE.FT_STRUCT: if (type.isPredefType(PredefinedType.PT_DECIMAL)) { - goto case FUNDTYPE.FT_R8; + goto default; } - break; + goto case FUNDTYPE.FT_VAR; case FUNDTYPE.FT_VAR: - break; + return new ExprZeroInit(type); default: - isError = true; - break; + return CreateConstant(type, ConstVal.GetDefaultValue(type.constValKind())); } - - return new ExprZeroInit(type, originalConstructorCall, isConstructor, isError); } public ExprConstant CreateConstant(CType type, ConstVal constVal) => new ExprConstant(type, constVal); public ExprConstant CreateIntegerConstant(int x) => - CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_INT).getThisType(), ConstVal.Get(x)); + CreateConstant(Types.GetPredefAgg(PredefinedType.PT_INT).getThisType(), ConstVal.Get(x)); public ExprConstant CreateBoolConstant(bool b) => - CreateConstant(Types.GetReqPredefAgg(PredefinedType.PT_BOOL).getThisType(), ConstVal.Get(b)); + CreateConstant(Types.GetPredefAgg(PredefinedType.PT_BOOL).getThisType(), ConstVal.Get(b)); public ExprBlock CreateBlock(ExprStatement pOptionalStatements) => new ExprBlock(pOptionalStatements); - public ExprArrayIndex CreateArrayIndex(Expr array, Expr index) - { - CType type = array.Type; - if (type is ArrayType arr) - { - type = arr.GetElementType(); - } - else if (type == null) - { - type = Types.GetReqPredefAgg(PredefinedType.PT_INT).getThisType(); - } - - return new ExprArrayIndex(type, array, index); - } + public ExprArrayIndex CreateArrayIndex(CType type, Expr array, Expr index) => + new ExprArrayIndex(type, array, index); public ExprBinOp CreateBinop(ExpressionKind exprKind, CType type, Expr left, Expr right) => new ExprBinOp(exprKind, type, left, right); diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs index ee75e7b38e..e604eca643 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using System.Diagnostics; using Microsoft.CSharp.RuntimeBinder.Errors; @@ -63,6 +64,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Lim } + [Flags] internal enum UnaOpMask { None = 0, @@ -78,6 +80,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Bool = Bang, } + [Flags] internal enum OpSigFlags { None = 0, @@ -90,6 +93,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics BoolBit = Convert | CanLift, } + [Flags] internal enum LiftFlags { None = 0, @@ -259,11 +263,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public BindingContext GetContext() { return Context; } private CNullable m_nullable; - private static void VSFAIL(string s) - { - Debug.Assert(false, s); - } - public ExpressionBinder(BindingContext context) { Context = context; @@ -358,33 +357,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private ExprFactory ExprFactory { get { return Context.ExprFactory; } } - private AggregateType GetReqPDT(PredefinedType pt) + private AggregateType GetPredefindType(PredefinedType pt) { - return GetReqPDT(pt, GetSymbolLoader()); - } + Debug.Assert(pt != PredefinedType.PT_VOID); // use getVoidType() - private static AggregateType GetReqPDT(PredefinedType pt, SymbolLoader symbolLoader) - { - Debug.Assert(pt != PredefinedType.PT_VOID); // use getVoidType() - return symbolLoader.GetReqPredefType(pt); - } - - private AggregateType GetOptPDT(PredefinedType pt) - { - return GetOptPDT(pt, true); - } - - private AggregateType GetOptPDT(PredefinedType pt, bool WarnIfNotFound) - { - Debug.Assert(pt != PredefinedType.PT_VOID); // use getVoidType() - if (WarnIfNotFound) - { - return GetSymbolLoader().GetOptPredefTypeErr(pt); - } - else - { - return GetSymbolLoader().GetOptPredefType(pt); - } + return GetSymbolLoader().GetPredefindType(pt); } private CType VoidType { get { return GetSymbolLoader().GetTypeManager().GetVoid(); } } @@ -413,8 +390,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics || op1 is ExprCall || op1 is ExprProperty || op1 is ExprClass - || op1 is ExprField - || op1 is ExprEvent); + || op1 is ExprField); if (!checkLvalue(op1, CheckLvalueKind.Assignment)) { @@ -427,48 +403,23 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GenerateOptimizedAssignment(op1, op2); } - internal Expr BindArrayIndexCore(BindingFlag bindFlags, Expr pOp1, Expr pOp2) + internal Expr BindArrayIndexCore(Expr pOp1, Expr pOp2) { - Expr pExpr; - bool bIsError = false; - if (!pOp1.IsOK || !pOp2.IsOK) - { - bIsError = true; - } + bool bIsError = !pOp1.IsOK || !pOp2.IsOK; - CType pIntType = GetReqPDT(PredefinedType.PT_INT); + CType pIntType = GetPredefindType(PredefinedType.PT_INT); - // Array indexing must occur on an array type. - if (!pOp1.Type.IsArrayType()) - { - Debug.Assert(!pOp1.Type.IsPointerType()); - pExpr = bindIndexer(pOp1, pOp2, bindFlags); - if (bIsError) - { - pExpr.SetError(); - } - return pExpr; - } - ArrayType pArrayType = pOp1.Type.AsArrayType(); - checkUnsafe(pArrayType.GetElementType()); // added to the binder so we don't bind to pointer ops + ArrayType pArrayType = pOp1.Type as ArrayType; + Debug.Assert(pArrayType != null); + CType elementType = pArrayType.GetElementType(); + checkUnsafe(elementType); // added to the binder so we don't bind to pointer ops // Check the rank of the array against the number of indices provided, and // convert the indexes to ints - CType pDestType = chooseArrayIndexType(pOp2); - - if (null == pDestType) - { - // using int as the type will allow us to give a better error... - pDestType = pIntType; - } - - int rank = pArrayType.rank; - int cIndices = 0; - + CType pDestType = ChooseArrayIndexType(pOp2); Expr transformedIndices = pOp2.Map(GetExprFactory(), - (Expr x) => + x => { - cIndices++; Expr pTemp = mustConvert(x, pDestType); if (pDestType == pIntType) return pTemp; @@ -476,18 +427,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GetExprFactory().CreateCast(EXPRFLAG.EXF_INDEXEXPR, exprType, pTemp); }); - if (cIndices != rank) - { - ErrorContext.Error(ErrorCode.ERR_BadIndexCount, rank); - pExpr = GetExprFactory().CreateArrayIndex(pOp1, transformedIndices); - pExpr.SetError(); - return pExpr; - } - // Allocate a new expression, the type is the element type of the array. // Array index operations are always lvalues. - pExpr = GetExprFactory().CreateArrayIndex(pOp1, transformedIndices); - pExpr.Flags |= EXPRFLAG.EXF_LVALUE | EXPRFLAG.EXF_ASSGOP; + Expr pExpr = GetExprFactory().CreateArrayIndex(elementType, pOp1, transformedIndices); if (bIsError) { @@ -497,80 +439,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return pExpr; } - private Expr bindIndexer(Expr pObject, Expr args, BindingFlag bindFlags) - { - CType type = pObject.Type; - - if (!type.IsAggregateType() && !type.IsTypeParameterType()) - { - ErrorContext.Error(ErrorCode.ERR_BadIndexLHS, type); - MethWithInst mwi = new MethWithInst(null, null); - ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(pObject, mwi); - ExprCall rval = GetExprFactory().CreateCall(0, type, args, pMemGroup, null); - rval.SetError(); - return rval; - } - - Name pName = NameManager.GetPredefinedName(PredefinedName.PN_INDEXERINTERNAL); - - MemberLookup mem = new MemberLookup(); - if (!mem.Lookup(GetSemanticChecker(), type, pObject, ContextForMemberLookup(), pName, 0, - (bindFlags & BindingFlag.BIND_BASECALL) != 0 ? (MemLookFlags.BaseCall | MemLookFlags.Indexer) : MemLookFlags.Indexer)) - { - mem.ReportErrors(); - type = GetTypes().GetErrorSym(); - Symbol pSymbol = null; - - if (mem.SwtInaccessible().Sym != null) - { - Debug.Assert(mem.SwtInaccessible().Sym.IsMethodOrPropertySymbol()); - type = mem.SwtInaccessible().MethProp().RetType; - pSymbol = mem.SwtInaccessible().Sym; - } - - ExprMemberGroup memgrp = null; - - if (pSymbol != null) - { - memgrp = GetExprFactory().CreateMemGroup((EXPRFLAG)mem.GetFlags(), - pName, BSYMMGR.EmptyTypeArray(), pSymbol.getKind(), mem.GetSourceType(), null/*pMPS*/, mem.GetObject(), mem.GetResults()); - memgrp.SetInaccessibleBit(); - } - else - { - MethWithInst mwi = new MethWithInst(null, null); - memgrp = GetExprFactory().CreateMemGroup(mem.GetObject(), mwi); - } - - ExprCall rval = GetExprFactory().CreateCall(0, type, args, memgrp, null); - rval.SetError(); - return rval; - } - - Debug.Assert(mem.SymFirst().IsPropertySymbol() && mem.SymFirst().AsPropertySymbol().isIndexer()); - - ExprMemberGroup grp = GetExprFactory().CreateMemGroup((EXPRFLAG)mem.GetFlags(), - pName, BSYMMGR.EmptyTypeArray(), mem.SymFirst().getKind(), mem.GetSourceType(), null/*pMPS*/, mem.GetObject(), mem.GetResults()); - - Expr pResult = BindMethodGroupToArguments(bindFlags, grp, args); - IExprWithObject exprWithObject = pResult as IExprWithObject; - Debug.Assert(exprWithObject != null); - if (exprWithObject?.OptionalObject == null) - { - // We must be in an error scenario where the object was not allowed. - // This can happen if the user tries to access the indexer off the - // type and not an instance or if the incorrect type/number of arguments - // were passed for binding. - if (exprWithObject != null) - { - exprWithObject.OptionalObject = pObject; - } - - pResult.SetError(); - } - return pResult; - } - //////////////////////////////////////////////////////////////////////////////// // Create a cast node with the given expression flags. private void bindSimpleCast(Expr exprSrc, ExprClass typeDest, out Expr pexprDest) @@ -626,15 +494,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private ExprCall BindToMethod(MethWithInst mwi, Expr pArguments, ExprMemberGroup pMemGroup, MemLookFlags flags) { - Debug.Assert(mwi.Sym != null && mwi.Sym.IsMethodSymbol() && (!mwi.Meth().isOverride || mwi.Meth().isHideByName)); + Debug.Assert(mwi.Sym is MethodSymbol && (!mwi.Meth().isOverride || mwi.Meth().isHideByName)); Debug.Assert(pMemGroup != null); bool fConstrained; - bool bIsMatchingStatic; Expr pObject = pMemGroup.OptionalObject; CType callingObjectType = pObject?.Type; - PostBindMethod((flags & MemLookFlags.BaseCall) != 0, ref mwi, pObject); - pObject = AdjustMemberObject(mwi, pObject, out fConstrained, out bIsMatchingStatic); + PostBindMethod(ref mwi, pObject); + pObject = AdjustMemberObject(mwi, pObject, out fConstrained); pMemGroup.OptionalObject = pObject; CType pReturnType = null; @@ -648,10 +515,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } ExprCall pResult = GetExprFactory().CreateCall(0, pReturnType, pArguments, pMemGroup, mwi); - if (!bIsMatchingStatic) - { - pResult.SetMismatchedStaticBit(); - } if (!pResult.IsOK) { @@ -671,11 +534,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - if ((flags & MemLookFlags.BaseCall) != 0) - { - pResult.Flags |= EXPRFLAG.EXF_BASECALL; - } - else if (fConstrained && pObject != null) + if (fConstrained && pObject != null) { // Use the constrained prefix. pResult.Flags |= EXPRFLAG.EXF_CONSTRAINED; @@ -702,13 +561,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return pField; } - bool bIsMatchingStatic; bool pfConstrained; - pOptionalObject = AdjustMemberObject(fwt, pOptionalObject, out pfConstrained, out bIsMatchingStatic); + pOptionalObject = AdjustMemberObject(fwt, pOptionalObject, out pfConstrained); checkUnsafe(pFieldType); // added to the binder so we don't bind to pointer ops - bool isLValue = (pOptionalObject != null && pOptionalObject.Type.IsPointerType()) || objectIsLvalue(pOptionalObject); + bool isLValue = pOptionalObject?.Type is PointerType || objectIsLvalue(pOptionalObject); // Exception: a readonly field is not an lvalue unless we're in the constructor/static constructor appropriate // for the field. @@ -717,34 +575,26 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics isLValue = false; } - CType fieldType = null; + AggregateType fieldType = null; // If this field is the backing field of a WindowsRuntime event then we need to bind to its // invocationlist property which is a delegate containing all the handlers. if (fwt.Field().isEvent && fwt.Field().getEvent(GetSymbolLoader()) != null && fwt.Field().getEvent(GetSymbolLoader()).IsWindowsRuntimeEvent) { - fieldType = fwt.Field().GetType(); - if (fieldType.IsAggregateType()) + fieldType = fwt.Field().GetType() as AggregateType; + if (fieldType != null) { // Access event backing field (EventRegistrationTokenTable) using // EventRegistrationTokenTable.GetOrCreateEventRegistrationTokenTable() // to ensure non-null pFieldType = GetTypes().GetParameterModifier(pFieldType, false); } - else - { - fieldType = null; - } } ExprField pResult = GetExprFactory() .CreateField(pFieldType, pOptionalObject, fwt, isLValue); - if (!bIsMatchingStatic) - { - pResult.SetMismatchedStaticBit(); - } - if (pFieldType.IsErrorType()) + if (pFieldType is ErrorType) { pResult.SetError(); } @@ -762,15 +612,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MethodSymbol getOrCreateMethod = GetSymbolLoader() .LookupAggMember(getOrCreateMethodName, fieldType.getAggregate(), symbmask_t.MASK_MethodSymbol) - .AsMethodSymbol(); + as MethodSymbol; - MethPropWithInst getOrCreatempwi = new MethPropWithInst(getOrCreateMethod, fieldType.AsAggregateType()); + MethPropWithInst getOrCreatempwi = new MethPropWithInst(getOrCreateMethod, fieldType); ExprMemberGroup getOrCreateGrp = GetExprFactory().CreateMemGroup(null, getOrCreatempwi); Expr getOrCreateCall = BindToMethod( new MethWithInst(getOrCreatempwi), pResult, getOrCreateGrp, (MemLookFlags)MemLookFlags.None); - AggregateSymbol fieldTypeSymbol = fieldType.AsAggregateType().GetOwningAggregate(); + AggregateSymbol fieldTypeSymbol = fieldType.GetOwningAggregate(); Name invocationListName = NameManager.GetPredefinedName(PredefinedName.PN_INVOCATIONLIST); // InvocationList might not be populated in the symbol table as no one would have called it. @@ -780,12 +630,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics PropertySymbol invocationList = GetSymbolLoader() .LookupAggMember(invocationListName, fieldTypeSymbol, symbmask_t.MASK_PropertySymbol) - .AsPropertySymbol(); + as PropertySymbol; - MethPropWithInst mpwi = new MethPropWithInst(invocationList, fieldType.AsAggregateType()); + MethPropWithInst mpwi = new MethPropWithInst(invocationList, fieldType); ExprMemberGroup memGroup = GetExprFactory().CreateMemGroup(getOrCreateCall, mpwi); - PropWithType pwt = new PropWithType(invocationList, fieldType.AsAggregateType()); + PropWithType pwt = new PropWithType(invocationList, fieldType); Expr propertyExpr = BindToProperty(getOrCreateCall, pwt, bindFlags, null, null, memGroup); return propertyExpr; } @@ -798,12 +648,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal Expr BindToProperty(Expr pObject, PropWithType pwt, BindingFlag bindFlags, Expr args, AggregateType pOtherType, ExprMemberGroup pMemGroup) { Debug.Assert(pwt.Sym != null && - pwt.Sym.IsPropertySymbol() && + pwt.Sym is PropertySymbol && pwt.GetType() != null && pwt.Prop().getClass() == pwt.GetType().getAggregate()); - Debug.Assert(pwt.Prop().Params.Count == 0 || pwt.Prop().isIndexer()); + Debug.Assert(pwt.Prop().Params.Count == 0 || pwt.Prop() is IndexerSymbol); Debug.Assert(pOtherType == null || - !pwt.Prop().isIndexer() && + !(pwt.Prop() is IndexerSymbol) && pOtherType.getAggregate() == pwt.Prop().RetType.getAggregate()); bool fConstrained; @@ -813,16 +663,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // We keep track of the type of the pObject which we're doing the call through so that we can report // protection access errors later, either below when binding the get, or later when checking that - // the setter is actually an lvalue. If we're actually doing a base.prop call then we do not - // need to ensure that the left side of the dot is an instance of the derived class, otherwise - // we save it away for later. - if (0 == (bindFlags & BindingFlag.BIND_BASECALL)) - { - pObjectThrough = pObject; - } + // the setter is actually an lvalue. + pObjectThrough = pObject; - bool bIsMatchingStatic; - PostBindProperty((bindFlags & BindingFlag.BIND_BASECALL) != 0, pwt, pObject, out mwtGet, out mwtSet); + PostBindProperty(pwt, pObject, out mwtGet, out mwtSet); if (mwtGet && (!mwtSet || @@ -831,15 +675,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ) ) { - pObject = AdjustMemberObject(mwtGet, pObject, out fConstrained, out bIsMatchingStatic); + pObject = AdjustMemberObject(mwtGet, pObject, out fConstrained); } else if (mwtSet) { - pObject = AdjustMemberObject(mwtSet, pObject, out fConstrained, out bIsMatchingStatic); + pObject = AdjustMemberObject(mwtSet, pObject, out fConstrained); } else { - pObject = AdjustMemberObject(pwt, pObject, out fConstrained, out bIsMatchingStatic); + pObject = AdjustMemberObject(pwt, pObject, out fConstrained); } pMemGroup.OptionalObject = pObject; @@ -849,10 +693,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (pObject != null && !pObject.IsOK) { ExprProperty pResult = GetExprFactory().CreateProperty(pReturnType, pObjectThrough, args, pMemGroup, pwt, null); - if (!bIsMatchingStatic) - { - pResult.SetMismatchedStaticBit(); - } pResult.SetError(); return pResult; } @@ -868,16 +708,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return GetExprFactory().CreateClass(pOtherType); } - ErrorContext.ErrorRef(ErrorCode.ERR_PropertyLacksGet, pwt); - } - else if (((bindFlags & BindingFlag.BIND_BASECALL) != 0) && mwtGet.Meth().isAbstract) - { - // if the get exists, but is abstract, forbid the call as well... - if (pOtherType != null) - { - return GetExprFactory().CreateClass(pOtherType); - } - ErrorContext.Error(ErrorCode.ERR_AbstractBaseCall, pwt); + + throw ErrorContext.Error(ErrorCode.ERR_PropertyLacksGet, pwt); } else { @@ -898,28 +730,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (error == ACCESSERROR.ACCESSERROR_NOACCESSTHRU) { - ErrorContext.Error(ErrorCode.ERR_BadProtectedAccess, pwt, type, ContextForMemberLookup()); + throw ErrorContext.Error(ErrorCode.ERR_BadProtectedAccess, pwt, type, ContextForMemberLookup()); } else { - ErrorContext.ErrorRef(ErrorCode.ERR_InaccessibleGetter, pwt); + throw ErrorContext.Error(ErrorCode.ERR_InaccessibleGetter, pwt); } } } } ExprProperty result = GetExprFactory().CreateProperty(pReturnType, pObjectThrough, args, pMemGroup, pwt, mwtSet); - if (!bIsMatchingStatic) - { - result.SetMismatchedStaticBit(); - } - - Debug.Assert(EXPRFLAG.EXF_BASECALL == (EXPRFLAG)BindingFlag.BIND_BASECALL); - if ((EXPRFLAG.EXF_BASECALL & (EXPRFLAG)bindFlags) != 0) - { - result.Flags |= EXPRFLAG.EXF_BASECALL; - } - else if (fConstrained && pObject != null) + if (fConstrained && pObject != null) { // Use the constrained prefix. result.Flags |= EXPRFLAG.EXF_CONSTRAINED; @@ -955,11 +777,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_NullableType: typeSrc = typeSrc.StripNubs(); goto LAgain; - case TypeKind.TK_TypeParameterType: - typeSrc = typeSrc.AsTypeParameterType().GetEffectiveBaseClass(); - goto LAgain; case TypeKind.TK_AggregateType: - if (!typeSrc.isClassType() && !typeSrc.isStructType() || typeSrc.AsAggregateType().getAggregate().IsSkipUDOps()) + if (!typeSrc.isClassType() && !typeSrc.isStructType() || ((AggregateType)typeSrc).getAggregate().IsSkipUDOps()) return null; break; default: @@ -973,14 +792,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics List methFirstList = new List(); MethodSymbol methCur = null; - AggregateType atsCur = typeSrc.AsAggregateType(); + AggregateType atsCur = (AggregateType)typeSrc; for (; ;) { // Find the next operator. - methCur = (methCur == null) ? - GetSymbolLoader().LookupAggMember(pName, atsCur.getAggregate(), symbmask_t.MASK_MethodSymbol).AsMethodSymbol() : - GetSymbolLoader().LookupNextSym(methCur, atsCur.getAggregate(), symbmask_t.MASK_MethodSymbol).AsMethodSymbol(); + methCur = methCur == null + ? GetSymbolLoader().LookupAggMember(pName, atsCur.getAggregate(), symbmask_t.MASK_MethodSymbol) as MethodSymbol + : GetSymbolLoader().LookupNextSym(methCur, atsCur.getAggregate(), symbmask_t.MASK_MethodSymbol) as MethodSymbol; if (methCur == null) { @@ -1011,7 +830,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics 0, false)); } - else if (GetSymbolLoader().FCanLift() && typeParam.IsNonNubValType() && + else if (typeParam.IsNonNubValType() && GetTypes().SubstType(methCur.RetType, atsCur).IsNonNubValType() && canConvert(arg, nubParam = GetTypes().GetNullable(typeParam))) { @@ -1033,22 +852,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (pmethBest == null) { // No winner, so its an ambiguous call... - ErrorContext.Error(ErrorCode.ERR_AmbigCall, pmethAmbig1.mpwi, pmethAmbig2.mpwi); - - ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(null, pmethAmbig1.mpwi); - ExprCall rval = GetExprFactory().CreateCall(0, null, arg, pMemGroup, null); - rval.SetError(); - return rval; - } - - if (SemanticChecker.CheckBogus(pmethBest.mpwi.Meth())) - { - ErrorContext.ErrorRef(ErrorCode.ERR_BindToBogus, pmethBest.mpwi); - - ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(null, pmethBest.mpwi); - ExprCall rval = GetExprFactory().CreateCall(0, null, arg, pMemGroup, null); - rval.SetError(); - return rval; + throw ErrorContext.Error(ErrorCode.ERR_AmbigCall, pmethAmbig1.mpwi, pmethAmbig2.mpwi); } ExprCall call; @@ -1068,15 +872,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private ExprCall BindLiftedUDUnop(Expr arg, CType typeArg, MethPropWithInst mpwi) { CType typeRaw = typeArg.StripNubs(); - if (!arg.Type.IsNullableType() || !canConvert(arg.Type.StripNubs(), typeRaw, CONVERTTYPE.NOUDC)) + if (!(arg.Type is NullableType) || !canConvert(arg.Type.StripNubs(), typeRaw, CONVERTTYPE.NOUDC)) { // Convert then lift. arg = mustConvert(arg, typeArg); } - Debug.Assert(arg.Type.IsNullableType()); + Debug.Assert(arg.Type is NullableType); CType typeRet = GetTypes().SubstType(mpwi.Meth().RetType, mpwi.GetType()); - if (!typeRet.IsNullableType()) + if (!(typeRet is NullableType)) { typeRet = GetTypes().GetNullable(typeRet); } @@ -1108,7 +912,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Given a method group or indexer group, bind it to the arguments for an // invocation. This method can change the arguments to bind with Extension // Methods - private bool BindMethodGroupToArgumentsCore(out GroupToArgsBinderResult pResults, BindingFlag bindFlags, ExprMemberGroup grp, ref Expr args, int carg, bool bindingCollectionAdd, bool bHasNamedArgumentSpecifiers) + private bool BindMethodGroupToArgumentsCore(out GroupToArgsBinderResult pResults, BindingFlag bindFlags, ExprMemberGroup grp, ref Expr args, int carg, bool bHasNamedArgumentSpecifiers) { ArgInfos pargInfo = new ArgInfos {carg = carg}; FillInArgInfoFromArgList(pargInfo, args); @@ -1117,7 +921,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics FillInArgInfoFromArgList(pOriginalArgInfo, args); GroupToArgsBinder binder = new GroupToArgsBinder(this, bindFlags, grp, pargInfo, pOriginalArgInfo, bHasNamedArgumentSpecifiers, null/*atsDelegate*/); - bool retval = bindingCollectionAdd ? binder.BindCollectionAddArgs() : binder.Bind(true /*ReportErrors*/); + bool retval = binder.Bind(bReportErrors: true); pResults = binder.GetResultsOfBind(); return retval; @@ -1150,16 +954,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // If we have named arguments specified, make sure we have them all appearing after // fixed arguments. - bool bSeenNamed = false; - if (!VerifyNamedArgumentsAfterFixed(args, out bSeenNamed)) - { - ExprCall rval = GetExprFactory().CreateCall(0, GetTypes().GetErrorSym(), args, grp, null); - rval.SetError(); - return rval; - } + bool seenNamed = VerifyNamedArgumentsAfterFixed(args); GroupToArgsBinderResult result; - if (!BindMethodGroupToArgumentsCore(out result, bindFlags, grp, ref args, carg, false, bSeenNamed)) + if (!BindMethodGroupToArgumentsCore(out result, bindFlags, grp, ref args, carg, seenNamed)) { Debug.Assert(false, "Why didn't BindMethodGroupToArgumentsCore throw an error?"); return null; @@ -1173,7 +971,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert((grp.Flags & EXPRFLAG.EXF_INDEXER) != 0); //PropWithType pwt = new PropWithType(mpwiBest.Prop(), mpwiBest.GetType()); - exprRes = BindToProperty(grp.OptionalObject, new PropWithType(mpwiBest), (bindFlags | (BindingFlag)(grp.Flags & EXPRFLAG.EXF_BASECALL)), args, null/*typeOther*/, grp); + exprRes = BindToProperty(grp.OptionalObject, new PropWithType(mpwiBest), bindFlags, args, null/*typeOther*/, grp); } else { @@ -1184,10 +982,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ///////////////////////////////////////////////////////////////////////////////// - private bool VerifyNamedArgumentsAfterFixed(Expr args, out bool seenNamed) + private bool VerifyNamedArgumentsAfterFixed(Expr args) { Expr list = args; - seenNamed = false; + bool seenNamed = false; while (list != null) { Expr arg; @@ -1211,12 +1009,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { if (seenNamed) { - GetErrorContext().Error(ErrorCode.ERR_NamedArgumentSpecificationBeforeFixedArgument); - return false; + throw GetErrorContext().Error(ErrorCode.ERR_NamedArgumentSpecificationBeforeFixedArgument); } } } - return true; + + return seenNamed; } //////////////////////////////////////////////////////////////////////////////// @@ -1240,22 +1038,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { pOperand2 = UnwrapExpression(pOperand2); if (pOperand1.Type != null && - !pOperand1.Type.IsErrorType() && + !(pOperand1.Type is ErrorType) && pOperand2.Type != null && - !pOperand2.Type.IsErrorType()) + !(pOperand2.Type is ErrorType)) { - ErrorContext.Error(ErrorCode.ERR_BadBinaryOps, strOp, pOperand1.Type, pOperand2.Type); + throw ErrorContext.Error(ErrorCode.ERR_BadBinaryOps, strOp, pOperand1.Type, pOperand2.Type); } } - else if (pOperand1.Type != null && !pOperand1.Type.IsErrorType()) + else if (pOperand1.Type != null && !(pOperand1.Type is ErrorType)) { - ErrorContext.Error(ErrorCode.ERR_BadUnaryOp, strOp, pOperand1.Type); + throw ErrorContext.Error(ErrorCode.ERR_BadUnaryOp, strOp, pOperand1.Type); } } if (pTypeErr == null) { - pTypeErr = GetReqPDT(PredefinedType.PT_OBJECT); + pTypeErr = GetPredefindType(PredefinedType.PT_OBJECT); } ExprOperator rval = GetExprFactory().CreateOperator(ek, pTypeErr, pOperand1, pOperand2); @@ -1281,17 +1079,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private static ErrorCode GetStandardLvalueError(CheckLvalueKind kind) { + Debug.Assert(kind >= CheckLvalueKind.Assignment && kind <= CheckLvalueKind.Increment); switch (kind) { - default: - VSFAIL("bad kind"); - return ErrorCode.ERR_AssgLvalueExpected; - case CheckLvalueKind.Assignment: - return ErrorCode.ERR_AssgLvalueExpected; case CheckLvalueKind.OutParameter: return ErrorCode.ERR_RefLvalueExpected; case CheckLvalueKind.Increment: return ErrorCode.ERR_IncrementLvalueExpected; + default: + return ErrorCode.ERR_AssgLvalueExpected; } } @@ -1300,39 +1096,26 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(prop != null); Debug.Assert(prop.isLvalue()); - // We have an lvalue property. Give an error if this is an abstract property - // or an inaccessible property. + // We have an lvalue property. Give an error if this is an inaccessible property. - if (prop.IsBaseCall && prop.MethWithTypeSet.Meth().isAbstract) + CType type = null; + if (prop.OptionalObjectThrough != null) { - ErrorContext.Error(ErrorCode.ERR_AbstractBaseCall, prop.MethWithTypeSet); + type = prop.OptionalObjectThrough.Type; } - else - { - CType type = null; - if (prop.OptionalObjectThrough != null) - { - type = prop.OptionalObjectThrough.Type; - } - CheckPropertyAccess(prop.MethWithTypeSet, prop.PropWithTypeSlot, type); - } + CheckPropertyAccess(prop.MethWithTypeSet, prop.PropWithTypeSlot, type); } - private bool CheckPropertyAccess(MethWithType mwt, PropWithType pwtSlot, CType type) + private void CheckPropertyAccess(MethWithType mwt, PropWithType pwtSlot, CType type) { - ACCESSERROR error = SemanticChecker.CheckAccess2(mwt.Meth(), mwt.GetType(), ContextForMemberLookup(), type); - if (error == ACCESSERROR.ACCESSERROR_NOACCESSTHRU) + switch (SemanticChecker.CheckAccess2(mwt.Meth(), mwt.GetType(), ContextForMemberLookup(), type)) { - ErrorContext.Error(ErrorCode.ERR_BadProtectedAccess, pwtSlot, type, ContextForMemberLookup()); - return false; + case ACCESSERROR.ACCESSERROR_NOACCESSTHRU: + throw ErrorContext.Error(ErrorCode.ERR_BadProtectedAccess, pwtSlot, type, ContextForMemberLookup()); + case ACCESSERROR.ACCESSERROR_NOACCESS: + throw ErrorContext.Error(mwt.Meth().isSetAccessor() ? ErrorCode.ERR_InaccessibleSetter : ErrorCode.ERR_InaccessibleGetter, pwtSlot); } - else if (error == ACCESSERROR.ACCESSERROR_NOACCESS) - { - ErrorContext.Error(mwt.Meth().isSetAccessor() ? ErrorCode.ERR_InaccessibleSetter : ErrorCode.ERR_InaccessibleGetter, pwtSlot); - return false; - } - return true; } //////////////////////////////////////////////////////////////////////////////// @@ -1358,8 +1141,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (kind == CheckLvalueKind.OutParameter) { // passing a property as ref or out - ErrorContext.Error(ErrorCode.ERR_RefProperty); - return true; + throw ErrorContext.Error(ErrorCode.ERR_RefProperty); } ExprProperty prop = (ExprProperty)expr; @@ -1388,54 +1170,37 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // SPEC VIOLATION: would be a breaking change. We currently discard "no op" casts // SPEC VIOLATION: very aggressively rather than generating an ExpressionKind.EK_CAST node. - ErrorContext.Error(ErrorCode.ERR_AssgReadonlyProp, prop.PropWithTypeSlot); - return true; + throw ErrorContext.Error(ErrorCode.ERR_AssgReadonlyProp, prop.PropWithTypeSlot); } break; case ExpressionKind.BoundLambda: case ExpressionKind.Constant: - ErrorContext.Error(GetStandardLvalueError(kind)); - return false; + throw ErrorContext.Error(GetStandardLvalueError(kind)); + case ExpressionKind.MemberGroup: - { - ErrorCode err = (kind == CheckLvalueKind.OutParameter) ? ErrorCode.ERR_RefReadonlyLocalCause : ErrorCode.ERR_AssgReadonlyLocalCause; - ErrorContext.Error(err, ((ExprMemberGroup)expr).Name, new ErrArgIds(MessageID.MethodGroup)); - return false; - } - default: - break; + ErrorCode err = (kind == CheckLvalueKind.OutParameter) ? ErrorCode.ERR_RefReadonlyLocalCause : ErrorCode.ERR_AssgReadonlyLocalCause; + throw ErrorContext.Error(err, ((ExprMemberGroup)expr).Name, new ErrArgIds(MessageID.MethodGroup)); } - return !TryReportLvalueFailure(expr, kind); + TryReportLvalueFailure(expr, kind); + return true; } - private void PostBindMethod(bool fBaseCall, ref MethWithInst pMWI, Expr pObject) + private void PostBindMethod(ref MethWithInst pMWI, Expr pObject) { MethWithInst mwiOrig = pMWI; // If it is virtual, find a remap of the method to something more specific. This // may alter where the method is found. - if (pObject != null && (fBaseCall || pObject.Type.isSimpleType())) + if (pObject != null && pObject.Type.isSimpleType()) { RemapToOverride(GetSymbolLoader(), pMWI, pObject.Type); } - if (fBaseCall && pMWI.Meth().isAbstract) - { - ErrorContext.Error(ErrorCode.ERR_AbstractBaseCall, pMWI); - } - if (pMWI.Meth().RetType != null) { checkUnsafe(pMWI.Meth().RetType); - bool fCheckParams = false; - - if (pMWI.Meth().isExternal) - { - fCheckParams = true; - SetExternalRef(pMWI.Meth().RetType); - } // We need to check unsafe on the parameters as well, since we cannot check in conversion. TypeArray pParams = pMWI.Meth().Params; @@ -1449,63 +1214,44 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { checkUnsafe(type); } - if (fCheckParams && type.IsParameterModifierType()) - { - SetExternalRef(type); - } } } } - private void PostBindProperty(bool fBaseCall, PropWithType pwt, Expr pObject, out MethWithType pmwtGet, out MethWithType pmwtSet) + private void PostBindProperty(PropWithType pwt, Expr pObject, out MethWithType pmwtGet, out MethWithType pmwtSet) { pmwtGet = new MethWithType(); pmwtSet = new MethWithType(); // Get the accessors. - if (pwt.Prop().methGet != null) + if (pwt.Prop().GetterMethod != null) { - pmwtGet.Set(pwt.Prop().methGet, pwt.GetType()); + pmwtGet.Set(pwt.Prop().GetterMethod, pwt.GetType()); } else { pmwtGet.Clear(); } - if (pwt.Prop().methSet != null) + if (pwt.Prop().SetterMethod != null) { - pmwtSet.Set(pwt.Prop().methSet, pwt.GetType()); + pmwtSet.Set(pwt.Prop().SetterMethod, pwt.GetType()); } else { pmwtSet.Clear(); } - // If it is virtual, find a remap of the method to something more specific. This - // may alter where the accessors are found. - if (fBaseCall && pObject != null) - { - if (pmwtGet) - { - RemapToOverride(GetSymbolLoader(), pmwtGet, pObject.Type); - } - if (pmwtSet) - { - RemapToOverride(GetSymbolLoader(), pmwtSet, pObject.Type); - } - } - if (pwt.Prop().RetType != null) { checkUnsafe(pwt.Prop().RetType); } } - private Expr AdjustMemberObject(SymWithType swt, Expr pObject, out bool pfConstrained, out bool pIsMatchingStatic) + private Expr AdjustMemberObject(SymWithType swt, Expr pObject, out bool pfConstrained) { // Assert that the type is present and is an instantiation of the member's parent. - Debug.Assert(swt.GetType() != null && swt.GetType().getAggregate() == swt.Sym.parent.AsAggregateSymbol()); + Debug.Assert(swt.GetType() != null && swt.GetType().getAggregate() == swt.Sym.parent as AggregateSymbol); bool bIsMatchingStatic = IsMatchingStatic(swt, pObject); - pIsMatchingStatic = bIsMatchingStatic; pfConstrained = false; bool isStatic = swt.Sym.isStatic; @@ -1520,20 +1266,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if ((pObject.Flags & EXPRFLAG.EXF_SIMPLENAME) != 0) { // We've made the static match now. - pIsMatchingStatic = true; - return null; - } - else - { - ErrorContext.ErrorRef(ErrorCode.ERR_ObjectProhibited, swt); return null; } + + throw ErrorContext.Error(ErrorCode.ERR_ObjectProhibited, swt); } - else - { - ErrorContext.ErrorRef(ErrorCode.ERR_ObjectRequired, swt); - return pObject; - } + + throw ErrorContext.Error(ErrorCode.ERR_ObjectRequired, swt); } // At this point, all errors for static invocations have been reported, and @@ -1544,7 +1283,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // If we're in a constructor, then bail. - if (swt.Sym.IsMethodSymbol() && swt.Meth().IsConstructor()) + if ((swt.Sym is MethodSymbol) && swt.Meth().IsConstructor()) { return pObject; } @@ -1557,27 +1296,26 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics CType typeObj = pObject.Type; CType typeTmp; - if (typeObj.IsNullableType() && (typeTmp = typeObj.AsNullableType().GetAts(GetErrorContext())) != null && typeTmp != swt.GetType()) + if (typeObj is NullableType nubTypeObj && (typeTmp = nubTypeObj.GetAts()) != swt.GetType()) { typeObj = typeTmp; } - if (typeObj.IsTypeParameterType() || typeObj.IsAggregateType()) + if (typeObj is TypeParameterType || typeObj is AggregateType) { - AggregateSymbol aggCalled = null; - aggCalled = swt.Sym.parent.AsAggregateSymbol(); + AggregateSymbol aggCalled = swt.Sym.parent as AggregateSymbol; Debug.Assert(swt.GetType().getAggregate() == aggCalled); // If we're invoking code on a struct-valued field, mark the struct as assigned (to // avoid warning CS0649). - if (pObject is ExprField field && !field.FieldWithType.Field().isAssigned && !swt.Sym.IsFieldSymbol() && + if (pObject is ExprField field && !field.FieldWithType.Field().isAssigned && !(swt.Sym is FieldSymbol) && typeObj.isStructType() && !typeObj.isPredefined()) { field.FieldWithType.Field().isAssigned = true; } if (pfConstrained && - (typeObj.IsTypeParameterType() || + (typeObj is TypeParameterType || typeObj.isStructType() && swt.GetType().IsRefType() && swt.Sym.IsVirtual())) { // For calls on type parameters or virtual calls on struct types (not enums), @@ -1593,7 +1331,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // WE don't give a great message for this, but it'll do. if (objNew == null) { - ErrorContext.Error(ErrorCode.ERR_WrongNestedThis, swt.GetType(), pObject.Type); + throw ErrorContext.Error(ErrorCode.ERR_WrongNestedThis, swt.GetType(), pObject.Type); } pObject = objNew; @@ -1608,24 +1346,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Symbol pSym = swt.Sym; // Instance constructors are always ok, static constructors are never ok. - if (pSym.IsMethodSymbol() && pSym.AsMethodSymbol().IsConstructor()) + if (pSym is MethodSymbol meth && meth.IsConstructor()) { - return !pSym.AsMethodSymbol().isStatic; + return !meth.isStatic; } bool isStatic = swt.Sym.isStatic; if (isStatic) { - // If we're static and we don't have an object, or we have an implicit this, - // then we're ok. The reason implicit this is ok is because if the user is - // just typing something like: - // - // Equals( - // - // then the implicit this can bind to statics. - - if (pObject == null || ((pObject.Flags & EXPRFLAG.EXF_IMPLICITTHIS) != 0)) + // If we're static and we don't have an object then we're ok. + if (pObject == null) { return true; } @@ -1672,30 +1403,23 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // For a property/indexer we remap the accessors, not the property/indexer. // Since every event has both accessors we remap the event instead of the accessors. - Debug.Assert(pswt && (pswt.Sym.IsMethodSymbol() || pswt.Sym.IsEventSymbol() || pswt.Sym.IsMethodOrPropertySymbol())); + Debug.Assert(pswt && (pswt.Sym is MethodSymbol || pswt.Sym is EventSymbol || pswt.Sym is MethodOrPropertySymbol)); Debug.Assert(typeObj != null); // Don't remap static or interface methods. - if (typeObj.IsNullableType()) + if (typeObj is NullableType nubTypeObj) { - typeObj = typeObj.AsNullableType().GetAts(symbolLoader.GetErrorContext()); - if (typeObj == null) - { - VSFAIL("Why did GetAts return null?"); - return; - } + typeObj = nubTypeObj.GetAts(); } // Don't remap non-virtual members - if (!typeObj.IsAggregateType() || typeObj.isInterfaceType() || !pswt.Sym.IsVirtual()) + if (!(typeObj is AggregateType atsObj) || atsObj.isInterfaceType() || !pswt.Sym.IsVirtual()) { return; } symbmask_t mask = pswt.Sym.mask(); - AggregateType atsObj = typeObj.AsAggregateType(); - // Search for an override version of the method. while (atsObj != null && atsObj.getAggregate() != pswt.Sym.parent) { @@ -1718,7 +1442,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(call != null); Expr argsPtr = call.OptionalArguments; SymWithType swt = call.GetSymWithType(); - MethodOrPropertySymbol mp = swt.Sym.AsMethodOrPropertySymbol(); + MethodOrPropertySymbol mp = swt.Sym as MethodOrPropertySymbol; TypeArray pTypeArgs = (call as ExprCall)?.MethWithInst.TypeArgs; Expr newArgs; AdjustCallArgumentsForParams(callingObjectType, swt.GetType(), mp, pTypeArgs, argsPtr, out newArgs); @@ -1737,10 +1461,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics int paramCount = mp.Params.Count; TypeArray @params = mp.Params; int iDst = 0; - bool markTypeFromExternCall = mp.IsFMETHSYM() && mp.AsFMETHSYM().isExternal; + MethodSymbol m = mp as MethodSymbol; int argCount = ExpressionIterator.Count(argsPtr); - if (mp.IsFMETHSYM() && mp.AsFMETHSYM().isVarargs) + if (m != null && m.isVarargs) { paramCount--; // we don't care about the vararg sentinel } @@ -1760,12 +1484,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Expr indir = it.Current(); // this will splice the optional arguments into the list - if (indir.Type.IsParameterModifierType()) + if (indir.Type is ParameterModifierType) { if (paramCount != 0) paramCount--; - if (markTypeFromExternCall) - SetExternalRef(indir.Type); GetExprFactory().AppendItemToList(indir, ref newArgs, ref newArgsTail); } else if (paramCount != 0) @@ -1806,8 +1528,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // void Foo(int y, params int[] x); // ... // Foo(x:1, y:1); - CType arrayType = GetTypes().SubstType(mp.Params[mp.Params.Count - 1], type, pTypeArgs); - CType elemType = arrayType.AsArrayType().GetElementType(); + CType arrayType = (ArrayType)GetTypes().SubstType(mp.Params[mp.Params.Count - 1], type, pTypeArgs); // Use an EK_ARRINIT even in the empty case so empty param arrays in attributes work. ExprArrayInit arrayInit = GetExprFactory().CreateArrayInit(arrayType, null, null, new[] { 0 }, 1); @@ -1875,7 +1596,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // we need to create an array and put it as the last arg... CType substitutedArrayType = GetTypes().SubstType(mp.Params[mp.Params.Count - 1], type, pTypeArgs); - if (!substitutedArrayType.IsArrayType() || !substitutedArrayType.AsArrayType().IsSZArray) + if (!(substitutedArrayType is ArrayType subArr) || !subArr.IsSZArray) { // Invalid type for params array parameter. Happens in LAF scenarios, e.g. // @@ -1885,7 +1606,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return; } - CType elementType = substitutedArrayType.AsArrayType().GetElementType(); + CType elementType = subArr.GetElementType(); // Use an EK_ARRINIT even in the empty case so empty param arrays in attributes work. ExprArrayInit exprArrayInit = GetExprFactory().CreateArrayInit(substitutedArrayType, null, null, new[] { 0 }, 1); @@ -1954,21 +1675,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - private void SetExternalRef(CType type) - { - AggregateSymbol agg = type.GetNakedAgg(); - if (null == agg || agg.HasExternReference()) - return; - - agg.SetHasExternReference(true); - foreach (Symbol sym in agg.Children()) - { - if (sym.IsFieldSymbol()) - SetExternalRef(sym.AsFieldSymbol().GetType()); - } - } - - private static readonly PredefinedType[] s_rgptIntOp = { PredefinedType.PT_INT, @@ -1979,12 +1685,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics - internal CType chooseArrayIndexType(Expr args) + internal CType ChooseArrayIndexType(Expr args) { // first, select the allowable types - for (int ipt = 0; ipt < s_rgptIntOp.Length; ipt++) + foreach (PredefinedType predef in s_rgptIntOp) { - CType type = GetReqPDT(s_rgptIntOp[ipt]); + CType type = GetPredefindType(predef); foreach (Expr arg in args.ToEnumerable()) { if (!canConvert(arg, type)) @@ -1992,11 +1698,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics goto NEXTI; } } + return type; - NEXTI: + + NEXTI: ; } - return null; + + // Provide better error message in attempting cast to int. + return GetPredefindType(PredefinedType.PT_INT); } internal void FillInArgInfoFromArgList(ArgInfos argInfo, Expr args) @@ -2057,7 +1767,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics CType type = @params[@params.Count - 1]; CType elementType = null; - if (!type.IsArrayType()) + if (!(type is ArrayType arr)) { ppExpandedParams = null; // If we don't have an array sym, we don't have expanded parameters. @@ -2065,7 +1775,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // At this point, we have an array sym. - elementType = type.AsArrayType().GetElementType(); + elementType = arr.GetElementType(); for (int itype = @params.Count - 1; itype < count; itype++) { @@ -2306,22 +2016,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private void checkUnsafe(CType type) { - checkUnsafe(type, ErrorCode.ERR_UnsafeNeeded, null); - } - - private void checkUnsafe(CType type, ErrorCode errCode, ErrArg pArg) - { - Debug.Assert((errCode != ErrorCode.ERR_SizeofUnsafe) || pArg != null); if (type == null || type.isUnsafe()) { - if (ReportUnsafeErrors()) - { - if (pArg != null) - ErrorContext.Error(errCode, pArg); - else - ErrorContext.Error(errCode); - } - RecordUnsafeUsage(); + throw ErrorContext.Error(ErrorCode.ERR_UnsafeNeeded); } } @@ -2331,16 +2028,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return Context.ContextForMemberLookup; } - private bool ReportUnsafeErrors() - { - return Context.ReportUnsafeErrors; - } - - private void RecordUnsafeUsage() - { - RecordUnsafeUsage(Context); - } - private ExprWrap WrapShortLivedExpression(Expr expr) { return GetExprFactory().CreateWrap(expr); @@ -2351,11 +2038,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GetExprFactory().CreateAssignment(op1, op2); } - private static void RecordUnsafeUsage(BindingContext context) - { - context.ReportUnsafeErrors = false; - } - internal static int CountArguments(Expr args, out bool typeErrors) { int carg = 0; @@ -2377,7 +2059,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(arg != null); - if (arg.Type == null || arg.Type.IsErrorType()) + if (arg.Type == null || arg.Type is ErrorType) { typeErrors = true; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionKind.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionKind.cs index bf426faa47..ac62995cf8 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionKind.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionKind.cs @@ -44,7 +44,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics //ArrayLength, //EK_ARGUMENTHANDLE, Call, - Event, + //Event, Field, Local, //EK_BASE, @@ -64,7 +64,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics //EK_ALIAS, // End type exprs. //EK_ERROR, - FunctionPointer, + //FunctionPointer, Property, Multi, MultiGet, diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs index 194949cd3b..85bbceea22 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs @@ -18,11 +18,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public GlobalSymbolContext(NameManager namemgr) { - TypeManager = new TypeManager(); GlobalSymbols = new BSYMMGR(namemgr); _predefTypes = new PredefinedTypes(GlobalSymbols); - TypeManager.Init(GlobalSymbols, _predefTypes); - GlobalSymbols.Init(); + TypeManager = new TypeManager(GlobalSymbols, _predefTypes); _nameManager = namemgr; } @@ -38,10 +36,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return GetGlobalSymbols().GetSymFactory(); } - - public MiscSymFactory GetGlobalMiscSymFactory() - { - return GetGlobalSymbols().GetMiscSymFactory(); - } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs index 25a8d40341..e7a8694d12 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs @@ -40,12 +40,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private TypeArray _pCurrentParameters; private TypeArray _pBestParameters; private int _nArgBest; - // Keep track of the first 20 or so syms with the wrong arg count. - private readonly SymWithType[] _swtWrongCount = new SymWithType[20]; - private int _nWrongCount; - private bool _bIterateToEndOfNsList; // we have found an appliacable extension method only itereate to // end of current namespaces extension method list - private bool _bBindingCollectionAddArgs; // Report parameter modifiers as error private readonly GroupToArgsBinderResult _results; private readonly List _methList; private readonly MethPropWithInst _mpwiParamTypeConstraints; @@ -82,9 +77,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _pCurrentParameters = null; _pBestParameters = null; _nArgBest = -1; - _nWrongCount = 0; - _bIterateToEndOfNsList = false; - _bBindingCollectionAddArgs = false; _results = new GroupToArgsBinderResult(); _methList = new List(); _mpwiParamTypeConstraints = new MethPropWithInst(); @@ -110,10 +102,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { if (bReportErrors) { - ReportErrorsOnFailure(); + throw ReportErrorsOnFailure(); } + return false; } + return true; } @@ -122,11 +116,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return _results; } - public bool BindCollectionAddArgs() - { - _bBindingCollectionAddArgs = true; - return Bind(true /* bReportErrors */); - } private SymbolLoader GetSymbolLoader() { return _pExprBinder.GetSymbolLoader(); @@ -143,32 +132,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(pGroup != null); - CType rval = null; - if (0 != (pGroup.Flags & EXPRFLAG.EXF_BASECALL)) - { - rval = null; - } - else if (0 != (pGroup.Flags & EXPRFLAG.EXF_CTOR)) - { - rval = pGroup.ParentType; - } - else if (pGroup.OptionalObject != null) - { - rval = pGroup.OptionalObject.Type; - } - else - { - rval = null; - } - return rval; + return (pGroup.Flags & EXPRFLAG.EXF_CTOR) != 0 ? pGroup.ParentType : pGroup.OptionalObject?.Type; } private void LookForCandidates() { bool fExpanded = false; bool bSearchForExpanded = true; - int cswtMaxWrongCount = _swtWrongCount.Length; bool allCandidatesUnsupported = true; bool lookedAtCandidates = false; @@ -236,17 +207,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (!bFoundExpanded) { lookedAtCandidates = true; - allCandidatesUnsupported &= _pCurrentSym.getBogus(); + allCandidatesUnsupported &= CSemanticChecker.CheckBogus(_pCurrentSym); // If we have the wrong number of arguments and still have room in our cache of 20, // then store it in our cache and go to the next sym. if (_pCurrentParameters.Count != _pArguments.carg) { - if (_nWrongCount < cswtMaxWrongCount && - (!_pCurrentSym.isParamArray || _pArguments.carg < _pCurrentParameters.Count - 1)) - { - _swtWrongCount[_nWrongCount++] = new SymWithType(_pCurrentSym, _pCurrentType); - } bSearchForExpanded = true; continue; } @@ -325,14 +291,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TypeArray ifaces = _pCurrentType.GetIfacesAll(); for (int i = 0; i < ifaces.Count; i++) { - AggregateType type = ifaces[i].AsAggregateType(); + AggregateType type = ifaces[i] as AggregateType; Debug.Assert(type.isInterfaceType()); _HiddenTypes.Add(type); } // Mark object. - AggregateType typeObject = GetSymbolLoader().GetReqPredefType(PredefinedType.PT_OBJECT); + AggregateType typeObject = GetSymbolLoader().GetPredefindType(PredefinedType.PT_OBJECT); _HiddenTypes.Add(typeObject); } } @@ -400,12 +366,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics pAmbig1.mpwi.GetType() != pAmbig2.mpwi.GetType() || pAmbig1.mpwi.MethProp().Params == pAmbig2.mpwi.MethProp().Params) { - GetErrorContext().Error(ErrorCode.ERR_AmbigCall, pAmbig1.mpwi, pAmbig2.mpwi); + throw GetErrorContext().Error(ErrorCode.ERR_AmbigCall, pAmbig1.mpwi, pAmbig2.mpwi); } else { // The two signatures are identical so don't use the type args in the error message. - GetErrorContext().Error(ErrorCode.ERR_AmbigCall, pAmbig1.mpwi.MethProp(), pAmbig2.mpwi.MethProp()); + throw GetErrorContext().Error(ErrorCode.ERR_AmbigCall, pAmbig1.mpwi.MethProp(), pAmbig2.mpwi.MethProp()); } } } @@ -575,7 +541,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics int index) { CType pParamType = type; - CType pRawParamType = type.IsNullableType() ? type.AsNullableType().GetUnderlyingType() : type; + CType pRawParamType = type.StripNubs(); Expr optionalArgument = null; if (methprop.HasDefaultParameterValue(index)) @@ -589,7 +555,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // This is the specific case where we want to create a DateTime // but the constval that stores it is a long. - AggregateType dateTimeType = symbolLoader.GetReqPredefType(PredefinedType.PT_DATETIME); + AggregateType dateTimeType = symbolLoader.GetPredefindType(PredefinedType.PT_DATETIME); optionalArgument = exprFactory.CreateConstant(dateTimeType, ConstVal.Get(DateTime.FromBinary(cv.Int64Val))); } else if (pConstValType.isSimpleOrEnumOrString()) @@ -610,7 +576,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics optionalArgument = exprFactory.CreateConstant(pConstValType, cv); } } - else if ((pParamType.IsRefType() || pParamType.IsNullableType()) && cv.IsNullRef) + else if ((pParamType.IsRefType() || pParamType is NullableType) && cv.IsNullRef) { // We have an "= null" default value with a reference type or a nullable type. @@ -643,9 +609,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // Otherwise, we generate Type.Missing - AggregateSymbol agg = symbolLoader.GetOptPredefAgg(PredefinedType.PT_MISSING); + AggregateSymbol agg = symbolLoader.GetPredefAgg(PredefinedType.PT_MISSING); Name name = NameManager.GetPredefinedName(PredefinedName.PN_CAP_VALUE); - FieldSymbol field = symbolLoader.LookupAggMember(name, agg, symbmask_t.MASK_FieldSymbol).AsFieldSymbol(); + FieldSymbol field = symbolLoader.LookupAggMember(name, agg, symbmask_t.MASK_FieldSymbol) as FieldSymbol; FieldWithType fwt = new FieldWithType(field, agg.getThisType()); ExprField exprField = exprFactory.CreateField(agg.getThisType(), null, fwt, false); @@ -689,32 +655,23 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MethodOrPropertySymbol pMethProp, CType pType) { - MethodSymbol method; bool bIsIndexer = false; - if (pMethProp.IsMethodSymbol()) + if (!(pMethProp is MethodSymbol method)) { - method = pMethProp.AsMethodSymbol(); - } - else - { - PropertySymbol prop = pMethProp.AsPropertySymbol(); - method = prop.methGet != null ? prop.methGet : prop.methSet; + PropertySymbol prop = (PropertySymbol)pMethProp; + method = prop.GetterMethod ?? prop.SetterMethod; if (method == null) { return null; } - bIsIndexer = prop.isIndexer(); + + bIsIndexer = prop is IndexerSymbol; } - if (!method.isVirtual) + if (!method.isVirtual || pType == null) { - return method; - } - - if (pType == null) - { - // This must be a static call. + // if pType is null, this must be a static call. return method; } @@ -725,19 +682,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics method = slotMethod; } - if (!pType.IsAggregateType()) + if (!(pType is AggregateType agg)) { // Not something that can have overrides anyway. return method; } - for (AggregateSymbol pAggregate = pType.AsAggregateType().GetOwningAggregate(); - pAggregate != null && pAggregate.GetBaseAgg() != null; + for (AggregateSymbol pAggregate = agg.GetOwningAggregate(); + pAggregate?.GetBaseAgg() != null; pAggregate = pAggregate.GetBaseAgg()) { - for (MethodOrPropertySymbol meth = symbolLoader.LookupAggMember(method.name, pAggregate, symbmask_t.MASK_MethodSymbol | symbmask_t.MASK_PropertySymbol).AsMethodOrPropertySymbol(); + for (MethodOrPropertySymbol meth = symbolLoader.LookupAggMember(method.name, pAggregate, symbmask_t.MASK_MethodSymbol | symbmask_t.MASK_PropertySymbol) as MethodOrPropertySymbol; meth != null; - meth = symbolLoader.LookupNextSym(meth, pAggregate, symbmask_t.MASK_MethodSymbol | symbmask_t.MASK_PropertySymbol).AsMethodOrPropertySymbol()) + meth = symbolLoader.LookupNextSym(meth, pAggregate, symbmask_t.MASK_MethodSymbol | symbmask_t.MASK_PropertySymbol) as MethodOrPropertySymbol) { if (!meth.isOverride) { @@ -747,8 +704,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { if (bIsIndexer) { - Debug.Assert(meth.IsMethodSymbol()); - return meth.AsMethodSymbol().getProperty(); + Debug.Assert(meth is MethodSymbol); + return ((MethodSymbol)meth).getProperty(); } else { @@ -763,7 +720,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // an override, but we won't have the slots set up correctly, and will // not find the base type in the inheritance hierarchy. The second is that // we're calling off of the base itself. - Debug.Assert(method.parent.IsAggregateSymbol()); + Debug.Assert(method.parent is AggregateSymbol); return method; } @@ -905,7 +862,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // return false. private bool GetNextSym(CMemberLookupResults.CMethodIterator iterator) { - if (!iterator.MoveNext(_methList.IsEmpty(), _bIterateToEndOfNsList)) + if (!iterator.MoveNext(_methList.IsEmpty())) { return false; } @@ -919,25 +876,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (_pCurrentType != type && _pCurrentType != null && !_methList.IsEmpty() && - !_methList.Head().mpwi.GetType().isInterfaceType() && - (!_methList.Head().mpwi.Sym.IsMethodSymbol() || !_methList.Head().mpwi.Meth().IsExtension())) + !_methList.Head().mpwi.GetType().isInterfaceType()) { return false; } - else if (_pCurrentType != type && - _pCurrentType != null && - !_methList.IsEmpty() && - !_methList.Head().mpwi.GetType().isInterfaceType() && - _methList.Head().mpwi.Sym.IsMethodSymbol() && - _methList.Head().mpwi.Meth().IsExtension()) - { - // we have found a applicable method that is an extension now we must move to the end of the NS list before quiting - if (_pGroup.OptionalObject != null) - { - // if we find this while looking for static methods we should ignore it - _bIterateToEndOfNsList = true; - } - } _pCurrentType = type; @@ -946,7 +888,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics while (_HiddenTypes.Contains(_pCurrentType)) { // Move through this type and get the next one. - for (; iterator.GetCurrentType() == _pCurrentType; iterator.MoveNext(_methList.IsEmpty(), _bIterateToEndOfNsList)) ; + for (; iterator.GetCurrentType() == _pCurrentType; iterator.MoveNext(_methList.IsEmpty())) ; _pCurrentSym = iterator.GetCurrentSymbol(); _pCurrentType = iterator.GetCurrentType(); @@ -1001,9 +943,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TypeArray typeArgs = _pGroup.TypeArgs; // Get the type args. - if (_pCurrentSym.IsMethodSymbol() && _pCurrentSym.AsMethodSymbol().typeVars.Count != typeArgs.Count) + if (_pCurrentSym is MethodSymbol methSym && methSym.typeVars.Count != typeArgs.Count) { - MethodSymbol methSym = _pCurrentSym.AsMethodSymbol(); // Can't infer if some type args are specified. if (typeArgs.Count > 0) { @@ -1034,11 +975,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TypeArray pTypeVars = methSym.typeVars; if (pTypeVars != null && _pCurrentTypeArgs != null && pTypeVars.Count == _pCurrentTypeArgs.Count) { - _mpwiCantInferInstArg.Set(_pCurrentSym.AsMethodSymbol(), _pCurrentType, _pCurrentTypeArgs); + _mpwiCantInferInstArg.Set(methSym, _pCurrentType, _pCurrentTypeArgs); } else { - _mpwiCantInferInstArg.Set(_pCurrentSym.AsMethodSymbol(), _pCurrentType, pTypeVars); + _mpwiCantInferInstArg.Set(methSym, _pCurrentType, pTypeVars); } } return Result.Failure_SearchForExpanded; @@ -1054,7 +995,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool ArgumentsAreConvertible() { bool containsErrorSym = false; - bool bIsInstanceParameterConvertible = false; if (_pArguments.carg != 0) { UpdateArguments(); @@ -1111,9 +1051,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // this is to eliminate the paranoid case of types that are equal but can't convert // (think ErrorType != ErrorType) // See if they just differ in out / ref. - CType argStripped = _pArguments.types[ivar].IsParameterModifierType() ? - _pArguments.types[ivar].AsParameterModifierType().GetParameterType() : _pArguments.types[ivar]; - CType varStripped = var.IsParameterModifierType() ? var.AsParameterModifierType().GetParameterType() : var; + CType argStripped = _pArguments.types[ivar] is ParameterModifierType modArg ? + modArg.GetParameterType() : _pArguments.types[ivar]; + CType varStripped = var is ParameterModifierType modVar ? modVar.GetParameterType() : var; if (argStripped == varStripped) { @@ -1126,18 +1066,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - if (_pCurrentSym.IsMethodSymbol()) + if (_pCurrentSym is MethodSymbol meth) { // Do not store the result if we have an extension method and the instance // parameter isn't convertible. - if (!_pCurrentSym.AsMethodSymbol().IsExtension() || bIsInstanceParameterConvertible) - { - _results.AddInconvertibleResult( - _pCurrentSym.AsMethodSymbol(), - _pCurrentType, - _pCurrentTypeArgs); - } + _results.AddInconvertibleResult(meth, _pCurrentType, _pCurrentTypeArgs); } return false; } @@ -1146,42 +1080,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (containsErrorSym) { - if (_results.IsBetterUninferableResult(_pCurrentTypeArgs) && _pCurrentSym.IsMethodSymbol()) + if (_results.IsBetterUninferableResult(_pCurrentTypeArgs) && _pCurrentSym is MethodSymbol meth) { - // If we're an instance method or we're an extension that has an inferable instance argument, - // then mark us down. Note that the extension may not need to infer type args, - // so check if we have any type variables at all to begin with. - if (!_pCurrentSym.AsMethodSymbol().IsExtension() || - _pCurrentSym.AsMethodSymbol().typeVars.Count == 0 || - MethodTypeInferrer.CanObjectOfExtensionBeInferred( - _pExprBinder, - GetSymbolLoader(), - _pCurrentSym.AsMethodSymbol(), - _pCurrentType.GetTypeArgsAll(), - _pCurrentSym.AsMethodSymbol().Params, - _pArguments)) - { - _results.GetUninferableResult().Set( - _pCurrentSym.AsMethodSymbol(), - _pCurrentType, - _pCurrentTypeArgs); - } + // If we're an instance method then mark us down. + _results.GetUninferableResult().Set(meth, _pCurrentType, _pCurrentTypeArgs); } } else { - if (_pCurrentSym.IsMethodSymbol()) + if (_pCurrentSym is MethodSymbol meth) { // Do not store the result if we have an extension method and the instance // parameter isn't convertible. - if (!_pCurrentSym.AsMethodSymbol().IsExtension() || bIsInstanceParameterConvertible) - { - _results.AddInconvertibleResult( - _pCurrentSym.AsMethodSymbol(), - _pCurrentType, - _pCurrentTypeArgs); - } + _results.AddInconvertibleResult(meth, _pCurrentType, _pCurrentTypeArgs); } } return !containsErrorSym; @@ -1237,20 +1149,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool DoesTypeArgumentsContainErrorSym(CType var) { - if (!var.IsAggregateType()) + if (!(var is AggregateType varAgg)) { return false; } - TypeArray typeVars = var.AsAggregateType().GetTypeArgsAll(); + TypeArray typeVars = varAgg.GetTypeArgsAll(); for (int i = 0; i < typeVars.Count; i++) { CType type = typeVars[i]; - if (type.IsErrorType()) + if (type is ErrorType) { return true; } - else if (type.IsAggregateType()) + else if (type is AggregateType) { // If we have an agg type sym, check if its type args have errors. if (DoesTypeArgumentsContainErrorSym(type)) @@ -1259,6 +1171,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } } + return false; } @@ -1269,26 +1182,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // used for Methods and Indexers Debug.Assert(_pGroup.SymKind == SYMKIND.SK_MethodSymbol || _pGroup.SymKind == SYMKIND.SK_PropertySymbol && 0 != (_pGroup.Flags & EXPRFLAG.EXF_INDEXER)); Debug.Assert(_pGroup.TypeArgs.Count == 0 || _pGroup.SymKind == SYMKIND.SK_MethodSymbol); - - // if this is a binding to finalize on object, then complain: - if (_results.GetBestResult().MethProp().name == NameManager.GetPredefinedName(PredefinedName.PN_DTOR) && - _results.GetBestResult().MethProp().getClass().isPredefAgg(PredefinedType.PT_OBJECT)) - { - if (0 != (_pGroup.Flags & EXPRFLAG.EXF_BASECALL)) - { - GetErrorContext().Error(ErrorCode.ERR_CallingBaseFinalizeDeprecated); - } - else - { - GetErrorContext().Error(ErrorCode.ERR_CallingFinalizeDepracated); - } - } - Debug.Assert(0 == (_pGroup.Flags & EXPRFLAG.EXF_USERCALLABLE) || _results.GetBestResult().MethProp().isUserCallable()); if (_pGroup.SymKind == SYMKIND.SK_MethodSymbol) { - Debug.Assert(_results.GetBestResult().MethProp().IsMethodSymbol()); + Debug.Assert(_results.GetBestResult().MethProp() is MethodSymbol); if (_results.GetBestResult().TypeArgs.Count > 0) { @@ -1298,13 +1196,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - private void ReportErrorsOnFailure() + private Exception ReportErrorsOnFailure() { // First and foremost, report if the user specified a name more than once. if (_pDuplicateSpecifiedName != null) { - GetErrorContext().Error(ErrorCode.ERR_DuplicateNamedArgument, _pDuplicateSpecifiedName); - return; + return GetErrorContext().Error(ErrorCode.ERR_DuplicateNamedArgument, _pDuplicateSpecifiedName); } Debug.Assert(_methList.IsEmpty()); @@ -1312,16 +1209,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (_results.GetInaccessibleResult()) { // We might have called this, but it is inaccessible... - GetSemanticChecker().ReportAccessError(_results.GetInaccessibleResult(), _pExprBinder.ContextForMemberLookup(), GetTypeQualifier(_pGroup)); - return; + return GetSemanticChecker().ReportAccessError(_results.GetInaccessibleResult(), _pExprBinder.ContextForMemberLookup(), GetTypeQualifier(_pGroup)); } // Report bogus. if (_mpwiBogus) { // We might have called this, but it is bogus... - GetErrorContext().ErrorRef(ErrorCode.ERR_BindToBogus, _mpwiBogus); - return; + return GetErrorContext().Error(ErrorCode.ERR_BindToBogus, _mpwiBogus); } bool bUseDelegateErrors = false; @@ -1342,212 +1237,96 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (_results.GetBestResult()) { // If we had some invalid arguments for best matching. - ReportErrorsForBestMatching(bUseDelegateErrors, nameErr); + return ReportErrorsForBestMatching(bUseDelegateErrors, nameErr); } - else if (_results.GetUninferableResult() || _mpwiCantInferInstArg) + + if (_results.GetUninferableResult() || _mpwiCantInferInstArg) { if (!_results.GetUninferableResult()) { //copy the extension method for which instance argument type inference failed - _results.GetUninferableResult().Set(_mpwiCantInferInstArg.Sym.AsMethodSymbol(), _mpwiCantInferInstArg.GetType(), _mpwiCantInferInstArg.TypeArgs); - } - Debug.Assert(_results.GetUninferableResult().Sym.IsMethodSymbol()); - - MethodSymbol sym = _results.GetUninferableResult().Meth(); - TypeArray pCurrentParameters = sym.Params; - // if we tried to bind to an extensionmethod and the instance argument Type Inference failed then the method does not exist - // on the type at all. this is treated as a lookup error - CType type = null; - if (_pGroup.OptionalObject != null) - { - type = _pGroup.OptionalObject.Type; - } - else if (_pGroup.OptionalLHS != null) - { - type = _pGroup.OptionalLHS.Type; + _results.GetUninferableResult().Set(_mpwiCantInferInstArg.Sym as MethodSymbol, _mpwiCantInferInstArg.GetType(), _mpwiCantInferInstArg.TypeArgs); } + Debug.Assert(_results.GetUninferableResult().Sym is MethodSymbol); MethWithType mwtCantInfer = new MethWithType(); mwtCantInfer.Set(_results.GetUninferableResult().Meth(), _results.GetUninferableResult().GetType()); - GetErrorContext().Error(ErrorCode.ERR_CantInferMethTypeArgs, mwtCantInfer); + return GetErrorContext().Error(ErrorCode.ERR_CantInferMethTypeArgs, mwtCantInfer); } - else if (_mwtBadArity) + + if (_mwtBadArity) { int cvar = _mwtBadArity.Meth().typeVars.Count; - GetErrorContext().ErrorRef(cvar > 0 ? ErrorCode.ERR_BadArity : ErrorCode.ERR_HasNoTypeVars, _mwtBadArity, new ErrArgSymKind(_mwtBadArity.Meth()), _pArguments.carg); + return GetErrorContext().Error(cvar > 0 ? ErrorCode.ERR_BadArity : ErrorCode.ERR_HasNoTypeVars, _mwtBadArity, new ErrArgSymKind(_mwtBadArity.Meth()), _pArguments.carg); } - else if (_mpwiParamTypeConstraints) + + if (_mpwiParamTypeConstraints) { // This will always report an error TypeBind.CheckMethConstraints(GetSemanticChecker(), GetErrorContext(), new MethWithInst(_mpwiParamTypeConstraints)); + Debug.Fail("Unreachable"); + return null; } - else if (_pInvalidSpecifiedName != null) + + if (_pInvalidSpecifiedName != null) { // Give a better message for delegate invoke. - if (_pGroup.OptionalObject != null && - _pGroup.OptionalObject.Type.IsAggregateType() && - _pGroup.OptionalObject.Type.AsAggregateType().GetOwningAggregate().IsDelegate()) - { - GetErrorContext().Error(ErrorCode.ERR_BadNamedArgumentForDelegateInvoke, _pGroup.OptionalObject.Type.AsAggregateType().GetOwningAggregate().name, _pInvalidSpecifiedName); - } - else - { - GetErrorContext().Error(ErrorCode.ERR_BadNamedArgument, _pGroup.Name, _pInvalidSpecifiedName); - } + return _pGroup.OptionalObject != null && _pGroup.OptionalObject.Type is AggregateType agg + && agg.GetOwningAggregate().IsDelegate() + ? GetErrorContext().Error( + ErrorCode.ERR_BadNamedArgumentForDelegateInvoke, agg.GetOwningAggregate().name, + _pInvalidSpecifiedName) + : GetErrorContext().Error(ErrorCode.ERR_BadNamedArgument, _pGroup.Name, _pInvalidSpecifiedName); } - else if (_pNameUsedInPositionalArgument != null) + + if (_pNameUsedInPositionalArgument != null) { - GetErrorContext().Error(ErrorCode.ERR_NamedArgumentUsedInPositional, _pNameUsedInPositionalArgument); + return GetErrorContext().Error(ErrorCode.ERR_NamedArgumentUsedInPositional, _pNameUsedInPositionalArgument); } - else + + if (_pDelegate != null) { - CParameterizedError error; - - if (_pDelegate != null) - { - GetErrorContext().MakeError(out error, ErrorCode.ERR_MethDelegateMismatch, nameErr, _pDelegate); - GetErrorContext().AddRelatedTypeLoc(error, _pDelegate); - } - else - { - // The number of arguments must be wrong. - - if (_fCandidatesUnsupported) - { - GetErrorContext().MakeError(out error, ErrorCode.ERR_BindToBogus, nameErr); - } - else if (bUseDelegateErrors) - { - Debug.Assert(0 == (_pGroup.Flags & EXPRFLAG.EXF_CTOR)); - GetErrorContext().MakeError(out error, ErrorCode.ERR_BadDelArgCount, nameErr, _pArguments.carg); - } - else - { - if (0 != (_pGroup.Flags & EXPRFLAG.EXF_CTOR)) - { - Debug.Assert(!_pGroup.ParentType.IsTypeParameterType()); - GetErrorContext().MakeError(out error, ErrorCode.ERR_BadCtorArgCount, _pGroup.ParentType, _pArguments.carg); - } - else - { - GetErrorContext().MakeError(out error, ErrorCode.ERR_BadArgCount, nameErr, _pArguments.carg); - } - } - } - - // Report possible matches (same name and is accessible). We stored these in m_swtWrongCount. - for (int i = 0; i < _nWrongCount; i++) - { - if (GetSemanticChecker().CheckAccess( - _swtWrongCount[i].Sym, - _swtWrongCount[i].GetType(), - _pExprBinder.ContextForMemberLookup(), - GetTypeQualifier(_pGroup))) - { - GetErrorContext().AddRelatedSymLoc(error, _swtWrongCount[i].Sym); - } - } - GetErrorContext().SubmitError(error); + return GetErrorContext().Error(ErrorCode.ERR_MethDelegateMismatch, nameErr, _pDelegate); } + + // The number of arguments must be wrong. + + if (_fCandidatesUnsupported) + { + return GetErrorContext().Error(ErrorCode.ERR_BindToBogus, nameErr); + } + + if (bUseDelegateErrors) + { + Debug.Assert(0 == (_pGroup.Flags & EXPRFLAG.EXF_CTOR)); + return GetErrorContext().Error(ErrorCode.ERR_BadDelArgCount, nameErr, _pArguments.carg); + } + + if (0 != (_pGroup.Flags & EXPRFLAG.EXF_CTOR)) + { + Debug.Assert(!(_pGroup.ParentType is TypeParameterType)); + return GetErrorContext().Error(ErrorCode.ERR_BadCtorArgCount, _pGroup.ParentType, _pArguments.carg); + } + + return GetErrorContext().Error(ErrorCode.ERR_BadArgCount, nameErr, _pArguments.carg); } - private void ReportErrorsForBestMatching(bool bUseDelegateErrors, Name nameErr) + + private RuntimeBinderException ReportErrorsForBestMatching(bool bUseDelegateErrors, Name nameErr) { // Best matching overloaded method 'name' had some invalid arguments. if (_pDelegate != null) { - GetErrorContext().ErrorRef(ErrorCode.ERR_MethDelegateMismatch, nameErr, _pDelegate, _results.GetBestResult()); - return; - } - - if (_bBindingCollectionAddArgs) - { - if (ReportErrorsForCollectionAdd()) - { - return; - } + return GetErrorContext().Error( + ErrorCode.ERR_MethDelegateMismatch, nameErr, _pDelegate, _results.GetBestResult()); } if (bUseDelegateErrors) { // Point to the Delegate, not the Invoke method - GetErrorContext().Error(ErrorCode.ERR_BadDelArgTypes, _results.GetBestResult().GetType()); - } - else - { - if (_results.GetBestResult().Sym.IsMethodSymbol() && _results.GetBestResult().Sym.AsMethodSymbol().IsExtension() && _pGroup.OptionalObject != null) - { - GetErrorContext().Error(ErrorCode.ERR_BadExtensionArgTypes, _pGroup.OptionalObject.Type, _pGroup.Name, _results.GetBestResult().Sym); - } - else if (_bBindingCollectionAddArgs) - { - GetErrorContext().Error(ErrorCode.ERR_BadArgTypesForCollectionAdd, _results.GetBestResult()); - } - else - { - GetErrorContext().Error(ErrorCode.ERR_BadArgTypes, _results.GetBestResult()); - } + return GetErrorContext().Error(ErrorCode.ERR_BadDelArgTypes, _results.GetBestResult().GetType()); } - // Argument X: cannot convert type 'Y' to type 'Z' - for (int ivar = 0; ivar < _pArguments.carg; ivar++) - { - CType var = _pBestParameters[ivar]; - - if (!_pExprBinder.canConvert(_pArguments.prgexpr[ivar], var)) - { - // See if they just differ in out / ref. - CType argStripped = _pArguments.types[ivar].IsParameterModifierType() ? - _pArguments.types[ivar].AsParameterModifierType().GetParameterType() : _pArguments.types[ivar]; - CType varStripped = var.IsParameterModifierType() ? var.AsParameterModifierType().GetParameterType() : var; - if (argStripped == varStripped) - { - if (varStripped != var) - { - // The argument is wrong in ref / out-ness. - GetErrorContext().Error(ErrorCode.ERR_BadArgRef, ivar + 1, (var.IsParameterModifierType() && var.AsParameterModifierType().isOut) ? "out" : "ref"); - } - else - { - CType argument = _pArguments.types[ivar]; - - // the argument is decorated, but doesn't needs a 'ref' or 'out' - GetErrorContext().Error(ErrorCode.ERR_BadArgExtraRef, ivar + 1, (argument.IsParameterModifierType() && argument.AsParameterModifierType().isOut) ? "out" : "ref"); - } - } - else - { - // if we tried to bind to an extensionmethod and the instance argument conversion failed then the method does not exist - // on the type at all. - Symbol sym = _results.GetBestResult().Sym; - if (ivar == 0 && sym.IsMethodSymbol() && sym.AsMethodSymbol().IsExtension() && _pGroup.OptionalObject != null && - !_pExprBinder.canConvertInstanceParamForExtension(_pGroup.OptionalObject, sym.AsMethodSymbol().Params[0])) - { - if (!_pGroup.OptionalObject.Type.getBogus()) - { - GetErrorContext().Error(ErrorCode.ERR_BadInstanceArgType, _pGroup.OptionalObject.Type, var); - } - } - else - { - GetErrorContext().Error(ErrorCode.ERR_BadArgType, ivar + 1, new ErrArg(_pArguments.types[ivar], ErrArgFlags.Unique), new ErrArg(var, ErrArgFlags.Unique)); - } - } - } - } - } - - private bool ReportErrorsForCollectionAdd() - { - for (int ivar = 0; ivar < _pArguments.carg; ivar++) - { - CType var = _pBestParameters[ivar]; - if (var.IsParameterModifierType()) - { - GetErrorContext().ErrorRef(ErrorCode.ERR_InitializerAddHasParamModifiers, _results.GetBestResult()); - return true; - } - } - return false; + return GetErrorContext().Error(ErrorCode.ERR_BadArgTypes, _results.GetBestResult()); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs index 6ce2057e6e..bb10caf48a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs @@ -58,7 +58,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics int nCount = 0; for (int i = 0; i < pTypeArgs.Count; i++) { - if (pTypeArgs[i].IsErrorType()) + if (pTypeArgs[i] is ErrorType) { nCount++; } @@ -78,13 +78,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // If we don't have a winner yet, go through each element's type args. for (int i = 0; i < max; i++) { - if (pTypeArgs1[i].IsAggregateType()) + if (pTypeArgs1[i] is AggregateType aggArg1) { - leftErrors += NumberOfErrorTypes(pTypeArgs1[i].AsAggregateType().GetTypeArgsAll()); + leftErrors += NumberOfErrorTypes(aggArg1.GetTypeArgsAll()); } - if (pTypeArgs2[i].IsAggregateType()) + if (pTypeArgs2[i] is AggregateType aggArg2) { - rightErrors += NumberOfErrorTypes(pTypeArgs2[i].AsAggregateType().GetTypeArgsAll()); + rightErrors += NumberOfErrorTypes(aggArg2.GetTypeArgsAll()); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs index c9eb5ae21d..a36dca6d7f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using Microsoft.CSharp.RuntimeBinder.Errors; using Microsoft.CSharp.RuntimeBinder.Syntax; namespace Microsoft.CSharp.RuntimeBinder.Semantics @@ -93,7 +92,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (_typeDest.GetTypeKind()) { case TypeKind.TK_ErrorType: - Debug.Assert(_typeDest.AsErrorType().HasTypeParent() || _typeDest.AsErrorType().HasNSParent()); + Debug.Assert(((ErrorType)_typeDest).HasParent); if (_typeSrc != _typeDest) { return false; @@ -105,7 +104,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; case TypeKind.TK_NullType: // Can only convert to the null type if src is null. - if (!_typeSrc.IsNullType()) + if (!(_typeSrc is NullType)) { return false; } @@ -115,9 +114,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } return true; case TypeKind.TK_MethodGroupType: - VSFAIL("Something is wrong with Type.IsNeverSameType()"); + Debug.Fail("Something is wrong with Type.IsNeverSameType()"); return false; - case TypeKind.TK_NaturalIntegerType: case TypeKind.TK_ArgumentListType: return _typeSrc == _typeDest; case TypeKind.TK_VoidType: @@ -126,9 +124,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics break; } - if (_typeSrc.IsErrorType()) + if (_typeSrc is ErrorType) { - Debug.Assert(!_typeDest.IsErrorType()); + Debug.Assert(!(_typeDest is ErrorType)); return false; } @@ -147,14 +145,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - if (_typeDest.IsNullableType()) + if (_typeDest is NullableType nubDest) { - return BindNubConversion(_typeDest.AsNullableType()); + return BindNubConversion(nubDest); } - if (_typeSrc.IsNullableType()) + if (_typeSrc is NullableType nubSrc) { - return bindImplicitConversionFromNullable(_typeSrc.AsNullableType()); + return bindImplicitConversionFromNullable(nubSrc); } if ((_flags & CONVERTTYPE.ISEXPLICIT) != 0) @@ -164,22 +162,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Get the fundamental types of destination. FUNDTYPE ftDest = _typeDest.fundType(); - Debug.Assert(ftDest != FUNDTYPE.FT_NONE || _typeDest.IsParameterModifierType()); + Debug.Assert(ftDest != FUNDTYPE.FT_NONE || _typeDest is ParameterModifierType); switch (_typeSrc.GetTypeKind()) { default: - VSFAIL("Bad type symbol kind"); + Debug.Fail($"Bad type symbol kind: {_typeSrc.GetTypeKind()}"); break; - case TypeKind.TK_MethodGroupType: - if (_exprSrc is ExprMemberGroup memGrp) - { - ExprCall outExpr; - bool retVal = _binder.BindGrpConversion(memGrp, _typeDest, _needsExprDest, out outExpr, false); - _exprDest = outExpr; - return retVal; - } - return false; case TypeKind.TK_VoidType: case TypeKind.TK_ErrorType: case TypeKind.TK_ParameterModifierType: @@ -206,15 +195,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // If not, try user defined implicit conversions. break; - case TypeKind.TK_TypeParameterType: - if (bindImplicitConversionFromTypeVar(_typeSrc.AsTypeParameterType())) - { - return true; - } - // If not, try user defined implicit conversions. - break; + case TypeKind.TK_AggregateType: - if (bindImplicitConversionFromAgg(_typeSrc.AsAggregateType())) + if (bindImplicitConversionFromAgg(_typeSrc as AggregateType)) { return true; } @@ -307,9 +290,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(_exprSrc == null || _exprSrc.Type == _typeSrc); Debug.Assert(!_needsExprDest || _exprSrc != null); Debug.Assert(_typeSrc != nubDst); // BindImplicitConversion should have taken care of this already. - AggregateType atsDst = nubDst.GetAts(GetErrorContext()); - if (atsDst == null) - return false; + AggregateType atsDst = nubDst.GetAts(); // Check for the unboxing conversion. This takes precedence over the wrapping conversions. if (GetSymbolLoader().HasBaseConversion(nubDst.GetUnderlyingType(), _typeSrc) && !CConversions.FWrappingConv(_typeSrc, nubDst)) @@ -345,7 +326,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(_typeSrc == typeSrcBase); // The null type can be implicitly converted to T? as the default value. - if (_typeSrc.IsNullType()) + if (_typeSrc is NullType) { // If we have the constant null, generate it as a default value of T?. If we have // some crazy expression which has been determined to be always null, like (null??null) @@ -419,18 +400,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Expr arg1 = _binder.mustCast(_exprSrc, typeSrcBase); ExprClass arg2 = GetExprFactory().CreateClass(typeDstBase); - bool convertible; - if (0 != (_flags & CONVERTTYPE.ISEXPLICIT)) - { - convertible = _binder.BindExplicitConversion(arg1, arg1.Type, arg2, typeDstBase, out arg1, _flags | CONVERTTYPE.NOUDC); - } - else - { - convertible = _binder.BindImplicitConversion(arg1, arg1.Type, arg2, typeDstBase, out arg1, _flags | CONVERTTYPE.NOUDC); - } + bool convertible = (_flags & CONVERTTYPE.ISEXPLICIT) != 0 + ? _binder.BindExplicitConversion( + arg1, arg1.Type, arg2, typeDstBase, out arg1, _flags | CONVERTTYPE.NOUDC) + : _binder.BindImplicitConversion( + arg1, arg1.Type, arg2, typeDstBase, out arg1, _flags | CONVERTTYPE.NOUDC); + if (!convertible) { - VSFAIL("bind(Im|Ex)plicitConversion failed unexpectedly"); + Debug.Fail("bind(Im|Ex)plicitConversion failed unexpectedly"); return false; } @@ -450,7 +428,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics FUNDTYPE ftDest = _typeDest.fundType(); if (ftDest != FUNDTYPE.FT_REF && ftDest != FUNDTYPE.FT_PTR && - (ftDest != FUNDTYPE.FT_VAR || !_typeDest.AsTypeParameterType().IsReferenceType()) && // null is convertible to System.Nullable. !_typeDest.isPredefType(PredefinedType.PT_G_OPTIONAL)) { @@ -490,11 +467,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Otherwise, the result is obtained by boxing the result of evaluating the Value property on // the nullable value. - AggregateType atsNub = nubSrc.GetAts(GetErrorContext()); - if (atsNub == null) - { - return false; - } + AggregateType atsNub = nubSrc.GetAts(); if (atsNub == _typeDest) { if (_needsExprDest) @@ -548,10 +521,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // including IList, ICollection, IEnumerable, IReadOnlyList, IReadOnlyCollection // and the non-generic versions. - if ((_typeDest.IsArrayType() || - (_typeDest.isInterfaceType() && - _typeDest.AsAggregateType().GetTypeArgsAll().Count == 1 && - ((_typeDest.AsAggregateType().GetTypeArgsAll()[0] != _typeSrc.AsArrayType().GetElementType()) || + if ((_typeDest is ArrayType || + (_typeDest is AggregateType aggDest && aggDest.isInterfaceType() && + aggDest.GetTypeArgsAll().Count == 1 && + ((aggDest.GetTypeArgsAll()[0] != ((ArrayType)_typeSrc).GetElementType()) || 0 != (_flags & CONVERTTYPE.FORCECAST)))) && (0 != (_flags & CONVERTTYPE.FORCECAST) || @@ -576,7 +549,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // * From any pointer-type to the type void*. - if (_typeDest.IsPointerType() && _typeDest.AsPointerType().GetReferentType() == _binder.getVoidType()) + if (_typeDest is PointerType ptDest && ptDest.GetReferentType() == _binder.getVoidType()) { if (_needsExprDest) _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest); @@ -630,7 +603,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // * From any delegate-type to System.Delegate. // * From any delegate-type to System.ICloneable. - if (!_typeDest.IsAggregateType() || !GetSymbolLoader().HasBaseConversion(pSource, _typeDest)) + if (!(_typeDest is AggregateType) || !GetSymbolLoader().HasBaseConversion(pSource, _typeDest)) { return false; } @@ -660,7 +633,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // base class for all enums (21.4). A struct or enum can be boxed to the type System.ValueType, // since that is the direct base class for all structs (18.3.2) and a base class for all enums. - if (_typeDest.IsAggregateType() && GetSymbolLoader().HasBaseConversion(aggTypeSrc, _typeDest.AsAggregateType())) + if (_typeDest is AggregateType aggDest && GetSymbolLoader().HasBaseConversion(aggTypeSrc, aggDest)) { if (_needsExprDest) _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_BOX | EXPRFLAG.EXF_CANTBENULL); @@ -792,84 +765,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - private bool bindImplicitConversionFromTypeVar(TypeParameterType tyVarSrc) - { - // 13.1.4 - // - // For a type-parameter T that is known to be a reference type (25.7), the following implicit - // reference conversions exist: - // - // * From T to its effective base class C, from T to any base class of C, and from T to any - // interface implemented by C. - // * From T to an interface-type I in T's effective interface set and from T to any base - // interface of I. - // * From T to a type parameter U provided that T depends on U (25.7). [Note: Since T is known - // to be a reference type, within the scope of T, the run-time type of U will always be a - // reference type, even if U is not known to be a reference type at compile-time.] - // * From the null type (11.2.7) to T. - // - // 13.1.5 - // - // For a type-parameter T that is not known to be a reference type (25.7), the following conversions - // involving T are considered to be boxing conversions at compile-time. At run-time, if T is a value - // type, the conversion is executed as a boxing conversion. At run-time, if T is a reference type, - // the conversion is executed as an implicit reference conversion or identity conversion. - // - // * From T to its effective base class C, from T to any base class of C, and from T to any - // interface implemented by C. [Note: C will be one of the types System.Object, System.ValueType, - // or System.Enum (otherwise T would be known to be a reference type and 13.1.4 would apply - // instead of this clause).] - // * From T to an interface-type I in T's effective interface set and from T to any base - // interface of I. - // - // 13.1.6 Implicit type parameter conversions - // - // This clause details implicit conversions involving type parameters that are not classified as - // implicit reference conversions or implicit boxing conversions. - // - // For a type-parameter T that is not known to be a reference type, there is an implicit conversion - // from T to a type parameter U provided T depends on U. At run-time, if T is a value type and U is - // a reference type, the conversion is executed as a boxing conversion. At run-time, if both T and U - // are value types, then T and U are necessarily the same type and no conversion is performed. At - // run-time, if T is a reference type, then U is necessarily also a reference type and the conversion - // is executed as an implicit reference conversion or identity conversion (25.7). - - CType typeTmp = tyVarSrc.GetEffectiveBaseClass(); - TypeArray bnds = tyVarSrc.GetBounds(); - int itype = -1; - for (; ;) - { - if (_binder.canConvert(typeTmp, _typeDest, _flags | CONVERTTYPE.NOUDC)) - { - if (!_needsExprDest) - { - return true; - } - if (_typeDest.IsTypeParameterType()) - { - // For a type var destination we need to cast to object then to the other type var. - Expr exprT; - ExprClass exprObj = GetExprFactory().CreateClass(_binder.GetReqPDT(PredefinedType.PT_OBJECT)); - _binder.bindSimpleCast(_exprSrc, exprObj, out exprT, EXPRFLAG.EXF_FORCE_BOX); - _binder.bindSimpleCast(exprT, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_FORCE_UNBOX); - } - else - { - _binder.bindSimpleCast(_exprSrc, _exprTypeDest, out _exprDest, EXPRFLAG.EXF_FORCE_BOX); - } - return true; - } - do - { - if (++itype >= bnds.Count) - { - return false; - } - typeTmp = bnds[itype]; - } - while (!typeTmp.isInterfaceType() && !typeTmp.IsTypeParameterType()); - } - } private SymbolLoader GetSymbolLoader() { return _binder.GetSymbolLoader(); @@ -878,10 +773,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return _binder.GetExprFactory(); } - private ErrorHandling GetErrorContext() - { - return _binder.GetErrorContext(); - } } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/LangCompiler.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/LangCompiler.cs deleted file mode 100644 index 54c8b127c1..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/LangCompiler.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using Microsoft.CSharp.RuntimeBinder.Errors; -using Microsoft.CSharp.RuntimeBinder.Syntax; - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - internal sealed class LangCompiler : - CSemanticChecker, - IErrorSink - { - private SymbolLoader _symbolLoader; - private CController _pController; // This is our parent "controller" - private ErrorHandling _errorContext; - - //////////////////////////////////////////////////////////////////////////////// - // Construct a compiler. All the real work is done in the Init() routine. This - // primary initializes all the sub-components. - - public LangCompiler(CController pCtrl, NameManager pNameMgr) - { - Debug.Assert(pCtrl != null); - - _pController = pCtrl; - GlobalSymbolContext globalSymbolContext = new GlobalSymbolContext(pNameMgr); - _errorContext = new ErrorHandling(new UserStringBuilder(globalSymbolContext), this, pCtrl.GetErrorFactory()); - _symbolLoader = new SymbolLoader(globalSymbolContext, _errorContext); - } - - private new ErrorHandling GetErrorContext() - { - return _errorContext; - } - - public override SymbolLoader SymbolLoader { get { return _symbolLoader; } } - public override SymbolLoader GetSymbolLoader() { return _symbolLoader; } - - //////////////////////////////////////////////////////////////////////////////// - // Searches the class [atsSearch] to see if it contains a method which is - // sufficient to implement [mwt]. Does not search base classes. [mwt] is - // typically a method in some interface. We may be implementing this interface - // at some particular type, e.g. IList, and so the required signature is - // the instantiation (i.e. substitution) of [mwt] for that instance. Similarly, - // the implementation may be provided by some base class that exists via - // polymorphic inheritance, e.g. Foo : List, and so we must instantiate - // the parameters for each potential implementation. [atsSearch] may thus be an - // instantiated type. - // - // If fOverride is true, this checks for a method with swtSlot set to the - // particular method. - public void SubmitError(CParameterizedError error) - { - _pController.SubmitError(GetErrorContext().RealizeError(error)); - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs index 86b51f256c..ce889a0964 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs @@ -11,6 +11,7 @@ using Microsoft.CSharp.RuntimeBinder.Syntax; namespace Microsoft.CSharp.RuntimeBinder.Semantics { + [Flags] internal enum MemLookFlags : uint { None = 0, @@ -24,10 +25,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // All EXF flags are < 0x01000000 MustBeInvocable = 0x20000000, - TypeVarsAllowed = 0x40000000, - ExtensionCall = 0x80000000, - All = Ctor | NewObj | Operator | Indexer | UserCallable | BaseCall | MustBeInvocable | TypeVarsAllowed | ExtensionCall + All = Ctor | NewObj | Operator | Indexer | UserCallable | BaseCall | MustBeInvocable } ///////////////////////////////////////////////////////////////////////////////// @@ -109,7 +108,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _swtFirst.Set(sym, type); Debug.Assert(_csym == 1); Debug.Assert(_prgtype[0] == type); - _fMulti = sym.IsMethodSymbol() || sym.IsPropertySymbol() && sym.AsPropertySymbol().isIndexer(); + _fMulti = sym is MethodSymbol || sym is IndexerSymbol; } } @@ -145,7 +144,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // For non-zero arity, only methods of the correct arity are considered. // For zero arity, don't filter out any methods since we do type argument // inferencing. - if (_arity > 0 && symCur.AsMethodSymbol().typeVars.Count != _arity) + if (_arity > 0 && ((MethodSymbol)symCur).typeVars.Count != _arity) { if (!_swtBadArity) _swtBadArity.Set(symCur, typeCur); @@ -155,18 +154,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case SYMKIND.SK_AggregateSymbol: // For types, always filter on arity. - if (symCur.AsAggregateSymbol().GetTypeVars().Count != _arity) - { - if (!_swtBadArity) - _swtBadArity.Set(symCur, typeCur); - continue; - } - break; - - case SYMKIND.SK_TypeParameterSymbol: - if ((_flags & MemLookFlags.TypeVarsAllowed) == 0) - continue; - if (_arity > 0) + if (((AggregateSymbol)symCur).GetTypeVars().Count != _arity) { if (!_swtBadArity) _swtBadArity.Set(symCur, typeCur); @@ -194,19 +182,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } continue; } - if ((_flags & MemLookFlags.UserCallable) != 0 && symCur.IsMethodOrPropertySymbol() && !symCur.AsMethodOrPropertySymbol().isUserCallable()) - { - bool bIsIndexedProperty = false; - // If its an indexed property method symbol, let it through. - if (symCur.IsMethodSymbol() && - symCur.AsMethodSymbol().isPropertyAccessor() && - ((symCur.name.Text.StartsWith("set_", StringComparison.Ordinal) && symCur.AsMethodSymbol().Params.Count > 1) || - (symCur.name.Text.StartsWith("get_", StringComparison.Ordinal) && symCur.AsMethodSymbol().Params.Count > 0))) - { - bIsIndexedProperty = true; - } - if (!bIsIndexedProperty) + MethodOrPropertySymbol methProp = symCur as MethodOrPropertySymbol; + MethodSymbol meth = symCur as MethodSymbol; + if (methProp != null && (_flags & MemLookFlags.UserCallable) != 0 && !methProp.isUserCallable()) + { + // If its an indexed property method symbol, let it through. + if (meth != null && + meth.isPropertyAccessor() && + ((symCur.name.Text.StartsWith("set_", StringComparison.Ordinal) && meth.Params.Count > 1) || + (symCur.name.Text.StartsWith("get_", StringComparison.Ordinal) && meth.Params.Count > 0))) { if (!_swtInaccess) { @@ -230,10 +215,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics continue; } + PropertySymbol prop = symCur as PropertySymbol; + // Make sure that whether we're seeing a ctor, operator, or indexer is consistent with the flags. - if (((_flags & MemLookFlags.Ctor) == 0) != (!symCur.IsMethodSymbol() || !symCur.AsMethodSymbol().IsConstructor()) || - ((_flags & MemLookFlags.Operator) == 0) != (!symCur.IsMethodSymbol() || !symCur.AsMethodSymbol().isOperator) || - ((_flags & MemLookFlags.Indexer) == 0) != (!symCur.IsPropertySymbol() || !symCur.AsPropertySymbol().isIndexer())) + if (((_flags & MemLookFlags.Ctor) == 0) != (meth == null || !meth.IsConstructor()) || + ((_flags & MemLookFlags.Operator) == 0) != (meth == null || !meth.isOperator) || + ((_flags & MemLookFlags.Indexer) == 0) != !(prop is IndexerSymbol)) { if (!_swtBad) { @@ -245,7 +232,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // We can't call CheckBogus on methods or indexers because if the method has the wrong // number of parameters people don't think they should have to /r the assemblies containing // the parameter types and they complain about the resulting CS0012 errors. - if (!symCur.IsMethodSymbol() && (_flags & MemLookFlags.Indexer) == 0 && GetSemanticChecker().CheckBogus(symCur)) + if (!(symCur is MethodSymbol) && (_flags & MemLookFlags.Indexer) == 0 && CSemanticChecker.CheckBogus(symCur)) { // A bogus member - we can't use these, so only record them for error reporting. if (!_swtBogus) @@ -258,8 +245,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // if we are in a calling context then we should only find a property if it is delegate valued if ((_flags & MemLookFlags.MustBeInvocable) != 0) { - if ((symCur.IsFieldSymbol() && !IsDelegateType(symCur.AsFieldSymbol().GetType(), typeCur) && !IsDynamicMember(symCur)) || - (symCur.IsPropertySymbol() && !IsDelegateType(symCur.AsPropertySymbol().RetType, typeCur) && !IsDynamicMember(symCur))) + if ((symCur is FieldSymbol field && !IsDelegateType(field.GetType(), typeCur) && !IsDynamicMember(symCur)) || + (prop != null && !IsDelegateType(prop.RetType, typeCur) && !IsDynamicMember(symCur))) { if (!_swtBad) { @@ -269,9 +256,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - if (symCur.IsMethodOrPropertySymbol()) + if (methProp != null) { - MethPropWithType mwpInsert = new MethPropWithType(symCur.AsMethodOrPropertySymbol(), typeCur); + MethPropWithType mwpInsert = new MethPropWithType(methProp, typeCur); _methPropWithTypeList.Add(mwpInsert); } @@ -286,8 +273,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(_fMulti || typeCur == _prgtype[0]); if (!_fMulti) { - if (_swtFirst.Sym.IsFieldSymbol() && symCur.IsEventSymbol() - // The isEvent bit is only set on symbols which come from source... + if (_swtFirst.Sym is FieldSymbol && symCur is EventSymbol + // The isEvent bit is only set on symbols which come from source... // This is not a problem for the compiler because the field is only // accessible in the scope in which it is declared, // but in the EE we ignore accessibility... @@ -297,7 +284,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // m_swtFirst is just the field behind the event symCur so ignore symCur. continue; } - else if (_swtFirst.Sym.IsFieldSymbol() && symCur.IsEventSymbol()) + else if (_swtFirst.Sym is FieldSymbol && symCur is EventSymbol) { // symCur is the matching event. continue; @@ -324,7 +311,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics else if (!_fMulti) { // Give method groups priority. - if ( /* !GetSymbolLoader().options.fLookupHack ||*/ !symCur.IsMethodSymbol()) + if (!(symCur is MethodSymbol)) goto LAmbig; _swtAmbigWarn = _swtFirst; // Erase previous results so we'll record this method as the first. @@ -338,7 +325,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (!typeCur.fDiffHidden) { // Give method groups priority. - if ( /*!GetSymbolLoader().options.fLookupHack ||*/ !_swtFirst.Sym.IsMethodSymbol()) + if (!(_swtFirst.Sym is MethodSymbol)) goto LAmbig; if (!_swtAmbigWarn) _swtAmbigWarn.Set(symCur, typeCur); @@ -351,7 +338,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics RecordType(typeCur, symCur); - if (symCur.IsMethodOrPropertySymbol() && symCur.AsMethodOrPropertySymbol().isHideByName) + if (methProp != null && methProp.isHideByName) pfHideByName = true; // We've found a symbol in this type but need to make sure there aren't any conflicting // syms here, so keep searching the type. @@ -372,13 +359,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool IsDynamicMember(Symbol sym) { System.Runtime.CompilerServices.DynamicAttribute da = null; - if (sym.IsFieldSymbol()) + if (sym is FieldSymbol field) { - if (!sym.AsFieldSymbol().getType().isPredefType(PredefinedType.PT_OBJECT)) + if (!field.getType().isPredefType(PredefinedType.PT_OBJECT)) { return false; } - var o = sym.AsFieldSymbol().AssociatedFieldInfo.GetCustomAttributes(typeof(System.Runtime.CompilerServices.DynamicAttribute), false).ToArray(); + var o = field.AssociatedFieldInfo.GetCustomAttributes(typeof(System.Runtime.CompilerServices.DynamicAttribute), false).ToArray(); if (o.Length == 1) { da = o[0] as System.Runtime.CompilerServices.DynamicAttribute; @@ -386,12 +373,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } else { - Debug.Assert(sym.IsPropertySymbol()); - if (!sym.AsPropertySymbol().getType().isPredefType(PredefinedType.PT_OBJECT)) + Debug.Assert(sym is PropertySymbol); + PropertySymbol prop = (PropertySymbol)sym; + if (!prop.getType().isPredefType(PredefinedType.PT_OBJECT)) { return false; } - var o = sym.AsPropertySymbol().AssociatedPropertyInfo.GetCustomAttributes(typeof(System.Runtime.CompilerServices.DynamicAttribute), false).ToArray(); + var o = prop.AssociatedPropertyInfo.GetCustomAttributes(typeof(System.Runtime.CompilerServices.DynamicAttribute), false).ToArray(); if (o.Length == 1) { da = o[0] as System.Runtime.CompilerServices.DynamicAttribute; @@ -430,7 +418,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics bool fHideByName = false; SearchSingleType(typeCur, out fHideByName); - _flags &= ~MemLookFlags.TypeVarsAllowed; if (_swtFirst && !_fMulti) { @@ -477,7 +464,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int i = 0; i < types.Count; i++) { - AggregateType type = types[i].AsAggregateType(); + AggregateType type = (AggregateType)types[i]; Debug.Assert(type.isInterfaceType()); type.fAllHidden = false; type.fDiffHidden = !!_swtFirst; @@ -489,7 +476,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (typeCur == null) { - typeCur = types[itypeNext++].AsAggregateType(); + typeCur = (AggregateType)types[itypeNext++]; } Debug.Assert(typeCur != null); @@ -508,7 +495,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TypeArray ifaces = typeCur.GetIfacesAll(); for (int i = 0; i < ifaces.Count; i++) { - AggregateType type = ifaces[i].AsAggregateType(); + AggregateType type = (AggregateType)ifaces[i]; Debug.Assert(type.isInterfaceType()); if (fHideByName) type.fAllHidden = true; @@ -519,13 +506,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (fHideByName) fHideObject = true; } - _flags &= ~MemLookFlags.TypeVarsAllowed; if (itypeNext >= types.Count) return !fHideObject; // Substitution has already been done. - typeCur = types[itypeNext++].AsAggregateType(); + typeCur = types[itypeNext++] as AggregateType; } } @@ -533,53 +519,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private CSemanticChecker GetSemanticChecker() { return _pSemanticChecker; } private ErrorHandling GetErrorContext() { return GetSymbolLoader().GetErrorContext(); } - private void ReportBogus(SymWithType swt) + private RuntimeBinderException ReportBogus(SymWithType swt) { - Debug.Assert(swt.Sym.hasBogus() && swt.Sym.checkBogus()); - - switch (swt.Sym.getKind()) - { - case SYMKIND.SK_EventSymbol: - break; - - case SYMKIND.SK_PropertySymbol: - if (swt.Prop().useMethInstead) - { - MethodSymbol meth1 = swt.Prop().methGet; - MethodSymbol meth2 = swt.Prop().methSet; - ReportBogusForEventsAndProperties(swt, meth1, meth2); - return; - } - break; - - case SYMKIND.SK_MethodSymbol: - if (swt.Meth().name == NameManager.GetPredefinedName(PredefinedName.PN_INVOKE) && swt.Meth().getClass().IsDelegate()) - { - swt.Set(swt.Meth().getClass(), swt.GetType()); - } - break; - - default: - break; - } - - // Generic bogus error. - GetErrorContext().ErrorRef(ErrorCode.ERR_BindToBogus, swt); - } - - private void ReportBogusForEventsAndProperties(SymWithType swt, MethodSymbol meth1, MethodSymbol meth2) - { - if (meth1 != null && meth2 != null) - { - GetErrorContext().Error(ErrorCode.ERR_BindToBogusProp2, swt.Sym.name, new SymWithType(meth1, swt.GetType()), new SymWithType(meth2, swt.GetType()), new ErrArgRefOnly(swt.Sym)); - return; - } - if (meth1 != null || meth2 != null) - { - GetErrorContext().Error(ErrorCode.ERR_BindToBogusProp1, swt.Sym.name, new SymWithType(meth1 != null ? meth1 : meth2, swt.GetType()), new ErrArgRefOnly(swt.Sym)); - return; - } - throw Error.InternalCompilerError(); + Debug.Assert(CSemanticChecker.CheckBogus(swt.Sym)); + MethodSymbol meth1 = swt.Prop().GetterMethod; + MethodSymbol meth2 = swt.Prop().SetterMethod; + Debug.Assert((meth1 ?? meth2) != null); + return meth1 == null | meth2 == null + ? GetErrorContext().Error( + ErrorCode.ERR_BindToBogusProp1, swt.Sym.name, new SymWithType(meth1 ?? meth2, swt.GetType()), + new ErrArgRefOnly(swt.Sym)) + : GetErrorContext().Error( + ErrorCode.ERR_BindToBogusProp2, swt.Sym.name, new SymWithType(meth1, swt.GetType()), + new SymWithType(meth2, swt.GetType()), new ErrArgRefOnly(swt.Sym)); } private bool IsDelegateType(CType pSrcType, AggregateType pAggType) @@ -626,14 +578,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert((flags & ~MemLookFlags.All) == 0); Debug.Assert(obj == null || obj.Type != null); - Debug.Assert(typeSrc.IsAggregateType() || typeSrc.IsTypeParameterType()); + Debug.Assert(typeSrc is AggregateType); Debug.Assert(checker != null); _prgtype = _rgtypeStart; // Save the inputs for error handling, etc. _pSemanticChecker = checker; - _pSymbolLoader = checker.GetSymbolLoader(); + _pSymbolLoader = checker.SymbolLoader; _typeSrc = typeSrc; _obj = obj is ExprClass ? null : obj; _symWhere = symWhere; @@ -641,14 +593,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _arity = arity; _flags = flags; - if ((_flags & MemLookFlags.BaseCall) != 0) - _typeQual = null; - else if ((_flags & MemLookFlags.Ctor) != 0) - _typeQual = _typeSrc; - else if (obj != null) - _typeQual = (CType)obj.Type; - else - _typeQual = null; + _typeQual = (_flags & MemLookFlags.Ctor) != 0 ? _typeSrc : obj?.Type; // Determine what to search. AggregateType typeCls1 = null; @@ -656,18 +601,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TypeArray ifaces = BSYMMGR.EmptyTypeArray(); AggregateType typeCls2 = null; - if (typeSrc.IsTypeParameterType()) + if (!typeSrc.isInterfaceType()) { - Debug.Assert((_flags & (MemLookFlags.Ctor | MemLookFlags.NewObj | MemLookFlags.Operator | MemLookFlags.BaseCall | MemLookFlags.TypeVarsAllowed)) == 0); - _flags &= ~MemLookFlags.TypeVarsAllowed; - ifaces = typeSrc.AsTypeParameterType().GetInterfaceBounds(); - typeCls1 = typeSrc.AsTypeParameterType().GetEffectiveBaseClass(); - if (ifaces.Count > 0 && typeCls1.isPredefType(PredefinedType.PT_OBJECT)) - typeCls1 = null; - } - else if (!typeSrc.isInterfaceType()) - { - typeCls1 = typeSrc.AsAggregateType(); + typeCls1 = (AggregateType)typeSrc; if (typeCls1.IsWindowsRuntimeType()) { @@ -678,12 +614,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(typeSrc.isInterfaceType()); Debug.Assert((_flags & (MemLookFlags.Ctor | MemLookFlags.NewObj | MemLookFlags.Operator | MemLookFlags.BaseCall)) == 0); - typeIface = typeSrc.AsAggregateType(); + typeIface = (AggregateType)typeSrc; ifaces = typeIface.GetIfacesAll(); } if (typeIface != null || ifaces.Count > 0) - typeCls2 = GetSymbolLoader().GetReqPredefType(PredefinedType.PT_OBJECT); + typeCls2 = GetSymbolLoader().GetPredefindType(PredefinedType.PT_OBJECT); // Search the class first (except possibly object). if (typeCls1 == null || LookupInClass(typeCls1, ref typeCls2)) @@ -725,10 +661,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return _swtFirst; } - public SymWithType SwtInaccessible() - { - return _swtInaccess; - } public Expr GetObject() { @@ -754,7 +686,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics /****************************************************************************** Reports errors. Only call this if FError() is true. ******************************************************************************/ - public void ReportErrors() + public Exception ReportErrors() { Debug.Assert(FError()); @@ -765,43 +697,44 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (_swtFirst) { // Ambiguous lookup. - GetErrorContext().ErrorRef(ErrorCode.ERR_AmbigMember, _swtFirst, _swtAmbig); + return GetErrorContext().Error(ErrorCode.ERR_AmbigMember, _swtFirst, _swtAmbig); } - else if (_swtInaccess) + + if (_swtInaccess) { - if (!_swtInaccess.Sym.isUserCallable() && ((_flags & MemLookFlags.UserCallable) != 0)) - GetErrorContext().Error(ErrorCode.ERR_CantCallSpecialMethod, _swtInaccess); - else - GetSemanticChecker().ReportAccessError(_swtInaccess, _symWhere, _typeQual); + return !_swtInaccess.Sym.isUserCallable() && ((_flags & MemLookFlags.UserCallable) != 0) + ? GetErrorContext().Error(ErrorCode.ERR_CantCallSpecialMethod, _swtInaccess) + : GetSemanticChecker().ReportAccessError(_swtInaccess, _symWhere, _typeQual); } - else if ((_flags & MemLookFlags.Ctor) != 0) + + if ((_flags & MemLookFlags.Ctor) != 0) { - if (_arity > 0) - { - GetErrorContext().Error(ErrorCode.ERR_BadCtorArgCount, _typeSrc.getAggregate(), _arity); - } - else - { - GetErrorContext().Error(ErrorCode.ERR_NoConstructors, _typeSrc.getAggregate()); - } + return _arity > 0 + ? GetErrorContext().Error(ErrorCode.ERR_BadCtorArgCount, _typeSrc.getAggregate(), _arity) + : GetErrorContext().Error(ErrorCode.ERR_NoConstructors, _typeSrc.getAggregate()); } - else if ((_flags & MemLookFlags.Operator) != 0) + + if ((_flags & MemLookFlags.Operator) != 0) { - GetErrorContext().Error(ErrorCode.ERR_NoSuchMember, _typeSrc, _name); + return GetErrorContext().Error(ErrorCode.ERR_NoSuchMember, _typeSrc, _name); } - else if ((_flags & MemLookFlags.Indexer) != 0) + + if ((_flags & MemLookFlags.Indexer) != 0) { - GetErrorContext().Error(ErrorCode.ERR_BadIndexLHS, _typeSrc); + return GetErrorContext().Error(ErrorCode.ERR_BadIndexLHS, _typeSrc); } - else if (_swtBad) + + if (_swtBad) { - GetErrorContext().Error((_flags & MemLookFlags.MustBeInvocable) != 0 ? ErrorCode.ERR_NonInvocableMemberCalled : ErrorCode.ERR_CantCallSpecialMethod, _swtBad); + return GetErrorContext().Error((_flags & MemLookFlags.MustBeInvocable) != 0 ? ErrorCode.ERR_NonInvocableMemberCalled : ErrorCode.ERR_CantCallSpecialMethod, _swtBad); } - else if (_swtBogus) + + if (_swtBogus) { - ReportBogus(_swtBogus); + return ReportBogus(_swtBogus); } - else if (_swtBadArity) + + if (_swtBadArity) { int cvar; @@ -809,30 +742,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { case SYMKIND.SK_MethodSymbol: Debug.Assert(_arity != 0); - cvar = _swtBadArity.Sym.AsMethodSymbol().typeVars.Count; - GetErrorContext().ErrorRef(cvar > 0 ? ErrorCode.ERR_BadArity : ErrorCode.ERR_HasNoTypeVars, _swtBadArity, new ErrArgSymKind(_swtBadArity.Sym), cvar); - break; + cvar = ((MethodSymbol)_swtBadArity.Sym).typeVars.Count; + return GetErrorContext().Error(cvar > 0 ? ErrorCode.ERR_BadArity : ErrorCode.ERR_HasNoTypeVars, _swtBadArity, new ErrArgSymKind(_swtBadArity.Sym), cvar); + case SYMKIND.SK_AggregateSymbol: - cvar = _swtBadArity.Sym.AsAggregateSymbol().GetTypeVars().Count; - GetErrorContext().ErrorRef(cvar > 0 ? ErrorCode.ERR_BadArity : ErrorCode.ERR_HasNoTypeVars, _swtBadArity, new ErrArgSymKind(_swtBadArity.Sym), cvar); - break; + cvar = ((AggregateSymbol)_swtBadArity.Sym).GetTypeVars().Count; + return GetErrorContext().Error(cvar > 0 ? ErrorCode.ERR_BadArity : ErrorCode.ERR_HasNoTypeVars, _swtBadArity, new ErrArgSymKind(_swtBadArity.Sym), cvar); + default: Debug.Assert(_arity != 0); - ExpressionBinder.ReportTypeArgsNotAllowedError(GetSymbolLoader(), _arity, _swtBadArity, new ErrArgSymKind(_swtBadArity.Sym)); - break; - } - } - else - { - if ((_flags & MemLookFlags.ExtensionCall) != 0) - { - GetErrorContext().Error(ErrorCode.ERR_NoSuchMemberOrExtension, _typeSrc, _name); - } - else - { - GetErrorContext().Error(ErrorCode.ERR_NoSuchMember, _typeSrc, _name); + return GetErrorContext().Error(ErrorCode.ERR_TypeArgsNotAllowed, _swtBadArity, new ErrArgSymKind(_swtBadArity.Sym)); } } + + return GetErrorContext().Error(ErrorCode.ERR_NoSuchMember, _typeSrc, _name); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodIterator.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodIterator.cs index 2b66416c23..3c49ad4573 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodIterator.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodIterator.cs @@ -34,9 +34,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // if Extension can be part of the results that are returned by the iterator // this may be false if an applicable instance method was found by bindgrptoArgs private bool _bcanIncludeExtensionsInResults; - // we have found a applicable extension and only continue to the end of the current - // Namespace's extension methodlist - private bool _bEndIterationAtCurrentExtensionList; public CMethodIterator(CSemanticChecker checker, SymbolLoader symLoader, Name name, TypeArray containingTypes, CType @object, CType qualifyingType, AggregateDeclaration context, bool allowBogusAndInaccessible, bool allowExtensionMethods, int arity, EXPRFLAG flags, symbmask_t mask) { @@ -62,7 +59,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _bCurrentSymIsBogus = false; _bCurrentSymIsInaccessible = false; _bcanIncludeExtensionsInResults = allowExtensionMethods; - _bEndIterationAtCurrentExtensionList = false; } public MethodOrPropertySymbol GetCurrentSymbol() { @@ -80,16 +76,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return _bCurrentSymIsBogus; } - public bool MoveNext(bool canIncludeExtensionsInResults, bool endatCurrentExtensionList) + public bool MoveNext(bool canIncludeExtensionsInResults) { if (_bcanIncludeExtensionsInResults) { _bcanIncludeExtensionsInResults = canIncludeExtensionsInResults; } - if (!_bEndIterationAtCurrentExtensionList) - { - _bEndIterationAtCurrentExtensionList = endatCurrentExtensionList; - } if (_bAtEnd) { @@ -143,9 +135,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Make sure that whether we're seeing a ctor is consistent with the flag. // The only properties we handle are indexers. if (_mask == symbmask_t.MASK_MethodSymbol && ( - 0 == (_flags & EXPRFLAG.EXF_CTOR) != !_pCurrentSym.AsMethodSymbol().IsConstructor() || - 0 == (_flags & EXPRFLAG.EXF_OPERATOR) != !_pCurrentSym.AsMethodSymbol().isOperator) || - _mask == symbmask_t.MASK_PropertySymbol && !_pCurrentSym.AsPropertySymbol().isIndexer()) + 0 == (_flags & EXPRFLAG.EXF_CTOR) != !((MethodSymbol)_pCurrentSym).IsConstructor() || + 0 == (_flags & EXPRFLAG.EXF_OPERATOR) != !((MethodSymbol)_pCurrentSym).isOperator) || + _mask == symbmask_t.MASK_PropertySymbol && !(_pCurrentSym is IndexerSymbol)) { // Get the next symbol. return false; @@ -154,7 +146,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // If our arity is non-0, we must match arity with this symbol. if (_nArity > 0) { - if (_mask == symbmask_t.MASK_MethodSymbol && _pCurrentSym.AsMethodSymbol().typeVars.Count != _nArity) + if (_mask == symbmask_t.MASK_MethodSymbol && ((MethodSymbol)_pCurrentSym).typeVars.Count != _nArity) { return false; } @@ -181,7 +173,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // Check bogus. - if (GetSemanticChecker().CheckBogus(_pCurrentSym)) + if (CSemanticChecker.CheckBogus(_pCurrentSym)) { // Sym is bogus, but if we're allow it, then let it through and mark it. if (_bAllowBogusAndInaccessible) @@ -194,17 +186,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - // if we are done checking all the instance types ensure that currentsym is an - // extension method and not a simple static method - if (!_bIsCheckingInstanceMethods) - { - if (!_pCurrentSym.AsMethodSymbol().IsExtension()) - { - return false; - } - } - - return true; + return _bIsCheckingInstanceMethods; } private bool FindNextMethod() @@ -214,12 +196,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (_pCurrentSym == null) { _pCurrentSym = GetSymbolLoader().LookupAggMember( - _pName, _pCurrentType.getAggregate(), _mask).AsMethodOrPropertySymbol(); + _pName, _pCurrentType.getAggregate(), _mask) as MethodOrPropertySymbol; } else { _pCurrentSym = GetSymbolLoader().LookupNextSym( - _pCurrentSym, _pCurrentType.getAggregate(), _mask).AsMethodOrPropertySymbol(); + _pCurrentSym, _pCurrentType.getAggregate(), _mask) as MethodOrPropertySymbol; } // If we couldn't find a sym, we look up the type chain and get the next type. @@ -269,7 +251,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } else { - _pCurrentType = _pContainingTypes[_nCurrentTypeCount++].AsAggregateType(); + _pCurrentType = _pContainingTypes[_nCurrentTypeCount++] as AggregateType; } } else diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs index 52d354ac53..011d482224 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Generic; using System.Diagnostics; using Microsoft.CSharp.RuntimeBinder.Syntax; @@ -17,6 +18,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics NoProgress, Success } + + [Flags] private enum Dependency { Unknown = 0x00, @@ -179,12 +182,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // for a CType variable that we couldn't infer. if (_pFixedResults[iParam] != null) { - if (!_pFixedResults[iParam].IsErrorType()) + if (!(_pFixedResults[iParam] is ErrorType err)) { continue; } - Name pErrorTypeName = _pFixedResults[iParam].AsErrorType().nameText; + Name pErrorTypeName = err.nameText; if (pErrorTypeName != null) { continue; @@ -192,9 +195,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } _pFixedResults[iParam] = GetTypeManager().GetErrorType( - null/*pParentType*/, - null, - (_pMethodTypeParameters.ItemAsTypeParameterType(iParam)).GetName(), + ((TypeParameterType)_pMethodTypeParameters[iParam]).GetName(), BSYMMGR.EmptyTypeArray()); } return GetGlobalSymbols().AllocParams(_pMethodTypeParameters.Count, _pFixedResults); @@ -216,7 +217,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(pParam != null); Debug.Assert(pParam.IsMethodTypeParameter()); int iParam = pParam.GetIndexInTotalParameters(); - Debug.Assert(_pMethodTypeParameters.ItemAsTypeParameterType(iParam) == pParam); + Debug.Assert(_pMethodTypeParameters[iParam] == pParam); return IsUnfixed(iParam); } @@ -296,13 +297,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics CType[] ppMethodParameters = new CType[_pMethodTypeParameters.Count]; for (int iParam = 0; iParam < _pMethodTypeParameters.Count; iParam++) { - TypeParameterType pParam = _pMethodTypeParameters.ItemAsTypeParameterType(iParam); + TypeParameterType pParam = (TypeParameterType)_pMethodTypeParameters[iParam]; ppMethodParameters[iParam] = IsUnfixed(iParam) ? pParam : _pFixedResults[iParam]; } SubstContext subsctx = new SubstContext(_pClassTypeArguments.Items, _pClassTypeArguments.Count, ppMethodParameters, _pMethodTypeParameters.Count); AggregateType pFixedDelegateType = - GetTypeManager().SubstType(pDelegateType, subsctx).AsAggregateType(); + GetTypeManager().SubstType(pDelegateType, subsctx) as AggregateType; TypeArray pFixedDelegateParams = pFixedDelegateType.GetDelegateParameters(GetSymbolLoader()); return pFixedDelegateParams; @@ -326,16 +327,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics //////////////////////////////////////////////////////////////////////////////// - private static bool IsReallyAType(CType pType) - { - if (pType.IsNullType() || pType.IsBoundLambdaType() || - pType.IsVoidType() || - pType.IsMethodGroupType()) - { - return false; - } - return true; - } + private static bool IsReallyAType(CType pType) => + !(pType is NullType) && !(pType is VoidType) && !(pType is MethodGroupType); //////////////////////////////////////////////////////////////////////////////// // @@ -385,14 +378,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics bool wasOutOrRef = false; - if (pDest.IsParameterModifierType()) + if (pDest is ParameterModifierType modDest) { - pDest = pDest.AsParameterModifierType().GetParameterType(); + pDest = modDest.GetParameterType(); wasOutOrRef = true; } - if (pSource.IsParameterModifierType()) + if (pSource is ParameterModifierType modSource) { - pSource = pSource.AsParameterModifierType().GetParameterType(); + pSource = modSource.GetParameterType(); } // If the argument is a TYPEORNAMESPACEERROR and the pSource is an // error CType, then we want to set it to the generic error CType @@ -559,18 +552,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int iArg = 0; iArg < _pMethodArguments.carg; iArg++) { CType pDest = _pMethodFormalParameterTypes[iArg]; - if (pDest.IsParameterModifierType()) + if (pDest is ParameterModifierType modDest) { - pDest = pDest.AsParameterModifierType().GetParameterType(); + pDest = modDest.GetParameterType(); } Expr pExpr = _pMethodArguments.prgexpr[iArg]; if (HasUnfixedParamInOutputType(pExpr, pDest) && !HasUnfixedParamInInputType(pExpr, pDest)) { CType pSource = _pMethodArguments.types[iArg]; - if (pSource.IsParameterModifierType()) + if (pSource is ParameterModifierType modSource) { - pSource = pSource.AsParameterModifierType().GetParameterType(); + pSource = modSource.GetParameterType(); } OutputTypeInference(pExpr, pSource, pDest); } @@ -673,7 +666,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { case ExpressionKind.MemberGroup: case ExpressionKind.BoundLambda: - TypeArray pDelegateParameters = pDest.AsAggregateType().GetDelegateParameters(GetSymbolLoader()); + TypeArray pDelegateParameters = (pDest as AggregateType).GetDelegateParameters(GetSymbolLoader()); if (pDelegateParameters != null) { return TypeManager.ParametersContainTyVar(pDelegateParameters, pParam); @@ -695,7 +688,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (IsUnfixed(iParam)) { if (DoesInputTypeContain(pSource, pDest, - _pMethodTypeParameters.ItemAsTypeParameterType(iParam))) + _pMethodTypeParameters[iParam] as TypeParameterType)) { return true; } @@ -721,7 +714,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { case ExpressionKind.MemberGroup: case ExpressionKind.BoundLambda: - CType pDelegateReturn = pDest.AsAggregateType().GetDelegateReturnType(GetSymbolLoader()); + CType pDelegateReturn = ((AggregateType)pDest).GetDelegateReturnType(GetSymbolLoader()); if (pDelegateReturn != null) { return TypeManager.TypeContainsType(pDelegateReturn, pParam); @@ -743,7 +736,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (IsUnfixed(iParam)) { if (DoesOutputTypeContain(pSource, pDest, - _pMethodTypeParameters.ItemAsTypeParameterType(iParam))) + _pMethodTypeParameters[iParam] as TypeParameterType)) { return true; } @@ -778,17 +771,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int iArg = 0; iArg < _pMethodArguments.carg; iArg++) { CType pDest = _pMethodFormalParameterTypes[iArg]; - if (pDest.IsParameterModifierType()) + if (pDest is ParameterModifierType modDest) { - pDest = pDest.AsParameterModifierType().GetParameterType(); + pDest = modDest.GetParameterType(); } Expr pExpr = _pMethodArguments.prgexpr[iArg]; if (DoesInputTypeContain(pExpr, pDest, - _pMethodTypeParameters.ItemAsTypeParameterType(jParam)) && + _pMethodTypeParameters[jParam] as TypeParameterType) && DoesOutputTypeContain(pExpr, pDest, - _pMethodTypeParameters.ItemAsTypeParameterType(iParam))) + _pMethodTypeParameters[iParam] as TypeParameterType)) { return true; } @@ -1072,13 +1065,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return false; } - AggregateType pDelegateType = pType.AsAggregateType(); + AggregateType pDelegateType = pType as AggregateType; CType pDelegateReturnType = pDelegateType.GetDelegateReturnType(GetSymbolLoader()); if (pDelegateReturnType == null) { return false; } - if (pDelegateReturnType.IsVoidType()) + if (pDelegateReturnType is VoidType) { return false; } @@ -1104,7 +1097,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MethPropWithInst mwi = argsBinder.GetResultsOfBind().GetBestResult(); CType pMethodReturnType = GetTypeManager().SubstType(mwi.Meth().RetType, mwi.GetType(), mwi.TypeArgs); - if (pMethodReturnType.IsVoidType()) + if (pMethodReturnType is VoidType) { return false; } @@ -1160,9 +1153,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // SPEC: If V is one of the unfixed Xi then U is added to the set of bounds // SPEC: for Xi. - if (pDest.IsTypeParameterType()) + if (pDest is TypeParameterType pTPType) { - TypeParameterType pTPType = pDest.AsTypeParameterType(); if (pTPType.IsMethodTypeParameter() && IsUnfixed(pTPType)) { AddExactBound(pTPType, pSource); @@ -1178,16 +1170,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // SPEC: Otherwise, if U is an array CType UE[...] and V is an array CType VE[...] // SPEC: of the same rank then an exact inference from UE to VE is made. - if (!pSource.IsArrayType() || !pDest.IsArrayType()) + if (!(pSource is ArrayType pArraySource) || !(pDest is ArrayType pArrayDest)) { return false; } - ArrayType pArraySource = pSource.AsArrayType(); - ArrayType pArrayDest = pDest.AsArrayType(); + if (pArraySource.rank != pArrayDest.rank || pArraySource.IsSZArray != pArrayDest.IsSZArray) { return false; } + ExactInference(pArraySource.GetElementType(), pArrayDest.GetElementType()); return true; } @@ -1198,12 +1190,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // SPEC: Otherwise, if U is the CType U1? and V is the CType V1? // SPEC: then an exact inference is made from U to V. - if (!pSource.IsNullableType() || !pDest.IsNullableType()) + if (!(pSource is NullableType nubSource) || !(pDest is NullableType nubDest)) { return false; } - ExactInference(pSource.AsNullableType().GetUnderlyingType(), - pDest.AsNullableType().GetUnderlyingType()); + + ExactInference(nubSource.GetUnderlyingType(), nubDest.GetUnderlyingType()); return true; } @@ -1215,16 +1207,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // SPEC: CType C then an exact inference // SPEC: is made from each Ui to the corresponding Vi. - if (!pSource.IsAggregateType() || !pDest.IsAggregateType()) - { - return false; - } - AggregateType pConstructedSource = pSource.AsAggregateType(); - AggregateType pConstructedDest = pDest.AsAggregateType(); - if (pConstructedSource.GetOwningAggregate() != pConstructedDest.GetOwningAggregate()) + if (!(pSource is AggregateType pConstructedSource) || !(pDest is AggregateType pConstructedDest) + || pConstructedSource.GetOwningAggregate() != pConstructedDest.GetOwningAggregate()) { return false; } + ExactTypeArgumentInference(pConstructedSource, pConstructedDest); return true; } @@ -1330,9 +1318,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // SPEC: If V is one of the unfixed Xi then U is added to the set of bounds // SPEC: for Xi. - if (pDest.IsTypeParameterType()) + if (pDest is TypeParameterType pTPType) { - TypeParameterType pTPType = pDest.AsTypeParameterType(); if (pTPType.IsMethodTypeParameter() && IsUnfixed(pTPType)) { AddLowerBound(pTPType, pSource); @@ -1362,22 +1349,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // public override M(U u) { M(u); } // should infer M // } - if (pSource.IsTypeParameterType()) - { - pSource = pSource.AsTypeParameterType().GetEffectiveBaseClass(); - } - - if (!pSource.IsArrayType()) + if (!(pSource is ArrayType pArraySource)) { return false; } - ArrayType pArraySource = pSource.AsArrayType(); - CType pElementSource = pArraySource.GetElementType(); - CType pElementDest = null; - if (pDest.IsArrayType()) + CType pElementSource = pArraySource.GetElementType(); + CType pElementDest; + + if (pDest is ArrayType pArrayDest) { - ArrayType pArrayDest = pDest.AsArrayType(); if (pArrayDest.rank != pArraySource.rank || pArrayDest.IsSZArray != pArraySource.IsSZArray) { return false; @@ -1394,7 +1375,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return false; } - AggregateType pAggregateDest = pDest.AsAggregateType(); + AggregateType pAggregateDest = (AggregateType)pDest; pElementDest = pAggregateDest.GetTypeArgsThis()[0]; } else @@ -1438,12 +1419,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool LowerBoundConstructedInference(CType pSource, CType pDest) { - if (!pDest.IsAggregateType()) + if (!(pDest is AggregateType pConstructedDest)) { return false; } - AggregateType pConstructedDest = pDest.AsAggregateType(); TypeArray pDestArgs = pConstructedDest.GetTypeArgsAll(); if (pDestArgs.Count == 0) { @@ -1459,16 +1439,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // SPEC: lower bound inference or upper bound inference // SPEC: is made from each Ui to the corresponding Vi. - if (pSource.IsAggregateType() && - pSource.AsAggregateType().GetOwningAggregate() == pConstructedDest.GetOwningAggregate()) + if (pSource is AggregateType aggSource && + aggSource.GetOwningAggregate() == pConstructedDest.GetOwningAggregate()) { - if (pSource.isInterfaceType() || pSource.isDelegateType()) + if (aggSource.isInterfaceType() || aggSource.isDelegateType()) { - LowerBoundTypeArgumentInference(pSource.AsAggregateType(), pConstructedDest); + LowerBoundTypeArgumentInference(aggSource, pConstructedDest); } else { - ExactTypeArgumentInference(pSource.AsAggregateType(), pConstructedDest); + ExactTypeArgumentInference(aggSource, pConstructedDest); } return true; } @@ -1521,11 +1501,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (pSource.isClassType()) { - pSourceBase = pSource.AsAggregateType().GetBaseClass(); - } - else if (pSource.IsTypeParameterType()) - { - pSourceBase = pSource.AsTypeParameterType().GetEffectiveBaseClass(); + pSourceBase = (pSource as AggregateType).GetBaseClass(); } while (pSourceBase != null) @@ -1559,7 +1535,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics //TypeArray pInterfaces = null; if (!pSource.isStructType() && !pSource.isClassType() && - !pSource.isInterfaceType() && !pSource.IsTypeParameterType()) + !pSource.isInterfaceType() && !(pSource is TypeParameterType)) { return false; } @@ -1620,7 +1596,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int arg = 0; arg < pSourceArgs.Count; ++arg) { - TypeParameterType pTypeParam = pTypeParams.ItemAsTypeParameterType(arg); + TypeParameterType pTypeParam = (TypeParameterType)pTypeParams[arg]; CType pSourceArg = pSourceArgs[arg]; CType pDestArg = pDestArgs[arg]; @@ -1691,9 +1667,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // SPEC: If V is one of the unfixed Xi then U is added to the set of upper bounds // SPEC: for Xi. - if (pDest.IsTypeParameterType()) + if (pDest is TypeParameterType pTPType) { - TypeParameterType pTPType = pDest.AsTypeParameterType(); if (pTPType.IsMethodTypeParameter() && IsUnfixed(pTPType)) { AddUpperBound(pTPType, pSource); @@ -1715,17 +1690,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // SPEC: from Ue to Ve is made. // SPEC: otherwise an exact inference from Ue to Ve is made. - if (!pDest.IsArrayType()) + if (!(pDest is ArrayType pArrayDest)) { return false; } - ArrayType pArrayDest = pDest.AsArrayType(); - CType pElementDest = pArrayDest.GetElementType(); - CType pElementSource = null; - if (pSource.IsArrayType()) + CType pElementDest = pArrayDest.GetElementType(); + CType pElementSource; + + if (pSource is ArrayType pArraySource) { - ArrayType pArraySource = pSource.AsArrayType(); if (pArrayDest.rank != pArraySource.rank || pArrayDest.IsSZArray != pArraySource.IsSZArray) { return false; @@ -1742,7 +1716,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return false; } - AggregateType pAggregateSource = pSource.AsAggregateType(); + AggregateType pAggregateSource = (AggregateType)pSource; pElementSource = pAggregateSource.GetTypeArgsThis()[0]; } else @@ -1765,12 +1739,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool UpperBoundConstructedInference(CType pSource, CType pDest) { - if (!pSource.IsAggregateType()) + if (!(pSource is AggregateType pConstructedSource)) { return false; } - AggregateType pConstructedSource = pSource.AsAggregateType(); TypeArray pSourceArgs = pConstructedSource.GetTypeArgsAll(); if (pSourceArgs.Count == 0) { @@ -1782,16 +1755,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // SPEC: lower bound inference or upper bound inference // SPEC: is made from each Ui to the corresponding Vi. - if (pDest.IsAggregateType() && - pConstructedSource.GetOwningAggregate() == pDest.AsAggregateType().GetOwningAggregate()) + if (pDest is AggregateType aggDest && + pConstructedSource.GetOwningAggregate() == aggDest.GetOwningAggregate()) { - if (pDest.isInterfaceType() || pDest.isDelegateType()) + if (aggDest.isInterfaceType() || aggDest.isDelegateType()) { - UpperBoundTypeArgumentInference(pConstructedSource, pDest.AsAggregateType()); + UpperBoundTypeArgumentInference(pConstructedSource, aggDest); } else { - ExactTypeArgumentInference(pConstructedSource, pDest.AsAggregateType()); + ExactTypeArgumentInference(pConstructedSource, aggDest); } return true; } @@ -1830,7 +1803,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // SPEC: inherits directly or indirectly from C then an exact // SPEC: inference is made from each Ui to the corresponding Vi. - AggregateType pDestBase = pDest.AsAggregateType().GetBaseClass(); + AggregateType pDestBase = ((AggregateType)pDest).GetBaseClass(); while (pDestBase != null) { @@ -1885,7 +1858,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return false; } - UpperBoundTypeArgumentInference(pInterface, pDest.AsAggregateType()); + UpperBoundTypeArgumentInference(pInterface, pDest as AggregateType); return true; } @@ -1920,7 +1893,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int arg = 0; arg < pSourceArgs.Count; ++arg) { - TypeParameterType pTypeParam = pTypeParams.ItemAsTypeParameterType(arg); + TypeParameterType pTypeParam = (TypeParameterType)pTypeParams[arg]; CType pSourceArg = pSourceArgs[arg]; CType pDestArg = pDestArgs[arg]; @@ -2134,13 +2107,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { CType pDest = _pMethodFormalParameterTypes[iArg]; CType pSource = _pMethodArguments.types[iArg]; - if (pDest.IsParameterModifierType()) + if (pDest is ParameterModifierType modDest) { - pDest = pDest.AsParameterModifierType().GetParameterType(); + pDest = modDest.GetParameterType(); } - if (pSource.IsParameterModifierType()) + if (pSource is ParameterModifierType modSource) { - pSource = pSource.AsParameterModifierType().GetParameterType(); + pSource = modSource.GetParameterType(); } LowerBoundInference(pSource, pDest); @@ -2187,97 +2160,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return GetSymbolLoader().getBSymmgr(); } - - //////////////////////////////////////////////////////////////////////////////// - // - // In error recovery and reporting scenarios we sometimes end up in a situation - // like this: - // - // x.Foo( y=> - // - // and the question is, "is Foo a valid extension method of x?" If Foo is - // generic, then Foo will be something like: - // - // static Blah Foo(this Bar bar, Func f){ ... } - // - // What we would like to know is: given _only_ the expression x, can we infer - // what T is in Bar ? If we can, then for error recovery and reporting - // we can provisionally consider Foo to be an extension method of x. If we - // cannot deduce this just from x then we should consider Foo to not be an - // extension method of x, at least until we have more information. - // - // Clearly it is pointless to run multiple phases - - public static bool CanObjectOfExtensionBeInferred( - ExpressionBinder binder, - SymbolLoader symbolLoader, - MethodSymbol pMethod, - TypeArray pClassTypeArguments, - TypeArray pMethodFormalParameterTypes, - ArgInfos pMethodArguments) - { - Debug.Assert(pMethod != null); - Debug.Assert(pMethod.typeVars.Count > 0); - Debug.Assert(pMethodFormalParameterTypes != null); - Debug.Assert(pMethod.isParamArray || pMethod.Params == pMethodFormalParameterTypes); - // We need at least one formal parameter type and at least one argument. - if (pMethodFormalParameterTypes.Count < 1 || pMethod.InferenceMustFail()) - { - return false; - } - Debug.Assert(pMethodArguments != null); - Debug.Assert(pMethodArguments.carg <= pMethodFormalParameterTypes.Count); - if (pMethodArguments.carg < 1) - { - return false; - } - var inferrer = new MethodTypeInferrer(binder, symbolLoader, - pMethodFormalParameterTypes, pMethodArguments, pMethod.typeVars, pClassTypeArguments); - return inferrer.CanInferExtensionObject(); - } - - //////////////////////////////////////////////////////////////////////////////// - - private bool CanInferExtensionObject() - { - Debug.Assert(_pMethodFormalParameterTypes != null); - Debug.Assert(_pMethodFormalParameterTypes.Count >= 1); - Debug.Assert(_pMethodArguments != null); - Debug.Assert(_pMethodArguments.carg >= 1); - CType pDest = _pMethodFormalParameterTypes[0]; - CType pSource = _pMethodArguments.types[0]; - if (pDest.IsParameterModifierType()) - { - pDest = pDest.AsParameterModifierType().GetParameterType(); - } - if (pSource.IsParameterModifierType()) - { - // This seems impossible, but this is an error scenario, so - // who knows? We'll err on the side of caution. - pSource = pSource.AsParameterModifierType().GetParameterType(); - } - // Rule out lambdas, nulls, and so on. - if (!IsReallyAType(pSource)) - { - return false; - } - LowerBoundInference(pSource, pDest); - // Now check to see that every CType parameter used by the first - // formal parameter CType was successfully inferred. - for (int iParam = 0; iParam < _pMethodTypeParameters.Count; ++iParam) - { - TypeParameterType pParam = _pMethodTypeParameters.ItemAsTypeParameterType(iParam); - if (!TypeManager.TypeContainsType(pDest, pParam)) - { - continue; - } - Debug.Assert(IsUnfixed(iParam)); - if (!HasBound(iParam) || !Fix(iParam)) - { - return false; - } - } - return true; - } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs index b23fc44509..ce13b77d4b 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs @@ -57,7 +57,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Value public Expr BindValue(Expr exprSrc) { - Debug.Assert(exprSrc != null && exprSrc.Type.IsNullableType()); + Debug.Assert(exprSrc != null && exprSrc.Type is NullableType); // For new T?(x), the answer is x. if (IsNullableConstructor(exprSrc, out ExprCall call)) @@ -67,33 +67,21 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return args; } - CType typeBase = exprSrc.Type.AsNullableType().GetUnderlyingType(); - AggregateType ats = exprSrc.Type.AsNullableType().GetAts(GetErrorContext()); - if (ats == null) - { - ExprProperty rval = GetExprFactory().CreateProperty(typeBase, exprSrc); - rval.SetError(); - return rval; - } - + NullableType nubSrc = (NullableType)exprSrc.Type; + CType typeBase = nubSrc.GetUnderlyingType(); + AggregateType ats = nubSrc.GetAts(); PropertySymbol prop = GetSymbolLoader().getBSymmgr().propNubValue; if (prop == null) { prop = GetSymbolLoader().getPredefinedMembers().GetProperty(PREDEFPROP.PP_G_OPTIONAL_VALUE); + Debug.Assert(prop != null); GetSymbolLoader().getBSymmgr().propNubValue = prop; } PropWithType pwt = new PropWithType(prop, ats); MethPropWithInst mpwi = new MethPropWithInst(prop, ats); ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(exprSrc, mpwi); - ExprProperty exprRes = GetExprFactory().CreateProperty(typeBase, null, null, pMemGroup, pwt, null); - - if (prop == null) - { - exprRes.SetError(); - } - - return exprRes; + return GetExprFactory().CreateProperty(typeBase, null, null, pMemGroup, pwt, null); } public ExprCall BindNew(Expr pExprSrc) @@ -102,33 +90,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics NullableType pNubSourceType = GetSymbolLoader().GetTypeManager().GetNullable(pExprSrc.Type); - AggregateType pSourceType = pNubSourceType.GetAts(GetErrorContext()); - if (pSourceType == null) - { - MethWithInst mwi = new MethWithInst(null, null); - ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(pExprSrc, mwi); - ExprCall rval = GetExprFactory().CreateCall(0, pNubSourceType, null, pMemGroup, null); - rval.SetError(); - return rval; - } - + AggregateType pSourceType = pNubSourceType.GetAts(); MethodSymbol meth = GetSymbolLoader().getBSymmgr().methNubCtor; if (meth == null) { meth = GetSymbolLoader().getPredefinedMembers().GetMethod(PREDEFMETH.PM_G_OPTIONAL_CTOR); + Debug.Assert(meth != null); GetSymbolLoader().getBSymmgr().methNubCtor = meth; } MethWithInst methwithinst = new MethWithInst(meth, pSourceType, BSYMMGR.EmptyTypeArray()); ExprMemberGroup memgroup = GetExprFactory().CreateMemGroup(null, methwithinst); - ExprCall pExprRes = GetExprFactory().CreateCall(EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CANTBENULL, pNubSourceType, pExprSrc, memgroup, methwithinst); - - if (meth == null) - { - pExprRes.SetError(); - } - - return pExprRes; + return GetExprFactory().CreateCall(EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CANTBENULL, pNubSourceType, pExprSrc, memgroup, methwithinst); } public CNullable(SymbolLoader symbolLoader, ErrorHandling errorContext, ExprFactory exprFactory) { diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Operators.cs.REMOVED.git-id b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Operators.cs.REMOVED.git-id index 5e0edcaad7..0924504142 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Operators.cs.REMOVED.git-id +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Operators.cs.REMOVED.git-id @@ -1 +1 @@ -3ac4656d4270c60674194214054301996e9f3afb \ No newline at end of file +22e7de10f76f8d31b06b08fd259925a68fd6e9b4 \ No newline at end of file diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs index 5645c62784..510b88a34f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs @@ -17,23 +17,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Keep this list sorted by containing type and name. internal enum PREDEFMETH { - PM_FIRST = 0, - PM_DECIMAL_OPDECREMENT, - PM_DECIMAL_OPDIVISION, - PM_DECIMAL_OPEQUALITY, - PM_DECIMAL_OPGREATERTHAN, - PM_DECIMAL_OPGREATERTHANOREQUAL, PM_DECIMAL_OPINCREMENT, - PM_DECIMAL_OPINEQUALITY, - PM_DECIMAL_OPLESSTHAN, - PM_DECIMAL_OPLESSTHANOREQUAL, - PM_DECIMAL_OPMINUS, - PM_DECIMAL_OPMODULUS, - PM_DECIMAL_OPMULTIPLY, - PM_DECIMAL_OPPLUS, PM_DECIMAL_OPUNARYMINUS, - PM_DECIMAL_OPUNARYPLUS, PM_DELEGATE_COMBINE, PM_DELEGATE_OPEQUALITY, @@ -52,8 +38,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics PM_EXPRESSION_ARRAYINDEX2, PM_EXPRESSION_ASSIGN, - PM_EXPRESSION_CONDITION, - PM_EXPRESSION_CONSTANT_OBJECT_TYPE, PM_EXPRESSION_CONVERT, PM_EXPRESSION_CONVERT_USER_DEFINED, @@ -105,11 +89,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics PM_EXPRESSION_NEGATECHECKED_USER_DEFINED, PM_EXPRESSION_CALL, PM_EXPRESSION_NEW, - PM_EXPRESSION_NEW_MEMBERS, PM_EXPRESSION_NEW_TYPE, PM_EXPRESSION_QUOTE, - PM_EXPRESSION_ARRAYLENGTH, - PM_EXPRESSION_NOT, PM_EXPRESSION_NOT_USER_DEFINED, @@ -120,24 +101,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics PM_EXPRESSION_INVOKE, - PM_METHODINFO_CREATEDELEGATE_TYPE_OBJECT, PM_G_OPTIONAL_CTOR, - PM_G_OPTIONAL_GETHASVALUE, PM_G_OPTIONAL_GETVALUE, - PM_G_OPTIONAL_GET_VALUE_OR_DEF, - PM_STRING_CONCAT_OBJECT_1, // NOTE: these 3 must be sequential. See RealizeConcats PM_STRING_CONCAT_OBJECT_2, PM_STRING_CONCAT_OBJECT_3, - PM_STRING_CONCAT_STRING_1, // NOTE: these 4 must be sequential. See RealizeConcats PM_STRING_CONCAT_STRING_2, - PM_STRING_CONCAT_STRING_3, - PM_STRING_CONCAT_STRING_4, - PM_STRING_CONCAT_SZ_OBJECT, - PM_STRING_CONCAT_SZ_STRING, - PM_STRING_GETCHARS, - PM_STRING_GETLENGTH, PM_STRING_OPEQUALITY, PM_STRING_OPINEQUALITY, @@ -149,7 +119,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Keep this list sorted by containing type and name. internal enum PREDEFPROP { - PP_FIRST = 0, PP_G_OPTIONAL_VALUE, PP_COUNT, }; @@ -216,14 +185,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public PREDEFPROP property; public PredefinedName name; public PREDEFMETH getter; - public PREDEFMETH setter; - public PredefinedPropertyInfo(PREDEFPROP property, PredefinedName name, PREDEFMETH getter, PREDEFMETH setter) + public PredefinedPropertyInfo(PREDEFPROP property, PredefinedName name, PREDEFMETH getter) { this.property = property; this.name = name; this.getter = getter; - this.setter = setter; } }; @@ -246,64 +213,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GetOptPredefAgg(GetMethPredefType(method)); } - // delegate specific helpers - private MethodSymbol FindDelegateConstructor(AggregateSymbol delegateType, int[] signature) - { - Debug.Assert(delegateType != null && delegateType.IsDelegate()); - Debug.Assert(signature != null); - - return LoadMethod( - delegateType, - signature, - 0, // meth ty vars - GetPredefName(PredefinedName.PN_CTOR), - ACCESS.ACC_PUBLIC, - false, // MethodCallingConventionEnum.Static - false); // MethodCallingConventionEnum.Virtual - } - - private MethodSymbol FindDelegateConstructor(AggregateSymbol delegateType) - { - Debug.Assert(delegateType != null && delegateType.IsDelegate()); - - MethodSymbol ctor = FindDelegateConstructor(delegateType, s_DelegateCtorSignature1); - if (ctor == null) - { - ctor = FindDelegateConstructor(delegateType, s_DelegateCtorSignature2); - } - - return ctor; - } - - public MethodSymbol FindDelegateConstructor(AggregateSymbol delegateType, bool fReportErrors) - { - MethodSymbol ctor = FindDelegateConstructor(delegateType); - if (ctor == null && fReportErrors) - { - GetErrorContext().Error(ErrorCode.ERR_BadDelegateConstructor, delegateType); - } - - return ctor; - } - - // property specific helpers - private PropertySymbol EnsureProperty(PREDEFPROP property) - { - Debug.Assert((int)property > (int)PREDEFMETH.PM_FIRST && (int)property < (int)PREDEFMETH.PM_COUNT); - - if (_properties[(int)property] == null) - { - _properties[(int)property] = LoadProperty(property); - } - return _properties[(int)property]; - } private PropertySymbol LoadProperty(PREDEFPROP property) { return LoadProperty( property, GetPropName(property), - GetPropGetter(property), - GetPropSetter(property)); + GetPropGetter(property)); } private Name GetPropName(PREDEFPROP property) @@ -313,57 +228,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private PropertySymbol LoadProperty( PREDEFPROP predefProp, Name propertyName, - PREDEFMETH propertyGetter, - PREDEFMETH propertySetter) + PREDEFMETH propertyGetter) { Debug.Assert(propertyName != null); - Debug.Assert(propertyGetter > PREDEFMETH.PM_FIRST && propertyGetter < PREDEFMETH.PM_COUNT); - Debug.Assert(propertySetter > PREDEFMETH.PM_FIRST && propertySetter <= PREDEFMETH.PM_COUNT); + Debug.Assert(propertyGetter >= 0 && propertyGetter < PREDEFMETH.PM_COUNT); - MethodSymbol getter = GetOptionalMethod(propertyGetter); - MethodSymbol setter = null; - if (propertySetter != PREDEFMETH.PM_COUNT) - { - setter = GetOptionalMethod(propertySetter); - } - - if (getter == null && setter == null) - { - RuntimeBinderSymbolTable.AddPredefinedPropertyToSymbolTable(GetOptPredefAgg(GetPropPredefType(predefProp)), propertyName); - getter = GetOptionalMethod(propertyGetter); - if (propertySetter != PREDEFMETH.PM_COUNT) - { - setter = GetOptionalMethod(propertySetter); - } - } - - setter?.SetMethKind(MethodKindEnum.PropAccessor); - - PropertySymbol property = null; - if (getter != null) - { - getter.SetMethKind(MethodKindEnum.PropAccessor); - property = getter.getProperty(); - - // Didn't find it, so load it. - if (property == null) - { - RuntimeBinderSymbolTable.AddPredefinedPropertyToSymbolTable(GetOptPredefAgg(GetPropPredefType(predefProp)), propertyName); - } - property = getter.getProperty(); - Debug.Assert(property != null); - - if (property.name != propertyName || - (propertySetter != PREDEFMETH.PM_COUNT && - (setter == null || - !setter.isPropertyAccessor() || - setter.getProperty() != property)) || - property.getBogus()) - { - property = null; - } - } + RuntimeBinderSymbolTable.AddPredefinedPropertyToSymbolTable( + GetOptPredefAgg(GetPropPredefType(predefProp)), propertyName); + MethodSymbol getter = GetMethod(propertyGetter); + getter.SetMethKind(MethodKindEnum.PropAccessor); + PropertySymbol property = getter.getProperty(); + Debug.Assert(property != null); return property; } @@ -392,7 +268,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } private AggregateSymbol GetOptPredefAgg(PredefinedType pt) { - return GetSymbolLoader().GetOptPredefAgg(pt); + return GetSymbolLoader().GetPredefAgg(pt); } private CType LoadTypeFromSignature(int[] signature, ref int indexIntoSignatures, TypeArray classTyVars) @@ -505,52 +381,27 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics #if DEBUG // validate the tables - for (int i = (int)PREDEFMETH.PM_FIRST + 1; i < (int)PREDEFMETH.PM_COUNT; i++) + for (int i = 0; i < (int)PREDEFMETH.PM_COUNT; i++) { Debug.Assert((int)GetMethInfo((PREDEFMETH)i).method == i); } - for (int i = (int)PREDEFPROP.PP_FIRST + 1; i < (int)PREDEFPROP.PP_COUNT; i++) + for (int i = 0; i < (int)PREDEFPROP.PP_COUNT; i++) { Debug.Assert((int)GetPropInfo((PREDEFPROP)i).property == i); } #endif } - public PropertySymbol GetProperty(PREDEFPROP property) // Reports an error if the property is not found. + public PropertySymbol GetProperty(PREDEFPROP property) { - PropertySymbol result = EnsureProperty(property); - if (result == null) - { - ReportError(property); - } - - return result; + Debug.Assert(property >= 0 && property < PREDEFPROP.PP_COUNT); + return _properties[(int)property] ?? (_properties[(int)property] = LoadProperty(property)); } public MethodSymbol GetMethod(PREDEFMETH method) { - MethodSymbol result = EnsureMethod(method); - if (result == null) - { - ReportError(method); - } - - return result; - } - - private MethodSymbol GetOptionalMethod(PREDEFMETH method) - { - return EnsureMethod(method); - } - - private MethodSymbol EnsureMethod(PREDEFMETH method) - { - Debug.Assert(method > PREDEFMETH.PM_FIRST && method < PREDEFMETH.PM_COUNT); - if (_methods[(int)method] == null) - { - _methods[(int)method] = LoadMethod(method); - } - return _methods[(int)method]; + Debug.Assert(method >= 0 && method < PREDEFMETH.PM_COUNT); + return _methods[(int)method] ?? (_methods[(int)method] = LoadMethod(method)); } private MethodSymbol LoadMethod( @@ -566,24 +417,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(signature != null); Debug.Assert(cMethodTyVars >= 0); Debug.Assert(methodName != null); - - if (type == null) - { - return null; - } + Debug.Assert(type != null); TypeArray classTyVars = type.GetTypeVarsAll(); int index = 0; CType returnType = LoadTypeFromSignature(signature, ref index, classTyVars); - if (returnType == null) - { - return null; - } + Debug.Assert(returnType != null); + TypeArray argumentTypes = LoadTypeArrayFromSignature(signature, ref index, classTyVars); - if (argumentTypes == null) - { - return null; - } + Debug.Assert(argumentTypes != null); + TypeArray standardMethodTyVars = GetTypeManager().GetStdMethTyVarArray(cMethodTyVars); MethodSymbol ret = LookupMethodWhileLoading(type, cMethodTyVars, methodName, methodAccess, isStatic, isVirtual, returnType, argumentTypes); @@ -602,17 +445,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics sym != null; sym = GetSymbolLoader().LookupNextSym(sym, type, symbmask_t.MASK_ALL)) { - if (sym.IsMethodSymbol()) + if (sym is MethodSymbol methsym) { - MethodSymbol methsym = sym.AsMethodSymbol(); if ((methsym.GetAccess() == methodAccess || methodAccess == ACCESS.ACC_UNKNOWN) && methsym.isStatic == isStatic && methsym.isVirtual == isVirtual && methsym.typeVars.Count == cMethodTyVars && GetTypeManager().SubstEqualTypes(methsym.RetType, returnType, null, methsym.typeVars, SubstTypeFlags.DenormMeth) && GetTypeManager().SubstEqualTypeArrays(methsym.Params, argumentTypes, (TypeArray)null, - methsym.typeVars, SubstTypeFlags.DenormMeth) && - !methsym.getBogus()) + methsym.typeVars, SubstTypeFlags.DenormMeth)) { return methsym; } @@ -633,19 +474,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics IsMethVirtual(method)); } - private void ReportError(PREDEFMETH method) - { - ReportError(GetMethPredefType(method), GetMethPredefName(method)); - } - - private void ReportError(PredefinedType type, PredefinedName name) - { - GetErrorContext().Error(ErrorCode.ERR_MissingPredefinedMember, PredefinedTypes.GetFullName(type), GetPredefName(name)); - } - - private static readonly int[] s_DelegateCtorSignature1 = { (int)PredefinedType.PT_VOID, 2, (int)PredefinedType.PT_OBJECT, (int)PredefinedType.PT_INTPTR }; - private static readonly int[] s_DelegateCtorSignature2 = { (int)PredefinedType.PT_VOID, 2, (int)PredefinedType.PT_OBJECT, (int)PredefinedType.PT_UINTPTR }; - private static PredefinedName GetPropPredefName(PREDEFPROP property) { return GetPropInfo(property).name; @@ -656,7 +484,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics PREDEFMETH result = GetPropInfo(property).getter; // getters are MethodRequiredEnum.Required - Debug.Assert(result > PREDEFMETH.PM_FIRST && result < PREDEFMETH.PM_COUNT); + Debug.Assert(result >= 0 && result < PREDEFMETH.PM_COUNT); return result; } @@ -666,31 +494,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GetMethInfo(GetPropGetter(property)).type; } - private static PREDEFMETH GetPropSetter(PREDEFPROP property) - { - PREDEFMETH result = GetPropInfo(property).setter; - - // setters are not MethodRequiredEnum.Required - Debug.Assert(result > PREDEFMETH.PM_FIRST && result <= PREDEFMETH.PM_COUNT); - - return GetPropInfo(property).setter; - } - - private void ReportError(PREDEFPROP property) - { - ReportError(GetPropPredefType(property), GetPropPredefName(property)); - } - // the list of predefined property definitions. // This list must be in the same order as the PREDEFPROP enum. private static readonly PredefinedPropertyInfo[] s_predefinedProperties = { - new PredefinedPropertyInfo(PREDEFPROP.PP_FIRST, PredefinedName.PN_COUNT, PREDEFMETH.PM_COUNT, PREDEFMETH.PM_COUNT), - new PredefinedPropertyInfo(PREDEFPROP.PP_G_OPTIONAL_VALUE, PredefinedName.PN_CAP_VALUE, PREDEFMETH.PM_G_OPTIONAL_GETVALUE, PREDEFMETH.PM_COUNT) + new PredefinedPropertyInfo(PREDEFPROP.PP_G_OPTIONAL_VALUE, PredefinedName.PN_CAP_VALUE, PREDEFMETH.PM_G_OPTIONAL_GETVALUE) }; private static PredefinedPropertyInfo GetPropInfo(PREDEFPROP property) { - Debug.Assert(property > PREDEFPROP.PP_FIRST && property < PREDEFPROP.PP_COUNT); + Debug.Assert(property >= 0 && property < PREDEFPROP.PP_COUNT); Debug.Assert(s_predefinedProperties[(int)property].property == property); return s_predefinedProperties[(int)property]; @@ -698,7 +510,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private static PredefinedMethodInfo GetMethInfo(PREDEFMETH method) { - Debug.Assert(method > PREDEFMETH.PM_FIRST && method < PREDEFMETH.PM_COUNT); + Debug.Assert(method >= 0 && method < PREDEFMETH.PM_COUNT); Debug.Assert(s_predefinedMethods[(int)method].method == method); return s_predefinedMethods[(int)method]; @@ -742,22 +554,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // the list of predefined method definitions. // This list must be in the same order as the PREDEFMETH enum. private static readonly PredefinedMethodInfo[] s_predefinedMethods = new PredefinedMethodInfo[(int)PREDEFMETH.PM_COUNT] { - new PredefinedMethodInfo( PREDEFMETH.PM_FIRST, PredefinedType.PT_COUNT, PredefinedName.PN_COUNT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_VOID, 0 }), new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPDECREMENT, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPDECREMENT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 1, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPDIVISION, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPDIVISION, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPEQUALITY, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPEQUALITY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPGREATERTHAN, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPGREATERTHAN, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPGREATERTHANOREQUAL, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPGREATERTHANOREQUAL, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPINCREMENT, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPINCREMENT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 1, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPINEQUALITY, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPINEQUALITY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPLESSTHAN, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPLESSTHAN, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPLESSTHANOREQUAL, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPLESSTHANOREQUAL, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPMINUS, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPMINUS, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPMODULUS, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPMODULUS, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPMULTIPLY, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPMULTIPLY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPPLUS, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPPLUS, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 2, (int)PredefinedType.PT_DECIMAL, (int)PredefinedType.PT_DECIMAL }), new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPUNARYMINUS, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPUNARYMINUS, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 1, (int)PredefinedType.PT_DECIMAL }), - new PredefinedMethodInfo( PREDEFMETH.PM_DECIMAL_OPUNARYPLUS, PredefinedType.PT_DECIMAL, PredefinedName.PN_OPUNARYPLUS, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DECIMAL, 1, (int)PredefinedType.PT_DECIMAL }), new PredefinedMethodInfo( PREDEFMETH.PM_DELEGATE_COMBINE, PredefinedType.PT_DELEGATE, PredefinedName.PN_COMBINE, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DELEGATE, 2, (int)PredefinedType.PT_DELEGATE, (int)PredefinedType.PT_DELEGATE }), new PredefinedMethodInfo( PREDEFMETH.PM_DELEGATE_OPEQUALITY, PredefinedType.PT_DELEGATE, PredefinedName.PN_OPEQUALITY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DELEGATE, (int)PredefinedType.PT_DELEGATE }), new PredefinedMethodInfo( PREDEFMETH.PM_DELEGATE_OPINEQUALITY, PredefinedType.PT_DELEGATE, PredefinedName.PN_OPINEQUALITY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_DELEGATE, (int)PredefinedType.PT_DELEGATE }), @@ -773,7 +572,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_ARRAYINDEX, PredefinedType.PT_EXPRESSION, PredefinedName.PN_ARRAYINDEX, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BINARYEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_ARRAYINDEX2, PredefinedType.PT_EXPRESSION, PredefinedName.PN_ARRAYINDEX, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_METHODCALLEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_ASSIGN, PredefinedType.PT_EXPRESSION, PredefinedName.PN_ASSIGN, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BINARYEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_EXPRESSION }), - new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_CONDITION, PredefinedType.PT_EXPRESSION, PredefinedName.PN_CONDITION, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_CONDITIONALEXPRESSION, 3, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_CONSTANT_OBJECT_TYPE, PredefinedType.PT_EXPRESSION, PredefinedName.PN_CONSTANT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_CONSTANTEXPRESSION, 2, (int)PredefinedType.PT_OBJECT, (int)PredefinedType.PT_TYPE }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_CONVERT, PredefinedType.PT_EXPRESSION, PredefinedName.PN_CONVERT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_TYPE }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_CONVERT_USER_DEFINED, PredefinedType.PT_EXPRESSION, PredefinedName.PN_CONVERT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 3, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_TYPE, (int)PredefinedType.PT_METHODINFO }), @@ -823,31 +621,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NEGATECHECKED_USER_DEFINED, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NEGATECHECKED, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_METHODINFO }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_CALL, PredefinedType.PT_EXPRESSION, PredefinedName.PN_CALL, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_METHODCALLEXPRESSION, 3, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_METHODINFO, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NEW, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NEW, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_NEWEXPRESSION, 2, (int)PredefinedType.PT_CONSTRUCTORINFO, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_EXPRESSION }), - new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NEW_MEMBERS, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NEW, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_NEWEXPRESSION, 3, (int)PredefinedType.PT_CONSTRUCTORINFO, (int)PredefinedType.PT_G_IENUMERABLE, (int)PredefinedType.PT_EXPRESSION, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_MEMBERINFO }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NEW_TYPE, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NEW, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_NEWEXPRESSION, 1, (int)PredefinedType.PT_TYPE }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_QUOTE, PredefinedType.PT_EXPRESSION, PredefinedName.PN_QUOTE, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 1, (int)PredefinedType.PT_EXPRESSION }), - new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_ARRAYLENGTH, PredefinedType.PT_EXPRESSION, PredefinedName.PN_ARRAYLENGTH, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 1, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NOT, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NOT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 1, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NOT_USER_DEFINED, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NOT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_UNARYEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_METHODINFO }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_NEWARRAYINIT, PredefinedType.PT_EXPRESSION, PredefinedName.PN_NEWARRAYINIT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_NEWARRAYEXPRESSION, 2, (int)PredefinedType.PT_TYPE, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_EXPRESSION }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_PROPERTY, PredefinedType.PT_EXPRESSION, PredefinedName.PN_EXPRESSION_PROPERTY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_MEMBEREXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)PredefinedType.PT_PROPERTYINFO }), new PredefinedMethodInfo( PREDEFMETH.PM_EXPRESSION_INVOKE, PredefinedType.PT_EXPRESSION, PredefinedName.PN_INVOKE, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_INVOCATIONEXPRESSION, 2, (int)PredefinedType.PT_EXPRESSION, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_EXPRESSION }), - new PredefinedMethodInfo( PREDEFMETH.PM_METHODINFO_CREATEDELEGATE_TYPE_OBJECT, PredefinedType.PT_METHODINFO, PredefinedName.PN_CREATEDELEGATE, MethodCallingConventionEnum.Virtual, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_DELEGATE, 2, (int)PredefinedType.PT_TYPE, (int)PredefinedType.PT_OBJECT}), new PredefinedMethodInfo( PREDEFMETH.PM_G_OPTIONAL_CTOR, PredefinedType.PT_G_OPTIONAL, PredefinedName.PN_CTOR, MethodCallingConventionEnum.Instance, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_VOID, 1, (int)MethodSignatureEnum.SIG_CLASS_TYVAR, 0 }), - new PredefinedMethodInfo( PREDEFMETH.PM_G_OPTIONAL_GETHASVALUE, PredefinedType.PT_G_OPTIONAL, PredefinedName.PN_GETHASVALUE, MethodCallingConventionEnum.Instance, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 0 }), new PredefinedMethodInfo( PREDEFMETH.PM_G_OPTIONAL_GETVALUE, PredefinedType.PT_G_OPTIONAL, PredefinedName.PN_GETVALUE, MethodCallingConventionEnum.Instance, ACCESS.ACC_PUBLIC, 0, new int[] { (int)MethodSignatureEnum.SIG_CLASS_TYVAR, 0, 0 }), - new PredefinedMethodInfo( PREDEFMETH.PM_G_OPTIONAL_GET_VALUE_OR_DEF, PredefinedType.PT_G_OPTIONAL, PredefinedName.PN_GET_VALUE_OR_DEF, MethodCallingConventionEnum.Instance, ACCESS.ACC_PUBLIC, 0, new int[] { (int)MethodSignatureEnum.SIG_CLASS_TYVAR, 0, 0 }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_OBJECT_1, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 1, (int)PredefinedType.PT_OBJECT }), new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_OBJECT_2, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 2, (int)PredefinedType.PT_OBJECT, (int)PredefinedType.PT_OBJECT }), new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_OBJECT_3, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 3, (int)PredefinedType.PT_OBJECT, (int)PredefinedType.PT_OBJECT, (int)PredefinedType.PT_OBJECT }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_STRING_1, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 1, (int)PredefinedType.PT_STRING }), new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_STRING_2, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 2, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_STRING_3, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 3, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_STRING_4, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 4, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_SZ_OBJECT, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 1, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_OBJECT }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_CONCAT_SZ_STRING, PredefinedType.PT_STRING, PredefinedName.PN_CONCAT, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_STRING, 1, (int)MethodSignatureEnum.SIG_SZ_ARRAY, (int)PredefinedType.PT_STRING }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_GETCHARS, PredefinedType.PT_STRING, PredefinedName.PN_GETCHARS, MethodCallingConventionEnum.Instance, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_CHAR, 1, (int)PredefinedType.PT_INT }), - new PredefinedMethodInfo( PREDEFMETH.PM_STRING_GETLENGTH, PredefinedType.PT_STRING, PredefinedName.PN_GETLENGTH, MethodCallingConventionEnum.Instance, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_INT, 0, }), new PredefinedMethodInfo( PREDEFMETH.PM_STRING_OPEQUALITY, PredefinedType.PT_STRING, PredefinedName.PN_OPEQUALITY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING }), new PredefinedMethodInfo( PREDEFMETH.PM_STRING_OPINEQUALITY, PredefinedType.PT_STRING, PredefinedName.PN_OPINEQUALITY, MethodCallingConventionEnum.Static, ACCESS.ACC_PUBLIC, 0, new int[] { (int)PredefinedType.PT_BOOL, 2, (int)PredefinedType.PT_STRING, (int)PredefinedType.PT_STRING }), }; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/SemanticChecker.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/SemanticChecker.cs index 0c4dadc94d..5b8c6fce65 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/SemanticChecker.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/SemanticChecker.cs @@ -19,34 +19,32 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // Semantic check methods on SymbolLoader // - internal abstract class CSemanticChecker + internal sealed class CSemanticChecker { // Generate an error if CType is static. - public bool CheckForStaticClass(Symbol symCtx, CType CType, ErrorCode err) + public void CheckForStaticClass(Symbol symCtx, CType CType, ErrorCode err) { - if (!CType.isStaticClass()) - return false; - ReportStaticClassError(symCtx, CType, err); - return true; + if (CType.isStaticClass()) + { + throw ReportStaticClassError(symCtx, CType, err); + } } - public virtual ACCESSERROR CheckAccess2(Symbol symCheck, AggregateType atsCheck, Symbol symWhere, CType typeThru) + public ACCESSERROR CheckAccess2(Symbol symCheck, AggregateType atsCheck, Symbol symWhere, CType typeThru) { Debug.Assert(symCheck != null); Debug.Assert(atsCheck == null || symCheck.parent == atsCheck.getAggregate()); Debug.Assert(typeThru == null || - typeThru.IsAggregateType() || - typeThru.IsTypeParameterType() || - typeThru.IsArrayType() || - typeThru.IsNullableType() || - typeThru.IsErrorType()); + typeThru is AggregateType || + typeThru is TypeParameterType || + typeThru is ArrayType || + typeThru is NullableType || + typeThru is ErrorType); #if DEBUG switch (symCheck.getKind()) { - default: - break; case SYMKIND.SK_MethodSymbol: case SYMKIND.SK_PropertySymbol: case SYMKIND.SK_FieldSymbol: @@ -81,28 +79,30 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return CheckTypeAccess(CType, symWhere) ? ACCESSERROR.ACCESSERROR_NOERROR : ACCESSERROR.ACCESSERROR_NOACCESS; } - public virtual bool CheckTypeAccess(CType type, Symbol symWhere) + public bool CheckTypeAccess(CType type, Symbol symWhere) { Debug.Assert(type != null); // Array, Ptr, Nub, etc don't matter. type = type.GetNakedType(true); - if (!type.IsAggregateType()) + if (!(type is AggregateType ats)) { - Debug.Assert(type.IsVoidType() || type.IsErrorType() || type.IsTypeParameterType()); + Debug.Assert(type is VoidType || type is ErrorType || type is TypeParameterType); return true; } - for (AggregateType ats = type.AsAggregateType(); ats != null; ats = ats.outerType) + do { if (ACCESSERROR.ACCESSERROR_NOERROR != CheckAccessCore(ats.GetOwningAggregate(), ats.outerType, symWhere, null)) { return false; } - } - TypeArray typeArgs = type.AsAggregateType().GetTypeArgsAll(); + ats = ats.outerType; + } while(ats != null); + + TypeArray typeArgs = ((AggregateType)type).GetTypeArgsAll(); for (int i = 0; i < typeArgs.Count; i++) { if (!CheckTypeAccess(typeArgs[i], symWhere)) @@ -113,39 +113,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // Generates an error for static classes - public void ReportStaticClassError(Symbol symCtx, CType CType, ErrorCode err) - { - if (symCtx != null) - ErrorContext.Error(err, CType, new ErrArgRef(symCtx)); - else - ErrorContext.Error(err, CType); - } + public RuntimeBinderException ReportStaticClassError(Symbol symCtx, CType CType, ErrorCode err) => + ErrorContext.Error(err, symCtx != null ? new []{CType, new ErrArg(symCtx)} : new ErrArg[]{CType}); - public abstract SymbolLoader SymbolLoader { get; } - public abstract SymbolLoader GetSymbolLoader(); + public SymbolLoader SymbolLoader { get; } = new SymbolLoader(); ///////////////////////////////////////////////////////////////////////////////// // SymbolLoader forwarders (begin) // - private ErrorHandling ErrorContext - { - get - { - return SymbolLoader.ErrorContext; - } - } + public ErrorHandling ErrorContext => SymbolLoader.ErrorContext; - public ErrorHandling GetErrorContext() { return ErrorContext; } public NameManager GetNameManager() { return SymbolLoader.GetNameManager(); } public TypeManager GetTypeManager() { return SymbolLoader.GetTypeManager(); } public BSYMMGR getBSymmgr() { return SymbolLoader.getBSymmgr(); } public SymFactory GetGlobalSymbolFactory() { return SymbolLoader.GetGlobalSymbolFactory(); } - public MiscSymFactory GetGlobalMiscSymFactory() { return SymbolLoader.GetGlobalMiscSymFactory(); } //protected CompilerPhase GetCompPhase() { return SymbolLoader.CompPhase(); } //protected void SetCompPhase(CompilerPhase compPhase) { SymbolLoader.compPhase = compPhase; } - public PredefinedTypes getPredefTypes() { return SymbolLoader.getPredefTypes(); } + public PredefinedTypes getPredefTypes() { return SymbolLoader.GetPredefindTypes(); } // // SymbolLoader forwarders (end) ///////////////////////////////////////////////////////////////////////////////// @@ -158,11 +144,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(symCheck != null); Debug.Assert(atsCheck == null || symCheck.parent == atsCheck.getAggregate()); Debug.Assert(typeThru == null || - typeThru.IsAggregateType() || - typeThru.IsTypeParameterType() || - typeThru.IsArrayType() || - typeThru.IsNullableType() || - typeThru.IsErrorType()); + typeThru is AggregateType || + typeThru is TypeParameterType || + typeThru is ArrayType || + typeThru is NullableType || + typeThru is ErrorType); switch (symCheck.GetAccess()) { @@ -202,24 +188,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics break; } - // Should always have atsCheck for private and protected access check. - // We currently don't need it since access doesn't respect instantiation. - // We just use symWhere.parent.AsAggregateSymbol() instead. - AggregateSymbol aggCheck = symCheck.parent.AsAggregateSymbol(); - // Find the inner-most enclosing AggregateSymbol. AggregateSymbol aggWhere = null; for (Symbol symT = symWhere; symT != null; symT = symT.parent) { - if (symT.IsAggregateSymbol()) + if (symT is AggregateSymbol aggSym) { - aggWhere = symT.AsAggregateSymbol(); + aggWhere = aggSym; break; } - if (symT.IsAggregateDeclaration()) + if (symT is AggregateDeclaration aggDec) { - aggWhere = symT.AsAggregateDeclaration().Agg(); + aggWhere = aggDec.Agg(); break; } } @@ -229,6 +210,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return ACCESSERROR.ACCESSERROR_NOACCESS; } + // Should always have atsCheck for private and protected access check. + // We currently don't need it since access doesn't respect instantiation. + // We just use symWhere.parent as AggregateSymbol instead. + AggregateSymbol aggCheck = symCheck.parent as AggregateSymbol; + // First check for private access. for (AggregateSymbol agg = aggWhere; agg != null; agg = agg.GetOuterAgg()) { @@ -286,63 +272,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return (atsThru == null) ? ACCESSERROR.ACCESSERROR_NOACCESS : ACCESSERROR.ACCESSERROR_NOACCESSTHRU; } - public bool CheckBogus(Symbol sym) + public static bool CheckBogus(Symbol sym) { - if (sym == null) - { - return false; - } - - if (!sym.hasBogus()) - { - bool fBogus = sym.computeCurrentBogusState(); - - if (fBogus) - { - // Only set this if everything is declared or - // at least 1 declared thing is bogus - sym.setBogus(fBogus); - } - } - - return sym.hasBogus() && sym.checkBogus(); + return (sym as PropertySymbol)?.Bogus ?? false; } - public bool CheckBogus(CType pType) - { - if (pType == null) - { - return false; - } - - if (!pType.hasBogus()) - { - bool fBogus = pType.computeCurrentBogusState(); - - if (fBogus) - { - // Only set this if everything is declared or - // at least 1 declared thing is bogus - pType.setBogus(fBogus); - } - } - - return pType.hasBogus() && pType.checkBogus(); - } - - public void ReportAccessError(SymWithType swtBad, Symbol symWhere, CType typeQual) + public RuntimeBinderException ReportAccessError(SymWithType swtBad, Symbol symWhere, CType typeQual) { Debug.Assert(!CheckAccess(swtBad.Sym, swtBad.GetType(), symWhere, typeQual) || !CheckTypeAccess(swtBad.GetType(), symWhere)); - if (CheckAccess2(swtBad.Sym, swtBad.GetType(), symWhere, typeQual) == ACCESSERROR.ACCESSERROR_NOACCESSTHRU) - { - ErrorContext.Error(ErrorCode.ERR_BadProtectedAccess, swtBad, typeQual, symWhere); - } - else - { - ErrorContext.ErrorRef(ErrorCode.ERR_BadAccess, swtBad); - } + return CheckAccess2(swtBad.Sym, swtBad.GetType(), symWhere, typeQual) + == ACCESSERROR.ACCESSERROR_NOACCESSTHRU + ? ErrorContext.Error(ErrorCode.ERR_BadProtectedAccess, swtBad, typeQual, symWhere) + : ErrorContext.Error(ErrorCode.ERR_BadAccess, swtBad); } public bool CheckAccess(Symbol symCheck, AggregateType atsCheck, Symbol symWhere, CType typeThru) diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AggregateSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AggregateSymbol.cs index 3943639da8..68bebea493 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AggregateSymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AggregateSymbol.cs @@ -63,9 +63,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Constructors private bool _hasPubNoArgCtor; // Whether it has a public instance constructor taking no args - // private struct members should not be checked for assignment or references - private bool _hasExternReference; - // User defined operators private bool _isSkipUDOps; // Never check for user defined operators on this type (eg, decimal, string, delegate). @@ -109,20 +106,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; } - public NamespaceOrAggregateSymbol Parent - { - get { return parent.AsNamespaceOrAggregateSymbol(); } - } + public NamespaceOrAggregateSymbol Parent => parent as NamespaceOrAggregateSymbol; - public bool isNested() - { - return parent != null && parent.IsAggregateSymbol(); - } + public bool isNested() => parent is AggregateSymbol; - public AggregateSymbol GetOuterAgg() - { - return parent != null && parent.IsAggregateSymbol() ? parent.AsAggregateSymbol() : null; - } + public AggregateSymbol GetOuterAgg() => parent as AggregateSymbol; public bool isPredefAgg(PredefinedType pt) { @@ -269,17 +257,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _hasPubNoArgCtor = hasPubNoArgCtor; } - public bool HasExternReference() - { - return _hasExternReference == true; - } - - public void SetHasExternReference(bool hasExternReference) - { - _hasExternReference = hasExternReference; - } - - public bool IsSkipUDOps() { return _isSkipUDOps == true; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AssemblyQualifiedNamespaceSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AssemblyQualifiedNamespaceSymbol.cs index 0f8c3e4d54..5f788924fe 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AssemblyQualifiedNamespaceSymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AssemblyQualifiedNamespaceSymbol.cs @@ -14,9 +14,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class AssemblyQualifiedNamespaceSymbol : ParentSymbol { - public NamespaceSymbol GetNS() - { - return parent.AsNamespaceSymbol(); - } + public NamespaceSymbol GetNS() => parent as NamespaceSymbol; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/FieldSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/FieldSymbol.cs index c4e52ff2bd..f8f72a97e1 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/FieldSymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/FieldSymbol.cs @@ -43,19 +43,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return type; } - public AggregateSymbol getClass() - { - return parent.AsAggregateSymbol(); - } + public AggregateSymbol getClass() => parent as AggregateSymbol; public EventSymbol getEvent(SymbolLoader symbolLoader) { - Debug.Assert(this.isEvent == true); - EventSymbol evt = symbolLoader.LookupAggMember(this.name, - this.getClass(), - symbmask_t.MASK_EventSymbol).AsEventSymbol(); - - return evt; + Debug.Assert(isEvent); + return symbolLoader.LookupAggMember(name, getClass(), symbmask_t.MASK_EventSymbol) as EventSymbol; } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodOrPropertySymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodOrPropertySymbol.cs index f712629e7b..9b7bdd4283 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodOrPropertySymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodOrPropertySymbol.cs @@ -28,9 +28,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public new bool isStatic; // Static member? public bool isOverride; // Overrides an inherited member. Only valid if isVirtual is set. - // false implies that a new vtable slot is required for this method. - public bool useMethInstead; // Only valid iff isBogus == TRUE && IsPropertySymbol(). - // If this is true then tell the user to call the accessors directly. + // false implies that a new vtable slot is required for this method. public bool isOperator; // a user defined operator (or default indexed property) public bool isParamArray; // new style varargs public bool isHideByName; // this property hides all below it regardless of signature @@ -169,10 +167,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return marshalAsType == UnmanagedType.Interface || marshalAsType == UnmanagedType.IUnknown; } - public AggregateSymbol getClass() - { - return parent.AsAggregateSymbol(); - } + public AggregateSymbol getClass() => parent as AggregateSymbol; public bool IsExpImpl() { diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodSymbol.cs index 9fd8e84924..b233c6d414 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodSymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodSymbol.cs @@ -23,8 +23,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private PropertySymbol _prop; // For property accessors, this is the PropertySymbol. private EventSymbol _evt; // For event accessors, this is the EventSymbol. - public bool isExtension; // is the method a extension method - public bool isExternal; // Has external definition. public bool isVirtual; // Virtual member? public bool isAbstract; // Abstract method? public bool isVarargs; // has varargs @@ -46,7 +44,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _checkedInfMustFail = true; for (int ivar = 0; ivar < typeVars.Count; ivar++) { - TypeParameterType var = typeVars.ItemAsTypeParameterType(ivar); + TypeParameterType var = (TypeParameterType)typeVars[ivar]; // See if type var is used in a parameter. for (int ipar = 0; ; ipar++) { @@ -66,11 +64,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; } - public bool IsExtension() - { - return isExtension; - } - public MethodKindEnum MethKind() { return _methKind; @@ -85,7 +78,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return getClass().isPredefAgg(PredefinedType.PT_G_OPTIONAL) && Params.Count == 1 && - Params[0].IsGenericParameter && + Params[0] is TypeParameterType && IsConstructor(); } @@ -194,7 +187,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; } - return (this == property.methSet); + return (this == property.SetterMethod); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MiscSymFactory.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MiscSymFactory.cs deleted file mode 100644 index ca8e2dbc02..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MiscSymFactory.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using Microsoft.CSharp.RuntimeBinder.Syntax; - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - internal sealed class MiscSymFactory : SymFactoryBase - { - // Constructor. - - public MiscSymFactory(SYMTBL symtable) - : base(symtable) - { - } - - public Scope CreateScope(Scope parent) - { - Scope sym = newBasicSym(SYMKIND.SK_Scope, null, parent).AsScope(); - if (parent != null) - { - sym.nestingOrder = parent.nestingOrder + 1; - } - - return sym; - } - - public IndexerSymbol CreateIndexer(Name name, ParentSymbol parent, Name realName) - { - IndexerSymbol sym = (IndexerSymbol)newBasicSym(SYMKIND.SK_IndexerSymbol, name, parent); - sym.setKind(SYMKIND.SK_PropertySymbol); - sym.isOperator = true; - - Debug.Assert(sym != null); - return sym; - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/NamespaceOrAggregateSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/NamespaceOrAggregateSymbol.cs index 3eb3e42bb5..2f9a029fcf 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/NamespaceOrAggregateSymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/NamespaceOrAggregateSymbol.cs @@ -27,9 +27,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public void AddDecl(AggregateDeclaration decl) { Debug.Assert(decl != null); - Debug.Assert(IsNamespaceSymbol() || IsAggregateSymbol()); - Debug.Assert(decl.IsAggregateDeclaration()); - Debug.Assert(!IsNamespaceSymbol()); + Debug.Assert(this is AggregateSymbol); + Debug.Assert(decl is AggregateDeclaration); // If parent is set it should be set to us! Debug.Assert(decl.bag == null || decl.bag == this); diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/PropertySymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/PropertySymbol.cs index f558991526..b0c9089b0a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/PropertySymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/PropertySymbol.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics; using System.Reflection; namespace Microsoft.CSharp.RuntimeBinder.Semantics @@ -17,19 +16,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal class PropertySymbol : MethodOrPropertySymbol { - public MethodSymbol methGet; // Getter method (always has same parent) - public MethodSymbol methSet; // Setter method (always has same parent) - public PropertyInfo AssociatedPropertyInfo; + public MethodSymbol GetterMethod { get; set; } // (always has same parent) - public bool isIndexer() - { - return isOperator; - } + public MethodSymbol SetterMethod { get; set; } // (always has same parent) - public IndexerSymbol AsIndexerSymbol() - { - Debug.Assert(isIndexer()); - return (IndexerSymbol)this; - } + public PropertyInfo AssociatedPropertyInfo { get; set; } + + public bool Bogus { get; set; } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactory.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactory.cs index 96c6b77eb9..f2be6b9419 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactory.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactory.cs @@ -7,17 +7,91 @@ using Microsoft.CSharp.RuntimeBinder.Syntax; namespace Microsoft.CSharp.RuntimeBinder.Semantics { - internal sealed class SymFactory : SymFactoryBase + internal sealed class SymFactory { - public SymFactory(SYMTBL symtable) : - base(symtable) + private readonly SYMTBL _symbolTable; + + public SymFactory(SYMTBL symtable) { + _symbolTable = symtable; + } + + private Symbol NewBasicSymbol( + SYMKIND kind, + Name name, + ParentSymbol parent) + { + Symbol sym; + switch (kind) + { + case SYMKIND.SK_NamespaceSymbol: + sym = new NamespaceSymbol(); + sym.name = name; + break; + case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: + sym = new AssemblyQualifiedNamespaceSymbol(); + sym.name = name; + break; + case SYMKIND.SK_AggregateSymbol: + sym = new AggregateSymbol(); + sym.name = name; + break; + case SYMKIND.SK_AggregateDeclaration: + sym = new AggregateDeclaration(); + sym.name = name; + break; + case SYMKIND.SK_TypeParameterSymbol: + sym = new TypeParameterSymbol(); + sym.name = name; + break; + case SYMKIND.SK_FieldSymbol: + sym = new FieldSymbol(); + sym.name = name; + break; + case SYMKIND.SK_LocalVariableSymbol: + sym = new LocalVariableSymbol(); + sym.name = name; + break; + case SYMKIND.SK_MethodSymbol: + sym = new MethodSymbol(); + sym.name = name; + break; + case SYMKIND.SK_PropertySymbol: + sym = new PropertySymbol(); + sym.name = name; + break; + case SYMKIND.SK_EventSymbol: + sym = new EventSymbol(); + sym.name = name; + break; + case SYMKIND.SK_Scope: + sym = new Scope(); + sym.name = name; + break; + case SYMKIND.SK_IndexerSymbol: + sym = new IndexerSymbol(); + sym.name = name; + break; + default: + throw Error.InternalCompilerError(); + } + + sym.setKind(kind); + + if (parent != null) + { + // Set the parent element of the child symbol. + parent.AddToChildList(sym); + _symbolTable.InsertChild(parent, sym); + } + + return (sym); } // Namespace public NamespaceSymbol CreateNamespace(Name name, NamespaceSymbol parent) { - NamespaceSymbol sym = newBasicSym(SYMKIND.SK_NamespaceSymbol, name, parent).AsNamespaceSymbol(); + NamespaceSymbol sym = (NamespaceSymbol)NewBasicSymbol(SYMKIND.SK_NamespaceSymbol, name, parent); sym.SetAccess(ACCESS.ACC_PUBLIC); return (sym); @@ -27,7 +101,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(name != null); - AssemblyQualifiedNamespaceSymbol sym = newBasicSym(SYMKIND.SK_AssemblyQualifiedNamespaceSymbol, name, parent).AsAssemblyQualifiedNamespaceSymbol(); + AssemblyQualifiedNamespaceSymbol sym = NewBasicSymbol(SYMKIND.SK_AssemblyQualifiedNamespaceSymbol, name, parent) as AssemblyQualifiedNamespaceSymbol; Debug.Assert(sym != null); return sym; @@ -41,12 +115,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics throw Error.InternalCompilerError(); } - AggregateSymbol sym = newBasicSym(SYMKIND.SK_AggregateSymbol, name, parent).AsAggregateSymbol(); + AggregateSymbol sym = (AggregateSymbol)NewBasicSymbol(SYMKIND.SK_AggregateSymbol, name, parent); sym.name = name; sym.SetTypeManager(typeManager); sym.SetSealed(false); sym.SetAccess(ACCESS.ACC_UNKNOWN); - sym.initBogus(); sym.SetIfaces(null); sym.SetIfacesAll(null); sym.SetTypeVars(null); @@ -60,7 +133,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics //Debug.Assert(declOuter == null || declOuter.Bag() == agg.Parent); // DECLSYMs are not parented like named symbols. - AggregateDeclaration sym = newBasicSym(SYMKIND.SK_AggregateDeclaration, agg.name, null).AsAggregateDeclaration(); + AggregateDeclaration sym = NewBasicSymbol(SYMKIND.SK_AggregateDeclaration, agg.name, null) as AggregateDeclaration; declOuter?.AddToChildList(sym); agg.AddDecl(sym); @@ -74,7 +147,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(name != null); - FieldSymbol sym = newBasicSym(SYMKIND.SK_FieldSymbol, name, parent).AsFieldSymbol(); + FieldSymbol sym = NewBasicSymbol(SYMKIND.SK_FieldSymbol, name, parent) as FieldSymbol; Debug.Assert(sym != null); return (sym); @@ -82,7 +155,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public LocalVariableSymbol CreateLocalVar(Name name, ParentSymbol parent, CType type) { - LocalVariableSymbol sym = newBasicSym(SYMKIND.SK_LocalVariableSymbol, name, parent).AsLocalVariableSymbol(); + LocalVariableSymbol sym = (LocalVariableSymbol)NewBasicSymbol(SYMKIND.SK_LocalVariableSymbol, name, parent); sym.SetType(type); sym.SetAccess(ACCESS.ACC_UNKNOWN); // required for Symbol::hasExternalAccess which is used by refactoring sym.wrap = null; @@ -90,23 +163,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return sym; } - public MethodSymbol CreateMethod(Name name, ParentSymbol parent) - { - MethodSymbol sym = newBasicSym(SYMKIND.SK_MethodSymbol, name, parent).AsMethodSymbol(); - - return sym; - } + public MethodSymbol CreateMethod(Name name, ParentSymbol parent) => + NewBasicSymbol(SYMKIND.SK_MethodSymbol, name, parent) as MethodSymbol; public PropertySymbol CreateProperty(Name name, ParentSymbol parent) { - PropertySymbol sym = newBasicSym(SYMKIND.SK_PropertySymbol, name, parent).AsPropertySymbol(); + PropertySymbol sym = NewBasicSymbol(SYMKIND.SK_PropertySymbol, name, parent) as PropertySymbol; Debug.Assert(sym != null); return (sym); } public EventSymbol CreateEvent(Name name, ParentSymbol parent) { - EventSymbol sym = newBasicSym(SYMKIND.SK_EventSymbol, name, parent).AsEventSymbol(); + EventSymbol sym = NewBasicSymbol(SYMKIND.SK_EventSymbol, name, parent) as EventSymbol; Debug.Assert(sym != null); return (sym); @@ -114,7 +183,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public TypeParameterSymbol CreateMethodTypeParameter(Name pName, MethodSymbol pParent, int index, int indexTotal) { - TypeParameterSymbol pResult = newBasicSym(SYMKIND.SK_TypeParameterSymbol, pName, pParent).AsTypeParameterSymbol(); + TypeParameterSymbol pResult = (TypeParameterSymbol)NewBasicSymbol(SYMKIND.SK_TypeParameterSymbol, pName, pParent); pResult.SetIndexInOwnParameters(index); pResult.SetIndexInTotalParameters(indexTotal); @@ -126,7 +195,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public TypeParameterSymbol CreateClassTypeParameter(Name pName, AggregateSymbol pParent, int index, int indexTotal) { - TypeParameterSymbol pResult = newBasicSym(SYMKIND.SK_TypeParameterSymbol, pName, pParent).AsTypeParameterSymbol(); + TypeParameterSymbol pResult = (TypeParameterSymbol)NewBasicSymbol(SYMKIND.SK_TypeParameterSymbol, pName, pParent); pResult.SetIndexInOwnParameters(index); pResult.SetIndexInTotalParameters(indexTotal); @@ -135,5 +204,26 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return pResult; } + + public Scope CreateScope(Scope parent) + { + Scope sym = (Scope)NewBasicSymbol(SYMKIND.SK_Scope, null, parent); + if (parent != null) + { + sym.nestingOrder = parent.nestingOrder + 1; + } + + return sym; + } + + public IndexerSymbol CreateIndexer(Name name, ParentSymbol parent, Name realName) + { + IndexerSymbol sym = (IndexerSymbol)NewBasicSymbol(SYMKIND.SK_IndexerSymbol, name, parent); + sym.setKind(SYMKIND.SK_PropertySymbol); + sym.isOperator = true; + + Debug.Assert(sym != null); + return sym; + } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactoryBase.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactoryBase.cs deleted file mode 100644 index 80c92ac840..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactoryBase.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.CSharp.RuntimeBinder.Syntax; - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - // This class is the base class for the different symbol factories: the - // SymFactory, TypeFactory and MiscSymFactory. This provides a common - // way of creating syms that all three classes use. - - internal abstract class SymFactoryBase - { - // Members. - private readonly SYMTBL m_pSymTable; - protected Symbol newBasicSym( - SYMKIND kind, - Name name, - ParentSymbol parent) - { - Symbol sym; - switch (kind) - { - case SYMKIND.SK_NamespaceSymbol: - sym = new NamespaceSymbol(); - sym.name = name; - break; - case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: - sym = new AssemblyQualifiedNamespaceSymbol(); - sym.name = name; - break; - case SYMKIND.SK_AggregateSymbol: - sym = new AggregateSymbol(); - sym.name = name; - break; - case SYMKIND.SK_AggregateDeclaration: - sym = new AggregateDeclaration(); - sym.name = name; - break; - case SYMKIND.SK_TypeParameterSymbol: - sym = new TypeParameterSymbol(); - sym.name = name; - break; - case SYMKIND.SK_FieldSymbol: - sym = new FieldSymbol(); - sym.name = name; - break; - case SYMKIND.SK_LocalVariableSymbol: - sym = new LocalVariableSymbol(); - sym.name = name; - break; - case SYMKIND.SK_MethodSymbol: - sym = new MethodSymbol(); - sym.name = name; - break; - case SYMKIND.SK_PropertySymbol: - sym = new PropertySymbol(); - sym.name = name; - break; - case SYMKIND.SK_EventSymbol: - sym = new EventSymbol(); - sym.name = name; - break; - case SYMKIND.SK_Scope: - sym = new Scope(); - sym.name = name; - break; - case SYMKIND.SK_UnresolvedAggregateSymbol: - sym = new UnresolvedAggregateSymbol(); - sym.name = name; - break; - case SYMKIND.SK_IndexerSymbol: - sym = new IndexerSymbol(); - sym.name = name; - break; - default: - throw Error.InternalCompilerError(); - } - - sym.setKind(kind); - - if (parent != null) - { - // Set the parent element of the child symbol. - parent.AddToChildList(sym); - m_pSymTable.InsertChild(parent, sym); - } - - return (sym); - } - - // This class should never be created on its own. - protected SymFactoryBase(SYMTBL symtable) - { - m_pSymTable = symtable; - } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/Symbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/Symbol.cs index 5735003eb1..7da37bdba4 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/Symbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/Symbol.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; +using System; using System.Diagnostics; using System.Reflection; using Microsoft.CSharp.RuntimeBinder.Syntax; @@ -39,6 +39,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics ///////////////////////////////////////////////////////////////////////////////// // Special constraints. + [Flags] internal enum SpecCons { None = 0x00, @@ -57,8 +58,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal abstract class Symbol { private SYMKIND _kind; // the symbol kind - private bool _isBogus; // can't be used in our language -- unsupported type(s) - private bool _checkedBogus; // Have we checked a method args/return for bogus types private ACCESS _access; // access level // If this is true, then we had an error the first time so do not give an error the second time. @@ -95,202 +94,46 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return (symbmask_t)(1 << (int)_kind); } - public bool checkBogus() - { - Debug.Assert(_checkedBogus); - return _isBogus; - } // if this Debug.Assert fires then call COMPILER_BASE::CheckBogus() instead - - public bool getBogus() - { - return _isBogus; - } - - public bool hasBogus() - { - return _checkedBogus; - } - - public void setBogus(bool isBogus) - { - _isBogus = isBogus; - _checkedBogus = true; - } - - public void initBogus() - { - _isBogus = false; - _checkedBogus = false; - } - - public bool computeCurrentBogusState() - { - if (hasBogus()) - { - return checkBogus(); - } - - bool fBogus = false; - - switch (getKind()) - { - case SYMKIND.SK_PropertySymbol: - case SYMKIND.SK_MethodSymbol: - { - MethodOrPropertySymbol meth = this.AsMethodOrPropertySymbol(); - - if (meth.RetType != null) - { - fBogus = meth.RetType.computeCurrentBogusState(); - } - if (meth.Params != null) - { - for (int i = 0; !fBogus && i < meth.Params.Count; i++) - { - fBogus |= meth.Params[i].computeCurrentBogusState(); - } - } - } - break; - - /* - case SYMKIND.SK_ParameterModifierType: - case SYMKIND.SK_OptionalModifierType: - case SYMKIND.SK_PointerType: - case SYMKIND.SK_ArrayType: - case SYMKIND.SK_NullableType: - case SYMKIND.SK_PinnedType: - if (this.AsType().GetBaseOrParameterOrElementType() != null) - { - fBogus = this.AsType().GetBaseOrParameterOrElementType().computeCurrentBogusState(); - } - break; - */ - - case SYMKIND.SK_EventSymbol: - if (this.AsEventSymbol().type != null) - { - fBogus = this.AsEventSymbol().type.computeCurrentBogusState(); - } - break; - - case SYMKIND.SK_FieldSymbol: - if (this.AsFieldSymbol().GetType() != null) - { - fBogus = this.AsFieldSymbol().GetType().computeCurrentBogusState(); - } - break; - - /* - case SYMKIND.SK_ErrorType: - this.setBogus(false); - break; - - case SYMKIND.SK_AggregateType: - fBogus = this.AsAggregateType().getAggregate().computeCurrentBogusState(); - for (int i = 0; !fBogus && i < this.AsAggregateType().GetTypeArgsAll().size; i++) - { - fBogus |= this.AsAggregateType().GetTypeArgsAll()[i].computeCurrentBogusState(); - } - break; - */ - - case SYMKIND.SK_TypeParameterSymbol: - /* - case SYMKIND.SK_TypeParameterType: - case SYMKIND.SK_VoidType: - case SYMKIND.SK_NullType: - case SYMKIND.SK_OpenTypePlaceholderType: - case SYMKIND.SK_ArgumentListType: - case SYMKIND.SK_NaturalIntegerType: - */ - case SYMKIND.SK_LocalVariableSymbol: - setBogus(false); - break; - - case SYMKIND.SK_AggregateSymbol: - fBogus = hasBogus() && checkBogus(); - break; - - case SYMKIND.SK_Scope: - case SYMKIND.SK_LambdaScope: - case SYMKIND.SK_NamespaceSymbol: - default: - Debug.Assert(false, "CheckBogus with invalid Symbol kind"); - setBogus(false); - break; - } - - if (fBogus) - { - // Only set this if at least 1 declared thing is bogus - setBogus(fBogus); - } - - return hasBogus() && checkBogus(); - } - - public bool IsNamespaceSymbol() { return _kind == SYMKIND.SK_NamespaceSymbol; } - - public bool IsAggregateSymbol() { return _kind == SYMKIND.SK_AggregateSymbol; } - public bool IsAggregateDeclaration() { return _kind == SYMKIND.SK_AggregateDeclaration; } - public bool IsFieldSymbol() { return _kind == SYMKIND.SK_FieldSymbol; } - public bool IsLocalVariableSymbol() { return _kind == SYMKIND.SK_LocalVariableSymbol; } - public bool IsMethodSymbol() { return _kind == SYMKIND.SK_MethodSymbol; } - public bool IsPropertySymbol() { return _kind == SYMKIND.SK_PropertySymbol; } - public bool IsTypeParameterSymbol() { return _kind == SYMKIND.SK_TypeParameterSymbol; } - public bool IsEventSymbol() { return _kind == SYMKIND.SK_EventSymbol; } - - public bool IsMethodOrPropertySymbol() - { - return IsMethodSymbol() || IsPropertySymbol(); - } - - public bool IsFMETHSYM() - { - return IsMethodSymbol(); - } - public CType getType() { - CType type = null; - if (IsMethodOrPropertySymbol()) + if (this is MethodOrPropertySymbol methProp) { - type = this.AsMethodOrPropertySymbol().RetType; + return methProp.RetType; } - else if (IsFieldSymbol()) + + if (this is FieldSymbol field) { - type = this.AsFieldSymbol().GetType(); + return field.GetType(); } - else if (IsEventSymbol()) + + if (this is EventSymbol ev) { - type = this.AsEventSymbol().type; + return ev.type; } - return type; + + return null; } public bool isStatic { get { - bool fStatic = false; - if (IsFieldSymbol()) + if (this is FieldSymbol field) { - fStatic = this.AsFieldSymbol().isStatic; + return field.isStatic; } - else if (IsEventSymbol()) + + if (this is EventSymbol ev) { - fStatic = this.AsEventSymbol().isStatic; + return ev.isStatic; } - else if (IsMethodOrPropertySymbol()) + + if (this is MethodOrPropertySymbol methProp) { - fStatic = this.AsMethodOrPropertySymbol().isStatic; + return methProp.isStatic; } - else if (IsAggregateSymbol()) - { - fStatic = true; - } - return fStatic; + + return this is AggregateSymbol; } } @@ -303,14 +146,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case SYMKIND.SK_FieldSymbol: case SYMKIND.SK_EventSymbol: case SYMKIND.SK_TypeParameterSymbol: - return parent.AsAggregateSymbol().AssociatedAssembly; + return ((AggregateSymbol)parent).AssociatedAssembly; case SYMKIND.SK_AggregateDeclaration: - return this.AsAggregateDeclaration().GetAssembly(); + return ((AggregateDeclaration)this).GetAssembly(); case SYMKIND.SK_AggregateSymbol: - return this.AsAggregateSymbol().AssociatedAssembly; - case SYMKIND.SK_NamespaceSymbol: - case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: + return ((AggregateSymbol)this).AssociatedAssembly; default: // Should never call this with any other kind. Debug.Assert(false, "GetAssemblyID called on bad sym kind"); @@ -330,15 +171,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case SYMKIND.SK_FieldSymbol: case SYMKIND.SK_EventSymbol: case SYMKIND.SK_TypeParameterSymbol: - return parent.AsAggregateSymbol().InternalsVisibleTo(assembly); + return ((AggregateSymbol)parent).InternalsVisibleTo(assembly); case SYMKIND.SK_AggregateDeclaration: - return this.AsAggregateDeclaration().Agg().InternalsVisibleTo(assembly); + return ((AggregateDeclaration)this).Agg().InternalsVisibleTo(assembly); case SYMKIND.SK_AggregateSymbol: - return this.AsAggregateSymbol().InternalsVisibleTo(assembly); - case SYMKIND.SK_ExternalAliasDefinitionSymbol: - case SYMKIND.SK_NamespaceSymbol: - case SYMKIND.SK_AssemblyQualifiedNamespaceSymbol: + return ((AggregateSymbol)this).InternalsVisibleTo(assembly); default: // Should never call this with any other kind. Debug.Assert(false, "InternalsVisibleTo called on bad sym kind"); @@ -358,12 +196,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (_kind) { case SYMKIND.SK_MethodSymbol: - return this.AsMethodSymbol().isVirtual; + return ((MethodSymbol)this).isVirtual; + case SYMKIND.SK_EventSymbol: - return this.AsEventSymbol().methAdd != null && this.AsEventSymbol().methAdd.isVirtual; + MethodSymbol methAdd = ((EventSymbol)this).methAdd; + return methAdd != null && methAdd.isVirtual; + case SYMKIND.SK_PropertySymbol: - return (this.AsPropertySymbol().methGet != null && this.AsPropertySymbol().methGet.isVirtual) || - (this.AsPropertySymbol().methSet != null && this.AsPropertySymbol().methSet.isVirtual); + PropertySymbol prop = ((PropertySymbol)this); + MethodSymbol meth = prop.GetterMethod ?? prop.SetterMethod; + return meth != null && meth.isVirtual; + default: return false; } @@ -375,9 +218,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { case SYMKIND.SK_MethodSymbol: case SYMKIND.SK_PropertySymbol: - return this.AsMethodOrPropertySymbol().isOverride; + return ((MethodOrPropertySymbol)this).isOverride; case SYMKIND.SK_EventSymbol: - return this.AsEventSymbol().isOverride; + return ((EventSymbol)this).isOverride; default: return false; } @@ -389,9 +232,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { case SYMKIND.SK_MethodSymbol: case SYMKIND.SK_PropertySymbol: - return this.AsMethodOrPropertySymbol().isHideByName; + return ((MethodOrPropertySymbol)this).isHideByName; case SYMKIND.SK_EventSymbol: - return this.AsEventSymbol().methAdd != null && this.AsEventSymbol().methAdd.isHideByName; + MethodSymbol methAdd = ((EventSymbol)this).methAdd; + return methAdd != null && methAdd.isHideByName; default: return true; } @@ -400,15 +244,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Returns the virtual that this sym overrides (if IsOverride() is true), null otherwise. public Symbol SymBaseVirtual() { - switch (_kind) - { - case SYMKIND.SK_MethodSymbol: - case SYMKIND.SK_PropertySymbol: - return this.AsMethodOrPropertySymbol().swtSlot.Sym; - case SYMKIND.SK_EventSymbol: - default: - return null; - } + return (this as MethodOrPropertySymbol)?.swtSlot.Sym; } /* @@ -416,54 +252,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics */ public bool isUserCallable() { - switch (_kind) - { - case SYMKIND.SK_MethodSymbol: - return this.AsMethodSymbol().isUserCallable(); - default: - break; - } - - return true; + return !(this is MethodSymbol methSym) || methSym.isUserCallable(); } } - - /* - * We have member functions here to do casts that, in DEBUG, check the - * symbol kind to make sure it is right. For example, the casting method - * for METHODSYM is called "asMETHODSYM". In retail builds, these - * methods optimize away to nothing. - */ - - internal static class SymbolExtensions - { - public static IEnumerable Children(this ParentSymbol symbol) - { - if (symbol == null) - yield break; - Symbol current = symbol.firstChild; - while (current != null) - { - yield return current; - current = current.nextChild; - } - } - - internal static MethodSymbol AsFMETHSYM(this Symbol symbol) { return symbol as MethodSymbol; } - - internal static NamespaceOrAggregateSymbol AsNamespaceOrAggregateSymbol(this Symbol symbol) { return symbol as NamespaceOrAggregateSymbol; } - internal static NamespaceSymbol AsNamespaceSymbol(this Symbol symbol) { return symbol as NamespaceSymbol; } - internal static AssemblyQualifiedNamespaceSymbol AsAssemblyQualifiedNamespaceSymbol(this Symbol symbol) { return symbol as AssemblyQualifiedNamespaceSymbol; } - - internal static AggregateSymbol AsAggregateSymbol(this Symbol symbol) { return symbol as AggregateSymbol; } - internal static AggregateDeclaration AsAggregateDeclaration(this Symbol symbol) { return symbol as AggregateDeclaration; } - internal static FieldSymbol AsFieldSymbol(this Symbol symbol) { return symbol as FieldSymbol; } - internal static LocalVariableSymbol AsLocalVariableSymbol(this Symbol symbol) { return symbol as LocalVariableSymbol; } - internal static MethodSymbol AsMethodSymbol(this Symbol symbol) { return symbol as MethodSymbol; } - internal static PropertySymbol AsPropertySymbol(this Symbol symbol) { return symbol as PropertySymbol; } - internal static MethodOrPropertySymbol AsMethodOrPropertySymbol(this Symbol symbol) { return symbol as MethodOrPropertySymbol; } - internal static Scope AsScope(this Symbol symbol) { return symbol as Scope; } - internal static TypeParameterSymbol AsTypeParameterSymbol(this Symbol symbol) { return symbol as TypeParameterSymbol; } - internal static EventSymbol AsEventSymbol(this Symbol symbol) { return symbol as EventSymbol; } - } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolKind.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolKind.cs index affef97ca4..405193322b 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolKind.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolKind.cs @@ -16,12 +16,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics SK_MethodSymbol, SK_PropertySymbol, SK_EventSymbol, - SK_ExternalAliasDefinitionSymbol, SK_Scope, - SK_CachedNameSymbol, - SK_LambdaScope, - SK_UnresolvedAggregateSymbol, - SK_IndexerSymbol, - SK_LIM + SK_IndexerSymbol } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolLoader.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolLoader.cs index 1784e0bc6a..d115740a05 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolLoader.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolLoader.cs @@ -17,14 +17,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public ErrorHandling ErrorContext { get; } public SymbolTable RuntimeBinderSymbolTable { get; private set; } - public SymbolLoader( - GlobalSymbolContext globalSymbols, - ErrorHandling errorContext - ) + public SymbolLoader() { + GlobalSymbolContext globalSymbols = new GlobalSymbolContext(new NameManager()); _nameManager = globalSymbols.GetNameManager(); PredefinedMembers = new PredefinedMembers(this); - ErrorContext = errorContext; + ErrorContext = new ErrorHandling(globalSymbols); GlobalSymbolContext = globalSymbols; Debug.Assert(GlobalSymbolContext != null); } @@ -46,9 +44,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics pSym != null; pSym = LookupNextSym(pSym, pAggDel, symbmask_t.MASK_ALL)) { - if (pSym.IsMethodSymbol() && pSym.AsMethodSymbol().isInvoke()) + if (pSym is MethodSymbol meth && meth.isInvoke()) { - return pSym.AsMethodSymbol(); + return meth; } } return null; @@ -59,7 +57,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return _nameManager; } - public PredefinedTypes getPredefTypes() + public PredefinedTypes GetPredefindTypes() { return GlobalSymbolContext.GetPredefTypes(); } @@ -89,49 +87,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GlobalSymbolContext.GetGlobalSymbolFactory(); } - public MiscSymFactory GetGlobalMiscSymFactory() - { - return GlobalSymbolContext.GetGlobalMiscSymFactory(); - } + public AggregateSymbol GetPredefAgg(PredefinedType pt) => GetTypeManager().GetPredefAgg(pt); - public AggregateType GetReqPredefType(PredefinedType pt) - { - AggregateSymbol agg = GetTypeManager().GetReqPredefAgg(pt); - if (agg == null) - { - Debug.Assert(false, "Required predef type missing"); - return null; - } - AggregateType ats = agg.getThisType(); - return ats; - } - - public AggregateSymbol GetOptPredefAgg(PredefinedType pt) - { - return GetTypeManager().GetOptPredefAgg(pt); - } - - public AggregateType GetOptPredefType(PredefinedType pt) - { - AggregateSymbol agg = GetTypeManager().GetOptPredefAgg(pt); - if (agg == null) - return null; - AggregateType ats = agg.getThisType(); - return ats; - } - - public AggregateType GetOptPredefTypeErr(PredefinedType pt) - { - AggregateSymbol agg = GetTypeManager().GetOptPredefAgg(pt); - if (agg == null) - { - getPredefTypes().ReportMissingPredefTypeError(ErrorContext, pt); - return null; - } - - AggregateType ats = agg.getThisType(); - return ats; - } + public AggregateType GetPredefindType(PredefinedType pt) => GetPredefAgg(pt).getThisType(); public Symbol LookupAggMember(Name name, AggregateSymbol agg, symbmask_t mask) { @@ -147,51 +105,44 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public AggregateType GetAggTypeSym(CType typeSym) { Debug.Assert(typeSym != null); - Debug.Assert(typeSym.IsAggregateType() || - typeSym.IsTypeParameterType() || - typeSym.IsArrayType() || - typeSym.IsNullableType()); + Debug.Assert(typeSym is AggregateType || + typeSym is ArrayType || + typeSym is NullableType); switch (typeSym.GetTypeKind()) { case TypeKind.TK_AggregateType: - return typeSym.AsAggregateType(); + return (AggregateType)typeSym; case TypeKind.TK_ArrayType: - return GetReqPredefType(PredefinedType.PT_ARRAY); - case TypeKind.TK_TypeParameterType: - return typeSym.AsTypeParameterType().GetEffectiveBaseClass(); + return GetPredefindType(PredefinedType.PT_ARRAY); case TypeKind.TK_NullableType: - return typeSym.AsNullableType().GetAts(ErrorContext); + return ((NullableType)typeSym).GetAts(); } Debug.Assert(false, "Bad typeSym!"); return null; } - private bool IsBaseInterface(CType pDerived, CType pBase) + private bool IsBaseInterface(AggregateType atsDer, AggregateType pBase) { - Debug.Assert(pDerived != null); + Debug.Assert(atsDer != null); Debug.Assert(pBase != null); - if (!pBase.isInterfaceType()) + if (pBase.isInterfaceType()) { - return false; - } - if (!pDerived.IsAggregateType()) - { - return false; - } - AggregateType atsDer = pDerived.AsAggregateType(); - while (atsDer != null) - { - TypeArray ifacesAll = atsDer.GetIfacesAll(); - for (int i = 0; i < ifacesAll.Count; i++) + while (atsDer != null) { - if (AreTypesEqualForConversion(ifacesAll[i], pBase)) + TypeArray ifacesAll = atsDer.GetIfacesAll(); + for (int i = 0; i < ifacesAll.Count; i++) { - return true; + if (AreTypesEqualForConversion(ifacesAll[i], pBase)) + { + return true; + } } + + atsDer = atsDer.GetBaseClass(); } - atsDer = atsDer.GetBaseClass(); } + return false; } @@ -215,26 +166,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(pBase != null); // A base class has got to be a class. The derived type might be a struct. - if (!pBase.isClassType()) + if (!(pBase is AggregateType atsBase && atsBase.isClassType())) { return false; } - if (pDerived.IsNullableType()) + if (pDerived is NullableType derivedNub) { - pDerived = pDerived.AsNullableType().GetAts(ErrorContext); - if (pDerived == null) - { - return false; - } + pDerived = derivedNub.GetAts(); } - if (!pDerived.IsAggregateType()) + if (!(pDerived is AggregateType atsDer)) { return false; } - AggregateType atsDer = pDerived.AsAggregateType(); - AggregateType atsBase = pBase.AsAggregateType(); AggregateType atsCur = atsDer.GetBaseClass(); while (atsCur != null) { @@ -304,8 +249,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - AggregateType atsDest = pDest.AsAggregateType(); - AggregateSymbol aggDest = pDest.getAggregate(); + AggregateType atsDest = (AggregateType)pDest; + AggregateSymbol aggDest = atsDest.getAggregate(); if (!aggDest.isPredefAgg(PredefinedType.PT_G_ILIST) && !aggDest.isPredefAgg(PredefinedType.PT_G_ICOLLECTION) && !aggDest.isPredefAgg(PredefinedType.PT_G_IENUMERABLE) && @@ -326,6 +271,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(pSource != null); Debug.Assert(pDest != null); + Debug.Assert(!(pSource is TypeParameterType)); // The implicit reference conversions are: // * From any reference type to Object. @@ -333,168 +279,118 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return true; } - // * From any class type S to any class type T provided S is derived from T. - if (pSource.isClassType() && pDest.isClassType() && IsBaseClass(pSource, pDest)) - { - return true; - } - // ORIGINAL RULES: - // // * From any class type S to any interface type T provided S implements T. - // if (pSource.isClassType() && pDest.isInterfaceType() && IsBaseInterface(pSource, pDest)) - // { - // return true; - // } - // // * from any interface type S to any interface type T, provided S is derived from T. - // if (pSource.isInterfaceType() && pDest.isInterfaceType() && IsBaseInterface(pSource, pDest)) - // { - // return true; - // } - - // VARIANCE EXTENSIONS: - // * From any class type S to any interface type T provided S implements an interface - // convertible to T. - // * From any interface type S to any interface type T provided S implements an interface - // convertible to T. - // * From any interface type S to any interface type T provided S is not T and S is - // an interface convertible to T. - - if (pSource.isClassType() && pDest.isInterfaceType() && HasAnyBaseInterfaceConversion(pSource, pDest)) + if (pSource is AggregateType aggSource) { - return true; - } - if (pSource.isInterfaceType() && pDest.isInterfaceType() && HasAnyBaseInterfaceConversion(pSource, pDest)) - { - return true; - } - if (pSource.isInterfaceType() && pDest.isInterfaceType() && pSource != pDest && - HasInterfaceConversion(pSource.AsAggregateType(), pDest.AsAggregateType())) - { - return true; - } - - // * From an array type S with an element type SE to an array type T with element type TE - // provided that all of the following are true: - // * S and T differ only in element type. In other words, S and T have the same number of dimensions. - // * Both SE and TE are reference types. - // * An implicit reference conversion exists from SE to TE. - if (pSource.IsArrayType() && pDest.IsArrayType() && - HasCovariantArrayConversion(pSource.AsArrayType(), pDest.AsArrayType())) - { - return true; - } - // * From any array type to System.Array or any interface implemented by System.Array. - if (pSource.IsArrayType() && (pDest.isPredefType(PredefinedType.PT_ARRAY) || - IsBaseInterface(GetReqPredefType(PredefinedType.PT_ARRAY), pDest))) - { - return true; - } - // * From a single-dimensional array type S[] to IList and its base - // interfaces, provided that there is an implicit identity or reference - // conversion from S to T. - if (pSource.IsArrayType() && HasArrayConversionToInterface(pSource.AsArrayType(), pDest)) - { - return true; - } - - // * From any delegate type to System.Delegate - // - // SPEC OMISSION: - // - // The spec should actually say - // - // * From any delegate type to System.Delegate - // * From any delegate type to System.MulticastDelegate - // * From any delegate type to any interface implemented by System.MulticastDelegate - if (pSource.isDelegateType() && - (pDest.isPredefType(PredefinedType.PT_MULTIDEL) || - pDest.isPredefType(PredefinedType.PT_DELEGATE) || - IsBaseInterface(GetReqPredefType(PredefinedType.PT_MULTIDEL), pDest))) - { - return true; - } - - // VARIANCE EXTENSION: - // * From any delegate type S to a delegate type T provided S is not T and - // S is a delegate convertible to T - - if (pSource.isDelegateType() && pDest.isDelegateType() && - HasDelegateConversion(pSource.AsAggregateType(), pDest.AsAggregateType())) - { - return true; - } - - // * From the null literal to any reference type - // NOTE: We extend the specification here. The C# 3.0 spec does not describe - // a "null type". Rather, it says that the null literal is typeless, and is - // convertible to any reference or nullable type. However, the C# 2.0 and 3.0 - // implementations have a "null type" which some expressions other than the - // null literal may have. (For example, (null??null), which is also an - // extension to the specification.) - if (pSource.IsNullType() && pDest.IsRefType()) - { - return true; - } - if (pSource.IsNullType() && pDest.IsNullableType()) - { - return true; - } - - // * Implicit conversions involving type parameters that are known to be reference types. - if (pSource.IsTypeParameterType() && - HasImplicitReferenceTypeParameterConversion(pSource.AsTypeParameterType(), pDest)) - { - return true; - } - - return false; - } - - private bool HasImplicitReferenceTypeParameterConversion( - TypeParameterType pSource, CType pDest) - { - Debug.Assert(pSource != null); - Debug.Assert(pDest != null); - - if (!pSource.IsRefType()) - { - // Not a reference conversion. - return false; - } - - // The following implicit conversions exist for a given type parameter T: - // - // * From T to its effective base class C. - AggregateType pEBC = pSource.GetEffectiveBaseClass(); - if (pDest == pEBC) - { - return true; - } - // * From T to any base class of C. - if (IsBaseClass(pEBC, pDest)) - { - return true; - } - // * From T to any interface implemented by C. - if (IsBaseInterface(pEBC, pDest)) - { - return true; - } - // * From T to any interface type I in T's effective interface set, and - // from T to any base interface of I. - TypeArray pInterfaces = pSource.GetInterfaceBounds(); - for (int i = 0; i < pInterfaces.Count; ++i) - { - if (pInterfaces[i] == pDest) + if (pDest is AggregateType aggDest) { - return true; + switch (aggSource.GetOwningAggregate().AggKind()) + { + case AggKindEnum.Class: + switch (aggDest.GetOwningAggregate().AggKind()) + { + case AggKindEnum.Class: + // * From any class type S to any class type T provided S is derived from T. + return IsBaseClass(aggSource, aggDest); + + case AggKindEnum.Interface: + // ORIGINAL RULES: + // // * From any class type S to any interface type T provided S implements T. + // if (pSource.isClassType() && pDest.isInterfaceType() && IsBaseInterface(pSource, pDest)) + // { + // return true; + // } + // // * from any interface type S to any interface type T, provided S is derived from T. + // if (pSource.isInterfaceType() && pDest.isInterfaceType() && IsBaseInterface(pSource, pDest)) + // { + // return true; + // } + + // VARIANCE EXTENSIONS: + // * From any class type S to any interface type T provided S implements an interface + // convertible to T. + // * From any interface type S to any interface type T provided S implements an interface + // convertible to T. + // * From any interface type S to any interface type T provided S is not T and S is + // an interface convertible to T. + + return HasAnyBaseInterfaceConversion(aggSource, aggDest); + } + + break; + + case AggKindEnum.Interface: + if (aggDest.isInterfaceType()) + { + return HasAnyBaseInterfaceConversion(aggSource, aggDest) + || HasInterfaceConversion(aggSource, aggDest); + } + + break; + + case AggKindEnum.Delegate: + // * From any delegate type to System.Delegate + // + // SPEC OMISSION: + // + // The spec should actually say + // + // * From any delegate type to System.Delegate + // * From any delegate type to System.MulticastDelegate + // * From any delegate type to any interface implemented by System.MulticastDelegate + if (aggDest.isPredefType(PredefinedType.PT_MULTIDEL) + || aggDest.isPredefType(PredefinedType.PT_DELEGATE) || IsBaseInterface( + GetPredefindType(PredefinedType.PT_MULTIDEL), aggDest)) + { + return true; + } + + // VARIANCE EXTENSION: + // * From any delegate type S to a delegate type T provided S is not T and + // S is a delegate convertible to T + return pDest.isDelegateType() && HasDelegateConversion(aggSource, aggDest); + } } } - // * From T to a type parameter U, provided T depends on U. - if (pDest.IsTypeParameterType() && pSource.DependsOn(pDest.AsTypeParameterType())) + else if (pSource is ArrayType arrSource) { - return true; + // * From an array type S with an element type SE to an array type T with element type TE + // provided that all of the following are true: + // * S and T differ only in element type. In other words, S and T have the same number of dimensions. + // * Both SE and TE are reference types. + // * An implicit reference conversion exists from SE to TE. + if (pDest is ArrayType arrDest) + { + return HasCovariantArrayConversion(arrSource, arrDest); + } + + if (pDest is AggregateType aggDest) + { + // * From any array type to System.Array or any interface implemented by System.Array. + if (aggDest.isPredefType(PredefinedType.PT_ARRAY) + || IsBaseInterface(GetPredefindType(PredefinedType.PT_ARRAY), aggDest)) + { + return true; + } + + // * From a single-dimensional array type S[] to IList and its base + // interfaces, provided that there is an implicit identity or reference + // conversion from S to T. + return HasArrayConversionToInterface(arrSource, pDest); + } } + else if (pSource is NullType) + { + // * From the null literal to any reference type + // NOTE: We extend the specification here. The C# 3.0 spec does not describe + // a "null type". Rather, it says that the null literal is typeless, and is + // convertible to any reference or nullable type. However, the C# 2.0 and 3.0 + // implementations have a "null type" which some expressions other than the + // null literal may have. (For example, (null??null), which is also an + // extension to the specification.) + return pDest.IsRefType() || pDest is NullableType; + } + return false; } @@ -504,23 +400,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return false; } - if (!pDerived.IsAggregateType()) + if (!(pDerived is AggregateType atsDer)) { return false; } - AggregateType atsDer = pDerived.AsAggregateType(); + + AggregateType atsBase = (AggregateType)pBase; while (atsDer != null) { - TypeArray ifacesAll = atsDer.GetIfacesAll(); - for (int i = 0; i < ifacesAll.Count; i++) + foreach (AggregateType iface in atsDer.GetIfacesAll().Items) { - if (HasInterfaceConversion(ifacesAll[i].AsAggregateType(), pBase.AsAggregateType())) + if (HasInterfaceConversion(iface, atsBase)) { return true; } } + atsDer = atsDer.GetBaseClass(); } + return false; } @@ -585,7 +483,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { continue; } - TypeParameterType pParam = pTypeParams[iParam].AsTypeParameterType(); + TypeParameterType pParam = (TypeParameterType)pTypeParams[iParam]; if (pParam.Invariant) { return false; @@ -608,87 +506,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - - private bool HasImplicitBoxingTypeParameterConversion( - TypeParameterType pSource, CType pDest) - { - Debug.Assert(pSource != null); - Debug.Assert(pDest != null); - - if (pSource.IsRefType()) - { - // Not a boxing conversion; both source and destination are references. - return false; - } - - // The following implicit conversions exist for a given type parameter T: - // - // * From T to its effective base class C. - AggregateType pEBC = pSource.GetEffectiveBaseClass(); - if (pDest == pEBC) - { - return true; - } - // * From T to any base class of C. - if (IsBaseClass(pEBC, pDest)) - { - return true; - } - // * From T to any interface implemented by C. - if (IsBaseInterface(pEBC, pDest)) - { - return true; - } - // * From T to any interface type I in T's effective interface set, and - // from T to any base interface of I. - TypeArray pInterfaces = pSource.GetInterfaceBounds(); - for (int i = 0; i < pInterfaces.Count; ++i) - { - if (pInterfaces[i] == pDest) - { - return true; - } - } - // * The conversion from T to a type parameter U, provided T depends on U, is not - // classified as a boxing conversion because it is not guaranteed to box. - // (If both T and U are value types then it is an identity conversion.) - - return false; - } - - private bool HasImplicitTypeParameterBaseConversion( - TypeParameterType pSource, CType pDest) - { - Debug.Assert(pSource != null); - Debug.Assert(pDest != null); - - if (HasImplicitReferenceTypeParameterConversion(pSource, pDest)) - { - return true; - } - if (HasImplicitBoxingTypeParameterConversion(pSource, pDest)) - { - return true; - } - if (pDest.IsTypeParameterType() && pSource.DependsOn(pDest.AsTypeParameterType())) - { - return true; - } - return false; - } - public bool HasImplicitBoxingConversion(CType pSource, CType pDest) { Debug.Assert(pSource != null); Debug.Assert(pDest != null); - - // Certain type parameter conversions are classified as boxing conversions. - - if (pSource.IsTypeParameterType() && - HasImplicitBoxingTypeParameterConversion(pSource.AsTypeParameterType(), pDest)) - { - return true; - } + Debug.Assert(!(pSource is TypeParameterType)); // The rest of the boxing conversions only operate when going from a value type // to a reference type. @@ -701,9 +523,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // A boxing conversion exists from a nullable type to a reference type // if and only if a boxing conversion exists from the underlying type. - if (pSource.IsNullableType()) + if (pSource is NullableType nubSource) { - return HasImplicitBoxingConversion(pSource.AsNullableType().GetUnderlyingType(), pDest); + return HasImplicitBoxingConversion(nubSource.GetUnderlyingType(), pDest); } // A boxing conversion exists from any non-nullable value type to object, @@ -746,7 +568,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // // This notion is not found in the spec but it is useful in the implementation. - if (pSource.IsAggregateType() && pDest.isPredefType(PredefinedType.PT_OBJECT)) + if (pSource is AggregateType && pDest.isPredefType(PredefinedType.PT_OBJECT)) { // If we are going from any aggregate type (class, struct, interface, enum or delegate) // to object, we immediately return true. This may seem like a mere optimization -- @@ -765,25 +587,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - if (HasIdentityOrImplicitReferenceConversion(pSource, pDest)) - { - return true; - } - if (HasImplicitBoxingConversion(pSource, pDest)) - { - return true; - } - if (pSource.IsTypeParameterType() && - HasImplicitTypeParameterBaseConversion(pSource.AsTypeParameterType(), pDest)) - { - return true; - } - return false; - } - - public bool FCanLift() - { - return null != GetOptPredefAgg(PredefinedType.PT_G_OPTIONAL); + return HasIdentityOrImplicitReferenceConversion(pSource, pDest) || HasImplicitBoxingConversion(pSource, pDest); } public bool IsBaseAggregate(AggregateSymbol derived, AggregateSymbol @base) @@ -802,9 +606,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics while (derived != null) { - for (int i = 0; i < derived.GetIfacesAll().Count; i++) + foreach (AggregateType iface in derived.GetIfacesAll().Items) { - AggregateType iface = derived.GetIfacesAll()[i].AsAggregateType(); if (iface.getAggregate() == @base) return true; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolManagerBase.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolManagerBase.cs index 8c9ee8c446..a414e22e66 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolManagerBase.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolManagerBase.cs @@ -18,7 +18,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public MethodSymbol methNubCtor; private readonly SymFactory _symFactory; - private readonly MiscSymFactory _miscSymFactory; private readonly NamespaceSymbol _rootNS; // The "root" (unnamed) namespace. @@ -35,36 +34,32 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics this.m_nameTable = nameMgr; this.tableGlobal = new SYMTBL(); _symFactory = new SymFactory(this.tableGlobal); - _miscSymFactory = new MiscSymFactory(this.tableGlobal); this.tableTypeArrays = new Dictionary(); _rootNS = _symFactory.CreateNamespace(m_nameTable.Lookup(""), null); GetNsAid(_rootNS); - } - public void Init() - { - /* - tableTypeArrays.Init(&this->GetPageHeap(), this->getAlloc()); - tableNameToSym.Init(this); - nsToExtensionMethods.Init(this); + //////////////////////////////////////////////////////////////////////////////// + // Build the data structures needed to make FPreLoad fast. Make sure the + // namespaces are created. Compute and sort hashes of the NamespaceSymbol * value and type + // name (sans arity indicator). - // Some root symbols. - Name* emptyName = m_nameTable->AddString(L""); - rootNS = symFactory.CreateNamespace(emptyName, NULL); // Root namespace - nsaGlobal = GetNsAid(rootNS, kaidGlobal); - - m_infileUnres.name = emptyName; - m_infileUnres.isSource = false; - m_infileUnres.idLocalAssembly = mdTokenNil; - m_infileUnres.SetAssemblyID(kaidUnresolved, allocGlobal); - - size_t isym; - isym = ssetAssembly.Add(&m_infileUnres); - ASSERT(isym == 0); - */ - - InitPreLoad(); + for (int i = 0; i < (int)PredefinedType.PT_COUNT; ++i) + { + NamespaceSymbol ns = GetRootNS(); + string name = PredefinedTypeFacts.GetName((PredefinedType)i); + int start = 0; + while (start < name.Length) + { + int iDot = name.IndexOf('.', start); + if (iDot == -1) + break; + string sub = (iDot > start) ? name.Substring(start, iDot - start) : name.Substring(start); + Name nm = this.GetNameManager().Add(sub); + ns = LookupGlobalSymCore(nm, ns, symbmask_t.MASK_NamespaceSymbol) as NamespaceSymbol ?? _symFactory.CreateNamespace(nm, ns); + start += sub.Length + 1; + } + } } @@ -116,11 +111,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics LAgain: if (type1.GetTypeKind() != type2.GetTypeKind()) { - if (type1.IsTypeParameterType()) + if (type1 is TypeParameterType) { nParam = BetterType.Right; } - else if (type2.IsTypeParameterType()) + else if (type2 is TypeParameterType) { nParam = BetterType.Left; } @@ -145,7 +140,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics goto LAgain; case TypeKind.TK_AggregateType: - nParam = CompareTypes(type1.AsAggregateType().GetTypeArgsAll(), type2.AsAggregateType().GetTypeArgsAll()); + nParam = CompareTypes(((AggregateType)type1).GetTypeArgsAll(), ((AggregateType)type2).GetTypeArgsAll()); break; } } @@ -171,11 +166,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return _symFactory; } - public MiscSymFactory GetMiscSymFactory() - { - return _miscSymFactory; - } - //////////////////////////////////////////////////////////////////////////////// // Build the data structures needed to make FPreLoad fast. Make sure the // namespaces are created. Compute and sort hashes of the NamespaceSymbol * value and type @@ -194,15 +184,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (iDot == -1) break; string sub = (iDot > start) ? name.Substring(start, iDot - start) : name.Substring(start); Name nm = this.GetNameManager().Add(sub); - NamespaceSymbol sym = this.LookupGlobalSymCore(nm, ns, symbmask_t.MASK_NamespaceSymbol).AsNamespaceSymbol(); - if (sym == null) - { - ns = _symFactory.CreateNamespace(nm, ns); - } - else - { - ns = sym; - } + ns = LookupGlobalSymCore(nm, ns, symbmask_t.MASK_NamespaceSymbol) as NamespaceSymbol ?? _symFactory.CreateNamespace(nm, ns); start += sub.Length + 1; } } @@ -256,12 +238,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Name name = GetNameFromPtrs(0, 0); Debug.Assert(name != null); - AssemblyQualifiedNamespaceSymbol nsa = LookupGlobalSymCore(name, ns, symbmask_t.MASK_AssemblyQualifiedNamespaceSymbol).AsAssemblyQualifiedNamespaceSymbol(); - if (nsa == null) - { + AssemblyQualifiedNamespaceSymbol nsa = LookupGlobalSymCore(name, ns, symbmask_t.MASK_AssemblyQualifiedNamespaceSymbol) as AssemblyQualifiedNamespaceSymbol // Create a new one. - nsa = _symFactory.CreateNamespaceAid(name, ns); - } + ?? _symFactory.CreateNamespaceAid(name, ns); Debug.Assert(nsa.GetNS() == ns); diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolMask.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolMask.cs index 215cfce896..1e9a9302bd 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolMask.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolMask.cs @@ -9,20 +9,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics [Flags] internal enum symbmask_t : long { - MASK_NamespaceSymbol = 1 << (int)SYMKIND.SK_NamespaceSymbol, - MASK_AssemblyQualifiedNamespaceSymbol = 1 << (int)SYMKIND.SK_AssemblyQualifiedNamespaceSymbol, - MASK_AggregateSymbol = 1 << (int)SYMKIND.SK_AggregateSymbol, - MASK_AggregateDeclaration = 1 << (int)SYMKIND.SK_AggregateDeclaration, - MASK_TypeParameterSymbol = 1 << (int)SYMKIND.SK_TypeParameterSymbol, - MASK_FieldSymbol = 1 << (int)SYMKIND.SK_FieldSymbol, - MASK_LocalVariableSymbol = 1 << (int)SYMKIND.SK_LocalVariableSymbol, - MASK_MethodSymbol = 1 << (int)SYMKIND.SK_MethodSymbol, - MASK_PropertySymbol = 1 << (int)SYMKIND.SK_PropertySymbol, - MASK_EventSymbol = 1 << (int)SYMKIND.SK_EventSymbol, - MASK_Scope = 1 << (int)SYMKIND.SK_Scope, - MASK_CachedNameSymbol = 1 << (int)SYMKIND.SK_CachedNameSymbol, - MASK_LambdaScope = 1 << (int)SYMKIND.SK_LambdaScope, + MASK_NamespaceSymbol = 1 << SYMKIND.SK_NamespaceSymbol, + MASK_AssemblyQualifiedNamespaceSymbol = 1 << SYMKIND.SK_AssemblyQualifiedNamespaceSymbol, + MASK_AggregateSymbol = 1 << SYMKIND.SK_AggregateSymbol, + MASK_TypeParameterSymbol = 1 << SYMKIND.SK_TypeParameterSymbol, + MASK_FieldSymbol = 1 << SYMKIND.SK_FieldSymbol, + MASK_MethodSymbol = 1 << SYMKIND.SK_MethodSymbol, + MASK_PropertySymbol = 1 << SYMKIND.SK_PropertySymbol, + MASK_EventSymbol = 1 << SYMKIND.SK_EventSymbol, MASK_ALL = ~0, - LOOKUPMASK = (MASK_AssemblyQualifiedNamespaceSymbol | MASK_FieldSymbol | MASK_LocalVariableSymbol | MASK_MethodSymbol | MASK_PropertySymbol) } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TypeParameterSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TypeParameterSymbol.cs index 6d60cb034f..6ee9888899 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TypeParameterSymbol.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TypeParameterSymbol.cs @@ -9,8 +9,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class TypeParameterSymbol : Symbol { private bool _bIsMethodTypeParameter; - private bool _bHasRefBound; - private bool _bHasValBound; private SpecCons _constraints; private TypeParameterType _pTypeParameterType; @@ -19,10 +17,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private int _nIndexInTotalParameters; private TypeArray _pBounds; - private TypeArray _pInterfaceBounds; - - private AggregateType _pEffectiveBaseClass; - private CType _pDeducedBaseClass; // This may be a NullableType or an ArrayType etc, for error reporting. public bool Covariant; public bool Invariant { get { return !Covariant && !Contravariant; } } @@ -69,19 +63,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _nIndexInTotalParameters = index; } - public TypeArray GetInterfaceBounds() - { - return _pInterfaceBounds; - } - public void SetBounds(TypeArray pBounds) { _pBounds = pBounds; - _pInterfaceBounds = null; - _pEffectiveBaseClass = null; - _pDeducedBaseClass = null; - _bHasRefBound = false; - _bHasValBound = false; } public TypeArray GetBounds() @@ -94,24 +78,19 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _constraints = constraints; } - public AggregateType GetEffectiveBaseClass() - { - return _pEffectiveBaseClass; - } - public bool IsValueType() { - return (_constraints & SpecCons.Val) > 0 || _bHasValBound; + return (_constraints & SpecCons.Val) > 0; } public bool IsReferenceType() { - return (_constraints & SpecCons.Ref) > 0 || _bHasRefBound; + return (_constraints & SpecCons.Ref) > 0; } public bool IsNonNullableValueType() { - return (_constraints & SpecCons.Val) > 0 || _bHasValBound && !_pDeducedBaseClass.IsNullableType(); + return (_constraints & SpecCons.Val) > 0; } public bool HasNewConstraint() diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/UnresolvedAggregateSymbol.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/UnresolvedAggregateSymbol.cs deleted file mode 100644 index e64f0334a2..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/UnresolvedAggregateSymbol.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - // ---------------------------------------------------------------------------- - // - // UnresolvedAggregateSymbol - // - // A fabricated AggregateSymbol to represent an imported type that we couldn't resolve. - // Used for error reporting. - // In the EE this is used as a place holder until the real AggregateSymbol is created. - // - // ---------------------------------------------------------------------------- - - internal sealed class UnresolvedAggregateSymbol : AggregateSymbol - { - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs index adb9efb030..19a478120e 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs @@ -11,6 +11,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Array = array; Index = index; + Flags = EXPRFLAG.EXF_LVALUE | EXPRFLAG.EXF_ASSGOP; } public Expr Array { get; set; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs index 5294ff0189..b7c39acc8f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs @@ -6,6 +6,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprAssignment : Expr { + private Expr _lhs; + public ExprAssignment(Expr lhs, Expr rhs) : base(ExpressionKind.Assignment) { @@ -14,10 +16,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Flags = EXPRFLAG.EXF_ASSGOP; } - public Expr LHS { get; set; } + public Expr LHS + { + get => _lhs; + set => Type = (_lhs = value).Type; + } public Expr RHS { get; set; } - - public override CType Type => LHS.Type; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs index fe02b8ff3d..a2180521ba 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs @@ -12,7 +12,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics : base(ExpressionKind.Call, type) { Debug.Assert( - (flags & ~(EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CONSTRAINED | EXPRFLAG.EXF_BASECALL + (flags & ~(EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CONSTRAINED | EXPRFLAG.EXF_NEWSTRUCTASSG | EXPRFLAG.EXF_IMPLICITSTRUCTASSG | EXPRFLAG.EXF_MASK_ANY)) == 0); Flags = flags; OptionalArguments = arguments; @@ -33,7 +33,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public MethWithInst MethWithInst { get; set; } - public PREDEFMETH PredefinedMethod { get; set; } + public PREDEFMETH PredefinedMethod { get; set; } = PREDEFMETH.PM_COUNT; public NullableCallLiftKind NullableCallLiftKind { get; set; } @@ -42,11 +42,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Expr CastOfNonLiftedResultToLiftedType { get; set; } SymWithType IExprWithArgs.GetSymWithType() => MethWithInst; - - public override void SetMismatchedStaticBit() - { - MemberGroup?.SetMismatchedStaticBit(); - base.SetMismatchedStaticBit(); - } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs index e76a520fbb..915ad374fc 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs @@ -8,6 +8,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprCast : Expr { + private ExprClass _destinationType; + public ExprCast(EXPRFLAG flags, ExprClass destinationType, Expr argument) : base(ExpressionKind.Cast) { @@ -21,9 +23,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Expr Argument { get; set; } - public ExprClass DestinationType { get; set; } - - public override CType Type => DestinationType.Type; + public ExprClass DestinationType + { + get => _destinationType; + set => Type = (_destinationType = value).Type; + } public bool IsBoxingCast => (Flags & (EXPRFLAG.EXF_BOX | EXPRFLAG.EXF_FORCE_BOX)) != 0; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs index 04e233b4eb..3d15312d9a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs @@ -21,14 +21,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public bool IsOptionalArgument { get; set; } - public virtual void SetMismatchedStaticBit() - { - HasError = true; - } - public string ErrorString { get; set; } - public virtual CType Type => null; + public CType Type { get; protected set; } public bool IsOK => !HasError; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs deleted file mode 100644 index 912cf21011..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - internal sealed class ExprEvent : ExprWithType, IExprWithObject - { - public ExprEvent(CType type, Expr obj, EventWithType ev) - : base(ExpressionKind.Event, type) - { - OptionalObject = obj; - EventWithType = ev; - } - - public Expr OptionalObject { get; set; } - - public EventWithType EventWithType { get; } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs index 554386c724..f9ac7c1719 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExprWithType.cs @@ -11,7 +11,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Type = type; } - - public override CType Type { get; } } } \ No newline at end of file diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs index f5c9970c7c..05bc26d64f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs @@ -13,10 +13,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Flags = EXPRFLAG.EXF_LVALUE; Local = local; + Type = local?.GetType(); } public LocalVariableSymbol Local { get; } - - public override CType Type => Local?.GetType(); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs index 1d76966e16..cc5980acdf 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs @@ -14,7 +14,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert( (flags & ~(EXPRFLAG.EXF_CTOR | EXPRFLAG.EXF_INDEXER | EXPRFLAG.EXF_OPERATOR | EXPRFLAG.EXF_NEWOBJCALL - | EXPRFLAG.EXF_BASECALL | EXPRFLAG.EXF_DELEGATE | EXPRFLAG.EXF_USERCALLABLE + | EXPRFLAG.EXF_DELEGATE | EXPRFLAG.EXF_USERCALLABLE | EXPRFLAG.EXF_MASK_ANY)) == 0); Flags = flags; Name = name; @@ -52,7 +52,5 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public CType ParentType { get; } public bool IsDelegate => (Flags & EXPRFLAG.EXF_DELEGATE) != 0; - - public void SetInaccessibleBit() => SetError(); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs deleted file mode 100644 index a457df2491..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - internal sealed class ExprFuncPtr : ExprWithType, IExprWithObject - { - public ExprFuncPtr(CType type, EXPRFLAG flags, Expr optionalObject, MethWithInst method) - : base(ExpressionKind.FunctionPointer, type) - { - Debug.Assert((flags & ~EXPRFLAG.EXF_BASECALL) == 0); - Flags = flags; - OptionalObject = optionalObject; - MethWithInst = new MethWithInst(method); - } - - public MethWithInst MethWithInst { get; } - - public Expr OptionalObject { get; set; } - } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs index 98ff7c92bd..bf9b399fe4 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs @@ -8,6 +8,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprNamedArgumentSpecification : Expr { + private Expr _value; + public ExprNamedArgumentSpecification(Name name, Expr value) : base(ExpressionKind.NamedArgumentSpecification) { @@ -17,8 +19,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Name Name { get; } - public Expr Value { get; set; } - - public override CType Type => Value.Type; + public Expr Value + { + get => _value; + set => Type = (_value = value).Type; + } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs index 5172c53597..6654cca006 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs @@ -48,8 +48,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public MethWithType MethWithTypeSet { get; } - public bool IsBaseCall => 0 != (Flags & EXPRFLAG.EXF_BASECALL); - SymWithType IExprWithArgs.GetSymWithType() => PropWithTypeSlot; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs index 7ea9df6b1e..47ba4c38bb 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs @@ -10,11 +10,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics : base(ExpressionKind.Wrap) { OptionalExpression = expression; + Type = expression?.Type; Flags = EXPRFLAG.EXF_LVALUE; } public Expr OptionalExpression { get; } - - public override CType Type => OptionalExpression?.Type; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs index 8439864c70..a5c72a1b5b 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs @@ -8,6 +8,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprUserDefinedConversion : Expr { + private Expr _userDefinedCall; + public ExprUserDefinedConversion(Expr argument, Expr call, MethWithInst method) : base(ExpressionKind.UserDefinedConversion) { @@ -24,9 +26,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Expr Argument { get; set; } - public Expr UserDefinedCall { get; set; } - - public override CType Type => UserDefinedCall.Type; + public Expr UserDefinedCall + { + get => _userDefinedCall; + set => Type = (_userDefinedCall = value).Type; + } public MethWithInst UserDefinedCallMethod { get; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs index 2abac4cecc..19642eccc4 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs @@ -114,8 +114,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return VisitARRAYINDEX(pExpr as ExprArrayIndex); case ExpressionKind.Call: return VisitCALL(pExpr as ExprCall); - case ExpressionKind.Event: - return VisitEVENT(pExpr as ExprEvent); case ExpressionKind.Field: return VisitFIELD(pExpr as ExprField); case ExpressionKind.Local: @@ -124,8 +122,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return VisitCONSTANT(pExpr as ExprConstant); case ExpressionKind.Class: return VisitCLASS(pExpr as ExprClass); - case ExpressionKind.FunctionPointer: - return VisitFUNCPTR(pExpr as ExprFuncPtr); case ExpressionKind.Property: return VisitPROP(pExpr as ExprProperty); case ExpressionKind.Multi: @@ -352,12 +348,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics break; case ExpressionKind.ZeroInit: - exprRet = Visit((pExpr as ExprZeroInit).OptionalArgument); - (pExpr as ExprZeroInit).OptionalArgument = exprRet; - - // Used for when we zeroinit 0 parameter constructors for structs/enums. - exprRet = Visit((pExpr as ExprZeroInit).OptionalConstructorCall); - (pExpr as ExprZeroInit).OptionalConstructorCall = exprRet; break; case ExpressionKind.Block: @@ -393,11 +383,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics (pExpr as ExprField).OptionalObject = exprRet; break; - case ExpressionKind.Event: - exprRet = Visit((pExpr as ExprEvent).OptionalObject); - (pExpr as ExprEvent).OptionalObject = exprRet; - break; - case ExpressionKind.Return: exprRet = Visit((pExpr as ExprReturn).OptionalObject); (pExpr as ExprReturn).OptionalObject = exprRet; @@ -470,7 +455,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case ExpressionKind.Local: case ExpressionKind.Class: - case ExpressionKind.FunctionPointer: case ExpressionKind.MultiGet: case ExpressionKind.Wrap: case ExpressionKind.NoOp: @@ -568,10 +552,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return VisitEXPR(pExpr); } - protected virtual Expr VisitEVENT(ExprEvent pExpr) - { - return VisitEXPR(pExpr); - } protected virtual Expr VisitLOCAL(ExprLocal pExpr) { return VisitEXPR(pExpr); @@ -580,10 +560,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { return VisitEXPR(pExpr); } - protected virtual Expr VisitFUNCPTR(ExprFuncPtr pExpr) - { - return VisitEXPR(pExpr); - } protected virtual Expr VisitMULTIGET(ExprMultiGet pExpr) { return VisitEXPR(pExpr); diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs index 96075b6d38..fff8ed3c4d 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs @@ -104,7 +104,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics CType delegateType = anonmeth.DelegateType; TypeArray lambdaTypeParams = GetSymbolLoader().getBSymmgr().AllocParams(1, new CType[] { delegateType }); - AggregateType expressionType = GetSymbolLoader().GetOptPredefTypeErr(PredefinedType.PT_EXPRESSION); + AggregateType expressionType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_EXPRESSION); MethWithInst mwi = new MethWithInst(lambdaMethod, expressionType, lambdaTypeParams); Expr createParameters = CreateWraps(anonmeth); Expr body = RewriteLambdaBody(anonmeth); @@ -215,7 +215,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Expr p1 = Visit(expr.FirstArgument); Expr p2 = Visit(expr.SecondArgument); MethodSymbol method = GetPreDefMethod(pdm); - Expr methodInfo = GetExprFactory().CreateMethodInfo(method, GetSymbolLoader().GetReqPredefType(PredefinedType.PT_STRING), null); + Expr methodInfo = GetExprFactory().CreateMethodInfo(method, GetSymbolLoader().GetPredefindType(PredefinedType.PT_STRING), null); return GenerateCall(PREDEFMETH.PM_EXPRESSION_ADD_USER_DEFINED, p1, p2, methodInfo); } protected override Expr VisitBINOP(ExprBinOp expr) @@ -344,7 +344,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(expr != null); // POSSIBLE ERROR: Multi-d should be an error? - Expr pTypeOf = CreateTypeOf(expr.Type.AsArrayType().GetElementType()); + Expr pTypeOf = CreateTypeOf(((ArrayType)expr.Type).GetElementType()); Expr args = GenerateArgsList(expr.OptionalArguments); Expr Params = GenerateParamsArray(args, PredefinedType.PT_EXPRESSION); return GenerateCall(PREDEFMETH.PM_EXPRESSION_NEWARRAYINIT, pTypeOf, Params); @@ -352,14 +352,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics protected override Expr VisitZEROINIT(ExprZeroInit expr) { Debug.Assert(expr != null); - Debug.Assert(expr.OptionalArgument == null); - - if (expr.IsConstructor) - { - // We have a parameterless "new MyStruct()" which has been realized as a zero init. - ExprTypeOf pTypeOf = CreateTypeOf(expr.Type); - return GenerateCall(PREDEFMETH.PM_EXPRESSION_NEW_TYPE, pTypeOf); - } return GenerateConstant(expr); } protected override Expr VisitTYPEOF(ExprTypeOf expr) @@ -440,10 +432,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics typeL = convertL; didEnumConversion = true; } - else if (typeL.IsNullableType() && typeL.StripNubs().isEnumType()) + else if (typeL is NullableType nubL && nubL.UnderlyingType.isEnumType()) { Debug.Assert(expr.IsLifted); - convertL = GetSymbolLoader().GetTypeManager().GetNullable(typeL.StripNubs().underlyingEnumType()); + convertL = GetSymbolLoader().GetTypeManager().GetNullable(nubL.UnderlyingType.underlyingEnumType()); typeL = convertL; didEnumConversion = true; } @@ -454,18 +446,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics typeR = convertR; didEnumConversion = true; } - else if (typeR.IsNullableType() && typeR.StripNubs().isEnumType()) + else if (typeR is NullableType nubR && nubR.UnderlyingType.isEnumType()) { Debug.Assert(expr.IsLifted); - convertR = GetSymbolLoader().GetTypeManager().GetNullable(typeR.StripNubs().underlyingEnumType()); + convertR = GetSymbolLoader().GetTypeManager().GetNullable(nubR.UnderlyingType.underlyingEnumType()); typeR = convertR; didEnumConversion = true; } - if (typeL.IsNullableType() && typeL.StripNubs() == typeR) + if (typeL is NullableType nubL2 && nubL2.UnderlyingType == typeR) { convertR = typeL; } - if (typeR.IsNullableType() && typeR.StripNubs() == typeL) + if (typeR is NullableType nubR2 && nubR2.UnderlyingType == typeL) { convertL = typeR; } @@ -513,15 +505,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Expr GenerateBuiltInUnaryOperator(PREDEFMETH pdm, Expr pOriginalOperator, Expr pOperator) { Expr op = Visit(pOriginalOperator); - if (pOriginalOperator.Type.IsNullableType() && pOriginalOperator.Type.StripNubs().isEnumType()) + bool isNullableEnum = pOriginalOperator.Type is NullableType nub && nub.underlyingType().isEnumType(); + if (isNullableEnum) { Debug.Assert(pOperator.Kind == ExpressionKind.BitwiseNot); // The only built-in unary operator defined on nullable enum. CType underlyingType = pOriginalOperator.Type.StripNubs().underlyingEnumType(); CType nullableType = GetSymbolLoader().GetTypeManager().GetNullable(underlyingType); op = GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, op, CreateTypeOf(nullableType)); } + Expr call = GenerateCall(pdm, op); - if (pOriginalOperator.Type.IsNullableType() && pOriginalOperator.Type.StripNubs().isEnumType()) + if (isNullableEnum) { call = GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, call, CreateTypeOf(pOperator.Type)); } @@ -730,11 +724,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (Symbol sym = anonmeth.ArgumentScope; sym != null; sym = sym.nextChild) { - if (!sym.IsLocalVariableSymbol()) + if (!(sym is LocalVariableSymbol local)) { continue; } - LocalVariableSymbol local = sym.AsLocalVariableSymbol(); + if (local.isThis) { continue; @@ -863,7 +857,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Expr GenerateParameter(string name, CType CType) { - GetSymbolLoader().GetReqPredefType(PredefinedType.PT_STRING); // force an ensure state + GetSymbolLoader().GetPredefindType(PredefinedType.PT_STRING); // force an ensure state ExprConstant nameString = GetExprFactory().CreateStringConstant(name); ExprTypeOf pTypeOf = CreateTypeOf(CType); return GenerateCall(PREDEFMETH.PM_EXPRESSION_PARAMETER, pTypeOf, nameString); @@ -884,11 +878,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Expr sequence = null; for (Symbol sym = anonmeth.ArgumentScope.firstChild; sym != null; sym = sym.nextChild) { - if (!sym.IsLocalVariableSymbol()) + if (!(sym is LocalVariableSymbol local)) { continue; } - LocalVariableSymbol local = sym.AsLocalVariableSymbol(); + if (local.isThis) { continue; @@ -914,11 +908,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { for (Symbol sym = anonmeth.ArgumentScope; sym != null; sym = sym.nextChild) { - if (!sym.IsLocalVariableSymbol()) + if (!(sym is LocalVariableSymbol local)) { continue; } - LocalVariableSymbol local = sym.AsLocalVariableSymbol(); + if (local.isThis) { continue; @@ -935,64 +929,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { Debug.Assert(expr != null); Debug.Assert(expr.MethWithInst.Meth().IsConstructor()); - - // Realize a call to new DELEGATE(obj, FUNCPTR) as though it actually was - // (DELEGATE)CreateDelegate(typeof(DELEGATE), obj, GetMethInfoFromHandle(FUNCPTR)) - - if (IsDelegateConstructorCall(expr)) - { - return GenerateDelegateConstructor(expr); - } Expr constructorInfo = GetExprFactory().CreateMethodInfo(expr.MethWithInst); Expr args = GenerateArgsList(expr.OptionalArguments); Expr Params = GenerateParamsArray(args, PredefinedType.PT_EXPRESSION); return GenerateCall(PREDEFMETH.PM_EXPRESSION_NEW, constructorInfo, Params); } - private Expr GenerateDelegateConstructor(ExprCall expr) - { - // In: - // - // new DELEGATE(obj, &FUNC) - // - // Out: - // - // Cast( - // Call( - // null, - // (MethodInfo)GetMethodFromHandle(&CreateDelegate), - // new Expression[3]{ - // Constant(typeof(DELEGATE)), - // transformed-object, - // Constant((MethodInfo)GetMethodFromHandle(&FUNC)}), - // typeof(DELEGATE)) - // - - Debug.Assert(expr != null); - Debug.Assert(expr.MethWithInst.Meth().IsConstructor()); - Debug.Assert(expr.Type.isDelegateType()); - - ExprList origArgs = (ExprList)expr.OptionalArguments; - Debug.Assert(origArgs != null); - Expr target = origArgs.OptionalElement; - Debug.Assert(origArgs.OptionalNextListNode.Kind == ExpressionKind.FunctionPointer); - ExprFuncPtr funcptr = (ExprFuncPtr)origArgs.OptionalNextListNode; - Debug.Assert(funcptr != null); - MethodSymbol createDelegateMethod = GetPreDefMethod(PREDEFMETH.PM_METHODINFO_CREATEDELEGATE_TYPE_OBJECT); - AggregateType delegateType = GetSymbolLoader().GetOptPredefTypeErr(PredefinedType.PT_DELEGATE); - MethWithInst mwi = new MethWithInst(createDelegateMethod, delegateType); - - Expr instance = GenerateConstant(GetExprFactory().CreateMethodInfo(funcptr.MethWithInst)); - Expr methinfo = GetExprFactory().CreateMethodInfo(mwi); - Expr param1 = GenerateConstant(CreateTypeOf(expr.Type)); - Expr param2 = Visit(target); - Expr paramsList = GetExprFactory().CreateList(param1, param2); - Expr Params = GenerateParamsArray(paramsList, PredefinedType.PT_EXPRESSION); - Expr call = GenerateCall(PREDEFMETH.PM_EXPRESSION_CALL, instance, methinfo, Params); - Expr pTypeOf = CreateTypeOf(expr.Type); - return GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, call, pTypeOf); - } - private Expr GenerateArgsList(Expr oldArgs) { Expr newArgs = null; @@ -1007,7 +949,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Expr GenerateIndexList(Expr oldIndices) { - CType intType = symbolLoader.GetReqPredefType(PredefinedType.PT_INT); + CType intType = symbolLoader.GetPredefindType(PredefinedType.PT_INT); Expr newIndices = null; Expr newIndicesTail = newIndices; @@ -1030,15 +972,15 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { EXPRFLAG flags = 0; - AggregateType pObject = GetSymbolLoader().GetReqPredefType(PredefinedType.PT_OBJECT); + AggregateType pObject = GetSymbolLoader().GetPredefindType(PredefinedType.PT_OBJECT); - if (expr.Type.IsNullType()) + if (expr.Type is NullType) { ExprTypeOf pTypeOf = CreateTypeOf(pObject); return GenerateCall(PREDEFMETH.PM_EXPRESSION_CONSTANT_OBJECT_TYPE, expr, pTypeOf); } - AggregateType stringType = GetSymbolLoader().GetReqPredefType(PredefinedType.PT_STRING); + AggregateType stringType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_STRING); if (expr.Type != stringType) { flags = EXPRFLAG.EXF_BOX; @@ -1058,7 +1000,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // be handling this error if (method == null) return null; - AggregateType expressionType = GetSymbolLoader().GetOptPredefTypeErr(PredefinedType.PT_EXPRESSION); + AggregateType expressionType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_EXPRESSION); MethWithInst mwi = new MethWithInst(method, expressionType); ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(null, mwi); ExprCall call = GetExprFactory().CreateCall(0, mwi.Meth().RetType, arg1, pMemGroup, mwi); @@ -1071,7 +1013,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MethodSymbol method = GetPreDefMethod(pdm); if (method == null) return null; - AggregateType expressionType = GetSymbolLoader().GetOptPredefTypeErr(PredefinedType.PT_EXPRESSION); + AggregateType expressionType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_EXPRESSION); Expr args = GetExprFactory().CreateList(arg1, arg2); MethWithInst mwi = new MethWithInst(method, expressionType); ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(null, mwi); @@ -1085,7 +1027,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MethodSymbol method = GetPreDefMethod(pdm); if (method == null) return null; - AggregateType expressionType = GetSymbolLoader().GetOptPredefTypeErr(PredefinedType.PT_EXPRESSION); + AggregateType expressionType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_EXPRESSION); Expr args = GetExprFactory().CreateList(arg1, arg2, arg3); MethWithInst mwi = new MethWithInst(method, expressionType); ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(null, mwi); @@ -1099,7 +1041,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics MethodSymbol method = GetPreDefMethod(pdm); if (method == null) return null; - AggregateType expressionType = GetSymbolLoader().GetOptPredefTypeErr(PredefinedType.PT_EXPRESSION); + AggregateType expressionType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_EXPRESSION); Expr args = GetExprFactory().CreateList(arg1, arg2, arg3, arg4); MethWithInst mwi = new MethWithInst(method, expressionType); ExprMemberGroup pMemGroup = GetExprFactory().CreateMemGroup(null, mwi); @@ -1111,7 +1053,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private ExprArrayInit GenerateParamsArray(Expr args, PredefinedType pt) { int parameterCount = ExpressionIterator.Count(args); - AggregateType paramsArrayElementType = GetSymbolLoader().GetOptPredefTypeErr(pt); + AggregateType paramsArrayElementType = GetSymbolLoader().GetPredefindType(pt); ArrayType paramsArrayType = GetSymbolLoader().GetTypeManager().GetArray(paramsArrayElementType, 1, true); ExprConstant paramsArrayArg = GetExprFactory().CreateIntegerConstant(parameterCount); return GetExprFactory().CreateArrayInit(paramsArrayType, args, paramsArrayArg, new int[] { parameterCount }, parameterCount); @@ -1137,23 +1079,24 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics CType aatype1 = orig1.Type; CType aatype2 = orig2.Type; // Is the operator even a candidate for lifting? - if (fptype1.IsNullableType() || fptype2.IsNullableType() || - !fptype1.IsAggregateType() || !fptype2.IsAggregateType() || - !fptype1.AsAggregateType().getAggregate().IsValueType() || - !fptype2.AsAggregateType().getAggregate().IsValueType()) + if (!(fptype1 is AggregateType fat1) + || !fat1.getAggregate().IsValueType() + || !(fptype2 is AggregateType fat2) + || !fat2.getAggregate().IsValueType()) { return; } + CType nubfptype1 = GetSymbolLoader().GetTypeManager().GetNullable(fptype1); CType nubfptype2 = GetSymbolLoader().GetTypeManager().GetNullable(fptype2); // If we have null op X, or T1 op T2?, or T1 op null, lift first arg to T1? - if (aatype1.IsNullType() || aatype1 == fptype1 && (aatype2 == nubfptype2 || aatype2.IsNullType())) + if (aatype1 is NullType || aatype1 == fptype1 && (aatype2 == nubfptype2 || aatype2 is NullType)) { new1 = GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, new1, CreateTypeOf(nubfptype1)); } // If we have X op null, or T1? op T2, or null op T2, lift second arg to T2? - if (aatype2.IsNullType() || aatype2 == fptype2 && (aatype1 == nubfptype1 || aatype1.IsNullType())) + if (aatype2 is NullType || aatype2 == fptype2 && (aatype1 == nubfptype1 || aatype1 is NullType)) { new2 = GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, new2, CreateTypeOf(nubfptype2)); } @@ -1161,42 +1104,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics pp2 = new2; } - private bool IsNullableValueType(CType pType) - { - if (pType.IsNullableType()) - { - CType pStrippedType = pType.StripNubs(); - return pStrippedType.IsAggregateType() && pStrippedType.AsAggregateType().getAggregate().IsValueType(); - } - return false; - } + private bool IsNullableValueType(CType pType) => + pType is NullableType && pType.StripNubs() is AggregateType agg && agg.getAggregate().IsValueType(); private bool IsNullableValueAccess(Expr pExpr, Expr pObject) { Debug.Assert(pExpr != null); - return pExpr is ExprProperty prop && prop.MemberGroup.OptionalObject == pObject && pObject.Type.IsNullableType(); + return pExpr is ExprProperty prop && prop.MemberGroup.OptionalObject == pObject && pObject.Type is NullableType; } - private bool IsDelegateConstructorCall(Expr pExpr) - { - Debug.Assert(pExpr != null); - if (!(pExpr is ExprCall pCall)) - { - return false; - } - - return pCall.MethWithInst.Meth() != null && - pCall.MethWithInst.Meth().IsConstructor() && - pCall.Type.isDelegateType() && - pCall.OptionalArguments != null && - pCall.OptionalArguments is ExprList list && - list.OptionalNextListNode.Kind == ExpressionKind.FunctionPointer; - } - private static bool isEnumToDecimalConversion(CType argtype, CType desttype) - { - CType strippedArgType = argtype.IsNullableType() ? argtype.StripNubs() : argtype; - CType strippedDestType = desttype.IsNullableType() ? desttype.StripNubs() : desttype; - return strippedArgType.isEnumType() && strippedDestType.isPredefType(PredefinedType.PT_DECIMAL); - } + private static bool isEnumToDecimalConversion(CType argtype, CType desttype) => + argtype.StripNubs().isEnumType() && desttype.StripNubs().isPredefType(PredefinedType.PT_DECIMAL); } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs index 8593c111a2..66051b6ce2 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs @@ -6,21 +6,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal sealed class ExprZeroInit : ExprWithType { - public ExprZeroInit(CType type, Expr originalConstructorCall, bool isConstructor, bool isError) + public ExprZeroInit(CType type) : base(ExpressionKind.ZeroInit, type) { - OptionalConstructorCall = originalConstructorCall; - IsConstructor = isConstructor; - if (isError) - { - SetError(); - } } - - public Expr OptionalArgument { get; set; } - - public Expr OptionalConstructorCall { get; set; } - - public bool IsConstructor { get; } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/TypeBind.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/TypeBind.cs index b0e2e331bb..7b75b91031 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/TypeBind.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/TypeBind.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Diagnostics; using Microsoft.CSharp.RuntimeBinder.Errors; using Microsoft.CSharp.RuntimeBinder.Syntax; @@ -12,7 +13,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Defines the structure used when binding types // CheckConstraints options. - + [Flags] internal enum CheckConstraintsFlags { None = 0x00, @@ -36,20 +37,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { type = type.GetNakedType(false); - if (type.IsNullableType()) + if (type is NullableType nub) { - CType typeT = type.AsNullableType().GetAts(checker.GetErrorContext()); - if (typeT != null) - type = typeT; - else - type = type.GetNakedType(true); + type = nub.GetAts(); } - if (!type.IsAggregateType()) + if (!(type is AggregateType ats)) return true; - AggregateType ats = type.AsAggregateType(); - if (ats.GetTypeArgsAll().Count == 0) { // Common case: there are no type vars, so there are no constraints. @@ -95,10 +90,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int i = 0; i < typeArgsThis.Count; i++) { CType arg = typeArgsThis[i].GetNakedType(true); - if (arg.IsAggregateType() && !arg.AsAggregateType().fConstraintsChecked) + if (arg is AggregateType atArg && !atArg.fConstraintsChecked) { - CheckConstraints(checker, errHandling, arg.AsAggregateType(), flags | CheckConstraintsFlags.Outer); - if (arg.AsAggregateType().fConstraintError) + CheckConstraints(checker, errHandling, atArg, flags | CheckConstraintsFlags.Outer); + if (atArg.fConstraintError) ats.fConstraintError = true; } } @@ -134,7 +129,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int i = 0; i < typeVars.Count; i++) { // Empty bounds should be set to object. - TypeParameterType var = typeVars.ItemAsTypeParameterType(i); + TypeParameterType var = (TypeParameterType)typeVars[i]; CType arg = typeArgs[i]; bool fOK = CheckSingleConstraint(checker, errHandling, symErr, var, arg, typeArgsCls, typeArgsMeth, flags); @@ -146,61 +141,29 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private static bool CheckSingleConstraint(CSemanticChecker checker, ErrorHandling errHandling, Symbol symErr, TypeParameterType var, CType arg, TypeArray typeArgsCls, TypeArray typeArgsMeth, CheckConstraintsFlags flags) { + Debug.Assert(!(arg is PointerType)); + Debug.Assert(!arg.isStaticClass()); + bool fReportErrors = 0 == (flags & CheckConstraintsFlags.NoErrors); - if (arg.IsOpenTypePlaceholderType()) - { - return true; - } - - if (arg.IsErrorType()) + if (arg is ErrorType) { // Error should have been reported previously. return false; } - if (checker.CheckBogus(arg)) - { - if (fReportErrors) - { - errHandling.ErrorRef(ErrorCode.ERR_BogusType, arg); - } - - return false; - } - - if (arg.IsPointerType()) - { - if (fReportErrors) - { - errHandling.Error(ErrorCode.ERR_BadTypeArgument, arg); - } - - return false; - } - - if (arg.isStaticClass()) - { - if (fReportErrors) - { - checker.ReportStaticClassError(null, arg, ErrorCode.ERR_GenericArgIsStaticClass); - } - - return false; - } - bool fError = false; if (var.HasRefConstraint() && !arg.IsRefType()) { if (fReportErrors) { - errHandling.ErrorRef(ErrorCode.ERR_RefConstraintNotSatisfied, symErr, new ErrArgNoRef(var), arg); + throw errHandling.Error(ErrorCode.ERR_RefConstraintNotSatisfied, symErr, new ErrArgNoRef(var), arg); } fError = true; } - TypeArray bnds = checker.GetSymbolLoader().GetTypeManager().SubstTypeArray(var.GetBounds(), typeArgsCls, typeArgsMeth); + TypeArray bnds = checker.SymbolLoader.GetTypeManager().SubstTypeArray(var.GetBounds(), typeArgsCls, typeArgsMeth); int itypeMin = 0; if (var.HasValConstraint()) @@ -213,22 +176,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // To check whether or not its a nullable type, we need to get the resolved // bound from the type argument and check against that. - bool bIsValueType = arg.IsValType(); - bool bIsNullable = arg.IsNullableType(); - if (bIsValueType && arg.IsTypeParameterType()) - { - TypeArray pArgBnds = arg.AsTypeParameterType().GetBounds(); - if (pArgBnds.Count > 0) - { - bIsNullable = pArgBnds[0].IsNullableType(); - } - } - - if (!bIsValueType || bIsNullable) + if (!arg.IsValType() || arg is NullableType) { if (fReportErrors) { - errHandling.ErrorRef(ErrorCode.ERR_ValConstraintNotSatisfied, symErr, new ErrArgNoRef(var), arg); + throw errHandling.Error(ErrorCode.ERR_ValConstraintNotSatisfied, symErr, new ErrArgNoRef(var), arg); } fError = true; @@ -265,11 +217,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // to which they have an implicit reference conversion error = ErrorCode.ERR_GenericConstraintNotSatisfiedRefType; } - else if (arg.IsNullableType() && checker.GetSymbolLoader().HasBaseConversion(arg.AsNullableType().GetUnderlyingType(), typeBnd)) // This is inlining FBoxingConv + else if (arg is NullableType nubArg && checker.SymbolLoader.HasBaseConversion(nubArg.GetUnderlyingType(), typeBnd)) // This is inlining FBoxingConv { // nullable types do not satisfy bounds to every type that they are boxable to // They only satisfy bounds of object and ValueType - if (typeBnd.isPredefType(PredefinedType.PT_ENUM) || arg.AsNullableType().GetUnderlyingType() == typeBnd) + if (typeBnd.isPredefType(PredefinedType.PT_ENUM) || nubArg.GetUnderlyingType() == typeBnd) { // Nullable types don't satisfy bounds of EnumType, or the underlying type of the enum // even though the conversion from Nullable to these types is a boxing conversion @@ -289,20 +241,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics error = ErrorCode.ERR_GenericConstraintNotSatisfiedNullableInterface; } } - else if (arg.IsTypeParameterType()) - { - // Type variables can satisfy bounds through boxing and type variable conversions - Debug.Assert(!arg.IsRefType()); - error = ErrorCode.ERR_GenericConstraintNotSatisfiedTyVar; - } else { // Value types can only satisfy bounds through boxing conversions. // Note that the exceptional case of Nullable types and boxing is handled above. error = ErrorCode.ERR_GenericConstraintNotSatisfiedValType; } - errHandling.Error(error, new ErrArgRef(symErr), new ErrArg(typeBnd, ErrArgFlags.Unique), var, new ErrArgRef(arg, ErrArgFlags.Unique)); + + throw errHandling.Error(error, new ErrArg(symErr), new ErrArg(typeBnd, ErrArgFlags.Unique), var, new ErrArg(arg, ErrArgFlags.Unique)); } + fError = true; } } @@ -315,27 +263,23 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (arg.isClassType()) { - AggregateSymbol agg = arg.AsAggregateType().getAggregate(); + AggregateSymbol agg = ((AggregateType)arg).getAggregate(); // Due to late binding nature of IDE created symbols, the AggregateSymbol might not // have all the information necessary yet, if it is not fully bound. // by calling LookupAggMember, it will ensure that we will update all the // information necessary at least for the given method. - checker.GetSymbolLoader().LookupAggMember(NameManager.GetPredefinedName(PredefinedName.PN_CTOR), agg, symbmask_t.MASK_ALL); + checker.SymbolLoader.LookupAggMember(NameManager.GetPredefinedName(PredefinedName.PN_CTOR), agg, symbmask_t.MASK_ALL); if (agg.HasPubNoArgCtor() && !agg.IsAbstract()) { return !fError; } } - else if (arg.IsTypeParameterType() && arg.AsTypeParameterType().HasNewConstraint()) - { - return !fError; - } if (fReportErrors) { - errHandling.ErrorRef(ErrorCode.ERR_NewConstraintNotSatisfied, symErr, new ErrArgNoRef(var), arg); + throw errHandling.Error(ErrorCode.ERR_NewConstraintNotSatisfied, symErr, new ErrArgNoRef(var), arg); } return false; @@ -367,16 +311,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics break; case TypeKind.TK_NullableType: - typeBnd = typeBnd.AsNullableType().GetAts(checker.GetErrorContext()); - if (null == typeBnd) - return true; + typeBnd = ((NullableType)typeBnd).GetAts(); break; case TypeKind.TK_AggregateType: break; } - Debug.Assert(typeBnd.IsAggregateType() || typeBnd.IsTypeParameterType() || typeBnd.IsArrayType()); + Debug.Assert(typeBnd is AggregateType || typeBnd is TypeParameterType || typeBnd is ArrayType); switch (arg.GetTypeKind()) { @@ -386,15 +328,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_PointerType: return false; case TypeKind.TK_NullableType: - arg = arg.AsNullableType().GetAts(checker.GetErrorContext()); - if (null == arg) - return true; + arg = ((NullableType)arg).GetAts(); // Fall through. goto case TypeKind.TK_TypeParameterType; case TypeKind.TK_TypeParameterType: case TypeKind.TK_ArrayType: case TypeKind.TK_AggregateType: - return checker.GetSymbolLoader().HasBaseConversion(arg, typeBnd); + return checker.SymbolLoader.HasBaseConversion(arg, typeBnd); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/AggregateType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/AggregateType.cs index cbb4c29cef..b97e65e958 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/AggregateType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/AggregateType.cs @@ -14,7 +14,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Represents a generic constructed (or instantiated) type. Parent is the AggregateSymbol. // ---------------------------------------------------------------------------- - internal partial class AggregateType : CType + internal sealed class AggregateType : CType { private TypeArray _pTypeArgsThis; private TypeArray _pTypeArgsAll; // includes args from outer types @@ -127,36 +127,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TypeArray pCheckedOuterTypeArgs = outerTypeArgs; TypeManager pTypeManager = getAggregate().GetTypeManager(); - - if (_pTypeArgsThis.Count > 0 && AreAllTypeArgumentsUnitTypes(_pTypeArgsThis)) - { - if (outerTypeArgs.Count > 0 && !AreAllTypeArgumentsUnitTypes(outerTypeArgs)) - { - // We have open placeholder types in our type, but not the parent. - pCheckedOuterTypeArgs = pTypeManager.CreateArrayOfUnitTypes(outerTypeArgs.Count); - } - } _pTypeArgsAll = pTypeManager.ConcatenateTypeArrays(pCheckedOuterTypeArgs, _pTypeArgsThis); } - private bool AreAllTypeArgumentsUnitTypes(TypeArray typeArray) - { - if (typeArray.Count == 0) - { - return true; - } - - for (int i = 0; i < typeArray.Count; i++) - { - Debug.Assert(typeArray[i] != null); - if (!typeArray[i].IsOpenTypePlaceholderType()) - { - return false; - } - } - return true; - } - public TypeArray GetTypeArgsThis() { return _pTypeArgsThis; @@ -185,7 +158,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int i = 0; i < ifaces.Count; i++) { - AggregateType type = ifaces[i].AsAggregateType(); + AggregateType type = ifaces[i] as AggregateType; Debug.Assert(type.isInterfaceType()); if (type.IsCollectionType()) diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ArrayType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ArrayType.cs index 3ac3487126..3546c27a51 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ArrayType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ArrayType.cs @@ -21,8 +21,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Returns the first non-array type in the parent chain. public CType GetBaseElementType() { - CType type; - for (type = GetElementType(); type.IsArrayType(); type = type.AsArrayType().GetElementType()) ; + CType type = GetElementType(); + while (type is ArrayType arr) + { + type = arr.GetElementType(); + } + return type; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/BoundLambdaType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/BoundLambdaType.cs deleted file mode 100644 index 868a2780bc..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/BoundLambdaType.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - // ---------------------------------------------------------------------------- - // BoundLambdaType - a placeholder typesym used only as the type of an anonymous - // method expression. There is exactly one of these. - // ---------------------------------------------------------------------------- - - internal sealed class BoundLambdaType : CType - { }; -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ErrorType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ErrorType.cs index 0a68e5ee3d..7376f4ceaf 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ErrorType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ErrorType.cs @@ -18,17 +18,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Name nameText; public TypeArray typeArgs; - public bool HasParent() { return _pParentType != null || _pParentNS != null; } - - public bool HasTypeParent() { return _pParentType != null; } - public CType GetTypeParent() { return _pParentType; } - public void SetTypeParent(CType pType) { _pParentType = pType; } - - public bool HasNSParent() { return _pParentNS != null; } - public AssemblyQualifiedNamespaceSymbol GetNSParent() { return _pParentNS; } - public void SetNSParent(AssemblyQualifiedNamespaceSymbol pNS) { _pParentNS = pNS; } - - private CType _pParentType; - private AssemblyQualifiedNamespaceSymbol _pParentNS; + // ErrorTypes are always either the per-TypeManager singleton ErrorType + // that has a null nameText and no namespace parent, or else have a + // non-null nameText and have the root namespace as the namespace parent, + // so checking that nameText isn't null is equivalent to checking if the + // type has a parent. + public bool HasParent => nameText != null; } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/NullableType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/NullableType.cs index 3459086a15..089b2b5cf6 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/NullableType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/NullableType.cs @@ -20,21 +20,17 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public BSYMMGR symmgr; public TypeManager typeManager; - public AggregateType GetAts(ErrorHandling errorContext) + public AggregateType GetAts() { - AggregateSymbol aggNullable = typeManager.GetNullable(); - if (aggNullable == null) - { - throw Error.InternalCompilerError(); - } - if (ats == null) { + AggregateSymbol aggNullable = typeManager.GetNullable(); CType typePar = GetUnderlyingType(); - CType[] typeParArray = new CType[] { typePar }; + CType[] typeParArray = { typePar }; TypeArray ta = symmgr.AllocParams(1, typeParArray); ats = typeManager.GetAggregate(aggNullable, ta); } + return ats; } public CType GetUnderlyingType() { return UnderlyingType; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/OpenTypePlaceholderType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/OpenTypePlaceholderType.cs deleted file mode 100644 index cc099ebc65..0000000000 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/OpenTypePlaceholderType.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CSharp.RuntimeBinder.Semantics -{ - // ---------------------------------------------------------------------------- - // OpenTypePlaceholderType - a placeholder typesym used only in type argument lists for open - // types. There is exactly one of these. - // ---------------------------------------------------------------------------- - - internal sealed class OpenTypePlaceholderType : CType - { } -} diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/PredefinedTypes.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/PredefinedTypes.cs index 9a27369f4a..5ea4cd818c 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/PredefinedTypes.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/PredefinedTypes.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using Microsoft.CSharp.RuntimeBinder.Errors; using Microsoft.CSharp.RuntimeBinder.Syntax; namespace Microsoft.CSharp.RuntimeBinder.Semantics @@ -13,26 +12,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics internal sealed class PredefinedTypes { private SymbolTable _runtimeBinderSymbolTable; - private readonly BSYMMGR _pBSymmgr; + private readonly BSYMMGR _symbolManager; private AggregateSymbol[] _predefSyms; // array of predefined symbol types. - public PredefinedTypes(BSYMMGR pBSymmgr) + public PredefinedTypes(BSYMMGR symbolManager) { - _pBSymmgr = pBSymmgr; + _symbolManager = symbolManager; _runtimeBinderSymbolTable = null; } - // We want to delay load the predef syms as needed. + // We want to delay load the predefined symbols as needed. private AggregateSymbol DelayLoadPredefSym(PredefinedType pt) { CType type = _runtimeBinderSymbolTable.GetCTypeFromType(PredefinedTypeFacts.GetAssociatedSystemType(pt)); AggregateSymbol sym = type.getAggregate(); - - // If we failed to load this thing, we have problems. - if (sym == null) - { - return null; - } return InitializePredefinedType(sym, pt); } @@ -48,121 +41,37 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public void Init(SymbolTable symtable) { _runtimeBinderSymbolTable = symtable; - Debug.Assert(_pBSymmgr != null); + Debug.Assert(_symbolManager != null); Debug.Assert(_predefSyms == null); _predefSyms = new AggregateSymbol[(int)PredefinedType.PT_COUNT]; } - public void ReportMissingPredefTypeError(ErrorHandling errorContext, PredefinedType pt) - { - Debug.Assert(_pBSymmgr != null); - Debug.Assert(_predefSyms != null); - Debug.Assert((PredefinedType)0 <= pt && pt < PredefinedType.PT_COUNT && _predefSyms[(int)pt] == null); - - // We do not assert that !predefTypeInfo[pt].isRequired because if the user is defining - // their own MSCorLib and is defining a required PredefType, they'll run into this error - // and we need to allow it to go through. - - errorContext.Error(ErrorCode.ERR_PredefinedTypeNotFound, PredefinedTypeFacts.GetName(pt)); - } - - public AggregateSymbol GetReqPredefAgg(PredefinedType pt) - { - if (!PredefinedTypeFacts.IsRequired(pt)) throw Error.InternalCompilerError(); - if (_predefSyms[(int)pt] == null) - { - // Delay load this thing. - _predefSyms[(int)pt] = DelayLoadPredefSym(pt); - } - return _predefSyms[(int)pt]; - } - - public AggregateSymbol GetOptPredefAgg(PredefinedType pt) - { - if (_predefSyms[(int)pt] == null) - { - // Delay load this thing. - _predefSyms[(int)pt] = DelayLoadPredefSym(pt); - } - - Debug.Assert(_predefSyms != null); - return _predefSyms[(int)pt]; - } + public AggregateSymbol GetPredefinedAggregate(PredefinedType pt) => + _predefSyms[(int)pt] ?? (_predefSyms[(int)pt] = DelayLoadPredefSym(pt)); //////////////////////////////////////////////////////////////////////////////// // Some of the predefined types have built-in names, like "int" or "string" or // "object". This return the nice name if one exists; otherwise null is // returned. - private static string GetNiceName(PredefinedType pt) - { - return PredefinedTypeFacts.GetNiceName(pt); - } + private static string GetNiceName(PredefinedType pt) => PredefinedTypeFacts.GetNiceName(pt); - public static string GetNiceName(AggregateSymbol type) - { - if (type.IsPredefined()) - return GetNiceName(type.GetPredefType()); - else - return null; - } + public static string GetNiceName(AggregateSymbol type) => + type.IsPredefined() ? GetNiceName(type.GetPredefType()) : null; - public static string GetFullName(PredefinedType pt) - { - return PredefinedTypeFacts.GetName(pt); - } - - public static bool isRequired(PredefinedType pt) - { - return PredefinedTypeFacts.IsRequired(pt); - } + public static string GetFullName(PredefinedType pt) => PredefinedTypeFacts.GetName(pt); } internal static class PredefinedTypeFacts { - internal static string GetName(PredefinedType type) - { - return s_pdTypes[(int)type].name; - } + internal static string GetName(PredefinedType type) => s_types[(int)type].Name; - internal static bool IsRequired(PredefinedType type) - { - return s_pdTypes[(int)type].required; - } + internal static FUNDTYPE GetFundType(PredefinedType type) => s_types[(int)type].FundType; - internal static FUNDTYPE GetFundType(PredefinedType type) - { - return s_pdTypes[(int)type].fundType; - } + internal static Type GetAssociatedSystemType(PredefinedType type) => s_types[(int)type].AssociatedSystemType; - internal static Type GetAssociatedSystemType(PredefinedType type) - { - return s_pdTypes[(int)type].AssociatedSystemType; - } - - internal static bool IsSimpleType(PredefinedType type) - { - switch (type) - { - case PredefinedType.PT_BYTE: - case PredefinedType.PT_SHORT: - case PredefinedType.PT_INT: - case PredefinedType.PT_LONG: - case PredefinedType.PT_FLOAT: - case PredefinedType.PT_DOUBLE: - case PredefinedType.PT_DECIMAL: - case PredefinedType.PT_CHAR: - case PredefinedType.PT_BOOL: - case PredefinedType.PT_SBYTE: - case PredefinedType.PT_USHORT: - case PredefinedType.PT_UINT: - case PredefinedType.PT_ULONG: - return true; - default: - return false; - } - } + internal static bool IsSimpleType(PredefinedType type) => type < PredefinedType.FirstNonSimpleType; internal static bool IsNumericType(PredefinedType type) { @@ -224,184 +133,99 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } } - internal static bool IsPredefinedType(string name) - { - return s_pdTypeNames.ContainsKey(name); - } - - internal static PredefinedType GetPredefTypeIndex(string name) - { - return s_pdTypeNames[name]; - } + public static PredefinedType TryGetPredefTypeIndex(string name) => + s_typesByName.TryGetValue(name, out PredefinedType type) ? type : PredefinedType.PT_UNDEFINEDINDEX; private sealed class PredefinedTypeInfo { - internal readonly PredefinedType type; - internal readonly string name; - internal readonly bool required; - internal readonly FUNDTYPE fundType; - internal readonly Type AssociatedSystemType; +#if DEBUG + public readonly PredefinedType Type; +#endif + public readonly string Name; + public readonly FUNDTYPE FundType; + public readonly Type AssociatedSystemType; - internal PredefinedTypeInfo(PredefinedType type, Type associatedSystemType, string name, bool required, int arity, AggKindEnum aggKind, FUNDTYPE fundType, bool inMscorlib) + internal PredefinedTypeInfo(PredefinedType type, Type associatedSystemType, string name, FUNDTYPE fundType) { - this.type = type; - this.name = name; - this.required = required; - this.fundType = fundType; +#if DEBUG + Type = type; +#endif + Name = name; + FundType = fundType; AssociatedSystemType = associatedSystemType; } - internal PredefinedTypeInfo(PredefinedType type, Type associatedSystemType, string name, bool required, int arity, bool inMscorlib) - : this(type, associatedSystemType, name, required, arity, AggKindEnum.Class, FUNDTYPE.FT_REF, inMscorlib) + internal PredefinedTypeInfo(PredefinedType type, Type associatedSystemType, string name) + : this(type, associatedSystemType, name, FUNDTYPE.FT_REF) { } } - private static readonly PredefinedTypeInfo[] s_pdTypes = new PredefinedTypeInfo[] { - new PredefinedTypeInfo(PredefinedType.PT_BYTE, typeof(byte), "System.Byte", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_U1, true), - new PredefinedTypeInfo(PredefinedType.PT_SHORT, typeof(short), "System.Int16", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_I2, true), - new PredefinedTypeInfo(PredefinedType.PT_INT, typeof(int), "System.Int32", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_I4, true), - new PredefinedTypeInfo(PredefinedType.PT_LONG, typeof(long), "System.Int64", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_I8, true), - new PredefinedTypeInfo(PredefinedType.PT_FLOAT, typeof(float), "System.Single", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_R4, true), - new PredefinedTypeInfo(PredefinedType.PT_DOUBLE, typeof(double), "System.Double", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_R8, true), - new PredefinedTypeInfo(PredefinedType.PT_DECIMAL, typeof(decimal), "System.Decimal", false, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_CHAR, typeof(char), "System.Char", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_U2, true), - new PredefinedTypeInfo(PredefinedType.PT_BOOL, typeof(bool), "System.Boolean", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_I1, true), - new PredefinedTypeInfo(PredefinedType.PT_SBYTE, typeof(sbyte), "System.SByte", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_I1, true), - new PredefinedTypeInfo(PredefinedType.PT_USHORT, typeof(ushort), "System.UInt16", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_U2, true), - new PredefinedTypeInfo(PredefinedType.PT_UINT, typeof(uint), "System.UInt32", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_U4, true), - new PredefinedTypeInfo(PredefinedType.PT_ULONG, typeof(ulong), "System.UInt64", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_U8, true), - new PredefinedTypeInfo(PredefinedType.PT_INTPTR, typeof(IntPtr), "System.IntPtr", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_UINTPTR, typeof(UIntPtr), "System.UIntPtr", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_OBJECT, typeof(object), "System.Object", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_STRING, typeof(string), "System.String", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DELEGATE, typeof(Delegate), "System.Delegate", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_MULTIDEL, typeof(MulticastDelegate), "System.MulticastDelegate", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ARRAY, typeof(Array), "System.Array", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_EXCEPTION, typeof(Exception), "System.Exception", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_TYPE, typeof(Type), "System.Type", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_MONITOR, typeof(System.Threading.Monitor), "System.Threading.Monitor", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_VALUE, typeof(ValueType), "System.ValueType", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ENUM, typeof(Enum), "System.Enum", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DATETIME, typeof(DateTime), "System.DateTime", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_DEBUGGABLEATTRIBUTE, typeof(DebuggableAttribute), "System.Diagnostics.DebuggableAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEBUGGABLEATTRIBUTE_DEBUGGINGMODES, typeof(DebuggableAttribute.DebuggingModes), "System.Diagnostics.DebuggableAttribute.DebuggingModes", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_IN, typeof(System.Runtime.InteropServices.InAttribute), "System.Runtime.InteropServices.InAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_OUT, typeof(System.Runtime.InteropServices.OutAttribute), "System.Runtime.InteropServices.OutAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ATTRIBUTE, typeof(Attribute), "System.Attribute", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ATTRIBUTEUSAGE, typeof(AttributeUsageAttribute), "System.AttributeUsageAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ATTRIBUTETARGETS, typeof(AttributeTargets), "System.AttributeTargets", false, 0, AggKindEnum.Enum, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_OBSOLETE, typeof(ObsoleteAttribute), "System.ObsoleteAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_CONDITIONAL, typeof(ConditionalAttribute), "System.Diagnostics.ConditionalAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_CLSCOMPLIANT, typeof(CLSCompliantAttribute), "System.CLSCompliantAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_GUID, typeof(System.Runtime.InteropServices.GuidAttribute), "System.Runtime.InteropServices.GuidAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEFAULTMEMBER, typeof(System.Reflection.DefaultMemberAttribute), "System.Reflection.DefaultMemberAttribute", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_PARAMS, typeof(ParamArrayAttribute), "System.ParamArrayAttribute", true, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_COMIMPORT, typeof(System.Runtime.InteropServices.ComImportAttribute), "System.Runtime.InteropServices.ComImportAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_FIELDOFFSET, typeof(System.Runtime.InteropServices.FieldOffsetAttribute), "System.Runtime.InteropServices.FieldOffsetAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_STRUCTLAYOUT, typeof(System.Runtime.InteropServices.StructLayoutAttribute), "System.Runtime.InteropServices.StructLayoutAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_LAYOUTKIND, typeof(System.Runtime.InteropServices.LayoutKind), "System.Runtime.InteropServices.LayoutKind", false, 0, AggKindEnum.Enum, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_MARSHALAS, typeof(System.Runtime.InteropServices.MarshalAsAttribute), "System.Runtime.InteropServices.MarshalAsAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DLLIMPORT, typeof(System.Runtime.InteropServices.DllImportAttribute), "System.Runtime.InteropServices.DllImportAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_INDEXERNAME, typeof(System.Runtime.CompilerServices.IndexerNameAttribute), "System.Runtime.CompilerServices.IndexerNameAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DECIMALCONSTANT, typeof(System.Runtime.CompilerServices.DecimalConstantAttribute), "System.Runtime.CompilerServices.DecimalConstantAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEFAULTVALUE, typeof(System.Runtime.InteropServices.DefaultParameterValueAttribute), "System.Runtime.InteropServices.DefaultParameterValueAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_UNMANAGEDFUNCTIONPOINTER, typeof(System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute), "System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_CALLINGCONVENTION, typeof(System.Runtime.InteropServices.CallingConvention), "System.Runtime.InteropServices.CallingConvention", false, 0, AggKindEnum.Enum, FUNDTYPE.FT_I4, true), - new PredefinedTypeInfo(PredefinedType.PT_CHARSET, typeof(System.Runtime.InteropServices.CharSet), "System.Runtime.InteropServices.CharSet", false, 0, AggKindEnum.Enum, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_TYPEHANDLE, typeof(RuntimeTypeHandle), "System.RuntimeTypeHandle", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_FIELDHANDLE, typeof(RuntimeFieldHandle), "System.RuntimeFieldHandle", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_METHODHANDLE, typeof(RuntimeMethodHandle), "System.RuntimeMethodHandle", false, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_G_DICTIONARY, typeof(Dictionary<,>), "System.Collections.Generic.Dictionary`2", false, 2, true), - new PredefinedTypeInfo(PredefinedType.PT_IASYNCRESULT, typeof(IAsyncResult), "System.IAsyncResult", false, 0, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_ASYNCCBDEL, typeof(AsyncCallback), "System.AsyncCallback", false, 0, AggKindEnum.Delegate, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_IDISPOSABLE, typeof(IDisposable), "System.IDisposable", true, 0, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_IENUMERABLE, typeof(System.Collections.IEnumerable), "System.Collections.IEnumerable", true, 0, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_IENUMERATOR, typeof(System.Collections.IEnumerator), "System.Collections.IEnumerator", true, 0, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_SYSTEMVOID, typeof(void), "System.Void", true, 0, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_RUNTIMEHELPERS, typeof(System.Runtime.CompilerServices.RuntimeHelpers), "System.Runtime.CompilerServices.RuntimeHelpers", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_VOLATILEMOD, typeof(System.Runtime.CompilerServices.IsVolatile), "System.Runtime.CompilerServices.IsVolatile", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_COCLASS, typeof(System.Runtime.InteropServices.CoClassAttribute), "System.Runtime.InteropServices.CoClassAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ACTIVATOR, typeof(Activator), "System.Activator", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_G_IENUMERABLE, typeof(IEnumerable<>), "System.Collections.Generic.IEnumerable`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_G_IENUMERATOR, typeof(IEnumerator<>), "System.Collections.Generic.IEnumerator`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_G_OPTIONAL, typeof(Nullable<>), "System.Nullable`1", false, 1, AggKindEnum.Struct, FUNDTYPE.FT_STRUCT, true), - new PredefinedTypeInfo(PredefinedType.PT_FIXEDBUFFER, typeof(System.Runtime.CompilerServices.FixedBufferAttribute), "System.Runtime.CompilerServices.FixedBufferAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEFAULTCHARSET, typeof(System.Runtime.InteropServices.DefaultCharSetAttribute), "System.Runtime.InteropServices.DefaultCharSetAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_COMPILATIONRELAXATIONS, typeof(System.Runtime.CompilerServices.CompilationRelaxationsAttribute), "System.Runtime.CompilerServices.CompilationRelaxationsAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_RUNTIMECOMPATIBILITY, typeof(System.Runtime.CompilerServices.RuntimeCompatibilityAttribute), "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_FRIENDASSEMBLY, typeof(System.Runtime.CompilerServices.InternalsVisibleToAttribute), "System.Runtime.CompilerServices.InternalsVisibleToAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEBUGGERHIDDEN, typeof(DebuggerHiddenAttribute), "System.Diagnostics.DebuggerHiddenAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_TYPEFORWARDER, typeof(System.Runtime.CompilerServices.TypeForwardedToAttribute), "System.Runtime.CompilerServices.TypeForwardedToAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_KEYFILE, typeof(System.Reflection.AssemblyKeyFileAttribute), "System.Reflection.AssemblyKeyFileAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_KEYNAME, typeof(System.Reflection.AssemblyKeyNameAttribute), "System.Reflection.AssemblyKeyNameAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DELAYSIGN, typeof(System.Reflection.AssemblyDelaySignAttribute), "System.Reflection.AssemblyDelaySignAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_NOTSUPPORTEDEXCEPTION, typeof(NotSupportedException), "System.NotSupportedException", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_COMPILERGENERATED, typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute), "System.Runtime.CompilerServices.CompilerGeneratedAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_UNSAFEVALUETYPE, typeof(System.Runtime.CompilerServices.UnsafeValueTypeAttribute), "System.Runtime.CompilerServices.UnsafeValueTypeAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ASSEMBLYFLAGS, typeof(System.Reflection.AssemblyFlagsAttribute), "System.Reflection.AssemblyFlagsAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ASSEMBLYVERSION, typeof(System.Reflection.AssemblyVersionAttribute), "System.Reflection.AssemblyVersionAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_ASSEMBLYCULTURE, typeof(System.Reflection.AssemblyCultureAttribute), "System.Reflection.AssemblyCultureAttribute", false, 0, true), - // LINQ - new PredefinedTypeInfo(PredefinedType.PT_G_IQUERYABLE, typeof(System.Linq.IQueryable<>), "System.Linq.IQueryable`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, false), - new PredefinedTypeInfo(PredefinedType.PT_IQUERYABLE, typeof(System.Linq.IQueryable), "System.Linq.IQueryable", false, 0, AggKindEnum.Interface, FUNDTYPE.FT_REF, false), - new PredefinedTypeInfo(PredefinedType.PT_STRINGBUILDER, typeof(System.Text.StringBuilder), "System.Text.StringBuilder", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_G_ICOLLECTION, typeof(ICollection<>), "System.Collections.Generic.ICollection`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_G_ILIST, typeof(IList<>), "System.Collections.Generic.IList`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, true), - new PredefinedTypeInfo(PredefinedType.PT_EXTENSION, typeof(System.Runtime.CompilerServices.ExtensionAttribute), "System.Runtime.CompilerServices.ExtensionAttribute", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_G_EXPRESSION, typeof(System.Linq.Expressions.Expression<>), "System.Linq.Expressions.Expression`1", false, 1, false), - new PredefinedTypeInfo(PredefinedType.PT_EXPRESSION, typeof(System.Linq.Expressions.Expression), "System.Linq.Expressions.Expression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_LAMBDAEXPRESSION, typeof(System.Linq.Expressions.LambdaExpression), "System.Linq.Expressions.LambdaExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_BINARYEXPRESSION, typeof(System.Linq.Expressions.BinaryExpression), "System.Linq.Expressions.BinaryExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_UNARYEXPRESSION, typeof(System.Linq.Expressions.UnaryExpression), "System.Linq.Expressions.UnaryExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_CONDITIONALEXPRESSION, typeof(System.Linq.Expressions.ConditionalExpression), "System.Linq.Expressions.ConditionalExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_CONSTANTEXPRESSION, typeof(System.Linq.Expressions.ConstantExpression), "System.Linq.Expressions.ConstantExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_PARAMETEREXPRESSION, typeof(System.Linq.Expressions.ParameterExpression), "System.Linq.Expressions.ParameterExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_MEMBEREXPRESSION, typeof(System.Linq.Expressions.MemberExpression), "System.Linq.Expressions.MemberExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_METHODCALLEXPRESSION, typeof(System.Linq.Expressions.MethodCallExpression), "System.Linq.Expressions.MethodCallExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_NEWEXPRESSION, typeof(System.Linq.Expressions.NewExpression), "System.Linq.Expressions.NewExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_BINDING, typeof(System.Linq.Expressions.MemberBinding), "System.Linq.Expressions.MemberBinding", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_MEMBERINITEXPRESSION, typeof(System.Linq.Expressions.MemberInitExpression), "System.Linq.Expressions.MemberInitExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_LISTINITEXPRESSION, typeof(System.Linq.Expressions.ListInitExpression), "System.Linq.Expressions.ListInitExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_TYPEBINARYEXPRESSION, typeof(System.Linq.Expressions.TypeBinaryExpression), "System.Linq.Expressions.TypeBinaryExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_NEWARRAYEXPRESSION, typeof(System.Linq.Expressions.NewArrayExpression), "System.Linq.Expressions.NewArrayExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_MEMBERASSIGNMENT, typeof(System.Linq.Expressions.MemberAssignment), "System.Linq.Expressions.MemberAssignment", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_MEMBERLISTBINDING, typeof(System.Linq.Expressions.MemberListBinding), "System.Linq.Expressions.MemberListBinding", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_MEMBERMEMBERBINDING, typeof(System.Linq.Expressions.MemberMemberBinding), "System.Linq.Expressions.MemberMemberBinding", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_INVOCATIONEXPRESSION, typeof(System.Linq.Expressions.InvocationExpression), "System.Linq.Expressions.InvocationExpression", false, 0, false), - new PredefinedTypeInfo(PredefinedType.PT_FIELDINFO, typeof(System.Reflection.FieldInfo), "System.Reflection.FieldInfo", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_METHODINFO, typeof(System.Reflection.MethodInfo), "System.Reflection.MethodInfo", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_CONSTRUCTORINFO, typeof(System.Reflection.ConstructorInfo), "System.Reflection.ConstructorInfo", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_PROPERTYINFO, typeof(System.Reflection.PropertyInfo), "System.Reflection.PropertyInfo", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_METHODBASE, typeof(System.Reflection.MethodBase), "System.Reflection.MethodBase", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_MEMBERINFO, typeof(System.Reflection.MemberInfo), "System.Reflection.MemberInfo", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEBUGGERDISPLAY, typeof(DebuggerDisplayAttribute), "System.Diagnostics.DebuggerDisplayAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEBUGGERBROWSABLE, typeof(DebuggerBrowsableAttribute), "System.Diagnostics.DebuggerBrowsableAttribute", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_DEBUGGERBROWSABLESTATE, typeof(DebuggerBrowsableState), "System.Diagnostics.DebuggerBrowsableState", false, 0, AggKindEnum.Enum, FUNDTYPE.FT_I4, true), - new PredefinedTypeInfo(PredefinedType.PT_G_EQUALITYCOMPARER, typeof(EqualityComparer<>), "System.Collections.Generic.EqualityComparer`1", false, 1, true), - new PredefinedTypeInfo(PredefinedType.PT_ELEMENTINITIALIZER, typeof(System.Linq.Expressions.ElementInit), "System.Linq.Expressions.ElementInit", false, 0, false), - - new PredefinedTypeInfo(PredefinedType.PT_MISSING, typeof(System.Reflection.Missing), "System.Reflection.Missing", false, 0, true), - new PredefinedTypeInfo(PredefinedType.PT_G_IREADONLYLIST, typeof(IReadOnlyList<>), "System.Collections.Generic.IReadOnlyList`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, false), - new PredefinedTypeInfo(PredefinedType.PT_G_IREADONLYCOLLECTION, typeof(IReadOnlyCollection<>), "System.Collections.Generic.IReadOnlyCollection`1", false, 1, AggKindEnum.Interface, FUNDTYPE.FT_REF, false), + private static readonly PredefinedTypeInfo[] s_types = { + new PredefinedTypeInfo(PredefinedType.PT_BYTE, typeof(byte), "System.Byte", FUNDTYPE.FT_U1), + new PredefinedTypeInfo(PredefinedType.PT_SHORT, typeof(short), "System.Int16", FUNDTYPE.FT_I2), + new PredefinedTypeInfo(PredefinedType.PT_INT, typeof(int), "System.Int32", FUNDTYPE.FT_I4), + new PredefinedTypeInfo(PredefinedType.PT_LONG, typeof(long), "System.Int64", FUNDTYPE.FT_I8), + new PredefinedTypeInfo(PredefinedType.PT_FLOAT, typeof(float), "System.Single", FUNDTYPE.FT_R4), + new PredefinedTypeInfo(PredefinedType.PT_DOUBLE, typeof(double), "System.Double", FUNDTYPE.FT_R8), + new PredefinedTypeInfo(PredefinedType.PT_DECIMAL, typeof(decimal), "System.Decimal", FUNDTYPE.FT_STRUCT), + new PredefinedTypeInfo(PredefinedType.PT_CHAR, typeof(char), "System.Char", FUNDTYPE.FT_U2), + new PredefinedTypeInfo(PredefinedType.PT_BOOL, typeof(bool), "System.Boolean", FUNDTYPE.FT_I1), + new PredefinedTypeInfo(PredefinedType.PT_SBYTE, typeof(sbyte), "System.SByte", FUNDTYPE.FT_I1), + new PredefinedTypeInfo(PredefinedType.PT_USHORT, typeof(ushort), "System.UInt16", FUNDTYPE.FT_U2), + new PredefinedTypeInfo(PredefinedType.PT_UINT, typeof(uint), "System.UInt32", FUNDTYPE.FT_U4), + new PredefinedTypeInfo(PredefinedType.PT_ULONG, typeof(ulong), "System.UInt64", FUNDTYPE.FT_U8), + new PredefinedTypeInfo(PredefinedType.PT_INTPTR, typeof(IntPtr), "System.IntPtr", FUNDTYPE.FT_STRUCT), + new PredefinedTypeInfo(PredefinedType.PT_UINTPTR, typeof(UIntPtr), "System.UIntPtr", FUNDTYPE.FT_STRUCT), + new PredefinedTypeInfo(PredefinedType.PT_OBJECT, typeof(object), "System.Object"), + new PredefinedTypeInfo(PredefinedType.PT_STRING, typeof(string), "System.String"), + new PredefinedTypeInfo(PredefinedType.PT_DELEGATE, typeof(Delegate), "System.Delegate"), + new PredefinedTypeInfo(PredefinedType.PT_MULTIDEL, typeof(MulticastDelegate), "System.MulticastDelegate"), + new PredefinedTypeInfo(PredefinedType.PT_ARRAY, typeof(Array), "System.Array"), + new PredefinedTypeInfo(PredefinedType.PT_TYPE, typeof(Type), "System.Type"), + new PredefinedTypeInfo(PredefinedType.PT_VALUE, typeof(ValueType), "System.ValueType"), + new PredefinedTypeInfo(PredefinedType.PT_ENUM, typeof(Enum), "System.Enum"), + new PredefinedTypeInfo(PredefinedType.PT_DATETIME, typeof(DateTime), "System.DateTime", FUNDTYPE.FT_STRUCT), + new PredefinedTypeInfo(PredefinedType.PT_IENUMERABLE, typeof(System.Collections.IEnumerable), "System.Collections.IEnumerable"), + new PredefinedTypeInfo(PredefinedType.PT_G_IENUMERABLE, typeof(IEnumerable<>), "System.Collections.Generic.IEnumerable`1"), + new PredefinedTypeInfo(PredefinedType.PT_G_OPTIONAL, typeof(Nullable<>), "System.Nullable`1", FUNDTYPE.FT_STRUCT), + new PredefinedTypeInfo(PredefinedType.PT_G_IQUERYABLE, typeof(System.Linq.IQueryable<>), "System.Linq.IQueryable`1"), + new PredefinedTypeInfo(PredefinedType.PT_G_ICOLLECTION, typeof(ICollection<>), "System.Collections.Generic.ICollection`1"), + new PredefinedTypeInfo(PredefinedType.PT_G_ILIST, typeof(IList<>), "System.Collections.Generic.IList`1"), + new PredefinedTypeInfo(PredefinedType.PT_G_EXPRESSION, typeof(System.Linq.Expressions.Expression<>), "System.Linq.Expressions.Expression`1"), + new PredefinedTypeInfo(PredefinedType.PT_EXPRESSION, typeof(System.Linq.Expressions.Expression), "System.Linq.Expressions.Expression"), + new PredefinedTypeInfo(PredefinedType.PT_BINARYEXPRESSION, typeof(System.Linq.Expressions.BinaryExpression), "System.Linq.Expressions.BinaryExpression"), + new PredefinedTypeInfo(PredefinedType.PT_UNARYEXPRESSION, typeof(System.Linq.Expressions.UnaryExpression), "System.Linq.Expressions.UnaryExpression"), + new PredefinedTypeInfo(PredefinedType.PT_CONSTANTEXPRESSION, typeof(System.Linq.Expressions.ConstantExpression), "System.Linq.Expressions.ConstantExpression"), + new PredefinedTypeInfo(PredefinedType.PT_PARAMETEREXPRESSION, typeof(System.Linq.Expressions.ParameterExpression), "System.Linq.Expressions.ParameterExpression"), + new PredefinedTypeInfo(PredefinedType.PT_MEMBEREXPRESSION, typeof(System.Linq.Expressions.MemberExpression), "System.Linq.Expressions.MemberExpression"), + new PredefinedTypeInfo(PredefinedType.PT_METHODCALLEXPRESSION, typeof(System.Linq.Expressions.MethodCallExpression), "System.Linq.Expressions.MethodCallExpression"), + new PredefinedTypeInfo(PredefinedType.PT_NEWEXPRESSION, typeof(System.Linq.Expressions.NewExpression), "System.Linq.Expressions.NewExpression"), + new PredefinedTypeInfo(PredefinedType.PT_NEWARRAYEXPRESSION, typeof(System.Linq.Expressions.NewArrayExpression), "System.Linq.Expressions.NewArrayExpression"), + new PredefinedTypeInfo(PredefinedType.PT_INVOCATIONEXPRESSION, typeof(System.Linq.Expressions.InvocationExpression), "System.Linq.Expressions.InvocationExpression"), + new PredefinedTypeInfo(PredefinedType.PT_FIELDINFO, typeof(System.Reflection.FieldInfo), "System.Reflection.FieldInfo"), + new PredefinedTypeInfo(PredefinedType.PT_METHODINFO, typeof(System.Reflection.MethodInfo), "System.Reflection.MethodInfo"), + new PredefinedTypeInfo(PredefinedType.PT_CONSTRUCTORINFO, typeof(System.Reflection.ConstructorInfo), "System.Reflection.ConstructorInfo"), + new PredefinedTypeInfo(PredefinedType.PT_PROPERTYINFO, typeof(System.Reflection.PropertyInfo), "System.Reflection.PropertyInfo"), + new PredefinedTypeInfo(PredefinedType.PT_MISSING, typeof(System.Reflection.Missing), "System.Reflection.Missing"), + new PredefinedTypeInfo(PredefinedType.PT_G_IREADONLYLIST, typeof(IReadOnlyList<>), "System.Collections.Generic.IReadOnlyList`1"), + new PredefinedTypeInfo(PredefinedType.PT_G_IREADONLYCOLLECTION, typeof(IReadOnlyCollection<>), "System.Collections.Generic.IReadOnlyCollection`1"), }; - private static readonly Dictionary s_pdTypeNames = CreatePredefinedTypeFacts(); + private static readonly Dictionary s_typesByName = CreatePredefinedTypeFacts(); private static Dictionary CreatePredefinedTypeFacts() { - var pdTypeNames = new Dictionary((int)PredefinedType.PT_COUNT); + var typesByName = new Dictionary((int)PredefinedType.PT_COUNT); + for (int i = 0; i < (int)PredefinedType.PT_COUNT; i++) + { #if DEBUG - for (int i = 0; i < (int)PredefinedType.PT_COUNT; i++) - { - Debug.Assert(s_pdTypes[i].type == (PredefinedType)i); - } + Debug.Assert(s_types[i].Type == (PredefinedType)i); #endif - for (int i = 0; i < (int)PredefinedType.PT_COUNT; i++) - { - pdTypeNames.Add(s_pdTypes[i].name, (PredefinedType)i); + typesByName.Add(s_types[i].Name, (PredefinedType)i); } - return pdTypeNames; + + return typesByName; } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/Type.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/Type.cs index 576146f6cb..8a83c9a0d9 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/Type.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/Type.cs @@ -16,30 +16,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private Name _pName; private bool _fHasErrors; // Whether anyituents have errors. This is immutable. - private bool _isBogus; // can't be used in our language -- unsupported type(s) - private bool _checkedBogus; // Have we checked a method args/return for bogus types - - // Is and As methods. - public AggregateType AsAggregateType() { return this as AggregateType; } - public ErrorType AsErrorType() { return this as ErrorType; } - public ArrayType AsArrayType() { return this as ArrayType; } - public PointerType AsPointerType() { return this as PointerType; } - public ParameterModifierType AsParameterModifierType() { return this as ParameterModifierType; } - public NullableType AsNullableType() { return this as NullableType; } - public TypeParameterType AsTypeParameterType() { return this as TypeParameterType; } - - public bool IsAggregateType() { return this is AggregateType; } - public bool IsVoidType() { return this is VoidType; } - public bool IsNullType() { return this is NullType; } - public bool IsOpenTypePlaceholderType() { return this is OpenTypePlaceholderType; } - public bool IsBoundLambdaType() { return this is BoundLambdaType; } - public bool IsMethodGroupType() { return this is MethodGroupType; } - public bool IsErrorType() { return this is ErrorType; } - public bool IsArrayType() { return this is ArrayType; } - public bool IsPointerType() { return this is PointerType; } - public bool IsParameterModifierType() { return this is ParameterModifierType; } - public bool IsNullableType() { return this is NullableType; } - public bool IsTypeParameterType() { return this is TypeParameterType; } public bool IsWindowsRuntimeType() { @@ -67,12 +43,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; } - // API similar to System.Type - public bool IsGenericParameter - { - get { return IsTypeParameterType(); } - } - private Type _associatedSystemType; public Type AssociatedSystemType { @@ -94,59 +64,46 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (src.GetTypeKind()) { case TypeKind.TK_ArrayType: - ArrayType a = src.AsArrayType(); + ArrayType a = (ArrayType)src; Type elementType = a.GetElementType().AssociatedSystemType; result = a.IsSZArray ? elementType.MakeArrayType() : elementType.MakeArrayType(a.rank); break; case TypeKind.TK_NullableType: - NullableType n = src.AsNullableType(); + NullableType n = (NullableType)src; Type underlyingType = n.GetUnderlyingType().AssociatedSystemType; result = typeof(Nullable<>).MakeGenericType(underlyingType); break; case TypeKind.TK_PointerType: - PointerType p = src.AsPointerType(); + PointerType p = (PointerType)src; Type referentType = p.GetReferentType().AssociatedSystemType; result = referentType.MakePointerType(); break; case TypeKind.TK_ParameterModifierType: - ParameterModifierType r = src.AsParameterModifierType(); + ParameterModifierType r = (ParameterModifierType)src; Type parameterType = r.GetParameterType().AssociatedSystemType; result = parameterType.MakeByRefType(); break; case TypeKind.TK_AggregateType: - result = CalculateAssociatedSystemTypeForAggregate(src.AsAggregateType()); + result = CalculateAssociatedSystemTypeForAggregate((AggregateType)src); break; case TypeKind.TK_TypeParameterType: - TypeParameterType t = src.AsTypeParameterType(); + TypeParameterType t = (TypeParameterType)src; if (t.IsMethodTypeParameter()) { - MethodInfo meth = t.GetOwningSymbol().AsMethodSymbol().AssociatedMemberInfo as MethodInfo; + MethodInfo meth = ((MethodSymbol)t.GetOwningSymbol()).AssociatedMemberInfo as MethodInfo; result = meth.GetGenericArguments()[t.GetIndexInOwnParameters()]; } else { - Type parentType = t.GetOwningSymbol().AsAggregateSymbol().AssociatedSystemType; + Type parentType = ((AggregateSymbol)t.GetOwningSymbol()).AssociatedSystemType; result = parentType.GetGenericArguments()[t.GetIndexInOwnParameters()]; } break; - - case TypeKind.TK_ArgumentListType: - case TypeKind.TK_BoundLambdaType: - case TypeKind.TK_ErrorType: - case TypeKind.TK_MethodGroupType: - case TypeKind.TK_NaturalIntegerType: - case TypeKind.TK_NullType: - case TypeKind.TK_OpenTypePlaceholderType: - case TypeKind.TK_UnboundLambdaType: - case TypeKind.TK_VoidType: - - default: - break; } Debug.Assert(result != null || src.GetTypeKind() == TypeKind.TK_AggregateType); @@ -164,7 +121,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics for (int i = 0; i < typeArgs.Count; i++) { // Unnamed type parameter types are just placeholders. - if (typeArgs[i].IsTypeParameterType() && typeArgs[i].AsTypeParameterType().GetTypeParameterSymbol().name == null) + if (typeArgs[i] is TypeParameterType typeParamArg && typeParamArg.GetTypeParameterSymbol().name == null) { return null; } @@ -195,71 +152,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public Name GetName() { return _pName; } public void SetName(Name pName) { _pName = pName; } - public bool checkBogus() { return _isBogus; } - public bool getBogus() { return _isBogus; } - public bool hasBogus() { return _checkedBogus; } - public void setBogus(bool isBogus) - { - _isBogus = isBogus; - _checkedBogus = true; - } - public bool computeCurrentBogusState() - { - if (hasBogus()) - { - return checkBogus(); - } - - bool fBogus = false; - - switch (GetTypeKind()) - { - case TypeKind.TK_ParameterModifierType: - case TypeKind.TK_PointerType: - case TypeKind.TK_ArrayType: - case TypeKind.TK_NullableType: - if (GetBaseOrParameterOrElementType() != null) - { - fBogus = GetBaseOrParameterOrElementType().computeCurrentBogusState(); - } - break; - - case TypeKind.TK_ErrorType: - setBogus(false); - break; - - case TypeKind.TK_AggregateType: - fBogus = AsAggregateType().getAggregate().computeCurrentBogusState(); - for (int i = 0; !fBogus && i < AsAggregateType().GetTypeArgsAll().Count; i++) - { - fBogus |= AsAggregateType().GetTypeArgsAll()[i].computeCurrentBogusState(); - } - break; - - case TypeKind.TK_TypeParameterType: - case TypeKind.TK_VoidType: - case TypeKind.TK_NullType: - case TypeKind.TK_OpenTypePlaceholderType: - case TypeKind.TK_ArgumentListType: - case TypeKind.TK_NaturalIntegerType: - setBogus(false); - break; - - default: - throw Error.InternalCompilerError(); - //setBogus(false); - //break; - } - - if (fBogus) - { - // Only set this if at least 1 declared thing is bogus - setBogus(fBogus); - } - - return hasBogus() && checkBogus(); - } - // This call switches on the kind and dispatches accordingly. This should really only be // used when dereferencing TypeArrays. We should consider refactoring our code to not // need this type of thing - strongly typed handling of TypeArrays would be much better. @@ -268,16 +160,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (GetTypeKind()) { case TypeKind.TK_ArrayType: - return AsArrayType().GetElementType(); + return ((ArrayType)this).GetElementType(); case TypeKind.TK_PointerType: - return AsPointerType().GetReferentType(); + return ((PointerType)this).GetReferentType(); case TypeKind.TK_ParameterModifierType: - return AsParameterModifierType().GetParameterType(); + return ((ParameterModifierType)this).GetParameterType(); case TypeKind.TK_NullableType: - return AsNullableType().GetUnderlyingType(); + return ((NullableType)this).GetUnderlyingType(); default: return null; @@ -286,19 +178,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public void InitFromParent() { - Debug.Assert(!IsAggregateType()); - CType typePar = null; - - if (IsErrorType()) - { - typePar = AsErrorType().GetTypeParent(); - } - else - { - typePar = GetBaseOrParameterOrElementType(); - } - - _fHasErrors = typePar.HasErrors(); + Debug.Assert(!(this is AggregateType)); + Debug.Assert(!(this is ErrorType)); + _fHasErrors = GetBaseOrParameterOrElementType().HasErrors(); } public bool HasErrors() @@ -323,7 +205,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { case TypeKind.TK_AggregateType: { - AggregateSymbol sym = AsAggregateType().getAggregate(); + AggregateSymbol sym = ((AggregateType)this).getAggregate(); // Treat enums like their underlying types. if (sym.IsEnum()) @@ -404,7 +286,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } public CType underlyingType() { - if (IsAggregateType() && getAggregate().IsEnum()) + if (this is AggregateType && getAggregate().IsEnum()) return getAggregate().GetUnderlyingType(); return this; } @@ -439,17 +321,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return GetNakedAgg(false); } - private AggregateSymbol GetNakedAgg(bool fStripNub) - { - CType type = GetNakedType(fStripNub); - if (type != null && type.IsAggregateType()) - return type.AsAggregateType().getAggregate(); - return null; - } + private AggregateSymbol GetNakedAgg(bool fStripNub) => + (GetNakedType(fStripNub) as AggregateType)?.getAggregate(); + public AggregateSymbol getAggregate() { - Debug.Assert(IsAggregateType()); - return AsAggregateType().GetOwningAggregate(); + Debug.Assert(this is AggregateType); + return ((AggregateType)this).GetOwningAggregate(); } public virtual CType StripNubs() => this; @@ -462,7 +340,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public bool isDelegateType() { - return (IsAggregateType() && getAggregate().IsDelegate()); + return this is AggregateType && getAggregate().IsDelegate(); } //////////////////////////////////////////////////////////////////////////////// @@ -485,7 +363,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool isPointerLike() { - return IsPointerType() || isPredefType(PredefinedType.PT_INTPTR) || isPredefType(PredefinedType.PT_UINTPTR); + return this is PointerType || isPredefType(PredefinedType.PT_INTPTR) || isPredefType(PredefinedType.PT_UINTPTR); } //////////////////////////////////////////////////////////////////////////////// @@ -498,23 +376,23 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } public bool isStructOrEnum() { - return (IsAggregateType() && (getAggregate().IsStruct() || getAggregate().IsEnum())) || IsNullableType(); + return this is AggregateType && (getAggregate().IsStruct() || getAggregate().IsEnum()) || this is NullableType; } public bool isStructType() { - return IsAggregateType() && getAggregate().IsStruct() || IsNullableType(); + return this is AggregateType && getAggregate().IsStruct() || this is NullableType; } public bool isEnumType() { - return (IsAggregateType() && getAggregate().IsEnum()); + return this is AggregateType && getAggregate().IsEnum(); } public bool isInterfaceType() { - return (IsAggregateType() && getAggregate().IsInterface()); + return this is AggregateType && getAggregate().IsInterface(); } public bool isClassType() { - return (IsAggregateType() && getAggregate().IsClass()); + return this is AggregateType && getAggregate().IsClass(); } public AggregateType underlyingEnumType() { @@ -523,9 +401,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } public bool isUnsigned() { - if (IsAggregateType()) + if (this is AggregateType sym) { - AggregateType sym = AsAggregateType(); if (sym.isEnumType()) { sym = sym.underlyingEnumType(); @@ -542,24 +419,24 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } else { - return IsPointerType(); + return this is PointerType; } } public bool isUnsafe() { // Pointer types are the only unsafe types. // Note that generics may not be instantiated with pointer types - return (this != null && (IsPointerType() || (IsArrayType() && AsArrayType().GetElementType().isUnsafe()))); + return this is PointerType || this is ArrayType arr && arr.GetElementType().isUnsafe(); } public bool isPredefType(PredefinedType pt) { - if (IsAggregateType()) - return AsAggregateType().getAggregate().IsPredefined() && AsAggregateType().getAggregate().GetPredefType() == pt; - return (IsVoidType() && pt == PredefinedType.PT_VOID); + if (this is AggregateType ats) + return ats.getAggregate().IsPredefined() && ats.getAggregate().GetPredefType() == pt; + return (this is VoidType && pt == PredefinedType.PT_VOID); } public bool isPredefined() { - return IsAggregateType() && getAggregate().IsPredefined(); + return this is AggregateType && getAggregate().IsPredefined(); } public PredefinedType getPredefType() { @@ -583,7 +460,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { if (isPredefType(PredefinedType.PT_G_EXPRESSION)) { - return AsAggregateType().GetTypeArgsThis()[0]; + return ((AggregateType)this).GetTypeArgsThis()[0]; } return this; @@ -595,9 +472,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (GetTypeKind()) { case TypeKind.TK_TypeParameterType: - return AsTypeParameterType().IsValueType(); + return ((TypeParameterType)this).IsValueType(); case TypeKind.TK_AggregateType: - return AsAggregateType().getAggregate().IsValueType(); + return ((AggregateType)this).getAggregate().IsValueType(); case TypeKind.TK_NullableType: return true; default: @@ -609,9 +486,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics switch (GetTypeKind()) { case TypeKind.TK_TypeParameterType: - return AsTypeParameterType().IsNonNullableValueType(); + return ((TypeParameterType)this).IsNonNullableValueType(); case TypeKind.TK_AggregateType: - return AsAggregateType().getAggregate().IsValueType(); + return ((AggregateType)this).getAggregate().IsValueType(); case TypeKind.TK_NullableType: return false; default: @@ -626,9 +503,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_NullType: return true; case TypeKind.TK_TypeParameterType: - return AsTypeParameterType().IsReferenceType(); + return ((TypeParameterType)this).IsReferenceType(); case TypeKind.TK_AggregateType: - return AsAggregateType().getAggregate().IsRefType(); + return ((AggregateType)this).getAggregate().IsRefType(); default: return false; } @@ -638,7 +515,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // be equivalent or convertible (like ANONMETHSYMs) public bool IsNeverSameType() { - return IsBoundLambdaType() || IsMethodGroupType() || (IsErrorType() && !AsErrorType().HasParent()); + return this is MethodGroupType || this is ErrorType err && !err.HasParent; } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeArray.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeArray.cs index e50e07eb99..414a895e91 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeArray.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeArray.cs @@ -21,8 +21,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public int Count => Items.Length; - public TypeParameterType ItemAsTypeParameterType(int i) => Items[i].AsTypeParameterType(); - public CType[] Items { get; } public CType this[int i] => Items[i]; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeFactory.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeFactory.cs index d201e4fd77..f737321150 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeFactory.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeFactory.cs @@ -55,20 +55,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return type; } - public OpenTypePlaceholderType CreateUnit() - { - OpenTypePlaceholderType type = new OpenTypePlaceholderType(); - type.SetTypeKind(TypeKind.TK_OpenTypePlaceholderType); - return type; - } - - public BoundLambdaType CreateAnonMethod() - { - BoundLambdaType type = new BoundLambdaType(); - type.SetTypeKind(TypeKind.TK_BoundLambdaType); - return type; - } - public MethodGroupType CreateMethodGroup() { MethodGroupType type = new MethodGroupType(); @@ -85,8 +71,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public ErrorType CreateError( Name name, - CType parent, - AssemblyQualifiedNamespaceSymbol pParentNS, Name nameText, TypeArray typeArgs) { @@ -94,8 +78,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics e.SetName(name); e.nameText = nameText; e.typeArgs = typeArgs; - e.SetTypeParent(parent); - e.SetNSParent(pParentNS); e.SetTypeKind(TypeKind.TK_ErrorType); return e; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeKind.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeKind.cs index f818f81dd9..323d0ee88f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeKind.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeKind.cs @@ -9,12 +9,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics TK_AggregateType, TK_VoidType, TK_NullType, - TK_OpenTypePlaceholderType, - TK_BoundLambdaType, - TK_UnboundLambdaType, TK_MethodGroupType, TK_ErrorType, - TK_NaturalIntegerType, TK_ArgumentListType, TK_ArrayType, TK_PointerType, diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeManager.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeManager.cs index 16f6ef4837..f3113125dc 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeManager.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeManager.cs @@ -8,7 +8,6 @@ using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; -using Microsoft.CSharp.RuntimeBinder.Errors; using Microsoft.CSharp.RuntimeBinder.Syntax; namespace Microsoft.CSharp.RuntimeBinder.Semantics @@ -25,8 +24,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Special types private readonly VoidType _voidType; private readonly NullType _nullType; - private readonly OpenTypePlaceholderType _typeUnit; - private readonly BoundLambdaType _typeAnonMeth; private readonly MethodGroupType _typeMethGrp; private readonly ArgumentListType _argListType; private readonly ErrorType _errorType; @@ -34,33 +31,24 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private readonly StdTypeVarColl _stvcMethod; private readonly StdTypeVarColl _stvcClass; - public TypeManager() + public TypeManager(BSYMMGR bsymmgr, PredefinedTypes predefTypes) { - _predefTypes = null; // Initialized via the Init call. - _BSymmgr = null; // Initialized via the Init call. _typeFactory = new TypeFactory(); _typeTable = new TypeTable(); // special types with their own symbol kind. - _errorType = _typeFactory.CreateError(null, null, null, null, null); + _errorType = _typeFactory.CreateError(null, null, null); _voidType = _typeFactory.CreateVoid(); _nullType = _typeFactory.CreateNull(); - _typeUnit = _typeFactory.CreateUnit(); - _typeAnonMeth = _typeFactory.CreateAnonMethod(); _typeMethGrp = _typeFactory.CreateMethodGroup(); _argListType = _typeFactory.CreateArgList(); - InitType(_errorType); _errorType.SetErrors(true); - InitType(_voidType); - InitType(_nullType); - InitType(_typeUnit); - InitType(_typeAnonMeth); - InitType(_typeMethGrp); - _stvcMethod = new StdTypeVarColl(); _stvcClass = new StdTypeVarColl(); + _BSymmgr = bsymmgr; + _predefTypes = predefTypes; } public void InitTypeFactory(SymbolTable table) @@ -68,10 +56,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _symbolTable = table; } - private void InitType(CType at) - { - } - private sealed class StdTypeVarColl { private readonly List prgptvs; @@ -214,7 +198,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // Store the old base class. AggregateType oldBaseType = agg.GetBaseClass(); - agg.SetBaseClass(_symbolTable.GetCTypeFromType(baseType).AsAggregateType()); + agg.SetBaseClass(_symbolTable.GetCTypeFromType(baseType) as AggregateType); pAggregate.GetBaseClass(); // Get the base type for the new agg type we're making. agg.SetBaseClass(oldBaseType); @@ -330,18 +314,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } public ErrorType GetErrorType( - CType pParentType, - AssemblyQualifiedNamespaceSymbol pParentNS, Name nameText, TypeArray typeArgs) { Debug.Assert(nameText != null); - Debug.Assert(pParentType == null || pParentNS == null); - if (pParentType == null && pParentNS == null) - { - // Use the root namespace as the parent. - pParentNS = _BSymmgr.GetRootNsAid(); - } if (typeArgs == null) { typeArgs = BSYMMGR.EmptyTypeArray(); @@ -350,30 +326,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Name name = _BSymmgr.GetNameFromPtrs(nameText, typeArgs); Debug.Assert(name != null); - ErrorType pError = null; - if (pParentType != null) - { - pError = _typeTable.LookupError(name, pParentType); - } - else - { - Debug.Assert(pParentNS != null); - pError = _typeTable.LookupError(name, pParentNS); - } + ErrorType pError = _typeTable.LookupError(name); if (pError == null) { // No existing error symbol. Create a new one. - pError = _typeFactory.CreateError(name, pParentType, pParentNS, nameText, typeArgs); + pError = _typeFactory.CreateError(name, nameText, typeArgs); pError.SetErrors(true); - if (pParentType != null) - { - _typeTable.InsertError(name, pParentType, pError); - } - else - { - _typeTable.InsertError(name, pParentNS, pError); - } + _typeTable.InsertError(name, pError); } else { @@ -395,16 +355,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return _nullType; } - private OpenTypePlaceholderType GetUnitType() - { - return _typeUnit; - } - - public BoundLambdaType GetAnonMethType() - { - return _typeAnonMeth; - } - public MethodGroupType GetMethGrpType() { return _typeMethGrp; @@ -420,10 +370,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return _errorType; } - public AggregateSymbol GetNullable() - { - return this.GetOptPredefAgg(PredefinedType.PT_G_OPTIONAL); - } + public AggregateSymbol GetNullable() => GetPredefAgg(PredefinedType.PT_G_OPTIONAL); private CType SubstType(CType typeSrc, TypeArray typeArgsCls, TypeArray typeArgsMeth, SubstTypeFlags grfst) { @@ -498,35 +445,32 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_NullType: case TypeKind.TK_VoidType: - case TypeKind.TK_OpenTypePlaceholderType: case TypeKind.TK_MethodGroupType: - case TypeKind.TK_BoundLambdaType: - case TypeKind.TK_UnboundLambdaType: - case TypeKind.TK_NaturalIntegerType: case TypeKind.TK_ArgumentListType: return type; case TypeKind.TK_ParameterModifierType: - typeDst = SubstTypeCore(typeSrc = type.AsParameterModifierType().GetParameterType(), pctx); - return (typeDst == typeSrc) ? type : GetParameterModifier(typeDst, type.AsParameterModifierType().isOut); + ParameterModifierType mod = (ParameterModifierType)type; + typeDst = SubstTypeCore(typeSrc = mod.GetParameterType(), pctx); + return (typeDst == typeSrc) ? type : GetParameterModifier(typeDst, mod.isOut); case TypeKind.TK_ArrayType: - typeDst = SubstTypeCore(typeSrc = type.AsArrayType().GetElementType(), pctx); - return (typeDst == typeSrc) ? type : GetArray(typeDst, type.AsArrayType().rank, type.AsArrayType().IsSZArray); + var arr = (ArrayType)type; + typeDst = SubstTypeCore(typeSrc = arr.GetElementType(), pctx); + return (typeDst == typeSrc) ? type : GetArray(typeDst, arr.rank, arr.IsSZArray); case TypeKind.TK_PointerType: - typeDst = SubstTypeCore(typeSrc = type.AsPointerType().GetReferentType(), pctx); + typeDst = SubstTypeCore(typeSrc = ((PointerType)type).GetReferentType(), pctx); return (typeDst == typeSrc) ? type : GetPointer(typeDst); case TypeKind.TK_NullableType: - typeDst = SubstTypeCore(typeSrc = type.AsNullableType().GetUnderlyingType(), pctx); + typeDst = SubstTypeCore(typeSrc = ((NullableType)type).GetUnderlyingType(), pctx); return (typeDst == typeSrc) ? type : GetNullable(typeDst); case TypeKind.TK_AggregateType: - if (type.AsAggregateType().GetTypeArgsAll().Count > 0) + AggregateType ats = (AggregateType)type; + if (ats.GetTypeArgsAll().Count > 0) { - AggregateType ats = type.AsAggregateType(); - TypeArray typeArgs = SubstTypeArray(ats.GetTypeArgsAll(), pctx); if (ats.GetTypeArgsAll() != typeArgs) return GetAggregate(ats.getAggregate(), typeArgs); @@ -534,28 +478,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return type; case TypeKind.TK_ErrorType: - if (type.AsErrorType().HasParent()) + ErrorType err = (ErrorType)type; + if (err.HasParent) { - ErrorType err = type.AsErrorType(); Debug.Assert(err.nameText != null && err.typeArgs != null); - - CType pParentType = null; - if (err.HasTypeParent()) - { - pParentType = SubstTypeCore(err.GetTypeParent(), pctx); - } - TypeArray typeArgs = SubstTypeArray(err.typeArgs, pctx); - if (typeArgs != err.typeArgs || (err.HasTypeParent() && pParentType != err.GetTypeParent())) + if (typeArgs != err.typeArgs) { - return GetErrorType(pParentType, err.GetNSParent(), err.nameText, typeArgs); + return GetErrorType(err.nameText, typeArgs); } } + return type; case TypeKind.TK_TypeParameterType: { - TypeParameterSymbol tvs = type.AsTypeParameterType().GetTypeParameterSymbol(); + TypeParameterSymbol tvs = ((TypeParameterType)type).GetTypeParameterSymbol(); int index = tvs.GetIndexInTotalParameters(); if (tvs.IsMethodTypeParameter()) { @@ -642,20 +580,20 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_NullType: case TypeKind.TK_VoidType: - case TypeKind.TK_OpenTypePlaceholderType: // There should only be a single instance of these. Debug.Assert(typeDst.GetTypeKind() != typeSrc.GetTypeKind()); return false; case TypeKind.TK_ArrayType: - if (typeDst.GetTypeKind() != TypeKind.TK_ArrayType || typeDst.AsArrayType().rank != typeSrc.AsArrayType().rank || typeDst.AsArrayType().IsSZArray != typeSrc.AsArrayType().IsSZArray) + ArrayType arrSrc = (ArrayType)typeSrc; + if (!(typeDst is ArrayType arrDst) || arrDst.rank != arrSrc.rank || arrDst.IsSZArray != arrSrc.IsSZArray) return false; goto LCheckBases; case TypeKind.TK_ParameterModifierType: - if (typeDst.GetTypeKind() != TypeKind.TK_ParameterModifierType || + if (!(typeDst is ParameterModifierType modDest) || ((pctx.grfst & SubstTypeFlags.NoRefOutDifference) == 0 && - typeDst.AsParameterModifierType().isOut != typeSrc.AsParameterModifierType().isOut)) + modDest.isOut != ((ParameterModifierType)typeSrc).isOut)) return false; goto LCheckBases; @@ -669,11 +607,10 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics goto LRecurse; case TypeKind.TK_AggregateType: - if (typeDst.GetTypeKind() != TypeKind.TK_AggregateType) + if (!(typeDst is AggregateType atsDst)) return false; { // BLOCK - AggregateType atsSrc = typeSrc.AsAggregateType(); - AggregateType atsDst = typeDst.AsAggregateType(); + AggregateType atsSrc = (AggregateType)typeSrc; if (atsSrc.getAggregate() != atsDst.getAggregate()) return false; @@ -690,52 +627,33 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; case TypeKind.TK_ErrorType: - if (!typeDst.IsErrorType() || !typeSrc.AsErrorType().HasParent() || !typeDst.AsErrorType().HasParent()) + ErrorType errSrc = (ErrorType)typeSrc; + if (!(typeDst is ErrorType errDst) || !errSrc.HasParent || !errDst.HasParent) return false; + + { + Debug.Assert(errSrc.nameText != null && errSrc.typeArgs != null); + Debug.Assert(errDst.nameText != null && errDst.typeArgs != null); + + if (errSrc.nameText != errDst.nameText || errSrc.typeArgs.Count != errDst.typeArgs.Count + || errSrc.HasParent != errDst.HasParent) { - ErrorType errSrc = typeSrc.AsErrorType(); - ErrorType errDst = typeDst.AsErrorType(); - Debug.Assert(errSrc.nameText != null && errSrc.typeArgs != null); - Debug.Assert(errDst.nameText != null && errDst.typeArgs != null); - - if (errSrc.nameText != errDst.nameText || errSrc.typeArgs.Count != errDst.typeArgs.Count) - return false; - - if (errSrc.HasTypeParent() != errDst.HasTypeParent()) - { - return false; - } - if (errSrc.HasTypeParent()) - { - if (errSrc.GetTypeParent() != errDst.GetTypeParent()) - { - return false; - } - if (!SubstEqualTypesCore(errDst.GetTypeParent(), errSrc.GetTypeParent(), pctx)) - { - return false; - } - } - else - { - if (errSrc.GetNSParent() != errDst.GetNSParent()) - { - return false; - } - } - - // All the args must unify. - for (int i = 0; i < errSrc.typeArgs.Count; i++) - { - if (!SubstEqualTypesCore(errDst.typeArgs[i], errSrc.typeArgs[i], pctx)) - return false; - } + return false; } + + // All the args must unify. + for (int i = 0; i < errSrc.typeArgs.Count; i++) + { + if (!SubstEqualTypesCore(errDst.typeArgs[i], errSrc.typeArgs[i], pctx)) + return false; + } + } + return true; case TypeKind.TK_TypeParameterType: { // BLOCK - TypeParameterSymbol tvs = typeSrc.AsTypeParameterType().GetTypeParameterSymbol(); + TypeParameterSymbol tvs = ((TypeParameterType)typeSrc).GetTypeParameterSymbol(); int index = tvs.GetIndexInTotalParameters(); if (tvs.IsMethodTypeParameter()) @@ -791,7 +709,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_NullType: case TypeKind.TK_VoidType: - case TypeKind.TK_OpenTypePlaceholderType: // There should only be a single instance of these. Debug.Assert(typeFind.GetTypeKind() != type.GetTypeKind()); return false; @@ -805,7 +722,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_AggregateType: { // BLOCK - AggregateType ats = type.AsAggregateType(); + AggregateType ats = (AggregateType)type; for (int i = 0; i < ats.GetTypeArgsAll().Count; i++) { @@ -816,9 +733,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; case TypeKind.TK_ErrorType: - if (type.AsErrorType().HasParent()) + ErrorType err = (ErrorType)type; + if (err.HasParent) { - ErrorType err = type.AsErrorType(); Debug.Assert(err.nameText != null && err.typeArgs != null); for (int i = 0; i < err.typeArgs.Count; i++) @@ -826,12 +743,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics if (TypeContainsType(err.typeArgs[i], typeFind)) return true; } - if (err.HasTypeParent()) - { - type = err.GetTypeParent(); - goto LRecurse; - } } + return false; case TypeKind.TK_TypeParameterType: @@ -848,11 +761,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics Debug.Assert(false, "Bad Symbol kind in TypeContainsTyVars"); return false; - case TypeKind.TK_UnboundLambdaType: - case TypeKind.TK_BoundLambdaType: case TypeKind.TK_NullType: case TypeKind.TK_VoidType: - case TypeKind.TK_OpenTypePlaceholderType: case TypeKind.TK_MethodGroupType: return false; @@ -865,7 +775,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics case TypeKind.TK_AggregateType: { // BLOCK - AggregateType ats = type.AsAggregateType(); + AggregateType ats = (AggregateType)type; for (int i = 0; i < ats.GetTypeArgsAll().Count; i++) { @@ -878,9 +788,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; case TypeKind.TK_ErrorType: - if (type.AsErrorType().HasParent()) + ErrorType err = (ErrorType)type; + if (err.HasParent) { - ErrorType err = type.AsErrorType(); Debug.Assert(err.nameText != null && err.typeArgs != null); for (int i = 0; i < err.typeArgs.Count; i++) @@ -890,18 +800,14 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } } - if (err.HasTypeParent()) - { - type = err.GetTypeParent(); - goto LRecurse; - } } + return false; case TypeKind.TK_TypeParameterType: if (typeVars != null && typeVars.Count > 0) { - int ivar = type.AsTypeParameterType().GetIndexInTotalParameters(); + int ivar = ((TypeParameterType)type).GetIndexInTotalParameters(); return ivar < typeVars.Count && type == typeVars[ivar]; } return true; @@ -923,25 +829,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return false; } - public AggregateSymbol GetReqPredefAgg(PredefinedType pt) - { - return _predefTypes.GetReqPredefAgg(pt); - } - - public AggregateSymbol GetOptPredefAgg(PredefinedType pt) - { - return _predefTypes.GetOptPredefAgg(pt); - } - - public TypeArray CreateArrayOfUnitTypes(int cSize) - { - CType[] ppArray = new CType[cSize]; - for (int i = 0; i < cSize; i++) - { - ppArray[i] = GetUnitType(); - } - return _BSymmgr.AllocParams(cSize, ppArray); - } + public AggregateSymbol GetPredefAgg(PredefinedType pt) => _predefTypes.GetPredefinedAggregate(pt); public TypeArray ConcatenateTypeArrays(TypeArray pTypeArray1, TypeArray pTypeArray2) { @@ -977,7 +865,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public CType SubstType(CType typeSrc, CType typeCls, TypeArray typeArgsMeth) { - return SubstType(typeSrc, typeCls.IsAggregateType() ? typeCls.AsAggregateType().GetTypeArgsAll() : null, typeArgsMeth); + return SubstType(typeSrc, (typeCls as AggregateType)?.GetTypeArgsAll(), typeArgsMeth); } public TypeArray SubstTypeArray(TypeArray taSrc, AggregateType atsCls, TypeArray typeArgsMeth) @@ -992,7 +880,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics private bool SubstEqualTypes(CType typeDst, CType typeSrc, CType typeCls, TypeArray typeArgsMeth) { - return SubstEqualTypes(typeDst, typeSrc, typeCls.IsAggregateType() ? typeCls.AsAggregateType().GetTypeArgsAll() : null, typeArgsMeth, SubstTypeFlags.NormNone); + return SubstEqualTypes(typeDst, typeSrc, (typeCls as AggregateType)?.GetTypeArgsAll(), typeArgsMeth, SubstTypeFlags.NormNone); } public bool SubstEqualTypes(CType typeDst, CType typeSrc, CType typeCls) @@ -1029,12 +917,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return pTypeParameter; } - internal void Init(BSYMMGR bsymmgr, PredefinedTypes predefTypes) - { - _BSymmgr = bsymmgr; - _predefTypes = predefTypes; - } - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // RUNTIME BINDER ONLY CHANGE // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -1062,16 +944,16 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } // These guys have no accessibility concerns. - Debug.Assert(!typeSrc.IsVoidType() && !typeSrc.IsErrorType() && !typeSrc.IsTypeParameterType()); + Debug.Assert(!(typeSrc is VoidType) && !(typeSrc is ErrorType) && !(typeSrc is TypeParameterType)); - if (typeSrc.IsParameterModifierType() || typeSrc.IsPointerType()) + if (typeSrc is ParameterModifierType || typeSrc is PointerType) { // We cannot vary these. return false; } CType intermediateType; - if ((typeSrc.isInterfaceType() || typeSrc.isDelegateType()) && TryVarianceAdjustmentToGetAccessibleType(semanticChecker, bindingContext, typeSrc.AsAggregateType(), out intermediateType)) + if (typeSrc is AggregateType aggSrc && (aggSrc.isInterfaceType() || aggSrc.isDelegateType()) && TryVarianceAdjustmentToGetAccessibleType(semanticChecker, bindingContext, aggSrc, out intermediateType)) { // If we have an interface or delegate type, then it can potentially be varied by its type arguments // to produce an accessible type, and if that's the case, then return that. @@ -1082,7 +964,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - if (typeSrc.IsArrayType() && TryArrayVarianceAdjustmentToGetAccessibleType(semanticChecker, bindingContext, typeSrc.AsArrayType(), out intermediateType)) + if (typeSrc is ArrayType arrSrc && TryArrayVarianceAdjustmentToGetAccessibleType(semanticChecker, bindingContext, arrSrc, out intermediateType)) { // Similarly to the interface and delegate case, arrays are covariant in their element type and // so we can potentially produce an array type that is accessible. @@ -1093,31 +975,30 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return true; } - if (typeSrc.IsNullableType()) + if (typeSrc is NullableType) { // We have an inaccessible nullable type, which means that the best we can do is System.ValueType. - typeDst = this.GetOptPredefAgg(PredefinedType.PT_VALUE).getThisType(); + typeDst = GetPredefAgg(PredefinedType.PT_VALUE).getThisType(); Debug.Assert(semanticChecker.CheckTypeAccess(typeDst, bindingContext.ContextForMemberLookup)); return true; } - if (typeSrc.IsArrayType()) + if (typeSrc is ArrayType) { // We have an inaccessible array type for which we could not earlier find a better array type // with a covariant conversion, so the best we can do is System.Array. - typeDst = this.GetReqPredefAgg(PredefinedType.PT_ARRAY).getThisType(); + typeDst = GetPredefAgg(PredefinedType.PT_ARRAY).getThisType(); Debug.Assert(semanticChecker.CheckTypeAccess(typeDst, bindingContext.ContextForMemberLookup)); return true; } - Debug.Assert(typeSrc.IsAggregateType()); + Debug.Assert(typeSrc is AggregateType); - if (typeSrc.IsAggregateType()) + if (typeSrc is AggregateType aggType) { // We have an AggregateType, so recurse on its base class. - AggregateType aggType = typeSrc.AsAggregateType(); AggregateType baseType = aggType.GetBaseClass(); if (baseType == null) @@ -1125,7 +1006,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics // This happens with interfaces, for instance. But in that case, the // conversion to object does exist, is an implicit reference conversion, // and so we will use it. - baseType = this.GetReqPredefAgg(PredefinedType.PT_OBJECT).getThisType(); + baseType = GetPredefAgg(PredefinedType.PT_OBJECT).getThisType(); } return GetBestAccessibleType(semanticChecker, bindingContext, baseType, out typeDst); @@ -1164,7 +1045,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics continue; } - if (!typeArgs[i].IsRefType() || !typeParams[i].AsTypeParameterType().Covariant) + if (!typeArgs[i].IsRefType() || !((TypeParameterType)typeParams[i]).Covariant) { // This guy is inaccessible, and we are not going to be able to vary him, so we need to fail. return false; diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeParameterType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeParameterType.cs index f6a5b49cb6..8d684daca4 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeParameterType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeParameterType.cs @@ -15,33 +15,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public ParentSymbol GetOwningSymbol() { return _pTypeParameterSymbol.parent; } - - public bool DependsOn(TypeParameterType pType) - { - Debug.Assert(pType != null); - - // * If a type parameter T is used as a constraint for type parameter S - // then S depends on T. - // * If a type parameter S depends on a type parameter T and T depends on - // U then S depends on U. - - TypeArray pConstraints = GetBounds(); - for (int iConstraint = 0; iConstraint < pConstraints.Count; ++iConstraint) - { - CType pConstraint = pConstraints[iConstraint]; - if (pConstraint == pType) - { - return true; - } - if (pConstraint.IsTypeParameterType() && - pConstraint.AsTypeParameterType().DependsOn(pType)) - { - return true; - } - } - return false; - } - // Forward calls into the symbol. public bool Covariant { get { return _pTypeParameterSymbol.Covariant; } } public bool Invariant { get { return _pTypeParameterSymbol.Invariant; } } @@ -56,8 +29,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public int GetIndexInOwnParameters() { return _pTypeParameterSymbol.GetIndexInOwnParameters(); } public int GetIndexInTotalParameters() { return _pTypeParameterSymbol.GetIndexInTotalParameters(); } public TypeArray GetBounds() { return _pTypeParameterSymbol.GetBounds(); } - public TypeArray GetInterfaceBounds() { return _pTypeParameterSymbol.GetInterfaceBounds(); } - public AggregateType GetEffectiveBaseClass() { return _pTypeParameterSymbol.GetEffectiveBaseClass(); } private TypeParameterSymbol _pTypeParameterSymbol; } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeTable.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeTable.cs index 63b89022ed..2329a3382d 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeTable.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeTable.cs @@ -48,12 +48,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { // Two way hashes private readonly Dictionary, AggregateType> _pAggregateTable; - private readonly Dictionary, ErrorType> _pErrorWithTypeParentTable; - private readonly Dictionary, ErrorType> _pErrorWithNamespaceParentTable; private readonly Dictionary, ArrayType> _pArrayTable; private readonly Dictionary, ParameterModifierType> _pParameterModifierTable; // One way hashes + private readonly Dictionary _pErrorWithNamespaceParentTable; private readonly Dictionary _pPointerTable; private readonly Dictionary _pNullableTable; private readonly Dictionary _pTypeParameterTable; @@ -61,8 +60,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics public TypeTable() { _pAggregateTable = new Dictionary, AggregateType>(); - _pErrorWithNamespaceParentTable = new Dictionary, ErrorType>(); - _pErrorWithTypeParentTable = new Dictionary, ErrorType>(); + _pErrorWithNamespaceParentTable = new Dictionary(); _pArrayTable = new Dictionary, ArrayType>(); _pParameterModifierTable = new Dictionary, ParameterModifierType>(); _pPointerTable = new Dictionary(); @@ -90,38 +88,13 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics _pAggregateTable.Add(new KeyPair(pAggregateSymbol, pName), pAggregate); } - public ErrorType LookupError(Name pName, CType pParentType) - { - var key = new KeyPair(pParentType, pName); - ErrorType result; - if (_pErrorWithTypeParentTable.TryGetValue(key, out result)) - { - return result; - } - return null; - } + public ErrorType LookupError(Name pName) => + _pErrorWithNamespaceParentTable.TryGetValue(pName, out ErrorType result) ? result : null; - public ErrorType LookupError(Name pName, AssemblyQualifiedNamespaceSymbol pParentNS) + public void InsertError(Name pName, ErrorType pError) { - var key = new KeyPair(pParentNS, pName); - ErrorType result; - if (_pErrorWithNamespaceParentTable.TryGetValue(key, out result)) - { - return result; - } - return null; - } - - public void InsertError(Name pName, CType pParentType, ErrorType pError) - { - Debug.Assert(LookupError(pName, pParentType) == null); - _pErrorWithTypeParentTable.Add(new KeyPair(pParentType, pName), pError); - } - - public void InsertError(Name pName, AssemblyQualifiedNamespaceSymbol pParentNS, ErrorType pError) - { - Debug.Assert(LookupError(pName, pParentNS) == null); - _pErrorWithNamespaceParentTable.Add(new KeyPair(pParentNS, pName), pError); + Debug.Assert(LookupError(pName) == null); + _pErrorWithNamespaceParentTable.Add(pName, pError); } public ArrayType LookupArray(Name pName, CType pElementType) diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UnaOpSig.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UnaOpSig.cs index 4953078112..cbbe443ca7 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UnaOpSig.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UnaOpSig.cs @@ -56,7 +56,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics this.cuosSkip = uos.cuosSkip; this.pfn = uos.pfn; this.fnkind = uos.fnkind; - _type = pt != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetOptPDT(pt) : null; + _type = pt != PredefinedType.PT_UNDEFINEDINDEX ? fnc.GetPredefindType(pt) : null; _grflt = LiftFlags.None; } public bool FPreDef() diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UtilityTypeExtensions.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UtilityTypeExtensions.cs index 9d09bf4d77..dc015c394a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UtilityTypeExtensions.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UtilityTypeExtensions.cs @@ -10,21 +10,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics { internal static class UtilityTypeExtensions { - private static IEnumerable InterfaceAndBases(this AggregateType type) - { - Debug.Assert(type != null); - yield return type; - foreach (AggregateType t in type.GetIfacesAll().Items) - yield return t; - } - - private static IEnumerable AllConstraintInterfaces(this TypeArray constraints) - { - Debug.Assert(constraints != null); - foreach (AggregateType c in constraints.Items) - foreach (AggregateType t in c.InterfaceAndBases()) - yield return t; - } private static IEnumerable TypeAndBaseClasses(this AggregateType type) { @@ -53,25 +38,8 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics return ats.TypeAndBaseClassInterfaces(); } - if (type is TypeParameterType typeParameter) - { - return AllPossibleInterfaces(typeParameter); - } - + Debug.Assert(type is NullableType); // Is even this case possible? return Array.Empty(); } - - private static IEnumerable AllPossibleInterfaces(TypeParameterType type) - { - foreach (AggregateType t in type.GetEffectiveBaseClass().TypeAndBaseClassInterfaces()) - { - yield return t; - } - - foreach (AggregateType t in type.GetInterfaceBounds().AllConstraintInterfaces()) - { - yield return t; - } - } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/WithType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/WithType.cs index 0b1e167061..41c5d9944c 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/WithType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/WithType.cs @@ -249,7 +249,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics } public MethWithInst(MethPropWithInst mpwi) { - Set(mpwi.Sym.AsMethodSymbol(), mpwi.Ats, mpwi.TypeArgs); + Set(mpwi.Sym as MethodSymbol, mpwi.Ats, mpwi.TypeArgs); } } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/SymbolTable.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/SymbolTable.cs index 3e46a9b01a..935b6991f5 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/SymbolTable.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/SymbolTable.cs @@ -19,8 +19,8 @@ namespace Microsoft.CSharp.RuntimeBinder { ///////////////////////////////////////////////////////////////////////////////// // Members - private HashSet _typesWithConversionsLoaded; - private HashSet _namesLoadedForEachType; + private readonly HashSet _typesWithConversionsLoaded = new HashSet(); + private readonly HashSet _namesLoadedForEachType = new HashSet(); // Members from the managed binder. private readonly SYMTBL _symbolTable; @@ -78,16 +78,6 @@ namespace Microsoft.CSharp.RuntimeBinder _typeManager = typeManager; _bsymmgr = bsymmgr; _semanticChecker = semanticChecker; - - ClearCache(); - } - - ///////////////////////////////////////////////////////////////////////////////// - - private void ClearCache() - { - _typesWithConversionsLoaded = new HashSet(); - _namesLoadedForEachType = new HashSet(); _rootNamespace = _bsymmgr.GetRootNS(); // Now populate object. @@ -106,18 +96,14 @@ namespace Microsoft.CSharp.RuntimeBinder { callingType = callingType.GetGenericTypeDefinition(); } + if (name == SpecialNames.Indexer) { - // What about named indexers? - if (callingType == typeof(string)) - { - name = "Chars"; - } - else - { - name = "Item"; - } + // If we don't find an indexer name for this type, use SpecialNames.Indexer as a key on the + // empty results we'll get, so that those empty results gets cached. + name = callingType.GetIndexerName() ?? SpecialNames.Indexer; } + NameHashKey key = new NameHashKey(callingType, name); // If we've already populated this name/type pair, then just leave. @@ -127,29 +113,7 @@ namespace Microsoft.CSharp.RuntimeBinder } // Add the names. - IEnumerable members = AddNamesOnType(key); - - // Take each member and load each type's conversions into the symbol table. - if (members != null) - { - foreach (MemberInfo member in members) - { - if (member is MethodInfo) - { - foreach (ParameterInfo param in (member as MethodInfo).GetParameters()) - { - AddConversionsForType(param.ParameterType); - } - } - else if (member is ConstructorInfo) - { - foreach (ParameterInfo param in (member as ConstructorInfo).GetParameters()) - { - AddConversionsForType(param.ParameterType); - } - } - } - } + AddNamesOnType(key); // Take each type argument and load its conversions into the symbol table. if (typeArguments != null) @@ -174,13 +138,13 @@ namespace Microsoft.CSharp.RuntimeBinder { CType type = callingObject.Type; - if (type.IsArrayType()) + if (type is ArrayType) { - type = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_ARRAY); + type = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_ARRAY); } - if (type.IsNullableType()) + if (type is NullableType nub) { - type = type.AsNullableType().GetAts(_semanticChecker.GetSymbolLoader().GetErrorContext()); + type = nub.GetAts(); } if (!mem.Lookup( @@ -190,8 +154,7 @@ namespace Microsoft.CSharp.RuntimeBinder context, GetName(name), arity, - MemLookFlags.TypeVarsAllowed | - (allowSpecialNames ? 0 : MemLookFlags.UserCallable) | + (allowSpecialNames ? 0 : MemLookFlags.UserCallable) | (name == SpecialNames.Indexer ? MemLookFlags.Indexer : 0) | (name == SpecialNames.Constructor ? MemLookFlags.Ctor : 0) | (requireInvocable ? MemLookFlags.MustBeInvocable : 0))) @@ -201,10 +164,16 @@ namespace Microsoft.CSharp.RuntimeBinder return mem.SwtFirst(); } - ///////////////////////////////////////////////////////////////////////////////// + private void AddParameterConversions(MethodBase method) + { + foreach (ParameterInfo param in method.GetParameters()) + { + AddConversionsForType(param.ParameterType); + } + } #region InheritanceHierarchy - private IEnumerable AddNamesOnType(NameHashKey key) + private void AddNamesOnType(NameHashKey key) { Debug.Assert(!_namesLoadedForEachType.Contains(key)); @@ -212,15 +181,13 @@ namespace Microsoft.CSharp.RuntimeBinder List inheritance = CreateInheritanceHierarchyList(key.type); // Now add every method as it appears in the inheritance hierarchy. - return AddNamesInInheritanceHierarchy(key.name, inheritance); + AddNamesInInheritanceHierarchy(key.name, inheritance); } ///////////////////////////////////////////////////////////////////////////////// - private IEnumerable AddNamesInInheritanceHierarchy(string name, List inheritance) + private void AddNamesInInheritanceHierarchy(string name, List inheritance) { - IEnumerable result = Array.Empty(); - for (int i = inheritance.Count - 1; i >= 0; --i) { Type type = inheritance[i]; @@ -228,77 +195,88 @@ namespace Microsoft.CSharp.RuntimeBinder { type = type.GetGenericTypeDefinition(); } - NameHashKey key = new NameHashKey(type, name); + + if (!_namesLoadedForEachType.Add(new NameHashKey(type, name))) + { + continue; + } // Now loop over all methods and add them. - IEnumerable members = Enumerable.Where(type.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static), - member => member.Name == name && member.DeclaringType == type); - IEnumerable events = Enumerable.Where(type.GetRuntimeEvents(), - member => member.Name == name && member.DeclaringType == type); - - if (members.Any()) + IEnumerator memberEn = type + .GetMembers( + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static) + .Where(member => member.DeclaringType == type && member.Name == name).GetEnumerator(); + if (memberEn.MoveNext()) { + List events = null; CType cType = GetCTypeFromType(type); - if (!(cType is AggregateType)) + if (!(cType is AggregateType aggType)) continue; - AggregateSymbol aggregate = (cType as AggregateType).getAggregate(); + AggregateSymbol aggregate = aggType.getAggregate(); FieldSymbol addedField = null; // We need to add fields before the actual events, so do the first iteration - // excludint events. - foreach (MemberInfo member in members) + // excluding events. + do { - if (member is MethodInfo) + MemberInfo member = memberEn.Current; + if (member is MethodInfo method) { - MethodKindEnum kind = MethodKindEnum.Actual; - if (member.Name == SpecialNames.Invoke) + MethodKindEnum kind; + switch (member.Name) { - kind = MethodKindEnum.Invoke; + case SpecialNames.Invoke: + kind = MethodKindEnum.Invoke; + break; + + case SpecialNames.ImplicitConversion: + kind = MethodKindEnum.ImplicitConv; + break; + + case SpecialNames.ExplicitConversion: + kind = MethodKindEnum.ExplicitConv; + break; + + default: + kind = MethodKindEnum.Actual; + break; } - else if (member.Name == SpecialNames.ImplicitConversion) - { - kind = MethodKindEnum.ImplicitConv; - } - else if (member.Name == SpecialNames.ExplicitConversion) - { - kind = MethodKindEnum.ExplicitConv; - } - AddMethodToSymbolTable( - member, - aggregate, - kind); + + AddMethodToSymbolTable(method, aggregate, kind); + AddParameterConversions(method); } - else if (member is ConstructorInfo) + else if (member is ConstructorInfo ctor) { - AddMethodToSymbolTable( - member, - aggregate, - MethodKindEnum.Constructor); + AddMethodToSymbolTable(ctor, aggregate, MethodKindEnum.Constructor); + AddParameterConversions(ctor); } - else if (member is PropertyInfo) + else if (member is PropertyInfo prop) { - AddPropertyToSymbolTable(member as PropertyInfo, aggregate); + AddPropertyToSymbolTable(prop, aggregate); } - else if (member is FieldInfo) + else if (member is FieldInfo field) { // Store this field so that if we also find an event, we can // mark it as the backing field of the event. Debug.Assert(addedField == null); - addedField = AddFieldToSymbolTable(member as FieldInfo, aggregate); + addedField = AddFieldToSymbolTable(field, aggregate); + } + else if (member is EventInfo e) + { + // Store events until after all fields + (events = events ?? new List()).Add(e); + } + } while (memberEn.MoveNext()); + + if (events != null) + { + foreach (EventInfo e in events) + { + AddEventToSymbolTable(e, aggregate, addedField); } } - foreach (EventInfo e in events) - { - AddEventToSymbolTable(e, aggregate, addedField); - } - - result = result.Concat(members); } - - _namesLoadedForEachType.Add(key); } - - return result; } ///////////////////////////////////////////////////////////////////////////////// @@ -343,7 +321,7 @@ namespace Microsoft.CSharp.RuntimeBinder CType ctype = GetCTypeFromType(type); if (ctype.IsWindowsRuntimeType()) { - TypeArray collectioniFaces = ctype.AsAggregateType().GetWinRTCollectionIfacesAll(_semanticChecker.GetSymbolLoader()); + TypeArray collectioniFaces = ((AggregateType)ctype).GetWinRTCollectionIfacesAll(_semanticChecker.SymbolLoader); for (int i = 0; i < collectioniFaces.Count; i++) { @@ -404,7 +382,7 @@ namespace Microsoft.CSharp.RuntimeBinder for (int i = 0; i < genericArguments.Length; i++) { Type t = genericArguments[i]; - ctypes[i].AsTypeParameterType().GetTypeParameterSymbol().SetBounds( + ((TypeParameterType)ctypes[i]).GetTypeParameterSymbol().SetBounds( _bsymmgr.AllocParams( GetCTypeArrayFromTypes(t.GetGenericParameterConstraints()))); } @@ -446,7 +424,7 @@ namespace Microsoft.CSharp.RuntimeBinder continue; } - CType ctype = null; + CType ctype; if (t.IsGenericParameter && t.DeclaringType == genericDefinition) { ctype = LoadClassTypeParameter(agg, t); @@ -458,7 +436,7 @@ namespace Microsoft.CSharp.RuntimeBinder // We check to make sure we own the type parameter - this is because we're // currently calculating TypeArgsThis, NOT TypeArgsAll. - if (ctype.AsTypeParameterType().GetOwningSymbol() == agg) + if (((TypeParameterType)ctype).GetOwningSymbol() == agg) { ctypes.Add(ctype); } @@ -472,7 +450,7 @@ namespace Microsoft.CSharp.RuntimeBinder private TypeParameterType LoadClassTypeParameter(AggregateSymbol parent, Type t) { - for (AggregateSymbol p = parent; p != null; p = p.parent.IsAggregateSymbol() ? p.parent.AsAggregateSymbol() : null) + for (AggregateSymbol p = parent; p != null; p = p.parent as AggregateSymbol) { for (TypeParameterSymbol typeParam = _bsymmgr.LookupAggMember( GetName(t), p, symbmask_t.MASK_TypeParameterSymbol) as TypeParameterSymbol; @@ -554,8 +532,6 @@ namespace Microsoft.CSharp.RuntimeBinder if (t.DeclaringMethod != null) { - MethodBase parentMethod = t.DeclaringMethod; - if (parentType.GetGenericArguments() == null || pos >= parentType.GetGenericArguments().Length) { return t; @@ -589,16 +565,18 @@ namespace Microsoft.CSharp.RuntimeBinder { for (Symbol sym = parent.firstChild; sym != null; sym = sym.nextChild) { - if (!sym.IsTypeParameterSymbol()) + if (!(sym is TypeParameterSymbol parSym)) { continue; } - if (AreTypeParametersEquivalent(sym.AsTypeParameterSymbol().GetTypeParameterType().AssociatedSystemType, t)) + TypeParameterType type = parSym.GetTypeParameterType(); + if (AreTypeParametersEquivalent(type.AssociatedSystemType, t)) { - return sym.AsTypeParameterSymbol().GetTypeParameterType(); + return type; } } + return AddTypeParameterToSymbolTable(null, parent, t, false); } @@ -691,7 +669,7 @@ namespace Microsoft.CSharp.RuntimeBinder Type t = o as Type; Name name = null; name = GetName(t); - next = _symbolTable.LookupSym(name, current, symbmask_t.MASK_AggregateSymbol).AsAggregateSymbol(); + next = _symbolTable.LookupSym(name, current, symbmask_t.MASK_AggregateSymbol) as AggregateSymbol; // Make sure we match arity as well when we find an aggregate. if (next != null) @@ -743,9 +721,9 @@ namespace Microsoft.CSharp.RuntimeBinder { // If we had an aggregate type, its possible we're not at the end. // This will happen for nullable for instance. - if (ctype.IsAggregateType()) + if (ctype is AggregateType cat) { - next = ctype.AsAggregateType().GetOwningAggregate(); + next = cat.GetOwningAggregate(); } else { @@ -762,7 +740,7 @@ namespace Microsoft.CSharp.RuntimeBinder if (t == type) { - ret = GetConstructedType(type, next.AsAggregateSymbol()); + ret = GetConstructedType(type, next as AggregateSymbol); break; } } @@ -870,7 +848,7 @@ namespace Microsoft.CSharp.RuntimeBinder // If the generic argument for nullable is our child, then we're // declaring the initial Nullable. AggregateSymbol agg = _symbolTable.LookupSym( - GetName(t), parent, symbmask_t.MASK_AggregateSymbol).AsAggregateSymbol(); + GetName(t), parent, symbmask_t.MASK_AggregateSymbol) as AggregateSymbol; if (agg != null) { agg = FindSymWithMatchingArity(agg, t); @@ -917,8 +895,6 @@ namespace Microsoft.CSharp.RuntimeBinder if (t.IsGenericParameter && t.DeclaringMethod != null) { MethodBase methodBase = t.DeclaringMethod; - ParameterInfo[] parameters = methodBase.GetParameters(); - bool bAdded = false; #if UNSUPPORTEDAPI foreach (MethodInfo methinfo in Enumerable.Where(t.DeclaringType.GetRuntimeMethods(), m => m.MetadataToken == methodBase.MetadataToken)) @@ -975,33 +951,30 @@ namespace Microsoft.CSharp.RuntimeBinder private NamespaceSymbol AddNamespaceToSymbolTable(NamespaceOrAggregateSymbol parent, string sz) { Name name = GetName(sz); - NamespaceSymbol ns = _symbolTable.LookupSym(name, parent, symbmask_t.MASK_NamespaceSymbol).AsNamespaceSymbol(); - if (ns == null) - { - ns = _symFactory.CreateNamespace(name, parent as NamespaceSymbol); - } - - return ns; + return _symbolTable.LookupSym(name, parent, symbmask_t.MASK_NamespaceSymbol) as NamespaceSymbol + ?? _symFactory.CreateNamespace(name, parent as NamespaceSymbol); } #endregion #region CTypeFromType ///////////////////////////////////////////////////////////////////////////////// - internal CType[] GetCTypeArrayFromTypes(IList types) + internal CType[] GetCTypeArrayFromTypes(Type[] types) { - if (types == null) + Debug.Assert(types != null); + + int length = types.Length; + if (length == 0) { - return null; + return Array.Empty(); } - CType[] ctypes = new CType[types.Count]; - - int i = 0; - foreach (Type t in types) + CType[] ctypes = new CType[length]; + for (int i = 0; i < types.Length; i++) { + Type t = types[i]; Debug.Assert(t != null); - ctypes[i++] = GetCTypeFromType(t); + ctypes[i] = GetCTypeFromType(t); } return ctypes; @@ -1036,7 +1009,7 @@ namespace Microsoft.CSharp.RuntimeBinder else if (type.IsEnum) { kind = AggKindEnum.Enum; - agg.SetUnderlyingType(GetCTypeFromType(Enum.GetUnderlyingType(type)).AsAggregateType()); + agg.SetUnderlyingType((AggregateType)GetCTypeFromType(Enum.GetUnderlyingType(type))); } else if (type.IsValueType) { @@ -1115,9 +1088,9 @@ namespace Microsoft.CSharp.RuntimeBinder for (int i = 0; i < agg.GetTypeVars().Count; i++) { Type t = genericArguments[i]; - if (agg.GetTypeVars()[i].IsTypeParameterType()) + if (agg.GetTypeVars()[i] is TypeParameterType typeVar) { - agg.GetTypeVars()[i].AsTypeParameterType().GetTypeParameterSymbol().SetBounds( + typeVar.GetTypeParameterSymbol().SetBounds( _bsymmgr.AllocParams( GetCTypeArrayFromTypes(t.GetGenericParameterConstraints()))); } @@ -1132,16 +1105,17 @@ namespace Microsoft.CSharp.RuntimeBinder { typeName = type.GetGenericTypeDefinition().FullName; } - if (typeName != null && PredefinedTypeFacts.IsPredefinedType(typeName)) + if (typeName != null) { - PredefinedTypes.InitializePredefinedType(agg, PredefinedTypeFacts.GetPredefTypeIndex(typeName)); + PredefinedType predefinedType = PredefinedTypeFacts.TryGetPredefTypeIndex(typeName); + if (predefinedType != PredefinedType.PT_UNDEFINEDINDEX) + { + PredefinedTypes.InitializePredefinedType(agg, predefinedType); + } } } agg.SetSealed(type.IsSealed); - agg.SetHasExternReference(false); - - AggregateType baseAggType = agg.getThisType(); if (type.BaseType != null) { // type.BaseType can be null for Object or for interface types. @@ -1150,7 +1124,7 @@ namespace Microsoft.CSharp.RuntimeBinder { t = t.GetGenericTypeDefinition(); } - agg.SetBaseClass(GetCTypeFromType(t).AsAggregateType()); + agg.SetBaseClass((AggregateType)GetCTypeFromType(t)); } agg.SetTypeManager(_typeManager); agg.SetFirstUDConversion(null); @@ -1175,7 +1149,7 @@ namespace Microsoft.CSharp.RuntimeBinder { type = type.GetGenericTypeDefinition(); } - Type[] interfaces = type.GetTypeInfo().ImplementedInterfaces.ToArray(); + Type[] interfaces = type.GetInterfaces(); // We won't be able to find the difference between Ifaces and // IfacesAll anymore - at runtime, the class implements all of its @@ -1283,7 +1257,7 @@ namespace Microsoft.CSharp.RuntimeBinder return cachedResult; } - private EventSymbol AddEventToSymbolTable(EventInfo eventInfo, AggregateSymbol aggregate, FieldSymbol addedField) + private void AddEventToSymbolTable(EventInfo eventInfo, AggregateSymbol aggregate, FieldSymbol addedField) { EventSymbol ev = _symbolTable.LookupSym( GetName(eventInfo.Name), @@ -1292,7 +1266,7 @@ namespace Microsoft.CSharp.RuntimeBinder if (ev != null) { Debug.Assert(ev.AssociatedEventInfo == eventInfo); - return ev; + return; } ev = _symFactory.CreateEvent(GetName(eventInfo.Name), aggregate); @@ -1354,8 +1328,6 @@ namespace Microsoft.CSharp.RuntimeBinder } } } - - return ev; } #endregion @@ -1377,10 +1349,12 @@ namespace Microsoft.CSharp.RuntimeBinder ///////////////////////////////////////////////////////////////////////////////// - private PropertySymbol AddPropertyToSymbolTable(PropertyInfo property, AggregateSymbol aggregate) + private void AddPropertyToSymbolTable(PropertyInfo property, AggregateSymbol aggregate) { Name name; - bool isIndexer = property.GetIndexParameters() != null && property.GetIndexParameters().Length != 0; + bool isIndexer = property.GetIndexParameters().Length != 0 + && property.DeclaringType?.GetCustomAttribute() + ?.MemberName == property.Name; if (isIndexer) { @@ -1407,11 +1381,11 @@ namespace Microsoft.CSharp.RuntimeBinder { if (prop.AssociatedPropertyInfo.IsEquivalentTo(property)) { - return prop; + return; } prevProp = prop; - prop = _semanticChecker.SymbolLoader.LookupNextSym(prop, prop.parent, symbmask_t.MASK_PropertySymbol).AsPropertySymbol(); + prop = _semanticChecker.SymbolLoader.LookupNextSym(prop, prop.parent, symbmask_t.MASK_PropertySymbol) as PropertySymbol; } prop = prevProp; @@ -1440,7 +1414,7 @@ namespace Microsoft.CSharp.RuntimeBinder { if (isIndexer) { - prop = _semanticChecker.GetSymbolLoader().GetGlobalMiscSymFactory().CreateIndexer(name, aggregate, GetName(property.Name)); + prop = _semanticChecker.SymbolLoader.GetGlobalSymbolFactory().CreateIndexer(name, aggregate, GetName(property.Name)); prop.Params = CreateParameterArray(null, property.GetIndexParameters()); } else @@ -1474,51 +1448,49 @@ namespace Microsoft.CSharp.RuntimeBinder ACCESS access = ACCESS.ACC_PRIVATE; if (methGet != null) { - prop.methGet = AddMethodToSymbolTable(methGet, aggregate, MethodKindEnum.PropAccessor); + prop.GetterMethod = AddMethodToSymbolTable(methGet, aggregate, MethodKindEnum.PropAccessor); // If we have an indexed property, leave the method as a method we can call, // and mark the property as bogus. - if (isIndexer || prop.methGet.Params.Count == 0) + if (isIndexer || prop.GetterMethod.Params.Count == 0) { - prop.methGet.SetProperty(prop); + prop.GetterMethod.SetProperty(prop); } else { - prop.setBogus(true); - prop.methGet.SetMethKind(MethodKindEnum.Actual); + prop.Bogus = true; + prop.GetterMethod.SetMethKind(MethodKindEnum.Actual); } - if (prop.methGet.GetAccess() > access) + if (prop.GetterMethod.GetAccess() > access) { - access = prop.methGet.GetAccess(); + access = prop.GetterMethod.GetAccess(); } } if (methSet != null) { - prop.methSet = AddMethodToSymbolTable(methSet, aggregate, MethodKindEnum.PropAccessor); + prop.SetterMethod = AddMethodToSymbolTable(methSet, aggregate, MethodKindEnum.PropAccessor); // If we have an indexed property, leave the method as a method we can call, // and mark the property as bogus. - if (isIndexer || prop.methSet.Params.Count == 1) + if (isIndexer || prop.SetterMethod.Params.Count == 1) { - prop.methSet.SetProperty(prop); + prop.SetterMethod.SetProperty(prop); } else { - prop.setBogus(true); - prop.methSet.SetMethKind(MethodKindEnum.Actual); + prop.Bogus = true; + prop.SetterMethod.SetMethKind(MethodKindEnum.Actual); } - if (prop.methSet.GetAccess() > access) + if (prop.SetterMethod.GetAccess() > access) { - access = prop.methSet.GetAccess(); + access = prop.SetterMethod.GetAccess(); } } // The access of the property is the least restrictive access of its getter/setter. prop.SetAccess(access); - - return prop; } #endregion @@ -1559,12 +1531,11 @@ namespace Microsoft.CSharp.RuntimeBinder ///////////////////////////////////////////////////////////////////////////////// - private MethodSymbol AddMethodToSymbolTable(MemberInfo member, AggregateSymbol callingAggregate, MethodKindEnum kind) + private MethodSymbol AddMethodToSymbolTable(MethodBase member, AggregateSymbol callingAggregate, MethodKindEnum kind) { MethodInfo method = member as MethodInfo; - ConstructorInfo ctor = member as ConstructorInfo; - Debug.Assert(method != null || ctor != null); + Debug.Assert(method != null || member is ConstructorInfo); #if UNSUPPORTEDAPI Debug.Assert(member.DeclaringType == member.ReflectedType); #endif @@ -1589,7 +1560,7 @@ namespace Microsoft.CSharp.RuntimeBinder return methodSymbol; } - ParameterInfo[] parameters = method != null ? method.GetParameters() : ctor.GetParameters(); + ParameterInfo[] parameters = member.GetParameters(); // First create the method. methodSymbol = _symFactory.CreateMethod(GetName(member.Name), callingAggregate); methodSymbol.AssociatedMemberInfo = member; @@ -1600,67 +1571,38 @@ namespace Microsoft.CSharp.RuntimeBinder methodSymbol.SetConvNext(callingAggregate.GetFirstUDConversion()); callingAggregate.SetFirstUDConversion(methodSymbol); } + ACCESS access; - if (method != null) + if (member.IsPublic) { - if (method.IsPublic) - { - access = ACCESS.ACC_PUBLIC; - } - else if (method.IsPrivate) - { - access = ACCESS.ACC_PRIVATE; - } - else if (method.IsFamily) - { - access = ACCESS.ACC_PROTECTED; - } - else if (method.IsAssembly || method.IsFamilyAndAssembly) - { - access = ACCESS.ACC_INTERNAL; - } - else - { - Debug.Assert(method.IsFamilyOrAssembly); - access = ACCESS.ACC_INTERNALPROTECTED; - } + access = ACCESS.ACC_PUBLIC; + } + else if (member.IsPrivate) + { + access = ACCESS.ACC_PRIVATE; + } + else if (member.IsFamily) + { + access = ACCESS.ACC_PROTECTED; + } + else if (member.IsFamilyOrAssembly) + { + access = ACCESS.ACC_INTERNALPROTECTED; } else { - Debug.Assert(ctor != null); - if (ctor.IsPublic) - { - access = ACCESS.ACC_PUBLIC; - } - else if (ctor.IsPrivate) - { - access = ACCESS.ACC_PRIVATE; - } - else if (ctor.IsFamily) - { - access = ACCESS.ACC_PROTECTED; - } - else if (ctor.IsAssembly || ctor.IsFamilyAndAssembly) - { - access = ACCESS.ACC_INTERNAL; - } - else - { - Debug.Assert(ctor.IsFamilyOrAssembly); - access = ACCESS.ACC_INTERNALPROTECTED; - } + Debug.Assert(member.IsAssembly || member.IsFamilyAndAssembly); + access = ACCESS.ACC_INTERNAL; } - methodSymbol.SetAccess(access); - methodSymbol.isExtension = false; // We don't support extension methods. - methodSymbol.isExternal = false; + methodSymbol.SetAccess(access); + methodSymbol.isVirtual = member.IsVirtual; + methodSymbol.isAbstract = member.IsAbstract; + methodSymbol.isStatic = member.IsStatic; if (method != null) { methodSymbol.typeVars = GetMethodTypeParameters(method, methodSymbol); - methodSymbol.isVirtual = method.IsVirtual; - methodSymbol.isAbstract = method.IsAbstract; - methodSymbol.isStatic = method.IsStatic; methodSymbol.isOverride = method.IsVirtual && method.IsHideBySig && method.GetRuntimeBaseDefinition() != method; methodSymbol.isOperator = IsOperator(method); methodSymbol.swtSlot = GetSlotForOverride(method); @@ -1670,18 +1612,15 @@ namespace Microsoft.CSharp.RuntimeBinder else { methodSymbol.typeVars = BSYMMGR.EmptyTypeArray(); - methodSymbol.isVirtual = ctor.IsVirtual; - methodSymbol.isAbstract = ctor.IsAbstract; - methodSymbol.isStatic = ctor.IsStatic; methodSymbol.isOverride = false; methodSymbol.isOperator = false; methodSymbol.swtSlot = null; methodSymbol.isVarargs = false; methodSymbol.RetType = _typeManager.GetVoid(); } + methodSymbol.modOptCount = GetCountOfModOpts(parameters); - methodSymbol.useMethInstead = false; methodSymbol.isParamArray = DoesMethodHaveParameterArray(parameters); methodSymbol.isHideByName = false; @@ -1700,16 +1639,9 @@ namespace Microsoft.CSharp.RuntimeBinder if (parameters.Length > 0) { // See if we have a param array. - var attributes = parameters[parameters.Length - 1].GetCustomAttributes(false); - if (attributes != null) + if (parameters[parameters.Length - 1].GetCustomAttribute(typeof(ParamArrayAttribute), false) != null) { - foreach (object o in attributes) - { - if (o is ParamArrayAttribute) - { - methProp.isParamArray = true; - } - } + methProp.isParamArray = true; } // Mark the names of the parameters, and their default values. @@ -1727,144 +1659,140 @@ namespace Microsoft.CSharp.RuntimeBinder private void SetParameterAttributes(MethodOrPropertySymbol methProp, ParameterInfo[] parameters, int i) { - if (((parameters[i].Attributes & ParameterAttributes.Optional) != 0) && - !parameters[i].ParameterType.IsByRef) + ParameterInfo parameter = parameters[i]; + if ((parameter.Attributes & ParameterAttributes.Optional) != 0 && !parameter.ParameterType.IsByRef) { methProp.SetOptionalParameter(i); PopulateSymbolTableWithName("Value", new Type[] { typeof(Missing) }, typeof(Missing)); // We might need this later } - object[] attrs; - // Get MarshalAsAttribute - if ((parameters[i].Attributes & ParameterAttributes.HasFieldMarshal) != 0) + if ((parameter.Attributes & ParameterAttributes.HasFieldMarshal) != 0) { - if ((attrs = parameters[i].GetCustomAttributes(typeof(MarshalAsAttribute), false).ToArray()) != null - && attrs.Length > 0) + MarshalAsAttribute attr = parameter.GetCustomAttribute(false); + if (attr != null) { - MarshalAsAttribute attr = (MarshalAsAttribute)attrs[0]; methProp.SetMarshalAsParameter(i, attr.Value); } } + DateTimeConstantAttribute dateAttr = parameter.GetCustomAttribute(false); // Get the various kinds of default values - if ((attrs = parameters[i].GetCustomAttributes(typeof(DateTimeConstantAttribute), false).ToArray()) != null - && attrs.Length > 0) + if (dateAttr != null) { // Get DateTimeConstant - - DateTimeConstantAttribute attr = (DateTimeConstantAttribute)attrs[0]; - - ConstVal cv = ConstVal.Get(((DateTime)attr.Value).Ticks); - CType cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_DATETIME); + ConstVal cv = ConstVal.Get(((DateTime)dateAttr.Value).Ticks); + CType cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_DATETIME); methProp.SetDefaultParameterValue(i, cvType, cv); } - else if ((attrs = parameters[i].GetCustomAttributes(typeof(DecimalConstantAttribute), false).ToArray()) != null - && attrs.Length > 0) + else { - // Get DecimalConstant - - DecimalConstantAttribute attr = (DecimalConstantAttribute)attrs[0]; - - ConstVal cv = ConstVal.Get(attr.Value); - CType cvType = _semanticChecker.GetSymbolLoader().GetOptPredefType(PredefinedType.PT_DECIMAL); - methProp.SetDefaultParameterValue(i, cvType, cv); - } - else if (((parameters[i].Attributes & ParameterAttributes.HasDefault) != 0) && - !parameters[i].ParameterType.IsByRef) - { - // Only set a default value if we have one, and the type that we're - // looking at isn't a by ref type or a type parameter. - - ConstVal cv = default(ConstVal); - CType cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_OBJECT); - - // We need to use RawDefaultValue, because DefaultValue is too clever. -#if UNSUPPORTEDAPI - if (parameters[i].RawDefaultValue != null) + DecimalConstantAttribute decAttr = parameter.GetCustomAttribute(); + if (decAttr != null) { - object defValue = parameters[i].RawDefaultValue; -#else - if (parameters[i].DefaultValue != null) - { - object defValue = parameters[i].DefaultValue; -#endif - Type defType = defValue.GetType(); - - if (defType == typeof(byte)) - { - cv = ConstVal.Get((byte)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_BYTE); - } - else if (defType == typeof(short)) - { - cv = ConstVal.Get((short)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_SHORT); - } - else if (defType == typeof(int)) - { - cv = ConstVal.Get((int)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_INT); - } - else if (defType == typeof(long)) - { - cv = ConstVal.Get((long)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_LONG); - } - else if (defType == typeof(float)) - { - cv = ConstVal.Get((float)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_FLOAT); - } - else if (defType == typeof(double)) - { - cv = ConstVal.Get((double)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_DOUBLE); - } - else if (defType == typeof(decimal)) - { - cv = ConstVal.Get((decimal)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_DECIMAL); - } - else if (defType == typeof(char)) - { - cv = ConstVal.Get((char)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_CHAR); - } - else if (defType == typeof(bool)) - { - cv = ConstVal.Get((bool)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_BOOL); - } - else if (defType == typeof(sbyte)) - { - cv = ConstVal.Get((sbyte)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_SBYTE); - } - else if (defType == typeof(ushort)) - { - cv = ConstVal.Get((ushort)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_USHORT); - } - else if (defType == typeof(uint)) - { - cv = ConstVal.Get((uint)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_UINT); - } - else if (defType == typeof(ulong)) - { - cv = ConstVal.Get((ulong)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_ULONG); - } - else if (defType == typeof(string)) - { - cv = ConstVal.Get((string)defValue); - cvType = _semanticChecker.GetSymbolLoader().GetReqPredefType(PredefinedType.PT_STRING); - } - // if we fall off the end of this cascading if, we get Object/null - // because that's how we initialized the constval. + // Get DecimalConstant + ConstVal cv = ConstVal.Get(decAttr.Value); + CType cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_DECIMAL); + methProp.SetDefaultParameterValue(i, cvType, cv); + } + else if ((parameter.Attributes & ParameterAttributes.HasDefault) != 0 && !parameter.ParameterType.IsByRef) + { + // Only set a default value if we have one, and the type that we're + // looking at isn't a by ref type or a type parameter. + + ConstVal cv = default(ConstVal); + CType cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_OBJECT); + + // We need to use RawDefaultValue, because DefaultValue is too clever. +#if UNSUPPORTEDAPI + if (parameter.RawDefaultValue != null) + { + object defValue = parameter.RawDefaultValue; +#else + if (parameter.DefaultValue != null) + { + object defValue = parameter.DefaultValue; +#endif + switch (Type.GetTypeCode(defValue.GetType())) + { + + case TypeCode.Byte: + cv = ConstVal.Get((byte)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_BYTE); + break; + + case TypeCode.Int16: + cv = ConstVal.Get((short)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_SHORT); + break; + + case TypeCode.Int32: + cv = ConstVal.Get((int)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_INT); + break; + + case TypeCode.Int64: + cv = ConstVal.Get((long)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_LONG); + break; + + case TypeCode.Single: + cv = ConstVal.Get((float)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_FLOAT); + break; + + case TypeCode.Double: + cv = ConstVal.Get((double)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_DOUBLE); + break; + + case TypeCode.Decimal: + cv = ConstVal.Get((decimal)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_DECIMAL); + break; + + case TypeCode.Char: + cv = ConstVal.Get((char)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_CHAR); + break; + + case TypeCode.Boolean: + cv = ConstVal.Get((bool)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_BOOL); + break; + + case TypeCode.SByte: + cv = ConstVal.Get((sbyte)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_SBYTE); + break; + + case TypeCode.UInt16: + cv = ConstVal.Get((ushort)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_USHORT); + break; + + case TypeCode.UInt32: + cv = ConstVal.Get((uint)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_UINT); + break; + + case TypeCode.UInt64: + cv = ConstVal.Get((ulong)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_ULONG); + break; + + case TypeCode.String: + cv = ConstVal.Get((string)defValue); + cvType = _semanticChecker.SymbolLoader.GetPredefindType(PredefinedType.PT_STRING); + break; + } + + // if we hit no case in the switch, we get object/null + // because that's how we initialized the constval. + } + + methProp.SetDefaultParameterValue(i, cvType, cv); } - methProp.SetDefaultParameterValue(i, cvType, cv); } } @@ -1872,14 +1800,14 @@ namespace Microsoft.CSharp.RuntimeBinder private MethodSymbol FindMatchingMethod(MemberInfo method, AggregateSymbol callingAggregate) { - MethodSymbol meth = _bsymmgr.LookupAggMember(GetName(method.Name), callingAggregate, symbmask_t.MASK_MethodSymbol).AsMethodSymbol(); + MethodSymbol meth = _bsymmgr.LookupAggMember(GetName(method.Name), callingAggregate, symbmask_t.MASK_MethodSymbol) as MethodSymbol; while (meth != null) { if (meth.AssociatedMemberInfo.IsEquivalentTo(method)) { return meth; } - meth = BSYMMGR.LookupNextSym(meth, callingAggregate, symbmask_t.MASK_MethodSymbol).AsMethodSymbol(); + meth = BSYMMGR.LookupNextSym(meth, callingAggregate, symbmask_t.MASK_MethodSymbol) as MethodSymbol; } return null; } @@ -1939,9 +1867,9 @@ namespace Microsoft.CSharp.RuntimeBinder } // Check if we have an out parameter. - if (ctype.IsParameterModifierType() && p.IsOut && !p.IsIn) + if (ctype is ParameterModifierType mod && p.IsOut && !p.IsIn) { - CType parameterType = ctype.AsParameterModifierType().GetParameterType(); + CType parameterType = mod.GetParameterType(); ctype = _typeManager.GetParameterModifier(parameterType, true); } @@ -2008,17 +1936,17 @@ namespace Microsoft.CSharp.RuntimeBinder private MethodSymbol FindMethodFromMemberInfo(MemberInfo baseMemberInfo) { CType t = GetCTypeFromType(baseMemberInfo.DeclaringType); - Debug.Assert(t.IsAggregateType()); + Debug.Assert(t is AggregateType); AggregateSymbol aggregate = t.getAggregate(); Debug.Assert(aggregate != null); MethodSymbol meth = _semanticChecker.SymbolLoader.LookupAggMember( GetName(baseMemberInfo.Name), aggregate, - symbmask_t.MASK_MethodSymbol).AsMethodSymbol(); + symbmask_t.MASK_MethodSymbol) as MethodSymbol; for (; meth != null && !meth.AssociatedMemberInfo.IsEquivalentTo(baseMemberInfo); - meth = _semanticChecker.SymbolLoader.LookupNextSym(meth, aggregate, symbmask_t.MASK_MethodSymbol).AsMethodSymbol()) + meth = _semanticChecker.SymbolLoader.LookupNextSym(meth, aggregate, symbmask_t.MASK_MethodSymbol) as MethodSymbol) ; return meth; @@ -2065,7 +1993,7 @@ namespace Microsoft.CSharp.RuntimeBinder // there are any conversions. CType t = GetCTypeFromType(type); - if (!t.IsAggregateType()) + if (!(t is AggregateType)) { CType endT; while ((endT = t.GetBaseOrParameterOrElementType()) != null) @@ -2074,10 +2002,10 @@ namespace Microsoft.CSharp.RuntimeBinder } } - if (t.IsTypeParameterType()) + if (t is TypeParameterType paramType) { // Add conversions for the bounds. - foreach (CType bound in t.AsTypeParameterType().GetBounds().Items) + foreach (CType bound in paramType.GetBounds().Items) { AddConversionsForType(bound.AssociatedSystemType); } @@ -2085,24 +2013,29 @@ namespace Microsoft.CSharp.RuntimeBinder } Debug.Assert(t is AggregateType); - AggregateSymbol aggregate = t.AsAggregateType().getAggregate(); + AggregateSymbol aggregate = ((AggregateType)t).getAggregate(); // Now find all the conversions and make them. - IEnumerable conversions = Enumerable.Where(type.GetRuntimeMethods(), - conversion => (conversion.IsPublic && conversion.IsStatic) - && (conversion.Name == SpecialNames.ImplicitConversion || conversion.Name == SpecialNames.ExplicitConversion) - && conversion.DeclaringType == type - && conversion.IsSpecialName - && !conversion.IsGenericMethod); - - foreach (MethodInfo conversion in conversions) + foreach (MethodInfo conversion in type.GetRuntimeMethods()) { - MethodSymbol method = AddMethodToSymbolTable( - conversion, - aggregate, - conversion.Name == SpecialNames.ImplicitConversion ? - MethodKindEnum.ImplicitConv : - MethodKindEnum.ExplicitConv); + if (conversion.IsPublic && conversion.IsStatic && conversion.DeclaringType == type + && conversion.IsSpecialName && !conversion.IsGenericMethod) + { + MethodKindEnum methodKind; + switch (conversion.Name) + { + case SpecialNames.ImplicitConversion: + methodKind = MethodKindEnum.ImplicitConv; + break; + case SpecialNames.ExplicitConversion: + methodKind = MethodKindEnum.ExplicitConv; + break; + default: + continue; + } + + AddMethodToSymbolTable(conversion, aggregate, methodKind); + } } } #endregion @@ -2110,56 +2043,45 @@ namespace Microsoft.CSharp.RuntimeBinder #region Operators ///////////////////////////////////////////////////////////////////////////////// - private bool IsOperator(MethodInfo method) + private static bool IsOperator(MethodInfo method) { - return method.IsSpecialName && - method.IsStatic && - (method.Name == SpecialNames.ImplicitConversion || - method.Name == SpecialNames.ExplicitConversion || + if (method.IsSpecialName && method.IsStatic) + { + switch (method.Name) + { + case SpecialNames.ImplicitConversion: + case SpecialNames.ExplicitConversion: + case SpecialNames.CLR_Add: + case SpecialNames.CLR_Subtract: + case SpecialNames.CLR_Multiply: + case SpecialNames.CLR_Division: + case SpecialNames.CLR_Modulus: + case SpecialNames.CLR_LShift: + case SpecialNames.CLR_RShift: + case SpecialNames.CLR_LT: + case SpecialNames.CLR_GT: + case SpecialNames.CLR_LTE: + case SpecialNames.CLR_GTE: + case SpecialNames.CLR_Equality: + case SpecialNames.CLR_Inequality: + case SpecialNames.CLR_BitwiseAnd: + case SpecialNames.CLR_ExclusiveOr: + case SpecialNames.CLR_BitwiseOr: + case SpecialNames.CLR_LogicalNot: + case SpecialNames.CLR_UnaryNegation: + case SpecialNames.CLR_UnaryPlus: + case SpecialNames.CLR_OnesComplement: + case SpecialNames.CLR_True: + case SpecialNames.CLR_False: + case SpecialNames.CLR_PreIncrement: + case SpecialNames.CLR_PreDecrement: + return true; + } + } - // Binary Operators - method.Name == SpecialNames.CLR_Add || - method.Name == SpecialNames.CLR_Subtract || - method.Name == SpecialNames.CLR_Multiply || - method.Name == SpecialNames.CLR_Division || - method.Name == SpecialNames.CLR_Modulus || - method.Name == SpecialNames.CLR_LShift || - method.Name == SpecialNames.CLR_RShift || - method.Name == SpecialNames.CLR_LT || - method.Name == SpecialNames.CLR_GT || - method.Name == SpecialNames.CLR_LTE || - method.Name == SpecialNames.CLR_GTE || - method.Name == SpecialNames.CLR_Equality || - method.Name == SpecialNames.CLR_Inequality || - method.Name == SpecialNames.CLR_BitwiseAnd || - method.Name == SpecialNames.CLR_ExclusiveOr || - method.Name == SpecialNames.CLR_BitwiseOr || - method.Name == SpecialNames.CLR_LogicalNot || - - // Binary inplace operators. - method.Name == SpecialNames.CLR_InPlaceAdd || - method.Name == SpecialNames.CLR_InPlaceSubtract || - method.Name == SpecialNames.CLR_InPlaceMultiply || - method.Name == SpecialNames.CLR_InPlaceDivide || - method.Name == SpecialNames.CLR_InPlaceModulus || - method.Name == SpecialNames.CLR_InPlaceBitwiseAnd || - method.Name == SpecialNames.CLR_InPlaceExclusiveOr || - method.Name == SpecialNames.CLR_InPlaceBitwiseOr || - method.Name == SpecialNames.CLR_InPlaceLShift || - method.Name == SpecialNames.CLR_InPlaceRShift || - - // Unary Operators - method.Name == SpecialNames.CLR_UnaryNegation || - method.Name == SpecialNames.CLR_UnaryPlus || - method.Name == SpecialNames.CLR_OnesComplement || - method.Name == SpecialNames.CLR_True || - method.Name == SpecialNames.CLR_False || - - method.Name == SpecialNames.CLR_PreIncrement || - method.Name == SpecialNames.CLR_PostIncrement || - method.Name == SpecialNames.CLR_PreDecrement || - method.Name == SpecialNames.CLR_PostDecrement); + return false; } + #endregion } } diff --git a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/PredefinedType.cs b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/PredefinedType.cs index 556c14acbd..de4c01615a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/PredefinedType.cs +++ b/external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/PredefinedType.cs @@ -26,8 +26,9 @@ namespace Microsoft.CSharp.RuntimeBinder.Syntax PT_ULONG, // The special "pointer-sized int" types. Note that this are not considered numeric types from the compiler's point of view -- - // they are special only in that they have special signature encodings. - PT_INTPTR, + // they are special only in that they have special signature encodings. + FirstNonSimpleType, + PT_INTPTR = FirstNonSimpleType, PT_UINTPTR, PT_OBJECT, @@ -37,144 +38,39 @@ namespace Microsoft.CSharp.RuntimeBinder.Syntax PT_DELEGATE, PT_MULTIDEL, PT_ARRAY, - PT_EXCEPTION, PT_TYPE, - PT_MONITOR, PT_VALUE, PT_ENUM, PT_DATETIME, - // predefined attribute types - PT_DEBUGGABLEATTRIBUTE, - PT_DEBUGGABLEATTRIBUTE_DEBUGGINGMODES, - PT_IN, - PT_OUT, - PT_ATTRIBUTE, - PT_ATTRIBUTEUSAGE, - PT_ATTRIBUTETARGETS, - PT_OBSOLETE, - PT_CONDITIONAL, - PT_CLSCOMPLIANT, - PT_GUID, - PT_DEFAULTMEMBER, - PT_PARAMS, - PT_COMIMPORT, - PT_FIELDOFFSET, - PT_STRUCTLAYOUT, - PT_LAYOUTKIND, - PT_MARSHALAS, - PT_DLLIMPORT, - PT_INDEXERNAME, - PT_DECIMALCONSTANT, - PT_DEFAULTVALUE, - PT_UNMANAGEDFUNCTIONPOINTER, - PT_CALLINGCONVENTION, - PT_CHARSET, - // predefined types for the BCL - PT_TYPEHANDLE, - PT_FIELDHANDLE, - PT_METHODHANDLE, - PT_G_DICTIONARY, - PT_IASYNCRESULT, - PT_ASYNCCBDEL, - PT_IDISPOSABLE, PT_IENUMERABLE, - PT_IENUMERATOR, - PT_SYSTEMVOID, - PT_RUNTIMEHELPERS, - - // signature MODIFIER for marking volatile fields - PT_VOLATILEMOD, - - // Sets the CoClass for a COM interface wrapper - PT_COCLASS, - - // For instantiating a type variable. - PT_ACTIVATOR, // Generic variants of enumerator interfaces PT_G_IENUMERABLE, - PT_G_IENUMERATOR, // Nullable PT_G_OPTIONAL, - // Marks a fixed buffer field - PT_FIXEDBUFFER, - - // Sets the module-level default character set marshalling - PT_DEFAULTCHARSET, - - // Used to disable string interning - PT_COMPILATIONRELAXATIONS, - - // Used to enable wrapped exceptions - PT_RUNTIMECOMPATIBILITY, - - // Used for friend assemblies - PT_FRIENDASSEMBLY, - - // Used to hide compiler-generated code from the debugger - PT_DEBUGGERHIDDEN, - - // Used for type forwarders - PT_TYPEFORWARDER, - - // Used to warn on usage of this instead of command-line options - PT_KEYFILE, - PT_KEYNAME, - PT_DELAYSIGN, - PT_NOTSUPPORTEDEXCEPTION, - PT_COMPILERGENERATED, - - PT_UNSAFEVALUETYPE, - - // special assembly identity attributes - PT_ASSEMBLYFLAGS, - PT_ASSEMBLYVERSION, - PT_ASSEMBLYCULTURE, - // LINQ PT_G_IQUERYABLE, - PT_IQUERYABLE, - PT_STRINGBUILDER, PT_G_ICOLLECTION, PT_G_ILIST, - PT_EXTENSION, PT_G_EXPRESSION, PT_EXPRESSION, - PT_LAMBDAEXPRESSION, PT_BINARYEXPRESSION, PT_UNARYEXPRESSION, - PT_CONDITIONALEXPRESSION, PT_CONSTANTEXPRESSION, PT_PARAMETEREXPRESSION, PT_MEMBEREXPRESSION, PT_METHODCALLEXPRESSION, PT_NEWEXPRESSION, - PT_BINDING, - PT_MEMBERINITEXPRESSION, - PT_LISTINITEXPRESSION, - PT_TYPEBINARYEXPRESSION, PT_NEWARRAYEXPRESSION, - PT_MEMBERASSIGNMENT, - PT_MEMBERLISTBINDING, - PT_MEMBERMEMBERBINDING, PT_INVOCATIONEXPRESSION, PT_FIELDINFO, PT_METHODINFO, PT_CONSTRUCTORINFO, PT_PROPERTYINFO, - PT_METHODBASE, - PT_MEMBERINFO, - - PT_DEBUGGERDISPLAY, - PT_DEBUGGERBROWSABLE, - PT_DEBUGGERBROWSABLESTATE, - PT_G_EQUALITYCOMPARER, - PT_ELEMENTINITIALIZER, - PT_MISSING, PT_G_IREADONLYLIST, diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.de.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.de.xlf index 2b711789e8..f2350e0aae 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.de.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.de.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined Für den {0}-Typ sind keine Konstruktoren definiert. - - The delegate '{0}' does not have a valid constructor - Der Delegat "{0}" enthält keinen gültigen Konstruktor. - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor Die Eigenschaft oder der Indexer "{0}" kann in diesem Kontext nicht verwendet werden, weil der get-Accessor fehlt. @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only Für die Eigenschaft oder den Indexer "{0}" ist eine Zuweisung nicht möglich -- sie sind schreibgeschützt. - - Cannot call an abstract base member: '{0}' - Ein abstrakter Basismember kann nicht aufgerufen werden: '{0}' - A property or indexer may not be passed as an out or ref parameter Eine Eigenschaft oder ein Indexer kann nicht als out- oder ref-Parameter übergeben werden. @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' Mehrdeutigkeit zwischen {0} und {1} - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - {0} enthält keine vordefinierte Größe, sizeof kann daher nur in einem ungeschützten Kontext verwendet werden (verwenden Sie ggf. System.Runtime.InteropServices.Marshal.SizeOf). - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - Destruktoren und object.Finalize können nicht direkt aufgerufen werden. Rufen Sie IDisposable.Dispose auf, sofern verfügbar. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - Rufen Sie die Finalize-Methode Ihrer Basisklasse nicht direkt auf, da sie automatisch vom Destruktor aufgerufen wird. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) Der {0}-Typ kann nicht implizit in {1} konvertiert werden. Es ist bereits eine explizite Konvertierung vorhanden (möglicherweise fehlt eine Umwandlung). @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments Die Verwendung von {1} "{0}" (generisch) erfordert {2}-Typargumente. - - The type '{0}' may not be used as a type argument - Der Typ "{0}" darf nicht als Typargument verwendet werden. - The {1} '{0}' cannot be used with type arguments {1} "{0}" kann nicht mit Typargumenten verwendet werden. @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. Der {3}-Typ kann nicht als {2}-Typparameter im generischen Typ oder in der generischen {0}-Methode verwendet werden. Der {3}-Typ, der NULL-Werte zulässt, entspricht nicht der Einschränkung von {1}. Typen, die NULL-Werte zulassen, können Schnittstelleneinschränkungen nicht entsprechen. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - Der {3}-Typ kann nicht als {2}-Typparameter im generischen Typ oder in der generischen {0}-Methode verwendet werden. Es ist keine Boxing-Konvertierung oder Typparameterkonvertierung von {3} in {1} vorhanden. - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. Der {3}-Typ kann nicht als {2}-Typparameter im generischen Typ oder in der generischen {0}-Methode verwendet werden. Es ist keine Boxing-Konvertierung von {3} in {1} vorhanden. - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - NULL kann nicht in den {0}-Typparameter konvertiert werden, da dieser Werttyp möglicherweise nicht auf NULL festgelegt werden kann. Verwenden Sie stattdessen ggf. default({0}). - - - '{1} {0}' has the wrong return type - Der Rückgabetyp von {1} {0} ist falsch. - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. Die Typargumente der {0}-Methode können nicht per Rückschluss aus der Syntax abgeleitet werden. Geben Sie die Typargumente explizit an. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - Die {0}-Methodengruppe kann nicht in den Nichtdelegattyp "{1}" konvertiert werden. Wollten Sie die Methode aufrufen? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' Der {2}-Typ muss ein Referenztyp sein, damit er als {1}-Parameter im generischen Typ oder in der generischen {0}-Methode verwendet werden kann. @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' Mehrdeutige benutzerdefinierte Konvertierungen von {0} und {1} bei der Konvertierung von {2} in {3} - - Predefined type '{0}' is not defined or imported - Der vordefinierte {0}-Typ ist nicht definiert oder importiert. - '{0}' is not supported by the language {0} wird von der Sprache nicht unterstützt. @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor {0}: Der Operator oder Accessor kann nicht explizit aufgerufen werden. - - '{0}' is a type not supported by the language - {0} ist ein Typ, der von der Sprache nicht unterstützt wird. - - - Missing compiler required member '{0}.{1}' - Der vom Compiler angeforderte Member "{0}.{1}" fehlt. - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - Literale vom Typ "double" können nicht implizit in den {1}-Typ konvertiert werden. Verwenden Sie ein {0}-Suffix, um ein Literal mit diesem Typ zu erstellen. - Cannot convert to static type '{0}' Die Konvertierung in den statischen {0}-Typ ist nicht möglich. - - '{0}': static types cannot be used as type arguments - {0}: Statische Typen können nicht als Typargumente verwendet werden. - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - Aus der {0}-Methode kann kein Delegat erstellt werden, da es sich um eine partielle Methode ohne implementierende Deklaration handelt. - The operand of an increment or decrement operator must be a variable, property or indexer Der Operand eines Inkrement- oder Dekrementoperators muss eine Variable, eine Eigenschaft oder ein Indexer sein. - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - {0} enthält keine Definition für {1}, und es konnte keine {1}-Erweiterungsmethode gefunden werden, die ein erstes Argument vom Typ "{0}" akzeptiert (möglicherweise fehlt eine Using-Direktive oder ein Assemblyverweis). - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - Die im {1}-Werttyp definierten {0}-Erweiterungsmethoden können nicht zum Erstellen von Delegaten verwendet werden. - No overload for method '{0}' takes '{1}' arguments Keine Ãœberladung für die {0}-Methode nimmt {1}-Argumente an. @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments Die beste Ãœbereinstimmung für die überladene {0}-Methode enthält einige ungültige Argumente. - - Argument '{0}': cannot convert from '{1}' to '{2}' - {0}-Argument: Die Konvertierung von {1} in {2} ist nicht möglich. - A ref or out argument must be an assignable variable Ein ref- oder out-Argument muss eine zuweisbare Variable sein. @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable Der Rückgabewert von {0} ist keine Variable und kann daher nicht geändert werden. - - Argument '{0}' should not be passed with the '{1}' keyword - Das {0}-Argument darf nicht mit dem {1}-Schlüsselwort übergeben werden. - - - Argument '{0}' must be passed with the '{1}' keyword - Das {0}-Argument muss mit dem {1}-Schlüsselwort übergeben werden. - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) Member des schreibgeschützten Felds "{0}" können nicht geändert werden (außer in einem Konstruktor oder Variableninitialisierer). @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' {0} ist ein(e) {1} und kann daher nicht als ref- oder out-Argument übergeben werden. - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - Kann Delegaten "{0}" keine Bindung an weil es ein Mitglied von "System.Nullable<T>ist" - '{0}' does not contain a constructor that takes '{1}' arguments "{0}" enthält keinen Konstruktor, der {1}-Argumente akzeptiert. - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - "{0}" enthält keine Definition für {1}, und die Ãœberladung der optimalen {2}-Erweiterungsmethode enthält einige ungültige Argumente. - - - Instance argument: cannot convert from '{0}' to '{1}' - Instanzenargument: Konvertierung von {0} in {1} ist nicht möglich. - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - Die beste Ãœbereinstimmung für die überladene {0}-Methode für den Auflistungsinitialisierer enthält einige ungültige Argumente. - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - Die beste Ãœbereinstimmung für die überladene {0}-Methode für das Auflistungsinitialisiererelement kann nicht verwendet werden. Die Add-Methoden von Auflistungsinitialisierern dürfen keine ref- oder out-Parameter enthalten. - Non-invocable member '{0}' cannot be used like a method. Der nicht aufrufbare Member "{0}" kann nicht wie eine Methode verwendet werden. diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.es.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.es.xlf index 48d7be0aed..f5128c16af 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.es.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.es.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined El tipo '{0}' no tiene constructores definidos. - - The delegate '{0}' does not have a valid constructor - El delegado '{0}' no tiene un constructor válido - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor La propiedad o el indizador '{0}' no se puede usar en este contexto porque carece del descriptor de acceso get. @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only No se puede asignar a la propiedad o el indizador '{0}' porque es de solo lectura - - Cannot call an abstract base member: '{0}' - No se puede llamar a un miembro base abstracto: '{0}' - A property or indexer may not be passed as an out or ref parameter Una propiedad o un indizador no se puede pasar como parámetro out o ref @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' Ambigüedad entre '{0}' y '{1}' - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - '{0}' no tiene un tamaño predefinido; por tanto, sizeof sólo se puede usar en un contexto no seguro (use System.Runtime.InteropServices.Marshal.SizeOf). - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - Los destructores y object.Finalize no se pueden llamar directamente. Llame a IDisposable.Dispose si está disponible. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - No llame directamente al método Finalize de la clase base. Se llama automáticamente desde el destructor. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) No se puede convertir implícitamente el tipo '{0}' en '{1}'. Ya existe una conversión explícita (compruebe si le falta una conversión). @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments Uso de {1} de tipo genérico ('{0}'): requiere '{2}' argumentos de tipo - - The type '{0}' may not be used as a type argument - El tipo '{0}' no se puede usar como argumento de tipo - The {1} '{0}' cannot be used with type arguments {1} '{0}' no se puede usar con argumentos de tipo. @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. El tipo '{3}' no se puede usar como parámetro de tipo '{2}' en el tipo o método genérico '{0}'. El tipo que acepta valores NULL '{3}' no cumple la restricción de '{1}'. Los tipos que aceptan valores NULL no pueden cumplir restricciones de interfaz. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - El tipo '{3}' no se puede usar como parámetro de tipo '{2}' en el tipo o método genérico '{0}'. No hay conversión boxing ni conversión de parámetro de tipo de '{3}' a '{1}'. - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. El tipo '{3}' no se puede usar como parámetro de tipo '{2}' en el tipo o método genérico '{0}'. No hay conversión boxing de '{3}' a '{1}'. - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - No se puede convertir NULL en el parámetro de tipo '{0}' porque podría ser un tipo de valor que no acepta valores NULL. Use 'default({0})' en su lugar. - - - '{1} {0}' has the wrong return type - '{1} {0}' es un tipo de valor devuelto equivocado - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. Los argumentos de tipo para el método '{0}' no se pueden inferir a partir del uso. Intente especificar los argumentos de tipo explícitamente. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - No se puede convertir el grupo de métodos '{0}' en tipo no delegado '{1}'. ¿Intentó invocar el método? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' El tipo '{2}' debe ser un tipo de referencia para poder usarlo como parámetro '{1}' en el tipo o método genérico '{0}'. @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' Conversiones ambiguas definidas por el usuario '{0}' y '{1}' al convertir de '{2}' a '{3}' - - Predefined type '{0}' is not defined or imported - El tipo predefinido '{0}' no está definido ni importado. - '{0}' is not supported by the language '{0}' no es compatible con el lenguaje @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor '{0}': no se puede llamar explícitamente al operador o al descriptor de acceso - - '{0}' is a type not supported by the language - No se admite el tipo '{0}' para este lenguaje - - - Missing compiler required member '{0}.{1}' - Falta el miembro '{0}.{1}' que requiere el compilador. - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - El literal de tipo double no se puede convertir implícitamente en el tipo '{1}'; use un sufijo '{0}' para crear un literal de este tipo - Cannot convert to static type '{0}' No se puede convertir en el tipo estático '{0}' - - '{0}': static types cannot be used as type arguments - '{0}': los tipos estáticos no se pueden usar como argumentos de tipo - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - No se puede crear un delegado a partir del método '{0}' porque es un método parcial sin una declaración de implementación. - The operand of an increment or decrement operator must be a variable, property or indexer El operando de un operador de incremento o decremento debe ser una variable, una propiedad o un indizador - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - '{0}' no contiene una definición para '{1}' ni se encuentra ningún método de extensión '{1}' que acepte un primer argumento del tipo '{0}' (¿falta una directiva de uso o una referencia de ensamblado?). - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - Los métodos de extensión '{0}' definidos en el tipo de valor '{1}' no se pueden usar para crear delegados. - No overload for method '{0}' takes '{1}' arguments Ninguna sobrecarga del método '{0}' toma argumentos '{1}' @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments La mejor coincidencia de método sobrecargado para '{0}' tiene algunos argumentos no válidos - - Argument '{0}': cannot convert from '{1}' to '{2}' - Argumento '{0}': no se puede convertir de '{1}' a '{2}' - A ref or out argument must be an assignable variable Un argumento out o ref debe ser una variable asignable @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable No se puede modificar el valor devuelto de '{0}' porque no es una variable. - - Argument '{0}' should not be passed with the '{1}' keyword - No se debe pasar el argumento '{0}' con la palabra clave '{1}' - - - Argument '{0}' must be passed with the '{1}' keyword - El argumento '{0}' se debe pasar con la palabra clave '{1}' - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) Los miembros del campo de solo lectura '{0}' no se pueden modificar (excepto en un constructor o inicializador de variable) @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' No se puede pasar '{0}' como argumento out o ref porque es '{1}'. - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - No se puede enlazar el delegado para '{0}' porque es un miembro de 'System.Nullable<T>' - '{0}' does not contain a constructor that takes '{1}' arguments '{0}' no contiene un constructor que tome '{1}' argumentos - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - '{0}' no contiene una definición para '{1}' y la mejor sobrecarga del método de extensión '{2}' tiene algunos argumentos no válidos - - - Instance argument: cannot convert from '{0}' to '{1}' - Argumento de instancia: no se puede convertir de '{0}' a '{1}' - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - El mejor método Add sobrecargado '{0}' del inicializador de colección tiene algunos argumentos no válidos - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - La mejor coincidencia de método sobrecargado '{0}' para el elemento inicializador de la colección no se puede usar. Los métodos 'Add' inicializadores de colección no pueden tener parámetros out o ref. - Non-invocable member '{0}' cannot be used like a method. No se puede usar como método el miembro '{0}' no invocable. diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.fr.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.fr.xlf index a75a68a0e1..25c37d0544 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.fr.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.fr.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined Aucun constructeur n'est défini pour le type '{0}' - - The delegate '{0}' does not have a valid constructor - Le délégué '{0}' n'a pas de constructeur valide - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor Impossible d'utiliser la propriété ou l'indexeur '{0}' dans ce contexte, car il lui manque l'accesseur get @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only Impossible d'assigner la propriété ou l'indexeur '{0}' -- il est en lecture seule - - Cannot call an abstract base member: '{0}' - Impossible d'appeler un membre de base abstrait : '{0}' - A property or indexer may not be passed as an out or ref parameter Une propriété ou un indexeur ne peut pas être passé en tant que paramètre de sortie (out) ni de référence (ref) @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' Ambiguïté entre '{0}' et '{1}' - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - '{0}' n'a pas de taille prédéfinie ; c'est pourquoi sizeof ne peut être utilisé que dans un contexte unsafe (utilisez System.Runtime.InteropServices.Marshal.SizeOf) - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - Impossible d'appeler directement des destructeurs et object.Finalize. Appelez IDisposable.Dispose s'il est disponible. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - Ne pas appeler directement votre méthode Finalize de la classe de base. La méthode est automatiquement appelée à partir de votre destructeur. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) Impossible de convertir implicitement le type '{0}' en '{1}'. Une conversion explicite existe (un cast est-il manquant ?) @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments L'utilisation du {1} '{0}' générique requiert les arguments de type '{2}' - - The type '{0}' may not be used as a type argument - Le type '{0}' ne peut pas être utilisé comme argument de type - The {1} '{0}' cannot be used with type arguments Impossible d'utiliser le {1} '{0}' avec des arguments de type @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. Impossible d'utiliser le type '{3}' comme paramètre de type '{2}' dans le type ou la méthode générique '{0}'. Le type Nullable '{3}' ne satisfait pas la contrainte de '{1}'. Les types Nullable ne peuvent pas satisfaire les contraintes d'interface. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - Impossible d'utiliser le type '{3}' comme paramètre de type '{2}' dans le type ou la méthode générique '{0}'. Il n'y a pas de conversion boxing ou de conversion de paramètre de type de '{3}' en '{1}'. - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. Impossible d'utiliser le type '{3}' comme paramètre de type '{2}' dans le type ou la méthode générique '{0}'. Il n'y a pas de conversion boxing de '{3}' en '{1}'. - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - Impossible de convertir null en paramètre de type '{0}' car il peut s'agir d'un type valeur qui n'autorise pas les valeurs null. Utilisez 'default({0})' à la place. - - - '{1} {0}' has the wrong return type - '{1} {0}' n'a pas le type de retour correct - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. Impossible de déduire les arguments de type pour la méthode '{0}' à partir de l'utilisation. Essayez de spécifier les arguments de type de façon explicite. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - Impossible de convertir le groupe de méthodes '{0}' en type non-délégué '{1}'. Souhaitiez-vous appeler la méthode ? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' Le type '{2}' doit être un type référence afin d'être utilisé comme paramètre '{1}' dans le type ou la méthode générique '{0}' @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' Conversions définies par l'utilisateur ambiguës '{0}' et '{1}' lors de la conversion de '{2}' en '{3}' - - Predefined type '{0}' is not defined or imported - Le type prédéfini '{0}' n'est pas défini ou importé - '{0}' is not supported by the language '{0}' n'est pas pris en charge par le langage @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor '{0}' : impossible d'appeler explicitement un opérateur ou un accesseur - - '{0}' is a type not supported by the language - '{0}' est un type qui n'est pas pris en charge par le langage - - - Missing compiler required member '{0}.{1}' - Membre requis par le compilateur '{0}.{1}' manquant - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - Impossible de convertir implicitement un littéral de type double en type '{1}' ; utilisez un suffixe '{0}' pour créer un littéral de ce type - Cannot convert to static type '{0}' Impossible de convertir en type static '{0}' - - '{0}': static types cannot be used as type arguments - '{0}' : impossible d'utiliser les types static en tant qu'arguments de type - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - Impossible de créer un délégué à partir de la méthode '{0}', car il s'agit d'une méthode partielle sans déclaration d'implémentation - The operand of an increment or decrement operator must be a variable, property or indexer L'opérande d'un opérateur d'incrémentation ou de décrémentation doit être une variable, une propriété ou un indexeur - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - '{0}' ne contient pas de définition pour '{1}' et aucune méthode d'extension '{1}' acceptant un premier argument de type '{0}' n'a été trouvée (une directive using ou une référence d'assembly est-elle manquante ?) - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - Impossible d'utiliser les méthodes d'extension '{0}' définies dans un type valeur '{1}' pour créer des délégués - No overload for method '{0}' takes '{1}' arguments Aucune surcharge pour la méthode '{0}' ne prend d'arguments '{1}' @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments La méthode surchargée correspondant le mieux à '{0}' a des arguments non valides - - Argument '{0}': cannot convert from '{1}' to '{2}' - Argument '{0}' : impossible de convertir de '{1}' en '{2}' - A ref or out argument must be an assignable variable Un argument ref ou out doit être une variable qui peut être assignée @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable Impossible de modifier la valeur de retour de '{0}' car il ne s'agit pas d'une variable - - Argument '{0}' should not be passed with the '{1}' keyword - L'argument '{0}' ne doit pas être passé avec le mot clé '{1}' - - - Argument '{0}' must be passed with the '{1}' keyword - L'argument '{0}' doit être passé avec le mot clé '{1}' - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) Impossible de modifier les membres d'un champ readonly '{0}' (sauf s'ils appartiennent à un constructeur ou un initialiseur de variable) @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' Impossible de passer '{0}' en tant qu'argument ref ou out, car il s'agit d'un '{1}' - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - Impossible de lier délégué à « {0} » parce que c'est un membre de « System.Nullable<T>» - '{0}' does not contain a constructor that takes '{1}' arguments '{0}' ne contient pas de constructeur qui accepte des arguments '{1}' - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - '{0}' ne contient pas de définition pour '{1}' et la meilleure surcharge de la méthode d'extension '{2}' contient des arguments non valides - - - Instance argument: cannot convert from '{0}' to '{1}' - Argument d'instance : impossible de convertir '{0}' en '{1}' - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - La méthode Add surchargée '{0}' correspondant le mieux à l'initialiseur de collection a des arguments non valides - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - La méthode surchargée '{0}' correspondant le mieux à l'élément de l'initialiseur de collection ne peut pas être utilisée. Les méthodes 'Add' de l'initialiseur de collection ne peuvent pas avoir de paramètres ref ou out. - Non-invocable member '{0}' cannot be used like a method. Impossible d'utiliser un membre '{0}' ne pouvant pas être appelé comme une méthode. diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.it.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.it.xlf index e51ad4d2ce..eb6fe0ba86 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.it.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.it.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined Per il tipo '{0}' non sono definiti costruttori - - The delegate '{0}' does not have a valid constructor - Il delegato '{0}' non presenta un costruttore valido - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor Impossibile utilizzare la proprietà o l'indicizzatore '{0}' in questo contesto perché manca la funzione di accesso get. @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only Impossibile assegnare un valore alla proprietà o all'indicizzatore '{0}' perché è di sola lettura - - Cannot call an abstract base member: '{0}' - Impossibile chiamare un membro di base astratto: '{0}' - A property or indexer may not be passed as an out or ref parameter Una proprietà o un indicizzatore non può essere passato come parametro out o ref @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' Ambiguità tra '{0}' e '{1}' - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - '{0}' non ha una dimensione predefinita, quindi sizeof può essere utilizzato solo in un contesto di tipo unsafe. Si consiglia di utilizzare System.Runtime.InteropServices.Marshal.SizeOf. - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - Impossibile chiamare direttamente i distruttori e object.Finalize. Provare a chiamare IDisposable.Dispose se disponibile. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - Non chiamare direttamente il metodo Finalize della classe base. Viene chiamato automaticamente dal distruttore. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) Impossibile convertire in modo implicito il tipo '{0}' in '{1}'. È presente una conversione esplicita. Probabile cast mancante. @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments L'utilizzo del {1} generico '{0}' richiede argomenti di tipo '{2}' - - The type '{0}' may not be used as a type argument - Il tipo '{0}' non può essere utilizzato come argomento di tipo - The {1} '{0}' cannot be used with type arguments Impossibile utilizzare {1} '{0}' insieme ad argomenti di tipo @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. Impossibile utilizzare il tipo '{3}' come parametro di tipo '{2}' nel tipo o metodo generico '{0}'. Il tipo nullable '{3}' non soddisfa il vincolo di '{1}'. I tipi nullable non soddisfano i vincoli di interfaccia. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - Impossibile utilizzare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Nessuna conversione boxing o conversione di parametri di tipo da '{3}' a '{1}'. - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. Impossibile utilizzare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Nessuna conversione boxing da '{3}' a '{1}'. - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - Impossibile convertire il valore Null nel parametro di tipo '{0}' perché potrebbe essere un tipo di valore non nullable. Si consiglia di utilizzare 'default({0})'. - - - '{1} {0}' has the wrong return type - Il tipo restituito di '{1} {0}' è errato - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. Impossibile dedurre gli argomenti di tipo per il metodo '{0}' dall'utilizzo. Provare a specificare gli argomenti di tipo in modo esplicito. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - Impossibile convertire il gruppo di metodi '{0}' nel tipo non delegato '{1}'. Si desiderava richiamare il metodo? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' È necessario che il tipo '{2}' sia un tipo di riferimento per essere utilizzato come parametro '{1}' nel tipo generico o nel metodo '{0}' @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' Conversioni '{0}' e '{1}' ambigue definite dall'utente durante la conversione da '{2}' a '{3}' - - Predefined type '{0}' is not defined or imported - Il tipo predefinito '{0}' non è definito né importato - '{0}' is not supported by the language '{0}' non è supportato dal linguaggio @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor '{0}': impossibile chiamare in modo esplicito l'operatore o la funzione di accesso - - '{0}' is a type not supported by the language - '{0}' è un tipo non supportato dal linguaggio - - - Missing compiler required member '{0}.{1}' - Manca il membro '{0}.{1}', necessario per il compilatore. - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - Impossibile convertire in modo implicito il valore letterale di tipo double nel tipo '{1}'. Utilizzare un suffisso '{0}' per creare un valore letterale di questo tipo - Cannot convert to static type '{0}' Impossibile convertire nel tipo statico '{0}' - - '{0}': static types cannot be used as type arguments - '{0}': i tipi statici non possono essere utilizzati come argomenti di tipi - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - Impossibile creare un delegato dal metodo '{0}' perché è un metodo parziale senza una dichiarazione di implementazione - The operand of an increment or decrement operator must be a variable, property or indexer L'operando di un operatore di incremento o decremento deve essere una variabile, una proprietà o un indicizzatore - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - '{0}' non contiene una definizione per '{1}' e non è stato trovato alcun metodo di estensione '{1}' che accetta un primo argomento di tipo '{0}'. Probabilmente manca una direttiva using o un riferimento a un assembly. - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - Impossibile utilizzare i metodi di estensione '{0}' definiti nel tipo di valore '{1}' per creare delegati - No overload for method '{0}' takes '{1}' arguments Nessun overload del metodo '{0}' accetta argomenti '{1}' @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments La corrispondenza migliore del metodo di overload per '{0}' presenta alcuni argomenti non validi - - Argument '{0}': cannot convert from '{1}' to '{2}' - Argomento '{0}': impossibile eseguire la conversione da '{1}' a '{2}' - A ref or out argument must be an assignable variable Un argomento ref o out deve essere una variabile assegnabile. @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable Impossibile modificare il valore restituito da '{0}' perché non è una variabile - - Argument '{0}' should not be passed with the '{1}' keyword - L'argomento '{0}' non deve essere passato con la parola chiave '{1}' - - - Argument '{0}' must be passed with the '{1}' keyword - L'argomento '{0}' deve essere passato con la parola chiave '{1}' - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) Impossibile modificare i membri del campo di sola lettura '{0}' (tranne che in un costruttore o in un inizializzatore di variabile) @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' Impossibile passare '{0}' come argomento ref o out perché è '{1}' - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - Non è possibile associare il delegato a '{0}' perché è un membro di 'System. Nullable<T>' - '{0}' does not contain a constructor that takes '{1}' arguments '{0}' non contiene un costruttore che accetta argomenti '{1}' - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - '{0}' non contiene una definizione per '{1}' e l'overload migliore del metodo di estensione '{2}' presenta alcuni argomenti non validi - - - Instance argument: cannot convert from '{0}' to '{1}' - Argomento dell'istanza: impossibile eseguire la conversione da '{0}' a '{1}' - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - Il miglior metodo Add di overload '{0}' per l'inizializzatore di raccolta presenta alcuni argomenti non validi - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - Impossibile utilizzare la corrispondenza migliore del metodo di overload '{0}' per l'elemento inizializzatore della raccolta. I metodi 'Add' dell'inizializzatore di raccolta non possono includere parametri ref o out. - Non-invocable member '{0}' cannot be used like a method. Impossibile utilizzare il membro non richiamabile '{0}' come metodo. diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ja.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ja.xlf index d05d8cf938..9e6c29c4b0 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ja.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ja.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined åž‹ '{0}' ã®ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ãŒå®šç¾©ã•ã‚Œã¦ã„ã¾ã›ã‚“ - - The delegate '{0}' does not have a valid constructor - デリゲート '{0}' ã«ã¯æœ‰åŠ¹ãªã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ãŒã‚ã‚Šã¾ã›ã‚“ - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor get アクセサーãŒãªã„ãŸã‚ã€ãƒ—ロパティã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ '{0}' ã‚’ã“ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only プロパティã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ '{0}' ã¯èª­ã¿å–り専用ã§ã‚ã‚‹ãŸã‚ã€å‰²ã‚Šå½“ã¦ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - Cannot call an abstract base member: '{0}' - 抽象基本メンãƒãƒ¼ã‚’呼ã³å‡ºã™ã“ã¨ã¯ã§ãã¾ã›ã‚“: '{0}' - A property or indexer may not be passed as an out or ref parameter プロパティã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ã‚’ out ã‹ ref ã®ãƒ‘ラメーターã¨ã—ã¦æ¸¡ã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。 @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' '{0}' 㨠'{1}' é–“ãŒã‚ã„ã¾ã„ã§ã™ - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - '{0}' ã«ã¯å®šç¾©æ¸ˆã¿ã®ã‚µã‚¤ã‚ºãŒæŒ‡å®šã•ã‚Œã¦ã„ãªã„ãŸã‚ã€sizeof 㯠unsafe コンテキストã§ã®ã¿ä½¿ç”¨ã§ãã¾ã™ (System.Runtime.InteropServices.Marshal.SizeOf ã®ä½¿ç”¨ã‚’ãŠå‹§ã‚ã—ã¾ã™) - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - デストラクター 㨠object.Finalize を直接呼ã³å‡ºã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。使用å¯èƒ½ã§ã‚れ㰠IDisposable.Dispose を呼ã³å‡ºã—ã¦ãã ã•ã„。 - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - 基本クラス㮠Finalize メソッドを直接呼ã³å‡ºã•ãªã„ã§ãã ã•ã„。デストラクターã‹ã‚‰è‡ªå‹•çš„ã«å‘¼ã³å‡ºã•ã‚Œã¾ã™ã€‚ - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) åž‹ '{0}' ã‚’ '{1}' ã«æš—黙的ã«å¤‰æ›ã§ãã¾ã›ã‚“。明示的ãªå¤‰æ›ãŒå­˜åœ¨ã—ã¾ã™ (cast ãŒä¸è¶³ã—ã¦ã„ãªã„ã‹ã©ã†ã‹ã‚’確èªã—ã¦ãã ã•ã„) @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments ジェãƒãƒªãƒƒã‚¯ {1} '{0}' ã®ä½¿ç”¨ã«ã¯ã€'{2}' åž‹ã®å¼•æ•°ãŒå¿…è¦ã§ã™ - - The type '{0}' may not be used as a type argument - åž‹ '{0}' ã¯åž‹å¼•æ•°ã¨ã—ã¦ã¯ä½¿ãˆã¾ã›ã‚“ - The {1} '{0}' cannot be used with type arguments {1} '{0}' ã¯åž‹å¼•æ•°ã¨ä¸€ç·’ã«ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“ @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. åž‹ '{3}' ã¯ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' 内ã§åž‹ãƒ‘ラメーター '{2}' ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。Null 許容型 '{3}' ã¯ã€'{1}' ã®åˆ¶ç´„を満ãŸã—ã¦ã„ã¾ã›ã‚“。Null 許容型ã¯ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ã‚¤ã‚¹åˆ¶ç´„を満ãŸã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - åž‹ '{3}' ã¯ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' 内ã§åž‹ãƒ‘ラメーター '{2}' ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。'{3}' ã‹ã‚‰ '{1}' ã¸ã®ãƒœãƒƒã‚¯ã‚¹å¤‰æ›ã¾ãŸã¯åž‹ãƒ‘ラメーター変æ›ãŒã‚ã‚Šã¾ã›ã‚“。 - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. åž‹ '{3}' ã¯ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' 内ã§åž‹ãƒ‘ラメーター '{2}' ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。'{3}' ã‹ã‚‰ '{1}' ã¸ã®ãƒœãƒƒã‚¯ã‚¹å¤‰æ›ãŒã‚ã‚Šã¾ã›ã‚“。 - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - Null éžè¨±å®¹ã®å€¤åž‹ã§ã‚ã‚‹å¯èƒ½æ€§ãŒã‚ã‚‹ãŸã‚ã€Null を型パラメーター '{0}' ã«å¤‰æ›ã§ãã¾ã›ã‚“。'default({0})' を使用ã—ã¦ãã ã•ã„。 - - - '{1} {0}' has the wrong return type - '{1} {0}' ã«ã¯ã€ä¸é©åˆ‡ãªæˆ»ã‚Šå€¤ã®åž‹ãŒæŒ‡å®šã•ã‚Œã¦ã„ã¾ã™ - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. メソッド '{0}' ã®åž‹å¼•æ•°ã‚’使ã„æ–¹ã‹ã‚‰æŽ¨è«–ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。型引数を明示的ã«æŒ‡å®šã—ã¦ãã ã•ã„。 - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - メソッド グループ '{0}' ã‚’éžãƒ‡ãƒªã‚²ãƒ¼ãƒˆåž‹ '{1}' ã«å¤‰æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã—ã¾ã™ã‹? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' åž‹ '{2}' ã¯ã€ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã®ãƒ‘ラメーター '{1}'ã€ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' ã¨ã—ã¦ä½¿ç”¨ã™ã‚‹ãŸã‚ã«ã€å‚照型ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“ @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' '{2}' ã‹ã‚‰ '{3}' ã¸å¤‰æ›ã™ã‚‹ã¨ãã®ã€ã‚ã„ã¾ã„ãªãƒ¦ãƒ¼ã‚¶ãƒ¼å®šç¾©ã®å¤‰æ› '{0}' ãŠã‚ˆã³ '{1}' ã§ã™ - - Predefined type '{0}' is not defined or imported - 定義済ã¿ã®åž‹ '{0}' ã¯å®šç¾©ã€ã¾ãŸã¯ã‚¤ãƒ³ãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ã¾ã›ã‚“ - '{0}' is not supported by the language '{0}' ã¯ã“ã®è¨€èªžã§ã‚µãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ã¾ã›ã‚“ @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor '{0}': 演算å­ã¾ãŸã¯ã‚¢ã‚¯ã‚»ã‚µãƒ¼ã‚’明示的ã«å‘¼ã³å‡ºã™ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - '{0}' is a type not supported by the language - '{0}' ã¯ã“ã®è¨€èªžã§ã‚µãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ãªã„åž‹ã§ã™ - - - Missing compiler required member '{0}.{1}' - コンパイラãŒå¿…è¦ã¨ã™ã‚‹ãƒ¡ãƒ³ãƒãƒ¼ '{0}.{1}' ãŒã‚ã‚Šã¾ã›ã‚“ - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - åž‹ double ã®ãƒªãƒ†ãƒ©ãƒ«ã‚’暗黙的ã«åž‹ '{1}' ã«å¤‰æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。'{0}' サフィックスを使用ã—ã¦ã€ã“ã®åž‹ã®ãƒªãƒ†ãƒ©ãƒ«ã‚’作æˆã—ã¦ãã ã•ã„ - Cannot convert to static type '{0}' スタティック型 '{0}' ã¸å¤‰æ›ã§ãã¾ã›ã‚“ - - '{0}': static types cannot be used as type arguments - '{0}': スタティック型を型引数ã¨ã—ã¦ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - メソッド '{0}' ã¯å®Ÿè£…宣言ãŒãªã„部分メソッドã§ã‚ã‚‹ãŸã‚ã€ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‹ã‚‰ãƒ‡ãƒªã‚²ãƒ¼ãƒˆã‚’作æˆã§ãã¾ã›ã‚“ - The operand of an increment or decrement operator must be a variable, property or indexer インクリメント演算å­ã¾ãŸã¯ãƒ‡ã‚¯ãƒªãƒ¡ãƒ³ãƒˆæ¼”ç®—å­ã®ã‚ªãƒšãƒ©ãƒ³ãƒ‰ã«ã¯ã€å¤‰æ•°ã€ãƒ—ロパティã€ã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ã‚’指定ã—ã¦ãã ã•ã„。 - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - '{0}' ã« '{1}' ã®å®šç¾©ãŒå«ã¾ã‚Œã¦ãŠã‚‰ãšã€åž‹ '{0}' ã®æœ€åˆã®å¼•æ•°ã‚’å—ã‘付ã‘る拡張メソッド '{1}' ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚using ディレクティブã¾ãŸã¯ã‚¢ã‚»ãƒ³ãƒ–リå‚ç…§ãŒä¸è¶³ã—ã¦ã„ã¾ã™ - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - 値ã®åž‹ '{1}' ã§å®šç¾©ã•ã‚ŒãŸæ‹¡å¼µãƒ¡ã‚½ãƒƒãƒ‰ '{0}' ã¯ã€ãƒ‡ãƒªã‚²ãƒ¼ãƒˆã‚’作æˆã™ã‚‹ãŸã‚ã«ä½¿ç”¨ã§ãã¾ã›ã‚“ - No overload for method '{0}' takes '{1}' arguments 引数を '{1}' 個指定ã§ãã‚‹ã€ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' ã®ã‚ªãƒ¼ãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ã¯ã‚ã‚Šã¾ã›ã‚“ @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments '{0}' ã«æœ€ã‚‚é©ã—ã¦ã„るオーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ メソッドã«ã¯ç„¡åŠ¹ãªå¼•æ•°ãŒã„ãã¤ã‹å«ã¾ã‚Œã¦ã„ã¾ã™ - - Argument '{0}': cannot convert from '{1}' to '{2}' - 引数 '{0}': '{1}' ã‹ã‚‰ '{2}' ã¸å¤‰æ›ã§ãã¾ã›ã‚“ - A ref or out argument must be an assignable variable ref ã¾ãŸã¯ out 引数ã¯ã€å‰²ã‚Šå½“ã¦å¯èƒ½ãªå¤‰æ•°ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable 変数ã§ã¯ãªã„ãŸã‚ã€'{0}' ã®æˆ»ã‚Šå€¤ã‚’変更ã§ãã¾ã›ã‚“ - - Argument '{0}' should not be passed with the '{1}' keyword - 引数 '{0}' ã‚’ '{1}' キーワードã¨å…±ã«æ¸¡ã™ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - - Argument '{0}' must be passed with the '{1}' keyword - 引数 '{0}' 㯠'{1}' キーワードã¨å…±ã«æ¸¡ã•ã‚Œãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“ - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) 読ã¿å–り専用フィールド '{0}' ã®ãƒ¡ãƒ³ãƒãƒ¼ã¯å¤‰æ›´ã§ãã¾ã›ã‚“ (コンストラクターã¾ãŸã¯å¤‰æ•°åˆæœŸåŒ–å­ã§ã¯å¯)。 @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' '{1}' ã§ã‚ã‚‹ãŸã‚ã€'{0}' 㯠ref ã¾ãŸã¯ out 引数ã¨ã—ã¦æ¸¡ã›ã¾ã›ã‚“ - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - 'System.Nullable<T>' ã®ãƒ¡ãƒ³ãƒãƒ¼ã§ã‚ã‚‹ãŸã‚ã«ã€'{0}' ã®ãƒ‡ãƒªã‚²ãƒ¼ãƒˆã‚’ãƒã‚¤ãƒ³ãƒ‰ã§ãã¾ã›ã‚“。 - '{0}' does not contain a constructor that takes '{1}' arguments '{0}' ã«ã€å¼•æ•°ã‚’ '{1}' 個指定ã§ãるコンストラクターãŒã‚ã‚Šã¾ã›ã‚“ - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - '{0}' ã« '{1}' ã®å®šç¾©ãŒå«ã¾ã‚Œã¦ãŠã‚‰ãšã€æœ€ã‚‚é©ã—ã¦ã„る拡張メソッド オーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ '{2}' ã«ã¯ç„¡åŠ¹ãªå¼•æ•°ãŒã„ãã¤ã‹å«ã¾ã‚Œã¦ã„ã¾ã™ - - - Instance argument: cannot convert from '{0}' to '{1}' - インスタンス引数: '{0}' ã‹ã‚‰ '{1}' ã¸å¤‰æ›ã§ãã¾ã›ã‚“ - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - コレクションåˆæœŸåŒ–å­ã«æœ€ã‚‚é©ã—ã¦ã„るオーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ Add メソッド '{0}' ã«ã¯ç„¡åŠ¹ãªå¼•æ•°ãŒã„ãã¤ã‹å«ã¾ã‚Œã¦ã„ã¾ã™ - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - コレクションåˆæœŸåŒ–å­è¦ç´ ã® '{0}' ã«æœ€ã‚‚é©ã—ã¦ã„るオーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ メソッドã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。コレクションåˆæœŸåŒ–å­ 'Add' メソッドã«ã¯ã€ref パラメーターã¾ãŸã¯ out パラメーターを使用ã§ãã¾ã›ã‚“。 - Non-invocable member '{0}' cannot be used like a method. 実行ä¸å¯èƒ½ãªãƒ¡ãƒ³ãƒãƒ¼ '{0}' をメソッドã®ã‚ˆã†ã«ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ko.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ko.xlf index aada956e7c..2fcdbc47dc 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ko.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ko.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined '{0}' 형ì‹ì— ì •ì˜ëœ ìƒì„±ìžê°€ 없습니다. - - The delegate '{0}' does not have a valid constructor - '{0}' 대리ìžì— 올바른 ìƒì„±ìžê°€ 없습니다. - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor '{0}' ì†ì„± ë˜ëŠ” ì¸ë±ì„œëŠ” get ì ‘ê·¼ìžê°€ 없으므로 ì´ ì»¨í…스트ì—ì„œ 사용할 수 없습니다. @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only '{0}' ì†ì„± ë˜ëŠ” ì¸ë±ì„œëŠ” ì½ê¸° ì „ìš©ì´ë¯€ë¡œ 할당할 수 없습니다. - - Cannot call an abstract base member: '{0}' - ì¶”ìƒ ê¸°ë³¸ 멤버를 호출할 수 없습니다. '{0}' - A property or indexer may not be passed as an out or ref parameter ì†ì„± ë˜ëŠ” ì¸ë±ì„œëŠ” out ë˜ëŠ” ref 매개 변수로 전달할 수 없습니다. @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' '{0}'ê³¼(와) '{1}' 사ì´ì— ëª¨í˜¸ì„±ì´ ìžˆìŠµë‹ˆë‹¤. - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - '{0}'ì— ë¯¸ë¦¬ ì •ì˜ëœ í¬ê¸°ê°€ 없으므로 sizeof는 안전하지 ì•Šì€ ì»¨í…스트ì—서만 사용할 수 있습니다. System.Runtime.InteropServices.Marshal.SizeOf를 사용하십시오. - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - ì†Œë©¸ìž ë° object.Finalize는 ì§ì ‘ 호출할 수 없습니다. 가능한 경우 IDisposable.Dispose를 호출하십시오. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - 기본 í´ëž˜ìŠ¤ Finalize 메서드를 ì§ì ‘ 호출하지 마십시오. ì´ ë©”ì„œë“œëŠ” 소멸ìžì—ì„œ ìžë™ìœ¼ë¡œ 호출ë©ë‹ˆë‹¤. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) 암시ì ìœ¼ë¡œ '{0}' 형ì‹ì„ '{1}' 형ì‹ìœ¼ë¡œ 변환할 수 없습니다. ëª…ì‹œì  ë³€í™˜ì´ ìžˆìŠµë‹ˆë‹¤. ìºìŠ¤íŠ¸ê°€ 있는지 확ì¸í•˜ì‹­ì‹œì˜¤. @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments 제네릭 {1} '{0}'ì„(를) 사용하려면 '{2}' í˜•ì‹ ì¸ìˆ˜ê°€ 필요합니다. - - The type '{0}' may not be used as a type argument - '{0}' 형ì‹ì€ í˜•ì‹ ì¸ìˆ˜ë¡œ 사용할 수 없습니다. - The {1} '{0}' cannot be used with type arguments {1} '{0}'ì€(는) í˜•ì‹ ì¸ìˆ˜ì™€ 함께 사용할 수 없습니다. @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. '{3}' 형ì‹ì€ 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ í˜•ì‹ ë§¤ê°œ 변수 '{2}'(으)ë¡œ 사용할 수 없습니다. nullable í˜•ì‹ '{3}'ì´(ê°€) '{1}' 제약 ì¡°ê±´ì„ ì¶©ì¡±í•˜ì§€ 않습니다. nullable 형ì‹ì€ ì–´ë– í•œ ì¸í„°íŽ˜ì´ìŠ¤ 제약 ì¡°ê±´ë„ ë§Œì¡±í•  수 없습니다. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - '{3}' 형ì‹ì€ 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ í˜•ì‹ ë§¤ê°œ 변수 '{2}'(으)ë¡œ 사용할 수 없습니다. '{3}'ì—ì„œ '{1}'(으)ë¡œì˜ boxing 변환 ë˜ëŠ” í˜•ì‹ ë§¤ê°œ 변수 ë³€í™˜ì´ ì—†ìŠµë‹ˆë‹¤. - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. '{3}' 형ì‹ì€ 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ í˜•ì‹ ë§¤ê°œ 변수 '{2}'(으)ë¡œ 사용할 수 없습니다. '{3}'ì—ì„œ '{1}'(으)ë¡œì˜ boxing ë³€í™˜ì´ ì—†ìŠµë‹ˆë‹¤. - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - nullì„ í—ˆìš©í•˜ì§€ 않는 ê°’ 형ì‹ì¼ 수 있으므로 nullì„ í˜•ì‹ ë§¤ê°œ 변수 '{0}'(으)ë¡œ 변환할 수 없습니다. 대신 'default({0})'를 사용하십시오. - - - '{1} {0}' has the wrong return type - '{1} {0}'ì— ìž˜ëª»ëœ ë°˜í™˜ 형ì‹ì´ 있습니다. - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. '{0}' ë©”ì„œë“œì˜ í˜•ì‹ ì¸ìˆ˜ë¥¼ 유추할 수 없습니다. í˜•ì‹ ì¸ìˆ˜ë¥¼ 명시ì ìœ¼ë¡œ 지정하십시오. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - '{0}' 메서드 ê·¸ë£¹ì„ ë¹„ëŒ€ë¦¬ìž í˜•ì‹ '{1}'(으)ë¡œ 변환할 수 없습니다. 메서드를 호출하시겠습니까? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ '{2}' 형ì‹ì„ '{1}' 매개 변수로 사용하려면 해당 형ì‹ì´ 참조 형ì‹ì´ì–´ì•¼ 합니다. @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' '{2}'ì—ì„œ '{3}(으)ë¡œ 변환하는 ë™ì•ˆ 모호한 ì‚¬ìš©ìž ì •ì˜ ë³€í™˜ '{0}' ë° '{1}'ì´(ê°€) ë°œìƒí–ˆìŠµë‹ˆë‹¤. - - Predefined type '{0}' is not defined or imported - 미리 ì •ì˜ëœ í˜•ì‹ '{0}'ì„(를) ì •ì˜í•˜ì§€ 않았거나 가져오지 않았습니다. - '{0}' is not supported by the language '{0}'ì€(는) 언어ì—ì„œ 지ì›ë˜ì§€ 않습니다. @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor '{0}': ì—°ì‚°ìžë‚˜ ì ‘ê·¼ìžë¥¼ 명시ì ìœ¼ë¡œ 호출할 수 없습니다. - - '{0}' is a type not supported by the language - '{0}'ì€(는) 언어ì—ì„œ 지ì›í•˜ëŠ” 형ì‹ì´ 아닙니다. - - - Missing compiler required member '{0}.{1}' - '{0}.{1}' 멤버를 필요로 하는 컴파ì¼ëŸ¬ê°€ 없습니다. - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - double 형ì‹ì˜ ë¦¬í„°ëŸ´ì„ ì•”ì‹œì ìœ¼ë¡œ '{1}' 형ì‹ìœ¼ë¡œ 변환할 수 없습니다. ì´ í˜•ì‹ì˜ ë¦¬í„°ëŸ´ì„ ë§Œë“¤ë ¤ë©´ '{0}' 접미사를 사용하십시오. - Cannot convert to static type '{0}' '{0}' ì •ì  í˜•ì‹ìœ¼ë¡œ 변환할 수 없습니다. - - '{0}': static types cannot be used as type arguments - '{0}': ì •ì  í˜•ì‹ì€ í˜•ì‹ ì¸ìˆ˜ë¡œ 사용할 수 없습니다. - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - '{0}'ì€(는) 구현 ì„ ì–¸ì´ ì—†ëŠ” 부분 메서드(Partial Method)ì´ë¯€ë¡œ ì´ ë©”ì„œë“œë¡œë¶€í„° 대리ìžë¥¼ 만들 수 없습니다. - The operand of an increment or decrement operator must be a variable, property or indexer ì¦ê°€ ì—°ì‚°ìž ë˜ëŠ” ê°ì†Œ ì—°ì‚°ìžì˜ 피연산ìžëŠ” 변수, ì†ì„± ë˜ëŠ” ì¸ë±ì„œì—¬ì•¼ 합니다. - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - '{0}'ì— '{1}'ì— ëŒ€í•œ ì •ì˜ê°€ 없고 '{0}' 형ì‹ì˜ 첫 번째 ì¸ìˆ˜ë¥¼ 허용하는 확장 메서드 '{1}'ì„(를) ì°¾ì„ ìˆ˜ 없습니다. using 지시문 ë˜ëŠ” 어셈블리 참조가 있는지 확ì¸í•˜ì‹­ì‹œì˜¤. - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - ê°’ í˜•ì‹ '{1}'ì— ì •ì˜ëœ 확장 메서드 '{0}'ì€(는) 대리ìžë¥¼ 만드는 ë° ì‚¬ìš©í•  수 없습니다. - No overload for method '{0}' takes '{1}' arguments '{1}'ê°œì˜ ì¸ìˆ˜ë¥¼ 사용하는 '{0}' ë©”ì„œë“œì— ëŒ€í•œ 오버로드가 없습니다. @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments '{0}'ì— ê°€ìž¥ ì¼ì¹˜í•˜ëŠ” ì˜¤ë²„ë¡œë“œëœ ë©”ì„œë“œì— ìž˜ëª»ëœ ì¸ìˆ˜ê°€ 있습니다. - - Argument '{0}': cannot convert from '{1}' to '{2}' - '{0}' ì¸ìˆ˜: '{1}'ì—ì„œ '{2}'(으)ë¡œ 변환할 수 없습니다. - A ref or out argument must be an assignable variable ref ë˜ëŠ” out ì¸ìˆ˜ëŠ” 할당 가능한 변수여야 합니다. @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable '{0}'ì€(는) 변수가 아니므로 해당 반환 ê°’ì„ ìˆ˜ì •í•  수 없습니다. - - Argument '{0}' should not be passed with the '{1}' keyword - '{0}' ì¸ìˆ˜ëŠ” '{1}' 키워드와 함께 전달할 수 없습니다. - - - Argument '{0}' must be passed with the '{1}' keyword - '{0}' ì¸ìˆ˜ëŠ” '{1}' 키워드와 함께 전달해야 합니다. - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) ì½ê¸° ì „ìš© í•„ë“œ '{0}'ì˜ ë©¤ë²„ëŠ” 수정할 수 없습니다. 단 ìƒì„±ìž ë˜ëŠ” 변수 ì´ë‹ˆì…œë¼ì´ì €ì—서는 예외입니다. @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' '{0}'ì€(는) '{1}'ì´ë¯€ë¡œ ref ë˜ëŠ” out ì¸ìˆ˜ë¡œ 전달할 수 없습니다. - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - 그것 'System.Nullable<T>'ì˜ ë©¤ë²„ ì´ë¯€ë¡œ ' (0) 'ì— ëŒ€ë¦¬ìžë¥¼ ë°”ì¸ë”©í•  수 없습니다. - '{0}' does not contain a constructor that takes '{1}' arguments '{0}'ì— '{1}'ê°œì˜ ì¸ìˆ˜ë¥¼ 사용하는 ìƒì„±ìžê°€ 없습니다. - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - '{0}'ì— '{1}'ì— ëŒ€í•œ ì •ì˜ê°€ 없으며 가장 ì í•©í•œ 확장 메서드 오버로드 '{2}'ì— ìž˜ëª»ëœ ì¸ìˆ˜ê°€ 있습니다. - - - Instance argument: cannot convert from '{0}' to '{1}' - ì¸ìŠ¤í„´ìŠ¤ ì¸ìˆ˜: '{0}'ì—ì„œ '{1}'(으)ë¡œ 변환할 수 없습니다. - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - ì˜¤ë²„ë¡œë“œëœ Add 메서드 중 해당 컬렉션 ì´ë‹ˆì…œë¼ì´ì €ì— 가장 ì í•©í•œ '{0}'ì— ìž˜ëª»ëœ ì¸ìˆ˜ê°€ 있습니다. - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - 컬렉션 ì´ë‹ˆì…œë¼ì´ì €ì— 대해 '{0}'ì— ê°€ìž¥ ì¼ì¹˜í•˜ëŠ” ì˜¤ë²„ë¡œë“œëœ ë©”ì„œë“œë¥¼ 사용할 수 없습니다. 컬렉션 ì´ë‹ˆì…œë¼ì´ì € 'Add' 메서드ì—는 ref ë˜ëŠ” out 매개 변수를 사용할 수 없습니다. - Non-invocable member '{0}' cannot be used like a method. 호출할 수 없는 ë©¤ë²„ì¸ '{0}'ì€(는) 메서드처럼 사용할 수 없습니다. diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ru.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ru.xlf index 10409cbe6b..c4c5974901 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ru.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.ru.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined Ð”Ð»Ñ Ñ‚Ð¸Ð¿Ð° "{0}" нет определенных конÑтрукторов - - The delegate '{0}' does not have a valid constructor - Делегат "{0}" не имеет допуÑтимого конÑтруктора - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor The property or indexer "{0}" cannot be used in this context because it lacks the get accessor @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only Ðевозможно приÑвоить значение ÑвойÑтву или индекÑатору "{0}" -- доÑтуп только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ - - Cannot call an abstract base member: '{0}' - Ðе удаетÑÑ Ð²Ñ‹Ð·Ð²Ð°Ñ‚ÑŒ абÑтрактный член базового клаÑÑа: "{0}" - A property or indexer may not be passed as an out or ref parameter СвойÑтва и индекÑаторы не могут передаватьÑÑ ÐºÐ°Ðº параметры Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼Ð¸ Ñловами out и ref @@ -190,18 +182,6 @@ Ambiguity between '{0}' and '{1}' ÐеоднозначноÑÑ‚ÑŒ между "{0}" и "{1}" - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - "{0}" does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - ÐепоÑредÑтвенный вызов деÑтрукторов и функций object.Finalize запрещен. РекомендуетÑÑ Ð²Ñ‹Ð·Ð¾Ð² IDisposable.Dispose, еÑли она доÑтупна. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - Ðе вызывайте метод Finalize базового клаÑÑа напрÑмую. Он вызываетÑÑ Ð°Ð²Ñ‚Ð¾Ð¼Ð°Ñ‚Ð¸Ñ‡ÐµÑки из деÑтруктора. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) Ðе удаетÑÑ Ð½ÐµÑвно преобразовать тип "{0}" в "{1}". СущеÑтвует Ñвное преобразование (требуетÑÑ Ð¿Ñ€Ð¸Ð²ÐµÐ´ÐµÐ½Ð¸Ðµ типа?) @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments ИÑпользование универÑального {1} "{0}" требует аргументов типа "{2}" - - The type '{0}' may not be used as a type argument - Тип '{0}' не может иÑпользоватьÑÑ Ð² качеÑтве аргумента типа - The {1} '{0}' cannot be used with type arguments {1} "{0}" не может иÑпользоватьÑÑ Ñ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚Ð°Ð¼Ð¸ типа @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. Ðевозможно иÑпользовать тип "{3}" в качеÑтве параметра типа "{2}" в универÑальном типе или методе "{0}". Ð”Ð»Ñ Ñ‚Ð¸Ð¿Ð° "{3}", допуÑкающего значение null, не выполнÑетÑÑ Ð¾Ð³Ñ€Ð°Ð½Ð¸Ñ‡ÐµÐ½Ð¸Ðµ "{1}". Типы, допуÑкающие значение null, не могут удовлетворÑÑ‚ÑŒ ни одному интерфейÑному ограничению. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - Ðевозможно иÑпользовать тип "{3}" в качеÑтве параметра типа "{2}" в универÑальном типе или методе "{0}". Ðет преобразованиÑ-упаковки или Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ Ñ‚Ð¸Ð¿Ð° параметра из "{3}" в "{1}". - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. Ðевозможно иÑпользовать тип "{3}" в качеÑтве параметра типа "{2}" в универÑальном типе или методе "{0}". Ðет преобразованиÑ-упаковки из "{3}" в "{1}". - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - Cannot convert null to type parameter "{0}" because it could be a non-nullable value type. ВмеÑто Ñтого рекомендуетÑÑ Ð¸Ñпользовать "default({0})". - - - '{1} {0}' has the wrong return type - "{1} {0}" имеет неправильный возвращаемый тип - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. The type arguments for method "{0}" cannot be inferred from the usage. ПопытайтеÑÑŒ Ñвно определить аргументы-типы. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - Ðе удаетÑÑ Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ñ‚ÑŒ группу методов "{0}" в тип, не ÑвлÑющийÑÑ Ð´ÐµÐ»ÐµÐ³Ð°Ñ‚Ð¾Ð¼ "{1}". ПредполагаетÑÑ Ð»Ð¸ вызывать Ñтот метод? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' Ð”Ð»Ñ Ð¸ÑÐ¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð² качеÑтве параметра "{1}" в универÑальном типе или методе "{0}" тип "{2}" должен быть ÑÑылочным типом @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' Ðеоднозначные пользовательÑкие Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ "{0}" и "{1}" при преобразовании из "{2}" в "{3}" - - Predefined type '{0}' is not defined or imported - Предопределенный тип "{0}" не определен и не импортирован - '{0}' is not supported by the language "{0}" не поддерживаетÑÑ Ñзыком @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor "{0}": Ñвный вызов оператора или метода доÑтупа невозможен - - '{0}' is a type not supported by the language - "{0}" ÑвлÑетÑÑ Ñ‚Ð¸Ð¿Ð¾Ð¼, который не поддерживаетÑÑ Ð² данном Ñзыке - - - Missing compiler required member '{0}.{1}' - ОтÑутÑтвует обÑзательный Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¿Ð¸Ð»Ñтора член "{0}.{1}" - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - Литерал Ñ Ñ‚Ð¸Ð¿Ð¾Ð¼ double не может быть неÑвно преобразован к типу "{1}"; Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð»Ð¸Ñ‚ÐµÑ€Ð°Ð»Ð° Ñтого типа Ñледует воÑпользоватьÑÑ ÑуффикÑом "{0}" - Cannot convert to static type '{0}' Ðе удаетÑÑ Ð²Ñ‹Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÑŒ преобразование к ÑтатичеÑкому типу "{0}" - - '{0}': static types cannot be used as type arguments - "{0}": Ð½ÐµÐ»ÑŒÐ·Ñ Ð¸Ñпользовать ÑтатичеÑкие типы в качеÑтве аргументов-типов - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - Ðевозможно Ñоздать делегат на оÑнове метода "{0}", поÑкольку он ÑвлÑетÑÑ Ñ€Ð°Ð·Ð´ÐµÐ»Ñемым методом без реализующего объÑÐ²Ð»ÐµÐ½Ð¸Ñ - The operand of an increment or decrement operator must be a variable, property or indexer Операндом оператора инкремента или декремента должна быть переменнаÑ, ÑвойÑтво или индекÑатор - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - "{0}" не Ñодержит Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð´Ð»Ñ "{1}", а найти метод раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ "{1}", принимающий первый аргумент типа "{0}", не удалоÑÑŒ (возможно, пропущена директива using или ÑÑылка на Ñборку) - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - Методы раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ "{0}", определенные Ð´Ð»Ñ Ñ‚Ð¸Ð¿Ð° Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ "{1}", не могут применÑÑ‚ÑŒÑÑ Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð´ÐµÐ»ÐµÐ³Ð°Ñ‚Ð¾Ð² - No overload for method '{0}' takes '{1}' arguments ОтÑутÑтвие перегрузки Ð´Ð»Ñ Ð¼ÐµÑ‚Ð¾Ð´Ð° "{0}" принимает"{1}" аргументы @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments Ðаиболее подходÑщий перегруженный метод Ð´Ð»Ñ "{0}" имеет неÑколько недопуÑтимых аргументов - - Argument '{0}': cannot convert from '{1}' to '{2}' - Ðргумент "{0}": невозможно преобразовать из "{1}" в "{2}" - A ref or out argument must be an assignable variable Ðргумент Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼ Ñловом ref или out должен быть переменной, которой можно приÑвоить значение @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable Cannot modify the return value of "{0}" because it is not a variable - - Argument '{0}' should not be passed with the '{1}' keyword - Ðргумент "{0}" должен быть передан Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼ Ñловом "{1}" - - - Argument '{0}' must be passed with the '{1}' keyword - Ðргумент "{0}" должен быть передан Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼ Ñловом "{1}" - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) Члены Ð¿Ð¾Ð»Ñ "{0}", предназначенного только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ, могут быть изменены только в конÑтрукторе или инициализаторе переменных @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' Ðе удалоÑÑŒ передать "{0}" как ÑÑылку или аргумент out, так как Ñто "{1}" - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - Ðе удаетÑÑ Ð¿Ñ€Ð¸Ð²Ñзать делегат '{0}', потому что он ÑвлÑетÑÑ Ñ‡Ð»ÐµÐ½Ð¾Ð¼ «System.Nullable<T>» - '{0}' does not contain a constructor that takes '{1}' arguments "{0}" не Ñодержит конÑтруктор, принимающий аргументов: {1} - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - "{0}" не Ñодержит Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð´Ð»Ñ "{1}", Ð½Ð°Ð¸Ð»ÑƒÑ‡ÑˆÐ°Ñ Ð¿ÐµÑ€ÐµÐ³Ñ€ÑƒÐ·ÐºÐ° метода раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ "{2}" имеет такие же недопуÑтимые аргументы - - - Instance argument: cannot convert from '{0}' to '{1}' - Instance argument: невозможно преобразовать из "{0}" в "{1}" - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - Ðаиболее подходÑщий перегруженный метод Add "{0}" Ð´Ð»Ñ Ð¸Ð½Ð¸Ñ†Ð¸Ð°Ð»Ð¸Ð·Ð°Ñ‚Ð¾Ñ€Ð° коллекции Ñодержит недопуÑтимые аргументы - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - Ðаиболее подходÑщий перегруженный метод, ÑоответÑтвующий "{0}" Ð´Ð»Ñ Ñлемента инициализации коллекции не может быть иÑпользован. Методы инициализации коллекции "Add" не имеют ÑÑылочных и выходных параметров. - Non-invocable member '{0}' cannot be used like a method. Ðевызываемый член "{0}" не может иÑпользоватьÑÑ ÐºÐ°Ðº метод. diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hans.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hans.xlf index 8dc5b47f8d..17983cffcc 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hans.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hans.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined 类型“{0}â€æœªå®šä¹‰æž„造函数 - - The delegate '{0}' does not have a valid constructor - 委托“{0}â€æ²¡æœ‰æœ‰æ•ˆçš„构造函数 - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor 属性或索引器“{0}â€ä¸èƒ½ç”¨åœ¨æ­¤ä¸Šä¸‹æ–‡ä¸­ï¼Œå› ä¸ºå®ƒç¼ºå°‘ get 访问器 @@ -162,10 +158,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only 无法为属性或索引器“{0}â€èµ‹å€¼ - 它是åªè¯»çš„ - - Cannot call an abstract base member: '{0}' - 无法调用抽象基æˆå‘˜:“{0}†- A property or indexer may not be passed as an out or ref parameter 属性或索引器ä¸å¾—作为 out 或 ref å‚数传递 @@ -194,14 +186,6 @@ '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) “{0}â€æ²¡æœ‰é¢„定义的大å°ï¼Œå› æ­¤ sizeof åªèƒ½åœ¨ä¸å®‰å…¨çš„上下文中使用(请考虑使用 System.Runtime.InteropServices.Marshal.SizeOf) - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - 无法直接调用æžæž„函数和 object.Finalize。如果å¯ç”¨ï¼Œè¯·è€ƒè™‘调用 IDisposable.Dispose。 - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - ä¸è¦ç›´æŽ¥è°ƒç”¨åŸºç±» Finalize 方法。它将从æžæž„函数中自动调用。 - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) 无法将类型“{0}â€éšå¼è½¬æ¢ä¸ºâ€œ{1}â€ã€‚存在一个显å¼è½¬æ¢(是å¦ç¼ºå°‘强制转æ¢?) @@ -218,10 +202,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments 使用泛型 {1}“{0}â€éœ€è¦â€œ{2}â€ä¸ªç±»åž‹å‚æ•° - - The type '{0}' may not be used as a type argument - 类型"{0}"ä¸å¯èƒ½ç”¨ä½œç±»åž‹å‚æ•° - The {1} '{0}' cannot be used with type arguments {1}“{0}â€ä¸èƒ½ä¸Žç±»åž‹å‚数一起使用 @@ -246,30 +226,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. 类型“{3}â€ä¸èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„类型å‚数“{2}â€ã€‚å¯ä»¥ä¸º null 的类型“{3}â€ä¸æ»¡è¶³â€œ{1}â€çš„约æŸã€‚å¯ä»¥ä¸º null 的类型ä¸èƒ½æ»¡è¶³ä»»ä½•æŽ¥å£çº¦æŸã€‚ - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - 类型“{3}â€ä¸èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„类型å‚数“{2}â€ã€‚没有从“{3}â€åˆ°â€œ{1}â€çš„装箱转æ¢æˆ–类型å‚数转æ¢ã€‚ - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. 类型“{3}â€ä¸èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„类型å‚数“{2}â€ã€‚没有从“{3}â€åˆ°â€œ{1}â€çš„装箱转æ¢ã€‚ - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - 无法将 null 转æ¢ä¸ºç±»åž‹å‚数“{0}â€ï¼Œå› ä¸ºå®ƒå¯èƒ½æ˜¯ä¸å¯ä»¥ä¸º null 的值类型。请考虑改用“default({0})â€ã€‚ - - - '{1} {0}' has the wrong return type - “{1} {0}â€çš„返回类型错误 - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. 无法从用法中推断出方法“{0}â€çš„类型å‚数。请å°è¯•æ˜¾å¼æŒ‡å®šç±»åž‹å‚数。 - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - 无法将方法组“{0}â€è½¬æ¢ä¸ºéžå§”托类型“{1}â€ã€‚是å¦å¸Œæœ›è°ƒç”¨æ­¤æ–¹æ³•? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' 类型“{2}â€å¿…须是引用类型æ‰èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„å‚数“{1}†@@ -282,10 +246,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' 从“{2}â€è½¬æ¢ä¸ºâ€œ{3}â€æ—¶ï¼Œç”¨æˆ·å®šä¹‰çš„转æ¢â€œ{0}â€å’Œâ€œ{1}â€å…·æœ‰äºŒä¹‰æ€§ - - Predefined type '{0}' is not defined or imported - 预定义类型“{0}â€æœªå®šä¹‰æˆ–导入 - '{0}' is not supported by the language 现用语言ä¸æ”¯æŒâ€œ{0}†@@ -294,42 +254,14 @@ '{0}': cannot explicitly call operator or accessor “{0}â€: 无法显å¼è°ƒç”¨è¿ç®—符或访问器 - - '{0}' is a type not supported by the language - “{0}â€ä¸æ˜¯çŽ°ç”¨è¯­è¨€æ”¯æŒçš„类型 - - - Missing compiler required member '{0}.{1}' - 缺少编译器è¦æ±‚çš„æˆå‘˜â€œ{0}.{1}†- - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - 无法将 Double 类型éšå¼è½¬æ¢ä¸ºâ€œ{1}â€ç±»åž‹ï¼›è¯·ä½¿ç”¨â€œ{0}â€åŽç¼€åˆ›å»ºæ­¤ç±»åž‹ - Cannot convert to static type '{0}' 无法转æ¢ä¸ºé™æ€ç±»åž‹â€œ{0}†- - '{0}': static types cannot be used as type arguments - “{0}â€: é™æ€ç±»åž‹ä¸èƒ½ç”¨ä½œç±»åž‹å‚æ•° - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - 无法通过方法“{0}â€åˆ›å»ºå§”托,因为该方法是没有实现声明的分部方法 - The operand of an increment or decrement operator must be a variable, property or indexer 递增或递å‡è¿ç®—符的æ“作数必须是å˜é‡ã€å±žæ€§æˆ–索引器 - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - “{0}â€æœªåŒ…å«â€œ{1}â€çš„定义,并且找ä¸åˆ°å¯æŽ¥å—第一个“{0}â€ç±»åž‹å‚数的扩展方法“{1}â€(是å¦ç¼ºå°‘ using 指令或程åºé›†å¼•ç”¨?) - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - 无法使用值类型“{1}â€å®šä¹‰çš„扩展方法“{0}â€æ¥åˆ›å»ºå§”托 - No overload for method '{0}' takes '{1}' arguments “{0}â€æ–¹æ³•æ²¡æœ‰é‡‡ç”¨â€œ{1}â€ä¸ªå‚æ•°çš„é‡è½½ @@ -338,10 +270,6 @@ The best overloaded method match for '{0}' has some invalid arguments 与“{0}â€æœ€åŒ¹é…çš„é‡è½½æ–¹æ³•å…·æœ‰ä¸€äº›æ— æ•ˆå‚æ•° - - Argument '{0}': cannot convert from '{1}' to '{2}' - å‚数“{0}â€: 无法从“{1}â€è½¬æ¢ä¸ºâ€œ{2}†- A ref or out argument must be an assignable variable ref 或 out å‚数必须是å¯ä»¥èµ‹å€¼çš„å˜é‡ @@ -378,14 +306,6 @@ Cannot modify the return value of '{0}' because it is not a variable 无法修改“{0}â€çš„返回值,因为它ä¸æ˜¯å˜é‡ - - Argument '{0}' should not be passed with the '{1}' keyword - å‚数“{0}â€ä¸åº”使用关键字“{1}â€ä¼ é€’ - - - Argument '{0}' must be passed with the '{1}' keyword - å‚数“{0}â€å¿…须使用关键字“{1}â€ä¼ é€’ - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) 无法修改åªè¯»å­—段“{0}â€çš„æˆå‘˜(在构造函数或å˜é‡åˆå§‹å€¼è®¾å®šé¡¹ä¸­é™¤å¤–) @@ -410,30 +330,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' “{0}â€æ˜¯ä¸€ä¸ªâ€œ{1}â€ï¼Œæ— æ³•ä½œä¸º ref 或 out å‚数进行传递 - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - ä¸èƒ½å°†å§”托绑定到 '{0}',因为它是 'System.Nullable<T>' æˆå‘˜ - '{0}' does not contain a constructor that takes '{1}' arguments “{0}â€ä¸åŒ…å«é‡‡ç”¨â€œ{1}â€ä¸ªå‚数的构造函数 - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - “{0}â€ä¸åŒ…å«â€œ{1}â€çš„定义,并且最佳扩展方法é‡è½½â€œ{2}â€å…·æœ‰ä¸€äº›æ— æ•ˆå‚æ•° - - - Instance argument: cannot convert from '{0}' to '{1}' - 实例å‚æ•°: 无法从“{0}â€è½¬æ¢ä¸ºâ€œ{1}†- - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - 集åˆåˆå§‹å€¼è®¾å®šé¡¹çš„最佳é‡è½½ Add 方法“{0}â€å…·æœ‰ä¸€äº›æ— æ•ˆå‚æ•° - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - 无法使用集åˆåˆå§‹å€¼è®¾å®šé¡¹å…ƒç´ çš„最佳é‡è½½æ–¹æ³•åŒ¹é…项“{0}â€ã€‚集åˆåˆå§‹å€¼è®¾å®šé¡¹â€œAddâ€æ–¹æ³•ä¸èƒ½å…·æœ‰ ref 或 out å‚数。 - Non-invocable member '{0}' cannot be used like a method. ä¸å¯è°ƒç”¨çš„æˆå‘˜â€œ{0}â€ä¸èƒ½åƒæ–¹æ³•ä¸€æ ·ä½¿ç”¨ã€‚ diff --git a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hant.xlf b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hant.xlf index 5f13492dec..cb8b342422 100644 --- a/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hant.xlf +++ b/external/corefx/src/Microsoft.CSharp/src/MultilingualResources/Microsoft.CSharp.zh-Hant.xlf @@ -130,10 +130,6 @@ The type '{0}' has no constructors defined 型別 '{0}' æ²’æœ‰å·²å®šç¾©çš„å»ºæ§‹å‡½å¼ - - The delegate '{0}' does not have a valid constructor - 委派 '{0}' æ²’æœ‰æœ‰æ•ˆçš„å»ºæ§‹å‡½å¼ - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor ç„¡æ³•æ–¼æ­¤å…§å®¹ä¸­ä½¿ç”¨å±¬æ€§æˆ–ç´¢å¼•å­ '{0}',因為其欠缺 get å­˜å–å­ @@ -162,18 +158,10 @@ Property or indexer '{0}' cannot be assigned to -- it is read only ç„¡æ³•æŒ‡æ´¾å±¬æ€§æˆ–ç´¢å¼•å­ '{0}' -- 其為唯讀 - - Cannot call an abstract base member: '{0}' - 無法呼å«æŠ½è±¡åŸºåº•æˆå“¡: '{0}' - A property or indexer may not be passed as an out or ref parameter 無法將屬性或索引å­ç•¶åš out 或 ref åƒæ•¸å‚³éž - - Dynamic calls cannot be used in conjunction with pointers - 動態呼å«ä¸èƒ½èˆ‡æŒ‡æ¨™ä¸€èµ·ä½¿ç”¨ - In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type as the type of its 2 parameters 為了å¯ä»¥ç•¶æˆæœ€å°‘é‹ç®— (Short Circuit) é‹ç®—å­ä½¿ç”¨ï¼Œä½¿ç”¨è€…定義的é‚輯é‹ç®—å­ ('{0}') 其傳回型別必須與其 2 個åƒæ•¸çš„åž‹åˆ¥ç›¸åŒ @@ -194,14 +182,6 @@ '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) '{0}' 沒有é å…ˆå®šç¾©çš„大å°ï¼Œå› æ­¤ sizeof åªèƒ½ä½¿ç”¨æ–¼ unsafe 內容 (å¯è€ƒæ…®ä½¿ç”¨ System.Runtime.InteropServices.Marshal.SizeOf) - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - ä¸èƒ½ç›´æŽ¥å‘¼å«è§£æ§‹å‡½å¼å’Œ object.Finalizeã€‚è«‹è€ƒæ…®å‘¼å« IDisposable.Dispose (如果有)。 - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - ä¸è¦ç›´æŽ¥å‘¼å«æ‚¨çš„基底類別 Finalize 方法。會從您的解構函å¼è‡ªå‹•å‘¼å«å®ƒã€‚ - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) 無法將型別 '{0}' éš±å«è½‰æ›ç‚º '{1}'。已有明確轉æ›å­˜åœ¨ (您是å¦æ¼æŽ‰äº†è½‰åž‹?) @@ -218,10 +198,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments 使用泛型 {1} '{0}' éœ€è¦ '{2}' 個型別引數 - - The type '{0}' may not be used as a type argument - é¡žåž‹"{0}"ä¸å¯èƒ½ç”¨ä½œé¡žåž‹åƒæ•¸ - The {1} '{0}' cannot be used with type arguments {1} '{0}' ä¸èƒ½é…åˆåž‹åˆ¥å¼•æ•¸ä½¿ç”¨ @@ -246,30 +222,14 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. 型別 '{3}' ä¸èƒ½åšç‚ºæ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中的型別åƒæ•¸ '{2}'。å¯ç‚º Null 的型別 '{3}' 未滿足 '{1}' çš„æ¢ä»¶ç´„æŸã€‚å¯ç‚º Null 的型別無法滿足所有介é¢æ¢ä»¶ç´„æŸã€‚ - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - 型別 '{3}' ä¸èƒ½åšç‚ºæ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中的型別åƒæ•¸ '{2}'。沒有從 '{3}' 到 '{1}' çš„ Boxing 轉æ›æˆ–型別åƒæ•¸è½‰æ›ã€‚ - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. 型別 '{3}' ä¸èƒ½åšç‚ºæ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中的型別åƒæ•¸ '{2}'。沒有從 '{3}' 到 '{1}' çš„ Boxing 轉æ›ã€‚ - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - 無法將 null 轉æ›æˆåž‹åˆ¥åƒæ•¸ '{0}',因為它是ä¸å¯ç‚º null 的實值型別。請考慮使用 'default({0})' 代替。 - - - '{1} {0}' has the wrong return type - '{1} {0}' 的傳回型別錯誤 - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. 方法 '{0}' 的型別引數ä¸èƒ½å¾žä½¿ç”¨æ–¹å¼æŽ¨æ–·ã€‚請嘗試明確指定型別引數。 - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - 無法將方法群組 '{0}' 轉æ›ç‚ºéžå§”派型別 '{1}'。您是å¦æƒ³è¦å«ç”¨é€™å€‹æ–¹æ³•? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' 型別 '{2}' 必須是åƒè€ƒåž‹åˆ¥ï¼Œæ‰èƒ½åœ¨æ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中åšç‚ºåƒæ•¸ '{1}' 使用 @@ -282,10 +242,6 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' 從 '{2}' 轉æ›ç‚º '{3}' 時,發ç¾æ¨¡ç¨œå…©å¯çš„ä½¿ç”¨è€…å®šç¾©è½‰æ› '{0}' å’Œ '{1}' - - Predefined type '{0}' is not defined or imported - 未定義或匯入é å…ˆå®šç¾©çš„型別 '{0}' - '{0}' is not supported by the language 此語言ä¸æ”¯æ´ '{0}' @@ -294,42 +250,14 @@ '{0}': cannot explicitly call operator or accessor '{0}': 無法明確呼å«é‹ç®—å­æˆ–å­˜å–å­ - - '{0}' is a type not supported by the language - 此語言ä¸æ”¯æ´åž‹åˆ¥ '{0}' - - - Missing compiler required member '{0}.{1}' - éºæ¼ç·¨è­¯å™¨æ‰€éœ€çš„æˆå“¡ '{0}.{1}' - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - ä¸èƒ½éš±å«å°‡åž‹åˆ¥ double 的常值轉æ›ç‚ºåž‹åˆ¥ '{1}'; 請使用 '{0}' 後置字元來建立此型別的常值 - Cannot convert to static type '{0}' 無法轉æ›ç‚ºéœæ…‹åž‹åˆ¥ '{0}' - - '{0}': static types cannot be used as type arguments - '{0}': éœæ…‹åž‹åˆ¥ä¸èƒ½ç•¶åšåž‹åˆ¥å¼•æ•¸ä½¿ç”¨ - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - 無法從方法 '{0}' 建立委派,因為它是沒有實作宣告的部分方法 - The operand of an increment or decrement operator must be a variable, property or indexer éžå¢žæˆ–éžæ¸›é‹ç®—å­çš„é‹ç®—元必須是變數ã€å±¬æ€§æˆ–索引å­ã€‚ - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - '{0}' ä¸åŒ…å« '{1}' 的定義,也找ä¸åˆ°æ“´å……方法 '{1}' 來接å—型別 '{0}' 的第一個引數 (您是å¦éºæ¼ using 指示詞或組件åƒè€ƒ?) - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - 在實值型別 '{1}' 中定義的擴充方法 '{0}' 無法用來建立委派 - No overload for method '{0}' takes '{1}' arguments 方法 '{0}' æ²’æœ‰ä»»ä½•å¤šè¼‰æŽ¥å— '{1}' 個引數 @@ -338,10 +266,6 @@ The best overloaded method match for '{0}' has some invalid arguments 最符åˆçš„多載方法 '{0}' 有一些無效的引數 - - Argument '{0}': cannot convert from '{1}' to '{2}' - 引數 '{0}': 無法從 '{1}' 轉æ›ç‚º '{2}' - A ref or out argument must be an assignable variable ref 或 out 引數必須是å¯æŒ‡æ´¾çš„變數 @@ -378,14 +302,6 @@ Cannot modify the return value of '{0}' because it is not a variable 無法修改 '{0}' 的傳回值,因為它ä¸æ˜¯è®Šæ•¸ - - Argument '{0}' should not be passed with the '{1}' keyword - 傳éžå¼•æ•¸ '{0}' 時ä¸èƒ½åŒ…å« '{1}' é—œéµå­— - - - Argument '{0}' must be passed with the '{1}' keyword - 傳éžå¼•æ•¸ '{0}' æ™‚å¿…é ˆåŒ…å« '{1}' é—œéµå­— - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) å”¯è®€æ¬„ä½ '{0}' çš„æˆå“¡ç„¡æ³•ä¿®æ”¹ (除éžæ˜¯åœ¨å»ºæ§‹å‡½å¼æˆ–變數åˆå§‹è¨­å®šå¼) @@ -410,30 +326,10 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' 無法將 '{0}' ç•¶åš ref 或 out 引數傳éžï¼Œå› ç‚ºå®ƒæ˜¯ '{1}' - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - ä¸èƒ½å°‡å§”託ç¶å®šåˆ° '{0}',因為它是 'System.Nullable<T>' æˆå“¡ - '{0}' does not contain a constructor that takes '{1}' arguments '{0}' ä¸åŒ…å«æŽ¥å— '{1}' å€‹å¼•æ•¸çš„å»ºæ§‹å‡½å¼ - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - '{0}' ä¸åŒ…å« '{1}' 的定義,而且最佳的擴充方法多載 '{2}' 有一些無效的引數 - - - Instance argument: cannot convert from '{0}' to '{1}' - 執行個體引數: 無法從 '{0}' 轉æ›ç‚º '{1}' - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - 集åˆåˆå§‹è¨­å®šå¼çš„最佳多載 Add 方法 '{0}' 有一些無效的引數 - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - 無法使用集åˆåˆå§‹è¨­å®šå¼é …目之最符åˆçš„多載方法 '{0}'。集åˆåˆå§‹è¨­å®šå¼ 'Add' 方法ä¸èƒ½å…·æœ‰ ref 或 out åƒæ•¸ã€‚ - Non-invocable member '{0}' cannot be used like a method. éžå¯å«ç”¨ (Non-invocable) æˆå“¡ '{0}' ä¸èƒ½åšç‚ºæ–¹æ³•ä½¿ç”¨ã€‚ diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.de.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.de.resx index 812a8dfee5..0b9a2ff9f1 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.de.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.de.resx @@ -105,9 +105,6 @@ Für den {0}-Typ sind keine Konstruktoren definiert. - - Der Delegat "{0}" enthält keinen gültigen Konstruktor. - Die Eigenschaft oder der Indexer "{0}" kann in diesem Kontext nicht verwendet werden, weil der get-Accessor fehlt. @@ -129,9 +126,6 @@ Für die Eigenschaft oder den Indexer "{0}" ist eine Zuweisung nicht möglich -- sie sind schreibgeschützt. - - Ein abstrakter Basismember kann nicht aufgerufen werden: '{0}' - Eine Eigenschaft oder ein Indexer kann nicht als out- oder ref-Parameter übergeben werden. @@ -150,15 +144,6 @@ Mehrdeutigkeit zwischen {0} und {1} - - {0} enthält keine vordefinierte Größe, sizeof kann daher nur in einem ungeschützten Kontext verwendet werden (verwenden Sie ggf. System.Runtime.InteropServices.Marshal.SizeOf). - - - Destruktoren und object.Finalize können nicht direkt aufgerufen werden. Rufen Sie IDisposable.Dispose auf, sofern verfügbar. - - - Rufen Sie die Finalize-Methode Ihrer Basisklasse nicht direkt auf, da sie automatisch vom Destruktor aufgerufen wird. - Der {0}-Typ kann nicht implizit in {1} konvertiert werden. Es ist bereits eine explizite Konvertierung vorhanden (möglicherweise fehlt eine Umwandlung). @@ -171,9 +156,6 @@ Die Verwendung von {1} "{0}" (generisch) erfordert {2}-Typargumente. - - Der Typ "{0}" darf nicht als Typargument verwendet werden. - {1} "{0}" kann nicht mit Typargumenten verwendet werden. @@ -192,24 +174,12 @@ Der {3}-Typ kann nicht als {2}-Typparameter im generischen Typ oder in der generischen {0}-Methode verwendet werden. Der {3}-Typ, der NULL-Werte zulässt, entspricht nicht der Einschränkung von {1}. Typen, die NULL-Werte zulassen, können Schnittstelleneinschränkungen nicht entsprechen. - - Der {3}-Typ kann nicht als {2}-Typparameter im generischen Typ oder in der generischen {0}-Methode verwendet werden. Es ist keine Boxing-Konvertierung oder Typparameterkonvertierung von {3} in {1} vorhanden. - Der {3}-Typ kann nicht als {2}-Typparameter im generischen Typ oder in der generischen {0}-Methode verwendet werden. Es ist keine Boxing-Konvertierung von {3} in {1} vorhanden. - - NULL kann nicht in den {0}-Typparameter konvertiert werden, da dieser Werttyp möglicherweise nicht auf NULL festgelegt werden kann. Verwenden Sie stattdessen ggf. default({0}). - - - Der Rückgabetyp von {1} {0} ist falsch. - Die Typargumente der {0}-Methode können nicht per Rückschluss aus der Syntax abgeleitet werden. Geben Sie die Typargumente explizit an. - - Die {0}-Methodengruppe kann nicht in den Nichtdelegattyp "{1}" konvertiert werden. Wollten Sie die Methode aufrufen? - Der {2}-Typ muss ein Referenztyp sein, damit er als {1}-Parameter im generischen Typ oder in der generischen {0}-Methode verwendet werden kann. @@ -219,51 +189,24 @@ Mehrdeutige benutzerdefinierte Konvertierungen von {0} und {1} bei der Konvertierung von {2} in {3} - - Der vordefinierte {0}-Typ ist nicht definiert oder importiert. - {0} wird von der Sprache nicht unterstützt. {0}: Der Operator oder Accessor kann nicht explizit aufgerufen werden. - - {0} ist ein Typ, der von der Sprache nicht unterstützt wird. - - - Der vom Compiler angeforderte Member "{0}.{1}" fehlt. - - - Literale vom Typ "double" können nicht implizit in den {1}-Typ konvertiert werden. Verwenden Sie ein {0}-Suffix, um ein Literal mit diesem Typ zu erstellen. - Die Konvertierung in den statischen {0}-Typ ist nicht möglich. - - {0}: Statische Typen können nicht als Typargumente verwendet werden. - - - Aus der {0}-Methode kann kein Delegat erstellt werden, da es sich um eine partielle Methode ohne implementierende Deklaration handelt. - Der Operand eines Inkrement- oder Dekrementoperators muss eine Variable, eine Eigenschaft oder ein Indexer sein. - - {0} enthält keine Definition für {1}, und es konnte keine {1}-Erweiterungsmethode gefunden werden, die ein erstes Argument vom Typ "{0}" akzeptiert (möglicherweise fehlt eine Using-Direktive oder ein Assemblyverweis). - - - Die im {1}-Werttyp definierten {0}-Erweiterungsmethoden können nicht zum Erstellen von Delegaten verwendet werden. - Keine Ãœberladung für die {0}-Methode nimmt {1}-Argumente an. Die beste Ãœbereinstimmung für die überladene {0}-Methode enthält einige ungültige Argumente. - - {0}-Argument: Die Konvertierung von {1} in {2} ist nicht möglich. - Ein ref- oder out-Argument muss eine zuweisbare Variable sein. @@ -291,12 +234,6 @@ Der Rückgabewert von {0} ist keine Variable und kann daher nicht geändert werden. - - Das {0}-Argument darf nicht mit dem {1}-Schlüsselwort übergeben werden. - - - Das {0}-Argument muss mit dem {1}-Schlüsselwort übergeben werden. - Member des schreibgeschützten Felds "{0}" können nicht geändert werden (außer in einem Konstruktor oder Variableninitialisierer). @@ -315,24 +252,9 @@ {0} ist ein(e) {1} und kann daher nicht als ref- oder out-Argument übergeben werden. - - Kann Delegaten "{0}" keine Bindung an weil es ein Mitglied von "System.Nullable<T>ist" - "{0}" enthält keinen Konstruktor, der {1}-Argumente akzeptiert. - - "{0}" enthält keine Definition für {1}, und die Ãœberladung der optimalen {2}-Erweiterungsmethode enthält einige ungültige Argumente. - - - Instanzenargument: Konvertierung von {0} in {1} ist nicht möglich. - - - Die beste Ãœbereinstimmung für die überladene {0}-Methode für den Auflistungsinitialisierer enthält einige ungültige Argumente. - - - Die beste Ãœbereinstimmung für die überladene {0}-Methode für das Auflistungsinitialisiererelement kann nicht verwendet werden. Die Add-Methoden von Auflistungsinitialisierern dürfen keine ref- oder out-Parameter enthalten. - Der nicht aufrufbare Member "{0}" kann nicht wie eine Methode verwendet werden. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.es.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.es.resx index db244c4e80..b50227d36d 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.es.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.es.resx @@ -105,9 +105,6 @@ El tipo '{0}' no tiene constructores definidos. - - El delegado '{0}' no tiene un constructor válido - La propiedad o el indizador '{0}' no se puede usar en este contexto porque carece del descriptor de acceso get. @@ -129,9 +126,6 @@ No se puede asignar a la propiedad o el indizador '{0}' porque es de solo lectura - - No se puede llamar a un miembro base abstracto: '{0}' - Una propiedad o un indizador no se puede pasar como parámetro out o ref @@ -150,15 +144,6 @@ Ambigüedad entre '{0}' y '{1}' - - '{0}' no tiene un tamaño predefinido; por tanto, sizeof sólo se puede usar en un contexto no seguro (use System.Runtime.InteropServices.Marshal.SizeOf). - - - Los destructores y object.Finalize no se pueden llamar directamente. Llame a IDisposable.Dispose si está disponible. - - - No llame directamente al método Finalize de la clase base. Se llama automáticamente desde el destructor. - No se puede convertir implícitamente el tipo '{0}' en '{1}'. Ya existe una conversión explícita (compruebe si le falta una conversión). @@ -171,9 +156,6 @@ Uso de {1} de tipo genérico ('{0}'): requiere '{2}' argumentos de tipo - - El tipo '{0}' no se puede usar como argumento de tipo - {1} '{0}' no se puede usar con argumentos de tipo. @@ -192,24 +174,12 @@ El tipo '{3}' no se puede usar como parámetro de tipo '{2}' en el tipo o método genérico '{0}'. El tipo que acepta valores NULL '{3}' no cumple la restricción de '{1}'. Los tipos que aceptan valores NULL no pueden cumplir restricciones de interfaz. - - El tipo '{3}' no se puede usar como parámetro de tipo '{2}' en el tipo o método genérico '{0}'. No hay conversión boxing ni conversión de parámetro de tipo de '{3}' a '{1}'. - El tipo '{3}' no se puede usar como parámetro de tipo '{2}' en el tipo o método genérico '{0}'. No hay conversión boxing de '{3}' a '{1}'. - - No se puede convertir NULL en el parámetro de tipo '{0}' porque podría ser un tipo de valor que no acepta valores NULL. Use 'default({0})' en su lugar. - - - '{1} {0}' es un tipo de valor devuelto equivocado - Los argumentos de tipo para el método '{0}' no se pueden inferir a partir del uso. Intente especificar los argumentos de tipo explícitamente. - - No se puede convertir el grupo de métodos '{0}' en tipo no delegado '{1}'. ¿Intentó invocar el método? - El tipo '{2}' debe ser un tipo de referencia para poder usarlo como parámetro '{1}' en el tipo o método genérico '{0}'. @@ -219,51 +189,24 @@ Conversiones ambiguas definidas por el usuario '{0}' y '{1}' al convertir de '{2}' a '{3}' - - El tipo predefinido '{0}' no está definido ni importado. - '{0}' no es compatible con el lenguaje '{0}': no se puede llamar explícitamente al operador o al descriptor de acceso - - No se admite el tipo '{0}' para este lenguaje - - - Falta el miembro '{0}.{1}' que requiere el compilador. - - - El literal de tipo double no se puede convertir implícitamente en el tipo '{1}'; use un sufijo '{0}' para crear un literal de este tipo - No se puede convertir en el tipo estático '{0}' - - '{0}': los tipos estáticos no se pueden usar como argumentos de tipo - - - No se puede crear un delegado a partir del método '{0}' porque es un método parcial sin una declaración de implementación. - El operando de un operador de incremento o decremento debe ser una variable, una propiedad o un indizador - - '{0}' no contiene una definición para '{1}' ni se encuentra ningún método de extensión '{1}' que acepte un primer argumento del tipo '{0}' (¿falta una directiva de uso o una referencia de ensamblado?). - - - Los métodos de extensión '{0}' definidos en el tipo de valor '{1}' no se pueden usar para crear delegados. - Ninguna sobrecarga del método '{0}' toma argumentos '{1}' La mejor coincidencia de método sobrecargado para '{0}' tiene algunos argumentos no válidos - - Argumento '{0}': no se puede convertir de '{1}' a '{2}' - Un argumento out o ref debe ser una variable asignable @@ -291,12 +234,6 @@ No se puede modificar el valor devuelto de '{0}' porque no es una variable. - - No se debe pasar el argumento '{0}' con la palabra clave '{1}' - - - El argumento '{0}' se debe pasar con la palabra clave '{1}' - Los miembros del campo de solo lectura '{0}' no se pueden modificar (excepto en un constructor o inicializador de variable) @@ -315,24 +252,9 @@ No se puede pasar '{0}' como argumento out o ref porque es '{1}'. - - No se puede enlazar el delegado para '{0}' porque es un miembro de 'System.Nullable<T>' - '{0}' no contiene un constructor que tome '{1}' argumentos - - '{0}' no contiene una definición para '{1}' y la mejor sobrecarga del método de extensión '{2}' tiene algunos argumentos no válidos - - - Argumento de instancia: no se puede convertir de '{0}' a '{1}' - - - El mejor método Add sobrecargado '{0}' del inicializador de colección tiene algunos argumentos no válidos - - - La mejor coincidencia de método sobrecargado '{0}' para el elemento inicializador de la colección no se puede usar. Los métodos 'Add' inicializadores de colección no pueden tener parámetros out o ref. - No se puede usar como método el miembro '{0}' no invocable. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.fr.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.fr.resx index 0f4fa44929..e31fb94aab 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.fr.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.fr.resx @@ -105,9 +105,6 @@ Aucun constructeur n'est défini pour le type '{0}' - - Le délégué '{0}' n'a pas de constructeur valide - Impossible d'utiliser la propriété ou l'indexeur '{0}' dans ce contexte, car il lui manque l'accesseur get @@ -129,9 +126,6 @@ Impossible d'assigner la propriété ou l'indexeur '{0}' -- il est en lecture seule - - Impossible d'appeler un membre de base abstrait : '{0}' - Une propriété ou un indexeur ne peut pas être passé en tant que paramètre de sortie (out) ni de référence (ref) @@ -150,15 +144,6 @@ Ambiguïté entre '{0}' et '{1}' - - '{0}' n'a pas de taille prédéfinie ; c'est pourquoi sizeof ne peut être utilisé que dans un contexte unsafe (utilisez System.Runtime.InteropServices.Marshal.SizeOf) - - - Impossible d'appeler directement des destructeurs et object.Finalize. Appelez IDisposable.Dispose s'il est disponible. - - - Ne pas appeler directement votre méthode Finalize de la classe de base. La méthode est automatiquement appelée à partir de votre destructeur. - Impossible de convertir implicitement le type '{0}' en '{1}'. Une conversion explicite existe (un cast est-il manquant ?) @@ -171,9 +156,6 @@ L'utilisation du {1} '{0}' générique requiert les arguments de type '{2}' - - Le type '{0}' ne peut pas être utilisé comme argument de type - Impossible d'utiliser le {1} '{0}' avec des arguments de type @@ -192,24 +174,12 @@ Impossible d'utiliser le type '{3}' comme paramètre de type '{2}' dans le type ou la méthode générique '{0}'. Le type Nullable '{3}' ne satisfait pas la contrainte de '{1}'. Les types Nullable ne peuvent pas satisfaire les contraintes d'interface. - - Impossible d'utiliser le type '{3}' comme paramètre de type '{2}' dans le type ou la méthode générique '{0}'. Il n'y a pas de conversion boxing ou de conversion de paramètre de type de '{3}' en '{1}'. - Impossible d'utiliser le type '{3}' comme paramètre de type '{2}' dans le type ou la méthode générique '{0}'. Il n'y a pas de conversion boxing de '{3}' en '{1}'. - - Impossible de convertir null en paramètre de type '{0}' car il peut s'agir d'un type valeur qui n'autorise pas les valeurs null. Utilisez 'default({0})' à la place. - - - '{1} {0}' n'a pas le type de retour correct - Impossible de déduire les arguments de type pour la méthode '{0}' à partir de l'utilisation. Essayez de spécifier les arguments de type de façon explicite. - - Impossible de convertir le groupe de méthodes '{0}' en type non-délégué '{1}'. Souhaitiez-vous appeler la méthode ? - Le type '{2}' doit être un type référence afin d'être utilisé comme paramètre '{1}' dans le type ou la méthode générique '{0}' @@ -219,51 +189,24 @@ Conversions définies par l'utilisateur ambiguës '{0}' et '{1}' lors de la conversion de '{2}' en '{3}' - - Le type prédéfini '{0}' n'est pas défini ou importé - '{0}' n'est pas pris en charge par le langage '{0}' : impossible d'appeler explicitement un opérateur ou un accesseur - - '{0}' est un type qui n'est pas pris en charge par le langage - - - Membre requis par le compilateur '{0}.{1}' manquant - - - Impossible de convertir implicitement un littéral de type double en type '{1}' ; utilisez un suffixe '{0}' pour créer un littéral de ce type - Impossible de convertir en type static '{0}' - - '{0}' : impossible d'utiliser les types static en tant qu'arguments de type - - - Impossible de créer un délégué à partir de la méthode '{0}', car il s'agit d'une méthode partielle sans déclaration d'implémentation - L'opérande d'un opérateur d'incrémentation ou de décrémentation doit être une variable, une propriété ou un indexeur - - '{0}' ne contient pas de définition pour '{1}' et aucune méthode d'extension '{1}' acceptant un premier argument de type '{0}' n'a été trouvée (une directive using ou une référence d'assembly est-elle manquante ?) - - - Impossible d'utiliser les méthodes d'extension '{0}' définies dans un type valeur '{1}' pour créer des délégués - Aucune surcharge pour la méthode '{0}' ne prend d'arguments '{1}' La méthode surchargée correspondant le mieux à '{0}' a des arguments non valides - - Argument '{0}' : impossible de convertir de '{1}' en '{2}' - Un argument ref ou out doit être une variable qui peut être assignée @@ -291,12 +234,6 @@ Impossible de modifier la valeur de retour de '{0}' car il ne s'agit pas d'une variable - - L'argument '{0}' ne doit pas être passé avec le mot clé '{1}' - - - L'argument '{0}' doit être passé avec le mot clé '{1}' - Impossible de modifier les membres d'un champ readonly '{0}' (sauf s'ils appartiennent à un constructeur ou un initialiseur de variable) @@ -315,24 +252,9 @@ Impossible de passer '{0}' en tant qu'argument ref ou out, car il s'agit d'un '{1}' - - Impossible de lier délégué à « {0} » parce que c'est un membre de « System.Nullable<T>» - '{0}' ne contient pas de constructeur qui accepte des arguments '{1}' - - '{0}' ne contient pas de définition pour '{1}' et la meilleure surcharge de la méthode d'extension '{2}' contient des arguments non valides - - - Argument d'instance : impossible de convertir '{0}' en '{1}' - - - La méthode Add surchargée '{0}' correspondant le mieux à l'initialiseur de collection a des arguments non valides - - - La méthode surchargée '{0}' correspondant le mieux à l'élément de l'initialiseur de collection ne peut pas être utilisée. Les méthodes 'Add' de l'initialiseur de collection ne peuvent pas avoir de paramètres ref ou out. - Impossible d'utiliser un membre '{0}' ne pouvant pas être appelé comme une méthode. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.it.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.it.resx index c417d81d53..7ca475533f 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.it.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.it.resx @@ -105,9 +105,6 @@ Per il tipo '{0}' non sono definiti costruttori - - Il delegato '{0}' non presenta un costruttore valido - Impossibile utilizzare la proprietà o l'indicizzatore '{0}' in questo contesto perché manca la funzione di accesso get. @@ -129,9 +126,6 @@ Impossibile assegnare un valore alla proprietà o all'indicizzatore '{0}' perché è di sola lettura - - Impossibile chiamare un membro di base astratto: '{0}' - Una proprietà o un indicizzatore non può essere passato come parametro out o ref @@ -150,15 +144,6 @@ Ambiguità tra '{0}' e '{1}' - - '{0}' non ha una dimensione predefinita, quindi sizeof può essere utilizzato solo in un contesto di tipo unsafe. Si consiglia di utilizzare System.Runtime.InteropServices.Marshal.SizeOf. - - - Impossibile chiamare direttamente i distruttori e object.Finalize. Provare a chiamare IDisposable.Dispose se disponibile. - - - Non chiamare direttamente il metodo Finalize della classe base. Viene chiamato automaticamente dal distruttore. - Impossibile convertire in modo implicito il tipo '{0}' in '{1}'. È presente una conversione esplicita. Probabile cast mancante. @@ -171,9 +156,6 @@ L'utilizzo del {1} generico '{0}' richiede argomenti di tipo '{2}' - - Il tipo '{0}' non può essere utilizzato come argomento di tipo - Impossibile utilizzare {1} '{0}' insieme ad argomenti di tipo @@ -192,24 +174,12 @@ Impossibile utilizzare il tipo '{3}' come parametro di tipo '{2}' nel tipo o metodo generico '{0}'. Il tipo nullable '{3}' non soddisfa il vincolo di '{1}'. I tipi nullable non soddisfano i vincoli di interfaccia. - - Impossibile utilizzare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Nessuna conversione boxing o conversione di parametri di tipo da '{3}' a '{1}'. - Impossibile utilizzare il tipo '{3}' come parametro di tipo '{2}' nel metodo o nel tipo generico '{0}'. Nessuna conversione boxing da '{3}' a '{1}'. - - Impossibile convertire il valore Null nel parametro di tipo '{0}' perché potrebbe essere un tipo di valore non nullable. Si consiglia di utilizzare 'default({0})'. - - - Il tipo restituito di '{1} {0}' è errato - Impossibile dedurre gli argomenti di tipo per il metodo '{0}' dall'utilizzo. Provare a specificare gli argomenti di tipo in modo esplicito. - - Impossibile convertire il gruppo di metodi '{0}' nel tipo non delegato '{1}'. Si desiderava richiamare il metodo? - È necessario che il tipo '{2}' sia un tipo di riferimento per essere utilizzato come parametro '{1}' nel tipo generico o nel metodo '{0}' @@ -219,51 +189,24 @@ Conversioni '{0}' e '{1}' ambigue definite dall'utente durante la conversione da '{2}' a '{3}' - - Il tipo predefinito '{0}' non è definito né importato - '{0}' non è supportato dal linguaggio '{0}': impossibile chiamare in modo esplicito l'operatore o la funzione di accesso - - '{0}' è un tipo non supportato dal linguaggio - - - Manca il membro '{0}.{1}', necessario per il compilatore. - - - Impossibile convertire in modo implicito il valore letterale di tipo double nel tipo '{1}'. Utilizzare un suffisso '{0}' per creare un valore letterale di questo tipo - Impossibile convertire nel tipo statico '{0}' - - '{0}': i tipi statici non possono essere utilizzati come argomenti di tipi - - - Impossibile creare un delegato dal metodo '{0}' perché è un metodo parziale senza una dichiarazione di implementazione - L'operando di un operatore di incremento o decremento deve essere una variabile, una proprietà o un indicizzatore - - '{0}' non contiene una definizione per '{1}' e non è stato trovato alcun metodo di estensione '{1}' che accetta un primo argomento di tipo '{0}'. Probabilmente manca una direttiva using o un riferimento a un assembly. - - - Impossibile utilizzare i metodi di estensione '{0}' definiti nel tipo di valore '{1}' per creare delegati - Nessun overload del metodo '{0}' accetta argomenti '{1}' La corrispondenza migliore del metodo di overload per '{0}' presenta alcuni argomenti non validi - - Argomento '{0}': impossibile eseguire la conversione da '{1}' a '{2}' - Un argomento ref o out deve essere una variabile assegnabile. @@ -291,12 +234,6 @@ Impossibile modificare il valore restituito da '{0}' perché non è una variabile - - L'argomento '{0}' non deve essere passato con la parola chiave '{1}' - - - L'argomento '{0}' deve essere passato con la parola chiave '{1}' - Impossibile modificare i membri del campo di sola lettura '{0}' (tranne che in un costruttore o in un inizializzatore di variabile) @@ -315,24 +252,9 @@ Impossibile passare '{0}' come argomento ref o out perché è '{1}' - - Non è possibile associare il delegato a '{0}' perché è un membro di 'System. Nullable<T>' - '{0}' non contiene un costruttore che accetta argomenti '{1}' - - '{0}' non contiene una definizione per '{1}' e l'overload migliore del metodo di estensione '{2}' presenta alcuni argomenti non validi - - - Argomento dell'istanza: impossibile eseguire la conversione da '{0}' a '{1}' - - - Il miglior metodo Add di overload '{0}' per l'inizializzatore di raccolta presenta alcuni argomenti non validi - - - Impossibile utilizzare la corrispondenza migliore del metodo di overload '{0}' per l'elemento inizializzatore della raccolta. I metodi 'Add' dell'inizializzatore di raccolta non possono includere parametri ref o out. - Impossibile utilizzare il membro non richiamabile '{0}' come metodo. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ja.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ja.resx index ea0a92c769..861002fe0a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ja.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ja.resx @@ -105,9 +105,6 @@ åž‹ '{0}' ã®ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ãŒå®šç¾©ã•ã‚Œã¦ã„ã¾ã›ã‚“ - - デリゲート '{0}' ã«ã¯æœ‰åŠ¹ãªã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ãŒã‚ã‚Šã¾ã›ã‚“ - get アクセサーãŒãªã„ãŸã‚ã€ãƒ—ロパティã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ '{0}' ã‚’ã“ã®ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã§ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ @@ -129,9 +126,6 @@ プロパティã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ '{0}' ã¯èª­ã¿å–り専用ã§ã‚ã‚‹ãŸã‚ã€å‰²ã‚Šå½“ã¦ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - 抽象基本メンãƒãƒ¼ã‚’呼ã³å‡ºã™ã“ã¨ã¯ã§ãã¾ã›ã‚“: '{0}' - プロパティã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ã‚’ out ã‹ ref ã®ãƒ‘ラメーターã¨ã—ã¦æ¸¡ã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。 @@ -150,15 +144,6 @@ '{0}' 㨠'{1}' é–“ãŒã‚ã„ã¾ã„ã§ã™ - - '{0}' ã«ã¯å®šç¾©æ¸ˆã¿ã®ã‚µã‚¤ã‚ºãŒæŒ‡å®šã•ã‚Œã¦ã„ãªã„ãŸã‚ã€sizeof 㯠unsafe コンテキストã§ã®ã¿ä½¿ç”¨ã§ãã¾ã™ (System.Runtime.InteropServices.Marshal.SizeOf ã®ä½¿ç”¨ã‚’ãŠå‹§ã‚ã—ã¾ã™) - - - デストラクター 㨠object.Finalize を直接呼ã³å‡ºã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。使用å¯èƒ½ã§ã‚れ㰠IDisposable.Dispose を呼ã³å‡ºã—ã¦ãã ã•ã„。 - - - 基本クラス㮠Finalize メソッドを直接呼ã³å‡ºã•ãªã„ã§ãã ã•ã„。デストラクターã‹ã‚‰è‡ªå‹•çš„ã«å‘¼ã³å‡ºã•ã‚Œã¾ã™ã€‚ - åž‹ '{0}' ã‚’ '{1}' ã«æš—黙的ã«å¤‰æ›ã§ãã¾ã›ã‚“。明示的ãªå¤‰æ›ãŒå­˜åœ¨ã—ã¾ã™ (cast ãŒä¸è¶³ã—ã¦ã„ãªã„ã‹ã©ã†ã‹ã‚’確èªã—ã¦ãã ã•ã„) @@ -171,9 +156,6 @@ ジェãƒãƒªãƒƒã‚¯ {1} '{0}' ã®ä½¿ç”¨ã«ã¯ã€'{2}' åž‹ã®å¼•æ•°ãŒå¿…è¦ã§ã™ - - åž‹ '{0}' ã¯åž‹å¼•æ•°ã¨ã—ã¦ã¯ä½¿ãˆã¾ã›ã‚“ - {1} '{0}' ã¯åž‹å¼•æ•°ã¨ä¸€ç·’ã«ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“ @@ -192,24 +174,12 @@ åž‹ '{3}' ã¯ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' 内ã§åž‹ãƒ‘ラメーター '{2}' ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。Null 許容型 '{3}' ã¯ã€'{1}' ã®åˆ¶ç´„を満ãŸã—ã¦ã„ã¾ã›ã‚“。Null 許容型ã¯ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ã‚¤ã‚¹åˆ¶ç´„を満ãŸã™ã“ã¨ã¯ã§ãã¾ã›ã‚“。 - - åž‹ '{3}' ã¯ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' 内ã§åž‹ãƒ‘ラメーター '{2}' ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。'{3}' ã‹ã‚‰ '{1}' ã¸ã®ãƒœãƒƒã‚¯ã‚¹å¤‰æ›ã¾ãŸã¯åž‹ãƒ‘ラメーター変æ›ãŒã‚ã‚Šã¾ã›ã‚“。 - åž‹ '{3}' ã¯ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' 内ã§åž‹ãƒ‘ラメーター '{2}' ã¨ã—ã¦ä½¿ç”¨ã§ãã¾ã›ã‚“。'{3}' ã‹ã‚‰ '{1}' ã¸ã®ãƒœãƒƒã‚¯ã‚¹å¤‰æ›ãŒã‚ã‚Šã¾ã›ã‚“。 - - Null éžè¨±å®¹ã®å€¤åž‹ã§ã‚ã‚‹å¯èƒ½æ€§ãŒã‚ã‚‹ãŸã‚ã€Null を型パラメーター '{0}' ã«å¤‰æ›ã§ãã¾ã›ã‚“。'default({0})' を使用ã—ã¦ãã ã•ã„。 - - - '{1} {0}' ã«ã¯ã€ä¸é©åˆ‡ãªæˆ»ã‚Šå€¤ã®åž‹ãŒæŒ‡å®šã•ã‚Œã¦ã„ã¾ã™ - メソッド '{0}' ã®åž‹å¼•æ•°ã‚’使ã„æ–¹ã‹ã‚‰æŽ¨è«–ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。型引数を明示的ã«æŒ‡å®šã—ã¦ãã ã•ã„。 - - メソッド グループ '{0}' ã‚’éžãƒ‡ãƒªã‚²ãƒ¼ãƒˆåž‹ '{1}' ã«å¤‰æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã—ã¾ã™ã‹? - åž‹ '{2}' ã¯ã€ã‚¸ã‚§ãƒãƒªãƒƒã‚¯åž‹ã®ãƒ‘ラメーター '{1}'ã€ã¾ãŸã¯ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' ã¨ã—ã¦ä½¿ç”¨ã™ã‚‹ãŸã‚ã«ã€å‚照型ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“ @@ -219,51 +189,24 @@ '{2}' ã‹ã‚‰ '{3}' ã¸å¤‰æ›ã™ã‚‹ã¨ãã®ã€ã‚ã„ã¾ã„ãªãƒ¦ãƒ¼ã‚¶ãƒ¼å®šç¾©ã®å¤‰æ› '{0}' ãŠã‚ˆã³ '{1}' ã§ã™ - - 定義済ã¿ã®åž‹ '{0}' ã¯å®šç¾©ã€ã¾ãŸã¯ã‚¤ãƒ³ãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ã¾ã›ã‚“ - '{0}' ã¯ã“ã®è¨€èªžã§ã‚µãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ã¾ã›ã‚“ '{0}': 演算å­ã¾ãŸã¯ã‚¢ã‚¯ã‚»ã‚µãƒ¼ã‚’明示的ã«å‘¼ã³å‡ºã™ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - '{0}' ã¯ã“ã®è¨€èªžã§ã‚µãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ãªã„åž‹ã§ã™ - - - コンパイラãŒå¿…è¦ã¨ã™ã‚‹ãƒ¡ãƒ³ãƒãƒ¼ '{0}.{1}' ãŒã‚ã‚Šã¾ã›ã‚“ - - - åž‹ double ã®ãƒªãƒ†ãƒ©ãƒ«ã‚’暗黙的ã«åž‹ '{1}' ã«å¤‰æ›ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。'{0}' サフィックスを使用ã—ã¦ã€ã“ã®åž‹ã®ãƒªãƒ†ãƒ©ãƒ«ã‚’作æˆã—ã¦ãã ã•ã„ - スタティック型 '{0}' ã¸å¤‰æ›ã§ãã¾ã›ã‚“ - - '{0}': スタティック型を型引数ã¨ã—ã¦ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - - メソッド '{0}' ã¯å®Ÿè£…宣言ãŒãªã„部分メソッドã§ã‚ã‚‹ãŸã‚ã€ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã‹ã‚‰ãƒ‡ãƒªã‚²ãƒ¼ãƒˆã‚’作æˆã§ãã¾ã›ã‚“ - インクリメント演算å­ã¾ãŸã¯ãƒ‡ã‚¯ãƒªãƒ¡ãƒ³ãƒˆæ¼”ç®—å­ã®ã‚ªãƒšãƒ©ãƒ³ãƒ‰ã«ã¯ã€å¤‰æ•°ã€ãƒ—ロパティã€ã¾ãŸã¯ã‚¤ãƒ³ãƒ‡ã‚¯ã‚µãƒ¼ã‚’指定ã—ã¦ãã ã•ã„。 - - '{0}' ã« '{1}' ã®å®šç¾©ãŒå«ã¾ã‚Œã¦ãŠã‚‰ãšã€åž‹ '{0}' ã®æœ€åˆã®å¼•æ•°ã‚’å—ã‘付ã‘る拡張メソッド '{1}' ãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚using ディレクティブã¾ãŸã¯ã‚¢ã‚»ãƒ³ãƒ–リå‚ç…§ãŒä¸è¶³ã—ã¦ã„ã¾ã™ - - - 値ã®åž‹ '{1}' ã§å®šç¾©ã•ã‚ŒãŸæ‹¡å¼µãƒ¡ã‚½ãƒƒãƒ‰ '{0}' ã¯ã€ãƒ‡ãƒªã‚²ãƒ¼ãƒˆã‚’作æˆã™ã‚‹ãŸã‚ã«ä½¿ç”¨ã§ãã¾ã›ã‚“ - 引数を '{1}' 個指定ã§ãã‚‹ã€ãƒ¡ã‚½ãƒƒãƒ‰ '{0}' ã®ã‚ªãƒ¼ãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ã¯ã‚ã‚Šã¾ã›ã‚“ '{0}' ã«æœ€ã‚‚é©ã—ã¦ã„るオーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ メソッドã«ã¯ç„¡åŠ¹ãªå¼•æ•°ãŒã„ãã¤ã‹å«ã¾ã‚Œã¦ã„ã¾ã™ - - 引数 '{0}': '{1}' ã‹ã‚‰ '{2}' ã¸å¤‰æ›ã§ãã¾ã›ã‚“ - ref ã¾ãŸã¯ out 引数ã¯ã€å‰²ã‚Šå½“ã¦å¯èƒ½ãªå¤‰æ•°ã§ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“。 @@ -291,12 +234,6 @@ 変数ã§ã¯ãªã„ãŸã‚ã€'{0}' ã®æˆ»ã‚Šå€¤ã‚’変更ã§ãã¾ã›ã‚“ - - 引数 '{0}' ã‚’ '{1}' キーワードã¨å…±ã«æ¸¡ã™ã“ã¨ã¯ã§ãã¾ã›ã‚“ - - - 引数 '{0}' 㯠'{1}' キーワードã¨å…±ã«æ¸¡ã•ã‚Œãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“ - 読ã¿å–り専用フィールド '{0}' ã®ãƒ¡ãƒ³ãƒãƒ¼ã¯å¤‰æ›´ã§ãã¾ã›ã‚“ (コンストラクターã¾ãŸã¯å¤‰æ•°åˆæœŸåŒ–å­ã§ã¯å¯)。 @@ -315,24 +252,9 @@ '{1}' ã§ã‚ã‚‹ãŸã‚ã€'{0}' 㯠ref ã¾ãŸã¯ out 引数ã¨ã—ã¦æ¸¡ã›ã¾ã›ã‚“ - - 'System.Nullable<T>' ã®ãƒ¡ãƒ³ãƒãƒ¼ã§ã‚ã‚‹ãŸã‚ã«ã€'{0}' ã®ãƒ‡ãƒªã‚²ãƒ¼ãƒˆã‚’ãƒã‚¤ãƒ³ãƒ‰ã§ãã¾ã›ã‚“。 - '{0}' ã«ã€å¼•æ•°ã‚’ '{1}' 個指定ã§ãるコンストラクターãŒã‚ã‚Šã¾ã›ã‚“ - - '{0}' ã« '{1}' ã®å®šç¾©ãŒå«ã¾ã‚Œã¦ãŠã‚‰ãšã€æœ€ã‚‚é©ã—ã¦ã„る拡張メソッド オーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ '{2}' ã«ã¯ç„¡åŠ¹ãªå¼•æ•°ãŒã„ãã¤ã‹å«ã¾ã‚Œã¦ã„ã¾ã™ - - - インスタンス引数: '{0}' ã‹ã‚‰ '{1}' ã¸å¤‰æ›ã§ãã¾ã›ã‚“ - - - コレクションåˆæœŸåŒ–å­ã«æœ€ã‚‚é©ã—ã¦ã„るオーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ Add メソッド '{0}' ã«ã¯ç„¡åŠ¹ãªå¼•æ•°ãŒã„ãã¤ã‹å«ã¾ã‚Œã¦ã„ã¾ã™ - - - コレクションåˆæœŸåŒ–å­è¦ç´ ã® '{0}' ã«æœ€ã‚‚é©ã—ã¦ã„るオーãƒãƒ¼ãƒ­ãƒ¼ãƒ‰ メソッドã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。コレクションåˆæœŸåŒ–å­ 'Add' メソッドã«ã¯ã€ref パラメーターã¾ãŸã¯ out パラメーターを使用ã§ãã¾ã›ã‚“。 - 実行ä¸å¯èƒ½ãªãƒ¡ãƒ³ãƒãƒ¼ '{0}' をメソッドã®ã‚ˆã†ã«ä½¿ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“。 diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ko.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ko.resx index 500a3e4caa..a2a6b1bf15 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ko.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ko.resx @@ -105,9 +105,6 @@ '{0}' 형ì‹ì— ì •ì˜ëœ ìƒì„±ìžê°€ 없습니다. - - '{0}' 대리ìžì— 올바른 ìƒì„±ìžê°€ 없습니다. - '{0}' ì†ì„± ë˜ëŠ” ì¸ë±ì„œëŠ” get ì ‘ê·¼ìžê°€ 없으므로 ì´ ì»¨í…스트ì—ì„œ 사용할 수 없습니다. @@ -129,9 +126,6 @@ '{0}' ì†ì„± ë˜ëŠ” ì¸ë±ì„œëŠ” ì½ê¸° ì „ìš©ì´ë¯€ë¡œ 할당할 수 없습니다. - - ì¶”ìƒ ê¸°ë³¸ 멤버를 호출할 수 없습니다. '{0}' - ì†ì„± ë˜ëŠ” ì¸ë±ì„œëŠ” out ë˜ëŠ” ref 매개 변수로 전달할 수 없습니다. @@ -150,15 +144,6 @@ '{0}'ê³¼(와) '{1}' 사ì´ì— ëª¨í˜¸ì„±ì´ ìžˆìŠµë‹ˆë‹¤. - - '{0}'ì— ë¯¸ë¦¬ ì •ì˜ëœ í¬ê¸°ê°€ 없으므로 sizeof는 안전하지 ì•Šì€ ì»¨í…스트ì—서만 사용할 수 있습니다. System.Runtime.InteropServices.Marshal.SizeOf를 사용하십시오. - - - ì†Œë©¸ìž ë° object.Finalize는 ì§ì ‘ 호출할 수 없습니다. 가능한 경우 IDisposable.Dispose를 호출하십시오. - - - 기본 í´ëž˜ìŠ¤ Finalize 메서드를 ì§ì ‘ 호출하지 마십시오. ì´ ë©”ì„œë“œëŠ” 소멸ìžì—ì„œ ìžë™ìœ¼ë¡œ 호출ë©ë‹ˆë‹¤. - 암시ì ìœ¼ë¡œ '{0}' 형ì‹ì„ '{1}' 형ì‹ìœ¼ë¡œ 변환할 수 없습니다. ëª…ì‹œì  ë³€í™˜ì´ ìžˆìŠµë‹ˆë‹¤. ìºìŠ¤íŠ¸ê°€ 있는지 확ì¸í•˜ì‹­ì‹œì˜¤. @@ -171,9 +156,6 @@ 제네릭 {1} '{0}'ì„(를) 사용하려면 '{2}' í˜•ì‹ ì¸ìˆ˜ê°€ 필요합니다. - - '{0}' 형ì‹ì€ í˜•ì‹ ì¸ìˆ˜ë¡œ 사용할 수 없습니다. - {1} '{0}'ì€(는) í˜•ì‹ ì¸ìˆ˜ì™€ 함께 사용할 수 없습니다. @@ -192,24 +174,12 @@ '{3}' 형ì‹ì€ 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ í˜•ì‹ ë§¤ê°œ 변수 '{2}'(으)ë¡œ 사용할 수 없습니다. nullable í˜•ì‹ '{3}'ì´(ê°€) '{1}' 제약 ì¡°ê±´ì„ ì¶©ì¡±í•˜ì§€ 않습니다. nullable 형ì‹ì€ ì–´ë– í•œ ì¸í„°íŽ˜ì´ìŠ¤ 제약 ì¡°ê±´ë„ ë§Œì¡±í•  수 없습니다. - - '{3}' 형ì‹ì€ 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ í˜•ì‹ ë§¤ê°œ 변수 '{2}'(으)ë¡œ 사용할 수 없습니다. '{3}'ì—ì„œ '{1}'(으)ë¡œì˜ boxing 변환 ë˜ëŠ” í˜•ì‹ ë§¤ê°œ 변수 ë³€í™˜ì´ ì—†ìŠµë‹ˆë‹¤. - '{3}' 형ì‹ì€ 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ í˜•ì‹ ë§¤ê°œ 변수 '{2}'(으)ë¡œ 사용할 수 없습니다. '{3}'ì—ì„œ '{1}'(으)ë¡œì˜ boxing ë³€í™˜ì´ ì—†ìŠµë‹ˆë‹¤. - - nullì„ í—ˆìš©í•˜ì§€ 않는 ê°’ 형ì‹ì¼ 수 있으므로 nullì„ í˜•ì‹ ë§¤ê°œ 변수 '{0}'(으)ë¡œ 변환할 수 없습니다. 대신 'default({0})'를 사용하십시오. - - - '{1} {0}'ì— ìž˜ëª»ëœ ë°˜í™˜ 형ì‹ì´ 있습니다. - '{0}' ë©”ì„œë“œì˜ í˜•ì‹ ì¸ìˆ˜ë¥¼ 유추할 수 없습니다. í˜•ì‹ ì¸ìˆ˜ë¥¼ 명시ì ìœ¼ë¡œ 지정하십시오. - - '{0}' 메서드 ê·¸ë£¹ì„ ë¹„ëŒ€ë¦¬ìž í˜•ì‹ '{1}'(으)ë¡œ 변환할 수 없습니다. 메서드를 호출하시겠습니까? - 제네릭 í˜•ì‹ ë˜ëŠ” 메서드 '{0}'ì—ì„œ '{2}' 형ì‹ì„ '{1}' 매개 변수로 사용하려면 해당 형ì‹ì´ 참조 형ì‹ì´ì–´ì•¼ 합니다. @@ -219,51 +189,24 @@ '{2}'ì—ì„œ '{3}(으)ë¡œ 변환하는 ë™ì•ˆ 모호한 ì‚¬ìš©ìž ì •ì˜ ë³€í™˜ '{0}' ë° '{1}'ì´(ê°€) ë°œìƒí–ˆìŠµë‹ˆë‹¤. - - 미리 ì •ì˜ëœ í˜•ì‹ '{0}'ì„(를) ì •ì˜í•˜ì§€ 않았거나 가져오지 않았습니다. - '{0}'ì€(는) 언어ì—ì„œ 지ì›ë˜ì§€ 않습니다. '{0}': ì—°ì‚°ìžë‚˜ ì ‘ê·¼ìžë¥¼ 명시ì ìœ¼ë¡œ 호출할 수 없습니다. - - '{0}'ì€(는) 언어ì—ì„œ 지ì›í•˜ëŠ” 형ì‹ì´ 아닙니다. - - - '{0}.{1}' 멤버를 필요로 하는 컴파ì¼ëŸ¬ê°€ 없습니다. - - - double 형ì‹ì˜ ë¦¬í„°ëŸ´ì„ ì•”ì‹œì ìœ¼ë¡œ '{1}' 형ì‹ìœ¼ë¡œ 변환할 수 없습니다. ì´ í˜•ì‹ì˜ ë¦¬í„°ëŸ´ì„ ë§Œë“¤ë ¤ë©´ '{0}' 접미사를 사용하십시오. - '{0}' ì •ì  í˜•ì‹ìœ¼ë¡œ 변환할 수 없습니다. - - '{0}': ì •ì  í˜•ì‹ì€ í˜•ì‹ ì¸ìˆ˜ë¡œ 사용할 수 없습니다. - - - '{0}'ì€(는) 구현 ì„ ì–¸ì´ ì—†ëŠ” 부분 메서드(Partial Method)ì´ë¯€ë¡œ ì´ ë©”ì„œë“œë¡œë¶€í„° 대리ìžë¥¼ 만들 수 없습니다. - ì¦ê°€ ì—°ì‚°ìž ë˜ëŠ” ê°ì†Œ ì—°ì‚°ìžì˜ 피연산ìžëŠ” 변수, ì†ì„± ë˜ëŠ” ì¸ë±ì„œì—¬ì•¼ 합니다. - - '{0}'ì— '{1}'ì— ëŒ€í•œ ì •ì˜ê°€ 없고 '{0}' 형ì‹ì˜ 첫 번째 ì¸ìˆ˜ë¥¼ 허용하는 확장 메서드 '{1}'ì„(를) ì°¾ì„ ìˆ˜ 없습니다. using 지시문 ë˜ëŠ” 어셈블리 참조가 있는지 확ì¸í•˜ì‹­ì‹œì˜¤. - - - ê°’ í˜•ì‹ '{1}'ì— ì •ì˜ëœ 확장 메서드 '{0}'ì€(는) 대리ìžë¥¼ 만드는 ë° ì‚¬ìš©í•  수 없습니다. - '{1}'ê°œì˜ ì¸ìˆ˜ë¥¼ 사용하는 '{0}' ë©”ì„œë“œì— ëŒ€í•œ 오버로드가 없습니다. '{0}'ì— ê°€ìž¥ ì¼ì¹˜í•˜ëŠ” ì˜¤ë²„ë¡œë“œëœ ë©”ì„œë“œì— ìž˜ëª»ëœ ì¸ìˆ˜ê°€ 있습니다. - - '{0}' ì¸ìˆ˜: '{1}'ì—ì„œ '{2}'(으)ë¡œ 변환할 수 없습니다. - ref ë˜ëŠ” out ì¸ìˆ˜ëŠ” 할당 가능한 변수여야 합니다. @@ -291,12 +234,6 @@ '{0}'ì€(는) 변수가 아니므로 해당 반환 ê°’ì„ ìˆ˜ì •í•  수 없습니다. - - '{0}' ì¸ìˆ˜ëŠ” '{1}' 키워드와 함께 전달할 수 없습니다. - - - '{0}' ì¸ìˆ˜ëŠ” '{1}' 키워드와 함께 전달해야 합니다. - ì½ê¸° ì „ìš© í•„ë“œ '{0}'ì˜ ë©¤ë²„ëŠ” 수정할 수 없습니다. 단 ìƒì„±ìž ë˜ëŠ” 변수 ì´ë‹ˆì…œë¼ì´ì €ì—서는 예외입니다. @@ -315,24 +252,9 @@ '{0}'ì€(는) '{1}'ì´ë¯€ë¡œ ref ë˜ëŠ” out ì¸ìˆ˜ë¡œ 전달할 수 없습니다. - - 그것 'System.Nullable<T>'ì˜ ë©¤ë²„ ì´ë¯€ë¡œ ' (0) 'ì— ëŒ€ë¦¬ìžë¥¼ ë°”ì¸ë”©í•  수 없습니다. - '{0}'ì— '{1}'ê°œì˜ ì¸ìˆ˜ë¥¼ 사용하는 ìƒì„±ìžê°€ 없습니다. - - '{0}'ì— '{1}'ì— ëŒ€í•œ ì •ì˜ê°€ 없으며 가장 ì í•©í•œ 확장 메서드 오버로드 '{2}'ì— ìž˜ëª»ëœ ì¸ìˆ˜ê°€ 있습니다. - - - ì¸ìŠ¤í„´ìŠ¤ ì¸ìˆ˜: '{0}'ì—ì„œ '{1}'(으)ë¡œ 변환할 수 없습니다. - - - ì˜¤ë²„ë¡œë“œëœ Add 메서드 중 해당 컬렉션 ì´ë‹ˆì…œë¼ì´ì €ì— 가장 ì í•©í•œ '{0}'ì— ìž˜ëª»ëœ ì¸ìˆ˜ê°€ 있습니다. - - - 컬렉션 ì´ë‹ˆì…œë¼ì´ì €ì— 대해 '{0}'ì— ê°€ìž¥ ì¼ì¹˜í•˜ëŠ” ì˜¤ë²„ë¡œë“œëœ ë©”ì„œë“œë¥¼ 사용할 수 없습니다. 컬렉션 ì´ë‹ˆì…œë¼ì´ì € 'Add' 메서드ì—는 ref ë˜ëŠ” out 매개 변수를 사용할 수 없습니다. - 호출할 수 없는 ë©¤ë²„ì¸ '{0}'ì€(는) 메서드처럼 사용할 수 없습니다. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.resx index b51391b37b..cfb5bb414c 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.resx @@ -151,9 +151,6 @@ The type '{0}' has no constructors defined - - The delegate '{0}' does not have a valid constructor - The property or indexer '{0}' cannot be used in this context because it lacks the get accessor @@ -175,9 +172,6 @@ Property or indexer '{0}' cannot be assigned to -- it is read only - - Cannot call an abstract base member: '{0}' - A property or indexer may not be passed as an out or ref parameter @@ -196,15 +190,6 @@ Ambiguity between '{0}' and '{1}' - - '{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - - - Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available. - - - Do not directly call your base class Finalize method. It is called automatically from your destructor. - Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?) @@ -217,9 +202,6 @@ Using the generic {1} '{0}' requires '{2}' type arguments - - The type '{0}' may not be used as a type argument - The {1} '{0}' cannot be used with type arguments @@ -238,24 +220,12 @@ The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints. - - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'. - The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'. - - Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead. - - - '{1} {0}' has the wrong return type - The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly. - - Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method? - The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}' @@ -265,51 +235,24 @@ Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}' - - Predefined type '{0}' is not defined or imported - '{0}' is not supported by the language '{0}': cannot explicitly call operator or accessor - - '{0}' is a type not supported by the language - - - Missing compiler required member '{0}.{1}' - - - Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type - Cannot convert to static type '{0}' - - '{0}': static types cannot be used as type arguments - - - Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration - The operand of an increment or decrement operator must be a variable, property or indexer - - '{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?) - - - Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates - No overload for method '{0}' takes '{1}' arguments The best overloaded method match for '{0}' has some invalid arguments - - Argument '{0}': cannot convert from '{1}' to '{2}' - A ref or out argument must be an assignable variable @@ -337,12 +280,6 @@ Cannot modify the return value of '{0}' because it is not a variable - - Argument '{0}' should not be passed with the '{1}' keyword - - - Argument '{0}' must be passed with the '{1}' keyword - Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer) @@ -361,24 +298,9 @@ Cannot pass '{0}' as a ref or out argument because it is a '{1}' - - Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>' - '{0}' does not contain a constructor that takes '{1}' arguments - - '{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments - - - Instance argument: cannot convert from '{0}' to '{1}' - - - The best overloaded Add method '{0}' for the collection initializer has some invalid arguments - - - The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters. - Non-invocable member '{0}' cannot be used like a method. @@ -398,6 +320,12 @@ Named argument '{0}' specifies a parameter for which a positional argument has already been given - The first argument to dynamically-bound static call must be a Type + The first argument to dynamically-bound static or constructor call must be a Type + + + The runtime binder cannot bind a metaobject without a value + + + More than one type in the binding has the same full name. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ru.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ru.resx index 3f05651376..9c982cc8df 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ru.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.ru.resx @@ -105,9 +105,6 @@ Ð”Ð»Ñ Ñ‚Ð¸Ð¿Ð° "{0}" нет определенных конÑтрукторов - - Делегат "{0}" не имеет допуÑтимого конÑтруктора - The property or indexer "{0}" cannot be used in this context because it lacks the get accessor @@ -129,9 +126,6 @@ Ðевозможно приÑвоить значение ÑвойÑтву или индекÑатору "{0}" -- доÑтуп только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ - - Ðе удаетÑÑ Ð²Ñ‹Ð·Ð²Ð°Ñ‚ÑŒ абÑтрактный член базового клаÑÑа: "{0}" - СвойÑтва и индекÑаторы не могут передаватьÑÑ ÐºÐ°Ðº параметры Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼Ð¸ Ñловами out и ref @@ -150,15 +144,6 @@ ÐеоднозначноÑÑ‚ÑŒ между "{0}" и "{1}" - - "{0}" does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) - - - ÐепоÑредÑтвенный вызов деÑтрукторов и функций object.Finalize запрещен. РекомендуетÑÑ Ð²Ñ‹Ð·Ð¾Ð² IDisposable.Dispose, еÑли она доÑтупна. - - - Ðе вызывайте метод Finalize базового клаÑÑа напрÑмую. Он вызываетÑÑ Ð°Ð²Ñ‚Ð¾Ð¼Ð°Ñ‚Ð¸Ñ‡ÐµÑки из деÑтруктора. - Ðе удаетÑÑ Ð½ÐµÑвно преобразовать тип "{0}" в "{1}". СущеÑтвует Ñвное преобразование (требуетÑÑ Ð¿Ñ€Ð¸Ð²ÐµÐ´ÐµÐ½Ð¸Ðµ типа?) @@ -171,9 +156,6 @@ ИÑпользование универÑального {1} "{0}" требует аргументов типа "{2}" - - Тип '{0}' не может иÑпользоватьÑÑ Ð² качеÑтве аргумента типа - {1} "{0}" не может иÑпользоватьÑÑ Ñ Ð°Ñ€Ð³ÑƒÐ¼ÐµÐ½Ñ‚Ð°Ð¼Ð¸ типа @@ -192,24 +174,12 @@ Ðевозможно иÑпользовать тип "{3}" в качеÑтве параметра типа "{2}" в универÑальном типе или методе "{0}". Ð”Ð»Ñ Ñ‚Ð¸Ð¿Ð° "{3}", допуÑкающего значение null, не выполнÑетÑÑ Ð¾Ð³Ñ€Ð°Ð½Ð¸Ñ‡ÐµÐ½Ð¸Ðµ "{1}". Типы, допуÑкающие значение null, не могут удовлетворÑÑ‚ÑŒ ни одному интерфейÑному ограничению. - - Ðевозможно иÑпользовать тип "{3}" в качеÑтве параметра типа "{2}" в универÑальном типе или методе "{0}". Ðет преобразованиÑ-упаковки или Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ Ñ‚Ð¸Ð¿Ð° параметра из "{3}" в "{1}". - Ðевозможно иÑпользовать тип "{3}" в качеÑтве параметра типа "{2}" в универÑальном типе или методе "{0}". Ðет преобразованиÑ-упаковки из "{3}" в "{1}". - - Cannot convert null to type parameter "{0}" because it could be a non-nullable value type. ВмеÑто Ñтого рекомендуетÑÑ Ð¸Ñпользовать "default({0})". - - - "{1} {0}" имеет неправильный возвращаемый тип - The type arguments for method "{0}" cannot be inferred from the usage. ПопытайтеÑÑŒ Ñвно определить аргументы-типы. - - Ðе удаетÑÑ Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ñ‚ÑŒ группу методов "{0}" в тип, не ÑвлÑющийÑÑ Ð´ÐµÐ»ÐµÐ³Ð°Ñ‚Ð¾Ð¼ "{1}". ПредполагаетÑÑ Ð»Ð¸ вызывать Ñтот метод? - Ð”Ð»Ñ Ð¸ÑÐ¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ Ð² качеÑтве параметра "{1}" в универÑальном типе или методе "{0}" тип "{2}" должен быть ÑÑылочным типом @@ -219,51 +189,24 @@ Ðеоднозначные пользовательÑкие Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ "{0}" и "{1}" при преобразовании из "{2}" в "{3}" - - Предопределенный тип "{0}" не определен и не импортирован - "{0}" не поддерживаетÑÑ Ñзыком "{0}": Ñвный вызов оператора или метода доÑтупа невозможен - - "{0}" ÑвлÑетÑÑ Ñ‚Ð¸Ð¿Ð¾Ð¼, который не поддерживаетÑÑ Ð² данном Ñзыке - - - ОтÑутÑтвует обÑзательный Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¿Ð¸Ð»Ñтора член "{0}.{1}" - - - Литерал Ñ Ñ‚Ð¸Ð¿Ð¾Ð¼ double не может быть неÑвно преобразован к типу "{1}"; Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð»Ð¸Ñ‚ÐµÑ€Ð°Ð»Ð° Ñтого типа Ñледует воÑпользоватьÑÑ ÑуффикÑом "{0}" - Ðе удаетÑÑ Ð²Ñ‹Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÑŒ преобразование к ÑтатичеÑкому типу "{0}" - - "{0}": Ð½ÐµÐ»ÑŒÐ·Ñ Ð¸Ñпользовать ÑтатичеÑкие типы в качеÑтве аргументов-типов - - - Ðевозможно Ñоздать делегат на оÑнове метода "{0}", поÑкольку он ÑвлÑетÑÑ Ñ€Ð°Ð·Ð´ÐµÐ»Ñемым методом без реализующего объÑÐ²Ð»ÐµÐ½Ð¸Ñ - Операндом оператора инкремента или декремента должна быть переменнаÑ, ÑвойÑтво или индекÑатор - - "{0}" не Ñодержит Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð´Ð»Ñ "{1}", а найти метод раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ "{1}", принимающий первый аргумент типа "{0}", не удалоÑÑŒ (возможно, пропущена директива using или ÑÑылка на Ñборку) - - - Методы раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ "{0}", определенные Ð´Ð»Ñ Ñ‚Ð¸Ð¿Ð° Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ "{1}", не могут применÑÑ‚ÑŒÑÑ Ð´Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð´ÐµÐ»ÐµÐ³Ð°Ñ‚Ð¾Ð² - ОтÑутÑтвие перегрузки Ð´Ð»Ñ Ð¼ÐµÑ‚Ð¾Ð´Ð° "{0}" принимает"{1}" аргументы Ðаиболее подходÑщий перегруженный метод Ð´Ð»Ñ "{0}" имеет неÑколько недопуÑтимых аргументов - - Ðргумент "{0}": невозможно преобразовать из "{1}" в "{2}" - Ðргумент Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼ Ñловом ref или out должен быть переменной, которой можно приÑвоить значение @@ -291,12 +234,6 @@ Cannot modify the return value of "{0}" because it is not a variable - - Ðргумент "{0}" должен быть передан Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼ Ñловом "{1}" - - - Ðргумент "{0}" должен быть передан Ñ ÐºÐ»ÑŽÑ‡ÐµÐ²Ñ‹Ð¼ Ñловом "{1}" - Члены Ð¿Ð¾Ð»Ñ "{0}", предназначенного только Ð´Ð»Ñ Ñ‡Ñ‚ÐµÐ½Ð¸Ñ, могут быть изменены только в конÑтрукторе или инициализаторе переменных @@ -315,24 +252,9 @@ Ðе удалоÑÑŒ передать "{0}" как ÑÑылку или аргумент out, так как Ñто "{1}" - - Ðе удаетÑÑ Ð¿Ñ€Ð¸Ð²Ñзать делегат '{0}', потому что он ÑвлÑетÑÑ Ñ‡Ð»ÐµÐ½Ð¾Ð¼ «System.Nullable<T>» - "{0}" не Ñодержит конÑтруктор, принимающий аргументов: {1} - - "{0}" не Ñодержит Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð´Ð»Ñ "{1}", Ð½Ð°Ð¸Ð»ÑƒÑ‡ÑˆÐ°Ñ Ð¿ÐµÑ€ÐµÐ³Ñ€ÑƒÐ·ÐºÐ° метода раÑÑˆÐ¸Ñ€ÐµÐ½Ð¸Ñ "{2}" имеет такие же недопуÑтимые аргументы - - - Instance argument: невозможно преобразовать из "{0}" в "{1}" - - - Ðаиболее подходÑщий перегруженный метод Add "{0}" Ð´Ð»Ñ Ð¸Ð½Ð¸Ñ†Ð¸Ð°Ð»Ð¸Ð·Ð°Ñ‚Ð¾Ñ€Ð° коллекции Ñодержит недопуÑтимые аргументы - - - Ðаиболее подходÑщий перегруженный метод, ÑоответÑтвующий "{0}" Ð´Ð»Ñ Ñлемента инициализации коллекции не может быть иÑпользован. Методы инициализации коллекции "Add" не имеют ÑÑылочных и выходных параметров. - Ðевызываемый член "{0}" не может иÑпользоватьÑÑ ÐºÐ°Ðº метод. diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx index f9702cf3b8..c4f57cf06a 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hans.resx @@ -105,9 +105,6 @@ 类型“{0}â€æœªå®šä¹‰æž„造函数 - - 委托“{0}â€æ²¡æœ‰æœ‰æ•ˆçš„构造函数 - 属性或索引器“{0}â€ä¸èƒ½ç”¨åœ¨æ­¤ä¸Šä¸‹æ–‡ä¸­ï¼Œå› ä¸ºå®ƒç¼ºå°‘ get 访问器 @@ -129,9 +126,6 @@ 无法为属性或索引器“{0}â€èµ‹å€¼ - 它是åªè¯»çš„ - - 无法调用抽象基æˆå‘˜:“{0}†- 属性或索引器ä¸å¾—作为 out 或 ref å‚数传递 @@ -150,15 +144,6 @@ 在“{0}â€å’Œâ€œ{1}â€ä¹‹é—´å…·æœ‰äºŒä¹‰æ€§ - - “{0}â€æ²¡æœ‰é¢„定义的大å°ï¼Œå› æ­¤ sizeof åªèƒ½åœ¨ä¸å®‰å…¨çš„上下文中使用(请考虑使用 System.Runtime.InteropServices.Marshal.SizeOf) - - - 无法直接调用æžæž„函数和 object.Finalize。如果å¯ç”¨ï¼Œè¯·è€ƒè™‘调用 IDisposable.Dispose。 - - - ä¸è¦ç›´æŽ¥è°ƒç”¨åŸºç±» Finalize 方法。它将从æžæž„函数中自动调用。 - 无法将类型“{0}â€éšå¼è½¬æ¢ä¸ºâ€œ{1}â€ã€‚存在一个显å¼è½¬æ¢(是å¦ç¼ºå°‘强制转æ¢?) @@ -171,9 +156,6 @@ 使用泛型 {1}“{0}â€éœ€è¦â€œ{2}â€ä¸ªç±»åž‹å‚æ•° - - 类型"{0}"ä¸å¯èƒ½ç”¨ä½œç±»åž‹å‚æ•° - {1}“{0}â€ä¸èƒ½ä¸Žç±»åž‹å‚数一起使用 @@ -192,24 +174,12 @@ 类型“{3}â€ä¸èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„类型å‚数“{2}â€ã€‚å¯ä»¥ä¸º null 的类型“{3}â€ä¸æ»¡è¶³â€œ{1}â€çš„约æŸã€‚å¯ä»¥ä¸º null 的类型ä¸èƒ½æ»¡è¶³ä»»ä½•æŽ¥å£çº¦æŸã€‚ - - 类型“{3}â€ä¸èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„类型å‚数“{2}â€ã€‚没有从“{3}â€åˆ°â€œ{1}â€çš„装箱转æ¢æˆ–类型å‚数转æ¢ã€‚ - 类型“{3}â€ä¸èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„类型å‚数“{2}â€ã€‚没有从“{3}â€åˆ°â€œ{1}â€çš„装箱转æ¢ã€‚ - - 无法将 null 转æ¢ä¸ºç±»åž‹å‚数“{0}â€ï¼Œå› ä¸ºå®ƒå¯èƒ½æ˜¯ä¸å¯ä»¥ä¸º null 的值类型。请考虑改用“default({0})â€ã€‚ - - - “{1} {0}â€çš„返回类型错误 - 无法从用法中推断出方法“{0}â€çš„类型å‚数。请å°è¯•æ˜¾å¼æŒ‡å®šç±»åž‹å‚数。 - - 无法将方法组“{0}â€è½¬æ¢ä¸ºéžå§”托类型“{1}â€ã€‚是å¦å¸Œæœ›è°ƒç”¨æ­¤æ–¹æ³•? - 类型“{2}â€å¿…须是引用类型æ‰èƒ½ç”¨ä½œæ³›åž‹ç±»åž‹æˆ–方法“{0}â€ä¸­çš„å‚数“{1}†@@ -219,51 +189,24 @@ 从“{2}â€è½¬æ¢ä¸ºâ€œ{3}â€æ—¶ï¼Œç”¨æˆ·å®šä¹‰çš„转æ¢â€œ{0}â€å’Œâ€œ{1}â€å…·æœ‰äºŒä¹‰æ€§ - - 预定义类型“{0}â€æœªå®šä¹‰æˆ–导入 - 现用语言ä¸æ”¯æŒâ€œ{0}†“{0}â€: 无法显å¼è°ƒç”¨è¿ç®—符或访问器 - - “{0}â€ä¸æ˜¯çŽ°ç”¨è¯­è¨€æ”¯æŒçš„类型 - - - 缺少编译器è¦æ±‚çš„æˆå‘˜â€œ{0}.{1}†- - - 无法将 Double 类型éšå¼è½¬æ¢ä¸ºâ€œ{1}â€ç±»åž‹ï¼›è¯·ä½¿ç”¨â€œ{0}â€åŽç¼€åˆ›å»ºæ­¤ç±»åž‹ - 无法转æ¢ä¸ºé™æ€ç±»åž‹â€œ{0}†- - “{0}â€: é™æ€ç±»åž‹ä¸èƒ½ç”¨ä½œç±»åž‹å‚æ•° - - - 无法通过方法“{0}â€åˆ›å»ºå§”托,因为该方法是没有实现声明的分部方法 - 递增或递å‡è¿ç®—符的æ“作数必须是å˜é‡ã€å±žæ€§æˆ–索引器 - - “{0}â€æœªåŒ…å«â€œ{1}â€çš„定义,并且找ä¸åˆ°å¯æŽ¥å—第一个“{0}â€ç±»åž‹å‚数的扩展方法“{1}â€(是å¦ç¼ºå°‘ using 指令或程åºé›†å¼•ç”¨?) - - - 无法使用值类型“{1}â€å®šä¹‰çš„扩展方法“{0}â€æ¥åˆ›å»ºå§”托 - “{0}â€æ–¹æ³•æ²¡æœ‰é‡‡ç”¨â€œ{1}â€ä¸ªå‚æ•°çš„é‡è½½ 与“{0}â€æœ€åŒ¹é…çš„é‡è½½æ–¹æ³•å…·æœ‰ä¸€äº›æ— æ•ˆå‚æ•° - - å‚数“{0}â€: 无法从“{1}â€è½¬æ¢ä¸ºâ€œ{2}†- ref 或 out å‚数必须是å¯ä»¥èµ‹å€¼çš„å˜é‡ @@ -291,12 +234,6 @@ 无法修改“{0}â€çš„返回值,因为它ä¸æ˜¯å˜é‡ - - å‚数“{0}â€ä¸åº”使用关键字“{1}â€ä¼ é€’ - - - å‚数“{0}â€å¿…须使用关键字“{1}â€ä¼ é€’ - 无法修改åªè¯»å­—段“{0}â€çš„æˆå‘˜(在构造函数或å˜é‡åˆå§‹å€¼è®¾å®šé¡¹ä¸­é™¤å¤–) @@ -315,24 +252,9 @@ “{0}â€æ˜¯ä¸€ä¸ªâ€œ{1}â€ï¼Œæ— æ³•ä½œä¸º ref 或 out å‚数进行传递 - - ä¸èƒ½å°†å§”托绑定到 '{0}',因为它是 'System.Nullable<T>' æˆå‘˜ - “{0}â€ä¸åŒ…å«é‡‡ç”¨â€œ{1}â€ä¸ªå‚数的构造函数 - - “{0}â€ä¸åŒ…å«â€œ{1}â€çš„定义,并且最佳扩展方法é‡è½½â€œ{2}â€å…·æœ‰ä¸€äº›æ— æ•ˆå‚æ•° - - - 实例å‚æ•°: 无法从“{0}â€è½¬æ¢ä¸ºâ€œ{1}†- - - 集åˆåˆå§‹å€¼è®¾å®šé¡¹çš„最佳é‡è½½ Add 方法“{0}â€å…·æœ‰ä¸€äº›æ— æ•ˆå‚æ•° - - - 无法使用集åˆåˆå§‹å€¼è®¾å®šé¡¹å…ƒç´ çš„最佳é‡è½½æ–¹æ³•åŒ¹é…项“{0}â€ã€‚集åˆåˆå§‹å€¼è®¾å®šé¡¹â€œAddâ€æ–¹æ³•ä¸èƒ½å…·æœ‰ ref 或 out å‚数。 - ä¸å¯è°ƒç”¨çš„æˆå‘˜â€œ{0}â€ä¸èƒ½åƒæ–¹æ³•ä¸€æ ·ä½¿ç”¨ã€‚ diff --git a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx index 10580f78a0..55ec74b0d6 100644 --- a/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx +++ b/external/corefx/src/Microsoft.CSharp/src/Resources/Strings.zh-Hant.resx @@ -105,9 +105,6 @@ 型別 '{0}' æ²’æœ‰å·²å®šç¾©çš„å»ºæ§‹å‡½å¼ - - 委派 '{0}' æ²’æœ‰æœ‰æ•ˆçš„å»ºæ§‹å‡½å¼ - ç„¡æ³•æ–¼æ­¤å…§å®¹ä¸­ä½¿ç”¨å±¬æ€§æˆ–ç´¢å¼•å­ '{0}',因為其欠缺 get å­˜å–å­ @@ -129,9 +126,6 @@ ç„¡æ³•æŒ‡æ´¾å±¬æ€§æˆ–ç´¢å¼•å­ '{0}' -- 其為唯讀 - - 無法呼å«æŠ½è±¡åŸºåº•æˆå“¡: '{0}' - 無法將屬性或索引å­ç•¶åš out 或 ref åƒæ•¸å‚³éž @@ -150,15 +144,6 @@ '{0}' å’Œ '{1}' ä¹‹é–“æ¨¡ç¨œå…©å¯ - - '{0}' 沒有é å…ˆå®šç¾©çš„大å°ï¼Œå› æ­¤ sizeof åªèƒ½ä½¿ç”¨æ–¼ unsafe 內容 (å¯è€ƒæ…®ä½¿ç”¨ System.Runtime.InteropServices.Marshal.SizeOf) - - - ä¸èƒ½ç›´æŽ¥å‘¼å«è§£æ§‹å‡½å¼å’Œ object.Finalizeã€‚è«‹è€ƒæ…®å‘¼å« IDisposable.Dispose (如果有)。 - - - ä¸è¦ç›´æŽ¥å‘¼å«æ‚¨çš„基底類別 Finalize 方法。會從您的解構函å¼è‡ªå‹•å‘¼å«å®ƒã€‚ - 無法將型別 '{0}' éš±å«è½‰æ›ç‚º '{1}'。已有明確轉æ›å­˜åœ¨ (您是å¦æ¼æŽ‰äº†è½‰åž‹?) @@ -171,9 +156,6 @@ 使用泛型 {1} '{0}' éœ€è¦ '{2}' 個型別引數 - - é¡žåž‹"{0}"ä¸å¯èƒ½ç”¨ä½œé¡žåž‹åƒæ•¸ - {1} '{0}' ä¸èƒ½é…åˆåž‹åˆ¥å¼•æ•¸ä½¿ç”¨ @@ -192,24 +174,12 @@ 型別 '{3}' ä¸èƒ½åšç‚ºæ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中的型別åƒæ•¸ '{2}'。å¯ç‚º Null 的型別 '{3}' 未滿足 '{1}' çš„æ¢ä»¶ç´„æŸã€‚å¯ç‚º Null 的型別無法滿足所有介é¢æ¢ä»¶ç´„æŸã€‚ - - 型別 '{3}' ä¸èƒ½åšç‚ºæ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中的型別åƒæ•¸ '{2}'。沒有從 '{3}' 到 '{1}' çš„ Boxing 轉æ›æˆ–型別åƒæ•¸è½‰æ›ã€‚ - 型別 '{3}' ä¸èƒ½åšç‚ºæ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中的型別åƒæ•¸ '{2}'。沒有從 '{3}' 到 '{1}' çš„ Boxing 轉æ›ã€‚ - - 無法將 null 轉æ›æˆåž‹åˆ¥åƒæ•¸ '{0}',因為它是ä¸å¯ç‚º null 的實值型別。請考慮使用 'default({0})' 代替。 - - - '{1} {0}' 的傳回型別錯誤 - 方法 '{0}' 的型別引數ä¸èƒ½å¾žä½¿ç”¨æ–¹å¼æŽ¨æ–·ã€‚請嘗試明確指定型別引數。 - - 無法將方法群組 '{0}' 轉æ›ç‚ºéžå§”派型別 '{1}'。您是å¦æƒ³è¦å«ç”¨é€™å€‹æ–¹æ³•? - 型別 '{2}' 必須是åƒè€ƒåž‹åˆ¥ï¼Œæ‰èƒ½åœ¨æ³›åž‹åž‹åˆ¥æˆ–方法 '{0}' 中åšç‚ºåƒæ•¸ '{1}' 使用 @@ -219,51 +189,24 @@ 從 '{2}' 轉æ›ç‚º '{3}' 時,發ç¾æ¨¡ç¨œå…©å¯çš„ä½¿ç”¨è€…å®šç¾©è½‰æ› '{0}' å’Œ '{1}' - - 未定義或匯入é å…ˆå®šç¾©çš„型別 '{0}' - 此語言ä¸æ”¯æ´ '{0}' '{0}': 無法明確呼å«é‹ç®—å­æˆ–å­˜å–å­ - - 此語言ä¸æ”¯æ´åž‹åˆ¥ '{0}' - - - éºæ¼ç·¨è­¯å™¨æ‰€éœ€çš„æˆå“¡ '{0}.{1}' - - - ä¸èƒ½éš±å«å°‡åž‹åˆ¥ double 的常值轉æ›ç‚ºåž‹åˆ¥ '{1}'; 請使用 '{0}' 後置字元來建立此型別的常值 - 無法轉æ›ç‚ºéœæ…‹åž‹åˆ¥ '{0}' - - '{0}': éœæ…‹åž‹åˆ¥ä¸èƒ½ç•¶åšåž‹åˆ¥å¼•æ•¸ä½¿ç”¨ - - - 無法從方法 '{0}' 建立委派,因為它是沒有實作宣告的部分方法 - éžå¢žæˆ–éžæ¸›é‹ç®—å­çš„é‹ç®—元必須是變數ã€å±¬æ€§æˆ–索引å­ã€‚ - - '{0}' ä¸åŒ…å« '{1}' 的定義,也找ä¸åˆ°æ“´å……方法 '{1}' 來接å—型別 '{0}' 的第一個引數 (您是å¦éºæ¼ using 指示詞或組件åƒè€ƒ?) - - - 在實值型別 '{1}' 中定義的擴充方法 '{0}' 無法用來建立委派 - 方法 '{0}' æ²’æœ‰ä»»ä½•å¤šè¼‰æŽ¥å— '{1}' 個引數 最符åˆçš„多載方法 '{0}' 有一些無效的引數 - - 引數 '{0}': 無法從 '{1}' 轉æ›ç‚º '{2}' - ref 或 out 引數必須是å¯æŒ‡æ´¾çš„變數 @@ -291,12 +234,6 @@ 無法修改 '{0}' 的傳回值,因為它ä¸æ˜¯è®Šæ•¸ - - 傳éžå¼•æ•¸ '{0}' 時ä¸èƒ½åŒ…å« '{1}' é—œéµå­— - - - 傳éžå¼•æ•¸ '{0}' æ™‚å¿…é ˆåŒ…å« '{1}' é—œéµå­— - å”¯è®€æ¬„ä½ '{0}' çš„æˆå“¡ç„¡æ³•ä¿®æ”¹ (除éžæ˜¯åœ¨å»ºæ§‹å‡½å¼æˆ–變數åˆå§‹è¨­å®šå¼) @@ -315,24 +252,9 @@ 無法將 '{0}' ç•¶åš ref 或 out 引數傳éžï¼Œå› ç‚ºå®ƒæ˜¯ '{1}' - - ä¸èƒ½å°‡å§”託ç¶å®šåˆ° '{0}',因為它是 'System.Nullable<T>' æˆå“¡ - '{0}' ä¸åŒ…å«æŽ¥å— '{1}' å€‹å¼•æ•¸çš„å»ºæ§‹å‡½å¼ - - '{0}' ä¸åŒ…å« '{1}' 的定義,而且最佳的擴充方法多載 '{2}' 有一些無效的引數 - - - 執行個體引數: 無法從 '{0}' 轉æ›ç‚º '{1}' - - - 集åˆåˆå§‹è¨­å®šå¼çš„最佳多載 Add 方法 '{0}' 有一些無效的引數 - - - 無法使用集åˆåˆå§‹è¨­å®šå¼é …目之最符åˆçš„多載方法 '{0}'。集åˆåˆå§‹è¨­å®šå¼ 'Add' 方法ä¸èƒ½å…·æœ‰ ref 或 out åƒæ•¸ã€‚ - éžå¯å«ç”¨ (Non-invocable) æˆå“¡ '{0}' ä¸èƒ½åšç‚ºæ–¹æ³•ä½¿ç”¨ã€‚ diff --git a/external/corefx/src/Microsoft.CSharp/tests/ArrayHandling.cs b/external/corefx/src/Microsoft.CSharp/tests/ArrayHandling.cs index 9b945a7cb8..75a215f5b5 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/ArrayHandling.cs +++ b/external/corefx/src/Microsoft.CSharp/tests/ArrayHandling.cs @@ -11,7 +11,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests { public class ArrayHandling { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public void SingleRankNonSZArray() { dynamic d = Array.CreateInstance(typeof(int), new[] { 8 }, new[] { -2 }); @@ -142,7 +142,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public void NonSZ1RArrayLenght() { dynamic d = Array.CreateInstance(typeof(int), new[] {23}, new[] {-2}); diff --git a/external/corefx/src/Microsoft.CSharp/tests/BindingErrors.cs b/external/corefx/src/Microsoft.CSharp/tests/BindingErrors.cs index cc6ed98291..1bfbe6a826 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/BindingErrors.cs +++ b/external/corefx/src/Microsoft.CSharp/tests/BindingErrors.cs @@ -7,11 +7,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Dynamic; -using System.Linq; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; using Xunit; namespace Microsoft.CSharp.RuntimeBinder.Tests @@ -54,6 +50,18 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } } + // So the static binder can't decide some cases are/are not static at compilation stage + class StaticAndInstanceSameName + { + public void DoSomething(double d) + { + } + + public static void DoSomething(int i) + { + } + } + private class AmbiguousNumClass { private readonly int _num; @@ -75,6 +83,26 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests return item; } + private class NonGeneric + { + public int Prop => 1; + + public int Meth() => 1; + } + + private class Constraints + { + public void MustBeConvertible(T arg) where T:IConvertible + { + } + + public void MustBeStruct(T arg) where T : struct + { + } + + public void MustBeDerived(TDerived d, TBase b) where TDerived : TBase { } + } + [Fact] public void CannotBindToConditional() { @@ -221,5 +249,178 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests dynamic d = new AmbiguousNumClass(7); Assert.Throws(() => -d); } + + [Fact] + public void StaticCallOnInstance() + { + dynamic d = new StaticAndInstanceSameName(); + d.DoSomething(2.0); // No exception + Assert.Throws(() => d.DoSomething(2)); + d = 2.0; + new StaticAndInstanceSameName().DoSomething(d); // No exception + d = 2; + Assert.Throws(() => new StaticAndInstanceSameName().DoSomething(d)); + } + + [Fact] + public void InstanceCallOnType() + { + dynamic d = 2; + StaticAndInstanceSameName.DoSomething(d); // No exception + d = 2.0; + Assert.Throws(() => StaticAndInstanceSameName.DoSomething(d)); + } + + [Fact] + public void CtorCallOnNoCtorType() + { + CallSite> callSite = CallSite>.Create( + Binder.InvokeConstructor( + CSharpBinderFlags.InvokeSpecialName, GetType(), + new[] + { + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) + })); + Func target = callSite.Target; + Assert.Throws(() => target(callSite, typeof(double))); + } + + [Fact] + public void NullaryCtorCallOnNoNullaryCtor() + { + CallSite> callSite = CallSite>.Create( + Binder.InvokeConstructor( + CSharpBinderFlags.InvokeSpecialName, GetType(), + new[] + { + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) + })); + Func target = callSite.Target; + RuntimeBinderException rbe = Assert.Throws(() => target(callSite, typeof(string))); + Assert.Contains("0", rbe.Message); + } + + [Fact] + public void QuinaryCtorCallOnNoQuinaryCtor() + { + CallSite> callSite = CallSite>.Create( + Binder.InvokeConstructor(CSharpBinderFlags.InvokeSpecialName, GetType(), + new[]{ + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)})); + Func target = callSite.Target; + RuntimeBinderException rbe = Assert.Throws(() => target.Invoke(callSite, typeof(string), null, null, null, null, null)); + Assert.Contains("5", rbe.Message); + } + + [Fact] + public void NoSuchMember() + { + dynamic d = 3; + Assert.Throws(() => d.Test()); + } + + [Fact] + public void NoTypeVarsOnProperty() + { + dynamic d = new NonGeneric(); + Assert.Throws(() => d.Prop()); + } + + [Fact] + public void NoTypeVarsOnNonGenericMethod() + { + dynamic d = new NonGeneric(); + Assert.Throws(() => d.Meth()); + } + + [Fact] + public void NullableDoesNotSatisfyInterfaceConstraints() + { + dynamic d = new Constraints(); + int? i = 3; + Assert.Throws(() => d.MustBeConvertible(i)); + } + + [Fact] + public void NullableDoesNotSatisfyStructConstraints() + { + dynamic d = new Constraints(); + int? i = 3; + Assert.Throws(() => d.MustBeStruct(i)); + } + + [Fact] + public void NullableDoesNotSatisfyConstraints() + { + dynamic d = new Constraints(); + int? n = 3; + int i = 3; + Assert.Throws(() => d.MustBeDerived(n, i)); + } + + [Fact] + public void NullableDoesNotSatisfyConstraintsEnum() + { + dynamic d = new Constraints(); + StringComparison? n = StringComparison.CurrentCulture; + Enum e = StringComparison.CurrentCulture; + Assert.Throws(() => d.MustBeDerived(n, e)); + } + + [Fact] + public void NamedArgumentBeforeFixedStatic() + { + CallSite> site = + CallSite>.Create( + Binder.InvokeMember( + CSharpBinderFlags.None, "Equals", null, GetType(), + new[] + { + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.IsStaticType, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.NamedArgument, "objA"), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) + })); + Func target = site.Target; + Assert.Throws(() => target.Invoke(site, typeof(object), 2, 2)); + } + + [Fact] + public void NamedArgumentBeforeFixedInstance() + { + CallSite> site = + CallSite>.Create( + Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember( + CSharpBinderFlags.None, "Equals", null, GetType(), + new[] + { + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.NamedArgument, "x"), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) + })); + Func target = site.Target; + Assert.Throws(() => target.Invoke(site, EqualityComparer.Default, 2, 2)); + } + + [Fact] + public void DuplicateNamedArgument() + { + CallSite> site = + CallSite>.Create( + Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember( + CSharpBinderFlags.None, "Equals", null, GetType(), + new[] + { + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.NamedArgument, "x"), + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.NamedArgument, "x") + })); + Func target = site.Target; + Assert.Throws(() => target.Invoke(site, EqualityComparer.Default, 2, 2)); + } } } diff --git a/external/corefx/src/Microsoft.CSharp/tests/IndexingTests.cs b/external/corefx/src/Microsoft.CSharp/tests/IndexingTests.cs new file mode 100644 index 0000000000..f18cc7e084 --- /dev/null +++ b/external/corefx/src/Microsoft.CSharp/tests/IndexingTests.cs @@ -0,0 +1,103 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Reflection; +using System.Runtime.CompilerServices; +using Xunit; + +namespace Microsoft.CSharp.RuntimeBinder.Tests +{ + public class IndexingTests + { + private class AllTheIntegers + { + [IndexerName("Integers")] + public int this[int x] => x; + } + + [DefaultMember("Indexer")] + private class DefaultDoesNotExist + { + } + + private interface IA + { + [IndexerName("NumberString")] + string this[int key] { get; } + } + + private interface IB : IA + { + } + + private interface IC : IB + { + } + + private class Implementation : IC + { + public string this[int key] => key.ToString(); + } + + [Fact] + public void CustomIndexerName() + { + dynamic d = new AllTheIntegers(); + int answer = d[42]; + Assert.Equal(42, answer); + } + + [Fact] + public void CustomIndexerNameDynamicArgument() + { + AllTheIntegers all = new AllTheIntegers(); + dynamic d = 3; + int answer = all[d]; + Assert.Equal(3, answer); + } + + [Fact] + public void TargetClassClaimsNonExistentMemberIsIndexer() + { + dynamic d = new DefaultDoesNotExist(); + var ex = Assert.Throws(() => d[23]); + Assert.Contains("[]", ex.Message); // true of the correct message in all translations. + Assert.Contains(typeof(DefaultDoesNotExist).FullName.Replace('+', '.'), ex.Message); + } + + [Fact] + public void DeepInheritingIndexingInterface() + { + IC ifaceTyped = new Implementation(); + dynamic d = 23; + string answer = ifaceTyped[d]; + Assert.Equal("23", answer); + } + + [Fact] + public void ArrayLongIndexed() + { + dynamic arr = new[] {1, 2, 3}; + dynamic ind = 2L; + Assert.Equal(3, arr[ind]); + } + + [Fact] + public void BadArrayIndexer() + { + dynamic arr = new[] {1, 2, 3}; + dynamic ind = "a"; + Assert.Throws(() => arr[ind]); + } + + [Fact] + public void BadArrayIndexerCouldHaveCast() + { + dynamic arr = new[] { 1, 2, 3 }; + dynamic ind = 2m; + Assert.Throws(() => arr[ind]); + } + } +} diff --git a/external/corefx/src/Microsoft.CSharp/tests/IntegerBinaryOperationTests.cs b/external/corefx/src/Microsoft.CSharp/tests/IntegerBinaryOperationTests.cs index ca38fe21dc..228ad222b9 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/IntegerBinaryOperationTests.cs +++ b/external/corefx/src/Microsoft.CSharp/tests/IntegerBinaryOperationTests.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Dynamic; using System.Linq; using System.Linq.Expressions; using System.Runtime.CompilerServices; @@ -604,5 +605,22 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests callsite = GetBinaryOperationCallSite(ExpressionType.Modulo, true, true, true); Assert.Throws(() => callsite.Target(callsite, dividend, divisor)); } + + [Fact] + public void NullDMO() + { + BinaryOperationBinder binder = Binder.BinaryOperation( + CSharpBinderFlags.None, + ExpressionType.Add, + GetType(), + new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) } + ) as BinaryOperationBinder; + DynamicMetaObject dmo2 = new DynamicMetaObject(Expression.Parameter(typeof(object)), BindingRestrictions.Empty, 2); + DynamicMetaObject dmoNoVal = new DynamicMetaObject(Expression.Parameter(typeof(object)), BindingRestrictions.Empty); + AssertExtensions.Throws("target", () => binder.FallbackBinaryOperation(null, null)); + AssertExtensions.Throws("arg", () => binder.FallbackBinaryOperation(dmo2, null)); + AssertExtensions.Throws("target", () => binder.FallbackBinaryOperation(dmoNoVal, null)); + AssertExtensions.Throws("arg", () => binder.FallbackBinaryOperation(dmo2, dmoNoVal)); + } } } diff --git a/external/corefx/src/Microsoft.CSharp/tests/Microsoft.CSharp.Tests.csproj b/external/corefx/src/Microsoft.CSharp/tests/Microsoft.CSharp.Tests.csproj index 5204141ec2..6b4b80b182 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/Microsoft.CSharp.Tests.csproj +++ b/external/corefx/src/Microsoft.CSharp/tests/Microsoft.CSharp.Tests.csproj @@ -7,9 +7,6 @@ - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs @@ -17,11 +14,13 @@ + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs b/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs index 3d12dbb087..d771a9ecf2 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs +++ b/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs @@ -21,7 +21,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Assert.Empty(rbe.Data); Assert.True((rbe.HResult & 0xFFFF0000) == 0x80130000); // Error from .NET Assert.Contains(rbe.GetType().FullName, rbe.Message); // Localized, but should contain type name. - BinaryFormatterHelpers.AssertRoundtrips(rbe); } [Fact] @@ -35,7 +34,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Assert.Same(message, rbe.Message); rbe = new RuntimeBinderException(null); Assert.Equal(new RuntimeBinderException().Message, rbe.Message); - BinaryFormatterHelpers.AssertRoundtrips(rbe); } @@ -46,7 +44,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Exception inner = new Exception("This is a test exception"); RuntimeBinderException rbe = new RuntimeBinderException(message, inner); Assert.Same(inner, rbe.InnerException); - BinaryFormatterHelpers.AssertRoundtrips(rbe); } [Fact] @@ -97,7 +94,29 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) })); Func target = site.Target; - Assert.Throws("Type Argument", () => target.Invoke(site, null, 2, 2)); + AssertExtensions.Throws("Type Argument", () => target.Invoke(site, null, 2, 2)); + } + + [Fact] + public void NonTypeToCtor() + { + CallSite> site = CallSite>.Create( + Binder.InvokeConstructor( + CSharpBinderFlags.None, GetType(), + new[] + { + CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, "Type Argument") + } + ) + ); + Func targ = site.Target; + AssertExtensions.Throws("Type Argument", () => targ.Invoke(site, 23)); + } + + [Fact] + public void AssertExceptionDeserializationFails() + { + BinaryFormatterHelpers.AssertExceptionDeserializationFails(); } } } diff --git a/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs b/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs index a35b128cb4..5a726c4cc3 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs +++ b/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs @@ -18,7 +18,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Assert.Empty(rbe.Data); Assert.True((rbe.HResult & 0xFFFF0000) == 0x80130000); // Error from .NET Assert.Contains(rbe.GetType().FullName, rbe.Message); // Localized, but should contain type name. - BinaryFormatterHelpers.AssertRoundtrips(rbe); } [Fact] @@ -32,7 +31,6 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Assert.Same(message, rbe.Message); rbe = new RuntimeBinderInternalCompilerException(null); Assert.Equal(new RuntimeBinderInternalCompilerException().Message, rbe.Message); - BinaryFormatterHelpers.AssertRoundtrips(rbe); } @@ -43,7 +41,12 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Exception inner = new Exception("This is a test exception"); RuntimeBinderInternalCompilerException rbe = new RuntimeBinderInternalCompilerException(message, inner); Assert.Same(inner, rbe.InnerException); - BinaryFormatterHelpers.AssertRoundtrips(rbe); + } + + [Fact] + public void AssertExceptionDeserializationFails() + { + BinaryFormatterHelpers.AssertExceptionDeserializationFails(); } } } diff --git a/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderTests.cs b/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderTests.cs index 6e91e84f57..48295c9fed 100644 --- a/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderTests.cs +++ b/external/corefx/src/Microsoft.CSharp/tests/RuntimeBinderTests.cs @@ -174,5 +174,25 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests dynamic res = itd.Equals(d); Assert.True(res); } + + [Fact, ActiveIssue(7527)] + public void CyclicTypeDefinition() + { + dynamic x = new Third(); + Assert.Equal(0, x.Zero()); + } + + class First where T : First + { + public int Zero() => 0; + } + + class Second : First where T : First + { + } + + class Third : Second> + { + } } } diff --git a/external/corefx/src/Microsoft.CSharp/tests/UserDefinedShortCircuitOperators.cs b/external/corefx/src/Microsoft.CSharp/tests/UserDefinedShortCircuitOperators.cs new file mode 100644 index 0000000000..084ce5f36c --- /dev/null +++ b/external/corefx/src/Microsoft.CSharp/tests/UserDefinedShortCircuitOperators.cs @@ -0,0 +1,133 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace Microsoft.CSharp.RuntimeBinder.Tests +{ + public class UserDefinedShortCircuitOperators + { + private class NumTypeBitwiseOpsOnly + { + public int Value; + + public static NumTypeBitwiseOpsOnly operator &(NumTypeBitwiseOpsOnly x, NumTypeBitwiseOpsOnly y) + => new NumTypeBitwiseOpsOnly{ Value = x.Value & y.Value }; + + public static NumTypeBitwiseOpsOnly operator |(NumTypeBitwiseOpsOnly x, NumTypeBitwiseOpsOnly y) + => new NumTypeBitwiseOpsOnly{ Value = x.Value | y.Value }; + } + + private class NumTypeBitwiseAndBoolCast + { + public int Value; + + public static NumTypeBitwiseAndBoolCast operator &(NumTypeBitwiseAndBoolCast x, NumTypeBitwiseAndBoolCast y) + => new NumTypeBitwiseAndBoolCast { Value = x.Value & y.Value }; + + public static NumTypeBitwiseAndBoolCast operator |(NumTypeBitwiseAndBoolCast x, NumTypeBitwiseAndBoolCast y) + => new NumTypeBitwiseAndBoolCast { Value = x.Value | y.Value }; + + public static implicit operator bool(NumTypeBitwiseAndBoolCast val) => val.Value != 0; + } + + private class NumTypeBitwiseAndTruthiness + { + public int Value; + + public static NumTypeBitwiseAndTruthiness operator &(NumTypeBitwiseAndTruthiness x, NumTypeBitwiseAndTruthiness y) + => new NumTypeBitwiseAndTruthiness { Value = x.Value & y.Value }; + + public static NumTypeBitwiseAndTruthiness operator |(NumTypeBitwiseAndTruthiness x, NumTypeBitwiseAndTruthiness y) + => new NumTypeBitwiseAndTruthiness { Value = x.Value | y.Value }; + + public static bool operator true(NumTypeBitwiseAndTruthiness val) => val.Value != 0; + + public static bool operator false(NumTypeBitwiseAndTruthiness val) => val.Value == 0; + } + + private class NumTypeBitwiseTruthinessAndBoolCast + { + public int Value; + + public static NumTypeBitwiseTruthinessAndBoolCast operator &(NumTypeBitwiseTruthinessAndBoolCast x, NumTypeBitwiseTruthinessAndBoolCast y) + => new NumTypeBitwiseTruthinessAndBoolCast { Value = x.Value & y.Value }; + + public static NumTypeBitwiseTruthinessAndBoolCast operator |(NumTypeBitwiseTruthinessAndBoolCast x, NumTypeBitwiseTruthinessAndBoolCast y) + => new NumTypeBitwiseTruthinessAndBoolCast { Value = x.Value | y.Value }; + + public static implicit operator bool(NumTypeBitwiseTruthinessAndBoolCast val) => val.Value != 0; + + public static bool operator true(NumTypeBitwiseTruthinessAndBoolCast val) => val.Value != 0; + + public static bool operator false(NumTypeBitwiseTruthinessAndBoolCast val) => val.Value == 0; + } + + [Fact] + public void CannotShortCircuitWithoutBoolOperators() + { + dynamic x = new NumTypeBitwiseOpsOnly { Value = -1 }; + dynamic y = new NumTypeBitwiseOpsOnly { Value = 0 }; + Assert.Throws(() => x && x); + Assert.Throws(() => x && y); + Assert.Throws(() => y && x); + Assert.Throws(() => y && y); + Assert.Throws(() => x || x); + Assert.Throws(() => x || y); + Assert.Throws(() => y || x); + Assert.Throws(() => y || y); + } + + [Fact] + public void CannotShortCircuitWithBoolCast() + { + dynamic x = new NumTypeBitwiseAndBoolCast { Value = -1 }; + dynamic y = new NumTypeBitwiseAndBoolCast { Value = 0 }; + Assert.Throws(() => x && x); + Assert.Throws(() => x && y); + + // Because the expression is evaluated dynamically, if casting the first operand to bool + // gives the short-circuiting answer, then that is the result, even though with static + // compilation this would result in CS0218, because the short-circuiting short-circuits + // the check that would throw! + Assert.Equal(0, (y && x).Value); + Assert.Equal(0, (y && y).Value); + Assert.Equal(-1, (x || x).Value); + Assert.Equal(-1, (x || y).Value); + + Assert.Throws(() => y || x); + Assert.Throws(() => y || y); + } + + [Fact] + public void CannotShortCircuitWithTruthiness() + { + dynamic x = new NumTypeBitwiseAndTruthiness { Value = -1 }; + dynamic y = new NumTypeBitwiseAndTruthiness { Value = 0 }; + Assert.Equal(-1, (x && x).Value); + Assert.Equal(0, (x && y).Value); + Assert.Equal(0, (y && x).Value); + Assert.Equal(0, (y && y).Value); + Assert.Equal(-1, (x || x).Value); + Assert.Equal(-1, (x || y).Value); + Assert.Equal(-1, (y || x).Value); + Assert.Equal(0, (y || y).Value); + } + + [Fact] + public void CannotShortCircuitWithTruthinessAndBoolCast() + { + dynamic x = new NumTypeBitwiseTruthinessAndBoolCast { Value = -1 }; + dynamic y = new NumTypeBitwiseTruthinessAndBoolCast { Value = 0 }; + Assert.Equal(-1, (x && x).Value); + Assert.Equal(0, (x && y).Value); + Assert.Equal(0, (y && x).Value); + Assert.Equal(0, (y && y).Value); + Assert.Equal(-1, (x || x).Value); + Assert.Equal(-1, (x || y).Value); + Assert.Equal(-1, (y || x).Value); + Assert.Equal(0, (y || y).Value); + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/Microsoft.Diagnostics.Tracing.EventSource.Redist.sln b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/Microsoft.Diagnostics.Tracing.EventSource.Redist.sln new file mode 100644 index 0000000000..314aec1c01 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/Microsoft.Diagnostics.Tracing.EventSource.Redist.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Diagnostics.EventSource.Redist", "src\Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj", "{0CAF38F5-C7E7-46F2-8F39-C5D57492FF7F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + netcoreapp-Windows_NT-Debug|Any CPU = netcoreapp-Windows_NT-Debug|Any CPU + netcoreapp-Windows_NT-Release|Any CPU = netcoreapp-Windows_NT-Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0CAF38F5-C7E7-46F2-8F39-C5D57492FF7F}.netfx-Windows_NT-Debug|Any CPU.ActiveCfg = netfx-Windows_NT-Debug|Any CPU + {0CAF38F5-C7E7-46F2-8F39-C5D57492FF7F}.netfx-Windows_NT-Debug|Any CPU.Build.0 = netfx-Windows_NT-Debug|Any CPU + {0CAF38F5-C7E7-46F2-8F39-C5D57492FF7F}.netfx-Windows_NT-Release|Any CPU.ActiveCfg = netfx-Windows_NT-Release|Any CPU + {0CAF38F5-C7E7-46F2-8F39-C5D57492FF7F}.netfx-Windows_NT-Release|Any CPU.Build.0 = netfx-Windows_NT-Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/dir.props b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/dir.props new file mode 100644 index 0000000000..727f85c06a --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/dir.props @@ -0,0 +1,9 @@ + + + + + 2.0.0 + 2.0.0.0 + Open + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/pkg/Microsoft.Diagnostics.Tracing.EventSource.Redist.pkgproj b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/pkg/Microsoft.Diagnostics.Tracing.EventSource.Redist.pkgproj new file mode 100644 index 0000000000..7c96c63275 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/pkg/Microsoft.Diagnostics.Tracing.EventSource.Redist.pkgproj @@ -0,0 +1,16 @@ + + + + + + + net461 + + + + + true + + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/ActivityTracker.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/ActivityTracker.cs new file mode 100644 index 0000000000..bb52a9bb94 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/ActivityTracker.cs @@ -0,0 +1,666 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.Threading; +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +using System.Threading.Tasks; +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Tracks activities. This is meant to be a singleton (accessed by the ActivityTracer.Instance static property) + /// + /// Logically this is simply holds the m_current variable that holds the async local that holds the current ActivityInfo + /// An ActivityInfo is represents a activity (which knows its creator and thus knows its path). + /// + /// Most of the magic is in the async local (it gets copied to new tasks) + /// + /// On every start event call OnStart + /// + /// Guid activityID; + /// Guid relatedActivityID; + /// if (OnStart(activityName, out activityID, out relatedActivityID, ForceStop, options)) + /// // Log Start event with activityID and relatedActivityID + /// + /// On every stop event call OnStop + /// + /// Guid activityID; + /// if (OnStop(activityName, ref activityID ForceStop)) + /// // Stop event with activityID + /// + /// On any normal event log the event with activityTracker.CurrentActivityId + /// + internal class ActivityTracker + { + + /// + /// Called on work item begins. The activity name = providerName + activityName without 'Start' suffix. + /// It updates CurrentActivityId to track. + /// + /// It returns true if the Start should be logged, otherwise (if it is illegal recursion) it return false. + /// + /// The start event should use as its activity ID the CurrentActivityId AFTER calling this routine and its + /// RelatedActivityID the CurrentActivityId BEFORE calling this routine (the creator). + /// + /// If activity tracing is not on, then activityId and relatedActivityId are not set + /// + public void OnStart(string providerName, string activityName, int task, ref Guid activityId, ref Guid relatedActivityId, EventActivityOptions options) + { + if (m_current == null) // We are not enabled + { + // We used to rely on the TPL provider turning us on, but that has the disadvantage that you don't get Start-Stop tracking + // until you use Tasks for the first time (which you may never do). Thus we change it to pull rather tan push for whether + // we are enabled. + if (m_checkedForEnable) + return; + m_checkedForEnable = true; + if (TplEtwProvider.Log.IsEnabled(EventLevel.Informational, TplEtwProvider.Keywords.TasksFlowActivityIds)) + Enable(); + if (m_current == null) + return; + } + + + Debug.Assert((options & EventActivityOptions.Disable) == 0); + + var currentActivity = m_current.Value; + var fullActivityName = NormalizeActivityName(providerName, activityName, task); + + var etwLog = TplEtwProvider.Log; + if (etwLog.Debug) + { + etwLog.DebugFacilityMessage("OnStartEnter", fullActivityName); + etwLog.DebugFacilityMessage("OnStartEnterActivityState", ActivityInfo.LiveActivities(currentActivity)); + } + + if (currentActivity != null) + { + // Stop activity tracking if we reached the maximum allowed depth + if (currentActivity.m_level >= MAX_ACTIVITY_DEPTH) + { + activityId = Guid.Empty; + relatedActivityId = Guid.Empty; + if (etwLog.Debug) + etwLog.DebugFacilityMessage("OnStartRET", "Fail"); + return; + } + // Check for recursion, and force-stop any activities if the activity already started. + if ((options & EventActivityOptions.Recursive) == 0) + { + ActivityInfo existingActivity = FindActiveActivity(fullActivityName, currentActivity); + if (existingActivity != null) + { + OnStop(providerName, activityName, task, ref activityId); + currentActivity = m_current.Value; + } + } + } + + // Get a unique ID for this activity. + long id; + if (currentActivity == null) + id = Interlocked.Increment(ref m_nextId); + else + id = Interlocked.Increment(ref currentActivity.m_lastChildID); + + // The previous ID is my 'causer' and becomes my related activity ID + relatedActivityId = EventSource.CurrentThreadActivityId; + + // Add to the list of started but not stopped activities. + ActivityInfo newActivity = new ActivityInfo(fullActivityName, id, currentActivity, relatedActivityId, options); + m_current.Value = newActivity; + + // Remember the current ID so we can log it + activityId = newActivity.ActivityId; + + if (etwLog.Debug) + { + etwLog.DebugFacilityMessage("OnStartRetActivityState", ActivityInfo.LiveActivities(newActivity)); + etwLog.DebugFacilityMessage1("OnStartRet", activityId.ToString(), relatedActivityId.ToString()); + } + } + + /// + /// Called when a work item stops. The activity name = providerName + activityName without 'Stop' suffix. + /// It updates m_current variable to track this fact. The Stop event associated with stop should log the ActivityID associated with the event. + /// + /// If activity tracing is not on, then activityId and relatedActivityId are not set + /// + public void OnStop(string providerName, string activityName, int task, ref Guid activityId) + { + if (m_current == null) // We are not enabled + return; + + var fullActivityName = NormalizeActivityName(providerName, activityName, task); + + var etwLog = TplEtwProvider.Log; + if (etwLog.Debug) + { + etwLog.DebugFacilityMessage("OnStopEnter", fullActivityName); + etwLog.DebugFacilityMessage("OnStopEnterActivityState", ActivityInfo.LiveActivities(m_current.Value)); + } + + for (; ; ) // This is a retry loop. + { + ActivityInfo currentActivity = m_current.Value; + ActivityInfo newCurrentActivity = null; // if we have seen any live activities (orphans), at he first one we have seen. + + // Search to find the activity to stop in one pass. This insures that we don't let one mistake + // (stopping something that was not started) cause all active starts to be stopped + // By first finding the target start to stop we are more robust. + ActivityInfo activityToStop = FindActiveActivity(fullActivityName, currentActivity); + + // ignore stops where we can't find a start because we may have popped them previously. + if (activityToStop == null) + { + activityId = Guid.Empty; + // TODO add some logging about this. Basically could not find matching start. + if (etwLog.Debug) + etwLog.DebugFacilityMessage("OnStopRET", "Fail"); + return; + } + + activityId = activityToStop.ActivityId; + + // See if there are any orphans that need to be stopped. + ActivityInfo orphan = currentActivity; + while (orphan != activityToStop && orphan != null) + { + if (orphan.m_stopped != 0) // Skip dead activities. + { + orphan = orphan.m_creator; + continue; + } + if (orphan.CanBeOrphan()) + { + // We can't pop anything after we see a valid orphan, remember this for later when we update m_current. + if (newCurrentActivity == null) + newCurrentActivity = orphan; + } + else + { + orphan.m_stopped = 1; + Debug.Assert(orphan.m_stopped != 0); + } + orphan = orphan.m_creator; + } + + // try to Stop the activity atomically. Other threads may be trying to do this as well. + if (Interlocked.CompareExchange(ref activityToStop.m_stopped, 1, 0) == 0) + { + // I succeeded stopping this activity. Now we update our m_current pointer + + // If I haven't yet determined the new current activity, it is my creator. + if (newCurrentActivity == null) + newCurrentActivity = activityToStop.m_creator; + + m_current.Value = newCurrentActivity; + + if (etwLog.Debug) + { + etwLog.DebugFacilityMessage("OnStopRetActivityState", ActivityInfo.LiveActivities(newCurrentActivity)); + etwLog.DebugFacilityMessage("OnStopRet", activityId.ToString()); + } + return; + } + // We failed to stop it. We must have hit a race to stop it. Just start over and try again. + } + } + + /// + /// Turns on activity tracking. It is sticky, once on it stays on (race issues otherwise) + /// + public void Enable() + { + if (m_current == null) + { + // Catch the not Implemented + try + { + m_current = new AsyncLocal(ActivityChanging); + } + catch (NotImplementedException) { +#if (!ES_BUILD_PCL && ! ES_BUILD_PN) + // send message to debugger without delay + System.Diagnostics.Debugger.Log(0, null, "Activity Enabled() called but AsyncLocals Not Supported (pre V4.6). Ignoring Enable"); +#endif + } + } + } + + /// + /// An activity tracker is a singleton, this is how you get the one and only instance. + /// + public static ActivityTracker Instance { get { return s_activityTrackerInstance; } } + + + #region private + + /// + /// The current activity ID. Use this to log normal events. + /// + private Guid CurrentActivityId { get { return m_current.Value.ActivityId; } } + + /// + /// Searched for a active (nonstopped) activity with the given name. Returns null if not found. + /// + private ActivityInfo FindActiveActivity(string name, ActivityInfo startLocation) + { + var activity = startLocation; + while (activity != null) + { + if (name == activity.m_name && activity.m_stopped == 0) + return activity; + activity = activity.m_creator; + } + return null; + } + + /// + /// Strip out "Start" or "End" suffix from activity name and add providerName prefix. + /// If 'task' it does not end in Start or Stop and Task is non-zero use that as the name of the activity + /// + private string NormalizeActivityName(string providerName, string activityName, int task) + { + if (activityName.EndsWith(EventSource.s_ActivityStartSuffix, StringComparison.Ordinal)) + activityName = activityName.Substring(0, activityName.Length - EventSource.s_ActivityStartSuffix.Length); + else if (activityName.EndsWith(EventSource.s_ActivityStopSuffix, StringComparison.Ordinal)) + activityName = activityName.Substring(0, activityName.Length - EventSource.s_ActivityStopSuffix.Length); + else if (task != 0) + activityName = "task" + task.ToString(); + + // We use provider name to distinguish between activities from different providers. + return providerName + activityName; + } + + // ******************************************************************************* + /// + /// An ActivityInfo represents a particular activity. It is almost read-only. The only + /// fields that change after creation are + /// m_lastChildID - used to generate unique IDs for the children activities and for the most part can be ignored. + /// m_stopped - indicates that this activity is dead + /// This read-only-ness is important because an activity's m_creator chain forms the + /// 'Path of creation' for the activity (which is also its unique ID) but is also used as + /// the 'list of live parents' which indicate of those ancestors, which are alive (if they + /// are not marked dead they are alive). + /// + private class ActivityInfo + { + public ActivityInfo(string name, long uniqueId, ActivityInfo creator, Guid activityIDToRestore, EventActivityOptions options) + { + m_name = name; + m_eventOptions = options; + m_creator = creator; + m_uniqueId = uniqueId; + m_level = creator != null ? creator.m_level + 1 : 0; + m_activityIdToRestore = activityIDToRestore; + + // Create a nice GUID that encodes the chain of activities that started this one. + CreateActivityPathGuid(out m_guid, out m_activityPathGuidOffset); + } + + public Guid ActivityId + { + get + { + return m_guid; + } + } + + public static string Path(ActivityInfo activityInfo) + { + if (activityInfo == null) + return (""); + return Path(activityInfo.m_creator) + "/" + activityInfo.m_uniqueId.ToString(); + } + + public override string ToString() + { + return m_name + "(" + Path(this) + (m_stopped != 0 ? ",DEAD)" : ")"); + } + + public static string LiveActivities(ActivityInfo list) + { + if (list == null) + return ""; + return list.ToString() + ";" + LiveActivities(list.m_creator); + } + + public bool CanBeOrphan() + { + if ((m_eventOptions & EventActivityOptions.Detachable) != 0) + return true; + return false; + } + + #region private + + #region CreateActivityPathGuid + /// + /// Logically every activity Path (see Path()) that describes the activities that caused this + /// (rooted in an activity that predates activity tracking. + /// + /// We wish to encode this path in the Guid to the extent that we can. Many of the paths have + /// many small numbers in them and we take advantage of this in the encoding to output as long + /// a path in the GUID as possible. + /// + /// Because of the possibility of GUID collision, we only use 96 of the 128 bits of the GUID + /// for encoding the path. The last 32 bits are a simple checksum (and random number) that + /// identifies this as using the convention defined here. + /// + /// It returns both the GUID which has the path as well as the offset that points just beyond + /// the end of the activity (so it can be appended to). Note that if the end is in a nibble + /// (it uses nibbles instead of bytes as the unit of encoding, then it will point at the unfinished + /// byte (since the top nibble can't be zero you can determine if this is true by seeing if + /// this byte is nonZero. This offset is needed to efficiently create the ID for child activities. + /// + private unsafe void CreateActivityPathGuid(out Guid idRet, out int activityPathGuidOffset) + { + fixed (Guid* outPtr = &idRet) + { + int activityPathGuidOffsetStart = 0; + if (m_creator != null) + { + activityPathGuidOffsetStart = m_creator.m_activityPathGuidOffset; + idRet = m_creator.m_guid; + } + else + { + // TODO FIXME - differentiate between AD inside PCL + int appDomainID = 0; +#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN) + appDomainID = System.Threading.Thread.GetDomainID(); +#endif + // We start with the appdomain number to make this unique among appdomains. + activityPathGuidOffsetStart = AddIdToGuid(outPtr, activityPathGuidOffsetStart, (uint)appDomainID); + } + + activityPathGuidOffset = AddIdToGuid(outPtr, activityPathGuidOffsetStart, (uint)m_uniqueId); + + + // If the path does not fit, Make a GUID by incrementing rather than as a path, keeping as much of the path as possible + if (12 < activityPathGuidOffset) + CreateOverflowGuid(outPtr); + } + } + + /// + /// If we can't fit the activity Path into the GUID we come here. What we do is simply + /// generate a 4 byte number (s_nextOverflowId). Then look for an ancestor that has + /// sufficient space for this ID. By doing this, we preserve the fact that this activity + /// is a child (of unknown depth) from that ancestor. + /// + private unsafe void CreateOverflowGuid(Guid* outPtr) + { + // Search backwards for an ancestor that has sufficient space to put the ID. + for (ActivityInfo ancestor = m_creator; ancestor != null; ancestor = ancestor.m_creator) + { + if (ancestor.m_activityPathGuidOffset <= 10) // we need at least 2 bytes. + { + uint id = unchecked((uint)Interlocked.Increment(ref ancestor.m_lastChildID)); // Get a unique ID + // Try to put the ID into the GUID + *outPtr = ancestor.m_guid; + int endId = AddIdToGuid(outPtr, ancestor.m_activityPathGuidOffset, id, true); + + // Does it fit? + if (endId <= 12) + break; + } + } + } + + /// + /// The encoding for a list of numbers used to make Activity GUIDs. Basically + /// we operate on nibbles (which are nice because they show up as hex digits). The + /// list is ended with a end nibble (0) and depending on the nibble value (Below) + /// the value is either encoded into nibble itself or it can spill over into the + /// bytes that follow. + /// + enum NumberListCodes : byte + { + End = 0x0, // ends the list. No valid value has this prefix. + LastImmediateValue = 0xA, + + PrefixCode = 0xB, // all the 'long' encodings go here. If the next nibble is MultiByte1-4 + // than this is a 'overflow' id. Unlike the hierarchical IDs these are + // allocated densely but don't tell you anything about nesting. we use + // these when we run out of space in the GUID to store the path. + + MultiByte1 = 0xC, // 1 byte follows. If this Nibble is in the high bits, it the high bits of the number are stored in the low nibble. + // commented out because the code does not explicitly reference the names (but they are logically defined). + // MultiByte2 = 0xD, // 2 bytes follow (we don't bother with the nibble optimization) + // MultiByte3 = 0xE, // 3 bytes follow (we don't bother with the nibble optimization) + // MultiByte4 = 0xF, // 4 bytes follow (we don't bother with the nibble optimization) + } + + /// Add the activity id 'id' to the output Guid 'outPtr' starting at the offset 'whereToAddId' + /// Thus if this number is 6 that is where 'id' will be added. This will return 13 (12 + /// is the maximum number of bytes that fit in a GUID) if the path did not fit. + /// If 'overflow' is true, then the number is encoded as an 'overflow number (which has a + /// special (longer prefix) that indicates that this ID is allocated differently + private static unsafe int AddIdToGuid(Guid* outPtr, int whereToAddId, uint id, bool overflow = false) + { + byte* ptr = (byte*)outPtr; + byte* endPtr = ptr + 12; + ptr += whereToAddId; + if (endPtr <= ptr) + return 13; // 12 means we might exactly fit, 13 means we definately did not fit + + if (0 < id && id <= (uint)NumberListCodes.LastImmediateValue && !overflow) + WriteNibble(ref ptr, endPtr, id); + else + { + uint len = 4; + if (id <= 0xFF) + len = 1; + else if (id <= 0xFFFF) + len = 2; + else if (id <= 0xFFFFFF) + len = 3; + + if (overflow) + { + if (endPtr <= ptr + 2) // I need at least 2 bytes + return 13; + + // Write out the prefix code nibble and the length nibble + WriteNibble(ref ptr, endPtr, (uint)NumberListCodes.PrefixCode); + } + // The rest is the same for overflow and non-overflow case + WriteNibble(ref ptr, endPtr, (uint)NumberListCodes.MultiByte1 + (len - 1)); + + // Do we have an odd nibble? If so flush it or use it for the 12 byte case. + if (ptr < endPtr && *ptr != 0) + { + // If the value < 4096 we can use the nibble we are otherwise just outputting as padding. + if (id < 4096) + { + // Indicate this is a 1 byte multicode with 4 high order bits in the lower nibble. + *ptr = (byte)(((uint)NumberListCodes.MultiByte1 << 4) + (id >> 8)); + id &= 0xFF; // Now we only want the low order bits. + } + ptr++; + } + + // Write out the bytes. + while (0 < len) + { + if (endPtr <= ptr) + { + ptr++; // Indicate that we have overflowed + break; + } + *ptr++ = (byte)id; + id = (id >> 8); + --len; + } + } + + // Compute the checksum + uint* sumPtr = (uint*)outPtr; + // We set the last DWORD the sum of the first 3 DWORDS in the GUID. This + // This last number is a random number (it identifies us as us) the process ID to make it unique per process. + sumPtr[3] = (sumPtr[0] + sumPtr[1] + sumPtr[2] + 0x599D99AD) ^ EventSource.s_currentPid; + + return (int)(ptr - ((byte*)outPtr)); + } + + /// + /// Write a single Nible 'value' (must be 0-15) to the byte buffer represented by *ptr. + /// Will not go past 'endPtr'. Also it assumes that we never write 0 so we can detect + /// whether a nibble has already been written to ptr because it will be nonzero. + /// Thus if it is non-zero it adds to the current byte, otherwise it advances and writes + /// the new byte (in the high bits) of the next byte. + /// + private static unsafe void WriteNibble(ref byte* ptr, byte* endPtr, uint value) + { + Debug.Assert(0 <= value && value < 16); + Debug.Assert(ptr < endPtr); + + if (*ptr != 0) + *ptr++ |= (byte)value; + else + *ptr = (byte)(value << 4); + } + + #endregion // CreateGuidForActivityPath + + readonly internal string m_name; // The name used in the 'start' and 'stop' APIs to help match up + readonly long m_uniqueId; // a small number that makes this activity unique among its siblings + internal readonly Guid m_guid; // Activity Guid, it is basically an encoding of the Path() (see CreateActivityPathGuid) + internal readonly int m_activityPathGuidOffset; // Keeps track of where in m_guid the causality path stops (used to generated child GUIDs) + internal readonly int m_level; // current depth of the Path() of the activity (used to keep recursion under control) + readonly internal EventActivityOptions m_eventOptions; // Options passed to start. + internal long m_lastChildID; // used to create a unique ID for my children activities + internal int m_stopped; // This work item has stopped + readonly internal ActivityInfo m_creator; // My parent (creator). Forms the Path() for the activity. + readonly internal Guid m_activityIdToRestore; // The Guid to restore after a stop. + #endregion + } + + // This callback is used to initialize the m_current AsyncLocal Variable. + // Its job is to keep the ETW Activity ID (part of thread local storage) in sync + // with m_current.ActivityID + void ActivityChanging(AsyncLocalValueChangedArgs args) + { + ActivityInfo cur = args.CurrentValue; + ActivityInfo prev = args.PreviousValue; + + // Are we popping off a value? (we have a prev, and it creator is cur) + // Then check if we should use the GUID at the time of the start event + if (prev != null && prev.m_creator == cur) + { + // If the saved activity ID is not the same as the creator activity + // that takes precedence (it means someone explicitly did a SetActivityID) + // Set it to that and get out + if (cur == null || prev.m_activityIdToRestore != cur.ActivityId) + { + EventSource.SetCurrentThreadActivityId(prev.m_activityIdToRestore); + return; + } + } + + // OK we did not have an explicit SetActivityID set. Then we should be + // setting the activity to current ActivityInfo. However that activity + // might be dead, in which case we should skip it, so we never set + // the ID to dead things. + while (cur != null) + { + // We found a live activity (typically the first time), set it to that. + if (cur.m_stopped == 0) + { + EventSource.SetCurrentThreadActivityId(cur.ActivityId); + return; + } + cur = cur.m_creator; + } + // we can get here if there is no information on our activity stack (everything is dead) + // currently we do nothing, as that seems better than setting to Guid.Emtpy. + } + + /// + /// Async local variables have the property that the are automatically copied whenever a task is created and used + /// while that task is running. Thus m_current 'flows' to any task that is caused by the current thread that + /// last set it. + /// + /// This variable points a a linked list that represents all Activities that have started but have not stopped. + /// + AsyncLocal m_current; + bool m_checkedForEnable; + + // Singleton + private static ActivityTracker s_activityTrackerInstance = new ActivityTracker(); + + // Used to create unique IDs at the top level. Not used for nested Ids (each activity has its own id generator) + static long m_nextId = 0; + private const ushort MAX_ACTIVITY_DEPTH = 100; // Limit maximum depth of activities to be tracked at 100. + // This will avoid leaking memory in case of activities that are never stopped. + + #endregion + } + +#if ES_BUILD_STANDALONE || ES_BUILD_PN + /******************************** SUPPORT *****************************/ + /// + /// This is supplied by the framework. It is has the semantics that the value is copied to any new Tasks that is created + /// by the current task. Thus all causally related code gets this value. Note that reads and writes to this VARIABLE + /// (not what it points it) to this does not need to be protected by locks because it is inherently thread local (you always + /// only get your thread local copy which means that you never have races. + /// + /// +#if ES_BUILD_STANDALONE + [EventSource(Name = "Microsoft.Tasks.Nuget")] +#else + [EventSource(Name = "System.Diagnostics.Tracing.TplEtwProvider")] +#endif + internal class TplEtwProvider : EventSource + { + public class Keywords + { + public const EventKeywords TasksFlowActivityIds = (EventKeywords)0x80; + public const EventKeywords Debug = (EventKeywords)0x20000; + } + + public static TplEtwProvider Log = new TplEtwProvider(); + public bool Debug { get { return IsEnabled(EventLevel.Verbose, Keywords.Debug); } } + + public void DebugFacilityMessage(string Facility, string Message) { WriteEvent(1, Facility, Message); } + public void DebugFacilityMessage1(string Facility, string Message, string Arg) { WriteEvent(2, Facility, Message, Arg); } + public void SetActivityId(Guid Id) { WriteEvent(3, Id); } + } +#endif + +#if ES_BUILD_AGAINST_DOTNET_V35 || ES_BUILD_PCL || NO_ASYNC_LOCAL + // In these cases we don't have any Async local support. Do nothing. + internal sealed class AsyncLocalValueChangedArgs + { + public T PreviousValue { get { return default(T); } } + public T CurrentValue { get { return default(T); } } + + } + + internal sealed class AsyncLocal + { + public AsyncLocal(Action> valueChangedHandler) { + throw new NotImplementedException("AsyncLocal only available on V4.6 and above"); + } + public T Value + { + get { return default(T); } + set { } + } + } +#endif + +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventActivityOptions.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventActivityOptions.cs new file mode 100644 index 0000000000..782afbf869 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventActivityOptions.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// EventActivityOptions flags allow to specify different activity related characteristics. + /// + [Flags] + public enum EventActivityOptions + { + /// + /// No special options are added to the event. + /// + None = 0, + + /// + /// Disable Implicit Activity Tracking + /// + Disable = 0x2, + + /// + /// Allow activity event to call itself (directly or indirectly) + /// + Recursive = 0x4, + + /// + /// Allows event activity to live beyond its parent. + /// + Detachable = 0x8 + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventDescriptor.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventDescriptor.cs new file mode 100644 index 0000000000..8fb471a99f --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventDescriptor.cs @@ -0,0 +1,209 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +#endif + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + [StructLayout(LayoutKind.Explicit, Size = 16)] +#if !CORECLR && !ES_BUILD_PN + [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] +#endif // !CORECLR && !ES_BUILD_PN + + /* + EventDescriptor was public in the separate System.Diagnostics.Tracing assembly(pre NS2.0), + now the move to CoreLib marked them as private. + While they are technically private (it's a contract used between the library and the ILC toolchain), + we need them to be rooted and exported from shared library for the system to work. + For now I'm simply marking them as public again.A cleaner solution might be to use.rd.xml to + root them and modify shared library definition to force export them. + */ +#if ES_BUILD_PN + public +#else + internal +#endif + struct EventDescriptor + { + # region private + [FieldOffset(0)] + private int m_traceloggingId; + [FieldOffset(0)] + private ushort m_id; + [FieldOffset(2)] + private byte m_version; + [FieldOffset(3)] + private byte m_channel; + [FieldOffset(4)] + private byte m_level; + [FieldOffset(5)] + private byte m_opcode; + [FieldOffset(6)] + private ushort m_task; + [FieldOffset(8)] + private long m_keywords; + #endregion + + public EventDescriptor( + int traceloggingId, + byte level, + byte opcode, + long keywords + ) + { + this.m_id = 0; + this.m_version = 0; + this.m_channel = 0; + this.m_traceloggingId = traceloggingId; + this.m_level = level; + this.m_opcode = opcode; + this.m_task = 0; + this.m_keywords = keywords; + } + + public EventDescriptor( + int id, + byte version, + byte channel, + byte level, + byte opcode, + int task, + long keywords + ) + { + if (id < 0) + { + throw new ArgumentOutOfRangeException(nameof(id), Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + } + + if (id > ushort.MaxValue) + { + throw new ArgumentOutOfRangeException(nameof(id), Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue)); + } + + m_traceloggingId = 0; + m_id = (ushort)id; + m_version = version; + m_channel = channel; + m_level = level; + m_opcode = opcode; + m_keywords = keywords; + + if (task < 0) + { + throw new ArgumentOutOfRangeException(nameof(task), Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + } + + if (task > ushort.MaxValue) + { + throw new ArgumentOutOfRangeException(nameof(task), Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue)); + } + + m_task = (ushort)task; + } + + public int EventId + { + get + { + return m_id; + } + } + public byte Version + { + get + { + return m_version; + } + } + public byte Channel + { + get + { + return m_channel; + } + } + public byte Level + { + get + { + return m_level; + } + } + public byte Opcode + { + get + { + return m_opcode; + } + } + public int Task + { + get + { + return m_task; + } + } + public long Keywords + { + get + { + return m_keywords; + } + } + + public override bool Equals(object obj) + { + if (!(obj is EventDescriptor)) + return false; + + return Equals((EventDescriptor) obj); + } + + public override int GetHashCode() + { + return m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^ (int)m_keywords; + } + + public bool Equals(EventDescriptor other) + { + if ((m_id != other.m_id) || + (m_version != other.m_version) || + (m_channel != other.m_channel) || + (m_level != other.m_level) || + (m_opcode != other.m_opcode) || + (m_task != other.m_task) || + (m_keywords != other.m_keywords)) + { + return false; + } + return true; + } + + public static bool operator ==(EventDescriptor event1, EventDescriptor event2) + { + return event1.Equals(event2); + } + + public static bool operator !=(EventDescriptor event1, EventDescriptor event2) + { + return !event1.Equals(event2); + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventProvider.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventProvider.cs new file mode 100644 index 0000000000..a74125a35a --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventProvider.cs @@ -0,0 +1,1326 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using Microsoft.Win32; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Security; +#if !CORECLR && !ES_BUILD_PN +using System.Security.Permissions; +#endif // !CORECLR && !ES_BUILD_PN +using System.Threading; +using System; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_AGAINST_DOTNET_V35 +using Microsoft.Internal; // for Tuple (can't define alias for open generic types so we "use" the whole namespace) +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + // New in CLR4.0 + internal enum ControllerCommand + { + // Strictly Positive numbers are for provider-specific commands, negative number are for 'shared' commands. 256 + // The first 256 negative numbers are reserved for the framework. + Update = 0, // Not used by EventPrividerBase. + SendManifest = -1, + Enable = -2, + Disable = -3, + }; + + /// + /// Only here because System.Diagnostics.EventProvider needs one more extensibility hook (when it gets a + /// controller callback) + /// +#if !CORECLR && !ES_BUILD_PN + [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] +#endif // !CORECLR && !ES_BUILD_PN + internal partial class EventProvider : IDisposable + { + // This is the windows EVENT_DATA_DESCRIPTOR structure. We expose it because this is what + // subclasses of EventProvider use when creating efficient (but unsafe) version of + // EventWrite. We do make it a nested type because we really don't expect anyone to use + // it except subclasses (and then only rarely). + [StructLayout(LayoutKind.Sequential)] + public struct EventData + { + internal unsafe ulong Ptr; + internal uint Size; + internal uint Reserved; + } + + /// + /// A struct characterizing ETW sessions (identified by the etwSessionId) as + /// activity-tracing-aware or legacy. A session that's activity-tracing-aware + /// has specified one non-zero bit in the reserved range 44-47 in the + /// 'allKeywords' value it passed in for a specific EventProvider. + /// + public struct SessionInfo + { + internal int sessionIdBit; // the index of the bit used for tracing in the "reserved" field of AllKeywords + internal int etwSessionId; // the machine-wide ETW session ID + + internal SessionInfo(int sessionIdBit_, int etwSessionId_) + { sessionIdBit = sessionIdBit_; etwSessionId = etwSessionId_; } + } + + private static bool m_setInformationMissing; + + internal IEventProvider m_eventProvider; // The interface that implements the specific logging mechanism functions. + UnsafeNativeMethods.ManifestEtw.EtwEnableCallback m_etwCallback; // Trace Callback function + private long m_regHandle; // Trace Registration Handle + private byte m_level; // Tracing Level + private long m_anyKeywordMask; // Trace Enable Flags + private long m_allKeywordMask; // Match all keyword + private List m_liveSessions; // current live sessions (Tuple) + private bool m_enabled; // Enabled flag from Trace callback + private string m_providerName; // Control name + private Guid m_providerId; // Control Guid + internal bool m_disposed; // when true provider has unregistered + + [ThreadStatic] + private static WriteEventErrorCode s_returnCode; // The last return code + + private const int s_basicTypeAllocationBufferSize = 16; + private const int s_etwMaxNumberArguments = 128; + private const int s_etwAPIMaxRefObjCount = 8; + private const int s_maxEventDataDescriptors = 128; + private const int s_traceEventMaximumSize = 65482; + private const int s_traceEventMaximumStringSize = 32724; + + [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] + public enum WriteEventErrorCode : int + { + //check mapping to runtime codes + NoError = 0, + NoFreeBuffers = 1, + EventTooBig = 2, + NullInput = 3, + TooManyArgs = 4, + Other = 5, + }; + + // Because callbacks happen on registration, and we need the callbacks for those setup + // we can't call Register in the constructor. + // + // Note that EventProvider should ONLY be used by EventSource. In particular because + // it registers a callback from native code you MUST dispose it BEFORE shutdown, otherwise + // you may get native callbacks during shutdown when we have destroyed the delegate. + // EventSource has special logic to do this, no one else should be calling EventProvider. + internal EventProvider() + { +#if PLATFORM_WINDOWS + m_eventProvider = new EtwEventProvider(); +#elif FEATURE_PERFTRACING + m_eventProvider = new EventPipeEventProvider(); +#else + m_eventProvider = new NoOpEventProvider(); +#endif + } + + /// + /// This method registers the controlGuid of this class with ETW. We need to be running on + /// Vista or above. If not a PlatformNotSupported exception will be thrown. If for some + /// reason the ETW Register call failed a NotSupported exception will be thrown. + /// + // + // + // + // + // + internal unsafe void Register(EventSource eventSource) + { + uint status; + m_etwCallback = new UnsafeNativeMethods.ManifestEtw.EtwEnableCallback(EtwEnableCallBack); + + status = EventRegister(eventSource, m_etwCallback); + if (status != 0) + { +#if PLATFORM_WINDOWS + throw new ArgumentException(Interop.Kernel32.GetMessage(unchecked((int)status))); +#else + throw new ArgumentException(Convert.ToString(unchecked((int)status))); +#endif + } + } + + // + // implement Dispose Pattern to early deregister from ETW insted of waiting for + // the finalizer to call deregistration. + // Once the user is done with the provider it needs to call Close() or Dispose() + // If neither are called the finalizer will unregister the provider anyway + // + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + // + // + // + protected virtual void Dispose(bool disposing) + { + // + // explicit cleanup is done by calling Dispose with true from + // Dispose() or Close(). The disposing arguement is ignored because there + // are no unmanaged resources. + // The finalizer calls Dispose with false. + // + + // + // check if the object has been allready disposed + // + if (m_disposed) return; + + // Disable the provider. + m_enabled = false; + + // Do most of the work under a lock to avoid shutdown race. + + long registrationHandle = 0; + lock (EventListener.EventListenersLock) + { + // Double check + if (m_disposed) + return; + + registrationHandle = m_regHandle; + m_regHandle = 0; + m_disposed = true; + } + + // We do the Unregistration outside the EventListenerLock because there is a lock + // inside the ETW routines. This lock is taken before ETW issues commands + // Thus the ETW lock gets taken first and then our EventListenersLock gets taken + // in SendCommand(), and also here. If we called EventUnregister after taking + // the EventListenersLock then the take-lock order is reversed and we can have + // deadlocks in race conditions (dispose racing with an ETW command). + // + // We solve by Unregistering after releasing the EventListenerLock. + if (registrationHandle != 0) + EventUnregister(registrationHandle); + + } + + /// + /// This method deregisters the controlGuid of this class with ETW. + /// + /// + public virtual void Close() + { + Dispose(); + } + + ~EventProvider() + { + Dispose(false); + } + + // + // + // + // + unsafe void EtwEnableCallBack( + [In] ref System.Guid sourceId, + [In] int controlCode, + [In] byte setLevel, + [In] long anyKeyword, + [In] long allKeyword, + [In] UnsafeNativeMethods.ManifestEtw.EVENT_FILTER_DESCRIPTOR* filterData, + [In] void* callbackContext + ) + { + // This is an optional callback API. We will therefore ignore any failures that happen as a + // result of turning on this provider as to not crash the app. + // EventSource has code to validate whether initialization it expected to occur actually occurred + try + { + ControllerCommand command = ControllerCommand.Update; + IDictionary args = null; + bool skipFinalOnControllerCommand = false; + if (controlCode == UnsafeNativeMethods.ManifestEtw.EVENT_CONTROL_CODE_ENABLE_PROVIDER) + { + m_enabled = true; + m_level = setLevel; + m_anyKeywordMask = anyKeyword; + m_allKeywordMask = allKeyword; + + // ES_SESSION_INFO is a marker for additional places we #ifdeffed out to remove + // references to EnumerateTraceGuidsEx. This symbol is actually not used because + // today we use FEATURE_ACTIVITYSAMPLING to determine if this code is there or not. + // However we put it in the #if so that we don't lose the fact that this feature + // switch is at least partially independent of FEATURE_ACTIVITYSAMPLING + + List> sessionsChanged = GetSessions(); + foreach (var session in sessionsChanged) + { + int sessionChanged = session.Item1.sessionIdBit; + int etwSessionId = session.Item1.etwSessionId; + bool bEnabling = session.Item2; + + skipFinalOnControllerCommand = true; + args = null; // reinitialize args for every session... + + // if we get more than one session changed we have no way + // of knowing which one "filterData" belongs to + if (sessionsChanged.Count > 1) + filterData = null; + + // read filter data only when a session is being *added* + byte[] data; + int keyIndex; + if (bEnabling && + GetDataFromController(etwSessionId, filterData, out command, out data, out keyIndex)) + { + args = new Dictionary(4); + while (keyIndex < data.Length) + { + int keyEnd = FindNull(data, keyIndex); + int valueIdx = keyEnd + 1; + int valueEnd = FindNull(data, valueIdx); + if (valueEnd < data.Length) + { + string key = System.Text.Encoding.UTF8.GetString(data, keyIndex, keyEnd - keyIndex); + string value = System.Text.Encoding.UTF8.GetString(data, valueIdx, valueEnd - valueIdx); + args[key] = value; + } + keyIndex = valueEnd + 1; + } + } + + // execute OnControllerCommand once for every session that has changed. + OnControllerCommand(command, args, (bEnabling ? sessionChanged : -sessionChanged), etwSessionId); + } + } + else if (controlCode == UnsafeNativeMethods.ManifestEtw.EVENT_CONTROL_CODE_DISABLE_PROVIDER) + { + m_enabled = false; + m_level = 0; + m_anyKeywordMask = 0; + m_allKeywordMask = 0; + m_liveSessions = null; + } + else if (controlCode == UnsafeNativeMethods.ManifestEtw.EVENT_CONTROL_CODE_CAPTURE_STATE) + { + command = ControllerCommand.SendManifest; + } + else + return; // per spec you ignore commands you don't recognize. + + if (!skipFinalOnControllerCommand) + OnControllerCommand(command, args, 0, 0); + } + catch (Exception) + { + // We want to ignore any failures that happen as a result of turning on this provider as to + // not crash the app. + } + } + + // New in CLR4.0 + protected virtual void OnControllerCommand(ControllerCommand command, IDictionary arguments, int sessionId, int etwSessionId) { } + protected EventLevel Level { get { return (EventLevel)m_level; } set { m_level = (byte)value; } } + protected EventKeywords MatchAnyKeyword { get { return (EventKeywords)m_anyKeywordMask; } set { m_anyKeywordMask = unchecked((long)value); } } + protected EventKeywords MatchAllKeyword { get { return (EventKeywords)m_allKeywordMask; } set { m_allKeywordMask = unchecked((long)value); } } + + static private int FindNull(byte[] buffer, int idx) + { + while (idx < buffer.Length && buffer[idx] != 0) + idx++; + return idx; + } + + /// + /// Determines the ETW sessions that have been added and/or removed to the set of + /// sessions interested in the current provider. It does so by (1) enumerating over all + /// ETW sessions that enabled 'this.m_Guid' for the current process ID, and (2) + /// comparing the current list with a list it cached on the previous invocation. + /// + /// The return value is a list of tuples, where the SessionInfo specifies the + /// ETW session that was added or remove, and the bool specifies whether the + /// session was added or whether it was removed from the set. + /// + private List> GetSessions() + { + List liveSessionList = null; + + GetSessionInfo( + (int etwSessionId, long matchAllKeywords, ref List sessionList) => + GetSessionInfoCallback(etwSessionId, matchAllKeywords, ref sessionList), + ref liveSessionList); + + List> changedSessionList = new List>(); + + // first look for sessions that have gone away (or have changed) + // (present in the m_liveSessions but not in the new liveSessionList) + if (m_liveSessions != null) + { + foreach (SessionInfo s in m_liveSessions) + { + int idx; + if ((idx = IndexOfSessionInList(liveSessionList, s.etwSessionId)) < 0 || + (liveSessionList[idx].sessionIdBit != s.sessionIdBit)) + changedSessionList.Add(Tuple.Create(s, false)); + + } + } + // next look for sessions that were created since the last callback (or have changed) + // (present in the new liveSessionList but not in m_liveSessions) + if (liveSessionList != null) + { + foreach (SessionInfo s in liveSessionList) + { + int idx; + if ((idx = IndexOfSessionInList(m_liveSessions, s.etwSessionId)) < 0 || + (m_liveSessions[idx].sessionIdBit != s.sessionIdBit)) + changedSessionList.Add(Tuple.Create(s, true)); + } + } + + m_liveSessions = liveSessionList; + return changedSessionList; + } + + + /// + /// This method is the callback used by GetSessions() when it calls into GetSessionInfo(). + /// It updates a List{SessionInfo} based on the etwSessionId and matchAllKeywords that + /// GetSessionInfo() passes in. + /// + private static void GetSessionInfoCallback(int etwSessionId, long matchAllKeywords, + ref List sessionList) + { + uint sessionIdBitMask = (uint)SessionMask.FromEventKeywords(unchecked((ulong)matchAllKeywords)); + // an ETW controller that specifies more than the mandated bit for our EventSource + // will be ignored... + if (bitcount(sessionIdBitMask) > 1) + return; + + if (sessionList == null) + sessionList = new List(8); + + if (bitcount(sessionIdBitMask) == 1) + { + // activity-tracing-aware etw session + sessionList.Add(new SessionInfo(bitindex(sessionIdBitMask) + 1, etwSessionId)); + } + else + { + // legacy etw session + sessionList.Add(new SessionInfo(bitcount((uint)SessionMask.All) + 1, etwSessionId)); + } + } + + private delegate void SessionInfoCallback(int etwSessionId, long matchAllKeywords, ref List sessionList); + + /// + /// This method enumerates over all active ETW sessions that have enabled 'this.m_Guid' + /// for the current process ID, calling 'action' for each session, and passing it the + /// ETW session and the 'AllKeywords' the session enabled for the current provider. + /// + private unsafe void GetSessionInfo(SessionInfoCallback action, ref List sessionList) + { + // We wish the EventSource package to be legal for Windows Store applications. + // Currently EnumerateTraceGuidsEx is not an allowed API, so we avoid its use here + // and use the information in the registry instead. This means that ETW controllers + // that do not publish their intent to the registry (basically all controllers EXCEPT + // TraceEventSesion) will not work properly + + // However the framework version of EventSource DOES have ES_SESSION_INFO defined and thus + // does not have this issue. +#if (PLATFORM_WINDOWS && (ES_SESSION_INFO || !ES_BUILD_STANDALONE)) + int buffSize = 256; // An initial guess that probably works most of the time. + byte* buffer; + for (; ; ) + { + var space = stackalloc byte[buffSize]; + buffer = space; + var hr = 0; + + fixed (Guid* provider = &m_providerId) + { + hr = UnsafeNativeMethods.ManifestEtw.EnumerateTraceGuidsEx(UnsafeNativeMethods.ManifestEtw.TRACE_QUERY_INFO_CLASS.TraceGuidQueryInfo, + provider, sizeof(Guid), buffer, buffSize, ref buffSize); + } + if (hr == 0) + break; + if (hr != 122 /* ERROR_INSUFFICIENT_BUFFER */) + return; + } + + var providerInfos = (UnsafeNativeMethods.ManifestEtw.TRACE_GUID_INFO*)buffer; + var providerInstance = (UnsafeNativeMethods.ManifestEtw.TRACE_PROVIDER_INSTANCE_INFO*)&providerInfos[1]; + int processId = unchecked((int)Win32Native.GetCurrentProcessId()); + // iterate over the instances of the EventProvider in all processes + for (int i = 0; i < providerInfos->InstanceCount; i++) + { + if (providerInstance->Pid == processId) + { + var enabledInfos = (UnsafeNativeMethods.ManifestEtw.TRACE_ENABLE_INFO*)&providerInstance[1]; + // iterate over the list of active ETW sessions "listening" to the current provider + for (int j = 0; j < providerInstance->EnableCount; j++) + action(enabledInfos[j].LoggerId, enabledInfos[j].MatchAllKeyword, ref sessionList); + } + if (providerInstance->NextOffset == 0) + break; + Debug.Assert(0 <= providerInstance->NextOffset && providerInstance->NextOffset < buffSize); + var structBase = (byte*)providerInstance; + providerInstance = (UnsafeNativeMethods.ManifestEtw.TRACE_PROVIDER_INSTANCE_INFO*)&structBase[providerInstance->NextOffset]; + } +#else +#if !ES_BUILD_PCL && PLATFORM_WINDOWS // TODO command arguments don't work on PCL builds... + // This code is only used in the Nuget Package Version of EventSource. because + // the code above is using APIs baned from UWP apps. + // + // TODO: In addition to only working when TraceEventSession enables the provider, this code + // also has a problem because TraceEvent does not clean up if the registry is stale + // It is unclear if it is worth keeping, but for now we leave it as it does work + // at least some of the time. + + // Determine our session from what is in the registry. + string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerName + "}"; + if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8) + regKey = @"Software" + @"\Wow6432Node" + regKey; + else + regKey = @"Software" + regKey; + + var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey); + if (key != null) + { + foreach (string valueName in key.GetValueNames()) + { + if (valueName.StartsWith("ControllerData_Session_", StringComparison.Ordinal)) + { + string strId = valueName.Substring(23); // strip of the ControllerData_Session_ + int etwSessionId; + if (int.TryParse(strId, out etwSessionId)) + { + // we need to assert this permission for partial trust scenarios + (new RegistryPermission(RegistryPermissionAccess.Read, regKey)).Assert(); + var data = key.GetValue(valueName) as byte[]; + if (data != null) + { + var dataAsString = System.Text.Encoding.UTF8.GetString(data); + int keywordIdx = dataAsString.IndexOf("EtwSessionKeyword", StringComparison.Ordinal); + if (0 <= keywordIdx) + { + int startIdx = keywordIdx + 18; + int endIdx = dataAsString.IndexOf('\0', startIdx); + string keywordBitString = dataAsString.Substring(startIdx, endIdx-startIdx); + int keywordBit; + if (0 < endIdx && int.TryParse(keywordBitString, out keywordBit)) + action(etwSessionId, 1L << keywordBit, ref sessionList); + } + } + } + } + } + } +#endif +#endif + } + + /// + /// Returns the index of the SesisonInfo from 'sessions' that has the specified 'etwSessionId' + /// or -1 if the value is not present. + /// + private static int IndexOfSessionInList(List sessions, int etwSessionId) + { + if (sessions == null) + return -1; + // for non-coreclr code we could use List.FindIndex(Predicate), but we need this to compile + // on coreclr as well + for (int i = 0; i < sessions.Count; ++i) + if (sessions[i].etwSessionId == etwSessionId) + return i; + + return -1; + } + + /// + /// Gets any data to be passed from the controller to the provider. It starts with what is passed + /// into the callback, but unfortunately this data is only present for when the provider is active + /// at the time the controller issues the command. To allow for providers to activate after the + /// controller issued a command, we also check the registry and use that to get the data. The function + /// returns an array of bytes representing the data, the index into that byte array where the data + /// starts, and the command being issued associated with that data. + /// + private unsafe bool GetDataFromController(int etwSessionId, + UnsafeNativeMethods.ManifestEtw.EVENT_FILTER_DESCRIPTOR* filterData, out ControllerCommand command, out byte[] data, out int dataStart) + { + data = null; + dataStart = 0; + if (filterData == null) + { +#if (!ES_BUILD_PCL && !ES_BUILD_PN && PLATFORM_WINDOWS) + string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerName + "}"; + if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8) + regKey = @"HKEY_LOCAL_MACHINE\Software" + @"\Wow6432Node" + regKey; + else + regKey = @"HKEY_LOCAL_MACHINE\Software" + regKey; + + string valueName = "ControllerData_Session_" + etwSessionId.ToString(CultureInfo.InvariantCulture); + + // we need to assert this permission for partial trust scenarios +#if !CORECLR + (new RegistryPermission(RegistryPermissionAccess.Read, regKey)).Assert(); +#endif + data = Microsoft.Win32.Registry.GetValue(regKey, valueName, null) as byte[]; + if (data != null) + { + // We only used the persisted data from the registry for updates. + command = ControllerCommand.Update; + return true; + } +#endif + } + else + { + if (filterData->Ptr != 0 && 0 < filterData->Size && filterData->Size <= 1024) + { + data = new byte[filterData->Size]; + Marshal.Copy((IntPtr)filterData->Ptr, data, 0, data.Length); + } + command = (ControllerCommand)filterData->Type; + return true; + } + + command = ControllerCommand.Update; + return false; + } + + /// + /// IsEnabled, method used to test if provider is enabled + /// + public bool IsEnabled() + { + return m_enabled; + } + + /// + /// IsEnabled, method used to test if event is enabled + /// + /// + /// Level to test + /// + /// + /// Keyword to test + /// + public bool IsEnabled(byte level, long keywords) + { + // + // If not enabled at all, return false. + // + if (!m_enabled) + { + return false; + } + + // This also covers the case of Level == 0. + if ((level <= m_level) || + (m_level == 0)) + { + + // + // Check if Keyword is enabled + // + + if ((keywords == 0) || + (((keywords & m_anyKeywordMask) != 0) && + ((keywords & m_allKeywordMask) == m_allKeywordMask))) + { + return true; + } + } + + return false; + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] + public static WriteEventErrorCode GetLastWriteEventError() + { + return s_returnCode; + } + + // + // Helper function to set the last error on the thread + // + private static void SetLastError(int error) + { + switch (error) + { + case UnsafeNativeMethods.ManifestEtw.ERROR_ARITHMETIC_OVERFLOW: + case UnsafeNativeMethods.ManifestEtw.ERROR_MORE_DATA: + s_returnCode = WriteEventErrorCode.EventTooBig; + break; + case UnsafeNativeMethods.ManifestEtw.ERROR_NOT_ENOUGH_MEMORY: + s_returnCode = WriteEventErrorCode.NoFreeBuffers; + break; + } + } + + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + private static unsafe object EncodeObject(ref object data, ref EventData* dataDescriptor, ref byte* dataBuffer, ref uint totalEventSize) + /*++ + + Routine Description: + + This routine is used by WriteEvent to unbox the object type and + to fill the passed in ETW data descriptor. + + Arguments: + + data - argument to be decoded + + dataDescriptor - pointer to the descriptor to be filled (updated to point to the next empty entry) + + dataBuffer - storage buffer for storing user data, needed because cant get the address of the object + (updated to point to the next empty entry) + + Return Value: + + null if the object is a basic type other than string or byte[]. String otherwise + + --*/ + { + Again: + dataDescriptor->Reserved = 0; + + string sRet = data as string; + byte[] blobRet = null; + + if (sRet != null) + { + dataDescriptor->Size = ((uint)sRet.Length + 1) * 2; + } + else if ((blobRet = data as byte[]) != null) + { + // first store array length + *(int*)dataBuffer = blobRet.Length; + dataDescriptor->Ptr = (ulong)dataBuffer; + dataDescriptor->Size = 4; + totalEventSize += dataDescriptor->Size; + + // then the array parameters + dataDescriptor++; + dataBuffer += s_basicTypeAllocationBufferSize; + dataDescriptor->Size = (uint)blobRet.Length; + } + else if (data is IntPtr) + { + dataDescriptor->Size = (uint)sizeof(IntPtr); + IntPtr* intptrPtr = (IntPtr*)dataBuffer; + *intptrPtr = (IntPtr)data; + dataDescriptor->Ptr = (ulong)intptrPtr; + } + else if (data is int) + { + dataDescriptor->Size = (uint)sizeof(int); + int* intptr = (int*)dataBuffer; + *intptr = (int)data; + dataDescriptor->Ptr = (ulong)intptr; + } + else if (data is long) + { + dataDescriptor->Size = (uint)sizeof(long); + long* longptr = (long*)dataBuffer; + *longptr = (long)data; + dataDescriptor->Ptr = (ulong)longptr; + } + else if (data is uint) + { + dataDescriptor->Size = (uint)sizeof(uint); + uint* uintptr = (uint*)dataBuffer; + *uintptr = (uint)data; + dataDescriptor->Ptr = (ulong)uintptr; + } + else if (data is UInt64) + { + dataDescriptor->Size = (uint)sizeof(ulong); + UInt64* ulongptr = (ulong*)dataBuffer; + *ulongptr = (ulong)data; + dataDescriptor->Ptr = (ulong)ulongptr; + } + else if (data is char) + { + dataDescriptor->Size = (uint)sizeof(char); + char* charptr = (char*)dataBuffer; + *charptr = (char)data; + dataDescriptor->Ptr = (ulong)charptr; + } + else if (data is byte) + { + dataDescriptor->Size = (uint)sizeof(byte); + byte* byteptr = (byte*)dataBuffer; + *byteptr = (byte)data; + dataDescriptor->Ptr = (ulong)byteptr; + } + else if (data is short) + { + dataDescriptor->Size = (uint)sizeof(short); + short* shortptr = (short*)dataBuffer; + *shortptr = (short)data; + dataDescriptor->Ptr = (ulong)shortptr; + } + else if (data is sbyte) + { + dataDescriptor->Size = (uint)sizeof(sbyte); + sbyte* sbyteptr = (sbyte*)dataBuffer; + *sbyteptr = (sbyte)data; + dataDescriptor->Ptr = (ulong)sbyteptr; + } + else if (data is ushort) + { + dataDescriptor->Size = (uint)sizeof(ushort); + ushort* ushortptr = (ushort*)dataBuffer; + *ushortptr = (ushort)data; + dataDescriptor->Ptr = (ulong)ushortptr; + } + else if (data is float) + { + dataDescriptor->Size = (uint)sizeof(float); + float* floatptr = (float*)dataBuffer; + *floatptr = (float)data; + dataDescriptor->Ptr = (ulong)floatptr; + } + else if (data is double) + { + dataDescriptor->Size = (uint)sizeof(double); + double* doubleptr = (double*)dataBuffer; + *doubleptr = (double)data; + dataDescriptor->Ptr = (ulong)doubleptr; + } + else if (data is bool) + { + // WIN32 Bool is 4 bytes + dataDescriptor->Size = 4; + int* intptr = (int*)dataBuffer; + if (((bool)data)) + { + *intptr = 1; + } + else + { + *intptr = 0; + } + dataDescriptor->Ptr = (ulong)intptr; + } + else if (data is Guid) + { + dataDescriptor->Size = (uint)sizeof(Guid); + Guid* guidptr = (Guid*)dataBuffer; + *guidptr = (Guid)data; + dataDescriptor->Ptr = (ulong)guidptr; + } + else if (data is decimal) + { + dataDescriptor->Size = (uint)sizeof(decimal); + decimal* decimalptr = (decimal*)dataBuffer; + *decimalptr = (decimal)data; + dataDescriptor->Ptr = (ulong)decimalptr; + } + else if (data is DateTime) + { + const long UTCMinTicks = 504911232000000000; + long dateTimeTicks = 0; + // We cannot translate dates sooner than 1/1/1601 in UTC. + // To avoid getting an ArgumentOutOfRangeException we compare with 1/1/1601 DateTime ticks + if (((DateTime)data).Ticks > UTCMinTicks) + dateTimeTicks = ((DateTime)data).ToFileTimeUtc(); + dataDescriptor->Size = (uint)sizeof(long); + long* longptr = (long*)dataBuffer; + *longptr = dateTimeTicks; + dataDescriptor->Ptr = (ulong)longptr; + } + else + { + if (data is System.Enum) + { + Type underlyingType = Enum.GetUnderlyingType(data.GetType()); + if (underlyingType == typeof(int)) + { +#if !ES_BUILD_PCL + data = ((IConvertible)data).ToInt32(null); +#else + data = (int)data; +#endif + goto Again; + } + else if (underlyingType == typeof(long)) + { +#if !ES_BUILD_PCL + data = ((IConvertible)data).ToInt64(null); +#else + data = (long)data; +#endif + goto Again; + } + } + + // To our eyes, everything else is a just a string + if (data == null) + sRet = ""; + else + sRet = data.ToString(); + dataDescriptor->Size = ((uint)sRet.Length + 1) * 2; + } + + totalEventSize += dataDescriptor->Size; + + // advance buffers + dataDescriptor++; + dataBuffer += s_basicTypeAllocationBufferSize; + + return (object)sRet ?? (object)blobRet; + } + + /// + /// WriteEvent, method to write a parameters with event schema properties + /// + /// + /// Event Descriptor for this event. + /// + /// + /// A pointer to the activity ID GUID to log + /// + /// + /// childActivityID is marked as 'related' to the current activity ID. + /// + /// + /// Payload for the ETW event. + /// + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + // + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Performance-critical code")] + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] + internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, params object[] eventPayload) + { + int status = 0; + + if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords)) + { + int argCount = 0; + unsafe + { + argCount = eventPayload.Length; + + if (argCount > s_etwMaxNumberArguments) + { + s_returnCode = WriteEventErrorCode.TooManyArgs; + return false; + } + + uint totalEventSize = 0; + int index; + int refObjIndex = 0; + List refObjPosition = new List(s_etwAPIMaxRefObjCount); + List dataRefObj = new List(s_etwAPIMaxRefObjCount); + EventData* userData = stackalloc EventData[2 * argCount]; + EventData* userDataPtr = (EventData*)userData; + byte* dataBuffer = stackalloc byte[s_basicTypeAllocationBufferSize * 2 * argCount]; // Assume 16 chars for non-string argument + byte* currentBuffer = dataBuffer; + + // + // The loop below goes through all the arguments and fills in the data + // descriptors. For strings save the location in the dataString array. + // Calculates the total size of the event by adding the data descriptor + // size value set in EncodeObject method. + // + bool hasNonStringRefArgs = false; + for (index = 0; index < eventPayload.Length; index++) + { + if (eventPayload[index] != null) + { + object supportedRefObj; + supportedRefObj = EncodeObject(ref eventPayload[index], ref userDataPtr, ref currentBuffer, ref totalEventSize); + + if (supportedRefObj != null) + { + // EncodeObject advanced userDataPtr to the next empty slot + int idx = (int)(userDataPtr - userData - 1); + if (!(supportedRefObj is string)) + { + if (eventPayload.Length + idx + 1 - index > s_etwMaxNumberArguments) + { + s_returnCode = WriteEventErrorCode.TooManyArgs; + return false; + } + hasNonStringRefArgs = true; + } + dataRefObj.Add(supportedRefObj); + refObjPosition.Add(idx); + refObjIndex++; + } + } + else + { + s_returnCode = WriteEventErrorCode.NullInput; + return false; + } + } + + // update argCount based on actual number of arguments written to 'userData' + argCount = (int)(userDataPtr - userData); + + if (totalEventSize > s_traceEventMaximumSize) + { + s_returnCode = WriteEventErrorCode.EventTooBig; + return false; + } + + // the optimized path (using "fixed" instead of allocating pinned GCHandles + if (!hasNonStringRefArgs && (refObjIndex < s_etwAPIMaxRefObjCount)) + { + // Fast path: at most 8 string arguments + + // ensure we have at least s_etwAPIMaxStringCount in dataString, so that + // the "fixed" statement below works + while (refObjIndex < s_etwAPIMaxRefObjCount) + { + dataRefObj.Add(null); + ++refObjIndex; + } + + // + // now fix any string arguments and set the pointer on the data descriptor + // + fixed (char* v0 = (string)dataRefObj[0], v1 = (string)dataRefObj[1], v2 = (string)dataRefObj[2], v3 = (string)dataRefObj[3], + v4 = (string)dataRefObj[4], v5 = (string)dataRefObj[5], v6 = (string)dataRefObj[6], v7 = (string)dataRefObj[7]) + { + userDataPtr = (EventData*)userData; + if (dataRefObj[0] != null) + { + userDataPtr[refObjPosition[0]].Ptr = (ulong)v0; + } + if (dataRefObj[1] != null) + { + userDataPtr[refObjPosition[1]].Ptr = (ulong)v1; + } + if (dataRefObj[2] != null) + { + userDataPtr[refObjPosition[2]].Ptr = (ulong)v2; + } + if (dataRefObj[3] != null) + { + userDataPtr[refObjPosition[3]].Ptr = (ulong)v3; + } + if (dataRefObj[4] != null) + { + userDataPtr[refObjPosition[4]].Ptr = (ulong)v4; + } + if (dataRefObj[5] != null) + { + userDataPtr[refObjPosition[5]].Ptr = (ulong)v5; + } + if (dataRefObj[6] != null) + { + userDataPtr[refObjPosition[6]].Ptr = (ulong)v6; + } + if (dataRefObj[7] != null) + { + userDataPtr[refObjPosition[7]].Ptr = (ulong)v7; + } + + status = m_eventProvider.EventWriteTransferWrapper(m_regHandle, ref eventDescriptor, eventHandle, activityID, childActivityID, argCount, userData); + } + } + else + { + // Slow path: use pinned handles + userDataPtr = (EventData*)userData; + + GCHandle[] rgGCHandle = new GCHandle[refObjIndex]; + for (int i = 0; i < refObjIndex; ++i) + { + // below we still use "fixed" to avoid taking dependency on the offset of the first field + // in the object (the way we would need to if we used GCHandle.AddrOfPinnedObject) + rgGCHandle[i] = GCHandle.Alloc(dataRefObj[i], GCHandleType.Pinned); + if (dataRefObj[i] is string) + { + fixed (char* p = (string)dataRefObj[i]) + userDataPtr[refObjPosition[i]].Ptr = (ulong)p; + } + else + { + fixed (byte* p = (byte[])dataRefObj[i]) + userDataPtr[refObjPosition[i]].Ptr = (ulong)p; + } + } + + status = m_eventProvider.EventWriteTransferWrapper(m_regHandle, ref eventDescriptor, eventHandle, activityID, childActivityID, argCount, userData); + + for (int i = 0; i < refObjIndex; ++i) + { + rgGCHandle[i].Free(); + } + } + } + } + + if (status != 0) + { + SetLastError((int)status); + return false; + } + + return true; + } + + /// + /// WriteEvent, method to be used by generated code on a derived class + /// + /// + /// Event Descriptor for this event. + /// + /// + /// A pointer to the activity ID to log + /// + /// + /// If this event is generating a child activity (WriteEventTransfer related activity) this is child activity + /// This can be null for events that do not generate a child activity. + /// + /// + /// number of event descriptors + /// + /// + /// pointer do the event data + /// + // + // + // + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] + internal unsafe protected bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr eventHandle, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data) + { + if (childActivityID != null) + { + // activity transfers are supported only for events that specify the Send or Receive opcode + Debug.Assert((EventOpcode)eventDescriptor.Opcode == EventOpcode.Send || + (EventOpcode)eventDescriptor.Opcode == EventOpcode.Receive || + (EventOpcode)eventDescriptor.Opcode == EventOpcode.Start || + (EventOpcode)eventDescriptor.Opcode == EventOpcode.Stop); + } + + int status = m_eventProvider.EventWriteTransferWrapper(m_regHandle, ref eventDescriptor, eventHandle, activityID, childActivityID, dataCount, (EventData*)data); + + if (status != 0) + { + SetLastError(status); + return false; + } + return true; + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] + internal unsafe bool WriteEventRaw( + ref EventDescriptor eventDescriptor, + Guid* activityID, + Guid* relatedActivityID, + int dataCount, + IntPtr data) + { + int status; + + status = m_eventProvider.EventWriteTransferWrapper( + m_regHandle, + ref eventDescriptor, + IntPtr.Zero, + activityID, + relatedActivityID, + dataCount, + (EventData*)data); + + if (status != 0) + { + SetLastError(status); + return false; + } + return true; + } + + + // These are look-alikes to the Manifest based ETW OS APIs that have been shimmed to work + // either with Manifest ETW or Classic ETW (if Manifest based ETW is not available). + private unsafe uint EventRegister(EventSource eventSource, UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback) + { + m_providerName = eventSource.Name; + m_providerId = eventSource.Guid; + m_etwCallback = enableCallback; + return m_eventProvider.EventRegister(eventSource, enableCallback, null, ref m_regHandle); + } + + private uint EventUnregister(long registrationHandle) + { + return m_eventProvider.EventUnregister(registrationHandle); + } + + static int[] nibblebits = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; + private static int bitcount(uint n) + { + int count = 0; + for (; n != 0; n = n >> 4) + count += nibblebits[n & 0x0f]; + return count; + } + private static int bitindex(uint n) + { + Debug.Assert(bitcount(n) == 1); + int idx = 0; + while ((n & (1 << idx)) == 0) + idx++; + return idx; + } + } + +#if PLATFORM_WINDOWS + + // A wrapper around the ETW-specific API calls. + internal sealed class EtwEventProvider : IEventProvider + { + // Register an event provider. + unsafe uint IEventProvider.EventRegister( + EventSource eventSource, + UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, + void* callbackContext, + ref long registrationHandle) + { + Guid providerId = eventSource.Guid; + return UnsafeNativeMethods.ManifestEtw.EventRegister( + ref providerId, + enableCallback, + callbackContext, + ref registrationHandle); + } + + // Unregister an event provider. + uint IEventProvider.EventUnregister(long registrationHandle) + { + return UnsafeNativeMethods.ManifestEtw.EventUnregister(registrationHandle); + } + + // Write an event. + unsafe int IEventProvider.EventWriteTransferWrapper( + long registrationHandle, + ref EventDescriptor eventDescriptor, + IntPtr eventHandle, + Guid* activityId, + Guid* relatedActivityId, + int userDataCount, + EventProvider.EventData* userData) + { + return UnsafeNativeMethods.ManifestEtw.EventWriteTransferWrapper( + registrationHandle, + ref eventDescriptor, + activityId, + relatedActivityId, + userDataCount, + userData); + } + + // Get or set the per-thread activity ID. + int IEventProvider.EventActivityIdControl(UnsafeNativeMethods.ManifestEtw.ActivityControl ControlCode, ref Guid ActivityId) + { + return UnsafeNativeMethods.ManifestEtw.EventActivityIdControl( + ControlCode, + ref ActivityId); + } + + // Define an EventPipeEvent handle. + unsafe IntPtr IEventProvider.DefineEventHandle(uint eventID, string eventName, Int64 keywords, uint eventVersion, uint level, byte *pMetadata, uint metadataLength) + { + throw new System.NotSupportedException(); + } + } + +#elif !FEATURE_PERFTRACING + + internal sealed class NoOpEventProvider : IEventProvider + { + unsafe uint IEventProvider.EventRegister( + EventSource eventSource, + UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, + void* callbackContext, + ref long registrationHandle) + { + return 0; + } + + uint IEventProvider.EventUnregister(long registrationHandle) + { + return 0; + } + + unsafe int IEventProvider.EventWriteTransferWrapper( + long registrationHandle, + ref EventDescriptor eventDescriptor, + IntPtr eventHandle, + Guid* activityId, + Guid* relatedActivityId, + int userDataCount, + EventProvider.EventData* userData) + { + return 0; + } + + int IEventProvider.EventActivityIdControl(UnsafeNativeMethods.ManifestEtw.ActivityControl ControlCode, ref Guid ActivityId) + { + return 0; + } + + // Define an EventPipeEvent handle. + unsafe IntPtr IEventProvider.DefineEventHandle(uint eventID, string eventName, Int64 keywords, uint eventVersion, uint level, byte *pMetadata, uint metadataLength) + { + throw new System.NotSupportedException(); + } + } + +#endif +} + diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventSource.cs.REMOVED.git-id b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventSource.cs.REMOVED.git-id new file mode 100644 index 0000000000..31d8db0aa0 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventSource.cs.REMOVED.git-id @@ -0,0 +1 @@ +8bc6455cb929bc7200fb3b1e60723e88669c113e \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventSourceException.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventSourceException.cs new file mode 100644 index 0000000000..51222dad3c --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/EventSourceException.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Resources; +using System.Runtime.Serialization; + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Exception that is thrown when an error occurs during EventSource operation. + /// +#if !CORECLR && !ES_BUILD_PN && !ES_BUILD_PCL && !CORERT + [Serializable] +#endif // !CORECLR && !ES_BUILD_PN && !ES_BUILD_PCL && !CORERT + public class EventSourceException : Exception + { + /// + /// Initializes a new instance of the EventSourceException class. + /// + public EventSourceException() : + base(Resources.GetResourceString("EventSource_ListenerWriteFailure")) { } + + /// + /// Initializes a new instance of the EventSourceException class with a specified error message. + /// + public EventSourceException(string message) : base(message) { } + + /// + /// Initializes a new instance of the EventSourceException class with a specified error message + /// and a reference to the inner exception that is the cause of this exception. + /// + public EventSourceException(string message, Exception innerException) : base(message, innerException) { } + +#if !ES_BUILD_PCL + /// + /// Initializes a new instance of the EventSourceException class with serialized data. + /// + protected EventSourceException(SerializationInfo info, StreamingContext context) : base(info, context) { } +#endif + + internal EventSourceException(Exception innerException) : + base(Resources.GetResourceString("EventSource_ListenerWriteFailure"), innerException) { } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/IEventProvider.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/IEventProvider.cs new file mode 100644 index 0000000000..d34f80eb51 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/IEventProvider.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Microsoft.Win32; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + // Represents the interface between EventProvider and an external logging mechanism. + internal interface IEventProvider + { + // Register an event provider. + unsafe uint EventRegister( + EventSource eventSource, + UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback, + void* callbackContext, + ref long registrationHandle); + + // Unregister an event provider. + uint EventUnregister(long registrationHandle); + + // Write an event. + unsafe int EventWriteTransferWrapper( + long registrationHandle, + ref EventDescriptor eventDescriptor, + IntPtr eventHandle, + Guid* activityId, + Guid* relatedActivityId, + int userDataCount, + EventProvider.EventData* userData); + + // Get or set the per-thread activity ID. + int EventActivityIdControl(UnsafeNativeMethods.ManifestEtw.ActivityControl ControlCode, ref Guid ActivityId); + + // Define an EventPipeEvent handle. + unsafe IntPtr DefineEventHandle(uint eventID, string eventName, Int64 keywords, uint eventVersion, uint level, byte *pMetadata, uint metadataLength); + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/StubEnvironment.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/StubEnvironment.cs new file mode 100644 index 0000000000..9d363dadd7 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/StubEnvironment.cs @@ -0,0 +1,396 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing.Internal +#else +namespace System.Diagnostics.Tracing.Internal +#endif +{ +#if ES_BUILD_AGAINST_DOTNET_V35 + using Microsoft.Internal; +#endif + using Microsoft.Reflection; + using System.Reflection; + + internal static class Environment + { + public static readonly string NewLine = System.Environment.NewLine; + + public static int TickCount + { get { return System.Environment.TickCount; } } + + public static string GetResourceString(string key, params object[] args) + { + string fmt = rm.GetString(key); + if (fmt != null) + return string.Format(fmt, args); + + string sargs = String.Empty; + foreach(var arg in args) + { + if (sargs != String.Empty) + sargs += ", "; + sargs += arg.ToString(); + } + + return key + " (" + sargs + ")"; + } + + public static string GetRuntimeResourceString(string key, params object[] args) + { + return GetResourceString(key, args); + } + + private static System.Resources.ResourceManager rm = new System.Resources.ResourceManager("Microsoft.Diagnostics.Tracing.Messages", typeof(Environment).Assembly()); + } +} + +#if ES_BUILD_AGAINST_DOTNET_V35 + +namespace Microsoft.Diagnostics.Contracts.Internal +{ + internal class Contract + { + public static void Assert(bool invariant) + { + Assert(invariant, string.Empty); + } + public static void Assert(bool invariant, string message) + { + if (!invariant) + { + if (System.Diagnostics.Debugger.IsAttached) + System.Diagnostics.Debugger.Break(); + throw new Exception("Assertion failed: " + message); + } + } + public static void EndContractBlock() + { } + } +} + + +namespace Microsoft.Internal +{ + using System.Text; + + internal static class Tuple + { + public static Tuple Create(T1 item1) + { + return new Tuple(item1); + } + + public static Tuple Create(T1 item1, T2 item2) + { + return new Tuple(item1, item2); + } + } + + [Serializable] + internal class Tuple + { + private readonly T1 m_Item1; + + public T1 Item1 { get { return m_Item1; } } + + public Tuple(T1 item1) + { + m_Item1 = item1; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("("); + sb.Append(m_Item1); + sb.Append(")"); + return sb.ToString(); + } + + int Size + { + get + { + return 1; + } + } + } + + [Serializable] + public class Tuple + { + private readonly T1 m_Item1; + private readonly T2 m_Item2; + + public T1 Item1 { get { return m_Item1; } } + public T2 Item2 { get { return m_Item2; } } + + public Tuple(T1 item1, T2 item2) + { + m_Item1 = item1; + m_Item2 = item2; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("("); + sb.Append(m_Item1); + sb.Append(", "); + sb.Append(m_Item2); + sb.Append(")"); + return sb.ToString(); + } + + int Size + { + get + { + return 2; + } + } + } +} + +#endif + +namespace Microsoft.Reflection +{ + using System.Reflection; + +#if ES_BUILD_PCL + [Flags] + public enum BindingFlags + { + DeclaredOnly = 0x02, // Only look at the members declared on the Type + Instance = 0x04, // Include Instance members in search + Static = 0x08, // Include Static members in search + Public = 0x10, // Include Public members in search + NonPublic = 0x20, // Include Non-Public members in search + } + + public enum TypeCode { + Empty = 0, // Null reference + Object = 1, // Instance that isn't a value + DBNull = 2, // Database null value + Boolean = 3, // Boolean + Char = 4, // Unicode character + SByte = 5, // Signed 8-bit integer + Byte = 6, // Unsigned 8-bit integer + Int16 = 7, // Signed 16-bit integer + UInt16 = 8, // Unsigned 16-bit integer + Int32 = 9, // Signed 32-bit integer + UInt32 = 10, // Unsigned 32-bit integer + Int64 = 11, // Signed 64-bit integer + UInt64 = 12, // Unsigned 64-bit integer + Single = 13, // IEEE 32-bit float + Double = 14, // IEEE 64-bit double + Decimal = 15, // Decimal + DateTime = 16, // DateTime + String = 18, // Unicode character string + } +#endif + static class ReflectionExtensions + { +#if (!ES_BUILD_PCL && !ES_BUILD_PN) + + // + // Type extension methods + // + public static bool IsEnum(this Type type) { return type.IsEnum; } + public static bool IsAbstract(this Type type) { return type.IsAbstract; } + public static bool IsSealed(this Type type) { return type.IsSealed; } + public static bool IsValueType(this Type type) { return type.IsValueType; } + public static bool IsGenericType(this Type type) { return type.IsGenericType; } + public static Type BaseType(this Type type) { return type.BaseType; } + public static Assembly Assembly(this Type type) { return type.Assembly; } + public static TypeCode GetTypeCode(this Type type) { return Type.GetTypeCode(type); } + + public static bool ReflectionOnly(this Assembly assm) { return assm.ReflectionOnly; } + +#else // ES_BUILD_PCL + + // + // Type extension methods + // + public static bool IsEnum(this Type type) { return type.GetTypeInfo().IsEnum; } + public static bool IsAbstract(this Type type) { return type.GetTypeInfo().IsAbstract; } + public static bool IsSealed(this Type type) { return type.GetTypeInfo().IsSealed; } + public static bool IsValueType(this Type type) { return type.GetTypeInfo().IsValueType; } + public static bool IsGenericType(this Type type) { return type.IsConstructedGenericType; } + public static Type BaseType(this Type type) { return type.GetTypeInfo().BaseType; } + public static Assembly Assembly(this Type type) { return type.GetTypeInfo().Assembly; } + public static IEnumerable GetProperties(this Type type) + { +#if ES_BUILD_PN + return type.GetProperties(); +#else + return type.GetRuntimeProperties(); +#endif + } + public static MethodInfo GetGetMethod(this PropertyInfo propInfo) { return propInfo.GetMethod; } + public static Type[] GetGenericArguments(this Type type) { return type.GenericTypeArguments; } + + public static MethodInfo[] GetMethods(this Type type, BindingFlags flags) + { + // Minimal implementation to cover only the cases we need + System.Diagnostics.Debug.Assert((flags & BindingFlags.DeclaredOnly) != 0); + System.Diagnostics.Debug.Assert((flags & ~(BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Static|BindingFlags.Public|BindingFlags.NonPublic)) == 0); + Func visFilter; + Func instFilter; + switch (flags & (BindingFlags.Public | BindingFlags.NonPublic)) + { + case 0: visFilter = mi => false; break; + case BindingFlags.Public: visFilter = mi => mi.IsPublic; break; + case BindingFlags.NonPublic: visFilter = mi => !mi.IsPublic; break; + default: visFilter = mi => true; break; + } + switch (flags & (BindingFlags.Instance | BindingFlags.Static)) + { + case 0: instFilter = mi => false; break; + case BindingFlags.Instance: instFilter = mi => !mi.IsStatic; break; + case BindingFlags.Static: instFilter = mi => mi.IsStatic; break; + default: instFilter = mi => true; break; + } + List methodInfos = new List(); + foreach (var declaredMethod in type.GetTypeInfo().DeclaredMethods) + { + if (visFilter(declaredMethod) && instFilter(declaredMethod)) + methodInfos.Add(declaredMethod); + } + return methodInfos.ToArray(); + } + public static FieldInfo[] GetFields(this Type type, BindingFlags flags) + { + // Minimal implementation to cover only the cases we need + System.Diagnostics.Debug.Assert((flags & BindingFlags.DeclaredOnly) != 0); + System.Diagnostics.Debug.Assert((flags & ~(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) == 0); + Func visFilter; + Func instFilter; + switch (flags & (BindingFlags.Public | BindingFlags.NonPublic)) + { + case 0: visFilter = fi => false; break; + case BindingFlags.Public: visFilter = fi => fi.IsPublic; break; + case BindingFlags.NonPublic: visFilter = fi => !fi.IsPublic; break; + default: visFilter = fi => true; break; + } + switch (flags & (BindingFlags.Instance | BindingFlags.Static)) + { + case 0: instFilter = fi => false; break; + case BindingFlags.Instance: instFilter = fi => !fi.IsStatic; break; + case BindingFlags.Static: instFilter = fi => fi.IsStatic; break; + default: instFilter = fi => true; break; + } + List fieldInfos = new List(); + foreach (var declaredField in type.GetTypeInfo().DeclaredFields) + { + if (visFilter(declaredField) && instFilter(declaredField)) + fieldInfos.Add(declaredField); + } + return fieldInfos.ToArray(); + } + public static Type GetNestedType(this Type type, string nestedTypeName) + { + TypeInfo ti = null; + foreach(var nt in type.GetTypeInfo().DeclaredNestedTypes) + { + if (nt.Name == nestedTypeName) + { + ti = nt; + break; + } + } + return ti == null ? null : ti.AsType(); + } + public static TypeCode GetTypeCode(this Type type) + { + if (type == typeof(bool)) return TypeCode.Boolean; + else if (type == typeof(byte)) return TypeCode.Byte; + else if (type == typeof(char)) return TypeCode.Char; + else if (type == typeof(ushort)) return TypeCode.UInt16; + else if (type == typeof(uint)) return TypeCode.UInt32; + else if (type == typeof(ulong)) return TypeCode.UInt64; + else if (type == typeof(sbyte)) return TypeCode.SByte; + else if (type == typeof(short)) return TypeCode.Int16; + else if (type == typeof(int)) return TypeCode.Int32; + else if (type == typeof(long)) return TypeCode.Int64; + else if (type == typeof(string)) return TypeCode.String; + else if (type == typeof(float)) return TypeCode.Single; + else if (type == typeof(double)) return TypeCode.Double; + else if (type == typeof(DateTime)) return TypeCode.DateTime; + else if (type == (typeof(Decimal))) return TypeCode.Decimal; + else return TypeCode.Object; + } + + // + // FieldInfo extension methods + // + public static object GetRawConstantValue(this FieldInfo fi) + { return fi.GetValue(null); } + + // + // Assembly extension methods + // + public static bool ReflectionOnly(this Assembly assm) + { + // In PCL we can't load in reflection-only context + return false; + } + +#endif + } +} + +// Defining some no-ops in PCL builds +#if ES_BUILD_PCL +namespace System.Security +{ + class SuppressUnmanagedCodeSecurityAttribute : Attribute { } + + enum SecurityAction { Demand } +} + +namespace System.Security.Permissions +{ + class HostProtectionAttribute : Attribute { public bool MayLeakOnAbort { get; set; } } + class PermissionSetAttribute : Attribute + { + public PermissionSetAttribute(System.Security.SecurityAction action) { } + public bool Unrestricted { get; set; } + } +} +#endif + +#if ES_BUILD_PN +namespace System +{ + internal static class AppDomain + { + public static int GetCurrentThreadId() + { + return Internal.Runtime.Augments.RuntimeThread.CurrentThread.ManagedThreadId; + } + } +} +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Win32 +{ + using System.Runtime.InteropServices; + using System.Security; + + [SuppressUnmanagedCodeSecurityAttribute()] + internal static class Win32Native + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + internal static extern uint GetCurrentProcessId(); + } +} +#endif diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ArrayTypeInfo.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ArrayTypeInfo.cs new file mode 100644 index 0000000000..5771354f67 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ArrayTypeInfo.cs @@ -0,0 +1,63 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + internal sealed class ArrayTypeInfo : TraceLoggingTypeInfo + { + private readonly TraceLoggingTypeInfo elementInfo; + + public ArrayTypeInfo(Type type, TraceLoggingTypeInfo elementInfo) + : base(type) + { + this.elementInfo = elementInfo; + } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.BeginBufferedArray(); + this.elementInfo.WriteMetadata(collector, name, format); + collector.EndBufferedArray(); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + var bookmark = collector.BeginBufferedArray(); + + var count = 0; + Array array = (Array)value.ReferenceValue; + if (array != null) + { + count = array.Length; + for (int i = 0; i < array.Length; i++) + { + this.elementInfo.WriteData(collector, elementInfo.PropertyValueFactory(array.GetValue(i))); + } + } + + collector.EndBufferedArray(bookmark, count); + } + + public override object GetData(object value) + { + var array = (Array)value; + var serializedArray = new object[array.Length]; + for (int i = 0; i < array.Length; i++) + { + serializedArray[i] = this.elementInfo.GetData(array.GetValue(i)); + } + return serializedArray; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ConcurrentSet.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ConcurrentSet.cs new file mode 100644 index 0000000000..76c01c6c06 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ConcurrentSet.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Interlocked = System.Threading.Interlocked; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: A very simple lock-free add-only dictionary. + /// Warning: this is a copy-by-value type. Copying performs a snapshot. + /// Accessing a readonly field always makes a copy of the field, so the + /// GetOrAdd method will not work as expected if called on a readonly field. + /// + /// + /// The type of the key, used for TryGet. + /// + /// + /// The type of the item, used for GetOrAdd. + /// + internal struct ConcurrentSet + where ItemType : ConcurrentSetItem + { + private ItemType[] items; + + public ItemType TryGet(KeyType key) + { + ItemType item; + var oldItems = this.items; + + if (oldItems != null) + { + var lo = 0; + var hi = oldItems.Length; + do + { + int i = (lo + hi) / 2; + item = oldItems[i]; + + int cmp = item.Compare(key); + if (cmp == 0) + { + goto Done; + } + else if (cmp < 0) + { + lo = i + 1; + } + else + { + hi = i; + } + } + while (lo != hi); + } + + item = null; + + Done: + + return item; + } + + public ItemType GetOrAdd(ItemType newItem) + { + ItemType item; + var oldItems = this.items; + ItemType[] newItems; + + Retry: + + if (oldItems == null) + { + newItems = new ItemType[] { newItem }; + } + else + { + var lo = 0; + var hi = oldItems.Length; + do + { + int i = (lo + hi) / 2; + item = oldItems[i]; + + int cmp = item.Compare(newItem); + if (cmp == 0) + { + goto Done; + } + else if (cmp < 0) + { + lo = i + 1; + } + else + { + hi = i; + } + } + while (lo != hi); + + int oldLength = oldItems.Length; + newItems = new ItemType[oldLength + 1]; + Array.Copy(oldItems, 0, newItems, 0, lo); + newItems[lo] = newItem; + Array.Copy(oldItems, lo, newItems, lo + 1, oldLength - lo); + } + + newItems = Interlocked.CompareExchange(ref this.items, newItems, oldItems); + if (oldItems != newItems) + { + oldItems = newItems; + goto Retry; + } + + item = newItem; + + Done: + + return item; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ConcurrentSetItem.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ConcurrentSetItem.cs new file mode 100644 index 0000000000..558dbf670b --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/ConcurrentSetItem.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Abstract base class that must be inherited by items in a + /// ConcurrentSet. + /// + /// Type of the set's key. + /// Type of the derived class. + internal abstract class ConcurrentSetItem + where ItemType : ConcurrentSetItem + { + public abstract int Compare(ItemType other); + public abstract int Compare(KeyType key); + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/DataCollector.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/DataCollector.cs new file mode 100644 index 0000000000..840a2f8753 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/DataCollector.cs @@ -0,0 +1,319 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: This is the implementation of the DataCollector + /// functionality. To enable safe access to the DataCollector from + /// untrusted code, there is one thread-local instance of this structure + /// per thread. The instance must be Enabled before any data is written to + /// it. The instance must be Finished before the data is passed to + /// EventWrite. The instance must be Disabled before the arrays referenced + /// by the pointers are freed or unpinned. + /// + internal unsafe struct DataCollector + { + [ThreadStatic] + internal static DataCollector ThreadInstance; + + private byte* scratchEnd; + private EventSource.EventData* datasEnd; + private GCHandle* pinsEnd; + private EventSource.EventData* datasStart; + private byte* scratch; + private EventSource.EventData* datas; + private GCHandle* pins; + private byte[] buffer; + private int bufferPos; + private int bufferNesting; // We may merge many fields int a single blob. If we are doing this we increment this. + private bool writingScalars; + + internal void Enable( + byte* scratch, + int scratchSize, + EventSource.EventData* datas, + int dataCount, + GCHandle* pins, + int pinCount) + { + this.datasStart = datas; + this.scratchEnd = scratch + scratchSize; + this.datasEnd = datas + dataCount; + this.pinsEnd = pins + pinCount; + this.scratch = scratch; + this.datas = datas; + this.pins = pins; + this.writingScalars = false; + } + + internal void Disable() + { + this = new DataCollector(); + } + + /// + /// Completes the list of scalars. Finish must be called before the data + /// descriptor array is passed to EventWrite. + /// + /// + /// A pointer to the next unused data descriptor, or datasEnd if they were + /// all used. (Descriptors may be unused if a string or array was null.) + /// + internal EventSource.EventData* Finish() + { + this.ScalarsEnd(); + return this.datas; + } + + internal void AddScalar(void* value, int size) + { + var pb = (byte*)value; + if (this.bufferNesting == 0) + { + var scratchOld = this.scratch; + var scratchNew = scratchOld + size; + if (this.scratchEnd < scratchNew) + { + throw new IndexOutOfRangeException(Resources.GetResourceString("EventSource_AddScalarOutOfRange")); + } + + this.ScalarsBegin(); + this.scratch = scratchNew; + + for (int i = 0; i != size; i++) + { + scratchOld[i] = pb[i]; + } + } + else + { + var oldPos = this.bufferPos; + this.bufferPos = checked(this.bufferPos + size); + this.EnsureBuffer(); + for (int i = 0; i != size; i++, oldPos++) + { + this.buffer[oldPos] = pb[i]; + } + } + } + + internal void AddBinary(string value, int size) + { + if (size > ushort.MaxValue) + { + size = ushort.MaxValue - 1; + } + + if (this.bufferNesting != 0) + { + this.EnsureBuffer(size + 2); + } + + this.AddScalar(&size, 2); + + if (size != 0) + { + if (this.bufferNesting == 0) + { + this.ScalarsEnd(); + this.PinArray(value, size); + } + else + { + var oldPos = this.bufferPos; + this.bufferPos = checked(this.bufferPos + size); + this.EnsureBuffer(); + fixed (void* p = value) + { + Marshal.Copy((IntPtr)p, buffer, oldPos, size); + } + } + } + } + + internal void AddBinary(Array value, int size) + { + this.AddArray(value, size, 1); + } + + internal void AddArray(Array value, int length, int itemSize) + { + if (length > ushort.MaxValue) + { + length = ushort.MaxValue; + } + + var size = length * itemSize; + if (this.bufferNesting != 0) + { + this.EnsureBuffer(size + 2); + } + + this.AddScalar(&length, 2); + + if (length != 0) + { + if (this.bufferNesting == 0) + { + this.ScalarsEnd(); + this.PinArray(value, size); + } + else + { + var oldPos = this.bufferPos; + this.bufferPos = checked(this.bufferPos + size); + this.EnsureBuffer(); + Buffer.BlockCopy(value, 0, this.buffer, oldPos, size); + } + } + } + + /// + /// Marks the start of a non-blittable array or enumerable. + /// + /// Bookmark to be passed to EndBufferedArray. + internal int BeginBufferedArray() + { + this.BeginBuffered(); + this.bufferPos += 2; // Reserve space for the array length (filled in by EndEnumerable) + return this.bufferPos; + } + + /// + /// Marks the end of a non-blittable array or enumerable. + /// + /// The value returned by BeginBufferedArray. + /// The number of items in the array. + internal void EndBufferedArray(int bookmark, int count) + { + this.EnsureBuffer(); + this.buffer[bookmark - 2] = unchecked((byte)count); + this.buffer[bookmark - 1] = unchecked((byte)(count >> 8)); + this.EndBuffered(); + } + + /// + /// Marks the start of dynamically-buffered data. + /// + internal void BeginBuffered() + { + this.ScalarsEnd(); + this.bufferNesting += 1; + } + + /// + /// Marks the end of dynamically-buffered data. + /// + internal void EndBuffered() + { + this.bufferNesting -= 1; + + if (this.bufferNesting == 0) + { + /* + TODO (perf): consider coalescing adjacent buffered regions into a + single buffer, similar to what we're already doing for adjacent + scalars. In addition, if a type contains a buffered region adjacent + to a blittable array, and the blittable array is small, it would be + more efficient to buffer the array instead of pinning it. + */ + + this.EnsureBuffer(); + this.PinArray(this.buffer, this.bufferPos); + this.buffer = null; + this.bufferPos = 0; + } + } + + private void EnsureBuffer() + { + var required = this.bufferPos; + if (this.buffer == null || this.buffer.Length < required) + { + this.GrowBuffer(required); + } + } + + private void EnsureBuffer(int additionalSize) + { + var required = this.bufferPos + additionalSize; + if (this.buffer == null || this.buffer.Length < required) + { + this.GrowBuffer(required); + } + } + + private void GrowBuffer(int required) + { + var newSize = this.buffer == null ? 64 : this.buffer.Length; + + do + { + newSize *= 2; + } + while (newSize < required); + + Array.Resize(ref this.buffer, newSize); + } + + private void PinArray(object value, int size) + { + var pinsTemp = this.pins; + if (this.pinsEnd <= pinsTemp) + { + throw new IndexOutOfRangeException(Resources.GetResourceString("EventSource_PinArrayOutOfRange")); + } + + var datasTemp = this.datas; + if (this.datasEnd <= datasTemp) + { + throw new IndexOutOfRangeException(Resources.GetResourceString("EventSource_DataDescriptorsOutOfRange")); + } + + this.pins = pinsTemp + 1; + this.datas = datasTemp + 1; + + *pinsTemp = GCHandle.Alloc(value, GCHandleType.Pinned); + datasTemp->DataPointer = pinsTemp->AddrOfPinnedObject(); + datasTemp->m_Size = size; + } + + private void ScalarsBegin() + { + if (!this.writingScalars) + { + var datasTemp = this.datas; + if (this.datasEnd <= datasTemp) + { + throw new IndexOutOfRangeException(Resources.GetResourceString("EventSource_DataDescriptorsOutOfRange")); + } + + datasTemp->DataPointer = (IntPtr) this.scratch; + this.writingScalars = true; + } + } + + private void ScalarsEnd() + { + if (this.writingScalars) + { + var datasTemp = this.datas; + datasTemp->m_Size = checked((int)(this.scratch - (byte*)datasTemp->m_Ptr)); + this.datas = datasTemp + 1; + this.writingScalars = false; + } + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EmptyStruct.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EmptyStruct.cs new file mode 100644 index 0000000000..bc7fb8c346 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EmptyStruct.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Empty struct indicating no payload data. + /// + internal struct EmptyStruct + { + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EnumHelper.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EnumHelper.cs new file mode 100644 index 0000000000..7a23378bb1 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EnumHelper.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +#if EVENTSOURCE_GENERICS +?using System; +using System.Reflection; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Provides support for casting enums to their underlying type + /// from within generic context. + /// + /// + /// The underlying type of the enum. + /// + internal static class EnumHelper + { + public static UnderlyingType Cast(ValueType value) + { + return (UnderlyingType)(object)value; + } + } + +} +#endif diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EnumerableTypeInfo.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EnumerableTypeInfo.cs new file mode 100644 index 0000000000..74a3fa27b2 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EnumerableTypeInfo.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + internal sealed class EnumerableTypeInfo : TraceLoggingTypeInfo + { + private readonly TraceLoggingTypeInfo elementInfo; + + public EnumerableTypeInfo(Type type, TraceLoggingTypeInfo elementInfo) + : base(type) + { + this.elementInfo = elementInfo; + } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.BeginBufferedArray(); + this.elementInfo.WriteMetadata(collector, name, format); + collector.EndBufferedArray(); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + var bookmark = collector.BeginBufferedArray(); + + var count = 0; + IEnumerable enumerable = (IEnumerable)value.ReferenceValue; + if (enumerable != null) + { + foreach (var element in enumerable) + { + this.elementInfo.WriteData(collector, elementInfo.PropertyValueFactory(element)); + count++; + } + } + + collector.EndBufferedArray(bookmark, count); + } + + public override object GetData(object value) + { + var iterType = (IEnumerable)value; + List serializedEnumerable = new List(); + foreach (var element in iterType) + { + serializedEnumerable.Add(elementInfo.GetData(element)); + } + return serializedEnumerable.ToArray(); + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventDataAttribute.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventDataAttribute.cs new file mode 100644 index 0000000000..cdedf13c64 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventDataAttribute.cs @@ -0,0 +1,146 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Used when authoring types that will be passed to EventSource.Write. + /// EventSource.Write<T> only works when T is either an anonymous type + /// or a type with an [EventData] attribute. In addition, the properties + /// of T must be supported property types. Supported property types include + /// simple built-in types (int, string, Guid, DateTime, DateTimeOffset, + /// KeyValuePair, etc.), anonymous types that only contain supported types, + /// types with an [EventData] attribute, arrays of the above, and IEnumerable + /// of the above. + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false)] + public class EventDataAttribute + : Attribute + { + private EventLevel level = (EventLevel)(-1); + private EventOpcode opcode = (EventOpcode)(-1); + + /// + /// Gets or sets the name to use if this type is used for an + /// implicitly-named event or an implicitly-named property. + /// + /// Example 1: + /// + /// EventSource.Write(null, new T()); // implicitly-named event + /// + /// The name of the event will be determined as follows: + /// + /// if (T has an EventData attribute and attribute.Name != null) + /// eventName = attribute.Name; + /// else + /// eventName = typeof(T).Name; + /// + /// Example 2: + /// + /// EventSource.Write(name, new { _1 = new T() }); // implicitly-named field + /// + /// The name of the field will be determined as follows: + /// + /// if (T has an EventData attribute and attribute.Name != null) + /// fieldName = attribute.Name; + /// else + /// fieldName = typeof(T).Name; + /// + public string Name + { + get; + set; + } + + /// + /// Gets or sets the level to use for the event. + /// Invalid levels (outside the range 0..255) are treated as unset. + /// Note that the Level attribute can bubble-up, i.e. if a type contains + /// a sub-object (a field or property), and the sub-object's type has a + /// TraceLoggingEvent attribute, the Level from the sub-object's attribute + /// can affect the event's level. + /// + /// Example: for EventSource.Write(name, options, data), the level of the + /// event will be determined as follows: + /// + /// if (options.Level has been set) + /// eventLevel = options.Level; + /// else if (data.GetType() has a TraceLoggingEvent attribute and attribute.Level has been set) + /// eventLevel = attribute.Level; + /// else if (a field/property contained in data has a TraceLoggingEvent attribute and attribute.Level has been set) + /// eventLevel = attribute.Level; + /// else + /// eventLevel = EventLevel.LogAlways; + /// + internal EventLevel Level + { + get { return this.level; } + set { this.level = value; } + } + + /// + /// Gets or sets the opcode to use for the event. + /// Invalid opcodes (outside the range 0..255) are treated as unset. + /// Note that the Opcode attribute can bubble-up, i.e. if a type contains + /// a sub-object (a field or property), and the sub-object's type has a + /// TraceLoggingEvent attribute, the Opcode from the sub-object's attribute + /// can affect the event's opcode. + /// + /// Example: for EventSource.Write(name, options, data), the opcode of the + /// event will be determined as follows: + /// + /// if (options.Opcode has been set) + /// eventOpcode = options.Opcode; + /// else if (data.GetType() has a TraceLoggingEvent attribute and attribute.Opcode has been set) + /// eventOpcode = attribute.Opcode; + /// else if (a field/property contained in data has a TraceLoggingEvent attribute and attribute.Opcode has been set) + /// eventOpcode = attribute.Opcode; + /// else + /// eventOpcode = EventOpcode.Info; + /// + internal EventOpcode Opcode + { + get { return this.opcode; } + set { this.opcode = value; } + } + + /// + /// Gets or sets the keywords to use for the event. + /// Note that the Keywords attribute can bubble-up, i.e. if a type contains + /// a sub-object (a field or property), and the sub-object's type has a + /// TraceLoggingEvent attribute, the Keywords from the sub-object's attribute + /// can affect the event's keywords. + /// + /// Example: for EventSource.Write(name, options, data), the keywords of the + /// event will be determined as follows: + /// + /// eventKeywords = options.Keywords; + /// if (data.GetType() has a TraceLoggingEvent attribute) + /// eventKeywords |= attribute.Keywords; + /// if (a field/property contained in data has a TraceLoggingEvent attribute) + /// eventKeywords |= attribute.Keywords; + /// + internal EventKeywords Keywords + { + get; + set; + } + + /// + /// Gets or sets the flags for an event. These flags are ignored by ETW, + /// but can have meaning to the event consumer. + /// + internal EventTags Tags + { + get; + set; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventFieldAttribute.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventFieldAttribute.cs new file mode 100644 index 0000000000..1a298c2851 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventFieldAttribute.cs @@ -0,0 +1,76 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Tags are flags that are not interpreted by EventSource but are passed along + /// to the EventListener. The EventListener determines the semantics of the flags. + /// + [Flags] + public enum EventFieldTags + { + /// + /// No special traits are added to the field. + /// + None = 0, + + /* Bits below 0x10000 are available for any use by the provider. */ + /* Bits at or above 0x10000 are reserved for definition by Microsoft. */ + } + + /// + /// TraceLogging: used when authoring types that will be passed to EventSource.Write. + /// Controls how a field or property is handled when it is written as a + /// field in a TraceLogging event. Apply this attribute to a field or + /// property if the default handling is not correct. (Apply the + /// TraceLoggingIgnore attribute if the property should not be + /// included as a field in the event.) + /// The default for Name is null, which means that the name of the + /// underlying field or property will be used as the event field's name. + /// The default for PiiTag is 0, which means that the event field does not + /// contain personally-identifiable information. + /// + [AttributeUsage(AttributeTargets.Property)] + public class EventFieldAttribute + : Attribute + { + /// + /// User defined options for the field. These are not interpreted by the EventSource + /// but are available to the Listener. See EventFieldSettings for details + /// + public EventFieldTags Tags + { + get; + set; + } + + /// + /// Gets or sets the name to use for the field. This defaults to null. + /// If null, the name of the corresponding property will be used + /// as the event field's name. + /// TODO REMOVE + /// + internal string Name + { + get; + set; + } + + /// + /// Gets or sets a field formatting hint. + /// + public EventFieldFormat Format + { + get; + set; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventFieldFormat.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventFieldFormat.cs new file mode 100644 index 0000000000..fd77b07965 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventFieldFormat.cs @@ -0,0 +1,130 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Provides a hint that may be used by an event listener when formatting + /// an event field for display. Note that the event listener may ignore the + /// hint if it does not recognize a particular combination of type and format. + /// Similar to TDH_OUTTYPE. + /// + public enum EventFieldFormat + { + /// + /// Field receives default formatting based on the field's underlying type. + /// + Default = 0, +#if false + /// + /// Field should not be displayed. + /// + NoPrint = 1, +#endif + /// + /// Field should be formatted as character or string data. + /// Typically applied to 8-bit or 16-bit integers. + /// This is the default format for String and Char types. + /// + String = 2, + + /// + /// Field should be formatted as boolean data. Typically applied to 8-bit + /// or 32-bit integers. This is the default format for the Boolean type. + /// + Boolean = 3, + + /// + /// Field should be formatted as hexadecimal data. Typically applied to + /// integer types. + /// + Hexadecimal = 4, + +#if false + /// + /// Field should be formatted as a process identifier. Typically applied to + /// 32-bit integer types. + /// + ProcessId = 5, + + /// + /// Field should be formatted as a thread identifier. Typically applied to + /// 32-bit integer types. + /// + ThreadId = 6, + + /// + /// Field should be formatted as an Internet port. Typically applied to 16-bit integer + /// types. + /// + Port = 7, + /// + /// Field should be formatted as an Internet Protocol v4 address. Typically applied to + /// 32-bit integer types. + /// + Ipv4Address = 8, + + /// + /// Field should be formatted as an Internet Protocol v6 address. Typically applied to + /// byte[] types. + /// + Ipv6Address = 9, + /// + /// Field should be formatted as a SOCKADDR. Typically applied to byte[] types. + /// + SocketAddress = 10, +#endif + /// + /// Field should be formatted as XML string data. Typically applied to + /// strings or arrays of 8-bit or 16-bit integers. + /// + Xml = 11, + + /// + /// Field should be formatted as JSON string data. Typically applied to + /// strings or arrays of 8-bit or 16-bit integers. + /// + Json = 12, +#if false + /// + /// Field should be formatted as a Win32 error code. Typically applied to + /// 32-bit integer types. + /// + Win32Error = 13, + + /// + /// Field should be formatted as an NTSTATUS code. Typically applied to + /// 32-bit integer types. + /// + NTStatus = 14, +#endif + /// + /// Field should be formatted as an HRESULT code. Typically applied to + /// 32-bit integer types. + /// + HResult = 15, +#if false + /// + /// Field should be formatted as a FILETIME. Typically applied to 64-bit + /// integer types. This is the default format for DateTime types. + /// + FileTime = 16, + /// + /// When applied to a numeric type, indicates that the type should be formatted + /// as a signed integer. This is the default format for signed integer types. + /// + Signed = 17, + + /// + /// When applied to a numeric type, indicates that the type should be formatted + /// as an unsigned integer. This is the default format for unsigned integer types. + /// + Unsigned = 18, +#endif + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventIgnoreAttribute.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventIgnoreAttribute.cs new file mode 100644 index 0000000000..769345f78e --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventIgnoreAttribute.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Used when authoring types that will be passed to EventSource.Write. + /// By default, EventSource.Write will write all of an object's public + /// properties to the event payload. Apply [EventIgnore] to a public + /// property to prevent EventSource.Write from including the property in + /// the event. + /// + [AttributeUsage(AttributeTargets.Property)] + public class EventIgnoreAttribute + : Attribute + { + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventPayload.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventPayload.cs new file mode 100644 index 0000000000..5967ad6ab5 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventPayload.cs @@ -0,0 +1,155 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Collections; +using System.Diagnostics; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// EventPayload class holds the list of parameters and their corresponding values for user defined types passed to + /// EventSource APIs. + /// Preserving the order of the elements as they were found inside user defined types is the most important characteristic of this class. + /// + internal class EventPayload : IDictionary + { + internal EventPayload(List payloadNames, List payloadValues) + { + Debug.Assert(payloadNames.Count == payloadValues.Count); + + m_names = payloadNames; + m_values = payloadValues; + } + + public ICollection Keys { get { return m_names; } } + public ICollection Values { get { return m_values; } } + + public object this[string key] + { + get + { + if (key == null) + throw new System.ArgumentNullException(nameof(key)); + + int position = 0; + foreach(var name in m_names) + { + if (name == key) + { + return m_values[position]; + } + position++; + } + + throw new System.Collections.Generic.KeyNotFoundException(); + } + set + { + throw new System.NotSupportedException(); + } + } + + public void Add(string key, object value) + { + throw new System.NotSupportedException(); + } + + public void Add(KeyValuePair payloadEntry) + { + throw new System.NotSupportedException(); + } + + public void Clear() + { + throw new System.NotSupportedException(); + } + + public bool Contains(KeyValuePair entry) + { + return ContainsKey(entry.Key); + } + + public bool ContainsKey(string key) + { + if (key == null) + throw new System.ArgumentNullException(nameof(key)); + + foreach (var item in m_names) + { + if (item == key) + return true; + } + return false; + } + + public int Count { get { return m_names.Count; } } + + public bool IsReadOnly { get { return true; } } + + public IEnumerator> GetEnumerator() + { + for (int i = 0; i < Keys.Count; i++) + { + yield return new KeyValuePair(this.m_names[i], this.m_values[i]); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + var instance = this as IEnumerable>; + return instance.GetEnumerator(); + } + + public void CopyTo(KeyValuePair[] payloadEntries, int count) + { + throw new System.NotSupportedException(); + } + + public bool Remove(string key) + { + throw new System.NotSupportedException(); + } + + public bool Remove(KeyValuePair entry) + { + throw new System.NotSupportedException(); + } + + public bool TryGetValue(string key, out object value) + { + if (key == null) + throw new System.ArgumentNullException(nameof(key)); + + int position = 0; + foreach (var name in m_names) + { + if (name == key) + { + value = m_values[position]; + return true; + } + position++; + } + + value = default(object); + return false; + } + + #region private + private List m_names; + private List m_values; + #endregion + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventSourceActivity.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventSourceActivity.cs new file mode 100644 index 0000000000..acc3eeb233 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventSourceActivity.cs @@ -0,0 +1,321 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Provides support for EventSource activities by marking the start and + /// end of a particular operation. + /// + internal sealed class EventSourceActivity + : IDisposable + { + /// + /// Initializes a new instance of the EventSourceActivity class that + /// is attached to the specified event source. The new activity will + /// not be attached to any related (parent) activity. + /// The activity is created in the Initialized state. + /// + /// + /// The event source to which the activity information is written. + /// + public EventSourceActivity(EventSource eventSource) + { + if (eventSource == null) + throw new ArgumentNullException(nameof(eventSource)); + Contract.EndContractBlock(); + + this.eventSource = eventSource; + } + + /// + /// You can make an activity out of just an EventSource. + /// + public static implicit operator EventSourceActivity(EventSource eventSource) { return new EventSourceActivity(eventSource); } + + /* Properties */ + /// + /// Gets the event source to which this activity writes events. + /// + public EventSource EventSource + { + get { return this.eventSource; } + } + + /// + /// Gets this activity's unique identifier, or the default Guid if the + /// event source was disabled when the activity was initialized. + /// + public Guid Id + { + get { return this.activityId; } + } + +#if false // don't expose RelatedActivityId unless there is a need. + /// + /// Gets the unique identifier of this activity's related (parent) + /// activity. + /// + public Guid RelatedId + { + get { return this.relatedActivityId; } + } +#endif + + /// + /// Writes a Start event with the specified name and data. If the start event is not active (because the provider + /// is not on or keyword-level indicates the event is off, then the returned activity is simply the 'this' pointer + /// and it is effectively like start did not get called. + /// + /// A new activityID GUID is generated and the returned + /// EventSourceActivity remembers this activity and will mark every event (including the start stop and any writes) + /// with this activityID. In addition the Start activity will log a 'relatedActivityID' that was the activity + /// ID before the start event. This way event processors can form a linked list of all the activities that + /// caused this one (directly or indirectly). + /// + /// + /// The name to use for the event. It is strongly suggested that this name end in 'Start' (e.g. DownloadStart). + /// If you do this, then the Stop() method will automatically replace the 'Start' suffix with a 'Stop' suffix. + /// + /// Allow options (keywords, level) to be set for the write associated with this start + /// These will also be used for the stop event. + /// The data to include in the event. + public EventSourceActivity Start(string eventName, EventSourceOptions options, T data) + { + return this.Start(eventName, ref options, ref data); + } + /// + /// Shortcut version see Start(string eventName, EventSourceOptions options, T data) Options is empty (no keywords + /// and level==Info) Data payload is empty. + /// + public EventSourceActivity Start(string eventName) + { + var options = new EventSourceOptions(); + var data = new EmptyStruct(); + return this.Start(eventName, ref options, ref data); + } + /// + /// Shortcut version see Start(string eventName, EventSourceOptions options, T data). Data payload is empty. + /// + public EventSourceActivity Start(string eventName, EventSourceOptions options) + { + var data = new EmptyStruct(); + return this.Start(eventName, ref options, ref data); + } + /// + /// Shortcut version see Start(string eventName, EventSourceOptions options, T data) Options is empty (no keywords + /// and level==Info) + /// + public EventSourceActivity Start(string eventName, T data) + { + var options = new EventSourceOptions(); + return this.Start(eventName, ref options, ref data); + } + + /// + /// Writes a Stop event with the specified data, and sets the activity + /// to the Stopped state. The name is determined by the eventName used in Start. + /// If that Start event name is suffixed with 'Start' that is removed, and regardless + /// 'Stop' is appended to the result to form the Stop event name. + /// May only be called when the activity is in the Started state. + /// + /// The data to include in the event. + public void Stop(T data) + { + this.Stop(null, ref data); + } + /// + /// Used if you wish to use the non-default stop name (which is the start name with Start replace with 'Stop') + /// This can be useful to indicate unusual ways of stopping (but it is still STRONGLY recommended that + /// you start with the same prefix used for the start event and you end with the 'Stop' suffix. + /// + public void Stop(string eventName) + { + var data = new EmptyStruct(); + this.Stop(eventName, ref data); + } + /// + /// Used if you wish to use the non-default stop name (which is the start name with Start replace with 'Stop') + /// This can be useful to indicate unusual ways of stopping (but it is still STRONGLY recommended that + /// you start with the same prefix used for the start event and you end with the 'Stop' suffix. + /// + public void Stop(string eventName, T data) + { + this.Stop(eventName, ref data); + } + + /// + /// Writes an event associated with this activity to the eventSource associated with this activity. + /// May only be called when the activity is in the Started state. + /// + /// + /// The name to use for the event. If null, the name is determined from + /// data's type. + /// + /// + /// The options to use for the event. + /// + /// The data to include in the event. + public void Write(string eventName, EventSourceOptions options, T data) + { + this.Write(this.eventSource, eventName, ref options, ref data); + } + /// + /// Writes an event associated with this activity. + /// May only be called when the activity is in the Started state. + /// + /// + /// The name to use for the event. If null, the name is determined from + /// data's type. + /// + /// The data to include in the event. + public void Write(string eventName, T data) + { + var options = new EventSourceOptions(); + this.Write(this.eventSource, eventName, ref options, ref data); + } + /// + /// Writes a trivial event associated with this activity. + /// May only be called when the activity is in the Started state. + /// + /// + /// The name to use for the event. Must not be null. + /// + /// + /// The options to use for the event. + /// + public void Write(string eventName, EventSourceOptions options) + { + var data = new EmptyStruct(); + this.Write(this.eventSource, eventName, ref options, ref data); + } + /// + /// Writes a trivial event associated with this activity. + /// May only be called when the activity is in the Started state. + /// + /// + /// The name to use for the event. Must not be null. + /// + public void Write(string eventName) + { + var options = new EventSourceOptions(); + var data = new EmptyStruct(); + this.Write(this.eventSource, eventName, ref options, ref data); + } + /// + /// Writes an event to a arbitrary eventSource stamped with the activity ID of this activity. + /// + public void Write(EventSource source, string eventName, EventSourceOptions options, T data) + { + this.Write(source, eventName, ref options, ref data); + } + + /// + /// Releases any unmanaged resources associated with this object. + /// If the activity is in the Started state, calls Stop(). + /// + public void Dispose() + { + if (this.state == State.Started) + { + var data = new EmptyStruct(); + this.Stop(null, ref data); + } + } + + #region private + private EventSourceActivity Start(string eventName, ref EventSourceOptions options, ref T data) + { + if (this.state != State.Started) + throw new InvalidOperationException(); + + // If the source is not on at all, then we don't need to do anything and we can simply return ourselves. + if (!this.eventSource.IsEnabled()) + return this; + + var newActivity = new EventSourceActivity(eventSource); + if (!this.eventSource.IsEnabled(options.Level, options.Keywords)) + { + // newActivity.relatedActivityId = this.Id; + Guid relatedActivityId = this.Id; + newActivity.activityId = Guid.NewGuid(); + newActivity.startStopOptions = options; + newActivity.eventName = eventName; + newActivity.startStopOptions.Opcode = EventOpcode.Start; + this.eventSource.Write(eventName, ref newActivity.startStopOptions, ref newActivity.activityId, ref relatedActivityId, ref data); + } + else + { + // If we are not active, we don't set the eventName, which basically also turns off the Stop event as well. + newActivity.activityId = this.Id; + } + + return newActivity; + } + + private void Write(EventSource eventSource, string eventName, ref EventSourceOptions options, ref T data) + { + if (this.state != State.Started) + throw new InvalidOperationException(); // Write after stop. + if (eventName == null) + throw new ArgumentNullException(); + + eventSource.Write(eventName, ref options, ref this.activityId, ref s_empty, ref data); + } + + private void Stop(string eventName, ref T data) + { + if (this.state != State.Started) + throw new InvalidOperationException(); + + // If start was not fired, then stop isn't as well. + if (!StartEventWasFired) + return; + + this.state = State.Stopped; + if (eventName == null) + { + eventName = this.eventName; + if (eventName.EndsWith("Start")) + eventName = eventName.Substring(0, eventName.Length - 5); + eventName = eventName + "Stop"; + } + this.startStopOptions.Opcode = EventOpcode.Stop; + this.eventSource.Write(eventName, ref this.startStopOptions, ref this.activityId, ref s_empty, ref data); + } + + private enum State + { + Started, + Stopped + } + + /// + /// If eventName is non-null then we logged a start event + /// + private bool StartEventWasFired { get { return eventName != null; } } + + private readonly EventSource eventSource; + private EventSourceOptions startStopOptions; + internal Guid activityId; + // internal Guid relatedActivityId; + private State state; + private string eventName; + + static internal Guid s_empty; + #endregion + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventSourceOptions.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventSourceOptions.cs new file mode 100644 index 0000000000..26305a5708 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/EventSourceOptions.cs @@ -0,0 +1,130 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Used when calling EventSource.Write. + /// Optional overrides for event settings such as Level, Keywords, or Opcode. + /// If overrides are not provided for a setting, default values will be used. + /// + public struct EventSourceOptions + { + internal EventKeywords keywords; + internal EventTags tags; + internal EventActivityOptions activityOptions; + internal byte level; + internal byte opcode; + internal byte valuesSet; + + internal const byte keywordsSet = 0x1; + internal const byte tagsSet = 0x2; + internal const byte levelSet = 0x4; + internal const byte opcodeSet = 0x8; + internal const byte activityOptionsSet = 0x10; + + /// + /// Gets or sets the level to use for the specified event. If this property + /// is unset, the event's level will be 5 (Verbose). + /// + public EventLevel Level + { + get + { + return (EventLevel)this.level; + } + + set + { + this.level = checked((byte)value); + this.valuesSet |= levelSet; + } + } + + /// + /// Gets or sets the opcode to use for the specified event. If this property + /// is unset, the event's opcode will 0 (Info). + /// + public EventOpcode Opcode + { + get + { + return (EventOpcode)this.opcode; + } + + set + { + this.opcode = checked((byte)value); + this.valuesSet |= opcodeSet; + } + } + + internal bool IsOpcodeSet + { + get + { + return (this.valuesSet & opcodeSet) != 0; + } + } + + /// + /// Gets or sets the keywords to use for the specified event. If this + /// property is unset, the event's keywords will be 0. + /// + public EventKeywords Keywords + { + get + { + return this.keywords; + } + + set + { + this.keywords = value; + this.valuesSet |= keywordsSet; + } + } + + /// + /// Gets or sets the tags to use for the specified event. If this property is + /// unset, the event's tags will be 0. + /// + public EventTags Tags + { + get + { + return this.tags; + } + + set + { + this.tags = value; + this.valuesSet |= tagsSet; + } + } + + /// + /// Gets or sets the activity options for this specified events. If this property is + /// unset, the event's activity options will be 0. + /// + public EventActivityOptions ActivityOptions + { + get + { + return this.activityOptions; + } + set + { + this.activityOptions = value; + this.valuesSet |= activityOptionsSet; + } + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/FieldMetadata.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/FieldMetadata.cs new file mode 100644 index 0000000000..f84a1fd703 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/FieldMetadata.cs @@ -0,0 +1,232 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Resources; +using Encoding = System.Text.Encoding; + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Contains the information needed to generate tracelogging + /// metadata for an event field. + /// + internal class FieldMetadata + { + /// + /// Name of the field + /// + private readonly string name; + + /// + /// The number of bytes in the UTF8 Encoding of 'name' INCLUDING a null terminator. + /// + private readonly int nameSize; + private readonly EventFieldTags tags; + private readonly byte[] custom; + + /// + /// ETW supports fixed sized arrays. If inType has the InTypeFixedCountFlag then this is the + /// statically known count for the array. It is also used to encode the number of bytes of + /// custom meta-data if InTypeCustomCountFlag set. + /// + private readonly ushort fixedCount; + + private byte inType; + private byte outType; + + /// + /// Scalar or variable-length array. + /// + public FieldMetadata( + string name, + TraceLoggingDataType type, + EventFieldTags tags, + bool variableCount) + : this( + name, + type, + tags, + variableCount ? Statics.InTypeVariableCountFlag : (byte)0, + 0, + null) + { + return; + } + + /// + /// Fixed-length array. + /// + public FieldMetadata( + string name, + TraceLoggingDataType type, + EventFieldTags tags, + ushort fixedCount) + : this( + name, + type, + tags, + Statics.InTypeFixedCountFlag, + fixedCount, + null) + { + return; + } + + /// + /// Custom serializer + /// + public FieldMetadata( + string name, + TraceLoggingDataType type, + EventFieldTags tags, + byte[] custom) + : this( + name, + type, + tags, + Statics.InTypeCustomCountFlag, + checked((ushort)(custom == null ? 0 : custom.Length)), + custom) + { + return; + } + + private FieldMetadata( + string name, + TraceLoggingDataType dataType, + EventFieldTags tags, + byte countFlags, + ushort fixedCount = 0, + byte[] custom = null) + { + if (name == null) + { + throw new ArgumentNullException( + nameof(name), + "This usually means that the object passed to Write is of a type that" + + " does not support being used as the top-level object in an event," + + " e.g. a primitive or built-in type."); + } + + Statics.CheckName(name); + var coreType = (int)dataType & Statics.InTypeMask; + this.name = name; + this.nameSize = Encoding.UTF8.GetByteCount(this.name) + 1; + this.inType = (byte)(coreType | countFlags); + this.outType = (byte)(((int)dataType >> 8) & Statics.OutTypeMask); + this.tags = tags; + this.fixedCount = fixedCount; + this.custom = custom; + + if (countFlags != 0) + { + if (coreType == (int)TraceLoggingDataType.Nil) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfNil")); + } + if (coreType == (int)TraceLoggingDataType.Binary) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfBinary")); + } +#if !BROKEN_UNTIL_M3 + if (coreType == (int)TraceLoggingDataType.Utf16String || + coreType == (int)TraceLoggingDataType.MbcsString) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedArrayOfNullTerminatedString")); + } +#endif + } + + if (((int)this.tags & 0xfffffff) != 0) + { + this.outType |= Statics.OutTypeChainFlag; + } + + if (this.outType != 0) + { + this.inType |= Statics.InTypeChainFlag; + } + } + + public void IncrementStructFieldCount() + { + this.inType |= Statics.InTypeChainFlag; + this.outType++; + if ((this.outType & Statics.OutTypeMask) == 0) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_TooManyFields")); + } + } + + /// + /// This is the main routine for FieldMetaData. Basically it will serialize the data in + /// this structure as TraceLogging style meta-data into the array 'metaArray' starting at + /// 'pos' (pos is updated to reflect the bytes written). + /// + /// Note that 'metaData' can be null, in which case it only updates 'pos'. This is useful + /// for a 'two pass' approach where you figure out how big to make the array, and then you + /// fill it in. + /// + public void Encode(ref int pos, byte[] metadata) + { + // Write out the null terminated UTF8 encoded name + if (metadata != null) + { + Encoding.UTF8.GetBytes(this.name, 0, this.name.Length, metadata, pos); + } + pos += this.nameSize; + + // Write 1 byte for inType + if (metadata != null) + { + metadata[pos] = this.inType; + } + pos += 1; + + // If InTypeChainFlag set, then write out the outType + if (0 != (this.inType & Statics.InTypeChainFlag)) + { + if (metadata != null) + { + metadata[pos] = this.outType; + } + pos += 1; + + // If OutTypeChainFlag set, then write out tags + if (0 != (this.outType & Statics.OutTypeChainFlag)) + { + Statics.EncodeTags((int)this.tags, ref pos, metadata); + } + } + + // If InTypeFixedCountFlag set, write out the fixedCount (2 bytes little endian) + if (0 != (this.inType & Statics.InTypeFixedCountFlag)) + { + if (metadata != null) + { + metadata[pos + 0] = unchecked((byte)this.fixedCount); + metadata[pos + 1] = (byte)(this.fixedCount >> 8); + } + pos += 2; + + // If InTypeCustomCountFlag set, write out the blob of custom meta-data. + if (Statics.InTypeCustomCountFlag == (this.inType & Statics.InTypeCountMask) && + this.fixedCount != 0) + { + if (metadata != null) + { + Buffer.BlockCopy(this.custom, 0, metadata, pos, this.fixedCount); + } + pos += this.fixedCount; + } + } + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/InvokeTypeInfo.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/InvokeTypeInfo.cs new file mode 100644 index 0000000000..3e5997bc9b --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/InvokeTypeInfo.cs @@ -0,0 +1,96 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: An implementation of TraceLoggingTypeInfo that works + /// for arbitrary types. It writes all public instance properties of + /// the type. + /// + /// + /// Type from which to read values. + /// + internal sealed class InvokeTypeInfo : TraceLoggingTypeInfo + { + private readonly PropertyAnalysis[] properties; + + public InvokeTypeInfo( + Type type, + TypeAnalysis typeAnalysis) + : base( + type, + typeAnalysis.name, + typeAnalysis.level, + typeAnalysis.opcode, + typeAnalysis.keywords, + typeAnalysis.tags) + { + if (typeAnalysis.properties.Length != 0) + this.properties = typeAnalysis.properties; + } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + var groupCollector = collector.AddGroup(name); + if (this.properties != null) + { + foreach (var property in this.properties) + { + var propertyFormat = EventFieldFormat.Default; + var propertyAttribute = property.fieldAttribute; + if (propertyAttribute != null) + { + groupCollector.Tags = propertyAttribute.Tags; + propertyFormat = propertyAttribute.Format; + } + + property.typeInfo.WriteMetadata( + groupCollector, + property.name, + propertyFormat); + } + } + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + if (this.properties != null) + { + foreach (var property in this.properties) + { + property.typeInfo.WriteData(collector, property.getter(value)); + } + } + } + + public override object GetData(object value) + { + if (this.properties != null) + { + var membersNames = new List(); + var memebersValues = new List(); + for (int i = 0; i < this.properties.Length; i++) + { + var propertyValue = properties[i].propertyInfo.GetValue(value); + membersNames.Add(properties[i].name); + memebersValues.Add(properties[i].typeInfo.GetData(propertyValue)); + } + return new EventPayload(membersNames, memebersValues); + } + + return null; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/NameInfo.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/NameInfo.cs new file mode 100644 index 0000000000..668043ae68 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/NameInfo.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using Interlocked = System.Threading.Interlocked; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Stores the metadata and event identifier corresponding + /// to a tracelogging event type+name+tags combination. + /// + internal sealed class NameInfo + : ConcurrentSetItem, NameInfo> + { + /// + /// Insure that eventIds strictly less than 'eventId' will not be + /// used by the SelfDescribing events. + /// + internal static void ReserveEventIDsBelow(int eventId) + { + for(;;) + { + int snapshot = lastIdentity; + int newIdentity = (lastIdentity & ~0xFFFFFF) + eventId; + newIdentity = Math.Max(newIdentity, snapshot); // Should be redundant. as we only create descriptors once. + if (Interlocked.CompareExchange(ref lastIdentity, newIdentity, snapshot) == snapshot) + break; + } + } + + private static int lastIdentity = Statics.TraceLoggingChannel << 24; + internal readonly string name; + internal readonly EventTags tags; + internal readonly int identity; + internal readonly byte[] nameMetadata; + + public NameInfo(string name, EventTags tags, int typeMetadataSize) + { + this.name = name; + this.tags = tags & Statics.EventTagsMask; + this.identity = Interlocked.Increment(ref lastIdentity); + + int tagsPos = 0; + Statics.EncodeTags((int)this.tags, ref tagsPos, null); + + this.nameMetadata = Statics.MetadataForString(name, tagsPos, 0, typeMetadataSize); + + tagsPos = 2; + Statics.EncodeTags((int)this.tags, ref tagsPos, this.nameMetadata); + } + + public override int Compare(NameInfo other) + { + return this.Compare(other.name, other.tags); + } + + public override int Compare(KeyValuePair key) + { + return this.Compare(key.Key, key.Value & Statics.EventTagsMask); + } + + private int Compare(string otherName, EventTags otherTags) + { + int result = StringComparer.Ordinal.Compare(this.name, otherName); + if (result == 0 && this.tags != otherTags) + { + result = this.tags < otherTags ? -1 : 1; + } + return result; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/PropertyAnalysis.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/PropertyAnalysis.cs new file mode 100644 index 0000000000..1f07539b52 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/PropertyAnalysis.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Reflection; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: stores the per-property information obtained by + /// reflecting over a type. + /// + internal sealed class PropertyAnalysis + { + internal readonly string name; + internal readonly PropertyInfo propertyInfo; + internal readonly Func getter; + internal readonly TraceLoggingTypeInfo typeInfo; + internal readonly EventFieldAttribute fieldAttribute; + + public PropertyAnalysis( + string name, + PropertyInfo propertyInfo, + TraceLoggingTypeInfo typeInfo, + EventFieldAttribute fieldAttribute) + { + this.name = name; + this.propertyInfo = propertyInfo; + this.getter = PropertyValue.GetPropertyGetter(propertyInfo); + this.typeInfo = typeInfo; + this.fieldAttribute = fieldAttribute; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/PropertyValue.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/PropertyValue.cs new file mode 100644 index 0000000000..854bc06bb6 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/PropertyValue.cs @@ -0,0 +1,273 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Diagnostics; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Holds property values of any type. For common value types, we have inline storage so that we don't need + /// to box the values. For all other types, we store the value in a single object reference field. + /// + /// To get the value of a property quickly, use a delegate produced by . + /// +#if ES_BUILD_PN + [CLSCompliant(false)] + public +#else + internal +#endif + unsafe struct PropertyValue + { + /// + /// Union of well-known value types, to avoid boxing those types. + /// + [StructLayout(LayoutKind.Explicit)] + public struct Scalar + { + [FieldOffset(0)] + public Boolean AsBoolean; + [FieldOffset(0)] + public Byte AsByte; + [FieldOffset(0)] + public SByte AsSByte; + [FieldOffset(0)] + public Char AsChar; + [FieldOffset(0)] + public Int16 AsInt16; + [FieldOffset(0)] + public UInt16 AsUInt16; + [FieldOffset(0)] + public Int32 AsInt32; + [FieldOffset(0)] + public UInt32 AsUInt32; + [FieldOffset(0)] + public Int64 AsInt64; + [FieldOffset(0)] + public UInt64 AsUInt64; + [FieldOffset(0)] + public IntPtr AsIntPtr; + [FieldOffset(0)] + public UIntPtr AsUIntPtr; + [FieldOffset(0)] + public Single AsSingle; + [FieldOffset(0)] + public Double AsDouble; + [FieldOffset(0)] + public Guid AsGuid; + [FieldOffset(0)] + public DateTime AsDateTime; + [FieldOffset(0)] + public DateTimeOffset AsDateTimeOffset; + [FieldOffset(0)] + public TimeSpan AsTimeSpan; + [FieldOffset(0)] + public Decimal AsDecimal; + } + + // Anything not covered by the Scalar union gets stored in this reference. + readonly object _reference; + readonly Scalar _scalar; + readonly int _scalarLength; + + private PropertyValue(object value) + { + _reference = value; + _scalar = default(Scalar); + _scalarLength = 0; + } + + private PropertyValue(Scalar scalar, int scalarLength) + { + _reference = null; + _scalar = scalar; + _scalarLength = scalarLength; + } + + private PropertyValue(Boolean value) : this(new Scalar() { AsBoolean = value }, sizeof(Boolean)) { } + private PropertyValue(Byte value) : this(new Scalar() { AsByte = value }, sizeof(Byte)) { } + private PropertyValue(SByte value) : this(new Scalar() { AsSByte = value }, sizeof(SByte)) { } + private PropertyValue(Char value) : this(new Scalar() { AsChar = value }, sizeof(Char)) { } + private PropertyValue(Int16 value) : this(new Scalar() { AsInt16 = value }, sizeof(Int16)) { } + private PropertyValue(UInt16 value) : this(new Scalar() { AsUInt16 = value }, sizeof(UInt16)) { } + private PropertyValue(Int32 value) : this(new Scalar() { AsInt32 = value }, sizeof(Int32)) { } + private PropertyValue(UInt32 value) : this(new Scalar() { AsUInt32 = value }, sizeof(UInt32)) { } + private PropertyValue(Int64 value) : this(new Scalar() { AsInt64 = value }, sizeof(Int64)) { } + private PropertyValue(UInt64 value) : this(new Scalar() { AsUInt64 = value }, sizeof(UInt64)) { } + private PropertyValue(IntPtr value) : this(new Scalar() { AsIntPtr = value }, sizeof(IntPtr)) { } + private PropertyValue(UIntPtr value) : this(new Scalar() { AsUIntPtr = value }, sizeof(UIntPtr)) { } + private PropertyValue(Single value) : this(new Scalar() { AsSingle = value }, sizeof(Single)) { } + private PropertyValue(Double value) : this(new Scalar() { AsDouble = value }, sizeof(Double)) { } + private PropertyValue(Guid value) : this(new Scalar() { AsGuid = value }, sizeof(Guid)) { } + private PropertyValue(DateTime value) : this(new Scalar() { AsDateTime = value }, sizeof(DateTime)) { } + private PropertyValue(DateTimeOffset value) : this(new Scalar() { AsDateTimeOffset = value }, sizeof(DateTimeOffset)) { } + private PropertyValue(TimeSpan value) : this(new Scalar() { AsTimeSpan = value }, sizeof(TimeSpan)) { } + private PropertyValue(Decimal value) : this(new Scalar() { AsDecimal = value }, sizeof(Decimal)) { } + + public static Func GetFactory(Type type) + { + if (type == typeof(Boolean)) return value => new PropertyValue((Boolean)value); + if (type == typeof(Byte)) return value => new PropertyValue((Byte)value); + if (type == typeof(SByte)) return value => new PropertyValue((SByte)value); + if (type == typeof(Char)) return value => new PropertyValue((Char)value); + if (type == typeof(Int16)) return value => new PropertyValue((Int16)value); + if (type == typeof(UInt16)) return value => new PropertyValue((UInt16)value); + if (type == typeof(Int32)) return value => new PropertyValue((Int32)value); + if (type == typeof(UInt32)) return value => new PropertyValue((UInt32)value); + if (type == typeof(Int64)) return value => new PropertyValue((Int64)value); + if (type == typeof(UInt64)) return value => new PropertyValue((UInt64)value); + if (type == typeof(IntPtr)) return value => new PropertyValue((IntPtr)value); + if (type == typeof(UIntPtr)) return value => new PropertyValue((UIntPtr)value); + if (type == typeof(Single)) return value => new PropertyValue((Single)value); + if (type == typeof(Double)) return value => new PropertyValue((Double)value); + if (type == typeof(Guid)) return value => new PropertyValue((Guid)value); + if (type == typeof(DateTime)) return value => new PropertyValue((DateTime)value); + if (type == typeof(DateTimeOffset)) return value => new PropertyValue((DateTimeOffset)value); + if (type == typeof(TimeSpan)) return value => new PropertyValue((TimeSpan)value); + if (type == typeof(Decimal)) return value => new PropertyValue((Decimal)value); + + return value => new PropertyValue(value); + } + + + public object ReferenceValue + { + get + { + Debug.Assert(_scalarLength == 0, "This ReflectedValue refers to an unboxed value type, not a reference type or boxed value type."); + return _reference; + } + } + + public Scalar ScalarValue + { + get + { + Debug.Assert(_scalarLength > 0, "This ReflectedValue refers to a reference type or boxed value type, not an unboxed value type"); + return _scalar; + } + } + + public int ScalarLength + { + get + { + Debug.Assert(_scalarLength > 0, "This ReflectedValue refers to a reference type or boxed value type, not an unboxed value type"); + return _scalarLength; + } + } + + /// + /// Gets a delegate that gets the value of a given property. + /// + public static Func GetPropertyGetter(PropertyInfo property) + { + if (property.DeclaringType.GetTypeInfo().IsValueType) + return GetBoxedValueTypePropertyGetter(property); + else + return GetReferenceTypePropertyGetter(property); + } + + /// + /// Gets a delegate that gets the value of a property of a value type. We unfortunately cannot avoid boxing the value type, + /// without making this generic over the value type. That would result in a large number of generic instantiations, and furthermore + /// does not work correctly on .Net Native (we cannot express the needed instantiations in an rd.xml file). We expect that user-defined + /// value types will be rare, and in any case the boxing only happens for events that are actually enabled. + /// + private static Func GetBoxedValueTypePropertyGetter(PropertyInfo property) + { + var type = property.PropertyType; + + if (type.GetTypeInfo().IsEnum) + type = Enum.GetUnderlyingType(type); + + var factory = GetFactory(type); + + return container => factory(property.GetValue(container.ReferenceValue)); + } + + /// + /// For properties of reference types, we use a generic helper class to get the value. This enables us to use MethodInfo.CreateDelegate + /// to build a fast getter. We can get away with this on .Net Native, because we really only need one runtime instantiation of the + /// generic type, since it's only instantiated over reference types (and thus all instances are shared). + /// + /// + /// + private static Func GetReferenceTypePropertyGetter(PropertyInfo property) + { + var helper = (TypeHelper)Activator.CreateInstance(typeof(ReferenceTypeHelper<>).MakeGenericType(property.DeclaringType)); + return helper.GetPropertyGetter(property); + } + +#if ES_BUILD_PN + public +#else + private +#endif + abstract class TypeHelper + { + public abstract Func GetPropertyGetter(PropertyInfo property); + + protected Delegate GetGetMethod(PropertyInfo property, Type propertyType) + { + return property.GetMethod.CreateDelegate(typeof(Func<,>).MakeGenericType(property.DeclaringType, propertyType)); + } + } + +#if ES_BUILD_PN + public +#else + private +#endif + sealed class ReferenceTypeHelper : TypeHelper where TContainer : class + { + public override Func GetPropertyGetter(PropertyInfo property) + { + var type = property.PropertyType; + + if (!Statics.IsValueType(type)) + { + var getter = (Func)GetGetMethod(property, type); + return container => new PropertyValue(getter((TContainer)container.ReferenceValue)); + } + else + { + if (type.GetTypeInfo().IsEnum) + type = Enum.GetUnderlyingType(type); + + if (type == typeof(Boolean)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Byte)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(SByte)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Char)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Int16)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(UInt16)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Int32)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(UInt32)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Int64)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(UInt64)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(IntPtr)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(UIntPtr)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Single)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Double)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Guid)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(DateTime)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(DateTimeOffset)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(TimeSpan)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + if (type == typeof(Decimal)) { var f = (Func)GetGetMethod(property, type); return container => new PropertyValue(f((TContainer)container.ReferenceValue)); } + + return container => new PropertyValue(property.GetValue(container.ReferenceValue)); + } + } + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/SimpleEventTypes.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/SimpleEventTypes.cs new file mode 100644 index 0000000000..cdced968f0 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/SimpleEventTypes.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Interlocked = System.Threading.Interlocked; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Contains the metadata needed to emit an event, optimized + /// for events with one top-level compile-time-typed payload object. + /// + /// + /// Type of the top-level payload object. Should be EmptyStruct if the + /// event has no payload. + /// + internal static class SimpleEventTypes + { + private static TraceLoggingEventTypes instance; + + public static TraceLoggingEventTypes Instance + { + get { return instance ?? InitInstance(); } + } + + private static TraceLoggingEventTypes InitInstance() + { + var info = TraceLoggingTypeInfo.GetInstance(typeof(T), null); + var newInstance = new TraceLoggingEventTypes(info.Name, info.Tags, new TraceLoggingTypeInfo[] { info }); + Interlocked.CompareExchange(ref instance, newInstance, null); + return instance; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/SimpleTypeInfos.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/SimpleTypeInfos.cs new file mode 100644 index 0000000000..901a0ed1a2 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/SimpleTypeInfos.cs @@ -0,0 +1,297 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Diagnostics; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Type handler for empty or unsupported types. + /// + internal sealed class NullTypeInfo : TraceLoggingTypeInfo + { + public NullTypeInfo() : base(typeof(EmptyStruct)) { } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.AddGroup(name); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + return; + } + + public override object GetData(object value) + { + return null; + } + } + + /// + /// Type handler for simple scalar types. + /// + sealed class ScalarTypeInfo : TraceLoggingTypeInfo + { + Func formatFunc; + TraceLoggingDataType nativeFormat; + + private ScalarTypeInfo( + Type type, + Func formatFunc, + TraceLoggingDataType nativeFormat) + : base(type) + { + this.formatFunc = formatFunc; + this.nativeFormat = nativeFormat; + } + + public override void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format) + { + collector.AddScalar(name, formatFunc(format, nativeFormat)); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + collector.AddScalar(value); + } + + public static TraceLoggingTypeInfo Boolean() { return new ScalarTypeInfo(typeof(Boolean), Statics.Format8, TraceLoggingDataType.Boolean8); } + public static TraceLoggingTypeInfo Byte() { return new ScalarTypeInfo(typeof(Byte), Statics.Format8, TraceLoggingDataType.UInt8); } + public static TraceLoggingTypeInfo SByte() { return new ScalarTypeInfo(typeof(SByte), Statics.Format8, TraceLoggingDataType.Int8); } + public static TraceLoggingTypeInfo Char() { return new ScalarTypeInfo(typeof(Char), Statics.Format16, TraceLoggingDataType.Char16); } + public static TraceLoggingTypeInfo Int16() { return new ScalarTypeInfo(typeof(Int16), Statics.Format16, TraceLoggingDataType.Int16); } + public static TraceLoggingTypeInfo UInt16() { return new ScalarTypeInfo(typeof(UInt16), Statics.Format16, TraceLoggingDataType.UInt16); } + public static TraceLoggingTypeInfo Int32() { return new ScalarTypeInfo(typeof(Int32), Statics.Format32, TraceLoggingDataType.Int32); } + public static TraceLoggingTypeInfo UInt32() { return new ScalarTypeInfo(typeof(UInt32), Statics.Format32, TraceLoggingDataType.UInt32); } + public static TraceLoggingTypeInfo Int64() { return new ScalarTypeInfo(typeof(Int64), Statics.Format64, TraceLoggingDataType.Int64); } + public static TraceLoggingTypeInfo UInt64() { return new ScalarTypeInfo(typeof(UInt64), Statics.Format64, TraceLoggingDataType.UInt64); } + public static TraceLoggingTypeInfo IntPtr() { return new ScalarTypeInfo(typeof(IntPtr), Statics.FormatPtr, Statics.IntPtrType); } + public static TraceLoggingTypeInfo UIntPtr() { return new ScalarTypeInfo(typeof(UIntPtr), Statics.FormatPtr, Statics.UIntPtrType); } + public static TraceLoggingTypeInfo Single() { return new ScalarTypeInfo(typeof(Single), Statics.Format32, TraceLoggingDataType.Float); } + public static TraceLoggingTypeInfo Double() { return new ScalarTypeInfo(typeof(Double), Statics.Format64, TraceLoggingDataType.Double); } + public static TraceLoggingTypeInfo Guid() { return new ScalarTypeInfo(typeof(Guid), (f, t) => Statics.MakeDataType(TraceLoggingDataType.Guid, f), TraceLoggingDataType.Guid); } + } + + + /// + /// Type handler for arrays of scalars + /// + internal sealed class ScalarArrayTypeInfo : TraceLoggingTypeInfo + { + Func formatFunc; + TraceLoggingDataType nativeFormat; + int elementSize; + + private ScalarArrayTypeInfo( + Type type, + Func formatFunc, + TraceLoggingDataType nativeFormat, + int elementSize) + : base(type) + { + this.formatFunc = formatFunc; + this.nativeFormat = nativeFormat; + this.elementSize = elementSize; + } + + public override void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format) + { + collector.AddArray(name, formatFunc(format, nativeFormat)); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + collector.AddArray(value, elementSize); + } + + public static TraceLoggingTypeInfo Boolean() { return new ScalarArrayTypeInfo(typeof(Boolean[]), Statics.Format8, TraceLoggingDataType.Boolean8, sizeof(Boolean)); } + public static TraceLoggingTypeInfo Byte() { return new ScalarArrayTypeInfo(typeof(Byte[]), Statics.Format8, TraceLoggingDataType.UInt8, sizeof(Byte)); } + public static TraceLoggingTypeInfo SByte() { return new ScalarArrayTypeInfo(typeof(SByte[]), Statics.Format8, TraceLoggingDataType.Int8, sizeof(SByte)); } + public static TraceLoggingTypeInfo Char() { return new ScalarArrayTypeInfo(typeof(Char[]), Statics.Format16, TraceLoggingDataType.Char16, sizeof(Char)); } + public static TraceLoggingTypeInfo Int16() { return new ScalarArrayTypeInfo(typeof(Int16[]), Statics.Format16, TraceLoggingDataType.Int16, sizeof(Int16)); } + public static TraceLoggingTypeInfo UInt16() { return new ScalarArrayTypeInfo(typeof(UInt16[]), Statics.Format16, TraceLoggingDataType.UInt16, sizeof(UInt16)); } + public static TraceLoggingTypeInfo Int32() { return new ScalarArrayTypeInfo(typeof(Int32[]), Statics.Format32, TraceLoggingDataType.Int32, sizeof(Int32)); } + public static TraceLoggingTypeInfo UInt32() { return new ScalarArrayTypeInfo(typeof(UInt32[]), Statics.Format32, TraceLoggingDataType.UInt32, sizeof(UInt32)); } + public static TraceLoggingTypeInfo Int64() { return new ScalarArrayTypeInfo(typeof(Int64[]), Statics.Format64, TraceLoggingDataType.Int64, sizeof(Int64)); } + public static TraceLoggingTypeInfo UInt64() { return new ScalarArrayTypeInfo(typeof(UInt64[]), Statics.Format64, TraceLoggingDataType.UInt64, sizeof(UInt64)); } + public static TraceLoggingTypeInfo IntPtr() { return new ScalarArrayTypeInfo(typeof(IntPtr[]), Statics.FormatPtr, Statics.IntPtrType, System.IntPtr.Size); } + public static TraceLoggingTypeInfo UIntPtr() { return new ScalarArrayTypeInfo(typeof(UIntPtr[]), Statics.FormatPtr, Statics.UIntPtrType, System.IntPtr.Size); } + public static TraceLoggingTypeInfo Single() { return new ScalarArrayTypeInfo(typeof(Single[]), Statics.Format32, TraceLoggingDataType.Float, sizeof(Single)); } + public static TraceLoggingTypeInfo Double() { return new ScalarArrayTypeInfo(typeof(Double[]), Statics.Format64, TraceLoggingDataType.Double, sizeof(Double)); } + public unsafe static TraceLoggingTypeInfo Guid() { return new ScalarArrayTypeInfo(typeof(Guid), (f, t) => Statics.MakeDataType(TraceLoggingDataType.Guid, f), TraceLoggingDataType.Guid, sizeof(Guid)); } + } + + /// + /// TraceLogging: Type handler for String. + /// + internal sealed class StringTypeInfo : TraceLoggingTypeInfo + { + public StringTypeInfo() : base(typeof(string)) { } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.AddBinary(name, Statics.MakeDataType(TraceLoggingDataType.CountedUtf16String, format)); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + collector.AddBinary((string)value.ReferenceValue); + } + + public override object GetData(object value) + { + if(value == null) + { + return ""; + } + + return value; + } + } + + /// + /// TraceLogging: Type handler for DateTime. + /// + internal sealed class DateTimeTypeInfo : TraceLoggingTypeInfo + { + public DateTimeTypeInfo() : base(typeof(DateTime)) { } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.AddScalar(name, Statics.MakeDataType(TraceLoggingDataType.FileTime, format)); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + var ticks = value.ScalarValue.AsDateTime.Ticks; + collector.AddScalar(ticks < 504911232000000000 ? 0 : ticks - 504911232000000000); + } + } + + /// + /// TraceLogging: Type handler for DateTimeOffset. + /// + internal sealed class DateTimeOffsetTypeInfo : TraceLoggingTypeInfo + { + public DateTimeOffsetTypeInfo() : base(typeof(DateTimeOffset)) { } + + public override void WriteMetadata(TraceLoggingMetadataCollector collector, string name, EventFieldFormat format) + { + var group = collector.AddGroup(name); + group.AddScalar("Ticks", Statics.MakeDataType(TraceLoggingDataType.FileTime, format)); + group.AddScalar("Offset", TraceLoggingDataType.Int64); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + var dateTimeOffset = value.ScalarValue.AsDateTimeOffset; + var ticks = dateTimeOffset.Ticks; + collector.AddScalar(ticks < 504911232000000000 ? 0 : ticks - 504911232000000000); + collector.AddScalar(dateTimeOffset.Offset.Ticks); + } + } + + /// + /// TraceLogging: Type handler for TimeSpan. + /// + internal sealed class TimeSpanTypeInfo : TraceLoggingTypeInfo + { + public TimeSpanTypeInfo() : base(typeof(TimeSpan)) { } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.AddScalar(name, Statics.MakeDataType(TraceLoggingDataType.Int64, format)); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + collector.AddScalar(value.ScalarValue.AsTimeSpan.Ticks); + } + } + + /// + /// TraceLogging: Type handler for Decimal. (Note: not full-fidelity, exposed as Double.) + /// + internal sealed class DecimalTypeInfo : TraceLoggingTypeInfo + { + public DecimalTypeInfo() : base(typeof(Decimal)) { } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + collector.AddScalar(name, Statics.MakeDataType(TraceLoggingDataType.Double, format)); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + collector.AddScalar((double)value.ScalarValue.AsDecimal); + } + } + + /// + /// TraceLogging: Type handler for Nullable. + /// + internal sealed class NullableTypeInfo : TraceLoggingTypeInfo + { + private readonly TraceLoggingTypeInfo valueInfo; + private readonly Func hasValueGetter; + private readonly Func valueGetter; + + public NullableTypeInfo(Type type, List recursionCheck) + : base(type) + { + var typeArgs = type.GenericTypeArguments; + Debug.Assert(typeArgs.Length == 1); + this.valueInfo = TraceLoggingTypeInfo.GetInstance(typeArgs[0], recursionCheck); + this.hasValueGetter = PropertyValue.GetPropertyGetter(type.GetTypeInfo().GetDeclaredProperty("HasValue")); + this.valueGetter = PropertyValue.GetPropertyGetter(type.GetTypeInfo().GetDeclaredProperty("Value")); + } + + public override void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format) + { + var group = collector.AddGroup(name); + group.AddScalar("HasValue", TraceLoggingDataType.Boolean8); + this.valueInfo.WriteMetadata(group, "Value", format); + } + + public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value) + { + var hasValue = hasValueGetter(value); + collector.AddScalar(hasValue); + var val = hasValue.ScalarValue.AsBoolean ? valueGetter(value) : valueInfo.PropertyValueFactory(Activator.CreateInstance(valueInfo.DataType)); + this.valueInfo.WriteData(collector, val); + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/Statics.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/Statics.cs new file mode 100644 index 0000000000..d95e316768 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/Statics.cs @@ -0,0 +1,728 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using Encoding = System.Text.Encoding; + +using Microsoft.Reflection; + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Constants and utility functions. + /// + internal static class Statics + { + #region Constants + + public const byte DefaultLevel = 5; + public const byte TraceLoggingChannel = 0xb; + public const byte InTypeMask = 31; + public const byte InTypeFixedCountFlag = 32; + public const byte InTypeVariableCountFlag = 64; + public const byte InTypeCustomCountFlag = 96; + public const byte InTypeCountMask = 96; + public const byte InTypeChainFlag = 128; + public const byte OutTypeMask = 127; + public const byte OutTypeChainFlag = 128; + public const EventTags EventTagsMask = (EventTags)0xfffffff; + + public static readonly TraceLoggingDataType IntPtrType = IntPtr.Size == 8 + ? TraceLoggingDataType.Int64 + : TraceLoggingDataType.Int32; + public static readonly TraceLoggingDataType UIntPtrType = IntPtr.Size == 8 + ? TraceLoggingDataType.UInt64 + : TraceLoggingDataType.UInt32; + public static readonly TraceLoggingDataType HexIntPtrType = IntPtr.Size == 8 + ? TraceLoggingDataType.HexInt64 + : TraceLoggingDataType.HexInt32; + + #endregion + + #region Metadata helpers + + /// + /// A complete metadata chunk can be expressed as: + /// length16 + prefix + null-terminated-utf8-name + suffix + additionalData. + /// We assume that excludedData will be provided by some other means, + /// but that its size is known. This function returns a blob containing + /// length16 + prefix + name + suffix, with prefix and suffix initialized + /// to 0's. The length16 value is initialized to the length of the returned + /// blob plus additionalSize, so that the concatenation of the returned blob + /// plus a blob of size additionalSize constitutes a valid metadata blob. + /// + /// + /// The name to include in the blob. + /// + /// + /// Amount of space to reserve before name. For provider or field blobs, this + /// should be 0. For event blobs, this is used for the tags field and will vary + /// from 1 to 4, depending on how large the tags field needs to be. + /// + /// + /// Amount of space to reserve after name. For example, a provider blob with no + /// traits would reserve 0 extra bytes, but a provider blob with a single GroupId + /// field would reserve 19 extra bytes. + /// + /// + /// Amount of additional data in another blob. This value will be counted in the + /// blob's length field, but will not be included in the returned byte[] object. + /// The complete blob would then be the concatenation of the returned byte[] object + /// with another byte[] object of length additionalSize. + /// + /// + /// A byte[] object with the length and name fields set, with room reserved for + /// prefix and suffix. If additionalSize was 0, the byte[] object is a complete + /// blob. Otherwise, another byte[] of size additionalSize must be concatenated + /// with this one to form a complete blob. + /// + public static byte[] MetadataForString( + string name, + int prefixSize, + int suffixSize, + int additionalSize) + { + Statics.CheckName(name); + int metadataSize = Encoding.UTF8.GetByteCount(name) + 3 + prefixSize + suffixSize; + var metadata = new byte[metadataSize]; + ushort totalSize = checked((ushort)(metadataSize + additionalSize)); + metadata[0] = unchecked((byte)totalSize); + metadata[1] = unchecked((byte)(totalSize >> 8)); + Encoding.UTF8.GetBytes(name, 0, name.Length, metadata, 2 + prefixSize); + return metadata; + } + + /// + /// Serialize the low 28 bits of the tags value into the metadata stream, + /// starting at the index given by pos. Updates pos. Writes 1 to 4 bytes, + /// depending on the value of the tags variable. Usable for event tags and + /// field tags. + /// + /// Note that 'metadata' can be null, in which case it only updates 'pos'. + /// This is useful for a two pass approach where you figure out how big to + /// make the array, and then you fill it in. + /// + public static void EncodeTags(int tags, ref int pos, byte[] metadata) + { + // We transmit the low 28 bits of tags, high bits first, 7 bits at a time. + var tagsLeft = tags & 0xfffffff; + bool more; + do + { + byte current = (byte)((tagsLeft >> 21) & 0x7f); + more = (tagsLeft & 0x1fffff) != 0; + current |= (byte)(more ? 0x80 : 0x00); + tagsLeft = tagsLeft << 7; + + if (metadata != null) + { + metadata[pos] = current; + } + pos += 1; + } + while (more); + } + + public static byte Combine( + int settingValue, + byte defaultValue) + { + unchecked + { + return (byte)settingValue == settingValue + ? (byte)settingValue + : defaultValue; + } + } + + public static byte Combine( + int settingValue1, + int settingValue2, + byte defaultValue) + { + unchecked + { + return (byte)settingValue1 == settingValue1 + ? (byte)settingValue1 + : (byte)settingValue2 == settingValue2 + ? (byte)settingValue2 + : defaultValue; + } + } + + public static int Combine( + int settingValue1, + int settingValue2) + { + unchecked + { + return (byte)settingValue1 == settingValue1 + ? settingValue1 + : settingValue2; + } + } + + public static void CheckName(string name) + { + if (name != null && 0 <= name.IndexOf('\0')) + { + throw new ArgumentOutOfRangeException(nameof(name)); + } + } + + public static bool ShouldOverrideFieldName(string fieldName) + { + return (fieldName.Length <= 2 && fieldName[0] == '_'); + } + + public static TraceLoggingDataType MakeDataType( + TraceLoggingDataType baseType, + EventFieldFormat format) + { + return (TraceLoggingDataType)(((int)baseType & 0x1f) | ((int)format << 8)); + } + + /// + /// Adjusts the native type based on format. + /// - If format is default, return native. + /// - If format is recognized, return the canonical type for that format. + /// - Otherwise remove existing format from native and apply the requested format. + /// + public static TraceLoggingDataType Format8( + EventFieldFormat format, + TraceLoggingDataType native) + { + switch (format) + { + case EventFieldFormat.Default: + return native; + case EventFieldFormat.String: + return TraceLoggingDataType.Char8; + case EventFieldFormat.Boolean: + return TraceLoggingDataType.Boolean8; + case EventFieldFormat.Hexadecimal: + return TraceLoggingDataType.HexInt8; +#if false + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int8; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt8; +#endif + default: + return MakeDataType(native, format); + } + } + + /// + /// Adjusts the native type based on format. + /// - If format is default, return native. + /// - If format is recognized, return the canonical type for that format. + /// - Otherwise remove existing format from native and apply the requested format. + /// + public static TraceLoggingDataType Format16( + EventFieldFormat format, + TraceLoggingDataType native) + { + switch (format) + { + case EventFieldFormat.Default: + return native; + case EventFieldFormat.String: + return TraceLoggingDataType.Char16; + case EventFieldFormat.Hexadecimal: + return TraceLoggingDataType.HexInt16; +#if false + case EventSourceFieldFormat.Port: + return TraceLoggingDataType.Port; + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int16; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt16; +#endif + default: + return MakeDataType(native, format); + } + } + + /// + /// Adjusts the native type based on format. + /// - If format is default, return native. + /// - If format is recognized, return the canonical type for that format. + /// - Otherwise remove existing format from native and apply the requested format. + /// + public static TraceLoggingDataType Format32( + EventFieldFormat format, + TraceLoggingDataType native) + { + switch (format) + { + case EventFieldFormat.Default: + return native; + case EventFieldFormat.Boolean: + return TraceLoggingDataType.Boolean32; + case EventFieldFormat.Hexadecimal: + return TraceLoggingDataType.HexInt32; +#if false + case EventSourceFieldFormat.Ipv4Address: + return TraceLoggingDataType.Ipv4Address; + case EventSourceFieldFormat.ProcessId: + return TraceLoggingDataType.ProcessId; + case EventSourceFieldFormat.ThreadId: + return TraceLoggingDataType.ThreadId; + case EventSourceFieldFormat.Win32Error: + return TraceLoggingDataType.Win32Error; + case EventSourceFieldFormat.NTStatus: + return TraceLoggingDataType.NTStatus; +#endif + case EventFieldFormat.HResult: + return TraceLoggingDataType.HResult; +#if false + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int32; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt32; +#endif + default: + return MakeDataType(native, format); + } + } + + /// + /// Adjusts the native type based on format. + /// - If format is default, return native. + /// - If format is recognized, return the canonical type for that format. + /// - Otherwise remove existing format from native and apply the requested format. + /// + public static TraceLoggingDataType Format64( + EventFieldFormat format, + TraceLoggingDataType native) + { + switch (format) + { + case EventFieldFormat.Default: + return native; + case EventFieldFormat.Hexadecimal: + return TraceLoggingDataType.HexInt64; +#if false + case EventSourceFieldFormat.FileTime: + return TraceLoggingDataType.FileTime; + case EventSourceFieldFormat.Signed: + return TraceLoggingDataType.Int64; + case EventSourceFieldFormat.Unsigned: + return TraceLoggingDataType.UInt64; +#endif + default: + return MakeDataType(native, format); + } + } + + /// + /// Adjusts the native type based on format. + /// - If format is default, return native. + /// - If format is recognized, return the canonical type for that format. + /// - Otherwise remove existing format from native and apply the requested format. + /// + public static TraceLoggingDataType FormatPtr( + EventFieldFormat format, + TraceLoggingDataType native) + { + switch (format) + { + case EventFieldFormat.Default: + return native; + case EventFieldFormat.Hexadecimal: + return HexIntPtrType; +#if false + case EventSourceFieldFormat.Signed: + return IntPtrType; + case EventSourceFieldFormat.Unsigned: + return UIntPtrType; +#endif + default: + return MakeDataType(native, format); + } + } + + #endregion + + #region Reflection helpers + + /* + All TraceLogging use of reflection APIs should go through wrappers here. + This helps with portability, and it also makes it easier to audit what + kinds of reflection operations are being done. + */ + + public static object CreateInstance(Type type, params object[] parameters) + { + return Activator.CreateInstance(type, parameters); + } + + public static bool IsValueType(Type type) + { + bool result = type.IsValueType(); + return result; + } + + public static bool IsEnum(Type type) + { + bool result = type.IsEnum(); + return result; + } + + public static IEnumerable GetProperties(Type type) + { + IEnumerable result = type.GetProperties(); + return result; + } + + public static MethodInfo GetGetMethod(PropertyInfo propInfo) + { + MethodInfo result = propInfo.GetGetMethod(); + return result; + } + + public static MethodInfo GetDeclaredStaticMethod(Type declaringType, string name) + { + MethodInfo result; +#if (ES_BUILD_PCL || ES_BUILD_PN) + result = declaringType.GetTypeInfo().GetDeclaredMethod(name); +#else + result = declaringType.GetMethod( + name, + BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.NonPublic); +#endif + return result; + } + + public static bool HasCustomAttribute( + PropertyInfo propInfo, + Type attributeType) + { + bool result; +#if (ES_BUILD_PCL || ES_BUILD_PN) + result = propInfo.IsDefined(attributeType); +#else + var attributes = propInfo.GetCustomAttributes( + attributeType, + false); + result = attributes.Length != 0; +#endif + return result; + } + + public static AttributeType GetCustomAttribute(PropertyInfo propInfo) + where AttributeType : Attribute + { + AttributeType result = null; +#if (ES_BUILD_PCL || ES_BUILD_PN) + foreach (var attrib in propInfo.GetCustomAttributes(false)) + { + result = attrib; + break; + } +#else + var attributes = propInfo.GetCustomAttributes(typeof(AttributeType), false); + if (attributes.Length != 0) + { + result = (AttributeType)attributes[0]; + } +#endif + return result; + } + + public static AttributeType GetCustomAttribute(Type type) + where AttributeType : Attribute + { + AttributeType result = null; +#if (ES_BUILD_PCL || ES_BUILD_PN) + foreach (var attrib in type.GetTypeInfo().GetCustomAttributes(false)) + { + result = attrib; + break; + } +#else + var attributes = type.GetCustomAttributes(typeof(AttributeType), false); + if (attributes.Length != 0) + { + result = (AttributeType)attributes[0]; + } +#endif + return result; + } + + public static Type[] GetGenericArguments(Type type) + { + return type.GetGenericArguments(); + } + + public static Type FindEnumerableElementType(Type type) + { + Type elementType = null; + + if (IsGenericMatch(type, typeof(IEnumerable<>))) + { + elementType = GetGenericArguments(type)[0]; + } + else + { +#if (ES_BUILD_PCL || ES_BUILD_PN) + var ifaceTypes = type.GetTypeInfo().ImplementedInterfaces; +#else + var ifaceTypes = type.FindInterfaces(IsGenericMatch, typeof(IEnumerable<>)); +#endif + + foreach (var ifaceType in ifaceTypes) + { +#if (ES_BUILD_PCL || ES_BUILD_PN) + if (!IsGenericMatch(ifaceType, typeof(IEnumerable<>))) + { + continue; + } +#endif + + if (elementType != null) + { + // ambiguous match. report no match at all. + elementType = null; + break; + } + + elementType = GetGenericArguments(ifaceType)[0]; + } + } + + return elementType; + } + + public static bool IsGenericMatch(Type type, object openType) + { + return type.IsGenericType() && type.GetGenericTypeDefinition() == (Type)openType; + } + + public static Delegate CreateDelegate(Type delegateType, MethodInfo methodInfo) + { + Delegate result; +#if (ES_BUILD_PCL || ES_BUILD_PN) + result = methodInfo.CreateDelegate( + delegateType); +#else + result = Delegate.CreateDelegate( + delegateType, + methodInfo); +#endif + return result; + } + + public static TraceLoggingTypeInfo CreateDefaultTypeInfo( + Type dataType, + List recursionCheck) + { + TraceLoggingTypeInfo result; + + if (recursionCheck.Contains(dataType)) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_RecursiveTypeDefinition")); + } + + recursionCheck.Add(dataType); + + var eventAttrib = Statics.GetCustomAttribute(dataType); + if (eventAttrib != null || + Statics.GetCustomAttribute(dataType) != null || + IsGenericMatch(dataType, typeof(KeyValuePair<,>))) + { + var analysis = new TypeAnalysis(dataType, eventAttrib, recursionCheck); + result = new InvokeTypeInfo(dataType, analysis); + } + else if (dataType.IsArray) + { + var elementType = dataType.GetElementType(); + if (elementType == typeof(Boolean)) + { + result = ScalarArrayTypeInfo.Boolean(); + } + else if (elementType == typeof(Byte)) + { + result = ScalarArrayTypeInfo.Byte(); + } + else if (elementType == typeof(SByte)) + { + result = ScalarArrayTypeInfo.SByte(); + } + else if (elementType == typeof(Int16)) + { + result = ScalarArrayTypeInfo.Int16(); + } + else if (elementType == typeof(UInt16)) + { + result = ScalarArrayTypeInfo.UInt16(); + } + else if (elementType == typeof(Int32)) + { + result = ScalarArrayTypeInfo.Int32(); + } + else if (elementType == typeof(UInt32)) + { + result = ScalarArrayTypeInfo.UInt32(); + } + else if (elementType == typeof(Int64)) + { + result = ScalarArrayTypeInfo.Int64(); + } + else if (elementType == typeof(UInt64)) + { + result = ScalarArrayTypeInfo.UInt64(); + } + else if (elementType == typeof(Char)) + { + result = ScalarArrayTypeInfo.Char(); + } + else if (elementType == typeof(Double)) + { + result = ScalarArrayTypeInfo.Double(); + } + else if (elementType == typeof(Single)) + { + result = ScalarArrayTypeInfo.Single(); + } + else if (elementType == typeof(IntPtr)) + { + result = ScalarArrayTypeInfo.IntPtr(); + } + else if (elementType == typeof(UIntPtr)) + { + result = ScalarArrayTypeInfo.UIntPtr(); + } + else if (elementType == typeof(Guid)) + { + result = ScalarArrayTypeInfo.Guid(); + } + else + { + result = new ArrayTypeInfo(dataType, TraceLoggingTypeInfo.GetInstance(elementType, recursionCheck)); + } + } + else + { + if (Statics.IsEnum(dataType)) + dataType = Enum.GetUnderlyingType(dataType); + + if (dataType == typeof(String)) + { + result = new StringTypeInfo(); + } + else if (dataType == typeof(Boolean)) + { + result = ScalarTypeInfo.Boolean(); + } + else if (dataType == typeof(Byte)) + { + result = ScalarTypeInfo.Byte(); + } + else if (dataType == typeof(SByte)) + { + result = ScalarTypeInfo.SByte(); + } + else if (dataType == typeof(Int16)) + { + result = ScalarTypeInfo.Int16(); + } + else if (dataType == typeof(UInt16)) + { + result = ScalarTypeInfo.UInt16(); + } + else if (dataType == typeof(Int32)) + { + result = ScalarTypeInfo.Int32(); + } + else if (dataType == typeof(UInt32)) + { + result = ScalarTypeInfo.UInt32(); + } + else if (dataType == typeof(Int64)) + { + result = ScalarTypeInfo.Int64(); + } + else if (dataType == typeof(UInt64)) + { + result = ScalarTypeInfo.UInt64(); + } + else if (dataType == typeof(Char)) + { + result = ScalarTypeInfo.Char(); + } + else if (dataType == typeof(Double)) + { + result = ScalarTypeInfo.Double(); + } + else if (dataType == typeof(Single)) + { + result = ScalarTypeInfo.Single(); + } + else if (dataType == typeof(DateTime)) + { + result = new DateTimeTypeInfo(); + } + else if (dataType == typeof(Decimal)) + { + result = new DecimalTypeInfo(); + } + else if (dataType == typeof(IntPtr)) + { + result = ScalarTypeInfo.IntPtr(); + } + else if (dataType == typeof(UIntPtr)) + { + result = ScalarTypeInfo.UIntPtr(); + } + else if (dataType == typeof(Guid)) + { + result = ScalarTypeInfo.Guid(); + } + else if (dataType == typeof(TimeSpan)) + { + result = new TimeSpanTypeInfo(); + } + else if (dataType == typeof(DateTimeOffset)) + { + result = new DateTimeOffsetTypeInfo(); + } + else if (dataType == typeof(EmptyStruct)) + { + result = new NullTypeInfo(); + } + else if (IsGenericMatch(dataType, typeof(Nullable<>))) + { + result = new NullableTypeInfo(dataType, recursionCheck); + } + else + { + var elementType = FindEnumerableElementType(dataType); + if (elementType != null) + { + result = new EnumerableTypeInfo(dataType, TraceLoggingTypeInfo.GetInstance(elementType, recursionCheck)); + } + else + { + throw new ArgumentException(Resources.GetResourceString("EventSource_NonCompliantTypeError", dataType.Name)); + } + } + } + + return result; + } + + #endregion + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingDataCollector.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingDataCollector.cs new file mode 100644 index 0000000000..04a047fb35 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingDataCollector.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Security; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Used when implementing a custom TraceLoggingTypeInfo. + /// The instance of this type is provided to the TypeInfo.WriteData method. + /// All operations are forwarded to the current thread's DataCollector. + /// Note that this abstraction would allow us to expose the custom + /// serialization system to partially-trusted code. If we end up not + /// making custom serialization public, or if we only expose it to + /// full-trust code, this abstraction is unnecessary (though it probably + /// doesn't hurt anything). + /// + internal unsafe class TraceLoggingDataCollector + { + internal static readonly TraceLoggingDataCollector Instance = new TraceLoggingDataCollector(); + + private TraceLoggingDataCollector() + { + return; + } + + /// + /// Marks the start of a non-blittable array or enumerable. + /// + /// Bookmark to be passed to EndBufferedArray. + public int BeginBufferedArray() + { + return DataCollector.ThreadInstance.BeginBufferedArray(); + } + + /// + /// Marks the end of a non-blittable array or enumerable. + /// + /// The value returned by BeginBufferedArray. + /// The number of items in the array. + public void EndBufferedArray(int bookmark, int count) + { + DataCollector.ThreadInstance.EndBufferedArray(bookmark, count); + } + + /// + /// Adds the start of a group to the event. + /// This has no effect on the event payload, but is provided to allow + /// WriteMetadata and WriteData implementations to have similar + /// sequences of calls, allowing for easier verification of correctness. + /// + public TraceLoggingDataCollector AddGroup() + { + return this; + } + + public void AddScalar(PropertyValue value) + { + var scalar = value.ScalarValue; + DataCollector.ThreadInstance.AddScalar(&scalar, value.ScalarLength); + } + + /// + /// Adds an Int64 value to the event payload. + /// + /// Value to be added. + public void AddScalar(long value) + { + DataCollector.ThreadInstance.AddScalar(&value, sizeof(long)); + } + + /// + /// Adds a Double value to the event payload. + /// + /// Value to be added. + public void AddScalar(double value) + { + DataCollector.ThreadInstance.AddScalar(&value, sizeof(double)); + } + + /// + /// Adds a counted String value to the event payload. + /// + /// + /// Value to be added. A null value is treated as a zero-length string. + /// + public void AddBinary(string value) + { + DataCollector.ThreadInstance.AddBinary(value, value == null ? 0 : value.Length * 2); + } + + public void AddArray(PropertyValue value, int elementSize) + { + Array array = (Array)value.ReferenceValue; + DataCollector.ThreadInstance.AddArray(array, array == null ? 0 : array.Length, elementSize); + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingDataType.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingDataType.cs new file mode 100644 index 0000000000..cc416a96d9 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingDataType.cs @@ -0,0 +1,349 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Used when implementing a custom TraceLoggingTypeInfo. + /// These are passed to metadataCollector.Add to specify the low-level + /// type of a field in the event payload. Note that a "formatted" + /// TraceLoggingDataType consists of a core TraceLoggingDataType value + /// (a TraceLoggingDataType with a value less than 32) plus an OutType. + /// Any combination of TraceLoggingDataType + OutType is valid, but not + /// all are useful. In particular, combinations not explicitly listed + /// below are unlikely to be recognized by decoders, and will typically + /// be decoded as the corresponding core type (i.e. the decoder will + /// mask off any unrecognized OutType value). + /// + internal enum TraceLoggingDataType + { + /// + /// Core type. + /// Data type with no value (0-length payload). + /// NOTE: arrays of Nil are illegal. + /// NOTE: a fixed-length array of Nil is interpreted by the decoder as + /// a struct (obsolete but retained for backwards-compatibility). + /// + Nil = 0, + + /// + /// Core type. + /// Encoding assumes null-terminated Char16 string. + /// Decoding treats as UTF-16LE string. + /// + Utf16String = 1, + + /// + /// Core type. + /// Encoding assumes null-terminated Char8 string. + /// Decoding treats as MBCS string. + /// + MbcsString = 2, + + /// + /// Core type. + /// Encoding assumes 8-bit value. + /// Decoding treats as signed integer. + /// + Int8 = 3, + + /// + /// Core type. + /// Encoding assumes 8-bit value. + /// Decoding treats as unsigned integer. + /// + UInt8 = 4, + + /// + /// Core type. + /// Encoding assumes 16-bit value. + /// Decoding treats as signed integer. + /// + Int16 = 5, + + /// + /// Core type. + /// Encoding assumes 16-bit value. + /// Decoding treats as unsigned integer. + /// + UInt16 = 6, + + /// + /// Core type. + /// Encoding assumes 32-bit value. + /// Decoding treats as signed integer. + /// + Int32 = 7, + + /// + /// Core type. + /// Encoding assumes 32-bit value. + /// Decoding treats as unsigned integer. + /// + UInt32 = 8, + + /// + /// Core type. + /// Encoding assumes 64-bit value. + /// Decoding treats as signed integer. + /// + Int64 = 9, + + /// + /// Core type. + /// Encoding assumes 64-bit value. + /// Decoding treats as unsigned integer. + /// + UInt64 = 10, + + /// + /// Core type. + /// Encoding assumes 32-bit value. + /// Decoding treats as Float. + /// + Float = 11, + + /// + /// Core type. + /// Encoding assumes 64-bit value. + /// Decoding treats as Double. + /// + Double = 12, + + /// + /// Core type. + /// Encoding assumes 32-bit value. + /// Decoding treats as Boolean. + /// + Boolean32 = 13, + + /// + /// Core type. + /// Encoding assumes 16-bit bytecount followed by binary data. + /// Decoding treats as binary data. + /// + Binary = 14, + + /// + /// Core type. + /// Encoding assumes 16-byte value. + /// Decoding treats as GUID. + /// + Guid = 15, + + /// + /// Core type. + /// Encoding assumes 64-bit value. + /// Decoding treats as FILETIME. + /// + FileTime = 17, + + /// + /// Core type. + /// Encoding assumes 16-byte value. + /// Decoding treats as SYSTEMTIME. + /// + SystemTime = 18, + + /// + /// Core type. + /// Encoding assumes 32-bit value. + /// Decoding treats as hexadecimal unsigned integer. + /// + HexInt32 = 20, + + /// + /// Core type. + /// Encoding assumes 64-bit value. + /// Decoding treats as hexadecimal unsigned integer. + /// + HexInt64 = 21, + + /// + /// Core type. + /// Encoding assumes 16-bit bytecount followed by Char16 data. + /// Decoding treats as UTF-16LE string. + /// + CountedUtf16String = 22, + + /// + /// Core type. + /// Encoding assumes 16-bit bytecount followed by Char8 data. + /// Decoding treats as MBCS string. + /// + CountedMbcsString = 23, + + /// + /// Core type. + /// Special case: Struct indicates that this field plus the + /// subsequent N logical fields are to be considered as one logical + /// field (i.e. a nested structure). The OutType is used to encode N. + /// The maximum value for N is 127. This field has no payload by + /// itself, but logically contains the payload of the following N + /// fields. It is legal to have an array of Struct. + /// + Struct = 24, + + /// + /// Formatted type. + /// Encoding assumes 16-bit value. + /// Decoding treats as UTF-16LE character. + /// + Char16 = UInt16 + (EventFieldFormat.String << 8), + + /// + /// Formatted type. + /// Encoding assumes 8-bit value. + /// Decoding treats as character. + /// + Char8 = UInt8 + (EventFieldFormat.String << 8), + + /// + /// Formatted type. + /// Encoding assumes 8-bit value. + /// Decoding treats as Boolean. + /// + Boolean8 = UInt8 + (EventFieldFormat.Boolean << 8), + + /// + /// Formatted type. + /// Encoding assumes 8-bit value. + /// Decoding treats as hexadecimal unsigned integer. + /// + HexInt8 = UInt8 + (EventFieldFormat.Hexadecimal << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit value. + /// Decoding treats as hexadecimal unsigned integer. + /// + HexInt16 = UInt16 + (EventFieldFormat.Hexadecimal << 8), + +#if false + /// + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as process identifier. + /// + ProcessId = UInt32 + (EventSourceFieldFormat.ProcessId << 8), + + /// + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as thread identifier. + /// + ThreadId = UInt32 + (EventSourceFieldFormat.ThreadId << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit value. + /// Decoding treats as IP port. + /// + Port = UInt16 + (EventSourceFieldFormat.Port << 8), + + /// + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as IPv4 address. + /// + Ipv4Address = UInt32 + (EventSourceFieldFormat.Ipv4Address << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by binary data. + /// Decoding treats as IPv6 address. + /// + Ipv6Address = Binary + (EventSourceFieldFormat.Ipv6Address << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by binary data. + /// Decoding treats as SOCKADDR. + /// + SocketAddress = Binary + (EventSourceFieldFormat.SocketAddress << 8), +#endif + /// + /// Formatted type. + /// Encoding assumes null-terminated Char16 string. + /// Decoding treats as UTF-16LE XML string. + /// + Utf16Xml = Utf16String + (EventFieldFormat.Xml << 8), + + /// + /// Formatted type. + /// Encoding assumes null-terminated Char8 string. + /// Decoding treats as MBCS XML string. + /// + MbcsXml = MbcsString + (EventFieldFormat.Xml << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by Char16 data. + /// Decoding treats as UTF-16LE XML. + /// + CountedUtf16Xml = CountedUtf16String + (EventFieldFormat.Xml << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by Char8 data. + /// Decoding treats as MBCS XML. + /// + CountedMbcsXml = CountedMbcsString + (EventFieldFormat.Xml << 8), + + /// + /// Formatted type. + /// Encoding assumes null-terminated Char16 string. + /// Decoding treats as UTF-16LE JSON string. + /// + Utf16Json = Utf16String + (EventFieldFormat.Json << 8), + + /// + /// Formatted type. + /// Encoding assumes null-terminated Char8 string. + /// Decoding treats as MBCS JSON string. + /// + MbcsJson = MbcsString + (EventFieldFormat.Json << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by Char16 data. + /// Decoding treats as UTF-16LE JSON. + /// + CountedUtf16Json = CountedUtf16String + (EventFieldFormat.Json << 8), + + /// + /// Formatted type. + /// Encoding assumes 16-bit bytecount followed by Char8 data. + /// Decoding treats as MBCS JSON. + /// + CountedMbcsJson = CountedMbcsString + (EventFieldFormat.Json << 8), +#if false + /// + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as Win32 error. + /// + Win32Error = UInt32 + (EventSourceFieldFormat.Win32Error << 8), + + /// + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as NTSTATUS. + /// + NTStatus = UInt32 + (EventSourceFieldFormat.NTStatus << 8), +#endif + /// + /// Formatted type. + /// Encoding assumes 32-bit value. + /// Decoding treats as HRESULT. + /// + HResult = Int32 + (EventFieldFormat.HResult << 8) + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventSource.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventSource.cs new file mode 100644 index 0000000000..a8017bb76f --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventSource.cs @@ -0,0 +1,897 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in. +// It is available from http://www.codeplex.com/hyperAddin + +#if PLATFORM_WINDOWS +#define FEATURE_MANAGED_ETW + +#if !ES_BUILD_STANDALONE +#define FEATURE_ACTIVITYSAMPLING +#endif +#endif // PLATFORM_WINDOWS + +#if ES_BUILD_STANDALONE +#define FEATURE_MANAGED_ETW_CHANNELS +// #define FEATURE_ADVANCED_MANAGED_ETW_CHANNELS +#endif + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +using EventDescriptor = Microsoft.Diagnostics.Tracing.EventDescriptor; +#endif + +using System; +using System.Resources; +using System.Runtime.InteropServices; +using System.Security; +using System.Collections.ObjectModel; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +using System.Collections.Generic; +using System.Text; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +using System.Collections.Generic; +using System.Text; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + public partial class EventSource + { +#if FEATURE_MANAGED_ETW + private byte[] providerMetadata; +#endif + + /// + /// Construct an EventSource with a given name for non-contract based events (e.g. those using the Write() API). + /// + /// + /// The name of the event source. Must not be null. + /// + public EventSource( + string eventSourceName) + : this(eventSourceName, EventSourceSettings.EtwSelfDescribingEventFormat) + { } + + /// + /// Construct an EventSource with a given name for non-contract based events (e.g. those using the Write() API). + /// + /// + /// The name of the event source. Must not be null. + /// + /// + /// Configuration options for the EventSource as a whole. + /// + public EventSource( + string eventSourceName, + EventSourceSettings config) + : this(eventSourceName, config, null) { } + + /// + /// Construct an EventSource with a given name for non-contract based events (e.g. those using the Write() API). + /// + /// Also specify a list of key-value pairs called traits (you must pass an even number of strings). + /// The first string is the key and the second is the value. These are not interpreted by EventSource + /// itself but may be interpreted the listeners. Can be fetched with GetTrait(string). + /// + /// + /// The name of the event source. Must not be null. + /// + /// + /// Configuration options for the EventSource as a whole. + /// + /// A collection of key-value strings (must be an even number). + public EventSource( + string eventSourceName, + EventSourceSettings config, + params string[] traits) + : this( + eventSourceName == null ? new Guid() : GenerateGuidFromName(eventSourceName.ToUpperInvariant()), + eventSourceName, + config, traits) + { + if (eventSourceName == null) + { + throw new ArgumentNullException(nameof(eventSourceName)); + } + Contract.EndContractBlock(); + } + + /// + /// Writes an event with no fields and default options. + /// (Native API: EventWriteTransfer) + /// + /// The name of the event. Must not be null. + public unsafe void Write(string eventName) + { + if (eventName == null) + { + throw new ArgumentNullException(nameof(eventName)); + } + + Contract.EndContractBlock(); + + if (!this.IsEnabled()) + { + return; + } + + var options = new EventSourceOptions(); + this.WriteImpl(eventName, ref options, null, null, null, SimpleEventTypes.Instance); + } + + /// + /// Writes an event with no fields. + /// (Native API: EventWriteTransfer) + /// + /// The name of the event. Must not be null. + /// + /// Options for the event, such as the level, keywords, and opcode. Unset + /// options will be set to default values. + /// + public unsafe void Write(string eventName, EventSourceOptions options) + { + if (eventName == null) + { + throw new ArgumentNullException(nameof(eventName)); + } + + Contract.EndContractBlock(); + + if (!this.IsEnabled()) + { + return; + } + + this.WriteImpl(eventName, ref options, null, null, null, SimpleEventTypes.Instance); + } + + /// + /// Writes an event. + /// (Native API: EventWriteTransfer) + /// + /// + /// The type that defines the event and its payload. This must be an + /// anonymous type or a type with an [EventData] attribute. + /// + /// + /// The name for the event. If null, the event name is automatically + /// determined based on T, either from the Name property of T's EventData + /// attribute or from typeof(T).Name. + /// + /// + /// The object containing the event payload data. The type T must be + /// an anonymous type or a type with an [EventData] attribute. The + /// public instance properties of data will be written recursively to + /// create the fields of the event. + /// + public unsafe void Write( + string eventName, + T data) + { + if (!this.IsEnabled()) + { + return; + } + + var options = new EventSourceOptions(); + this.WriteImpl(eventName, ref options, data, null, null, SimpleEventTypes.Instance); + } + + /// + /// Writes an event. + /// (Native API: EventWriteTransfer) + /// + /// + /// The type that defines the event and its payload. This must be an + /// anonymous type or a type with an [EventData] attribute. + /// + /// + /// The name for the event. If null, the event name is automatically + /// determined based on T, either from the Name property of T's EventData + /// attribute or from typeof(T).Name. + /// + /// + /// Options for the event, such as the level, keywords, and opcode. Unset + /// options will be set to default values. + /// + /// + /// The object containing the event payload data. The type T must be + /// an anonymous type or a type with an [EventData] attribute. The + /// public instance properties of data will be written recursively to + /// create the fields of the event. + /// + public unsafe void Write( + string eventName, + EventSourceOptions options, + T data) + { + if (!this.IsEnabled()) + { + return; + } + + this.WriteImpl(eventName, ref options, data, null, null, SimpleEventTypes.Instance); + } + + /// + /// Writes an event. + /// This overload is for use with extension methods that wish to efficiently + /// forward the options or data parameter without performing an extra copy. + /// (Native API: EventWriteTransfer) + /// + /// + /// The type that defines the event and its payload. This must be an + /// anonymous type or a type with an [EventData] attribute. + /// + /// + /// The name for the event. If null, the event name is automatically + /// determined based on T, either from the Name property of T's EventData + /// attribute or from typeof(T).Name. + /// + /// + /// Options for the event, such as the level, keywords, and opcode. Unset + /// options will be set to default values. + /// + /// + /// The object containing the event payload data. The type T must be + /// an anonymous type or a type with an [EventData] attribute. The + /// public instance properties of data will be written recursively to + /// create the fields of the event. + /// + public unsafe void Write( + string eventName, + ref EventSourceOptions options, + ref T data) + { + if (!this.IsEnabled()) + { + return; + } + + this.WriteImpl(eventName, ref options, data, null, null, SimpleEventTypes.Instance); + } + + /// + /// Writes an event. + /// This overload is meant for clients that need to manipuate the activityId + /// and related ActivityId for the event. + /// + /// + /// The type that defines the event and its payload. This must be an + /// anonymous type or a type with an [EventData] attribute. + /// + /// + /// The name for the event. If null, the event name is automatically + /// determined based on T, either from the Name property of T's EventData + /// attribute or from typeof(T).Name. + /// + /// + /// Options for the event, such as the level, keywords, and opcode. Unset + /// options will be set to default values. + /// + /// + /// The GUID of the activity associated with this event. + /// + /// + /// The GUID of another activity that is related to this activity, or Guid.Empty + /// if there is no related activity. Most commonly, the Start operation of a + /// new activity specifies a parent activity as its related activity. + /// + /// + /// The object containing the event payload data. The type T must be + /// an anonymous type or a type with an [EventData] attribute. The + /// public instance properties of data will be written recursively to + /// create the fields of the event. + /// + public unsafe void Write( + string eventName, + ref EventSourceOptions options, + ref Guid activityId, + ref Guid relatedActivityId, + ref T data) + { + if (!this.IsEnabled()) + { + return; + } + + fixed (Guid* pActivity = &activityId, pRelated = &relatedActivityId) + { + this.WriteImpl( + eventName, + ref options, + data, + pActivity, + relatedActivityId == Guid.Empty ? null : pRelated, + SimpleEventTypes.Instance); + } + } + + /// + /// Writes an extended event, where the values of the event are the + /// combined properties of any number of values. This method is + /// intended for use in advanced logging scenarios that support a + /// dynamic set of event context providers. + /// This method does a quick check on whether this event is enabled. + /// + /// + /// The name for the event. If null, the name from eventTypes is used. + /// (Note that providing the event name via the name parameter is slightly + /// less efficient than using the name from eventTypes.) + /// + /// + /// Optional overrides for the event, such as the level, keyword, opcode, + /// activityId, and relatedActivityId. Any settings not specified by options + /// are obtained from eventTypes. + /// + /// + /// Information about the event and the types of the values in the event. + /// Must not be null. Note that the eventTypes object should be created once and + /// saved. It should not be recreated for each event. + /// + /// + /// A pointer to the activity ID GUID to log + /// + /// + /// A pointer to the child activity ID to log (can be null) + /// + /// The values to include in the event. Must not be null. The number and types of + /// the values must match the number and types of the fields described by the + /// eventTypes parameter. + /// + private unsafe void WriteMultiMerge( + string eventName, + ref EventSourceOptions options, + TraceLoggingEventTypes eventTypes, + Guid* activityID, + Guid* childActivityID, + params object[] values) + { + if (!this.IsEnabled()) + { + return; + } + byte level = (options.valuesSet & EventSourceOptions.levelSet) != 0 + ? options.level + : eventTypes.level; + EventKeywords keywords = (options.valuesSet & EventSourceOptions.keywordsSet) != 0 + ? options.keywords + : eventTypes.keywords; + + if (this.IsEnabled((EventLevel)level, keywords)) + { + WriteMultiMergeInner(eventName, ref options, eventTypes, activityID, childActivityID, values); + } + } + + /// + /// Writes an extended event, where the values of the event are the + /// combined properties of any number of values. This method is + /// intended for use in advanced logging scenarios that support a + /// dynamic set of event context providers. + /// Attention: This API does not check whether the event is enabled or not. + /// Please use WriteMultiMerge to avoid spending CPU cycles for events that are + /// not enabled. + /// + /// + /// The name for the event. If null, the name from eventTypes is used. + /// (Note that providing the event name via the name parameter is slightly + /// less efficient than using the name from eventTypes.) + /// + /// + /// Optional overrides for the event, such as the level, keyword, opcode, + /// activityId, and relatedActivityId. Any settings not specified by options + /// are obtained from eventTypes. + /// + /// + /// Information about the event and the types of the values in the event. + /// Must not be null. Note that the eventTypes object should be created once and + /// saved. It should not be recreated for each event. + /// + /// + /// A pointer to the activity ID GUID to log + /// + /// + /// A pointer to the child activity ID to log (can be null) + /// + /// + /// The values to include in the event. Must not be null. The number and types of + /// the values must match the number and types of the fields described by the + /// eventTypes parameter. + /// + private unsafe void WriteMultiMergeInner( + string eventName, + ref EventSourceOptions options, + TraceLoggingEventTypes eventTypes, + Guid* activityID, + Guid* childActivityID, + params object[] values) + { +#if FEATURE_MANAGED_ETW + int identity = 0; + byte level = (options.valuesSet & EventSourceOptions.levelSet) != 0 + ? options.level + : eventTypes.level; + byte opcode = (options.valuesSet & EventSourceOptions.opcodeSet) != 0 + ? options.opcode + : eventTypes.opcode; + EventTags tags = (options.valuesSet & EventSourceOptions.tagsSet) != 0 + ? options.tags + : eventTypes.Tags; + EventKeywords keywords = (options.valuesSet & EventSourceOptions.keywordsSet) != 0 + ? options.keywords + : eventTypes.keywords; + + var nameInfo = eventTypes.GetNameInfo(eventName ?? eventTypes.Name, tags); + if (nameInfo == null) + { + return; + } + identity = nameInfo.identity; + EventDescriptor descriptor = new EventDescriptor(identity, level, opcode, (long)keywords); + + var pinCount = eventTypes.pinCount; + var scratch = stackalloc byte[eventTypes.scratchSize]; + var descriptors = stackalloc EventData[eventTypes.dataCount + 3]; + + var pins = stackalloc GCHandle[pinCount]; + for (int i = 0; i < pinCount; i++) + pins[i] = default(GCHandle); + + fixed (byte* + pMetadata0 = this.providerMetadata, + pMetadata1 = nameInfo.nameMetadata, + pMetadata2 = eventTypes.typeMetadata) + { + descriptors[0].SetMetadata(pMetadata0, this.providerMetadata.Length, 2); + descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1); + descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1); + +#if (!ES_BUILD_PCL && !ES_BUILD_PN) + System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions(); +#endif + try + { + DataCollector.ThreadInstance.Enable( + scratch, + eventTypes.scratchSize, + descriptors + 3, + eventTypes.dataCount, + pins, + pinCount); + + for (int i = 0; i < eventTypes.typeInfos.Length; i++) + { + var info = eventTypes.typeInfos[i]; + info.WriteData(TraceLoggingDataCollector.Instance, info.PropertyValueFactory(values[i])); + } + + this.WriteEventRaw( + eventName, + ref descriptor, + activityID, + childActivityID, + (int)(DataCollector.ThreadInstance.Finish() - descriptors), + (IntPtr)descriptors); + } + finally + { + this.WriteCleanup(pins, pinCount); + } + } +#endif // FEATURE_MANAGED_ETW + } + + /// + /// Writes an extended event, where the values of the event have already + /// been serialized in "data". + /// + /// + /// The name for the event. If null, the name from eventTypes is used. + /// (Note that providing the event name via the name parameter is slightly + /// less efficient than using the name from eventTypes.) + /// + /// + /// Optional overrides for the event, such as the level, keyword, opcode, + /// activityId, and relatedActivityId. Any settings not specified by options + /// are obtained from eventTypes. + /// + /// + /// Information about the event and the types of the values in the event. + /// Must not be null. Note that the eventTypes object should be created once and + /// saved. It should not be recreated for each event. + /// + /// + /// A pointer to the activity ID GUID to log + /// + /// + /// A pointer to the child activity ID to log (can be null) + /// + /// + /// The previously serialized values to include in the event. Must not be null. + /// The number and types of the values must match the number and types of the + /// fields described by the eventTypes parameter. + /// + internal unsafe void WriteMultiMerge( + string eventName, + ref EventSourceOptions options, + TraceLoggingEventTypes eventTypes, + Guid* activityID, + Guid* childActivityID, + EventData* data) + { +#if FEATURE_MANAGED_ETW + if (!this.IsEnabled()) + { + return; + } + + fixed (EventSourceOptions* pOptions = &options) + { + EventDescriptor descriptor; + var nameInfo = this.UpdateDescriptor(eventName, eventTypes, ref options, out descriptor); + if (nameInfo == null) + { + return; + } + + // We make a descriptor for each EventData, and because we morph strings to counted strings + // we may have 2 for each arg, so we allocate enough for this. + var descriptors = stackalloc EventData[eventTypes.dataCount + eventTypes.typeInfos.Length * 2 + 3]; + + fixed (byte* + pMetadata0 = this.providerMetadata, + pMetadata1 = nameInfo.nameMetadata, + pMetadata2 = eventTypes.typeMetadata) + { + descriptors[0].SetMetadata(pMetadata0, this.providerMetadata.Length, 2); + descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1); + descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1); + int numDescrs = 3; + + for (int i = 0; i < eventTypes.typeInfos.Length; i++) + { + // Until M3, we need to morph strings to a counted representation + // When TDH supports null terminated strings, we can remove this. + if (eventTypes.typeInfos[i].DataType == typeof(string)) + { + // Write out the size of the string + descriptors[numDescrs].DataPointer = (IntPtr) (&descriptors[numDescrs + 1].m_Size); + descriptors[numDescrs].m_Size = 2; + numDescrs++; + + descriptors[numDescrs].m_Ptr = data[i].m_Ptr; + descriptors[numDescrs].m_Size = data[i].m_Size - 2; // Remove the null terminator + numDescrs++; + } + else + { + descriptors[numDescrs].m_Ptr = data[i].m_Ptr; + descriptors[numDescrs].m_Size = data[i].m_Size; + + // old conventions for bool is 4 bytes, but meta-data assumes 1. + if (data[i].m_Size == 4 && eventTypes.typeInfos[i].DataType == typeof(bool)) + descriptors[numDescrs].m_Size = 1; + + numDescrs++; + } + } + + this.WriteEventRaw( + eventName, + ref descriptor, + activityID, + childActivityID, + numDescrs, + (IntPtr)descriptors); + } + } +#endif // FEATURE_MANAGED_ETW + } + + private unsafe void WriteImpl( + string eventName, + ref EventSourceOptions options, + object data, + Guid* pActivityId, + Guid* pRelatedActivityId, + TraceLoggingEventTypes eventTypes) + { + try + { + fixed (EventSourceOptions* pOptions = &options) + { + EventDescriptor descriptor; + options.Opcode = options.IsOpcodeSet ? options.Opcode : GetOpcodeWithDefault(options.Opcode, eventName); + var nameInfo = this.UpdateDescriptor(eventName, eventTypes, ref options, out descriptor); + if (nameInfo == null) + { + return; + } + +#if FEATURE_MANAGED_ETW + var pinCount = eventTypes.pinCount; + var scratch = stackalloc byte[eventTypes.scratchSize]; + var descriptors = stackalloc EventData[eventTypes.dataCount + 3]; + + var pins = stackalloc GCHandle[pinCount]; + for (int i = 0; i < pinCount; i++) + pins[i] = default(GCHandle); + + fixed (byte* + pMetadata0 = this.providerMetadata, + pMetadata1 = nameInfo.nameMetadata, + pMetadata2 = eventTypes.typeMetadata) + { + descriptors[0].SetMetadata(pMetadata0, this.providerMetadata.Length, 2); + descriptors[1].SetMetadata(pMetadata1, nameInfo.nameMetadata.Length, 1); + descriptors[2].SetMetadata(pMetadata2, eventTypes.typeMetadata.Length, 1); +#endif // FEATURE_MANAGED_ETW + +#if (!ES_BUILD_PCL && !ES_BUILD_PN) + System.Runtime.CompilerServices.RuntimeHelpers.PrepareConstrainedRegions(); +#endif + EventOpcode opcode = (EventOpcode)descriptor.Opcode; + + Guid activityId = Guid.Empty; + Guid relatedActivityId = Guid.Empty; + if (pActivityId == null && pRelatedActivityId == null && + ((options.ActivityOptions & EventActivityOptions.Disable) == 0)) + { + if (opcode == EventOpcode.Start) + { + m_activityTracker.OnStart(m_name, eventName, 0, ref activityId, ref relatedActivityId, options.ActivityOptions); + } + else if (opcode == EventOpcode.Stop) + { + m_activityTracker.OnStop(m_name, eventName, 0, ref activityId); + } + if (activityId != Guid.Empty) + pActivityId = &activityId; + if (relatedActivityId != Guid.Empty) + pRelatedActivityId = &relatedActivityId; + } + + try + { +#if FEATURE_MANAGED_ETW + DataCollector.ThreadInstance.Enable( + scratch, + eventTypes.scratchSize, + descriptors + 3, + eventTypes.dataCount, + pins, + pinCount); + + var info = eventTypes.typeInfos[0]; + info.WriteData(TraceLoggingDataCollector.Instance, info.PropertyValueFactory(data)); + + this.WriteEventRaw( + eventName, + ref descriptor, + pActivityId, + pRelatedActivityId, + (int)(DataCollector.ThreadInstance.Finish() - descriptors), + (IntPtr)descriptors); +#endif // FEATURE_MANAGED_ETW + + // TODO enable filtering for listeners. + if (m_Dispatchers != null) + { + var eventData = (EventPayload)(eventTypes.typeInfos[0].GetData(data)); + WriteToAllListeners(eventName, ref descriptor, nameInfo.tags, pActivityId, eventData); + } + + } + catch (Exception ex) + { + if (ex is EventSourceException) + throw; + else + ThrowEventSourceException(eventName, ex); + } +#if FEATURE_MANAGED_ETW + finally + { + this.WriteCleanup(pins, pinCount); + } + } +#endif // FEATURE_MANAGED_ETW + } + } + catch (Exception ex) + { + if (ex is EventSourceException) + throw; + else + ThrowEventSourceException(eventName, ex); + } + } + + private unsafe void WriteToAllListeners(string eventName, ref EventDescriptor eventDescriptor, EventTags tags, Guid* pActivityId, EventPayload payload) + { + EventWrittenEventArgs eventCallbackArgs = new EventWrittenEventArgs(this); + eventCallbackArgs.EventName = eventName; + eventCallbackArgs.m_level = (EventLevel) eventDescriptor.Level; + eventCallbackArgs.m_keywords = (EventKeywords) eventDescriptor.Keywords; + eventCallbackArgs.m_opcode = (EventOpcode) eventDescriptor.Opcode; + eventCallbackArgs.m_tags = tags; + + // Self described events do not have an id attached. We mark it internally with -1. + eventCallbackArgs.EventId = -1; + if (pActivityId != null) + eventCallbackArgs.RelatedActivityId = *pActivityId; + + if (payload != null) + { + eventCallbackArgs.Payload = new ReadOnlyCollection((IList)payload.Values); + eventCallbackArgs.PayloadNames = new ReadOnlyCollection((IList)payload.Keys); + } + + DispatchToAllListeners(-1, pActivityId, eventCallbackArgs); + } + +#if (!ES_BUILD_PCL && !ES_BUILD_PN) + [System.Runtime.ConstrainedExecution.ReliabilityContract( + System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, + System.Runtime.ConstrainedExecution.Cer.Success)] +#endif + [NonEvent] + private unsafe void WriteCleanup(GCHandle* pPins, int cPins) + { + DataCollector.ThreadInstance.Disable(); + + for (int i = 0; i < cPins; i++) + { + if (pPins[i].IsAllocated) + { + pPins[i].Free(); + } + } + } + + private void InitializeProviderMetadata() + { +#if FEATURE_MANAGED_ETW + if (m_traits != null) + { + List traitMetaData = new List(100); + for (int i = 0; i < m_traits.Length - 1; i += 2) + { + if (m_traits[i].StartsWith("ETW_", StringComparison.Ordinal)) + { + string etwTrait = m_traits[i].Substring(4); + byte traitNum; + if (!byte.TryParse(etwTrait, out traitNum)) + { + if (etwTrait == "GROUP") + { + traitNum = 1; + } + else + { + throw new ArgumentException(Resources.GetResourceString("UnknownEtwTrait", etwTrait), "traits"); + } + } + string value = m_traits[i + 1]; + int lenPos = traitMetaData.Count; + traitMetaData.Add(0); // Emit size (to be filled in later) + traitMetaData.Add(0); + traitMetaData.Add(traitNum); // Emit Trait number + var valueLen = AddValueToMetaData(traitMetaData, value) + 3; // Emit the value bytes +3 accounts for 3 bytes we emited above. + traitMetaData[lenPos] = unchecked((byte)valueLen); // Fill in size + traitMetaData[lenPos + 1] = unchecked((byte)(valueLen >> 8)); + } + } + providerMetadata = Statics.MetadataForString(this.Name, 0, traitMetaData.Count, 0); + int startPos = providerMetadata.Length - traitMetaData.Count; + foreach (var b in traitMetaData) + providerMetadata[startPos++] = b; + } + else + providerMetadata = Statics.MetadataForString(this.Name, 0, 0, 0); +#endif //FEATURE_MANAGED_ETW + } + + private static int AddValueToMetaData(List metaData, string value) + { + if (value.Length == 0) + return 0; + + int startPos = metaData.Count; + char firstChar = value[0]; + + if (firstChar == '@') + metaData.AddRange(Encoding.UTF8.GetBytes(value.Substring(1))); + else if (firstChar == '{') + metaData.AddRange(new Guid(value).ToByteArray()); + else if (firstChar == '#') + { + for (int i = 1; i < value.Length; i++) + { + if (value[i] != ' ') // Skip spaces between bytes. + { + if (!(i + 1 < value.Length)) + { + throw new ArgumentException(Resources.GetResourceString("EvenHexDigits"), "traits"); + } + metaData.Add((byte)(HexDigit(value[i]) * 16 + HexDigit(value[i + 1]))); + i++; + } + } + } + else if ('A' <= firstChar || ' ' == firstChar) // Is it alphabetic or space (excludes digits and most punctuation). + { + metaData.AddRange(Encoding.UTF8.GetBytes(value)); + } + else + { + throw new ArgumentException(Resources.GetResourceString("IllegalValue", value), "traits"); + } + + return metaData.Count - startPos; + } + + /// + /// Returns a value 0-15 if 'c' is a hexadecimal digit. If it throws an argument exception. + /// + private static int HexDigit(char c) + { + if ('0' <= c && c <= '9') + { + return (c - '0'); + } + if ('a' <= c) + { + c = unchecked((char)(c - ('a' - 'A'))); // Convert to lower case + } + if ('A' <= c && c <= 'F') + { + return (c - 'A' + 10); + } + + throw new ArgumentException(Resources.GetResourceString("BadHexDigit", c), "traits"); + } + + private NameInfo UpdateDescriptor( + string name, + TraceLoggingEventTypes eventInfo, + ref EventSourceOptions options, + out EventDescriptor descriptor) + { + NameInfo nameInfo = null; + int identity = 0; + byte level = (options.valuesSet & EventSourceOptions.levelSet) != 0 + ? options.level + : eventInfo.level; + byte opcode = (options.valuesSet & EventSourceOptions.opcodeSet) != 0 + ? options.opcode + : eventInfo.opcode; + EventTags tags = (options.valuesSet & EventSourceOptions.tagsSet) != 0 + ? options.tags + : eventInfo.Tags; + EventKeywords keywords = (options.valuesSet & EventSourceOptions.keywordsSet) != 0 + ? options.keywords + : eventInfo.keywords; + + if (this.IsEnabled((EventLevel)level, keywords)) + { + nameInfo = eventInfo.GetNameInfo(name ?? eventInfo.Name, tags); + identity = nameInfo.identity; + } + + descriptor = new EventDescriptor(identity, level, opcode, (long)keywords); + return nameInfo; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventTraits.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventTraits.cs new file mode 100644 index 0000000000..e808a8823c --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventTraits.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// Tags are flags that are not interpreted by EventSource but are passed along + /// to the EventListener. The EventListener determines the semantics of the flags. + /// + [Flags] + public enum EventTags + { + /// + /// No special traits are added to the event. + /// + None = 0, + + /* Bits below 0x10000 are available for any use by the provider. */ + /* Bits at or above 0x10000 are reserved for definition by Microsoft. */ + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventTypes.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventTypes.cs new file mode 100644 index 0000000000..c2239671bb --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingEventTypes.cs @@ -0,0 +1,262 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using Interlocked = System.Threading.Interlocked; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: Used when calling EventSource.WriteMultiMerge. + /// Stores the type information to use when writing the event fields. + /// + public class TraceLoggingEventTypes + { + internal readonly TraceLoggingTypeInfo[] typeInfos; + internal readonly string name; + internal readonly EventTags tags; + internal readonly byte level; + internal readonly byte opcode; + internal readonly EventKeywords keywords; + internal readonly byte[] typeMetadata; + internal readonly int scratchSize; + internal readonly int dataCount; + internal readonly int pinCount; + private ConcurrentSet, NameInfo> nameInfos; + + /// + /// Initializes a new instance of TraceLoggingEventTypes corresponding + /// to the name, flags, and types provided. Always uses the default + /// TypeInfo for each Type. + /// + /// + /// The name to use when the name parameter passed to + /// EventSource.Write is null. This value must not be null. + /// + /// + /// Tags to add to the event if the tags are not set via options. + /// + /// + /// The types of the fields in the event. This value must not be null. + /// + internal TraceLoggingEventTypes( + string name, + EventTags tags, + params Type[] types) + : this(tags, name, MakeArray(types)) + { + return; + } + + /// + /// Returns a new instance of TraceLoggingEventInfo corresponding to the name, + /// flags, and typeInfos provided. + /// + /// + /// The name to use when the name parameter passed to + /// EventSource.Write is null. This value must not be null. + /// + /// + /// Tags to add to the event if the tags are not set via options. + /// + /// + /// The types of the fields in the event. This value must not be null. + /// + /// + /// An instance of TraceLoggingEventInfo with DefaultName set to the specified name + /// and with the specified typeInfos. + /// + internal TraceLoggingEventTypes( + string name, + EventTags tags, + params TraceLoggingTypeInfo[] typeInfos) + : this(tags, name, MakeArray(typeInfos)) + { + return; + } + + internal TraceLoggingEventTypes( + string name, + EventTags tags, + System.Reflection.ParameterInfo[] paramInfos) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Contract.EndContractBlock(); + + this.typeInfos = MakeArray(paramInfos); + this.name = name; + this.tags = tags; + this.level = Statics.DefaultLevel; + + var collector = new TraceLoggingMetadataCollector(); + for (int i = 0; i < typeInfos.Length; ++i) + { + var typeInfo = typeInfos[i]; + this.level = Statics.Combine((int)typeInfo.Level, this.level); + this.opcode = Statics.Combine((int)typeInfo.Opcode, this.opcode); + this.keywords |= typeInfo.Keywords; + var paramName = paramInfos[i].Name; + if (Statics.ShouldOverrideFieldName(paramName)) + { + paramName = typeInfo.Name; + } + typeInfo.WriteMetadata(collector, paramName, EventFieldFormat.Default); + } + + this.typeMetadata = collector.GetMetadata(); + this.scratchSize = collector.ScratchSize; + this.dataCount = collector.DataCount; + this.pinCount = collector.PinCount; + } + + private TraceLoggingEventTypes( + EventTags tags, + string defaultName, + TraceLoggingTypeInfo[] typeInfos) + { + if (defaultName == null) + { + throw new ArgumentNullException(nameof(defaultName)); + } + + Contract.EndContractBlock(); + + this.typeInfos = typeInfos; + this.name = defaultName; + this.tags = tags; + this.level = Statics.DefaultLevel; + + var collector = new TraceLoggingMetadataCollector(); + foreach (var typeInfo in typeInfos) + { + this.level = Statics.Combine((int)typeInfo.Level, this.level); + this.opcode = Statics.Combine((int)typeInfo.Opcode, this.opcode); + this.keywords |= typeInfo.Keywords; + typeInfo.WriteMetadata(collector, null, EventFieldFormat.Default); + } + + this.typeMetadata = collector.GetMetadata(); + this.scratchSize = collector.ScratchSize; + this.dataCount = collector.DataCount; + this.pinCount = collector.PinCount; + } + + /// + /// Gets the default name that will be used for events with this descriptor. + /// + internal string Name + { + get { return this.name; } + } + + /// + /// Gets the default level that will be used for events with this descriptor. + /// + internal EventLevel Level + { + get { return (EventLevel)this.level; } + } + + /// + /// Gets the default opcode that will be used for events with this descriptor. + /// + internal EventOpcode Opcode + { + get { return (EventOpcode)this.opcode; } + } + + /// + /// Gets the default set of keywords that will added to events with this descriptor. + /// + internal EventKeywords Keywords + { + get { return (EventKeywords)this.keywords; } + } + + /// + /// Gets the default tags that will be added events with this descriptor. + /// + internal EventTags Tags + { + get { return this.tags; } + } + + internal NameInfo GetNameInfo(string name, EventTags tags) + { + var ret = this.nameInfos.TryGet(new KeyValuePair(name, tags)); + if (ret == null) + { + ret = this.nameInfos.GetOrAdd(new NameInfo(name, tags, this.typeMetadata.Length)); + } + + return ret; + } + + private TraceLoggingTypeInfo[] MakeArray(System.Reflection.ParameterInfo[] paramInfos) + { + if (paramInfos == null) + { + throw new ArgumentNullException(nameof(paramInfos)); + } + + Contract.EndContractBlock(); + + var recursionCheck = new List(paramInfos.Length); + var result = new TraceLoggingTypeInfo[paramInfos.Length]; + for (int i = 0; i < paramInfos.Length; ++i) + { + result[i] = TraceLoggingTypeInfo.GetInstance(paramInfos[i].ParameterType, recursionCheck); + } + + return result; + } + + private static TraceLoggingTypeInfo[] MakeArray(Type[] types) + { + if (types == null) + { + throw new ArgumentNullException(nameof(types)); + } + + Contract.EndContractBlock(); + + var recursionCheck = new List(types.Length); + var result = new TraceLoggingTypeInfo[types.Length]; + for (int i = 0; i < types.Length; i++) + { + result[i] = TraceLoggingTypeInfo.GetInstance(types[i], recursionCheck); + } + + return result; + } + + private static TraceLoggingTypeInfo[] MakeArray( + TraceLoggingTypeInfo[] typeInfos) + { + if (typeInfos == null) + { + throw new ArgumentNullException(nameof(typeInfos)); + } + + Contract.EndContractBlock(); + + return (TraceLoggingTypeInfo[])typeInfos.Clone(); ; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingMetadataCollector.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingMetadataCollector.cs new file mode 100644 index 0000000000..41225c8626 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingMetadataCollector.cs @@ -0,0 +1,370 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +#if ES_BUILD_STANDALONE +using Environment = Microsoft.Diagnostics.Tracing.Internal.Environment; +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: used when implementing a custom TraceLoggingTypeInfo. + /// An instance of this type is provided to the TypeInfo.WriteMetadata method. + /// + internal class TraceLoggingMetadataCollector + { + private readonly Impl impl; + private readonly FieldMetadata currentGroup; + private int bufferedArrayFieldCount = int.MinValue; + + /// + /// Creates a root-level collector. + /// + internal TraceLoggingMetadataCollector() + { + this.impl = new Impl(); + } + + /// + /// Creates a collector for a group. + /// + /// Parent collector + /// The field that starts the group + private TraceLoggingMetadataCollector( + TraceLoggingMetadataCollector other, + FieldMetadata group) + { + this.impl = other.impl; + this.currentGroup = group; + } + + /// + /// The field tags to be used for the next field. + /// This will be reset to None each time a field is written. + /// + internal EventFieldTags Tags + { + get; + set; + } + + internal int ScratchSize + { + get { return this.impl.scratchSize; } + } + + internal int DataCount + { + get { return this.impl.dataCount; } + } + + internal int PinCount + { + get { return this.impl.pinCount; } + } + + private bool BeginningBufferedArray + { + get { return this.bufferedArrayFieldCount == 0; } + } + + /// + /// Call this method to add a group to the event and to return + /// a new metadata collector that can be used to add fields to the + /// group. After all of the fields in the group have been written, + /// switch back to the original metadata collector to add fields + /// outside of the group. + /// Special-case: if name is null, no group is created, and AddGroup + /// returns the original metadata collector. This is useful when + /// adding the top-level group for an event. + /// Note: do not use the original metadata collector while the group's + /// metadata collector is in use, and do not use the group's metadata + /// collector after switching back to the original. + /// + /// + /// The name of the group. If name is null, the call to AddGroup is a + /// no-op (collector.AddGroup(null) returns collector). + /// + /// + /// A new metadata collector that can be used to add fields to the group. + /// + public TraceLoggingMetadataCollector AddGroup(string name) + { + TraceLoggingMetadataCollector result = this; + + if (name != null || // Normal. + this.BeginningBufferedArray) // Error, FieldMetadata's constructor will throw the appropriate exception. + { + var newGroup = new FieldMetadata( + name, + TraceLoggingDataType.Struct, + this.Tags, + this.BeginningBufferedArray); + this.AddField(newGroup); + result = new TraceLoggingMetadataCollector(this, newGroup); + } + + return result; + } + + /// + /// Adds a scalar field to an event. + /// + /// + /// The name to use for the added field. This value must not be null. + /// + /// + /// The type code for the added field. This must be a fixed-size type + /// (e.g. string types are not supported). + /// + public void AddScalar(string name, TraceLoggingDataType type) + { + int size; + switch ((TraceLoggingDataType)((int)type & Statics.InTypeMask)) + { + case TraceLoggingDataType.Int8: + case TraceLoggingDataType.UInt8: + case TraceLoggingDataType.Char8: + size = 1; + break; + case TraceLoggingDataType.Int16: + case TraceLoggingDataType.UInt16: + case TraceLoggingDataType.Char16: + size = 2; + break; + case TraceLoggingDataType.Int32: + case TraceLoggingDataType.UInt32: + case TraceLoggingDataType.HexInt32: + case TraceLoggingDataType.Float: + case TraceLoggingDataType.Boolean32: + size = 4; + break; + case TraceLoggingDataType.Int64: + case TraceLoggingDataType.UInt64: + case TraceLoggingDataType.HexInt64: + case TraceLoggingDataType.Double: + case TraceLoggingDataType.FileTime: + size = 8; + break; + case TraceLoggingDataType.Guid: + case TraceLoggingDataType.SystemTime: + size = 16; + break; + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + + this.impl.AddScalar(size); + this.AddField(new FieldMetadata(name, type, this.Tags, this.BeginningBufferedArray)); + } + + /// + /// Adds a binary-format field to an event. + /// Compatible with core types: Binary, CountedUtf16String, CountedMbcsString. + /// Compatible with dataCollector methods: AddBinary(string), AddArray(Any8bitType[]). + /// + /// + /// The name to use for the added field. This value must not be null. + /// + /// + /// The type code for the added field. This must be a Binary or CountedString type. + /// + public void AddBinary(string name, TraceLoggingDataType type) + { + switch ((TraceLoggingDataType)((int)type & Statics.InTypeMask)) + { + case TraceLoggingDataType.Binary: + case TraceLoggingDataType.CountedMbcsString: + case TraceLoggingDataType.CountedUtf16String: + break; + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + + this.impl.AddScalar(2); + this.impl.AddNonscalar(); + this.AddField(new FieldMetadata(name, type, this.Tags, this.BeginningBufferedArray)); + } + + /// + /// Adds an array field to an event. + /// + /// + /// The name to use for the added field. This value must not be null. + /// + /// + /// The type code for the added field. This must be a fixed-size type + /// or a string type. In the case of a string type, this adds an array + /// of characters, not an array of strings. + /// + public void AddArray(string name, TraceLoggingDataType type) + { + switch ((TraceLoggingDataType)((int)type & Statics.InTypeMask)) + { + case TraceLoggingDataType.Utf16String: + case TraceLoggingDataType.MbcsString: + case TraceLoggingDataType.Int8: + case TraceLoggingDataType.UInt8: + case TraceLoggingDataType.Int16: + case TraceLoggingDataType.UInt16: + case TraceLoggingDataType.Int32: + case TraceLoggingDataType.UInt32: + case TraceLoggingDataType.Int64: + case TraceLoggingDataType.UInt64: + case TraceLoggingDataType.Float: + case TraceLoggingDataType.Double: + case TraceLoggingDataType.Boolean32: + case TraceLoggingDataType.Guid: + case TraceLoggingDataType.FileTime: + case TraceLoggingDataType.HexInt32: + case TraceLoggingDataType.HexInt64: + case TraceLoggingDataType.Char16: + case TraceLoggingDataType.Char8: + break; + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + + if (this.BeginningBufferedArray) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedNestedArraysEnums")); + } + + this.impl.AddScalar(2); + this.impl.AddNonscalar(); + this.AddField(new FieldMetadata(name, type, this.Tags, true)); + } + + public void BeginBufferedArray() + { + if (this.bufferedArrayFieldCount >= 0) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedNestedArraysEnums")); + } + + this.bufferedArrayFieldCount = 0; + this.impl.BeginBuffered(); + } + + public void EndBufferedArray() + { + if (this.bufferedArrayFieldCount != 1) + { + throw new InvalidOperationException(Resources.GetResourceString("EventSource_IncorrentlyAuthoredTypeInfo")); + } + + this.bufferedArrayFieldCount = int.MinValue; + this.impl.EndBuffered(); + } + + /// + /// Adds a custom-serialized field to an event. + /// + /// + /// The name to use for the added field. This value must not be null. + /// + /// The encoding type for the field. + /// Additional information needed to decode the field, if any. + public void AddCustom(string name, TraceLoggingDataType type, byte[] metadata) + { + if (this.BeginningBufferedArray) + { + throw new NotSupportedException(Resources.GetResourceString("EventSource_NotSupportedCustomSerializedData")); + } + + this.impl.AddScalar(2); + this.impl.AddNonscalar(); + this.AddField(new FieldMetadata( + name, + type, + this.Tags, + metadata)); + } + + internal byte[] GetMetadata() + { + var size = this.impl.Encode(null); + var metadata = new byte[size]; + this.impl.Encode(metadata); + return metadata; + } + + private void AddField(FieldMetadata fieldMetadata) + { + this.Tags = EventFieldTags.None; + this.bufferedArrayFieldCount++; + this.impl.fields.Add(fieldMetadata); + + if (this.currentGroup != null) + { + this.currentGroup.IncrementStructFieldCount(); + } + } + + private class Impl + { + internal readonly List fields = new List(); + internal short scratchSize; + internal sbyte dataCount; + internal sbyte pinCount; + private int bufferNesting; + private bool scalar; + + public void AddScalar(int size) + { + if (this.bufferNesting == 0) + { + if (!this.scalar) + { + this.dataCount = checked((sbyte)(this.dataCount + 1)); + } + + this.scalar = true; + this.scratchSize = checked((short)(this.scratchSize + size)); + } + } + + public void AddNonscalar() + { + if (this.bufferNesting == 0) + { + this.scalar = false; + this.pinCount = checked((sbyte)(this.pinCount + 1)); + this.dataCount = checked((sbyte)(this.dataCount + 1)); + } + } + + public void BeginBuffered() + { + if (this.bufferNesting == 0) + { + this.AddNonscalar(); + } + + this.bufferNesting++; + } + + public void EndBuffered() + { + this.bufferNesting--; + } + + public int Encode(byte[] metadata) + { + int size = 0; + + foreach (var field in this.fields) + { + field.Encode(ref size, metadata); + } + + return size; + } + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingTypeInfo.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingTypeInfo.cs new file mode 100644 index 0000000000..d68e106b0b --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TraceLoggingTypeInfo.cs @@ -0,0 +1,209 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; + +#if !ES_BUILD_AGAINST_DOTNET_V35 +using Contract = System.Diagnostics.Contracts.Contract; +#else +using Contract = Microsoft.Diagnostics.Contracts.Internal.Contract; +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: used when implementing a custom TraceLoggingTypeInfo. + /// Non-generic base class for TraceLoggingTypeInfo<DataType>. Do not derive + /// from this class. Instead, derive from TraceLoggingTypeInfo<DataType>. + /// + internal abstract class TraceLoggingTypeInfo + { + private readonly string name; + private readonly EventKeywords keywords; + private readonly EventLevel level = (EventLevel)(-1); + private readonly EventOpcode opcode = (EventOpcode)(-1); + private readonly EventTags tags; + private readonly Type dataType; + private readonly Func propertyValueFactory; + + internal TraceLoggingTypeInfo(Type dataType) + { + if (dataType == null) + { + throw new ArgumentNullException(nameof(dataType)); + } + + Contract.EndContractBlock(); + + this.name = dataType.Name; + this.dataType = dataType; + this.propertyValueFactory = PropertyValue.GetFactory(dataType); + } + + internal TraceLoggingTypeInfo( + Type dataType, + string name, + EventLevel level, + EventOpcode opcode, + EventKeywords keywords, + EventTags tags) + { + if (dataType == null) + { + throw new ArgumentNullException(nameof(dataType)); + } + + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Contract.EndContractBlock(); + + Statics.CheckName(name); + + this.name = name; + this.keywords = keywords; + this.level = level; + this.opcode = opcode; + this.tags = tags; + this.dataType = dataType; + this.propertyValueFactory = PropertyValue.GetFactory(dataType); + } + + /// + /// Gets the name to use for the event if this type is the top-level type, + /// or the name to use for an implicitly-named field. + /// Never null. + /// + public string Name + { + get { return this.name; } + } + + /// + /// Gets the event level associated with this type. Any value in the range 0..255 + /// is an associated event level. Any value outside the range 0..255 is invalid and + /// indicates that this type has no associated event level. + /// + public EventLevel Level + { + get { return this.level; } + } + + /// + /// Gets the event opcode associated with this type. Any value in the range 0..255 + /// is an associated event opcode. Any value outside the range 0..255 is invalid and + /// indicates that this type has no associated event opcode. + /// + public EventOpcode Opcode + { + get { return this.opcode; } + } + + /// + /// Gets the keyword(s) associated with this type. + /// + public EventKeywords Keywords + { + get { return this.keywords; } + } + + /// + /// Gets the event tags associated with this type. + /// + public EventTags Tags + { + get { return this.tags; } + } + + internal Type DataType + { + get { return this.dataType; } + } + + internal Func PropertyValueFactory + { + get { return this.propertyValueFactory; } + } + + /// + /// When overridden by a derived class, writes the metadata (schema) for + /// this type. Note that the sequence of operations in WriteMetadata should be + /// essentially identical to the sequence of operations in + /// WriteData/WriteObjectData. Otherwise, the metadata and data will not match, + /// which may cause trouble when decoding the event. + /// + /// + /// The object that collects metadata for this object's type. Metadata is written + /// by calling methods on the collector object. Note that if the type contains + /// sub-objects, the implementation of this method may need to call the + /// WriteMetadata method for the type of the sub-object, e.g. by calling + /// TraceLoggingTypeInfo<SubType>.Instance.WriteMetadata(...). + /// + /// + /// The name of the property that contains an object of this type, or null if this + /// object is being written as a top-level object of an event. Typical usage + /// is to pass this value to collector.AddGroup. + /// + /// + /// The format attribute for the field that contains an object of this type. + /// + public abstract void WriteMetadata( + TraceLoggingMetadataCollector collector, + string name, + EventFieldFormat format); + + /// + /// Refer to TraceLoggingTypeInfo.WriteObjectData for information about this + /// method. + /// + /// + /// Refer to TraceLoggingTypeInfo.WriteObjectData for information about this + /// method. + /// + /// + /// Refer to TraceLoggingTypeInfo.WriteObjectData for information about this + /// method. + /// + public abstract void WriteData( + TraceLoggingDataCollector collector, + PropertyValue value); + + /// + /// Fetches the event parameter data for internal serialization. + /// + /// + /// + public virtual object GetData(object value) + { + return value; + } + + [ThreadStatic] // per-thread cache to avoid synchronization + private static Dictionary threadCache; + + public static TraceLoggingTypeInfo GetInstance(Type type, List recursionCheck) + { + var cache = threadCache ?? (threadCache = new Dictionary()); + + TraceLoggingTypeInfo instance; + if (!cache.TryGetValue(type, out instance)) + { + if (recursionCheck == null) + recursionCheck = new List(); + var recursionCheckCount = recursionCheck.Count; + instance = Statics.CreateDefaultTypeInfo(type, recursionCheck); + cache[type] = instance; + recursionCheck.RemoveRange(recursionCheckCount, recursionCheck.Count - recursionCheckCount); + } + return instance; + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TypeAnalysis.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TypeAnalysis.cs new file mode 100644 index 0000000000..42cdde5f6a --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/TraceLogging/TypeAnalysis.cs @@ -0,0 +1,103 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Reflection; + + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + /// + /// TraceLogging: stores the per-type information obtained by reflecting over a type. + /// + internal sealed class TypeAnalysis + { + internal readonly PropertyAnalysis[] properties; + internal readonly string name; + internal readonly EventKeywords keywords; + internal readonly EventLevel level = (EventLevel)(-1); + internal readonly EventOpcode opcode = (EventOpcode)(-1); + internal readonly EventTags tags; + + public TypeAnalysis( + Type dataType, + EventDataAttribute eventAttrib, + List recursionCheck) + { + var propertyInfos = Statics.GetProperties(dataType); + var propertyList = new List(); + + foreach (var propertyInfo in propertyInfos) + { + if (Statics.HasCustomAttribute(propertyInfo, typeof(EventIgnoreAttribute))) + { + continue; + } + + if (!propertyInfo.CanRead || + propertyInfo.GetIndexParameters().Length != 0) + { + continue; + } + + MethodInfo getterInfo = Statics.GetGetMethod(propertyInfo); + if (getterInfo == null) + { + continue; + } + + if (getterInfo.IsStatic || !getterInfo.IsPublic) + { + continue; + } + + var propertyType = propertyInfo.PropertyType; + var propertyTypeInfo = TraceLoggingTypeInfo.GetInstance(propertyType, recursionCheck); + var fieldAttribute = Statics.GetCustomAttribute(propertyInfo); + + string propertyName = + fieldAttribute != null && fieldAttribute.Name != null + ? fieldAttribute.Name + : Statics.ShouldOverrideFieldName(propertyInfo.Name) + ? propertyTypeInfo.Name + : propertyInfo.Name; + propertyList.Add(new PropertyAnalysis( + propertyName, + propertyInfo, + propertyTypeInfo, + fieldAttribute)); + } + + this.properties = propertyList.ToArray(); + + foreach (var property in this.properties) + { + var typeInfo = property.typeInfo; + this.level = (EventLevel)Statics.Combine((int)typeInfo.Level, (int)this.level); + this.opcode = (EventOpcode)Statics.Combine((int)typeInfo.Opcode, (int)this.opcode); + this.keywords |= typeInfo.Keywords; + this.tags |= typeInfo.Tags; + } + + if (eventAttrib != null) + { + this.level = (EventLevel)Statics.Combine((int)eventAttrib.Level, (int)this.level); + this.opcode = (EventOpcode)Statics.Combine((int)eventAttrib.Opcode, (int)this.opcode); + this.keywords |= eventAttrib.Keywords; + this.tags |= eventAttrib.Tags; + this.name = eventAttrib.Name; + } + + if (this.name == null) + { + this.name = dataType.Name; + } + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/Winmeta.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/Winmeta.cs new file mode 100644 index 0000000000..ac756b6059 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/shared/Winmeta.cs @@ -0,0 +1,196 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================ +** +** +** Purpose: +** Contains eventing constants defined by the Windows +** environment. +** +============================================================*/ +#if ES_BUILD_STANDALONE +#define FEATURE_MANAGED_ETW_CHANNELS +#endif + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + using System; + + /// + /// WindowsEventLevel. Custom values must be in the range from 16 through 255 + /// + public enum EventLevel + { + /// + /// Log always + /// + LogAlways = 0, + /// + /// Only critical errors + /// + Critical, + /// + /// All errors, including previous levels + /// + Error, + /// + /// All warnings, including previous levels + /// + Warning, + /// + /// All informational events, including previous levels + /// + Informational, + /// + /// All events, including previous levels + /// + Verbose + } + /// + /// WindowsEventTask. Custom values must be in the range from 1 through 65534 + /// +#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN) + [System.Runtime.CompilerServices.FriendAccessAllowed] +#endif + public enum EventTask + { + /// + /// Undefined task + /// + None = 0 + } + /// + /// EventOpcode. Custom values must be in the range from 11 through 239 + /// +#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN) + [System.Runtime.CompilerServices.FriendAccessAllowed] +#endif + public enum EventOpcode + { + /// + /// An informational event + /// + Info = 0, + /// + /// An activity start event + /// + Start, + /// + /// An activity end event + /// + Stop, + /// + /// A trace collection start event + /// + DataCollectionStart, + /// + /// A trace collection end event + /// + DataCollectionStop, + /// + /// An extensional event + /// + Extension, + /// + /// A reply event + /// + Reply, + /// + /// An event representing the activity resuming from the suspension + /// + Resume, + /// + /// An event representing the activity is suspended, pending another activity's completion + /// + Suspend, + /// + /// An event representing the activity is transferred to another component, and can continue to work + /// + Send, + /// + /// An event representing receiving an activity transfer from another component + /// + Receive = 240 + } + + // Added for CLR V4 + /// + /// EventChannel. Custom values must be in the range from 16 through 255. Currently only predefined values allowed. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32", Justification = "Backwards compatibility")] +#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN) + [System.Runtime.CompilerServices.FriendAccessAllowed] +#endif + public enum EventChannel : byte + { + /// + /// No channel + /// + None = 0, + // Channels 1 - 15 are reserved... + /// The admin channel + Admin = 16, + /// The operational channel + Operational = 17, + /// The analytic channel + Analytic = 18, + /// The debug channel + Debug = 19, + + }; + + /// + /// EventOpcode + /// + [Flags] + public enum EventKeywords : long + { + /// + /// No events. + /// + None = 0x0, + /// + /// All Events + /// + All = ~0, + /// + /// Telemetry events + /// + MicrosoftTelemetry = 0x02000000000000, + /// + /// WDI context events + /// + WdiContext = 0x02000000000000, + /// + /// WDI diagnostic events + /// + WdiDiagnostic = 0x04000000000000, + /// + /// SQM events + /// + Sqm = 0x08000000000000, + /// + /// Failed security audits + /// + AuditFailure = 0x10000000000000, + /// + /// Successful security audits + /// + AuditSuccess = 0x20000000000000, + /// + /// Transfer events where the related Activity ID is a computed value and not a GUID + /// N.B. The correct value for this field is 0x40000000000000. + /// + CorrelationHint = 0x10000000000000, + /// + /// Events raised using classic eventlog API + /// + EventLogClassic = 0x80000000000000 + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Configurations.props b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Configurations.props new file mode 100644 index 0000000000..33ad2040f9 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Configurations.props @@ -0,0 +1,8 @@ + + + + + netfx-Windows_NT; + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/ManifestEtw.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/ManifestEtw.cs new file mode 100644 index 0000000000..abc4933c11 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/ManifestEtw.cs @@ -0,0 +1,216 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.Win32 +{ + using Microsoft.Win32.SafeHandles; + using System; +#if ES_BUILD_STANDALONE + using Microsoft.Diagnostics.Tracing; +#else + using System.Diagnostics.Tracing; +#endif + using System.Runtime.InteropServices; + using System.Security; + using System.Text; + + [SuppressUnmanagedCodeSecurityAttribute()] + internal static partial class UnsafeNativeMethods + { + [SuppressUnmanagedCodeSecurityAttribute()] + internal static unsafe class ManifestEtw + { +// Disable warning about unused fields as these structures are defined by the corresponding Windows APIs. +#pragma warning disable CS0649 + // + // ETW Library + // + private const string ADVAPI32 = "advapi32.dll"; + + // + // Constants error coded returned by ETW APIs + // + + // The event size is larger than the allowed maximum (64k - header). + internal const int ERROR_ARITHMETIC_OVERFLOW = 534; + + // Occurs when filled buffers are trying to flush to disk, + // but disk IOs are not happening fast enough. + // This happens when the disk is slow and event traffic is heavy. + // Eventually, there are no more free (empty) buffers and the event is dropped. + internal const int ERROR_NOT_ENOUGH_MEMORY = 8; + + internal const int ERROR_MORE_DATA = 0xEA; + internal const int ERROR_NOT_SUPPORTED = 50; + internal const int ERROR_INVALID_PARAMETER = 0x57; + + // + // ETW Methods + // + + internal const int EVENT_CONTROL_CODE_DISABLE_PROVIDER = 0; + internal const int EVENT_CONTROL_CODE_ENABLE_PROVIDER = 1; + internal const int EVENT_CONTROL_CODE_CAPTURE_STATE = 2; + + // + // Callback + // + internal unsafe delegate void EtwEnableCallback( + [In] ref Guid sourceId, + [In] int isEnabled, + [In] byte level, + [In] long matchAnyKeywords, + [In] long matchAllKeywords, + [In] EVENT_FILTER_DESCRIPTOR* filterData, + [In] void* callbackContext + ); + + // + // Registration APIs + // + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + internal static extern unsafe uint EventRegister( + [In] ref Guid providerId, + [In]EtwEnableCallback enableCallback, + [In]void* callbackContext, + [In][Out]ref long registrationHandle + ); + + // + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventUnregister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + internal static extern uint EventUnregister([In] long registrationHandle); + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteString", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + internal static extern unsafe int EventWriteString( + [In] long registrationHandle, + [In] byte level, + [In] long keyword, + [In] string msg + ); + + [StructLayout(LayoutKind.Sequential)] + unsafe internal struct EVENT_FILTER_DESCRIPTOR + { + public long Ptr; + public int Size; + public int Type; + }; + + /// + /// Call the ETW native API EventWriteTransfer and checks for invalid argument error. + /// The implementation of EventWriteTransfer on some older OSes (Windows 2008) does not accept null relatedActivityId. + /// So, for these cases we will retry the call with an empty Guid. + /// + internal static int EventWriteTransferWrapper(long registrationHandle, + ref EventDescriptor eventDescriptor, + Guid* activityId, + Guid* relatedActivityId, + int userDataCount, + EventProvider.EventData* userData) + { + int HResult = EventWriteTransfer(registrationHandle, ref eventDescriptor, activityId, relatedActivityId, userDataCount, userData); + if (HResult == ERROR_INVALID_PARAMETER && relatedActivityId == null) + { + Guid emptyGuid = Guid.Empty; + HResult = EventWriteTransfer(registrationHandle, ref eventDescriptor, activityId, &emptyGuid, userDataCount, userData); + } + + return HResult; + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteTransfer", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks + private static extern int EventWriteTransfer( + [In] long registrationHandle, + [In] ref EventDescriptor eventDescriptor, + [In] Guid* activityId, + [In] Guid* relatedActivityId, + [In] int userDataCount, + [In] EventProvider.EventData* userData + ); + + internal enum ActivityControl : uint + { + EVENT_ACTIVITY_CTRL_GET_ID = 1, + EVENT_ACTIVITY_CTRL_SET_ID = 2, + EVENT_ACTIVITY_CTRL_CREATE_ID = 3, + EVENT_ACTIVITY_CTRL_GET_SET_ID = 4, + EVENT_ACTIVITY_CTRL_CREATE_SET_ID = 5 + }; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventActivityIdControl", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks + internal static extern int EventActivityIdControl([In] ActivityControl ControlCode, [In][Out] ref Guid ActivityId); + + internal enum EVENT_INFO_CLASS + { + BinaryTrackInfo, + SetEnableAllKeywords, + SetTraits, + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EventSetInformation", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks + internal static extern int EventSetInformation( + [In] long registrationHandle, + [In] EVENT_INFO_CLASS informationClass, + [In] void* eventInformation, + [In] int informationLength); + + // Support for EnumerateTraceGuidsEx + internal enum TRACE_QUERY_INFO_CLASS + { + TraceGuidQueryList, + TraceGuidQueryInfo, + TraceGuidQueryProcess, + TraceStackTracingInfo, + MaxTraceSetInfoClass + }; + + internal struct TRACE_GUID_INFO + { + public int InstanceCount; + public int Reserved; + }; + + internal struct TRACE_PROVIDER_INSTANCE_INFO + { + public int NextOffset; + public int EnableCount; + public int Pid; + public int Flags; + }; + + internal struct TRACE_ENABLE_INFO + { + public int IsEnabled; + public byte Level; + public byte Reserved1; + public ushort LoggerId; + public int EnableProperty; + public int Reserved2; + public long MatchAnyKeyword; + public long MatchAllKeyword; + }; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] + [DllImport(ADVAPI32, ExactSpelling = true, EntryPoint = "EnumerateTraceGuidsEx", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] + [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks + internal static extern int EnumerateTraceGuidsEx( + TRACE_QUERY_INFO_CLASS TraceQueryInfoClass, + void* InBuffer, + int InBufferSize, + void* OutBuffer, + int OutBufferSize, + ref int ReturnLength); + +#pragma warning restore CS0649 + } + } +} diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj new file mode 100644 index 0000000000..33e247edf7 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj @@ -0,0 +1,27 @@ + + + + + Microsoft.Diagnostics.Tracing.EventSource + {0CAF38F5-C7E7-46F2-8F39-C5D57492FF7F} + $(DefineConstants);NO_EVENTCOMMANDEXECUTED_SUPPORT;ES_BUILD_STANDALONE;FEATURE_MANAGED_ETW + + + true + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Resources/Strings.resx b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Resources/Strings.resx new file mode 100644 index 0000000000..412c756441 --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/Resources/Strings.resx @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Abstract event source must not declare event methods ({0} with ID {1}). + + + Abstract event source must not declare {0} nested type. + + + Getting out of bounds during scalar addition. + + + Channel {0} does not match event channel value {1}. + + + Data descriptors are out of range. + + + Multiple definitions for string "{0}". + + + The type of {0} is not expected in {1}. + + + Channel {0} has a value of {1} which is outside the legal range (16-254). + + + Event {0} has ID {1} which is already in use. + + + Event {0} (with ID {1}) has a non-default opcode but not a task. + + + Event method {0} (with ID {1}) is an explicit interface method implementation. Re-write method as implicit implementation. + + + Event {0} (with ID {1}) has a name that is not the concatenation of its task name and opcode. + + + Event name {0} used more than once. If you wish to overload a method, the overloaded method should have a NonEvent attribute. + + + Event {0} was called with {1} argument(s), but it is defined with {2} parameter(s). + + + An instance of EventSource with Guid {0} already exists. + + + Event {0} specifies an Admin channel {1}. It must specify a Message property. + + + Keyword {0} has a value of {1} which is outside the legal range (0-0x0000080000000000). + + + Opcode {0} has a value of {1} which is outside the legal range (11-238). + + + Task {0} has a value of {1} which is outside the legal range (1-65535). + + + Incorrectly-authored TypeInfo - a type should be serialized as one field or as one group + + + Invalid command value. + + + Can't specify both etw event format flags. + + + Keywords {0} and {1} are defined with the same value ({2}). + + + Value {0} for keyword {1} needs to be a power of 2. + + + Creating an EventListener inside a EventListener callback. + + + Listener not found. + + + An error occurred when writing to a listener. + + + Attempt to define more than the maximum limit of 8 channels for a provider. + + + Event {0} is givien event ID {1} but {2} was passed to WriteEvent. + + + The Guid of an EventSource must be non zero. + + + The name of an EventSource must not be null. + + + Event IDs must be positive integers. + + + No Free Buffers available from the operating system (e.g. event rate too fast). + + + The API supports only anonymous types or types decorated with the EventDataAttribute. Non-compliant type: {0} dataType. + + + EventSource expects the first parameter of the Event method to be of type Guid and to be named "relatedActivityId" when calling WriteEventWithRelatedActivityId. + + + Arrays of Binary are not supported. + + + Arrays of Nil are not supported. + + + Arrays of null-terminated string are not supported. + + + Enumerables of custom-serialized data are not supported + + + Nested arrays/enumerables are not supported. + + + Null passed as a event argument. + + + Opcodes {0} and {1} are defined with the same value ({2}). + + + Pins are out of range. + + + Recursive type definition is not supported. + + + Bit position in AllKeywords ({0}) must equal the command argument named "EtwSessionKeyword" ({1}). + + + An event with stop suffix must follow a corresponding event with a start suffix. + + + Tasks {0} and {1} are defined with the same value ({2}). + + + Event {0} (with ID {1}) has the same task/opcode pair as event {2} (with ID {3}). + + + Too many arguments. + + + Too many fields in structure. + + + EventSource({0}, {1}) + + + Event source types must be sealed or abstract. + + + Event source types must derive from EventSource. + + + Use of undefined channel value {0} for event {1}. + + + Use of undefined keyword value {0} for event {1}. + + + Use of undefined opcode value {0} for event {1}. + + + Unsupported type {0} in event source. + + + Event {0} specifies an illegal or unsupported formatting message ("{1}"). + + + The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly. + + diff --git a/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/RuntimeSpecific.cs b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/RuntimeSpecific.cs new file mode 100644 index 0000000000..014995117c --- /dev/null +++ b/external/corefx/src/Microsoft.Diagnostics.EventSource.Tracing.Redist/src/RuntimeSpecific.cs @@ -0,0 +1,245 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Microsoft.Reflection; +using Microsoft.Win32; + +#if ES_BUILD_STANDALONE +namespace Microsoft.Diagnostics.Tracing +#else +namespace System.Diagnostics.Tracing +#endif +{ + public partial class EventSource + { +#if FEATURE_MANAGED_ETW && FEATURE_PERFTRACING + // For non-Windows, we use a thread-local variable to hold the activity ID. + // On Windows, ETW has it's own thread-local variable and we participate in its use. + [ThreadStatic] + private static Guid s_currentThreadActivityId; +#endif // FEATURE_MANAGED_ETW && FEATURE_PERFTRACING + + // ActivityID support (see also WriteEventWithRelatedActivityIdCore) + /// + /// When a thread starts work that is on behalf of 'something else' (typically another + /// thread or network request) it should mark the thread as working on that other work. + /// This API marks the current thread as working on activity 'activityID'. This API + /// should be used when the caller knows the thread's current activity (the one being + /// overwritten) has completed. Otherwise, callers should prefer the overload that + /// return the oldActivityThatWillContinue (below). + /// + /// All events created with the EventSource on this thread are also tagged with the + /// activity ID of the thread. + /// + /// It is common, and good practice after setting the thread to an activity to log an event + /// with a 'start' opcode to indicate that precise time/thread where the new activity + /// started. + /// + /// A Guid that represents the new activity with which to mark + /// the current thread + public static void SetCurrentThreadActivityId(Guid activityId) + { + if (TplEtwProvider.Log != null) + TplEtwProvider.Log.SetActivityId(activityId); +#if FEATURE_MANAGED_ETW +#if FEATURE_ACTIVITYSAMPLING + Guid newId = activityId; +#endif // FEATURE_ACTIVITYSAMPLING + // We ignore errors to keep with the convention that EventSources do not throw errors. + // Note we can't access m_throwOnWrites because this is a static method. + +#if FEATURE_PERFTRACING + s_currentThreadActivityId = activityId; +#elif PLATFORM_WINDOWS + if (UnsafeNativeMethods.ManifestEtw.EventActivityIdControl( + UnsafeNativeMethods.ManifestEtw.ActivityControl.EVENT_ACTIVITY_CTRL_GET_SET_ID, + ref activityId) == 0) +#endif // FEATURE_PERFTRACING + { +#if FEATURE_ACTIVITYSAMPLING + var activityDying = s_activityDying; + if (activityDying != null && newId != activityId) + { + if (activityId == Guid.Empty) + { + activityId = FallbackActivityId; + } + // OutputDebugString(string.Format("Activity dying: {0} -> {1}", activityId, newId)); + activityDying(activityId); // This is actually the OLD activity ID. + } +#endif // FEATURE_ACTIVITYSAMPLING + } +#endif // FEATURE_MANAGED_ETW + } + + /// + /// When a thread starts work that is on behalf of 'something else' (typically another + /// thread or network request) it should mark the thread as working on that other work. + /// This API marks the current thread as working on activity 'activityID'. It returns + /// whatever activity the thread was previously marked with. There is a convention that + /// callers can assume that callees restore this activity mark before the callee returns. + /// To encourage this, this API returns the old activity, so that it can be restored later. + /// + /// All events created with the EventSource on this thread are also tagged with the + /// activity ID of the thread. + /// + /// It is common, and good practice after setting the thread to an activity to log an event + /// with a 'start' opcode to indicate that precise time/thread where the new activity + /// started. + /// + /// A Guid that represents the new activity with which to mark + /// the current thread + /// The Guid that represents the current activity + /// which will continue at some point in the future, on the current thread + public static void SetCurrentThreadActivityId(Guid activityId, out Guid oldActivityThatWillContinue) + { + oldActivityThatWillContinue = activityId; +#if FEATURE_MANAGED_ETW + // We ignore errors to keep with the convention that EventSources do not throw errors. + // Note we can't access m_throwOnWrites because this is a static method. + +#if FEATURE_PERFTRACING + oldActivityThatWillContinue = s_currentThreadActivityId; + s_currentThreadActivityId = activityId; +#elif PLATFORM_WINDOWS + UnsafeNativeMethods.ManifestEtw.EventActivityIdControl( + UnsafeNativeMethods.ManifestEtw.ActivityControl.EVENT_ACTIVITY_CTRL_GET_SET_ID, + ref oldActivityThatWillContinue); +#endif // FEATURE_PERFTRACING +#endif // FEATURE_MANAGED_ETW + + // We don't call the activityDying callback here because the caller has declared that + // it is not dying. + if (TplEtwProvider.Log != null) + TplEtwProvider.Log.SetActivityId(activityId); + } + + /// + /// Retrieves the ETW activity ID associated with the current thread. + /// + public static Guid CurrentThreadActivityId + { + get + { + // We ignore errors to keep with the convention that EventSources do not throw + // errors. Note we can't access m_throwOnWrites because this is a static method. + Guid retVal = new Guid(); +#if FEATURE_MANAGED_ETW +#if FEATURE_PERFTRACING + retVal = s_currentThreadActivityId; +#elif PLATFORM_WINDOWS + UnsafeNativeMethods.ManifestEtw.EventActivityIdControl( + UnsafeNativeMethods.ManifestEtw.ActivityControl.EVENT_ACTIVITY_CTRL_GET_ID, + ref retVal); +#endif // FEATURE_PERFTRACING +#endif // FEATURE_MANAGED_ETW + return retVal; + } + } + + private int GetParameterCount(EventMetadata eventData) + { + return eventData.Parameters.Length; + } + + private Type GetDataType(EventMetadata eventData, int parameterId) + { + return eventData.Parameters[parameterId].ParameterType; + } + + private static string GetResourceString(string key, params object[] args) + { + return string.Format(Resources.GetResourceString(key), args); + } + + private static readonly bool m_EventSourcePreventRecursion = false; + } + + internal partial class ManifestBuilder + { + private string GetTypeNameHelper(Type type) + { + switch (type.GetTypeCode()) + { + case TypeCode.Boolean: + return "win:Boolean"; + case TypeCode.Byte: + return "win:UInt8"; + case TypeCode.Char: + case TypeCode.UInt16: + return "win:UInt16"; + case TypeCode.UInt32: + return "win:UInt32"; + case TypeCode.UInt64: + return "win:UInt64"; + case TypeCode.SByte: + return "win:Int8"; + case TypeCode.Int16: + return "win:Int16"; + case TypeCode.Int32: + return "win:Int32"; + case TypeCode.Int64: + return "win:Int64"; + case TypeCode.String: + return "win:UnicodeString"; + case TypeCode.Single: + return "win:Float"; + case TypeCode.Double: + return "win:Double"; + case TypeCode.DateTime: + return "win:FILETIME"; + default: + if (type == typeof(Guid)) + return "win:GUID"; + else if (type == typeof(IntPtr)) + return "win:Pointer"; + else if ((type.IsArray || type.IsPointer) && type.GetElementType() == typeof(byte)) + return "win:Binary"; + + ManifestError(Resources.GetResourceString("EventSource_UnsupportedEventTypeInManifest", type.Name), true); + return string.Empty; + } + } + } + + internal partial class EventProvider + { + internal unsafe int SetInformation( + UnsafeNativeMethods.ManifestEtw.EVENT_INFO_CLASS eventInfoClass, + IntPtr data, + uint dataSize) + { + int status = UnsafeNativeMethods.ManifestEtw.ERROR_NOT_SUPPORTED; + + if (!m_setInformationMissing) + { + try + { + status = UnsafeNativeMethods.ManifestEtw.EventSetInformation( + m_regHandle, + eventInfoClass, + (void*)data, + (int)dataSize); + } + catch (TypeLoadException) + { + m_setInformationMissing = true; + } + } + + return status; + } + } + + internal static class Resources + { + internal static string GetResourceString(string key, params object[] args) + { + return string.Format(Resources.GetResourceString(key), args); + } + } +} diff --git a/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Symbols.vb b/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Symbols.vb index 6fa3b11d5a..5bf73e6e9f 100644 --- a/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Symbols.vb +++ b/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Symbols.vb @@ -510,11 +510,6 @@ Namespace Microsoft.VisualBasic.CompilerServices Return method.GetGenericArguments End Function - Friend Shared Function GetTypeParameters(ByVal type As Type) As Type() - Debug.Assert(type.GetGenericTypeDefinition Is Nothing, "expected unbound generic type") - Return type.GetGenericArguments - End Function - Friend Shared Function GetTypeArguments(ByVal type As Type) As Type() Debug.Assert(type.GetGenericTypeDefinition IsNot Nothing, "expected bound generic type") Return type.GetGenericArguments diff --git a/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.LateBinder.vb b/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.LateBinder.vb index 661190f11e..00dc926510 100644 --- a/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.LateBinder.vb +++ b/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.LateBinder.vb @@ -47,9 +47,6 @@ Namespace Microsoft.VisualBasic.CompilerServices Friend Const OptionCompareTextFlags As CompareOptions = (CompareOptions.IgnoreCase Or CompareOptions.IgnoreWidth Or CompareOptions.IgnoreKanaType) - ' DON'T ACCESS DIRECTLY! Go through the property below - Private Shared s_VBAResourceManager As System.Resources.ResourceManager - Private Shared s_triedLoadingResourceManager As Boolean Private Shared ReadOnly s_resourceManagerSyncObj As Object = New Object Friend Shared m_achIntlSpace() As Char = {chSpace, chIntlSpace} @@ -79,7 +76,7 @@ Namespace Microsoft.VisualBasic.CompilerServices ' This one is exposed because I have to be able to get at localized error ' strings from the MY template ' Param: ID - Identifier for the string to be retrieved - ' Param: Args - An array of params used to replace placeholders. + ' Param: Args - An array of params used to replace placeholders. 'Returns: The resource string if found or an error message string '***************************************************************************** Public Shared Function GetResourceString(ByVal resourceKey As String, ByVal ParamArray args() As String) As String diff --git a/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.vb b/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.vb index bd0e48bacb..1af0a3d6b3 100644 --- a/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.vb +++ b/external/corefx/src/Microsoft.VisualBasic/src/Microsoft/VisualBasic/CompilerServices/Utils.vb @@ -56,35 +56,11 @@ Namespace Global.Microsoft.VisualBasic.CompilerServices Friend Module ReflectionExtensions - - Public Function MemberType(ByVal memberInfo As MemberInfo) As MemberTypes - If TypeOf memberInfo Is ConstructorInfo Then - Return MemberTypes.Constructor - ElseIf TypeOf memberInfo Is MethodInfo Then - Return MemberTypes.Method - ElseIf TypeOf memberInfo Is PropertyInfo Then - Return MemberTypes.Property - ElseIf TypeOf memberInfo Is FieldInfo Then - Return MemberTypes.Field - ElseIf TypeOf memberInfo Is EventInfo Then - Return MemberTypes.Event - ElseIf TypeOf memberInfo Is System.Reflection.TypeInfo Then - Return MemberTypes.TypeInfo - Else - Throw New System.ArgumentException - End If - End Function - Public Function GetTypeCode(type As Type) As TypeCode Return Type.GetTypeCode(type) End Function - - Public Function IsSubclassOf(source As Type, other As Type) As Boolean - Return source.IsSubclassOf(other) - End Function - Public ReadOnly Property BindingFlagsInvokeMethod As BindingFlags Get Return CType(256, BindingFlags) ' BindingFlags.InvokeMethod @@ -334,7 +310,7 @@ Namespace Global.Microsoft.VisualBasic.CompilerServices ' fallback to "IsEquivalentTo" Dim fallbackMemberEquivalence As Func(Of MethodBase, MethodBase, Boolean) = Function(m1param, m2param) m1param.IsEquivalentTo(m2param) - ' fallback must work + ' fallback must work s_MemberEquivalence = fallbackMemberEquivalence Return fallbackMemberEquivalence(m1, m2) End Function diff --git a/external/corefx/src/Microsoft.VisualBasic/tests/Microsoft.VisualBasic.Tests.csproj b/external/corefx/src/Microsoft.VisualBasic/tests/Microsoft.VisualBasic.Tests.csproj index 0c98cb1ef7..3e0bee673b 100644 --- a/external/corefx/src/Microsoft.VisualBasic/tests/Microsoft.VisualBasic.Tests.csproj +++ b/external/corefx/src/Microsoft.VisualBasic/tests/Microsoft.VisualBasic.Tests.csproj @@ -3,8 +3,6 @@ {325260D6-D5DD-4E06-9DA2-9AF2AD9DE8C8} - - chk @@ -12,9 +10,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/Microsoft.VisualBasic/tests/UtilsTests.cs b/external/corefx/src/Microsoft.VisualBasic/tests/UtilsTests.cs index 1cfbd927d4..7c2310a7f7 100644 --- a/external/corefx/src/Microsoft.VisualBasic/tests/UtilsTests.cs +++ b/external/corefx/src/Microsoft.VisualBasic/tests/UtilsTests.cs @@ -71,7 +71,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests Assert.Throws(() => Utils.CopyArray(new int[1], new int[1, 1])); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public void CopyArray_RankGreaterThanTwoAndNonMatchingBounds_ThrowsArrayTypeMismatchException() { Array array1 = Array.CreateInstance(typeof(int), new int[] { 1, 2, 3 }, new int[] { 2, 3, 4 }); @@ -80,7 +80,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests Assert.Throws(() => Utils.CopyArray(array2, array1)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public void CopyArray_NonMatchingBounds_ThrowsArgumentOutOfRangeException() { Array array1 = Array.CreateInstance(typeof(int), new int[] { 1, 2 }, new int[] { 2, 3 }); diff --git a/external/corefx/src/Microsoft.Win32.Primitives/tests/Microsoft.Win32.Primitives.Tests.csproj b/external/corefx/src/Microsoft.Win32.Primitives/tests/Microsoft.Win32.Primitives.Tests.csproj index 43e29a6460..c6f16ad480 100644 --- a/external/corefx/src/Microsoft.Win32.Primitives/tests/Microsoft.Win32.Primitives.Tests.csproj +++ b/external/corefx/src/Microsoft.Win32.Primitives/tests/Microsoft.Win32.Primitives.Tests.csproj @@ -8,9 +8,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/Microsoft.Win32.Registry.AccessControl/pkg/Microsoft.Win32.Registry.AccessControl.pkgproj b/external/corefx/src/Microsoft.Win32.Registry.AccessControl/pkg/Microsoft.Win32.Registry.AccessControl.pkgproj index 4cbbcf4691..2b744f2091 100644 --- a/external/corefx/src/Microsoft.Win32.Registry.AccessControl/pkg/Microsoft.Win32.Registry.AccessControl.pkgproj +++ b/external/corefx/src/Microsoft.Win32.Registry.AccessControl/pkg/Microsoft.Win32.Registry.AccessControl.pkgproj @@ -10,11 +10,7 @@ netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Win32.Registry/Microsoft.Win32.Registry.sln b/external/corefx/src/Microsoft.Win32.Registry/Microsoft.Win32.Registry.sln index 122533c637..75f92de41b 100644 --- a/external/corefx/src/Microsoft.Win32.Registry/Microsoft.Win32.Registry.sln +++ b/external/corefx/src/Microsoft.Win32.Registry/Microsoft.Win32.Registry.sln @@ -30,10 +30,10 @@ Global {20A2BA2C-5517-483F-8FFE-643441A59852}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {20A2BA2C-5517-483F-8FFE-643441A59852}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU {20A2BA2C-5517-483F-8FFE-643441A59852}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU - {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {D3F18ACC-D327-4ABB-BA6C-E9C34A041B2F}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {EEC02D4E-217E-4B4D-A7DA-5038FAD44A18}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {EEC02D4E-217E-4B4D-A7DA-5038FAD44A18}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {EEC02D4E-217E-4B4D-A7DA-5038FAD44A18}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU diff --git a/external/corefx/src/Microsoft.Win32.Registry/pkg/Microsoft.Win32.Registry.pkgproj b/external/corefx/src/Microsoft.Win32.Registry/pkg/Microsoft.Win32.Registry.pkgproj index 4b05ca1b12..e444f293b3 100644 --- a/external/corefx/src/Microsoft.Win32.Registry/pkg/Microsoft.Win32.Registry.pkgproj +++ b/external/corefx/src/Microsoft.Win32.Registry/pkg/Microsoft.Win32.Registry.pkgproj @@ -10,11 +10,7 @@ netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.Win32.Registry/src/Configurations.props b/external/corefx/src/Microsoft.Win32.Registry/src/Configurations.props index 352e23e9b6..a109dc94d8 100644 --- a/external/corefx/src/Microsoft.Win32.Registry/src/Configurations.props +++ b/external/corefx/src/Microsoft.Win32.Registry/src/Configurations.props @@ -2,8 +2,8 @@ - netcoreapp-Windows_NT; - netcoreapp-Unix; + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; netstandard; netfx-Windows_NT; diff --git a/external/corefx/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj b/external/corefx/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj index 541d29e3ee..6a0b6d8f82 100644 --- a/external/corefx/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj +++ b/external/corefx/src/Microsoft.Win32.Registry/src/Microsoft.Win32.Registry.csproj @@ -15,15 +15,15 @@ --> false - - - - + + + + - + Common\Interop\Windows\Interop.RegistryOptions.cs @@ -40,7 +40,7 @@ - + Common\Interop\Windows\Interop.Libraries.cs diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/dir.props b/external/corefx/src/Microsoft.XmlSerializer.Generator/dir.props index 4c94be0e4d..b090298bf1 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/dir.props +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/dir.props @@ -2,9 +2,11 @@ + preview1 1.0.0 true 1.0.0.0 + $(AssemblyVersion) Open diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/GenerateNupkgProps.targets b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/GenerateNupkgProps.targets new file mode 100644 index 0000000000..ce4649910d --- /dev/null +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/GenerateNupkgProps.targets @@ -0,0 +1,32 @@ + + + + + GenerateNupkgProps; + $(BuildDependsOn) + + $(PackageOutputPath)build/ + $(PackageBuildPath)$(Id).props + + + + build\ + + + + + +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <DotNetCliToolReference Include="$(Id)" Version="$(PackageVersion)" /> + </ItemGroup> +</Project> + + + + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/Microsoft.XmlSerializer.Generator.pkgproj b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/Microsoft.XmlSerializer.Generator.pkgproj index 763dd414d3..fe2f64b2e0 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/Microsoft.XmlSerializer.Generator.pkgproj +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/Microsoft.XmlSerializer.Generator.pkgproj @@ -4,5 +4,18 @@ + + true + + + + + build\ + + + \lib\netstandard2.0\ + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/Microsoft.XmlSerializer.Generator.targets b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/Microsoft.XmlSerializer.Generator.targets new file mode 100644 index 0000000000..8ebc0d32c4 --- /dev/null +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/Microsoft.XmlSerializer.Generator.targets @@ -0,0 +1,27 @@ + + + $(AssemblyName).XmlSerializers + $(IntermediateOutputPath)$(SerializerName).dll + $(IntermediateOutputPath)$(SerializerName).pdb + $(IntermediateOutputPath)$(SerializerName).cs + SGEN : warning SGEN1: Fail to generate the serializer for $(AssemblyName).dll. Please follow the instructions in https://go.microsoft.com/fwlink/?linkid=858594 and try again. + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/dotnet-Microsoft.XmlSerializer.Generator.runtimeconfig.json b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/dotnet-Microsoft.XmlSerializer.Generator.runtimeconfig.json new file mode 100644 index 0000000000..7539019b10 --- /dev/null +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/dotnet-Microsoft.XmlSerializer.Generator.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "netcoreapp2.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "2.0.0" + } + } +} \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/prefercliruntime b/external/corefx/src/Microsoft.XmlSerializer.Generator/pkg/build/prefercliruntime new file mode 100644 index 0000000000..e69de29bb2 diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets new file mode 100644 index 0000000000..a047acd078 --- /dev/null +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/GenerateThisAssemblyCs.targets @@ -0,0 +1,52 @@ + + + + + GenerateThisAssemblyCs; + $(CompileDependsOn) + + + + + + + + + +using System%3B +namespace Microsoft.XmlSerializer.Generator +{ + internal static class ThisAssembly + { + internal const string PackageVersion = "$(PackageVersion)"%3B + internal const string AssemblyVersion = "$(AssemblyVersion)"%3B + internal const string Version = "$(AssemblyFileVersion)"%3B + internal const string PreReleaseLabel = "$(PreReleaseLabel)"%3B + + internal static string InformationalVersion + { + get + { + if (string.IsNullOrEmpty(PreReleaseLabel)) + { + return PackageVersion%3B + } + else + { + return $"{PackageVersion}-{PreReleaseLabel}"%3B + } + } + } + } +} + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft.XmlSerializer.Generator.csproj b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft.XmlSerializer.Generator.csproj index 4c24f60006..5f67201f4c 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft.XmlSerializer.Generator.csproj +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft.XmlSerializer.Generator.csproj @@ -3,11 +3,14 @@ {80958E8B-2FEB-4F95-83F9-825CA1ED26F8} - Microsoft.XmlSerializer.Generator + dotnet-Microsoft.XmlSerializer.Generator true ..\..\System.Private.Xml\src\Resources\Strings.resx $(DefineConstants);XMLSERIALIZERGENERATOR ..\..\System.Private.Xml\src + Exe + .dll + $(NoWarn);0169;0414;0649 @@ -151,11 +154,6 @@ - - - - - - + \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft/XmlSerializer/Generator/XmlSerializationWriter.cs b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft/XmlSerializer/Generator/XmlSerializationWriter.cs index 13f85cf609..22c8fe6336 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft/XmlSerializer/Generator/XmlSerializationWriter.cs +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Microsoft/XmlSerializer/Generator/XmlSerializationWriter.cs @@ -2044,7 +2044,16 @@ namespace Microsoft.XmlSerializer.Generator else if (type == typeof(Int32)) Writer.Write(((Int32)value).ToString(null, NumberFormatInfo.InvariantInfo)); else if (type == typeof(Double)) - Writer.Write(((Double)value).ToString("R", NumberFormatInfo.InvariantInfo)); + { + if (double.IsNaN((Double)value)) + { + Writer.Write("double.NaN"); + } + else + { + Writer.Write(((Double)value).ToString("R", NumberFormatInfo.InvariantInfo)); + } + } else if (type == typeof(Boolean)) Writer.Write((bool)value ? "true" : "false"); else if ((type == typeof(Int16)) || (type == typeof(Int64)) || (type == typeof(UInt16)) || (type == typeof(UInt32)) || (type == typeof(UInt64)) || (type == typeof(Byte)) || (type == typeof(SByte))) @@ -2058,8 +2067,15 @@ namespace Microsoft.XmlSerializer.Generator } else if (type == typeof(Single)) { - Writer.Write(((Single)value).ToString("R", NumberFormatInfo.InvariantInfo)); - Writer.Write("f"); + if (Single.IsNaN((Single)value)) + { + Writer.Write("System.Single.NaN"); + } + else + { + Writer.Write(((Single)value).ToString("R", NumberFormatInfo.InvariantInfo)); + Writer.Write("f"); + } } else if (type == typeof(Decimal)) { diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Resources/Microsoft.XmlSerializer.Generator.rd.xml b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Resources/Microsoft.XmlSerializer.Generator.rd.xml deleted file mode 100644 index 9c983cad2f..0000000000 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Resources/Microsoft.XmlSerializer.Generator.rd.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Sgen.cs b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Sgen.cs index 94e0c5bf3b..df04c29a81 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Sgen.cs +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/src/Sgen.cs @@ -12,13 +12,12 @@ using System.Threading; namespace Microsoft.XmlSerializer.Generator { - public class Sgen + internal class Sgen { public static int Main(string[] args) { Sgen sgen = new Sgen(); - sgen.Run(args); - return 0; + return sgen.Run(args); } private int Run(string[] args) @@ -29,18 +28,21 @@ namespace Microsoft.XmlSerializer.Generator var errs = new ArrayList(); bool force = false; bool proxyOnly = false; + bool disableRun = true; + bool noLogo = false; + bool parsableErrors = false; + bool silent = false; + bool warnings = false; try { for (int i = 0; i < args.Length; i++) { - bool argument = false; string arg = args[i]; string value = string.Empty; if (arg.StartsWith("/") || arg.StartsWith("-")) { - argument = true; int colonPos = arg.IndexOf(":"); if (colonPos != -1) { @@ -49,22 +51,15 @@ namespace Microsoft.XmlSerializer.Generator } } + string originalArg = arg; arg = arg.ToLower(CultureInfo.InvariantCulture); + if (ArgumentMatch(arg, "?") || ArgumentMatch(arg, "help")) { WriteHeader(); WriteHelp(); return 0; } - else if (!argument && (arg.EndsWith(".dll") || arg.EndsWith(".exe"))) - { - if (assembly != null) - { - errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg)); - } - - assembly = arg; - } else if (ArgumentMatch(arg, "force")) { force = true; @@ -86,18 +81,63 @@ namespace Microsoft.XmlSerializer.Generator { types.Add(value); } + else if (ArgumentMatch(arg, "assembly")) + { + if (assembly != null) + { + errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg)); + } + + assembly = value; + } + else if (ArgumentMatch(arg, "quiet")) + { + disableRun = false; + } + else if (ArgumentMatch(arg, "nologo")) + { + noLogo = true; + } + else if (ArgumentMatch(arg, "silent")) + { + silent = true; + } + else if (ArgumentMatch(arg, "parsableerrors")) + { + parsableErrors = true; + } + else if (ArgumentMatch(arg, "verbose")) + { + warnings = true; + } else { - errs.Add(SR.Format(SR.ErrInvalidArgument, arg)); - continue; + if (arg.EndsWith(".dll") || arg.EndsWith(".exe")) + { + if (assembly != null) + { + errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg)); + } + + assembly = originalArg; + } + else + { + errs.Add(SR.Format(SR.ErrInvalidArgument, arg)); + } } } + if (!noLogo) + { + WriteHeader(); + } + if (errs.Count > 0) { foreach (string err in errs) { - Console.Error.WriteLine(FormatMessage(true, SR.Format(SR.Warning, err))); + Console.Error.WriteLine(FormatMessage(parsableErrors, true, SR.Format(SR.Warning, err))); } } @@ -105,14 +145,21 @@ namespace Microsoft.XmlSerializer.Generator { if (assembly == null) { - Console.Error.WriteLine(FormatMessage(false, SR.Format(SR.ErrMissingRequiredArgument, SR.Format(SR.ErrAssembly, "assembly")))); + Console.Error.WriteLine(FormatMessage(parsableErrors, false, SR.Format(SR.ErrMissingRequiredArgument, SR.Format(SR.ErrAssembly, "assembly")))); } WriteHelp(); return 0; } - GenerateFile(types, assembly, proxyOnly, force, codePath); + if(disableRun) + { + Console.WriteLine("This tool is not intended to be used directly."); + Console.WriteLine("Please refer to https://github.com/dotnet/core/blob/master/samples/xmlserializergenerator-instructions.md on how to use it."); + return 0; + } + + GenerateFile(types, assembly, proxyOnly, silent, warnings, force, codePath, parsableErrors); } catch (Exception e) { @@ -121,13 +168,14 @@ namespace Microsoft.XmlSerializer.Generator throw; } + WriteError(e, parsableErrors); return 1; } return 0; } - private void GenerateFile(List typeNames, string assemblyName, bool proxyOnly, bool force, string outputDirectory) + private void GenerateFile(List typeNames, string assemblyName, bool proxyOnly, bool silent, bool warnings, bool force, string outputDirectory, bool parsableerrors) { Assembly assembly = LoadAssembly(assemblyName, true); Type[] types; @@ -161,7 +209,7 @@ namespace Microsoft.XmlSerializer.Generator Type type = assembly.GetType(typeName); if (type == null) { - Console.Error.WriteLine(FormatMessage(false, SR.Format(SR.ErrorDetails, SR.Format(SR.ErrLoadType, typeName, assemblyName)))); + Console.Error.WriteLine(FormatMessage(parsableerrors, false, SR.Format(SR.ErrorDetails, SR.Format(SR.ErrLoadType, typeName, assemblyName)))); } types[typeIndex++] = type; @@ -197,7 +245,7 @@ namespace Microsoft.XmlSerializer.Generator if (!proxyOnly) { - ImportType(type, mappings, importedTypes, importer); + ImportType(type, mappings, importedTypes, warnings, importer, parsableerrors); } } @@ -227,7 +275,8 @@ namespace Microsoft.XmlSerializer.Generator throw new ArgumentException(SR.Format(SR.ErrDirectoryNotExists, codePath, outputDirectory)); } - bool success; + bool success = false; + bool toDeleteFile = true; try { @@ -243,19 +292,34 @@ namespace Microsoft.XmlSerializer.Generator } catch (UnauthorizedAccessException) { + toDeleteFile = false; throw new UnauthorizedAccessException(SR.Format(SR.DirectoryAccessDenied, outputDirectory)); } + finally + { + if (!success && toDeleteFile && File.Exists(codePath)) + { + File.Delete(codePath); + } + } if (success) { - Console.Out.WriteLine(SR.Format(SR.InfoAssemblyName, codePath)); - Console.Out.WriteLine(SR.Format(SR.InfoGeneratedAssembly, assembly.Location, codePath)); + if (!silent) + { + Console.Out.WriteLine(SR.Format(SR.InfoFileName, codePath)); + Console.Out.WriteLine(SR.Format(SR.InfoGeneratedFile, assembly.Location, codePath)); + } } else { - Console.Out.WriteLine(FormatMessage(false, SR.Format(SR.ErrGenerationFailed, assembly.Location))); + Console.Out.WriteLine(FormatMessage(parsableerrors, false, SR.Format(SR.ErrGenerationFailed, assembly.Location))); } } + else + { + Console.Out.WriteLine(FormatMessage(parsableerrors, true, SR.Format(SR.InfoNoSerializableTypes, assembly.Location))); + } } // assumes all same case. @@ -270,7 +334,7 @@ namespace Microsoft.XmlSerializer.Generator return (arg == formal || (arg.Length == 1 && arg[0] == formal[0])); } - private void ImportType(Type type, ArrayList mappings, ArrayList importedTypes, XmlReflectionImporter importer) + private void ImportType(Type type, ArrayList mappings, ArrayList importedTypes, bool verbose, XmlReflectionImporter importer, bool parsableerrors) { XmlTypeMapping xmlTypeMapping = null; var localImporter = new XmlReflectionImporter(); @@ -284,10 +348,33 @@ namespace Microsoft.XmlSerializer.Generator { throw; } + + if (verbose) + { + Console.Out.WriteLine(FormatMessage(parsableerrors, true, SR.Format(SR.InfoIgnoreType, type.FullName))); + WriteWarning(e, parsableerrors); + } + return; } if (xmlTypeMapping != null) { + if (xmlTypeMapping.Mapping != null && xmlTypeMapping.Mapping is StructMapping) + { + foreach (MemberMapping memberMapping in ((StructMapping)xmlTypeMapping.Mapping).Members) + { + MemberInfo memberInfo = memberMapping.MemberInfo; + if (memberInfo != null && memberInfo.MemberType == MemberTypes.Property) + { + PropertyInfo propertyInfo = memberInfo as PropertyInfo; + if (propertyInfo != null && (propertyInfo.SetMethod == null || !propertyInfo.SetMethod.IsPublic)) + { + return; + } + } + } + } + xmlTypeMapping = importer.ImportTypeMapping(type); mappings.Add(xmlTypeMapping); importedTypes.Add(type); @@ -299,30 +386,67 @@ namespace Microsoft.XmlSerializer.Generator Assembly assembly = null; string path = Path.GetFullPath(assemblyName); assembly = Assembly.LoadFile(path); + if (assembly == null) + { + throw new InvalidOperationException(SR.Format(SR.ErrLoadAssembly, assemblyName)); + } + return assembly; } private void WriteHeader() { // do not localize Copyright header - Console.WriteLine(String.Format(CultureInfo.CurrentCulture, "[Microsoft (R) .NET Framework, Version {0}]", TempAssembly.ThisAssembly.InformationalVersion)); + Console.WriteLine(String.Format(CultureInfo.CurrentCulture, "[Microsoft (R) .NET Core Xml Serialization Generation Utility, Version {0}]", ThisAssembly.InformationalVersion)); Console.WriteLine("Copyright (C) Microsoft Corporation. All rights reserved."); } - void WriteHelp() + private void WriteHelp() { - //TBD - Console.WriteLine("In Development"); + Console.Out.WriteLine(SR.Format(SR.HelpDescription)); + Console.Out.WriteLine(SR.Format(SR.HelpUsage, this.GetType().Assembly.GetName().Name)); + Console.Out.WriteLine(SR.Format(SR.HelpDevOptions)); + Console.Out.WriteLine(SR.Format(SR.HelpAssembly, "/assembly:", "/a:")); + Console.Out.WriteLine(SR.Format(SR.HelpType, "/type:", "/t:")); + Console.Out.WriteLine(SR.Format(SR.HelpProxy, "/proxytypes", "/p")); + Console.Out.WriteLine(SR.Format(SR.HelpForce, "/force", "/f")); + Console.Out.WriteLine(SR.Format(SR.HelpOut, "/out:", "/o:")); + + Console.Out.WriteLine(SR.Format(SR.HelpMiscOptions)); + Console.Out.WriteLine(SR.Format(SR.HelpHelp, "/?", "/help")); } - private static string FormatMessage(bool warning, string message) + private static string FormatMessage(bool parsableerrors, bool warning, string message) { - return FormatMessage(warning, "SGEN1", message); + return FormatMessage(parsableerrors, warning, "SGEN1", message); } - private static string FormatMessage(bool warning, string code, string message) + private static string FormatMessage(bool parsableerrors, bool warning, string code, string message) { + if (!parsableerrors) + { + return message; + } + return "SGEN: " + (warning ? "warning " : "error ") + code + ": " + message; } + + private static void WriteError(Exception e, bool parsableerrors) + { + Console.Error.WriteLine(FormatMessage(parsableerrors, false, e.Message)); + if (e.InnerException != null) + { + WriteError(e.InnerException, parsableerrors); + } + } + + static void WriteWarning(Exception e, bool parsableerrors) + { + Console.Out.WriteLine(FormatMessage(parsableerrors, true, e.Message)); + if (e.InnerException != null) + { + WriteWarning(e.InnerException, parsableerrors); + } + } } } \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/AlwaysPassTest.cs b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/AlwaysPassTest.cs new file mode 100644 index 0000000000..e09b8bba12 --- /dev/null +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/AlwaysPassTest.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Xunit; + +public static partial class XmlSerializerTests +{ + //This is a dummy test that runs on all platform. It is to make sure we have at least one test running in UWP platform, which will exclude all other SGENTESTS. + [Fact] + public static void AlwaysPassTest() + { + Assert.True(true); + } +} diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Configurations.props b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Configurations.props index c398e42e89..eb4a540a92 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Configurations.props +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Configurations.props @@ -3,6 +3,8 @@ netstandard; + uap; + netcoreapp; \ No newline at end of file diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Microsoft.XmlSerializer.Generator.Tests.csproj b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Microsoft.XmlSerializer.Generator.Tests.csproj index 7eada28f7f..f4d52adb2f 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Microsoft.XmlSerializer.Generator.Tests.csproj +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/Microsoft.XmlSerializer.Generator.Tests.csproj @@ -3,15 +3,89 @@ {0D1E2954-A5C7-4B8C-932A-31EB4A96A737} + $(DefineConstants);XMLSERIALIZERGENERATORTESTS + + + true + + + + $(ToolsDir)xunit.console.netcore.runtimeconfig.json + $(TestHostRootPath) + + + + $(ToolsDir)csc.runtimeconfig.json + $(ToolsDir)dotnetcli/ + + + + + + + + + + - + + + + dotnet-Microsoft.XmlSerializer.Generator.runtimeconfig.json + PreserveNewest + - + + + + true + + + + + + $(AssemblyName).XmlSerializers + + + + + + + + - - + + + + + diff --git a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/SGenTests.cs b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/SGenTests.cs index 805556e685..639429dc47 100644 --- a/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/SGenTests.cs +++ b/external/corefx/src/Microsoft.XmlSerializer.Generator/tests/SGenTests.cs @@ -5,16 +5,24 @@ using Xunit; using Microsoft.XmlSerializer.Generator; +using System.IO; +using System; +using System.Reflection; namespace Microsoft.XmlSerializer.Generator.Tests { public static class SgenTests { [Fact] - public static void BasicTest() + public static void SgenCommandTest() { - int n = Sgen.Main(null); + string codefile = "Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs"; + var type = Type.GetType("Microsoft.XmlSerializer.Generator.Sgen, dotnet-Microsoft.XmlSerializer.Generator"); + MethodInfo md = type.GetMethod("Main", BindingFlags.Static | BindingFlags.Public); + string[] args = new string[] { "Microsoft.XmlSerializer.Generator.Tests.dll", "/force", "/quiet" }; + int n = (int)md.Invoke(null, new object[] { args }); Assert.Equal(0, n); + Assert.True(File.Exists(codefile), string.Format("Fail to generate {0}.", codefile)); } } } diff --git a/external/corefx/src/Native/Unix/System.Native/pal_networking.cpp b/external/corefx/src/Native/Unix/System.Native/pal_networking.cpp index 177232dbf1..7c2a3034b3 100644 --- a/external/corefx/src/Native/Unix/System.Native/pal_networking.cpp +++ b/external/corefx/src/Native/Unix/System.Native/pal_networking.cpp @@ -9,6 +9,7 @@ #include "pal_safecrt.h" #include +#include #include #include #include @@ -1143,13 +1144,29 @@ SystemNative_SetIPv6Address(uint8_t* socketAddress, int32_t socketAddressLen, ui return PAL_SUCCESS; } -static void ConvertMessageHeaderToMsghdr(msghdr* header, const MessageHeader& messageHeader) +static bool IsStreamSocket(int socket) { + int type; + socklen_t length = sizeof(int); + return getsockopt(socket, SOL_SOCKET, SO_TYPE, &type, &length) == 0 + && type == SOCK_STREAM; +} + +static void ConvertMessageHeaderToMsghdr(msghdr* header, const MessageHeader& messageHeader, int socket = -1) +{ + // sendmsg/recvmsg can return EMSGSIZE when msg_iovlen is greather than IOV_MAX. + // We avoid this for stream sockets by truncating msg_iovlen to IOV_MAX. This is ok since sendmsg is + // not required to send all data and recvmsg can be called again to receive more. + auto iovlen = static_castmsg_iovlen)>(messageHeader.IOVectorCount); + if (iovlen > IOV_MAX && IsStreamSocket(socket)) + { + iovlen = static_cast(IOV_MAX); + } *header = { .msg_name = messageHeader.SocketAddress, .msg_namelen = static_cast(messageHeader.SocketAddressLen), .msg_iov = reinterpret_cast(messageHeader.IOVectors), - .msg_iovlen = static_castmsg_iovlen)>(messageHeader.IOVectorCount), + .msg_iovlen = iovlen, .msg_control = messageHeader.ControlBuffer, .msg_controllen = static_castmsg_controllen)>(messageHeader.ControlBufferLen), }; @@ -1576,7 +1593,7 @@ extern "C" Error SystemNative_ReceiveMessage(intptr_t socket, MessageHeader* mes } msghdr header; - ConvertMessageHeaderToMsghdr(&header, *messageHeader); + ConvertMessageHeaderToMsghdr(&header, *messageHeader, fd); ssize_t res; while (CheckInterrupted(res = recvmsg(fd, &header, socketFlags))); @@ -1619,7 +1636,7 @@ extern "C" Error SystemNative_SendMessage(intptr_t socket, MessageHeader* messag } msghdr header; - ConvertMessageHeaderToMsghdr(&header, *messageHeader); + ConvertMessageHeaderToMsghdr(&header, *messageHeader, fd); ssize_t res; while (CheckInterrupted(res = sendmsg(fd, &header, flags))); diff --git a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/openssl.cpp b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/openssl.cpp index ec0205d71e..eba1dc2f4a 100644 --- a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/openssl.cpp +++ b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/openssl.cpp @@ -1271,12 +1271,11 @@ static void LockingCallback(int mode, int n, const char* file, int line) result = pthread_mutex_unlock(&g_locks[n]); } -#pragma clang diagnostic pop - if (result != 0) { assert(0 && "LockingCallback failed."); } +#pragma clang diagnostic pop } #ifdef __APPLE__ diff --git a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h index 9cd689d991..c77d4bc0f6 100644 --- a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h +++ b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h @@ -281,7 +281,6 @@ int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, PER_FUNCTION_BLOCK(SSL_shutdown, true) \ PER_FUNCTION_BLOCK(SSL_state, true) \ PER_FUNCTION_BLOCK(SSLv23_method, true) \ - PER_FUNCTION_BLOCK(SSLv3_method, false) \ PER_FUNCTION_BLOCK(SSL_write, true) \ PER_FUNCTION_BLOCK(TLSv1_1_method, true) \ PER_FUNCTION_BLOCK(TLSv1_2_method, true) \ @@ -325,6 +324,7 @@ int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, PER_FUNCTION_BLOCK(X509_STORE_CTX_get_error_depth, true) \ PER_FUNCTION_BLOCK(X509_STORE_CTX_init, true) \ PER_FUNCTION_BLOCK(X509_STORE_CTX_new, true) \ + PER_FUNCTION_BLOCK(X509_STORE_CTX_set_flags, true) \ PER_FUNCTION_BLOCK(X509_STORE_CTX_set_verify_cb, true) \ PER_FUNCTION_BLOCK(X509_STORE_free, true) \ PER_FUNCTION_BLOCK(X509_STORE_new, true) \ @@ -571,7 +571,6 @@ FOR_ALL_OPENSSL_FUNCTIONS #define SSL_shutdown SSL_shutdown_ptr #define SSL_state SSL_state_ptr #define SSLv23_method SSLv23_method_ptr -#define SSLv3_method SSLv3_method_ptr #define SSL_write SSL_write_ptr #define TLSv1_1_method TLSv1_1_method_ptr #define TLSv1_2_method TLSv1_2_method_ptr @@ -615,6 +614,7 @@ FOR_ALL_OPENSSL_FUNCTIONS #define X509_STORE_CTX_get_error_depth X509_STORE_CTX_get_error_depth_ptr #define X509_STORE_CTX_init X509_STORE_CTX_init_ptr #define X509_STORE_CTX_new X509_STORE_CTX_new_ptr +#define X509_STORE_CTX_set_flags X509_STORE_CTX_set_flags_ptr #define X509_STORE_CTX_set_verify_cb X509_STORE_CTX_set_verify_cb_ptr #define X509_STORE_free X509_STORE_free_ptr #define X509_STORE_new X509_STORE_new_ptr diff --git a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.cpp b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.cpp index 6cc7021004..7d1c99469a 100644 --- a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.cpp +++ b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_ecc_import_export.cpp @@ -108,8 +108,17 @@ extern "C" int32_t CryptoNative_GetECKeyParameters( if (includePrivate) { - *d = const_cast(EC_KEY_get0_private_key(key)); - *cbD = BN_num_bytes(*d); + const BIGNUM* const_bignum_privateKey = EC_KEY_get0_private_key(key); + if (const_bignum_privateKey != nullptr) + { + *d = const_cast(const_bignum_privateKey); + *cbD = BN_num_bytes(*d); + } + else + { + rc = -1; + goto error; + } } else { diff --git a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_x509.cpp b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_x509.cpp index 0a3dfcc2c8..3118c9aa2c 100644 --- a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_x509.cpp +++ b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native/pal_x509.cpp @@ -208,7 +208,14 @@ extern "C" void CryptoNative_X509StoreCtxDestroy(X509_STORE_CTX* v) extern "C" int32_t CryptoNative_X509StoreCtxInit(X509_STORE_CTX* ctx, X509_STORE* store, X509* x509, X509Stack* extraStore) { - return X509_STORE_CTX_init(ctx, store, x509, extraStore); + int32_t val = X509_STORE_CTX_init(ctx, store, x509, extraStore); + + if (val != 0) + { + X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_CHECK_SS_SIGNATURE); + } + + return val; } extern "C" int32_t CryptoNative_X509VerifyCert(X509_STORE_CTX* ctx) diff --git a/external/corefx/src/Native/Unix/configure.cmake b/external/corefx/src/Native/Unix/configure.cmake index e905577cd1..1598db7bd1 100644 --- a/external/corefx/src/Native/Unix/configure.cmake +++ b/external/corefx/src/Native/Unix/configure.cmake @@ -29,7 +29,7 @@ set(CMAKE_REQUIRED_FLAGS -Werror) # in_pktinfo: Find whether this struct exists check_include_files( - linux/in.h + "sys/socket.h;linux/in.h" HAVE_LINUX_IN_H) if (HAVE_LINUX_IN_H) @@ -40,10 +40,11 @@ endif () check_c_source_compiles( " + #include #include <${SOCKET_INCLUDES}> int main() { - struct in_pktinfo; + struct in_pktinfo pktinfo; return 0; } " @@ -51,10 +52,11 @@ check_c_source_compiles( check_c_source_compiles( " + #include #include <${SOCKET_INCLUDES}> int main() { - struct ip_mreqn; + struct ip_mreqn mreqn; return 0; } " diff --git a/external/corefx/src/Native/build-native.cmd b/external/corefx/src/Native/build-native.cmd index c2e6eccfb4..b37ac8a503 100644 --- a/external/corefx/src/Native/build-native.cmd +++ b/external/corefx/src/Native/build-native.cmd @@ -53,17 +53,19 @@ goto :Arg_Loop :: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015 :: toolset if it is installed. Finally, we will fail the script if no supported VS instance :: can be found. -if not defined VisualStudioVersion ( - if defined VS150COMNTOOLS ( - call "%VS150COMNTOOLS%VsDevCmd.bat" - goto :VS2017 - ) else if defined VS140COMNTOOLS ( - call "%VS140COMNTOOLS%VsDevCmd.bat" - goto :VS2015 - ) - goto :MissingVersion -) +if defined VisualStudioVersion goto :RunVCVars + +set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" +if exist %_VSWHERE% ( + for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools +) +if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% +if not exist "%_VSCOMNTOOLS%" goto :MissingVersion + +call "%_VSCOMNTOOLS%\VsDevCmd.bat" + +:RunVCVars if "%VisualStudioVersion%"=="15.0" ( goto :VS2017 ) else if "%VisualStudioVersion%"=="14.0" ( @@ -72,7 +74,7 @@ if "%VisualStudioVersion%"=="15.0" ( :MissingVersion :: Can't find VS 2015 or 2017 -echo Error: Visual Studio 2015 or 2017 required +echo Error: Visual Studio 2015 or 2017 required echo Please see https://github.com/dotnet/corefx/tree/master/Documentation for build instructions. exit /b 1 diff --git a/external/corefx/src/Native/build-native.sh b/external/corefx/src/Native/build-native.sh index 92ec81612f..a3c202c756 100755 --- a/external/corefx/src/Native/build-native.sh +++ b/external/corefx/src/Native/build-native.sh @@ -7,31 +7,44 @@ usage() echo "If you plan to only run this script, be sure to pass those parameters." echo "For more information type build-native.sh -? at the root of the repo." echo - echo "Usage: $0 [runParameters][verbose] [clangx.y] [cross] [staticLibLink] [cmakeargs] [makeargs]" - echo "runParameters: buildArch, buildType, buildOS, --numProc " - echo "verbose - optional argument to enable verbose build output." - echo "clangx.y - optional argument to build using clang version x.y." - echo "cross - optional argument to signify cross compilation," - echo " - will use ROOTFS_DIR environment variable if set." - echo "staticLibLink - Optional argument to statically link any native library." - echo "portable - Optional argument to build native libraries portable over GLIBC based Linux distros." - echo "stripSymbols - Optional argument to strip native symbols during the build." - echo "generateversion - Pass this in to get a version on the build output." - echo "cmakeargs - user-settable additional arguments passed to CMake." + echo "Usage: $0 [runParameters][-verbose] [-clangx.y] [-cross] [-staticLibLink] [-cmakeargs] [-makeargs]" + echo "runParameters: buildArch, buildType, buildOS, -numProc " + echo "BuildArch can be: -x64, -x86, -arm, -armel, -arm64" + echo "BuildType can be: -debug, -checked, -release" + echo "-verbose - optional argument to enable verbose build output." + echo "-clangx.y - optional argument to build using clang version x.y." + echo "-cross - optional argument to signify cross compilation," + echo " - will use ROOTFS_DIR environment variable if set." + echo "-staticLibLink - Optional argument to statically link any native library." + echo "-portable - Optional argument to build native libraries portable over GLIBC based Linux distros." + echo "-stripSymbols - Optional argument to strip native symbols during the build." + echo "-generateversion - Pass this in to get a version on the build output." + echo "-cmakeargs - user-settable additional arguments passed to CMake." exit 1 } initHostDistroRid() { + __HostDistroRid="" if [ "$__HostOS" == "Linux" ]; then - if [ ! -e /etc/os-release ]; then - echo "WARNING: Can not determine runtime id for current distro." - __HostDistroRid="" - else + if [ -e /etc/os-release ]; then source /etc/os-release + if [[ $ID == "alpine" ]]; then + # remove the last version digit + VERSION_ID=${VERSION_ID%.*} + fi __HostDistroRid="$ID.$VERSION_ID-$__HostArch" + elif [ -e /etc/redhat-release ]; then + local redhatRelease=$( - - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Buffers/ref/System.Buffers.cs b/external/corefx/src/System.Buffers/ref/System.Buffers.cs index e1d6a23e1b..62fd63c145 100644 --- a/external/corefx/src/System.Buffers/ref/System.Buffers.cs +++ b/external/corefx/src/System.Buffers/ref/System.Buffers.cs @@ -15,4 +15,4 @@ namespace System.Buffers public abstract T[] Rent(int minimumLength); public abstract void Return(T[] array, bool clearArray = false); } -} +} \ No newline at end of file diff --git a/external/corefx/src/System.Buffers/src/Configurations.props b/external/corefx/src/System.Buffers/src/Configurations.props index f8eca1e4fa..6544913df5 100644 --- a/external/corefx/src/System.Buffers/src/Configurations.props +++ b/external/corefx/src/System.Buffers/src/Configurations.props @@ -4,13 +4,15 @@ netstandard1.1; netstandard; + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; + uap-Windows_NT; + uapaot-Windows_NT; $(PackageConfigurations); netcoreapp-Windows_NT; netcoreapp-Unix; - uap-Windows_NT; - uapaot-Windows_NT; diff --git a/external/corefx/src/System.Buffers/tests/ArrayPool/UnitTests.cs b/external/corefx/src/System.Buffers/tests/ArrayPool/UnitTests.cs index 2f3644fa4c..72a9e9f203 100644 --- a/external/corefx/src/System.Buffers/tests/ArrayPool/UnitTests.cs +++ b/external/corefx/src/System.Buffers/tests/ArrayPool/UnitTests.cs @@ -414,7 +414,6 @@ namespace System.Buffers.ArrayPool.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)] public static void RentBufferFiresRentedDiagnosticEvent() { ArrayPool pool = ArrayPool.Create(maxArrayLength: 16, maxArraysPerBucket: 1); @@ -432,7 +431,6 @@ namespace System.Buffers.ArrayPool.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)] public static void ReturnBufferFiresDiagnosticEvent() { ArrayPool pool = ArrayPool.Create(maxArrayLength: 16, maxArraysPerBucket: 1); @@ -447,7 +445,6 @@ namespace System.Buffers.ArrayPool.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)] public static void RentingNonExistentBufferFiresAllocatedDiagnosticEvent() { ArrayPool pool = ArrayPool.Create(maxArrayLength: 16, maxArraysPerBucket: 1); @@ -455,7 +452,6 @@ namespace System.Buffers.ArrayPool.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)] public static void RentingBufferOverConfiguredMaximumSizeFiresDiagnosticEvent() { ArrayPool pool = ArrayPool.Create(maxArrayLength: 16, maxArraysPerBucket: 1); @@ -463,7 +459,6 @@ namespace System.Buffers.ArrayPool.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/corefx/issues/20511", TargetFrameworkMonikers.UapAot)] public static void RentingManyBuffersFiresExpectedDiagnosticEvents() { ArrayPool pool = ArrayPool.Create(maxArrayLength: 16, maxArraysPerBucket: 10); diff --git a/external/corefx/src/System.CodeDom/src/Microsoft/CSharp/CSharpCodeGenerator.cs.REMOVED.git-id b/external/corefx/src/System.CodeDom/src/Microsoft/CSharp/CSharpCodeGenerator.cs.REMOVED.git-id index b18a0ec904..629bddf6f1 100644 --- a/external/corefx/src/System.CodeDom/src/Microsoft/CSharp/CSharpCodeGenerator.cs.REMOVED.git-id +++ b/external/corefx/src/System.CodeDom/src/Microsoft/CSharp/CSharpCodeGenerator.cs.REMOVED.git-id @@ -1 +1 @@ -e180cb5c5ae74aba136635e15db40031c56ba552 \ No newline at end of file +a203d193d404a4813ea1c6ef40970b3be451581b \ No newline at end of file diff --git a/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.Evidence.cs b/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.Evidence.cs index 011393cf23..5093d44f46 100644 --- a/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.Evidence.cs +++ b/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.Evidence.cs @@ -8,7 +8,6 @@ namespace System.CodeDom.Compiler { public partial class CompilerParameters { - [NonSerialized] private Evidence _evidence; [Obsolete("CAS policy is obsolete and will be removed in a future release of the .NET Framework." diff --git a/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs b/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs index c441201a43..a8079dcd05 100644 --- a/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs +++ b/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs @@ -12,8 +12,6 @@ namespace System.CodeDom.Compiler private readonly StringCollection _assemblyNames = new StringCollection(); private readonly StringCollection _embeddedResources = new StringCollection(); private readonly StringCollection _linkedResources = new StringCollection(); - - [NonSerialized] private TempFileCollection _tempFiles; public CompilerParameters() : this(null, null) diff --git a/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs b/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs index b74d2c7759..1e5117f655 100644 --- a/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs +++ b/external/corefx/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs @@ -13,8 +13,6 @@ namespace System.CodeDom.Compiler private readonly CompilerErrorCollection _errors = new CompilerErrorCollection(); private readonly StringCollection _output = new StringCollection(); private Assembly _compiledAssembly; - - [NonSerialized] private TempFileCollection _tempFiles; public CompilerResults(TempFileCollection tempFiles) diff --git a/external/corefx/src/System.CodeDom/tests/System.CodeDom.Tests.csproj b/external/corefx/src/System.CodeDom/tests/System.CodeDom.Tests.csproj index 5bdc89f107..c0c0a2802f 100644 --- a/external/corefx/src/System.CodeDom/tests/System.CodeDom.Tests.csproj +++ b/external/corefx/src/System.CodeDom/tests/System.CodeDom.Tests.csproj @@ -106,9 +106,6 @@ Common\System\Collections\TestBase.NonGeneric.cs - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs index f978081368..82580b490a 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Runtime.Serialization; using System.Threading; namespace System.Collections.Concurrent @@ -34,13 +33,9 @@ namespace System.Collections.Concurrent public class ConcurrentBag : IProducerConsumerCollection, IReadOnlyCollection { /// The per-bag, per-thread work-stealing queues. - [NonSerialized] private ThreadLocal _locals; /// The head work stealing queue in a linked list of queues. - [NonSerialized] private volatile WorkStealingQueue _workStealingQueues; - /// Temporary storage of the bag's contents used during serialization. - private T[] _serializationArray; /// Initializes a new instance of the class. public ConcurrentBag() @@ -72,38 +67,6 @@ namespace System.Collections.Concurrent } } - /// Get the data array to be serialized. - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - // save the data into the serialization array to be saved - _serializationArray = ToArray(); - } - - /// Clear the serialized array. - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - _serializationArray = null; - } - - /// Construct the stack from a previously serialized one. - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - Debug.Assert(_locals == null); - _locals = new ThreadLocal(); - - WorkStealingQueue queue = GetCurrentThreadWorkStealingQueue(forceCreate: true); - foreach (T item in _serializationArray) - { - queue.LocalPush(item); - } - _serializationArray = null; - - _workStealingQueues = queue; - } - /// /// Adds an object to the . /// @@ -1002,7 +965,7 @@ namespace System.Collections.Concurrent Debug.Assert( count == (_tailIndex - _headIndex) || count == (_tailIndex + 1 - _headIndex), - "Count should be the same as tail - head, but allowing for the possibilty that " + + "Count should be the same as tail - head, but allowing for the possibility that " + "a peek decremented _tailIndex before seeing that a freeze was happening."); Debug.Assert(arrayIndex <= array.Length - count); diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs index e1a52da3ae..3ccbdb7937 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs @@ -18,7 +18,6 @@ using System.Diagnostics; using System.Diagnostics.Private; using System.Reflection; using System.Runtime.CompilerServices; -using System.Runtime.Serialization; using System.Threading; namespace System.Collections.Concurrent @@ -57,18 +56,11 @@ namespace System.Collections.Concurrent } } - [NonSerialized] private volatile Tables _tables; // Internal tables of the dictionary private IEqualityComparer _comparer; // Key equality comparer - [NonSerialized] private readonly bool _growLockArray; // Whether to dynamically increase the size of the striped lock - [NonSerialized] private int _budget; // The maximum number of elements per lock before a resize operation is triggered - private KeyValuePair[] _serializationArray; // Used for custom serialization - private int _serializationConcurrencyLevel; // used to save the concurrency level in serialization - private int _serializationCapacity; // used to save the capacity in serialization - // The default capacity, i.e. the initial # of buckets. When choosing this value, we are making // a trade-off between the size of a very small dictionary, and the number of resizes when // constructing a large dictionary. Also, the capacity should not be divisible by a small prime. @@ -294,44 +286,6 @@ namespace System.Collections.Concurrent _budget = buckets.Length / locks.Length; } - /// Get the data array to be serialized. - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - Tables tables = _tables; - - // save the data into the serialization array to be saved - _serializationArray = ToArray(); - _serializationConcurrencyLevel = tables._locks.Length; - _serializationCapacity = tables._buckets.Length; - } - - /// Clear the serialized state. - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - _serializationArray = null; - } - - /// Construct the dictionary from a previously serialized one - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - KeyValuePair[] array = _serializationArray; - - var buckets = new Node[_serializationCapacity]; - var countPerLock = new int[_serializationConcurrencyLevel]; - var locks = new object[_serializationConcurrencyLevel]; - for (int i = 0; i < locks.Length; i++) - { - locks[i] = new object(); - } - _tables = new Tables(buckets, locks, countPerLock); - - InitializeFromCollection(array); - _serializationArray = null; - } - /// /// Attempts to add the specified key and value to the . @@ -987,7 +941,7 @@ namespace System.Collections.Concurrent /// /// Gets the number of key/value pairs contained in the . Should only be used after all locks - /// have been aquired. + /// have been acquired. /// /// The dictionary contains too many /// elements. diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs index 3d3d9b3590..c4202e1a2c 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Private; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using System.Threading; namespace System.Collections.Concurrent @@ -55,16 +54,11 @@ namespace System.Collections.Concurrent /// Lock used to protect cross-segment operations, including any updates to or /// and any operations that need to get a consistent view of them. /// - [NonSerialized] private object _crossSegmentLock; /// The current tail segment. - [NonSerialized] private volatile Segment _tail; /// The current head segment. - [NonSerialized] private volatile Segment _head; - /// Field used to temporarily store the contents of the queue for serialization. - private T[] _serializationArray; /// /// Initializes a new instance of the class. @@ -75,29 +69,6 @@ namespace System.Collections.Concurrent _tail = _head = new Segment(InitialSegmentLength); } - /// Set the data array to be serialized. - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - _serializationArray = ToArray(); - } - - /// Clear the data array that was serialized. - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - _serializationArray = null; - } - - /// Construct the queue from the deserialized . - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - Debug.Assert(_serializationArray != null); - InitializeFromCollection(_serializationArray); - _serializationArray = null; - } - /// /// Initializes the contents of the queue from an existing collection. /// @@ -858,7 +829,7 @@ namespace System.Collections.Concurrent /// Mask for quickly accessing a position within the queue's array. internal readonly int _slotsMask; /// The head and tail positions, with padding to help avoid false sharing contention. - /// Dequeueing happens from the head, enqueueing happens at the tail. + /// Dequeuing happens from the head, enqueuing happens at the tail. internal PaddedHeadAndTail _headAndTail; // mutable struct: do not make this readonly /// Indicates whether the segment has been marked such that dequeues don't overwrite the removed data. @@ -1143,10 +1114,10 @@ namespace System.Collections.Concurrent /// Padded head and tail indices, to avoid false sharing between producers and consumers. [DebuggerDisplay("Head = {Head}, Tail = {Tail}")] - [StructLayout(LayoutKind.Explicit, Size = 192)] // padding before/between/after fields based on typical cache line size of 64 + [StructLayout(LayoutKind.Explicit, Size = 384)] // padding before/between/after fields based on worst case cache line size of 128 internal struct PaddedHeadAndTail { - [FieldOffset(64)] public int Head; - [FieldOffset(128)] public int Tail; + [FieldOffset(128)] public int Head; + [FieldOffset(256)] public int Tail; } } diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs index 31680a4844..55987e4b18 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs @@ -13,7 +13,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Private; -using System.Runtime.Serialization; using System.Threading; namespace System.Collections.Concurrent @@ -61,13 +60,9 @@ namespace System.Collections.Concurrent } } - [NonSerialized] private volatile Node _head; // The stack is a singly linked list, and only remembers the head. - private const int BACKOFF_MAX_YIELDS = 8; // Arbitrary number to cap backoff. - private T[] _serializationArray; // Used for custom serialization - /// /// Initializes a new instance of the /// class. @@ -93,45 +88,6 @@ namespace System.Collections.Concurrent InitializeFromCollection(collection); } - /// Get the data array to be serialized. - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - // save the data into the serialization array to be saved - _serializationArray = ToArray(); - } - - /// - /// Construct the stack from a previously seiralized one - /// - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - Debug.Assert(_serializationArray != null); - - // Add the elements to our stack. We need to add them from head-to-tail, to - // preserve the original ordering of the stack before serialization. - Node prevNode = null, head = null; - for (int i = 0; i < _serializationArray.Length; i++) - { - Node currNode = new Node(_serializationArray[i]); - - if (prevNode == null) - { - head = currNode; - } - else - { - prevNode._next = currNode; - } - - prevNode = currNode; - } - - _head = head; - _serializationArray = null; - } - /// /// Initializes the contents of the stack from an existing collection. /// diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs index 58cdd66066..acd8c4207a 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs @@ -381,7 +381,7 @@ namespace System.Collections.Concurrent /// /// Dispose is abstract, and depends on the type of the source data: - /// - For source data type IList and Array, the type of the shared reader is just the dataitself. + /// - For source data type IList and Array, the type of the shared reader is just the data itself. /// We don't do anything in Dispose method for IList and Array. /// - For source data type IEnumerable, the type of the shared reader is an enumerator we created. /// Thus we need to dispose this shared reader enumerator, when there is no more active partitions diff --git a/external/corefx/src/System.Collections.Concurrent/tests/BlockingCollectionTests.cs b/external/corefx/src/System.Collections.Concurrent/tests/BlockingCollectionTests.cs index 3501a7b247..48921e0676 100644 --- a/external/corefx/src/System.Collections.Concurrent/tests/BlockingCollectionTests.cs +++ b/external/corefx/src/System.Collections.Concurrent/tests/BlockingCollectionTests.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -174,7 +176,20 @@ namespace System.Collections.Concurrent.Tests public static void TestDebuggerAttributes() { DebuggerAttributes.ValidateDebuggerDisplayReferences(new BlockingCollection()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new BlockingCollection()); + BlockingCollection col = new BlockingCollection { 1, 2, 3 }; + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + int[] items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(col, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(new BlockingCollection()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } /// diff --git a/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionaryTests.cs b/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionaryTests.cs index 7a2f5c2d1a..a45dbe0a22 100644 --- a/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionaryTests.cs +++ b/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionaryTests.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using System.Reflection; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -543,7 +545,22 @@ namespace System.Collections.Concurrent.Tests public static void TestDebuggerAttributes() { DebuggerAttributes.ValidateDebuggerDisplayReferences(new ConcurrentDictionary()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ConcurrentDictionary()); + ConcurrentDictionary dict = new ConcurrentDictionary(); + dict.TryAdd("One", 1); + dict.TryAdd("Two", 2); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; + Assert.Equal(dict, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(new ConcurrentDictionary()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } [Fact] diff --git a/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentQueueTests.cs b/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentQueueTests.cs index 5ba3f27bee..b639a1b16b 100644 --- a/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentQueueTests.cs +++ b/external/corefx/src/System.Collections.Concurrent/tests/ConcurrentQueueTests.cs @@ -97,10 +97,6 @@ namespace System.Collections.Concurrent.Tests [InlineData(3, 3, 1024)] public void MultipleProducerConsumer_AllItemsTransferred(int producers, int consumers, int itemsPerProducer) { - //ActiveIssue("https://github.com/dotnet/corefx/issues/22385 - Never terminates on Win10 RS3 - when built using CHK framework on ILC", TargetFrameworkMonikers.UapAot) - if (PlatformDetection.IsNetNative && PlatformDetection.IsWindows10InsiderPreviewBuild16215OrGreater) - return; - var cq = new ConcurrentQueue(); var tasks = new List(); @@ -110,7 +106,7 @@ namespace System.Collections.Concurrent.Tests for (int i = 0; i < consumers; i++) { - tasks.Add(Task.Run(() => + tasks.Add(Task.Factory.StartNew(() => { while (Volatile.Read(ref remainingItems) > 0) { @@ -121,18 +117,18 @@ namespace System.Collections.Concurrent.Tests Interlocked.Decrement(ref remainingItems); } } - })); + }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default)); } for (int i = 0; i < producers; i++) { - tasks.Add(Task.Run(() => + tasks.Add(Task.Factory.StartNew(() => { for (int item = 1; item <= itemsPerProducer; item++) { cq.Enqueue(item); } - })); + }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default)); } Task.WaitAll(tasks.ToArray()); diff --git a/external/corefx/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs b/external/corefx/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs index 65fcb5595c..4d40e5f78b 100644 --- a/external/corefx/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs +++ b/external/corefx/src/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs @@ -962,7 +962,10 @@ namespace System.Collections.Concurrent.Tests { IProducerConsumerCollection c = CreateProducerConsumerCollection(count); DebuggerAttributes.ValidateDebuggerDisplayReferences(c); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(c); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(c); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + Array items = itemProperty.GetValue(info.Instance) as Array; + Assert.Equal(c, items.Cast()); } [Fact] diff --git a/external/corefx/src/System.Collections.Concurrent/tests/System.Collections.Concurrent.Tests.csproj b/external/corefx/src/System.Collections.Concurrent/tests/System.Collections.Concurrent.Tests.csproj index a471769673..505b528b69 100644 --- a/external/corefx/src/System.Collections.Concurrent/tests/System.Collections.Concurrent.Tests.csproj +++ b/external/corefx/src/System.Collections.Concurrent/tests/System.Collections.Concurrent.Tests.csproj @@ -65,9 +65,6 @@ Common\System\EnumTypes.cs - - CommonTest\System\PlatformDetection.cs - System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Collections.Immutable/pkg/System.Collections.Immutable.pkgproj b/external/corefx/src/System.Collections.Immutable/pkg/System.Collections.Immutable.pkgproj index 3fc9266e62..fb72021465 100644 --- a/external/corefx/src/System.Collections.Immutable/pkg/System.Collections.Immutable.pkgproj +++ b/external/corefx/src/System.Collections.Immutable/pkg/System.Collections.Immutable.pkgproj @@ -9,8 +9,15 @@ net45;netcore45;netcoreapp1.0;wp8;wpa81;$(AllXamarinFrameworks) - - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Collections.Immutable/src/PEVerifyCompat.rsp b/external/corefx/src/System.Collections.Immutable/src/PEVerifyCompat.rsp new file mode 100644 index 0000000000..0a7805fa7a --- /dev/null +++ b/external/corefx/src/System.Collections.Immutable/src/PEVerifyCompat.rsp @@ -0,0 +1 @@ +/features:peverify-compat \ No newline at end of file diff --git a/external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx b/external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx index 3aeb6428f9..d871641f8c 100644 --- a/external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx +++ b/external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx @@ -59,10 +59,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Object is not a array with the same initialization state as the array to compare it to. + Object is not an array with the same initialization state as the array to compare it to. - Object is not a array with the same number of elements as the array to compare it to. + Object is not an array with the same number of elements as the array to compare it to. Cannot find the old value diff --git a/external/corefx/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj b/external/corefx/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj index 2d19079d52..e335340572 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj +++ b/external/corefx/src/System.Collections.Immutable/src/System.Collections.Immutable.csproj @@ -9,6 +9,7 @@ 512 $(OutputPath)$(MSBuildProjectName).xml False + $(MSBuildThisFileDirectory)PEVerifyCompat.rsp;$(CompilerResponseFile) netstandard1.0;portable-net45+win8+wp8+wpa81 @@ -71,6 +72,8 @@ + + diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.DebuggerProxy.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.DebuggerProxy.cs index 087e01bf45..40c751c70c 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.DebuggerProxy.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Builder.DebuggerProxy.cs @@ -21,6 +21,7 @@ namespace System.Collections.Immutable /// The collection to display in the debugger public ImmutableArrayBuilderDebuggerProxy(ImmutableArray.Builder builder) { + Requires.NotNull(builder, nameof(builder)); _builder = builder; } diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs index 4fd1483c3f..ff85847beb 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; +using System.Linq; namespace System.Collections.Immutable { @@ -832,7 +833,9 @@ namespace System.Collections.Immutable /// IEnumerator> IEnumerable>.GetEnumerator() { - return this.GetEnumerator(); + return this.IsEmpty ? + Enumerable.Empty>().GetEnumerator() : + this.GetEnumerator(); } #endregion diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs index 5c89b8cad2..329b0e53a9 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs @@ -600,7 +600,9 @@ namespace System.Collections.Immutable /// IEnumerator IEnumerable.GetEnumerator() { - return this.GetEnumerator(); + return this.IsEmpty ? + Enumerable.Empty().GetEnumerator() : + this.GetEnumerator(); } #endregion diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableInterlocked.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableInterlocked.cs index 5e92ae5330..dfa77cce24 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableInterlocked.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableInterlocked.cs @@ -423,7 +423,7 @@ namespace System.Collections.Immutable #region ImmutableStack members /// - /// Pushes a new element onto a stack. + /// Pops the top element off a stack and returns it to the caller, if the stack is not empty. /// /// The type of elements stored in the stack. /// The variable or field to atomically update. diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList.cs index f03af54d91..ecb16b5f08 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList.cs @@ -18,10 +18,7 @@ namespace System.Collections.Immutable /// The type of items stored by the collection. /// The immutable collection. [Pure] - public static ImmutableList Create() - { - return ImmutableList.Empty; - } + public static ImmutableList Create() => ImmutableList.Empty; /// /// Creates a new immutable collection prefilled with the specified item. @@ -30,10 +27,7 @@ namespace System.Collections.Immutable /// The item to prepopulate. /// The new immutable collection. [Pure] - public static ImmutableList Create(T item) - { - return ImmutableList.Empty.Add(item); - } + public static ImmutableList Create(T item) => ImmutableList.Empty.Add(item); /// /// Creates a new immutable collection prefilled with the specified items. @@ -42,10 +36,7 @@ namespace System.Collections.Immutable /// The items to prepopulate. /// The new immutable collection. [Pure] - public static ImmutableList CreateRange(IEnumerable items) - { - return ImmutableList.Empty.AddRange(items); - } + public static ImmutableList CreateRange(IEnumerable items) => ImmutableList.Empty.AddRange(items); /// /// Creates a new immutable collection prefilled with the specified items. @@ -54,10 +45,7 @@ namespace System.Collections.Immutable /// The items to prepopulate. /// The new immutable collection. [Pure] - public static ImmutableList Create(params T[] items) - { - return ImmutableList.Empty.AddRange(items); - } + public static ImmutableList Create(params T[] items) => ImmutableList.Empty.AddRange(items); /// /// Creates a new immutable list builder. @@ -65,10 +53,7 @@ namespace System.Collections.Immutable /// The type of items stored by the collection. /// The immutable collection builder. [Pure] - public static ImmutableList.Builder CreateBuilder() - { - return Create().ToBuilder(); - } + public static ImmutableList.Builder CreateBuilder() => Create().ToBuilder(); /// /// Enumerates a sequence exactly once and produces an immutable list of its contents. diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Builder.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Builder.cs index c883f14daa..2fb2004c54 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Builder.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Builder.cs @@ -282,12 +282,7 @@ namespace System.Collections.Immutable /// copied from ImmutableList<T>. The System.Array must have /// zero-based indexing. /// - public void CopyTo(T[] array) - { - Requires.NotNull(array, nameof(array)); - Requires.Range(array.Length >= this.Count, nameof(array)); - _root.CopyTo(array); - } + public void CopyTo(T[] array) => _root.CopyTo(array); /// /// Copies the entire ImmutableList<T> to a compatible one-dimensional @@ -301,12 +296,7 @@ namespace System.Collections.Immutable /// /// The zero-based index in array at which copying begins. /// - public void CopyTo(T[] array, int arrayIndex) - { - Requires.NotNull(array, nameof(array)); - Requires.Range(array.Length >= arrayIndex + this.Count, nameof(arrayIndex)); - _root.CopyTo(array, arrayIndex); - } + public void CopyTo(T[] array, int arrayIndex) => _root.CopyTo(array, arrayIndex); /// /// Copies a range of elements from the ImmutableList<T> to @@ -324,10 +314,7 @@ namespace System.Collections.Immutable /// /// The zero-based index in array at which copying begins. /// The number of elements to copy. - public void CopyTo(int index, T[] array, int arrayIndex, int count) - { - _root.CopyTo(index, array, arrayIndex, count); - } + public void CopyTo(int index, T[] array, int arrayIndex, int count) => _root.CopyTo(index, array, arrayIndex, count); /// /// Creates a shallow copy of a range of elements in the source ImmutableList<T>. @@ -384,11 +371,7 @@ namespace System.Collections.Immutable /// that match the conditions defined by the specified predicate; otherwise, /// false. /// - public bool Exists(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.Exists(match); - } + public bool Exists(Predicate match) => _root.Exists(match); /// /// Searches for an element that matches the conditions defined by the specified @@ -402,11 +385,7 @@ namespace System.Collections.Immutable /// The first element that matches the conditions defined by the specified predicate, /// if found; otherwise, the default value for type T. /// - public T Find(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.Find(match); - } + public T Find(Predicate match) => _root.Find(match); /// /// Retrieves all the elements that match the conditions defined by the specified @@ -421,11 +400,7 @@ namespace System.Collections.Immutable /// the conditions defined by the specified predicate, if found; otherwise, an /// empty ImmutableList<T>. /// - public ImmutableList FindAll(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.FindAll(match); - } + public ImmutableList FindAll(Predicate match) => _root.FindAll(match); /// /// Searches for an element that matches the conditions defined by the specified @@ -440,11 +415,7 @@ namespace System.Collections.Immutable /// The zero-based index of the first occurrence of an element that matches the /// conditions defined by match, if found; otherwise, -1. /// - public int FindIndex(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.FindIndex(match); - } + public int FindIndex(Predicate match) => _root.FindIndex(match); /// /// Searches for an element that matches the conditions defined by the specified @@ -458,13 +429,7 @@ namespace System.Collections.Immutable /// The zero-based index of the first occurrence of an element that matches the /// conditions defined by match, if found; otherwise, -1. /// - public int FindIndex(int startIndex, Predicate match) - { - Requires.NotNull(match, nameof(match)); - Requires.Range(startIndex >= 0, nameof(startIndex)); - Requires.Range(startIndex <= this.Count, nameof(startIndex)); - return _root.FindIndex(startIndex, match); - } + public int FindIndex(int startIndex, Predicate match) => _root.FindIndex(startIndex, match); /// /// Searches for an element that matches the conditions defined by the specified @@ -479,15 +444,7 @@ namespace System.Collections.Immutable /// The zero-based index of the first occurrence of an element that matches the /// conditions defined by match, if found; otherwise, -1. /// - public int FindIndex(int startIndex, int count, Predicate match) - { - Requires.NotNull(match, nameof(match)); - Requires.Range(startIndex >= 0, nameof(startIndex)); - Requires.Range(count >= 0, nameof(count)); - Requires.Range(startIndex + count <= this.Count, nameof(count)); - - return _root.FindIndex(startIndex, count, match); - } + public int FindIndex(int startIndex, int count, Predicate match) => _root.FindIndex(startIndex, count, match); /// /// Searches for an element that matches the conditions defined by the specified @@ -501,11 +458,7 @@ namespace System.Collections.Immutable /// The last element that matches the conditions defined by the specified predicate, /// if found; otherwise, the default value for type T. /// - public T FindLast(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.FindLast(match); - } + public T FindLast(Predicate match) => _root.FindLast(match); /// /// Searches for an element that matches the conditions defined by the specified @@ -520,11 +473,7 @@ namespace System.Collections.Immutable /// The zero-based index of the last occurrence of an element that matches the /// conditions defined by match, if found; otherwise, -1. /// - public int FindLastIndex(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.FindLastIndex(match); - } + public int FindLastIndex(Predicate match) => _root.FindLastIndex(match); /// /// Searches for an element that matches the conditions defined by the specified @@ -539,13 +488,7 @@ namespace System.Collections.Immutable /// The zero-based index of the last occurrence of an element that matches the /// conditions defined by match, if found; otherwise, -1. /// - public int FindLastIndex(int startIndex, Predicate match) - { - Requires.NotNull(match, nameof(match)); - Requires.Range(startIndex >= 0, nameof(startIndex)); - Requires.Range(startIndex == 0 || startIndex < this.Count, nameof(startIndex)); - return _root.FindLastIndex(startIndex, match); - } + public int FindLastIndex(int startIndex, Predicate match) => _root.FindLastIndex(startIndex, match); /// /// Searches for an element that matches the conditions defined by the specified @@ -563,15 +506,7 @@ namespace System.Collections.Immutable /// The zero-based index of the last occurrence of an element that matches the /// conditions defined by match, if found; otherwise, -1. /// - public int FindLastIndex(int startIndex, int count, Predicate match) - { - Requires.NotNull(match, nameof(match)); - Requires.Range(startIndex >= 0, nameof(startIndex)); - Requires.Range(count <= this.Count, nameof(count)); - Requires.Range(startIndex - count + 1 >= 0, nameof(startIndex)); - - return _root.FindLastIndex(startIndex, count, match); - } + public int FindLastIndex(int startIndex, int count, Predicate match) => _root.FindLastIndex(startIndex, count, match); /// /// Searches for the specified object and returns the zero-based index of the @@ -592,10 +527,8 @@ namespace System.Collections.Immutable /// to the last element, if found; otherwise, -1. /// [Pure] - public int IndexOf(T item, int index) - { - return _root.IndexOf(item, index, this.Count - index, EqualityComparer.Default); - } + public int IndexOf(T item, int index) => + _root.IndexOf(item, index, this.Count - index, EqualityComparer.Default); /// /// Searches for the specified object and returns the zero-based index of the @@ -619,10 +552,8 @@ namespace System.Collections.Immutable /// contains count number of elements, if found; otherwise, -1. /// [Pure] - public int IndexOf(T item, int index, int count) - { - return _root.IndexOf(item, index, count, EqualityComparer.Default); - } + public int IndexOf(T item, int index, int count) => + _root.IndexOf(item, index, count, EqualityComparer.Default); /// /// Searches for the specified object and returns the zero-based index of the @@ -650,10 +581,8 @@ namespace System.Collections.Immutable /// contains count number of elements, if found; otherwise, -1. /// [Pure] - public int IndexOf(T item, int index, int count, IEqualityComparer equalityComparer) - { - return _root.IndexOf(item, index, count, equalityComparer); - } + public int IndexOf(T item, int index, int count, IEqualityComparer equalityComparer) => + _root.IndexOf(item, index, count, equalityComparer); /// /// Searches for the specified object and returns the zero-based index of the @@ -726,10 +655,8 @@ namespace System.Collections.Immutable /// and ends at index, if found; otherwise, -1. /// [Pure] - public int LastIndexOf(T item, int startIndex, int count) - { - return _root.LastIndexOf(item, startIndex, count, EqualityComparer.Default); - } + public int LastIndexOf(T item, int startIndex, int count) => + _root.LastIndexOf(item, startIndex, count, EqualityComparer.Default); /// /// Searches for the specified object and returns the zero-based index of the @@ -750,10 +677,8 @@ namespace System.Collections.Immutable /// and ends at index, if found; otherwise, -1. /// [Pure] - public int LastIndexOf(T item, int startIndex, int count, IEqualityComparer equalityComparer) - { - return _root.LastIndexOf(item, startIndex, count, equalityComparer); - } + public int LastIndexOf(T item, int startIndex, int count, IEqualityComparer equalityComparer) => + _root.LastIndexOf(item, startIndex, count, equalityComparer); /// /// Determines whether every element in the ImmutableList<T> @@ -768,11 +693,7 @@ namespace System.Collections.Immutable /// conditions defined by the specified predicate; otherwise, false. If the list /// has no elements, the return value is true. /// - public bool TrueForAll(Predicate match) - { - Requires.NotNull(match, nameof(match)); - return _root.TrueForAll(match); - } + public bool TrueForAll(Predicate match) => _root.TrueForAll(match); #endregion diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Enumerator.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Enumerator.cs new file mode 100755 index 0000000000..d416523138 --- /dev/null +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Enumerator.cs @@ -0,0 +1,298 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; + +namespace System.Collections.Immutable +{ + public sealed partial class ImmutableList + { + /// + /// Enumerates the contents of a binary tree. + /// + /// + /// This struct can and should be kept in exact sync with the other binary tree enumerators: + /// , , and . + /// + /// CAUTION: when this enumerator is actually used as a valuetype (not boxed) do NOT copy it by assigning to a second variable + /// or by passing it to another method. When this enumerator is disposed of it returns a mutable reference type stack to a resource pool, + /// and if the value type enumerator is copied (which can easily happen unintentionally if you pass the value around) there is a risk + /// that a stack that has already been returned to the resource pool may still be in use by one of the enumerator copies, leading to data + /// corruption and/or exceptions. + /// + [EditorBrowsable(EditorBrowsableState.Advanced)] + public struct Enumerator : IEnumerator, ISecurePooledObjectUser, IStrongEnumerator + { + /// + /// The resource pool of reusable mutable stacks for purposes of enumeration. + /// + /// + /// We utilize this resource pool to make "allocation free" enumeration achievable. + /// + private static readonly SecureObjectPool>, Enumerator> s_EnumeratingStacks = + new SecureObjectPool>, Enumerator>(); + + /// + /// The builder being enumerated, if applicable. + /// + private readonly Builder _builder; + + /// + /// A unique ID for this instance of this enumerator. + /// Used to protect pooled objects from use after they are recycled. + /// + private readonly int _poolUserId; + + /// + /// The starting index of the collection at which to begin enumeration. + /// + private readonly int _startIndex; + + /// + /// The number of elements to include in the enumeration. + /// + private readonly int _count; + + /// + /// The number of elements left in the enumeration. + /// + private int _remainingCount; + + /// + /// A value indicating whether this enumerator walks in reverse order. + /// + private bool _reversed; + + /// + /// The set being enumerated. + /// + private Node _root; + + /// + /// The stack to use for enumerating the binary tree. + /// + private SecurePooledObject>> _stack; + + /// + /// The node currently selected. + /// + private Node _current; + + /// + /// The version of the builder (when applicable) that is being enumerated. + /// + private int _enumeratingBuilderVersion; + + /// + /// Initializes an structure. + /// + /// The root of the set to be enumerated. + /// The builder, if applicable. + /// The index of the first element to enumerate. + /// The number of elements in this collection. + /// true if the list should be enumerated in reverse order. + internal Enumerator(Node root, Builder builder = null, int startIndex = -1, int count = -1, bool reversed = false) + { + Requires.NotNull(root, nameof(root)); + Requires.Range(startIndex >= -1, nameof(startIndex)); + Requires.Range(count >= -1, nameof(count)); + Requires.Argument(reversed || count == -1 || (startIndex == -1 ? 0 : startIndex) + count <= root.Count); + Requires.Argument(!reversed || count == -1 || (startIndex == -1 ? root.Count - 1 : startIndex) - count + 1 >= 0); + + _root = root; + _builder = builder; + _current = null; + _startIndex = startIndex >= 0 ? startIndex : (reversed ? root.Count - 1 : 0); + _count = count == -1 ? root.Count : count; + _remainingCount = _count; + _reversed = reversed; + _enumeratingBuilderVersion = builder != null ? builder.Version : -1; + _poolUserId = SecureObjectPool.NewId(); + _stack = null; + if (_count > 0) + { + if (!s_EnumeratingStacks.TryTake(this, out _stack)) + { + _stack = s_EnumeratingStacks.PrepNew(this, new Stack>(root.Height)); + } + + this.ResetStack(); + } + } + + /// + int ISecurePooledObjectUser.PoolUserId => _poolUserId; + + /// + /// The current element. + /// + public T Current + { + get + { + this.ThrowIfDisposed(); + if (_current != null) + { + return _current.Value; + } + + throw new InvalidOperationException(); + } + } + + /// + /// The current element. + /// + object System.Collections.IEnumerator.Current => this.Current; + + /// + /// Disposes of this enumerator and returns the stack reference to the resource pool. + /// + public void Dispose() + { + _root = null; + _current = null; + Stack> stack; + if (_stack != null && _stack.TryUse(ref this, out stack)) + { + stack.ClearFastWhenEmpty(); + s_EnumeratingStacks.TryAdd(this, _stack); + } + + _stack = null; + } + + /// + /// Advances enumeration to the next element. + /// + /// A value indicating whether there is another element in the enumeration. + public bool MoveNext() + { + this.ThrowIfDisposed(); + this.ThrowIfChanged(); + + if (_stack != null) + { + var stack = _stack.Use(ref this); + if (_remainingCount > 0 && stack.Count > 0) + { + Node n = stack.Pop().Value; + _current = n; + this.PushNext(this.NextBranch(n)); + _remainingCount--; + return true; + } + } + + _current = null; + return false; + } + + /// + /// Restarts enumeration. + /// + public void Reset() + { + this.ThrowIfDisposed(); + + _enumeratingBuilderVersion = _builder != null ? _builder.Version : -1; + _remainingCount = _count; + if (_stack != null) + { + this.ResetStack(); + } + } + + /// Resets the stack used for enumeration. + private void ResetStack() + { + var stack = _stack.Use(ref this); + stack.ClearFastWhenEmpty(); + + var node = _root; + var skipNodes = _reversed ? _root.Count - _startIndex - 1 : _startIndex; + while (!node.IsEmpty && skipNodes != this.PreviousBranch(node).Count) + { + if (skipNodes < this.PreviousBranch(node).Count) + { + stack.Push(new RefAsValueType(node)); + node = this.PreviousBranch(node); + } + else + { + skipNodes -= this.PreviousBranch(node).Count + 1; + node = this.NextBranch(node); + } + } + + if (!node.IsEmpty) + { + stack.Push(new RefAsValueType(node)); + } + } + + /// + /// Obtains the right branch of the given node (or the left, if walking in reverse). + /// + private Node NextBranch(Node node) => _reversed ? node.Left : node.Right; + + /// + /// Obtains the left branch of the given node (or the right, if walking in reverse). + /// + private Node PreviousBranch(Node node) => _reversed ? node.Right : node.Left; + + /// + /// Throws an if this enumerator has been disposed. + /// + private void ThrowIfDisposed() + { + Contract.Ensures(_root != null); + Contract.EnsuresOnThrow(_root == null); + + // Since this is a struct, copies might not have been marked as disposed. + // But the stack we share across those copies would know. + // This trick only works when we have a non-null stack. + // For enumerators of empty collections, there isn't any natural + // way to know when a copy of the struct has been disposed of. + + if (_root == null || (_stack != null && !_stack.IsOwned(ref this))) + { + Requires.FailObjectDisposed(this); + } + } + + /// + /// Throws an exception if the underlying builder's contents have been changed since enumeration started. + /// + /// Thrown if the collection has changed. + private void ThrowIfChanged() + { + if (_builder != null && _builder.Version != _enumeratingBuilderVersion) + { + throw new InvalidOperationException(SR.CollectionModifiedDuringEnumeration); + } + } + + /// + /// Pushes this node and all its Left descendants onto the stack. + /// + /// The starting node to push onto the stack. + private void PushNext(Node node) + { + Requires.NotNull(node, nameof(node)); + if (!node.IsEmpty) + { + var stack = _stack.Use(ref this); + while (!node.IsEmpty) + { + stack.Push(new RefAsValueType(node)); + node = this.PreviousBranch(node); + } + } + } + } + } +} diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs new file mode 100644 index 0000000000..aad42615b3 --- /dev/null +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs @@ -0,0 +1,1526 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Contracts; +using System.Runtime.CompilerServices; + +namespace System.Collections.Immutable +{ + public sealed partial class ImmutableList + { + /// + /// A node in the AVL tree storing this set. + /// + [DebuggerDisplay("{_key}")] + internal sealed class Node : IBinaryTree, IEnumerable + { + /// + /// The default empty node. + /// + internal static readonly Node EmptyNode = new Node(); + + /// + /// The key associated with this node. + /// + private T _key; + + /// + /// A value indicating whether this node has been frozen (made immutable). + /// + /// + /// Nodes must be frozen before ever being observed by a wrapping collection type + /// to protect collections from further mutations. + /// + private bool _frozen; + + /// + /// The depth of the tree beneath this node. + /// + private byte _height; // AVL tree max height <= ~1.44 * log2(maxNodes + 2) + + /// + /// The number of elements contained by this subtree starting at this node. + /// + /// + /// If this node would benefit from saving 4 bytes, we could have only a few nodes + /// scattered throughout the graph actually record the count of nodes beneath them. + /// Those without the count could query their descendants, which would often short-circuit + /// when they hit a node that *does* include a count field. + /// + private int _count; + + /// + /// The left tree. + /// + private Node _left; + + /// + /// The right tree. + /// + private Node _right; + + /// + /// Initializes a new instance of the class + /// that is pre-frozen. + /// + private Node() + { + Contract.Ensures(this.IsEmpty); + _frozen = true; // the empty node is *always* frozen. + } + + /// + /// Initializes a new instance of the class + /// that is not yet frozen. + /// + /// The value stored by this node. + /// The left branch. + /// The right branch. + /// Whether this node is prefrozen. + private Node(T key, Node left, Node right, bool frozen = false) + { + Requires.NotNull(left, nameof(left)); + Requires.NotNull(right, nameof(right)); + Debug.Assert(!frozen || (left._frozen && right._frozen)); + Contract.Ensures(!this.IsEmpty); + + _key = key; + _left = left; + _right = right; + _height = ParentHeight(left, right); + _count = ParentCount(left, right); + _frozen = frozen; + } + + /// + /// Gets a value indicating whether this instance is empty. + /// + /// + /// true if this instance is empty; otherwise, false. + /// + public bool IsEmpty + { + get + { + Contract.Ensures(Contract.Result() == (_left == null)); + Debug.Assert(!(_left == null ^ _right == null)); + return _left == null; + } + } + + /// + /// Gets the height of the tree beneath this node. + /// + public int Height => _height; + + /// + /// Gets the left branch of this node. + /// + public Node Left => _left; + + /// + /// Gets the left branch of this node. + /// + IBinaryTree IBinaryTree.Left => _left; + + /// + /// Gets the right branch of this node. + /// + public Node Right => _right; + + /// + /// Gets the right branch of this node. + /// + IBinaryTree IBinaryTree.Right => _right; + + /// + /// Gets the left branch of this node. + /// + IBinaryTree IBinaryTree.Left => _left; + + /// + /// Gets the right branch of this node. + /// + IBinaryTree IBinaryTree.Right => _right; + + /// + /// Gets the value represented by the current node. + /// + public T Value => _key; + + /// + /// Gets the number of elements contained by this subtree starting at this node. + /// + public int Count => _count; + + /// + /// Gets the key. + /// + internal T Key => _key; + + /// + /// Gets the element of the set at the given index. + /// + /// The 0-based index of the element in the set to return. + /// The element at the given position. + internal T this[int index] + { + get + { + Requires.Range(index >= 0 && index < this.Count, nameof(index)); + + if (index < _left._count) + { + return _left[index]; + } + + if (index > _left._count) + { + return _right[index - _left._count - 1]; + } + + return _key; + } + } + + #region IEnumerable Members + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + public Enumerator GetEnumerator() => new Enumerator(this); + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + [ExcludeFromCodeCoverage] // internal, never called, but here for interface implementation + IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + [ExcludeFromCodeCoverage] // internal, never called, but here for interface implementation + IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); + + #endregion + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// The builder, if applicable. + /// + /// A that can be used to iterate through the collection. + /// + internal Enumerator GetEnumerator(Builder builder) => new Enumerator(this, builder); + + /// + /// Creates a node tree that contains the contents of a list. + /// + /// An indexable list with the contents that the new node tree should contain. + /// The starting index within that should be captured by the node tree. + /// The number of elements from that should be captured by the node tree. + /// The root of the created node tree. + [Pure] + internal static Node NodeTreeFromList(IOrderedCollection items, int start, int length) + { + Requires.NotNull(items, nameof(items)); + Requires.Range(start >= 0, nameof(start)); + Requires.Range(length >= 0, nameof(length)); + + if (length == 0) + { + return EmptyNode; + } + + int rightCount = (length - 1) / 2; + int leftCount = (length - 1) - rightCount; + Node left = NodeTreeFromList(items, start, leftCount); + Node right = NodeTreeFromList(items, start + leftCount + 1, rightCount); + return new Node(items[start + leftCount], left, right, true); + } + + /// + /// Adds the specified key to the tree. + /// + /// The key. + /// The new tree. + internal Node Add(T key) + { + if (this.IsEmpty) + { + return CreateLeaf(key); + } + + Node newRight = _right.Add(key); + Node result = this.MutateRight(newRight); + return result.IsBalanced ? result : result.BalanceRight(); + } + + /// + /// Adds a value at a given index to this node. + /// + /// The location for the new value. + /// The value to add. + /// The new tree. + internal Node Insert(int index, T key) + { + Requires.Range(index >= 0 && index <= this.Count, nameof(index)); + + if (this.IsEmpty) + { + return CreateLeaf(key); + } + + if (index <= _left._count) + { + Node newLeft = _left.Insert(index, key); + Node result = this.MutateLeft(newLeft); + return result.IsBalanced ? result : result.BalanceLeft(); + } + else + { + Node newRight = _right.Insert(index - _left._count - 1, key); + Node result = this.MutateRight(newRight); + return result.IsBalanced ? result : result.BalanceRight(); + } + } + + /// + /// Adds the specified keys to this tree. + /// + /// The keys. + /// The new tree. + internal Node AddRange(IEnumerable keys) + { + Requires.NotNull(keys, nameof(keys)); + + if (this.IsEmpty) + { + return CreateRange(keys); + } + + Node newRight = _right.AddRange(keys); + Node result = this.MutateRight(newRight); + return result.BalanceMany(); + } + + /// + /// Adds the specified keys at a given index to this tree. + /// + /// The location for the new keys. + /// The keys. + /// The new tree. + internal Node InsertRange(int index, IEnumerable keys) + { + Requires.Range(index >= 0 && index <= this.Count, nameof(index)); + Requires.NotNull(keys, nameof(keys)); + + if (this.IsEmpty) + { + return CreateRange(keys); + } + + Node result; + if (index <= _left._count) + { + Node newLeft = _left.InsertRange(index, keys); + result = this.MutateLeft(newLeft); + } + else + { + Node newRight = _right.InsertRange(index - _left._count - 1, keys); + result = this.MutateRight(newRight); + } + + return result.BalanceMany(); + } + + /// + /// Removes a value at a given index to this node. + /// + /// The location for the new value. + /// The new tree. + internal Node RemoveAt(int index) + { + Requires.Range(index >= 0 && index < this.Count, nameof(index)); + + Node result = this; + if (index == _left._count) + { + // We have a match. If this is a leaf, just remove it + // by returning Empty. If we have only one child, + // replace the node with the child. + if (_right.IsEmpty && _left.IsEmpty) + { + result = EmptyNode; + } + else if (_right.IsEmpty && !_left.IsEmpty) + { + result = _left; + } + else if (!_right.IsEmpty && _left.IsEmpty) + { + result = _right; + } + else + { + // We have two children. Remove the next-highest node and replace + // this node with it. + var successor = _right; + while (!successor._left.IsEmpty) + { + successor = successor._left; + } + + var newRight = _right.RemoveAt(0); + result = successor.MutateBoth(left: _left, right: newRight); + } + } + else if (index < _left._count) + { + var newLeft = _left.RemoveAt(index); + result = this.MutateLeft(newLeft); + } + else + { + var newRight = _right.RemoveAt(index - _left._count - 1); + result = this.MutateRight(newRight); + } + + return result.IsEmpty || result.IsBalanced ? result : result.Balance(); + } + + /// + /// Removes all the elements that match the conditions defined by the specified + /// predicate. + /// + /// + /// The delegate that defines the conditions of the elements + /// to remove. + /// + /// + /// The new node tree. + /// + internal Node RemoveAll(Predicate match) + { + Requires.NotNull(match, nameof(match)); + Contract.Ensures(Contract.Result() != null); + + var result = this; + var enumerator = new Enumerator(result); + try + { + var startIndex = 0; + while (enumerator.MoveNext()) + { + if (match(enumerator.Current)) + { + result = result.RemoveAt(startIndex); + enumerator.Dispose(); + enumerator = new Enumerator(result, startIndex: startIndex); + } + else + { + startIndex++; + } + } + } + finally + { + enumerator.Dispose(); + } + + return result; + } + + /// + /// Replaces a value at a given index. + /// + /// The location for the new value. + /// The new value for the node. + /// The new tree. + internal Node ReplaceAt(int index, T value) + { + Requires.Range(index >= 0 && index < this.Count, nameof(index)); + Debug.Assert(!this.IsEmpty); + + Node result = this; + if (index == _left._count) + { + // We have a match. + result = this.MutateKey(value); + } + else if (index < _left._count) + { + var newLeft = _left.ReplaceAt(index, value); + result = this.MutateLeft(newLeft); + } + else + { + var newRight = _right.ReplaceAt(index - _left._count - 1, value); + result = this.MutateRight(newRight); + } + + return result; + } + + /// + /// Reverses the order of the elements in the entire . + /// + /// The reversed list. + internal Node Reverse() => this.Reverse(0, this.Count); + + /// + /// Reverses the order of the elements in the specified range. + /// + /// The zero-based starting index of the range to reverse. + /// The number of elements in the range to reverse. + /// The reversed list. + internal Node Reverse(int index, int count) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + Requires.Range(index + count <= this.Count, nameof(index)); + + Node result = this; + int start = index; + int end = index + count - 1; + while (start < end) + { + T a = result[start]; + T b = result[end]; + result = result + .ReplaceAt(end, a) + .ReplaceAt(start, b); + start++; + end--; + } + + return result; + } + + /// + /// Sorts the elements in the entire using + /// the default comparer. + /// + internal Node Sort() => this.Sort(Comparer.Default); + + /// + /// Sorts the elements in the entire using + /// the specified . + /// + /// + /// The to use when comparing elements. + /// + /// The sorted list. + internal Node Sort(Comparison comparison) + { + Requires.NotNull(comparison, nameof(comparison)); + Contract.Ensures(Contract.Result() != null); + + // PERF: Eventually this might be reimplemented in a way that does not require allocating an array. + var array = new T[this.Count]; + this.CopyTo(array); + Array.Sort(array, comparison); + return NodeTreeFromList(array.AsOrderedCollection(), 0, this.Count); + } + + /// + /// Sorts the elements in the entire using + /// the specified comparer. + /// + /// + /// The implementation to use when comparing + /// elements, or null to use the default comparer . + /// + /// The sorted list. + internal Node Sort(IComparer comparer) => this.Sort(0, this.Count, comparer); + + /// + /// Sorts the elements in a range of elements in + /// using the specified comparer. + /// + /// + /// The zero-based starting index of the range to sort. + /// + /// + /// The length of the range to sort. + /// + /// + /// The implementation to use when comparing + /// elements, or null to use the default comparer . + /// + /// The sorted list. + internal Node Sort(int index, int count, IComparer comparer) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + Requires.Argument(index + count <= this.Count); + + // PERF: Eventually this might be reimplemented in a way that does not require allocating an array. + var array = new T[this.Count]; + this.CopyTo(array); + Array.Sort(array, index, count, comparer); + return NodeTreeFromList(array.AsOrderedCollection(), 0, this.Count); + } + + /// + /// Searches a range of elements in the sorted + /// for an element using the specified comparer and returns the zero-based index + /// of the element. + /// + /// The zero-based starting index of the range to search. + /// The length of the range to search. + /// The object to locate. The value can be null for reference types. + /// + /// The implementation to use when comparing + /// elements, or null to use the default comparer . + /// + /// + /// The zero-based index of item in the sorted , + /// if item is found; otherwise, a negative number that is the bitwise complement + /// of the index of the next element that is larger than item or, if there is + /// no larger element, the bitwise complement of . + /// + /// + /// is less than 0.-or- is less than 0. + /// + /// + /// and do not denote a valid range in the . + /// + /// + /// is null, and the default comparer + /// cannot find an implementation of the generic interface + /// or the interface for type . + /// + internal int BinarySearch(int index, int count, T item, IComparer comparer) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + comparer = comparer ?? Comparer.Default; + + if (this.IsEmpty || count <= 0) + { + return ~index; + } + + // If this node is not within range, defer to either branch as appropriate. + int thisNodeIndex = _left.Count; // this is only the index within the AVL tree, treating this node as root rather than a member of a larger tree. + if (index + count <= thisNodeIndex) + { + return _left.BinarySearch(index, count, item, comparer); + } + else if (index > thisNodeIndex) + { + int result = _right.BinarySearch(index - thisNodeIndex - 1, count, item, comparer); + int offset = thisNodeIndex + 1; + return result < 0 ? result - offset : result + offset; + } + + // We're definitely in the caller's designated range now. + // Any possible match will be a descendant of this node (or this immediate one). + // Some descendants may not be in range, but if we hit any it means no match was found, + // and a negative response would come back from the above code to the below code. + int compare = comparer.Compare(item, _key); + if (compare == 0) + { + return thisNodeIndex; + } + else if (compare > 0) + { + int adjustedCount = count - (thisNodeIndex - index) - 1; + int result = adjustedCount < 0 ? -1 : _right.BinarySearch(0, adjustedCount, item, comparer); + int offset = thisNodeIndex + 1; + return result < 0 ? result - offset : result + offset; + } + else + { + if (index == thisNodeIndex) + { + // We can't go any further left. + return ~index; + } + + int result = _left.BinarySearch(index, count, item, comparer); + return result; + } + } + + /// + /// Searches for the specified object and returns the zero-based index of the + /// first occurrence within the range of elements in the + /// that starts at the specified index and contains the specified number of elements. + /// + /// + /// The object to locate in the . The value + /// can be null for reference types. + /// + /// The equality comparer to use for testing the match of two elements. + /// + /// The zero-based index of the first occurrence of within the entire + /// , if found; otherwise, -1. + /// + [Pure] + internal int IndexOf(T item, IEqualityComparer equalityComparer) => this.IndexOf(item, 0, this.Count, equalityComparer); + + /// + /// Searches for the specified object and returns the zero-based index of the + /// first occurrence within the range of elements in the + /// that starts at the specified index and contains the specified number of elements. + /// + /// + /// The object to locate in the . The value + /// can be null for reference types. + /// + /// + /// The zero-based starting index of the search. 0 (zero) is valid in an empty + /// list. + /// + /// + /// The number of elements in the section to search. + /// + /// + /// The equality comparer to use in the search. + /// If null, is used. + /// + /// + /// The zero-based index of the first occurrence of within the range of + /// elements in the that starts at and + /// contains number of elements, if found; otherwise, -1. + /// + [Pure] + internal int IndexOf(T item, int index, int count, IEqualityComparer equalityComparer) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + Requires.Range(count <= this.Count, nameof(count)); + Requires.Range(index + count <= this.Count, nameof(count)); + + equalityComparer = equalityComparer ?? EqualityComparer.Default; + using (var enumerator = new Enumerator(this, startIndex: index, count: count)) + { + while (enumerator.MoveNext()) + { + if (equalityComparer.Equals(item, enumerator.Current)) + { + return index; + } + + index++; + } + } + + return -1; + } + + /// + /// Searches for the specified object and returns the zero-based index of the + /// last occurrence within the range of elements in the + /// that contains the specified number of elements and ends at the specified + /// index. + /// + /// + /// The object to locate in the . The value + /// can be null for reference types. + /// + /// The zero-based starting index of the backward search. + /// The number of elements in the section to search. + /// The equality comparer to use for testing the match of two elements. + /// + /// The zero-based index of the last occurrence of within the range of elements + /// in the that contains number of elements + /// and ends at , if found; otherwise, -1. + /// + [Pure] + internal int LastIndexOf(T item, int index, int count, IEqualityComparer equalityComparer) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0 && count <= this.Count, nameof(count)); + Requires.Argument(index - count + 1 >= 0); + + equalityComparer = equalityComparer ?? EqualityComparer.Default; + using (var enumerator = new Enumerator(this, startIndex: index, count: count, reversed: true)) + { + while (enumerator.MoveNext()) + { + if (equalityComparer.Equals(item, enumerator.Current)) + { + return index; + } + + index--; + } + } + + return -1; + } + + /// + /// Copies the entire to a compatible one-dimensional + /// array, starting at the beginning of the target array. + /// + /// + /// The one-dimensional that is the destination of the elements + /// copied from . The must have + /// zero-based indexing. + /// + internal void CopyTo(T[] array) + { + Requires.NotNull(array, nameof(array)); + Requires.Range(array.Length >= this.Count, nameof(array)); + + int index = 0; + foreach (var element in this) + { + array[index++] = element; + } + } + + /// + /// Copies the entire to a compatible one-dimensional + /// array, starting at the specified index of the target array. + /// + /// + /// The one-dimensional that is the destination of the elements + /// copied from . The must have + /// zero-based indexing. + /// + /// + /// The zero-based index in at which copying begins. + /// + internal void CopyTo(T[] array, int arrayIndex) + { + Requires.NotNull(array, nameof(array)); + Requires.Range(arrayIndex >= 0, nameof(arrayIndex)); + Requires.Range(array.Length >= arrayIndex + this.Count, nameof(arrayIndex)); + + foreach (var element in this) + { + array[arrayIndex++] = element; + } + } + + /// + /// Copies a range of elements from the to + /// a compatible one-dimensional array, starting at the specified index of the + /// target array. + /// + /// + /// The zero-based index in the source at + /// which copying begins. + /// + /// + /// The one-dimensional that is the destination of the elements + /// copied from . The must have + /// zero-based indexing. + /// + /// The zero-based index in at which copying begins. + /// The number of elements to copy. + internal void CopyTo(int index, T[] array, int arrayIndex, int count) + { + Requires.NotNull(array, nameof(array)); + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + Requires.Range(index + count <= this.Count, nameof(count)); + Requires.Range(arrayIndex >= 0, nameof(arrayIndex)); + Requires.Range(arrayIndex + count <= array.Length, nameof(arrayIndex)); + + using (var enumerator = new Enumerator(this, startIndex: index, count: count)) + { + while (enumerator.MoveNext()) + { + array[arrayIndex++] = enumerator.Current; + } + } + } + + /// + /// Copies the elements of the to an , starting at a particular index. + /// + /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. + /// The zero-based index in at which copying begins. + internal void CopyTo(Array array, int arrayIndex) + { + Requires.NotNull(array, nameof(array)); + Requires.Range(arrayIndex >= 0, nameof(arrayIndex)); + Requires.Range(array.Length >= arrayIndex + this.Count, nameof(arrayIndex)); + + foreach (var element in this) + { + array.SetValue(element, arrayIndex++); + } + } + + /// + /// Converts the elements in the current to + /// another type, and returns a list containing the converted elements. + /// + /// + /// A delegate that converts each element from + /// one type to another type. + /// + /// + /// The type of the elements of the target array. + /// + /// + /// A node tree with the transformed list. + /// + internal ImmutableList.Node ConvertAll(Func converter) + { + var root = ImmutableList.Node.EmptyNode; + + if (this.IsEmpty) + { + return root; + } + + return root.AddRange(Linq.Enumerable.Select(this, converter)); + } + + /// + /// Determines whether every element in the + /// matches the conditions defined by the specified predicate. + /// + /// + /// The delegate that defines the conditions to check against + /// the elements. + /// + /// + /// true if every element in the matches the + /// conditions defined by the specified predicate; otherwise, false. If the list + /// has no elements, the return value is true. + /// + internal bool TrueForAll(Predicate match) + { + Requires.NotNull(match, nameof(match)); + + foreach (var item in this) + { + if (!match(item)) + { + return false; + } + } + + return true; + } + + /// + /// Determines whether the contains elements + /// that match the conditions defined by the specified predicate. + /// + /// + /// The delegate that defines the conditions of the elements + /// to search for. + /// + /// + /// true if the contains one or more elements + /// that match the conditions defined by the specified predicate; otherwise, + /// false. + /// + internal bool Exists(Predicate match) + { + Requires.NotNull(match, nameof(match)); + + foreach (T item in this) + { + if (match(item)) + { + return true; + } + } + + return false; + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the first occurrence within the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The first element that matches the conditions defined by the specified predicate, + /// if found; otherwise, the default value for type . + /// + internal T Find(Predicate match) + { + Requires.NotNull(match, nameof(match)); + + foreach (var item in this) + { + if (match(item)) + { + return item; + } + } + + return default(T); + } + + /// + /// Retrieves all the elements that match the conditions defined by the specified + /// predicate. + /// + /// + /// The delegate that defines the conditions of the elements + /// to search for. + /// + /// + /// A containing all the elements that match + /// the conditions defined by the specified predicate, if found; otherwise, an + /// empty . + /// + internal ImmutableList FindAll(Predicate match) + { + Requires.NotNull(match, nameof(match)); + Contract.Ensures(Contract.Result>() != null); + + if (this.IsEmpty) + { + return ImmutableList.Empty; + } + + List list = null; + foreach (var item in this) + { + if (match(item)) + { + if (list == null) + { + list = new List(); + } + + list.Add(item); + } + } + + return list != null ? + ImmutableList.CreateRange(list) : + ImmutableList.Empty; + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the first occurrence within + /// the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The zero-based index of the first occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + internal int FindIndex(Predicate match) + { + Requires.NotNull(match, nameof(match)); + Contract.Ensures(Contract.Result() >= -1); + + return this.FindIndex(0, _count, match); + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the first occurrence within + /// the range of elements in the that extends + /// from the specified index to the last element. + /// + /// The zero-based starting index of the search. + /// The delegate that defines the conditions of the element to search for. + /// + /// The zero-based index of the first occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + internal int FindIndex(int startIndex, Predicate match) + { + Requires.NotNull(match, nameof(match)); + Requires.Range(startIndex >= 0 && startIndex <= this.Count, nameof(startIndex)); + + return this.FindIndex(startIndex, this.Count - startIndex, match); + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the first occurrence within + /// the range of elements in the that starts + /// at the specified index and contains the specified number of elements. + /// + /// The zero-based starting index of the search. + /// The number of elements in the section to search. + /// The delegate that defines the conditions of the element to search for. + /// + /// The zero-based index of the first occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + internal int FindIndex(int startIndex, int count, Predicate match) + { + Requires.NotNull(match, nameof(match)); + Requires.Range(startIndex >= 0, nameof(startIndex)); + Requires.Range(count >= 0, nameof(count)); + Requires.Range(startIndex + count <= this.Count, nameof(count)); + + using (var enumerator = new Enumerator(this, startIndex: startIndex, count: count)) + { + int index = startIndex; + while (enumerator.MoveNext()) + { + if (match(enumerator.Current)) + { + return index; + } + + index++; + } + } + + return -1; + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the last occurrence within the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The last element that matches the conditions defined by the specified predicate, + /// if found; otherwise, the default value for type . + /// + internal T FindLast(Predicate match) + { + Requires.NotNull(match, nameof(match)); + + using (var enumerator = new Enumerator(this, reversed: true)) + { + while (enumerator.MoveNext()) + { + if (match(enumerator.Current)) + { + return enumerator.Current; + } + } + } + + return default(T); + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the last occurrence within + /// the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The zero-based index of the last occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + internal int FindLastIndex(Predicate match) + { + Requires.NotNull(match, nameof(match)); + Contract.Ensures(Contract.Result() >= -1); + + return this.IsEmpty ? -1 : this.FindLastIndex(this.Count - 1, this.Count, match); + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the last occurrence within + /// the range of elements in the that extends + /// from the first element to the specified index. + /// + /// The zero-based starting index of the backward search. + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// The zero-based index of the last occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + internal int FindLastIndex(int startIndex, Predicate match) + { + Requires.NotNull(match, nameof(match)); + Requires.Range(startIndex >= 0, nameof(startIndex)); + Requires.Range(startIndex == 0 || startIndex < this.Count, nameof(startIndex)); + + return this.IsEmpty ? -1 : this.FindLastIndex(startIndex, startIndex + 1, match); + } + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the last occurrence within + /// the range of elements in the that contains + /// the specified number of elements and ends at the specified index. + /// + /// The zero-based starting index of the backward search. + /// The number of elements in the section to search. + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The zero-based index of the last occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + internal int FindLastIndex(int startIndex, int count, Predicate match) + { + Requires.NotNull(match, nameof(match)); + Requires.Range(startIndex >= 0, nameof(startIndex)); + Requires.Range(count <= this.Count, nameof(count)); + Requires.Range(startIndex - count + 1 >= 0, nameof(startIndex)); + + using (var enumerator = new Enumerator(this, startIndex: startIndex, count: count, reversed: true)) + { + int index = startIndex; + while (enumerator.MoveNext()) + { + if (match(enumerator.Current)) + { + return index; + } + + index--; + } + } + + return -1; + } + + /// + /// Freezes this node and all descendant nodes so that any mutations require a new instance of the nodes. + /// + internal void Freeze() + { + // If this node is frozen, all its descendants must already be frozen. + if (!_frozen) + { + _left.Freeze(); + _right.Freeze(); + _frozen = true; + } + } + + #region Tree balancing methods + + /// + /// AVL rotate left operation. + /// + /// The rotated tree. + private Node RotateLeft() + { + Debug.Assert(!this.IsEmpty); + Debug.Assert(!_right.IsEmpty); + Contract.Ensures(Contract.Result() != null); + + return _right.MutateLeft(this.MutateRight(_right._left)); + } + + /// + /// AVL rotate right operation. + /// + /// The rotated tree. + private Node RotateRight() + { + Debug.Assert(!this.IsEmpty); + Debug.Assert(!_left.IsEmpty); + Contract.Ensures(Contract.Result() != null); + + return _left.MutateRight(this.MutateLeft(_left._right)); + } + + /// + /// AVL rotate double-left operation. + /// + /// The rotated tree. + private Node DoubleLeft() + { + Debug.Assert(!this.IsEmpty); + Debug.Assert(!_right.IsEmpty); + Debug.Assert(!_right._left.IsEmpty); + Contract.Ensures(Contract.Result() != null); + + // The following is an optimized version of rotating the right child right, then rotating the parent left. + Node right = _right; + Node rightLeft = right._left; + return rightLeft.MutateBoth( + left: this.MutateRight(rightLeft._left), + right: right.MutateLeft(rightLeft._right)); + } + + /// + /// AVL rotate double-right operation. + /// + /// The rotated tree. + private Node DoubleRight() + { + Debug.Assert(!this.IsEmpty); + Debug.Assert(!_left.IsEmpty); + Debug.Assert(!_left._right.IsEmpty); + Contract.Ensures(Contract.Result() != null); + + // The following is an optimized version of rotating the left child left, then rotating the parent right. + Node left = _left; + Node leftRight = left._right; + return leftRight.MutateBoth( + left: left.MutateRight(leftRight._left), + right: this.MutateLeft(leftRight._right)); + } + + /// + /// Gets a value indicating whether this tree is in balance. + /// + /// + /// 0 if the heights of both sides are the same, a positive integer if the right side is taller, or a negative integer if the left side is taller. + /// + private int BalanceFactor + { + get + { + Debug.Assert(!this.IsEmpty); + return _right._height - _left._height; + } + } + + /// + /// Determines whether this tree is right heavy. + /// + /// + /// true if this tree is right heavy; otherwise, false. + /// + private bool IsRightHeavy => this.BalanceFactor >= 2; + + /// + /// Determines whether this tree is left heavy. + /// + /// + /// true if this tree is left heavy; otherwise, false. + /// + private bool IsLeftHeavy => this.BalanceFactor <= -2; + + /// + /// Determines whether this tree has a balance factor of -1, 0, or 1. + /// + /// + /// true if this tree is balanced; otherwise, false. + /// + private bool IsBalanced => unchecked((uint)(this.BalanceFactor + 1)) <= 2; + + /// + /// Balances this tree. + /// + /// A balanced tree. + private Node Balance() => this.IsLeftHeavy ? this.BalanceLeft() : this.BalanceRight(); + + /// + /// Balances the left side of this tree by rotating this tree rightwards. + /// + /// A balanced tree. + private Node BalanceLeft() + { + Debug.Assert(!this.IsEmpty); + Debug.Assert(this.IsLeftHeavy); + + return _left.BalanceFactor > 0 ? this.DoubleRight() : this.RotateRight(); + } + + /// + /// Balances the right side of this tree by rotating this tree leftwards. + /// + /// A balanced tree. + private Node BalanceRight() + { + Debug.Assert(!this.IsEmpty); + Debug.Assert(this.IsRightHeavy); + + return _right.BalanceFactor < 0 ? this.DoubleLeft() : this.RotateLeft(); + } + + /// + /// Balances this tree. Allows for a large imbalance between left and + /// right nodes, but assumes left and right nodes are individually balanced. + /// + /// A balanced tree. + /// + /// If this tree is already balanced, this method does nothing. + /// + private Node BalanceMany() + { + Node tree = this; + while (!tree.IsBalanced) + { + if (tree.IsRightHeavy) + { + tree = tree.BalanceRight(); + tree.MutateLeft(tree._left.BalanceMany()); + } + else + { + tree = tree.BalanceLeft(); + tree.MutateRight(tree._right.BalanceMany()); + } + } + + return tree; + } + + #endregion + + /// + /// Creates a node mutation, either by mutating this node (if not yet frozen) or by creating a clone of this node + /// with the described changes. + /// + /// The left branch of the mutated node. + /// The right branch of the mutated node. + /// The mutated (or created) node. + private Node MutateBoth(Node left, Node right) + { + Requires.NotNull(left, nameof(left)); + Requires.NotNull(right, nameof(right)); + Debug.Assert(!this.IsEmpty); + + if (_frozen) + { + return new Node(_key, left, right); + } + else + { + _left = left; + _right = right; + _height = ParentHeight(left, right); + _count = ParentCount(left, right); + return this; + } + } + + /// + /// Creates a node mutation, either by mutating this node (if not yet frozen) or by creating a clone of this node + /// with the described changes. + /// + /// The left branch of the mutated node. + /// The mutated (or created) node. + private Node MutateLeft(Node left) + { + Requires.NotNull(left, nameof(left)); + Debug.Assert(!this.IsEmpty); + + if (_frozen) + { + return new Node(_key, left, _right); + } + else + { + _left = left; + _height = ParentHeight(left, _right); + _count = ParentCount(left, _right); + return this; + } + } + + /// + /// Creates a node mutation, either by mutating this node (if not yet frozen) or by creating a clone of this node + /// with the described changes. + /// + /// The right branch of the mutated node. + /// The mutated (or created) node. + private Node MutateRight(Node right) + { + Requires.NotNull(right, nameof(right)); + Debug.Assert(!this.IsEmpty); + + if (_frozen) + { + return new Node(_key, _left, right); + } + else + { + _right = right; + _height = ParentHeight(_left, right); + _count = ParentCount(_left, right); + return this; + } + } + + /// + /// Calculates the height of the parent node from its children. + /// + /// The left child. + /// The right child. + /// The height of the parent node. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static byte ParentHeight(Node left, Node right) => checked((byte)(1 + Math.Max(left._height, right._height))); + + /// + /// Calculates the number of elements in the parent node from its children. + /// + /// The left child. + /// The right child. + /// The number of elements in the parent node. + private static int ParentCount(Node left, Node right) => 1 + left._count + right._count; + + /// + /// Creates a node mutation, either by mutating this node (if not yet frozen) or by creating a clone of this node + /// with the described changes. + /// + /// The new key for this node. + /// The mutated (or created) node. + private Node MutateKey(T key) + { + Debug.Assert(!this.IsEmpty); + + if (_frozen) + { + return new Node(key, _left, _right); + } + else + { + _key = key; + return this; + } + } + + /// + /// Creates a node from the specified keys. + /// + /// The keys. + /// The root of the created node tree. + private static Node CreateRange(IEnumerable keys) + { + ImmutableList other; + if (TryCastToImmutableList(keys, out other)) + { + return other._root; + } + + var list = keys.AsOrderedCollection(); + return NodeTreeFromList(list, 0, list.Count); + } + + /// + /// Creates a leaf node. + /// + /// The leaf node's key. + /// The leaf node. + private static Node CreateLeaf(T key) => new Node(key, left: EmptyNode, right: EmptyNode); + } + } +} diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.cs new file mode 100644 index 0000000000..6f0eb3bc9b --- /dev/null +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.cs @@ -0,0 +1,1227 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Contracts; +using System.Linq; + +namespace System.Collections.Immutable +{ + /// + /// An immutable list implementation. + /// + /// The type of elements in the set. + [DebuggerDisplay("Count = {Count}")] + [DebuggerTypeProxy(typeof(ImmutableEnumerableDebuggerProxy<>))] + public sealed partial class ImmutableList : IImmutableList, IList, IList, IOrderedCollection, IImmutableListQueries, IStrongEnumerable.Enumerator> + { + /// + /// An empty immutable list. + /// + [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + public static readonly ImmutableList Empty = new ImmutableList(); + + /// + /// The root node of the AVL tree that stores this set. + /// + private readonly Node _root; + + /// + /// Initializes a new instance of the class. + /// + internal ImmutableList() => _root = Node.EmptyNode; + + /// + /// Initializes a new instance of the class. + /// + /// The root of the AVL tree with the contents of this set. + private ImmutableList(Node root) + { + Requires.NotNull(root, nameof(root)); + + root.Freeze(); + _root = root; + } + + /// + /// See the interface. + /// + public ImmutableList Clear() => Empty; + + /// + /// Searches the entire sorted for an element + /// using the default comparer and returns the zero-based index of the element. + /// + /// The object to locate. The value can be null for reference types. + /// + /// The zero-based index of item in the sorted , + /// if item is found; otherwise, a negative number that is the bitwise complement + /// of the index of the next element that is larger than item or, if there is + /// no larger element, the bitwise complement of . + /// + /// + /// The default comparer cannot + /// find an implementation of the generic interface or + /// the interface for type . + /// + public int BinarySearch(T item) => this.BinarySearch(item, null); + + /// + /// Searches the entire sorted for an element + /// using the specified comparer and returns the zero-based index of the element. + /// + /// The object to locate. The value can be null for reference types. + /// + /// The implementation to use when comparing + /// elements.-or-null to use the default comparer . + /// + /// + /// The zero-based index of item in the sorted , + /// if item is found; otherwise, a negative number that is the bitwise complement + /// of the index of the next element that is larger than item or, if there is + /// no larger element, the bitwise complement of . + /// + /// + /// is null, and the default comparer + /// cannot find an implementation of the generic interface + /// or the interface for type . + /// + public int BinarySearch(T item, IComparer comparer) => this.BinarySearch(0, this.Count, item, comparer); + + /// + /// Searches a range of elements in the sorted + /// for an element using the specified comparer and returns the zero-based index + /// of the element. + /// + /// The zero-based starting index of the range to search. + /// The length of the range to search. + /// The object to locate. The value can be null for reference types. + /// + /// The implementation to use when comparing + /// elements, or null to use the default comparer . + /// + /// + /// The zero-based index of item in the sorted , + /// if item is found; otherwise, a negative number that is the bitwise complement + /// of the index of the next element that is larger than item or, if there is + /// no larger element, the bitwise complement of . + /// + /// + /// is less than 0.-or- is less than 0. + /// + /// + /// and do not denote a valid range in the . + /// + /// + /// is null, and the default comparer + /// cannot find an implementation of the generic interface + /// or the interface for type . + /// + public int BinarySearch(int index, int count, T item, IComparer comparer) => _root.BinarySearch(index, count, item, comparer); + + #region IImmutableList Properties + + /// + /// See the interface. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + public bool IsEmpty => _root.IsEmpty; + + /// + /// See the interface. + /// + IImmutableList IImmutableList.Clear() => this.Clear(); + + /// + /// See the interface. + /// + public int Count => _root.Count; + + #endregion + + #region ICollection Properties + + /// + /// See . + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + object ICollection.SyncRoot => this; + + /// + /// See the interface. + /// + /// + /// This type is immutable, so it is always thread-safe. + /// + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + bool ICollection.IsSynchronized => true; + + #endregion + + #region IImmutableList Indexers + + /// + /// Gets the element of the set at the given index. + /// + /// The 0-based index of the element in the set to return. + /// The element at the given position. + /// Thrown from getter when is negative or not less than . + public T this[int index] => _root[index]; + + #endregion + + #region IOrderedCollection Indexers + + /// + /// Gets the element in the collection at a given index. + /// + T IOrderedCollection.this[int index] => this[index]; + + #endregion + + #region Public methods + + /// + /// Creates a collection with the same contents as this collection that + /// can be efficiently mutated across multiple operations using standard + /// mutable interfaces. + /// + /// + /// This is an O(1) operation and results in only a single (small) memory allocation. + /// The mutable collection that is returned is *not* thread-safe. + /// + [Pure] + public Builder ToBuilder() + { + // We must not cache the instance created here and return it to various callers. + // Those who request a mutable collection must get references to the collection + // that version independently of each other. + return new Builder(this); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList Add(T value) + { + Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result>().Count == this.Count + 1); + var result = _root.Add(value); + return this.Wrap(result); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList AddRange(IEnumerable items) + { + Requires.NotNull(items, nameof(items)); + Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result>().Count >= this.Count); + + // Some optimizations may apply if we're an empty list. + if (this.IsEmpty) + { + return CreateRange(items); + } + + var result = _root.AddRange(items); + + return this.Wrap(result); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList Insert(int index, T item) + { + Requires.Range(index >= 0 && index <= this.Count, nameof(index)); + Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result>().Count == this.Count + 1); + return this.Wrap(_root.Insert(index, item)); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList InsertRange(int index, IEnumerable items) + { + Requires.Range(index >= 0 && index <= this.Count, nameof(index)); + Requires.NotNull(items, nameof(items)); + Contract.Ensures(Contract.Result>() != null); + + var result = _root.InsertRange(index, items); + + return this.Wrap(result); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList Remove(T value) => this.Remove(value, EqualityComparer.Default); + + /// + /// See the interface. + /// + [Pure] + public ImmutableList Remove(T value, IEqualityComparer equalityComparer) + { + Contract.Ensures(Contract.Result>() != null); + int index = this.IndexOf(value, equalityComparer); + return index < 0 ? this : this.RemoveAt(index); + } + + /// + /// Removes the specified values from this list. + /// + /// The starting index to begin removal. + /// The number of elements to remove. + /// A new list with the elements removed. + [Pure] + public ImmutableList RemoveRange(int index, int count) + { + Requires.Range(index >= 0 && index <= this.Count, nameof(index)); + Requires.Range(count >= 0 && index + count <= this.Count, nameof(count)); + Contract.Ensures(Contract.Result>() != null); + + var result = _root; + int remaining = count; + while (remaining-- > 0) + { + result = result.RemoveAt(index); + } + + return this.Wrap(result); + } + + /// + /// Removes the specified values from this list. + /// + /// The items to remove if matches are found in this list. + /// + /// A new list with the elements removed. + /// + [Pure] + public ImmutableList RemoveRange(IEnumerable items) => this.RemoveRange(items, EqualityComparer.Default); + + /// + /// Removes the specified values from this list. + /// + /// The items to remove if matches are found in this list. + /// + /// The equality comparer to use in the search. + /// If null, is used. + /// + /// + /// A new list with the elements removed. + /// + [Pure] + public ImmutableList RemoveRange(IEnumerable items, IEqualityComparer equalityComparer) + { + Requires.NotNull(items, nameof(items)); + Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result>().Count <= this.Count); + + // Some optimizations may apply if we're an empty list. + if (this.IsEmpty) + { + return this; + } + + // Let's not implement in terms of ImmutableList.Remove so that we're + // not unnecessarily generating a new list object for each item. + var result = _root; + foreach (T item in items.GetEnumerableDisposable()) + { + int index = result.IndexOf(item, equalityComparer); + if (index >= 0) + { + result = result.RemoveAt(index); + } + } + + return this.Wrap(result); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList RemoveAt(int index) + { + Requires.Range(index >= 0 && index < this.Count, nameof(index)); + Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result>().Count == this.Count - 1); + var result = _root.RemoveAt(index); + return this.Wrap(result); + } + + /// + /// Removes all the elements that match the conditions defined by the specified + /// predicate. + /// + /// + /// The delegate that defines the conditions of the elements + /// to remove. + /// + /// + /// The new list. + /// + [Pure] + public ImmutableList RemoveAll(Predicate match) + { + Requires.NotNull(match, nameof(match)); + Contract.Ensures(Contract.Result>() != null); + + return this.Wrap(_root.RemoveAll(match)); + } + + /// + /// See the interface. + /// + [Pure] + public ImmutableList SetItem(int index, T value) => this.Wrap(_root.ReplaceAt(index, value)); + + /// + /// See the interface. + /// + [Pure] + public ImmutableList Replace(T oldValue, T newValue) => this.Replace(oldValue, newValue, EqualityComparer.Default); + + /// + /// See the interface. + /// + [Pure] + public ImmutableList Replace(T oldValue, T newValue, IEqualityComparer equalityComparer) + { + Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result>().Count == this.Count); + + int index = this.IndexOf(oldValue, equalityComparer); + if (index < 0) + { + throw new ArgumentException(SR.CannotFindOldValue, nameof(oldValue)); + } + + return this.SetItem(index, newValue); + } + + /// + /// Reverses the order of the elements in the entire . + /// + /// The reversed list. + [Pure] + public ImmutableList Reverse() => this.Wrap(_root.Reverse()); + + /// + /// Reverses the order of the elements in the specified range. + /// + /// The zero-based starting index of the range to reverse. + /// The number of elements in the range to reverse. + /// The reversed list. + [Pure] + public ImmutableList Reverse(int index, int count) => this.Wrap(_root.Reverse(index, count)); + + /// + /// Sorts the elements in the entire using + /// the default comparer. + /// + [Pure] + public ImmutableList Sort() => this.Wrap(_root.Sort()); + + /// + /// Sorts the elements in the entire using + /// the specified . + /// + /// + /// The to use when comparing elements. + /// + /// The sorted list. + /// is null. + [Pure] + public ImmutableList Sort(Comparison comparison) + { + Requires.NotNull(comparison, nameof(comparison)); + Contract.Ensures(Contract.Result>() != null); + return this.Wrap(_root.Sort(comparison)); + } + + /// + /// Sorts the elements in the entire using + /// the specified comparer. + /// + /// + /// The implementation to use when comparing + /// elements, or null to use the default comparer . + /// + /// The sorted list. + [Pure] + public ImmutableList Sort(IComparer comparer) => this.Wrap(_root.Sort(comparer)); + + /// + /// Sorts the elements in a range of elements in + /// using the specified comparer. + /// + /// + /// The zero-based starting index of the range to sort. + /// + /// + /// The length of the range to sort. + /// + /// + /// The implementation to use when comparing + /// elements, or null to use the default comparer . + /// + /// The sorted list. + [Pure] + public ImmutableList Sort(int index, int count, IComparer comparer) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + Requires.Range(index + count <= this.Count, nameof(count)); + Contract.Ensures(Contract.Result>() != null); + + return this.Wrap(_root.Sort(index, count, comparer)); + } + + #endregion + + #region IImmutableListQueries Methods + + /// + /// Performs the specified action on each element of the list. + /// + /// The System.Action<T> delegate to perform on each element of the list. + public void ForEach(Action action) + { + Requires.NotNull(action, nameof(action)); + + foreach (T item in this) + { + action(item); + } + } + + /// + /// Copies the entire to a compatible one-dimensional + /// array, starting at the beginning of the target array. + /// + /// + /// The one-dimensional that is the destination of the elements + /// copied from . The must have + /// zero-based indexing. + /// + public void CopyTo(T[] array) => _root.CopyTo(array); + + /// + /// Copies the entire to a compatible one-dimensional + /// array, starting at the specified index of the target array. + /// + /// + /// The one-dimensional that is the destination of the elements + /// copied from . The must have + /// zero-based indexing. + /// + /// + /// The zero-based index in array at which copying begins. + /// + public void CopyTo(T[] array, int arrayIndex) => _root.CopyTo(array, arrayIndex); + + /// + /// Copies a range of elements from the to + /// a compatible one-dimensional array, starting at the specified index of the + /// target array. + /// + /// + /// The zero-based index in the source at + /// which copying begins. + /// + /// + /// The one-dimensional that is the destination of the elements + /// copied from . The must have + /// zero-based indexing. + /// + /// The zero-based index in array at which copying begins. + /// The number of elements to copy. + public void CopyTo(int index, T[] array, int arrayIndex, int count) => _root.CopyTo(index, array, arrayIndex, count); + + /// + /// Creates a shallow copy of a range of elements in the source . + /// + /// + /// The zero-based index at which the range + /// starts. + /// + /// + /// The number of elements in the range. + /// + /// + /// A shallow copy of a range of elements in the source . + /// + public ImmutableList GetRange(int index, int count) + { + Requires.Range(index >= 0, nameof(index)); + Requires.Range(count >= 0, nameof(count)); + Requires.Range(index + count <= this.Count, nameof(count)); + return this.Wrap(Node.NodeTreeFromList(this, index, count)); + } + + /// + /// Converts the elements in the current to + /// another type, and returns a list containing the converted elements. + /// + /// + /// A delegate that converts each element from + /// one type to another type. + /// + /// + /// The type of the elements of the target array. + /// + /// + /// A of the target type containing the converted + /// elements from the current . + /// + public ImmutableList ConvertAll(Func converter) + { + Requires.NotNull(converter, nameof(converter)); + return ImmutableList.WrapNode(_root.ConvertAll(converter)); + } + + /// + /// Determines whether the contains elements + /// that match the conditions defined by the specified predicate. + /// + /// + /// The delegate that defines the conditions of the elements + /// to search for. + /// + /// + /// true if the contains one or more elements + /// that match the conditions defined by the specified predicate; otherwise, + /// false. + /// + public bool Exists(Predicate match) => _root.Exists(match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the first occurrence within the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The first element that matches the conditions defined by the specified predicate, + /// if found; otherwise, the default value for type . + /// + public T Find(Predicate match) => _root.Find(match); + + /// + /// Retrieves all the elements that match the conditions defined by the specified + /// predicate. + /// + /// + /// The delegate that defines the conditions of the elements + /// to search for. + /// + /// + /// A containing all the elements that match + /// the conditions defined by the specified predicate, if found; otherwise, an + /// empty . + /// + public ImmutableList FindAll(Predicate match) => _root.FindAll(match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the first occurrence within + /// the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The zero-based index of the first occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + public int FindIndex(Predicate match) => _root.FindIndex(match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the first occurrence within + /// the range of elements in the that extends + /// from the specified index to the last element. + /// + /// The zero-based starting index of the search. + /// The delegate that defines the conditions of the element to search for. + /// + /// The zero-based index of the first occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + public int FindIndex(int startIndex, Predicate match) => _root.FindIndex(startIndex, match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the first occurrence within + /// the range of elements in the that starts + /// at the specified index and contains the specified number of elements. + /// + /// The zero-based starting index of the search. + /// The number of elements in the section to search. + /// The delegate that defines the conditions of the element to search for. + /// + /// The zero-based index of the first occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + public int FindIndex(int startIndex, int count, Predicate match) => _root.FindIndex(startIndex, count, match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the last occurrence within the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The last element that matches the conditions defined by the specified predicate, + /// if found; otherwise, the default value for type . + /// + public T FindLast(Predicate match) => _root.FindLast(match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the last occurrence within + /// the entire . + /// + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The zero-based index of the last occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + public int FindLastIndex(Predicate match) => _root.FindLastIndex(match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the last occurrence within + /// the range of elements in the that extends + /// from the first element to the specified index. + /// + /// The zero-based starting index of the backward search. + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// The zero-based index of the last occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + public int FindLastIndex(int startIndex, Predicate match) => _root.FindLastIndex(startIndex, match); + + /// + /// Searches for an element that matches the conditions defined by the specified + /// predicate, and returns the zero-based index of the last occurrence within + /// the range of elements in the that contains + /// the specified number of elements and ends at the specified index. + /// + /// The zero-based starting index of the backward search. + /// The number of elements in the section to search. + /// + /// The delegate that defines the conditions of the element + /// to search for. + /// + /// + /// The zero-based index of the last occurrence of an element that matches the + /// conditions defined by , if found; otherwise, -1. + /// + public int FindLastIndex(int startIndex, int count, Predicate match) => _root.FindLastIndex(startIndex, count, match); + + /// + /// Searches for the specified object and returns the zero-based index of the + /// first occurrence within the range of elements in the + /// that starts at the specified index and contains the specified number of elements. + /// + /// + /// The object to locate in the . The value + /// can be null for reference types. + /// + /// + /// The zero-based starting index of the search. 0 (zero) is valid in an empty + /// list. + /// + /// + /// The number of elements in the section to search. + /// + /// + /// The equality comparer to use in the search. + /// + /// + /// The zero-based index of the first occurrence of within the range of + /// elements in the that starts at and + /// contains number of elements, if found; otherwise, -1. + /// + [Pure] + public int IndexOf(T item, int index, int count, IEqualityComparer equalityComparer) => _root.IndexOf(item, index, count, equalityComparer); + + /// + /// Searches for the specified object and returns the zero-based index of the + /// last occurrence within the range of elements in the + /// that contains the specified number of elements and ends at the specified + /// index. + /// + /// + /// The object to locate in the . The value + /// can be null for reference types. + /// + /// The zero-based starting index of the backward search. + /// The number of elements in the section to search. + /// + /// The equality comparer to use in the search. + /// + /// + /// The zero-based index of the last occurrence of within the range of elements + /// in the that contains number of elements + /// and ends at , if found; otherwise, -1. + /// + [Pure] + public int LastIndexOf(T item, int index, int count, IEqualityComparer equalityComparer) => _root.LastIndexOf(item, index, count, equalityComparer); + + /// + /// Determines whether every element in the + /// matches the conditions defined by the specified predicate. + /// + /// + /// The delegate that defines the conditions to check against + /// the elements. + /// + /// + /// true if every element in the matches the + /// conditions defined by the specified predicate; otherwise, false. If the list + /// has no elements, the return value is true. + /// + public bool TrueForAll(Predicate match) => _root.TrueForAll(match); + + #endregion + + #region IImmutableList Methods + + /// + /// See the interface. + /// + public bool Contains(T value) => this.IndexOf(value) >= 0; + + /// + /// See the interface. + /// + public int IndexOf(T value) => this.IndexOf(value, EqualityComparer.Default); + + /// + /// See the interface. + /// + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.Add(T value) => this.Add(value); + + /// + /// See the interface. + /// + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.AddRange(IEnumerable items) => this.AddRange(items); + + /// + /// Inserts the specified value at the specified index. + /// + /// The index at which to insert the value. + /// The element to add. + /// The new immutable list. + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.Insert(int index, T item) => this.Insert(index, item); + + /// + /// Inserts the specified value at the specified index. + /// + /// The index at which to insert the value. + /// The elements to add. + /// The new immutable list. + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.InsertRange(int index, IEnumerable items) + { + return this.InsertRange(index, items); + } + + /// + /// See the interface. + /// + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.Remove(T value, IEqualityComparer equalityComparer) => this.Remove(value, equalityComparer); + + /// + /// See the interface. + /// + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.RemoveAll(Predicate match) => this.RemoveAll(match); + + /// + /// See the interface. + /// + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.RemoveRange(IEnumerable items, IEqualityComparer equalityComparer) => this.RemoveRange(items, equalityComparer); + + /// + /// See the interface. + /// + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.RemoveRange(int index, int count) => this.RemoveRange(index, count); + + /// + /// Removes the element at the specified index. + /// + /// The index. + /// A new list with the elements removed. + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.RemoveAt(int index) => this.RemoveAt(index); + + /// + /// Replaces an element in the list at a given position with the specified element. + /// + /// The position in the list of the element to replace. + /// The element to replace the old element with. + /// The new list. + [ExcludeFromCodeCoverage] + IImmutableList IImmutableList.SetItem(int index, T value) => this.SetItem(index, value); + + /// + /// Replaces an element in the list with the specified element. + /// + /// The element to replace. + /// The element to replace the old element with. + /// + /// The equality comparer to use in the search. + /// If null, is used. + /// + /// The new list. + /// Thrown when the old value does not exist in the list. + IImmutableList IImmutableList.Replace(T oldValue, T newValue, IEqualityComparer equalityComparer) => this.Replace(oldValue, newValue, equalityComparer); + + #endregion + + #region IEnumerable Members + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + IEnumerator IEnumerable.GetEnumerator() + { + return this.IsEmpty ? + Enumerable.Empty().GetEnumerator() : + this.GetEnumerator(); + } + + #endregion + + #region IEnumerable Members + + /// + /// Returns an enumerator that iterates through a collection. + /// + /// + /// An object that can be used to iterate through the collection. + /// + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => this.GetEnumerator(); + + #endregion + + #region IList Members + + /// + /// Inserts the specified index. + /// + /// The index. + /// The item. + /// Always thrown. + void IList.Insert(int index, T item) => throw new NotSupportedException(); + + /// + /// Removes the value at the specified index. + /// + /// The index. + /// Always thrown. + void IList.RemoveAt(int index) => throw new NotSupportedException(); + + /// + /// Gets or sets the value at the specified index. + /// + /// Thrown from getter when is negative or not less than . + /// Always thrown from the setter. + T IList.this[int index] + { + get => this[index]; + set => throw new NotSupportedException(); + } + + #endregion + + #region ICollection Members + + /// + /// Adds the specified item. + /// + /// The item. + /// Always thrown. + void ICollection.Add(T item) => throw new NotSupportedException(); + + /// + /// Clears this instance. + /// + /// Always thrown. + void ICollection.Clear() => throw new NotSupportedException(); + + /// + /// Gets a value indicating whether the is read-only. + /// + /// true if the is read-only; otherwise, false. + /// + bool ICollection.IsReadOnly => true; + + /// + /// Removes the specified item. + /// + /// The item. + /// Nothing. An exception is always thrown. + /// Always thrown. + bool ICollection.Remove(T item) => throw new NotSupportedException(); + + #endregion + + #region ICollection Methods + + /// + /// See the interface. + /// + void System.Collections.ICollection.CopyTo(Array array, int arrayIndex) => _root.CopyTo(array, arrayIndex); + + #endregion + + #region IList members + + /// + /// Adds an item to the . + /// + /// The object to add to the . + /// + /// Nothing. An exception is always thrown. + /// + /// Always thrown. + int IList.Add(object value) => throw new NotSupportedException(); + + /// + /// Removes the item at the specified index. + /// + /// The zero-based index of the item to remove. + /// Always thrown. + void IList.RemoveAt(int index) => throw new NotSupportedException(); + + /// + /// Clears this instance. + /// + /// Always thrown. + void IList.Clear() => throw new NotSupportedException(); + + /// + /// Determines whether the contains a specific value. + /// + /// The object to locate in the . + /// + /// true if the is found in the ; otherwise, false. + /// + bool IList.Contains(object value) => IsCompatibleObject(value) && this.Contains((T)value); + + /// + /// Determines the index of a specific item in the . + /// + /// The object to locate in the . + /// + /// The index of if found in the list; otherwise, -1. + /// + int IList.IndexOf(object value) => IsCompatibleObject(value) ? this.IndexOf((T)value) : -1; + + /// + /// Inserts an item to the at the specified index. + /// + /// The zero-based index at which should be inserted. + /// The object to insert into the . + /// Always thrown. + void IList.Insert(int index, object value) => throw new NotSupportedException(); + + /// + /// Gets a value indicating whether the has a fixed size. + /// + /// true if the has a fixed size; otherwise, false. + bool IList.IsFixedSize => true; + + /// + /// Gets a value indicating whether the is read-only. + /// + /// true if the is read-only; otherwise, false. + /// + bool IList.IsReadOnly => true; + + /// + /// Removes the first occurrence of a specific object from the . + /// + /// The object to remove from the . + /// Always thrown. + void IList.Remove(object value) => throw new NotSupportedException(); + + /// + /// Gets or sets the at the specified index. + /// + /// + /// The . + /// + /// The index. + /// The value at the specified index. + /// Thrown from getter when is negative or not less than . + /// Always thrown from the setter. + object IList.this[int index] + { + get => this[index]; + set => throw new NotSupportedException(); + } + + #endregion + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// + /// A that can be used to iterate through the collection. + /// + /// + /// CAUTION: when this enumerator is actually used as a valuetype (not boxed) do NOT copy it by assigning to a second variable + /// or by passing it to another method. When this enumerator is disposed of it returns a mutable reference type stack to a resource pool, + /// and if the value type enumerator is copied (which can easily happen unintentionally if you pass the value around) there is a risk + /// that a stack that has already been returned to the resource pool may still be in use by one of the enumerator copies, leading to data + /// corruption and/or exceptions. + /// + public Enumerator GetEnumerator() => new Enumerator(_root); + + /// + /// Returns the root of the list + /// + internal Node Root => _root; + + /// + /// Creates a new sorted set wrapper for a node tree. + /// + /// The root of the collection. + /// The immutable sorted set instance. + [Pure] + private static ImmutableList WrapNode(Node root) + { + return root.IsEmpty + ? ImmutableList.Empty + : new ImmutableList(root); + } + + /// + /// Attempts to discover an instance beneath some enumerable sequence + /// if one exists. + /// + /// The sequence that may have come from an immutable list. + /// Receives the concrete typed value if one can be found. + /// true if the cast was successful; false otherwise. + private static bool TryCastToImmutableList(IEnumerable sequence, out ImmutableList other) + { + other = sequence as ImmutableList; + if (other != null) + { + return true; + } + + var builder = sequence as Builder; + if (builder != null) + { + other = builder.ToImmutable(); + return true; + } + + return false; + } + + /// + /// Tests whether a value is one that might be found in this collection. + /// + /// The value to test. + /// true if this value might appear in the collection. + /// + /// This implementation comes from . + /// + private static bool IsCompatibleObject(object value) + { + // Non-null values are fine. Only accept nulls if T is a class or Nullable. + // Note that default(T) is not equal to null for value types except when T is Nullable. + return ((value is T) || (value == null && default(T) == null)); + } + + /// + /// Creates a wrapping collection type around a root node. + /// + /// The root node to wrap. + /// A wrapping collection type for the new tree. + [Pure] + private ImmutableList Wrap(Node root) + { + if (root != _root) + { + return root.IsEmpty ? this.Clear() : new ImmutableList(root); + } + else + { + return this; + } + } + + /// + /// Creates an immutable list with the contents from a sequence of elements. + /// + /// The sequence of elements from which to create the list. + /// The immutable list. + private static ImmutableList CreateRange(IEnumerable items) + { + // If the items being added actually come from an ImmutableList + // then there is no value in reconstructing it. + if (TryCastToImmutableList(items, out ImmutableList other)) + { + return other; + } + + // Rather than build up the immutable structure in the incremental way, + // build it in such a way as to generate minimal garbage, by assembling + // the immutable binary tree from leaf to root. This requires + // that we know the length of the item sequence in advance, and can + // index into that sequence like a list, so the one possible piece of + // garbage produced is a temporary array to store the list while + // we build the tree. + var list = items.AsOrderedCollection(); + if (list.Count == 0) + { + return Empty; + } + + Node root = Node.NodeTreeFromList(list, 0, list.Count); + return new ImmutableList(root); + } + } +} diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.cs.REMOVED.git-id b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.cs.REMOVED.git-id deleted file mode 100644 index 92280531dd..0000000000 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -ff577fbb5e1afdcc6d1d9635b1ef14f0786ca85f \ No newline at end of file diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableQueue_1.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableQueue_1.cs index 46114e47e7..cd7117fb6c 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableQueue_1.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableQueue_1.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; +using System.Linq; namespace System.Collections.Immutable { @@ -249,7 +250,9 @@ namespace System.Collections.Immutable [Pure] IEnumerator IEnumerable.GetEnumerator() { - return new EnumeratorObject(this); + return this.IsEmpty ? + Enumerable.Empty().GetEnumerator() : + new EnumeratorObject(this); } /// diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs index bb81722bb8..45acf19e4b 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs @@ -27,11 +27,7 @@ namespace System.Collections.Immutable /// /// The value associated with this node. /// - /// - /// Sadly this field could be readonly but doing so breaks serialization due to bug: - /// http://connect.microsoft.com/VisualStudio/feedback/details/312970/weird-argumentexception-when-deserializing-field-in-typedreferences-cannot-be-static-or-init-only - /// - private TValue _value; + private readonly TValue _value; /// /// A value indicating whether this node has been frozen (made immutable). diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs index 87999eea3d..8a78c25ae8 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Globalization; +using System.Linq; namespace System.Collections.Immutable { @@ -733,7 +734,9 @@ namespace System.Collections.Immutable [ExcludeFromCodeCoverage] IEnumerator> IEnumerable>.GetEnumerator() { - return this.GetEnumerator(); + return this.IsEmpty ? + Enumerable.Empty>().GetEnumerator() : + this.GetEnumerator(); } #endregion diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs index 5a9f0e7df8..9d885be8e1 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs @@ -957,7 +957,9 @@ namespace System.Collections.Immutable [ExcludeFromCodeCoverage] IEnumerator IEnumerable.GetEnumerator() { - return this.GetEnumerator(); + return this.IsEmpty ? + Enumerable.Empty().GetEnumerator() : + this.GetEnumerator(); } #endregion diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableStack_1.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableStack_1.cs index cf39d52e04..be4299e418 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableStack_1.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableStack_1.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; +using System.Linq; namespace System.Collections.Immutable { @@ -208,7 +209,9 @@ namespace System.Collections.Immutable [Pure] IEnumerator IEnumerable.GetEnumerator() { - return new EnumeratorObject(this); + return this.IsEmpty ? + Enumerable.Empty().GetEnumerator() : + new EnumeratorObject(this); } /// diff --git a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs index 3c283ac9a1..eb31b80255 100644 --- a/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs +++ b/external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs @@ -35,11 +35,7 @@ namespace System.Collections.Immutable /// /// The value associated with this node. /// - /// - /// Sadly, this field could be readonly but doing so breaks serialization due to bug: - /// http://connect.microsoft.com/VisualStudio/feedback/details/312970/weird-argumentexception-when-deserializing-field-in-typedreferences-cannot-be-static-or-init-only - /// - private TValue _value; + private readonly TValue _value; /// /// A value indicating whether this node has been frozen (made immutable). diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs index 5ba037e491..e21264659e 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -708,7 +709,21 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableArray.CreateBuilder()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableArray.CreateBuilder(4)); + ImmutableArray.Builder builder = ImmutableArray.CreateBuilder(4); + builder.AddRange("One", "Two", "Three", "Four"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(builder); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + string[] items = itemProperty.GetValue(info.Instance) as string[]; + Assert.Equal(builder, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableArray.CreateBuilder(4)); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } private static ImmutableArray.Builder CreateBuilderWithCount(int count) diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayTest.cs.REMOVED.git-id b/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayTest.cs.REMOVED.git-id index 6cf0380541..fcc8cd0105 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayTest.cs.REMOVED.git-id +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableArrayTest.cs.REMOVED.git-id @@ -1 +1 @@ -8eb295bff0644a2caae72ace3c18ee39b76f29a9 \ No newline at end of file +58cd6cde7942608a770e571fe5dd368d59d6a434 \ No newline at end of file diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs index bca7831bfb..e3727b3fdd 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -251,7 +252,22 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableDictionary.CreateBuilder()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableDictionary.CreateBuilder()); + ImmutableDictionary.Builder builder = ImmutableDictionary.CreateBuilder(); + builder.Add(1, "One"); + builder.Add(2, "Two"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(builder); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; + Assert.Equal(builder, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableHashSet.Create()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } protected override IImmutableDictionary GetEmptyImmutableDictionary() diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryTest.cs index b18e786550..fc80bfb76d 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableDictionaryTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -350,10 +351,23 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableDictionary.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableDictionary.Create()); + ImmutableDictionary dict = ImmutableDictionary.Create().Add("One", 1).Add("Two", 2); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict); object rootNode = DebuggerAttributes.GetFieldValue(ImmutableDictionary.Create(), "_root"); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; + Assert.Equal(dict, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableHashSet.Create()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } [Fact] diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableHashSetTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableHashSetTest.cs index 09ee371c2d..04207db7f0 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableHashSetTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableHashSetTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -189,7 +190,20 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableHashSet.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableHashSet.Create(1, 2, 3)); + ImmutableHashSet set = ImmutableHashSet.Create(1, 2, 3); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(set); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + int[] items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(set, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableHashSet.Create()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } [Fact] diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableListBuilderTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableListBuilderTest.cs index 400e803c05..c7ee4a67a8 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableListBuilderTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableListBuilderTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -345,7 +346,22 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableList.CreateBuilder()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableList.CreateBuilder()); + ImmutableList.Builder builder = ImmutableList.CreateBuilder(); + builder.Add("One"); + builder.Add("Two"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(builder); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + string[] items = itemProperty.GetValue(info.Instance) as string[]; + Assert.Equal(builder, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableList.CreateBuilder()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } protected override IEnumerable GetEnumerableOf(params T[] contents) diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableListTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableListTest.cs index 58f15e5b95..513375ed3c 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableListTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableListTest.cs @@ -775,10 +775,23 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableList.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableList.Create(1, 2, 3)); + ImmutableList list = ImmutableList.Create(1, 2, 3); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(list); object rootNode = DebuggerAttributes.GetFieldValue(ImmutableList.Create("1", "2", "3"), "_root"); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + double[] items = itemProperty.GetValue(info.Instance) as double[]; + Assert.Equal(list, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableList.Create()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } #if netcoreapp diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableQueueTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableQueueTest.cs index 56d6b69187..7c65177e6c 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableQueueTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableQueueTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -240,7 +241,20 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableQueue.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableQueue.Create()); + ImmutableQueue queue = ImmutableQueue.Create("One", "Two"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(queue); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + string[] items = itemProperty.GetValue(info.Instance) as string[]; + Assert.Equal(queue, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableQueue.Create()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } protected override IEnumerable GetEnumerableOf(params T[] contents) diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryBuilderTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryBuilderTest.cs index 339c0db715..019c49d7dc 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryBuilderTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryBuilderTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -259,7 +260,22 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSortedDictionary.CreateBuilder()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableSortedDictionary.CreateBuilder()); + ImmutableSortedDictionary.Builder builder = ImmutableSortedDictionary.CreateBuilder(); + builder.Add(1, "One"); + builder.Add(2, "Two"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(builder); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; + Assert.Equal(builder, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSortedDictionary.CreateBuilder()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } protected override IImmutableDictionary GetEmptyImmutableDictionary() diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs index 9f4b59a547..6b9e471031 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -409,10 +410,23 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSortedDictionary.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableSortedDictionary.Create()); + ImmutableSortedDictionary dict = ImmutableSortedDictionary.Create().Add(1, 2).Add(2, 3).Add(3, 4); + var info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict); object rootNode = DebuggerAttributes.GetFieldValue(ImmutableSortedDictionary.Create(), "_root"); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; + Assert.Equal(dict, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSortedDictionary.Create()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } ////[Fact] // not really a functional test -- but very useful to enable when collecting perf traces. diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs index 97d6a7f502..11aa1fcdf1 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -356,6 +357,23 @@ namespace System.Collections.Immutable.Tests { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSortedSet.CreateBuilder()); DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableSortedSet.CreateBuilder()); + ImmutableSortedSet.Builder builder = ImmutableSortedSet.CreateBuilder(); + builder.Add(1); + builder.Add(2); + builder.Add(3); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(builder); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + int[] items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(builder, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSortedSet.CreateBuilder()); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } } } diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetTest.cs index 6b8d7ab502..a7eb1332ca 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableSortedSetTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -374,10 +375,23 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSortedSet.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableSortedSet.Create("1", "2", "3")); + ImmutableSortedSet set = ImmutableSortedSet.Create("1", "2", "3"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(set); object rootNode = DebuggerAttributes.GetFieldValue(ImmutableSortedSet.Create(), "_root"); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + string[] items = itemProperty.GetValue(info.Instance) as string[]; + Assert.Equal(set, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSortedSet.Create("1", "2", "3")); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } [Fact] diff --git a/external/corefx/src/System.Collections.Immutable/tests/ImmutableStackTest.cs b/external/corefx/src/System.Collections.Immutable/tests/ImmutableStackTest.cs index 1eb9b48d4d..407ae64362 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/ImmutableStackTest.cs +++ b/external/corefx/src/System.Collections.Immutable/tests/ImmutableStackTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.Immutable.Tests @@ -257,7 +258,20 @@ namespace System.Collections.Immutable.Tests public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableStack.Create()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableStack.Create("1", "2", "3")); + ImmutableStack stack = ImmutableStack.Create("1", "2", "3"); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(stack); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + string[] items = itemProperty.GetValue(info.Instance) as string[]; + Assert.Equal(stack, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void TestDebuggerAttributes_Null() + { + Type proxyType = DebuggerAttributes.GetProxyType(ImmutableStack.Create("1", "2", "3")); + TargetInvocationException tie = Assert.Throws(() => Activator.CreateInstance(proxyType, (object)null)); + Assert.IsType(tie.InnerException); } protected override IEnumerable GetEnumerableOf(params T[] contents) diff --git a/external/corefx/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj b/external/corefx/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj index a3e2c46eee..55d43aa6d1 100644 --- a/external/corefx/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj +++ b/external/corefx/src/System.Collections.Immutable/tests/System.Collections.Immutable.Tests.csproj @@ -106,9 +106,6 @@ Common\System\SerializableAttribute.cs - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/ArrayListTests.cs.REMOVED.git-id b/external/corefx/src/System.Collections.NonGeneric/tests/ArrayListTests.cs.REMOVED.git-id index 4bf5a681f8..b1297bed73 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/ArrayListTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Collections.NonGeneric/tests/ArrayListTests.cs.REMOVED.git-id @@ -1 +1 @@ -dae3b51987f3f156f00c0f5ac6ec1e732549fa97 \ No newline at end of file +b12525a01aa4c288d9c0881914162d496349fe68 \ No newline at end of file diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs b/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs new file mode 100644 index 0000000000..4728a33102 --- /dev/null +++ b/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs @@ -0,0 +1,216 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using System.Diagnostics; +using Xunit; + +namespace System.Collections.Tests +{ + public class CaseInsensitiveComparerTests : RemoteExecutorTestBase + { + [Theory] + [InlineData("hello", "HELLO", 0)] + [InlineData("hello", "hello", 0)] + [InlineData("HELLO", "HELLO", 0)] + [InlineData("hello", "goodbye", 1)] + [InlineData("hello", null, 1)] + [InlineData(null, "hello", -1)] + [InlineData(5, 5, 0)] + [InlineData(10, 5, 1)] + [InlineData(5, 10, -1)] + [InlineData(5, null, 1)] + [InlineData(null, 5, -1)] + [InlineData(null, null, 0)] + public void Ctor_Empty_Compare(object a, object b, int expected) + { + CaseInsensitiveComparer comparer = new CaseInsensitiveComparer(); + Assert.Equal(expected, Math.Sign(comparer.Compare(a, b))); + } + + [Theory] + [InlineData("hello", "HELLO", 0)] + [InlineData("hello", "hello", 0)] + [InlineData("HELLO", "HELLO", 0)] + [InlineData("hello", "goodbye", 1)] + [InlineData("hello", null, 1)] + [InlineData(null, "hello", -1)] + [InlineData(5, 5, 0)] + [InlineData(10, 5, 1)] + [InlineData(5, 10, -1)] + [InlineData(5, null, 1)] + [InlineData(null, 5, -1)] + [InlineData(null, null, 0)] + public void Ctor_CultureInfo_Compare(object a, object b, int expected) + { + var cultureNames = new string[] + { + "cs-CZ","da-DK","de-DE","el-GR","en-US", + "es-ES","fi-FI","fr-FR","hu-HU","it-IT", + "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", + "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", + "zh-CN","zh-HK","zh-TW" + }; + + foreach (string cultureName in cultureNames) + { + CultureInfo culture; + try + { + culture = new CultureInfo(cultureName); + } + catch (CultureNotFoundException) + { + continue; + } + + var comparer = new CaseInsensitiveComparer(culture); + Assert.Equal(expected, Math.Sign(comparer.Compare(a, b))); + } + } + + [Fact] + public void Ctor_CultureInfo_Compare_TurkishI() + { + var cultureNames = new string[] + { + "cs-CZ","da-DK","de-DE","el-GR","en-US", + "es-ES","fi-FI","fr-FR","hu-HU","it-IT", + "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", + "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", + "zh-CN","zh-HK","zh-TW" + }; + + foreach (string cultureName in cultureNames) + { + CultureInfo culture; + try + { + culture = new CultureInfo(cultureName); + } + catch (CultureNotFoundException) + { + continue; + } + + var comparer = new CaseInsensitiveComparer(culture); + + // Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049) + // but rather "İ" (U+0130) + if (culture.Name == "tr-TR") + { + Assert.Equal(1, comparer.Compare("file", "FILE")); + } + else + { + Assert.Equal(0, comparer.Compare("file", "FILE")); + } + } + } + + [Fact] + public void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() + { + AssertExtensions.Throws("culture", () => new CaseInsensitiveComparer(null)); // Culture is null + } + + [Theory] + [InlineData("hello", "HELLO", 0)] + [InlineData("hello", "hello", 0)] + [InlineData("HELLO", "HELLO", 0)] + [InlineData("hello", "goodbye", 1)] + [InlineData("hello", "null", 1)] + [InlineData("null", "hello", -1)] + [InlineData("file", "FILE", 0)] // Turkey's comparing system is ignored as this is invariant + [InlineData(5, 5, 0)] + [InlineData(10, 5, 1)] + [InlineData(5, 10, -1)] + [InlineData(5, "null", 1)] + [InlineData("null", 5, -1)] + [InlineData("null", "null", 0)] + public void DefaultInvariant_Compare(object a, object b, int expected) + { + RemoteInvoke((ra, rb, rexpected) => + { + Func convert = (string o) => + { + if (Int32.TryParse(o, out int ret)) + return ret; + + return (o == "null") ? null : o; + }; + + var ra_val = convert(ra); + var rb_val = convert(rb); + var rexpected_val = convert(rexpected); + + var cultureNames = new string[] +{ + "cs-CZ","da-DK","de-DE","el-GR","en-US", + "es-ES","fi-FI","fr-FR","hu-HU","it-IT", + "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", + "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", + "zh-CN","zh-HK","zh-TW" +}; + + foreach (string cultureName in cultureNames) + { + CultureInfo culture; + try + { + culture = new CultureInfo(cultureName); + } + catch (CultureNotFoundException) + { + continue; + } + + // Set current culture + CultureInfo.CurrentCulture = culture; + CultureInfo.CurrentUICulture = culture; + + // All cultures should sort the same way, irrespective of the thread's culture + CaseInsensitiveComparer defaultInvComparer = CaseInsensitiveComparer.DefaultInvariant; + Assert.Equal(rexpected_val, Math.Sign(defaultInvComparer.Compare(ra_val, rb_val))); + } + return SuccessExitCode; + }, a.ToString(), b.ToString(), expected.ToString()).Dispose(); + } + + [Theory] + [InlineData("hello", "HELLO", 0)] + [InlineData("hello", "hello", 0)] + [InlineData("HELLO", "HELLO", 0)] + [InlineData("hello", "goodbye", 1)] + [InlineData("hello", null, 1)] + [InlineData(null, "hello", -1)] + [InlineData(5, 5, 0)] + [InlineData(10, 5, 1)] + [InlineData(5, 10, -1)] + [InlineData(5, null, 1)] + [InlineData(null, 5, -1)] + [InlineData(null, null, 0)] + public void Default_Compare(object a, object b, int expected) + { + Assert.Equal(expected, Math.Sign(CaseInsensitiveComparer.Default.Compare(a, b))); + } + + [Fact] + public void Default_Compare_TurkishI() + { + // Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049) + // but rather "İ" (U+0130) + CultureInfo culture = CultureInfo.CurrentCulture; + CaseInsensitiveComparer comparer = CaseInsensitiveComparer.Default; + if (culture.Name == "tr-TR") + { + Assert.Equal(1, comparer.Compare("file", "FILE")); + } + else + { + Assert.Equal(0, comparer.Compare("file", "FILE")); + } + } + } +} diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs b/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs index ef7c6c1a35..e9a28fda08 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs +++ b/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. using System.Globalization; +using System.Diagnostics; using Xunit; #pragma warning disable 618 // obsolete types namespace System.Collections.Tests { - public static class CaseInsensitiveHashCodeProviderTests + public class CaseInsensitiveHashCodeProviderTests : RemoteExecutorTestBase { [Theory] [InlineData("hello", "HELLO", true)] @@ -19,7 +20,7 @@ namespace System.Collections.Tests [InlineData(5, 5, true)] [InlineData(10, 5, false)] [InlineData(5, 10, false)] - public static void Ctor_Empty_GetHashCodeCompare(object a, object b, bool expected) + public void Ctor_Empty_GetHashCodeCompare(object a, object b, bool expected) { var provider = new CaseInsensitiveHashCodeProvider(); Assert.Equal(provider.GetHashCode(a), provider.GetHashCode(a)); @@ -35,43 +36,41 @@ namespace System.Collections.Tests [InlineData(5, 5, true)] [InlineData(10, 5, false)] [InlineData(5, 10, false)] - public static void Ctor_Empty_ChangeCurrentCulture_GetHashCodeCompare(object a, object b, bool expected) + public void Ctor_Empty_ChangeCurrentCulture_GetHashCodeCompare(object a, object b, bool expected) { - var cultureNames = new string[] + RemoteInvoke((ra, rb, rexpected) => { - "cs-CZ","da-DK","de-DE","el-GR","en-US", - "es-ES","fi-FI","fr-FR","hu-HU","it-IT", - "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", - "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", - "zh-CN","zh-HK","zh-TW" - }; + var cultureNames = new string[] + { + "cs-CZ","da-DK","de-DE","el-GR","en-US", + "es-ES","fi-FI","fr-FR","hu-HU","it-IT", + "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", + "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", + "zh-CN","zh-HK","zh-TW" + }; - foreach (string cultureName in cultureNames) - { - CultureInfo newCulture; - try - { - newCulture = new CultureInfo(cultureName); - } - catch (CultureNotFoundException) - { - continue; - } + bool.TryParse(rexpected, out bool expectedResult); - CultureInfo origCulture = CultureInfo.CurrentCulture; - try + foreach (string cultureName in cultureNames) { + CultureInfo newCulture; + try + { + newCulture = new CultureInfo(cultureName); + } + catch (CultureNotFoundException) + { + continue; + } + CultureInfo.CurrentCulture = newCulture; var provider = new CaseInsensitiveHashCodeProvider(); - Assert.Equal(provider.GetHashCode(a), provider.GetHashCode(a)); - Assert.Equal(provider.GetHashCode(b), provider.GetHashCode(b)); - Assert.Equal(expected, provider.GetHashCode(a) == provider.GetHashCode(b)); + Assert.Equal(provider.GetHashCode(ra), provider.GetHashCode(ra)); + Assert.Equal(provider.GetHashCode(rb), provider.GetHashCode(rb)); + Assert.Equal(expectedResult, provider.GetHashCode(ra) == provider.GetHashCode(rb)); } - finally - { - CultureInfo.CurrentCulture = origCulture; - } - } + return SuccessExitCode; + }, a.ToString(), b.ToString(), expected.ToString()).Dispose(); } [Theory] @@ -82,7 +81,7 @@ namespace System.Collections.Tests [InlineData(5, 5, true)] [InlineData(10, 5, false)] [InlineData(5, 10, false)] - public static void Ctor_CultureInfo_ChangeCurrentCulture_GetHashCodeCompare(object a, object b, bool expected) + public void Ctor_CultureInfo_ChangeCurrentCulture_GetHashCodeCompare(object a, object b, bool expected) { var cultureNames = new string[] { @@ -113,7 +112,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_CultureInfo_GetHashCodeCompare_TurkishI() + public void Ctor_CultureInfo_GetHashCodeCompare_TurkishI() { var cultureNames = new string[] { @@ -147,13 +146,13 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() + public void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() { AssertExtensions.Throws("culture", () => new CaseInsensitiveHashCodeProvider(null)); } [Fact] - public static void GetHashCode_NullObj_ThrowsArgumentNullException() + public void GetHashCode_NullObj_ThrowsArgumentNullException() { AssertExtensions.Throws("obj", () => new CaseInsensitiveHashCodeProvider().GetHashCode(null)); } @@ -166,7 +165,7 @@ namespace System.Collections.Tests [InlineData(5, 5, true)] [InlineData(10, 5, false)] [InlineData(5, 10, false)] - public static void Default_GetHashCodeCompare(object a, object b, bool expected) + public void Default_GetHashCodeCompare(object a, object b, bool expected) { Assert.Equal(expected, CaseInsensitiveHashCodeProvider.Default.GetHashCode(a) == CaseInsensitiveHashCodeProvider.Default.GetHashCode(b)); @@ -175,12 +174,11 @@ namespace System.Collections.Tests } [Fact] - public static void Default_Compare_TurkishI() + public void Default_Compare_TurkishI() { // Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049) // but rather "İ" (U+0130) - CultureInfo origCulture = CultureInfo.CurrentCulture; - try + RemoteInvoke(() => { CultureInfo.CurrentCulture = new CultureInfo("tr-TR"); Assert.False(CaseInsensitiveHashCodeProvider.Default.GetHashCode("file") == CaseInsensitiveHashCodeProvider.Default.GetHashCode("FILE")); @@ -188,11 +186,8 @@ namespace System.Collections.Tests CultureInfo.CurrentCulture = new CultureInfo("en-US"); Assert.True(CaseInsensitiveHashCodeProvider.Default.GetHashCode("file") == CaseInsensitiveHashCodeProvider.Default.GetHashCode("FILE")); - } - finally - { - CultureInfo.CurrentCulture = origCulture; - } + return SuccessExitCode; + }).Dispose(); } } } diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsentiveComparerTests.cs b/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsentiveComparerTests.cs deleted file mode 100644 index b84898bef9..0000000000 --- a/external/corefx/src/System.Collections.NonGeneric/tests/CaseInsentiveComparerTests.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Globalization; -using Xunit; - -namespace System.Collections.Tests -{ - public static class CaseInsensitiveComparerTests - { - [Theory] - [InlineData("hello", "HELLO", 0)] - [InlineData("hello", "hello", 0)] - [InlineData("HELLO", "HELLO", 0)] - [InlineData("hello", "goodbye", 1)] - [InlineData("hello", null, 1)] - [InlineData(null, "hello", -1)] - [InlineData(5, 5, 0)] - [InlineData(10, 5, 1)] - [InlineData(5, 10, -1)] - [InlineData(5, null, 1)] - [InlineData(null, 5, -1)] - [InlineData(null, null, 0)] - public static void Ctor_Empty_Compare(object a, object b, int expected) - { - CaseInsensitiveComparer comparer = new CaseInsensitiveComparer(); - Assert.Equal(expected, Math.Sign(comparer.Compare(a, b))); - } - - [Theory] - [InlineData("hello", "HELLO", 0)] - [InlineData("hello", "hello", 0)] - [InlineData("HELLO", "HELLO", 0)] - [InlineData("hello", "goodbye", 1)] - [InlineData("hello", null, 1)] - [InlineData(null, "hello", -1)] - [InlineData(5, 5, 0)] - [InlineData(10, 5, 1)] - [InlineData(5, 10, -1)] - [InlineData(5, null, 1)] - [InlineData(null, 5, -1)] - [InlineData(null, null, 0)] - public static void Ctor_CultureInfo_Compare(object a, object b, int expected) - { - var cultureNames = new string[] - { - "cs-CZ","da-DK","de-DE","el-GR","en-US", - "es-ES","fi-FI","fr-FR","hu-HU","it-IT", - "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", - "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", - "zh-CN","zh-HK","zh-TW" - }; - - foreach (string cultureName in cultureNames) - { - CultureInfo culture; - try - { - culture = new CultureInfo(cultureName); - } - catch (CultureNotFoundException) - { - continue; - } - - var comparer = new CaseInsensitiveComparer(culture); - Assert.Equal(expected, Math.Sign(comparer.Compare(a, b))); - } - } - - [Fact] - public static void Ctor_CultureInfo_Compare_TurkishI() - { - var cultureNames = new string[] - { - "cs-CZ","da-DK","de-DE","el-GR","en-US", - "es-ES","fi-FI","fr-FR","hu-HU","it-IT", - "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", - "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", - "zh-CN","zh-HK","zh-TW" - }; - - foreach (string cultureName in cultureNames) - { - CultureInfo culture; - try - { - culture = new CultureInfo(cultureName); - } - catch (CultureNotFoundException) - { - continue; - } - - var comparer = new CaseInsensitiveComparer(culture); - - // Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049) - // but rather "İ" (U+0130) - if (culture.Name == "tr-TR") - { - Assert.Equal(1, comparer.Compare("file", "FILE")); - } - else - { - Assert.Equal(0, comparer.Compare("file", "FILE")); - } - } - } - - [Fact] - public static void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() - { - AssertExtensions.Throws("culture", () => new CaseInsensitiveComparer(null)); // Culture is null - } - - [Theory] - [InlineData("hello", "HELLO", 0)] - [InlineData("hello", "hello", 0)] - [InlineData("HELLO", "HELLO", 0)] - [InlineData("hello", "goodbye", 1)] - [InlineData("hello", null, 1)] - [InlineData(null, "hello", -1)] - [InlineData("file", "FILE", 0)] // Turkey's comparing system is ignored as this is invariant - [InlineData(5, 5, 0)] - [InlineData(10, 5, 1)] - [InlineData(5, 10, -1)] - [InlineData(5, null, 1)] - [InlineData(null, 5, -1)] - [InlineData(null, null, 0)] - public static void DefaultInvariant_Compare(object a, object b, int expected) - { - CultureInfo culture1 = CultureInfo.CurrentCulture; - CultureInfo culture2 = CultureInfo.CurrentUICulture; - - try - { - var cultureNames = new string[] - { - "cs-CZ","da-DK","de-DE","el-GR","en-US", - "es-ES","fi-FI","fr-FR","hu-HU","it-IT", - "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", - "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", - "zh-CN","zh-HK","zh-TW" - }; - - foreach (string cultureName in cultureNames) - { - CultureInfo culture; - try - { - culture = new CultureInfo(cultureName); - } - catch (CultureNotFoundException) - { - continue; - } - - // Set current culture - CultureInfo.CurrentCulture = culture; - CultureInfo.CurrentUICulture = culture; - - // All cultures should sort the same way, irrespective of the thread's culture - CaseInsensitiveComparer defaultInvComparer = CaseInsensitiveComparer.DefaultInvariant; - Assert.Equal(expected, Math.Sign(defaultInvComparer.Compare(a, b))); - } - } - finally - { - CultureInfo.CurrentCulture = culture1; - CultureInfo.CurrentUICulture = culture2; - } - } - - [Theory] - [InlineData("hello", "HELLO", 0)] - [InlineData("hello", "hello", 0)] - [InlineData("HELLO", "HELLO", 0)] - [InlineData("hello", "goodbye", 1)] - [InlineData("hello", null, 1)] - [InlineData(null, "hello", -1)] - [InlineData(5, 5, 0)] - [InlineData(10, 5, 1)] - [InlineData(5, 10, -1)] - [InlineData(5, null, 1)] - [InlineData(null, 5, -1)] - [InlineData(null, null, 0)] - public static void Default_Compare(object a, object b, int expected) - { - Assert.Equal(expected, Math.Sign(CaseInsensitiveComparer.Default.Compare(a, b))); - } - - [Fact] - public static void Default_Compare_TurkishI() - { - // Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049) - // but rather "İ" (U+0130) - CultureInfo culture = CultureInfo.CurrentCulture; - CaseInsensitiveComparer comparer = CaseInsensitiveComparer.Default; - if (culture.Name == "tr-TR") - { - Assert.Equal(1, comparer.Compare("file", "FILE")); - } - else - { - Assert.Equal(0, comparer.Compare("file", "FILE")); - } - } - } -} diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/ComparerTests.cs b/external/corefx/src/System.Collections.NonGeneric/tests/ComparerTests.cs index 17db97242e..8d59c475cb 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/ComparerTests.cs +++ b/external/corefx/src/System.Collections.NonGeneric/tests/ComparerTests.cs @@ -3,12 +3,13 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using Xunit; namespace System.Collections.Tests { - public static class ComparerTests + public class ComparerTests : RemoteExecutorTestBase { [Theory] [InlineData("b", "a", 1)] @@ -20,7 +21,7 @@ namespace System.Collections.Tests [InlineData(1, null, 1)] [InlineData(null, null, 0)] [InlineData(null, 1, -1)] - public static void Ctor_CultureInfo(object a, object b, int expected) + public void Ctor_CultureInfo(object a, object b, int expected) { var culture = new CultureInfo("en-US"); var comparer = new Comparer(culture); @@ -29,27 +30,24 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() + public void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() { AssertExtensions.Throws("culture", () => new Comparer(null)); // Culture is null } [Fact] - public static void DefaultInvariant_Compare() + public void DefaultInvariant_Compare() { - CultureInfo culture1 = CultureInfo.CurrentCulture; - CultureInfo culture2 = CultureInfo.CurrentUICulture; - - try + RemoteInvoke(() => { var cultureNames = new string[] - { +{ "cs-CZ","da-DK","de-DE","el-GR","en-US", "es-ES","fi-FI","fr-FR","hu-HU","it-IT", "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", "zh-CN","zh-HK","zh-TW" - }; +}; var string1 = new string[] { "Apple", "abc", }; var string2 = new string[] { "Æble", "ABC" }; @@ -75,16 +73,12 @@ namespace System.Collections.Tests Assert.Equal(1, comp.Compare(string1[0], string2[0])); Assert.Equal(-1, comp.Compare(string1[1], string2[1])); } - } - finally - { - CultureInfo.CurrentCulture = culture1; - CultureInfo.CurrentUICulture = culture2; - } + return SuccessExitCode; + }).Dispose(); } [Fact] - public static void DefaultInvariant_Compare_Invalid() + public void DefaultInvariant_Compare_Invalid() { Comparer comp = Comparer.Default; AssertExtensions.Throws(null, () => comp.Compare(new object(), 1)); // One object doesn't implement IComparable @@ -115,13 +109,13 @@ namespace System.Collections.Tests [InlineData(null, 1, -1)] [InlineData(null, null, 0)] [MemberData(nameof(CompareTestData))] - public static void Default_Compare(object a, object b, int expected) + public void Default_Compare(object a, object b, int expected) { Assert.Equal(expected, Math.Sign(Comparer.Default.Compare(a, b))); } [Fact] - public static void Default_Compare_Invalid() + public void Default_Compare_Invalid() { Comparer comp = Comparer.Default; AssertExtensions.Throws(null, () => comp.Compare(new object(), 1)); // One object doesn't implement IComparable diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/HashtableTests.cs b/external/corefx/src/System.Collections.NonGeneric/tests/HashtableTests.cs index ce17cd0ecf..13dff03ba3 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/HashtableTests.cs +++ b/external/corefx/src/System.Collections.NonGeneric/tests/HashtableTests.cs @@ -12,17 +12,17 @@ using Xunit; namespace System.Collections.Tests { - public static class HashtableTests + public class HashtableTests : RemoteExecutorTestBase { [Fact] - public static void Ctor_Empty() + public void Ctor_Empty() { var hash = new ComparableHashtable(); VerifyHashtable(hash, null, null); } [Fact] - public static void Ctor_HashCodeProvider_Comparer() + public void Ctor_HashCodeProvider_Comparer() { var hash = new ComparableHashtable(CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); VerifyHashtable(hash, null, hash.EqualityComparer); @@ -35,7 +35,7 @@ namespace System.Collections.Tests [InlineData(false, true)] [InlineData(true, false)] [InlineData(true, true)] - public static void Ctor_HashCodeProvider_Comparer_NullInputs(bool nullProvider, bool nullComparer) + public void Ctor_HashCodeProvider_Comparer_NullInputs(bool nullProvider, bool nullComparer) { var hash = new ComparableHashtable( nullProvider ? null : CaseInsensitiveHashCodeProvider.DefaultInvariant, @@ -44,7 +44,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary() + public void Ctor_IDictionary() { // No exception var hash1 = new ComparableHashtable(new Hashtable()); @@ -60,13 +60,13 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_NullDictionary_ThrowsArgumentNullException() + public void Ctor_IDictionary_NullDictionary_ThrowsArgumentNullException() { AssertExtensions.Throws("d", () => new Hashtable((IDictionary)null)); // Dictionary is null } [Fact] - public static void Ctor_IDictionary_HashCodeProvider_Comparer() + public void Ctor_IDictionary_HashCodeProvider_Comparer() { // No exception var hash1 = new ComparableHashtable(new Hashtable(), CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); @@ -82,32 +82,34 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_HashCodeProvider_Comparer_NullDictionary_ThrowsArgumentNullException() + public void Ctor_IDictionary_HashCodeProvider_Comparer_NullDictionary_ThrowsArgumentNullException() { AssertExtensions.Throws("d", () => new Hashtable(null, CaseInsensitiveHashCodeProvider.Default, StringComparer.OrdinalIgnoreCase)); // Dictionary is null } [Fact] - public static void Ctor_IEqualityComparer() + public void Ctor_IEqualityComparer() { - // Null comparer - var hash = new ComparableHashtable((IEqualityComparer)null); - VerifyHashtable(hash, null, null); - - // Custom comparer - Helpers.PerformActionOnCustomCulture(() => + RemoteInvoke(() => { + // Null comparer + var hash = new ComparableHashtable((IEqualityComparer)null); + VerifyHashtable(hash, null, null); + + // Custom comparer IEqualityComparer comparer = StringComparer.CurrentCulture; hash = new ComparableHashtable(comparer); VerifyHashtable(hash, null, comparer); - }); + + return SuccessExitCode; + }).Dispose(); } [Theory] [InlineData(0)] [InlineData(10)] [InlineData(100)] - public static void Ctor_Int(int capacity) + public void Ctor_Int(int capacity) { var hash = new ComparableHashtable(capacity); VerifyHashtable(hash, null, null); @@ -117,21 +119,21 @@ namespace System.Collections.Tests [InlineData(0)] [InlineData(10)] [InlineData(100)] - public static void Ctor_Int_HashCodeProvider_Comparer(int capacity) + public void Ctor_Int_HashCodeProvider_Comparer(int capacity) { var hash = new ComparableHashtable(capacity, CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); VerifyHashtable(hash, null, hash.EqualityComparer); } [Fact] - public static void Ctor_Int_Invalid() + public void Ctor_Int_Invalid() { AssertExtensions.Throws("capacity", () => new Hashtable(-1)); // Capacity < 0 AssertExtensions.Throws("capacity", null, () => new Hashtable(int.MaxValue)); // Capacity / load factor > int.MaxValue } [Fact] - public static void Ctor_IDictionary_Int() + public void Ctor_IDictionary_Int() { // No exception var hash1 = new ComparableHashtable(new Hashtable(), 1f, CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); @@ -148,7 +150,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_Int_Invalid() + public void Ctor_IDictionary_Int_Invalid() { AssertExtensions.Throws("d", () => new Hashtable(null, 1f)); // Dictionary is null @@ -161,7 +163,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_Int_HashCodeProvider_Comparer() + public void Ctor_IDictionary_Int_HashCodeProvider_Comparer() { // No exception var hash1 = new ComparableHashtable(new Hashtable(), 1f); @@ -177,32 +179,34 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_IEqualityComparer() + public void Ctor_IDictionary_IEqualityComparer() { - // No exception - var hash1 = new ComparableHashtable(new Hashtable(), null); - Assert.Equal(0, hash1.Count); - - hash1 = new ComparableHashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(), null), null), null), null), null); - Assert.Equal(0, hash1.Count); - - // Null comparer - Hashtable hash2 = Helpers.CreateIntHashtable(100); - hash1 = new ComparableHashtable(hash2, null); - VerifyHashtable(hash1, hash2, null); - - // Custom comparer - hash2 = Helpers.CreateIntHashtable(100); - Helpers.PerformActionOnCustomCulture(() => + RemoteInvoke(() => { + // No exception + var hash1 = new ComparableHashtable(new Hashtable(), null); + Assert.Equal(0, hash1.Count); + + hash1 = new ComparableHashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(new Hashtable(), null), null), null), null), null); + Assert.Equal(0, hash1.Count); + + // Null comparer + Hashtable hash2 = Helpers.CreateIntHashtable(100); + hash1 = new ComparableHashtable(hash2, null); + VerifyHashtable(hash1, hash2, null); + + // Custom comparer + hash2 = Helpers.CreateIntHashtable(100); IEqualityComparer comparer = StringComparer.CurrentCulture; hash1 = new ComparableHashtable(hash2, comparer); VerifyHashtable(hash1, hash2, comparer); - }); + + return SuccessExitCode; + }).Dispose(); } [Fact] - public static void Ctor_IDictionary_IEqualityComparer_NullDictionary_ThrowsArgumentNullException() + public void Ctor_IDictionary_IEqualityComparer_NullDictionary_ThrowsArgumentNullException() { AssertExtensions.Throws("d", () => new Hashtable((IDictionary)null, null)); // Dictionary is null } @@ -212,7 +216,7 @@ namespace System.Collections.Tests [InlineData(10, 0.2)] [InlineData(100, 0.3)] [InlineData(1000, 1)] - public static void Ctor_Int_Int(int capacity, float loadFactor) + public void Ctor_Int_Int(int capacity, float loadFactor) { var hash = new ComparableHashtable(capacity, loadFactor); VerifyHashtable(hash, null, null); @@ -223,14 +227,14 @@ namespace System.Collections.Tests [InlineData(10, 0.2)] [InlineData(100, 0.3)] [InlineData(1000, 1)] - public static void Ctor_Int_Int_HashCodeProvider_Comparer(int capacity, float loadFactor) + public void Ctor_Int_Int_HashCodeProvider_Comparer(int capacity, float loadFactor) { var hash = new ComparableHashtable(capacity, loadFactor, CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); VerifyHashtable(hash, null, hash.EqualityComparer); } [Fact] - public static void Ctor_Int_Int_GenerateNewPrime() + public void Ctor_Int_Int_GenerateNewPrime() { // The ctor for Hashtable performs the following calculation: // rawSize = capacity / (loadFactor * 0.72) @@ -250,7 +254,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_Int_Int_Invalid() + public void Ctor_Int_Int_Invalid() { AssertExtensions.Throws("capacity", () => new Hashtable(-1, 1f)); // Capacity < 0 AssertExtensions.Throws("capacity", null, () => new Hashtable(int.MaxValue, 0.1f)); // Capacity / load factor > int.MaxValue @@ -268,56 +272,59 @@ namespace System.Collections.Tests [InlineData(10)] [InlineData(100)] [InlineData(1000)] - public static void Ctor_Int_IEqualityComparer(int capacity) + public void Ctor_Int_IEqualityComparer(int capacity) { - // Null comparer - var hash = new ComparableHashtable(capacity, null); - VerifyHashtable(hash, null, null); - - // Custom comparer - Helpers.PerformActionOnCustomCulture(() => + RemoteInvoke((rcapacity) => { + int.TryParse(rcapacity, out int capacityint); + + // Null comparer + var hash = new ComparableHashtable(capacityint, null); + VerifyHashtable(hash, null, null); + + // Custom comparer IEqualityComparer comparer = StringComparer.CurrentCulture; - hash = new ComparableHashtable(capacity, comparer); + hash = new ComparableHashtable(capacityint, comparer); VerifyHashtable(hash, null, comparer); - }); + return SuccessExitCode; + }, capacity.ToString()).Dispose(); } [Fact] - public static void Ctor_Int_IEqualityComparer_Invalid() + public void Ctor_Int_IEqualityComparer_Invalid() { AssertExtensions.Throws("capacity", () => new Hashtable(-1, null)); // Capacity < 0 AssertExtensions.Throws("capacity", null, () => new Hashtable(int.MaxValue, null)); // Capacity / load factor > int.MaxValue } [Fact] - public static void Ctor_IDictionary_Int_IEqualityComparer() + public void Ctor_IDictionary_Int_IEqualityComparer() { - // No exception - var hash1 = new ComparableHashtable(new Hashtable(), 1f, null); - Assert.Equal(0, hash1.Count); + RemoteInvoke(() => { + // No exception + var hash1 = new ComparableHashtable(new Hashtable(), 1f, null); + Assert.Equal(0, hash1.Count); - hash1 = new ComparableHashtable(new Hashtable(new Hashtable( - new Hashtable(new Hashtable(new Hashtable(), 1f, null), 1f, null), 1f, null), 1f, null), 1f, null); - Assert.Equal(0, hash1.Count); + hash1 = new ComparableHashtable(new Hashtable(new Hashtable( + new Hashtable(new Hashtable(new Hashtable(), 1f, null), 1f, null), 1f, null), 1f, null), 1f, null); + Assert.Equal(0, hash1.Count); - // Null comparer - Hashtable hash2 = Helpers.CreateIntHashtable(100); - hash1 = new ComparableHashtable(hash2, 1f, null); - VerifyHashtable(hash1, hash2, null); + // Null comparer + Hashtable hash2 = Helpers.CreateIntHashtable(100); + hash1 = new ComparableHashtable(hash2, 1f, null); + VerifyHashtable(hash1, hash2, null); - hash2 = Helpers.CreateIntHashtable(100); - // Custom comparer - Helpers.PerformActionOnCustomCulture(() => - { + hash2 = Helpers.CreateIntHashtable(100); + // Custom comparer IEqualityComparer comparer = StringComparer.CurrentCulture; hash1 = new ComparableHashtable(hash2, 1f, comparer); VerifyHashtable(hash1, hash2, comparer); - }); + return SuccessExitCode; + }).Dispose(); } [Fact] - public static void Ctor_IDictionary_LoadFactor_IEqualityComparer_Invalid() + public void Ctor_IDictionary_LoadFactor_IEqualityComparer_Invalid() { AssertExtensions.Throws("d", () => new Hashtable(null, 1f, null)); // Dictionary is null @@ -334,24 +341,29 @@ namespace System.Collections.Tests [InlineData(10, 0.2)] [InlineData(100, 0.3)] [InlineData(1000, 1)] - public static void Ctor_Int_Int_IEqualityComparer(int capacity, float loadFactor) + public void Ctor_Int_Int_IEqualityComparer(int capacity, float loadFactor) { - // Null comparer - var hash = new ComparableHashtable(capacity, loadFactor, null); - VerifyHashtable(hash, null, null); - Assert.Null(hash.EqualityComparer); - - // Custom comparer - Helpers.PerformActionOnCustomCulture(() => + RemoteInvoke((rcapacity, rloadFactor) => { + int.TryParse(rcapacity, out int capacityint); + float.TryParse(rloadFactor, out float loadFactorFloat); + + // Null comparer + var hash = new ComparableHashtable(capacityint, loadFactorFloat, null); + VerifyHashtable(hash, null, null); + Assert.Null(hash.EqualityComparer); + + // Custom compare IEqualityComparer comparer = StringComparer.CurrentCulture; - hash = new ComparableHashtable(capacity, loadFactor, comparer); + hash = new ComparableHashtable(capacityint, loadFactorFloat, comparer); VerifyHashtable(hash, null, comparer); - }); + + return SuccessExitCode; + }, capacity.ToString(), loadFactor.ToString()).Dispose(); } [Fact] - public static void Ctor_Capacity_LoadFactor_IEqualityComparer_Invalid() + public void Ctor_Capacity_LoadFactor_IEqualityComparer_Invalid() { AssertExtensions.Throws("capacity", () => new Hashtable(-1, 1f, null)); // Capacity < 0 AssertExtensions.Throws("capacity", null, () => new Hashtable(int.MaxValue, 0.1f, null)); // Capacity / load factor > int.MaxValue @@ -366,7 +378,7 @@ namespace System.Collections.Tests [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] - public static void DebuggerAttribute() + public void DebuggerAttribute() { DebuggerAttributes.ValidateDebuggerDisplayReferences(new Hashtable()); @@ -388,7 +400,7 @@ namespace System.Collections.Tests } [Fact] - public static void Add_ReferenceType() + public void Add_ReferenceType() { var hash1 = new Hashtable(); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -406,7 +418,7 @@ namespace System.Collections.Tests } [Fact] - public static void Add_ClearRepeatedly() + public void Add_ClearRepeatedly() { const int Iterations = 2; const int Count = 2; @@ -428,7 +440,7 @@ namespace System.Collections.Tests [Fact] [OuterLoop] - public static void AddRemove_LargeAmountNumbers() + public void AddRemove_LargeAmountNumbers() { // Generate a random 100,000 array of ints as test data var inputData = new int[100000]; @@ -464,7 +476,7 @@ namespace System.Collections.Tests } [Fact] - public static void DuplicatedKeysWithInitialCapacity() + public void DuplicatedKeysWithInitialCapacity() { // Make rehash get called because to many items with duplicated keys have been added to the hashtable var hash = new Hashtable(200); @@ -491,7 +503,7 @@ namespace System.Collections.Tests } [Fact] - public static void DuplicatedKeysWithDefaultCapacity() + public void DuplicatedKeysWithDefaultCapacity() { // Make rehash get called because to many items with duplicated keys have been added to the hashtable var hash = new Hashtable(); @@ -520,7 +532,7 @@ namespace System.Collections.Tests [Theory] [InlineData(0)] [InlineData(100)] - public static void Clone(int count) + public void Clone(int count) { Hashtable hash1 = Helpers.CreateStringHashtable(count); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -545,7 +557,7 @@ namespace System.Collections.Tests } [Fact] - public static void Clone_IsShallowCopy() + public void Clone_IsShallowCopy() { var hash = new Hashtable(); for (int i = 0; i < 10; i++) @@ -570,7 +582,7 @@ namespace System.Collections.Tests } [Fact] - public static void Clone_HashtableCastedToInterfaces() + public void Clone_HashtableCastedToInterfaces() { // Try to cast the returned object from Clone() to different types Hashtable hash = Helpers.CreateIntHashtable(100); @@ -583,7 +595,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsKey() + public void ContainsKey() { Hashtable hash1 = Helpers.CreateStringHashtable(100); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -609,7 +621,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsKey_EqualObjects() + public void ContainsKey_EqualObjects() { var hash1 = new Hashtable(); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -642,7 +654,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsKey_NullKey_ThrowsArgumentNullException() + public void ContainsKey_NullKey_ThrowsArgumentNullException() { var hash1 = new Hashtable(); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -653,7 +665,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsValue() + public void ContainsValue() { Hashtable hash1 = Helpers.CreateStringHashtable(100); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -679,7 +691,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsValue_EqualObjects() + public void ContainsValue_EqualObjects() { var hash1 = new Hashtable(); Helpers.PerformActionOnAllHashtableWrappers(hash1, hash2 => @@ -694,7 +706,7 @@ namespace System.Collections.Tests } [Fact] - public static void Keys_ModifyingHashtable_ModifiesCollection() + public void Keys_ModifyingHashtable_ModifiesCollection() { Hashtable hash = Helpers.CreateStringHashtable(100); ICollection keys = hash.Keys; @@ -711,7 +723,7 @@ namespace System.Collections.Tests } [Fact] - public static void Remove_SameHashcode() + public void Remove_SameHashcode() { // We want to add and delete items (with the same hashcode) to the hashtable in such a way that the hashtable // does not expand but have to tread through collision bit set positions to insert the new elements. We do this @@ -754,7 +766,7 @@ namespace System.Collections.Tests } [Fact] - public static void SynchronizedProperties() + public void SynchronizedProperties() { // Ensure Synchronized correctly reflects a wrapped hashtable var hash1 = Helpers.CreateStringHashtable(100); @@ -773,13 +785,13 @@ namespace System.Collections.Tests } [Fact] - public static void Synchronized_NullTable_ThrowsArgumentNullException() + public void Synchronized_NullTable_ThrowsArgumentNullException() { AssertExtensions.Throws("table", () => Hashtable.Synchronized(null)); // Table is null } [Fact] - public static void Values_ModifyingHashtable_ModifiesCollection() + public void Values_ModifyingHashtable_ModifiesCollection() { Hashtable hash = Helpers.CreateStringHashtable(100); ICollection values = hash.Values; @@ -796,7 +808,7 @@ namespace System.Collections.Tests } [Fact] - public static void HashCodeProvider_Set_ImpactsSearch() + public void HashCodeProvider_Set_ImpactsSearch() { var hash = new ComparableHashtable(CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); hash.Add("test", "test"); @@ -820,7 +832,7 @@ namespace System.Collections.Tests } [Fact] - public static void HashCodeProvider_Comparer_CompatibleGetSet_Success() + public void HashCodeProvider_Comparer_CompatibleGetSet_Success() { var hash = new ComparableHashtable(); Assert.Null(hash.HashCodeProvider); @@ -839,7 +851,7 @@ namespace System.Collections.Tests } [Fact] - public static void HashCodeProvider_Comparer_IncompatibleGetSet_Throws() + public void HashCodeProvider_Comparer_IncompatibleGetSet_Throws() { var hash = new ComparableHashtable(StringComparer.CurrentCulture); @@ -851,7 +863,7 @@ namespace System.Collections.Tests } [Fact] - public static void Comparer_Set_ImpactsSearch() + public void Comparer_Set_ImpactsSearch() { var hash = new ComparableHashtable(CaseInsensitiveHashCodeProvider.DefaultInvariant, StringComparer.OrdinalIgnoreCase); hash.Add("test", "test"); @@ -1008,7 +1020,7 @@ namespace System.Collections.Tests /// (3) compare the key, if equal, go to step 4. Otherwise end. /// (4) return the value contained in the bucket. /// The problem is that after step 3 and before step 4. A writer can kick in a remove the old item and add a new one - /// in the same bukcet. In order to make this happen easily, I created two long with same hashcode. + /// in the same bucket. In order to make this happen easily, I created two long with same hashcode. /// public class Hashtable_ItemThreadSafetyTests { diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/Helpers.cs b/external/corefx/src/System.Collections.NonGeneric/tests/Helpers.cs index 28a2bfac14..6e18543af7 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/Helpers.cs +++ b/external/corefx/src/System.Collections.NonGeneric/tests/Helpers.cs @@ -198,26 +198,5 @@ namespace System.Collections.Tests return array; } - - public static void PerformActionOnCustomCulture(Action action, CultureInfo customCulture = null) - { - CultureInfo currentCulture = CultureInfo.CurrentCulture; - try - { - if (customCulture == null) - { - customCulture = new CultureInfo("de-DE"); - } - CultureInfo.CurrentCulture = customCulture; - action(); - } - catch (CultureNotFoundException) - { - } - finally - { - CultureInfo.CurrentCulture = currentCulture; - } - } } } diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/Performance/Configurations.props b/external/corefx/src/System.Collections.NonGeneric/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Collections.NonGeneric/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/Performance/Perf.ArrayList.cs b/external/corefx/src/System.Collections.NonGeneric/tests/Performance/Perf.ArrayList.cs new file mode 100644 index 0000000000..e2f9845686 --- /dev/null +++ b/external/corefx/src/System.Collections.NonGeneric/tests/Performance/Perf.ArrayList.cs @@ -0,0 +1,486 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Xunit.Performance; +using System.Collections.Generic; +using Xunit; + +namespace System.Collections.Tests +{ + public class Perf_ArrayList + { + private static volatile int s_temp; + + private ArrayList CreateArrayListOfInts(int size = 100000) + { + var arrayListOfInts = new ArrayList(size); + for (int element = 0; element < size; element++) + { + arrayListOfInts.Add(element); + } + + return arrayListOfInts; + } + + private ArrayList CreateArrayList(int size = 100000) + { + var arrayListOfInts = new ArrayList(size); + var obj = new object(); + for (int i = 0; i < size; i++) + { + arrayListOfInts.Add(obj); + } + + return arrayListOfInts; + } + + [Benchmark(InnerIterationCount = 10000000)] + public void Add() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + var element = new object(); + foreach (var iteration in Benchmark.Iterations) + { + var elements = new ArrayList(); + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.Add(element); + } + } + } + } + + [Benchmark(InnerIterationCount = 6000)] + public void AddRange() + { + int size = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(1000); + foreach (var iteration in Benchmark.Iterations) + { + ArrayList[] elementsCollection = new ArrayList[size]; + for (int index = 0; index < size; index++) + { + elementsCollection[index] = new ArrayList(); + } + + using (iteration.StartMeasurement()) + { + for (int index = 0; index < size; index++) + { + elementsCollection[index].AddRange(elements); + } + } + } + } + + [Benchmark(InnerIterationCount = 10)] + public void BinarySearch() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayListOfInts(100000); + Comparer comparer = Comparer.Default; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int index = 0; index < innerIterationCount; index++) + { + for (int i = 0; i < elements.Count; i++) + { + elements.BinarySearch(i, comparer); + } + } + } + } + } + + [Benchmark(InnerIterationCount = 5000)] + public void Clear() + { + int size = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(10000); + foreach (var iteration in Benchmark.Iterations) + { + ArrayList[] elementsCollection = new ArrayList[size]; + for (int index = 0; index < size; index++) + { + elementsCollection[index] = new ArrayList(elements); + } + + using (iteration.StartMeasurement()) + { + for (int index = 0; index < size; index++) + { + elementsCollection[index].Clear(); + } + } + } + } + + [Benchmark(InnerIterationCount = 1000)] + public void Contains() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int size = 100000; + ArrayList elements = CreateArrayListOfInts(size); + object contained = elements[size / 2]; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.Contains(contained); + } + } + } + } + + [Benchmark(InnerIterationCount = 100000000)] + public void Ctor_Default() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + new ArrayList(); + } + } + } + } + + [Benchmark(InnerIterationCount = 10000)] + public void Ctor_ICollection() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(10000); + object[] array = elements.ToArray(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + new ArrayList(array); + } + } + } + } + + [Benchmark(InnerIterationCount = 100000000)] + public void Count() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(10000); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + s_temp = elements.Count; + } + } + } + } + + [Benchmark(InnerIterationCount = 100000000)] + public void Indexer() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList((int)Benchmark.InnerIterationCount); + object temp; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int index = 0; index < innerIterationCount; index++) + { + temp = elements[index]; + } + } + } + } + + [Benchmark(InnerIterationCount = 10000)] + public void Enumerator() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(10000); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + foreach (var element in elements) + { } + } + } + } + } + + [Benchmark(InnerIterationCount = 10000)] + public void SetCapacity() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int size = 10000; + ArrayList elements = CreateArrayList(size); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + // Capacity set back and forth between "size + 1" and "size + 2" + elements.Capacity = size + (i % 2) + 1; + } + } + } + } + + [Benchmark(InnerIterationCount = 50000)] + public void ToArray() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + foreach (var iteration in Benchmark.Iterations) + { + ArrayList elements = CreateArrayList(10000); + + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.ToArray(); + } + } + } + } + + [Benchmark(InnerIterationCount = 500)] + public void IndexOf() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayListOfInts(); + + int nonexistentElemetnt = -1; + int firstElemetnt = 0; + int middleElemetnt = elements.Count / 2; + int lastElemetnt = elements.Count - 1; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.IndexOf(nonexistentElemetnt); + elements.IndexOf(firstElemetnt); + elements.IndexOf(middleElemetnt); + elements.IndexOf(lastElemetnt); + } + } + } + } + + [Benchmark(InnerIterationCount = 10)] + [InlineData(0, 100000)] + [InlineData(99999, 100000)] + public void InsertRange(int index, int length) + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(length); + var arrayList = new ArrayList(elements); + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + arrayList.InsertRange(index, elements); + } + } + } + } + + [Benchmark(InnerIterationCount = 50000)] + public void CopyTo() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int size = 10000; + ArrayList elements = CreateArrayList(size); + object[] destination = new object[size]; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.CopyTo(destination, 0); + } + } + } + } + + [Benchmark(InnerIterationCount = 10000)] + public void LastIndexOf() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int size = 10000; + ArrayList elements = CreateArrayListOfInts(size); + int element = size / 2; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.LastIndexOf(element); + } + } + } + } + + [Benchmark(InnerIterationCount = 1000)] + public void Remove() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayListOfInts(); + int element = elements.Count / 2; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.Remove(element); + } + } + } + } + + [Benchmark(InnerIterationCount = 7000)] + public void RemoveRange() + { + int size = (int)Benchmark.InnerIterationCount; + ArrayList elements = CreateArrayList(size); + + foreach (var iteration in Benchmark.Iterations) + { + ArrayList[] elementsCollection = new ArrayList[size]; + for (int index = 0; index < size; index++) + { + elementsCollection[index] = new ArrayList(elements); + } + + using (iteration.StartMeasurement()) + { + for (int index = 0; index < size; index++) + { + elementsCollection[index].RemoveRange(1, size - 2); + } + } + } + } + + [Benchmark(InnerIterationCount = 1000)] + public void Reverse() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int startIndex = 0; + int count = 100000; + ArrayList elements = CreateArrayList(count); + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.Reverse(startIndex, count); + } + } + } + } + + [Benchmark(InnerIterationCount = 10000000)] + public void SetRange() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int startIndex = 0; + int size = 100000; + ArrayList elements = CreateArrayList(size); + var newElemnts = new ArrayList(size); + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.SetRange(startIndex, elements); + } + } + } + } + + [Benchmark(InnerIterationCount = 20000000)] + public void GetRange() + { + int innerIterationCount = (int)Benchmark.InnerIterationCount; + int startIndex = 0; + int size = 100000; + ArrayList elements = CreateArrayList(size); + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterationCount; i++) + { + elements.GetRange(startIndex, size); + } + } + } + } + + [Benchmark(InnerIterationCount = 10000000)] + public void Sort() + { + int size = (int)Benchmark.InnerIterationCount; + var random = new Random(32829); + ArrayList elements = new ArrayList(size); + for (int index = 0; index < elements.Count; index++) + { + elements.Add(random.Next()); + } + + foreach (var iteration in Benchmark.Iterations) + { + ArrayList[] elementsCollection = new ArrayList[size]; + for (int index = 0; index < size; index++) + { + elementsCollection[index] = new ArrayList(elements); + } + + using (iteration.StartMeasurement()) + { + for (int index = 0; index < size; index++) + { + elementsCollection[index].Sort(); + } + } + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/Performance/System.Collections.NonGeneric.Performance.Tests.csproj b/external/corefx/src/System.Collections.NonGeneric/tests/Performance/System.Collections.NonGeneric.Performance.Tests.csproj index fe127562d9..364bdd2e5d 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/Performance/System.Collections.NonGeneric.Performance.Tests.csproj +++ b/external/corefx/src/System.Collections.NonGeneric/tests/Performance/System.Collections.NonGeneric.Performance.Tests.csproj @@ -9,6 +9,7 @@ + Common\System\PerfUtils.cs diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/SortedListTests.cs b/external/corefx/src/System.Collections.NonGeneric/tests/SortedListTests.cs index 7c833c9cee..e8c62cf33a 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/SortedListTests.cs +++ b/external/corefx/src/System.Collections.NonGeneric/tests/SortedListTests.cs @@ -11,10 +11,10 @@ using Xunit; namespace System.Collections.Tests { - public static class SortedListTests + public class SortedListTests : RemoteExecutorTestBase { [Fact] - public static void Ctor_Empty() + public void Ctor_Empty() { var sortList = new SortedList(); Assert.Equal(0, sortList.Count); @@ -30,7 +30,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void Ctor_Int(int initialCapacity) + public void Ctor_Int(int initialCapacity) { var sortList = new SortedList(initialCapacity); Assert.Equal(0, sortList.Count); @@ -42,7 +42,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_Int_NegativeInitialCapacity_ThrowsArgumentOutOfRangeException() + public void Ctor_Int_NegativeInitialCapacity_ThrowsArgumentOutOfRangeException() { AssertExtensions.Throws("initialCapacity", () => new SortedList(-1)); // InitialCapacity < 0 } @@ -52,7 +52,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void Ctor_IComparer_Int(int initialCapacity) + public void Ctor_IComparer_Int(int initialCapacity) { var sortList = new SortedList(new CustomComparer(), initialCapacity); Assert.Equal(0, sortList.Count); @@ -64,13 +64,13 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IComparer_Int_NegativeInitialCapacity_ThrowsArgumentOutOfRangeException() + public void Ctor_IComparer_Int_NegativeInitialCapacity_ThrowsArgumentOutOfRangeException() { AssertExtensions.Throws("value", () => new SortedList(new CustomComparer(), -1)); // InitialCapacity < 0 } [Fact] - public static void Ctor_IComparer() + public void Ctor_IComparer() { var sortList = new SortedList(new CustomComparer()); Assert.Equal(0, sortList.Count); @@ -81,7 +81,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IComparer_Null() + public void Ctor_IComparer_Null() { var sortList = new SortedList((IComparer)null); Assert.Equal(0, sortList.Count); @@ -100,7 +100,7 @@ namespace System.Collections.Tests [InlineData(1, false)] [InlineData(10, false)] [InlineData(100, false)] - public static void Ctor_IDictionary(int count, bool sorted) + public void Ctor_IDictionary(int count, bool sorted) { var hashtable = new Hashtable(); if (sorted) @@ -140,7 +140,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_NullDictionary_ThrowsArgumentNullException() + public void Ctor_IDictionary_NullDictionary_ThrowsArgumentNullException() { AssertExtensions.Throws("d", () => new SortedList((IDictionary)null)); // Dictionary is null } @@ -154,7 +154,7 @@ namespace System.Collections.Tests [InlineData(1, false)] [InlineData(10, false)] [InlineData(100, false)] - public static void Ctor_IDictionary_IComparer(int count, bool sorted) + public void Ctor_IDictionary_IComparer(int count, bool sorted) { var hashtable = new Hashtable(); if (sorted) @@ -195,7 +195,7 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_IComparer_Null() + public void Ctor_IDictionary_IComparer_Null() { var sortList = new SortedList(new Hashtable(), null); Assert.Equal(0, sortList.Count); @@ -206,21 +206,21 @@ namespace System.Collections.Tests } [Fact] - public static void Ctor_IDictionary_IComparer_NullDictionary_ThrowsArgumentNullException() + public void Ctor_IDictionary_IComparer_NullDictionary_ThrowsArgumentNullException() { AssertExtensions.Throws("d", () => new SortedList(null, new CustomComparer())); // Dictionary is null } [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] - public static void DebuggerAttribute_Empty() + public void DebuggerAttribute_Empty() { Assert.Equal("Count = 0", DebuggerAttributes.ValidateDebuggerDisplayReferences(new SortedList())); } [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] - public static void DebuggerAttribute_NormalList() + public void DebuggerAttribute_NormalList() { var list = new SortedList() { { "a", 1 }, { "b", 2 } }; DebuggerAttributeInfo debuggerAttribute = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(list); @@ -231,7 +231,7 @@ namespace System.Collections.Tests [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] - public static void DebuggerAttribute_SynchronizedList() + public void DebuggerAttribute_SynchronizedList() { var list = SortedList.Synchronized(new SortedList() { { "a", 1 }, { "b", 2 } }); DebuggerAttributeInfo debuggerAttribute = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(SortedList), list); @@ -242,7 +242,7 @@ namespace System.Collections.Tests [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] - public static void DebuggerAttribute_NullSortedList_ThrowsArgumentNullException() + public void DebuggerAttribute_NullSortedList_ThrowsArgumentNullException() { bool threwNull = false; try @@ -259,7 +259,7 @@ namespace System.Collections.Tests [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "This test intentionally reflects on an internal member of SortedList. Cannot do that on UaoAot.")] - public static void EnsureCapacity_NewCapacityLessThanMin_CapsToMaxArrayLength() + public void EnsureCapacity_NewCapacityLessThanMin_CapsToMaxArrayLength() { // A situation like this occurs for very large lengths of SortedList. // To avoid allocating several GBs of memory and making this test run for a very @@ -277,7 +277,7 @@ namespace System.Collections.Tests } [Fact] - public static void Add() + public void Add() { var sortList1 = new SortedList(); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -300,7 +300,7 @@ namespace System.Collections.Tests } [Fact] - public static void Add_Invalid() + public void Add_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -316,7 +316,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void Clear(int count) + public void Clear(int count) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -334,7 +334,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void Clone(int count) + public void Clone(int count) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -353,7 +353,7 @@ namespace System.Collections.Tests } [Fact] - public static void Clone_IsShallowCopy() + public void Clone_IsShallowCopy() { var sortList = new SortedList(); for (int i = 0; i < 10; i++) @@ -388,7 +388,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsKey() + public void ContainsKey() { var sortList1 = new SortedList(); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -414,7 +414,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsKey_NullKey_ThrowsArgumentNullException() + public void ContainsKey_NullKey_ThrowsArgumentNullException() { var sortList1 = new SortedList(); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -425,7 +425,7 @@ namespace System.Collections.Tests } [Fact] - public static void ContainsValue() + public void ContainsValue() { var sortList1 = new SortedList(); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -454,7 +454,7 @@ namespace System.Collections.Tests [InlineData(1, 50)] [InlineData(10, 50)] [InlineData(100, 50)] - public static void CopyTo(int count, int index) + public void CopyTo(int count, int index) { SortedList sortList1 = Helpers.CreateStringSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -477,7 +477,7 @@ namespace System.Collections.Tests } [Fact] - public static void CopyTo_Invalid() + public void CopyTo_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -491,7 +491,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetByIndex() + public void GetByIndex() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -509,7 +509,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetByIndex_InvalidIndex_ThrowsArgumentOutOfRangeException() + public void GetByIndex_InvalidIndex_ThrowsArgumentOutOfRangeException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -524,7 +524,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void GetEnumerator_IDictionaryEnumerator(int count) + public void GetEnumerator_IDictionaryEnumerator(int count) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -552,7 +552,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetEnumerator_IDictionaryEnumerator_Invalid() + public void GetEnumerator_IDictionaryEnumerator_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -602,7 +602,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void GetEnumerator_IEnumerator(int count) + public void GetEnumerator_IEnumerator(int count) { SortedList sortList = Helpers.CreateIntSortedList(count); Assert.NotSame(sortList.GetEnumerator(), sortList.GetEnumerator()); @@ -625,7 +625,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetEnumerator_StartOfEnumeration_Clone() + public void GetEnumerator_StartOfEnumeration_Clone() { SortedList sortedList = Helpers.CreateIntSortedList(10); @@ -664,7 +664,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetEnumerator_InMiddleOfEnumeration_Clone() + public void GetEnumerator_InMiddleOfEnumeration_Clone() { SortedList sortedList = Helpers.CreateIntSortedList(10); @@ -686,7 +686,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetEnumerator_IEnumerator_Invalid() + public void GetEnumerator_IEnumerator_Invalid() { SortedList sortList = Helpers.CreateIntSortedList(100); @@ -721,7 +721,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void GetKeyList(int count) + public void GetKeyList(int count) { SortedList sortList1 = Helpers.CreateStringSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -745,14 +745,14 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_IsSameAsKeysProperty() + public void GetKeyList_IsSameAsKeysProperty() { var sortList = Helpers.CreateIntSortedList(10); Assert.Same(sortList.GetKeyList(), sortList.Keys); } [Fact] - public static void GetKeyList_IListProperties() + public void GetKeyList_IListProperties() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -767,7 +767,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_Contains() + public void GetKeyList_Contains() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -785,7 +785,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_Contains_InvalidValueType_ThrowsInvalidOperationException() + public void GetKeyList_Contains_InvalidValueType_ThrowsInvalidOperationException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -797,7 +797,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_IndexOf() + public void GetKeyList_IndexOf() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -815,7 +815,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_IndexOf_Invalid() + public void GetKeyList_IndexOf_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -835,7 +835,7 @@ namespace System.Collections.Tests [InlineData(1, 50)] [InlineData(10, 50)] [InlineData(100, 50)] - public static void GetKeyList_CopyTo(int count, int index) + public void GetKeyList_CopyTo(int count, int index) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -853,7 +853,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_CopyTo_Invalid() + public void GetKeyList_CopyTo_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -874,7 +874,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void GetKeyList_GetEnumerator(int count) + public void GetKeyList_GetEnumerator(int count) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -901,7 +901,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_GetEnumerator_Invalid() + public void GetKeyList_GetEnumerator_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -936,7 +936,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKeyList_TryingToModifyCollection_ThrowsNotSupportedException() + public void GetKeyList_TryingToModifyCollection_ThrowsNotSupportedException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -955,7 +955,7 @@ namespace System.Collections.Tests [Theory] [InlineData(0)] [InlineData(100)] - public static void GetKey(int count) + public void GetKey(int count) { SortedList sortList1 = Helpers.CreateStringSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -969,7 +969,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetKey_InvalidIndex_ThrowsArgumentOutOfRangeException() + public void GetKey_InvalidIndex_ThrowsArgumentOutOfRangeException() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -984,7 +984,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void GetValueList(int count) + public void GetValueList(int count) { SortedList sortList1 = Helpers.CreateStringSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1008,14 +1008,14 @@ namespace System.Collections.Tests } [Fact] - public static void GetValueList_IsSameAsValuesProperty() + public void GetValueList_IsSameAsValuesProperty() { var sortList = Helpers.CreateIntSortedList(10); Assert.Same(sortList.GetValueList(), sortList.Values); } [Fact] - public static void GetValueList_IListProperties() + public void GetValueList_IListProperties() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1030,7 +1030,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetValueList_Contains() + public void GetValueList_Contains() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1051,7 +1051,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetValueList_IndexOf() + public void GetValueList_IndexOf() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1077,7 +1077,7 @@ namespace System.Collections.Tests [InlineData(1, 50)] [InlineData(10, 50)] [InlineData(100, 50)] - public static void GetValueList_CopyTo(int count, int index) + public void GetValueList_CopyTo(int count, int index) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1095,7 +1095,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetValueList_CopyTo_Invalid() + public void GetValueList_CopyTo_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1114,7 +1114,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(10)] [InlineData(100)] - public static void GetValueList_GetEnumerator(int count) + public void GetValueList_GetEnumerator(int count) { SortedList sortList1 = Helpers.CreateIntSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1141,7 +1141,7 @@ namespace System.Collections.Tests } [Fact] - public static void ValueList_GetEnumerator_Invalid() + public void ValueList_GetEnumerator_Invalid() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1176,7 +1176,7 @@ namespace System.Collections.Tests } [Fact] - public static void GetValueList_TryingToModifyCollection_ThrowsNotSupportedException() + public void GetValueList_TryingToModifyCollection_ThrowsNotSupportedException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1193,7 +1193,7 @@ namespace System.Collections.Tests } [Fact] - public static void IndexOfKey() + public void IndexOfKey() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1217,7 +1217,7 @@ namespace System.Collections.Tests } [Fact] - public static void IndexOfKey_NullKey_ThrowsArgumentNullException() + public void IndexOfKey_NullKey_ThrowsArgumentNullException() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1227,7 +1227,7 @@ namespace System.Collections.Tests } [Fact] - public static void IndexOfValue() + public void IndexOfValue() { SortedList sortList1 = Helpers.CreateStringSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1255,7 +1255,7 @@ namespace System.Collections.Tests } [Fact] - public static void IndexOfValue_SameValue() + public void IndexOfValue_SameValue() { var sortList1 = new SortedList(); sortList1.Add("Key_0", "Value_0"); @@ -1272,7 +1272,7 @@ namespace System.Collections.Tests [InlineData(1)] [InlineData(4)] [InlineData(5000)] - public static void Capacity_Get_Set(int capacity) + public void Capacity_Get_Set(int capacity) { var sortList = new SortedList(); sortList.Capacity = capacity; @@ -1284,7 +1284,7 @@ namespace System.Collections.Tests } [Fact] - public static void Capacity_Set_ShrinkingCapacity_ThrowsArgumentOutOfRangeException() + public void Capacity_Set_ShrinkingCapacity_ThrowsArgumentOutOfRangeException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1294,7 +1294,7 @@ namespace System.Collections.Tests } [Fact] - public static void Capacity_Set_Invalid() + public void Capacity_Set_Invalid() { var sortList1 = new SortedList(); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1308,7 +1308,7 @@ namespace System.Collections.Tests [InlineData(0)] [InlineData(1)] [InlineData(10)] - public static void Item_Get(int count) + public void Item_Get(int count) { SortedList sortList1 = Helpers.CreateStringSortedList(count); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1328,21 +1328,21 @@ namespace System.Collections.Tests } [Fact] - public static void Item_Get_DifferentCulture() + public void Item_Get_DifferentCulture() { - var sortList = new SortedList(); - - CultureInfo currentCulture = CultureInfo.CurrentCulture; - try + RemoteInvoke(() => { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); + var sortList = new SortedList(); + + try + { var cultureNames = new string[] { - "cs-CZ","da-DK","de-DE","el-GR","en-US", - "es-ES","fi-FI","fr-FR","hu-HU","it-IT", - "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", - "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", - "zh-CN","zh-HK","zh-TW" + "cs-CZ","da-DK","de-DE","el-GR","en-US", + "es-ES","fi-FI","fr-FR","hu-HU","it-IT", + "ja-JP","ko-KR","nb-NO","nl-NL","pl-PL", + "pt-BR","pt-PT","ru-RU","sv-SE","tr-TR", + "zh-CN","zh-HK","zh-TW" }; var installedCultures = new CultureInfo[cultureNames.Length]; @@ -1371,14 +1371,13 @@ namespace System.Collections.Tests catch (CultureNotFoundException) { } - finally - { - CultureInfo.CurrentCulture = currentCulture; - } - } + + return SuccessExitCode; + }).Dispose(); + } [Fact] - public static void Item_Set() + public void Item_Set() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1404,7 +1403,7 @@ namespace System.Collections.Tests } [Fact] - public static void Item_Set_NullKey_ThrowsArgumentNullException() + public void Item_Set_NullKey_ThrowsArgumentNullException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1414,7 +1413,7 @@ namespace System.Collections.Tests } [Fact] - public static void RemoveAt() + public void RemoveAt() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1431,7 +1430,7 @@ namespace System.Collections.Tests } [Fact] - public static void RemoveAt_InvalidIndex_ThrowsArgumentOutOfRangeException() + public void RemoveAt_InvalidIndex_ThrowsArgumentOutOfRangeException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1442,7 +1441,7 @@ namespace System.Collections.Tests } [Fact] - public static void Remove() + public void Remove() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1461,7 +1460,7 @@ namespace System.Collections.Tests } [Fact] - public static void Remove_NullKey_ThrowsArgumentNullException() + public void Remove_NullKey_ThrowsArgumentNullException() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1471,7 +1470,7 @@ namespace System.Collections.Tests } [Fact] - public static void SetByIndex() + public void SetByIndex() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1485,7 +1484,7 @@ namespace System.Collections.Tests } [Fact] - public static void SetByIndex_InvalidIndex_ThrowsArgumentOutOfRangeExeption() + public void SetByIndex_InvalidIndex_ThrowsArgumentOutOfRangeExeption() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => @@ -1496,20 +1495,20 @@ namespace System.Collections.Tests } [Fact] - public static void Synchronized_IsSynchronized() + public void Synchronized_IsSynchronized() { SortedList sortList = SortedList.Synchronized(new SortedList()); Assert.True(sortList.IsSynchronized); } [Fact] - public static void Synchronized_NullList_ThrowsArgumentNullException() + public void Synchronized_NullList_ThrowsArgumentNullException() { AssertExtensions.Throws("list", () => SortedList.Synchronized(null)); // List is null } [Fact] - public static void TrimToSize() + public void TrimToSize() { SortedList sortList1 = Helpers.CreateIntSortedList(100); Helpers.PerformActionOnAllSortedListWrappers(sortList1, sortList2 => diff --git a/external/corefx/src/System.Collections.NonGeneric/tests/System.Collections.NonGeneric.Tests.csproj b/external/corefx/src/System.Collections.NonGeneric/tests/System.Collections.NonGeneric.Tests.csproj index 714b533e9f..890fce1a45 100644 --- a/external/corefx/src/System.Collections.NonGeneric/tests/System.Collections.NonGeneric.Tests.csproj +++ b/external/corefx/src/System.Collections.NonGeneric/tests/System.Collections.NonGeneric.Tests.csproj @@ -36,7 +36,7 @@ - + @@ -53,9 +53,12 @@ Common\System\Collections\IEnumerable.NonGeneric.Serialization.Tests.cs - - CommonTest\System\PlatformDetection.cs - + + + + {69e46a6f-9966-45a5-8945-2559fe337827} + RemoteExecutorConsoleApp + - + \ No newline at end of file diff --git a/external/corefx/src/System.Collections.Specialized/tests/Resources/System.Collections.Specialized.Tests.rd.xml b/external/corefx/src/System.Collections.Specialized/tests/Resources/System.Collections.Specialized.Tests.rd.xml new file mode 100644 index 0000000000..8a12dcaa3e --- /dev/null +++ b/external/corefx/src/System.Collections.Specialized/tests/Resources/System.Collections.Specialized.Tests.rd.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/external/corefx/src/System.Collections.Specialized/tests/System.Collections.Specialized.Tests.csproj b/external/corefx/src/System.Collections.Specialized/tests/System.Collections.Specialized.Tests.csproj index 612db11279..11183499e3 100644 --- a/external/corefx/src/System.Collections.Specialized/tests/System.Collections.Specialized.Tests.csproj +++ b/external/corefx/src/System.Collections.Specialized/tests/System.Collections.Specialized.Tests.csproj @@ -30,9 +30,6 @@ Common\System\Diagnostics\DebuggerAttributes.cs - - CommonTest\System\PlatformDetection.cs - System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs @@ -94,5 +91,8 @@ + + + diff --git a/external/corefx/src/System.Collections/src/System/Collections/Generic/HashSet.cs b/external/corefx/src/System.Collections/src/System/Collections/Generic/HashSet.cs index 562ed2c4cd..00cbafcc11 100644 --- a/external/corefx/src/System.Collections/src/System/Collections/Generic/HashSet.cs +++ b/external/corefx/src/System.Collections/src/System/Collections/Generic/HashSet.cs @@ -460,7 +460,7 @@ namespace System.Collections.Generic /// Searches the set for a given value and returns the equal value it finds, if any. /// /// The value to search for. - /// The value from the set that the search found, or the original value if the search yielded no match. + /// The value from the set that the search found, or the default value of when the search yielded no match. /// A value indicating whether the search was successful. /// /// This can be useful when you want to reuse a previously stored reference instead of @@ -1150,7 +1150,7 @@ namespace System.Collections.Generic } // Able to increase capacity; copy elements to larger array and rehash - SetCapacity(newSize, false); + SetCapacity(newSize); } /// @@ -1158,7 +1158,7 @@ namespace System.Collections.Generic /// *must* be a prime. It is very likely that you want to call IncreaseCapacity() /// instead of this method. /// - private void SetCapacity(int newSize, bool forceNewHashCodes) + private void SetCapacity(int newSize) { Debug.Assert(_buckets != null, "SetCapacity called on a set with no elements"); @@ -1168,21 +1168,6 @@ namespace System.Collections.Generic Array.Copy(_slots, 0, newSlots, 0, _lastIndex); } -#if FEATURE_RANDOMIZED_STRING_HASHING - if (forceNewHashCodes) - { - for (int i = 0; i < _lastIndex; i++) - { - if (newSlots[i].hashCode != -1) - { - newSlots[i].hashCode = InternalGetHashCode(newSlots[i].value); - } - } - } -#else - Debug.Assert(!forceNewHashCodes); -#endif - int[] newBuckets = new int[newSize]; for (int i = 0; i < _lastIndex; i++) { @@ -1209,18 +1194,13 @@ namespace System.Collections.Generic int hashCode = InternalGetHashCode(value); int bucket = hashCode % _buckets.Length; -#if FEATURE_RANDOMIZED_STRING_HASHING - int collisionCount = 0; -#endif + for (int i = _buckets[bucket] - 1; i >= 0; i = _slots[i].next) { if (_slots[i].hashCode == hashCode && _comparer.Equals(_slots[i].value, value)) { return false; } -#if FEATURE_RANDOMIZED_STRING_HASHING - collisionCount++; -#endif } int index; @@ -1247,14 +1227,6 @@ namespace System.Collections.Generic _count++; _version++; -#if FEATURE_RANDOMIZED_STRING_HASHING - if (collisionCount > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_comparer)) - { - _comparer = (IEqualityComparer)HashHelpers.GetRandomizedEqualityComparer(_comparer); - SetCapacity(_buckets.Length, true); - } -#endif // FEATURE_RANDOMIZED_STRING_HASHING - return true; } diff --git a/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.cs b/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.cs index 331dd64944..7e04a5d346 100644 --- a/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.cs +++ b/external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; +using Interlocked = System.Threading.Interlocked; namespace System.Collections.Generic { @@ -14,23 +15,29 @@ namespace System.Collections.Generic // 3. If a node is red, the both its children are black // 4. Every simple path from a node to a descendant leaf contains the same number of black nodes // - // The basic idea of red-black tree is to represent 2-3-4 trees as standard BSTs but to add one extra bit of information + // The basic idea of a red-black tree is to represent 2-3-4 trees as standard BSTs but to add one extra bit of information // per node to encode 3-nodes and 4-nodes. // 4-nodes will be represented as: B // R R // 3 -node will be represented as: B or B // R B B R // - // For a detailed description of the algorithm, take a look at "Algorithm" by Rebert Sedgewick. + // For a detailed description of the algorithm, take a look at "Algorithms" by Robert Sedgewick. + + internal enum NodeColor : byte + { + Black, + Red + } internal delegate bool TreeWalkPredicate(SortedSet.Node node); - internal enum TreeRotation + internal enum TreeRotation : byte { - Left = 1, - Right = 2, - RightLeft = 3, - LeftRight = 4, + Left, + LeftRight, + Right, + RightLeft } [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "by design name choice")] @@ -56,12 +63,14 @@ namespace System.Collections.Generic private const string CountName = "Count"; // Do not rename (binary serialization) private const string ItemsName = "Items"; // Do not rename (binary serialization) private const string VersionName = "Version"; // Do not rename (binary serialization) + // Needed for enumerator private const string TreeName = "Tree"; private const string NodeValueName = "Item"; private const string EnumStartName = "EnumStarted"; private const string ReverseName = "Reverse"; private const string EnumVersionName = "EnumVersion"; + // Needed for TreeSubset private const string MinName = "Min"; private const string MaxName = "Max"; @@ -108,7 +117,7 @@ namespace System.Collections.Generic } return; } - + int count; T[] elements = EnumerableHelpers.ToArray(collection, out count); if (count > 0) @@ -135,10 +144,7 @@ namespace System.Collections.Generic } } - protected SortedSet(SerializationInfo info, StreamingContext context) - { - siInfo = info; - } + protected SortedSet(SerializationInfo info, StreamingContext context) => siInfo = info; #endregion @@ -182,7 +188,7 @@ namespace System.Collections.Generic } /// - /// Does an inorder tree walk and calls the delegate for each node. + /// Does an in-order tree walk and calls the delegate for each node. /// /// /// The delegate to invoke on each node. @@ -201,7 +207,7 @@ namespace System.Collections.Generic // Note: It's not strictly necessary to provide the stack capacity, but we don't // want the stack to unnecessarily allocate arrays as it grows. - var stack = new Stack(2 * (int)(Log2(Count + 1))); + var stack = new Stack(2 * (int)Log2(Count + 1)); Node current = root; while (current != null) @@ -294,7 +300,7 @@ namespace System.Collections.Generic { if (_syncRoot == null) { - Threading.Interlocked.CompareExchange(ref _syncRoot, new object(), null); + Interlocked.CompareExchange(ref _syncRoot, new object(), null); } return _syncRoot; @@ -315,16 +321,16 @@ namespace System.Collections.Generic #region ICollection members - public bool Add(T item) => AddIfNotPresent(item); + public bool Add(T item) => AddIfNotPresent(item); // Hack so the implementation can be made virtual - void ICollection.Add(T item) => AddIfNotPresent(item); + void ICollection.Add(T item) => Add(item); internal virtual bool AddIfNotPresent(T item) { if (root == null) { // The tree is empty and this is the first item. - root = new Node(item, isRed: false); + root = new Node(item, NodeColor.Black); count = 1; version++; return true; @@ -350,7 +356,7 @@ namespace System.Collections.Generic { // We could have changed root node to red during the search process. // We need to set it to black before we return. - root.IsRed = false; + root.ColorBlack(); return false; } @@ -372,8 +378,8 @@ namespace System.Collections.Generic } Debug.Assert(parent != null); - // ready to insert the new node - Node node = new Node(item, isRed: true); + // We're ready to insert the new node. + Node node = new Node(item, NodeColor.Red); if (order > 0) { parent.Right = node; @@ -383,19 +389,19 @@ namespace System.Collections.Generic parent.Left = node; } - // the new node will be red, so we will need to adjust the colors if parent node is also red + // The new node will be red, so we will need to adjust colors if its parent is also red. if (parent.IsRed) { InsertionBalance(node, ref parent, grandParent, greatGrandParent); } - // Root node is always black - root.IsRed = false; + // The root node is always black. + root.ColorBlack(); ++count; return true; } - public bool Remove(T item) => DoRemove(item); // hack so it can be made non-virtual + public bool Remove(T item) => DoRemove(item); // Hack so the implementation can be made virtual internal virtual bool DoRemove(T item) { @@ -405,15 +411,15 @@ namespace System.Collections.Generic } // Search for a node and then find its successor. - // Then copy the item from the successor to the matching node and delete the successor. - // If a node doesn't have a successor, we can replace it with its left child (if not empty.) + // Then copy the item from the successor to the matching node, and delete the successor. + // If a node doesn't have a successor, we can replace it with its left child (if not empty), // or delete the matching node. // // In top-down implementation, it is important to make sure the node to be deleted is not a 2-node. // Following code will make sure the node on the path is not a 2-node. - // even if we don't actually remove from the set, we may be altering its structure (by doing rotations - // and such). so update version to disable any enumerators/subsets working on it + // Even if we don't actually remove from the set, we may be altering its structure (by doing rotations + // and such). So update our version to disable any enumerators/subsets working on it. version++; Node current = root; @@ -426,20 +432,20 @@ namespace System.Collections.Generic { if (current.Is2Node) { - // fix up 2-Node + // Fix up 2-node if (parent == null) { - // current is root. Mark it as red - current.IsRed = true; + // `current` is the root. Mark it red. + current.ColorRed(); } else { - Node sibling = GetSibling(current, parent); + Node sibling = parent.GetSibling(current); if (sibling.IsRed) { // If parent is a 3-node, flip the orientation of the red link. - // We can achieve this by a single rotation - // This case is converted to one of other cased below. + // We can achieve this by a single rotation. + // This case is converted to one of the other cases below. Debug.Assert(parent.IsBlack); if (parent.Right == sibling) { @@ -450,66 +456,37 @@ namespace System.Collections.Generic parent.RotateRight(); } - parent.IsRed = true; - sibling.IsRed = false; // parent's color - // sibling becomes child of grandParent or root after rotation. Update link from grandParent or root - ReplaceChildOfNodeOrRoot(grandParent, parent, sibling); - // sibling will become grandParent of current node + parent.ColorRed(); + sibling.ColorBlack(); // The red parent can't have black children. + // `sibling` becomes the child of `grandParent` or `root` after rotation. Update the link from that node. + ReplaceChildOrRoot(grandParent, parent, sibling); + // `sibling` will become the grandparent of `current`. grandParent = sibling; if (parent == match) { parentOfMatch = sibling; } - // update sibling, this is necessary for following processing - sibling = (parent.Left == current) ? parent.Right : parent.Left; + sibling = parent.GetSibling(current); } Debug.Assert(Node.IsNonNullBlack(sibling)); if (sibling.Is2Node) { - Merge2Nodes(parent, current, sibling); + parent.Merge2Nodes(); } else { - // current is a 2-node and sibling is either a 3-node or a 4-node. - // We can change the color of current to red by some rotation. - TreeRotation rotation = RotationNeeded(parent, current, sibling); - Node newGrandParent = null; - switch (rotation) - { - case TreeRotation.Right: - Debug.Assert(parent.Left == sibling); - Debug.Assert(sibling.Left.IsRed); - sibling.Left.IsRed = false; - newGrandParent = parent.RotateRight(); - break; + // `current` is a 2-node and `sibling` is either a 3-node or a 4-node. + // We can change the color of `current` to red by some rotation. + Node newGrandParent = parent.Rotate(parent.GetRotation(current, sibling)); - case TreeRotation.Left: - Debug.Assert(parent.Right == sibling); - Debug.Assert(sibling.Right.IsRed); - sibling.Right.IsRed = false; - newGrandParent = parent.RotateLeft(); - break; + newGrandParent.Color = parent.Color; + parent.ColorBlack(); + current.ColorRed(); - case TreeRotation.RightLeft: - Debug.Assert(parent.Right == sibling); - Debug.Assert(sibling.Left.IsRed); - newGrandParent = parent.RotateRightLeft(); - break; - - case TreeRotation.LeftRight: - Debug.Assert(parent.Left == sibling); - Debug.Assert(sibling.Right.IsRed); - newGrandParent = parent.RotateLeftRight(); - break; - } - - newGrandParent.IsRed = parent.IsRed; - parent.IsRed = false; - current.IsRed = true; - ReplaceChildOfNodeOrRoot(grandParent, parent, newGrandParent); + ReplaceChildOrRoot(grandParent, parent, newGrandParent); if (parent == match) { parentOfMatch = newGrandParent; @@ -519,11 +496,11 @@ namespace System.Collections.Generic } } - // we don't need to compare any more once we found the match + // We don't need to compare after we find the match. int order = foundMatch ? -1 : comparer.Compare(item, current.Item); if (order == 0) { - // save the matching node + // Save the matching node. foundMatch = true; match = current; parentOfMatch = parent; @@ -535,18 +512,14 @@ namespace System.Collections.Generic current = order < 0 ? current.Left : current.Right; } - // move successor to the matching node position and replace links + // Move successor to the matching node position and replace links. if (match != null) { ReplaceNode(match, parentOfMatch, parent, grandParent); --count; } - if (root != null) - { - root.IsRed = false; - } - + root?.ColorBlack(); return foundMatch; } @@ -557,7 +530,6 @@ namespace System.Collections.Generic ++version; } - public virtual bool Contains(T item) => FindNode(item) != null; public void CopyTo(T[] array) => CopyTo(array, 0, Count); @@ -642,7 +614,11 @@ namespace System.Collections.Generic try { - InOrderTreeWalk(node => { objects[index++] = node.Item; return true; }); + InOrderTreeWalk(node => + { + objects[index++] = node.Item; + return true; + }); } catch (ArrayTypeMismatchException) { @@ -665,8 +641,6 @@ namespace System.Collections.Generic #region Tree-specific operations - private static Node GetSibling(Node node, Node parent) => parent.Left == node ? parent.Right : parent.Left; - // After calling InsertionBalance, we need to make sure `current` and `parent` are up-to-date. // It doesn't matter if we keep `grandParent` and `greatGrandParent` up-to-date, because we won't // need to split again in the next node. @@ -676,8 +650,8 @@ namespace System.Collections.Generic Debug.Assert(parent != null); Debug.Assert(grandParent != null); - bool parentIsOnRight = (grandParent.Right == parent); - bool currentIsOnRight = (parent.Right == current); + bool parentIsOnRight = grandParent.Right == parent; + bool currentIsOnRight = parent.Right == current; Node newChildOfGreatGrandParent; if (parentIsOnRight == currentIsOnRight) @@ -694,35 +668,23 @@ namespace System.Collections.Generic } // `grandParent` will become a child of either `parent` of `current`. - grandParent.IsRed = true; - newChildOfGreatGrandParent.IsRed = false; + grandParent.ColorRed(); + newChildOfGreatGrandParent.ColorBlack(); - ReplaceChildOfNodeOrRoot(greatGrandParent, grandParent, newChildOfGreatGrandParent); + ReplaceChildOrRoot(greatGrandParent, grandParent, newChildOfGreatGrandParent); } - private static void Merge2Nodes(Node parent, Node child1, Node child2) - { - Debug.Assert(Node.IsNonNullRed(parent)); - // Combine two 2-nodes into a 4-node - parent.IsRed = false; - child1.IsRed = true; - child2.IsRed = true; - } - - // Replace the child of a parent node. - // If the parent node is null, replace the root. - private void ReplaceChildOfNodeOrRoot(Node parent, Node child, Node newChild) + /// + /// Replaces the child of a parent node, or replaces the root if the parent is null. + /// + /// The (possibly null) parent. + /// The child node to replace. + /// The node to replace with. + private void ReplaceChildOrRoot(Node parent, Node child, Node newChild) { if (parent != null) { - if (parent.Left == child) - { - parent.Left = newChild; - } - else - { - parent.Right = newChild; - } + parent.ReplaceChild(child, newChild); } else { @@ -730,12 +692,16 @@ namespace System.Collections.Generic } } - // Replace the matching node with its successor. + /// + /// Replaces the matching node with its successor. + /// private void ReplaceNode(Node match, Node parentOfMatch, Node successor, Node parentOfSuccessor) { + Debug.Assert(match != null); + if (successor == match) { - // this node has no successor, should only happen if right child of matching node is null. + // This node has no successor. This can only happen if the right child of the match is null. Debug.Assert(match.Right == null); successor = match.Left; } @@ -745,14 +711,11 @@ namespace System.Collections.Generic Debug.Assert(successor.Left == null); Debug.Assert((successor.Right == null && successor.IsRed) || (successor.Right.IsRed && successor.IsBlack)); - if (successor.Right != null) - { - successor.Right.IsRed = false; - } + successor.Right?.ColorBlack(); if (parentOfSuccessor != match) { - // detach successor from its parent and set its right child + // Detach the successor from its parent and set its right child. parentOfSuccessor.Left = successor.Right; successor.Right = match.Right; } @@ -762,10 +725,10 @@ namespace System.Collections.Generic if (successor != null) { - successor.IsRed = match.IsRed; + successor.Color = match.Color; } - ReplaceChildOfNodeOrRoot(parentOfMatch, match, successor); + ReplaceChildOrRoot(parentOfMatch, match, successor); } internal virtual Node FindNode(T item) @@ -779,15 +742,26 @@ namespace System.Collections.Generic return current; } - current = (order < 0) ? current.Left : current.Right; + current = order < 0 ? current.Left : current.Right; } return null; } - // Used for bithelpers. Note that this implementation is completely different - // from the Subset's. The two should not be mixed. This indexes as if the tree were an array. - // http://en.wikipedia.org/wiki/Binary_Tree#Methods_for_storing_binary_trees + /// + /// Searches for an item and returns its zero-based index in this set. + /// + /// The item. + /// The item's zero-based index in this set, or -1 if it isn't found. + /// + /// + /// This implementation is based off of http://en.wikipedia.org/wiki/Binary_Tree#Methods_for_storing_binary_trees. + /// + /// + /// This method is used with the class. Note that this implementation is + /// completely different from 's, and that the two should not be mixed. + /// + /// internal virtual int InternalIndexOf(T item) { Node current = root; @@ -800,8 +774,8 @@ namespace System.Collections.Generic return count; } - current = (order < 0) ? current.Left : current.Right; - count = (order < 0) ? (2 * count + 1) : (2 * count + 2); + current = order < 0 ? current.Left : current.Right; + count = order < 0 ? (2 * count + 1) : (2 * count + 2); } return -1; @@ -837,25 +811,12 @@ namespace System.Collections.Generic internal void UpdateVersion() => ++version; /// - /// Testing counter that can track rotations. - /// - private static TreeRotation RotationNeeded(Node parent, Node current, Node sibling) - { - Debug.Assert(Node.IsNonNullRed(sibling.Left) || Node.IsNonNullRed(sibling.Right)); - - bool currentIsLeftChild = parent.Left == current; - return Node.IsNonNullRed(sibling.Left) ? - (currentIsLeftChild ? TreeRotation.RightLeft : TreeRotation.Right) : - (currentIsLeftChild ? TreeRotation.Left : TreeRotation.LeftRight); - } - - /// - /// Used for deep equality of SortedSet testing. + /// Returns an object that can be used to create a collection that contains individual sets. /// public static IEqualityComparer> CreateSetComparer() => CreateSetComparer(memberEqualityComparer: null); /// - /// Creates a new set comparer for this set, where this set's members' equality is defined by the specified comparer. + /// Returns an object, according to a specified comparer, that can be used to create a collection that contains individual sets. /// public static IEqualityComparer> CreateSetComparer(IEqualityComparer memberEqualityComparer) { @@ -871,7 +832,6 @@ namespace System.Collections.Generic /// true if the sets have equal contents; otherwise, false. internal static bool SortedSetEquals(SortedSet set1, SortedSet set2, IComparer comparer) { - // Handle null cases first. if (set1 == null) { return set2 == null; @@ -887,7 +847,7 @@ namespace System.Collections.Generic { return set1.Count == set2.Count && set1.SetEquals(set2); } - + bool found = false; foreach (T item1 in set1) { @@ -909,10 +869,14 @@ namespace System.Collections.Generic return true; } + /// + /// Determines whether two instances have the same comparer. + /// + /// The other . + /// A value indicating whether both sets have the same comparer. private bool HasEqualComparer(SortedSet other) { - // Both comparers will most commonly be the default comparer. - // Avoid a virtual method call to Equals() in that case. + // Commonly, both comparers will be the default comparer (and reference-equal). Avoid a virtual method call to Equals() in that case. return Comparer == other.Comparer || Comparer.Equals(other.Comparer); } @@ -927,29 +891,29 @@ namespace System.Collections.Generic throw new ArgumentNullException(nameof(other)); } - SortedSet s = other as SortedSet; - TreeSubSet t = this as TreeSubSet; + SortedSet asSorted = other as SortedSet; + TreeSubSet treeSubset = this as TreeSubSet; - if (t != null) + if (treeSubset != null) VersionCheck(); - if (s != null && t == null && count == 0) + if (asSorted != null && treeSubset == null && count == 0) { - SortedSet dummy = new SortedSet(s, comparer); + SortedSet dummy = new SortedSet(asSorted, comparer); root = dummy.root; count = dummy.count; version++; return; } - if (s != null && t == null && HasEqualComparer(s) && (s.Count > this.Count / 2)) + // This actually hurts if N is much greater than M. The / 2 is arbitrary. + if (asSorted != null && treeSubset == null && HasEqualComparer(asSorted) && (asSorted.Count > this.Count / 2)) { - // This actually hurts if N is much greater than M. The /2 is arbitrary. // First do a merge sort to an array. - T[] merged = new T[s.Count + this.Count]; + T[] merged = new T[asSorted.Count + this.Count]; int c = 0; Enumerator mine = this.GetEnumerator(); - Enumerator theirs = s.GetEnumerator(); + Enumerator theirs = asSorted.GetEnumerator(); bool mineEnded = !mine.MoveNext(), theirsEnded = !theirs.MoveNext(); while (!mineEnded && !theirsEnded) { @@ -978,7 +942,8 @@ namespace System.Collections.Generic do { merged[c++] = remaining.Current; - } while (remaining.MoveNext()); + } + while (remaining.MoveNext()); } // now merged has all c elements @@ -1017,49 +982,48 @@ namespace System.Collections.Generic // Only some base cases are handled below. int size = endIndex - startIndex + 1; - if (size == 0) + Node root; + + switch (size) { - return null; + case 0: + return null; + case 1: + root = new Node(arr[startIndex], NodeColor.Black); + if (redNode != null) + { + root.Left = redNode; + } + break; + case 2: + root = new Node(arr[startIndex], NodeColor.Black); + root.Right = new Node(arr[endIndex], NodeColor.Black); + root.Right.ColorRed(); + if (redNode != null) + { + root.Left = redNode; + } + break; + case 3: + root = new Node(arr[startIndex + 1], NodeColor.Black); + root.Left = new Node(arr[startIndex], NodeColor.Black); + root.Right = new Node(arr[endIndex], NodeColor.Black); + if (redNode != null) + { + root.Left.Left = redNode; + } + break; + default: + int midpt = ((startIndex + endIndex) / 2); + root = new Node(arr[midpt], NodeColor.Black); + root.Left = ConstructRootFromSortedArray(arr, startIndex, midpt - 1, redNode); + root.Right = size % 2 == 0 ? + ConstructRootFromSortedArray(arr, midpt + 2, endIndex, new Node(arr[midpt + 1], NodeColor.Red)) : + ConstructRootFromSortedArray(arr, midpt + 1, endIndex, null); + break; + } - Node root = null; - if (size == 1) - { - root = new Node(arr[startIndex], isRed: false); - if (redNode != null) - { - root.Left = redNode; - } - } - else if (size == 2) - { - root = new Node(arr[startIndex], isRed: false); - root.Right = new Node(arr[endIndex], isRed: false); - root.Right.IsRed = true; - if (redNode != null) - { - root.Left = redNode; - } - } - else if (size == 3) - { - root = new Node(arr[startIndex + 1], isRed: false); - root.Left = new Node(arr[startIndex], isRed: false); - root.Right = new Node(arr[endIndex], isRed: false); - if (redNode != null) - { - root.Left.Left = redNode; - } - } - else - { - int midpt = ((startIndex + endIndex) / 2); - root = new Node(arr[midpt], isRed: false); - root.Left = ConstructRootFromSortedArray(arr, startIndex, midpt - 1, redNode); - root.Right = size % 2 == 0 ? - ConstructRootFromSortedArray(arr, midpt + 2, endIndex, new Node(arr[midpt + 1], isRed: true)) : - ConstructRootFromSortedArray(arr, midpt + 1, endIndex, null); - } return root; } @@ -1079,18 +1043,19 @@ namespace System.Collections.Generic // HashSet optimizations can't be done until equality comparers and comparers are related // Technically, this would work as well with an ISorted - SortedSet s = other as SortedSet; - TreeSubSet t = this as TreeSubSet; - if (t != null) + SortedSet asSorted = other as SortedSet; + TreeSubSet treeSubset = this as TreeSubSet; + + if (treeSubset != null) VersionCheck(); - // only let this happen if i am also a SortedSet, not a SubSet - if (s != null && t == null && HasEqualComparer(s)) + + if (asSorted != null && treeSubset == null && HasEqualComparer(asSorted)) { - // first do a merge sort to an array. + // First do a merge sort to an array. T[] merged = new T[this.Count]; int c = 0; Enumerator mine = this.GetEnumerator(); - Enumerator theirs = s.GetEnumerator(); + Enumerator theirs = asSorted.GetEnumerator(); bool mineEnded = !mine.MoveNext(), theirsEnded = !theirs.MoveNext(); T max = Max; T min = Min; @@ -1144,7 +1109,7 @@ namespace System.Collections.Generic Clear(); foreach (T item in toSave) { - AddIfNotPresent(item); + Add(item); } } @@ -1168,8 +1133,8 @@ namespace System.Collections.Generic if (asSorted != null && HasEqualComparer(asSorted)) { - // outside range, no point doing anything - if (!(comparer.Compare(asSorted.Max, Min) < 0 || comparer.Compare(asSorted.Min, Max) > 0)) + // Outside range, no point in doing anything + if (comparer.Compare(asSorted.Max, Min) >= 0 && comparer.Compare(asSorted.Min, Max) <= 0) { T min = Min; T max = Max; @@ -1280,11 +1245,9 @@ namespace System.Collections.Generic } else { - // worst case: mark every element in my set and see if I've counted all - // O(MlogN) - + // Worst case: I mark every element in my set and see if I've counted all of them. O(M log N). ElementCount result = CheckUniqueAndUnfoundElements(other, false); - return (result.UniqueCount == Count && result.UnfoundCount >= 0); + return result.UniqueCount == Count && result.UnfoundCount >= 0; } } @@ -1321,10 +1284,9 @@ namespace System.Collections.Generic return IsSubsetOfSortedSetWithSameComparer(asSorted); } - // worst case: mark every element in my set and see if I've counted all - // O(MlogN). + // Worst case: I mark every element in my set and see if I've counted all of them. O(M log N). ElementCount result = CheckUniqueAndUnfoundElements(other, false); - return (result.UniqueCount == Count && result.UnfoundCount > 0); + return result.UniqueCount == Count && result.UnfoundCount > 0; } public bool IsSupersetOf(IEnumerable other) @@ -1385,12 +1347,11 @@ namespace System.Collections.Generic return true; } - // worst case: mark every element in my set and see if I've counted all - // O(MlogN) + // Worst case: I mark every element in my set and see if I've counted all of them. O(M log N). // slight optimization, put it into a HashSet and then check can do it in O(N+M) // but slower in better cases + wastes space ElementCount result = CheckUniqueAndUnfoundElements(other, true); - return (result.UniqueCount < Count && result.UnfoundCount == 0); + return result.UniqueCount < Count && result.UnfoundCount == 0; } public bool SetEquals(IEnumerable other) @@ -1419,10 +1380,9 @@ namespace System.Collections.Generic return mineEnded && theirsEnded; } - // worst case: mark every element in my set and see if I've counted all - // O(N) by size of other + // Worst case: I mark every element in my set and see if I've counted all of them. O(size of the other collection). ElementCount result = CheckUniqueAndUnfoundElements(other, true); - return (result.UniqueCount == Count && result.UnfoundCount == 0); + return result.UniqueCount == Count && result.UnfoundCount == 0; } public bool Overlaps(IEnumerable other) @@ -1561,7 +1521,7 @@ namespace System.Collections.Generic return true; }); - // reverse breadth first to (try to) incur low cost + // Enumerate the results of the breadth-first walk in reverse in an attempt to lower cost. int actuallyRemoved = 0; for (int i = matches.Count - 1; i >= 0; i--) { @@ -1600,8 +1560,8 @@ namespace System.Collections.Generic } public T Max => MaxInternal; - - internal virtual T MaxInternal + + internal virtual T MaxInternal { get { @@ -1649,10 +1609,7 @@ namespace System.Collections.Generic } #endif - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) - { - GetObjectData(info, context); - } + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) => GetObjectData(info, context); protected virtual void GetObjectData(SerializationInfo info, StreamingContext context) { @@ -1673,12 +1630,9 @@ namespace System.Collections.Generic } } - void IDeserializationCallback.OnDeserialization(Object sender) - { - OnDeserialization(sender); - } + void IDeserializationCallback.OnDeserialization(object sender) => OnDeserialization(sender); - protected virtual void OnDeserialization(Object sender) + protected virtual void OnDeserialization(object sender) { if (comparer != null) { @@ -1724,33 +1678,44 @@ namespace System.Collections.Generic [Serializable] internal sealed class Node { - public Node(T item, bool isRed) + public Node(T item, NodeColor color) { - // The default color is red since we usually don't need to create a black node directly. Item = item; - IsRed = isRed; + Color = color; } + public static bool IsNonNullBlack(Node node) => node != null && node.IsBlack; + + public static bool IsNonNullRed(Node node) => node != null && node.IsRed; + + public static bool IsNullOrBlack(Node node) => node == null || node.IsBlack; + public T Item { get; set; } public Node Left { get; set; } public Node Right { get; set; } - public bool IsRed { get; set; } + public NodeColor Color { get; set; } - public bool IsBlack => !IsRed; + public bool IsBlack => Color == NodeColor.Black; + + public bool IsRed => Color == NodeColor.Red; public bool Is2Node => IsBlack && IsNullOrBlack(Left) && IsNullOrBlack(Right); public bool Is4Node => IsNonNullRed(Left) && IsNonNullRed(Right); + public void ColorBlack() => Color = NodeColor.Black; + + public void ColorRed() => Color = NodeColor.Red; + public Node DeepClone(int count) { #if DEBUG Debug.Assert(count == GetCount()); #endif - + // Breadth-first traversal to recreate nodes, preorder traversal to replicate nodes. var originalNodes = new Stack(2 * Log2(count) + 2); @@ -1791,27 +1756,78 @@ namespace System.Collections.Generic return newRoot; } + /// + /// Gets the rotation this node should undergo during a removal. + /// + public TreeRotation GetRotation(Node current, Node sibling) + { + Debug.Assert(IsNonNullRed(sibling.Left) || IsNonNullRed(sibling.Right)); #if DEBUG - public int GetCount() => 1 + (Left?.GetCount() ?? 0) + (Right?.GetCount() ?? 0); + Debug.Assert(HasChildren(current, sibling)); #endif - public Node ShallowClone() => new Node(Item, IsRed); + bool currentIsLeftChild = Left == current; + return IsNonNullRed(sibling.Left) ? + (currentIsLeftChild ? TreeRotation.RightLeft : TreeRotation.Right) : + (currentIsLeftChild ? TreeRotation.Left : TreeRotation.LeftRight); + } - public static bool IsNonNullBlack(Node node) => node != null && node.IsBlack; + /// + /// Gets the sibling of one of this node's children. + /// + public Node GetSibling(Node node) + { + Debug.Assert(node != null); + Debug.Assert(node == Left ^ node == Right); - public static bool IsNonNullRed(Node node) => node != null && node.IsRed; + return node == Left ? Right : Left; + } - public static bool IsNullOrBlack(Node node) => node == null || node.IsBlack; + public Node ShallowClone() => new Node(Item, Color); public void Split4Node() { Debug.Assert(Left != null); Debug.Assert(Right != null); - IsRed = true; - Left.IsRed = Right.IsRed = false; + ColorRed(); + Left.ColorBlack(); + Right.ColorBlack(); } + /// + /// Does a rotation on this tree. May change the color of a grandchild from red to black. + /// + public Node Rotate(TreeRotation rotation) + { + Node removeRed; + switch (rotation) + { + case TreeRotation.Right: + removeRed = Left.Left; + Debug.Assert(removeRed.IsRed); + removeRed.ColorBlack(); + return RotateRight(); + case TreeRotation.Left: + removeRed = Right.Right; + Debug.Assert(removeRed.IsRed); + removeRed.ColorBlack(); + return RotateLeft(); + case TreeRotation.RightLeft: + Debug.Assert(Right.Left.IsRed); + return RotateRightLeft(); + case TreeRotation.LeftRight: + Debug.Assert(Left.Right.IsRed); + return RotateLeftRight(); + default: + Debug.Fail($"{nameof(rotation)}: {rotation} is not a defined {nameof(TreeRotation)} value."); + return null; + } + } + + /// + /// Does a left rotation on this tree, making this node the new left child of the current right child. + /// public Node RotateLeft() { Node child = Right; @@ -1820,6 +1836,9 @@ namespace System.Collections.Generic return child; } + /// + /// Does a left-right rotation on this tree. The left child is rotated left, then this node is rotated right. + /// public Node RotateLeftRight() { Node child = Left; @@ -1832,6 +1851,9 @@ namespace System.Collections.Generic return grandChild; } + /// + /// Does a right rotation on this tree, making this node the new right child of the current left child. + /// public Node RotateRight() { Node child = Left; @@ -1840,6 +1862,9 @@ namespace System.Collections.Generic return child; } + /// + /// Does a right-left rotation on this tree. The right child is rotated right, then this node is rotated left. + /// public Node RotateRightLeft() { Node child = Right; @@ -1851,13 +1876,63 @@ namespace System.Collections.Generic grandChild.Right = child; return grandChild; } + + /// + /// Combines two 2-nodes into a 4-node. + /// + public void Merge2Nodes() + { + Debug.Assert(IsRed); + Debug.Assert(Left.Is2Node); + Debug.Assert(Right.Is2Node); + + // Combine two 2-nodes into a 4-node. + ColorBlack(); + Left.ColorRed(); + Right.ColorRed(); + } + + /// + /// Replaces a child of this node with a new node. + /// + /// The child to replace. + /// The node to replace with. + public void ReplaceChild(Node child, Node newChild) + { +#if DEBUG + Debug.Assert(HasChild(child)); +#endif + + if (Left == child) + { + Left = newChild; + } + else + { + Right = newChild; + } + } + +#if DEBUG + private int GetCount() => 1 + (Left?.GetCount() ?? 0) + (Right?.GetCount() ?? 0); + + private bool HasChild(Node child) => child == Left || child == Right; + + private bool HasChildren(Node child1, Node child2) + { + Debug.Assert(child1 != child2); + + return (Left == child1 && Right == child2) + || (Left == child2 && Right == child1); + } +#endif } [SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")] [Serializable] public struct Enumerator : IEnumerator, IEnumerator, ISerializable, IDeserializationCallback { - private static readonly Node s_dummyNode = new Node(default(T), isRed: true); + private static readonly Node s_dummyNode = new Node(default(T), NodeColor.Red); private SortedSet _tree; private int _version; @@ -1868,27 +1943,17 @@ namespace System.Collections.Generic private bool _reverse; internal Enumerator(SortedSet set) + : this(set, reverse: false) { - _tree = set; - _tree.VersionCheck(); // make sure that the underlying subset has not been changed since - - _version = _tree.version; - - // 2lg(n + 1) is the maximum height - _stack = new Stack(2 * (int)Log2(set.Count + 1)); - _current = null; - _reverse = false; - - Initialize(); } internal Enumerator(SortedSet set, bool reverse) { _tree = set; - _tree.VersionCheck(); // make sure that the underlying subset has not been changed since - _version = _tree.version; + set.VersionCheck(); + _version = set.version; - // 2lg(n + 1) is the maximum height + // 2 log(n + 1) is the maximum height. _stack = new Stack(2 * (int)Log2(set.Count + 1)); _current = null; _reverse = reverse; @@ -1901,7 +1966,7 @@ namespace System.Collections.Generic throw new PlatformNotSupportedException(); } - void IDeserializationCallback.OnDeserialization(Object sender) + void IDeserializationCallback.OnDeserialization(object sender) { throw new PlatformNotSupportedException(); } @@ -2028,7 +2093,7 @@ namespace System.Collections.Generic /// Searches the set for a given value and returns the equal value it finds, if any. /// /// The value to search for. - /// The value from the set that the search found, or the original value if the search yielded no match. + /// The value from the set that the search found, or the default value of when the search yielded no match. /// A value indicating whether the search was successful. /// /// This can be useful when you want to reuse a previously stored reference instead of diff --git a/external/corefx/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs b/external/corefx/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs index 91f0965e8e..b56090f5f8 100644 --- a/external/corefx/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs +++ b/external/corefx/src/System.Collections/tests/Generic/Comparers/Comparer.Generic.Tests.cs @@ -13,6 +13,7 @@ namespace System.Collections.Generic.Tests { public abstract partial class ComparersGenericTests { + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Missing https://github.com/dotnet/coreclr/pull/4340")] [Fact] public void Comparer_ComparerDefault() { diff --git a/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs b/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs index 4c4c519df2..4969bb2c52 100644 --- a/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs +++ b/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs @@ -9,6 +9,7 @@ namespace System.Collections.Generic.Tests { public abstract partial class ComparersGenericTests { + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Missing https://github.com/dotnet/coreclr/pull/4340")] [Fact] public void EqualityComparer_EqualityComparerDefault() { diff --git a/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Find.cs b/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Find.cs index cc91308e81..b93e7c62f1 100644 --- a/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Find.cs +++ b/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Find.cs @@ -30,14 +30,14 @@ namespace System.Collections.Tests //[] Call Find an empty collection linkedList = new LinkedList(); - Assert.Null(linkedList.Find(headItems[0])); //"Err_2899hjaied Expected Find to return false with a non null item on a empty collection" - Assert.Null(linkedList.Find(default(T))); //"Err_5808ajiea Expected Find to return false with a null item on a empty collection" + Assert.Null(linkedList.Find(headItems[0])); //"Err_2899hjaied Expected Find to return false with a non null item on an empty collection" + Assert.Null(linkedList.Find(default(T))); //"Err_5808ajiea Expected Find to return false with a null item on an empty collection" //[] Call Find on a collection with one item in it linkedList = new LinkedList(); linkedList.AddLast(headItems[0]); - Assert.Null(linkedList.Find(headItems[1])); //"Err_2899hjaied Expected Find to return false with a non null item on a empty collection size=1" - Assert.Null(linkedList.Find(default(T))); //"Err_5808ajiea Expected Find to return false with a null item on a empty collection size=1" + Assert.Null(linkedList.Find(headItems[1])); //"Err_2899hjaied Expected Find to return false with a non null item on an empty collection size=1" + Assert.Null(linkedList.Find(default(T))); //"Err_5808ajiea Expected Find to return false with a null item on an empty collection size=1" VerifyFind(linkedList, new T[] { headItems[0] }); //[] Call Find on a collection with two items in it @@ -129,4 +129,4 @@ namespace System.Collections.Tests VerifyFind(linkedList, tempItems); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.FindLast.cs b/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.FindLast.cs index 4513807420..5769211e23 100644 --- a/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.FindLast.cs +++ b/external/corefx/src/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.FindLast.cs @@ -37,14 +37,14 @@ namespace System.Collections.Tests //[] Call FindLast an empty collection linkedList = new LinkedList(); - Assert.Null(linkedList.FindLast(headItems[0])); //"Err_2899hjaied Expected FindLast to return false with a non null item on a empty collection" - Assert.Null(linkedList.FindLast(default(T))); //"Err_5808ajiea Expected FindLast to return false with a null item on a empty collection" + Assert.Null(linkedList.FindLast(headItems[0])); //"Err_2899hjaied Expected FindLast to return false with a non null item on an empty collection" + Assert.Null(linkedList.FindLast(default(T))); //"Err_5808ajiea Expected FindLast to return false with a null item on an empty collection" //[] Call FindLast on a collection with one item in it linkedList = new LinkedList(); linkedList.AddLast(headItems[0]); - Assert.Null(linkedList.FindLast(headItems[1])); //"Err_2899hjaied Expected FindLast to return false with a non null item on a empty collection size=1" - Assert.Null(linkedList.FindLast(default(T))); //"Err_5808ajiea Expected FindLast to return false with a null item on a empty collection size=1" + Assert.Null(linkedList.FindLast(headItems[1])); //"Err_2899hjaied Expected FindLast to return false with a non null item on an empty collection size=1" + Assert.Null(linkedList.FindLast(default(T))); //"Err_5808ajiea Expected FindLast to return false with a null item on an empty collection size=1" VerifyFindLast(linkedList, new T[] { headItems[0] }); //[] Call FindLast on a collection with two items in it @@ -127,4 +127,4 @@ namespace System.Collections.Tests VerifyFindLast(linkedList, temp); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Collections/tests/ILCConfigurations.rd.xml b/external/corefx/src/System.Collections/tests/ILCConfigurations.rd.xml deleted file mode 100644 index 8e199216ee..0000000000 --- a/external/corefx/src/System.Collections/tests/ILCConfigurations.rd.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/external/corefx/src/System.Collections/tests/Performance/Configurations.props b/external/corefx/src/System.Collections/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Collections/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Collections/tests/Resources/System.Collections.Tests.rd.xml b/external/corefx/src/System.Collections/tests/Resources/System.Collections.Tests.rd.xml index 7b409ae9fd..23b96d2828 100644 --- a/external/corefx/src/System.Collections/tests/Resources/System.Collections.Tests.rd.xml +++ b/external/corefx/src/System.Collections/tests/Resources/System.Collections.Tests.rd.xml @@ -1,7 +1,13 @@ + - + + + - - + + + + + diff --git a/external/corefx/src/System.Collections/tests/System.Collections.Tests.csproj b/external/corefx/src/System.Collections/tests/System.Collections.Tests.csproj index 0dad64f966..ebd8168cba 100644 --- a/external/corefx/src/System.Collections/tests/System.Collections.Tests.csproj +++ b/external/corefx/src/System.Collections/tests/System.Collections.Tests.csproj @@ -71,9 +71,6 @@ Common\System\Collections\DictionaryExtensions.cs - - CommonTest\System\PlatformDetection.cs - System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs @@ -163,9 +160,6 @@ Common\System\Collections\IEnumerable.Generic.Serialization.Tests.cs - - - diff --git a/external/corefx/src/System.ComponentModel.Annotations/pkg/System.ComponentModel.Annotations.pkgproj b/external/corefx/src/System.ComponentModel.Annotations/pkg/System.ComponentModel.Annotations.pkgproj index 957e23392c..6a31e5cf40 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/pkg/System.ComponentModel.Annotations.pkgproj +++ b/external/corefx/src/System.ComponentModel.Annotations/pkg/System.ComponentModel.Annotations.pkgproj @@ -3,7 +3,7 @@ - net461;netcoreapp2.0;$(AllXamarinFrameworks) + net461;netcoreapp2.1;$(AllXamarinFrameworks) diff --git a/external/corefx/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj b/external/corefx/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj index e7dd01ee56..9b96eb41e0 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj +++ b/external/corefx/src/System.ComponentModel.Annotations/ref/System.ComponentModel.Annotations.csproj @@ -3,7 +3,10 @@ {C4D6F1F4-DC7E-4756-9A88-171A8B1F1E26} - true + + 4.2.0.0 + true diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociationAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociationAttribute.cs index 25fe1c0b00..5f62287183 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociationAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/AssociationAttribute.cs @@ -14,11 +14,6 @@ namespace System.ComponentModel.DataAnnotations [Obsolete("This attribute is no longer in use and will be ignored if applied.")] public sealed class AssociationAttribute : Attribute { - private string _name; - private string _thisKey; - private string _otherKey; - private bool _isForeignKey; - /// /// Full form of constructor /// @@ -30,78 +25,50 @@ namespace System.ComponentModel.DataAnnotations /// on the other side of the association public AssociationAttribute(string name, string thisKey, string otherKey) { - _name = name; - _thisKey = thisKey; - _otherKey = otherKey; + Name = name; + ThisKey = thisKey; + OtherKey = otherKey; } /// /// Gets the name of the association. For bi-directional associations, the name must /// be the same on both sides of the association /// - public string Name - { - get { return _name; } - } + public string Name { get; } /// /// Gets a comma separated list of the property names of the key values /// on this side of the association /// - public string ThisKey - { - get { return _thisKey; } - } + public string ThisKey { get; } /// /// Gets a comma separated list of the property names of the key values /// on the other side of the association /// - public string OtherKey - { - get { return _otherKey; } - } + public string OtherKey { get; } /// /// Gets or sets a value indicating whether this association member represents /// the foreign key side of an association /// - public bool IsForeignKey - { - get { return _isForeignKey; } - set { _isForeignKey = value; } - } + public bool IsForeignKey { get; set; } /// /// Gets the collection of individual key members specified in the ThisKey string. /// - public IEnumerable ThisKeyMembers - { - get - { - return GetKeyMembers(ThisKey); - } - } + public IEnumerable ThisKeyMembers => GetKeyMembers(ThisKey); /// /// Gets the collection of individual key members specified in the OtherKey string. /// - public IEnumerable OtherKeyMembers - { - get - { - return GetKeyMembers(OtherKey); - } - } + public IEnumerable OtherKeyMembers => GetKeyMembers(OtherKey); /// /// Parses the comma delimited key specified /// /// The key to parse /// Array of individual key members - private static string[] GetKeyMembers(string key) - { - return key.Replace(" ", string.Empty).Split(','); - } + private static string[] GetKeyMembers(string key) => key.Replace(" ", string.Empty).Split(','); } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CompareAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CompareAttribute.cs index fdc23ab732..38e5f98cba 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CompareAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CompareAttribute.cs @@ -21,17 +21,15 @@ namespace System.ComponentModel.DataAnnotations OtherProperty = otherProperty; } - public string OtherProperty { get; private set; } + public string OtherProperty { get; } public string OtherPropertyDisplayName { get; internal set; } public override bool RequiresValidationContext => true; - public override string FormatErrorMessage(string name) - { - return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, - OtherPropertyDisplayName ?? OtherProperty); - } + public override string FormatErrorMessage(string name) => + string.Format( + CultureInfo.CurrentCulture, ErrorMessageString, name, OtherPropertyDisplayName ?? OtherProperty); protected override ValidationResult IsValid(object value, ValidationContext validationContext) { @@ -53,14 +51,16 @@ namespace System.ComponentModel.DataAnnotations { if (OtherPropertyDisplayName == null) { - OtherPropertyDisplayName = GetDisplayNameForProperty(validationContext.ObjectType, otherPropertyInfo); + OtherPropertyDisplayName = GetDisplayNameForProperty(otherPropertyInfo); } + return new ValidationResult(FormatErrorMessage(validationContext.DisplayName)); } + return null; } - private string GetDisplayNameForProperty(Type containerType, PropertyInfo property) + private string GetDisplayNameForProperty(PropertyInfo property) { var attributes = CustomAttributeExtensions.GetCustomAttributes(property, true); var display = attributes.OfType().FirstOrDefault(); @@ -71,10 +71,5 @@ namespace System.ComponentModel.DataAnnotations return OtherProperty; } - - private static bool IsPublic(PropertyInfo p) - { - return (p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic); - } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CustomValidationAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CustomValidationAttribute.cs index 53661bc2ee..fa4561fa20 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CustomValidationAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/CustomValidationAttribute.cs @@ -60,8 +60,6 @@ namespace System.ComponentModel.DataAnnotations #region Member Fields private readonly Lazy _malformedErrorMessage; - private readonly string _method; - private readonly Type _validatorType; private bool _isSingleArgumentMethod; private string _lastMessage; private MethodInfo _methodInfo; @@ -76,7 +74,7 @@ namespace System.ComponentModel.DataAnnotations /// specified type. /// /// - /// An invalid or will be cause + /// An invalid or will be cause /// > to return a /// and to return a summary error message. /// @@ -88,8 +86,8 @@ namespace System.ComponentModel.DataAnnotations public CustomValidationAttribute(Type validatorType, string method) : base(() => SR.CustomValidationAttribute_ValidationError) { - _validatorType = validatorType; - _method = method; + ValidatorType = validatorType; + Method = method; _malformedErrorMessage = new Lazy(CheckAttributeWellFormed); } @@ -100,18 +98,12 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the type that contains the validation method identified by . /// - public Type ValidatorType - { - get { return _validatorType; } - } + public Type ValidatorType { get; } /// /// Gets the name of the method in to invoke to perform validation. /// - public string Method - { - get { return _method; } - } + public string Method { get; } public override bool RequiresValidationContext { @@ -154,8 +146,8 @@ namespace System.ComponentModel.DataAnnotations SR.CustomValidationAttribute_Type_Conversion_Failed, (value != null ? value.GetType().ToString() : "null"), _firstParameterType, - _validatorType, - _method)); + ValidatorType, + Method)); } // Invoke the method. Catch TargetInvocationException merely to unwrap it. @@ -212,10 +204,7 @@ namespace System.ComponentModel.DataAnnotations /// Checks whether the current attribute instance itself is valid for use. /// /// The error message why it is not well-formed, null if it is well-formed. - private string CheckAttributeWellFormed() - { - return ValidateValidatorTypeParameter() ?? ValidateMethodParameter(); - } + private string CheckAttributeWellFormed() => ValidateValidatorTypeParameter() ?? ValidateMethodParameter(); /// /// Internal helper to determine whether is legal for use. @@ -223,15 +212,15 @@ namespace System.ComponentModel.DataAnnotations /// null or the appropriate error message. private string ValidateValidatorTypeParameter() { - if (_validatorType == null) + if (ValidatorType == null) { return SR.CustomValidationAttribute_ValidatorType_Required; } - if (!_validatorType.IsVisible) + if (!ValidatorType.IsVisible) { return string.Format(CultureInfo.CurrentCulture, - SR.CustomValidationAttribute_Type_Must_Be_Public, _validatorType.Name); + SR.CustomValidationAttribute_Type_Must_Be_Public, ValidatorType.Name); } return null; @@ -243,27 +232,27 @@ namespace System.ComponentModel.DataAnnotations /// null or the appropriate error message. private string ValidateMethodParameter() { - if (string.IsNullOrEmpty(_method)) + if (string.IsNullOrEmpty(Method)) { return SR.CustomValidationAttribute_Method_Required; } // Named method must be public and static - var methodInfo = _validatorType.GetRuntimeMethods() - .SingleOrDefault(m => string.Equals(m.Name, _method, StringComparison.Ordinal) + var methodInfo = ValidatorType.GetRuntimeMethods() + .SingleOrDefault(m => string.Equals(m.Name, Method, StringComparison.Ordinal) && m.IsPublic && m.IsStatic); if (methodInfo == null) { return string.Format(CultureInfo.CurrentCulture, - SR.CustomValidationAttribute_Method_Not_Found, _method, _validatorType.Name); + SR.CustomValidationAttribute_Method_Not_Found, Method, ValidatorType.Name); } // Method must return a ValidationResult if (methodInfo.ReturnType != typeof(ValidationResult)) { return string.Format(CultureInfo.CurrentCulture, - SR.CustomValidationAttribute_Method_Must_Return_ValidationResult, _method, - _validatorType.Name); + SR.CustomValidationAttribute_Method_Must_Return_ValidationResult, Method, + ValidatorType.Name); } ParameterInfo[] parameterInfos = methodInfo.GetParameters(); @@ -272,7 +261,7 @@ namespace System.ComponentModel.DataAnnotations if (parameterInfos.Length == 0 || parameterInfos[0].ParameterType.IsByRef) { return string.Format(CultureInfo.CurrentCulture, - SR.CustomValidationAttribute_Method_Signature, _method, _validatorType.Name); + SR.CustomValidationAttribute_Method_Signature, Method, ValidatorType.Name); } // We accept 2 forms: @@ -285,8 +274,8 @@ namespace System.ComponentModel.DataAnnotations if ((parameterInfos.Length != 2) || (parameterInfos[1].ParameterType != typeof(ValidationContext))) { return string.Format(CultureInfo.CurrentCulture, - SR.CustomValidationAttribute_Method_Signature, _method, - _validatorType.Name); + SR.CustomValidationAttribute_Method_Signature, Method, + ValidatorType.Name); } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DataTypeAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DataTypeAttribute.cs index e398ad3f50..686a41a332 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DataTypeAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DataTypeAttribute.cs @@ -62,13 +62,13 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the DataType. If it equals DataType.Custom, should also be retrieved. /// - public DataType DataType { get; private set; } + public DataType DataType { get; } /// /// Gets the string representing a custom data type. Returns a non-null value only if is /// DataType.Custom. /// - public string CustomDataType { get; private set; } + public string CustomDataType { get; } /// /// Gets the default display format that gets used along with this DataType. diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayAttribute.cs index 53305daa00..f105a857b2 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayAttribute.cs @@ -57,14 +57,8 @@ namespace System.ComponentModel.DataAnnotations /// public string ShortName { - get { return _shortName.Value; } - set - { - if (_shortName.Value != value) - { - _shortName.Value = value; - } - } + get => _shortName.Value; + set => _shortName.Value = value; } /// @@ -88,14 +82,8 @@ namespace System.ComponentModel.DataAnnotations /// public string Name { - get { return _name.Value; } - set - { - if (_name.Value != value) - { - _name.Value = value; - } - } + get => _name.Value; + set => _name.Value = value; } /// @@ -119,14 +107,8 @@ namespace System.ComponentModel.DataAnnotations /// public string Description { - get { return _description.Value; } - set - { - if (_description.Value != value) - { - _description.Value = value; - } - } + get => _description.Value; + set => _description.Value = value; } /// @@ -150,14 +132,8 @@ namespace System.ComponentModel.DataAnnotations /// public string Prompt { - get { return _prompt.Value; } - set - { - if (_prompt.Value != value) - { - _prompt.Value = value; - } - } + get => _prompt.Value; + set => _prompt.Value = value; } /// @@ -181,14 +157,8 @@ namespace System.ComponentModel.DataAnnotations /// public string GroupName { - get { return _groupName.Value; } - set - { - if (_groupName.Value != value) - { - _groupName.Value = value; - } - } + get => _groupName.Value; + set => _groupName.Value = value; } /// @@ -200,7 +170,7 @@ namespace System.ComponentModel.DataAnnotations /// public Type ResourceType { - get { return _resourceType; } + get => _resourceType; set { if (_resourceType != value) @@ -240,9 +210,9 @@ namespace System.ComponentModel.DataAnnotations "GetAutoGenerateField")); } - return _autoGenerateField.Value; + return _autoGenerateField.GetValueOrDefault(); } - set { _autoGenerateField = value; } + set => _autoGenerateField = value; } /// @@ -270,9 +240,9 @@ namespace System.ComponentModel.DataAnnotations "GetAutoGenerateFilter")); } - return _autoGenerateFilter.Value; + return _autoGenerateFilter.GetValueOrDefault(); } - set { _autoGenerateFilter = value; } + set => _autoGenerateFilter = value; } /// @@ -297,9 +267,9 @@ namespace System.ComponentModel.DataAnnotations SR.DisplayAttribute_PropertyNotSet, "Order", "GetOrder")); } - return _order.Value; + return _order.GetValueOrDefault(); } - set { _order = value; } + set => _order = value; } #endregion @@ -330,10 +300,7 @@ namespace System.ComponentModel.DataAnnotations /// but a public static property with a name matching the value couldn't be found /// on the . /// - public string GetShortName() - { - return _shortName.GetLocalizableValue() ?? GetName(); - } + public string GetShortName() => _shortName.GetLocalizableValue() ?? GetName(); /// /// Gets the UI display string for Name. @@ -360,10 +327,7 @@ namespace System.ComponentModel.DataAnnotations /// but a public static property with a name matching the value couldn't be found /// on the . /// - public string GetName() - { - return _name.GetLocalizableValue(); - } + public string GetName() => _name.GetLocalizableValue(); /// /// Gets the UI display string for Description. @@ -386,10 +350,7 @@ namespace System.ComponentModel.DataAnnotations /// but a public static property with a name matching the value couldn't be found /// on the . /// - public string GetDescription() - { - return _description.GetLocalizableValue(); - } + public string GetDescription() => _description.GetLocalizableValue(); /// /// Gets the UI display string for Prompt. @@ -412,10 +373,7 @@ namespace System.ComponentModel.DataAnnotations /// but a public static property with a name matching the value couldn't be found /// on the . /// - public string GetPrompt() - { - return _prompt.GetLocalizableValue(); - } + public string GetPrompt() => _prompt.GetLocalizableValue(); /// /// Gets the UI display string for GroupName. @@ -438,10 +396,7 @@ namespace System.ComponentModel.DataAnnotations /// but a public static property with a name matching the value couldn't be found /// on the . /// - public string GetGroupName() - { - return _groupName.GetLocalizableValue(); - } + public string GetGroupName() => _groupName.GetLocalizableValue(); /// /// Gets the value of if it has been set, or null. @@ -452,10 +407,7 @@ namespace System.ComponentModel.DataAnnotations /// When has not been set returns null. /// /// - public bool? GetAutoGenerateField() - { - return _autoGenerateField; - } + public bool? GetAutoGenerateField() => _autoGenerateField; /// /// Gets the value of if it has been set, or null. @@ -466,10 +418,7 @@ namespace System.ComponentModel.DataAnnotations /// When has not been set returns null. /// /// - public bool? GetAutoGenerateFilter() - { - return _autoGenerateFilter; - } + public bool? GetAutoGenerateFilter() => _autoGenerateFilter; /// /// Gets the value of if it has been set, or null. @@ -485,10 +434,8 @@ namespace System.ComponentModel.DataAnnotations /// of 10000. This value allows for explicitly-ordered fields to be displayed before /// and after the fields that don't specify an order. /// - public int? GetOrder() - { - return _order; - } + public int? GetOrder() => _order; + #endregion } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayColumnAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayColumnAttribute.cs index fcf526d222..f77c27101b 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayColumnAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayColumnAttribute.cs @@ -28,10 +28,10 @@ namespace System.ComponentModel.DataAnnotations SortDescending = sortDescending; } - public string DisplayColumn { get; private set; } + public string DisplayColumn { get; } - public string SortColumn { get; private set; } + public string SortColumn { get; } - public bool SortDescending { get; private set; } + public bool SortDescending { get; } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayFormatAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayFormatAttribute.cs index 13f2be0192..37050b6980 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayFormatAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/DisplayFormatAttribute.cs @@ -44,13 +44,13 @@ namespace System.ComponentModel.DataAnnotations /// /// /// - /// The null dispay text is generally used as placeholder when the value is not specified. + /// The null display text is generally used as placeholder when the value is not specified. /// A null or empty string is legal, and consumers must allow for that. /// public string NullDisplayText { - get { return _nullDisplayText.Value; } - set { _nullDisplayText.Value = value; } + get => _nullDisplayText.Value; + set => _nullDisplayText.Value = value; } /// @@ -75,8 +75,8 @@ namespace System.ComponentModel.DataAnnotations /// public Type NullDisplayTextResourceType { - get { return _nullDisplayText.ResourceType; } - set { _nullDisplayText.ResourceType = value; } + get => _nullDisplayText.ResourceType; + set => _nullDisplayText.ResourceType = value; } /// @@ -103,9 +103,6 @@ namespace System.ComponentModel.DataAnnotations /// but a public static property with a name matching the value couldn't be found /// on the . /// - public string GetNullDisplayText() - { - return _nullDisplayText.GetLocalizableValue(); - } + public string GetNullDisplayText() => _nullDisplayText.GetLocalizableValue(); } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EditableAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EditableAttribute.cs index 8591a424cf..b9cc7eb371 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EditableAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EditableAttribute.cs @@ -42,7 +42,7 @@ namespace System.ComponentModel.DataAnnotations /// When false, the field/property is not editable. /// /// - public bool AllowEdit { get; private set; } + public bool AllowEdit { get; } /// /// Indicates whether or not the field/property allows an initial value diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EnumDataTypeAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EnumDataTypeAttribute.cs index 7af31e2dc6..425b47e8bc 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EnumDataTypeAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EnumDataTypeAttribute.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using System.Globalization; using System.Linq; -using System.Reflection; namespace System.ComponentModel.DataAnnotations { @@ -20,7 +19,7 @@ namespace System.ComponentModel.DataAnnotations EnumType = enumType; } - public Type EnumType { get; private set; } + public Type EnumType { get; } public override bool IsValid(object value) { @@ -107,16 +106,10 @@ namespace System.ComponentModel.DataAnnotations return Enum.IsDefined(EnumType, convertedValue); } - private static bool IsEnumTypeInFlagsMode(Type enumType) - { - return enumType.GetCustomAttributes(typeof(FlagsAttribute), false).Any(); - } + private static bool IsEnumTypeInFlagsMode(Type enumType) => + enumType.GetCustomAttributes(typeof(FlagsAttribute), false).Any(); - - private static string GetUnderlyingTypeValueString(Type enumType, object enumValue) - { - return - Convert.ChangeType(enumValue, Enum.GetUnderlyingType(enumType), CultureInfo.InvariantCulture).ToString(); - } + private static string GetUnderlyingTypeValueString(Type enumType, object enumValue) => + Convert.ChangeType(enumValue, Enum.GetUnderlyingType(enumType), CultureInfo.InvariantCulture).ToString(); } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FileExtensionsAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FileExtensionsAttribute.cs index 7eb04acd04..1fedd9df43 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FileExtensionsAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FileExtensionsAttribute.cs @@ -25,34 +25,23 @@ namespace System.ComponentModel.DataAnnotations public string Extensions { - get - { - // Default file extensions match those from jquery validate. - return string.IsNullOrWhiteSpace(_extensions) ? "png,jpg,jpeg,gif" : _extensions; - } - set { _extensions = value; } + // Default file extensions match those from jquery validate. + get => string.IsNullOrWhiteSpace(_extensions) ? "png,jpg,jpeg,gif" : _extensions; + set => _extensions = value; } - private string ExtensionsFormatted - { - get { return ExtensionsParsed.Aggregate((left, right) => left + ", " + right); } - } + private string ExtensionsFormatted => ExtensionsParsed.Aggregate((left, right) => left + ", " + right); - - private string ExtensionsNormalized - { - get { return Extensions.Replace(" ", string.Empty).Replace(".", string.Empty).ToLowerInvariant(); } - } + private string ExtensionsNormalized => + Extensions.Replace(" ", string.Empty).Replace(".", string.Empty).ToLowerInvariant(); private IEnumerable ExtensionsParsed { get { return ExtensionsNormalized.Split(',').Select(e => "." + e); } } - public override string FormatErrorMessage(string name) - { - return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, ExtensionsFormatted); - } + public override string FormatErrorMessage(string name) => + string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, ExtensionsFormatted); public override bool IsValid(object value) { diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FilterUIHintAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FilterUIHintAttribute.cs index 9e22888639..e080c2a4e4 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FilterUIHintAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/FilterUIHintAttribute.cs @@ -13,44 +13,26 @@ namespace System.ComponentModel.DataAnnotations [Obsolete("This attribute is no longer in use and will be ignored if applied.")] public sealed class FilterUIHintAttribute : Attribute { - private UIHintAttribute.UIHintImplementation _implementation; + private readonly UIHintAttribute.UIHintImplementation _implementation; /// /// Gets the name of the control that is most appropriate for this associated /// property or field /// - public string FilterUIHint - { - get - { - return this._implementation.UIHint; - } - } + public string FilterUIHint => _implementation.UIHint; /// /// Gets the name of the presentation layer that supports the control type /// in /// - public string PresentationLayer - { - get - { - return this._implementation.PresentationLayer; - } - } + public string PresentationLayer => _implementation.PresentationLayer; /// /// Gets the name-value pairs used as parameters to the control's constructor /// /// is thrown if the current attribute /// is ill-formed. - public IDictionary ControlParameters - { - get - { - return this._implementation.ControlParameters; - } - } + public IDictionary ControlParameters => _implementation.ControlParameters; /// /// Constructor that accepts the name of the control, without specifying @@ -84,7 +66,7 @@ namespace System.ComponentModel.DataAnnotations public FilterUIHintAttribute(string filterUIHint, string presentationLayer, params object[] controlParameters) { - this._implementation = new UIHintAttribute.UIHintImplementation( + _implementation = new UIHintAttribute.UIHintImplementation( filterUIHint, presentationLayer, controlParameters); } @@ -92,10 +74,7 @@ namespace System.ComponentModel.DataAnnotations /// Returns the hash code for this FilterUIHintAttribute. /// /// A 32-bit signed integer hash code. - public override int GetHashCode() - { - return this._implementation.GetHashCode(); - } + public override int GetHashCode() => _implementation.GetHashCode(); /// /// Determines whether this instance of FilterUIHintAttribute and a specified object, @@ -112,7 +91,7 @@ namespace System.ComponentModel.DataAnnotations return false; } - return this._implementation.Equals(otherAttribute._implementation); + return _implementation.Equals(otherAttribute._implementation); } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/LocalizableString.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/LocalizableString.cs index 82d8316d30..8ad0ba8256 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/LocalizableString.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/LocalizableString.cs @@ -49,7 +49,7 @@ namespace System.ComponentModel.DataAnnotations /// public string Value { - get { return _propertyValue; } + get => _propertyValue; set { if (_propertyValue != value) @@ -65,7 +65,7 @@ namespace System.ComponentModel.DataAnnotations /// public Type ResourceType { - get { return _resourceType; } + get => _resourceType; set { if (_resourceType != value) diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MaxLengthAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MaxLengthAttribute.cs index 199e9e596a..6f213d18b6 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MaxLengthAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MaxLengthAttribute.cs @@ -3,7 +3,9 @@ // See the LICENSE file in the project root for more information. using System.Collections; +using System.Diagnostics; using System.Globalization; +using System.Reflection; namespace System.ComponentModel.DataAnnotations { @@ -42,12 +44,9 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the maximum allowable length of the collection/string data. /// - public int Length { get; private set; } + public int Length { get; } - private static string DefaultErrorMessageString - { - get { return SR.MaxLengthAttribute_ValidationError; } - } + private static string DefaultErrorMessageString => SR.MaxLengthAttribute_ValidationError; /// /// Determines whether a specified object is valid. (Overrides ) @@ -76,16 +75,13 @@ namespace System.ComponentModel.DataAnnotations { length = str.Length; } + else if (CountPropertyHelper.TryGetCount(value, out var count)) + { + length = count; + } else { - if (value is ICollection collection) - { - length = collection.Count; - } - else - { - throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType())); - } + throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType())); } return MaxAllowableLength == Length || length <= Length; @@ -96,11 +92,9 @@ namespace System.ComponentModel.DataAnnotations /// /// The name to include in the formatted string. /// A localized string to describe the maximum acceptable length. - public override string FormatErrorMessage(string name) - { + public override string FormatErrorMessage(string name) => // An error occurred, so we know the value is greater than the maximum if it was specified - return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, Length); - } + string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, Length); /// /// Checks that Length has a legal value. @@ -115,4 +109,28 @@ namespace System.ComponentModel.DataAnnotations } } } + + internal static class CountPropertyHelper + { + public static bool TryGetCount(object value, out int count) + { + Debug.Assert(value != null); + + if (value is ICollection collection) + { + count = collection.Count; + return true; + } + + PropertyInfo property = value.GetType().GetRuntimeProperty("Count"); + if (property != null && property.CanRead && property.PropertyType == typeof(int)) + { + count = (int)property.GetValue(value); + return true; + } + + count = -1; + return false; + } + } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MinLengthAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MinLengthAttribute.cs index 44109fa21b..e27c376aa0 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MinLengthAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/MinLengthAttribute.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections; using System.Globalization; namespace System.ComponentModel.DataAnnotations @@ -30,7 +29,7 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the minimum allowable length of the collection/string data. /// - public int Length { get; private set; } + public int Length { get; } /// /// Determines whether a specified object is valid. (Overrides ) @@ -60,16 +59,13 @@ namespace System.ComponentModel.DataAnnotations { length = str.Length; } + else if (CountPropertyHelper.TryGetCount(value, out var count)) + { + length = count; + } else { - if (value is ICollection collection) - { - length = collection.Count; - } - else - { - throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType())); - } + throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType())); } return length >= Length; @@ -80,11 +76,9 @@ namespace System.ComponentModel.DataAnnotations /// /// The name to include in the formatted string. /// A localized string to describe the minimum acceptable length. - public override string FormatErrorMessage(string name) - { + public override string FormatErrorMessage(string name) => // An error occurred, so we know the value is less than the minimum - return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, Length); - } + string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name, Length); /// /// Checks that Length has a legal value. diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RangeAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RangeAttribute.cs index 1d9f9c0c36..d24b6a262a 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RangeAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RangeAttribute.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Globalization; -using System.Reflection; namespace System.ComponentModel.DataAnnotations { @@ -69,7 +68,7 @@ namespace System.ComponentModel.DataAnnotations /// Gets the type of the and values (e.g. Int32, Double, or some custom /// type) /// - public Type OperandType { get; private set; } + public Type OperandType { get; } private Func Conversion { get; set; } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RegularExpressionAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RegularExpressionAttribute.cs index 479d010903..15883c3960 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RegularExpressionAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/RegularExpressionAttribute.cs @@ -34,7 +34,7 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the regular expression pattern to use /// - public string Pattern { get; private set; } + public string Pattern { get; } private Regex Regex { get; set; } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ScaffoldColumnAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ScaffoldColumnAttribute.cs index b476242c1d..c3ecbe3cfc 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ScaffoldColumnAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ScaffoldColumnAttribute.cs @@ -12,6 +12,6 @@ namespace System.ComponentModel.DataAnnotations Scaffold = scaffold; } - public bool Scaffold { get; private set; } + public bool Scaffold { get; } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ColumnAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ColumnAttribute.cs index c554af5484..8e9d0e4dfa 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ColumnAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ColumnAttribute.cs @@ -12,7 +12,6 @@ namespace System.ComponentModel.DataAnnotations.Schema [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public class ColumnAttribute : Attribute { - private readonly string _name; private int _order = -1; private string _typeName; @@ -35,23 +34,20 @@ namespace System.ComponentModel.DataAnnotations.Schema SR.ArgumentIsNullOrWhitespace, nameof(name))); } - _name = name; + Name = name; } /// /// The name of the column the property is mapped to. /// - public string Name - { - get { return _name; } - } + public string Name { get; } /// /// The zero-based order of the column the property is mapped to. /// public int Order { - get { return _order; } + get => _order; set { if (value < 0) @@ -68,7 +64,7 @@ namespace System.ComponentModel.DataAnnotations.Schema /// public string TypeName { - get { return _typeName; } + get => _typeName; set { if (string.IsNullOrWhiteSpace(value)) diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/DatabaseGeneratedAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/DatabaseGeneratedAttribute.cs index 8100910987..7f45f2b0e7 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/DatabaseGeneratedAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/DatabaseGeneratedAttribute.cs @@ -27,6 +27,6 @@ namespace System.ComponentModel.DataAnnotations.Schema /// /// The pattern used to generate values for the property in the database. /// - public DatabaseGeneratedOption DatabaseGeneratedOption { get; private set; } + public DatabaseGeneratedOption DatabaseGeneratedOption { get; } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ForeignKeyAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ForeignKeyAttribute.cs index abb5176d7a..fad15304ad 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ForeignKeyAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/ForeignKeyAttribute.cs @@ -14,8 +14,6 @@ namespace System.ComponentModel.DataAnnotations.Schema [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public class ForeignKeyAttribute : Attribute { - private readonly string _name; - /// /// Initializes a new instance of the class. /// @@ -32,16 +30,13 @@ namespace System.ComponentModel.DataAnnotations.Schema SR.ArgumentIsNullOrWhitespace, nameof(name))); } - _name = name; + Name = name; } /// /// If placed on a foreign key property, the name of the associated navigation property. /// If placed on a navigation property, the name of the associated foreign key(s). /// - public string Name - { - get { return _name; } - } + public string Name { get; } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/InversePropertyAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/InversePropertyAttribute.cs index ac067db16d..b8b39d3944 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/InversePropertyAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/InversePropertyAttribute.cs @@ -12,8 +12,6 @@ namespace System.ComponentModel.DataAnnotations.Schema [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] public class InversePropertyAttribute : Attribute { - private readonly string _property; - /// /// Initializes a new instance of the class. /// @@ -25,15 +23,13 @@ namespace System.ComponentModel.DataAnnotations.Schema throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.ArgumentIsNullOrWhitespace, nameof(property))); } - _property = property; + + Property = property; } /// /// The navigation property representing the other end of the same relationship. /// - public string Property - { - get { return _property; } - } + public string Property { get; } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/TableAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/TableAttribute.cs index f7add7eb87..31133ad398 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/TableAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Schema/TableAttribute.cs @@ -12,7 +12,6 @@ namespace System.ComponentModel.DataAnnotations.Schema [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class TableAttribute : Attribute { - private readonly string _name; private string _schema; /// @@ -26,23 +25,21 @@ namespace System.ComponentModel.DataAnnotations.Schema throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.ArgumentIsNullOrWhitespace, nameof(name))); } - _name = name; + + Name = name; } /// /// The name of the table the class is mapped to. /// - public string Name - { - get { return _name; } - } + public string Name { get; } /// /// The schema of the table the class is mapped to. /// public string Schema { - get { return _schema; } + get => _schema; set { if (string.IsNullOrWhiteSpace(value)) @@ -50,6 +47,7 @@ namespace System.ComponentModel.DataAnnotations.Schema throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.ArgumentIsNullOrWhitespace, nameof(value))); } + _schema = value; } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/StringLengthAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/StringLengthAttribute.cs index 9640fe1e2c..2360617175 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/StringLengthAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/StringLengthAttribute.cs @@ -26,7 +26,7 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the maximum acceptable length of the string /// - public int MaximumLength { get; private set; } + public int MaximumLength { get; } /// /// Gets or sets the minimum acceptable length of the string diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/UIHintAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/UIHintAttribute.cs index 9f1077f079..befa796bc4 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/UIHintAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/UIHintAttribute.cs @@ -51,32 +51,20 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the name of the control that is most appropriate for this associated property or field /// - public string UIHint - { - get { return _implementation.UIHint; } - } + public string UIHint => _implementation.UIHint; /// /// Gets the name of the presentation layer that supports the control type in /// - public string PresentationLayer - { - get { return _implementation.PresentationLayer; } - } + public string PresentationLayer => _implementation.PresentationLayer; /// /// Gets the name-value pairs used as parameters to the control's constructor /// /// is thrown if the current attribute is ill-formed. - public IDictionary ControlParameters - { - get { return _implementation.ControlParameters; } - } + public IDictionary ControlParameters => _implementation.ControlParameters; - public override int GetHashCode() - { - return _implementation.GetHashCode(); - } + public override int GetHashCode() => _implementation.GetHashCode(); public override bool Equals(object obj) { @@ -107,12 +95,12 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the name of the control that is most appropriate for this associated property or field /// - public string UIHint { get; private set; } + public string UIHint { get; } /// /// Gets the name of the presentation layer that supports the control type in /// - public string PresentationLayer { get; private set; } + public string PresentationLayer { get; } public IDictionary ControlParameters { diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttribute.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttribute.cs index 3b3cb32055..75eef3cdad 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttribute.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Globalization; -using System.Linq; using System.Reflection; namespace System.ComponentModel.DataAnnotations @@ -116,10 +115,7 @@ namespace System.ComponentModel.DataAnnotations /// to perform validation. /// Base class returns false. Override in child classes as appropriate. /// - public virtual bool RequiresValidationContext - { - get { return false; } - } + public virtual bool RequiresValidationContext => false; #endregion @@ -134,12 +130,9 @@ namespace System.ComponentModel.DataAnnotations /// public string ErrorMessage { - get - { - // If _errorMessage is not set, return the default. This is done to preserve - // behavior prior to the fix where ErrorMessage showed the non-null message to use. - return _errorMessage ?? _defaultErrorMessage; - } + // If _errorMessage is not set, return the default. This is done to preserve + // behavior prior to the fix where ErrorMessage showed the non-null message to use. + get => _errorMessage ?? _defaultErrorMessage; set { _errorMessage = value; @@ -164,7 +157,7 @@ namespace System.ComponentModel.DataAnnotations /// public string ErrorMessageResourceName { - get { return _errorMessageResourceName; } + get => _errorMessageResourceName; set { _errorMessageResourceName = value; @@ -185,7 +178,7 @@ namespace System.ComponentModel.DataAnnotations /// public Type ErrorMessageResourceType { - get { return _errorMessageResourceType; } + get => _errorMessageResourceType; set { _errorMessageResourceType = value; @@ -316,10 +309,8 @@ namespace System.ComponentModel.DataAnnotations /// The user-visible name to include in the formatted message. /// The localized string describing the validation error /// is thrown if the current attribute is malformed. - public virtual string FormatErrorMessage(string name) - { - return string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name); - } + public virtual string FormatErrorMessage(string name) => + string.Format(CultureInfo.CurrentCulture, ErrorMessageString, name); /// /// Gets the value indicating whether or not the specified is valid diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs index 06f2a34919..5f41a1ccdf 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs @@ -20,16 +20,12 @@ namespace System.ComponentModel.DataAnnotations /// internal class ValidationAttributeStore { - private static readonly ValidationAttributeStore _singleton = new ValidationAttributeStore(); private readonly Dictionary _typeStoreItems = new Dictionary(); /// /// Gets the singleton /// - internal static ValidationAttributeStore Instance - { - get { return _singleton; } - } + internal static ValidationAttributeStore Instance { get; } = new ValidationAttributeStore(); /// /// Retrieves the type level validation attributes for the given type. @@ -144,35 +140,26 @@ namespace System.ComponentModel.DataAnnotations } } - internal static bool IsPublic(PropertyInfo p) - { - return (p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic); - } + internal static bool IsPublic(PropertyInfo p) => + (p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic); - internal static bool IsStatic(PropertyInfo p) - { - return (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic); - } + internal static bool IsStatic(PropertyInfo p) => + (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic); /// /// Private abstract class for all store items /// private abstract class StoreItem { - private readonly IEnumerable _validationAttributes; - internal StoreItem(IEnumerable attributes) { - _validationAttributes = attributes.OfType(); + ValidationAttributes = attributes.OfType(); DisplayAttribute = attributes.OfType().SingleOrDefault(); } - internal IEnumerable ValidationAttributes - { - get { return _validationAttributes; } - } + internal IEnumerable ValidationAttributes { get; } - internal DisplayAttribute DisplayAttribute { get; set; } + internal DisplayAttribute DisplayAttribute { get; } } /// @@ -248,19 +235,14 @@ nameof(propertyName)); /// private class PropertyStoreItem : StoreItem { - private readonly Type _propertyType; - internal PropertyStoreItem(Type propertyType, IEnumerable attributes) : base(attributes) { Debug.Assert(propertyType != null); - _propertyType = propertyType; + PropertyType = propertyType; } - internal Type PropertyType - { - get { return _propertyType; } - } + internal Type PropertyType { get; } } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs index 57714f55fa..fd5a0b5930 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationContext.cs @@ -30,9 +30,7 @@ namespace System.ComponentModel.DataAnnotations #region Member Fields private readonly Dictionary _items; - private readonly object _objectInstance; private string _displayName; - private string _memberName; private Func _serviceProvider; #endregion @@ -102,7 +100,7 @@ namespace System.ComponentModel.DataAnnotations _items = new Dictionary(); } - _objectInstance = instance; + ObjectInstance = instance; } #endregion @@ -119,18 +117,12 @@ namespace System.ComponentModel.DataAnnotations /// For example, the property being validated, as well as other properties on the instance might not have been /// updated to their new values. /// - public object ObjectInstance - { - get { return _objectInstance; } - } + public object ObjectInstance { get; } /// /// Gets the type of the object being validated. It will not be null. /// - public Type ObjectType - { - get { return ObjectInstance.GetType(); } - } + public Type ObjectType => ObjectInstance.GetType(); /// /// Gets or sets the user-visible name of the type or property being validated. @@ -172,11 +164,7 @@ namespace System.ComponentModel.DataAnnotations /// This name reflects the API name of the member being validated, not a localized name. It should be set /// only for property or parameter contexts. /// - public string MemberName - { - get { return _memberName; } - set { _memberName = value; } - } + public string MemberName { get; set; } /// /// Gets the dictionary of key/value pairs associated with this context. @@ -185,10 +173,7 @@ namespace System.ComponentModel.DataAnnotations /// This property will never be null, but the dictionary may be empty. Changes made /// to items in this dictionary will never affect the original dictionary specified in the constructor. /// - public IDictionary Items - { - get { return _items; } - } + public IDictionary Items => _items; #endregion @@ -204,7 +189,7 @@ namespace System.ComponentModel.DataAnnotations ValidationAttributeStore store = ValidationAttributeStore.Instance; DisplayAttribute displayAttribute = null; - if (string.IsNullOrEmpty(_memberName)) + if (string.IsNullOrEmpty(MemberName)) { displayAttribute = store.GetTypeDisplayAttribute(this); } @@ -244,15 +229,8 @@ namespace System.ComponentModel.DataAnnotations /// /// The type of the service needed. /// An instance of that service or null if it is not available. - public object GetService(Type serviceType) - { - if (_serviceProvider != null) - { - return _serviceProvider(serviceType); - } + public object GetService(Type serviceType) => _serviceProvider?.Invoke(serviceType); - return null; - } #endregion } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs index e8dd66bc4b..0ae7ccfe7b 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs @@ -84,7 +84,7 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the ValidationAttribute instance that triggered this exception. /// - public ValidationAttribute ValidationAttribute { get; private set; } + public ValidationAttribute ValidationAttribute { get; } /// /// Gets the instance that describes the validation error. @@ -107,6 +107,6 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the value that caused the validating attribute to trigger the exception /// - public object Value { get; private set; } + public object Value { get; } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationResult.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationResult.cs index 6521f60caa..7a74fc512c 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationResult.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationResult.cs @@ -26,9 +26,6 @@ namespace System.ComponentModel.DataAnnotations /// public static readonly ValidationResult Success; - private readonly IEnumerable _memberNames; - private string _errorMessage; - #endregion #region All Constructors @@ -60,8 +57,8 @@ namespace System.ComponentModel.DataAnnotations /// public ValidationResult(string errorMessage, IEnumerable memberNames) { - _errorMessage = errorMessage; - _memberNames = memberNames ?? Array.Empty(); + ErrorMessage = errorMessage; + MemberNames = memberNames ?? Array.Empty(); } /// @@ -76,8 +73,8 @@ namespace System.ComponentModel.DataAnnotations throw new ArgumentNullException(nameof(validationResult)); } - _errorMessage = validationResult._errorMessage; - _memberNames = validationResult._memberNames; + ErrorMessage = validationResult.ErrorMessage; + MemberNames = validationResult.MemberNames; } #endregion @@ -87,19 +84,12 @@ namespace System.ComponentModel.DataAnnotations /// /// Gets the collection of member names affected by this result. The collection may be empty but will never be null. /// - public IEnumerable MemberNames - { - get { return _memberNames; } - } + public IEnumerable MemberNames { get; } /// /// Gets the error message for this result. It may be null. /// - public string ErrorMessage - { - get { return _errorMessage; } - set { _errorMessage = value; } - } + public string ErrorMessage { get; set; } #endregion @@ -118,10 +108,7 @@ namespace System.ComponentModel.DataAnnotations /// The property value if specified, /// otherwise, the base result. /// - public override string ToString() - { - return ErrorMessage ?? base.ToString(); - } + public override string ToString() => ErrorMessage ?? base.ToString(); #endregion Methods } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Validator.cs b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Validator.cs index 9040ffe6c9..1fdd87d466 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Validator.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/Validator.cs @@ -64,10 +64,7 @@ namespace System.ComponentModel.DataAnnotations { result = false; - if (validationResults != null) - { - validationResults.Add(err.ValidationResult); - } + validationResults?.Add(err.ValidationResult); } return result; @@ -95,11 +92,9 @@ namespace System.ComponentModel.DataAnnotations /// When doesn't match the /// on . /// - public static bool TryValidateObject(object instance, ValidationContext validationContext, - ICollection validationResults) - { - return TryValidateObject(instance, validationContext, validationResults, false /*validateAllProperties*/); - } + public static bool TryValidateObject( + object instance, ValidationContext validationContext, ICollection validationResults) => + TryValidateObject(instance, validationContext, validationResults, false /*validateAllProperties*/); /// /// Tests whether the given object instance is valid. @@ -157,10 +152,7 @@ namespace System.ComponentModel.DataAnnotations { result = false; - if (validationResults != null) - { - validationResults.Add(err.ValidationResult); - } + validationResults?.Add(err.ValidationResult); } return result; @@ -207,10 +199,7 @@ namespace System.ComponentModel.DataAnnotations { result = false; - if (validationResults != null) - { - validationResults.Add(err.ValidationResult); - } + validationResults?.Add(err.ValidationResult); } return result; @@ -234,11 +223,8 @@ namespace System.ComponentModel.DataAnnotations var attributes = _store.GetPropertyValidationAttributes(validationContext); - var err = GetValidationErrors(value, validationContext, attributes, false).FirstOrDefault(); - if (err != null) - { - err.ThrowValidationException(); - } + GetValidationErrors(value, validationContext, attributes, false).FirstOrDefault() + ?.ThrowValidationException(); } /// @@ -301,12 +287,7 @@ namespace System.ComponentModel.DataAnnotations SR.Validator_InstanceMustMatchValidationContextInstance, nameof(instance)); } - var err = - GetObjectValidationErrors(instance, validationContext, validateAllProperties, false).FirstOrDefault(); - if (err != null) - { - err.ThrowValidationException(); - } + GetObjectValidationErrors(instance, validationContext, validateAllProperties, false).FirstOrDefault()?.ThrowValidationException(); } /// @@ -334,12 +315,7 @@ namespace System.ComponentModel.DataAnnotations throw new ArgumentNullException(nameof(validationContext)); } - var err = - GetValidationErrors(value, validationContext, validationAttributes, false).FirstOrDefault(); - if (err != null) - { - err.ThrowValidationException(); - } + GetValidationErrors(value, validationContext, validationAttributes, false).FirstOrDefault()?.ThrowValidationException(); } /// @@ -650,11 +626,11 @@ nameof(value)); Value = value; } - internal object Value { get; set; } + internal object Value { get; } - internal ValidationAttribute ValidationAttribute { get; set; } + internal ValidationAttribute ValidationAttribute { get; } - internal ValidationResult ValidationResult { get; set; } + internal ValidationResult ValidationResult { get; } internal Exception ThrowValidationException() => throw new ValidationException(ValidationResult, ValidationAttribute, Value); } diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs b/external/corefx/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs index 58c294b98e..c2e74b25df 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/MaxLengthAttributeTests.cs @@ -5,6 +5,7 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using Xunit; namespace System.ComponentModel.DataAnnotations.Tests @@ -30,9 +31,23 @@ namespace System.ComponentModel.DataAnnotations.Tests yield return new object[] { new MaxLengthAttribute(-1), new Collection(new int[20]) }; yield return new object[] { new MaxLengthAttribute(15), new Collection(new string[14]) }; yield return new object[] { new MaxLengthAttribute(16), new Collection(new string[16]) }; + yield return new object[] { new MaxLengthAttribute(-1), new List(new int[20]) }; yield return new object[] { new MaxLengthAttribute(15), new List(new string[14]) }; yield return new object[] { new MaxLengthAttribute(16), new List(new string[16]) }; + + //ICollection but not ICollection + yield return new object[] { new MaxLengthAttribute(-1), new HashSet(Enumerable.Range(1, 20)) }; + yield return new object[] { new MaxLengthAttribute(15), new HashSet(Enumerable.Range(1, 14).Select(i => i.ToString())) }; + yield return new object[] { new MaxLengthAttribute(16), new HashSet(Enumerable.Range(1, 16).Select(i => i.ToString())) }; + + //ICollection but not ICollection + yield return new object[] { new MaxLengthAttribute(-1), new ArrayList(new int[20]) }; + yield return new object[] { new MaxLengthAttribute(15), new ArrayList(new string[14]) }; + yield return new object[] { new MaxLengthAttribute(16), new ArrayList(new string[16]) }; + + //Multi ICollection + yield return new object[] { new MaxLengthAttribute(1), new MultiCollection() }; } protected override IEnumerable InvalidValues() @@ -47,6 +62,7 @@ namespace System.ComponentModel.DataAnnotations.Tests { yield return new object[] { new MaxLengthAttribute(12), new Collection(new byte[13]) }; yield return new object[] { new MaxLengthAttribute(12), new List(new byte[13]) }; + yield return new object[] { new MaxLengthAttribute(12), new HashSet(Enumerable.Range(1, 13)) }; } [Fact] @@ -109,22 +125,36 @@ namespace System.ComponentModel.DataAnnotations.Tests } [Fact] - public static void GetValidationResult_ValueGenericICollection_ThrowsInvalidCastException() + public static void GetValidationResult_ValueGenericIEnumerable_ThrowsInvalidCastException() { - Assert.Throws(() => new MaxLengthAttribute().GetValidationResult(new GenericICollectionClass(), new ValidationContext(new object()))); + Assert.Throws(() => new MaxLengthAttribute().GetValidationResult(new GenericIEnumerableClass(), new ValidationContext(new object()))); } } - class GenericICollectionClass : ICollection + class GenericIEnumerableClass : IEnumerable { - public int Count { get; set; } - public bool IsReadOnly => false; - public void Add(int item) { } - public void Clear() { } - public bool Contains(int item) => false; - public void CopyTo(int[] array, int arrayIndex) { } - public IEnumerator GetEnumerator() => new List(new int[Count]).GetEnumerator(); - public bool Remove(int item) => false; - IEnumerator IEnumerable.GetEnumerator() => new List(new int[Count]).GetEnumerator(); + public IEnumerator GetEnumerator() => Enumerable.Empty().GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } + + public class MultiCollection : Collection, ICollection, ICollection + { + int ICollection.Count => 0; + int ICollection.Count => 0; + bool ICollection.IsReadOnly => throw new NotSupportedException(); + bool ICollection.IsReadOnly => throw new NotSupportedException(); + void ICollection.Add(int item) => throw new NotSupportedException(); + void ICollection.Add(uint item) => throw new NotSupportedException(); + void ICollection.Clear() => throw new NotSupportedException(); + void ICollection.Clear() => throw new NotSupportedException(); + bool ICollection.Contains(int item) => throw new NotSupportedException(); + bool ICollection.Contains(uint item) => throw new NotSupportedException(); + void ICollection.CopyTo(int[] array, int arrayIndex) => throw new NotSupportedException(); + void ICollection.CopyTo(uint[] array, int arrayIndex) => throw new NotSupportedException(); + IEnumerator IEnumerable.GetEnumerator() => throw new NotSupportedException(); + IEnumerator IEnumerable.GetEnumerator() => throw new NotSupportedException(); + IEnumerator IEnumerable.GetEnumerator() => throw new NotSupportedException(); + bool ICollection.Remove(int item) => throw new NotSupportedException(); + bool ICollection.Remove(uint item) => throw new NotSupportedException(); } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs b/external/corefx/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs index 5f9fafe76b..75983fc058 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/MinLengthAttributeTests.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using Xunit; namespace System.ComponentModel.DataAnnotations.Tests @@ -31,6 +33,19 @@ namespace System.ComponentModel.DataAnnotations.Tests yield return new object[] { new MinLengthAttribute(0), new List(new int[0]) }; yield return new object[] { new MinLengthAttribute(12), new List(new int[14]) }; yield return new object[] { new MinLengthAttribute(16), new List(new string[16]) }; + + //ICollection but not ICollection + yield return new object[] { new MinLengthAttribute(0), new HashSet() }; + yield return new object[] { new MinLengthAttribute(12), new HashSet(Enumerable.Range(1, 14)) }; + yield return new object[] { new MinLengthAttribute(16), new HashSet(Enumerable.Range(1, 16).Select(i => i.ToString())) }; + + //ICollection but not ICollection + yield return new object[] { new MinLengthAttribute(0), new ArrayList(new int[0]) }; + yield return new object[] { new MinLengthAttribute(12), new ArrayList(new int[14]) }; + yield return new object[] { new MinLengthAttribute(16), new ArrayList(new string[16]) }; + + //Multi ICollection + yield return new object[] { new MinLengthAttribute(0), new MultiCollection() }; } protected override IEnumerable InvalidValues() @@ -98,9 +113,9 @@ namespace System.ComponentModel.DataAnnotations.Tests } [Fact] - public static void GetValidationResult_ValueGenericICollection_ThrowsInvalidCastException() + public static void GetValidationResult_ValueGenericIEnumerable_ThrowsInvalidCastException() { - Assert.Throws(() => new MinLengthAttribute(0).GetValidationResult(new GenericICollectionClass(), new ValidationContext(new object()))); + Assert.Throws(() => new MinLengthAttribute(0).GetValidationResult(new GenericIEnumerableClass(), new ValidationContext(new object()))); } } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/ColumnAttributeTests.cs b/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/ColumnAttributeTests.cs index 155557ce19..8087619eef 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/ColumnAttributeTests.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/ColumnAttributeTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using Xunit; namespace System.ComponentModel.DataAnnotations.Schema.Tests diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/DatabaseGeneratedAttributeTests.cs b/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/DatabaseGeneratedAttributeTests.cs index 8992115877..6f42ed5d3a 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/DatabaseGeneratedAttributeTests.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/Schema/DatabaseGeneratedAttributeTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using Xunit; namespace System.ComponentModel.DataAnnotations.Schema.Tests diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/System.ComponentModel.Annotations.Tests.csproj b/external/corefx/src/System.ComponentModel.Annotations/tests/System.ComponentModel.Annotations.Tests.csproj index d2ac137f99..b938a63a15 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/System.ComponentModel.Annotations.Tests.csproj +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/System.ComponentModel.Annotations.Tests.csproj @@ -10,6 +10,9 @@ + + Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs + @@ -45,9 +48,6 @@ - - Common\System\PlatformDetection.cs - - \ No newline at end of file + diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/ValidationExceptionTests.cs b/external/corefx/src/System.ComponentModel.Annotations/tests/ValidationExceptionTests.cs index 7fa6a2b29e..5d7a82cac5 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/ValidationExceptionTests.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/ValidationExceptionTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Runtime.Serialization.Formatters.Tests; using Xunit; namespace System.ComponentModel.DataAnnotations.Tests @@ -78,5 +79,13 @@ namespace System.ComponentModel.DataAnnotations.Tests Assert.Same(validatingAttribute, ex.ValidationAttribute); Assert.Same(value, ex.Value); } + + + [Fact] + public void AssertExceptionDeserializationFails() + { + BinaryFormatterHelpers.AssertExceptionDeserializationFails(); + } + } } diff --git a/external/corefx/src/System.ComponentModel.Annotations/tests/ValidatorTests.cs b/external/corefx/src/System.ComponentModel.Annotations/tests/ValidatorTests.cs index fc97235652..1d92d1db46 100644 --- a/external/corefx/src/System.ComponentModel.Annotations/tests/ValidatorTests.cs +++ b/external/corefx/src/System.ComponentModel.Annotations/tests/ValidatorTests.cs @@ -72,6 +72,27 @@ namespace System.ComponentModel.DataAnnotations.Tests Assert.Equal("ValidValueStringPropertyAttribute.IsValid failed for value Invalid Value", validationResults[0].ErrorMessage); } + [Fact] + public static void TryValidateObject_collection_can_have_multiple_results() + { + HasDoubleFailureProperty objectToBeValidated = new HasDoubleFailureProperty(); + ValidationContext validationContext = new ValidationContext(objectToBeValidated); + List results = new List(); + Assert.False(Validator.TryValidateObject(objectToBeValidated, validationContext, results, true)); + Assert.Equal(2, results.Count); + } + + + [Fact] + public static void TryValidateObject_collection_can_have_multiple_results_from_type_attributes() + { + DoublyInvalid objectToBeValidated = new DoublyInvalid(); + ValidationContext validationContext = new ValidationContext(objectToBeValidated); + List results = new List(); + Assert.False(Validator.TryValidateObject(objectToBeValidated, validationContext, results, true)); + Assert.Equal(2, results.Count); + } + // TryValidateObject_returns_true_if_validateAllProperties_is_false_and_Required_test_passes_even_if_there_are_other_errors() [Fact] public static void TestTryValidateObjectSuccessEvenWithOtherErrors() @@ -429,6 +450,16 @@ namespace System.ComponentModel.DataAnnotations.Tests // cannot check error message - not defined on ret builds } + [Fact] + public static void TryValidateProperty_collection_can_have_multiple_results() + { + ValidationContext validationContext = new ValidationContext(new HasDoubleFailureProperty()); + validationContext.MemberName = nameof(HasDoubleFailureProperty.WillAlwaysFailTwice); + List results = new List(); + Assert.False(Validator.TryValidateProperty("Nope", validationContext, results)); + Assert.Equal(2, results.Count); + } + [Fact] public static void TryValidateProperty_returns_true_if_all_attributes_are_valid() { @@ -635,6 +666,19 @@ namespace System.ComponentModel.DataAnnotations.Tests Assert.Equal("ValidValueStringPropertyAttribute.IsValid failed for value Invalid Value", validationResults[0].ErrorMessage); } + [Fact] + public static void TryValidateValue_collection_can_have_multiple_results() + { + ValidationContext validationContext = new ValidationContext(new HasDoubleFailureProperty()); + validationContext.MemberName = nameof(HasDoubleFailureProperty.WillAlwaysFailTwice); + ValidationAttribute[] attributesToValidate = + {new ValidValueStringPropertyAttribute(), new ValidValueStringPropertyDuplicateAttribute()}; + + List results = new List(); + Assert.False(Validator.TryValidateValue("Not Valid", validationContext, results, attributesToValidate)); + Assert.Equal(2, results.Count); + } + [Fact] public static void TryValidateValue_returns_true_if_Property_has_RequiredAttribute_and_value_is_valid() { @@ -779,12 +823,28 @@ namespace System.ComponentModel.DataAnnotations.Tests } } + // Allows easy testing that multiple failures can be reported + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] + public class ValidValueStringPropertyDuplicateAttribute : ValidationAttribute + { + protected override ValidationResult IsValid(object value, ValidationContext _) + { + if (value == null) + { return ValidationResult.Success; } + var valueAsString = value as string; + if ("Valid Value".Equals(valueAsString)) + { return ValidationResult.Success; } + return new ValidationResult("ValidValueStringPropertyAttribute.IsValid failed for value " + value); + } + } + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class ValidClassAttribute : ValidationAttribute { protected override ValidationResult IsValid(object value, ValidationContext _) { - if (value == null) { return ValidationResult.Success; } + if (value == null) + { return ValidationResult.Success; } if (value.GetType().Name.ToLowerInvariant().Contains("invalid")) { return new ValidationResult("ValidClassAttribute.IsValid failed for class of type " + value.GetType().FullName); @@ -793,6 +853,32 @@ namespace System.ComponentModel.DataAnnotations.Tests } } + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] + public class ValidClassDuplicateAttribute : ValidationAttribute + { + protected override ValidationResult IsValid(object value, ValidationContext _) + { + if (value == null) + { return ValidationResult.Success; } + if (value.GetType().Name.ToLowerInvariant().Contains("invalid")) + { + return new ValidationResult("ValidClassAttribute.IsValid failed for class of type " + value.GetType().FullName); + } + return ValidationResult.Success; + } + } + + public class HasDoubleFailureProperty + { + [ValidValueStringProperty, ValidValueStringPropertyDuplicate] + public string WillAlwaysFailTwice => "This is never valid."; + } + + [ValidClass, ValidClassDuplicate] + public class DoublyInvalid + { + } + [ValidClass] public class ToBeValidated { diff --git a/external/corefx/src/System.ComponentModel.EventBasedAsync/tests/BackgroundWorkerTests.cs b/external/corefx/src/System.ComponentModel.EventBasedAsync/tests/BackgroundWorkerTests.cs index 595f176ccc..4e954a7a0f 100644 --- a/external/corefx/src/System.ComponentModel.EventBasedAsync/tests/BackgroundWorkerTests.cs +++ b/external/corefx/src/System.ComponentModel.EventBasedAsync/tests/BackgroundWorkerTests.cs @@ -72,27 +72,21 @@ namespace System.ComponentModel.EventBasedAsync.Tests } [Fact] - public void RunWorkerAsync_NoOnWorkHandler_SetsResultToNull() + public async Task RunWorkerAsync_NoOnWorkHandler_SetsResultToNull() { + var tcs = new TaskCompletionSource(); var backgroundWorker = new BackgroundWorker { WorkerReportsProgress = true }; - bool isCompleted = false; backgroundWorker.RunWorkerCompleted += (sender, e) => { - isCompleted = true; Assert.Null(e.Result); Assert.False(backgroundWorker.IsBusy); + tcs.SetResult(true); }; + backgroundWorker.RunWorkerAsync(); - var stopwatch = new Stopwatch(); - stopwatch.Start(); - while (!isCompleted) - { - if (stopwatch.Elapsed > TimeSpan.FromSeconds(10)) - { - throw new Exception("The background worker never completed."); - } - } + await Task.WhenAny(tcs.Task, Task.Delay(TimeSpan.FromSeconds(10))); // Usually takes 100th of a sec + Assert.True(tcs.Task.IsCompleted); } #region TestCancelAsync diff --git a/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/Component.cs b/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/Component.cs index a9f94b8199..1e8c0814b5 100644 --- a/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/Component.cs +++ b/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/Component.cs @@ -41,7 +41,7 @@ namespace System.ComponentModel internal bool CanRaiseEventsInternal => CanRaiseEvents; /// - /// Adds a event handler to listen to the Disposed event on the component. + /// Adds an event handler to listen to the Disposed event on the component. /// [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Advanced)] @@ -119,7 +119,7 @@ namespace System.ComponentModel /// } /// /// - /// For base classes, you should never override the Finalier (~Class in C#) + /// For base classes, you should never override the Finalizer (~Class in C#) /// or the Dispose method that takes no arguments, rather you should /// always override the Dispose method that takes a bool. /// diff --git a/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/IComponent.cs b/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/IComponent.cs index b21bf7f2ca..4e29c0eae4 100644 --- a/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/IComponent.cs +++ b/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/IComponent.cs @@ -38,7 +38,7 @@ namespace System.ComponentModel } /// - /// Adds a event handler to listen to the Disposed event on the component. + /// Adds an event handler to listen to the Disposed event on the component. /// event EventHandler Disposed; } diff --git a/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/NotifyParentPropertyAttribute.cs b/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/NotifyParentPropertyAttribute.cs index 284872ed28..a866efee42 100644 --- a/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/NotifyParentPropertyAttribute.cs +++ b/external/corefx/src/System.ComponentModel.Primitives/src/System/ComponentModel/NotifyParentPropertyAttribute.cs @@ -32,7 +32,7 @@ namespace System.ComponentModel public static readonly NotifyParentPropertyAttribute Default = No; /// - /// Initiailzes a new instance of the NotifyPropertyAttribute class + /// Initializes a new instance of the NotifyPropertyAttribute class /// that uses the specified value /// to indicate whether the parent property should be notified when a child namespace property is modified. /// diff --git a/external/corefx/src/System.ComponentModel.Primitives/tests/CategoryAttributeTests.cs b/external/corefx/src/System.ComponentModel.Primitives/tests/CategoryAttributeTests.cs index fd8825518e..6d7d85c0f9 100644 --- a/external/corefx/src/System.ComponentModel.Primitives/tests/CategoryAttributeTests.cs +++ b/external/corefx/src/System.ComponentModel.Primitives/tests/CategoryAttributeTests.cs @@ -10,6 +10,7 @@ namespace System.ComponentModel.Tests public class CategoryAttributeTests { [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] // NetFX does not have fix for #21369 public void Ctor_Default() { var attribute = new CategoryAttribute(); @@ -27,6 +28,7 @@ namespace System.ComponentModel.Tests [Theory] [MemberData(nameof(Ctor_Category_TestData))] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Does not have the fix for https://github.com/dotnet/corefx/issues/21356")] public void Ctor_Category(string category, bool expectedIsDefaultAttribute) { var attribute = new CategoryAttribute(category); diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DecimalConverter.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DecimalConverter.cs index 1c35836b2d..8ab50d053d 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DecimalConverter.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DecimalConverter.cs @@ -45,7 +45,7 @@ namespace System.ComponentModel /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination - /// type is string. If this cannot convert to the desitnation type, this will + /// type is string. If this cannot convert to the destination type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs index e10692bc73..0f96381696 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DelegatingTypeDescriptionProvider.cs @@ -60,7 +60,7 @@ namespace System.ComponentModel /// The name of the specified component, or null if the component has no name. /// In many cases this will return the same value as GetComponentName. If the /// component resides in a nested container or has other nested semantics, it may - /// return a different fully qualfied name. + /// return a different fully qualified name. /// /// If not overridden, the default implementation of this method will call /// GetTypeDescriptor.GetComponentName. diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerOptionService.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerOptionService.cs index 3d77209844..9088ef3fd6 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerOptionService.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerOptionService.cs @@ -33,7 +33,7 @@ namespace System.ComponentModel.Design /// /// Creates a new DesignerOptionCollection with the given name, and adds it to /// the given parent. The "value" parameter specifies an object whose public - /// properties will be used in the Propeties collection of the option collection. + /// properties will be used in the Properties collection of the option collection. /// The value parameter can be null if this options collection does not offer /// any properties. Properties will be wrapped in such a way that passing /// anything into the component parameter of the property descriptor will be diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerTransaction.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerTransaction.cs index 22b389aa7c..0b8659b104 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerTransaction.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesignerTransaction.cs @@ -9,7 +9,7 @@ namespace System.ComponentModel.Design { /// /// Identifies a transaction within a designer. Transactions are - /// used to wrap serveral changes into one unit of work, which + /// used to wrap several changes into one unit of work, which /// helps performance. /// public abstract class DesignerTransaction : IDisposable diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesigntimeLicenseContext.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesigntimeLicenseContext.cs index 52284b6340..0792c802a5 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesigntimeLicenseContext.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/DesigntimeLicenseContext.cs @@ -76,7 +76,7 @@ namespace System.ComponentModel.Design { if (savedLicenseKeys == null || savedLicenseKeys[type.AssemblyQualifiedName] == null) { - Debug.WriteLineIf(s_runtimeLicenseContextSwitch.TraceVerbose, "savedLicenseKey is null or doesnt contain our type"); + Debug.WriteLineIf(s_runtimeLicenseContextSwitch.TraceVerbose, "savedLicenseKey is null or doesn't contain our type"); if (savedLicenseKeys == null) { savedLicenseKeys = new Hashtable(); diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IComponentInitializer.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IComponentInitializer.cs index 40786630f3..ef0396aa9c 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IComponentInitializer.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/IComponentInitializer.cs @@ -20,7 +20,7 @@ namespace System.ComponentModel.Design /// dragging a component to another container, for example. The defaultValues /// property contains a name/value dictionary of default values that should be applied /// to properties. This dictionary may be null if no default values are specified. - /// You may use the defaultValues dictionary to apply recommended defaults to proeprties + /// You may use the defaultValues dictionary to apply recommended defaults to properties /// but you should not modify component properties beyond what is stored in the /// dictionary, because this is an existing component that may already have properties /// set on it. diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/ComponentSerializationService.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/ComponentSerializationService.cs index a54f7e8523..5b50720c0a 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/ComponentSerializationService.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/ComponentSerializationService.cs @@ -47,7 +47,7 @@ namespace System.ComponentModel.Design.Serialization /// /// Normal serialization only serializes values that differ from the component's default state. - /// This provides the most compact serialization mechanism but assumes that during deserilalization + /// This provides the most compact serialization mechanism but assumes that during deserialization /// a new, freshly created object will be used. If an existing object is used properties that /// contained default values during serialization would not be reset back to their defaults. /// The SerializeAbsolute method does not require this assumption on the deserializing end. diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/DesignerLoader.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/DesignerLoader.cs index 7261308bc0..0a6749fec5 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/DesignerLoader.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/DesignerLoader.cs @@ -27,8 +27,8 @@ namespace System.ComponentModel.Design.Serialization { /// /// Returns true when the designer is in the process of loading. Clients that are - /// sinking notifications from the designer often want to ignore them while the desingner is loading - /// and only respond to them if they result from user interatcions. + /// sinking notifications from the designer often want to ignore them while the designer is loading + /// and only respond to them if they result from user interactions. /// public virtual bool Loading => false; diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationManager.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationManager.cs index a89afa720d..424a31700b 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationManager.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationManager.cs @@ -18,7 +18,7 @@ namespace System.ComponentModel.Design.Serialization /// The Context property provides a user-defined storage area /// implemented as a stack. This storage area is a useful way /// to provide communication across serializers, as serialization - /// is a generally hierarchial process. + /// is a generally hierarchical process. /// ContextStack Context { get; } diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationProvider.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationProvider.cs index 8c0e799631..27ccfc39bb 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationProvider.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/IDesignerSerializationProvider.cs @@ -15,15 +15,15 @@ namespace System.ComponentModel.Design.Serialization { /// /// This will be called by the serialization manager when it - /// is trying to locate a serialzer for an object type. + /// is trying to locate a serializer for an object type. /// If this serialization provider can provide a serializer /// that is of the correct type, it should return it. /// Otherwise, it should return null. /// /// In order to break order dependencies between multiple /// serialization providers the serialization manager will - /// loop through all serilaization provideres until the - /// serilaizer returned reaches steady state. Because + /// loop through all serialization providers until the + /// serializer returned reaches steady state. Because /// of this you should always check currentSerializer /// before returning a new serializer. If currentSerializer /// is an instance of your serializer, then you should diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/INameCreationService.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/INameCreationService.cs index 1e1ba2fc07..eef0a1bece 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/INameCreationService.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/INameCreationService.cs @@ -28,7 +28,7 @@ namespace System.ComponentModel.Design.Serialization /// /// Determines if the given name is valid. A name /// creation service may have rules defining a valid - /// name, and this method allows the sevice to enforce + /// name, and this method allows the service to enforce /// those rules. /// bool IsValidName(string name); @@ -36,7 +36,7 @@ namespace System.ComponentModel.Design.Serialization /// /// Determines if the given name is valid. A name /// creation service may have rules defining a valid - /// name, and this method allows the sevice to enforce + /// name, and this method allows the service to enforce /// those rules. It is similar to IsValidName, except /// that this method will throw an exception if the /// name is invalid. This allows implementors to provide diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs index 41e9f920ef..6ed8701261 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/Serialization/MemberRelationshipService.cs @@ -20,7 +20,7 @@ namespace System.ComponentModel.Design.Serialization /// between these two objects is lost. Serialization schemes that /// wish to maintain this relationship may install a MemberRelationshipService /// into the serialization manager. When an object is deserialized - /// this serivce will be notified of these relationships. It is up to the service + /// this service will be notified of these relationships. It is up to the service /// to act on these notifications if it wishes. During serialization, the /// service is also consulted. If a relationship exists the same /// relationship is maintained by the serializer. @@ -126,7 +126,7 @@ namespace System.ComponentModel.Design.Serialization } /// - /// Returns true if the provided relatinoship is supported. + /// Returns true if the provided relationship is supported. /// public abstract bool SupportsRelationship(MemberRelationship source, MemberRelationship relationship); diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ServiceObjectContainer.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ServiceObjectContainer.cs index 6925eda307..4697a087a3 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ServiceObjectContainer.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/ServiceObjectContainer.cs @@ -56,7 +56,7 @@ namespace System.ComponentModel.Design /// /// This property returns the default services that are implemented directly on this IServiceContainer. /// the default implementation of this property is to return the IServiceContainer and ServiceContainer - /// types. You may override this proeprty and return your own types, modifying the default behavior + /// types. You may override this property and return your own types, modifying the default behavior /// of GetService. /// protected virtual Type[] DefaultServices => s_defaultServices; diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/StandardCommands.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/StandardCommands.cs index c852925c11..ea03c7d032 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/StandardCommands.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/StandardCommands.cs @@ -11,7 +11,7 @@ namespace System.ComponentModel.Design using System.Threading; /// - /// Specifies indentifiers for the standard set of commands that are available to + /// Specifies identifiers for the standard set of commands that are available to /// most applications. /// public class StandardCommands diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DesignTimeVisibleAttribute.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DesignTimeVisibleAttribute.cs index ae51f0f051..cf9f745231 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DesignTimeVisibleAttribute.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/DesignTimeVisibleAttribute.cs @@ -51,7 +51,7 @@ namespace System.ComponentModel public static readonly DesignTimeVisibleAttribute No = new DesignTimeVisibleAttribute(false); /// - /// The default visiblity. (equal to Yes.) + /// The default visibility. (equal to Yes.) /// public static readonly DesignTimeVisibleAttribute Default = Yes; diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/GuidConverter.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/GuidConverter.cs index 3171eb46da..3286d667b1 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/GuidConverter.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/GuidConverter.cs @@ -58,7 +58,7 @@ namespace System.ComponentModel /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination - /// type is string. If this cannot convert to the desitnation type, this will + /// type is string. If this cannot convert to the destination type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICancelAddNew.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICancelAddNew.cs index da2dc9b878..2e29ff1338 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICancelAddNew.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ICancelAddNew.cs @@ -11,7 +11,7 @@ namespace System.ComponentModel /// to be either cancelled or committed. /// /// Note: In some scenarios, specifically Windows Forms complex data binding, - /// the list may recieve CancelNew or EndNew calls for items other than the + /// the list may receive CancelNew or EndNew calls for items other than the /// new item. These calls should be ignored, ie. the new item should only be /// cancelled or committed when that item's index is specified. /// diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MarshalByValueComponent.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MarshalByValueComponent.cs index e51dc0772b..1af15d3fb5 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MarshalByValueComponent.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MarshalByValueComponent.cs @@ -42,7 +42,7 @@ namespace System.ComponentModel } /// - /// Adds a event handler to listen to the Disposed event on the component. + /// Adds an event handler to listen to the Disposed event on the component. /// public event EventHandler Disposed { @@ -118,7 +118,7 @@ namespace System.ComponentModel /// } /// /// - /// For base classes, you should never override the Finalier (~Class in C#) + /// For base classes, you should never override the Finalizer (~Class in C#) /// or the Dispose method that takes no arguments, rather you should /// always override the Dispose method that takes a bool. /// diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs.REMOVED.git-id b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs.REMOVED.git-id index a3b1adb863..3e2362d4a7 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs.REMOVED.git-id +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs.REMOVED.git-id @@ -1 +1 @@ -cc061799feaf14b4a42a2c169b65cffb309d078a \ No newline at end of file +174d609906a9fbec6cf9d6bbc0e33af3f6ad1396 \ No newline at end of file diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs index 0d1e5eabc7..73122b15dc 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs @@ -240,7 +240,7 @@ namespace System.ComponentModel } /// - /// Called each time we access the attribtes on + /// Called each time we access the attributes on /// this member descriptor to give deriving classes /// a chance to change them on the fly. /// diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PasswordPropertyTextAttribute.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PasswordPropertyTextAttribute.cs index 1a54e58dc7..8908f3f213 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PasswordPropertyTextAttribute.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/PasswordPropertyTextAttribute.cs @@ -9,7 +9,7 @@ namespace System.ComponentModel { /// /// If this attribute is placed on a property or a type, its text representation in a property window - /// will appear as dots or astrisks to indicate a password field. This indidation in no way + /// will appear as dots or asterisks to indicate a password field. This indication in no way /// represents any type of encryption or security. /// [AttributeUsage(AttributeTargets.All)] diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs index 66c525e1e4..514e90640c 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs @@ -1187,7 +1187,7 @@ namespace System.ComponentModel /// other words, it indicates whether the state of the property is distinct /// from when the component is first instantiated. If there is a default /// value specified in this ReflectPropertyDescriptor, it will be compared against the - /// property's current value to determine this. If there is't, the + /// property's current value to determine this. If there isn't, the /// ShouldSerializeXXX method is looked for and invoked if found. If both /// these routes fail, true will be returned. /// diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs index 8838d2fb36..285f68dc7d 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs @@ -147,10 +147,10 @@ namespace System.ComponentModel /// /// Adds an editor table for the given editor base type. - /// ypically, editors are specified as metadata on an object. If no metadata for a - /// equested editor base type can be found on an object, however, the - /// ypeDescriptor will search an editor - /// able for the editor type, if one can be found. + /// Typically, editors are specified as metadata on an object. If no metadata for a + /// requested editor base type can be found on an object, however, the + /// TypeDescriptor will search an editor + /// table for the editor type, if one can be found. /// internal static void AddEditorTable(Type editorBaseType, Hashtable table) { @@ -726,7 +726,7 @@ namespace System.ComponentModel /// The name of the specified component, or null if the component has no name. /// In many cases this will return the same value as GetComponentName. If the /// component resides in a nested container or has other nested semantics, it may - /// return a different fully qualfied name. + /// return a different fully qualified name. /// /// If not overridden, the default implementation of this method will call /// GetComponentName. diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/RunInstallerAttribute.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/RunInstallerAttribute.cs index 7d6e3def37..86a0e32afe 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/RunInstallerAttribute.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/RunInstallerAttribute.cs @@ -59,7 +59,7 @@ namespace System.ComponentModel /// /// - /// Specifies the default visiblity, which is . This field is + /// Specifies the default visibility, which is . This field is /// read-only. /// /// diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TimeSpanConverter.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TimeSpanConverter.cs index 3579242080..ff1b174626 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TimeSpanConverter.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TimeSpanConverter.cs @@ -67,7 +67,7 @@ namespace System.ComponentModel /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination - /// type is string. If this cannot convert to the desitnation type, this will + /// type is string. If this cannot convert to the destination type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs index 9d88eb395b..09ece7cf15 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs @@ -26,7 +26,7 @@ namespace System.ComponentModel /// These two filters specify that ReportElement toolbox items will only be /// enabled when a ReportDesigner is visible. By specifying a filter type of /// Require on the report designer class, this will disable any toolbox items - /// that are not report elements. If the report designer specifed a filter type + /// that are not report elements. If the report designer specified a filter type /// of "Allow" instead of "Require", other components would be enabled when the /// report designer was active. ReportElements would still be disabled when /// other designers were active, however, because ReportElement requires designers diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptionProvider.cs b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptionProvider.cs index c7490312f0..2abceb8bb7 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptionProvider.cs +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptionProvider.cs @@ -125,7 +125,7 @@ namespace System.ComponentModel /// The name of the specified component, or null if the component has no name. /// In many cases this will return the same value as GetComponentName. If the /// component resides in a nested container or has other nested semantics, it may - /// return a different fully qualfied name. + /// return a different fully qualified name. /// /// If not overridden, the default implementation of this method will call /// GetTypeDescriptor.GetComponentName. diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs.REMOVED.git-id b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs.REMOVED.git-id index b20479f263..1c0331f62f 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs.REMOVED.git-id +++ b/external/corefx/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs.REMOVED.git-id @@ -1 +1 @@ -fb8bc5f09d8ef6e450caa8ed2c0c8e04fbeda13a \ No newline at end of file +9a2df4f09b14cc71f5feafd11a05d52d48fc2617 \ No newline at end of file diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs b/external/corefx/src/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs new file mode 100644 index 0000000000..b44922d2a7 --- /dev/null +++ b/external/corefx/src/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs @@ -0,0 +1,487 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using Xunit; + +namespace System.ComponentModel.Design.Tests +{ + public class DesignerOptionServiceTests + { + [Fact] + public void CreateOptionCollection_CreateMultipleTimes_ReturnsExpected() + { + var service = new TestDesignerOptionService(); + + DesignerOptionService.DesignerOptionCollection options1 = service.DoCreateOptionCollection(service.Options, "name", "value"); + Assert.Equal(0, options1.Count); + Assert.NotEmpty(options1.Properties); + Assert.Same(options1.Properties, options1.Properties); + Assert.Same(service.Options, options1.Parent); + + DesignerOptionService.DesignerOptionCollection options2 = service.DoCreateOptionCollection(service.Options, "name", "value"); + Assert.Equal(2, service.Options.Count); + Assert.Equal(0, options2.Count); + Assert.NotEmpty(options2.Properties); + Assert.Same(options2.Properties, options2.Properties); + Assert.Same(service.Options, options2.Parent); + + Assert.Equal(new DesignerOptionService.DesignerOptionCollection[] { options1, options2 }, service.Options.Cast()); + } + + [Fact] + public void CreateOptionCollection_NullParent_ThrowsArgumentNullException() + { + var service = new TestDesignerOptionService(); + AssertExtensions.Throws("parent", () => service.DoCreateOptionCollection(null, "name", "value")); + } + + [Fact] + public void CreateOptionCollection_NullName_ThrowsArgumentNullException() + { + var service = new TestDesignerOptionService(); + AssertExtensions.Throws("name", () => service.DoCreateOptionCollection(service.Options, null, "value")); + } + + [Fact] + public void CreateOptionCollection_EmptyName_ThrowsArgumentException() + { + var service = new TestDesignerOptionService(); + AssertExtensions.Throws("name.Length", () => service.DoCreateOptionCollection(service.Options, string.Empty, "value")); + } + + [Fact] + public void Options_Get_ReturnsExpected() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.Options; + Assert.Same(options, service.Options); + + Assert.Equal(0, options.Count); + Assert.Empty(options.Properties); + Assert.Same(options.Properties, options.Properties); + Assert.Null(options.Parent); + } + + [Fact] + public void Options_IListProperties_ReturnsExpected() + { + var service = new TestDesignerOptionService(); + IList options = service.Options; + Assert.Same(options, service.Options); + + Assert.Equal(0, options.Count); + Assert.True(options.IsFixedSize); + Assert.True(options.IsReadOnly); + Assert.False(options.IsSynchronized); + Assert.Same(options, options.SyncRoot); + } + + [Fact] + public void IList_Modification_ThrowsNotSupportedException() + { + var service = new TestDesignerOptionService(); + IList options = service.Options; + + Assert.Throws(() => options[0] = null); + Assert.Throws(() => options.Add(null)); + Assert.Throws(() => options.Insert(0, null)); + Assert.Throws(() => options.Remove(null)); + Assert.Throws(() => options.RemoveAt(0)); + Assert.Throws(() => options.Clear()); + } + + [Fact] + public void IndexOf_ValueExists_ReturnsExpected() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Equal(0, service.Options.IndexOf(options)); + Assert.Equal(0, ((IList)service.Options).IndexOf(options)); + } + + [Fact] + public void IndexOf_NoSuchOptions_ReturnsNegativeOne() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Equal(-1, service.Options.IndexOf(service.Options)); + Assert.Equal(-1, service.Options.IndexOf(null)); + Assert.Equal(-1, ((IList)service.Options).IndexOf(service.Options)); + } + + [Fact] + public void Contains_ValueExists_ReturnsExpected() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Equal(0, service.Options.IndexOf(options)); + Assert.Equal(0, ((IList)service.Options).IndexOf(options)); + } + + [Fact] + public void Contains_NoSuchOptions_ReturnsFalse() + { + var service = new TestDesignerOptionService(); + IList options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.False(options.Contains(service.Options)); + Assert.False(options.Contains(null)); + } + + [Theory] + [InlineData("Name")] + [InlineData("name")] + public void Indexer_ValidName_ReturnsExpected(string name) + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Same(options, service.Options[name]); + } + + [Theory] + [InlineData(null)] + [InlineData("NoSuchName")] + public void Indexer_InvalidName_ReturnsNull(string name) + { + var service = new TestDesignerOptionService(); + service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Null(service.Options[name]); + } + + [Fact] + public void Indexer_ValidIndex_ReturnsExpected() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Same(options, service.Options[0]); + Assert.Same(options, ((IList)service.Options)[0]); + } + + [Theory] + [InlineData(-1)] + [InlineData(1)] + public void Indexer_InvalidIndex_ThrowsIndexOutOfRangeException(int index) + { + var service = new TestDesignerOptionService(); + service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.Throws(() => service.Options[index]); + Assert.Throws(() => ((IList)service.Options)[index]); + } + + [Fact] + public void Properties_GetBeforeAddingChild_ReturnsEmpty() + { + var service = new TestDesignerOptionService(); + Assert.Empty(service.Options.Properties); + + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "name", "value"); + Assert.Empty(service.Options.Properties); + } + + [Fact] + public void Properties_GetAfterAddingChild_ReturnsNonEmpty() + { + var service = new TestDesignerOptionService(); + + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "name", "value"); + Assert.NotEmpty(service.Options.Properties); + } + + [Fact] + public void Properties_PropertyDescriptorAttributes_Success() + { + var value = new TestClass { Value = "Value" }; + + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", value); + PropertyDescriptor propertyDescriptor = Assert.IsAssignableFrom(Assert.Single(options.Properties)); + PropertyDescriptor actualProperty = Assert.IsAssignableFrom(Assert.Single(TypeDescriptor.GetProperties(value))); + + Assert.Equal(actualProperty.Attributes, propertyDescriptor.Attributes); + Assert.Equal(actualProperty.ComponentType, propertyDescriptor.ComponentType); + Assert.Equal(actualProperty.IsReadOnly, propertyDescriptor.IsReadOnly); + Assert.Equal(actualProperty.PropertyType, propertyDescriptor.PropertyType); + Assert.Equal(actualProperty.CanResetValue(value), propertyDescriptor.CanResetValue("InvalidComponent")); + Assert.Equal(actualProperty.ShouldSerializeValue(value), propertyDescriptor.ShouldSerializeValue("InvalidComponent")); + + propertyDescriptor.ResetValue(null); + Assert.Equal("Value", value.Value); + } + + [Fact] + public void DesignerOptionConverterGetPropertiesSupported_Invoke_ReturnsTrue() + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(DesignerOptionService.DesignerOptionCollection)); + Assert.True(converter.GetPropertiesSupported()); + } + + [Fact] + public void DesignerOptionConverterGetProperties_ValidValue_ReturnsExpected() + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(DesignerOptionService.DesignerOptionCollection)); + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", new TestClass()); + service.DoCreateOptionCollection(options, "Name", null); + + PropertyDescriptorCollection properties = converter.GetProperties(options); + Assert.Equal(2, properties.Count); + + PropertyDescriptor optionsDescriptor = properties[0]; + Assert.Equal(typeof(DesignerOptionService.DesignerOptionCollection), optionsDescriptor.ComponentType); + Assert.Equal(typeof(DesignerOptionService.DesignerOptionCollection), optionsDescriptor.PropertyType); + Assert.Same(options[0], optionsDescriptor.GetValue(null)); + + Assert.True(optionsDescriptor.IsReadOnly); + Assert.False(optionsDescriptor.CanResetValue(null)); + Assert.False(optionsDescriptor.ShouldSerializeValue(null)); + + optionsDescriptor.ResetValue(null); + optionsDescriptor.SetValue(null, null); + + PropertyDescriptor propertyDescriptor = properties[1]; + Assert.Same(options.Properties[0], propertyDescriptor); + } + + [Theory] + [InlineData("Value")] + [InlineData(null)] + public void DesignerOptionConverterGetProperties_InvalidValue_ReturnsEmpty(object value) + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(DesignerOptionService.DesignerOptionCollection)); + Assert.Empty(converter.GetProperties(value)); + } + + [Fact] + public void DesignerOptionConverter_ConvertToString_ReturnsExpected() + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(DesignerOptionService.DesignerOptionCollection)); + Assert.Equal("(Collection)", converter.ConvertToString(null)); + } + + [Fact] + public void DesignerOptionConverter_ConvertToNonString_ThrowsNotSupportedException() + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(DesignerOptionService.DesignerOptionCollection)); + Assert.Throws(() => converter.ConvertTo(null, typeof(object))); + } + + [Fact] + public void CopyTo_ValidRange_Success() + { + var service = new TestDesignerOptionService(); + + DesignerOptionService.DesignerOptionCollection options1 = service.DoCreateOptionCollection(service.Options, "name", "value"); + DesignerOptionService.DesignerOptionCollection options2 = service.DoCreateOptionCollection(service.Options, "name", "value"); + + var destination = new object[3]; + service.Options.CopyTo(destination, 1); + + Assert.Equal(new object[] { null, options1, options2 }, destination); + } + + [Fact] + public void Properties_GetWhenPopulateOptionCollectionOverriden_ReturnsExpected() + { + var service = new PopulatingDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.Options; + Assert.Single(options); + Assert.Equal("Name", options[0].Name); + } + + private class PopulatingDesignerOptionService : DesignerOptionService + { + protected override void PopulateOptionCollection(DesignerOptionCollection options) + { + CreateOptionCollection(options, "Name", "Value"); + } + } + + [Fact] + public void ShowDialog_Invoke_ReturnsFalseByDefault() + { + var service = new TestDesignerOptionService(); + Assert.False(service.DoShowDialog(null, null)); + } + + [Fact] + public void GetOptionValue_NotNested_ReturnsExpected() + { + var value = new TestClass { Value = "StringValue" }; + + var service = new TestDesignerOptionService(); + IDesignerOptionService iService = service; + service.DoCreateOptionCollection(service.Options, "Name", value); + + Assert.Equal("StringValue", iService.GetOptionValue("Name", "Value")); + } + + [Fact] + public void GetOptionValue_Nested_ReturnsExpected() + { + var value = new TestClass { Value = "StringValue" }; + + var service = new TestDesignerOptionService(); + IDesignerOptionService iService = service; + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", null); + service.DoCreateOptionCollection(options, "SubName", value); + + Assert.Equal("StringValue", iService.GetOptionValue("Name\\SubName", "Value")); + } + + [Theory] + [InlineData("NoSuchParentName\\SubName", "Value")] + [InlineData("Name\\NoSuchSubName", "Value")] + [InlineData("Name\\SubName", "NoSuchValue")] + public void GetOptionValue_NoSuchValue_ReturnsNull(string pageName, string valueName) + { + var value = new TestClass { Value = "StringValue" }; + + var service = new TestDesignerOptionService(); + IDesignerOptionService iService = service; + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", null); + service.DoCreateOptionCollection(options, "SubName", value); + + Assert.Null(iService.GetOptionValue(pageName, valueName)); + } + + [Fact] + public void GetOptionValue_NullPageName_ThrowsArgumentNullException() + { + IDesignerOptionService service = new TestDesignerOptionService(); + AssertExtensions.Throws("pageName", () => service.GetOptionValue(null, "ValueName")); + } + + [Fact] + public void GetOptionValue_NullValueName_ThrowsArgumentNullException() + { + IDesignerOptionService service = new TestDesignerOptionService(); + AssertExtensions.Throws("valueName", () => service.GetOptionValue("PageName", null)); + } + + [Fact] + public void SetOptionValue_NotNested_ReturnsExpected() + { + var value = new TestClass { Value = "StringValue" }; + + var service = new TestDesignerOptionService(); + IDesignerOptionService iService = service; + service.DoCreateOptionCollection(service.Options, "Name", value); + + iService.SetOptionValue("Name", "Value", "abc"); + Assert.Equal("abc", value.Value); + } + + [Fact] + public void SetOptionValue_Nested_ReturnsExpected() + { + var value = new TestClass { Value = "StringValue" }; + + var service = new TestDesignerOptionService(); + IDesignerOptionService iService = service; + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", null); + service.DoCreateOptionCollection(options, "SubName", value); + + iService.SetOptionValue("Name\\SubName", "Value", "abc"); + Assert.Equal("abc", value.Value); + } + + [Theory] + [InlineData("NoSuchParentName\\SubName", "Value")] + [InlineData("Name\\NoSuchSubName", "Value")] + [InlineData("Name\\SubName", "NoSuchValue")] + public void SetOptionValue_NoSuchValue_Nop(string pageName, string valueName) + { + var value = new TestClass { Value = "StringValue" }; + + var service = new TestDesignerOptionService(); + IDesignerOptionService iService = service; + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", null); + service.DoCreateOptionCollection(options, "SubName", value); + + iService.SetOptionValue(pageName, valueName, "value"); + } + + [Fact] + public void SetOptionValue_NullPageName_ThrowsArgumentNullException() + { + IDesignerOptionService service = new TestDesignerOptionService(); + AssertExtensions.Throws("pageName", () => service.SetOptionValue(null, "ValueName", "value")); + } + + [Fact] + public void SetOptionValue_NullValueName_ThrowsArgumentNullException() + { + IDesignerOptionService service = new TestDesignerOptionService(); + AssertExtensions.Throws("valueName", () => service.SetOptionValue("PageName", null, "value")); + } + + [Fact] + public void ShowDialog_NonNestedValue_Success() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", "Value"); + + Assert.True(options.ShowDialog()); + Assert.Equal("Value", service.ShowDialogValue); + } + + [Fact] + public void ShowDialog_NestedValue_Success() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", null); + service.DoCreateOptionCollection(options, "Name", "Value"); + + Assert.True(options.ShowDialog()); + Assert.Equal("Value", service.ShowDialogValue); + } + + [Fact] + public void ShowDialog_NullValue_Success() + { + var service = new TestDesignerOptionService(); + DesignerOptionService.DesignerOptionCollection options = service.DoCreateOptionCollection(service.Options, "Name", null); + service.DoCreateOptionCollection(options, "Name", null); + + Assert.False(options.ShowDialog()); + Assert.Equal("Default", service.ShowDialogValue); + } + + private class TestDesignerOptionService : DesignerOptionService + { + public object ShowDialogValue { get; set; } = "Default"; + + public DesignerOptionCollection DoCreateOptionCollection(DesignerOptionCollection parent, string name, object value) + { + return CreateOptionCollection(parent, name, value); + } + + protected override bool ShowDialog(DesignerOptionCollection options, object optionObject) + { + ShowDialogValue = optionObject; + return true; + } + + public bool DoShowDialog(DesignerOptionCollection options, object optionObject) + { + return base.ShowDialog(options, optionObject); + } + } + + private class TestClass + { + public string Value { get; set; } + } + } +} diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/tests/Performance/Configurations.props b/external/corefx/src/System.ComponentModel.TypeConverter/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.ComponentModel.TypeConverter/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj b/external/corefx/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj index 90b22fbe94..74c80d8690 100644 --- a/external/corefx/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj +++ b/external/corefx/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj @@ -22,9 +22,6 @@ - - Common\tests\System\PlatformDetection.cs - @@ -87,6 +84,7 @@ + diff --git a/external/corefx/src/System.Composition.Hosting/tests/System.Composition.Hosting.Tests.csproj b/external/corefx/src/System.Composition.Hosting/tests/System.Composition.Hosting.Tests.csproj index 23afc7b81d..e688fa8aec 100644 --- a/external/corefx/src/System.Composition.Hosting/tests/System.Composition.Hosting.Tests.csproj +++ b/external/corefx/src/System.Composition.Hosting/tests/System.Composition.Hosting.Tests.csproj @@ -15,9 +15,6 @@ - - Common\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.Composition.Runtime/System.Composition.Runtime.sln b/external/corefx/src/System.Composition.Runtime/System.Composition.Runtime.sln index fd6f5880d8..4d9e5754d3 100644 --- a/external/corefx/src/System.Composition.Runtime/System.Composition.Runtime.sln +++ b/external/corefx/src/System.Composition.Runtime/System.Composition.Runtime.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Composition.Runtime.Tests", "tests\System.Composition.Runtime.Tests.csproj", "{52BE9F68-69EC-44AA-806E-11EFB57D9B4B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Composition.Runtime.Tests", "tests\System.Composition.Runtime.Tests.csproj", "{3B6042E6-9765-4A03-9089-92050100C85E}" ProjectSection(ProjectDependencies) = postProject {2711DFD2-8541-4628-BC53-EB784A14CDCF} = {2711DFD2-8541-4628-BC53-EB784A14CDCF} EndProjectSection @@ -19,10 +19,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {52BE9F68-69EC-44AA-806E-11EFB57D9B4B}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {52BE9F68-69EC-44AA-806E-11EFB57D9B4B}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {52BE9F68-69EC-44AA-806E-11EFB57D9B4B}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {52BE9F68-69EC-44AA-806E-11EFB57D9B4B}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {3B6042E6-9765-4A03-9089-92050100C85E}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {3B6042E6-9765-4A03-9089-92050100C85E}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {3B6042E6-9765-4A03-9089-92050100C85E}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {3B6042E6-9765-4A03-9089-92050100C85E}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {2711DFD2-8541-4628-BC53-EB784A14CDCF}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {2711DFD2-8541-4628-BC53-EB784A14CDCF}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {2711DFD2-8541-4628-BC53-EB784A14CDCF}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU @@ -32,7 +32,7 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {52BE9F68-69EC-44AA-806E-11EFB57D9B4B} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {3B6042E6-9765-4A03-9089-92050100C85E} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {2711DFD2-8541-4628-BC53-EB784A14CDCF} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} EndGlobalSection EndGlobal diff --git a/external/corefx/src/System.Composition.Runtime/src/System/Composition/ExportOfT.cs b/external/corefx/src/System.Composition.Runtime/src/System/Composition/ExportOfT.cs index adbc9adf82..14d46c536f 100644 --- a/external/corefx/src/System.Composition.Runtime/src/System/Composition/ExportOfT.cs +++ b/external/corefx/src/System.Composition.Runtime/src/System/Composition/ExportOfT.cs @@ -14,7 +14,7 @@ namespace System.Composition private readonly Action _disposeAction; /// - /// Construct an ExportLifetimContext. + /// Construct an Export. /// /// The value of the export. /// An action that releases resources associated with the export. diff --git a/external/corefx/src/System.Composition.Runtime/tests/System.Composition.Runtime.Tests.csproj b/external/corefx/src/System.Composition.Runtime/tests/System.Composition.Runtime.Tests.csproj index 842c342da6..aa496f801a 100644 --- a/external/corefx/src/System.Composition.Runtime/tests/System.Composition.Runtime.Tests.csproj +++ b/external/corefx/src/System.Composition.Runtime/tests/System.Composition.Runtime.Tests.csproj @@ -2,7 +2,7 @@ - {52BE9F68-69EC-44AA-806E-11EFB57D9B4B} + {3B6042E6-9765-4A03-9089-92050100C85E} diff --git a/external/corefx/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj b/external/corefx/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj index e00bafcab6..d7095e9532 100644 --- a/external/corefx/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj +++ b/external/corefx/src/System.Composition.TypedParts/src/System.Composition.TypedParts.csproj @@ -54,6 +54,9 @@ + + Common\System\Numerics\Hashing\HashHelpers.cs + diff --git a/external/corefx/src/System.Composition.TypedParts/src/System/Composition/TypedParts/Discovery/DiscoveredPart.cs b/external/corefx/src/System.Composition.TypedParts/src/System/Composition/TypedParts/Discovery/DiscoveredPart.cs index 9f0775162f..54da7dfd54 100644 --- a/external/corefx/src/System.Composition.TypedParts/src/System/Composition/TypedParts/Discovery/DiscoveredPart.cs +++ b/external/corefx/src/System.Composition.TypedParts/src/System/Composition/TypedParts/Discovery/DiscoveredPart.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; +using System.Numerics.Hashing; using System.Reflection; using System.Linq.Expressions; using System.Diagnostics; @@ -142,7 +143,7 @@ namespace System.Composition.TypedParts.Discovery var partActivatorDependencies = dependencies .Where(dep => dep.Site is ParameterImportSite) - .ToDictionary(d => ((ParameterImportSite)d.Site).Parameter); + .ToDictionary(d => ((ParameterImportSite)d.Site).Parameter, ParameterInfoComparer.Instance); for (var i = 0; i < cps.Length; ++i) { @@ -226,5 +227,44 @@ namespace System.Composition.TypedParts.Discovery } public IEnumerable DiscoveredExports { get { return _exports; } } + + // uses the fact that current usage only has comparisons + // between ParameterInfo objects from the same constructor reference, + // thus only the position needs to be compared. + // Equals checks the member reference equality in case usage changes. + private sealed class ParameterInfoComparer : IEqualityComparer + { + public static readonly ParameterInfoComparer Instance = new ParameterInfoComparer(); + + public int GetHashCode(ParameterInfo obj) + { + return HashHelpers.Combine(obj.Position.GetHashCode(), obj.Member.GetHashCode()); + } + + public bool Equals(ParameterInfo x, ParameterInfo y) + { + if (ReferenceEquals(x, y)) + { + return true; + } + + if (x == null || y == null) + { + return false; + } + + if (x.Position != y.Position) + { + return false; + } + + if (x.Member != y.Member) + { + return false; + } + + return true; + } + } } } diff --git a/external/corefx/src/System.Composition.TypedParts/tests/ReflectionTests.cs b/external/corefx/src/System.Composition.TypedParts/tests/ReflectionTests.cs new file mode 100644 index 0000000000..4795ccd1b2 --- /dev/null +++ b/external/corefx/src/System.Composition.TypedParts/tests/ReflectionTests.cs @@ -0,0 +1,147 @@ +using System.Collections.Concurrent; +using System.Composition.Hosting; +using System.Threading; +using Xunit; + +namespace System.Composition.TypedParts.Tests +{ + /// + /// Tests dealing with reflection usage in System.Composition + /// + public class ReflectionTests + { + public static bool HasMultiplerProcessors { get; } = Environment.ProcessorCount > 1; + + /// + /// Regression test for issue #6857 System.Composition: Bug in Resolving Activators Due to the .NET Type System + /// Non-deterministic + /// + /// + /// Because MethodInfo.GetParameters() lazy initializes it's return value, + /// concurrent calls can create different ParameterInfo instances. + /// This can cause arguments to an export's constructor to incorrectly + /// revert to a default value during GetExport. + /// + [ConditionalFact(nameof(HasMultiplerProcessors))] + public void MultiThreadedGetExportsWorkWithImportingConstuctor() + { + var errors = new ConcurrentBag(); + + using (var evnt = new ManualResetEventSlim()) + { + var threads = new Thread[Environment.ProcessorCount]; + for (var idx = 0; idx < threads.Length; idx++) + { + threads[idx] = new Thread(() => Run(evnt, errors)); + } + + foreach (var thread in threads) + { + thread.Start(); + } + + evnt.Set(); + + foreach (var thread in threads) + { + thread.Join(); + } + } + + if (errors.Count > 0) + { + throw new AggregateException(errors); + } + } + + private static void Run(ManualResetEventSlim evnt, ConcurrentBag errors) + { + try + { + evnt.Wait(); + GetExport(); + } + catch (Exception ex) + { + errors.Add(ex); + } + } + + private static void GetExport() + { + CompositionContext cc = CreateContainer(typeof(A), typeof(B), typeof(C), typeof(D)); + D d = cc.GetExport(); + Assert.IsAssignableFrom(typeof(A), d.A); + Assert.IsAssignableFrom(typeof(B), d.B); + Assert.IsAssignableFrom(typeof(A), d.B.A); + Assert.IsAssignableFrom(typeof(C), d.C); + Assert.IsAssignableFrom(typeof(A), d.C.A); + Assert.IsAssignableFrom(typeof(B), d.C.B); + } + + private static CompositionContext CreateContainer(params Type[] types) + { + return new ContainerConfiguration() + .WithParts(types) + .CreateContainer(); + } + + public interface IA { } + + [Export(typeof(IA))] + public class A : IA { } + + public interface IB + { + IA A { get; } + } + + [Export(typeof(IB))] + public class B : IB + { + public IA A { get; } + + [ImportingConstructor] + public B(IA ia) + { + A = ia; + } + } + + public interface IC + { + IA A { get; } + IB B { get; } + } + + [Export(typeof(IC))] + public class C : IC + { + public IA A { get; } + public IB B { get; } + + [ImportingConstructor] + public C(IA ia, IB ib) + { + A = ia; + B = ib; + } + } + + [Export] + public class D + { + public IA A { get; } + public IB B { get; } + public IC C { get; } + + [ImportingConstructor] + public D(IA ia, IB ib, IC ic) + { + A = ia; + B = ib; + C = ic; + } + } + } +} diff --git a/external/corefx/src/System.Composition.TypedParts/tests/System.Composition.TypedParts.Tests.csproj b/external/corefx/src/System.Composition.TypedParts/tests/System.Composition.TypedParts.Tests.csproj index 45f80cc2b8..3111e1d534 100644 --- a/external/corefx/src/System.Composition.TypedParts/tests/System.Composition.TypedParts.Tests.csproj +++ b/external/corefx/src/System.Composition.TypedParts/tests/System.Composition.TypedParts.Tests.csproj @@ -11,6 +11,7 @@ Common\System\Diagnostics\DebuggerAttributes.cs + \ No newline at end of file diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ApplicationSettingsBase.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ApplicationSettingsBase.cs index c5e8982b28..10ae363c43 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ApplicationSettingsBase.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ApplicationSettingsBase.cs @@ -377,7 +377,7 @@ namespace System.Configuration } /// - /// Overriden from SettingsBase to support validation event. + /// Overridden from SettingsBase to support validation event. /// public override void Save() { @@ -391,7 +391,7 @@ namespace System.Configuration } /// - /// Overriden from SettingsBase to support validation event. + /// Overridden from SettingsBase to support validation event. /// public override object this[string propertyName] { diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs index b62f885187..446df7227d 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs @@ -92,7 +92,7 @@ namespace System.Configuration // (1) Company name string part1 = Validate(_companyName, limitSize: true); - // (2) Domain or product name & a application urit hash + // (2) Domain or product name & an application urit hash string namePrefix = Validate(AppDomain.CurrentDomain.FriendlyName, limitSize: true); if (string.IsNullOrEmpty(namePrefix)) namePrefix = Validate(ProductName, limitSize: true); diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs index 885fdb9c64..0a3f4634c3 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs @@ -1336,7 +1336,7 @@ namespace System.Configuration ((lockType != ConfigurationLockCollectionType.LockedElements) && (lockType != ConfigurationLockCollectionType.LockedElementsExceptionList) && typeof(ConfigurationElement).IsAssignableFrom(propToLock.Type)) || - // or if not locking elements but the property is a element + // or if not locking elements but the property is an element (((lockType == ConfigurationLockCollectionType.LockedElements) || (lockType == ConfigurationLockCollectionType.LockedElementsExceptionList)) && !typeof(ConfigurationElement).IsAssignableFrom(propToLock.Type)) diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElementCollectionType.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElementCollectionType.cs index 8ea30d8819..9d1ed1266d 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElementCollectionType.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElementCollectionType.cs @@ -46,7 +46,7 @@ namespace System.Configuration Any access via indexes have to go through some transformation step. The Alternate version changes the inheritance stuff like the BasicMapAlternate, - where the "nearest" config file entries take precendence over the "parent" + where the "nearest" config file entries take precedence over the "parent" config file entries (see example above). **********************************************************************/ @@ -55,4 +55,4 @@ namespace System.Configuration BasicMapAlternate, AddRemoveClearMapAlternate, } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConnectionStringSettingsCollection.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConnectionStringSettingsCollection.cs index 018aa2f4d4..bc2423688b 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConnectionStringSettingsCollection.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConnectionStringSettingsCollection.cs @@ -39,7 +39,7 @@ namespace System.Configuration } // the connection string behavior is strange in that is acts kind of like a - // basic map and partially like a add remove clear collection + // basic map and partially like an add remove clear collection // Overriding these methods allows for the specific behaviors to be // patterened protected override void BaseAdd(int index, ConfigurationElement element) @@ -83,4 +83,4 @@ namespace System.Configuration BaseClear(); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs.REMOVED.git-id b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs.REMOVED.git-id index cac4bb49d2..2cc27cd723 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs.REMOVED.git-id +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs.REMOVED.git-id @@ -1 +1 @@ -e0f4661dc2c2be051b341c569966baea84d7789b \ No newline at end of file +87057bfb1dc6c7c795d76ec1d27d11238bbaec0b \ No newline at end of file diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/SectionInput.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/SectionInput.cs index 98c1bf9276..69aeecdc46 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/SectionInput.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/SectionInput.cs @@ -13,7 +13,7 @@ namespace System.Configuration // result can be null, so we use this object to indicate whether it has been evaluated private static readonly object s_unevaluated = new object(); - // accummulated errors related to this input + // accumulated errors related to this input private readonly List _errors; // Provider to use for encryption diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/XmlUtil.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/XmlUtil.cs index 3486f1c03e..1ffa3b5925 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/XmlUtil.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/XmlUtil.cs @@ -20,7 +20,7 @@ namespace System.Configuration // * Method to copy a configuration section to a string. // * Methods to format a string of XML. // - // Errors found during read are accumlated in a ConfigurationSchemaErrors object. + // Errors found during read are accumulated in a ConfigurationSchemaErrors object. internal sealed class XmlUtil : IDisposable, IConfigErrorInfo { private const int MaxLineWidth = 60; diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationLockCollectionTest.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationLockCollectionTest.cs index 24de22ad52..9f7bc144d3 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationLockCollectionTest.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationLockCollectionTest.cs @@ -28,6 +28,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. +using System; using System.Configuration; using System.Collections; using Xunit; @@ -37,7 +38,7 @@ namespace MonoTests.System.Configuration { public class ConfigurationLockCollectionTest { - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void InitialState() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -73,7 +74,7 @@ namespace MonoTests.System.Configuration Assert.Equal(col, col.SyncRoot); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void NonExistentItem() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -84,7 +85,7 @@ namespace MonoTests.System.Configuration Assert.Throws(() => col.IsReadOnly("file")); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void Populate() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -98,7 +99,7 @@ namespace MonoTests.System.Configuration Assert.True(col.Contains("file"), "A4"); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void Populate_Error() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -107,7 +108,7 @@ namespace MonoTests.System.Configuration Assert.Throws(() => col.Add("boo")); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void Enumerator() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -121,7 +122,7 @@ namespace MonoTests.System.Configuration Assert.False(e.MoveNext(), "A3"); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void SetFromList() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); @@ -139,7 +140,7 @@ namespace MonoTests.System.Configuration Assert.True(col.Contains("file"), "A2"); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] [ActiveIssue("dotnet/corefx #18195", TargetFrameworkMonikers.NetFramework)] public void DuplicateAdd() { @@ -154,7 +155,7 @@ namespace MonoTests.System.Configuration Assert.Equal(1, app.LockAttributes.Count); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void IsReadOnly() { SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs index f8cf76e191..f9b6534c9d 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationManagerTest.cs @@ -42,7 +42,7 @@ namespace MonoTests.System.Configuration public class ConfigurationManagerTest { - [Fact] // OpenExeConfiguration (ConfigurationUserLevel) + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] // OpenExeConfiguration (ConfigurationUserLevel) [ActiveIssue("dotnet/corefx #19384", TargetFrameworkMonikers.NetFramework)] public void OpenExeConfiguration1_UserLevel_None() { @@ -51,7 +51,7 @@ namespace MonoTests.System.Configuration Assert.Equal(TestUtil.ThisConfigFileName, fi.Name); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void OpenExeConfiguration1_UserLevel_PerUserRoaming() { string applicationData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); @@ -66,7 +66,7 @@ namespace MonoTests.System.Configuration Assert.Equal("user.config", fi.Name); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] [ActiveIssue(15065, TestPlatforms.AnyUnix)] public void OpenExeConfiguration1_UserLevel_PerUserRoamingAndLocal() { @@ -140,24 +140,22 @@ namespace MonoTests.System.Configuration Assert.Equal(TestUtil.ThisApplicationPath + ".config", config.FilePath); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void exePath_UserLevelPerRoaming() { string applicationData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); // If there is not ApplicationData folder PerUserRoaming won't work - if (string.IsNullOrEmpty(applicationData)) return; - - Assert.True(Directory.Exists(applicationData), "application data should exist"); + if (string.IsNullOrEmpty(applicationData)) + return; SysConfig config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming); string filePath = config.FilePath; Assert.False(string.IsNullOrEmpty(filePath), "should have some file path"); - Assert.True(filePath.StartsWith(applicationData), "#1:" + filePath); Assert.Equal("user.config", Path.GetFileName(filePath)); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] [ActiveIssue(15066, TestPlatforms.AnyUnix)] public void exePath_UserLevelPerRoamingAndLocal() { @@ -260,7 +258,7 @@ namespace MonoTests.System.Configuration Assert.Equal("machineconfig", fi.Name); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] // Doesn't pass on Mono // [Category("NotWorking")] [ActiveIssue("dotnet/corefx #19384", TargetFrameworkMonikers.NetFramework)] @@ -283,13 +281,13 @@ namespace MonoTests.System.Configuration Assert.Equal("machine.config", fi.Name); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void GetSectionReturnsNativeObject() { Assert.True(ConfigurationManager.GetSection("appSettings") is NameValueCollection); } - [Fact] // Test for bug #3412 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] // Test for bug #3412 // Doesn't pass on Mono // [Category("NotWorking")] public void TestAddRemoveSection() @@ -345,7 +343,7 @@ namespace MonoTests.System.Configuration } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void TestContext() { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj index 0e5f2b741c..b74cdf5517 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj @@ -11,9 +11,6 @@ - - Common\System\PlatformDetection.cs - Common\System\IO\TempDirectory.cs diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ApplicationSettingsBaseTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ApplicationSettingsBaseTests.cs index 760429f74e..0a43191327 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ApplicationSettingsBaseTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ApplicationSettingsBaseTests.cs @@ -42,8 +42,8 @@ namespace System.ConfigurationTests } } - [Theory - InlineData(true) + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)), + InlineData(true), InlineData(false) ] [ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)] @@ -56,8 +56,8 @@ namespace System.ConfigurationTests Assert.NotNull(settings.Context); } - [Theory - InlineData(true) + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)), + InlineData(true), InlineData(false) ] [ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)] @@ -71,8 +71,8 @@ namespace System.ConfigurationTests Assert.NotNull(settings.Providers[typeof(LocalFileSettingsProvider).Name]); } - [Theory - InlineData(true) + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)), + InlineData(true), InlineData(false) ] [ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)] @@ -87,8 +87,8 @@ namespace System.ConfigurationTests Assert.Equal("Foo", settings.StringProperty); } - [Theory - InlineData(true) + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)), + InlineData(true), InlineData(false) ] [ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)] @@ -103,7 +103,7 @@ namespace System.ConfigurationTests Assert.Equal(10, settings.IntProperty); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] [ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)] public void Reload_SimpleSettings_Ok() { @@ -140,7 +140,7 @@ namespace System.ConfigurationTests { } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] [ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)] public void SettingsProperty_SettingsWithAttributes_Ok() { diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs index cdbb02ba6d..77e5ef7e82 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs @@ -9,25 +9,25 @@ namespace System.ConfigurationTests { public class ConfigPathUtilityTests { - [Theory - InlineData(null, false) - InlineData(@"", false) - InlineData(@"\", false) - InlineData(@"/", false) - InlineData(@".", false) - InlineData(@"..", false) - InlineData(@"a", true) - InlineData(@"a\", false) - InlineData(@"\a", false) - InlineData(@"/a", false) - InlineData(@"a/", false) - InlineData(@"a/b", true) - InlineData(@"a//c", false) - InlineData(@"a\b", false) - InlineData(@"a/b/c", true) - InlineData(@"a/b./c", true) - InlineData(@"a/b../c", true) - InlineData(@"a/../c", false) + [Theory, + InlineData(null, false), + InlineData(@"", false), + InlineData(@"\", false), + InlineData(@"/", false), + InlineData(@".", false), + InlineData(@"..", false), + InlineData(@"a", true), + InlineData(@"a\", false), + InlineData(@"\a", false), + InlineData(@"/a", false), + InlineData(@"a/", false), + InlineData(@"a/b", true), + InlineData(@"a//c", false), + InlineData(@"a\b", false), + InlineData(@"a/b/c", true), + InlineData(@"a/b./c", true), + InlineData(@"a/b../c", true), + InlineData(@"a/../c", false), InlineData(@"a/./c", false) ] public void IsValid(string configPath, bool expected) @@ -35,7 +35,7 @@ namespace System.ConfigurationTests Assert.Equal(expected, ConfigPathUtility.IsValid(configPath)); } - [Theory + [Theory, InlineData(@"a", @"b", @"a/b") ] public void Combine(string parentConfigPath, string childConfigPath, string expected) @@ -43,8 +43,8 @@ namespace System.ConfigurationTests Assert.Equal(expected, ConfigPathUtility.Combine(parentConfigPath, childConfigPath)); } - [Theory - InlineData(@"a", new string[] { "a" }) + [Theory, + InlineData(@"a", new string[] { "a" }), InlineData(@"a/b", new string[] { "a", "b" }) ] public void GetParts(string configPath, string[] expected) @@ -52,10 +52,10 @@ namespace System.ConfigurationTests Assert.Equal(expected, ConfigPathUtility.GetParts(configPath)); } - [Theory - InlineData(@"a", @"a") - InlineData(@"ab", @"ab") - InlineData(@"a/b", @"b") + [Theory, + InlineData(@"a", @"a"), + InlineData(@"ab", @"ab"), + InlineData(@"a/b", @"b"), InlineData(@"a/b/c", @"c") ] public void GetName(string configPath, string expected) diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationElementCollectionTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationElementCollectionTests.cs index d204487f59..ceef8a4d7c 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationElementCollectionTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationElementCollectionTests.cs @@ -47,10 +47,9 @@ namespace System.ConfigurationTests } [Fact] - [ActiveIssue(21004, TargetFrameworkMonikers.UapAot)] public void NullComparerThrows() { - Assert.Equal("comparer", Assert.Throws(() => new SimpleCollection(null)).ParamName); + AssertExtensions.Throws("comparer", () => new SimpleCollection(null)); } [Fact] diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationPropertyTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationPropertyTests.cs index 52a88f2ce3..e4b6bac3eb 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationPropertyTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigurationPropertyTests.cs @@ -34,10 +34,10 @@ namespace System.ConfigurationTests AssertExtensions.Throws("name", () => new ConfigurationProperty("", typeof(string))); } - [Theory - InlineData("lock") - InlineData("locks") - InlineData("config") + [Theory, + InlineData("lock"), + InlineData("locks"), + InlineData("config"), InlineData("configuration") ] public void ReservedNameThrows(string name) @@ -45,11 +45,11 @@ namespace System.ConfigurationTests AssertExtensions.Throws(null, () => new ConfigurationProperty(name, typeof(string))); } - [Theory - InlineData("Lock") - InlineData("ilock") - InlineData("LOCKS") - InlineData("CoNfig") + [Theory, + InlineData("Lock"), + InlineData("ilock"), + InlineData("LOCKS"), + InlineData("CoNfig"), InlineData("conFIGuration") ] public void ReservedNameOrdinallyCompared(string name) @@ -164,8 +164,8 @@ namespace System.ConfigurationTests Assert.IsType(property.Converter); } - [Theory - InlineData(typeof(string), typeof(StringConverter)) + [Theory, + InlineData(typeof(string), typeof(StringConverter)), InlineData(typeof(int), typeof(Int32Converter)) ] public void FindConverterForBuiltInTypes(Type type, Type converterType) diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ImplicitMachineConfigTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ImplicitMachineConfigTests.cs index 96da21403b..047d93c6cd 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ImplicitMachineConfigTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ImplicitMachineConfigTests.cs @@ -10,7 +10,7 @@ namespace System.ConfigurationTests { public class ImplicitMachineConfigTests { - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void RuntimeAppSettingsAccessible() { var appSettings = ConfigurationManager.AppSettings; diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/LocalFileSettingsProviderTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/LocalFileSettingsProviderTests.cs index 3174837bb0..bad25718f5 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/LocalFileSettingsProviderTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/LocalFileSettingsProviderTests.cs @@ -15,7 +15,7 @@ namespace System.ConfigurationTests ["SettingsKey"] = "SettingsKeyFoo" }; - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void GetPropertyValues_NotStoredProperty_ValueEqualsNull() { var property = new SettingsProperty("PropertyName"); @@ -30,7 +30,7 @@ namespace System.ConfigurationTests Assert.Equal(null, propertyValues["PropertyName"].PropertyValue); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] public void GetPropertyValues_NotStoredConnectionStringProperty_ValueEqualsEmptyString() { var property = new SettingsProperty("PropertyName"); diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs index 311d2005d4..d5d4ef548b 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs @@ -9,16 +9,16 @@ namespace System.ConfigurationTests { public class StringUtilTests { - [Theory - InlineData(null, null, true) - InlineData(@"", null, true) - InlineData(null, @"", true) - InlineData(@"", @"", true) - InlineData(@"a", null, false) - InlineData(null, @"a", false) - InlineData(@"a", @"", false) - InlineData(@"", @"a", false) - InlineData(@"A", @"a", false) + [Theory, + InlineData(null, null, true), + InlineData(@"", null, true), + InlineData(null, @"", true), + InlineData(@"", @"", true), + InlineData(@"a", null, false), + InlineData(null, @"a", false), + InlineData(@"a", @"", false), + InlineData(@"", @"a", false), + InlineData(@"A", @"a", false), InlineData(@"a", @"a", true) ] public void EqualsOrBothNullOrEmpty(string s1, string s2, bool expected) @@ -26,16 +26,16 @@ namespace System.ConfigurationTests Assert.Equal(expected, StringUtil.EqualsOrBothNullOrEmpty(s1, s2)); } - [Theory - InlineData(null, null, true) - InlineData(@"", null, false) - InlineData(null, @"", false) - InlineData(@"", @"", true) - InlineData(@"a", null, false) - InlineData(null, @"a", false) - InlineData(@"a", @"", false) - InlineData(@"", @"a", false) - InlineData(@"A", @"a", true) + [Theory, + InlineData(null, null, true), + InlineData(@"", null, false), + InlineData(null, @"", false), + InlineData(@"", @"", true), + InlineData(@"a", null, false), + InlineData(null, @"a", false), + InlineData(@"a", @"", false), + InlineData(@"", @"a", false), + InlineData(@"A", @"a", true), InlineData(@"a", @"a", true) ] public void EqualsIgnoreCase(string s1, string s2, bool expected) @@ -43,20 +43,20 @@ namespace System.ConfigurationTests Assert.Equal(expected, StringUtil.EqualsIgnoreCase(s1, s2)); } - [Theory - InlineData(null, null, false) - InlineData(@"", null, false) - InlineData(null, @"", false) - InlineData(@"", @"", true) - InlineData(@"a", null, false) - InlineData(null, @"a", false) - InlineData(@"a", @"", true) - InlineData(@"", @"a", false) - InlineData(@"A", @"a", false) - InlineData(@"a", @"a", true) - InlineData(@"a", @"abba", false) - InlineData(@"abba", @"ab", true) - InlineData(@"abba", @"abba", true) + [Theory, + InlineData(null, null, false), + InlineData(@"", null, false), + InlineData(null, @"", false), + InlineData(@"", @"", true), + InlineData(@"a", null, false), + InlineData(null, @"a", false), + InlineData(@"a", @"", true), + InlineData(@"", @"a", false), + InlineData(@"A", @"a", false), + InlineData(@"a", @"a", true), + InlineData(@"a", @"abba", false), + InlineData(@"abba", @"ab", true), + InlineData(@"abba", @"abba", true), InlineData(@"ABBA", @"abba", false) ] public void StartsWithOrdinal(string s1, string s2, bool expected) @@ -64,20 +64,20 @@ namespace System.ConfigurationTests Assert.Equal(expected, StringUtil.StartsWithOrdinal(s1, s2)); } - [Theory - InlineData(null, null, false) - InlineData(@"", null, false) - InlineData(null, @"", false) - InlineData(@"", @"", true) - InlineData(@"a", null, false) - InlineData(null, @"a", false) - InlineData(@"a", @"", true) - InlineData(@"", @"a", false) - InlineData(@"A", @"a", true) - InlineData(@"a", @"a", true) - InlineData(@"a", @"abba", false) - InlineData(@"abba", @"ab", true) - InlineData(@"abba", @"abba", true) + [Theory, + InlineData(null, null, false), + InlineData(@"", null, false), + InlineData(null, @"", false), + InlineData(@"", @"", true), + InlineData(@"a", null, false), + InlineData(null, @"a", false), + InlineData(@"a", @"", true), + InlineData(@"", @"a", false), + InlineData(@"A", @"a", true), + InlineData(@"a", @"a", true), + InlineData(@"a", @"abba", false), + InlineData(@"abba", @"ab", true), + InlineData(@"abba", @"abba", true), InlineData(@"ABBA", @"abba", true) ] public void StartsWithOrdinalIgnoreCase(string s1, string s2, bool expected) @@ -85,7 +85,7 @@ namespace System.ConfigurationTests Assert.Equal(expected, StringUtil.StartsWithOrdinalIgnoreCase(s1, s2)); } - [Theory + [Theory, InlineData(new object[] { "1", "2", "3" }, new string[] { "1", "2", "3" } ) ] public void ObjectArrayToStringArray(object[] objectArray, string[] expected) diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs index 7de3d4e435..0aee3fe677 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs @@ -9,11 +9,11 @@ namespace System.ConfigurationTests { public class ValidatiorUtilsTests { - [Theory - InlineData(@"a", typeof(string), false) - InlineData(null, typeof(string), false) - InlineData(@"a", typeof(int), true) - InlineData(1, typeof(string), true) + [Theory, + InlineData(@"a", typeof(string), false), + InlineData(null, typeof(string), false), + InlineData(@"a", typeof(int), true), + InlineData(1, typeof(string), true), ] public void HelperParamValidation(object value, Type allowedType, bool shouldThrow) { @@ -28,22 +28,22 @@ namespace System.ConfigurationTests } } - [Theory + [Theory, // Exclusive in range - InlineData(1, 1, 1, 1, true, true, "Validation_scalar_range_violation_not_different") - InlineData(1, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range") - InlineData(2, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range") + InlineData(1, 1, 1, 1, true, true, "Validation_scalar_range_violation_not_different"), + InlineData(1, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range"), + InlineData(2, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range"), // Not exclusive in range - InlineData(1, 1, 1, 1, false, false, null) - InlineData(1, 1, 2, 1, false, false, null) - InlineData(2, 1, 2, 1, false, false, null) + InlineData(1, 1, 1, 1, false, false, null), + InlineData(1, 1, 2, 1, false, false, null), + InlineData(2, 1, 2, 1, false, false, null), // Exclusive out of range - InlineData(2, 1, 1, 1, true, false, null) - InlineData(3, 1, 2, 1, true, false, null) - InlineData(3, 1, 2, 1, true, false, null) + InlineData(2, 1, 1, 1, true, false, null), + InlineData(3, 1, 2, 1, true, false, null), + InlineData(3, 1, 2, 1, true, false, null), // Not exclusive out of range - InlineData(2, 1, 1, 1, false, true, "Validation_scalar_range_violation_not_equal") - InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range") + InlineData(2, 1, 1, 1, false, true, "Validation_scalar_range_violation_not_equal"), + InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range"), InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range") ] public void ValidateIntScalar(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message) @@ -61,8 +61,8 @@ namespace System.ConfigurationTests } } - [Theory - InlineData(1, 1, 1, 1, false, false, null) + [Theory, + InlineData(1, 1, 1, 1, false, false, null), InlineData(1, 1, 1, 2, false, true, "Validator_scalar_resolution_violation") ] public void ValidateIntBadResolution(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message) diff --git a/external/corefx/src/System.Console/src/System.Console.csproj b/external/corefx/src/System.Console/src/System.Console.csproj index 562aa9d9aa..7ab6906fba 100644 --- a/external/corefx/src/System.Console/src/System.Console.csproj +++ b/external/corefx/src/System.Console/src/System.Console.csproj @@ -231,6 +231,9 @@ Common\Interop\Unix\Interop.OpenFlags.cs + + Common\Interop\Unix\Interop.Poll.cs + Common\Interop\Unix\Interop.GetEUid.cs diff --git a/external/corefx/src/System.Console/src/System/Console.cs b/external/corefx/src/System.Console/src/System/Console.cs index 6888931682..9452d64372 100644 --- a/external/corefx/src/System.Console/src/System/Console.cs +++ b/external/corefx/src/System.Console/src/System/Console.cs @@ -163,9 +163,15 @@ namespace System set { ConsolePal.CursorSize = value; } } - public static bool NumberLock { get { return ConsolePal.NumberLock; } } + public static bool NumberLock + { + get { return ConsolePal.NumberLock; } + } - public static bool CapsLock { get { return ConsolePal.CapsLock; } } + public static bool CapsLock + { + get { return ConsolePal.CapsLock; } + } internal const ConsoleColor UnknownColor = (ConsoleColor)(-1); @@ -217,26 +223,14 @@ namespace System public static int WindowWidth { - get - { - return ConsolePal.WindowWidth; - } - set - { - ConsolePal.WindowWidth = value; - } + get { return ConsolePal.WindowWidth; } + set { ConsolePal.WindowWidth = value; } } public static int WindowHeight { - get - { - return ConsolePal.WindowHeight; - } - set - { - ConsolePal.WindowHeight = value; - } + get { return ConsolePal.WindowHeight; } + set { ConsolePal.WindowHeight = value; } } public static void SetWindowPosition(int left, int top) diff --git a/external/corefx/src/System.Console/src/System/ConsolePal.Unix.cs b/external/corefx/src/System.Console/src/System/ConsolePal.Unix.cs index aa42280837..7be909bab5 100644 --- a/external/corefx/src/System.Console/src/System/ConsolePal.Unix.cs +++ b/external/corefx/src/System.Console/src/System/ConsolePal.Unix.cs @@ -977,6 +977,17 @@ namespace System // that ended, so simply pretend we were successful. return; } + else if (errorInfo.Error == Interop.Error.EAGAIN) // aka EWOULDBLOCK + { + // May happen if the file handle is configured as non-blocking. + // In that case, we need to wait to be able to write and then + // try again. We poll, but don't actually care about the result, + // only the blocking behavior, and thus ignore any poll errors + // and loop around to do another write (which may correctly fail + // if something else has gone wrong). + Interop.Sys.Poll(fd, Interop.Sys.PollEvents.POLLOUT, Timeout.Infinite, out Interop.Sys.PollEvents triggered); + continue; + } else { // Something else... fail. @@ -1063,14 +1074,14 @@ namespace System ValidateRead(buffer, offset, count); return ConsolePal.Read(_handle, buffer, offset, count); - } + } public override void Write(byte[] buffer, int offset, int count) { ValidateWrite(buffer, offset, count); ConsolePal.Write(_handle, buffer, offset, count); - } + } public override void Flush() { diff --git a/external/corefx/src/System.Console/src/System/ConsolePal.Windows.cs b/external/corefx/src/System.Console/src/System/ConsolePal.Windows.cs index ce7e440426..605898b966 100644 --- a/external/corefx/src/System.Console/src/System/ConsolePal.Windows.cs +++ b/external/corefx/src/System.Console/src/System/ConsolePal.Windows.cs @@ -1207,7 +1207,8 @@ namespace System { int numBytesWritten; writeSuccess = (0 != Interop.Kernel32.WriteFile(hFile, p + offset, count, out numBytesWritten, IntPtr.Zero)); - Debug.Assert(!writeSuccess || count == numBytesWritten); + // In some cases we have seen numBytesWritten returned that is twice count; + // so we aren't asserting the value of it. See corefx #24508 } else { @@ -1227,7 +1228,7 @@ namespace System // For pipes that are closing or broken, just stop. // (E.g. ERROR_NO_DATA ("pipe is being closed") is returned when we write to a console that is closing; - // ERROR_BROKEN_PIPE ("pipe was closed") is returned when stdin was closed, which is mot an error, but EOF.) + // ERROR_BROKEN_PIPE ("pipe was closed") is returned when stdin was closed, which is not an error, but EOF.) int errorCode = Marshal.GetLastWin32Error(); if (errorCode == Interop.Errors.ERROR_NO_DATA || errorCode == Interop.Errors.ERROR_BROKEN_PIPE) return Interop.Errors.ERROR_SUCCESS; diff --git a/external/corefx/src/System.Console/tests/NegativeTesting.cs b/external/corefx/src/System.Console/tests/NegativeTesting.cs index 6619897f4e..9315e76a4b 100644 --- a/external/corefx/src/System.Console/tests/NegativeTesting.cs +++ b/external/corefx/src/System.Console/tests/NegativeTesting.cs @@ -8,13 +8,13 @@ using Xunit; public class NegativeTesting { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWinRT))] // In appcontainer, the stream cannot be opened: there is no Console + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsInAppContainer))] // In appcontainer, the stream cannot be opened: there is no Console public static void OpenStandardOutNegativeTests_Uap() { Assert.Same(Stream.Null, Console.OpenStandardOutput()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWinRT))] // In appcontainer, the stream cannot be opened: there is no Console + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsInAppContainer))] // In appcontainer, the stream cannot be opened: there is no Console public static void OpenStandardErrorNegativeTests_Uap() { Assert.Same(Stream.Null, Console.OpenStandardError()); diff --git a/external/corefx/src/System.Console/tests/NonStandardConfiguration.Unix.cs b/external/corefx/src/System.Console/tests/NonStandardConfiguration.Unix.cs new file mode 100644 index 0000000000..03c681b645 --- /dev/null +++ b/external/corefx/src/System.Console/tests/NonStandardConfiguration.Unix.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Linq; +using Xunit; + +namespace System.Tests +{ + public partial class NonStandardConfigurationTests : RemoteExecutorTestBase + { + [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes + [Fact] + public void NonBlockingStdout_AllDataReceived() + { + RemoteInvokeHandle remote = RemoteInvoke(() => + { + char[] data = Enumerable.Repeat('a', 1024).ToArray(); + + const int StdoutFd = 1; + Assert.Equal(0, Interop.Sys.Fcntl.DangerousSetIsNonBlocking((IntPtr)StdoutFd, 1)); + + for (int i = 0; i < 10_000; i++) + { + Console.Write(data); + } + + return SuccessExitCode; + }, new RemoteInvokeOptions { StartInfo = new ProcessStartInfo() { RedirectStandardOutput = true } }); + + using (remote) + { + Assert.Equal( + new string('a', 1024 * 10_000), + remote.Process.StandardOutput.ReadToEnd()); + } + } + } +} diff --git a/external/corefx/src/System.Console/tests/Performance/Configurations.props b/external/corefx/src/System.Console/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Console/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Console/tests/System.Console.Tests.csproj b/external/corefx/src/System.Console/tests/System.Console.Tests.csproj index 2ce0244bd2..ec59ce57e9 100644 --- a/external/corefx/src/System.Console/tests/System.Console.Tests.csproj +++ b/external/corefx/src/System.Console/tests/System.Console.Tests.csproj @@ -11,11 +11,7 @@ - - Common\tests\System\PlatformDetection.cs - - @@ -25,7 +21,6 @@ - @@ -42,6 +37,19 @@ + + + + + + + + Common\Interop\Windows\Interop.Libraries.cs + + + Interop\Unix\System.Native\Interop.Fcntl.cs + + {69e46a6f-9966-45a5-8945-2559fe337827} @@ -49,4 +57,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Console/tests/WindowAndCursorProps.cs b/external/corefx/src/System.Console/tests/WindowAndCursorProps.cs index edeb605842..00e63a3ce2 100644 --- a/external/corefx/src/System.Console/tests/WindowAndCursorProps.cs +++ b/external/corefx/src/System.Console/tests/WindowAndCursorProps.cs @@ -139,7 +139,7 @@ public class WindowAndCursorProps : RemoteExecutorTestBase Assert.NotNull(Console.Title); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // Nano currently ignores set title + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // Nano currently ignores set title [InlineData(0)] [InlineData(1)] [InlineData(255)] @@ -154,7 +154,16 @@ public class WindowAndCursorProps : RemoteExecutorTestBase { string newTitle = new string('a', int.Parse(lengthOfTitleString)); Console.Title = newTitle; - Assert.Equal(newTitle, Console.Title); + + if (newTitle.Length > 513 && PlatformDetection.IsWindowsRedStone2) + { + // RS2 has a bug when getting the window title when the title length is longer than 513 character + Assert.Throws(() => Console.Title); + } + else + { + Assert.Equal(newTitle, Console.Title); + } return SuccessExitCode; }, lengthOfTitle.ToString()).Dispose(); } @@ -356,7 +365,7 @@ public class WindowAndCursorProps : RemoteExecutorTestBase } [PlatformSpecific(TestPlatforms.Windows)] - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void SetWindowSize_GetWindowSize_ReturnsExpected() { if (!Console.IsInputRedirected && !Console.IsOutputRedirected) diff --git a/external/corefx/src/System.Data.Common/dir.props b/external/corefx/src/System.Data.Common/dir.props index b5dea7fb76..b89fb6fc11 100644 --- a/external/corefx/src/System.Data.Common/dir.props +++ b/external/corefx/src/System.Data.Common/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Data.Common/ref/Configurations.props b/external/corefx/src/System.Data.Common/ref/Configurations.props index 192309fce5..c701755863 100644 --- a/external/corefx/src/System.Data.Common/ref/Configurations.props +++ b/external/corefx/src/System.Data.Common/ref/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap; diff --git a/external/corefx/src/System.Data.Common/ref/System.Data.Common.csproj b/external/corefx/src/System.Data.Common/ref/System.Data.Common.csproj index 0040e706fc..f3525231a9 100644 --- a/external/corefx/src/System.Data.Common/ref/System.Data.Common.csproj +++ b/external/corefx/src/System.Data.Common/ref/System.Data.Common.csproj @@ -7,8 +7,6 @@ - - diff --git a/external/corefx/src/System.Data.Common/src/Configurations.props b/external/corefx/src/System.Data.Common/src/Configurations.props index c172e09c79..f1e1082d04 100644 --- a/external/corefx/src/System.Data.Common/src/Configurations.props +++ b/external/corefx/src/System.Data.Common/src/Configurations.props @@ -4,7 +4,6 @@ uap-Windows_NT; netcoreapp; - netfx; uapaot-Windows_NT; diff --git a/external/corefx/src/System.Data.Common/src/System.Data.Common.csproj b/external/corefx/src/System.Data.Common/src/System.Data.Common.csproj index 2f897127f4..f510044d98 100644 --- a/external/corefx/src/System.Data.Common/src/System.Data.Common.csproj +++ b/external/corefx/src/System.Data.Common/src/System.Data.Common.csproj @@ -7,12 +7,11 @@ true AnyCPU true + $(DefineConstants);netfx $(DefineConstants);uapaot - - diff --git a/external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnection.cs b/external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnection.cs index 38d6478e81..14bc4280ac 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnection.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnection.cs @@ -10,7 +10,9 @@ namespace System.Data.Common { public abstract partial class DbConnection : Component, IDbConnection { +#pragma warning disable 649 // ignore unassigned field warning internal bool _suppressStateChangeForReconnection; +#pragma warning restore 649 protected DbConnection() : base() { diff --git a/external/corefx/src/System.Data.Common/src/System/Data/ConstraintCollection.cs b/external/corefx/src/System.Data.Common/src/System/Data/ConstraintCollection.cs index 6df9d1e4d7..aa0c6e806d 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/ConstraintCollection.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/ConstraintCollection.cs @@ -498,7 +498,7 @@ namespace System.Data } /// - /// Returns a matching constriant object. + /// Returns a matching constraint object. /// internal Constraint FindConstraint(Constraint constraint) { @@ -512,7 +512,7 @@ namespace System.Data } /// - /// Returns a matching constriant object. + /// Returns a matching constraint object. /// internal UniqueConstraint FindKeyConstraint(DataColumn[] columns) { @@ -529,7 +529,7 @@ namespace System.Data } /// - /// Returns a matching constriant object. + /// Returns a matching constraint object. /// internal UniqueConstraint FindKeyConstraint(DataColumn column) { @@ -544,7 +544,7 @@ namespace System.Data } /// - /// Returns a matching constriant object. + /// Returns a matching constraint object. /// internal ForeignKeyConstraint FindForeignKeyConstraint(DataColumn[] parentColumns, DataColumn[] childColumns) { diff --git a/external/corefx/src/System.Data.Common/src/System/Data/ConstraintConverter.cs b/external/corefx/src/System.Data.Common/src/System/Data/ConstraintConverter.cs index 2e21a24573..47e14f2bff 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/ConstraintConverter.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/ConstraintConverter.cs @@ -25,7 +25,7 @@ namespace System.Data /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination - /// type is string. If this cannot convert to the desitnation type, this will + /// type is string. If this cannot convert to the destination type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataColumn.cs b/external/corefx/src/System.Data.Common/src/System/Data/DataColumn.cs index d7fa68076c..aaaa05c6f7 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataColumn.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataColumn.cs @@ -79,7 +79,7 @@ namespace System.Data } /// - /// Inititalizes a new instance of the class + /// Initializes a new instance of the class /// using the specified column name. /// public DataColumn(string columnName) : this(columnName, typeof(string), null, MappingType.Element) @@ -87,7 +87,7 @@ namespace System.Data } /// - /// Inititalizes a new instance of the class + /// Initializes a new instance of the class /// using the specified column name and data type. /// public DataColumn(string columnName, Type dataType) : this(columnName, dataType, null, MappingType.Element) @@ -468,7 +468,7 @@ namespace System.Data internal DataExpression DataExpression => _expression; /// - /// The type of data stored in thecolumn. + /// The type of data stored in the column. /// [DefaultValue(typeof(string))] [RefreshProperties(RefreshProperties.All)] @@ -699,7 +699,7 @@ namespace System.Data internal void BindExpression() => DataExpression.Bind(_table); /// - /// Gets or sets the expresssion used to either filter rows, calculate the column's + /// Gets or sets the expression used to either filter rows, calculate the column's /// value, or create an aggregate column. /// [RefreshProperties(RefreshProperties.All)] @@ -1767,7 +1767,7 @@ namespace System.Data internal object ConvertXmlToObject(string s) { - Debug.Assert(s != null, "Caller is resposible for missing element/attribure case"); + Debug.Assert(s != null, "Caller is resposible for missing element/attribute case"); InsureStorage(); return _storage.ConvertXmlToObject(s); } diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataRelation.cs b/external/corefx/src/System.Data.Common/src/System/Data/DataRelation.cs index a744452b4a..8cf43a625e 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataRelation.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataRelation.cs @@ -53,12 +53,12 @@ namespace System.Data internal string _childTableNamespace = null; /// - /// this stores whether the child element appears beneath the parent in the XML persised files. + /// This stores whether the child element appears beneath the parent in the XML persisted files. /// internal bool _nested = false; /// - /// this stores whether the relationship should make sure that KeyConstraints and ForeignKeyConstraints + /// This stores whether the relationship should make sure that KeyConstraints and ForeignKeyConstraints /// exist when added to the ConstraintsCollections of the table. /// internal bool _createConstraints; diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataRowView.cs b/external/corefx/src/System.Data.Common/src/System/Data/DataRowView.cs index f73fbecb44..cb9cd2678e 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataRowView.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataRowView.cs @@ -64,7 +64,7 @@ namespace System.Data /// Gets the specified column value or related child view or sets a value in specified column. /// Specified column or relation name when getting. Specified column name when setting. - /// when is ambigous. + /// when is ambiguous. /// Unmatched when getting a value. /// Unmatched when setting a value. /// when setting a value. diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataSet.cs.REMOVED.git-id b/external/corefx/src/System.Data.Common/src/System/Data/DataSet.cs.REMOVED.git-id index c0b95853ac..496a369a12 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataSet.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataSet.cs.REMOVED.git-id @@ -1 +1 @@ -eb1a16daf6818fe2c70a8c33b36ee0e20cc05351 \ No newline at end of file +29c7d82939cbf918f4b0c4f291551c1ed37cec38 \ No newline at end of file diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataTable.cs.REMOVED.git-id b/external/corefx/src/System.Data.Common/src/System/Data/DataTable.cs.REMOVED.git-id index 8a9873c9f3..3b9447a777 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataTable.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataTable.cs.REMOVED.git-id @@ -1 +1 @@ -9f3b04d44b6402875d4d79420cf0f53cc2820775 \ No newline at end of file +3079e9ab6fb29508e64831341117dc6ee1503e6d \ No newline at end of file diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataView.cs b/external/corefx/src/System.Data.Common/src/System/Data/DataView.cs index f9613b95de..97be9cb86a 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataView.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataView.cs @@ -27,7 +27,7 @@ namespace System.Data private string _sort = string.Empty; - /// Allow a user implemented comparision of two DataRow + /// Allow a user implemented comparison of two DataRow /// User must use correct DataRowVersion in comparison or index corruption will happen private System.Comparison _comparison; @@ -70,7 +70,7 @@ namespace System.Data private Dictionary _rowViewCache = new Dictionary(DataRowReferenceComparer.s_default); /// - /// This collection allows expression maintaince to (add / remove) from the index when it really should be a (change / move). + /// This collection allows expression maintenance to (add / remove) from the index when it really should be a (change / move). /// private readonly Dictionary _rowViewBuffer = new Dictionary(DataRowReferenceComparer.s_default); @@ -419,7 +419,7 @@ namespace System.Data } } - /// Allow a user implemented comparision of two DataRow + /// Allow a user implemented comparison of two DataRow /// User must use correct DataRowVersion in comparison or index corruption will happen internal System.Comparison SortComparison { diff --git a/external/corefx/src/System.Data.Common/src/System/Data/DataViewManagerListItemTypeDescriptor.cs b/external/corefx/src/System.Data.Common/src/System/Data/DataViewManagerListItemTypeDescriptor.cs index 69ba9362dd..cbeb8158d6 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/DataViewManagerListItemTypeDescriptor.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/DataViewManagerListItemTypeDescriptor.cs @@ -123,7 +123,7 @@ namespace System.Data /// Retrieves the object that directly depends on this value being edited. This is /// generally the object that is required for the PropertyDescriptor's GetValue and SetValue /// methods. If 'null' is passed for the PropertyDescriptor, the ICustomComponent - /// descripotor implemementation should return the default object, that is the main + /// descriptor implementation should return the default object, that is the main /// object that exposes the properties and attributes, /// object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) => this; diff --git a/external/corefx/src/System.Data.Common/src/System/Data/Filter/BinaryNode.cs b/external/corefx/src/System.Data.Common/src/System/Data/Filter/BinaryNode.cs index 53ca05fb19..7c2876f76e 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/Filter/BinaryNode.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/Filter/BinaryNode.cs @@ -1096,7 +1096,7 @@ namespace System.Data if ((vRight == DBNull.Value) || (right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight))) continue; - Debug.Assert((!DataStorage.IsObjectNull(vLeft)) && (!DataStorage.IsObjectNull(vRight)), "Imposible.."); + Debug.Assert((!DataStorage.IsObjectNull(vLeft)) && (!DataStorage.IsObjectNull(vRight)), "Impossible."); resultType = DataStorage.GetStorageType(vLeft.GetType()); diff --git a/external/corefx/src/System.Data.Common/src/System/Data/Filter/Operators.cs b/external/corefx/src/System.Data.Common/src/System/Data/Filter/Operators.cs index efe5271303..587746679d 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/Filter/Operators.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/Filter/Operators.cs @@ -119,8 +119,8 @@ namespace System.Data internal const int priMax = 24; /// - /// Mapping from Operator to prioritys - /// CONSIDER: fast, but hard to maitain + /// Mapping from Operator to priorities + /// CONSIDER: fast, but hard to maintain /// private static readonly int[] s_priority = new int[] { diff --git a/external/corefx/src/System.Data.Common/src/System/Data/RecordManager.cs b/external/corefx/src/System.Data.Common/src/System/Data/RecordManager.cs index 39fa405087..fdf29db5b7 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/RecordManager.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/RecordManager.cs @@ -267,7 +267,7 @@ namespace System.Data [Conditional("DEBUG")] internal void VerifyRecord(int record) { - Debug.Assert((record < _lastFreeRecord) && (-1 == _freeRecordList.IndexOf(record)), "accesing free record"); + Debug.Assert((record < _lastFreeRecord) && (-1 == _freeRecordList.IndexOf(record)), "accessing free record"); Debug.Assert((null == _rows[record]) || (record == _rows[record]._oldRecord) || (record == _rows[record]._newRecord) || @@ -277,7 +277,7 @@ namespace System.Data [Conditional("DEBUG")] internal void VerifyRecord(int record, DataRow row) { - Debug.Assert((record < _lastFreeRecord) && (-1 == _freeRecordList.IndexOf(record)), "accesing free record"); + Debug.Assert((record < _lastFreeRecord) && (-1 == _freeRecordList.IndexOf(record)), "accessing free record"); Debug.Assert((null == _rows[record]) || (row == _rows[record]), "record of a different row"); } } diff --git a/external/corefx/src/System.Data.Common/src/System/Data/RelationshipConverter.cs b/external/corefx/src/System.Data.Common/src/System/Data/RelationshipConverter.cs index 20813e5b21..56b4800b6c 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/RelationshipConverter.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/RelationshipConverter.cs @@ -32,7 +32,7 @@ namespace System.Data /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination - /// type is string. If this cannot convert to the desitnation type, this will + /// type is string. If this cannot convert to the destination type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) diff --git a/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs b/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs index 506a0064dc..9d14092823 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLDouble.cs @@ -36,8 +36,14 @@ namespace System.Data.SqlTypes public SqlDouble(double value) { +#if !netfx + if (!double.IsFinite(value)) +#else if (double.IsInfinity(value) || double.IsNaN(value)) +#endif + { throw new OverflowException(SQLResource.ArithOverflowMessage); + } else { m_value = value; diff --git a/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs b/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs index 643ff22407..42620035b6 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs @@ -32,8 +32,14 @@ namespace System.Data.SqlTypes public SqlSingle(float value) { +#if !netfx + if (!float.IsFinite(value)) +#else if (float.IsInfinity(value) || float.IsNaN(value)) +#endif + { throw new OverflowException(SQLResource.ArithOverflowMessage); + } else { _fNotNull = true; diff --git a/external/corefx/src/System.Data.Common/src/System/Data/Selection.cs b/external/corefx/src/System.Data.Common/src/System/Data/Selection.cs index 9b80d410e4..6d1bd1a6da 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/Selection.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/Selection.cs @@ -63,7 +63,7 @@ namespace System.Data private readonly DataTable _table; internal readonly IndexField[] _indexFields; - /// Allow a user implemented comparision of two DataRow + /// Allow a user implemented comparison of two DataRow /// User must use correct DataRowVersion in comparison or index corruption will happen private readonly System.Comparison _comparison; @@ -439,7 +439,7 @@ namespace System.Data /// /// When searching by value for a specific record, the DataRow may require backdating to reflect the appropriate state /// otherwise on Delete of a DataRow in the Added state, would result in the where the row - /// reflection record would be in the Detatched instead of Added state. + /// reflection record would be in the Detached instead of Added state. /// private int GetIndex(int record, int changeRecord) { diff --git a/external/corefx/src/System.Data.Common/src/System/Data/XmlToDatasetMap.cs b/external/corefx/src/System.Data.Common/src/System/Data/XmlToDatasetMap.cs index 24ddadb947..54c1aba1e6 100644 --- a/external/corefx/src/System.Data.Common/src/System/Data/XmlToDatasetMap.cs +++ b/external/corefx/src/System.Data.Common/src/System/Data/XmlToDatasetMap.cs @@ -36,7 +36,7 @@ namespace System.Data } } - // This class exist to avoid alocatin of XmlNodeIdentety to every acces to the hash table. + // This class exist to avoid alocatin of XmlNodeIdentety to every access to the hash table. // Unfortunetely XmlNode doesn't export single identety object. internal sealed class XmlNodeIdHashtable : Hashtable { diff --git a/external/corefx/src/System.Data.Common/src/System/Xml/XPathNodePointer.cs b/external/corefx/src/System.Data.Common/src/System/Xml/XPathNodePointer.cs index 57dc9a9f3c..6887fc7c9d 100644 --- a/external/corefx/src/System.Data.Common/src/System/Xml/XPathNodePointer.cs +++ b/external/corefx/src/System.Data.Common/src/System/Xml/XPathNodePointer.cs @@ -417,7 +417,7 @@ namespace System.Xml { colVal = row[col]; if (colVal == DBNull.Value) - break; //goto its ancesstors + break; //goto its ancestor return (string)colVal; } } @@ -1324,7 +1324,7 @@ namespace System.Xml //The function only helps to find out if there is a namespace declaration of given name is defined on the given node - //It will not check the accestors of the given node. + //It will not check the ancestor of the given node. private string GetNamespace(XmlBoundElement be, string name) { if (be == null) @@ -1619,7 +1619,7 @@ namespace System.Xml node = node.ParentNode; } while (node != null && node.NodeType != XmlNodeType.Element); } - // till now, node should be the next accesstor (bound) element of the element parent of current namespace node (attribute or data column) + // till now, node should be the next ancestor (bound) element of the element parent of current namespace node (attribute or data column) while (node != null) { //try the namespace attributes from the same element diff --git a/external/corefx/src/System.Data.Common/tests/System.Data.Common.Tests.csproj b/external/corefx/src/System.Data.Common/tests/System.Data.Common.Tests.csproj index 00f409e47d..ab5a69e6d0 100644 --- a/external/corefx/src/System.Data.Common/tests/System.Data.Common.Tests.csproj +++ b/external/corefx/src/System.Data.Common/tests/System.Data.Common.Tests.csproj @@ -8,6 +8,7 @@ + @@ -104,15 +105,18 @@ Common\System\Diagnostics\Tracing\TestEventListener.cs - - System\PlatformDetection.cs - System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs + + + {69e46a6f-9966-45a5-8945-2559fe337827} + RemoteExecutorConsoleApp + + - + \ No newline at end of file diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingCollectionTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingCollectionTest.cs index 3e5e4c6df4..9703a0df11 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingCollectionTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingCollectionTest.cs @@ -25,7 +25,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using Xunit; -using System; +using System.Collections; using System.Data.Common; namespace System.Data.Tests.Common @@ -472,11 +472,11 @@ namespace System.Data.Tests.Common Array array = null; DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); - Assert.Throws(() => dataColumnMappingCollection.AddRange(array)); + AssertExtensions.Throws("values", () => dataColumnMappingCollection.AddRange(array)); } [Fact] - public void This_String_SetAndGetOK() + public void Indexer_String_SetAndGetOK() { DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); dataColumnMappingCollection.Add(new DataColumnMapping("sourcePIN", "dataSetPIN")); @@ -485,5 +485,90 @@ namespace System.Data.Tests.Common DataColumnMapping dataColumnMapping = dataColumnMappingCollection["sourcePIN"]; Assert.Equal("dataSetPINSet", dataColumnMapping.DataSetColumn); } + + [Fact] + public void CopyTo_Array_Int_Success() + { + Array array = new DataColumnMapping[1]; + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + dataColumnMappingCollection.Add(new DataColumnMapping("sourcePIN", "dataSetPIN")); + IEnumerator enumerator = array.GetEnumerator(); + enumerator.MoveNext(); + Assert.Null(enumerator.Current); + + dataColumnMappingCollection.CopyTo(array, 0); + + enumerator = array.GetEnumerator(); + enumerator.MoveNext(); + Assert.Equal("dataSetPIN", ((DataColumnMapping)enumerator.Current).DataSetColumn); + } + + [Fact] + public void GetEnumerator_Success() + { + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + dataColumnMappingCollection.Add(new DataColumnMapping("a", "b")); + + IEnumerator enumerator = dataColumnMappingCollection.GetEnumerator(); + + Assert.True(enumerator.MoveNext()); + Assert.Equal("b", ((DataColumnMapping)enumerator.Current).DataSetColumn); + Assert.False(enumerator.MoveNext()); + } + + [Fact] + public void Insert_Int_Object_Success() + { + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + Assert.Equal(0, dataColumnMappingCollection.Count); + + dataColumnMappingCollection.Insert(0, (object)new DataColumnMapping("sourcePIN", "dataSetPIN")); + + Assert.Equal(1, dataColumnMappingCollection.Count); + Assert.Equal("dataSetPIN", dataColumnMappingCollection["sourcePIN"].DataSetColumn); + } + + [Fact] + public void Remove_Object_Success() + { + DataColumnMapping dataColumnMapping = new DataColumnMapping("sourcePIN", "dataSetPIN"); + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + dataColumnMappingCollection.Add(dataColumnMapping); + Assert.Equal(1, dataColumnMappingCollection.Count); + + dataColumnMappingCollection.Remove((object)dataColumnMapping); + + Assert.Equal(0, dataColumnMappingCollection.Count); + } + + [Fact] + public void Remove_Object_PassingNullThrowsException() + { + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + + AssertExtensions.Throws("value", () => dataColumnMappingCollection.Remove((object)null)); + } + + [Fact] + public void Indexer_Int_SetAndGetOK() + { + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + dataColumnMappingCollection.Add(new DataColumnMapping("sourcePIN", "dataSetPIN")); + + dataColumnMappingCollection[0] = new DataColumnMapping("sourcePIN", "dataSetPINSet"); + DataColumnMapping dataColumnMapping = dataColumnMappingCollection[0]; + Assert.Equal("dataSetPINSet", dataColumnMapping.DataSetColumn); + } + + [Fact] + public void GetDataColumn_DataColumnMappingCollection_String_Type_DataTable_MissingMappingAction_MissingSchemaAction() + { + DataColumnMappingCollection dataColumnMappingCollection = new DataColumnMappingCollection(); + dataColumnMappingCollection.Add(new DataColumnMapping("sourcePIN", "dataSetPIN")); + + DataColumn dataColumn = DataColumnMappingCollection.GetDataColumn(dataColumnMappingCollection, "sourcePIN", null, new DataTable(), MissingMappingAction.Ignore, MissingSchemaAction.Ignore); + + Assert.Null(dataColumn); + } } } diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingTest.cs new file mode 100644 index 0000000000..d3237debd6 --- /dev/null +++ b/external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingTest.cs @@ -0,0 +1,70 @@ +using System.Data.Common; +using Xunit; + +namespace System.Data.Tests.Common +{ + public class DataColumnMappingTest + { + [Fact] + public void DataSetColumn_Get_WhenNotSet() + { + DataColumnMapping dataColumnMapping = new DataColumnMapping(); + + string dataSetColumn = dataColumnMapping.DataSetColumn; + + Assert.Equal(string.Empty, dataSetColumn); + } + + [Fact] + public void SourceColumn_Get_WhenNotSet() + { + DataColumnMapping dataColumnMapping = new DataColumnMapping(); + + string sourceColumn = dataColumnMapping.SourceColumn; + + Assert.Equal(string.Empty, sourceColumn); + } + + [Fact] + public void GetDataColumnBySchemaAction_String_String_DataTable_Type_MissingSchemaAction_MissingDataTableThrowsException() + { + AssertExtensions.Throws("dataTable", () => DataColumnMapping.GetDataColumnBySchemaAction("", "", null, typeof(string), new MissingSchemaAction())); + } + + [Fact] + public void GetDataColumnBySchemaAction_String_String_DataTable_Type_MissingSchemaAction_MissingDataSetColumnReturnsNull() + { + DataColumn dataColumn = DataColumnMapping.GetDataColumnBySchemaAction("", null, new DataTable(), typeof(string), new MissingSchemaAction()); + + Assert.Null(dataColumn); + } + + [Fact] + public void GetDataColumnBySchemaAction_String_String_DataTable_Type_MissingSchemaAction_DataColumnExpressionExistsThrowsException() + { + DataColumn priceColumn = new DataColumn(); + priceColumn.DataType = typeof(decimal); + priceColumn.ColumnName = "price"; + priceColumn.DefaultValue = 50; + + DataColumn taxColumn = new DataColumn(); + taxColumn.DataType = typeof(decimal); + taxColumn.ColumnName = "tax"; + taxColumn.Expression = "price * 0.0862"; + + DataTable dataTable = new DataTable(); + dataTable.Columns.Add(priceColumn); + dataTable.Columns.Add(taxColumn); + + Assert.Throws(() => DataColumnMapping.GetDataColumnBySchemaAction("", "tax", dataTable, typeof(string), new MissingSchemaAction())); + } + + [Fact] + public void ToString_OK() + { + DataColumnMapping dataColumnMapping = new DataColumnMapping("the source", ""); + + Assert.Equal("the source", dataColumnMapping.ToString()); + } + } +} diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs index b938de71a4..f7aea15b3b 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs @@ -21,6 +21,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. +using System.IO; using Xunit; namespace System.Data.Tests.Common @@ -45,101 +46,95 @@ namespace System.Data.Tests.Common Assert.Equal(3, testData.Rows.Count); } -#if NET_4_5 [Fact] - public void GetFieldValueTest () + public void GetFieldValueTest() { //First row - dataReader.Read (); - Assert.Equal ("row_1", dataReader.GetFieldValue (0)); + _dataReader.Read(); + Assert.Equal("row_1", _dataReader.GetFieldValue(0)); byte[] expected_data = new byte[] { 0xde, 0xad, 0xbe, 0xef }; - byte[] actual_data = dataReader.GetFieldValue (1); - Assert.Equal (expected_data.Length, actual_data.Length); - for (int i = 0; i < expected_data.Length; i++) { - Assert.Equal (expected_data [i], actual_data [i]); + byte[] actual_data = _dataReader.GetFieldValue(1); + Assert.Equal(expected_data.Length, actual_data.Length); + for (int i = 0; i < expected_data.Length; i++) + { + Assert.Equal(expected_data [i], actual_data [i]); } //Second row where data row column value is DBNull - dataReader.Read (); - Assert.Equal ("row_2", dataReader.GetFieldValue (0)); - try { - actual_data = dataReader.GetFieldValue (1); -Assert.False(true); - } catch (InvalidCastException) { - //This is expected - } + _dataReader.Read(); + Assert.Equal("row_2", _dataReader.GetFieldValue(0)); + Assert.Throws(() => _dataReader.GetFieldValue(1)); //Third row - dataReader.Read (); - Assert.Equal ("row_3", dataReader.GetFieldValue (0)); + _dataReader.Read(); + Assert.Equal("row_3", _dataReader.GetFieldValue(0)); expected_data = new byte[] { 0x00 }; - actual_data = dataReader.GetFieldValue (1); - Assert.Equal (expected_data.Length, actual_data.Length); - Assert.Equal (expected_data [0], actual_data [0]); + actual_data = _dataReader.GetFieldValue(1); + Assert.Equal(expected_data.Length, actual_data.Length); + Assert.Equal(expected_data [0], actual_data [0]); } [Fact] - public void GetStreamTest () + public void GetStreamTest() { int testColOrdinal = 1; byte[] buffer = new byte[1024]; - dataReader.Read (); - Stream stream = dataReader.GetStream (testColOrdinal); - Assert.NotNull (stream); + _dataReader.Read(); + Stream stream = _dataReader.GetStream(testColOrdinal); + Assert.NotNull(stream); //Read stream content to byte buffer - int data_length = stream.Read (buffer, 0, buffer.Length); + int data_length = stream.Read(buffer, 0, buffer.Length); //Verify that content is expected byte[] expected = new byte[] { 0xde, 0xad, 0xbe, 0xef }; - Assert.Equal (expected.Length, data_length); - for (int i = 0; i < expected.Length; i++) { - Assert.Equal (expected [i], buffer [i]); + Assert.Equal(expected.Length, data_length); + for (int i = 0; i < expected.Length; i++) + { + Assert.Equal(expected [i], buffer [i]); } //Get DBNull value stream - Assert.True (dataReader.Read ()); - stream = dataReader.GetStream (testColOrdinal); - Assert.Equal (0, stream.Length); + Assert.True(_dataReader.Read()); + stream = _dataReader.GetStream(testColOrdinal); + Assert.Equal(0, stream.Length); //Get single byte value stream - Assert.True (dataReader.Read ()); - stream = dataReader.GetStream (testColOrdinal); + Assert.True(_dataReader.Read()); + stream = _dataReader.GetStream(testColOrdinal); expected = new byte[] { 0x00 }; - Assert.Equal (expected.Length, stream.Length); - Assert.Equal (expected [0], stream.ReadByte ()); + Assert.Equal(expected.Length, stream.Length); + Assert.Equal(expected [0], stream.ReadByte()); } [Fact] - public void GetTextReader () + public void GetTextReader() { int testColOrdinal = 0; //Read first row - dataReader.Read (); - TextReader textReader = dataReader.GetTextReader (testColOrdinal); - Assert.NotNull (textReader); + _dataReader.Read(); + TextReader textReader = _dataReader.GetTextReader(testColOrdinal); + Assert.NotNull(textReader); - string txt = textReader.ReadToEnd (); - Assert.Equal ("row_1", txt); + string txt = textReader.ReadToEnd(); + Assert.Equal("row_1", txt); //Move to second row - Assert.True (dataReader.Read ()); - textReader = dataReader.GetTextReader (testColOrdinal); - txt = textReader.ReadToEnd (); - Assert.Equal ("row_2", txt); + Assert.True(_dataReader.Read()); + textReader = _dataReader.GetTextReader(testColOrdinal); + txt = textReader.ReadToEnd(); + Assert.Equal("row_2", txt); //Move to third row - Assert.True (dataReader.Read ()); - textReader = dataReader.GetTextReader (testColOrdinal); - txt = textReader.ReadToEnd (); - Assert.Equal ("row_3", txt); + Assert.True(_dataReader.Read()); + textReader = _dataReader.GetTextReader(testColOrdinal); + txt = textReader.ReadToEnd(); + Assert.Equal("row_3", txt); - Assert.False (dataReader.Read ()); + Assert.False(_dataReader.Read()); } - -#endif //NET_4_5 } } diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataColumnTest2.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataColumnTest2.cs index 73a8820ee9..15d5d78444 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataColumnTest2.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataColumnTest2.cs @@ -27,26 +27,12 @@ using System.ComponentModel; using System.Globalization; - using Xunit; namespace System.Data.Tests { - public class DataColumnTest2 : IDisposable + public class DataColumnTest2 { - private CultureInfo _originalCulture; - - public DataColumnTest2() - { - _originalCulture = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - - public void Dispose() - { - CultureInfo.CurrentCulture = _originalCulture; - } - [Fact] public void AllowDBNull() { diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetAssertion.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetAssertion.cs index c79e4d72ab..5fd36c4443 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetAssertion.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetAssertion.cs @@ -26,15 +26,16 @@ using System.Collections; +using System.Diagnostics; using System.IO; using System.Xml; using Xunit; namespace System.Data.Tests { - public class DataSetAssertion + public static class DataSetAssertion { - public string GetNormalizedSchema(string source) + public static string GetNormalizedSchema(string source) { /* // Due to the implementation difference, we must have @@ -55,7 +56,7 @@ namespace System.Data.Tests return writer.ToString(); } - private void SortAttributes(XmlElement el) + private static void SortAttributes(XmlElement el) { SortAttributesAttributes(el); ArrayList al = new ArrayList(); @@ -70,7 +71,7 @@ namespace System.Data.Tests el.RemoveChild(n); } - private void SortAttributesAttributes(XmlElement el) + private static void SortAttributesAttributes(XmlElement el) { ArrayList al = new ArrayList(); foreach (XmlAttribute a in el.Attributes) @@ -87,7 +88,7 @@ namespace System.Data.Tests el.SetAttributeNode(a); } - public void AssertDataSet(string label, DataSet ds, string name, int tableCount, int relCount) + public static void AssertDataSet(string label, DataSet ds, string name, int tableCount, int relCount) { Assert.Equal(name, ds.DataSetName); Assert.Equal(tableCount, ds.Tables.Count); @@ -95,7 +96,7 @@ namespace System.Data.Tests Assert.Equal(relCount, ds.Relations.Count); } - public void AssertDataTable(string label, DataTable dt, string name, int columnCount, int rowCount, int parentRelationCount, int childRelationCount, int constraintCount, int primaryKeyLength) + public static void AssertDataTable(string label, DataTable dt, string name, int columnCount, int rowCount, int parentRelationCount, int childRelationCount, int constraintCount, int primaryKeyLength) { Assert.Equal(name, dt.TableName); Assert.Equal(columnCount, dt.Columns.Count); @@ -106,18 +107,18 @@ namespace System.Data.Tests Assert.Equal(primaryKeyLength, dt.PrimaryKey.Length); } - public void AssertReadXml(DataSet ds, string label, string xml, XmlReadMode readMode, XmlReadMode resultMode, string datasetName, int tableCount) + public static void AssertReadXml(DataSet ds, string label, string xml, XmlReadMode readMode, XmlReadMode resultMode, string datasetName, int tableCount) { - AssertReadXml(ds, label, xml, readMode, resultMode, datasetName, tableCount, ReadState.EndOfFile, null, null); + DataSetAssertion.AssertReadXml(ds, label, xml, readMode, resultMode, datasetName, tableCount, ReadState.EndOfFile, null, null); } - public void AssertReadXml(DataSet ds, string label, string xml, XmlReadMode readMode, XmlReadMode resultMode, string datasetName, int tableCount, ReadState state) + public static void AssertReadXml(DataSet ds, string label, string xml, XmlReadMode readMode, XmlReadMode resultMode, string datasetName, int tableCount, ReadState state) { - AssertReadXml(ds, label, xml, readMode, resultMode, datasetName, tableCount, state, null, null); + DataSetAssertion.AssertReadXml(ds, label, xml, readMode, resultMode, datasetName, tableCount, state, null, null); } // a bit detailed version - public void AssertReadXml(DataSet ds, string label, string xml, XmlReadMode readMode, XmlReadMode resultMode, string datasetName, int tableCount, ReadState state, string readerLocalName, string readerNS) + public static void AssertReadXml(DataSet ds, string label, string xml, XmlReadMode readMode, XmlReadMode resultMode, string datasetName, int tableCount, ReadState state, string readerLocalName, string readerNS) { XmlReader xtr = new XmlTextReader(xml, XmlNodeType.Element, null); Assert.Equal(resultMode, ds.ReadXml(xtr, readMode)); @@ -129,7 +130,7 @@ namespace System.Data.Tests Assert.Equal(readerNS, xtr.NamespaceURI); } - public void AssertDataRelation(string label, DataRelation rel, string name, bool nested, + public static void AssertDataRelation(string label, DataRelation rel, string name, bool nested, string[] parentColNames, string[] childColNames, bool existsUK, bool existsFK) { @@ -151,7 +152,7 @@ namespace System.Data.Tests Assert.Null(rel.ChildKeyConstraint); } - public void AssertUniqueConstraint(string label, UniqueConstraint uc, + public static void AssertUniqueConstraint(string label, UniqueConstraint uc, string name, bool isPrimaryKey, string[] colNames) { Assert.Equal(name, uc.ConstraintName); @@ -161,7 +162,7 @@ namespace System.Data.Tests Assert.Equal(colNames.Length, uc.Columns.Length); } - public void AssertForeignKeyConstraint(string label, + public static void AssertForeignKeyConstraint(string label, ForeignKeyConstraint fk, string name, AcceptRejectRule acceptRejectRule, Rule delRule, Rule updateRule, string[] colNames, string[] relColNames) @@ -178,7 +179,7 @@ namespace System.Data.Tests Assert.Equal(relColNames.Length, fk.RelatedColumns.Length); } - public void AssertDataColumn(string label, DataColumn col, + public static void AssertDataColumn(string label, DataColumn col, string colName, bool allowDBNull, bool autoIncr, int autoIncrSeed, int autoIncrStep, string caption, MappingType colMap, diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetInferXmlSchemaTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetInferXmlSchemaTest.cs index 2e62e12430..885a9b4ec8 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetInferXmlSchemaTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetInferXmlSchemaTest.cs @@ -31,7 +31,7 @@ using Xunit; namespace System.Data.Tests { - public class DataSetInferXmlSchemaTest : DataSetAssertion + public class DataSetInferXmlSchemaTest { private string _xml1 = ""; private string _xml2 = ""; @@ -174,26 +174,26 @@ namespace System.Data.Tests { DataSet ds = new DataSet(); ds.InferXmlSchema((XmlReader)null, null); - AssertDataSet("null", ds, "NewDataSet", 0, 0); + DataSetAssertion.AssertDataSet("null", ds, "NewDataSet", 0, 0); } [Fact] public void SingleElement() { DataSet ds = GetDataSet(_xml1, null); - AssertDataSet("xml1", ds, "root", 0, 0); + DataSetAssertion.AssertDataSet("xml1", ds, "root", 0, 0); ds = GetDataSet(_xml4, null); - AssertDataSet("xml4", ds, "root", 0, 0); + DataSetAssertion.AssertDataSet("xml4", ds, "root", 0, 0); // namespaces ds = GetDataSet(_xml14, null); - AssertDataSet("xml14", ds, "root", 0, 0); + DataSetAssertion.AssertDataSet("xml14", ds, "root", 0, 0); Assert.Equal(string.Empty, ds.Prefix); Assert.Equal("urn:foo", ds.Namespace); ds = GetDataSet(_xml17, null); - AssertDataSet("xml17", ds, "root", 0, 0); + DataSetAssertion.AssertDataSet("xml17", ds, "root", 0, 0); Assert.Equal("urn:foo", ds.Namespace); } @@ -201,61 +201,61 @@ namespace System.Data.Tests public void SingleElementWithAttribute() { DataSet ds = GetDataSet(_xml2, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); } [Fact] public void SingleElementWithTwoAttribute() { DataSet ds = GetDataSet(_xml3, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 2, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col", dt.Columns[1], "attr2", true, false, 0, 1, "attr2", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col", dt.Columns[1], "attr2", true, false, 0, 1, "attr2", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); } [Fact] public void SingleChild() { DataSet ds = GetDataSet(_xml5, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "child", true, false, 0, 1, "child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "child", true, false, 0, 1, "child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); ds = GetDataSet(_xml6, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); } [Fact] public void SimpleElementTable() { DataSet ds = GetDataSet(_xml7, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 3, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col2", dt.Columns[1], "col2", true, false, 0, 1, "col2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataColumn("col3", dt.Columns[2], "col3", true, false, 0, 1, "col3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 3, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col2", dt.Columns[1], "col2", true, false, 0, 1, "col2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col3", dt.Columns[2], "col3", true, false, 0, 1, "col3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); } [Fact] public void SimpleDataSet() { DataSet ds = GetDataSet(_xml8, null); - AssertDataSet("ds", ds, "set", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "set", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "tab", 3, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col2", dt.Columns[1], "col2", true, false, 0, 1, "col2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataColumn("col3", dt.Columns[2], "col3", true, false, 0, 1, "col3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "tab", 3, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "col1", true, false, 0, 1, "col1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col2", dt.Columns[1], "col2", true, false, 0, 1, "col2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col3", dt.Columns[2], "col3", true, false, 0, 1, "col3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); } [Fact] @@ -264,36 +264,36 @@ namespace System.Data.Tests // FIXME: Also test ReadXml (, XmlReadMode.InferSchema) and // make sure that ReadXml() stores DataRow to el1 (and maybe to others) DataSet ds = GetDataSet(_xml9, null); - AssertDataSet("ds", ds, "NewDataSet", 4, 3); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 4, 3); DataTable dt = ds.Tables[0]; - AssertDataTable("dt1", dt, "el1", 3, 0, 0, 1, 1, 1); - AssertDataColumn("el1_Id", dt.Columns[0], "el1_Id", false, true, 0, 1, "el1_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); - AssertDataColumn("el1_attr1", dt.Columns[1], "attr1", true, false, 0, 1, "attr1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataColumn("el1_attrA", dt.Columns[2], "attrA", true, false, 0, 1, "attrA", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt1", dt, "el1", 3, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("el1_Id", dt.Columns[0], "el1_Id", false, true, 0, 1, "el1_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataColumn("el1_attr1", dt.Columns[1], "attr1", true, false, 0, 1, "attr1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el1_attrA", dt.Columns[2], "attrA", true, false, 0, 1, "attrA", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); dt = ds.Tables[1]; - AssertDataTable("dt2", dt, "el2", 6, 0, 1, 2, 2, 1); - AssertDataColumn("el2_Id", dt.Columns[0], "el2_Id", false, true, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); - AssertDataColumn("el2_col2", dt.Columns[1], "column2", true, false, 0, 1, "column2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataColumn("el2_col3", dt.Columns[2], "column3", true, false, 0, 1, "column3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); - AssertDataColumn("el2_attr2", dt.Columns[3], "attr2", true, false, 0, 1, "attr2", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false); - AssertDataColumn("el2_attrB", dt.Columns[4], "attrB", true, false, 0, 1, "attrB", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 4, string.Empty, false, false); - AssertDataColumn("el2_el1Id", dt.Columns[5], "el1_Id", true, false, 0, 1, "el1_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 5, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt2", dt, "el2", 6, 0, 1, 2, 2, 1); + DataSetAssertion.AssertDataColumn("el2_Id", dt.Columns[0], "el2_Id", false, true, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataColumn("el2_col2", dt.Columns[1], "column2", true, false, 0, 1, "column2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el2_col3", dt.Columns[2], "column3", true, false, 0, 1, "column3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el2_attr2", dt.Columns[3], "attr2", true, false, 0, 1, "attr2", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el2_attrB", dt.Columns[4], "attrB", true, false, 0, 1, "attrB", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 4, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el2_el1Id", dt.Columns[5], "el1_Id", true, false, 0, 1, "el1_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 5, string.Empty, false, false); dt = ds.Tables[2]; - AssertDataTable("dt3", dt, "el3", 4, 0, 1, 0, 1, 0); - AssertDataColumn("el3_attr3", dt.Columns[0], "attr3", true, false, 0, 1, "attr3", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("el3_attrC", dt.Columns[1], "attrC", true, false, 0, 1, "attrC", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataColumn("el3_Text", dt.Columns[2], "el3_Text", true, false, 0, 1, "el3_Text", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); - AssertDataColumn("el3_el2Id", dt.Columns[3], "el2_Id", true, false, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt3", dt, "el3", 4, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("el3_attr3", dt.Columns[0], "attr3", true, false, 0, 1, "attr3", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el3_attrC", dt.Columns[1], "attrC", true, false, 0, 1, "attrC", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el3_Text", dt.Columns[2], "el3_Text", true, false, 0, 1, "el3_Text", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el3_el2Id", dt.Columns[3], "el2_Id", true, false, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false); dt = ds.Tables[3]; - AssertDataTable("dt4", dt, "el4", 4, 0, 1, 0, 1, 0); - AssertDataColumn("el3_attr4", dt.Columns[0], "attr4", true, false, 0, 1, "attr4", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("el4_attrD", dt.Columns[1], "attrD", true, false, 0, 1, "attrD", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataColumn("el4_Text", dt.Columns[2], "el4_Text", true, false, 0, 1, "el4_Text", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); - AssertDataColumn("el4_el2Id", dt.Columns[3], "el2_Id", true, false, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt4", dt, "el4", 4, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("el3_attr4", dt.Columns[0], "attr4", true, false, 0, 1, "attr4", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el4_attrD", dt.Columns[1], "attrD", true, false, 0, 1, "attrD", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el4_Text", dt.Columns[2], "el4_Text", true, false, 0, 1, "el4_Text", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("el4_el2Id", dt.Columns[3], "el2_Id", true, false, 0, 1, "el2_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 3, string.Empty, false, false); } [Fact] @@ -302,10 +302,10 @@ namespace System.Data.Tests // Note that text part is ignored. DataSet ds = GetDataSet(_xml10, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); - AssertDataColumn("col", dt.Columns[0], "b", true, false, 0, 1, "b", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col", dt.Columns[0], "b", true, false, 0, 1, "b", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); } [Fact] @@ -314,10 +314,10 @@ namespace System.Data.Tests // Note that 1) significant whitespace is ignored, and // 2) xml:space is treated as column (and also note namespaces). DataSet ds = GetDataSet(_xml11, null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); - AssertDataColumn("element", dt.Columns[0], "child_after_significant_space", true, false, 0, 1, "child_after_significant_space", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("element", dt.Columns[0], "child_after_significant_space", true, false, 0, 1, "child_after_significant_space", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); Assert.Equal(1, dt.Columns.Count); } @@ -334,7 +334,7 @@ namespace System.Data.Tests (" \n\n")); XmlReader xr = new XmlNodeReader(doc); ds.InferXmlSchema(xr, null); - AssertDataSet("pure_whitespace", ds, "root", 0, 0); + DataSetAssertion.AssertDataSet("pure_whitespace", ds, "root", 0, 0); } [Fact] @@ -343,59 +343,59 @@ namespace System.Data.Tests // FIXME: Also test ReadXml (, XmlReadMode.InferSchema) and // make sure that ReadXml() stores DataRow to el1 (and maybe to others) DataSet ds = GetDataSet(_xml15, null); - AssertDataSet("ds", ds, "root", 2, 0); + DataSetAssertion.AssertDataSet("ds", ds, "root", 2, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "table1", 2, 0, 0, 0, 0, 0); - AssertDataColumn("col1_1", dt.Columns[0], "col1_1", true, false, 0, 1, "col1_1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col1_2", dt.Columns[1], "col1_2", true, false, 0, 1, "col1_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "table1", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col1_1", dt.Columns[0], "col1_1", true, false, 0, 1, "col1_1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col1_2", dt.Columns[1], "col1_2", true, false, 0, 1, "col1_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); dt = ds.Tables[1]; - AssertDataTable("dt", dt, "table2", 2, 0, 0, 0, 0, 0); - AssertDataColumn("col2_1", dt.Columns[0], "col2_1", true, false, 0, 1, "col2_1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col2_2", dt.Columns[1], "col2_2", true, false, 0, 1, "col2_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "table2", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col2_1", dt.Columns[0], "col2_1", true, false, 0, 1, "col2_1", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col2_2", dt.Columns[1], "col2_2", true, false, 0, 1, "col2_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); } [Fact] public void ConflictSimpleComplexColumns() { DataSet ds = GetDataSet(_xml18, null); - AssertDataSet("ds", ds, "set", 2, 1); + DataSetAssertion.AssertDataSet("ds", ds, "set", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1); - AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("dt", dt, "col", 2, 0, 1, 0, 1, 0); - AssertDataColumn("another_col", dt.Columns[0], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("table_refId", dt.Columns[1], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "col", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("another_col", dt.Columns[0], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("table_refId", dt.Columns[1], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); DataRelation dr = ds.Relations[0]; - AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true); - AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" }); - AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" }); + DataSetAssertion.AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true); + DataSetAssertion.AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" }); + DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" }); } [Fact] public void ConflictColumnTable() { DataSet ds = GetDataSet(_xml19, null); - AssertDataSet("ds", ds, "set", 2, 1); + DataSetAssertion.AssertDataSet("ds", ds, "set", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1); - AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("dt", dt, "col", 2, 0, 1, 0, 1, 0); - AssertDataColumn("table_refId", dt.Columns["table_Id"], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); - AssertDataColumn("another_col", dt.Columns["another_col"], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "col", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("table_refId", dt.Columns["table_Id"], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("another_col", dt.Columns["another_col"], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); DataRelation dr = ds.Relations[0]; - AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true); - AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" }); - AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" }); + DataSetAssertion.AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true); + DataSetAssertion.AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" }); + DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" }); } [Fact] @@ -403,22 +403,22 @@ namespace System.Data.Tests { // Conflicts between a column and a table, additionally an attribute. DataSet ds = GetDataSet(_xml20, null); - AssertDataSet("ds", ds, "set", 2, 1); + DataSetAssertion.AssertDataSet("ds", ds, "set", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1); - AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("dt", dt, "table", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("table_Id", dt.Columns[0], "table_Id", false, true, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("dt", dt, "col", 3, 0, 1, 0, 1, 0); - AssertDataColumn("another_col", dt.Columns[0], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("table_refId", dt.Columns["table_Id"], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); - AssertDataColumn("attr", dt.Columns["attr"], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*2*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("dt", dt, "col", 3, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("another_col", dt.Columns[0], "another_col", true, false, 0, 1, "another_col", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("table_refId", dt.Columns["table_Id"], "table_Id", true, false, 0, 1, "table_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("attr", dt.Columns["attr"], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*2*/-1, string.Empty, false, false); DataRelation dr = ds.Relations[0]; - AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true); - AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" }); - AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" }); + DataSetAssertion.AssertDataRelation("rel", dr, "table_col", true, new string[] { "table_Id" }, new string[] { "table_Id" }, true, true); + DataSetAssertion.AssertUniqueConstraint("uniq", dr.ParentKeyConstraint, "Constraint1", true, new string[] { "table_Id" }); + DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" }); } [Fact] @@ -456,14 +456,14 @@ namespace System.Data.Tests string xml = ""; DataSet ds = new DataSet(); ds.InferXmlSchema(new StringReader(xml), null); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); - AssertDataTable("dt", ds.Tables[0], "root", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "root", 2, 0, 0, 0, 0, 0); ds = new DataSet(); ds.InferXmlSchema(new StringReader(xml), new string[] { "urn:foo" }); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); // a:foo is ignored - AssertDataTable("dt", ds.Tables[0], "root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "root", 1, 0, 0, 0, 0, 0); } [Fact] diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlSchemaTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlSchemaTest.cs index d2e5cdf7ac..3f169b6a4a 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlSchemaTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlSchemaTest.cs @@ -26,13 +26,14 @@ using System.IO; +using System.Diagnostics; using System.Globalization; using System.Xml; using Xunit; namespace System.Data.Tests { - public class DataSetReadXmlSchemaTest : DataSetAssertion, IDisposable + public class DataSetReadXmlSchemaTest : RemoteExecutorTestBase { private DataSet CreateTestSet() { @@ -50,19 +51,6 @@ namespace System.Data.Tests return ds; } - private CultureInfo _currentCultureBackup; - - public DataSetReadXmlSchemaTest() - { - _currentCultureBackup = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); - } - - public void Dispose() - { - CultureInfo.CurrentCulture = _currentCultureBackup; - } - [Fact] public void SingleElementTreatmentDifference() { @@ -125,39 +113,39 @@ namespace System.Data.Tests string xs = string.Format(xsbase, simple); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("simple", ds, "hoge", 1, 0); - AssertDataTable("simple", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataSet("simple", ds, "hoge", 1, 0); + DataSetAssertion.AssertDataTable("simple", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); // reference to global complex type ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs2)); - AssertDataSet("external complexType", ds, "hoge", 2, 1); - AssertDataTable("external Tab1", ds.Tables[0], "Root", 1, 0, 0, 1, 1, 1); - AssertDataTable("external Tab2", ds.Tables[1], "Child", 3, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataSet("external complexType", ds, "hoge", 2, 1); + DataSetAssertion.AssertDataTable("external Tab1", ds.Tables[0], "Root", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataTable("external Tab2", ds.Tables[1], "Child", 3, 0, 1, 0, 1, 0); // xsbase2 + complex -> datatable ds = new DataSet(); xs = string.Format(xsbase2, complex); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("complex", ds, "hoge", 2, 1); - AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataSet("complex", ds, "hoge", 2, 1); + DataSetAssertion.AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 1, 1, 1); DataTable dt = ds.Tables[1]; - AssertDataTable("complex", dt, "Child", 3, 0, 1, 0, 1, 0); - AssertDataColumn("a1", dt.Columns["a1"], "a1", true, false, 0, 1, "a1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); - AssertDataColumn("a2", dt.Columns["a2"], "a2", true, false, 0, 1, "a2", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); - AssertDataColumn("Root_Id", dt.Columns[2], "Root_Id", true, false, 0, 1, "Root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); + DataSetAssertion.AssertDataTable("complex", dt, "Child", 3, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("a1", dt.Columns["a1"], "a1", true, false, 0, 1, "a1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("a2", dt.Columns["a2"], "a2", true, false, 0, 1, "a2", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("Root_Id", dt.Columns[2], "Root_Id", true, false, 0, 1, "Root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false); // xsbase + complex -> dataset ds = new DataSet(); xs = string.Format(xsbase, complex); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("complex", ds, "Root", 1, 0); + DataSetAssertion.AssertDataSet("complex", ds, "Root", 1, 0); ds = new DataSet(); xs = string.Format(xsbase2, elref); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("complex", ds, "hoge", 1, 0); - AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataSet("complex", ds, "hoge", 1, 0); + DataSetAssertion.AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); } [Fact] @@ -181,8 +169,8 @@ namespace System.Data.Tests "; var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(schema)); - AssertDataSet("ds", ds, "doc", 1, 0); - AssertDataTable("table", ds.Tables[0], "elem", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataSet("ds", ds, "doc", 1, 0); + DataSetAssertion.AssertDataTable("table", ds.Tables[0], "elem", 2, 0, 0, 0, 0, 0); } [Fact] @@ -206,8 +194,8 @@ namespace System.Data.Tests var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs)); // Here "unusedType" table is never imported. - AssertDataSet("ds", ds, "hoge", 1, 0); - AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataSet("ds", ds, "hoge", 1, 0); + DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); } [Fact] @@ -221,7 +209,7 @@ namespace System.Data.Tests var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs)); // nothing is imported. - AssertDataSet("ds", ds, "NewDataSet", 0, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 0, 0); } [Fact] @@ -243,7 +231,7 @@ namespace System.Data.Tests var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("ds", ds, "Root", 0, 0); // name is "Root" + DataSetAssertion.AssertDataSet("ds", ds, "Root", 0, 0); // name is "Root" // But when explicit msdata:IsDataSet value is "false", then // treat as usual. @@ -251,7 +239,7 @@ namespace System.Data.Tests ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); } [Fact] @@ -302,13 +290,16 @@ namespace System.Data.Tests var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs)); // Child should not be regarded as DataSet element - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); } [Fact] public void LocaleOnRootWithoutIsDataSet() { - string xs = @" + RemoteInvoke(() => + { + CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); + string xs = @" @@ -319,15 +310,18 @@ namespace System.Data.Tests "; - var ds = new DataSet(); - ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); - Assert.Equal("fi-FI", ds.Locale.Name); // DataSet's Locale comes from current thread - DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "Root", 2, 0, 0, 0, 0, 0); - Assert.Equal("ja-JP", dt.Locale.Name); // DataTable's Locale comes from msdata:Locale - AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col2", dt.Columns[1], "Child", false, false, 0, 1, "Child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + var ds = new DataSet(); + ds.ReadXmlSchema(new StringReader(xs)); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); + Assert.Equal("fi-FI", ds.Locale.Name); // DataSet's Locale comes from current thread + DataTable dt = ds.Tables[0]; + DataSetAssertion.AssertDataTable("dt", dt, "Root", 2, 0, 0, 0, 0, 0); + Assert.Equal("ja-JP", dt.Locale.Name); // DataTable's Locale comes from msdata:Locale + DataSetAssertion.AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col2", dt.Columns[1], "Child", false, false, 0, 1, "Child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + + return SuccessExitCode; + }).Dispose(); } @@ -440,10 +434,10 @@ namespace System.Data.Tests // No prefixes on tables and columns var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(xs)); - AssertDataSet("ds", ds, "DS", 3, 1); + DataSetAssertion.AssertDataSet("ds", ds, "DS", 3, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("R3", dt, "R3", 3, 0, 0, 0, 0, 0); - AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("R3", dt, "R3", 3, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); } [Fact] @@ -469,17 +463,17 @@ namespace System.Data.Tests private void ReadTest1Check(DataSet ds) { - AssertDataSet("dataset", ds, "NewDataSet", 2, 1); - AssertDataTable("tbl1", ds.Tables[0], "Table1", 3, 0, 0, 1, 1, 0); - AssertDataTable("tbl2", ds.Tables[1], "Table2", 3, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataSet("dataset", ds, "NewDataSet", 2, 1); + DataSetAssertion.AssertDataTable("tbl1", ds.Tables[0], "Table1", 3, 0, 0, 1, 1, 0); + DataSetAssertion.AssertDataTable("tbl2", ds.Tables[1], "Table2", 3, 0, 1, 0, 1, 0); DataRelation rel = ds.Relations[0]; - AssertDataRelation("rel", rel, "Rel1", false, + DataSetAssertion.AssertDataRelation("rel", rel, "Rel1", false, new string[] { "Column1_3" }, new string[] { "Column2_1" }, true, true); - AssertUniqueConstraint("uc", rel.ParentKeyConstraint, + DataSetAssertion.AssertUniqueConstraint("uc", rel.ParentKeyConstraint, "Constraint1", false, new string[] { "Column1_3" }); - AssertForeignKeyConstraint("fk", rel.ChildKeyConstraint, "Rel1", + DataSetAssertion.AssertForeignKeyConstraint("fk", rel.ChildKeyConstraint, "Rel1", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "Column2_1" }, new string[] { "Column1_3" }); @@ -491,11 +485,11 @@ namespace System.Data.Tests { var ds = new DataSet(); ds.ReadXmlSchema(new StringReader(@"")); - AssertDataSet("001", ds, "NewDataSet", 0, 0); + DataSetAssertion.AssertDataSet("001", ds, "NewDataSet", 0, 0); ds = new DataSet(); ds.ReadXmlSchema(new StringReader(@"")); - AssertDataSet("002", ds, "NewDataSet", 0, 0); + DataSetAssertion.AssertDataSet("002", ds, "NewDataSet", 0, 0); ds = new DataSet(); ds.ReadXmlSchema(new StringReader( @@ -503,7 +497,7 @@ namespace System.Data.Tests ")); - AssertDataSet("003", ds, "NewDataSet", 0, 0); + DataSetAssertion.AssertDataSet("003", ds, "NewDataSet", 0, 0); ds = new DataSet(); ds.ReadXmlSchema(new StringReader( @@ -515,7 +509,7 @@ namespace System.Data.Tests ")); - AssertDataSet("004", ds, "NewDataSet", 0, 0); + DataSetAssertion.AssertDataSet("004", ds, "NewDataSet", 0, 0); } [Fact] @@ -533,11 +527,11 @@ namespace System.Data.Tests ")); - AssertDataSet("005", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("005", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); - AssertDataColumn("attr", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("text", dt.Columns[1], "foo_text", false, false, 0, 1, "foo_text", MappingType.SimpleContent, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("attr", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("text", dt.Columns[1], "foo_text", false, false, 0, 1, "foo_text", MappingType.SimpleContent, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); ds = new DataSet(); ds.ReadXmlSchema(new StringReader( @@ -548,11 +542,11 @@ namespace System.Data.Tests ")); - AssertDataSet("006", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("006", ds, "NewDataSet", 1, 0); dt = ds.Tables[0]; - AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); - AssertDataColumn("att1", dt.Columns["att1"], "att1", true, false, 0, 1, "att1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); - AssertDataColumn("att2", dt.Columns["att2"], "att2", true, false, 0, 1, "att2", MappingType.Attribute, typeof(int), 2, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("att1", dt.Columns["att1"], "att1", true, false, 0, 1, "att1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("att2", dt.Columns["att2"], "att2", true, false, 0, 1, "att2", MappingType.Attribute, typeof(int), 2, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); } [Fact] @@ -576,15 +570,15 @@ namespace System.Data.Tests ")); - AssertDataSet("007", ds, "NewDataSet", 2, 1); + DataSetAssertion.AssertDataSet("007", ds, "NewDataSet", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1); - AssertDataColumn("id", dt.Columns[0], "uno_Id", false, true, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("id", dt.Columns[0], "uno_Id", false, true, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0); - AssertDataColumn("child", dt.Columns[0], "tres", false, false, 0, 1, "tres", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("child", dt.Columns[0], "tres", false, false, 0, 1, "tres", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); // External simple type element ds = new DataSet(); @@ -605,15 +599,15 @@ namespace System.Data.Tests ")); - AssertDataSet("008", ds, "NewDataSet", 2, 1); + DataSetAssertion.AssertDataSet("008", ds, "NewDataSet", 2, 1); dt = ds.Tables[0]; - AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1); - AssertDataColumn("id", dt.Columns[0], "uno_Id", false, true, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("tab1", dt, "uno", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("id", dt.Columns[0], "uno_Id", false, true, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0); - AssertDataColumn("child", dt.Columns[0], "tres", false, false, 0, 1, "tres", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, false); - AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("tab2", dt, "des", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("child", dt.Columns[0], "tres", false, false, 0, 1, "tres", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, "urn:foo", 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); } [Fact] @@ -639,12 +633,12 @@ namespace System.Data.Tests ")); - AssertDataSet("013", ds, "root", 1, 0); + DataSetAssertion.AssertDataSet("013", ds, "root", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("root", dt, "e", 2, 0, 0, 0, 0, 0); - AssertDataColumn("attr", dt.Columns[0], "a", true, false, 0, 1, "a", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("simple", dt.Columns[1], "e_text", false, false, 0, 1, "e_text", MappingType.SimpleContent, typeof(decimal), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("root", dt, "e", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("attr", dt.Columns[0], "a", true, false, 0, 1, "a", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("simple", dt.Columns[1], "e_text", false, false, 0, 1, "e_text", MappingType.SimpleContent, typeof(decimal), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); } [Fact] @@ -728,16 +722,16 @@ namespace System.Data.Tests ")); - AssertDataSet("101", ds, "root", 2, 1); + DataSetAssertion.AssertDataSet("101", ds, "root", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("parent_table", dt, "p", 2, 0, 0, 1, 0, 0); - AssertDataColumn("pk", dt.Columns[0], "pk", false, false, 0, 1, "pk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("parent_table", dt, "p", 2, 0, 0, 1, 0, 0); + DataSetAssertion.AssertDataColumn("pk", dt.Columns[0], "pk", false, false, 0, 1, "pk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); dt = ds.Tables[1]; - AssertDataTable("child_table", dt, "c", 2, 0, 1, 0, 0, 0); - AssertDataColumn("fk", dt.Columns[0], "fk", false, false, 0, 1, "fk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("child_table", dt, "c", 2, 0, 1, 0, 0, 0); + DataSetAssertion.AssertDataColumn("fk", dt.Columns[0], "fk", false, false, 0, 1, "fk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataRelation("rel", ds.Relations[0], "rel", false, new string[] { "pk" }, new string[] { "fk" }, false, false); + DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "rel", false, new string[] { "pk" }, new string[] { "fk" }, false, false); } [Fact] @@ -779,16 +773,16 @@ namespace System.Data.Tests ")); - AssertDataSet("102", ds, "ds", 2, 1); + DataSetAssertion.AssertDataSet("102", ds, "ds", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("parent_table", dt, "p", 2, 0, 0, 1, 0, 0); - AssertDataColumn("pk", dt.Columns[0], "pk", false, false, 0, 1, "pk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("parent_table", dt, "p", 2, 0, 0, 1, 0, 0); + DataSetAssertion.AssertDataColumn("pk", dt.Columns[0], "pk", false, false, 0, 1, "pk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); dt = ds.Tables[1]; - AssertDataTable("child_table", dt, "c", 2, 0, 1, 0, 0, 0); - AssertDataColumn("fk", dt.Columns[0], "fk", false, false, 0, 1, "fk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("child_table", dt, "c", 2, 0, 1, 0, 0, 0); + DataSetAssertion.AssertDataColumn("fk", dt.Columns[0], "fk", false, false, 0, 1, "fk", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataRelation("rel", ds.Relations[0], "rel", true, new string[] { "pk" }, new string[] { "fk" }, false, false); + DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "rel", true, new string[] { "pk" }, new string[] { "fk" }, false, false); } [Fact] @@ -806,17 +800,17 @@ namespace System.Data.Tests ")); - AssertDataSet("012", ds, "NewDataSet", 2, 1); + DataSetAssertion.AssertDataSet("012", ds, "NewDataSet", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("parent", dt, "Foo", 1, 0, 0, 1, 1, 1); - AssertDataColumn("key", dt.Columns[0], "Foo_Id", false, true, 0, 1, "Foo_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("parent", dt, "Foo", 1, 0, 0, 1, 1, 1); + DataSetAssertion.AssertDataColumn("key", dt.Columns[0], "Foo_Id", false, true, 0, 1, "Foo_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("repeated", dt, "Bar", 2, 0, 1, 0, 1, 0); - AssertDataColumn("data", dt.Columns[0], "Bar_Column", false, false, 0, 1, "Bar_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("refkey", dt.Columns[1], "Foo_Id", true, false, 0, 1, "Foo_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("repeated", dt, "Bar", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("data", dt.Columns[0], "Bar_Column", false, false, 0, 1, "Bar_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("refkey", dt.Columns[1], "Foo_Id", true, false, 0, 1, "Foo_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataRelation("rel", ds.Relations[0], "Foo_Bar", true, new string[] { "Foo_Id" }, new string[] { "Foo_Id" }, true, true); + DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "Foo_Bar", true, new string[] { "Foo_Id" }, new string[] { "Foo_Id" }, true, true); } [Fact] @@ -835,25 +829,25 @@ namespace System.Data.Tests ")); - AssertDataSet("014", ds, "NewDataSet", 3, 2); + DataSetAssertion.AssertDataSet("014", ds, "NewDataSet", 3, 2); DataTable dt = ds.Tables[0]; - AssertDataTable("parent", dt, "root", 1, 0, 0, 2, 1, 1); - AssertDataColumn("key", dt.Columns[0], "root_Id", false, true, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); + DataSetAssertion.AssertDataTable("parent", dt, "root", 1, 0, 0, 2, 1, 1); + DataSetAssertion.AssertDataColumn("key", dt.Columns[0], "root_Id", false, true, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, true); dt = ds.Tables[1]; - AssertDataTable("repeated", dt, "x", 2, 0, 1, 0, 1, 0); - AssertDataColumn("data_1", dt.Columns[0], "x_Column", false, false, 0, 1, "x_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("refkey_1", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("repeated", dt, "x", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("data_1", dt.Columns[0], "x_Column", false, false, 0, 1, "x_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("refkey_1", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); dt = ds.Tables[2]; - AssertDataTable("repeated", dt, "y", 2, 0, 1, 0, 1, 0); - AssertDataColumn("data", dt.Columns[0], "y_Column", false, false, 0, 1, "y_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("refkey", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("repeated", dt, "y", 2, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataColumn("data", dt.Columns[0], "y_Column", false, false, 0, 1, "y_Column", MappingType.SimpleContent, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("refkey", dt.Columns[1], "root_Id", true, false, 0, 1, "root_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); - AssertDataRelation("rel", ds.Relations[0], "root_x", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true); + DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "root_x", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true); - AssertDataRelation("rel", ds.Relations[1], "root_y", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true); + DataSetAssertion.AssertDataRelation("rel", ds.Relations[1], "root_y", true, new string[] { "root_Id" }, new string[] { "root_Id" }, true, true); } [Fact] @@ -955,7 +949,7 @@ namespace System.Data.Tests Assert.Equal(0, ds.Tables[0].Constraints.Count); Assert.Equal(0, ds.Tables[1].Constraints.Count); - AssertDataRelation("TestRel", ds.Relations[0], "rel", false, new string[] { "col 1", "col2" }, + DataSetAssertion.AssertDataRelation("TestRel", ds.Relations[0], "rel", false, new string[] { "col 1", "col2" }, new string[] { "col1", "col 2" }, false, false); } } diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs index 3422267cef..2604562ba3 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs @@ -31,7 +31,7 @@ using Xunit; namespace System.Data.Tests { - public class DataSetReadXmlTest : DataSetAssertion + public class DataSetReadXmlTest { private const string xml1 = ""; private const string xml2 = ""; @@ -72,55 +72,55 @@ namespace System.Data.Tests // empty XML ds = new DataSet(); - AssertReadXml(ds, "EmptyString", xml1, + DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1, XmlReadMode.Auto, XmlReadMode.Auto, "NewDataSet", 0); // simple element ds = new DataSet(); - AssertReadXml(ds, "EmptyElement", xml2, + DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2, XmlReadMode.Auto, XmlReadMode.InferSchema, "root", 0); // simple element2 ds = new DataSet(); - AssertReadXml(ds, "StartEndTag", xml3, + DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3, XmlReadMode.Auto, XmlReadMode.InferSchema, "root", 0); // whitespace in simple element ds = new DataSet(); - AssertReadXml(ds, "Whitespace", xml4, + DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4, XmlReadMode.Auto, XmlReadMode.InferSchema, "root", 0); // text in simple element ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.Auto, XmlReadMode.InferSchema, "root", 0); // simple table pattern: // root becomes a table and test becomes a column. ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.Auto, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("xml6", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("xml6", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); // simple table with 2 columns: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.Auto, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("xml7", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("xml7", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0); // simple dataset with 1 table: ds = new DataSet(); - AssertReadXml(ds, "SimpleDataSet", xml8, + DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8, XmlReadMode.Auto, XmlReadMode.InferSchema, "dataset", 1); - AssertDataTable("xml8", ds.Tables[0], "table", 2, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("xml8", ds.Tables[0], "table", 2, 1, 0, 0, 0, 0); } [Fact] @@ -130,49 +130,49 @@ namespace System.Data.Tests // empty XML ds = new DataSet(); - AssertReadXml(ds, "EmptyString", xml1, + DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // simple element ds = new DataSet(); - AssertReadXml(ds, "EmptyElement", xml2, + DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // simple element2 ds = new DataSet(); - AssertReadXml(ds, "StartEndTag", xml3, + DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // whitespace in simple element ds = new DataSet(); - AssertReadXml(ds, "Whitespace", xml4, + DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // text in simple element ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // simple table pattern: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // simple table with 2 columns: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); // simple dataset with 1 table: ds = new DataSet(); - AssertReadXml(ds, "SimpleDataSet", xml8, + DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); } @@ -184,49 +184,49 @@ namespace System.Data.Tests // empty XML ds = new DataSet(); - AssertReadXml(ds, "EmptyString", xml1, + DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // simple element ds = new DataSet(); - AssertReadXml(ds, "EmptyElement", xml2, + DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // simple element2 ds = new DataSet(); - AssertReadXml(ds, "StartEndTag", xml3, + DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // whitespace in simple element ds = new DataSet(); - AssertReadXml(ds, "Whitespace", xml4, + DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // text in simple element ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // simple table pattern: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // simple table with 2 columns: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // simple dataset with 1 table: ds = new DataSet(); - AssertReadXml(ds, "SimpleDataSet", xml8, + DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); } @@ -238,49 +238,49 @@ namespace System.Data.Tests // empty XML ds = new DataSet(); - AssertReadXml(ds, "EmptyString", xml1, + DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // simple element ds = new DataSet(); - AssertReadXml(ds, "EmptyElement", xml2, + DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // simple element2 ds = new DataSet(); - AssertReadXml(ds, "StartEndTag", xml3, + DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // whitespace in simple element ds = new DataSet(); - AssertReadXml(ds, "Whitespace", xml4, + DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // text in simple element ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // simple table pattern: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // simple table with 2 columns: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); // simple dataset with 1 table: ds = new DataSet(); - AssertReadXml(ds, "SimpleDataSet", xml8, + DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); } @@ -292,55 +292,55 @@ namespace System.Data.Tests // empty XML ds = new DataSet(); - AssertReadXml(ds, "EmptyString", xml1, + DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 0); // simple element ds = new DataSet(); - AssertReadXml(ds, "EmptyElement", xml2, + DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "root", 0); // simple element2 ds = new DataSet(); - AssertReadXml(ds, "StartEndTag", xml3, + DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "root", 0); // whitespace in simple element ds = new DataSet(); - AssertReadXml(ds, "Whitespace", xml4, + DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "root", 0); // text in simple element ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "root", 0); // simple table pattern: // root becomes a table and test becomes a column. ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("xml6", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("xml6", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); // simple table with 2 columns: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("xml7", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("xml7", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0); // simple dataset with 1 table: ds = new DataSet(); - AssertReadXml(ds, "SimpleDataSet", xml8, + DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "dataset", 1); - AssertDataTable("xml8", ds.Tables[0], "table", 2, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("xml8", ds.Tables[0], "table", 2, 1, 0, 0, 0, 0); } [Fact] @@ -350,49 +350,49 @@ namespace System.Data.Tests // empty XML ds = new DataSet(); - AssertReadXml(ds, "EmptyString", xml1, + DataSetAssertion.AssertReadXml(ds, "EmptyString", xml1, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // simple element ds = new DataSet(); - AssertReadXml(ds, "EmptyElement", xml2, + DataSetAssertion.AssertReadXml(ds, "EmptyElement", xml2, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // simple element2 ds = new DataSet(); - AssertReadXml(ds, "StartEndTag", xml3, + DataSetAssertion.AssertReadXml(ds, "StartEndTag", xml3, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // whitespace in simple element ds = new DataSet(); - AssertReadXml(ds, "Whitespace", xml4, + DataSetAssertion.AssertReadXml(ds, "Whitespace", xml4, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // text in simple element ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // simple table pattern: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // simple table with 2 columns: ds = new DataSet(); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // simple dataset with 1 table: ds = new DataSet(); - AssertReadXml(ds, "SimpleDataSet", xml8, + DataSetAssertion.AssertReadXml(ds, "SimpleDataSet", xml8, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); } @@ -404,33 +404,33 @@ namespace System.Data.Tests // ignored ds = new DataSet(); - AssertReadXml(ds, "Fragment", diff1, + DataSetAssertion.AssertReadXml(ds, "Fragment", diff1, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); ds = new DataSet(); - AssertReadXml(ds, "IgnoreSchema", diff1, + DataSetAssertion.AssertReadXml(ds, "IgnoreSchema", diff1, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); ds = new DataSet(); - AssertReadXml(ds, "InferSchema", diff1, + DataSetAssertion.AssertReadXml(ds, "InferSchema", diff1, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 0); ds = new DataSet(); - AssertReadXml(ds, "ReadSchema", diff1, + DataSetAssertion.AssertReadXml(ds, "ReadSchema", diff1, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0); // Auto, DiffGram ... treated as DiffGram ds = new DataSet(); - AssertReadXml(ds, "Auto", diff1, + DataSetAssertion.AssertReadXml(ds, "Auto", diff1, XmlReadMode.Auto, XmlReadMode.DiffGram, "NewDataSet", 0); ds = new DataSet(); - AssertReadXml(ds, "DiffGram", diff1, + DataSetAssertion.AssertReadXml(ds, "DiffGram", diff1, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0); } @@ -442,34 +442,34 @@ namespace System.Data.Tests // Fragment ... skipped ds = new DataSet(); - AssertReadXml(ds, "Fragment", diff2, + DataSetAssertion.AssertReadXml(ds, "Fragment", diff2, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 0); // others ... kept ds = new DataSet(); - AssertReadXml(ds, "IgnoreSchema", diff2, + DataSetAssertion.AssertReadXml(ds, "IgnoreSchema", diff2, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0, ReadState.Interactive); ds = new DataSet(); - AssertReadXml(ds, "InferSchema", diff2, + DataSetAssertion.AssertReadXml(ds, "InferSchema", diff2, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 0, ReadState.Interactive); ds = new DataSet(); - AssertReadXml(ds, "ReadSchema", diff2, + DataSetAssertion.AssertReadXml(ds, "ReadSchema", diff2, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 0, ReadState.Interactive); // Auto, DiffGram ... treated as DiffGram ds = new DataSet(); - AssertReadXml(ds, "Auto", diff2, + DataSetAssertion.AssertReadXml(ds, "Auto", diff2, XmlReadMode.Auto, XmlReadMode.DiffGram, "NewDataSet", 0, ReadState.Interactive); ds = new DataSet(); - AssertReadXml(ds, "DiffGram", diff2, + DataSetAssertion.AssertReadXml(ds, "DiffGram", diff2, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 0, ReadState.Interactive); } @@ -481,36 +481,36 @@ namespace System.Data.Tests // ignored ds = new DataSet(); - AssertReadXml(ds, "IgnoreSchema", schema1, + DataSetAssertion.AssertReadXml(ds, "IgnoreSchema", schema1, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0); ds = new DataSet(); - AssertReadXml(ds, "InferSchema", schema1, + DataSetAssertion.AssertReadXml(ds, "InferSchema", schema1, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 0); // misc ... consume schema ds = new DataSet(); - AssertReadXml(ds, "Fragment", schema1, + DataSetAssertion.AssertReadXml(ds, "Fragment", schema1, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 1); - AssertDataTable("fragment", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("fragment", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); ds = new DataSet(); - AssertReadXml(ds, "ReadSchema", schema1, + DataSetAssertion.AssertReadXml(ds, "ReadSchema", schema1, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 1); - AssertDataTable("readschema", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("readschema", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); ds = new DataSet(); - AssertReadXml(ds, "Auto", schema1, + DataSetAssertion.AssertReadXml(ds, "Auto", schema1, XmlReadMode.Auto, XmlReadMode.ReadSchema, "NewDataSet", 1); - AssertDataTable("auto", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("auto", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); ds = new DataSet(); - AssertReadXml(ds, "DiffGram", schema1, + DataSetAssertion.AssertReadXml(ds, "DiffGram", schema1, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 1); } @@ -522,37 +522,37 @@ namespace System.Data.Tests // ignored ds = new DataSet(); - AssertReadXml(ds, "IgnoreSchema", schema2, + DataSetAssertion.AssertReadXml(ds, "IgnoreSchema", schema2, XmlReadMode.IgnoreSchema, XmlReadMode.IgnoreSchema, "NewDataSet", 0, ReadState.Interactive); ds = new DataSet(); - AssertReadXml(ds, "InferSchema", schema2, + DataSetAssertion.AssertReadXml(ds, "InferSchema", schema2, XmlReadMode.InferSchema, XmlReadMode.InferSchema, "NewDataSet", 0, ReadState.Interactive); // Fragment ... consumed both ds = new DataSet(); - AssertReadXml(ds, "Fragment", schema2, + DataSetAssertion.AssertReadXml(ds, "Fragment", schema2, XmlReadMode.Fragment, XmlReadMode.Fragment, "NewDataSet", 1); - AssertDataTable("fragment", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("fragment", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); // rest ... treated as schema ds = new DataSet(); - AssertReadXml(ds, "Auto", schema2, + DataSetAssertion.AssertReadXml(ds, "Auto", schema2, XmlReadMode.Auto, XmlReadMode.ReadSchema, "NewDataSet", 1, ReadState.Interactive); - AssertDataTable("auto", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("auto", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); ds = new DataSet(); - AssertReadXml(ds, "DiffGram", schema2, + DataSetAssertion.AssertReadXml(ds, "DiffGram", schema2, XmlReadMode.DiffGram, XmlReadMode.DiffGram, "NewDataSet", 1, ReadState.Interactive); - AssertDataTable("diffgram", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("diffgram", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); ds = new DataSet(); - AssertReadXml(ds, "ReadSchema", schema2, + DataSetAssertion.AssertReadXml(ds, "ReadSchema", schema2, XmlReadMode.ReadSchema, XmlReadMode.ReadSchema, "NewDataSet", 1, ReadState.Interactive); } @@ -563,14 +563,14 @@ namespace System.Data.Tests // simple element -> simple table var ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.Auto, XmlReadMode.InferSchema, "root", 0); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.Auto, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("seq1", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("seq1", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); } [Fact] @@ -579,31 +579,31 @@ namespace System.Data.Tests // simple element -> simple dataset var ds = new DataSet(); - AssertReadXml(ds, "SingleText", xml5, + DataSetAssertion.AssertReadXml(ds, "SingleText", xml5, XmlReadMode.Auto, XmlReadMode.InferSchema, "root", 0); - AssertReadXml(ds, "SimpleTable2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2", xml7, XmlReadMode.Auto, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("#1", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("#1", ds.Tables[0], "root", 2, 1, 0, 0, 0, 0); // simple table -> simple dataset ds = new DataSet(); - AssertReadXml(ds, "SimpleTable", xml6, + DataSetAssertion.AssertReadXml(ds, "SimpleTable", xml6, XmlReadMode.Auto, XmlReadMode.InferSchema, "NewDataSet", 1); - AssertDataTable("#2", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("#2", ds.Tables[0], "root", 1, 1, 0, 0, 0, 0); // Return value became IgnoreSchema, since there is // already schema information in the dataset. // Columns are kept 1 as old table holds. // Rows are up to 2 because of accumulative read. - AssertReadXml(ds, "SimpleTable2-2", xml7, + DataSetAssertion.AssertReadXml(ds, "SimpleTable2-2", xml7, XmlReadMode.Auto, XmlReadMode.IgnoreSchema, "NewDataSet", 1); - AssertDataTable("#3", ds.Tables[0], "root", 1, 2, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("#3", ds.Tables[0], "root", 1, 2, 0, 0, 0, 0); } [Fact] @@ -627,7 +627,7 @@ namespace System.Data.Tests ds.Tables.Add(dt); dt.Columns.Add("col"); ds.ReadXml(new StringReader(xml1), XmlReadMode.IgnoreSchema); - AssertDataSet("ds", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0); Assert.Equal(1, dt.Rows.Count); dt.Clear(); @@ -727,7 +727,7 @@ namespace System.Data.Tests var ds = new DataSet(); ds.ReadXml(new StringReader(xml)); - AssertReadXml(ds, "SameNameParentChild", xml, + DataSetAssertion.AssertReadXml(ds, "SameNameParentChild", xml, XmlReadMode.Auto, XmlReadMode.IgnoreSchema, "NewDataSet", 1); } @@ -739,7 +739,7 @@ namespace System.Data.Tests var ds = new DataSet(); ds.ReadXml(new StringReader(xml)); - AssertReadXml(ds, "SameColumnName", xml, + DataSetAssertion.AssertReadXml(ds, "SameColumnName", xml, XmlReadMode.Auto, XmlReadMode.IgnoreSchema, "NewDataSet", 1); } diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest.cs index 32275d849e..70fa58ff4d 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest.cs @@ -37,25 +37,17 @@ using System.IO; using System.Data.SqlTypes; using System.Globalization; using System.Text; +using System.Diagnostics; namespace System.Data.Tests { - public class DataSetTest : DataSetAssertion, IDisposable + public class DataSetTest : RemoteExecutorTestBase { - private CultureInfo _currentCultureBackup; - public DataSetTest() { - _currentCultureBackup = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); MyDataSet.count = 0; } - public void Dispose() - { - CultureInfo.CurrentCulture = _currentCultureBackup; - } - [Fact] public void Properties() { @@ -186,7 +178,7 @@ namespace System.Data.Tests TextWriter writer = new StringWriter(); ds.WriteXmlSchema(writer); - string TextString = GetNormalizedSchema(writer.ToString()); + string TextString = DataSetAssertion.GetNormalizedSchema(writer.ToString()); // string TextString = writer.ToString (); string substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); @@ -517,86 +509,94 @@ namespace System.Data.Tests [Fact] public void WriteXmlSchema() { - var ds = new DataSet(); - ds.ReadXml(new StringReader(DataProvider.region)); - TextWriter writer = new StringWriter(); - ds.WriteXmlSchema(writer); + RemoteInvoke(() => + { + CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); + + var ds = new DataSet(); + ds.ReadXml(new StringReader(DataProvider.region)); + TextWriter writer = new StringWriter(); + ds.WriteXmlSchema(writer); - string TextString = GetNormalizedSchema(writer.ToString()); - // string TextString = writer.ToString (); + string TextString = DataSetAssertion.GetNormalizedSchema(writer.ToString()); + // string TextString = writer.ToString (); - string substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal("", substring); + string substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal("", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - // This is original DataSet.WriteXmlSchema() output - // Assert.Equal ("", substring); - Assert.Equal("", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + // This is original DataSet.WriteXmlSchema() output + // Assert.Equal ("", substring); + Assert.Equal("", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - // This is original DataSet.WriteXmlSchema() output - // Assert.Equal (" ", substring); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + // This is original DataSet.WriteXmlSchema() output + // Assert.Equal (" ", substring); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - // This is original DataSet.WriteXmlSchema() output - // Assert.Equal (" ", substring); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + // This is original DataSet.WriteXmlSchema() output + // Assert.Equal (" ", substring); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); - substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); - TextString = TextString.Substring(TextString.IndexOf('\n') + 1); - Assert.Equal(" ", substring); + substring = TextString.Substring(0, TextString.IndexOfAny(new[] { '\r', '\n' })); + TextString = TextString.Substring(TextString.IndexOf('\n') + 1); + Assert.Equal(" ", substring); + + Assert.Equal("", TextString); + + return SuccessExitCode; + }).Dispose(); - Assert.Equal("", TextString); } [Fact] @@ -1037,11 +1037,11 @@ namespace System.Data.Tests string xml = ""; var ds = new DataSet(); ds.ReadXml(new StringReader(xml)); - AssertDataSet("ds", ds, "FullTextResponse", 2, 1); + DataSetAssertion.AssertDataSet("ds", ds, "FullTextResponse", 2, 1); DataTable dt = ds.Tables[0]; - AssertDataTable("dt1", dt, "Domains", 1, 1, 0, 1, 1, 1); + DataSetAssertion.AssertDataTable("dt1", dt, "Domains", 1, 1, 0, 1, 1, 1); dt = ds.Tables[1]; - AssertDataTable("dt2", dt, "AvailResponse", 3, 2, 1, 0, 1, 0); + DataSetAssertion.AssertDataTable("dt2", dt, "AvailResponse", 3, 2, 1, 0, 1, 0); StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.QuoteChar = '\''; @@ -1565,16 +1565,19 @@ namespace System.Data.Tests [Fact] public void WriteXmlModeSchema1() { - string SerializedDataTable = + RemoteInvoke(() => + { + CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); + string SerializedDataTable = @" "; - string expected = -@" + string expected = + @" " + -@" + @"msdata:Locale=""en-US"">" + + @" @@ -1590,14 +1593,17 @@ namespace System.Data.Tests "; - DataSet set; - set = new DataSet(); - set.ReadXml(new StringReader(SerializedDataTable)); + DataSet set; + set = new DataSet(); + set.ReadXml(new StringReader(SerializedDataTable)); - StringWriter w = new StringWriter(); - set.WriteXml(w, XmlWriteMode.WriteSchema); - string result = w.ToString(); - Assert.Equal(expected.Replace("\r", ""), result.Replace("\r", "")); + StringWriter w = new StringWriter(); + set.WriteXml(w, XmlWriteMode.WriteSchema); + string result = w.ToString(); + Assert.Equal(expected.Replace("\r", ""), result.Replace("\r", "")); + + return SuccessExitCode; + }).Dispose(); } [Fact] @@ -1667,7 +1673,7 @@ namespace System.Data.Tests } /// - /// Test for testing DataSet.Clear method with foriegn key relations + /// Test for testing DataSet.Clear method with foreign key relations /// This is expected to clear all the related datatable rows also /// [Fact] diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest2.cs.REMOVED.git-id b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest2.cs.REMOVED.git-id index 26eb600a88..6630c72e1f 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest2.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest2.cs.REMOVED.git-id @@ -1 +1 @@ -10a6914d65427276ce2b68c6b6e404a465584103 \ No newline at end of file +56c3a2c4d25bccb11af1ee46c6a21af1efa875b1 \ No newline at end of file diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableCollectionTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableCollectionTest.cs index 0f76f6d84a..65d574356f 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableCollectionTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableCollectionTest.cs @@ -243,7 +243,7 @@ namespace System.Data.Tests string tblname = ""; /* checking for a recently input table, expecting true */ Assert.Equal(true, tbcol.Contains(_tables[0].TableName)); - /* trying to check with a empty string, expecting false */ + /* trying to check with an empty string, expecting false */ Assert.Equal(false, tbcol.Contains(tblname)); /* trying to check for a table that donot exist, expecting false */ Assert.Equal(false, tbcol.Contains("InvalidTableName")); @@ -267,7 +267,7 @@ namespace System.Data.Tests Assert.Equal("Table3", array[2].TableName); Assert.Equal("Table4", array[3].TableName); - /* copying with in a array */ + /* copying with in an array */ DataTable[] array1 = new DataTable[6]; tbcol.CopyTo(array1, 2); Assert.Equal(null, array1[0]); diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReadXmlSchemaTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReadXmlSchemaTest.cs index 607efdb2e5..0e953a816c 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReadXmlSchemaTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReadXmlSchemaTest.cs @@ -30,7 +30,7 @@ using Xunit; namespace System.Data.Tests { - public class DataTableReadXmlSchemaTest : DataSetAssertion, IDisposable + public class DataTableReadXmlSchemaTest { private DataSet CreateTestSet() { @@ -48,19 +48,6 @@ namespace System.Data.Tests return ds; } - private CultureInfo _currentCultureBackup; - - public DataTableReadXmlSchemaTest() - { - _currentCultureBackup = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); - } - - public void Dispose() - { - CultureInfo.CurrentCulture = _currentCultureBackup; - } - [Fact] public void SuspiciousDataSetElement() { @@ -83,7 +70,7 @@ namespace System.Data.Tests var ds = new DataSet(); ds.Tables.Add(new DataTable("elem")); ds.Tables[0].ReadXmlSchema(new StringReader(schema)); - AssertDataTable("table", ds.Tables[0], "elem", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("table", ds.Tables[0], "elem", 2, 0, 0, 0, 0, 0); } [Fact] @@ -110,7 +97,7 @@ namespace System.Data.Tests ds.Tables.Add(new DataTable("Root")); ds.Tables.Add(new DataTable("unusedType")); ds.Tables[0].ReadXmlSchema(new StringReader(xs)); - AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); // Here "unusedType" table is never imported. ds.Tables[1].ReadXmlSchema(new StringReader(xs)); }); @@ -137,7 +124,7 @@ namespace System.Data.Tests var ds = new DataSet(); ds.Tables.Add(new DataTable("Root")); ds.Tables[0].ReadXmlSchema(new StringReader(xs)); - AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("dt", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0); // Even if a global element uses a complexType, it will be // ignored if the element has msdata:IsDataSet='true' @@ -196,10 +183,10 @@ namespace System.Data.Tests ds.Tables.Add("Root"); ds.Tables[0].ReadXmlSchema(new StringReader(xs)); DataTable dt = ds.Tables[0]; - AssertDataTable("dt", dt, "Root", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataTable("dt", dt, "Root", 2, 0, 0, 0, 0, 0); Assert.Equal("ja-JP", dt.Locale.Name); // DataTable's Locale comes from msdata:Locale - AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("col2", dt.Columns[1], "Child", false, false, 0, 1, "Child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("col2", dt.Columns[1], "Child", false, false, 0, 1, "Child", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); } [Fact] @@ -255,23 +242,23 @@ namespace System.Data.Tests ds.Tables.Add(new DataTable("R3")); ds.Tables[0].ReadXmlSchema(new StringReader(xs)); DataTable dt = ds.Tables[0]; - AssertDataTable("R3", dt, "R3", 3, 0, 0, 0, 0, 0); - AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataTable("R3", dt, "R3", 3, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("col1", dt.Columns[0], "Attr", true, false, 0, 1, "Attr", MappingType.Attribute, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); } private void ReadTest1Check(DataSet ds) { - AssertDataSet("dataset", ds, "NewDataSet", 2, 1); - AssertDataTable("tbl1", ds.Tables[0], "Table1", 3, 0, 0, 1, 1, 0); - AssertDataTable("tbl2", ds.Tables[1], "Table2", 3, 0, 1, 0, 1, 0); + DataSetAssertion.AssertDataSet("dataset", ds, "NewDataSet", 2, 1); + DataSetAssertion.AssertDataTable("tbl1", ds.Tables[0], "Table1", 3, 0, 0, 1, 1, 0); + DataSetAssertion.AssertDataTable("tbl2", ds.Tables[1], "Table2", 3, 0, 1, 0, 1, 0); DataRelation rel = ds.Relations[0]; - AssertDataRelation("rel", rel, "Rel1", false, + DataSetAssertion.AssertDataRelation("rel", rel, "Rel1", false, new string[] { "Column1_3" }, new string[] { "Column2_1" }, true, true); - AssertUniqueConstraint("uc", rel.ParentKeyConstraint, + DataSetAssertion.AssertUniqueConstraint("uc", rel.ParentKeyConstraint, "Constraint1", false, new string[] { "Column1_3" }); - AssertForeignKeyConstraint("fk", rel.ChildKeyConstraint, "Rel1", + DataSetAssertion.AssertForeignKeyConstraint("fk", rel.ChildKeyConstraint, "Rel1", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "Column2_1" }, new string[] { "Column1_3" }); @@ -293,11 +280,11 @@ namespace System.Data.Tests ")); - AssertDataSet("005", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("005", ds, "NewDataSet", 1, 0); DataTable dt = ds.Tables[0]; - AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); - AssertDataColumn("attr", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("text", dt.Columns[1], "foo_text", false, false, 0, 1, "foo_text", MappingType.SimpleContent, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("attr", dt.Columns[0], "attr", true, false, 0, 1, "attr", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("text", dt.Columns[1], "foo_text", false, false, 0, 1, "foo_text", MappingType.SimpleContent, typeof(long), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); ds = new DataSet(); ds.Tables.Add(new DataTable("foo")); @@ -309,11 +296,11 @@ namespace System.Data.Tests ")); - AssertDataSet("006", ds, "NewDataSet", 1, 0); + DataSetAssertion.AssertDataSet("006", ds, "NewDataSet", 1, 0); dt = ds.Tables[0]; - AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); - AssertDataColumn("att1", dt.Columns["att1"], "att1", true, false, 0, 1, "att1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); - AssertDataColumn("att2", dt.Columns["att2"], "att2", true, false, 0, 1, "att2", MappingType.Attribute, typeof(int), 2, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("tab", dt, "foo", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("att1", dt.Columns["att1"], "att1", true, false, 0, 1, "att1", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, /*0*/-1, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("att2", dt.Columns["att2"], "att2", true, false, 0, 1, "att2", MappingType.Attribute, typeof(int), 2, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false); } [Fact] @@ -341,9 +328,9 @@ namespace System.Data.Tests ")); DataTable dt = ds.Tables[0]; - AssertDataTable("root", dt, "e", 2, 0, 0, 0, 0, 0); - AssertDataColumn("attr", dt.Columns[0], "a", true, false, 0, 1, "a", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); - AssertDataColumn("simple", dt.Columns[1], "e_text", false, false, 0, 1, "e_text", MappingType.SimpleContent, typeof(decimal), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); + DataSetAssertion.AssertDataTable("root", dt, "e", 2, 0, 0, 0, 0, 0); + DataSetAssertion.AssertDataColumn("attr", dt.Columns[0], "a", true, false, 0, 1, "a", MappingType.Attribute, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 0, string.Empty, false, false); + DataSetAssertion.AssertDataColumn("simple", dt.Columns[1], "e_text", false, false, 0, 1, "e_text", MappingType.SimpleContent, typeof(decimal), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false); } [Fact] diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReaderTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReaderTest.cs index 81ea3fc59b..6eb0951b74 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReaderTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableReaderTest.cs @@ -729,7 +729,7 @@ namespace System.Data.Tests Assert.Equal("col_int*5", schemaTable.Rows[11]["Expression"]); Assert.True((bool)schemaTable.Rows[11]["IsReadOnly"]); - // if expression depends on a external col, then set Expression as null.. + // if expression depends on an external col, then set Expression as null.. Assert.Equal("col_expression_ext", schemaTable.Rows[12]["ColumnName"]); Assert.Equal(DBNull.Value, schemaTable.Rows[12]["Expression"]); Assert.True((bool)schemaTable.Rows[12]["IsReadOnly"]); diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest.cs.REMOVED.git-id b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest.cs.REMOVED.git-id index ef1a11ff73..2092698b11 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest.cs.REMOVED.git-id @@ -1 +1 @@ -abb35ca2ab2bd5043c9f2616ad14981a3045bb04 \ No newline at end of file +90ac29b27c18e67a2c878cff5fd1fa4872e0babd \ No newline at end of file diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest.cs index cca40166e9..b0281c9f94 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest.cs @@ -262,7 +262,7 @@ namespace System.Data.Tests Assert.Equal(dv[2][0], "9"); - //This should not throw a System.Data.VersionNotFoundException: "There is no Proposed data to accces" + //This should not throw a System.Data.VersionNotFoundException: "There is no proposed data to access" Assert.Equal(dv[1][0], "7"); } diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs index b2dbd2892e..dc703b069e 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBooleanTest.cs @@ -38,7 +38,6 @@ namespace System.Data.Tests.SqlTypes public SqlBooleanTest() { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); _sqlTrue = new SqlBoolean(true); _sqlFalse = new SqlBoolean(false); } diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs index 8fc9e811e6..db65797852 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlByteTest.cs @@ -36,11 +36,6 @@ namespace System.Data.Tests.SqlTypes { private const string Error = " does not work correctly"; - public SqlByteTest() - { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - // Test constructor [Fact] public void Create() diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBytesTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBytesTest.cs index f9f183e10f..3e355417f5 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBytesTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlBytesTest.cs @@ -31,11 +31,6 @@ namespace System.Data.Tests.SqlTypes { public class SqlBytesTest { - public SqlBytesTest() - { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - // Test constructor [Fact] public void SqlBytesItem() diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlCharsTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlCharsTest.cs index ab66922cb3..a33a35b1a3 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlCharsTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlCharsTest.cs @@ -26,26 +26,14 @@ using System.IO; using System.Xml; using System.Data.SqlTypes; using System.Globalization; - using System.Xml.Serialization; namespace System.Data.Tests.SqlTypes { - public class SqlCharsTest : IDisposable + public class SqlCharsTest { private CultureInfo _originalCulture; - public SqlCharsTest() - { - _originalCulture = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - - public void Dispose() - { - CultureInfo.CurrentCulture = _originalCulture; - } - // Test constructor [Fact] public void SqlCharsItem() diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs index e13ea8dc0a..b1901b9bf1 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDateTimeTest.cs @@ -50,7 +50,6 @@ namespace System.Data.Tests.SqlTypes public SqlDateTimeTest() { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); _test1 = new SqlDateTime(2002, 10, 19, 9, 40, 0); _test2 = new SqlDateTime(2003, 11, 20, 10, 50, 1); _test3 = new SqlDateTime(2003, 11, 20, 10, 50, 1); diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs index 07762185c7..47f709aac4 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs @@ -34,7 +34,7 @@ using System.IO; namespace System.Data.Tests.SqlTypes { - public class SqlDecimalTest : IDisposable + public class SqlDecimalTest { private CultureInfo _originalCulture; private SqlDecimal _test1; @@ -45,8 +45,6 @@ namespace System.Data.Tests.SqlTypes public SqlDecimalTest() { - _originalCulture = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("en-US"); _test1 = new SqlDecimal(6464.6464m); _test2 = new SqlDecimal(10000.00m); _test3 = new SqlDecimal(10000.00m); @@ -54,11 +52,6 @@ namespace System.Data.Tests.SqlTypes _test5 = new SqlDecimal(decimal.MaxValue); } - public void Dispose() - { - CultureInfo.CurrentCulture = _originalCulture; - } - // Test constructor [Fact] public void Create() diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs index 8f55bc6117..074e1ec9a5 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlDoubleTest.cs @@ -35,21 +35,10 @@ using Xunit; namespace System.Data.Tests.SqlTypes { - public class SqlDoubleTest : IDisposable + public class SqlDoubleTest { private CultureInfo _originalCulture; - public SqlDoubleTest() - { - _originalCulture = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - - public void Dispose() - { - CultureInfo.CurrentCulture = _originalCulture; - } - // Test constructor [Fact] public void Create() diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs index 56d7291124..2b40b21a90 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlMoneyTest.cs @@ -41,7 +41,6 @@ namespace System.Data.Tests.SqlTypes public SqlMoneyTest() { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); _test1 = new SqlMoney(6464.6464d); _test2 = new SqlMoney(90000.0m); _test3 = new SqlMoney(90000.0m); @@ -89,7 +88,7 @@ namespace System.Data.Tests.SqlTypes [Fact] public void PublicFields() { - // FIXME: There is a error in msdn docs, it says thath MaxValue + // FIXME: There is an error in msdn docs, it says thath MaxValue // is 922,337,203,685,475.5807 when the actual value is // 922,337,203,685,477.5807 Assert.Equal(922337203685477.5807m, SqlMoney.MaxValue.Value); diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs index ae16767c1c..c2ec520b03 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlSingleTest.cs @@ -34,11 +34,6 @@ namespace System.Data.Tests.SqlTypes { public class SqlSingleTest { - public SqlSingleTest() - { - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - // Test constructor [Fact] public void Create() diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs index 2ffbaa9815..9cd1709372 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs @@ -31,17 +31,16 @@ using System.IO; using System.Xml; using System.Xml.Serialization; using System.Text; - +using System.Diagnostics; using Xunit; namespace System.Data.Tests.SqlTypes { - public class SqlStringTest : IDisposable + public class SqlStringTest : RemoteExecutorTestBase { private SqlString _test1; private SqlString _test2; private SqlString _test3; - private CultureInfo _originalCulture; static SqlStringTest() { @@ -50,18 +49,11 @@ namespace System.Data.Tests.SqlTypes public SqlStringTest() { - _originalCulture = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("en-AU"); _test1 = new SqlString("First TestString"); _test2 = new SqlString("This is just a test SqlString"); _test3 = new SqlString("This is just a test SqlString"); } - public void Dispose() - { - CultureInfo.CurrentCulture = _originalCulture; - } - [Fact] public void Constructor_Value_Success() { @@ -180,24 +172,32 @@ namespace System.Data.Tests.SqlTypes [Fact] public void Properties() { - // CompareInfo - Assert.Equal(3081, _test1.CompareInfo.LCID); + RemoteInvoke(() => + { + CultureInfo.CurrentCulture = new CultureInfo("en-AU"); + var one = new SqlString("First TestString"); - // CultureInfo - Assert.Equal(3081, _test1.CultureInfo.LCID); + // CompareInfo + Assert.Equal(3081, one.CompareInfo.LCID); - // LCID - Assert.Equal(3081, _test1.LCID); + // CultureInfo + Assert.Equal(3081, one.CultureInfo.LCID); - // IsNull - Assert.True(!_test1.IsNull); - Assert.True(SqlString.Null.IsNull); + // LCID + Assert.Equal(3081, one.LCID); - // SqlCompareOptions - Assert.Equal("IgnoreCase, IgnoreKanaType, IgnoreWidth", _test1.SqlCompareOptions.ToString()); + // IsNull + Assert.True(!one.IsNull); + Assert.True(SqlString.Null.IsNull); - // Value - Assert.Equal("First TestString", _test1.Value); + // SqlCompareOptions + Assert.Equal("IgnoreCase, IgnoreKanaType, IgnoreWidth", one.SqlCompareOptions.ToString()); + + // Value + Assert.Equal("First TestString", one.Value); + + return SuccessExitCode; + }).Dispose(); } // PUBLIC METHODS diff --git a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs index 2fc999247d..aff1cb058d 100644 --- a/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs +++ b/external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/SqlXmlTest.cs @@ -31,21 +31,8 @@ using Xunit; namespace System.Data.Tests.SqlTypes { - public class SqlXmlTest : IDisposable + public class SqlXmlTest { - private CultureInfo _originalCulture; - - public SqlXmlTest() - { - _originalCulture = CultureInfo.CurrentCulture; ; - CultureInfo.CurrentCulture = new CultureInfo("en-US"); - } - - public void Dispose() - { - CultureInfo.CurrentCulture = _originalCulture; - } - // Test constructor [Fact] // .ctor (Stream) //[Category ("NotDotNet")] // Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2 diff --git a/external/corefx/src/System.Data.DataSetExtensions/System.Data.DataSetExtensions.sln b/external/corefx/src/System.Data.DataSetExtensions/System.Data.DataSetExtensions.sln new file mode 100644 index 0000000000..b5dc3d6003 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/System.Data.DataSetExtensions.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.DataSetExtensions.Tests", "tests\System.Data.DataSetExtensions.Tests.csproj", "{2B38992F-9979-485F-B104-38C476D0B706}" + ProjectSection(ProjectDependencies) = postProject + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A} = {C7CB4B69-2A11-4A20-A21E-5C954855AE5A} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.DataSetExtensions", "src\System.Data.DataSetExtensions.csproj", "{C7CB4B69-2A11-4A20-A21E-5C954855AE5A}" + ProjectSection(ProjectDependencies) = postProject + {50A5A8BC-C6A9-4000-8B52-667BEE00459D} = {50A5A8BC-C6A9-4000-8B52-667BEE00459D} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.DataSetExtensions", "ref\System.Data.DataSetExtensions.csproj", "{50A5A8BC-C6A9-4000-8B52-667BEE00459D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2B38992F-9979-485F-B104-38C476D0B706}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {2B38992F-9979-485F-B104-38C476D0B706}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {2B38992F-9979-485F-B104-38C476D0B706}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {2B38992F-9979-485F-B104-38C476D0B706}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {50A5A8BC-C6A9-4000-8B52-667BEE00459D}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {50A5A8BC-C6A9-4000-8B52-667BEE00459D}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {50A5A8BC-C6A9-4000-8B52-667BEE00459D}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {50A5A8BC-C6A9-4000-8B52-667BEE00459D}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {2B38992F-9979-485F-B104-38C476D0B706} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} + {50A5A8BC-C6A9-4000-8B52-667BEE00459D} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} + EndGlobalSection +EndGlobal diff --git a/external/corefx/src/System.Data.DataSetExtensions/dir.props b/external/corefx/src/System.Data.DataSetExtensions/dir.props new file mode 100644 index 0000000000..09d2f14f39 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/dir.props @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + MSFT + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/pkg/System.Data.DataSetExtensions.pkgproj b/external/corefx/src/System.Data.DataSetExtensions/pkg/System.Data.DataSetExtensions.pkgproj new file mode 100644 index 0000000000..ec640ad906 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/pkg/System.Data.DataSetExtensions.pkgproj @@ -0,0 +1,14 @@ + + + + + + netcoreapp2.0;net45;$(AllXamarinFrameworks) + + + + true + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/Configurations.props b/external/corefx/src/System.Data.DataSetExtensions/ref/Configurations.props similarity index 100% rename from external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/Configurations.props rename to external/corefx/src/System.Data.DataSetExtensions/ref/Configurations.props diff --git a/external/corefx/src/System.Data.DataSetExtensions/ref/System.Data.DataSetExtensions.cs b/external/corefx/src/System.Data.DataSetExtensions/ref/System.Data.DataSetExtensions.cs new file mode 100644 index 0000000000..a0ff68b940 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/ref/System.Data.DataSetExtensions.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the http://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +namespace System.Data +{ + public static partial class DataRowComparer + { + public static System.Data.DataRowComparer Default { get { throw null; } } + } + public sealed partial class DataRowComparer : System.Collections.Generic.IEqualityComparer where TRow : System.Data.DataRow + { + internal DataRowComparer() { } + public static System.Data.DataRowComparer Default { get { throw null; } } + public bool Equals(TRow leftRow, TRow rightRow) { throw null; } + public int GetHashCode(TRow row) { throw null; } + } + public static partial class DataRowExtensions + { + public static T Field(this System.Data.DataRow row, System.Data.DataColumn column) { throw null; } + public static T Field(this System.Data.DataRow row, System.Data.DataColumn column, System.Data.DataRowVersion version) { throw null; } + public static T Field(this System.Data.DataRow row, int columnIndex) { throw null; } + public static T Field(this System.Data.DataRow row, int columnIndex, System.Data.DataRowVersion version) { throw null; } + public static T Field(this System.Data.DataRow row, string columnName) { throw null; } + public static T Field(this System.Data.DataRow row, string columnName, System.Data.DataRowVersion version) { throw null; } + public static void SetField(this System.Data.DataRow row, System.Data.DataColumn column, T value) { } + public static void SetField(this System.Data.DataRow row, int columnIndex, T value) { } + public static void SetField(this System.Data.DataRow row, string columnName, T value) { } + } + public static partial class DataTableExtensions + { + public static System.Data.EnumerableRowCollection AsEnumerable(this System.Data.DataTable source) { throw null; } + public static System.Data.DataTable CopyToDataTable(this System.Collections.Generic.IEnumerable source) where T : System.Data.DataRow { throw null; } + public static void CopyToDataTable(this System.Collections.Generic.IEnumerable source, System.Data.DataTable table, System.Data.LoadOption options) where T : System.Data.DataRow { } + public static void CopyToDataTable(this System.Collections.Generic.IEnumerable source, System.Data.DataTable table, System.Data.LoadOption options, System.Data.FillErrorEventHandler errorHandler) where T : System.Data.DataRow { } + } + public abstract partial class EnumerableRowCollection : System.Collections.IEnumerable + { + internal EnumerableRowCollection() { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public static partial class EnumerableRowCollectionExtensions + { + public static System.Data.EnumerableRowCollection Cast(this System.Data.EnumerableRowCollection source) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.EnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.EnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.EnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.EnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.EnumerableRowCollection Select(this System.Data.EnumerableRowCollection source, System.Func selector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenByDescending(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenByDescending(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenBy(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector) { throw null; } + public static System.Data.OrderedEnumerableRowCollection ThenBy(this System.Data.OrderedEnumerableRowCollection source, System.Func keySelector, System.Collections.Generic.IComparer comparer) { throw null; } + public static System.Data.EnumerableRowCollection Where(this System.Data.EnumerableRowCollection source, System.Func predicate) { throw null; } + } + public partial class EnumerableRowCollection : System.Data.EnumerableRowCollection, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + internal EnumerableRowCollection() { } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public sealed partial class OrderedEnumerableRowCollection : System.Data.EnumerableRowCollection + { + internal OrderedEnumerableRowCollection() { } + } + public static partial class TypedTableBaseExtensions + { + public static System.Data.EnumerableRowCollection AsEnumerable(this System.Data.TypedTableBase source) where TRow : System.Data.DataRow { throw null; } + public static TRow ElementAtOrDefault(this System.Data.TypedTableBase source, int index) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.TypedTableBase source, System.Func keySelector) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderByDescending(this System.Data.TypedTableBase source, System.Func keySelector, System.Collections.Generic.IComparer comparer) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.TypedTableBase source, System.Func keySelector) where TRow : System.Data.DataRow { throw null; } + public static System.Data.OrderedEnumerableRowCollection OrderBy(this System.Data.TypedTableBase source, System.Func keySelector, System.Collections.Generic.IComparer comparer) where TRow : System.Data.DataRow { throw null; } + public static System.Data.EnumerableRowCollection Select(this System.Data.TypedTableBase source, System.Func selector) where TRow : System.Data.DataRow { throw null; } + public static System.Data.EnumerableRowCollection Where(this System.Data.TypedTableBase source, System.Func predicate) where TRow : System.Data.DataRow { throw null; } + } + public abstract partial class TypedTableBase : System.Data.DataTable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : System.Data.DataRow + { + protected TypedTableBase() { } + protected TypedTableBase(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public System.Data.EnumerableRowCollection Cast() { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/ref/System.Data.DataSetExtensions.csproj b/external/corefx/src/System.Data.DataSetExtensions/ref/System.Data.DataSetExtensions.csproj new file mode 100644 index 0000000000..a9fb6f7147 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/ref/System.Data.DataSetExtensions.csproj @@ -0,0 +1,13 @@ + + + + + {50A5A8BC-C6A9-4000-8B52-667BEE00459D} + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/Configurations.props b/external/corefx/src/System.Data.DataSetExtensions/src/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/Resources/Strings.resx b/external/corefx/src/System.Data.DataSetExtensions/src/Resources/Strings.resx new file mode 100644 index 0000000000..32ce22b237 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/Resources/Strings.resx @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The {0} enumeration value, {1}, is not valid. + + + The source contains no DataRows. + + + The source contains a DataRow reference that is null. + + + The source contains a detached DataRow that cannot be copied to the DataTable. + + + The DataRowComparer does not work with DataRows that have been deleted since it only compares current values. + + + The source contains a deleted DataRow that cannot be copied to the DataTable. + + + Cannot cast DBNull. Value to type '{0}'. Please use a nullable type. + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System.Data.DataSetExtensions.csproj b/external/corefx/src/System.Data.DataSetExtensions/src/System.Data.DataSetExtensions.csproj new file mode 100644 index 0000000000..0a50899246 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System.Data.DataSetExtensions.csproj @@ -0,0 +1,36 @@ + + + + + {C7CB4B69-2A11-4A20-A21E-5C954855AE5A} + System.Data.DataSetExtensions + true + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataRowComparer.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataRowComparer.cs new file mode 100644 index 0000000000..5796b9ba1a --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataRowComparer.cs @@ -0,0 +1,227 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; + +namespace System.Data +{ + /// + /// This class implements IEqualityComparer using value based semantics + /// when comparing DataRows. + /// + public static class DataRowComparer + { + /// + /// Gets the singleton instance of the data row comparer. + /// + public static DataRowComparer Default { get { return DataRowComparer.Default; } } + + internal static bool AreEqual(object a, object b) + { + if (ReferenceEquals(a, b)) + { + // same reference or (null, null) or (DBNull.Value, DBNull.Value) + return true; + } + if (ReferenceEquals(a, null) || ReferenceEquals(a, DBNull.Value) || + ReferenceEquals(b, null) || ReferenceEquals(b, DBNull.Value)) + { + // (null, non-null) or (null, DBNull.Value) or vice versa + return false; + } + return (a.Equals(b) || (a.GetType().IsArray && CompareArray((Array)a, b as Array))); + } + + private static bool AreElementEqual(object a, object b) + { + if (ReferenceEquals(a, b)) + { + // same reference or (null, null) or (DBNull.Value, DBNull.Value) + return true; + } + if (ReferenceEquals(a, null) || ReferenceEquals(a, DBNull.Value) || + ReferenceEquals(b, null) || ReferenceEquals(b, DBNull.Value)) + { + // (null, non-null) or (null, DBNull.Value) or vice versa + return false; + } + return a.Equals(b); + } + + private static bool CompareArray(Array a, Array b) + { + if ((null == b) || + (1 != a.Rank) || + (1 != b.Rank) || + (a.Length != b.Length)) + { + // automatically consider array's with Rank>1 not-equal + return false; + } + + int index1 = a.GetLowerBound(0); + int index2 = b.GetLowerBound(0); + if (a.GetType() == b.GetType() && (0 == index1) && (0 == index2)) + { + switch (Type.GetTypeCode(a.GetType().GetElementType())) + { + case TypeCode.Byte: + return CompareEquatableArray((byte[])a, (byte[])b); + case TypeCode.Int16: + return CompareEquatableArray((short[])a, (short[])b); + case TypeCode.Int32: + return CompareEquatableArray((int[])a, (int[])b); + case TypeCode.Int64: + return CompareEquatableArray((long[])a, (long[])b); + case TypeCode.String: + return CompareEquatableArray((string[])a, (string[])b); + } + } + + // Compare every element. But don't recurse if we have Array of array. + int length = index1 + a.Length; + for (; index1 < length; ++index1, ++index2) + { + if (!AreElementEqual(a.GetValue(index1), b.GetValue(index2))) + { + return false; + } + } + return true; + } + + private static bool CompareEquatableArray(TElem[] a, TElem[] b) where TElem : IEquatable + { + Debug.Assert(!ReferenceEquals(a, b)); + Debug.Assert(a != null); + Debug.Assert(b != null); + Debug.Assert(a.Length == b.Length); + + for (int i = 0; i < a.Length; ++i) + { + if (!a[i].Equals(b[i])) + { + return false; + } + } + return true; + } + } + + /// + /// This class implements IEqualityComparer using value based semantics + /// when comparing DataRows. + /// + public sealed class DataRowComparer : IEqualityComparer where TRow : DataRow + { + /// + /// Private constructor to prevent initialization outside of Default singleton instance. + /// + private DataRowComparer() { } + + private static DataRowComparer s_instance = new DataRowComparer(); + + /// + /// Gets the singleton instance of the data row comparer. + /// + public static DataRowComparer Default { get { return s_instance; } } + + /// + /// This method compares to DataRows by doing a column by column value based + /// comparison. + /// + /// The first input DataRow + /// The second input DataRow + /// True if rows are equal, false if not. + public bool Equals(TRow leftRow, TRow rightRow) + { + if (ReferenceEquals(leftRow, rightRow)) + { + return true; + } + + if (ReferenceEquals(leftRow, null) || + ReferenceEquals(rightRow, null)) + { + return false; + } + + if (leftRow.RowState == DataRowState.Deleted || rightRow.RowState == DataRowState.Deleted) + { + throw DataSetUtil.InvalidOperation(SR.DataSetLinq_CannotCompareDeletedRow); + } + + int count = leftRow.Table.Columns.Count; + if (count != rightRow.Table.Columns.Count) + { + return false; + } + + for (int i = 0; i < count; ++i) + { + if (!DataRowComparer.AreEqual(leftRow[i], rightRow[i])) + { + return false; + } + } + return true; + } + + /// + /// This method retrieves a hash code for the source row. + /// + /// The source DataRow + /// HashCode for row based on values in the row. + public int GetHashCode(TRow row) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + + if (row.RowState == DataRowState.Deleted) + { + throw DataSetUtil.InvalidOperation(SR.DataSetLinq_CannotCompareDeletedRow); + } + + int hash = 0; + Debug.Assert(row.Table != null); + if (row.Table.Columns.Count > 0) + { + // if the row has at least one column, then use the first column value + object value = row[0]; + + Type valueType = value.GetType(); + if (valueType.IsArray) + { + Array array = value as Array; + + if (array.Rank > 1) + { + hash = value.GetHashCode(); + } + else if (array.Length > 0) + { + hash = array.GetValue(array.GetLowerBound(0)).GetHashCode(); + } + } + else + { + ValueType vt = value as ValueType; + + // have to unbox value types. + if (vt != null) + { + hash = vt.GetHashCode(); + } + else + { + hash = value.GetHashCode(); + } + } + } + + // if table has no columns, the hash code is 0 + return hash; + } + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataRowExtensions.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataRowExtensions.cs new file mode 100644 index 0000000000..c2fc2bb52e --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataRowExtensions.cs @@ -0,0 +1,171 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +namespace System.Data +{ + + /// + /// This static class defines the DataRow extension methods. + /// + public static class DataRowExtensions + { + + /// + /// This method provides access to the values in each of the columns in a given row. + /// This method makes casts unnecessary when accessing columns. + /// Additionally, Field supports nullable types and maps automatically between DBNull and + /// Nullable when the generic type is nullable. + /// + /// The input DataRow + /// The input column name specifying which row value to retrieve. + /// The DataRow value for the column specified. + public static T Field(this DataRow row, string columnName) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + return UnboxT.s_unbox(row[columnName]); + } + + /// + /// This method provides access to the values in each of the columns in a given row. + /// This method makes casts unnecessary when accessing columns. + /// Additionally, Field supports nullable types and maps automatically between DBNull and + /// Nullable when the generic type is nullable. + /// + /// The input DataRow + /// The input DataColumn specifying which row value to retrieve. + /// The DataRow value for the column specified. + public static T Field(this DataRow row, DataColumn column) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + return UnboxT.s_unbox(row[column]); + } + + /// + /// This method provides access to the values in each of the columns in a given row. + /// This method makes casts unnecessary when accessing columns. + /// Additionally, Field supports nullable types and maps automatically between DBNull and + /// Nullable when the generic type is nullable. + /// + /// The input DataRow + /// The input ordinal specifying which row value to retrieve. + /// The DataRow value for the column specified. + public static T Field(this DataRow row, int columnIndex) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + return UnboxT.s_unbox(row[columnIndex]); + } + + /// + /// This method provides access to the values in each of the columns in a given row. + /// This method makes casts unnecessary when accessing columns. + /// Additionally, Field supports nullable types and maps automatically between DBNull and + /// Nullable when the generic type is nullable. + /// + /// The input DataRow + /// The input ordinal specifying which row value to retrieve. + /// The DataRow version for which row value to retrieve. + /// The DataRow value for the column specified. + public static T Field(this DataRow row, int columnIndex, DataRowVersion version) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + return UnboxT.s_unbox(row[columnIndex, version]); + } + + /// + /// This method provides access to the values in each of the columns in a given row. + /// This method makes casts unnecessary when accessing columns. + /// Additionally, Field supports nullable types and maps automatically between DBNull and + /// Nullable when the generic type is nullable. + /// + /// The input DataRow + /// The input column name specifying which row value to retrieve. + /// The DataRow version for which row value to retrieve. + /// The DataRow value for the column specified. + public static T Field(this DataRow row, string columnName, DataRowVersion version) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + return UnboxT.s_unbox(row[columnName, version]); + } + + /// + /// This method provides access to the values in each of the columns in a given row. + /// This method makes casts unnecessary when accessing columns. + /// Additionally, Field supports nullable types and maps automatically between DBNull and + /// Nullable when the generic type is nullable. + /// + /// The input DataRow + /// The input DataColumn specifying which row value to retrieve. + /// The DataRow version for which row value to retrieve. + /// The DataRow value for the column specified. + public static T Field(this DataRow row, DataColumn column, DataRowVersion version) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + return UnboxT.s_unbox(row[column, version]); + } + + /// + /// This method sets a new value for the specified column for the DataRow it�s called on. + /// + /// The input DataRow. + /// The input ordinal specifying which row value to set. + /// The new row value for the specified column. + public static void SetField(this DataRow row, int columnIndex, T value) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + row[columnIndex] = (object)value ?? DBNull.Value; + } + + /// + /// This method sets a new value for the specified column for the DataRow it�s called on. + /// + /// The input DataRow. + /// The input column name specifying which row value to retrieve. + /// The new row value for the specified column. + public static void SetField(this DataRow row, string columnName, T value) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + row[columnName] = (object)value ?? DBNull.Value; + } + + /// + /// This method sets a new value for the specified column for the DataRow it�s called on. + /// + /// The input DataRow. + /// The input DataColumn specifying which row value to retrieve. + /// The new row value for the specified column. + public static void SetField(this DataRow row, DataColumn column, T value) + { + DataSetUtil.CheckArgumentNull(row, nameof(row)); + row[column] = (object)value ?? DBNull.Value; + } + + private static class UnboxT + { + internal static readonly Converter s_unbox = Create(); + + private static Converter Create() + { + if (default(T) == null) + return ReferenceOrNullableField; + else + return ValueField; + } + + private static T ReferenceOrNullableField(object value) + { + return ((DBNull.Value == value) ? default(T) : (T)value); + } + + private static T ValueField(object value) + { + if (DBNull.Value == value) + { + throw DataSetUtil.InvalidCast(string.Format(SR.DataSetLinq_NonNullableCast, typeof(T).ToString())); + } + return (T)value; + } + } + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataSetUtil.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataSetUtil.cs new file mode 100644 index 0000000000..c06e089890 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataSetUtil.cs @@ -0,0 +1,117 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Data; +using System.Diagnostics; + +internal static class DataSetUtil +{ + internal static void CheckArgumentNull(T argumentValue, string argumentName) where T : class + { + if (null == argumentValue) + { + throw ArgumentNull(argumentName); + } + } + + private static T TraceException(string trace, T e) + { + Debug.Assert(null != e, "TraceException: null Exception"); + return e; + } + + private static T TraceExceptionAsReturnValue(T e) + { + return TraceException(" '%ls'\n", e); + } + + internal static ArgumentException Argument(string message) + { + return TraceExceptionAsReturnValue(new ArgumentException(message)); + } + + internal static ArgumentNullException ArgumentNull(string message) + { + return TraceExceptionAsReturnValue(new ArgumentNullException(message)); + } + + internal static ArgumentOutOfRangeException ArgumentOutOfRange(string message, string parameterName) + { + return TraceExceptionAsReturnValue(new ArgumentOutOfRangeException(parameterName, message)); + } + + internal static InvalidCastException InvalidCast(string message) + { + return TraceExceptionAsReturnValue(new InvalidCastException(message)); + } + + internal static InvalidOperationException InvalidOperation(string message) + { + return TraceExceptionAsReturnValue(new InvalidOperationException(message)); + } + + internal static NotSupportedException NotSupported(string message) + { + return TraceExceptionAsReturnValue(new NotSupportedException(message)); + } + + static internal ArgumentOutOfRangeException InvalidEnumerationValue(Type type, int value) + { + return ArgumentOutOfRange(string.Format(SR.DataSetLinq_InvalidEnumerationValue, type.Name, value.ToString(System.Globalization.CultureInfo.InvariantCulture)), type.Name); + } + + static internal ArgumentOutOfRangeException InvalidDataRowState(DataRowState value) + { +#if DEBUG + switch (value) + { + case DataRowState.Detached: + case DataRowState.Unchanged: + case DataRowState.Added: + case DataRowState.Deleted: + case DataRowState.Modified: + Debug.Assert(false, "valid DataRowState " + value.ToString()); + break; + } +#endif + return InvalidEnumerationValue(typeof(DataRowState), (int)value); + } + + static internal ArgumentOutOfRangeException InvalidLoadOption(LoadOption value) + { +#if DEBUG + switch (value) + { + case LoadOption.OverwriteChanges: + case LoadOption.PreserveChanges: + case LoadOption.Upsert: + Debug.Assert(false, "valid LoadOption " + value.ToString()); + break; + } +#endif + return InvalidEnumerationValue(typeof(LoadOption), (int)value); + } + + // only StackOverflowException & ThreadAbortException are sealed classes + private static readonly Type s_stackOverflowType = typeof(StackOverflowException); + private static readonly Type s_outOfMemoryType = typeof(OutOfMemoryException); + private static readonly Type s_threadAbortType = typeof(System.Threading.ThreadAbortException); + private static readonly Type s_nullReferenceType = typeof(NullReferenceException); + private static readonly Type s_accessViolationType = typeof(AccessViolationException); + private static readonly Type s_securityType = typeof(System.Security.SecurityException); + + static internal bool IsCatchableExceptionType(Exception e) + { + // a 'catchable' exception is defined by what it is not. + Type type = e.GetType(); + + return ((type != s_stackOverflowType) && + (type != s_outOfMemoryType) && + (type != s_threadAbortType) && + (type != s_nullReferenceType) && + (type != s_accessViolationType) && + !s_securityType.IsAssignableFrom(type)); + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataTableExtensions.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataTableExtensions.cs new file mode 100644 index 0000000000..593edb080d --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/DataTableExtensions.cs @@ -0,0 +1,222 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; + +namespace System.Data +{ + + /// + /// This static class defines the DataTable extension methods. + /// + public static class DataTableExtensions + { + /// + /// This method returns a IEnumerable of Datarows. + /// + /// The source DataTable to make enumerable. + /// IEnumerable of datarows. + public static EnumerableRowCollection AsEnumerable(this DataTable source) + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + return new EnumerableRowCollection(source); + } + + /// + /// This method takes an input sequence of DataRows and produces a DataTable object + /// with copies of the source rows. + /// Also note that this will cause the rest of the query to execute at this point in time + /// (e.g. there is no more delayed execution after this sequence operator). + /// + /// The input sequence of DataRows + /// DataTable containing copies of the source DataRows. Properties for the DataTable table will be taken from first DataRow in the source. + /// if source is null + /// if source is empty + public static DataTable CopyToDataTable(this IEnumerable source) + where T : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + return LoadTableFromEnumerable(source, table: null, options: null, errorHandler: null); + } + + /// + /// Delegates to other CopyToDataTable overload with a null FillErrorEventHandler. + /// + public static void CopyToDataTable(this IEnumerable source, DataTable table, LoadOption options) + where T : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + DataSetUtil.CheckArgumentNull(table, nameof(table)); + LoadTableFromEnumerable(source, table, options, errorHandler: null); + } + + + /// + /// This method takes an input sequence of DataRows and produces a DataTable object + /// with copies of the source rows. + /// Also note that this will cause the rest of the query to execute at this point in time + /// (e.g. there is no more delayed execution after this sequence operator). + /// + /// The input sequence of DataRows. CopyToDataTable uses DataRowVersion.Default when retrieving values from source DataRow + /// which will include proposed values for DataRow being edited. Null DataRow in the sequence are skipped. + /// The target DataTable to load. + /// The target DataTable to load. + /// Error handler for recoverable errors. + /// Recoverable errors include: + /// A source DataRow is in the deleted or detached state. + /// DataTable.LoadDataRow threw an exception, i.e. wrong # of columns in source row + /// Unrecoverable errors include: + /// exceptions from IEnumerator, DataTable.BeginLoadData or DataTable.EndLoadData + /// DataTable containing copies of the source DataRows. + /// if source is null + /// if table is null + /// if source DataRow is in Deleted or Detached state + public static void CopyToDataTable(this IEnumerable source, DataTable table, LoadOption options, FillErrorEventHandler errorHandler) + where T : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + DataSetUtil.CheckArgumentNull(table, nameof(table)); + LoadTableFromEnumerable(source, table, options, errorHandler); + } + + private static DataTable LoadTableFromEnumerable(IEnumerable source, DataTable table, LoadOption? options, FillErrorEventHandler errorHandler) + where T : DataRow + { + if (options.HasValue) + { + switch (options.Value) + { + case LoadOption.OverwriteChanges: + case LoadOption.PreserveChanges: + case LoadOption.Upsert: + break; + default: + throw DataSetUtil.InvalidLoadOption(options.Value); + } + } + + + using (IEnumerator rows = source.GetEnumerator()) + { + // need to get first row to create table + if (!rows.MoveNext()) + { + return table ?? throw DataSetUtil.InvalidOperation(SR.DataSetLinq_EmptyDataRowSource); + } + + DataRow current; + if (table == null) + { + current = rows.Current; + if (current == null) + { + throw DataSetUtil.InvalidOperation(SR.DataSetLinq_NullDataRow); + } + + table = new DataTable() + { + Locale = CultureInfo.CurrentCulture + }; + + // We do not copy the same properties that DataView.ToTable does. + // If user needs that functionality, use other CopyToDataTable overloads. + // The reasoning being, the IEnumerator can be sourced from + // different DataTable, so we just use the "Default" instead of resolving the difference. + + foreach (DataColumn column in current.Table.Columns) + { + table.Columns.Add(column.ColumnName, column.DataType); + } + } + + table.BeginLoadData(); + try + { + do + { + current = rows.Current; + if (current == null) + { + continue; + } + + object[] values = null; + try + { + // 'recoverable' error block + switch (current.RowState) + { + case DataRowState.Detached: + if (!current.HasVersion(DataRowVersion.Proposed)) + { + throw DataSetUtil.InvalidOperation(SR.DataSetLinq_CannotLoadDetachedRow); + } + goto case DataRowState.Added; + case DataRowState.Unchanged: + case DataRowState.Added: + case DataRowState.Modified: + values = current.ItemArray; + if (options.HasValue) + { + table.LoadDataRow(values, options.Value); + } + else + { + table.LoadDataRow(values, fAcceptChanges: true); + } + break; + case DataRowState.Deleted: + throw DataSetUtil.InvalidOperation(SR.DataSetLinq_CannotLoadDeletedRow); + default: + throw DataSetUtil.InvalidDataRowState(current.RowState); + } + } + catch (Exception e) + { + if (!DataSetUtil.IsCatchableExceptionType(e)) + { + throw; + } + + FillErrorEventArgs fillError = null; + if (null != errorHandler) + { + fillError = new FillErrorEventArgs(table, values) + { + Errors = e + }; + errorHandler.Invoke(rows, fillError); + } + if (null == fillError) + { + throw; + } + else if (!fillError.Continue) + { + if (ReferenceEquals(fillError.Errors ?? e, e)) + { + // if user didn't change exception to throw (or set it to null) + throw; + } + else + { + // user may have changed exception to throw in handler + throw fillError.Errors; + } + } + } + } while (rows.MoveNext()); + } + finally + { + table.EndLoadData(); + } + } + Debug.Assert(null != table, "null DataTable"); + return table; + } + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/EnumerableRowCollection.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/EnumerableRowCollection.cs new file mode 100644 index 0000000000..6a9889c568 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/EnumerableRowCollection.cs @@ -0,0 +1,178 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Diagnostics; +using System.Linq; + +namespace System.Data +{ + /// + /// Provides an entry point so that Cast operator call can be intercepted within an extension method. + /// + public abstract class EnumerableRowCollection : IEnumerable + { + internal abstract Type ElementType { get; } + internal abstract DataTable Table { get; } + + internal EnumerableRowCollection() + { + } + + IEnumerator IEnumerable.GetEnumerator() + { + return null; + } + } + + /// + /// This class provides a wrapper for DataTables to allow for querying via LINQ. + /// + public class EnumerableRowCollection : EnumerableRowCollection, IEnumerable + { + private readonly DataTable _table; + private readonly IEnumerable _enumerableRows; + private readonly List> _listOfPredicates; + + // Stores list of sort expression in the order provided by user. E.g. order by, thenby, thenby descending.. + private readonly SortExpressionBuilder _sortExpression; + + private readonly Func _selector; + + internal override Type ElementType + { + get + { + return typeof(TRow); + } + + } + + internal IEnumerable EnumerableRows + { + get + { + return _enumerableRows; + } + } + + internal override DataTable Table + { + get + { + return _table; + } + } + + /// + /// This constructor is used when Select operator is called with output Type other than input row Type. + /// Basically fail on GetLDV(), but other LINQ operators must work. + /// + internal EnumerableRowCollection(IEnumerable enumerableRows, bool isDataViewable, DataTable table) + { + Debug.Assert(!isDataViewable || table != null, "isDataViewable bug table is null"); + + _enumerableRows = enumerableRows; + if (isDataViewable) + { + _table = table; + } + _listOfPredicates = new List>(); + _sortExpression = new SortExpressionBuilder(); + } + + /// + /// Basic Constructor + /// + internal EnumerableRowCollection(DataTable table) + { + _table = table; + _enumerableRows = table.Rows.Cast(); + _listOfPredicates = new List>(); + _sortExpression = new SortExpressionBuilder(); + } + + /// + /// Copy Constructor that sets the input IEnumerable as enumerableRows + /// Used to maintain IEnumerable that has linq operators executed in the same order as the user + /// + internal EnumerableRowCollection(EnumerableRowCollection source, IEnumerable enumerableRows, Func selector) + { + Debug.Assert(null != enumerableRows, "null enumerableRows"); + + _enumerableRows = enumerableRows; + _selector = selector; + if (null != source) + { + if (null == source._selector) + { + _table = source._table; + } + _listOfPredicates = new List>(source._listOfPredicates); + //deep copy the List + _sortExpression = source._sortExpression.Clone(); + } + else + { + _listOfPredicates = new List>(); + _sortExpression = new SortExpressionBuilder(); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// This method returns an strongly typed iterator + /// for the underlying DataRow collection. + /// + /// A strongly typed iterator. + public IEnumerator GetEnumerator() + { + return _enumerableRows.GetEnumerator(); + } + + /// + /// Used to add a filter predicate. + /// A conjunction of all predicates are evaluated in LinqDataView + /// + internal void AddPredicate(Func pred) + { + Debug.Assert(pred != null); + _listOfPredicates.Add(pred); + } + + /// + /// Adds a sort expression when Keyselector is provided but not Comparer + /// + internal void AddSortExpression(Func keySelector, bool isDescending, bool isOrderBy) + { + AddSortExpression(keySelector, Comparer.Default, isDescending, isOrderBy); + } + + /// + /// Adds a sort expression when Keyselector and Comparer are provided. + /// + internal void AddSortExpression(Func keySelector, IComparer comparer, bool isDescending, bool isOrderBy) + { + DataSetUtil.CheckArgumentNull(keySelector, nameof(keySelector)); + DataSetUtil.CheckArgumentNull(comparer, nameof(comparer)); + + _sortExpression.Add( + delegate (TRow input) + { + return keySelector(input); + }, + delegate (object val1, object val2) + { + return (isDescending ? -1 : 1) * comparer.Compare((TKey)val1, (TKey)val2); + }, + isOrderBy); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/EnumerableRowCollectionExtensions.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/EnumerableRowCollectionExtensions.cs new file mode 100644 index 0000000000..3c8623a2f0 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/EnumerableRowCollectionExtensions.cs @@ -0,0 +1,164 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; + +namespace System.Data +{ + /// + /// This static class defines the extension methods that add LINQ operator functionality + /// within IEnumerableDT and IOrderedEnumerableDT. + /// + public static class EnumerableRowCollectionExtensions + { + /// + /// LINQ's Where operator for generic EnumerableRowCollection. + /// + public static EnumerableRowCollection Where(this EnumerableRowCollection source, Func predicate) + { + //copy constructor + EnumerableRowCollection edt = new EnumerableRowCollection(source, Enumerable.Where(source, predicate), selector: null); + edt.AddPredicate(predicate); + return edt; + } + + /// + /// LINQ's OrderBy operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderBy(this EnumerableRowCollection source, Func keySelector) + { + IEnumerable ie = Enumerable.OrderBy(source, keySelector); + + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + edt.AddSortExpression(keySelector, isDescending: false, isOrderBy: true); + return edt; + } + + /// + /// LINQ's OrderBy operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderBy(this EnumerableRowCollection source, Func keySelector, IComparer comparer) + { + IEnumerable ie = Enumerable.OrderBy(source, keySelector, comparer); + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + edt.AddSortExpression(keySelector, comparer, isDescending: false, isOrderBy: true); + return edt; + } + + /// + /// LINQ's OrderByDescending operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderByDescending(this EnumerableRowCollection source, Func keySelector) + { + IEnumerable ie = Enumerable.OrderByDescending(source, keySelector); + + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + edt.AddSortExpression(keySelector, isDescending: true, isOrderBy: true); + return edt; + } + + /// + /// LINQ's OrderByDescending operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderByDescending(this EnumerableRowCollection source, Func keySelector, IComparer comparer) + { + IEnumerable ie = Enumerable.OrderByDescending(source, keySelector, comparer); + + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + edt.AddSortExpression(keySelector, comparer, isDescending: true, isOrderBy: true); + return edt; + } + + /// + /// LINQ's ThenBy operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection ThenBy(this OrderedEnumerableRowCollection source, Func keySelector) + { + IEnumerable ie = Enumerable.ThenBy((IOrderedEnumerable)source.EnumerableRows, keySelector); + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + + edt.AddSortExpression(keySelector, isDescending: false, isOrderBy: false); + return edt; + } + + /// + /// LINQ's ThenBy operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection ThenBy(this OrderedEnumerableRowCollection source, Func keySelector, IComparer comparer) + { + IEnumerable ie = Enumerable.ThenBy((IOrderedEnumerable)source.EnumerableRows, keySelector, comparer); + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + + edt.AddSortExpression(keySelector, comparer, isDescending: false, isOrderBy: false); + return edt; + } + + /// + /// LINQ's ThenByDescending operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection ThenByDescending(this OrderedEnumerableRowCollection source, Func keySelector) + { + IEnumerable ie = Enumerable.ThenByDescending((IOrderedEnumerable)source.EnumerableRows, keySelector); + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + + edt.AddSortExpression(keySelector, isDescending: true, isOrderBy: false); + return edt; + } + + /// + /// LINQ's ThenByDescending operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection ThenByDescending(this OrderedEnumerableRowCollection source, Func keySelector, IComparer comparer) + { + IEnumerable ie = Enumerable.ThenByDescending((IOrderedEnumerable)source.EnumerableRows, keySelector, comparer); + OrderedEnumerableRowCollection edt = new OrderedEnumerableRowCollection(source, ie); + + edt.AddSortExpression(keySelector, comparer, isDescending: true, isOrderBy: false); + return edt; + } + + /// + /// Executes a Select (Projection) on EnumerableDataTable. If the selector returns a different + /// type than the type of rows, then AsLinqDataView is disabled, and the returning EnumerableDataTable + /// represents an enumerable over the LINQ Query. + /// + public static EnumerableRowCollection Select(this EnumerableRowCollection source, Func selector) + { + //Anonymous type or some other type + //The only thing that matters from this point on is _enumerableRows + IEnumerable typedEnumerable = Enumerable.Select(source, selector); + + // Dont need predicates or sort expression from this point on since we know AsLinqDataView is disabled. + return new EnumerableRowCollection(((object)source) as EnumerableRowCollection, typedEnumerable, ((object)selector) as Func); + } + + /// + /// Casts an EnumerableDataTable_TSource into EnumerableDataTable_TResult + /// + public static EnumerableRowCollection Cast(this EnumerableRowCollection source) + { + // Since Cast does not have the signature Cast_T_R(..) this call is routed through the non-generic base class EnumerableDataTable + + if ((null != source) && source.ElementType.Equals(typeof(TResult))) + { + return (EnumerableRowCollection)source; + } + else + { + //Anonymous type or some other type + //The only thing that matters from this point on is _enumerableRows + + IEnumerable typedEnumerable = Enumerable.Cast(source); + + EnumerableRowCollection newEdt = new EnumerableRowCollection( + typedEnumerable, + typeof(TResult).IsAssignableFrom(source.ElementType) && typeof(DataRow).IsAssignableFrom(typeof(TResult)), + source.Table); + + return newEdt; + } + } + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/OrderedEnumerableRowCollection.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/OrderedEnumerableRowCollection.cs new file mode 100644 index 0000000000..75c24f71af --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/OrderedEnumerableRowCollection.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; + +namespace System.Data +{ + + /// + /// This class provides a wrapper for DataTables representing an ordered sequence. + /// + public sealed class OrderedEnumerableRowCollection : EnumerableRowCollection + { + /// + /// Copy Constructor that sets enumerableRows to the one given in the input + /// + internal OrderedEnumerableRowCollection(EnumerableRowCollection enumerableTable, IEnumerable enumerableRows) + : base(enumerableTable, enumerableRows, null) + { + + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/SortExpressionBuilder.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/SortExpressionBuilder.cs new file mode 100644 index 0000000000..7d4dd356b7 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/SortExpressionBuilder.cs @@ -0,0 +1,196 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; + +namespace System.Data +{ + + /// + /// This class represents a combined sort expression build using multiple sort expressions. + /// + /// + internal class SortExpressionBuilder : IComparer> + { + /** + * This class ensures multiple orderby/thenbys are handled correctly. Its semantics is as follows: + * + * Query 1: + * orderby a + * thenby b + * orderby c + * orderby d + * thenby e + * + * is equivalent to: + * + * Query 2: + * orderby d + * thenby e + * thenby c + * thenby a + * thenby b + * + **/ + + // Selectors and comparers are mapped using the index in the list. + // E.g: _comparers[i] is used with _selectors[i] + + LinkedList> _selectors = new LinkedList>(); + LinkedList> _comparers = new LinkedList>(); + + LinkedListNode> _currentSelector = null; + LinkedListNode> _currentComparer = null; + + /// + /// Adds a sorting selector/comparer in the correct order + /// + internal void Add(Func keySelector, Comparison compare, bool isOrderBy) + { + Debug.Assert(keySelector != null); + Debug.Assert(compare != null); + // Inputs are assumed to be valid. The burden for ensuring it is on the caller. + + if (isOrderBy) + { + _currentSelector = _selectors.AddFirst(keySelector); + _currentComparer = _comparers.AddFirst(compare); + } + else + { + // ThenBy can only be called after OrderBy + Debug.Assert(_currentSelector != null); + Debug.Assert(_currentComparer != null); + + _currentSelector = _selectors.AddAfter(_currentSelector, keySelector); + _currentComparer = _comparers.AddAfter(_currentComparer, compare); + } + } + + /// + /// Represents a Combined selector of all selectors added thus far. + /// + /// List of 'objects returned by each selector'. This list is the combined-selector + public List Select(T row) + { + List result = new List(); + + foreach (Func selector in _selectors) + { + result.Add(selector(row)); + } + + return result; + } + + + /// + /// Represents a Comparer (of IComparer) that compares two combined-selectors using + /// provided comparers for each individual selector. + /// Note: Comparison is done in the order it was Added. + /// + /// Comparison result of the combined Sort comparer expression + public int Compare(List a, List b) + { + Debug.Assert(a.Count == Count); + + int i = 0; + foreach (Comparison compare in _comparers) + { + int result = compare(a[i], b[i]); + + if (result != 0) + { + return result; + } + i++; + } + + return 0; + } + + internal int Count + { + get + { + //weak now that we have two dimensions + Debug.Assert(_selectors.Count == _comparers.Count); + return _selectors.Count; + } + } + + /// + /// Clones the SortexpressionBuilder and returns a new object + /// that points to same comparer and selectors (in the same order). + /// + internal SortExpressionBuilder Clone() + { + SortExpressionBuilder builder = new SortExpressionBuilder(); + + foreach (Func selector in _selectors) + { + if (selector == _currentSelector.Value) + { + builder._currentSelector = builder._selectors.AddLast(selector); + } + else + { + builder._selectors.AddLast(selector); + } + } + + + foreach (Comparison comparer in _comparers) + { + if (comparer == _currentComparer.Value) + { + builder._currentComparer = builder._comparers.AddLast(comparer); + } + else + { + builder._comparers.AddLast(comparer); + } + } + + return builder; + } + + /// + /// Clones the SortExpressinBuilder and casts to type TResult. + /// + internal SortExpressionBuilder CloneCast() + { + SortExpressionBuilder builder = new SortExpressionBuilder(); + + foreach (Func selector in _selectors) + { + if (selector == _currentSelector.Value) + { + builder._currentSelector = builder._selectors.AddLast(r => selector((T)(object)r)); + } + else + { + builder._selectors.AddLast(r => selector((T)(object)r)); + } + } + + + foreach (Comparison comparer in _comparers) + { + if (comparer == _currentComparer.Value) + { + builder._currentComparer = builder._comparers.AddLast(comparer); + } + else + { + builder._comparers.AddLast(comparer); + } + } + + return builder; + } + + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/TypedTableBase.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/TypedTableBase.cs new file mode 100644 index 0000000000..908f5f078e --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/TypedTableBase.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace System.Data +{ + /// + /// This is the generic base class for TypedDataSet + /// + [Serializable] + public abstract class TypedTableBase : DataTable, IEnumerable where T : DataRow + { + + /// + /// Default constructor for generic TypedTableBase. + /// Will be called by generated Typed DataSet classes and is not for public use. + /// + protected TypedTableBase() : base() { } + + /// + /// Constructor for the generic TypedTableBase with takes SerializationInfo and StreamingContext. + /// Will be called by generated Typed DataSet classes and + /// is not for public use. + /// + /// SerializationInfo containing data to construct the object. + /// The streaming context for the object being deserialized. + protected TypedTableBase(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + : base(info, context) { } + + /// + /// This property returns an enumerator of T for the TypedTable. Note, this could + /// execute the underlying Linq expression. + /// + /// IEnumerable of T. + public IEnumerator GetEnumerator() + { + return Rows.Cast().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Casts an EnumerableDataTable_TSource into EnumerableDataTable_TResult + /// + public EnumerableRowCollection Cast() + { + EnumerableRowCollection erc = new EnumerableRowCollection(this); + return erc.Cast(); + } + + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/TypedTableBaseExtensions.cs b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/TypedTableBaseExtensions.cs new file mode 100644 index 0000000000..fc9348a697 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/src/System/Data/TypedTableBaseExtensions.cs @@ -0,0 +1,107 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; + +namespace System.Data +{ + /// + /// This static class defines the extension methods that add LINQ operator functionality + /// within IEnumerableDT and IOrderedEnumerableDT. + /// + public static class TypedTableBaseExtensions + { + /// + /// LINQ's Where operator for generic EnumerableRowCollection. + /// + public static EnumerableRowCollection Where(this TypedTableBase source, Func predicate) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + EnumerableRowCollection erc = new EnumerableRowCollection(source); + return erc.Where(predicate); + } + + /// + /// LINQ's OrderBy operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderBy(this TypedTableBase source, Func keySelector) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + EnumerableRowCollection erc = new EnumerableRowCollection(source); + return erc.OrderBy(keySelector); + } + + /// + /// LINQ's OrderBy operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderBy( + this TypedTableBase source, + Func keySelector, + IComparer comparer) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + EnumerableRowCollection erc = new EnumerableRowCollection(source); + return erc.OrderBy(keySelector, comparer); + } + + /// + /// LINQ's OrderByDescending operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderByDescending(this TypedTableBase source, Func keySelector) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + EnumerableRowCollection erc = new EnumerableRowCollection(source); + return erc.OrderByDescending(keySelector); + } + + /// + /// LINQ's OrderByDescending operator for generic EnumerableRowCollection. + /// + public static OrderedEnumerableRowCollection OrderByDescending( + this TypedTableBase source, + Func keySelector, + IComparer comparer) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + EnumerableRowCollection erc = new EnumerableRowCollection(source); + return erc.OrderByDescending(keySelector, comparer); + } + + + /// + /// Executes a Select (Projection) on EnumerableDataTable. If the selector returns a different + /// type than the type of rows, then AsLinqDataView is disabled, and the returning EnumerableDataTable + /// represents an enumerable over the LINQ Query. + /// + public static EnumerableRowCollection Select(this TypedTableBase source, Func selector) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + EnumerableRowCollection erc = new EnumerableRowCollection(source); + return erc.Select(selector); + } + + /// + /// This method returns a IEnumerable of TRow. + /// + /// The source DataTable to make enumerable. + /// IEnumerable of datarows. + public static EnumerableRowCollection AsEnumerable(this TypedTableBase source) where TRow : DataRow + { + DataSetUtil.CheckArgumentNull(source, nameof(source)); + return new EnumerableRowCollection(source as DataTable); + } + + public static TRow ElementAtOrDefault(this TypedTableBase source, int index) where TRow : DataRow + { + if ((index >= 0) && (index < source.Rows.Count)) + { + return (TRow)source.Rows[index]; + } + else + { + return default(TRow); + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/Configurations.props b/external/corefx/src/System.Data.DataSetExtensions/tests/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataRowComparerTest.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataRowComparerTest.cs new file mode 100644 index 0000000000..1428cc167e --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataRowComparerTest.cs @@ -0,0 +1,253 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// DataRowComparerTest.cs +// +// Author: +// Atsushi Enomoto +// +// Copyright (C) 2008 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.Collections.Generic; +using System.Data; +using Xunit; + +namespace MonoTests.System.Data +{ + public class DataRowComparerTest + { + [Fact] + public void Default() + { + DataRowComparer c1 = DataRowComparer.Default; + DataRowComparer c2 = DataRowComparer.Default; + Assert.Same(c1, c2); + } + + [Fact] + public void Equals() + { + DataRowComparer c = DataRowComparer.Default; + + DataTable dtA = new DataTable("tableA"); + dtA.Columns.Add("col1", typeof(int)); + dtA.Columns.Add("col2", typeof(string)); + dtA.Columns.Add("col3", typeof(DateTime)); + DataRow r1 = dtA.Rows.Add(3, "bar", new DateTime(2008, 5, 7)); + DataRow r2 = dtA.Rows.Add(3, "bar", new DateTime(2008, 5, 7)); + + Assert.True(c.Equals(r1, r2), "#A1"); + r1["col1"] = 4; + Assert.False(c.Equals(r1, r2), "#A2"); + r1["col1"] = 3; + Assert.True(c.Equals(r1, r2), "#A3"); + + r1["col2"] = null; + Assert.False(c.Equals(r1, r2), "#B1"); + r2["col2"] = null; + Assert.True(c.Equals(r1, r2), "#B2"); + r1["col2"] = "bar"; + Assert.False(c.Equals(r1, r2), "#B3"); + r2["col2"] = "bar"; + Assert.True(c.Equals(r1, r2), "#B4"); + + r1["col3"] = DBNull.Value; + Assert.False(c.Equals(r1, r2), "#C1"); + r2["col3"] = DBNull.Value; + Assert.True(c.Equals(r1, r2), "#C2"); + r1["col3"] = new DateTime(2008, 5, 7); + Assert.False(c.Equals(r1, r2), "#C3"); + r2["col3"] = new DateTime(2008, 5, 7); + Assert.True(c.Equals(r1, r2), "#C4"); + + Assert.False(c.Equals(r1, null), "#D1"); + Assert.False(c.Equals(null, r1), "#D2"); + Assert.True(c.Equals(null, null), "#D3"); + + // rows do not have to share the same parent + + DataTable dtB = new DataTable("tableB"); + dtB.Columns.Add("colB1", typeof(int)); + dtB.Columns.Add("colB2", typeof(string)); + dtB.Columns.Add("colB3", typeof(DateTime)); + + DataRow r3 = dtB.Rows.Add(3, "bar", new DateTime(2008, 5, 7)); + + Assert.True(c.Equals(r1, r3), "#E1"); + r1["col1"] = 4; + Assert.False(c.Equals(r1, r3), "#E2"); + r1["col1"] = 3; + Assert.True(c.Equals(r1, r3), "#E3"); + + // difference in rowstate is ignored + + r1.AcceptChanges(); + + Assert.True(c.Equals(r1, r2), "#G1"); + r1["col1"] = 4; + Assert.False(c.Equals(r1, r2), "#G2"); + r1["col1"] = 3; + Assert.True(c.Equals(r1, r2), "#G3"); + + // rows have different number of columns + + DataTable dtC = new DataTable("tableC"); + dtC.Columns.Add("colC1", typeof(int)); + dtC.Columns.Add("colC2", typeof(string)); + + DataRow r4 = dtC.Rows.Add(3, "bar"); + + Assert.False(c.Equals(r1, r4), "#H1"); + r1["col3"] = DBNull.Value; + Assert.False(c.Equals(r1, r4), "#H2"); + } + + [Fact] + public void Equals_Rows_Detached() + { + DataRowComparer c = DataRowComparer.Default; + + DataTable dt = new DataTable("tableA"); + dt.Columns.Add("col1", typeof(int)); + dt.Columns.Add("col2", typeof(string)); + dt.Columns.Add("col3", typeof(DateTime)); + DataRow r1 = dt.Rows.Add(3, "bar", new DateTime(2008, 5, 7)); + DataRow r2 = dt.NewRow(); + r2.ItemArray = new object[] { 3, "bar", new DateTime(2008, 5, 7) }; + DataRow r3 = dt.NewRow(); + r3.ItemArray = new object[] { 3, "bar", new DateTime(2008, 5, 7) }; + + // left row detached + Assert.True(c.Equals(r2, r1), "#A1"); + r1["col1"] = 4; + Assert.False(c.Equals(r2, r1), "#A2"); + r1["col1"] = 3; + Assert.True(c.Equals(r2, r1), "#A3"); + + // right row detached + Assert.True(c.Equals(r1, r2), "#B1"); + r1["col2"] = "baz"; + Assert.False(c.Equals(r1, r2), "#B2"); + r1["col2"] = "bar"; + Assert.True(c.Equals(r1, r2), "#B3"); + + // both rows detached + Assert.True(c.Equals(r2, r3), "#C1"); + r2["col3"] = new DateTime(2008, 6, 7); + Assert.False(c.Equals(r2, r3), "#C2"); + r2["col3"] = new DateTime(2008, 5, 7); + Assert.True(c.Equals(r2, r3), "#C3"); + } + + [Fact] + public void Equals_Rows_Deleted() + { + DataRowComparer c = DataRowComparer.Default; + + DataTable dtA = new DataTable("tableA"); + dtA.Columns.Add("col1", typeof(int)); + dtA.Columns.Add("col2", typeof(string)); + dtA.Columns.Add("col3", typeof(DateTime)); + DataRow r1 = dtA.Rows.Add(3, "bar", new DateTime(2008, 5, 7)); + DataRow r2 = dtA.Rows.Add(3, "bar", new DateTime(2008, 5, 7)); + + r1.Delete(); + + // left row deleted + try + { + c.Equals(r1, r2); + Assert.True(false, "#A1"); + } + catch (RowNotInTableException ex) + { + Assert.Equal(typeof(RowNotInTableException), ex.GetType()); + Assert.Null(ex.InnerException); + Assert.NotNull(ex.Message); + } + + // right row deleted + try + { + c.Equals(r2, r1); + Assert.True(false, "#B1"); + } + catch (RowNotInTableException ex) + { + Assert.Equal(typeof(RowNotInTableException), ex.GetType()); + Assert.Null(ex.InnerException); + Assert.NotNull(ex.Message); + } + + r2.Delete(); + + // both rows deleted + try + { + c.Equals(r2, r1); + Assert.True(false, "#C1"); + } + catch (RowNotInTableException ex) + { + Assert.Equal(typeof(RowNotInTableException), ex.GetType()); + Assert.Null(ex.InnerException); + Assert.NotNull(ex.Message); + } + } + + [Fact] + public void GetHashCodeWithVersions() + { + DataSet ds = new DataSet(); + DataTable dt = new DataTable("MyTable"); + ds.Tables.Add(dt); + dt.Columns.Add("col1"); + dt.Columns.Add("col2"); + DataRow r1 = dt.Rows.Add(new object[] { "foo", "bar" }); + DataRow r2 = dt.Rows.Add(new object[] { "foo", "bar" }); + ds.AcceptChanges(); + DataRowComparer c = DataRowComparer.Default; + Assert.True(c.GetHashCode(r1) == c.GetHashCode(r2), "#1"); + } + + [Fact] + public void GetHashCode_Row_Null() + { + DataRowComparer c = DataRowComparer.Default; + + try + { + c.GetHashCode(null); + Assert.True(false, "#1"); + } + catch (ArgumentNullException ex) + { + Assert.Equal(typeof(ArgumentNullException), ex.GetType()); + Assert.Null(ex.InnerException); + Assert.NotNull(ex.Message); + Assert.Equal("row", ex.ParamName); + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataRowExtensionsTest.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataRowExtensionsTest.cs new file mode 100644 index 0000000000..4eb2328af0 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataRowExtensionsTest.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// DataRowExtensionsTest.cs +// +// Author: +// Marek Habersack (mhabersack@novell.com) +// +// Copyright (C) 2008 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.Collections.Generic; +using System.Data; +using Xunit; + +namespace MonoTests.System.Data +{ + public class DataRowExtensionsTest + { + DataRow SetupRow() + { + DataTable dt = new DataTable("TestTable"); + DataColumn dc = new DataColumn("Column1", typeof(string)); + dc.AllowDBNull = true; + dt.Columns.Add(dc); + + dc = new DataColumn("Column2", typeof(int)); + dc.AllowDBNull = true; + dt.Columns.Add(dc); + + DataRow row = dt.NewRow(); + dt.Rows.Add(row); + return row; + } + + [Fact] + public void Field_T_DBNullFieldValue() + { + DataRow row = SetupRow(); + row["Column1"] = null; + row["Column2"] = DBNull.Value; + + string s = row.Field("Column1"); + Assert.Equal(null, s); + + int? i = row.Field("Column2"); + Assert.Equal(null, i); + } + + [Fact] + public void Field_T_DBNullFieldValue_ValueType() + { + DataRow row = SetupRow(); + row["Column1"] = null; + row["Column2"] = DBNull.Value; + + Assert.Throws(() => row.Field("Column2")); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataTableExtensionsTest.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataTableExtensionsTest.cs new file mode 100644 index 0000000000..60cdc772ab --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/DataTableExtensionsTest.cs @@ -0,0 +1,94 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// DataTableExtensionsTest.cs +// +// Author: +// Atsushi Enomoto +// +// Copyright (C) 2008 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.Collections.Generic; +using System.Data; +using System.Linq; +using Xunit; + +namespace MonoTests.System.Data +{ + public class DataTableExtensionsTest + { + private string _testDataSet = "testdataset1.xml"; + + [Fact] + public void CopyToDataTableNoArgNoRows() + { + DataTable dt = new DataTable(); + dt.Columns.Add("CID", typeof(int)); + dt.Columns.Add("CName", typeof(string)); + + // for no rows + Assert.Throws(() => dt.AsEnumerable().CopyToDataTable()); + } + + [Fact] + public void CopyToDataTableNoArg() + { + DataTable dt = new DataTable(); + dt.Columns.Add("CID", typeof(int)); + dt.Columns.Add("CName", typeof(string)); + dt.Rows.Add(new object[] { 1, "foo" }); + DataTable dst = dt.AsEnumerable().CopyToDataTable(); + Assert.Equal(1, dst.Rows.Count); + Assert.Equal("foo", dst.Rows[0]["CName"]); + } + + [Fact] + public void CopyToDataTableTableArgNoRows() + { + DataTable dt = new DataTable(); + dt.Columns.Add("CID", typeof(int)); + dt.Columns.Add("CName", typeof(string)); + DataTable dst = new DataTable(); + dt.AsEnumerable().CopyToDataTable(dst, LoadOption.PreserveChanges); + } + + [Fact] + public void AsEnumerable() + { + DataSet ds = new DataSet(); + ds.ReadXml(_testDataSet); + DataTable dt = ds.Tables[0]; + Assert.Equal("ScoreList", dt.TableName); + var dv = dt.AsEnumerable(); + Assert.Equal(4, dv.Count()); + var i = dv.GetEnumerator(); + Assert.True(i.MoveNext(), "#1"); + Assert.Equal(1, i.Current["ID"]); + Assert.True(i.MoveNext(), "#3"); + Assert.Equal(2, i.Current["ID"]); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/EnumerableRowCollectionTest.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/EnumerableRowCollectionTest.cs new file mode 100644 index 0000000000..8f634e13fc --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/EnumerableRowCollectionTest.cs @@ -0,0 +1,212 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// EnumerableRowCollectionTest.cs +// +// Author: +// Atsushi Enomoto +// +// Copyright (C) 2008 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.Collections.Generic; +using System.Data; +using Xunit; + +namespace MonoTests.System.Data +{ + public class EnumerableRowCollectionTest + { + private string _testDataSet = "testdataset1.xml"; + + [Fact] + public void QueryWhere() + { + var ds = new DataSet(); + ds.ReadXml(_testDataSet); + var table = ds.Tables[0]; + /* schema generated as ... + var table = ds.Tables.Add ("ScoreList"); + table.Columns.Add ("ID", typeof (int)); + table.Columns.Add ("RegisteredDate", typeof (DateTime)); + table.Columns.Add ("Name", typeof (string)); + table.Columns.Add ("Score", typeof (int)); + ds.WriteXml ("Test/System.Data/testdataset1.xsd", XmlWriteMode.WriteSchema); + */ + var q = from line in table.AsEnumerable() + where line.Field("Score") > 80 + select line; + bool iterated = false; + foreach (var line in q) + { + if (iterated) + Assert.True(false, "should match only one raw"); + Assert.Equal(100, line["Score"]); + iterated = true; + } + } + + [Fact] + public void QueryWhereSelect () + { + var ds = new DataSet (); + ds.ReadXml (_testDataSet); + var table = ds.Tables [0]; + var q = from line in table.AsEnumerable () + where line.Field ("Score") > 80 + select new { + StudentID = line.Field ("ID"), + StudentName = line.Field ("Name"), + StudentScore = line.Field ("Score") }; + bool iterated = false; + foreach (var ql in q) { + if (iterated) + Assert.True(false, "should match only one raw"); + Assert.Equal(100, ql.StudentScore); + iterated = true; + } + } + + [Fact] + public void QueryWhereSelectOrderBy () + { + var ds = new DataSet (); + ds.ReadXml (_testDataSet); + var table = ds.Tables [0]; + var q = from line in table.AsEnumerable () + where line.Field ("Score") >= 80 + orderby line.Field ("ID") + select new { + StudentID = line.Field ("ID"), + StudentName = line.Field ("Name"), + StudentScore = line.Field ("Score") }; + int prevID = -1; + foreach (var ql in q) { + switch (prevID) { + case -1: + Assert.Equal(1, ql.StudentID); + break; + case 1: + Assert.Equal(4, ql.StudentID); + break; + default: + Assert.True(false, "should match only one raw"); + break; + } + prevID = ql.StudentID; + } + } + + [Fact] + public void QueryWhereSelectOrderByDescending () + { + var ds = new DataSet (); + ds.ReadXml (_testDataSet); + var table = ds.Tables [0]; + var q = from line in table.AsEnumerable () + where line.Field ("Score") >= 80 + orderby line.Field ("ID") descending + select new { + StudentID = line.Field ("ID"), + StudentName = line.Field ("Name"), + StudentScore = line.Field ("Score") }; + int prevID = -1; + foreach (var ql in q) { + switch (prevID) { + case -1: + Assert.Equal(4, ql.StudentID); + break; + case 4: + Assert.Equal(1, ql.StudentID); + break; + default: + Assert.True(false, "should match only one raw"); + break; + } + prevID = ql.StudentID; + } + } + + [Fact] + public void ThenBy () + { + var ds = new DataSet (); + ds.ReadXml (_testDataSet); + var table = ds.Tables [0]; + var q = from line in table.AsEnumerable () + where line.Field ("Score") >= 80 + orderby line.Field ("Gender"), line.Field ("ID") + select new { + StudentID = line.Field ("ID"), + StudentName = line.Field ("Name"), + StudentScore = line.Field ("Score") }; + int prevID = -1; + foreach (var ql in q) { + switch (prevID) { + case -1: + Assert.Equal(1, ql.StudentID); + break; + case 1: + Assert.Equal(4, ql.StudentID); + break; + default: + Assert.True(false, "should match only one raw"); + break; + } + prevID = ql.StudentID; + } + } + + [Fact] + public void ThenByDescending () + { + var ds = new DataSet (); + ds.ReadXml (_testDataSet); + var table = ds.Tables [0]; + var q = from line in table.AsEnumerable () + where line.Field ("Score") >= 80 + orderby line.Field ("Gender"), line.Field ("ID") descending + select new { + StudentID = line.Field ("ID"), + StudentName = line.Field ("Name"), + StudentScore = line.Field ("Score") }; + int prevID = -1; + foreach (var ql in q) { + switch (prevID) { + case -1: + Assert.Equal(4, ql.StudentID); + break; + case 4: + Assert.Equal(1, ql.StudentID); + break; + default: + Assert.True(false, "should match only one raw"); + break; + } + prevID = ql.StudentID; + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/testdataset1.xml b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/testdataset1.xml new file mode 100644 index 0000000000..92eba59388 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/Mono/testdataset1.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + 1 + 2008-05-13T00:00:00.000 + Dorkpuff + 100 + 0 + + + 2 + 2008-05-14T00:00:00.000 + Headfoot + 30 + 0 + + + 3 + 2008-05-15T00:00:00.000 + Muckdoof + 60 + 1 + + + 4 + 2008-05-16T00:00:00.000 + Numbcheese + 80 + 0 + + diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/System.Data.DataSetExtensions.Tests.csproj b/external/corefx/src/System.Data.DataSetExtensions/tests/System.Data.DataSetExtensions.Tests.csproj new file mode 100644 index 0000000000..452939395c --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/System.Data.DataSetExtensions.Tests.csproj @@ -0,0 +1,29 @@ + + + + + + chk + {2B38992F-9979-485F-B104-38C476D0B706} + InnerLoop;OuterLoop + + + + + + + + + + + + + + + + + PreserveNewest + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataRowComparerTests.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataRowComparerTests.cs new file mode 100644 index 0000000000..d455982213 --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataRowComparerTests.cs @@ -0,0 +1,394 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using Xunit; + +namespace System.Data.Tests +{ + public class DataRowComparerTests + { + [Fact] + public void Default_Get_ReturnsNotNull() + { + Assert.NotNull(DataRowComparer.Default); + Assert.NotNull(DataRowComparer.Default); + } + + public static IEnumerable Equals_TestData() + { + var table1 = new DataTable("Table1"); + table1.Columns.Add("Column1"); + table1.Columns.Add("Column2"); + table1.Columns.Add("Column3"); + + var table2 = new DataTable("Table2"); + table2.Columns.Add("Column1"); + + DataRow row = table2.Rows.Add(1); + + // Basic + yield return new object[] + { + row, + row, + true + }; + + yield return new object[] + { + table1.Rows.Add(1, 2, null), + table1.Rows.Add(1, 2, null), + true + }; + + yield return new object[] + { + table1.Rows.Add(1, 2, null), + table1.Rows.Add(1, 3, null), + false + }; + + yield return new object[] + { + table1.Rows.Add(1, 2, null), + table1.Rows.Add(1, 2, "abc"), + false + }; + + // DBNull + yield return new object[] + { + table1.Rows.Add(1, 2, null), + table1.Rows.Add(1, 2, DBNull.Value), + true + }; + + yield return new object[] + { + table1.Rows.Add(1, 2, DBNull.Value), + table1.Rows.Add(1, 2, "abc"), + false + }; + + // Array + var arrayTable = new DataTable("Table3"); + DataColumn arrayColumn = arrayTable.Columns.Add("Column1"); + arrayColumn.DataType = typeof(Array); + + DataRow ArrayRow(object array) => arrayTable.Rows.Add(array); + + int[] sameArray = new int[] { 1, 2, 3 }; + yield return new object[] + { + ArrayRow(sameArray), + ArrayRow(sameArray), + true + }; + + yield return new object[] + { + ArrayRow(new byte[] { 1, 2, 3 }), + ArrayRow(new byte[] { 1, 2, 3 }), + true + }; + + yield return new object[] + { + ArrayRow(new byte[] { 1, 2, 3 }), + ArrayRow(new byte[] { 1, 2, 4 }), + false + }; + + yield return new object[] + { + ArrayRow(new short[] { 1, 2, 3 }), + ArrayRow(new short[] { 1, 2, 3 }), + true + }; + + yield return new object[] + { + ArrayRow(new short[] { 1, 2, 3 }), + ArrayRow(new short[] { 1, 2, 4 }), + false + }; + + yield return new object[] + { + ArrayRow(new int[] { 1, 2, 3 }), + ArrayRow(new int[] { 1, 2, 3 }), + true + }; + + yield return new object[] + { + ArrayRow(new int[] { 1, 2, 3 }), + ArrayRow(new int[] { 1, 2, 4 }), + false + }; + + yield return new object[] + { + ArrayRow(new string[] { "a", "b" }), + ArrayRow(new string[] { "a", "b" }), + true + }; + + yield return new object[] + { + ArrayRow(new string[] { "a", "b" }), + ArrayRow(new string[] { "a", "c" }), + false + }; + + yield return new object[] + { + ArrayRow(new object[] { 1, "a", null }), + ArrayRow(new object[] { 1, "a", null }), + true + }; + + yield return new object[] + { + ArrayRow(new object[] { 1, "a", null }), + ArrayRow(new object[] { 1, "a", DBNull.Value }), + false + }; + + yield return new object[] + { + ArrayRow(new object[] { 1, "a", null }), + ArrayRow(new object[] { 2, "a", null }), + false + }; + + yield return new object[] + { + ArrayRow(new object[] { 1, "a", null }), + ArrayRow(new object[] { 1, "a", "b" }), + false + }; + + yield return new object[] + { + ArrayRow(new ushort[] { 1, 2, 3 }), + ArrayRow(new ushort[] { 1, 2, 3 }), + true + }; + + yield return new object[] + { + ArrayRow(new ushort[] { 1, 2, 3 }), + ArrayRow(new ushort[] { 1, 2, 4 }), + false + }; + + yield return new object[] + { + ArrayRow(new uint[] { 1, 2, 3 }), + ArrayRow(new uint[] { 1, 2, 3 }), + true + }; + + yield return new object[] + { + ArrayRow(new uint[] { 1, 2, 3 }), + ArrayRow(new uint[] { 1, 2, 4 }), + false + }; + + yield return new object[] + { + ArrayRow(new long[] { 1, 2, 3 }), + ArrayRow(new long[] { 1, 2, 3 }), + true + }; + + yield return new object[] + { + ArrayRow(new long[] { 1, 2, 3 }), + ArrayRow(new long[] { 1, 2, 4 }), + false + }; + + yield return new object[] + { + ArrayRow(new long[] { 1, 2, 3 }), + ArrayRow(new int[] { 1, 2, 3 }), + false + }; + + yield return new object[] + { + ArrayRow(new int[] { 1, 2, 3 }), + ArrayRow(new int[] { 1, 2 }), + false + }; + + yield return new object[] + { + ArrayRow(new int[] { 1, 2, 3 }), + ArrayRow(new int[2,2]), + false + }; + + yield return new object[] + { + ArrayRow(new int[2,2]), + ArrayRow(new int[2,2]), + false + }; + + yield return new object[] + { + ArrayRow(new int[2]), + ArrayRow(null), + false + }; + + // Different count. + yield return new object[] + { + table1.Rows.Add(1, 2, null), + table2.Rows.Add(1), + false + }; + + // Null argument. + yield return new object[] + { + table1.Rows.Add(1, 2, null), + null, + false + }; + + yield return new object[] + { + null, + table1.Rows.Add(1, 2, null), + false + }; + + yield return new object[] + { + null, + null, + true + }; + } + + [Theory] + [MemberData(nameof(Equals_TestData))] + public void Equals_Rows_ReturnsExpected(DataRow row1, DataRow row2, bool expected) + { + Assert.Equal(expected, DataRowComparer.Default.Equals(row1, row2)); + Assert.Equal(expected, DataRowComparer.Default.Equals(row2, row1)); + } + + [Fact] + public void Equals_NullStringValueInStringArrayInRightColumn_ThrowsNullReferenceException() + { + var table = new DataTable("Table"); + DataColumn column = table.Columns.Add("Column"); + column.DataType = typeof(Array); + + DataRow row1 = table.Rows.Add(new object[] { new string[] { null } }); + DataRow row2 = table.Rows.Add(new object[] { new string[] { null } }); + DataRow row3 = table.Rows.Add(new object[] { new string[] { "abc" } }); + + Assert.Throws(() => DataRowComparer.Default.Equals(row1, row2)); + Assert.Throws(() => DataRowComparer.Default.Equals(row2, row1)); + Assert.Throws(() => DataRowComparer.Default.Equals(row1, row3)); + + Assert.False(DataRowComparer.Default.Equals(row3, row1)); + } + + [Fact] + public void Equals_DeletedRow_ThrowsInvalidOperationException() + { + var table = new DataTable("Table"); + table.Columns.Add("Column"); + + DataRow row1 = table.Rows.Add(1); + DataRow row2 = table.Rows.Add(2); + + table.AcceptChanges(); + row1.Delete(); + + Assert.Throws(() => DataRowComparer.Default.Equals(row1, row2)); + Assert.Throws(() => DataRowComparer.Default.Equals(row2, row1)); + } + + public static IEnumerable GetHashCode_TestData() + { + yield return new object[] { 123, 123 }; + yield return new object[] { null, DBNull.Value.GetHashCode() }; + + yield return new object[] { new int[0], 0 }; + yield return new object[] { new int[] { 1, 2 }, 1 }; + + if (PlatformDetection.IsNonZeroLowerBoundArraySupported) + { + Array nonZeroBoundArray = Array.CreateInstance(typeof(int), new int[] { 2 }, new int[] { 2 }); + nonZeroBoundArray.SetValue(10, 2); + yield return new object[] { nonZeroBoundArray, 10 }; + } + + Array multidimensionalArray = new int[,] { { 1, 2 }, { 3, 4 } }; + yield return new object[] { multidimensionalArray, multidimensionalArray.GetHashCode() }; + } + + [Theory] + [MemberData(nameof(GetHashCode_TestData))] + public void GetHashCode_HasColumns_ReturnsExpected(object value, int expected) + { + var table = new DataTable(); + DataColumn column = table.Columns.Add("Column1"); + table.Columns.Add("Column2"); + column.DataType = value?.GetType() ?? typeof(object); + + DataRow row = table.Rows.Add(value, 2); + Assert.Equal(expected, DataRowComparer.Default.GetHashCode(row)); + } + + [Fact] + public void GetHashCode_NoColumns_ReturnsZero() + { + var table = new DataTable(); + Assert.Equal(0, DataRowComparer.Default.GetHashCode(table.NewRow())); + } + + [Fact] + public void GetHashCode_OneColumn_DoesNotReturnZero() + { + var comparer = DataRowComparer.Default; + DataTable table = new DataTable(); + DataRow row = table.NewRow(); + table.Columns.Add(); + + Assert.NotEqual(0, comparer.GetHashCode(row)); + } + + [Fact] + public void GetHashCode_NullRow_ThrowsArgumentNullException() + { + AssertExtensions.Throws("row", () => DataRowComparer.Default.GetHashCode(null)); + } + + [Fact] + public void GetHashCode_DeletedRow_ThrowsInvalidOperationException() + { + var table = new DataTable("Table"); + table.Columns.Add("Column"); + + DataRow row = table.Rows.Add(1); + table.AcceptChanges(); + row.Delete(); + + Assert.Throws(() => DataRowComparer.Default.GetHashCode(row)); + } + + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataRowExtensionsTests.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataRowExtensionsTests.cs new file mode 100644 index 0000000000..c11e2c7ffb --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataRowExtensionsTests.cs @@ -0,0 +1,176 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Data.Tests +{ + public class DataRowExtensionsTests + { + [Fact] + public void Field_String_NullRowThrows() + { + AssertExtensions.Throws("row", () => DataRowExtensions.Field(null, "foo")); + } + + [Fact] + public void Field_String_NullColumnNameThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + AssertExtensions.Throws("name", () => DataRowExtensions.Field(row, columnName: null)); + } + + [Fact] + public void Field_Column_NullRowThrows() + { + DataColumn column = new DataColumn(); + AssertExtensions.Throws("row", () => DataRowExtensions.Field(null, column)); + } + + [Fact] + public void Field_Column_NullColumnThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + AssertExtensions.Throws("column", () => DataRowExtensions.Field(row, column: null)); + } + + [Fact] + public void Field_Index_NullRowThrows() + { + AssertExtensions.Throws("row", () => DataRowExtensions.Field(null, 0)); + } + + [Fact] + public void Field_Index_NegativeIndexThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + Assert.Throws(() => DataRowExtensions.Field(row, columnIndex: -1)); + } + + [Fact] + public void Field_IndexVersion_NullRowThrows() + { + AssertExtensions.Throws("row", () => DataRowExtensions.Field(null, columnIndex: 0, version: DataRowVersion.Default)); + } + + [Fact] + public void Field_IndexVersion_NegativeIndexThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + Assert.Throws(() => DataRowExtensions.Field(row, columnIndex: -1, version: DataRowVersion.Default)); + } + + [Fact] + public void Field_NameVersion_NullRowThrows() + { + AssertExtensions.Throws("row", () => DataRowExtensions.Field(null, columnName: "foo", version: DataRowVersion.Default)); + } + + [Fact] + public void Field_NameVersion_NullColumnNameThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + AssertExtensions.Throws("name", () => DataRowExtensions.Field(row, columnName: null, version: DataRowVersion.Default)); + } + + [Fact] + public void Field_ColumnVersion_NullRowThrows() + { + DataColumn column = new DataColumn(); + AssertExtensions.Throws("row", () => DataRowExtensions.Field(null, column: column, version: DataRowVersion.Default)); + } + + [Fact] + public void Field_ColumnVersion_NullColumnThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + AssertExtensions.Throws("column", () => DataRowExtensions.Field(row, column: null, version: DataRowVersion.Default)); + } + + [Fact] + public void SetField_IndexValue_NullRowThrows() + { + AssertExtensions.Throws("row", () => DataRowExtensions.SetField(null, columnIndex: 0, value: 0)); + } + + [Fact] + public void SetField_IndexValue_NullColumnThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + Assert.Throws(() => DataRowExtensions.SetField(row, columnIndex: -1, value: 0)); + } + + [Fact] + public void SetField_IndexValue_NullValueReplacedByDBNull() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + table.Columns.Add(new DataColumn()); + + DataRowExtensions.SetField(row, columnIndex: 0, value: null); + Assert.Equal(DBNull.Value, row[0]); + } + + [Fact] + public void SetField_NameValue_NullRowThrows() + { + AssertExtensions.Throws("row", () => DataRowExtensions.SetField(null, columnName: "foo", value: 0)); + } + + [Fact] + public void SetField_NameValue_NullColumnNameThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + AssertExtensions.Throws("name", () => DataRowExtensions.SetField(row, columnName: null, value: 0)); + } + + [Fact] + public void SetField_NameValue_NullValueReplacedByDBNull() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + table.Columns.Add(new DataColumn("foo")); + + DataRowExtensions.SetField(row, columnName: "foo", value: null); + Assert.Equal(DBNull.Value, row["foo"]); + } + + [Fact] + public void SetField_ColumnValue_NullRowThrows() + { + DataColumn column = new DataColumn(); + AssertExtensions.Throws("row", () => DataRowExtensions.SetField(null, column: column, value: 0)); + } + + [Fact] + public void SetField_ColumnValue_NullColumnThrows() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + AssertExtensions.Throws("column", () => DataRowExtensions.SetField(row, column: null, value: 0)); + } + + [Fact] + public void SetField_ColumnValue_NullValueReplacedByDBNull() + { + DataTable table = new DataTable("test"); + DataRow row = table.NewRow(); + DataColumn column = new DataColumn(); + table.Columns.Add(column); + + DataRowExtensions.SetField(row, column: column, value: null); + Assert.Equal(DBNull.Value, row[column]); + } + + + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataTableExtensionsTests.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataTableExtensionsTests.cs new file mode 100644 index 0000000000..50800ce70b --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/DataTableExtensionsTests.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Data.Tests +{ + public class DataTableExtensionsTests + { + [Fact] + public void AsEnumerable_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => DataTableExtensions.AsEnumerable(null)); + } + + [Fact] + public void CopyToDataTable_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => DataTableExtensions.CopyToDataTable(null)); + AssertExtensions.Throws("source", () => DataTableExtensions.CopyToDataTable(null, new DataTable(), LoadOption.OverwriteChanges)); + AssertExtensions.Throws("source", () => DataTableExtensions.CopyToDataTable(null, new DataTable(), LoadOption.OverwriteChanges, null)); + } + + [Fact] + public void CopyToDataTable_NullTable_ThrowsArgumentNullException() + { + AssertExtensions.Throws("table", () => DataTableExtensions.CopyToDataTable(new DataRow[0], null, LoadOption.OverwriteChanges)); + AssertExtensions.Throws("table", () => DataTableExtensions.CopyToDataTable(new DataRow[0], null, LoadOption.OverwriteChanges, null)); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/EnumerableRowCollectionExtensionsTests.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/EnumerableRowCollectionExtensionsTests.cs new file mode 100644 index 0000000000..42ddc0581b --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/EnumerableRowCollectionExtensionsTests.cs @@ -0,0 +1,120 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace System.Data +{ + public class EnumerableRowCollectionExtensionsTests + { + public class TestTypedTable : TypedTableBase where T : DataRow + { + public TestTypedTable() : base() { } + } + + private class TestDataRowComparer : Comparer where T : DataRow + { + public override int Compare(T x, T y) + { + return int.Parse((string)x.ItemArray[0]).CompareTo(int.Parse((string)y.ItemArray[0])); + } + } + + private (TypedTableBase table, DataRow one, DataRow two, DataRow three) InstantiateTable() + { + TypedTableBase table = new TestTypedTable(); + table.Columns.Add(); + DataRow two = table.Rows.Add(2); + DataRow one = table.Rows.Add(1); + DataRow three = table.Rows.Add(3); + + return (table, one, two, three); + } + + [Fact] + public void Where_SuccessfullyFindRow() + { + TypedTableBase table = new TestTypedTable(); + table.Columns.Add(); + DataRow two = table.Rows.Add("two"); + + EnumerableRowCollection source = table.Cast(); + + var filtered = source.Where(row => "two".Equals(row.ItemArray[0])); + + // Check that only one row matches predicate condition + Assert.Equal(1, filtered.Count()); + + // Check that matching row is the same object as the second data row + Assert.Same(two, filtered.First()); + } + + [Fact] + public void OrderBy_AddSortExpressionValidation() + { + var (table, one, two, three) = InstantiateTable(); + + EnumerableRowCollection source = table.Cast(); + var ordered = source.OrderBy(row => int.Parse((string)row.ItemArray[0])); + Assert.Equal(new DataRow[] { one, two, three }, ordered); + + DataRow zero = table.Rows.Add(0); + var compared = source.OrderBy((row => row), new TestDataRowComparer()); + Assert.Equal(new DataRow[] { zero, one, two, three }, compared); + } + + [Fact] + public void OrderByDescending_AddSortExpressionValidation() + { + var (table, one, two, three) = InstantiateTable(); + + EnumerableRowCollection source = table.Cast(); + var orderedBackwards = source.OrderByDescending(row => int.Parse((string)row.ItemArray[0])); + Assert.Equal(new DataRow[] { three, two, one }, orderedBackwards); + + DataRow four = table.Rows.Add(4); + var comparedBackwards = source.OrderByDescending((row => row), new TestDataRowComparer()); + Assert.Equal(new DataRow[] { four, three, two, one }, comparedBackwards); + } + + [Fact] + public void ThenBy_AddSortExpressionValidation() + { + var (table, one, two, three) = InstantiateTable(); + + // Order the EnumerableRowCollection + OrderedEnumerableRowCollection orderedSource = table.Cast().OrderBy(row => int.Parse((string)row.ItemArray[0])); + + DataRow zero = table.Rows.Add(0); + var orderedAgain = orderedSource.ThenBy(row => int.Parse((string)row.ItemArray[0])); + Assert.Equal(new DataRow[] { zero, one, two, three }, orderedAgain); + + DataRow negative = table.Rows.Add(-1); + var comparedAgain = orderedSource.ThenBy((row => row), new TestDataRowComparer()); + Assert.Equal(new DataRow[] { negative, zero, one, two, three }, comparedAgain); + + } + + [Fact] + public void ThenByDescending_AddSortExpressionValidation() + { + var (table, one, two, three) = InstantiateTable(); + + // Order the EnumerableRowCollection + OrderedEnumerableRowCollection orderedSource = table.Cast().OrderByDescending(row => int.Parse((string)row.ItemArray[0])); + + DataRow zero = table.Rows.Add(0); + var orderedBackwardsAgain = orderedSource.ThenByDescending(row => int.Parse((string)row.ItemArray[0])); + Assert.Equal(new DataRow[] { three, two, one, zero }, orderedBackwardsAgain); + + DataRow negative = table.Rows.Add(-1); + var comparedBackwardsAgain = orderedSource.ThenByDescending((row => row), new TestDataRowComparer()); + Assert.Equal(new DataRow[] { three, two, one, zero, negative }, comparedBackwardsAgain); + + } + + } +} diff --git a/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/TypedTableBaseExtensionsTests.cs b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/TypedTableBaseExtensionsTests.cs new file mode 100644 index 0000000000..686d2e4fea --- /dev/null +++ b/external/corefx/src/System.Data.DataSetExtensions/tests/System/Data/TypedTableBaseExtensionsTests.cs @@ -0,0 +1,85 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Data.Tests +{ + public class TypedTableBaseExtensionsTests + { + [Fact] + public void AsEnumerable_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.AsEnumerable(null)); + } + + [Fact] + public void OrderBy_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.OrderBy(null, row => "abc")); + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.OrderBy(null, row => "abc", StringComparer.CurrentCulture)); + } + + [Fact] + public void OrderByDescending_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.OrderByDescending(null, row => "abc")); + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.OrderByDescending(null, row => "abc", StringComparer.CurrentCulture)); + } + + [Fact] + public void Select_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.Select(null, row => "abc")); + } + + [Fact] + public void Where_NullSource_ThrowsArgumentNullException() + { + AssertExtensions.Throws("source", () => TypedTableBaseExtensions.Where(null, row => true)); + } + + public class TestTypedTable : TypedTableBase where T : DataRow + { + public TestTypedTable() : base() { } + } + + [Fact] + public void ElementAtOrDefault_ValidIndex() + { + TypedTableBase table = new TestTypedTable(); + table.Columns.Add(); + DataRow zero = table.Rows.Add(0); + + Assert.Same(zero, table.ElementAtOrDefault(0)); + } + + [Fact] + public void ElementAtOrDefault_InvalidIndex() + { + TypedTableBase table = new TestTypedTable(); + table.Columns.Add(); + DataRow zero = table.Rows.Add(0); + + Assert.Same(default(DataRow), table.ElementAtOrDefault(1)); + } + + [Fact] + public void Select_ToListOfInts() + { + TypedTableBase table = new TestTypedTable(); + table.Columns.Add(); + table.Rows.Add(10); + table.Rows.Add(5); + + var chosen = table.Select(row => int.Parse((string)row.ItemArray[0])); + int total = 0; + foreach (int num in chosen) + { + total += num; + } + Assert.Equal(15, total); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Data.Odbc/dir.props b/external/corefx/src/System.Data.Odbc/dir.props index af5b293385..4356decc45 100644 --- a/external/corefx/src/System.Data.Odbc/dir.props +++ b/external/corefx/src/System.Data.Odbc/dir.props @@ -2,7 +2,7 @@ - 4.0.1.0 + 4.0.0.0 Open \ No newline at end of file diff --git a/external/corefx/src/System.Data.Odbc/pkg/System.Data.Odbc.pkgproj b/external/corefx/src/System.Data.Odbc/pkg/System.Data.Odbc.pkgproj new file mode 100644 index 0000000000..c0232ef4ea --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/pkg/System.Data.Odbc.pkgproj @@ -0,0 +1,11 @@ + + + + + + net461;netcoreapp2.0;$(AllXamarinFrameworks) + + + + + diff --git a/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/AdapterUtil.Odbc.cs b/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/AdapterUtil.Odbc.cs index f354ee884c..ee835edbc9 100644 --- a/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/AdapterUtil.Odbc.cs +++ b/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/AdapterUtil.Odbc.cs @@ -306,6 +306,10 @@ namespace System.Data.Common { return InvalidOperation(SR.GetString(SR.ADP_UninitializedParameterSize, index.ToString(CultureInfo.InvariantCulture), dataType.Name)); } + internal static InvalidOperationException QuotePrefixNotSet(string method) + { + return InvalidOperation(SR.GetString(SR.ADP_QuotePrefixNotSet, method)); + } // // : ConnectionUtil @@ -544,7 +548,6 @@ namespace System.Data.Common return Argument(SR.GetString(SR.MDF_UnsupportedVersion, collectionName)); } - // global constant strings internal const string BeginTransaction = "BeginTransaction"; internal const string ChangeDatabase = "ChangeDatabase"; @@ -560,6 +563,8 @@ namespace System.Data.Common internal const string ParameterName = "ParameterName"; internal const string Prepare = "Prepare"; internal const string RollbackTransaction = "RollbackTransaction"; + internal const string QuoteIdentifier = "QuoteIdentifier"; + internal const string UnquoteIdentifier = "UnquoteIdentifier"; internal const int DecimalMaxPrecision = 29; internal const int DecimalMaxPrecision28 = 28; // there are some cases in Odbc where we need that ... diff --git a/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Linux.cs b/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Linux.cs index 287dd205fc..2351f0f1a9 100644 --- a/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Linux.cs +++ b/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Linux.cs @@ -6,7 +6,7 @@ namespace System.Data.Common { internal static class ExternDll { - public const string Odbc32 = "odbc.so.2"; + public const string Odbc32 = "libodbc.so.2"; } } diff --git a/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Osx.cs b/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Osx.cs index 57a945ab72..5e6c68c5f6 100644 --- a/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Osx.cs +++ b/external/corefx/src/System.Data.Odbc/src/Common/System/Data/Common/ExternDll.Osx.cs @@ -6,7 +6,7 @@ namespace System.Data.Common { internal static class ExternDll { - public const string Odbc32 = "odbc.2"; + public const string Odbc32 = "libodbc.2.dylib"; } } diff --git a/external/corefx/src/System.Data.Odbc/src/Configurations.props b/external/corefx/src/System.Data.Odbc/src/Configurations.props index 34857a0ae4..8c227f14fc 100644 --- a/external/corefx/src/System.Data.Odbc/src/Configurations.props +++ b/external/corefx/src/System.Data.Odbc/src/Configurations.props @@ -3,6 +3,7 @@ netfx-Windows_NT; + netstandard; netstandard-Linux; netstandard-OSX; netstandard-Windows_NT; diff --git a/external/corefx/src/System.Data.Odbc/src/Resources/Strings.resx b/external/corefx/src/System.Data.Odbc/src/Resources/Strings.resx index f90b0484a6..4de65a9c38 100644 --- a/external/corefx/src/System.Data.Odbc/src/Resources/Strings.resx +++ b/external/corefx/src/System.Data.Odbc/src/Resources/Strings.resx @@ -201,6 +201,9 @@ Timeout attempting to open the connection. The time period elapsed prior to attempting to open the connection has been exceeded. This may have occurred because of too many simultaneous non-pooled connection attempts. + + {0} requires an open connection when the quote prefix has not been set. + Unable to build the '{0}' collection because execution of the SQL query failed. See the inner exception for details. @@ -328,7 +331,7 @@ {0} DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{1}. - Invalid CommandTimeout value {0}; the value must be >= 0. + Invalid CommandTimeout value {0}; the value must be >= 0. {1}[{0}]: the Size property has an invalid size of 0. @@ -426,4 +429,10 @@ An internal connection does not have an owner. - \ No newline at end of file + + System.Data.ODBC is not supported on this platform. + + + Dependency unixODBC with minimum version 2.3.1 is required. + + diff --git a/external/corefx/src/System.Data.Odbc/src/System.Data.Odbc.csproj b/external/corefx/src/System.Data.Odbc/src/System.Data.Odbc.csproj index 43dbb34d2a..e24e87e76c 100644 --- a/external/corefx/src/System.Data.Odbc/src/System.Data.Odbc.csproj +++ b/external/corefx/src/System.Data.Odbc/src/System.Data.Odbc.csproj @@ -6,6 +6,7 @@ System.Data.Odbc true true + SR.Odbc_PlatformNotSupported @@ -15,7 +16,7 @@ - + Common\System\Data\Common\AdapterUtil.cs diff --git a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/DbDataRecord.cs b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/DbDataRecord.cs index d4110a4161..1c81f9d1b0 100644 --- a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/DbDataRecord.cs +++ b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/DbDataRecord.cs @@ -112,7 +112,7 @@ namespace System.Data.Odbc { //Random //Means that the user can ask for the values int any order (ie: out of order). - // In order to acheive this on a forward only stream, we need to actually + // In order to achieve this on a forward only stream, we need to actually // retreive all the value in between so they can go back to values they've skipped for (int c = 0; c < i; c++) { diff --git a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs index a2fa431498..b1312e0d4b 100644 --- a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs +++ b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs @@ -244,16 +244,49 @@ namespace System.Data.Odbc } } retcode = hstmt.CloseCursor(); - return rParams.ToArray(); ; + return rParams.ToArray(); } public override string QuoteIdentifier(string unquotedIdentifier) { return QuoteIdentifier(unquotedIdentifier, null /* use DataAdapter.SelectCommand.Connection if available */); } + public string QuoteIdentifier(string unquotedIdentifier, OdbcConnection connection) { - throw ADP.NotSupported(); + ADP.CheckArgumentNull(unquotedIdentifier, nameof(unquotedIdentifier)); + + // if the user has specificed a prefix use the user specified prefix and suffix + // otherwise get them from the provider + string quotePrefix = QuotePrefix; + string quoteSuffix = QuoteSuffix; + if (string.IsNullOrEmpty(quotePrefix)) + { + if (connection == null) + { + // Use the adapter's connection if QuoteIdentifier was called from + // DbCommandBuilder instance (which does not have an overload that gets connection object) + connection = DataAdapter?.SelectCommand?.Connection; + if (connection == null) + { + throw ADP.QuotePrefixNotSet(ADP.QuoteIdentifier); + } + } + quotePrefix = connection.QuoteChar(ADP.QuoteIdentifier); + quoteSuffix = quotePrefix; + } + + // by the ODBC spec "If the data source does not support quoted identifiers, a blank is returned." + // So if a blank is returned the string is returned unchanged. Otherwise the returned string is used + // to quote the string + if (!string.IsNullOrEmpty(quotePrefix) && quotePrefix != " ") + { + return ADP.BuildQuotedString(quotePrefix, quoteSuffix, unquotedIdentifier); + } + else + { + return unquotedIdentifier; + } } protected override void SetRowUpdatingHandler(DbDataAdapter adapter) @@ -273,9 +306,46 @@ namespace System.Data.Odbc { return UnquoteIdentifier(quotedIdentifier, null /* use DataAdapter.SelectCommand.Connection if available */); } + public string UnquoteIdentifier(string quotedIdentifier, OdbcConnection connection) { - throw ADP.NotSupported(); + ADP.CheckArgumentNull(quotedIdentifier, nameof(quotedIdentifier)); + + // if the user has specificed a prefix use the user specified prefix and suffix + // otherwise get them from the provider + string quotePrefix = QuotePrefix; + string quoteSuffix = QuoteSuffix; + if (string.IsNullOrEmpty(quotePrefix)) + { + if (connection == null) + { + // Use the adapter's connection if UnquoteIdentifier was called from + // DbCommandBuilder instance (which does not have an overload that gets connection object) + connection = DataAdapter?.SelectCommand?.Connection; + if (connection == null) + { + throw ADP.QuotePrefixNotSet(ADP.UnquoteIdentifier); + } + } + quotePrefix = connection.QuoteChar(ADP.UnquoteIdentifier); + quoteSuffix = quotePrefix; + } + + String unquotedIdentifier; + // by the ODBC spec "If the data source does not support quoted identifiers, a blank is returned." + // So if a blank is returned the string is returned unchanged. Otherwise the returned string is used + // to unquote the string + if (!string.IsNullOrEmpty(quotePrefix) || quotePrefix != " ") + { + // ignoring the return value because it is acceptable for the quotedString to not be quoted in this + // context. + ADP.RemoveStringQuotes(quotePrefix, quoteSuffix, quotedIdentifier, out unquotedIdentifier); + } + else + { + unquotedIdentifier = quotedIdentifier; + } + return unquotedIdentifier; } } } diff --git a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs index 42f9b05f59..7c4102aef5 100644 --- a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs +++ b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs @@ -7,6 +7,7 @@ using System.Data.Common; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Runtime.InteropServices; using System.Security.Permissions; using System.Text; using SysTx = System.Transactions; @@ -561,7 +562,14 @@ namespace System.Data.Odbc public override void Open() { - InnerConnection.OpenConnection(this, ConnectionFactory); + try + { + InnerConnection.OpenConnection(this, ConnectionFactory); + } + catch (DllNotFoundException e) when (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new DllNotFoundException(SR.Odbc_UnixOdbcNotFound + Environment.NewLine + e.Message); + } // SQLBUDT #276132 - need to manually enlist in some cases, because // native ODBC doesn't know about SysTx transactions. diff --git a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs.REMOVED.git-id b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs.REMOVED.git-id index 24608228b2..2c1bd3857a 100644 --- a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs.REMOVED.git-id @@ -1 +1 @@ -ad1582cfe8c3a8b0f98826c045d56ff42a47603a \ No newline at end of file +39db136a568642f63975380e1fdaccdb7aed06de \ No newline at end of file diff --git a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcParameter.cs b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcParameter.cs index 21645ea5bf..dbbf8b0be2 100644 --- a/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcParameter.cs +++ b/external/corefx/src/System.Data.Odbc/src/System/Data/Odbc/OdbcParameter.cs @@ -747,26 +747,31 @@ namespace System.Data.Odbc } }; - int cbParameterSize = GetParameterSize(value, offset, ordinal); // count of bytes for the data, for SQLBindParameter + int cbParameterSize = GetParameterSize(value, offset, ordinal); // count of bytes for the data, for SQLBindParameter - // here we upgrade the datatypes if the given values size is bigger than the types columnsize - // + // Upgrade input value type if the size of input value is bigger than the max size of the input value type. switch (_bindtype._sql_type) { - case ODBC32.SQL_TYPE.VARBINARY: // MDAC 74372 - // Note: per definition DbType.Binary does not support more than 8000 bytes so we change the type for binding - if ((cbParameterSize > 8000)) - { _bindtype = TypeMap._Image; } // will change to LONGVARBINARY + case ODBC32.SQL_TYPE.VARBINARY: + // Max length of VARBINARY is 8,000 of byte array. + if (size > 8000) + { + _bindtype = TypeMap._Image; // will change to LONGVARBINARY + } break; - case ODBC32.SQL_TYPE.VARCHAR: // MDAC 74372 - // Note: per definition DbType.Binary does not support more than 8000 bytes so we change the type for binding - if ((cbParameterSize > 8000)) - { _bindtype = TypeMap._Text; } // will change to LONGVARCHAR + case ODBC32.SQL_TYPE.VARCHAR: + // Max length of VARCHAR is 8,000 of non-unicode characters. + if (size > 8000) + { + _bindtype = TypeMap._Text; // will change to LONGVARCHAR + } break; - case ODBC32.SQL_TYPE.WVARCHAR: // MDAC 75099 - // Note: per definition DbType.Binary does not support more than 8000 bytes so we change the type for binding - if ((cbParameterSize > 4000)) - { _bindtype = TypeMap._NText; } // will change to WLONGVARCHAR + case ODBC32.SQL_TYPE.WVARCHAR: + // Max length of WVARCHAR (NVARCHAR) is 4,000 of unicode characters. + if (size > 4000) + { + _bindtype = TypeMap._NText; // will change to WLONGVARCHAR + } break; } diff --git a/external/corefx/src/System.Data.Odbc/tests/CommandBuilderTests.cs b/external/corefx/src/System.Data.Odbc/tests/CommandBuilderTests.cs new file mode 100644 index 0000000000..2b19b46a38 --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/tests/CommandBuilderTests.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Data.Odbc.Tests +{ + public class CommandBuilderTests : IntegrationTestBase + { + [Fact(Skip = "Native dependencies missing in CI. See https://github.com/dotnet/corefx/issues/15776.")] + public void QuoteIdentifier_UseConnection() + { + var commandBuilder = new OdbcCommandBuilder(); + + // Get quote string + var quotedIdentifier = commandBuilder.QuoteIdentifier("Test", connection); + var qs = quotedIdentifier.Remove(quotedIdentifier.IndexOf("Test")); + Assert.NotEmpty(qs); + + // Test -> 'Test' + var quotedTestString = commandBuilder.QuoteIdentifier("Source", connection); + Assert.Equal($"{qs}Source{qs}", quotedTestString); + // 'Test' -> Test + Assert.Equal("Source", commandBuilder.UnquoteIdentifier(quotedTestString, connection)); + + // Test' -> 'Test''' + quotedTestString = commandBuilder.QuoteIdentifier($"Test identifier{qs}", connection); + Assert.Equal($"{qs}Test identifier{qs}{qs}{qs}", quotedTestString); + // 'Test''' -> Test' + Assert.Equal($"Test identifier{qs}", commandBuilder.UnquoteIdentifier(quotedTestString, connection)); + + // Needs an active connection + Assert.Throws(() => commandBuilder.QuoteIdentifier("Test", null)); + Assert.Throws(() => commandBuilder.QuoteIdentifier("Test")); + Assert.Throws(() => commandBuilder.UnquoteIdentifier("Test", null)); + Assert.Throws(() => commandBuilder.UnquoteIdentifier("Test")); + } + + [Fact(Skip = "Native dependencies missing in CI. See https://github.com/dotnet/corefx/issues/15776.")] + public void QuoteIdentifier_CustomPrefixSuffix() + { + var commandBuilder = new OdbcCommandBuilder(); + + // Custom prefix & suffix + commandBuilder.QuotePrefix = "'"; + commandBuilder.QuoteSuffix = "'"; + + Assert.Equal("'Test'", commandBuilder.QuoteIdentifier("Test", connection)); + Assert.Equal("'Te''st'", commandBuilder.QuoteIdentifier("Te'st", connection)); + Assert.Equal("Test", commandBuilder.UnquoteIdentifier("'Test'", connection)); + Assert.Equal("Te'st", commandBuilder.UnquoteIdentifier("'Te''st'", connection)); + + // Ensure we don't need active connection: + Assert.Equal("'Test'", commandBuilder.QuoteIdentifier("Test", null)); + Assert.Equal("Test", commandBuilder.UnquoteIdentifier("'Test'", null)); + } + } +} diff --git a/external/corefx/src/System.Data.Odbc/tests/DependencyCheckTest.cs b/external/corefx/src/System.Data.Odbc/tests/DependencyCheckTest.cs new file mode 100644 index 0000000000..19295beede --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/tests/DependencyCheckTest.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Data.Odbc.Tests +{ + public class DependencyCheckTest + { + [ConditionalFact(Helpers.OdbcNotAvailable)] + public void OdbcConnection_OpenWhenOdbcNotInstalled_ThrowsException() + { + if (PlatformDetection.IsWindowsServerCore && !Environment.Is64BitProcess) + return; // On 32 bit Server Core, it does not throw DllNotFoundException. + + using (var connection = new OdbcConnection(ConnectionStrings.WorkingConnection)) + { + Assert.Throws(() => connection.Open()); + } + } + } +} diff --git a/external/corefx/src/System.Data.Odbc/tests/Helpers.cs b/external/corefx/src/System.Data.Odbc/tests/Helpers.cs new file mode 100644 index 0000000000..f7d92db218 --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/tests/Helpers.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace System.Data.Odbc.Tests +{ + public static class Helpers + { + public const string OdbcIsAvailable = nameof(Helpers) + "." + nameof(CheckOdbcIsAvailable); + public const string OdbcNotAvailable = nameof(Helpers) + "." + nameof(CheckOdbcNotAvailable); + + public static bool CheckOdbcNotAvailable() => !CheckOdbcIsAvailable(); + + private static bool CheckOdbcIsAvailable() => + PlatformDetection.IsWindows ? + !PlatformDetection.IsWindowsNanoServer && (!PlatformDetection.IsWindowsServerCore || Environment.Is64BitProcess ) : + Interop.Libdl.dlopen(( + PlatformDetection.IsOSX ? + "libodbc.2.dylib" : + "libodbc.so.2" + ), Interop.Libdl.RTLD_NOW) != IntPtr.Zero; + } +} diff --git a/external/corefx/src/System.Data.Odbc/tests/OdbcParameterTests.cs b/external/corefx/src/System.Data.Odbc/tests/OdbcParameterTests.cs new file mode 100644 index 0000000000..5aab7c759f --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/tests/OdbcParameterTests.cs @@ -0,0 +1,270 @@ +using System.Data.SqlClient; +using System.Text; +using Xunit; + +namespace System.Data.Odbc.Tests +{ + public static class OdbcParameterTests + { + [CheckConnStrSetupFact] + public static void RunTest() + { + string str1000 = null; + string str2000 = null; + string str4000 = null; + string str5000 = null; + string str8000 = ""; + for (int i = 0; i < 800; i++) + { + str8000 += "0123456789"; + if (i == 99) + { + str1000 = str8000; + } + else if (i == 199) + { + str2000 = str8000; + } + else if (i == 399) + { + str4000 = str8000; + } + else if (i == 499) + { + str5000 = str8000; + } + } + + byte[] byte1000 = Encoding.ASCII.GetBytes(str1000); + byte[] byte2000 = Encoding.ASCII.GetBytes(str2000); + byte[] byte4000 = Encoding.ASCII.GetBytes(str4000); + byte[] byte5000 = Encoding.ASCII.GetBytes(str5000); + byte[] byte8000 = Encoding.ASCII.GetBytes(str8000); + + object output = null; + int inputLength = 0; + int outputLength = 0; + + RunTestProcedure("VARBINARY", 8000, byte8000, out output, out inputLength, out outputLength); + string outputStr = Encoding.ASCII.GetString(output as byte[]); + Assert.Equal(str8000, outputStr); + Assert.Equal(byte8000.Length, inputLength); + Assert.Equal(byte8000.Length, outputLength); + + RunTestProcedure("VARBINARY", 8000, byte5000, out output, out inputLength, out outputLength); + outputStr = Encoding.ASCII.GetString(output as byte[]); + Assert.Equal(str8000, outputStr); + Assert.Equal(byte5000.Length, inputLength); + Assert.Equal(byte8000.Length, outputLength); + + RunTestProcedure("VARBINARY", 8000, byte4000, out output, out inputLength, out outputLength); + outputStr = Encoding.ASCII.GetString(output as byte[]); + Assert.Equal(str8000, outputStr); + Assert.Equal(byte4000.Length, inputLength); + Assert.Equal(str8000.Length, outputLength); + + RunTestProcedure("VARBINARY", 8000, byte2000, out output, out inputLength, out outputLength); + outputStr = Encoding.ASCII.GetString(output as byte[]); + Assert.Equal(str4000, outputStr); + Assert.Equal(byte2000.Length, inputLength); + Assert.Equal(str4000.Length, outputLength); + + RunTestProcedure("VARBINARY", 8000, byte1000, out output, out inputLength, out outputLength); + outputStr = Encoding.ASCII.GetString(output as byte[]); + Assert.Equal(str2000, outputStr); + Assert.Equal(byte1000.Length, inputLength); + Assert.Equal(byte2000.Length, outputLength); + + RunTestProcedure("VARCHAR", 8000, str8000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str8000, outputStr); + Assert.Equal(str8000.Length, inputLength); + Assert.Equal(str8000.Length, outputLength); + + RunTestProcedure("VARCHAR", 8000, str5000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str8000, outputStr); + Assert.Equal(str5000.Length, inputLength); + Assert.Equal(str8000.Length, outputLength); + + RunTestProcedure("VARCHAR", 8000, str4000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str8000, outputStr); + Assert.Equal(str4000.Length, inputLength); + Assert.Equal(str8000.Length, outputLength); + + RunTestProcedure("VARCHAR", 8000, str2000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str4000, outputStr); + Assert.Equal(str2000.Length, inputLength); + Assert.Equal(str4000.Length, outputLength); + + RunTestProcedure("VARCHAR", 8000, str1000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str2000, outputStr); + Assert.Equal(str1000.Length, inputLength); + Assert.Equal(str2000.Length, outputLength); + + RunTestProcedure("NVARCHAR", 4000, str8000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str4000, outputStr); + Assert.Equal(str4000.Length * 2, inputLength); // since NVARCHAR takes 2 bytes per character + Assert.Equal(str4000.Length * 2, outputLength); + + RunTestProcedure("NVARCHAR", 4000, str5000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str4000, outputStr); + Assert.Equal(str4000.Length * 2, inputLength); + Assert.Equal(str4000.Length * 2, outputLength); + + RunTestProcedure("NVARCHAR", 4000, str4000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str4000, outputStr); + Assert.Equal(str4000.Length * 2, inputLength); + Assert.Equal(str4000.Length * 2, outputLength); + + RunTestProcedure("NVARCHAR", 4000, str2000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str4000, outputStr); + Assert.Equal(str2000.Length * 2, inputLength); + Assert.Equal(str4000.Length * 2, outputLength); + + RunTestProcedure("NVARCHAR", 4000, str1000, out output, out inputLength, out outputLength); + outputStr = output as string; + Assert.Equal(str2000, outputStr); + Assert.Equal(str1000.Length * 2, inputLength); + Assert.Equal(str2000.Length * 2, outputLength); + } + + private static void RunTestProcedure(string procDataType, int procDataSize, object v1, out object v2, out int v3, out int v4) + { + string procName = DataTestUtility.GetUniqueName("ODBCTEST", "", ""); + + string removeExistingStoredProcSql = + $"IF OBJECT_ID('{procName}', 'P') IS NOT NULL " + + $"DROP PROCEDURE {procName};"; + + string createTestStoredProcSql = + $"CREATE PROCEDURE {procName} (" + + $"@v1 {procDataType}({procDataSize}), " + + $"@v2 {procDataType}({procDataSize}) OUT, " + + "@v3 INTEGER OUT, " + + "@v4 INTEGER OUT) " + + "AS BEGIN " + + "SET @v2 = @v1 + @v1; " + + "SET @v3 = datalength(@v1); " + + "SET @v4 = datalength(@v2); " + + "END;"; + + try + { + DataTestUtility.RunNonQuery(DataTestUtility.OdbcConnStr, removeExistingStoredProcSql); + DataTestUtility.RunNonQuery(DataTestUtility.OdbcConnStr, createTestStoredProcSql); + + DbAccessor dbAccessUtil = new DbAccessor(); + dbAccessUtil.connectSqlServer(DataTestUtility.OdbcConnStr); + dbAccessUtil.callProc("{ call "+ procName+"(?,?,?,?) }", procDataType, procDataSize, v1, out v2, out v3, out v4); + dbAccessUtil.commit(); + dbAccessUtil.disconnect(); + } + finally + { + DataTestUtility.RunNonQuery(DataTestUtility.OdbcConnStr, removeExistingStoredProcSql); + } + } + + private class DbAccessor + { + private OdbcConnection con = null; + private OdbcTransaction trn = null; + + public bool connectSqlServer(string connStr) + { + if (con == null) + { + con = new OdbcConnection(connStr); + } + + con.Open(); + trn = con.BeginTransaction(); + + return true; + } + + public void disconnect() + { + if (trn != null) + { + trn.Rollback(); + trn.Dispose(); + trn = null; + } + if (con != null) + { + con.Close(); + con.Dispose(); + con = null; + } + } + + public void callProc(string sql, string procDataType, int procDataSize, object v1, out object v2, out int v3, out int v4) + { + using (OdbcCommand command = new OdbcCommand(sql, con, trn)) + { + command.Parameters.Clear(); + command.CommandType = CommandType.StoredProcedure; + + OdbcType dataType = OdbcType.NVarChar; + switch (procDataType.ToUpper()) + { + case "VARBINARY": + dataType = OdbcType.VarBinary; + break; + case "VARCHAR": + dataType = OdbcType.VarChar; + break; + } + + command.Parameters.Add("@v1", dataType, procDataSize); + command.Parameters.Add("@v2", dataType, procDataSize); + command.Parameters.Add("@v3", OdbcType.Int); + command.Parameters.Add("@v4", OdbcType.Int); + + command.Parameters["@v1"].Direction = ParameterDirection.Input; + command.Parameters["@v2"].Direction = ParameterDirection.Output; + command.Parameters["@v3"].Direction = ParameterDirection.Output; + command.Parameters["@v4"].Direction = ParameterDirection.Output; + + command.Parameters["@v1"].Value = v1; + command.ExecuteNonQuery(); + + v2 = command.Parameters["@v2"].Value; + v3 = Int32.Parse(command.Parameters["@v3"].Value.ToString()); + v4 = Int32.Parse(command.Parameters["@v4"].Value.ToString()); + } + } + + public bool commit() + { + if (trn == null) + { + return false; + } + trn.Commit(); + trn = null; + return true; + } + + public bool rollback() + { + if (trn == null) + { + return false; + } + trn.Rollback(); + trn = null; + return true; + } + } + } +} diff --git a/external/corefx/src/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj b/external/corefx/src/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj index 462090fec9..e0565935f3 100644 --- a/external/corefx/src/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj +++ b/external/corefx/src/System.Data.Odbc/tests/System.Data.Odbc.Tests.csproj @@ -9,9 +9,21 @@ + + + + + Common\Interop\Unix\Interop.Libraries.cs + + + Common\Interop\Unix\libdl\Interop.dlopen.cs + + + + @@ -20,4 +32,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Data.Odbc/tests/TestCommon/CheckConnStrSetupFactAttribute.cs b/external/corefx/src/System.Data.Odbc/tests/TestCommon/CheckConnStrSetupFactAttribute.cs new file mode 100644 index 0000000000..145bc2f11c --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/tests/TestCommon/CheckConnStrSetupFactAttribute.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Data.Odbc.Tests +{ + public class CheckConnStrSetupFactAttribute : FactAttribute + { + public CheckConnStrSetupFactAttribute() + { + if(!DataTestUtility.AreConnStringsSetup()) + { + Skip = "Connection Strings Not Setup"; + } + } + } +} diff --git a/external/corefx/src/System.Data.Odbc/tests/TestCommon/DataTestUtility.cs b/external/corefx/src/System.Data.Odbc/tests/TestCommon/DataTestUtility.cs new file mode 100644 index 0000000000..c7af7aa1fa --- /dev/null +++ b/external/corefx/src/System.Data.Odbc/tests/TestCommon/DataTestUtility.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; + +namespace System.Data.Odbc.Tests +{ + public static class DataTestUtility + { + public static readonly string OdbcConnStr = null; + + static DataTestUtility() + { + OdbcConnStr = Environment.GetEnvironmentVariable("TEST_ODBC_CONN_STR"); + } + + public static bool AreConnStringsSetup() + { + return !string.IsNullOrEmpty(OdbcConnStr); + } + + // the name length will be no more then (16 + prefix.Length + escapeLeft.Length + escapeRight.Length) + // some providers does not support names (Oracle supports up to 30) + public static string GetUniqueName(string prefix, string escapeLeft, string escapeRight) + { + string uniqueName = string.Format("{0}{1}_{2}_{3}{4}", + escapeLeft, + prefix, + DateTime.Now.Ticks.ToString("X", CultureInfo.InvariantCulture), // up to 8 characters + Guid.NewGuid().ToString().Substring(0, 6), // take the first 6 characters only + escapeRight); + return uniqueName; + } + + public static void RunNonQuery(string connectionString, string sql) + { + using (OdbcConnection connection = new OdbcConnection(connectionString)) + { + using (OdbcCommand command = new OdbcCommand(sql, connection)) + { + connection.Open(); + command.ExecuteNonQuery(); + } + } + } + } +} diff --git a/external/corefx/src/System.Data.SqlClient/dir.props b/external/corefx/src/System.Data.SqlClient/dir.props index a302349368..f763a56920 100644 --- a/external/corefx/src/System.Data.SqlClient/dir.props +++ b/external/corefx/src/System.Data.SqlClient/dir.props @@ -4,5 +4,6 @@ 4.3.0.0 MSFT + true \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/pkg/System.Data.SqlClient.pkgproj b/external/corefx/src/System.Data.SqlClient/pkg/System.Data.SqlClient.pkgproj index 25cf504279..1a8bf629ed 100644 --- a/external/corefx/src/System.Data.SqlClient/pkg/System.Data.SqlClient.pkgproj +++ b/external/corefx/src/System.Data.SqlClient/pkg/System.Data.SqlClient.pkgproj @@ -6,6 +6,10 @@ net461;netcoreapp2.0;$(UAPvNextTFM);$(AllXamarinFrameworks) + + + runtimes/win/lib/$(UAPvNextTFM) + diff --git a/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.cs b/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.cs index db2bef225b..731959fa3f 100644 --- a/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.cs +++ b/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.cs @@ -260,11 +260,13 @@ namespace System.Data.SqlClient public System.Data.SqlClient.SqlBulkCopyColumnMapping Add(int sourceColumnIndex, string destinationColumn) { throw null; } public System.Data.SqlClient.SqlBulkCopyColumnMapping Add(string sourceColumn, int destinationColumnIndex) { throw null; } public System.Data.SqlClient.SqlBulkCopyColumnMapping Add(string sourceColumn, string destinationColumn) { throw null; } + public new void Clear() { } public bool Contains(System.Data.SqlClient.SqlBulkCopyColumnMapping value) { throw null; } public void CopyTo(System.Data.SqlClient.SqlBulkCopyColumnMapping[] array, int index) { } public int IndexOf(System.Data.SqlClient.SqlBulkCopyColumnMapping value) { throw null; } public void Insert(int index, System.Data.SqlClient.SqlBulkCopyColumnMapping value) { } public void Remove(System.Data.SqlClient.SqlBulkCopyColumnMapping value) { } + public new void RemoveAt(int index) { } } [System.FlagsAttribute] public enum SqlBulkCopyOptions @@ -344,6 +346,7 @@ namespace System.Data.SqlClient public System.Threading.Tasks.Task ExecuteXmlReaderAsync(System.Threading.CancellationToken cancellationToken) { throw null; } public override void Prepare() { } public System.Data.Sql.SqlNotificationRequest Notification { get { throw null; } set { } } + public void ResetCommandTimeout() { } } public sealed class SqlCommandBuilder : System.Data.Common.DbCommandBuilder { @@ -418,6 +421,7 @@ namespace System.Data.SqlClient public string CurrentLanguage { get { throw null; } set { } } public string DataSource { get { throw null; } set { } } public bool Encrypt { get { throw null; } set { } } + public bool Enlist { get { throw null; } set { } } public string FailoverPartner { get { throw null; } set { } } public string InitialCatalog { get { throw null; } set { } } public bool IntegratedSecurity { get { throw null; } set { } } @@ -671,6 +675,7 @@ namespace System.Data.SqlClient public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size) { } public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size, string sourceColumn) { } public SqlParameter(string parameterName, object value) { } + public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size, System.Data.ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, System.Data.DataRowVersion sourceVersion, object value) { } public SqlParameter(string parameterName, System.Data.SqlDbType dbType, int size, System.Data.ParameterDirection direction, byte precision, byte scale, string sourceColumn, System.Data.DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value, string xmlSchemaCollectionDatabase, string xmlSchemaCollectionOwningSchema, string xmlSchemaCollectionName) { } object ICloneable.Clone() { throw null; } public System.Data.SqlTypes.SqlCompareOptions CompareInfo { get { throw null; } set { } } @@ -708,6 +713,7 @@ namespace System.Data.SqlClient public override int Add(object value) { throw null; } public System.Data.SqlClient.SqlParameter Add(string parameterName, System.Data.SqlDbType sqlDbType) { throw null; } public System.Data.SqlClient.SqlParameter Add(string parameterName, System.Data.SqlDbType sqlDbType, int size) { throw null; } + public System.Data.SqlClient.SqlParameter Add(string parameterName, System.Data.SqlDbType sqlDbType, int size, string sourceColumn) { throw null; } public override void AddRange(System.Array values) { } public void AddRange(System.Data.SqlClient.SqlParameter[] values) { } public System.Data.SqlClient.SqlParameter AddWithValue(string parameterName, object value) { throw null; } @@ -758,4 +764,4 @@ namespace System.Data { internal OperationAbortedException() { } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj b/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj index 0647919132..18ecba930a 100644 --- a/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj +++ b/external/corefx/src/System.Data.SqlClient/ref/System.Data.SqlClient.csproj @@ -4,8 +4,9 @@ {D58E8D2B-3331-4660-8DFB-512D66F8EC63} true - - netstandard2.0;$(UAPvNextTFM) + + 4.3.0.0 diff --git a/external/corefx/src/System.Data.SqlClient/src/Configurations.props b/external/corefx/src/System.Data.SqlClient/src/Configurations.props index c73cbfb132..abd5922776 100644 --- a/external/corefx/src/System.Data.SqlClient/src/Configurations.props +++ b/external/corefx/src/System.Data.SqlClient/src/Configurations.props @@ -1,14 +1,17 @@  - - uap-Windows_NT; + netstandard-Unix; netstandard-Windows_NT; netstandard1.2; netstandard1.3; netstandard; netfx-Windows_NT; + + + $(PackageConfigurations) + uap-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/src/Resources/Strings.resx b/external/corefx/src/System.Data.SqlClient/src/Resources/Strings.resx index 7a6a92ad0d..097998c31a 100644 --- a/external/corefx/src/System.Data.SqlClient/src/Resources/Strings.resx +++ b/external/corefx/src/System.Data.SqlClient/src/Resources/Strings.resx @@ -931,7 +931,7 @@ A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. - + The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following: the client tried to connect to an unsupported version of SQL Server; the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. @@ -1180,7 +1180,4 @@ Unable to build schema collection '{0}'; - - Enlisting in Ambient transactions is not supported. - \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj b/external/corefx/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj index bad37fe649..458751a21c 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj +++ b/external/corefx/src/System.Data.SqlClient/src/System.Data.SqlClient.csproj @@ -123,6 +123,7 @@ + @@ -177,7 +178,6 @@ - diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/ActivityCorrelator.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/ActivityCorrelator.cs index d40daebef2..a54c4eaabe 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/ActivityCorrelator.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/ActivityCorrelator.cs @@ -71,7 +71,7 @@ namespace System.Data.Common } /// - /// Increment the sequence number and generate the new ActviityId + /// Increment the sequence number and generate the new ActivityId /// /// ActivityId internal static ActivityId Next() diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/AdapterUtil.SqlClient.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/AdapterUtil.SqlClient.cs index 73f5e075cc..12bc23e463 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/AdapterUtil.SqlClient.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/AdapterUtil.SqlClient.cs @@ -721,11 +721,6 @@ namespace System.Data.Common } } - internal static Exception AmbientTransactionIsNotSupported() - { - return new NotSupportedException(SR.AmbientTransactionsNotSupported); - } - private static Version s_systemDataVersion; internal static Version GetAssemblyVersion() @@ -814,61 +809,6 @@ namespace System.Data.Common return e; } - // the return value is true if the string was quoted and false if it was not - // this allows the caller to determine if it is an error or not for the quotedString to not be quoted - internal static bool RemoveStringQuotes(string quotePrefix, string quoteSuffix, string quotedString, out string unquotedString) - { - int prefixLength = quotePrefix != null ? quotePrefix.Length : 0; - int suffixLength = quoteSuffix != null ? quoteSuffix.Length : 0; - - if ((suffixLength + prefixLength) == 0) - { - unquotedString = quotedString; - return true; - } - - if (quotedString == null) - { - unquotedString = quotedString; - return false; - } - - int quotedStringLength = quotedString.Length; - - // is the source string too short to be quoted - if (quotedStringLength < prefixLength + suffixLength) - { - unquotedString = quotedString; - return false; - } - - // is the prefix present? - if (prefixLength > 0) - { - if (!quotedString.StartsWith(quotePrefix, StringComparison.Ordinal)) - { - unquotedString = quotedString; - return false; - } - } - - // is the suffix present? - if (suffixLength > 0) - { - if (!quotedString.EndsWith(quoteSuffix, StringComparison.Ordinal)) - { - unquotedString = quotedString; - return false; - } - unquotedString = quotedString.Substring(prefixLength, quotedStringLength - (prefixLength + suffixLength)).Replace(quoteSuffix + quoteSuffix, quoteSuffix); - } - else - { - unquotedString = quotedString.Substring(prefixLength, quotedStringLength - prefixLength); - } - return true; - } - internal static ArgumentOutOfRangeException InvalidCommandBehavior(CommandBehavior value) { Debug.Assert((0 > (int)value) || ((int)value > 0x3F), "valid CommandType " + value.ToString()); diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/DbConnectionOptions.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/DbConnectionOptions.cs index dc7729a93c..fbb572764e 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/DbConnectionOptions.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/Common/DbConnectionOptions.cs @@ -47,7 +47,7 @@ namespace System.Data.Common public bool ConvertValueToIntegratedSecurity() { string value; - return _parsetable.TryGetValue(KEY.Integrated_Security, out value) ? + return _parsetable.TryGetValue(KEY.Integrated_Security, out value) && value != null ? ConvertValueToIntegratedSecurityInternal(value) : false; } @@ -75,7 +75,7 @@ namespace System.Data.Common public int ConvertValueToInt32(string keyName, int defaultValue) { string value; - return _parsetable.TryGetValue(keyName, out value) ? + return _parsetable.TryGetValue(keyName, out value) && value != null ? ConvertToInt32Internal(keyName, value) : defaultValue; } @@ -107,4 +107,4 @@ namespace System.Data.Common return _parsetable.ContainsKey(keyword); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionFactory.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionFactory.cs index f11157e53c..cf6c3f673a 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionFactory.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionFactory.cs @@ -395,15 +395,14 @@ namespace System.Data.ProviderBase } } - - DbConnectionPoolGroup newConnectionPoolGroup = new DbConnectionPoolGroup(connectionOptions, key, poolOptions); - newConnectionPoolGroup.ProviderInfo = CreateConnectionPoolGroupProviderInfo(connectionOptions); - lock (this) { connectionPoolGroups = _connectionPoolGroups; if (!connectionPoolGroups.TryGetValue(key, out connectionPoolGroup)) { + DbConnectionPoolGroup newConnectionPoolGroup = new DbConnectionPoolGroup(connectionOptions, key, poolOptions); + newConnectionPoolGroup.ProviderInfo = CreateConnectionPoolGroupProviderInfo(connectionOptions); + // build new dictionary with space for new connection string Dictionary newConnectionPoolGroups = new Dictionary(1 + connectionPoolGroups.Count); foreach (KeyValuePair entry in connectionPoolGroups) diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionInternal.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionInternal.cs index 3b0391740c..93c9ac7bdb 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionInternal.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionInternal.cs @@ -166,7 +166,7 @@ namespace System.Data.ProviderBase /// Get boolean value that indicates whether the enlisted transaction has been disposed. /// /// - /// True if there is an enlisted transaction, and it has been diposed. + /// True if there is an enlisted transaction, and it has been disposed. /// False if there is an enlisted transaction that has not been disposed, or if the transaction reference is null. /// /// diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs index fb857dc68a..b28ade14d2 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolGroup.cs @@ -186,20 +186,19 @@ namespace System.Data.ProviderBase currentIdentity = null; } } + if (null != currentIdentity) { - if (!_poolCollection.TryGetValue(currentIdentity, out pool)) - { // find the pool - DbConnectionPoolProviderInfo connectionPoolProviderInfo = connectionFactory.CreateConnectionPoolProviderInfo(this.ConnectionOptions); - - // optimistically create pool, but its callbacks are delayed until after actual add - DbConnectionPool newPool = new DbConnectionPool(connectionFactory, this, currentIdentity, connectionPoolProviderInfo); - + if (!_poolCollection.TryGetValue(currentIdentity, out pool)) // find the pool + { lock (this) { // Did someone already add it to the list? if (!_poolCollection.TryGetValue(currentIdentity, out pool)) { + DbConnectionPoolProviderInfo connectionPoolProviderInfo = connectionFactory.CreateConnectionPoolProviderInfo(this.ConnectionOptions); + DbConnectionPool newPool = new DbConnectionPool(connectionFactory, this, currentIdentity, connectionPoolProviderInfo); + if (MarkPoolGroupAsActive()) { // If we get here, we know for certain that we there isn't @@ -209,12 +208,15 @@ namespace System.Data.ProviderBase bool addResult = _poolCollection.TryAdd(currentIdentity, newPool); Debug.Assert(addResult, "No other pool with current identity should exist at this point"); pool = newPool; - newPool = null; } else { // else pool entry has been disabled so don't create new pools Debug.Assert(PoolGroupStateDisabled == _state, "state should be disabled"); + + // don't need to call connectionFactory.QueuePoolForRelease(newPool) because + // pool callbacks were delayed and no risk of connections being created + newPool.Shutdown(); } } else @@ -223,13 +225,6 @@ namespace System.Data.ProviderBase Debug.Assert(PoolGroupStateActive == _state, "state should be active since a pool exists and lock holds"); } } - - if (null != newPool) - { - // don't need to call connectionFactory.QueuePoolForRelease(newPool) because - // pool callbacks were delayed and no risk of connections being created - newPool.Shutdown(); - } } // the found pool could be in any state } diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/LocalDB.Windows.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/LocalDB.Windows.cs index 7abe9bf924..3c81724c48 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/LocalDB.Windows.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/LocalDB.Windows.cs @@ -152,7 +152,7 @@ namespace System.Data.SqlClient.SNI } /// - /// Retireves the part of the sqlUserInstance.dll from the registry + /// Retrieves the part of the sqlUserInstance.dll from the registry /// /// In case the dll path is not found, the error is set here. /// diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsConnection.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsConnection.cs index ce792443d3..b0fe68403c 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsConnection.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsConnection.cs @@ -45,7 +45,7 @@ namespace System.Data.SqlClient.SNI _lowerHandle.SetAsyncCallbacks(HandleReceiveComplete, HandleSendComplete); } - public SNIMarsHandle CreateSession(object callbackObject, bool async) + public SNIMarsHandle CreateMarsSession(object callbackObject, bool async) { lock (this) { diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsManager.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsManager.cs deleted file mode 100644 index 53953b7963..0000000000 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsManager.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Concurrent; -using System.Collections.Generic; - -namespace System.Data.SqlClient.SNI -{ - /// - /// Singleton to manage all MARS connection - /// - internal class SNIMarsManager - { - public static readonly SNIMarsManager Singleton = new SNIMarsManager(); - private ConcurrentDictionary _connections = new ConcurrentDictionary(); - - /// - /// Constructor - /// - public SNIMarsManager() - { - } - - /// - /// Create a MARS connection - /// - /// Lower SNI handle - /// SNI error code - public uint CreateMarsConnection(SNIHandle lowerHandle) - { - SNIMarsConnection connection = new SNIMarsConnection(lowerHandle); - - if (_connections.TryAdd(lowerHandle, connection)) - { - return connection.StartReceive(); - } - else - { - return TdsEnums.SNI_ERROR; - } - } - - /// - /// Get a MARS connection by lower handle - /// - /// Lower SNI handle - /// MARS connection - public SNIMarsConnection GetConnection(SNIHandle lowerHandle) - { - return _connections[lowerHandle]; - } - } -} diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIProxy.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIProxy.cs index f6fa4d3101..11c49447ce 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIProxy.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIProxy.cs @@ -38,21 +38,6 @@ namespace System.Data.SqlClient.SNI { } - /// - /// Enable MARS support on a connection - /// - /// Connection handle - /// SNI error code - public uint EnableMars(SNIHandle handle) - { - if (SNIMarsManager.Singleton.CreateMarsConnection(handle) == TdsEnums.SNI_SUCCESS_IO_PENDING) - { - return TdsEnums.SNI_SUCCESS; - } - - return TdsEnums.SNI_ERROR; - } - /// /// Enable SSL on a connection /// @@ -432,20 +417,6 @@ namespace System.Data.SqlClient.SNI return new SNINpHandle(details.PipeHostName, details.PipeName, timerExpire, callbackObject); } - /// - /// Create MARS handle - /// - /// Asynchronous I/O callback object - /// SNI connection handle - /// Default buffer size - /// Asynchronous connection - /// SNI error status - public SNIHandle CreateMarsHandle(object callbackObject, SNIHandle physicalConnection, int defaultBufferSize, bool async) - { - SNIMarsConnection connection = SNIMarsManager.Singleton.GetConnection(physicalConnection); - return connection.CreateSession(callbackObject, async); - } - /// /// Read packet asynchronously /// @@ -502,7 +473,7 @@ namespace System.Data.SqlClient.SNI /// Gets the Local db Named pipe data source if the input is a localDB server. /// /// The data source - /// Set true when an error occured while getting LocalDB up + /// Set true when an error occurred while getting LocalDB up /// private string GetLocalDBDataSource(string fullServerName, out bool error) { @@ -877,4 +848,4 @@ namespace System.Data.SqlClient.SNI private static bool IsLocalHost(string serverName) => ".".Equals(serverName) || "(local)".Equals(serverName) || "localhost".Equals(serverName); } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.cs index 214d57ccb7..4b9f0a8c6a 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.cs @@ -341,6 +341,10 @@ namespace System.Data.SqlClient.SNI /// public override void DisableSsl() { +#if MONO + // Temp workaround - SSLStream.Dispose causes an expected behavior in mono for windows + if (Environment.OSVersion.Platform != PlatformID.Win32NT) +#endif _sslStream.Dispose(); _sslStream = null; _sslOverTdsStream.Dispose(); diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlBulkCopy.cs.REMOVED.git-id b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlBulkCopy.cs.REMOVED.git-id index 4e69f51a4c..9e3d78e332 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlBulkCopy.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlBulkCopy.cs.REMOVED.git-id @@ -1 +1 @@ -7f5d1c4807eaf36f3fd9a864997a81db03ec17bb \ No newline at end of file +ca6aaa8e5e52241db96ee4cf49def4a66255ef83 \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommand.cs.REMOVED.git-id b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommand.cs.REMOVED.git-id index 8c777c2a42..76674a8aa1 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommand.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommand.cs.REMOVED.git-id @@ -1 +1 @@ -53f48d4706ba6e6d77eb030d6b75deb32cb95db6 \ No newline at end of file +ec32c2f52b30d02516a9dd668091384b81a62db6 \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs.REMOVED.git-id b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs.REMOVED.git-id index 6999a86677..43c907d9b7 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDataReader.cs.REMOVED.git-id @@ -1 +1 @@ -f9de4026e1ef3de655cafffd0f48d13c1ecf6c91 \ No newline at end of file +708c6f08b7f78cdb16c99827da906e5cf84d774c \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDelegatedTransaction.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDelegatedTransaction.cs index ecd03c1136..d0e60ab389 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDelegatedTransaction.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDelegatedTransaction.cs @@ -397,7 +397,7 @@ namespace System.Data.SqlClient // Event notification that transaction ended. This comes from the subscription to the Transaction's // ended event via the internal connection. If it occurs without a prior Rollback or SinglePhaseCommit call, - // it indicates the transaction was ended externally (generally that one the the DTC participants aborted + // it indicates the transaction was ended externally (generally that one of the DTC participants aborted // the transaction). internal void TransactionEnded(Transaction transaction) { diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.AppDomain.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.AppDomain.cs new file mode 100644 index 0000000000..1e92c1482a --- /dev/null +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.AppDomain.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Data.SqlClient +{ + // these members were moved to a separate file in order + // to be able to skip them on platforms where AppDomain members are not supported + // for example, some mobile profiles on mono + partial class SqlDependencyPerAppDomainDispatcher + { + private void SubscribeToAppDomainUnload() + { + // If rude abort - we'll leak. This is acceptable for now. + AppDomain.CurrentDomain.DomainUnload += new EventHandler(UnloadEventHandler); + } + + private void UnloadEventHandler(object sender, EventArgs e) + { + // Make non-blocking call to ProcessDispatcher to ThreadPool.QueueUserWorkItem to complete + // stopping of all start calls in this AppDomain. For containers shared among various AppDomains, + // this will just be a ref-count subtract. For non-shared containers, we will close the container + // and clean-up. + var dispatcher = SqlDependency.ProcessDispatcher; + dispatcher?.QueueAppDomainUnloading(SqlDependency.AppDomainKey); + } + } +} diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.cs index ba360d3b4a..a2b2ffffef 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlDependencyUtils.cs @@ -13,7 +13,7 @@ namespace System.Data.SqlClient // that AppDomain. It receives calls from the SqlDependencyProcessDispatcher with an ID or a server name // to invalidate matching dependencies in the given AppDomain. - internal class SqlDependencyPerAppDomainDispatcher : MarshalByRefObject + internal partial class SqlDependencyPerAppDomainDispatcher : MarshalByRefObject { // Instance members @@ -82,8 +82,7 @@ namespace System.Data.SqlClient _timeoutTimer = new Timer(new TimerCallback(TimeoutTimerCallback), null, Timeout.Infinite, Timeout.Infinite); - // If rude abort - we'll leak. This is acceptable for now. - AppDomain.CurrentDomain.DomainUnload += new EventHandler(UnloadEventHandler); + SubscribeToAppDomainUnload(); } // When remoted across appdomains, MarshalByRefObject links by default time out if there is no activity @@ -93,21 +92,6 @@ namespace System.Data.SqlClient return null; } - // Events - - private void UnloadEventHandler(object sender, EventArgs e) - { - // Make non-blocking call to ProcessDispatcher to ThreadPool.QueueUserWorkItem to complete - // stopping of all start calls in this AppDomain. For containers shared among various AppDomains, - // this will just be a ref-count subtract. For non-shared containers, we will close the container - // and clean-up. - SqlDependencyProcessDispatcher dispatcher = SqlDependency.ProcessDispatcher; - if (null != dispatcher) - { - dispatcher.QueueAppDomainUnloading(SqlDependency.AppDomainKey); - } - } - // Methods for dependency hash manipulation and firing. // This method is called upon SqlDependency constructor. diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInternalConnectionTds.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInternalConnectionTds.cs index 3e7346dbf2..f5c03bb81c 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInternalConnectionTds.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInternalConnectionTds.cs @@ -644,7 +644,7 @@ namespace System.Data.SqlClient /// /// When using Implicit transaction unbinding, /// verify that the enlisted transaction is active. - /// If it is not active, and the transaction object has been diposed, unbind from the transaction. + /// If it is not active, and the transaction object has been disposed, unbind from the transaction. /// If it is not active and not disposed, throw an exception. /// /// @@ -1416,7 +1416,7 @@ namespace System.Data.SqlClient // Determine unit interval if (timeout.IsInfinite) { - timeoutUnitInterval = checked((long)ADP.FailoverTimeoutStep * ADP.TimerFromSeconds(ADP.DefaultConnectionTimeout)); + timeoutUnitInterval = checked((long)(ADP.FailoverTimeoutStep * ADP.TimerFromSeconds(ADP.DefaultConnectionTimeout))); } else { diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlParameter.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlParameter.cs index 2946cfd530..56f0f078b8 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlParameter.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlParameter.cs @@ -110,6 +110,27 @@ namespace System.Data.SqlClient this.SourceColumn = sourceColumn; } + public SqlParameter( + string parameterName, + SqlDbType dbType, + int size, + ParameterDirection direction, + bool isNullable, + byte precision, + byte scale, + string sourceColumn, + DataRowVersion sourceVersion, + object value + ) : this(parameterName, dbType, size, sourceColumn) + { + this.Direction = direction; + this.IsNullable = isNullable; + this.Precision = precision; + this.Scale = scale; + this.SourceVersion = sourceVersion; + this.Value = value; + } + public SqlParameter( string parameterName, SqlDbType dbType, diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsEnums.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsEnums.cs index 14efc67378..d3ac97309f 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsEnums.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsEnums.cs @@ -2,10 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. - - -//------------------------------------------------------------------------------ - +using System.Diagnostics; namespace System.Data.SqlClient { @@ -870,13 +867,54 @@ namespace System.Data.SqlClient internal static readonly int[] WHIDBEY_TIME_LENGTH = { 8, 10, 11, 12, 13, 14, 15, 16 }; internal static readonly int[] WHIDBEY_DATETIME2_LENGTH = { 19, 21, 22, 23, 24, 25, 26, 27 }; internal static readonly int[] WHIDBEY_DATETIMEOFFSET_LENGTH = { 26, 28, 29, 30, 31, 32, 33, 34 }; + + // Needed for UapAot, since we cannot use Enum.GetName() on SniContext. + // Enum.GetName() uses reflection, which is blocked on UapAot for internal types + // like SniContext. + internal static string GetSniContextEnumName(SniContext sniContext) + { + switch (sniContext) + { + case SniContext.Undefined: + return "Undefined"; + case SniContext.Snix_Connect: + return "Snix_Connect"; + case SniContext.Snix_PreLoginBeforeSuccessfulWrite: + return "Snix_PreLoginBeforeSuccessfulWrite"; + case SniContext.Snix_PreLogin: + return "Snix_PreLogin"; + case SniContext.Snix_LoginSspi: + return "Snix_LoginSspi"; + case SniContext.Snix_ProcessSspi: + return "Snix_ProcessSspi"; + case SniContext.Snix_Login: + return "Snix_Login"; + case SniContext.Snix_EnableMars: + return "Snix_EnableMars"; + case SniContext.Snix_AutoEnlist: + return "Snix_AutoEnlist"; + case SniContext.Snix_GetMarsSession: + return "Snix_GetMarsSession"; + case SniContext.Snix_Execute: + return "Snix_Execute"; + case SniContext.Snix_Read: + return "Snix_Read"; + case SniContext.Snix_Close: + return "Snix_Close"; + case SniContext.Snix_SendRows: + return "Snix_SendRows"; + default: + Debug.Fail($"Received unknown SniContext enum. Value: {sniContext}"); + return null; + } + } } internal enum SniContext { Undefined = 0, Snix_Connect, - Snix_PreLoginBeforeSuccessfullWrite, + Snix_PreLoginBeforeSuccessfulWrite, Snix_PreLogin, Snix_LoginSspi, Snix_ProcessSspi, diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs.REMOVED.git-id b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs.REMOVED.git-id index 8cde086937..d0b91d28f1 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs.REMOVED.git-id +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs.REMOVED.git-id @@ -1 +1 @@ -a0654276998bf541f2fefb2f7b517bc6becc477e \ No newline at end of file +37a4d51e0d908eadb8ca232097e52985b9bbb687 \ No newline at end of file diff --git a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs index e94768da91..50d03824fb 100644 --- a/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs +++ b/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs @@ -11,7 +11,7 @@ namespace System.Data.SqlClient.SNI { internal class TdsParserStateObjectManaged : TdsParserStateObject { - + private SNIMarsConnection _marsConnection = null; private SNIHandle _sessionHandle = null; // the SNI handle we're to work on private SNIPacket _sniPacket = null; // Will have to re-vamp this for MARS internal SNIPacket _sniAsyncAttnPacket = null; // Packet to use to send Attn @@ -45,7 +45,13 @@ namespace System.Data.SqlClient.SNI { Debug.Assert(physicalConnection is TdsParserStateObjectManaged, "Expected a stateObject of type " + this.GetType()); TdsParserStateObjectManaged managedSNIObject = physicalConnection as TdsParserStateObjectManaged; - _sessionHandle = SNIProxy.Singleton.CreateMarsHandle(this, managedSNIObject.Handle, _outBuff.Length, async); + + _sessionHandle = managedSNIObject.CreateMarsSession(this, async); + } + + internal SNIMarsHandle CreateMarsSession(object callbackObject, bool async) + { + return _marsConnection.CreateMarsSession(callbackObject, async); } protected override uint SNIPacketGetData(object packet, byte[] _inBuff, ref uint dataSize) => SNIProxy.Singleton.PacketGetData(packet as SNIPacket, _inBuff, ref dataSize); @@ -84,10 +90,7 @@ namespace System.Data.SqlClient.SNI _sniPacket = null; _sessionHandle = null; _sniAsyncAttnPacket = null; - - _sniPacket = null; - _sessionHandle = null; - _sniAsyncAttnPacket = null; + _marsConnection = null; DisposeCounters(); @@ -218,7 +221,16 @@ namespace System.Data.SqlClient.SNI internal override uint DisabeSsl() => SNIProxy.Singleton.DisableSsl(Handle); - internal override uint EnableMars(ref uint info) => SNIProxy.Singleton.EnableMars(Handle); + internal override uint EnableMars(ref uint info) + { + _marsConnection = new SNIMarsConnection(Handle); + if (_marsConnection.StartReceive() == TdsEnums.SNI_SUCCESS_IO_PENDING) + { + return TdsEnums.SNI_SUCCESS; + } + + return TdsEnums.SNI_ERROR; + } internal override uint EnableSsl(ref uint info)=> SNIProxy.Singleton.EnableSsl(Handle, info); diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/AmbientTransactionFailureTest.cs b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/AmbientTransactionFailureTest.cs index 1e6cbfcb0e..46fe0fa69f 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/AmbientTransactionFailureTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/AmbientTransactionFailureTest.cs @@ -72,7 +72,7 @@ namespace System.Data.SqlClient.Tests new object[] { EnlistConnectionInTransaction, s_connectionStringWithEnlistOff } }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotArmProcess))] // https://github.com/dotnet/corefx/issues/21598 + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArmProcess))] // https://github.com/dotnet/corefx/issues/21598 [MemberData(nameof(ExceptionTestDataForSqlException))] public void TestSqlException(Action connectAction, string connectionString) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/CloneTests.cs b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/CloneTests.cs index be1d7a2b86..8c3fafb15f 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/CloneTests.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/CloneTests.cs @@ -31,6 +31,8 @@ namespace System.Data.SqlClient.Tests SqlCommand command = connection.CreateCommand(); command.CommandText = "select 1"; command.CommandTimeout = 45; + command.ResetCommandTimeout(); + Assert.Equal(command.CommandTimeout, 30); command.CommandType = CommandType.Text; SqlParameter parameter = command.CreateParameter(); diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs index 79dc1941b3..d04c326aaf 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs @@ -18,6 +18,7 @@ using System.Runtime.CompilerServices; namespace System.Data.SqlClient.Tests { + [ActiveIssue("dotnet/corefx #17925", TestPlatforms.Any)] public class DiagnosticTest : RemoteExecutorTestBase { private const string BadConnectionString = "data source = bad; initial catalog = bad; uid = bad; password = bad; connection timeout = 1;"; @@ -26,7 +27,7 @@ namespace System.Data.SqlClient.Tests public static bool IsConnectionStringConfigured() => s_tcpConnStr != string.Empty; [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteScalarTest() { RemoteInvoke(() => @@ -48,7 +49,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteScalarErrorTest() { RemoteInvoke(() => @@ -72,7 +73,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteNonQueryTest() { RemoteInvoke(() => @@ -94,7 +95,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteNonQueryErrorTest() { RemoteInvoke(() => @@ -132,7 +133,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteReaderTest() { RemoteInvoke(() => @@ -155,7 +156,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteReaderErrorTest() { RemoteInvoke(() => @@ -181,7 +182,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteReaderWithCommandBehaviorTest() { RemoteInvoke(() => @@ -204,6 +205,7 @@ namespace System.Data.SqlClient.Tests } [ConditionalFact(nameof(IsConnectionStringConfigured))] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteXmlReaderTest() { RemoteInvoke(cs => @@ -226,7 +228,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteXmlReaderErrorTest() { RemoteInvoke(() => @@ -252,7 +254,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteScalarAsyncTest() { RemoteInvoke(() => @@ -274,7 +276,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteScalarAsyncErrorTest() { RemoteInvoke(() => @@ -298,7 +300,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteNonQueryAsyncTest() { RemoteInvoke(() => @@ -320,7 +322,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteNonQueryAsyncErrorTest() { RemoteInvoke(() => @@ -343,7 +345,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteReaderAsyncTest() { RemoteInvoke(() => @@ -366,7 +368,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteReaderAsyncErrorTest() { RemoteInvoke(() => @@ -392,6 +394,7 @@ namespace System.Data.SqlClient.Tests } [ConditionalFact(nameof(IsConnectionStringConfigured))] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteXmlReaderAsyncTest() { RemoteInvoke(cs => @@ -414,6 +417,7 @@ namespace System.Data.SqlClient.Tests } [ConditionalFact(nameof(IsConnectionStringConfigured))] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ExecuteXmlReaderAsyncErrorTest() { RemoteInvoke(cs => @@ -439,7 +443,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ConnectionOpenTest() { RemoteInvoke(() => @@ -460,7 +464,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ConnectionOpenErrorTest() { RemoteInvoke(() => @@ -477,7 +481,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ConnectionOpenAsyncTest() { RemoteInvoke(() => @@ -494,7 +498,7 @@ namespace System.Data.SqlClient.Tests } [Fact] - [ActiveIssue("dotnet/corefx #17925", TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] // Internals reflection not supported on uapaot public void ConnectionOpenAsyncErrorTest() { RemoteInvoke(() => diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs index 8556f45bce..5c07ba6cb1 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs @@ -139,6 +139,25 @@ namespace System.Data.SqlClient.Tests OpenBadConnection(builder.ConnectionString, invalidConnStringError); } + [Fact] + [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)] + public static void LocalDBNotSupportedOnUapTest() + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(@"server=(localdb)\MSSQLLocalDB") + { + IntegratedSecurity = true, + ConnectTimeout = 2 + }; + + Assert.Throws(() => + { + using (SqlConnection conn = new SqlConnection(builder.ConnectionString)) + { + conn.Open(); + } + }); + } + private void GenerateConnectionException(string connectionString) { using (SqlConnection sqlConnection = new SqlConnection(connectionString)) diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs new file mode 100644 index 0000000000..2df596fac9 --- /dev/null +++ b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs @@ -0,0 +1,83 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +using System.Data.Common; +using System.Reflection; +using Xunit; + +namespace System.Data.SqlClient.Tests +{ + public class SqlConnectionBasicTests + { + [Fact] + [ActiveIssue("dotnet/corefx #23435", TestPlatforms.Any)] + public void ConnectionTest() + { + using (TestTdsServer server = TestTdsServer.StartTestServer()) + { + using (SqlConnection connection = new SqlConnection(server.ConnectionString)) + { + connection.Open(); + } + } + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotArmProcess))] + [ActiveIssue("dotnet/corefx #23435", TestPlatforms.Any)] + [PlatformSpecific(TestPlatforms.Windows)] + public void IntegratedAuthConnectionTest() + { + using (TestTdsServer server = TestTdsServer.StartTestServer()) + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(server.ConnectionString); + builder.IntegratedSecurity = true; + using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) + { + connection.Open(); + } + } + } + + [Fact] + public void SqlConnectionDbProviderFactoryTest() + { + SqlConnection con = new SqlConnection(); + PropertyInfo dbProviderFactoryProperty = con.GetType().GetProperty("DbProviderFactory", BindingFlags.NonPublic | BindingFlags.Instance); + Assert.NotNull(dbProviderFactoryProperty); + DbProviderFactory factory = dbProviderFactoryProperty.GetValue(con) as DbProviderFactory; + Assert.NotNull(factory); + Assert.Same(typeof(SqlClientFactory), factory.GetType()); + Assert.Same(SqlClientFactory.Instance, factory); + } + + [Fact] + public void SqlConnectionValidParameters() + { + var con = new SqlConnection("Timeout=1234;packet Size=5678 ;;; ;"); + Assert.Equal(1234, con.ConnectionTimeout); + Assert.Equal(5678, con.PacketSize); + } + + [Fact] + public void SqlConnectionEmptyParameters() + { + var con = new SqlConnection("Timeout=;packet Size= ;Integrated Security=;"); + //default values are defined in internal class DbConnectionStringDefaults + Assert.Equal(15, con.ConnectionTimeout); + Assert.Equal(8000, con.PacketSize); + Assert.False(new SqlConnectionStringBuilder(con.ConnectionString).IntegratedSecurity); + } + + [Fact] + public void SqlConnectionInvalidParameters() + { + Assert.Throws(() => new SqlConnection("Timeout=null;")); + Assert.Throws(() => new SqlConnection("Timeout= null;")); + Assert.Throws(() => new SqlConnection("Timeout=1 1;")); + Assert.Throws(() => new SqlConnection("Timeout=1a;")); + Assert.Throws(() => new SqlConnection("Integrated Security=truee")); + } + } +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs deleted file mode 100644 index d11077d446..0000000000 --- a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - -using System.Data.Common; -using System.Reflection; -using Xunit; - -namespace System.Data.SqlClient.Tests -{ - public class SqlConnectionBasicTests - { - - [Fact] - public void ConnectionTest() - { - using (TestTdsServer server = TestTdsServer.StartTestServer()) - { - using (SqlConnection connection = new SqlConnection(server.ConnectionString)) - { - connection.Open(); - } - } - } - - - [PlatformSpecific(TestPlatforms.Windows)] // Integ auth on Test server is supported on Windows right now - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotArmProcess))] // https://github.com/dotnet/corefx/issues/19218 And https://github.com/dotnet/corefx/issues/21598 - public void IntegratedAuthConnectionTest() - { - using (TestTdsServer server = TestTdsServer.StartTestServer()) - { - SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(server.ConnectionString); - builder.IntegratedSecurity = true; - using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) - { - connection.Open(); - } - } - } - - [Fact] - public void SqlConnectionDbProviderFactoryTest() - { - SqlConnection con = new SqlConnection(); - PropertyInfo dbProviderFactoryProperty = con.GetType().GetProperty("DbProviderFactory", BindingFlags.NonPublic | BindingFlags.Instance); - Assert.NotNull(dbProviderFactoryProperty); - DbProviderFactory factory = dbProviderFactoryProperty.GetValue(con) as DbProviderFactory; - Assert.NotNull(factory); - Assert.Same(typeof(SqlClientFactory), factory.GetType()); - Assert.Same(SqlClientFactory.Instance, factory); - } - } -} diff --git a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/System.Data.SqlClient.Tests.csproj b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/System.Data.SqlClient.Tests.csproj index c946aa95cf..2c4c8a0225 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/System.Data.SqlClient.Tests.csproj +++ b/external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/System.Data.SqlClient.Tests.csproj @@ -2,8 +2,6 @@ - - chk {F3E72F35-0351-4D67-9388-725BCAD807BA} @@ -27,12 +25,9 @@ - + - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DDBasics/DDDataTypesTest/DDDataTypesTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DDBasics/DDDataTypesTest/DDDataTypesTest.cs index 2e72162c2c..0d345ba2a7 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DDBasics/DDDataTypesTest/DDDataTypesTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DDBasics/DDDataTypesTest/DDDataTypesTest.cs @@ -2,14 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Data.Common; using System.Data.SqlTypes; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Xml; using Xunit; @@ -193,397 +186,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests } } - [CheckConnStrSetupFact] - public static void TestUdtDataReaderGetValueThrowsPlatformNotSupportedException() - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/') as col0"; - using (SqlDataReader reader = command.ExecuteReader()) - { - Assert.True(reader.Read()); - - Assert.Throws(() => - { - object valud = reader[0]; - }); - - Assert.Throws(() => - { - reader.GetValue(0); - }); - - Assert.Throws(() => - { - reader.GetFieldValue(0); - }); - - AggregateException exception = Assert.Throws(() => - { - reader.GetFieldValueAsync(0).Wait(); - }); - Assert.IsType(typeof(PlatformNotSupportedException), exception.InnerException); - - Assert.Throws(() => - { - object[] values = new object[1]; - reader.GetValues(values); - }); - - Assert.Throws(() => - { - object[] values = new object[1]; - reader.GetSqlValues(values); - }); - - Assert.Throws(() => - { - reader.GetProviderSpecificFieldType(0); - }); - - Assert.Throws(() => - { - reader.GetProviderSpecificValue(0); - }); - - Assert.Throws(() => - { - object[] values = new object[1]; - reader.GetProviderSpecificValues(values); - }); - } - } - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlParameterThrowsPlatformNotSupportedException() - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - - // This command is not executed on the server since we should throw well before we send the query - command.CommandText = "select @p as col0"; - - command.Parameters.Add(new SqlParameter - { - ParameterName = "@p", - SqlDbType = SqlDbType.Udt, - Direction = ParameterDirection.Input, - }); - - Assert.Throws(() => - { - command.ExecuteReader(); - }); - - - command.Parameters.Clear(); - command.Parameters.Add(new SqlParameter - { - ParameterName = "@p", - SqlDbType = SqlDbType.Udt, - Direction = ParameterDirection.InputOutput, - }); - - Assert.Throws(() => - { - command.ExecuteReader(); - }); - - - command.Parameters.Clear(); - command.Parameters.Add(new SqlParameter - { - ParameterName = "@p", - SqlDbType = SqlDbType.Udt, - Direction = ParameterDirection.Output, - }); - - Assert.Throws(() => - { - command.ExecuteReader(); - }); - } - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlCommandExecuteScalarThrowsPlatformNotSupportedException() - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/') as col0"; - Assert.Throws(() => - { - object value = command.ExecuteScalar(); - }); - - - SqlCommand asyncCommand = connection.CreateCommand(); - asyncCommand.CommandText = "select hierarchyid::Parse('/') as col0"; - AggregateException exception = Assert.Throws(() => - { - asyncCommand.ExecuteScalarAsync().Wait(); - }); - Assert.IsType(typeof(PlatformNotSupportedException), exception.InnerException); - } - } - - [CheckConnStrSetupFact] - public static void TestUdtZeroByte() - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/') as col0"; - using (SqlDataReader reader = command.ExecuteReader()) - { - Assert.True(reader.Read()); - Assert.False(reader.IsDBNull(0)); - SqlBytes sqlBytes = reader.GetSqlBytes(0); - Assert.False(sqlBytes.IsNull, "Expected a zero length byte array"); - Assert.True(sqlBytes.Length == 0, "Expected a zero length byte array"); - } - } - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlDataReaderGetSqlBytesSequentialAccess() - { - TestUdtSqlDataReaderGetSqlBytes(CommandBehavior.SequentialAccess); - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlDataReaderGetSqlBytes() - { - TestUdtSqlDataReaderGetSqlBytes(CommandBehavior.Default); - } - - private static void TestUdtSqlDataReaderGetSqlBytes(CommandBehavior behavior) - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; - using (SqlDataReader reader = command.ExecuteReader(behavior)) - { - Assert.True(reader.Read()); - - SqlBytes sqlBytes = null; - - sqlBytes = reader.GetSqlBytes(0); - Assert.Equal("5ade", ToHexString(sqlBytes.Value)); - - sqlBytes = reader.GetSqlBytes(1); - Assert.Equal("0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000ffffffff0000000002", ToHexString(sqlBytes.Value)); - - sqlBytes = reader.GetSqlBytes(2); - Assert.Equal("e610000001148716d9cef7d34740d7a3703d0a975ec08716d9cef7d34740cba145b6f3955ec0", ToHexString(sqlBytes.Value)); - - if (behavior == CommandBehavior.Default) - { - sqlBytes = reader.GetSqlBytes(0); - Assert.Equal("5ade", ToHexString(sqlBytes.Value)); - } - } - } - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlDataReaderGetBytesSequentialAccess() - { - TestUdtSqlDataReaderGetBytes(CommandBehavior.SequentialAccess); - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlDataReaderGetBytes() - { - TestUdtSqlDataReaderGetBytes(CommandBehavior.Default); - } - - private static void TestUdtSqlDataReaderGetBytes(CommandBehavior behavior) - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; - using (SqlDataReader reader = command.ExecuteReader(behavior)) - { - Assert.True(reader.Read()); - - int byteCount = 0; - byte[] bytes = null; - - byteCount = (int) reader.GetBytes(0, 0, null, 0, 0); - Assert.True(byteCount > 0); - bytes = new byte[byteCount]; - reader.GetBytes(0, 0, bytes, 0, bytes.Length); - Assert.Equal("5ade", ToHexString(bytes)); - - byteCount = (int)reader.GetBytes(1, 0, null, 0, 0); - Assert.True(byteCount > 0); - bytes = new byte[byteCount]; - reader.GetBytes(1, 0, bytes, 0, bytes.Length); - Assert.Equal("0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000ffffffff0000000002", ToHexString(bytes)); - - byteCount = (int)reader.GetBytes(2, 0, null, 0, 0); - Assert.True(byteCount > 0); - bytes = new byte[byteCount]; - reader.GetBytes(2, 0, bytes, 0, bytes.Length); - Assert.Equal("e610000001148716d9cef7d34740d7a3703d0a975ec08716d9cef7d34740cba145b6f3955ec0", ToHexString(bytes)); - - if (behavior == CommandBehavior.Default) - { - byteCount = (int)reader.GetBytes(0, 0, null, 0, 0); - Assert.True(byteCount > 0); - bytes = new byte[byteCount]; - reader.GetBytes(0, 0, bytes, 0, bytes.Length); - Assert.Equal("5ade", ToHexString(bytes)); - } - } - } - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlDataReaderGetStreamSequentialAccess() - { - TestUdtSqlDataReaderGetStream(CommandBehavior.SequentialAccess); - } - - [CheckConnStrSetupFact] - public static void TestUdtSqlDataReaderGetStream() - { - TestUdtSqlDataReaderGetStream(CommandBehavior.Default); - } - - private static void TestUdtSqlDataReaderGetStream(CommandBehavior behavior) - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; - using (SqlDataReader reader = command.ExecuteReader(behavior)) - { - Assert.True(reader.Read()); - - MemoryStream buffer = null; - byte[] bytes = null; - - buffer = new MemoryStream(); - using (Stream stream = reader.GetStream(0)) - { - stream.CopyTo(buffer); - } - bytes = buffer.ToArray(); - Assert.Equal("5ade", ToHexString(bytes)); - - buffer = new MemoryStream(); - using (Stream stream = reader.GetStream(1)) - { - stream.CopyTo(buffer); - } - bytes = buffer.ToArray(); - Assert.Equal("0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000ffffffff0000000002", ToHexString(bytes)); - - buffer = new MemoryStream(); - using (Stream stream = reader.GetStream(2)) - { - stream.CopyTo(buffer); - } - bytes = buffer.ToArray(); - Assert.Equal("e610000001148716d9cef7d34740d7a3703d0a975ec08716d9cef7d34740cba145b6f3955ec0", ToHexString(bytes)); - - if (behavior == CommandBehavior.Default) - { - buffer = new MemoryStream(); - using (Stream stream = reader.GetStream(0)) - { - stream.CopyTo(buffer); - } - bytes = buffer.ToArray(); - Assert.Equal("5ade", ToHexString(bytes)); - } - } - } - } - - [CheckConnStrSetupFact] - public static void TestUdtSchemaMetadata() - { - using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) - { - connection.Open(); - SqlCommand command = connection.CreateCommand(); - command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; - using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.SchemaOnly)) - { - ReadOnlyCollection columns = reader.GetColumnSchema(); - - DbColumn column = null; - - // Validate Microsoft.SqlServer.Types.SqlHierarchyId, Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 - column = columns[0]; - Assert.Equal(column.ColumnName, "col0"); - Assert.Equal(typeof(byte[]), column.DataType); - Assert.NotNull(column.UdtAssemblyQualifiedName); - AssertSqlUdtAssemblyQualifiedName(column.UdtAssemblyQualifiedName, "Microsoft.SqlServer.Types.SqlHierarchyId"); - - // Validate Microsoft.SqlServer.Types.SqlGeometry, Microsoft.SqlServer.Types, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91 - column = columns[1]; - Assert.Equal(column.ColumnName, "col1"); - Assert.Equal(typeof(byte[]), column.DataType); - Assert.NotNull(column.UdtAssemblyQualifiedName); - AssertSqlUdtAssemblyQualifiedName(column.UdtAssemblyQualifiedName, "Microsoft.SqlServer.Types.SqlGeometry"); - - // Validate Microsoft.SqlServer.Types.SqlGeography, Microsoft.SqlServer.Types, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91 - column = columns[2]; - Assert.Equal(column.ColumnName, "col2"); - Assert.Equal(typeof(byte[]), column.DataType); - Assert.NotNull(column.UdtAssemblyQualifiedName); - AssertSqlUdtAssemblyQualifiedName(column.UdtAssemblyQualifiedName, "Microsoft.SqlServer.Types.SqlGeography"); - } - } - } - - private static void AssertSqlUdtAssemblyQualifiedName(string assemblyQualifiedName, string expectedType) - { - List parts = assemblyQualifiedName.Split(',').Select(x => x.Trim()).ToList(); - - string type = parts[0]; - string assembly = parts.Count < 2 ? string.Empty : parts[1]; - string version = parts.Count < 3 ? string.Empty : parts[2]; - string culture = parts.Count < 4 ? string.Empty : parts[3]; - string token = parts.Count < 5 ? string.Empty : parts[4]; - - Assert.Equal(expectedType, type); - Assert.Equal("Microsoft.SqlServer.Types", assembly); - Assert.True(version.StartsWith("Version")); - Assert.True(culture.StartsWith("Culture")); - Assert.True(token.StartsWith("PublicKeyToken")); - } - - private static string ToHexString(byte[] bytes) - { - StringBuilder hex = new StringBuilder(bytes.Length * 2); - foreach (byte b in bytes) - { - hex.AppendFormat("{0:x2}", b); - } - - return hex.ToString(); - } - - private static char localByteToChar(int b) + private static char LocalByteToChar(int b) { char c; @@ -603,8 +206,8 @@ namespace System.Data.SqlClient.ManualTesting.Tests { for (int i = 0; i < bb.Length; ++i) { - cc[2 * i] = localByteToChar((bb[i] >> 4) & 0xf); - cc[2 * i + 1] = localByteToChar(bb[i] & 0xf); + cc[2 * i] = LocalByteToChar((bb[i] >> 4) & 0xf); + cc[2 * i + 1] = LocalByteToChar(bb[i] & 0xf); } } } diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/AssemblyResourceManager.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/AssemblyResourceManager.cs index 88e5afff57..40b0961f61 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/AssemblyResourceManager.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/AssemblyResourceManager.cs @@ -55,19 +55,27 @@ namespace System.Data.SqlClient.ManualTesting.Tests private bool TryGetResourceValue(string resourceName, object[] args, out object result) { - var type = _resourceAssembly.GetType("System.SR"); - var info = type.GetProperty(resourceName, BindingFlags.NonPublic | BindingFlags.Static); - - result = null; - if (info != null) + if (PlatformDetection.IsNetNative) { - result = info.GetValue(null); - if (args != null) - { - result = string.Format((string)result, args); - } + result = string.Empty; + return true; + } + else + { + var type = _resourceAssembly.GetType("System.SR"); + var info = type.GetProperty(resourceName, BindingFlags.NonPublic | BindingFlags.Static); + + result = null; + if (info != null) + { + result = info.GetValue(null); + if (args != null) + { + result = string.Format((string)result, args); + } + } + return result != null; } - return result != null; } } } diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs index 30a5e8e311..2426927935 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs @@ -223,5 +223,42 @@ namespace System.Data.SqlClient.ManualTesting.Tests { ExpectFailure(() => actionThatFails().Wait(), null, exceptionMessage, innerExceptionMessage, innerInnerExceptionMustBeNull); } + + public static string GenerateTableName() + { + return string.Format("TEST_{0}{1}{2}", Environment.GetEnvironmentVariable("ComputerName"), Environment.TickCount, Guid.NewGuid()).Replace('-', '_'); + } + + public static void RunNonQuery(string connectionString, string sql) + { + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + using (SqlCommand command = connection.CreateCommand()) + { + command.CommandText = sql; + command.ExecuteNonQuery(); + } + } + } + + public static DataTable RunQuery(string connectionString, string sql) + { + DataTable result = null; + using (SqlConnection connection = new SqlConnection(connectionString)) + { + connection.Open(); + using (SqlCommand command = connection.CreateCommand()) + { + command.CommandText = sql; + using (SqlDataReader reader = command.ExecuteReader()) + { + result = new DataTable(); + result.Load(reader); + } + } + } + return result; + } } } diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolTest.cs index 3b1e8192c9..892e0ed360 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolTest.cs @@ -11,8 +11,8 @@ namespace System.Data.SqlClient.ManualTesting.Tests { public static class ConnectionPoolTest { - private static readonly string _tcpConnStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = false }).ConnectionString; - private static readonly string _tcpMarsConnStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = true }).ConnectionString; + private static readonly string _tcpConnStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = false, Pooling = true }).ConnectionString; + private static readonly string _tcpMarsConnStr = (new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr) { MultipleActiveResultSets = true, Pooling = true }).ConnectionString; [CheckConnStrSetupFact] public static void ConnectionPool_NonMars() diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ExceptionTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ExceptionTest.cs index ceb826a089..fedaf7b403 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ExceptionTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ExceptionTest.cs @@ -148,7 +148,9 @@ namespace System.Data.SqlClient.ManualTesting.Tests VerifyConnectionFailure(() => GenerateConnectionException(badBuilder.ConnectionString), errorMessage, (ex) => VerifyException(ex, 1, 18456, 1, 14)); // tests incorrect database name - exception thrown from adapter - badBuilder = new SqlConnectionStringBuilder(builder.ConnectionString) { InitialCatalog = "NotADatabase" }; + // (Forcing Pooling here, so that differing ClientConnectionId's in the exceptions won't make the test fail + // in CheckThatExceptionsAreDistinctButHaveSameData) + badBuilder = new SqlConnectionStringBuilder(builder.ConnectionString) { InitialCatalog = "NotADatabase", Pooling = true }; errorMessage = string.Format(CultureInfo.InvariantCulture, "Cannot open database \"{0}\" requested by the login. The login failed.", badBuilder.InitialCatalog); SqlException firstAttemptException = VerifyConnectionFailure(() => GenerateConnectionException(badBuilder.ConnectionString), errorMessage, (ex) => VerifyException(ex, 2, 4060, 1, 11)); diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs index 4a93bab65b..9df411365c 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs @@ -53,16 +53,5 @@ namespace System.Data.SqlClient.ManualTesting.Tests } } } - - [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)] - [Fact] - public static void LocalDBNotSupportedOnUapTest() - { - SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(@"server=(localdb)\MSSQLLocalDB"); - builder.IntegratedSecurity = true; - builder.ConnectTimeout = 2; - - DataTestUtility.AssertThrowsWrapper(() => OpenConnection(builder.ConnectionString)); - } } } diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/MirroringTest/ConnectionOnMirroringTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/MirroringTest/ConnectionOnMirroringTest.cs new file mode 100644 index 0000000000..ac72f03d1c --- /dev/null +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/MirroringTest/ConnectionOnMirroringTest.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; + +namespace System.Data.SqlClient.ManualTesting.Tests +{ + public static class ConnectionOnMirroringTest + { + private static ManualResetEvent workerCompletedEvent = new ManualResetEvent(false); + + [CheckConnStrSetupFact] + public static void TestMultipleConnectionToMirroredServer() + { + string mirroringStateDesc; + string failoverPartnerName; + bool isMirroring = GetMirroringInfo(DataTestUtility.TcpConnStr, out mirroringStateDesc, out failoverPartnerName); + bool isSynchronized = "SYNCHRONIZED".Equals(mirroringStateDesc, StringComparison.InvariantCultureIgnoreCase); + if (isMirroring && isSynchronized && !string.IsNullOrEmpty(failoverPartnerName)) + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr); + builder.ConnectTimeout = 0; + + TestWorker worker = new TestWorker(builder.ConnectionString); + Thread childThread = new Thread(() => worker.TestMultipleConnection()); + childThread.Start(); + + if (workerCompletedEvent.WaitOne(10000)) + { + childThread.Join(); + } + else + { + // currently Thread.Abort() throws PlatformNotSupportedException in CoreFx. + childThread.Interrupt(); + throw new Exception("SqlConnection could not open and close successfully in timely manner. Possibly connection hangs."); + } + } + } + + private static bool GetMirroringInfo(string connectionString, out string mirroringStateDesc, out string failoverPartnerName) + { + mirroringStateDesc = null; + failoverPartnerName = null; + + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectionString); + string dbname = builder.InitialCatalog; + + builder.ConnectTimeout = 5; + connectionString = builder.ConnectionString; + + DataTable dt = DataTestUtility.RunQuery(connectionString, $"select mirroring_state_desc from sys.database_mirroring where database_id = DB_ID('{dbname}')"); + mirroringStateDesc = dt.Rows[0][0].ToString(); + + bool isMirroring = !string.IsNullOrEmpty(mirroringStateDesc); + if (isMirroring) + { + dt = DataTestUtility.RunQuery(connectionString, $"select mirroring_partner_name from sys.database_mirroring where database_id = DB_ID('{dbname}')"); + failoverPartnerName = dt.Rows[0][0].ToString(); + } + + return isMirroring; + } + + private class TestWorker + { + private string _connectionString; + + public TestWorker(string connectionString) + { + _connectionString = connectionString; + } + + public void TestMultipleConnection() + { + List list = new List(); + + for (int i = 0; i < 10; ++i) + { + SqlConnection conn = new SqlConnection(_connectionString); + list.Add(conn); + conn.Open(); + } + + foreach (SqlConnection conn in list) + { + conn.Dispose(); + } + + workerCompletedEvent.Set(); + } + } + } +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs index 308897b9ca..e711ec1fa0 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/ParametersTest.cs @@ -42,7 +42,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests DataTestUtility.AssertEqualsWithDescription("Parameter2", opc[1].ParameterName, "FAILED: Incorrect ParameterName"); opc.Add(new SqlParameter(null, null)); - opc.Add(new SqlParameter(null, SqlDbType.Int)); + opc.Add(null, SqlDbType.Int, 0, null); DataTestUtility.AssertEqualsWithDescription("Parameter4", opc["Parameter4"].ParameterName, "FAILED: Incorrect ParameterName"); opc.Add(new SqlParameter("Parameter5", SqlDbType.NVarChar, 20)); @@ -97,6 +97,38 @@ namespace System.Data.SqlClient.ManualTesting.Tests DataTestUtility.AssertThrowsWrapper(() => new SqlCommand().Parameters.Remove(new SqlParameter()), "Attempted to remove an SqlParameter that is not contained by this SqlParameterCollection."); } + [CheckConnStrSetupFact] + public static void Test_SqlParameter_Constructor() + { + using (var conn = new SqlConnection(s_connString)) + { + var dataTable = new DataTable(); + var adapter = new SqlDataAdapter(); + + adapter.SelectCommand = new SqlCommand("SELECT CustomerID, ContactTitle FROM dbo.Customers WHERE ContactTitle = @ContactTitle", conn); + var selectParam = new SqlParameter("@ContactTitle", SqlDbType.NVarChar, 30, ParameterDirection.Input, true, 0, 0, "ContactTitle", DataRowVersion.Current, "Owner"); + adapter.SelectCommand.Parameters.Add(selectParam); + + adapter.UpdateCommand = new SqlCommand("UPDATE dbo.Customers SET ContactTitle = @ContactTitle WHERE CustomerID = @CustomerID", conn); + var titleParam = new SqlParameter("@ContactTitle", SqlDbType.NVarChar, 30, ParameterDirection.Input, true, 0, 0, "ContactTitle", DataRowVersion.Current, null); + var idParam = new SqlParameter("@CustomerID", SqlDbType.NChar, 5, ParameterDirection.Input, false, 0, 0, "CustomerID", DataRowVersion.Current, null); + adapter.UpdateCommand.Parameters.Add(titleParam); + adapter.UpdateCommand.Parameters.Add(idParam); + + adapter.Fill(dataTable); + object titleData = dataTable.Rows[0]["ContactTitle"]; + Assert.Equal("Owner", (string)titleData); + + titleData = "Test Data"; + adapter.Update(dataTable); + adapter.Fill(dataTable); + Assert.Equal("Test Data", (string)titleData); + + titleData = "Owner"; + adapter.Update(dataTable); + } + } + [CheckConnStrSetupFact] public static void Test_WithEnumValue_ShouldInferToUnderlyingType() { diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/AdjustPrecScaleForBulkCopy.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/AdjustPrecScaleForBulkCopy.cs new file mode 100644 index 0000000000..c4aa0b7cb2 --- /dev/null +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/SqlBulkCopyTest/AdjustPrecScaleForBulkCopy.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Data.SqlTypes; +using Xunit; + +namespace System.Data.SqlClient.ManualTesting.Tests +{ + public static class AdjustPrecScaleForBulkCopy + { + [CheckConnStrSetupFact] + public static void RunTest() + { + SqlDecimal value = BulkCopySqlDecimalToTable(new SqlDecimal(0), 1, 0, 2, 2); + Assert.Equal("0.00", value.ToString()); + + value = BulkCopySqlDecimalToTable(new SqlDecimal(10.0), 10, 1, 4, 2); + Assert.Equal("10.00", value.ToString()); + + value = BulkCopySqlDecimalToTable(new SqlDecimal(10.00), 7, 2, 2, 0); + Assert.Equal("10", value.ToString()); + + value = BulkCopySqlDecimalToTable(new SqlDecimal(12.345), 5, 3, 3, 1); + Assert.Equal("12.3", value.ToString()); + + value = BulkCopySqlDecimalToTable(new SqlDecimal(123.45), 10, 2, 4, 1); + Assert.Equal("123.4", value.ToString()); + + Assert.Throws(() => BulkCopySqlDecimalToTable(new SqlDecimal(111.00), 7, 2, 2, 0)); + } + + private static SqlDecimal BulkCopySqlDecimalToTable(SqlDecimal decimalValue, int sourcePrecision, int sourceScale, int targetPrecision, int targetScale) + { + string tableName = DataTestUtility.GenerateTableName(); + string connectionString = DataTestUtility.TcpConnStr; + + SqlDecimal resultValue; + try + { + DataTestUtility.RunNonQuery(connectionString, $"create table {tableName} (target_column decimal({targetPrecision}, {targetScale}))"); + + SqlDecimal inputValue = SqlDecimal.ConvertToPrecScale(decimalValue, sourcePrecision, sourceScale); + + DataTable dt = new DataTable(); + dt.Clear(); + dt.Columns.Add("source_column", typeof(SqlDecimal)); + DataRow row = dt.NewRow(); + row["source_column"] = inputValue; + dt.Rows.Add(row); + + using (SqlBulkCopy sbc = new SqlBulkCopy(connectionString, SqlBulkCopyOptions.KeepIdentity)) + { + sbc.DestinationTableName = tableName; + sbc.ColumnMappings.Add("source_column", "target_column"); + sbc.WriteToServer(dt); + } + + DataTable resultTable = DataTestUtility.RunQuery(connectionString, $"select * from {tableName}"); + resultValue = new SqlDecimal((Decimal)resultTable.Rows[0][0]); + } + finally + { + DataTestUtility.RunNonQuery(connectionString, $"drop table {tableName}"); + } + + return resultValue; + } + } +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs index ac749a5c8e..f442024e68 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionEnlistmentTest.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; using System.Transactions; using Xunit; @@ -11,114 +10,196 @@ namespace System.Data.SqlClient.ManualTesting.Tests public class TransactionEnlistmentTest { [CheckConnStrSetupFact] - public static void TestAmbientTransaction_TxScopeComplete() + public static void TestAutoEnlistment_TxScopeComplete() { - const int inputCol1 = 1; - const string inputCol2 = "one"; - - SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr); - string connectionString = builder.ConnectionString; - string testTableName = GenerateTableName(); - - RunNonQuery(connectionString, $"create table {testTableName} (col1 int, col2 text)"); - - try - { - using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue)) - { - using (SqlConnection connection = new SqlConnection(connectionString)) - { - connection.Open(); - using (SqlCommand command = connection.CreateCommand()) - { - command.CommandText = $"INSERT INTO {testTableName} VALUES ({inputCol1}, '{inputCol2}')"; - command.ExecuteNonQuery(); - } - } - txScope.Complete(); - } - - DataTable result = RunQuery(connectionString, $"select col2 from {testTableName} where col1 = {inputCol1}"); - Assert.True(result.Rows.Count > 0); - Assert.True(string.Equals(result.Rows[0][0], inputCol2)); - } - finally - { - RunNonQuery(connectionString, $"drop table {testTableName}"); - } + RunTestSet(TestCase_AutoEnlistment_TxScopeComplete); } [CheckConnStrSetupFact] - public static void TestAmbientTransaction_TxScopeNonComplete() + public static void TestAutoEnlistment_TxScopeNonComplete() { - const int inputCol1 = 2; - const string inputCol2 = "two"; + RunTestSet(TestCase_AutoEnlistment_TxScopeNonComplete); + } - SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr); - string connectionString = builder.ConnectionString; - string testTableName = GenerateTableName(); + [CheckConnStrSetupFact] + public static void TestManualEnlistment_Enlist() + { + RunTestSet(TestCase_ManualEnlistment_Enlist); + } - RunNonQuery(connectionString, $"create table {testTableName} (col1 int, col2 text)"); + [CheckConnStrSetupFact] + public static void TestManualEnlistment_NonEnlist() + { + RunTestSet(TestCase_ManualEnlistment_NonEnlist); + } - try + [CheckConnStrSetupFact] + public static void TestManualEnlistment_Enlist_TxScopeComplete() + { + RunTestSet(TestCase_ManualEnlistment_Enlist_TxScopeComplete); + } + + + + + private static void TestCase_AutoEnlistment_TxScopeComplete() + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(ConnectionString); + builder.Enlist = true; + ConnectionString = builder.ConnectionString; + + using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue)) { - using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue)) + using (SqlConnection connection = new SqlConnection(ConnectionString)) { - using (SqlConnection connection = new SqlConnection(connectionString)) + connection.Open(); + using (SqlCommand command = connection.CreateCommand()) { - connection.Open(); - using (SqlCommand command = connection.CreateCommand()) - { - command.CommandText = $"INSERT INTO {testTableName} VALUES ({inputCol1}, '{inputCol2}')"; - command.ExecuteNonQuery(); - } + command.CommandText = $"INSERT INTO {TestTableName} VALUES ({InputCol1}, '{InputCol2}')"; + command.ExecuteNonQuery(); } } + txScope.Complete(); + } - DataTable result = RunQuery(connectionString, $"select col2 from {testTableName} where col1 = {inputCol1}"); - Assert.True(result.Rows.Count == 0); + DataTable result = DataTestUtility.RunQuery(ConnectionString, $"select col2 from {TestTableName} where col1 = {InputCol1}"); + Assert.True(result.Rows.Count == 1); + Assert.True(string.Equals(result.Rows[0][0], InputCol2)); + } + + private static void TestCase_AutoEnlistment_TxScopeNonComplete() + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(ConnectionString); + builder.Enlist = true; + ConnectionString = builder.ConnectionString; + + using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue)) + { + using (SqlConnection connection = new SqlConnection(ConnectionString)) + { + connection.Open(); + using (SqlCommand command = connection.CreateCommand()) + { + command.CommandText = $"INSERT INTO {TestTableName} VALUES ({InputCol1}, '{InputCol2}')"; + command.ExecuteNonQuery(); + } + } + } + + DataTable result = DataTestUtility.RunQuery(ConnectionString, $"select col2 from {TestTableName} where col1 = {InputCol1}"); + Assert.True(result.Rows.Count == 0); + } + + private static void TestCase_ManualEnlistment_Enlist() + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(ConnectionString); + builder.Enlist = false; + ConnectionString = builder.ConnectionString; + + using (SqlConnection connection = new SqlConnection(ConnectionString)) + { + connection.Open(); + using (TransactionScope txScope = new TransactionScope()) + { + connection.EnlistTransaction(Transactions.Transaction.Current); + using (SqlCommand command = connection.CreateCommand()) + { + command.CommandText = $"INSERT INTO {TestTableName} VALUES ({InputCol1}, '{InputCol2}')"; + command.ExecuteNonQuery(); + } + } + } + + DataTable result = DataTestUtility.RunQuery(ConnectionString, $"select col2 from {TestTableName} where col1 = {InputCol1}"); + Assert.True(result.Rows.Count == 0); + } + + private static void TestCase_ManualEnlistment_NonEnlist() + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(ConnectionString); + builder.Enlist = false; + ConnectionString = builder.ConnectionString; + + using (SqlConnection connection = new SqlConnection(ConnectionString)) + { + connection.Open(); + using (TransactionScope txScope = new TransactionScope()) + { + using (SqlCommand command = connection.CreateCommand()) + { + command.CommandText = $"INSERT INTO {TestTableName} VALUES ({InputCol1}, '{InputCol2}')"; + command.ExecuteNonQuery(); + } + } + } + + DataTable result = DataTestUtility.RunQuery(ConnectionString, $"select col2 from {TestTableName} where col1 = {InputCol1}"); + Assert.True(result.Rows.Count == 1); + Assert.True(string.Equals(result.Rows[0][0], InputCol2)); + } + + private static void TestCase_ManualEnlistment_Enlist_TxScopeComplete() + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(ConnectionString); + builder.Enlist = false; + ConnectionString = builder.ConnectionString; + + using (SqlConnection connection = new SqlConnection(ConnectionString)) + { + connection.Open(); + using (TransactionScope txScope = new TransactionScope()) + { + connection.EnlistTransaction(Transactions.Transaction.Current); + using (SqlCommand command = connection.CreateCommand()) + { + command.CommandText = $"INSERT INTO {TestTableName} VALUES ({InputCol1}, '{InputCol2}')"; + command.ExecuteNonQuery(); + } + txScope.Complete(); + } + } + + DataTable result = DataTestUtility.RunQuery(ConnectionString, $"select col2 from {TestTableName} where col1 = {InputCol1}"); + Assert.True(result.Rows.Count == 1); + Assert.True(string.Equals(result.Rows[0][0], InputCol2)); + } + + + + + private static string TestTableName; + private static string ConnectionString; + private const int InputCol1 = 1; + private const string InputCol2 = "One"; + + private static void RunTestSet(Action TestCase) + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TcpConnStr); + builder.ConnectTimeout = 5; + + builder.Pooling = true; + ConnectionString = builder.ConnectionString; + + RunTestFormat(TestCase); + + builder.Pooling = false; + ConnectionString = builder.ConnectionString; + + RunTestFormat(TestCase); + } + + private static void RunTestFormat(Action testCase) + { + TestTableName = DataTestUtility.GenerateTableName(); + DataTestUtility.RunNonQuery(ConnectionString, $"create table {TestTableName} (col1 int, col2 text)"); + try + { + testCase(); } finally { - RunNonQuery(connectionString, $"drop table {testTableName}"); + DataTestUtility.RunNonQuery(ConnectionString, $"drop table {TestTableName}"); } } - - private static void RunNonQuery(string connectionString, string sql) - { - using (SqlConnection connection = new SqlConnection(connectionString)) - { - connection.Open(); - using (SqlCommand command = connection.CreateCommand()) - { - command.CommandText = sql; - command.ExecuteNonQuery(); - } - } - } - - private static DataTable RunQuery(string connectionString, string sql) - { - DataTable result = null; - using (SqlConnection connection = new SqlConnection(connectionString)) - { - connection.Open(); - using (SqlCommand command = connection.CreateCommand()) - { - command.CommandText = sql; - using (SqlDataReader reader = command.ExecuteReader()) - { - result = new DataTable(); - result.Load(reader); - } - } - } - return result; - } - - private static string GenerateTableName() - { - return string.Format("TEST_{0}{1}{2}", Environment.GetEnvironmentVariable("ComputerName"), Environment.TickCount, Guid.NewGuid()).Replace('-', '_'); - } } } diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs index 00c71a5397..e8090510c3 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/TransactionTest/TransactionTest.cs @@ -232,14 +232,13 @@ namespace System.Data.SqlClient.ManualTesting.Tests string executeCommandWithoutTransactionMessage = SystemDataResourceManager.Instance.ADP_TransactionRequired("ExecuteNonQuery"); string transactionConflictErrorMessage = SystemDataResourceManager.Instance.ADP_TransactionConnectionMismatch; string parallelTransactionErrorMessage = SystemDataResourceManager.Instance.ADP_ParallelTransactionsNotSupported("SqlConnection"); - - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { SqlCommand command = new SqlCommand("sql", connection); command.ExecuteNonQuery(); }, executeCommandWithoutTransactionMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { SqlConnection con1 = new SqlConnection(_connectionString); con1.Open(); @@ -249,44 +248,38 @@ namespace System.Data.SqlClient.ManualTesting.Tests command.ExecuteNonQuery(); }, transactionConflictErrorMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { connection.BeginTransaction(null); }, parallelTransactionErrorMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { connection.BeginTransaction(""); }, parallelTransactionErrorMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { tx.Rollback(null); }, invalidSaveStateMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { tx.Rollback(""); }, invalidSaveStateMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { tx.Save(null); }, invalidSaveStateMessage); - AssertException(() => + DataTestUtility.AssertThrowsWrapper(() => { tx.Save(""); }, invalidSaveStateMessage); } } - public static void AssertException(Action action, string expectedErrorMessage) where T : Exception - { - var exception = Assert.Throws(action); - Assert.Equal(exception.Message, expectedErrorMessage); - } - private void ReadUncommitedIsolationLevel_ShouldReturnUncommitedData() { using (SqlConnection connection1 = new SqlConnection(_connectionString)) @@ -350,7 +343,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests SqlTransaction tx2 = connection2.BeginTransaction(IsolationLevel.ReadCommitted); command2.Transaction = tx2; - AssertException(() => command2.ExecuteReader(), SystemDataResourceManager.Instance.SQL_Timeout as string); + DataTestUtility.AssertThrowsWrapper(() => command2.ExecuteReader(), SystemDataResourceManager.Instance.SQL_Timeout as string); tx2.Rollback(); connection2.Close(); diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs new file mode 100644 index 0000000000..7a6722bd25 --- /dev/null +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest.cs @@ -0,0 +1,359 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data.Common; +using System.Data.SqlTypes; +using System.IO; +using System.Linq; +using System.Text; +using Xunit; + +namespace System.Data.SqlClient.ManualTesting.Tests +{ + public static class UdtTest + { + [CheckConnStrSetupFact] + public static void GetSchemaTableTest() + { + using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr)) + using (SqlCommand cmd = new SqlCommand("select hierarchyid::Parse('/1/') as col0", conn)) + { + conn.Open(); + using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo)) + { + DataTable schemaTable = reader.GetSchemaTable(); + DataTestUtility.AssertEqualsWithDescription(1, schemaTable.Rows.Count, "Unexpected schema table row count."); + + string columnName = (string)(string)schemaTable.Rows[0][schemaTable.Columns["ColumnName"]]; + DataTestUtility.AssertEqualsWithDescription("col0", columnName, "Unexpected column name."); + + string dataTypeName = (string)schemaTable.Rows[0][schemaTable.Columns["DataTypeName"]]; + DataTestUtility.AssertEqualsWithDescription("Northwind.sys.hierarchyid", dataTypeName, "Unexpected data type name."); + + string udtAssemblyName = (string)schemaTable.Rows[0][schemaTable.Columns["UdtAssemblyQualifiedName"]]; + Assert.True(udtAssemblyName?.StartsWith("Microsoft.SqlServer.Types.SqlHierarchyId"), "Unexpected UDT assembly name: " + udtAssemblyName); + } + } + } + + [CheckConnStrSetupFact] + public static void GetValueTest() + { + using (SqlConnection conn = new SqlConnection(DataTestUtility.TcpConnStr)) + using (SqlCommand cmd = new SqlCommand("select hierarchyid::Parse('/1/') as col0", conn)) + { + conn.Open(); + using (SqlDataReader reader = cmd.ExecuteReader()) + { + Assert.True(reader.Read()); + + Assert.Throws(() => reader.GetValue(0)); + + Assert.Throws(() => reader.GetSqlValue(0)); + } + } + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlParameterThrowsPlatformNotSupportedException() + { + using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) + { + connection.Open(); + SqlCommand command = connection.CreateCommand(); + + // This command is not executed on the server since we should throw well before we send the query + command.CommandText = "select @p as col0"; + + command.Parameters.Add(new SqlParameter + { + ParameterName = "@p", + SqlDbType = SqlDbType.Udt, + Direction = ParameterDirection.Input, + }); + + Assert.Throws(() => + { + command.ExecuteReader(); + }); + + command.Parameters.Clear(); + command.Parameters.Add(new SqlParameter + { + ParameterName = "@p", + SqlDbType = SqlDbType.Udt, + Direction = ParameterDirection.InputOutput, + }); + + Assert.Throws(() => + { + command.ExecuteReader(); + }); + + command.Parameters.Clear(); + command.Parameters.Add(new SqlParameter + { + ParameterName = "@p", + SqlDbType = SqlDbType.Udt, + Direction = ParameterDirection.Output, + }); + + Assert.Throws(() => + { + command.ExecuteReader(); + }); + } + } + + [CheckConnStrSetupFact] + public static void TestUdtZeroByte() + { + using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) + { + connection.Open(); + SqlCommand command = connection.CreateCommand(); + command.CommandText = "select hierarchyid::Parse('/') as col0"; + using (SqlDataReader reader = command.ExecuteReader()) + { + Assert.True(reader.Read()); + Assert.False(reader.IsDBNull(0)); + SqlBytes sqlBytes = reader.GetSqlBytes(0); + Assert.False(sqlBytes.IsNull, "Expected a zero length byte array"); + Assert.True(sqlBytes.Length == 0, "Expected a zero length byte array"); + } + } + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlDataReaderGetSqlBytesSequentialAccess() + { + TestUdtSqlDataReaderGetSqlBytes(CommandBehavior.SequentialAccess); + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlDataReaderGetSqlBytes() + { + TestUdtSqlDataReaderGetSqlBytes(CommandBehavior.Default); + } + + private static void TestUdtSqlDataReaderGetSqlBytes(CommandBehavior behavior) + { + using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) + { + connection.Open(); + SqlCommand command = connection.CreateCommand(); + command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; + using (SqlDataReader reader = command.ExecuteReader(behavior)) + { + Assert.True(reader.Read()); + + SqlBytes sqlBytes = null; + + sqlBytes = reader.GetSqlBytes(0); + Assert.Equal("5ade", ToHexString(sqlBytes.Value)); + + sqlBytes = reader.GetSqlBytes(1); + Assert.Equal("0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000ffffffff0000000002", ToHexString(sqlBytes.Value)); + + sqlBytes = reader.GetSqlBytes(2); + Assert.Equal("e610000001148716d9cef7d34740d7a3703d0a975ec08716d9cef7d34740cba145b6f3955ec0", ToHexString(sqlBytes.Value)); + + if (behavior == CommandBehavior.Default) + { + sqlBytes = reader.GetSqlBytes(0); + Assert.Equal("5ade", ToHexString(sqlBytes.Value)); + } + } + } + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlDataReaderGetBytesSequentialAccess() + { + TestUdtSqlDataReaderGetBytes(CommandBehavior.SequentialAccess); + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlDataReaderGetBytes() + { + TestUdtSqlDataReaderGetBytes(CommandBehavior.Default); + } + + private static void TestUdtSqlDataReaderGetBytes(CommandBehavior behavior) + { + using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) + { + connection.Open(); + SqlCommand command = connection.CreateCommand(); + command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; + using (SqlDataReader reader = command.ExecuteReader(behavior)) + { + Assert.True(reader.Read()); + + int byteCount = 0; + byte[] bytes = null; + + byteCount = (int)reader.GetBytes(0, 0, null, 0, 0); + Assert.True(byteCount > 0); + bytes = new byte[byteCount]; + reader.GetBytes(0, 0, bytes, 0, bytes.Length); + Assert.Equal("5ade", ToHexString(bytes)); + + byteCount = (int)reader.GetBytes(1, 0, null, 0, 0); + Assert.True(byteCount > 0); + bytes = new byte[byteCount]; + reader.GetBytes(1, 0, bytes, 0, bytes.Length); + Assert.Equal("0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000ffffffff0000000002", ToHexString(bytes)); + + byteCount = (int)reader.GetBytes(2, 0, null, 0, 0); + Assert.True(byteCount > 0); + bytes = new byte[byteCount]; + reader.GetBytes(2, 0, bytes, 0, bytes.Length); + Assert.Equal("e610000001148716d9cef7d34740d7a3703d0a975ec08716d9cef7d34740cba145b6f3955ec0", ToHexString(bytes)); + + if (behavior == CommandBehavior.Default) + { + byteCount = (int)reader.GetBytes(0, 0, null, 0, 0); + Assert.True(byteCount > 0); + bytes = new byte[byteCount]; + reader.GetBytes(0, 0, bytes, 0, bytes.Length); + Assert.Equal("5ade", ToHexString(bytes)); + } + } + } + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlDataReaderGetStreamSequentialAccess() + { + TestUdtSqlDataReaderGetStream(CommandBehavior.SequentialAccess); + } + + [CheckConnStrSetupFact] + public static void TestUdtSqlDataReaderGetStream() + { + TestUdtSqlDataReaderGetStream(CommandBehavior.Default); + } + + private static void TestUdtSqlDataReaderGetStream(CommandBehavior behavior) + { + using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) + { + connection.Open(); + SqlCommand command = connection.CreateCommand(); + command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; + using (SqlDataReader reader = command.ExecuteReader(behavior)) + { + Assert.True(reader.Read()); + + MemoryStream buffer = null; + byte[] bytes = null; + + buffer = new MemoryStream(); + using (Stream stream = reader.GetStream(0)) + { + stream.CopyTo(buffer); + } + bytes = buffer.ToArray(); + Assert.Equal("5ade", ToHexString(bytes)); + + buffer = new MemoryStream(); + using (Stream stream = reader.GetStream(1)) + { + stream.CopyTo(buffer); + } + bytes = buffer.ToArray(); + Assert.Equal("0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000ffffffff0000000002", ToHexString(bytes)); + + buffer = new MemoryStream(); + using (Stream stream = reader.GetStream(2)) + { + stream.CopyTo(buffer); + } + bytes = buffer.ToArray(); + Assert.Equal("e610000001148716d9cef7d34740d7a3703d0a975ec08716d9cef7d34740cba145b6f3955ec0", ToHexString(bytes)); + + if (behavior == CommandBehavior.Default) + { + buffer = new MemoryStream(); + using (Stream stream = reader.GetStream(0)) + { + stream.CopyTo(buffer); + } + bytes = buffer.ToArray(); + Assert.Equal("5ade", ToHexString(bytes)); + } + } + } + } + + [CheckConnStrSetupFact] + public static void TestUdtSchemaMetadata() + { + using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr)) + { + connection.Open(); + SqlCommand command = connection.CreateCommand(); + command.CommandText = "select hierarchyid::Parse('/1/1/3/') as col0, geometry::Parse('LINESTRING (100 100, 20 180, 180 180)') as col1, geography::Parse('LINESTRING(-122.360 47.656, -122.343 47.656)') as col2"; + using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.SchemaOnly)) + { + ReadOnlyCollection columns = reader.GetColumnSchema(); + + DbColumn column = null; + + // Validate Microsoft.SqlServer.Types.SqlHierarchyId, Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 + column = columns[0]; + Assert.Equal(column.ColumnName, "col0"); + Assert.Equal(typeof(byte[]), column.DataType); + Assert.NotNull(column.UdtAssemblyQualifiedName); + AssertSqlUdtAssemblyQualifiedName(column.UdtAssemblyQualifiedName, "Microsoft.SqlServer.Types.SqlHierarchyId"); + + // Validate Microsoft.SqlServer.Types.SqlGeometry, Microsoft.SqlServer.Types, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91 + column = columns[1]; + Assert.Equal(column.ColumnName, "col1"); + Assert.Equal(typeof(byte[]), column.DataType); + Assert.NotNull(column.UdtAssemblyQualifiedName); + AssertSqlUdtAssemblyQualifiedName(column.UdtAssemblyQualifiedName, "Microsoft.SqlServer.Types.SqlGeometry"); + + // Validate Microsoft.SqlServer.Types.SqlGeography, Microsoft.SqlServer.Types, Version = 11.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91 + column = columns[2]; + Assert.Equal(column.ColumnName, "col2"); + Assert.Equal(typeof(byte[]), column.DataType); + Assert.NotNull(column.UdtAssemblyQualifiedName); + AssertSqlUdtAssemblyQualifiedName(column.UdtAssemblyQualifiedName, "Microsoft.SqlServer.Types.SqlGeography"); + } + } + } + + private static void AssertSqlUdtAssemblyQualifiedName(string assemblyQualifiedName, string expectedType) + { + List parts = assemblyQualifiedName.Split(',').Select(x => x.Trim()).ToList(); + + string type = parts[0]; + string assembly = parts.Count < 2 ? string.Empty : parts[1]; + string version = parts.Count < 3 ? string.Empty : parts[2]; + string culture = parts.Count < 4 ? string.Empty : parts[3]; + string token = parts.Count < 5 ? string.Empty : parts[4]; + + Assert.Equal(expectedType, type); + Assert.Equal("Microsoft.SqlServer.Types", assembly); + Assert.True(version.StartsWith("Version")); + Assert.True(culture.StartsWith("Culture")); + Assert.True(token.StartsWith("PublicKeyToken")); + } + + private static string ToHexString(byte[] bytes) + { + StringBuilder hex = new StringBuilder(bytes.Length * 2); + foreach (byte b in bytes) + { + hex.AppendFormat("{0:x2}", b); + } + + return hex.ToString(); + } + } +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj index 876fb51ec5..7a0e541915 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj +++ b/external/corefx/src/System.Data.SqlClient/tests/ManualTests/System.Data.SqlClient.ManualTesting.Tests.csproj @@ -56,8 +56,10 @@ + + @@ -109,6 +111,7 @@ + diff --git a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/HostsFileManager.cs b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/HostsFileManager.cs index 021ed1b77f..ec0d258efe 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/HostsFileManager.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/HostsFileManager.cs @@ -25,7 +25,7 @@ namespace Microsoft.Test.Data.SqlClient /// using (var hostsFile = new HostsFileManager()) /// { /// // use the hostsFile methods to add/remove entries - /// // simultanious usage of HostsFileManager in two app domains or processes on the same machine is not allowed + /// // simultaneous usage of HostsFileManager in two app domains or processes on the same machine is not allowed /// } /// public sealed class HostsFileManager : IDisposable diff --git a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/SqlClientTestGroup.cs b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/SqlClientTestGroup.cs index 1425daa5ca..a3775a02af 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/SqlClientTestGroup.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.SqlClient.Stress.Tests/SqlClientTestGroup.cs @@ -38,8 +38,8 @@ namespace Stress.Data.SqlClient /// This significantly increases the probability of hitting some bugs, such as: /// vstfdevdiv 674236 (SqlConnection.Open() throws InvalidOperationException for absolutely valid connection request) /// sqlbuvsts 328845 (InvalidOperationException: The requested operation cannot be completed because the connection has been broken.) (this is LSE QFE) - /// However, calling ClearAllPools all the time might also significantly decrease te probability of hitting some other bug, - /// so this thread will alternate between hammering on ClearAllPools for several minutes, and then doing nother for several minutes. + /// However, calling ClearAllPools all the time might also significantly decrease the probability of hitting some other bug, + /// so this thread will alternate between hammering on ClearAllPools for several minutes, and then doing nothing for several minutes. /// private static Thread s_clearAllPoolsThread; @@ -196,7 +196,7 @@ namespace Stress.Data.SqlClient /// The Sql Command to Execute /// Indicates if data is being queried and where ExecuteQuery or Non-query to be used with the reader /// Indicates if the query should be executed as an Xml - /// Indicates if command was cancelled and is used to throw exception if a Command cancelation related exception is encountered + /// Indicates if command was cancelled and is used to throw exception if a Command cancellation related exception is encountered /// The Cancellation Token Source private void SqlCommandEndExecute(Random rnd, IAsyncResult result, SqlCommand com, bool query, bool xml, bool cancelled, CancellationTokenSource cts = null) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs index 2a341ecd63..bf20276c98 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressErrors.cs @@ -140,7 +140,7 @@ namespace Stress.Data } /// - /// Reports that a fatal error has happened. This is a error that completely prevents the test from continuing, + /// Reports that a fatal error has happened. This is an error that completely prevents the test from continuing, /// for example a setup failure. Ordinary programming errors should not be handled by this method. /// /// A description of the error @@ -213,4 +213,4 @@ namespace Stress.Data } #endregion } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs index 2da8be788f..818e3893ac 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/StressTests/System.Data.StressFramework/DataStressFactory.cs @@ -81,9 +81,6 @@ namespace Stress.Data private set; } - - private Timer _currentPoolingStressModeTimer; - #endregion diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/FederatedAuthentication/Rps.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/FederatedAuthentication/Rps.cs index 21a1c2070e..d1f70c5e8e 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/FederatedAuthentication/Rps.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/FederatedAuthentication/Rps.cs @@ -14,7 +14,7 @@ namespace Microsoft.SqlServer.TDS.EndPoint.FederatedAuthentication internal class RPS { /// - /// Instance of the dynamially loaded RPS assembly from Microsoft.Passport.RPS + /// Instance of the dynamically loaded RPS assembly from Microsoft.Passport.RPS /// private Assembly _rpsAssembly = null; diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClient.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClient.cs index 127d84fd00..413076a6aa 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClient.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClient.cs @@ -33,26 +33,26 @@ namespace Microsoft.SqlServer.TDS.EndPoint /// /// It is called when pre-login response arrives /// - /// TDS message recieved + /// TDS message received /// TDS message to send to the server TDSMessage OnPreLoginResponse(TDSMessage message); /// /// It is called when SPNEGO response arrives /// - /// TDS message recieved + /// TDS message received TDSMessage OnSSPIResponse(TDSMessage message); /// /// It is called when FedAuthInfoToken response arrives /// - /// TDS message recieved + /// TDS message received TDSMessage OnFedAuthInfoTokenResponse(TDSMessage message); /// /// It is called when login acknowledgement arrives. /// - /// TDS message recieved + /// TDS message received void OnLoginResponse(TDSMessage message); /// diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClientContext.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClientContext.cs index 9c357e284e..6ec9f83372 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClientContext.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSClientContext.cs @@ -85,7 +85,7 @@ namespace Microsoft.SqlServer.TDS.EndPoint string Query { get; set; } /// - /// Respose to the query + /// Response to the query /// IList QueryResponse { get; set; } diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSServerSession.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSServerSession.cs index ad1d9ab5c3..ca2373f1f5 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSServerSession.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/ITDSServerSession.cs @@ -55,7 +55,7 @@ namespace Microsoft.SqlServer.TDS.EndPoint TDSEndPointInfo ServerEndPointInfo { get; set; } /// - /// Remote connectionend-point information + /// Remote connection end-point information /// TDSEndPointInfo ClientEndPointInfo { get; set; } diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SSPIResponse.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SSPIResponse.cs index 313ad14663..2f91619e50 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SSPIResponse.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SSPIResponse.cs @@ -10,7 +10,7 @@ namespace Microsoft.SqlServer.TDS.EndPoint.SSPI public class SSPIResponse { /// - /// Payload to proceed to the next step of authentcation + /// Payload to proceed to the next step of authentication /// public byte[] Payload { get; set; } diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecConstants.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecConstants.cs index bf2103f44c..a8080da438 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecConstants.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecConstants.cs @@ -5,12 +5,12 @@ namespace Microsoft.SqlServer.TDS.EndPoint.SSPI { /// - /// Constants that are used accros security API + /// Constants that are used across security API /// internal static class SecConstants { /// - /// Security packages used for SSPI authenication + /// Security packages used for SSPI authentication /// internal const string Negotiate = "negotiate"; internal const string Kerberos = "kerberos"; diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServer.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServer.cs index 170b22703e..fb9724377b 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServer.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServer.cs @@ -523,7 +523,7 @@ namespace Microsoft.SqlServer.TDS.Servers // Update session packet size session.PacketSize = (uint)Arguments.PacketSize; - // Create login acknowledgnment packet + // Create login acknowledgement packet TDSLoginAckToken loginResponseToken = new TDSLoginAckToken(Arguments.ServerVersion, session.TDSVersion, TDSLogin7TypeFlagsSQL.SQL, "Microsoft SQL Server"); // Otherwise SNAC yields E_FAIL // Log response diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServerSession.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServerSession.cs index 8741167531..5cf92bd5b0 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServerSession.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/GenericTDSServerSession.cs @@ -65,7 +65,7 @@ namespace Microsoft.SqlServer.TDS.Servers public TDSEndPointInfo ServerEndPointInfo { get; set; } /// - /// Remote connectionend-point information + /// Remote connection end-point information /// public TDSEndPointInfo ClientEndPointInfo { get; set; } @@ -398,7 +398,7 @@ namespace Microsoft.SqlServer.TDS.Servers } /// - /// Indlate recovery data + /// Inflate recovery data /// private void _InflateRecoveryData(TDSSessionRecoveryData data) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/QueryEngine.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/QueryEngine.cs index 28f23c862f..f2066ff8bc 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/QueryEngine.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/QueryEngine.cs @@ -1481,7 +1481,7 @@ namespace Microsoft.SqlServer.TDS.Servers } /// - /// Prepare response for arithmethic abort + /// Prepare response for arithmetic abort /// private TDSMessage _PrepareArithAbortResponse(ITDSServerSession session) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckGenericOption.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckGenericOption.cs index f4b7b77dd0..5613031fb0 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckGenericOption.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckGenericOption.cs @@ -103,7 +103,7 @@ namespace Microsoft.SqlServer.TDS.FeatureExtAck } /// - /// Delate the token. + /// Deflate the token. /// /// Stream the token to deflate to. public override void Deflate(Stream destination) diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckToken.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckToken.cs index 5e5702176b..c0816b9032 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckToken.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/TDSFeatureExtAckToken.cs @@ -13,7 +13,7 @@ namespace Microsoft.SqlServer.TDS.FeatureExtAck public class TDSFeatureExtAckToken : TDSPacketToken { /// - /// Collection of feature extension acknoeldged options + /// Collection of feature extension acknowledged options /// public IList Options { get; set; } @@ -117,4 +117,4 @@ namespace Microsoft.SqlServer.TDS.FeatureExtAck destination.WriteByte((byte)TDSFeatureID.Terminator); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSPN.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSPN.cs index 7eccbe7859..fe63bface5 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSPN.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSPN.cs @@ -57,7 +57,7 @@ namespace Microsoft.SqlServer.TDS.Authentication } /// - /// Default public contructor + /// Default public constructor /// public TDSFedAuthInfoOptionSPN() { @@ -113,4 +113,4 @@ namespace Microsoft.SqlServer.TDS.Authentication } } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSTSURL.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSTSURL.cs index c7a7632de4..c274dd5e45 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSTSURL.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/TDSFedAuthInfoOptionSTSURL.cs @@ -57,7 +57,7 @@ namespace Microsoft.SqlServer.TDS.Authentication } /// - /// Default public contructor + /// Default public constructor /// public TDSFedAuthInfoOptionSTSURL() { @@ -111,4 +111,4 @@ namespace Microsoft.SqlServer.TDS.Authentication } } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/LanguageString.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/LanguageString.cs index 164e368b41..a96751c9ee 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/LanguageString.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/LanguageString.cs @@ -7,7 +7,7 @@ using System; namespace Microsoft.SqlServer.TDS { /// - /// Class that contains langauge names and can convert between enumeration and strings + /// Class that contains language names and can convert between enumeration and strings /// public static class LanguageString { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7FeatureOptionToken.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7FeatureOptionToken.cs index a6b553c57d..5ac7066a57 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7FeatureOptionToken.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7FeatureOptionToken.cs @@ -31,7 +31,7 @@ namespace Microsoft.SqlServer.TDS.Login7 public abstract bool Inflate(Stream source); /// - /// Delate the token + /// Deflate the token /// public abstract void Deflate(Stream destination); } diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags1.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags1.cs index 2b60b28343..8ae594a44c 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags1.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags1.cs @@ -116,7 +116,7 @@ namespace Microsoft.SqlServer.TDS.Login7 } /// - /// Initialization construcgtor + /// Initialization constructor /// public TDSLogin7TokenOptionalFlags1(byte flags) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags2.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags2.cs index 3b1cbba76a..f15fa8ac9b 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags2.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags2.cs @@ -75,7 +75,7 @@ namespace Microsoft.SqlServer.TDS.Login7 } /// - /// Initialization construcgtor + /// Initialization constructor /// public TDSLogin7TokenOptionalFlags2(byte flags) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags3.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags3.cs index 82aa3569f4..7c5010a0e0 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags3.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenOptionalFlags3.cs @@ -60,7 +60,7 @@ namespace Microsoft.SqlServer.TDS.Login7 } /// - /// Initialization construcgtor + /// Initialization constructor /// public TDSLogin7TokenOptionalFlags3(byte flags) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenTypeFlags.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenTypeFlags.cs index d1c19d5da2..eb1921f1ae 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenTypeFlags.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/TDSLogin7TokenTypeFlags.cs @@ -60,7 +60,7 @@ namespace Microsoft.SqlServer.TDS.Login7 } /// - /// Initialization construcgtor + /// Initialization constructor /// public TDSLogin7TokenTypeFlags(byte flags) { diff --git a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SessionState/TDSSessionStateOption.cs b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SessionState/TDSSessionStateOption.cs index 2babcbbdf2..00e78b29d4 100644 --- a/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SessionState/TDSSessionStateOption.cs +++ b/external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SessionState/TDSSessionStateOption.cs @@ -12,7 +12,7 @@ namespace Microsoft.SqlServer.TDS.SessionState public abstract class TDSSessionStateOption : IDeflatable, IInflatable { /// - /// Property that tells the caller how much of the data from the stream was read by infation logic + /// Property that tells the caller how much of the data from the stream was read by inflation logic /// internal uint InflationSize { get; set; } diff --git a/external/corefx/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj b/external/corefx/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj index e456d1d099..22b300ac03 100644 --- a/external/corefx/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.Contracts/tests/System.Diagnostics.Contracts.Tests.csproj @@ -14,9 +14,6 @@ - - Common\System\PlatformDetection.cs - Common\System\ShouldNotBeInvokedException.cs diff --git a/external/corefx/src/System.Diagnostics.Debug/System.Diagnostics.Debug.sln b/external/corefx/src/System.Diagnostics.Debug/System.Diagnostics.Debug.sln index 41f06c2580..b99c41dc2c 100644 --- a/external/corefx/src/System.Diagnostics.Debug/System.Diagnostics.Debug.sln +++ b/external/corefx/src/System.Diagnostics.Debug/System.Diagnostics.Debug.sln @@ -26,10 +26,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {56F67E92-E606-435E-A00F-003CBFB26945}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {56F67E92-E606-435E-A00F-003CBFB26945}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {56F67E92-E606-435E-A00F-003CBFB26945}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {56F67E92-E606-435E-A00F-003CBFB26945}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {56F67E92-E606-435E-A00F-003CBFB26945}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {56F67E92-E606-435E-A00F-003CBFB26945}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {56F67E92-E606-435E-A00F-003CBFB26945}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {56F67E92-E606-435E-A00F-003CBFB26945}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU {E7E8DE8A-9EC1-46A8-A6EE-727DB32DBEB8}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU {E7E8DE8A-9EC1-46A8-A6EE-727DB32DBEB8}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {E7E8DE8A-9EC1-46A8-A6EE-727DB32DBEB8}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU diff --git a/external/corefx/src/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj b/external/corefx/src/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj index 67b2b8d245..d536adf3a1 100644 --- a/external/corefx/src/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj @@ -9,14 +9,10 @@ None - - - - - - - - + + + + @@ -26,9 +22,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/pkg/System.Diagnostics.DiagnosticSource.pkgproj b/external/corefx/src/System.Diagnostics.DiagnosticSource/pkg/System.Diagnostics.DiagnosticSource.pkgproj index 98fb9b3179..9217e74da3 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/pkg/System.Diagnostics.DiagnosticSource.pkgproj +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/pkg/System.Diagnostics.DiagnosticSource.pkgproj @@ -9,10 +9,18 @@ net46;net45;netcore45;netcoreapp1.0;wpa81;$(AllXamarinFrameworks) - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md index 0f6f65047e..75d2d83c05 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md @@ -1,4 +1,4 @@ -# DiagnosticSource Users Guide +# DiagnosticSource User's Guide This document describes DiagnosticSource, a simple module that allows code to be instrumented for production-time logging of **rich data payloads** for @@ -41,12 +41,12 @@ there is a bridge that pipes information from DiagnosticSource's to an EventSour consumers can get at all DiagnosticSource events. While the data payloads from DiagnosticSource can't in general be passed through to the EventSource (because they are not serializable), there is a mechanism in the bridge that enables consumers to specify which fields -along to the EventSource. +to pass along to the EventSource. What this means is that in general it is not necessary to instrument a code site multiple times. By instrumenting with Diagnostic source, both clients that need the rich data (and thus use DiagnosticListener) as well as any consumers using EventListeners -(or OS facilities like ETW)) can get at the data. +(or OS facilities like ETW) can get at the data. ---------------------------------------- ## Instrumenting with DiagnosticSource/DiagnosticListener @@ -86,25 +86,27 @@ A typical call site will look like Already some of the architectural elements are being exposed, namely - 1. Every event has a string name (e.g. Request Start), and exactly one object as a payload. - 2. If you need to send more than one item, you can do so by creating a object with all information - in it as properties. CSharp's [anonymous type](https://msdn.microsoft.com/en-us/library/bb397696.aspx) - feature is typically used to create a type to pass 'on the fly', and makes this scheme very - convenient. - 3. At the instrumentation site, you must guard the call to 'Write' with an 'IsEnabled' check on - the same event name. Without this check, even when the instrumentation is inactive, the rules - of the C# language require all the work of creating the payload object and calling 'Write' to be - done, even though nothing is actually listening for the data. By guarding the 'Write' call, we - make it efficient when the source is not enabled. +1. Every event has a string name (e.g. Request Start), and exactly one object as a payload. +2. If you need to send more than one item, you can do so by creating a object with all information + in it as properties. C#'s [anonymous type](https://msdn.microsoft.com/en-us/library/bb397696.aspx) + feature is typically used to create a type to pass 'on the fly', and makes this scheme very + convenient. +3. At the instrumentation site, you must guard the call to 'Write' with an 'IsEnabled' check on + the same event name. Without this check, even when the instrumentation is inactive, the rules + of the C# language require all the work of creating the payload object and calling 'Write' to be + done, even though nothing is actually listening for the data. By guarding the 'Write' call, we + make it efficient when the source is not enabled. ### Creating DiagnosticSources (Actually DiagnosticListeners) Perhaps confusingly you make a DiagnosticSource by creating a DiagnosticListener +```C# static DiagnosticSource mySource = new DiagnosticListener("System.Net.Http"); +``` Basically a DiagnosticListener is a named place where a source sends its information (events). -From an implementation point of view, DiagnosticSource is a abstract class that has the two +From an implementation point of view, DiagnosticSource is an abstract class that has the two instrumentation methods, and DiagnosticListener is something that implements that abstract class. Thus every DiagnosticListener is a DiagnosticSource, and by making a DiagnosticListener you implicitly make a DiagnosticSource as well. @@ -119,13 +121,13 @@ Thus the event names only need to be unique within a component. #### DiagnosticListener Names - * CONSIDER - the likely scenarios for USING information when deciding how may + * CONSIDER - the likely scenarios for USING information when deciding how many DiagnosticListener to have and the events in each. Keep in mind that it is **very easy and efficient** to filter all the events in a particular listener so ideally the most important scenarios involve turning on whole listeners and not needing to filter for particular events. You may need to split a source into multiple smaller ones to achieve this, and this is OK. For example there - are both incomming Http request and outgoing Http requests and you may only need one + are both incoming HTTP requests and outgoing HTTP requests and you may only need one or the other, so having a System.Net.Http.Incomming and System.Net.Http.OutGoing for each sub-case is good. @@ -140,7 +142,7 @@ Thus the event names only need to be unique within a component. component naming**. You want it to be the case that users can correctly guess which listeners to activate knowing just their scenario. - * DO - Make the name for the DiagnosticListeners **globally unique**. This is Typically + * DO - Make the name for the DiagnosticListeners **globally unique**. This is typically done by making the first part of the name the component (e.g. System.Net.Http) * DO - Use dots '.' to create multi-part names. This works well if the name is a Name @@ -151,7 +153,7 @@ Thus the event names only need to be unique within a component. #### EventNames - * DO - keep the names reasonably short (< 16 characters). Keep in mind that that event names + * DO - keep the names reasonably short (< 16 characters). Keep in mind that event names are already qualified by the Listener so the name only needs to be unique within a listener. Short names make the 'IsEnabled' faster. @@ -159,7 +161,7 @@ Thus the event names only need to be unique within a component. naming one event 'RequestStart' and the another 'RequestStop' is good because tools can use the convention to determine that the time interval betweeen them is interesting. -### payloads +### Payloads * DO use the anonymous type syntax 'new { property1 =value1 ...}' as the default way to pass a payload *even if there is only one data element*. This makes adding more data later easy @@ -167,7 +169,7 @@ Thus the event names only need to be unique within a component. * CONSIDER - if you have an event that is so frequent that the performance of the logging is a important consideration, **and** you have only one data item **and** it is unlikely that - you will ever have more data to pass to the event, **and** and the data item is a normal class + you will ever have more data to pass to the event, **and** the data item is a normal class (not a value type) **then** you save some cost by simply by passing the data object directly without using an anonymous type wrapper. @@ -211,7 +213,7 @@ active in the system at runtime. The API to accomplish this is the 'AllListene IObservable\. The IObservable interface is the 'callback' version of the IEnumerable interface. You can learn -more about it at the [Reactive Extensions Site](https://msdn.microsoft.com/en-us/data/gg577609.aspx). +more about it at the [Reactive Extensions](https://msdn.microsoft.com/en-us/data/gg577609.aspx) site. In a nutshell, you have an object called an IObserver which has three callbacks, OnNext, OnComplete and OnError, and an IObservable has single method called 'Subscribe' which gets passed one of these Observers. Once connected, the Observer gets callback (mostly OnNext callbacks) when things @@ -286,7 +288,7 @@ call 'Subscribe' on it as well. Thus we can fill out the previous example a bit In this example after finding the 'System.Net.Http' DiagnosticListener, we create an action that prints out the name of the listener, event, and payload.ToString(). Notice a few things: - 1. DiagnosticListener implement IObservable\>. This means + 1. DiagnosticListener implements IObservable\>. This means on each callback we get a KeyValuePair. The key of this pair is the name of the event and the value is the payload object. In the code above we simply log this information to the Console. @@ -316,8 +318,8 @@ an object. Odds are that you want to get at more specific data. There are tw 2. Use reflection API, for example if we assuming we have the method ```C# - /// Define a shortcut method that fetches a field of a particular name. - static class PropertyExtensions + /// Define a shortcut method that fetches a field of a particular name. + static class PropertyExtensions { static object GetProperty(this object _this, string propertyName) { @@ -392,8 +394,8 @@ And consumers may use such properties to filter events more precisely. { if (eventName == "RequestStart") { - HttpRequestMessage request = context as HttpRequestMessage; - if (request != null) + HttpRequestMessage request = context as HttpRequestMessage; + if (request != null) { return IsUriEnabled(request.RequestUri); } @@ -406,7 +408,7 @@ And consumers may use such properties to filter events more precisely. ``` Note that producer is not aware of filter consumer has provided. DiagnosticListener -will invoke provided filter ommiting additional arguments if necessary, thus the filter +will invoke provided filter omitting additional arguments if necessary, thus the filter should expect to receive null context. Producers should enclose IsEnabled call with event name and context with pure IsEnabled call for event name, so consumers must ensure that filter allows events without context diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs index 05c1afa314..34f24635a6 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs @@ -22,7 +22,7 @@ namespace System.Diagnostics /// /// No methods on Activity allow exceptions to escape as a response to bad inputs. /// They are thrown and caught (that allows Debuggers and Monitors to see the error) - /// but the exception is supressed, and the operation does something reasonable (typically + /// but the exception is suppressed, and the operation does something reasonable (typically /// doing nothing). /// public partial class Activity @@ -472,4 +472,4 @@ namespace System.Diagnostics private bool isFinished; #endregion // private } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSource.cs b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSource.cs index 17e9d5383c..0a665fc0cd 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSource.cs +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSource.cs @@ -31,7 +31,7 @@ namespace System.Diagnostics /// /// The name of the event being written. /// An object that represent the value being passed as a payload for the event. - /// This is often a anonymous type which contains several sub-values. + /// This is often an anonymous type which contains several sub-values. public abstract void Write(string name, object value); /// @@ -53,7 +53,7 @@ namespace System.Diagnostics /// IsEnabled(string) to check if consumer wants to get notifications for such events at all. /// Based on it, producer may call IsEnabled(string, object, object) again with non-null context /// Optional. An object that represents the additional context for IsEnabled. - /// Null by default. Consumers shoud expect to receive null which may indicate that producer + /// Null by default. Consumers should expect to receive null which may indicate that producer /// called pure IsEnabled(string) or producer passed all necessary context in arg1 /// public virtual bool IsEnabled(string name, object arg1, object arg2 = null) diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs index f75e9cf7db..449ab9635d 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs @@ -28,9 +28,9 @@ namespace System.Diagnostics /// list that will be forwarded to the EventSource. If it is empty, values of properties of the /// diagnostic source payload are dumped as strings (using ToString()) and forwarded to the EventSource. /// For what people think of as serializable object strings, primitives this gives you want you want. - /// (the value of the property in string form) for what people think of as non-serialiable objects + /// (the value of the property in string form) for what people think of as non-serializable objects /// (e.g. HttpContext) the ToString() method is typically not defined, so you get the Object.ToString() - /// implemenation that prints the type name. This is useful since this is the information you need + /// implementation that prints the type name. This is useful since this is the information you need /// (the type of the property) to discover the field names so you can create a transform specification /// that will pick off the properties you desire. /// @@ -124,9 +124,9 @@ namespace System.Diagnostics /// "MyDiagnosticSource/SecurityStart@Activity2Start\r\n" + /// "MyDiagnosticSource/SecurityStop@Activity2Stop\r\n" /// - /// Defines that RequestStart will be logged with the EventSource Event Activity1Start (and the cooresponding stop) which - /// means that all events caused between these two markers will have an activity ID assocatied with this start event. - /// Simmilarly SecurityStart is mapped to Activity2Start. + /// Defines that RequestStart will be logged with the EventSource Event Activity1Start (and the corresponding stop) which + /// means that all events caused between these two markers will have an activity ID associated with this start event. + /// Similarly SecurityStart is mapped to Activity2Start. /// /// Note you can map many DiangosticSource events to the same EventSource Event (e.g. Activity1Start). As long as the /// activities don't nest, you can reuse the same event name (since the payloads have the DiagnosticSource name which can @@ -871,7 +871,7 @@ namespace System.Diagnostics } /// - /// CallbackObserver is a adapter class that creates an observer (which you can pass + /// CallbackObserver is an adapter class that creates an observer (which you can pass /// to IObservable.Subscribe), and calls the given callback every time the 'next' /// operation on the IObserver happens. /// diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceTests.cs b/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceTests.cs index c04497d7b8..ac1bf6f537 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceTests.cs +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/DiagnosticSourceTests.cs @@ -651,7 +651,7 @@ namespace System.Diagnostics.Tests } /// - /// Used to make an observer out of a action delegate. + /// Used to make an observer out of an action delegate. /// public static IObserver MakeObserver( Action onNext = null, Action onCompleted = null) diff --git a/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs b/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs index 717728765f..f741ae3ab3 100644 --- a/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs +++ b/external/corefx/src/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs @@ -437,7 +437,7 @@ namespace System.Diagnostics.Tests } /// - /// CallbackObserver is a adapter class that creates an observer (which you can pass + /// CallbackObserver is an adapter class that creates an observer (which you can pass /// to IObservable.Subscribe), and calls the given callback every time the 'next' /// operation on the IObserver happens. /// @@ -453,7 +453,7 @@ namespace System.Diagnostics.Tests } /// - /// EventObserverAndRecorder is an observer that watches all Http diagnosticlistener events flowing + /// EventObserverAndRecorder is an observer that watches all Http diagnostic listener events flowing /// through, and record all of them /// private class EventObserverAndRecorder : IObserver>, IDisposable diff --git a/external/corefx/src/System.Diagnostics.EventLog/System.Diagnostics.EventLog.sln b/external/corefx/src/System.Diagnostics.EventLog/System.Diagnostics.EventLog.sln new file mode 100644 index 0000000000..3cd67c4364 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/System.Diagnostics.EventLog.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.EventLog.Tests", "tests\System.Diagnostics.EventLog.Tests.csproj", "{5B218883-369E-4C3D-8BD0-74843474DCBD}" + ProjectSection(ProjectDependencies) = postProject + {432779B9-3CBD-4871-A7DC-D8A192319DBD} = {432779B9-3CBD-4871-A7DC-D8A192319DBD} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.EventLog", "src\System.Diagnostics.EventLog.csproj", "{432779B9-3CBD-4871-A7DC-D8A192319DBD}" + ProjectSection(ProjectDependencies) = postProject + {F405C42E-EF6F-4404-80FD-3B87E216707C} = {F405C42E-EF6F-4404-80FD-3B87E216707C} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.EventLog", "ref\System.Diagnostics.EventLog.csproj", "{F405C42E-EF6F-4404-80FD-3B87E216707C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B218883-369E-4C3D-8BD0-74843474DCBD}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {5B218883-369E-4C3D-8BD0-74843474DCBD}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {5B218883-369E-4C3D-8BD0-74843474DCBD}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {5B218883-369E-4C3D-8BD0-74843474DCBD}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {432779B9-3CBD-4871-A7DC-D8A192319DBD}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {432779B9-3CBD-4871-A7DC-D8A192319DBD}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {432779B9-3CBD-4871-A7DC-D8A192319DBD}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {432779B9-3CBD-4871-A7DC-D8A192319DBD}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {F405C42E-EF6F-4404-80FD-3B87E216707C}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {F405C42E-EF6F-4404-80FD-3B87E216707C}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {F405C42E-EF6F-4404-80FD-3B87E216707C}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {F405C42E-EF6F-4404-80FD-3B87E216707C}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {5B218883-369E-4C3D-8BD0-74843474DCBD} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {432779B9-3CBD-4871-A7DC-D8A192319DBD} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} + {F405C42E-EF6F-4404-80FD-3B87E216707C} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} + EndGlobalSection +EndGlobal diff --git a/external/corefx/src/System.Diagnostics.EventLog/dir.props b/external/corefx/src/System.Diagnostics.EventLog/dir.props new file mode 100644 index 0000000000..54d241f0e4 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/dir.props @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + Open + + diff --git a/external/corefx/src/System.Diagnostics.EventLog/ref/Configurations.props b/external/corefx/src/System.Diagnostics.EventLog/ref/Configurations.props new file mode 100644 index 0000000000..2defe17dae --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/ref/Configurations.props @@ -0,0 +1,9 @@ + + + + + netfx; + netstandard; + + + diff --git a/external/corefx/src/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.cs b/external/corefx/src/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.cs new file mode 100644 index 0000000000..e54c8a35e1 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.cs @@ -0,0 +1,186 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public partial class EntryWrittenEventArgs : System.EventArgs + { + public EntryWrittenEventArgs() { } + public EntryWrittenEventArgs(System.Diagnostics.EventLogEntry entry) { } + public System.Diagnostics.EventLogEntry Entry { get { throw null; } } + } + public delegate void EntryWrittenEventHandler(object sender, System.Diagnostics.EntryWrittenEventArgs e); + public partial class EventInstance + { + public EventInstance(long instanceId, int categoryId) { } + public EventInstance(long instanceId, int categoryId, System.Diagnostics.EventLogEntryType entryType) { } + public int CategoryId { get { throw null; } set { } } + public System.Diagnostics.EventLogEntryType EntryType { get { throw null; } set { } } + public long InstanceId { get { throw null; } set { } } + } + [System.ComponentModel.DefaultEventAttribute("EntryWritten")] + [System.Diagnostics.MonitoringDescriptionAttribute("Provides interaction with Windows event logs.")] + public partial class EventLog : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize + { + public EventLog() { } + public EventLog(string logName) { } + public EventLog(string logName, string machineName) { } + public EventLog(string logName, string machineName, string source) { } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(false)] + [System.Diagnostics.MonitoringDescriptionAttribute("Indicates if the component monitors the event log for changes.")] + public bool EnableRaisingEvents { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Diagnostics.MonitoringDescriptionAttribute("The contents of the log.")] + public System.Diagnostics.EventLogEntryCollection Entries { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ComponentModel.SettingsBindableAttribute(true)] + [System.Diagnostics.MonitoringDescriptionAttribute("Gets or sets the name of the log to read from and write to.")] + public string Log { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + public string LogDisplayName { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute(".")] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ComponentModel.SettingsBindableAttribute(true)] + [System.Diagnostics.MonitoringDescriptionAttribute("The machine on which this event log resides.")] + public string MachineName { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)(0))] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public long MaximumKilobytes { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public int MinimumRetentionDays { get { throw null; } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public System.Diagnostics.OverflowAction OverflowAction { get { throw null; } } + [System.ComponentModel.DefaultValueAttribute("")] + [System.ComponentModel.ReadOnlyAttribute(true)] + [System.ComponentModel.SettingsBindableAttribute(true)] + [System.Diagnostics.MonitoringDescriptionAttribute("The application name (source name) to use when writing to the event log.")] + public string Source { get { throw null; } set { } } + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.DefaultValueAttribute(null)] + [System.Diagnostics.MonitoringDescriptionAttribute("The object used to marshal the event handler calls issued as a result of an EventLog change.")] + public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { [System.Security.Permissions.HostProtectionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Synchronization=true)]get { throw null; } set { } } + [System.Diagnostics.MonitoringDescriptionAttribute("Raised each time any application writes an entry to the event log.")] + public event System.Diagnostics.EntryWrittenEventHandler EntryWritten { add { } remove { } } + public void BeginInit() { } + public void Clear() { } + public void Close() { } + public static void CreateEventSource(System.Diagnostics.EventSourceCreationData sourceData) { } + public static void CreateEventSource(string source, string logName) { } + [System.ObsoleteAttribute("This method has been deprecated. Please use System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public static void CreateEventSource(string source, string logName, string machineName) { } + public static void Delete(string logName) { } + public static void Delete(string logName, string machineName) { } + public static void DeleteEventSource(string source) { } + public static void DeleteEventSource(string source, string machineName) { } + protected override void Dispose(bool disposing) { } + public void EndInit() { } + public static bool Exists(string logName) { throw null; } + public static bool Exists(string logName, string machineName) { throw null; } + public static System.Diagnostics.EventLog[] GetEventLogs() { throw null; } + public static System.Diagnostics.EventLog[] GetEventLogs(string machineName) { throw null; } + public static string LogNameFromSourceName(string source, string machineName) { throw null; } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void ModifyOverflowPolicy(System.Diagnostics.OverflowAction action, int retentionDays) { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void RegisterDisplayName(string resourceFile, long resourceId) { } + public static bool SourceExists(string source) { throw null; } + public static bool SourceExists(string source, string machineName) { throw null; } + public void WriteEntry(string message) { } + public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type) { } + public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID) { } + public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID, short category) { } + public void WriteEntry(string message, System.Diagnostics.EventLogEntryType type, int eventID, short category, byte[] rawData) { } + public static void WriteEntry(string source, string message) { } + public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type) { } + public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID) { } + public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID, short category) { } + public static void WriteEntry(string source, string message, System.Diagnostics.EventLogEntryType type, int eventID, short category, byte[] rawData) { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void WriteEvent(System.Diagnostics.EventInstance instance, byte[] data, params object[] values) { } + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public void WriteEvent(System.Diagnostics.EventInstance instance, params object[] values) { } + public static void WriteEvent(string source, System.Diagnostics.EventInstance instance, byte[] data, params object[] values) { } + public static void WriteEvent(string source, System.Diagnostics.EventInstance instance, params object[] values) { } + } + [System.ComponentModel.DesignTimeVisibleAttribute(false)] + [System.ComponentModel.ToolboxItemAttribute(false)] + public sealed partial class EventLogEntry : System.ComponentModel.Component, System.Runtime.Serialization.ISerializable + { + internal EventLogEntry() { } + [System.Diagnostics.MonitoringDescriptionAttribute("The category for this message.")] + public string Category { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("An application-specific category number assigned to this entry.")] + public short CategoryNumber { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The binary data associated with this entry in the event log.")] + public byte[] Data { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The type of entry - Information, Warning, etc.")] + public System.Diagnostics.EventLogEntryType EntryType { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The number identifying the message for this source.")] + [System.ObsoleteAttribute("This property has been deprecated. Please use System.Diagnostics.EventLogEntry.InstanceId instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public int EventID { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The sequence of this entry in the event log.")] + public int Index { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The full number identifying the message in the event message dll.")] + [System.Runtime.InteropServices.ComVisibleAttribute(false)] + public long InstanceId { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The machine on which this event log resides.")] + public string MachineName { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The text of the message for this entry.")] + public string Message { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The application-supplied strings used in the message.")] + public string[] ReplacementStrings { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The name of the application that wrote this entry.")] + public string Source { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The time at which the application logged this entry.")] + public System.DateTime TimeGenerated { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The time at which the system logged this entry to the event log.")] + public System.DateTime TimeWritten { get { throw null; } } + [System.Diagnostics.MonitoringDescriptionAttribute("The username of the account associated with this entry by the writing application.")] + public string UserName { get { throw null; } } + public bool Equals(System.Diagnostics.EventLogEntry otherEntry) { throw null; } + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class EventLogEntryCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal EventLogEntryCollection() { } + public int Count { get { throw null; } } + public virtual System.Diagnostics.EventLogEntry this[int index] { get { throw null; } } + bool System.Collections.ICollection.IsSynchronized { get { throw null; } } + object System.Collections.ICollection.SyncRoot { get { throw null; } } + public void CopyTo(System.Diagnostics.EventLogEntry[] entries, int index) { } + public System.Collections.IEnumerator GetEnumerator() { throw null; } + void System.Collections.ICollection.CopyTo(System.Array array, int index) { } + } + public enum EventLogEntryType + { + Error = 1, + FailureAudit = 16, + Information = 4, + SuccessAudit = 8, + Warning = 2, + } + public partial class EventSourceCreationData + { + public EventSourceCreationData(string source, string logName) { } + public int CategoryCount { get { throw null; } set { } } + public string CategoryResourceFile { get { throw null; } set { } } + public string LogName { get { throw null; } set { } } + public string MachineName { get { throw null; } set { } } + public string MessageResourceFile { get { throw null; } set { } } + public string ParameterResourceFile { get { throw null; } set { } } + public string Source { get { throw null; } set { } } + } + public enum OverflowAction + { + DoNotOverwrite = -1, + OverwriteAsNeeded = 0, + OverwriteOlder = 1, + } +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj b/external/corefx/src/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj new file mode 100644 index 0000000000..a15250ff35 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/ref/System.Diagnostics.EventLog.csproj @@ -0,0 +1,23 @@ + + + + + + + + + true + {F405C42E-EF6F-4404-80FD-3B87E216707C} + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/Configurations.props b/external/corefx/src/System.Diagnostics.EventLog/src/Configurations.props new file mode 100644 index 0000000000..e21546f0e0 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/Configurations.props @@ -0,0 +1,10 @@ + + + + + netcoreapp-Windows_NT; + netfx; + netstandard; + + + diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp b/external/corefx/src/System.Diagnostics.EventLog/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp new file mode 100644 index 0000000000..afae65bd27 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp @@ -0,0 +1,7 @@ +advapi32.dll!ClearEventLog +advapi32.dll!CloseEventLog +advapi32.dll!GetNumberOfEventLogRecords +advapi32.dll!GetOldestEventLogRecord +advapi32.dll!NotifyChangeEventLog +advapi32.dll!OpenEventLog +advapi32.dll!ReadEventLog \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/Resources/Strings.resx b/external/corefx/src/System.Diagnostics.EventLog/src/Resources/Strings.resx new file mode 100644 index 0000000000..de56ea52f6 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/Resources/Strings.resx @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Provides interaction with Windows event logs. + + + The contents of the log. + + + The category for this message. + + + An application-specific category number assigned to this entry. + + + The binary data associated with this entry in the event log. + + + The type of entry - Information, Warning, etc. + + + The number identifying the message for this source. + + + The sequence of this entry in the event log. + + + The machine on which this event log resides. + + + The text of the message for this entry. + + + The application-supplied strings used in the message. + + + The full number identifying the message in the event message dll. + + + The name of the application that wrote this entry. + + + The time at which the application logged this entry. + + + The time at which the system logged this entry to the event log. + + + The username of the account associated with this entry by the writing application. + + + Raised each time any application writes an entry to the event log. + + + Gets or sets the name of the log to read from and write to. + + + Indicates if the component monitors the event log for changes. + + + The application name (source name) to use when writing to the event log. + + + The object used to marshal the event handler calls issued as a result of an EventLog change. + + + The name of the machine on which to read or write events. + + + Event log names must consist of printable characters and cannot contain \\, *, ?, or spaces + + + The event log source '{0}' cannot be deleted, because it's equal to the log name. + + + Cannot monitor EntryWritten events for this EventLog. This might be because the EventLog is on a remote machine which is not a supported scenario. + + + Cannot open log {0} on computer '{1}'. {2} + + + Cannot open log for source '{0}'. You may not have write access. + + + Cannot read log entry number {0}. The event log may be corrupt. + + + Cannot retrieve all entries. + + + Only the first eight characters of a custom log name are significant, and there is already another log on the system using the first eight characters of the name given. Name given: '{0}', name of existing log: '{1}'. + + + Invalid eventID value '{0}'. It must be in the range between '{1}' and '{2}'. + + + Index {0} is out of bounds. + + + Cannot initialize the same object twice. + + + The log name: '{0}' is invalid for customer log creation. + + + Invalid value '{1}' for parameter '{0}'. + + + Invalid format for argument {0}. + + + Log {0} has already been registered as a source on the local computer. + + + Cannot open registry key {0}\\{1}\\{2}. + + + Source {0} already exists on the computer '{1}'. + + + Source {0} is not registered on the local computer. + + + The event log '{0}' on computer '{1}' does not exist. + + + Log entry string is too long. A string written to the event log cannot exceed 32766 characters. + + + The source '{0}' is not registered in log '{1}'. (It is registered in log '{2}'.) " The Source and Log properties must be matched, or you may set Log to the empty string, and it will automatically be matched to the Source property.NoAccountInfo=Cannot obtain account information. + + + MaximumKilobytes must be between 64 KB and 4 GB, and must be in 64K increments. + + + The description for Event ID '{0}' in Source '{1}' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event: + + + Cannot find Log {0} on computer '{1}'. + + + Log property value has not been specified. + + + Must specify value for {0}. + + + Source property was not set before opening the event log in write mode. + + + Source property was not set before writing to the event log. + + + No current EventLog entry available, cursor is located before the first or after the last element of the enumeration. + + + Log to delete was not specified. + + + The size of {0} is too big. It cannot be longer than {1} characters. + + + EventLog access is not supported on this platform. + + + Cannot open registry key {0}\\{1}\\{2} on computer '{3}'. + + + Cannot open registry key {0} on computer {1}. + + + Cannot open registry key {0} on computer {1}. You might not have access. + + + 'retentionDays' must be between 1 and 365 days. + + + The source was not found, but some or all event logs could not be searched. Inaccessible logs: {0}. + + + The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: {0}. + + + Source {0} already exists on the computer '{1}'. + + + The source '{0}' is not registered on machine '{1}', or you do not have write access to the {2} registry key. + + + The maximum allowed number of replacement strings is 255. + + + Log {0} has already been registered as a source on the local computer. + + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj b/external/corefx/src/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj new file mode 100644 index 0000000000..d2480d8cae --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj @@ -0,0 +1,92 @@ + + + + + true + true + SR.PlatformNotSupported_EventLog + + false + {432779B9-3CBD-4871-A7DC-D8A192319DBD} + + + + + + + + + + + + + + Component + + + Component + + + + + + + + + + + + + Common\Interop\Windows\Interop.Libraries.cs + + + Common\Interop\Windows\kernel32\Interop.CloseHandle.cs + + + Common\Interop\Windows\kernel32\Interop.FormatMessage_SafeLibraryHandle.cs + + + Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs + + + Common\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs + + + Common\Interop\Windows\kernel32\Interop.LookupAccountSid.cs + + + Common\Interop\Windows\kernel32\Interop.WaitForSingleObject.cs + + + Common\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/CompModSwitches.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/CompModSwitches.cs new file mode 100644 index 0000000000..4ef9619c95 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/CompModSwitches.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.ComponentModel +{ + internal static class CompModSwitches + { + private static volatile BooleanSwitch s_commonDesignerServices; + private static volatile TraceSwitch s_eventLog; + + public static BooleanSwitch CommonDesignerServices + { + get + { + if (s_commonDesignerServices == null) + { + s_commonDesignerServices = new BooleanSwitch(nameof(CommonDesignerServices), "Assert if any common designer service is not found."); + } + + return s_commonDesignerServices; + } + } + + public static TraceSwitch EventLog + { + get + { + if (s_eventLog == null) + { + s_eventLog = new TraceSwitch(nameof(EventLog), "Enable tracing for the EventLog component."); + } + + return s_eventLog; + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EntryWrittenEventArgs.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EntryWrittenEventArgs.cs new file mode 100644 index 0000000000..45fabbf3a4 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EntryWrittenEventArgs.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public class EntryWrittenEventArgs : EventArgs + { + public EntryWrittenEventArgs() + { + } + + public EntryWrittenEventArgs(EventLogEntry entry) + { + Entry = entry; + } + + public EventLogEntry Entry { get; } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EntryWrittenEventHandler.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EntryWrittenEventHandler.cs new file mode 100644 index 0000000000..5e6ccd694b --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EntryWrittenEventHandler.cs @@ -0,0 +1,8 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public delegate void EntryWrittenEventHandler(object sender, EntryWrittenEventArgs e); +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventData.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventData.cs new file mode 100644 index 0000000000..1b4ac56b1c --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventData.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; + +namespace System.Diagnostics +{ + public class EventInstance + { + private int _categoryNumber; + private EventLogEntryType _entryType = EventLogEntryType.Information; + private long _instanceId; + + public EventInstance(long instanceId, int categoryId) + { + CategoryId = categoryId; + InstanceId = instanceId; + } + + public EventInstance(long instanceId, int categoryId, EventLogEntryType entryType) : this(instanceId, categoryId) + { + EntryType = entryType; + } + + public int CategoryId + { + get => _categoryNumber; + set + { + if (value > UInt16.MaxValue || value < 0) + throw new ArgumentOutOfRangeException(nameof(CategoryId)); + + _categoryNumber = value; + } + } + + public EventLogEntryType EntryType + { + get => _entryType; + set + { + if (!Enum.IsDefined(typeof(EventLogEntryType), value)) + throw new InvalidEnumArgumentException(nameof(EntryType), (int)value, typeof(EventLogEntryType)); + + _entryType = value; + } + } + + public long InstanceId + { + get => _instanceId; + set + { + if (value > UInt32.MaxValue || value < 0) + throw new ArgumentOutOfRangeException(nameof(InstanceId)); + + _instanceId = value; + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs new file mode 100644 index 0000000000..2b43d2a1ef --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs @@ -0,0 +1,1049 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Permissions; +using System.Text; +using System.Threading; +using Microsoft.Win32; +using Microsoft.Win32.SafeHandles; + +namespace System.Diagnostics +{ + [DefaultEvent("EntryWritten"), MonitoringDescription("Provides interaction with Windows event logs.")] + public class EventLog : Component, ISupportInitialize + { + private const string EventLogKey = "SYSTEM\\CurrentControlSet\\Services\\EventLog"; + internal const string DllName = "EventLogMessages.dll"; + private const string eventLogMutexName = "netfxeventlog.1.0"; + private const int DefaultMaxSize = 512 * 1024; + private const int DefaultRetention = 7 * SecondsPerDay; + private const int SecondsPerDay = 60 * 60 * 24; + + private EventLogInternal _underlyingEventLog; + + public EventLog() : this(string.Empty, ".", string.Empty) + { + } + + public EventLog(string logName) : this(logName, ".", string.Empty) + { + } + + public EventLog(string logName, string machineName) : this(logName, machineName, string.Empty) + { + } + + public EventLog(string logName, string machineName, string source) + { + _underlyingEventLog = new EventLogInternal(logName, machineName, source, this); + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [MonitoringDescription("The contents of the log.")] + public EventLogEntryCollection Entries + { + get + { + return _underlyingEventLog.Entries; + } + } + + [Browsable(false)] + public string LogDisplayName + { + get + { + return _underlyingEventLog.LogDisplayName; + } + } + + [ReadOnly(true)] + [MonitoringDescription("Gets or sets the name of the log to read from and write to.")] + [DefaultValue("")] + [SettingsBindable(true)] + public string Log + { + get + { + return _underlyingEventLog.Log; + } + set + { + EventLogInternal newLog = new EventLogInternal(value, _underlyingEventLog.MachineName, _underlyingEventLog.Source, this); + EventLogInternal oldLog = _underlyingEventLog; + + if (oldLog.EnableRaisingEvents) + { + newLog.onEntryWrittenHandler = oldLog.onEntryWrittenHandler; + newLog.EnableRaisingEvents = true; + } + + _underlyingEventLog = newLog; + oldLog.Close(); + } + } + + [ReadOnly(true)] + [MonitoringDescription("The machine on which this event log resides.")] + [DefaultValue(".")] + [SettingsBindable(true)] + public string MachineName + { + get + { + return _underlyingEventLog.MachineName; + } + set + { + EventLogInternal newLog = new EventLogInternal(_underlyingEventLog.logName, value, _underlyingEventLog.sourceName, this); + EventLogInternal oldLog = _underlyingEventLog; + + if (oldLog.EnableRaisingEvents) + { + newLog.onEntryWrittenHandler = oldLog.onEntryWrittenHandler; + newLog.EnableRaisingEvents = true; + } + + _underlyingEventLog = newLog; + oldLog.Close(); + } + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [Browsable(false)] + [ComVisible(false)] + public long MaximumKilobytes + { + get => _underlyingEventLog.MaximumKilobytes; + set => _underlyingEventLog.MaximumKilobytes = value; + } + + [Browsable(false)] + [ComVisible(false)] + public OverflowAction OverflowAction + { + get => _underlyingEventLog.OverflowAction; + } + + [Browsable(false)] + [ComVisible(false)] + public int MinimumRetentionDays + { + get => _underlyingEventLog.MinimumRetentionDays; + } + + internal bool ComponentDesignMode + { + get => this.DesignMode; + } + + internal object ComponentGetService(Type service) + { + return GetService(service); + } + + [Browsable(false)] + [MonitoringDescription("Indicates if the component monitors the event log for changes.")] + [DefaultValue(false)] + public bool EnableRaisingEvents + { + get => _underlyingEventLog.EnableRaisingEvents; + set => _underlyingEventLog.EnableRaisingEvents = value; + } + + [Browsable(false)] + [DefaultValue(null)] + [MonitoringDescription("The object used to marshal the event handler calls issued as a result of an EventLog change.")] + public ISynchronizeInvoke SynchronizingObject + { + get => _underlyingEventLog.SynchronizingObject; + set => _underlyingEventLog.SynchronizingObject = value; + } + + [ReadOnly(true)] + [MonitoringDescription("The application name (source name) to use when writing to the event log.")] + [DefaultValue("")] + [SettingsBindable(true)] + public string Source + { + get => _underlyingEventLog.Source; + set + { + EventLogInternal newLog = new EventLogInternal(_underlyingEventLog.Log, _underlyingEventLog.MachineName, CheckAndNormalizeSourceName(value), this); + EventLogInternal oldLog = _underlyingEventLog; + + if (oldLog.EnableRaisingEvents) + { + newLog.onEntryWrittenHandler = oldLog.onEntryWrittenHandler; + newLog.EnableRaisingEvents = true; + } + + _underlyingEventLog = newLog; + oldLog.Close(); + } + } + + [MonitoringDescription("Raised each time any application writes an entry to the event log.")] + public event EntryWrittenEventHandler EntryWritten + { + add + { + _underlyingEventLog.EntryWritten += value; + } + remove + { + _underlyingEventLog.EntryWritten -= value; + } + } + + public void BeginInit() + { + _underlyingEventLog.BeginInit(); + } + + public void Clear() + { + _underlyingEventLog.Clear(); + } + + public void Close() + { + _underlyingEventLog.Close(); + } + + public static void CreateEventSource(string source, string logName) + { + CreateEventSource(new EventSourceCreationData(source, logName, ".")); + } + + [Obsolete("This method has been deprecated. Please use System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public static void CreateEventSource(string source, string logName, string machineName) + { + CreateEventSource(new EventSourceCreationData(source, logName, machineName)); + } + + public static void CreateEventSource(EventSourceCreationData sourceData) + { + if (sourceData == null) + throw new ArgumentNullException(nameof(sourceData)); + + string logName = sourceData.LogName; + string source = sourceData.Source; + string machineName = sourceData.MachineName; + + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "CreateEventSource: Checking arguments"); + if (!SyntaxCheck.CheckMachineName(machineName)) + { + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName)); + } + + if (logName == null || logName.Length == 0) + logName = "Application"; + if (!ValidLogName(logName, false)) + throw new ArgumentException(SR.BadLogName); + if (source == null || source.Length == 0) + throw new ArgumentException(SR.Format(SR.MissingParameter, nameof(source))); + if (source.Length + EventLogKey.Length > 254) + throw new ArgumentException(SR.Format(SR.ParameterTooLong, nameof(source), 254 - EventLogKey.Length)); + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutex(eventLogMutexName, ref mutex); + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "CreateEventSource: Calling SourceExists"); + if (SourceExists(source, machineName, true)) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "CreateEventSource: SourceExists returned true"); + if (".".Equals(machineName)) + throw new ArgumentException(SR.Format(SR.LocalSourceAlreadyExists, source)); + else + throw new ArgumentException(SR.Format(SR.SourceAlreadyExists, source, machineName)); + } + + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "CreateEventSource: Getting DllPath"); + + RegistryKey baseKey = null; + RegistryKey eventKey = null; + RegistryKey logKey = null; + RegistryKey sourceLogKey = null; + RegistryKey sourceKey = null; + try + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "CreateEventSource: Getting local machine regkey"); + if (machineName == ".") + baseKey = Registry.LocalMachine; + else + baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName); + + eventKey = baseKey.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\EventLog", true); + if (eventKey == null) + { + if (!".".Equals(machineName)) + throw new InvalidOperationException(SR.Format(SR.RegKeyMissing, "SYSTEM\\CurrentControlSet\\Services\\EventLog", logName, source, machineName)); + else + throw new InvalidOperationException(SR.Format(SR.LocalRegKeyMissing, "SYSTEM\\CurrentControlSet\\Services\\EventLog", logName, source)); + } + + logKey = eventKey.OpenSubKey(logName, true); + if (logKey == null && logName.Length >= 8) + { + string logNameFirst8 = logName.Substring(0, 8); + if (string.Compare(logNameFirst8, "AppEvent", StringComparison.OrdinalIgnoreCase) == 0 || + string.Compare(logNameFirst8, "SecEvent", StringComparison.OrdinalIgnoreCase) == 0 || + string.Compare(logNameFirst8, "SysEvent", StringComparison.OrdinalIgnoreCase) == 0) + throw new ArgumentException(SR.Format(SR.InvalidCustomerLogName, logName)); + + string sameLogName = FindSame8FirstCharsLog(eventKey, logName); + if (sameLogName != null) + throw new ArgumentException(SR.Format(SR.DuplicateLogName, logName, sameLogName)); + } + + bool createLogKey = (logKey == null); + if (createLogKey) + { + if (SourceExists(logName, machineName, true)) + { + if (".".Equals(machineName)) + throw new ArgumentException(SR.Format(SR.LocalLogAlreadyExistsAsSource, logName)); + else + throw new ArgumentException(SR.Format(SR.LogAlreadyExistsAsSource, logName, machineName)); + } + + logKey = eventKey.CreateSubKey(logName); + SetSpecialLogRegValues(logKey, logName); + // A source with the same name as the log has to be created + // by default. It is the behavior expected by EventLog API. + sourceLogKey = logKey.CreateSubKey(logName); + SetSpecialSourceRegValues(sourceLogKey, sourceData); + } + + if (logName != source) + { + if (!createLogKey) + { + SetSpecialLogRegValues(logKey, logName); + } + + sourceKey = logKey.CreateSubKey(source); + SetSpecialSourceRegValues(sourceKey, sourceData); + } + } + finally + { + baseKey?.Close(); + eventKey?.Close(); + logKey?.Close(); + sourceLogKey?.Close(); + sourceKey?.Close(); + } + } + finally + { + mutex?.ReleaseMutex(); + mutex?.Close(); + } + } + + public static void Delete(string logName) + { + Delete(logName, "."); + } + + public static void Delete(string logName, string machineName) + { + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.InvalidParameterFormat, nameof(machineName)); + if (logName == null || logName.Length == 0) + throw new ArgumentException(SR.NoLogName); + if (!ValidLogName(logName, false)) + throw new InvalidOperationException(SR.BadLogName); + + RegistryKey eventlogkey = null; + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutex(eventLogMutexName, ref mutex); + try + { + eventlogkey = GetEventLogRegKey(machineName, true); + if (eventlogkey == null) + { + throw new InvalidOperationException(SR.Format(SR.RegKeyNoAccess, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog", machineName)); + } + + using (RegistryKey logKey = eventlogkey.OpenSubKey(logName)) + { + if (logKey == null) + throw new InvalidOperationException(SR.Format(SR.MissingLog, logName, machineName)); + //clear out log before trying to delete it + //that way, if we can't delete the log file, no entries will persist because it has been cleared + EventLog logToClear = new EventLog(logName, machineName); + try + { + logToClear.Clear(); + } + finally + { + logToClear.Close(); + } + + string filename = null; + try + { + //most of the time, the "File" key does not exist, but we'll still give it a whirl + filename = (string)logKey.GetValue("File"); + } + catch { } + if (filename != null) + { + try + { + File.Delete(filename); + } + catch { } + } + } + // now delete the registry entry + eventlogkey.DeleteSubKeyTree(logName); + } + finally + { + eventlogkey?.Close(); + } + } + finally + { + mutex?.ReleaseMutex(); + } + } + + public static void DeleteEventSource(string source) + { + DeleteEventSource(source, "."); + } + + public static void DeleteEventSource(string source, string machineName) + { + if (!SyntaxCheck.CheckMachineName(machineName)) + { + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName)); + } + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutex(eventLogMutexName, ref mutex); + RegistryKey key = null; + // First open the key read only so we can do some checks. This is important so we get the same + // exceptions even if we don't have write access to the reg key. + using (key = FindSourceRegistration(source, machineName, true)) + { + if (key == null) + { + if (machineName == null) + throw new ArgumentException(SR.Format(SR.LocalSourceNotRegistered, source)); + else + throw new ArgumentException(SR.Format(SR.SourceNotRegistered, source, machineName, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog")); + } + // Check parent registry key (Event Log Name) and if it's equal to source, then throw an exception. + // The reason: each log registry key must always contain subkey (i.e. source) with the same name. + string keyname = key.Name; + int index = keyname.LastIndexOf('\\'); + if (string.Compare(keyname, index + 1, source, 0, keyname.Length - index, StringComparison.Ordinal) == 0) + throw new InvalidOperationException(SR.Format(SR.CannotDeleteEqualSource, source)); + } + + try + { + key = FindSourceRegistration(source, machineName, false); + key.DeleteSubKeyTree(source); + } + finally + { + key?.Close(); + } + } + finally + { + mutex?.ReleaseMutex(); + } + } + + protected override void Dispose(bool disposing) + { + _underlyingEventLog?.Dispose(disposing); + base.Dispose(disposing); + } + + public void EndInit() + { + _underlyingEventLog.EndInit(); + } + + public static bool Exists(string logName) + { + return Exists(logName, "."); + } + + public static bool Exists(string logName, string machineName) + { + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameterFormat, nameof(machineName))); + + if (logName == null || logName.Length == 0) + return false; + + RegistryKey eventkey = null; + RegistryKey logKey = null; + + try + { + eventkey = GetEventLogRegKey(machineName, false); + if (eventkey == null) + return false; + + logKey = eventkey.OpenSubKey(logName, false); // try to find log file key immediately. + return (logKey != null); + } + finally + { + eventkey?.Close(); + logKey?.Close(); + } + } + // Try to find log file name with the same 8 first characters. + // Returns 'null' if no "same first 8 chars" log is found. logName.Length must be > 7 + private static string FindSame8FirstCharsLog(RegistryKey keyParent, string logName) + { + string logNameFirst8 = logName.Substring(0, 8); + string[] logNames = keyParent.GetSubKeyNames(); + + for (int i = 0; i < logNames.Length; i++) + { + string currentLogName = logNames[i]; + if (currentLogName.Length >= 8 && + string.Compare(currentLogName.Substring(0, 8), logNameFirst8, StringComparison.OrdinalIgnoreCase) == 0) + return currentLogName; + } + + return null; // not found + } + + private static RegistryKey FindSourceRegistration(string source, string machineName, bool readOnly) + { + return FindSourceRegistration(source, machineName, readOnly, false); + } + + private static RegistryKey FindSourceRegistration(string source, string machineName, bool readOnly, bool wantToCreate) + { + if (source != null && source.Length != 0) + { + RegistryKey eventkey = null; + try + { + eventkey = GetEventLogRegKey(machineName, !readOnly); + if (eventkey == null) + { + // there's not even an event log service on the machine. + // or, more likely, we don't have the access to read the registry. + return null; + } + + StringBuilder inaccessibleLogs = null; + // Most machines will return only { "Application", "System", "Security" }, + // but you can create your own if you want. + string[] logNames = eventkey.GetSubKeyNames(); + for (int i = 0; i < logNames.Length; i++) + { + // see if the source is registered in this log. + // NOTE: A source name must be unique across ALL LOGS! + RegistryKey sourceKey = null; + try + { + RegistryKey logKey = eventkey.OpenSubKey(logNames[i], /*writable*/!readOnly); + if (logKey != null) + { + sourceKey = logKey.OpenSubKey(source, /*writable*/!readOnly); + if (sourceKey != null) + { + // found it + return logKey; + } + else + { + logKey.Close(); + } + } + // else logKey is null, so we don't need to Close it + } + catch (UnauthorizedAccessException) + { + if (inaccessibleLogs == null) + { + inaccessibleLogs = new StringBuilder(logNames[i]); + } + else + { + inaccessibleLogs.Append(", "); + inaccessibleLogs.Append(logNames[i]); + } + } + catch (SecurityException) + { + if (inaccessibleLogs == null) + { + inaccessibleLogs = new StringBuilder(logNames[i]); + } + else + { + inaccessibleLogs.Append(", "); + inaccessibleLogs.Append(logNames[i]); + } + } + finally + { + sourceKey?.Close(); + } + } + + if (inaccessibleLogs != null) + throw new SecurityException(SR.Format(wantToCreate ? SR.SomeLogsInaccessibleToCreate : SR.SomeLogsInaccessible, inaccessibleLogs.ToString())); + + } + finally + { + eventkey?.Close(); + } + } + + return null; + } + + public static EventLog[] GetEventLogs() + { + return GetEventLogs("."); + } + + public static EventLog[] GetEventLogs(string machineName) + { + if (!SyntaxCheck.CheckMachineName(machineName)) + { + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName)); + } + + string[] logNames = new string[0]; + + RegistryKey eventkey = null; + try + { + // we figure out what logs are on the machine by looking in the registry. + eventkey = GetEventLogRegKey(machineName, false); + if (eventkey == null) + // there's not even an event log service on the machine. + // or, more likely, we don't have the access to read the registry. + throw new InvalidOperationException(SR.Format(SR.RegKeyMissingShort, EventLogKey, machineName)); + // Most machines will return only { "Application", "System", "Security" }, + // but you can create your own if you want. + logNames = eventkey.GetSubKeyNames(); + } + finally + { + eventkey?.Close(); + } + // now create EventLog objects that point to those logs + EventLog[] logs = new EventLog[logNames.Length]; + for (int i = 0; i < logNames.Length; i++) + { + EventLog log = new EventLog(logNames[i], machineName); + logs[i] = log; + } + + return logs; + } + + internal static RegistryKey GetEventLogRegKey(string machine, bool writable) + { + RegistryKey lmkey = null; + + try + { + if (machine.Equals(".")) + { + lmkey = Registry.LocalMachine; + } + else + { + lmkey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machine); + } + if (lmkey != null) + return lmkey.OpenSubKey(EventLogKey, writable); + } + finally + { + lmkey?.Close(); + } + return null; + } + + internal static string GetDllPath(string machineName) + { + return Path.Combine(SharedUtils.GetLatestBuildDllDirectory(machineName), DllName); + } + + public static bool SourceExists(string source) + { + return SourceExists(source, "."); + } + + public static bool SourceExists(string source, string machineName) + { + return SourceExists(source, machineName, false); + } + + internal static bool SourceExists(string source, string machineName, bool wantToCreate) + { + if (!SyntaxCheck.CheckMachineName(machineName)) + { + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName)); + } + + using (RegistryKey keyFound = FindSourceRegistration(source, machineName, true, wantToCreate)) + { + return (keyFound != null); + } + } + + public static string LogNameFromSourceName(string source, string machineName) + { + return _InternalLogNameFromSourceName(source, machineName); + } + + internal static string _InternalLogNameFromSourceName(string source, string machineName) + { + using (RegistryKey key = FindSourceRegistration(source, machineName, true)) + { + if (key == null) + return string.Empty; + else + { + string name = key.Name; + int whackPos = name.LastIndexOf('\\'); + // this will work even if whackPos is -1 + return name.Substring(whackPos + 1); + } + } + } + + [ComVisible(false)] + public void ModifyOverflowPolicy(OverflowAction action, int retentionDays) + { + _underlyingEventLog.ModifyOverflowPolicy(action, retentionDays); + } + + [ComVisible(false)] + public void RegisterDisplayName(string resourceFile, long resourceId) + { + _underlyingEventLog.RegisterDisplayName(resourceFile, resourceId); + } + + private static void SetSpecialLogRegValues(RegistryKey logKey, string logName) + { + // Set all the default values for this log. AutoBackupLogfiles only makes sense in + // Win2000 SP4, WinXP SP1, and Win2003, but it should alright elsewhere. + // Since we use this method on the existing system logs as well as our own, + // we need to make sure we don't overwrite any existing values. + if (logKey.GetValue("MaxSize") == null) + logKey.SetValue("MaxSize", DefaultMaxSize, RegistryValueKind.DWord); + if (logKey.GetValue("AutoBackupLogFiles") == null) + logKey.SetValue("AutoBackupLogFiles", 0, RegistryValueKind.DWord); + } + + private static void SetSpecialSourceRegValues(RegistryKey sourceLogKey, EventSourceCreationData sourceData) + { + if (string.IsNullOrEmpty(sourceData.MessageResourceFile)) + sourceLogKey.SetValue("EventMessageFile", GetDllPath(sourceData.MachineName), RegistryValueKind.ExpandString); + else + sourceLogKey.SetValue("EventMessageFile", FixupPath(sourceData.MessageResourceFile), RegistryValueKind.ExpandString); + + if (!string.IsNullOrEmpty(sourceData.ParameterResourceFile)) + sourceLogKey.SetValue("ParameterMessageFile", FixupPath(sourceData.ParameterResourceFile), RegistryValueKind.ExpandString); + + if (!string.IsNullOrEmpty(sourceData.CategoryResourceFile)) + { + sourceLogKey.SetValue("CategoryMessageFile", FixupPath(sourceData.CategoryResourceFile), RegistryValueKind.ExpandString); + sourceLogKey.SetValue("CategoryCount", sourceData.CategoryCount, RegistryValueKind.DWord); + } + } + + private static string FixupPath(string path) + { + if (path[0] == '%') + return path; + else + return Path.GetFullPath(path); + } + + internal static string TryFormatMessage(SafeLibraryHandle hModule, uint messageNum, string[] insertionStrings) + { + if (insertionStrings.Length == 0) + { + return UnsafeTryFormatMessage(hModule, messageNum, insertionStrings); + } + + // If you pass in an empty array UnsafeTryFormatMessage will just pull out the message. + string formatString = UnsafeTryFormatMessage(hModule, messageNum, new string[0]); + + if (formatString == null) + { + return null; + } + + int largestNumber = 0; + + for (int i = 0; i < formatString.Length; i++) + { + if (formatString[i] == '%') + { + if (formatString.Length > i + 1) + { + StringBuilder sb = new StringBuilder(); + while (i + 1 < formatString.Length && Char.IsDigit(formatString[i + 1])) + { + sb.Append(formatString[i + 1]); + i++; + } + // move over the non number character that broke us out of the loop + i++; + + if (sb.Length > 0) + { + int num = -1; + if (Int32.TryParse(sb.ToString(), NumberStyles.None, CultureInfo.InvariantCulture, out num)) + { + largestNumber = Math.Max(largestNumber, num); + } + } + } + } + } + // Replacement strings are 1 indexed. + if (largestNumber > insertionStrings.Length) + { + string[] newStrings = new string[largestNumber]; + Array.Copy(insertionStrings, newStrings, insertionStrings.Length); + for (int i = insertionStrings.Length; i < newStrings.Length; i++) + { + newStrings[i] = "%" + (i + 1); + } + + insertionStrings = newStrings; + } + + return UnsafeTryFormatMessage(hModule, messageNum, insertionStrings); + } + // FormatMessageW will AV if you don't pass in enough format strings. If you call TryFormatMessage we ensure insertionStrings + // is long enough. You don't want to call this directly unless you're sure insertionStrings is long enough! + internal static string UnsafeTryFormatMessage(SafeLibraryHandle hModule, uint messageNum, string[] insertionStrings) + { + string msg = null; + + int msgLen = 0; + StringBuilder buf = new StringBuilder(1024); + int flags = Interop.Kernel32.FORMAT_MESSAGE_FROM_HMODULE | Interop.Kernel32.FORMAT_MESSAGE_ARGUMENT_ARRAY; + + IntPtr[] addresses = new IntPtr[insertionStrings.Length]; + GCHandle[] handles = new GCHandle[insertionStrings.Length]; + GCHandle stringsRoot = GCHandle.Alloc(addresses, GCHandleType.Pinned); + + if (insertionStrings.Length == 0) + { + flags |= Interop.Kernel32.FORMAT_MESSAGE_IGNORE_INSERTS; + } + + try + { + for (int i = 0; i < handles.Length; i++) + { + handles[i] = GCHandle.Alloc(insertionStrings[i], GCHandleType.Pinned); + addresses[i] = handles[i].AddrOfPinnedObject(); + } + int lastError = Interop.Kernel32.ERROR_INSUFFICIENT_BUFFER; + while (msgLen == 0 && lastError == Interop.Kernel32.ERROR_INSUFFICIENT_BUFFER) + { + msgLen = Interop.Kernel32.FormatMessage( + flags, + hModule, + messageNum, + 0, + buf, + buf.Capacity, + addresses); + + if (msgLen == 0) + { + lastError = Marshal.GetLastWin32Error(); + if (lastError == Interop.Kernel32.ERROR_INSUFFICIENT_BUFFER) + buf.Capacity = buf.Capacity * 2; + } + } + } + catch + { + msgLen = 0; // return empty on failure + } + finally + { + for (int i = 0; i < handles.Length; i++) + { + if (handles[i].IsAllocated) + handles[i].Free(); + } + stringsRoot.Free(); + } + + if (msgLen > 0) + { + msg = buf.ToString(); + // chop off a single CR/LF pair from the end if there is one. FormatMessage always appends one extra. + if (msg.Length > 1 && msg[msg.Length - 1] == '\n') + msg = msg.Substring(0, msg.Length - 2); + } + + return msg; + } + // CharIsPrintable used to be Char.IsPrintable, but Jay removed it and + // is forcing people to use the Unicode categories themselves. Copied + // the code here. + private static bool CharIsPrintable(char c) + { + UnicodeCategory uc = Char.GetUnicodeCategory(c); + return (!(uc == UnicodeCategory.Control) || (uc == UnicodeCategory.Format) || + (uc == UnicodeCategory.LineSeparator) || (uc == UnicodeCategory.ParagraphSeparator) || + (uc == UnicodeCategory.OtherNotAssigned)); + } + + internal static bool ValidLogName(string logName, bool ignoreEmpty) + { + // No need to trim here since the next check will verify that there are no spaces. + // We need to ignore the empty string as an invalid log name sometimes because it can + // be passed in from our default constructor. + if (logName.Length == 0 && !ignoreEmpty) + return false; + + //any space, backslash, asterisk, or question mark is bad + //any non-printable characters are also bad + foreach (char c in logName) + if (!CharIsPrintable(c) || (c == '\\') || (c == '*') || (c == '?')) + return false; + + return true; + } + + public void WriteEntry(string message) + { + WriteEntry(message, EventLogEntryType.Information, (short)0, 0, null); + } + + public static void WriteEntry(string source, string message) + { + WriteEntry(source, message, EventLogEntryType.Information, (short)0, 0, null); + } + + public void WriteEntry(string message, EventLogEntryType type) + { + WriteEntry(message, type, (short)0, 0, null); + } + + public static void WriteEntry(string source, string message, EventLogEntryType type) + { + WriteEntry(source, message, type, (short)0, 0, null); + } + + public void WriteEntry(string message, EventLogEntryType type, int eventID) + { + WriteEntry(message, type, eventID, 0, null); + } + + public static void WriteEntry(string source, string message, EventLogEntryType type, int eventID) + { + WriteEntry(source, message, type, eventID, 0, null); + } + + public void WriteEntry(string message, EventLogEntryType type, int eventID, short category) + { + WriteEntry(message, type, eventID, category, null); + } + + public static void WriteEntry(string source, string message, EventLogEntryType type, int eventID, short category) + { + WriteEntry(source, message, type, eventID, category, null); + } + + public static void WriteEntry(string source, string message, EventLogEntryType type, int eventID, short category, byte[] rawData) + { + using (EventLogInternal log = new EventLogInternal(string.Empty, ".", CheckAndNormalizeSourceName(source))) + { + log.WriteEntry(message, type, eventID, category, rawData); + } + } + + public void WriteEntry(string message, EventLogEntryType type, int eventID, short category, byte[] rawData) + { + _underlyingEventLog.WriteEntry(message, type, eventID, category, rawData); + } + + [ComVisible(false)] + public void WriteEvent(EventInstance instance, params Object[] values) + { + WriteEvent(instance, null, values); + } + + [ComVisible(false)] + public void WriteEvent(EventInstance instance, byte[] data, params Object[] values) + { + _underlyingEventLog.WriteEvent(instance, data, values); + } + + public static void WriteEvent(string source, EventInstance instance, params Object[] values) + { + using (EventLogInternal log = new EventLogInternal(string.Empty, ".", CheckAndNormalizeSourceName(source))) + { + log.WriteEvent(instance, null, values); + } + } + + public static void WriteEvent(string source, EventInstance instance, byte[] data, params Object[] values) + { + using (EventLogInternal log = new EventLogInternal(string.Empty, ".", CheckAndNormalizeSourceName(source))) + { + log.WriteEvent(instance, data, values); + } + } + + // The EventLog.set_Source used to do some normalization and throw some exceptions. We mimic that behavior here. + private static string CheckAndNormalizeSourceName(string source) + { + if (source == null) + source = string.Empty; + + // this 254 limit is the max length of a registry key. + if (source.Length + EventLogKey.Length > 254) + throw new ArgumentException(SR.Format(SR.ParameterTooLong, nameof(source), 254 - EventLogKey.Length)); + + return source; + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntry.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntry.cs new file mode 100644 index 0000000000..899b279a9a --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntry.cs @@ -0,0 +1,461 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using System.Text; +using Microsoft.Win32; + +namespace System.Diagnostics +{ + [ + ToolboxItem(false), + DesignTimeVisible(false), + ] + public sealed class EventLogEntry : Component, ISerializable + { + internal byte[] dataBuf; + internal int bufOffset; + private EventLogInternal owner; + private string category; + private string message; + + internal EventLogEntry(byte[] buf, int offset, EventLogInternal log) + { + this.dataBuf = buf; + this.bufOffset = offset; + this.owner = log; + + GC.SuppressFinalize(this); + } + + private EventLogEntry(SerializationInfo info, StreamingContext context) + { + throw new PlatformNotSupportedException(); + } + + [MonitoringDescription("The machine on which this event log resides.")] + public string MachineName + { + get + { + // first skip over the source name + int pos = bufOffset + FieldOffsets.RAWDATA; + while (CharFrom(dataBuf, pos) != '\0') + pos += 2; + pos += 2; + char ch = CharFrom(dataBuf, pos); + StringBuilder buf = new StringBuilder(); + while (ch != '\0') + { + buf.Append(ch); + pos += 2; + ch = CharFrom(dataBuf, pos); + } + + return buf.ToString(); + } + } + + [MonitoringDescription("The binary data associated with this entry in the event log.")] + public byte[] Data + { + get + { + int dataLen = IntFrom(dataBuf, bufOffset + FieldOffsets.DATALENGTH); + byte[] data = new byte[dataLen]; + Array.Copy(dataBuf, bufOffset + IntFrom(dataBuf, bufOffset + FieldOffsets.DATAOFFSET), + data, 0, dataLen); + return data; + } + } + + [MonitoringDescription("The sequence of this entry in the event log.")] + public int Index + { + get + { + return IntFrom(dataBuf, bufOffset + FieldOffsets.RECORDNUMBER); + } + } + + [MonitoringDescription("The category for this message.")] + public string Category + { + get + { + if (category == null) + { + string dllName = GetMessageLibraryNames("CategoryMessageFile"); + string cat = owner.FormatMessageWrapper(dllName, (uint)CategoryNumber, null); + if (cat == null) + category = "(" + CategoryNumber.ToString(CultureInfo.CurrentCulture) + ")"; + else + category = cat; + } + + return category; + } + } + + [MonitoringDescription("An application-specific category number assigned to this entry.")] + public short CategoryNumber + { + get + { + return ShortFrom(dataBuf, bufOffset + FieldOffsets.EVENTCATEGORY); + } + } + + [ + MonitoringDescription("The number identifying the message for this source."), + Obsolete("This property has been deprecated. Please use System.Diagnostics.EventLogEntry.InstanceId instead. http://go.microsoft.com/fwlink/?linkid=14202") + ] + public int EventID + { + get + { + return IntFrom(dataBuf, bufOffset + FieldOffsets.EVENTID) & 0x3FFFFFFF; + } + } + + [MonitoringDescription("The type of entry - Information, Warning, etc.")] + public EventLogEntryType EntryType + { + get + { + return (EventLogEntryType)ShortFrom(dataBuf, bufOffset + FieldOffsets.EVENTTYPE); + } + } + + [MonitoringDescription("The text of the message for this entry.")] + public string Message + { + get + { + if (message == null) + { + string dllNames = GetMessageLibraryNames("EventMessageFile"); + int msgId = IntFrom(dataBuf, bufOffset + FieldOffsets.EVENTID); + string msg = owner.FormatMessageWrapper(dllNames, (uint)msgId, ReplacementStrings); + if (msg == null) + { + StringBuilder msgBuf = new StringBuilder(SR.MessageNotFormatted + msgId + Source); + string[] strings = ReplacementStrings; + for (int i = 0; i < strings.Length; i++) + { + if (i != 0) + msgBuf.Append(", "); + msgBuf.Append("'"); + msgBuf.Append(strings[i]); + msgBuf.Append("'"); + } + + msg = msgBuf.ToString(); + } + else + msg = ReplaceMessageParameters(msg, ReplacementStrings); + + message = msg; + } + + return message; + } + } + + [MonitoringDescription("The name of the application that wrote this entry.")] + public string Source + { + get + { + StringBuilder buf = new StringBuilder(); + int pos = bufOffset + FieldOffsets.RAWDATA; + + char ch = CharFrom(dataBuf, pos); + while (ch != '\0') + { + buf.Append(ch); + pos += 2; + ch = CharFrom(dataBuf, pos); + } + + return buf.ToString(); + } + } + + [MonitoringDescription("The application-supplied strings used in the message.")] + public string[] ReplacementStrings + { + get + { + string[] strings = new string[ShortFrom(dataBuf, bufOffset + FieldOffsets.NUMSTRINGS)]; + int i = 0; + int bufpos = bufOffset + IntFrom(dataBuf, bufOffset + FieldOffsets.STRINGOFFSET); + StringBuilder buf = new StringBuilder(); + while (i < strings.Length) + { + char ch = CharFrom(dataBuf, bufpos); + if (ch != '\0') + buf.Append(ch); + else + { + strings[i] = buf.ToString(); + i++; + buf = new StringBuilder(); + } + + bufpos += 2; + } + + return strings; + } + } + + [ + MonitoringDescription("The full number identifying the message in the event message dll."), + ComVisible(false) + ] + public Int64 InstanceId + { + get + { + return (UInt32)IntFrom(dataBuf, bufOffset + FieldOffsets.EVENTID); + } + } + + [MonitoringDescription("The time at which the application logged this entry.")] + public DateTime TimeGenerated + { + get + { + return beginningOfTime.AddSeconds(IntFrom(dataBuf, bufOffset + FieldOffsets.TIMEGENERATED)).ToLocalTime(); + } + } + + [MonitoringDescription("The time at which the system logged this entry to the event log.")] + public DateTime TimeWritten + { + get + { + return beginningOfTime.AddSeconds(IntFrom(dataBuf, bufOffset + FieldOffsets.TIMEWRITTEN)).ToLocalTime(); + } + } + + [MonitoringDescription("The username of the account associated with this entry by the writing application.")] + public string UserName + { + get + { + int sidLen = IntFrom(dataBuf, bufOffset + FieldOffsets.USERSIDLENGTH); + if (sidLen == 0) + return null; + byte[] sid = new byte[sidLen]; + Array.Copy(dataBuf, bufOffset + IntFrom(dataBuf, bufOffset + FieldOffsets.USERSIDOFFSET), + sid, 0, sid.Length); + + int userNameLen = 256; + int domainNameLen = 256; + int sidNameUse = 0; + StringBuilder bufUserName = new StringBuilder(userNameLen); + StringBuilder bufDomainName = new StringBuilder(domainNameLen); + StringBuilder retUserName = new StringBuilder(); + + if (Interop.Kernel32.LookupAccountSid(MachineName, sid, bufUserName, ref userNameLen, bufDomainName, ref domainNameLen, ref sidNameUse) != 0) + { + retUserName.Append(bufDomainName.ToString()); + retUserName.Append("\\"); + retUserName.Append(bufUserName.ToString()); + } + + return retUserName.ToString(); + } + } + + private char CharFrom(byte[] buf, int offset) + { + return (char)ShortFrom(buf, offset); + } + + public bool Equals(EventLogEntry otherEntry) + { + if (otherEntry == null) + return false; + int ourLen = IntFrom(dataBuf, bufOffset + FieldOffsets.LENGTH); + int theirLen = IntFrom(otherEntry.dataBuf, otherEntry.bufOffset + FieldOffsets.LENGTH); + if (ourLen != theirLen) + { + return false; + } + int min = bufOffset; + int max = bufOffset + ourLen; + int j = otherEntry.bufOffset; + for (int i = min; i < max; i++, j++) + if (dataBuf[i] != otherEntry.dataBuf[j]) + { + return false; + } + + return true; + } + + private int IntFrom(byte[] buf, int offset) + { + // assumes Little Endian byte order. + return (unchecked((int)0xFF000000) & (buf[offset + 3] << 24)) | (0xFF0000 & (buf[offset + 2] << 16)) | + (0xFF00 & (buf[offset + 1] << 8)) | (0xFF & (buf[offset])); + } + + internal string ReplaceMessageParameters(String msg, string[] insertionStrings) + { + int percentIdx = msg.IndexOf('%'); + if (percentIdx < 0) + return msg; + + int startCopyIdx = 0; + int msgLength = msg.Length; + StringBuilder buf = new StringBuilder(); + string paramDLLNames = GetMessageLibraryNames("ParameterMessageFile"); + + while (percentIdx >= 0) + { + string param = null; + int lasNumIdx = percentIdx + 1; + while (lasNumIdx < msgLength && Char.IsDigit(msg, lasNumIdx)) + lasNumIdx++; + + uint paramMsgID = 0; + + if (lasNumIdx != percentIdx + 1) + UInt32.TryParse(msg.Substring(percentIdx + 1, lasNumIdx - percentIdx - 1), out paramMsgID); + + if (paramMsgID != 0) + param = owner.FormatMessageWrapper(paramDLLNames, paramMsgID, insertionStrings); + + if (param != null) + { + if (percentIdx > startCopyIdx) + buf.Append(msg, startCopyIdx, percentIdx - startCopyIdx); // original chars from msg + buf.Append(param); + startCopyIdx = lasNumIdx; + } + + percentIdx = msg.IndexOf('%', percentIdx + 1); + } + + if (msgLength - startCopyIdx > 0) + buf.Append(msg, startCopyIdx, msgLength - startCopyIdx); // last span of original msg + return buf.ToString(); + } + + private static RegistryKey GetSourceRegKey(string logName, string source, string machineName) + { + RegistryKey eventKey = null; + RegistryKey logKey = null; + + try + { + eventKey = EventLog.GetEventLogRegKey(machineName, false); + return eventKey?.OpenSubKey(logName ?? "Application", /*writable*/false)?.OpenSubKey(source, /*writeable*/false); + } + finally + { + eventKey?.Close(); + logKey?.Close(); + } + } + + private string GetMessageLibraryNames(string libRegKey) + { + // get the value stored in the registry + string fileName = null; + RegistryKey regKey = null; + try + { + regKey = GetSourceRegKey(owner.Log, Source, owner.MachineName); + if (regKey != null) + { + fileName = (string)regKey.GetValue(libRegKey); + } + } + finally + { + regKey?.Close(); + } + + if (fileName == null) + return null; + // convert any absolute paths on a remote machine to use the \\MACHINENAME\DRIVELETTER$ shares + if (owner.MachineName != ".") + { + string[] fileNames = fileName.Split(';'); + + StringBuilder result = new StringBuilder(); + + for (int i = 0; i < fileNames.Length; i++) + { + if (fileNames[i].Length >= 2 && fileNames[i][1] == ':') + { + result.Append(@"\\"); + result.Append(owner.MachineName); + result.Append(@"\"); + result.Append(fileNames[i][0]); + result.Append("$"); + result.Append(fileNames[i], 2, fileNames[i].Length - 2); + result.Append(';'); + } + } + + if (result.Length == 0) + { + return null; + } + else + { + return result.ToString(0, result.Length - 1); + } + } + else + { + return fileName; + } + } + + private short ShortFrom(byte[] buf, int offset) + { + // assumes little Endian byte order. + return (short)((0xFF00 & (buf[offset + 1] << 8)) | (0xFF & buf[offset])); + } + + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + throw new PlatformNotSupportedException(); + } + + private static class FieldOffsets + { + internal const int LENGTH = 0; + internal const int RESERVED = 4; + internal const int RECORDNUMBER = 8; + internal const int TIMEGENERATED = 12; + internal const int TIMEWRITTEN = 16; + internal const int EVENTID = 20; + internal const int EVENTTYPE = 24; + internal const int NUMSTRINGS = 26; + internal const int EVENTCATEGORY = 28; + internal const int RESERVEDFLAGS = 30; + internal const int CLOSINGRECORDNUMBER = 32; + internal const int STRINGOFFSET = 36; + internal const int USERSIDLENGTH = 40; + internal const int USERSIDOFFSET = 44; + internal const int DATALENGTH = 48; + internal const int DATAOFFSET = 52; + internal const int RAWDATA = 56; + } + + private static readonly DateTime beginningOfTime = new DateTime(1970, 1, 1, 0, 0, 0); + private const int OFFSETFIXUP = 4 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 4 + 4; + } +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntryCollection.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntryCollection.cs new file mode 100644 index 0000000000..cb0a9a2c9c --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntryCollection.cs @@ -0,0 +1,106 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; + +namespace System.Diagnostics +{ + public class EventLogEntryCollection : ICollection + { + private readonly EventLogInternal _log; + + internal EventLogEntryCollection(EventLogInternal log) + { + _log = log; + } + + public int Count + { + get + { + return _log.EntryCount; + } + } + + public virtual EventLogEntry this[int index] + { + get + { + return _log.GetEntryAt(index); + } + } + + public void CopyTo(EventLogEntry[] entries, int index) + { + ((ICollection)this).CopyTo((Array)entries, index); + } + + public IEnumerator GetEnumerator() + { + return new EntriesEnumerator(this); + } + + internal EventLogEntry GetEntryAtNoThrow(int index) + { + return _log.GetEntryAtNoThrow(index); + } + + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + object ICollection.SyncRoot + { + get + { + return this; + } + } + + void ICollection.CopyTo(Array array, int index) + { + EventLogEntry[] entries = _log.GetAllEntries(); + Array.Copy(entries, 0, array, index, entries.Length); + } + + private class EntriesEnumerator : IEnumerator + { + private EventLogEntryCollection entries; + private int num = -1; + private EventLogEntry cachedEntry = null; + + internal EntriesEnumerator(EventLogEntryCollection entries) + { + this.entries = entries; + } + + public object Current + { + get + { + if (cachedEntry == null) + throw new InvalidOperationException(SR.NoCurrentEntry); + + return cachedEntry; + } + } + + public bool MoveNext() + { + num++; + cachedEntry = entries.GetEntryAtNoThrow(num); + return cachedEntry != null; + } + + public void Reset() + { + num = -1; + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntryType.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntryType.cs new file mode 100644 index 0000000000..a240fc02b8 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogEntryType.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public enum EventLogEntryType + { + Error = 1, + Warning = 2, + Information = 4, + SuccessAudit = 8, + FailureAudit = 16, + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs new file mode 100644 index 0000000000..cb89277555 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs @@ -0,0 +1,1506 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Specialized; +using System.ComponentModel; +using System.ComponentModel.Design; +using System.Globalization; +using System.IO; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using System.Threading; +using Microsoft.Win32; +using Microsoft.Win32.SafeHandles; + +namespace System.Diagnostics +{ + internal class EventLogInternal : IDisposable, ISupportInitialize + { + private EventLogEntryCollection entriesCollection; + internal string logName; + // used in monitoring for event postings. + private int lastSeenCount; + // holds the machine we're on, or null if it's the local machine + internal readonly string machineName; + // the delegate to call when an event arrives + internal EntryWrittenEventHandler onEntryWrittenHandler; + // holds onto the handle for reading + private SafeEventLogReadHandle readHandle; + // the source name - used only when writing + internal readonly string sourceName; + // holds onto the handle for writing + private SafeEventLogWriteHandle writeHandle; + + private string logDisplayName; + // cache system state variables + // the initial size of the buffer (it can be made larger if necessary) + private const int BUF_SIZE = 40000; + // the number of bytes in the cache that belong to entries (not necessarily + // the same as BUF_SIZE, because the cache only holds whole entries) + private int bytesCached; + // the actual cache buffer + private byte[] cache; + // the number of the entry at the beginning of the cache + private int firstCachedEntry = -1; + // the number of the entry that we got out of the cache most recently + private int lastSeenEntry; + // where that entry was + private int lastSeenPos; + //support for threadpool based deferred execution + private ISynchronizeInvoke synchronizingObject; + // the EventLog object that publicly exposes this instance. + private readonly EventLog parent; + + private const string EventLogKey = "SYSTEM\\CurrentControlSet\\Services\\EventLog"; + internal const string DllName = "EventLogMessages.dll"; + private const string eventLogMutexName = "netfxeventlog.1.0"; + private const int SecondsPerDay = 60 * 60 * 24; + private const int DefaultMaxSize = 512 * 1024; + private const int DefaultRetention = 7 * SecondsPerDay; + + private const int Flag_notifying = 0x1; // keeps track of whether we're notifying our listeners - to prevent double notifications + private const int Flag_forwards = 0x2; // whether the cache contains entries in forwards order (true) or backwards (false) + private const int Flag_initializing = 0x4; + internal const int Flag_monitoring = 0x8; + private const int Flag_registeredAsListener = 0x10; + private const int Flag_writeGranted = 0x20; + private const int Flag_disposed = 0x100; + private const int Flag_sourceVerified = 0x200; + + private BitVector32 boolFlags = new BitVector32(); + + private Hashtable messageLibraries; + private readonly static Hashtable listenerInfos = new Hashtable(StringComparer.OrdinalIgnoreCase); + + private Object m_InstanceLockObject; + private Object InstanceLockObject + { + get + { + if (m_InstanceLockObject == null) + { + Object o = new Object(); + Interlocked.CompareExchange(ref m_InstanceLockObject, o, null); + } + + return m_InstanceLockObject; + } + } + + private static Object s_InternalSyncObject; + private static Object InternalSyncObject + { + get + { + if (s_InternalSyncObject == null) + { + Object o = new Object(); + Interlocked.CompareExchange(ref s_InternalSyncObject, o, null); + } + + return s_InternalSyncObject; + } + } + + public EventLogInternal() : this("", ".", "", null) + { + } + + public EventLogInternal(string logName) : this(logName, ".", "", null) + { + } + + public EventLogInternal(string logName, string machineName) : this(logName, machineName, "", null) + { + } + + public EventLogInternal(string logName, string machineName, string source) : this(logName, machineName, source, null) + { + } + + public EventLogInternal(string logName, string machineName, string source, EventLog parent) + { + //look out for invalid log names + if (logName == null) + throw new ArgumentNullException(nameof(logName)); + if (!ValidLogName(logName, true)) + throw new ArgumentException(SR.BadLogName); + + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName)); + + this.machineName = machineName; + this.logName = logName; + this.sourceName = source; + readHandle = null; + writeHandle = null; + boolFlags[Flag_forwards] = true; + this.parent = parent; + } + + public EventLogEntryCollection Entries + { + get + { + string currentMachineName = this.machineName; + + if (entriesCollection == null) + entriesCollection = new EventLogEntryCollection(this); + return entriesCollection; + } + } + + internal int EntryCount + { + get + { + if (!IsOpenForRead) + OpenForRead(this.machineName); + int count; + bool success = UnsafeNativeMethods.GetNumberOfEventLogRecords(readHandle, out count); + if (!success) + throw SharedUtils.CreateSafeWin32Exception(); + return count; + } + } + + private bool IsOpen + { + get + { + return readHandle != null || writeHandle != null; + } + } + + private bool IsOpenForRead + { + get + { + return readHandle != null; + } + } + + private bool IsOpenForWrite + { + get + { + return writeHandle != null; + } + } + + public string LogDisplayName + { + get + { + if (logDisplayName != null) + return logDisplayName; + + string currentMachineName = this.machineName; + if (GetLogName(currentMachineName) != null) + { + RegistryKey logkey = null; + + try + { + // we figure out what logs are on the machine by looking in the registry. + logkey = GetLogRegKey(currentMachineName, false); + if (logkey == null) + throw new InvalidOperationException(SR.Format(SR.MissingLog, GetLogName(currentMachineName), currentMachineName)); + + string resourceDll = (string)logkey.GetValue("DisplayNameFile"); + if (resourceDll == null) + logDisplayName = GetLogName(currentMachineName); + else + { + int resourceId = (int)logkey.GetValue("DisplayNameID"); + logDisplayName = FormatMessageWrapper(resourceDll, (uint)resourceId, null); + if (logDisplayName == null) + logDisplayName = GetLogName(currentMachineName); + } + } + finally + { + logkey?.Close(); + } + } + + return logDisplayName; + } + } + + public string Log + { + get + { + string currentMachineName = this.machineName; + return GetLogName(currentMachineName); + } + } + + private string GetLogName(string currentMachineName) + { + if ((logName == null || logName.Length == 0) && sourceName != null && sourceName.Length != 0) + { + logName = EventLog._InternalLogNameFromSourceName(sourceName, currentMachineName); + } + + return logName; + } + + public string MachineName + { + get + { + return this.machineName; + } + } + + [ComVisible(false)] + public long MaximumKilobytes + { + get + { + string currentMachineName = this.machineName; + + object val = GetLogRegValue(currentMachineName, "MaxSize"); + if (val != null) + { + int intval = (int)val; // cast to an int first to unbox + return ((uint)intval) / 1024; // then convert to kilobytes + } + // 512k is the default value + return 0x200; + } + + set + { + string currentMachineName = this.machineName; + // valid range is 64 KB to 4 GB + if (value < 64 || value > 0x3FFFC0 || value % 64 != 0) + throw new ArgumentOutOfRangeException("MaximumKilobytes", SR.MaximumKilobytesOutOfRange); + + long regvalue = value * 1024; // convert to bytes + int i = unchecked((int)regvalue); + + using (RegistryKey logkey = GetLogRegKey(currentMachineName, true)) + logkey.SetValue("MaxSize", i, RegistryValueKind.DWord); + } + } + + internal Hashtable MessageLibraries + { + get + { + if (messageLibraries == null) + messageLibraries = new Hashtable(StringComparer.OrdinalIgnoreCase); + return messageLibraries; + } + } + + [ComVisible(false)] + public OverflowAction OverflowAction + { + get + { + string currentMachineName = this.machineName; + + object retentionobj = GetLogRegValue(currentMachineName, "Retention"); + if (retentionobj != null) + { + int retention = (int)retentionobj; + if (retention == 0) + return OverflowAction.OverwriteAsNeeded; + else if (retention == -1) + return OverflowAction.DoNotOverwrite; + else + return OverflowAction.OverwriteOlder; + } + + // default value as listed in MSDN + return OverflowAction.OverwriteOlder; + } + } + + [ComVisible(false)] + public int MinimumRetentionDays + { + get + { + string currentMachineName = this.machineName; + + object retentionobj = GetLogRegValue(currentMachineName, "Retention"); + if (retentionobj != null) + { + int retention = (int)retentionobj; + if (retention == 0 || retention == -1) + return retention; + else + return (int)(((double)retention) / SecondsPerDay); + } + + return 7; + } + } + + public bool EnableRaisingEvents + { + get + { + string currentMachineName = this.machineName; + return boolFlags[Flag_monitoring]; + } + set + { + string currentMachineName = this.machineName; + + if (parent.ComponentDesignMode) + this.boolFlags[Flag_monitoring] = value; + else + { + if (value) + StartRaisingEvents(currentMachineName, GetLogName(currentMachineName)); + else + StopRaisingEvents(/*currentMachineName,*/ GetLogName(currentMachineName)); + } + } + } + + private int OldestEntryNumber + { + get + { + if (!IsOpenForRead) + OpenForRead(this.machineName); + int num; + bool success = UnsafeNativeMethods.GetOldestEventLogRecord(readHandle, out num); + if (!success) + throw SharedUtils.CreateSafeWin32Exception(); + + if (num == 0) + num = 1; + + return num; + } + } + + internal SafeEventLogReadHandle ReadHandle + { + get + { + if (!IsOpenForRead) + OpenForRead(this.machineName); + return readHandle; + } + } + + public ISynchronizeInvoke SynchronizingObject + { + get + { + string currentMachineName = this.machineName; + if (this.synchronizingObject == null && parent.ComponentDesignMode) + { + IDesignerHost host = (IDesignerHost)parent.ComponentGetService(typeof(IDesignerHost)); + if (host != null) + { + object baseComponent = host.RootComponent; + if (baseComponent != null && baseComponent is ISynchronizeInvoke) + this.synchronizingObject = (ISynchronizeInvoke)baseComponent; + } + } + + return this.synchronizingObject; + } + + set + { + this.synchronizingObject = value; + } + } + + public string Source + { + get + { + string currentMachineName = this.machineName; + return sourceName; + } + } + + private static void AddListenerComponent(EventLogInternal component, string compMachineName, string compLogName) + { + lock (InternalSyncObject) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::AddListenerComponent(" + compLogName + ")"); + + LogListeningInfo info = (LogListeningInfo)listenerInfos[compLogName]; + if (info != null) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::AddListenerComponent: listener already active."); + info.listeningComponents.Add(component); + return; + } + + info = new LogListeningInfo(); + info.listeningComponents.Add(component); + + info.handleOwner = new EventLogInternal(compLogName, compMachineName); + // tell the event log system about it + info.waitHandle = new AutoResetEvent(false); + bool success = UnsafeNativeMethods.NotifyChangeEventLog(info.handleOwner.ReadHandle, info.waitHandle.SafeWaitHandle); + if (!success) + throw new InvalidOperationException(SR.CantMonitorEventLog, SharedUtils.CreateSafeWin32Exception()); + + info.registeredWaitHandle = ThreadPool.RegisterWaitForSingleObject(info.waitHandle, new WaitOrTimerCallback(StaticCompletionCallback), info, -1, false); + listenerInfos[compLogName] = info; + } + } + + public event EntryWrittenEventHandler EntryWritten + { + add + { + string currentMachineName = this.machineName; + onEntryWrittenHandler += value; + } + remove + { + string currentMachineName = this.machineName; + onEntryWrittenHandler -= value; + } + } + + public void BeginInit() + { + string currentMachineName = this.machineName; + + if (boolFlags[Flag_initializing]) + throw new InvalidOperationException(SR.InitTwice); + boolFlags[Flag_initializing] = true; + if (boolFlags[Flag_monitoring]) + StopListening(GetLogName(currentMachineName)); + } + + public void Clear() + { + string currentMachineName = this.machineName; + + if (!IsOpenForRead) + OpenForRead(currentMachineName); + bool success = UnsafeNativeMethods.ClearEventLog(readHandle, NativeMethods.NullHandleRef); + if (!success) + { + // Ignore file not found errors. ClearEventLog seems to try to delete the file where the event log is + // stored. If it can't find it, it gives an error. + int error = Marshal.GetLastWin32Error(); + if (error != NativeMethods.ERROR_FILE_NOT_FOUND) + throw SharedUtils.CreateSafeWin32Exception(); + } + // now that we've cleared the event log, we need to re-open our handles, because + // the internal state of the event log has changed. + Reset(currentMachineName); + } + + public void Close() + { + Close(this.machineName); + } + + private void Close(string currentMachineName) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::Close"); + //Trace("Close", "Closing the event log"); + if (readHandle != null) + { + try + { + readHandle.Close(); + } + catch (IOException) + { + throw SharedUtils.CreateSafeWin32Exception(); + } + readHandle = null; + //Trace("Close", "Closed read handle"); + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::Close: closed read handle"); + } + + if (writeHandle != null) + { + try + { + writeHandle.Close(); + } + catch (IOException) + { + throw SharedUtils.CreateSafeWin32Exception(); + } + writeHandle = null; + //Trace("Close", "Closed write handle"); + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::Close: closed write handle"); + } + + if (boolFlags[Flag_monitoring]) + StopRaisingEvents(/*currentMachineName,*/ GetLogName(currentMachineName)); + + if (messageLibraries != null) + { + foreach (SafeLibraryHandle handle in messageLibraries.Values) + handle.Close(); + + messageLibraries = null; + } + + boolFlags[Flag_sourceVerified] = false; + } + + private void CompletionCallback(object context) + { + if (boolFlags[Flag_disposed]) + { + // This object has been disposed previously, ignore firing the event. + return; + } + + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::CompletionStatusChanged: starting at " + lastSeenCount.ToString(CultureInfo.InvariantCulture)); + lock (InstanceLockObject) + { + if (boolFlags[Flag_notifying]) + { + // don't do double notifications. + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::CompletionStatusChanged: aborting because we're already notifying."); + return; + } + + boolFlags[Flag_notifying] = true; + } + + int i = lastSeenCount; + try + { + int oldest = OldestEntryNumber; + int count = EntryCount + oldest; + // Ensure lastSeenCount is within bounds. This deals with the case where the event log has been cleared between + // notifications. + if (lastSeenCount < oldest || lastSeenCount > count) + { + lastSeenCount = oldest; + i = lastSeenCount; + } + + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::CompletionStatusChanged: OldestEntryNumber is " + OldestEntryNumber + ", EntryCount is " + EntryCount); + while (i < count) + { + while (i < count) + { + EventLogEntry entry = GetEntryWithOldest(i); + if (this.SynchronizingObject != null && this.SynchronizingObject.InvokeRequired) + this.SynchronizingObject.BeginInvoke(this.onEntryWrittenHandler, new object[] { this, new EntryWrittenEventArgs(entry) }); + else + onEntryWrittenHandler(this, new EntryWrittenEventArgs(entry)); + + i++; + } + oldest = OldestEntryNumber; + count = EntryCount + oldest; + } + } + catch (Exception e) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::CompletionStatusChanged: Caught exception notifying event handlers: " + e.ToString()); + } + + try + { + // if the user cleared the log while we were receiving events, the call to GetEntryWithOldest above could have + // thrown an exception and i could be too large. Make sure we don't set lastSeenCount to something bogus. + int newCount = EntryCount + OldestEntryNumber; + if (i > newCount) + lastSeenCount = newCount; + else + lastSeenCount = i; + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::CompletionStatusChanged: finishing at " + lastSeenCount.ToString(CultureInfo.InvariantCulture)); + } + catch (Win32Exception e) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::CompletionStatusChanged: Caught exception updating last entry number: " + e.ToString()); + } + + lock (InstanceLockObject) + { + boolFlags[Flag_notifying] = false; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void Dispose(bool disposing) + { + try + { + if (disposing) + { + //Dispose unmanaged and managed resources + if (IsOpen) + { + Close(); + } + // This is probably unnecessary + if (readHandle != null) + { + readHandle.Close(); + readHandle = null; + } + + if (writeHandle != null) + { + writeHandle.Close(); + writeHandle = null; + } + } + } + finally + { + messageLibraries = null; + this.boolFlags[Flag_disposed] = true; + } + } + + public void EndInit() + { + string currentMachineName = this.machineName; + + boolFlags[Flag_initializing] = false; + if (boolFlags[Flag_monitoring]) + StartListening(currentMachineName, GetLogName(currentMachineName)); + } + + internal string FormatMessageWrapper(string dllNameList, uint messageNum, string[] insertionStrings) + { + if (dllNameList == null) + return null; + + if (insertionStrings == null) + insertionStrings = new string[0]; + + string[] listDll = dllNameList.Split(';'); + + // Find first mesage in DLL list + foreach (string dllName in listDll) + { + if (dllName == null || dllName.Length == 0) + continue; + + SafeLibraryHandle hModule = null; + + if (IsOpen) + { + hModule = MessageLibraries[dllName] as SafeLibraryHandle; + + if (hModule == null || hModule.IsInvalid) + { + hModule = Interop.Kernel32.LoadLibraryExW(dllName, IntPtr.Zero, Interop.Kernel32.LOAD_LIBRARY_AS_DATAFILE); + MessageLibraries[dllName] = hModule; + } + } + else + { + hModule = Interop.Kernel32.LoadLibraryExW(dllName, IntPtr.Zero, Interop.Kernel32.LOAD_LIBRARY_AS_DATAFILE); + } + + if (hModule.IsInvalid) + continue; + + string msg = null; + try + { + msg = EventLog.TryFormatMessage(hModule, messageNum, insertionStrings); + } + finally + { + if (!IsOpen) + { + hModule.Close(); + } + } + + if (msg != null) + { + return msg; + } + } + + return null; + } + + internal EventLogEntry[] GetAllEntries() + { + // we could just call getEntryAt() on all the entries, but it'll be faster + // if we grab multiple entries at once. + string currentMachineName = this.machineName; + + if (!IsOpenForRead) + OpenForRead(currentMachineName); + + EventLogEntry[] entries = new EventLogEntry[EntryCount]; + int idx = 0; + int oldestEntry = OldestEntryNumber; + + int bytesRead; + int minBytesNeeded; + int error = 0; + while (idx < entries.Length) + { + byte[] buf = new byte[BUF_SIZE]; + bool success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, + oldestEntry + idx, buf, buf.Length, out bytesRead, out minBytesNeeded); + if (!success) + { + error = Marshal.GetLastWin32Error(); + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "Error from ReadEventLog is " + error.ToString(CultureInfo.InvariantCulture)); + + if (error == Interop.Kernel32.ERROR_INSUFFICIENT_BUFFER || error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) + { + if (error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) + { + Reset(currentMachineName); + } + // try again with a bigger buffer if necessary + else if (minBytesNeeded > buf.Length) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "Increasing buffer size from " + buf.Length.ToString(CultureInfo.InvariantCulture) + " to " + minBytesNeeded.ToString(CultureInfo.InvariantCulture) + " bytes"); + buf = new byte[minBytesNeeded]; + } + success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, + oldestEntry + idx, buf, buf.Length, out bytesRead, out minBytesNeeded); + if (!success) + break; + } + else + { + break; + } + + error = 0; + } + entries[idx] = new EventLogEntry(buf, 0, this); + int sum = IntFrom(buf, 0); + idx++; + while (sum < bytesRead && idx < entries.Length) + { + entries[idx] = new EventLogEntry(buf, sum, this); + sum += IntFrom(buf, sum); + idx++; + } + } + if (idx != entries.Length) + { + if (error != 0) + throw new InvalidOperationException(SR.CantRetrieveEntries, SharedUtils.CreateSafeWin32Exception(error)); + else + throw new InvalidOperationException(SR.CantRetrieveEntries); + } + return entries; + } + + private int GetCachedEntryPos(int entryIndex) + { + if (cache == null || (boolFlags[Flag_forwards] && entryIndex < firstCachedEntry) || + (!boolFlags[Flag_forwards] && entryIndex > firstCachedEntry) || firstCachedEntry == -1) + { + // the index falls before anything we have in the cache, or the cache + // is not yet valid + return -1; + } + + while (lastSeenEntry < entryIndex) + { + lastSeenEntry++; + if (boolFlags[Flag_forwards]) + { + lastSeenPos = GetNextEntryPos(lastSeenPos); + if (lastSeenPos >= bytesCached) + break; + } + else + { + lastSeenPos = GetPreviousEntryPos(lastSeenPos); + if (lastSeenPos < 0) + break; + } + } + + while (lastSeenEntry > entryIndex) + { + lastSeenEntry--; + if (boolFlags[Flag_forwards]) + { + lastSeenPos = GetPreviousEntryPos(lastSeenPos); + if (lastSeenPos < 0) + break; + } + else + { + lastSeenPos = GetNextEntryPos(lastSeenPos); + if (lastSeenPos >= bytesCached) + break; + } + } + + if (lastSeenPos >= bytesCached) + { + // we ran past the end. move back to the last one and return -1 + lastSeenPos = GetPreviousEntryPos(lastSeenPos); + if (boolFlags[Flag_forwards]) + lastSeenEntry--; + else + lastSeenEntry++; + return -1; + } + else if (lastSeenPos < 0) + { + // we ran past the beginning. move back to the first one and return -1 + lastSeenPos = 0; + if (boolFlags[Flag_forwards]) + lastSeenEntry++; + else + lastSeenEntry--; + return -1; + } + else + { + // we found it. + return lastSeenPos; + } + } + + internal EventLogEntry GetEntryAt(int index) + { + EventLogEntry entry = GetEntryAtNoThrow(index); + if (entry == null) + throw new ArgumentException(SR.Format(SR.IndexOutOfBounds, index.ToString(CultureInfo.CurrentCulture))); + return entry; + } + + internal EventLogEntry GetEntryAtNoThrow(int index) + { + if (!IsOpenForRead) + OpenForRead(this.machineName); + + if (index < 0 || index >= EntryCount) + return null; + index += OldestEntryNumber; + EventLogEntry entry = null; + + try + { + entry = GetEntryWithOldest(index); + } + catch (InvalidOperationException) + { + } + + return entry; + } + + private EventLogEntry GetEntryWithOldest(int index) + { + EventLogEntry entry = null; + int entryPos = GetCachedEntryPos(index); + if (entryPos >= 0) + { + entry = new EventLogEntry(cache, entryPos, this); + return entry; + } + + string currentMachineName = this.machineName; + int flags = 0; + if (GetCachedEntryPos(index + 1) < 0) + { + flags = NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ; + boolFlags[Flag_forwards] = true; + } + else + { + flags = NativeMethods.BACKWARDS_READ | NativeMethods.SEEK_READ; + boolFlags[Flag_forwards] = false; + } + + cache = new byte[BUF_SIZE]; + int bytesRead; + int minBytesNeeded; + bool success = UnsafeNativeMethods.ReadEventLog(readHandle, flags, index, + cache, cache.Length, out bytesRead, out minBytesNeeded); + if (!success) + { + int error = Marshal.GetLastWin32Error(); + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "Error from ReadEventLog is " + error.ToString(CultureInfo.InvariantCulture)); + if (error == Interop.Kernel32.ERROR_INSUFFICIENT_BUFFER || error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) + { + if (error == NativeMethods.ERROR_EVENTLOG_FILE_CHANGED) + { + byte[] tempcache = cache; + Reset(currentMachineName); + cache = tempcache; + } + else + { + // try again with a bigger buffer. + if (minBytesNeeded > cache.Length) + { + cache = new byte[minBytesNeeded]; + } + } + success = UnsafeNativeMethods.ReadEventLog(readHandle, NativeMethods.FORWARDS_READ | NativeMethods.SEEK_READ, index, + cache, cache.Length, out bytesRead, out minBytesNeeded); + } + + if (!success) + { + throw new InvalidOperationException(SR.Format(SR.CantReadLogEntryAt, index.ToString(CultureInfo.CurrentCulture)), SharedUtils.CreateSafeWin32Exception()); + } + } + + bytesCached = bytesRead; + firstCachedEntry = index; + lastSeenEntry = index; + lastSeenPos = 0; + return new EventLogEntry(cache, 0, this); + } + + internal static RegistryKey GetEventLogRegKey(string machine, bool writable) + { + RegistryKey lmkey = null; + + try + { + if (machine.Equals(".")) + { + lmkey = Registry.LocalMachine; + } + else + { + lmkey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machine); + } + if (lmkey != null) + return lmkey.OpenSubKey(EventLogKey, writable); + } + finally + { + lmkey?.Close(); + } + + return null; + } + + private RegistryKey GetLogRegKey(string currentMachineName, bool writable) + { + string logname = GetLogName(currentMachineName); + if (!ValidLogName(logname, false)) + throw new InvalidOperationException(SR.BadLogName); + + RegistryKey eventkey = null; + RegistryKey logkey = null; + + try + { + eventkey = GetEventLogRegKey(currentMachineName, false); + if (eventkey == null) + throw new InvalidOperationException(SR.Format(SR.RegKeyMissingShort, EventLogKey, currentMachineName)); + + logkey = eventkey.OpenSubKey(logname, writable); + if (logkey == null) + throw new InvalidOperationException(SR.Format(SR.MissingLog, logname, currentMachineName)); + } + finally + { + eventkey?.Close(); + } + + return logkey; + } + + private object GetLogRegValue(string currentMachineName, string valuename) + { + RegistryKey logkey = null; + + try + { + logkey = GetLogRegKey(currentMachineName, false); + if (logkey == null) + throw new InvalidOperationException(SR.Format(SR.MissingLog, GetLogName(currentMachineName), currentMachineName)); + + object val = logkey.GetValue(valuename); + return val; + } + finally + { + logkey?.Close(); + } + } + + private int GetNextEntryPos(int pos) + { + return pos + IntFrom(cache, pos); + } + + private int GetPreviousEntryPos(int pos) + { + return pos - IntFrom(cache, pos - 4); + } + + internal static string GetDllPath(string machineName) + { + return Path.Combine(SharedUtils.GetLatestBuildDllDirectory(machineName), DllName); + } + + private static int IntFrom(byte[] buf, int offset) + { + // assumes Little Endian byte order. + return (unchecked((int)0xFF000000) & (buf[offset + 3] << 24)) | (0xFF0000 & (buf[offset + 2] << 16)) | + (0xFF00 & (buf[offset + 1] << 8)) | (0xFF & (buf[offset])); + } + + [ComVisible(false)] + public void ModifyOverflowPolicy(OverflowAction action, int retentionDays) + { + string currentMachineName = this.machineName; + + if (action < OverflowAction.DoNotOverwrite || action > OverflowAction.OverwriteOlder) + throw new InvalidEnumArgumentException("action", (int)action, typeof(OverflowAction)); + // this is a long because in the if statement we may need to store values as + // large as UInt32.MaxValue - 1. This would overflow an int. + long retentionvalue = (long)action; + if (action == OverflowAction.OverwriteOlder) + { + if (retentionDays < 1 || retentionDays > 365) + throw new ArgumentOutOfRangeException(SR.RentionDaysOutOfRange); + + retentionvalue = (long)retentionDays * SecondsPerDay; + } + + using (RegistryKey logkey = GetLogRegKey(currentMachineName, true)) + logkey.SetValue("Retention", retentionvalue, RegistryValueKind.DWord); + } + + private void OpenForRead(string currentMachineName) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::OpenForRead"); + + if (this.boolFlags[Flag_disposed]) + throw new ObjectDisposedException(GetType().Name); + + string logname = GetLogName(currentMachineName); + + if (logname == null || logname.Length == 0) + throw new ArgumentException(SR.MissingLogProperty); + + if (!EventLog.Exists(logname, currentMachineName)) // do not open non-existing Log [alexvec] + throw new InvalidOperationException(SR.Format(SR.LogDoesNotExists, logname, currentMachineName)); + + // Clean up cache variables. + // The initilizing code is put here to guarantee, that first read of events + // from log file will start by filling up the cache buffer. + lastSeenEntry = 0; + lastSeenPos = 0; + bytesCached = 0; + firstCachedEntry = -1; + + SafeEventLogReadHandle handle = SafeEventLogReadHandle.OpenEventLog(currentMachineName, logname); + if (handle.IsInvalid) + { + Win32Exception e = null; + if (Marshal.GetLastWin32Error() != 0) + { + e = SharedUtils.CreateSafeWin32Exception(); + } + throw new InvalidOperationException(SR.Format(SR.CantOpenLog, logname.ToString(), currentMachineName, e?.Message ?? "")); + } + + readHandle = handle; + } + + private void OpenForWrite(string currentMachineName) + { + //Cannot allocate the writeHandle if the object has been disposed, since finalization has been suppressed. + if (this.boolFlags[Flag_disposed]) + throw new ObjectDisposedException(GetType().Name); + + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::OpenForWrite"); + if (sourceName == null || sourceName.Length == 0) + throw new ArgumentException(SR.NeedSourceToOpen); + + SafeEventLogWriteHandle handle = SafeEventLogWriteHandle.RegisterEventSource(currentMachineName, sourceName); + if (handle.IsInvalid) + { + Win32Exception e = null; + if (Marshal.GetLastWin32Error() != 0) + { + e = SharedUtils.CreateSafeWin32Exception(); + } + throw new InvalidOperationException(SR.Format(SR.CantOpenLogAccess, sourceName), e); + } + writeHandle = handle; + } + + [ComVisible(false)] + public void RegisterDisplayName(string resourceFile, long resourceId) + { + string currentMachineName = this.machineName; + + using (RegistryKey logkey = GetLogRegKey(currentMachineName, true)) + { + logkey.SetValue("DisplayNameFile", resourceFile, RegistryValueKind.ExpandString); + logkey.SetValue("DisplayNameID", resourceId, RegistryValueKind.DWord); + } + } + + private void Reset(string currentMachineName) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::Reset"); + // save the state we're in now + bool openRead = IsOpenForRead; + bool openWrite = IsOpenForWrite; + bool isMonitoring = boolFlags[Flag_monitoring]; + bool isListening = boolFlags[Flag_registeredAsListener]; + // close everything down + Close(currentMachineName); + cache = null; + // and get us back into the same state as before + if (openRead) + OpenForRead(currentMachineName); + if (openWrite) + OpenForWrite(currentMachineName); + if (isListening) + StartListening(currentMachineName, GetLogName(currentMachineName)); + + boolFlags[Flag_monitoring] = isMonitoring; + } + + [HostProtection(Synchronization = true)] + private static void RemoveListenerComponent(EventLogInternal component, string compLogName) + { + lock (InternalSyncObject) + { + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::RemoveListenerComponent(" + compLogName + ")"); + + LogListeningInfo info = (LogListeningInfo)listenerInfos[compLogName]; + Debug.Assert(info != null); + // remove the requested component from the list. + info.listeningComponents.Remove(component); + if (info.listeningComponents.Count != 0) + return; + // if that was the last interested compononent, destroy the handles and stop listening. + info.handleOwner.Dispose(); + //Unregister the thread pool wait handle + info.registeredWaitHandle.Unregister(info.waitHandle); + // close the handle + info.waitHandle.Close(); + listenerInfos[compLogName] = null; + } + } + + private void StartListening(string currentMachineName, string currentLogName) + { + // make sure we don't fire events for entries that are already there + Debug.Assert(!boolFlags[Flag_registeredAsListener], "StartListening called with boolFlags[Flag_registeredAsListener] true."); + lastSeenCount = EntryCount + OldestEntryNumber; + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::StartListening: lastSeenCount = " + lastSeenCount); + AddListenerComponent(this, currentMachineName, currentLogName); + boolFlags[Flag_registeredAsListener] = true; + } + + private void StartRaisingEvents(string currentMachineName, string currentLogName) + { + if (!boolFlags[Flag_initializing] && !boolFlags[Flag_monitoring] && !parent.ComponentDesignMode) + { + StartListening(currentMachineName, currentLogName); + } + boolFlags[Flag_monitoring] = true; + } + + private static void StaticCompletionCallback(object context, bool wasSignaled) + { + LogListeningInfo info = (LogListeningInfo)context; + if (info == null) + return; + // get a snapshot of the components to fire the event on + EventLogInternal[] interestedComponents; + lock (InternalSyncObject) + { + interestedComponents = (EventLogInternal[])info.listeningComponents.ToArray(typeof(EventLogInternal)); + } + + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::StaticCompletionCallback: notifying " + interestedComponents.Length + " components."); + + for (int i = 0; i < interestedComponents.Length; i++) + { + try + { + if (interestedComponents[i] != null) + { + interestedComponents[i].CompletionCallback(null); + } + } + catch (ObjectDisposedException) + { + // The EventLog that was registered to listen has been disposed. Nothing much we can do here + // we don't want to propigate this error up as it will likely be unhandled and will cause the app + // to crash. + Debug.WriteLineIf(CompModSwitches.EventLog.TraceVerbose, "EventLog::StaticCompletionCallback: ignored an ObjectDisposedException"); + } + } + } + + private void StopListening(/*string currentMachineName,*/ string currentLogName) + { + Debug.Assert(boolFlags[Flag_registeredAsListener], "StopListening called without StartListening."); + RemoveListenerComponent(this, currentLogName); + boolFlags[Flag_registeredAsListener] = false; + } + + private void StopRaisingEvents(/*string currentMachineName,*/ string currentLogName) + { + if (!boolFlags[Flag_initializing] && boolFlags[Flag_monitoring] && !parent.ComponentDesignMode) + { + StopListening(currentLogName); + } + boolFlags[Flag_monitoring] = false; + } + + private static bool CharIsPrintable(char c) + { + UnicodeCategory uc = Char.GetUnicodeCategory(c); + return (!(uc == UnicodeCategory.Control) || (uc == UnicodeCategory.Format) || + (uc == UnicodeCategory.LineSeparator) || (uc == UnicodeCategory.ParagraphSeparator) || + (uc == UnicodeCategory.OtherNotAssigned)); + } + + internal static bool ValidLogName(string logName, bool ignoreEmpty) + { + if (logName.Length == 0 && !ignoreEmpty) + return false; + //any space, backslash, asterisk, or question mark is bad + //any non-printable characters are also bad + foreach (char c in logName) + if (!CharIsPrintable(c) || (c == '\\') || (c == '*') || (c == '?')) + return false; + return true; + } + + private void VerifyAndCreateSource(string sourceName, string currentMachineName) + { + if (boolFlags[Flag_sourceVerified]) + return; + + if (!EventLog.SourceExists(sourceName, currentMachineName, true)) + { + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutex(eventLogMutexName, ref mutex); + if (!EventLog.SourceExists(sourceName, currentMachineName, true)) + { + if (GetLogName(currentMachineName) == null) + this.logName = "Application"; + // we automatically add an entry in the registry if there's not already + // one there for this source + EventLog.CreateEventSource(new EventSourceCreationData(sourceName, GetLogName(currentMachineName), currentMachineName)); + // The user may have set a custom log and tried to read it before trying to + // write. Due to a quirk in the event log API, we would have opened the Application + // log to read (because the custom log wasn't there). Now that we've created + // the custom log, we should close so that when we re-open, we get a read + // handle on the _new_ log instead of the Application log. + Reset(currentMachineName); + } + else + { + string rightLogName = EventLog.LogNameFromSourceName(sourceName, currentMachineName); + string currentLogName = GetLogName(currentMachineName); + if (rightLogName != null && currentLogName != null && String.Compare(rightLogName, currentLogName, StringComparison.OrdinalIgnoreCase) != 0) + throw new ArgumentException(SR.Format(SR.LogSourceMismatch, Source.ToString(), currentLogName, rightLogName)); + } + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + else + { + string rightLogName = EventLog._InternalLogNameFromSourceName(sourceName, currentMachineName); + string currentLogName = GetLogName(currentMachineName); + if (rightLogName != null && currentLogName != null && String.Compare(rightLogName, currentLogName, StringComparison.OrdinalIgnoreCase) != 0) + throw new ArgumentException(SR.Format(SR.LogSourceMismatch, Source.ToString(), currentLogName, rightLogName)); + } + boolFlags[Flag_sourceVerified] = true; + } + + public void WriteEntry(string message) + { + WriteEntry(message, EventLogEntryType.Information, (short)0, 0, null); + } + + public void WriteEntry(string message, EventLogEntryType type) + { + WriteEntry(message, type, (short)0, 0, null); + } + + public void WriteEntry(string message, EventLogEntryType type, int eventID) + { + WriteEntry(message, type, eventID, 0, null); + } + + public void WriteEntry(string message, EventLogEntryType type, int eventID, short category) + { + WriteEntry(message, type, eventID, category, null); + } + + public void WriteEntry(string message, EventLogEntryType type, int eventID, short category, + byte[] rawData) + { + if (eventID < 0 || eventID > ushort.MaxValue) + + throw new ArgumentException(SR.Format(SR.EventID, eventID.ToString(), 0, ushort.MaxValue)); + + if (Source.Length == 0) + throw new ArgumentException(SR.NeedSourceToWrite); + + if (!Enum.IsDefined(typeof(EventLogEntryType), type)) + throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(EventLogEntryType)); + + string currentMachineName = machineName; + if (!boolFlags[Flag_writeGranted]) + { + boolFlags[Flag_writeGranted] = true; + } + VerifyAndCreateSource(sourceName, currentMachineName); + // now that the source has been hooked up to our DLL, we can use "normal" + // (message-file driven) logging techniques. + // Our DLL has 64K different entries; all of them just display the first + // insertion string. + InternalWriteEvent((uint)eventID, (ushort)category, type, new string[] { message }, rawData, currentMachineName); + } + + [ComVisible(false)] + public void WriteEvent(EventInstance instance, params Object[] values) + { + WriteEvent(instance, null, values); + } + + [ComVisible(false)] + public void WriteEvent(EventInstance instance, byte[] data, params Object[] values) + { + if (instance == null) + throw new ArgumentNullException(nameof(instance)); + if (Source.Length == 0) + throw new ArgumentException(SR.NeedSourceToWrite); + + string currentMachineName = machineName; + if (!boolFlags[Flag_writeGranted]) + { + boolFlags[Flag_writeGranted] = true; + } + + VerifyAndCreateSource(Source, currentMachineName); + + string[] strings = null; + + if (values != null) + { + strings = new string[values.Length]; + for (int i = 0; i < values.Length; i++) + { + if (values[i] != null) + strings[i] = values[i].ToString(); + else + strings[i] = String.Empty; + } + } + + InternalWriteEvent((uint)instance.InstanceId, (ushort)instance.CategoryId, instance.EntryType, strings, data, currentMachineName); + } + + private void InternalWriteEvent(uint eventID, ushort category, EventLogEntryType type, string[] strings, + byte[] rawData, string currentMachineName) + { + // check arguments + if (strings == null) + strings = new string[0]; + if (strings.Length >= 256) + throw new ArgumentException(SR.TooManyReplacementStrings); + + for (int i = 0; i < strings.Length; i++) + { + if (strings[i] == null) + strings[i] = String.Empty; + + // make sure the strings aren't too long. MSDN says each string has a limit of 32k (32768) characters, but + // experimentation shows that it doesn't like anything larger than 32766 + if (strings[i].Length > 32766) + throw new ArgumentException(SR.LogEntryTooLong); + } + if (rawData == null) + rawData = new byte[0]; + + if (Source.Length == 0) + throw new ArgumentException(SR.NeedSourceToWrite); + + if (!IsOpenForWrite) + OpenForWrite(currentMachineName); + + // pin each of the strings in memory + IntPtr[] stringRoots = new IntPtr[strings.Length]; + GCHandle[] stringHandles = new GCHandle[strings.Length]; + GCHandle stringsRootHandle = GCHandle.Alloc(stringRoots, GCHandleType.Pinned); + try + { + for (int strIndex = 0; strIndex < strings.Length; strIndex++) + { + stringHandles[strIndex] = GCHandle.Alloc(strings[strIndex], GCHandleType.Pinned); + stringRoots[strIndex] = stringHandles[strIndex].AddrOfPinnedObject(); + } + + byte[] sid = null; + // actually report the event + bool success = UnsafeNativeMethods.ReportEvent(writeHandle, (short)type, category, eventID, + sid, (short)strings.Length, rawData.Length, new HandleRef(this, stringsRootHandle.AddrOfPinnedObject()), rawData); + if (!success) + { + //Trace("WriteEvent", "Throwing Win32Exception"); + throw SharedUtils.CreateSafeWin32Exception(); + } + } + finally + { + // now free the pinned strings + for (int i = 0; i < strings.Length; i++) + { + if (stringHandles[i].IsAllocated) + stringHandles[i].Free(); + } + stringsRootHandle.Free(); + } + } + + private class LogListeningInfo + { + public EventLogInternal handleOwner; + public RegisteredWaitHandle registeredWaitHandle; + public WaitHandle waitHandle; + public ArrayList listeningComponents = new ArrayList(); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventSourceCreationData.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventSourceCreationData.cs new file mode 100644 index 0000000000..30b1529959 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/EventSourceCreationData.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public class EventSourceCreationData + { + private int _categoryCount; + + private EventSourceCreationData() { } + + public EventSourceCreationData(string source, string logName) + { + Source = source; + LogName = logName; + } + + internal EventSourceCreationData(string source, string logName, string machineName) : this(source, logName) + { + MachineName = machineName; + } + + private EventSourceCreationData(string source, string logName, string machineName, + string messageResourceFile, string parameterResourceFile, + string categoryResourceFile, short categoryCount) + : this(source, logName, machineName) + + { + MessageResourceFile = messageResourceFile; + ParameterResourceFile = parameterResourceFile; + CategoryResourceFile = categoryResourceFile; + CategoryCount = categoryCount; + } + + public string LogName { get; set; } = "Application"; + + public string MachineName { get; set; } = "."; + + public string Source { get; set; } + + public string MessageResourceFile { get; set; } + + public string ParameterResourceFile { get; set; } + + public string CategoryResourceFile { get; set; } + + public int CategoryCount + { + get { return _categoryCount; } + set + { + if (value > UInt16.MaxValue || value < 0) + throw new ArgumentOutOfRangeException(nameof(CategoryCount)); + + _categoryCount = value; + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/NativeMethods.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/NativeMethods.cs new file mode 100644 index 0000000000..e911a11e1e --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/NativeMethods.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32 +{ + internal static class NativeMethods + { + public readonly static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); + + public const int WAIT_OBJECT_0 = 0x00000000; + public const int WAIT_TIMEOUT = 0x00000102; + public const int WAIT_ABANDONED = 0x00000080; + public const int SEEK_READ = 0x2; + public const int FORWARDS_READ = 0x4; + public const int BACKWARDS_READ = 0x8; + public const int ERROR_EVENTLOG_FILE_CHANGED = 1503; + public const int ERROR_FILE_NOT_FOUND = 2; + } +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/OverflowAction.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/OverflowAction.cs new file mode 100644 index 0000000000..64648bad7c --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/OverflowAction.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public enum OverflowAction + { + DoNotOverwrite = -1, + OverwriteAsNeeded = 0, + OverwriteOlder = 1, + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs new file mode 100644 index 0000000000..b4bdd084ac --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ + internal sealed class SafeEventLogReadHandle : SafeHandleZeroOrMinusOneIsInvalid + { + internal SafeEventLogReadHandle() : base(true) { } + + [DllImport(Interop.Libraries.Advapi32, CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)] + internal static extern SafeEventLogReadHandle OpenEventLog(string UNCServerName, string sourceName); + + [DllImport(Interop.Libraries.Advapi32, SetLastError = true)] + private static extern bool CloseEventLog(IntPtr hEventLog); + + protected override bool ReleaseHandle() + { + return CloseEventLog(handle); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs new file mode 100644 index 0000000000..9f67581629 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ + internal sealed class SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid + { + internal SafeEventLogWriteHandle() : base(true) { } + + [DllImport(Interop.Libraries.Advapi32, CharSet = System.Runtime.InteropServices.CharSet.Unicode, SetLastError = true)] + internal static extern SafeEventLogWriteHandle RegisterEventSource(string uncServerName, string sourceName); + + [DllImport(Interop.Libraries.Advapi32, SetLastError = true)] + private static extern bool DeregisterEventSource(IntPtr hEventLog); + + protected override bool ReleaseHandle() + { + return DeregisterEventSource(handle); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SharedUtils.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SharedUtils.cs new file mode 100644 index 0000000000..7d6afa5b15 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/SharedUtils.cs @@ -0,0 +1,251 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.AccessControl; +using System.Security.Principal; +using System.Text; +using System.Threading; +using Microsoft.Win32; + +namespace System.Diagnostics +{ + internal static class SharedUtils + { + internal static Win32Exception CreateSafeWin32Exception() + { + return CreateSafeWin32Exception(0); + } + + internal static Win32Exception CreateSafeWin32Exception(int error) + { + Win32Exception newException = null; + if (error == 0) + newException = new Win32Exception(); + else + newException = new Win32Exception(error); + + return newException; + } + + internal static void EnterMutex(string name, ref Mutex mutex) + { + string mutexName = null; + mutexName = "Global\\" + name; + EnterMutexWithoutGlobal(mutexName, ref mutex); + } + + internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex mutex) + { + bool createdNew; + MutexSecurity sec = new MutexSecurity(); + SecurityIdentifier everyoneSid = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null); + //sec.AddAccessRule(new MutexAccessRule(everyoneSid, MutexRights.Synchronize | MutexRights.Modify, AccessControlType.Allow)); + //Mutex tmpMutex = new Mutex(false, mutexName, out createdNew, sec); + Mutex tmpMutex = new Mutex(false, mutexName, out createdNew); + SafeWaitForMutex(tmpMutex, ref mutex); + } + + private static bool SafeWaitForMutex(Mutex mutexIn, ref Mutex mutexOut) + { + Debug.Assert(mutexOut == null, "You must pass in a null ref Mutex"); + while (true) + { + if (!SafeWaitForMutexOnce(mutexIn, ref mutexOut)) + return false; + if (mutexOut != null) + return true; + Thread.Sleep(0); + } + } + + [MethodImplAttribute(MethodImplOptions.NoInlining)] + private static bool SafeWaitForMutexOnce(Mutex mutexIn, ref Mutex mutexOut) + { + bool ret; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { } + finally + { + Thread.BeginCriticalRegion(); + Thread.BeginThreadAffinity(); + int result = Interop.Kernel32.WaitForSingleObject(mutexIn.SafeWaitHandle, 500); + switch (result) + { + case NativeMethods.WAIT_OBJECT_0: + case NativeMethods.WAIT_ABANDONED: + mutexOut = mutexIn; + ret = true; + break; + + case NativeMethods.WAIT_TIMEOUT: + ret = true; + break; + + default: + ret = false; + break; + } + if (mutexOut == null) + { + Thread.EndThreadAffinity(); + Thread.EndCriticalRegion(); + } + } + + return ret; + } + + internal static string GetLatestBuildDllDirectory(string machineName) + { + string dllDir = ""; + RegistryKey baseKey = null; + RegistryKey complusReg = null; + + try + { + if (machineName.Equals(".")) + { + return GetLocalBuildDirectory(); + } + else + { + baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName); + } + if (baseKey == null) + throw new InvalidOperationException(SR.Format(SR.RegKeyMissingShort, "HKEY_LOCAL_MACHINE", machineName)); + + complusReg = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\.NETFramework"); + if (complusReg != null) + { + string installRoot = (string)complusReg.GetValue("InstallRoot"); + if (installRoot != null && installRoot != String.Empty) + { + string versionPrefix = "v" + Environment.Version.Major + "." + Environment.Version.Minor; + RegistryKey policyKey = complusReg.OpenSubKey("policy"); + + string version = null; + + if (policyKey != null) + { + try + { + RegistryKey bestKey = policyKey.OpenSubKey(versionPrefix); + + if (bestKey != null) + { + try + { + version = versionPrefix + "." + GetLargestBuildNumberFromKey(bestKey); + } + finally + { + bestKey.Close(); + } + } + else + { + string[] majorVersions = policyKey.GetSubKeyNames(); + int[] largestVersion = new int[] { -1, -1, -1 }; + for (int i = 0; i < majorVersions.Length; i++) + { + + string majorVersion = majorVersions[i]; + if (majorVersion.Length > 1 && majorVersion[0] == 'v' && majorVersion.Contains(".")) + { + int[] currentVersion = new int[] { -1, -1, -1 }; + + string[] splitVersion = majorVersion.Substring(1).Split('.'); + + if (splitVersion.Length != 2) + { + continue; + } + + if (!Int32.TryParse(splitVersion[0], out currentVersion[0]) || !Int32.TryParse(splitVersion[1], out currentVersion[1])) + { + continue; + } + + RegistryKey k = policyKey.OpenSubKey(majorVersion); + if (k == null) + { + continue; + } + try + { + currentVersion[2] = GetLargestBuildNumberFromKey(k); + + if (currentVersion[0] > largestVersion[0] + || ((currentVersion[0] == largestVersion[0]) && (currentVersion[1] > largestVersion[1]))) + { + largestVersion = currentVersion; + } + } + finally + { + k.Close(); + } + } + } + + version = "v" + largestVersion[0] + "." + largestVersion[1] + "." + largestVersion[2]; + } + } + finally + { + policyKey.Close(); + } + + if (version != null && version != String.Empty) + { + StringBuilder installBuilder = new StringBuilder(); + installBuilder.Append(installRoot); + if (!installRoot.EndsWith("\\", StringComparison.Ordinal)) + installBuilder.Append("\\"); + installBuilder.Append(version); + dllDir = installBuilder.ToString(); + } + } + } + } + } + catch + { + } + finally + { + complusReg?.Close(); + baseKey?.Close(); + } + + return dllDir; + } + + private static int GetLargestBuildNumberFromKey(RegistryKey rootKey) + { + int largestBuild = -1; + + string[] minorVersions = rootKey.GetValueNames(); + for (int i = 0; i < minorVersions.Length; i++) + { + int o; + if (Int32.TryParse(minorVersions[i], out o)) + { + largestBuild = (largestBuild > o) ? largestBuild : o; + } + } + + return largestBuild; + } + + private static string GetLocalBuildDirectory() + { + return RuntimeEnvironment.GetRuntimeDirectory(); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/UnsafeNativeMethods.cs b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/UnsafeNativeMethods.cs new file mode 100644 index 0000000000..7ad718cb18 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/src/System/Diagnostics/UnsafeNativeMethods.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; +using Microsoft.Win32.SafeHandles; + +namespace Microsoft.Win32 +{ + internal static class UnsafeNativeMethods + { + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool ReportEvent(SafeHandle hEventLog, short type, ushort category, + uint eventID, byte[] userSID, short numStrings, int dataLen, HandleRef strings, + byte[] rawData); + + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool ClearEventLog(SafeHandle hEventLog, HandleRef lpctstrBackupFileName); + + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool GetNumberOfEventLogRecords(SafeHandle hEventLog, out int count); + + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool GetOldestEventLogRecord(SafeHandle hEventLog, out int number); + + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ReadEventLog(SafeHandle hEventLog, int dwReadFlags, + int dwRecordOffset, byte[] buffer, int numberOfBytesToRead, out int bytesRead, + out int minNumOfBytesNeeded); + + [DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool NotifyChangeEventLog(SafeHandle hEventLog, SafeWaitHandle hEvent); + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/tests/Configurations.props b/external/corefx/src/System.Diagnostics.EventLog/tests/Configurations.props new file mode 100644 index 0000000000..237253623a --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/tests/Configurations.props @@ -0,0 +1,9 @@ + + + + + netcoreapp-Windows_NT; + netfx; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/tests/EventLogTests/EventLogSourceCreationTests.cs b/external/corefx/src/System.Diagnostics.EventLog/tests/EventLogTests/EventLogSourceCreationTests.cs new file mode 100644 index 0000000000..291b1dc4e1 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/tests/EventLogTests/EventLogSourceCreationTests.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System; + +namespace System.Diagnostics.Tests +{ + public class EventLogSourceCreationTests + { + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void CheckSourceExistenceAndDeletion() + { + if (!AdminHelpers.IsProcessElevated()) + return; + + string source = Guid.NewGuid().ToString("N"); + try + { + EventLog.CreateEventSource(source, "MyNewLog"); + Assert.True(EventLog.SourceExists(source)); + } + finally + { + EventLog.DeleteEventSource(source); + } + + Assert.False(EventLog.SourceExists(source)); + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void CheckSourceExistsArgumentNull() + { + if (!AdminHelpers.IsProcessElevated()) + return; + + Assert.False(EventLog.SourceExists(null)); + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void DeleteUnregisteredSource() + { + if (!AdminHelpers.IsProcessElevated()) + return; + + Assert.Throws(() => EventLog.DeleteEventSource(Guid.NewGuid().ToString("N"))); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.EventLog/tests/EventLogTests/EventLogTests.cs b/external/corefx/src/System.Diagnostics.EventLog/tests/EventLogTests/EventLogTests.cs new file mode 100644 index 0000000000..9c511badc1 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/tests/EventLogTests/EventLogTests.cs @@ -0,0 +1,76 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Diagnostics.Tests +{ + public class EventLogTests + { + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void EventLogReinitializationException() + { + using (EventLog eventLog = new EventLog()) + { + eventLog.BeginInit(); + Assert.Throws(() => eventLog.BeginInit()); + } + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void ClearLogTest() + { + if (!AdminHelpers.IsProcessElevated()) + return; + + string source = Guid.NewGuid().ToString("N"); + string logName = Guid.NewGuid().ToString("N"); + try + { + EventLog.CreateEventSource(source, logName); + using (EventLog myLog = new EventLog()) + { + myLog.Source = source; + myLog.WriteEntry("Writing to event log."); + Assert.True(myLog.Entries.Count != 0); + myLog.Clear(); + Assert.Equal(0, myLog.Entries.Count); + } + } + finally + { + EventLog.DeleteEventSource(source); + } + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void ApplicationEventLog_Count() + { + using ( EventLog ael = new EventLog("Application")) + { + Assert.InRange(ael.Entries.Count, 1, Int32.MaxValue); + } + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + public void DeleteLogTest() + { + if (!AdminHelpers.IsProcessElevated()) + return; + + string source = Guid.NewGuid().ToString("N"); + string logName = Guid.NewGuid().ToString("N"); + try + { + EventLog.CreateEventSource(source, logName); + Assert.True(EventLog.Exists(logName)); + } + finally + { + EventLog.Delete(logName); + Assert.False(EventLog.Exists(logName)); + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.EventLog/tests/System.Diagnostics.EventLog.Tests.csproj b/external/corefx/src/System.Diagnostics.EventLog/tests/System.Diagnostics.EventLog.Tests.csproj new file mode 100644 index 0000000000..4939f9241d --- /dev/null +++ b/external/corefx/src/System.Diagnostics.EventLog/tests/System.Diagnostics.EventLog.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + + + + {5B218883-369E-4C3D-8BD0-74843474DCBD} + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj b/external/corefx/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj index 16c061f977..2e73b2ef8e 100644 --- a/external/corefx/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj @@ -27,9 +27,6 @@ - - Common\System\PlatformDetection.cs - @@ -57,7 +54,7 @@ - + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/System.Diagnostics.PerformanceCounter.sln b/external/corefx/src/System.Diagnostics.PerformanceCounter/System.Diagnostics.PerformanceCounter.sln index e403ccbf88..6eaaa71bf6 100644 --- a/external/corefx/src/System.Diagnostics.PerformanceCounter/System.Diagnostics.PerformanceCounter.sln +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/System.Diagnostics.PerformanceCounter.sln @@ -2,8 +2,22 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.PerformanceCounter.Tests", "tests\System.Diagnostics.PerformanceCounter.Tests.csproj", "{296074B7-1CC9-497E-8C1E-FC5C985C75C6}" + ProjectSection(ProjectDependencies) = postProject + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA} = {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.PerformanceCounter", "src\System.Diagnostics.PerformanceCounter.csproj", "{9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}" + ProjectSection(ProjectDependencies) = postProject + {5BDC8641-E3EE-47B5-BE7B-2D2275402412} = {5BDC8641-E3EE-47B5-BE7B-2D2275402412} + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.PerformanceCounter", "ref\System.Diagnostics.PerformanceCounter.csproj", "{5BDC8641-E3EE-47B5-BE7B-2D2275402412}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}" EndProject Global @@ -12,15 +26,25 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU - {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU - {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU - {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {296074B7-1CC9-497E-8C1E-FC5C985C75C6}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {5BDC8641-E3EE-47B5-BE7B-2D2275402412}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {296074B7-1CC9-497E-8C1E-FC5C985C75C6} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} {5BDC8641-E3EE-47B5-BE7B-2D2275402412} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} EndGlobalSection EndGlobal diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/dir.props b/external/corefx/src/System.Diagnostics.PerformanceCounter/dir.props index 34e3d801bb..54d241f0e4 100644 --- a/external/corefx/src/System.Diagnostics.PerformanceCounter/dir.props +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/dir.props @@ -2,6 +2,7 @@ - 4.0.1.0 + 4.0.0.0 + Open - \ No newline at end of file + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/Configurations.props b/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/Configurations.props index 2845c11c54..2defe17dae 100644 --- a/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/Configurations.props +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/Configurations.props @@ -2,7 +2,8 @@ - netcoreapp; + netfx; + netstandard; - \ No newline at end of file + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.cs index 378c25acd5..802cb179ff 100644 --- a/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.cs +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.cs @@ -5,15 +5,38 @@ // Changes to this file must follow the http://aka.ms/api-review process. // ------------------------------------------------------------------------------ - namespace System.Diagnostics { + public partial class CounterCreationData + { + public CounterCreationData() { } + public CounterCreationData(string counterName, string counterHelp, System.Diagnostics.PerformanceCounterType counterType) { } + public string CounterHelp { get { throw null; } set { } } + public string CounterName { get { throw null; } set { } } + public System.Diagnostics.PerformanceCounterType CounterType { get { throw null; } set { } } + } + public partial class CounterCreationDataCollection : System.Collections.CollectionBase + { + public CounterCreationDataCollection() { } + public CounterCreationDataCollection(System.Diagnostics.CounterCreationDataCollection value) { } + public CounterCreationDataCollection(System.Diagnostics.CounterCreationData[] value) { } + public System.Diagnostics.CounterCreationData this[int index] { get { throw null; } set { } } + public int Add(System.Diagnostics.CounterCreationData value) { throw null; } + public void AddRange(System.Diagnostics.CounterCreationDataCollection value) { } + public void AddRange(System.Diagnostics.CounterCreationData[] value) { } + public bool Contains(System.Diagnostics.CounterCreationData value) { throw null; } + public void CopyTo(System.Diagnostics.CounterCreationData[] array, int index) { } + public int IndexOf(System.Diagnostics.CounterCreationData value) { throw null; } + public void Insert(int index, System.Diagnostics.CounterCreationData value) { } + protected override void OnValidate(object value) { } + public virtual void Remove(System.Diagnostics.CounterCreationData value) { } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct CounterSample { public static System.Diagnostics.CounterSample Empty; - public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType) { throw null; } - public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType, long counterTimeStamp) { throw null; } + public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType) { throw null;} + public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, System.Diagnostics.PerformanceCounterType counterType, long counterTimeStamp) { throw null;} public long BaseValue { get { throw null; } } public long CounterFrequency { get { throw null; } } public long CounterTimeStamp { get { throw null; } } @@ -30,6 +53,44 @@ namespace System.Diagnostics public static bool operator ==(System.Diagnostics.CounterSample a, System.Diagnostics.CounterSample b) { throw null; } public static bool operator !=(System.Diagnostics.CounterSample a, System.Diagnostics.CounterSample b) { throw null; } } + public static partial class CounterSampleCalculator + { + public static float ComputeCounterValue(System.Diagnostics.CounterSample newSample) { throw null; } + public static float ComputeCounterValue(System.Diagnostics.CounterSample oldSample, System.Diagnostics.CounterSample newSample) { throw null; } + } + public partial interface ICollectData + { + void CloseData(); + void CollectData(int id, System.IntPtr valueName, System.IntPtr data, int totalBytes, out System.IntPtr res); + } + public partial class InstanceData + { + public InstanceData(string instanceName, System.Diagnostics.CounterSample sample) { } + public string InstanceName { get { throw null; } } + public long RawValue { get { throw null; } } + public System.Diagnostics.CounterSample Sample { get { throw null; } } + } + public partial class InstanceDataCollection : System.Collections.DictionaryBase + { + [System.ObsoleteAttribute("This constructor has been deprecated. Please use System.Diagnostics.InstanceDataCollectionCollection.get_Item to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public InstanceDataCollection(string counterName) { } + public string CounterName { get { throw null; } } + public System.Diagnostics.InstanceData this[string instanceName] { get { throw null; } } + public System.Collections.ICollection Keys { get { throw null; } } + public System.Collections.ICollection Values { get { throw null; } } + public bool Contains(string instanceName) { throw null; } + public void CopyTo(System.Diagnostics.InstanceData[] instances, int index) { } + } + public partial class InstanceDataCollectionCollection : System.Collections.DictionaryBase + { + [System.ObsoleteAttribute("This constructor has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.ReadCategory() to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public InstanceDataCollectionCollection() { } + public System.Diagnostics.InstanceDataCollection this[string counterName] { get { throw null; } } + public System.Collections.ICollection Keys { get { throw null; } } + public System.Collections.ICollection Values { get { throw null; } } + public bool Contains(string counterName) { throw null; } + public void CopyTo(System.Diagnostics.InstanceDataCollection[] counters, int index) { } + } public sealed partial class PerformanceCounter : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize { [System.ObsoleteAttribute("This field has been deprecated and is not used. Use machine.config or an application configuration file to set the size of the PerformanceCounter file mapping.")] @@ -40,25 +101,20 @@ namespace System.Diagnostics public PerformanceCounter(string categoryName, string counterName, string instanceName) { } public PerformanceCounter(string categoryName, string counterName, string instanceName, bool readOnly) { } public PerformanceCounter(string categoryName, string counterName, string instanceName, string machineName) { } - [System.ComponentModel.DefaultValueAttribute("")] public string CategoryName { get { throw null; } set { } } public string CounterHelp { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute("")] public string CounterName { get { throw null; } set { } } public System.Diagnostics.PerformanceCounterType CounterType { get { throw null; } } - [System.ComponentModel.DefaultValueAttribute((System.Diagnostics.PerformanceCounterInstanceLifetime)(0))] public System.Diagnostics.PerformanceCounterInstanceLifetime InstanceLifetime { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute("")] public string InstanceName { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(".")] public string MachineName { get { throw null; } set { } } public long RawValue { get { throw null; } set { } } - [System.ComponentModel.DefaultValueAttribute(true)] public bool ReadOnly { get { throw null; } set { } } public void BeginInit() { } public void Close() { } public static void CloseSharedResources() { } - public long Decrement() { return default(long); } + public long Decrement() { throw null; } + protected override void Dispose(bool disposing) { } public void EndInit() { } public long Increment() { throw null; } public long IncrementBy(long value) { throw null; } @@ -66,11 +122,57 @@ namespace System.Diagnostics public float NextValue() { throw null; } public void RemoveInstance() { } } + public sealed partial class PerformanceCounterCategory + { + public PerformanceCounterCategory() { } + public PerformanceCounterCategory(string categoryName) { } + public PerformanceCounterCategory(string categoryName, string machineName) { } + public string CategoryHelp { get { throw null; } } + public string CategoryName { get { throw null; } set { } } + public System.Diagnostics.PerformanceCounterCategoryType CategoryType { get { throw null; } } + public string MachineName { get { throw null; } set { } } + public bool CounterExists(string counterName) { throw null; } + public static bool CounterExists(string counterName, string categoryName) { throw null; } + public static bool CounterExists(string counterName, string categoryName, string machineName) { throw null; } + [System.ObsoleteAttribute("This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.CounterCreationDataCollection counterData) { throw null; } + public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.PerformanceCounterCategoryType categoryType, System.Diagnostics.CounterCreationDataCollection counterData) { throw null; } + public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, System.Diagnostics.PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) { throw null; } + [System.ObsoleteAttribute("This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public static System.Diagnostics.PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp) { throw null; } + public static void Delete(string categoryName) { } + public static bool Exists(string categoryName) { throw null; } + public static bool Exists(string categoryName, string machineName) { throw null; } + public static System.Diagnostics.PerformanceCounterCategory[] GetCategories() { throw null; } + public static System.Diagnostics.PerformanceCounterCategory[] GetCategories(string machineName) { throw null; } + public System.Diagnostics.PerformanceCounter[] GetCounters() { throw null; } + public System.Diagnostics.PerformanceCounter[] GetCounters(string instanceName) { throw null; } + public string[] GetInstanceNames() { throw null; } + public bool InstanceExists(string instanceName) { throw null; } + public static bool InstanceExists(string instanceName, string categoryName) { throw null; } + public static bool InstanceExists(string instanceName, string categoryName, string machineName) { throw null; } + public System.Diagnostics.InstanceDataCollectionCollection ReadCategory() { throw null; } + } + public enum PerformanceCounterCategoryType + { + MultiInstance = 1, + SingleInstance = 0, + Unknown = -1, + } public enum PerformanceCounterInstanceLifetime { Global = 0, Process = 1, } + public sealed partial class PerformanceCounterManager : System.Diagnostics.ICollectData + { + [System.ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public PerformanceCounterManager() { } + [System.ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")] + void System.Diagnostics.ICollectData.CloseData() { } + [System.ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")] + void System.Diagnostics.ICollectData.CollectData(int callIdx, System.IntPtr valueNamePtr, System.IntPtr dataPtr, int totalBytes, out System.IntPtr res) { res = default(System.IntPtr); } + } public enum PerformanceCounterType { AverageBase = 1073939458, diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj b/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj index e5cf52151c..7d48996228 100644 --- a/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj @@ -2,18 +2,19 @@ + true {5BDC8641-E3EE-47B5-BE7B-2D2275402412} - - + + + + - - Component - + - - - + + + - \ No newline at end of file + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/Configurations.props b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/Configurations.props new file mode 100644 index 0000000000..2155a36057 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/Configurations.props @@ -0,0 +1,10 @@ + + + + + netcoreapp-Windows_NT; + netstandard; + netfx; + + + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/Resources/Strings.resx b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/Resources/Strings.resx new file mode 100644 index 0000000000..8c7c8cf25f --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/Resources/Strings.resx @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Invalid value '{1}' for parameter '{0}'. + + + Cannot load Category Help data because an invalid index '{0}' was read from the registry. + + + Cannot load Counter Name data because an invalid index '{0}' was read from the registry. + + + Cannot load Performance Counter data because an unexpected registry key value type was read from '{0}'. + + + Instance names used for writing to custom counters must be 127 characters or less. + + + PerformanceCounterInstanceLifetime.Process is not valid in the global shared memory. If your performance counter category was created with an older version of the Framework, it uses the global shared memory. Either use PerformanceCounterInstanceLifetime.Global, or if applications running on older versions of the Framework do not need to write to your category, delete and recreate it. + + + Custom counters file view is out of memory. + + + Cannot continue the current operation, the performance counters memory mapping has been corrupted. + + + Category '{0}' is marked as single-instance. Performance counters in this category can only be created without instance names. + + + Category '{0}' is marked as multi-instance. Performance counters in this category can only be created with instance names. + + + An instance with a lifetime of Process can only be accessed from a PerformanceCounter with the InstanceLifetime set to PerformanceCounterInstanceLifetime.Process. + + + An instance with a lifetime of Global can only be accessed from a PerformanceCounter with the InstanceLifetime set to PerformanceCounterInstanceLifetime.Global. + + + Instance '{0}' already exists with a lifetime of Process. It cannot be recreated or reused until it has been removed or until the process using it has exited. + + + Cannot access shared memory, AppDomain has been unloaded. + + + Cannot initialize security descriptor initialized. + + + Cannot create file mapping. + + + Cannot map view of file. + + + MismatchedCounterTypes=Mismatched counter types. + + + There was an error calculating the PerformanceCounter value (0x{0}). + + + Only objects of type CounterCreationData can be added to a CounterCreationDataCollection. + + + Instance '{0}' does not exist in the specified Category. + + + Could not Read Category Index: {0}. + + + Category does not exist. + + + The Counter layout for the Category specified is invalid, a counter of the type: AverageCount64, AverageTimer32, CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, CounterMultiTimer100NsInverse, RawFraction, or SampleFraction has to be immediately followed by any of the base counter types: AverageBase, CounterMultiBase, RawBase or SampleBase. + + + Counter '{0}' does not exist in the specified Category. + + + Help Not Available + + + Category {0} does not exist. + + + Counter {0} does not exist. + + + Cannot create or delete the Performance Category '{0}' because access is denied. + + + Invalid value {1} for property {0}. + + + Category name property has not been set. + + + Cannot create Performance Category '{0}' because it already exists. + + + Invalid category name. Its length must be in the range between '{0}' and '{1}'. Double quotes, control characters and leading or trailing spaces are not allowed. + + + Category names must be 1024 characters or less. + + + Invalid counter name. Its length must be in the range between '{0}' and '{1}'. Double quotes, control characters and leading or trailing spaces are not allowed. + + + Invalid help string. Its length must be in the range between '{0}' and '{1}'. + + + Invalid empty or null string for counter name. + + + Cannot create Performance Category with counter name {0} because the name is a duplicate. + + + Cannot delete Performance Category because this category is not registered or is a system category. + + + Counter is not single instance, an instance name needs to be specified. + + + Instance {0} does not exist in category {1}. + + + The InstanceLifetime cannot be set after the instance has been initialized. You must use the default constructor and set the CategoryName, InstanceName, CounterName, InstanceLifetime and ReadOnly properties manually before setting the RawValue. + + + Cannot update Performance Counter, this object has been initialized as ReadOnly. + + + Writeable performance counters are not allowed when running in AppContainer. + + + Failed to initialize because CategoryName is missing. + + + Failed to initialize because CounterName is missing. + + + InstanceLifetime is unused by ReadOnly counters. + + + Cannot write to a Performance Counter in a remote machine. + + + The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly. + + + Single instance categories are only valid with the Global lifetime. + + + Counter is single instance, instance name '{0}' is not valid for this counter category. + + + Cannot remove Performance Counter Instance, this object as been initialized as ReadOnly. + + + Could not locate Performance Counter with specified category name '{0}', counter name '{1}'. + + + Cannot initialize security descriptor initialized. + + + Cannot open registry key {0} on computer {1}. + + + Cannot calculate the size of the file view. + + + Cannot read Category {0}. + + + Performance Counters are not supported on this platform. + + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj new file mode 100644 index 0000000000..59c23e2300 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj @@ -0,0 +1,178 @@ + + + + + AnyCPU + {9758106C-5D4E-475D-B5E7-B7ABC46B1DDA} + System.Diagnostics.PerformanceCounter + System.Diagnostics.PerformanceCounter + $(DefineConstants);FEATURE_REGISTRY + true + true + SR.PlatformNotSupported_PerfCounters + false + + + + + + + + + + + + + + + + + + + + Component + + + + + + + + + + + + + + Common\Interop\Windows\Interop.BOOL.cs + + + Common\Interop\Windows\Interop.Errors.cs + + + Common\Interop\Windows\Interop.Libraries.cs + + + Common\Interop\Windows\advapi32\Interop.ConvertStringSecurityDescriptorToSecurityDescriptor.cs + + + Common\Interop\Windows\advapi32\Interop.GetTokenInformation.cs + + + Common\Interop\Windows\advapi32\Interop.PERF_INFO.cs + + + Common\Interop\Windows\advapi32\Interop.ProcessOptions.cs + + + Common\Interop\Windows\advapi32\Interop.TOKEN_INFORMATION_CLASS.cs + + + Common\Interop\Windows\kernel32\Interop.CreateFileMapping.cs + + + Common\Interop\Windows\kernel32\Interop.DuplicateHandle.cs + + + Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs + + + Common\Interop\Windows\kernel32\Interop.GetComputerName.cs + + + Common\Interop\Windows\kernel32\Interop.GetCurrentProcess.cs + + + Common\Interop\Windows\kernel32\Interop.GetCurrentProcessId.cs + + + Common\Interop\Windows\kernel32\Interop.GetProcessTimes.cs + + + Common\Interop\Windows\kernel32\Interop.HandleOptions.cs + + + Common\Interop\Windows\kernel32\Interop.LoadLibrary.cs + + + Common\Interop\Windows\kernel32\Interop.LocalAlloc.cs + + + Common\Interop\Windows\kernel32\Interop.LocalAlloc.Constants.cs + + + Common\Interop\Windows\kernel32\Interop.LocalFree.cs + + + Common\Interop\Windows\kernel32\Interop.MapViewOfFile.cs + + + Common\Interop\Windows\kernel32\Interop.MemOptions.cs + + + Common\Interop\Windows\kernel32\Interop.MEMORY_BASIC_INFO.cs + + + Common\Interop\Windows\kernel32\Interop.OpenFileMapping.cs + + + Common\Interop\Windows\kernel32\Interop.OpenProcess.cs + + + Common\Interop\Windows\kernel32\Interop.PerformanceCounterOptions.cs + + + Common\Interop\Windows\kernel32\Interop.ProcessWaitHandle.cs + + + Common\Interop\Windows\kernel32\Interop.SECURITY_ATTRIBUTES.cs + + + Common\Interop\Windows\kernel32\Interop.UnmapViewOfFile.cs + + + Common\Interop\Windows\kernel32\Interop.VirtualQuery.cs + + + Common\Interop\Windows\kernel32\Interop.WaitForSingleObject.cs + + + Common\Interop\Windows\perfcounter\Interop.FormatFromRawValue.cs + + + Common\Microsoft\Win32\SafeHandles\SafeLocalAllocHandle.cs + + + Common\Microsoft\Win32\SafeHandles\SafeLocalMemHandle.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterCreationData.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterCreationData.cs new file mode 100644 index 0000000000..9fad36a1f2 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterCreationData.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; + +namespace System.Diagnostics +{ + /// + /// A class defining the counter type, name and help string for a custom counter. + /// + public class CounterCreationData + { + private PerformanceCounterType _counterType = PerformanceCounterType.NumberOfItems32; + private string _counterName = string.Empty; + private string _counterHelp = string.Empty; + + public CounterCreationData() + { + } + + public CounterCreationData(string counterName, string counterHelp, PerformanceCounterType counterType) + { + CounterType = counterType; + CounterName = counterName; + CounterHelp = counterHelp; + } + + public PerformanceCounterType CounterType + { + get + { + return _counterType; + } + set + { + if (!Enum.IsDefined(typeof(PerformanceCounterType), value)) + throw new InvalidEnumArgumentException(nameof(PerformanceCounterType), (int)value, typeof(PerformanceCounterType)); + + _counterType = value; + } + } + + public string CounterName + { + get + { + return _counterName; + } + set + { + PerformanceCounterCategory.CheckValidCounter(value); + _counterName = value; + } + } + + public string CounterHelp + { + get + { + return _counterHelp; + } + set + { + PerformanceCounterCategory.CheckValidHelp(value); + _counterHelp = value; + } + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterCreationDataCollection.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterCreationDataCollection.cs new file mode 100644 index 0000000000..89ab073b8e --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterCreationDataCollection.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; + +namespace System.Diagnostics +{ + public class CounterCreationDataCollection : CollectionBase + { + public CounterCreationDataCollection() + { + } + + public CounterCreationDataCollection(CounterCreationDataCollection value) + { + AddRange(value); + } + + public CounterCreationDataCollection(CounterCreationData[] value) + { + AddRange(value); + } + + public CounterCreationData this[int index] + { + get + { + return ((CounterCreationData)(List[index])); + } + set + { + List[index] = value; + } + } + + public int Add(CounterCreationData value) + { + return List.Add(value); + } + + public void AddRange(CounterCreationData[] value) + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + for (int i = 0; i < value.Length; i++) + { + Add(value[i]); + } + } + + public void AddRange(CounterCreationDataCollection value) + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + int currentCount = value.Count; + for (int i = 0; i < currentCount; i++) + { + Add(value[i]); + } + } + + public bool Contains(CounterCreationData value) + { + return List.Contains(value); + } + + public void CopyTo(CounterCreationData[] array, int index) + { + List.CopyTo(array, index); + } + + public int IndexOf(CounterCreationData value) + { + return List.IndexOf(value); + } + + public void Insert(int index, CounterCreationData value) + { + List.Insert(index, value); + } + + public virtual void Remove(CounterCreationData value) + { + List.Remove(value); + } + + protected override void OnValidate(object value) + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + + if (!(value is CounterCreationData)) + throw new ArgumentException(SR.Format(SR.MustAddCounterCreationData)); + } + + } +} + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs new file mode 100644 index 0000000000..3bffd3de1c --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSample.cs @@ -0,0 +1,192 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + /// + /// A struct holding the raw data for a performance counter. + /// + public struct CounterSample + { + private readonly long _rawValue; + private readonly long _baseValue; + private readonly long _timeStamp; + private readonly long _counterFrequency; + private readonly PerformanceCounterType _counterType; + private readonly long _timeStamp100nSec; + private readonly long _systemFrequency; + private readonly long _counterTimeStamp; + + public static CounterSample Empty = new CounterSample(0, 0, 0, 0, 0, 0, PerformanceCounterType.NumberOfItems32); + + public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, PerformanceCounterType counterType) + { + _rawValue = rawValue; + _baseValue = baseValue; + _timeStamp = timeStamp; + _counterFrequency = counterFrequency; + _counterType = counterType; + _timeStamp100nSec = timeStamp100nSec; + _systemFrequency = systemFrequency; + _counterTimeStamp = 0; + } + + public CounterSample(long rawValue, long baseValue, long counterFrequency, long systemFrequency, long timeStamp, long timeStamp100nSec, PerformanceCounterType counterType, long counterTimeStamp) + { + _rawValue = rawValue; + _baseValue = baseValue; + _timeStamp = timeStamp; + _counterFrequency = counterFrequency; + _counterType = counterType; + _timeStamp100nSec = timeStamp100nSec; + _systemFrequency = systemFrequency; + _counterTimeStamp = counterTimeStamp; + } + + /// + /// Raw value of the counter. + /// + public long RawValue + { + get + { + return _rawValue; + } + } + + internal ulong UnsignedRawValue + { + get + { + return (ulong)_rawValue; + } + } + + /// + /// Optional base raw value for the counter (only used if multiple counter based). + /// + public long BaseValue + { + get + { + return _baseValue; + } + } + + /// + /// Raw system frequency + /// + public long SystemFrequency + { + get + { + return _systemFrequency; + } + } + + /// + /// Raw counter frequency + /// + public long CounterFrequency + { + get + { + return _counterFrequency; + } + } + + /// + /// Raw counter frequency + /// + public long CounterTimeStamp + { + get + { + return _counterTimeStamp; + } + } + + /// + /// Raw timestamp + /// + public long TimeStamp + { + get + { + return _timeStamp; + } + } + + /// + /// Raw high fidelity timestamp + /// + public long TimeStamp100nSec + { + get + { + return _timeStamp100nSec; + } + } + + /// + /// Counter type + /// + public PerformanceCounterType CounterType + { + get + { + return _counterType; + } + } + + /// + /// Static functions to calculate the performance value off the sample + /// + public static float Calculate(CounterSample counterSample) + { + return CounterSampleCalculator.ComputeCounterValue(counterSample); + } + + /// + /// Static functions to calculate the performance value off the samples + /// + public static float Calculate(CounterSample counterSample, CounterSample nextCounterSample) + { + return CounterSampleCalculator.ComputeCounterValue(counterSample, nextCounterSample); + } + + public override bool Equals(Object o) + { + return (o is CounterSample) && Equals((CounterSample)o); + } + + public bool Equals(CounterSample sample) + { + return (_rawValue == sample._rawValue) && + (_baseValue == sample._baseValue) && + (_timeStamp == sample._timeStamp) && + (_counterFrequency == sample._counterFrequency) && + (_counterType == sample._counterType) && + (_timeStamp100nSec == sample._timeStamp100nSec) && + (_systemFrequency == sample._systemFrequency) && + (_counterTimeStamp == sample._counterTimeStamp); + } + + public override int GetHashCode() + { + return _rawValue.GetHashCode(); + } + + public static bool operator ==(CounterSample a, CounterSample b) + { + return a.Equals(b); + } + + public static bool operator !=(CounterSample a, CounterSample b) + { + return !(a.Equals(b)); + } + + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSampleCalculator.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSampleCalculator.cs new file mode 100644 index 0000000000..e4a47a7448 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/CounterSampleCalculator.cs @@ -0,0 +1,250 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.IO; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using System.Globalization; + +namespace System.Diagnostics +{ + /// + /// Set of utility functions for interpreting the counter data + /// + public static class CounterSampleCalculator + { + private static volatile bool s_perfCounterDllLoaded = false; + + /// + /// Converts 100NS elapsed time to fractional seconds + /// + /// + private static float GetElapsedTime(CounterSample oldSample, CounterSample newSample) + { + float eSeconds; + float eDifference; + + if (newSample.RawValue == 0) + { + // no data [start time = 0] so return 0 + return 0.0f; + } + else + { + float eFreq; + eFreq = (float)(ulong)oldSample.CounterFrequency; + + if (oldSample.UnsignedRawValue >= (ulong)newSample.CounterTimeStamp || eFreq <= 0.0f) + return 0.0f; + + // otherwise compute difference between current time and start time + eDifference = (float)((ulong)newSample.CounterTimeStamp - oldSample.UnsignedRawValue); + + // convert to fractional seconds using object counter + eSeconds = eDifference / eFreq; + + return eSeconds; + } + } + + /// + /// Computes the calculated value given a raw counter sample. + /// + public static float ComputeCounterValue(CounterSample newSample) + { + return ComputeCounterValue(CounterSample.Empty, newSample); + } + + /// + /// Computes the calculated value given a raw counter sample. + /// + public static float ComputeCounterValue(CounterSample oldSample, CounterSample newSample) + { + int newCounterType = (int)newSample.CounterType; + if (oldSample.SystemFrequency == 0) + { + if ((newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) && + (newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT) && + (newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX) && + (newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT) && + (newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX) && + (newCounterType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE)) + { + + // Since oldSample has a system frequency of 0, this means the newSample is the first sample + // on a two sample calculation. Since we can't do anything with it, return 0. + return 0.0f; + } + } + else if (oldSample.CounterType != newSample.CounterType) + { + throw new InvalidOperationException(SR.Format(SR.MismatchedCounterTypes)); + } + + if (newCounterType == Interop.Kernel32.PerformanceCounterOptions.PERF_ELAPSED_TIME) + return (float)GetElapsedTime(oldSample, newSample); + + Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER newPdhValue = new Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER(); + Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER oldPdhValue = new Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER(); + + FillInValues(oldSample, newSample, oldPdhValue, newPdhValue); + + LoadPerfCounterDll(); + + Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE pdhFormattedValue = new Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_COUNTERVALUE(); + long timeBase = newSample.SystemFrequency; + int result = Interop.PerfCounter.FormatFromRawValue((uint)newCounterType, Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_DOUBLE | Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_NOSCALE | Interop.Kernel32.PerformanceCounterOptions.PDH_FMT_NOCAP100, + ref timeBase, newPdhValue, oldPdhValue, pdhFormattedValue); + + if (result != Interop.Errors.ERROR_SUCCESS) + { + // If the numbers go negative, just return 0. This better matches the old behavior. + if (result == Interop.Kernel32.PerformanceCounterOptions.PDH_CALC_NEGATIVE_VALUE || result == Interop.Kernel32.PerformanceCounterOptions.PDH_CALC_NEGATIVE_DENOMINATOR || result == Interop.Kernel32.PerformanceCounterOptions.PDH_NO_DATA) + return 0; + else + throw new Win32Exception(result, SR.Format(SR.PerfCounterPdhError, result.ToString("x", CultureInfo.InvariantCulture))); + } + + return (float)pdhFormattedValue.data; + + } + + // This method figures out which values are supposed to go into which structures so that PDH can do the + // calculation for us. This was ported from Window's cutils.c + private static void FillInValues(CounterSample oldSample, CounterSample newSample, Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER oldPdhValue, Interop.Kernel32.PerformanceCounterOptions.PDH_RAW_COUNTER newPdhValue) + { + int newCounterType = (int)newSample.CounterType; + + switch (newCounterType) + { + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_COUNTER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_QUEUELEN_TYPE: + case Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_COUNTER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_OBJ_TIME_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE: + newPdhValue.FirstValue = newSample.RawValue; + newPdhValue.SecondValue = newSample.TimeStamp; + + oldPdhValue.FirstValue = oldSample.RawValue; + oldPdhValue.SecondValue = oldSample.TimeStamp; + break; + + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_100NS_QUEUELEN_TYPE: + newPdhValue.FirstValue = newSample.RawValue; + newPdhValue.SecondValue = newSample.TimeStamp100nSec; + + oldPdhValue.FirstValue = oldSample.RawValue; + oldPdhValue.SecondValue = oldSample.TimeStamp100nSec; + break; + + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER_INV: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_BULK_COUNT: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_QUEUELEN_TYPE: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV: + newPdhValue.FirstValue = newSample.RawValue; + newPdhValue.SecondValue = newSample.TimeStamp; + + oldPdhValue.FirstValue = oldSample.RawValue; + oldPdhValue.SecondValue = oldSample.TimeStamp; + if (newCounterType == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER || newCounterType == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV) + { + // this is to make PDH work like PERFMON for + // this counter type + newPdhValue.FirstValue *= (uint)newSample.CounterFrequency; + if (oldSample.CounterFrequency != 0) + { + oldPdhValue.FirstValue *= (uint)oldSample.CounterFrequency; + } + } + + if ((newCounterType & Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) == Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) + { + newPdhValue.MultiCount = (int)newSample.BaseValue; + oldPdhValue.MultiCount = (int)oldSample.BaseValue; + } + + break; + // + // These counters do not use any time reference + // + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_DELTA: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX: + case Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_DELTA: + newPdhValue.FirstValue = newSample.RawValue; + newPdhValue.SecondValue = 0; + + oldPdhValue.FirstValue = oldSample.RawValue; + oldPdhValue.SecondValue = 0; + break; + // + // These counters use the 100 Ns time base in thier calculation + // + case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER_INV: + case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV: + newPdhValue.FirstValue = newSample.RawValue; + newPdhValue.SecondValue = newSample.TimeStamp100nSec; + + oldPdhValue.FirstValue = oldSample.RawValue; + oldPdhValue.SecondValue = oldSample.TimeStamp100nSec; + if ((newCounterType & Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) == Interop.Kernel32.PerformanceCounterOptions.PERF_MULTI_COUNTER) + { + newPdhValue.MultiCount = (int)newSample.BaseValue; + oldPdhValue.MultiCount = (int)oldSample.BaseValue; + } + break; + // + // These counters use two data points + // + case Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION: + case Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION: + case Interop.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_FRACTION: + case Interop.Kernel32.PerformanceCounterOptions.PERF_PRECISION_SYSTEM_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_PRECISION_100NS_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_PRECISION_OBJECT_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER: + case Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK: + newPdhValue.FirstValue = newSample.RawValue; + newPdhValue.SecondValue = newSample.BaseValue; + + oldPdhValue.FirstValue = oldSample.RawValue; + oldPdhValue.SecondValue = oldSample.BaseValue; + break; + + default: + // an unidentified counter was returned so + newPdhValue.FirstValue = 0; + newPdhValue.SecondValue = 0; + + oldPdhValue.FirstValue = 0; + oldPdhValue.SecondValue = 0; + break; + } + } + + private static void LoadPerfCounterDll() + { + if (s_perfCounterDllLoaded) + return; + + new FileIOPermission(PermissionState.Unrestricted).Assert(); + + string installPath = SharedUtils.GetLatestBuildDllDirectory("."); + string perfcounterPath = Path.Combine(installPath, "perfcounter.dll"); + if (Interop.Kernel32.LoadLibrary(perfcounterPath) == IntPtr.Zero) + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } + + s_perfCounterDllLoaded = true; + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/DiagnosticsConfiguration.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/DiagnosticsConfiguration.cs new file mode 100644 index 0000000000..b44b4fd20b --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/DiagnosticsConfiguration.cs @@ -0,0 +1,105 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Reflection; +using System.Configuration; + +namespace System.Diagnostics +{ + internal enum InitState + { + NotInitialized, + Initializing, + Initialized + } + + internal static class DiagnosticsConfiguration + { + private static volatile SystemDiagnosticsSection s_configSection; + private static volatile InitState s_initState = InitState.NotInitialized; + + internal static int PerformanceCountersFileMappingSize + { + get + { + for (int retryCount = 0; !CanInitialize() && retryCount <= 5; ++retryCount) + { + if (retryCount == 5) + return SharedPerformanceCounter.DefaultCountersFileMappingSize; + + System.Threading.Thread.Sleep(200); + } + + Initialize(); + SystemDiagnosticsSection configSectionSav = s_configSection; + if (configSectionSav != null && configSectionSav.PerfCounters != null) + { + int size = configSectionSav.PerfCounters.FileMappingSize; + if (size < SharedPerformanceCounter.MinCountersFileMappingSize) + size = SharedPerformanceCounter.MinCountersFileMappingSize; + + if (size > SharedPerformanceCounter.MaxCountersFileMappingSize) + size = SharedPerformanceCounter.MaxCountersFileMappingSize; + + return size; + } + else + return SharedPerformanceCounter.DefaultCountersFileMappingSize; + } + } + + internal static string ConfigFilePath + { + get + { + Initialize(); + SystemDiagnosticsSection configSectionSav = s_configSection; + return configSectionSav?.ElementInformation?.Source ?? string.Empty; + } + } + + private static SystemDiagnosticsSection GetConfigSection() + { + SystemDiagnosticsSection configSection = (SystemDiagnosticsSection)ConfigurationManager.GetSection("system.diagnostics"); + return configSection; + } + + internal static bool CanInitialize() + { + bool setConfigurationSystemInProgress = (bool)(typeof(ConfigurationManager).GetProperty("SetConfigurationSystemInProgress", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null)); + return (s_initState != InitState.Initializing) && !setConfigurationSystemInProgress; + } + + internal static void Initialize() + { + // Initialize() is also called by other components outside of Trace (such as PerformanceCounter) + // as a result using one lock for this critical section and another for Trace API critical sections + // (such as Trace.WriteLine) could potentially lead to deadlock between 2 threads that are + // executing these critical sections (and consequently obtaining the 2 locks) in the reverse order. + // Using the same lock for DiagnosticsConfiguration as well as TraceInternal avoids this issue. + // Sequential locks on TraceInternal.critSec by the same thread is a non issue for this critical section. + lock (TraceInternal.critSec) + { + // because some of the code used to load config also uses diagnostics + // we can't block them while we initialize from config. Therefore we just + // return immediately and they just use the default values. + bool setConfigurationSystemInProgress = (bool)(typeof(ConfigurationManager).GetProperty("SetConfigurationSystemInProgress", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null)); + if (s_initState != InitState.NotInitialized || setConfigurationSystemInProgress) + { + return; + } + + s_initState = InitState.Initializing; // used for preventing recursion + try + { + s_configSection = GetConfigSection(); + } + finally + { + s_initState = InitState.Initialized; + } + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/ICollectData.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/ICollectData.cs new file mode 100644 index 0000000000..8c70cca440 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/ICollectData.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace System.Diagnostics +{ + /// + [ComImport, Guid("73386977-D6FD-11D2-BED5-00C04F79E3AE"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] + public interface ICollectData + { + [return: MarshalAs(UnmanagedType.I4)] + void CollectData( + [In, MarshalAs(UnmanagedType.I4 )] + int id, + [In, MarshalAs(UnmanagedType.SysInt )] + IntPtr valueName, + [In, MarshalAs(UnmanagedType.SysInt )] + IntPtr data, + [In, MarshalAs(UnmanagedType.I4 )] + int totalBytes, + [Out, MarshalAs(UnmanagedType.SysInt)] + out IntPtr res); + + void CloseData(); + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceData.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceData.cs new file mode 100644 index 0000000000..e3e3b3105c --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceData.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + /// + /// A holder of instance data. + /// + public class InstanceData + { + public InstanceData(string instanceName, CounterSample sample) + { + InstanceName = instanceName; + Sample = sample; + } + + public string InstanceName { get; } + + public CounterSample Sample { get; } + + public long RawValue + { + get + { + return Sample.RawValue; + } + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceDataCollection.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceDataCollection.cs new file mode 100644 index 0000000000..c4100329c3 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceDataCollection.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Globalization; + +namespace System.Diagnostics +{ + /// + /// A collection containing all the instance data for a counter. This collection is contained in the + /// when using the + /// method. + /// + public class InstanceDataCollection : DictionaryBase + { + [Obsolete("This constructor has been deprecated. Please use System.Diagnostics.InstanceDataCollectionCollection.get_Item to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public InstanceDataCollection(string counterName) + { + if (counterName == null) + throw new ArgumentNullException(nameof(counterName)); + CounterName = counterName; + } + + public string CounterName { get; } + + public ICollection Keys + { + get { return Dictionary.Keys; } + } + + public ICollection Values + { + get + { + return Dictionary.Values; + } + } + + public InstanceData this[string instanceName] + { + get + { + if (instanceName == null) + throw new ArgumentNullException(nameof(instanceName)); + + if (instanceName.Length == 0) + instanceName = PerformanceCounterLib.SingleInstanceName; + + string objectName = instanceName.ToLower(CultureInfo.InvariantCulture); + return (InstanceData)Dictionary[objectName]; + } + } + + internal void Add(string instanceName, InstanceData value) + { + string objectName = instanceName.ToLower(CultureInfo.InvariantCulture); + Dictionary.Add(objectName, value); + } + + public bool Contains(string instanceName) + { + if (instanceName == null) + throw new ArgumentNullException(nameof(instanceName)); + + string objectName = instanceName.ToLower(CultureInfo.InvariantCulture); + return Dictionary.Contains(objectName); + } + + public void CopyTo(InstanceData[] instances, int index) + { + Dictionary.Values.CopyTo(instances, index); + } + } +} + + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceDataCollectionCollection.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceDataCollectionCollection.cs new file mode 100644 index 0000000000..f0172c2077 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/InstanceDataCollectionCollection.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Globalization; + +namespace System.Diagnostics +{ + /// + /// The collection returned from the method. + /// that contains all the counter and instance data. + /// The collection contains an InstanceDataCollection object for each counter. Each InstanceDataCollection + /// object contains the performance data for all counters for that instance. In other words the data is + /// indexed by counter name and then by instance name. + /// + public class InstanceDataCollectionCollection : DictionaryBase + { + [Obsolete("This constructor has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.ReadCategory() to get an instance of this collection instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public InstanceDataCollectionCollection() : base() { } + + public InstanceDataCollection this[string counterName] + { + get + { + if (counterName == null) + throw new ArgumentNullException(nameof(counterName)); + + object objectName = counterName.ToLower(CultureInfo.InvariantCulture); + return (InstanceDataCollection)Dictionary[objectName]; + } + } + + public ICollection Keys + { + get { return Dictionary.Keys; } + } + + public ICollection Values + { + get + { + return Dictionary.Values; + } + } + + internal void Add(string counterName, InstanceDataCollection value) + { + object objectName = counterName.ToLower(CultureInfo.InvariantCulture); + Dictionary.Add(objectName, value); + } + + public bool Contains(string counterName) + { + if (counterName == null) + throw new ArgumentNullException(nameof(counterName)); + + object objectName = counterName.ToLower(CultureInfo.InvariantCulture); + return Dictionary.Contains(objectName); + } + + public void CopyTo(InstanceDataCollection[] counters, int index) + { + Dictionary.Values.CopyTo((Array)counters, index); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerfCounterSection.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerfCounterSection.cs new file mode 100644 index 0000000000..4d9a8680e4 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerfCounterSection.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Configuration; + +namespace System.Diagnostics +{ + internal class PerfCounterSection : ConfigurationElement + { + private static readonly ConfigurationProperty s_propFileMappingSize = new ConfigurationProperty("filemappingsize", typeof(int), 524288, ConfigurationPropertyOptions.None); + private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection { s_propFileMappingSize }; + + [ConfigurationProperty("filemappingsize", DefaultValue = 524288)] + public int FileMappingSize => (int)this[s_propFileMappingSize]; + + protected override ConfigurationPropertyCollection Properties => s_properties; + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs new file mode 100644 index 0000000000..d1b784cfc3 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs @@ -0,0 +1,611 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace System.Diagnostics +{ + /// + /// Performance Counter component. + /// This class provides support for NT Performance counters. + /// It handles both the existing counters (accesible by Perf Registry Interface) + /// and user defined (extensible) counters. + /// This class is a part of a larger framework, that includes the perf dll object and + /// perf service. + /// + public sealed class PerformanceCounter : Component, ISupportInitialize + { + private string _machineName; + private string _categoryName; + private string _counterName; + private string _instanceName; + private PerformanceCounterInstanceLifetime _instanceLifetime = PerformanceCounterInstanceLifetime.Global; + + private bool _isReadOnly; + private bool _initialized = false; + private string _helpMsg = null; + private int _counterType = -1; + + // Cached old sample + private CounterSample _oldSample = CounterSample.Empty; + + // Cached IP Shared Performanco counter + private SharedPerformanceCounter _sharedCounter; + + [ObsoleteAttribute("This field has been deprecated and is not used. Use machine.config or an application configuration file to set the size of the PerformanceCounter file mapping.")] + public static int DefaultFileMappingSize = 524288; + + private Object _instanceLockObject; + private Object InstanceLockObject + { + get + { + if (_instanceLockObject == null) + { + Object o = new Object(); + Interlocked.CompareExchange(ref _instanceLockObject, o, null); + } + return _instanceLockObject; + } + } + + /// + /// The defaut constructor. Creates the perf counter object + /// + public PerformanceCounter() + { + _machineName = "."; + _categoryName = string.Empty; + _counterName = string.Empty; + _instanceName = string.Empty; + _isReadOnly = true; + GC.SuppressFinalize(this); + } + + /// + /// Creates the Performance Counter Object + /// + public PerformanceCounter(string categoryName, string counterName, string instanceName, string machineName) + { + MachineName = machineName; + CategoryName = categoryName; + CounterName = counterName; + InstanceName = instanceName; + _isReadOnly = true; + Initialize(); + GC.SuppressFinalize(this); + } + + internal PerformanceCounter(string categoryName, string counterName, string instanceName, string machineName, bool skipInit) + { + MachineName = machineName; + CategoryName = categoryName; + CounterName = counterName; + InstanceName = instanceName; + _isReadOnly = true; + _initialized = true; + GC.SuppressFinalize(this); + } + + /// + /// Creates the Performance Counter Object on local machine. + /// + public PerformanceCounter(string categoryName, string counterName, string instanceName) : + this(categoryName, counterName, instanceName, true) + { + } + + /// + /// Creates the Performance Counter Object on local machine. + /// + public PerformanceCounter(string categoryName, string counterName, string instanceName, bool readOnly) + { + if (!readOnly) + { + VerifyWriteableCounterAllowed(); + } + MachineName = "."; + CategoryName = categoryName; + CounterName = counterName; + InstanceName = instanceName; + _isReadOnly = readOnly; + Initialize(); + GC.SuppressFinalize(this); + } + + /// + /// Creates the Performance Counter Object, assumes that it's a single instance + /// + public PerformanceCounter(string categoryName, string counterName) : + this(categoryName, counterName, true) + { + } + + /// + /// Creates the Performance Counter Object, assumes that it's a single instance + /// + public PerformanceCounter(string categoryName, string counterName, bool readOnly) : + this(categoryName, counterName, "", readOnly) + { + } + + /// + /// Returns the performance category name for this performance counter + /// + public string CategoryName + { + get + { + return _categoryName; + } + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + + if (_categoryName == null || !string.Equals(_categoryName, value, StringComparison.OrdinalIgnoreCase)) + { + _categoryName = value; + Close(); + } + } + } + + /// + /// Returns the description message for this performance counter + /// + public string CounterHelp + { + get + { + string currentCategoryName = _categoryName; + string currentMachineName = _machineName; + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, currentMachineName, currentCategoryName); + permission.Demand(); + Initialize(); + + if (_helpMsg == null) + _helpMsg = PerformanceCounterLib.GetCounterHelp(currentMachineName, currentCategoryName, _counterName); + + return _helpMsg; + } + } + + /// + /// Sets/returns the performance counter name for this performance counter + /// + public string CounterName + { + get + { + return _counterName; + } + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + + if (_counterName == null || !string.Equals(_counterName, value, StringComparison.OrdinalIgnoreCase)) + { + _counterName = value; + Close(); + } + } + } + + /// + /// Sets/Returns the counter type for this performance counter + /// + public PerformanceCounterType CounterType + { + get + { + if (_counterType == -1) + { + string currentCategoryName = _categoryName; + string currentMachineName = _machineName; + + // This is the same thing that NextSample does, except that it doesn't try to get the actual counter + // value. If we wanted the counter value, we would need to have an instance name. + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, currentMachineName, currentCategoryName); + permission.Demand(); + + Initialize(); + CategorySample categorySample = PerformanceCounterLib.GetCategorySample(currentMachineName, currentCategoryName); + CounterDefinitionSample counterSample = categorySample.GetCounterDefinitionSample(_counterName); + _counterType = counterSample._counterType; + } + + return (PerformanceCounterType)_counterType; + } + } + + public PerformanceCounterInstanceLifetime InstanceLifetime + { + get { return _instanceLifetime; } + set + { + if (value > PerformanceCounterInstanceLifetime.Process || value < PerformanceCounterInstanceLifetime.Global) + throw new ArgumentOutOfRangeException(nameof(value)); + + if (_initialized) + throw new InvalidOperationException(SR.Format(SR.CantSetLifetimeAfterInitialized)); + + _instanceLifetime = value; + } + } + + /// + /// Sets/returns an instance name for this performance counter + /// + public string InstanceName + { + get + { + return _instanceName; + } + set + { + if (value == null && _instanceName == null) + return; + + if ((value == null && _instanceName != null) || + (value != null && _instanceName == null) || + !string.Equals(_instanceName, value, StringComparison.OrdinalIgnoreCase)) + { + _instanceName = value; + Close(); + } + } + } + + /// + /// Returns true if counter is read only (system counter, foreign extensible counter or remote counter) + /// + public bool ReadOnly + { + get + { + return _isReadOnly; + } + + set + { + if (value != _isReadOnly) + { + if (value == false) + { + VerifyWriteableCounterAllowed(); + } + _isReadOnly = value; + Close(); + } + } + } + + /// + /// Set/returns the machine name for this performance counter + /// + public string MachineName + { + get + { + return _machineName; + } + set + { + if (!SyntaxCheck.CheckMachineName(value)) + throw new ArgumentException(SR.Format(SR.InvalidProperty, nameof(MachineName), value), nameof(value)); + + if (_machineName != value) + { + _machineName = value; + Close(); + } + } + } + + /// + /// Directly accesses the raw value of this counter. If counter type is of a 32-bit size, it will truncate + /// the value given to 32 bits. This can be significantly more performant for scenarios where + /// the raw value is sufficient. Note that this only works for custom counters created using + /// this component, non-custom counters will throw an exception if this property is accessed. + /// + public long RawValue + { + get + { + if (ReadOnly) + { + //No need to initialize or Demand, since NextSample already does. + return NextSample().RawValue; + } + else + { + Initialize(); + + return _sharedCounter.Value; + } + } + set + { + if (ReadOnly) + ThrowReadOnly(); + + Initialize(); + + _sharedCounter.Value = value; + } + } + + /// + /// + public void BeginInit() + { + Close(); + } + + /// + /// Frees all the resources allocated by this counter + /// + public void Close() + { + _helpMsg = null; + _oldSample = CounterSample.Empty; + _sharedCounter = null; + _initialized = false; + _counterType = -1; + } + + /// + /// Frees all the resources allocated for all performance + /// counters, frees File Mapping used by extensible counters, + /// unloads dll's used to read counters. + /// + public static void CloseSharedResources() + { + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, ".", "*"); + permission.Demand(); + PerformanceCounterLib.CloseAllLibraries(); + } + + /// + /// + /// + protected override void Dispose(bool disposing) + { + // safe to call while finalizing or disposing + if (disposing) + { + //Dispose managed and unmanaged resources + Close(); + } + + base.Dispose(disposing); + } + + /// + /// Decrements counter by one using an efficient atomic operation. + /// + public long Decrement() + { + if (ReadOnly) + ThrowReadOnly(); + + Initialize(); + + return _sharedCounter.Decrement(); + } + + /// + /// + public void EndInit() + { + Initialize(); + } + + /// + /// Increments the value of this counter. If counter type is of a 32-bit size, it'll truncate + /// the value given to 32 bits. This method uses a mutex to guarantee correctness of + /// the operation in case of multiple writers. This method should be used with caution because of the negative + /// impact on performance due to creation of the mutex. + /// + public long IncrementBy(long value) + { + if (_isReadOnly) + ThrowReadOnly(); + + Initialize(); + + return _sharedCounter.IncrementBy(value); + } + + /// + /// Increments counter by one using an efficient atomic operation. + /// + public long Increment() + { + if (_isReadOnly) + ThrowReadOnly(); + + Initialize(); + + return _sharedCounter.Increment(); + } + + private void ThrowReadOnly() + { + throw new InvalidOperationException(SR.Format(SR.ReadOnlyCounter)); + } + + private static void VerifyWriteableCounterAllowed() + { + if (EnvironmentHelpers.IsAppContainerProcess) + { + throw new NotSupportedException(SR.Format(SR.PCNotSupportedUnderAppContainer)); + } + } + + private void Initialize() + { + // Keep this method small so the JIT will inline it. + if (!_initialized && !DesignMode) + { + InitializeImpl(); + } + } + + /// + /// Intializes required resources + /// + private void InitializeImpl() + { + bool tookLock = false; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + Monitor.Enter(InstanceLockObject, ref tookLock); + + if (!_initialized) + { + string currentCategoryName = _categoryName; + string currentMachineName = _machineName; + + if (currentCategoryName == string.Empty) + throw new InvalidOperationException(SR.Format(SR.CategoryNameMissing)); + if (_counterName == string.Empty) + throw new InvalidOperationException(SR.Format(SR.CounterNameMissing)); + + if (ReadOnly) + { + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, currentMachineName, currentCategoryName); + + permission.Demand(); + + if (!PerformanceCounterLib.CounterExists(currentMachineName, currentCategoryName, _counterName)) + throw new InvalidOperationException(SR.Format(SR.CounterExists, currentCategoryName, _counterName)); + + PerformanceCounterCategoryType categoryType = PerformanceCounterLib.GetCategoryType(currentMachineName, currentCategoryName); + if (categoryType == PerformanceCounterCategoryType.MultiInstance) + { + if (string.IsNullOrEmpty(_instanceName)) + throw new InvalidOperationException(SR.Format(SR.MultiInstanceOnly, currentCategoryName)); + } + else if (categoryType == PerformanceCounterCategoryType.SingleInstance) + { + if (!string.IsNullOrEmpty(_instanceName)) + throw new InvalidOperationException(SR.Format(SR.SingleInstanceOnly, currentCategoryName)); + } + + if (_instanceLifetime != PerformanceCounterInstanceLifetime.Global) + throw new InvalidOperationException(SR.Format(SR.InstanceLifetimeProcessonReadOnly)); + + _initialized = true; + } + else + { + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Write, currentMachineName, currentCategoryName); + permission.Demand(); + + if (currentMachineName != "." && !string.Equals(currentMachineName, PerformanceCounterLib.ComputerName, StringComparison.OrdinalIgnoreCase)) + throw new InvalidOperationException(SR.Format(SR.RemoteWriting)); + + if (!PerformanceCounterLib.IsCustomCategory(currentMachineName, currentCategoryName)) + throw new InvalidOperationException(SR.Format(SR.NotCustomCounter)); + + // check category type + PerformanceCounterCategoryType categoryType = PerformanceCounterLib.GetCategoryType(currentMachineName, currentCategoryName); + if (categoryType == PerformanceCounterCategoryType.MultiInstance) + { + if (string.IsNullOrEmpty(_instanceName)) + throw new InvalidOperationException(SR.Format(SR.MultiInstanceOnly, currentCategoryName)); + } + else if (categoryType == PerformanceCounterCategoryType.SingleInstance) + { + if (!string.IsNullOrEmpty(_instanceName)) + throw new InvalidOperationException(SR.Format(SR.SingleInstanceOnly, currentCategoryName)); + } + + if (string.IsNullOrEmpty(_instanceName) && InstanceLifetime == PerformanceCounterInstanceLifetime.Process) + throw new InvalidOperationException(SR.Format(SR.InstanceLifetimeProcessforSingleInstance)); + + _sharedCounter = new SharedPerformanceCounter(currentCategoryName.ToLower(CultureInfo.InvariantCulture), _counterName.ToLower(CultureInfo.InvariantCulture), _instanceName.ToLower(CultureInfo.InvariantCulture), _instanceLifetime); + _initialized = true; + } + } + } + finally + { + if (tookLock) + Monitor.Exit(InstanceLockObject); + } + + } + + // Will cause an update, raw value + /// + /// Obtains a counter sample and returns the raw value for it. + /// + public CounterSample NextSample() + { + string currentCategoryName = _categoryName; + string currentMachineName = _machineName; + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, currentMachineName, currentCategoryName); + permission.Demand(); + + Initialize(); + CategorySample categorySample = PerformanceCounterLib.GetCategorySample(currentMachineName, currentCategoryName); + CounterDefinitionSample counterSample = categorySample.GetCounterDefinitionSample(_counterName); + _counterType = counterSample._counterType; + if (!categorySample._isMultiInstance) + { + if (_instanceName != null && _instanceName.Length != 0) + throw new InvalidOperationException(SR.Format(SR.InstanceNameProhibited, _instanceName)); + + return counterSample.GetSingleValue(); + } + else + { + if (_instanceName == null || _instanceName.Length == 0) + throw new InvalidOperationException(SR.Format(SR.InstanceNameRequired)); + + return counterSample.GetInstanceValue(_instanceName); + } + } + + /// + /// Obtains a counter sample and returns the calculated value for it. + /// NOTE: For counters whose calculated value depend upon 2 counter reads, + /// the very first read will return 0.0. + /// + public float NextValue() + { + //No need to initialize or Demand, since NextSample already does. + CounterSample newSample = NextSample(); + float retVal = 0.0f; + + retVal = CounterSample.Calculate(_oldSample, newSample); + _oldSample = newSample; + + return retVal; + } + + /// + /// Removes this counter instance from the shared memory + /// + public void RemoveInstance() + { + if (_isReadOnly) + throw new InvalidOperationException(SR.Format(SR.ReadOnlyRemoveInstance)); + + Initialize(); + _sharedCounter.RemoveInstance(_instanceName.ToLower(CultureInfo.InvariantCulture), _instanceLifetime); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategory.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategory.cs new file mode 100644 index 0000000000..86b32217c2 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategory.cs @@ -0,0 +1,619 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System; +using System.Threading; +using System.Collections; +using System.Globalization; +using System.Runtime.CompilerServices; + +namespace System.Diagnostics +{ + /// + /// A Performance counter category object. + /// + public sealed class PerformanceCounterCategory + { + private string _categoryName; + private string _categoryHelp; + private string _machineName; + internal const int MaxCategoryNameLength = 80; + internal const int MaxCounterNameLength = 32767; + internal const int MaxHelpLength = 32767; + private const string PerfMutexName = "netfxperf.1.0"; + + public PerformanceCounterCategory() + { + _machineName = "."; + } + + /// + /// Creates a PerformanceCounterCategory object for given category. + /// Uses the local machine. + /// + public PerformanceCounterCategory(string categoryName) + : this(categoryName, ".") + { + } + + /// + /// Creates a PerformanceCounterCategory object for given category. + /// Uses the given machine name. + /// + public PerformanceCounterCategory(string categoryName, string machineName) + { + if (categoryName == null) + throw new ArgumentNullException(nameof(categoryName)); + + if (categoryName.Length == 0) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(categoryName), categoryName), nameof(categoryName)); + + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName), nameof(machineName)); + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, machineName, categoryName); + permission.Demand(); + + _categoryName = categoryName; + _machineName = machineName; + } + + /// + /// Gets/sets the Category name + /// + public string CategoryName + { + get + { + return _categoryName; + } + + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + + if (value.Length == 0) + throw new ArgumentException(SR.Format(SR.InvalidProperty, nameof(CategoryName), value), nameof(value)); + + // the lock prevents a race between setting CategoryName and MachineName, since this permission + // checks depend on both pieces of info. + lock (this) + { + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, _machineName, value); + permission.Demand(); + + _categoryName = value; + } + } + } + + /// + /// Gets/sets the Category help + /// + public string CategoryHelp + { + get + { + if (_categoryName == null) + throw new InvalidOperationException(SR.Format(SR.CategoryNameNotSet)); + + if (_categoryHelp == null) + _categoryHelp = PerformanceCounterLib.GetCategoryHelp(_machineName, _categoryName); + + return _categoryHelp; + } + } + + public PerformanceCounterCategoryType CategoryType + { + get + { + CategorySample categorySample = PerformanceCounterLib.GetCategorySample(_machineName, _categoryName); + + // If we get MultiInstance, we can be confident it is correct. If it is single instance, though + // we need to check if is a custom category and if the IsMultiInstance value is set in the registry. + // If not we return Unknown + if (categorySample._isMultiInstance) + return PerformanceCounterCategoryType.MultiInstance; + else + { + if (PerformanceCounterLib.IsCustomCategory(".", _categoryName)) + return PerformanceCounterLib.GetCategoryType(".", _categoryName); + else + return PerformanceCounterCategoryType.SingleInstance; + } + } + } + + + /// + /// Gets/sets the Machine name + /// + public string MachineName + { + get + { + return _machineName; + } + set + { + if (!SyntaxCheck.CheckMachineName(value)) + throw new ArgumentException(SR.Format(SR.InvalidProperty, nameof(MachineName), value), nameof(value)); + + // the lock prevents a race between setting CategoryName and MachineName, since this permission + // checks depend on both pieces of info. + lock (this) + { + if (_categoryName != null) + { + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, value, _categoryName); + permission.Demand(); + } + + _machineName = value; + } + } + } + + /// + /// Returns true if the counter is registered for this category + /// + public bool CounterExists(string counterName) + { + if (counterName == null) + throw new ArgumentNullException(nameof(counterName)); + + if (_categoryName == null) + throw new InvalidOperationException(SR.Format(SR.CategoryNameNotSet)); + + return PerformanceCounterLib.CounterExists(_machineName, _categoryName, counterName); + } + + /// + /// Returns true if the counter is registered for this category on the current machine. + /// + public static bool CounterExists(string counterName, string categoryName) + { + return CounterExists(counterName, categoryName, "."); + } + + /// + /// Returns true if the counter is registered for this category on a particular machine. + /// + public static bool CounterExists(string counterName, string categoryName, string machineName) + { + if (counterName == null) + throw new ArgumentNullException(nameof(counterName)); + + if (categoryName == null) + throw new ArgumentNullException(nameof(categoryName)); + + if (categoryName.Length == 0) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(categoryName), categoryName), nameof(categoryName)); + + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName), nameof(machineName)); + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, machineName, categoryName); + permission.Demand(); + + return PerformanceCounterLib.CounterExists(machineName, categoryName, counterName); + } + + /// + /// Registers one extensible performance category of type NumberOfItems32 with the system + /// + [Obsolete("This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public static PerformanceCounterCategory Create(string categoryName, string categoryHelp, string counterName, string counterHelp) + { + CounterCreationData customData = new CounterCreationData(counterName, counterHelp, PerformanceCounterType.NumberOfItems32); + return Create(categoryName, categoryHelp, PerformanceCounterCategoryType.Unknown, new CounterCreationDataCollection(new CounterCreationData[] { customData })); + } + + public static PerformanceCounterCategory Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, string counterName, string counterHelp) + { + CounterCreationData customData = new CounterCreationData(counterName, counterHelp, PerformanceCounterType.NumberOfItems32); + return Create(categoryName, categoryHelp, categoryType, new CounterCreationDataCollection(new CounterCreationData[] { customData })); + } + + /// + /// Registers the extensible performance category with the system on the local machine + /// + [Obsolete("This method has been deprecated. Please use System.Diagnostics.PerformanceCounterCategory.Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public static PerformanceCounterCategory Create(string categoryName, string categoryHelp, CounterCreationDataCollection counterData) + { + return Create(categoryName, categoryHelp, PerformanceCounterCategoryType.Unknown, counterData); + } + + public static PerformanceCounterCategory Create(string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) + { + if (categoryType < PerformanceCounterCategoryType.Unknown || categoryType > PerformanceCounterCategoryType.MultiInstance) + throw new ArgumentOutOfRangeException(nameof(categoryType)); + if (counterData == null) + throw new ArgumentNullException(nameof(counterData)); + + CheckValidCategory(categoryName); + if (categoryHelp != null) + { + // null categoryHelp is a valid option - it gets set to "Help Not Available" later on. + CheckValidHelp(categoryHelp); + } + string machineName = "."; + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Administer, machineName, categoryName); + permission.Demand(); + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutex(PerfMutexName, ref mutex); + if (PerformanceCounterLib.IsCustomCategory(machineName, categoryName) || PerformanceCounterLib.CategoryExists(machineName, categoryName)) + throw new InvalidOperationException(SR.Format(SR.PerformanceCategoryExists, categoryName)); + + CheckValidCounterLayout(counterData); + PerformanceCounterLib.RegisterCategory(categoryName, categoryType, categoryHelp, counterData); + return new PerformanceCounterCategory(categoryName, machineName); + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + + // there is an idential copy of CheckValidCategory in PerformnaceCounterInstaller + internal static void CheckValidCategory(string categoryName) + { + if (categoryName == null) + throw new ArgumentNullException(nameof(categoryName)); + + if (!CheckValidId(categoryName, MaxCategoryNameLength)) + throw new ArgumentException(SR.Format(SR.PerfInvalidCategoryName, 1, MaxCategoryNameLength)); + + // 1026 chars is the size of the buffer used in perfcounter.dll to get this name. + // If the categoryname plus prefix is too long, we won't be able to read the category properly. + if (categoryName.Length > (1024 - SharedPerformanceCounter.DefaultFileMappingName.Length)) + throw new ArgumentException(SR.Format(SR.CategoryNameTooLong)); + } + + internal static void CheckValidCounter(string counterName) + { + if (counterName == null) + throw new ArgumentNullException(nameof(counterName)); + + if (!CheckValidId(counterName, MaxCounterNameLength)) + throw new ArgumentException(SR.Format(SR.PerfInvalidCounterName, 1, MaxCounterNameLength)); + } + + // there is an idential copy of CheckValidId in PerformnaceCounterInstaller + internal static bool CheckValidId(string id, int maxLength) + { + if (id.Length == 0 || id.Length > maxLength) + return false; + + for (int index = 0; index < id.Length; ++index) + { + char current = id[index]; + + if ((index == 0 || index == (id.Length - 1)) && current == ' ') + return false; + + if (current == '\"') + return false; + + if (char.IsControl(current)) + return false; + } + + return true; + } + + internal static void CheckValidHelp(string help) + { + if (help == null) + throw new ArgumentNullException(nameof(help)); + if (help.Length > MaxHelpLength) + throw new ArgumentException(SR.Format(SR.PerfInvalidHelp, 0, MaxHelpLength)); + } + + internal static void CheckValidCounterLayout(CounterCreationDataCollection counterData) + { + // Ensure that there are no duplicate counter names being created + Hashtable h = new Hashtable(); + for (int i = 0; i < counterData.Count; i++) + { + if (counterData[i].CounterName == null || counterData[i].CounterName.Length == 0) + { + throw new ArgumentException(SR.Format(SR.InvalidCounterName)); + } + + int currentSampleType = (int)counterData[i].CounterType; + if ((currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION) || + (currentSampleType == Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER)) + { + if (counterData.Count <= (i + 1)) + throw new InvalidOperationException(SR.Format(SR.CounterLayout)); + else + { + currentSampleType = (int)counterData[i + 1].CounterType; + + + if (!PerformanceCounterLib.IsBaseCounter(currentSampleType)) + throw new InvalidOperationException(SR.Format(SR.CounterLayout)); + } + } + else if (PerformanceCounterLib.IsBaseCounter(currentSampleType)) + { + if (i == 0) + throw new InvalidOperationException(SR.Format(SR.CounterLayout)); + else + { + currentSampleType = (int)counterData[i - 1].CounterType; + + if ( + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION) && + (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER)) + throw new InvalidOperationException(SR.Format(SR.CounterLayout)); + } + } + + if (h.ContainsKey(counterData[i].CounterName)) + { + throw new ArgumentException(SR.Format(SR.DuplicateCounterName, counterData[i].CounterName)); + } + else + { + h.Add(counterData[i].CounterName, string.Empty); + + // Ensure that all counter help strings aren't null or empty + if (counterData[i].CounterHelp == null || counterData[i].CounterHelp.Length == 0) + { + counterData[i].CounterHelp = counterData[i].CounterName; + } + } + } + } + + /// + /// Removes the counter (category) from the system + /// + public static void Delete(string categoryName) + { + CheckValidCategory(categoryName); + string machineName = "."; + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Administer, machineName, categoryName); + permission.Demand(); + + categoryName = categoryName.ToLower(CultureInfo.InvariantCulture); + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutex(PerfMutexName, ref mutex); + if (!PerformanceCounterLib.IsCustomCategory(machineName, categoryName)) + throw new InvalidOperationException(SR.Format(SR.CantDeleteCategory)); + + SharedPerformanceCounter.RemoveAllInstances(categoryName); + + PerformanceCounterLib.UnregisterCategory(categoryName); + PerformanceCounterLib.CloseAllLibraries(); + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + + /// + /// Returns true if the category is registered on the current machine. + /// + public static bool Exists(string categoryName) + { + return Exists(categoryName, "."); + } + + /// + /// Returns true if the category is registered in the machine. + /// + public static bool Exists(string categoryName, string machineName) + { + if (categoryName == null) + throw new ArgumentNullException(nameof(categoryName)); + + if (categoryName.Length == 0) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(categoryName), categoryName), nameof(categoryName)); + + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName), nameof(machineName)); + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, machineName, categoryName); + permission.Demand(); + + if (PerformanceCounterLib.IsCustomCategory(machineName, categoryName)) + return true; + + return PerformanceCounterLib.CategoryExists(machineName, categoryName); + } + + /// + /// Returns the instance names for a given category + /// + /// + internal static string[] GetCounterInstances(string categoryName, string machineName) + { + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, machineName, categoryName); + permission.Demand(); + + CategorySample categorySample = PerformanceCounterLib.GetCategorySample(machineName, categoryName); + if (categorySample._instanceNameTable.Count == 0) + return Array.Empty(); + + string[] instanceNames = new string[categorySample._instanceNameTable.Count]; + categorySample._instanceNameTable.Keys.CopyTo(instanceNames, 0); + if (instanceNames.Length == 1 && instanceNames[0] == PerformanceCounterLib.SingleInstanceName) + return Array.Empty(); + + return instanceNames; + } + + /// + /// Returns an array of counters in this category. The counter must have only one instance. + /// + public PerformanceCounter[] GetCounters() + { + if (GetInstanceNames().Length != 0) + throw new ArgumentException(SR.Format(SR.InstanceNameRequired)); + return GetCounters(""); + } + + /// + /// Returns an array of counters in this category for the given instance. + /// + public PerformanceCounter[] GetCounters(string instanceName) + { + if (instanceName == null) + throw new ArgumentNullException(nameof(instanceName)); + + if (_categoryName == null) + throw new InvalidOperationException(SR.Format(SR.CategoryNameNotSet)); + + if (instanceName.Length != 0 && !InstanceExists(instanceName)) + throw new InvalidOperationException(SR.Format(SR.MissingInstance, instanceName, _categoryName)); + + string[] counterNames = PerformanceCounterLib.GetCounters(_machineName, _categoryName); + PerformanceCounter[] counters = new PerformanceCounter[counterNames.Length]; + for (int index = 0; index < counters.Length; index++) + counters[index] = new PerformanceCounter(_categoryName, counterNames[index], instanceName, _machineName, true); + + return counters; + } + + + /// + /// Returns an array of performance counter categories for the current machine. + /// + public static PerformanceCounterCategory[] GetCategories() + { + return GetCategories("."); + } + + /// + /// Returns an array of performance counter categories for a particular machine. + /// + public static PerformanceCounterCategory[] GetCategories(string machineName) + { + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName), nameof(machineName)); + + PerformanceCounterPermission permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Read, machineName, "*"); + permission.Demand(); + + string[] categoryNames = PerformanceCounterLib.GetCategories(machineName); + PerformanceCounterCategory[] categories = new PerformanceCounterCategory[categoryNames.Length]; + for (int index = 0; index < categories.Length; index++) + categories[index] = new PerformanceCounterCategory(categoryNames[index], machineName); + + return categories; + } + + /// + /// Returns an array of instances for this category + /// + public string[] GetInstanceNames() + { + if (_categoryName == null) + throw new InvalidOperationException(SR.Format(SR.CategoryNameNotSet)); + + return GetCounterInstances(_categoryName, _machineName); + } + + /// + /// Returns true if the instance already exists for this category. + /// + public bool InstanceExists(string instanceName) + { + if (instanceName == null) + throw new ArgumentNullException(nameof(instanceName)); + + if (_categoryName == null) + throw new InvalidOperationException(SR.Format(SR.CategoryNameNotSet)); + + CategorySample categorySample = PerformanceCounterLib.GetCategorySample(_machineName, _categoryName); + return categorySample._instanceNameTable.ContainsKey(instanceName); + } + + /// + /// Returns true if the instance already exists for the category specified. + /// + public static bool InstanceExists(string instanceName, string categoryName) + { + return InstanceExists(instanceName, categoryName, "."); + } + + /// + /// Returns true if the instance already exists for this category and machine specified. + /// + public static bool InstanceExists(string instanceName, string categoryName, string machineName) + { + if (instanceName == null) + throw new ArgumentNullException(nameof(instanceName)); + + if (categoryName == null) + throw new ArgumentNullException(nameof(categoryName)); + + if (categoryName.Length == 0) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(categoryName), categoryName), nameof(categoryName)); + + if (!SyntaxCheck.CheckMachineName(machineName)) + throw new ArgumentException(SR.Format(SR.InvalidParameter, nameof(machineName), machineName), nameof(machineName)); + + PerformanceCounterCategory category = new PerformanceCounterCategory(categoryName, machineName); + return category.InstanceExists(instanceName); + } + + /// + /// Reads all the counter and instance data of this performance category. Note that reading the entire category + /// at once can be as efficient as reading a single counter because of the way the system provides the data. + /// + public InstanceDataCollectionCollection ReadCategory() + { + if (_categoryName == null) + throw new InvalidOperationException(SR.Format(SR.CategoryNameNotSet)); + + CategorySample categorySample = PerformanceCounterLib.GetCategorySample(_machineName, _categoryName); + return categorySample.ReadCategory(); + } + } + + [Flags] + internal enum PerformanceCounterCategoryOptions + { + EnableReuse = 0x1, + UseUniqueSharedMemory = 0x2, + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategoryType.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategoryType.cs new file mode 100644 index 0000000000..b6d7c4cb89 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterCategoryType.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public enum PerformanceCounterCategoryType + { + Unknown = -1, + SingleInstance = 0, + MultiInstance = 1 + } +} + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterInstanceLifetime.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterInstanceLifetime.cs new file mode 100644 index 0000000000..f6f167d376 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterInstanceLifetime.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + public enum PerformanceCounterInstanceLifetime + { + Global = 0, + Process = 1 + } +} + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs new file mode 100644 index 0000000000..ec41fb9979 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs @@ -0,0 +1,1826 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Globalization; +using System.Security.Permissions; +using System.Security; +using System.Text; +using System.Threading; +using System.Collections; +using System.ComponentModel; +using Microsoft.Win32; +using System.IO; + +namespace System.Diagnostics +{ + internal class PerformanceCounterLib + { + internal const string PerfShimName = "netfxperf.dll"; + private const string PerfShimFullNameSuffix = @"\netfxperf.dll"; + private const string PerfShimPathExp = @"%systemroot%\system32\netfxperf.dll"; + internal const string OpenEntryPoint = "OpenPerformanceData"; + internal const string CollectEntryPoint = "CollectPerformanceData"; + internal const string CloseEntryPoint = "ClosePerformanceData"; + internal const string SingleInstanceName = "systemdiagnosticsperfcounterlibsingleinstance"; + + private const string PerflibPath = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"; + internal const string ServicePath = "SYSTEM\\CurrentControlSet\\Services"; + private const string CategorySymbolPrefix = "OBJECT_"; + private const string ConterSymbolPrefix = "DEVICE_COUNTER_"; + private const string HelpSufix = "_HELP"; + private const string NameSufix = "_NAME"; + private const string TextDefinition = "[text]"; + private const string InfoDefinition = "[info]"; + private const string LanguageDefinition = "[languages]"; + private const string ObjectDefinition = "[objects]"; + private const string DriverNameKeyword = "drivername"; + private const string SymbolFileKeyword = "symbolfile"; + private const string DefineKeyword = "#define"; + private const string LanguageKeyword = "language"; + private const string DllName = "netfxperf.dll"; + + private const int EnglishLCID = 0x009; + + private static volatile string s_computerName; + private static volatile string s_iniFilePath; + private static volatile string s_symbolFilePath; + + private PerformanceMonitor _performanceMonitor; + private string _machineName; + private string _perfLcid; + + private Hashtable _customCategoryTable; + private static volatile Hashtable s_libraryTable; + private Hashtable _categoryTable; + private Hashtable _nameTable; + private Hashtable _helpTable; + private readonly object _categoryTableLock = new Object(); + private readonly object _nameTableLock = new Object(); + private readonly object _helpTableLock = new Object(); + + private static Object s_internalSyncObject; + private static Object InternalSyncObject + { + get + { + if (s_internalSyncObject == null) + { + Object o = new Object(); + Interlocked.CompareExchange(ref s_internalSyncObject, o, null); + } + return s_internalSyncObject; + } + } + + internal PerformanceCounterLib(string machineName, string lcid) + { + _machineName = machineName; + _perfLcid = lcid; + } + + /// + internal static string ComputerName + { + get + { + if (s_computerName == null) + { + lock (InternalSyncObject) + { + if (s_computerName == null) + { + s_computerName = Interop.Kernel32.GetComputerName() ?? string.Empty; + } + } + } + + return s_computerName; + } + } + + private unsafe Hashtable CategoryTable + { + get + { + if (_categoryTable == null) + { + lock (_categoryTableLock) + { + if (_categoryTable == null) + { + byte[] perfData = GetPerformanceData("Global"); + + fixed (byte* perfDataPtr = perfData) + { + IntPtr dataRef = new IntPtr((void*)perfDataPtr); + Interop.Advapi32.PERF_DATA_BLOCK dataBlock = new Interop.Advapi32.PERF_DATA_BLOCK(); + Marshal.PtrToStructure(dataRef, dataBlock); + dataRef = (IntPtr)((long)dataRef + dataBlock.HeaderLength); + int categoryNumber = dataBlock.NumObjectTypes; + + // on some machines MSMQ claims to have 4 categories, even though it only has 2. + // This causes us to walk past the end of our data, potentially crashing or reading + // data we shouldn't. We use endPerfData to make sure we don't go past the end + // of the perf data. + long endPerfData = (long)(new IntPtr((void*)perfDataPtr)) + dataBlock.TotalByteLength; + Hashtable tempCategoryTable = new Hashtable(categoryNumber, StringComparer.OrdinalIgnoreCase); + for (int index = 0; index < categoryNumber && ((long)dataRef < endPerfData); index++) + { + Interop.Advapi32.PERF_OBJECT_TYPE perfObject = new Interop.Advapi32.PERF_OBJECT_TYPE(); + + Marshal.PtrToStructure(dataRef, perfObject); + + CategoryEntry newCategoryEntry = new CategoryEntry(perfObject); + IntPtr nextRef = (IntPtr)((long)dataRef + perfObject.TotalByteLength); + dataRef = (IntPtr)((long)dataRef + perfObject.HeaderLength); + + int index3 = 0; + int previousCounterIndex = -1; + //Need to filter out counters that are repeated, some providers might + //return several adyacent copies of the same counter. + for (int index2 = 0; index2 < newCategoryEntry.CounterIndexes.Length; ++index2) + { + Interop.Advapi32.PERF_COUNTER_DEFINITION perfCounter = new Interop.Advapi32.PERF_COUNTER_DEFINITION(); + Marshal.PtrToStructure(dataRef, perfCounter); + if (perfCounter.CounterNameTitleIndex != previousCounterIndex) + { + newCategoryEntry.CounterIndexes[index3] = perfCounter.CounterNameTitleIndex; + newCategoryEntry.HelpIndexes[index3] = perfCounter.CounterHelpTitleIndex; + previousCounterIndex = perfCounter.CounterNameTitleIndex; + ++index3; + } + dataRef = (IntPtr)((long)dataRef + perfCounter.ByteLength); + } + + //Lets adjust the entry counter arrays in case there were repeated copies + if (index3 < newCategoryEntry.CounterIndexes.Length) + { + int[] adjustedCounterIndexes = new int[index3]; + int[] adjustedHelpIndexes = new int[index3]; + Array.Copy(newCategoryEntry.CounterIndexes, adjustedCounterIndexes, index3); + Array.Copy(newCategoryEntry.HelpIndexes, adjustedHelpIndexes, index3); + newCategoryEntry.CounterIndexes = adjustedCounterIndexes; + newCategoryEntry.HelpIndexes = adjustedHelpIndexes; + } + + string categoryName = (string)NameTable[newCategoryEntry.NameIndex]; + if (categoryName != null) + tempCategoryTable[categoryName] = newCategoryEntry; + + dataRef = nextRef; + } + + _categoryTable = tempCategoryTable; + } + } + } + } + + return _categoryTable; + } + } + + internal Hashtable HelpTable + { + get + { + if (_helpTable == null) + { + lock (_helpTableLock) + { + if (_helpTable == null) + _helpTable = GetStringTable(true); + } + } + + return _helpTable; + } + } + + // Returns a temp file name + private static string IniFilePath + { + get + { + if (s_iniFilePath == null) + { + lock (InternalSyncObject) + { + if (s_iniFilePath == null) + { + // Need to assert Environment permissions here + // the environment check is not exposed as a public + // method + EnvironmentPermission environmentPermission = new EnvironmentPermission(PermissionState.Unrestricted); + environmentPermission.Assert(); + try + { + s_iniFilePath = Path.GetTempFileName(); + } + finally + { + EnvironmentPermission.RevertAssert(); + } + } + } + } + + return s_iniFilePath; + } + } + + internal Hashtable NameTable + { + get + { + if (_nameTable == null) + { + lock (_nameTableLock) + { + if (_nameTable == null) + _nameTable = GetStringTable(false); + } + } + + return _nameTable; + } + } + + // Returns a temp file name + private static string SymbolFilePath + { + get + { + if (s_symbolFilePath == null) + { + lock (InternalSyncObject) + { + if (s_symbolFilePath == null) + { + string tempPath; + + EnvironmentPermission environmentPermission = new EnvironmentPermission(PermissionState.Unrestricted); + environmentPermission.Assert(); + tempPath = Path.GetTempPath(); + EnvironmentPermission.RevertAssert(); + + // We need both FileIOPermission EvironmentPermission + PermissionSet ps = new PermissionSet(PermissionState.None); + ps.AddPermission(new EnvironmentPermission(PermissionState.Unrestricted)); + ps.AddPermission(new FileIOPermission(FileIOPermissionAccess.Write, tempPath)); + ps.Assert(); + try + { + s_symbolFilePath = Path.GetTempFileName(); + } + finally + { + PermissionSet.RevertAssert(); + } + } + } + } + + return s_symbolFilePath; + } + } + + internal static bool CategoryExists(string machine, string category) + { + PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + if (library.CategoryExists(category)) + return true; + + if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + if (library.CategoryExists(category)) + return true; + culture = culture.Parent; + } + } + + return false; + } + + internal bool CategoryExists(string category) + { + return CategoryTable.ContainsKey(category); + } + + internal static void CloseAllLibraries() + { + if (s_libraryTable != null) + { + foreach (PerformanceCounterLib library in s_libraryTable.Values) + library.Close(); + + s_libraryTable = null; + } + } + + internal static void CloseAllTables() + { + if (s_libraryTable != null) + { + foreach (PerformanceCounterLib library in s_libraryTable.Values) + library.CloseTables(); + } + } + + internal void CloseTables() + { + _nameTable = null; + _helpTable = null; + _categoryTable = null; + _customCategoryTable = null; + } + + internal void Close() + { + if (_performanceMonitor != null) + { + _performanceMonitor.Close(); + _performanceMonitor = null; + } + + CloseTables(); + } + + internal static bool CounterExists(string machine, string category, string counter) + { + PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + bool categoryExists = false; + bool counterExists = library.CounterExists(category, counter, ref categoryExists); + + if (!categoryExists && CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + counterExists = library.CounterExists(category, counter, ref categoryExists); + if (counterExists) + break; + + culture = culture.Parent; + } + } + + if (!categoryExists) + { + // Consider adding diagnostic logic here, may be we can dump the nameTable... + throw new InvalidOperationException(SR.Format(SR.MissingCategory)); + } + + return counterExists; + } + + private bool CounterExists(string category, string counter, ref bool categoryExists) + { + categoryExists = false; + if (!CategoryTable.ContainsKey(category)) + return false; + else + categoryExists = true; + + CategoryEntry entry = (CategoryEntry)CategoryTable[category]; + for (int index = 0; index < entry.CounterIndexes.Length; ++index) + { + int counterIndex = entry.CounterIndexes[index]; + string counterName = (string)NameTable[counterIndex]; + if (counterName == null) + counterName = string.Empty; + + if (string.Equals(counterName, counter, StringComparison.OrdinalIgnoreCase)) + return true; + } + + return false; + } + + private static void CreateIniFile(string categoryName, string categoryHelp, CounterCreationDataCollection creationData, string[] languageIds) + { + //SECREVIEW: PerformanceCounterPermission must have been demanded before + FileIOPermission permission = new FileIOPermission(PermissionState.Unrestricted); + permission.Assert(); + try + { + StreamWriter iniWriter = new StreamWriter(IniFilePath, false, Encoding.Unicode); + try + { + //NT4 won't be able to parse Unicode ini files without this + //extra white space. + iniWriter.WriteLine(""); + iniWriter.WriteLine(InfoDefinition); + iniWriter.Write(DriverNameKeyword); + iniWriter.Write("="); + iniWriter.WriteLine(categoryName); + iniWriter.Write(SymbolFileKeyword); + iniWriter.Write("="); + iniWriter.WriteLine(Path.GetFileName(SymbolFilePath)); + iniWriter.WriteLine(""); + + iniWriter.WriteLine(LanguageDefinition); + foreach (string languageId in languageIds) + { + iniWriter.Write(languageId); + iniWriter.Write("="); + iniWriter.Write(LanguageKeyword); + iniWriter.WriteLine(languageId); + } + iniWriter.WriteLine(""); + + iniWriter.WriteLine(ObjectDefinition); + foreach (string languageId in languageIds) + { + iniWriter.Write(CategorySymbolPrefix); + iniWriter.Write("1_"); + iniWriter.Write(languageId); + iniWriter.Write(NameSufix); + iniWriter.Write("="); + iniWriter.WriteLine(categoryName); + } + iniWriter.WriteLine(""); + + iniWriter.WriteLine(TextDefinition); + foreach (string languageId in languageIds) + { + iniWriter.Write(CategorySymbolPrefix); + iniWriter.Write("1_"); + iniWriter.Write(languageId); + iniWriter.Write(NameSufix); + iniWriter.Write("="); + iniWriter.WriteLine(categoryName); + iniWriter.Write(CategorySymbolPrefix); + iniWriter.Write("1_"); + iniWriter.Write(languageId); + iniWriter.Write(HelpSufix); + iniWriter.Write("="); + if (categoryHelp == null || categoryHelp == string.Empty) + iniWriter.WriteLine(SR.Format(SR.HelpNotAvailable)); + else + iniWriter.WriteLine(categoryHelp); + + + int counterIndex = 0; + foreach (CounterCreationData counterData in creationData) + { + ++counterIndex; + iniWriter.WriteLine(""); + iniWriter.Write(ConterSymbolPrefix); + iniWriter.Write(counterIndex.ToString(CultureInfo.InvariantCulture)); + iniWriter.Write("_"); + iniWriter.Write(languageId); + iniWriter.Write(NameSufix); + iniWriter.Write("="); + iniWriter.WriteLine(counterData.CounterName); + + iniWriter.Write(ConterSymbolPrefix); + iniWriter.Write(counterIndex.ToString(CultureInfo.InvariantCulture)); + iniWriter.Write("_"); + iniWriter.Write(languageId); + iniWriter.Write(HelpSufix); + iniWriter.Write("="); + + Debug.Assert(!string.IsNullOrEmpty(counterData.CounterHelp), "CounterHelp should have been fixed up by the caller"); + iniWriter.WriteLine(counterData.CounterHelp); + } + } + + iniWriter.WriteLine(""); + } + finally + { + iniWriter.Close(); + } + } + finally + { + FileIOPermission.RevertAssert(); + } + } + + private static void CreateRegistryEntry(string categoryName, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection creationData, ref bool iniRegistered) + { + RegistryKey serviceParentKey = null; + RegistryKey serviceKey = null; + RegistryKey linkageKey = null; + + //SECREVIEW: Whoever is able to call this function, must already + // have demmanded PerformanceCounterPermission + // we can therefore assert the RegistryPermission. + RegistryPermission registryPermission = new RegistryPermission(PermissionState.Unrestricted); + registryPermission.Assert(); + try + { + serviceParentKey = Registry.LocalMachine.OpenSubKey(ServicePath, true); + + serviceKey = serviceParentKey.OpenSubKey(categoryName + "\\Performance", true); + if (serviceKey == null) + serviceKey = serviceParentKey.CreateSubKey(categoryName + "\\Performance"); + + serviceKey.SetValue("Open", "OpenPerformanceData"); + serviceKey.SetValue("Collect", "CollectPerformanceData"); + serviceKey.SetValue("Close", "ClosePerformanceData"); + serviceKey.SetValue("Library", DllName); + serviceKey.SetValue("IsMultiInstance", (int)categoryType, RegistryValueKind.DWord); + serviceKey.SetValue("CategoryOptions", 0x3, RegistryValueKind.DWord); + + string[] counters = new string[creationData.Count]; + string[] counterTypes = new string[creationData.Count]; + for (int i = 0; i < creationData.Count; i++) + { + counters[i] = creationData[i].CounterName; + counterTypes[i] = ((int)creationData[i].CounterType).ToString(CultureInfo.InvariantCulture); + } + + linkageKey = serviceParentKey.OpenSubKey(categoryName + "\\Linkage", true); + if (linkageKey == null) + linkageKey = serviceParentKey.CreateSubKey(categoryName + "\\Linkage"); + + linkageKey.SetValue("Export", new string[] { categoryName }); + + serviceKey.SetValue("Counter Types", (object)counterTypes); + serviceKey.SetValue("Counter Names", (object)counters); + + object firstID = serviceKey.GetValue("First Counter"); + if (firstID != null) + iniRegistered = true; + else + iniRegistered = false; + } + finally + { + if (serviceKey != null) + serviceKey.Close(); + + if (linkageKey != null) + linkageKey.Close(); + + if (serviceParentKey != null) + serviceParentKey.Close(); + + RegistryPermission.RevertAssert(); + } + } + + private static void CreateSymbolFile(CounterCreationDataCollection creationData) + { + //SECREVIEW: PerformanceCounterPermission must have been demanded before + FileIOPermission permission = new FileIOPermission(PermissionState.Unrestricted); + permission.Assert(); + try + { + StreamWriter symbolWriter = new StreamWriter(SymbolFilePath); + try + { + symbolWriter.Write(DefineKeyword); + symbolWriter.Write(" "); + symbolWriter.Write(CategorySymbolPrefix); + symbolWriter.WriteLine("1 0;"); + + for (int counterIndex = 1; counterIndex <= creationData.Count; ++counterIndex) + { + symbolWriter.Write(DefineKeyword); + symbolWriter.Write(" "); + symbolWriter.Write(ConterSymbolPrefix); + symbolWriter.Write(counterIndex.ToString(CultureInfo.InvariantCulture)); + symbolWriter.Write(" "); + symbolWriter.Write((counterIndex * 2).ToString(CultureInfo.InvariantCulture)); + symbolWriter.WriteLine(";"); + } + + symbolWriter.WriteLine(""); + } + finally + { + symbolWriter.Close(); + } + } + finally + { + FileIOPermission.RevertAssert(); + } + } + + private static void DeleteRegistryEntry(string categoryName) + { + RegistryKey serviceKey = null; + + //SECREVIEW: Whoever is able to call this function, must already + // have demmanded PerformanceCounterPermission + // we can therefore assert the RegistryPermission. + RegistryPermission registryPermission = new RegistryPermission(PermissionState.Unrestricted); + registryPermission.Assert(); + try + { + serviceKey = Registry.LocalMachine.OpenSubKey(ServicePath, true); + + bool deleteCategoryKey = false; + using (RegistryKey categoryKey = serviceKey.OpenSubKey(categoryName, true)) + { + if (categoryKey != null) + { + if (categoryKey.GetValueNames().Length == 0) + { + deleteCategoryKey = true; + } + else + { + categoryKey.DeleteSubKeyTree("Linkage"); + categoryKey.DeleteSubKeyTree("Performance"); + } + } + } + if (deleteCategoryKey) + serviceKey.DeleteSubKeyTree(categoryName); + + } + finally + { + if (serviceKey != null) + serviceKey.Close(); + + RegistryPermission.RevertAssert(); + } + } + + private static void DeleteTemporaryFiles() + { + try + { + File.Delete(IniFilePath); + } + catch + { + } + + try + { + File.Delete(SymbolFilePath); + } + catch + { + } + } + + // Ensures that the customCategoryTable is initialized and decides whether the category passed in + // 1) is a custom category + // 2) is a multi instance custom category + // The return value is whether the category is a custom category or not. + internal bool FindCustomCategory(string category, out PerformanceCounterCategoryType categoryType) + { + RegistryKey key = null; + RegistryKey baseKey = null; + categoryType = PerformanceCounterCategoryType.Unknown; + + if (_customCategoryTable == null) + { + Interlocked.CompareExchange(ref _customCategoryTable, new Hashtable(StringComparer.OrdinalIgnoreCase), null); + } + + if (_customCategoryTable.ContainsKey(category)) + { + categoryType = (PerformanceCounterCategoryType)_customCategoryTable[category]; + return true; + } + else + { + try + { + string keyPath = ServicePath + "\\" + category + "\\Performance"; + if (_machineName == "." || string.Equals(_machineName, ComputerName, StringComparison.OrdinalIgnoreCase)) + { + key = Registry.LocalMachine.OpenSubKey(keyPath); + } + else + { + baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "\\\\" + _machineName); + if (baseKey != null) + { + try + { + key = baseKey.OpenSubKey(keyPath); + } + catch (SecurityException) + { + // we may not have permission to read the registry key on the remote machine. The security exception + // is thrown when RegOpenKeyEx returns ERROR_ACCESS_DENIED or ERROR_BAD_IMPERSONATION_LEVEL + // + // In this case we return an 'Unknown' category type and 'false' to indicate the category is *not* custom. + // + categoryType = PerformanceCounterCategoryType.Unknown; + _customCategoryTable[category] = categoryType; + return false; + } + } + } + + if (key != null) + { + object systemDllName = key.GetValue("Library", null, RegistryValueOptions.DoNotExpandEnvironmentNames); + if (systemDllName != null && systemDllName is string + && (string.Equals((string)systemDllName, PerformanceCounterLib.PerfShimName, StringComparison.OrdinalIgnoreCase) + || ((string)systemDllName).EndsWith(PerformanceCounterLib.PerfShimFullNameSuffix, StringComparison.OrdinalIgnoreCase))) + { + + object isMultiInstanceObject = key.GetValue("IsMultiInstance"); + if (isMultiInstanceObject != null) + { + categoryType = (PerformanceCounterCategoryType)isMultiInstanceObject; + if (categoryType < PerformanceCounterCategoryType.Unknown || categoryType > PerformanceCounterCategoryType.MultiInstance) + categoryType = PerformanceCounterCategoryType.Unknown; + } + else + categoryType = PerformanceCounterCategoryType.Unknown; + + object objectID = key.GetValue("First Counter"); + if (objectID != null) + { + int firstID = (int)objectID; + + _customCategoryTable[category] = categoryType; + return true; + } + } + } + } + finally + { + if (key != null) + key.Close(); + if (baseKey != null) + baseKey.Close(); + PermissionSet.RevertAssert(); + } + } + return false; + } + + internal static string[] GetCategories(string machineName) + { + PerformanceCounterLib library; + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machineName, culture); + string[] categories = library.GetCategories(); + if (categories.Length != 0) + return categories; + culture = culture.Parent; + } + + library = GetPerformanceCounterLib(machineName, new CultureInfo(EnglishLCID)); + return library.GetCategories(); + } + + internal string[] GetCategories() + { + ICollection keys = CategoryTable.Keys; + string[] categories = new string[keys.Count]; + keys.CopyTo(categories, 0); + return categories; + } + + internal static string GetCategoryHelp(string machine, string category) + { + PerformanceCounterLib library; + string help; + + //First check the current culture for the category. This will allow + //PerformanceCounterCategory.CategoryHelp to return localized strings. + if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + help = library.GetCategoryHelp(category); + if (help != null) + return help; + culture = culture.Parent; + } + } + + //We did not find the category walking up the culture hierarchy. Try looking + // for the category in the default culture English. + library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + help = library.GetCategoryHelp(category); + + if (help == null) + throw new InvalidOperationException(SR.Format(SR.MissingCategory)); + + return help; + } + + private string GetCategoryHelp(string category) + { + CategoryEntry entry = (CategoryEntry)CategoryTable[category]; + if (entry == null) + return null; + + return (string)HelpTable[entry.HelpIndex]; + } + + internal static CategorySample GetCategorySample(string machine, string category) + { + PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + CategorySample sample = library.GetCategorySample(category); + if (sample == null && CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + sample = library.GetCategorySample(category); + if (sample != null) + return sample; + culture = culture.Parent; + } + } + if (sample == null) + throw new InvalidOperationException(SR.Format(SR.MissingCategory)); + + return sample; + } + + private CategorySample GetCategorySample(string category) + { + CategoryEntry entry = (CategoryEntry)CategoryTable[category]; + if (entry == null) + return null; + + CategorySample sample = null; + byte[] dataRef = GetPerformanceData(entry.NameIndex.ToString(CultureInfo.InvariantCulture)); + if (dataRef == null) + throw new InvalidOperationException(SR.Format(SR.CantReadCategory, category)); + + sample = new CategorySample(dataRef, entry, this); + return sample; + } + + internal static string[] GetCounters(string machine, string category) + { + PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + bool categoryExists = false; + string[] counters = library.GetCounters(category, ref categoryExists); + + if (!categoryExists && CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + counters = library.GetCounters(category, ref categoryExists); + if (categoryExists) + return counters; + + culture = culture.Parent; + } + } + + if (!categoryExists) + throw new InvalidOperationException(SR.Format(SR.MissingCategory)); + + return counters; + } + + private string[] GetCounters(string category, ref bool categoryExists) + { + categoryExists = false; + CategoryEntry entry = (CategoryEntry)CategoryTable[category]; + if (entry == null) + return null; + else + categoryExists = true; + + int index2 = 0; + string[] counters = new string[entry.CounterIndexes.Length]; + for (int index = 0; index < counters.Length; ++index) + { + int counterIndex = entry.CounterIndexes[index]; + string counterName = (string)NameTable[counterIndex]; + if (counterName != null && counterName != string.Empty) + { + counters[index2] = counterName; + ++index2; + } + } + + //Lets adjust the array in case there were null entries + if (index2 < counters.Length) + { + string[] adjustedCounters = new string[index2]; + Array.Copy(counters, adjustedCounters, index2); + counters = adjustedCounters; + } + + return counters; + } + + internal static string GetCounterHelp(string machine, string category, string counter) + { + PerformanceCounterLib library; + bool categoryExists = false; + string help; + + //First check the current culture for the counter. This will allow + //PerformanceCounter.CounterHelp to return localized strings. + if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + help = library.GetCounterHelp(category, counter, ref categoryExists); + if (categoryExists) + return help; + culture = culture.Parent; + } + } + + //We did not find the counter walking up the culture hierarchy. Try looking + // for the counter in the default culture English. + library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + help = library.GetCounterHelp(category, counter, ref categoryExists); + + if (!categoryExists) + throw new InvalidOperationException(SR.Format(SR.MissingCategoryDetail, category)); + + return help; + } + + private string GetCounterHelp(string category, string counter, ref bool categoryExists) + { + categoryExists = false; + CategoryEntry entry = (CategoryEntry)CategoryTable[category]; + if (entry == null) + return null; + else + categoryExists = true; + + int helpIndex = -1; + for (int index = 0; index < entry.CounterIndexes.Length; ++index) + { + int counterIndex = entry.CounterIndexes[index]; + string counterName = (string)NameTable[counterIndex]; + if (counterName == null) + counterName = string.Empty; + + if (string.Equals(counterName, counter, StringComparison.OrdinalIgnoreCase)) + { + helpIndex = entry.HelpIndexes[index]; + break; + } + } + + if (helpIndex == -1) + throw new InvalidOperationException(SR.Format(SR.MissingCounter, counter)); + + string help = (string)HelpTable[helpIndex]; + if (help == null) + return string.Empty; + else + return help; + } + + internal string GetCounterName(int index) + { + if (NameTable.ContainsKey(index)) + return (string)NameTable[index]; + + return ""; + } + + private static string[] GetLanguageIds() + { + RegistryKey libraryParentKey = null; + string[] ids = Array.Empty(); + new RegistryPermission(PermissionState.Unrestricted).Assert(); + try + { + libraryParentKey = Registry.LocalMachine.OpenSubKey(PerflibPath); + + if (libraryParentKey != null) + ids = libraryParentKey.GetSubKeyNames(); + } + finally + { + if (libraryParentKey != null) + libraryParentKey.Close(); + + RegistryPermission.RevertAssert(); + } + + return ids; + } + + internal static PerformanceCounterLib GetPerformanceCounterLib(string machineName, CultureInfo culture) + { + string lcidString = culture.LCID.ToString("X3", CultureInfo.InvariantCulture); + + machineName = (machineName == "." ? ComputerName : machineName).ToLowerInvariant(); + + if (PerformanceCounterLib.s_libraryTable == null) + { + lock (InternalSyncObject) + { + if (PerformanceCounterLib.s_libraryTable == null) + PerformanceCounterLib.s_libraryTable = new Hashtable(); + } + } + + string libraryKey = machineName + ":" + lcidString; + if (PerformanceCounterLib.s_libraryTable.Contains(libraryKey)) + return (PerformanceCounterLib)PerformanceCounterLib.s_libraryTable[libraryKey]; + else + { + PerformanceCounterLib library = new PerformanceCounterLib(machineName, lcidString); + PerformanceCounterLib.s_libraryTable[libraryKey] = library; + return library; + } + } + + internal byte[] GetPerformanceData(string item) + { + if (_performanceMonitor == null) + { + lock (InternalSyncObject) + { + if (_performanceMonitor == null) + _performanceMonitor = new PerformanceMonitor(_machineName); + } + } + + return _performanceMonitor.GetData(item); + } + + private Hashtable GetStringTable(bool isHelp) + { + Hashtable stringTable; + RegistryKey libraryKey; + + if (string.Equals(_machineName, ComputerName, StringComparison.OrdinalIgnoreCase)) + libraryKey = Registry.PerformanceData; + else + { + libraryKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.PerformanceData, _machineName); + } + + try + { + string[] names = null; + int waitRetries = 14; //((2^13)-1)*10ms == approximately 1.4mins + int waitSleep = 0; + + // In some stress situations, querying counter values from + // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009 + // often returns null/empty data back. We should build fault-tolerance logic to + // make it more reliable because getting null back once doesn't necessarily mean + // that the data is corrupted, most of the time we would get the data just fine + // in subsequent tries. + while (waitRetries > 0) + { + try + { + if (!isHelp) + names = (string[])libraryKey.GetValue("Counter " + _perfLcid); + else + names = (string[])libraryKey.GetValue("Explain " + _perfLcid); + + if ((names == null) || (names.Length == 0)) + { + --waitRetries; + if (waitSleep == 0) + waitSleep = 10; + else + { + System.Threading.Thread.Sleep(waitSleep); + waitSleep *= 2; + } + } + else + break; + } + catch (IOException) + { + // RegistryKey throws if it can't find the value. We want to return an empty table + // and throw a different exception higher up the stack. + names = null; + break; + } + catch (InvalidCastException) + { + // Unable to cast object of type 'System.Byte[]' to type 'System.String[]'. + // this happens when the registry data store is corrupt and the type is not even REG_MULTI_SZ + names = null; + break; + } + } + + if (names == null) + stringTable = new Hashtable(); + else + { + stringTable = new Hashtable(names.Length / 2); + + for (int index = 0; index < (names.Length / 2); ++index) + { + string nameString = names[(index * 2) + 1]; + if (nameString == null) + nameString = string.Empty; + + int key; + if (!Int32.TryParse(names[index * 2], NumberStyles.Integer, CultureInfo.InvariantCulture, out key)) + { + if (isHelp) + { + // Category Help Table + throw new InvalidOperationException(SR.Format(SR.CategoryHelpCorrupt, names[index * 2])); + } + else + { + // Counter Name Table + throw new InvalidOperationException(SR.Format(SR.CounterNameCorrupt, names[index * 2])); + } + } + + stringTable[key] = nameString; + } + } + } + finally + { + libraryKey.Close(); + } + + return stringTable; + } + + internal static bool IsCustomCategory(string machine, string category) + { + PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + if (library.IsCustomCategory(category)) + return true; + + if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + if (library.IsCustomCategory(category)) + return true; + culture = culture.Parent; + } + } + + return false; + } + + internal static bool IsBaseCounter(int type) + { + return (type == Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BASE || + type == Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE || + type == Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_BASE || + type == Interop.Kernel32.PerformanceCounterOptions.PERF_LARGE_RAW_BASE || + type == Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_BASE); + } + + private bool IsCustomCategory(string category) + { + PerformanceCounterCategoryType categoryType; + + return FindCustomCategory(category, out categoryType); + } + + internal static PerformanceCounterCategoryType GetCategoryType(string machine, string category) + { + PerformanceCounterCategoryType categoryType = PerformanceCounterCategoryType.Unknown; + + PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID)); + if (!library.FindCustomCategory(category, out categoryType)) + { + if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID) + { + CultureInfo culture = CultureInfo.CurrentCulture; + while (culture != CultureInfo.InvariantCulture) + { + library = GetPerformanceCounterLib(machine, culture); + if (library.FindCustomCategory(category, out categoryType)) + return categoryType; + culture = culture.Parent; + } + } + } + return categoryType; + } + + internal static void RegisterCategory(string categoryName, PerformanceCounterCategoryType categoryType, string categoryHelp, CounterCreationDataCollection creationData) + { + try + { + bool iniRegistered = false; + CreateRegistryEntry(categoryName, categoryType, creationData, ref iniRegistered); + if (!iniRegistered) + { + string[] languageIds = GetLanguageIds(); + CreateIniFile(categoryName, categoryHelp, creationData, languageIds); + CreateSymbolFile(creationData); + RegisterFiles(IniFilePath, false); + } + CloseAllTables(); + CloseAllLibraries(); + } + finally + { + DeleteTemporaryFiles(); + } + } + + private static void RegisterFiles(string arg0, bool unregister) + { + Process p; + ProcessStartInfo processStartInfo = new ProcessStartInfo(); + processStartInfo.UseShellExecute = false; + processStartInfo.CreateNoWindow = true; + processStartInfo.ErrorDialog = false; + processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; + processStartInfo.WorkingDirectory = Environment.SystemDirectory; + + if (unregister) + processStartInfo.FileName = Environment.SystemDirectory + "\\unlodctr.exe"; + else + processStartInfo.FileName = Environment.SystemDirectory + "\\lodctr.exe"; + + int res = 0; + try + { + processStartInfo.Arguments = "\"" + arg0 + "\""; + p = Process.Start(processStartInfo); + p.WaitForExit(); + + res = p.ExitCode; + } + finally + { + } + + + if (res == Interop.Errors.ERROR_ACCESS_DENIED) + { + throw new UnauthorizedAccessException(SR.Format(SR.CantChangeCategoryRegistration, arg0)); + } + + // Look at Q269225, unlodctr might return 2 when WMI is not installed. + if (unregister && res == 2) + res = 0; + + if (res != 0) + throw SharedUtils.CreateSafeWin32Exception(res); + } + + internal static void UnregisterCategory(string categoryName) + { + RegisterFiles(categoryName, true); + DeleteRegistryEntry(categoryName); + CloseAllTables(); + CloseAllLibraries(); + } + } + + internal class PerformanceMonitor + { + private RegistryKey perfDataKey = null; + private string machineName; + + internal PerformanceMonitor(string machineName) + { + this.machineName = machineName; + Init(); + } + + private void Init() + { + try + { + if (machineName != "." && !string.Equals(machineName, PerformanceCounterLib.ComputerName, StringComparison.OrdinalIgnoreCase)) + { + perfDataKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.PerformanceData, machineName); + } + else + perfDataKey = Registry.PerformanceData; + } + catch (UnauthorizedAccessException) + { + // we need to do this for compatibility with v1.1 and v1.0. + throw new Win32Exception(Interop.Errors.ERROR_ACCESS_DENIED); + } + catch (IOException e) + { + // we need to do this for compatibility with v1.1 and v1.0. + throw new Win32Exception(Marshal.GetHRForException(e)); + } + } + + internal void Close() + { + if (perfDataKey != null) + perfDataKey.Close(); + + perfDataKey = null; + } + + // Win32 RegQueryValueEx for perf data could deadlock (for a Mutex) up to 2mins in some + // scenarios before they detect it and exit gracefully. In the mean time, ERROR_BUSY, + // ERROR_NOT_READY etc can be seen by other concurrent calls (which is the reason for the + // wait loop and switch case below). We want to wait most certainly more than a 2min window. + // The curent wait time of up to 10mins takes care of the known stress deadlock issues. In most + // cases we wouldn't wait for more than 2mins anyways but in worst cases how much ever time + // we wait may not be sufficient if the Win32 code keeps running into this deadlock again + // and again. A condition very rare but possible in theory. We would get back to the user + // in this case with InvalidOperationException after the wait time expires. + internal byte[] GetData(string item) + { + int waitRetries = 17; //2^16*10ms == approximately 10mins + int waitSleep = 0; + byte[] data = null; + int error = 0; + + // no need to revert here since we'll fall off the end of the method + new RegistryPermission(PermissionState.Unrestricted).Assert(); + while (waitRetries > 0) + { + try + { + data = (byte[])perfDataKey.GetValue(item); + return data; + } + catch (IOException e) + { + error = Marshal.GetHRForException(e); + switch (error) + { + case Interop.Advapi32.RPCStatus.RPC_S_CALL_FAILED: + case Interop.Errors.ERROR_INVALID_HANDLE: + case Interop.Advapi32.RPCStatus.RPC_S_SERVER_UNAVAILABLE: + Init(); + goto case Interop.Advapi32.WaitOptions.WAIT_TIMEOUT; + + case Interop.Advapi32.WaitOptions.WAIT_TIMEOUT: + case Interop.Errors.ERROR_NOT_READY: + case Interop.Errors.ERROR_LOCK_FAILED: + case Interop.Errors.ERROR_BUSY: + --waitRetries; + if (waitSleep == 0) + { + waitSleep = 10; + } + else + { + System.Threading.Thread.Sleep(waitSleep); + waitSleep *= 2; + } + break; + + default: + throw SharedUtils.CreateSafeWin32Exception(error); + } + } + catch (InvalidCastException e) + { + throw new InvalidOperationException(SR.Format(SR.CounterDataCorrupt, perfDataKey.ToString()), e); + } + } + + throw SharedUtils.CreateSafeWin32Exception(error); + } + + } + + internal class CategoryEntry + { + internal int NameIndex; + internal int HelpIndex; + internal int[] CounterIndexes; + internal int[] HelpIndexes; + + internal CategoryEntry(Interop.Advapi32.PERF_OBJECT_TYPE perfObject) + { + NameIndex = perfObject.ObjectNameTitleIndex; + HelpIndex = perfObject.ObjectHelpTitleIndex; + CounterIndexes = new int[perfObject.NumCounters]; + HelpIndexes = new int[perfObject.NumCounters]; + } + } + + internal class CategorySample + { + internal readonly long _systemFrequency; + internal readonly long _timeStamp; + internal readonly long _timeStamp100nSec; + internal readonly long _counterFrequency; + internal readonly long _counterTimeStamp; + internal Hashtable _counterTable; + internal Hashtable _instanceNameTable; + internal bool _isMultiInstance; + private CategoryEntry _entry; + private PerformanceCounterLib _library; + + internal unsafe CategorySample(byte[] data, CategoryEntry entry, PerformanceCounterLib library) + { + _entry = entry; + _library = library; + int categoryIndex = entry.NameIndex; + Interop.Advapi32.PERF_DATA_BLOCK dataBlock = new Interop.Advapi32.PERF_DATA_BLOCK(); + fixed (byte* dataPtr = data) + { + IntPtr dataRef = new IntPtr((void*)dataPtr); + + Marshal.PtrToStructure(dataRef, dataBlock); + _systemFrequency = dataBlock.PerfFreq; + _timeStamp = dataBlock.PerfTime; + _timeStamp100nSec = dataBlock.PerfTime100nSec; + dataRef = (IntPtr)((long)dataRef + dataBlock.HeaderLength); + int numPerfObjects = dataBlock.NumObjectTypes; + if (numPerfObjects == 0) + { + _counterTable = new Hashtable(); + _instanceNameTable = new Hashtable(StringComparer.OrdinalIgnoreCase); + return; + } + + //Need to find the right category, GetPerformanceData might return + //several of them. + Interop.Advapi32.PERF_OBJECT_TYPE perfObject = null; + bool foundCategory = false; + for (int index = 0; index < numPerfObjects; index++) + { + perfObject = new Interop.Advapi32.PERF_OBJECT_TYPE(); + Marshal.PtrToStructure(dataRef, perfObject); + + if (perfObject.ObjectNameTitleIndex == categoryIndex) + { + foundCategory = true; + break; + } + + dataRef = (IntPtr)((long)dataRef + perfObject.TotalByteLength); + } + + if (!foundCategory) + throw new InvalidOperationException(SR.Format(SR.CantReadCategoryIndex, categoryIndex.ToString(CultureInfo.CurrentCulture))); + + _counterFrequency = perfObject.PerfFreq; + _counterTimeStamp = perfObject.PerfTime; + int counterNumber = perfObject.NumCounters; + int instanceNumber = perfObject.NumInstances; + + if (instanceNumber == -1) + _isMultiInstance = false; + else + _isMultiInstance = true; + + // Move pointer forward to end of PERF_OBJECT_TYPE + dataRef = (IntPtr)((long)dataRef + perfObject.HeaderLength); + + CounterDefinitionSample[] samples = new CounterDefinitionSample[counterNumber]; + _counterTable = new Hashtable(counterNumber); + for (int index = 0; index < samples.Length; ++index) + { + Interop.Advapi32.PERF_COUNTER_DEFINITION perfCounter = new Interop.Advapi32.PERF_COUNTER_DEFINITION(); + Marshal.PtrToStructure(dataRef, perfCounter); + samples[index] = new CounterDefinitionSample(perfCounter, this, instanceNumber); + dataRef = (IntPtr)((long)dataRef + perfCounter.ByteLength); + + int currentSampleType = samples[index]._counterType; + if (!PerformanceCounterLib.IsBaseCounter(currentSampleType)) + { + // We'll put only non-base counters in the table. + if (currentSampleType != Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_NODATA) + _counterTable[samples[index]._nameIndex] = samples[index]; + } + else + { + // it's a base counter, try to hook it up to the main counter. + Debug.Assert(index > 0, "Index > 0 because base counters should never be at index 0"); + if (index > 0) + samples[index - 1]._baseCounterDefinitionSample = samples[index]; + } + } + + // now set up the InstanceNameTable. + if (!_isMultiInstance) + { + _instanceNameTable = new Hashtable(1, StringComparer.OrdinalIgnoreCase); + _instanceNameTable[PerformanceCounterLib.SingleInstanceName] = 0; + + for (int index = 0; index < samples.Length; ++index) + { + samples[index].SetInstanceValue(0, dataRef); + } + } + else + { + string[] parentInstanceNames = null; + _instanceNameTable = new Hashtable(instanceNumber, StringComparer.OrdinalIgnoreCase); + for (int i = 0; i < instanceNumber; i++) + { + Interop.Advapi32.PERF_INSTANCE_DEFINITION perfInstance = new Interop.Advapi32.PERF_INSTANCE_DEFINITION(); + Marshal.PtrToStructure(dataRef, perfInstance); + if (perfInstance.ParentObjectTitleIndex > 0 && parentInstanceNames == null) + parentInstanceNames = GetInstanceNamesFromIndex(perfInstance.ParentObjectTitleIndex); + + string instanceName; + if (parentInstanceNames != null && perfInstance.ParentObjectInstance >= 0 && perfInstance.ParentObjectInstance < parentInstanceNames.Length - 1) + instanceName = parentInstanceNames[perfInstance.ParentObjectInstance] + "/" + Marshal.PtrToStringUni((IntPtr)((long)dataRef + perfInstance.NameOffset)); + else + instanceName = Marshal.PtrToStringUni((IntPtr)((long)dataRef + perfInstance.NameOffset)); + + //In some cases instance names are not unique (Process), same as perfmon + //generate a unique name. + string newInstanceName = instanceName; + int newInstanceNumber = 1; + while (true) + { + if (!_instanceNameTable.ContainsKey(newInstanceName)) + { + _instanceNameTable[newInstanceName] = i; + break; + } + else + { + newInstanceName = instanceName + "#" + newInstanceNumber.ToString(CultureInfo.InvariantCulture); + ++newInstanceNumber; + } + } + + + dataRef = (IntPtr)((long)dataRef + perfInstance.ByteLength); + for (int index = 0; index < samples.Length; ++index) + samples[index].SetInstanceValue(i, dataRef); + + dataRef = (IntPtr)((long)dataRef + Marshal.ReadInt32(dataRef)); + } + } + } + } + + internal unsafe string[] GetInstanceNamesFromIndex(int categoryIndex) + { + byte[] data = _library.GetPerformanceData(categoryIndex.ToString(CultureInfo.InvariantCulture)); + fixed (byte* dataPtr = data) + { + IntPtr dataRef = new IntPtr((void*)dataPtr); + + Interop.Advapi32.PERF_DATA_BLOCK dataBlock = new Interop.Advapi32.PERF_DATA_BLOCK(); + Marshal.PtrToStructure(dataRef, dataBlock); + dataRef = (IntPtr)((long)dataRef + dataBlock.HeaderLength); + int numPerfObjects = dataBlock.NumObjectTypes; + + Interop.Advapi32.PERF_OBJECT_TYPE perfObject = null; + bool foundCategory = false; + for (int index = 0; index < numPerfObjects; index++) + { + perfObject = new Interop.Advapi32.PERF_OBJECT_TYPE(); + Marshal.PtrToStructure(dataRef, perfObject); + + if (perfObject.ObjectNameTitleIndex == categoryIndex) + { + foundCategory = true; + break; + } + + dataRef = (IntPtr)((long)dataRef + perfObject.TotalByteLength); + } + + if (!foundCategory) + return Array.Empty(); + + int counterNumber = perfObject.NumCounters; + int instanceNumber = perfObject.NumInstances; + dataRef = (IntPtr)((long)dataRef + perfObject.HeaderLength); + + if (instanceNumber == -1) + return Array.Empty(); + + CounterDefinitionSample[] samples = new CounterDefinitionSample[counterNumber]; + for (int index = 0; index < samples.Length; ++index) + { + Interop.Advapi32.PERF_COUNTER_DEFINITION perfCounter = new Interop.Advapi32.PERF_COUNTER_DEFINITION(); + Marshal.PtrToStructure(dataRef, perfCounter); + dataRef = (IntPtr)((long)dataRef + perfCounter.ByteLength); + } + + string[] instanceNames = new string[instanceNumber]; + for (int i = 0; i < instanceNumber; i++) + { + Interop.Advapi32.PERF_INSTANCE_DEFINITION perfInstance = new Interop.Advapi32.PERF_INSTANCE_DEFINITION(); + Marshal.PtrToStructure(dataRef, perfInstance); + instanceNames[i] = Marshal.PtrToStringUni((IntPtr)((long)dataRef + perfInstance.NameOffset)); + dataRef = (IntPtr)((long)dataRef + perfInstance.ByteLength); + dataRef = (IntPtr)((long)dataRef + Marshal.ReadInt32(dataRef)); + } + + return instanceNames; + } + } + + internal CounterDefinitionSample GetCounterDefinitionSample(string counter) + { + for (int index = 0; index < _entry.CounterIndexes.Length; ++index) + { + int counterIndex = _entry.CounterIndexes[index]; + string counterName = (string)_library.NameTable[counterIndex]; + if (counterName != null) + { + if (string.Equals(counterName, counter, StringComparison.OrdinalIgnoreCase)) + { + CounterDefinitionSample sample = (CounterDefinitionSample)_counterTable[counterIndex]; + if (sample == null) + { + //This is a base counter and has not been added to the table + foreach (CounterDefinitionSample multiSample in _counterTable.Values) + { + if (multiSample._baseCounterDefinitionSample != null && + multiSample._baseCounterDefinitionSample._nameIndex == counterIndex) + return multiSample._baseCounterDefinitionSample; + } + + throw new InvalidOperationException(SR.Format(SR.CounterLayout)); + } + return sample; + } + } + } + + throw new InvalidOperationException(SR.Format(SR.CantReadCounter, counter)); + } + + internal InstanceDataCollectionCollection ReadCategory() + { + +#pragma warning disable 618 + InstanceDataCollectionCollection data = new InstanceDataCollectionCollection(); +#pragma warning restore 618 + for (int index = 0; index < _entry.CounterIndexes.Length; ++index) + { + int counterIndex = _entry.CounterIndexes[index]; + + string name = (string)_library.NameTable[counterIndex]; + if (name != null && name != string.Empty) + { + CounterDefinitionSample sample = (CounterDefinitionSample)_counterTable[counterIndex]; + if (sample != null) + //If the current index refers to a counter base, + //the sample will be null + data.Add(name, sample.ReadInstanceData(name)); + } + } + + return data; + } + } + + internal class CounterDefinitionSample + { + internal readonly int _nameIndex; + internal readonly int _counterType; + internal CounterDefinitionSample _baseCounterDefinitionSample; + + private readonly int _size; + private readonly int _offset; + private long[] _instanceValues; + private CategorySample _categorySample; + + internal CounterDefinitionSample(Interop.Advapi32.PERF_COUNTER_DEFINITION perfCounter, CategorySample categorySample, int instanceNumber) + { + _nameIndex = perfCounter.CounterNameTitleIndex; + _counterType = perfCounter.CounterType; + _offset = perfCounter.CounterOffset; + _size = perfCounter.CounterSize; + if (instanceNumber == -1) + { + _instanceValues = new long[1]; + } + else + _instanceValues = new long[instanceNumber]; + + _categorySample = categorySample; + } + + private long ReadValue(IntPtr pointer) + { + if (_size == 4) + { + return (long)(uint)Marshal.ReadInt32((IntPtr)((long)pointer + _offset)); + } + else if (_size == 8) + { + return (long)Marshal.ReadInt64((IntPtr)((long)pointer + _offset)); + } + + return -1; + } + + internal CounterSample GetInstanceValue(string instanceName) + { + + if (!_categorySample._instanceNameTable.ContainsKey(instanceName)) + { + // Our native dll truncates instance names to 128 characters. If we can't find the instance + // with the full name, try truncating to 128 characters. + if (instanceName.Length > SharedPerformanceCounter.InstanceNameMaxLength) + instanceName = instanceName.Substring(0, SharedPerformanceCounter.InstanceNameMaxLength); + + if (!_categorySample._instanceNameTable.ContainsKey(instanceName)) + throw new InvalidOperationException(SR.Format(SR.CantReadInstance, instanceName)); + } + + int index = (int)_categorySample._instanceNameTable[instanceName]; + long rawValue = _instanceValues[index]; + long baseValue = 0; + if (_baseCounterDefinitionSample != null) + { + CategorySample baseCategorySample = _baseCounterDefinitionSample._categorySample; + int baseIndex = (int)baseCategorySample._instanceNameTable[instanceName]; + baseValue = _baseCounterDefinitionSample._instanceValues[baseIndex]; + } + + return new CounterSample(rawValue, + baseValue, + _categorySample._counterFrequency, + _categorySample._systemFrequency, + _categorySample._timeStamp, + _categorySample._timeStamp100nSec, + (PerformanceCounterType)_counterType, + _categorySample._counterTimeStamp); + + } + + internal InstanceDataCollection ReadInstanceData(string counterName) + { +#pragma warning disable 618 + InstanceDataCollection data = new InstanceDataCollection(counterName); +#pragma warning restore 618 + + string[] keys = new string[_categorySample._instanceNameTable.Count]; + _categorySample._instanceNameTable.Keys.CopyTo(keys, 0); + int[] indexes = new int[_categorySample._instanceNameTable.Count]; + _categorySample._instanceNameTable.Values.CopyTo(indexes, 0); + for (int index = 0; index < keys.Length; ++index) + { + long baseValue = 0; + if (_baseCounterDefinitionSample != null) + { + CategorySample baseCategorySample = _baseCounterDefinitionSample._categorySample; + int baseIndex = (int)baseCategorySample._instanceNameTable[keys[index]]; + baseValue = _baseCounterDefinitionSample._instanceValues[baseIndex]; + } + + CounterSample sample = new CounterSample(_instanceValues[indexes[index]], + baseValue, + _categorySample._counterFrequency, + _categorySample._systemFrequency, + _categorySample._timeStamp, + _categorySample._timeStamp100nSec, + (PerformanceCounterType)_counterType, + _categorySample._counterTimeStamp); + + data.Add(keys[index], new InstanceData(keys[index], sample)); + } + + return data; + } + + internal CounterSample GetSingleValue() + { + long rawValue = _instanceValues[0]; + long baseValue = 0; + if (_baseCounterDefinitionSample != null) + baseValue = _baseCounterDefinitionSample._instanceValues[0]; + + return new CounterSample(rawValue, + baseValue, + _categorySample._counterFrequency, + _categorySample._systemFrequency, + _categorySample._timeStamp, + _categorySample._timeStamp100nSec, + (PerformanceCounterType)_counterType, + _categorySample._counterTimeStamp); + } + + internal void SetInstanceValue(int index, IntPtr dataRef) + { + long rawValue = ReadValue(dataRef); + _instanceValues[index] = rawValue; + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterManager.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterManager.cs new file mode 100644 index 0000000000..5046964c55 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterManager.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Diagnostics +{ + public sealed class PerformanceCounterManager : ICollectData + { + [ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public PerformanceCounterManager() + { + } + + [ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")] + void ICollectData.CollectData(int callIdx, IntPtr valueNamePtr, IntPtr dataPtr, int totalBytes, out IntPtr res) + { + res = (IntPtr)(-1); + } + + [ObsoleteAttribute("This class has been deprecated. Use the PerformanceCounters through the System.Diagnostics.PerformanceCounter class instead. http://go.microsoft.com/fwlink/?linkid=14202")] + void ICollectData.CloseData() + { + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterType.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterType.cs new file mode 100644 index 0000000000..55534b8a9e --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterType.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Diagnostics +{ + /// + /// Enum of friendly names to counter types (maps directory to the native types) + /// + public enum PerformanceCounterType + { + NumberOfItems32 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT, + NumberOfItems64 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT, + NumberOfItemsHEX32 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_RAWCOUNT_HEX, + NumberOfItemsHEX64 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_RAWCOUNT_HEX, + RateOfCountsPerSecond32 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_COUNTER, + RateOfCountsPerSecond64 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_BULK_COUNT, + CountPerTimeInterval32 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_QUEUELEN_TYPE, + CountPerTimeInterval64 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_QUEUELEN_TYPE, + RawFraction = Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_FRACTION, + RawBase = Interop.Kernel32.PerformanceCounterOptions.PERF_RAW_BASE, + + AverageTimer32 = Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_TIMER, + AverageBase = Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BASE, + AverageCount64 = Interop.Kernel32.PerformanceCounterOptions.PERF_AVERAGE_BULK, + + SampleFraction = Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_FRACTION, + SampleCounter = Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_COUNTER, + SampleBase = Interop.Kernel32.PerformanceCounterOptions.PERF_SAMPLE_BASE, + + CounterTimer = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER, + CounterTimerInverse = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_TIMER_INV, + Timer100Ns = Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER, + Timer100NsInverse = Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_TIMER_INV, + ElapsedTime = Interop.Kernel32.PerformanceCounterOptions.PERF_ELAPSED_TIME, + CounterMultiTimer = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER, + CounterMultiTimerInverse = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_TIMER_INV, + CounterMultiTimer100Ns = Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER, + CounterMultiTimer100NsInverse = Interop.Kernel32.PerformanceCounterOptions.PERF_100NSEC_MULTI_TIMER_INV, + CounterMultiBase = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_MULTI_BASE, + + CounterDelta32 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_DELTA, + CounterDelta64 = Interop.Kernel32.PerformanceCounterOptions.PERF_COUNTER_LARGE_DELTA + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PrivilegedConfigurationManager.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PrivilegedConfigurationManager.cs new file mode 100644 index 0000000000..63e04f244b --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PrivilegedConfigurationManager.cs @@ -0,0 +1,27 @@ +//------------------------------------------------------------------------------ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +//------------------------------------------------------------------------------ + + +namespace System.Configuration { + + using System.Collections.Specialized; + using System.Security; + using System.Security.Permissions; + + [ConfigurationPermission(SecurityAction.Assert, Unrestricted=true)] + internal static class PrivilegedConfigurationManager { + internal static ConnectionStringSettingsCollection ConnectionStrings { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + get { + return ConfigurationManager.ConnectionStrings; + } + } + + internal static object GetSection(string sectionName) { + return ConfigurationManager.GetSection(sectionName); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs new file mode 100644 index 0000000000..54902ed3c3 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedPerformanceCounter.cs @@ -0,0 +1,1881 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Text; +using System.Threading; +using System.Collections; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using Microsoft.Win32; +using Microsoft.Win32.SafeHandles; + +namespace System.Diagnostics +{ + internal sealed class SharedPerformanceCounter + { + private const int MaxSpinCount = 5000; + internal const int DefaultCountersFileMappingSize = 524288; + internal const int MaxCountersFileMappingSize = 33554432; + internal const int MinCountersFileMappingSize = 32768; + internal const int InstanceNameMaxLength = 127; + internal const int InstanceNameSlotSize = 256; + internal const string SingleInstanceName = "systemdiagnosticssharedsingleinstance"; + internal const string DefaultFileMappingName = "netfxcustomperfcounters.1.0"; + internal static readonly int s_singleInstanceHashCode = GetWstrHashCode(SingleInstanceName); + private static Hashtable s_categoryDataTable = new Hashtable(StringComparer.Ordinal); + private static readonly int s_categoryEntrySize = Marshal.SizeOf(typeof(CategoryEntry)); + private static readonly int s_instanceEntrySize = Marshal.SizeOf(typeof(InstanceEntry)); + private static readonly int s_counterEntrySize = Marshal.SizeOf(typeof(CounterEntry)); + private static readonly int s_processLifetimeEntrySize = Marshal.SizeOf(typeof(ProcessLifetimeEntry)); + + private static long s_lastInstanceLifetimeSweepTick; + private const long InstanceLifetimeSweepWindow = 30 * 10000000; //ticks + private static volatile ProcessData s_procData; + + private static ProcessData ProcessData + { + get + { + if (s_procData == null) + { + try + { + int pid = (int)Interop.Kernel32.GetCurrentProcessId(); + long startTime = -1; + + // Though we have asserted the required CAS permissions above, we may + // still fail to query the process information if the user does not + // have the necessary process access rights or privileges. + // This might be the case if the current process was started by a + // different user (primary token) than the current user + // (impersonation token) that has less privilege/ACL rights. + using (SafeProcessHandle procHandle = Interop.Kernel32.OpenProcess(Interop.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION, false, pid)) + { + if (!procHandle.IsInvalid) + { + long temp; + Interop.Kernel32.GetProcessTimes(procHandle, out startTime, out temp, out temp, out temp); + } + } + s_procData = new ProcessData(pid, startTime); + } + finally + { + } + } + return s_procData; + } + } + + // InitialOffset is the offset in our global shared memory where we put the first CategoryEntry. It needs to be 4 because in + // v1.0 and v1.1 we used IntPtr.Size. That creates potential side-by-side issues on 64 bit machines using WOW64. + // A v1.0 app running on WOW64 will assume the InitialOffset is 4. A true 64 bit app on the same machine will assume + // the initial offset is 8. + // However, using an offset of 4 means that our CounterEntry.Value is potentially misaligned. This is why we have SetValue + // and other methods which split CounterEntry.Value into two ints. With separate shared memory blocks per + // category, we can fix this and always use an inital offset of 8. + internal int _initialOffset = 4; + + private CategoryData _categoryData; + private long _baseAddress; + private unsafe CounterEntry* _counterEntryPointer; + private string _categoryName; + private int _categoryNameHashCode; + private int _thisInstanceOffset = -1; + + internal SharedPerformanceCounter(string catName, string counterName, string instanceName) : + this(catName, counterName, instanceName, PerformanceCounterInstanceLifetime.Global) + { } + + internal unsafe SharedPerformanceCounter(string catName, string counterName, string instanceName, PerformanceCounterInstanceLifetime lifetime) + { + _categoryName = catName; + _categoryNameHashCode = GetWstrHashCode(_categoryName); + + _categoryData = GetCategoryData(); + + // Check that the instance name isn't too long if we're using the new shared memory. + // We allocate InstanceNameSlotSize bytes in the shared memory + if (_categoryData.UseUniqueSharedMemory) + { + if (instanceName != null && instanceName.Length > InstanceNameMaxLength) + throw new InvalidOperationException(SR.Format(SR.InstanceNameTooLong)); + } + else + { + if (lifetime != PerformanceCounterInstanceLifetime.Global) + throw new InvalidOperationException(SR.Format(SR.ProcessLifetimeNotValidInGlobal)); + } + + if (counterName != null && instanceName != null) + { + if (!_categoryData.CounterNames.Contains(counterName)) + Debug.Assert(false, "Counter " + counterName + " does not exist in category " + catName); + else + _counterEntryPointer = GetCounter(counterName, instanceName, _categoryData.EnableReuse, lifetime); + } + } + + private FileMapping FileView + { + get + { + return _categoryData.FileMapping; + } + } + + internal unsafe long Value + { + get + { + if (_counterEntryPointer == null) + return 0; + + return GetValue(_counterEntryPointer); + } + + set + { + if (_counterEntryPointer == null) + return; + + SetValue(_counterEntryPointer, value); + } + } + + private unsafe int CalculateAndAllocateMemory(int totalSize, out int alignmentAdjustment) + { + int newOffset; + int oldOffset; + alignmentAdjustment = 0; + + Debug.Assert(!_categoryData.UseUniqueSharedMemory, "We should never be calling CalculateAndAllocateMemory in the unique shared memory"); + + do + { + oldOffset = *((int*)_baseAddress); + // we need to verify the oldOffset before we start using it. Otherwise someone could change + // it to something bogus and we would write outside of the shared memory. + ResolveOffset(oldOffset, 0); + + newOffset = CalculateMemory(oldOffset, totalSize, out alignmentAdjustment); + + // In the default shared mem we need to make sure that the end address is also aligned. This is because + // in v1.1/v1.0 we just assumed that the next free offset was always properly aligned. + int endAddressMod8 = (int)(_baseAddress + newOffset) & 0x7; + int endAlignmentAdjustment = (8 - endAddressMod8) & 0x7; + newOffset += endAlignmentAdjustment; + + } while (Interlocked.CompareExchange(ref *(int*)((IntPtr)_baseAddress).ToPointer(), newOffset, oldOffset) != oldOffset); + + return oldOffset; + } + + private int CalculateMemory(int oldOffset, int totalSize, out int alignmentAdjustment) + { + int newOffset = CalculateMemoryNoBoundsCheck(oldOffset, totalSize, out alignmentAdjustment); + + if (newOffset > FileView._fileMappingSize || newOffset < 0) + { + throw new InvalidOperationException(SR.Format(SR.CountersOOM)); + } + + return newOffset; + } + + private int CalculateMemoryNoBoundsCheck(int oldOffset, int totalSize, out int alignmentAdjustment) + { + int currentTotalSize = totalSize; + + Thread.MemoryBarrier(); + + // make sure the start address is 8 byte aligned + int startAddressMod8 = (int)(_baseAddress + oldOffset) & 0x7; + alignmentAdjustment = (8 - startAddressMod8) & 0x7; + currentTotalSize = currentTotalSize + alignmentAdjustment; + + int newOffset = oldOffset + currentTotalSize; + + return newOffset; + } + + private unsafe int CreateCategory(CategoryEntry* lastCategoryPointer, + int instanceNameHashCode, string instanceName, + PerformanceCounterInstanceLifetime lifetime) + { + int categoryNameLength; + int instanceNameLength; + int alignmentAdjustment; + int freeMemoryOffset; + int newOffset = 0; + int totalSize; + + categoryNameLength = (_categoryName.Length + 1) * 2; + totalSize = s_categoryEntrySize + s_instanceEntrySize + (s_counterEntrySize * _categoryData.CounterNames.Count) + categoryNameLength; + for (int i = 0; i < _categoryData.CounterNames.Count; i++) + { + totalSize += (((string)_categoryData.CounterNames[i]).Length + 1) * 2; + } + + if (_categoryData.UseUniqueSharedMemory) + { + instanceNameLength = InstanceNameSlotSize; + totalSize += s_processLifetimeEntrySize + instanceNameLength; + + // If we're in a separate shared memory, we need to do a two stage update of the free memory pointer. + // First we calculate our alignment adjustment and where the new free offset is. Then we + // write the new structs and data. The last two operations are to link the new structs into the + // existing ones and update the next free offset. Our process could get killed in between those two, + // leaving the memory in an inconsistent state. We use the "IsConsistent" flag to help determine + // when that has happened. + freeMemoryOffset = *((int*)_baseAddress); + newOffset = CalculateMemory(freeMemoryOffset, totalSize, out alignmentAdjustment); + + if (freeMemoryOffset == _initialOffset) + lastCategoryPointer->IsConsistent = 0; + } + else + { + instanceNameLength = (instanceName.Length + 1) * 2; + totalSize += instanceNameLength; + freeMemoryOffset = CalculateAndAllocateMemory(totalSize, out alignmentAdjustment); + } + + long nextPtr = ResolveOffset(freeMemoryOffset, totalSize + alignmentAdjustment); + + CategoryEntry* newCategoryEntryPointer; + InstanceEntry* newInstanceEntryPointer; + // We need to decide where to put the padding returned in alignmentAdjustment. There are several things that + // need to be aligned. First, we need to align each struct on a 4 byte boundary so we can use interlocked + // operations on the int Spinlock field. Second, we need to align the CounterEntry on an 8 byte boundary so that + // on 64 bit platforms we can use interlocked operations on the Value field. alignmentAdjustment guarantees 8 byte + // alignemnt, so we use that for both. If we're creating the very first category, however, we can't move that + // CategoryEntry. In this case we put the alignmentAdjustment before the InstanceEntry. + if (freeMemoryOffset == _initialOffset) + { + newCategoryEntryPointer = (CategoryEntry*)nextPtr; + nextPtr += s_categoryEntrySize + alignmentAdjustment; + newInstanceEntryPointer = (InstanceEntry*)nextPtr; + } + else + { + nextPtr += alignmentAdjustment; + newCategoryEntryPointer = (CategoryEntry*)nextPtr; + nextPtr += s_categoryEntrySize; + newInstanceEntryPointer = (InstanceEntry*)nextPtr; + } + nextPtr += s_instanceEntrySize; + + // create the first CounterEntry and reserve space for all of the rest. We won't + // finish creating them until the end + CounterEntry* newCounterEntryPointer = (CounterEntry*)nextPtr; + nextPtr += s_counterEntrySize * _categoryData.CounterNames.Count; + + if (_categoryData.UseUniqueSharedMemory) + { + ProcessLifetimeEntry* newLifetimeEntry = (ProcessLifetimeEntry*)nextPtr; + nextPtr += s_processLifetimeEntrySize; + + newCounterEntryPointer->LifetimeOffset = (int)((long)newLifetimeEntry - _baseAddress); + PopulateLifetimeEntry(newLifetimeEntry, lifetime); + } + + newCategoryEntryPointer->CategoryNameHashCode = _categoryNameHashCode; + newCategoryEntryPointer->NextCategoryOffset = 0; + newCategoryEntryPointer->FirstInstanceOffset = (int)((long)newInstanceEntryPointer - _baseAddress); + newCategoryEntryPointer->CategoryNameOffset = (int)(nextPtr - _baseAddress); + SafeMarshalCopy(_categoryName, (IntPtr)nextPtr); + nextPtr += categoryNameLength; + + newInstanceEntryPointer->InstanceNameHashCode = instanceNameHashCode; + newInstanceEntryPointer->NextInstanceOffset = 0; + newInstanceEntryPointer->FirstCounterOffset = (int)((long)newCounterEntryPointer - _baseAddress); + newInstanceEntryPointer->RefCount = 1; + newInstanceEntryPointer->InstanceNameOffset = (int)(nextPtr - _baseAddress); + SafeMarshalCopy(instanceName, (IntPtr)nextPtr); + nextPtr += instanceNameLength; + + string counterName = (string)_categoryData.CounterNames[0]; + newCounterEntryPointer->CounterNameHashCode = GetWstrHashCode(counterName); + SetValue(newCounterEntryPointer, 0); + newCounterEntryPointer->CounterNameOffset = (int)(nextPtr - _baseAddress); + SafeMarshalCopy(counterName, (IntPtr)nextPtr); + nextPtr += (counterName.Length + 1) * 2; + + CounterEntry* previousCounterEntryPointer; + for (int i = 1; i < _categoryData.CounterNames.Count; i++) + { + previousCounterEntryPointer = newCounterEntryPointer; + counterName = (string)_categoryData.CounterNames[i]; + + newCounterEntryPointer++; + newCounterEntryPointer->CounterNameHashCode = GetWstrHashCode(counterName); + SetValue(newCounterEntryPointer, 0); + newCounterEntryPointer->CounterNameOffset = (int)(nextPtr - _baseAddress); + SafeMarshalCopy(counterName, (IntPtr)nextPtr); + + nextPtr += (counterName.Length + 1) * 2; + previousCounterEntryPointer->NextCounterOffset = (int)((long)newCounterEntryPointer - _baseAddress); + } + + Debug.Assert(nextPtr - _baseAddress == freeMemoryOffset + totalSize + alignmentAdjustment, "We should have used all of the space we requested at this point"); + + int offset = (int)((long)newCategoryEntryPointer - _baseAddress); + lastCategoryPointer->IsConsistent = 0; + // If not the first category node, link it. + if (offset != _initialOffset) + lastCategoryPointer->NextCategoryOffset = offset; + + if (_categoryData.UseUniqueSharedMemory) + { + *((int*)_baseAddress) = newOffset; + lastCategoryPointer->IsConsistent = 1; + } + return offset; + } + + private unsafe int CreateInstance(CategoryEntry* categoryPointer, + int instanceNameHashCode, string instanceName, + PerformanceCounterInstanceLifetime lifetime) + { + int instanceNameLength; + int totalSize = s_instanceEntrySize + (s_counterEntrySize * _categoryData.CounterNames.Count); + int alignmentAdjustment; + int freeMemoryOffset; + int newOffset = 0; + + if (_categoryData.UseUniqueSharedMemory) + { + instanceNameLength = InstanceNameSlotSize; + totalSize += s_processLifetimeEntrySize + instanceNameLength; + + // If we're in a separate shared memory, we need to do a two stage update of the free memory pointer. + // First we calculate our alignment adjustment and where the new free offset is. Then we + // write the new structs and data. The last two operations are to link the new structs into the + // existing ones and update the next free offset. Our process could get killed in between those two, + // leaving the memory in an inconsistent state. We use the "IsConsistent" flag to help determine + // when that has happened. + freeMemoryOffset = *((int*)_baseAddress); + newOffset = CalculateMemory(freeMemoryOffset, totalSize, out alignmentAdjustment); + } + else + { + instanceNameLength = (instanceName.Length + 1) * 2; + totalSize += instanceNameLength; + + // add in the counter names for the global shared mem. + for (int i = 0; i < _categoryData.CounterNames.Count; i++) + { + totalSize += (((string)_categoryData.CounterNames[i]).Length + 1) * 2; + } + freeMemoryOffset = CalculateAndAllocateMemory(totalSize, out alignmentAdjustment); + } + + freeMemoryOffset += alignmentAdjustment; + long nextPtr = ResolveOffset(freeMemoryOffset, totalSize); // don't add alignmentAdjustment since it's already + // been added to freeMemoryOffset + + InstanceEntry* newInstanceEntryPointer = (InstanceEntry*)nextPtr; + nextPtr += s_instanceEntrySize; + + // create the first CounterEntry and reserve space for all of the rest. We won't + // finish creating them until the end + CounterEntry* newCounterEntryPointer = (CounterEntry*)nextPtr; + nextPtr += s_counterEntrySize * _categoryData.CounterNames.Count; + + if (_categoryData.UseUniqueSharedMemory) + { + ProcessLifetimeEntry* newLifetimeEntry = (ProcessLifetimeEntry*)nextPtr; + nextPtr += s_processLifetimeEntrySize; + + newCounterEntryPointer->LifetimeOffset = (int)((long)newLifetimeEntry - _baseAddress); + PopulateLifetimeEntry(newLifetimeEntry, lifetime); + } + + // set up the InstanceEntry + newInstanceEntryPointer->InstanceNameHashCode = instanceNameHashCode; + newInstanceEntryPointer->NextInstanceOffset = 0; + newInstanceEntryPointer->FirstCounterOffset = (int)((long)newCounterEntryPointer - _baseAddress); + newInstanceEntryPointer->RefCount = 1; + newInstanceEntryPointer->InstanceNameOffset = (int)(nextPtr - _baseAddress); + SafeMarshalCopy(instanceName, (IntPtr)nextPtr); + + nextPtr += instanceNameLength; + + if (_categoryData.UseUniqueSharedMemory) + { + // in the unique shared mem we'll assume that the CounterEntries of the first instance + // are all created. Then we can just refer to the old counter name rather than copying in a new one. + InstanceEntry* firstInstanceInCategoryPointer = (InstanceEntry*)ResolveOffset(categoryPointer->FirstInstanceOffset, s_instanceEntrySize); + CounterEntry* firstCounterInCategoryPointer = (CounterEntry*)ResolveOffset(firstInstanceInCategoryPointer->FirstCounterOffset, s_counterEntrySize); + newCounterEntryPointer->CounterNameHashCode = firstCounterInCategoryPointer->CounterNameHashCode; + SetValue(newCounterEntryPointer, 0); + newCounterEntryPointer->CounterNameOffset = firstCounterInCategoryPointer->CounterNameOffset; + + // now create the rest of the CounterEntrys + CounterEntry* previousCounterEntryPointer; + for (int i = 1; i < _categoryData.CounterNames.Count; i++) + { + previousCounterEntryPointer = newCounterEntryPointer; + + newCounterEntryPointer++; + Debug.Assert(firstCounterInCategoryPointer->NextCounterOffset != 0, "The unique shared memory should have all of its counters created by the time we hit CreateInstance"); + firstCounterInCategoryPointer = (CounterEntry*)ResolveOffset(firstCounterInCategoryPointer->NextCounterOffset, s_counterEntrySize); + newCounterEntryPointer->CounterNameHashCode = firstCounterInCategoryPointer->CounterNameHashCode; + SetValue(newCounterEntryPointer, 0); + newCounterEntryPointer->CounterNameOffset = firstCounterInCategoryPointer->CounterNameOffset; + + previousCounterEntryPointer->NextCounterOffset = (int)((long)newCounterEntryPointer - _baseAddress); + } + } + else + { + // now create the rest of the CounterEntrys + CounterEntry* previousCounterEntryPointer = null; + for (int i = 0; i < _categoryData.CounterNames.Count; i++) + { + string counterName = (string)_categoryData.CounterNames[i]; + newCounterEntryPointer->CounterNameHashCode = GetWstrHashCode(counterName); + newCounterEntryPointer->CounterNameOffset = (int)(nextPtr - _baseAddress); + SafeMarshalCopy(counterName, (IntPtr)nextPtr); + nextPtr += (counterName.Length + 1) * 2; + + SetValue(newCounterEntryPointer, 0); + + if (i != 0) + previousCounterEntryPointer->NextCounterOffset = (int)((long)newCounterEntryPointer - _baseAddress); + + previousCounterEntryPointer = newCounterEntryPointer; + newCounterEntryPointer++; + } + } + + Debug.Assert(nextPtr - _baseAddress == freeMemoryOffset + totalSize, "We should have used all of the space we requested at this point"); + + int offset = (int)((long)newInstanceEntryPointer - _baseAddress); + categoryPointer->IsConsistent = 0; + + // prepend the new instance rather than append, helps with perf of hooking up subsequent counters + newInstanceEntryPointer->NextInstanceOffset = categoryPointer->FirstInstanceOffset; + categoryPointer->FirstInstanceOffset = offset; + + if (_categoryData.UseUniqueSharedMemory) + { + *((int*)_baseAddress) = newOffset; + categoryPointer->IsConsistent = 1; + } + + return freeMemoryOffset; + } + + private unsafe int CreateCounter(CounterEntry* lastCounterPointer, + int counterNameHashCode, string counterName) + { + int counterNameLength = (counterName.Length + 1) * 2; + int totalSize = sizeof(CounterEntry) + counterNameLength; + int alignmentAdjustment; + int freeMemoryOffset; + + Debug.Assert(!_categoryData.UseUniqueSharedMemory, "We should never be calling CreateCounter in the unique shared memory"); + freeMemoryOffset = CalculateAndAllocateMemory(totalSize, out alignmentAdjustment); + + freeMemoryOffset += alignmentAdjustment; + + long nextPtr = ResolveOffset(freeMemoryOffset, totalSize); + CounterEntry* newCounterEntryPointer = (CounterEntry*)nextPtr; + nextPtr += sizeof(CounterEntry); + + newCounterEntryPointer->CounterNameOffset = (int)(nextPtr - _baseAddress); + newCounterEntryPointer->CounterNameHashCode = counterNameHashCode; + newCounterEntryPointer->NextCounterOffset = 0; + SetValue(newCounterEntryPointer, 0); + SafeMarshalCopy(counterName, (IntPtr)nextPtr); + + Debug.Assert(nextPtr + counterNameLength - _baseAddress == freeMemoryOffset + totalSize, "We should have used all of the space we requested at this point"); + + lastCounterPointer->NextCounterOffset = (int)((long)newCounterEntryPointer - _baseAddress); + return freeMemoryOffset; + } + + private unsafe static void PopulateLifetimeEntry(ProcessLifetimeEntry* lifetimeEntry, PerformanceCounterInstanceLifetime lifetime) + { + + if (lifetime == PerformanceCounterInstanceLifetime.Process) + { + + lifetimeEntry->LifetimeType = (int)PerformanceCounterInstanceLifetime.Process; + lifetimeEntry->ProcessId = ProcessData.ProcessId; + lifetimeEntry->StartupTime = ProcessData.StartupTime; + } + else + { + lifetimeEntry->ProcessId = 0; + lifetimeEntry->StartupTime = 0; + } + } + + private static unsafe void WaitAndEnterCriticalSection(int* spinLockPointer, out bool taken) + { + WaitForCriticalSection(spinLockPointer); + + // Note - we are taking a lock here, but it probably isn't + // worthwhile to use Thread.BeginCriticalRegion & EndCriticalRegion. + // These only really help the CLR escalate from a thread abort + // to an appdomain unload, under the assumption that you may be + // editing shared state within the appdomain. Here you are editing + // shared state, but it is shared across processes. Unloading the + // appdomain isn't exactly helping. The only thing that would help + // would be if the CLR tells the host to ensure all allocations + // have a higher chance of succeeding within this critical region, + // but of course that's only a probabilisitic statement. + + // Must be able to assign to the out param. + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + } + finally + { + int r = Interlocked.CompareExchange(ref *spinLockPointer, 1, 0); + taken = (r == 0); + } + } + + private static unsafe void WaitForCriticalSection(int* spinLockPointer) + { + int spinCount = MaxSpinCount; + for (; spinCount > 0 && *spinLockPointer != 0; spinCount--) + { + // We suspect there are scenarios where the finalizer thread + // will call this method. The finalizer thread runs with + // a higher priority than the other code. Using SpinWait + // isn't sufficient, since it only spins, but doesn't yield + // to any lower-priority threads. Call Thread.Sleep(1). + if (*spinLockPointer != 0) + Thread.Sleep(1); + } + + // if the lock still isn't free, most likely there's a deadlock caused by a process + // getting killed while it held the lock. We'll just free the lock + if (spinCount == 0 && *spinLockPointer != 0) + *spinLockPointer = 0; + } + + private static unsafe void ExitCriticalSection(int* spinLockPointer) + { + *spinLockPointer = 0; + } + + // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + // This hashcode function is identical to the one in SharedPerformanceCounter.cpp. If + // you change one without changing the other, perfcounters will break. + internal static int GetWstrHashCode(string wstr) + { + uint hash = 5381; + for (uint i = 0; i < wstr.Length; i++) + hash = ((hash << 5) + hash) ^ wstr[(int)i]; + return (int)hash; + } + + // Calculate the length of a string in the shared memory. If we reach the end of the shared memory + // before we see a null terminator, we throw. + private unsafe int GetStringLength(char* startChar) + { + char* currentChar = startChar; + ulong endAddress = (ulong)(_baseAddress + FileView._fileMappingSize); + + while ((ulong)currentChar < (endAddress - 2)) + { + if (*currentChar == 0) + return (int)(currentChar - startChar); + + currentChar++; + } + + throw new InvalidOperationException(SR.Format(SR.MappingCorrupted)); + } + + // Compare a managed string to a string located at a given offset. If we walk past the end of the + // shared memory, we throw. + private unsafe bool StringEquals(string stringA, int offset) + { + char* currentChar = (char*)ResolveOffset(offset, 0); + ulong endAddress = (ulong)(_baseAddress + FileView._fileMappingSize); + + int i; + for (i = 0; i < stringA.Length; i++) + { + if ((ulong)(currentChar + i) > (endAddress - 2)) + throw new InvalidOperationException(SR.Format(SR.MappingCorrupted)); + + if (stringA[i] != currentChar[i]) + return false; + } + + // now check for the null termination. + if ((ulong)(currentChar + i) > (endAddress - 2)) + throw new InvalidOperationException(SR.Format(SR.MappingCorrupted)); + + return (currentChar[i] == 0); + } + + private unsafe CategoryData GetCategoryData() + { + CategoryData data = (CategoryData)s_categoryDataTable[_categoryName]; + + if (data == null) + { + lock (s_categoryDataTable) + { + data = (CategoryData)s_categoryDataTable[_categoryName]; + if (data == null) + { + data = new CategoryData(); + data.FileMappingName = DefaultFileMappingName; + data.MutexName = _categoryName; + + RegistryPermission registryPermission = new RegistryPermission(PermissionState.Unrestricted); + registryPermission.Assert(); + RegistryKey categoryKey = null; + try + { + categoryKey = Registry.LocalMachine.OpenSubKey(PerformanceCounterLib.ServicePath + "\\" + _categoryName + "\\Performance"); + + // first read the options + Object optionsObject = categoryKey.GetValue("CategoryOptions"); + if (optionsObject != null) + { + int options = (int)optionsObject; + data.EnableReuse = (((PerformanceCounterCategoryOptions)options & PerformanceCounterCategoryOptions.EnableReuse) != 0); + + if (((PerformanceCounterCategoryOptions)options & PerformanceCounterCategoryOptions.UseUniqueSharedMemory) != 0) + { + data.UseUniqueSharedMemory = true; + _initialOffset = 8; + data.FileMappingName = DefaultFileMappingName + _categoryName; + } + } + + int fileMappingSize; + object fileMappingSizeObject = categoryKey.GetValue("FileMappingSize"); + if (fileMappingSizeObject != null && data.UseUniqueSharedMemory) + { + // we only use this reg value in the unique shared memory case. + fileMappingSize = (int)fileMappingSizeObject; + if (fileMappingSize < MinCountersFileMappingSize) + fileMappingSize = MinCountersFileMappingSize; + + if (fileMappingSize > MaxCountersFileMappingSize) + fileMappingSize = MaxCountersFileMappingSize; + } + else + { + fileMappingSize = GetFileMappingSizeFromConfig(); + if (data.UseUniqueSharedMemory) + fileMappingSize = fileMappingSize >> 2; // if we have a custom filemapping, only make it 25% as large. + } + + // now read the counter names + object counterNamesObject = categoryKey.GetValue("Counter Names"); + byte[] counterNamesBytes = counterNamesObject as byte[]; + + if (counterNamesBytes != null) + { + ArrayList names = new ArrayList(); + fixed (byte* counterNamesPtr = counterNamesBytes) + { + int start = 0; + for (int i = 0; i < counterNamesBytes.Length - 1; i += 2) + { + if (counterNamesBytes[i] == 0 && counterNamesBytes[i + 1] == 0 && start != i) + { + string counter = new String((sbyte*)counterNamesPtr, start, i - start, Encoding.Unicode); + names.Add(counter.ToLowerInvariant()); + start = i + 2; + } + } + } + data.CounterNames = names; + } + else + { + string[] counterNames = (string[])counterNamesObject; + for (int i = 0; i < counterNames.Length; i++) + counterNames[i] = counterNames[i].ToLowerInvariant(); + data.CounterNames = new ArrayList(counterNames); + } + + data.FileMappingName = "Global\\" + data.FileMappingName; + data.MutexName = "Global\\" + _categoryName; + data.FileMapping = new FileMapping(data.FileMappingName, fileMappingSize, _initialOffset); + s_categoryDataTable[_categoryName] = data; + } + finally + { + if (categoryKey != null) + categoryKey.Close(); + RegistryPermission.RevertAssert(); + } + } + } + } + _baseAddress = (long)data.FileMapping.FileViewAddress; + + if (data.UseUniqueSharedMemory) + _initialOffset = 8; + + + return data; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static int GetFileMappingSizeFromConfig() + { + return DiagnosticsConfiguration.PerformanceCountersFileMappingSize; + } + + private static void RemoveCategoryData(string categoryName) + { + lock (s_categoryDataTable) + { + s_categoryDataTable.Remove(categoryName); + } + } + + private unsafe CounterEntry* GetCounter(string counterName, string instanceName, bool enableReuse, PerformanceCounterInstanceLifetime lifetime) + { + int counterNameHashCode = GetWstrHashCode(counterName); + int instanceNameHashCode; + if (instanceName != null && instanceName.Length != 0) + instanceNameHashCode = GetWstrHashCode(instanceName); + else + { + instanceNameHashCode = s_singleInstanceHashCode; + instanceName = SingleInstanceName; + } + + Mutex mutex = null; + CounterEntry* counterPointer = null; + InstanceEntry* instancePointer = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutexWithoutGlobal(_categoryData.MutexName, ref mutex); + CategoryEntry* categoryPointer; + bool counterFound = false; + while (!FindCategory(&categoryPointer)) + { + // don't bother locking again if we're using a separate shared memory. + bool sectionEntered; + if (_categoryData.UseUniqueSharedMemory) + sectionEntered = true; + else + WaitAndEnterCriticalSection(&(categoryPointer->SpinLock), out sectionEntered); + + int newCategoryOffset; + if (sectionEntered) + { + try + { + newCategoryOffset = CreateCategory(categoryPointer, instanceNameHashCode, instanceName, lifetime); + } + finally + { + if (!_categoryData.UseUniqueSharedMemory) + ExitCriticalSection(&(categoryPointer->SpinLock)); + } + + categoryPointer = (CategoryEntry*)(ResolveOffset(newCategoryOffset, s_categoryEntrySize)); + instancePointer = (InstanceEntry*)(ResolveOffset(categoryPointer->FirstInstanceOffset, s_instanceEntrySize)); + counterFound = FindCounter(counterNameHashCode, counterName, instancePointer, &counterPointer); + Debug.Assert(counterFound, "All counters should be created, so we should always find the counter"); + return counterPointer; + } + } + + bool foundFreeInstance; + while (!FindInstance(instanceNameHashCode, instanceName, categoryPointer, &instancePointer, true, lifetime, out foundFreeInstance)) + { + InstanceEntry* lockInstancePointer = instancePointer; + + // don't bother locking again if we're using a separate shared memory. + bool sectionEntered; + if (_categoryData.UseUniqueSharedMemory) + sectionEntered = true; + else + WaitAndEnterCriticalSection(&(lockInstancePointer->SpinLock), out sectionEntered); + + if (sectionEntered) + { + try + { + bool reused = false; + + if (enableReuse && foundFreeInstance) + { + reused = TryReuseInstance(instanceNameHashCode, instanceName, categoryPointer, &instancePointer, lifetime, lockInstancePointer); + // at this point we might have reused an instance that came from v1.1/v1.0. We can't assume it will have the counter + // we're looking for. + } + + if (!reused) + { + int newInstanceOffset = CreateInstance(categoryPointer, instanceNameHashCode, instanceName, lifetime); + instancePointer = (InstanceEntry*)(ResolveOffset(newInstanceOffset, s_instanceEntrySize)); + + counterFound = FindCounter(counterNameHashCode, counterName, instancePointer, &counterPointer); + Debug.Assert(counterFound, "All counters should be created, so we should always find the counter"); + return counterPointer; + } + } + finally + { + if (!_categoryData.UseUniqueSharedMemory) + ExitCriticalSection(&(lockInstancePointer->SpinLock)); + } + } + } + + if (_categoryData.UseUniqueSharedMemory) + { + counterFound = FindCounter(counterNameHashCode, counterName, instancePointer, &counterPointer); + Debug.Assert(counterFound, "All counters should be created, so we should always find the counter"); + return counterPointer; + } + else + { + while (!FindCounter(counterNameHashCode, counterName, instancePointer, &counterPointer)) + { + bool sectionEntered; + WaitAndEnterCriticalSection(&(counterPointer->SpinLock), out sectionEntered); + + if (sectionEntered) + { + try + { + int newCounterOffset = CreateCounter(counterPointer, counterNameHashCode, counterName); + return (CounterEntry*)(ResolveOffset(newCounterOffset, s_counterEntrySize)); + } + finally + { + ExitCriticalSection(&(counterPointer->SpinLock)); + } + } + } + + return counterPointer; + } + } + finally + { + // cache this instance for reuse + try + { + if (counterPointer != null && instancePointer != null) + { + _thisInstanceOffset = ResolveAddress((long)instancePointer, s_instanceEntrySize); + } + } + catch (InvalidOperationException) + { + _thisInstanceOffset = -1; + } + + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + + // + // FindCategory - + // + // * when the function returns true the returnCategoryPointerReference is set to the CategoryEntry + // that matches 'categoryNameHashCode' and 'categoryName' + // + // * when the function returns false the returnCategoryPointerReference is set to the last CategoryEntry + // in the linked list + // + private unsafe bool FindCategory(CategoryEntry** returnCategoryPointerReference) + { + CategoryEntry* firstCategoryPointer = (CategoryEntry*)(ResolveOffset(_initialOffset, s_categoryEntrySize)); + CategoryEntry* currentCategoryPointer = firstCategoryPointer; + CategoryEntry* previousCategoryPointer = firstCategoryPointer; + + for (; ; ) + { + if (currentCategoryPointer->IsConsistent == 0) + Verify(currentCategoryPointer); + + if (currentCategoryPointer->CategoryNameHashCode == _categoryNameHashCode) + { + if (StringEquals(_categoryName, currentCategoryPointer->CategoryNameOffset)) + { + *returnCategoryPointerReference = currentCategoryPointer; + return true; + } + } + + previousCategoryPointer = currentCategoryPointer; + if (currentCategoryPointer->NextCategoryOffset != 0) + currentCategoryPointer = (CategoryEntry*)(ResolveOffset(currentCategoryPointer->NextCategoryOffset, s_categoryEntrySize)); + else + { + *returnCategoryPointerReference = previousCategoryPointer; + return false; + } + } + } + + private unsafe bool FindCounter(int counterNameHashCode, string counterName, InstanceEntry* instancePointer, CounterEntry** returnCounterPointerReference) + { + CounterEntry* currentCounterPointer = (CounterEntry*)(ResolveOffset(instancePointer->FirstCounterOffset, s_counterEntrySize)); + CounterEntry* previousCounterPointer = currentCounterPointer; + for (; ; ) + { + if (currentCounterPointer->CounterNameHashCode == counterNameHashCode) + { + if (StringEquals(counterName, currentCounterPointer->CounterNameOffset)) + { + *returnCounterPointerReference = currentCounterPointer; + return true; + } + } + + previousCounterPointer = currentCounterPointer; + if (currentCounterPointer->NextCounterOffset != 0) + currentCounterPointer = (CounterEntry*)(ResolveOffset(currentCounterPointer->NextCounterOffset, s_counterEntrySize)); + else + { + *returnCounterPointerReference = previousCounterPointer; + return false; + } + } + } + + private unsafe bool FindInstance(int instanceNameHashCode, string instanceName, + CategoryEntry* categoryPointer, InstanceEntry** returnInstancePointerReference, + bool activateUnusedInstances, PerformanceCounterInstanceLifetime lifetime, + out bool foundFreeInstance) + { + + InstanceEntry* currentInstancePointer = (InstanceEntry*)(ResolveOffset(categoryPointer->FirstInstanceOffset, s_instanceEntrySize)); + InstanceEntry* previousInstancePointer = currentInstancePointer; + foundFreeInstance = false; + // Look at the first instance to determine if this is single or multi instance. + if (currentInstancePointer->InstanceNameHashCode == s_singleInstanceHashCode) + { + if (StringEquals(SingleInstanceName, currentInstancePointer->InstanceNameOffset)) + { + if (instanceName != SingleInstanceName) + throw new InvalidOperationException(SR.Format(SR.SingleInstanceOnly, _categoryName)); + } + else + { + if (instanceName == SingleInstanceName) + throw new InvalidOperationException(SR.Format(SR.MultiInstanceOnly, _categoryName)); + } + } + else + { + if (instanceName == SingleInstanceName) + throw new InvalidOperationException(SR.Format(SR.MultiInstanceOnly, _categoryName)); + } + + // + // 1st pass find exact matching! + // + // We don't need to aggressively claim unused instances. For performance, we would proactively + // verify lifetime of instances if activateUnusedInstances is specified and certain time + // has elapsed since last sweep or we are running out of shared memory. + bool verifyLifeTime = activateUnusedInstances; + if (activateUnusedInstances) + { + + int totalSize = s_instanceEntrySize + s_processLifetimeEntrySize + InstanceNameSlotSize + (s_counterEntrySize * _categoryData.CounterNames.Count); + int freeMemoryOffset = *((int*)_baseAddress); + int alignmentAdjustment; + int newOffset = CalculateMemoryNoBoundsCheck(freeMemoryOffset, totalSize, out alignmentAdjustment); + + if (!(newOffset > FileView._fileMappingSize || newOffset < 0)) + { + long tickDelta = (DateTime.Now.Ticks - Volatile.Read(ref s_lastInstanceLifetimeSweepTick)); + if (tickDelta < InstanceLifetimeSweepWindow) + verifyLifeTime = false; + } + } + + try + { + for (; ; ) + { + bool verifiedLifetimeOfThisInstance = false; + if (verifyLifeTime && (currentInstancePointer->RefCount != 0)) + { + verifiedLifetimeOfThisInstance = true; + VerifyLifetime(currentInstancePointer); + } + + if (currentInstancePointer->InstanceNameHashCode == instanceNameHashCode) + { + if (StringEquals(instanceName, currentInstancePointer->InstanceNameOffset)) + { + // we found a matching instance. + *returnInstancePointerReference = currentInstancePointer; + + CounterEntry* firstCounter = (CounterEntry*)ResolveOffset(currentInstancePointer->FirstCounterOffset, s_counterEntrySize); + ProcessLifetimeEntry* lifetimeEntry; + if (_categoryData.UseUniqueSharedMemory) + lifetimeEntry = (ProcessLifetimeEntry*)ResolveOffset(firstCounter->LifetimeOffset, s_processLifetimeEntrySize); + else + lifetimeEntry = null; + + // ensure that we have verified the lifetime of the matched instance + if (!verifiedLifetimeOfThisInstance && currentInstancePointer->RefCount != 0) + VerifyLifetime(currentInstancePointer); + + if (currentInstancePointer->RefCount != 0) + { + if (lifetimeEntry != null && lifetimeEntry->ProcessId != 0) + { + if (lifetime != PerformanceCounterInstanceLifetime.Process) + throw new InvalidOperationException(SR.Format(SR.CantConvertProcessToGlobal)); + + // make sure only one process is using this instance. + if (ProcessData.ProcessId != lifetimeEntry->ProcessId) + throw new InvalidOperationException(SR.Format(SR.InstanceAlreadyExists, instanceName)); + + // compare start time of the process, account for ACL issues in querying process information + if ((lifetimeEntry->StartupTime != -1) && (ProcessData.StartupTime != -1)) + { + if (ProcessData.StartupTime != lifetimeEntry->StartupTime) + throw new InvalidOperationException(SR.Format(SR.InstanceAlreadyExists, instanceName)); + } + } + else + { + if (lifetime == PerformanceCounterInstanceLifetime.Process) + throw new InvalidOperationException(SR.Format(SR.CantConvertGlobalToProcess)); + } + return true; + } + + if (activateUnusedInstances) + { + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutexWithoutGlobal(_categoryData.MutexName, ref mutex); + ClearCounterValues(currentInstancePointer); + if (lifetimeEntry != null) + PopulateLifetimeEntry(lifetimeEntry, lifetime); + + currentInstancePointer->RefCount = 1; + return true; + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + else + return false; + } + } + + if (currentInstancePointer->RefCount == 0) + { + foundFreeInstance = true; + } + + previousInstancePointer = currentInstancePointer; + if (currentInstancePointer->NextInstanceOffset != 0) + currentInstancePointer = (InstanceEntry*)(ResolveOffset(currentInstancePointer->NextInstanceOffset, s_instanceEntrySize)); + else + { + *returnInstancePointerReference = previousInstancePointer; + return false; + } + } + } + finally + { + if (verifyLifeTime) + Volatile.Write(ref s_lastInstanceLifetimeSweepTick, DateTime.Now.Ticks); + } + } + + private unsafe bool TryReuseInstance(int instanceNameHashCode, string instanceName, + CategoryEntry* categoryPointer, InstanceEntry** returnInstancePointerReference, + PerformanceCounterInstanceLifetime lifetime, + InstanceEntry* lockInstancePointer) + { + // 2nd pass find a free instance slot + InstanceEntry* currentInstancePointer = (InstanceEntry*)(ResolveOffset(categoryPointer->FirstInstanceOffset, s_instanceEntrySize)); + InstanceEntry* previousInstancePointer = currentInstancePointer; + for (; ; ) + { + if (currentInstancePointer->RefCount == 0) + { + + bool hasFit; + long instanceNamePtr; // we need cache this to avoid race conditions. + + if (_categoryData.UseUniqueSharedMemory) + { + instanceNamePtr = ResolveOffset(currentInstancePointer->InstanceNameOffset, InstanceNameSlotSize); + // In the separate shared memory case we should always have enough space for instances. The + // name slot size is fixed. + Debug.Assert(((instanceName.Length + 1) * 2) <= InstanceNameSlotSize, "The instance name length should always fit in our slot size"); + hasFit = true; + } + else + { + // we don't know the string length yet. + instanceNamePtr = ResolveOffset(currentInstancePointer->InstanceNameOffset, 0); + + // In the global shared memory, we require names to be exactly the same length in order + // to reuse them. This way we don't end up leaking any space and we don't need to + // depend on the layout of the memory to calculate the space we have. + int length = GetStringLength((char*)instanceNamePtr); + hasFit = (length == instanceName.Length); + } + + bool noSpinLock = (lockInstancePointer == currentInstancePointer) || _categoryData.UseUniqueSharedMemory; + // Instance name fit + if (hasFit) + { + // don't bother locking again if we're using a separate shared memory. + bool sectionEntered; + if (noSpinLock) + sectionEntered = true; + else + WaitAndEnterCriticalSection(&(currentInstancePointer->SpinLock), out sectionEntered); + + if (sectionEntered) + { + try + { + // Make copy with zero-term + SafeMarshalCopy(instanceName, (IntPtr)instanceNamePtr); + currentInstancePointer->InstanceNameHashCode = instanceNameHashCode; + + // return + *returnInstancePointerReference = currentInstancePointer; + // clear the counter values. + ClearCounterValues(*returnInstancePointerReference); + + if (_categoryData.UseUniqueSharedMemory) + { + CounterEntry* counterPointer = (CounterEntry*)ResolveOffset(currentInstancePointer->FirstCounterOffset, s_counterEntrySize); + ProcessLifetimeEntry* lifetimeEntry = (ProcessLifetimeEntry*)ResolveOffset(counterPointer->LifetimeOffset, s_processLifetimeEntrySize); + PopulateLifetimeEntry(lifetimeEntry, lifetime); + } + + (*returnInstancePointerReference)->RefCount = 1; + return true; + } + finally + { + if (!noSpinLock) + ExitCriticalSection(&(currentInstancePointer->SpinLock)); + } + } + } + } + + previousInstancePointer = currentInstancePointer; + if (currentInstancePointer->NextInstanceOffset != 0) + currentInstancePointer = (InstanceEntry*)(ResolveOffset(currentInstancePointer->NextInstanceOffset, s_instanceEntrySize)); + else + { + *returnInstancePointerReference = previousInstancePointer; + return false; + } + } + } + + private unsafe void Verify(CategoryEntry* currentCategoryPointer) + { + if (!_categoryData.UseUniqueSharedMemory) + return; + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutexWithoutGlobal(_categoryData.MutexName, ref mutex); + VerifyCategory(currentCategoryPointer); + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + + private unsafe void VerifyCategory(CategoryEntry* currentCategoryPointer) + { + int freeOffset = *((int*)_baseAddress); + ResolveOffset(freeOffset, 0); // verify next free offset + + // begin by verifying the head node's offset + int currentOffset = ResolveAddress((long)currentCategoryPointer, s_categoryEntrySize); + if (currentOffset >= freeOffset) + { + // zero out the bad head node entry + currentCategoryPointer->SpinLock = 0; + currentCategoryPointer->CategoryNameHashCode = 0; + currentCategoryPointer->CategoryNameOffset = 0; + currentCategoryPointer->FirstInstanceOffset = 0; + currentCategoryPointer->NextCategoryOffset = 0; + currentCategoryPointer->IsConsistent = 0; + return; + } + + if (currentCategoryPointer->NextCategoryOffset > freeOffset) + currentCategoryPointer->NextCategoryOffset = 0; + else if (currentCategoryPointer->NextCategoryOffset != 0) + VerifyCategory((CategoryEntry*)ResolveOffset(currentCategoryPointer->NextCategoryOffset, s_categoryEntrySize)); + + if (currentCategoryPointer->FirstInstanceOffset != 0) + { + // Check whether the recently added instance at the head of the list is committed. If not, rewire + // the head of the list to point to the next instance + if (currentCategoryPointer->FirstInstanceOffset > freeOffset) + { + InstanceEntry* currentInstancePointer = (InstanceEntry*)ResolveOffset(currentCategoryPointer->FirstInstanceOffset, s_instanceEntrySize); + currentCategoryPointer->FirstInstanceOffset = currentInstancePointer->NextInstanceOffset; + if (currentCategoryPointer->FirstInstanceOffset > freeOffset) + currentCategoryPointer->FirstInstanceOffset = 0; + } + + if (currentCategoryPointer->FirstInstanceOffset != 0) + { + Debug.Assert(currentCategoryPointer->FirstInstanceOffset <= freeOffset, "The head of the list is inconsistent - possible mismatch of V2 & V3 instances?"); + VerifyInstance((InstanceEntry*)ResolveOffset(currentCategoryPointer->FirstInstanceOffset, s_instanceEntrySize)); + } + } + + currentCategoryPointer->IsConsistent = 1; + } + + private unsafe void VerifyInstance(InstanceEntry* currentInstancePointer) + { + int freeOffset = *((int*)_baseAddress); + ResolveOffset(freeOffset, 0); // verify next free offset + + if (currentInstancePointer->NextInstanceOffset > freeOffset) + currentInstancePointer->NextInstanceOffset = 0; + else if (currentInstancePointer->NextInstanceOffset != 0) + VerifyInstance((InstanceEntry*)ResolveOffset(currentInstancePointer->NextInstanceOffset, s_instanceEntrySize)); + } + + private unsafe void VerifyLifetime(InstanceEntry* currentInstancePointer) + { + Debug.Assert(currentInstancePointer->RefCount != 0, "RefCount must be 1 for instances passed to VerifyLifetime"); + + CounterEntry* counter = (CounterEntry*)ResolveOffset(currentInstancePointer->FirstCounterOffset, s_counterEntrySize); + if (counter->LifetimeOffset != 0) + { + ProcessLifetimeEntry* lifetime = (ProcessLifetimeEntry*)ResolveOffset(counter->LifetimeOffset, s_processLifetimeEntrySize); + if (lifetime->LifetimeType == (int)PerformanceCounterInstanceLifetime.Process) + { + int pid = lifetime->ProcessId; + long startTime = lifetime->StartupTime; + + if (pid != 0) + { + + // Optimize for this process + if (pid == ProcessData.ProcessId) + { + if ((ProcessData.StartupTime != -1) && (startTime != -1) && (ProcessData.StartupTime != startTime)) + { + // Process id got recycled. Reclaim this instance. + currentInstancePointer->RefCount = 0; + return; + } + } + else + { + long processStartTime; + using (SafeProcessHandle procHandle = Interop.Kernel32.OpenProcess(Interop.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION, false, pid)) + { + int error = Marshal.GetLastWin32Error(); + if ((error == Interop.Errors.ERROR_INVALID_PARAMETER) && procHandle.IsInvalid) + { + // The process is dead. Reclaim this instance. Note that we only clear the refcount here. + // If we tried to clear the pid and startup time as well, we would have a race where + // we could clear the pid/startup time but not the refcount. + currentInstancePointer->RefCount = 0; + return; + } + + // Defer cleaning the instance when we had previously encountered errors in + // recording process start time (i.e, when startTime == -1) until after the + // process id is not valid (which will be caught in the if check above) + if (!procHandle.IsInvalid && startTime != -1) + { + long temp; + if (Interop.Kernel32.GetProcessTimes(procHandle, out processStartTime, out temp, out temp, out temp)) + { + if (processStartTime != startTime) + { + // The process is dead but a new one is using the same pid. Reclaim this instance. + currentInstancePointer->RefCount = 0; + return; + } + } + } + } + + // Check to see if the process handle has been signaled by the kernel. If this is the case then it's safe + // to reclaim the instance as the process is in the process of exiting. + using (SafeProcessHandle procHandle = Interop.Kernel32.OpenProcess(Interop.Advapi32.ProcessOptions.SYNCHRONIZE, false, pid)) + { + if (!procHandle.IsInvalid) + { + using (Interop.Kernel32.ProcessWaitHandle wh = new Interop.Kernel32.ProcessWaitHandle(procHandle)) + { + if (wh.WaitOne(0, false)) + { + // Process has exited + currentInstancePointer->RefCount = 0; + return; + } + } + } + } + } + } + + } + } + } + + internal unsafe long IncrementBy(long value) + { + if (_counterEntryPointer == null) + return 0; + + CounterEntry* counterEntry = _counterEntryPointer; + + return AddToValue(counterEntry, value); + } + + internal unsafe long Increment() + { + if (_counterEntryPointer == null) + return 0; + + return IncrementUnaligned(_counterEntryPointer); + } + + internal unsafe long Decrement() + { + if (_counterEntryPointer == null) + return 0; + + return DecrementUnaligned(_counterEntryPointer); + } + + internal unsafe static void RemoveAllInstances(string categoryName) + { + SharedPerformanceCounter spc = new SharedPerformanceCounter(categoryName, null, null); + spc.RemoveAllInstances(); + RemoveCategoryData(categoryName); + } + + private unsafe void RemoveAllInstances() + { + CategoryEntry* categoryPointer; + if (!FindCategory(&categoryPointer)) + return; + + InstanceEntry* instancePointer = (InstanceEntry*)(ResolveOffset(categoryPointer->FirstInstanceOffset, s_instanceEntrySize)); + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutexWithoutGlobal(_categoryData.MutexName, ref mutex); + for (; ; ) + { + RemoveOneInstance(instancePointer, true); + + if (instancePointer->NextInstanceOffset != 0) + instancePointer = (InstanceEntry*)(ResolveOffset(instancePointer->NextInstanceOffset, s_instanceEntrySize)); + else + { + break; + } + } + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + + internal unsafe void RemoveInstance(string instanceName, PerformanceCounterInstanceLifetime instanceLifetime) + { + if (instanceName == null || instanceName.Length == 0) + return; + + int instanceNameHashCode = GetWstrHashCode(instanceName); + + CategoryEntry* categoryPointer; + if (!FindCategory(&categoryPointer)) + return; + + InstanceEntry* instancePointer = null; + bool validatedCachedInstancePointer = false; + bool temp; + + Mutex mutex = null; + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + SharedUtils.EnterMutexWithoutGlobal(_categoryData.MutexName, ref mutex); + + if (_thisInstanceOffset != -1) + { + try + { + // validate whether the cached instance pointer is pointing at the right instance + instancePointer = (InstanceEntry*)(ResolveOffset(_thisInstanceOffset, s_instanceEntrySize)); + if (instancePointer->InstanceNameHashCode == instanceNameHashCode) + { + if (StringEquals(instanceName, instancePointer->InstanceNameOffset)) + { + validatedCachedInstancePointer = true; + + CounterEntry* firstCounter = (CounterEntry*)ResolveOffset(instancePointer->FirstCounterOffset, s_counterEntrySize); + ProcessLifetimeEntry* lifetimeEntry; + if (_categoryData.UseUniqueSharedMemory) + { + lifetimeEntry = (ProcessLifetimeEntry*)ResolveOffset(firstCounter->LifetimeOffset, s_processLifetimeEntrySize); + if (lifetimeEntry != null + && lifetimeEntry->LifetimeType == (int)PerformanceCounterInstanceLifetime.Process + && lifetimeEntry->ProcessId != 0) + { + validatedCachedInstancePointer &= (instanceLifetime == PerformanceCounterInstanceLifetime.Process); + validatedCachedInstancePointer &= (ProcessData.ProcessId == lifetimeEntry->ProcessId); + if ((lifetimeEntry->StartupTime != -1) && (ProcessData.StartupTime != -1)) + validatedCachedInstancePointer &= (ProcessData.StartupTime == lifetimeEntry->StartupTime); + } + else + validatedCachedInstancePointer &= (instanceLifetime != PerformanceCounterInstanceLifetime.Process); + } + } + } + } + catch (InvalidOperationException) + { + validatedCachedInstancePointer = false; + } + if (!validatedCachedInstancePointer) + _thisInstanceOffset = -1; + } + + if (!validatedCachedInstancePointer && !FindInstance(instanceNameHashCode, instanceName, categoryPointer, &instancePointer, false, instanceLifetime, out temp)) + return; + + if (instancePointer != null) + RemoveOneInstance(instancePointer, false); + } + finally + { + if (mutex != null) + { + mutex.ReleaseMutex(); + mutex.Close(); + } + } + } + + private unsafe void RemoveOneInstance(InstanceEntry* instancePointer, bool clearValue) + { + bool sectionEntered = false; + + RuntimeHelpers.PrepareConstrainedRegions(); + try + { + if (!_categoryData.UseUniqueSharedMemory) + { + while (!sectionEntered) + { + WaitAndEnterCriticalSection(&(instancePointer->SpinLock), out sectionEntered); + } + } + + instancePointer->RefCount = 0; + + if (clearValue) + ClearCounterValues(instancePointer); + } + finally + { + if (sectionEntered) + ExitCriticalSection(&(instancePointer->SpinLock)); + } + } + + private unsafe void ClearCounterValues(InstanceEntry* instancePointer) + { + //Clear counter instance values + CounterEntry* currentCounterPointer = null; + + if (instancePointer->FirstCounterOffset != 0) + currentCounterPointer = (CounterEntry*)(ResolveOffset(instancePointer->FirstCounterOffset, s_counterEntrySize)); + + while (currentCounterPointer != null) + { + SetValue(currentCounterPointer, 0); + + if (currentCounterPointer->NextCounterOffset != 0) + currentCounterPointer = (CounterEntry*)(ResolveOffset(currentCounterPointer->NextCounterOffset, s_counterEntrySize)); + else + currentCounterPointer = null; + } + + } + + private static unsafe long AddToValue(CounterEntry* counterEntry, long addend) + { + // Called while holding a lock - shouldn't have to worry about + // reading misaligned data & getting old vs. new parts of an Int64. + if (IsMisaligned(counterEntry)) + { + ulong newvalue; + + CounterEntryMisaligned* entry = (CounterEntryMisaligned*)counterEntry; + newvalue = (uint)entry->Value_hi; + newvalue <<= 32; + newvalue |= (uint)entry->Value_lo; + + + newvalue = (ulong)((long)newvalue + addend); + + entry->Value_hi = (int)(newvalue >> 32); + entry->Value_lo = (int)(newvalue & 0xffffffff); + + return (long)newvalue; + } + else + return Interlocked.Add(ref counterEntry->Value, addend); + } + + private static unsafe long DecrementUnaligned(CounterEntry* counterEntry) + { + if (IsMisaligned(counterEntry)) + return AddToValue(counterEntry, -1); + else + return Interlocked.Decrement(ref counterEntry->Value); + } + + private static unsafe long GetValue(CounterEntry* counterEntry) + { + if (IsMisaligned(counterEntry)) + { + ulong value; + CounterEntryMisaligned* entry = (CounterEntryMisaligned*)counterEntry; + value = (uint)entry->Value_hi; + value <<= 32; + value |= (uint)entry->Value_lo; + + return (long)value; + } + else + return counterEntry->Value; + } + + private static unsafe long IncrementUnaligned(CounterEntry* counterEntry) + { + if (IsMisaligned(counterEntry)) + return AddToValue(counterEntry, 1); + else + return Interlocked.Increment(ref counterEntry->Value); + } + + private static unsafe void SetValue(CounterEntry* counterEntry, long value) + { + if (IsMisaligned(counterEntry)) + { + CounterEntryMisaligned* entry = (CounterEntryMisaligned*)counterEntry; + entry->Value_lo = (int)(value & 0xffffffff); + entry->Value_hi = (int)(value >> 32); + } + else + counterEntry->Value = value; + } + + private static unsafe bool IsMisaligned(CounterEntry* counterEntry) + { + return (((Int64)counterEntry & 0x7) != 0); + } + + private long ResolveOffset(int offset, int sizeToRead) + { + //It is very important to check the integrity of the shared memory + //everytime a new address is resolved. + if (offset > (FileView._fileMappingSize - sizeToRead) || offset < 0) + throw new InvalidOperationException(SR.Format(SR.MappingCorrupted)); + + long address = _baseAddress + offset; + + return address; + } + + private int ResolveAddress(long address, int sizeToRead) + { + int offset = (int)(address - _baseAddress); + + //It is very important to check the integrity of the shared memory + //everytime a new address is resolved. + if (offset > (FileView._fileMappingSize - sizeToRead) || offset < 0) + throw new InvalidOperationException(SR.Format(SR.MappingCorrupted)); + + return offset; + } + + private class FileMapping + { + internal int _fileMappingSize; + private SafeMemoryMappedViewHandle _fileViewAddress = null; + private SafeMemoryMappedFileHandle _fileMappingHandle = null; + //The version of the file mapping name is independent from the + //assembly version. + + public FileMapping(string fileMappingName, int fileMappingSize, int initialOffset) + { + Initialize(fileMappingName, fileMappingSize, initialOffset); + } + + internal IntPtr FileViewAddress + { + get + { + if (_fileViewAddress.IsInvalid) + throw new InvalidOperationException(SR.Format(SR.SharedMemoryGhosted)); + + return _fileViewAddress.DangerousGetHandle(); + } + } + + private unsafe void Initialize(string fileMappingName, int fileMappingSize, int initialOffset) + { + string mappingName = fileMappingName; + + SafeLocalMemHandle securityDescriptorPointer = null; + try + { + // The sddl string consists of these parts: + // D: it's a DACL + // (A; this is an allow ACE + // OICI; object inherit and container inherit + // FRFWGRGW;;; allow file read, file write, generic read and generic write + // AU) granted to Authenticated Users + // ;S-1-5-33) the same permission granted to AU is also granted to restricted services + string sddlString = "D:(A;OICI;FRFWGRGW;;;AU)(A;OICI;FRFWGRGW;;;S-1-5-33)"; + + if (!Interop.Advapi32.ConvertStringSecurityDescriptorToSecurityDescriptor(sddlString, Interop.Kernel32.PerformanceCounterOptions.SDDL_REVISION_1, + out securityDescriptorPointer, IntPtr.Zero)) + throw new InvalidOperationException(SR.Format(SR.SetSecurityDescriptorFailed)); + + Interop.Kernel32.SECURITY_ATTRIBUTES securityAttributes = new Interop.Kernel32.SECURITY_ATTRIBUTES(); + securityAttributes.bInheritHandle = Interop.BOOL.FALSE; + + // + // + // Here we call CreateFileMapping to create the memory mapped file. When CreateFileMapping fails + // with ERROR_ACCESS_DENIED, we know the file mapping has been created and we then open it with OpenFileMapping. + // + // There is chance of a race condition between CreateFileMapping and OpenFileMapping; The memory mapped file + // may actually be closed in between these two calls. When this happens, OpenFileMapping returns ERROR_FILE_NOT_FOUND. + // In this case, we need to loop back and retry creating the memory mapped file. + // + // This loop will timeout in approximately 1.4 minutes. An InvalidOperationException is thrown in the timeout case. + // + // + int waitRetries = 14; //((2^13)-1)*10ms == approximately 1.4mins + int waitSleep = 0; + bool created = false; + while (!created && waitRetries > 0) + { + _fileMappingHandle = Interop.Kernel32.CreateFileMapping((IntPtr)(-1), ref securityAttributes, + Interop.Kernel32.PageOptions.PAGE_READWRITE, 0, fileMappingSize, mappingName); + + if ((Marshal.GetLastWin32Error() != Interop.Errors.ERROR_ACCESS_DENIED) || !_fileMappingHandle.IsInvalid) + { + created = true; + } + else + { + // Invalidate the old safehandle before we get rid of it. This prevents it from trying to finalize + _fileMappingHandle.SetHandleAsInvalid(); + _fileMappingHandle = Interop.Kernel32.OpenFileMapping(Interop.Kernel32.FileMapOptions.FILE_MAP_WRITE, false, mappingName); + + if ((Marshal.GetLastWin32Error() != Interop.Errors.ERROR_FILE_NOT_FOUND) || !_fileMappingHandle.IsInvalid) + { + created = true; + } + else + { + --waitRetries; + if (waitSleep == 0) + { + waitSleep = 10; + } + else + { + System.Threading.Thread.Sleep(waitSleep); + waitSleep *= 2; + } + } + } + } + if (_fileMappingHandle.IsInvalid) + { + throw new InvalidOperationException(SR.Format(SR.CantCreateFileMapping)); + } + + _fileViewAddress = Interop.Kernel32.MapViewOfFile(_fileMappingHandle, Interop.Kernel32.FileMapOptions.FILE_MAP_WRITE, 0, 0, UIntPtr.Zero); + if (_fileViewAddress.IsInvalid) + throw new InvalidOperationException(SR.Format(SR.CantMapFileView)); + + // figure out what size the share memory really is. + Interop.Kernel32.MEMORY_BASIC_INFORMATION meminfo = new Interop.Kernel32.MEMORY_BASIC_INFORMATION(); + if (Interop.Kernel32.VirtualQuery(_fileViewAddress, ref meminfo, (UIntPtr)sizeof(Interop.Kernel32.MEMORY_BASIC_INFORMATION)) == UIntPtr.Zero) + throw new InvalidOperationException(SR.Format(SR.CantGetMappingSize)); + + _fileMappingSize = (int)meminfo.RegionSize; + } + finally + { + if (securityDescriptorPointer != null) + securityDescriptorPointer.Close(); + } + + Interlocked.CompareExchange(ref *(int*)_fileViewAddress.DangerousGetHandle().ToPointer(), initialOffset, 0); + } + + } + + // SafeMarshalCopy always null terminates the char array + // before copying it to native memory + // + private static void SafeMarshalCopy(string str, IntPtr nativePointer) + { + // convert str to a char array and copy it to the unmanaged memory pointer + char[] tmp = new char[str.Length + 1]; + str.CopyTo(0, tmp, 0, str.Length); + tmp[str.Length] = '\0'; // make sure the char[] is null terminated + Marshal.Copy(tmp, 0, nativePointer, tmp.Length); + } + + // + // The final tmpPadding field is needed to make the size of this structure 8-byte aligned. This is + // necessary on IA64. + // + // Note that in V1.0 and v1.1 there was no explicit padding defined on any of these structs. That means that + // sizeof(CategoryEntry) or Marshal.SizeOf(typeof(CategoryEntry)) returned 4 bytes less before Whidbey, + // and the int we use as IsConsistent could actually overlap the InstanceEntry SpinLock. + + [StructLayout(LayoutKind.Sequential)] + private struct CategoryEntry + { + public int SpinLock; + public int CategoryNameHashCode; + public int CategoryNameOffset; + public int FirstInstanceOffset; + public int NextCategoryOffset; + public int IsConsistent; // this was 4 bytes of padding in v1.0/v1.1 + } + + [StructLayout(LayoutKind.Sequential)] + private struct InstanceEntry + { + public int SpinLock; + public int InstanceNameHashCode; + public int InstanceNameOffset; + public int RefCount; + public int FirstCounterOffset; + public int NextInstanceOffset; + } + + [StructLayout(LayoutKind.Sequential)] + private struct CounterEntry + { + public int SpinLock; + public int CounterNameHashCode; + public int CounterNameOffset; + public int LifetimeOffset; // this was 4 bytes of padding in v1.0/v1.1 + public long Value; + public int NextCounterOffset; + public int padding2; + } + + [StructLayout(LayoutKind.Sequential)] + private struct CounterEntryMisaligned + { + public int SpinLock; + public int CounterNameHashCode; + public int CounterNameOffset; + public int LifetimeOffset; // this was 4 bytes of padding in v1.0/v1.1 + public int Value_lo; + public int Value_hi; + public int NextCounterOffset; + public int padding2; // The compiler adds this only if there is an int64 in the struct - + // ie only for CounterEntry. It really needs to be here. + } + + [StructLayout(LayoutKind.Sequential)] + private struct ProcessLifetimeEntry + { + public int LifetimeType; + public int ProcessId; + public Int64 StartupTime; + } + + private class CategoryData + { + public FileMapping FileMapping; + public bool EnableReuse; + public bool UseUniqueSharedMemory; + public string FileMappingName; + public string MutexName; + public ArrayList CounterNames; + } + } + + internal class ProcessData + { + public ProcessData(int pid, long startTime) + { + ProcessId = pid; + StartupTime = startTime; + } + public int ProcessId; + public long StartupTime; + } + +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs new file mode 100644 index 0000000000..96d4622669 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SharedUtils.cs @@ -0,0 +1,330 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Security.Permissions; +using System.Threading; +using System.Text; +using Microsoft.Win32; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Diagnostics.CodeAnalysis; + +namespace System.Diagnostics +{ + internal static class SharedUtils + { + internal const int UnknownEnvironment = 0; + internal const int W2kEnvironment = 1; + internal const int NtEnvironment = 2; + internal const int NonNtEnvironment = 3; + public const int WAIT_OBJECT_0 = 0x00000000; + public const int WAIT_ABANDONED = 0x00000080; + + private static Object s_InternalSyncObject; + private static Object InternalSyncObject + { + get + { + if (s_InternalSyncObject == null) + { + Object o = new Object(); + Interlocked.CompareExchange(ref s_InternalSyncObject, o, null); + } + return s_InternalSyncObject; + } + } + + internal static Win32Exception CreateSafeWin32Exception() + { + return CreateSafeWin32Exception(0); + } + + internal static Win32Exception CreateSafeWin32Exception(int error) + { + Win32Exception newException = null; + try + { + if (error == 0) + newException = new Win32Exception(); + else + newException = new Win32Exception(error); + } + finally + { + } + + return newException; + } + + internal static void EnterMutex(string name, ref Mutex mutex) + { + string mutexName = "Global\\" + name; + + EnterMutexWithoutGlobal(mutexName, ref mutex); + } + + internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex mutex) + { + bool createdNew; + + Mutex tmpMutex = new Mutex(false, mutexName, out createdNew); + + SafeWaitForMutex(tmpMutex, ref mutex); + } + + // We need to atomically attempt to acquire the mutex and record whether we took it (because we require thread affinity + // while the mutex is held and the two states must be kept in lock step). We can get atomicity with a CER, but we don't want + // to hold a CER over a call to WaitOne (this could cause deadlocks). The final solution is to provide a new API out of + // mscorlib that performs the wait and lets us know if it succeeded. But at this late stage we don't want to expose a new + // API out of mscorlib, so we'll build our own solution. + // We'll P/Invoke out to the WaitForSingleObject inside a CER, but use a timeout to ensure we can't block a thread abort for + // an unlimited time (we do this in an infinite loop so the semantic of acquiring the mutex is unchanged, the timeout is + // just to allow us to poll for abort). A limitation of CERs in Whidbey (and part of the problem that put us in this + // position in the first place) is that a CER root in a method will cause the entire method to delay thread aborts. So we + // need to carefully partition the real CER part of out logic in a sub-method (and ensure the jit doesn't inline on us). + private static bool SafeWaitForMutex(Mutex mutexIn, ref Mutex mutexOut) + { + Debug.Assert(mutexOut == null, "You must pass in a null ref Mutex"); + + // Wait as long as necessary for the mutex. + while (true) + { + + // Attempt to acquire the mutex but timeout quickly if we can't. + if (!SafeWaitForMutexOnce(mutexIn, ref mutexOut)) + return false; + if (mutexOut != null) + return true; + + // We come out here to the outer method every so often so we're not in a CER and a thread abort can interrupt us. + // But the abort logic itself is poll based (in the this case) so we really need to check for a pending abort + // explicitly else the two timing windows will virtually never line up and we'll still end up stalling the abort + // attempt. Thread.Sleep checks for pending abort for us. + Thread.Sleep(0); + } + } + + // The portion of SafeWaitForMutex that runs under a CER and thus must not block for a arbitrary period of time. + // This method must not be inlined (to stop the CER accidently spilling into the calling method). + [MethodImplAttribute(MethodImplOptions.NoInlining)] + private static bool SafeWaitForMutexOnce(Mutex mutexIn, ref Mutex mutexOut) + { + bool ret; + + RuntimeHelpers.PrepareConstrainedRegions(); + try + { } + finally + { + // Wait for the mutex for half a second (long enough to gain the mutex in most scenarios and short enough to avoid + // impacting a thread abort for too long). + // Holding a mutex requires us to keep thread affinity and announce ourselves as a critical region. + Thread.BeginCriticalRegion(); + Thread.BeginThreadAffinity(); + int result = Interop.Kernel32.WaitForSingleObject(mutexIn.SafeWaitHandle, 500); + switch (result) + { + + case WAIT_OBJECT_0: + case WAIT_ABANDONED: + // Mutex was obtained, atomically record that fact. + mutexOut = mutexIn; + ret = true; + break; + + case Interop.Advapi32.WaitOptions.WAIT_TIMEOUT: + // Couldn't get mutex yet, simply return and we'll try again later. + ret = true; + break; + + default: + // Some sort of failure return immediately all the way to the caller of SafeWaitForMutex. + ret = false; + break; + } + + // If we're not leaving with the Mutex we don't require thread affinity and we're not a critical region any more. + if (mutexOut == null) + { + Thread.EndThreadAffinity(); + Thread.EndCriticalRegion(); + } + } + + return ret; + } + + // What if an app is locked back? Why would we use this? + internal static string GetLatestBuildDllDirectory(string machineName) + { + string dllDir = ""; + RegistryKey baseKey = null; + RegistryKey complusReg = null; + + //This property is retrieved only when creationg a new category, + // the calling code already demanded PerformanceCounterPermission. + // Therefore the assert below is safe. + + //This property is retrieved only when creationg a new log, + // the calling code already demanded EventLogPermission. + // Therefore the assert below is safe. + + RegistryPermission registryPermission = new RegistryPermission(PermissionState.Unrestricted); + registryPermission.Assert(); + + try + { + baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName); + if (baseKey == null) + throw new InvalidOperationException(SR.Format(SR.RegKeyMissingShort, "HKEY_LOCAL_MACHINE", machineName)); + + complusReg = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\.NETFramework"); + if (complusReg != null) + { + string installRoot = (string)complusReg.GetValue("InstallRoot"); + if (installRoot != null && installRoot != string.Empty) + { + // the "policy" subkey contains a v{major}.{minor} subkey for each version installed. There are also + // some extra subkeys like "standards" and "upgrades" we want to ignore. + + // first we figure out what version we are... + string versionPrefix = "v" + Environment.Version.Major + "." + Environment.Version.Minor; + RegistryKey policyKey = complusReg.OpenSubKey("policy"); + + // This is the full version string of the install on the remote machine we want to use (for example "v2.0.50727") + string version = null; + + if (policyKey != null) + { + try + { + + // First check to see if there is a version of the runtime with the same minor and major number: + RegistryKey bestKey = policyKey.OpenSubKey(versionPrefix); + + if (bestKey != null) + { + try + { + version = versionPrefix + "." + GetLargestBuildNumberFromKey(bestKey); + } + finally + { + bestKey.Close(); + } + } + else + { + // There isn't an exact match for our version, so we will look for the largest version + // installed. + string[] majorVersions = policyKey.GetSubKeyNames(); + int[] largestVersion = new int[] { -1, -1, -1 }; + for (int i = 0; i < majorVersions.Length; i++) + { + + string majorVersion = majorVersions[i]; + + // If this looks like a key of the form v{something}.{something}, we should see if it's a usable build. + if (majorVersion.Length > 1 && majorVersion[0] == 'v' && majorVersion.Contains(".")) + { + int[] currentVersion = new int[] { -1, -1, -1 }; + + string[] splitVersion = majorVersion.Substring(1).Split('.'); + + if (splitVersion.Length != 2) + { + continue; + } + + if (!Int32.TryParse(splitVersion[0], out currentVersion[0]) || !Int32.TryParse(splitVersion[1], out currentVersion[1])) + { + continue; + } + + RegistryKey k = policyKey.OpenSubKey(majorVersion); + if (k == null) + { + // We may be able to use another subkey + continue; + } + try + { + currentVersion[2] = GetLargestBuildNumberFromKey(k); + + if (currentVersion[0] > largestVersion[0] + || ((currentVersion[0] == largestVersion[0]) && (currentVersion[1] > largestVersion[1]))) + { + largestVersion = currentVersion; + } + } + finally + { + k.Close(); + } + } + } + + version = "v" + largestVersion[0] + "." + largestVersion[1] + "." + largestVersion[2]; + } + } + finally + { + policyKey.Close(); + } + + if (version != null && version != string.Empty) + { + StringBuilder installBuilder = new StringBuilder(); + installBuilder.Append(installRoot); + if (!installRoot.EndsWith("\\", StringComparison.Ordinal)) + installBuilder.Append("\\"); + installBuilder.Append(version); + dllDir = installBuilder.ToString(); + } + } + } + } + } + catch + { + // ignore + } + finally + { + if (complusReg != null) + complusReg.Close(); + + if (baseKey != null) + baseKey.Close(); + + RegistryPermission.RevertAssert(); + } + + return dllDir; + } + + private static int GetLargestBuildNumberFromKey(RegistryKey rootKey) + { + int largestBuild = -1; + + string[] minorVersions = rootKey.GetValueNames(); + for (int i = 0; i < minorVersions.Length; i++) + { + int o; + if (Int32.TryParse(minorVersions[i], out o)) + { + largestBuild = (largestBuild > o) ? largestBuild : o; + } + } + + return largestBuild; + } + + private static string GetLocalBuildDirectory() + { + return RuntimeEnvironment.GetRuntimeDirectory(); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SystemDiagnosticsSection.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SystemDiagnosticsSection.cs new file mode 100644 index 0000000000..9b72d5dc8b --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SystemDiagnosticsSection.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Configuration; + +namespace System.Diagnostics +{ + internal class SystemDiagnosticsSection : ConfigurationSection + { + private static readonly ConfigurationProperty s_propPerfCounters = new ConfigurationProperty("performanceCounters", typeof(PerfCounterSection), new PerfCounterSection(), ConfigurationPropertyOptions.None); + private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection { s_propPerfCounters }; + + [ConfigurationProperty("performanceCounters")] + public PerfCounterSection PerfCounters => (PerfCounterSection)base[s_propPerfCounters]; + + protected override ConfigurationPropertyCollection Properties => s_properties; + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/TraceInternal.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/TraceInternal.cs new file mode 100644 index 0000000000..55c6b75861 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/TraceInternal.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +namespace System.Diagnostics +{ + internal static class TraceInternal + { + // this is internal so TraceSource can use it. We want to lock on the same object because both TraceInternal and + // TraceSource could be writing to the same listeners at the same time. + internal static readonly object critSec = new object(); + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/src/misc/EnvironmentHelpers.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/misc/EnvironmentHelpers.cs new file mode 100644 index 0000000000..9bcd850cb7 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/src/misc/EnvironmentHelpers.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Security; +using System.Security.Principal; + +namespace System +{ + internal static class EnvironmentHelpers + { + private static volatile bool s_isAppContainerProcess; + private static volatile bool s_isAppContainerProcessInitalized; + + public static bool IsAppContainerProcess + { + get + { + if(!s_isAppContainerProcessInitalized) + { + if(Environment.OSVersion.Version.Major < 6 || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor <= 1)) + { + // Windows 7 or older. + s_isAppContainerProcess = false; + } + else + { + s_isAppContainerProcess = HasAppContainerToken(); + } + + s_isAppContainerProcessInitalized = true; + } + + return s_isAppContainerProcess; + } + } + + private static unsafe bool HasAppContainerToken() + { + int* dwIsAppContainerPtr = stackalloc int[1]; + uint dwLength = 0; + + using (WindowsIdentity wi = WindowsIdentity.GetCurrent(TokenAccessLevels.Query)) + { + if (!Interop.Advapi32.GetTokenInformation(wi.Token, (uint)Interop.Advapi32.TOKEN_INFORMATION_CLASS.TokenIsAppContainer, new IntPtr(dwIsAppContainerPtr), sizeof(int), out dwLength)) + { + throw new Win32Exception(); + } + } + + return (*dwIsAppContainerPtr != 0); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/Configurations.props b/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/Configurations.props new file mode 100644 index 0000000000..51d1fc2309 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/Configurations.props @@ -0,0 +1,9 @@ + + + + + netcoreapp-Windows_NT; + netfx; + + + diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs b/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs new file mode 100644 index 0000000000..1f7fcfc72f --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/PerformanceCounterTests.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Specialized; +using Xunit; + +namespace System.Diagnostics.Tests +{ + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] // In appcontainer, cannot write to perf counters + public static class PerformanceCounterTests + { + [ConditionalFact(typeof(AdminHelpers), nameof(AdminHelpers.IsProcessElevated))] + public static void PerformanceCounterCategory_CreateCategory() + { + if ( !PerformanceCounterCategory.Exists("AverageCounter64SampleCategory") ) + { + CounterCreationDataCollection counterDataCollection = new CounterCreationDataCollection(); + + // Add the counter. + CounterCreationData averageCount64 = new CounterCreationData(); + averageCount64.CounterType = PerformanceCounterType.AverageCount64; + averageCount64.CounterName = "AverageCounter64Sample"; + counterDataCollection.Add(averageCount64); + + // Add the base counter. + CounterCreationData averageCount64Base = new CounterCreationData(); + averageCount64Base.CounterType = PerformanceCounterType.AverageBase; + averageCount64Base.CounterName = "AverageCounter64SampleBase"; + counterDataCollection.Add(averageCount64Base); + + // Create the category. + PerformanceCounterCategory.Create("AverageCounter64SampleCategory", + "Demonstrates usage of the AverageCounter64 performance counter type.", + PerformanceCounterCategoryType.SingleInstance, counterDataCollection); + } + + Assert.True(PerformanceCounterCategory.Exists("AverageCounter64SampleCategory")); + } + + [ConditionalFact(typeof(AdminHelpers), nameof(AdminHelpers.IsProcessElevated))] + public static void PerformanceCounter_CreateCounter_Count0() + { + var name = Guid.NewGuid().ToString("N") + "_Counter"; + var category = name + "_Category"; + if ( !PerformanceCounterCategory.Exists(category) ) + { + CounterCreationDataCollection counterDataCollection = new CounterCreationDataCollection(); + + // Add the counter. + CounterCreationData counter = new CounterCreationData(); + counter.CounterType = PerformanceCounterType.AverageCount64; + counter.CounterName = name; + counterDataCollection.Add(counter); + + // Add the base counter. + CounterCreationData counterBase = new CounterCreationData(); + counterBase.CounterType = PerformanceCounterType.AverageBase; + counterBase.CounterName = name + "Base"; + counterDataCollection.Add(counterBase); + + // Create the category. + PerformanceCounterCategory.Create(category, + "description", + PerformanceCounterCategoryType.SingleInstance, counterDataCollection); + } + + PerformanceCounter counterSample = new PerformanceCounter(category, + name, false); + + counterSample.RawValue = 0; + + Assert.Equal(0, counterSample.RawValue); + } + } +} diff --git a/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/System.Diagnostics.PerformanceCounter.Tests.csproj b/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/System.Diagnostics.PerformanceCounter.Tests.csproj new file mode 100644 index 0000000000..dcdb5ef17c --- /dev/null +++ b/external/corefx/src/System.Diagnostics.PerformanceCounter/tests/System.Diagnostics.PerformanceCounter.Tests.csproj @@ -0,0 +1,18 @@ + + + + + {296074B7-1CC9-497E-8C1E-FC5C985C75C6} + + + + + + + + + Common\System\ShouldNotBeInvokedException.cs + + + + diff --git a/external/corefx/src/System.Diagnostics.Process/src/Resources/Strings.resx b/external/corefx/src/System.Diagnostics.Process/src/Resources/Strings.resx index 71dc8266c7..e4ee4b3903 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/Resources/Strings.resx +++ b/external/corefx/src/System.Diagnostics.Process/src/Resources/Strings.resx @@ -210,6 +210,9 @@ The Process object must have the UseShellExecute property set to false in order to redirect IO streams. + + The FileName property should not be a directory unless UseShellExecute is set. + An async read operation has already been started on the stream. diff --git a/external/corefx/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj b/external/corefx/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj index 4e3cd026a1..fd49b2d334 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj +++ b/external/corefx/src/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj @@ -184,6 +184,9 @@ Common\Interop\Windows\kernel32\Interop.DuplicateHandle.cs + + Common\Interop\Windows\kernel32\Interop.ProcessWaitHandle.cs + Common\Interop\Windows\advapi32\Interop.OpenProcessToken.cs @@ -274,7 +277,6 @@ - @@ -402,6 +404,7 @@ + @@ -422,4 +425,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/PerformanceCounterLib.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/PerformanceCounterLib.cs index 1ac863cdd2..d5452ce8a3 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/PerformanceCounterLib.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/PerformanceCounterLib.cs @@ -2,9 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. + #if FEATURE_REGISTRY using Microsoft.Win32; #endif +using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; @@ -21,7 +23,7 @@ namespace System.Diagnostics private string _machineName; private string _perfLcid; - private static Dictionary s_libraryTable; + private static ConcurrentDictionary<(string machineName, string lcidString), PerformanceCounterLib> s_libraryTable; private Dictionary _nameTable; private readonly object _nameTableLock = new Object(); @@ -67,16 +69,9 @@ namespace System.Diagnostics else machineName = machineName.ToLowerInvariant(); - LazyInitializer.EnsureInitialized(ref s_libraryTable, ref s_internalSyncObject, () => new Dictionary()); + LazyInitializer.EnsureInitialized(ref s_libraryTable, ref s_internalSyncObject, () => new ConcurrentDictionary<(string, string), PerformanceCounterLib>()); - string libraryKey = machineName + ":" + lcidString; - PerformanceCounterLib library; - if (!PerformanceCounterLib.s_libraryTable.TryGetValue(libraryKey, out library)) - { - library = new PerformanceCounterLib(machineName, lcidString); - PerformanceCounterLib.s_libraryTable[libraryKey] = library; - } - return library; + return PerformanceCounterLib.s_libraryTable.GetOrAdd((machineName, lcidString), (key) => new PerformanceCounterLib(key.machineName, key.lcidString)); } internal byte[] GetPerformanceData(string item) diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs index bf05c42546..898cf347ec 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs @@ -57,6 +57,21 @@ namespace System.Diagnostics } } + /// Gets execution path + private string GetPathToOpenFile() + { + string[] allowedProgramsToRun = { "xdg-open", "gnome-open", "kfmclient" }; + foreach (var program in allowedProgramsToRun) + { + string pathToProgram = FindProgramInPath(program); + if (!string.IsNullOrEmpty(pathToProgram)) + { + return pathToProgram; + } + } + return null; + } + /// /// Gets the amount of time the associated process has spent utilizing the CPU. /// It is the sum of the and @@ -171,9 +186,14 @@ namespace System.Diagnostics // ---- PAL layer ends here ---- // ----------------------------- - /// Gets the path to the current executable, or null if it could not be retrieved. - private static string GetExePath() + /// Gets the path to the executable for the process, or null if it could not be retrieved. + /// The pid for the target process, or -1 for the current process. + internal static string GetExePath(int processId = -1) { + string exeFilePath = processId == -1 ? + Interop.procfs.SelfExeFilePath : + Interop.procfs.GetExeFilePathForProcess(processId); + // Determine the maximum size of a path int maxPath = Interop.Sys.MaxPath; @@ -182,7 +202,7 @@ namespace System.Diagnostics { // Read from procfs the symbolic link to this process' executable byte[] buffer = new byte[pathLen + 1]; // +1 for null termination - int resultLength = Interop.Sys.ReadLink(Interop.procfs.SelfExeFilePath, buffer, pathLen); + int resultLength = Interop.Sys.ReadLink(exeFilePath, buffer, pathLen); // If we got one, null terminate it (readlink doesn't do this) and return the string if (resultLength > 0) diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs index 2870fc7ae3..560d04c4cb 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.OSX.cs @@ -88,6 +88,12 @@ namespace System.Diagnostics } } + /// Gets execution path + private string GetPathToOpenFile() + { + return "/usr/bin/open"; + } + /// /// Gets the amount of time the associated process has spent utilizing the CPU. /// It is the sum of the and diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs index 2d2c3c2fea..05976713ab 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs @@ -45,7 +45,7 @@ namespace System.Diagnostics [CLSCompliant(false)] public static Process Start(string fileName, string arguments, string userName, SecureString password, string domain) - { + { throw new PlatformNotSupportedException(SR.ProcessStartIdentityNotSupported); } @@ -83,6 +83,37 @@ namespace System.Diagnostics GetWaitState(); // lazily initializes the wait state } + /// + /// Make sure we are watching for a process exit. + /// + /// + private void EnsureWatchingForExit() + { + if (!_watchingForExit) + { + lock (this) + { + if (!_watchingForExit) + { + Debug.Assert(_haveProcessHandle, "Process.EnsureWatchingForExit called with no process handle"); + Debug.Assert(Associated, "Process.EnsureWatchingForExit called with no associated process"); + _watchingForExit = true; + try + { + _waitHandle = new ProcessWaitHandle(_processHandle); + _registeredWaitHandle = ThreadPool.RegisterWaitForSingleObject(_waitHandle, + new WaitOrTimerCallback(CompletionCallback), null, -1, true); + } + catch + { + _watchingForExit = false; + throw; + } + } + } + } + } + /// /// Instructs the Process component to wait the specified number of milliseconds for the associated process to exit. /// @@ -163,7 +194,7 @@ namespace System.Diagnostics } Debug.Assert(pri >= -20 && pri <= 20); - return + return pri < -15 ? ProcessPriorityClass.RealTime : pri < -10 ? ProcessPriorityClass.High : pri < -5 ? ProcessPriorityClass.AboveNormal : @@ -219,7 +250,10 @@ namespace System.Diagnostics return new SafeProcessHandle(_processId); } - /// Starts the process using the supplied start info. + /// + /// Starts the process using the supplied start info. + /// With UseShellExecute option, we'll try the shell tools to launch it(e.g. "open fileName") + /// /// The start info with which to start the process. private bool StartCore(ProcessStartInfo startInfo) { @@ -232,32 +266,43 @@ namespace System.Diagnostics { throw new InvalidOperationException(SR.CantRedirectStreams); } + } - const string ShellPath = "/bin/sh"; + int childPid, stdinFd, stdoutFd, stderrFd; + string[] envp = CreateEnvp(startInfo); + string cwd = !string.IsNullOrWhiteSpace(startInfo.WorkingDirectory) ? startInfo.WorkingDirectory : null; - filename = ShellPath; - argv = new string[3] { ShellPath, "-c", startInfo.FileName + " " + startInfo.Arguments}; + if (startInfo.UseShellExecute) + { + // use default program to open file/url + filename = GetPathToOpenFile(); + argv = ParseArgv(startInfo, filename); } else { filename = ResolvePath(startInfo.FileName); argv = ParseArgv(startInfo); + if (Directory.Exists(filename)) + { + throw new Win32Exception(SR.DirectoryNotValidAsInput); + } } - string[] envp = CreateEnvp(startInfo); - string cwd = !string.IsNullOrWhiteSpace(startInfo.WorkingDirectory) ? startInfo.WorkingDirectory : null; + if (string.IsNullOrEmpty(filename)) + { + throw new Win32Exception(Interop.Error.ENOENT.Info().RawErrno); + } // Invoke the shim fork/execve routine. It will create pipes for all requested // redirects, fork a child process, map the pipe ends onto the appropriate stdin/stdout/stderr // descriptors, and execve to execute the requested process. The shim implementation // is used to fork/execve as executing managed code in a forked process is not safe (only // the calling thread will transfer, thread IDs aren't stable across the fork, etc.) - int childPid, stdinFd, stdoutFd, stderrFd; Interop.Sys.ForkAndExecProcess( - filename, argv, envp, cwd, - startInfo.RedirectStandardInput, startInfo.RedirectStandardOutput, startInfo.RedirectStandardError, - out childPid, - out stdinFd, out stdoutFd, out stderrFd); + filename, argv, envp, cwd, + startInfo.RedirectStandardInput, startInfo.RedirectStandardOutput, startInfo.RedirectStandardError, + out childPid, + out stdinFd, out stdoutFd, out stderrFd); // Store the child's information into this Process object. Debug.Assert(childPid >= 0); @@ -300,23 +345,31 @@ namespace System.Diagnostics /// Size to use for redirect streams and stream readers/writers. private const int StreamBufferSize = 4096; + /// Converts the filename and arguments information from a ProcessStartInfo into an argv array. /// The ProcessStartInfo. + /// alternative resolved path to use as first argument /// The argv array. - private static string[] ParseArgv(ProcessStartInfo psi) + private static string[] ParseArgv(ProcessStartInfo psi, string alternativePath = null) { - string argv0 = psi.FileName; // pass filename (instead of resolved path) as argv[0], to match what caller supplied - if (string.IsNullOrEmpty(psi.Arguments)) + string argv0 = psi.FileName; // when no alternative path exists, pass filename (instead of resolved path) as argv[0], to match what caller supplied + if (string.IsNullOrEmpty(psi.Arguments) && string.IsNullOrEmpty(alternativePath)) { return new string[] { argv0 }; } - else + + var argvList = new List(); + if (!string.IsNullOrEmpty(alternativePath)) { - var argvList = new List(); - argvList.Add(argv0); - ParseArgumentsIntoList(psi.Arguments, argvList); - return argvList.ToArray(); + argvList.Add(alternativePath); + if (alternativePath.Contains("kfmclient")) + { + argvList.Add("openURL"); // kfmclient needs OpenURL + } } + argvList.Add(argv0); + ParseArgumentsIntoList(psi.Arguments, argvList); + return argvList.ToArray(); } /// Converts the environment variables information from a ProcessStartInfo into an envp array. @@ -333,9 +386,9 @@ namespace System.Diagnostics return envp; } - /// Resolves a path to the filename passed to ProcessStartInfo. + /// Resolves a path to the filename passed to ProcessStartInfo. /// The filename. - /// The resolved path. + /// The resolved path. It can return null in case of URLs. private static string ResolvePath(string filename) { // Follow the same resolution that Windows uses with CreateProcess: @@ -377,6 +430,17 @@ namespace System.Diagnostics } // Then check each directory listed in the PATH environment variables + return FindProgramInPath(filename); + } + + /// + /// Gets the path to the program + /// + /// + /// + private static string FindProgramInPath(string program) + { + string path; string pathEnvVar = Environment.GetEnvironmentVariable("PATH"); if (pathEnvVar != null) { @@ -384,16 +448,14 @@ namespace System.Diagnostics while (pathParser.MoveNext()) { string subPath = pathParser.ExtractCurrent(); - path = Path.Combine(subPath, filename); + path = Path.Combine(subPath, program); if (File.Exists(path)) { return path; } } } - - // Could not find the file - throw new Win32Exception(Interop.Error.ENOENT.Info().RawErrno); + return null; } /// Convert a number of "jiffies", or ticks, to a TimeSpan. @@ -436,7 +498,7 @@ namespace System.Diagnostics { Debug.Assert(fd >= 0); return new FileStream( - new SafeFileHandle((IntPtr)fd, ownsHandle: true), + new SafeFileHandle((IntPtr)fd, ownsHandle: true), access, StreamBufferSize, isAsync: false); } diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs index f6e65b1219..3798c6f210 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs @@ -107,6 +107,37 @@ namespace System.Diagnostics // Nop } + /// + /// Make sure we are watching for a process exit. + /// + /// + private void EnsureWatchingForExit() + { + if (!_watchingForExit) + { + lock (this) + { + if (!_watchingForExit) + { + Debug.Assert(_haveProcessHandle, "Process.EnsureWatchingForExit called with no process handle"); + Debug.Assert(Associated, "Process.EnsureWatchingForExit called with no associated process"); + _watchingForExit = true; + try + { + _waitHandle = new Interop.Kernel32.ProcessWaitHandle(_processHandle); + _registeredWaitHandle = ThreadPool.RegisterWaitForSingleObject(_waitHandle, + new WaitOrTimerCallback(CompletionCallback), null, -1, true); + } + catch + { + _watchingForExit = false; + throw; + } + } + } + } + } + /// /// Instructs the Process component to wait the specified number of milliseconds for the associated process to exit. /// @@ -119,7 +150,7 @@ namespace System.Diagnostics if (handle.IsInvalid) return true; - using (ProcessWaitHandle processWaitHandle = new ProcessWaitHandle(handle)) + using (Interop.Kernel32.ProcessWaitHandle processWaitHandle = new Interop.Kernel32.ProcessWaitHandle(handle)) { return _signaled = processWaitHandle.WaitOne(milliseconds); } @@ -184,7 +215,7 @@ namespace System.Diagnostics // since some process could return an actual STILL_ACTIVE exit code (259). if (!_signaled) // if we just came from WaitForExit, don't repeat { - using (var wh = new ProcessWaitHandle(handle)) + using (var wh = new Interop.Kernel32.ProcessWaitHandle(handle)) { _signaled = wh.WaitOne(0); } @@ -765,7 +796,7 @@ namespace System.Diagnostics // Since haveProcessHandle is true, we know we have the process handle // open with at least SYNCHRONIZE access, so we can wait on it with // zero timeout to see if the process has exited. - using (ProcessWaitHandle waitHandle = new ProcessWaitHandle(_processHandle)) + using (Interop.Kernel32.ProcessWaitHandle waitHandle = new Interop.Kernel32.ProcessWaitHandle(_processHandle)) { if (waitHandle.WaitOne(0)) { diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.cs index c6cebbf7fa..a6ce74d2cb 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/Process.cs @@ -919,37 +919,6 @@ namespace System.Diagnostics } } - /// - /// Make sure we are watching for a process exit. - /// - /// - private void EnsureWatchingForExit() - { - if (!_watchingForExit) - { - lock (this) - { - if (!_watchingForExit) - { - Debug.Assert(_haveProcessHandle, "Process.EnsureWatchingForExit called with no process handle"); - Debug.Assert(Associated, "Process.EnsureWatchingForExit called with no associated process"); - _watchingForExit = true; - try - { - _waitHandle = new ProcessWaitHandle(_processHandle); - _registeredWaitHandle = ThreadPool.RegisterWaitForSingleObject(_waitHandle, - new WaitOrTimerCallback(CompletionCallback), null, -1, true); - } - catch - { - _watchingForExit = false; - throw; - } - } - } - } - } - /// /// Make sure we have obtained the min and max working set limits. /// diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs index a64f50d89a..61e1d1f2e5 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs @@ -80,6 +80,22 @@ namespace System.Diagnostics } } + // Move the main executable module to be the first in the list if it's not already + string exePath = Process.GetExePath(processId); + for (int i = 0; i < modules.Count; i++) + { + ProcessModule module = modules[i]; + if (module.FileName == exePath) + { + if (i > 0) + { + modules.RemoveAt(i); + modules.Insert(0, module); + } + break; + } + } + // Return the set of modules found return modules; } diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Uap.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Uap.cs index e4f077d54a..a9b22ca5a9 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Uap.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Uap.cs @@ -17,17 +17,6 @@ namespace System.Diagnostics internal static partial class ProcessManager { public static IntPtr GetMainWindowHandle(int processId) => IntPtr.Zero; - - /// Gets process infos for each process on the specified machine. - /// The target machine. - /// An array of process infos, one per found process. - public static ProcessInfo[] GetProcessInfos(string machineName) - { - if (!IsRemoteMachine(machineName)) - throw new PlatformNotSupportedException(SR.GetProcessInfoNotSupported); // NtDll.NtQuerySystemInformation is not available in Uap - - return NtProcessManager.GetProcessInfos(machineName, isRemoteMachine: true); - } } internal static partial class NtProcessManager @@ -85,4 +74,12 @@ namespace System.Diagnostics return new ProcessModuleCollection(0); } } + + internal static partial class NtProcessInfoHelper + { + internal static ProcessInfo[] GetProcessInfos(Predicate processIdFilter = null) + { + throw new PlatformNotSupportedException(SR.GetProcessInfoNotSupported); // NtDll.NtQuerySystemInformation is not available in Uap + } + } } diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs index ea44afa15d..96e6c46d61 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs @@ -18,16 +18,6 @@ namespace System.Diagnostics MainWindowFinder finder = new MainWindowFinder(); return finder.FindMainWindow(processId); } - - /// Gets process infos for each process on the specified machine. - /// The target machine. - /// An array of process infos, one per found process. - public static ProcessInfo[] GetProcessInfos(string machineName) - { - return IsRemoteMachine(machineName) ? - NtProcessManager.GetProcessInfos(machineName, isRemoteMachine: true) : - NtProcessInfoHelper.GetProcessInfos(); // Do not use performance counter for local machine - } } internal sealed class MainWindowFinder @@ -253,7 +243,7 @@ namespace System.Diagnostics // Cache a single buffer for use in GetProcessInfos(). private static long[] CachedBuffer; - public static ProcessInfo[] GetProcessInfos() + internal static ProcessInfo[] GetProcessInfos(Predicate processIdFilter = null) { int requiredSize = 0; int status; @@ -304,7 +294,7 @@ namespace System.Diagnostics } // Parse the data block to get process information - processInfos = GetProcessInfos(bufferHandle.AddrOfPinnedObject()); + processInfos = GetProcessInfos(bufferHandle.AddrOfPinnedObject(), processIdFilter); } finally { diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Windows.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Windows.cs index 80a79f9a01..a99a1a390a 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Windows.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Windows.cs @@ -44,20 +44,44 @@ namespace System.Diagnostics return Array.IndexOf(GetProcessIds(machineName), processId) >= 0; } + /// Gets process infos for each process on the specified machine. + /// The target machine. + /// An array of process infos, one per found process. + public static ProcessInfo[] GetProcessInfos(string machineName) + { + return IsRemoteMachine(machineName) ? + NtProcessManager.GetProcessInfos(machineName, isRemoteMachine: true) : + NtProcessInfoHelper.GetProcessInfos(); + } + /// Gets the ProcessInfo for the specified process ID on the specified machine. /// The process ID. /// The machine name. /// The ProcessInfo for the process if it could be found; otherwise, null. public static ProcessInfo GetProcessInfo(int processId, string machineName) { - ProcessInfo[] processInfos = ProcessManager.GetProcessInfos(machineName); - foreach (ProcessInfo processInfo in processInfos) + if (IsRemoteMachine(machineName)) { - if (processInfo.ProcessId == processId) + // remote case: we take the hit of looping through all results + ProcessInfo[] processInfos = NtProcessManager.GetProcessInfos(machineName, isRemoteMachine: true); + foreach (ProcessInfo processInfo in processInfos) { - return processInfo; + if (processInfo.ProcessId == processId) + { + return processInfo; + } } } + else + { + // local case: do not use performance counter and also attempt to get the matching (by pid) process only + ProcessInfo[] processInfos = NtProcessInfoHelper.GetProcessInfos(pid => pid == processId); + if (processInfos.Length == 1) + { + return processInfos[0]; + } + } + return null; } @@ -636,7 +660,6 @@ namespace System.Diagnostics } } - internal static partial class NtProcessInfoHelper { private static int GetNewBufferSize(int existingBufferSize, int requiredSize) @@ -676,7 +699,7 @@ namespace System.Diagnostics private const int DefaultCachedBufferSize = 128 * 1024; #endif - private static unsafe ProcessInfo[] GetProcessInfos(IntPtr dataPtr) + private static unsafe ProcessInfo[] GetProcessInfos(IntPtr dataPtr, Predicate processIdFilter) { // Use a dictionary to avoid duplicate entries if any // 60 is a reasonable number for processes on a normal machine. @@ -689,67 +712,70 @@ namespace System.Diagnostics IntPtr currentPtr = (IntPtr)((long)dataPtr + totalOffset); ref SystemProcessInformation pi = ref *(SystemProcessInformation *)(currentPtr); - // get information for a process - ProcessInfo processInfo = new ProcessInfo(); // Process ID shouldn't overflow. OS API GetCurrentProcessID returns DWORD. - processInfo.ProcessId = pi.UniqueProcessId.ToInt32(); - processInfo.SessionId = (int)pi.SessionId; - processInfo.PoolPagedBytes = (long)pi.QuotaPagedPoolUsage; ; - processInfo.PoolNonPagedBytes = (long)pi.QuotaNonPagedPoolUsage; - processInfo.VirtualBytes = (long)pi.VirtualSize; - processInfo.VirtualBytesPeak = (long)pi.PeakVirtualSize; - processInfo.WorkingSetPeak = (long)pi.PeakWorkingSetSize; - processInfo.WorkingSet = (long)pi.WorkingSetSize; - processInfo.PageFileBytesPeak = (long)pi.PeakPagefileUsage; - processInfo.PageFileBytes = (long)pi.PagefileUsage; - processInfo.PrivateBytes = (long)pi.PrivatePageCount; - processInfo.BasePriority = pi.BasePriority; - processInfo.HandleCount = (int)pi.HandleCount; - - - if (pi.ImageName.Buffer == IntPtr.Zero) + var processInfoProcessId = pi.UniqueProcessId.ToInt32(); + if (processIdFilter == null || processIdFilter(processInfoProcessId)) { - if (processInfo.ProcessId == NtProcessManager.SystemProcessID) + // get information for a process + ProcessInfo processInfo = new ProcessInfo(); + processInfo.ProcessId = processInfoProcessId; + processInfo.SessionId = (int)pi.SessionId; + processInfo.PoolPagedBytes = (long)pi.QuotaPagedPoolUsage; + processInfo.PoolNonPagedBytes = (long)pi.QuotaNonPagedPoolUsage; + processInfo.VirtualBytes = (long)pi.VirtualSize; + processInfo.VirtualBytesPeak = (long)pi.PeakVirtualSize; + processInfo.WorkingSetPeak = (long)pi.PeakWorkingSetSize; + processInfo.WorkingSet = (long)pi.WorkingSetSize; + processInfo.PageFileBytesPeak = (long)pi.PeakPagefileUsage; + processInfo.PageFileBytes = (long)pi.PagefileUsage; + processInfo.PrivateBytes = (long)pi.PrivatePageCount; + processInfo.BasePriority = pi.BasePriority; + processInfo.HandleCount = (int)pi.HandleCount; + + if (pi.ImageName.Buffer == IntPtr.Zero) { - processInfo.ProcessName = "System"; - } - else if (processInfo.ProcessId == NtProcessManager.IdleProcessID) - { - processInfo.ProcessName = "Idle"; + if (processInfo.ProcessId == NtProcessManager.SystemProcessID) + { + processInfo.ProcessName = "System"; + } + else if (processInfo.ProcessId == NtProcessManager.IdleProcessID) + { + processInfo.ProcessName = "Idle"; + } + else + { + // for normal process without name, using the process ID. + processInfo.ProcessName = processInfo.ProcessId.ToString(CultureInfo.InvariantCulture); + } } else { - // for normal process without name, using the process ID. - processInfo.ProcessName = processInfo.ProcessId.ToString(CultureInfo.InvariantCulture); + string processName = GetProcessShortName(Marshal.PtrToStringUni(pi.ImageName.Buffer, pi.ImageName.Length / sizeof(char))); + processInfo.ProcessName = processName; } - } - else - { - string processName = GetProcessShortName(Marshal.PtrToStringUni(pi.ImageName.Buffer, pi.ImageName.Length / sizeof(char))); - processInfo.ProcessName = processName; - } - // get the threads for current process - processInfos[processInfo.ProcessId] = processInfo; + // get the threads for current process + processInfos[processInfo.ProcessId] = processInfo; - currentPtr = (IntPtr)((long)currentPtr + Marshal.SizeOf(pi)); - int i = 0; - while (i < pi.NumberOfThreads) - { - ref SystemThreadInformation ti = ref *(SystemThreadInformation *)(currentPtr); - ThreadInfo threadInfo = new ThreadInfo(); + currentPtr = (IntPtr)((long)currentPtr + Marshal.SizeOf(pi)); + int i = 0; + while (i < pi.NumberOfThreads) + { + ref SystemThreadInformation ti = ref *(SystemThreadInformation *)(currentPtr); + ThreadInfo threadInfo = new ThreadInfo(); - threadInfo._processId = (int)ti.ClientId.UniqueProcess; - threadInfo._threadId = (ulong)ti.ClientId.UniqueThread; - threadInfo._basePriority = ti.BasePriority; - threadInfo._currentPriority = ti.Priority; - threadInfo._startAddress = ti.StartAddress; - threadInfo._threadState = (ThreadState)ti.ThreadState; - threadInfo._threadWaitReason = NtProcessManager.GetThreadWaitReason((int)ti.WaitReason); + threadInfo._processId = (int)ti.ClientId.UniqueProcess; + threadInfo._threadId = (ulong)ti.ClientId.UniqueThread; + threadInfo._basePriority = ti.BasePriority; + threadInfo._currentPriority = ti.Priority; + threadInfo._startAddress = ti.StartAddress; + threadInfo._threadState = (ThreadState)ti.ThreadState; + threadInfo._threadWaitReason = NtProcessManager.GetThreadWaitReason((int)ti.WaitReason); - processInfo._threadInfoList.Add(threadInfo); - currentPtr = (IntPtr)((long)currentPtr + Marshal.SizeOf(ti)); - i++; + processInfo._threadInfoList.Add(threadInfo); + currentPtr = (IntPtr)((long)currentPtr + Marshal.SizeOf(ti)); + i++; + } } if (pi.NextEntryOffset == 0) diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessModuleCollection.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessModuleCollection.cs index e370668b7c..6b701ec5c9 100644 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessModuleCollection.cs +++ b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessModuleCollection.cs @@ -27,6 +27,10 @@ namespace System.Diagnostics internal void Add(ProcessModule module) => InnerList.Add(module); + internal void Insert(int index, ProcessModule module) => InnerList.Insert(index, module); + + internal void RemoveAt(int index) => InnerList.RemoveAt(index); + public ProcessModule this[int index] => (ProcessModule)InnerList[index]; public int IndexOf(ProcessModule module) => InnerList.IndexOf(module); diff --git a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitHandle.Windows.cs b/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitHandle.Windows.cs deleted file mode 100644 index 2122e3b6df..0000000000 --- a/external/corefx/src/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitHandle.Windows.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; -using System.Threading; - -namespace System.Diagnostics -{ - internal sealed class ProcessWaitHandle : WaitHandle - { - internal ProcessWaitHandle(SafeProcessHandle processHandle) - { - SafeWaitHandle waitHandle = null; - SafeProcessHandle currentProcHandle = Interop.Kernel32.GetCurrentProcess(); - bool succeeded = Interop.Kernel32.DuplicateHandle( - currentProcHandle, - processHandle, - currentProcHandle, - out waitHandle, - 0, - false, - Interop.Kernel32.HandleOptions.DUPLICATE_SAME_ACCESS); - - if (!succeeded) - { - Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); - } - - this.SetSafeWaitHandle(waitHandle); - } - } -} diff --git a/external/corefx/src/System.Diagnostics.Process/tests/Performance/Configurations.props b/external/corefx/src/System.Diagnostics.Process/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Diagnostics.Process/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/external/corefx/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index 50128a21c0..d028b3828f 100644 --- a/external/corefx/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/external/corefx/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -957,7 +957,7 @@ namespace System.Diagnostics.Tests Process.Start(info); // Returns null after navigating browser } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // No Notepad on Nano + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // No Notepad on Nano [MemberData(nameof(UseShellExecute))] [OuterLoop("Launches notepad")] [PlatformSpecific(TestPlatforms.Windows)] @@ -994,9 +994,8 @@ namespace System.Diagnostics.Tests } } } - - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer), // Nano does not support UseShellExecute - nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindows8x))] // https://github.com/dotnet/corefx/issues/20388 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), // Nano does not support UseShellExecute + nameof(PlatformDetection.IsNotWindows8x))] // https://github.com/dotnet/corefx/issues/20388 [OuterLoop("Launches notepad")] [PlatformSpecific(TestPlatforms.Windows)] // Re-enabling with extra diagnostic info @@ -1087,7 +1086,7 @@ namespace System.Diagnostics.Tests } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindowsNanoServer))] public void ShellExecute_Nano_Fails_Start() { string tempFile = GetTestFilePath() + ".txt"; diff --git a/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index e8470a92e8..0757c839d2 100644 --- a/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -62,12 +62,143 @@ namespace System.Diagnostics.Tests } [Fact] - public void TestUseShellExecute_Unix_Succeeds() + [PlatformSpecific(TestPlatforms.Linux)] + public void ProcessStart_UseShellExecute_OnLinux_ThrowsIfNoProgramInstalled() { - using (var p = Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = "exit", Arguments = "42" })) + if (!s_allowedProgramsToRun.Any(program => IsProgramInstalled(program))) { - Assert.True(p.WaitForExit(WaitInMS)); - Assert.Equal(42, p.ExitCode); + Console.WriteLine($"None of the following programs were installed on this machine: {string.Join(",", s_allowedProgramsToRun)}."); + Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = Environment.CurrentDirectory })); + } + } + + [Fact] + [OuterLoop("Opens program")] + public void ProcessStart_DirectoryNameInCurDirectorySameAsFileNameInExecDirectory_Success() + { + string fileToOpen = "dotnet"; + string curDir = Environment.CurrentDirectory; + string dotnetFolder = Path.Combine(Path.GetTempPath(),"dotnet"); + bool shouldDelete = !Directory.Exists(dotnetFolder); + try + { + Directory.SetCurrentDirectory(Path.GetTempPath()); + Directory.CreateDirectory(dotnetFolder); + + using (var px = Process.Start(fileToOpen)) + { + Assert.NotNull(px); + } + } + finally + { + if (shouldDelete) + { + Directory.Delete(dotnetFolder); + } + + Directory.SetCurrentDirectory(curDir); + } + } + + [Theory, InlineData(true), InlineData(false)] + [OuterLoop("Opens program")] + public void ProcessStart_UseShellExecute_OnUnix_SuccessWhenProgramInstalled(bool isFolder) + { + string programToOpen = s_allowedProgramsToRun.FirstOrDefault(program => IsProgramInstalled(program)); + string fileToOpen; + if (isFolder) + { + fileToOpen = Environment.CurrentDirectory; + } + else + { + fileToOpen = GetTestFilePath() + ".txt"; + File.WriteAllText(fileToOpen, $"{nameof(ProcessStart_UseShellExecute_OnUnix_SuccessWhenProgramInstalled)}"); + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || programToOpen != null) + { + using (var px = Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = fileToOpen })) + { + Assert.NotNull(px); + if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) // on OSX, process name is dotnet for some reason. Refer to #23972 + { + Assert.Equal(programToOpen, px.ProcessName); + } + px.Kill(); + px.WaitForExit(); + Assert.True(px.HasExited); + } + } + } + + [Theory, InlineData("nano"), InlineData("vi")] + [PlatformSpecific(TestPlatforms.Linux)] + [OuterLoop("Opens program")] + public void ProcessStart_OpenFileOnLinux_UsesSpecifiedProgram(string programToOpenWith) + { + if (IsProgramInstalled(programToOpenWith)) + { + string fileToOpen = GetTestFilePath() + ".txt"; + File.WriteAllText(fileToOpen, $"{nameof(ProcessStart_OpenFileOnLinux_UsesSpecifiedProgram)}"); + using (var px = Process.Start(programToOpenWith, fileToOpen)) + { + Assert.Equal(programToOpenWith, px.ProcessName); + px.Kill(); + px.WaitForExit(); + Assert.True(px.HasExited); + } + } + else + { + Console.WriteLine($"Program specified to open file with {programToOpenWith} is not installed on this machine."); + } + } + + [Theory, InlineData("/usr/bin/open"), InlineData("/usr/bin/nano")] + [PlatformSpecific(TestPlatforms.OSX)] + [OuterLoop("Opens program")] + public void ProcessStart_OpenFileOnOsx_UsesSpecifiedProgram(string programToOpenWith) + { + string fileToOpen = GetTestFilePath() + ".txt"; + File.WriteAllText(fileToOpen, $"{nameof(ProcessStart_OpenFileOnOsx_UsesSpecifiedProgram)}"); + using (var px = Process.Start(programToOpenWith, fileToOpen)) + { + // Assert.Equal(programToOpenWith, px.ProcessName); // on OSX, process name is dotnet for some reason. Refer to #23972 + Console.WriteLine($"in OSX, {nameof(programToOpenWith)} is {programToOpenWith}, while {nameof(px.ProcessName)} is {px.ProcessName}."); + px.Kill(); + px.WaitForExit(); + Assert.True(px.HasExited); + } + } + + [Theory, InlineData("Safari"), InlineData("\"Google Chrome\"")] + [PlatformSpecific(TestPlatforms.OSX)] + [OuterLoop("Opens browser")] + public void ProcessStart_OpenUrl_UsesSpecifiedApplication(string applicationToOpenWith) + { + using (var px = Process.Start("/usr/bin/open", "https://github.com/dotnet/corefx -a " + applicationToOpenWith)) + { + Assert.NotNull(px); + px.Kill(); + px.WaitForExit(); + Assert.True(px.HasExited); + } + } + + [Theory, InlineData("-a Safari"), InlineData("-a \"Google Chrome\"")] + [PlatformSpecific(TestPlatforms.OSX)] + [OuterLoop("Opens browser")] + public void ProcessStart_UseShellExecuteTrue_OpenUrl_SuccessfullyReadsArgument(string arguments) + { + var startInfo = new ProcessStartInfo { UseShellExecute = true, FileName = "https://github.com/dotnet/corefx", Arguments = arguments }; + using (var px = Process.Start(startInfo)) + { + Assert.NotNull(px); + px.Kill(); + px.WaitForExit(); + Assert.True(px.HasExited); } } @@ -148,5 +279,32 @@ namespace System.Diagnostics.Tests [DllImport("libc")] private static extern int chmod(string path, int mode); + + private readonly string[] s_allowedProgramsToRun = new string[] { "xdg-open", "gnome-open", "kfmclient" }; + + /// + /// Checks if the program is installed + /// + /// + /// + private bool IsProgramInstalled(string program) + { + string path; + string pathEnvVar = Environment.GetEnvironmentVariable("PATH"); + if (pathEnvVar != null) + { + var pathParser = new StringParser(pathEnvVar, ':', skipEmpty: true); + while (pathParser.MoveNext()) + { + string subPath = pathParser.ExtractCurrent(); + path = Path.Combine(subPath, program); + if (File.Exists(path)) + { + return true; + } + } + } + return false; + } } } diff --git a/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.cs b/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.cs index d079f2b9a6..da7d483cf5 100644 --- a/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/external/corefx/src/System.Diagnostics.Process/tests/ProcessTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -13,7 +12,6 @@ using System.Security; using System.Text; using System.Threading; using Xunit; -using Xunit.NetCore.Extensions; namespace System.Diagnostics.Tests { @@ -120,6 +118,71 @@ namespace System.Diagnostics.Tests } } + [Fact] + public void ProcessStart_TryExitCommandAsFileName_ThrowsWin32Exception() + { + Win32Exception e = Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = false, FileName = "exit", Arguments = "42" })); + } + + [Fact] + public void ProcessStart_UseShellExecuteFalse_FilenameIsUrl_ThrowsWin32Exception() + { + Win32Exception e = Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = false, FileName = "https://www.github.com/corefx" })); + } + + [Fact] + public void ProcessStart_TryOpenFolder_UseShellExecuteIsFalse_ThrowsWin32Exception() + { + Win32Exception e = Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = false, FileName = Path.GetTempPath() })); + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.HasWindowsShell))] + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "not supported on UAP")] + [OuterLoop("Launches File Explorer")] + public void ProcessStart_UseShellExecuteTrue_OpenMissingFile_Throws() + { + string fileToOpen = Path.Combine(Environment.CurrentDirectory, "_no_such_file.TXT"); + Win32Exception e = Assert.Throws(() => Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = fileToOpen })); + } + + [PlatformSpecific(TestPlatforms.Windows)] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.HasWindowsShell))] + [InlineData(true)] + [InlineData(false)] + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "not supported on UAP")] + [OuterLoop("Launches File Explorer")] + public void ProcessStart_UseShellExecute_OnWindows_DoesNotThrow(bool isFolder) + { + string fileToOpen; + if (isFolder) + { + fileToOpen = Environment.CurrentDirectory; + } + else + { + fileToOpen = GetTestFilePath() + ".txt"; + File.WriteAllText(fileToOpen, $"{nameof(ProcessStart_UseShellExecute_OnWindows_DoesNotThrow)}"); + } + + using (var px = Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = fileToOpen })) + { + if (isFolder) + { + Assert.Null(px); + } + else + { + if (px != null) // sometimes process is null + { + Assert.Equal("notepad", px.ProcessName); + + px.Kill(); + Assert.True(px.WaitForExit(WaitInMS)); + } + } + } + } + [Fact] public void TestExitCode() { @@ -900,7 +963,6 @@ namespace System.Diagnostics.Tests [Fact] [PlatformSpecific(TestPlatforms.Windows)] // Behavior differs on Windows and Unix - [ActiveIssue("https://github.com/dotnet/corefx/issues/18212", TargetFrameworkMonikers.UapAot)] [SkipOnTargetFramework(TargetFrameworkMonikers.UapNotUapAot, "Retrieving information about local processes is not supported on uap")] public void TestProcessOnRemoteMachineWindows() { diff --git a/external/corefx/src/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj b/external/corefx/src/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj index 98b3b57e05..3ccd854fc0 100644 --- a/external/corefx/src/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj @@ -11,15 +11,16 @@ + + + + Common\System\PasteArguments.cs - - Common\tests\System\PlatformDetection.cs - - - Common\System\PlatformDetection.Unix.cs + + Common\System\IO\StringParser.cs Common\System\ShouldNotBeInvokedException.cs @@ -51,4 +52,4 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.StackTrace/dir.props b/external/corefx/src/System.Diagnostics.StackTrace/dir.props index e09fa64586..e063359772 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/dir.props +++ b/external/corefx/src/System.Diagnostics.StackTrace/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.StackTrace/ref/Configurations.props b/external/corefx/src/System.Diagnostics.StackTrace/ref/Configurations.props index 192309fce5..c701755863 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/ref/Configurations.props +++ b/external/corefx/src/System.Diagnostics.StackTrace/ref/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap; diff --git a/external/corefx/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj b/external/corefx/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj index 9b8a9fcfcf..f4232af744 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj +++ b/external/corefx/src/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.csproj @@ -7,8 +7,6 @@ - - diff --git a/external/corefx/src/System.Diagnostics.StackTrace/src/Configurations.props b/external/corefx/src/System.Diagnostics.StackTrace/src/Configurations.props index 216b17ac28..527cedea19 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/src/Configurations.props +++ b/external/corefx/src/System.Diagnostics.StackTrace/src/Configurations.props @@ -6,7 +6,6 @@ netcoreapp-Windows_NT; netcoreapp-Unix; uap-Windows_NT; - netfx; \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj b/external/corefx/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj index 06e7d60cc2..39130ab370 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj +++ b/external/corefx/src/System.Diagnostics.StackTrace/src/System.Diagnostics.StackTrace.csproj @@ -16,8 +16,6 @@ - - diff --git a/external/corefx/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs b/external/corefx/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs index 6f6686300c..3542fdbeaf 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs +++ b/external/corefx/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackTraceSymbols.CoreCLR.cs @@ -198,7 +198,7 @@ namespace System.Diagnostics if (peReader.TryOpenAssociatedPortablePdb(assemblyPath, TryOpenFile, out provider, out pdbPath)) { // TODO: - // Consider caching the provider in a global cache (accross stack traces) if the PDB is embedded (pdbPath == null), + // Consider caching the provider in a global cache (across stack traces) if the PDB is embedded (pdbPath == null), // as decompressing embedded PDB takes some time. return provider; } diff --git a/external/corefx/src/System.Diagnostics.StackTrace/tests/StackFrameTests.cs b/external/corefx/src/System.Diagnostics.StackTrace/tests/StackFrameTests.cs index dfc590848a..4587f058e0 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/tests/StackFrameTests.cs +++ b/external/corefx/src/System.Diagnostics.StackTrace/tests/StackFrameTests.cs @@ -24,6 +24,7 @@ namespace System.Diagnostics.Tests VerifyStackFrame(stackFrame, false, 0, typeof(StackFrameTests).GetMethod(nameof(Ctor_Default)), isCurrentFrame: true); } + [ActiveIssue(23796, TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(true)] [InlineData(false)] @@ -43,6 +44,7 @@ namespace System.Diagnostics.Tests VerifyStackFrame(stackFrame, true, skipFrames, typeof(StackFrameTests).GetMethod(nameof(Ctor_SkipFrames)), isCurrentFrame: skipFrames == 0); } + [ActiveIssue(23796, TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(StackFrame.OFFSET_UNKNOWN, true)] [InlineData(0, true)] diff --git a/external/corefx/src/System.Diagnostics.StackTrace/tests/StackTraceTests.cs b/external/corefx/src/System.Diagnostics.StackTrace/tests/StackTraceTests.cs index 75d1e86d1e..fcd19de108 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/tests/StackTraceTests.cs +++ b/external/corefx/src/System.Diagnostics.StackTrace/tests/StackTraceTests.cs @@ -142,6 +142,7 @@ namespace System.Diagnostics.Tests Assert.Null(stackTrace.GetFrame(0)); } + [ActiveIssue(23796, TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(0)] [InlineData(1)] @@ -191,6 +192,7 @@ namespace System.Diagnostics.Tests Assert.Null(stackTrace.GetFrame(0)); } + [ActiveIssue(23796, TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(0, true)] [InlineData(1, true)] diff --git a/external/corefx/src/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj b/external/corefx/src/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj index 2bc1b752ce..0c2de01add 100644 --- a/external/corefx/src/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj @@ -17,9 +17,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj b/external/corefx/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj index 95f0ae1f70..bcdb892b39 100644 --- a/external/corefx/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj @@ -31,9 +31,6 @@ - - Common\tests\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Diagnostics.Tracing/dir.props b/external/corefx/src/System.Diagnostics.Tracing/dir.props index b5dea7fb76..b89fb6fc11 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/dir.props +++ b/external/corefx/src/System.Diagnostics.Tracing/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md b/external/corefx/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md index 65ea9d2c77..98345b3ddc 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md +++ b/external/corefx/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md @@ -34,7 +34,8 @@ public sealed class MinimalEventCounterSource : EventSource // using an EventAttribute for this method // 2. Each counter supports a single float value, so conceptually it maps to a single // measurement in the code. - // 3. You don't have to have + // 3. You don't have to have log with WriteEvent if you don't think you will ever care about details + // of individual requests (that counter data is sufficient). WriteEvent(1, url, elapsedMSec); // This logs it to the event stream if events are on. this.requestCounter.WriteMetric(elapsedMSec); // This adds it to the PerfCounter called 'Request' if PerfCounters are on } @@ -48,10 +49,10 @@ So, with that, we logged the metric to the `EventCounter`, but unless we can act There is an extra keyword that you will need to specify the turn on the EventCounters. ``` -PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:**EventCounterIntervalSec=1** collect +PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:EventCounterIntervalSec=1 collect ``` -Note the bold part about `EventCounterIntervalSec`, that indicate the frequency of the sampling. +Note the part about `EventCounterIntervalSec`, that indicate the frequency of the sampling. As usual, turn on PerfView, and then run the sample code, we will have something like this @@ -69,7 +70,7 @@ Notice that, this command also log the events, so we will get both the events an PerfView Capture of Event Traces -As we mentioned, to avoid overhead, sometimes we will want just the counters. This command can be used to log only the counters: +As we mentioned, to avoid overhead, sometimes we will want just the counters. This command can be used to log *only* the counters: ``` PerfView /onlyProviders=*Samples-EventCounterDemos-Minimal:*:Critical:EventCounterIntervalSec=1 collect diff --git a/external/corefx/src/System.Diagnostics.Tracing/ref/Configurations.props b/external/corefx/src/System.Diagnostics.Tracing/ref/Configurations.props index 7de0087598..c701755863 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/ref/Configurations.props +++ b/external/corefx/src/System.Diagnostics.Tracing/ref/Configurations.props @@ -4,7 +4,6 @@ netcoreapp; uap; - netfx; \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs b/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs index 211769b3e0..5361718d29 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs +++ b/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs @@ -54,9 +54,10 @@ namespace System.Diagnostics.Tracing public bool DisableEvent(int eventId) { throw null; } public bool EnableEvent(int eventId) { throw null; } } - public class EventCounter { + public class EventCounter : IDisposable { public EventCounter(string name, EventSource eventSource) { } public void WriteMetric(float value) { } + public void Dispose() { } } [System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited = false)] public partial class EventDataAttribute : System.Attribute diff --git a/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj b/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj index 27538cd0c3..63b38defb4 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj +++ b/external/corefx/src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.csproj @@ -5,12 +5,12 @@ true {0D8C8BAE-E5A5-4E9F-B101-3D18BD81D261} true - $(DefineConstants);FEATURE_ETLEVENTS + $(DefineConstants);FEATURE_ETLEVENTS + + $(NoWarn);0067 - - diff --git a/external/corefx/src/System.Diagnostics.Tracing/src/Configurations.props b/external/corefx/src/System.Diagnostics.Tracing/src/Configurations.props index 11587136e3..aed58fb42e 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/src/Configurations.props +++ b/external/corefx/src/System.Diagnostics.Tracing/src/Configurations.props @@ -6,7 +6,6 @@ uapaot-Windows_NT; netcoreapp-Windows_NT; netcoreapp-Unix; - netfx-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj b/external/corefx/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj index 4f8307d8d9..99023cde4b 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj +++ b/external/corefx/src/System.Diagnostics.Tracing/src/System.Diagnostics.Tracing.csproj @@ -8,15 +8,13 @@ true - $(DefineConstants);SUPPORTS_EVENTCOMMANDEXECUTED + $(DefineConstants);NO_EVENTCOMMANDEXECUTED_SUPPORT - - @@ -30,6 +28,7 @@ + \ No newline at end of file diff --git a/external/corefx/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs b/external/corefx/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs index e95be0d167..482909066f 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs +++ b/external/corefx/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs @@ -25,10 +25,12 @@ namespace System.Diagnostics.Tracing /// See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs /// which shows tests, which are also useful in seeing actual use. /// - public class EventCounter + public class EventCounter : IDisposable { /// /// Initializes a new instance of the class. + /// EVentCounters live as long as the EventSource that they are attached to unless they are + /// explicitly Disposed. /// /// The name. /// The event source. @@ -46,11 +48,15 @@ namespace System.Diagnostics.Tracing InitializeBuffer(); _name = name; - EventCounterGroup.AddEventCounter(eventSource, this); + _group = EventCounterGroup.GetEventCounterGroup(eventSource); + _group.Add(this); + _min = float.PositiveInfinity; + _max = float.NegativeInfinity; } /// - /// Writes the metric. + /// Writes 'value' to the stream of values tracked by the counter. This updates the sum and other statistics that will + /// be logged on the next timer interval. /// /// The value. public void WriteMetric(float value) @@ -58,9 +64,30 @@ namespace System.Diagnostics.Tracing Enqueue(value); } + /// + /// Removes the counter from set that the EventSource will report on. After being disposed, this + /// counter will do nothing and its resource will be reclaimed if all references to it are removed. + /// If an EventCounter is not explicitly disposed it will be cleaned up automatically when the + /// EventSource it is attached to dies. + /// + public void Dispose() + { + var group = _group; + if (group != null) + { + group.Remove(this); + _group = null; + } + } + + public override string ToString() + { + return "EventCounter '" + _name + "' Count " + _count + " Mean " + (((double)_sum) / _count).ToString("n3"); + } #region private implementation private readonly string _name; + private EventCounterGroup _group; #region Buffer Management @@ -68,9 +95,12 @@ namespace System.Diagnostics.Tracing private const int BufferedSize = 10; private const float UnusedBufferSlotValue = float.NegativeInfinity; private const int UnsetIndex = -1; - private volatile float[] _bufferedValues; + private volatile float[] _bufferedValues; private volatile int _bufferedValuesIndex; + // arbitrarily we use _bufferfValues as the lock object. + private object MyLock { get { return _bufferedValues; } } + private void InitializeBuffer() { _bufferedValues = new float[BufferedSize]; @@ -92,10 +122,8 @@ namespace System.Diagnostics.Tracing { // It is possible that two threads both think the buffer is full, but only one get to actually flush it, the other // will eventually enter this code path and potentially calling Flushing on a buffer that is not full, and that's okay too. - lock (_bufferedValues) - { + lock (MyLock) // Lock the counter Flush(); - } i = 0; } @@ -110,6 +138,7 @@ namespace System.Diagnostics.Tracing private void Flush() { + Debug.Assert(Monitor.IsEntered(MyLock)); for (int i = 0; i < _bufferedValues.Length; i++) { var value = Interlocked.Exchange(ref _bufferedValues[i], UnusedBufferSlotValue); @@ -135,31 +164,36 @@ namespace System.Diagnostics.Tracing private void OnMetricWritten(float value) { + Debug.Assert(Monitor.IsEntered(MyLock)); _sum += value; _sumSquared += value * value; - if (_count == 0 || value > _max) - { + if (value > _max) _max = value; - } - if (_count == 0 || value < _min) - { + if (value < _min) _min = value; - } _count++; } internal EventCounterPayload GetEventCounterPayload() { - lock (_bufferedValues) + lock (MyLock) // Lock the counter { Flush(); EventCounterPayload result = new EventCounterPayload(); result.Name = _name; result.Count = _count; - result.Mean = _sum / _count; - result.StandardDeviation = (float)Math.Sqrt(_sumSquared / _count - _sum * _sum / _count / _count); + if (0 < _count) + { + result.Mean = _sum / _count; + result.StandardDeviation = (float)Math.Sqrt(_sumSquared / _count - _sum * _sum / _count / _count); + } + else + { + result.Mean = 0; + result.StandardDeviation = 0; + } result.Min = _min; result.Max = _max; ResetStatistics(); @@ -169,11 +203,12 @@ namespace System.Diagnostics.Tracing private void ResetStatistics() { + Debug.Assert(Monitor.IsEntered(MyLock)); _count = 0; _sum = 0; _sumSquared = 0; - _min = 0; - _max = 0; + _min = float.PositiveInfinity; + _max = float.NegativeInfinity; } #endregion // Statistics Calculation @@ -228,30 +263,50 @@ namespace System.Diagnostics.Tracing #endregion // Implementation of the IEnumerable interface } - internal class EventCounterGroup : IDisposable + internal class EventCounterGroup { private readonly EventSource _eventSource; - private readonly int _eventSourceIndex; private readonly List _eventCounters; - internal EventCounterGroup(EventSource eventSource, int eventSourceIndex) + internal EventCounterGroup(EventSource eventSource) { _eventSource = eventSource; - _eventSourceIndex = eventSourceIndex; _eventCounters = new List(); RegisterCommandCallback(); } - private void Add(EventCounter eventCounter) + internal void Add(EventCounter eventCounter) { - _eventCounters.Add(eventCounter); + lock (this) // Lock the EventCounterGroup + _eventCounters.Add(eventCounter); + } + + internal void Remove(EventCounter eventCounter) + { + lock (this) // Lock the EventCounterGroup + _eventCounters.Remove(eventCounter); } #region EventSource Command Processing private void RegisterCommandCallback() { -#if SUPPORTS_EVENTCOMMANDEXECUTED + // Old destktop runtimes don't have this +#if NO_EVENTCOMMANDEXECUTED_SUPPORT + // We could not build against the API that had the EventCommandExecuted but maybe it is there are runtime. + // use reflection to try to get it. + System.Reflection.MethodInfo method = typeof(EventSource).GetMethod("add_EventCommandExecuted"); + if (method != null) + { + method.Invoke(_eventSource, new object[] { (EventHandler)OnEventSourceCommand }); + } + else + { + string msg = "EventCounterError: Old Runtime that does not support EventSource.EventCommandExecuted. EventCounters not Supported"; + _eventSource.Write(msg); + Debug.WriteLine(msg); + } +#else _eventSource.EventCommandExecuted += OnEventSourceCommand; #endif } @@ -264,7 +319,15 @@ namespace System.Diagnostics.Tracing float value; if (e.Arguments.TryGetValue("EventCounterIntervalSec", out valueStr) && float.TryParse(valueStr, out value)) { - EnableTimer(value); + // Recursion through EventSource callbacks possible. When we enable the timer + // we synchonously issue a EventSource.Write event, which in turn can call back + // to user code (in an EventListener) while holding this lock. This is dangerous + // because it mean this code might inadvertantly participate in a lock loop. + // The scenario seems very unlikely so we ignore that problem for now. + lock (this) // Lock the EventCounterGroup + { + EnableTimer(value); + } } } } @@ -273,42 +336,42 @@ namespace System.Diagnostics.Tracing #region Global EventCounterGroup Array management - private static EventCounterGroup[] s_eventCounterGroups; - - internal static void AddEventCounter(EventSource eventSource, EventCounter eventCounter) - { - int eventSourceIndex = EventListenerHelper.EventSourceIndex(eventSource); - - EventCounterGroup.EnsureEventSourceIndexAvailable(eventSourceIndex); - EventCounterGroup eventCounterGroup = GetEventCounterGroup(eventSource); - eventCounterGroup.Add(eventCounter); - } + // We need eventCounters to 'attach' themselves to a particular EventSource. + // this table provides the mapping from EventSource -> EventCounterGroup + // which represents this 'attached' information. + private static WeakReference[] s_eventCounterGroups; + private static readonly object s_eventCounterGroupsLock = new object(); private static void EnsureEventSourceIndexAvailable(int eventSourceIndex) { + Debug.Assert(Monitor.IsEntered(s_eventCounterGroupsLock)); if (EventCounterGroup.s_eventCounterGroups == null) { - EventCounterGroup.s_eventCounterGroups = new EventCounterGroup[eventSourceIndex + 1]; + EventCounterGroup.s_eventCounterGroups = new WeakReference[eventSourceIndex + 1]; } else if (eventSourceIndex >= EventCounterGroup.s_eventCounterGroups.Length) { - EventCounterGroup[] newEventCounterGroups = new EventCounterGroup[eventSourceIndex + 1]; + WeakReference[] newEventCounterGroups = new WeakReference[eventSourceIndex + 1]; Array.Copy(EventCounterGroup.s_eventCounterGroups, 0, newEventCounterGroups, 0, EventCounterGroup.s_eventCounterGroups.Length); EventCounterGroup.s_eventCounterGroups = newEventCounterGroups; } } - private static EventCounterGroup GetEventCounterGroup(EventSource eventSource) + internal static EventCounterGroup GetEventCounterGroup(EventSource eventSource) { - int eventSourceIndex = EventListenerHelper.EventSourceIndex(eventSource); - EventCounterGroup result = EventCounterGroup.s_eventCounterGroups[eventSourceIndex]; - if (result == null) + lock (s_eventCounterGroupsLock) { - result = new EventCounterGroup(eventSource, eventSourceIndex); - EventCounterGroup.s_eventCounterGroups[eventSourceIndex] = result; + int eventSourceIndex = EventListenerHelper.EventSourceIndex(eventSource); + EnsureEventSourceIndexAvailable(eventSourceIndex); + WeakReference weakRef = EventCounterGroup.s_eventCounterGroups[eventSourceIndex]; + EventCounterGroup ret = null; + if (weakRef == null || !weakRef.TryGetTarget(out ret)) + { + ret = new EventCounterGroup(eventSource); + EventCounterGroup.s_eventCounterGroups[eventSourceIndex] = new WeakReference(ret); + } + return ret; } - - return result; } #endregion // Global EventCounterGroup Array management @@ -319,57 +382,69 @@ namespace System.Diagnostics.Tracing private int _pollingIntervalInMilliseconds; private Timer _pollingTimer; + private void DisposeTimer() + { + Debug.Assert(Monitor.IsEntered(this)); + if (_pollingTimer != null) + { + _pollingTimer.Dispose(); + _pollingTimer = null; + } + } + private void EnableTimer(float pollingIntervalInSeconds) { - if (pollingIntervalInSeconds == 0) + Debug.Assert(Monitor.IsEntered(this)); + if (pollingIntervalInSeconds <= 0) { - if (_pollingTimer != null) - { - _pollingTimer.Dispose(); - _pollingTimer = null; - } - + DisposeTimer(); _pollingIntervalInMilliseconds = 0; } - else if (_pollingIntervalInMilliseconds == 0 || pollingIntervalInSeconds < _pollingIntervalInMilliseconds) + else if (_pollingIntervalInMilliseconds == 0 || pollingIntervalInSeconds * 1000 < _pollingIntervalInMilliseconds) { + Debug.WriteLine("Polling interval changed at " + DateTime.UtcNow.ToString("mm.ss.ffffff")); _pollingIntervalInMilliseconds = (int)(pollingIntervalInSeconds * 1000); - if (_pollingTimer != null) - { - _pollingTimer.Dispose(); - _pollingTimer = null; - } - - _timeStampSinceCollectionStarted = DateTime.Now; + DisposeTimer(); + _timeStampSinceCollectionStarted = DateTime.UtcNow; _pollingTimer = new Timer(OnTimer, null, _pollingIntervalInMilliseconds, _pollingIntervalInMilliseconds); } + // Always fire the timer event (so you see everything up to this time). + OnTimer(null); } private void OnTimer(object state) { - if (_eventSource.IsEnabled()) + Debug.WriteLine("Timer fired at " + DateTime.UtcNow.ToString("mm.ss.ffffff")); + lock (this) // Lock the EventCounterGroup { - DateTime now = DateTime.Now; - TimeSpan elapsed = now - _timeStampSinceCollectionStarted; - lock (_pollingTimer) + if (_eventSource.IsEnabled()) { + DateTime now = DateTime.UtcNow; + TimeSpan elapsed = now - _timeStampSinceCollectionStarted; + foreach (var eventCounter in _eventCounters) { EventCounterPayload payload = eventCounter.GetEventCounterPayload(); payload.IntervalSec = (float)elapsed.TotalSeconds; - _eventSource.Write("EventCounters", new EventSourceOptions() { Level = EventLevel.LogAlways }, new { Payload = payload }); + _eventSource.Write("EventCounters", new EventSourceOptions() { Level = EventLevel.LogAlways }, new PayloadType(payload)); } - - _timeStampSinceCollectionStarted = now; } + else + { + DisposeTimer(); + } } - else - { - _pollingTimer.Dispose(); - _pollingTimer = null; - EventCounterGroup.s_eventCounterGroups[_eventSourceIndex] = null; - } + } + + /// + /// This is the payload that is sent in the with EventSource.Write + /// + [EventData] + class PayloadType + { + public PayloadType(EventCounterPayload payload) { Payload = payload; } + public EventCounterPayload Payload { get; set; } } #region PCL timer hack @@ -409,43 +484,15 @@ namespace System.Diagnostics.Tracing #endregion // Timer Processing - #region Implementation of the IDisposable interface - - private bool _disposed = false; - - public void Dispose() - { - Dispose(true); - } - - protected virtual void Dispose(bool disposing) - { - if (_disposed) - { - return; - } - - if (disposing) - { - if (_pollingTimer != null) - { - _pollingTimer.Dispose(); - _pollingTimer = null; - } - } - - _disposed = true; - } - - #endregion // Implementation of the IDisposable interface } // This class a work-around because .NET V4.6.2 did not make EventSourceIndex public (it was only protected) // We make this helper class to get around that protection. We want V4.6.3 to make this public at which // point this class is no longer needed and can be removed. - internal class EventListenerHelper : EventListener { + internal class EventListenerHelper : EventListener + { public new static int EventSourceIndex(EventSource eventSource) { return EventListener.EventSourceIndex(eventSource); } - protected override void OnEventWritten(EventWrittenEventArgs eventData) { } // override abstact methods to keep compiler happy + protected override void OnEventWritten(EventWrittenEventArgs eventData) { } // override abstract methods to keep compiler happy } #endregion // internal supporting classes diff --git a/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs b/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs index 07bc0c40c1..5dff1851fb 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs +++ b/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs @@ -6,6 +6,7 @@ using System.Diagnostics.Tracing; using Xunit; using System; using System.Collections.Generic; +using System.IO; namespace BasicEventSourceTests { @@ -18,6 +19,24 @@ namespace BasicEventSourceTests /// public static class EventTestHarness { + /// + /// LogWriteLine will dump its output into a string that will be appended to any exception + /// that happened during a test the harness is running. + /// + /// + /// + public static void LogWriteLine(string format, params object[] arg) + { + if (_log == null) + return; + + _log.Write("{0:mm:ss.fff} : ", DateTime.UtcNow); + _log.WriteLine(format, arg); + } + + // Use to log things in the test itself if needed + private static StringWriter _log = null; + /// /// Runs a series of tests 'tests' using the listener (either an ETWListener or an EventListenerListener) on /// an EventSource 'source' passing it the filter parameters=options (by default source turn on completely @@ -66,6 +85,8 @@ namespace BasicEventSourceTests currentTest = tests[testNumber]; Assert.Equal(currentTest.Name, data.PayloadValue(0, "name")); expectedTestNumber++; + _log = new StringWriter(); + LogWriteLine("STARTING Sub-Test {0}", currentTest.Name); } else { @@ -77,6 +98,7 @@ namespace BasicEventSourceTests } else { + LogWriteLine("Received Event {0}", data); // If expectedTestNumber is 0 then this is before the first test // If expectedTestNumber is count then it is after the last test Assert.NotNull(currentTest); @@ -85,29 +107,60 @@ namespace BasicEventSourceTests }; // Run the tests. collecting and validating the results. - using (TestHarnessEventSource testHarnessEventSource = new TestHarnessEventSource()) + try { - // Turn on the test EventSource. - listener.EventSourceSynchronousEnable(source, options); - // And the harnesses's EventSource. - listener.EventSourceSynchronousEnable(testHarnessEventSource); - // Generate events for all the tests, surrounded by events that tell us we are starting a test. - int testNumber = 0; - foreach (var test in tests) + using (TestHarnessEventSource testHarnessEventSource = new TestHarnessEventSource()) { - testHarnessEventSource.StartTest(test.Name, testNumber); - test.EventGenerator(); - testNumber++; + // Turn on the test EventSource. + listener.EventSourceSynchronousEnable(source, options); + // And the harnesses's EventSource. + listener.EventSourceSynchronousEnable(testHarnessEventSource); + + // Generate events for all the tests, surrounded by events that tell us we are starting a test. + int testNumber = 0; + foreach (var test in tests) + { + testHarnessEventSource.StartTest(test.Name, testNumber); + test.EventGenerator(); + testNumber++; + } + testHarnessEventSource.StartTest("", testNumber); // Empty test marks the end of testing. + + // Disable the listeners. + listener.EventSourceCommand(source.Name, EventCommand.Disable); + listener.EventSourceCommand(testHarnessEventSource.Name, EventCommand.Disable); + + // Send something that should be ignored. + testHarnessEventSource.IgnoreEvent(); } - testHarnessEventSource.StartTest("", testNumber); // Empty test marks the end of testing. + } + catch (Exception e) + { + if (e is EventSourceException) + e = e.InnerException; + LogWriteLine("Exception thrown: {0}", e.Message); - // Disable the listeners. - listener.EventSourceCommand(source.Name, EventCommand.Disable); - listener.EventSourceCommand(testHarnessEventSource.Name, EventCommand.Disable); + var exceptionText = new StringWriter(); + exceptionText.WriteLine("Error Detected in EventTestHarness.RunTest"); + if (currentTest != null) + exceptionText.WriteLine("FAILURE IN SUBTEST: \"{0}\"", currentTest.Name); - // Send something that should be ignored. - testHarnessEventSource.IgnoreEvent(); + exceptionText.WriteLine("************* EXCEPTION INFO ***************"); + exceptionText.WriteLine(e.ToString()); + exceptionText.WriteLine("*********** END EXCEPTION INFO *************"); + + if (_log != null) + { + exceptionText.WriteLine("************* LOGGING MESSAGES ***************"); + exceptionText.WriteLine(_log.ToString()); + exceptionText.WriteLine("*********** END LOGGING MESSAGES *************"); + } + + exceptionText.WriteLine("Version of Runtime {0}", Environment.Version); + exceptionText.WriteLine("Version of OS {0}", Environment.OSVersion); + exceptionText.WriteLine("**********************************************"); + throw new EventTestHarnessException(exceptionText.ToString(), e); } listener.Dispose(); // Indicate we are done listening. For the ETW file based cases, we do all the processing here @@ -116,6 +169,11 @@ namespace BasicEventSourceTests Assert.Equal(expectedTestNumber, tests.Count); } + public class EventTestHarnessException : Exception + { + public EventTestHarnessException(string message, Exception exception) : base(message, exception) { } + } + /// /// This eventSource I use to emit events to separate tests from each other. /// diff --git a/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs b/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs index 4e39ffb211..ff083de8f6 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs +++ b/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs @@ -42,7 +42,7 @@ namespace BasicEventSourceTests } } - internal void EnableTimer(EventSource eventSource, int pollingTime) + internal void EnableTimer(EventSource eventSource, double pollingTime) { FilteringOptions options = new FilteringOptions(); options.Args = new Dictionary(); @@ -84,9 +84,29 @@ namespace BasicEventSourceTests public abstract int PayloadCount { get; } public virtual string PayloadString(int propertyIndex, string propertyName) { - return PayloadValue(propertyIndex, propertyName).ToString(); + var obj = PayloadValue(propertyIndex, propertyName); + var asDict = obj as IDictionary; + if (asDict != null) + { + StringBuilder sb = new StringBuilder(); + sb.Append("{"); + bool first = true; + foreach (var key in asDict.Keys) + { + if (!first) + sb.Append(","); + first = false; + var value = asDict[key]; + sb.Append(key).Append(":").Append(value != null ? value.ToString() : "NULL"); + } + sb.Append("}"); + return sb.ToString(); + } + if (obj != null) + return obj.ToString(); + return ""; } - public abstract IEnumerable PayloadNames { get; } + public abstract IList PayloadNames { get; } #if DEBUG /// @@ -240,7 +260,7 @@ namespace BasicEventSourceTests return _data.PayloadString(propertyIndex); } public override int PayloadCount { get { return _data.PayloadNames.Length; } } - public override IEnumerable PayloadNames { get { return _data.PayloadNames; } } + public override IList PayloadNames { get { return _data.PayloadNames; } } #region private internal EtwEvent(TraceEvent data) { _data = data.Clone(); } @@ -262,33 +282,33 @@ namespace BasicEventSourceTests private Action _onEventSourceCreated; #if FEATURE_ETLEVENTS - public event EventHandler EventSourceCreated + public event EventHandler EventSourceCreated { add { if (this._listener != null) - this._listener.EventSourceCreated += value; - } + this._listener.EventSourceCreated += value; + } remove { if (this._listener != null) - this._listener.EventSourceCreated -= value; - } - } - + this._listener.EventSourceCreated -= value; + } + } + public event EventHandler EventWritten { add { if (this._listener != null) - this._listener.EventWritten += value; + this._listener.EventWritten += value; } remove { if (this._listener != null) this._listener.EventWritten -= value; - } - } + } + } #endif public EventListenerListener(bool useEventsToListen = false) @@ -297,7 +317,7 @@ namespace BasicEventSourceTests if (useEventsToListen) { _listener = new HelperEventListener(null); - _listener.EventSourceCreated += (sender, eventSourceCreatedEventArgs) + _listener.EventSourceCreated += (sender, eventSourceCreatedEventArgs) => _onEventSourceCreated?.Invoke(eventSourceCreatedEventArgs.EventSource); _listener.EventWritten += mListenerEventWritten; } @@ -310,6 +330,7 @@ namespace BasicEventSourceTests public override void Dispose() { + EventTestHarness.LogWriteLine("Disposing Listener"); _listener.Dispose(); } @@ -325,6 +346,8 @@ namespace BasicEventSourceTests public override void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null) { + EventTestHarness.LogWriteLine("Sending command {0} to EventSource {1} Options {2}", eventSourceName, command, options); + if (options == null) options = new FilteringOptions(); @@ -372,7 +395,7 @@ namespace BasicEventSourceTests { #if FEATURE_ETLEVENTS // OnEventWritten is abstract in netfx <= 461 - base.OnEventWritten(eventData); + base.OnEventWritten(eventData); #endif _forwardTo?.OnEvent?.Invoke(new EventListenerEvent(eventData)); } @@ -391,7 +414,7 @@ namespace BasicEventSourceTests public override string EventName { get { return _data.EventName; } } - public override IEnumerable PayloadNames { get { return _data.PayloadNames; } } + public override IList PayloadNames { get { return _data.PayloadNames; } } public override int PayloadCount { diff --git a/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs b/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs index fc9fb12492..1f655227ea 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs +++ b/external/corefx/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; -#if USE_ETW // TODO: Enable when TraceEvent is available on CoreCLR. GitHub issue #4864. +#if USE_ETW // TODO: Enable when TraceEvent is available on CoreCLR. GitHub issue https://github.com/dotnet/corefx/issues/4864 using Microsoft.Diagnostics.Tracing.Session; #endif using Xunit; @@ -18,7 +18,6 @@ using System.Threading.Tasks; namespace BasicEventSourceTests { -#if USE_ETW // TODO: Enable when TraceEvent is available on CoreCLR. GitHub issue #4864. public class TestEventCounter { private sealed class MyEventSource : EventSource @@ -44,6 +43,8 @@ namespace BasicEventSourceTests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, reason: "https://github.com/dotnet/corefx/issues/23661")] + [ActiveIssue("https://github.com/dotnet/corefx/issues/22791", TargetFrameworkMonikers.UapAot)] public void Test_Write_Metric_EventListener() { using (var listener = new EventListenerListener()) @@ -52,130 +53,266 @@ namespace BasicEventSourceTests } } +#if USE_ETW [Fact] public void Test_Write_Metric_ETW() { + using (var listener = new EtwListener()) { Test_Write_Metric(listener); } } +#endif private void Test_Write_Metric(Listener listener) { TestUtilities.CheckNoEventSourcesRunning("Start"); - using (var logger = new MyEventSource()) { var tests = new List(); /*************************************************************************/ - tests.Add(new SubTest("Log 1 event", + tests.Add(new SubTest("EventCounter: Log 1 event, explicit poll at end", delegate () { - listener.EnableTimer(logger, 1); /* Poll every 1 s */ - logger.Request(37); - Thread.Sleep(1500); // Sleep for 1.5 seconds + listener.EnableTimer(logger, 1); // Set to poll every second, but we dont actually care because the test ends before that. + logger.Request(5); listener.EnableTimer(logger, 0); }, delegate (List evts) { - Assert.Equal(2, evts.Count); - ValidateSingleEventCounter(evts[0], "Request", 1, 37, 0, 37, 37); + // There will be two events (request and error) for time 0 and 2 more at 1 second and 2 more when we shut it off. + Assert.Equal(4, evts.Count); + ValidateSingleEventCounter(evts[0], "Request", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[1], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[2], "Request", 1, 5, 0, 5, 5); + ValidateSingleEventCounter(evts[3], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); })); /*************************************************************************/ - tests.Add(new SubTest("Log 2 event in single period", + tests.Add(new SubTest("EventCounter: Log 2 events, explicit poll at end", delegate () { - listener.EnableTimer(logger, 1); /* Poll every 1 s */ - logger.Request(37); - logger.Request(25); - Thread.Sleep(1500); // Sleep for 1.5 seconds - listener.EnableTimer(logger, 0); - }, - delegate (List evts) - { - Assert.Equal(2, evts.Count); - ValidateSingleEventCounter(evts[0], "Request", 2, 31, 6, 25, 37); - })); - /*************************************************************************/ - tests.Add(new SubTest("Log 2 event in two periods", - delegate () - { - listener.EnableTimer(logger, 1); /* Poll every 1 s */ - logger.Request(37); - Thread.Sleep(1500); // Sleep for 1.5 seconds - logger.Request(25); - Thread.Sleep(1000); // Sleep for 1 seconds (at time = 2.5 second exactly two messages should be received) - listener.EnableTimer(logger, 0); + listener.EnableTimer(logger, 1); // Set to poll every second, but we dont actually care because the test ends before that. + logger.Request(5); + logger.Request(10); + listener.EnableTimer(logger, 0); // poll }, delegate (List evts) { Assert.Equal(4, evts.Count); - ValidateSingleEventCounter(evts[0], "Request", 1, 37, 0, 37, 37); - ValidateSingleEventCounter(evts[2], "Request", 1, 25, 0, 25, 25); + ValidateSingleEventCounter(evts[0], "Request", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[1], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[2], "Request", 2, 7.5f, 2.5f, 5, 10); + ValidateSingleEventCounter(evts[3], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); })); + /*************************************************************************/ - tests.Add(new SubTest("Log 2 different events in a period", + tests.Add(new SubTest("EventCounter: Log 3 events in two polling periods (explicit polling)", delegate () { - listener.EnableTimer(logger, 1); /* Poll every 1 s */ - logger.Request(25); + listener.EnableTimer(logger, 0); /* Turn off (but also poll once) */ + logger.Request(5); + logger.Request(10); logger.Error(); - Thread.Sleep(1500); // Sleep for 1.5 seconds - listener.EnableTimer(logger, 0); + listener.EnableTimer(logger, 0); /* Turn off (but also poll once) */ + logger.Request(8); + logger.Error(); + logger.Error(); + listener.EnableTimer(logger, 0); /* Turn off (but also poll once) */ }, delegate (List evts) { - Assert.Equal(2, evts.Count); - ValidateSingleEventCounter(evts[0], "Request", 1, 25, 0, 25, 25); - ValidateSingleEventCounter(evts[1], "Error", 1, 1, 0, 1, 1); + Assert.Equal(6, evts.Count); + ValidateSingleEventCounter(evts[0], "Request", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[1], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[2], "Request", 2, 7.5f, 2.5f, 5, 10); + ValidateSingleEventCounter(evts[3], "Error", 1, 1, 0, 1, 1); + ValidateSingleEventCounter(evts[4], "Request", 1, 8, 0, 8, 8); + ValidateSingleEventCounter(evts[5], "Error", 2, 1, 0, 1, 1); })); + + + /*************************************************************************/ + int num100msecTimerTicks = 0; + tests.Add(new SubTest("EventCounter: Log multiple events in multiple periods", + delegate () + { + // We have had problems with timer ticks not being called back 100% reliably. + // However timers really don't have a strong guarentee (only that the happen eventually) + // So what we do is create a timer callback that simply counts the number of callbacks. + // This acts as a marker to show whether the timer callbacks are happening promptly. + // If we don't get enough of these tick callbacks then we don't require EventCounter to + // be sending periodic callbacks either. + num100msecTimerTicks = 0; + using (var timer = new System.Threading.Timer(delegate(object state) { num100msecTimerTicks++; EventTestHarness.LogWriteLine("Tick"); }, null, 100, 100)) + { + listener.EnableTimer(logger, .1); /* Poll every .1 s */ + // logs at 0 seconds because of EnableTimer command + Sleep(100); + logger.Request(1); + Sleep(100); + logger.Request(2); + logger.Error(); + Sleep(100); + logger.Request(4); + Sleep(100); + logger.Request(8); + logger.Error(); + Sleep(100); + logger.Request(16); + Sleep(220); + listener.EnableTimer(logger, 0); + } + }, + delegate (List evts) + { + int requestCount = 0; + float requestSum = 0; + float requestMin = float.MaxValue; + float requestMax = float.MinValue; + + int errorCount = 0; + float errorSum = 0; + float errorMin = float.MaxValue; + float errorMax = float.MinValue; + + float timeSum = 0; + + for (int j = 0; j < evts.Count; j += 2) + { + var requestPayload = ValidateEventHeaderAndGetPayload(evts[j]); + Assert.Equal("Request", requestPayload["Name"]); + + var count = (int)requestPayload["Count"]; + requestCount += count; + if (count > 0) + requestSum += (float)requestPayload["Mean"] * count; + requestMin = Math.Min(requestMin, (float)requestPayload["Min"]); + requestMax = Math.Max(requestMax, (float)requestPayload["Max"]); + float requestIntevalSec = (float)requestPayload["IntervalSec"]; + + var errorPayload = ValidateEventHeaderAndGetPayload(evts[j + 1]); + Assert.Equal("Error", errorPayload["Name"]); + + count = (int)errorPayload["Count"]; + errorCount += count; + if (count > 0) + errorSum += (float)errorPayload["Mean"] * count; + errorMin = Math.Min(errorMin, (float)errorPayload["Min"]); + errorMax = Math.Max(errorMax, (float)errorPayload["Max"]); + float errorIntevalSec = (float)requestPayload["IntervalSec"]; + + Assert.Equal(requestIntevalSec, errorIntevalSec); + timeSum += requestIntevalSec; + } + + EventTestHarness.LogWriteLine("Validating: Count={0} RequestSum={1:n3} TimeSum={2:n3} ", evts.Count, requestSum, timeSum); + Assert.Equal(requestCount, 5); + Assert.Equal(requestSum, 31); + Assert.Equal(requestMin, 1); + Assert.Equal(requestMax, 16); + + Assert.Equal(errorCount, 2); + Assert.Equal(errorSum, 2); + Assert.Equal(errorMin, 1); + Assert.Equal(errorMax, 1); + + Assert.True(.4 < timeSum, $"FAILURE: .4 < {timeSum}"); // We should have at least 400 msec + Assert.True(timeSum < 2, $"FAILURE: {timeSum} < 2"); // But well under 2 sec. + + // Do all the things that depend on the count of events last so we know everything else is sane + Assert.True(4 <= evts.Count, "We expect two metrics at the beginning trigger and two at the end trigger. evts.Count = " + evts.Count); + Assert.True(evts.Count % 2 == 0, "We expect two metrics for every trigger. evts.Count = " + evts.Count); + + ValidateSingleEventCounter(evts[0], "Request", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[1], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + + // We shoudl always get the unconditional callback at the start and end of the trace. + Assert.True(4 <= evts.Count, $"FAILURE EventCounter Multi-event: 4 <= {evts.Count} ticks: {num100msecTimerTicks} thread: {Thread.CurrentThread.ManagedThreadId}"); + // We expect the timer to have gone off at least twice, plus the explicit poll at the begining and end. + // Each one fires two events (one for requests, one for errors). so that is (2 + 2)*2 = 8 + // We expect about 7 timer requests, but we don't get picky about the exact count + // Putting in a generous buffer, we double 7 to say we don't expect more than 14 timer fires + // so that is (2 + 14) * 2 = 32 + if (num100msecTimerTicks > 3) // We seem to have problems with timer events going off 100% reliably. To avoid failures here we only check if in the 700 msec test we get at least 3 100 msec ticks. + Assert.True(8 <= evts.Count, $"FAILURE: 8 <= {evts.Count}"); + Assert.True(evts.Count <= 32, $"FAILURE: {evts.Count} <= 32"); + })); + + + /*************************************************************************/ +#if FEATURE_EVENTCOUNTER_DISPOSE + tests.Add(new SubTest("EventCounter: Dispose()", + delegate () + { + // Creating and destroying + var myCounter = new EventCounter("counter for a transient object", logger); + myCounter.WriteMetric(10); + listener.EnableTimer(logger, 0); /* Turn off (but also poll once) */ + myCounter.Dispose(); + listener.EnableTimer(logger, 0); /* Turn off (but also poll once) */ + }, + delegate (List evts) + { + // The static counters (Request and Error), should not log any counts and stay at zero. + // The new counter will exist for the first poll but will not exist for the second. + Assert.Equal(5, evts.Count); + ValidateSingleEventCounter(evts[0], "Request", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[1], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[2], "counter for a transient object", 1, 10, 0, 10, 10); + ValidateSingleEventCounter(evts[3], "Request", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + ValidateSingleEventCounter(evts[4], "Error", 0, 0, 0, float.PositiveInfinity, float.NegativeInfinity); + })); +#endif /*************************************************************************/ EventTestHarness.RunTests(tests, listener, logger); } TestUtilities.CheckNoEventSourcesRunning("Stop"); } - private static void ValidateSingleEventCounter(Event evt, string counterName, int count, float sum, float sumSquared, float min, float max) + // Thread.Sleep has proven unreliable, sometime sleeping much shorter than it should. + // This makes sure it at least sleeps 'msec' at a miniumum. + private static void Sleep(int minMSec) { - object payload = ValidateEventHeaderAndGetPayload(evt); - var payloadContent = payload as IDictionary; - Assert.NotNull(payloadContent); - ValidateEventCounter(counterName, count, sum, sumSquared, min, max, payloadContent); + var startTime = DateTime.UtcNow; + for (; ; ) + { + DateTime endTime = DateTime.UtcNow; + double delta = (endTime - startTime).TotalMilliseconds; + if (delta >= minMSec) + break; + Thread.Sleep(1); + } } - private static object ValidateEventHeaderAndGetPayload(Event evt) + private static void ValidateSingleEventCounter(Event evt, string counterName, int count, float mean, float standardDeviation, float min, float max) + { + ValidateEventCounter(counterName, count, mean, standardDeviation, min, max, ValidateEventHeaderAndGetPayload(evt)); + } + + private static IDictionary ValidateEventHeaderAndGetPayload(Event evt) { Assert.Equal("EventCounters", evt.EventName); - List payloadNames = evt.PayloadNames.ToList(); - Assert.Equal(1, payloadNames.Count); - Assert.Equal("Payload", payloadNames[0]); - object rawPayload = evt.PayloadValue(0, "Payload"); - return rawPayload; + Assert.Equal(1, evt.PayloadCount); + Assert.NotNull(evt.PayloadNames); + Assert.Equal(1, evt.PayloadNames.Count); + Assert.Equal("Payload", evt.PayloadNames[0]); + var ret = (IDictionary)evt.PayloadValue(0, "Payload"); + Assert.NotNull(ret); + return ret; } private static void ValidateEventCounter(string counterName, int count, float mean, float standardDeviation, float min, float max, IDictionary payloadContent) { - var payloadContentValue = new List>(); - foreach (var payloadContentEntry in payloadContent) + Assert.Equal(counterName, (string)payloadContent["Name"]); + Assert.Equal(count, (int)payloadContent["Count"]); + if (count != 0) { - payloadContentValue.Add(payloadContentEntry); + Assert.Equal(mean, (float)payloadContent["Mean"]); + Assert.Equal(standardDeviation, (float)payloadContent["StandardDeviation"]); } - - Assert.Equal(7, payloadContentValue.Count); - ValidatePayloadEntry("Name", counterName, payloadContentValue[0]); - ValidatePayloadEntry("Mean", mean, payloadContentValue[1]); - ValidatePayloadEntry("StandardDeviation", standardDeviation, payloadContentValue[2]); - ValidatePayloadEntry("Count", count, payloadContentValue[3]); - ValidatePayloadEntry("Min", min, payloadContentValue[4]); - ValidatePayloadEntry("Max", max, payloadContentValue[5]); - } - - private static void ValidatePayloadEntry(string name, object value, KeyValuePair payloadEntry) - { - Assert.Equal(name, payloadEntry.Key); - Assert.Equal(value, payloadEntry.Value); + Assert.Equal(min, (float)payloadContent["Min"]); + Assert.Equal(max, (float)payloadContent["Max"]); } } -#endif //USE_ETW } diff --git a/external/corefx/src/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj b/external/corefx/src/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj index 050cf0b16d..5974d34e8f 100644 --- a/external/corefx/src/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj +++ b/external/corefx/src/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj @@ -4,6 +4,7 @@ {7E0E1B11-FF70-461E-99F7-C0AF252C0C60} $(DefineConstants);FEATURE_ETLEVENTS + $(DefineConstants);FEATURE_EVENTCOUNTER_DISPOSE true @@ -36,9 +37,6 @@ - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj index a50b48f7f3..7a653a3ece 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj @@ -17,10 +17,10 @@ - + - + @@ -67,7 +67,7 @@ - + diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs.REMOVED.git-id b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs.REMOVED.git-id index 294401321d..e50c3e8fb1 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs.REMOVED.git-id +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs.REMOVED.git-id @@ -1 +1 @@ -2eef4f26f04a8d93a35710e3a22200d70b0e162f \ No newline at end of file +a5362b7fa0b83c6757f5e6fff6d578dc4e712ad6 \ No newline at end of file diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs index 559bc0e715..57dec83e39 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx_LoadStore.cs @@ -258,7 +258,7 @@ namespace System.DirectoryServices.AccountManagement GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADStoreCtx", "GetAsPrincipal: using path={0}", (null != de ? de.Path : "searchResult")); - // Construct a appropriate Principal object. + // Construct an appropriate Principal object. bool targetIsFromGC = SDSUtils.IsObjectFromGC(path); try diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/RangeRetriever.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/RangeRetriever.cs index 3dbcb63d24..810f58418b 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/RangeRetriever.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/RangeRetriever.cs @@ -28,7 +28,7 @@ namespace System.DirectoryServices.AccountManagement /// DirectoryEntry object whose attribute needs to be range retrieved /// name of the attribute that needs to be range retrieved, ex: "memberOf" /// - /// If set to true, the supplied DirectoryEntry will be diposed, + /// If set to true, the supplied DirectoryEntry will be disposed, /// by this object's Dispose() method /// /// diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/SDSUtils.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/SDSUtils.cs index 6d290a781e..d365332c1d 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/SDSUtils.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/SDSUtils.cs @@ -23,7 +23,7 @@ namespace System.DirectoryServices.AccountManagement { Principal p; - // Construct a appropriate Principal object. + // Construct an appropriate Principal object. // Make* constructs a Principal that is marked persisted // and not loaded (p.unpersisted = false, p.loaded = false). @@ -85,7 +85,7 @@ namespace System.DirectoryServices.AccountManagement { Principal p; - // Construct a appropriate Principal object. + // Construct an appropriate Principal object. // Make* constructs a Principal that is marked persisted // and not loaded (p.unpersisted = false, p.loaded = false). diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/FindResultEnumerator.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/FindResultEnumerator.cs index b52bec2492..3e4aee89d8 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/FindResultEnumerator.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/FindResultEnumerator.cs @@ -154,7 +154,7 @@ namespace System.DirectoryServices.AccountManagement // Internal Constructors // - // Constructs a enumerator to enumerate over the supplied of ResultSet + // Constructs an enumerator to enumerate over the supplied of ResultSet // Note that resultSet can be null internal FindResultEnumerator(ResultSet resultSet) { diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/PrincipalCollection.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/PrincipalCollection.cs index 2924e10016..a86b831e05 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/PrincipalCollection.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/PrincipalCollection.cs @@ -429,7 +429,7 @@ namespace System.DirectoryServices.AccountManagement } else { - // They're trying to remove a already-persisted value. We add it to the + // They're trying to remove an already-persisted value. We add it to the // removedValues list. Then, if it's already been loaded into insertedValuesCompleted, // we remove it from insertedValuesCompleted. diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx.cs index d1d01ec541..416dd325cc 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx.cs @@ -811,7 +811,7 @@ namespace System.DirectoryServices.AccountManagement // interact with other StoreCtxs to fulfill the request. // // This method is typically used by ResultSet implementations, when they're iterating over a collection - // (e.g., of group membership) and encounter a entry that represents a foreign principal. + // (e.g., of group membership) and encounter an entry that represents a foreign principal. internal override Principal ResolveCrossStoreRefToPrincipal(object o) { Debug.Assert(o is DirectoryEntry); @@ -894,7 +894,7 @@ namespace System.DirectoryServices.AccountManagement // // Returns true if AccountInfo is supported for the specified principal, false otherwise. - // Used when a application tries to access the AccountInfo property of a newly-inserted + // Used when an application tries to access the AccountInfo property of a newly-inserted // (not yet persisted) AuthenticablePrincipal, to determine whether it should be allowed. internal override bool SupportsAccounts(AuthenticablePrincipal p) { @@ -907,7 +907,7 @@ namespace System.DirectoryServices.AccountManagement } // Returns the set of credential types supported by this store for the specified principal. - // Used when a application tries to access the PasswordInfo property of a newly-inserted + // Used when an application tries to access the PasswordInfo property of a newly-inserted // (not yet persisted) AuthenticablePrincipal, to determine whether it should be allowed. // Also used to implement AuthenticablePrincipal.SupportedCredentialTypes. internal override CredentialTypes SupportedCredTypes(AuthenticablePrincipal p) diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx_LoadStore.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx_LoadStore.cs index 88594f37fa..baaf4b05c9 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx_LoadStore.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMStoreCtx_LoadStore.cs @@ -207,7 +207,7 @@ namespace System.DirectoryServices.AccountManagement GlobalDebug.WriteLineIf(GlobalDebug.Info, "SAMStoreCtx", "GetAsPrincipal: using path={0}", de.Path); - // Construct a appropriate Principal object. + // Construct an appropriate Principal object. Principal p = SDSUtils.DirectoryEntryToPrincipal(de, this.OwningContext, null); Debug.Assert(p != null); diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/StoreCtx.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/StoreCtx.cs index a1340e384f..b4ef442830 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/StoreCtx.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/StoreCtx.cs @@ -206,7 +206,7 @@ namespace System.DirectoryServices.AccountManagement // interact with other StoreCtxs to fulfill the request. // // This method is typically used by ResultSet implementations, when they're iterating over a collection - // (e.g., of group membership) and encounter a entry that represents a foreign principal. + // (e.g., of group membership) and encounter an entry that represents a foreign principal. internal abstract Principal ResolveCrossStoreRefToPrincipal(object o); // @@ -219,12 +219,12 @@ namespace System.DirectoryServices.AccountManagement internal abstract bool IsValidProperty(Principal p, string propertyName); // Returns true if AccountInfo is supported for the specified principal, false otherwise. - // Used when a application tries to access the AccountInfo property of a newly-inserted + // Used when an application tries to access the AccountInfo property of a newly-inserted // (not yet persisted) AuthenticablePrincipal, to determine whether it should be allowed. internal abstract bool SupportsAccounts(AuthenticablePrincipal p); // Returns the set of credential types supported by this store for the specified principal. - // Used when a application tries to access the PasswordInfo property of a newly-inserted + // Used when an application tries to access the PasswordInfo property of a newly-inserted // (not yet persisted) AuthenticablePrincipal, to determine whether it should be allowed. // Also used to implement AuthenticablePrincipal.SupportedCredentialTypes. internal abstract CredentialTypes SupportedCredTypes(AuthenticablePrincipal p); diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Utils.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Utils.cs index ede2a49703..94bdfed888 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Utils.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Utils.cs @@ -237,7 +237,7 @@ namespace System.DirectoryServices.AccountManagement (identAuth.b5 == 0) && (identAuth.b6 == 5)) { - // No, so it can't be a account or builtin SID. + // No, so it can't be an account or builtin SID. // Probably something like \Everyone or \LOCAL. return SidType.FakeObject; } diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs new file mode 100644 index 0000000000..5204c198d0 --- /dev/null +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/AccountManagementTests.cs @@ -0,0 +1,583 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Globalization; +using System.Runtime.InteropServices; +using System.DirectoryServices.Tests; +using System.Linq; +using Xunit; + +namespace System.DirectoryServices.AccountManagement.Tests +{ + public class AccountManagementTests + { + internal static bool IsLdapConfigurationExist => LdapConfiguration.Configuration != null; + internal static bool IsActiveDirectoryServer => IsLdapConfigurationExist && LdapConfiguration.Configuration.IsActiveDirectoryServer; + internal static bool IsDomainJoinedClient => !Environment.MachineName.Equals(Environment.UserDomainName, StringComparison.OrdinalIgnoreCase); + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestCurrentUser() + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal p = FindUser(LdapConfiguration.Configuration.UserNameWithNoDomain, context)) + { + Assert.NotNull(p); + Assert.Equal(LdapConfiguration.Configuration.UserNameWithNoDomain, p.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer), nameof(IsDomainJoinedClient))] + public void TestCurrentUserContext() + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal p = FindUser(LdapConfiguration.Configuration.UserNameWithNoDomain, context)) + using (UserPrincipal cu = UserPrincipal.Current) + { + Assert.NotEqual(cu.Context.Name, p.Context.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestCurrentUserUsingSearchFilter() + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal p = FindUserUsingFilter(LdapConfiguration.Configuration.UserNameWithNoDomain, context)) + { + Assert.NotNull(p); + Assert.Equal(LdapConfiguration.Configuration.UserNameWithNoDomain, p.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestGuestsGroup() + { + using (PrincipalContext context = DomainContext) + using (GroupPrincipal p = FindGroup("Guests", context)) + { + Assert.NotNull(p); + Assert.Equal("Guests", p.Name); + Assert.Equal("Guests", p.SamAccountName); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestAddingUser() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser1"); + UserData u2 = UserData.GenerateUserData("CoreFxUser2"); + UserData u3 = UserData.GenerateUserData("CoreFxUser3"); + + DeleteUser(u1.Name); + DeleteUser(u2.Name); + DeleteUser(u3.Name); + + try + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal p1 = CreateUser(context, u1)) + using (UserPrincipal p2 = CreateUser(context, u2)) + using (UserPrincipal p3 = CreateUser(context, u3)) + { + Assert.NotNull(p1); + Assert.NotNull(p2); + Assert.NotNull(p3); + + ValidateRecentAddedUser(context, u1); + ValidateRecentAddedUser(context, u2); + ValidateRecentAddedUser(context, u3); + + ValidateUserUsingPrincipal(context, p1); + ValidateUserUsingPrincipal(context, p2); + ValidateUserUsingPrincipal(context, p3); + } + } + finally + { + DeleteUser(u1.Name); + DeleteUser(u2.Name); + DeleteUser(u3.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestAddingGroup() + { + GroupData gd1 = GroupData.GenerateGroupData("CoreFXGroup1"); + GroupData gd2 = GroupData.GenerateGroupData("CoreFXGroup2"); + GroupData gd3 = GroupData.GenerateGroupData("CoreFXGroup3"); + + DeleteGroup(gd1.Name); + DeleteGroup(gd2.Name); + DeleteGroup(gd3.Name); + + try + { + using (PrincipalContext context = DomainContext) + using (GroupPrincipal p1 = CreateGroup(context, gd1)) + using (GroupPrincipal p2 = CreateGroup(context, gd2)) + using (GroupPrincipal p3 = CreateGroup(context, gd3)) + { + Assert.NotNull(p1); + Assert.NotNull(p2); + Assert.NotNull(p3); + + ValidateRecentAddedGroup(context, gd1); + ValidateRecentAddedGroup(context, gd2); + ValidateRecentAddedGroup(context, gd3); + + ValidateGroupUsingPrincipal(context, p1); + ValidateGroupUsingPrincipal(context, p2); + ValidateGroupUsingPrincipal(context, p3); + } + } + finally + { + DeleteGroup(gd1.Name); + DeleteGroup(gd2.Name); + DeleteGroup(gd3.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestAddingUserToAGroup() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser4"); + GroupData g1 = GroupData.GenerateGroupData("CoreFXGroup4"); + + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + + try + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal user = CreateUser(context, u1)) + using (GroupPrincipal group = CreateGroup(context, g1)) + { + Assert.Equal(u1.Name, user.Name); + Assert.Equal(g1.Name, group.Name); + + // First, check the user is not in the group + + Assert.False(user.GetGroups().Contains(group)); + Assert.False(user.IsMemberOf(group)); + Assert.False(group.Members.Contains(user)); + + // second, add user and validate it is member of the group + + group.Members.Add(context, IdentityType.Name, user.Name); + group.Save(); + + Assert.True(user.GetGroups().Contains(group)); + Assert.True(user.IsMemberOf(group)); + Assert.True(group.Members.Contains(user)); + + // Third, remove the user from the group and check again + group.Members.Remove(context, IdentityType.Name, user.Name); + group.Save(); + Assert.False(user.GetGroups().Contains(group)); + Assert.False(user.IsMemberOf(group)); + Assert.False(group.Members.Contains(user)); + } + } + finally + { + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestDeleteUserAndGroup() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser5"); + GroupData g1 = GroupData.GenerateGroupData("CoreFXGroup5"); + + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + + try + { + using (PrincipalContext context = DomainContext) + { + using (UserPrincipal up = FindUser(u1.Name, context)) { Assert.Null(up); } + using (GroupPrincipal gp = FindGroup(g1.Name, context)) { Assert.Null(gp); } + + using (UserPrincipal user = CreateUser(context, u1)) + using (GroupPrincipal group = CreateGroup(context, g1)) + { + using (UserPrincipal up = FindUser(u1.Name, context)) + { + Assert.NotNull(up); + up.Delete(); + } + using (GroupPrincipal gp = FindGroup(g1.Name, context)) + { + Assert.NotNull(gp); + gp.Delete(); + } + } + + using (UserPrincipal up = FindUser(u1.Name, context)) { Assert.Null(up); } + using (GroupPrincipal gp = FindGroup(g1.Name, context)) { Assert.Null(gp); } + } + } + finally + { + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestNegativeCases() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser6"); + GroupData g1 = GroupData.GenerateGroupData("CoreFXGroup6"); + + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + + try + { + Assert.Throws(() => new PrincipalContext((ContextType) 768, null, null, null)); + Assert.Throws(() => new PrincipalContext(ContextType.Domain, "InvalidDomainName", null, null)); + Assert.Throws(() => new PrincipalContext(ContextType.Domain, LdapConfiguration.Configuration.ServerName, "InvalidTestUserName", null)); + Assert.Throws(() => new PrincipalContext(ContextType.Domain, LdapConfiguration.Configuration.ServerName, LdapConfiguration.Configuration.UserName, null)); + Assert.Throws(() => new UserPrincipal(null)); + Assert.Throws(() => new GroupPrincipal(null)); + + using (PrincipalContext context = DomainContext) + { + using (UserPrincipal user = CreateUser(context, u1)) + using (GroupPrincipal group = CreateGroup(context, g1)) + { + Assert.Throws(() => CreateUser(context, u1)); + Assert.Throws(() => CreateGroup(context, g1)); + + group.Members.Add(context, IdentityType.Name, user.Name); + group.Save(); + Assert.Throws(() => group.Members.Add(context, IdentityType.Name, user.Name)); + group.Members.Remove(context, IdentityType.Name, user.Name); + group.Save(); + + user.Delete(); + Assert.Throws(() => user.Delete()); + Assert.Throws(() => user.Save()); + + group.Delete(); + Assert.Throws(() => group.Delete()); + Assert.Throws(() => group.Save()); + } + } + } + finally + { + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestComputerContext() + { + using (PrincipalContext context = DomainContext) + { + using (ComputerPrincipal cp = new ComputerPrincipal(context)) + { + cp.Name = "*"; + PrincipalSearcher ps = new PrincipalSearcher(); + ps.QueryFilter = cp; + using (ComputerPrincipal r1 = ps.FindOne() as ComputerPrincipal) + using (ComputerPrincipal r2 = ComputerPrincipal.FindByIdentity(context, r1.Name)) + { + Assert.Equal(r2.AccountExpirationDate, r1.AccountExpirationDate); + Assert.Equal(r2.Description, r1.Description); + Assert.Equal(r2.DisplayName, r1.DisplayName); + Assert.Equal(r2.DistinguishedName, r1.DistinguishedName); + Assert.Equal(r2.Guid, r1.Guid); + Assert.Equal(r2.HomeDirectory, r1.HomeDirectory); + Assert.Equal(r2.HomeDrive, r1.HomeDrive); + Assert.Equal(r2.SamAccountName, r1.SamAccountName); + Assert.Equal(r2.Sid, r1.Sid); + Assert.Equal(r2.UserPrincipalName, r1.UserPrincipalName); + } + } + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestUpdateUserAndGroupData() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser7"); + GroupData g1 = GroupData.GenerateGroupData("CoreFXGroup7"); + + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + + try + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal user = CreateUser(context, u1)) + using (GroupPrincipal group = CreateGroup(context, g1)) + { + using (UserPrincipal up = FindUser(u1.Name, context)) { Assert.Equal(user.DisplayName, up.DisplayName); } + using (GroupPrincipal gp = FindGroup(g1.Name, context)) { Assert.Equal(group.DisplayName, gp.DisplayName); } + + user.DisplayName = "Updated CoreFx Test Child User 4"; + user.Save(); + group.DisplayName = "Updated CoreFX Test Group Container 4"; + group.Save(); + + using (UserPrincipal up = FindUser(u1.Name, context)) { Assert.Equal("Updated CoreFx Test Child User 4", up.DisplayName); } + using (GroupPrincipal gp = FindGroup(g1.Name, context)) { Assert.Equal("Updated CoreFX Test Group Container 4", gp.DisplayName); } + } + } + finally + { + DeleteUser(u1.Name); + DeleteGroup(g1.Name); + } + } + + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestCredentials() + { + UserData u1 = UserData.GenerateUserData("CoreFxUser8"); + + DeleteUser(u1.Name); + + try + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal p1 = CreateUser(context, u1)) + { + Assert.True(context.ValidateCredentials(u1.Name, u1.Password)); + Assert.True(context.ValidateCredentials(u1.Name, u1.Password, ContextOptions.ServerBind)); + + Assert.Throws(() => context.ValidateCredentials(u1.Name, "WrongPassword")); + Assert.Throws(() => context.ValidateCredentials("WrongUser", u1.Password)); + } + } + finally + { + DeleteUser(u1.Name); + } + } + + private void ValidateRecentAddedUser(PrincipalContext context, UserData userData) + { + using (UserPrincipal p = FindUser(userData.Name, context)) + { + Assert.NotNull(p); + Assert.Equal(userData.Name, p.Name); + Assert.Equal(userData.FirstName, p.GivenName); + Assert.Equal(userData.LastName, p.Surname); + Assert.Equal(userData.DisplayName, p.DisplayName); + Assert.True(p.DistinguishedName.IndexOf(userData.Name, StringComparison.OrdinalIgnoreCase) >= 0); + Assert.Equal(userData.Name, p.SamAccountName); + } + } + + private void ValidateRecentAddedGroup(PrincipalContext context, GroupData groupData) + { + using (GroupPrincipal p = FindGroup(groupData.Name, context)) + { + Assert.NotNull(p); + Assert.Equal(groupData.Name, p.Name); + Assert.Equal(groupData.Description, p.Description); + Assert.Equal(groupData.DisplayName, p.DisplayName); + Assert.Equal(groupData.Name, p.SamAccountName); + Assert.True(p.DistinguishedName.IndexOf(groupData.Name, StringComparison.OrdinalIgnoreCase) >= 0); + } + } + + private void ValidateUserUsingPrincipal(PrincipalContext context, UserPrincipal user) + { + using (UserPrincipal p = FindUser(user.Name, context)) + { + Assert.NotNull(p); + Assert.Equal(user.Name, p.Name); + Assert.Equal(user.GivenName, p.GivenName); + Assert.Equal(user.Surname, p.Surname); + Assert.Equal(user.DisplayName, p.DisplayName); + Assert.Equal(user.SamAccountName, p.SamAccountName); + + Assert.Equal(user.Guid, p.Guid); + Assert.Equal(user.Sid, p.Sid); + Assert.Equal(user.UserPrincipalName, p.UserPrincipalName); + Assert.Equal(user.UserCannotChangePassword, p.UserCannotChangePassword); + Assert.Equal(user.Enabled, p.Enabled); + Assert.Equal(user.AccountExpirationDate, p.AccountExpirationDate); + } + } + + private void ValidateGroupUsingPrincipal(PrincipalContext context, GroupPrincipal group) + { + using (GroupPrincipal p = FindGroup(group.Name, context)) + { + Assert.NotNull(p); + Assert.Equal(group.Name, p.Name); + Assert.Equal(group.DisplayName, p.DisplayName); + Assert.Equal(group.SamAccountName, p.SamAccountName); + + Assert.Equal(group.Guid, p.Guid); + Assert.Equal(group.Sid, p.Sid); + Assert.Equal(group.UserPrincipalName, p.UserPrincipalName); + Assert.Equal(group.DistinguishedName, p.DistinguishedName); + } + } + + private UserPrincipal CreateUser(PrincipalContext context, UserData userData) + { + UserPrincipal user = new UserPrincipal(context, userData.Name, userData.Password, true); + + // assign some properties to the user principal + user.GivenName = userData.FirstName; + user.Surname = userData.LastName; + user.DisplayName = userData.DisplayName; + user.Save(); + return user; + } + + private GroupPrincipal CreateGroup(PrincipalContext context, GroupData groupData) + { + GroupPrincipal group = new GroupPrincipal(context, groupData.Name); + group.Description = groupData.Description; + group.DisplayName = groupData.DisplayName; + group.Save(); + return group; + } + + private void DeleteGroup(string groupName) + { + try + { + using (PrincipalContext context = DomainContext) + using (GroupPrincipal p = FindGroup(groupName, context)) + { + if (p != null) + p.Delete(); + } + } + catch + { + // ignore the failure as we use this method to ensure clean up even if the group not exist + } + } + + private void DeleteUser(string userName) + { + try + { + using (PrincipalContext context = DomainContext) + using (UserPrincipal p = FindUser(userName, context)) + { + if (p != null) + p.Delete(); + } + } + catch + { + // ignore the failure as we use this method to ensure clean up even if the user not exist + } + } + + private GroupPrincipal FindGroup(string groupName, PrincipalContext context) + { + return GroupPrincipal.FindByIdentity(context, IdentityType.Name, groupName); + } + + private UserPrincipal FindUser(string userName, PrincipalContext context) + { + return UserPrincipal.FindByIdentity(context, IdentityType.Name, userName); + } + + private UserPrincipal FindUserUsingFilter(string userName, PrincipalContext context) + { + CustomUserPrincipal userPrincipal = new CustomUserPrincipal(context); + userPrincipal.SetUserNameFilter(userName); + PrincipalSearcher searcher = new PrincipalSearcher(userPrincipal); + return searcher.FindOne() as UserPrincipal; + } + + private PrincipalContext DomainContext => new PrincipalContext( + ContextType.Domain, + LdapConfiguration.Configuration.ServerName, + LdapConfiguration.Configuration.UserName, + LdapConfiguration.Configuration.Password); + } + + internal class UserData + { + internal static UserData GenerateUserData(string name) + { + UserData ud = new UserData(); + ud.Name = name; + ud.Password = Guid.NewGuid().ToString() + "#1aZ"; + ud.FirstName = "First " + name; + ud.LastName = "Last " + name; + ud.DisplayName = "Display " + name; + return ud; + } + + internal string Name { get; set; } + internal string Password { get; set; } + internal string FirstName { get; set; } + internal string LastName { get; set; } + internal string DisplayName { get; set; } + } + + internal class GroupData + { + internal static GroupData GenerateGroupData(string name) + { + GroupData gd = new GroupData(); + gd.Name = name; + gd.Description = "Description " + name; + gd.DisplayName = "Display " + name; + return gd; + } + + internal string Name { get; set; } + internal string Description { get; set; } + internal string DisplayName { get; set; } + } + + [DirectoryObjectClass("user")] + public class CustomUserPrincipal : UserPrincipal + { + private CustomFilter _customFilter; + + public CustomUserPrincipal(PrincipalContext context) : base(context) { } + + public void SetUserNameFilter(string name) + { + ((CustomFilter) AdvancedSearchFilter).SetFilter(name); + } + + public override AdvancedFilters AdvancedSearchFilter + { + get + { + if (_customFilter == null) + { + _customFilter = new CustomFilter(this); + } + + return _customFilter; + } + } + } + + public class CustomFilter : AdvancedFilters + { + public CustomFilter(Principal p) : base(p) { } + + public void SetFilter(string userName) + { + this.AdvancedFilterSet("cn", userName, typeof(string), MatchType.Equals); + } + } +} diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs index 04ac152d6b..c5a9230b84 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/ComputerPrincipalTest.cs @@ -45,7 +45,7 @@ namespace System.DirectoryServices.AccountManagement.Tests AssertExtensions.Throws(null, () => new ComputerPrincipal(context, "samAccountName", null, enabled: true)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void Ctor_MachineContext_NoException() { var context = new PrincipalContext(ContextType.Machine); diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/LDAP.Configuration.xml b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/LDAP.Configuration.xml new file mode 100644 index 0000000000..16d7b6c5c2 --- /dev/null +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/LDAP.Configuration.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs index 3dcf65ca9e..bf67a3c059 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs @@ -10,7 +10,7 @@ namespace System.DirectoryServices.AccountManagement.Tests { public class PrincipalContextTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void Ctor_ContextType() { var context = new PrincipalContext(ContextType.Machine); @@ -23,7 +23,7 @@ namespace System.DirectoryServices.AccountManagement.Tests Assert.Equal(Environment.MachineName, context.ConnectedServer); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(ContextType.Machine, null)] [InlineData(ContextType.Machine, "")] @@ -49,7 +49,7 @@ namespace System.DirectoryServices.AccountManagement.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(ContextType.Machine, null, null)] [InlineData(ContextType.Machine, "", null)] @@ -75,7 +75,7 @@ namespace System.DirectoryServices.AccountManagement.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(ContextType.Machine, null, null, ContextOptions.Negotiate)] [InlineData(ContextType.Machine, "", null, ContextOptions.Negotiate)] @@ -101,7 +101,8 @@ namespace System.DirectoryServices.AccountManagement.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(23800)] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(ContextType.Machine, null, "userName", "password")] [InlineData(ContextType.Machine, "", "", "")] @@ -126,7 +127,8 @@ namespace System.DirectoryServices.AccountManagement.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(23800)] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(ContextType.Machine, null, null, "userName", "password")] [InlineData(ContextType.Machine, "", null, "", "")] @@ -168,7 +170,11 @@ namespace System.DirectoryServices.AccountManagement.Tests [Fact] public void Ctor_DomainContextType_ThrowsPrincipalServerDownException() { - Assert.Throws(() => new PrincipalContext(ContextType.Domain)); + if (Environment.MachineName.Equals(Environment.UserDomainName, StringComparison.OrdinalIgnoreCase)) + { + // The machine is not connected to a domain. we expect PrincipalContext(ContextType.Domain) to throw + Assert.Throws(() => new PrincipalContext(ContextType.Domain)); + } } [Fact] @@ -282,7 +288,7 @@ namespace System.DirectoryServices.AccountManagement.Tests Assert.Throws(() => context.UserName); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [InlineData(null, null, true)] [InlineData("", "", false)] public void ValidateCredentials_Invoke_ReturnsExpected(string userName, string password, bool expected) @@ -292,7 +298,8 @@ namespace System.DirectoryServices.AccountManagement.Tests Assert.Equal(expected, context.ValidateCredentials(userName, password, ContextOptions.Negotiate)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(23800)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] public void ValidateCredentials_InvalidUserName_ThrowsException() { @@ -300,7 +307,8 @@ namespace System.DirectoryServices.AccountManagement.Tests Assert.Throws(() => context.ValidateCredentials("\0", "password")); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(23800)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] public void ValidateCredentials_IncorrectUserNamePassword_ThrowsException() { diff --git a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj index f76dc01b65..fe762de387 100644 --- a/external/corefx/src/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj +++ b/external/corefx/src/System.DirectoryServices.AccountManagement/tests/System.DirectoryServices.AccountManagement.Tests.csproj @@ -14,9 +14,19 @@ - - Common\System\PlatformDetection.cs + + + + Common\DirectoryServices\LdapConfiguration.cs + + + + + PreserveNewest + + + \ No newline at end of file diff --git a/external/corefx/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/SearchResults.cs b/external/corefx/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/SearchResults.cs index 9edcb9389b..7c81120717 100644 --- a/external/corefx/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/SearchResults.cs +++ b/external/corefx/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/SearchResults.cs @@ -72,10 +72,11 @@ namespace System.DirectoryServices.Protocols { private DirectoryControl[] _resultControls = null; - internal SearchResultEntry(string dn) => DistinguishedName = dn; + internal SearchResultEntry(string dn) : this(dn, new SearchResultAttributeCollection()) {} - internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs) : this(dn) + internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs) { + DistinguishedName = dn; Attributes = attrs; } diff --git a/external/corefx/src/System.DirectoryServices/src/System.DirectoryServices.csproj b/external/corefx/src/System.DirectoryServices/src/System.DirectoryServices.csproj index a3bfc8e80a..4bb3676351 100644 --- a/external/corefx/src/System.DirectoryServices/src/System.DirectoryServices.csproj +++ b/external/corefx/src/System.DirectoryServices/src/System.DirectoryServices.csproj @@ -18,7 +18,7 @@ - + diff --git a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs.REMOVED.git-id b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs.REMOVED.git-id index f0bb9bfcc5..d56f861d1d 100644 --- a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs.REMOVED.git-id +++ b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Utils.cs.REMOVED.git-id @@ -1 +1 @@ -5512312aa6bdb5e8a2c4476128f22895f08223b0 \ No newline at end of file +ae29ccfeed9ec00c81f609fdf9c8082cf736dc26 \ No newline at end of file diff --git a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs index 1cdab36817..8895609a8d 100644 --- a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs +++ b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/DirectorySearcher.cs @@ -398,7 +398,7 @@ namespace System.DirectoryServices public bool Asynchronous { get; set; } /// - /// Gets or sets a value indicateing whether the search should also return deleted objects that match the search + /// Gets or sets a value indicating whether the search should also return deleted objects that match the search /// filter. /// [DefaultValue(false)] diff --git a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ReferalChasingOption.cs b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ReferalChasingOption.cs index 1457fc836f..8e75ed1b2f 100644 --- a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ReferalChasingOption.cs +++ b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/ReferalChasingOption.cs @@ -10,7 +10,7 @@ namespace System.DirectoryServices public enum ReferralChasingOption { /// - /// Never chase the referred-to server. Setthing this option + /// Never chase the referred-to server. Setting this option /// prevents a client from contacting other servers in a referral process. /// None = 0, diff --git a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs index 138da5f2ec..4b1d26e5c3 100644 --- a/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs +++ b/external/corefx/src/System.DirectoryServices/src/System/DirectoryServices/SchemaNameCollection.cs @@ -148,7 +148,7 @@ namespace System.DirectoryServices } /// - /// nserts an item at the specified position in the collection. + /// Inserts an item at the specified position in the collection. /// public void Insert(int index, string value) { diff --git a/external/corefx/src/System.DirectoryServices/tests/LDAP.Configuration.xml b/external/corefx/src/System.DirectoryServices/tests/LDAP.Configuration.xml new file mode 100644 index 0000000000..f587727b9a --- /dev/null +++ b/external/corefx/src/System.DirectoryServices/tests/LDAP.Configuration.xml @@ -0,0 +1,19 @@ + + \ No newline at end of file diff --git a/external/corefx/src/System.DirectoryServices/tests/System.DirectoryServices.Tests.csproj b/external/corefx/src/System.DirectoryServices/tests/System.DirectoryServices.Tests.csproj index a5ee49348b..f20484596a 100644 --- a/external/corefx/src/System.DirectoryServices/tests/System.DirectoryServices.Tests.csproj +++ b/external/corefx/src/System.DirectoryServices/tests/System.DirectoryServices.Tests.csproj @@ -10,6 +10,7 @@ + @@ -18,9 +19,21 @@ - - Common\System\PlatformDetection.cs + + + Common\DirectoryServices\LdapConfiguration.cs + + + PreserveNewest + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ActiveDirectoryInterSiteTransportTests.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ActiveDirectoryInterSiteTransportTests.cs index bc038fd891..33c516c056 100644 --- a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ActiveDirectoryInterSiteTransportTests.cs +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ActiveDirectoryInterSiteTransportTests.cs @@ -36,8 +36,12 @@ namespace System.DirectoryServices.ActiveDirectory.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not approved COM object for app")] public void FindByTransportType_ForestNoDomainAssociatedWithName_ThrowsActiveDirectoryOperationException_NoUap() { - var context = new DirectoryContext(DirectoryContextType.Forest, "\0"); - AssertExtensions.Throws("context", () => ActiveDirectoryInterSiteTransport.FindByTransportType(context, ActiveDirectoryTransportType.Rpc)); + // Domain joined machines will not throw on the ActiveDirectoryInterSiteTransport.FindByTransportType call. + if (Environment.MachineName.Equals(Environment.UserDomainName, StringComparison.OrdinalIgnoreCase)) + { + var context = new DirectoryContext(DirectoryContextType.Forest, "\0"); + AssertExtensions.Throws("context", () => ActiveDirectoryInterSiteTransport.FindByTransportType(context, ActiveDirectoryTransportType.Rpc)); + } } [Fact] @@ -47,7 +51,7 @@ namespace System.DirectoryServices.ActiveDirectory.Tests AssertExtensions.Throws("context", () => ActiveDirectoryInterSiteTransport.FindByTransportType(context, ActiveDirectoryTransportType.Rpc)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(DirectoryContextType.ApplicationPartition)] [InlineData(DirectoryContextType.DirectoryServer)] diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DomainControllerTests.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DomainControllerTests.cs index 489de1aa5a..d95fd471d3 100644 --- a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DomainControllerTests.cs +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DomainControllerTests.cs @@ -26,7 +26,7 @@ namespace System.DirectoryServices.ActiveDirectory.Tests AssertExtensions.Throws("context", () => DomainController.GetDomainController(context)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData("\0")] [InlineData("server:port")] @@ -38,7 +38,7 @@ namespace System.DirectoryServices.ActiveDirectory.Tests Assert.Throws(() => DomainController.GetDomainController(context)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Access to path is denied when in App container")] public void GetDomainController_InvalidIPV6_ThrowsActiveDirectoryObjectNotFoundException() { @@ -109,9 +109,13 @@ namespace System.DirectoryServices.ActiveDirectory.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not approved COM object for app")] public void FindAll_NoSuchName_ReturnsEmpty() { - var context = new DirectoryContext(DirectoryContextType.Domain, "\0"); - Assert.Empty(DomainController.FindAll(context)); - Assert.Empty(DomainController.FindAll(context, "siteName")); + // Domain joined machines can have entries in the DomainController. + if (Environment.MachineName.Equals(Environment.UserDomainName, StringComparison.OrdinalIgnoreCase)) + { + var context = new DirectoryContext(DirectoryContextType.Domain, "\0"); + Assert.Empty(DomainController.FindAll(context)); + Assert.Empty(DomainController.FindAll(context, "siteName")); + } } [Fact] diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ForestTests.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ForestTests.cs index d51e67d33b..06abaaa22c 100644 --- a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ForestTests.cs +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/ForestTests.cs @@ -33,7 +33,7 @@ namespace System.DirectoryServices.ActiveDirectory.Tests Assert.Throws(() => Forest.GetForest(context)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [InlineData(DirectoryContextType.DirectoryServer, "\0")] [InlineData(DirectoryContextType.Forest, "server:port")] [ActiveIssue("https://github.com/dotnet/corefx/issues/21553", TargetFrameworkMonikers.UapAot)] @@ -46,7 +46,7 @@ namespace System.DirectoryServices.ActiveDirectory.Tests Assert.Throws(() => Forest.GetForest(context)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [OuterLoop("Takes too long on domain joined machines")] [InlineData(DirectoryContextType.Forest, "\0")] [InlineData(DirectoryContextType.DirectoryServer, "server:port")] diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectoryComInterop.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectoryComInterop.cs new file mode 100644 index 0000000000..b174268c09 --- /dev/null +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectoryComInterop.cs @@ -0,0 +1,257 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System; + +namespace ActiveDirectoryComInterop +{ + // , TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable) + [Guid("9068270B-0939-11D1-8BE1-00C04FD8D503")] + [ComImport] + public interface IADsLargeInteger + { + [DispId(2)] + int HighPart + { + [DispId(2)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(2)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(3)] + int LowPart + { + [DispId(3)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(3)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + } + + // , TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable) + [Guid("FD8256D0-FD15-11CE-ABC4-02608C9E7553")] + [ComImport] + public interface IADs + { + [DispId(2)] + string Name + { + [DispId(2)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + [DispId(3)] + string Class + { + [DispId(3)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + [DispId(4)] + string GUID + { + [DispId(4)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + [DispId(5)] + string ADsPath + { + [DispId(5)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + [DispId(6)] + string Parent + { + [DispId(6)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + [DispId(7)] + string Schema + { + [DispId(7)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + } + + [DispId(8)] + [MethodImpl(MethodImplOptions.InternalCall)] + void GetInfo(); + + [DispId(9)] + [MethodImpl(MethodImplOptions.InternalCall)] + void SetInfo(); + + [DispId(10)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.Struct)] + object Get([MarshalAs(UnmanagedType.BStr)] [In] string bstrName); + + [DispId(11)] + [MethodImpl(MethodImplOptions.InternalCall)] + void Put([MarshalAs(UnmanagedType.BStr)] [In] string bstrName, [MarshalAs(UnmanagedType.Struct)] [In] object vProp); + + [DispId(12)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.Struct)] + object GetEx([MarshalAs(UnmanagedType.BStr)] [In] string bstrName); + + [DispId(13)] + [MethodImpl(MethodImplOptions.InternalCall)] + void PutEx([In] int lnControlCode, [MarshalAs(UnmanagedType.BStr)] [In] string bstrName, [MarshalAs(UnmanagedType.Struct)] [In] object vProp); + + [DispId(14)] + [MethodImpl(MethodImplOptions.InternalCall)] + void GetInfoEx([MarshalAs(UnmanagedType.Struct)] [In] object vProperties, [In] int lnReserved); + } + + // , TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable) + [Guid("B8C787CA-9BDD-11D0-852C-00C04FD8D503")] + [ComImport] + public interface IADsSecurityDescriptor + { + [DispId(2)] + int Revision + { + [DispId(2)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(2)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(3)] + int Control + { + [DispId(3)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(3)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(4)] + string Owner + { + [DispId(4)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [DispId(4)] + [MethodImpl(MethodImplOptions.InternalCall)] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + [DispId(5)] + bool OwnerDefaulted + { + [DispId(5)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(5)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(6)] + string Group + { + [DispId(6)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.BStr)] + get; + [DispId(6)] + [MethodImpl(MethodImplOptions.InternalCall)] + [param: MarshalAs(UnmanagedType.BStr)] + set; + } + + [DispId(7)] + bool GroupDefaulted + { + [DispId(7)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(7)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(8)] + object DiscretionaryAcl + { + [DispId(8)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.IDispatch)] + get; + [DispId(8)] + [MethodImpl(MethodImplOptions.InternalCall)] + [param: MarshalAs(UnmanagedType.IDispatch)] + set; + } + + [DispId(9)] + bool DaclDefaulted + { + [DispId(9)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(9)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(10)] + object SystemAcl + { + [DispId(10)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.IDispatch)] + get; + [DispId(10)] + [MethodImpl(MethodImplOptions.InternalCall)] + [param: MarshalAs(UnmanagedType.IDispatch)] + set; + } + + [DispId(11)] + bool SaclDefaulted + { + [DispId(11)] + [MethodImpl(MethodImplOptions.InternalCall)] + get; + [DispId(11)] + [MethodImpl(MethodImplOptions.InternalCall)] + set; + } + + [DispId(12)] + [MethodImpl(MethodImplOptions.InternalCall)] + [return: MarshalAs(UnmanagedType.IDispatch)] + object CopySecurityDescriptor(); + } +} diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs index f18641042e..5cc732f703 100644 --- a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs @@ -140,7 +140,7 @@ namespace System.DirectoryServices.Tests Assert.Throws(() => entry.CopyTo(disposedEntry, "newName")); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [ActiveIssue(21346, TargetFrameworkMonikers.UapAot)] public void DeleteTree_NoObject_ThrowsCOMException() { diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryServicesTests.Windows.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryServicesTests.Windows.cs new file mode 100644 index 0000000000..dada312bbf --- /dev/null +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryServicesTests.Windows.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Collections; +using Xunit; +using ActiveDirectoryComInterop; + +namespace System.DirectoryServices.Tests +{ + public partial class DirectoryServicesTests + { + [ConditionalFact(nameof(IsActiveDirectoryServer))] + public void TestComInterfaces() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "dateRoot"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "dateRoot", "Date OU")) + { + long deTime = GetTimeValue((IADsLargeInteger) de.Properties["uSNCreated"].Value); + long rootOUTime = GetTimeValue((IADsLargeInteger) rootOU.Properties["uSNCreated"].Value); + + // we are sure rootOU is created after de + Assert.True(rootOUTime > deTime); + + IADs iads = (IADs) rootOU.NativeObject; + Assert.Equal("ou=dateRoot", iads.Name); + Assert.Equal("Class", iads.Class); + Assert.True(iads.ADsPath.IndexOf(LdapConfiguration.Configuration.ServerName, StringComparison.OrdinalIgnoreCase) >= 0); + + IADsSecurityDescriptor iadsSD = (IADsSecurityDescriptor) de.Properties["ntSecurityDescriptor"].Value; + Assert.True(LdapConfiguration.Configuration.Domain.IndexOf(iadsSD.Owner.Split('\\')[0], StringComparison.OrdinalIgnoreCase) >= 0); + Assert.True(LdapConfiguration.Configuration.Domain.IndexOf(iadsSD.Group.Split('\\')[0], StringComparison.OrdinalIgnoreCase) >= 0); + } + } + finally + { + DeleteOU(de, "dateRoot"); + } + } + } + + private long GetTimeValue(IADsLargeInteger largeInteger) + { + return (long) largeInteger.LowPart | (long) (largeInteger.HighPart << 32); + } + } +} diff --git a/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryServicesTests.cs b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryServicesTests.cs new file mode 100644 index 0000000000..b358174d0a --- /dev/null +++ b/external/corefx/src/System.DirectoryServices/tests/System/DirectoryServices/DirectoryServicesTests.cs @@ -0,0 +1,648 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Collections; +using Xunit; + +namespace System.DirectoryServices.Tests +{ + public partial class DirectoryServicesTests + { + internal static bool IsLdapConfigurationExist => LdapConfiguration.Configuration != null; + internal static bool IsActiveDirectoryServer => IsLdapConfigurationExist && LdapConfiguration.Configuration.IsActiveDirectoryServer; + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestOU() // adding and removing organization unit + { + using (DirectoryEntry de = CreateRootEntry()) + { + string ouName = "NetCoreDevs"; + + // ensure cleanup before doing the creation. + DeleteOU(de, ouName); + + CreateOU(de, ouName, ".Net Core Developers Unit"); + try + { + SearchOUByName(de, ouName); + } + finally + { + // Clean up the added ou + DeleteOU(de, ouName); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestOrganizationalRole() // adding and removing users to/from the ou + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "CoreFxRootOU"); + + using (DirectoryEntry rootOU = CreateOU(de, "CoreFxRootOU", "CoreFx Root OU")) + { + try + { + DirectoryEntry child1OU = CreateOU(rootOU, "CoreFxChild1OU", "CoreFx Child OU 1"); + DirectoryEntry child2OU = CreateOU(rootOU, "CoreFxChild2OU", "CoreFx Child OU 2"); + + CreateOrganizationalRole(child1OU, "user.ou1.1", "User 1 is in CoreFx ou 1", "1 111 111 1111"); + CreateOrganizationalRole(child1OU, "user.ou1.2", "User 2 is in CoreFx ou 1", "1 222 222 2222"); + + CreateOrganizationalRole(child2OU, "user.ou2.1", "User 1 is in CoreFx ou 2", "1 333 333 3333"); + CreateOrganizationalRole(child2OU, "user.ou2.2", "User 2 is in CoreFx ou 2", "1 333 333 3333"); + + // now let's search for the added data: + SearchOUByName(rootOU, "CoreFxChild1OU"); + SearchOUByName(rootOU, "CoreFxChild2OU"); + + SearchOrganizationalRole(child1OU, "user.ou1.1"); + SearchOrganizationalRole(child1OU, "user.ou1.2"); + + SearchOrganizationalRole(child2OU, "user.ou2.1"); + SearchOrganizationalRole(child2OU, "user.ou2.2"); + } + finally + { + // rootOU.DeleteTree(); doesn't work as getting "A protocol error occurred. (Exception from HRESULT: 0x80072021)" + DeleteOU(de, "CoreFxRootOU"); + } + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestPropertyCaching() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "CachingOU"); + + using (DirectoryEntry rootOU = CreateOU(de, "CachingOU", "Caching OU")) + { + try + { + using (DirectoryEntry userEntry = CreateOrganizationalRole(rootOU, "caching.user.1", "User 1 in caching OU", "1 111 111 1111")) + { + Assert.True(userEntry.UsePropertyCache); + + SearchOrganizationalRole(rootOU, "caching.user.1"); + string originalPhone = (string) userEntry.Properties["telephoneNumber"].Value; + string newPhone = "1 222 222 2222"; + userEntry.Properties["telephoneNumber"].Value = newPhone; + + using (DirectoryEntry sameUserEntry = GetOrganizationalRole(rootOU, "caching.user.1")) + { + Assert.Equal(originalPhone, (string) sameUserEntry.Properties["telephoneNumber"].Value); + } + + userEntry.CommitChanges(); + + using (DirectoryEntry sameUserEntry = GetOrganizationalRole(rootOU, "caching.user.1")) + { + Assert.Equal(newPhone, (string) sameUserEntry.Properties["telephoneNumber"].Value); + } + + userEntry.UsePropertyCache = false; + Assert.False(userEntry.UsePropertyCache); + + userEntry.Properties["telephoneNumber"].Value = originalPhone; + using (DirectoryEntry sameUserEntry = GetOrganizationalRole(rootOU, "caching.user.1")) + { + Assert.Equal(originalPhone, (string) sameUserEntry.Properties["telephoneNumber"].Value); + } + } + } + finally + { + DeleteOU(de, "CachingOU"); + } + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestMoveTo() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "MoveingOU"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "MoveingOU", "Moving Root OU")) + { + using (DirectoryEntry fromOU = CreateOU(rootOU, "MoveFromOU", "Moving From OU")) + using (DirectoryEntry toOU = CreateOU(rootOU, "MoveToOU", "Moving To OU")) + { + DirectoryEntry user = CreateOrganizationalRole(fromOU, "user.move.1", "User to move across OU's", "1 111 111 1111"); + SearchOrganizationalRole(fromOU, "user.move.1"); + + user.MoveTo(toOU); + user.CommitChanges(); + + SearchOrganizationalRole(toOU, "user.move.1"); + Assert.Throws(() => SearchOrganizationalRole(fromOU, "user.move.1")); + + user.MoveTo(fromOU, "cn=user.moved.1"); + user.CommitChanges(); + + SearchOrganizationalRole(fromOU, "user.moved.1"); + + Assert.Throws(() => SearchOrganizationalRole(fromOU, "user.move.1")); + Assert.Throws(() => SearchOrganizationalRole(toOU, "user.move.1")); + Assert.Throws(() => user.MoveTo(toOU, "user.move.2")); + } + } + } + finally + { + DeleteOU(de, "MoveingOU"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestCopyTo() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "CopyingOU"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "CopyingOU", "Copying Root OU")) + { + using (DirectoryEntry fromOU = CreateOU(rootOU, "CopyFromOU", "Copying From OU")) + using (DirectoryEntry toOU = CreateOU(rootOU, "CopyToOU", "Copying To OU")) + { + DirectoryEntry user = CreateOrganizationalRole(fromOU, "user.move.1", "User to copy across OU's", "1 111 111 1111"); + SearchOrganizationalRole(fromOU, "user.move.1"); + + // The Lightweight Directory Access Protocol (LDAP) provider does not currently support the CopyTo(DirectoryEntry) method. + Assert.Throws(() => user.CopyTo(toOU)); + Assert.Throws(() => user.CopyTo(toOU, "user.move.2")); + } + } + } + finally + { + DeleteOU(de, "CopyingOU"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestRename() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "RenamingOU"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "RenamingOU", "Renaming Root OU")) + { + DirectoryEntry user = CreateOrganizationalRole(rootOU, "user.before.rename", "User to rename", "1 111 111 1111"); + SearchOrganizationalRole(rootOU, "user.before.rename"); + + + user.Rename("cn=user.after.rename"); + user.CommitChanges(); + + Assert.Throws(() => SearchOrganizationalRole(rootOU, "user.before.rename")); + + SearchOrganizationalRole(rootOU, "user.after.rename"); + + Assert.Throws(() => user.Rename("user.after.after.rename")); + } + } + finally + { + DeleteOU(de, "RenamingOU"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestParent() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "GrandParent"); + + try + { + using (DirectoryEntry grandOU = CreateOU(de, "GrandParent", "Grand Parent OU")) + using (DirectoryEntry parentOU = CreateOU(grandOU, "Parent", "Parent OU")) + using (DirectoryEntry childOU = CreateOU(parentOU, "Child", "Child OU")) + { + SearchOUByName(de, "GrandParent"); + SearchOUByName(grandOU, "Parent"); + SearchOUByName(parentOU, "Child"); + + Assert.Equal(de.Name, grandOU.Parent.Name); + Assert.Equal(grandOU.Name, parentOU.Parent.Name); + Assert.Equal(parentOU.Name, childOU.Parent.Name); + } + } + finally + { + DeleteOU(de, "GrandParent"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestDeleteTree() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "RootToDelete"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "RootToDelete", "Root OU")) + using (DirectoryEntry childOU = CreateOU(rootOU, "Child1", "Root Child 1 OU")) + using (DirectoryEntry anotherChildOU = CreateOU(rootOU, "Child2", "Root Child 2 OU")) + using (DirectoryEntry grandChildOU = CreateOU(childOU, "GrandChild", "Grand Child OU")) + using (DirectoryEntry user1 = CreateOrganizationalRole(grandChildOU, "user.grandChild.1", "Grand Child User", "1 111 111 1111")) + using (DirectoryEntry user2 = CreateOrganizationalRole(grandChildOU, "user.grandChild.2", "Grand Child User", "1 222 222 2222")) + { + SearchOUByName(de, "RootToDelete"); + SearchOUByName(rootOU, "Child1"); + SearchOUByName(rootOU, "Child2"); + SearchOUByName(childOU, "GrandChild"); + SearchOrganizationalRole(grandChildOU, "user.grandChild.1"); + + if (LdapConfiguration.Configuration.IsActiveDirectoryServer) + { + rootOU.DeleteTree(); + + Assert.Throws(() => SearchOUByName(de, "RootToDelete")); + Assert.Throws(() => SearchOUByName(rootOU, "Child1")); + Assert.Throws(() => SearchOUByName(rootOU, "Child2")); + Assert.Throws(() => SearchOUByName(childOU, "GrandChild")); + Assert.Throws(() => SearchOrganizationalRole(grandChildOU, "user.grandChild.1")); + } + else + { + // on non Active Directory Servers, DeleteTree() throws DirectoryServicesCOMException : A protocol error occurred. (Exception from HRESULT: 0x80072021) + Assert.Throws(() => rootOU.DeleteTree()); + } + } + } + finally + { + DeleteOU(de, "RootToDelete"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestInvalidServerPath() + { + using (DirectoryEntry de = new DirectoryEntry("SomeWrongPath")) + { + Assert.Throws(() => { foreach (var e in de.Children) {} } ); + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.Filter = $"(objectClass=*)"; + Assert.Throws(() => ds.FindAll() ); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestMissingUserAndPasswordInfo() + { + using (DirectoryEntry de = new DirectoryEntry(LdapConfiguration.Configuration.LdapPath)) + { + CheckSpecificException(() => { foreach (var e in de.Children) {} } ); + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.Filter = $"(objectClass=*)"; + CheckSpecificException(() => ds.FindAll()); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestInvalidUserAndPassword() + { + using (DirectoryEntry de = new DirectoryEntry(LdapConfiguration.Configuration.LdapPath, "wrongUser", "wrongPassword")) + { + CheckSpecificException(() => { foreach (var e in de.Children) {} }); + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.Filter = $"(objectClass=*)"; + CheckSpecificException(() => ds.FindAll() ); + } + } + + using (DirectoryEntry de = new DirectoryEntry( + LdapConfiguration.Configuration.LdapPath, + LdapConfiguration.Configuration.UserName, + "wrongPassword" + )) + { + CheckSpecificException(() => { foreach (var e in de.Children) {} } ); + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.Filter = $"(objectClass=*)"; + CheckSpecificException(() => ds.FindAll() ); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestInvalidSearchFilter() + { + using (DirectoryEntry de = new DirectoryEntry( + LdapConfiguration.Configuration.LdapPath, + LdapConfiguration.Configuration.UserName, + "wrongPassword" + )) + { + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.Filter = $"(objectClass=*))"; // invalid search filter + CheckSpecificException(() => ds.FindOne() ); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestUnAllowedProperty() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "NegativeRoot"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "NegativeRoot", "Negative Test Root OU")) + { + DirectoryEntry entry = rootOU.Children.Add($"cn=MyNamedObject","Class"); + entry.Properties["objectClass"].Value = "namedObject"; + entry.Properties["cn"].Value = "MyNamedObject"; + entry.Properties["description"].Value = "description"; // description is not allowed in the schema + Assert.Throws(() => entry.CommitChanges()); + } + } + finally + { + DeleteOU(de, "NegativeRoot"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestSearch() + { + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "SearchRoot"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "SearchRoot", "Root OU")) + using (DirectoryEntry childOU = CreateOU(rootOU, "Search.Child1", "Root Child 1 OU")) + using (DirectoryEntry anotherChildOU = CreateOU(rootOU, "Search.Child2", "Root Child 2 OU")) + using (DirectoryEntry grandChildOU = CreateOU(childOU, "Search.GrandChild", "Grand Child OU")) + using (DirectoryEntry user1 = CreateOrganizationalRole(grandChildOU, "user.search.grandChild.1", "Grand Child User", "1 111 111 1111")) + using (DirectoryEntry user2 = CreateOrganizationalRole(grandChildOU, "user.search.grandChild.2", "Grand Child User", "1 222 222 2222")) + { + user1.Properties["postalCode"].Value = 98052; + user1.Properties["postalAddress"].Value = "12345 SE 1st Street, City1, State1"; + user1.CommitChanges(); + + user2.Properties["postalCode"].Value = 98088; + user2.Properties["postalAddress"].Value = "67890 SE 2nd Street, City2, State2"; + user2.CommitChanges(); + + using (DirectorySearcher ds = new DirectorySearcher(rootOU)) + { + ds.ClientTimeout = new TimeSpan(0, 2, 0); + ds.Filter = "(objectClass=organizationalUnit)"; + Assert.Equal(4, ds.FindAll().Count); + + ds.Filter = "(objectClass=organizationalRole)"; + Assert.Equal(2, ds.FindAll().Count); + + ds.Filter = "(ou=SearchRoot)"; + Assert.Equal(1, ds.FindAll().Count); + + ds.Filter = "(ou=Search.Child1)"; + Assert.Equal(1, ds.FindAll().Count); + + ds.Filter = "(ou=Search.Child2)"; + Assert.Equal(1, ds.FindAll().Count); + + ds.Filter = "(ou=Search.GrandChild)"; + Assert.Equal(1, ds.FindAll().Count); + + ds.Filter = "(description=Grand Child OU)"; + Assert.Equal(1, ds.FindAll().Count); + + ds.Filter = "(description=*)"; + Assert.Equal(6, ds.FindAll().Count); + + ds.Filter = "(&(description=*)(objectClass=organizationalUnit))"; + Assert.Equal(4, ds.FindAll().Count); + + ds.Filter = "(&(description=*)(objectClass=organizationalRole))"; + Assert.Equal(2, ds.FindAll().Count); + + ds.Filter = "(&(description=No Description)(objectClass=organizationalRole))"; + Assert.Equal(0, ds.FindAll().Count); + + ds.Filter = "(postalCode=*)"; + Assert.Equal(2, ds.FindAll().Count); + + ds.Filter = "(postalCode=98052)"; + Assert.Equal(1, ds.FindAll().Count); + SearchResult sr = ds.FindOne(); + Assert.Equal("98052", sr.Properties["postalCode"][0]); + + ds.Filter = "(postalCode=98088)"; + Assert.Equal(1, ds.FindAll().Count); + sr = ds.FindOne(); + Assert.Equal("98088", sr.Properties["postalCode"][0]); + } + } + } + finally + { + DeleteOU(de, "SearchRoot"); + } + } + } + + [ConditionalFact(nameof(IsLdapConfigurationExist))] + public void TestAttributesWithDifferentTypes() + { + // Windows server looks not supporting extensibleObject. + // It throw exception with the message "The specified directory service attribute or value does not exist." + if (IsActiveDirectoryServer) + return; + + using (DirectoryEntry de = CreateRootEntry()) + { + DeleteOU(de, "AttributesRoot"); + + try + { + using (DirectoryEntry rootOU = CreateOU(de, "AttributesRoot", "Attributes Root OU")) + { + DirectoryEntry cnEntry = rootOU.Children.Add($"cn=CustomUser","Class"); + cnEntry.Properties["objectClass"].Value = new string [] { "extensibleObject", "organizationalRole" }; + cnEntry.Properties["cn"].Value = "CustomUser"; + cnEntry.Properties["description"].Value = "Some Custom User"; + cnEntry.Properties["telephoneNumber"].Value = "1 111 111 11111"; + cnEntry.Properties["changeNumber"].Value = 101; + cnEntry.Properties["deleteOldRDN"].Value = true; + cnEntry.CommitChanges(); + + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.ClientTimeout = new TimeSpan(0, 2, 0); + ds.Filter = $"(cn=CustomUser)"; + SearchResult sr = ds.FindOne(); + if (sr == null) + { + throw new DirectoryServicesCOMException($"Couldn't find CustomUser in the entry {de.Name}"); + } + Assert.Equal(true, sr.Properties["deleteOldRDN"][0]); + Assert.Equal(101, sr.Properties["changeNumber"][0]); + Assert.Equal("Some Custom User", sr.Properties["description"][0]); + Assert.Equal("1 111 111 11111", sr.Properties["telephoneNumber"][0]); + } + } + } + finally + { + DeleteOU(de, "AttributesRoot"); + } + } + } + + private void CheckSpecificException(Action blockToExecute) + { + Exception exception = Record.Exception(blockToExecute); + Assert.NotNull(exception); + + if (IsActiveDirectoryServer) + Assert.IsType(exception); + else + Assert.IsType(exception); + } + + private DirectoryEntry CreateOU(DirectoryEntry de, string ou, string description) + { + DirectoryEntry ouCoreDevs = de.Children.Add($"ou={ou}","Class"); + ouCoreDevs.Properties["objectClass"].Value = "organizationalUnit"; // has to be organizationalUnit + ouCoreDevs.Properties["description"].Value = description; + ouCoreDevs.Properties["ou"].Value = ou; + ouCoreDevs.CommitChanges(); + return ouCoreDevs; + } + + private DirectoryEntry CreateOrganizationalRole(DirectoryEntry ouEntry, string cn, string description, string phone) + { + DirectoryEntry cnEntry = ouEntry.Children.Add($"cn={cn}","Class"); + cnEntry.Properties["objectClass"].Value = "organizationalRole"; + cnEntry.Properties["cn"].Value = cn; + cnEntry.Properties["description"].Value = description; + cnEntry.Properties["ou"].Value = ouEntry.Name; + cnEntry.Properties["telephoneNumber"].Value = phone; + cnEntry.CommitChanges(); + return cnEntry; + } + + private void DeleteOU(DirectoryEntry parentDe, string ou) + { + try + { + // We didn't use DirectoryEntry.DeleteTree as it fails on OpenDJ with "A protocol error occurred. (Exception from HRESULT: 0x80072021)" + // Also on AD servers DirectoryEntry.Children.Remove(de) will fail if the de is not a leaf entry. so we had to do it recursively. + DirectoryEntry de = parentDe.Children.Find($"ou={ou}"); + DeleteDirectoryEntry(parentDe, de); + } + catch + { + // ignore the error if the test failed early and couldn't create the OU we are trying to delete + } + } + + private void DeleteDirectoryEntry(DirectoryEntry parent, DirectoryEntry de) + { + foreach (DirectoryEntry child in de.Children) + { + DeleteDirectoryEntry(de, child); + } + + parent.Children.Remove(de); + parent.CommitChanges(); + } + + private void SearchOUByName(DirectoryEntry de, string ouName) + { + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.ClientTimeout = new TimeSpan(0, 2, 0); + ds.Filter = $"(&(objectClass=organizationalUnit)(ou={ouName}))"; + ds.PropertiesToLoad.Add("ou"); + SearchResult sr = ds.FindOne(); + if (sr == null) + { + throw new DirectoryServicesCOMException($"Couldn't find {ouName} in the entry {de.Name}"); + } + Assert.Equal(ouName, sr.Properties["ou"][0]); + } + } + + private void SearchOrganizationalRole(DirectoryEntry de, string cnName) + { + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.ClientTimeout = new TimeSpan(0, 2, 0); + ds.Filter = $"(&(objectClass=organizationalRole)(cn={cnName}))"; + ds.PropertiesToLoad.Add("cn"); + SearchResult sr = ds.FindOne(); + + if (sr == null) + { + throw new DirectoryServicesCOMException($"Couldn't find {cnName} in the entry {de.Name}"); + } + + Assert.Equal(cnName, sr.Properties["cn"][0]); + } + } + + private DirectoryEntry GetOrganizationalRole(DirectoryEntry de, string cnName) + { + using (DirectorySearcher ds = new DirectorySearcher(de)) + { + ds.ClientTimeout = new TimeSpan(0, 2, 0); + ds.Filter = $"(&(objectClass=organizationalRole)(cn={cnName}))"; + ds.PropertiesToLoad.Add("cn"); + SearchResult sr = ds.FindOne(); + return sr.GetDirectoryEntry(); + } + } + + private DirectoryEntry CreateRootEntry() + { + return new DirectoryEntry(LdapConfiguration.Configuration.LdapPath, + LdapConfiguration.Configuration.UserName, + LdapConfiguration.Configuration.Password, + LdapConfiguration.Configuration.AuthenticationTypes); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/System.Drawing.Common.sln b/external/corefx/src/System.Drawing.Common/System.Drawing.Common.sln index e28fde2290..bdc9c7a707 100644 --- a/external/corefx/src/System.Drawing.Common/System.Drawing.Common.sln +++ b/external/corefx/src/System.Drawing.Common/System.Drawing.Common.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26911.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Drawing.Common.Tests", "tests\System.Drawing.Common.Tests.csproj", "{4B93E684-0630-45F4-8F63-6C7788C9892F}" ProjectSection(ProjectDependencies) = postProject @@ -26,18 +26,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4B93E684-0630-45F4-8F63-6C7788C9892F}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {4B93E684-0630-45F4-8F63-6C7788C9892F}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {4B93E684-0630-45F4-8F63-6C7788C9892F}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {4B93E684-0630-45F4-8F63-6C7788C9892F}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU - {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU - {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU - {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU - {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU - {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {4B93E684-0630-45F4-8F63-6C7788C9892F}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {4B93E684-0630-45F4-8F63-6C7788C9892F}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {4B93E684-0630-45F4-8F63-6C7788C9892F}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {4B93E684-0630-45F4-8F63-6C7788C9892F}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Debug|Any CPU.ActiveCfg = netcoreapp2.0-Windows_NT-Debug|Any CPU + {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Debug|Any CPU.Build.0 = netcoreapp2.0-Windows_NT-Debug|Any CPU + {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Release|Any CPU.ActiveCfg = netcoreapp2.0-Unix-Release|Any CPU + {191B3618-FECD-4ABD-9D6B-5AC90DC33621}.Release|Any CPU.Build.0 = netcoreapp2.0-Unix-Release|Any CPU + {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Debug|Any CPU.ActiveCfg = netcoreapp2.0-Debug|Any CPU + {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Debug|Any CPU.Build.0 = netcoreapp2.0-Debug|Any CPU + {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Release|Any CPU.ActiveCfg = netcoreapp2.0-Release|Any CPU + {D7AEA698-275D-441F-B7A7-8491D1F0EFF0}.Release|Any CPU.Build.0 = netcoreapp2.0-Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -47,4 +47,7 @@ Global {191B3618-FECD-4ABD-9D6B-5AC90DC33621} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} {D7AEA698-275D-441F-B7A7-8491D1F0EFF0} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ACBCC0AB-54DC-4B76-9556-2569EF381DFB} + EndGlobalSection EndGlobal diff --git a/external/corefx/src/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj b/external/corefx/src/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj new file mode 100644 index 0000000000..97ada23e30 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj @@ -0,0 +1,11 @@ + + + + + + netcoreapp2.0 + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/ref/Configurations.props b/external/corefx/src/System.Drawing.Common/ref/Configurations.props index 2845c11c54..01894f79b9 100644 --- a/external/corefx/src/System.Drawing.Common/ref/Configurations.props +++ b/external/corefx/src/System.Drawing.Common/ref/Configurations.props @@ -2,7 +2,7 @@ - netcoreapp; + netcoreapp2.0; \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.cs.REMOVED.git-id index fe8428d46f..56728782a5 100644 --- a/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.cs.REMOVED.git-id +++ b/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.cs.REMOVED.git-id @@ -1 +1 @@ -95dc5c6b7e3c796270769eb3528d3280910541ba \ No newline at end of file +2d6b0ae7dae22a18a349995df2ad777b9922f9ac \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.csproj b/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.csproj index 95030c06a4..d8daf77d79 100644 --- a/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.csproj +++ b/external/corefx/src/System.Drawing.Common/ref/System.Drawing.Common.csproj @@ -4,20 +4,20 @@ {D7AEA698-275D-441F-B7A7-8491D1F0EFF0} - - + + - - - - - - - - + + + + + + + + - \ No newline at end of file + diff --git a/external/corefx/src/System.Drawing.Common/src/Configurations.props b/external/corefx/src/System.Drawing.Common/src/Configurations.props index de40e021ab..85b3fdbbf8 100644 --- a/external/corefx/src/System.Drawing.Common/src/Configurations.props +++ b/external/corefx/src/System.Drawing.Common/src/Configurations.props @@ -2,7 +2,8 @@ - netcoreapp-Windows_NT; + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; diff --git a/external/corefx/src/System.Drawing.Common/src/MonoTODOAttribute.cs b/external/corefx/src/System.Drawing.Common/src/MonoTODOAttribute.cs new file mode 100644 index 0000000000..a8193e7b0e --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/MonoTODOAttribute.cs @@ -0,0 +1,114 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// MonoTODOAttribute.cs +// +// Authors: +// Ravi Pratap (ravi@ximian.com) +// Eyal Alaluf +// +// (C) Ximian, Inc. http://www.ximian.com +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (C) 2006 Mainsoft, Inc (http://www.mainsoft.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.Diagnostics; + +namespace System +{ +#pragma warning disable 436 + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + [Conditional("MONO")] + internal class MonoTODOAttribute : Attribute + { + + string comment; + + public MonoTODOAttribute() + { + } + + public MonoTODOAttribute(string comment) + { + this.comment = comment; + } + + public string Comment + { + get { return comment; } + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + internal class MonoDocumentationNoteAttribute : MonoTODOAttribute + { + + public MonoDocumentationNoteAttribute(string comment) + : base(comment) + { + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + internal class MonoExtensionAttribute : MonoTODOAttribute + { + + public MonoExtensionAttribute(string comment) + : base(comment) + { + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + internal class MonoInternalNoteAttribute : MonoTODOAttribute + { + + public MonoInternalNoteAttribute(string comment) + : base(comment) + { + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + internal class MonoLimitationAttribute : MonoTODOAttribute + { + + public MonoLimitationAttribute(string comment) + : base(comment) + { + } + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + internal class MonoNotSupportedAttribute : MonoTODOAttribute + { + + public MonoNotSupportedAttribute(string comment) + : base(comment) + { + } + } +#pragma warning restore 436 +} diff --git a/external/corefx/src/System.Drawing.Common/src/Resources/Strings.resx b/external/corefx/src/System.Drawing.Common/src/Resources/Strings.resx index d028b8457e..61918c3fe8 100644 --- a/external/corefx/src/System.Drawing.Common/src/Resources/Strings.resx +++ b/external/corefx/src/System.Drawing.Common/src/Resources/Strings.resx @@ -1,5 +1,64 @@ + @@ -58,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + (printer name protected due to security restrictions) @@ -331,4 +390,19 @@ {0} is not a valid value for {1}. + + Invalid Blend object. It should have at least 2 elements in each of the factors and positions arrays. + + + Invalid Blend object. The positions array must have 0.0 as its first element. + + + Invalid Blend object. The positions array must have 1.0 as its last element. + + + Unable to load DLL '{0}': The specified module could not be found. + + + Unable to find an entry point named '{0}' in DLL '{1}'. + \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/Resources/System/Drawing/Error.ico b/external/corefx/src/System.Drawing.Common/src/Resources/System/Drawing/Error.ico new file mode 100644 index 0000000000..8648d511f4 Binary files /dev/null and b/external/corefx/src/System.Drawing.Common/src/Resources/System/Drawing/Error.ico differ diff --git a/external/corefx/src/System.Drawing.Common/src/System.Drawing.Common.csproj b/external/corefx/src/System.Drawing.Common/src/System.Drawing.Common.csproj index 550bfc14fa..e96c9dddc0 100644 --- a/external/corefx/src/System.Drawing.Common/src/System.Drawing.Common.csproj +++ b/external/corefx/src/System.Drawing.Common/src/System.Drawing.Common.csproj @@ -3,7 +3,6 @@ Library - System.Drawing {191B3618-FECD-4ABD-9D6B-5AC90DC33621} $(DefineConstants);DRAWING_NAMESPACE true @@ -11,15 +10,17 @@ false CS0618 $(DefineConstants);FEATURE_WINDOWS_SYSTEM_COLORS + $(DefineConstants);CORECLR;NETCORE - - + + + + - @@ -31,30 +32,43 @@ + + - - - - + + - - - - - + - - + + + + + + + + + + + + + + + + + + + + - @@ -62,24 +76,19 @@ - - - - - - + - + @@ -88,128 +97,159 @@ - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + - - - - - - - - Component - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - + + + + + + + + + + System\Drawing\ColorConverterCommon.cs + + + System\Drawing\ColorTable.cs + + + System\Drawing\ColorUtil.netcoreapp20.cs + + + System\Drawing\KnownColor.cs + + + System\Drawing\KnownColorTable.cs + + + Common\System\Runtime\InteropServices\FunctionWrapper.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Component + + + + + + + + + - - - + - @@ -222,25 +262,90 @@ - + + Common\System\Numerics\Hashing\HashHelpers.cs + Common\Interop\Windows\Interop.Libraries.cs + + Common\Interop\Windows\kernel32\Interop.FreeLibrary.cs + + + Common\Interop\Windows\kernel32\Interop.LoadLibraryEx.cs + + + Common\Interop\Windows\kernel32\Interop.GetProcAddress.cs + Common\Interop\Windows\user32\Interop.GetSysColor.cs Common\Interop\Windows\user32\Interop.Win32SystemColors.cs - - System\Drawing\ColorConverterCommon.cs + + Common\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs - - System\Drawing\ColorTable.cs + + Common\System\Runtime\InteropServices\FunctionWrapper.Windows.cs - - System\Drawing\KnownColorTable.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Common\Interop\Unix\Interop.Libraries.cs + + + Common\Interop\Unix\libdl\Interop.dlopen.cs + + + Common\Interop\Unix\libdl\Interop.dlsym.cs + + + Common\System\Runtime\InteropServices\FunctionWrapper.Unix.cs @@ -251,6 +356,9 @@ System.Drawing.ShieldIcon.ico + + placeholder.ico + - \ No newline at end of file + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.Unix.cs new file mode 100644 index 0000000000..5c6707c9ae --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.Unix.cs @@ -0,0 +1,322 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Bitmap.cs +// +// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004 Novell, Inc. http://www.novell.com +// +// Authors: +// Alexandre Pigolkine (pigolkine@gmx.de) +// Christian Meyer (Christian.Meyer@cs.tum.edu) +// Miguel de Icaza (miguel@ximian.com) +// Jordi Mas i Hernandez (jmas@softcatala.org) +// Ravindra (rkumar@novell.com) +// + +// +// Copyright (C) 2004-2005 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.IO; +using System.Drawing.Imaging; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace System.Drawing +{ + [ComVisible(true)] + [Serializable] +#if !NETCORE + [Editor ("System.Drawing.Design.BitmapEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] +#endif + public sealed class Bitmap : Image + { + #region constructors + // constructors + + // required for XmlSerializer (#323246) + private Bitmap() + { + } + + internal Bitmap(IntPtr ptr) + { + nativeObject = ptr; + } + + // Usually called when cloning images that need to have + // not only the handle saved, but also the underlying stream + // (when using MS GDI+ and IStream we must ensure the stream stays alive for all the life of the Image) + internal Bitmap(IntPtr ptr, Stream stream) + { + nativeObject = ptr; + } + + public Bitmap(int width, int height) : this(width, height, PixelFormat.Format32bppArgb) + { + } + + public Bitmap(int width, int height, Graphics g) + { + if (g == null) + throw new ArgumentNullException("g"); + + IntPtr bmp; + int s = SafeNativeMethods.Gdip.GdipCreateBitmapFromGraphics(width, height, g.nativeObject, out bmp); + SafeNativeMethods.Gdip.CheckStatus(s); + nativeObject = bmp; + } + + public Bitmap(int width, int height, PixelFormat format) + { + IntPtr bmp; + int s = SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(width, height, 0, format, IntPtr.Zero, out bmp); + SafeNativeMethods.Gdip.CheckStatus(s); + nativeObject = bmp; + + } + + public Bitmap(Image original) : this(original, original.Width, original.Height) { } + + public Bitmap(Stream stream) : this(stream, false) { } + + public Bitmap(string filename) : this(filename, false) { } + + public Bitmap(Image original, Size newSize) : this(original, newSize.Width, newSize.Height) { } + + public Bitmap(Stream stream, bool useIcm) + { + // false: stream is owned by user code + nativeObject = InitFromStream(stream); + } + + public Bitmap(string filename, bool useIcm) + { + if (filename == null) + throw new ArgumentNullException("filename"); + + IntPtr imagePtr; + int st; + + if (useIcm) + st = SafeNativeMethods.Gdip.GdipCreateBitmapFromFileICM(filename, out imagePtr); + else + st = SafeNativeMethods.Gdip.GdipCreateBitmapFromFile(filename, out imagePtr); + + SafeNativeMethods.Gdip.CheckStatus(st); + nativeObject = imagePtr; + } + + public Bitmap(Type type, string resource) + { + if (resource == null) + throw new ArgumentException("resource"); + + // For compatibility with the .NET Framework + if (type == null) + throw new NullReferenceException(); + + Stream s = type.GetTypeInfo().Assembly.GetManifestResourceStream(type, resource); + if (s == null) + { + string msg = string.Format("Resource '{0}' was not found.", resource); + throw new FileNotFoundException(msg); + } + + nativeObject = InitFromStream(s); + } + + public Bitmap(Image original, int width, int height) : this(width, height, PixelFormat.Format32bppArgb) + { + Graphics graphics = Graphics.FromImage(this); + + graphics.DrawImage(original, 0, 0, width, height); + graphics.Dispose(); + } + + public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0) + { + IntPtr bmp; + + int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(width, height, stride, format, scan0, out bmp); + SafeNativeMethods.Gdip.CheckStatus(status); + nativeObject = bmp; + } + + private Bitmap(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + #endregion + // methods + public Color GetPixel(int x, int y) + { + + int argb; + + int s = SafeNativeMethods.Gdip.GdipBitmapGetPixel(nativeObject, x, y, out argb); + SafeNativeMethods.Gdip.CheckStatus(s); + + return Color.FromArgb(argb); + } + + public void SetPixel(int x, int y, Color color) + { + int s = SafeNativeMethods.Gdip.GdipBitmapSetPixel(nativeObject, x, y, color.ToArgb()); + if (s == SafeNativeMethods.Gdip.InvalidParameter) + { + // check is done in case of an error only to avoid another + // unmanaged call for normal (successful) calls + if ((this.PixelFormat & PixelFormat.Indexed) != 0) + { + string msg = "SetPixel cannot be called on indexed bitmaps."; + throw new InvalidOperationException(msg); + } + } + SafeNativeMethods.Gdip.CheckStatus(s); + } + + public Bitmap Clone(Rectangle rect, PixelFormat format) + { + IntPtr bmp; + int status = SafeNativeMethods.Gdip.GdipCloneBitmapAreaI(rect.X, rect.Y, rect.Width, rect.Height, + format, nativeObject, out bmp); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Bitmap(bmp); + } + + public Bitmap Clone(RectangleF rect, PixelFormat format) + { + IntPtr bmp; + int status = SafeNativeMethods.Gdip.GdipCloneBitmapArea(rect.X, rect.Y, rect.Width, rect.Height, + format, nativeObject, out bmp); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Bitmap(bmp); + } + + public static Bitmap FromHicon(IntPtr hicon) + { + IntPtr bitmap; + int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromHICON(hicon, out bitmap); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Bitmap(bitmap); + } + + public static Bitmap FromResource(IntPtr hinstance, string bitmapName) //TODO: Untested + { + IntPtr bitmap; + int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromResource(hinstance, bitmapName, out bitmap); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Bitmap(bitmap); + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public IntPtr GetHbitmap() + { + return GetHbitmap(Color.Gray); + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public IntPtr GetHbitmap(Color background) + { + IntPtr HandleBmp; + + int status = SafeNativeMethods.Gdip.GdipCreateHBITMAPFromBitmap(nativeObject, out HandleBmp, background.ToArgb()); + SafeNativeMethods.Gdip.CheckStatus(status); + + return HandleBmp; + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public IntPtr GetHicon() + { + IntPtr HandleIcon; + + int status = SafeNativeMethods.Gdip.GdipCreateHICONFromBitmap(nativeObject, out HandleIcon); + SafeNativeMethods.Gdip.CheckStatus(status); + + return HandleIcon; + } + + public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format) + { + BitmapData result = new BitmapData(); + return LockBits(rect, flags, format, result); + } + + public + BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData) + { + int status = SafeNativeMethods.Gdip.GdipBitmapLockBits(nativeObject, ref rect, flags, format, bitmapData); + if (status == 7) + { + status = 8; // libgdiplus has the wrong error code mapping for this state. + } + //NOTE: scan0 points to piece of memory allocated in the unmanaged space + SafeNativeMethods.Gdip.CheckStatus(status); + + return bitmapData; + } + + public void MakeTransparent() + { + Color clr = GetPixel(0, 0); + MakeTransparent(clr); + } + + public void MakeTransparent(Color transparentColor) + { + // We have to draw always over a 32-bitmap surface that supports alpha channel + Bitmap bmp = new Bitmap(Width, Height, PixelFormat.Format32bppArgb); + Graphics gr = Graphics.FromImage(bmp); + Rectangle destRect = new Rectangle(0, 0, Width, Height); + ImageAttributes imageAttr = new ImageAttributes(); + + imageAttr.SetColorKey(transparentColor, transparentColor); + + gr.DrawImage(this, destRect, 0, 0, Width, Height, GraphicsUnit.Pixel, imageAttr); + + IntPtr oldBmp = nativeObject; + nativeObject = bmp.nativeObject; + bmp.nativeObject = oldBmp; + + gr.Dispose(); + bmp.Dispose(); + imageAttr.Dispose(); + } + + public void SetResolution(float xDpi, float yDpi) + { + int status = SafeNativeMethods.Gdip.GdipBitmapSetResolution(nativeObject, xDpi, yDpi); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void UnlockBits(BitmapData bitmapdata) + { + int status = SafeNativeMethods.Gdip.GdipBitmapUnlockBits(nativeObject, bitmapdata); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Bitmap.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs index d965609a91..303174d8f0 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs @@ -4,8 +4,6 @@ namespace System.Drawing { - using System.Configuration; - using System.Drawing.Configuration; using System.IO; using System.Reflection; @@ -27,19 +25,9 @@ namespace System.Drawing { get { - if (s_suffix == null) - { - s_suffix = string.Empty; - var section = ConfigurationManager.GetSection("system.drawing") as SystemDrawingSection; - if (section != null) - { - var value = section.BitmapSuffix; - if (value != null && value is string) - { - s_suffix = (string)value; - } - } - } + // NOTE: This value is read from the "SystemDrawingSection" of the ConfigurationManager on + // the .NET Framework. To avoid pulling in a direct dependency to that assembly, we are not + // reading the value in this implementation. return s_suffix; } set diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.Unix.cs new file mode 100644 index 0000000000..298aa8ea98 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.Unix.cs @@ -0,0 +1,121 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005 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. +// +// Authors: +// +// Jordi Mas i Hernadez +// +// + + +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; + +namespace System.Drawing +{ + public sealed class BufferedGraphics : IDisposable + { + private Rectangle size; + private Bitmap membmp = null; + private Graphics target = null; + private Graphics source = null; + + private BufferedGraphics() + { + + } + + internal BufferedGraphics(Graphics targetGraphics, Rectangle targetRectangle) + { + size = targetRectangle; + target = targetGraphics; + membmp = new Bitmap(size.Width, size.Height); + } + + ~BufferedGraphics() + { + Dispose(false); + } + + public Graphics Graphics + { + get + { + if (source == null) + { + source = Graphics.FromImage(membmp); + } + + return source; + } + } + + public void Dispose() + { + Dispose(true); + System.GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposing == false) + return; + + if (membmp != null) + { + membmp.Dispose(); + membmp = null; + } + + if (source != null) + { + source.Dispose(); + source = null; + } + + target = null; + } + + public void Render() + { + Render(target); + } + + public void Render(Graphics target) + { + if (target == null) + return; + + target.DrawImage(membmp, size); + } + + [MonoTODO("The targetDC parameter has no equivalent in libgdiplus.")] + public void Render(IntPtr targetDC) + { + throw new NotImplementedException(); + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.Windows.cs new file mode 100644 index 0000000000..c6068fb65b --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.Windows.cs @@ -0,0 +1,137 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + /// + /// The BufferedGraphics class can be thought of as a "Token" or "Reference" to the buffer that a + /// BufferedGraphicsContext creates. While a BufferedGraphics is outstanding, the memory associated with the + /// buffer is locked. The general design is such that under normal conditions a single BufferedGraphics will be in + /// use at one time for a given BufferedGraphicsContext. + /// + public sealed class BufferedGraphics : IDisposable + { + private Graphics _bufferedGraphicsSurface; + private readonly Graphics _targetGraphics; + private BufferedGraphicsContext _context; + private readonly IntPtr _targetDC; + private readonly Point _targetLoc; + private readonly Size _virtualSize; + private const int RasterOp = 0xcc0020; // RasterOp.SOURCE.GetRop(); + + /// + /// Internal constructor, this class is created by BufferedGraphicsContext. + /// + internal BufferedGraphics(Graphics bufferedGraphicsSurface, BufferedGraphicsContext context, Graphics targetGraphics, + IntPtr targetDC, Point targetLoc, Size virtualSize) + { + _context = context; + _bufferedGraphicsSurface = bufferedGraphicsSurface; + _targetDC = targetDC; + _targetGraphics = targetGraphics; + _targetLoc = targetLoc; + _virtualSize = virtualSize; + } + + ~BufferedGraphics() => Dispose(false); + + /// + /// Disposes the object and releases the lock on the memory. + /// + public void Dispose() => Dispose(true); + + private void Dispose(bool disposing) + { + if (disposing) + { + if (_context != null) + { + _context.ReleaseBuffer(this); + + if (DisposeContext) + { + _context.Dispose(); + _context = null; + } + } + + if (_bufferedGraphicsSurface != null) + { + _bufferedGraphicsSurface.Dispose(); + _bufferedGraphicsSurface = null; + } + } + } + + /// + /// Determines if we need to dispose of the Context when this is disposed + /// + internal bool DisposeContext { get; set; } + + /// + /// Allows access to the Graphics wrapper for the buffer. + /// + public Graphics Graphics => _bufferedGraphicsSurface; + + /// + /// Renders the buffer to the original graphics used to allocate the buffer. + /// + public void Render() + { + if (_targetGraphics != null) + { + Render(_targetGraphics); + } + else + { + RenderInternal(new HandleRef(Graphics, _targetDC), this); + } + } + + /// + /// Renders the buffer to the specified target graphics. + /// + public void Render(Graphics target) + { + if (target != null) + { + IntPtr targetDC = target.GetHdc(); + + try + { + RenderInternal(new HandleRef(target, targetDC), this); + } + finally + { + target.ReleaseHdcInternal(targetDC); + } + } + } + + /// + /// Renders the buffer to the specified target HDC. + /// + public void Render(IntPtr targetDC) => RenderInternal(new HandleRef(null, targetDC), this); + + /// + /// Internal method that renders the specified buffer into the target. + /// + private void RenderInternal(HandleRef refTargetDC, BufferedGraphics buffer) + { + IntPtr sourceDC = buffer.Graphics.GetHdc(); + + try + { + SafeNativeMethods.BitBlt(refTargetDC, _targetLoc.X, _targetLoc.Y, _virtualSize.Width, _virtualSize.Height, + new HandleRef(buffer.Graphics, sourceDC), 0, 0, RasterOp); + } + finally + { + buffer.Graphics.ReleaseHdcInternal(sourceDC); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs deleted file mode 100644 index 9c22bd1e80..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; - -namespace System.Drawing -{ - /// - /// The BufferedGraphics class can be thought of as a "Token" or "Reference" to the buffer that a - /// BufferedGraphicsContext creates. While a BufferedGraphics is outstanding, the memory associated with the - /// buffer is locked. The general designis such that under normal conditions a single BufferedGraphics will be in - /// use at one time for a given BufferedGraphicsContext. - /// - public sealed class BufferedGraphics : IDisposable - { - private Graphics _bufferedGraphicsSurface; - private readonly Graphics _targetGraphics; - private BufferedGraphicsContext _context; - private readonly IntPtr _targetDC; - private readonly Point _targetLoc; - private readonly Size _virtualSize; - private const int RasterOp = 0xcc0020; // RasterOp.SOURCE.GetRop(); - - /// - /// Internal constructor, this class is created by BufferedGraphicsContext. - /// - internal BufferedGraphics(Graphics bufferedGraphicsSurface, BufferedGraphicsContext context, Graphics targetGraphics, - IntPtr targetDC, Point targetLoc, Size virtualSize) - { - _context = context; - _bufferedGraphicsSurface = bufferedGraphicsSurface; - _targetDC = targetDC; - _targetGraphics = targetGraphics; - _targetLoc = targetLoc; - _virtualSize = virtualSize; - } - - ~BufferedGraphics() => Dispose(false); - - /// - /// Disposes the object and releases the lock on the memory. - /// - public void Dispose() => Dispose(true); - - private void Dispose(bool disposing) - { - if (disposing) - { - if (_context != null) - { - _context.ReleaseBuffer(this); - - if (DisposeContext) - { - _context.Dispose(); - _context = null; - } - } - - if (_bufferedGraphicsSurface != null) - { - _bufferedGraphicsSurface.Dispose(); - _bufferedGraphicsSurface = null; - } - } - } - - /// - /// Determines if we need to dispose of the Context when this is disposed - /// - internal bool DisposeContext { get; set; } - - /// - /// Allows access to the Graphics wrapper for the buffer. - /// - public Graphics Graphics => _bufferedGraphicsSurface; - - /// - /// Renders the buffer to the original graphics used to allocate the buffer. - /// - public void Render() - { - if (_targetGraphics != null) - { - Render(_targetGraphics); - } - else - { - RenderInternal(new HandleRef(Graphics, _targetDC), this); - } - } - - /// - /// Renders the buffer to the specified target graphics. - /// - public void Render(Graphics target) - { - if (target != null) - { - IntPtr targetDC = target.GetHdc(); - - try - { - RenderInternal(new HandleRef(target, targetDC), this); - } - finally - { - target.ReleaseHdcInternal(targetDC); - } - } - } - - /// - /// Renders the buffer to the specified target HDC. - /// - public void Render(IntPtr targetDC) => RenderInternal(new HandleRef(null, targetDC), this); - - /// - /// Internal method that renders the specified buffer into the target. - /// - private void RenderInternal(HandleRef refTargetDC, BufferedGraphics buffer) - { - IntPtr sourceDC = buffer.Graphics.GetHdc(); - - try - { - SafeNativeMethods.BitBlt(refTargetDC, _targetLoc.X, _targetLoc.Y, _virtualSize.Width, _virtualSize.Height, - new HandleRef(buffer.Graphics, sourceDC), 0, 0, RasterOp); - } - finally - { - buffer.Graphics.ReleaseHdcInternal(sourceDC); - } - } - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Unix.cs new file mode 100644 index 0000000000..de0d434af8 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Unix.cs @@ -0,0 +1,90 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005 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. +// +// Authors: +// +// Jordi Mas i Hernandez +// +// + + +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; + +namespace System.Drawing +{ + public sealed class BufferedGraphicsContext : IDisposable + { + private Size max_buffer; + + public BufferedGraphicsContext() + { + max_buffer = Size.Empty; + } + +#if !NETCORE + ~BufferedGraphicsContext () + { + } +#endif + + public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle targetRectangle) + { + BufferedGraphics graphics = new BufferedGraphics(targetGraphics, targetRectangle); + return graphics; + } + + [MonoTODO("The targetDC parameter has no equivalent in libgdiplus.")] + public BufferedGraphics Allocate(IntPtr targetDC, Rectangle targetRectangle) + { + throw new NotImplementedException(); + } + + public void Dispose() + { + System.GC.SuppressFinalize(this); + } + + public void Invalidate() + { + } + + public Size MaximumBuffer + { + get { return max_buffer; } + set + { + if (value.Width <= 0 || value.Height <= 0) + { + throw new ArgumentException("The height or width of the size is less than or equal to zero."); + } + + max_buffer = value; + } + } + + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs new file mode 100644 index 0000000000..6d53c5db87 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs @@ -0,0 +1,629 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using System.Threading; + +namespace System.Drawing +{ + /// + /// The BufferedGraphicsContext class can be used to perform standard double buffer rendering techniques. + /// + public sealed class BufferedGraphicsContext : IDisposable + { + private Size _maximumBuffer; + private Size _bufferSize; + private Size _virtualSize; + private Point _targetLoc; + private IntPtr _compatDC; + private IntPtr _dib; + private IntPtr _oldBitmap; + private Graphics _compatGraphics; + private BufferedGraphics _buffer; + private int _busy; + private bool _invalidateWhenFree; + + private const int BufferFree = 0; // The graphics buffer is free to use. + private const int BufferBusyPainting = 1; // The graphics buffer is busy being created/painting. + private const int BufferBusyDisposing = 2; // The graphics buffer is busy disposing. + + private static TraceSwitch s_doubleBuffering; + +#if DEBUG + private string _stackAtBusy; +#endif + + /// + /// Basic constructor. + /// + public BufferedGraphicsContext() + { + // By defualt, the size of our maxbuffer will be 3 x standard button size. + _maximumBuffer.Width = 75 * 3; + _maximumBuffer.Height = 32 * 3; + + _bufferSize = Size.Empty; + } + + ~BufferedGraphicsContext() => Dispose(false); + + /// + /// Internal trace switch for debugging + /// + internal static TraceSwitch DoubleBuffering + { + get + { + if (s_doubleBuffering == null) + { + s_doubleBuffering = new TraceSwitch("DoubleBuffering", "Output information about double buffering"); + } + + return s_doubleBuffering; + } + } + + /// + /// Allows you to set the maximum width and height of the buffer that will be retained in memory. + /// You can allocate a buffer of any size, however any request for a buffer that would have a total + /// memory footprint larger that the maximum size will be allocated temporarily and then discarded + /// with the BufferedGraphics is released. + /// + public Size MaximumBuffer + { + get => _maximumBuffer; + set + { + if (value.Width <= 0 || value.Height <= 0) + { + throw new ArgumentException(SR.Format(SR.InvalidArgument, nameof(MaximumBuffer), value), nameof(value)); + } + + // If we've been asked to decrease the size of the maximum buffer, + // then invalidate the older & larger buffer. + if (value.Width * value.Height < _maximumBuffer.Width * _maximumBuffer.Height) + { + Invalidate(); + } + + _maximumBuffer = value; + } + } + + /// + /// Returns a BufferedGraphics that is matched for the specified target Graphics object. + /// + public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle targetRectangle) + { + if (ShouldUseTempManager(targetRectangle)) + { + Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Too big of buffer requested (" + targetRectangle.Width + " x " + targetRectangle.Height + ") ... allocating temp buffer manager"); + return AllocBufferInTempManager(targetGraphics, IntPtr.Zero, targetRectangle); + } + + return AllocBuffer(targetGraphics, IntPtr.Zero, targetRectangle); + } + + /// + /// Returns a BufferedGraphics that is matched for the specified target HDC object. + /// + public BufferedGraphics Allocate(IntPtr targetDC, Rectangle targetRectangle) + { + if (ShouldUseTempManager(targetRectangle)) + { + Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Too big of buffer requested (" + targetRectangle.Width + " x " + targetRectangle.Height + ") ... allocating temp buffer manager"); + return AllocBufferInTempManager(null, targetDC, targetRectangle); + } + + return AllocBuffer(null, targetDC, targetRectangle); + } + + /// + /// Returns a BufferedGraphics that is matched for the specified target HDC object. + /// + private BufferedGraphics AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) + { + int oldBusy = Interlocked.CompareExchange(ref _busy, BufferBusyPainting, BufferFree); + + // In the case were we have contention on the buffer - i.e. two threads + // trying to use the buffer at the same time, we just create a temp + // buffermanager and have the buffer dispose of it when it is done. + // + if (oldBusy != BufferFree) + { + Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Attempt to have two buffers for a buffer manager... allocating temp buffer manager"); + return AllocBufferInTempManager(targetGraphics, targetDC, targetRectangle); + } + +#if DEBUG + if (DoubleBuffering.TraceVerbose) + { + _stackAtBusy = new StackTrace().ToString(); + } +#endif + + Graphics surface; + _targetLoc = new Point(targetRectangle.X, targetRectangle.Y); + + try + { + if (targetGraphics != null) + { + IntPtr destDc = targetGraphics.GetHdc(); + try + { + surface = CreateBuffer(destDc, -_targetLoc.X, -_targetLoc.Y, targetRectangle.Width, targetRectangle.Height); + } + finally + { + targetGraphics.ReleaseHdcInternal(destDc); + } + } + else + { + surface = CreateBuffer(targetDC, -_targetLoc.X, -_targetLoc.Y, targetRectangle.Width, targetRectangle.Height); + } + + _buffer = new BufferedGraphics(surface, this, targetGraphics, targetDC, _targetLoc, _virtualSize); + } + catch + { + // Free the buffer so it can be disposed. + _busy = BufferFree; + throw; + } + + return _buffer; + } + + /// + /// Returns a BufferedGraphics that is matched for the specified target HDC object. + /// + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] + private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) + { + BufferedGraphicsContext tempContext = null; + BufferedGraphics tempBuffer = null; + + try + { + tempContext = new BufferedGraphicsContext(); + tempBuffer = tempContext.AllocBuffer(targetGraphics, targetDC, targetRectangle); + tempBuffer.DisposeContext = true; + } + finally + { + if (tempContext != null && (tempBuffer == null || (tempBuffer != null && !tempBuffer.DisposeContext))) + { + tempContext.Dispose(); + } + } + + return tempBuffer; + } + + + /// + /// Fills in the fields of a BITMAPINFO so that we can create a bitmap + /// that matches the format of the display. + /// + /// This is done by creating a compatible bitmap and calling GetDIBits + /// to return the color masks. This is done with two calls. The first + /// call passes in biBitCount = 0 to GetDIBits which will fill in the + /// base BITMAPINFOHEADER data. The second call to GetDIBits (passing + /// in the BITMAPINFO filled in by the first call) will return the color + /// table or bitmasks, as appropriate. + /// + /// True if successful, false otherwise. + private bool FillBitmapInfo(IntPtr hdc, IntPtr hpal, ref NativeMethods.BITMAPINFO_FLAT pbmi) + { + IntPtr hbm = IntPtr.Zero; + bool bRet = false; + try + { + // Create a dummy bitmap from which we can query color format info + // about the device surface. + hbm = SafeNativeMethods.CreateCompatibleBitmap(new HandleRef(null, hdc), 1, 1); + + if (hbm == IntPtr.Zero) + { + throw new OutOfMemoryException(SR.Format(SR.GraphicsBufferQueryFail)); + } + + pbmi.bmiHeader_biSize = Marshal.SizeOf(typeof(NativeMethods.BITMAPINFOHEADER)); + pbmi.bmiColors = new byte[NativeMethods.BITMAPINFO_MAX_COLORSIZE * 4]; + + // Call first time to fill in BITMAPINFO header. + SafeNativeMethods.GetDIBits(new HandleRef(null, hdc), + new HandleRef(null, hbm), + 0, + 0, + IntPtr.Zero, + ref pbmi, + NativeMethods.DIB_RGB_COLORS); + + if (pbmi.bmiHeader_biBitCount <= 8) + { + bRet = FillColorTable(hdc, hpal, ref pbmi); + } + else + { + if (pbmi.bmiHeader_biCompression == NativeMethods.BI_BITFIELDS) + { + // Call a second time to get the color masks. + SafeNativeMethods.GetDIBits(new HandleRef(null, hdc), + new HandleRef(null, hbm), + 0, + pbmi.bmiHeader_biHeight, + IntPtr.Zero, + ref pbmi, + NativeMethods.DIB_RGB_COLORS); + } + bRet = true; + } + } + finally + { + if (hbm != IntPtr.Zero) + { + SafeNativeMethods.DeleteObject(new HandleRef(null, hbm)); + hbm = IntPtr.Zero; + } + } + return bRet; + } + + /// + /// Initialize the color table of the BITMAPINFO pointed to by pbmi. Colors + /// are set to the current system palette. + /// + /// Note: call only valid for displays of 8bpp or less. + /// + /// True is successful, false otherwise. + private unsafe bool FillColorTable(IntPtr hdc, IntPtr hpal, ref NativeMethods.BITMAPINFO_FLAT pbmi) + { + byte[] aj = new byte[sizeof(NativeMethods.PALETTEENTRY) * 256]; + + fixed (byte* pcolors = pbmi.bmiColors) + { + fixed (byte* ppal = aj) + { + NativeMethods.RGBQUAD* prgb = (NativeMethods.RGBQUAD*)pcolors; + NativeMethods.PALETTEENTRY* lppe = (NativeMethods.PALETTEENTRY*)ppal; + + int cColors = 1 << pbmi.bmiHeader_biBitCount; + if (cColors <= 256) + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "8 bit or less..."); + + // Note: we don't support 4bpp displays. + uint palRet; + IntPtr palHalftone = IntPtr.Zero; + if (hpal == IntPtr.Zero) + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "using halftone palette..."); + palHalftone = Graphics.GetHalftonePalette(); + palRet = SafeNativeMethods.GetPaletteEntries(new HandleRef(null, palHalftone), 0, cColors, aj); + } + else + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "using custom palette..."); + palRet = SafeNativeMethods.GetPaletteEntries(new HandleRef(null, hpal), 0, cColors, aj); + } + + if (palRet != 0) + { + for (int i = 0; i < cColors; i++) + { + prgb[i].rgbRed = lppe[i].peRed; + prgb[i].rgbGreen = lppe[i].peGreen; + prgb[i].rgbBlue = lppe[i].peBlue; + prgb[i].rgbReserved = 0; + } + + return true; + } + else + { + Debug.WriteLineIf(DoubleBuffering.TraceWarning, "FillColorTable: MyGetSystemPaletteEntries failed\n"); + } + } + } + } + + return false; + } + + /// + /// Returns a Graphics object representing a buffer. + /// + private Graphics CreateBuffer(IntPtr src, int offsetX, int offsetY, int width, int height) + { + // Create the compat DC. + _busy = BufferBusyDisposing; + DisposeDC(); + _busy = BufferBusyPainting; + _compatDC = UnsafeNativeMethods.CreateCompatibleDC(new HandleRef(null, src)); + + // Recreate the bitmap if necessary. + if (width > _bufferSize.Width || height > _bufferSize.Height) + { + Debug.WriteLineIf(DoubleBuffering.TraceInfo, "allocating new bitmap: " + width + " x " + height); + int optWidth = Math.Max(width, _bufferSize.Width); + int optHeight = Math.Max(height, _bufferSize.Height); + + _busy = BufferBusyDisposing; + DisposeBitmap(); + _busy = BufferBusyPainting; + + Debug.WriteLineIf(DoubleBuffering.TraceInfo, " new size : " + optWidth + " x " + optHeight); + IntPtr pvbits = IntPtr.Zero; + _dib = CreateCompatibleDIB(src, IntPtr.Zero, optWidth, optHeight, ref pvbits); + _bufferSize = new Size(optWidth, optHeight); + } + + // Select the bitmap. + _oldBitmap = SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _dib)); + + // Create compat graphics. + Debug.WriteLineIf(DoubleBuffering.TraceInfo, " Create compatGraphics"); + _compatGraphics = Graphics.FromHdcInternal(_compatDC); + _compatGraphics.TranslateTransform(-_targetLoc.X, -_targetLoc.Y); + _virtualSize = new Size(width, height); + + return _compatGraphics; + } + + /// + /// Create a DIB section with an optimal format w.r.t. the specified hdc. + /// + /// If DIB <= 8bpp, then the DIB color table is initialized based on the + /// specified palette. If the palette handle is NULL, then the system + /// palette is used. + /// + /// Note: The hdc must be a direct DC (not an info or memory DC). + /// + /// Note: On palettized displays, if the system palette changes the + /// UpdateDIBColorTable function should be called to maintain + /// the identity palette mapping between the DIB and the display. + /// + /// A valid bitmap handle if successful, IntPtr.Zero otherwise. + [SuppressMessage("Microsoft.Interoperability", "CA1404:CallGetLastErrorImmediatelyAfterPInvoke")] + private IntPtr CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, int ulWidth, int ulHeight, ref IntPtr ppvBits) + { + if (hdc == IntPtr.Zero) + { + throw new ArgumentNullException(nameof(hdc)); + } + + IntPtr hbmRet = IntPtr.Zero; + var pbmi = new NativeMethods.BITMAPINFO_FLAT(); + + // Validate hdc. + int objType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, hdc)); + + switch (objType) + { + case NativeMethods.OBJ_DC: + case NativeMethods.OBJ_METADC: + case NativeMethods.OBJ_MEMDC: + case NativeMethods.OBJ_ENHMETADC: + break; + default: + throw new ArgumentException(SR.Format(SR.DCTypeInvalid)); + } + + if (FillBitmapInfo(hdc, hpal, ref pbmi)) + { + // Change bitmap size to match specified dimensions. + pbmi.bmiHeader_biWidth = ulWidth; + pbmi.bmiHeader_biHeight = ulHeight; + if (pbmi.bmiHeader_biCompression == NativeMethods.BI_RGB) + { + pbmi.bmiHeader_biSizeImage = 0; + } + else + { + if (pbmi.bmiHeader_biBitCount == 16) + { + pbmi.bmiHeader_biSizeImage = ulWidth * ulHeight * 2; + } + else if (pbmi.bmiHeader_biBitCount == 32) + { + pbmi.bmiHeader_biSizeImage = ulWidth * ulHeight * 4; + } + else + { + pbmi.bmiHeader_biSizeImage = 0; + } + } + pbmi.bmiHeader_biClrUsed = 0; + pbmi.bmiHeader_biClrImportant = 0; + + // Create the DIB section. Let Win32 allocate the memory and return + // a pointer to the bitmap surface. + hbmRet = SafeNativeMethods.CreateDIBSection(new HandleRef(null, hdc), ref pbmi, NativeMethods.DIB_RGB_COLORS, ref ppvBits, IntPtr.Zero, 0); + Win32Exception ex = null; + if (hbmRet == IntPtr.Zero) + { + ex = new Win32Exception(Marshal.GetLastWin32Error()); +#if DEBUG + DumpBitmapInfo(ref pbmi); +#endif + } + +#if DEBUG + if (DoubleBuffering.TraceVerbose) + { + DumpBitmapInfo(ref pbmi); + } +#endif + if (ex != null) + { + throw ex; + } + } + + return hbmRet; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disposes the DC, but leaves the bitmap alone. + /// + private void DisposeDC() + { + if (_oldBitmap != IntPtr.Zero && _compatDC != IntPtr.Zero) + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "restoring bitmap to DC"); + SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _oldBitmap)); + _oldBitmap = IntPtr.Zero; + } + + if (_compatDC != IntPtr.Zero) + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete compat DC"); + UnsafeNativeMethods.DeleteDC(new HandleRef(this, _compatDC)); + _compatDC = IntPtr.Zero; + } + } + + /// + /// Disposes the bitmap, will ASSERT if bitmap is being used (checks oldbitmap). if ASSERTed, call DisposeDC() first. + /// + private void DisposeBitmap() + { + if (_dib != IntPtr.Zero) + { + Debug.Assert(_oldBitmap == IntPtr.Zero); + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete dib"); + + SafeNativeMethods.DeleteObject(new HandleRef(this, _dib)); + _dib = IntPtr.Zero; + } + } + + /// + /// Disposes of the Graphics buffer. + /// + private void Dispose(bool disposing) + { + Debug.WriteLineIf(DoubleBuffering.TraceInfo, "Dispose(" + disposing + ") {"); + Debug.Indent(); + int oldBusy = Interlocked.CompareExchange(ref _busy, BufferBusyDisposing, BufferFree); + + if (disposing) + { + if (oldBusy == BufferBusyPainting) + { +#if DEBUG + Debug.WriteLineIf(DoubleBuffering.TraceInfo, "Stack at busy buffer: \n" + _stackAtBusy); +#endif + + throw new InvalidOperationException(SR.Format(SR.GraphicsBufferCurrentlyBusy)); + } + + if (_compatGraphics != null) + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "Disposing compatGraphics"); + _compatGraphics.Dispose(); + _compatGraphics = null; + } + } + + DisposeDC(); + DisposeBitmap(); + + if (_buffer != null) + { + Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "Disposing buffer"); + _buffer.Dispose(); + _buffer = null; + } + + _bufferSize = Size.Empty; + _virtualSize = Size.Empty; + Debug.Unindent(); + Debug.WriteLineIf(DoubleBuffering.TraceInfo, "}"); + + _busy = BufferFree; + } + +#if DEBUG + [ExcludeFromCodeCoverage] + private void DumpBitmapInfo(ref NativeMethods.BITMAPINFO_FLAT pbmi) + { + Debug.WriteLine("biWidth --> " + pbmi.bmiHeader_biWidth); + Debug.WriteLine("biHeight --> " + pbmi.bmiHeader_biHeight); + Debug.WriteLine("biPlanes --> " + pbmi.bmiHeader_biPlanes); + Debug.WriteLine("biBitCount --> " + pbmi.bmiHeader_biBitCount); + Debug.WriteLine(""); + } +#endif + + /// + /// Invalidates the cached graphics buffer. + /// + public void Invalidate() + { + int oldBusy = Interlocked.CompareExchange(ref _busy, BufferBusyDisposing, BufferFree); + + // If we're not busy with our buffer, lets clean it up now + if (oldBusy == BufferFree) + { + Dispose(); + _busy = BufferFree; + } + else + { + // This will indicate to free the buffer as soon as it becomes non-busy. + _invalidateWhenFree = true; + } + } + + /// + /// Returns a Graphics object representing a buffer. + /// + internal void ReleaseBuffer(BufferedGraphics buffer) + { + _buffer = null; + if (_invalidateWhenFree) + { + // Clears everything including the bitmap. + _busy = BufferBusyDisposing; + Dispose(); + } + else + { + // Otherwise, just dispose the DC. A new one will be created next time. + _busy = BufferBusyDisposing; + + // Only clears out the DC. + DisposeDC(); + } + + _busy = BufferFree; + } + + /// + /// This routine allows us to control the point were we start using throw away + /// managers for painting. Since the buffer manager stays around (by default) + /// for the life of the app, we don't want to consume too much memory + /// in the buffer. However, re-allocating the buffer for small things (like + /// buttons, labels, etc) will hit us on runtime performance. + /// + private bool ShouldUseTempManager(Rectangle targetBounds) + { + return (targetBounds.Width * targetBounds.Height) > (MaximumBuffer.Width * MaximumBuffer.Height); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs deleted file mode 100644 index 8ad5bfef3c..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs +++ /dev/null @@ -1,629 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.InteropServices; -using System.Threading; - -namespace System.Drawing -{ - /// - /// The BufferedGraphicsContext class can be used to perform standard double buffer rendering techniques. - /// - public sealed class BufferedGraphicsContext : IDisposable - { - private Size _maximumBuffer; - private Size _bufferSize; - private Size _virtualSize; - private Point _targetLoc; - private IntPtr _compatDC; - private IntPtr _dib; - private IntPtr _oldBitmap; - private Graphics _compatGraphics; - private BufferedGraphics _buffer; - private int _busy; - private bool _invalidateWhenFree; - - private const int BufferFree = 0; // The graphics buffer is free to use. - private const int BufferBusyPainting = 1; // The graphics buffer is busy being created/painting. - private const int BufferBusyDisposing = 2; // The graphics buffer is busy disposing. - - private static TraceSwitch s_doubleBuffering; - -#if DEBUG - private string _stackAtBusy; -#endif - - /// - /// Basic constructor. - /// - public BufferedGraphicsContext() - { - // By defualt, the size of our maxbuffer will be 3 x standard button size. - _maximumBuffer.Width = 75 * 3; - _maximumBuffer.Height = 32 * 3; - - _bufferSize = Size.Empty; - } - - ~BufferedGraphicsContext() => Dispose(false); - - /// - /// Internal trace switch for debugging - /// - internal static TraceSwitch DoubleBuffering - { - get - { - if (s_doubleBuffering == null) - { - s_doubleBuffering = new TraceSwitch("DoubleBuffering", "Output information about double buffering"); - } - - return s_doubleBuffering; - } - } - - /// - /// Allows you to set the maximum width and height of the buffer that will be retained in memory. - /// You can allocate a buffer of any size, however any request for a buffer that would have a total - /// memory footprint larger that the maximum size will be allocated temporarily and then discarded - /// with the BufferedGraphics is released. - /// - public Size MaximumBuffer - { - get => _maximumBuffer; - set - { - if (value.Width <= 0 || value.Height <= 0) - { - throw new ArgumentException(SR.Format(SR.InvalidArgument, nameof(MaximumBuffer), value), nameof(value)); - } - - // If we've been asked to decrease the size of the maximum buffer, - // then invalidate the older & larger buffer. - if (value.Width * value.Height < _maximumBuffer.Width * _maximumBuffer.Height) - { - Invalidate(); - } - - _maximumBuffer = value; - } - } - - /// - /// Returns a BufferedGraphics that is matched for the specified target Graphics object. - /// - public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle targetRectangle) - { - if (ShouldUseTempManager(targetRectangle)) - { - Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Too big of buffer requested (" + targetRectangle.Width + " x " + targetRectangle.Height + ") ... allocating temp buffer manager"); - return AllocBufferInTempManager(targetGraphics, IntPtr.Zero, targetRectangle); - } - - return AllocBuffer(targetGraphics, IntPtr.Zero, targetRectangle); - } - - /// - /// Returns a BufferedGraphics that is matched for the specified target HDC object. - /// - public BufferedGraphics Allocate(IntPtr targetDC, Rectangle targetRectangle) - { - if (ShouldUseTempManager(targetRectangle)) - { - Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Too big of buffer requested (" + targetRectangle.Width + " x " + targetRectangle.Height + ") ... allocating temp buffer manager"); - return AllocBufferInTempManager(null, targetDC, targetRectangle); - } - - return AllocBuffer(null, targetDC, targetRectangle); - } - - /// - /// Returns a BufferedGraphics that is matched for the specified target HDC object. - /// - private BufferedGraphics AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) - { - int oldBusy = Interlocked.CompareExchange(ref _busy, BufferBusyPainting, BufferFree); - - // In the case were we have contention on the buffer - i.e. two threads - // trying to use the buffer at the same time, we just create a temp - // buffermanager and have the buffer dispose of it when it is done. - // - if (oldBusy != BufferFree) - { - Debug.WriteLineIf(DoubleBuffering.TraceWarning, "Attempt to have two buffers for a buffer manager... allocating temp buffer manager"); - return AllocBufferInTempManager(targetGraphics, targetDC, targetRectangle); - } - -#if DEBUG - if (DoubleBuffering.TraceVerbose) - { - _stackAtBusy = new StackTrace().ToString(); - } -#endif - - Graphics surface; - _targetLoc = new Point(targetRectangle.X, targetRectangle.Y); - - try - { - if (targetGraphics != null) - { - IntPtr destDc = targetGraphics.GetHdc(); - try - { - surface = CreateBuffer(destDc, -_targetLoc.X, -_targetLoc.Y, targetRectangle.Width, targetRectangle.Height); - } - finally - { - targetGraphics.ReleaseHdcInternal(destDc); - } - } - else - { - surface = CreateBuffer(targetDC, -_targetLoc.X, -_targetLoc.Y, targetRectangle.Width, targetRectangle.Height); - } - - _buffer = new BufferedGraphics(surface, this, targetGraphics, targetDC, _targetLoc, _virtualSize); - } - catch - { - // Free the buffer so it can be disposed. - _busy = BufferFree; - throw; - } - - return _buffer; - } - - /// - /// Returns a BufferedGraphics that is matched for the specified target HDC object. - /// - [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] - private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) - { - BufferedGraphicsContext tempContext = null; - BufferedGraphics tempBuffer = null; - - try - { - tempContext = new BufferedGraphicsContext(); - tempBuffer = tempContext.AllocBuffer(targetGraphics, targetDC, targetRectangle); - tempBuffer.DisposeContext = true; - } - finally - { - if (tempContext != null && (tempBuffer == null || (tempBuffer != null && !tempBuffer.DisposeContext))) - { - tempContext.Dispose(); - } - } - - return tempBuffer; - } - - - /// - /// Fills in the fields of a BITMAPINFO so that we can create a bitmap - /// that matches the format of the display. - /// - /// This is done by creating a compatible bitmap and calling GetDIBits - /// to return the color masks. This is done with two calls. The first - /// call passes in biBitCount = 0 to GetDIBits which will fill in the - /// base BITMAPINFOHEADER data. The second call to GetDIBits (passing - /// in the BITMAPINFO filled in by the first call) will return the color - /// table or bitmasks, as appropriate. - /// - /// True if successful, false otherwise. - private bool FillBitmapInfo(IntPtr hdc, IntPtr hpal, ref NativeMethods.BITMAPINFO_FLAT pbmi) - { - IntPtr hbm = IntPtr.Zero; - bool bRet = false; - try - { - // Create a dummy bitmap from which we can query color format info - // about the device surface. - hbm = SafeNativeMethods.CreateCompatibleBitmap(new HandleRef(null, hdc), 1, 1); - - if (hbm == IntPtr.Zero) - { - throw new OutOfMemoryException(SR.Format(SR.GraphicsBufferQueryFail)); - } - - pbmi.bmiHeader_biSize = Marshal.SizeOf(typeof(NativeMethods.BITMAPINFOHEADER)); - pbmi.bmiColors = new byte[NativeMethods.BITMAPINFO_MAX_COLORSIZE * 4]; - - // Call first time to fill in BITMAPINFO header. - SafeNativeMethods.GetDIBits(new HandleRef(null, hdc), - new HandleRef(null, hbm), - 0, - 0, - IntPtr.Zero, - ref pbmi, - NativeMethods.DIB_RGB_COLORS); - - if (pbmi.bmiHeader_biBitCount <= 8) - { - bRet = FillColorTable(hdc, hpal, ref pbmi); - } - else - { - if (pbmi.bmiHeader_biCompression == NativeMethods.BI_BITFIELDS) - { - // Call a second time to get the color masks. - SafeNativeMethods.GetDIBits(new HandleRef(null, hdc), - new HandleRef(null, hbm), - 0, - pbmi.bmiHeader_biHeight, - IntPtr.Zero, - ref pbmi, - NativeMethods.DIB_RGB_COLORS); - } - bRet = true; - } - } - finally - { - if (hbm != IntPtr.Zero) - { - SafeNativeMethods.DeleteObject(new HandleRef(null, hbm)); - hbm = IntPtr.Zero; - } - } - return bRet; - } - - /// - /// Initialize the color table of the BITMAPINFO pointed to by pbmi. Colors - /// are set to the current system palette. - /// - /// Note: call only valid for displays of 8bpp or less. - /// - /// True is successful, false otherwise. - private unsafe bool FillColorTable(IntPtr hdc, IntPtr hpal, ref NativeMethods.BITMAPINFO_FLAT pbmi) - { - byte[] aj = new byte[sizeof(NativeMethods.PALETTEENTRY) * 256]; - - fixed (byte* pcolors = pbmi.bmiColors) - { - fixed (byte* ppal = aj) - { - NativeMethods.RGBQUAD* prgb = (NativeMethods.RGBQUAD*)pcolors; - NativeMethods.PALETTEENTRY* lppe = (NativeMethods.PALETTEENTRY*)ppal; - - int cColors = 1 << pbmi.bmiHeader_biBitCount; - if (cColors <= 256) - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "8 bit or less..."); - - // Note: we don't support 4bpp displays. - uint palRet; - IntPtr palHalftone = IntPtr.Zero; - if (hpal == IntPtr.Zero) - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "using halftone palette..."); - palHalftone = Graphics.GetHalftonePalette(); - palRet = SafeNativeMethods.GetPaletteEntries(new HandleRef(null, palHalftone), 0, cColors, aj); - } - else - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "using custom palette..."); - palRet = SafeNativeMethods.GetPaletteEntries(new HandleRef(null, hpal), 0, cColors, aj); - } - - if (palRet != 0) - { - for (int i = 0; i < cColors; i++) - { - prgb[i].rgbRed = lppe[i].peRed; - prgb[i].rgbGreen = lppe[i].peGreen; - prgb[i].rgbBlue = lppe[i].peBlue; - prgb[i].rgbReserved = 0; - } - - return true; - } - else - { - Debug.WriteLineIf(DoubleBuffering.TraceWarning, "FillColorTable: MyGetSystemPaletteEntries failed\n"); - } - } - } - } - - return false; - } - - /// - /// Returns a Graphics object representing a buffer. - /// - private Graphics CreateBuffer(IntPtr src, int offsetX, int offsetY, int width, int height) - { - // Create the compat DC. - _busy = BufferBusyDisposing; - DisposeDC(); - _busy = BufferBusyPainting; - _compatDC = UnsafeNativeMethods.CreateCompatibleDC(new HandleRef(null, src)); - - // Recreate the bitmap if necessary. - if (width > _bufferSize.Width || height > _bufferSize.Height) - { - Debug.WriteLineIf(DoubleBuffering.TraceInfo, "allocating new bitmap: " + width + " x " + height); - int optWidth = Math.Max(width, _bufferSize.Width); - int optHeight = Math.Max(height, _bufferSize.Height); - - _busy = BufferBusyDisposing; - DisposeBitmap(); - _busy = BufferBusyPainting; - - Debug.WriteLineIf(DoubleBuffering.TraceInfo, " new size : " + optWidth + " x " + optHeight); - IntPtr pvbits = IntPtr.Zero; - _dib = CreateCompatibleDIB(src, IntPtr.Zero, optWidth, optHeight, ref pvbits); - _bufferSize = new Size(optWidth, optHeight); - } - - // Select the bitmap. - _oldBitmap = SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _dib)); - - // Create compat graphics. - Debug.WriteLineIf(DoubleBuffering.TraceInfo, " Create compatGraphics"); - _compatGraphics = Graphics.FromHdcInternal(_compatDC); - _compatGraphics.TranslateTransform(-_targetLoc.X, -_targetLoc.Y); - _virtualSize = new Size(width, height); - - return _compatGraphics; - } - - /// - /// Create a DIB section with an optimal format w.r.t. the specified hdc. - /// - /// If DIB <= 8bpp, then the DIB color table is initialized based on the - /// specified palette. If the palette handle is NULL, then the system - /// palette is used. - /// - /// Note: The hdc must be a direct DC (not an info or memory DC). - /// - /// Note: On palettized displays, if the system palette changes the - /// UpdateDIBColorTable function should be called to maintain - /// the identity palette mapping between the DIB and the display. - /// - /// A valid bitmap handle if successul, IntPtr.Zero otherwise. - [SuppressMessage("Microsoft.Interoperability", "CA1404:CallGetLastErrorImmediatelyAfterPInvoke")] - private IntPtr CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, int ulWidth, int ulHeight, ref IntPtr ppvBits) - { - if (hdc == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(hdc)); - } - - IntPtr hbmRet = IntPtr.Zero; - var pbmi = new NativeMethods.BITMAPINFO_FLAT(); - - // Validate hdc. - int objType = UnsafeNativeMethods.GetObjectType(new HandleRef(null, hdc)); - - switch (objType) - { - case NativeMethods.OBJ_DC: - case NativeMethods.OBJ_METADC: - case NativeMethods.OBJ_MEMDC: - case NativeMethods.OBJ_ENHMETADC: - break; - default: - throw new ArgumentException(SR.Format(SR.DCTypeInvalid)); - } - - if (FillBitmapInfo(hdc, hpal, ref pbmi)) - { - // Change bitmap size to match specified dimensions. - pbmi.bmiHeader_biWidth = ulWidth; - pbmi.bmiHeader_biHeight = ulHeight; - if (pbmi.bmiHeader_biCompression == NativeMethods.BI_RGB) - { - pbmi.bmiHeader_biSizeImage = 0; - } - else - { - if (pbmi.bmiHeader_biBitCount == 16) - { - pbmi.bmiHeader_biSizeImage = ulWidth * ulHeight * 2; - } - else if (pbmi.bmiHeader_biBitCount == 32) - { - pbmi.bmiHeader_biSizeImage = ulWidth * ulHeight * 4; - } - else - { - pbmi.bmiHeader_biSizeImage = 0; - } - } - pbmi.bmiHeader_biClrUsed = 0; - pbmi.bmiHeader_biClrImportant = 0; - - // Create the DIB section. Let Win32 allocate the memory and return - // a pointer to the bitmap surface. - hbmRet = SafeNativeMethods.CreateDIBSection(new HandleRef(null, hdc), ref pbmi, NativeMethods.DIB_RGB_COLORS, ref ppvBits, IntPtr.Zero, 0); - Win32Exception ex = null; - if (hbmRet == IntPtr.Zero) - { - ex = new Win32Exception(Marshal.GetLastWin32Error()); -#if DEBUG - DumpBitmapInfo(ref pbmi); -#endif - } - -#if DEBUG - if (DoubleBuffering.TraceVerbose) - { - DumpBitmapInfo(ref pbmi); - } -#endif - if (ex != null) - { - throw ex; - } - } - - return hbmRet; - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Disposes the DC, but leaves the bitmap alone. - /// - private void DisposeDC() - { - if (_oldBitmap != IntPtr.Zero && _compatDC != IntPtr.Zero) - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "restoring bitmap to DC"); - SafeNativeMethods.SelectObject(new HandleRef(this, _compatDC), new HandleRef(this, _oldBitmap)); - _oldBitmap = IntPtr.Zero; - } - - if (_compatDC != IntPtr.Zero) - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete compat DC"); - UnsafeNativeMethods.DeleteDC(new HandleRef(this, _compatDC)); - _compatDC = IntPtr.Zero; - } - } - - /// - /// Disposes the bitmap, will ASSERT if bitmap is being used (checks oldbitmap). if ASSERTed, call DisposeDC() first. - /// - private void DisposeBitmap() - { - if (_dib != IntPtr.Zero) - { - Debug.Assert(_oldBitmap == IntPtr.Zero); - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "delete dib"); - - SafeNativeMethods.DeleteObject(new HandleRef(this, _dib)); - _dib = IntPtr.Zero; - } - } - - /// - /// Disposes of the Graphics buffer. - /// - private void Dispose(bool disposing) - { - Debug.WriteLineIf(DoubleBuffering.TraceInfo, "Dispose(" + disposing + ") {"); - Debug.Indent(); - int oldBusy = Interlocked.CompareExchange(ref _busy, BufferBusyDisposing, BufferFree); - - if (disposing) - { - if (oldBusy == BufferBusyPainting) - { -#if DEBUG - Debug.WriteLineIf(DoubleBuffering.TraceInfo, "Stack at busy buffer: \n" + _stackAtBusy); -#endif - - throw new InvalidOperationException(SR.Format(SR.GraphicsBufferCurrentlyBusy)); - } - - if (_compatGraphics != null) - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "Disposing compatGraphics"); - _compatGraphics.Dispose(); - _compatGraphics = null; - } - } - - DisposeDC(); - DisposeBitmap(); - - if (_buffer != null) - { - Debug.WriteLineIf(DoubleBuffering.TraceVerbose, "Disposing buffer"); - _buffer.Dispose(); - _buffer = null; - } - - _bufferSize = Size.Empty; - _virtualSize = Size.Empty; - Debug.Unindent(); - Debug.WriteLineIf(DoubleBuffering.TraceInfo, "}"); - - _busy = BufferFree; - } - -#if DEBUG - [ExcludeFromCodeCoverage] - private void DumpBitmapInfo(ref NativeMethods.BITMAPINFO_FLAT pbmi) - { - Debug.WriteLine("biWidth --> " + pbmi.bmiHeader_biWidth); - Debug.WriteLine("biHeight --> " + pbmi.bmiHeader_biHeight); - Debug.WriteLine("biPlanes --> " + pbmi.bmiHeader_biPlanes); - Debug.WriteLine("biBitCount --> " + pbmi.bmiHeader_biBitCount); - Debug.WriteLine(""); - } -#endif - - /// - /// Invalidates the cached graphics buffer. - /// - public void Invalidate() - { - int oldBusy = Interlocked.CompareExchange(ref _busy, BufferBusyDisposing, BufferFree); - - // If we're not busy with our buffer, lets clean it up now - if (oldBusy == BufferFree) - { - Dispose(); - _busy = BufferFree; - } - else - { - // This will indicate to free the buffer as soon as it becomes non-busy. - _invalidateWhenFree = true; - } - } - - /// - /// Returns a Graphics object representing a buffer. - /// - internal void ReleaseBuffer(BufferedGraphics buffer) - { - _buffer = null; - if (_invalidateWhenFree) - { - // Clears everything including the bitmap. - _busy = BufferBusyDisposing; - Dispose(); - } - else - { - // Otherwise, just dispose the DC. A new one will be created next time. - _busy = BufferBusyDisposing; - - // Only clears out the DC. - DisposeDC(); - } - - _busy = BufferFree; - } - - /// - /// This routine allows us to control the point were we start using throw away - /// managers for painting. Since the buffer manager stays around (by default) - /// for the life of the app, we don't want to consume too much memory - /// in the buffer. However, re-allocating the buffer for small things (like - /// buttons, labels, etc) will hit us on runtime performance. - /// - private bool ShouldUseTempManager(Rectangle targetBounds) - { - return (targetBounds.Width * targetBounds.Height) > (MaximumBuffer.Width * MaximumBuffer.Height); - } - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.Unix.cs new file mode 100644 index 0000000000..60f9abc8d9 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.Unix.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005 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. +// +// Authors: +// +// Jordi Mas i Hernadez +// +// + + +namespace System.Drawing +{ + public sealed class BufferedGraphicsManager + { + private static BufferedGraphicsContext graphics_context; + + static BufferedGraphicsManager() + { + graphics_context = new BufferedGraphicsContext(); + } + + private BufferedGraphicsManager() + { + } + + public static BufferedGraphicsContext Current + { + get { return graphics_context; } + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsManager.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/CharacterRange.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/CharacterRange.cs new file mode 100644 index 0000000000..33bbfd3f4b --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/CharacterRange.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Drawing +{ + using System.Runtime.InteropServices; + [StructLayout(LayoutKind.Sequential)] + public struct CharacterRange + { + private int _first; + private int _length; + + /// + /// Initializes a new instance of the class with the specified coordinates. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] + public CharacterRange(int First, int Length) + { + _first = First; + _length = Length; + } + + /// + /// Gets the First character position of this . + /// + public int First + { + get + { + return _first; + } + set + { + _first = value; + } + } + + /// + /// Gets the Length of this . + /// + public int Length + { + get + { + return _length; + } + set + { + _length = value; + } + } + + public override bool Equals(object obj) + { + if (obj.GetType() != typeof(CharacterRange)) + return false; + + CharacterRange cr = (CharacterRange)obj; + return ((_first == cr.First) && (_length == cr.Length)); + } + + public static bool operator ==(CharacterRange cr1, CharacterRange cr2) + { + return ((cr1.First == cr2.First) && (cr1.Length == cr2.Length)); + } + + public static bool operator !=(CharacterRange cr1, CharacterRange cr2) + { + return !(cr1 == cr2); + } + + public override int GetHashCode() + { + return unchecked(_first << 8 + _length); + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ColorTranslator.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ColorTranslator.cs index 6b17bd0696..4c9bd74851 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ColorTranslator.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ColorTranslator.cs @@ -36,7 +36,7 @@ namespace System.Drawing // We must never have another method called ToOle() with a different signature. // This is so that we can push into the runtime a custom marshaller for OLE_COLOR to Color. - if (c.IsKnownColor) + if (ColorUtil.GetIsKnownColor(c)) { switch (c.ToKnownColor()) { @@ -125,65 +125,65 @@ namespace System.Drawing switch (oleColor) { case unchecked((int)0x8000000A): - return Color.FromKnownColor(KnownColor.ActiveBorder); + return ColorUtil.FromKnownColor(KnownColor.ActiveBorder); case unchecked((int)0x80000002): - return Color.FromKnownColor(KnownColor.ActiveCaption); + return ColorUtil.FromKnownColor(KnownColor.ActiveCaption); case unchecked((int)0x80000009): - return Color.FromKnownColor(KnownColor.ActiveCaptionText); + return ColorUtil.FromKnownColor(KnownColor.ActiveCaptionText); case unchecked((int)0x8000000C): - return Color.FromKnownColor(KnownColor.AppWorkspace); + return ColorUtil.FromKnownColor(KnownColor.AppWorkspace); case unchecked((int)0x8000000F): - return Color.FromKnownColor(KnownColor.Control); + return ColorUtil.FromKnownColor(KnownColor.Control); case unchecked((int)0x80000010): - return Color.FromKnownColor(KnownColor.ControlDark); + return ColorUtil.FromKnownColor(KnownColor.ControlDark); case unchecked((int)0x80000015): - return Color.FromKnownColor(KnownColor.ControlDarkDark); + return ColorUtil.FromKnownColor(KnownColor.ControlDarkDark); case unchecked((int)0x80000016): - return Color.FromKnownColor(KnownColor.ControlLight); + return ColorUtil.FromKnownColor(KnownColor.ControlLight); case unchecked((int)0x80000014): - return Color.FromKnownColor(KnownColor.ControlLightLight); + return ColorUtil.FromKnownColor(KnownColor.ControlLightLight); case unchecked((int)0x80000012): - return Color.FromKnownColor(KnownColor.ControlText); + return ColorUtil.FromKnownColor(KnownColor.ControlText); case unchecked((int)0x80000001): - return Color.FromKnownColor(KnownColor.Desktop); + return ColorUtil.FromKnownColor(KnownColor.Desktop); case unchecked((int)0x8000001B): - return Color.FromKnownColor(KnownColor.GradientActiveCaption); + return ColorUtil.FromKnownColor(KnownColor.GradientActiveCaption); case unchecked((int)0x8000001C): - return Color.FromKnownColor(KnownColor.GradientInactiveCaption); + return ColorUtil.FromKnownColor(KnownColor.GradientInactiveCaption); case unchecked((int)0x80000011): - return Color.FromKnownColor(KnownColor.GrayText); + return ColorUtil.FromKnownColor(KnownColor.GrayText); case unchecked((int)0x8000000D): - return Color.FromKnownColor(KnownColor.Highlight); + return ColorUtil.FromKnownColor(KnownColor.Highlight); case unchecked((int)0x8000000E): - return Color.FromKnownColor(KnownColor.HighlightText); + return ColorUtil.FromKnownColor(KnownColor.HighlightText); case unchecked((int)0x8000001A): - return Color.FromKnownColor(KnownColor.HotTrack); + return ColorUtil.FromKnownColor(KnownColor.HotTrack); case unchecked((int)0x8000000B): - return Color.FromKnownColor(KnownColor.InactiveBorder); + return ColorUtil.FromKnownColor(KnownColor.InactiveBorder); case unchecked((int)0x80000003): - return Color.FromKnownColor(KnownColor.InactiveCaption); + return ColorUtil.FromKnownColor(KnownColor.InactiveCaption); case unchecked((int)0x80000013): - return Color.FromKnownColor(KnownColor.InactiveCaptionText); + return ColorUtil.FromKnownColor(KnownColor.InactiveCaptionText); case unchecked((int)0x80000018): - return Color.FromKnownColor(KnownColor.Info); + return ColorUtil.FromKnownColor(KnownColor.Info); case unchecked((int)0x80000017): - return Color.FromKnownColor(KnownColor.InfoText); + return ColorUtil.FromKnownColor(KnownColor.InfoText); case unchecked((int)0x80000004): - return Color.FromKnownColor(KnownColor.Menu); + return ColorUtil.FromKnownColor(KnownColor.Menu); case unchecked((int)0x8000001E): - return Color.FromKnownColor(KnownColor.MenuBar); + return ColorUtil.FromKnownColor(KnownColor.MenuBar); case unchecked((int)0x8000001D): - return Color.FromKnownColor(KnownColor.MenuHighlight); + return ColorUtil.FromKnownColor(KnownColor.MenuHighlight); case unchecked((int)0x80000007): - return Color.FromKnownColor(KnownColor.MenuText); + return ColorUtil.FromKnownColor(KnownColor.MenuText); case unchecked((int)0x80000000): - return Color.FromKnownColor(KnownColor.ScrollBar); + return ColorUtil.FromKnownColor(KnownColor.ScrollBar); case unchecked((int)0x80000005): - return Color.FromKnownColor(KnownColor.Window); + return ColorUtil.FromKnownColor(KnownColor.Window); case unchecked((int)0x80000006): - return Color.FromKnownColor(KnownColor.WindowFrame); + return ColorUtil.FromKnownColor(KnownColor.WindowFrame); case unchecked((int)0x80000008): - return Color.FromKnownColor(KnownColor.WindowText); + return ColorUtil.FromKnownColor(KnownColor.WindowText); } Color color = Color.FromArgb((byte)((oleColor >> Win32RedShift) & 0xFF), @@ -274,7 +274,7 @@ namespace System.Drawing if (c.IsEmpty) return colorString; - if (c.IsSystemColor) + if (ColorUtil.IsSystemColor(c)) { switch (c.ToKnownColor()) { @@ -385,33 +385,33 @@ namespace System.Drawing private static void InitializeHtmlSysColorTable() { s_htmlSysColorTable = new Hashtable(26); - s_htmlSysColorTable["activeborder"] = Color.FromKnownColor(KnownColor.ActiveBorder); - s_htmlSysColorTable["activecaption"] = Color.FromKnownColor(KnownColor.ActiveCaption); - s_htmlSysColorTable["appworkspace"] = Color.FromKnownColor(KnownColor.AppWorkspace); - s_htmlSysColorTable["background"] = Color.FromKnownColor(KnownColor.Desktop); - s_htmlSysColorTable["buttonface"] = Color.FromKnownColor(KnownColor.Control); - s_htmlSysColorTable["buttonhighlight"] = Color.FromKnownColor(KnownColor.ControlLightLight); - s_htmlSysColorTable["buttonshadow"] = Color.FromKnownColor(KnownColor.ControlDark); - s_htmlSysColorTable["buttontext"] = Color.FromKnownColor(KnownColor.ControlText); - s_htmlSysColorTable["captiontext"] = Color.FromKnownColor(KnownColor.ActiveCaptionText); - s_htmlSysColorTable["graytext"] = Color.FromKnownColor(KnownColor.GrayText); - s_htmlSysColorTable["highlight"] = Color.FromKnownColor(KnownColor.Highlight); - s_htmlSysColorTable["highlighttext"] = Color.FromKnownColor(KnownColor.HighlightText); - s_htmlSysColorTable["inactiveborder"] = Color.FromKnownColor(KnownColor.InactiveBorder); - s_htmlSysColorTable["inactivecaption"] = Color.FromKnownColor(KnownColor.InactiveCaption); - s_htmlSysColorTable["inactivecaptiontext"] = Color.FromKnownColor(KnownColor.InactiveCaptionText); - s_htmlSysColorTable["infobackground"] = Color.FromKnownColor(KnownColor.Info); - s_htmlSysColorTable["infotext"] = Color.FromKnownColor(KnownColor.InfoText); - s_htmlSysColorTable["menu"] = Color.FromKnownColor(KnownColor.Menu); - s_htmlSysColorTable["menutext"] = Color.FromKnownColor(KnownColor.MenuText); - s_htmlSysColorTable["scrollbar"] = Color.FromKnownColor(KnownColor.ScrollBar); - s_htmlSysColorTable["threeddarkshadow"] = Color.FromKnownColor(KnownColor.ControlDarkDark); - s_htmlSysColorTable["threedface"] = Color.FromKnownColor(KnownColor.Control); - s_htmlSysColorTable["threedhighlight"] = Color.FromKnownColor(KnownColor.ControlLight); - s_htmlSysColorTable["threedlightshadow"] = Color.FromKnownColor(KnownColor.ControlLightLight); - s_htmlSysColorTable["window"] = Color.FromKnownColor(KnownColor.Window); - s_htmlSysColorTable["windowframe"] = Color.FromKnownColor(KnownColor.WindowFrame); - s_htmlSysColorTable["windowtext"] = Color.FromKnownColor(KnownColor.WindowText); + s_htmlSysColorTable["activeborder"] = ColorUtil.FromKnownColor(KnownColor.ActiveBorder); + s_htmlSysColorTable["activecaption"] = ColorUtil.FromKnownColor(KnownColor.ActiveCaption); + s_htmlSysColorTable["appworkspace"] = ColorUtil.FromKnownColor(KnownColor.AppWorkspace); + s_htmlSysColorTable["background"] = ColorUtil.FromKnownColor(KnownColor.Desktop); + s_htmlSysColorTable["buttonface"] = ColorUtil.FromKnownColor(KnownColor.Control); + s_htmlSysColorTable["buttonhighlight"] = ColorUtil.FromKnownColor(KnownColor.ControlLightLight); + s_htmlSysColorTable["buttonshadow"] = ColorUtil.FromKnownColor(KnownColor.ControlDark); + s_htmlSysColorTable["buttontext"] = ColorUtil.FromKnownColor(KnownColor.ControlText); + s_htmlSysColorTable["captiontext"] = ColorUtil.FromKnownColor(KnownColor.ActiveCaptionText); + s_htmlSysColorTable["graytext"] = ColorUtil.FromKnownColor(KnownColor.GrayText); + s_htmlSysColorTable["highlight"] = ColorUtil.FromKnownColor(KnownColor.Highlight); + s_htmlSysColorTable["highlighttext"] = ColorUtil.FromKnownColor(KnownColor.HighlightText); + s_htmlSysColorTable["inactiveborder"] = ColorUtil.FromKnownColor(KnownColor.InactiveBorder); + s_htmlSysColorTable["inactivecaption"] = ColorUtil.FromKnownColor(KnownColor.InactiveCaption); + s_htmlSysColorTable["inactivecaptiontext"] = ColorUtil.FromKnownColor(KnownColor.InactiveCaptionText); + s_htmlSysColorTable["infobackground"] = ColorUtil.FromKnownColor(KnownColor.Info); + s_htmlSysColorTable["infotext"] = ColorUtil.FromKnownColor(KnownColor.InfoText); + s_htmlSysColorTable["menu"] = ColorUtil.FromKnownColor(KnownColor.Menu); + s_htmlSysColorTable["menutext"] = ColorUtil.FromKnownColor(KnownColor.MenuText); + s_htmlSysColorTable["scrollbar"] = ColorUtil.FromKnownColor(KnownColor.ScrollBar); + s_htmlSysColorTable["threeddarkshadow"] = ColorUtil.FromKnownColor(KnownColor.ControlDarkDark); + s_htmlSysColorTable["threedface"] = ColorUtil.FromKnownColor(KnownColor.Control); + s_htmlSysColorTable["threedhighlight"] = ColorUtil.FromKnownColor(KnownColor.ControlLight); + s_htmlSysColorTable["threedlightshadow"] = ColorUtil.FromKnownColor(KnownColor.ControlLightLight); + s_htmlSysColorTable["window"] = ColorUtil.FromKnownColor(KnownColor.Window); + s_htmlSysColorTable["windowframe"] = ColorUtil.FromKnownColor(KnownColor.WindowFrame); + s_htmlSysColorTable["windowtext"] = ColorUtil.FromKnownColor(KnownColor.WindowText); } } } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.Unix.cs new file mode 100644 index 0000000000..f265fe244a --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.Unix.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace System.Drawing.Drawing2D +{ + public sealed partial class AdjustableArrowCap : CustomLineCap + { + public override object Clone() + { + IntPtr clonedCap; + int status = SafeNativeMethods.Gdip.GdipCloneCustomLineCap(new HandleRef(this, nativeCap), out clonedCap); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new AdjustableArrowCap(clonedCap); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs index 9aacda85d8..369a57b713 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; namespace System.Drawing.Drawing2D { - public sealed class AdjustableArrowCap : CustomLineCap + public sealed partial class AdjustableArrowCap : CustomLineCap { internal AdjustableArrowCap(IntPtr nativeCap) : base(nativeCap) { } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Unix.cs new file mode 100644 index 0000000000..b6f597d0fb --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Unix.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace System.Drawing.Drawing2D +{ + public partial class CustomLineCap + { + internal static CustomLineCap CreateCustomLineCapObject(IntPtr cap) + { + // libgdiplus does not implement GdipGetCustomLineCapType, so it will not correctly handle + // AdjustableArrowCap objects. + return new CustomLineCap(cap); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Windows.cs new file mode 100644 index 0000000000..942fef458d --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.Windows.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +namespace System.Drawing.Drawing2D +{ + public partial class CustomLineCap + { + internal static CustomLineCap CreateCustomLineCapObject(IntPtr cap) + { + int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapType(new HandleRef(null, cap), out CustomLineCapType capType); + + if (status != SafeNativeMethods.Gdip.Ok) + { + SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(null, cap)); + throw SafeNativeMethods.Gdip.StatusException(status); + } + + switch (capType) + { + case CustomLineCapType.Default: + return new CustomLineCap(cap); + + case CustomLineCapType.AdjustableArrowCap: + return new AdjustableArrowCap(cap); + } + + SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(null, cap)); + throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.NotImplemented); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs index 152474117d..a9c75acd0f 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCap.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; namespace System.Drawing.Drawing2D { - public class CustomLineCap : MarshalByRefObject, ICloneable, IDisposable + public partial class CustomLineCap : MarshalByRefObject, ICloneable, IDisposable { #if FINALIZATION_WATCH private string allocationSite = Graphics.GetAllocationStack(); @@ -74,7 +74,7 @@ namespace System.Drawing.Drawing2D ~CustomLineCap() => Dispose(false); - public object Clone() + public virtual object Clone() { IntPtr clonedCap; int status = SafeNativeMethods.Gdip.GdipCloneCustomLineCap(new HandleRef(this, nativeCap), out clonedCap); @@ -85,29 +85,6 @@ namespace System.Drawing.Drawing2D return CreateCustomLineCapObject(clonedCap); } - internal static CustomLineCap CreateCustomLineCapObject(IntPtr cap) - { - int status = SafeNativeMethods.Gdip.GdipGetCustomLineCapType(new HandleRef(null, cap), out CustomLineCapType capType); - - if (status != SafeNativeMethods.Gdip.Ok) - { - SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(null, cap)); - throw SafeNativeMethods.Gdip.StatusException(status); - } - - switch (capType) - { - case CustomLineCapType.Default: - return new CustomLineCap(cap); - - case CustomLineCapType.AdjustableArrowCap: - return new AdjustableArrowCap(cap); - } - - SafeNativeMethods.Gdip.GdipDeleteCustomLineCap(new HandleRef(null, cap)); - throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.NotImplemented); - } - public void SetStrokeCaps(LineCap startCap, LineCap endCap) { int status = SafeNativeMethods.Gdip.GdipSetCustomLineCapStrokeCaps(new HandleRef(this, nativeCap), startCap, endCap); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.Unix.cs new file mode 100644 index 0000000000..1260c98a5c --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.Unix.cs @@ -0,0 +1,912 @@ +// +// System.Drawing.Drawing2D.GraphicsPath.cs +// +// Authors: +// +// Miguel de Icaza (miguel@ximian.com) +// Duncan Mak (duncan@ximian.com) +// Jordi Mas i Hernandez (jordi@ximian.com) +// Ravindra (rkumar@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2004,2006-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.ComponentModel; +using System.Runtime.InteropServices; + +namespace System.Drawing.Drawing2D +{ + public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable + { + // 1/4 is the FlatnessDefault as defined in GdiPlusEnums.h + private const float FlatnessDefault = 1.0f / 4.0f; + + internal IntPtr nativePath = IntPtr.Zero; + + GraphicsPath(IntPtr ptr) + { + nativePath = ptr; + } + + public GraphicsPath() + { + int status = SafeNativeMethods.Gdip.GdipCreatePath(FillMode.Alternate, out nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public GraphicsPath(FillMode fillMode) + { + int status = SafeNativeMethods.Gdip.GdipCreatePath(fillMode, out nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public GraphicsPath(Point[] pts, byte[] types) + : this(pts, types, FillMode.Alternate) + { + } + + public GraphicsPath(PointF[] pts, byte[] types) + : this(pts, types, FillMode.Alternate) + { + } + + public GraphicsPath(Point[] pts, byte[] types, FillMode fillMode) + { + if (pts == null) + throw new ArgumentNullException("pts"); + if (pts.Length != types.Length) + throw new ArgumentException("Invalid parameter passed. Number of points and types must be same."); + + int status = SafeNativeMethods.Gdip.GdipCreatePath2I(pts, types, pts.Length, fillMode, out nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public GraphicsPath(PointF[] pts, byte[] types, FillMode fillMode) + { + if (pts == null) + throw new ArgumentNullException("pts"); + if (pts.Length != types.Length) + throw new ArgumentException("Invalid parameter passed. Number of points and types must be same."); + + int status = SafeNativeMethods.Gdip.GdipCreatePath2(pts, types, pts.Length, fillMode, out nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public object Clone() + { + IntPtr clone; + + int status = SafeNativeMethods.Gdip.GdipClonePath(nativePath, out clone); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new GraphicsPath(clone); + } + + public void Dispose() + { + Dispose(true); + System.GC.SuppressFinalize(this); + } + + ~GraphicsPath() + { + Dispose(false); + } + + void Dispose(bool disposing) + { + int status; + if (nativePath != IntPtr.Zero) + { + status = SafeNativeMethods.Gdip.GdipDeletePath(nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + + nativePath = IntPtr.Zero; + } + } + + public FillMode FillMode + { + get + { + FillMode mode; + int status = SafeNativeMethods.Gdip.GdipGetPathFillMode(nativePath, out mode); + SafeNativeMethods.Gdip.CheckStatus(status); + + return mode; + } + set + { + if ((value < FillMode.Alternate) || (value > FillMode.Winding)) + throw new InvalidEnumArgumentException("FillMode", (int)value, typeof(FillMode)); + + int status = SafeNativeMethods.Gdip.GdipSetPathFillMode(nativePath, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public PathData PathData + { + get + { + int count; + int status = SafeNativeMethods.Gdip.GdipGetPointCount(nativePath, out count); + SafeNativeMethods.Gdip.CheckStatus(status); + + PointF[] points = new PointF[count]; + byte[] types = new byte[count]; + + // status would fail if we ask points or types with a 0 count + // anyway that would only mean two unrequired unmanaged calls + if (count > 0) + { + status = SafeNativeMethods.Gdip.GdipGetPathPoints(nativePath, points, count); + SafeNativeMethods.Gdip.CheckStatus(status); + + status = SafeNativeMethods.Gdip.GdipGetPathTypes(nativePath, types, count); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + PathData pdata = new PathData(); + pdata.Points = points; + pdata.Types = types; + return pdata; + } + } + + public PointF[] PathPoints + { + get + { + int count; + int status = SafeNativeMethods.Gdip.GdipGetPointCount(nativePath, out count); + SafeNativeMethods.Gdip.CheckStatus(status); + if (count == 0) + throw new ArgumentException("PathPoints"); + + PointF[] points = new PointF[count]; + status = SafeNativeMethods.Gdip.GdipGetPathPoints(nativePath, points, count); + SafeNativeMethods.Gdip.CheckStatus(status); + + return points; + } + } + + public byte[] PathTypes + { + get + { + int count; + int status = SafeNativeMethods.Gdip.GdipGetPointCount(nativePath, out count); + SafeNativeMethods.Gdip.CheckStatus(status); + if (count == 0) + throw new ArgumentException("PathTypes"); + + byte[] types = new byte[count]; + status = SafeNativeMethods.Gdip.GdipGetPathTypes(nativePath, types, count); + SafeNativeMethods.Gdip.CheckStatus(status); + + return types; + } + } + + public int PointCount + { + get + { + int count; + int status = SafeNativeMethods.Gdip.GdipGetPointCount(nativePath, out count); + SafeNativeMethods.Gdip.CheckStatus(status); + + return count; + } + } + + internal IntPtr NativeObject + { + get + { + return nativePath; + } + set + { + nativePath = value; + } + } + + // + // AddArc + // + public void AddArc(Rectangle rect, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathArcI(nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddArc(RectangleF rect, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathArc(nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddArc(int x, int y, int width, int height, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathArcI(nativePath, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathArc(nativePath, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddBezier + // + public void AddBezier(Point pt1, Point pt2, Point pt3, Point pt4) + { + int status = SafeNativeMethods.Gdip.GdipAddPathBezierI(nativePath, pt1.X, pt1.Y, + pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddBezier(PointF pt1, PointF pt2, PointF pt3, PointF pt4) + { + int status = SafeNativeMethods.Gdip.GdipAddPathBezier(nativePath, pt1.X, pt1.Y, + pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddBezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) + { + int status = SafeNativeMethods.Gdip.GdipAddPathBezierI(nativePath, x1, y1, x2, y2, x3, y3, x4, y4); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddBezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) + { + int status = SafeNativeMethods.Gdip.GdipAddPathBezier(nativePath, x1, y1, x2, y2, x3, y3, x4, y4); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddBeziers + // + public void AddBeziers(params Point[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipAddPathBeziersI(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddBeziers(PointF[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipAddPathBeziers(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddEllipse + // + public void AddEllipse(RectangleF rect) + { + int status = SafeNativeMethods.Gdip.GdipAddPathEllipse(nativePath, rect.X, rect.Y, rect.Width, rect.Height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddEllipse(float x, float y, float width, float height) + { + int status = SafeNativeMethods.Gdip.GdipAddPathEllipse(nativePath, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddEllipse(Rectangle rect) + { + int status = SafeNativeMethods.Gdip.GdipAddPathEllipseI(nativePath, rect.X, rect.Y, rect.Width, rect.Height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddEllipse(int x, int y, int width, int height) + { + int status = SafeNativeMethods.Gdip.GdipAddPathEllipseI(nativePath, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + + // + // AddLine + // + public void AddLine(Point pt1, Point pt2) + { + int status = SafeNativeMethods.Gdip.GdipAddPathLineI(nativePath, pt1.X, pt1.Y, pt2.X, pt2.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddLine(PointF pt1, PointF pt2) + { + int status = SafeNativeMethods.Gdip.GdipAddPathLine(nativePath, pt1.X, pt1.Y, pt2.X, + pt2.Y); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddLine(int x1, int y1, int x2, int y2) + { + int status = SafeNativeMethods.Gdip.GdipAddPathLineI(nativePath, x1, y1, x2, y2); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddLine(float x1, float y1, float x2, float y2) + { + int status = SafeNativeMethods.Gdip.GdipAddPathLine(nativePath, x1, y1, x2, + y2); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddLines + // + public void AddLines(Point[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + if (points.Length == 0) + throw new ArgumentException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathLine2I(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddLines(PointF[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + if (points.Length == 0) + throw new ArgumentException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathLine2(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddPie + // + public void AddPie(Rectangle rect, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathPie( + nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddPie(int x, int y, int width, int height, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathPieI(nativePath, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle) + { + int status = SafeNativeMethods.Gdip.GdipAddPathPie(nativePath, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddPolygon + // + public void AddPolygon(Point[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathPolygonI(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddPolygon(PointF[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathPolygon(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddRectangle + // + public void AddRectangle(Rectangle rect) + { + int status = SafeNativeMethods.Gdip.GdipAddPathRectangleI(nativePath, rect.X, rect.Y, rect.Width, rect.Height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddRectangle(RectangleF rect) + { + int status = SafeNativeMethods.Gdip.GdipAddPathRectangle(nativePath, rect.X, rect.Y, rect.Width, rect.Height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddRectangles + // + public void AddRectangles(Rectangle[] rects) + { + if (rects == null) + throw new ArgumentNullException("rects"); + if (rects.Length == 0) + throw new ArgumentException("rects"); + + int status = SafeNativeMethods.Gdip.GdipAddPathRectanglesI(nativePath, rects, rects.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddRectangles(RectangleF[] rects) + { + if (rects == null) + throw new ArgumentNullException("rects"); + if (rects.Length == 0) + throw new ArgumentException("rects"); + + int status = SafeNativeMethods.Gdip.GdipAddPathRectangles(nativePath, rects, rects.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddPath + // + public void AddPath(GraphicsPath addingPath, bool connect) + { + if (addingPath == null) + throw new ArgumentNullException("addingPath"); + + int status = SafeNativeMethods.Gdip.GdipAddPathPath(nativePath, addingPath.nativePath, connect); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public PointF GetLastPoint() + { + PointF pt; + int status = SafeNativeMethods.Gdip.GdipGetPathLastPoint(nativePath, out pt); + SafeNativeMethods.Gdip.CheckStatus(status); + + return pt; + } + + // + // AddClosedCurve + // + public void AddClosedCurve(Point[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurveI(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddClosedCurve(PointF[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurve(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddClosedCurve(Point[] points, float tension) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurve2I(nativePath, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddClosedCurve(PointF[] points, float tension) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathClosedCurve2(nativePath, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // + // AddCurve + // + public void AddCurve(Point[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathCurveI(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddCurve(PointF[] points) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathCurve(nativePath, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddCurve(Point[] points, float tension) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathCurve2I(nativePath, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddCurve(PointF[] points, float tension) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathCurve2(nativePath, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddCurve(Point[] points, int offset, int numberOfSegments, float tension) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathCurve3I(nativePath, points, points.Length, + offset, numberOfSegments, tension); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void AddCurve(PointF[] points, int offset, int numberOfSegments, float tension) + { + if (points == null) + throw new ArgumentNullException("points"); + + int status = SafeNativeMethods.Gdip.GdipAddPathCurve3(nativePath, points, points.Length, + offset, numberOfSegments, tension); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void Reset() + { + int status = SafeNativeMethods.Gdip.GdipResetPath(nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void Reverse() + { + int status = SafeNativeMethods.Gdip.GdipReversePath(nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void Transform(Matrix matrix) + { + if (matrix == null) + throw new ArgumentNullException("matrix"); + + int status = SafeNativeMethods.Gdip.GdipTransformPath(nativePath, matrix.nativeMatrix); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + [MonoTODO("The StringFormat parameter is ignored when using libgdiplus.")] + public void AddString(string s, FontFamily family, int style, float emSize, Point origin, StringFormat format) + { + Rectangle layout = new Rectangle(); + layout.X = origin.X; + layout.Y = origin.Y; + AddString(s, family, style, emSize, layout, format); + } + + [MonoTODO("The StringFormat parameter is ignored when using libgdiplus.")] + public void AddString(string s, FontFamily family, int style, float emSize, PointF origin, StringFormat format) + { + RectangleF layout = new RectangleF(); + layout.X = origin.X; + layout.Y = origin.Y; + AddString(s, family, style, emSize, layout, format); + } + + [MonoTODO("The layoutRect and StringFormat parameters are ignored when using libgdiplus.")] + public void AddString(string s, FontFamily family, int style, float emSize, Rectangle layoutRect, StringFormat format) + { + if (family == null) + throw new ArgumentException("family"); + + IntPtr sformat = (format == null) ? IntPtr.Zero : format.nativeFormat; + // note: the NullReferenceException on s.Length is the expected (MS) exception + int status = SafeNativeMethods.Gdip.GdipAddPathStringI(nativePath, s, s.Length, family.NativeFamily, style, emSize, ref layoutRect, sformat); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + [MonoTODO("The layoutRect and StringFormat parameters are ignored when using libgdiplus.")] + public void AddString(string s, FontFamily family, int style, float emSize, RectangleF layoutRect, StringFormat format) + { + if (family == null) + throw new ArgumentException("family"); + + IntPtr sformat = (format == null) ? IntPtr.Zero : format.nativeFormat; + // note: the NullReferenceException on s.Length is the expected (MS) exception + int status = SafeNativeMethods.Gdip.GdipAddPathString(nativePath, s, s.Length, family.NativeFamily, style, emSize, ref layoutRect, sformat); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void ClearMarkers() + { + int s = SafeNativeMethods.Gdip.GdipClearPathMarkers(nativePath); + + SafeNativeMethods.Gdip.CheckStatus(s); + } + + public void CloseAllFigures() + { + int s = SafeNativeMethods.Gdip.GdipClosePathFigures(nativePath); + + SafeNativeMethods.Gdip.CheckStatus(s); + } + + public void CloseFigure() + { + int s = SafeNativeMethods.Gdip.GdipClosePathFigure(nativePath); + + SafeNativeMethods.Gdip.CheckStatus(s); + } + + public void Flatten() + { + Flatten(null, FlatnessDefault); + } + + public void Flatten(Matrix matrix) + { + Flatten(matrix, FlatnessDefault); + } + + public void Flatten(Matrix matrix, float flatness) + { + IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix; + int status = SafeNativeMethods.Gdip.GdipFlattenPath(nativePath, m, flatness); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public RectangleF GetBounds() + { + return GetBounds(null, null); + } + + public RectangleF GetBounds(Matrix matrix) + { + return GetBounds(matrix, null); + } + + public RectangleF GetBounds(Matrix matrix, Pen pen) + { + RectangleF retval; + IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix; + IntPtr p = (pen == null) ? IntPtr.Zero : pen.NativePen; + + int s = SafeNativeMethods.Gdip.GdipGetPathWorldBounds(nativePath, out retval, m, p); + + SafeNativeMethods.Gdip.CheckStatus(s); + + return retval; + } + + public bool IsOutlineVisible(Point point, Pen pen) + { + return IsOutlineVisible(point.X, point.Y, pen, null); + } + + public bool IsOutlineVisible(PointF point, Pen pen) + { + return IsOutlineVisible(point.X, point.Y, pen, null); + } + + public bool IsOutlineVisible(int x, int y, Pen pen) + { + return IsOutlineVisible(x, y, pen, null); + } + + public bool IsOutlineVisible(float x, float y, Pen pen) + { + return IsOutlineVisible(x, y, pen, null); + } + + public bool IsOutlineVisible(Point pt, Pen pen, Graphics graphics) + { + return IsOutlineVisible(pt.X, pt.Y, pen, graphics); + } + + public bool IsOutlineVisible(PointF pt, Pen pen, Graphics graphics) + { + return IsOutlineVisible(pt.X, pt.Y, pen, graphics); + } + + public bool IsOutlineVisible(int x, int y, Pen pen, Graphics graphics) + { + if (pen == null) + throw new ArgumentNullException("pen"); + + bool result; + IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject; + + int s = SafeNativeMethods.Gdip.GdipIsOutlineVisiblePathPointI(nativePath, x, y, pen.NativePen, g, out result); + SafeNativeMethods.Gdip.CheckStatus(s); + + return result; + } + + public bool IsOutlineVisible(float x, float y, Pen pen, Graphics graphics) + { + if (pen == null) + throw new ArgumentNullException("pen"); + + bool result; + IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject; + + int s = SafeNativeMethods.Gdip.GdipIsOutlineVisiblePathPoint(nativePath, x, y, pen.NativePen, g, out result); + SafeNativeMethods.Gdip.CheckStatus(s); + + return result; + } + + public bool IsVisible(Point point) + { + return IsVisible(point.X, point.Y, null); + } + + public bool IsVisible(PointF point) + { + return IsVisible(point.X, point.Y, null); + } + + public bool IsVisible(int x, int y) + { + return IsVisible(x, y, null); + } + + public bool IsVisible(float x, float y) + { + return IsVisible(x, y, null); + } + + public bool IsVisible(Point pt, Graphics graphics) + { + return IsVisible(pt.X, pt.Y, graphics); + } + + public bool IsVisible(PointF pt, Graphics graphics) + { + return IsVisible(pt.X, pt.Y, graphics); + } + + public bool IsVisible(int x, int y, Graphics graphics) + { + bool retval; + + IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject; + + int s = SafeNativeMethods.Gdip.GdipIsVisiblePathPointI(nativePath, x, y, g, out retval); + + SafeNativeMethods.Gdip.CheckStatus(s); + + return retval; + } + + public bool IsVisible(float x, float y, Graphics graphics) + { + bool retval; + + IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject; + + int s = SafeNativeMethods.Gdip.GdipIsVisiblePathPoint(nativePath, x, y, g, out retval); + + SafeNativeMethods.Gdip.CheckStatus(s); + + return retval; + } + + public void SetMarkers() + { + int s = SafeNativeMethods.Gdip.GdipSetPathMarker(nativePath); + + SafeNativeMethods.Gdip.CheckStatus(s); + } + + public void StartFigure() + { + int s = SafeNativeMethods.Gdip.GdipStartPathFigure(nativePath); + + SafeNativeMethods.Gdip.CheckStatus(s); + } + + [MonoTODO("GdipWarpPath isn't implemented in libgdiplus")] + public void Warp(PointF[] destPoints, RectangleF srcRect) + { + Warp(destPoints, srcRect, null, WarpMode.Perspective, FlatnessDefault); + } + + [MonoTODO("GdipWarpPath isn't implemented in libgdiplus")] + public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix) + { + Warp(destPoints, srcRect, matrix, WarpMode.Perspective, FlatnessDefault); + } + + [MonoTODO("GdipWarpPath isn't implemented in libgdiplus")] + public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode) + { + Warp(destPoints, srcRect, matrix, warpMode, FlatnessDefault); + } + + [MonoTODO("GdipWarpPath isn't implemented in libgdiplus")] + public void Warp(PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode, float flatness) + { + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + + IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix; + + int s = SafeNativeMethods.Gdip.GdipWarpPath(nativePath, m, destPoints, destPoints.Length, + srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode, flatness); + + SafeNativeMethods.Gdip.CheckStatus(s); + } + + [MonoTODO("GdipWidenPath isn't implemented in libgdiplus")] + public void Widen(Pen pen) + { + Widen(pen, null, FlatnessDefault); + } + + [MonoTODO("GdipWidenPath isn't implemented in libgdiplus")] + public void Widen(Pen pen, Matrix matrix) + { + Widen(pen, matrix, FlatnessDefault); + } + + [MonoTODO("GdipWidenPath isn't implemented in libgdiplus")] + public void Widen(Pen pen, Matrix matrix, float flatness) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (PointCount == 0) + return; + IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix; + + int s = SafeNativeMethods.Gdip.GdipWidenPath(nativePath, pen.NativePen, m, flatness); + SafeNativeMethods.Gdip.CheckStatus(s); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPath.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs index cb9c34c62a..2e59504744 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/GraphicsPathIterator.cs @@ -164,7 +164,7 @@ namespace System.Drawing.Drawing2D throw SafeNativeMethods.Gdip.StatusException(status); } - public int Enumerate(ref PointF[] points, ref byte[] types) + public unsafe int Enumerate(ref PointF[] points, ref byte[] types) { if (points.Length != types.Length) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); @@ -187,7 +187,7 @@ namespace System.Drawing.Drawing2D if (resultCount < count) { - SafeNativeMethods.ZeroMemory((IntPtr)(checked((long)memoryPts + resultCount * size)), (UIntPtr)((count - resultCount) * size)); + SafeNativeMethods.ZeroMemory((byte*)(checked((long)memoryPts + resultCount * size)), (ulong)((count - resultCount) * size)); } points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(memoryPts, count); @@ -201,7 +201,7 @@ namespace System.Drawing.Drawing2D return resultCount; } - public int CopyData(ref PointF[] points, ref byte[] types, int startIndex, int endIndex) + public unsafe int CopyData(ref PointF[] points, ref byte[] types, int startIndex, int endIndex) { if ((points.Length != types.Length) || (endIndex - startIndex + 1 > points.Length)) throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); @@ -224,7 +224,7 @@ namespace System.Drawing.Drawing2D if (resultCount < count) { - SafeNativeMethods.ZeroMemory((IntPtr)(checked((long)memoryPts + resultCount * size)), (UIntPtr)((count - resultCount) * size)); + SafeNativeMethods.ZeroMemory((byte*)(checked((long)memoryPts + resultCount * size)), (ulong)((count - resultCount) * size)); } points = SafeNativeMethods.Gdip.ConvertGPPOINTFArrayF(memoryPts, count); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs index 68e539988d..43ea6829e2 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs @@ -15,6 +15,11 @@ namespace System.Drawing.Drawing2D public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { + if (hatchstyle < HatchStyle.Min || hatchstyle > HatchStyle.SolidDiamond) + { + throw new ArgumentException(SR.Format(SR.InvalidEnumArgument, nameof(hatchstyle), hatchstyle, nameof(HatchStyle)), nameof(hatchstyle)); + } + IntPtr nativeBrush; int status = SafeNativeMethods.Gdip.GdipCreateHatchBrush(unchecked((int)hatchstyle), foreColor.ToArgb(), backColor.ToArgb(), out nativeBrush); SafeNativeMethods.Gdip.CheckStatus(status); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs index f46f95442a..162a4735ec 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/LinearGradientBrush.cs @@ -266,9 +266,41 @@ namespace System.Drawing.Drawing2D } set { - // Allocate temporary native memory buffer and copy input blend factors into it. + // Do explicit parameter validation here; libgdiplus does not correctly validate the arguments + if (value == null || value.Factors == null) + { + // This is the original behavior on Desktop .NET + throw new NullReferenceException(); + } + + if (value.Positions == null) + { + throw new ArgumentNullException("source"); + } + int count = value.Factors.Length; + if (count == 0 || value.Positions.Length == 0) + { + throw new ArgumentException(SR.BlendObjectMustHaveTwoElements); + } + + if (count >=2 && count != value.Positions.Length) + { + throw new ArgumentOutOfRangeException(); + } + + if (count >= 2 && value.Positions[0] != 0.0F) + { + throw new ArgumentException(SR.BlendObjectFirstElementInvalid); + } + + if (count >= 2 && value.Positions[count - 1] != 1.0F) + { + throw new ArgumentException(SR.BlendObjectLastElementInvalid); + } + + // Allocate temporary native memory buffer and copy input blend factors into it. IntPtr factors = IntPtr.Zero; IntPtr positions = IntPtr.Zero; @@ -303,9 +335,14 @@ namespace System.Drawing.Drawing2D public void SetSigmaBellShape(float focus, float scale) { - if (focus < 0 || focus > 1 || scale < 0 || scale > 1) + if (focus < 0 || focus > 1) { - throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(focus)); + } + + if (scale < 0 || scale > 1) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(scale)); } int status = SafeNativeMethods.Gdip.GdipSetLineSigmaBlend(new HandleRef(this, NativeBrush), focus, scale); @@ -316,13 +353,25 @@ namespace System.Drawing.Drawing2D public void SetBlendTriangularShape(float focus, float scale) { - if (focus < 0 || focus > 1 || scale < 0 || scale > 1) + if (focus < 0 || focus > 1) { - throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(focus)); + } + + if (scale < 0 || scale > 1) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(scale)); } int status = SafeNativeMethods.Gdip.GdipSetLineLinearBlend(new HandleRef(this, NativeBrush), focus, scale); SafeNativeMethods.Gdip.CheckStatus(status); + + // Setting a triangular shape overrides the explicitly set interpolation colors. libgdiplus correctly clears + // the interpolation colors (https://github.com/mono/libgdiplus/blob/master/src/lineargradientbrush.c#L959) but + // returns WrongState instead of ArgumentException (https://github.com/mono/libgdiplus/blob/master/src/lineargradientbrush.c#L814) + // when calling GdipGetLinePresetBlend, so it is important we set this to false. This way, we are sure get_InterpolationColors + // will return an ArgumentException. + _interpolationColorsWasSet = false; } public ColorBlend InterpolationColors @@ -492,7 +541,7 @@ namespace System.Drawing.Drawing2D { if (value == null) { - throw new ArgumentNullException("matrix"); + throw new ArgumentNullException(nameof(value)); } int status = SafeNativeMethods.Gdip.GdipSetLineTransform(new HandleRef(this, NativeBrush), new HandleRef(value, value.nativeMatrix)); @@ -515,6 +564,13 @@ namespace System.Drawing.Drawing2D throw new ArgumentNullException(nameof(matrix)); } + // Multiplying the transform by a disposed matrix is a nop in GDI+, but throws + // with the libgdiplus backend. Simulate a nop for compatability with GDI+. + if (matrix.nativeMatrix == IntPtr.Zero) + { + return; + } + int status = SafeNativeMethods.Gdip.GdipMultiplyLineTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix), order); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs index 99a2a84ced..4bd39c992c 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Matrix.cs @@ -170,7 +170,12 @@ namespace System.Drawing.Drawing2D { if (matrix == null) { - throw new ArgumentNullException("matrix"); + throw new ArgumentNullException(nameof(matrix)); + } + + if (matrix.nativeMatrix == nativeMatrix) + { + throw new InvalidOperationException(SR.GdiplusObjectBusy); } int status = SafeNativeMethods.Gdip.GdipMultiplyMatrix(new HandleRef(this, nativeMatrix), new HandleRef(matrix, matrix.nativeMatrix), diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs index 2896a1002f..a268e66aad 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/PathGradientBrush.cs @@ -173,26 +173,16 @@ namespace System.Drawing.Drawing2D } set { - int status = SafeNativeMethods.Gdip.GdipGetPathGradientSurroundColorCount(new HandleRef(this, NativeBrush), - out int count); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - if ((value.Length > count) || (count <= 0)) - throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.InvalidParameter); - - count = value.Length; + int count = value.Length; int[] argbs = new int[count]; for (int i = 0; i < value.Length; i++) argbs[i] = value[i].ToArgb(); - status = SafeNativeMethods.Gdip.GdipSetPathGradientSurroundColorsWithCount(new HandleRef(this, NativeBrush), + int status = SafeNativeMethods.Gdip.GdipSetPathGradientSurroundColorsWithCount(new HandleRef(this, NativeBrush), argbs, ref count); - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); + SafeNativeMethods.Gdip.CheckStatus(status); } } @@ -237,7 +227,8 @@ namespace System.Drawing.Drawing2D public Blend Blend { get - { // Figure out the size of blend factor array + { + // Figure out the size of blend factor array int status = SafeNativeMethods.Gdip.GdipGetPathGradientBlendCount(new HandleRef(this, NativeBrush), out int retval); if (status != SafeNativeMethods.Gdip.Ok) @@ -249,52 +240,66 @@ namespace System.Drawing.Drawing2D int count = retval; - IntPtr factors = IntPtr.Zero; - IntPtr positions = IntPtr.Zero; + var factors = new float[count]; + var positions = new float[count]; - try + // Retrieve horizontal blend factors + + status = SafeNativeMethods.Gdip.GdipGetPathGradientBlend(new HandleRef(this, NativeBrush), factors, positions, count); + + if (status != SafeNativeMethods.Gdip.Ok) { - int size = checked(4 * count); - factors = Marshal.AllocHGlobal(size); - positions = Marshal.AllocHGlobal(size); - - // Retrieve horizontal blend factors - - status = SafeNativeMethods.Gdip.GdipGetPathGradientBlend(new HandleRef(this, NativeBrush), factors, positions, count); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - // Return the result in a managed array - - Blend blend = new Blend(count); - - Marshal.Copy(factors, blend.Factors, 0, count); - Marshal.Copy(positions, blend.Positions, 0, count); - - return blend; - } - finally - { - if (factors != IntPtr.Zero) - { - Marshal.FreeHGlobal(factors); - } - if (positions != IntPtr.Zero) - { - Marshal.FreeHGlobal(positions); - } + throw SafeNativeMethods.Gdip.StatusException(status); } + + // Return the result in a managed array + + Blend blend = new Blend(count); + blend.Factors = factors; + blend.Positions = positions; + + return blend; } set { - // Allocate temporary native memory buffer - // and copy input blend factors into it. + if (value == null || value.Factors == null) + { + // This is the behavior on Desktop + throw new NullReferenceException(); + } + + // The Desktop implementation throws ArgumentNullException("source") because it never validates the value of value.Positions, and then passes it + // on to Marshal.Copy(value.Positions, 0, positions, count);. The first argument of Marshal.Copy is source, hence this exception. + if (value.Positions == null) + { + throw new ArgumentNullException("source"); + } int count = value.Factors.Length; + // Explicit argument validation, because libgdiplus does not correctly validate all parameters. + if (count == 0 || value.Positions.Length == 0) + { + throw new ArgumentException(SR.BlendObjectMustHaveTwoElements); + } + + if (count >= 2 && count != value.Positions.Length) + { + throw new ArgumentOutOfRangeException(); + } + + if (count >= 2 && value.Positions[0] != 0.0F) + { + throw new ArgumentException(SR.BlendObjectFirstElementInvalid); + } + + if (count >= 2 && value.Positions[count - 1] != 1.0F) + { + throw new ArgumentException(SR.BlendObjectLastElementInvalid); + } + + // Allocate temporary native memory buffer + // and copy input blend factors into it. IntPtr factors = IntPtr.Zero; IntPtr positions = IntPtr.Zero; @@ -334,30 +339,36 @@ namespace System.Drawing.Drawing2D public void SetSigmaBellShape(float focus, float scale) { - if (focus < 0 || focus > 1 || scale < 0 || scale > 1) + if (focus < 0 || focus > 1) { - throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(focus)); + } + + if (scale < 0 || scale > 1) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(scale)); } int status = SafeNativeMethods.Gdip.GdipSetPathGradientSigmaBlend(new HandleRef(this, NativeBrush), focus, scale); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); + SafeNativeMethods.Gdip.CheckStatus(status); } public void SetBlendTriangularShape(float focus) => SetBlendTriangularShape(focus, (float)1.0); public void SetBlendTriangularShape(float focus, float scale) { - if (focus < 0 || focus > 1 || scale < 0 || scale > 1) + if (focus < 0 || focus > 1) { - throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(focus)); + } + + if (scale < 0 || scale > 1) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter), nameof(scale)); } int status = SafeNativeMethods.Gdip.GdipSetPathGradientLinearBlend(new HandleRef(this, NativeBrush), focus, scale); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); + SafeNativeMethods.Gdip.CheckStatus(status); } public ColorBlend InterpolationColors @@ -365,118 +376,76 @@ namespace System.Drawing.Drawing2D get { // Figure out the size of blend factor array - int status = SafeNativeMethods.Gdip.GdipGetPathGradientPresetBlendCount(new HandleRef(this, NativeBrush), out int retval); + int status = SafeNativeMethods.Gdip.GdipGetPathGradientPresetBlendCount(new HandleRef(this, NativeBrush), out int count); + SafeNativeMethods.Gdip.CheckStatus(status); - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - // If retVal is 0, then there is nothing to marshal. + // If count is 0, then there is nothing to marshal. // In this case, we'll return an empty ColorBlend... - // - if (retval == 0) + if (count == 0) { return new ColorBlend(); } - // Allocate temporary native memory buffer + int[] colors = new int[count]; + float[] positions = new float[count]; - int count = retval; + ColorBlend blend = new ColorBlend(count); - IntPtr colors = IntPtr.Zero; - IntPtr positions = IntPtr.Zero; - - try + // status would fail if we ask points or types with a < 2 count + if (count > 1) { - int size = checked(4 * count); - colors = Marshal.AllocHGlobal(size); - positions = Marshal.AllocHGlobal(size); - // Retrieve horizontal blend factors - status = SafeNativeMethods.Gdip.GdipGetPathGradientPresetBlend(new HandleRef(this, NativeBrush), colors, positions, count); - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } + SafeNativeMethods.Gdip.CheckStatus(status); // Return the result in a managed array - ColorBlend blend = new ColorBlend(count); - - int[] argb = new int[count]; - Marshal.Copy(colors, argb, 0, count); - Marshal.Copy(positions, blend.Positions, 0, count); + blend.Positions = positions; // copy ARGB values into Color array of ColorBlend - blend.Colors = new Color[argb.Length]; + blend.Colors = new Color[count]; - for (int i = 0; i < argb.Length; i++) + for (int i = 0; i < count; i++) { - blend.Colors[i] = Color.FromArgb(argb[i]); - } - - return blend; - } - finally - { - if (colors != IntPtr.Zero) - { - Marshal.FreeHGlobal(colors); - } - if (positions != IntPtr.Zero) - { - Marshal.FreeHGlobal(positions); + blend.Colors[i] = Color.FromArgb(colors[i]); } } + + return blend; } set { - // Allocate temporary native memory buffer - // and copy input blend factors into it. - + // The Desktop implementation will throw various exceptions - ranging from NullReferenceExceptions to Argument(OutOfRange)Exceptions + // depending on how sane the input is. These checks exist to replicate the exact Desktop behavior. int count = value.Colors.Length; - IntPtr colors = IntPtr.Zero; - IntPtr positions = IntPtr.Zero; - - try + if (value.Positions == null) { - int size = checked(4 * count); - colors = Marshal.AllocHGlobal(size); - positions = Marshal.AllocHGlobal(size); - - int[] argbs = new int[count]; - for (int i = 0; i < count; i++) - { - argbs[i] = value.Colors[i].ToArgb(); - } - - Marshal.Copy(argbs, 0, colors, count); - Marshal.Copy(value.Positions, 0, positions, count); - - // Set blend factors - - int status = SafeNativeMethods.Gdip.GdipSetPathGradientPresetBlend(new HandleRef(this, NativeBrush), new HandleRef(null, colors), new HandleRef(null, positions), count); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } + throw new ArgumentNullException("source"); } - finally + + if (value.Colors.Length > value.Positions.Length) { - if (colors != IntPtr.Zero) - { - Marshal.FreeHGlobal(colors); - } - if (positions != IntPtr.Zero) - { - Marshal.FreeHGlobal(positions); - } + throw new ArgumentOutOfRangeException(); } + + if (value.Colors.Length < value.Positions.Length) + { + throw new ArgumentException(); + } + + float[] positions = value.Positions; + int[] argbs = new int[count]; + for (int i = 0; i < count; i++) + { + argbs[i] = value.Colors[i].ToArgb(); + } + + // Set blend factors + int status = SafeNativeMethods.Gdip.GdipSetPathGradientPresetBlend(new HandleRef(this, NativeBrush), argbs, positions, count); + + SafeNativeMethods.Gdip.CheckStatus(status); } } @@ -487,21 +456,19 @@ namespace System.Drawing.Drawing2D Matrix matrix = new Matrix(); int status = SafeNativeMethods.Gdip.GdipGetPathGradientTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix)); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); + SafeNativeMethods.Gdip.CheckStatus(status); return matrix; } set { if (value == null) - throw new ArgumentNullException("matrix"); + { + throw new ArgumentNullException(nameof(value)); + } int status = SafeNativeMethods.Gdip.GdipSetPathGradientTransform(new HandleRef(this, NativeBrush), new HandleRef(value, value.nativeMatrix)); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); + SafeNativeMethods.Gdip.CheckStatus(status); } } @@ -518,14 +485,21 @@ namespace System.Drawing.Drawing2D public void MultiplyTransform(Matrix matrix, MatrixOrder order) { if (matrix == null) - throw new ArgumentNullException("matrix"); + { + throw new ArgumentNullException(nameof(matrix)); + } + + // Multiplying the transform by a disposed matrix is a nop in GDI+, but throws + // with the libgdiplus backend. Simulate a nop for compatability with GDI+. + if (matrix.nativeMatrix == IntPtr.Zero) + { + return; + } int status = SafeNativeMethods.Gdip.GdipMultiplyPathGradientTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix), order); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); + SafeNativeMethods.Gdip.CheckStatus(status); } public void TranslateTransform(float dx, float dy) => TranslateTransform(dx, dy, MatrixOrder.Prepend); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.NotSerializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.NotSerializable.cs new file mode 100644 index 0000000000..d4bf27db71 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.NotSerializable.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; + +namespace System.Drawing +{ + partial class Font + { + void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Serializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Serializable.cs index 8e42433fc4..b0f3e4ccde 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Serializable.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Serializable.cs @@ -10,7 +10,7 @@ using System.Security.Permissions; namespace System.Drawing { [Serializable] - partial class Font : ISerializable + partial class Font { private Font(SerializationInfo info, StreamingContext context) { diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Unix.cs new file mode 100644 index 0000000000..2f360846f1 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Unix.cs @@ -0,0 +1,719 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Fonts.cs +// +// Authors: +// Alexandre Pigolkine (pigolkine@gmx.de) +// Miguel de Icaza (miguel@ximian.com) +// Todd Berman (tberman@sevenl.com) +// Jordi Mas i Hernandez (jordi@ximian.com) +// Ravindra (rkumar@novell.com) +// +// Copyright (C) 2004 Ximian, Inc. (http://www.ximian.com) +// Copyright (C) 2004, 2006 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.Reflection; +using System.Runtime.Serialization; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace System.Drawing +{ + [Serializable] + [ComVisible(true)] +#if !NETCORE + [Editor ("System.Drawing.Design.FontEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] + [TypeConverter (typeof (FontConverter))] +#endif + public sealed class Font : MarshalByRefObject, ISerializable, ICloneable, IDisposable + { + private IntPtr fontObject = IntPtr.Zero; + private string systemFontName; + private string originalFontName; + private float _size; + + private const byte DefaultCharSet = 1; + private static int CharSetOffset = -1; + + private void CreateFont(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical) + { + originalFontName = familyName; + FontFamily family; + // NOTE: If family name is null, empty or invalid, + // MS creates Microsoft Sans Serif font. + try + { + family = new FontFamily(familyName); + } + catch (Exception) + { + family = FontFamily.GenericSansSerif; + } + + setProperties(family, emSize, style, unit, charSet, isVertical); + int status = SafeNativeMethods.Gdip.GdipCreateFont(family.NativeFamily, emSize, style, unit, out fontObject); + + if (status == SafeNativeMethods.Gdip.FontStyleNotFound) + throw new ArgumentException(string.Format("Style {0} isn't supported by font {1}.", style.ToString(), familyName)); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + private Font(SerializationInfo info, StreamingContext context) + { + string name; + float size; + FontStyle style; + GraphicsUnit unit; + + name = (string)info.GetValue("Name", typeof(string)); + size = (float)info.GetValue("Size", typeof(float)); + style = (FontStyle)info.GetValue("Style", typeof(FontStyle)); + unit = (GraphicsUnit)info.GetValue("Unit", typeof(GraphicsUnit)); + + CreateFont(name, size, style, unit, DefaultCharSet, false); + } + + void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) + { + si.AddValue("Name", Name); + si.AddValue("Size", Size); + si.AddValue("Style", Style); + si.AddValue("Unit", Unit); + } + + ~Font() + { + Dispose(); + } + + public void Dispose() + { + if (fontObject != IntPtr.Zero) + { + int status = SafeNativeMethods.Gdip.GdipDeleteFont(fontObject); + fontObject = IntPtr.Zero; + GC.SuppressFinalize(this); + // check the status code (throw) at the last step + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + internal void SetSystemFontName(string newSystemFontName) + { + systemFontName = newSystemFontName; + } + + internal void unitConversion(GraphicsUnit fromUnit, GraphicsUnit toUnit, float nSrc, out float nTrg) + { + float inchs = 0; + nTrg = 0; + + switch (fromUnit) + { + case GraphicsUnit.Display: + inchs = nSrc / 75f; + break; + case GraphicsUnit.Document: + inchs = nSrc / 300f; + break; + case GraphicsUnit.Inch: + inchs = nSrc; + break; + case GraphicsUnit.Millimeter: + inchs = nSrc / 25.4f; + break; + case GraphicsUnit.Pixel: + case GraphicsUnit.World: + inchs = nSrc / Graphics.systemDpiX; + break; + case GraphicsUnit.Point: + inchs = nSrc / 72f; + break; + default: + throw new ArgumentException("Invalid GraphicsUnit"); + } + + switch (toUnit) + { + case GraphicsUnit.Display: + nTrg = inchs * 75; + break; + case GraphicsUnit.Document: + nTrg = inchs * 300; + break; + case GraphicsUnit.Inch: + nTrg = inchs; + break; + case GraphicsUnit.Millimeter: + nTrg = inchs * 25.4f; + break; + case GraphicsUnit.Pixel: + case GraphicsUnit.World: + nTrg = inchs * Graphics.systemDpiX; + break; + case GraphicsUnit.Point: + nTrg = inchs * 72; + break; + default: + throw new ArgumentException("Invalid GraphicsUnit"); + } + } + + void setProperties(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical) + { + _name = family.Name; + _fontFamily = family; + _size = emSize; + + // MS throws ArgumentException, if unit is set to GraphicsUnit.Display + _unit = unit; + _style = style; + _gdiCharSet = charSet; + _gdiVerticalFont = isVertical; + + unitConversion(unit, GraphicsUnit.Point, emSize, out _sizeInPoints); + + _bold = _italic = _strikeout = _underline = false; + + if ((style & FontStyle.Bold) == FontStyle.Bold) + _bold = true; + + if ((style & FontStyle.Italic) == FontStyle.Italic) + _italic = true; + + if ((style & FontStyle.Strikeout) == FontStyle.Strikeout) + _strikeout = true; + + if ((style & FontStyle.Underline) == FontStyle.Underline) + _underline = true; + } + + public static Font FromHfont(IntPtr hfont) + { + IntPtr newObject; + FontStyle newStyle = FontStyle.Regular; + float newSize; + SafeNativeMethods.LOGFONT lf = new SafeNativeMethods.LOGFONT(); + + // Sanity. Should we throw an exception? + if (hfont == IntPtr.Zero) + { + Font result = new Font("Arial", (float)10.0, FontStyle.Regular); + return (result); + } + + // If we're on Unix we use our private gdiplus API to avoid Wine + // dependencies in S.D + int s = SafeNativeMethods.Gdip.GdipCreateFontFromHfont(hfont, out newObject, ref lf); + SafeNativeMethods.Gdip.CheckStatus(s); + + if (lf.lfItalic != 0) + { + newStyle |= FontStyle.Italic; + } + + if (lf.lfUnderline != 0) + { + newStyle |= FontStyle.Underline; + } + + if (lf.lfStrikeOut != 0) + { + newStyle |= FontStyle.Strikeout; + } + + if (lf.lfWeight > 400) + { + newStyle |= FontStyle.Bold; + } + + if (lf.lfHeight < 0) + { + newSize = lf.lfHeight * -1; + } + else + { + newSize = lf.lfHeight; + } + + return (new Font(newObject, lf.lfFaceName, newStyle, newSize)); + } + + public IntPtr ToHfont() + { + if (fontObject == IntPtr.Zero) + throw new ArgumentException("Object has been disposed."); + + return fontObject; + } + + internal Font(IntPtr newFontObject, string familyName, FontStyle style, float size) + { + FontFamily fontFamily; + + try + { + fontFamily = new FontFamily(familyName); + } + catch (Exception) + { + fontFamily = FontFamily.GenericSansSerif; + } + + setProperties(fontFamily, size, style, GraphicsUnit.Pixel, 0, false); + fontObject = newFontObject; + } + + public Font(Font prototype, FontStyle newStyle) + { + // no null checks, MS throws a NullReferenceException if original is null + setProperties(prototype.FontFamily, prototype.Size, newStyle, prototype.Unit, prototype.GdiCharSet, prototype.GdiVerticalFont); + + int status = SafeNativeMethods.Gdip.GdipCreateFont(_fontFamily.NativeFamily, Size, Style, Unit, out fontObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Font(FontFamily family, float emSize, GraphicsUnit unit) + : this(family, emSize, FontStyle.Regular, unit, DefaultCharSet, false) + { + } + + public Font(string familyName, float emSize, GraphicsUnit unit) + : this(new FontFamily(familyName), emSize, FontStyle.Regular, unit, DefaultCharSet, false) + { + } + + public Font(FontFamily family, float emSize) + : this(family, emSize, FontStyle.Regular, GraphicsUnit.Point, DefaultCharSet, false) + { + } + + public Font(FontFamily family, float emSize, FontStyle style) + : this(family, emSize, style, GraphicsUnit.Point, DefaultCharSet, false) + { + } + + public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit) + : this(family, emSize, style, unit, DefaultCharSet, false) + { + } + + public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) + : this(family, emSize, style, unit, gdiCharSet, false) + { + } + + public Font(FontFamily family, float emSize, FontStyle style, + GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) + { + if (family == null) + throw new ArgumentNullException("family"); + + int status; + setProperties(family, emSize, style, unit, gdiCharSet, gdiVerticalFont); + status = SafeNativeMethods.Gdip.GdipCreateFont(family.NativeFamily, emSize, style, unit, out fontObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Font(string familyName, float emSize) + : this(familyName, emSize, FontStyle.Regular, GraphicsUnit.Point, DefaultCharSet, false) + { + } + + public Font(string familyName, float emSize, FontStyle style) + : this(familyName, emSize, style, GraphicsUnit.Point, DefaultCharSet, false) + { + } + + public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit) + : this(familyName, emSize, style, unit, DefaultCharSet, false) + { + } + + public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) + : this(familyName, emSize, style, unit, gdiCharSet, false) + { + } + + public Font(string familyName, float emSize, FontStyle style, + GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) + { + CreateFont(familyName, emSize, style, unit, gdiCharSet, gdiVerticalFont); + } + internal Font(string familyName, float emSize, string systemName) + : this(familyName, emSize, FontStyle.Regular, GraphicsUnit.Point, DefaultCharSet, false) + { + systemFontName = systemName; + } + public object Clone() + { + return new Font(this, Style); + } + + internal IntPtr NativeObject + { + get + { + return fontObject; + } + } + + private bool _bold; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Bold + { + get + { + return _bold; + } + } + + private FontFamily _fontFamily; + + [Browsable(false)] + public FontFamily FontFamily + { + get + { + return _fontFamily; + } + } + + private byte _gdiCharSet; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public byte GdiCharSet + { + get + { + return _gdiCharSet; + } + } + + private bool _gdiVerticalFont; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool GdiVerticalFont + { + get + { + return _gdiVerticalFont; + } + } + + [Browsable(false)] + public int Height + { + get + { + return (int)Math.Ceiling(GetHeight()); + } + } + + [Browsable(false)] + public bool IsSystemFont + { + get + { + return !string.IsNullOrEmpty(systemFontName); + } + } + + private bool _italic; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Italic + { + get + { + return _italic; + } + } + + private string _name; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#if !NETCORE + [Editor ("System.Drawing.Design.FontNameEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] + [TypeConverter (typeof (FontConverter.FontNameConverter))] +#endif + public string Name + { + get + { + return _name; + } + } + + public float Size + { + get + { + return _size; + } + } + + private float _sizeInPoints; + + [Browsable(false)] + public float SizeInPoints + { + get + { + return _sizeInPoints; + } + } + + private bool _strikeout; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Strikeout + { + get + { + return _strikeout; + } + } + + private FontStyle _style; + + [Browsable(false)] + public FontStyle Style + { + get + { + return _style; + } + } + + [Browsable(false)] + public string SystemFontName + { + get + { + return systemFontName; + } + } + + [Browsable(false)] + public string OriginalFontName + { + get + { + return originalFontName; + } + } + private bool _underline; + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Underline + { + get + { + return _underline; + } + } + + private GraphicsUnit _unit; + +#if !NETCORE + [TypeConverter (typeof (FontConverter.FontUnitConverter))] +#endif + public GraphicsUnit Unit + { + get + { + return _unit; + } + } + + public override bool Equals(object obj) + { + Font fnt = (obj as Font); + if (fnt == null) + return false; + + if (fnt.FontFamily.Equals(FontFamily) && fnt.Size == Size && + fnt.Style == Style && fnt.Unit == Unit && + fnt.GdiCharSet == GdiCharSet && + fnt.GdiVerticalFont == GdiVerticalFont) + return true; + else + return false; + } + + private int _hashCode; + + public override int GetHashCode() + { + if (_hashCode == 0) + { + _hashCode = 17; + unchecked + { + _hashCode = _hashCode * 23 + _name.GetHashCode(); + _hashCode = _hashCode * 23 + FontFamily.GetHashCode(); + _hashCode = _hashCode * 23 + _size.GetHashCode(); + _hashCode = _hashCode * 23 + _unit.GetHashCode(); + _hashCode = _hashCode * 23 + _style.GetHashCode(); + _hashCode = _hashCode * 23 + _gdiCharSet; + _hashCode = _hashCode * 23 + _gdiVerticalFont.GetHashCode(); + } + } + + return _hashCode; + } + + [MonoTODO("The hdc parameter has no direct equivalent in libgdiplus.")] + public static Font FromHdc(IntPtr hdc) + { + throw new NotImplementedException(); + } + + [MonoTODO("The returned font may not have all it's properties initialized correctly.")] + public static Font FromLogFont(object lf, IntPtr hdc) + { + IntPtr newObject; + SafeNativeMethods.LOGFONT o = (SafeNativeMethods.LOGFONT)lf; + int status = SafeNativeMethods.Gdip.GdipCreateFontFromLogfont(hdc, ref o, out newObject); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Font(newObject, "Microsoft Sans Serif", FontStyle.Regular, 10); + } + + public float GetHeight() + { + return GetHeight(Graphics.systemDpiY); + } + + public static Font FromLogFont(object lf) + { + return FromLogFont(lf, IntPtr.Zero); + } + + public void ToLogFont(object logFont) + { + // Unix - We don't have a window we could associate the DC with + // so we use an image instead + using (Bitmap img = new Bitmap(1, 1, Imaging.PixelFormat.Format32bppArgb)) + { + using (Graphics g = Graphics.FromImage(img)) + { + ToLogFont(logFont, g); + } + } + } + + public void ToLogFont(object logFont, Graphics graphics) + { + if (graphics == null) + throw new ArgumentNullException("graphics"); + + if (logFont == null) + { + throw new AccessViolationException("logFont"); + } + + Type st = logFont.GetType(); + if (!st.GetTypeInfo().IsLayoutSequential) + throw new ArgumentException("logFont", "Layout must be sequential."); + + // note: there is no exception if 'logFont' isn't big enough + Type lf = typeof(LOGFONT); + int size = Marshal.SizeOf(logFont); + if (size >= Marshal.SizeOf(lf)) + { + int status; + IntPtr copy = Marshal.AllocHGlobal(size); + try + { + Marshal.StructureToPtr(logFont, copy, false); + + status = SafeNativeMethods.Gdip.GdipGetLogFont(NativeObject, graphics.NativeObject, logFont); + if (status != SafeNativeMethods.Gdip.Ok) + { + // reset to original values + Marshal.PtrToStructure(copy, logFont); + } + } + finally + { + Marshal.FreeHGlobal(copy); + } + + if (CharSetOffset == -1) + { + // not sure why this methods returns an IntPtr since it's an offset + // anyway there's no issue in downcasting the result into an int32 + CharSetOffset = (int)Marshal.OffsetOf(lf, "lfCharSet"); + } + + // note: Marshal.WriteByte(object,*) methods are unimplemented on Mono + GCHandle gch = GCHandle.Alloc(logFont, GCHandleType.Pinned); + try + { + IntPtr ptr = gch.AddrOfPinnedObject(); + // if GDI+ lfCharSet is 0, then we return (S.D.) 1, otherwise the value is unchanged + if (Marshal.ReadByte(ptr, CharSetOffset) == 0) + { + // set lfCharSet to 1 + Marshal.WriteByte(ptr, CharSetOffset, 1); + } + } + finally + { + gch.Free(); + } + + // now we can throw, if required + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public float GetHeight(Graphics graphics) + { + if (graphics == null) + throw new ArgumentNullException("graphics"); + + float size; + int status = SafeNativeMethods.Gdip.GdipGetFontHeight(fontObject, graphics.NativeObject, out size); + SafeNativeMethods.Gdip.CheckStatus(status); + return size; + } + + public float GetHeight(float dpi) + { + float size; + int status = SafeNativeMethods.Gdip.GdipGetFontHeightGivenDPI(fontObject, dpi, out size); + SafeNativeMethods.Gdip.CheckStatus(status); + return size; + } + + public override String ToString() + { + return String.Format("[Font: Name={0}, Size={1}, Units={2}, GdiCharSet={3}, GdiVerticalFont={4}]", _name, Size, (int)_unit, _gdiCharSet, _gdiVerticalFont); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Windows.cs new file mode 100644 index 0000000000..23bf242f19 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.Windows.cs @@ -0,0 +1,717 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing.Internal; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; + +namespace System.Drawing +{ + /// + /// Defines a particular format for text, including font face, size, and style attributes. + /// + [ComVisible(true)] + public sealed partial class Font : MarshalByRefObject, ICloneable, IDisposable, ISerializable + { + private const int LogFontCharSetOffset = 23; + private const int LogFontNameOffset = 28; + + private IntPtr _nativeFont; + private float _fontSize; + private FontStyle _fontStyle; + private FontFamily _fontFamily; + private GraphicsUnit _fontUnit; + private byte _gdiCharSet = SafeNativeMethods.DEFAULT_CHARSET; + private bool _gdiVerticalFont; + private string _systemFontName = ""; + private string _originalFontName; + + /// + /// Creates the GDI+ native font object. + /// + private void CreateNativeFont() + { + Debug.Assert(_nativeFont == IntPtr.Zero, "nativeFont already initialized, this will generate a handle leak."); + Debug.Assert(_fontFamily != null, "fontFamily not initialized."); + + // Note: GDI+ creates singleton font family objects (from the corresponding font file) and reference count them so + // if creating the font object from an external FontFamily, this object's FontFamily will share the same native object. + int status = SafeNativeMethods.Gdip.GdipCreateFont( + new HandleRef(this, _fontFamily.NativeFamily), + _fontSize, + _fontStyle, + _fontUnit, + out _nativeFont); + + // Special case this common error message to give more information + if (status == SafeNativeMethods.Gdip.FontStyleNotFound) + { + throw new ArgumentException(SR.Format(SR.GdiplusFontStyleNotFound, _fontFamily.Name, _fontStyle.ToString())); + } + else if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + /// + /// Initializes a new instance of the class from the specified existing + /// and . + /// + public Font(Font prototype, FontStyle newStyle) + { + // Copy over the originalFontName because it won't get initialized + _originalFontName = prototype.OriginalFontName; + Initialize(prototype.FontFamily, prototype.Size, newStyle, prototype.Unit, SafeNativeMethods.DEFAULT_CHARSET, false); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit) + { + Initialize(family, emSize, style, unit, SafeNativeMethods.DEFAULT_CHARSET, false); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) + { + Initialize(family, emSize, style, unit, gdiCharSet, false); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) + { + Initialize(family, emSize, style, unit, gdiCharSet, gdiVerticalFont); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) + { + Initialize(familyName, emSize, style, unit, gdiCharSet, IsVerticalName(familyName)); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) + { + if (float.IsNaN(emSize) || float.IsInfinity(emSize) || emSize <= 0) + { + throw new ArgumentException(SR.Format(SR.InvalidBoundArgument, "emSize", emSize, 0, "System.Single.MaxValue"), "emSize"); + } + + Initialize(familyName, emSize, style, unit, gdiCharSet, gdiVerticalFont); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(FontFamily family, float emSize, FontStyle style) + { + Initialize(family, emSize, style, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, false); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(FontFamily family, float emSize, GraphicsUnit unit) + { + Initialize(family, emSize, FontStyle.Regular, unit, SafeNativeMethods.DEFAULT_CHARSET, false); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(FontFamily family, float emSize) + { + Initialize(family, emSize, FontStyle.Regular, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, false); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit) + { + Initialize(familyName, emSize, style, unit, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(string familyName, float emSize, FontStyle style) + { + Initialize(familyName, emSize, style, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(string familyName, float emSize, GraphicsUnit unit) + { + Initialize(familyName, emSize, FontStyle.Regular, unit, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); + } + + /// + /// Initializes a new instance of the class with the specified attributes. + /// + public Font(string familyName, float emSize) + { + Initialize(familyName, emSize, FontStyle.Regular, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); + } + + /// + /// Constructor to initialize fields from an existing native GDI+ object reference. Used by ToLogFont. + /// + private Font(IntPtr nativeFont, byte gdiCharSet, bool gdiVerticalFont) + { + Debug.Assert(_nativeFont == IntPtr.Zero, "GDI+ native font already initialized, this will generate a handle leak"); + Debug.Assert(nativeFont != IntPtr.Zero, "nativeFont is null"); + + int status = 0; + float size = 0; + GraphicsUnit unit = GraphicsUnit.Point; + FontStyle style = FontStyle.Regular; + IntPtr nativeFamily = IntPtr.Zero; + + _nativeFont = nativeFont; + + status = SafeNativeMethods.Gdip.GdipGetFontUnit(new HandleRef(this, nativeFont), out unit); + SafeNativeMethods.Gdip.CheckStatus(status); + + status = SafeNativeMethods.Gdip.GdipGetFontSize(new HandleRef(this, nativeFont), out size); + SafeNativeMethods.Gdip.CheckStatus(status); + + status = SafeNativeMethods.Gdip.GdipGetFontStyle(new HandleRef(this, nativeFont), out style); + SafeNativeMethods.Gdip.CheckStatus(status); + + status = SafeNativeMethods.Gdip.GdipGetFamily(new HandleRef(this, nativeFont), out nativeFamily); + SafeNativeMethods.Gdip.CheckStatus(status); + + SetFontFamily(new FontFamily(nativeFamily)); + Initialize(_fontFamily, size, style, unit, gdiCharSet, gdiVerticalFont); + } + + /// + /// Initializes this object's fields. + /// + private void Initialize(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) + { + _originalFontName = familyName; + + SetFontFamily(new FontFamily(StripVerticalName(familyName), createDefaultOnFail: true)); + Initialize(_fontFamily, emSize, style, unit, gdiCharSet, gdiVerticalFont); + } + + /// + /// Initializes this object's fields. + /// + private void Initialize(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) + { + if (family == null) + { + throw new ArgumentNullException(nameof(family)); + } + + if (float.IsNaN(emSize) || float.IsInfinity(emSize) || emSize <= 0) + { + throw new ArgumentException(SR.Format(SR.InvalidBoundArgument, nameof(emSize), emSize, 0, "System.Single.MaxValue"), nameof(emSize)); + } + + int status; + + _fontSize = emSize; + _fontStyle = style; + _fontUnit = unit; + _gdiCharSet = gdiCharSet; + _gdiVerticalFont = gdiVerticalFont; + + if (_fontFamily == null) + { + // GDI+ FontFamily is a singleton object. + SetFontFamily(new FontFamily(family.NativeFamily)); + } + + if (_nativeFont == IntPtr.Zero) + { + CreateNativeFont(); + } + + // Get actual size. + status = SafeNativeMethods.Gdip.GdipGetFontSize(new HandleRef(this, _nativeFont), out _fontSize); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + /// + /// Creates a from the specified Windows handle. + /// + public static Font FromHfont(IntPtr hfont) + { + var lf = new SafeNativeMethods.LOGFONT(); + SafeNativeMethods.GetObject(new HandleRef(null, hfont), lf); + + IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); + try + { + return FromLogFont(lf, screenDC); + } + finally + { + UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); + } + } + + public static Font FromLogFont(object lf) + { + IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); + try + { + return FromLogFont(lf, screenDC); + } + finally + { + UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); + } + } + + public static Font FromLogFont(object lf, IntPtr hdc) + { + IntPtr font = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipCreateFontFromLogfontW(new HandleRef(null, hdc), lf, out font); + + // Special case this incredibly common error message to give more information + if (status == SafeNativeMethods.Gdip.NotTrueTypeFont) + { + throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName)); + } + else if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + // GDI+ returns font = 0 even though the status is Ok. + if (font == IntPtr.Zero) + { + throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont, lf.ToString())); + } + +#pragma warning disable 0618 + bool gdiVerticalFont = (Marshal.ReadInt16(lf, LogFontNameOffset) == (short)'@'); + return new Font(font, Marshal.ReadByte(lf, LogFontCharSetOffset), gdiVerticalFont); +#pragma warning restore 0618 + } + + /// + /// Creates a Font from the specified Windows handle to a device context. + /// + public static Font FromHdc(IntPtr hdc) + { + IntPtr font = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipCreateFontFromDC(new HandleRef(null, hdc), ref font); + + // Special case this incredibly common error message to give more information + if (status == SafeNativeMethods.Gdip.NotTrueTypeFont) + { + throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName)); + } + else if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + return new Font(font, 0, false); + } + + /// + /// Creates an exact copy of this . + /// + public object Clone() + { + IntPtr clonedFont = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipCloneFont(new HandleRef(this, _nativeFont), out clonedFont); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new Font(clonedFont, _gdiCharSet, _gdiVerticalFont); + } + + /// + /// Get native GDI+ object pointer. This property triggers the creation of the GDI+ native object if not initialized yet. + /// + internal IntPtr NativeFont => _nativeFont; + + /// + /// Gets the of this . + /// + [Browsable(false)] + public FontFamily FontFamily + { + get + { + Debug.Assert(_fontFamily != null, "fontFamily should never be null"); + return _fontFamily; + } + } + + private void SetFontFamily(FontFamily family) + { + _fontFamily = family; + + // GDI+ creates ref-counted singleton FontFamily objects based on the family name so all managed + // objects with same family name share the underlying GDI+ native pointer. The unmanged object is + // destroyed when its ref-count gets to zero. + // Make sure this.fontFamily is not finalized so the underlying singleton object is kept alive. + GC.SuppressFinalize(_fontFamily); + } + + /// + /// Cleans up Windows resources for this . + /// + ~Font() => Dispose(false); + + /// + /// Cleans up Windows resources for this . + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_nativeFont != IntPtr.Zero) + { + try + { +#if DEBUG + int status = +#endif + SafeNativeMethods.Gdip.GdipDeleteFont(new HandleRef(this, _nativeFont)); +#if DEBUG + Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture)); +#endif + } + catch (Exception ex) when (!ClientUtils.IsCriticalException(ex)) + { + } + finally + { + _nativeFont = IntPtr.Zero; + } + } + } + + private static bool IsVerticalName(string familyName) => familyName?.Length > 0 && familyName[0] == '@'; + + /// + /// Gets a value indicating whether this is bold. + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Bold => (Style & FontStyle.Bold) != 0; + + /// + /// Returns the GDI char set for this instance of a font. This will only + /// be valid if this font was created from a classic GDI font definition, + /// like a LOGFONT or HFONT, or it was passed into the constructor. + /// + /// This is here for compatibility with native Win32 intrinsic controls + /// on non-Unicode platforms. + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public byte GdiCharSet => _gdiCharSet; + + /// + /// Determines if this font was created to represent a GDI vertical font. This will only be valid if this font + /// was created from a classic GDIfont definition, like a LOGFONT or HFONT, or it was passed into the constructor. + /// + /// This is here for compatibility with native Win32 intrinsic controls on non-Unicode platforms. + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool GdiVerticalFont => _gdiVerticalFont; + + /// + /// Gets a value indicating whether this is Italic. + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Italic => (Style & FontStyle.Italic) != 0; + + /// + /// Gets the face name of this . + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public string Name => FontFamily.Name; + + /// + /// This property is required by the framework and not intended to be used directly. + /// + [Browsable(false)] + public string OriginalFontName => _originalFontName; + + /// + /// Gets a value indicating whether this is strikeout (has a line through it). + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Strikeout => (Style & FontStyle.Strikeout) != 0; + + /// + /// Gets a value indicating whether this is underlined. + /// + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public bool Underline => (Style & FontStyle.Underline) != 0; + + /// + /// Returns a value indicating whether the specified object is a equivalent to this + /// . + /// + public override bool Equals(object obj) + { + if (obj == this) + { + return true; + } + + if (!(obj is Font font)) + { + return false; + } + + // Note: If this and/or the passed-in font are disposed, this method can still return true since we check for cached properties + // here. + // We need to call properties on the passed-in object since it could be a proxy in a remoting scenario and proxies don't + // have access to private/internal fields. + return font.FontFamily.Equals(FontFamily) && + font.GdiVerticalFont == GdiVerticalFont && + font.GdiCharSet == GdiCharSet && + font.Style == Style && + font.Size == Size && + font.Unit == Unit; + } + + /// + /// Gets the hash code for this . + /// + public override int GetHashCode() + { + return unchecked((int)((((uint)_fontStyle << 13) | ((uint)_fontStyle >> 19)) ^ + (((uint)_fontUnit << 26) | ((uint)_fontUnit >> 6)) ^ + (((uint)_fontSize << 7) | ((uint)_fontSize >> 25)))); + } + + private static string StripVerticalName(string familyName) + { + if (familyName?.Length > 1 && familyName[0] == '@') + { + return familyName.Substring(1); + } + + return familyName; + } + + /// + /// Returns a human-readable string representation of this . + /// + public override string ToString() + { + return string.Format(CultureInfo.CurrentCulture, "[{0}: Name={1}, Size={2}, Units={3}, GdiCharSet={4}, GdiVerticalFont={5}]", + GetType().Name, + FontFamily.Name, + _fontSize, + (int)_fontUnit, + _gdiCharSet, + _gdiVerticalFont); + } + + public void ToLogFont(object logFont) + { + IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); + try + { + Graphics graphics = Graphics.FromHdcInternal(screenDC); + try + { + ToLogFont(logFont, graphics); + } + finally + { + graphics.Dispose(); + } + } + finally + { + UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); + } + } + + public unsafe void ToLogFont(object logFont, Graphics graphics) + { + if (graphics == null) + { + throw new ArgumentNullException(nameof(graphics)); + } + + int status = SafeNativeMethods.Gdip.GdipGetLogFontW(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), logFont); + + // Prefix the string with '@' this is a gdiVerticalFont. +#pragma warning disable 0618 + if (_gdiVerticalFont) + { + // Copy the Unicode contents of the name. + for (int i = 60; i >= 0; i -= 2) + { + Marshal.WriteInt16(logFont, + LogFontNameOffset + i + 2, + Marshal.ReadInt16(logFont, LogFontNameOffset + i)); + } + + // Prefix the name with an '@' sign. + Marshal.WriteInt16(logFont, LogFontNameOffset, (short)'@'); + } + if (Marshal.ReadByte(logFont, LogFontCharSetOffset) == 0) + { + Marshal.WriteByte(logFont, LogFontCharSetOffset, _gdiCharSet); + } +#pragma warning restore 0618 + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + /// + /// Returns a handle to this . + /// + public IntPtr ToHfont() + { + var lf = new SafeNativeMethods.LOGFONT(); + ToLogFont(lf); + + IntPtr handle = IntUnsafeNativeMethods.IntCreateFontIndirect(lf); + if (handle == IntPtr.Zero) + { + throw new Win32Exception(); + } + + return handle; + } + + /// + /// Returns the height of this Font in the specified graphics context. + /// + public float GetHeight(Graphics graphics) + { + if (graphics == null) + { + throw new ArgumentNullException(nameof(graphics)); + } + + float height; + int status = SafeNativeMethods.Gdip.GdipGetFontHeight(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), out height); + SafeNativeMethods.Gdip.CheckStatus(status); + + return height; + } + + public float GetHeight() + { + IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); + try + { + using (Graphics graphics = Graphics.FromHdcInternal(screenDC)) + { + return GetHeight(graphics); + } + } + finally + { + UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); + } + } + + public float GetHeight(float dpi) + { + float height; + int status = SafeNativeMethods.Gdip.GdipGetFontHeightGivenDPI(new HandleRef(this, NativeFont), dpi, out height); + SafeNativeMethods.Gdip.CheckStatus(status); + + return height; + } + + /// + /// Gets style information for this . + /// + [Browsable(false)] + public FontStyle Style => _fontStyle; + + // Return value is in Unit (the unit the font was created in) + /// + /// Gets the size of this . + /// + public float Size => _fontSize; + + /// + /// Gets the size, in points, of this . + /// + [Browsable(false)] + public float SizeInPoints + { + get + { + if (Unit == GraphicsUnit.Point) + { + return Size; + } + + IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); + try + { + using (Graphics graphics = Graphics.FromHdcInternal(screenDC)) + { + float pixelsPerPoint = (float)(graphics.DpiY / 72.0); + float lineSpacingInPixels = GetHeight(graphics); + float emHeightInPixels = lineSpacingInPixels * FontFamily.GetEmHeight(Style) / FontFamily.GetLineSpacing(Style); + + return emHeightInPixels / pixelsPerPoint; + } + } + finally + { + UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); + } + } + } + + /// + /// Gets the unit of measure for this . + /// + public GraphicsUnit Unit => _fontUnit; + + /// + /// Gets the height of this . + /// + [Browsable(false)] + public int Height => (int)Math.Ceiling(GetHeight()); + + /// + /// Returns true if this is a SystemFont. + /// + [Browsable(false)] + public bool IsSystemFont => !string.IsNullOrEmpty(_systemFontName); + + /// + /// Gets the name of this . + /// + [Browsable(false)] + public string SystemFontName => _systemFontName; + + // This is used by SystemFonts when constructing a system Font objects. + internal void SetSystemFontName(string systemFontName) => _systemFontName = systemFontName; + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.cs deleted file mode 100644 index 763165287d..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Font.cs +++ /dev/null @@ -1,716 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing.Internal; -using System.Globalization; -using System.Runtime.InteropServices; - -namespace System.Drawing -{ - /// - /// Defines a particular format for text, including font face, size, and style attributes. - /// - [ComVisible(true)] - public sealed partial class Font : MarshalByRefObject, ICloneable, IDisposable - { - private const int LogFontCharSetOffset = 23; - private const int LogFontNameOffset = 28; - - private IntPtr _nativeFont; - private float _fontSize; - private FontStyle _fontStyle; - private FontFamily _fontFamily; - private GraphicsUnit _fontUnit; - private byte _gdiCharSet = SafeNativeMethods.DEFAULT_CHARSET; - private bool _gdiVerticalFont; - private string _systemFontName = ""; - private string _originalFontName; - - /// - /// Creates the GDI+ native font object. - /// - private void CreateNativeFont() - { - Debug.Assert(_nativeFont == IntPtr.Zero, "nativeFont already initialized, this will generate a handle leak."); - Debug.Assert(_fontFamily != null, "fontFamily not initialized."); - - // Note: GDI+ creates singleton font family objects (from the corresponding font file) and reference count them so - // if creating the font object from an external FontFamily, this object's FontFamily will share the same native object. - int status = SafeNativeMethods.Gdip.GdipCreateFont( - new HandleRef(this, _fontFamily.NativeFamily), - _fontSize, - _fontStyle, - _fontUnit, - out _nativeFont); - - // Special case this common error message to give more information - if (status == SafeNativeMethods.Gdip.FontStyleNotFound) - { - throw new ArgumentException(SR.Format(SR.GdiplusFontStyleNotFound, _fontFamily.Name, _fontStyle.ToString())); - } - else if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - /// - /// Initializes a new instance of the class from the specified existing - /// and . - /// - public Font(Font prototype, FontStyle newStyle) - { - // Copy over the originalFontName because it won't get initialized - _originalFontName = prototype.OriginalFontName; - Initialize(prototype.FontFamily, prototype.Size, newStyle, prototype.Unit, SafeNativeMethods.DEFAULT_CHARSET, false); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit) - { - Initialize(family, emSize, style, unit, SafeNativeMethods.DEFAULT_CHARSET, false); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) - { - Initialize(family, emSize, style, unit, gdiCharSet, false); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) - { - Initialize(family, emSize, style, unit, gdiCharSet, gdiVerticalFont); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) - { - Initialize(familyName, emSize, style, unit, gdiCharSet, IsVerticalName(familyName)); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) - { - if (float.IsNaN(emSize) || float.IsInfinity(emSize) || emSize <= 0) - { - throw new ArgumentException(SR.Format(SR.InvalidBoundArgument, "emSize", emSize, 0, "System.Single.MaxValue"), "emSize"); - } - - Initialize(familyName, emSize, style, unit, gdiCharSet, gdiVerticalFont); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(FontFamily family, float emSize, FontStyle style) - { - Initialize(family, emSize, style, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, false); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(FontFamily family, float emSize, GraphicsUnit unit) - { - Initialize(family, emSize, FontStyle.Regular, unit, SafeNativeMethods.DEFAULT_CHARSET, false); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(FontFamily family, float emSize) - { - Initialize(family, emSize, FontStyle.Regular, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, false); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit) - { - Initialize(familyName, emSize, style, unit, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(string familyName, float emSize, FontStyle style) - { - Initialize(familyName, emSize, style, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(string familyName, float emSize, GraphicsUnit unit) - { - Initialize(familyName, emSize, FontStyle.Regular, unit, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); - } - - /// - /// Initializes a new instance of the class with the specified attributes. - /// - public Font(string familyName, float emSize) - { - Initialize(familyName, emSize, FontStyle.Regular, GraphicsUnit.Point, SafeNativeMethods.DEFAULT_CHARSET, IsVerticalName(familyName)); - } - - /// - /// Constructor to initialize fields from an exisiting native GDI+ object reference. Used by ToLogFont. - /// - private Font(IntPtr nativeFont, byte gdiCharSet, bool gdiVerticalFont) - { - Debug.Assert(_nativeFont == IntPtr.Zero, "GDI+ native font already initialized, this will generate a handle leak"); - Debug.Assert(nativeFont != IntPtr.Zero, "nativeFont is null"); - - int status = 0; - float size = 0; - GraphicsUnit unit = GraphicsUnit.Point; - FontStyle style = FontStyle.Regular; - IntPtr nativeFamily = IntPtr.Zero; - - _nativeFont = nativeFont; - - status = SafeNativeMethods.Gdip.GdipGetFontUnit(new HandleRef(this, nativeFont), out unit); - SafeNativeMethods.Gdip.CheckStatus(status); - - status = SafeNativeMethods.Gdip.GdipGetFontSize(new HandleRef(this, nativeFont), out size); - SafeNativeMethods.Gdip.CheckStatus(status); - - status = SafeNativeMethods.Gdip.GdipGetFontStyle(new HandleRef(this, nativeFont), out style); - SafeNativeMethods.Gdip.CheckStatus(status); - - status = SafeNativeMethods.Gdip.GdipGetFamily(new HandleRef(this, nativeFont), out nativeFamily); - SafeNativeMethods.Gdip.CheckStatus(status); - - SetFontFamily(new FontFamily(nativeFamily)); - Initialize(_fontFamily, size, style, unit, gdiCharSet, gdiVerticalFont); - } - - /// - /// Initializes this object's fields. - /// - private void Initialize(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) - { - _originalFontName = familyName; - - SetFontFamily(new FontFamily(StripVerticalName(familyName), createDefaultOnFail: true)); - Initialize(_fontFamily, emSize, style, unit, gdiCharSet, gdiVerticalFont); - } - - /// - /// Initializes this object's fields. - /// - private void Initialize(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) - { - if (family == null) - { - throw new ArgumentNullException(nameof(family)); - } - - if (float.IsNaN(emSize) || float.IsInfinity(emSize) || emSize <= 0) - { - throw new ArgumentException(SR.Format(SR.InvalidBoundArgument, nameof(emSize), emSize, 0, "System.Single.MaxValue"), nameof(emSize)); - } - - int status; - - _fontSize = emSize; - _fontStyle = style; - _fontUnit = unit; - _gdiCharSet = gdiCharSet; - _gdiVerticalFont = gdiVerticalFont; - - if (_fontFamily == null) - { - // GDI+ FontFamily is a singleton object. - SetFontFamily(new FontFamily(family.NativeFamily)); - } - - if (_nativeFont == IntPtr.Zero) - { - CreateNativeFont(); - } - - // Get actual size. - status = SafeNativeMethods.Gdip.GdipGetFontSize(new HandleRef(this, _nativeFont), out _fontSize); - SafeNativeMethods.Gdip.CheckStatus(status); - } - - /// - /// Creates a from the specified Windows handle. - /// - public static Font FromHfont(IntPtr hfont) - { - var lf = new SafeNativeMethods.LOGFONT(); - SafeNativeMethods.GetObject(new HandleRef(null, hfont), lf); - - IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); - try - { - return FromLogFont(lf, screenDC); - } - finally - { - UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); - } - } - - public static Font FromLogFont(object lf) - { - IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); - try - { - return FromLogFont(lf, screenDC); - } - finally - { - UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); - } - } - - public static Font FromLogFont(object lf, IntPtr hdc) - { - IntPtr font = IntPtr.Zero; - int status = SafeNativeMethods.Gdip.GdipCreateFontFromLogfontW(new HandleRef(null, hdc), lf, out font); - - // Special case this incredibly common error message to give more information - if (status == SafeNativeMethods.Gdip.NotTrueTypeFont) - { - throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName)); - } - else if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - // GDI+ returns font = 0 even though the status is Ok. - if (font == IntPtr.Zero) - { - throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont, lf.ToString())); - } - -#pragma warning disable 0618 - bool gdiVerticalFont = (Marshal.ReadInt16(lf, LogFontNameOffset) == (short)'@'); - return new Font(font, Marshal.ReadByte(lf, LogFontCharSetOffset), gdiVerticalFont); -#pragma warning restore 0618 - } - - /// - /// Creates a Font from the specified Windows handle to a device context. - /// - public static Font FromHdc(IntPtr hdc) - { - IntPtr font = IntPtr.Zero; - int status = SafeNativeMethods.Gdip.GdipCreateFontFromDC(new HandleRef(null, hdc), ref font); - - // Special case this incredibly common error message to give more information - if (status == SafeNativeMethods.Gdip.NotTrueTypeFont) - { - throw new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName)); - } - else if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - return new Font(font, 0, false); - } - - /// - /// Creates an exact copy of this . - /// - public object Clone() - { - IntPtr clonedFont = IntPtr.Zero; - int status = SafeNativeMethods.Gdip.GdipCloneFont(new HandleRef(this, _nativeFont), out clonedFont); - SafeNativeMethods.Gdip.CheckStatus(status); - - return new Font(clonedFont, _gdiCharSet, _gdiVerticalFont); - } - - /// - /// Get native GDI+ object pointer. This property triggers the creation of the GDI+ native object if not initialized yet. - /// - internal IntPtr NativeFont => _nativeFont; - - /// - /// Gets the of this . - /// - [Browsable(false)] - public FontFamily FontFamily - { - get - { - Debug.Assert(_fontFamily != null, "fontFamily should never be null"); - return _fontFamily; - } - } - - private void SetFontFamily(FontFamily family) - { - _fontFamily = family; - - // GDI+ creates ref-counted singleton FontFamily objects based on the family name so all managed - // objects with same family name share the underlying GDI+ native pointer. The unmanged object is - // destroyed when its ref-count gets to zero. - // Make sure this.fontFamily is not finalized so the underlying singleton object is kept alive. - GC.SuppressFinalize(_fontFamily); - } - - /// - /// Cleans up Windows resources for this . - /// - ~Font() => Dispose(false); - - /// - /// Cleans up Windows resources for this . - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private void Dispose(bool disposing) - { - if (_nativeFont != IntPtr.Zero) - { - try - { -#if DEBUG - int status = -#endif - SafeNativeMethods.Gdip.GdipDeleteFont(new HandleRef(this, _nativeFont)); -#if DEBUG - Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture)); -#endif - } - catch (Exception ex) when (!ClientUtils.IsCriticalException(ex)) - { - } - finally - { - _nativeFont = IntPtr.Zero; - } - } - } - - private static bool IsVerticalName(string familyName) => familyName?.Length > 0 && familyName[0] == '@'; - - /// - /// Gets a value indicating whether this is bold. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool Bold => (Style & FontStyle.Bold) != 0; - - /// - /// Returns the GDI char set for this instance of a font. This will only - /// be valid if this font was created from a classic GDI font definition, - /// like a LOGFONT or HFONT, or it was passed into the constructor. - /// - /// This is here for compatability with native Win32 intrinsic controls - /// on non-Unicode platforms. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public byte GdiCharSet => _gdiCharSet; - - /// - /// Determines if this font was created to represt a GDI vertical font. This will only be valid if this font - /// was created from a classic GDIfont definition, like a LOGFONT or HFONT, or it was passed into the constructor. - /// - /// This is here for compatability with native Win32 intrinsic controls on non-Unicode platforms. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool GdiVerticalFont => _gdiVerticalFont; - - /// - /// Gets a value indicating whether this is Italic. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool Italic => (Style & FontStyle.Italic) != 0; - - /// - /// Gets the face name of this . - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public string Name => FontFamily.Name; - - /// - /// This property is required by the framework and not intended to be used directly. - /// - [Browsable(false)] - public string OriginalFontName => _originalFontName; - - /// - /// Gets a value indicating whether this is strikeout (has a line through it). - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool Strikeout => (Style & FontStyle.Strikeout) != 0; - - /// - /// Gets a value indicating whether this is underlined. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool Underline => (Style & FontStyle.Underline) != 0; - - /// - /// Returns a value indicating whether the specified object is a equivalent to this - /// . - /// - public override bool Equals(object obj) - { - if (obj == this) - { - return true; - } - - if (!(obj is Font font)) - { - return false; - } - - // Note: If this and/or the passed-in font are disposed, this method can still return true since we check for cached properties - // here. - // We need to call properties on the passed-in object since it could be a proxy in a remoting scenario and proxies don't - // have access to private/internal fields. - return font.FontFamily.Equals(FontFamily) && - font.GdiVerticalFont == GdiVerticalFont && - font.GdiCharSet == GdiCharSet && - font.Style == Style && - font.Size == Size && - font.Unit == Unit; - } - - /// - /// Gets the hash code for this . - /// - public override int GetHashCode() - { - return unchecked((int)((((uint)_fontStyle << 13) | ((uint)_fontStyle >> 19)) ^ - (((uint)_fontUnit << 26) | ((uint)_fontUnit >> 6)) ^ - (((uint)_fontSize << 7) | ((uint)_fontSize >> 25)))); - } - - private static string StripVerticalName(string familyName) - { - if (familyName?.Length > 1 && familyName[0] == '@') - { - return familyName.Substring(1); - } - - return familyName; - } - - /// - /// Returns a human-readable string representation of this . - /// - public override string ToString() - { - return string.Format(CultureInfo.CurrentCulture, "[{0}: Name={1}, Size={2}, Units={3}, GdiCharSet={4}, GdiVerticalFont={5}]", - GetType().Name, - FontFamily.Name, - _fontSize, - (int)_fontUnit, - _gdiCharSet, - _gdiVerticalFont); - } - - public void ToLogFont(object logFont) - { - IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); - try - { - Graphics graphics = Graphics.FromHdcInternal(screenDC); - try - { - ToLogFont(logFont, graphics); - } - finally - { - graphics.Dispose(); - } - } - finally - { - UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); - } - } - - public unsafe void ToLogFont(object logFont, Graphics graphics) - { - if (graphics == null) - { - throw new ArgumentNullException(nameof(graphics)); - } - - int status = SafeNativeMethods.Gdip.GdipGetLogFontW(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), logFont); - - // Prefix the string with '@' this is a gdiVerticalFont. -#pragma warning disable 0618 - if (_gdiVerticalFont) - { - // Copy the Unicode contents of the name. - for (int i = 60; i >= 0; i -= 2) - { - Marshal.WriteInt16(logFont, - LogFontNameOffset + i + 2, - Marshal.ReadInt16(logFont, LogFontNameOffset + i)); - } - - // Prefix the name with an '@' sign. - Marshal.WriteInt16(logFont, LogFontNameOffset, (short)'@'); - } - if (Marshal.ReadByte(logFont, LogFontCharSetOffset) == 0) - { - Marshal.WriteByte(logFont, LogFontCharSetOffset, _gdiCharSet); - } -#pragma warning restore 0618 - - SafeNativeMethods.Gdip.CheckStatus(status); - } - - /// - /// Returns a handle to this . - /// - public IntPtr ToHfont() - { - var lf = new SafeNativeMethods.LOGFONT(); - ToLogFont(lf); - - IntPtr handle = IntUnsafeNativeMethods.IntCreateFontIndirect(lf); - if (handle == IntPtr.Zero) - { - throw new Win32Exception(); - } - - return handle; - } - - /// - /// Returns the height of this Font in the specified graphics context. - /// - public float GetHeight(Graphics graphics) - { - if (graphics == null) - { - throw new ArgumentNullException(nameof(graphics)); - } - - float height; - int status = SafeNativeMethods.Gdip.GdipGetFontHeight(new HandleRef(this, NativeFont), new HandleRef(graphics, graphics.NativeGraphics), out height); - SafeNativeMethods.Gdip.CheckStatus(status); - - return height; - } - - public float GetHeight() - { - IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); - try - { - using (Graphics graphics = Graphics.FromHdcInternal(screenDC)) - { - return GetHeight(graphics); - } - } - finally - { - UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); - } - } - - public float GetHeight(float dpi) - { - float height; - int status = SafeNativeMethods.Gdip.GdipGetFontHeightGivenDPI(new HandleRef(this, NativeFont), dpi, out height); - SafeNativeMethods.Gdip.CheckStatus(status); - - return height; - } - - /// - /// Gets style information for this . - /// - [Browsable(false)] - public FontStyle Style => _fontStyle; - - // Return value is in Unit (the unit the font was created in) - /// - /// Gets the size of this . - /// - public float Size => _fontSize; - - /// - /// Gets the size, in points, of this . - /// - [Browsable(false)] - public float SizeInPoints - { - get - { - if (Unit == GraphicsUnit.Point) - { - return Size; - } - - IntPtr screenDC = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); - try - { - using (Graphics graphics = Graphics.FromHdcInternal(screenDC)) - { - float pixelsPerPoint = (float)(graphics.DpiY / 72.0); - float lineSpacingInPixels = GetHeight(graphics); - float emHeightInPixels = lineSpacingInPixels * FontFamily.GetEmHeight(Style) / FontFamily.GetLineSpacing(Style); - - return emHeightInPixels / pixelsPerPoint; - } - } - finally - { - UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, screenDC)); - } - } - } - - /// - /// Gets the unit of measure for this . - /// - public GraphicsUnit Unit => _fontUnit; - - /// - /// Gets the height of this . - /// - [Browsable(false)] - public int Height => (int)Math.Ceiling(GetHeight()); - - /// - /// Returns true if this is a SystemFont. - /// - [Browsable(false)] - public bool IsSystemFont => !string.IsNullOrEmpty(_systemFontName); - - /// - /// Gets the name of this . - /// - [Browsable(false)] - public string SystemFontName => _systemFontName; - - // This is used by SystemFonts when constructing a system Font objects. - internal void SetSystemFontName(string systemFontName) => _systemFontName = systemFontName; - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs index dbb2d2ee6d..f77dce68a9 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/FontFamily.cs @@ -47,7 +47,7 @@ namespace System.Drawing /// /// The parameter determines how errors are handled when creating a /// font based on a font family that does not exist on the end user's system at run time. If this parameter is - /// true, then a fall-back fontwill always be used instead. If this parameter is false, an exception will be thrown. + /// true, then a fall-back font will always be used instead. If this parameter is false, an exception will be thrown. /// internal FontFamily(string name, bool createDefaultOnFail) { @@ -200,7 +200,7 @@ namespace System.Drawing public string Name => GetName(CurrentLanguage); /// - /// Retuns the name of this in the specified language. + /// Returns the name of this in the specified language. /// public string GetName(int language) { diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs new file mode 100644 index 0000000000..b9300116d0 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs @@ -0,0 +1,330 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.GdiPlusStreamHelper.cs +// - Originally in System.Drawing.gdipFunctions.cs +// +// Authors: +// Alexandre Pigolkine (pigolkine@gmx.de) +// Jordi Mas i Hernandez (jordi@ximian.com) +// Sanjay Gupta (gsanjay@novell.com) +// Ravindra (rkumar@novell.com) +// Peter Dennis Bartok (pbartok@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2004 - 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.IO; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + internal sealed partial class GdiPlusStreamHelper + { + public Stream stream; + + private StreamGetHeaderDelegate sghd = null; + private StreamGetBytesDelegate sgbd = null; + private StreamSeekDelegate skd = null; + private StreamPutBytesDelegate spbd = null; + private StreamCloseDelegate scd = null; + private StreamSizeDelegate ssd = null; + private byte[] start_buf; + private int start_buf_pos; + private int start_buf_len; + private byte[] managedBuf; + private const int default_bufsize = 4096; + + public GdiPlusStreamHelper(Stream s, bool seekToOrigin) + { + managedBuf = new byte[default_bufsize]; + + stream = s; + if (stream != null && stream.CanSeek && seekToOrigin) + { + stream.Seek(0, SeekOrigin.Begin); + } + } + + public int StreamGetHeaderImpl(IntPtr buf, int bufsz) + { + int bytesRead; + + start_buf = new byte[bufsz]; + + try + { + bytesRead = stream.Read(start_buf, 0, bufsz); + } + catch (IOException) + { + return -1; + } + + if (bytesRead > 0 && buf != IntPtr.Zero) + { + Marshal.Copy(start_buf, 0, (IntPtr)(buf.ToInt64()), bytesRead); + } + + start_buf_pos = 0; + start_buf_len = bytesRead; + + return bytesRead; + } + + public StreamGetHeaderDelegate GetHeaderDelegate + { + get + { + if (stream != null && stream.CanRead) + { + if (sghd == null) + { + sghd = new StreamGetHeaderDelegate(StreamGetHeaderImpl); + } + return sghd; + } + return null; + } + } + + public int StreamGetBytesImpl(IntPtr buf, int bufsz, bool peek) + { + if (buf == IntPtr.Zero && peek) + { + return -1; + } + + if (bufsz > managedBuf.Length) + managedBuf = new byte[bufsz]; + int bytesRead = 0; + long streamPosition = 0; + + if (bufsz > 0) + { + if (stream.CanSeek) + { + streamPosition = stream.Position; + } + if (start_buf_len > 0) + { + if (start_buf_len > bufsz) + { + Array.Copy(start_buf, start_buf_pos, managedBuf, 0, bufsz); + start_buf_pos += bufsz; + start_buf_len -= bufsz; + bytesRead = bufsz; + bufsz = 0; + } + else + { + // this is easy + Array.Copy(start_buf, start_buf_pos, managedBuf, 0, start_buf_len); + bufsz -= start_buf_len; + bytesRead = start_buf_len; + start_buf_len = 0; + } + } + + if (bufsz > 0) + { + try + { + bytesRead += stream.Read(managedBuf, bytesRead, bufsz); + } + catch (IOException) + { + return -1; + } + } + + if (bytesRead > 0 && buf != IntPtr.Zero) + { + Marshal.Copy(managedBuf, 0, (IntPtr)(buf.ToInt64()), bytesRead); + } + + if (!stream.CanSeek && (bufsz == 10) && peek) + { + // Special 'hack' to support peeking of the type for gdi+ on non-seekable streams + } + + if (peek) + { + if (stream.CanSeek) + { + // If we are peeking bytes, then go back to original position before peeking + stream.Seek(streamPosition, SeekOrigin.Begin); + } + else + { + throw new NotSupportedException(); + } + } + } + + return bytesRead; + } + + public StreamGetBytesDelegate GetBytesDelegate + { + get + { + if (stream != null && stream.CanRead) + { + if (sgbd == null) + { + sgbd = new StreamGetBytesDelegate(StreamGetBytesImpl); + } + return sgbd; + } + return null; + } + } + + public long StreamSeekImpl(int offset, int whence) + { + // Make sure we have a valid 'whence'. + if ((whence < 0) || (whence > 2)) + return -1; + + // Invalidate the start_buf if we're actually going to call a Seek method. + start_buf_pos += start_buf_len; + start_buf_len = 0; + + SeekOrigin origin; + + // Translate 'whence' into a SeekOrigin enum member. + switch (whence) + { + case 0: + origin = SeekOrigin.Begin; + break; + case 1: + origin = SeekOrigin.Current; + break; + case 2: + origin = SeekOrigin.End; + break; + + // The following line is redundant but necessary to avoid a + // "Use of unassigned local variable" error without actually + // initializing 'origin' to a dummy value. + default: + return -1; + } + + // Do the actual seek operation and return its result. + return stream.Seek((long)offset, origin); + } + + public StreamSeekDelegate SeekDelegate + { + get + { + if (stream != null && stream.CanSeek) + { + if (skd == null) + { + skd = new StreamSeekDelegate(StreamSeekImpl); + } + return skd; + } + return null; + } + } + + public int StreamPutBytesImpl(IntPtr buf, int bufsz) + { + if (bufsz > managedBuf.Length) + managedBuf = new byte[bufsz]; + Marshal.Copy(buf, managedBuf, 0, bufsz); + stream.Write(managedBuf, 0, bufsz); + return bufsz; + } + + public StreamPutBytesDelegate PutBytesDelegate + { + get + { + if (stream != null && stream.CanWrite) + { + if (spbd == null) + { + spbd = new StreamPutBytesDelegate(StreamPutBytesImpl); + } + return spbd; + } + return null; + } + } + + public void StreamCloseImpl() + { + stream.Dispose(); + } + + public StreamCloseDelegate CloseDelegate + { + get + { + if (stream != null) + { + if (scd == null) + { + scd = new StreamCloseDelegate(StreamCloseImpl); + } + return scd; + } + return null; + } + } + + public long StreamSizeImpl() + { + try + { + return stream.Length; + } + catch + { + return -1; + } + } + + public StreamSizeDelegate SizeDelegate + { + get + { + if (stream != null) + { + if (ssd == null) + { + ssd = new StreamSizeDelegate(StreamSizeImpl); + } + return ssd; + } + return null; + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs new file mode 100644 index 0000000000..f66a1a8600 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs @@ -0,0 +1,1377 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Internal; +using System.Text; +using System.Collections; +using System.Runtime.InteropServices; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Drawing.Internal; +using System.Drawing.Imaging; +using System.Drawing.Text; +using System.Drawing.Drawing2D; +using System.Threading; +using System.Security; +using System.Runtime.ConstrainedExecution; +using System.Runtime.CompilerServices; + +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+BITMAP.bmBits")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+DIBSECTION.dshSection")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip.initToken")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip+StartupInput.DebugEventCallback")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip+StartupOutput.hook")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Gdip+StartupOutput.unhook")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+ICONINFO.hbmColor")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+ICONINFO.hbmMask")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+MSG.hwnd")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+MSG.lParam")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+MSG.wParam")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+OBJECTHEADER.pInfo")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PICTDESC.union1")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hDC")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hDevMode")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hDevNames")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hInstance")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hPrintTemplate")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hSetupTemplate")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.hwndOwner")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLG.lCustData")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hDC")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hDevMode")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hDevNames")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hInstance")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hPrintTemplate")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hSetupTemplate")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.hwndOwner")] +[assembly: SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources", Scope = "member", Target = "System.Drawing.SafeNativeMethods+PRINTDLGX86.lCustData")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+StreamConsts..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+POINT..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+LOGPEN..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+DIBSECTION..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+Ole..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+CommonHandles..ctor()")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+CommonHandles")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+ENHMETAHEADER")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+StreamConsts")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+Ole")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Drawing.SafeNativeMethods+Gdip")] +[assembly: SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Drawing.SafeNativeMethods+ENHMETAHEADER..ctor()")] + +namespace System.Drawing +{ + [SuppressUnmanagedCodeSecurity] + internal partial class SafeNativeMethods + { + // We make this a nested class so that we don't have to initialize GDI+ to access SafeNativeMethods (mostly gdi/user32). + [SuppressUnmanagedCodeSecurityAttribute] + internal partial class Gdip + { + private static readonly TraceSwitch s_gdiPlusInitialization = new TraceSwitch("GdiPlusInitialization", "Tracks GDI+ initialization and teardown"); + + private static IntPtr s_initToken; + private const string ThreadDataSlotName = "system.drawing.threaddata"; + + static Gdip() + { +#if MONO + s_initToken = (IntPtr) 1; +#else + Debug.Assert(s_initToken == IntPtr.Zero, "GdiplusInitialization: Initialize should not be called more than once in the same domain!"); + Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Initialize GDI+ [" + AppDomain.CurrentDomain.FriendlyName + "]"); + Debug.Indent(); + + s_gdipModule = LoadNativeLibrary(); + LoadSharedFunctionPointers(); + PlatformInitialize(); + + StartupInput input = StartupInput.GetDefault(); + StartupOutput output; + + // GDI+ ref counts multiple calls to Startup in the same process, so calls from multiple + // domains are ok, just make sure to pair each w/GdiplusShutdown + int status = GdiplusStartup(out s_initToken, ref input, out output); + CheckStatus(status); + + Debug.Unindent(); +#endif + // Sync to event for handling shutdown + AppDomain currentDomain = AppDomain.CurrentDomain; + currentDomain.ProcessExit += new EventHandler(OnProcessExit); + + // Also sync to DomainUnload for non-default domains since they will not get a ProcessExit if + // they are unloaded prior to ProcessExit (and this object's static fields are scoped to AppDomains, + // so we must cleanup on AppDomain shutdown) + if (!currentDomain.IsDefaultAppDomain()) + { + currentDomain.DomainUnload += new EventHandler(OnProcessExit); + } + } + + /// + /// Returns true if GDI+ has been started, but not shut down + /// + private static bool Initialized => s_initToken != IntPtr.Zero; + + /// + /// This property will give us back a hashtable we can use to store all of our static brushes and pens on + /// a per-thread basis. This way we can avoid 'object in use' crashes when different threads are + /// referencing the same drawing object. + /// + internal static IDictionary ThreadData + { + get + { + LocalDataStoreSlot slot = Thread.GetNamedDataSlot(ThreadDataSlotName); + IDictionary threadData = (IDictionary)Thread.GetData(slot); + if (threadData == null) + { + threadData = new Hashtable(); + Thread.SetData(slot, threadData); + } + + return threadData; + } + } + + // Clean up thread data + [MethodImpl(MethodImplOptions.NoInlining)] + private static void ClearThreadData() + { + Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Releasing TLS data"); + LocalDataStoreSlot slot = Thread.GetNamedDataSlot(ThreadDataSlotName); + Thread.SetData(slot, null); + } + + /// + /// Shutsdown GDI+ + /// + private static void Shutdown() + { + Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Shutdown GDI+ [" + AppDomain.CurrentDomain.FriendlyName + "]"); + Debug.Indent(); + + if (Initialized) + { + Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Not already shutdown"); + + ClearThreadData(); + + // Due to conditions at shutdown, we can't be sure all objects will be finalized here: e.g. a Global variable + // in the application/domain may still be holding a GDI+ object. If so, calling GdiplusShutdown will free the GDI+ heap, + // causing AppVerifier exceptions due to active crit sections. + // For now, we will simply not call shutdown, the resultant heap leak should occur most often during shutdown anyway. + // If GDI+ moves their allocations to the standard heap we can revisit. + +#if GDIP_SHUTDOWN + // Let any thread data collect and finalize before + // we tear down GDI+ + // + Debug.WriteLineIf(GdiPlusInitialization.TraceVerbose, "Running garbage collector"); + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + + // Shutdown GDI+ + // + Debug.WriteLineIf(GdiPlusInitialization.TraceVerbose, "Instruct GDI+ to shutdown"); + + GdiplusShutdown(new HandleRef(null, initToken)); + initToken = IntPtr.Zero; +#endif + + // unhook our shutdown handlers as we do not need to shut down more than once + AppDomain currentDomain = AppDomain.CurrentDomain; + currentDomain.ProcessExit -= new EventHandler(OnProcessExit); + if (!currentDomain.IsDefaultAppDomain()) + { + currentDomain.DomainUnload -= new EventHandler(OnProcessExit); + } + } + Debug.Unindent(); + } + + + // When we get notification that the process/domain is terminating, we will + // try to shutdown GDI+ if we haven't already. + [PrePrepareMethod] + private static void OnProcessExit(object sender, EventArgs e) + { + Debug.WriteLineIf(s_gdiPlusInitialization.TraceVerbose, "Process exited"); + Shutdown(); + } + + // Used to ensure static constructor has run. + internal static void DummyFunction() + { + } + + //---------------------------------------------------------------------------------------- + // Initialization methods (GdiplusInit.h) + //---------------------------------------------------------------------------------------- +#if !MONO + internal static int GdipDeletePath(HandleRef path) => Initialized ? IntGdipDeletePath(path) : Ok; + internal static int GdipDeletePathIter(HandleRef pathIter) => Initialized ? IntGdipDeletePathIter(pathIter) : Ok; + internal static int GdipDeleteMatrix(HandleRef matrix) => Initialized ? IntGdipDeleteMatrix(matrix) : Ok; + internal static int GdipDeleteRegion(HandleRef region) => Initialized ? IntGdipDeleteRegion(region) : Ok; + internal static int GdipDeleteBrush(HandleRef brush) => Initialized ? IntGdipDeleteBrush(brush) : Ok; + internal static int GdipDeletePen(HandleRef pen) => Initialized ? IntGdipDeletePen(pen) : Ok; + internal static int GdipDeleteCustomLineCap(HandleRef customCap) => Initialized ? IntGdipDeleteCustomLineCap(customCap) : Ok; + internal static int GdipDisposeImage(HandleRef image) => Initialized ? IntGdipDisposeImage(image) : Ok; + internal static int GdipDisposeImageAttributes(HandleRef imageattr) => Initialized ? IntGdipDisposeImageAttributes(imageattr) : Ok; + internal static int GdipDeleteGraphics(HandleRef graphics) => Initialized ? IntGdipDeleteGraphics(graphics) : Ok; + internal static int GdipReleaseDC(HandleRef graphics, HandleRef hdc) => Initialized ? IntGdipReleaseDC(graphics, hdc) : Ok; + internal static int GdipDeletePrivateFontCollection(ref IntPtr fontCollection) + { + if (!Initialized) + { + fontCollection = IntPtr.Zero; + return Ok; + } + + return IntGdipDeletePrivateFontCollection(ref fontCollection); + } + internal static int GdipDeleteFontFamily(HandleRef fontFamily) => Initialized ? IntGdipDeleteFontFamily(fontFamily) : Ok; + internal static int GdipDeleteFont(HandleRef font) => Initialized ? IntGdipDeleteFont(font) : Ok; + internal static int GdipDeleteStringFormat(HandleRef format) => Initialized ? IntGdipDeleteStringFormat(format) : Ok; +#endif + //---------------------------------------------------------------------------------------- + // Status codes + //---------------------------------------------------------------------------------------- + internal const int Ok = 0; + internal const int GenericError = 1; + internal const int InvalidParameter = 2; + internal const int OutOfMemory = 3; + internal const int ObjectBusy = 4; + internal const int InsufficientBuffer = 5; + internal const int NotImplemented = 6; + internal const int Win32Error = 7; + internal const int WrongState = 8; + internal const int Aborted = 9; + internal const int FileNotFound = 10; + internal const int ValueOverflow = 11; + internal const int AccessDenied = 12; + internal const int UnknownImageFormat = 13; + internal const int FontFamilyNotFound = 14; + internal const int FontStyleNotFound = 15; + internal const int NotTrueTypeFont = 16; + internal const int UnsupportedGdiplusVersion = 17; + internal const int GdiplusNotInitialized = 18; + internal const int PropertyNotFound = 19; + internal const int PropertyNotSupported = 20; + + internal static void CheckStatus(int status) + { + if (status != Ok) + { + throw StatusException(status); + } + } + + internal static Exception StatusException(int status) + { + Debug.Assert(status != Ok, "Throwing an exception for an 'Ok' return code"); + + switch (status) + { + case GenericError: + return new ExternalException(SR.Format(SR.GdiplusGenericError), E_FAIL); + case InvalidParameter: + return new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + case OutOfMemory: + return new OutOfMemoryException(SR.Format(SR.GdiplusOutOfMemory)); + case ObjectBusy: + return new InvalidOperationException(SR.Format(SR.GdiplusObjectBusy)); + case InsufficientBuffer: + return new OutOfMemoryException(SR.Format(SR.GdiplusInsufficientBuffer)); + case NotImplemented: + return new NotImplementedException(SR.Format(SR.GdiplusNotImplemented)); + case Win32Error: + return new ExternalException(SR.Format(SR.GdiplusGenericError), E_FAIL); + case WrongState: + return new InvalidOperationException(SR.Format(SR.GdiplusWrongState)); + case Aborted: + return new ExternalException(SR.Format(SR.GdiplusAborted), E_ABORT); + case FileNotFound: + return new FileNotFoundException(SR.Format(SR.GdiplusFileNotFound)); + case ValueOverflow: + return new OverflowException(SR.Format(SR.GdiplusOverflow)); + case AccessDenied: + return new ExternalException(SR.Format(SR.GdiplusAccessDenied), E_ACCESSDENIED); + case UnknownImageFormat: + return new ArgumentException(SR.Format(SR.GdiplusUnknownImageFormat)); + case PropertyNotFound: + return new ArgumentException(SR.Format(SR.GdiplusPropertyNotFoundError)); + case PropertyNotSupported: + return new ArgumentException(SR.Format(SR.GdiplusPropertyNotSupportedError)); + + case FontFamilyNotFound: + Debug.Fail("We should be special casing FontFamilyNotFound so we can provide the font name"); + return new ArgumentException(SR.Format(SR.GdiplusFontFamilyNotFound, "?")); + + case FontStyleNotFound: + Debug.Fail("We should be special casing FontStyleNotFound so we can provide the font name"); + return new ArgumentException(SR.Format(SR.GdiplusFontStyleNotFound, "?", "?")); + + case NotTrueTypeFont: + Debug.Fail("We should be special casing NotTrueTypeFont so we can provide the font name"); + return new ArgumentException(SR.Format(SR.GdiplusNotTrueTypeFont_NoName)); + + case UnsupportedGdiplusVersion: + return new ExternalException(SR.Format(SR.GdiplusUnsupportedGdiplusVersion), E_FAIL); + + case GdiplusNotInitialized: + return new ExternalException(SR.Format(SR.GdiplusNotInitialized), E_FAIL); + } + + return new ExternalException(SR.Format(SR.GdiplusUnknown), E_UNEXPECTED); + } + + //---------------------------------------------------------------------------------------- + // Helper function: Convert GpPointF* memory block to PointF[] + //---------------------------------------------------------------------------------------- + internal static PointF[] ConvertGPPOINTFArrayF(IntPtr memory, int count) + { + if (memory == IntPtr.Zero) + { + throw new ArgumentNullException(nameof(memory)); + } + + var points = new PointF[count]; + Type pointType = typeof(GPPOINTF); + int size = Marshal.SizeOf(pointType); + + for (int index = 0; index < count; index++) + { + var pt = (GPPOINTF)Marshal.PtrToStructure((IntPtr)((long)memory + index * size), pointType); + points[index] = new PointF(pt.X, pt.Y); + } + + return points; + } + + //---------------------------------------------------------------------------------------- + // Helper function: Convert GpPoint* memory block to Point[] + //---------------------------------------------------------------------------------------- + internal static Point[] ConvertGPPOINTArray(IntPtr memory, int count) + { + if (memory == IntPtr.Zero) + { + throw new ArgumentNullException(nameof(memory)); + } + + var points = new Point[count]; + Type pointType = typeof(GPPOINT); + + int size = Marshal.SizeOf(pointType); + + for (int index = 0; index < count; index++) + { + var pt = (GPPOINT)Marshal.PtrToStructure((IntPtr)((long)memory + index * size), pointType); + points[index] = new Point(pt.X, pt.Y); + } + + return points; + } + + //---------------------------------------------------------------------------------------- + // Helper function: Convert PointF[] to native memory block GpPointF* + //---------------------------------------------------------------------------------------- + internal static IntPtr ConvertPointToMemory(PointF[] points) + { + if (points == null) + { + throw new ArgumentNullException(nameof(points)); + } + + int size = (int)Marshal.SizeOf(typeof(GPPOINTF)); + int count = points.Length; + IntPtr memory = Marshal.AllocHGlobal(checked(count * size)); + + for (int index = 0; index < count; index++) + { + Marshal.StructureToPtr(new GPPOINTF(points[index]), (IntPtr)(checked((long)memory + index * size)), false); + } + + return memory; + } + + //---------------------------------------------------------------------------------------- + // Helper function: Convert Point[] to native memory block GpPoint* + //---------------------------------------------------------------------------------------- + internal static IntPtr ConvertPointToMemory(Point[] points) + { + if (points == null) + { + throw new ArgumentNullException(nameof(points)); + } + + int size = Marshal.SizeOf(typeof(GPPOINT)); + int count = points.Length; + IntPtr memory = Marshal.AllocHGlobal(checked(count * size)); + + for (int index = 0; index < count; index++) + { + Marshal.StructureToPtr(new GPPOINT(points[index]), (IntPtr)(checked((long)memory + index * size)), false); + } + + return memory; + } + + //---------------------------------------------------------------------------------------- + // Helper function: Convert RectangleF[] to native memory block GpRectF* + //---------------------------------------------------------------------------------------- + internal static IntPtr ConvertRectangleToMemory(RectangleF[] rect) + { + if (rect == null) + { + throw new ArgumentNullException(nameof(rect)); + } + + int size = Marshal.SizeOf(typeof(GPRECTF)); + int count = rect.Length; + IntPtr memory = Marshal.AllocHGlobal(checked(count * size)); + + for (int index = 0; index < count; index++) + { + Marshal.StructureToPtr(new GPRECTF(rect[index]), (IntPtr)(checked((long)memory + index * size)), false); + } + + return memory; + } + + //---------------------------------------------------------------------------------------- + // Helper function: Convert Rectangle[] to native memory block GpRect* + //---------------------------------------------------------------------------------------- + internal static IntPtr ConvertRectangleToMemory(Rectangle[] rect) + { + if (rect == null) + { + throw new ArgumentNullException(nameof(rect)); + } + + int size = (int)Marshal.SizeOf(typeof(GPRECT)); + int count = rect.Length; + IntPtr memory = Marshal.AllocHGlobal(checked(count * size)); + + for (int index = 0; index < count; index++) + { + Marshal.StructureToPtr(new GPRECT(rect[index]), (IntPtr)(checked((long)memory + index * size)), false); + } + + return memory; + } + } + + public const int ERROR_CANCELLED = 1223; + + public const int + E_UNEXPECTED = unchecked((int)0x8000FFFF), + E_NOTIMPL = unchecked((int)0x80004001), + E_ABORT = unchecked((int)0x80004004), + E_FAIL = unchecked((int)0x80004005), + E_ACCESSDENIED = unchecked((int)0x80070005), + GMEM_MOVEABLE = 0x0002, + GMEM_ZEROINIT = 0x0040, + DM_IN_BUFFER = 8, + DM_OUT_BUFFER = 2, + DT_PLOTTER = 0, + DT_RASPRINTER = 2, + TECHNOLOGY = 2, + DC_PAPERS = 2, + DC_PAPERSIZE = 3, + DC_BINS = 6, + DC_DUPLEX = 7, + DC_BINNAMES = 12, + DC_ENUMRESOLUTIONS = 13, + DC_PAPERNAMES = 16, + DC_ORIENTATION = 17, + DC_COPIES = 18, + PD_ALLPAGES = 0x00000000, + PD_SELECTION = 0x00000001, + PD_PAGENUMS = 0x00000002, + PD_CURRENTPAGE = 0x00400000, + PD_RETURNDEFAULT = 0x00000400, + DI_NORMAL = 0x0003, + IMAGE_ICON = 1, + IDI_APPLICATION = 32512, + IDI_HAND = 32513, + IDI_QUESTION = 32514, + IDI_EXCLAMATION = 32515, + IDI_ASTERISK = 32516, + IDI_WINLOGO = 32517, + IDI_WARNING = 32515, + IDI_ERROR = 32513, + IDI_INFORMATION = 32516, + SRCCOPY = 0x00CC0020, + PLANES = 14, + BITSPIXEL = 12, + LOGPIXELSX = 88, + LOGPIXELSY = 90, + PHYSICALWIDTH = 110, + PHYSICALHEIGHT = 111, + PHYSICALOFFSETX = 112, + PHYSICALOFFSETY = 113, + VERTRES = 10, + HORZRES = 8, + DM_ORIENTATION = 0x00000001, + DM_PAPERSIZE = 0x00000002, + DM_PAPERLENGTH = 0x00000004, + DM_PAPERWIDTH = 0x00000008, + DM_COPIES = 0x00000100, + DM_DEFAULTSOURCE = 0x00000200, + DM_PRINTQUALITY = 0x00000400, + DM_COLOR = 0x00000800, + DM_DUPLEX = 0x00001000, + DM_YRESOLUTION = 0x00002000, + DM_COLLATE = 0x00008000, + DMORIENT_PORTRAIT = 1, + DMORIENT_LANDSCAPE = 2, + DMPAPER_LETTER = 1, + DMPAPER_LETTERSMALL = 2, + DMPAPER_TABLOID = 3, + DMPAPER_LEDGER = 4, + DMPAPER_LEGAL = 5, + DMPAPER_STATEMENT = 6, + DMPAPER_EXECUTIVE = 7, + DMPAPER_A3 = 8, + DMPAPER_A4 = 9, + DMPAPER_A4SMALL = 10, + DMPAPER_A5 = 11, + DMPAPER_B4 = 12, + DMPAPER_B5 = 13, + DMPAPER_FOLIO = 14, + DMPAPER_QUARTO = 15, + DMPAPER_10X14 = 16, + DMPAPER_11X17 = 17, + DMPAPER_NOTE = 18, + DMPAPER_ENV_9 = 19, + DMPAPER_ENV_10 = 20, + DMPAPER_ENV_11 = 21, + DMPAPER_ENV_12 = 22, + DMPAPER_ENV_14 = 23, + DMPAPER_CSHEET = 24, + DMPAPER_DSHEET = 25, + DMPAPER_ESHEET = 26, + DMPAPER_ENV_DL = 27, + DMPAPER_ENV_C5 = 28, + DMPAPER_ENV_C3 = 29, + DMPAPER_ENV_C4 = 30, + DMPAPER_ENV_C6 = 31, + DMPAPER_ENV_C65 = 32, + DMPAPER_ENV_B4 = 33, + DMPAPER_ENV_B5 = 34, + DMPAPER_ENV_B6 = 35, + DMPAPER_ENV_ITALY = 36, + DMPAPER_ENV_MONARCH = 37, + DMPAPER_ENV_PERSONAL = 38, + DMPAPER_FANFOLD_US = 39, + DMPAPER_FANFOLD_STD_GERMAN = 40, + DMPAPER_FANFOLD_LGL_GERMAN = 41, + DMPAPER_ISO_B4 = 42, + DMPAPER_JAPANESE_POSTCARD = 43, + DMPAPER_9X11 = 44, + DMPAPER_10X11 = 45, + DMPAPER_15X11 = 46, + DMPAPER_ENV_INVITE = 47, + DMPAPER_RESERVED_48 = 48, + DMPAPER_RESERVED_49 = 49, + DMPAPER_LETTER_EXTRA = 50, + DMPAPER_LEGAL_EXTRA = 51, + DMPAPER_TABLOID_EXTRA = 52, + DMPAPER_A4_EXTRA = 53, + DMPAPER_LETTER_TRANSVERSE = 54, + DMPAPER_A4_TRANSVERSE = 55, + DMPAPER_LETTER_EXTRA_TRANSVERSE = 56, + DMPAPER_A_PLUS = 57, + DMPAPER_B_PLUS = 58, + DMPAPER_LETTER_PLUS = 59, + DMPAPER_A4_PLUS = 60, + DMPAPER_A5_TRANSVERSE = 61, + DMPAPER_B5_TRANSVERSE = 62, + DMPAPER_A3_EXTRA = 63, + DMPAPER_A5_EXTRA = 64, + DMPAPER_B5_EXTRA = 65, + DMPAPER_A2 = 66, + DMPAPER_A3_TRANSVERSE = 67, + DMPAPER_A3_EXTRA_TRANSVERSE = 68, + + // WINVER >= 0x0500 + DMPAPER_DBL_JAPANESE_POSTCARD = 69, /* Japanese Double Postcard 200 x 148 mm */ + DMPAPER_A6 = 70, /* A6 105 x 148 mm */ + DMPAPER_JENV_KAKU2 = 71, /* Japanese Envelope Kaku #2 */ + DMPAPER_JENV_KAKU3 = 72, /* Japanese Envelope Kaku #3 */ + DMPAPER_JENV_CHOU3 = 73, /* Japanese Envelope Chou #3 */ + DMPAPER_JENV_CHOU4 = 74, /* Japanese Envelope Chou #4 */ + DMPAPER_LETTER_ROTATED = 75, /* Letter Rotated 11 x 8 1/2 11 in */ + DMPAPER_A3_ROTATED = 76, /* A3 Rotated 420 x 297 mm */ + DMPAPER_A4_ROTATED = 77, /* A4 Rotated 297 x 210 mm */ + DMPAPER_A5_ROTATED = 78, /* A5 Rotated 210 x 148 mm */ + DMPAPER_B4_JIS_ROTATED = 79, /* B4 (JIS) Rotated 364 x 257 mm */ + DMPAPER_B5_JIS_ROTATED = 80, /* B5 (JIS) Rotated 257 x 182 mm */ + DMPAPER_JAPANESE_POSTCARD_ROTATED = 81, /* Japanese Postcard Rotated 148 x 100 mm */ + DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82, /* Double Japanese Postcard Rotated 148 x 200 mm */ + DMPAPER_A6_ROTATED = 83, /* A6 Rotated 148 x 105 mm */ + DMPAPER_JENV_KAKU2_ROTATED = 84, /* Japanese Envelope Kaku #2 Rotated */ + DMPAPER_JENV_KAKU3_ROTATED = 85, /* Japanese Envelope Kaku #3 Rotated */ + DMPAPER_JENV_CHOU3_ROTATED = 86, /* Japanese Envelope Chou #3 Rotated */ + DMPAPER_JENV_CHOU4_ROTATED = 87, /* Japanese Envelope Chou #4 Rotated */ + DMPAPER_B6_JIS = 88, /* B6 (JIS) 128 x 182 mm */ + DMPAPER_B6_JIS_ROTATED = 89, /* B6 (JIS) Rotated 182 x 128 mm */ + DMPAPER_12X11 = 90, /* 12 x 11 in */ + DMPAPER_JENV_YOU4 = 91, /* Japanese Envelope You #4 */ + DMPAPER_JENV_YOU4_ROTATED = 92, /* Japanese Envelope You #4 Rotated*/ + DMPAPER_P16K = 93, /* PRC 16K 146 x 215 mm */ + DMPAPER_P32K = 94, /* PRC 32K 97 x 151 mm */ + DMPAPER_P32KBIG = 95, /* PRC 32K(Big) 97 x 151 mm */ + DMPAPER_PENV_1 = 96, /* PRC Envelope #1 102 x 165 mm */ + DMPAPER_PENV_2 = 97, /* PRC Envelope #2 102 x 176 mm */ + DMPAPER_PENV_3 = 98, /* PRC Envelope #3 125 x 176 mm */ + DMPAPER_PENV_4 = 99, /* PRC Envelope #4 110 x 208 mm */ + DMPAPER_PENV_5 = 100, /* PRC Envelope #5 110 x 220 mm */ + DMPAPER_PENV_6 = 101, /* PRC Envelope #6 120 x 230 mm */ + DMPAPER_PENV_7 = 102, /* PRC Envelope #7 160 x 230 mm */ + DMPAPER_PENV_8 = 103, /* PRC Envelope #8 120 x 309 mm */ + DMPAPER_PENV_9 = 104, /* PRC Envelope #9 229 x 324 mm */ + DMPAPER_PENV_10 = 105, /* PRC Envelope #10 324 x 458 mm */ + DMPAPER_P16K_ROTATED = 106, /* PRC 16K Rotated */ + DMPAPER_P32K_ROTATED = 107, /* PRC 32K Rotated */ + DMPAPER_P32KBIG_ROTATED = 108, /* PRC 32K(Big) Rotated */ + DMPAPER_PENV_1_ROTATED = 109, /* PRC Envelope #1 Rotated 165 x 102 mm */ + DMPAPER_PENV_2_ROTATED = 110, /* PRC Envelope #2 Rotated 176 x 102 mm */ + DMPAPER_PENV_3_ROTATED = 111, /* PRC Envelope #3 Rotated 176 x 125 mm */ + DMPAPER_PENV_4_ROTATED = 112, /* PRC Envelope #4 Rotated 208 x 110 mm */ + DMPAPER_PENV_5_ROTATED = 113, /* PRC Envelope #5 Rotated 220 x 110 mm */ + DMPAPER_PENV_6_ROTATED = 114, /* PRC Envelope #6 Rotated 230 x 120 mm */ + DMPAPER_PENV_7_ROTATED = 115, /* PRC Envelope #7 Rotated 230 x 160 mm */ + DMPAPER_PENV_8_ROTATED = 116, /* PRC Envelope #8 Rotated 309 x 120 mm */ + DMPAPER_PENV_9_ROTATED = 117, /* PRC Envelope #9 Rotated 324 x 229 mm */ + DMPAPER_PENV_10_ROTATED = 118, /* PRC Envelope #10 Rotated 458 x 324 mm */ + + DMPAPER_LAST = DMPAPER_PENV_10_ROTATED, + + DMBIN_UPPER = 1, + DMBIN_LOWER = 2, + DMBIN_MIDDLE = 3, + DMBIN_MANUAL = 4, + DMBIN_ENVELOPE = 5, + DMBIN_ENVMANUAL = 6, + DMBIN_AUTO = 7, + DMBIN_TRACTOR = 8, + DMBIN_SMALLFMT = 9, + DMBIN_LARGEFMT = 10, + DMBIN_LARGECAPACITY = 11, + DMBIN_CASSETTE = 14, + DMBIN_FORMSOURCE = 15, + DMBIN_LAST = 15, + DMBIN_USER = 256, + DMRES_DRAFT = -1, + DMRES_LOW = -2, + DMRES_MEDIUM = -3, + DMRES_HIGH = -4, + DMCOLOR_MONOCHROME = 1, + DMCOLOR_COLOR = 2, + DMDUP_SIMPLEX = 1, + DMDUP_VERTICAL = 2, + DMDUP_HORIZONTAL = 3, + + DMCOLLATE_FALSE = 0, + DMCOLLATE_TRUE = 1, + PRINTER_ENUM_LOCAL = 0x00000002, + PRINTER_ENUM_CONNECTIONS = 0x00000004, + SRCPAINT = 0x00EE0086, /* dest = source OR dest */ + SRCAND = 0x008800C6, /* dest = source AND dest */ + SRCINVERT = 0x00660046, /* dest = source XOR dest */ + SRCERASE = 0x00440328, /* dest = source AND (NOT dest ) */ + NOTSRCCOPY = 0x00330008, /* dest = (NOT source) */ + NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */ + MERGECOPY = 0x00C000CA, /* dest = (source AND pattern) */ + MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest */ + PATCOPY = 0x00F00021, /* dest = pattern */ + PATPAINT = 0x00FB0A09, /* dest = DPSnoo */ + PATINVERT = 0x005A0049, /* dest = pattern XOR dest */ + DSTINVERT = 0x00550009, /* dest = (NOT dest) */ + BLACKNESS = 0x00000042, /* dest = BLACK */ + WHITENESS = 0x00FF0062, /* dest = WHITE */ + CAPTUREBLT = 0x40000000, /* Include layered windows */ + SM_CXICON = 11, + SM_CYICON = 12, + DEFAULT_CHARSET = 1; + + public const int NOMIRRORBITMAP = unchecked((int)0x80000000); /* Do not Mirror the bitmap in this call */ + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateCompatibleBitmap", CharSet = CharSet.Auto)] + public static extern IntPtr IntCreateCompatibleBitmap(HandleRef hDC, int width, int height); + + public static IntPtr CreateCompatibleBitmap(HandleRef hDC, int width, int height) + { + return System.Internal.HandleCollector.Add(IntCreateCompatibleBitmap(hDC, width, height), CommonHandles.GDI); + } + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int BitBlt(HandleRef hDC, int x, int y, int nWidth, int nHeight, + HandleRef hSrcDC, int xSrc, int ySrc, int dwRop); + + [DllImport(ExternDll.Gdi32)] + public static extern int GetDIBits(HandleRef hdc, HandleRef hbm, int arg1, int arg2, IntPtr arg3, ref NativeMethods.BITMAPINFO_FLAT bmi, int arg5); + + [DllImport(ExternDll.Gdi32)] + public static extern uint GetPaletteEntries(HandleRef hpal, int iStartIndex, int nEntries, byte[] lppe); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateDIBSection", CharSet = CharSet.Auto)] + public static extern IntPtr IntCreateDIBSection(HandleRef hdc, ref NativeMethods.BITMAPINFO_FLAT bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset); + + public static IntPtr CreateDIBSection(HandleRef hdc, ref NativeMethods.BITMAPINFO_FLAT bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset) + { + return System.Internal.HandleCollector.Add(IntCreateDIBSection(hdc, ref bmi, iUsage, ref ppvBits, hSection, dwOffset), SafeNativeMethods.CommonHandles.GDI); + } + + [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern IntPtr GlobalFree(HandleRef handle); + + [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern int StartDoc(HandleRef hDC, DOCINFO lpDocInfo); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int StartPage(HandleRef hDC); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int EndPage(HandleRef hDC); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int AbortDoc(HandleRef hDC); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int EndDoc(HandleRef hDC); + + [DllImport(ExternDll.Comdlg32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool PrintDlg([In, Out] PRINTDLG lppd); + + [DllImport(ExternDll.Comdlg32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern bool PrintDlg([In, Out] PRINTDLGX86 lppd); + + [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = CharSet.Auto)] + public static extern int DeviceCapabilities(string pDevice, string pPort, short fwCapabilities, IntPtr pOutput, IntPtr /*DEVMODE*/ pDevMode); + + [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)] + public static extern int DocumentProperties(HandleRef hwnd, HandleRef hPrinter, string pDeviceName, IntPtr /*DEVMODE*/ pDevModeOutput, HandleRef /*DEVMODE*/ pDevModeInput, int fMode); + + [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)] + public static extern int DocumentProperties(HandleRef hwnd, HandleRef hPrinter, string pDeviceName, IntPtr /*DEVMODE*/ pDevModeOutput, IntPtr /*DEVMODE*/ pDevModeInput, int fMode); + + [DllImport(ExternDll.Winspool, SetLastError = true, CharSet = CharSet.Auto)] + public static extern int EnumPrinters(int flags, string name, int level, IntPtr pPrinterEnum/*buffer*/, + int cbBuf, out int pcbNeeded, out int pcReturned); + + [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern IntPtr GlobalLock(HandleRef handle); + + [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern IntPtr /*HDC*/ ResetDC(HandleRef hDC, HandleRef /*DEVMODE*/ lpDevMode); + + [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern bool GlobalUnlock(HandleRef handle); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "CreateRectRgn", CharSet = CharSet.Auto)] + private static extern IntPtr IntCreateRectRgn(int x1, int y1, int x2, int y2); + + public static IntPtr CreateRectRgn(int x1, int y1, int x2, int y2) + { + return System.Internal.HandleCollector.Add(IntCreateRectRgn(x1, y1, x2, y2), SafeNativeMethods.CommonHandles.GDI); + } + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int GetClipRgn(HandleRef hDC, HandleRef hRgn); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int SelectClipRgn(HandleRef hDC, HandleRef hRgn); + + [SuppressMessage("Microsoft.Security", "CA2101:SpecifyMarshalingForPInvokeStringArguments")] + [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern int AddFontResourceEx(string lpszFilename, int fl, IntPtr pdv); + + public static int AddFontFile(string fileName) + { + return AddFontResourceEx(fileName, /*FR_PRIVATE*/ 0x10, IntPtr.Zero); + } + + internal static IntPtr SaveClipRgn(IntPtr hDC) + { + IntPtr hTempRgn = CreateRectRgn(0, 0, 0, 0); + IntPtr hSaveRgn = IntPtr.Zero; + try + { + int result = GetClipRgn(new HandleRef(null, hDC), new HandleRef(null, hTempRgn)); + if (result > 0) + { + hSaveRgn = hTempRgn; + hTempRgn = IntPtr.Zero; + } + } + finally + { + if (hTempRgn != IntPtr.Zero) + { + DeleteObject(new HandleRef(null, hTempRgn)); + } + } + + return hSaveRgn; + } + + internal static void RestoreClipRgn(IntPtr hDC, IntPtr hRgn) + { + try + { + SelectClipRgn(new HandleRef(null, hDC), new HandleRef(null, hRgn)); + } + finally + { + if (hRgn != IntPtr.Zero) + { + DeleteObject(new HandleRef(null, hRgn)); + } + } + } + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int ExtEscape(HandleRef hDC, int nEscape, int cbInput, ref int inData, int cbOutput, [Out] out int outData); + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int ExtEscape(HandleRef hDC, int nEscape, int cbInput, byte[] inData, int cbOutput, [Out] out int outData); + + public const int QUERYESCSUPPORT = 8, CHECKJPEGFORMAT = 4119, CHECKPNGFORMAT = 4120; + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern int IntersectClipRect(HandleRef hDC, int x1, int y1, int x2, int y2); + + [DllImport(ExternDll.Kernel32, SetLastError = true, ExactSpelling = true, EntryPoint = "GlobalAlloc", CharSet = CharSet.Auto)] + public static extern IntPtr IntGlobalAlloc(int uFlags, UIntPtr dwBytes); // size should be 32/64bits compatible + + public static IntPtr GlobalAlloc(int uFlags, uint dwBytes) + { + return IntGlobalAlloc(uFlags, new UIntPtr(dwBytes)); + } + + static internal unsafe void ZeroMemory(byte* ptr, ulong length) + { + byte* end = ptr + length; + while (ptr != end) *ptr++ = 0; + } + + public const int ERROR_ACCESS_DENIED = 5; + public const int ERROR_INVALID_PARAMETER = 87; + public const int ERROR_PROC_NOT_FOUND = 127; + + + [StructLayout(LayoutKind.Sequential)] + public class ENHMETAHEADER + { + /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader. + /// Extreme care should be taken if changing the layout of the corresponding managed + /// structures to minimize the risk of buffer overruns. The affected managed classes + /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf. + public int iType; + public int nSize = 40; // ndirect.DllLib.sizeOf( this ) + // rclBounds was a by-value RECTL structure + public int rclBounds_left; + public int rclBounds_top; + public int rclBounds_right; + public int rclBounds_bottom; + // rclFrame was a by-value RECTL structure + public int rclFrame_left; + public int rclFrame_top; + public int rclFrame_right; + public int rclFrame_bottom; + public int dSignature; + public int nVersion; + public int nBytes; + public int nRecords; + public short nHandles; + public short sReserved; + public int nDescription; + public int offDescription; + public int nPalEntries; + // szlDevice was a by-value SIZE structure + public int szlDevice_cx; + public int szlDevice_cy; + // szlMillimeters was a by-value SIZE structure + public int szlMillimeters_cx; + public int szlMillimeters_cy; + public int cbPixelFormat; + public int offPixelFormat; + public int bOpenGL; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public class DOCINFO + { + public int cbSize = 20; + public string lpszDocName; + public string lpszOutput; + public string lpszDatatype; + public int fwType; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public class PRINTDLG + { + public int lStructSize; + public IntPtr hwndOwner; + public IntPtr hDevMode; + public IntPtr hDevNames; + public IntPtr hDC; + public int Flags; + public short nFromPage; + public short nToPage; + public short nMinPage; + public short nMaxPage; + public short nCopies; + public IntPtr hInstance; + public IntPtr lCustData; + public IntPtr lpfnPrintHook; + public IntPtr lpfnSetupHook; + public string lpPrintTemplateName; + public string lpSetupTemplateName; + public IntPtr hPrintTemplate; + public IntPtr hSetupTemplate; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)] + public class PRINTDLGX86 + { + public int lStructSize; + public IntPtr hwndOwner; + public IntPtr hDevMode; + public IntPtr hDevNames; + public IntPtr hDC; + public int Flags; + public short nFromPage; + public short nToPage; + public short nMinPage; + public short nMaxPage; + public short nCopies; + public IntPtr hInstance; + public IntPtr lCustData; + public IntPtr lpfnPrintHook; + public IntPtr lpfnSetupHook; + public string lpPrintTemplateName; + public string lpSetupTemplateName; + public IntPtr hPrintTemplate; + public IntPtr hSetupTemplate; + } + + [StructLayout(LayoutKind.Sequential)] + public class ICONINFO + { + public int fIcon; + public int xHotspot; + public int yHotspot; + public IntPtr hbmMask = IntPtr.Zero; + public IntPtr hbmColor = IntPtr.Zero; + } + + [StructLayout(LayoutKind.Sequential)] + public class BITMAP + { + public int bmType; + public int bmWidth; + public int bmHeight; + public int bmWidthBytes; + public short bmPlanes; + public short bmBitsPixel; + public IntPtr bmBits = IntPtr.Zero; + } + + [StructLayout(LayoutKind.Sequential)] + public class BITMAPINFOHEADER + { + public int biSize = 40; + public int biWidth; + public int biHeight; + public short biPlanes; + public short biBitCount; + public int biCompression; + public int biSizeImage; + public int biXPelsPerMeter; + public int biYPelsPerMeter; + public int biClrUsed; + public int biClrImportant; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public class LOGFONT + { + public int lfHeight; + public int lfWidth; + public int lfEscapement; + public int lfOrientation; + public int lfWeight; + public byte lfItalic; + public byte lfUnderline; + public byte lfStrikeOut; + public byte lfCharSet; + public byte lfOutPrecision; + public byte lfClipPrecision; + public byte lfQuality; + public byte lfPitchAndFamily; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string lfFaceName; + + public override string ToString() + { + return + "lfHeight=" + lfHeight + ", " + + "lfWidth=" + lfWidth + ", " + + "lfEscapement=" + lfEscapement + ", " + + "lfOrientation=" + lfOrientation + ", " + + "lfWeight=" + lfWeight + ", " + + "lfItalic=" + lfItalic + ", " + + "lfUnderline=" + lfUnderline + ", " + + "lfStrikeOut=" + lfStrikeOut + ", " + + "lfCharSet=" + lfCharSet + ", " + + "lfOutPrecision=" + lfOutPrecision + ", " + + "lfClipPrecision=" + lfClipPrecision + ", " + + "lfQuality=" + lfQuality + ", " + + "lfPitchAndFamily=" + lfPitchAndFamily + ", " + + "lfFaceName=" + lfFaceName; + } + } + + [StructLayout(LayoutKind.Sequential, Pack = 2)] + public struct ICONDIR + { + public short idReserved; + public short idType; + public short idCount; + public ICONDIRENTRY idEntries; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ICONDIRENTRY + { + public byte bWidth; + public byte bHeight; + public byte bColorCount; + public byte bReserved; + public short wPlanes; + public short wBitCount; + public int dwBytesInRes; + public int dwImageOffset; + } + + public class Ole + { + public const int PICTYPE_ICON = 3; + } + + [StructLayout(LayoutKind.Sequential)] + public class PICTDESC + { + internal int cbSizeOfStruct; + public int picType; + internal IntPtr union1; + internal int union2; + internal int union3; + + public static PICTDESC CreateIconPICTDESC(IntPtr hicon) + { + return new PICTDESC() + { + cbSizeOfStruct = 12, + picType = Ole.PICTYPE_ICON, + union1 = hicon + }; + } + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public class DEVMODE + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string dmDeviceName; + public short dmSpecVersion; + public short dmDriverVersion; + public short dmSize; + public short dmDriverExtra; + public int dmFields; + public short dmOrientation; + public short dmPaperSize; + public short dmPaperLength; + public short dmPaperWidth; + public short dmScale; + public short dmCopies; + public short dmDefaultSource; + public short dmPrintQuality; + public short dmColor; + public short dmDuplex; + public short dmYResolution; + public short dmTTOption; + public short dmCollate; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string dmFormName; + public short dmLogPixels; + public int dmBitsPerPel; + public int dmPelsWidth; + public int dmPelsHeight; + public int dmDisplayFlags; + public int dmDisplayFrequency; + public int dmICMMethod; + public int dmICMIntent; + public int dmMediaType; + public int dmDitherType; + public int dmICCManufacturer; + public int dmICCModel; + public int dmPanningWidth; + public int dmPanningHeight; + + + public override string ToString() + { + return "[DEVMODE: " + + "dmDeviceName=" + dmDeviceName + + ", dmSpecVersion=" + dmSpecVersion + + ", dmDriverVersion=" + dmDriverVersion + + ", dmSize=" + dmSize + + ", dmDriverExtra=" + dmDriverExtra + + ", dmFields=" + dmFields + + ", dmOrientation=" + dmOrientation + + ", dmPaperSize=" + dmPaperSize + + ", dmPaperLength=" + dmPaperLength + + ", dmPaperWidth=" + dmPaperWidth + + ", dmScale=" + dmScale + + ", dmCopies=" + dmCopies + + ", dmDefaultSource=" + dmDefaultSource + + ", dmPrintQuality=" + dmPrintQuality + + ", dmColor=" + dmColor + + ", dmDuplex=" + dmDuplex + + ", dmYResolution=" + dmYResolution + + ", dmTTOption=" + dmTTOption + + ", dmCollate=" + dmCollate + + ", dmFormName=" + dmFormName + + ", dmLogPixels=" + dmLogPixels + + ", dmBitsPerPel=" + dmBitsPerPel + + ", dmPelsWidth=" + dmPelsWidth + + ", dmPelsHeight=" + dmPelsHeight + + ", dmDisplayFlags=" + dmDisplayFlags + + ", dmDisplayFrequency=" + dmDisplayFrequency + + ", dmICMMethod=" + dmICMMethod + + ", dmICMIntent=" + dmICMIntent + + ", dmMediaType=" + dmMediaType + + ", dmDitherType=" + dmDitherType + + ", dmICCManufacturer=" + dmICCManufacturer + + ", dmICCModel=" + dmICCModel + + ", dmPanningWidth=" + dmPanningWidth + + ", dmPanningHeight=" + dmPanningHeight + + "]"; + } + } + + public sealed class CommonHandles + { + static CommonHandles() + { +#if DEBUG + // Setup the DebugHandleTracker + DebugHandleTracker.Initialize(); + AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload); + AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit); +#endif + } + + /// + /// Handle type for GDI objects. + /// + public static readonly int GDI = System.Internal.HandleCollector.RegisterType("GDI", 50, 500); + + /// + /// Handle type for HDC's that count against the Win98 limit of five DC's. + /// HDC's which are not scarce, such as HDC's for bitmaps, are counted as GDIHANDLE's. + /// + public static readonly int HDC = System.Internal.HandleCollector.RegisterType("HDC", 100, 2); // wait for 2 dc's before collecting + + /// + /// Handle type for icons. + /// + public static readonly int Icon = System.Internal.HandleCollector.RegisterType("Icon", 20, 500); + + /// + /// Handle type for kernel objects. + /// + public static readonly int Kernel = System.Internal.HandleCollector.RegisterType("Kernel", 0, 1000); + +#if DEBUG + private static void CurrentDomain_DomainUnload(object sender, EventArgs e) + { + DebugHandleTracker.CheckLeaks(); + } + + private static void CurrentDomain_ProcessExit(object sender, EventArgs e) + { + DebugHandleTracker.CheckLeaks(); + } +#endif + } + + public class StreamConsts + { + public const int STREAM_SEEK_SET = 0x0; + public const int STREAM_SEEK_CUR = 0x1; + public const int STREAM_SEEK_END = 0x2; + } + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "DeleteObject", CharSet = CharSet.Auto)] + internal static extern int IntDeleteObject(HandleRef hObject); + + public static int DeleteObject(HandleRef hObject) + { + System.Internal.HandleCollector.Remove((IntPtr)hObject, CommonHandles.GDI); + return IntDeleteObject(hObject); + } + + [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern IntPtr SelectObject(HandleRef hdc, HandleRef obj); + + [DllImport(ExternDll.User32, SetLastError = true, EntryPoint = "CreateIconFromResourceEx")] + private unsafe static extern IntPtr IntCreateIconFromResourceEx(byte* pbIconBits, int cbIconBits, bool fIcon, int dwVersion, int csDesired, int cyDesired, int flags); + + public unsafe static IntPtr CreateIconFromResourceEx(byte* pbIconBits, int cbIconBits, bool fIcon, int dwVersion, int csDesired, int cyDesired, int flags) + { + return System.Internal.HandleCollector.Add(IntCreateIconFromResourceEx(pbIconBits, cbIconBits, fIcon, dwVersion, csDesired, cyDesired, flags), SafeNativeMethods.CommonHandles.Icon); + } + + [DllImport(ExternDll.Shell32, CharSet = CharSet.Auto, BestFitMapping = false, EntryPoint = "ExtractAssociatedIcon")] + public unsafe static extern IntPtr IntExtractAssociatedIcon(HandleRef hInst, StringBuilder iconPath, ref int index); + + public unsafe static IntPtr ExtractAssociatedIcon(HandleRef hInst, StringBuilder iconPath, ref int index) + { + return System.Internal.HandleCollector.Add(IntExtractAssociatedIcon(hInst, iconPath, ref index), CommonHandles.Icon); + } + + [DllImport(ExternDll.User32, SetLastError = true, EntryPoint = "LoadIcon", CharSet = CharSet.Auto)] + private static extern IntPtr IntLoadIcon(HandleRef hInst, IntPtr iconId); + + public static IntPtr LoadIcon(HandleRef hInst, int iconId) + { + // We only use the case were the low word of the IntPtr is used a resource id but it still has to be an intptr. + return IntLoadIcon(hInst, new IntPtr(iconId)); + } + + [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "DestroyIcon", CharSet = CharSet.Auto)] + private static extern bool IntDestroyIcon(HandleRef hIcon); + + public static bool DestroyIcon(HandleRef hIcon) + { + System.Internal.HandleCollector.Remove((IntPtr)hIcon, SafeNativeMethods.CommonHandles.Icon); + return IntDestroyIcon(hIcon); + } + + [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, EntryPoint = "CopyImage", CharSet = CharSet.Auto)] + private static extern IntPtr IntCopyImage(HandleRef hImage, int uType, int cxDesired, int cyDesired, int fuFlags); + + public static IntPtr CopyImage(HandleRef hImage, int uType, int cxDesired, int cyDesired, int fuFlags) + { + int handleType; + switch (uType) + { + case IMAGE_ICON: + handleType = CommonHandles.Icon; + break; + default: + handleType = CommonHandles.GDI; + break; + } + return System.Internal.HandleCollector.Add(IntCopyImage(hImage, uType, cxDesired, cyDesired, fuFlags), handleType); + } + + // GetObject stuff + [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] BITMAP bm); + + [DllImport(ExternDll.Gdi32, SetLastError = true, CharSet = CharSet.Auto)] + public static extern int GetObject(HandleRef hObject, int nSize, [In, Out] LOGFONT lf); + + public static int GetObject(HandleRef hObject, LOGFONT lp) + { + return GetObject(hObject, Marshal.SizeOf(typeof(LOGFONT)), lp); + } + + [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern bool GetIconInfo(HandleRef hIcon, [In, Out] ICONINFO info); + + [DllImport(ExternDll.User32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] + public static extern bool DrawIconEx(HandleRef hDC, int x, int y, HandleRef hIcon, int width, int height, int iStepIfAniCursor, HandleRef hBrushFlickerFree, int diFlags); + +#if CUSTOM_MARSHALING_ISTREAM + [DllImport(ExternDll.Oleaut32, PreserveSig=false)] + public static extern IPicture OleLoadPictureEx( + [return: MarshalAs(UnmanagedType.CustomMarshaler,MarshalType="StreamToIStreamMarshaler")] Stream pStream, + int lSize, bool fRunmode, ref Guid refiid, int width, int height, int dwFlags); + + +#endif + [DllImport(ExternDll.Oleaut32, PreserveSig = false)] + public static extern IPicture OleCreatePictureIndirect(SafeNativeMethods.PICTDESC pictdesc, [In]ref Guid refiid, bool fOwn); + + [ComImport()] + [Guid("7BF80980-BF32-101A-8BBB-00AA00300CAB")] + [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IPicture + { + [SuppressUnmanagedCodeSecurity] + IntPtr GetHandle(); + + [SuppressUnmanagedCodeSecurity] + IntPtr GetHPal(); + + [return: MarshalAs(UnmanagedType.I2)] + [SuppressUnmanagedCodeSecurity] + short GetPictureType(); + + [SuppressUnmanagedCodeSecurity] + int GetWidth(); + + [SuppressUnmanagedCodeSecurity] + int GetHeight(); + + [SuppressUnmanagedCodeSecurity] + void Render(); + + [SuppressUnmanagedCodeSecurity] + void SetHPal([In] IntPtr phpal); + + [SuppressUnmanagedCodeSecurity] + IntPtr GetCurDC(); + + [SuppressUnmanagedCodeSecurity] + void SelectPicture([In] IntPtr hdcIn, + [Out, MarshalAs(UnmanagedType.LPArray)] int[] phdcOut, + [Out, MarshalAs(UnmanagedType.LPArray)] int[] phbmpOut); + + [return: MarshalAs(UnmanagedType.Bool)] + [SuppressUnmanagedCodeSecurity] + bool GetKeepOriginalFormat(); + + [SuppressUnmanagedCodeSecurity] + void SetKeepOriginalFormat([In, MarshalAs(UnmanagedType.Bool)] bool pfkeep); + + [SuppressUnmanagedCodeSecurity] + void PictureChanged(); + + [SuppressUnmanagedCodeSecurity] + [PreserveSig] + int SaveAsFile([In, MarshalAs(UnmanagedType.Interface)] UnsafeNativeMethods.IStream pstm, + [In] int fSaveMemCopy, + [Out] out int pcbSize); + + [SuppressUnmanagedCodeSecurity] + int GetAttributes(); + + [SuppressUnmanagedCodeSecurity] + void SetHdc([In] IntPtr hdc); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs.REMOVED.git-id deleted file mode 100644 index 97f630b89d..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b7a2c6e61f42c76c2ba38159c3270a12231e6349 \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs.REMOVED.git-id new file mode 100644 index 0000000000..507b08e578 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs.REMOVED.git-id @@ -0,0 +1 @@ +b6bca4984ed6d22b5fe95202452c9ce6a391f130 \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs.REMOVED.git-id new file mode 100644 index 0000000000..79013d34ab --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.Windows.cs.REMOVED.git-id @@ -0,0 +1 @@ +fb5077cfa16bc0077bdabce8ba730320907a4e8a \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs.REMOVED.git-id new file mode 100644 index 0000000000..995f803f6e --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GdiplusNative.cs.REMOVED.git-id @@ -0,0 +1 @@ +32f468bca56c69c2f37dcc41a18cf87332f69e4a \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs new file mode 100644 index 0000000000..4cf0917f63 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.Unix.cs @@ -0,0 +1,2218 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Graphics.cs +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out) +// Alexandre Pigolkine(pigolkine@gmx.de) +// Jordi Mas i Hernandez (jordi@ximian.com) +// Sebastien Pouliot +// +// Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com) +// Copyright (C) 2004-2006 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.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.Drawing.Internal; +using System.Drawing.Text; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Text; + +namespace System.Drawing +{ + public sealed partial class Graphics : MarshalByRefObject, IDisposable + , IDeviceContext + { + internal IntPtr nativeObject = IntPtr.Zero; + internal IMacContext maccontext; + private bool disposed = false; + private static float defDpiX = 0; + private static float defDpiY = 0; + private IntPtr deviceContextHdc; + + public delegate bool EnumerateMetafileProc(EmfPlusRecordType recordType, + int flags, + int dataSize, + IntPtr data, + PlayRecordCallback callbackData); + + public delegate bool DrawImageAbort(IntPtr callbackdata); + + internal Graphics(IntPtr nativeGraphics) + { + nativeObject = nativeGraphics; + } + + ~Graphics() + { + Dispose(); + } + + static internal float systemDpiX + { + get + { + if (defDpiX == 0) + { + Bitmap bmp = new Bitmap(1, 1); + Graphics g = Graphics.FromImage(bmp); + defDpiX = g.DpiX; + defDpiY = g.DpiY; + } + return defDpiX; + } + } + + static internal float systemDpiY + { + get + { + if (defDpiY == 0) + { + Bitmap bmp = new Bitmap(1, 1); + Graphics g = Graphics.FromImage(bmp); + defDpiX = g.DpiX; + defDpiY = g.DpiY; + } + return defDpiY; + } + } + + // For CoreFX compatibility + internal IntPtr NativeGraphics => nativeObject; + + internal IntPtr NativeObject + { + get + { + return nativeObject; + } + + set + { + nativeObject = value; + } + } + + [MonoTODO("Metafiles, both WMF and EMF formats, aren't supported.")] + public void AddMetafileComment(byte[] data) + { + throw new NotImplementedException(); + } + + public GraphicsContainer BeginContainer() + { + int state; + int status = SafeNativeMethods.Gdip.GdipBeginContainer2(new HandleRef(this, nativeObject), out state); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new GraphicsContainer(state); + } + + [MonoTODO("The rectangles and unit parameters aren't supported in libgdiplus")] + public GraphicsContainer BeginContainer(Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit) + { + int state; + + var dstf = new GPRECT(dstrect); + var srcf = new GPRECT(srcrect); + + int status = SafeNativeMethods.Gdip.GdipBeginContainerI(new HandleRef(this, nativeObject), ref dstf, ref srcf, unchecked((int)unit), out state); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new GraphicsContainer(state); + } + + [MonoTODO("The rectangles and unit parameters aren't supported in libgdiplus")] + public GraphicsContainer BeginContainer(RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit) + { + int state; + + var dstf = new GPRECTF(dstrect); + var srcf = new GPRECTF(srcrect); + + int status = SafeNativeMethods.Gdip.GdipBeginContainer(new HandleRef(this, nativeObject), ref dstf, ref srcf, unchecked((int)unit), out state); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new GraphicsContainer(state); + } + + + public void Clear(Color color) + { + int status; + status = SafeNativeMethods.Gdip.GdipGraphicsClear(nativeObject, color.ToArgb()); + SafeNativeMethods.Gdip.CheckStatus(status); + } + [MonoLimitation("Works on Win32 and on X11 (but not on Cocoa and Quartz)")] + public void CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize) + { + CopyFromScreen(upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y, + blockRegionSize, CopyPixelOperation.SourceCopy); + } + + [MonoLimitation("Works on Win32 and (for CopyPixelOperation.SourceCopy only) on X11 but not on Cocoa and Quartz")] + public void CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation) + { + CopyFromScreen(upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y, + blockRegionSize, copyPixelOperation); + } + + [MonoLimitation("Works on Win32 and on X11 (but not on Cocoa and Quartz)")] + public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize) + { + CopyFromScreen(sourceX, sourceY, destinationX, destinationY, blockRegionSize, + CopyPixelOperation.SourceCopy); + } + + [MonoLimitation("Works on Win32 and (for CopyPixelOperation.SourceCopy only) on X11 but not on Cocoa and Quartz")] + public void CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) + { + if (!Enum.IsDefined(typeof(CopyPixelOperation), copyPixelOperation)) + throw new InvalidEnumArgumentException(string.Format("Enum argument value '{0}' is not valid for CopyPixelOperation", copyPixelOperation)); + + if (SafeNativeMethods.Gdip.UseX11Drawable) + { + CopyFromScreenX11(sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation); + } + else if (SafeNativeMethods.Gdip.UseCarbonDrawable) + { + CopyFromScreenMac(sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation); + } + else if (SafeNativeMethods.Gdip.UseCocoaDrawable) + { + CopyFromScreenMac(sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation); + } + } + + private void CopyFromScreenMac(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) + { + throw new NotImplementedException(); + } + + private void CopyFromScreenX11(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) + { + IntPtr window, image, defvisual, vPtr; + int AllPlanes = ~0, nitems = 0, pixel; + + if (copyPixelOperation != CopyPixelOperation.SourceCopy) + throw new NotImplementedException("Operation not implemented under X11"); + + if (SafeNativeMethods.Gdip.Display == IntPtr.Zero) + { + SafeNativeMethods.Gdip.Display = LibX11Functions.XOpenDisplay(IntPtr.Zero); + } + + window = LibX11Functions.XRootWindow(SafeNativeMethods.Gdip.Display, 0); + defvisual = LibX11Functions.XDefaultVisual(SafeNativeMethods.Gdip.Display, 0); + XVisualInfo visual = new XVisualInfo(); + + /* Get XVisualInfo for this visual */ + visual.visualid = LibX11Functions.XVisualIDFromVisual(defvisual); + vPtr = LibX11Functions.XGetVisualInfo(SafeNativeMethods.Gdip.Display, 0x1 /* VisualIDMask */, ref visual, ref nitems); + visual = (XVisualInfo)Marshal.PtrToStructure(vPtr, typeof(XVisualInfo)); +#if false + Console.WriteLine ("visual\t{0}", visual.visual); + Console.WriteLine ("visualid\t{0}", visual.visualid); + Console.WriteLine ("screen\t{0}", visual.screen); + Console.WriteLine ("depth\t{0}", visual.depth); + Console.WriteLine ("klass\t{0}", visual.klass); + Console.WriteLine ("red_mask\t{0:X}", visual.red_mask); + Console.WriteLine ("green_mask\t{0:X}", visual.green_mask); + Console.WriteLine ("blue_mask\t{0:X}", visual.blue_mask); + Console.WriteLine ("colormap_size\t{0}", visual.colormap_size); + Console.WriteLine ("bits_per_rgb\t{0}", visual.bits_per_rgb); +#endif + image = LibX11Functions.XGetImage(SafeNativeMethods.Gdip.Display, window, sourceX, sourceY, blockRegionSize.Width, + blockRegionSize.Height, AllPlanes, 2 /* ZPixmap*/); + if (image == IntPtr.Zero) + { + string s = String.Format("XGetImage returned NULL when asked to for a {0}x{1} region block", + blockRegionSize.Width, blockRegionSize.Height); + throw new InvalidOperationException(s); + } + + Bitmap bmp = new Bitmap(blockRegionSize.Width, blockRegionSize.Height); + int red, blue, green; + int red_mask = (int)visual.red_mask; + int blue_mask = (int)visual.blue_mask; + int green_mask = (int)visual.green_mask; + for (int y = 0; y < blockRegionSize.Height; y++) + { + for (int x = 0; x < blockRegionSize.Width; x++) + { + pixel = LibX11Functions.XGetPixel(image, x, y); + + switch (visual.depth) + { + case 16: /* 16bbp pixel transformation */ + red = (int)((pixel & red_mask) >> 8) & 0xff; + green = (int)(((pixel & green_mask) >> 3)) & 0xff; + blue = (int)((pixel & blue_mask) << 3) & 0xff; + break; + case 24: + case 32: + red = (int)((pixel & red_mask) >> 16) & 0xff; + green = (int)(((pixel & green_mask) >> 8)) & 0xff; + blue = (int)((pixel & blue_mask)) & 0xff; + break; + default: + string text = string.Format("{0}bbp depth not supported.", visual.depth); + throw new NotImplementedException(text); + } + + bmp.SetPixel(x, y, Color.FromArgb(255, red, green, blue)); + } + } + + DrawImage(bmp, destinationX, destinationY); + bmp.Dispose(); + LibX11Functions.XDestroyImage(image); + LibX11Functions.XFree(vPtr); + } + + public void Dispose() + { + int status; + if (!disposed) + { + if (SafeNativeMethods.Gdip.UseCarbonDrawable || SafeNativeMethods.Gdip.UseCocoaDrawable) + { + Flush(); + if (maccontext != null) + maccontext.Release(); + } + + status = SafeNativeMethods.Gdip.GdipDeleteGraphics(nativeObject); + nativeObject = IntPtr.Zero; + SafeNativeMethods.Gdip.CheckStatus(status); + disposed = true; + } + + GC.SuppressFinalize(this); + } + + + public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle) + { + DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + } + + + public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle) + { + DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + } + + + public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) + { + int status; + if (pen == null) + throw new ArgumentNullException("pen"); + + status = SafeNativeMethods.Gdip.GdipDrawArc(nativeObject, pen.NativePen, + x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // Microsoft documentation states that the signature for this member should be + // public void DrawArc( Pen pen, int x, int y, int width, int height, int startAngle, + // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params + public void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) + { + int status; + if (pen == null) + throw new ArgumentNullException("pen"); + status = SafeNativeMethods.Gdip.GdipDrawArcI(nativeObject, pen.NativePen, + x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4) + { + int status; + if (pen == null) + throw new ArgumentNullException("pen"); + status = SafeNativeMethods.Gdip.GdipDrawBezier(nativeObject, pen.NativePen, + pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, + pt3.Y, pt4.X, pt4.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4) + { + int status; + if (pen == null) + throw new ArgumentNullException("pen"); + status = SafeNativeMethods.Gdip.GdipDrawBezierI(nativeObject, pen.NativePen, + pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, + pt3.Y, pt4.X, pt4.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) + { + int status; + if (pen == null) + throw new ArgumentNullException("pen"); + status = SafeNativeMethods.Gdip.GdipDrawBezier(nativeObject, pen.NativePen, x1, + y1, x2, y2, x3, y3, x4, y4); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawBeziers(Pen pen, Point[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int length = points.Length; + int status; + + if (length < 4) + return; + + for (int i = 0; i < length - 1; i += 3) + { + Point p1 = points[i]; + Point p2 = points[i + 1]; + Point p3 = points[i + 2]; + Point p4 = points[i + 3]; + + status = SafeNativeMethods.Gdip.GdipDrawBezier(nativeObject, + pen.NativePen, + p1.X, p1.Y, p2.X, p2.Y, + p3.X, p3.Y, p4.X, p4.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public void DrawBeziers(Pen pen, PointF[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int length = points.Length; + int status; + + if (length < 4) + return; + + for (int i = 0; i < length - 1; i += 3) + { + PointF p1 = points[i]; + PointF p2 = points[i + 1]; + PointF p3 = points[i + 2]; + PointF p4 = points[i + 3]; + + status = SafeNativeMethods.Gdip.GdipDrawBezier(nativeObject, + pen.NativePen, + p1.X, p1.Y, p2.X, p2.Y, + p3.X, p3.Y, p4.X, p4.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + + public void DrawClosedCurve(Pen pen, PointF[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawClosedCurve(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawClosedCurve(Pen pen, Point[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawClosedCurveI(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged + // GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule) + public void DrawClosedCurve(Pen pen, Point[] points, float tension, FillMode fillmode) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawClosedCurve2I(nativeObject, pen.NativePen, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged + // GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule) + public void DrawClosedCurve(Pen pen, PointF[] points, float tension, FillMode fillmode) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawClosedCurve2(nativeObject, pen.NativePen, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, Point[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurveI(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, PointF[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurve(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, PointF[] points, float tension) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurve2(nativeObject, pen.NativePen, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, Point[] points, float tension) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurve2I(nativeObject, pen.NativePen, points, points.Length, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurve3(nativeObject, pen.NativePen, + points, points.Length, offset, + numberOfSegments, 0.5f); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments, float tension) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurve3I(nativeObject, pen.NativePen, + points, points.Length, offset, + numberOfSegments, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments, float tension) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + + int status; + status = SafeNativeMethods.Gdip.GdipDrawCurve3(nativeObject, pen.NativePen, + points, points.Length, offset, + numberOfSegments, tension); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawEllipse(Pen pen, Rectangle rect) + { + if (pen == null) + throw new ArgumentNullException("pen"); + + DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void DrawEllipse(Pen pen, RectangleF rect) + { + if (pen == null) + throw new ArgumentNullException("pen"); + DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void DrawEllipse(Pen pen, int x, int y, int width, int height) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status; + status = SafeNativeMethods.Gdip.GdipDrawEllipseI(nativeObject, pen.NativePen, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawEllipse(Pen pen, float x, float y, float width, float height) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawEllipse(nativeObject, pen.NativePen, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawIcon(Icon icon, Rectangle targetRect) + { + if (icon == null) + throw new ArgumentNullException("icon"); + + DrawImage(icon.GetInternalBitmap(), targetRect); + } + + public void DrawIcon(Icon icon, int x, int y) + { + if (icon == null) + throw new ArgumentNullException("icon"); + + DrawImage(icon.GetInternalBitmap(), x, y); + } + + public void DrawIconUnstretched(Icon icon, Rectangle targetRect) + { + if (icon == null) + throw new ArgumentNullException("icon"); + + DrawImageUnscaled(icon.GetInternalBitmap(), targetRect); + } + + public void DrawImage(Image image, RectangleF rect) + { + if (image == null) + throw new ArgumentNullException("image"); + + int status = SafeNativeMethods.Gdip.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, PointF point) + { + if (image == null) + throw new ArgumentNullException("image"); + + int status = SafeNativeMethods.Gdip.GdipDrawImage(nativeObject, image.NativeObject, point.X, point.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Point[] destPoints) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsI(nativeObject, image.NativeObject, destPoints, destPoints.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Point point) + { + if (image == null) + throw new ArgumentNullException("image"); + DrawImage(image, point.X, point.Y); + } + + public void DrawImage(Image image, Rectangle rect) + { + if (image == null) + throw new ArgumentNullException("image"); + DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void DrawImage(Image image, PointF[] destPoints) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + int status = SafeNativeMethods.Gdip.GdipDrawImagePoints(nativeObject, image.NativeObject, destPoints, destPoints.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, int x, int y) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageI(nativeObject, image.NativeObject, x, y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, float x, float y) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImage(nativeObject, image.NativeObject, x, y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, + srcUnit, IntPtr.Zero, null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, + srcUnit, IntPtr.Zero, null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRectI(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero, + null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRect(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero, + null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, + ImageAttributes imageAttr) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRectI(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, + imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, float x, float y, float width, float height) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRect(nativeObject, image.NativeObject, x, y, + width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, + ImageAttributes imageAttr) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRect(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, + imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, int x, int y, int width, int height) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectI(nativeObject, image.nativeObject, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImagePointRect(nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRect(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, + imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRectI(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, + imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData) + { + if (image == null) + throw new ArgumentNullException("image"); + if (destPoints == null) + throw new ArgumentNullException("destPoints"); + + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRectI(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, + imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, (IntPtr)callbackData); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero, + null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData) + { + int status = SafeNativeMethods.Gdip.GdipDrawImagePointsRect(nativeObject, image.NativeObject, + destPoints, destPoints.Length, srcRect.X, srcRect.Y, + srcRect.Width, srcRect.Height, srcUnit, + imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, (IntPtr)callbackData); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero, + null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcX, srcY, srcWidth, srcHeight, srcUnit, + imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, + destRect.Height, srcX, srcY, srcWidth, srcHeight, + srcUnit, imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, + destRect.Height, srcX, srcY, srcWidth, srcHeight, + srcUnit, imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, + IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, + destRect.Height, srcX, srcY, srcWidth, srcHeight, + srcUnit, imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, + callback, IntPtr.Zero); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcX, srcY, srcWidth, srcHeight, srcUnit, + imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, callback, callbackData); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData) + { + if (image == null) + throw new ArgumentNullException("image"); + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRect(nativeObject, image.NativeObject, + destRect.X, destRect.Y, destRect.Width, destRect.Height, + srcX, srcY, srcWidth, srcHeight, srcUnit, + imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, callback, callbackData); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawImageUnscaled(Image image, Point point) + { + DrawImageUnscaled(image, point.X, point.Y); + } + + public void DrawImageUnscaled(Image image, Rectangle rect) + { + DrawImageUnscaled(image, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void DrawImageUnscaled(Image image, int x, int y) + { + if (image == null) + throw new ArgumentNullException("image"); + DrawImage(image, x, y, image.Width, image.Height); + } + + public void DrawImageUnscaled(Image image, int x, int y, int width, int height) + { + if (image == null) + throw new ArgumentNullException("image"); + + // avoid creating an empty, or negative w/h, bitmap... + if ((width <= 0) || (height <= 0)) + return; + + using (Image tmpImg = new Bitmap(width, height)) + { + using (Graphics g = FromImage(tmpImg)) + { + g.DrawImage(image, 0, 0, image.Width, image.Height); + DrawImage(tmpImg, x, y, width, height); + } + } + } + + public void DrawImageUnscaledAndClipped(Image image, Rectangle rect) + { + if (image == null) + throw new ArgumentNullException("image"); + + int width = (image.Width > rect.Width) ? rect.Width : image.Width; + int height = (image.Height > rect.Height) ? rect.Height : image.Height; + + DrawImageUnscaled(image, rect.X, rect.Y, width, height); + } + + public void DrawLine(Pen pen, PointF pt1, PointF pt2) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawLine(nativeObject, pen.NativePen, + pt1.X, pt1.Y, pt2.X, pt2.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawLine(Pen pen, Point pt1, Point pt2) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawLineI(nativeObject, pen.NativePen, + pt1.X, pt1.Y, pt2.X, pt2.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawLine(Pen pen, int x1, int y1, int x2, int y2) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawLineI(nativeObject, pen.NativePen, x1, y1, x2, y2); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawLine(Pen pen, float x1, float y1, float x2, float y2) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (!float.IsNaN(x1) && !float.IsNaN(y1) && + !float.IsNaN(x2) && !float.IsNaN(y2)) + { + int status = SafeNativeMethods.Gdip.GdipDrawLine(nativeObject, pen.NativePen, x1, y1, x2, y2); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public void DrawLines(Pen pen, PointF[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipDrawLines(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawLines(Pen pen, Point[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipDrawLinesI(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawPath(Pen pen, GraphicsPath path) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (path == null) + throw new ArgumentNullException("path"); + int status = SafeNativeMethods.Gdip.GdipDrawPath(nativeObject, pen.NativePen, path.nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle) + { + if (pen == null) + throw new ArgumentNullException("pen"); + DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + } + + public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle) + { + if (pen == null) + throw new ArgumentNullException("pen"); + DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + } + + public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawPie(nativeObject, pen.NativePen, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // Microsoft documentation states that the signature for this member should be + // public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle + // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params + public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawPieI(nativeObject, pen.NativePen, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawPolygon(Pen pen, Point[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipDrawPolygonI(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawPolygon(Pen pen, PointF[] points) + { + if (pen == null) + throw new ArgumentNullException("pen"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipDrawPolygon(nativeObject, pen.NativePen, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawRectangle(Pen pen, Rectangle rect) + { + if (pen == null) + throw new ArgumentNullException("pen"); + DrawRectangle(pen, rect.Left, rect.Top, rect.Width, rect.Height); + } + + public void DrawRectangle(Pen pen, float x, float y, float width, float height) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawRectangle(nativeObject, pen.NativePen, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawRectangle(Pen pen, int x, int y, int width, int height) + { + if (pen == null) + throw new ArgumentNullException("pen"); + int status = SafeNativeMethods.Gdip.GdipDrawRectangleI(nativeObject, pen.NativePen, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawRectangles(Pen pen, RectangleF[] rects) + { + if (pen == null) + throw new ArgumentNullException("image"); + if (rects == null) + throw new ArgumentNullException("rects"); + int status = SafeNativeMethods.Gdip.GdipDrawRectangles(nativeObject, pen.NativePen, rects, rects.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawRectangles(Pen pen, Rectangle[] rects) + { + if (pen == null) + throw new ArgumentNullException("image"); + if (rects == null) + throw new ArgumentNullException("rects"); + int status = SafeNativeMethods.Gdip.GdipDrawRectanglesI(nativeObject, pen.NativePen, rects, rects.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle) + { + DrawString(s, font, brush, layoutRectangle, null); + } + + public void DrawString(string s, Font font, Brush brush, PointF point) + { + DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), null); + } + + public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format) + { + DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format); + } + + public void DrawString(string s, Font font, Brush brush, float x, float y) + { + DrawString(s, font, brush, new RectangleF(x, y, 0, 0), null); + } + + public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format) + { + DrawString(s, font, brush, new RectangleF(x, y, 0, 0), format); + } + + public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format) + { + if (font == null) + throw new ArgumentNullException("font"); + if (brush == null) + throw new ArgumentNullException("brush"); + if (s == null || s.Length == 0) + return; + + int status = SafeNativeMethods.Gdip.GdipDrawString(nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.nativeFormat : IntPtr.Zero, brush.NativeBrush); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void EndContainer(GraphicsContainer container) + { + if (container == null) + throw new ArgumentNullException("container"); + int status = SafeNativeMethods.Gdip.GdipEndContainer(new HandleRef(this, nativeObject), container.nativeGraphicsContainer); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + private const string MetafileEnumeration = "Metafiles enumeration, for both WMF and EMF formats, isn't supported."; + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point[] destPoints, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point destPoint, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF destPoint, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point[] destPoints, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point[] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point[] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF[] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + [MonoTODO(MetafileEnumeration)] + public void EnumerateMetafile(Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr) + { + throw new NotImplementedException(); + } + + public void FillClosedCurve(Brush brush, PointF[] points) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillClosedCurve(nativeObject, brush.NativeBrush, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillClosedCurve(Brush brush, Point[] points) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillClosedCurveI(nativeObject, brush.NativeBrush, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + + public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + FillClosedCurve(brush, points, fillmode, 0.5f); + } + + public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + FillClosedCurve(brush, points, fillmode, 0.5f); + } + + public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, float tension) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillClosedCurve2(nativeObject, brush.NativeBrush, points, points.Length, tension, fillmode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, float tension) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillClosedCurve2I(nativeObject, brush.NativeBrush, points, points.Length, tension, fillmode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillEllipse(Brush brush, Rectangle rect) + { + if (brush == null) + throw new ArgumentNullException("brush"); + FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void FillEllipse(Brush brush, RectangleF rect) + { + if (brush == null) + throw new ArgumentNullException("brush"); + FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + public void FillEllipse(Brush brush, float x, float y, float width, float height) + { + if (brush == null) + throw new ArgumentNullException("brush"); + int status = SafeNativeMethods.Gdip.GdipFillEllipse(nativeObject, brush.NativeBrush, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillEllipse(Brush brush, int x, int y, int width, int height) + { + if (brush == null) + throw new ArgumentNullException("brush"); + int status = SafeNativeMethods.Gdip.GdipFillEllipseI(nativeObject, brush.NativeBrush, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPath(Brush brush, GraphicsPath path) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (path == null) + throw new ArgumentNullException("path"); + int status = SafeNativeMethods.Gdip.GdipFillPath(nativeObject, brush.NativeBrush, path.nativePath); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle) + { + if (brush == null) + throw new ArgumentNullException("brush"); + int status = SafeNativeMethods.Gdip.GdipFillPie(nativeObject, brush.NativeBrush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle) + { + if (brush == null) + throw new ArgumentNullException("brush"); + int status = SafeNativeMethods.Gdip.GdipFillPieI(nativeObject, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle) + { + if (brush == null) + throw new ArgumentNullException("brush"); + int status = SafeNativeMethods.Gdip.GdipFillPie(nativeObject, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPolygon(Brush brush, PointF[] points) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillPolygon2(nativeObject, brush.NativeBrush, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPolygon(Brush brush, Point[] points) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillPolygon2I(nativeObject, brush.NativeBrush, points, points.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPolygon(Brush brush, Point[] points, FillMode fillMode) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillPolygonI(nativeObject, brush.NativeBrush, points, points.Length, fillMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (points == null) + throw new ArgumentNullException("points"); + int status = SafeNativeMethods.Gdip.GdipFillPolygon(nativeObject, brush.NativeBrush, points, points.Length, fillMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillRectangle(Brush brush, RectangleF rect) + { + if (brush == null) + throw new ArgumentNullException("brush"); + FillRectangle(brush, rect.Left, rect.Top, rect.Width, rect.Height); + } + + public void FillRectangle(Brush brush, Rectangle rect) + { + if (brush == null) + throw new ArgumentNullException("brush"); + FillRectangle(brush, rect.Left, rect.Top, rect.Width, rect.Height); + } + + public void FillRectangle(Brush brush, int x, int y, int width, int height) + { + if (brush == null) + throw new ArgumentNullException("brush"); + + int status = SafeNativeMethods.Gdip.GdipFillRectangleI(nativeObject, brush.NativeBrush, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillRectangle(Brush brush, float x, float y, float width, float height) + { + if (brush == null) + throw new ArgumentNullException("brush"); + + int status = SafeNativeMethods.Gdip.GdipFillRectangle(nativeObject, brush.NativeBrush, x, y, width, height); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillRectangles(Brush brush, Rectangle[] rects) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (rects == null) + throw new ArgumentNullException("rects"); + + int status = SafeNativeMethods.Gdip.GdipFillRectanglesI(nativeObject, brush.NativeBrush, rects, rects.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void FillRectangles(Brush brush, RectangleF[] rects) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (rects == null) + throw new ArgumentNullException("rects"); + + int status = SafeNativeMethods.Gdip.GdipFillRectangles(nativeObject, brush.NativeBrush, rects, rects.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + + public void FillRegion(Brush brush, Region region) + { + if (brush == null) + throw new ArgumentNullException("brush"); + if (region == null) + throw new ArgumentNullException("region"); + + int status = (int)SafeNativeMethods.Gdip.GdipFillRegion(new HandleRef(this, nativeObject), new HandleRef(brush, brush.NativeBrush), new HandleRef(region, region._nativeRegion)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + + public void Flush() + { + Flush(FlushIntention.Flush); + } + + + public void Flush(FlushIntention intention) + { + if (nativeObject == IntPtr.Zero) + { + return; + } + + int status = SafeNativeMethods.Gdip.GdipFlush(nativeObject, intention); + SafeNativeMethods.Gdip.CheckStatus(status); + + if (maccontext != null) + maccontext.Synchronize(); + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public static Graphics FromHdc(IntPtr hdc) + { + IntPtr graphics; + int status = SafeNativeMethods.Gdip.GdipCreateFromHDC(hdc, out graphics); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Graphics(graphics); + } + + [MonoTODO] + [EditorBrowsable(EditorBrowsableState.Advanced)] + public static Graphics FromHdc(IntPtr hdc, IntPtr hdevice) + { + throw new NotImplementedException(); + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public static Graphics FromHdcInternal(IntPtr hdc) + { + SafeNativeMethods.Gdip.Display = hdc; + return null; + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public static Graphics FromHwnd(IntPtr hwnd) + { + IntPtr graphics; + + if (SafeNativeMethods.Gdip.UseCocoaDrawable) + { + CocoaContext context = MacSupport.GetCGContextForNSView(hwnd); + SafeNativeMethods.Gdip.GdipCreateFromContext_macosx(context.ctx, context.width, context.height, out graphics); + + Graphics g = new Graphics(graphics); + g.maccontext = context; + + return g; + } + + if (SafeNativeMethods.Gdip.UseCarbonDrawable) + { + CarbonContext context = MacSupport.GetCGContextForView(hwnd); + SafeNativeMethods.Gdip.GdipCreateFromContext_macosx(context.ctx, context.width, context.height, out graphics); + + Graphics g = new Graphics(graphics); + g.maccontext = context; + + return g; + } + if (SafeNativeMethods.Gdip.UseX11Drawable) + { + if (SafeNativeMethods.Gdip.Display == IntPtr.Zero) + { + SafeNativeMethods.Gdip.Display = LibX11Functions.XOpenDisplay(IntPtr.Zero); + if (SafeNativeMethods.Gdip.Display == IntPtr.Zero) + throw new NotSupportedException("Could not open display (X-Server required. Check your DISPLAY environment variable)"); + } + if (hwnd == IntPtr.Zero) + { + hwnd = LibX11Functions.XRootWindow(SafeNativeMethods.Gdip.Display, LibX11Functions.XDefaultScreen(SafeNativeMethods.Gdip.Display)); + } + + return FromXDrawable(hwnd, SafeNativeMethods.Gdip.Display); + + } + + int status = SafeNativeMethods.Gdip.GdipCreateFromHWND(hwnd, out graphics); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new Graphics(graphics); + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public static Graphics FromHwndInternal(IntPtr hwnd) + { + return FromHwnd(hwnd); + } + + public static Graphics FromImage(Image image) + { + IntPtr graphics; + + if (image == null) + throw new ArgumentNullException("image"); + + if ((image.PixelFormat & PixelFormat.Indexed) != 0) + throw new Exception("Cannot create Graphics from an indexed bitmap."); + + int status = SafeNativeMethods.Gdip.GdipGetImageGraphicsContext(image.nativeObject, out graphics); + SafeNativeMethods.Gdip.CheckStatus(status); + Graphics result = new Graphics(graphics); + + Rectangle rect = new Rectangle(0, 0, image.Width, image.Height); + SafeNativeMethods.Gdip.GdipSetVisibleClip_linux(result.NativeObject, ref rect); + + return result; + } + + internal static Graphics FromXDrawable(IntPtr drawable, IntPtr display) + { + IntPtr graphics; + + int s = SafeNativeMethods.Gdip.GdipCreateFromXDrawable_linux(drawable, display, out graphics); + SafeNativeMethods.Gdip.CheckStatus(s); + return new Graphics(graphics); + } + + [MonoTODO] + public static IntPtr GetHalftonePalette() + { + throw new NotImplementedException(); + } + + public IntPtr GetHdc() + { + SafeNativeMethods.Gdip.CheckStatus(SafeNativeMethods.Gdip.GdipGetDC(this.nativeObject, out deviceContextHdc)); + return deviceContextHdc; + } + + public Color GetNearestColor(Color color) + { + int argb; + + int status = SafeNativeMethods.Gdip.GdipGetNearestColor(nativeObject, out argb); + SafeNativeMethods.Gdip.CheckStatus(status); + + return Color.FromArgb(argb); + } + + public Region[] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat) + { + if ((text == null) || (text.Length == 0)) + return new Region[0]; + + if (font == null) + throw new ArgumentNullException("font"); + + if (stringFormat == null) + throw new ArgumentException("stringFormat"); + + int regcount = stringFormat.GetMeasurableCharacterRangeCount(); + if (regcount == 0) + return new Region[0]; + + IntPtr[] native_regions = new IntPtr[regcount]; + Region[] regions = new Region[regcount]; + + for (int i = 0; i < regcount; i++) + { + regions[i] = new Region(); + native_regions[i] = regions[i]._nativeRegion; + } + + int status = SafeNativeMethods.Gdip.GdipMeasureCharacterRanges(nativeObject, text, text.Length, + font.NativeObject, ref layoutRect, stringFormat.nativeFormat, regcount, out native_regions[0]); + SafeNativeMethods.Gdip.CheckStatus(status); + + return regions; + } + + private unsafe SizeF GdipMeasureString(IntPtr graphics, string text, Font font, ref RectangleF layoutRect, + IntPtr stringFormat) + { + if ((text == null) || (text.Length == 0)) + return SizeF.Empty; + + if (font == null) + throw new ArgumentNullException("font"); + + RectangleF boundingBox = new RectangleF(); + + int status = SafeNativeMethods.Gdip.GdipMeasureString(nativeObject, text, text.Length, font.NativeObject, + ref layoutRect, stringFormat, out boundingBox, null, null); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new SizeF(boundingBox.Width, boundingBox.Height); + } + + public SizeF MeasureString(string text, Font font) + { + return MeasureString(text, font, SizeF.Empty); + } + + public SizeF MeasureString(string text, Font font, SizeF layoutArea) + { + RectangleF rect = new RectangleF(0, 0, layoutArea.Width, layoutArea.Height); + return GdipMeasureString(nativeObject, text, font, ref rect, IntPtr.Zero); + } + + public SizeF MeasureString(string text, Font font, int width) + { + RectangleF rect = new RectangleF(0, 0, width, Int32.MaxValue); + return GdipMeasureString(nativeObject, text, font, ref rect, IntPtr.Zero); + } + + public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat) + { + RectangleF rect = new RectangleF(0, 0, layoutArea.Width, layoutArea.Height); + IntPtr format = (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat; + return GdipMeasureString(nativeObject, text, font, ref rect, format); + } + + public SizeF MeasureString(string text, Font font, int width, StringFormat format) + { + RectangleF rect = new RectangleF(0, 0, width, Int32.MaxValue); + IntPtr stringFormat = (format == null) ? IntPtr.Zero : format.nativeFormat; + return GdipMeasureString(nativeObject, text, font, ref rect, stringFormat); + } + + public SizeF MeasureString(string text, Font font, PointF origin, StringFormat stringFormat) + { + RectangleF rect = new RectangleF(origin.X, origin.Y, 0, 0); + IntPtr format = (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat; + return GdipMeasureString(nativeObject, text, font, ref rect, format); + } + + public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat, + out int charactersFitted, out int linesFilled) + { + charactersFitted = 0; + linesFilled = 0; + + if ((text == null) || (text.Length == 0)) + return SizeF.Empty; + + if (font == null) + throw new ArgumentNullException("font"); + + RectangleF boundingBox = new RectangleF(); + RectangleF rect = new RectangleF(0, 0, layoutArea.Width, layoutArea.Height); + + IntPtr format = (stringFormat == null) ? IntPtr.Zero : stringFormat.nativeFormat; + + unsafe + { + fixed (int* pc = &charactersFitted, pl = &linesFilled) + { + int status = SafeNativeMethods.Gdip.GdipMeasureString(nativeObject, text, text.Length, + font.NativeObject, ref rect, format, out boundingBox, pc, pl); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + return new SizeF(boundingBox.Width, boundingBox.Height); + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + public void ReleaseHdc(IntPtr hdc) + { + ReleaseHdcInternal(hdc); + } + + public void ReleaseHdc() + { + ReleaseHdcInternal(deviceContextHdc); + } + + [MonoLimitation("Can only be used when hdc was provided by Graphics.GetHdc() method")] + [EditorBrowsable(EditorBrowsableState.Never)] + public void ReleaseHdcInternal(IntPtr hdc) + { + int status = SafeNativeMethods.Gdip.InvalidParameter; + if (hdc == deviceContextHdc) + { + status = SafeNativeMethods.Gdip.GdipReleaseDC(nativeObject, deviceContextHdc); + deviceContextHdc = IntPtr.Zero; + } + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void Restore(GraphicsState gstate) + { + // the possible NRE thrown by gstate.nativeState match MS behaviour + int status = SafeNativeMethods.Gdip.GdipRestoreGraphics(nativeObject, (uint)gstate.nativeState); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public GraphicsState Save() + { + uint saveState; + int status = SafeNativeMethods.Gdip.GdipSaveGraphics(nativeObject, out saveState); + SafeNativeMethods.Gdip.CheckStatus(status); + + GraphicsState state = new GraphicsState((int)saveState); + return state; + } + + + public void TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF[] pts) + { + if (pts == null) + throw new ArgumentNullException("pts"); + + IntPtr ptrPt = MarshallingHelpers.FromPointToUnManagedMemory(pts); + + int status = SafeNativeMethods.Gdip.GdipTransformPoints(nativeObject, destSpace, srcSpace, ptrPt, pts.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + + MarshallingHelpers.FromUnManagedMemoryToPoint(ptrPt, pts); + } + + + public void TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, Point[] pts) + { + if (pts == null) + throw new ArgumentNullException("pts"); + IntPtr ptrPt = MarshallingHelpers.FromPointToUnManagedMemoryI(pts); + + int status = SafeNativeMethods.Gdip.GdipTransformPointsI(nativeObject, destSpace, srcSpace, ptrPt, pts.Length); + SafeNativeMethods.Gdip.CheckStatus(status); + + MarshallingHelpers.FromUnManagedMemoryToPointI(ptrPt, pts); + } + + public CompositingMode CompositingMode + { + get + { + CompositingMode mode; + int status = SafeNativeMethods.Gdip.GdipGetCompositingMode(nativeObject, out mode); + SafeNativeMethods.Gdip.CheckStatus(status); + + return mode; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetCompositingMode(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + } + + public CompositingQuality CompositingQuality + { + get + { + CompositingQuality quality; + + int status = SafeNativeMethods.Gdip.GdipGetCompositingQuality(nativeObject, out quality); + SafeNativeMethods.Gdip.CheckStatus(status); + return quality; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetCompositingQuality(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public float DpiX + { + get + { + float x; + + int status = SafeNativeMethods.Gdip.GdipGetDpiX(nativeObject, out x); + SafeNativeMethods.Gdip.CheckStatus(status); + return x; + } + } + + public float DpiY + { + get + { + float y; + + int status = SafeNativeMethods.Gdip.GdipGetDpiY(nativeObject, out y); + SafeNativeMethods.Gdip.CheckStatus(status); + return y; + } + } + + public InterpolationMode InterpolationMode + { + get + { + InterpolationMode imode = InterpolationMode.Invalid; + int status = SafeNativeMethods.Gdip.GdipGetInterpolationMode(nativeObject, out imode); + SafeNativeMethods.Gdip.CheckStatus(status); + return imode; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetInterpolationMode(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public float PageScale + { + get + { + float scale; + + int status = SafeNativeMethods.Gdip.GdipGetPageScale(nativeObject, out scale); + SafeNativeMethods.Gdip.CheckStatus(status); + return scale; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetPageScale(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public GraphicsUnit PageUnit + { + get + { + GraphicsUnit unit; + + int status = SafeNativeMethods.Gdip.GdipGetPageUnit(nativeObject, out unit); + SafeNativeMethods.Gdip.CheckStatus(status); + return unit; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetPageUnit(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + [MonoTODO("This property does not do anything when used with libgdiplus.")] + public PixelOffsetMode PixelOffsetMode + { + get + { + PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid; + + int status = SafeNativeMethods.Gdip.GdipGetPixelOffsetMode(nativeObject, out pixelOffset); + SafeNativeMethods.Gdip.CheckStatus(status); + return pixelOffset; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetPixelOffsetMode(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public Point RenderingOrigin + { + get + { + int x, y; + int status = SafeNativeMethods.Gdip.GdipGetRenderingOrigin(nativeObject, out x, out y); + SafeNativeMethods.Gdip.CheckStatus(status); + return new Point(x, y); + } + + set + { + int status = SafeNativeMethods.Gdip.GdipSetRenderingOrigin(nativeObject, value.X, value.Y); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public SmoothingMode SmoothingMode + { + get + { + SmoothingMode mode = SmoothingMode.Invalid; + + int status = SafeNativeMethods.Gdip.GdipGetSmoothingMode(nativeObject, out mode); + SafeNativeMethods.Gdip.CheckStatus(status); + return mode; + } + + set + { + int status = SafeNativeMethods.Gdip.GdipSetSmoothingMode(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + [MonoTODO("This property does not do anything when used with libgdiplus.")] + public int TextContrast + { + get + { + int contrast; + + int status = SafeNativeMethods.Gdip.GdipGetTextContrast(nativeObject, out contrast); + SafeNativeMethods.Gdip.CheckStatus(status); + return contrast; + } + + set + { + int status = SafeNativeMethods.Gdip.GdipSetTextContrast(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public TextRenderingHint TextRenderingHint + { + get + { + TextRenderingHint hint; + + int status = SafeNativeMethods.Gdip.GdipGetTextRenderingHint(nativeObject, out hint); + SafeNativeMethods.Gdip.CheckStatus(status); + return hint; + } + + set + { + int status = SafeNativeMethods.Gdip.GdipSetTextRenderingHint(nativeObject, value); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public RectangleF VisibleClipBounds + { + get + { + var rect = new GPRECTF(); + int status = SafeNativeMethods.Gdip.GdipGetVisibleClipBounds(new HandleRef(this, NativeGraphics), ref rect); + SafeNativeMethods.Gdip.CheckStatus(status); + + return rect.ToRectangleF(); + } + } + + [MonoTODO] + [EditorBrowsable(EditorBrowsableState.Never)] + public object GetContextInfo() + { + // only known source of information @ http://blogs.wdevs.com/jdunlap/Default.aspx + throw new NotImplementedException(); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs.REMOVED.git-id new file mode 100644 index 0000000000..aaedd2442f --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.Windows.cs.REMOVED.git-id @@ -0,0 +1 @@ +38f248e18ee07172227790d3080380aea1a033bd \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.cs new file mode 100644 index 0000000000..753cbf2589 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.cs @@ -0,0 +1,313 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Drawing.Drawing2D; +using System.Drawing.Internal; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + /// + /// Encapsulates a GDI+ drawing surface. + /// + public sealed partial class Graphics : MarshalByRefObject, IDisposable, IDeviceContext + { + public void SetClip(Graphics g) => SetClip(g, CombineMode.Replace); + + public void SetClip(Graphics g, CombineMode combineMode) + { + if (g == null) + { + throw new ArgumentNullException(nameof(g)); + } + + int status = SafeNativeMethods.Gdip.GdipSetClipGraphics(new HandleRef(this, NativeGraphics), new HandleRef(g, g.NativeGraphics), combineMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void SetClip(Rectangle rect) => SetClip(rect, CombineMode.Replace); + + public void SetClip(Rectangle rect, CombineMode combineMode) + { + int status = SafeNativeMethods.Gdip.GdipSetClipRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, combineMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void SetClip(RectangleF rect) => SetClip(rect, CombineMode.Replace); + + public void SetClip(RectangleF rect, CombineMode combineMode) + { + int status = SafeNativeMethods.Gdip.GdipSetClipRect(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, combineMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void SetClip(GraphicsPath path) => SetClip(path, CombineMode.Replace); + + public void SetClip(GraphicsPath path, CombineMode combineMode) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + int status = SafeNativeMethods.Gdip.GdipSetClipPath(new HandleRef(this, NativeGraphics), new HandleRef(path, path.nativePath), combineMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void SetClip(Region region, CombineMode combineMode) + { + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + + int status = SafeNativeMethods.Gdip.GdipSetClipRegion(new HandleRef(this, NativeGraphics), new HandleRef(region, region._nativeRegion), combineMode); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void IntersectClip(Rectangle rect) + { + int status = SafeNativeMethods.Gdip.GdipSetClipRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, CombineMode.Intersect); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void IntersectClip(RectangleF rect) + { + int status = SafeNativeMethods.Gdip.GdipSetClipRect(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, CombineMode.Intersect); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void IntersectClip(Region region) + { + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + + int status = SafeNativeMethods.Gdip.GdipSetClipRegion(new HandleRef(this, NativeGraphics), new HandleRef(region, region._nativeRegion), + CombineMode.Intersect); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void ExcludeClip(Rectangle rect) + { + int status = SafeNativeMethods.Gdip.GdipSetClipRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, CombineMode.Exclude); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void ExcludeClip(Region region) + { + if (region == null) + { + throw new ArgumentNullException(nameof(region)); + } + + int status = SafeNativeMethods.Gdip.GdipSetClipRegion(new HandleRef(this, NativeGraphics), + new HandleRef(region, region._nativeRegion), + CombineMode.Exclude); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void ResetClip() + { + int status = SafeNativeMethods.Gdip.GdipResetClip(new HandleRef(this, NativeGraphics)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void TranslateClip(float dx, float dy) + { + int status = SafeNativeMethods.Gdip.GdipTranslateClip(new HandleRef(this, NativeGraphics), dx, dy); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void TranslateClip(int dx, int dy) + { + int status = SafeNativeMethods.Gdip.GdipTranslateClip(new HandleRef(this, NativeGraphics), dx, dy); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Region Clip + { + get + { + var region = new Region(); + int status = SafeNativeMethods.Gdip.GdipGetClip(new HandleRef(this, NativeGraphics), new HandleRef(region, region._nativeRegion)); + SafeNativeMethods.Gdip.CheckStatus(status); + + return region; + } + set => SetClip(value, CombineMode.Replace); + } + + public RectangleF ClipBounds + { + get + { + var rect = new GPRECTF(); + int status = SafeNativeMethods.Gdip.GdipGetClipBounds(new HandleRef(this, NativeGraphics), ref rect); + SafeNativeMethods.Gdip.CheckStatus(status); + + return rect.ToRectangleF(); + } + } + + public bool IsClipEmpty + { + get + { + int isEmpty; + int status = SafeNativeMethods.Gdip.GdipIsClipEmpty(new HandleRef(this, NativeGraphics), out isEmpty); + SafeNativeMethods.Gdip.CheckStatus(status); + + return isEmpty != 0; + } + } + + public bool IsVisibleClipEmpty + { + get + { + int isEmpty; + int status = SafeNativeMethods.Gdip.GdipIsVisibleClipEmpty(new HandleRef(this, NativeGraphics), out isEmpty); + SafeNativeMethods.Gdip.CheckStatus(status); + + return isEmpty != 0; + } + } + + + public bool IsVisible(int x, int y) => IsVisible(new Point(x, y)); + + public bool IsVisible(Point point) + { + int isVisible; + int status = SafeNativeMethods.Gdip.GdipIsVisiblePointI(new HandleRef(this, NativeGraphics), point.X, point.Y, out isVisible); + SafeNativeMethods.Gdip.CheckStatus(status); + + return isVisible != 0; + } + + public bool IsVisible(float x, float y) => IsVisible(new PointF(x, y)); + + public bool IsVisible(PointF point) + { + int isVisible; + int status = SafeNativeMethods.Gdip.GdipIsVisiblePoint(new HandleRef(this, NativeGraphics), point.X, point.Y, out isVisible); + SafeNativeMethods.Gdip.CheckStatus(status); + + return isVisible != 0; + } + + public bool IsVisible(int x, int y, int width, int height) + { + return IsVisible(new Rectangle(x, y, width, height)); + } + + public bool IsVisible(Rectangle rect) + { + int isVisible; + int status = SafeNativeMethods.Gdip.GdipIsVisibleRectI(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, out isVisible); + SafeNativeMethods.Gdip.CheckStatus(status); + + return isVisible != 0; + } + + public bool IsVisible(float x, float y, float width, float height) + { + return IsVisible(new RectangleF(x, y, width, height)); + } + + public bool IsVisible(RectangleF rect) + { + int isVisible; + int status = SafeNativeMethods.Gdip.GdipIsVisibleRect(new HandleRef(this, NativeGraphics), rect.X, rect.Y, + rect.Width, rect.Height, out isVisible); + SafeNativeMethods.Gdip.CheckStatus(status); + + return isVisible != 0; + } + + /// + /// Gets or sets the world transform for this . + /// + public Matrix Transform + { + get + { + var matrix = new Matrix(); + int status = SafeNativeMethods.Gdip.GdipGetWorldTransform(new HandleRef(this, NativeGraphics), + new HandleRef(matrix, matrix.nativeMatrix)); + SafeNativeMethods.Gdip.CheckStatus(status); + + return matrix; + } + set + { + int status = SafeNativeMethods.Gdip.GdipSetWorldTransform(new HandleRef(this, NativeGraphics), + new HandleRef(value, value.nativeMatrix)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + /// + /// Resets the world transform to identity. + /// + public void ResetTransform() + { + int status = SafeNativeMethods.Gdip.GdipResetWorldTransform(new HandleRef(this, NativeGraphics)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + /// + /// Multiplies the that represents the world transform and . + /// + public void MultiplyTransform(Matrix matrix) => MultiplyTransform(matrix, MatrixOrder.Prepend); + + /// + /// Multiplies the that represents the world transform and . + /// + public void MultiplyTransform(Matrix matrix, MatrixOrder order) + { + if (matrix == null) + { + throw new ArgumentNullException(nameof(matrix)); + } + + int status = SafeNativeMethods.Gdip.GdipMultiplyWorldTransform(new HandleRef(this, NativeGraphics), + new HandleRef(matrix, matrix.nativeMatrix), + order); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void TranslateTransform(float dx, float dy) => TranslateTransform(dx, dy, MatrixOrder.Prepend); + + public void TranslateTransform(float dx, float dy, MatrixOrder order) + { + int status = SafeNativeMethods.Gdip.GdipTranslateWorldTransform(new HandleRef(this, NativeGraphics), dx, dy, order); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void ScaleTransform(float sx, float sy) => ScaleTransform(sx, sy, MatrixOrder.Prepend); + + public void ScaleTransform(float sx, float sy, MatrixOrder order) + { + int status = SafeNativeMethods.Gdip.GdipScaleWorldTransform(new HandleRef(this, NativeGraphics), sx, sy, order); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void RotateTransform(float angle) => RotateTransform(angle, MatrixOrder.Prepend); + + public void RotateTransform(float angle, MatrixOrder order) + { + int status = SafeNativeMethods.Gdip.GdipRotateWorldTransform(new HandleRef(this, NativeGraphics), angle, order); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.cs.REMOVED.git-id deleted file mode 100644 index 769afe696c..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Graphics.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -2f471b17124e33165b720d4f5fbce1f6ebaf00bd \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/GraphicsUnit.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GraphicsUnit.cs new file mode 100644 index 0000000000..c1a71a009a --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/GraphicsUnit.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Drawing +{ + /// + /// Specifies the unit of measure for the given data. + /// + public enum GraphicsUnit + { + /// + /// Specifies the world unit as the unit of measure. + /// + World = 0, + /// + /// Specifies 1/75 inch as the unit of measure. + /// + Display = 1, + /// + /// Specifies a device pixel as the unit of measure. + /// + Pixel = 2, + /// + /// Specifies a printer's point (1/72 inch) as the unit of measure. + /// + Point = 3, + /// + /// Specifies the inch as the unit of measure. + /// + Inch = 4, + /// + /// Specifies the document unit (1/300 inch) as the unit of measure. + /// + Document = 5, + /// + /// Specifies the millimeter as the unit of measure. + /// + Millimeter = 6 + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs index 3dd44ac082..ead9887da3 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs @@ -13,7 +13,7 @@ namespace System.Drawing /// special care, for instance using other Win32 functions like CreateDC or CreateCompatibleDC require /// DeleteDC instead of ReleaseDC to properly free the dc handle. /// - /// See the DeviceContext class for an implemenation of this interface, it uses the Dispose method + /// See the DeviceContext class for an implementation of this interface, it uses the Dispose method /// for freeing non-display dc handles. /// /// This is a low-level API that is expected to be used with TextRenderer or PInvoke calls. diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.NotSerializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.NotSerializable.cs new file mode 100644 index 0000000000..544342ec38 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.NotSerializable.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; + +namespace System.Drawing +{ + partial class Icon + { + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.Unix.cs new file mode 100644 index 0000000000..c75a01d948 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.Unix.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Runtime.Serialization; +using System.Security.Permissions; + +namespace System.Drawing +{ + [Serializable] + partial class Icon + { + private const string IconSizeSerializationName = "IconSize"; + private const string IconDataSerializationName = "IconData"; + + private Icon(SerializationInfo info, StreamingContext context) + { + MemoryStream dataStream = null; + int width = 0; + int height = 0; + foreach (SerializationEntry serEnum in info) + { + if (string.Equals(serEnum.Name, IconDataSerializationName, StringComparison.CurrentCultureIgnoreCase)) + { + dataStream = new MemoryStream((byte[])serEnum.Value); + } + if (string.Equals(serEnum.Name, IconSizeSerializationName, StringComparison.CurrentCultureIgnoreCase)) + { + Size iconSize = (Size)serEnum.Value; + width = iconSize.Width; + height = iconSize.Height; + } + } + if (dataStream != null) + { + dataStream.Seek(0, SeekOrigin.Begin); + InitFromStreamWithSize(dataStream, width, height); + } + } + + void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) + { + MemoryStream ms = new MemoryStream(); + Save(ms); + si.AddValue(IconSizeSerializationName, this.Size, typeof(Size)); + si.AddValue(IconDataSerializationName, ms.ToArray()); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.Windows.cs new file mode 100644 index 0000000000..8cd871c9b8 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.Windows.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Runtime.Serialization; +using System.Security.Permissions; + +namespace System.Drawing +{ + [Serializable] + partial class Icon + { + private Icon(SerializationInfo info, StreamingContext context) + { + _iconData = (byte[])info.GetValue("IconData", typeof(byte[])); + _iconSize = (Size)info.GetValue("IconSize", typeof(Size)); + + if (_iconSize.IsEmpty) + { + Initialize(0, 0); + } + else + { + Initialize(_iconSize.Width, _iconSize.Height); + } + } + + [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) + { + if (_iconData != null) + { + si.AddValue("IconData", _iconData, typeof(byte[])); + } + else + { + MemoryStream stream = new MemoryStream(); + Save(stream); + si.AddValue("IconData", stream.ToArray(), typeof(byte[])); + } + si.AddValue("IconSize", _iconSize, typeof(Size)); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.cs deleted file mode 100644 index a71b23153b..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Serializable.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; -using System.Runtime.Serialization; -using System.Security.Permissions; - -namespace System.Drawing -{ - [Serializable] - partial class Icon : ISerializable - { - private Icon(SerializationInfo info, StreamingContext context) - { - _iconData = (byte[])info.GetValue("IconData", typeof(byte[])); - _iconSize = (Size)info.GetValue("IconSize", typeof(Size)); - - if (_iconSize.IsEmpty) - { - Initialize(0, 0); - } - else - { - Initialize(_iconSize.Width, _iconSize.Height); - } - } - - [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] - void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) - { - if (_iconData != null) - { - si.AddValue("IconData", _iconData, typeof(byte[])); - } - else - { - MemoryStream stream = new MemoryStream(); - Save(stream); - si.AddValue("IconData", stream.ToArray(), typeof(byte[])); - } - si.AddValue("IconSize", _iconSize, typeof(Size)); - } - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs new file mode 100644 index 0000000000..26f6f183e3 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs @@ -0,0 +1,888 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Icon.cs +// +// Authors: +// Gary Barnett (gary.barnett.mono@gmail.com) +// Dennis Hayes (dennish@Raytek.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Sanjay Gupta (gsanjay@novell.com) +// Peter Dennis Bartok (pbartok@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004-2008 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.Collections; +using System.ComponentModel; +using System.Drawing.Imaging; +using System.IO; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ +#if !NETCORE +#if !MONOTOUCH + [Editor ("System.Drawing.Design.IconEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] +#endif + [TypeConverter(typeof(IconConverter))] +#endif + public sealed partial class Icon : MarshalByRefObject, ISerializable, ICloneable, IDisposable + { + [StructLayout(LayoutKind.Sequential)] + internal struct IconDirEntry + { + internal byte width; // Width of icon + internal byte height; // Height of icon + internal byte colorCount; // colors in icon + internal byte reserved; // Reserved + internal ushort planes; // Color Planes + internal ushort bitCount; // Bits per pixel + internal uint bytesInRes; // bytes in resource + internal uint imageOffset; // position in file + internal bool ignore; // for unsupported images (vista 256 png) + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct IconDir + { + internal ushort idReserved; // Reserved + internal ushort idType; // resource type (1 for icons) + internal ushort idCount; // how many images? + internal IconDirEntry[] idEntries; // the entries for each image + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct BitmapInfoHeader + { + internal uint biSize; + internal int biWidth; + internal int biHeight; + internal ushort biPlanes; + internal ushort biBitCount; + internal uint biCompression; + internal uint biSizeImage; + internal int biXPelsPerMeter; + internal int biYPelsPerMeter; + internal uint biClrUsed; + internal uint biClrImportant; + }; + + [StructLayout(LayoutKind.Sequential)] // added baseclass for non bmp image format support + internal abstract class ImageData + { + }; + + [StructLayout(LayoutKind.Sequential)] + internal class IconImage : ImageData + { + internal BitmapInfoHeader iconHeader; //image header + internal uint[] iconColors; //colors table + internal byte[] iconXOR; // bits for XOR mask + internal byte[] iconAND; //bits for AND mask + }; + + [StructLayout(LayoutKind.Sequential)] + internal class IconDump : ImageData + { + internal byte[] data; + }; + + private Size iconSize; + private IntPtr handle = IntPtr.Zero; + private IconDir iconDir; + private ushort id; + private ImageData[] imageData; + private bool undisposable; + private bool disposed; + private Bitmap bitmap; + + private Icon() + { + } + +#if !MONOTOUCH + private Icon(IntPtr handle) + { + this.handle = handle; + bitmap = Bitmap.FromHicon(handle); + iconSize = new Size(bitmap.Width, bitmap.Height); + bitmap = Bitmap.FromHicon(handle); + iconSize = new Size(bitmap.Width, bitmap.Height); + // FIXME: we need to convert the bitmap into an icon + undisposable = true; + } +#endif + + public Icon(Icon original, int width, int height) + : this(original, new Size(width, height)) + { + } + + public Icon(Icon original, Size size) + { + if (original == null) + throw new ArgumentNullException(nameof(original)); + + iconSize = size; + iconDir = original.iconDir; + + int count = iconDir.idCount; + if (count > 0) + { + imageData = original.imageData; + id = UInt16.MaxValue; + + for (ushort i = 0; i < count; i++) + { + IconDirEntry ide = iconDir.idEntries[i]; + if (((ide.height == size.Height) || (ide.width == size.Width)) && !ide.ignore) + { + id = i; + break; + } + } + + // if a perfect match isn't found we look for the biggest icon *smaller* than specified + if (id == UInt16.MaxValue) + { + int requested = Math.Min(size.Height, size.Width); + // previously best set to 1st image, as this might not be smallest changed loop to check all + IconDirEntry? best = null; + for (ushort i = 0; i < count; i++) + { + IconDirEntry ide = iconDir.idEntries[i]; + if (((ide.height < requested) || (ide.width < requested)) && !ide.ignore) + { + if (best == null) + { + best = ide; + id = i; + } + else if ((ide.height > best.Value.height) || (ide.width > best.Value.width)) + { + best = ide; + id = i; + } + } + } + } + + // last one, if nothing better can be found + if (id == UInt16.MaxValue) + { + int i = count; + while (id == UInt16.MaxValue && i > 0) + { + i--; + if (!iconDir.idEntries[i].ignore) + id = (ushort)i; + } + } + + if (id == UInt16.MaxValue) + throw new ArgumentException("Icon", "No valid icon image found"); + + iconSize.Height = iconDir.idEntries[id].height; + iconSize.Width = iconDir.idEntries[id].width; + } + else + { + iconSize.Height = size.Height; + iconSize.Width = size.Width; + } + + if (original.bitmap != null) + bitmap = (Bitmap)original.bitmap.Clone(); + } + + public Icon(Stream stream) : this(stream, 32, 32) + { + } + + public Icon(Stream stream, int width, int height) + { + InitFromStreamWithSize(stream, width, height); + } + + public Icon(string fileName) + { + using (FileStream fs = File.OpenRead(fileName)) + { + InitFromStreamWithSize(fs, 32, 32); + } + } + + public Icon(Type type, string resource) + { + if (resource == null) + throw new ArgumentException("resource"); + + // For compatibility with the .NET Framework + if (type == null) + throw new NullReferenceException(); + + using (Stream s = type.GetTypeInfo().Assembly.GetManifestResourceStream(type, resource)) + { + if (s == null) + { + throw new ArgumentException(null); + } + InitFromStreamWithSize(s, 32, 32); // 32x32 is default + } + } + + + + internal Icon(string resourceName, bool undisposable) + { + using (Stream s = typeof(Icon).GetTypeInfo().Assembly.GetManifestResourceStream(resourceName)) + { + if (s == null) + { + string msg = string.Format("Resource '{0}' was not found.", resourceName); + throw new FileNotFoundException(msg); + } + InitFromStreamWithSize(s, 32, 32); // 32x32 is default + } + this.undisposable = true; + } + + public Icon(Stream stream, Size size) : + this(stream, size.Width, size.Height) + { + } + + public Icon(string fileName, int width, int height) + { + using (FileStream fs = File.OpenRead(fileName)) + { + InitFromStreamWithSize(fs, width, height); + } + } + + public Icon(string fileName, Size size) + { + using (FileStream fs = File.OpenRead(fileName)) + { + InitFromStreamWithSize(fs, size.Width, size.Height); + } + } + + [MonoLimitation("The same icon, SystemIcons.WinLogo, is returned for all file types.")] + public static Icon ExtractAssociatedIcon(string filePath) + { + if (filePath == null) + throw new ArgumentNullException(nameof(filePath)); + if (String.IsNullOrEmpty(filePath)) + throw new ArgumentException("Null or empty path.", "path"); + if (!File.Exists(filePath)) + throw new FileNotFoundException("Couldn't find specified file.", filePath); + + return SystemIcons.WinLogo; + } + + public void Dispose() + { + // SystemIcons requires this + if (undisposable) + return; + + if (!disposed) + { + if (bitmap != null) + { + bitmap.Dispose(); + bitmap = null; + } + GC.SuppressFinalize(this); + } + disposed = true; + } + + public object Clone() + { + return new Icon(this, Size); + } + +#if !MONOTOUCH + public static Icon FromHandle(IntPtr handle) + { + if (handle == IntPtr.Zero) + throw new ArgumentException("handle"); + + return new Icon(handle); + } +#endif + private void SaveIconImage(BinaryWriter writer, IconImage ii) + { + BitmapInfoHeader bih = ii.iconHeader; + writer.Write(bih.biSize); + writer.Write(bih.biWidth); + writer.Write(bih.biHeight); + writer.Write(bih.biPlanes); + writer.Write(bih.biBitCount); + writer.Write(bih.biCompression); + writer.Write(bih.biSizeImage); + writer.Write(bih.biXPelsPerMeter); + writer.Write(bih.biYPelsPerMeter); + writer.Write(bih.biClrUsed); + writer.Write(bih.biClrImportant); + + //now write color table + int colCount = ii.iconColors.Length; + for (int j = 0; j < colCount; j++) + writer.Write(ii.iconColors[j]); + + //now write XOR Mask + writer.Write(ii.iconXOR); + + //now write AND Mask + writer.Write(ii.iconAND); + } + + private void SaveIconDump(BinaryWriter writer, IconDump id) + { + writer.Write(id.data); + } + + private void SaveIconDirEntry(BinaryWriter writer, IconDirEntry ide, uint offset) + { + writer.Write(ide.width); + writer.Write(ide.height); + writer.Write(ide.colorCount); + writer.Write(ide.reserved); + writer.Write(ide.planes); + writer.Write(ide.bitCount); + writer.Write(ide.bytesInRes); + writer.Write((offset == UInt32.MaxValue) ? ide.imageOffset : offset); + } + + private void SaveAll(BinaryWriter writer) + { + writer.Write(iconDir.idReserved); + writer.Write(iconDir.idType); + ushort count = iconDir.idCount; + writer.Write(count); + + for (int i = 0; i < (int)count; i++) + { + SaveIconDirEntry(writer, iconDir.idEntries[i], UInt32.MaxValue); + } + + for (int i = 0; i < (int)count; i++) + { + + //FIXME: HACK: 1 (out of the 8) vista type icons had additional bytes (value:0) + //between images. This fixes the issue, but perhaps shouldnt include in production? + while (writer.BaseStream.Length < iconDir.idEntries[i].imageOffset) + writer.Write((byte)0); + + if (imageData[i] is IconDump) + SaveIconDump(writer, (IconDump)imageData[i]); + else + SaveIconImage(writer, (IconImage)imageData[i]); + } + } + // TODO: check image not ignored (presently this method doesnt seem to be called unless width/height + // refer to image) + private void SaveBestSingleIcon(BinaryWriter writer, int width, int height) + { + writer.Write(iconDir.idReserved); + writer.Write(iconDir.idType); + writer.Write((ushort)1); + + // find best entry and save it + int best = 0; + int bitCount = 0; + for (int i = 0; i < iconDir.idCount; i++) + { + IconDirEntry ide = iconDir.idEntries[i]; + if ((width == ide.width) && (height == ide.height)) + { + if (ide.bitCount >= bitCount) + { + bitCount = ide.bitCount; + best = i; + } + } + } + + SaveIconDirEntry(writer, iconDir.idEntries[best], 22); + SaveIconImage(writer, (IconImage)imageData[best]); + } + + private void SaveBitmapAsIcon(BinaryWriter writer) + { + writer.Write((ushort)0); // idReserved must be 0 + writer.Write((ushort)1); // idType must be 1 + writer.Write((ushort)1); // only one icon + + // when transformed into a bitmap only a single image exists + IconDirEntry ide = new IconDirEntry(); + ide.width = (byte)bitmap.Width; + ide.height = (byte)bitmap.Height; + ide.colorCount = 0; // 32 bbp == 0, for palette size + ide.reserved = 0; // always 0 + ide.planes = 0; + ide.bitCount = 32; + ide.imageOffset = 22; // 22 is the first icon position (for single icon files) + + BitmapInfoHeader bih = new BitmapInfoHeader(); + bih.biSize = (uint)Marshal.SizeOf(typeof(BitmapInfoHeader)); + bih.biWidth = bitmap.Width; + bih.biHeight = 2 * bitmap.Height; // include both XOR and AND images + bih.biPlanes = 1; + bih.biBitCount = 32; + bih.biCompression = 0; + bih.biSizeImage = 0; + bih.biXPelsPerMeter = 0; + bih.biYPelsPerMeter = 0; + bih.biClrUsed = 0; + bih.biClrImportant = 0; + + IconImage ii = new IconImage(); + ii.iconHeader = bih; + ii.iconColors = new uint[0]; // no palette + int xor_size = (((bih.biBitCount * bitmap.Width + 31) & ~31) >> 3) * bitmap.Height; + ii.iconXOR = new byte[xor_size]; + int p = 0; + for (int y = bitmap.Height - 1; y >= 0; y--) + { + for (int x = 0; x < bitmap.Width; x++) + { + Color c = bitmap.GetPixel(x, y); + ii.iconXOR[p++] = c.B; + ii.iconXOR[p++] = c.G; + ii.iconXOR[p++] = c.R; + ii.iconXOR[p++] = c.A; + } + } + int and_line_size = (((Width + 31) & ~31) >> 3); // must be a multiple of 4 bytes + int and_size = and_line_size * bitmap.Height; + ii.iconAND = new byte[and_size]; + + ide.bytesInRes = (uint)(bih.biSize + xor_size + and_size); + + SaveIconDirEntry(writer, ide, UInt32.MaxValue); + SaveIconImage(writer, ii); + } + + private void Save(Stream outputStream, int width, int height) + { + BinaryWriter writer = new BinaryWriter(outputStream); + // if we have the icon information then save from this + if (iconDir.idEntries != null) + { + if ((width == -1) && (height == -1)) + SaveAll(writer); + else + SaveBestSingleIcon(writer, width, height); + } + else if (bitmap != null) + { + // if the icon was created from a bitmap then convert it + SaveBitmapAsIcon(writer); + } + writer.Flush(); + } + + public void Save(Stream outputStream) + { + if (outputStream == null) + throw new NullReferenceException("outputStream"); + + // save every icons available + Save(outputStream, -1, -1); + } +#if !MONOTOUCH + internal Bitmap BuildBitmapOnWin32() + { + Bitmap bmp; + + if (imageData == null) + return new Bitmap(32, 32); + + IconImage ii = (IconImage)imageData[id]; + BitmapInfoHeader bih = ii.iconHeader; + int biHeight = bih.biHeight / 2; + + int ncolors = (int)bih.biClrUsed; + if ((ncolors == 0) && (bih.biBitCount < 24)) + ncolors = (int)(1 << bih.biBitCount); + + switch (bih.biBitCount) + { + case 1: + bmp = new Bitmap(bih.biWidth, biHeight, PixelFormat.Format1bppIndexed); + break; + case 4: + bmp = new Bitmap(bih.biWidth, biHeight, PixelFormat.Format4bppIndexed); + break; + case 8: + bmp = new Bitmap(bih.biWidth, biHeight, PixelFormat.Format8bppIndexed); + break; + case 24: + bmp = new Bitmap(bih.biWidth, biHeight, PixelFormat.Format24bppRgb); + break; + case 32: + bmp = new Bitmap(bih.biWidth, biHeight, PixelFormat.Format32bppArgb); + break; + default: + string msg = string.Format("Unexpected number of bits: {0}", bih.biBitCount); + throw new Exception(msg); + } + + if (bih.biBitCount < 24) + { + ColorPalette pal = bmp.Palette; // Managed palette + + for (int i = 0; i < ii.iconColors.Length; i++) + { + pal.Entries[i] = Color.FromArgb((int)ii.iconColors[i] | unchecked((int)0xff000000)); + } + bmp.Palette = pal; + } + + int bytesPerLine = (int)((((bih.biWidth * bih.biBitCount) + 31) & ~31) >> 3); + BitmapData bits = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, bmp.PixelFormat); + + for (int y = 0; y < biHeight; y++) + { + Marshal.Copy(ii.iconXOR, bytesPerLine * y, + (IntPtr)(bits.Scan0.ToInt64() + bits.Stride * (biHeight - 1 - y)), bytesPerLine); + } + + bmp.UnlockBits(bits); + + bmp = new Bitmap(bmp); // This makes a 32bpp image out of an indexed one + + // Apply the mask to make properly transparent + bytesPerLine = (int)((((bih.biWidth) + 31) & ~31) >> 3); + for (int y = 0; y < biHeight; y++) + { + for (int x = 0; x < bih.biWidth / 8; x++) + { + for (int bit = 7; bit >= 0; bit--) + { + if (((ii.iconAND[y * bytesPerLine + x] >> bit) & 1) != 0) + { + bmp.SetPixel(x * 8 + 7 - bit, biHeight - y - 1, Color.Transparent); + } + } + } + } + + return bmp; + } + + internal Bitmap GetInternalBitmap() + { + if (bitmap == null) + { + // Mono's libgdiplus doesn't require to keep the stream alive when loading images + using (MemoryStream ms = new MemoryStream()) + { + // save the current icon + Save(ms, Width, Height); + ms.Position = 0; + + // libgdiplus can now decode icons + bitmap = (Bitmap)Image.LoadFromStream(ms, false); + } + } + return bitmap; + } + + // note: all bitmaps are 32bits ARGB - no matter what the icon format (bitcount) was + public Bitmap ToBitmap() + { + if (disposed) + throw new ObjectDisposedException("Icon instance was disposed."); + + // note: we can't return the original image because + // (a) we have no control over the bitmap instance we return (i.e. it could be disposed) + // (b) the palette, flags won't match MS results. See MonoTests.System.Drawing.Imaging.IconCodecTest. + // Image16 for the differences + return new Bitmap(GetInternalBitmap()); + } +#endif + public override string ToString() + { + //is this correct, this is what returned by .Net + return ""; + } + +#if !MONOTOUCH + [Browsable(false)] + public IntPtr Handle + { + get + { + if (disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + // note: this handle doesn't survive the lifespan of the icon instance + if (handle == IntPtr.Zero) + { + handle = GetInternalBitmap().NativeObject; + } + return handle; + } + } +#endif + [Browsable(false)] + public int Height + { + get + { + if (disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + return iconSize.Height; + } + } + + public Size Size + { + get + { + if (disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + return iconSize; + } + } + + [Browsable(false)] + public int Width + { + get + { + if (disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + return iconSize.Width; + } + } + + ~Icon() + { + Dispose(); + } + + private void InitFromStreamWithSize(Stream stream, int width, int height) + { + if (stream == null) + throw new ArgumentNullException(nameof(stream)); + + if (stream.Length == 0) + throw new System.ArgumentException("The argument 'stream' must be a picture that can be used as a Icon", "stream"); + + //read the icon header + BinaryReader reader = new BinaryReader(stream); + + //iconDir = new IconDir (); + iconDir.idReserved = reader.ReadUInt16(); + if (iconDir.idReserved != 0) //must be 0 + throw new System.ArgumentException("Invalid Argument", "stream"); + + iconDir.idType = reader.ReadUInt16(); + if (iconDir.idType != 1) //must be 1 + throw new System.ArgumentException("Invalid Argument", "stream"); + + ushort dirEntryCount = reader.ReadUInt16(); + imageData = new ImageData[dirEntryCount]; + iconDir.idCount = dirEntryCount; + iconDir.idEntries = new IconDirEntry[dirEntryCount]; + bool sizeObtained = false; + // now read in the IconDirEntry structures + for (int i = 0; i < dirEntryCount; i++) + { + IconDirEntry ide; + ide.width = reader.ReadByte(); + ide.height = reader.ReadByte(); + ide.colorCount = reader.ReadByte(); + ide.reserved = reader.ReadByte(); + ide.planes = reader.ReadUInt16(); + ide.bitCount = reader.ReadUInt16(); + ide.bytesInRes = reader.ReadUInt32(); + ide.imageOffset = reader.ReadUInt32(); + + // Vista 256x256 icons points directly to a PNG bitmap + // 256x256 icons are decoded as 0x0 (width and height are encoded as BYTE) + // and we ignore them just like MS does (at least up to fx 2.0) + // Added: storing data so it can be saved back + if ((ide.width == 0) && (ide.height == 0)) + ide.ignore = true; + else + ide.ignore = false; + + iconDir.idEntries[i] = ide; + + //is this is the best fit?? + if (!sizeObtained) + { + if (((ide.height == height) || (ide.width == width)) && !ide.ignore) + { + this.id = (ushort)i; + sizeObtained = true; + this.iconSize.Height = ide.height; + this.iconSize.Width = ide.width; + } + } + } + + // throw error if no valid entries found + int valid = 0; + for (int i = 0; i < dirEntryCount; i++) + { + if (!(iconDir.idEntries[i].ignore)) + valid++; + } + + if (valid == 0) + throw new Win32Exception(0, "No valid icon entry were found."); + + // if we havent found the best match, return the one with the + // largest size. Is this approach correct?? + if (!sizeObtained) + { + uint largestSize = 0; + for (int j = 0; j < dirEntryCount; j++) + { + if (iconDir.idEntries[j].bytesInRes >= largestSize && !iconDir.idEntries[j].ignore) + { + largestSize = iconDir.idEntries[j].bytesInRes; + this.id = (ushort)j; + this.iconSize.Height = iconDir.idEntries[j].height; + this.iconSize.Width = iconDir.idEntries[j].width; + } + } + } + + //now read in the icon data + for (int j = 0; j < dirEntryCount; j++) + { + // process ignored into IconDump + if (iconDir.idEntries[j].ignore) + { + IconDump id = new IconDump(); + stream.Seek(iconDir.idEntries[j].imageOffset, SeekOrigin.Begin); + id.data = new byte[iconDir.idEntries[j].bytesInRes]; + stream.Read(id.data, 0, id.data.Length); + imageData[j] = id; + continue; + } + // standard image + IconImage iidata = new IconImage(); + BitmapInfoHeader bih = new BitmapInfoHeader(); + stream.Seek(iconDir.idEntries[j].imageOffset, SeekOrigin.Begin); + byte[] buffer = new byte[iconDir.idEntries[j].bytesInRes]; + stream.Read(buffer, 0, buffer.Length); + BinaryReader bihReader = new BinaryReader(new MemoryStream(buffer)); + bih.biSize = bihReader.ReadUInt32(); + bih.biWidth = bihReader.ReadInt32(); + bih.biHeight = bihReader.ReadInt32(); + bih.biPlanes = bihReader.ReadUInt16(); + bih.biBitCount = bihReader.ReadUInt16(); + bih.biCompression = bihReader.ReadUInt32(); + bih.biSizeImage = bihReader.ReadUInt32(); + bih.biXPelsPerMeter = bihReader.ReadInt32(); + bih.biYPelsPerMeter = bihReader.ReadInt32(); + bih.biClrUsed = bihReader.ReadUInt32(); + bih.biClrImportant = bihReader.ReadUInt32(); + iidata.iconHeader = bih; + //Read the number of colors used and corresponding memory occupied by + //color table. Fill this memory chunk into rgbquad[] + int numColors; + switch (bih.biBitCount) + { + case 1: + numColors = 2; + break; + case 4: + numColors = 16; + break; + case 8: + numColors = 256; + break; + default: + numColors = 0; + break; + } + + iidata.iconColors = new uint[numColors]; + for (int i = 0; i < numColors; i++) + iidata.iconColors[i] = bihReader.ReadUInt32(); + + //XOR mask is immediately after ColorTable and its size is + //icon height* no. of bytes per line + + //icon height is half of BITMAPINFOHEADER.biHeight, since it contains + //both XOR as well as AND mask bytes + int iconHeight = bih.biHeight / 2; + + //bytes per line should should be uint aligned + int numBytesPerLine = ((((bih.biWidth * bih.biPlanes * bih.biBitCount) + 31) >> 5) << 2); + + //Determine the XOR array Size + int xorSize = numBytesPerLine * iconHeight; + iidata.iconXOR = new byte[xorSize]; + int nread = bihReader.Read(iidata.iconXOR, 0, xorSize); + if (nread != xorSize) + { + string msg = string.Format("{0} data length expected {1}, read {2}", "XOR", xorSize, nread); + throw new ArgumentException(msg, "stream"); + } + + //Determine the AND array size + numBytesPerLine = (int)((((bih.biWidth) + 31) & ~31) >> 3); + int andSize = numBytesPerLine * iconHeight; + iidata.iconAND = new byte[andSize]; + nread = bihReader.Read(iidata.iconAND, 0, andSize); + if (nread != andSize) + { + string msg = string.Format("{0} data length expected {1}, read {2}", "AND", andSize, nread); + throw new ArgumentException(msg, "stream"); + } + + imageData[j] = iidata; + bihReader.Dispose(); + } + + reader.Dispose(); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs new file mode 100644 index 0000000000..0d38d257e5 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs @@ -0,0 +1,900 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing.Imaging; +using System.Drawing.Internal; +using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using System.Text; + +namespace System.Drawing +{ + public sealed partial class Icon : MarshalByRefObject, ICloneable, IDisposable, ISerializable + { +#if FINALIZATION_WATCH + private string allocationSite = Graphics.GetAllocationStack(); +#endif + + private static int s_bitDepth; + + // The PNG signature is specified at http://www.w3.org/TR/PNG/#5PNG-file-signature + private const int PNGSignature1 = 137 + ('P' << 8) + ('N' << 16) + ('G' << 24); + private const int PNGSignature2 = 13 + (10 << 8) + (26 << 16) + (10 << 24); + + // Icon data + private readonly byte[] _iconData; + private int _bestImageOffset; + private int _bestBitDepth; + private int _bestBytesInRes; + private bool? _isBestImagePng = null; + private Size _iconSize = Size.Empty; + private IntPtr _handle = IntPtr.Zero; + private bool _ownHandle = true; + + private Icon() { } + + internal Icon(IntPtr handle) : this(handle, false) + { + } + + internal Icon(IntPtr handle, bool takeOwnership) + { + if (handle == IntPtr.Zero) + { + throw new ArgumentException(SR.Format(SR.InvalidGDIHandle, nameof(Icon))); + } + + _handle = handle; + _ownHandle = takeOwnership; + } + + public Icon(string fileName) : this(fileName, 0, 0) + { + } + + public Icon(string fileName, Size size) : this(fileName, size.Width, size.Height) + { + } + + public Icon(string fileName, int width, int height) : this() + { + using (FileStream f = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + Debug.Assert(f != null, "File.OpenRead returned null instead of throwing an exception"); + _iconData = new byte[(int)f.Length]; + f.Read(_iconData, 0, _iconData.Length); + } + + Initialize(width, height); + } + + public Icon(Icon original, Size size) : this(original, size.Width, size.Height) + { + } + + public Icon(Icon original, int width, int height) : this() + { + if (original == null) + { + throw new ArgumentNullException(nameof(original)); + } + + _iconData = original._iconData; + + if (_iconData == null) + { + _iconSize = original.Size; + _handle = SafeNativeMethods.CopyImage(new HandleRef(original, original.Handle), SafeNativeMethods.IMAGE_ICON, _iconSize.Width, _iconSize.Height, 0); + } + else + { + Initialize(width, height); + } + } + + public Icon(Type type, string resource) : this() + { + Stream stream = type.Module.Assembly.GetManifestResourceStream(type, resource); + if (stream == null) + { + throw new ArgumentException(SR.Format(SR.ResourceNotFound, type, resource)); + } + + _iconData = new byte[(int)stream.Length]; + stream.Read(_iconData, 0, _iconData.Length); + Initialize(0, 0); + } + + public Icon(Stream stream) : this(stream, 0, 0) + { + } + + public Icon(Stream stream, Size size) : this(stream, size.Width, size.Height) + { + } + + public Icon(Stream stream, int width, int height) : this() + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + _iconData = new byte[(int)stream.Length]; + stream.Read(_iconData, 0, _iconData.Length); + Initialize(width, height); + } + + public static Icon ExtractAssociatedIcon(string filePath) => ExtractAssociatedIcon(filePath, 0); + + private static Icon ExtractAssociatedIcon(string filePath, int index) + { + if (filePath == null) + { + throw new ArgumentNullException(nameof(filePath)); + } + + Uri uri; + try + { + uri = new Uri(filePath); + } + catch (UriFormatException) + { + // It's a relative pathname, get its full path as a file. + filePath = Path.GetFullPath(filePath); + uri = new Uri(filePath); + } + + if (uri.IsUnc) + { + throw new ArgumentException(SR.Format(SR.InvalidArgument, nameof(filePath), filePath)); + } + + if (!uri.IsFile) + { + return null; + } + + if (!File.Exists(filePath)) + { + throw new FileNotFoundException(filePath); + } + + var sb = new StringBuilder(NativeMethods.MAX_PATH); + sb.Append(filePath); + + IntPtr hIcon = SafeNativeMethods.ExtractAssociatedIcon(NativeMethods.NullHandleRef, sb, ref index); + if (hIcon != IntPtr.Zero) + { + return new Icon(hIcon, true); + } + + return null; + } + + [Browsable(false)] + public IntPtr Handle + { + get + { + if (_handle == IntPtr.Zero) + { + throw new ObjectDisposedException(GetType().Name); + } + return _handle; + } + } + + [Browsable(false)] + public int Height => Size.Height; + + public Size Size + { + get + { + if (_iconSize.IsEmpty) + { + var info = new SafeNativeMethods.ICONINFO(); + SafeNativeMethods.GetIconInfo(new HandleRef(this, Handle), info); + var bmp = new SafeNativeMethods.BITMAP(); + + if (info.hbmColor != IntPtr.Zero) + { + SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); + SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmColor)); + _iconSize = new Size(bmp.bmWidth, bmp.bmHeight); + } + else if (info.hbmMask != IntPtr.Zero) + { + SafeNativeMethods.GetObject(new HandleRef(null, info.hbmMask), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); + _iconSize = new Size(bmp.bmWidth, bmp.bmHeight / 2); + } + + if (info.hbmMask != IntPtr.Zero) + { + SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmMask)); + } + } + + return _iconSize; + } + } + + [Browsable(false)] + public int Width => Size.Width; + + public object Clone() => new Icon(this, Size.Width, Size.Height); + + // Called when this object is going to destroy it's Win32 handle. You + // may override this if there is something special you need to do to + // destroy the handle. This will be called even if the handle is not + // owned by this object, which is handy if you want to create a + // derived class that has it's own create/destroy semantics. + // + // The default implementation will call the appropriate Win32 + // call to destroy the handle if this object currently owns the + // handle. It will do nothing if the object does not currently + // own the handle. + internal void DestroyHandle() + { + if (_ownHandle) + { + SafeNativeMethods.DestroyIcon(new HandleRef(this, _handle)); + _handle = IntPtr.Zero; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_handle != IntPtr.Zero) + { +#if FINALIZATION_WATCH + if (!disposing) + { + Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite); + } +#endif + DestroyHandle(); + } + } + + // Draws this image to a graphics object. The drawing command originates on the graphics + // object, but a graphics object generally has no idea how to render a given image. So, + // it passes the call to the actual image. This version crops the image to the given + // dimensions and allows the user to specify a rectangle within the image to draw. + private void DrawIcon(IntPtr dc, Rectangle imageRect, Rectangle targetRect, bool stretch) + { + int imageX = 0; + int imageY = 0; + int imageWidth; + int imageHeight; + int targetX = 0; + int targetY = 0; + int targetWidth = 0; + int targetHeight = 0; + + Size cursorSize = Size; + + // Compute the dimensions of the icon if needed. + if (!imageRect.IsEmpty) + { + imageX = imageRect.X; + imageY = imageRect.Y; + imageWidth = imageRect.Width; + imageHeight = imageRect.Height; + } + else + { + imageWidth = cursorSize.Width; + imageHeight = cursorSize.Height; + } + + if (!targetRect.IsEmpty) + { + targetX = targetRect.X; + targetY = targetRect.Y; + targetWidth = targetRect.Width; + targetHeight = targetRect.Height; + } + else + { + targetWidth = cursorSize.Width; + targetHeight = cursorSize.Height; + } + + int drawWidth, drawHeight; + int clipWidth, clipHeight; + + if (stretch) + { + drawWidth = cursorSize.Width * targetWidth / imageWidth; + drawHeight = cursorSize.Height * targetHeight / imageHeight; + clipWidth = targetWidth; + clipHeight = targetHeight; + } + else + { + drawWidth = cursorSize.Width; + drawHeight = cursorSize.Height; + clipWidth = targetWidth < imageWidth ? targetWidth : imageWidth; + clipHeight = targetHeight < imageHeight ? targetHeight : imageHeight; + } + + // The ROP is SRCCOPY, so we can be simple here and take + // advantage of clipping regions. Drawing the cursor + // is merely a matter of offsetting and clipping. + IntPtr hSaveRgn = SafeNativeMethods.SaveClipRgn(dc); + try + { + SafeNativeMethods.IntersectClipRect(new HandleRef(this, dc), targetX, targetY, targetX + clipWidth, targetY + clipHeight); + SafeNativeMethods.DrawIconEx(new HandleRef(null, dc), + targetX - imageX, + targetY - imageY, + new HandleRef(this, _handle), + drawWidth, + drawHeight, + 0, + NativeMethods.NullHandleRef, + SafeNativeMethods.DI_NORMAL); + } + finally + { + SafeNativeMethods.RestoreClipRgn(dc, hSaveRgn); + } + } + + internal void Draw(Graphics graphics, int x, int y) + { + Size size = Size; + Draw(graphics, new Rectangle(x, y, size.Width, size.Height)); + } + + // Draws this image to a graphics object. The drawing command originates on the graphics + // object, but a graphics object generally has no idea how to render a given image. So, + // it passes the call to the actual image. This version stretches the image to the given + // dimensions and allows the user to specify a rectangle within the image to draw. + internal void Draw(Graphics graphics, Rectangle targetRect) + { + Rectangle copy = targetRect; + copy.X += (int)graphics.Transform.OffsetX; + copy.Y += (int)graphics.Transform.OffsetY; + + using (WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics, ApplyGraphicsProperties.Clipping)) + { + IntPtr dc = wg.GetHdc(); + DrawIcon(dc, Rectangle.Empty, copy, true); + } + } + + // Draws this image to a graphics object. The drawing command originates on the graphics + // object, but a graphics object generally has no idea how to render a given image. So, + // it passes the call to the actual image. This version crops the image to the given + // dimensions and allows the user to specify a rectangle within the image to draw. + internal void DrawUnstretched(Graphics graphics, Rectangle targetRect) + { + Rectangle copy = targetRect; + copy.X += (int)graphics.Transform.OffsetX; + copy.Y += (int)graphics.Transform.OffsetY; + + using (WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics, ApplyGraphicsProperties.Clipping)) + { + IntPtr dc = wg.GetHdc(); + DrawIcon(dc, Rectangle.Empty, copy, false); + } + } + + ~Icon() => Dispose(false); + + public static Icon FromHandle(IntPtr handle) => new Icon(handle); + + private unsafe short GetShort(byte* pb) + { + int retval = 0; + if (0 != (unchecked((byte)pb) & 1)) + { + retval = *pb; + pb++; + retval = unchecked(retval | (*pb << 8)); + } + else + { + retval = unchecked(*(short*)pb); + } + return unchecked((short)retval); + } + + private unsafe int GetInt(byte* pb) + { + int retval = 0; + if (0 != (unchecked((byte)pb) & 3)) + { + retval = *pb; pb++; + retval = retval | (*pb << 8); pb++; + retval = retval | (*pb << 16); pb++; + retval = unchecked(retval | (*pb << 24)); + } + else + { + retval = *(int*)pb; + } + return retval; + } + + // Initializes this Image object. This is identical to calling the image's + // constructor with picture, but this allows non-constructor initialization, + // which may be necessary in some instances. + private unsafe void Initialize(int width, int height) + { + if (_iconData == null || _handle != IntPtr.Zero) + { + throw new InvalidOperationException(SR.Format(SR.IllegalState, GetType().Name)); + } + + int icondirSize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIR)); + if (_iconData.Length < icondirSize) + { + throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); + } + + // Get the correct width and height. + if (width == 0) + { + width = UnsafeNativeMethods.GetSystemMetrics(SafeNativeMethods.SM_CXICON); + } + + if (height == 0) + { + height = UnsafeNativeMethods.GetSystemMetrics(SafeNativeMethods.SM_CYICON); + } + + if (s_bitDepth == 0) + { + IntPtr dc = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); + s_bitDepth = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), SafeNativeMethods.BITSPIXEL); + s_bitDepth *= UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), SafeNativeMethods.PLANES); + UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, dc)); + + // If the bitdepth is 8, make it 4 because windows does not + // choose a 256 color icon if the display is running in 256 color mode + // due to palette flicker. + if (s_bitDepth == 8) + { + s_bitDepth = 4; + } + } + + fixed (byte* pbIconData = _iconData) + { + short idReserved = GetShort(pbIconData); + short idType = GetShort(pbIconData + 2); + short idCount = GetShort(pbIconData + 4); + + if (idReserved != 0 || idType != 1 || idCount == 0) + { + throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); + } + + SafeNativeMethods.ICONDIRENTRY EntryTemp; + + byte bestWidth = 0; + byte bestHeight = 0; + + byte* pbIconDirEntry = unchecked(pbIconData + 6); + int icondirEntrySize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIRENTRY)); + + if ((icondirEntrySize * (idCount - 1) + icondirSize) > _iconData.Length) + { + throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); + } + + for (int i = 0; i < idCount; i++) + { + // Fill in EntryTemp + EntryTemp.bWidth = pbIconDirEntry[0]; + EntryTemp.bHeight = pbIconDirEntry[1]; + EntryTemp.bColorCount = pbIconDirEntry[2]; + EntryTemp.bReserved = pbIconDirEntry[3]; + EntryTemp.wPlanes = GetShort(pbIconDirEntry + 4); + EntryTemp.wBitCount = GetShort(pbIconDirEntry + 6); + EntryTemp.dwBytesInRes = GetInt(pbIconDirEntry + 8); + EntryTemp.dwImageOffset = GetInt(pbIconDirEntry + 12); + + bool fUpdateBestFit = false; + int iconBitDepth = 0; + if (EntryTemp.bColorCount != 0) + { + iconBitDepth = 4; + if (EntryTemp.bColorCount < 0x10) + { + iconBitDepth = 1; + } + } + else + { + iconBitDepth = EntryTemp.wBitCount; + } + + // If it looks like if nothing is specified at this point then set the bits per pixel to 8. + if (iconBitDepth == 0) + { + iconBitDepth = 8; + } + + // Windows rules for specifing an icon: + // + // 1. The icon with the closest size match. + // 2. For matching sizes, the image with the closest bit depth. + // 3. If there is no color depth match, the icon with the closest color depth that does not exceed the display. + // 4. If all icon color depth > display, lowest color depth is chosen. + // 5. color depth of > 8bpp are all equal. + // 6. Never choose an 8bpp icon on an 8bpp system. + // + + if (_bestBytesInRes == 0) + { + fUpdateBestFit = true; + } + else + { + int bestDelta = Math.Abs(bestWidth - width) + Math.Abs(bestHeight - height); + int thisDelta = Math.Abs(EntryTemp.bWidth - width) + Math.Abs(EntryTemp.bHeight - height); + + if ((thisDelta < bestDelta) || + (thisDelta == bestDelta && (iconBitDepth <= s_bitDepth && iconBitDepth > _bestBitDepth || _bestBitDepth > s_bitDepth && iconBitDepth < _bestBitDepth))) + { + fUpdateBestFit = true; + } + } + + if (fUpdateBestFit) + { + bestWidth = EntryTemp.bWidth; + bestHeight = EntryTemp.bHeight; + _bestImageOffset = EntryTemp.dwImageOffset; + _bestBytesInRes = EntryTemp.dwBytesInRes; + _bestBitDepth = iconBitDepth; + } + + pbIconDirEntry += icondirEntrySize; + } + + if (_bestImageOffset < 0) + { + throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); + } + + if (_bestBytesInRes < 0) + { + throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER); + } + + int endOffset; + try + { + endOffset = checked(_bestImageOffset + _bestBytesInRes); + } + catch (OverflowException) + { + throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER); + } + + if (endOffset > _iconData.Length) + { + throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); + } + + // Copy the bytes into an aligned buffer if needed. + if ((_bestImageOffset % IntPtr.Size) != 0) + { + // Beginning of icon's content is misaligned. + byte[] alignedBuffer = new byte[_bestBytesInRes]; + Array.Copy(_iconData, _bestImageOffset, alignedBuffer, 0, _bestBytesInRes); + + fixed (byte* pbAlignedBuffer = alignedBuffer) + { + _handle = SafeNativeMethods.CreateIconFromResourceEx(pbAlignedBuffer, _bestBytesInRes, true, 0x00030000, 0, 0, 0); + } + } + else + { + try + { + _handle = SafeNativeMethods.CreateIconFromResourceEx(checked(pbIconData + _bestImageOffset), _bestBytesInRes, true, 0x00030000, 0, 0, 0); + } + catch (OverflowException) + { + throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER); + } + } + if (_handle == IntPtr.Zero) + { + throw new Win32Exception(); + } + } + } + + public void Save(Stream outputStream) + { + if (_iconData != null) + { + outputStream.Write(_iconData, 0, _iconData.Length); + } + else + { + // Ideally, we would pick apart the icon using + // GetIconInfo, and then pull the individual bitmaps out, + // converting them to DIBS and saving them into the file. + // But, in the interest of simplicity, we just call to + // OLE to do it for us. + SafeNativeMethods.PICTDESC pictdesc = SafeNativeMethods.PICTDESC.CreateIconPICTDESC(Handle); + Guid g = typeof(SafeNativeMethods.IPicture).GUID; + SafeNativeMethods.IPicture picture = SafeNativeMethods.OleCreatePictureIndirect(pictdesc, ref g, false); + + if (picture != null) + { + try + { + picture.SaveAsFile(new UnsafeNativeMethods.ComStreamFromDataStream(outputStream), -1, out int temp); + } + finally + { + Marshal.ReleaseComObject(picture); + } + } + } + } + + private void CopyBitmapData(BitmapData sourceData, BitmapData targetData) + { + int offsetSrc = 0; + int offsetDest = 0; + + Debug.Assert(sourceData.Height == targetData.Height, "Unexpected height. How did this happen?"); + + for (int i = 0; i < Math.Min(sourceData.Height, targetData.Height); i++) + { + IntPtr srcPtr, destPtr; + if (IntPtr.Size == 4) + { + srcPtr = new IntPtr(sourceData.Scan0.ToInt32() + offsetSrc); + destPtr = new IntPtr(targetData.Scan0.ToInt32() + offsetDest); + } + else + { + srcPtr = new IntPtr(sourceData.Scan0.ToInt64() + offsetSrc); + destPtr = new IntPtr(targetData.Scan0.ToInt64() + offsetDest); + } + + UnsafeNativeMethods.CopyMemory(new HandleRef(this, destPtr), new HandleRef(this, srcPtr), Math.Abs(targetData.Stride)); + + offsetSrc += sourceData.Stride; + offsetDest += targetData.Stride; + } + } + + private static bool BitmapHasAlpha(BitmapData bmpData) + { + bool hasAlpha = false; + for (int i = 0; i < bmpData.Height; i++) + { + for (int j = 3; j < Math.Abs(bmpData.Stride); j += 4) + { + // Stride here is fine since we know we're doing this on the whole image. + unsafe + { + byte* candidate = unchecked(((byte*)bmpData.Scan0.ToPointer()) + (i * bmpData.Stride) + j); + if (*candidate != 0) + { + hasAlpha = true; + return hasAlpha; + } + } + } + } + + return false; + } + + public Bitmap ToBitmap() + { + // DontSupportPngFramesInIcons is true when the application is targeting framework version below 4.6 + // and false when the application is targeting 4.6 and above. Downlevel application can also set the following switch + // to false in the .config file's runtime section in order to opt-in into the new behavior: + // + if (HasPngSignature() && !LocalAppContextSwitches.DontSupportPngFramesInIcons) + { + return PngFrame(); + } + + return BmpFrame(); + } + + private Bitmap BmpFrame() + { + Bitmap bitmap = null; + if (_iconData != null && _bestBitDepth == 32) + { + // GDI+ doesnt handle 32 bpp icons with alpha properly + // we load the icon ourself from the byte table + bitmap = new Bitmap(Size.Width, Size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + Debug.Assert(_bestImageOffset >= 0 && (_bestImageOffset + _bestBytesInRes) <= _iconData.Length, "Illegal offset/length for the Icon data"); + + unsafe + { + BitmapData bmpdata = bitmap.LockBits(new Rectangle(0, 0, Size.Width, Size.Height), + ImageLockMode.WriteOnly, + PixelFormat.Format32bppArgb); + try + { + uint* pixelPtr = (uint*)bmpdata.Scan0.ToPointer(); + + // jumping the image header + int newOffset = _bestImageOffset + Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER)); + // there is no color table that we need to skip since we're 32bpp + + int lineLength = Size.Width * 4; + int width = Size.Width; + for (int j = (Size.Height - 1) * 4; j >= 0; j -= 4) + { + Marshal.Copy(_iconData, newOffset + j * width, (IntPtr)pixelPtr, lineLength); + pixelPtr += width; + } + + // note: we ignore the mask that's available after the pixel table + } + finally + { + bitmap.UnlockBits(bmpdata); + } + } + } + else if (_bestBitDepth == 0 || _bestBitDepth == 32) + { + // This may be a 32bpp icon or an icon without any data. + var info = new SafeNativeMethods.ICONINFO(); + SafeNativeMethods.GetIconInfo(new HandleRef(this, _handle), info); + var bmp = new SafeNativeMethods.BITMAP(); + try + { + if (info.hbmColor != IntPtr.Zero) + { + SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); + if (bmp.bmBitsPixel == 32) + { + Bitmap tmpBitmap = null; + BitmapData bmpData = null; + BitmapData targetData = null; + try + { + tmpBitmap = Image.FromHbitmap(info.hbmColor); + + // In GDI+ the bits are there but the bitmap was created with no alpha channel + // so copy the bits by hand to a new bitmap + // we also need to go around a limitation in the way the ICON is stored (ie if it's another bpp + // but stored in 32bpp all pixels are transparent and not opaque) + // (Here you mostly need to remain calm....) + bmpData = tmpBitmap.LockBits(new Rectangle(0, 0, tmpBitmap.Width, tmpBitmap.Height), ImageLockMode.ReadOnly, tmpBitmap.PixelFormat); + + // we need do the following if the image has alpha because otherwise the image is fully transparent even though it has data + if (BitmapHasAlpha(bmpData)) + { + bitmap = new Bitmap(bmpData.Width, bmpData.Height, PixelFormat.Format32bppArgb); + targetData = bitmap.LockBits(new Rectangle(0, 0, bmpData.Width, bmpData.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + + CopyBitmapData(bmpData, targetData); + } + } + finally + { + if (tmpBitmap != null && bmpData != null) + { + tmpBitmap.UnlockBits(bmpData); + } + if (bitmap != null && targetData != null) + { + bitmap.UnlockBits(targetData); + } + } + tmpBitmap.Dispose(); + } + } + } + finally + { + if (info.hbmColor != IntPtr.Zero) + { + SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmColor)); + } + if (info.hbmMask != IntPtr.Zero) + { + SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmMask)); + } + } + } + + + if (bitmap == null) + { + // last chance... all the other cases (ie non 32 bpp icons coming from a handle or from the bitmapData) + + // we have to do this rather than just return Bitmap.FromHIcon because + // the bitmap returned from that, even though it's 32bpp, just paints where the mask allows it + // seems like another GDI+ weirdness. might be interesting to investigate further. In the meantime + // this looks like the right thing to do and is not more expansive that what was present before. + + Size size = Size; + bitmap = new Bitmap(size.Width, size.Height); // initialized to transparent + Graphics graphics = null; + using (graphics = Graphics.FromImage(bitmap)) + { + try + { + using (Bitmap tmpBitmap = Bitmap.FromHicon(Handle)) + { + graphics.DrawImage(tmpBitmap, new Rectangle(0, 0, size.Width, size.Height)); + } + } + catch (ArgumentException) + { + // Sometimes FromHicon will crash with no real reason. + // The backup plan is to just draw the image like we used to. + // NOTE: FromHIcon is also where we have the buffer overrun + // if width and height are mismatched. + Draw(graphics, new Rectangle(0, 0, size.Width, size.Height)); + } + } + + + // GDI+ fills the surface with a sentinel color for GetDC, but does + // not correctly clean it up again, so we have to do it. + Color fakeTransparencyColor = Color.FromArgb(0x0d, 0x0b, 0x0c); + bitmap.MakeTransparent(fakeTransparencyColor); + } + + Debug.Assert(bitmap != null, "Bitmap cannot be null"); + return bitmap; + } + + private Bitmap PngFrame() + { + Debug.Assert(_iconData != null); + using (var stream = new MemoryStream()) + { + stream.Write(_iconData, _bestImageOffset, _bestBytesInRes); + return new Bitmap(stream); + } + } + + private bool HasPngSignature() + { + if (!_isBestImagePng.HasValue) + { + if (_iconData != null && _iconData.Length >= _bestImageOffset + 8) + { + int iconSignature1 = BitConverter.ToInt32(_iconData, _bestImageOffset); + int iconSignature2 = BitConverter.ToInt32(_iconData, _bestImageOffset + 4); + _isBestImagePng = (iconSignature1 == PNGSignature1) && (iconSignature2 == PNGSignature2); + } + else + { + _isBestImagePng = false; + } + } + + return _isBestImagePng.Value; + } + + public override string ToString() => SR.toStringIcon; + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.cs deleted file mode 100644 index 598e25922e..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Icon.cs +++ /dev/null @@ -1,899 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing.Imaging; -using System.Drawing.Internal; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; - -namespace System.Drawing -{ - public sealed partial class Icon : MarshalByRefObject, ICloneable, IDisposable - { -#if FINALIZATION_WATCH - private string allocationSite = Graphics.GetAllocationStack(); -#endif - - private static int s_bitDepth; - - // The PNG signature is specified at http://www.w3.org/TR/PNG/#5PNG-file-signature - private const int PNGSignature1 = 137 + ('P' << 8) + ('N' << 16) + ('G' << 24); - private const int PNGSignature2 = 13 + (10 << 8) + (26 << 16) + (10 << 24); - - // Icon data - private readonly byte[] _iconData; - private int _bestImageOffset; - private int _bestBitDepth; - private int _bestBytesInRes; - private bool? _isBestImagePng = null; - private Size _iconSize = Size.Empty; - private IntPtr _handle = IntPtr.Zero; - private bool _ownHandle = true; - - private Icon() { } - - internal Icon(IntPtr handle) : this(handle, false) - { - } - - internal Icon(IntPtr handle, bool takeOwnership) - { - if (handle == IntPtr.Zero) - { - throw new ArgumentException(SR.Format(SR.InvalidGDIHandle, nameof(Icon))); - } - - _handle = handle; - _ownHandle = takeOwnership; - } - - public Icon(string fileName) : this(fileName, 0, 0) - { - } - - public Icon(string fileName, Size size) : this(fileName, size.Width, size.Height) - { - } - - public Icon(string fileName, int width, int height) : this() - { - using (FileStream f = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) - { - Debug.Assert(f != null, "File.OpenRead returned null instead of throwing an exception"); - _iconData = new byte[(int)f.Length]; - f.Read(_iconData, 0, _iconData.Length); - } - - Initialize(width, height); - } - - public Icon(Icon original, Size size) : this(original, size.Width, size.Height) - { - } - - public Icon(Icon original, int width, int height) : this() - { - if (original == null) - { - throw new ArgumentNullException(nameof(original)); - } - - _iconData = original._iconData; - - if (_iconData == null) - { - _iconSize = original.Size; - _handle = SafeNativeMethods.CopyImage(new HandleRef(original, original.Handle), SafeNativeMethods.IMAGE_ICON, _iconSize.Width, _iconSize.Height, 0); - } - else - { - Initialize(width, height); - } - } - - public Icon(Type type, string resource) : this() - { - Stream stream = type.Module.Assembly.GetManifestResourceStream(type, resource); - if (stream == null) - { - throw new ArgumentException(SR.Format(SR.ResourceNotFound, type, resource)); - } - - _iconData = new byte[(int)stream.Length]; - stream.Read(_iconData, 0, _iconData.Length); - Initialize(0, 0); - } - - public Icon(Stream stream) : this(stream, 0, 0) - { - } - - public Icon(Stream stream, Size size) : this(stream, size.Width, size.Height) - { - } - - public Icon(Stream stream, int width, int height) : this() - { - if (stream == null) - { - throw new ArgumentNullException(nameof(stream)); - } - - _iconData = new byte[(int)stream.Length]; - stream.Read(_iconData, 0, _iconData.Length); - Initialize(width, height); - } - - public static Icon ExtractAssociatedIcon(string filePath) => ExtractAssociatedIcon(filePath, 0); - - private static Icon ExtractAssociatedIcon(string filePath, int index) - { - if (filePath == null) - { - throw new ArgumentNullException(nameof(filePath)); - } - - Uri uri; - try - { - uri = new Uri(filePath); - } - catch (UriFormatException) - { - // It's a relative pathname, get its full path as a file. - filePath = Path.GetFullPath(filePath); - uri = new Uri(filePath); - } - - if (uri.IsUnc) - { - throw new ArgumentException(SR.Format(SR.InvalidArgument, nameof(filePath), filePath)); - } - - if (!uri.IsFile) - { - return null; - } - - if (!File.Exists(filePath)) - { - throw new FileNotFoundException(filePath); - } - - var sb = new StringBuilder(NativeMethods.MAX_PATH); - sb.Append(filePath); - - IntPtr hIcon = SafeNativeMethods.ExtractAssociatedIcon(NativeMethods.NullHandleRef, sb, ref index); - if (hIcon != IntPtr.Zero) - { - return new Icon(hIcon, true); - } - - return null; - } - - [Browsable(false)] - public IntPtr Handle - { - get - { - if (_handle == IntPtr.Zero) - { - throw new ObjectDisposedException(GetType().Name); - } - return _handle; - } - } - - [Browsable(false)] - public int Height => Size.Height; - - public Size Size - { - get - { - if (_iconSize.IsEmpty) - { - var info = new SafeNativeMethods.ICONINFO(); - SafeNativeMethods.GetIconInfo(new HandleRef(this, Handle), info); - var bmp = new SafeNativeMethods.BITMAP(); - - if (info.hbmColor != IntPtr.Zero) - { - SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); - SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmColor)); - _iconSize = new Size(bmp.bmWidth, bmp.bmHeight); - } - else if (info.hbmMask != IntPtr.Zero) - { - SafeNativeMethods.GetObject(new HandleRef(null, info.hbmMask), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); - _iconSize = new Size(bmp.bmWidth, bmp.bmHeight / 2); - } - - if (info.hbmMask != IntPtr.Zero) - { - SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmMask)); - } - } - - return _iconSize; - } - } - - [Browsable(false)] - public int Width => Size.Width; - - public object Clone() => new Icon(this, Size.Width, Size.Height); - - // Called when this object is going to destroy it's Win32 handle. You - // may override this if there is something special you need to do to - // destroy the handle. This will be called even if the handle is not - // owned by this object, which is handy if you want to create a - // derived class that has it's own create/destroy semantics. - // - // The default implementation will call the appropriate Win32 - // call to destroy the handle if this object currently owns the - // handle. It will do nothing if the object does not currently - // own the handle. - internal void DestroyHandle() - { - if (_ownHandle) - { - SafeNativeMethods.DestroyIcon(new HandleRef(this, _handle)); - _handle = IntPtr.Zero; - } - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private void Dispose(bool disposing) - { - if (_handle != IntPtr.Zero) - { -#if FINALIZATION_WATCH - if (!disposing) - { - Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite); - } -#endif - DestroyHandle(); - } - } - - // Draws this image to a graphics object. The drawing command originates on the graphics - // object, but a graphics object generally has no idea how to render a given image. So, - // it passes the call to the actual image. This version crops the image to the given - // dimensions and allows the user to specify a rectangle within the image to draw. - private void DrawIcon(IntPtr dc, Rectangle imageRect, Rectangle targetRect, bool stretch) - { - int imageX = 0; - int imageY = 0; - int imageWidth; - int imageHeight; - int targetX = 0; - int targetY = 0; - int targetWidth = 0; - int targetHeight = 0; - - Size cursorSize = Size; - - // Compute the dimensions of the icon if needed. - if (!imageRect.IsEmpty) - { - imageX = imageRect.X; - imageY = imageRect.Y; - imageWidth = imageRect.Width; - imageHeight = imageRect.Height; - } - else - { - imageWidth = cursorSize.Width; - imageHeight = cursorSize.Height; - } - - if (!targetRect.IsEmpty) - { - targetX = targetRect.X; - targetY = targetRect.Y; - targetWidth = targetRect.Width; - targetHeight = targetRect.Height; - } - else - { - targetWidth = cursorSize.Width; - targetHeight = cursorSize.Height; - } - - int drawWidth, drawHeight; - int clipWidth, clipHeight; - - if (stretch) - { - drawWidth = cursorSize.Width * targetWidth / imageWidth; - drawHeight = cursorSize.Height * targetHeight / imageHeight; - clipWidth = targetWidth; - clipHeight = targetHeight; - } - else - { - drawWidth = cursorSize.Width; - drawHeight = cursorSize.Height; - clipWidth = targetWidth < imageWidth ? targetWidth : imageWidth; - clipHeight = targetHeight < imageHeight ? targetHeight : imageHeight; - } - - // The ROP is SRCCOPY, so we can be simple here and take - // advantage of clipping regions. Drawing the cursor - // is merely a matter of offsetting and clipping. - IntPtr hSaveRgn = SafeNativeMethods.SaveClipRgn(dc); - try - { - SafeNativeMethods.IntersectClipRect(new HandleRef(this, dc), targetX, targetY, targetX + clipWidth, targetY + clipHeight); - SafeNativeMethods.DrawIconEx(new HandleRef(null, dc), - targetX - imageX, - targetY - imageY, - new HandleRef(this, _handle), - drawWidth, - drawHeight, - 0, - NativeMethods.NullHandleRef, - SafeNativeMethods.DI_NORMAL); - } - finally - { - SafeNativeMethods.RestoreClipRgn(dc, hSaveRgn); - } - } - - internal void Draw(Graphics graphics, int x, int y) - { - Size size = Size; - Draw(graphics, new Rectangle(x, y, size.Width, size.Height)); - } - - // Draws this image to a graphics object. The drawing command originates on the graphics - // object, but a graphics object generally has no idea how to render a given image. So, - // it passes the call to the actual image. This version stretches the image to the given - // dimensions and allows the user to specify a rectangle within the image to draw. - internal void Draw(Graphics graphics, Rectangle targetRect) - { - Rectangle copy = targetRect; - copy.X += (int)graphics.Transform.OffsetX; - copy.Y += (int)graphics.Transform.OffsetY; - - using (WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics, ApplyGraphicsProperties.Clipping)) - { - IntPtr dc = wg.GetHdc(); - DrawIcon(dc, Rectangle.Empty, copy, true); - } - } - - // Draws this image to a graphics object. The drawing command originates on the graphics - // object, but a graphics object generally has no idea how to render a given image. So, - // it passes the call to the actual image. This version crops the image to the given - // dimensions and allows the user to specify a rectangle within the image to draw. - internal void DrawUnstretched(Graphics graphics, Rectangle targetRect) - { - Rectangle copy = targetRect; - copy.X += (int)graphics.Transform.OffsetX; - copy.Y += (int)graphics.Transform.OffsetY; - - using (WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics, ApplyGraphicsProperties.Clipping)) - { - IntPtr dc = wg.GetHdc(); - DrawIcon(dc, Rectangle.Empty, copy, false); - } - } - - ~Icon() => Dispose(false); - - public static Icon FromHandle(IntPtr handle) => new Icon(handle); - - private unsafe short GetShort(byte* pb) - { - int retval = 0; - if (0 != (unchecked((byte)pb) & 1)) - { - retval = *pb; - pb++; - retval = unchecked(retval | (*pb << 8)); - } - else - { - retval = unchecked(*(short*)pb); - } - return unchecked((short)retval); - } - - private unsafe int GetInt(byte* pb) - { - int retval = 0; - if (0 != (unchecked((byte)pb) & 3)) - { - retval = *pb; pb++; - retval = retval | (*pb << 8); pb++; - retval = retval | (*pb << 16); pb++; - retval = unchecked(retval | (*pb << 24)); - } - else - { - retval = *(int*)pb; - } - return retval; - } - - // Initializes this Image object. This is identical to calling the image's - // constructor with picture, but this allows non-constructor initialization, - // which may be necessary in some instances. - private unsafe void Initialize(int width, int height) - { - if (_iconData == null || _handle != IntPtr.Zero) - { - throw new InvalidOperationException(SR.Format(SR.IllegalState, GetType().Name)); - } - - int icondirSize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIR)); - if (_iconData.Length < icondirSize) - { - throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); - } - - // Get the correct width and height. - if (width == 0) - { - width = UnsafeNativeMethods.GetSystemMetrics(SafeNativeMethods.SM_CXICON); - } - - if (height == 0) - { - height = UnsafeNativeMethods.GetSystemMetrics(SafeNativeMethods.SM_CYICON); - } - - if (s_bitDepth == 0) - { - IntPtr dc = UnsafeNativeMethods.GetDC(NativeMethods.NullHandleRef); - s_bitDepth = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), SafeNativeMethods.BITSPIXEL); - s_bitDepth *= UnsafeNativeMethods.GetDeviceCaps(new HandleRef(null, dc), SafeNativeMethods.PLANES); - UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new HandleRef(null, dc)); - - // If the bitdepth is 8, make it 4 because windows does not - // choose a 256 color icon if the display is running in 256 color mode - // due to palette flicker. - if (s_bitDepth == 8) - { - s_bitDepth = 4; - } - } - - fixed (byte* pbIconData = _iconData) - { - short idReserved = GetShort(pbIconData); - short idType = GetShort(pbIconData + 2); - short idCount = GetShort(pbIconData + 4); - - if (idReserved != 0 || idType != 1 || idCount == 0) - { - throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); - } - - SafeNativeMethods.ICONDIRENTRY EntryTemp; - - byte bestWidth = 0; - byte bestHeight = 0; - - byte* pbIconDirEntry = unchecked(pbIconData + 6); - int icondirEntrySize = Marshal.SizeOf(typeof(SafeNativeMethods.ICONDIRENTRY)); - - if ((icondirEntrySize * (idCount - 1) + icondirSize) > _iconData.Length) - { - throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); - } - - for (int i = 0; i < idCount; i++) - { - // Fill in EntryTemp - EntryTemp.bWidth = pbIconDirEntry[0]; - EntryTemp.bHeight = pbIconDirEntry[1]; - EntryTemp.bColorCount = pbIconDirEntry[2]; - EntryTemp.bReserved = pbIconDirEntry[3]; - EntryTemp.wPlanes = GetShort(pbIconDirEntry + 4); - EntryTemp.wBitCount = GetShort(pbIconDirEntry + 6); - EntryTemp.dwBytesInRes = GetInt(pbIconDirEntry + 8); - EntryTemp.dwImageOffset = GetInt(pbIconDirEntry + 12); - - bool fUpdateBestFit = false; - int iconBitDepth = 0; - if (EntryTemp.bColorCount != 0) - { - iconBitDepth = 4; - if (EntryTemp.bColorCount < 0x10) - { - iconBitDepth = 1; - } - } - else - { - iconBitDepth = EntryTemp.wBitCount; - } - - // If it looks like if nothing is specified at this point then set the bits per pixel to 8. - if (iconBitDepth == 0) - { - iconBitDepth = 8; - } - - // Windows rules for specifing an icon: - // - // 1. The icon with the closest size match. - // 2. For matching sizes, the image with the closest bit depth. - // 3. If there is no color depth match, the icon with the closest color depth that does not exceed the display. - // 4. If all icon color depth > display, lowest color depth is chosen. - // 5. color depth of > 8bpp are all equal. - // 6. Never choose an 8bpp icon on an 8bpp system. - // - - if (_bestBytesInRes == 0) - { - fUpdateBestFit = true; - } - else - { - int bestDelta = Math.Abs(bestWidth - width) + Math.Abs(bestHeight - height); - int thisDelta = Math.Abs(EntryTemp.bWidth - width) + Math.Abs(EntryTemp.bHeight - height); - - if ((thisDelta < bestDelta) || - (thisDelta == bestDelta && (iconBitDepth <= s_bitDepth && iconBitDepth > _bestBitDepth || _bestBitDepth > s_bitDepth && iconBitDepth < _bestBitDepth))) - { - fUpdateBestFit = true; - } - } - - if (fUpdateBestFit) - { - bestWidth = EntryTemp.bWidth; - bestHeight = EntryTemp.bHeight; - _bestImageOffset = EntryTemp.dwImageOffset; - _bestBytesInRes = EntryTemp.dwBytesInRes; - _bestBitDepth = iconBitDepth; - } - - pbIconDirEntry += icondirEntrySize; - } - - if (_bestImageOffset < 0) - { - throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); - } - - if (_bestBytesInRes < 0) - { - throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER); - } - - int endOffset; - try - { - endOffset = checked(_bestImageOffset + _bestBytesInRes); - } - catch (OverflowException) - { - throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER); - } - - if (endOffset > _iconData.Length) - { - throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); - } - - // Copy the bytes into an aligned buffer if needed. - if ((_bestImageOffset % IntPtr.Size) != 0) - { - // Beginning of icon's content is misaligned. - byte[] alignedBuffer = new byte[_bestBytesInRes]; - Array.Copy(_iconData, _bestImageOffset, alignedBuffer, 0, _bestBytesInRes); - - fixed (byte* pbAlignedBuffer = alignedBuffer) - { - _handle = SafeNativeMethods.CreateIconFromResourceEx(pbAlignedBuffer, _bestBytesInRes, true, 0x00030000, 0, 0, 0); - } - } - else - { - try - { - _handle = SafeNativeMethods.CreateIconFromResourceEx(checked(pbIconData + _bestImageOffset), _bestBytesInRes, true, 0x00030000, 0, 0, 0); - } - catch (OverflowException) - { - throw new Win32Exception(SafeNativeMethods.ERROR_INVALID_PARAMETER); - } - } - if (_handle == IntPtr.Zero) - { - throw new Win32Exception(); - } - } - } - - public void Save(Stream outputStream) - { - if (_iconData != null) - { - outputStream.Write(_iconData, 0, _iconData.Length); - } - else - { - // Ideally, we would pick apart the icon using - // GetIconInfo, and then pull the individual bitmaps out, - // converting them to DIBS and saving them into the file. - // But, in the interest of simplicity, we just call to - // OLE to do it for us. - SafeNativeMethods.PICTDESC pictdesc = SafeNativeMethods.PICTDESC.CreateIconPICTDESC(Handle); - Guid g = typeof(SafeNativeMethods.IPicture).GUID; - SafeNativeMethods.IPicture picture = SafeNativeMethods.OleCreatePictureIndirect(pictdesc, ref g, false); - - if (picture != null) - { - try - { - picture.SaveAsFile(new UnsafeNativeMethods.ComStreamFromDataStream(outputStream), -1, out int temp); - } - finally - { - Marshal.ReleaseComObject(picture); - } - } - } - } - - private void CopyBitmapData(BitmapData sourceData, BitmapData targetData) - { - int offsetSrc = 0; - int offsetDest = 0; - - Debug.Assert(sourceData.Height == targetData.Height, "Unexpected height. How did this happen?"); - - for (int i = 0; i < Math.Min(sourceData.Height, targetData.Height); i++) - { - IntPtr srcPtr, destPtr; - if (IntPtr.Size == 4) - { - srcPtr = new IntPtr(sourceData.Scan0.ToInt32() + offsetSrc); - destPtr = new IntPtr(targetData.Scan0.ToInt32() + offsetDest); - } - else - { - srcPtr = new IntPtr(sourceData.Scan0.ToInt64() + offsetSrc); - destPtr = new IntPtr(targetData.Scan0.ToInt64() + offsetDest); - } - - UnsafeNativeMethods.CopyMemory(new HandleRef(this, destPtr), new HandleRef(this, srcPtr), Math.Abs(targetData.Stride)); - - offsetSrc += sourceData.Stride; - offsetDest += targetData.Stride; - } - } - - private static bool BitmapHasAlpha(BitmapData bmpData) - { - bool hasAlpha = false; - for (int i = 0; i < bmpData.Height; i++) - { - for (int j = 3; j < Math.Abs(bmpData.Stride); j += 4) - { - // Stride here is fine since we know we're doing this on the whole image. - unsafe - { - byte* candidate = unchecked(((byte*)bmpData.Scan0.ToPointer()) + (i * bmpData.Stride) + j); - if (*candidate != 0) - { - hasAlpha = true; - return hasAlpha; - } - } - } - } - - return false; - } - - public Bitmap ToBitmap() - { - // DontSupportPngFramesInIcons is true when the application is targeting framework version below 4.6 - // and false when the application is targeting 4.6 and above. Downlevel application can also set the following switch - // to false in the .config file's runtime section in order to opt-in into the new behavior: - // - if (HasPngSignature() && !LocalAppContextSwitches.DontSupportPngFramesInIcons) - { - return PngFrame(); - } - - return BmpFrame(); - } - - private Bitmap BmpFrame() - { - Bitmap bitmap = null; - if (_iconData != null && _bestBitDepth == 32) - { - // GDI+ doesnt handle 32 bpp icons with alpha properly - // we load the icon ourself from the byte table - bitmap = new Bitmap(Size.Width, Size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - Debug.Assert(_bestImageOffset >= 0 && (_bestImageOffset + _bestBytesInRes) <= _iconData.Length, "Illegal offset/length for the Icon data"); - - unsafe - { - BitmapData bmpdata = bitmap.LockBits(new Rectangle(0, 0, Size.Width, Size.Height), - ImageLockMode.WriteOnly, - PixelFormat.Format32bppArgb); - try - { - uint* pixelPtr = (uint*)bmpdata.Scan0.ToPointer(); - - // jumping the image header - int newOffset = _bestImageOffset + Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER)); - // there is no color table that we need to skip since we're 32bpp - - int lineLength = Size.Width * 4; - int width = Size.Width; - for (int j = (Size.Height - 1) * 4; j >= 0; j -= 4) - { - Marshal.Copy(_iconData, newOffset + j * width, (IntPtr)pixelPtr, lineLength); - pixelPtr += width; - } - - // note: we ignore the mask that's available after the pixel table - } - finally - { - bitmap.UnlockBits(bmpdata); - } - } - } - else if (_bestBitDepth == 0 || _bestBitDepth == 32) - { - // This may be a 32bpp icon or an icon without any data. - var info = new SafeNativeMethods.ICONINFO(); - SafeNativeMethods.GetIconInfo(new HandleRef(this, _handle), info); - var bmp = new SafeNativeMethods.BITMAP(); - try - { - if (info.hbmColor != IntPtr.Zero) - { - SafeNativeMethods.GetObject(new HandleRef(null, info.hbmColor), Marshal.SizeOf(typeof(SafeNativeMethods.BITMAP)), bmp); - if (bmp.bmBitsPixel == 32) - { - Bitmap tmpBitmap = null; - BitmapData bmpData = null; - BitmapData targetData = null; - try - { - tmpBitmap = Image.FromHbitmap(info.hbmColor); - - // In GDI+ the bits are there but the bitmap was created with no alpha channel - // so copy the bits by hand to a new bitmap - // we also need to go around a limitation in the way the ICON is stored (ie if it's another bpp - // but stored in 32bpp all pixels are transparent and not opaque) - // (Here you mostly need to remain calm....) - bmpData = tmpBitmap.LockBits(new Rectangle(0, 0, tmpBitmap.Width, tmpBitmap.Height), ImageLockMode.ReadOnly, tmpBitmap.PixelFormat); - - // we need do the following if the image has alpha because otherwise the image is fully transparent even though it has data - if (BitmapHasAlpha(bmpData)) - { - bitmap = new Bitmap(bmpData.Width, bmpData.Height, PixelFormat.Format32bppArgb); - targetData = bitmap.LockBits(new Rectangle(0, 0, bmpData.Width, bmpData.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); - - CopyBitmapData(bmpData, targetData); - } - } - finally - { - if (tmpBitmap != null && bmpData != null) - { - tmpBitmap.UnlockBits(bmpData); - } - if (bitmap != null && targetData != null) - { - bitmap.UnlockBits(targetData); - } - } - tmpBitmap.Dispose(); - } - } - } - finally - { - if (info.hbmColor != IntPtr.Zero) - { - SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmColor)); - } - if (info.hbmMask != IntPtr.Zero) - { - SafeNativeMethods.IntDeleteObject(new HandleRef(null, info.hbmMask)); - } - } - } - - - if (bitmap == null) - { - // last chance... all the other cases (ie non 32 bpp icons coming from a handle or from the bitmapData) - - // we have to do this rather than just return Bitmap.FromHIcon because - // the bitmap returned from that, even though it's 32bpp, just paints where the mask allows it - // seems like another GDI+ weirdness. might be interesting to investigate further. In the meantime - // this looks like the right thing to do and is not more expansive that what was present before. - - Size size = Size; - bitmap = new Bitmap(size.Width, size.Height); // initialized to transparent - Graphics graphics = null; - using (graphics = Graphics.FromImage(bitmap)) - { - try - { - using (Bitmap tmpBitmap = Bitmap.FromHicon(Handle)) - { - graphics.DrawImage(tmpBitmap, new Rectangle(0, 0, size.Width, size.Height)); - } - } - catch (ArgumentException) - { - // Sometimes FromHicon will crash with no real reason. - // The backup plan is to just draw the image like we used to. - // NOTE: FromHIcon is also where we have the buffer overrun - // if width and height are mismatched. - Draw(graphics, new Rectangle(0, 0, size.Width, size.Height)); - } - } - - - // GDI+ fills the surface with a sentinel color for GetDC, but does - // not correctly clean it up again, so we have to do it. - Color fakeTransparencyColor = Color.FromArgb(0x0d, 0x0b, 0x0c); - bitmap.MakeTransparent(fakeTransparencyColor); - } - - Debug.Assert(bitmap != null, "Bitmap cannot be null"); - return bitmap; - } - - private Bitmap PngFrame() - { - Debug.Assert(_iconData != null); - using (var stream = new MemoryStream()) - { - stream.Write(_iconData, _bestImageOffset, _bestBytesInRes); - return new Bitmap(stream); - } - } - - private bool HasPngSignature() - { - if (!_isBestImagePng.HasValue) - { - if (_iconData != null && _iconData.Length >= _bestImageOffset + 8) - { - int iconSignature1 = BitConverter.ToInt32(_iconData, _bestImageOffset); - int iconSignature2 = BitConverter.ToInt32(_iconData, _bestImageOffset + 4); - _isBestImagePng = (iconSignature1 == PNGSignature1) && (iconSignature2 == PNGSignature2); - } - else - { - _isBestImagePng = false; - } - } - - return _isBestImagePng.Value; - } - - public override string ToString() => SR.toStringIcon; - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.NotSerializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.NotSerializable.cs new file mode 100644 index 0000000000..a08ca4d9f0 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.NotSerializable.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; + +namespace System.Drawing +{ + partial class Image + { + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Serializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Serializable.cs index 1d690657e0..ffb5f9d14d 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Serializable.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Serializable.cs @@ -11,7 +11,7 @@ using System.Security.Permissions; namespace System.Drawing { [Serializable] - partial class Image : ISerializable + partial class Image { #pragma warning disable CA2229 internal Image(SerializationInfo info, StreamingContext context) diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Unix.cs new file mode 100644 index 0000000000..30b1ed2a6e --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Unix.cs @@ -0,0 +1,901 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Image.cs +// +// Authors: Christian Meyer (Christian.Meyer@cs.tum.edu) +// Alexandre Pigolkine (pigolkine@gmx.de) +// Jordi Mas i Hernandez (jordi@ximian.com) +// Sanjay Gupta (gsanjay@novell.com) +// Ravindra (rkumar@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) +// Copyright (C) 2013 Kristof Ralovich, changes are available under the terms of the MIT X11 license +// +// 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.Runtime.Serialization; +using System.Runtime.InteropServices; +using System.ComponentModel; +using System.Drawing.Imaging; +using System.IO; +using System.Reflection; + +namespace System.Drawing +{ + [ComVisible(true)] + [Serializable] +#if !NETCORE +[Editor ("System.Drawing.Design.ImageEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] +[TypeConverter (typeof(ImageConverter))] +#endif + [ImmutableObject(true)] + public abstract class Image : MarshalByRefObject, IDisposable, ICloneable, ISerializable + { + public delegate bool GetThumbnailImageAbort(); + private object tag; + + internal IntPtr nativeObject = IntPtr.Zero; + + // constructor + internal Image() + { + } + +#if NETCORE + protected Image(SerializationInfo info, StreamingContext context) +#else + internal Image (SerializationInfo info, StreamingContext context) +#endif + { + foreach (SerializationEntry serEnum in info) + { + if (String.Compare(serEnum.Name, "Data", true) == 0) + { + byte[] bytes = (byte[])serEnum.Value; + + if (bytes != null) + { + MemoryStream ms = new MemoryStream(bytes); + nativeObject = InitFromStream(ms); + } + } + } + } + + // FIXME - find out how metafiles (another decoder-only codec) are handled + void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context) + { + using (MemoryStream ms = new MemoryStream()) + { + // Icon is a decoder-only codec + if (RawFormat.Equals(ImageFormat.Icon)) + { + Save(ms, ImageFormat.Png); + } + else + { + Save(ms, RawFormat); + } + si.AddValue("Data", ms.ToArray()); + } + } + + // public methods + // static + public static Image FromFile(string filename) + { + return FromFile(filename, false); + } + + public static Image FromFile(string filename, bool useEmbeddedColorManagement) + { + IntPtr imagePtr; + int st; + + if (!File.Exists(filename)) + throw new FileNotFoundException(filename); + + if (useEmbeddedColorManagement) + st = SafeNativeMethods.Gdip.GdipLoadImageFromFileICM(filename, out imagePtr); + else + st = SafeNativeMethods.Gdip.GdipLoadImageFromFile(filename, out imagePtr); + SafeNativeMethods.Gdip.CheckStatus(st); + + return CreateFromHandle(imagePtr); + } + + public static Bitmap FromHbitmap(IntPtr hbitmap) + { + return FromHbitmap(hbitmap, IntPtr.Zero); + } + + public static Bitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette) + { + IntPtr imagePtr; + int st; + + st = SafeNativeMethods.Gdip.GdipCreateBitmapFromHBITMAP(hbitmap, hpalette, out imagePtr); + + SafeNativeMethods.Gdip.CheckStatus(st); + return new Bitmap(imagePtr); + } + + // note: FromStream can return either a Bitmap or Metafile instance + + public static Image FromStream(Stream stream) + { + return LoadFromStream(stream, false); + } + + [MonoLimitation("useEmbeddedColorManagement isn't supported.")] + public static Image FromStream(Stream stream, bool useEmbeddedColorManagement) + { + return LoadFromStream(stream, false); + } + + // See http://support.microsoft.com/default.aspx?scid=kb;en-us;831419 for performance discussion + [MonoLimitation("useEmbeddedColorManagement and validateImageData aren't supported.")] + public static Image FromStream(Stream stream, bool useEmbeddedColorManagement, bool validateImageData) + { + return LoadFromStream(stream, false); + } + + internal static Image LoadFromStream(Stream stream, bool keepAlive) + { + if (stream == null) + throw new ArgumentNullException("stream"); + + Image img = CreateFromHandle(InitFromStream(stream)); + return img; + } + + internal static Image CreateImageObject(IntPtr nativeImage) + { + return CreateFromHandle(nativeImage); + } + + internal static Image CreateFromHandle(IntPtr handle) + { + ImageType type; + SafeNativeMethods.Gdip.CheckStatus(SafeNativeMethods.Gdip.GdipGetImageType(handle, out type)); + switch (type) + { + case ImageType.Bitmap: + return new Bitmap(handle); + case ImageType.Metafile: + return new Metafile(handle); + default: + throw new NotSupportedException("Unknown image type."); + } + } + + public static int GetPixelFormatSize(PixelFormat pixfmt) + { + int result = 0; + switch (pixfmt) + { + case PixelFormat.Format16bppArgb1555: + case PixelFormat.Format16bppGrayScale: + case PixelFormat.Format16bppRgb555: + case PixelFormat.Format16bppRgb565: + result = 16; + break; + case PixelFormat.Format1bppIndexed: + result = 1; + break; + case PixelFormat.Format24bppRgb: + result = 24; + break; + case PixelFormat.Format32bppArgb: + case PixelFormat.Format32bppPArgb: + case PixelFormat.Format32bppRgb: + result = 32; + break; + case PixelFormat.Format48bppRgb: + result = 48; + break; + case PixelFormat.Format4bppIndexed: + result = 4; + break; + case PixelFormat.Format64bppArgb: + case PixelFormat.Format64bppPArgb: + result = 64; + break; + case PixelFormat.Format8bppIndexed: + result = 8; + break; + } + return result; + } + + public static bool IsAlphaPixelFormat(PixelFormat pixfmt) + { + bool result = false; + switch (pixfmt) + { + case PixelFormat.Format16bppArgb1555: + case PixelFormat.Format32bppArgb: + case PixelFormat.Format32bppPArgb: + case PixelFormat.Format64bppArgb: + case PixelFormat.Format64bppPArgb: + result = true; + break; + case PixelFormat.Format16bppGrayScale: + case PixelFormat.Format16bppRgb555: + case PixelFormat.Format16bppRgb565: + case PixelFormat.Format1bppIndexed: + case PixelFormat.Format24bppRgb: + case PixelFormat.Format32bppRgb: + case PixelFormat.Format48bppRgb: + case PixelFormat.Format4bppIndexed: + case PixelFormat.Format8bppIndexed: + result = false; + break; + } + return result; + } + + public static bool IsCanonicalPixelFormat(PixelFormat pixfmt) + { + return ((pixfmt & PixelFormat.Canonical) != 0); + } + + public static bool IsExtendedPixelFormat(PixelFormat pixfmt) + { + return ((pixfmt & PixelFormat.Extended) != 0); + } + + internal static IntPtr InitFromStream(Stream stream) + { + if (stream == null) + throw new ArgumentNullException(nameof(stream)); + + IntPtr imagePtr; + int st; + + // Seeking required + if (!stream.CanSeek) + { + byte[] buffer = new byte[256]; + int index = 0; + int count; + + do + { + if (buffer.Length < index + 256) + { + byte[] newBuffer = new byte[buffer.Length * 2]; + Array.Copy(buffer, newBuffer, buffer.Length); + buffer = newBuffer; + } + count = stream.Read(buffer, index, 256); + index += count; + } + while (count != 0); + + stream = new MemoryStream(buffer, 0, index); + } + + // Unix, with libgdiplus + // We use a custom API for this, because there's no easy way + // to get the Stream down to libgdiplus. So, we wrap the stream + // with a set of delegates. + GdiPlusStreamHelper sh = new GdiPlusStreamHelper(stream, true); + + st = SafeNativeMethods.Gdip.GdipLoadImageFromDelegate_linux(sh.GetHeaderDelegate, sh.GetBytesDelegate, + sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, out imagePtr); + + return st == SafeNativeMethods.Gdip.Ok ? imagePtr : IntPtr.Zero; + } + + // non-static + public RectangleF GetBounds(ref GraphicsUnit pageUnit) + { + RectangleF source; + + int status = SafeNativeMethods.Gdip.GdipGetImageBounds(nativeObject, out source, ref pageUnit); + SafeNativeMethods.Gdip.CheckStatus(status); + + return source; + } + + public EncoderParameters GetEncoderParameterList(Guid encoder) + { + int status; + uint sz; + + status = SafeNativeMethods.Gdip.GdipGetEncoderParameterListSize(nativeObject, ref encoder, out sz); + SafeNativeMethods.Gdip.CheckStatus(status); + + IntPtr rawEPList = Marshal.AllocHGlobal((int)sz); + EncoderParameters eps; + + try + { + status = SafeNativeMethods.Gdip.GdipGetEncoderParameterList(nativeObject, ref encoder, sz, rawEPList); + eps = EncoderParameters.ConvertFromMemory(rawEPList); + SafeNativeMethods.Gdip.CheckStatus(status); + } + finally + { + Marshal.FreeHGlobal(rawEPList); + } + + return eps; + } + + public int GetFrameCount(FrameDimension dimension) + { + uint count; + Guid guid = dimension.Guid; + + int status = SafeNativeMethods.Gdip.GdipImageGetFrameCount(nativeObject, ref guid, out count); + SafeNativeMethods.Gdip.CheckStatus(status); + + return (int)count; + } + + public PropertyItem GetPropertyItem(int propid) + { + int propSize; + IntPtr property; + PropertyItem item = new PropertyItem(); + GdipPropertyItem gdipProperty = new GdipPropertyItem(); + int status; + + status = SafeNativeMethods.Gdip.GdipGetPropertyItemSize(nativeObject, propid, + out propSize); + SafeNativeMethods.Gdip.CheckStatus(status); + + /* Get PropertyItem */ + property = Marshal.AllocHGlobal(propSize); + try + { + status = SafeNativeMethods.Gdip.GdipGetPropertyItem(nativeObject, propid, propSize, property); + SafeNativeMethods.Gdip.CheckStatus(status); + gdipProperty = (GdipPropertyItem)Marshal.PtrToStructure(property, + typeof(GdipPropertyItem)); + GdipPropertyItem.MarshalTo(gdipProperty, item); + } + finally + { + Marshal.FreeHGlobal(property); + } + return item; + } + + public Image GetThumbnailImage(int thumbWidth, int thumbHeight, Image.GetThumbnailImageAbort callback, IntPtr callbackData) + { + if ((thumbWidth <= 0) || (thumbHeight <= 0)) + throw new OutOfMemoryException("Invalid thumbnail size"); + + Image ThumbNail = new Bitmap(thumbWidth, thumbHeight); + + using (Graphics g = Graphics.FromImage(ThumbNail)) + { + int status = SafeNativeMethods.Gdip.GdipDrawImageRectRectI(g.nativeObject, nativeObject, + 0, 0, thumbWidth, thumbHeight, + 0, 0, this.Width, this.Height, + GraphicsUnit.Pixel, IntPtr.Zero, null, IntPtr.Zero); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + + return ThumbNail; + } + + + public void RemovePropertyItem(int propid) + { + int status = SafeNativeMethods.Gdip.GdipRemovePropertyItem(nativeObject, propid); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public void RotateFlip(RotateFlipType rotateFlipType) + { + int status = SafeNativeMethods.Gdip.GdipImageRotateFlip(nativeObject, rotateFlipType); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + internal ImageCodecInfo findEncoderForFormat(ImageFormat format) + { + ImageCodecInfo[] encoders = ImageCodecInfo.GetImageEncoders(); + ImageCodecInfo encoder = null; + + if (format.Guid.Equals(ImageFormat.MemoryBmp.Guid)) + format = ImageFormat.Png; + + /* Look for the right encoder for our format*/ + for (int i = 0; i < encoders.Length; i++) + { + if (encoders[i].FormatID.Equals(format.Guid)) + { + encoder = encoders[i]; + break; + } + } + + return encoder; + } + + public void Save(string filename) + { + Save(filename, RawFormat); + } + + public void Save(string filename, ImageFormat format) + { + ImageCodecInfo encoder = findEncoderForFormat(format); + if (encoder == null) + { + // second chance + encoder = findEncoderForFormat(RawFormat); + if (encoder == null) + { + string msg = string.Format("No codec available for saving format '{0}'.", format.Guid); + throw new ArgumentException(msg, "format"); + } + } + Save(filename, encoder, null); + } + + public void Save(string filename, ImageCodecInfo encoder, EncoderParameters encoderParams) + { + int st; + Guid guid = encoder.Clsid; + + if (encoderParams == null) + { + st = SafeNativeMethods.Gdip.GdipSaveImageToFile(nativeObject, filename, ref guid, IntPtr.Zero); + } + else + { + IntPtr nativeEncoderParams = encoderParams.ConvertToMemory(); + st = SafeNativeMethods.Gdip.GdipSaveImageToFile(nativeObject, filename, ref guid, nativeEncoderParams); + Marshal.FreeHGlobal(nativeEncoderParams); + } + + SafeNativeMethods.Gdip.CheckStatus(st); + } + + public void Save(Stream stream, ImageFormat format) + { + ImageCodecInfo encoder = findEncoderForFormat(format); + + if (encoder == null) + throw new ArgumentException("No codec available for format:" + format.Guid); + + Save(stream, encoder, null); + } + + public void Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) + { + int st; + IntPtr nativeEncoderParams; + Guid guid = encoder.Clsid; + + if (encoderParams == null) + nativeEncoderParams = IntPtr.Zero; + else + nativeEncoderParams = encoderParams.ConvertToMemory(); + + try + { + GdiPlusStreamHelper sh = new GdiPlusStreamHelper(stream, false); + st = SafeNativeMethods.Gdip.GdipSaveImageToDelegate_linux(nativeObject, sh.GetBytesDelegate, sh.PutBytesDelegate, + sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, ref guid, nativeEncoderParams); + } + finally + { + if (nativeEncoderParams != IntPtr.Zero) + Marshal.FreeHGlobal(nativeEncoderParams); + } + + SafeNativeMethods.Gdip.CheckStatus(st); + } + + public void SaveAdd(EncoderParameters encoderParams) + { + int st; + + IntPtr nativeEncoderParams = encoderParams.ConvertToMemory(); + st = SafeNativeMethods.Gdip.GdipSaveAdd(nativeObject, nativeEncoderParams); + Marshal.FreeHGlobal(nativeEncoderParams); + SafeNativeMethods.Gdip.CheckStatus(st); + } + + public void SaveAdd(Image image, EncoderParameters encoderParams) + { + int st; + + IntPtr nativeEncoderParams = encoderParams.ConvertToMemory(); + st = SafeNativeMethods.Gdip.GdipSaveAddImage(nativeObject, image.NativeObject, nativeEncoderParams); + Marshal.FreeHGlobal(nativeEncoderParams); + SafeNativeMethods.Gdip.CheckStatus(st); + } + + public int SelectActiveFrame(FrameDimension dimension, int frameIndex) + { + Guid guid = dimension.Guid; + int st = SafeNativeMethods.Gdip.GdipImageSelectActiveFrame(nativeObject, ref guid, frameIndex); + + SafeNativeMethods.Gdip.CheckStatus(st); + + return frameIndex; + } + + public void SetPropertyItem(PropertyItem propitem) + { + if (propitem == null) + throw new ArgumentNullException("propitem"); + + int nItemSize = Marshal.SizeOf(propitem.Value[0]); + int size = nItemSize * propitem.Value.Length; + IntPtr dest = Marshal.AllocHGlobal(size); + try + { + GdipPropertyItem pi = new GdipPropertyItem(); + pi.id = propitem.Id; + pi.len = propitem.Len; + pi.type = propitem.Type; + + Marshal.Copy(propitem.Value, 0, dest, size); + pi.value = dest; + + unsafe + { + int status = SafeNativeMethods.Gdip.GdipSetPropertyItem(nativeObject, &pi); + + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + finally + { + Marshal.FreeHGlobal(dest); + } + } + + // properties + [Browsable(false)] + public int Flags + { + get + { + int flags; + + int status = SafeNativeMethods.Gdip.GdipGetImageFlags(nativeObject, out flags); + SafeNativeMethods.Gdip.CheckStatus(status); + return flags; + } + } + + [Browsable(false)] + public Guid[] FrameDimensionsList + { + get + { + uint found; + int status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsCount(nativeObject, out found); + SafeNativeMethods.Gdip.CheckStatus(status); + Guid[] guid = new Guid[found]; + status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsList(nativeObject, guid, found); + SafeNativeMethods.Gdip.CheckStatus(status); + return guid; + } + } + + [DefaultValue(false)] + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int Height + { + get + { + uint height; + int status = SafeNativeMethods.Gdip.GdipGetImageHeight(nativeObject, out height); + SafeNativeMethods.Gdip.CheckStatus(status); + + return (int)height; + } + } + + public float HorizontalResolution + { + get + { + float resolution; + + int status = SafeNativeMethods.Gdip.GdipGetImageHorizontalResolution(nativeObject, out resolution); + SafeNativeMethods.Gdip.CheckStatus(status); + + return resolution; + } + } + + [Browsable(false)] + public ColorPalette Palette + { + get + { + return retrieveGDIPalette(); + } + set + { + storeGDIPalette(value); + } + } + + internal ColorPalette retrieveGDIPalette() + { + int bytes; + ColorPalette ret = new ColorPalette(); + + int st = SafeNativeMethods.Gdip.GdipGetImagePaletteSize(nativeObject, out bytes); + SafeNativeMethods.Gdip.CheckStatus(st); + IntPtr palette_data = Marshal.AllocHGlobal(bytes); + try + { + st = SafeNativeMethods.Gdip.GdipGetImagePalette(nativeObject, palette_data, bytes); + SafeNativeMethods.Gdip.CheckStatus(st); + ret.ConvertFromMemory(palette_data); + return ret; + } + + finally + { + Marshal.FreeHGlobal(palette_data); + } + } + + internal void storeGDIPalette(ColorPalette palette) + { + if (palette == null) + { + throw new ArgumentNullException("palette"); + } + IntPtr palette_data = palette.ConvertToMemory(); + if (palette_data == IntPtr.Zero) + { + return; + } + + try + { + int st = SafeNativeMethods.Gdip.GdipSetImagePalette(nativeObject, palette_data); + SafeNativeMethods.Gdip.CheckStatus(st); + } + + finally + { + Marshal.FreeHGlobal(palette_data); + } + } + + + public SizeF PhysicalDimension + { + get + { + float width, height; + int status = SafeNativeMethods.Gdip.GdipGetImageDimension(nativeObject, out width, out height); + SafeNativeMethods.Gdip.CheckStatus(status); + + return new SizeF(width, height); + } + } + + public PixelFormat PixelFormat + { + get + { + PixelFormat pixFormat; + int status = SafeNativeMethods.Gdip.GdipGetImagePixelFormat(nativeObject, out pixFormat); + SafeNativeMethods.Gdip.CheckStatus(status); + + return pixFormat; + } + } + + [Browsable(false)] + public int[] PropertyIdList + { + get + { + uint propNumbers; + + int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(nativeObject, + out propNumbers); + SafeNativeMethods.Gdip.CheckStatus(status); + + int[] idList = new int[propNumbers]; + status = SafeNativeMethods.Gdip.GdipGetPropertyIdList(nativeObject, + propNumbers, idList); + SafeNativeMethods.Gdip.CheckStatus(status); + + return idList; + } + } + + [Browsable(false)] + public PropertyItem[] PropertyItems + { + get + { + int propNums, propsSize, propSize; + IntPtr properties, propPtr; + PropertyItem[] items; + GdipPropertyItem gdipProperty = new GdipPropertyItem(); + int status; + + status = SafeNativeMethods.Gdip.GdipGetPropertySize(nativeObject, out propsSize, out propNums); + SafeNativeMethods.Gdip.CheckStatus(status); + + items = new PropertyItem[propNums]; + + if (propNums == 0) + return items; + + /* Get PropertyItem list*/ + properties = Marshal.AllocHGlobal(propsSize * propNums); + try + { + status = SafeNativeMethods.Gdip.GdipGetAllPropertyItems(nativeObject, propsSize, + propNums, properties); + SafeNativeMethods.Gdip.CheckStatus(status); + + propSize = Marshal.SizeOf(gdipProperty); + propPtr = properties; + + for (int i = 0; i < propNums; i++, propPtr = new IntPtr(propPtr.ToInt64() + propSize)) + { + gdipProperty = (GdipPropertyItem)Marshal.PtrToStructure + (propPtr, typeof(GdipPropertyItem)); + items[i] = new PropertyItem(); + GdipPropertyItem.MarshalTo(gdipProperty, items[i]); + } + } + finally + { + Marshal.FreeHGlobal(properties); + } + return items; + } + } + + public ImageFormat RawFormat + { + get + { + Guid guid; + int st = SafeNativeMethods.Gdip.GdipGetImageRawFormat(nativeObject, out guid); + + SafeNativeMethods.Gdip.CheckStatus(st); + return new ImageFormat(guid); + } + } + + public Size Size + { + get + { + return new Size(Width, Height); + } + } + + [DefaultValue(null)] + [LocalizableAttribute(false)] +#if !NETCORE + [BindableAttribute(true)] + [TypeConverter (typeof (StringConverter))] +#endif + public object Tag + { + get { return tag; } + set { tag = value; } + } + public float VerticalResolution + { + get + { + float resolution; + + int status = SafeNativeMethods.Gdip.GdipGetImageVerticalResolution(nativeObject, out resolution); + SafeNativeMethods.Gdip.CheckStatus(status); + + return resolution; + } + } + + [DefaultValue(false)] + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public int Width + { + get + { + uint width; + int status = SafeNativeMethods.Gdip.GdipGetImageWidth(nativeObject, out width); + SafeNativeMethods.Gdip.CheckStatus(status); + + return (int)width; + } + } + + internal IntPtr NativeObject + { + get + { + return nativeObject; + } + set + { + nativeObject = value; + } + } + + internal IntPtr nativeImage + { + get + { + return nativeObject; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + ~Image() + { + Dispose(false); + } + + protected virtual void Dispose(bool disposing) + { + if (nativeObject != IntPtr.Zero) + { + int status = SafeNativeMethods.Gdip.GdipDisposeImage(nativeObject); + // ... set nativeObject to null before (possibly) throwing an exception + nativeObject = IntPtr.Zero; + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + public object Clone() + { + IntPtr newimage = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipCloneImage(NativeObject, out newimage); + SafeNativeMethods.Gdip.CheckStatus(status); + + if (this is Bitmap) + return new Bitmap(newimage); + else + return new Metafile(newimage); + } + } + +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Windows.cs new file mode 100644 index 0000000000..80c3821f20 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.Windows.cs @@ -0,0 +1,1237 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing.Imaging; +using System.Drawing.Internal; +using System.Globalization; +using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; + +namespace System.Drawing +{ + /// + /// An abstract base class that provides functionality for 'Bitmap', 'Icon', 'Cursor', and 'Metafile' descended classes. + /// + [ImmutableObject(true)] + [ComVisible(true)] + public abstract partial class Image : MarshalByRefObject, ICloneable, IDisposable, ISerializable + { +#if FINALIZATION_WATCH + private string allocationSite = Graphics.GetAllocationStack(); +#endif + + // The signature of this delegate is incorrect. The signature of the corresponding + // native callback function is: + // extern "C" { + // typedef BOOL (CALLBACK * ImageAbort)(VOID *); + // typedef ImageAbort DrawImageAbort; + // typedef ImageAbort GetThumbnailImageAbort; + // } + // However, as this delegate is not used in both GDI 1.0 and 1.1, we choose not + // to modify it, in order to preserve compatibility. + public delegate bool GetThumbnailImageAbort(); + + internal IntPtr nativeImage; + + // used to work around lack of animated gif encoder... rarely set... + private byte[] _rawData; + + //userData : so that user can use TAGS with IMAGES.. + private object _userData; + + internal Image() + { + } + + [ + Localizable(false), + DefaultValue(null), + ] + public object Tag + { + get + { + return _userData; + } + set + { + _userData = value; + } + } + + /// + /// Creates an from the specified file. + /// + public static Image FromFile(string filename) => FromFile(filename, false); + + public static Image FromFile(string filename, bool useEmbeddedColorManagement) + { + if (!File.Exists(filename)) + { + // Throw a more specific exception for invalid paths that are null or empty, + // contain invalid characters or are too long. + filename = Path.GetFullPath(filename); + throw new FileNotFoundException(filename); + } + + // GDI+ will read this file multiple times. Get the fully qualified path + // so if our app changes default directory we won't get an error + filename = Path.GetFullPath(filename); + + IntPtr image = IntPtr.Zero; + int status; + + if (useEmbeddedColorManagement) + { + status = SafeNativeMethods.Gdip.GdipLoadImageFromFileICM(filename, out image); + } + else + { + status = SafeNativeMethods.Gdip.GdipLoadImageFromFile(filename, out image); + } + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image)); + + if (status != SafeNativeMethods.Gdip.Ok) + { + SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image)); + throw SafeNativeMethods.Gdip.StatusException(status); + } + + Image img = CreateImageObject(image); + + EnsureSave(img, filename, null); + + return img; + } + + + /// + /// Creates an from the specified data stream. + /// + public static Image FromStream(Stream stream) + { + return Image.FromStream(stream, false); + } + + public static Image FromStream(Stream stream, + bool useEmbeddedColorManagement) + { + return FromStream(stream, useEmbeddedColorManagement, true); + } + + public static Image FromStream(Stream stream, bool useEmbeddedColorManagement, bool validateImageData) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + IntPtr image = IntPtr.Zero; + int status; + + if (useEmbeddedColorManagement) + { + status = SafeNativeMethods.Gdip.GdipLoadImageFromStreamICM(new GPStream(stream), out image); + } + else + { + status = SafeNativeMethods.Gdip.GdipLoadImageFromStream(new GPStream(stream), out image); + } + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + if (validateImageData) + { + status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image)); + + if (status != SafeNativeMethods.Gdip.Ok) + { + SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image)); + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + Image img = CreateImageObject(image); + + EnsureSave(img, null, stream); + + return img; + } + + // Used for serialization + private void InitializeFromStream(Stream stream) + { + IntPtr image = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipLoadImageFromStream(new GPStream(stream), out image); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image)); + + if (status != SafeNativeMethods.Gdip.Ok) + { + SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image)); + throw SafeNativeMethods.Gdip.StatusException(status); + } + + nativeImage = image; + + int type = -1; + + status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(this, nativeImage), out type); + + EnsureSave(this, null, stream); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + } + + internal Image(IntPtr nativeImage) + { + SetNativeImage(nativeImage); + } + + /// + /// Creates an exact copy of this . + /// + public object Clone() + { + IntPtr cloneImage = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipCloneImage(new HandleRef(this, nativeImage), out cloneImage); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, cloneImage)); + + if (status != SafeNativeMethods.Gdip.Ok) + { + SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, cloneImage)); + throw SafeNativeMethods.Gdip.StatusException(status); + } + + return CreateImageObject(cloneImage); + } + + /// + /// Cleans up Windows resources for this . + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { +#if FINALIZATION_WATCH + if (!disposing && nativeImage != IntPtr.Zero) + Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite); +#endif + if (nativeImage != IntPtr.Zero) + { + try + { +#if DEBUG + int status = +#endif + SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(this, nativeImage)); +#if DEBUG + Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture)); +#endif + } + catch (Exception ex) + { + if (ClientUtils.IsSecurityOrCriticalException(ex)) + { + throw; + } + + Debug.Fail("Exception thrown during Dispose: " + ex.ToString()); + } + finally + { + nativeImage = IntPtr.Zero; + } + } + } + + /// + /// Cleans up Windows resources for this . + /// + ~Image() + { + Dispose(false); + } + + internal static void EnsureSave(Image image, string filename, Stream dataStream) + { + if (image.RawFormat.Equals(ImageFormat.Gif)) + { + bool animatedGif = false; + + Guid[] dimensions = image.FrameDimensionsList; + foreach (Guid guid in dimensions) + { + FrameDimension dimension = new FrameDimension(guid); + if (dimension.Equals(FrameDimension.Time)) + { + animatedGif = image.GetFrameCount(FrameDimension.Time) > 1; + break; + } + } + + + if (animatedGif) + { + try + { + Stream created = null; + long lastPos = 0; + if (dataStream != null) + { + lastPos = dataStream.Position; + dataStream.Position = 0; + } + + try + { + if (dataStream == null) + { + created = dataStream = File.OpenRead(filename); + } + + image._rawData = new byte[(int)dataStream.Length]; + dataStream.Read(image._rawData, 0, (int)dataStream.Length); + } + finally + { + if (created != null) + { + created.Close(); + } + else + { + dataStream.Position = lastPos; + } + } + } + // possible exceptions for reading the filename + catch (UnauthorizedAccessException) + { + } + catch (DirectoryNotFoundException) + { + } + catch (IOException) + { + } + // possible exceptions for setting/getting the position inside dataStream + catch (NotSupportedException) + { + } + catch (ObjectDisposedException) + { + } + // possible exception when reading stuff into dataStream + catch (ArgumentException) + { + } + } + } + } + + internal static Image CreateImageObject(IntPtr nativeImage) + { + Image image; + + int type = -1; + + int status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(null, nativeImage), out type); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + switch ((ImageType)type) + { + case ImageType.Bitmap: + image = Bitmap.FromGDIplus(nativeImage); + break; + + case ImageType.Metafile: + image = Metafile.FromGDIplus(nativeImage); + break; + + default: + throw new ArgumentException(SR.Format(SR.InvalidImage)); + } + + return image; + } + + /// + /// Returns information about the codecs used for this . + /// + public EncoderParameters GetEncoderParameterList(Guid encoder) + { + EncoderParameters p; + int size; + + int status = SafeNativeMethods.Gdip.GdipGetEncoderParameterListSize(new HandleRef(this, nativeImage), + ref encoder, + out size); + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + if (size <= 0) + return null; + + IntPtr buffer = Marshal.AllocHGlobal(size); + try + { + status = SafeNativeMethods.Gdip.GdipGetEncoderParameterList(new HandleRef(this, nativeImage), + ref encoder, + size, + buffer); + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + p = EncoderParameters.ConvertFromMemory(buffer); + } + finally + { + Marshal.FreeHGlobal(buffer); + } + + return p; + } + + /// + /// Saves this to the specified file. + /// + public void Save(string filename) + { + Save(filename, RawFormat); + } + + /// + /// Saves this to the specified file in the specified format. + /// + public void Save(string filename, ImageFormat format) + { + if (format == null) + throw new ArgumentNullException("format"); + + ImageCodecInfo codec = format.FindEncoder(); + + if (codec == null) + codec = ImageFormat.Png.FindEncoder(); + + Save(filename, codec, null); + } + + /// + /// Saves this to the specified file in the specified format and with the specified encoder parameters. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] + public void Save(string filename, ImageCodecInfo encoder, EncoderParameters encoderParams) + { + if (filename == null) + throw new ArgumentNullException("filename"); + if (encoder == null) + throw new ArgumentNullException("encoder"); + + IntPtr encoderParamsMemory = IntPtr.Zero; + + if (encoderParams != null) + { + _rawData = null; + encoderParamsMemory = encoderParams.ConvertToMemory(); + } + int status = SafeNativeMethods.Gdip.Ok; + + try + { + Guid g = encoder.Clsid; + bool saved = false; + + if (_rawData != null) + { + ImageCodecInfo rawEncoder = RawFormat.FindEncoder(); + if (rawEncoder != null && rawEncoder.Clsid == g) + { + using (FileStream fs = File.OpenWrite(filename)) + { + fs.Write(_rawData, 0, _rawData.Length); + saved = true; + } + } + } + + if (!saved) + { + status = SafeNativeMethods.Gdip.GdipSaveImageToFile(new HandleRef(this, nativeImage), + filename, + ref g, + new HandleRef(encoderParams, encoderParamsMemory)); + } + } + finally + { + if (encoderParamsMemory != IntPtr.Zero) + { + Marshal.FreeHGlobal(encoderParamsMemory); + } + } + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + internal void Save(MemoryStream stream) + { + // Jpeg loses data, so we don't want to use it to serialize... + ImageFormat dest = RawFormat; + if (dest == ImageFormat.Jpeg) + { + dest = ImageFormat.Png; + } + ImageCodecInfo codec = dest.FindEncoder(); + + // If we don't find an Encoder (for things like Icon), we + // just switch back to PNG... + if (codec == null) + { + codec = ImageFormat.Png.FindEncoder(); + } + Save(stream, codec, null); + } + + /// + /// Saves this to the specified stream in the specified format. + /// + public void Save(Stream stream, ImageFormat format) + { + if (format == null) + throw new ArgumentNullException("format"); + + ImageCodecInfo codec = format.FindEncoder(); + Save(stream, codec, null); + } + + /// + /// Saves this to the specified stream in the specified format. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] + public void Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) + { + if (stream == null) + { + throw new ArgumentNullException("stream"); + } + if (encoder == null) + { + throw new ArgumentNullException("encoder"); + } + + IntPtr encoderParamsMemory = IntPtr.Zero; + + if (encoderParams != null) + { + _rawData = null; + encoderParamsMemory = encoderParams.ConvertToMemory(); + } + + int status = SafeNativeMethods.Gdip.Ok; + + try + { + Guid g = encoder.Clsid; + bool saved = false; + + if (_rawData != null) + { + ImageCodecInfo rawEncoder = RawFormat.FindEncoder(); + if (rawEncoder != null && rawEncoder.Clsid == g) + { + stream.Write(_rawData, 0, _rawData.Length); + saved = true; + } + } + + if (!saved) + { + status = SafeNativeMethods.Gdip.GdipSaveImageToStream(new HandleRef(this, nativeImage), + new UnsafeNativeMethods.ComStreamFromDataStream(stream), + ref g, + new HandleRef(encoderParams, encoderParamsMemory)); + } + } + finally + { + if (encoderParamsMemory != IntPtr.Zero) + { + Marshal.FreeHGlobal(encoderParamsMemory); + } + } + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + /// + /// Adds an to this . + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] + public void SaveAdd(EncoderParameters encoderParams) + { + IntPtr encoder = IntPtr.Zero; + if (encoderParams != null) + { + encoder = encoderParams.ConvertToMemory(); + } + + _rawData = null; + int status = SafeNativeMethods.Gdip.GdipSaveAdd(new HandleRef(this, nativeImage), new HandleRef(encoderParams, encoder)); + + if (encoder != IntPtr.Zero) + { + Marshal.FreeHGlobal(encoder); + } + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + /// + /// Adds an to the specified . + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] + public void SaveAdd(Image image, EncoderParameters encoderParams) + { + IntPtr encoder = IntPtr.Zero; + + if (image == null) + { + throw new ArgumentNullException("image"); + } + if (encoderParams != null) + { + encoder = encoderParams.ConvertToMemory(); + } + + _rawData = null; + int status = SafeNativeMethods.Gdip.GdipSaveAddImage(new HandleRef(this, nativeImage), new HandleRef(image, image.nativeImage), new HandleRef(encoderParams, encoder)); + + if (encoder != IntPtr.Zero) + { + Marshal.FreeHGlobal(encoder); + } + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + private SizeF _GetPhysicalDimension() + { + float width; + float height; + + int status = SafeNativeMethods.Gdip.GdipGetImageDimension(new HandleRef(this, nativeImage), out width, out height); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return new SizeF(width, height); + } + + /// + /// Gets the width and height of this . + /// + public SizeF PhysicalDimension + { + get { return _GetPhysicalDimension(); } + } + + /// + /// Gets the width and height of this . + /// + public Size Size + { + get + { + return new Size(Width, Height); + } + } + + /// + /// Gets the width of this . + /// + [ + DefaultValue(false), + Browsable(false), + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) + ] + public int Width + { + get + { + int width; + + int status = SafeNativeMethods.Gdip.GdipGetImageWidth(new HandleRef(this, nativeImage), out width); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return width; + } + } + + /// + /// Gets the height of this . + /// + [ + DefaultValue(false), + Browsable(false), + DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) + ] + public int Height + { + get + { + int height; + + int status = SafeNativeMethods.Gdip.GdipGetImageHeight(new HandleRef(this, nativeImage), out height); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return height; + } + } + + /// + /// Gets the horizontal resolution, in pixels-per-inch, of this . + /// + public float HorizontalResolution + { + get + { + float horzRes; + + int status = SafeNativeMethods.Gdip.GdipGetImageHorizontalResolution(new HandleRef(this, nativeImage), out horzRes); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return horzRes; + } + } + + /// + /// Gets the vertical resolution, in pixels-per-inch, of this . + /// + public float VerticalResolution + { + get + { + float vertRes; + + int status = SafeNativeMethods.Gdip.GdipGetImageVerticalResolution(new HandleRef(this, nativeImage), out vertRes); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return vertRes; + } + } + + /// + /// Gets attribute flags for this . + /// + [Browsable(false)] + public int Flags + { + get + { + int flags; + + int status = SafeNativeMethods.Gdip.GdipGetImageFlags(new HandleRef(this, nativeImage), out flags); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return flags; + } + } + + /// + /// Gets the format of this . + /// + public ImageFormat RawFormat + { + get + { + Guid guid = new Guid(); + + int status = SafeNativeMethods.Gdip.GdipGetImageRawFormat(new HandleRef(this, nativeImage), ref guid); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + + return new ImageFormat(guid); + } + } + + /// + /// Gets the pixel format for this . + /// + public PixelFormat PixelFormat + { + get + { + int format; + + int status = SafeNativeMethods.Gdip.GdipGetImagePixelFormat(new HandleRef(this, nativeImage), out format); + + if (status != SafeNativeMethods.Gdip.Ok) + return PixelFormat.Undefined; + else + return (PixelFormat)format; + } + } + + /// + /// Gets a bounding rectangle in the specified units for this . + /// + public RectangleF GetBounds(ref GraphicsUnit pageUnit) + { + GPRECTF gprectf = new GPRECTF(); + + int status = SafeNativeMethods.Gdip.GdipGetImageBounds(new HandleRef(this, nativeImage), ref gprectf, out pageUnit); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return gprectf.ToRectangleF(); + } + + private ColorPalette _GetColorPalette() + { + int size = -1; + + int status = SafeNativeMethods.Gdip.GdipGetImagePaletteSize(new HandleRef(this, nativeImage), out size); + // "size" is total byte size: + // sizeof(ColorPalette) + (pal->Count-1)*sizeof(ARGB) + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + ColorPalette palette = new ColorPalette(size); + + // Memory layout is: + // UINT Flags + // UINT Count + // ARGB Entries[size] + + IntPtr memory = Marshal.AllocHGlobal(size); + try + { + status = SafeNativeMethods.Gdip.GdipGetImagePalette(new HandleRef(this, nativeImage), memory, size); + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + palette.ConvertFromMemory(memory); + } + finally + { + Marshal.FreeHGlobal(memory); + } + + return palette; + } + + private void _SetColorPalette(ColorPalette palette) + { + IntPtr memory = palette.ConvertToMemory(); + + int status = SafeNativeMethods.Gdip.GdipSetImagePalette(new HandleRef(this, nativeImage), memory); + + if (memory != IntPtr.Zero) + { + Marshal.FreeHGlobal(memory); + } + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + /// + /// Gets or sets the color palette used for this . + /// + [Browsable(false)] + public ColorPalette Palette + { + get + { + return _GetColorPalette(); + } + set + { + _SetColorPalette(value); + } + } + + // Thumbnail support + + /// + /// Returns the thumbnail for this . + /// + public Image GetThumbnailImage(int thumbWidth, int thumbHeight, + GetThumbnailImageAbort callback, IntPtr callbackData) + { + IntPtr thumbImage = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipGetImageThumbnail(new HandleRef(this, nativeImage), thumbWidth, thumbHeight, out thumbImage, + callback, callbackData); + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return CreateImageObject(thumbImage); + } + + // Multi-frame support + + /// + /// Gets an array of GUIDs that represent the dimensions of frames within this . + /// + [Browsable(false)] + public Guid[] FrameDimensionsList + { + get + { + int count; + + int status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsCount(new HandleRef(this, nativeImage), out count); + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + Debug.Assert(count >= 0, "FrameDimensionsList returns bad count"); + if (count <= 0) + { + return new Guid[0]; + } + + int size = (int)Marshal.SizeOf(typeof(Guid)); + + IntPtr buffer = Marshal.AllocHGlobal(checked(size * count)); + if (buffer == IntPtr.Zero) + { + throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory); + } + + status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsList(new HandleRef(this, nativeImage), buffer, count); + + if (status != SafeNativeMethods.Gdip.Ok) + { + Marshal.FreeHGlobal(buffer); + throw SafeNativeMethods.Gdip.StatusException(status); + } + + Guid[] guids = new Guid[count]; + + try + { + for (int i = 0; i < count; i++) + { + guids[i] = (Guid)Marshal.PtrToStructure((IntPtr)((long)buffer + size * i), typeof(Guid)); + } + } + finally + { + Marshal.FreeHGlobal(buffer); + } + + return guids; + } + } + + /// + /// Returns the number of frames of the given dimension. + /// + public int GetFrameCount(FrameDimension dimension) + { + int[] count = new int[] { 0 }; + + Guid dimensionID = dimension.Guid; + int status = SafeNativeMethods.Gdip.GdipImageGetFrameCount(new HandleRef(this, nativeImage), ref dimensionID, count); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return count[0]; + } + + /// + /// Selects the frame specified by the given dimension and index. + /// + public int SelectActiveFrame(FrameDimension dimension, int frameIndex) + { + int[] count = new int[] { 0 }; + + Guid dimensionID = dimension.Guid; + int status = SafeNativeMethods.Gdip.GdipImageSelectActiveFrame(new HandleRef(this, nativeImage), ref dimensionID, frameIndex); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return count[0]; + } + + public void RotateFlip(RotateFlipType rotateFlipType) + { + int status = SafeNativeMethods.Gdip.GdipImageRotateFlip(new HandleRef(this, nativeImage), unchecked((int)rotateFlipType)); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + } + + /// + /// Gets an array of the property IDs stored in this . + /// + [Browsable(false)] + public int[] PropertyIdList + { + get + { + int count; + + int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(new HandleRef(this, nativeImage), out count); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + int[] propid = new int[count]; + + //if we have a 0 count, just return our empty array + if (count == 0) + return propid; + + status = SafeNativeMethods.Gdip.GdipGetPropertyIdList(new HandleRef(this, nativeImage), count, propid); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return propid; + } + } + + /// + /// Gets the specified property item from this . + /// + public PropertyItem GetPropertyItem(int propid) + { + PropertyItem propitem; + int size; + + int status = SafeNativeMethods.Gdip.GdipGetPropertyItemSize(new HandleRef(this, nativeImage), propid, out size); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + if (size == 0) + return null; + + IntPtr propdata = Marshal.AllocHGlobal(size); + + if (propdata == IntPtr.Zero) + throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory); + + try + { + status = SafeNativeMethods.Gdip.GdipGetPropertyItem(new HandleRef(this, nativeImage), propid, size, propdata); + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + propitem = PropertyItemInternal.ConvertFromMemory(propdata, 1)[0]; + } + finally + { + Marshal.FreeHGlobal(propdata); + } + + return propitem; + } + + /// + /// Removes the specified property item from this . + /// + public void RemovePropertyItem(int propid) + { + int status = SafeNativeMethods.Gdip.GdipRemovePropertyItem(new HandleRef(this, nativeImage), propid); + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + } + + /// + /// Sets the specified property item to the specified value. + /// + public void SetPropertyItem(PropertyItem propitem) + { + PropertyItemInternal propItemInternal = PropertyItemInternal.ConvertFromPropertyItem(propitem); + + using (propItemInternal) + { + int status = SafeNativeMethods.Gdip.GdipSetPropertyItem(new HandleRef(this, nativeImage), propItemInternal); + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + } + } + + /// + /// Gets an array of objects that describe this . + /// + [Browsable(false)] + public PropertyItem[] PropertyItems + { + get + { + int size; + int count; + + int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(new HandleRef(this, nativeImage), out count); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + status = SafeNativeMethods.Gdip.GdipGetPropertySize(new HandleRef(this, nativeImage), out size, ref count); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + if (size == 0 || count == 0) + return new PropertyItem[0]; + + IntPtr propdata = Marshal.AllocHGlobal(size); + try + { + status = SafeNativeMethods.Gdip.GdipGetAllPropertyItems(new HandleRef(this, nativeImage), size, count, propdata); + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + return PropertyItemInternal.ConvertFromMemory(propdata, count); + } + finally + { + Marshal.FreeHGlobal(propdata); + } + } + } + + internal void SetNativeImage(IntPtr handle) + { + if (handle == IntPtr.Zero) + throw new ArgumentException(SR.Format(SR.NativeHandle0), "handle"); + + nativeImage = handle; + } + + /// + /// Creates a from a Windows handle. + /// + public static Bitmap FromHbitmap(IntPtr hbitmap) + { + return FromHbitmap(hbitmap, IntPtr.Zero); + } + + /// + /// Creates a from the specified Windows handle with the specified color palette. + /// + public static Bitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette) + { + IntPtr bitmap = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromHBITMAP(new HandleRef(null, hbitmap), new HandleRef(null, hpalette), out bitmap); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return Bitmap.FromGDIplus(bitmap); + } + + /// + /// Returns the size of the specified pixel format. + /// + public static int GetPixelFormatSize(PixelFormat pixfmt) + { + return (unchecked((int)pixfmt) >> 8) & 0xFF; + } + + /// + /// Returns a value indicating whether the pixel format contains alpha information. + /// + public static bool IsAlphaPixelFormat(PixelFormat pixfmt) + { + return (pixfmt & PixelFormat.Alpha) != 0; + } + + /// + /// Returns a value indicating whether the pixel format is extended. + /// + public static bool IsExtendedPixelFormat(PixelFormat pixfmt) + { + return (pixfmt & PixelFormat.Extended) != 0; + } + + /* + * Determine if the pixel format is canonical format: + * PixelFormat32bppARGB + * PixelFormat32bppPARGB + * PixelFormat64bppARGB + * PixelFormat64bppPARGB + */ + /// + /// Returns a value indicating whether the pixel format is canonical. + /// + public static bool IsCanonicalPixelFormat(PixelFormat pixfmt) + { + return (pixfmt & PixelFormat.Canonical) != 0; + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.cs deleted file mode 100644 index 450e474fba..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Image.cs +++ /dev/null @@ -1,1242 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing.Imaging; -using System.Drawing.Internal; -using System.Globalization; -using System.IO; -using System.Runtime.InteropServices; - -namespace System.Drawing -{ - /// - /// An abstract base class that provides functionality for 'Bitmap', 'Icon', 'Cursor', and 'Metafile' descended classes. - /// - [ImmutableObject(true)] - [ComVisible(true)] - public abstract partial class Image : MarshalByRefObject, ICloneable, IDisposable - { -#if FINALIZATION_WATCH - private string allocationSite = Graphics.GetAllocationStack(); -#endif - - // The signature of this delegate is incorrect. The signature of the corresponding - // native callback function is: - // extern "C" { - // typedef BOOL (CALLBACK * ImageAbort)(VOID *); - // typedef ImageAbort DrawImageAbort; - // typedef ImageAbort GetThumbnailImageAbort; - // } - // However, as this delegate is not used in both GDI 1.0 and 1.1, we choose not - // to modify it, in order to preserve compatibility. - public delegate bool GetThumbnailImageAbort(); - - internal IntPtr nativeImage; - - // used to work around lack of animated gif encoder... rarely set... - private byte[] _rawData; - - //userData : so that user can use TAGS with IMAGES.. - private object _userData; - - internal Image() - { - } - - [ - Localizable(false), - DefaultValue(null), - ] - public object Tag - { - get - { - return _userData; - } - set - { - _userData = value; - } - } - - /// - /// Creates an from the specified file. - /// - public static Image FromFile(string filename) => FromFile(filename, false); - - public static Image FromFile(string filename, bool useEmbeddedColorManagement) - { - if (!File.Exists(filename)) - { - // Throw a more specific exception for invalid paths that are null or empty, - // contain invalid characters or are too long. - filename = Path.GetFullPath(filename); - throw new FileNotFoundException(filename); - } - - // GDI+ will read this file multiple times. Get the fully qualified path - // so if our app changes default directory we won't get an error - filename = Path.GetFullPath(filename); - - IntPtr image = IntPtr.Zero; - int status; - - if (useEmbeddedColorManagement) - { - status = SafeNativeMethods.Gdip.GdipLoadImageFromFileICM(filename, out image); - } - else - { - status = SafeNativeMethods.Gdip.GdipLoadImageFromFile(filename, out image); - } - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image)); - - if (status != SafeNativeMethods.Gdip.Ok) - { - SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image)); - throw SafeNativeMethods.Gdip.StatusException(status); - } - - Image img = CreateImageObject(image); - - EnsureSave(img, filename, null); - - return img; - } - - - /// - /// Creates an from the specified data stream. - /// - public static Image FromStream(Stream stream) - { - return Image.FromStream(stream, false); - } - - public static Image FromStream(Stream stream, - bool useEmbeddedColorManagement) - { - return FromStream(stream, useEmbeddedColorManagement, true); - } - - public static Image FromStream(Stream stream, bool useEmbeddedColorManagement, bool validateImageData) - { - if (stream == null) - { - throw new ArgumentNullException(nameof(stream)); - } - - IntPtr image = IntPtr.Zero; - int status; - - if (useEmbeddedColorManagement) - { - status = SafeNativeMethods.Gdip.GdipLoadImageFromStreamICM(new GPStream(stream), out image); - } - else - { - status = SafeNativeMethods.Gdip.GdipLoadImageFromStream(new GPStream(stream), out image); - } - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - if (validateImageData) - { - status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image)); - - if (status != SafeNativeMethods.Gdip.Ok) - { - SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image)); - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - Image img = CreateImageObject(image); - - EnsureSave(img, null, stream); - - return img; - } - - // Used for serialization - private void InitializeFromStream(Stream stream) - { - IntPtr image = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipLoadImageFromStream(new GPStream(stream), out image); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, image)); - - if (status != SafeNativeMethods.Gdip.Ok) - { - SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, image)); - throw SafeNativeMethods.Gdip.StatusException(status); - } - - nativeImage = image; - - int type = -1; - - status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(this, nativeImage), out type); - - EnsureSave(this, null, stream); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - } - - internal Image(IntPtr nativeImage) - { - SetNativeImage(nativeImage); - } - - /// - /// Creates an exact copy of this . - /// - public object Clone() - { - IntPtr cloneImage = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipCloneImage(new HandleRef(this, nativeImage), out cloneImage); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - status = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, cloneImage)); - - if (status != SafeNativeMethods.Gdip.Ok) - { - SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, cloneImage)); - throw SafeNativeMethods.Gdip.StatusException(status); - } - - return CreateImageObject(cloneImage); - } - - /// - /// Cleans up Windows resources for this . - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { -#if FINALIZATION_WATCH - if (!disposing && nativeImage != IntPtr.Zero) - Debug.WriteLine("**********************\nDisposed through finalization:\n" + allocationSite); -#endif - if (nativeImage != IntPtr.Zero) - { - try - { -#if DEBUG - int status = -#endif - SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(this, nativeImage)); -#if DEBUG - Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture)); -#endif - } - catch (Exception ex) - { - if (ClientUtils.IsSecurityOrCriticalException(ex)) - { - throw; - } - - Debug.Fail("Exception thrown during Dispose: " + ex.ToString()); - } - finally - { - nativeImage = IntPtr.Zero; - } - } - } - - /// - /// Cleans up Windows resources for this . - /// - ~Image() - { - Dispose(false); - } - - internal static void EnsureSave(Image image, string filename, Stream dataStream) - { - if (image.RawFormat.Equals(ImageFormat.Gif)) - { - bool animatedGif = false; - - Guid[] dimensions = image.FrameDimensionsList; - foreach (Guid guid in dimensions) - { - FrameDimension dimension = new FrameDimension(guid); - if (dimension.Equals(FrameDimension.Time)) - { - animatedGif = image.GetFrameCount(FrameDimension.Time) > 1; - break; - } - } - - - if (animatedGif) - { - try - { - Stream created = null; - long lastPos = 0; - if (dataStream != null) - { - lastPos = dataStream.Position; - dataStream.Position = 0; - } - - try - { - if (dataStream == null) - { - created = dataStream = File.OpenRead(filename); - } - - image._rawData = new byte[(int)dataStream.Length]; - dataStream.Read(image._rawData, 0, (int)dataStream.Length); - } - finally - { - if (created != null) - { - created.Close(); - } - else - { - dataStream.Position = lastPos; - } - } - } - // possible exceptions for reading the filename - catch (UnauthorizedAccessException) - { - } - catch (DirectoryNotFoundException) - { - } - catch (IOException) - { - } - // possible exceptions for setting/getting the position inside dataStream - catch (NotSupportedException) - { - } - catch (ObjectDisposedException) - { - } - // possible exception when reading stuff into dataStream - catch (ArgumentException) - { - } - } - } - } - - private enum ImageTypeEnum - { - Bitmap = 1, - Metafile = 2, - } - - internal static Image CreateImageObject(IntPtr nativeImage) - { - Image image; - - int type = -1; - - int status = SafeNativeMethods.Gdip.GdipGetImageType(new HandleRef(null, nativeImage), out type); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - switch ((ImageTypeEnum)type) - { - case ImageTypeEnum.Bitmap: - image = Bitmap.FromGDIplus(nativeImage); - break; - - case ImageTypeEnum.Metafile: - image = Metafile.FromGDIplus(nativeImage); - break; - - default: - throw new ArgumentException(SR.Format(SR.InvalidImage)); - } - - return image; - } - - /// - /// Returns information about the codecs used for this . - /// - public EncoderParameters GetEncoderParameterList(Guid encoder) - { - EncoderParameters p; - int size; - - int status = SafeNativeMethods.Gdip.GdipGetEncoderParameterListSize(new HandleRef(this, nativeImage), - ref encoder, - out size); - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - if (size <= 0) - return null; - - IntPtr buffer = Marshal.AllocHGlobal(size); - try - { - status = SafeNativeMethods.Gdip.GdipGetEncoderParameterList(new HandleRef(this, nativeImage), - ref encoder, - size, - buffer); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - p = EncoderParameters.ConvertFromMemory(buffer); - } - finally - { - Marshal.FreeHGlobal(buffer); - } - - return p; - } - - /// - /// Saves this to the specified file. - /// - public void Save(string filename) - { - Save(filename, RawFormat); - } - - /// - /// Saves this to the specified file in the specified format. - /// - public void Save(string filename, ImageFormat format) - { - if (format == null) - throw new ArgumentNullException("format"); - - ImageCodecInfo codec = format.FindEncoder(); - - if (codec == null) - codec = ImageFormat.Png.FindEncoder(); - - Save(filename, codec, null); - } - - /// - /// Saves this to the specified file in the specified format and with the specified encoder parameters. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] - public void Save(string filename, ImageCodecInfo encoder, EncoderParameters encoderParams) - { - if (filename == null) - throw new ArgumentNullException("filename"); - if (encoder == null) - throw new ArgumentNullException("encoder"); - - IntPtr encoderParamsMemory = IntPtr.Zero; - - if (encoderParams != null) - { - _rawData = null; - encoderParamsMemory = encoderParams.ConvertToMemory(); - } - int status = SafeNativeMethods.Gdip.Ok; - - try - { - Guid g = encoder.Clsid; - bool saved = false; - - if (_rawData != null) - { - ImageCodecInfo rawEncoder = RawFormat.FindEncoder(); - if (rawEncoder != null && rawEncoder.Clsid == g) - { - using (FileStream fs = File.OpenWrite(filename)) - { - fs.Write(_rawData, 0, _rawData.Length); - saved = true; - } - } - } - - if (!saved) - { - status = SafeNativeMethods.Gdip.GdipSaveImageToFile(new HandleRef(this, nativeImage), - filename, - ref g, - new HandleRef(encoderParams, encoderParamsMemory)); - } - } - finally - { - if (encoderParamsMemory != IntPtr.Zero) - { - Marshal.FreeHGlobal(encoderParamsMemory); - } - } - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - internal void Save(MemoryStream stream) - { - // Jpeg loses data, so we don't want to use it to serialize... - ImageFormat dest = RawFormat; - if (dest == ImageFormat.Jpeg) - { - dest = ImageFormat.Png; - } - ImageCodecInfo codec = dest.FindEncoder(); - - // If we don't find an Encoder (for things like Icon), we - // just switch back to PNG... - if (codec == null) - { - codec = ImageFormat.Png.FindEncoder(); - } - Save(stream, codec, null); - } - - /// - /// Saves this to the specified stream in the specified format. - /// - public void Save(Stream stream, ImageFormat format) - { - if (format == null) - throw new ArgumentNullException("format"); - - ImageCodecInfo codec = format.FindEncoder(); - Save(stream, codec, null); - } - - /// - /// Saves this to the specified stream in the specified format. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] - public void Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (encoder == null) - { - throw new ArgumentNullException("encoder"); - } - - IntPtr encoderParamsMemory = IntPtr.Zero; - - if (encoderParams != null) - { - _rawData = null; - encoderParamsMemory = encoderParams.ConvertToMemory(); - } - - int status = SafeNativeMethods.Gdip.Ok; - - try - { - Guid g = encoder.Clsid; - bool saved = false; - - if (_rawData != null) - { - ImageCodecInfo rawEncoder = RawFormat.FindEncoder(); - if (rawEncoder != null && rawEncoder.Clsid == g) - { - stream.Write(_rawData, 0, _rawData.Length); - saved = true; - } - } - - if (!saved) - { - status = SafeNativeMethods.Gdip.GdipSaveImageToStream(new HandleRef(this, nativeImage), - new UnsafeNativeMethods.ComStreamFromDataStream(stream), - ref g, - new HandleRef(encoderParams, encoderParamsMemory)); - } - } - finally - { - if (encoderParamsMemory != IntPtr.Zero) - { - Marshal.FreeHGlobal(encoderParamsMemory); - } - } - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - /// - /// Adds an to this . - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] - public void SaveAdd(EncoderParameters encoderParams) - { - IntPtr encoder = IntPtr.Zero; - if (encoderParams != null) - { - encoder = encoderParams.ConvertToMemory(); - } - - _rawData = null; - int status = SafeNativeMethods.Gdip.GdipSaveAdd(new HandleRef(this, nativeImage), new HandleRef(encoderParams, encoder)); - - if (encoder != IntPtr.Zero) - { - Marshal.FreeHGlobal(encoder); - } - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - /// - /// Adds an to the specified . - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] - public void SaveAdd(Image image, EncoderParameters encoderParams) - { - IntPtr encoder = IntPtr.Zero; - - if (image == null) - { - throw new ArgumentNullException("image"); - } - if (encoderParams != null) - { - encoder = encoderParams.ConvertToMemory(); - } - - _rawData = null; - int status = SafeNativeMethods.Gdip.GdipSaveAddImage(new HandleRef(this, nativeImage), new HandleRef(image, image.nativeImage), new HandleRef(encoderParams, encoder)); - - if (encoder != IntPtr.Zero) - { - Marshal.FreeHGlobal(encoder); - } - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - private SizeF _GetPhysicalDimension() - { - float width; - float height; - - int status = SafeNativeMethods.Gdip.GdipGetImageDimension(new HandleRef(this, nativeImage), out width, out height); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return new SizeF(width, height); - } - - /// - /// Gets the width and height of this . - /// - public SizeF PhysicalDimension - { - get { return _GetPhysicalDimension(); } - } - - /// - /// Gets the width and height of this . - /// - public Size Size - { - get - { - return new Size(Width, Height); - } - } - - /// - /// Gets the width of this . - /// - [ - DefaultValue(false), - Browsable(false), - DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) - ] - public int Width - { - get - { - int width; - - int status = SafeNativeMethods.Gdip.GdipGetImageWidth(new HandleRef(this, nativeImage), out width); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return width; - } - } - - /// - /// Gets the height of this . - /// - [ - DefaultValue(false), - Browsable(false), - DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) - ] - public int Height - { - get - { - int height; - - int status = SafeNativeMethods.Gdip.GdipGetImageHeight(new HandleRef(this, nativeImage), out height); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return height; - } - } - - /// - /// Gets the horizontal resolution, in pixels-per-inch, of this . - /// - public float HorizontalResolution - { - get - { - float horzRes; - - int status = SafeNativeMethods.Gdip.GdipGetImageHorizontalResolution(new HandleRef(this, nativeImage), out horzRes); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return horzRes; - } - } - - /// - /// Gets the vertical resolution, in pixels-per-inch, of this . - /// - public float VerticalResolution - { - get - { - float vertRes; - - int status = SafeNativeMethods.Gdip.GdipGetImageVerticalResolution(new HandleRef(this, nativeImage), out vertRes); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return vertRes; - } - } - - /// - /// Gets attribute flags for this . - /// - [Browsable(false)] - public int Flags - { - get - { - int flags; - - int status = SafeNativeMethods.Gdip.GdipGetImageFlags(new HandleRef(this, nativeImage), out flags); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return flags; - } - } - - /// - /// Gets the format of this . - /// - public ImageFormat RawFormat - { - get - { - Guid guid = new Guid(); - - int status = SafeNativeMethods.Gdip.GdipGetImageRawFormat(new HandleRef(this, nativeImage), ref guid); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - - return new ImageFormat(guid); - } - } - - /// - /// Gets the pixel format for this . - /// - public PixelFormat PixelFormat - { - get - { - int format; - - int status = SafeNativeMethods.Gdip.GdipGetImagePixelFormat(new HandleRef(this, nativeImage), out format); - - if (status != SafeNativeMethods.Gdip.Ok) - return PixelFormat.Undefined; - else - return (PixelFormat)format; - } - } - - /// - /// Gets a bounding rectangle in the specified units for this . - /// - public RectangleF GetBounds(ref GraphicsUnit pageUnit) - { - GPRECTF gprectf = new GPRECTF(); - - int status = SafeNativeMethods.Gdip.GdipGetImageBounds(new HandleRef(this, nativeImage), ref gprectf, out pageUnit); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return gprectf.ToRectangleF(); - } - - private ColorPalette _GetColorPalette() - { - int size = -1; - - int status = SafeNativeMethods.Gdip.GdipGetImagePaletteSize(new HandleRef(this, nativeImage), out size); - // "size" is total byte size: - // sizeof(ColorPalette) + (pal->Count-1)*sizeof(ARGB) - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - ColorPalette palette = new ColorPalette(size); - - // Memory layout is: - // UINT Flags - // UINT Count - // ARGB Entries[size] - - IntPtr memory = Marshal.AllocHGlobal(size); - try - { - status = SafeNativeMethods.Gdip.GdipGetImagePalette(new HandleRef(this, nativeImage), memory, size); - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - palette.ConvertFromMemory(memory); - } - finally - { - Marshal.FreeHGlobal(memory); - } - - return palette; - } - - private void _SetColorPalette(ColorPalette palette) - { - IntPtr memory = palette.ConvertToMemory(); - - int status = SafeNativeMethods.Gdip.GdipSetImagePalette(new HandleRef(this, nativeImage), memory); - - if (memory != IntPtr.Zero) - { - Marshal.FreeHGlobal(memory); - } - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - /// - /// Gets or sets the color palette used for this . - /// - [Browsable(false)] - public ColorPalette Palette - { - get - { - return _GetColorPalette(); - } - set - { - _SetColorPalette(value); - } - } - - // Thumbnail support - - /// - /// Returns the thumbnail for this . - /// - public Image GetThumbnailImage(int thumbWidth, int thumbHeight, - GetThumbnailImageAbort callback, IntPtr callbackData) - { - IntPtr thumbImage = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipGetImageThumbnail(new HandleRef(this, nativeImage), thumbWidth, thumbHeight, out thumbImage, - callback, callbackData); - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return CreateImageObject(thumbImage); - } - - // Multi-frame support - - /// - /// Gets an array of GUIDs that represent the dimensions of frames within this . - /// - [Browsable(false)] - public Guid[] FrameDimensionsList - { - get - { - int count; - - int status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsCount(new HandleRef(this, nativeImage), out count); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - Debug.Assert(count >= 0, "FrameDimensionsList returns bad count"); - if (count <= 0) - { - return new Guid[0]; - } - - int size = (int)Marshal.SizeOf(typeof(Guid)); - - IntPtr buffer = Marshal.AllocHGlobal(checked(size * count)); - if (buffer == IntPtr.Zero) - { - throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory); - } - - status = SafeNativeMethods.Gdip.GdipImageGetFrameDimensionsList(new HandleRef(this, nativeImage), buffer, count); - - if (status != SafeNativeMethods.Gdip.Ok) - { - Marshal.FreeHGlobal(buffer); - throw SafeNativeMethods.Gdip.StatusException(status); - } - - Guid[] guids = new Guid[count]; - - try - { - for (int i = 0; i < count; i++) - { - guids[i] = (Guid)Marshal.PtrToStructure((IntPtr)((long)buffer + size * i), typeof(Guid)); - } - } - finally - { - Marshal.FreeHGlobal(buffer); - } - - return guids; - } - } - - /// - /// Returns the number of frames of the given dimension. - /// - public int GetFrameCount(FrameDimension dimension) - { - int[] count = new int[] { 0 }; - - Guid dimensionID = dimension.Guid; - int status = SafeNativeMethods.Gdip.GdipImageGetFrameCount(new HandleRef(this, nativeImage), ref dimensionID, count); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return count[0]; - } - - /// - /// Selects the frame specified by the given dimension and index. - /// - public int SelectActiveFrame(FrameDimension dimension, int frameIndex) - { - int[] count = new int[] { 0 }; - - Guid dimensionID = dimension.Guid; - int status = SafeNativeMethods.Gdip.GdipImageSelectActiveFrame(new HandleRef(this, nativeImage), ref dimensionID, frameIndex); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return count[0]; - } - - public void RotateFlip(RotateFlipType rotateFlipType) - { - int status = SafeNativeMethods.Gdip.GdipImageRotateFlip(new HandleRef(this, nativeImage), unchecked((int)rotateFlipType)); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - } - - /// - /// Gets an array of the property IDs stored in this . - /// - [Browsable(false)] - public int[] PropertyIdList - { - get - { - int count; - - int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(new HandleRef(this, nativeImage), out count); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - int[] propid = new int[count]; - - //if we have a 0 count, just return our empty array - if (count == 0) - return propid; - - status = SafeNativeMethods.Gdip.GdipGetPropertyIdList(new HandleRef(this, nativeImage), count, propid); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return propid; - } - } - - /// - /// Gets the specified property item from this . - /// - public PropertyItem GetPropertyItem(int propid) - { - PropertyItem propitem; - int size; - - int status = SafeNativeMethods.Gdip.GdipGetPropertyItemSize(new HandleRef(this, nativeImage), propid, out size); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - if (size == 0) - return null; - - IntPtr propdata = Marshal.AllocHGlobal(size); - - if (propdata == IntPtr.Zero) - throw SafeNativeMethods.Gdip.StatusException(SafeNativeMethods.Gdip.OutOfMemory); - - try - { - status = SafeNativeMethods.Gdip.GdipGetPropertyItem(new HandleRef(this, nativeImage), propid, size, propdata); - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - propitem = PropertyItemInternal.ConvertFromMemory(propdata, 1)[0]; - } - finally - { - Marshal.FreeHGlobal(propdata); - } - - return propitem; - } - - /// - /// Removes the specified property item from this . - /// - public void RemovePropertyItem(int propid) - { - int status = SafeNativeMethods.Gdip.GdipRemovePropertyItem(new HandleRef(this, nativeImage), propid); - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - } - - /// - /// Sets the specified property item to the specified value. - /// - public void SetPropertyItem(PropertyItem propitem) - { - PropertyItemInternal propItemInternal = PropertyItemInternal.ConvertFromPropertyItem(propitem); - - using (propItemInternal) - { - int status = SafeNativeMethods.Gdip.GdipSetPropertyItem(new HandleRef(this, nativeImage), propItemInternal); - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - } - } - - /// - /// Gets an array of objects that describe this . - /// - [Browsable(false)] - public PropertyItem[] PropertyItems - { - get - { - int size; - int count; - - int status = SafeNativeMethods.Gdip.GdipGetPropertyCount(new HandleRef(this, nativeImage), out count); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - status = SafeNativeMethods.Gdip.GdipGetPropertySize(new HandleRef(this, nativeImage), out size, ref count); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - if (size == 0 || count == 0) - return new PropertyItem[0]; - - IntPtr propdata = Marshal.AllocHGlobal(size); - try - { - status = SafeNativeMethods.Gdip.GdipGetAllPropertyItems(new HandleRef(this, nativeImage), size, count, propdata); - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - return PropertyItemInternal.ConvertFromMemory(propdata, count); - } - finally - { - Marshal.FreeHGlobal(propdata); - } - } - } - - internal void SetNativeImage(IntPtr handle) - { - if (handle == IntPtr.Zero) - throw new ArgumentException(SR.Format(SR.NativeHandle0), "handle"); - - nativeImage = handle; - } - - /// - /// Creates a from a Windows handle. - /// - public static Bitmap FromHbitmap(IntPtr hbitmap) - { - return FromHbitmap(hbitmap, IntPtr.Zero); - } - - /// - /// Creates a from the specified Windows handle with the specified color palette. - /// - public static Bitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette) - { - IntPtr bitmap = IntPtr.Zero; - int status = SafeNativeMethods.Gdip.GdipCreateBitmapFromHBITMAP(new HandleRef(null, hbitmap), new HandleRef(null, hpalette), out bitmap); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return Bitmap.FromGDIplus(bitmap); - } - - /// - /// Returns the size of the specified pixel format. - /// - public static int GetPixelFormatSize(PixelFormat pixfmt) - { - return (unchecked((int)pixfmt) >> 8) & 0xFF; - } - - /// - /// Returns a value indicating whether the pixel format contains alpha information. - /// - public static bool IsAlphaPixelFormat(PixelFormat pixfmt) - { - return (pixfmt & PixelFormat.Alpha) != 0; - } - - /// - /// Returns a value indicating whether the pixel format is extended. - /// - public static bool IsExtendedPixelFormat(PixelFormat pixfmt) - { - return (pixfmt & PixelFormat.Extended) != 0; - } - - /* - * Determine if the pixel format is canonical format: - * PixelFormat32bppARGB - * PixelFormat32bppPARGB - * PixelFormat64bppARGB - * PixelFormat64bppPARGB - */ - /// - /// Returns a value indicating whether the pixel format is canonical. - /// - public static bool IsCanonicalPixelFormat(PixelFormat pixfmt) - { - return (pixfmt & PixelFormat.Canonical) != 0; - } - } -} - diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.Unix.cs new file mode 100644 index 0000000000..5757c7510f --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.Unix.cs @@ -0,0 +1,197 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.ImageAnimator.cs +// +// Authors: +// Dennis Hayes (dennish@Raytek.com) +// Sanjay Gupta (gsanjay@novell.com) +// Sebastien Pouliot +// +// (C) 2002 Ximian, Inc +// Copyright (C) 2004,2006-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.Collections; +using System.Drawing.Imaging; +using System.Threading; + +namespace System.Drawing +{ + + class AnimateEventArgs : EventArgs + { + + private int frameCount; + private int activeFrame; + private Thread thread; + + public AnimateEventArgs(Image image) + { + frameCount = image.GetFrameCount(FrameDimension.Time); + } + + public Thread RunThread + { + get { return thread; } + set { thread = value; } + } + + public int GetNextFrame() + { + if (activeFrame < frameCount - 1) + activeFrame++; + else + activeFrame = 0; + + return activeFrame; + } + } + + public sealed class ImageAnimator + { + + static Hashtable ht = Hashtable.Synchronized(new Hashtable()); + + private ImageAnimator() + { + } + + public static void Animate(Image image, EventHandler onFrameChangedHandler) + { + // must be non-null and contain animation time frames + if (!CanAnimate(image)) + return; + + // is animation already in progress ? + if (ht.ContainsKey(image)) + return; + + PropertyItem item = image.GetPropertyItem(0x5100); // FrameDelay in libgdiplus + byte[] value = item.Value; + int[] delay = new int[(value.Length >> 2)]; + for (int i = 0, n = 0; i < value.Length; i += 4, n++) + { + int d = BitConverter.ToInt32(value, i) * 10; + // follow worse case (Opera) see http://news.deviantart.com/article/27613/ + delay[n] = d < 100 ? 100 : d; + } + + AnimateEventArgs aea = new AnimateEventArgs(image); + WorkerThread wt = new WorkerThread(onFrameChangedHandler, aea, delay); + Thread thread = new Thread(new ThreadStart(wt.LoopHandler)); + thread.IsBackground = true; + aea.RunThread = thread; + ht.Add(image, aea); + thread.Start(); + } + + public static bool CanAnimate(Image image) + { + if (image == null) + return false; + + int n = image.FrameDimensionsList.Length; + if (n < 1) + return false; + + for (int i = 0; i < n; i++) + { + if (image.FrameDimensionsList[i].Equals(FrameDimension.Time.Guid)) + { + return (image.GetFrameCount(FrameDimension.Time) > 1); + } + } + return false; + } + + public static void StopAnimate(Image image, EventHandler onFrameChangedHandler) + { + if (image == null) + return; + + if (ht.ContainsKey(image)) + { + AnimateEventArgs evtArgs = (AnimateEventArgs)ht[image]; + evtArgs.RunThread.Abort(); + ht.Remove(image); + } + } + + public static void UpdateFrames() + { + foreach (Image image in ht.Keys) + UpdateImageFrame(image); + } + + + public static void UpdateFrames(Image image) + { + if (image == null) + return; + + if (ht.ContainsKey(image)) + UpdateImageFrame(image); + } + + // this method avoid checks that aren't requied for UpdateFrames() + private static void UpdateImageFrame(Image image) + { + AnimateEventArgs aea = (AnimateEventArgs)ht[image]; + image.SelectActiveFrame(FrameDimension.Time, aea.GetNextFrame()); + } + } + + class WorkerThread + { + + private EventHandler frameChangeHandler; + private AnimateEventArgs animateEventArgs; + private int[] delay; + + public WorkerThread(EventHandler frmChgHandler, AnimateEventArgs aniEvtArgs, int[] delay) + { + frameChangeHandler = frmChgHandler; + animateEventArgs = aniEvtArgs; + this.delay = delay; + } + + public void LoopHandler() + { + try + { + int n = 0; + while (true) + { + Thread.Sleep(delay[n++]); + frameChangeHandler(null, animateEventArgs); + if (n == delay.Length) + n = 0; + } + } + catch (ThreadAbortException) + { + Thread.ResetAbort(); // we're going to finish anyway + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.Windows.cs new file mode 100644 index 0000000000..6d5e3e4a89 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.Windows.cs @@ -0,0 +1,440 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Drawing +{ + using System.Collections.Generic; + using System.Diagnostics; + using System.Drawing.Imaging; + using System.Threading; + + /// + /// Animates one or more images that have time-based frames. + /// See the ImageInfo.cs file for the helper nested ImageInfo class. + /// + /// A common pattern for using this class is as follows (See PictureBox control): + /// 1. The winform app (user's code) calls ImageAnimator.Animate() from the main thread. + /// 2. Animate() spawns the animating (worker) thread in the background, which will update the image + /// frames and raise the OnFrameChanged event, which handler will be executed in the main thread. + /// 3. The main thread triggers a paint event (Invalidate()) from the OnFrameChanged handler. + /// 4. From the OnPaint event, the main thread calls ImageAnimator.UpdateFrames() and then paints the + /// image (updated frame). + /// 5. The main thread calls ImageAnimator.StopAnimate() when needed. This does not kill the worker thread. + /// + /// Comment on locking the image ref: + /// We need to synchronize access to sections of code that modify the image(s), but we don't want to block + /// animation of one image when modifying a different one; for this, we use the image ref for locking the + /// critical section (lock(image)). + /// + /// This class is safe for multi-threading but Image is not; multithreaded applications must use a critical + /// section lock using the image ref the image access is not from the same thread that executes ImageAnimator + /// code. If the user code locks on the image ref forever a deadlock will happen preventing the animation + /// from occurring. + /// + public sealed partial class ImageAnimator + { + /// + /// A list of images to be animated. + /// + private static List s_imageInfoList; + + /// + /// A variable to flag when an image or images need to be updated due to the selection of a new frame + /// in an image. We don't need to synchronize access to this variable, in the case it is true we don't + /// do anything, otherwise the worse case is where a thread attempts to update the image's frame after + /// another one did which is harmless. + /// + private static bool s_anyFrameDirty; + + /// + /// The thread used for animating the images. + /// + private static Thread s_animationThread; + + /// + /// Lock that allows either concurrent read-access to the images list for multiple threads, or write- + /// access to it for a single thread. Observe that synchronization access to image objects are done + /// with critical sections (lock). + /// + private static ReaderWriterLock s_rwImgListLock = new ReaderWriterLock(); + + /// + /// Flag to avoid a deadlock when waiting on a write-lock and an attempt to acquire a read-lock is + /// made in the same thread. If RWLock is currently owned by another thread, the current thread is going to wait on an + /// event using CoWaitForMultipleHandles while pumps message. + /// The comment above refers to the COM STA message pump, not to be confused with the UI message pump. + /// However, the effect is the same, the COM message pump will pump messages and dispatch them to the + /// window while waiting on the writer lock; this has the potential of creating a re-entrancy situation + // that if during the message processing a wait on a reader lock is originated the thread will be block + // on itself. + /// While processing STA message, the thread may call back into managed code. We do this because + /// we can not block finalizer thread. Finalizer thread may need to release STA objects on this thread. If + /// the current thread does not pump message, finalizer thread is blocked, and AD unload is blocked while + /// waiting for finalizer thread. RWLock is a fair lock. If a thread waits for a writer lock, then it needs + /// a reader lock while pumping message, the thread is blocked forever. + /// This TLS variable is used to flag the above situation and avoid the deadlock, it is ThreadStatic so each + /// thread calling into ImageAnimator is guarded against this problem. + /// + + + + + [ThreadStatic] + private static int t_threadWriterLockWaitCount; + + /// + /// Prevent instantiation of this class. + /// + private ImageAnimator() + { + } + + /// + /// Advances the frame in the specified image. The new frame is drawn the next time the image is rendered. + /// + public static void UpdateFrames(Image image) + { + if (!s_anyFrameDirty || image == null || s_imageInfoList == null) + { + return; + } + + if (t_threadWriterLockWaitCount > 0) + { + // Cannot acquire reader lock - frame update will be missed. + return; + } + + // If the current thread already has the writer lock, no reader lock is acquired. Instead, the lock count on + // the writer lock is incremented. It it already has a reader lock, the locks ref count will be incremented + // w/o placing the request at the end of the reader queue. + + s_rwImgListLock.AcquireReaderLock(Timeout.Infinite); + + try + { + bool foundDirty = false; + bool foundImage = false; + + foreach (ImageInfo imageInfo in s_imageInfoList) + { + if (imageInfo.Image == image) + { + if (imageInfo.FrameDirty) + { + // See comment in the class header about locking the image ref. +#pragma warning disable CA2002 + lock (imageInfo.Image) + { +#pragma warning restore CA2002 + imageInfo.UpdateFrame(); + } + } + foundImage = true; + } + + if (imageInfo.FrameDirty) + { + foundDirty = true; + } + + if (foundDirty && foundImage) + { + break; + } + } + + s_anyFrameDirty = foundDirty; + } + finally + { + s_rwImgListLock.ReleaseReaderLock(); + } + } + + /// + /// Advances the frame in all images currently being animated. The new frame is drawn the next time the image is rendered. + /// + public static void UpdateFrames() + { + if (!s_anyFrameDirty || s_imageInfoList == null) + { + return; + } + if (t_threadWriterLockWaitCount > 0) + { + // Cannot acquire reader lock at this time, frames update will be missed. + return; + } + + s_rwImgListLock.AcquireReaderLock(Timeout.Infinite); + + try + { + foreach (ImageInfo imageInfo in s_imageInfoList) + { + // See comment in the class header about locking the image ref. +#pragma warning disable CA2002 + lock (imageInfo.Image) + { +#pragma warning restore CA2002 + imageInfo.UpdateFrame(); + } + } + s_anyFrameDirty = false; + } + finally + { + s_rwImgListLock.ReleaseReaderLock(); + } + } + + /// + /// Adds an image to the image manager. If the image does not support animation this method does nothing. + /// This method creates the image list and spawns the animation thread the first time it is called. + /// + public static void Animate(Image image, EventHandler onFrameChangedHandler) + { + if (image == null) + { + return; + } + + ImageInfo imageInfo = null; + + // See comment in the class header about locking the image ref. +#pragma warning disable CA2002 + lock (image) + { +#pragma warning restore CA2002 + // could we avoid creating an ImageInfo object if FrameCount == 1 ? + imageInfo = new ImageInfo(image); + } + + // If the image is already animating, stop animating it + StopAnimate(image, onFrameChangedHandler); + + // Acquire a writer lock to modify the image info list. If the thread has a reader lock we need to upgrade + // it to a writer lock; acquiring a reader lock in this case would block the thread on itself. + // If the thread already has a writer lock its ref count will be incremented w/o placing the request in the + // writer queue. See ReaderWriterLock.AcquireWriterLock method in the MSDN. + + bool readerLockHeld = s_rwImgListLock.IsReaderLockHeld; + LockCookie lockDowngradeCookie = new LockCookie(); + + t_threadWriterLockWaitCount++; + + try + { + if (readerLockHeld) + { + lockDowngradeCookie = s_rwImgListLock.UpgradeToWriterLock(Timeout.Infinite); + } + else + { + s_rwImgListLock.AcquireWriterLock(Timeout.Infinite); + } + } + finally + { + t_threadWriterLockWaitCount--; + Debug.Assert(t_threadWriterLockWaitCount >= 0, "threadWriterLockWaitCount less than zero."); + } + + try + { + if (imageInfo.Animated) + { + // Construct the image array + // + if (s_imageInfoList == null) + { + s_imageInfoList = new List(); + } + + // Add the new image + // + imageInfo.FrameChangedHandler = onFrameChangedHandler; + s_imageInfoList.Add(imageInfo); + + // Construct a new timer thread if we haven't already + // + if (s_animationThread == null) + { + s_animationThread = new Thread(new ThreadStart(AnimateImages50ms)); + s_animationThread.Name = typeof(ImageAnimator).Name; + s_animationThread.IsBackground = true; + s_animationThread.Start(); + } + } + } + finally + { + if (readerLockHeld) + { + s_rwImgListLock.DowngradeFromWriterLock(ref lockDowngradeCookie); + } + else + { + s_rwImgListLock.ReleaseWriterLock(); + } + } + } + + /// + /// Whether or not the image has multiple time-based frames. + /// + public static bool CanAnimate(Image image) + { + if (image == null) + { + return false; + } + + // See comment in the class header about locking the image ref. +#pragma warning disable CA2002 + lock (image) + { +#pragma warning restore CA2002 + Guid[] dimensions = image.FrameDimensionsList; + + foreach (Guid guid in dimensions) + { + FrameDimension dimension = new FrameDimension(guid); + if (dimension.Equals(FrameDimension.Time)) + { + return image.GetFrameCount(FrameDimension.Time) > 1; + } + } + } + + return false; + } + + /// + /// Removes an image from the image manager so it is no longer animated. + /// + public static void StopAnimate(Image image, EventHandler onFrameChangedHandler) + { + // Make sure we have a list of images + if (image == null || s_imageInfoList == null) + { + return; + } + + // Acquire a writer lock to modify the image info list - See comments on Animate() about this locking. + + bool readerLockHeld = s_rwImgListLock.IsReaderLockHeld; + LockCookie lockDowngradeCookie = new LockCookie(); + + t_threadWriterLockWaitCount++; + + try + { + if (readerLockHeld) + { + lockDowngradeCookie = s_rwImgListLock.UpgradeToWriterLock(Timeout.Infinite); + } + else + { + s_rwImgListLock.AcquireWriterLock(Timeout.Infinite); + } + } + finally + { + t_threadWriterLockWaitCount--; + Debug.Assert(t_threadWriterLockWaitCount >= 0, "threadWriterLockWaitCount less than zero."); + } + + try + { + // Find the corresponding reference and remove it + for (int i = 0; i < s_imageInfoList.Count; i++) + { + ImageInfo imageInfo = s_imageInfoList[i]; + + if (image == imageInfo.Image) + { + if ((onFrameChangedHandler == imageInfo.FrameChangedHandler) || (onFrameChangedHandler != null && onFrameChangedHandler.Equals(imageInfo.FrameChangedHandler))) + { + s_imageInfoList.Remove(imageInfo); + } + break; + } + } + } + finally + { + if (readerLockHeld) + { + s_rwImgListLock.DowngradeFromWriterLock(ref lockDowngradeCookie); + } + else + { + s_rwImgListLock.ReleaseWriterLock(); + } + } + } + + + /// + /// Worker thread procedure which implements the main animation loop. + /// NOTE: This is the ONLY code the worker thread executes, keeping it in one method helps better understand + /// any synchronization issues. + /// WARNING: Also, this is the only place where ImageInfo objects (not the contained image object) are modified, + /// so no access synchronization is required to modify them. + /// + private static void AnimateImages50ms() + { + Debug.Assert(s_imageInfoList != null, "Null images list"); + + while (true) + { + // Acquire reader-lock to access imageInfoList, elemens in the list can be modified w/o needing a writer-lock. + // Observe that we don't need to check if the thread is waiting or a writer lock here since the thread this + // method runs in never acquires a writer lock. + s_rwImgListLock.AcquireReaderLock(Timeout.Infinite); + try + { + for (int i = 0; i < s_imageInfoList.Count; i++) + { + ImageInfo imageInfo = s_imageInfoList[i]; + + // Frame delay is measured in 1/100ths of a second. This thread + // sleeps for 50 ms = 5/100ths of a second between frame updates, + // so we increase the frame delay count 5/100ths of a second + // at a time. + // + imageInfo.FrameTimer += 5; + if (imageInfo.FrameTimer >= imageInfo.FrameDelay(imageInfo.Frame)) + { + imageInfo.FrameTimer = 0; + + if (imageInfo.Frame + 1 < imageInfo.FrameCount) + { + imageInfo.Frame++; + } + else + { + imageInfo.Frame = 0; + } + + if (imageInfo.FrameDirty) + { + s_anyFrameDirty = true; + } + } + } + } + finally + { + s_rwImgListLock.ReleaseReaderLock(); + } + + Thread.Sleep(50); + } + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs deleted file mode 100644 index 83437aaaba..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageAnimator.cs +++ /dev/null @@ -1,440 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Drawing -{ - using System.Collections.Generic; - using System.Diagnostics; - using System.Drawing.Imaging; - using System.Threading; - - /// - /// Animates one or more images that have time-based frames. - /// See the ImageInfo.cs file for the helper nested ImageInfo class. - /// - /// A common pattern for using this class is as follows (See PictureBox control): - /// 1. The winform app (user's code) calls ImageAnimator.Animate() from the main thread. - /// 2. Animate() spawns the animating (worker) thread in the background, which will update the image - /// frames and raise the OnFrameChanged event, which handler will be executed in the main thred. - /// 3. The main thread triggers a paint event (Invalidate()) from the OnFrameChanged handler. - /// 4. From the OnPaint event, the main thread calls ImageAnimator.UpdateFrames() and then paints the - /// image (updated frame). - /// 5. The main thread calls ImageAnimator.StopAnimate() when needed. This does not kill the worker thread. - /// - /// Comment on locking the image ref: - /// We need to synchronize access to sections of code that modify the image(s), but we don't want to block - /// animation of one image when modifying a different one; for this, we use the image ref for locking the - /// critical section (lock(image)). - /// - /// This class is safe for multi-threading but Image is not; multithreaded applications must use a critical - /// section lock using the image ref the image access is not from the same thread that executes ImageAnimator - /// code. If the user code locks on the image ref forever a deadlock will happen preventing the animiation - /// from occurring. - /// - public sealed partial class ImageAnimator - { - /// - /// A list of images to be animated. - /// - private static List s_imageInfoList; - - /// - /// A variable to flag when an image or images need to be updated due to the selection of a new frame - /// in an image. We don't need to synchronize access to this variable, in the case it is true we don't - /// do anything, otherwise the worse case is where a thread attempts to update the image's frame after - /// another one did which is harmless. - /// - private static bool s_anyFrameDirty; - - /// - /// The thread used for animating the images. - /// - private static Thread s_animationThread; - - /// - /// Lock that allows either concurrent read-access to the images list for multiple threads, or write- - /// access to it for a single thread. Observe that synchronization access to image objects are done - /// with critical sections (lock). - /// - private static ReaderWriterLock s_rwImgListLock = new ReaderWriterLock(); - - /// - /// Flag to avoid a deadlock when waiting on a write-lock and a an attemp to acquire a read-lock is - /// made in the same thread. If RWLock is currently owned by another thread, the current thread is going to wait on an - /// event using CoWaitForMultipleHandles while pumps message. - /// The comment above refers to the COM STA message pump, not to be confused with the UI message pump. - /// However, the effect is the same, the COM message pump will pump messages and dispatch them to the - /// window while waiting on the writer lock; this has the potential of creating a re-entrancy situation - // that if during the message processing a wait on a reader lock is originated the thread will be block - // on itself. - /// While processing STA message, the thread may call back into managed code. We do this because - /// we can not block finalizer thread. Finalizer thread may need to release STA objects on this thread. If - /// the current thread does not pump message, finalizer thread is blocked, and AD unload is blocked while - /// waiting for finalizer thread. RWLock is a fair lock. If a thread waits for a writer lock, then it needs - /// a reader lock while pumping message, the thread is blocked forever. - /// This TLS variable is used to flag the above situation and avoid the deadlock, it is ThreadStatic so each - /// thread calling into ImageAnimator is garded against this problem. - /// - - - - - [ThreadStatic] - private static int t_threadWriterLockWaitCount; - - /// - /// Prevent instantiation of this class. - /// - private ImageAnimator() - { - } - - /// - /// Advances the frame in the specified image. The new frame is drawn the next time the image is rendered. - /// - public static void UpdateFrames(Image image) - { - if (!s_anyFrameDirty || image == null || s_imageInfoList == null) - { - return; - } - - if (t_threadWriterLockWaitCount > 0) - { - // Cannot acquire reader lock - frame update will be missed. - return; - } - - // If the current thread already has the writer lock, no reader lock is acquired. Instead, the lock count on - // the writer lock is incremented. It it already has a reader lock, the locks ref count will be incremented - // w/o placing the request at the end of the reader queue. - - s_rwImgListLock.AcquireReaderLock(Timeout.Infinite); - - try - { - bool foundDirty = false; - bool foundImage = false; - - foreach (ImageInfo imageInfo in s_imageInfoList) - { - if (imageInfo.Image == image) - { - if (imageInfo.FrameDirty) - { - // See comment in the class header about locking the image ref. -#pragma warning disable CA2002 - lock (imageInfo.Image) - { -#pragma warning restore CA2002 - imageInfo.UpdateFrame(); - } - } - foundImage = true; - } - - if (imageInfo.FrameDirty) - { - foundDirty = true; - } - - if (foundDirty && foundImage) - { - break; - } - } - - s_anyFrameDirty = foundDirty; - } - finally - { - s_rwImgListLock.ReleaseReaderLock(); - } - } - - /// - /// Advances the frame in all images currently being animated. The new frame is drawn the next time the image is rendered. - /// - public static void UpdateFrames() - { - if (!s_anyFrameDirty || s_imageInfoList == null) - { - return; - } - if (t_threadWriterLockWaitCount > 0) - { - // Cannot acquire reader lock at this time, frames update will be missed. - return; - } - - s_rwImgListLock.AcquireReaderLock(Timeout.Infinite); - - try - { - foreach (ImageInfo imageInfo in s_imageInfoList) - { - // See comment in the class header about locking the image ref. -#pragma warning disable CA2002 - lock (imageInfo.Image) - { -#pragma warning restore CA2002 - imageInfo.UpdateFrame(); - } - } - s_anyFrameDirty = false; - } - finally - { - s_rwImgListLock.ReleaseReaderLock(); - } - } - - /// - /// Adds an image to the image manager. If the image does not support animation this method does nothing. - /// This method creates the image list and spawns the animation thread the first time it is called. - /// - public static void Animate(Image image, EventHandler onFrameChangedHandler) - { - if (image == null) - { - return; - } - - ImageInfo imageInfo = null; - - // See comment in the class header about locking the image ref. -#pragma warning disable CA2002 - lock (image) - { -#pragma warning restore CA2002 - // could we avoid creating an ImageInfo object if FrameCount == 1 ? - imageInfo = new ImageInfo(image); - } - - // If the image is already animating, stop animating it - StopAnimate(image, onFrameChangedHandler); - - // Acquire a writer lock to modify the image info list. If the thread has a reader lock we need to upgrade - // it to a writer lock; acquiring a reader lock in this case would block the thread on itself. - // If the thread already has a writer lock its ref count will be incremented w/o placing the request in the - // writer queue. See ReaderWriterLock.AcquireWriterLock method in the MSDN. - - bool readerLockHeld = s_rwImgListLock.IsReaderLockHeld; - LockCookie lockDowngradeCookie = new LockCookie(); - - t_threadWriterLockWaitCount++; - - try - { - if (readerLockHeld) - { - lockDowngradeCookie = s_rwImgListLock.UpgradeToWriterLock(Timeout.Infinite); - } - else - { - s_rwImgListLock.AcquireWriterLock(Timeout.Infinite); - } - } - finally - { - t_threadWriterLockWaitCount--; - Debug.Assert(t_threadWriterLockWaitCount >= 0, "threadWriterLockWaitCount less than zero."); - } - - try - { - if (imageInfo.Animated) - { - // Construct the image array - // - if (s_imageInfoList == null) - { - s_imageInfoList = new List(); - } - - // Add the new image - // - imageInfo.FrameChangedHandler = onFrameChangedHandler; - s_imageInfoList.Add(imageInfo); - - // Construct a new timer thread if we haven't already - // - if (s_animationThread == null) - { - s_animationThread = new Thread(new ThreadStart(AnimateImages50ms)); - s_animationThread.Name = typeof(ImageAnimator).Name; - s_animationThread.IsBackground = true; - s_animationThread.Start(); - } - } - } - finally - { - if (readerLockHeld) - { - s_rwImgListLock.DowngradeFromWriterLock(ref lockDowngradeCookie); - } - else - { - s_rwImgListLock.ReleaseWriterLock(); - } - } - } - - /// - /// Whether or not the image has multiple time-based frames. - /// - public static bool CanAnimate(Image image) - { - if (image == null) - { - return false; - } - - // See comment in the class header about locking the image ref. -#pragma warning disable CA2002 - lock (image) - { -#pragma warning restore CA2002 - Guid[] dimensions = image.FrameDimensionsList; - - foreach (Guid guid in dimensions) - { - FrameDimension dimension = new FrameDimension(guid); - if (dimension.Equals(FrameDimension.Time)) - { - return image.GetFrameCount(FrameDimension.Time) > 1; - } - } - } - - return false; - } - - /// - /// Removes an image from the image manager so it is no longer animated. - /// - public static void StopAnimate(Image image, EventHandler onFrameChangedHandler) - { - // Make sure we have a list of images - if (image == null || s_imageInfoList == null) - { - return; - } - - // Acquire a writer lock to modify the image info list - See comments on Animate() about this locking. - - bool readerLockHeld = s_rwImgListLock.IsReaderLockHeld; - LockCookie lockDowngradeCookie = new LockCookie(); - - t_threadWriterLockWaitCount++; - - try - { - if (readerLockHeld) - { - lockDowngradeCookie = s_rwImgListLock.UpgradeToWriterLock(Timeout.Infinite); - } - else - { - s_rwImgListLock.AcquireWriterLock(Timeout.Infinite); - } - } - finally - { - t_threadWriterLockWaitCount--; - Debug.Assert(t_threadWriterLockWaitCount >= 0, "threadWriterLockWaitCount less than zero."); - } - - try - { - // Find the corresponding reference and remove it - for (int i = 0; i < s_imageInfoList.Count; i++) - { - ImageInfo imageInfo = s_imageInfoList[i]; - - if (image == imageInfo.Image) - { - if ((onFrameChangedHandler == imageInfo.FrameChangedHandler) || (onFrameChangedHandler != null && onFrameChangedHandler.Equals(imageInfo.FrameChangedHandler))) - { - s_imageInfoList.Remove(imageInfo); - } - break; - } - } - } - finally - { - if (readerLockHeld) - { - s_rwImgListLock.DowngradeFromWriterLock(ref lockDowngradeCookie); - } - else - { - s_rwImgListLock.ReleaseWriterLock(); - } - } - } - - - /// - /// Worker thread procedure which implements the main animation loop. - /// NOTE: This is the ONLY code the worker thread executes, keeping it in one method helps better understand - /// any synchronization issues. - /// WARNING: Also, this is the only place where ImageInfo objects (not the contained image object) are modified, - /// so no access synchronization is required to modify them. - /// - private static void AnimateImages50ms() - { - Debug.Assert(s_imageInfoList != null, "Null images list"); - - while (true) - { - // Acquire reader-lock to access imageInfoList, elemens in the list can be modified w/o needing a writer-lock. - // Observe that we don't need to check if the thread is waiting or a writer lock here since the thread this - // method runs in never acquires a writer lock. - s_rwImgListLock.AcquireReaderLock(Timeout.Infinite); - try - { - for (int i = 0; i < s_imageInfoList.Count; i++) - { - ImageInfo imageInfo = s_imageInfoList[i]; - - // Frame delay is measured in 1/100ths of a second. This thread - // sleeps for 50 ms = 5/100ths of a second between frame updates, - // so we increase the frame delay count 5/100ths of a second - // at a time. - // - imageInfo.FrameTimer += 5; - if (imageInfo.FrameTimer >= imageInfo.FrameDelay(imageInfo.Frame)) - { - imageInfo.FrameTimer = 0; - - if (imageInfo.Frame + 1 < imageInfo.FrameCount) - { - imageInfo.Frame++; - } - else - { - imageInfo.Frame = 0; - } - - if (imageInfo.FrameDirty) - { - s_anyFrameDirty = true; - } - } - } - } - finally - { - s_rwImgListLock.ReleaseReaderLock(); - } - - Thread.Sleep(50); - } - } - } -} - diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageType.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageType.cs new file mode 100644 index 0000000000..439576ce9e --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ImageType.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Drawing +{ + internal enum ImageType + { + Unknown = 0, + Bitmap = 1, + Metafile = 2, + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.Unix.cs new file mode 100644 index 0000000000..e7d9b2eb11 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.Unix.cs @@ -0,0 +1,145 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Imaging.BitmapData.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// Vladimir Vukicevic (vladimir@pobox.com) +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004, 2006 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.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + // MUST BE KEPT IN SYNC WITH gdip.h in libgdiplus! + // The first 6 fields MUST also match MS definition + [StructLayout(LayoutKind.Sequential)] + public sealed class BitmapData + { + private int width; + private int height; + private int stride; + private PixelFormat pixel_format; // int + private IntPtr scan0; + private int reserved; +#pragma warning disable 169 + // *** Warning *** don't depend on those fields in managed + // code as they won't exists when using MS + // GDI+ + private IntPtr palette; + private int property_count; + private IntPtr property; + private float dpi_horz; + private float dpi_vert; + private int image_flags; + private int left; + private int top; + private int x; + private int y; + private int transparent; + // *** Warning *** +#pragma warning restore 169 + + public int Height + { + get + { + return height; + } + + set + { + height = value; + } + } + + public int Width + { + get + { + return width; + } + + set + { + width = value; + } + } + + public PixelFormat PixelFormat + { + get + { + + return pixel_format; + } + + set + { + pixel_format = value; + } + } + + public int Reserved + { + get + { + return reserved; + } + + set + { + reserved = value; + } + } + + public IntPtr Scan0 + { + get + { + return scan0; + } + + set + { + scan0 = value; + } + } + + public int Stride + { + get + { + return stride; + } + + set + { + stride = value; + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/BitmapData.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMap.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMap.cs index 7e6c8f2c83..654b9202b5 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMap.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMap.cs @@ -30,7 +30,7 @@ namespace System.Drawing.Imaging set { _oldColor = value; } } /// - /// Specifes the new to which to convert. + /// Specifies the new to which to convert. /// public Color NewColor { diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs index 8e3a4238bf..806d3a51f9 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ColorMatrix.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace System.Drawing.Imaging { /// - /// Defines a 5 x 5 matrix that that contains the homogenous coordinates for the RGBA space. + /// Defines a 5 x 5 matrix that contains the homogeneous coordinates for the RGBA space. /// [StructLayout(LayoutKind.Sequential)] public sealed class ColorMatrix diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfType.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfType.cs index 151a7ad217..b88b178026 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfType.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfType.cs @@ -10,15 +10,15 @@ namespace System.Drawing.Imaging public enum EmfType { /// - /// Windows enhanced metafile. Contains GDI commands. Metafiles of this type are refered to as an EMF file. + /// Windows enhanced metafile. Contains GDI commands. Metafiles of this type are referred to as an EMF file. /// EmfOnly = MetafileType.Emf, /// - /// Windows enhanced metafile plus. Contains GDI+ commands. Metafiles of this type are refered to as an EMF+ file. + /// Windows enhanced metafile plus. Contains GDI+ commands. Metafiles of this type are referred to as an EMF+ file. /// EmfPlusOnly = MetafileType.EmfPlusOnly, /// - /// Dual Windows enhanced metafile. Contains equivalent GDI and GDI+ commands. Metafiles of this type are refered to as an EMF+ file. + /// Dual Windows enhanced metafile. Contains equivalent GDI and GDI+ commands. Metafiles of this type are referred to as an EMF+ file. /// EmfPlusDual = MetafileType.EmfPlusDual } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameters.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameters.cs index 93f0c0249a..dc4a2bdfb1 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameters.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EncoderParameters.cs @@ -35,7 +35,7 @@ namespace System.Drawing.Imaging /// /// Copy the EncoderParameters data into a chunk of memory to be consumed by native GDI+ code. /// - /// We need to marshal the EncoderParameters info from/to native GDI+ ourselve since the definition of the managed/unmanaged classes + /// We need to marshal the EncoderParameters info from/to native GDI+ ourselves since the definition of the managed/unmanaged classes /// are different and the native class is a bit weird. The native EncoderParameters class is defined in GDI+ as follows: /// /// class EncoderParameters { diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs index b276d495ad..431201ee11 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs @@ -6,6 +6,7 @@ using System.Runtime.InteropServices; using System.Diagnostics; using System.Drawing.Drawing2D; using System.Globalization; +using System.IO; namespace System.Drawing.Imaging { @@ -405,6 +406,9 @@ namespace System.Drawing.Imaging public void SetOutputChannelColorProfile(String colorProfileFilename, ColorAdjustType type) { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(colorProfileFilename); + int status = SafeNativeMethods.Gdip.GdipSetImageAttributesOutputChannelColorProfile( new HandleRef(this, nativeImageAttributes), type, diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs index d963b94257..75a7f42eb3 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/ImageFormat.cs @@ -107,7 +107,7 @@ namespace System.Drawing.Imaging } /// - /// Specifies the Exchangable Image Format (EXIF). + /// Specifies the Exchangeable Image Format (EXIF). /// public static ImageFormat Exif { diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetaHeader.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetaHeader.Unix.cs new file mode 100644 index 0000000000..673fff1f2a --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetaHeader.Unix.cs @@ -0,0 +1,140 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Imaging.MetaHeader.cs +// +// Authors: +// Everaldo Canuto (everaldo.canuto@bol.com.br) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Dennis Hayes (dennish@raytek.com) +// Sebastien Pouliot +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004, 2006-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.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + + [StructLayout(LayoutKind.Sequential, Pack = 2)] + internal struct WmfMetaHeader + { + // field order match: http://wvware.sourceforge.net/caolan/ora-wmf.html + // for WMFHEAD structure + public short file_type; + public short header_size; + public short version; + // this is unaligned and fails on the SPARC architecture (see bug #81254 for details) + // public int file_size; + public ushort file_size_low; + public ushort file_size_high; + public short num_of_objects; + public int max_record_size; + public short num_of_params; + } + + [StructLayout(LayoutKind.Sequential)] + public sealed class MetaHeader + { + + private WmfMetaHeader wmf; + + public MetaHeader() + { + } + + internal MetaHeader(WmfMetaHeader header) + { + wmf.file_type = header.file_type; + wmf.header_size = header.header_size; + wmf.version = header.version; + wmf.file_size_low = header.file_size_low; + wmf.file_size_high = header.file_size_high; + wmf.num_of_objects = header.num_of_objects; + wmf.max_record_size = header.max_record_size; + wmf.num_of_params = header.num_of_params; + } + + + public short HeaderSize + { + get { return wmf.header_size; } + set { wmf.header_size = value; } + } + + public int MaxRecord + { + get { return wmf.max_record_size; } + set { wmf.max_record_size = value; } + } + + public short NoObjects + { + get { return wmf.num_of_objects; } + set { wmf.num_of_objects = value; } + } + + public short NoParameters + { + get { return wmf.num_of_params; } + set { wmf.num_of_params = value; } + } + + public int Size + { + get + { + if (BitConverter.IsLittleEndian) + return (wmf.file_size_high << 16) | wmf.file_size_low; + else + return (wmf.file_size_low << 16) | wmf.file_size_high; + } + set + { + if (BitConverter.IsLittleEndian) + { + wmf.file_size_high = (ushort)(value >> 16); + wmf.file_size_low = (ushort)value; + } + else + { + wmf.file_size_high = (ushort)value; + wmf.file_size_low = (ushort)(value >> 16); + } + } + } + + public short Type + { + get { return wmf.file_type; } + set { wmf.file_type = value; } + } + + public short Version + { + get { return wmf.version; } + set { wmf.version = value; } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/METAHEADER.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetaHeader.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/METAHEADER.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetaHeader.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Unix.cs new file mode 100644 index 0000000000..9825ac7337 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Unix.cs @@ -0,0 +1,426 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Imaging.Metafile.cs +// +// Authors: +// Christian Meyer, eMail: Christian.Meyer@cs.tum.edu +// Dennis Hayes (dennish@raytek.com) +// Sebastien Pouliot +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004,2006-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.IO; +using System.Reflection; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + + [MonoTODO("Metafiles, both WMF and EMF formats, are only partially supported.")] +#if !NETCORE + [Serializable] + [Editor ("System.Drawing.Design.MetafileEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] +#endif + public sealed class Metafile : Image + { + + // constructors + + internal Metafile(IntPtr ptr) + { + nativeObject = ptr; + } + + // Usually called when cloning images that need to have + // not only the handle saved, but also the underlying stream + // (when using MS GDI+ and IStream we must ensure the stream stays alive for all the life of the Image) + internal Metafile(IntPtr ptr, Stream stream) + { + nativeObject = ptr; + } + + public Metafile(Stream stream) + { + if (stream == null) + throw new ArgumentNullException("stream"); + + int status; + // With libgdiplus we use a custom API for this, because there's no easy way + // to get the Stream down to libgdiplus. So, we wrap the stream with a set of delegates. + GdiPlusStreamHelper sh = new GdiPlusStreamHelper(stream, false); + status = SafeNativeMethods.Gdip.GdipCreateMetafileFromDelegate_linux(sh.GetHeaderDelegate, sh.GetBytesDelegate, + sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(string filename) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(filename); + + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromFile(filename, out nativeObject); + if (status == SafeNativeMethods.Gdip.GenericError) + throw new ExternalException("Couldn't load specified file."); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(IntPtr henhmetafile, bool deleteEmf) + { + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromEmf(henhmetafile, deleteEmf, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(IntPtr referenceHdc, EmfType emfType) : + this(referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, emfType, null) + { + } + + public Metafile(IntPtr referenceHdc, Rectangle frameRect) : + this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(IntPtr referenceHdc, RectangleF frameRect) : + this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) + { + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromEmf(hmetafile, false, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(Stream stream, IntPtr referenceHdc) : + this(stream, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc) : + this(fileName, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, + null) + { + } + + public Metafile(IntPtr referenceHdc, EmfType emfType, string description) : + this(referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, emfType, description) + { + } + + public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) : + this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null) + { + } + + public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) : + this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null) + { + } + + public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) + { + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromEmf(hmetafile, deleteWmf, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(Stream stream, IntPtr referenceHdc, EmfType type) : + this(stream, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, type, null) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect) : + this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect) : + this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, EmfType type) : + this(fileName, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, type, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect) : + this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect) : + this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible, EmfType.EmfPlusDual, null) + { + } + + public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) : + this(referenceHdc, frameRect, frameUnit, type, null) + { + } + + public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) : + this(referenceHdc, frameRect, frameUnit, type, null) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description) : + this(stream, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, type, description) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) : + this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) : + this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, EmfType type, string description) : + this(fileName, referenceHdc, new RectangleF(), MetafileFrameUnit.GdiCompatible, type, description) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) : + this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) : + this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, null) + { + } + + public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, + string desc) + { + int status = SafeNativeMethods.Gdip.GdipRecordMetafileI(referenceHdc, type, ref frameRect, frameUnit, + desc, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, + string description) + { + int status = SafeNativeMethods.Gdip.GdipRecordMetafile(referenceHdc, type, ref frameRect, frameUnit, + description, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, + EmfType type) : this(stream, referenceHdc, frameRect, frameUnit, type, null) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, + EmfType type) : this(stream, referenceHdc, frameRect, frameUnit, type, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, + EmfType type) : this(fileName, referenceHdc, frameRect, frameUnit, type, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, + string description) : this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, description) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, + EmfType type) : this(fileName, referenceHdc, frameRect, frameUnit, type, null) + { + } + + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, + string desc) : this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, + desc) + { + } + + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, + EmfType type, string description) + { + if (stream == null) + throw new NullReferenceException("stream"); + + int status = SafeNativeMethods.Gdip.NotImplemented; + // With libgdiplus we use a custom API for this, because there's no easy way + // to get the Stream down to libgdiplus. So, we wrap the stream with a set of delegates. + GdiPlusStreamHelper sh = new GdiPlusStreamHelper(stream, false); + status = SafeNativeMethods.Gdip.GdipRecordMetafileFromDelegateI_linux(sh.GetHeaderDelegate, sh.GetBytesDelegate, + sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, referenceHdc, + type, ref frameRect, frameUnit, description, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, + EmfType type, string description) + { + if (stream == null) + throw new NullReferenceException("stream"); + + int status = SafeNativeMethods.Gdip.NotImplemented; + // With libgdiplus we use a custom API for this, because there's no easy way + // to get the Stream down to libgdiplus. So, we wrap the stream with a set of delegates. + GdiPlusStreamHelper sh = new GdiPlusStreamHelper(stream, false); + status = SafeNativeMethods.Gdip.GdipRecordMetafileFromDelegate_linux(sh.GetHeaderDelegate, sh.GetBytesDelegate, + sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, sh.SizeDelegate, referenceHdc, + type, ref frameRect, frameUnit, description, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, + EmfType type, string description) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(fileName); + + int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileNameI(fileName, referenceHdc, type, ref frameRect, + frameUnit, description, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, + EmfType type, string description) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(fileName); + + int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, referenceHdc, type, ref frameRect, frameUnit, + description, out nativeObject); + SafeNativeMethods.Gdip.CheckStatus(status); + } + + // methods + + public IntPtr GetHenhmetafile() + { + return nativeObject; + } + + [MonoLimitation("Metafiles aren't only partially supported by libgdiplus.")] + public MetafileHeader GetMetafileHeader() + { + IntPtr header = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeader))); + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromMetafile(nativeObject, header); + SafeNativeMethods.Gdip.CheckStatus(status); + return new MetafileHeader(header); + } + finally + { + Marshal.FreeHGlobal(header); + } + } + + [MonoLimitation("Metafiles aren't only partially supported by libgdiplus.")] + public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile) + { + IntPtr header = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeader))); + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromEmf(henhmetafile, header); + SafeNativeMethods.Gdip.CheckStatus(status); + return new MetafileHeader(header); + } + finally + { + Marshal.FreeHGlobal(header); + } + } + + [MonoLimitation("Metafiles aren't only partially supported by libgdiplus.")] + public static MetafileHeader GetMetafileHeader(Stream stream) + { + if (stream == null) + throw new NullReferenceException("stream"); + + IntPtr header = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeader))); + try + { + int status; + // With libgdiplus we use a custom API for this, because there's no easy way + // to get the Stream down to libgdiplus. So, we wrap the stream with a set of delegates. + GdiPlusStreamHelper sh = new GdiPlusStreamHelper(stream, false); + status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromDelegate_linux(sh.GetHeaderDelegate, + sh.GetBytesDelegate, sh.PutBytesDelegate, sh.SeekDelegate, sh.CloseDelegate, + sh.SizeDelegate, header); + SafeNativeMethods.Gdip.CheckStatus(status); + return new MetafileHeader(header); + } + finally + { + Marshal.FreeHGlobal(header); + } + } + + [MonoLimitation("Metafiles aren't only partially supported by libgdiplus.")] + public static MetafileHeader GetMetafileHeader(string fileName) + { + if (fileName == null) + throw new ArgumentNullException("fileName"); + + IntPtr header = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeader))); + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromFile(fileName, header); + SafeNativeMethods.Gdip.CheckStatus(status); + return new MetafileHeader(header); + } + finally + { + Marshal.FreeHGlobal(header); + } + } + + [MonoLimitation("Metafiles aren't only partially supported by libgdiplus.")] + public static MetafileHeader GetMetafileHeader(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) + { + IntPtr header = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeader))); + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromEmf(hmetafile, header); + SafeNativeMethods.Gdip.CheckStatus(status); + return new MetafileHeader(header); + } + finally + { + Marshal.FreeHGlobal(header); + } + } + + [MonoLimitation("Metafiles aren't only partially supported by libgdiplus.")] + public void PlayRecord(EmfPlusRecordType recordType, int flags, int dataSize, byte[] data) + { + int status = SafeNativeMethods.Gdip.GdipPlayMetafileRecord(nativeObject, recordType, flags, dataSize, data); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs new file mode 100644 index 0000000000..7a3c6b2ad7 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs @@ -0,0 +1,770 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.IO; +using System.Drawing.Internal; + +namespace System.Drawing.Imaging +{ + /// + /// Defines a graphic metafile. A metafile contains records that describe a sequence of graphics operations that + /// can be recorded and played back. + /// + public sealed partial class Metafile : Image + { + // GDI+ doesn't handle filenames over MAX_PATH very well + private const int MaxPath = 260; + + /// + /// Initializes a new instance of the class from the specified handle and + /// . + /// + public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) : + this(hmetafile, wmfHeader, false) + { } + + /// + /// Initializes a new instance of the class from the specified handle and + /// . + /// + public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) + { + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromWmf(new HandleRef(null, hmetafile), deleteWmf, wmfHeader, out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified handle and + /// . + /// + public Metafile(IntPtr henhmetafile, bool deleteEmf) + { + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromEmf(new HandleRef(null, henhmetafile), deleteEmf, out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified filename. + /// + public Metafile(string filename) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(filename); + + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromFile(filename, out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified stream. + /// + public Metafile(Stream stream) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromStream(new GPStream(stream), out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified handle to a device context. + /// + public Metafile(IntPtr referenceHdc, EmfType emfType) : + this(referenceHdc, emfType, null) + { } + + /// + /// Initializes a new instance of the class from the specified handle to a device context. + /// + public Metafile(IntPtr referenceHdc, EmfType emfType, String description) + { + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), + unchecked((int)emfType), + NativeMethods.NullHandleRef, + unchecked((int)MetafileFrameUnit.GdiCompatible), + description, + out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, RectangleF frameRect) : + this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) + { } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) : + this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) + { } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) : + this(referenceHdc, frameRect, frameUnit, type, null) + { } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, String description) + { + IntPtr metafile = IntPtr.Zero; + + GPRECTF rectf = new GPRECTF(frameRect); + int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), + unchecked((int)type), + ref rectf, + unchecked((int)frameUnit), + description, out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, Rectangle frameRect) : + this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) + { } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) : + this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) + { } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) : + this(referenceHdc, frameRect, frameUnit, type, null) + { } + + /// + /// Initializes a new instance of the class from the specified device context, bounded + /// by the specified rectangle. + /// + public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string desc) + { + IntPtr metafile = IntPtr.Zero; + + int status; + + if (frameRect.IsEmpty) + { + status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), + unchecked((int)type), + NativeMethods.NullHandleRef, + unchecked((int)MetafileFrameUnit.GdiCompatible), + desc, + out metafile); + } + else + { + GPRECT gprect = new GPRECT(frameRect); + status = SafeNativeMethods.Gdip.GdipRecordMetafileI(new HandleRef(null, referenceHdc), + unchecked((int)type), + ref gprect, + unchecked((int)frameUnit), + desc, + out metafile); + } + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc) : + this(fileName, referenceHdc, EmfType.EmfPlusDual, null) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, EmfType type) : + this(fileName, referenceHdc, type, null) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, EmfType type, String description) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(fileName); + + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, new HandleRef(null, referenceHdc), + unchecked((int)type), + NativeMethods.NullHandleRef, + unchecked((int)MetafileFrameUnit.GdiCompatible), + description, + out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect) : + this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, + MetafileFrameUnit frameUnit) : + this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, + MetafileFrameUnit frameUnit, EmfType type) : + this(fileName, referenceHdc, frameRect, frameUnit, type, null) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, string desc) : + this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, desc) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, + MetafileFrameUnit frameUnit, EmfType type, String description) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(fileName); + + if (fileName.Length > MaxPath) + { + throw new PathTooLongException(); + } + + IntPtr metafile = IntPtr.Zero; + + GPRECTF rectf = new GPRECTF(frameRect); + int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, + new HandleRef(null, referenceHdc), + unchecked((int)type), + ref rectf, + unchecked((int)frameUnit), + description, + out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect) : + this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, + MetafileFrameUnit frameUnit) : + this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, + MetafileFrameUnit frameUnit, EmfType type) : + this(fileName, referenceHdc, frameRect, frameUnit, type, null) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, string description) : + this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, description) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(fileName); + + IntPtr metafile = IntPtr.Zero; + + int status; + + if (frameRect.IsEmpty) + { + status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, + new HandleRef(null, referenceHdc), + unchecked((int)type), + NativeMethods.NullHandleRef, + unchecked((int)frameUnit), + description, + out metafile); + } + else + { + GPRECT gprect = new GPRECT(frameRect); + status = SafeNativeMethods.Gdip.GdipRecordMetafileFileNameI(fileName, + new HandleRef(null, referenceHdc), + unchecked((int)type), + ref gprect, + unchecked((int)frameUnit), + description, + out metafile); + } + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified data stream. + /// + public Metafile(Stream stream, IntPtr referenceHdc) : + this(stream, referenceHdc, EmfType.EmfPlusDual, null) + { } + + /// + /// Initializes a new instance of the class from the specified data stream. + /// + public Metafile(Stream stream, IntPtr referenceHdc, EmfType type) : + this(stream, referenceHdc, type, null) + { } + + /// + /// Initializes a new instance of the class from the specified data stream. + /// + public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description) + { + IntPtr metafile = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), + new HandleRef(null, referenceHdc), + unchecked((int)type), + NativeMethods.NullHandleRef, + unchecked((int)MetafileFrameUnit.GdiCompatible), + description, + out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified data stream. + /// + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect) : + this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, + MetafileFrameUnit frameUnit) : + this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, + MetafileFrameUnit frameUnit, EmfType type) : + this(stream, referenceHdc, frameRect, frameUnit, type, null) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, + MetafileFrameUnit frameUnit, EmfType type, string description) + { + IntPtr metafile = IntPtr.Zero; + + GPRECTF rectf = new GPRECTF(frameRect); + int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), + new HandleRef(null, referenceHdc), + unchecked((int)type), + ref rectf, + unchecked((int)frameUnit), + description, + out metafile); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Initializes a new instance of the class from the specified data stream. + /// + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect) : + this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, + MetafileFrameUnit frameUnit) : + this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, + MetafileFrameUnit frameUnit, EmfType type) : + this(stream, referenceHdc, frameRect, frameUnit, type, null) + { } + + /// + /// Initializes a new instance of the class with the specified filename. + /// + public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, + EmfType type, string description) + { + IntPtr metafile = IntPtr.Zero; + + int status; + + if (frameRect.IsEmpty) + { + status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), + new HandleRef(null, referenceHdc), + unchecked((int)type), + NativeMethods.NullHandleRef, + unchecked((int)frameUnit), + description, + out metafile); + } + else + { + GPRECT gprect = new GPRECT(frameRect); + status = SafeNativeMethods.Gdip.GdipRecordMetafileStreamI(new GPStream(stream), + new HandleRef(null, referenceHdc), + unchecked((int)type), + ref gprect, + unchecked((int)frameUnit), + description, + out metafile); + } + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + SetNativeImage(metafile); + } + + /// + /// Returns the associated with the specified . + /// + public static MetafileHeader GetMetafileHeader(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) + { + MetafileHeader header = new MetafileHeader(); + + header.wmf = new MetafileHeaderWmf(); + + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromWmf(new HandleRef(null, hmetafile), wmfHeader, header.wmf); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return header; + } + + /// + /// Returns the associated with the specified . + /// + public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile) + { + MetafileHeader header = new MetafileHeader(); + header.emf = new MetafileHeaderEmf(); + + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromEmf(new HandleRef(null, henhmetafile), header.emf); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return header; + } + + /// + /// Returns the associated with the specified . + /// + public static MetafileHeader GetMetafileHeader(string fileName) + { + // Called in order to emulate exception behavior from netfx related to invalid file paths. + Path.GetFullPath(fileName); + + MetafileHeader header = new MetafileHeader(); + + IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); + + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromFile(fileName, memory); + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + int[] type = new int[] { 0 }; + + Marshal.Copy(memory, type, 0, 1); + + MetafileType metafileType = (MetafileType)type[0]; + + if (metafileType == MetafileType.Wmf || + metafileType == MetafileType.WmfPlaceable) + { + // WMF header + header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf)); + header.emf = null; + } + else + { + // EMF header + header.wmf = null; + header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf)); + } + } + finally + { + Marshal.FreeHGlobal(memory); + } + + return header; + } + + /// + /// Returns the associated with the specified . + /// + public static MetafileHeader GetMetafileHeader(Stream stream) + { + MetafileHeader header; + + IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); + + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromStream(new GPStream(stream), memory); + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + int[] type = new int[] { 0 }; + + Marshal.Copy(memory, type, 0, 1); + + MetafileType metafileType = (MetafileType)type[0]; + + header = new MetafileHeader(); + + if (metafileType == MetafileType.Wmf || + metafileType == MetafileType.WmfPlaceable) + { + // WMF header + header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf)); + header.emf = null; + } + else + { + // EMF header + header.wmf = null; + header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf)); + } + } + finally + { + Marshal.FreeHGlobal(memory); + } + + return header; + } + + /// + /// Returns the associated with this . + /// + public MetafileHeader GetMetafileHeader() + { + MetafileHeader header; + + IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); + + try + { + int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromMetafile(new HandleRef(this, nativeImage), memory); + + if (status != SafeNativeMethods.Gdip.Ok) + { + throw SafeNativeMethods.Gdip.StatusException(status); + } + + int[] type = new int[] { 0 }; + + Marshal.Copy(memory, type, 0, 1); + + MetafileType metafileType = (MetafileType)type[0]; + + header = new MetafileHeader(); + + if (metafileType == MetafileType.Wmf || + metafileType == MetafileType.WmfPlaceable) + { + // WMF header + header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf)); + header.emf = null; + } + else + { + // EMF header + header.wmf = null; + header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf)); + } + } + finally + { + Marshal.FreeHGlobal(memory); + } + + return header; + } + + /// + /// Returns a Windows handle to an enhanced . + /// + public IntPtr GetHenhmetafile() + { + IntPtr hEmf = IntPtr.Zero; + + int status = SafeNativeMethods.Gdip.GdipGetHemfFromMetafile(new HandleRef(this, nativeImage), out hEmf); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + + return hEmf; + } + + /// + /// Plays an EMF+ file. + /// + public void PlayRecord(EmfPlusRecordType recordType, + int flags, + int dataSize, + byte[] data) + { + // Used in conjunction with Graphics.EnumerateMetafile to play an EMF+ + // The data must be DWORD aligned if it's an EMF or EMF+. It must be + // WORD aligned if it's a WMF. + + int status = SafeNativeMethods.Gdip.GdipPlayMetafileRecord(new HandleRef(this, nativeImage), + recordType, + flags, + dataSize, + data); + + if (status != SafeNativeMethods.Gdip.Ok) + throw SafeNativeMethods.Gdip.StatusException(status); + } + + /* + * Create a new metafile object from a native metafile handle. + * This is only for internal purpose. + */ + internal static Metafile FromGDIplus(IntPtr nativeImage) + { + Metafile metafile = new Metafile(); + metafile.SetNativeImage(nativeImage); + return metafile; + } + + private Metafile() + { + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs deleted file mode 100644 index 53f07e73dd..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.cs +++ /dev/null @@ -1,747 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.InteropServices; -using System.IO; -using System.Drawing.Internal; - -namespace System.Drawing.Imaging -{ - /// - /// Defines a graphic metafile. A metafile contains records that describe a sequence of graphics operations that - /// can be recorded and played back. - /// - public sealed partial class Metafile : Image - { - /// - /// Initializes a new instance of the class from the specified handle and - /// . - /// - public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) : - this(hmetafile, wmfHeader, false) - { } - - /// - /// Initializes a new instance of the class from the specified handle and - /// . - /// - public Metafile(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) - { - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromWmf(new HandleRef(null, hmetafile), deleteWmf, wmfHeader, out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified handle and - /// . - /// - public Metafile(IntPtr henhmetafile, bool deleteEmf) - { - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromEmf(new HandleRef(null, henhmetafile), deleteEmf, out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified filename. - /// - public Metafile(string filename) - { - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromFile(filename, out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified stream. - /// - public Metafile(Stream stream) - { - if (stream == null) - { - throw new ArgumentNullException(nameof(stream)); - } - - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipCreateMetafileFromStream(new GPStream(stream), out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified handle to a device context. - /// - public Metafile(IntPtr referenceHdc, EmfType emfType) : - this(referenceHdc, emfType, null) - { } - - /// - /// Initializes a new instance of the class from the specified handle to a device context. - /// - public Metafile(IntPtr referenceHdc, EmfType emfType, String description) - { - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), - unchecked((int)emfType), - NativeMethods.NullHandleRef, - unchecked((int)MetafileFrameUnit.GdiCompatible), - description, - out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, RectangleF frameRect) : - this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) - { } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) : - this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) - { } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) : - this(referenceHdc, frameRect, frameUnit, type, null) - { } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, String description) - { - IntPtr metafile = IntPtr.Zero; - - GPRECTF rectf = new GPRECTF(frameRect); - int status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), - unchecked((int)type), - ref rectf, - unchecked((int)frameUnit), - description, out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, Rectangle frameRect) : - this(referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) - { } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) : - this(referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) - { } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type) : - this(referenceHdc, frameRect, frameUnit, type, null) - { } - - /// - /// Initializes a new instance of the class from the specified device context, bounded - /// by the specified rectangle. - /// - public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string desc) - { - IntPtr metafile = IntPtr.Zero; - - int status; - - if (frameRect.IsEmpty) - { - status = SafeNativeMethods.Gdip.GdipRecordMetafile(new HandleRef(null, referenceHdc), - unchecked((int)type), - NativeMethods.NullHandleRef, - unchecked((int)MetafileFrameUnit.GdiCompatible), - desc, - out metafile); - } - else - { - GPRECT gprect = new GPRECT(frameRect); - status = SafeNativeMethods.Gdip.GdipRecordMetafileI(new HandleRef(null, referenceHdc), - unchecked((int)type), - ref gprect, - unchecked((int)frameUnit), - desc, - out metafile); - } - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc) : - this(fileName, referenceHdc, EmfType.EmfPlusDual, null) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, EmfType type) : - this(fileName, referenceHdc, type, null) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, EmfType type, String description) - { - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, new HandleRef(null, referenceHdc), - unchecked((int)type), - NativeMethods.NullHandleRef, - unchecked((int)MetafileFrameUnit.GdiCompatible), - description, - out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect) : - this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, - MetafileFrameUnit frameUnit) : - this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, - MetafileFrameUnit frameUnit, EmfType type) : - this(fileName, referenceHdc, frameRect, frameUnit, type, null) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, string desc) : - this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, desc) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, RectangleF frameRect, - MetafileFrameUnit frameUnit, EmfType type, String description) - { - IntPtr metafile = IntPtr.Zero; - - GPRECTF rectf = new GPRECTF(frameRect); - int status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, - new HandleRef(null, referenceHdc), - unchecked((int)type), - ref rectf, - unchecked((int)frameUnit), - description, - out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect) : - this(fileName, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, - MetafileFrameUnit frameUnit) : - this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, - MetafileFrameUnit frameUnit, EmfType type) : - this(fileName, referenceHdc, frameRect, frameUnit, type, null) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, string description) : - this(fileName, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual, description) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string description) - { - IntPtr metafile = IntPtr.Zero; - - int status; - - if (frameRect.IsEmpty) - { - status = SafeNativeMethods.Gdip.GdipRecordMetafileFileName(fileName, - new HandleRef(null, referenceHdc), - unchecked((int)type), - NativeMethods.NullHandleRef, - unchecked((int)frameUnit), - description, - out metafile); - } - else - { - GPRECT gprect = new GPRECT(frameRect); - status = SafeNativeMethods.Gdip.GdipRecordMetafileFileNameI(fileName, - new HandleRef(null, referenceHdc), - unchecked((int)type), - ref gprect, - unchecked((int)frameUnit), - description, - out metafile); - } - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified data stream. - /// - public Metafile(Stream stream, IntPtr referenceHdc) : - this(stream, referenceHdc, EmfType.EmfPlusDual, null) - { } - - /// - /// Initializes a new instance of the class from the specified data stream. - /// - public Metafile(Stream stream, IntPtr referenceHdc, EmfType type) : - this(stream, referenceHdc, type, null) - { } - - /// - /// Initializes a new instance of the class from the specified data stream. - /// - public Metafile(Stream stream, IntPtr referenceHdc, EmfType type, string description) - { - IntPtr metafile = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), - new HandleRef(null, referenceHdc), - unchecked((int)type), - NativeMethods.NullHandleRef, - unchecked((int)MetafileFrameUnit.GdiCompatible), - description, - out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified data stream. - /// - public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect) : - this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, - MetafileFrameUnit frameUnit) : - this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, - MetafileFrameUnit frameUnit, EmfType type) : - this(stream, referenceHdc, frameRect, frameUnit, type, null) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(Stream stream, IntPtr referenceHdc, RectangleF frameRect, - MetafileFrameUnit frameUnit, EmfType type, string description) - { - IntPtr metafile = IntPtr.Zero; - - GPRECTF rectf = new GPRECTF(frameRect); - int status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), - new HandleRef(null, referenceHdc), - unchecked((int)type), - ref rectf, - unchecked((int)frameUnit), - description, - out metafile); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Initializes a new instance of the class from the specified data stream. - /// - public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect) : - this(stream, referenceHdc, frameRect, MetafileFrameUnit.GdiCompatible) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, - MetafileFrameUnit frameUnit) : - this(stream, referenceHdc, frameRect, frameUnit, EmfType.EmfPlusDual) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, - MetafileFrameUnit frameUnit, EmfType type) : - this(stream, referenceHdc, frameRect, frameUnit, type, null) - { } - - /// - /// Initializes a new instance of the class with the specified filename. - /// - public Metafile(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, - EmfType type, string description) - { - IntPtr metafile = IntPtr.Zero; - - int status; - - if (frameRect.IsEmpty) - { - status = SafeNativeMethods.Gdip.GdipRecordMetafileStream(new GPStream(stream), - new HandleRef(null, referenceHdc), - unchecked((int)type), - NativeMethods.NullHandleRef, - unchecked((int)frameUnit), - description, - out metafile); - } - else - { - GPRECT gprect = new GPRECT(frameRect); - status = SafeNativeMethods.Gdip.GdipRecordMetafileStreamI(new GPStream(stream), - new HandleRef(null, referenceHdc), - unchecked((int)type), - ref gprect, - unchecked((int)frameUnit), - description, - out metafile); - } - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - SetNativeImage(metafile); - } - - /// - /// Returns the associated with the specified . - /// - public static MetafileHeader GetMetafileHeader(IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) - { - MetafileHeader header = new MetafileHeader(); - - header.wmf = new MetafileHeaderWmf(); - - int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromWmf(new HandleRef(null, hmetafile), wmfHeader, header.wmf); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return header; - } - - /// - /// Returns the associated with the specified . - /// - public static MetafileHeader GetMetafileHeader(IntPtr henhmetafile) - { - MetafileHeader header = new MetafileHeader(); - header.emf = new MetafileHeaderEmf(); - - int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromEmf(new HandleRef(null, henhmetafile), header.emf); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return header; - } - - /// - /// Returns the associated with the specified . - /// - public static MetafileHeader GetMetafileHeader(string fileName) - { - MetafileHeader header = new MetafileHeader(); - - IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); - - try - { - int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromFile(fileName, memory); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - int[] type = new int[] { 0 }; - - Marshal.Copy(memory, type, 0, 1); - - MetafileType metafileType = (MetafileType)type[0]; - - if (metafileType == MetafileType.Wmf || - metafileType == MetafileType.WmfPlaceable) - { - // WMF header - header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf)); - header.emf = null; - } - else - { - // EMF header - header.wmf = null; - header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf)); - } - } - finally - { - Marshal.FreeHGlobal(memory); - } - - return header; - } - - /// - /// Returns the associated with the specified . - /// - public static MetafileHeader GetMetafileHeader(Stream stream) - { - MetafileHeader header; - - IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); - - try - { - int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromStream(new GPStream(stream), memory); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - int[] type = new int[] { 0 }; - - Marshal.Copy(memory, type, 0, 1); - - MetafileType metafileType = (MetafileType)type[0]; - - header = new MetafileHeader(); - - if (metafileType == MetafileType.Wmf || - metafileType == MetafileType.WmfPlaceable) - { - // WMF header - header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf)); - header.emf = null; - } - else - { - // EMF header - header.wmf = null; - header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf)); - } - } - finally - { - Marshal.FreeHGlobal(memory); - } - - return header; - } - - /// - /// Returns the associated with this . - /// - public MetafileHeader GetMetafileHeader() - { - MetafileHeader header; - - IntPtr memory = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MetafileHeaderEmf))); - - try - { - int status = SafeNativeMethods.Gdip.GdipGetMetafileHeaderFromMetafile(new HandleRef(this, nativeImage), memory); - - if (status != SafeNativeMethods.Gdip.Ok) - { - throw SafeNativeMethods.Gdip.StatusException(status); - } - - int[] type = new int[] { 0 }; - - Marshal.Copy(memory, type, 0, 1); - - MetafileType metafileType = (MetafileType)type[0]; - - header = new MetafileHeader(); - - if (metafileType == MetafileType.Wmf || - metafileType == MetafileType.WmfPlaceable) - { - // WMF header - header.wmf = (MetafileHeaderWmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderWmf)); - header.emf = null; - } - else - { - // EMF header - header.wmf = null; - header.emf = (MetafileHeaderEmf)Marshal.PtrToStructure(memory, typeof(MetafileHeaderEmf)); - } - } - finally - { - Marshal.FreeHGlobal(memory); - } - - return header; - } - - /// - /// Returns a Windows handle to an enhanced . - /// - public IntPtr GetHenhmetafile() - { - IntPtr hEmf = IntPtr.Zero; - - int status = SafeNativeMethods.Gdip.GdipGetHemfFromMetafile(new HandleRef(this, nativeImage), out hEmf); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - - return hEmf; - } - - /// - /// Plays an EMF+ file. - /// - public void PlayRecord(EmfPlusRecordType recordType, - int flags, - int dataSize, - byte[] data) - { - // Used in conjunction with Graphics.EnumerateMetafile to play an EMF+ - // The data must be DWORD aligned if it's an EMF or EMF+. It must be - // WORD aligned if it's a WMF. - - int status = SafeNativeMethods.Gdip.GdipPlayMetafileRecord(new HandleRef(this, nativeImage), - recordType, - flags, - dataSize, - data); - - if (status != SafeNativeMethods.Gdip.Ok) - throw SafeNativeMethods.Gdip.StatusException(status); - } - - /* - * Create a new metafile object from a native metafile handle. - * This is only for internal purpose. - */ - internal static Metafile FromGDIplus(IntPtr nativeImage) - { - Metafile metafile = new Metafile(); - metafile.SetNativeImage(nativeImage); - return metafile; - } - - private Metafile() - { - } - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.Unix.cs new file mode 100644 index 0000000000..f4f2cdd7d7 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.Unix.cs @@ -0,0 +1,220 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.Imaging.MetafileHeader.cs +// +// Author: Everaldo Canuto +// eMail: everaldo.canuto@bol.com.br +// Dennis Hayes (dennish@raytek.com) +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004, 2006 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.Drawing.Drawing2D; +using System.Runtime.InteropServices; + +namespace System.Drawing.Imaging +{ + + [StructLayout(LayoutKind.Sequential, Pack = 2)] + struct EnhMetafileHeader + { + public int type; + public int size; + public Rectangle bounds; + public Rectangle frame; + public int signature; + public int version; + public int bytes; + public int records; + public short handles; + public short reserved; + public int description; + public int off_description; + public int palette_entires; + public Size device; + public Size millimeters; + } + + // hack: keep public type as Sequential while making it possible to get the required union + [StructLayout(LayoutKind.Explicit)] + struct MonoMetafileHeader + { + [FieldOffset(0)] + public MetafileType type; + [FieldOffset(4)] + public int size; + [FieldOffset(8)] + public int version; + [FieldOffset(12)] + public int emf_plus_flags; + [FieldOffset(16)] + public float dpi_x; + [FieldOffset(20)] + public float dpi_y; + [FieldOffset(24)] + public int x; + [FieldOffset(28)] + public int y; + [FieldOffset(32)] + public int width; + [FieldOffset(36)] + public int height; + [FieldOffset(40)] + public WmfMetaHeader wmf_header; + [FieldOffset(40)] + public EnhMetafileHeader emf_header; + [FieldOffset(128)] + public int emfplus_header_size; + [FieldOffset(132)] + public int logical_dpi_x; + [FieldOffset(136)] + public int logical_dpi_y; + } + + [MonoTODO("Metafiles, both WMF and EMF formats, aren't supported.")] + [StructLayout(LayoutKind.Sequential)] + public sealed class MetafileHeader + { + + private MonoMetafileHeader header; + + //constructor + + internal MetafileHeader(IntPtr henhmetafile) + { + Marshal.PtrToStructure(henhmetafile, this); + } + + // methods + + [MonoTODO("always returns false")] + public bool IsDisplay() + { + return false; + } + + public bool IsEmf() + { + return (Type == MetafileType.Emf); + } + + public bool IsEmfOrEmfPlus() + { + return (Type >= MetafileType.Emf); + } + + public bool IsEmfPlus() + { + return (Type >= MetafileType.EmfPlusOnly); + } + + public bool IsEmfPlusDual() + { + return (Type == MetafileType.EmfPlusDual); + } + + public bool IsEmfPlusOnly() + { + return (Type == MetafileType.EmfPlusOnly); + } + + public bool IsWmf() + { + return (Type <= MetafileType.WmfPlaceable); + } + + public bool IsWmfPlaceable() + { + return (Type == MetafileType.WmfPlaceable); + } + + // properties + + public Rectangle Bounds + { + get + { + if (this.MetafileSize == 0) + { + // GDI+ compatibility; + return new Rectangle(); + } + + return new Rectangle(header.x, header.y, header.width, header.height); + } + } + + public float DpiX + { + get { return header.dpi_x; } + } + + public float DpiY + { + get { return header.dpi_y; } + } + + public int EmfPlusHeaderSize + { + get { return header.emfplus_header_size; } + } + + public int LogicalDpiX + { + get { return header.logical_dpi_x; } + } + + public int LogicalDpiY + { + get { return header.logical_dpi_y; } + } + + public int MetafileSize + { + get { return header.size; } + } + + public MetafileType Type + { + get { return header.type; } + } + + public int Version + { + get { return header.version; } + } + + // note: this always returns a new instance (where we can change + // properties even if they don't seems to affect anything) + public MetaHeader WmfHeader + { + get + { + if (IsWmf()) + return new MetaHeader(header.wmf_header); + throw new ArgumentException("WmfHeader only available on WMF files."); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeader.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs index 4d852f0292..28542d895e 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs @@ -10,7 +10,7 @@ namespace System.Drawing.Imaging internal class MetafileHeaderEmf { /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader. - /// Extreme care should be taken if changing the layout of the corresponding managaed + /// Extreme care should be taken if changing the layout of the corresponding managed /// structures to minimize the risk of buffer overruns. The affected managed classes /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf. public MetafileType type = MetafileType.Invalid; diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs index dc2d1e82cf..7bcc8ce1aa 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs @@ -10,7 +10,7 @@ namespace System.Drawing.Imaging internal class MetafileHeaderWmf { /// The ENHMETAHEADER structure is defined natively as a union with WmfHeader. - /// Extreme care should be taken if changing the layout of the corresponding managaed + /// Extreme care should be taken if changing the layout of the corresponding managed /// structures to minimize the risk of buffer overruns. The affected managed classes /// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf. public MetafileType type = MetafileType.Invalid; diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PixelFormat.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PixelFormat.cs index efab1b8d45..7ef57e05ff 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PixelFormat.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PixelFormat.cs @@ -33,7 +33,7 @@ namespace System.Drawing.Imaging /// Alpha = 0x00040000, /// - /// Specifies that pixel format contains pre-multipled alpha values. + /// Specifies that pixel format contains pre-multiplied alpha values. /// PAlpha = 0x00080000, // What's this? Extended = 0x00100000, @@ -48,7 +48,7 @@ namespace System.Drawing.Imaging DontCare = 0, // makes it into devtools, we can change this. /// - /// Specifies thatpixel format is 1 bit per pixel indexed color. The color table therefore has two colors in it. + /// Specifies that pixel format is 1 bit per pixel indexed color. The color table therefore has two colors in it. /// Format1bppIndexed = 1 | (1 << 8) | (int)Indexed | (int)Gdi, /// diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/ISystemEventTracker.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/ISystemEventTracker.cs deleted file mode 100644 index 9e2f7b9c2a..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/ISystemEventTracker.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Drawing.Internal -{ - internal interface ISystemColorTracker - { - void OnSystemColorChanged(); - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/SystemColorTracker.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/SystemColorTracker.cs deleted file mode 100644 index 5d8937dbf3..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/SystemColorTracker.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#if FEATURE_SYSTEM_EVENTS -using System.ComponentModel; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.InteropServices; -using Microsoft.Win32; - -namespace System.Drawing.Internal -{ - // Keeps track of objects that need to be notified of system color change events. - // Mostly this means maintaining a list of weak references. - internal class SystemColorTracker - { - // when I tried the self host, it went over 500 but never over 1000. - private static int INITIAL_SIZE = 200; - // If it gets this big, I seriously miscalculated the performance of this object. - private static int WARNING_SIZE = 100000; - private static float EXPAND_THRESHOLD = 0.75f; - private static int EXPAND_FACTOR = 2; - - private static WeakReference[] list = new WeakReference[INITIAL_SIZE]; - private static int count = 0; - private static bool addedTracker; - - // There's no such thing as a delegate to a static method, - // so we need to create an instance of something. - private SystemColorTracker() - { - } - - internal static void Add(ISystemColorTracker obj) - { - lock (typeof(SystemColorTracker)) - { - Debug.Assert(list != null, "List is null"); - Debug.Assert(list.Length > 0, "INITIAL_SIZE was initialized after list"); - - if (list.Length == count) - { - GarbageCollectList(); - } - - if (!addedTracker) - { - addedTracker = true; - SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(OnUserPreferenceChanged); - } - - // Strictly speaking, we should grab a lock on this class. But since the chances - // of a problem are so low, the consequences so minimal (something will get accidentally dropped - // from the list), and the performance of locking so lousy, we'll risk it. - int index = count; - count++; - - // COM+ takes forever to Finalize() weak references, so it pays to reuse them. - if (list[index] == null) - list[index] = new WeakReference(obj); - else - { - Debug.Assert(list[index].Target == null, "Trying to reuse a weak reference that isn't broken yet: list[" + index + "], length =" + list.Length); - list[index].Target = obj; - } - } - } - - private static void CleanOutBrokenLinks() - { - // Partition the list -- valid references in the low indices, broken references in the high indices. - // This is taken straight out of Sedgewick (p. 118 on quicksort). - - // Basic idea is to find a broken reference on the left side of the list, and swap it with - // a valid reference on the right - int right = list.Length - 1; - int left = 0; - - int length = list.Length; - - // Loop invariant: everything to the left of "left" is a valid reference, - // and anything to the right of "right" is broken. - for (;;) - { - while (left < length && list[left].Target != null) - left++; - while (right >= 0 && list[right].Target == null) - right--; - - if (left >= right) - { - count = left; - break; - } - - WeakReference temp = list[left]; - list[left] = list[right]; - list[right] = temp; - - left++; - right--; - } - - Debug.Assert(count >= 0 && count <= list.Length, "count not a legal index into list"); - -#if DEBUG - // Check loop invariant. - - // We'd like to assert that any index < count contains a valid pointer, - // but since garbage collection can happen at any time, it may have been broken - // after we partitioned it. - // - // for (int i = 0; i < count; i++) { - // Debug.Assert(list[i].Target != null, "Null found on the left side of the list"); - // } - - for (int i = count; i < list.Length; i++) - { - Debug.Assert(list[i].Target == null, "Partitioning didn't work"); - } -#endif - } - - private static void GarbageCollectList() - { - CleanOutBrokenLinks(); - - if (count / (float)list.Length > EXPAND_THRESHOLD) - { - WeakReference[] newList = new WeakReference[list.Length * EXPAND_FACTOR]; - list.CopyTo(newList, 0); - list = newList; - - if (list.Length >= WARNING_SIZE) - { - Debug.Fail("SystemColorTracker is using way more memory than expected."); - } - } - } - - private static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e) - { - - // Update pens and brushes - if (e.Category == UserPreferenceCategory.Color) - { - for (int i = 0; i < count; i++) - { - Debug.Assert(list[i] != null, "null value in active part of list"); - ISystemColorTracker tracker = (ISystemColorTracker)list[i].Target; - if (tracker != null) - { - // If object still around - tracker.OnSystemColorChanged(); - } - } - } - } - } -} -#endif diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/LibX11Functions.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/LibX11Functions.cs new file mode 100644 index 0000000000..a152a0def2 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/LibX11Functions.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Originally in System.Drawing.gdipFunctions.cs + +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + internal static class LibX11Functions + { + // Some special X11 stuff + [DllImport("libX11", EntryPoint = "XOpenDisplay")] + internal extern static IntPtr XOpenDisplay(IntPtr display); + + [DllImport("libX11", EntryPoint = "XCloseDisplay")] + internal extern static int XCloseDisplay(IntPtr display); + + [DllImport("libX11", EntryPoint = "XRootWindow")] + internal extern static IntPtr XRootWindow(IntPtr display, int screen); + + [DllImport("libX11", EntryPoint = "XDefaultScreen")] + internal extern static int XDefaultScreen(IntPtr display); + + [DllImport("libX11", EntryPoint = "XDefaultDepth")] + internal extern static uint XDefaultDepth(IntPtr display, int screen); + + [DllImport("libX11", EntryPoint = "XGetImage")] + internal extern static IntPtr XGetImage(IntPtr display, IntPtr drawable, int src_x, int src_y, int width, int height, int pane, int format); + + [DllImport("libX11", EntryPoint = "XGetPixel")] + internal extern static int XGetPixel(IntPtr image, int x, int y); + + [DllImport("libX11", EntryPoint = "XDestroyImage")] + internal extern static int XDestroyImage(IntPtr image); + + [DllImport("libX11", EntryPoint = "XDefaultVisual")] + internal extern static IntPtr XDefaultVisual(IntPtr display, int screen); + + [DllImport("libX11", EntryPoint = "XGetVisualInfo")] + internal extern static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo vinfo_template, ref int nitems); + + [DllImport("libX11", EntryPoint = "XVisualIDFromVisual")] + internal extern static IntPtr XVisualIDFromVisual(IntPtr visual); + + [DllImport("libX11", EntryPoint = "XFree")] + internal extern static void XFree(IntPtr data); + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/MarshallingHelpers.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/MarshallingHelpers.cs new file mode 100644 index 0000000000..c6e75f3230 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/MarshallingHelpers.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Authors: +// Alexandre Pigolkine (pigolkine@gmx.de) +// Jordi Mas i Hernandez (jordi@ximian.com) +// Sanjay Gupta (gsanjay@novell.com) +// Ravindra (rkumar@novell.com) +// Peter Dennis Bartok (pbartok@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2004 - 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.Runtime.InteropServices; + +namespace System.Drawing +{ + internal static class MarshallingHelpers + { + // Copies a Ptr to an array of Points and releases the memory + static public void FromUnManagedMemoryToPointI(IntPtr prt, Point[] pts) + { + int nPointSize = Marshal.SizeOf(pts[0]); + IntPtr pos = prt; + for (int i = 0; i < pts.Length; i++, pos = new IntPtr(pos.ToInt64() + nPointSize)) + pts[i] = (Point)Marshal.PtrToStructure(pos, typeof(Point)); + + Marshal.FreeHGlobal(prt); + } + + // Copies a Ptr to an array of Points and releases the memory + static public void FromUnManagedMemoryToPoint(IntPtr prt, PointF[] pts) + { + int nPointSize = Marshal.SizeOf(pts[0]); + IntPtr pos = prt; + for (int i = 0; i < pts.Length; i++, pos = new IntPtr(pos.ToInt64() + nPointSize)) + pts[i] = (PointF)Marshal.PtrToStructure(pos, typeof(PointF)); + + Marshal.FreeHGlobal(prt); + } + + // Copies an array of Points to unmanaged memory + static public IntPtr FromPointToUnManagedMemoryI(Point[] pts) + { + int nPointSize = Marshal.SizeOf(pts[0]); + IntPtr dest = Marshal.AllocHGlobal(nPointSize * pts.Length); + IntPtr pos = dest; + for (int i = 0; i < pts.Length; i++, pos = new IntPtr(pos.ToInt64() + nPointSize)) + Marshal.StructureToPtr(pts[i], pos, false); + + return dest; + } + + // Copies an array of Points to unmanaged memory + static public IntPtr FromPointToUnManagedMemory(PointF[] pts) + { + int nPointSize = Marshal.SizeOf(pts[0]); + IntPtr dest = Marshal.AllocHGlobal(nPointSize * pts.Length); + IntPtr pos = dest; + for (int i = 0; i < pts.Length; i++, pos = new IntPtr(pos.ToInt64() + nPointSize)) + Marshal.StructureToPtr(pts[i], pos, false); + + return dest; + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs index 5ff4b7d32a..f4071aaf24 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs @@ -72,15 +72,13 @@ namespace System.Drawing public byte peFlags; } + [StructLayout(LayoutKind.Sequential)] internal struct RGBQUAD { public byte rgbBlue; public byte rgbGreen; public byte rgbRed; - // disable csharp compiler warning #0414: field assigned unused value -#pragma warning disable 0414 public byte rgbReserved; -#pragma warning restore 0414 } [StructLayout(LayoutKind.Sequential)] diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeStructs.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeStructs.Unix.cs new file mode 100644 index 0000000000..c9ad9dba0b --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeStructs.Unix.cs @@ -0,0 +1,150 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.NativeStructs.cs +// +// Author: +// Alexandre Pigolkine (pigolkine@gmx.de) +// Jordi Mas (jordi@ximian.com) +// +// Copyright (C) 2004, 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.Drawing.Imaging; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + internal struct LOGFONT + { + internal int lfHeight; + internal uint lfWidth; + internal uint lfEscapement; + internal uint lfOrientation; + internal uint lfWeight; + internal byte lfItalic; + internal byte lfUnderline; + internal byte lfStrikeOut; + internal byte lfCharSet; + internal byte lfOutPrecision; + internal byte lfClipPrecision; + internal byte lfQuality; + internal byte lfPitchAndFamily; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + internal string lfFaceName; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + internal struct GdipImageCodecInfo /*Size 76 bytes*/ + { + internal Guid Clsid; + internal Guid FormatID; + internal IntPtr CodecName; + internal IntPtr DllName; + internal IntPtr FormatDescription; + internal IntPtr FilenameExtension; + internal IntPtr MimeType; + internal ImageCodecFlags Flags; + internal int Version; + internal int SigCount; + internal int SigSize; + IntPtr SigPattern; + IntPtr SigMask; + + internal static void MarshalTo(GdipImageCodecInfo gdipcodec, ImageCodecInfo codec) + { + codec.CodecName = Marshal.PtrToStringUni(gdipcodec.CodecName); + codec.DllName = Marshal.PtrToStringUni(gdipcodec.DllName); + codec.FormatDescription = Marshal.PtrToStringUni(gdipcodec.FormatDescription); + codec.FilenameExtension = Marshal.PtrToStringUni(gdipcodec.FilenameExtension); + codec.MimeType = Marshal.PtrToStringUni(gdipcodec.MimeType); + codec.Clsid = gdipcodec.Clsid; + codec.FormatID = gdipcodec.FormatID; + codec.Flags = gdipcodec.Flags; + codec.Version = gdipcodec.Version; + codec.SignatureMasks = new byte[gdipcodec.SigCount][]; + codec.SignaturePatterns = new byte[gdipcodec.SigCount][]; + IntPtr p = gdipcodec.SigPattern; + IntPtr m = gdipcodec.SigMask; + for (int i = 0; i < gdipcodec.SigCount; i++) + { + codec.SignatureMasks[i] = new byte[gdipcodec.SigSize]; + Marshal.Copy(m, codec.SignatureMasks[i], 0, gdipcodec.SigSize); + m = new IntPtr(m.ToInt64() + gdipcodec.SigSize); + codec.SignaturePatterns[i] = new byte[gdipcodec.SigSize]; + Marshal.Copy(p, codec.SignaturePatterns[i], 0, gdipcodec.SigSize); + p = new IntPtr(p.ToInt64() + gdipcodec.SigSize); + } + } + } + + [StructLayout(LayoutKind.Sequential)] + internal struct GdipPropertyItem + { + internal int id; + internal int len; + internal short type; + internal IntPtr value; + + internal static void MarshalTo(GdipPropertyItem gdipProp, PropertyItem prop) + { + prop.Id = gdipProp.id; + prop.Len = gdipProp.len; + prop.Type = gdipProp.type; + prop.Value = new byte[gdipProp.len]; + Marshal.Copy(gdipProp.value, prop.Value, 0, gdipProp.len); + } + } + + [StructLayout(LayoutKind.Sequential)] + internal struct IconInfo + { + int fIcon; + public int xHotspot; + public int yHotspot; + public IntPtr hbmMask; + public IntPtr hbmColor; + + public bool IsIcon + { + get { return (fIcon == 1); } + set { fIcon = (value) ? 1 : 0; } + } + } + + [StructLayout(LayoutKind.Sequential)] + internal struct XVisualInfo + { + internal IntPtr visual; + internal IntPtr visualid; + internal int screen; + internal uint depth; + internal int klass; + internal IntPtr red_mask; + internal IntPtr green_mask; + internal IntPtr blue_mask; + internal int colormap_size; + internal int bits_per_rgb; + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs new file mode 100644 index 0000000000..99a4e4838a --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + public partial class Pen + { + // libgdiplus does not implement GdipGetPenCustomEndCap, so we cache the last-known value here. + // Note that this value is not necessarily in sync with the true native value of this property, + // as it could have been set outside of the CustomEndCap property on this type. + private CustomLineCap _cachedEndCap; + + /// + /// Gets or sets a custom cap style to use at the beginning of lines drawn with this . + /// + public CustomLineCap CustomStartCap + { + get + { + IntPtr lineCap = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipGetPenCustomStartCap(new HandleRef(this, NativePen), out lineCap); + SafeNativeMethods.Gdip.CheckStatus(status); + if (lineCap == IntPtr.Zero) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + } + + return CustomLineCap.CreateCustomLineCapObject(lineCap); + } + set + { + if (_immutable) + { + throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); + } + + int status = SafeNativeMethods.Gdip.GdipSetPenCustomStartCap(new HandleRef(this, NativePen), + new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + /// + /// Gets or sets a custom cap style to use at the end of lines drawn with this . + /// + public CustomLineCap CustomEndCap + { + get + { + // If the CustomEndCap has never been set, this accessor should throw. + if (_cachedEndCap == null) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + } + + return _cachedEndCap; + } + set + { + if (_immutable) + { + throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); + } + + // Windows GDI+ clones the CustomLineCap before storing it in the Pen. + CustomLineCap clone = value == null ? null : (CustomLineCap)value.Clone(); + + int status = SafeNativeMethods.Gdip.GdipSetPenCustomEndCap( + new HandleRef(this, NativePen), + new HandleRef(clone, (clone == null) ? IntPtr.Zero : clone.nativeCap)); + SafeNativeMethods.Gdip.CheckStatus(status); + _cachedEndCap = clone; + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs new file mode 100644 index 0000000000..ef3d1235b1 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + public partial class Pen + { + /// + /// Gets or sets a custom cap style to use at the beginning of lines drawn with this . + /// + public CustomLineCap CustomStartCap + { + get + { + IntPtr lineCap = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipGetPenCustomStartCap(new HandleRef(this, NativePen), out lineCap); + SafeNativeMethods.Gdip.CheckStatus(status); + + return CustomLineCap.CreateCustomLineCapObject(lineCap); + } + set + { + if (_immutable) + { + throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); + } + + int status = SafeNativeMethods.Gdip.GdipSetPenCustomStartCap(new HandleRef(this, NativePen), + new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + + /// + /// Gets or sets a custom cap style to use at the end of lines drawn with this . + /// + public CustomLineCap CustomEndCap + { + get + { + IntPtr lineCap = IntPtr.Zero; + int status = SafeNativeMethods.Gdip.GdipGetPenCustomEndCap(new HandleRef(this, NativePen), out lineCap); + SafeNativeMethods.Gdip.CheckStatus(status); + return CustomLineCap.CreateCustomLineCapObject(lineCap); + } + set + { + if (_immutable) + { + throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); + } + + int status = SafeNativeMethods.Gdip.GdipSetPenCustomEndCap( + new HandleRef(this, NativePen), + new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.cs index a6bf180a62..16cc0071da 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Pen.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -14,10 +14,7 @@ namespace System.Drawing /// /// Defines an object used to draw lines and curves. /// - public sealed class Pen : MarshalByRefObject, ICloneable, IDisposable -#if FEATURE_SYSTEM_EVENTS - , ISystemColorTracker -#endif + public sealed partial class Pen : MarshalByRefObject, ICloneable, IDisposable { #if FINALIZATION_WATCH private string allocationSite = Graphics.GetAllocationStack(); @@ -30,6 +27,9 @@ namespace System.Drawing private Color _color; private bool _immutable; + // Tracks whether the dash style has been changed to something else than Solid during the lifetime of this object. + private bool _dashStyleWasOrIsNotSolid; + /// /// Creates a Pen from a native GDI+ object. /// @@ -60,13 +60,6 @@ namespace System.Drawing SafeNativeMethods.Gdip.CheckStatus(status); SetNativePen(pen); - -#if FEATURE_SYSTEM_EVENTS - if (this.color.IsSystemColor) - { - SystemColorTracker.Add(this); - } -#endif } /// @@ -359,58 +352,6 @@ namespace System.Drawing } } - /// - /// Gets or sets a custom cap style to use at the beginning of lines drawn with this . - /// - public CustomLineCap CustomStartCap - { - get - { - IntPtr lineCap = IntPtr.Zero; - int status = SafeNativeMethods.Gdip.GdipGetPenCustomStartCap(new HandleRef(this, NativePen), out lineCap); - SafeNativeMethods.Gdip.CheckStatus(status); - - return CustomLineCap.CreateCustomLineCapObject(lineCap); - } - set - { - if (_immutable) - { - throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); - } - - int status = SafeNativeMethods.Gdip.GdipSetPenCustomStartCap(new HandleRef(this, NativePen), - new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap)); - SafeNativeMethods.Gdip.CheckStatus(status); - } - } - - /// - /// Gets or sets a custom cap style to use at the end of lines drawn with this . - /// - public CustomLineCap CustomEndCap - { - get - { - IntPtr lineCap = IntPtr.Zero; - int status = SafeNativeMethods.Gdip.GdipGetPenCustomEndCap(new HandleRef(this, NativePen), out lineCap); - SafeNativeMethods.Gdip.CheckStatus(status); - - return CustomLineCap.CreateCustomLineCapObject(lineCap); - } - set - { - if (_immutable) - { - throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); - } - - int status = SafeNativeMethods.Gdip.GdipSetPenCustomEndCap(new HandleRef(this, NativePen), - new HandleRef(value, (value == null) ? IntPtr.Zero : value.nativeCap)); - SafeNativeMethods.Gdip.CheckStatus(status); - } - } - /// /// Gets or sets the limit of the thickness of the join on a mitered corner. /// @@ -516,6 +457,12 @@ namespace System.Drawing /// public void MultiplyTransform(Matrix matrix, MatrixOrder order) { + if (matrix.nativeMatrix == IntPtr.Zero) + { + // Disposed matrices should result in a no-op. + return; + } + int status = SafeNativeMethods.Gdip.GdipMultiplyPenTransform(new HandleRef(this, NativePen), new HandleRef(matrix, matrix.nativeMatrix), order); @@ -523,13 +470,13 @@ namespace System.Drawing } /// - /// Translates the local geometrical transform by the specified dimmensions. This method prepends the translation + /// Translates the local geometrical transform by the specified dimensions. This method prepends the translation /// to the transform. /// public void TranslateTransform(float dx, float dy) => TranslateTransform(dx, dy, MatrixOrder.Prepend); /// - /// Translates the local geometrical transform by the specified dimmensions in the specified order. + /// Translates the local geometrical transform by the specified dimensions in the specified order. /// public void TranslateTransform(float dx, float dy, MatrixOrder order) { @@ -623,15 +570,6 @@ namespace System.Drawing Color oldColor = _color; _color = value; InternalSetColor(value); - -#if FEATURE_SYSTEM_EVENTS - // NOTE: We never remove pens from the active list, so if someone is - // changing their pen colors a lot, this could be a problem. - if (value.IsSystemColor && !oldColor.IsSystemColor) - { - SystemColorTracker.Add(this); - } -#endif } } } @@ -734,6 +672,11 @@ namespace System.Drawing { EnsureValidDashPattern(); } + + if (value != DashStyle.Solid) + { + this._dashStyleWasOrIsNotSolid = true; + } } } @@ -780,32 +723,41 @@ namespace System.Drawing } /// - /// Gets or sets an array of cutom dashes and spaces. The dashes are made up of line segments. + /// Gets or sets an array of custom dashes and spaces. The dashes are made up of line segments. /// public float[] DashPattern { get { - int count = 0; - int status = SafeNativeMethods.Gdip.GdipGetPenDashCount(new HandleRef(this, NativePen), out count); + int status = SafeNativeMethods.Gdip.GdipGetPenDashCount(new HandleRef(this, NativePen), out int count); SafeNativeMethods.Gdip.CheckStatus(status); - - // Allocate temporary native memory buffer - // and pass it to GDI+ to retrieve dash array elements. - IntPtr buf = Marshal.AllocHGlobal(checked(4 * count)); - try - { - status = SafeNativeMethods.Gdip.GdipGetPenDashArray(new HandleRef(this, NativePen), buf, count); - SafeNativeMethods.Gdip.CheckStatus(status); - var dashArray = new float[count]; - Marshal.Copy(buf, dashArray, 0, count); - return dashArray; - } - finally + float[] pattern; + // don't call GdipGetPenDashArray with a 0 count + if (count > 0) { - Marshal.FreeHGlobal(buf); + pattern = new float[count]; + status = SafeNativeMethods.Gdip.GdipGetPenDashArray(new HandleRef(this, NativePen), pattern, count); + SafeNativeMethods.Gdip.CheckStatus(status); } + else if (DashStyle == DashStyle.Solid && !this._dashStyleWasOrIsNotSolid) + { + // Most likely we're replicating an existing System.Drawing bug here, it doesn't make much sense to + // ask for a dash pattern when using a solid dash. + throw new OutOfMemoryException(); + } + else if (DashStyle == DashStyle.Solid) + { + pattern = new float[0]; + } + else + { + // special case (not handled inside GDI+) + pattern = new float[1]; + pattern[0] = 1.0f; + } + + return pattern; } set { @@ -820,6 +772,14 @@ namespace System.Drawing throw new ArgumentException(SR.Format(SR.InvalidDashPattern)); } + foreach (float val in value) + { + if (val <= 0) + { + throw new ArgumentException(SR.Format(SR.InvalidDashPattern)); + } + } + int count = value.Length; IntPtr buf = Marshal.AllocHGlobal(checked(4 * count)); @@ -838,7 +798,7 @@ namespace System.Drawing } /// - /// Gets or sets an array of cutom dashes and spaces. The dashes are made up of line segments. + /// Gets or sets an array of custom dashes and spaces. The dashes are made up of line segments. /// public float[] CompoundArray { @@ -861,19 +821,22 @@ namespace System.Drawing throw new ArgumentException(SR.Format(SR.CantChangeImmutableObjects, nameof(Pen))); } + if (value.Length <= 1) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + } + + foreach (float val in value) + { + if (val < 0 || val > 1) + { + throw new ArgumentException(SR.Format(SR.GdiplusInvalidParameter)); + } + } + int status = SafeNativeMethods.Gdip.GdipSetPenCompoundArray(new HandleRef(this, NativePen), value, value.Length); SafeNativeMethods.Gdip.CheckStatus(status); } } - -#if FEATURE_SYSTEM_EVENTS - void ISystemColorTracker.OnSystemColorChanged() - { - if (NativePen != IntPtr.Zero) - { - InternalSetColor(_color); - } - } -#endif } } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.NotSerializable.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.NotSerializable.cs new file mode 100644 index 0000000000..3df9fff78d --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.NotSerializable.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; + +namespace System.Drawing.Printing +{ + partial class InvalidPrinterException + { + protected InvalidPrinterException(SerializationInfo info, StreamingContext context) : base(info, context) + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/LibcupsNative.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/LibcupsNative.cs new file mode 100644 index 0000000000..6d243f7021 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/LibcupsNative.cs @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Text; + +namespace System.Drawing.Printing +{ + internal static class LibcupsNative + { + private const string LibraryName = "libcups"; + private static IntPtr s_libcupsHandle = LoadLibcups(); + + private static IntPtr LoadLibcups() + { + // We allow both "libcups.so" and "libcups.so.2" to be loaded. + IntPtr lib = Interop.Libdl.dlopen("libcups.so", Interop.Libdl.RTLD_NOW); + if (lib == IntPtr.Zero) + { + lib = Interop.Libdl.dlopen("libcups.so.2", Interop.Libdl.RTLD_NOW); + } + + return lib; + } + + private delegate int cupsGetDests_delegate(ref IntPtr dests); + private static FunctionWrapper cupsGetDests_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsGetDests", LibraryName); + internal static int cupsGetDests(ref IntPtr dests) => cupsGetDests_ptr.Delegate(ref dests); + + private delegate int cupsFreeDests_delegate(int num_dests, IntPtr dests); + private static FunctionWrapper cupsFreeDests_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsFreeDests", LibraryName); + internal static void cupsFreeDests(int num_dests, IntPtr dests) => cupsFreeDests_ptr.Delegate(num_dests, dests); + + private delegate IntPtr cupsTempFd_delegate([MarshalAs(UnmanagedType.LPStr)]StringBuilder sb, int len); + private static FunctionWrapper cupsTempFd_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsTempFd", LibraryName); + internal static IntPtr cupsTempFd(StringBuilder sb, int len) => cupsTempFd_ptr.Delegate(sb, len); + + private delegate IntPtr cupsGetDefault_delegate(); + private static FunctionWrapper cupsGetDefault_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsGetDefault", LibraryName); + internal static IntPtr cupsGetDefault() => cupsGetDefault_ptr.Delegate(); + + private delegate int cupsPrintFile_delegate( + [MarshalAs(UnmanagedType.LPStr)]string printer, + [MarshalAs(UnmanagedType.LPStr)]string filename, + [MarshalAs(UnmanagedType.LPStr)]string title, + int num_options, + IntPtr options); + private static FunctionWrapper cupsPrintFile_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsPrintFile", LibraryName); + internal static int cupsPrintFile(string printer, string filename, string title, int num_options, IntPtr options) + => cupsPrintFile_ptr.Delegate(printer, filename, title, num_options, options); + + private delegate IntPtr cupsGetPPD_delegate([MarshalAs(UnmanagedType.LPStr)]string printer); + private static FunctionWrapper cupsGetPPD_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsGetPPD", LibraryName); + internal static IntPtr cupsGetPPD(string printer) => cupsGetPPD_ptr.Delegate(printer); + + private delegate IntPtr ppdOpenFile_delegate([MarshalAs(UnmanagedType.LPStr)]string filename); + private static FunctionWrapper ppdOpenFile_ptr + = FunctionWrapper.Load(s_libcupsHandle, "ppdOpenFile", LibraryName); + internal static IntPtr ppdOpenFile(string filename) => ppdOpenFile_ptr.Delegate(filename); + + private delegate IntPtr ppdFindOption_delegate(IntPtr ppd_file, [MarshalAs(UnmanagedType.LPStr)]string keyword); + private static FunctionWrapper ppdFindOption_ptr + = FunctionWrapper.Load(s_libcupsHandle, "ppdFindOption", LibraryName); + internal static IntPtr ppdFindOption(IntPtr ppd_file, string keyword) => ppdFindOption_ptr.Delegate(ppd_file, keyword); + + private delegate void ppdClose_delegate(IntPtr ppd); + private static FunctionWrapper ppdClose_ptr + = FunctionWrapper.Load(s_libcupsHandle, "ppdClose", LibraryName); + internal static void ppdClose(IntPtr ppd) => ppdClose_ptr.Delegate(ppd); + + private delegate int cupsParseOptions_delegate([MarshalAs(UnmanagedType.LPStr)]string arg, int number_of_options, ref IntPtr options); + private static FunctionWrapper cupsParseOptions_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsParseOptions", LibraryName); + internal static int cupsParseOptions(string arg, int number_of_options, ref IntPtr options) + => cupsParseOptions_ptr.Delegate(arg, number_of_options, ref options); + + private delegate void cupsFreeOptions_delegate(int number_options, IntPtr options); + private static FunctionWrapper cupsFreeOptions_ptr + = FunctionWrapper.Load(s_libcupsHandle, "cupsFreeOptions", LibraryName); + internal static void cupsFreeOptions(int number_options, IntPtr options) => cupsFreeOptions_ptr.Delegate(number_options, options); + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.Unix.cs new file mode 100644 index 0000000000..ca643832cd --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.Unix.cs @@ -0,0 +1,272 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PageSettings.cs +// +// Authors: +// Dennis Hayes (dennish@Raytek.com) +// Herve Poussineau (hpoussineau@fr.st) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2002 Ximian, Inc +// + +// +// Copyright (C) 2004 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.Runtime.InteropServices; + +namespace System.Drawing.Printing +{ + [Serializable] + public class PageSettings : ICloneable + { + internal bool color; + internal bool landscape; + internal PaperSize paperSize; + internal PaperSource paperSource; + internal PrinterResolution printerResolution; + + // create a new default Margins object (is 1 inch for all margins) + Margins margins = new Margins(); +#pragma warning disable 649 + float hardMarginX; + float hardMarginY; + RectangleF printableArea; + PrinterSettings printerSettings; +#pragma warning restore 649 + + public PageSettings() : this(new PrinterSettings()) + { + } + + public PageSettings(PrinterSettings printerSettings) + { + PrinterSettings = printerSettings; + + this.color = printerSettings.DefaultPageSettings.color; + this.landscape = printerSettings.DefaultPageSettings.landscape; + this.paperSize = printerSettings.DefaultPageSettings.paperSize; + this.paperSource = printerSettings.DefaultPageSettings.paperSource; + this.printerResolution = printerSettings.DefaultPageSettings.printerResolution; + } + + // used by PrinterSettings.DefaultPageSettings + internal PageSettings(PrinterSettings printerSettings, bool color, bool landscape, PaperSize paperSize, PaperSource paperSource, PrinterResolution printerResolution) + { + PrinterSettings = printerSettings; + this.color = color; + this.landscape = landscape; + this.paperSize = paperSize; + this.paperSource = paperSource; + this.printerResolution = printerResolution; + } + + //props + public Rectangle Bounds + { + get + { + int width = this.paperSize.Width; + int height = this.paperSize.Height; + + width -= this.margins.Left + this.margins.Right; + height -= this.margins.Top + this.margins.Bottom; + + if (this.landscape) + { + // swap width and height + int tmp = width; + width = height; + height = tmp; + } + return new Rectangle(this.margins.Left, this.margins.Top, width, height); + } + } + + public bool Color + { + get + { + if (!this.printerSettings.IsValid) + throw new InvalidPrinterException(this.printerSettings); + return color; + } + set + { + color = value; + } + } + + public bool Landscape + { + get + { + if (!this.printerSettings.IsValid) + throw new InvalidPrinterException(this.printerSettings); + return landscape; + } + set + { + landscape = value; + } + } + + public Margins Margins + { + get + { + if (!this.printerSettings.IsValid) + throw new InvalidPrinterException(this.printerSettings); + return margins; + } + set + { + margins = value; + } + } + + public PaperSize PaperSize + { + get + { + if (!this.printerSettings.IsValid) + throw new InvalidPrinterException(this.printerSettings); + return paperSize; + } + set + { + if (value != null) + paperSize = value; + } + } + + public PaperSource PaperSource + { + get + { + if (!this.printerSettings.IsValid) + throw new InvalidPrinterException(this.printerSettings); + return paperSource; + } + set + { + if (value != null) + paperSource = value; + } + } + + public PrinterResolution PrinterResolution + { + get + { + if (!this.printerSettings.IsValid) + throw new InvalidPrinterException(this.printerSettings); + return printerResolution; + } + set + { + if (value != null) + printerResolution = value; + } + } + + public PrinterSettings PrinterSettings + { + get + { + return printerSettings; + } + set + { + printerSettings = value; + } + } + public float HardMarginX + { + get + { + return hardMarginX; + } + } + + public float HardMarginY + { + get + { + return hardMarginY; + } + } + + public RectangleF PrintableArea + { + get + { + return printableArea; + } + } + + + public object Clone() + { + // We do a deep copy + PrinterResolution pres = new PrinterResolution(this.printerResolution.Kind, this.printerResolution.X, this.printerResolution.Y); + PaperSource psource = new PaperSource(this.paperSource.Kind, this.paperSource.SourceName); + PaperSize psize = new PaperSize(this.paperSize.PaperName, this.paperSize.Width, this.paperSize.Height); + psize.RawKind = (int)this.paperSize.Kind; + + PageSettings ps = new PageSettings(this.printerSettings, this.color, this.landscape, + psize, psource, pres); + ps.Margins = (Margins)this.margins.Clone(); + return ps; + } + + + [MonoTODO("PageSettings.CopyToHdevmode")] + public void CopyToHdevmode(IntPtr hdevmode) + { + throw new NotImplementedException(); + } + + + [MonoTODO("PageSettings.SetHdevmode")] + public void SetHdevmode(IntPtr hdevmode) + { + throw new NotImplementedException(); + } + + public override string ToString() + { + string ret = "[PageSettings: Color={0}"; + ret += ", Landscape={1}"; + ret += ", Margins={2}"; + ret += ", PaperSize={3}"; + ret += ", PaperSource={4}"; + ret += ", PrinterResolution={5}"; + ret += "]"; + + return String.Format(ret, this.color, this.landscape, this.margins, this.paperSize, this.paperSource, this.printerResolution); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PageSettings.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.Unix.cs new file mode 100644 index 0000000000..7514415d1e --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.Unix.cs @@ -0,0 +1,108 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PreviewPrintController.cs +// +// Author: +// Dennis Hayes (dennish@Raytek.com) +// +// (C) 2002 Ximian, Inc +// + +// +// Copyright (C) 2004 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.Collections; +using System.Drawing.Imaging; + +namespace System.Drawing.Printing +{ + public class PreviewPrintController : PrintController + { + bool useantialias; + ArrayList pageInfoList; + + public PreviewPrintController() + { + pageInfoList = new ArrayList(); + } + public override bool IsPreview + { + get { return true; } + } + + [MonoTODO] + public override void OnEndPage(PrintDocument document, PrintPageEventArgs e) + { + } + + [MonoTODO] + public override void OnStartPrint(PrintDocument document, PrintEventArgs e) + { + if (!document.PrinterSettings.IsValid) + throw new InvalidPrinterException(document.PrinterSettings); + + /* maybe we should reuse the images, and clear them? */ + foreach (PreviewPageInfo pi in pageInfoList) + pi.Image.Dispose(); + + pageInfoList.Clear(); + } + + [MonoTODO] + public override void OnEndPrint(PrintDocument document, PrintEventArgs e) + { + } + + [MonoTODO] + public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e) + { + Image image = new Bitmap(e.PageSettings.PaperSize.Width, e.PageSettings.PaperSize.Height); + + PreviewPageInfo info = new PreviewPageInfo(image, new Size(e.PageSettings.PaperSize.Width, + e.PageSettings.PaperSize.Height)); + + pageInfoList.Add(info); + + Graphics g = Graphics.FromImage(info.Image); + g.FillRectangle(new SolidBrush(Color.White), new Rectangle(new Point(0, 0), new Size(image.Width, image.Height))); + + return g; + } + + public virtual bool UseAntiAlias + { + get { return useantialias; } + set { useantialias = value; } + } + + public PreviewPageInfo[] GetPreviewPageInfo() + { + PreviewPageInfo[] pi = new PreviewPageInfo[pageInfoList.Count]; + pageInfoList.CopyTo(pi); + return pi; + } + + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPrintController.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Unix.cs new file mode 100644 index 0000000000..b9c482f067 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Unix.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PrintController.cs +// +// Author: +// Dennis Hayes (dennish@Raytek.com) +// +// (C) 2002 Ximian, Inc +// Copyright (C) 2004, 2006 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. +// + +namespace System.Drawing.Printing +{ + + public abstract class PrintController + { + + public virtual bool IsPreview + { + get { return false; } + } + public virtual void OnEndPage(PrintDocument document, PrintPageEventArgs e) + { + } + + public virtual void OnStartPrint(PrintDocument document, PrintEventArgs e) + { + } + + public virtual void OnEndPrint(PrintDocument document, PrintEventArgs e) + { + } + + public virtual Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e) + { + return null; + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Unix.cs new file mode 100644 index 0000000000..6c3a8e40ac --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Unix.cs @@ -0,0 +1,239 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PrintDocument.cs +// +// Authors: +// Dennis Hayes (dennish@Raytek.com) +// Herve Poussineau (hpoussineau@fr.st) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2002 Ximian, Inc +// + +// +// Copyright (C) 2004 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.ComponentModel; + +namespace System.Drawing.Printing +{ +#if !NETCORE + [DefaultEvent ("PrintPage"), DefaultProperty ("DocumentName")] + [ToolboxItemFilter ("System.Drawing.Printing", ToolboxItemFilterType.Allow)] +#endif + public class PrintDocument : System.ComponentModel.Component + { + private PageSettings defaultpagesettings; + private PrinterSettings printersettings; + private PrintController printcontroller; + private string documentname; + private bool originAtMargins = false; // .NET V1.1 Beta + + public PrintDocument() + { + documentname = "document"; //offical default. + printersettings = new PrinterSettings(); // use default values + defaultpagesettings = (PageSettings)printersettings.DefaultPageSettings.Clone(); + printcontroller = new StandardPrintController(); + } + + // properties + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [Browsable(false)] + [SRDescription("The settings for the current page.")] + public PageSettings DefaultPageSettings + { + get + { + return defaultpagesettings; + } + set + { + defaultpagesettings = value; + } + } + + // Name of the document, not the file! + [DefaultValue("document")] + [SRDescription("The name of the document.")] + public string DocumentName + { + get + { + return documentname; + } + set + { + documentname = value; + } + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [Browsable(false)] + [SRDescription("The print controller object.")] + public PrintController PrintController + { + get + { + return printcontroller; + } + set + { + printcontroller = value; + } + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + [Browsable(false)] + [SRDescription("The current settings for the active printer.")] + public PrinterSettings PrinterSettings + { + get + { + return printersettings; + } + set + { + printersettings = value == null ? new PrinterSettings() : value; + } + } + + [DefaultValue(false)] + [SRDescription("Determines if the origin is set at the specified margins.")] + public bool OriginAtMargins + { + get + { + return originAtMargins; + } + set + { + originAtMargins = value; + } + } + + // methods + public void Print() + { + PrintEventArgs printArgs = new PrintEventArgs(); + this.OnBeginPrint(printArgs); + if (printArgs.Cancel) + return; + PrintController.OnStartPrint(this, printArgs); + if (printArgs.Cancel) + return; + + Graphics g = null; + + if (printArgs.GraphicsContext != null) + { + g = Graphics.FromHdc(printArgs.GraphicsContext.Hdc); + printArgs.GraphicsContext.Graphics = g; + } + + // while there are more pages + PrintPageEventArgs printPageArgs; + do + { + QueryPageSettingsEventArgs queryPageSettingsArgs = new QueryPageSettingsEventArgs( + DefaultPageSettings.Clone() as PageSettings); + OnQueryPageSettings(queryPageSettingsArgs); + + PageSettings pageSettings = queryPageSettingsArgs.PageSettings; + printPageArgs = new PrintPageEventArgs( + g, + pageSettings.Bounds, + new Rectangle(0, 0, pageSettings.PaperSize.Width, pageSettings.PaperSize.Height), + pageSettings); + + // TODO: We should create a graphics context for each page since they can have diferent paper + // size, orientation, etc. We use a single graphic for now to keep Cairo using a single PDF file. + + printPageArgs.GraphicsContext = printArgs.GraphicsContext; + Graphics pg = PrintController.OnStartPage(this, printPageArgs); + + // assign Graphics in printPageArgs + printPageArgs.SetGraphics(pg); + + if (!printPageArgs.Cancel) + this.OnPrintPage(printPageArgs); + + PrintController.OnEndPage(this, printPageArgs); + if (printPageArgs.Cancel) + break; + } while (printPageArgs.HasMorePages); + + this.OnEndPrint(printArgs); + PrintController.OnEndPrint(this, printArgs); + } + + public override string ToString() + { + return "[PrintDocument " + this.DocumentName + "]"; + } + + // events + protected virtual void OnBeginPrint(PrintEventArgs e) + { + //fire the event + if (BeginPrint != null) + BeginPrint(this, e); + } + + protected virtual void OnEndPrint(PrintEventArgs e) + { + //fire the event + if (EndPrint != null) + EndPrint(this, e); + } + + protected virtual void OnPrintPage(PrintPageEventArgs e) + { + //fire the event + if (PrintPage != null) + PrintPage(this, e); + } + + protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e) + { + //fire the event + if (QueryPageSettings != null) + QueryPageSettings(this, e); + } + + [SRDescription("Raised when printing begins")] + public event PrintEventHandler BeginPrint; + + [SRDescription("Raised when printing ends")] + public event PrintEventHandler EndPrint; + + [SRDescription("Raised when printing of a new page begins")] + public event PrintPageEventHandler PrintPage; + + [SRDescription("Raised before printing of a new page begins")] + public event QueryPageSettingsEventHandler QueryPageSettings; + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintDocument.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventArgs.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventArgs.Unix.cs new file mode 100644 index 0000000000..0ea43bbd92 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventArgs.Unix.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PrintEventArgs.cs +// +// Author: +// Dennis Hayes (dennish@Raytek.com) +// +// (C) 2002 Ximian, Inc +// + +// +// Copyright (C) 2004 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; +//NOTE: Complete! Aparently just a redifiniton of CancleEventArgs specific to Printing. +namespace System.Drawing.Printing +{ + /// + /// Summary description for PrintEventArgs. + /// + public class PrintEventArgs : System.ComponentModel.CancelEventArgs + { + private GraphicsPrinter graphics_context; + private PrintAction action; + + public PrintEventArgs() + { + } + + internal PrintEventArgs(PrintAction action) + { + this.action = action; + } + + public PrintAction PrintAction + { + get { return action; } + } + + internal GraphicsPrinter GraphicsContext + { + get { return graphics_context; } + set { graphics_context = value; } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEvent.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventArgs.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEvent.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventArgs.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventArgs.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventArgs.Unix.cs new file mode 100644 index 0000000000..73a42bb5fc --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventArgs.Unix.cs @@ -0,0 +1,123 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PrintPageEventArgs.cs +// +// Author: +// Dennis Hayes (dennish@Raytek.com) +// Herve Poussineau (hpoussineau@fr.st) +// +// (C) 2002 Ximian, Inc +// + +// +// Copyright (C) 2004 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.Drawing; +namespace System.Drawing.Printing +{ + /// + /// Summary description for PrintPageEventArgs. + /// + public class PrintPageEventArgs : EventArgs + { + bool cancel; + Graphics graphics; + bool hasmorePages; + Rectangle marginBounds; + Rectangle pageBounds; + PageSettings pageSettings; + GraphicsPrinter graphics_context; + + public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds, + Rectangle pageBounds, PageSettings pageSettings) + { + this.graphics = graphics; + this.marginBounds = marginBounds; + this.pageBounds = pageBounds; + this.pageSettings = pageSettings; + } + public bool Cancel + { + get + { + return cancel; + } + set + { + cancel = value; + } + } + public Graphics Graphics + { + get + { + return graphics; + } + } + public bool HasMorePages + { + get + { + return hasmorePages; + } + set + { + hasmorePages = value; + } + } + public Rectangle MarginBounds + { + get + { + return marginBounds; + } + } + public Rectangle PageBounds + { + get + { + return pageBounds; + } + } + public PageSettings PageSettings + { + get + { + return pageSettings; + } + } + + // used in PrintDocument.Print() + internal void SetGraphics(Graphics g) + { + graphics = g; + } + + internal GraphicsPrinter GraphicsContext + { + get { return graphics_context; } + set { graphics_context = value; } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEvent.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventArgs.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEvent.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventArgs.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs index 24f3a89d8a..bebe3a9921 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPreviewGraphics.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; namespace System.Drawing { /// - /// Retrives the printer graphics during preview. + /// Retrieves the printer graphics during preview. /// internal class PrintPreviewGraphics { diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Unix.cs new file mode 100644 index 0000000000..337713c187 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Unix.cs @@ -0,0 +1,571 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.PrinterSettings.cs +// +// Authors: +// Dennis Hayes (dennish@Raytek.com) +// Herve Poussineau (hpoussineau@fr.st) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2002 Ximian, Inc +// Copyright (C) 2004,2006 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.Runtime.InteropServices; +using System.Collections; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Drawing.Imaging; + +namespace System.Drawing.Printing +{ + [Serializable] + public class PrinterSettings : ICloneable + { + private string printer_name; + private string print_filename; + private short copies; + private int maximum_page; + private int minimum_page; + private int from_page; + private int to_page; + private bool collate; + private PrintRange print_range; + internal int maximum_copies; + internal bool can_duplex; + internal bool supports_color; + internal int landscape_angle; + private bool print_tofile; + internal PrinterSettings.PrinterResolutionCollection printer_resolutions; + internal PrinterSettings.PaperSizeCollection paper_sizes; + internal PrinterSettings.PaperSourceCollection paper_sources; + private PageSettings default_pagesettings; + private Duplex duplex; + internal bool is_plotter; + + internal NameValueCollection printer_capabilities; // this stores a list of all the printer options. Used only in cups, but might come in handy on win too. + + public PrinterSettings() + { + printer_name = PrintingServices.DefaultPrinter; + ResetToDefaults(); + PrintingServices.LoadPrinterSettings(printer_name, this); + } + + private void ResetToDefaults() + { + printer_resolutions = null; + paper_sizes = null; + paper_sources = null; + default_pagesettings = null; + maximum_page = 9999; + copies = 1; + collate = true; + } + + //properties + + public bool CanDuplex + { + get { return can_duplex; } + } + + public bool Collate + { + get { return collate; } + set { collate = value; } + } + + public short Copies + { + get { return copies; } + set + { + if (value < 0) + throw new ArgumentException("The value of the Copies property is less than zero."); + + copies = value; + } + } + + public PageSettings DefaultPageSettings + { + get + { + if (default_pagesettings == null) + { + default_pagesettings = new PageSettings(this, + SupportsColor, + false, + // Real defaults are set by LoadPrinterSettings + new PaperSize("A4", 827, 1169), + new PaperSource(PaperSourceKind.FormSource, "Tray"), + new PrinterResolution(PrinterResolutionKind.Medium, 200, 200)); + } + + return default_pagesettings; + } + } + + public Duplex Duplex + { + get { return this.duplex; } + set { this.duplex = value; } + } + + public int FromPage + { + get { return from_page; } + set + { + if (value < 0) + throw new ArgumentException("The value of the FromPage property is less than zero"); + + from_page = value; + } + } + + public static PrinterSettings.StringCollection InstalledPrinters + { + get { return PrintingServices.InstalledPrinters; } + } + + public bool IsDefaultPrinter + { + get { return (printer_name == PrintingServices.DefaultPrinter); } + } + + public bool IsPlotter + { + get { return is_plotter; } + } + + public bool IsValid + { + get { return PrintingServices.IsPrinterValid(this.printer_name); } + } + + public int LandscapeAngle + { + get { return landscape_angle; } + } + + public int MaximumCopies + { + get { return maximum_copies; } + } + + public int MaximumPage + { + get { return maximum_page; } + set + { + // This not documented but behaves like MinimumPage + if (value < 0) + throw new ArgumentException("The value of the MaximumPage property is less than zero"); + + maximum_page = value; + } + } + + public int MinimumPage + { + get { return minimum_page; } + set + { + if (value < 0) + throw new ArgumentException("The value of the MaximumPage property is less than zero"); + + minimum_page = value; + } + } + + public PrinterSettings.PaperSizeCollection PaperSizes + { + get + { + if (!this.IsValid) + throw new InvalidPrinterException(this); + + return paper_sizes; + } + } + + public PrinterSettings.PaperSourceCollection PaperSources + { + get + { + if (!this.IsValid) + throw new InvalidPrinterException(this); + + return paper_sources; + } + } + public + string PrintFileName + { + get { return print_filename; } + set { print_filename = value; } + } + public string PrinterName + { + get { return printer_name; } + set + { + if (printer_name == value) + return; + + printer_name = value; + PrintingServices.LoadPrinterSettings(printer_name, this); + } + } + + public PrinterSettings.PrinterResolutionCollection PrinterResolutions + { + get + { + if (!this.IsValid) + throw new InvalidPrinterException(this); + + if (printer_resolutions == null) + { + printer_resolutions = new PrinterSettings.PrinterResolutionCollection(new PrinterResolution[] { }); + PrintingServices.LoadPrinterResolutions(printer_name, this); + } + + return printer_resolutions; + } + } + + public PrintRange PrintRange + { + get { return print_range; } + set + { + if (value != PrintRange.AllPages && value != PrintRange.Selection && + value != PrintRange.SomePages) + throw new InvalidEnumArgumentException("The value of the PrintRange property is not one of the PrintRange values"); + + print_range = value; + } + } + + public bool PrintToFile + { + get { return print_tofile; } + set { print_tofile = value; } + } + + public bool SupportsColor + { + get { return supports_color; } + } + + public int ToPage + { + get { return to_page; } + set + { + if (value < 0) + throw new ArgumentException("The value of the ToPage property is less than zero"); + + to_page = value; + } + } + + internal NameValueCollection PrinterCapabilities + { + get + { + if (this.printer_capabilities == null) + this.printer_capabilities = new NameValueCollection(); + return this.printer_capabilities; + } + } + + //methods + public object Clone() + { + PrinterSettings ps = new PrinterSettings(); + return ps; + } + + [MonoTODO("PrinterSettings.CreateMeasurementGraphics")] + public Graphics CreateMeasurementGraphics() + { + throw new NotImplementedException(); + } + [MonoTODO("PrinterSettings.CreateMeasurementGraphics")] + public Graphics CreateMeasurementGraphics(bool honorOriginAtMargins) + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.CreateMeasurementGraphics")] + public Graphics CreateMeasurementGraphics(PageSettings pageSettings) + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.CreateMeasurementGraphics")] + public Graphics CreateMeasurementGraphics(PageSettings pageSettings, bool honorOriginAtMargins) + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.GetHdevmode")] + public IntPtr GetHdevmode() + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.GetHdevmode")] + public IntPtr GetHdevmode(PageSettings pageSettings) + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.GetHdevname")] + public IntPtr GetHdevnames() + { + throw new NotImplementedException(); + } + + + [MonoTODO("IsDirectPrintingSupported")] + public bool IsDirectPrintingSupported(Image image) + { + throw new NotImplementedException(); + } + + [MonoTODO("IsDirectPrintingSupported")] + public bool IsDirectPrintingSupported(ImageFormat imageFormat) + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.SetHdevmode")] + public void SetHdevmode(IntPtr hdevmode) + { + throw new NotImplementedException(); + } + + [MonoTODO("PrinterSettings.SetHdevnames")] + public void SetHdevnames(IntPtr hdevnames) + { + throw new NotImplementedException(); + } + + public override string ToString() + { + return "Printer [PrinterSettings " + printer_name + " Copies=" + copies + " Collate=" + collate + + " Duplex=" + can_duplex + " FromPage=" + from_page + " LandscapeAngle=" + landscape_angle + + " MaximumCopies=" + maximum_copies + " OutputPort=" + " ToPage=" + to_page + "]"; + + } + + // Public subclasses + #region Public Subclasses + + + public class PaperSourceCollection : ICollection, IEnumerable + { + ArrayList _PaperSources = new ArrayList(); + + public PaperSourceCollection(PaperSource[] array) + { + foreach (PaperSource ps in array) + _PaperSources.Add(ps); + } + + public int Count { get { return _PaperSources.Count; } } + int ICollection.Count { get { return _PaperSources.Count; } } + bool ICollection.IsSynchronized { get { return false; } } + object ICollection.SyncRoot { get { return this; } } + [EditorBrowsable(EditorBrowsableState.Never)] + public int Add(PaperSource paperSource) { return _PaperSources.Add(paperSource); } + public void CopyTo(PaperSource[] paperSources, int index) { throw new NotImplementedException(); } + + public virtual PaperSource this[int index] + { + get { return _PaperSources[index] as PaperSource; } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _PaperSources.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return _PaperSources.GetEnumerator(); + } + + void ICollection.CopyTo(Array array, int index) + { + _PaperSources.CopyTo(array, index); + } + + internal void Clear() + { + _PaperSources.Clear(); + } + + } + + public class PaperSizeCollection : ICollection, IEnumerable + { + ArrayList _PaperSizes = new ArrayList(); + + public PaperSizeCollection(PaperSize[] array) + { + foreach (PaperSize ps in array) + _PaperSizes.Add(ps); + } + + public int Count { get { return _PaperSizes.Count; } } + int ICollection.Count { get { return _PaperSizes.Count; } } + bool ICollection.IsSynchronized { get { return false; } } + object ICollection.SyncRoot { get { return this; } } + [EditorBrowsable(EditorBrowsableState.Never)] + public int Add(PaperSize paperSize) { return _PaperSizes.Add(paperSize); } + public void CopyTo(PaperSize[] paperSizes, int index) { throw new NotImplementedException(); } + + public virtual PaperSize this[int index] + { + get { return _PaperSizes[index] as PaperSize; } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _PaperSizes.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return _PaperSizes.GetEnumerator(); + } + + void ICollection.CopyTo(Array array, int index) + { + _PaperSizes.CopyTo(array, index); + } + + internal void Clear() + { + _PaperSizes.Clear(); + } + } + + public class PrinterResolutionCollection : ICollection, IEnumerable + { + ArrayList _PrinterResolutions = new ArrayList(); + + public PrinterResolutionCollection(PrinterResolution[] array) + { + foreach (PrinterResolution pr in array) + _PrinterResolutions.Add(pr); + } + + public int Count { get { return _PrinterResolutions.Count; } } + int ICollection.Count { get { return _PrinterResolutions.Count; } } + bool ICollection.IsSynchronized { get { return false; } } + object ICollection.SyncRoot { get { return this; } } + [EditorBrowsable(EditorBrowsableState.Never)] + public int Add(PrinterResolution printerResolution) { return _PrinterResolutions.Add(printerResolution); } + public void CopyTo(PrinterResolution[] printerResolutions, int index) { throw new NotImplementedException(); } + + public virtual PrinterResolution this[int index] + { + get { return _PrinterResolutions[index] as PrinterResolution; } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _PrinterResolutions.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return _PrinterResolutions.GetEnumerator(); + } + + void ICollection.CopyTo(Array array, int index) + { + _PrinterResolutions.CopyTo(array, index); + } + + internal void Clear() + { + _PrinterResolutions.Clear(); + } + } + + public class StringCollection : ICollection, IEnumerable + { + ArrayList _Strings = new ArrayList(); + + public StringCollection(string[] array) + { + foreach (string s in array) + _Strings.Add(s); + } + + public int Count { get { return _Strings.Count; } } + int ICollection.Count { get { return _Strings.Count; } } + bool ICollection.IsSynchronized { get { return false; } } + object ICollection.SyncRoot { get { return this; } } + + public virtual string this[int index] + { + get { return _Strings[index] as string; } + } + [EditorBrowsable(EditorBrowsableState.Never)] + public int Add(string value) { return _Strings.Add(value); } + public void CopyTo(string[] strings, int index) { throw new NotImplementedException(); } + + IEnumerator IEnumerable.GetEnumerator() + { + return _Strings.GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return _Strings.GetEnumerator(); + } + + void ICollection.CopyTo(Array array, int index) + { + _Strings.CopyTo(array, index); + } + } + + #endregion + /* + void GetPrintDialogInfo (string printer_name, ref string port, ref string type, ref string status, ref string comment) + { + printing_services.GetPrintDialogInfo (printer_name, ref port, ref type, ref status, ref comment); + } + */ + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs new file mode 100644 index 0000000000..ccc03bea84 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs @@ -0,0 +1,1710 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing.Imaging; +using System.Drawing.Internal; +using System.Globalization; +using System.IO; +using System.Runtime.InteropServices; + +namespace System.Drawing.Printing +{ + /// + /// Information about how a document should be printed, including which printer to print it on. + /// + public partial class PrinterSettings : ICloneable + { + // All read/write data is stored in managed code, and whenever we need to call Win32, + // we create new DEVMODE and DEVNAMES structures. We don't store device capabilities, + // though. + // + // Also, all properties have hidden tri-state logic -- yes/no/default + private const int Padding64Bit = 4; + + private string _printerName; // default printer. + private string _driverName = ""; + private string _outputPort = ""; + private bool _printToFile; + + // Whether the PrintDialog has been shown (not whether it's currently shown). This is how we enforce SafePrinting. + private bool _printDialogDisplayed; + + private short _extrabytes; + private byte[] _extrainfo; + + private short _copies = -1; + private Duplex _duplex = System.Drawing.Printing.Duplex.Default; + private TriState _collate = TriState.Default; + private PageSettings _defaultPageSettings; + private int _fromPage; + private int _toPage; + private int _maxPage = 9999; + private int _minPage; + private PrintRange _printRange; + + private short _devmodebytes; + private byte[] _cachedDevmode; + + /// + /// Initializes a new instance of the class. + /// + public PrinterSettings() + { + _defaultPageSettings = new PageSettings(this); + } + + /// + /// Gets a value indicating whether the printer supports duplex (double-sided) printing. + /// + public bool CanDuplex + { + get { return DeviceCapabilities(SafeNativeMethods.DC_DUPLEX, IntPtr.Zero, 0) == 1; } + } + + /// + /// Gets or sets the number of copies to print. + /// + public short Copies + { + get + { + if (_copies != -1) + return _copies; + else + return GetModeField(ModeField.Copies, 1); + } + set + { + if (value < 0) + throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, + "value", value.ToString(CultureInfo.CurrentCulture), + (0).ToString(CultureInfo.CurrentCulture))); + /* + We shouldnt allow copies to be set since the copies can be a large number + and can be reflected in PrintDialog. So for the Copies property, + we prefer that for SafePrinting, copied cannot be set programmatically + but through the print dialog. + Any lower security could set copies to anything. + */ + _copies = value; + } + } + + /// + /// Gets or sets a value indicating whether the print out is collated. + /// + public bool Collate + { + get + { + if (!_collate.IsDefault) + return (bool)_collate; + else + return GetModeField(ModeField.Collate, SafeNativeMethods.DMCOLLATE_FALSE) == SafeNativeMethods.DMCOLLATE_TRUE; + } + set { _collate = value; } + } + + /// + /// Gets the default page settings for this printer. + /// + public PageSettings DefaultPageSettings + { + get { return _defaultPageSettings; } + } + + // As far as I can tell, Windows no longer pays attention to driver names and output ports. + // But I'm leaving this code in place in case I'm wrong. + internal string DriverName + { + get { return _driverName; } + } + + /// + /// Gets or sets the printer's duplex setting. + /// + public Duplex Duplex + { + get + { + if (_duplex != Duplex.Default) + { + return _duplex; + } + + return (Duplex)GetModeField(ModeField.Duplex, SafeNativeMethods.DMDUP_SIMPLEX); + } + set + { + if (value < Duplex.Default || value > Duplex.Horizontal) + { + throw new InvalidEnumArgumentException(nameof(value), unchecked((int)value), typeof(Duplex)); + } + + _duplex = value; + } + } + + /// + /// Gets or sets the first page to print. + /// + public int FromPage + { + get { return _fromPage; } + set + { + if (value < 0) + throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, + "value", value.ToString(CultureInfo.CurrentCulture), + (0).ToString(CultureInfo.CurrentCulture))); + _fromPage = value; + } + } + + + + /// + /// Gets the names of all printers installed on the machine. + /// + public static StringCollection InstalledPrinters + { + get + { + int sizeofstruct; + // Note: The call to get the size of the buffer required for level 5 does not work properly on NT platforms. + const int Level = 4; + // PRINTER_INFO_4 is 12 or 24 bytes in size depending on the architecture. + if (IntPtr.Size == 8) + { + sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1) + Padding64Bit; + } + else + { + sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1); + } + + int bufferSize; + int count; + SafeNativeMethods.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, null, Level, IntPtr.Zero, 0, out bufferSize, out count); + + IntPtr buffer = Marshal.AllocCoTaskMem(bufferSize); + int returnCode = SafeNativeMethods.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, + null, Level, buffer, + bufferSize, out bufferSize, out count); + var array = new string[count]; + + if (returnCode == 0) + { + Marshal.FreeCoTaskMem(buffer); + throw new Win32Exception(); + } + + for (int i = 0; i < count; i++) + { + // The printer name is at offset 0 + // + IntPtr namePointer = (IntPtr)Marshal.ReadIntPtr((IntPtr)(checked((long)buffer + i * sizeofstruct))); + array[i] = Marshal.PtrToStringAuto(namePointer); + } + + Marshal.FreeCoTaskMem(buffer); + + return new StringCollection(array); + } + } + + /// + /// Gets a value indicating whether the property designates the default printer. + /// + public bool IsDefaultPrinter + { + get + { + return (_printerName == null || _printerName == GetDefaultPrinterName()); + } + } + + /// + /// Gets a value indicating whether the printer is a plotter, as opposed to a raster printer. + /// + public bool IsPlotter + { + get + { + return GetDeviceCaps(SafeNativeMethods.TECHNOLOGY, SafeNativeMethods.DT_RASPRINTER) == SafeNativeMethods.DT_PLOTTER; + } + } + + /// + /// Gets a value indicating whether the property designates a valid printer. + /// + public bool IsValid + { + get + { + return DeviceCapabilities(SafeNativeMethods.DC_COPIES, IntPtr.Zero, -1) != -1; + } + } + + /// + /// Gets the angle, in degrees, which the portrait orientation is rotated to produce the landscape orientation. + /// + public int LandscapeAngle + { + get { return DeviceCapabilities(SafeNativeMethods.DC_ORIENTATION, IntPtr.Zero, 0); } + } + + /// + /// Gets the maximum number of copies allowed by the printer. + /// + public int MaximumCopies + { + get { return DeviceCapabilities(SafeNativeMethods.DC_COPIES, IntPtr.Zero, 1); } + } + + /// + /// Gets or sets the highest or which may be selected in a print dialog box. + /// + public int MaximumPage + { + get { return _maxPage; } + set + { + if (value < 0) + throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, + "value", value.ToString(CultureInfo.CurrentCulture), + (0).ToString(CultureInfo.CurrentCulture))); + _maxPage = value; + } + } + + /// + /// Gets or sets the lowest or which may be selected in a print dialog box. + /// + public int MinimumPage + { + get { return _minPage; } + set + { + if (value < 0) + throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, + "value", value.ToString(CultureInfo.CurrentCulture), + (0).ToString(CultureInfo.CurrentCulture))); + _minPage = value; + } + } + + internal string OutputPort + { + get + { + return _outputPort; + } + set + { + _outputPort = value; + } + } + + /// + /// Indicates the name of the printerfile. + /// + public string PrintFileName + { + get + { + string printFileName = OutputPort; + return printFileName; + } + set + { + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException(value); + } + OutputPort = value; + } + } + + /// + /// Gets the paper sizes supported by this printer. + /// + public PaperSizeCollection PaperSizes + { + get { return new PaperSizeCollection(Get_PaperSizes()); } + } + + /// + /// Gets the paper sources available on this printer. + /// + public PaperSourceCollection PaperSources + { + get { return new PaperSourceCollection(Get_PaperSources()); } + } + + /// + /// Whether the print dialog has been displayed. In SafePrinting mode, a print dialog is required to print. + /// After printing, this property is set to false if the program does not have AllPrinting; this guarantees + /// a document is only printed once each time the print dialog is shown. + /// + internal bool PrintDialogDisplayed + { + get + { + return _printDialogDisplayed; + } + + set + { + _printDialogDisplayed = value; + } + } + + /// + /// Gets or sets the pages the user has asked to print. + /// + public PrintRange PrintRange + { + get { return _printRange; } + set + { + if (!Enum.IsDefined(typeof(PrintRange), value)) + throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(PrintRange)); + + _printRange = value; + } + } + + /// + /// Indicates whether to print to a file instead of a port. + /// + public bool PrintToFile + { + get + { + return _printToFile; + } + set + { + _printToFile = value; + } + } + + /// + /// Gets or sets the name of the printer. + /// + public string PrinterName + { + get + { + return PrinterNameInternal; + } + + set + { + PrinterNameInternal = value; + } + } + + private string PrinterNameInternal + { + get + { + if (_printerName == null) + return GetDefaultPrinterName(); + else + return _printerName; + } + set + { + // Reset the DevMode and Extrabytes... + _cachedDevmode = null; + _extrainfo = null; + _printerName = value; + // PrinterName can be set through a fulltrusted assembly without using the PrintDialog. + // So dont set this variable here. + //PrintDialogDisplayed = true; + } + } + + /// + /// Gets the resolutions supported by this printer. + /// + public PrinterResolutionCollection PrinterResolutions + { + get { return new PrinterResolutionCollection(Get_PrinterResolutions()); } + } + + /// + /// If the image is a JPEG or a PNG (Image.RawFormat) and the printer returns true from + /// ExtEscape(CHECKJPEGFORMAT) or ExtEscape(CHECKPNGFORMAT) then this function returns true. + /// + public bool IsDirectPrintingSupported(ImageFormat imageFormat) + { + bool isDirectPrintingSupported = false; + if (imageFormat.Equals(ImageFormat.Jpeg) || imageFormat.Equals(ImageFormat.Png)) + { + int nEscape = imageFormat.Equals(ImageFormat.Jpeg) ? SafeNativeMethods.CHECKJPEGFORMAT : SafeNativeMethods.CHECKPNGFORMAT; + int outData = 0; + DeviceContext dc = CreateInformationContext(DefaultPageSettings); + HandleRef hdc = new HandleRef(dc, dc.Hdc); + try + { + isDirectPrintingSupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0; + } + finally + { + dc.Dispose(); + } + } + return isDirectPrintingSupported; + } + + /// + /// This method utilizes the CHECKJPEGFORMAT/CHECKPNGFORMAT printer escape functions + /// to determine whether the printer can handle a JPEG image. + /// + /// If the image is a JPEG or a PNG (Image.RawFormat) and the printer returns true + /// from ExtEscape(CHECKJPEGFORMAT) or ExtEscape(CHECKPNGFORMAT) then this function returns true. + /// + public bool IsDirectPrintingSupported(Image image) + { + bool isDirectPrintingSupported = false; + if (image.RawFormat.Equals(ImageFormat.Jpeg) || image.RawFormat.Equals(ImageFormat.Png)) + { + MemoryStream stream = new MemoryStream(); + try + { + image.Save(stream, image.RawFormat); + stream.Position = 0; + using (BufferedStream inStream = new BufferedStream(stream)) + { + int pvImageLen = (int)inStream.Length; + byte[] pvImage = new byte[pvImageLen]; + + int nRead = inStream.Read(pvImage, 0, (int)pvImageLen); + + int nEscape = image.RawFormat.Equals(ImageFormat.Jpeg) ? SafeNativeMethods.CHECKJPEGFORMAT : SafeNativeMethods.CHECKPNGFORMAT; + int outData = 0; + + DeviceContext dc = CreateInformationContext(DefaultPageSettings); + HandleRef hdc = new HandleRef(dc, dc.Hdc); + try + { + bool querySupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0; + if (querySupported) + { + isDirectPrintingSupported = (SafeNativeMethods.ExtEscape(hdc, nEscape, pvImageLen, pvImage, Marshal.SizeOf(typeof(int)), out outData) > 0) + && (outData == 1); + } + } + finally + { + dc.Dispose(); + } + } + } + finally + { + stream.Close(); + } + } + return isDirectPrintingSupported; + } + + /// + /// Gets a value indicating whether the printer supports color printing. + /// + public bool SupportsColor + { + get + { + return GetDeviceCaps(SafeNativeMethods.BITSPIXEL, 1) > 1; + } + } + + /// + /// Gets or sets the last page to print. + /// + public int ToPage + { + get { return _toPage; } + set + { + if (value < 0) + throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, + "value", value.ToString(CultureInfo.CurrentCulture), + (0).ToString(CultureInfo.CurrentCulture))); + _toPage = value; + } + } + + /// + /// Creates an identical copy of this object. + /// + public object Clone() + { + PrinterSettings clone = (PrinterSettings)MemberwiseClone(); + clone._printDialogDisplayed = false; + return clone; + } + // what is done in copytohdevmode cannot give unwanted access AllPrinting permission + internal DeviceContext CreateDeviceContext(PageSettings pageSettings) + { + IntPtr modeHandle = GetHdevmodeInternal(); + DeviceContext dc = null; + + try + { + //Copy the PageSettings to the DEVMODE... + pageSettings.CopyToHdevmode(modeHandle); + dc = CreateDeviceContext(modeHandle); + } + finally + { + SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle)); + } + return dc; + } + + internal DeviceContext CreateDeviceContext(IntPtr hdevmode) + { + IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode)); + DeviceContext dc = DeviceContext.CreateDC(DriverName, PrinterNameInternal, (string)null, new HandleRef(null, modePointer)); + SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode)); + return dc; + } + + // A read-only DC, which is faster than CreateHdc + // what is done in copytohdevmode cannot give unwanted access AllPrinting permission + internal DeviceContext CreateInformationContext(PageSettings pageSettings) + { + IntPtr modeHandle = GetHdevmodeInternal(); + DeviceContext dc; + + try + { + //Copy the PageSettings to the DEVMODE... + pageSettings.CopyToHdevmode(modeHandle); + dc = CreateInformationContext(modeHandle); + } + finally + { + SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle)); + } + return dc; + } + + // A read-only DC, which is faster than CreateHdc + internal DeviceContext CreateInformationContext(IntPtr hdevmode) + { + IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode)); + DeviceContext dc = DeviceContext.CreateIC(DriverName, PrinterNameInternal, (string)null, new HandleRef(null, modePointer)); + SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode)); + return dc; + } + + public Graphics CreateMeasurementGraphics() + { + return CreateMeasurementGraphics(DefaultPageSettings); + } + + //whatever the call stack calling HardMarginX and HardMarginY here is safe + public Graphics CreateMeasurementGraphics(bool honorOriginAtMargins) + { + Graphics g = CreateMeasurementGraphics(); + if (g != null && honorOriginAtMargins) + { + g.TranslateTransform(-_defaultPageSettings.HardMarginX, -_defaultPageSettings.HardMarginY); + g.TranslateTransform(_defaultPageSettings.Margins.Left, _defaultPageSettings.Margins.Top); + } + return g; + } + + public Graphics CreateMeasurementGraphics(PageSettings pageSettings) + { + // returns the Graphics object for the printer + DeviceContext dc = CreateDeviceContext(pageSettings); + Graphics g = Graphics.FromHdcInternal(dc.Hdc); + g.PrintingHelper = dc; // Graphics will dispose of the DeviceContext. + return g; + } + + //whatever the call stack calling HardMarginX and HardMarginY here is safe + public Graphics CreateMeasurementGraphics(PageSettings pageSettings, bool honorOriginAtMargins) + { + Graphics g = CreateMeasurementGraphics(); + if (g != null && honorOriginAtMargins) + { + g.TranslateTransform(-pageSettings.HardMarginX, -pageSettings.HardMarginY); + g.TranslateTransform(pageSettings.Margins.Left, pageSettings.Margins.Top); + } + return g; + } + + + // Create a PRINTDLG with a few useful defaults. + // Try to keep this consistent with PrintDialog.CreatePRINTDLG. + private static SafeNativeMethods.PRINTDLGX86 CreatePRINTDLGX86() + { + SafeNativeMethods.PRINTDLGX86 data = new SafeNativeMethods.PRINTDLGX86(); + data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLGX86)); + data.hwndOwner = IntPtr.Zero; + data.hDevMode = IntPtr.Zero; + data.hDevNames = IntPtr.Zero; + data.Flags = 0; + data.hwndOwner = IntPtr.Zero; + data.hDC = IntPtr.Zero; + data.nFromPage = 1; + data.nToPage = 1; + data.nMinPage = 0; + data.nMaxPage = 9999; + data.nCopies = 1; + data.hInstance = IntPtr.Zero; + data.lCustData = IntPtr.Zero; + data.lpfnPrintHook = IntPtr.Zero; + data.lpfnSetupHook = IntPtr.Zero; + data.lpPrintTemplateName = null; + data.lpSetupTemplateName = null; + data.hPrintTemplate = IntPtr.Zero; + data.hSetupTemplate = IntPtr.Zero; + return data; + } + + + // Create a PRINTDLG with a few useful defaults. + // Try to keep this consistent with PrintDialog.CreatePRINTDLG. + private static SafeNativeMethods.PRINTDLG CreatePRINTDLG() + { + SafeNativeMethods.PRINTDLG data = new SafeNativeMethods.PRINTDLG(); + data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLG)); + data.hwndOwner = IntPtr.Zero; + data.hDevMode = IntPtr.Zero; + data.hDevNames = IntPtr.Zero; + data.Flags = 0; + data.hwndOwner = IntPtr.Zero; + data.hDC = IntPtr.Zero; + data.nFromPage = 1; + data.nToPage = 1; + data.nMinPage = 0; + data.nMaxPage = 9999; + data.nCopies = 1; + data.hInstance = IntPtr.Zero; + data.lCustData = IntPtr.Zero; + data.lpfnPrintHook = IntPtr.Zero; + data.lpfnSetupHook = IntPtr.Zero; + data.lpPrintTemplateName = null; + data.lpSetupTemplateName = null; + data.hPrintTemplate = IntPtr.Zero; + data.hSetupTemplate = IntPtr.Zero; + return data; + } + + // Use FastDeviceCapabilities where possible -- computing PrinterName is quite slow + private int DeviceCapabilities(short capability, IntPtr pointerToBuffer, int defaultValue) + { + string printerName = PrinterName; + return FastDeviceCapabilities(capability, pointerToBuffer, defaultValue, printerName); + } + + // We pass PrinterName in as a parameter rather than computing it ourselves because it's expensive to compute. + // We need to pass IntPtr.Zero since passing HDevMode is non-performant. + private static int FastDeviceCapabilities(short capability, IntPtr pointerToBuffer, int defaultValue, string printerName) + { + int result = SafeNativeMethods.DeviceCapabilities(printerName, GetOutputPort(), + capability, pointerToBuffer, IntPtr.Zero); + if (result == -1) + return defaultValue; + return result; + } + + // Called by get_PrinterName + private static string GetDefaultPrinterName() + { + if (IntPtr.Size == 8) + { + SafeNativeMethods.PRINTDLG data = CreatePRINTDLG(); + data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; + bool status = SafeNativeMethods.PrintDlg(data); + + if (!status) + return SR.Format(SR.NoDefaultPrinter); + + IntPtr handle = data.hDevNames; + IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); + if (names == IntPtr.Zero) + throw new Win32Exception(); + + string name = ReadOneDEVNAME(names, 1); + SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); + names = IntPtr.Zero; + + // Windows allocates them, but we have to free them + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); + + return name; + } + else + { + SafeNativeMethods.PRINTDLGX86 data = CreatePRINTDLGX86(); + data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; + bool status = SafeNativeMethods.PrintDlg(data); + + if (!status) + return SR.Format(SR.NoDefaultPrinter); + + IntPtr handle = data.hDevNames; + IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); + if (names == IntPtr.Zero) + throw new Win32Exception(); + + string name = ReadOneDEVNAME(names, 1); + SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); + names = IntPtr.Zero; + + // Windows allocates them, but we have to free them + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); + + return name; + } + } + + + // Called by get_OutputPort + private static string GetOutputPort() + { + if (IntPtr.Size == 8) + { + SafeNativeMethods.PRINTDLG data = CreatePRINTDLG(); + data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; + bool status = SafeNativeMethods.PrintDlg(data); + if (!status) + return SR.Format(SR.NoDefaultPrinter); + + IntPtr handle = data.hDevNames; + IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); + if (names == IntPtr.Zero) + throw new Win32Exception(); + + string name = ReadOneDEVNAME(names, 2); + + SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); + names = IntPtr.Zero; + + // Windows allocates them, but we have to free them + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); + + return name; + } + else + { + SafeNativeMethods.PRINTDLGX86 data = CreatePRINTDLGX86(); + data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; + bool status = SafeNativeMethods.PrintDlg(data); + + if (!status) + return SR.Format(SR.NoDefaultPrinter); + + IntPtr handle = data.hDevNames; + IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); + if (names == IntPtr.Zero) + throw new Win32Exception(); + + string name = ReadOneDEVNAME(names, 2); + + SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); + names = IntPtr.Zero; + + // Windows allocates them, but we have to free them + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); + SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); + + return name; + } + } + + private int GetDeviceCaps(int capability, int defaultValue) + { + DeviceContext dc = CreateInformationContext(DefaultPageSettings); + int result = defaultValue; + + try + { + result = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), capability); + } + catch (InvalidPrinterException) + { + // do nothing, will return defaultValue. + } + finally + { + dc.Dispose(); + } + + return result; + } + + /// + /// Creates a handle to a DEVMODE structure which correspond too the printer settings.When you are done with the + /// handle, you must deallocate it yourself: + /// Windows.GlobalFree(handle); + /// Where "handle" is the return value from this method. + /// + public IntPtr GetHdevmode() + { + // Don't assert unmanaged code -- anyone using handles should have unmanaged code permission + IntPtr modeHandle = GetHdevmodeInternal(); + _defaultPageSettings.CopyToHdevmode(modeHandle); + return modeHandle; + } + + internal IntPtr GetHdevmodeInternal() + { + // getting the printer name is quite expensive if PrinterName is left default, + // because it needs to figure out what the default printer is + return GetHdevmodeInternal(PrinterNameInternal); + } + + private IntPtr GetHdevmodeInternal(string printer) + { + // Create DEVMODE + int modeSize = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, IntPtr.Zero, NativeMethods.NullHandleRef, 0); + if (modeSize < 1) + { + throw new InvalidPrinterException(this); + } + IntPtr handle = SafeNativeMethods.GlobalAlloc(SafeNativeMethods.GMEM_MOVEABLE, (uint)modeSize); // cannot be <0 anyway + IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, handle)); + + //Get the DevMode only if its not cached.... + if (_cachedDevmode != null) + { + Marshal.Copy(_cachedDevmode, 0, pointer, _devmodebytes); + } + else + { + int returnCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, pointer, NativeMethods.NullHandleRef, SafeNativeMethods.DM_OUT_BUFFER); + if (returnCode < 0) + { + throw new Win32Exception(); + } + } + + SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)Marshal.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE)); + + + if (_extrainfo != null) + { + // guard against buffer overrun attacks (since design allows client to set a new printer name without updating the devmode) + // by checking for a large enough buffer size before copying the extrainfo buffer + if (_extrabytes <= mode.dmDriverExtra) + { + IntPtr pointeroffset = (IntPtr)(checked((long)pointer + (long)mode.dmSize)); + Marshal.Copy(_extrainfo, 0, pointeroffset, _extrabytes); + } + } + if ((mode.dmFields & SafeNativeMethods.DM_COPIES) == SafeNativeMethods.DM_COPIES) + { + if (_copies != -1) + mode.dmCopies = _copies; + } + + if ((mode.dmFields & SafeNativeMethods.DM_DUPLEX) == SafeNativeMethods.DM_DUPLEX) + { + if (unchecked((int)_duplex) != -1) + mode.dmDuplex = unchecked((short)_duplex); + } + + if ((mode.dmFields & SafeNativeMethods.DM_COLLATE) == SafeNativeMethods.DM_COLLATE) + { + if (_collate.IsNotDefault) + mode.dmCollate = (short)(((bool)_collate) ? SafeNativeMethods.DMCOLLATE_TRUE : SafeNativeMethods.DMCOLLATE_FALSE); + } + + Marshal.StructureToPtr(mode, pointer, false); + + int retCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, pointer, pointer, SafeNativeMethods.DM_IN_BUFFER | SafeNativeMethods.DM_OUT_BUFFER); + if (retCode < 0) + { + SafeNativeMethods.GlobalFree(new HandleRef(null, handle)); + SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle)); + return IntPtr.Zero; + } + + + SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle)); + return handle; + } + + /// + /// Creates a handle to a DEVMODE structure which correspond to the printer and page settings. + /// When you are done with the handle, you must deallocate it yourself: + /// Windows.GlobalFree(handle); + /// Where "handle" is the return value from this method. + /// + public IntPtr GetHdevmode(PageSettings pageSettings) + { + IntPtr modeHandle = GetHdevmodeInternal(); + pageSettings.CopyToHdevmode(modeHandle); + + return modeHandle; + } + + /// + /// Creates a handle to a DEVNAMES structure which correspond to the printer settings. + /// When you are done with the handle, you must deallocate it yourself: + /// Windows.GlobalFree(handle); + /// Where "handle" is the return value from this method. + /// + public IntPtr GetHdevnames() + { + string printerName = PrinterName; // the PrinterName property is slow when using the default printer + string driver = DriverName; // make sure we are writing out exactly the same string as we got the length of + string outPort = OutputPort; + + // Create DEVNAMES structure + // +4 for null terminator + int namesCharacters = checked(4 + printerName.Length + driver.Length + outPort.Length); + + // 8 = size of fixed portion of DEVNAMES + short offset = (short)(8 / Marshal.SystemDefaultCharSize); // Offsets are in characters, not bytes + uint namesSize = (uint)checked(Marshal.SystemDefaultCharSize * (offset + namesCharacters)); // always >0 + IntPtr handle = SafeNativeMethods.GlobalAlloc(SafeNativeMethods.GMEM_MOVEABLE | SafeNativeMethods.GMEM_ZEROINIT, namesSize); + IntPtr namesPointer = SafeNativeMethods.GlobalLock(new HandleRef(null, handle)); + + Marshal.WriteInt16(namesPointer, offset); // wDriverOffset + offset += WriteOneDEVNAME(driver, namesPointer, offset); + Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 2)), offset); // wDeviceOffset + offset += WriteOneDEVNAME(printerName, namesPointer, offset); + Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 4)), offset); // wOutputOffset + offset += WriteOneDEVNAME(outPort, namesPointer, offset); + Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 6)), offset); // wDefault + + SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle)); + return handle; + } + + // Handles creating then disposing a default DEVMODE + internal short GetModeField(ModeField field, short defaultValue) + { + return GetModeField(field, defaultValue, IntPtr.Zero); + } + + internal short GetModeField(ModeField field, short defaultValue, IntPtr modeHandle) + { + bool ownHandle = false; + short result; + try + { + if (modeHandle == IntPtr.Zero) + { + try + { + modeHandle = GetHdevmodeInternal(); + ownHandle = true; + } + catch (InvalidPrinterException) + { + return defaultValue; + } + } + + IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle)); + SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)Marshal.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE)); + switch (field) + { + case ModeField.Orientation: + result = mode.dmOrientation; + break; + case ModeField.PaperSize: + result = mode.dmPaperSize; + break; + case ModeField.PaperLength: + result = mode.dmPaperLength; + break; + case ModeField.PaperWidth: + result = mode.dmPaperWidth; + break; + case ModeField.Copies: + result = mode.dmCopies; + break; + case ModeField.DefaultSource: + result = mode.dmDefaultSource; + break; + case ModeField.PrintQuality: + result = mode.dmPrintQuality; + break; + case ModeField.Color: + result = mode.dmColor; + break; + case ModeField.Duplex: + result = mode.dmDuplex; + break; + case ModeField.YResolution: + result = mode.dmYResolution; + break; + case ModeField.TTOption: + result = mode.dmTTOption; + break; + case ModeField.Collate: + result = mode.dmCollate; + break; + default: + Debug.Fail("Invalid field in GetModeField"); + result = defaultValue; + break; + } + SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle)); + } + finally + { + if (ownHandle) + { + SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle)); + } + } + return result; + } + + internal PaperSize[] Get_PaperSizes() + { + string printerName = PrinterName; // this is quite expensive if PrinterName is left default + + int count = FastDeviceCapabilities(SafeNativeMethods.DC_PAPERNAMES, IntPtr.Zero, -1, printerName); + if (count == -1) + return new PaperSize[0]; + int stringSize = Marshal.SystemDefaultCharSize * 64; + IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count)); + FastDeviceCapabilities(SafeNativeMethods.DC_PAPERNAMES, namesBuffer, -1, printerName); + + Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_PAPERS, IntPtr.Zero, -1, printerName) == count, + "Not the same number of paper kinds as paper names?"); + IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count); + FastDeviceCapabilities(SafeNativeMethods.DC_PAPERS, kindsBuffer, -1, printerName); + + Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_PAPERSIZE, IntPtr.Zero, -1, printerName) == count, + "Not the same number of paper kinds as paper names?"); + IntPtr dimensionsBuffer = Marshal.AllocCoTaskMem(8 * count); + FastDeviceCapabilities(SafeNativeMethods.DC_PAPERSIZE, dimensionsBuffer, -1, printerName); + + PaperSize[] result = new PaperSize[count]; + for (int i = 0; i < count; i++) + { + string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 64); + int index = name.IndexOf('\0'); + if (index > -1) + { + name = name.Substring(0, index); + } + short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + i * 2))); + int width = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8))); + int height = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8 + 4))); + result[i] = new PaperSize((PaperKind)kind, name, + PrinterUnitConvert.Convert(width, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), + PrinterUnitConvert.Convert(height, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display)); + } + + Marshal.FreeCoTaskMem(namesBuffer); + Marshal.FreeCoTaskMem(kindsBuffer); + Marshal.FreeCoTaskMem(dimensionsBuffer); + return result; + } + + internal PaperSource[] Get_PaperSources() + { + string printerName = PrinterName; // this is quite expensive if PrinterName is left default + + int count = FastDeviceCapabilities(SafeNativeMethods.DC_BINNAMES, IntPtr.Zero, -1, printerName); + if (count == -1) + return new PaperSource[0]; + + // Contrary to documentation, DeviceCapabilities returns char[count, 24], + // not char[count][24] + int stringSize = Marshal.SystemDefaultCharSize * 24; + IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count)); + FastDeviceCapabilities(SafeNativeMethods.DC_BINNAMES, namesBuffer, -1, printerName); + + Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_BINS, IntPtr.Zero, -1, printerName) == count, + "Not the same number of bin kinds as bin names?"); + IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count); + FastDeviceCapabilities(SafeNativeMethods.DC_BINS, kindsBuffer, -1, printerName); + + PaperSource[] result = new PaperSource[count]; + for (int i = 0; i < count; i++) + { + string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 24); + int index = name.IndexOf('\0'); + if (index > -1) + { + name = name.Substring(0, index); + } + + short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + 2 * i))); + result[i] = new PaperSource((PaperSourceKind)kind, name); + } + + Marshal.FreeCoTaskMem(namesBuffer); + Marshal.FreeCoTaskMem(kindsBuffer); + return result; + } + + internal PrinterResolution[] Get_PrinterResolutions() + { + string printerName = PrinterName; // this is quite expensive if PrinterName is left default + PrinterResolution[] result; + + int count = FastDeviceCapabilities(SafeNativeMethods.DC_ENUMRESOLUTIONS, IntPtr.Zero, -1, printerName); + if (count == -1) + { + //Just return the standard values if custom resolutions are absent .... + result = new PrinterResolution[4]; + result[0] = new PrinterResolution(PrinterResolutionKind.High, -4, -1); + result[1] = new PrinterResolution(PrinterResolutionKind.Medium, -3, -1); + result[2] = new PrinterResolution(PrinterResolutionKind.Low, -2, -1); + result[3] = new PrinterResolution(PrinterResolutionKind.Draft, -1, -1); + + return result; + } + + result = new PrinterResolution[count + 4]; + result[0] = new PrinterResolution(PrinterResolutionKind.High, -4, -1); + result[1] = new PrinterResolution(PrinterResolutionKind.Medium, -3, -1); + result[2] = new PrinterResolution(PrinterResolutionKind.Low, -2, -1); + result[3] = new PrinterResolution(PrinterResolutionKind.Draft, -1, -1); + + IntPtr buffer = Marshal.AllocCoTaskMem(checked(8 * count)); + FastDeviceCapabilities(SafeNativeMethods.DC_ENUMRESOLUTIONS, buffer, -1, printerName); + + for (int i = 0; i < count; i++) + { + int x = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i * 8))); + int y = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i * 8 + 4))); + result[i + 4] = new PrinterResolution(PrinterResolutionKind.Custom, x, y); + } + + Marshal.FreeCoTaskMem(buffer); + return result; + } + + // names is pointer to DEVNAMES + private static String ReadOneDEVNAME(IntPtr pDevnames, int slot) + { + int offset = checked(Marshal.SystemDefaultCharSize * Marshal.ReadInt16((IntPtr)(checked((long)pDevnames + slot * 2)))); + string result = Marshal.PtrToStringAuto((IntPtr)(checked((long)pDevnames + offset))); + return result; + } + + /// + /// Copies the relevant information out of the handle and into the PrinterSettings. + /// + public void SetHdevmode(IntPtr hdevmode) + { + if (hdevmode == IntPtr.Zero) + throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevmode)); + + IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode)); + SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)Marshal.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE)); + + //Copy entire public devmode as a byte array... + _devmodebytes = mode.dmSize; + if (_devmodebytes > 0) + { + _cachedDevmode = new byte[_devmodebytes]; + Marshal.Copy(pointer, _cachedDevmode, 0, _devmodebytes); + } + + //Copy private devmode as a byte array.. + _extrabytes = mode.dmDriverExtra; + if (_extrabytes > 0) + { + _extrainfo = new byte[_extrabytes]; + Marshal.Copy((IntPtr)(checked((long)pointer + (long)mode.dmSize)), _extrainfo, 0, _extrabytes); + } + + if ((mode.dmFields & SafeNativeMethods.DM_COPIES) == SafeNativeMethods.DM_COPIES) + { + _copies = mode.dmCopies; + } + + if ((mode.dmFields & SafeNativeMethods.DM_DUPLEX) == SafeNativeMethods.DM_DUPLEX) + { + _duplex = (Duplex)mode.dmDuplex; + } + + if ((mode.dmFields & SafeNativeMethods.DM_COLLATE) == SafeNativeMethods.DM_COLLATE) + { + _collate = (mode.dmCollate == SafeNativeMethods.DMCOLLATE_TRUE); + } + + SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode)); + } + + /// + /// Copies the relevant information out of the handle and into the PrinterSettings. + /// + public void SetHdevnames(IntPtr hdevnames) + { + if (hdevnames == IntPtr.Zero) + throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevnames)); + + IntPtr namesPointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevnames)); + + _driverName = ReadOneDEVNAME(namesPointer, 0); + _printerName = ReadOneDEVNAME(namesPointer, 1); + _outputPort = ReadOneDEVNAME(namesPointer, 2); + + PrintDialogDisplayed = true; + + SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevnames)); + } + + /// + /// Provides some interesting information about the PrinterSettings in String form. + /// + public override string ToString() + { + string printerName = PrinterName; + return "[PrinterSettings " + + printerName + + " Copies=" + Copies.ToString(CultureInfo.InvariantCulture) + + " Collate=" + Collate.ToString(CultureInfo.InvariantCulture) + + " Duplex=" + Duplex.ToString() + + " FromPage=" + FromPage.ToString(CultureInfo.InvariantCulture) + + " LandscapeAngle=" + LandscapeAngle.ToString(CultureInfo.InvariantCulture) + + " MaximumCopies=" + MaximumCopies.ToString(CultureInfo.InvariantCulture) + + " OutputPort=" + OutputPort.ToString(CultureInfo.InvariantCulture) + + " ToPage=" + ToPage.ToString(CultureInfo.InvariantCulture) + + "]"; + } + + // Write null terminated string, return length of string in characters (including null) + private short WriteOneDEVNAME(string str, IntPtr bufferStart, int index) + { + if (str == null) + str = ""; + IntPtr address = (IntPtr)(checked((long)bufferStart + index * Marshal.SystemDefaultCharSize)); + + char[] data = str.ToCharArray(); + Marshal.Copy(data, 0, address, data.Length); + Marshal.WriteInt16((IntPtr)(checked((long)address + data.Length * 2)), 0); + + return checked((short)(str.Length + 1)); + } + + /// + /// Collection of PaperSize's... + /// + public class PaperSizeCollection : ICollection + { + private PaperSize[] _array; + + /// + /// Initializes a new instance of the class. + /// + public PaperSizeCollection(PaperSize[] array) + { + _array = array; + } + + /// + /// Gets a value indicating the number of paper sizes. + /// + public int Count + { + get + { + return _array.Length; + } + } + + /// + /// Retrieves the PaperSize with the specified index. + /// + public virtual PaperSize this[int index] + { + get + { + return _array[index]; + } + } + + public IEnumerator GetEnumerator() + { + return new ArrayEnumerator(_array, 0, Count); + } + + int ICollection.Count + { + get + { + return Count; + } + } + + + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + object ICollection.SyncRoot + { + get + { + return this; + } + } + + void ICollection.CopyTo(Array array, int index) + { + Array.Copy(_array, index, array, 0, _array.Length); + } + + public void CopyTo(PaperSize[] paperSizes, int index) + { + Array.Copy(_array, index, paperSizes, 0, _array.Length); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + [ + EditorBrowsable(EditorBrowsableState.Never) + ] + public Int32 Add(PaperSize paperSize) + { + PaperSize[] newArray = new PaperSize[Count + 1]; + ((ICollection)this).CopyTo(newArray, 0); + newArray[Count] = paperSize; + _array = newArray; + return Count; + } + } + + public class PaperSourceCollection : ICollection + { + private PaperSource[] _array; + + /// + /// Initializes a new instance of the class. + /// + public PaperSourceCollection(PaperSource[] array) + { + _array = array; + } + + /// + /// Gets a value indicating the number of paper sources. + /// + public int Count + { + get + { + return _array.Length; + } + } + + /// + /// Gets the PaperSource with the specified index. + /// + public virtual PaperSource this[int index] + { + get + { + return _array[index]; + } + } + + public IEnumerator GetEnumerator() + { + return new ArrayEnumerator(_array, 0, Count); + } + + int ICollection.Count + { + get + { + return Count; + } + } + + + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + object ICollection.SyncRoot + { + get + { + return this; + } + } + + void ICollection.CopyTo(Array array, int index) + { + Array.Copy(_array, index, array, 0, _array.Length); + } + + public void CopyTo(PaperSource[] paperSources, int index) + { + Array.Copy(_array, index, paperSources, 0, _array.Length); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public Int32 Add(PaperSource paperSource) + { + PaperSource[] newArray = new PaperSource[Count + 1]; + ((ICollection)this).CopyTo(newArray, 0); + newArray[Count] = paperSource; + _array = newArray; + return Count; + } + } + + public class PrinterResolutionCollection : ICollection + { + private PrinterResolution[] _array; + + /// + /// Initializes a new instance of the class. + /// + public PrinterResolutionCollection(PrinterResolution[] array) + { + _array = array; + } + + /// + /// Gets a value indicating the number of available printer resolutions. + /// + public int Count + { + get + { + return _array.Length; + } + } + + /// + /// Retrieves the PrinterResolution with the specified index. + /// + public virtual PrinterResolution this[int index] + { + get + { + return _array[index]; + } + } + + public IEnumerator GetEnumerator() + { + return new ArrayEnumerator(_array, 0, Count); + } + + int ICollection.Count + { + get + { + return Count; + } + } + + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + object ICollection.SyncRoot + { + get + { + return this; + } + } + + void ICollection.CopyTo(Array array, int index) + { + Array.Copy(_array, index, array, 0, _array.Length); + } + + public void CopyTo(PrinterResolution[] printerResolutions, int index) + { + Array.Copy(_array, index, printerResolutions, 0, _array.Length); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public Int32 Add(PrinterResolution printerResolution) + { + PrinterResolution[] newArray = new PrinterResolution[Count + 1]; + ((ICollection)this).CopyTo(newArray, 0); + newArray[Count] = printerResolution; + _array = newArray; + return Count; + } + } + + public class StringCollection : ICollection + { + private String[] _array; + + /// + /// Initializes a new instance of the class. + /// + public StringCollection(String[] array) + { + _array = array; + } + + /// + /// Gets a value indicating the number of strings. + /// + public int Count + { + get + { + return _array.Length; + } + } + + /// + /// Gets the string with the specified index. + /// + public virtual String this[int index] + { + get + { + return _array[index]; + } + } + + public IEnumerator GetEnumerator() + { + return new ArrayEnumerator(_array, 0, Count); + } + + int ICollection.Count + { + get + { + return Count; + } + } + + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + object ICollection.SyncRoot + { + get + { + return this; + } + } + + void ICollection.CopyTo(Array array, int index) + { + Array.Copy(_array, index, array, 0, _array.Length); + } + + + public void CopyTo(string[] strings, int index) + { + Array.Copy(_array, index, strings, 0, _array.Length); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + [ + EditorBrowsable(EditorBrowsableState.Never) + ] + public Int32 Add(String value) + { + String[] newArray = new String[Count + 1]; + ((ICollection)this).CopyTo(newArray, 0); + newArray[Count] = value; + _array = newArray; + return Count; + } + } + + private class ArrayEnumerator : IEnumerator + { + private object[] _array; + private object _item; + private int _index; + private int _startIndex; + private int _endIndex; + + public ArrayEnumerator(object[] array, int startIndex, int count) + { + _array = array; + _startIndex = startIndex; + _endIndex = _index + count; + + _index = _startIndex; + } + + public object Current + { + get + { + return _item; + } + } + + + public bool MoveNext() + { + if (_index >= _endIndex) + return false; + _item = _array[_index++]; + return true; + } + + public void Reset() + { + // Position enumerator before first item + + _index = _startIndex; + _item = null; + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs deleted file mode 100644 index 4c7a42bbb7..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.cs +++ /dev/null @@ -1,1710 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing.Imaging; -using System.Drawing.Internal; -using System.Globalization; -using System.IO; -using System.Runtime.InteropServices; - -namespace System.Drawing.Printing -{ - /// - /// Information about how a document should be printed, including which printer to print it on. - /// - public partial class PrinterSettings : ICloneable - { - // All read/write data is stored in managed code, and whenever we need to call Win32, - // we create new DEVMODE and DEVNAMES structures. We don't store device capabilities, - // though. - // - // Also, all properties have hidden tri-state logic -- yes/no/default - private const int Padding64Bit = 4; - - private string _printerName; // default printer. - private string _driverName = ""; - private string _outputPort = ""; - private bool _printToFile; - - // Whether the PrintDialog has been shown (not whether it's currently shown). This is how we enforce SafePrinting. - private bool _printDialogDisplayed; - - private short _extrabytes; - private byte[] _extrainfo; - - private short _copies = -1; - private Duplex _duplex = System.Drawing.Printing.Duplex.Default; - private TriState _collate = TriState.Default; - private PageSettings _defaultPageSettings; - private int _fromPage; - private int _toPage; - private int _maxPage = 9999; - private int _minPage; - private PrintRange _printRange; - - private short _devmodebytes; - private byte[] _cachedDevmode; - - /// - /// Initializes a new instance of the class. - /// - public PrinterSettings() - { - _defaultPageSettings = new PageSettings(this); - } - - /// - /// Gets a value indicating whether the printer supports duplex (double-sided) printing. - /// - public bool CanDuplex - { - get { return DeviceCapabilities(SafeNativeMethods.DC_DUPLEX, IntPtr.Zero, 0) == 1; } - } - - /// - /// Gets or sets the number of copies to print. - /// - public short Copies - { - get - { - if (_copies != -1) - return _copies; - else - return GetModeField(ModeField.Copies, 1); - } - set - { - if (value < 0) - throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, - "value", value.ToString(CultureInfo.CurrentCulture), - (0).ToString(CultureInfo.CurrentCulture))); - /* - We shouldnt allow copies to be set since the copies can be a large number - and can be reflected in PrintDialog. So for the Copies property, - we prefer that for SafePrinting, copied cannot be set programmatically - but through the print dialog. - Any lower security could set copies to anything. - */ - _copies = value; - } - } - - /// - /// Gets or sets a value indicating whether the print out is collated. - /// - public bool Collate - { - get - { - if (!_collate.IsDefault) - return (bool)_collate; - else - return GetModeField(ModeField.Collate, SafeNativeMethods.DMCOLLATE_FALSE) == SafeNativeMethods.DMCOLLATE_TRUE; - } - set { _collate = value; } - } - - /// - /// Gets the default page settings for this printer. - /// - public PageSettings DefaultPageSettings - { - get { return _defaultPageSettings; } - } - - // As far as I can tell, Windows no longer pays attention to driver names and output ports. - // But I'm leaving this code in place in case I'm wrong. - internal string DriverName - { - get { return _driverName; } - } - - /// - /// Gets or sets the printer's duplex setting. - /// - public Duplex Duplex - { - get - { - if (_duplex != Duplex.Default) - { - return _duplex; - } - - return (Duplex)GetModeField(ModeField.Duplex, SafeNativeMethods.DMDUP_SIMPLEX); - } - set - { - if (value < Duplex.Default || value > Duplex.Horizontal) - { - throw new InvalidEnumArgumentException(nameof(value), unchecked((int)value), typeof(Duplex)); - } - - _duplex = value; - } - } - - /// - /// Gets or sets the first page to print. - /// - public int FromPage - { - get { return _fromPage; } - set - { - if (value < 0) - throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, - "value", value.ToString(CultureInfo.CurrentCulture), - (0).ToString(CultureInfo.CurrentCulture))); - _fromPage = value; - } - } - - - - /// - /// Gets the names of all printers installed on the machine. - /// - public static StringCollection InstalledPrinters - { - get - { - int sizeofstruct; - // Note: The call to get the size of the buffer required for level 5 does not work properly on NT platforms. - const int Level = 4; - // PRINTER_INFO_4 is 12 or 24 bytes in size depending on the architecture. - if (IntPtr.Size == 8) - { - sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1) + Padding64Bit; - } - else - { - sizeofstruct = (IntPtr.Size * 2) + (Marshal.SizeOf(typeof(int)) * 1); - } - - int bufferSize; - int count; - SafeNativeMethods.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, null, Level, IntPtr.Zero, 0, out bufferSize, out count); - - IntPtr buffer = Marshal.AllocCoTaskMem(bufferSize); - int returnCode = SafeNativeMethods.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, - null, Level, buffer, - bufferSize, out bufferSize, out count); - var array = new string[count]; - - if (returnCode == 0) - { - Marshal.FreeCoTaskMem(buffer); - throw new Win32Exception(); - } - - for (int i = 0; i < count; i++) - { - // The printer name is at offset 0 - // - IntPtr namePointer = (IntPtr)Marshal.ReadIntPtr((IntPtr)(checked((long)buffer + i * sizeofstruct))); - array[i] = Marshal.PtrToStringAuto(namePointer); - } - - Marshal.FreeCoTaskMem(buffer); - - return new StringCollection(array); - } - } - - /// - /// Gets a value indicating whether the property designates the default printer. - /// - public bool IsDefaultPrinter - { - get - { - return (_printerName == null || _printerName == GetDefaultPrinterName()); - } - } - - /// - /// Gets a value indicating whether the printer is a plotter, as opposed to a raster printer. - /// - public bool IsPlotter - { - get - { - return GetDeviceCaps(SafeNativeMethods.TECHNOLOGY, SafeNativeMethods.DT_RASPRINTER) == SafeNativeMethods.DT_PLOTTER; - } - } - - /// - /// Gets a value indicating whether the property designates a valid printer. - /// - public bool IsValid - { - get - { - return DeviceCapabilities(SafeNativeMethods.DC_COPIES, IntPtr.Zero, -1) != -1; - } - } - - /// - /// Gets the angle, in degrees, which the portrait orientation is rotated to produce the landscape orientation. - /// - public int LandscapeAngle - { - get { return DeviceCapabilities(SafeNativeMethods.DC_ORIENTATION, IntPtr.Zero, 0); } - } - - /// - /// Gets the maximum number of copies allowed by the printer. - /// - public int MaximumCopies - { - get { return DeviceCapabilities(SafeNativeMethods.DC_COPIES, IntPtr.Zero, 1); } - } - - /// - /// Gets or sets the highest or which may be selected in a print dialog box. - /// - public int MaximumPage - { - get { return _maxPage; } - set - { - if (value < 0) - throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, - "value", value.ToString(CultureInfo.CurrentCulture), - (0).ToString(CultureInfo.CurrentCulture))); - _maxPage = value; - } - } - - /// - /// Gets or sets the lowest or which may be selected in a print dialog box. - /// - public int MinimumPage - { - get { return _minPage; } - set - { - if (value < 0) - throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, - "value", value.ToString(CultureInfo.CurrentCulture), - (0).ToString(CultureInfo.CurrentCulture))); - _minPage = value; - } - } - - internal string OutputPort - { - get - { - return _outputPort; - } - set - { - _outputPort = value; - } - } - - /// - /// Indicates the name of the printerfile. - /// - public string PrintFileName - { - get - { - string printFileName = OutputPort; - return printFileName; - } - set - { - if (string.IsNullOrEmpty(value)) - { - throw new ArgumentNullException(value); - } - OutputPort = value; - } - } - - /// - /// Gets the paper sizes supported by this printer. - /// - public PaperSizeCollection PaperSizes - { - get { return new PaperSizeCollection(Get_PaperSizes()); } - } - - /// - /// Gets the paper sources available on this printer. - /// - public PaperSourceCollection PaperSources - { - get { return new PaperSourceCollection(Get_PaperSources()); } - } - - /// - /// Whether the print dialog has been displayed. In SafePrinting mode, a print dialog is required to print. - /// After printing, this property is set to false if the program does not have AllPrinting; this guarantees - /// a document is only printed once each time the print dialog is shown. - /// - internal bool PrintDialogDisplayed - { - get - { - return _printDialogDisplayed; - } - - set - { - _printDialogDisplayed = value; - } - } - - /// - /// Gets or sets the pages the user has asked to print. - /// - public PrintRange PrintRange - { - get { return _printRange; } - set - { - if (!Enum.IsDefined(typeof(PrintRange), value)) - throw new InvalidEnumArgumentException("value", unchecked((int)value), typeof(PrintRange)); - - _printRange = value; - } - } - - /// - /// Indicates whether to print to a file instead of a port. - /// - public bool PrintToFile - { - get - { - return _printToFile; - } - set - { - _printToFile = value; - } - } - - /// - /// Gets or sets the name of the printer. - /// - public string PrinterName - { - get - { - return PrinterNameInternal; - } - - set - { - PrinterNameInternal = value; - } - } - - private string PrinterNameInternal - { - get - { - if (_printerName == null) - return GetDefaultPrinterName(); - else - return _printerName; - } - set - { - // Reset the DevMode and Extrabytes... - _cachedDevmode = null; - _extrainfo = null; - _printerName = value; - // PrinterName can be set through a fulltrusted assembly without using the PrintDialog. - // So dont set this variable here. - //PrintDialogDisplayed = true; - } - } - - /// - /// Gets the resolutions supported by this printer. - /// - public PrinterResolutionCollection PrinterResolutions - { - get { return new PrinterResolutionCollection(Get_PrinterResolutions()); } - } - - /// - /// If the image is a JPEG or a PNG (Image.RawFormat) and the printer returns true from - /// ExtEscape(CHECKJPEGFORMAT) or ExtEscape(CHECKPNGFORMAT) then this function returns true. - /// - public bool IsDirectPrintingSupported(ImageFormat imageFormat) - { - bool isDirectPrintingSupported = false; - if (imageFormat.Equals(ImageFormat.Jpeg) || imageFormat.Equals(ImageFormat.Png)) - { - int nEscape = imageFormat.Equals(ImageFormat.Jpeg) ? SafeNativeMethods.CHECKJPEGFORMAT : SafeNativeMethods.CHECKPNGFORMAT; - int outData = 0; - DeviceContext dc = CreateInformationContext(DefaultPageSettings); - HandleRef hdc = new HandleRef(dc, dc.Hdc); - try - { - isDirectPrintingSupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0; - } - finally - { - dc.Dispose(); - } - } - return isDirectPrintingSupported; - } - - /// - /// This method utilizes the CHECKJPEGFORMAT/CHECKPNGFORMAT printer escape functions - /// to determine whether the printer can handle a JPEG image. - /// - /// If the image is a JPEG or a PNG (Image.RawFormat) and the printer returns true - /// from ExtEscape(CHECKJPEGFORMAT) or ExtEscape(CHECKPNGFORMAT) then this function returns true. - /// - public bool IsDirectPrintingSupported(Image image) - { - bool isDirectPrintingSupported = false; - if (image.RawFormat.Equals(ImageFormat.Jpeg) || image.RawFormat.Equals(ImageFormat.Png)) - { - MemoryStream stream = new MemoryStream(); - try - { - image.Save(stream, image.RawFormat); - stream.Position = 0; - using (BufferedStream inStream = new BufferedStream(stream)) - { - int pvImageLen = (int)inStream.Length; - byte[] pvImage = new byte[pvImageLen]; - - int nRead = inStream.Read(pvImage, 0, (int)pvImageLen); - - int nEscape = image.RawFormat.Equals(ImageFormat.Jpeg) ? SafeNativeMethods.CHECKJPEGFORMAT : SafeNativeMethods.CHECKPNGFORMAT; - int outData = 0; - - DeviceContext dc = CreateInformationContext(DefaultPageSettings); - HandleRef hdc = new HandleRef(dc, dc.Hdc); - try - { - bool querySupported = SafeNativeMethods.ExtEscape(hdc, SafeNativeMethods.QUERYESCSUPPORT, Marshal.SizeOf(typeof(int)), ref nEscape, 0, out outData) > 0; - if (querySupported) - { - isDirectPrintingSupported = (SafeNativeMethods.ExtEscape(hdc, nEscape, pvImageLen, pvImage, Marshal.SizeOf(typeof(int)), out outData) > 0) - && (outData == 1); - } - } - finally - { - dc.Dispose(); - } - } - } - finally - { - stream.Close(); - } - } - return isDirectPrintingSupported; - } - - /// - /// Gets a value indicating whether the printer supports color printing. - /// - public bool SupportsColor - { - get - { - return GetDeviceCaps(SafeNativeMethods.BITSPIXEL, 1) > 1; - } - } - - /// - /// Gets or sets the last page to print. - /// - public int ToPage - { - get { return _toPage; } - set - { - if (value < 0) - throw new ArgumentException(SR.Format(SR.InvalidLowBoundArgumentEx, - "value", value.ToString(CultureInfo.CurrentCulture), - (0).ToString(CultureInfo.CurrentCulture))); - _toPage = value; - } - } - - /// - /// Creates an identical copy of this object. - /// - public object Clone() - { - PrinterSettings clone = (PrinterSettings)MemberwiseClone(); - clone._printDialogDisplayed = false; - return clone; - } - // what is done in copytohdevmode cannot give unwanted access AllPrinting permission - internal DeviceContext CreateDeviceContext(PageSettings pageSettings) - { - IntPtr modeHandle = GetHdevmodeInternal(); - DeviceContext dc = null; - - try - { - //Copy the PageSettings to the DEVMODE... - pageSettings.CopyToHdevmode(modeHandle); - dc = CreateDeviceContext(modeHandle); - } - finally - { - SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle)); - } - return dc; - } - - internal DeviceContext CreateDeviceContext(IntPtr hdevmode) - { - IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode)); - DeviceContext dc = DeviceContext.CreateDC(DriverName, PrinterNameInternal, (string)null, new HandleRef(null, modePointer)); - SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode)); - return dc; - } - - // A read-only DC, which is faster than CreateHdc - // what is done in copytohdevmode cannot give unwanted access AllPrinting permission - internal DeviceContext CreateInformationContext(PageSettings pageSettings) - { - IntPtr modeHandle = GetHdevmodeInternal(); - DeviceContext dc; - - try - { - //Copy the PageSettings to the DEVMODE... - pageSettings.CopyToHdevmode(modeHandle); - dc = CreateInformationContext(modeHandle); - } - finally - { - SafeNativeMethods.GlobalFree(new HandleRef(null, modeHandle)); - } - return dc; - } - - // A read-only DC, which is faster than CreateHdc - internal DeviceContext CreateInformationContext(IntPtr hdevmode) - { - IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode)); - DeviceContext dc = DeviceContext.CreateIC(DriverName, PrinterNameInternal, (string)null, new HandleRef(null, modePointer)); - SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode)); - return dc; - } - - public Graphics CreateMeasurementGraphics() - { - return CreateMeasurementGraphics(DefaultPageSettings); - } - - //whatever the call stack calling HardMarginX and HardMarginY here is safe - public Graphics CreateMeasurementGraphics(bool honorOriginAtMargins) - { - Graphics g = CreateMeasurementGraphics(); - if (g != null && honorOriginAtMargins) - { - g.TranslateTransform(-_defaultPageSettings.HardMarginX, -_defaultPageSettings.HardMarginY); - g.TranslateTransform(_defaultPageSettings.Margins.Left, _defaultPageSettings.Margins.Top); - } - return g; - } - - public Graphics CreateMeasurementGraphics(PageSettings pageSettings) - { - // returns the Graphics object for the printer - DeviceContext dc = CreateDeviceContext(pageSettings); - Graphics g = Graphics.FromHdcInternal(dc.Hdc); - g.PrintingHelper = dc; // Graphics will dispose of the DeviceContext. - return g; - } - - //whatever the call stack calling HardMarginX and HardMarginY here is safe - public Graphics CreateMeasurementGraphics(PageSettings pageSettings, bool honorOriginAtMargins) - { - Graphics g = CreateMeasurementGraphics(); - if (g != null && honorOriginAtMargins) - { - g.TranslateTransform(-pageSettings.HardMarginX, -pageSettings.HardMarginY); - g.TranslateTransform(pageSettings.Margins.Left, pageSettings.Margins.Top); - } - return g; - } - - - // Create a PRINTDLG with a few useful defaults. - // Try to keep this consistent with PrintDialog.CreatePRINTDLG. - private static SafeNativeMethods.PRINTDLGX86 CreatePRINTDLGX86() - { - SafeNativeMethods.PRINTDLGX86 data = new SafeNativeMethods.PRINTDLGX86(); - data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLGX86)); - data.hwndOwner = IntPtr.Zero; - data.hDevMode = IntPtr.Zero; - data.hDevNames = IntPtr.Zero; - data.Flags = 0; - data.hwndOwner = IntPtr.Zero; - data.hDC = IntPtr.Zero; - data.nFromPage = 1; - data.nToPage = 1; - data.nMinPage = 0; - data.nMaxPage = 9999; - data.nCopies = 1; - data.hInstance = IntPtr.Zero; - data.lCustData = IntPtr.Zero; - data.lpfnPrintHook = IntPtr.Zero; - data.lpfnSetupHook = IntPtr.Zero; - data.lpPrintTemplateName = null; - data.lpSetupTemplateName = null; - data.hPrintTemplate = IntPtr.Zero; - data.hSetupTemplate = IntPtr.Zero; - return data; - } - - - // Create a PRINTDLG with a few useful defaults. - // Try to keep this consistent with PrintDialog.CreatePRINTDLG. - private static SafeNativeMethods.PRINTDLG CreatePRINTDLG() - { - SafeNativeMethods.PRINTDLG data = new SafeNativeMethods.PRINTDLG(); - data.lStructSize = Marshal.SizeOf(typeof(SafeNativeMethods.PRINTDLG)); - data.hwndOwner = IntPtr.Zero; - data.hDevMode = IntPtr.Zero; - data.hDevNames = IntPtr.Zero; - data.Flags = 0; - data.hwndOwner = IntPtr.Zero; - data.hDC = IntPtr.Zero; - data.nFromPage = 1; - data.nToPage = 1; - data.nMinPage = 0; - data.nMaxPage = 9999; - data.nCopies = 1; - data.hInstance = IntPtr.Zero; - data.lCustData = IntPtr.Zero; - data.lpfnPrintHook = IntPtr.Zero; - data.lpfnSetupHook = IntPtr.Zero; - data.lpPrintTemplateName = null; - data.lpSetupTemplateName = null; - data.hPrintTemplate = IntPtr.Zero; - data.hSetupTemplate = IntPtr.Zero; - return data; - } - - // Use FastDeviceCapabilities where possible -- computing PrinterName is quite slow - private int DeviceCapabilities(short capability, IntPtr pointerToBuffer, int defaultValue) - { - string printerName = PrinterName; - return FastDeviceCapabilities(capability, pointerToBuffer, defaultValue, printerName); - } - - // We pass PrinterName in as a parameter rather than computing it ourselves because it's expensive to compute. - // We need to pass IntPtr.Zero since passing HDevMode is non-performant. - private static int FastDeviceCapabilities(short capability, IntPtr pointerToBuffer, int defaultValue, string printerName) - { - int result = SafeNativeMethods.DeviceCapabilities(printerName, GetOutputPort(), - capability, pointerToBuffer, IntPtr.Zero); - if (result == -1) - return defaultValue; - return result; - } - - // Called by get_PrinterName - private static string GetDefaultPrinterName() - { - if (IntPtr.Size == 8) - { - SafeNativeMethods.PRINTDLG data = CreatePRINTDLG(); - data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; - bool status = SafeNativeMethods.PrintDlg(data); - - if (!status) - return SR.Format(SR.NoDefaultPrinter); - - IntPtr handle = data.hDevNames; - IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); - if (names == IntPtr.Zero) - throw new Win32Exception(); - - string name = ReadOneDEVNAME(names, 1); - SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); - names = IntPtr.Zero; - - // Windows allocates them, but we have to free them - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); - - return name; - } - else - { - SafeNativeMethods.PRINTDLGX86 data = CreatePRINTDLGX86(); - data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; - bool status = SafeNativeMethods.PrintDlg(data); - - if (!status) - return SR.Format(SR.NoDefaultPrinter); - - IntPtr handle = data.hDevNames; - IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); - if (names == IntPtr.Zero) - throw new Win32Exception(); - - string name = ReadOneDEVNAME(names, 1); - SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); - names = IntPtr.Zero; - - // Windows allocates them, but we have to free them - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); - - return name; - } - } - - - // Called by get_OutputPort - private static string GetOutputPort() - { - if (IntPtr.Size == 8) - { - SafeNativeMethods.PRINTDLG data = CreatePRINTDLG(); - data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; - bool status = SafeNativeMethods.PrintDlg(data); - if (!status) - return SR.Format(SR.NoDefaultPrinter); - - IntPtr handle = data.hDevNames; - IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); - if (names == IntPtr.Zero) - throw new Win32Exception(); - - string name = ReadOneDEVNAME(names, 2); - - SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); - names = IntPtr.Zero; - - // Windows allocates them, but we have to free them - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); - - return name; - } - else - { - SafeNativeMethods.PRINTDLGX86 data = CreatePRINTDLGX86(); - data.Flags = SafeNativeMethods.PD_RETURNDEFAULT; - bool status = SafeNativeMethods.PrintDlg(data); - - if (!status) - return SR.Format(SR.NoDefaultPrinter); - - IntPtr handle = data.hDevNames; - IntPtr names = SafeNativeMethods.GlobalLock(new HandleRef(data, handle)); - if (names == IntPtr.Zero) - throw new Win32Exception(); - - string name = ReadOneDEVNAME(names, 2); - - SafeNativeMethods.GlobalUnlock(new HandleRef(data, handle)); - names = IntPtr.Zero; - - // Windows allocates them, but we have to free them - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevNames)); - SafeNativeMethods.GlobalFree(new HandleRef(data, data.hDevMode)); - - return name; - } - } - - private int GetDeviceCaps(int capability, int defaultValue) - { - DeviceContext dc = CreateInformationContext(DefaultPageSettings); - int result = defaultValue; - - try - { - result = UnsafeNativeMethods.GetDeviceCaps(new HandleRef(dc, dc.Hdc), capability); - } - catch (InvalidPrinterException) - { - // do nothing, will return defaultValue. - } - finally - { - dc.Dispose(); - } - - return result; - } - - /// - /// Creates a handle to a DEVMODE structure which correspond too the printer settings.When you are done with the - /// handle, you must deallocate it yourself: - /// Windows.GlobalFree(handle); - /// Where "handle" is the return value from this method. - /// - public IntPtr GetHdevmode() - { - // Don't assert unmanaged code -- anyone using handles should have unmanaged code permission - IntPtr modeHandle = GetHdevmodeInternal(); - _defaultPageSettings.CopyToHdevmode(modeHandle); - return modeHandle; - } - - internal IntPtr GetHdevmodeInternal() - { - // getting the printer name is quite expensive if PrinterName is left default, - // because it needs to figure out what the default printer is - return GetHdevmodeInternal(PrinterNameInternal); - } - - private IntPtr GetHdevmodeInternal(string printer) - { - // Create DEVMODE - int modeSize = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, IntPtr.Zero, NativeMethods.NullHandleRef, 0); - if (modeSize < 1) - { - throw new InvalidPrinterException(this); - } - IntPtr handle = SafeNativeMethods.GlobalAlloc(SafeNativeMethods.GMEM_MOVEABLE, (uint)modeSize); // cannot be <0 anyway - IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, handle)); - - //Get the DevMode only if its not cached.... - if (_cachedDevmode != null) - { - Marshal.Copy(_cachedDevmode, 0, pointer, _devmodebytes); - } - else - { - int returnCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, pointer, NativeMethods.NullHandleRef, SafeNativeMethods.DM_OUT_BUFFER); - if (returnCode < 0) - { - throw new Win32Exception(); - } - } - - SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)Marshal.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE)); - - - if (_extrainfo != null) - { - // guard against buffer overrun attacks (since design allows client to set a new printer name without updating the devmode) - // by checking for a large enough buffer size before copying the extrainfo buffer - if (_extrabytes <= mode.dmDriverExtra) - { - IntPtr pointeroffset = (IntPtr)(checked((long)pointer + (long)mode.dmSize)); - Marshal.Copy(_extrainfo, 0, pointeroffset, _extrabytes); - } - } - if ((mode.dmFields & SafeNativeMethods.DM_COPIES) == SafeNativeMethods.DM_COPIES) - { - if (_copies != -1) - mode.dmCopies = _copies; - } - - if ((mode.dmFields & SafeNativeMethods.DM_DUPLEX) == SafeNativeMethods.DM_DUPLEX) - { - if (unchecked((int)_duplex) != -1) - mode.dmDuplex = unchecked((short)_duplex); - } - - if ((mode.dmFields & SafeNativeMethods.DM_COLLATE) == SafeNativeMethods.DM_COLLATE) - { - if (_collate.IsNotDefault) - mode.dmCollate = (short)(((bool)_collate) ? SafeNativeMethods.DMCOLLATE_TRUE : SafeNativeMethods.DMCOLLATE_FALSE); - } - - Marshal.StructureToPtr(mode, pointer, false); - - int retCode = SafeNativeMethods.DocumentProperties(NativeMethods.NullHandleRef, NativeMethods.NullHandleRef, printer, pointer, pointer, SafeNativeMethods.DM_IN_BUFFER | SafeNativeMethods.DM_OUT_BUFFER); - if (retCode < 0) - { - SafeNativeMethods.GlobalFree(new HandleRef(null, handle)); - SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle)); - return IntPtr.Zero; - } - - - SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle)); - return handle; - } - - /// - /// Creates a handle to a DEVMODE structure which correspond to the printer and page settings. - /// When you are done with the handle, you must deallocate it yourself: - /// Windows.GlobalFree(handle); - /// Where "handle" is the return value from this method. - /// - public IntPtr GetHdevmode(PageSettings pageSettings) - { - IntPtr modeHandle = GetHdevmodeInternal(); - pageSettings.CopyToHdevmode(modeHandle); - - return modeHandle; - } - - /// - /// Creates a handle to a DEVNAMES structure which correspond to the printer settings. - /// When you are done with the handle, you must deallocate it yourself: - /// Windows.GlobalFree(handle); - /// Where "handle" is the return value from this method. - /// - public IntPtr GetHdevnames() - { - string printerName = PrinterName; // the PrinterName property is slow when using the default printer - string driver = DriverName; // make sure we are writing out exactly the same string as we got the length of - string outPort = OutputPort; - - // Create DEVNAMES structure - // +4 for null terminator - int namesCharacters = checked(4 + printerName.Length + driver.Length + outPort.Length); - - // 8 = size of fixed portion of DEVNAMES - short offset = (short)(8 / Marshal.SystemDefaultCharSize); // Offsets are in characters, not bytes - uint namesSize = (uint)checked(Marshal.SystemDefaultCharSize * (offset + namesCharacters)); // always >0 - IntPtr handle = SafeNativeMethods.GlobalAlloc(SafeNativeMethods.GMEM_MOVEABLE | SafeNativeMethods.GMEM_ZEROINIT, namesSize); - IntPtr namesPointer = SafeNativeMethods.GlobalLock(new HandleRef(null, handle)); - - Marshal.WriteInt16(namesPointer, offset); // wDriverOffset - offset += WriteOneDEVNAME(driver, namesPointer, offset); - Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 2)), offset); // wDeviceOffset - offset += WriteOneDEVNAME(printerName, namesPointer, offset); - Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 4)), offset); // wOutputOffset - offset += WriteOneDEVNAME(outPort, namesPointer, offset); - Marshal.WriteInt16((IntPtr)(checked((long)namesPointer + 6)), offset); // wDefault - - SafeNativeMethods.GlobalUnlock(new HandleRef(null, handle)); - return handle; - } - - // Handles creating then disposing a default DEVMODE - internal short GetModeField(ModeField field, short defaultValue) - { - return GetModeField(field, defaultValue, IntPtr.Zero); - } - - internal short GetModeField(ModeField field, short defaultValue, IntPtr modeHandle) - { - bool ownHandle = false; - short result; - try - { - if (modeHandle == IntPtr.Zero) - { - try - { - modeHandle = GetHdevmodeInternal(); - ownHandle = true; - } - catch (InvalidPrinterException) - { - return defaultValue; - } - } - - IntPtr modePointer = SafeNativeMethods.GlobalLock(new HandleRef(this, modeHandle)); - SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)Marshal.PtrToStructure(modePointer, typeof(SafeNativeMethods.DEVMODE)); - switch (field) - { - case ModeField.Orientation: - result = mode.dmOrientation; - break; - case ModeField.PaperSize: - result = mode.dmPaperSize; - break; - case ModeField.PaperLength: - result = mode.dmPaperLength; - break; - case ModeField.PaperWidth: - result = mode.dmPaperWidth; - break; - case ModeField.Copies: - result = mode.dmCopies; - break; - case ModeField.DefaultSource: - result = mode.dmDefaultSource; - break; - case ModeField.PrintQuality: - result = mode.dmPrintQuality; - break; - case ModeField.Color: - result = mode.dmColor; - break; - case ModeField.Duplex: - result = mode.dmDuplex; - break; - case ModeField.YResolution: - result = mode.dmYResolution; - break; - case ModeField.TTOption: - result = mode.dmTTOption; - break; - case ModeField.Collate: - result = mode.dmCollate; - break; - default: - Debug.Fail("Invalid field in GetModeField"); - result = defaultValue; - break; - } - SafeNativeMethods.GlobalUnlock(new HandleRef(this, modeHandle)); - } - finally - { - if (ownHandle) - { - SafeNativeMethods.GlobalFree(new HandleRef(this, modeHandle)); - } - } - return result; - } - - internal PaperSize[] Get_PaperSizes() - { - string printerName = PrinterName; // this is quite expensive if PrinterName is left default - - int count = FastDeviceCapabilities(SafeNativeMethods.DC_PAPERNAMES, IntPtr.Zero, -1, printerName); - if (count == -1) - return new PaperSize[0]; - int stringSize = Marshal.SystemDefaultCharSize * 64; - IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count)); - FastDeviceCapabilities(SafeNativeMethods.DC_PAPERNAMES, namesBuffer, -1, printerName); - - Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_PAPERS, IntPtr.Zero, -1, printerName) == count, - "Not the same number of paper kinds as paper names?"); - IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count); - FastDeviceCapabilities(SafeNativeMethods.DC_PAPERS, kindsBuffer, -1, printerName); - - Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_PAPERSIZE, IntPtr.Zero, -1, printerName) == count, - "Not the same number of paper kinds as paper names?"); - IntPtr dimensionsBuffer = Marshal.AllocCoTaskMem(8 * count); - FastDeviceCapabilities(SafeNativeMethods.DC_PAPERSIZE, dimensionsBuffer, -1, printerName); - - PaperSize[] result = new PaperSize[count]; - for (int i = 0; i < count; i++) - { - string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 64); - int index = name.IndexOf('\0'); - if (index > -1) - { - name = name.Substring(0, index); - } - short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + i * 2))); - int width = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8))); - int height = Marshal.ReadInt32((IntPtr)(checked((long)dimensionsBuffer + i * 8 + 4))); - result[i] = new PaperSize((PaperKind)kind, name, - PrinterUnitConvert.Convert(width, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), - PrinterUnitConvert.Convert(height, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display)); - } - - Marshal.FreeCoTaskMem(namesBuffer); - Marshal.FreeCoTaskMem(kindsBuffer); - Marshal.FreeCoTaskMem(dimensionsBuffer); - return result; - } - - internal PaperSource[] Get_PaperSources() - { - string printerName = PrinterName; // this is quite expensive if PrinterName is left default - - int count = FastDeviceCapabilities(SafeNativeMethods.DC_BINNAMES, IntPtr.Zero, -1, printerName); - if (count == -1) - return new PaperSource[0]; - - // Contrary to documentation, DeviceCapabilities returns char[count, 24], - // not char[count][24] - int stringSize = Marshal.SystemDefaultCharSize * 24; - IntPtr namesBuffer = Marshal.AllocCoTaskMem(checked(stringSize * count)); - FastDeviceCapabilities(SafeNativeMethods.DC_BINNAMES, namesBuffer, -1, printerName); - - Debug.Assert(FastDeviceCapabilities(SafeNativeMethods.DC_BINS, IntPtr.Zero, -1, printerName) == count, - "Not the same number of bin kinds as bin names?"); - IntPtr kindsBuffer = Marshal.AllocCoTaskMem(2 * count); - FastDeviceCapabilities(SafeNativeMethods.DC_BINS, kindsBuffer, -1, printerName); - - PaperSource[] result = new PaperSource[count]; - for (int i = 0; i < count; i++) - { - string name = Marshal.PtrToStringAuto((IntPtr)(checked((long)namesBuffer + stringSize * i)), 24); - int index = name.IndexOf('\0'); - if (index > -1) - { - name = name.Substring(0, index); - } - - short kind = Marshal.ReadInt16((IntPtr)(checked((long)kindsBuffer + 2 * i))); - result[i] = new PaperSource((PaperSourceKind)kind, name); - } - - Marshal.FreeCoTaskMem(namesBuffer); - Marshal.FreeCoTaskMem(kindsBuffer); - return result; - } - - internal PrinterResolution[] Get_PrinterResolutions() - { - string printerName = PrinterName; // this is quite expensive if PrinterName is left default - PrinterResolution[] result; - - int count = FastDeviceCapabilities(SafeNativeMethods.DC_ENUMRESOLUTIONS, IntPtr.Zero, -1, printerName); - if (count == -1) - { - //Just return the standrard values if custom resolutions absemt .... - result = new PrinterResolution[4]; - result[0] = new PrinterResolution(PrinterResolutionKind.High, -4, -1); - result[1] = new PrinterResolution(PrinterResolutionKind.Medium, -3, -1); - result[2] = new PrinterResolution(PrinterResolutionKind.Low, -2, -1); - result[3] = new PrinterResolution(PrinterResolutionKind.Draft, -1, -1); - - return result; - } - - result = new PrinterResolution[count + 4]; - result[0] = new PrinterResolution(PrinterResolutionKind.High, -4, -1); - result[1] = new PrinterResolution(PrinterResolutionKind.Medium, -3, -1); - result[2] = new PrinterResolution(PrinterResolutionKind.Low, -2, -1); - result[3] = new PrinterResolution(PrinterResolutionKind.Draft, -1, -1); - - IntPtr buffer = Marshal.AllocCoTaskMem(checked(8 * count)); - FastDeviceCapabilities(SafeNativeMethods.DC_ENUMRESOLUTIONS, buffer, -1, printerName); - - for (int i = 0; i < count; i++) - { - int x = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i * 8))); - int y = Marshal.ReadInt32((IntPtr)(checked((long)buffer + i * 8 + 4))); - result[i + 4] = new PrinterResolution(PrinterResolutionKind.Custom, x, y); - } - - Marshal.FreeCoTaskMem(buffer); - return result; - } - - // names is pointer to DEVNAMES - private static String ReadOneDEVNAME(IntPtr pDevnames, int slot) - { - int offset = checked(Marshal.SystemDefaultCharSize * Marshal.ReadInt16((IntPtr)(checked((long)pDevnames + slot * 2)))); - string result = Marshal.PtrToStringAuto((IntPtr)(checked((long)pDevnames + offset))); - return result; - } - - /// - /// Copies the relevant information out of the handle and into the PrinterSettings. - /// - public void SetHdevmode(IntPtr hdevmode) - { - if (hdevmode == IntPtr.Zero) - throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevmode)); - - IntPtr pointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevmode)); - SafeNativeMethods.DEVMODE mode = (SafeNativeMethods.DEVMODE)Marshal.PtrToStructure(pointer, typeof(SafeNativeMethods.DEVMODE)); - - //Copy entire public devmode as a byte array... - _devmodebytes = mode.dmSize; - if (_devmodebytes > 0) - { - _cachedDevmode = new byte[_devmodebytes]; - Marshal.Copy(pointer, _cachedDevmode, 0, _devmodebytes); - } - - //Copy private devmode as a byte array.. - _extrabytes = mode.dmDriverExtra; - if (_extrabytes > 0) - { - _extrainfo = new byte[_extrabytes]; - Marshal.Copy((IntPtr)(checked((long)pointer + (long)mode.dmSize)), _extrainfo, 0, _extrabytes); - } - - if ((mode.dmFields & SafeNativeMethods.DM_COPIES) == SafeNativeMethods.DM_COPIES) - { - _copies = mode.dmCopies; - } - - if ((mode.dmFields & SafeNativeMethods.DM_DUPLEX) == SafeNativeMethods.DM_DUPLEX) - { - _duplex = (Duplex)mode.dmDuplex; - } - - if ((mode.dmFields & SafeNativeMethods.DM_COLLATE) == SafeNativeMethods.DM_COLLATE) - { - _collate = (mode.dmCollate == SafeNativeMethods.DMCOLLATE_TRUE); - } - - SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevmode)); - } - - /// - /// Copies the relevant information out of the handle and into the PrinterSettings. - /// - public void SetHdevnames(IntPtr hdevnames) - { - if (hdevnames == IntPtr.Zero) - throw new ArgumentException(SR.Format(SR.InvalidPrinterHandle, hdevnames)); - - IntPtr namesPointer = SafeNativeMethods.GlobalLock(new HandleRef(null, hdevnames)); - - _driverName = ReadOneDEVNAME(namesPointer, 0); - _printerName = ReadOneDEVNAME(namesPointer, 1); - _outputPort = ReadOneDEVNAME(namesPointer, 2); - - PrintDialogDisplayed = true; - - SafeNativeMethods.GlobalUnlock(new HandleRef(null, hdevnames)); - } - - /// - /// Provides some interesting information about the PrinterSettings in String form. - /// - public override string ToString() - { - string printerName = PrinterName; - return "[PrinterSettings " - + printerName - + " Copies=" + Copies.ToString(CultureInfo.InvariantCulture) - + " Collate=" + Collate.ToString(CultureInfo.InvariantCulture) - + " Duplex=" + Duplex.ToString() - + " FromPage=" + FromPage.ToString(CultureInfo.InvariantCulture) - + " LandscapeAngle=" + LandscapeAngle.ToString(CultureInfo.InvariantCulture) - + " MaximumCopies=" + MaximumCopies.ToString(CultureInfo.InvariantCulture) - + " OutputPort=" + OutputPort.ToString(CultureInfo.InvariantCulture) - + " ToPage=" + ToPage.ToString(CultureInfo.InvariantCulture) - + "]"; - } - - // Write null terminated string, return length of string in characters (including null) - private short WriteOneDEVNAME(string str, IntPtr bufferStart, int index) - { - if (str == null) - str = ""; - IntPtr address = (IntPtr)(checked((long)bufferStart + index * Marshal.SystemDefaultCharSize)); - - char[] data = str.ToCharArray(); - Marshal.Copy(data, 0, address, data.Length); - Marshal.WriteInt16((IntPtr)(checked((long)address + data.Length * 2)), 0); - - return checked((short)(str.Length + 1)); - } - - /// - /// Collection of PaperSize's... - /// - public class PaperSizeCollection : ICollection - { - private PaperSize[] _array; - - /// - /// Initializes a new instance of the class. - /// - public PaperSizeCollection(PaperSize[] array) - { - _array = array; - } - - /// - /// Gets a value indicating the number of paper sizes. - /// - public int Count - { - get - { - return _array.Length; - } - } - - /// - /// Retrieves the PaperSize with the specified index. - /// - public virtual PaperSize this[int index] - { - get - { - return _array[index]; - } - } - - public IEnumerator GetEnumerator() - { - return new ArrayEnumerator(_array, 0, Count); - } - - int ICollection.Count - { - get - { - return Count; - } - } - - - bool ICollection.IsSynchronized - { - get - { - return false; - } - } - - object ICollection.SyncRoot - { - get - { - return this; - } - } - - void ICollection.CopyTo(Array array, int index) - { - Array.Copy(_array, index, array, 0, _array.Length); - } - - public void CopyTo(PaperSize[] paperSizes, int index) - { - Array.Copy(_array, index, paperSizes, 0, _array.Length); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - [ - EditorBrowsable(EditorBrowsableState.Never) - ] - public Int32 Add(PaperSize paperSize) - { - PaperSize[] newArray = new PaperSize[Count + 1]; - ((ICollection)this).CopyTo(newArray, 0); - newArray[Count] = paperSize; - _array = newArray; - return Count; - } - } - - public class PaperSourceCollection : ICollection - { - private PaperSource[] _array; - - /// - /// Initializes a new instance of the class. - /// - public PaperSourceCollection(PaperSource[] array) - { - _array = array; - } - - /// - /// Gets a value indicating the number of paper sources. - /// - public int Count - { - get - { - return _array.Length; - } - } - - /// - /// Gets the PaperSource with the specified index. - /// - public virtual PaperSource this[int index] - { - get - { - return _array[index]; - } - } - - public IEnumerator GetEnumerator() - { - return new ArrayEnumerator(_array, 0, Count); - } - - int ICollection.Count - { - get - { - return Count; - } - } - - - bool ICollection.IsSynchronized - { - get - { - return false; - } - } - - object ICollection.SyncRoot - { - get - { - return this; - } - } - - void ICollection.CopyTo(Array array, int index) - { - Array.Copy(_array, index, array, 0, _array.Length); - } - - public void CopyTo(PaperSource[] paperSources, int index) - { - Array.Copy(_array, index, paperSources, 0, _array.Length); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - public Int32 Add(PaperSource paperSource) - { - PaperSource[] newArray = new PaperSource[Count + 1]; - ((ICollection)this).CopyTo(newArray, 0); - newArray[Count] = paperSource; - _array = newArray; - return Count; - } - } - - public class PrinterResolutionCollection : ICollection - { - private PrinterResolution[] _array; - - /// - /// Initializes a new instance of the class. - /// - public PrinterResolutionCollection(PrinterResolution[] array) - { - _array = array; - } - - /// - /// Gets a value indicating the number of available printer resolutions. - /// - public int Count - { - get - { - return _array.Length; - } - } - - /// - /// Retrieves the PrinterResolution with the specified index. - /// - public virtual PrinterResolution this[int index] - { - get - { - return _array[index]; - } - } - - public IEnumerator GetEnumerator() - { - return new ArrayEnumerator(_array, 0, Count); - } - - int ICollection.Count - { - get - { - return Count; - } - } - - bool ICollection.IsSynchronized - { - get - { - return false; - } - } - - object ICollection.SyncRoot - { - get - { - return this; - } - } - - void ICollection.CopyTo(Array array, int index) - { - Array.Copy(_array, index, array, 0, _array.Length); - } - - public void CopyTo(PrinterResolution[] printerResolutions, int index) - { - Array.Copy(_array, index, printerResolutions, 0, _array.Length); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - public Int32 Add(PrinterResolution printerResolution) - { - PrinterResolution[] newArray = new PrinterResolution[Count + 1]; - ((ICollection)this).CopyTo(newArray, 0); - newArray[Count] = printerResolution; - _array = newArray; - return Count; - } - } - - public class StringCollection : ICollection - { - private String[] _array; - - /// - /// Initializes a new instance of the class. - /// - public StringCollection(String[] array) - { - _array = array; - } - - /// - /// Gets a value indicating the number of strings. - /// - public int Count - { - get - { - return _array.Length; - } - } - - /// - /// Gets the string with the specified index. - /// - public virtual String this[int index] - { - get - { - return _array[index]; - } - } - - public IEnumerator GetEnumerator() - { - return new ArrayEnumerator(_array, 0, Count); - } - - int ICollection.Count - { - get - { - return Count; - } - } - - bool ICollection.IsSynchronized - { - get - { - return false; - } - } - - object ICollection.SyncRoot - { - get - { - return this; - } - } - - void ICollection.CopyTo(Array array, int index) - { - Array.Copy(_array, index, array, 0, _array.Length); - } - - - public void CopyTo(string[] strings, int index) - { - Array.Copy(_array, index, strings, 0, _array.Length); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - [ - EditorBrowsable(EditorBrowsableState.Never) - ] - public Int32 Add(String value) - { - String[] newArray = new String[Count + 1]; - ((ICollection)this).CopyTo(newArray, 0); - newArray[Count] = value; - _array = newArray; - return Count; - } - } - - private class ArrayEnumerator : IEnumerator - { - private object[] _array; - private object _item; - private int _index; - private int _startIndex; - private int _endIndex; - - public ArrayEnumerator(object[] array, int startIndex, int count) - { - _array = array; - _startIndex = startIndex; - _endIndex = _index + count; - - _index = _startIndex; - } - - public object Current - { - get - { - return _item; - } - } - - - public bool MoveNext() - { - if (_index >= _endIndex) - return false; - _item = _array[_index++]; - return true; - } - - public void Reset() - { - // Position enumerator before first item - - _index = _startIndex; - _item = null; - } - } - } -} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs new file mode 100644 index 0000000000..0e4d3773f8 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs @@ -0,0 +1,1101 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005 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. +// +// Author: +// +// Jordi Mas i Hernandez, jordimash@gmail.com +// + +using System.Runtime.InteropServices; +using System.Collections; +using System.Drawing.Printing; +using System.ComponentModel; +using System.Drawing.Imaging; +using System.Diagnostics; +using System.Text; +using System.IO; +using System.Collections.Specialized; + +namespace System.Drawing.Printing +{ + /// + /// This class is designed to cache the values retrieved by the + /// native printing services, as opposed to GlobalPrintingServices, which + /// doesn't cache any values. + /// + internal static class PrintingServices + { + #region Private Fields + + private static Hashtable doc_info = new Hashtable(); + private static bool cups_installed; + + private static Hashtable installed_printers; + private static string default_printer = String.Empty; + + #endregion + + #region Constructor + + static PrintingServices() + { + installed_printers = new Hashtable(); + CheckCupsInstalled(); + } + + #endregion + + #region Properties + + internal static PrinterSettings.StringCollection InstalledPrinters + { + get + { + LoadPrinters(); + PrinterSettings.StringCollection list = new PrinterSettings.StringCollection(new string[] { }); + foreach (object key in installed_printers.Keys) + { + list.Add(key.ToString()); + } + return list; + } + } + + internal static string DefaultPrinter + { + get + { + if (installed_printers.Count == 0) + LoadPrinters(); + return default_printer; + } + } + + #endregion + + + #region Methods + + /// + /// Do a cups call to check if it is installed + /// + private static void CheckCupsInstalled() + { + try + { + LibcupsNative.cupsGetDefault(); + } + catch (DllNotFoundException) + { +#if NETCORE + System.Diagnostics.Debug.WriteLine("libcups not found. To have printing support, you need cups installed"); +#else + Console.WriteLine("libcups not found. To have printing support, you need cups installed"); +#endif + cups_installed = false; + return; + } + + cups_installed = true; + } + + /// + /// Open the printer's PPD file + /// + /// Printer name, returned from cupsGetDests + private static IntPtr OpenPrinter(string printer) + { + try + { + IntPtr ptr = LibcupsNative.cupsGetPPD(printer); + string ppd_filename = Marshal.PtrToStringAnsi(ptr); + IntPtr ppd_handle = LibcupsNative.ppdOpenFile(ppd_filename); + return ppd_handle; + } + catch (Exception) + { +#if NETCORE + System.Diagnostics.Debug.WriteLine("There was an error opening the printer {0}. Please check your cups installation."); +#else + Console.WriteLine("There was an error opening the printer {0}. Please check your cups installation."); +#endif + } + return IntPtr.Zero; + } + + /// + /// Close the printer file + /// + /// PPD handle + private static void ClosePrinter(ref IntPtr handle) + { + try + { + if (handle != IntPtr.Zero) + LibcupsNative.ppdClose(handle); + } + finally + { + handle = IntPtr.Zero; + } + } + + private static int OpenDests(ref IntPtr ptr) + { + try + { + return LibcupsNative.cupsGetDests(ref ptr); + } + catch + { + ptr = IntPtr.Zero; + } + return 0; + } + + private static void CloseDests(ref IntPtr ptr, int count) + { + try + { + if (ptr != IntPtr.Zero) + LibcupsNative.cupsFreeDests(count, ptr); + } + finally + { + ptr = IntPtr.Zero; + } + } + + /// + /// Checks if a printer has a valid PPD file. Caches the result unless force is true + /// + /// Does the check disregarding the last cached value if true + internal static bool IsPrinterValid(string printer) + { + if (!cups_installed || printer == null | printer == String.Empty) + return false; + + return installed_printers.Contains(printer); + } + + /// + /// Loads the printer settings and initializes the PrinterSettings and PageSettings fields + /// + /// Printer name + /// PrinterSettings object to initialize + internal static void LoadPrinterSettings(string printer, PrinterSettings settings) + { + if (cups_installed == false || (printer == null) || (printer == String.Empty)) + return; + + if (installed_printers.Count == 0) + LoadPrinters(); + + if (((SysPrn.Printer)installed_printers[printer]).Settings != null) + { + SysPrn.Printer p = (SysPrn.Printer)installed_printers[printer]; + settings.can_duplex = p.Settings.can_duplex; + settings.is_plotter = p.Settings.is_plotter; + settings.landscape_angle = p.Settings.landscape_angle; + settings.maximum_copies = p.Settings.maximum_copies; + settings.paper_sizes = p.Settings.paper_sizes; + settings.paper_sources = p.Settings.paper_sources; + settings.printer_capabilities = p.Settings.printer_capabilities; + settings.printer_resolutions = p.Settings.printer_resolutions; + settings.supports_color = p.Settings.supports_color; + return; + } + + settings.PrinterCapabilities.Clear(); + + IntPtr dests = IntPtr.Zero, ptr = IntPtr.Zero, ptr_printer, ppd_handle = IntPtr.Zero; + string name = String.Empty; + CUPS_DESTS printer_dest; + PPD_FILE ppd; + int ret = 0, cups_dests_size; + NameValueCollection options, paper_names, paper_sources; + + try + { + ret = OpenDests(ref dests); + if (ret == 0) + return; + + cups_dests_size = Marshal.SizeOf(typeof(CUPS_DESTS)); + ptr = dests; + for (int i = 0; i < ret; i++) + { + ptr_printer = (IntPtr)Marshal.ReadIntPtr(ptr); + if (Marshal.PtrToStringAnsi(ptr_printer).Equals(printer)) + { + name = printer; + break; + } + ptr = (IntPtr)((long)ptr + cups_dests_size); + } + + if (!name.Equals(printer)) + { + return; + } + + ppd_handle = OpenPrinter(printer); + if (ppd_handle == IntPtr.Zero) + return; + + printer_dest = (CUPS_DESTS)Marshal.PtrToStructure(ptr, typeof(CUPS_DESTS)); + options = new NameValueCollection(); + paper_names = new NameValueCollection(); + paper_sources = new NameValueCollection(); + string defsize; + string defsource; + LoadPrinterOptions(printer_dest.options, printer_dest.num_options, ppd_handle, options, + paper_names, out defsize, + paper_sources, out defsource); + + if (settings.paper_sizes == null) + settings.paper_sizes = new PrinterSettings.PaperSizeCollection(new PaperSize[] { }); + else + settings.paper_sizes.Clear(); + + if (settings.paper_sources == null) + settings.paper_sources = new PrinterSettings.PaperSourceCollection(new PaperSource[] { }); + else + settings.paper_sources.Clear(); + + settings.DefaultPageSettings.PaperSource = LoadPrinterPaperSources(settings, defsource, paper_sources); + settings.DefaultPageSettings.PaperSize = LoadPrinterPaperSizes(ppd_handle, settings, defsize, paper_names); + LoadPrinterResolutionsAndDefault(printer, settings, ppd_handle); + + ppd = (PPD_FILE)Marshal.PtrToStructure(ppd_handle, typeof(PPD_FILE)); + settings.landscape_angle = ppd.landscape; + settings.supports_color = (ppd.color_device == 0) ? false : true; + settings.can_duplex = options["Duplex"] != null; + + ClosePrinter(ref ppd_handle); + + ((SysPrn.Printer)installed_printers[printer]).Settings = settings; + } + finally + { + CloseDests(ref dests, ret); + } + } + + /// + /// Loads the global options of a printer plus the paper types and trays supported, + /// and sets the default paper size and source tray. + /// + /// The options field of a printer's CUPS_DESTS structure + /// The number of options of the printer + /// A ppd handle for the printer, returned by ppdOpen + /// The list of options + /// A list of types of paper (PageSize) + /// The default paper size, set by LoadOptionList + /// A list of trays(InputSlot) + /// The default source tray, set by LoadOptionList + private static void LoadPrinterOptions(IntPtr options, int numOptions, IntPtr ppd, + NameValueCollection list, + NameValueCollection paper_names, out string defsize, + NameValueCollection paper_sources, out string defsource) + { + CUPS_OPTIONS cups_options; + string option_name, option_value; + int cups_size = Marshal.SizeOf(typeof(CUPS_OPTIONS)); + + LoadOptionList(ppd, "PageSize", paper_names, out defsize); + LoadOptionList(ppd, "InputSlot", paper_sources, out defsource); + + for (int j = 0; j < numOptions; j++) + { + cups_options = (CUPS_OPTIONS)Marshal.PtrToStructure(options, typeof(CUPS_OPTIONS)); + option_name = Marshal.PtrToStringAnsi(cups_options.name); + option_value = Marshal.PtrToStringAnsi(cups_options.val); + + if (option_name == "PageSize") + defsize = option_value; + else if (option_name == "InputSlot") + defsource = option_value; +#if PrintDebug + Console.WriteLine("{0} = {1}", option_name, option_value); +#endif + + list.Add(option_name, option_value); + + options = (IntPtr)((long)options + cups_size); + } + } + + /// + /// Loads the global options of a printer. + /// + /// The options field of a printer's CUPS_DESTS structure + /// The number of options of the printer + private static NameValueCollection LoadPrinterOptions(IntPtr options, int numOptions) + { + CUPS_OPTIONS cups_options; + string option_name, option_value; + int cups_size = Marshal.SizeOf(typeof(CUPS_OPTIONS)); + NameValueCollection list = new NameValueCollection(); + for (int j = 0; j < numOptions; j++) + { + cups_options = (CUPS_OPTIONS)Marshal.PtrToStructure(options, typeof(CUPS_OPTIONS)); + option_name = Marshal.PtrToStringAnsi(cups_options.name); + option_value = Marshal.PtrToStringAnsi(cups_options.val); + +#if PrintDebug + Console.WriteLine("{0} = {1}", option_name, option_value); +#endif + + list.Add(option_name, option_value); + + options = (IntPtr)((long)options + cups_size); + } + return list; + } + + /// + /// Loads a printer's options (selection of paper sizes, paper sources, etc) + /// and sets the default option from the selected list. + /// + /// Printer ppd file handle + /// Name of the option group to load + /// List of loaded options + /// The default option from the loaded options list + private static void LoadOptionList(IntPtr ppd, string option_name, NameValueCollection list, out string defoption) + { + + IntPtr ptr = IntPtr.Zero; + PPD_OPTION ppd_option; + PPD_CHOICE choice; + int choice_size = Marshal.SizeOf(typeof(PPD_CHOICE)); + defoption = null; + + ptr = LibcupsNative.ppdFindOption(ppd, option_name); + if (ptr != IntPtr.Zero) + { + ppd_option = (PPD_OPTION)Marshal.PtrToStructure(ptr, typeof(PPD_OPTION)); +#if PrintDebug + Console.WriteLine (" OPTION key:{0} def:{1} text: {2}", ppd_option.keyword, ppd_option.defchoice, ppd_option.text); +#endif + defoption = ppd_option.defchoice; + ptr = ppd_option.choices; + for (int c = 0; c < ppd_option.num_choices; c++) + { + choice = (PPD_CHOICE)Marshal.PtrToStructure(ptr, typeof(PPD_CHOICE)); + list.Add(choice.choice, choice.text); +#if PrintDebug + Console.WriteLine (" choice:{0} - text: {1}", choice.choice, choice.text); +#endif + + ptr = (IntPtr)((long)ptr + choice_size); + } + } + } + + /// + /// Loads a printer's available resolutions + /// + /// Printer name + /// PrinterSettings object to fill + internal static void LoadPrinterResolutions(string printer, PrinterSettings settings) + { + IntPtr ppd_handle = OpenPrinter(printer); + if (ppd_handle == IntPtr.Zero) + return; + + LoadPrinterResolutionsAndDefault(printer, settings, ppd_handle); + + ClosePrinter(ref ppd_handle); + } + + /// + /// Create a PrinterResolution from a string Resolution that is set in the PPD option. + /// An example of Resolution is "600x600dpi" or "600dpi". Returns null if malformed or "Unknown". + /// + private static PrinterResolution ParseResolution(string resolution) + { + if (String.IsNullOrEmpty(resolution)) + return null; + + int dpiIndex = resolution.IndexOf("dpi"); + if (dpiIndex == -1) + { + // Resolution is "Unknown" or unparsable + return null; + } + resolution = resolution.Substring(0, dpiIndex); + + int x_resolution, y_resolution; + try + { + if (resolution.Contains("x")) + { + string[] resolutions = resolution.Split(new[] { 'x' }); + x_resolution = Convert.ToInt32(resolutions[0]); + y_resolution = Convert.ToInt32(resolutions[1]); + } + else + { + x_resolution = Convert.ToInt32(resolution); + y_resolution = x_resolution; + } + } + catch (Exception) + { + return null; + } + + return new PrinterResolution(PrinterResolutionKind.Custom, x_resolution, y_resolution); + } + + /// + /// Loads a printer's paper sizes. Returns the default PaperSize, and fills a list of paper_names for use in dialogues + /// + /// PPD printer file handle + /// PrinterSettings object to fill + /// Default paper size, from the global options of the printer + /// List of available paper sizes that gets filled + private static PaperSize LoadPrinterPaperSizes(IntPtr ppd_handle, PrinterSettings settings, + string def_size, NameValueCollection paper_names) + { + IntPtr ptr; + string real_name; + PPD_FILE ppd; + PPD_SIZE size; + PaperSize ps; + + PaperSize defsize = new PaperSize(GetPaperKind(827, 1169), "A4", 827, 1169); + ppd = (PPD_FILE)Marshal.PtrToStructure(ppd_handle, typeof(PPD_FILE)); + ptr = ppd.sizes; + float w, h; + for (int i = 0; i < ppd.num_sizes; i++) + { + size = (PPD_SIZE)Marshal.PtrToStructure(ptr, typeof(PPD_SIZE)); + real_name = paper_names[size.name]; + w = size.width * 100 / 72; + h = size.length * 100 / 72; + PaperKind kind = GetPaperKind((int)w, (int)h); + ps = new PaperSize(kind, real_name, (int)w, (int)h); + ps.RawKind = (int)kind; + if (def_size == ps.Kind.ToString()) + defsize = ps; + settings.paper_sizes.Add(ps); + ptr = (IntPtr)((long)ptr + Marshal.SizeOf(size)); + } + + return defsize; + + } + + /// + /// Loads a printer's paper sources (trays). Returns the default PaperSource, and fills a list of paper_sources for use in dialogues + /// + /// PrinterSettings object to fill + /// Default paper source, from the global options of the printer + /// List of available paper sizes that gets filled + private static PaperSource LoadPrinterPaperSources(PrinterSettings settings, string def_source, + NameValueCollection paper_sources) + { + PaperSourceKind kind; + PaperSource defsource = null; + foreach (string source in paper_sources) + { + switch (source) + { + case "Auto": + kind = PaperSourceKind.AutomaticFeed; + break; + case "Standard": + kind = PaperSourceKind.AutomaticFeed; + break; + case "Tray": + kind = PaperSourceKind.AutomaticFeed; + break; + case "Envelope": + kind = PaperSourceKind.Envelope; + break; + case "Manual": + kind = PaperSourceKind.Manual; + break; + default: + kind = PaperSourceKind.Custom; + break; + } + settings.paper_sources.Add(new PaperSource(kind, paper_sources[source])); + if (def_source == source) + defsource = settings.paper_sources[settings.paper_sources.Count - 1]; + } + + if (defsource == null && settings.paper_sources.Count > 0) + return settings.paper_sources[0]; + return defsource; + } + + /// + /// Sets the available resolutions and default resolution from a + /// printer's PPD file into settings. + /// + private static void LoadPrinterResolutionsAndDefault(string printer, + PrinterSettings settings, IntPtr ppd_handle) + { + if (settings.printer_resolutions == null) + settings.printer_resolutions = new PrinterSettings.PrinterResolutionCollection(new PrinterResolution[] { }); + else + settings.printer_resolutions.Clear(); + + var printer_resolutions = new NameValueCollection(); + string defresolution; + LoadOptionList(ppd_handle, "Resolution", printer_resolutions, out defresolution); + foreach (var resolution in printer_resolutions.Keys) + { + var new_resolution = ParseResolution(resolution.ToString()); + settings.PrinterResolutions.Add(new_resolution); + } + + var default_resolution = ParseResolution(defresolution); + + if (default_resolution == null) + default_resolution = ParseResolution("300dpi"); + if (printer_resolutions.Count == 0) + settings.PrinterResolutions.Add(default_resolution); + + settings.DefaultPageSettings.PrinterResolution = default_resolution; + } + + /// + /// + /// + /// + private static void LoadPrinters() + { + installed_printers.Clear(); + if (cups_installed == false) + return; + + IntPtr dests = IntPtr.Zero, ptr_printers; + CUPS_DESTS printer; + int n_printers = 0; + int cups_dests_size = Marshal.SizeOf(typeof(CUPS_DESTS)); + string name, first, type, status, comment; + first = type = status = comment = String.Empty; + int state = 0; + + try + { + n_printers = OpenDests(ref dests); + + ptr_printers = dests; + for (int i = 0; i < n_printers; i++) + { + printer = (CUPS_DESTS)Marshal.PtrToStructure(ptr_printers, typeof(CUPS_DESTS)); + name = Marshal.PtrToStringAnsi(printer.name); + + if (printer.is_default == 1) + default_printer = name; + + if (first.Equals(String.Empty)) + first = name; + + NameValueCollection options = LoadPrinterOptions(printer.options, printer.num_options); + + if (options["printer-state"] != null) + state = Int32.Parse(options["printer-state"]); + + if (options["printer-comment"] != null) + comment = options["printer-state"]; + + switch (state) + { + case 4: + status = "Printing"; + break; + case 5: + status = "Stopped"; + break; + default: + status = "Ready"; + break; + } + + installed_printers.Add(name, new SysPrn.Printer(String.Empty, type, status, comment)); + + ptr_printers = (IntPtr)((long)ptr_printers + cups_dests_size); + } + + } + finally + { + CloseDests(ref dests, n_printers); + } + + if (default_printer.Equals(String.Empty)) + default_printer = first; + } + + /// + /// Gets a printer's settings for use in the print dialogue + /// + /// + /// + /// + /// + /// + internal static void GetPrintDialogInfo(string printer, ref string port, ref string type, ref string status, ref string comment) + { + int count = 0, state = -1; + bool found = false; + CUPS_DESTS cups_dests; + IntPtr dests = IntPtr.Zero, ptr_printers, ptr_printer; + int cups_dests_size = Marshal.SizeOf(typeof(CUPS_DESTS)); + + if (cups_installed == false) + return; + + try + { + count = OpenDests(ref dests); + + if (count == 0) + return; + + ptr_printers = dests; + + for (int i = 0; i < count; i++) + { + ptr_printer = (IntPtr)Marshal.ReadIntPtr(ptr_printers); + if (Marshal.PtrToStringAnsi(ptr_printer).Equals(printer)) + { + found = true; + break; + } + ptr_printers = (IntPtr)((long)ptr_printers + cups_dests_size); + } + + if (!found) + return; + + cups_dests = (CUPS_DESTS)Marshal.PtrToStructure(ptr_printers, typeof(CUPS_DESTS)); + + NameValueCollection options = LoadPrinterOptions(cups_dests.options, cups_dests.num_options); + + if (options["printer-state"] != null) + state = Int32.Parse(options["printer-state"]); + + if (options["printer-comment"] != null) + comment = options["printer-state"]; + + switch (state) + { + case 4: + status = "Printing"; + break; + case 5: + status = "Stopped"; + break; + default: + status = "Ready"; + break; + } + } + finally + { + CloseDests(ref dests, count); + } + } + + /// + /// Returns the appropriate PaperKind for the width and height + /// + /// + /// + private static PaperKind GetPaperKind(int width, int height) + { + if (width == 827 && height == 1169) + return PaperKind.A4; + if (width == 583 && height == 827) + return PaperKind.A5; + if (width == 717 && height == 1012) + return PaperKind.B5; + if (width == 693 && height == 984) + return PaperKind.B5Envelope; + if (width == 638 && height == 902) + return PaperKind.C5Envelope; + if (width == 449 && height == 638) + return PaperKind.C6Envelope; + if (width == 1700 && height == 2200) + return PaperKind.CSheet; + if (width == 433 && height == 866) + return PaperKind.DLEnvelope; + if (width == 2200 && height == 3400) + return PaperKind.DSheet; + if (width == 3400 && height == 4400) + return PaperKind.ESheet; + if (width == 725 && height == 1050) + return PaperKind.Executive; + if (width == 850 && height == 1300) + return PaperKind.Folio; + if (width == 850 && height == 1200) + return PaperKind.GermanStandardFanfold; + if (width == 1700 && height == 1100) + return PaperKind.Ledger; + if (width == 850 && height == 1400) + return PaperKind.Legal; + if (width == 927 && height == 1500) + return PaperKind.LegalExtra; + if (width == 850 && height == 1100) + return PaperKind.Letter; + if (width == 927 && height == 1200) + return PaperKind.LetterExtra; + if (width == 850 && height == 1269) + return PaperKind.LetterPlus; + if (width == 387 && height == 750) + return PaperKind.MonarchEnvelope; + if (width == 387 && height == 887) + return PaperKind.Number9Envelope; + if (width == 413 && height == 950) + return PaperKind.Number10Envelope; + if (width == 450 && height == 1037) + return PaperKind.Number11Envelope; + if (width == 475 && height == 1100) + return PaperKind.Number12Envelope; + if (width == 500 && height == 1150) + return PaperKind.Number14Envelope; + if (width == 363 && height == 650) + return PaperKind.PersonalEnvelope; + if (width == 1000 && height == 1100) + return PaperKind.Standard10x11; + if (width == 1000 && height == 1400) + return PaperKind.Standard10x14; + if (width == 1100 && height == 1700) + return PaperKind.Standard11x17; + if (width == 1200 && height == 1100) + return PaperKind.Standard12x11; + if (width == 1500 && height == 1100) + return PaperKind.Standard15x11; + if (width == 900 && height == 1100) + return PaperKind.Standard9x11; + if (width == 550 && height == 850) + return PaperKind.Statement; + if (width == 1100 && height == 1700) + return PaperKind.Tabloid; + if (width == 1487 && height == 1100) + return PaperKind.USStandardFanfold; + + return PaperKind.Custom; + } + + #endregion + + #region Print job methods + + static string tmpfile; + + /// + /// Gets a pointer to an options list parsed from the printer's current settings, to use when setting up the printing job + /// + /// + /// + /// + internal static int GetCupsOptions(PrinterSettings printer_settings, PageSettings page_settings, out IntPtr options) + { + options = IntPtr.Zero; + + PaperSize size = page_settings.PaperSize; + int width = size.Width * 72 / 100; + int height = size.Height * 72 / 100; + + StringBuilder sb = new StringBuilder(); + sb.Append( + "copies=" + printer_settings.Copies + " " + + "Collate=" + printer_settings.Collate + " " + + "ColorModel=" + (page_settings.Color ? "Color" : "Black") + " " + + "PageSize=" + String.Format("Custom.{0}x{1}", width, height) + " " + + "landscape=" + page_settings.Landscape + ); + + if (printer_settings.CanDuplex) + { + if (printer_settings.Duplex == Duplex.Simplex) + sb.Append(" Duplex=None"); + else + sb.Append(" Duplex=DuplexNoTumble"); + } + + return LibcupsNative.cupsParseOptions(sb.ToString(), 0, ref options); + } + + internal static bool StartDoc(GraphicsPrinter gr, string doc_name, string output_file) + { + DOCINFO doc = (DOCINFO)doc_info[gr.Hdc]; + doc.title = doc_name; + return true; + } + + internal static bool EndDoc(GraphicsPrinter gr) + { + DOCINFO doc = (DOCINFO)doc_info[gr.Hdc]; + + gr.Graphics.Dispose(); // Dispose object to force surface finish + + IntPtr options; + int options_count = GetCupsOptions(doc.settings, doc.default_page_settings, out options); + + LibcupsNative.cupsPrintFile(doc.settings.PrinterName, doc.filename, doc.title, options_count, options); + LibcupsNative.cupsFreeOptions(options_count, options); + doc_info.Remove(gr.Hdc); + if (tmpfile != null) + { + try + { File.Delete(tmpfile); } + catch { } + } + return true; + } + + internal static bool StartPage(GraphicsPrinter gr) + { + return true; + } + + internal static bool EndPage(GraphicsPrinter gr) + { + SafeNativeMethods.Gdip.GdipGetPostScriptSavePage(gr.Hdc); + return true; + } + + // Unfortunately, PrinterSettings and PageSettings couldn't be referencing each other, + // thus we need to pass them separately + internal static IntPtr CreateGraphicsContext(PrinterSettings settings, PageSettings default_page_settings) + { + IntPtr graphics = IntPtr.Zero; + string name; + if (!settings.PrintToFile) + { + StringBuilder sb = new StringBuilder(1024); + int length = sb.Capacity; + LibcupsNative.cupsTempFd(sb, length); + name = sb.ToString(); + tmpfile = name; + } + else + name = settings.PrintFileName; + + PaperSize psize = default_page_settings.PaperSize; + int width, height; + if (default_page_settings.Landscape) + { // Swap in case of landscape + width = psize.Height; + height = psize.Width; + } + else + { + width = psize.Width; + height = psize.Height; + } + + SafeNativeMethods.Gdip.GdipGetPostScriptGraphicsContext(name, + width * 72 / 100, + height * 72 / 100, + default_page_settings.PrinterResolution.X, + default_page_settings.PrinterResolution.Y, ref graphics); + + DOCINFO doc = new DOCINFO(); + doc.filename = name; + doc.settings = settings; + doc.default_page_settings = default_page_settings; + doc_info.Add(graphics, doc); + + return graphics; + } + + #endregion + +#pragma warning disable 649 + #region Struct + public struct DOCINFO + { + public PrinterSettings settings; + public PageSettings default_page_settings; + public string title; + public string filename; + } + + public struct PPD_SIZE + { + public int marked; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 42)] + public string name; + public float width; + public float length; + public float left; + public float bottom; + public float right; + public float top; + } + + public struct PPD_GROUP + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] + public string text; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 42)] + public string name; + public int num_options; + public IntPtr options; + public int num_subgroups; + public IntPtr subgrups; + } + + public struct PPD_OPTION + { + public byte conflicted; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + public string keyword; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + public string defchoice; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 81)] + public string text; + public int ui; + public int section; + public float order; + public int num_choices; + public IntPtr choices; + } + + public struct PPD_CHOICE + { + public byte marked; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + public string choice; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 81)] + public string text; + public IntPtr code; + public IntPtr option; + } + + public struct PPD_FILE + { + public int language_level; + public int color_device; + public int variable_sizes; + public int accurate_screens; + public int contone_only; + public int landscape; + public int model_number; + public int manual_copies; + public int throughput; + public int colorspace; + public IntPtr patches; + public int num_emulations; + public IntPtr emulations; + public IntPtr jcl_begin; + public IntPtr jcl_ps; + public IntPtr jcl_end; + public IntPtr lang_encoding; + public IntPtr lang_version; + public IntPtr modelname; + public IntPtr ttrasterizer; + public IntPtr manufacturer; + public IntPtr product; + public IntPtr nickname; + public IntPtr shortnickname; + public int num_groups; + public IntPtr groups; + public int num_sizes; + public IntPtr sizes; + + /* There is more data after this that we are not using*/ + } + + + public struct CUPS_OPTIONS + { + public IntPtr name; + public IntPtr val; + } + + public struct CUPS_DESTS + { + public IntPtr name; + public IntPtr instance; + public int is_default; + public int num_options; + public IntPtr options; + } + + #endregion +#pragma warning restore 649 + internal static void LoadDefaultResolutions(PrinterSettings.PrinterResolutionCollection col) + { + col.Add(new PrinterResolution(PrinterResolutionKind.High, (int)PrinterResolutionKind.High, -1)); + col.Add(new PrinterResolution(PrinterResolutionKind.Medium, (int)PrinterResolutionKind.Medium, -1)); + col.Add(new PrinterResolution(PrinterResolutionKind.Low, (int)PrinterResolutionKind.Low, -1)); + col.Add(new PrinterResolution(PrinterResolutionKind.Draft, (int)PrinterResolutionKind.Draft, -1)); + } + } + + internal class SysPrn + { + internal static void GetPrintDialogInfo(string printer, ref string port, ref string type, ref string status, ref string comment) + { + PrintingServices.GetPrintDialogInfo(printer, ref port, ref type, ref status, ref comment); + } + + internal class Printer + { + public readonly string Comment; + public readonly string Port; + public readonly string Type; + public readonly string Status; + public PrinterSettings Settings; + + public Printer(string port, string type, string status, string comment) + { + Port = port; + Type = type; + Status = status; + Comment = comment; + } + } + } + + internal class GraphicsPrinter + { + private Graphics graphics; + private IntPtr hDC; + + internal GraphicsPrinter(Graphics gr, IntPtr dc) + { + graphics = gr; + hDC = dc; + } + + internal Graphics Graphics + { + get { return graphics; } + set { graphics = value; } + } + internal IntPtr Hdc { get { return hDC; } } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/StandardPrintController.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/StandardPrintController.Unix.cs new file mode 100644 index 0000000000..d8ed01bf2d --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/StandardPrintController.Unix.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.StandardPrintController.cs +// +// Author: +// Dennis Hayes (dennish@Raytek.com) +// Herve Poussineau (hpoussineau@fr.st) +// Jordi Mas i Hernandez (jordimash@gmail.com) +// +// (C) 2002 Ximian, Inc +// + +// +// Copyright (C) 2004 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; + +namespace System.Drawing.Printing +{ + public class StandardPrintController : PrintController + { + public StandardPrintController() + { + } + + public override void OnEndPage(PrintDocument document, PrintPageEventArgs e) + { + PrintingServices.EndPage(e.GraphicsContext); + } + + public override void OnStartPrint(PrintDocument document, PrintEventArgs e) + { + IntPtr dc = PrintingServices.CreateGraphicsContext(document.PrinterSettings, document.DefaultPageSettings); + e.GraphicsContext = new GraphicsPrinter(null, dc); + PrintingServices.StartDoc(e.GraphicsContext, document.DocumentName, string.Empty); + } + + public override void OnEndPrint(PrintDocument document, PrintEventArgs e) + { + PrintingServices.EndDoc(e.GraphicsContext); + } + + public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e) + { + PrintingServices.StartPage(e.GraphicsContext); + return e.Graphics; + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.Unix.cs new file mode 100644 index 0000000000..a0d4ce033c --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.Unix.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Drawing.Drawing2D; +using System.Drawing.Internal; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + partial class Region + { + public void ReleaseHrgn(IntPtr regionHandle) + { + if (regionHandle == IntPtr.Zero) + { + throw new ArgumentNullException(nameof(regionHandle)); + } + + // for libgdiplus HRGN == GpRegion*, and we check the return code + int status = SafeNativeMethods.Gdip.GdipDeleteRegion(new HandleRef(this, regionHandle)); + SafeNativeMethods.Gdip.CheckStatus(status); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.Windows.cs new file mode 100644 index 0000000000..ef79d390ab --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.Windows.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Drawing.Drawing2D; +using System.Drawing.Internal; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + partial class Region + { + public void ReleaseHrgn(IntPtr regionHandle) + { + if (regionHandle == IntPtr.Zero) + { + throw new ArgumentNullException(nameof(regionHandle)); + } + + // On Windows HRGN are (old) GDI objects. Deskop .NET does not check the return code of IntDeleteObject + SafeNativeMethods.IntDeleteObject(new HandleRef(this, regionHandle)); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.cs index 4889bbc7b1..a8f0ff9571 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Region.cs @@ -11,7 +11,7 @@ using System.Runtime.InteropServices; namespace System.Drawing { - public sealed class Region : MarshalByRefObject, IDisposable + public sealed partial class Region : MarshalByRefObject, IDisposable { #if FINALIZATION_WATCH private string allocationSite = Graphics.GetAllocationStack(); @@ -190,17 +190,6 @@ namespace System.Drawing SafeNativeMethods.Gdip.CheckStatus(status); } - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] - public void ReleaseHrgn(IntPtr regionHandle) - { - if (regionHandle == IntPtr.Zero) - { - throw new ArgumentNullException(nameof(regionHandle)); - } - - SafeNativeMethods.IntDeleteObject(new HandleRef(this, regionHandle)); - } - public void Union(RectangleF rect) { var gprectf = new GPRECTF(rect); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SRDescriptionAttribute.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SRDescriptionAttribute.cs new file mode 100644 index 0000000000..6cb35b8b89 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SRDescriptionAttribute.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.SRDescriptionAttribute.cs +// +// Authors: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2004 Andreas Nahr +// + +// +// Copyright (C) 2004 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.ComponentModel; + +namespace System.Drawing +{ + [AttributeUsage(AttributeTargets.All)] + internal sealed class SRDescriptionAttribute : DescriptionAttribute + { + public SRDescriptionAttribute(string description) + : base(description) + { + } + + public override string Description + { + get + { + return DescriptionValue; + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs index 4d85d39bc4..4922d7c1dd 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs @@ -8,9 +8,6 @@ using System.Runtime.InteropServices; namespace System.Drawing { public sealed class SolidBrush : Brush -#if FEATURE_SYSTEM_EVENTS - , ISystemColorTracker -#endif { // GDI+ doesn't understand system colors, so we need to cache the value here. private Color _color = Color.Empty; @@ -25,13 +22,6 @@ namespace System.Drawing SafeNativeMethods.Gdip.CheckStatus(status); SetNativeBrushInternal(nativeBrush); - -#if FEATURE_SYSTEM_EVENTS - if (color.IsSystemColor) - { - SystemColorTracker.Add(this); - } -#endif } internal SolidBrush(Color color, bool immutable) : this(color) @@ -97,15 +87,6 @@ namespace System.Drawing { Color oldColor = _color; InternalSetColor(value); - -#if FEATURE_SYSTEM_EVENTS - // NOTE: We never remove brushes from the active list, so if someone is - // changing their brush colors a lot, this could be a problem. - if (value.IsSystemColor && !oldColor.IsSystemColor) - { - SystemColorTracker.Add(this); - } -#endif } } } @@ -118,16 +99,6 @@ namespace System.Drawing _color = value; } - -#if FEATURE_SYSTEM_EVENTS - void ISystemColorTracker.OnSystemColorChanged() - { - if (NativeBrush != IntPtr.Zero) - { - InternalSetColor(_color); - } - } -#endif } } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs index 22c00f5600..5a06267a51 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormat.cs @@ -10,77 +10,6 @@ namespace System.Drawing using System.Runtime.InteropServices; using System.Globalization; - [StructLayout(LayoutKind.Sequential)] - public struct CharacterRange - { - private int _first; - private int _length; - - /// - /// Initializes a new instance of the class with the specifiedcoordinates. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] - public CharacterRange(int First, int Length) - { - _first = First; - _length = Length; - } - - /// - /// Gets the First character position of this . - /// - public int First - { - get - { - return _first; - } - set - { - _first = value; - } - } - - /// - /// Gets the Length of this . - /// - public int Length - { - get - { - return _length; - } - set - { - _length = value; - } - } - - public override bool Equals(object obj) - { - if (obj.GetType() != typeof(CharacterRange)) - return false; - - CharacterRange cr = (CharacterRange)obj; - return ((_first == cr.First) && (_length == cr.Length)); - } - - public static bool operator ==(CharacterRange cr1, CharacterRange cr2) - { - return ((cr1.First == cr2.First) && (cr1.Length == cr2.Length)); - } - - public static bool operator !=(CharacterRange cr1, CharacterRange cr2) - { - return !(cr1 == cr2); - } - - public override int GetHashCode() - { - return unchecked(_first << 8 + _length); - } - } - /// /// Encapsulates text layout information (such as alignment and linespacing), display manipulations (such as /// ellipsis insertion and national digit substitution) and OpenType features. @@ -326,12 +255,24 @@ namespace System.Drawing public void SetTabStops(float firstTabOffset, float[] tabStops) { if (firstTabOffset < 0) + { throw new ArgumentException(SR.Format(SR.InvalidArgument, "firstTabOffset", firstTabOffset)); + } + + foreach (float tabStop in tabStops) // Emulate Windows GDI+ behavior. + { + if (float.IsNegativeInfinity(tabStop)) + { + throw new NotImplementedException(); + } + } int status = SafeNativeMethods.Gdip.GdipSetStringFormatTabStops(new HandleRef(this, nativeFormat), firstTabOffset, tabStops.Length, tabStops); if (status != SafeNativeMethods.Gdip.Ok) + { throw SafeNativeMethods.Gdip.StatusException(status); + } } /// @@ -482,6 +423,15 @@ namespace System.Drawing } } + internal int GetMeasurableCharacterRangeCount() + { + int cnt; + int status = SafeNativeMethods.Gdip.GdipGetStringFormatMeasurableCharacterRangeCount(new HandleRef(this, nativeFormat), out cnt); + + SafeNativeMethods.Gdip.CheckStatus(status); + return cnt; + } + /// /// Cleans up Windows resources for this . /// diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormatFlags.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormatFlags.cs index 1c2ffd3797..8742bd9dc2 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormatFlags.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormatFlags.cs @@ -24,7 +24,7 @@ namespace System.Drawing /// Specifies that no part of any glyph overhangs the bounding rectangle. By default some glyphs /// overhang the rectangle slightly where necessary to appear at the edge visually. For example /// when an italic lower case letter f in a font such as Garamond is aligned at the far left - /// of a rectangle, the lower part of the f will reach slightly further left thanthe left edge + /// of a rectangle, the lower part of the f will reach slightly further left than the left edge /// of the rectangle. Setting this flag will ensure no painting outside the rectangle but will /// cause the aligned edges of adjacent lines of text to appear uneven. /// diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs index adef01ccc2..c3aad7a835 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs @@ -55,7 +55,7 @@ namespace System.Drawing public static Brush FromSystemColor(Color c) { - if (!c.IsSystemColor) + if (!ColorUtil.IsSystemColor(c)) { throw new ArgumentException(SR.Format(SR.ColorNotSystemColor, c.ToString())); } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs index 3583e4f940..ca6ee2dd37 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemColors.cs @@ -6,47 +6,47 @@ namespace System.Drawing { public static class SystemColors { - public static Color ActiveBorder => Color.FromKnownColor(KnownColor.ActiveBorder); - public static Color ActiveCaption => Color.FromKnownColor(KnownColor.ActiveCaption); - public static Color ActiveCaptionText => Color.FromKnownColor(KnownColor.ActiveCaptionText); - public static Color AppWorkspace => Color.FromKnownColor(KnownColor.AppWorkspace); + public static Color ActiveBorder => ColorUtil.FromKnownColor(KnownColor.ActiveBorder); + public static Color ActiveCaption => ColorUtil.FromKnownColor(KnownColor.ActiveCaption); + public static Color ActiveCaptionText => ColorUtil.FromKnownColor(KnownColor.ActiveCaptionText); + public static Color AppWorkspace => ColorUtil.FromKnownColor(KnownColor.AppWorkspace); - public static Color ButtonFace => Color.FromKnownColor(KnownColor.ButtonFace); - public static Color ButtonHighlight => Color.FromKnownColor(KnownColor.ButtonHighlight); - public static Color ButtonShadow => Color.FromKnownColor(KnownColor.ButtonShadow); + public static Color ButtonFace => ColorUtil.FromKnownColor(KnownColor.ButtonFace); + public static Color ButtonHighlight => ColorUtil.FromKnownColor(KnownColor.ButtonHighlight); + public static Color ButtonShadow => ColorUtil.FromKnownColor(KnownColor.ButtonShadow); - public static Color Control => Color.FromKnownColor(KnownColor.Control); - public static Color ControlDark => Color.FromKnownColor(KnownColor.ControlDark); - public static Color ControlDarkDark => Color.FromKnownColor(KnownColor.ControlDarkDark); - public static Color ControlLight => Color.FromKnownColor(KnownColor.ControlLight); - public static Color ControlLightLight => Color.FromKnownColor(KnownColor.ControlLightLight); - public static Color ControlText => Color.FromKnownColor(KnownColor.ControlText); + public static Color Control => ColorUtil.FromKnownColor(KnownColor.Control); + public static Color ControlDark => ColorUtil.FromKnownColor(KnownColor.ControlDark); + public static Color ControlDarkDark => ColorUtil.FromKnownColor(KnownColor.ControlDarkDark); + public static Color ControlLight => ColorUtil.FromKnownColor(KnownColor.ControlLight); + public static Color ControlLightLight => ColorUtil.FromKnownColor(KnownColor.ControlLightLight); + public static Color ControlText => ColorUtil.FromKnownColor(KnownColor.ControlText); - public static Color Desktop => Color.FromKnownColor(KnownColor.Desktop); + public static Color Desktop => ColorUtil.FromKnownColor(KnownColor.Desktop); - public static Color GradientActiveCaption => Color.FromKnownColor(KnownColor.GradientActiveCaption); - public static Color GradientInactiveCaption => Color.FromKnownColor(KnownColor.GradientInactiveCaption); - public static Color GrayText => Color.FromKnownColor(KnownColor.GrayText); + public static Color GradientActiveCaption => ColorUtil.FromKnownColor(KnownColor.GradientActiveCaption); + public static Color GradientInactiveCaption => ColorUtil.FromKnownColor(KnownColor.GradientInactiveCaption); + public static Color GrayText => ColorUtil.FromKnownColor(KnownColor.GrayText); - public static Color Highlight => Color.FromKnownColor(KnownColor.Highlight); - public static Color HighlightText => Color.FromKnownColor(KnownColor.HighlightText); - public static Color HotTrack => Color.FromKnownColor(KnownColor.HotTrack); + public static Color Highlight => ColorUtil.FromKnownColor(KnownColor.Highlight); + public static Color HighlightText => ColorUtil.FromKnownColor(KnownColor.HighlightText); + public static Color HotTrack => ColorUtil.FromKnownColor(KnownColor.HotTrack); - public static Color InactiveBorder => Color.FromKnownColor(KnownColor.InactiveBorder); - public static Color InactiveCaption => Color.FromKnownColor(KnownColor.InactiveCaption); - public static Color InactiveCaptionText => Color.FromKnownColor(KnownColor.InactiveCaptionText); - public static Color Info => Color.FromKnownColor(KnownColor.Info); - public static Color InfoText => Color.FromKnownColor(KnownColor.InfoText); + public static Color InactiveBorder => ColorUtil.FromKnownColor(KnownColor.InactiveBorder); + public static Color InactiveCaption => ColorUtil.FromKnownColor(KnownColor.InactiveCaption); + public static Color InactiveCaptionText => ColorUtil.FromKnownColor(KnownColor.InactiveCaptionText); + public static Color Info => ColorUtil.FromKnownColor(KnownColor.Info); + public static Color InfoText => ColorUtil.FromKnownColor(KnownColor.InfoText); - public static Color Menu => Color.FromKnownColor(KnownColor.Menu); - public static Color MenuBar => Color.FromKnownColor(KnownColor.MenuBar); - public static Color MenuHighlight => Color.FromKnownColor(KnownColor.MenuHighlight); - public static Color MenuText => Color.FromKnownColor(KnownColor.MenuText); + public static Color Menu => ColorUtil.FromKnownColor(KnownColor.Menu); + public static Color MenuBar => ColorUtil.FromKnownColor(KnownColor.MenuBar); + public static Color MenuHighlight => ColorUtil.FromKnownColor(KnownColor.MenuHighlight); + public static Color MenuText => ColorUtil.FromKnownColor(KnownColor.MenuText); - public static Color ScrollBar => Color.FromKnownColor(KnownColor.ScrollBar); + public static Color ScrollBar => ColorUtil.FromKnownColor(KnownColor.ScrollBar); - public static Color Window => Color.FromKnownColor(KnownColor.Window); - public static Color WindowFrame => Color.FromKnownColor(KnownColor.WindowFrame); - public static Color WindowText => Color.FromKnownColor(KnownColor.WindowText); + public static Color Window => ColorUtil.FromKnownColor(KnownColor.Window); + public static Color WindowFrame => ColorUtil.FromKnownColor(KnownColor.WindowFrame); + public static Color WindowText => ColorUtil.FromKnownColor(KnownColor.WindowText); } } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.Unix.cs new file mode 100644 index 0000000000..b6eb9ee6a5 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.Unix.cs @@ -0,0 +1,77 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005, 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. +// +// Authors: +// Jordi Mas i Hernandez +// Sebastien Pouliot +// + + +namespace System.Drawing +{ + + public static partial class SystemFonts + { + public static Font CaptionFont + { + get { return new Font("Microsoft Sans Serif", 11, "CaptionFont"); } + } + + public static Font DefaultFont + { + get { return new Font("Microsoft Sans Serif", 8.25f, "DefaultFont"); } + } + + public static Font DialogFont + { + get { return new Font("Tahoma", 8, "DialogFont"); } + } + + public static Font IconTitleFont + { + get { return new Font("Microsoft Sans Serif", 11, "IconTitleFont"); } + } + + public static Font MenuFont + { + get { return new Font("Microsoft Sans Serif", 11, "MenuFont"); } + } + + public static Font MessageBoxFont + { + get { return new Font("Microsoft Sans Serif", 11, "MessageBoxFont"); } + } + + public static Font SmallCaptionFont + { + get { return new Font("Microsoft Sans Serif", 11, "SmallCaptionFont"); } + } + + public static Font StatusFont + { + get { return new Font("Microsoft Sans Serif", 11, "StatusFont"); } + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.Windows.cs new file mode 100644 index 0000000000..68238e0631 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.Windows.cs @@ -0,0 +1,266 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; + +namespace System.Drawing +{ + public static partial class SystemFonts + { + public static Font CaptionFont + { + get + { + Font captionFont = null; + + var data = new NativeMethods.NONCLIENTMETRICS(); + bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); + + if (result) + { + captionFont = GetFontFromData(data.lfCaptionFont); + } + + captionFont.SetSystemFontName(nameof(CaptionFont)); + return captionFont; + } + } + + public static Font SmallCaptionFont + { + get + { + Font smcaptionFont = null; + + var data = new NativeMethods.NONCLIENTMETRICS(); + bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); + + if (result) + { + smcaptionFont = GetFontFromData(data.lfSmCaptionFont); + } + + smcaptionFont.SetSystemFontName(nameof(SmallCaptionFont)); + return smcaptionFont; + } + } + + public static Font MenuFont + { + get + { + Font menuFont = null; + + var data = new NativeMethods.NONCLIENTMETRICS(); + bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); + + if (result) + { + menuFont = GetFontFromData(data.lfMenuFont); + } + + menuFont.SetSystemFontName(nameof(MenuFont)); + return menuFont; + } + } + + public static Font StatusFont + { + get + { + Font statusFont = null; + + var data = new NativeMethods.NONCLIENTMETRICS(); + bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); + + if (result) + { + statusFont = GetFontFromData(data.lfStatusFont); + } + + statusFont.SetSystemFontName(nameof(StatusFont)); + return statusFont; + } + } + + public static Font MessageBoxFont + { + get + { + Font messageBoxFont = null; + + var data = new NativeMethods.NONCLIENTMETRICS(); + bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); + + if (result) + { + messageBoxFont = GetFontFromData(data.lfMessageFont); + } + + messageBoxFont.SetSystemFontName(nameof(MessageBoxFont)); + return messageBoxFont; + } + } + + private static bool IsCriticalFontException(Exception ex) + { + return !( + // In any of these cases we'll handle the exception. + ex is ExternalException || + ex is ArgumentException || + ex is OutOfMemoryException || // GDI+ throws this one for many reasons other than actual OOM. + ex is InvalidOperationException || + ex is NotImplementedException || + ex is FileNotFoundException); + } + + public static Font IconTitleFont + { + get + { + Font iconTitleFont = null; + + var itfont = new SafeNativeMethods.LOGFONT(); + bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETICONTITLELOGFONT, Marshal.SizeOf(itfont), itfont, 0); + + if (result) + { + iconTitleFont = GetFontFromData(itfont); + } + + iconTitleFont.SetSystemFontName(nameof(IconTitleFont)); + return iconTitleFont; + } + } + + public static Font DefaultFont + { + get + { + Font defaultFont = null; + + // For Arabic systems, always return Tahoma 8. + bool systemDefaultLCIDIsArabic = (UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0001; + if (systemDefaultLCIDIsArabic) + { + try + { + defaultFont = new Font("Tahoma", 8); + } + catch (Exception ex) when (!IsCriticalFontException(ex)) { } + } + + // First try DEFAULT_GUI. + if (defaultFont == null) + { + IntPtr handle = UnsafeNativeMethods.GetStockObject(NativeMethods.DEFAULT_GUI_FONT); + try + { + using (Font fontInWorldUnits = Font.FromHfont(handle)) + { + defaultFont = FontInPoints(fontInWorldUnits); + } + } + catch (ArgumentException) + { + } + } + + // If DEFAULT_GUI didn't work, try Tahoma. + if (defaultFont == null) + { + try + { + defaultFont = new Font("Tahoma", 8); + } + catch (ArgumentException) + { + } + } + + // Use GenericSansSerif as a last resort - this will always work. + if (defaultFont == null) + { + defaultFont = new Font(FontFamily.GenericSansSerif, 8); + } + + if (defaultFont.Unit != GraphicsUnit.Point) + { + defaultFont = FontInPoints(defaultFont); + } + + Debug.Assert(defaultFont != null, "defaultFont wasn't set."); + + defaultFont.SetSystemFontName(nameof(DefaultFont)); + return defaultFont; + } + } + + public static Font DialogFont + { + get + { + Font dialogFont = null; + + if ((UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0011) + { + // Always return DefaultFont for Japanese cultures. + dialogFont = DefaultFont; + } + else + { + try + { + // Use MS Shell Dlg 2, 8pt for anything other than than Japanese. + dialogFont = new Font("MS Shell Dlg 2", 8); + } + catch (ArgumentException) + { + } + } + + if (dialogFont == null) + { + dialogFont = DefaultFont; + } + else if (dialogFont.Unit != GraphicsUnit.Point) + { + dialogFont = FontInPoints(dialogFont); + } + + // For Japanese cultures, SystemFonts.DefaultFont returns a new Font object every time it is invoked. + // So for Japanese we return the DefaultFont with its SystemFontName set to DialogFont. + dialogFont.SetSystemFontName(nameof(DialogFont)); + return dialogFont; + } + } + + private static Font FontInPoints(Font font) + { + return new Font(font.FontFamily, font.SizeInPoints, font.Style, GraphicsUnit.Point, font.GdiCharSet, font.GdiVerticalFont); + } + + private static Font GetFontFromData(SafeNativeMethods.LOGFONT logFont) + { + if (logFont == null) + { + return null; + } + + Font font = null; + try + { + font = Font.FromLogFont(logFont); + } + catch (Exception ex) when (!IsCriticalFontException(ex)) { } + + return + font == null ? DefaultFont : + font.Unit != GraphicsUnit.Point ? FontInPoints(font) : + font; + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs index a4d417f1f3..ed33d0be14 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemFonts.cs @@ -8,241 +8,8 @@ using System.Runtime.InteropServices; namespace System.Drawing { - public static class SystemFonts + public static partial class SystemFonts { - public static Font CaptionFont - { - get - { - Font captionFont = null; - - var data = new NativeMethods.NONCLIENTMETRICS(); - bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); - - if (result) - { - captionFont = GetFontFromData(data.lfCaptionFont); - } - - captionFont.SetSystemFontName(nameof(CaptionFont)); - return captionFont; - } - } - - public static Font SmallCaptionFont - { - get - { - Font smcaptionFont = null; - - var data = new NativeMethods.NONCLIENTMETRICS(); - bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); - - if (result) - { - smcaptionFont = GetFontFromData(data.lfSmCaptionFont); - } - - smcaptionFont.SetSystemFontName(nameof(SmallCaptionFont)); - return smcaptionFont; - } - } - - public static Font MenuFont - { - get - { - Font menuFont = null; - - var data = new NativeMethods.NONCLIENTMETRICS(); - bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); - - if (result) - { - menuFont = GetFontFromData(data.lfMenuFont); - } - - menuFont.SetSystemFontName(nameof(MenuFont)); - return menuFont; - } - } - - public static Font StatusFont - { - get - { - Font statusFont = null; - - var data = new NativeMethods.NONCLIENTMETRICS(); - bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); - - if (result) - { - statusFont = GetFontFromData(data.lfStatusFont); - } - - statusFont.SetSystemFontName(nameof(StatusFont)); - return statusFont; - } - } - - public static Font MessageBoxFont - { - get - { - Font messageBoxFont = null; - - var data = new NativeMethods.NONCLIENTMETRICS(); - bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETNONCLIENTMETRICS, data.cbSize, data, 0); - - if (result) - { - messageBoxFont = GetFontFromData(data.lfMessageFont); - } - - messageBoxFont.SetSystemFontName(nameof(MessageBoxFont)); - return messageBoxFont; - } - } - - private static bool IsCriticalFontException(Exception ex) - { - return !( - // In any of these cases we'll handle the exception. - ex is ExternalException || - ex is ArgumentException || - ex is OutOfMemoryException || // GDI+ throws this one for many reasons other than actual OOM. - ex is InvalidOperationException || - ex is NotImplementedException || - ex is FileNotFoundException); - } - - public static Font IconTitleFont - { - get - { - Font iconTitleFont = null; - - var itfont = new SafeNativeMethods.LOGFONT(); - bool result = UnsafeNativeMethods.SystemParametersInfo(NativeMethods.SPI_GETICONTITLELOGFONT, Marshal.SizeOf(itfont), itfont, 0); - - if (result) - { - iconTitleFont = GetFontFromData(itfont); - } - - iconTitleFont.SetSystemFontName(nameof(IconTitleFont)); - return iconTitleFont; - } - } - - public static Font DefaultFont - { - get - { - Font defaultFont = null; - - // For Arabic systems, always return Tahoma 8. - bool systemDefaultLCIDIsArabic = (UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0001; - if (systemDefaultLCIDIsArabic) - { - try - { - defaultFont = new Font("Tahoma", 8); - } - catch (Exception ex) when (!IsCriticalFontException(ex)) { } - } - - // First try DEFAULT_GUI. - if (defaultFont == null) - { - IntPtr handle = UnsafeNativeMethods.GetStockObject(NativeMethods.DEFAULT_GUI_FONT); - try - { - using (Font fontInWorldUnits = Font.FromHfont(handle)) - { - defaultFont = FontInPoints(fontInWorldUnits); - } - } - catch (ArgumentException) - { - } - } - - // If DEFAULT_GUI didn't work, try Tahoma. - if (defaultFont == null) - { - try - { - defaultFont = new Font("Tahoma", 8); - } - catch (ArgumentException) - { - } - } - - // Use GenericSansSerif as a last resort - this will always work. - if (defaultFont == null) - { - defaultFont = new Font(FontFamily.GenericSansSerif, 8); - } - - if (defaultFont.Unit != GraphicsUnit.Point) - { - defaultFont = FontInPoints(defaultFont); - } - - Debug.Assert(defaultFont != null, "defaultFont wasn't set."); - - defaultFont.SetSystemFontName(nameof(DefaultFont)); - return defaultFont; - } - } - - public static Font DialogFont - { - get - { - Font dialogFont = null; - - if ((UnsafeNativeMethods.GetSystemDefaultLCID() & 0x3ff) == 0x0011) - { - // Always return DefaultFont for Japanese cultures. - dialogFont = DefaultFont; - } - else - { - try - { - // Use MS Shell Dlg 2, 8pt for anything other than than Japanese. - dialogFont = new Font("MS Shell Dlg 2", 8); - } - catch (ArgumentException) - { - } - } - - if (dialogFont == null) - { - dialogFont = DefaultFont; - } - else if (dialogFont.Unit != GraphicsUnit.Point) - { - dialogFont = FontInPoints(dialogFont); - } - - // For Japanese cultures, SystemFonts.DefaultFont returns a new Font object every time it is invoked. - // So for Japanese we return the DefaultFont with its SystemFontName set to DialogFont. - dialogFont.SetSystemFontName(nameof(DialogFont)); - return dialogFont; - } - } - - private static Font FontInPoints(Font font) - { - return new Font(font.FontFamily, font.SizeInPoints, font.Style, GraphicsUnit.Point, font.GdiCharSet, font.GdiVerticalFont); - } - public static Font GetFontByName(string systemFontName) { if (nameof(CaptionFont).Equals(systemFontName)) @@ -280,25 +47,5 @@ namespace System.Drawing return null; } - - private static Font GetFontFromData(SafeNativeMethods.LOGFONT logFont) - { - if (logFont == null) - { - return null; - } - - Font font = null; - try - { - font = Font.FromLogFont(logFont); - } - catch (Exception ex) when (!IsCriticalFontException(ex)) { } - - return - font == null ? DefaultFont : - font.Unit != GraphicsUnit.Point ? FontInPoints(font) : - font; - } } } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.Unix.cs new file mode 100644 index 0000000000..2516f81bfa --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.Unix.cs @@ -0,0 +1,135 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.SystemIcons.cs +// +// Authors: +// Dennis Hayes (dennish@Raytek.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// Sebastien Pouliot +// +// (C) 2002 Ximian, Inc +// Copyright (C) 2004, 2006 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. +// + +namespace System.Drawing +{ + + // LAME: I don't see why the "old" (win 2.x) names were exposed in the fx :| + + public sealed class SystemIcons + { + + static Icon[] icons; + private const int Application_Winlogo = 0; + private const int Asterisk_Information = 1; + private const int Error_Hand = 2; + private const int Exclamation_Warning = 3; + private const int Question_ = 4; + private const int Shield_ = 5; + + static SystemIcons() + { + // we minimize the # of icons to load since most of them are duplicates + icons = new Icon[6]; + // we use an internal .ctor to ensure the SystemIcons can't de disposed +#if NETCORE + // TODO: Decide which icons to use for this. + icons[Application_Winlogo] = new Icon("placeholder.ico", true); + icons[Asterisk_Information] = new Icon("placeholder.ico", true); + icons[Error_Hand] = new Icon("placeholder.ico", true); + icons[Exclamation_Warning] = new Icon("placeholder.ico", true); + icons[Question_] = new Icon("placeholder.ico", true); + icons[Shield_] = new Icon("placeholder.ico", true); +#else + icons[Application_Winlogo] = new Icon("Mono.ico", true); + icons[Asterisk_Information] = new Icon("Information.ico", true); + icons[Error_Hand] = new Icon("Error.ico", true); + icons[Exclamation_Warning] = new Icon("Warning.ico", true); + icons[Question_] = new Icon("Question.ico", true); + icons[Shield_] = new Icon("Shield.ico", true); +#endif + } + + private SystemIcons() + { + } + + // note: same as WinLogo (for Mono) + public static Icon Application + { + get { return icons[Application_Winlogo]; } + } + + // note: same as Information + public static Icon Asterisk + { + get { return icons[Asterisk_Information]; } + } + + // note: same as Hand + public static Icon Error + { + get { return icons[Error_Hand]; } + } + + // same as Warning + public static Icon Exclamation + { + get { return icons[Exclamation_Warning]; } + } + + // note: same as Error + public static Icon Hand + { + get { return icons[Error_Hand]; } + } + + // note: same as Asterisk + public static Icon Information + { + get { return icons[Asterisk_Information]; } + } + + public static Icon Question + { + get { return icons[Question_]; } + } + + // note: same as Exclamation + public static Icon Warning + { + get { return icons[Exclamation_Warning]; } + } + + // note: same as Application (for Mono) + public static Icon WinLogo + { + get { return icons[Application_Winlogo]; } + } + + public static Icon Shield + { + get { return icons[Shield_]; } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.Windows.cs similarity index 100% rename from external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.cs rename to external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemIcons.Windows.cs diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs index b541492d96..743d120ea1 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemPens.cs @@ -56,7 +56,7 @@ namespace System.Drawing public static Pen FromSystemColor(Color c) { - if (!c.IsSystemColor) + if (!ColorUtil.IsSystemColor(c)) { throw new ArgumentException(SR.Format(SR.ColorNotSystemColor, c.ToString())); } diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.Unix.cs new file mode 100644 index 0000000000..43100306cd --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.Unix.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Drawing.Text +{ + partial class PrivateFontCollection + { + private void GdiAddFontFile(string filename) + { + // There is no GDI on Unix, only libgdiplus, so this is a no-op. + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.Windows.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.Windows.cs new file mode 100644 index 0000000000..2605002911 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.Windows.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Drawing.Text +{ + partial class PrivateFontCollection + { + private void GdiAddFontFile(string filename) + { + SafeNativeMethods.AddFontFile(filename); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs index 063398986b..b6ecdd8e99 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Text/PrivateFontCollection.cs @@ -10,9 +10,9 @@ using System.IO; namespace System.Drawing.Text { /// - /// Encapsulates a collection of objecs. + /// Encapsulates a collection of objects. /// - public sealed class PrivateFontCollection : FontCollection + public sealed partial class PrivateFontCollection : FontCollection { /// /// Initializes a new instance of the class. @@ -35,7 +35,7 @@ namespace System.Drawing.Text #if DEBUG int status = #endif - SafeNativeMethods.Gdip.GdipDeletePrivateFontCollection(out _nativeFontCollection); + SafeNativeMethods.Gdip.GdipDeletePrivateFontCollection(ref _nativeFontCollection); #if DEBUG Debug.Assert(status == SafeNativeMethods.Gdip.Ok, "GDI+ returned an error status: " + status.ToString(CultureInfo.InvariantCulture)); #endif @@ -57,13 +57,35 @@ namespace System.Drawing.Text /// public void AddFontFile(string filename) { - Path.GetFullPath(filename); + if (_nativeFontCollection == IntPtr.Zero) + { + // This is the default behavior on Desktop. The ArgumentException originates from GdipPrivateAddFontFile which would + // refuse the null pointer. + throw new ArgumentException(); + } - int status = SafeNativeMethods.Gdip.GdipPrivateAddFontFile(new HandleRef(this, _nativeFontCollection), filename); + if (filename == null) + { + // This is the default behavior on Desktop. The name "path" originates from Path.GetFullPath or similar which would refuse + // a null value. + throw new ArgumentNullException("path"); + } + + // this ensure the filename is valid (or throw the correct exception) + string fullPath = Path.GetFullPath(filename); + + if (!File.Exists(fullPath)) + { + throw new FileNotFoundException(); + } + + int status = SafeNativeMethods.Gdip.GdipPrivateAddFontFile(new HandleRef(this, _nativeFontCollection), fullPath); SafeNativeMethods.Gdip.CheckStatus(status); // Register private font with GDI as well so pure GDI-based controls (TextBox, Button for instance) can access it. - SafeNativeMethods.AddFontFile(filename); + // This is a no-op on Unix which has GDI+ (libgdiplus), not GDI; and we don't have System.Windows.Forms + // on Unix. + this.GdiAddFontFile(filename); } /// diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs index c39f329afc..1710dfb4dc 100644 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs @@ -168,7 +168,7 @@ namespace System.Drawing { if (value == null) { - throw new ArgumentNullException("value"); + throw new ArgumentNullException(nameof(value)); } int status = SafeNativeMethods.Gdip.GdipSetTextureTransform(new HandleRef(this, NativeBrush), new HandleRef(value, value.nativeMatrix)); @@ -225,6 +225,13 @@ namespace System.Drawing throw new ArgumentNullException(nameof(matrix)); } + // Multiplying the transform by a disposed matrix is a nop in GDI+, but throws + // with the libgdiplus backend. Simulate a nop for compatability with GDI+. + if (matrix.nativeMatrix == IntPtr.Zero) + { + return; + } + int status = SafeNativeMethods.Gdip.GdipMultiplyTextureTransform(new HandleRef(this, NativeBrush), new HandleRef(matrix, matrix.nativeMatrix), order); diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.Unix.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.Unix.cs new file mode 100644 index 0000000000..356fddd4b1 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.Unix.cs @@ -0,0 +1,150 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.ToolboxBitmapAttribute.cs +// +// Authors: +// Dennis Hayes (dennish@Raytek.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004 Novell, Inc. http://www.novell.com +// + +// +// Copyright (C) 2004 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; + +namespace System.Drawing +{ + [AttributeUsage(AttributeTargets.Class)] + public class ToolboxBitmapAttribute : Attribute + { + private Image smallImage = null; + private Image bigImage = null; + public static readonly ToolboxBitmapAttribute Default = new ToolboxBitmapAttribute(); + + private ToolboxBitmapAttribute() + { + } + + public ToolboxBitmapAttribute(string imageFile) + { + } + + public ToolboxBitmapAttribute(Type t) + { + smallImage = GetImageFromResource(t, null, false); + } + + public ToolboxBitmapAttribute(Type t, string name) + { + smallImage = GetImageFromResource(t, name, false); + } + + public override bool Equals(object value) + { + if (!(value is ToolboxBitmapAttribute)) + return false; + if (value == this) + return true; + return ((ToolboxBitmapAttribute)value).smallImage == this.smallImage; + } + + public override int GetHashCode() + { + return (smallImage.GetHashCode() ^ bigImage.GetHashCode()); + } + + public Image GetImage(object component) + { + return GetImage(component.GetType(), null, false); + } + + public Image GetImage(object component, bool large) + { + return GetImage(component.GetType(), null, large); + } + + public Image GetImage(Type type) + { + return GetImage(type, null, false); + } + + public Image GetImage(Type type, bool large) + { + return GetImage(type, null, large); + } + + public Image GetImage(Type type, string imgName, bool large) + { + if (smallImage == null) + smallImage = GetImageFromResource(type, imgName, false); + + if (large) + { + if (bigImage == null) + bigImage = new Bitmap(smallImage, 32, 32); + return bigImage; + } + else + return smallImage; + } + + public static Image GetImageFromResource(Type t, string imageName, bool large) + { + Bitmap bitmap; + if (imageName == null) + imageName = t.Name + ".bmp"; + + try + { + using (System.IO.Stream s = t.GetTypeInfo().Assembly.GetManifestResourceStream(t.Namespace + "." + imageName)) + { + if (s == null) + { + return null; + } + else + { + bitmap = new Bitmap(s, false); + } + } + + //FIXME: thrown too easily + //if (bitmap.Width != 16 || bitmap.Height != 16) + // throw new Exception ("ToolboxBitmap must be 16x16 pixels"); + + if (large) + return new Bitmap(bitmap, 32, 32); + return bitmap; + } + catch + { + return null; + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Unit.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/Unit.cs deleted file mode 100644 index 8127fecccf..0000000000 --- a/external/corefx/src/System.Drawing.Common/src/System/Drawing/Unit.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System.Drawing -{ - /// - /// Specifies the unit of measure for the given data. - /// - public enum GraphicsUnit - { - /// - /// Specifies the world unit as the unit of measure. - /// - World = 0, - /// - /// Specifies 1/75 inch as the unit of measure. - /// - Display = 1, - /// - /// Specifies a device pixel as the unit of measure. - /// - Pixel = 2, - /// - /// Specifies a printer's point (1/72 inch) as the unit of measure. - /// - Point = 3, - /// - /// Specifies the inch as the unit of measure. - /// - Inch = 4, - /// - /// Specifes the document unit (1/300 inch) as the unit of measure. - /// - Document = 5, - /// - /// Specifies the millimeter as the unit of measure. - /// - Millimeter = 6 - } -} - diff --git a/external/corefx/src/System.Drawing.Common/src/System/Drawing/macFunctions.cs b/external/corefx/src/System.Drawing.Common/src/System/Drawing/macFunctions.cs new file mode 100644 index 0000000000..f15b66ac60 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/System/Drawing/macFunctions.cs @@ -0,0 +1,390 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// System.Drawing.carbonFunctions.cs +// +// Authors: +// Geoff Norton (gnorton@customerdna.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. +// +#undef DEBUG_CLIPPING + +using System.Collections; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security; + +namespace System.Drawing +{ + + internal static class MacSupport + { + internal static Hashtable contextReference = new Hashtable(); + internal static object lockobj = new object(); + + internal static Delegate hwnd_delegate; + +#if DEBUG_CLIPPING + internal static float red = 1.0f; + internal static float green = 0.0f; + internal static float blue = 0.0f; + internal static int debug_threshold = 1; +#endif + + static MacSupport() + { +#if !NETSTANDARD1_6 + foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) + { + if (String.Equals(asm.GetName().Name, "System.Windows.Forms")) + { + Type driver_type = asm.GetType("System.Windows.Forms.XplatUICarbon"); + if (driver_type != null) + { + hwnd_delegate = (Delegate)driver_type.GetTypeInfo().GetField("HwndDelegate", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); + } + } + } +#endif + } + + internal static CocoaContext GetCGContextForNSView(IntPtr handle) + { + IntPtr graphicsContext = objc_msgSend(objc_getClass("NSGraphicsContext"), sel_registerName("currentContext")); + IntPtr ctx = objc_msgSend(graphicsContext, sel_registerName("graphicsPort")); + Rect bounds = new Rect(); + + CGContextSaveGState(ctx); + + objc_msgSend_stret(ref bounds, handle, sel_registerName("bounds")); + + var isFlipped = bool_objc_msgSend(handle, sel_registerName("isFlipped")); + if (isFlipped) + { + CGContextTranslateCTM(ctx, bounds.origin.x, bounds.size.height); + CGContextScaleCTM(ctx, 1.0f, -1.0f); + } + + return new CocoaContext(ctx, (int)bounds.size.width, (int)bounds.size.height); + } + + internal static CarbonContext GetCGContextForView(IntPtr handle) + { + IntPtr context = IntPtr.Zero; + IntPtr port = IntPtr.Zero; + IntPtr window = IntPtr.Zero; + + window = GetControlOwner(handle); + + if (handle == IntPtr.Zero || window == IntPtr.Zero) + { + // FIXME: Can we actually get a CGContextRef for the desktop? this makes context IntPtr.Zero + port = GetQDGlobalsThePort(); + CreateCGContextForPort(port, ref context); + + Rect desktop_bounds = CGDisplayBounds(CGMainDisplayID()); + + return new CarbonContext(port, context, (int)desktop_bounds.size.width, (int)desktop_bounds.size.height); + } + + QDRect window_bounds = new QDRect(); + Rect view_bounds = new Rect(); + + port = GetWindowPort(window); + + context = GetContext(port); + + GetWindowBounds(window, 32, ref window_bounds); + + HIViewGetBounds(handle, ref view_bounds); + + HIViewConvertRect(ref view_bounds, handle, IntPtr.Zero); + + if (view_bounds.size.height < 0) + view_bounds.size.height = 0; + if (view_bounds.size.width < 0) + view_bounds.size.width = 0; + + CGContextTranslateCTM(context, view_bounds.origin.x, (window_bounds.bottom - window_bounds.top) - (view_bounds.origin.y + view_bounds.size.height)); + + // Create the original rect path and clip to it + Rect rc_clip = new Rect(0, 0, view_bounds.size.width, view_bounds.size.height); + + CGContextSaveGState(context); + + Rectangle[] clip_rectangles = (Rectangle[])hwnd_delegate.DynamicInvoke(new object[] { handle }); + if (clip_rectangles != null && clip_rectangles.Length > 0) + { + int length = clip_rectangles.Length; + + CGContextBeginPath(context); + CGContextAddRect(context, rc_clip); + + for (int i = 0; i < length; i++) + { + CGContextAddRect(context, new Rect(clip_rectangles[i].X, view_bounds.size.height - clip_rectangles[i].Y - clip_rectangles[i].Height, clip_rectangles[i].Width, clip_rectangles[i].Height)); + } + CGContextClosePath(context); + CGContextEOClip(context); +#if DEBUG_CLIPPING + if (clip_rectangles.Length >= debug_threshold) { + CGContextSetRGBFillColor (context, red, green, blue, 0.5f); + CGContextFillRect (context, rc_clip); + CGContextFlush (context); + System.Threading.Thread.Sleep (500); + if (red == 1.0f) { red = 0.0f; blue = 1.0f; } + else if (blue == 1.0f) { blue = 0.0f; green = 1.0f; } + else if (green == 1.0f) { green = 0.0f; red = 1.0f; } + } +#endif + } + else + { + CGContextBeginPath(context); + CGContextAddRect(context, rc_clip); + CGContextClosePath(context); + CGContextClip(context); + } + + return new CarbonContext(port, context, (int)view_bounds.size.width, (int)view_bounds.size.height); + } + + internal static IntPtr GetContext(IntPtr port) + { + IntPtr context = IntPtr.Zero; + + lock (lockobj) + { +#if FALSE + if (contextReference [port] != null) { + CreateCGContextForPort (port, ref context); + } else { + QDBeginCGContext (port, ref context); + contextReference [port] = context; + } +#else + CreateCGContextForPort(port, ref context); +#endif + } + + return context; + } + + internal static void ReleaseContext(IntPtr port, IntPtr context) + { + CGContextRestoreGState(context); + + lock (lockobj) + { +#if FALSE + if (contextReference [port] != null && context == (IntPtr) contextReference [port]) { + QDEndCGContext (port, ref context); + contextReference [port] = null; + } else { + CFRelease (context); + } +#else + CFRelease(context); +#endif + } + } + + #region Cocoa Methods + [DllImport("libobjc.dylib")] + public static extern IntPtr objc_getClass(string className); + [DllImport("libobjc.dylib")] + public static extern IntPtr objc_msgSend(IntPtr basePtr, IntPtr selector, string argument); + [DllImport("libobjc.dylib")] + public static extern IntPtr objc_msgSend(IntPtr basePtr, IntPtr selector); + [DllImport("libobjc.dylib")] + public static extern void objc_msgSend_stret(ref Rect arect, IntPtr basePtr, IntPtr selector); + [DllImport("libobjc.dylib", EntryPoint = "objc_msgSend")] + public static extern bool bool_objc_msgSend(IntPtr handle, IntPtr selector); + [DllImport("libobjc.dylib")] + public static extern IntPtr sel_registerName(string selectorName); + #endregion + + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern IntPtr CGMainDisplayID(); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern Rect CGDisplayBounds(IntPtr display); + + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern int HIViewGetBounds(IntPtr vHnd, ref Rect r); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern int HIViewConvertRect(ref Rect r, IntPtr a, IntPtr b); + + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern IntPtr GetControlOwner(IntPtr aView); + + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern int GetWindowBounds(IntPtr wHnd, uint reg, ref QDRect rect); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern IntPtr GetWindowPort(IntPtr hWnd); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern IntPtr GetQDGlobalsThePort(); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CreateCGContextForPort(IntPtr port, ref IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CFRelease(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void QDBeginCGContext(IntPtr port, ref IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void QDEndCGContext(IntPtr port, ref IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern int CGContextClipToRect(IntPtr context, Rect clip); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern int CGContextClipToRects(IntPtr context, Rect[] clip_rects, int count); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextTranslateCTM(IntPtr context, float tx, float ty); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextScaleCTM(IntPtr context, float x, float y); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextFlush(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextSynchronize(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern IntPtr CGPathCreateMutable(); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGPathAddRects(IntPtr path, IntPtr _void, Rect[] rects, int count); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGPathAddRect(IntPtr path, IntPtr _void, Rect rect); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextAddRects(IntPtr context, Rect[] rects, int count); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextAddRect(IntPtr context, Rect rect); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextBeginPath(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextClosePath(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextAddPath(IntPtr context, IntPtr path); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextClip(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextEOClip(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextEOFillPath(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextSaveGState(IntPtr context); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextRestoreGState(IntPtr context); + +#if DEBUG_CLIPPING + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextSetRGBFillColor (IntPtr context, float red, float green, float blue, float alpha); + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + internal static extern void CGContextFillRect (IntPtr context, Rect rect); +#endif + } + + internal struct CGSize + { + public float width; + public float height; + } + + internal struct CGPoint + { + public float x; + public float y; + } + + internal struct Rect + { + public Rect(float x, float y, float width, float height) + { + this.origin.x = x; + this.origin.y = y; + this.size.width = width; + this.size.height = height; + } + + public CGPoint origin; + public CGSize size; + } + + internal struct QDRect + { + public short top; + public short left; + public short bottom; + public short right; + } + + internal struct CarbonContext : IMacContext + { + public IntPtr port; + public IntPtr ctx; + public int width; + public int height; + + public CarbonContext(IntPtr port, IntPtr ctx, int width, int height) + { + this.port = port; + this.ctx = ctx; + this.width = width; + this.height = height; + } + + public void Synchronize() + { + MacSupport.CGContextSynchronize(ctx); + } + + public void Release() + { + MacSupport.ReleaseContext(port, ctx); + } + } + + internal struct CocoaContext : IMacContext + { + public IntPtr ctx; + public int width; + public int height; + + public CocoaContext(IntPtr ctx, int width, int height) + { + this.ctx = ctx; + this.width = width; + this.height = height; + } + + public void Synchronize() + { + MacSupport.CGContextSynchronize(ctx); + } + + public void Release() + { + MacSupport.CGContextRestoreGState(ctx); + } + } + + internal interface IMacContext + { + void Synchronize(); + void Release(); + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs b/external/corefx/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs index 3125f3797d..62ffb3abf0 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/DebugHandleTracker.cs @@ -429,7 +429,7 @@ namespace System.Internal } /// - /// Rereives the string of the parsed stack trace + /// Retrieves the string of the parsed stack trace /// public override string ToString() { diff --git a/external/corefx/src/System.Drawing.Common/src/misc/DpiHelper.cs b/external/corefx/src/System.Drawing.Common/src/misc/DpiHelper.cs index a883a2e9b2..f9170ba223 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/DpiHelper.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/DpiHelper.cs @@ -29,7 +29,7 @@ namespace System.Windows.Forms private static double s_logicalToDeviceUnitsScalingFactorX = 0.0; private static double s_logicalToDeviceUnitsScalingFactorY = 0.0; - private static bool s_enableHighDpi = false; + private static bool s_enableHighDpi = true; private static InterpolationMode s_interpolationMode = InterpolationMode.Invalid; private static void Initialize() @@ -39,17 +39,8 @@ namespace System.Windows.Forms return; } - try - { - string value = ConfigurationManager.AppSettings.Get(EnableHighDpiConfigurationValueName); - if (string.Equals(value, "true", StringComparison.InvariantCultureIgnoreCase)) - { - s_enableHighDpi = true; - } - } - catch - { - } + // NOTE: In the .NET Framework, this value can be controlled via ConfigurationManager. + // In .NET Core, the value always defaults to the value "true". if (s_enableHighDpi) { diff --git a/external/corefx/src/System.Drawing.Common/src/misc/ExternDll.Unix.cs b/external/corefx/src/System.Drawing.Common/src/misc/ExternDll.Unix.cs new file mode 100644 index 0000000000..6e35142b82 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/misc/ExternDll.Unix.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System +{ + internal static class ExternDll + { + public const string Gdiplus = "gdiplus"; + public const string User32 = "user32"; + public const string Gdi32 = "gdi32"; + public const string Kernel32 = "kernel32"; + public const string Winspool = "winspool.drv"; + public const string Comdlg32 = "comdlg32.dll"; + public const string Comctl32 = "comctl32.dll"; + public const string Shell32 = "shell32.dll"; + public const string Oleaut32 = "oleaut32.dll"; + } +} diff --git a/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs b/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs index ed003cdcbf..8dbb1cae30 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContext.cs @@ -12,7 +12,7 @@ namespace System.Drawing.Internal /// Represents a Win32 device context. Provides operations for setting some of the properties of a device context. /// It's the managed wrapper for an HDC. /// - /// This class is divided into two files separating the code that needs to be compiled into reatail builds and + /// This class is divided into two files separating the code that needs to be compiled into retail builds and /// debugging code. /// internal sealed partial class DeviceContext : MarshalByRefObject, IDeviceContext, IDisposable @@ -23,9 +23,9 @@ namespace System.Drawing.Internal /// /// The hDc is released/deleted only when owned by the object, meaning it was created internally; /// in this case, the object is responsible for releasing/deleting it. - /// In the case the object is created from an exisiting hdc, it is not released; this is consistent + /// In the case the object is created from an existing hdc, it is not released; this is consistent /// with the Win32 guideline that says if you call GetDC/CreateDC/CreatIC/CreateEnhMetafile, you are - /// responsible for calling ReleaseDC/DeleteDC/DeleteEnhMetafile respectivelly. + /// responsible for calling ReleaseDC/DeleteDC/DeleteEnhMetafile respectively. /// /// This class implements some of the operations commonly performed on the properties of a dc in WinForms, /// specially for interacting with GDI+, like clipping and coordinate transformation. @@ -34,9 +34,9 @@ namespace System.Drawing.Internal /// DrawString (GDI+). /// /// Other properties are persisted from operation to operation until they are reset, like clipping, - /// one can make several calls to Graphics or WindowsGraphics obect after setting the dc clip area and + /// one can make several calls to Graphics or WindowsGraphics object after setting the dc clip area and /// before resetting it; these kinds of properties are the ones implemented in this class. - /// This kind of properties place an extra chanllenge in the scenario where a DeviceContext is obtained + /// This kind of properties place an extra challenge in the scenario where a DeviceContext is obtained /// from a Graphics object that has been used with GDI+, because GDI+ saves the hdc internally, rendering the /// DeviceContext underlying hdc out of sync. DeviceContext needs to support these kind of properties to /// be able to keep the GDI+ and GDI HDCs in sync. @@ -49,7 +49,7 @@ namespace System.Drawing.Internal /// 5. View port origin. /// 6. Window extent /// - /// Other non-persisted properties just for information: Background/Forground color, Palette, Color adjustment, + /// Other non-persisted properties just for information: Background/Foreground color, Palette, Color adjustment, /// Color space, ICM mode and profile, Current pen position, Binary raster op (not supported by GDI+), /// Background mode, Logical Pen, DC pen color, ARc direction, Miter limit, Logical brush, DC brush color, /// Brush origin, Polygon filling mode, Bitmap stretching mode, Logical font, Intercharacter spacing, @@ -132,7 +132,7 @@ namespace System.Drawing.Internal /// - /// Constructor to contruct a DeviceContext object from an window handle. + /// Constructor to construct a DeviceContext object from an window handle. /// private DeviceContext(IntPtr hWnd) { @@ -149,7 +149,7 @@ namespace System.Drawing.Internal } /// - /// Constructor to contruct a DeviceContext object from an existing Win32 device context handle. + /// Constructor to construct a DeviceContext object from an existing Win32 device context handle. /// private DeviceContext(IntPtr hDC, DeviceContextType dcType) { diff --git a/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs b/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs index d39d5bf25e..deb3ed33f6 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/GDI/DeviceContexts.cs @@ -6,7 +6,7 @@ namespace System.Drawing.Internal { /// /// Keeps a cache of some graphics primitives. Created to improve performance of TextRenderer.MeasureText methods - /// that don't receive a WindowsGraphics. This class mantains a cache of MRU WindowsFont objects in the process. + /// that don't receive a WindowsGraphics. This class maintains a cache of MRU WindowsFont objects in the process. /// internal static class DeviceContexts { diff --git a/external/corefx/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs b/external/corefx/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs index c25dcd7ae3..35a2602c50 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/GDI/SafeNativeMethods.cs @@ -38,6 +38,6 @@ namespace System.Drawing.Internal IntPtr hRgn = System.Internal.HandleCollector.Add(IntCreateRectRgn(x1, y1, x2, y2), CommonHandles.GDI); DbgUtil.AssertWin32(hRgn != IntPtr.Zero, "IntCreateRectRgn([x1={0}, y1={1}, x2={2}, y2={3}]) failed.", x1, y1, x2, y2); return hRgn; - } + } } } diff --git a/external/corefx/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs b/external/corefx/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs index dd91040e8a..a28b3251e2 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/GDI/UnsafeNativeMethods.cs @@ -22,7 +22,7 @@ namespace System.Drawing.Internal } /// - /// NOTE: DeleteDC is to be used to delete the hdc created from CreateCompatibleDC ONLY. All other hdcs shoul + /// NOTE: DeleteDC is to be used to delete the hdc created from CreateCompatibleDC ONLY. All other hdcs should /// be deleted with DeleteHDC. /// [DllImport(ExternDll.Gdi32, SetLastError = true, ExactSpelling = true, EntryPoint = "DeleteDC", CharSet = CharSet.Auto)] diff --git a/external/corefx/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs b/external/corefx/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs index 860e9a692d..5e05b4b6dc 100644 --- a/external/corefx/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs +++ b/external/corefx/src/System.Drawing.Common/src/misc/GDI/WindowsGraphics.cs @@ -15,7 +15,7 @@ namespace System.Drawing.Internal /// and compatibility issues found in GDI+ Graphics class. /// /// Note: WindowsGraphics is a stateful component, DC properties are persisted from method calls, as opposed to - /// Graphics (GDI+) which performs attomic operations and always restores the hdc. The underlying hdc is always + /// Graphics (GDI+) which performs atomic operations and always restores the hdc. The underlying hdc is always /// saved and restored on dispose so external HDCs won't be modified by WindowsGraphics. So we don't need to /// restore previous objects into the dc in method calls. /// diff --git a/external/corefx/src/System.Drawing.Common/src/misc/InvalidEnumArgumentException.cs b/external/corefx/src/System.Drawing.Common/src/misc/InvalidEnumArgumentException.cs new file mode 100644 index 0000000000..62de174730 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/src/misc/InvalidEnumArgumentException.cs @@ -0,0 +1,63 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using System.Runtime.Serialization; + +namespace System.ComponentModel +{ + /// + /// The exception that is thrown when using invalid arguments that are enumerators. + /// + internal class InvalidEnumArgumentException : ArgumentException + { + /// + /// Initializes a new instance of the class without a message. + /// + public InvalidEnumArgumentException() : this(null) + { + } + + /// + /// Initializes a new instance of the class with + /// the specified message. + /// + public InvalidEnumArgumentException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the Exception class with a specified error message and a + /// reference to the inner exception that is the cause of this exception. + /// FxCop CA1032: Multiple constructors are required to correctly implement a custom exception. + /// + public InvalidEnumArgumentException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class with a + /// message generated from the argument, invalid value, and enumeration + /// class. + /// + public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass) + : base(SR.Format(SR.InvalidEnumArgument, + argumentName, + invalidValue.ToString(CultureInfo.CurrentCulture), + enumClass.Name), argumentName) + { + } + + /// + /// Need this constructor since Exception implements ISerializable. We don't have any fields, + /// so just forward this to base. + /// + protected InvalidEnumArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) + { + throw new PlatformNotSupportedException(); + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/tests/BitmapTests.cs b/external/corefx/src/System.Drawing.Common/tests/BitmapTests.cs index f9116f8201..a0488f4004 100644 --- a/external/corefx/src/System.Drawing.Common/tests/BitmapTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/BitmapTests.cs @@ -41,7 +41,7 @@ namespace System.Drawing.Tests yield return new object[] { "16x16_nonindexed_24bit.png", 16, 16, PixelFormat.Format24bppRgb, ImageFormat.Png }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_FilePath_TestData))] public void Ctor_FilePath(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) { @@ -54,7 +54,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_FilePath_TestData))] public void Ctor_FilePath_UseIcm(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) { @@ -70,14 +70,16 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullFilePath_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => new Bitmap((string)null)); AssertExtensions.Throws("path", () => new Bitmap((string)null, false)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("", "path")] [InlineData("\0", "path")] [InlineData("NoSuchPath", null)] @@ -88,7 +90,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(paramName, null, () => new Bitmap(filename, true)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Type_ResourceName() { using (var bitmap = new Bitmap(typeof(BitmapTests), "bitmap_173x183_indexed_8bit.bmp")) @@ -100,13 +102,14 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullType_ThrowsNullReferenceException() { Assert.Throws(() => new Bitmap(null, "name")); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(typeof(Bitmap), null)] [InlineData(typeof(Bitmap), "")] [InlineData(typeof(Bitmap), "bitmap_173x183_indexed_8bit.bmp")] @@ -117,7 +120,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Bitmap(type, resource)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_FilePath_TestData))] public void Ctor_Stream(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) { @@ -131,7 +134,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_FilePath_TestData))] public void Ctor_Stream_UseIcm(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) { @@ -148,14 +151,16 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullStream_ThrowsArgumentNullException() { AssertExtensions.Throws("stream", null, () => new Bitmap((Stream)null)); AssertExtensions.Throws("stream", null, () => new Bitmap((Stream)null, false)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_InvalidBytesInStream_ThrowsArgumentException() { using (var stream = new MemoryStream(new byte[0])) @@ -166,7 +171,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(10, 10)] [InlineData(5, 15)] public void Ctor_Width_Height(int width, int height) @@ -178,7 +183,8 @@ namespace System.Drawing.Tests Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(10, 10, PixelFormat.Format1bppIndexed)] [InlineData(10, 10, PixelFormat.Format8bppIndexed)] [InlineData(1, 1, PixelFormat.Format16bppArgb1555)] @@ -212,7 +218,8 @@ namespace System.Drawing.Tests yield return new object[] { 1, 1, 1, PixelFormat.Format1bppIndexed, IntPtr.Zero }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Width_Height_Stride_PixelFormat_Scan0_TestData))] public void Ctor_Width_Height_Stride_PixelFormat_Scan0(int width, int height, int stride, PixelFormat pixelFormat, IntPtr scan0) { @@ -225,7 +232,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(ushort.MaxValue * 513)] @@ -240,7 +248,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Bitmap(width, 1, 0, PixelFormat.Format16bppArgb1555, IntPtr.Zero)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(ushort.MaxValue * 513)] @@ -255,7 +264,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Bitmap(1, height, 0, PixelFormat.Format16bppArgb1555, IntPtr.Zero)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.Undefined - 1)] [InlineData(PixelFormat.Undefined)] [InlineData(PixelFormat.Gdi - 1)] @@ -273,7 +283,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Bitmap(1, 1, 0, format, IntPtr.Zero)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_InvalidScan0_ThrowsArgumentException() { AssertExtensions.Throws(null, () => new Bitmap(1, 1, 0, PixelFormat.Format16bppArgb1555, (IntPtr)10)); @@ -294,7 +305,8 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(Helpers.GetTestBitmapPath("16x16_nonindexed_24bit.png")), 32, 48 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Image_TestData))] public void Ctor_Width_Height_Graphics(Bitmap image, int width, int height) { @@ -308,13 +320,13 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullGraphics_ThrowsArgumentNullException() { AssertExtensions.Throws("g", "Value of 'null' is not valid for 'g'.", () => new Bitmap(1, 1, null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Image() { using (var image = new Bitmap(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) @@ -327,13 +339,14 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullImageWithoutSize_ThrowsNullReferenceException() { Assert.Throws(() => new Bitmap((Image)null)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Image_TestData))] public void Ctor_Image_Width_Height(Image image, int width, int height) { @@ -346,7 +359,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Image_TestData))] public void Ctor_Size(Image image, int width, int height) { @@ -359,14 +373,14 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullImageWithSize_ThrowsArgumentNullException() { AssertExtensions.Throws("image", () => new Bitmap(null, new Size(1, 2))); AssertExtensions.Throws("image", () => new Bitmap(null, 1, 2)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_DisposedImage_ThrowsArgumentException() { var image = new Bitmap(1, 1); @@ -385,7 +399,8 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(3, 3, PixelFormat.Format64bppPArgb), new Rectangle(1, 1, 1, 1), PixelFormat.Format16bppRgb565 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Clone_TestData))] public void Clone_Rectangle_ReturnsExpected(Bitmap bitmap, Rectangle rectangle, PixelFormat targetFormat) { @@ -423,7 +438,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Clone_TestData))] public void Clone_RectangleF_ReturnsExpected(Bitmap bitmap, Rectangle rectangle, PixelFormat format) { @@ -444,7 +460,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 1)] [InlineData(1, 0)] public void Clone_ZeroWidthOrHeightRect_ThrowsArgumentException(int width, int height) @@ -456,7 +473,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 0, 4, 1)] [InlineData(0, 0, 1, 4)] [InlineData(0, 0, 1, 4)] @@ -473,7 +491,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.Max)] [InlineData(PixelFormat.Indexed)] [InlineData(PixelFormat.Gdi)] @@ -491,7 +510,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_GrayscaleFormat_ThrowsOutOfMemoryException() { using (var bitmap = new Bitmap(1, 1, PixelFormat.Format16bppGrayScale)) @@ -501,7 +521,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_ValidBitmap_Success() { using (var bitmap = new Bitmap(1, 1)) @@ -513,7 +533,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -524,7 +544,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.Clone(new RectangleF(0, 0, 1, 1), PixelFormat.Format32bppArgb)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetFrameCount_NewBitmap_ReturnsZero() { using (var bitmap = new Bitmap(1, 1)) @@ -536,7 +556,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetFrameCount_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -545,7 +565,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.GetFrameCount(FrameDimension.Page)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(1)] @@ -560,7 +581,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SelectActiveFrame_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -578,7 +599,7 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), 99, 99, Color.FromArgb(0, 0, 0) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(GetPixel_TestData))] public void GetPixel_ValidPixelFormat_Success(Bitmap bitmap, int x, int y, Color color) { @@ -592,7 +613,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1)] public void GetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x) @@ -603,7 +625,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1)] public void GetPixel_InvalidY_ThrowsArgumentOutOfRangeException(int y) @@ -614,7 +637,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetPixel_GrayScalePixelFormat_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1, PixelFormat.Format16bppGrayScale)) @@ -623,7 +647,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetPixel_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -639,7 +663,8 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(512, 512, PixelFormat.Format16bppRgb555), 512, 512 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(GetHbitmap_TestData))] public void GetHbitmap_FromHbitmap_ReturnsExpected(Bitmap bitmap, int width, int height) { @@ -680,7 +705,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1, 1)] [InlineData(short.MaxValue, 1)] [InlineData(1, short.MaxValue)] @@ -692,7 +718,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHbitmap_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -701,7 +727,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.GetHbitmap()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHbitmap_InvalidHandle_ThrowsExternalException() { Assert.Throws(() => Image.FromHbitmap(IntPtr.Zero)); @@ -716,7 +743,7 @@ namespace System.Drawing.Tests yield return new object[] { new Icon(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")), 96, 96 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(FromHicon_Icon_TestData))] public void FromHicon_IconHandle_ReturnsExpected(Icon icon, int width, int height) { @@ -744,7 +771,8 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(512, 512, PixelFormat.Format16bppRgb555).GetHicon(), 512, 512 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(FromHicon_TestData))] public Bitmap GetHicon_FromHicon_ReturnsExpected(IntPtr handle, int width, int height) { @@ -761,7 +789,8 @@ namespace System.Drawing.Tests return result; } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHicon_Grayscale_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1, PixelFormat.Format16bppGrayScale)) @@ -770,7 +799,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHicon_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -779,14 +808,16 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.GetHicon()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHicon_InvalidHandle_ThrowsArgumentException() { AssertExtensions.Throws(null, () => Bitmap.FromHicon(IntPtr.Zero)); AssertExtensions.Throws(null, () => Bitmap.FromHicon((IntPtr)10)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHicon_1bppIcon_ThrowsArgumentException() { using (var icon = new Icon(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"))) @@ -795,21 +826,24 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromResource_InvalidHandle_ThrowsArgumentException() { AssertExtensions.Throws(null, () => Bitmap.FromResource(IntPtr.Zero, "Name")); AssertExtensions.Throws(null, () => Bitmap.FromResource((IntPtr)10, "Name")); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromResource_InvalidBitmapName_ThrowsArgumentException() { AssertExtensions.Throws(null, () => Bitmap.FromResource(IntPtr.Zero, "Name")); AssertExtensions.Throws(null, () => Bitmap.FromResource((IntPtr)10, "Name")); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MakeTransparent_NoColorWithMatches_SetsMatchingPixelsToTransparent() { using (var bitmap = new Bitmap(10, 10)) @@ -847,7 +881,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MakeTransparent_CustomColorExists_SetsMatchingPixelsToTransparent() { using (var bitmap = new Bitmap(10, 10)) @@ -885,7 +920,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MakeTransparent_CustomColorDoesntExist_DoesNothing() { using (var bitmap = new Bitmap(10, 10)) @@ -909,7 +944,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MakeTransparent_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -919,7 +954,9 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.MakeTransparent(Color.Red)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ActiveIssue(21886, TargetFrameworkMonikers.NetFramework)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MakeTransparent_GrayscalePixelFormat_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1, PixelFormat.Format16bppGrayScale)) @@ -929,7 +966,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MakeTransparent_Icon_ThrowsInvalidOperationException() { using (var bitmap = new Bitmap(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) @@ -944,7 +982,7 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), 99, 99, Color.FromArgb(255, 128, 128, 128) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(SetPixel_TestData))] public void SetPixel_ValidPixelFormat_Success(Bitmap bitmap, int x, int y, Color color) { @@ -952,7 +990,7 @@ namespace System.Drawing.Tests Assert.Equal(color, bitmap.GetPixel(x, y)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.Format1bppIndexed)] [InlineData(PixelFormat.Format4bppIndexed)] [InlineData(PixelFormat.Format8bppIndexed)] @@ -964,7 +1002,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1)] public void SetPixel_InvalidX_ThrowsArgumentOutOfRangeException(int x) @@ -975,7 +1014,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1)] public void SetPixel_InvalidY_ThrowsArgumentOutOfRangeException(int y) @@ -986,7 +1026,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetPixel_GrayScalePixelFormat_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1, PixelFormat.Format16bppGrayScale)) @@ -995,7 +1036,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetPixel_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -1004,7 +1045,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.SetPixel(0, 0, Color.Red)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1, 1)] [InlineData(float.PositiveInfinity, float.PositiveInfinity)] [InlineData(float.MaxValue, float.MaxValue)] @@ -1016,7 +1057,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(float.NaN)] @@ -1029,7 +1070,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(float.NaN)] @@ -1042,7 +1084,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetResolution_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -1051,6 +1093,25 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.SetResolution(1, 1)); } + public static IEnumerable LockBits_NotUnix_TestData() + { + Bitmap bitmap() => new Bitmap(2, 2, PixelFormat.Format32bppArgb); + yield return new object[] { bitmap(), new Rectangle(1, 1, 1,1), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb, 8, 1 }; + yield return new object[] { bitmap(), new Rectangle(1, 1, 1, 1), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb, 8, 3 }; + yield return new object[] { bitmap(), new Rectangle(1, 1, 1, 1), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb, 8, 2 }; + + yield return new object[] { bitmap(), new Rectangle(1, 1, 1, 1), ImageLockMode.ReadOnly - 1, PixelFormat.Format32bppArgb, 8, 0 }; + + yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.WriteOnly, PixelFormat.Format16bppGrayScale, 4, 65538 }; + + yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed, 100, 65537 }; + yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed, 100, 65539 }; + yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed, 100, 65538 }; + + yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb, 300, 65539 }; + yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb, 300, 65538 }; + } + public static IEnumerable LockBits_TestData() { Bitmap bitmap() => new Bitmap(2, 2, PixelFormat.Format32bppArgb); @@ -1058,14 +1119,6 @@ namespace System.Drawing.Tests yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb, 8, 3 }; yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb, 8, 2 }; - yield return new object[] { bitmap(), new Rectangle(1, 1, 1,1), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb, 8, 1 }; - yield return new object[] { bitmap(), new Rectangle(1, 1, 1, 1), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb, 8, 3 }; - yield return new object[] { bitmap(), new Rectangle(1, 1, 1, 1), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb, 8, 2 }; - - yield return new object[] { bitmap(), new Rectangle(1, 1, 1, 1), ImageLockMode.ReadOnly - 1, PixelFormat.Format32bppArgb, 8, 0 }; - - yield return new object[] { bitmap(), new Rectangle(0, 0, 2, 2), ImageLockMode.WriteOnly, PixelFormat.Format16bppGrayScale, 4, 65538 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb, 400, 1 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb, 400, 3 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb, 400, 2 }; @@ -1074,10 +1127,6 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb, 300, 65539 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb, 300, 65538 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed, 100, 65537 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed, 100, 65539 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format32bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed, 100, 65538 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format24bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb, 300, 1 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format24bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb, 300, 3 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format24bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb, 300, 2 }; @@ -1087,8 +1136,6 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(100, 100, PixelFormat.Format24bppRgb), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb, 400, 65538 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb, 300, 65537 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb, 300, 65539 }; - yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb, 300, 65538 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed, 100, 1 }; yield return new object[] { new Bitmap(100, 100, PixelFormat.Format8bppIndexed), new Rectangle(0, 0, 100, 100), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed, 100, 3 }; @@ -1100,9 +1147,22 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(184, 184, PixelFormat.Format1bppIndexed), new Rectangle(0, 0, 184, 184), ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed, 24, 2 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(LockBits_TestData))] public void LockBits_Invoke_Success(Bitmap bitmap, Rectangle rectangle, ImageLockMode lockMode, PixelFormat pixelFormat, int expectedStride, int expectedReserved) + { + Do_LockBits_Invoke_Success(bitmap, rectangle, lockMode, pixelFormat, expectedStride, expectedReserved); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(LockBits_NotUnix_TestData))] + public void LockBits_Invoke_Success_NotUnix(Bitmap bitmap, Rectangle rectangle, ImageLockMode lockMode, PixelFormat pixelFormat, int expectedStride, int expectedReserved) + { + Do_LockBits_Invoke_Success(bitmap, rectangle, lockMode, pixelFormat, expectedStride, expectedReserved); + } + + private void Do_LockBits_Invoke_Success(Bitmap bitmap, Rectangle rectangle, ImageLockMode lockMode, PixelFormat pixelFormat, int expectedStride, int expectedReserved) { try { @@ -1111,7 +1171,13 @@ namespace System.Drawing.Tests Assert.Equal(rectangle.Width, data.Width); Assert.Equal(rectangle.Height, data.Height); Assert.Equal(expectedStride, data.Stride); - Assert.Equal(expectedReserved, data.Reserved); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // "Reserved" is documented as "Reserved. Do not use.", so it's not clear whether we actually need to test this in any unit tests. + // Additionally, the values are not consistent accross Windows (GDI+) and Unix (libgdiplus) + Assert.Equal(expectedReserved, data.Reserved); + } // Locking with 16bppGrayscale succeeds, but the data can't be unlocked. if (pixelFormat == PixelFormat.Format16bppGrayScale) @@ -1129,7 +1195,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LockBits_NullBitmapData_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1)) @@ -1138,7 +1204,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, 0, 1, 1)] [InlineData(2, 0, 1, 1)] [InlineData(0, -1, 1, 1)] @@ -1162,7 +1229,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.DontCare)] [InlineData(PixelFormat.Max)] [InlineData(PixelFormat.Indexed)] @@ -1186,7 +1254,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LockBits_ReadOnlyGrayscale_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1)) @@ -1202,7 +1271,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData((ImageLockMode)(-1))] [InlineData(ImageLockMode.UserInputBuffer + 1)] [InlineData(ImageLockMode.UserInputBuffer)] @@ -1218,7 +1288,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LockBits_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -1230,7 +1300,7 @@ namespace System.Drawing.Tests Assert.Equal(IntPtr.Zero, bitmapData.Scan0); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LockBits_AlreadyLocked_ThrowsInvalidOperationException() { using (var bitmap = new Bitmap(1, 1)) @@ -1245,7 +1315,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, -1)] [InlineData(0, 2)] [InlineData(1, 2)] @@ -1261,7 +1332,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void UnlockBits_Scan0Zero_Nop() { using (var bitmap = new Bitmap(1, 1)) @@ -1273,7 +1344,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.Indexed)] [InlineData(PixelFormat.Gdi)] public void UnlockBits_InvalidPixelFormat_Nop(PixelFormat format) @@ -1287,7 +1359,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void UnlockBits_NullBitmapData_ThrowsArgumentException() { using (var bitmap = new Bitmap(1, 1)) @@ -1296,7 +1368,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void UnlockBits_NotLocked_ThrowsExternalException() { using (var bitmap = new Bitmap(1, 1)) @@ -1305,7 +1378,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void UnlockBits_AlreadyUnlocked_ThrowsExternalException() { using (var bitmap = new Bitmap(1, 1)) @@ -1317,7 +1391,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void UnlockBits_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -1326,7 +1400,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.UnlockBits(new BitmapData())); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Size_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -1337,7 +1411,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.Size); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.Format16bppArgb1555)] [InlineData(PixelFormat.Format16bppRgb555)] [InlineData(PixelFormat.Format16bppRgb565)] @@ -1495,7 +1570,7 @@ namespace System.Drawing.Tests yield return new object[] { PixelFormat.Format8bppIndexed, new int[] { -16777216, -8388608, -16744448, -8355840, -16777088, -8388480, -16744320, -8355712, -4144960, -65536, -16711936, -256, -16776961, -65281, -16711681, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16777216, -16777165, -16777114, -16777063, -16777012, -16776961, -16764160, -16764109, -16764058, -16764007, -16763956, -16763905, -16751104, -16751053, -16751002, -16750951, -16750900, -16750849, -16738048, -16737997, -16737946, -16737895, -16737844, -16737793, -16724992, -16724941, -16724890, -16724839, -16724788, -16724737, -16711936, -16711885, -16711834, -16711783, -16711732, -16711681, -13434880, -13434829, -13434778, -13434727, -13434676, -13434625, -13421824, -13421773, -13421722, -13421671, -13421620, -13421569, -13408768, -13408717, -13408666, -13408615, -13408564, -13408513, -13395712, -13395661, -13395610, -13395559, -13395508, -13395457, -13382656, -13382605, -13382554, -13382503, -13382452, -13382401, -13369600, -13369549, -13369498, -13369447, -13369396, -13369345, -10092544, -10092493, -10092442, -10092391, -10092340, -10092289, -10079488, -10079437, -10079386, -10079335, -10079284, -10079233, -10066432, -10066381, -10066330, -10066279, -10066228, -10066177, -10053376, -10053325, -10053274, -10053223, -10053172, -10053121, -10040320, -10040269, -10040218, -10040167, -10040116, -10040065, -10027264, -10027213, -10027162, -10027111, -10027060, -10027009, -6750208, -6750157, -6750106, -6750055, -6750004, -6749953, -6737152, -6737101, -6737050, -6736999, -6736948, -6736897, -6724096, -6724045, -6723994, -6723943, -6723892, -6723841, -6711040, -6710989, -6710938, -6710887, -6710836, -6710785, -6697984, -6697933, -6697882, -6697831, -6697780, -6697729, -6684928, -6684877, -6684826, -6684775, -6684724, -6684673, -3407872, -3407821, -3407770, -3407719, -3407668, -3407617, -3394816, -3394765, -3394714, -3394663, -3394612, -3394561, -3381760, -3381709, -3381658, -3381607, -3381556, -3381505, -3368704, -3368653, -3368602, -3368551, -3368500, -3368449, -3355648, -3355597, -3355546, -3355495, -3355444, -3355393, -3342592, -3342541, -3342490, -3342439, -3342388, -3342337, -65536, -65485, -65434, -65383, -65332, -65281, -52480, -52429, -52378, -52327, -52276, -52225, -39424, -39373, -39322, -39271, -39220, -39169, -26368, -26317, -26266, -26215, -26164, -26113, -13312, -13261, -13210, -13159, -13108, -13057, -256, -205, -154, -103, -52, -1 } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Palette_TestData))] public void Palette_Get_ReturnsExpected(PixelFormat pixelFormat, int[] expectedEntries) { @@ -1505,7 +1580,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Palette_SetNull_ThrowsNullReferenceException() { using (var bitmap = new Bitmap(1, 1)) @@ -1514,7 +1590,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Palette_Disposed_ThrowsArgumentException() { var bitmap = new Bitmap(1, 1); @@ -1526,7 +1602,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => bitmap.Size); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LockBits_Marshalling_Success() { Color red = Color.FromArgb(Color.Red.ToArgb()); diff --git a/external/corefx/src/System.Drawing.Common/tests/BrushTests.cs b/external/corefx/src/System.Drawing.Common/tests/BrushTests.cs index 5f4ce8efcb..ce94015096 100644 --- a/external/corefx/src/System.Drawing.Common/tests/BrushTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/BrushTests.cs @@ -20,7 +20,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] public void Dispose_NoSuchEntryPoint_SilentyCatchesException() { var brush = new SubBrush(); diff --git a/external/corefx/src/System.Drawing.Common/tests/BrushesTests.cs b/external/corefx/src/System.Drawing.Common/tests/BrushesTests.cs index f549d62ef2..642f152659 100644 --- a/external/corefx/src/System.Drawing.Common/tests/BrushesTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/BrushesTests.cs @@ -157,7 +157,7 @@ namespace System.Drawing.Tests public static object[] Brush(Func getBrush, Color expectedColor) => new object[] { getBrush, expectedColor }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Brushes_TestData))] public void Brushes_Get_ReturnsExpected(Func getBrush, Color expectedColor) { diff --git a/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsContextTests.cs b/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsContextTests.cs index 0f3b04fb60..b869fffcf9 100644 --- a/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsContextTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsContextTests.cs @@ -8,6 +8,7 @@ namespace System.Drawing.Tests { public class BufferedGraphicsContextTests { + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void Ctor_Default() { @@ -17,7 +18,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_ValidTargetGraphics_Success() { using (var context = new BufferedGraphicsContext()) @@ -31,7 +33,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_LargeRectWithTargetGraphics_Success() { using (var context = new BufferedGraphicsContext()) @@ -45,7 +48,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_ValidTargetHdc_Success() { using (var context = new BufferedGraphicsContext()) @@ -69,7 +73,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_LargeRectWithTargetHdc_Success() { using (var context = new BufferedGraphicsContext()) @@ -93,6 +98,7 @@ namespace System.Drawing.Tests } } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void Allocate_InvalidHdc_ThrowsArgumentException() { @@ -102,7 +108,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_NullGraphicsZeroSize_Success() { using (var context = new BufferedGraphicsContext()) @@ -112,7 +119,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_NullGraphicsNonZeroSize_ThrowsArgumentNullException() { using (var context = new BufferedGraphicsContext()) @@ -122,7 +130,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_DisposedGraphics_ThrowsArgumentException() { using (var context = new BufferedGraphicsContext()) @@ -137,7 +146,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Allocate_BusyGraphics_ThrowsInvalidOperationException() { using (var context = new BufferedGraphicsContext()) @@ -182,6 +192,7 @@ namespace System.Drawing.Tests } } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Theory] [InlineData(0)] [InlineData(-1)] @@ -193,6 +204,7 @@ namespace System.Drawing.Tests } } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Theory] [InlineData(0)] [InlineData(-1)] @@ -212,7 +224,8 @@ namespace System.Drawing.Tests var context = new BufferedGraphicsContext(); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_BusyAndValidated_ThrowsInvalidOperationException() { using (var context = new BufferedGraphicsContext()) @@ -226,7 +239,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_BusyAndInvalidated_ThrowsInvalidOperationException() { using (var context = new BufferedGraphicsContext()) diff --git a/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsTests.cs b/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsTests.cs index dc1f68c54d..e71905bea8 100644 --- a/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/BufferedGraphicsTests.cs @@ -8,7 +8,8 @@ namespace System.Drawing.Tests { public class BufferedGraphicsTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_TempMultipleTimes_Success() { using (var context = new BufferedGraphicsContext()) @@ -25,7 +26,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_ActualMultipleTimes_Success() { using (var context = new BufferedGraphicsContext()) @@ -42,7 +44,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Render_ParameterlessWithTargetGraphics_Success() { Color color = Color.FromArgb(255, 0, 0, 0); @@ -68,7 +71,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Render_ParameterlessWithNullTargetGraphics_Success() { Color color = Color.FromArgb(255, 0, 0, 0); @@ -95,7 +99,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Render_TargetGraphics_Success() { Color color = Color.FromArgb(255, 0, 0, 0); @@ -123,7 +128,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Render_NullGraphics_Nop() { using (var context = new BufferedGraphicsContext()) @@ -133,7 +139,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Render_InvalidTargetDC_Nop() { using (var context = new BufferedGraphicsContext()) diff --git a/external/corefx/src/System.Drawing.Common/tests/CharacterRangeTests.cs b/external/corefx/src/System.Drawing.Common/tests/CharacterRangeTests.cs index 168e58270f..6ded38860a 100644 --- a/external/corefx/src/System.Drawing.Common/tests/CharacterRangeTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/CharacterRangeTests.cs @@ -64,6 +64,7 @@ namespace System.Drawing.Tests } } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void Equals_NullOther_ThrowsNullReferenceException() { diff --git a/external/corefx/src/System.Drawing.Common/tests/Configurations.props b/external/corefx/src/System.Drawing.Common/tests/Configurations.props index 6d8d8b8ee4..3efbed0bcd 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Configurations.props +++ b/external/corefx/src/System.Drawing.Common/tests/Configurations.props @@ -2,7 +2,7 @@ - netcoreapp-Windows_NT; + netcoreapp; netfx; diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/AdjustableArrowCapTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/AdjustableArrowCapTests.cs index a8066ade1f..b31228faa7 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/AdjustableArrowCapTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/AdjustableArrowCapTests.cs @@ -24,7 +24,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { 1f, -1f }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Float_Float_TestData))] public void Ctor_Float_Float(float width, float height) { @@ -45,7 +45,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Float_Float_Bool_TestData))] public void Ctor_Float_Float_Bool(float width, float height, bool filled) { @@ -69,7 +69,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { float.NaN }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Properties_TestData))] public void Width_Set_GetReturnsExpected(float width) { @@ -80,7 +80,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Properties_TestData))] public void Height_Set_GetReturnsExpected(float height) { @@ -91,7 +91,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Properties_TestData))] public void MiddleInset_Set_GetReturnsExpected(float middleInset) { @@ -102,7 +102,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(true)] [InlineData(false)] public void Filled_Set_GetReturnsExpected(bool filled) @@ -114,7 +114,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Success() { using (AdjustableArrowCap arrowCap = new AdjustableArrowCap(1, 1)) @@ -128,7 +128,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void BaseCap_ReturnsTriangle() { using (AdjustableArrowCap arrowCap = new AdjustableArrowCap(1, 1)) diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs index 709a0dd897..12682f2ec9 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs @@ -41,7 +41,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { fillPath, null, LineCap.Flat, 0f, LineCap.Flat }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Path_Path_LineCap_Float_TestData))] public void Ctor_Path_Path_LineCap_Float(GraphicsPath fillPath, GraphicsPath strokePath, LineCap baseCap, float baseInset, LineCap expectedCap) { @@ -56,7 +57,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] // These values are outside the valid range of the LineCap enum. [InlineData(LineCap.Flat - 1)] [InlineData(LineCap.Custom + 1)] @@ -70,7 +72,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_FillPath_Incomplete_ThrowsArgumentException() { using (GraphicsPath fillPath = new GraphicsPath()) @@ -80,7 +83,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_FillPath_DoesNotCrossYAxis_ThrowsNotImplementedException() { // Closed fillPath, but does not cross the Y-axis. @@ -93,7 +97,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineCap.Square, LineCap.Square)] [InlineData(LineCap.Round, LineCap.Round)] [InlineData(LineCap.Triangle, LineCap.Triangle)] @@ -110,7 +114,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineCap.SquareAnchor, LineCap.SquareAnchor)] [InlineData(LineCap.Custom, LineCap.Custom)] [InlineData(LineCap.Square, LineCap.Custom)] @@ -131,7 +136,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineJoin.Miter)] // Default value [InlineData(LineJoin.Bevel)] [InlineData(LineJoin.Round)] @@ -149,7 +154,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineCap.Flat)] // Default value [InlineData(LineCap.Square)] [InlineData(LineCap.Round)] @@ -181,7 +186,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0f)] [InlineData(1f)] [InlineData(10f)] @@ -204,7 +209,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0f)] [InlineData(1f)] [InlineData(10f)] @@ -227,7 +232,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Disposed_MembersThrow() { using (GraphicsPath strokePath = new GraphicsPath()) diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathIteratorTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathIteratorTests.cs index cc6196f7a0..79b8d70b11 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathIteratorTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathIteratorTests.cs @@ -33,7 +33,7 @@ namespace System.Drawing.Drawing2D.Tests { private readonly PointF[] _twoPoints = new PointF[2] { new PointF(1, 2), new PointF(20, 30) }; - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Path_Success() { byte[] types = new byte[] { 0, 1 }; @@ -45,7 +45,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_EmptyPath_Success() { using (GraphicsPath gp = new GraphicsPath()) @@ -55,7 +55,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullPath_Success() { using (GraphicsPathIterator gpi = new GraphicsPathIterator(null)) @@ -64,7 +64,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextSubpath_PathFigureNotClosed_ReturnsExpeced() { using (GraphicsPath gp = new GraphicsPath()) @@ -76,7 +77,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextSubpath_PathFigureClosed_ReturnsExpeced() { using (GraphicsPath gp = new GraphicsPath(_twoPoints, new byte[] { 0, 129 })) @@ -87,7 +88,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextSubpath_NullPath_ReturnsExpected() { using (GraphicsPathIterator gpi = new GraphicsPathIterator(null)) @@ -97,7 +99,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextSubpath_FigureNotClosed_ReturnsExpeced() { using (GraphicsPath gp = new GraphicsPath()) @@ -111,7 +114,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextSubpath_FigureClosed_ReturnsExpeced() { using (GraphicsPath gp = new GraphicsPath(_twoPoints, new byte[] { 0, 129 })) @@ -124,7 +127,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextMarker_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath(_twoPoints, new byte[] { 0, 1 })) @@ -136,7 +139,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextMarker_Empty_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath()) @@ -149,7 +152,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextMarker_NullPath_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath()) @@ -160,7 +163,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextMarker_EmptyPath_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath()) @@ -171,7 +174,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NextMarker_Path_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath(_twoPoints, new byte[] { 0, 1 })) @@ -181,7 +184,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Count_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath(_twoPoints, new byte[] { 0, 1 })) @@ -196,7 +199,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SubpathCount_ReturnsExpected() { using (GraphicsPath gp = new GraphicsPath()) @@ -219,7 +222,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void HasCurve_ReturnsExpected() { Point[] points = new Point[] { new Point(1, 1), new Point(2, 2), new Point(3, 3), new Point(4, 4) }; @@ -237,8 +240,9 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - public void Rewind_Succes() + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Rewind_Success() { using (GraphicsPath gp = new GraphicsPath()) using (GraphicsPath inner = new GraphicsPath()) @@ -263,7 +267,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Enumerate_ZeroPoints_ReturnsExpected() { PointF[] points = new PointF[0]; @@ -278,7 +282,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Enumerate_ReturnsExpected() { PointF[] points = new PointF[] { new PointF(1f, 1f), new PointF(2f, 2f), new PointF(3f, 3f), new PointF(4f, 4f) }; @@ -302,7 +306,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new PointF[2], new byte[1] }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(PointsTypesLenghtMismatch_TestData))] public void Enumerate_PointsTypesMismatch_ThrowsArgumentException(PointF[] points, byte[] types) { @@ -320,7 +324,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { null, null }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(NullPointsTypes_TestData))] public void Enumerate_NullPointsTypes_ThrowsNullReferenceException(PointF[] points, byte[] types) { @@ -331,7 +335,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(PointsTypesLenghtMismatch_TestData))] public void CopyData_PointsTypesMismatch_ThrowsArgumentException(PointF[] points, byte[] types) { @@ -342,7 +346,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(NullPointsTypes_TestData))] public void CopyData_NullPointsTypes_ThrowsNullReferenceException(PointF[] points, byte[] types) { @@ -353,7 +357,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, 2)] [InlineData(0, 3)] public void CopyData_StartEndIndexesOutOfRange_ThrowsArgumentException(int startIndex, int endIndex) @@ -374,9 +378,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new PointF[3], new byte[3], 0, int.MaxValue }; yield return new object[] { new PointF[3], new byte[3], 2, 0 }; } - - [ActiveIssue(22026)] - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(CopyData_StartEndIndexesOutOfRange_TestData))] public void CopyData_StartEndIndexesOutOfRange_ReturnsExpeced(PointF[] points, byte[] types, int startIndex, int endIndex) { @@ -390,7 +393,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CopyData_EqualStartEndIndexes_ReturnsExpeced() { PointF[] points = new PointF[] { new PointF(1f, 1f), new PointF(2f, 2f), new PointF(3f, 3f), new PointF(4f, 4f) }; @@ -408,7 +411,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CopyData_ReturnsExpected() { PointF[] points = new PointF[] { new PointF(1f, 1f), new PointF(2f, 2f), new PointF(3f, 3f), new PointF(4f, 4f) }; diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathTests.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathTests.cs.REMOVED.git-id index 22dc948ff4..262c170a0f 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathTests.cs.REMOVED.git-id @@ -1 +1 @@ -5f617dc17286ed2c0168718ddf33bb48a0da290e \ No newline at end of file +98dd7c2485fcc0a7e60e433b9a056a1f7eb3d25d \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs index c342bb0a05..4aff17f43c 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/HatchBrushTests.cs @@ -14,7 +14,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { HatchStyle.SolidDiamond, Color.PapayaWhip }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_HatchStyle_ForeColor_TestData))] public void Ctor_HatchStyle_ForeColor(HatchStyle hatchStyle, Color foreColor) { @@ -33,7 +33,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { HatchStyle.SolidDiamond, Color.PapayaWhip, Color.Plum }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_HatchStyle_ForeColor_BackColor_TestData))] public void Ctor_HatchStyle_ForeColor_BackColor(HatchStyle hatchStyle, Color foreColor, Color backColor) { @@ -47,16 +47,16 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(backColor.ToArgb(), brush.BackgroundColor.ToArgb()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [Theory] [InlineData(HatchStyle.Horizontal -1 )] [InlineData(HatchStyle.SolidDiamond + 1)] public void Ctor_InvalidHatchStyle_ThrowsArgumentException(HatchStyle hatchStyle) { - AssertExtensions.Throws(null, () => new HatchBrush(hatchStyle, Color.Empty)); - AssertExtensions.Throws(null, () => new HatchBrush(hatchStyle, Color.Empty, Color.Empty)); + AssertExtensions.Throws("hatchstyle", null, () => new HatchBrush(hatchStyle, Color.Empty)); + AssertExtensions.Throws("hatchstyle", null, () => new HatchBrush(hatchStyle, Color.Empty, Color.Empty)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Brush_ReturnsClone() { var brush = new HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.Magenta, Color.Peru); @@ -68,7 +68,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(brush.BackgroundColor, clone.BackgroundColor); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_ImmutableColor_ReturnsMutableClone() { SolidBrush brush = Assert.IsType(Brushes.Bisque); @@ -79,7 +79,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(Color.Bisque, brush.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { var brush = new HatchBrush(HatchStyle.DarkHorizontal, Color.PeachPuff, Color.Purple); @@ -88,7 +88,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Clone()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void HatchStyle_EmptyAndGetDisposed_ThrowsArgumentException() { var brush = new HatchBrush(HatchStyle.DarkHorizontal, Color.PeachPuff, Color.Purple); @@ -97,7 +97,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.HatchStyle); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ForegroundColor_EmptyAndGetDisposed_ThrowsArgumentException() { var brush = new HatchBrush(HatchStyle.DarkHorizontal, Color.PeachPuff, Color.Purple); @@ -106,7 +106,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.ForegroundColor); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void BackgroundColor_EmptyAndGetDisposed_ThrowsArgumentException() { var brush = new HatchBrush(HatchStyle.DarkHorizontal, Color.PeachPuff, Color.Purple); @@ -115,7 +115,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.BackgroundColor); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Success() { var brush = new HatchBrush(HatchStyle.DarkHorizontal, Color.PeachPuff, Color.Purple); diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/LinearGradientBrushTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/LinearGradientBrushTests.cs index a4626b37dd..37f67b3933 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/LinearGradientBrushTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/LinearGradientBrushTests.cs @@ -24,7 +24,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Point(4, 6), new Point(1, 2), Color.Black, Color.Wheat, new RectangleF(1, 2, 3, 4) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Point_TestData))] public void Ctor_PointF_PointF_Color_Color(Point point1, Point point2, Color color1, Color color2, RectangleF expectedRectangle) { @@ -42,7 +42,8 @@ namespace System.Drawing.Drawing2D.Tests Assert.False(brush.Transform.IsIdentity); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_PointF_PointF_Color_Color_FloatRanges() { var brush = new LinearGradientBrush(new PointF(float.NaN, float.NaN), new PointF(float.PositiveInfinity, float.NegativeInfinity), Color.Plum, Color.Red); @@ -52,7 +53,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(float.NaN, brush.Rectangle.Height); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Point_TestData))] public void Ctor_Point_Point_Color_Color(Point point1, Point point2, Color color1, Color color2, RectangleF expectedRectangle) { @@ -70,7 +71,8 @@ namespace System.Drawing.Drawing2D.Tests Assert.False(brush.Transform.IsIdentity); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 0)] [InlineData(1, 1)] public void Ctor_EqualPoints_ThrowsOutOfMemoryException(int x, int y) @@ -87,7 +89,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Rectangle(1, 2, 3, 4), Color.Red, Color.Plum, LinearGradientMode.Vertical }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_LinearGradientMode_TestData))] public void Ctor_Rectangle_Color_Color_LinearGradientMode(Rectangle rectangle, Color color1, Color color2, LinearGradientMode linearGradientMode) { @@ -105,7 +107,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(linearGradientMode == LinearGradientMode.Horizontal, brush.Transform.IsIdentity); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_LinearGradientMode_TestData))] public void Ctor_RectangleF_Color_Color_LinearGradientMode(Rectangle rectangle, Color color1, Color color2, LinearGradientMode linearGradientMode) { @@ -132,7 +134,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Rectangle(1, 2, 3, 4), Color.Red, Color.Plum, 90 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_Angle_TestData))] public void Ctor_Rectangle_Color_Color_Angle(Rectangle rectangle, Color color1, Color color2, float angle) { @@ -150,7 +152,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal((angle % 360) == 0, brush.Transform.IsIdentity); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_Angle_TestData))] public void Ctor_RectangleF_Color_Color_Angle(Rectangle rectangle, Color color1, Color color2, float angle) { @@ -176,7 +178,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { testData[0], testData[1], testData[2], testData[3], false }; } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_Angle_IsAngleScalable_TestData))] public void Ctor_Rectangle_Color_Color_Angle_IsAngleScalable(Rectangle rectangle, Color color1, Color color2, float angle, bool isAngleScalable) { @@ -194,7 +196,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal((angle % 360) == 0, brush.Transform.IsIdentity); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_Angle_IsAngleScalable_TestData))] public void Ctor_RectangleF_Color_Color_Angle_IsAngleScalable(Rectangle rectangle, Color color1, Color color2, float angle, bool isAngleScalable) { @@ -212,7 +214,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal((angle % 360) == 0, brush.Transform.IsIdentity); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_ZeroWidth_ThrowsArgumentException() { AssertExtensions.Throws(null, () => new LinearGradientBrush(new Rectangle(1, 2, 0, 4), Color.Empty, Color.Empty, 0f)); @@ -223,7 +225,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => new LinearGradientBrush(new RectangleF(1, 2, 0, 4), Color.Empty, Color.Empty, 0, true)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_ZeroHeight_ThrowsArgumentException() { AssertExtensions.Throws(null, () => new LinearGradientBrush(new Rectangle(1, 2, 3, 0), Color.Empty, Color.Empty, 0f)); @@ -234,45 +236,16 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => new LinearGradientBrush(new RectangleF(1, 2, 3, 0), Color.Empty, Color.Empty, 0, true)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LinearGradientMode.Horizontal - 1)] [InlineData(LinearGradientMode.BackwardDiagonal + 1)] public void Ctor_InvalidLinearGradientMode_ThrowsEnumArgumentException(LinearGradientMode linearGradientMode) { - AssertExtensions.Throws("linearGradientMode", () => new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Empty, Color.Empty, linearGradientMode)); - AssertExtensions.Throws("linearGradientMode", () => new LinearGradientBrush(new RectangleF(1, 2, 3, 4), Color.Empty, Color.Empty, linearGradientMode)); + Assert.ThrowsAny(() => new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Empty, Color.Empty, linearGradientMode)); + Assert.ThrowsAny(() => new LinearGradientBrush(new RectangleF(1, 2, 3, 4), Color.Empty, Color.Empty, linearGradientMode)); } - public static IEnumerable Ctor_HatchStyle_ForeColor_BackColor_TestData() - { - yield return new object[] { HatchStyle.Horizontal, new Color(), new Color() }; - yield return new object[] { HatchStyle.SolidDiamond, Color.PapayaWhip, Color.Plum }; - } - - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - [MemberData(nameof(Ctor_HatchStyle_ForeColor_BackColor_TestData))] - public void Ctor_HatchStyle_ForeColor_BackColor(HatchStyle hatchStyle, Color foreColor, Color backColor) - { - var brush = new HatchBrush(hatchStyle, foreColor, backColor); - Assert.Equal(hatchStyle, brush.HatchStyle); - - Assert.NotEqual(foreColor, brush.ForegroundColor); - Assert.Equal(foreColor.ToArgb(), brush.ForegroundColor.ToArgb()); - - Assert.NotEqual(backColor, brush.BackgroundColor); - Assert.Equal(backColor.ToArgb(), brush.BackgroundColor.ToArgb()); - } - - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - [InlineData(HatchStyle.Horizontal - 1)] - [InlineData(HatchStyle.SolidDiamond + 1)] - public void Ctor_InvalidHatchStyle_ThrowsArgumentException(HatchStyle hatchStyle) - { - AssertExtensions.Throws(null, () => new HatchBrush(hatchStyle, Color.Empty)); - AssertExtensions.Throws(null, () => new HatchBrush(hatchStyle, Color.Empty, Color.Empty)); - } - - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Brush_ReturnsClone() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -286,7 +259,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(brush.Transform, clone.Transform); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -295,7 +268,8 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Clone()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_GetWithInterpolationColorsSet_ReturnsNull() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -309,7 +283,8 @@ namespace System.Drawing.Drawing2D.Tests Assert.Null(brush.Blend); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { 1 }, new float[] { 1 })] [InlineData(new float[] { 0 }, new float[] { 0 })] [InlineData(new float[] { float.MaxValue }, new float[] { float.MaxValue })] @@ -333,7 +308,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(factors.Length, brush.Blend.Positions.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { 1, 2 }, new float[] { 1, 2 })] [InlineData(new float[] { 1, 2 }, new float[] { 1, 1 })] [InlineData(new float[] { 1, 2 }, new float[] { 1, 0 })] @@ -349,42 +324,42 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Blend = blend); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_SetNullBlend_ThrowsNullReferenceException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); Assert.Throws(() => brush.Blend = null); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_SetNullBlendFactors_ThrowsNullReferenceException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); Assert.Throws(() => brush.Blend = new Blend { Factors = null }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_SetNullBlendPositions_ThrowsArgumentNullException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); AssertExtensions.Throws("source", () => brush.Blend = new Blend { Factors = new float[2], Positions = null }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_SetFactorsLengthGreaterThanPositionsLength_ThrowsArgumentOutOfRangeException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); AssertExtensions.Throws(null, () => brush.Blend = new Blend { Factors = new float[2], Positions = new float[1] }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_SetInvalidBlendFactorsLength_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); AssertExtensions.Throws(null, () => brush.Blend = new Blend { Factors = new float[0], Positions = new float[0] }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_GetSetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -394,7 +369,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Blend = new Blend()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(true)] [InlineData(false)] public void GammaCorrection_Set_GetReturnsExpected(bool gammaCorrection) @@ -403,7 +378,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(gammaCorrection, brush.GammaCorrection); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GammaCorrection_GetSetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -413,7 +388,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.GammaCorrection = true); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(float.PositiveInfinity)] [InlineData(1)] [InlineData(0.5f)] @@ -433,7 +408,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(blend.Positions, brush.InterpolationColors.Positions); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_SetWithExistingInterpolationColors_OverwritesInterpolationColors() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true) @@ -448,28 +423,28 @@ namespace System.Drawing.Drawing2D.Tests var blend = new ColorBlend { Colors = new Color[] { Color.Red, Color.PeachPuff, Color.PowderBlue }, - Positions = new float[] { 0, 0.5f, 1f } + Positions = new float[] { 0, 0.5f, 1f } }; brush.InterpolationColors = blend; Assert.Equal(blend.Colors.Select(c => Color.FromArgb(c.ToArgb())), brush.InterpolationColors.Colors); Assert.Equal(blend.Positions, brush.InterpolationColors.Positions); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_SetNullBlend_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); AssertExtensions.Throws(null, () => brush.InterpolationColors = null); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_SetBlendWithNullColors_ThrowsNullReferenceException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); Assert.Throws(() => brush.InterpolationColors = new ColorBlend { Colors = null }); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(1)] public void InterpolationColors_SetBlendWithTooFewColors_ThrowsArgumentException(int colorsLength) @@ -478,14 +453,14 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.InterpolationColors = new ColorBlend { Colors = new Color[colorsLength] }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_SetNullBlendPositions_ThrowsNullReferenceException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); Assert.Throws(() => brush.InterpolationColors = new ColorBlend { Colors = new Color[2], Positions = null }); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(1)] [InlineData(3)] @@ -499,7 +474,7 @@ namespace System.Drawing.Drawing2D.Tests }); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { 1, 0, 1 })] [InlineData(new float[] { 0, 0, 0 })] public void InterpolationColors_InvalidPositions_ThrowsArgumentException(float[] positions) @@ -512,7 +487,7 @@ namespace System.Drawing.Drawing2D.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_GetSetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true) @@ -533,7 +508,7 @@ namespace System.Drawing.Drawing2D.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_SetBlendTriangularShape_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true) @@ -550,7 +525,8 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.InterpolationColors); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_SetBlend_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true) @@ -571,7 +547,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.InterpolationColors); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LinearColors_SetValid_GetReturnsExpected() { Color[] colors = new Color[] { Color.Red, Color.Blue, Color.AntiqueWhite }; @@ -579,14 +555,14 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(colors.Take(2).Select(c => Color.FromArgb(c.ToArgb())), brush.LinearColors); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LinearColors_SetNull_ThrowsNullReferenceException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); Assert.Throws(() => brush.LinearColors = null); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(1)] public void LinearColors_SetInvalidLength_ThrowsIndexOutOfRangeException(int length) @@ -595,7 +571,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Throws(() => brush.LinearColors = new Color[length]); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LinearColors_GetSetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -605,7 +581,8 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.LinearColors = new Color[] { Color.Red, Color.Wheat }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Rectangle_GetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -614,7 +591,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Rectangle); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetValid_GetReturnsExpected() { var transform = new Matrix(1, 2, 3, 4, 5, 6); @@ -622,14 +599,14 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(transform, brush.Transform); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetNull_ThrowsArgumentNullException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws("matrix", () => brush.Transform = null); + AssertExtensions.Throws("value", "matrix", () => brush.Transform = null); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_GetSetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -639,7 +616,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Transform = new Matrix()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(WrapMode.Tile)] [InlineData(WrapMode.TileFlipX)] [InlineData(WrapMode.TileFlipXY)] @@ -650,23 +627,23 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(wrapMode, brush.WrapMode); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(WrapMode.Tile - 1)] [InlineData(WrapMode.Clamp + 1)] public void WrapMode_SetInvalid_ThrowsInvalidEnumArgumentException(WrapMode wrapMode) { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws("value", () => brush.WrapMode = wrapMode); + Assert.ThrowsAny(() => brush.WrapMode = wrapMode); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_Clamp_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); AssertExtensions.Throws(null, () => brush.WrapMode = WrapMode.Clamp); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_GetSetDisposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -676,7 +653,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.WrapMode = WrapMode.TileFlipX); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Invoke_SetsTransformToIdentity() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -686,7 +663,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.True(brush.Transform.IsIdentity); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -695,7 +672,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.ResetTransform()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NoOrder_Success() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -707,7 +684,8 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend)] [InlineData(MatrixOrder.Append)] [InlineData(MatrixOrder.Prepend - 1)] @@ -732,30 +710,33 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NullMatrix_ThrowsArgumentNullException() { - var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws("matrix", () => brush.MultiplyTransform(null)); - AssertExtensions.Throws("matrix", () => brush.MultiplyTransform(null, MatrixOrder.Append)); + using (var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true)) + { + AssertExtensions.Throws("matrix", () => brush.MultiplyTransform(null)); + AssertExtensions.Throws("matrix", () => brush.MultiplyTransform(null, MatrixOrder.Append)); + } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_DisposedMatrix_Nop() { - var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - Matrix transform = brush.Transform; + using (var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true)) + using (Matrix transform = brush.Transform) + { + var matrix = new Matrix(); + matrix.Dispose(); - var matrix = new Matrix(); - matrix.Dispose(); + brush.MultiplyTransform(matrix); + brush.MultiplyTransform(matrix, MatrixOrder.Append); - brush.MultiplyTransform(matrix); - brush.MultiplyTransform(matrix, MatrixOrder.Append); - - Assert.Equal(transform, brush.Transform); + Assert.Equal(transform, brush.Transform); + } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NonInvertibleMatrix_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -765,7 +746,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.MultiplyTransform(matrix, MatrixOrder.Append)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -775,7 +756,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.MultiplyTransform(new Matrix(), MatrixOrder.Prepend)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, -2)] [InlineData(0, 0)] [InlineData(1, 2)] @@ -789,7 +770,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1, 1, MatrixOrder.Prepend)] [InlineData(1, 1, MatrixOrder.Append)] [InlineData(0, 0, MatrixOrder.Prepend)] @@ -806,7 +787,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void TranslateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder order) @@ -815,7 +796,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.TranslateTransform(0, 0, order)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TranslateTransform_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -825,7 +806,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.TranslateTransform(0, 0, MatrixOrder.Append)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, -2)] [InlineData(0, 0)] [InlineData(1, 2)] @@ -839,7 +820,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1, 1, MatrixOrder.Prepend)] [InlineData(1, 1, MatrixOrder.Append)] [InlineData(0, 0, MatrixOrder.Prepend)] @@ -856,7 +837,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void ScaleTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder order) @@ -865,7 +846,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.ScaleTransform(0, 0, order)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ScaleTransform_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -875,7 +856,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.ScaleTransform(0, 0, MatrixOrder.Append)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(1)] @@ -890,7 +871,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1, MatrixOrder.Prepend)] [InlineData(1, MatrixOrder.Append)] [InlineData(0, MatrixOrder.Prepend)] @@ -907,7 +888,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedTransform, brush.Transform); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void RotateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder order) @@ -916,7 +897,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.RotateTransform(0, order)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateTransform_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -926,7 +907,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.RotateTransform(0, MatrixOrder.Append)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(0.5)] [InlineData(1)] @@ -937,7 +918,7 @@ namespace System.Drawing.Drawing2D.Tests brush.SetSigmaBellShape(focus); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-0.1)] [InlineData(1.1)] [InlineData(float.PositiveInfinity)] @@ -945,11 +926,11 @@ namespace System.Drawing.Drawing2D.Tests public void SetSigmalBellShape_InvalidFocus_ThrowsArgumentException(float focus) { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(focus)); - AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(focus, 1)); + AssertExtensions.Throws("focus", null, () => brush.SetSigmaBellShape(focus)); + AssertExtensions.Throws("focus", null, () => brush.SetSigmaBellShape(focus, 1)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-0.1)] [InlineData(1.1)] [InlineData(float.PositiveInfinity)] @@ -957,10 +938,10 @@ namespace System.Drawing.Drawing2D.Tests public void SetSigmalBellShape_InvalidScale_ThrowsArgumentException(float scale) { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(0.1f, scale)); + AssertExtensions.Throws("scale", null, () => brush.SetSigmaBellShape(0.1f, scale)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetSigmalBellShape_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -970,7 +951,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(0, 1)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, new float[] { 1, 0 }, new float[] { 0, 1 })] [InlineData(0.5, new float[] { 0, 1, 0 }, new float[] { 0, 0.5f, 1 })] [InlineData(1, new float[] { 0, 1 }, new float[] { 0, 1 })] @@ -983,7 +964,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedPositions, brush.Blend.Positions); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 1, new float[] { 1, 0 }, new float[] { 0, 1 })] [InlineData(0.5, 0, new float[] { 0, 0, 0 }, new float[] { 0, 0.5f, 1 })] [InlineData(0.5, 1, new float[] { 0, 1, 0 }, new float[] { 0, 0.5f, 1 })] @@ -997,7 +978,7 @@ namespace System.Drawing.Drawing2D.Tests Assert.Equal(expectedPositions, brush.Blend.Positions); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-0.1)] [InlineData(1.1)] [InlineData(float.PositiveInfinity)] @@ -1005,11 +986,11 @@ namespace System.Drawing.Drawing2D.Tests public void SetBlendTriangularShape_InvalidFocus_ThrowsArgumentException(float focus) { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(focus)); - AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(focus, 1)); + AssertExtensions.Throws("focus", null, () => brush.SetBlendTriangularShape(focus)); + AssertExtensions.Throws("focus", null, () => brush.SetBlendTriangularShape(focus, 1)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-0.1)] [InlineData(1.1)] [InlineData(float.PositiveInfinity)] @@ -1017,10 +998,10 @@ namespace System.Drawing.Drawing2D.Tests public void SetBlendTriangularShape_InvalidScale_ThrowsArgumentException(float scale) { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); - AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(0.1f, scale)); + AssertExtensions.Throws("scale", null, () => brush.SetBlendTriangularShape(0.1f, scale)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetBlendTriangularShape_Disposed_ThrowsArgumentException() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); @@ -1030,7 +1011,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(0, 1)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Success() { var brush = new LinearGradientBrush(new Rectangle(1, 2, 3, 4), Color.Plum, Color.Red, 45, true); diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/MatrixTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/MatrixTests.cs index 75d01ca708..b70be00e73 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/MatrixTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/MatrixTests.cs @@ -31,7 +31,7 @@ namespace System.Drawing.Drawing2D.Tests { public class MatrixTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { using (var matrix = new Matrix()) @@ -44,7 +44,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(float.NaN)] [InlineData(float.NegativeInfinity)] [InlineData(float.PositiveInfinity)] @@ -58,7 +59,7 @@ namespace System.Drawing.Drawing2D.Tests Ctor_Elements(1, 0, 0, 1, 0, f, false, false); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1, 0, 0, 1, 0, 0, true, true)] [InlineData(0, 1, 2, 1, 3, 4, false, true)] [InlineData(0, 0, 0, 0, 0, 0, false, false)] @@ -93,7 +94,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Rectangle(0, 0, 1, 1), new Point[] { new Point(0, 0), new Point(1, 0), new Point(0, 1) }, new float[] { 1, 0, 0, 1, 0, 0 }, true, true }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_Points_TestData))] public void Ctor_Rectangle_Points(Rectangle rect, Point[] plgpnts, float[] expectedElements, bool isIdentity, bool isInvertible) { @@ -107,7 +108,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Rectangle_Points_TestData))] public void Ctor_RectangleF_Points(Rectangle rect, Point[] plgpnts, float[] expectedElements, bool isIdentity, bool isInvertible) { @@ -121,14 +122,14 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullPoints_ThrowsArgumentNullException() { AssertExtensions.Throws("plgpts", () => new Matrix(new RectangleF(), null)); AssertExtensions.Throws("plgpts", () => new Matrix(new Rectangle(), null)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(2)] [InlineData(4)] @@ -138,21 +139,21 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => new Matrix(new Rectangle(), new Point[length])); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_WidthZero_ThrowsOutOfMemoryException() { Assert.Throws(() => new Matrix(new Rectangle(1, 1, 0, 1), new Point[3])); Assert.Throws(() => new Matrix(new RectangleF(1, 1, 0, 1), new PointF[3])); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_HeightZero_ThrowsOutOfMemoryException() { Assert.Throws(() => new Matrix(new Rectangle(1, 1, 1, 0), new Point[3])); Assert.Throws(() => new Matrix(new RectangleF(1, 1, 1, 0), new PointF[3])); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Matrix_ReturnsExpected() { using (var matrix = new Matrix(1, 2, 3, 4, 5, 6)) @@ -163,7 +164,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -197,7 +198,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(), new object(), false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Equals_TestData))] public void Equals_Other_ReturnsExpected(Matrix matrix, object other, bool expected) { @@ -216,7 +217,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Equals_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -225,7 +226,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => matrix.Equals(new Matrix())); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Equals_DisposedOther_ThrowsArgumentException() { var matrix = new Matrix(); @@ -234,7 +235,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => new Matrix().Equals(matrix)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Elements_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -250,7 +251,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(), new float[] { 1, 0, 0, 1, 0, 0 } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Invert_TestData))] public void Invert_Matrix_Success(Matrix matrix, float[] expectedElements) { @@ -265,7 +266,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(float.NaN)] [InlineData(float.PositiveInfinity)] [InlineData(float.NegativeInfinity)] @@ -287,7 +289,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Invert_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -296,7 +298,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => matrix.Invert()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void IsIdentity_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -305,7 +307,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => matrix.IsIdentity); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void IsInvertible_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -341,7 +343,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), new Matrix(float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue), MatrixOrder.Append, new float[] { float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Multiply_TestData))] public void Multiply_Matrix_Success(Matrix matrix, Matrix multiple, MatrixOrder order, float[] expected) { @@ -365,7 +368,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Multiply_NullMatrix_ThrowsArgumentNullException() { using (var matrix = new Matrix()) @@ -375,7 +378,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void Multiply_InvalidMatrixOrder_ThrowsArgumentException(MatrixOrder order) @@ -387,7 +390,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Multiply_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -400,7 +403,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Multiply_DisposedMatrix_ThrowsArgumentException() { using (var matrix = new Matrix()) @@ -413,7 +416,17 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Multiply_SameMatrix_ThrowsInvalidOperationException() + { + using (var matrix = new Matrix()) + { + Assert.Throws(() => matrix.Multiply(matrix)); + Assert.Throws(() => matrix.Multiply(matrix, MatrixOrder.Prepend)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Reset_Matrix_ReturnsExpected() { using (var matrix = new Matrix(1, 2, 3, 4, 5, 6)) @@ -426,7 +439,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Reset_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -472,7 +485,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), float.NegativeInfinity, PointF.Empty, MatrixOrder.Append, new float[] { float.NaN, float.NaN, float.NaN, float.NaN, float.NaN, float.NaN }, null, false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Rotate_TestData))] public void Rotate_Matrix_Success(Matrix matrix, float angle, PointF point, MatrixOrder order, float[] expectedElements, float[] expectedElementsRotateAt, bool isIdentity) { @@ -521,7 +535,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Rotate_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -530,7 +544,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => matrix.Rotate(1, MatrixOrder.Append)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void Rotate_InvalidMatrixOrder_ThrowsArgumentException(MatrixOrder order) @@ -541,7 +555,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateAt_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -551,7 +565,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => matrix.RotateAt(1, PointF.Empty, MatrixOrder.Append)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void RotateAt_InvalidMatrixOrder_ThrowsArgumentException(MatrixOrder order) @@ -592,7 +606,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), float.MaxValue, float.MaxValue, MatrixOrder.Append, new float[] { float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Scale_TestData))] public void Scale_Matrix_Succss(Matrix matrix, float scaleX, float scaleY, MatrixOrder order, float[] expectedElements) { @@ -616,7 +631,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void Scale_InvalidMatrixOrder_ThrowsArgumentException(MatrixOrder order) @@ -627,7 +642,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Scale_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -667,7 +682,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(10, 20, 30, 40, 50, 60), float.MaxValue, float.MaxValue, MatrixOrder.Append, new float[] { float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Shear_TestData))] public void Shear_Matrix_Succss(Matrix matrix, float shearX, float shearY, MatrixOrder order, float[] expectedElements) { @@ -692,7 +708,7 @@ namespace System.Drawing.Drawing2D.Tests } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void Shear_InvalidMatrixOrder_ThrowsArgumentException(MatrixOrder order) @@ -703,7 +719,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Shear_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -734,7 +750,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), float.MaxValue, float.MaxValue, MatrixOrder.Append, new float[] { 1, 2, 3, 4, float.MaxValue, float.MaxValue } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Translate_TestData))] public void Translate_Matrix_Success(Matrix matrix, float offsetX, float offsetY, MatrixOrder order, float[] expectedElements) { @@ -758,7 +775,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void Translate_InvalidMatrixOrder_ThrowsArgumentException(MatrixOrder order) @@ -769,7 +786,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Translate_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -786,7 +803,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(2, 4, 6, 8, 10, 12), new Point[1], new Point[] { new Point(10, 12) } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TransformPoints_TestData))] public void TransformPoints_Point_Success(Matrix matrix, Point[] points, Point[] expectedPoints) { @@ -801,7 +818,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TransformPoints_TestData))] public void TransformPoints_PointF_Success(Matrix matrix, Point[] points, Point[] expectedPoints) { @@ -817,7 +834,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TransformPoints_NullPoints_ThrowsArgumentNullException() { using (var matrix = new Matrix()) @@ -827,7 +844,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TransformPoints_EmptyPoints_ThrowsArgumentException() { using (var matrix = new Matrix()) @@ -837,7 +854,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TransformPoints_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); @@ -854,7 +871,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Matrix(2, 4, 6, 8, 10, 12), new Point[1], new Point[1] }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TransformVectors_TestData))] public void TransformVectors_Point_Success(Matrix matrix, Point[] points, Point[] expectedPoints) { @@ -869,7 +886,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TransformVectors_TestData))] public void TransformVectors_PointF_Success(Matrix matrix, Point[] points, Point[] expectedPoints) { @@ -885,7 +902,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TransformVectors_TestData))] public void VectorTransformPoints_Points_Success(Matrix matrix, Point[] points, Point[] expectedPoints) { @@ -900,7 +917,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TransformVectors_NullPoints_ThrowsArgumentNullException() { using (var matrix = new Matrix()) @@ -911,7 +928,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TransformVectors_EmptyPoints_ThrowsArgumentException() { using (var matrix = new Matrix()) @@ -922,7 +939,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TransformVectors_Disposed_ThrowsArgumentException() { var matrix = new Matrix(); diff --git a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/PathGradientBrushTests.cs b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/PathGradientBrushTests.cs index c7bf4a0f9f..27e9e060db 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Drawing2D/PathGradientBrushTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Drawing2D/PathGradientBrushTests.cs @@ -36,7 +36,8 @@ namespace System.Drawing.Drawing2D.Tests private readonly PointF[] _defaultFloatPoints = new PointF[2] { new PointF(1, 2), new PointF(20, 30) }; private readonly RectangleF _defaultRectangle = new RectangleF(1, 2, 19, 28); - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Points_ReturnsExpected() { using (PathGradientBrush bi = new PathGradientBrush(_defaultIntPoints)) @@ -58,7 +59,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { WrapMode.TileFlipY }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(WrapMode_TestData))] public void Ctor_PointsWrapMode_ReturnsExpected(WrapMode wrapMode) { @@ -72,14 +74,14 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_PointsNull_ThrowsArgumentNullException() { AssertExtensions.Throws("points", () => new PathGradientBrush((Point[])null)); AssertExtensions.Throws("points", () => new PathGradientBrush((PointF[])null)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(1)] public void Ctor_PointsLengthLessThenTwo_ThrowsOutOfMemoryException(int pointsLength) @@ -90,17 +92,18 @@ namespace System.Drawing.Drawing2D.Tests Assert.Throws(() => new PathGradientBrush(new PointF[pointsLength], WrapMode.Clamp)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_InvalidWrapMode_ThrowsInvalidEnumArgumentException() { - AssertExtensions.Throws("wrapMode", () => + Assert.ThrowsAny(() => new PathGradientBrush(_defaultIntPoints, (WrapMode)int.MaxValue)); - AssertExtensions.Throws("wrapMode", () => + Assert.ThrowsAny(() => new PathGradientBrush(_defaultFloatPoints, (WrapMode)int.MaxValue)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Path_ReturnsExpected() { using (GraphicsPath path = new GraphicsPath(_defaultFloatPoints, new byte[] { 0, 1 })) @@ -111,13 +114,13 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Path_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => new PathGradientBrush((GraphicsPath)null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_PathWithLessThenTwoPoints_ThrowsOutOfMemoryException() { using (GraphicsPath path = new GraphicsPath()) @@ -128,7 +131,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_ReturnsExpected() { using (GraphicsPath path = new GraphicsPath(_defaultFloatPoints, new byte[] { 0, 1 })) @@ -140,7 +144,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -149,7 +153,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Clone()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CenterColor_ReturnsExpected() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -162,7 +166,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CenterColor_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -171,7 +175,8 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.CenterColor = Color.Blue); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SurroundColors_ReturnsExpected() { Color[] expectedColors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) }; @@ -187,7 +192,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SurroundColors_CannotChange() { Color[] colors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) }; @@ -203,7 +208,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SurroundColors_Disposed_ThrowsArgumentException() { Color[] colors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) }; @@ -219,7 +224,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Point[2] { new Point(1, 1), new Point(2, 2) }, new Color[3] }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(SurroundColors_InvalidColorsLength_TestData))] public void SurroundColors_InvalidColorsLength_ThrowsArgumentException(Point[] points, Color[] colors) { @@ -229,7 +234,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] public void SurroundColors_Null_ThrowsArgumentNullException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -238,7 +243,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CenterPoint_ReturnsExpected() { PointF centralPoint = new PointF(float.MaxValue, float.MinValue); @@ -258,7 +263,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CenterPoint_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -275,7 +280,8 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new float[1] { 1 }, new float[3] { 0, 3, 1 } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Blend_FactorsPositions_TestData))] public void Blend_ReturnsExpected(float[] factors, float[] positions) { @@ -299,7 +305,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_CannotChange() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints, WrapMode.TileFlipXY)) @@ -315,7 +321,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -333,7 +339,7 @@ namespace System.Drawing.Drawing2D.Tests yield return new object[] { new Blend() { Factors = new float[3], Positions = new float[3] { 1, 1, 1 } } }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Blend_InvalidFactorsPositions_TestData))] public void Blend_InvalidFactorPositions_ThrowsArgumentException(Blend blend) { @@ -343,7 +349,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_InvalidFactorPositionsLengthMismatch_ThrowsArgumentOutOfRangeException() { Blend invalidBlend = new Blend() { Factors = new float[2], Positions = new float[1] }; @@ -354,7 +360,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_Null_ThrowsNullReferenceException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -365,7 +371,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Blend_NullBlendProperites_ThrowsArgumentNullException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -375,7 +381,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1f)] [InlineData(0f)] [InlineData(0.5f)] @@ -411,7 +417,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1f, 1f)] [InlineData(0f, 1f)] [InlineData(0.5f, 1f)] @@ -459,7 +465,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetSigmaBellShape_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -469,30 +475,30 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(1f, 1f)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1.1f)] public void SetSigmaBellShape_InvalidFocus_ThrowsArgumentException(float focus) { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) { - AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(focus)); - AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(focus, 1f)); + AssertExtensions.Throws("focus", null, () => brush.SetSigmaBellShape(focus)); + AssertExtensions.Throws("focus", null, () => brush.SetSigmaBellShape(focus, 1f)); } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1.1f)] public void SetSigmaBellShape_InvalidScale_ThrowsArgumentException(float scale) { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) { - AssertExtensions.Throws(null, () => brush.SetSigmaBellShape(1f, scale)); + AssertExtensions.Throws("scale", null, () => brush.SetSigmaBellShape(1f, scale)); } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1f)] [InlineData(0f)] [InlineData(0.5f)] @@ -522,7 +528,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1f, 1f)] [InlineData(0f, 1f)] [InlineData(0.5f, 1f)] @@ -557,7 +563,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetBlendTriangularShape_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -567,30 +573,30 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(1f, 1f)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1.1f)] public void SetBlendTriangularShape_InvalidFocus_ThrowsArgumentException(float focus) { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) { - AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(focus)); - AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(focus, 1f)); + AssertExtensions.Throws("focus", null, () => brush.SetBlendTriangularShape(focus)); + AssertExtensions.Throws("focus", null, () => brush.SetBlendTriangularShape(focus, 1f)); } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(1.1f)] public void SetBlendTriangularShape_InvalidScale_ThrowsArgumentException(float scale) { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) { - AssertExtensions.Throws(null, () => brush.SetBlendTriangularShape(1f, scale)); + AssertExtensions.Throws("scale", null, () => brush.SetBlendTriangularShape(1f, scale)); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_ReturnsExpected() { Color[] expectedColors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) }; @@ -609,7 +615,8 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_CannotChange() { Color[] colors = new Color[2] { Color.FromArgb(255, 0, 0, 255), Color.FromArgb(255, 255, 0, 0) }; @@ -631,7 +638,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -640,7 +647,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.InterpolationColors); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_Null_ThrowsNullReferenceException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -649,7 +656,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_NullColors_ThrowsNullReferenceException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -662,7 +669,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_NullPoints_ArgumentNullException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -672,7 +679,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_Empty_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -681,7 +688,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_EmptyColors_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -691,7 +698,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_PointsLengthGreaterThenColorsLength_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -701,7 +708,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void InterpolationColors_ColorsLengthGreaterThenPointsLength_ThrowsArgumentOutOfRangeException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -711,7 +718,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_ReturnsExpected() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -724,7 +731,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_EmptyMatrix_ReturnsExpected() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -735,7 +742,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -744,16 +751,16 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.Transform); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_Null_ArgumentNullException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) { - AssertExtensions.Throws("matrix", () => brush.Transform = null); + AssertExtensions.Throws("value", "matrix", () => brush.Transform = null); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_NonInvertible_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -763,7 +770,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Success() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -778,7 +785,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -787,7 +794,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.ResetTransform()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_Matrix_Success() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -800,7 +807,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Append)] [InlineData(MatrixOrder.Prepend)] public void MultiplyTransform_MatrixMatrixOrder_Success(MatrixOrder matrixOrder) @@ -815,7 +822,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_Disposed_ThrowsArgumentException() { using (Matrix matrix = new Matrix(1, 0, 0, 1, 1, 1)) @@ -827,17 +834,33 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - public void MultiplyTransform_Null_ArgumentNullException() + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void MultiplyTransform_NullMatrix_ThrowsArgumentNullException() { - using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) + using (var brush = new PathGradientBrush(_defaultFloatPoints)) { AssertExtensions.Throws("matrix", () => brush.MultiplyTransform(null)); AssertExtensions.Throws("matrix", () => brush.MultiplyTransform(null, MatrixOrder.Append)); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void MultiplyTransform_DisposedMatrix_Nop() + { + using (var brush = new PathGradientBrush(_defaultFloatPoints)) + using (Matrix transform = brush.Transform) + { + var matrix = new Matrix(); + matrix.Dispose(); + + brush.MultiplyTransform(matrix); + brush.MultiplyTransform(matrix, MatrixOrder.Append); + + Assert.Equal(transform, brush.Transform); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_InvalidMatrixOrder_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -847,7 +870,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NonInvertible_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -858,7 +881,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TranslateTransform_Offset_Success() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -870,7 +893,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Append)] [InlineData(MatrixOrder.Prepend)] public void TranslateTransform_OffsetMatrixOrder_Success(MatrixOrder matrixOrder) @@ -884,7 +907,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TranslateTransform_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -893,7 +916,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.TranslateTransform(20f, 30f, MatrixOrder.Append)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TranslateTransform_InvalidMatrixOrder_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -902,7 +925,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ScaleTransform_Scale_Success() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -926,7 +949,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Append)] [InlineData(MatrixOrder.Prepend)] public void ScaleTransform_ScaleMatrixOrder_Success(MatrixOrder matrixOrder) @@ -940,7 +963,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ScaleTransform_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -949,7 +972,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.ScaleTransform(0.25f, 2, MatrixOrder.Append)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ScaleTransform_InvalidMatrixOrder_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -958,7 +981,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateTransform_Angle_Success() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -973,7 +996,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Append)] [InlineData(MatrixOrder.Prepend)] public void RotateTransform_AngleMatrixOrder_Success(MatrixOrder matrixOrder) @@ -987,7 +1010,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateTransform_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -996,7 +1019,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.RotateTransform(45, MatrixOrder.Append)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateTransform_InvalidMatrixOrder_ArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) @@ -1005,7 +1028,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FocusScales_ReturnsExpected() { var point = new PointF(2.5f, 3.4f); @@ -1017,7 +1040,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FocusScales_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -1026,7 +1049,7 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.FocusScales); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(WrapMode_TestData))] public void WrapMode_ReturnsExpected(WrapMode wrapMode) { @@ -1037,7 +1060,7 @@ namespace System.Drawing.Drawing2D.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_Disposed_ThrowsArgumentException() { PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints); @@ -1046,12 +1069,12 @@ namespace System.Drawing.Drawing2D.Tests AssertExtensions.Throws(null, () => brush.WrapMode); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_Invalid_InvalidEnumArgumentException() { using (PathGradientBrush brush = new PathGradientBrush(_defaultFloatPoints)) { - AssertExtensions.Throws("value", () => brush.WrapMode = (WrapMode)int.MinValue); + Assert.ThrowsAny(() => brush.WrapMode = (WrapMode)int.MinValue); } } diff --git a/external/corefx/src/System.Drawing.Common/tests/FontFamilyTests.cs b/external/corefx/src/System.Drawing.Common/tests/FontFamilyTests.cs index 04ce27e6e0..ad60729124 100644 --- a/external/corefx/src/System.Drawing.Common/tests/FontFamilyTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/FontFamilyTests.cs @@ -10,7 +10,8 @@ namespace System.Drawing.Tests { public class FontFamilyTests { - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(GenericFontFamilies.Serif - 1, "Courier New")] // Value is outside the enum range. [InlineData(GenericFontFamilies.Monospace + 1, "Courier New")] // Value is outside the enum range. [InlineData(GenericFontFamilies.Monospace, "Courier New")] @@ -24,7 +25,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("Courier New", "Courier New")] [InlineData("Microsoft Sans Serif", "Microsoft Sans Serif")] [InlineData("Times New Roman", "Times New Roman")] @@ -37,7 +39,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Name_FontCollection() { using (var fontCollection = new PrivateFontCollection()) @@ -51,7 +54,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(null)] [InlineData("")] [InlineData("NoSuchFont")] @@ -62,7 +66,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new FontFamily(name, null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NoSuchFontNameInCollection_ThrowsArgumentException() { var fontCollection = new PrivateFontCollection(); @@ -80,7 +84,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSansSerif, null, false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Equals_TestData))] public void Equals_Object_ReturnsExpected(FontFamily fontFamily, object other, bool expected) { @@ -95,7 +100,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Families_Get_ReturnsExpected() { #pragma warning disable 0618 // FontFamily.GetFamilies is deprecated. @@ -105,7 +110,15 @@ namespace System.Drawing.Tests FontFamily[] families = FontFamily.Families; FontFamily[] familiesWithGraphics = FontFamily.GetFamilies(graphics); - Assert.Equal(families, familiesWithGraphics); + // FontFamily.Equals uses the native handle to determine equality. However, GDI+ does not always + // cache handles, so we cannot just Assert.Equal(families, familiesWithGraphics); + Assert.Equal(families.Length, familiesWithGraphics.Length); + + for (int i = 0; i < families.Length; i++) + { + Assert.Equal(families[i].Name, familiesWithGraphics[i].Name); + } + foreach (FontFamily fontFamily in families) { using (FontFamily copy = new FontFamily(fontFamily.Name)) @@ -117,7 +130,8 @@ namespace System.Drawing.Tests #pragma warning restore 0618 } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GenericMonospace_Get_ReturnsExpected() { using (FontFamily fontFamily1 = FontFamily.GenericMonospace) @@ -130,7 +144,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GenericSansSerif_Get_ReturnsExpected() { using (FontFamily fontFamily1 = FontFamily.GenericSansSerif) @@ -143,7 +158,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GenericSerif_Get_ReturnsExpected() { using (FontFamily fontFamily1 = FontFamily.GenericSerif) @@ -156,7 +172,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetFamilies_NullGraphics_ThrowsArgumentNullException() { #pragma warning disable 0618 // FontFamily.GetFamilies is deprecated. @@ -164,7 +180,8 @@ namespace System.Drawing.Tests #pragma warning restore 0618 } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHashCode_Invoke_ReturnsNameHashCode() { using (FontFamily fontFamily = FontFamily.GenericSansSerif) @@ -184,7 +201,8 @@ namespace System.Drawing.Tests yield return new object[] { FontStyle.Strikeout + 1 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(FontStyle_TestData))] public void FontFamilyProperties_CustomFont_ReturnsExpected(FontStyle style) { @@ -203,7 +221,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void IsStyleAvailable_Disposed_ThrowsArgumentException() { FontFamily fontFamily = FontFamily.GenericMonospace; @@ -212,7 +231,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => fontFamily.IsStyleAvailable(FontStyle.Italic)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetEmHeight_Disposed_ThrowsArgumentException() { FontFamily fontFamily = FontFamily.GenericMonospace; @@ -223,7 +243,8 @@ namespace System.Drawing.Tests private const int FrenchLCID = 1036; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, "Code New Roman")] [InlineData(0, "Code New Roman")] [InlineData(int.MaxValue, "Code New Roman")] @@ -242,7 +263,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetName_Disposed_ThrowsArgumentException() { FontFamily fontFamily = FontFamily.GenericMonospace; @@ -251,7 +273,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => fontFamily.GetName(0)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetCellAscent_Disposed_ThrowsArgumentException() { FontFamily fontFamily = FontFamily.GenericMonospace; @@ -260,7 +283,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => fontFamily.GetCellAscent(FontStyle.Italic)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetCellDescent_Disposed_ThrowsArgumentException() { FontFamily fontFamily = FontFamily.GenericMonospace; @@ -269,7 +293,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => fontFamily.GetCellDescent(FontStyle.Italic)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetLineSpacing_Disposed_ThrowsArgumentException() { FontFamily fontFamily = FontFamily.GenericMonospace; @@ -278,7 +303,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => fontFamily.GetLineSpacing(FontStyle.Italic)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Nop() { FontFamily fontFamily = FontFamily.GenericMonospace; diff --git a/external/corefx/src/System.Drawing.Common/tests/FontTests.cs b/external/corefx/src/System.Drawing.Common/tests/FontTests.cs index 725adeadee..e742cedcf1 100644 --- a/external/corefx/src/System.Drawing.Common/tests/FontTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/FontTests.cs @@ -16,7 +16,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSerif, float.MaxValue }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_TestData))] public void Ctor_Family_Size(FontFamily fontFamily, float emSize) { @@ -33,7 +34,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_TestData))] public void Ctor_FamilyName_Size(FontFamily fontFamily, float emSize) { @@ -62,7 +64,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSerif, 16, (FontStyle)int.MaxValue }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_TestData))] public void Ctor_Family_Size_Style(FontFamily fontFamily, float emSize, FontStyle style) { @@ -79,7 +82,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_TestData))] public void Ctor_FamilyName_Size_Style(FontFamily fontFamily, float emSize, FontStyle style) { @@ -106,7 +110,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSerif, 16, GraphicsUnit.World }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Unit_TestData))] public void Ctor_Family_Size_Unit(FontFamily fontFamily, float emSize, GraphicsUnit unit) { @@ -123,7 +128,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Unit_TestData))] public void Ctor_FamilyName_Size_Unit(FontFamily fontFamily, float emSize, GraphicsUnit unit) { @@ -152,7 +158,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSerif, 16, (FontStyle)int.MaxValue, GraphicsUnit.Millimeter }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_Unit_TestData))] public void Ctor_Family_Size_Style_Unit(FontFamily fontFamily, float emSize, FontStyle style, GraphicsUnit unit) { @@ -169,7 +176,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_Unit_TestData))] public void Ctor_FamilyName_Size_Style_Unit(FontFamily fontFamily, float emSize, FontStyle style, GraphicsUnit unit) { @@ -198,7 +206,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSerif, 16, (FontStyle)int.MaxValue, GraphicsUnit.Millimeter, 200 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_Unit_GdiCharSet_TestData))] public void Ctor_Family_Size_Style_Unit_GdiCharSet(FontFamily fontFamily, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) { @@ -215,7 +224,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_Unit_GdiCharSet_TestData))] public void Ctor_FamilyName_Size_Style_Unit_GdiCharSet(FontFamily fontFamily, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet) { @@ -244,7 +254,8 @@ namespace System.Drawing.Tests yield return new object[] { FontFamily.GenericSerif, 16, (FontStyle)int.MaxValue, GraphicsUnit.Millimeter, 200, false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_Unit_GdiCharSet_GdiVerticalFont_TestData))] public void Ctor_Family_Size_Style_Unit_GdiCharSet_GdiVerticalFont(FontFamily fontFamily, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) { @@ -261,7 +272,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Family_Size_Style_Unit_GdiCharSet_GdiVerticalFont_TestData))] public void Ctor_FamilyName_Size_Style_Unit_GdiCharSet_GdiVerticalFont(FontFamily fontFamily, float emSize, FontStyle style, GraphicsUnit unit, byte gdiCharSet, bool gdiVerticalFont) { @@ -278,7 +290,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_FamilyNamePrefixedWithAtSign_StripsSign() { using (FontFamily family = FontFamily.GenericMonospace) @@ -289,7 +302,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(null)] [InlineData("")] [InlineData("NoSuchFont")] @@ -302,13 +316,14 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullFont_ThrowsNullReferenceException() { Assert.Throws(() => new Font(null, FontStyle.Regular)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_DisposedFont_Success() { using (FontFamily family = FontFamily.GenericSerif) @@ -324,7 +339,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullFamily_ThrowsArgumentNullException() { AssertExtensions.Throws("family", () => new Font((FontFamily)null, 10)); @@ -335,7 +350,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws("family", () => new Font((FontFamily)null, 10, FontStyle.Italic, GraphicsUnit.Display, 10, gdiVerticalFont: true)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_DisposedFamily_ThrowsArgumentException() { FontFamily family = FontFamily.GenericSansSerif; @@ -349,7 +365,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Font(family, 10, FontStyle.Italic, GraphicsUnit.Display, 10, gdiVerticalFont: true)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(float.NaN)] @@ -374,7 +391,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(GraphicsUnit.Display)] [InlineData(GraphicsUnit.World - 1)] [InlineData(GraphicsUnit.Millimeter + 1)] @@ -393,7 +411,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Invoke_ReturnsExpected() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -411,7 +430,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_DisposedFont_ThrowsArgumentException() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -439,7 +459,8 @@ namespace System.Drawing.Tests yield return new object[] { new Font(family, 10), null, false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Equals_TestData))] public void Equals_Other_ReturnsExpected(Font font, object other, bool expected) { @@ -464,13 +485,15 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHdc_ZeroHdc_ThrowsArgumentException() { AssertExtensions.Throws(null, () => Font.FromHdc(IntPtr.Zero)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHdc_GraphicsHdc_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -488,13 +511,15 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHfont_Zero_ThrowsArgumentException() { AssertExtensions.Throws(null, () => Font.FromHfont(IntPtr.Zero)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHeight_Parameterless_ReturnsExpected() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -507,7 +532,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHeight_Graphics_ReturnsExpected() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -519,7 +545,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 0)] [InlineData(-1, -0.1571995)] [InlineData(1, 0.1571995)] @@ -535,7 +562,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHeight_NullGraphics_ThrowsArgumentNullException() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -546,7 +574,7 @@ namespace System.Drawing.Tests } // This causes an AccessViolation in GDI+. - // [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + // [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHeight_DisposedGraphics_ThrowsArgumentException() { using (FontFamily family = FontFamily.GenericMonospace) @@ -560,7 +588,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHeight_Disposed_ThrowsArgumentException() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -576,7 +605,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(FontStyle.Bold, int.MinValue, 0)] [InlineData(FontStyle.Bold, -2147483099, 0)] [InlineData(FontStyle.Regular, -2147483098, 0)] @@ -608,12 +638,13 @@ namespace System.Drawing.Tests }; using (Font font = Font.FromLogFont(logFont)) { - VerifyFont(font, family.Name, 16, fontStyle, GraphicsUnit.World, charSet, expectedGdiVerticalFont: false); + VerifyFont(font, family.Name, font.Size, fontStyle, GraphicsUnit.World, charSet, expectedGdiVerticalFont: false); } } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromLogFont_NullLogFont_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -632,7 +663,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromLogFont_InvalidLogFont_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -652,7 +684,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(GraphicsUnit.Document)] [InlineData(GraphicsUnit.Inch)] [InlineData(GraphicsUnit.Millimeter)] @@ -676,7 +709,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(FontStyle.Strikeout | FontStyle.Bold | FontStyle.Italic, true, 255, "@", 700)] [InlineData(FontStyle.Regular, 0, false, "", 400)] [InlineData(FontStyle.Regular, 10, false, "", 400)] @@ -705,7 +739,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(TextRenderingHint.SystemDefault, 0)] [InlineData(TextRenderingHint.AntiAlias, 3)] [InlineData(TextRenderingHint.AntiAliasGridFit, 3)] @@ -741,7 +776,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Throws an AccessViolationException in the .NET Framework.")] public void ToLogFont_NullLogFont_ThrowsArgumentNullException() { @@ -755,7 +791,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToLogFont_NullGraphics_ThrowsArgumentNullException() { using (FontFamily family = FontFamily.GenericMonospace) @@ -765,7 +802,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToLogFont_DisposedGraphics_ThrowsArgumentException() { using (FontFamily family = FontFamily.GenericMonospace) @@ -799,7 +837,8 @@ namespace System.Drawing.Tests public string lfFaceName; } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToHfont_SimpleFont_Roundtrips() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -814,7 +853,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToHfont_ComplicatedFont_DoesNotRoundtrip() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -829,7 +869,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToHfont_Disposed_ThrowsArgumentException() { using (FontFamily family = FontFamily.GenericSansSerif) @@ -843,7 +884,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToString_Invoke_ReturnsExpected() { using (FontFamily family = FontFamily.GenericSansSerif) diff --git a/external/corefx/src/System.Drawing.Common/tests/GraphicsTests.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/tests/GraphicsTests.cs.REMOVED.git-id index cb95781c52..8f1111934b 100644 --- a/external/corefx/src/System.Drawing.Common/tests/GraphicsTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Drawing.Common/tests/GraphicsTests.cs.REMOVED.git-id @@ -1 +1 @@ -3af65ef656cb17eee6b586b7d6b1c4b000b3582b \ No newline at end of file +fa8c6c7e5ceaf3a5078cd782101d21a97c8026b1 \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/tests/Helpers.cs b/external/corefx/src/System.Drawing.Common/tests/Helpers.cs index 5d55f9805d..a1e577c41b 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Helpers.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Helpers.cs @@ -1,18 +1,104 @@ // Licensed to the .NET Foundation under one or more agreements. // See the LICENSE file in the project root for more information. +using System.Drawing.Printing; using System.IO; using System.Runtime.InteropServices; using System.Text; using Xunit; using Xunit.Sdk; -namespace System.Drawing.Tests +namespace System.Drawing { public static class Helpers { + public const string GdiplusIsAvailable = nameof(Helpers) + "." + nameof(GetGdiplusIsAvailable); + public const string RecentGdiplusIsAvailable = nameof(Helpers) + "." + nameof(GetRecentGdiPlusIsAvailable); + public const string RecentGdiplusIsAvailable2 = nameof(Helpers) + "." + nameof(GetRecentGdiPlusIsAvailable2); + public const string GdiPlusIsAvailableNotRedhat73 = nameof(Helpers) + "." + nameof(GetGdiPlusIsAvailableNotRedhat73); + public const string GdiPlusIsAvailableNotWindows7 = nameof(Helpers) + "." + nameof(GetGdiPlusIsAvailableNotWindows7); + public const string AnyInstalledPrinters = nameof(Helpers) + "." + nameof(IsAnyInstalledPrinters); + + public static bool GetGdiplusIsAvailable() + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return PlatformDetection.IsNotWindowsNanoServer && PlatformDetection.IsNotWindowsServerCore; + } + else + { + IntPtr nativeLib; + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + nativeLib = dlopen("libgdiplus.dylib", RTLD_NOW); + } + else + { + nativeLib = dlopen("libgdiplus.so", RTLD_NOW); + if (nativeLib == IntPtr.Zero) + { + nativeLib = dlopen("libgdiplus.so.0", RTLD_NOW); + } + } + + return nativeLib != IntPtr.Zero; + } + } + + public static bool GetRecentGdiPlusIsAvailable2() + { + // CentOS 7, RHEL 7 and Ubuntu 14.04, as well as Fedora 25 and OpenSUSE 4.22 are running outdated versions of libgdiplus + if (PlatformDetection.IsCentos7 || PlatformDetection.IsRedHat || PlatformDetection.IsUbuntu1404 || PlatformDetection.IsFedora || PlatformDetection.IsOpenSUSE) + { + return false; + } + + return GetGdiplusIsAvailable(); + } + + public static bool GetGdiPlusIsAvailableNotRedhat73() + { + if (PlatformDetection.IsRedHat) + { + return false; + } + + return GetGdiplusIsAvailable(); + } + + public static bool GetGdiPlusIsAvailableNotWindows7() + { + if (PlatformDetection.IsWindows7) + { + return false; + } + + return GetGdiplusIsAvailable(); + } + + public static bool GetRecentGdiPlusIsAvailable() + { + // CentOS 7, RHEL 7 and Ubuntu 14.04 are running outdated versions of libgdiplus + if (PlatformDetection.IsCentos7 || PlatformDetection.IsRedHat || PlatformDetection.IsUbuntu1404) + { + return false; + } + + return GetGdiplusIsAvailable(); + } + + public static bool IsAnyInstalledPrinters() + { + return PrinterSettings.InstalledPrinters.Count > 0; + } + + [DllImport("libdl")] + private static extern IntPtr dlopen(string libName, int flags); + public const int RTLD_NOW = 0x002; + public static string GetTestBitmapPath(string fileName) => GetTestPath("bitmaps", fileName); public static string GetTestFontPath(string fileName) => GetTestPath("fonts", fileName); + public static string GetTestColorProfilePath(string fileName) => GetTestPath("colorProfiles", fileName); private static string GetTestPath(string directoryName, string fileName) => Path.Combine(AppContext.BaseDirectory, directoryName, fileName); @@ -142,5 +228,23 @@ namespace System.Drawing.Tests public int Right; public int Bottom; } + + public static void VerifyBitmapNotBlank(Bitmap bmp) + { + Color emptyColor = Color.FromArgb(0); + for (int y = 0; y < bmp.Height; y++) + { + for (int x = 0; x < bmp.Width; x++) + { + Color pixel = bmp.GetPixel(x, y); + if (!pixel.Equals(emptyColor)) + { + return; + } + } + } + + throw new XunitException("The entire image was blank."); + } } } diff --git a/external/corefx/src/System.Drawing.Common/tests/IconTests.cs b/external/corefx/src/System.Drawing.Common/tests/IconTests.cs index 6c72becdd0..cad6da5ce4 100644 --- a/external/corefx/src/System.Drawing.Common/tests/IconTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/IconTests.cs @@ -36,7 +36,7 @@ namespace System.Drawing.Tests { public class IconTests : RemoteExecutorTestBase { - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("48x48_multiple_entries_4bit.ico")] [InlineData("256x256_seven_entries_multiple_bits.ico")] public void Ctor_FilePath(string name) @@ -69,7 +69,8 @@ namespace System.Drawing.Tests yield return new object[] { "256x256_one_entry_32bit.ico", new Size(int.MaxValue, int.MaxValue), new Size(256, 256) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Size_TestData))] public void Ctor_FilePath_Width_Height(string fileName, Size size, Size expectedSize) { @@ -81,7 +82,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Size_TestData))] public void Ctor_FilePath_Size(string fileName, Size size, Size expectedSize) { @@ -93,7 +95,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullFilePath_ThrowsArgumentNullException() { AssertExtensions.Throws("path", () => new Icon((string)null)); @@ -101,7 +103,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws("path", () => new Icon((string)null, 32, 32)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Stream() { using (var stream = File.OpenRead(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -113,7 +115,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Size_TestData))] public void Ctor_Stream_Width_Height(string fileName, Size size, Size expectedSize) { @@ -126,7 +129,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Size_TestData))] public void Ctor_Stream_Size(string fileName, Size size, Size expectedSize) { @@ -139,7 +143,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullStream_ThrowsArgumentNullException() { AssertExtensions.Throws("stream", null, () => new Icon((Stream)null)); @@ -191,7 +195,8 @@ namespace System.Drawing.Tests yield return new object[] { new byte[] { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, typeof(Win32Exception) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_InvalidBytesInStream_TestData))] public void Ctor_InvalidBytesInStream_ThrowsException(byte[] bytes, Type exceptionType) { @@ -204,7 +209,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Size_TestData))] public void Ctor_Icon_Width_Height(string fileName, Size size, Size expectedSize) { @@ -218,7 +224,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Size_TestData))] public void Ctor_Icon_Size(string fileName, Size size, Size expectedSize) { @@ -232,14 +239,16 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullIcon_ThrowsArgumentNullException() { AssertExtensions.Throws("original", null, () => new Icon((Icon)null, 32, 32)); AssertExtensions.Throws("original", null, () => new Icon((Icon)null, new Size(32, 32))); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + // libgdiplus causes a segfault when given an invalid Icon handle. + [PlatformSpecific(TestPlatforms.Windows)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_InvalidHandle_Success() { using (Icon icon = Icon.FromHandle((IntPtr)1)) @@ -258,7 +267,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Type_Resource() { using (var icon = new Icon(typeof(IconTests), "48x48_multiple_entries_4bit.ico")) @@ -268,13 +277,13 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullType_ThrowsNullReferenceException() { Assert.Throws(() => new Icon(null, "48x48_multiple_entries_4bit.ico")); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(typeof(Icon), null)] [InlineData(typeof(Icon), "")] [InlineData(typeof(Icon), "48x48_multiple_entries_4bit.ico")] @@ -284,7 +293,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Icon(type, resource)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_ConstructedIcon_Success() { using (var icon = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -298,7 +307,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_IconFromHandle_Success() { using (var icon = Icon.FromHandle(SystemIcons.Hand.Handle)) @@ -312,16 +321,16 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_IconData_DestroysHandle() { var icon = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); icon.Dispose(); - Assert.Throws(() => icon.Handle); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_OwnsHandle_DestroysHandle() { Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); @@ -330,7 +339,7 @@ namespace System.Drawing.Tests Assert.Throws(() => icon.Handle); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_DoesNotOwnHandle_DoesNotDestroyHandle() { using (var source = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -344,7 +353,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(16)] [InlineData(32)] [InlineData(48)] @@ -365,7 +374,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ExtractAssociatedIcon_FilePath_Success() { using (Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -375,19 +384,21 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ExtractAssociatedIcon_NonFilePath_ReturnsNull() { Assert.Null(Icon.ExtractAssociatedIcon("http://microsoft.com")); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ExtractAssociatedIcon_NullFilePath_ThrowsArgumentNullException() { AssertExtensions.Throws("filePath", null, () => Icon.ExtractAssociatedIcon(null)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("", "path")] [InlineData("\\\\uncpath", null)] public void ExtractAssociatedIcon_InvalidFilePath_ThrowsArgumentException(string filePath, string paramName) @@ -395,13 +406,14 @@ namespace System.Drawing.Tests AssertExtensions.Throws(paramName, null, () => Icon.ExtractAssociatedIcon(filePath)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ExtractAssociatedIcon_NoSuchPath_ThrowsFileNotFoundException() { Assert.Throws(() => Icon.ExtractAssociatedIcon("no-such-file.png")); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("16x16_one_entry_4bit.ico")] [InlineData("32x32_one_entry_4bit.ico")] [InlineData("48x48_one_entry_1bit.ico")] @@ -413,7 +425,7 @@ namespace System.Drawing.Tests SaveAndCompare(new Icon(Helpers.GetTestBitmapPath(fileName)), true); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_OutputStream_ProducesIdenticalBytes() { string filePath = Helpers.GetTestBitmapPath("256x256_seven_entries_multiple_bits.ico"); @@ -425,7 +437,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_HasIconDataAndDisposed_ProducesIdenticalBytes() { string filePath = Helpers.GetTestBitmapPath("256x256_seven_entries_multiple_bits.ico"); @@ -438,7 +450,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_NullOutputStreamIconData_ThrowsNullReferenceException() { using (var icon = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -447,7 +459,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_NullOutputStreamNoIconData_ThrowsArgumentNullException() { using (var source = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -459,7 +472,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_ClosedOutputStreamIconData_ThrowsException() { using (var icon = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -471,7 +485,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_ClosedOutputStreamNoIconData_DoesNothing() { using (var source = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"))) @@ -484,7 +499,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Save_NoIconDataOwnsHandleAndDisposed_ThrowsObjectDisposedException() { Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); @@ -505,7 +521,7 @@ namespace System.Drawing.Tests yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 0, 0) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ToBitmap_TestData))] public void ToBitmap_BitmapIcon_ReturnsExpected(Icon icon) { @@ -529,7 +545,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToBitmap_BitmapIconFromHandle_ReturnsExpected() { // Handle refers to an icon without any colour. This is not in ToBitmap_TestData as there is @@ -543,7 +559,8 @@ namespace System.Drawing.Tests private const string DontSupportPngFramesInIcons = "Switch.System.Drawing.DontSupportPngFramesInIcons"; - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToBitmap_PngIconSupportedInSwitches_Success() { void VerifyPng() @@ -580,7 +597,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToBitmap_PngIconNotSupportedInSwitches_ThrowsArgumentOutOfRangeException() { void VerifyPngNotSupported() @@ -631,7 +649,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHandle_IconHandleOneTime_Success() { using (var icon1 = new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) @@ -643,7 +661,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHandle_IconHandleMultipleTime_Success() { using (var icon1 = new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) @@ -663,7 +681,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHandle_BitmapHandleOneTime_Success() { IntPtr handle; @@ -679,7 +697,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHandle_BitmapHandleMultipleTime_Success() { IntPtr handle; @@ -701,13 +719,13 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FromHandle_Zero_ThrowsArgumentException() { AssertExtensions.Throws(null, () => Icon.FromHandle(IntPtr.Zero)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Size_GetWhenDisposed_ThrowsObjectDisposedException() { var icon = new Icon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); diff --git a/external/corefx/src/System.Drawing.Common/tests/ImageTests.cs b/external/corefx/src/System.Drawing.Common/tests/ImageTests.cs index 761d66e700..907803c03f 100644 --- a/external/corefx/src/System.Drawing.Common/tests/ImageTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/ImageTests.cs @@ -19,7 +19,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(InvalidBytes_TestData))] public void FromFile_InvalidBytes_ThrowsOutOfMemoryException(byte[] bytes) { @@ -30,6 +31,7 @@ namespace System.Drawing.Tests } } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void FromFile_NullFileName_ThrowsArgumentNullException() { @@ -37,6 +39,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws("path", () => Image.FromFile(null, useEmbeddedColorManagement: true)); } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void FromFile_EmptyFileName_ThrowsArgumentNullException() { @@ -44,6 +47,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws("path", null, () => Image.FromFile(string.Empty, useEmbeddedColorManagement: true)); } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void FromFile_LongSegment_ThrowsException() { @@ -73,7 +77,8 @@ namespace System.Drawing.Tests Assert.Throws(() => Image.FromFile("NoSuchFile", useEmbeddedColorManagement: true)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(InvalidBytes_TestData))] public void FromStream_InvalidBytes_ThrowsArgumentException(byte[] bytes) { diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/BitmapDataTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/BitmapDataTests.cs index 2d1638e704..8ac78e44ea 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/BitmapDataTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/BitmapDataTests.cs @@ -9,7 +9,7 @@ namespace System.Drawing.Imaging.Tests { public class BitmapDataTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { BitmapData bd = new BitmapData(); @@ -21,7 +21,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal((PixelFormat)0, bd.PixelFormat); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] @@ -32,7 +32,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(value, bd.Height); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] @@ -43,7 +43,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(value, bd.Width); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] @@ -54,7 +54,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(value, bd.Reserved); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] @@ -65,7 +65,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(new IntPtr(value), bd.Scan0); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] @@ -76,7 +76,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(value, bd.Stride); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PixelFormat.DontCare)] [InlineData(PixelFormat.Max)] [InlineData(PixelFormat.Indexed)] @@ -106,11 +106,12 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(pixelFormat, bd.PixelFormat); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void PixelFormat_SetInvalid_ThrowsInvalidEnumException() { BitmapData bd = new BitmapData(); - Assert.Throws(() => bd.PixelFormat = (PixelFormat)(-1)); + Assert.ThrowsAny(() => bd.PixelFormat = (PixelFormat)(-1)); } } } diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMapTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMapTests.cs index 81123e983a..e16498f58e 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMapTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMapTests.cs @@ -8,7 +8,7 @@ namespace System.Drawing.Imaging.Tests { public class ColorMapTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { ColorMap cm = new ColorMap(); @@ -16,7 +16,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(new Color(), cm.NewColor); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void NewColor_SetValid_ReturnsExpected() { ColorMap cm = new ColorMap(); @@ -24,7 +24,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(Color.AliceBlue, cm.NewColor); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void OldColor_SetValid_ReturnsExpected() { ColorMap cm = new ColorMap(); diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMatrixTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMatrixTests.cs index bf59f0898e..f88a063c04 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMatrixTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/ColorMatrixTests.cs @@ -34,7 +34,7 @@ namespace System.Drawing.Imaging.Tests { public class ColorMatrixTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { ColorMatrix cm = new ColorMatrix(); @@ -98,14 +98,14 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(BadCtorParams))] public void Ctor_BadValues_ThrowsExpectedException(float[][] newColorMatrix, Type expectedException) { Assert.Throws(expectedException, () => new ColorMatrix(newColorMatrix)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_TooBigArraySize_MapOnly4and4Elements() { ColorMatrix cm = new ColorMatrix(new float[][] { @@ -144,7 +144,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(4.4f, cm.Matrix44); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AccessToNotExistingElement_ThrowsIndexOutOfRangeException() { ColorMatrix cm = new ColorMatrix(new float[][] { @@ -158,7 +158,7 @@ namespace System.Drawing.Imaging.Tests Assert.Throws(() => { var x = cm[5, 5]; }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_SetValue_ReturnsExpected() { ColorMatrix cm = new ColorMatrix(IndexedColorMatrix); @@ -202,7 +202,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MatrixElement_SetValues_ReturnsExpected() { ColorMatrix cm = new ColorMatrix(); @@ -260,7 +260,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(25, cm.Matrix44); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MatrixElementByIndexer_SetValue_ReturnsExpetecd() { ColorMatrix cm = new ColorMatrix(IndexedColorMatrix); diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParameterTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParameterTests.cs index e8cf6422d5..368a06b312 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParameterTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParameterTests.cs @@ -39,7 +39,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Encoder_Byte_TestData))] public void Ctor_Encoder_Byte(Encoder encoder, byte value) { @@ -47,7 +47,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, encoder, EncoderParameterValueType.ValueTypeByte, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(false, EncoderParameterValueType.ValueTypeByte)] [InlineData(true, EncoderParameterValueType.ValueTypeUndefined)] public void Ctor_Encoder_ByteValue_Bool(bool undefined, EncoderParameterValueType expected) @@ -56,7 +56,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, expected, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(short.MinValue)] [InlineData(short.MaxValue)] @@ -66,7 +66,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeShort, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(long.MinValue)] [InlineData(long.MaxValue)] @@ -76,7 +76,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLong, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue, int.MaxValue)] [InlineData(10, 5)] [InlineData(-10, -5)] @@ -86,7 +86,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRational, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 0, 0, 0)] [InlineData(1, 2, 3, 4)] public void Ctor_Encoder_Numerator1_Denominator1_Numerator2_Denominator2(int numerator1, int denominator1, int numerator2, int denominator2) @@ -95,7 +95,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRationalRange, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, 0)] [InlineData(1, 2)] public void Ctor_Encoder_RangeBegin_RangeEnd(long rangeBegin, long rangeEnd) @@ -104,7 +104,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLongRange, 1); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("someStringValue")] [InlineData("")] public void Ctor_Encoder_String(string value) @@ -113,7 +113,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeAscii, value.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new byte[] { })] [InlineData(new byte[] { 0, 1, 2, 3 })] public void Ctor_Encoder_ByteArray(byte[] value) @@ -122,7 +122,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeByte, value.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new byte[] { 1, 2 }, false, EncoderParameterValueType.ValueTypeByte)] [InlineData(new byte[] { 1, 2 }, true, EncoderParameterValueType.ValueTypeUndefined)] public void Ctor_Encoder_ByteArray_Bool(byte[] value, bool undefined, EncoderParameterValueType expected) @@ -131,7 +131,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, expected, value.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new short[] { })] [InlineData(new short[] { 0, 1, 2, 3 })] public void Ctor_Encoder_ShortArray(short[] value) @@ -140,7 +140,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeShort, value.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new long[] { })] [InlineData(new long[] { 0, 1, 2, 3 })] public void Ctor_Encoder_LongArray(long[] value) @@ -149,7 +149,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLong, value.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new int[] { 0, 1, 2, 3 }, new int[] { 5, 6, 7, 8 })] public void Ctor_Encoder_NumeratorArray_DenominatorArray(int[] numerator, int[] denominator) { @@ -157,7 +157,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRational, numerator.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new long[] { 0, 1, 2, 3 }, new long[] { 5, 6, 7, 8 })] public void Ctor_Encoder_RangeBeginArray_RangeEndArray(long[] rangeBegin, long[] rangeEnd) { @@ -165,7 +165,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLongRange, rangeBegin.Length); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new int[] { 0, 1, 2, 3 }, new int[] { 4, 5, 6, 7 }, new int[] { 8, 9, 10, 11 }, new int[] { 12, 13, 14, 15 })] public void Ctor_Encoder_Numerator1Array_Denominator1Array_Numerator2Array_Denominator2Array(int[] numerator1, int[] denominator1, int[] numerator2, int[] denominator2) { @@ -189,7 +189,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Encoder_NumberOfValues_TestData))] public void Ctor_Encoder_NumberOfValues_Type_Value(int numberOfValues, EncoderParameterValueType type, IntPtr value) { @@ -197,7 +197,7 @@ namespace System.Drawing.Imaging.Tests CheckEncoderParameter(ep, s_anyEncoder, type, numberOfValues); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Encoder_ReturnsExpecetd() { Encoder encoder = new Encoder(Guid.NewGuid()); @@ -207,13 +207,13 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(encoder.Guid, ep.Encoder.Guid); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Encoder_NumberOfValues_NotExistingType_ThrowsInvalidOperationException() { Assert.Throws(() => new EncoderParameter(s_anyEncoder, 1, (EncoderParameterValueType)999, IntPtr.Zero)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new int[] { 1, 2 }, new int[] { 1 }, new int[] { 1 }, new int[] { 1 }, typeof(ArgumentException))] [InlineData(new int[] { 1 }, new int[] { 1, 2 }, new int[] { 1 }, new int[] { 1 }, typeof(ArgumentException))] [InlineData(null, new int[] { 1 }, new int[] { 1 }, new int[] { 1 }, typeof(NullReferenceException))] @@ -225,14 +225,14 @@ namespace System.Drawing.Imaging.Tests Assert.Throws(expected, () => new EncoderParameter(s_anyEncoder, numerator1, denominator1, numerator2, denominator2)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Encoder_Null_ThrowsNullReferenceException() { EncoderParameter ep = new EncoderParameter(s_anyEncoder, 0); Assert.Throws(() => ep.Encoder = null); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new int[] { 0 }, new int[] { 0, 1 }, typeof(ArgumentException))] [InlineData(new int[] { 0, 1 }, new int[] { 0 }, typeof(ArgumentException))] [InlineData(new int[] { 0, 1 }, null, typeof(NullReferenceException))] @@ -242,7 +242,7 @@ namespace System.Drawing.Imaging.Tests Assert.Throws(expected, () => new EncoderParameter(s_anyEncoder, numerator, denominator)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new long[] { 0 }, new long[] { 0, 1 }, typeof(ArgumentException))] [InlineData(new long[] { 0, 1 }, new long[] { 0 }, typeof(ArgumentException))] [InlineData(new long[] { 0, 1 }, null, typeof(NullReferenceException))] @@ -252,13 +252,13 @@ namespace System.Drawing.Imaging.Tests Assert.Throws(expected, () => new EncoderParameter(s_anyEncoder, rangeBegin, rangeEnd)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Encoder_NullString_ThrowsNullReferenceException() { Assert.Throws(() => new EncoderParameter(s_anyEncoder, (string)null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Encoder_ByteArray_ThrowsNullReferenceException() { Assert.Throws(() => new EncoderParameter(s_anyEncoder, (byte[])null)); @@ -284,7 +284,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullEncoder_ThrowsNullReferenceException() { Assert.Throws(() => new EncoderParameter(null, (byte)0)); @@ -302,7 +302,7 @@ namespace System.Drawing.Imaging.Tests Assert.Throws(() => new EncoderParameter(null, new long[] { }, new long[] { })); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(EncoderParameterValueType.ValueTypeShort, (int.MaxValue / 2) + 1, typeof(OverflowException))] [InlineData(EncoderParameterValueType.ValueTypeLong, (int.MaxValue / 4) + 1, typeof(OverflowException))] [InlineData(EncoderParameterValueType.ValueTypeRational, (int.MaxValue / 8) + 1, typeof(OverflowException))] @@ -313,7 +313,7 @@ namespace System.Drawing.Imaging.Tests Assert.Throws(expected, () => new EncoderParameter(s_anyEncoder, numberOfValues, type, IntPtr.Zero)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(int.MinValue)] public void Ctor_Encoder_NegativeNumberOfValues_Type_Value_OutOfMemoryException(int numberOfValues) diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParametersTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParametersTests.cs index c9c8d7d747..1da3fbd779 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParametersTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderParametersTests.cs @@ -9,7 +9,7 @@ namespace System.Drawing.Imaging.Tests { public class EncoderParametersTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { EncoderParameters ep = new EncoderParameters(); @@ -17,7 +17,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(new EncoderParameter[1], ep.Param); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(1)] public void Ctor_Count_Default(int count) { @@ -36,7 +36,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Param_TestData))] public void Param_Success(EncoderParameter[] param) { @@ -45,7 +45,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(param, ep.Param); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Param_TestData))] public void Dispose_Success(EncoderParameter[] param) { diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderTests.cs index c027fc25dc..d170630565 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/EncoderTests.cs @@ -9,7 +9,7 @@ namespace System.Drawing.Imaging.Tests { public class EncoderTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Guid() { Guid guid = Guid.NewGuid(); @@ -34,7 +34,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(EncoderTestData))] public void DefinedEncoders_ReturnsExpected(Guid defined, Guid expected) { diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/FrameDimensionTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/FrameDimensionTests.cs index f62a784160..903f180785 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/FrameDimensionTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/FrameDimensionTests.cs @@ -9,7 +9,7 @@ namespace System.Drawing.Imaging.Tests { public class FrameDimensionTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Guid() { Guid guid = Guid.NewGuid(); @@ -50,28 +50,28 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ImageFormatGuidTestData))] public void Guid_ReturnsExpected(Guid expected, FrameDimension frameDimension) { Assert.Equal(expected, frameDimension.Guid); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(FrameDimensionEqualsTestData))] public void Equals_Object_ReturnsExpected(FrameDimension frameDimension, object obj, bool result) { Assert.Equal(result, frameDimension.Equals(obj)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHashCode_Success() { Guid guid = Guid.NewGuid(); Assert.Equal(guid.GetHashCode(), new FrameDimension(guid).GetHashCode()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(FrameDimensionToStringTestData))] public void ToString_ReturnsExpected(string expected, FrameDimension imageFormat) { diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs new file mode 100644 index 0000000000..76fd78966b --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs @@ -0,0 +1,1523 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005-2006 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.Collections.Generic; +using System.Drawing.Drawing2D; +using System.Drawing.Tests; +using System.IO; +using Xunit; + +namespace System.Drawing.Imaging.Tests +{ + public class ImageAttributesTests + { + private readonly Rectangle _rectangle = new Rectangle(0, 0, 64, 64); + private readonly Color _actualYellow = Color.FromArgb(255, 255, 255, 0); + private readonly Color _actualGreen = Color.FromArgb(255, 0, 255, 0); + private readonly Color _expectedRed = Color.FromArgb(255, 255, 0, 0); + private readonly Color _expectedBlack = Color.FromArgb(255, 0, 0, 0); + private readonly ColorMatrix _greenComponentToZeroColorMatrix = new ColorMatrix(new float[][] + { + new float[] {1, 0, 0, 0, 0}, + new float[] {0, 0, 0, 0, 0}, + new float[] {0, 0, 1, 0, 0}, + new float[] {0, 0, 0, 1, 0}, + new float[] {0, 0, 0, 0, 0}, + }); + + private readonly ColorMatrix _grayMatrix = new ColorMatrix(new float[][] { + new float[] {1, 0, 0, 0, 0}, + new float[] {0, 2, 0, 0, 0}, + new float[] {0, 0, 3, 0, 0}, + new float[] {0, 0, 0, 1, 0}, + new float[] {0, 0, 0, 0, 0}, + }); + + private readonly ColorMap[] _yellowToRedColorMap = new ColorMap[] + { + new ColorMap() { OldColor = Color.FromArgb(255, 255, 255, 0), NewColor = Color.FromArgb(255, 255, 0, 0) } + }; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_Default_Success() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] // Causes a crash on libgdiplus. + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Clone_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix); + + using (ImageAttributes clone = Assert.IsAssignableFrom(imageAttr.Clone())) + { + bitmap.SetPixel(0, 0, _actualYellow); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, clone); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Clone_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.Clone()); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrix_ColorMatrix_Success() + { + using (var brush = new SolidBrush(_actualGreen)) + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix); + bitmap.SetPixel(0, 0, _actualYellow); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + + graphics.FillRectangle(brush, _rectangle); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedBlack, bitmap.GetPixel(0, 0)); + } + } + + public static IEnumerable ColorMatrix_DropShadowRepaintWhenAreaIsSmallerThanTheFilteredElement_TestData() + { + yield return new object[] { Color.FromArgb(100, 255, 0, 0) }; + yield return new object[] { Color.FromArgb(255, 255, 155, 155) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorMatrix_DropShadowRepaintWhenAreaIsSmallerThanTheFilteredElement_TestData))] + public void SetColorMatrix_ColorMatrixI_Success(Color color) + { + ColorMatrix colorMatrix = new ColorMatrix(new float[][] + { + new float[] {1, 0, 0, 0, 0}, + new float[] {0, 1, 0, 0, 0}, + new float[] {0, 0, 1, 0, 0}, + new float[] {0, 0, 0, 0.5f, 0}, + new float[] {0, 0, 0, 0, 1}, + }); + + using (var brush = new SolidBrush(color)) + using (var bitmapBig = new Bitmap(200, 100)) + using (var bitmapSmall = new Bitmap(100, 100)) + using (var graphicsSmallBitmap = Graphics.FromImage(bitmapSmall)) + using (var graphicsBigBitmap = Graphics.FromImage(bitmapBig)) + using (var imageAttr = new ImageAttributes()) + { + graphicsSmallBitmap.FillRectangle(Brushes.White, 0, 0, 100, 100); + graphicsSmallBitmap.FillEllipse(brush, 0, 0, 100, 100); + graphicsBigBitmap.FillRectangle(Brushes.White, 0, 0, 200, 100); + imageAttr.SetColorMatrix(colorMatrix); + graphicsBigBitmap.DrawImage(bitmapSmall, new Rectangle(0, 0, 100, 100), 0, 0, 100, 100, GraphicsUnit.Pixel, null); + graphicsBigBitmap.DrawImage(bitmapSmall, new Rectangle(100, 0, 100, 100), 0, 0, 100, 100, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 255, 155, 155), bitmapBig.GetPixel(50, 50)); + Assert.Equal(Color.FromArgb(255, 255, 205, 205), bitmapBig.GetPixel(150, 50)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrix_ColorMatrixFlags_Success() + { + var grayShade = Color.FromArgb(255, 100, 100, 100); + + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + bitmap.SetPixel(0, 0, _actualYellow); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + + bitmap.SetPixel(0, 0, grayShade); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.SkipGrays); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(grayShade, bitmap.GetPixel(0, 0)); + } + } + + public static IEnumerable ColorAdjustType_TestData() + { + yield return new object[] { ColorAdjustType.Default }; + yield return new object[] { ColorAdjustType.Bitmap }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_TestData))] + public void SetColorMatrix_ColorMatrixDefaultFlagType_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var brush = new SolidBrush(_actualYellow)) + using (var pen = new Pen(brush)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedBlack, bitmap.GetPixel(0, 0)); + + graphics.FillRectangle(brush, _rectangle); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + + graphics.DrawRectangle(pen, _rectangle); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + } + } + + public static IEnumerable ColorAdjustTypeI_TestData() + { + yield return new object[] { ColorAdjustType.Brush }; + yield return new object[] { ColorAdjustType.Pen }; + yield return new object[] { ColorAdjustType.Text }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustTypeI_TestData))] + public void SetColorMatrix_ColorMatrixDefaultFlagTypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var brush = new SolidBrush(_actualYellow)) + using (var pen = new Pen(brush)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualGreen, bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrix_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix)); + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default)); + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrix_NullMatrix_ThrowsArgumentException() + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(null)); + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(null, ColorMatrixFlag.Default)); + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrix(null, ColorMatrixFlag.Default, ColorAdjustType.Default)); + } + } + + public static IEnumerable ColorAdjustType_InvalidTypes_TestData() + { + yield return new object[] { (ColorAdjustType.Default - 1) }; + yield return new object[] { ColorAdjustType.Count }; + yield return new object[] { ColorAdjustType.Any }; + yield return new object[] { (ColorAdjustType.Any + 1) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetColorMatrix_InvalidTypes_ThrowsInvalidEnumArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type)); + } + } + + public static IEnumerable ColorMatrixFlag_InvalidFlags_TestData() + { + yield return new object[] { (ColorMatrixFlag.Default - 1) }; + yield return new object[] { ColorMatrixFlag.AltGrays }; + yield return new object[] { (ColorMatrixFlag.AltGrays + 1) }; + yield return new object[] { (ColorMatrixFlag)int.MinValue }; + yield return new object[] { (ColorMatrixFlag)int.MaxValue }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetColorMatrix_InvalidFlags_ThrowsArgumentException(ColorMatrixFlag flag) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, flag)); + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, flag, ColorAdjustType.Default)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearColorMatrix_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix); + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix); + imageAttr.ClearColorMatrix(); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualGreen, bitmap.GetPixel(0, 0)); + } + } + + public static IEnumerable ColorAdjustType_AllTypesAllowed_TestData() + { + yield return new object[] { ColorAdjustType.Default }; + yield return new object[] { ColorAdjustType.Bitmap }; + yield return new object[] { ColorAdjustType.Brush }; + yield return new object[] { ColorAdjustType.Pen }; + yield return new object[] { ColorAdjustType.Text }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearColorMatrix_DefaultFlagType_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var brush = new SolidBrush(_actualYellow)) + using (var pen = new Pen(brush)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type); + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, ColorMatrixFlag.Default, type); + imageAttr.ClearColorMatrix(type); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualGreen, bitmap.GetPixel(0, 0)); + + graphics.FillRectangle(brush, _rectangle); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualYellow, bitmap.GetPixel(0, 0)); + + graphics.DrawRectangle(pen, _rectangle); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualYellow, bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearColorMatrix_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearColorMatrix()); + AssertExtensions.Throws(null, () => imageAttr.ClearColorMatrix(ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearColorMatrix_InvalidTypes_ThrowsInvalidEnumArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearColorMatrix(type)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrices_ColorMatrixGrayMatrix_Success() + { + using (var brush = new SolidBrush(_actualGreen)) + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix); + bitmap.SetPixel(0, 0, _actualYellow); + bitmap.SetPixel(1, 1, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + Assert.Equal(Color.FromArgb(255, 100, 0, 100), bitmap.GetPixel(1, 1)); + } + } + + public static IEnumerable SetColorMatrices_Flags_TestData() + { + yield return new object[] { ColorMatrixFlag.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 0, 100) }; + yield return new object[] { ColorMatrixFlag.SkipGrays, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.AltGrays, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 200, 255) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetColorMatrices_Flags_TestData))] + public void SetColorMatrices_ColorMatrixGrayMatrixFlags_Success(ColorMatrixFlag flag, Color grayShade, Color expecedGrayShade) + { + using (var brush = new SolidBrush(_actualGreen)) + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, flag); + bitmap.SetPixel(0, 0, _actualYellow); + bitmap.SetPixel(1, 1, grayShade); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + Assert.Equal(expecedGrayShade, bitmap.GetPixel(1, 1)); + } + } + + public static IEnumerable SetColorMatrices_FlagsTypes_TestData() + { + yield return new object[] { ColorMatrixFlag.Default, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 0, 100) }; + yield return new object[] { ColorMatrixFlag.SkipGrays, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.AltGrays, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 200, 255) }; + yield return new object[] { ColorMatrixFlag.Default, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 0, 100) }; + yield return new object[] { ColorMatrixFlag.SkipGrays, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.AltGrays, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 100, 200, 255) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetColorMatrices_FlagsTypes_TestData))] + public void SetColorMatrices_ColorMatrixGrayMatrixFlagsTypes_Success + (ColorMatrixFlag flag, ColorAdjustType type, Color grayShade, Color expecedGrayShade) + { + using (var brush = new SolidBrush(_actualGreen)) + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, flag, type); + bitmap.SetPixel(0, 0, _actualYellow); + bitmap.SetPixel(1, 1, grayShade); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedRed, bitmap.GetPixel(0, 0)); + Assert.Equal(expecedGrayShade, bitmap.GetPixel(1, 1)); + } + } + + public static IEnumerable SetColorMatrices_FlagsTypesI_TestData() + { + yield return new object[] { ColorMatrixFlag.Default, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.SkipGrays, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.AltGrays, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.Default, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.SkipGrays, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.AltGrays, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.Default, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.SkipGrays, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorMatrixFlag.AltGrays, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetColorMatrices_FlagsTypesI_TestData))] + public void SetColorMatrices_ColorMatrixGrayMatrixFlagsTypesI_Success(ColorMatrixFlag flag, ColorAdjustType type, Color grayShade) + { + using (var brush = new SolidBrush(_actualGreen)) + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, flag, type); + bitmap.SetPixel(0, 0, _actualYellow); + bitmap.SetPixel(1, 1, grayShade); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualYellow, bitmap.GetPixel(0, 0)); + Assert.Equal(grayShade, bitmap.GetPixel(1, 1)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrices_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix)); + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, ColorMatrixFlag.Default)); + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorMatrices_NullMatrices_ThrowsArgumentException() + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrices(null, _grayMatrix)); + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrices(null, _grayMatrix, ColorMatrixFlag.Default)); + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, null, ColorMatrixFlag.AltGrays)); + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrices(null, _grayMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default)); + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, null, ColorMatrixFlag.AltGrays, ColorAdjustType.Default)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetColorMatrices_InvalidTypes_ThrowsInvalidEnumArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, ColorMatrixFlag.Default, type)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(ColorMatrixFlag.Default - 1)] + [InlineData(ColorMatrixFlag.AltGrays + 1)] + [InlineData((ColorMatrixFlag)int.MinValue)] + [InlineData((ColorMatrixFlag)int.MaxValue)] + public void SetColorMatrices_InvalidFlags_ThrowsArgumentException(ColorMatrixFlag flag) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, flag)); + AssertExtensions.Throws(null, () => + imageAttr.SetColorMatrices(_greenComponentToZeroColorMatrix, _grayMatrix, flag, ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetThreshold_Threshold_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetThreshold(0.7f); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 230, 50, 220)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 255, 0, 255), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_TestData))] + public void SetThreshold_ThresholdType_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetThreshold(0.7f, type); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 230, 50, 220)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 255, 0, 255), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [MemberData(nameof(ColorAdjustTypeI_TestData))] + public void SetThreshold_ThresholdTypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetThreshold(0.7f, type); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 230, 50, 220)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 230, 50, 220), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetThreshold_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetThreshold(0.5f)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetThreshold_InvalidType_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetThreshold(0.5f, type)); + } + } + + public void ClearThreshold_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetThreshold(0.7f); + imageAttr.ClearThreshold(); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 230, 50, 220)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 230, 50, 220), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearThreshold_ThresholdTypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetThreshold(0.7f, type); + imageAttr.ClearThreshold(type); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 230, 50, 220)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 230, 50, 220), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearThreshold_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearThreshold(ColorAdjustType.Default)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearThreshold_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearThreshold(type)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetGamma_Gamma_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 33, 255, 0), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_TestData))] + public void SetGamma_GammaType_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f, type); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 33, 255, 0), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustTypeI_TestData))] + public void SetGamma_GammaTypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f, type); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 255, 0), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetGamma_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetGamma(2.2f)); + AssertExtensions.Throws(null, () => imageAttr.SetGamma(2.2f, ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetGamma_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetGamma(2.2f, type)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearGamma_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f, type); + imageAttr.ClearGamma(type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 255, 0), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearGamma_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearGamma(ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearGamma_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearGamma(type)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetNoOp_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix); + imageAttr.SetNoOp(); + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualGreen, bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void SetNoOp_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f, type); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type); + imageAttr.SetNoOp(type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 255, 0), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetNoOp_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetNoOp()); + AssertExtensions.Throws(null, () => imageAttr.SetNoOp(ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetNoOp_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetNoOp(type)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearNoOp_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix); + imageAttr.SetNoOp(); + imageAttr.ClearNoOp(); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_expectedBlack, bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_TestData))] + public void ClearNoOp_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f, type); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type); + imageAttr.SetNoOp(type); + imageAttr.ClearNoOp(type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 33, 0, 0), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustTypeI_TestData))] + public void ClearNoOp_TypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetGamma(2.2f, type); + imageAttr.SetColorMatrix(_greenComponentToZeroColorMatrix, ColorMatrixFlag.Default, type); + imageAttr.SetNoOp(type); + imageAttr.ClearNoOp(type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 255, 0)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 255, 0), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearNoOp_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearNoOp()); + AssertExtensions.Throws(null, () => imageAttr.ClearNoOp(ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearNoOp_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearNoOp(type)); + } + } + + [ActiveIssue(22309)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorKey_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150)); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(0, 0, 0, 0), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(22309)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_TestData))] + public void SetColorKey_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150), type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(0, 0, 0, 0), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustTypeI_TestData))] + public void SetColorKey_TypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150), type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 100, 100), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetColorKey_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150))); + AssertExtensions.Throws(null, () => + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150), ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetColorKey_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150), type)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearColorKey_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150)); + imageAttr.ClearColorKey(); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 100, 100), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearColorKey_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetColorKey(Color.FromArgb(50, 50, 50), Color.FromArgb(150, 150, 150), type); + imageAttr.ClearColorKey(type); + + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 100, 100), bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearColorKey_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearColorKey()); + AssertExtensions.Throws(null, () => imageAttr.ClearColorKey(ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearColorKey_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearColorKey(type)); + } + } + + public static IEnumerable SetOutputChannel_ColorChannelFlag_TestData() + { + yield return new object[] { ColorChannelFlag.ColorChannelC, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 198, 198, 198) }; + yield return new object[] { ColorChannelFlag.ColorChannelK, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 108, 108, 108) }; + yield return new object[] { ColorChannelFlag.ColorChannelM, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 204, 204, 204) }; + yield return new object[] { ColorChannelFlag.ColorChannelY, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 207, 207, 207) }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetOutputChannel_ColorChannelFlag_TestData))] + public void SetOutputChannel_Flag_Success(ColorChannelFlag flag, Color actualColor, Color expectedColor) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(flag); + + bitmap.SetPixel(0, 0, actualColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(expectedColor, bitmap.GetPixel(0, 0)); + } + } + + public static IEnumerable SetOutputChannel_ColorChannelFlagType_TestData() + { + yield return new object[] { ColorChannelFlag.ColorChannelC, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 198, 198, 198) }; + yield return new object[] { ColorChannelFlag.ColorChannelK, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 108, 108, 108) }; + yield return new object[] { ColorChannelFlag.ColorChannelM, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 204, 204, 204) }; + yield return new object[] { ColorChannelFlag.ColorChannelY, ColorAdjustType.Default, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 207, 207, 207) }; + yield return new object[] { ColorChannelFlag.ColorChannelC, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 198, 198, 198) }; + yield return new object[] { ColorChannelFlag.ColorChannelK, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 108, 108, 108) }; + yield return new object[] { ColorChannelFlag.ColorChannelM, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 204, 204, 204) }; + yield return new object[] { ColorChannelFlag.ColorChannelY, ColorAdjustType.Bitmap, Color.FromArgb(255, 100, 100, 100), Color.FromArgb(255, 207, 207, 207) }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetOutputChannel_ColorChannelFlagType_TestData))] + public void SetOutputChannel_FlagType_Success(ColorChannelFlag flag, ColorAdjustType type, Color actualColor, Color expectedColor) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(flag, type); + + bitmap.SetPixel(0, 0, actualColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(expectedColor, bitmap.GetPixel(0, 0)); + } + } + + public static IEnumerable SetOutputChannel_ColorChannelFlagTypeI_TestData() + { + yield return new object[] { ColorChannelFlag.ColorChannelC, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelK, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelM, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelY, ColorAdjustType.Brush, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelC, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelK, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelM, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelY, ColorAdjustType.Pen, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelC, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelK, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelM, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + yield return new object[] { ColorChannelFlag.ColorChannelY, ColorAdjustType.Text, Color.FromArgb(255, 100, 100, 100) }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetOutputChannel_ColorChannelFlagTypeI_TestData))] + public void SetOutputChannel_FlagTypeI_Success(ColorChannelFlag flag, ColorAdjustType type, Color color) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(flag, type); + + bitmap.SetPixel(0, 0, color); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(color, bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannel_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelY)); + AssertExtensions.Throws(null, () => imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelY, ColorAdjustType.Default)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetOutputChannel_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelY, type)); + } + } + + public static IEnumerable SetOutputChannel_InvalidColorChannelFlags_TestData() + { + yield return new object[] { (ColorChannelFlag)int.MinValue }; + yield return new object[] { ColorChannelFlag.ColorChannelC - 1 }; + yield return new object[] { ColorChannelFlag.ColorChannelLast }; + yield return new object[] { ColorChannelFlag.ColorChannelLast + 1 }; + yield return new object[] { (ColorChannelFlag)int.MaxValue }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SetOutputChannel_InvalidColorChannelFlags_TestData))] + public void SetOutputChannel_InvalidFlags_ThrowsArgumentException(ColorChannelFlag flag) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetOutputChannel(flag)); + AssertExtensions.Throws(null, () => imageAttr.SetOutputChannel(flag, ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearOutputChannel_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelC); + imageAttr.ClearOutputChannel(); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualGreen, bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearOutputChannel_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelC, type); + imageAttr.ClearOutputChannel(type); + + bitmap.SetPixel(0, 0, _actualGreen); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_actualGreen, bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearOutputChannel_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearOutputChannel()); + AssertExtensions.Throws(null, () => imageAttr.ClearOutputChannel(ColorAdjustType.Default)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearOutputChannel_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearOutputChannel(type)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannelColorProfile_Name_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelC); + imageAttr.SetOutputChannelColorProfile(Helpers.GetTestColorProfilePath("RSWOP.icm")); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 198, 198, 198), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannelColorProfile_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => + imageAttr.SetOutputChannelColorProfile(Helpers.GetTestColorProfilePath("RSWOP.icm"))); + AssertExtensions.Throws(null, () => + imageAttr.SetOutputChannelColorProfile(Helpers.GetTestColorProfilePath("RSWOP.icm"), ColorAdjustType.Default)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannelColorProfile_Null_ThrowsArgumentNullException() + { + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile(null)); + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile(null, ColorAdjustType.Default)); + } + } + + [ActiveIssue(22309)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannelColorProfile_InvalidPath_ThrowsArgumentException() + { + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile(string.Empty)); + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile(string.Empty, ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannelColorProfile_InvalidPath_ThrowsOutOfMemoryException() + { + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile("invalidPath")); + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile("invalidPath", ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetOutputChannelColorProfile_InvalidPath_ThrowsPathTooLongException() + { + string fileNameTooLong = new string('a', short.MaxValue); + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile(fileNameTooLong)); + Assert.Throws(() => imageAttr.SetOutputChannelColorProfile(fileNameTooLong, ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetOutputChannelColorProfile_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetOutputChannelColorProfile("path", type)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearOutputChannelColorProfile_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelC); + imageAttr.SetOutputChannelColorProfile(Helpers.GetTestColorProfilePath("RSWOP.icm")); + imageAttr.ClearOutputChannelColorProfile(); + imageAttr.ClearOutputChannel(); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 100, 100), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearOutputChannelColorProfile_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetOutputChannel(ColorChannelFlag.ColorChannelC, type); + imageAttr.SetOutputChannelColorProfile(Helpers.GetTestColorProfilePath("RSWOP.icm"), type); + imageAttr.ClearOutputChannelColorProfile(type); + imageAttr.ClearOutputChannel(type); + bitmap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100)); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(Color.FromArgb(255, 100, 100, 100), bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearOutputChannelColorProfile_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearOutputChannelColorProfile()); + AssertExtensions.Throws(null, () => imageAttr.ClearOutputChannelColorProfile(ColorAdjustType.Default)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearOutputChannelColorProfile_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearOutputChannelColorProfile(type)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetRemapTable_Map_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetRemapTable(_yellowToRedColorMap); + bitmap.SetPixel(0, 0, _yellowToRedColorMap[0].OldColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_yellowToRedColorMap[0].NewColor, bitmap.GetPixel(0, 0)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_TestData))] + public void SetRemapTable_MapType_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetRemapTable(_yellowToRedColorMap, type); + bitmap.SetPixel(0, 0, _yellowToRedColorMap[0].OldColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_yellowToRedColorMap[0].NewColor, bitmap.GetPixel(0, 0)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustTypeI_TestData))] + public void SetRemapTable_MapTypeI_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetRemapTable(_yellowToRedColorMap, type); + bitmap.SetPixel(0, 0, _yellowToRedColorMap[0].OldColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_yellowToRedColorMap[0].OldColor, bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetRemapTable_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetRemapTable(_yellowToRedColorMap)); + AssertExtensions.Throws(null, () => imageAttr.SetRemapTable(_yellowToRedColorMap, ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void SetRemapTable_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetRemapTable(_yellowToRedColorMap, type)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetRemapTable_NullMap_ThrowsNullReferenceException() + { + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.SetRemapTable(null, ColorAdjustType.Default)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetRemapTable_NullMapMeber_ThrowsNullReferenceException() + { + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.SetRemapTable(new ColorMap[1] { null }, ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetRemapTable_EmptyMap_ThrowsArgumentException() + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.SetRemapTable(new ColorMap[0], ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearRemapTable_Success() + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetRemapTable(_yellowToRedColorMap); + imageAttr.ClearRemapTable(); + bitmap.SetPixel(0, 0, _yellowToRedColorMap[0].OldColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_yellowToRedColorMap[0].OldColor, bitmap.GetPixel(0, 0)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_AllTypesAllowed_TestData))] + public void ClearRemapTable_Type_Success(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var graphics = Graphics.FromImage(bitmap)) + using (var imageAttr = new ImageAttributes()) + { + imageAttr.SetRemapTable(_yellowToRedColorMap, type); + imageAttr.ClearRemapTable(type); + bitmap.SetPixel(0, 0, _yellowToRedColorMap[0].OldColor); + graphics.DrawImage(bitmap, _rectangle, _rectangle.X, _rectangle.Y, _rectangle.Width, _rectangle.Height, GraphicsUnit.Pixel, imageAttr); + Assert.Equal(_yellowToRedColorMap[0].OldColor, bitmap.GetPixel(0, 0)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ClearRemapTable_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.ClearRemapTable()); + AssertExtensions.Throws(null, () => imageAttr.ClearRemapTable(ColorAdjustType.Default)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void ClearRemapTable_InvalidTypes_ThrowsArgumentException(ColorAdjustType type) + { + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.ClearRemapTable(type)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetWrapMode_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + AssertExtensions.Throws(null, () => imageAttr.SetWrapMode(WrapMode.Clamp)); + AssertExtensions.Throws(null, () => imageAttr.SetWrapMode(WrapMode.Clamp, Color.Black)); + AssertExtensions.Throws(null, () => imageAttr.SetWrapMode(WrapMode.Clamp, Color.Black, true)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetAdjustedPalette_Disposed_ThrowsArgumentException() + { + var imageAttr = new ImageAttributes(); + imageAttr.Dispose(); + + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + { + AssertExtensions.Throws(null, () => imageAttr.GetAdjustedPalette(bitmap.Palette, ColorAdjustType.Default)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetAdjustedPalette_NullPallete_ThrowsNullReferenceException() + { + using (var imageAttr = new ImageAttributes()) + { + Assert.Throws(() => imageAttr.GetAdjustedPalette(null, ColorAdjustType.Default)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(ColorAdjustType_InvalidTypes_TestData))] + public void GetAdjustedPalette_Disposed_ThrowsArgumentException(ColorAdjustType type) + { + using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) + using (var imageAttr = new ImageAttributes()) + { + AssertExtensions.Throws(null, () => imageAttr.GetAdjustedPalette(bitmap.Palette, type)); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageCodecInfoTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageCodecInfoTests.cs index dd3f8dce98..7778defbf6 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageCodecInfoTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageCodecInfoTests.cs @@ -160,7 +160,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(GIF_CSID)] [InlineData(EMF_CSID)] [InlineData(BMP_DIB_RLE_CSID)] @@ -174,7 +174,7 @@ namespace System.Drawing.Imaging.Tests Assert.NotNull(GetDecoder(csid)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(GIF_CSID)] [InlineData(BMP_DIB_RLE_CSID)] [InlineData(JPG_JPEG_JPE_JFIF_CSID)] @@ -185,19 +185,19 @@ namespace System.Drawing.Imaging.Tests Assert.NotNull(GetEncoder(csid)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CountEncoders_ReturnsExcpected() { Assert.Equal(5, encoders.Count); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CountDecoders_ReturnsExcpected() { Assert.Equal(8, decoders.Count); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(CodecInfoTestData))] public void CheckDecoderAndEncoder_ReturnsExpecetd(string clsid, ImageFormat format, string codecName, string dllName, string fileNameExtension, ImageCodecFlags flags, string formatDescription, @@ -206,7 +206,7 @@ namespace System.Drawing.Imaging.Tests CheckDecoderAndEncoder(clsid, format, codecName, dllName, fileNameExtension, flags, formatDescription, mimeType, version, signatureLength, mask, pattern, pattern2); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(WMF_CSID)] [InlineData(EMF_CSID)] [InlineData(ICO_CSID)] diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageFormatTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageFormatTests.cs index 43742a1133..a4d956929e 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageFormatTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/ImageFormatTests.cs @@ -68,28 +68,28 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ImageFormatGuidTestData))] public void Guid_ReturnsExpected(Guid expectedGuid, ImageFormat imageFormat) { Assert.Equal(expectedGuid, imageFormat.Guid); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ImageFormatToStringTestData))] public void ToString_ReturnsExpected(string expected, ImageFormat imageFormat) { Assert.Equal(expected, imageFormat.ToString()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ImageFormatEqualsTestData))] public void Equals_Object_ReturnsExpected(ImageFormat imageFormat, object obj, bool result) { Assert.Equal(result, imageFormat.Equals(obj)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetHashCode_Success() { Guid guid = Guid.NewGuid(); diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/MetaHeaderTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/MetaHeaderTests.cs index 417448021d..444ca826c8 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/MetaHeaderTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/MetaHeaderTests.cs @@ -8,7 +8,7 @@ namespace System.Drawing.Imaging.Tests { public class MetaHeaderTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { MetaHeader mh = new MetaHeader(); @@ -21,7 +21,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(0, mh.Version); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(short.MaxValue)] [InlineData(0)] [InlineData(short.MinValue)] @@ -40,7 +40,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(value, mh.Version); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/MetafileTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/MetafileTests.cs new file mode 100644 index 0000000000..443a4df835 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/MetafileTests.cs @@ -0,0 +1,1124 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005-2006 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.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using Xunit; + +namespace System.Drawing.Imaging.Tests +{ + public class MetafileTests + { + private const string WmfFile = "telescope_01.wmf"; + private const string BmpFile = "bitmap_173x183_indexed_8bit.bmp"; + private readonly Rectangle _rectangle = new Rectangle(0, 0, 64, 64); + private readonly RectangleF _rectangleF = new RectangleF(0, 0, 64, 64); + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrZero_ThrowsArgumentException() + { + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, false)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrToWmf_ThrowsExternalException() + { + using (var metafile = new Metafile(GetPath(WmfFile))) + { + Assert.Throws(() => new Metafile(metafile.GetHenhmetafile(), false)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_String_Success() + { + using (var metafile = new Metafile(GetPath(WmfFile))) + { + AssertMetafile(metafile); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_Bitmap_ThrowsExternalException() + { + Assert.Throws(() => new Metafile(GetPath(BmpFile))); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullString_ThrowsArgumentNullException() + { + AssertExtensions.Throws("path", () => new Metafile((string)null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_InvalidPath_ThrowsExternalException() + { + Assert.Throws(() => new Metafile("fileNotExist")); + } + + public static IEnumerable InvalidPath_TestData() + { + yield return new object[] { new string('a', 261) }; + yield return new object[] { @"fileNo*-//\\#@(found" }; + yield return new object[] { string.Empty }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(@"fileNo*-//\\#@(found")] + [InlineData("")] + public void Ctor_InvalidPath_ThrowsArgumentException(string path) + { + AssertExtensions.Throws("path", null, () => new Metafile(path)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_Stream_Success() + { + using (FileStream stream = File.OpenRead(GetPath(WmfFile))) + using (var metafile = new Metafile(stream)) + { + AssertMetafile(metafile); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullStream_ThrowsArgumentException() + { + AssertExtensions.Throws("stream", null, () => new Metafile((Stream)null)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_EmptyStream_ThrowsExternalException() + { + using (var stream = new MemoryStream()) + { + Assert.Throws(() => new Metafile(stream)); + } + } + + public static IEnumerable EmfType_TestData() + { + yield return new object[] { EmfType.EmfOnly }; + yield return new object[] { EmfType.EmfPlusDual }; + yield return new object[] { EmfType.EmfPlusOnly }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_IntPtrEmfType_Success(EmfType emfType) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + } + } + + public static IEnumerable EmfType_Invalid_TestData() + { + yield return new object[] { (EmfType.EmfOnly - 1) }; + yield return new object[] { (EmfType.EmfPlusDual + 1) }; + yield return new object[] { (EmfType)int.MaxValue }; + yield return new object[] { (EmfType)int.MinValue }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_Invalid_TestData))] + public void Ctor_IntPtrInvalidEmfType_ThrowsArgumentException(EmfType emfType) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + AssertExtensions.Throws(null, () => new Metafile(g.GetHdc(), emfType)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullEmfType_ThrowsArgumentException() + { + AssertExtensions.Throws(null, () => new Metafile((IntPtr)null, EmfType.EmfOnly)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_ZeroPointerEmfType_ThrowsArgumentException() + { + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, EmfType.EmfOnly)); + } + + public static IEnumerable Description_TestData() + { + yield return new object[] { null }; + yield return new object[] { "description" }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_IntPtrEmfTypeString_Success(string description) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(InvalidPath_TestData))] + public void Ctor_ZeroPointerEmfTypeInvalidString_ThrowsArgumentException(string description) + { + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, EmfType.EmfOnly, description)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrRectangleF_Success() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangleF)) + { + AssertMetafileIsBlank(metafile); + } + } + + public static IEnumerable MetafileFrameUnit_TestData() + { + yield return new object[] { MetafileFrameUnit.Pixel }; + yield return new object[] { MetafileFrameUnit.Point }; + yield return new object[] { MetafileFrameUnit.Inch }; + yield return new object[] { MetafileFrameUnit.Document }; + yield return new object[] { MetafileFrameUnit.Millimeter }; + yield return new object[] { MetafileFrameUnit.GdiCompatible }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_TestData))] + public void Ctor_IntPtrRectangleFMetafileFrameUnit_Success(MetafileFrameUnit frameUnit) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangleF, frameUnit)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_IntPtrRectangleFMetafileFrameUnitEmfType_Success(EmfType emfType) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangleF, MetafileFrameUnit.Pixel, emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_IntPtrRectangleFMetafileFrameUnitEmfTypeString_Success(string description) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangleF, MetafileFrameUnit.Pixel, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrRectangle_Success() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangle)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_TestData))] + public void Ctor_IntPtrRectangleMetafileFrameUnit_Success(MetafileFrameUnit frameUnit) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangle, frameUnit)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_IntPtrRectangleMetafileFrameUnitEmfType_Success(EmfType emfType) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangle, MetafileFrameUnit.Pixel, emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_IntPtrRectangleMetafileFrameUnitEmfTypeString_Success(string description) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(g.GetHdc(), _rectangle, MetafileFrameUnit.Pixel, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrZeroI_ThrowsArgumentException() + { + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, _rectangleF)); + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, _rectangleF, MetafileFrameUnit.Pixel)); + AssertExtensions.Throws(null, () => + new Metafile(IntPtr.Zero, _rectangleF, MetafileFrameUnit.Pixel, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(IntPtr.Zero, _rectangleF, MetafileFrameUnit.Pixel, EmfType.EmfOnly, "description")); + + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, _rectangle)); + AssertExtensions.Throws(null, () => new Metafile(IntPtr.Zero, _rectangle, MetafileFrameUnit.Pixel)); + AssertExtensions.Throws(null, () => + new Metafile(IntPtr.Zero, _rectangle, MetafileFrameUnit.Pixel, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(IntPtr.Zero, _rectangle, MetafileFrameUnit.Pixel, EmfType.EmfOnly, "description")); + } + + public static IEnumerable MetafileFrameUnit_Invalid_TestData() + { + yield return new object[] { (MetafileFrameUnit.Pixel - 1) }; + yield return new object[] { (MetafileFrameUnit.GdiCompatible + 1) }; + yield return new object[] { (MetafileFrameUnit)int.MaxValue }; + yield return new object[] { (MetafileFrameUnit)int.MinValue }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_Invalid_TestData))] + public void Ctor_InvalidMetafileFrameUnit_ThrowsArgumentException(MetafileFrameUnit farameUnit) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => new Metafile(referenceHdc, _rectangleF, farameUnit)); + AssertExtensions.Throws(null, () => new Metafile(referenceHdc, _rectangleF, farameUnit, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(referenceHdc, _rectangleF, farameUnit, EmfType.EmfOnly, "description")); + + AssertExtensions.Throws(null, () => new Metafile(referenceHdc, _rectangle, farameUnit)); + AssertExtensions.Throws(null, () => new Metafile(referenceHdc, _rectangle, farameUnit, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(referenceHdc, _rectangle, farameUnit, EmfType.EmfOnly, "description")); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_Invalid_TestData))] + public void Ctor_InvalidEmfType_ThrowsArgumentException(EmfType emfType) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => + new Metafile(referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, emfType)); + AssertExtensions.Throws(null, () => + new Metafile(referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, emfType, "description")); + + AssertExtensions.Throws(null, () => + new Metafile(referenceHdc, _rectangle, MetafileFrameUnit.GdiCompatible, emfType)); + AssertExtensions.Throws(null, () => + new Metafile(referenceHdc, _rectangle, MetafileFrameUnit.GdiCompatible, emfType, "description")); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_StringIntPtr_Success() + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc())) + { + AssertMetafileIsBlank(metafile); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_StringIntPtrEmfType_Success(EmfType emfType) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_StringIntPtrEmfType_Success(string description) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), EmfType.EmfPlusDual, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfPlusDual); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrZeroII_ThrowsArgumentException() + { + string fileName = GetPath("newTestImage.wmf"); + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero)); + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero, EmfType.EmfOnly, "description")); + DeleteFile(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_Invalid_TestData))] + public void Ctor_InvalidEmfTypeI_ThrowsArgumentException(EmfType emfType) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => new Metafile(fileName, referenceHdc, emfType)); + AssertExtensions.Throws(null, () => new Metafile(fileName, referenceHdc, emfType, "description")); + DeleteFile(fileName); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullPath_ThrowsArgumentNullException() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws("path", () => new Metafile((string)null, referenceHdc)); + AssertExtensions.Throws("path", () => new Metafile((string)null, referenceHdc, EmfType.EmfOnly)); + AssertExtensions.Throws("path", () => new Metafile((string)null, referenceHdc, EmfType.EmfOnly, "description")); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(@"fileNo*-//\\#@(found")] + [InlineData("")] + public void Ctor_InvalidPathI_ThrowsArgumentException(string fileName) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws("path", null, () => new Metafile(fileName, referenceHdc)); + AssertExtensions.Throws("path", null, () => new Metafile(fileName, referenceHdc, EmfType.EmfOnly)); + AssertExtensions.Throws("path", null, () => new Metafile(fileName, referenceHdc, EmfType.EmfOnly, "description")); + } + } + + // Long paths aren't that much of a problem on Unix. + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_PathTooLong_ThrowsPathTooLongException() + { + string fileName = GetPath(new string('a', short.MaxValue)); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + Assert.Throws(() => new Metafile(fileName, referenceHdc)); + Assert.Throws(() => new Metafile(fileName, referenceHdc, EmfType.EmfOnly)); + Assert.Throws(() => new Metafile(fileName, referenceHdc, EmfType.EmfOnly, "description")); + DeleteFile(fileName); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + public void Ctor_StringIntPtrRectangleF_Success() + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), _rectangleF)) + { + AssertMetafileIsBlank(metafile); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_TestData))] + public void Ctor_StringIntPtrRectangleFMetafileFrameUnit_Success(MetafileFrameUnit frameUnit) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), _rectangleF, frameUnit)) + { + AssertMetafileIsBlank(metafile); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_StringIntPtrRectangleFMetafileFrameUnitEmfType_Success(EmfType emfType) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), _rectangleF, MetafileFrameUnit.GdiCompatible, emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_StringIntPtrRectangleFMetafileFrameUnitEmfTypeString_Success(string description) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile( + fileName, g.GetHdc(), _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_RectangleFEmpty_Success(string description) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile( + fileName, g.GetHdc(), new RectangleF(), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + public void Ctor_StringIntPtrRectangle_Success() + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), _rectangle)) + { + AssertMetafileIsBlank(metafile); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_TestData))] + public void Ctor_StringIntPtrRectangleMetafileFrameUnit_Success(MetafileFrameUnit frameUnit) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), _rectangle, frameUnit)) + { + AssertMetafileIsBlank(metafile); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_StringIntPtrRectangleMetafileFrameUnitEmfType_Success(EmfType emfType) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile(fileName, g.GetHdc(), _rectangle, MetafileFrameUnit.GdiCompatible, emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_StringIntPtrRectangleMetafileFrameUnitEmfTypeString_Success(string description) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile( + fileName, g.GetHdc(), _rectangle, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_RectangleEmpty_Success(string description) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var metafile = new Metafile( + fileName, g.GetHdc(), new Rectangle(), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly); + Assert.True(File.Exists(fileName)); + } + + File.Delete(fileName); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrZeroIII_ThrowsArgumentException() + { + string fileName = GetPath("newTestImage.wmf"); + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero, _rectangleF)); + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero, _rectangleF, MetafileFrameUnit.GdiCompatible)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, IntPtr.Zero, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, IntPtr.Zero, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero, _rectangle)); + AssertExtensions.Throws(null, () => new Metafile(fileName, IntPtr.Zero, _rectangle, MetafileFrameUnit.GdiCompatible)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, IntPtr.Zero, _rectangle, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, IntPtr.Zero, _rectangle, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + DeleteFile(fileName); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_Invalid_TestData))] + public void Ctor_InvalidEmfTypeII_ThrowsArgumentException(MetafileFrameUnit frameUnit) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => new Metafile(fileName, referenceHdc, _rectangleF, frameUnit)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangleF, frameUnit, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangleF, frameUnit, EmfType.EmfOnly, "description")); + + AssertExtensions.Throws(null, () => new Metafile(fileName, referenceHdc, _rectangle, frameUnit)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangle, frameUnit, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangle, frameUnit, EmfType.EmfOnly, "description")); + DeleteFile(fileName); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_Invalid_TestData))] + public void Ctor_InvalidEmfTypeII_ThrowsArgumentException(EmfType emfType) + { + string fileName = GetPath("newTestImage.wmf"); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, emfType)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, emfType, "description")); + + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangle, MetafileFrameUnit.GdiCompatible, emfType)); + AssertExtensions.Throws(null, () => + new Metafile(fileName, referenceHdc, _rectangle, MetafileFrameUnit.GdiCompatible, emfType, "description")); + DeleteFile(fileName); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullPathI_ThrowsArgumentNullException() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws("path", () => new Metafile((string)null, referenceHdc, _rectangleF)); + AssertExtensions.Throws("path", () => + new Metafile((string)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible)); + AssertExtensions.Throws("path", () => + new Metafile((string)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + AssertExtensions.Throws("path", () => + new Metafile((string)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(@"fileNo*-//\\#@(found")] + [InlineData("")] + public void Ctor_InvalidPathII_ThrowsArgumentException(string fileName) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws("path", null, () => new Metafile(fileName, referenceHdc, _rectangleF)); + AssertExtensions.Throws("path", null, () => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible)); + AssertExtensions.Throws("path", null, () => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + AssertExtensions.Throws("path", null, () => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + } + } + + // Long paths aren't that much of a problem on Unix. + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_PathTooLongI_ThrowsPathTooLongException() + { + string fileName = GetPath(new string('a', 261)); + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + Assert.Throws(() => new Metafile(fileName, referenceHdc, _rectangleF)); + Assert.Throws(() => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible)); + Assert.Throws(() => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + Assert.Throws(() => + new Metafile(fileName, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + DeleteFile(fileName); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + public void Ctor_StreamIntPtrRectangle_Success() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var stream = new MemoryStream()) + using (var metafile = new Metafile(stream, g.GetHdc(), _rectangle)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_TestData))] + public void Ctor_StreamIntPtrRectangleMetafileFrameUnit_Success(MetafileFrameUnit frameUnit) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var stream = new MemoryStream()) + using (var metafile = new Metafile(stream, g.GetHdc(), _rectangle, frameUnit)) + { + AssertMetafileIsBlank(metafile); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_TestData))] + public void Ctor_StreamIntPtrRectangleMetafileFrameUnitEmfType_Success(EmfType emfType) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var stream = new MemoryStream()) + using (var metafile = new Metafile(stream, g.GetHdc(), _rectangle, MetafileFrameUnit.GdiCompatible, emfType)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), emfType); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_StreamIntPtrRectangleMetafileFrameUnitEmfTypeString_Success(string description) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var stream = new MemoryStream()) + using (var metafile = new Metafile( + stream, g.GetHdc(), _rectangle, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Description_TestData))] + public void Ctor_RectangleEmptyI_Success(string description) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + using (var stream = new MemoryStream()) + using (var metafile = new Metafile( + stream, g.GetHdc(), new Rectangle(), MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, description)) + { + AssertMetafileIsBlank(metafile); + AssertEmfType(metafile.GetMetafileHeader(), EmfType.EmfOnly); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_IntPtrZeroIV_ThrowsArgumentException() + { + using (var stream = new MemoryStream()) + { + AssertExtensions.Throws(null, () => new Metafile(stream, IntPtr.Zero, _rectangle)); + AssertExtensions.Throws(null, () => new Metafile(stream, IntPtr.Zero, _rectangle, MetafileFrameUnit.GdiCompatible)); + AssertExtensions.Throws(null, () => + new Metafile(stream, IntPtr.Zero, _rectangle, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(stream, IntPtr.Zero, _rectangle, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(MetafileFrameUnit_Invalid_TestData))] + public void Ctor_InvalidEmfTypeIII_ThrowsArgumentException(MetafileFrameUnit frameUnit) + { + using (var stream = new MemoryStream()) + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => new Metafile(stream, referenceHdc, _rectangle, frameUnit)); + AssertExtensions.Throws(null, () => + new Metafile(stream, referenceHdc, _rectangle, frameUnit, EmfType.EmfOnly)); + AssertExtensions.Throws(null, () => + new Metafile(stream, referenceHdc, _rectangle, frameUnit, EmfType.EmfOnly, "description")); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(EmfType_Invalid_TestData))] + public void Ctor_InvalidEmfTypeIII_ThrowsArgumentException(EmfType emfType) + { + using (var stream = new MemoryStream()) + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + AssertExtensions.Throws(null, () => + new Metafile(stream, referenceHdc, _rectangle, MetafileFrameUnit.GdiCompatible, emfType)); + AssertExtensions.Throws(null, () => + new Metafile(stream, referenceHdc, _rectangle, MetafileFrameUnit.GdiCompatible, emfType, "description")); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullStream_ThrowsNullReferenceException() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr referenceHdc = g.GetHdc(); + Assert.Throws(() => new Metafile((Stream)null, referenceHdc, _rectangleF)); + Assert.Throws(() => new Metafile((Stream)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible)); + Assert.Throws(() => + new Metafile((Stream)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly)); + Assert.Throws(() => + new Metafile((Stream)null, referenceHdc, _rectangleF, MetafileFrameUnit.GdiCompatible, EmfType.EmfOnly, "description")); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Static_GetMetafileHeader_String_ReturnsExpected() + { + MetafileHeader header = Metafile.GetMetafileHeader(GetPath(WmfFile)); + AssertMetafileHeader(header); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Static_GetMetafileHeader_IntPtr_ThrowsArgumentException() + { + AssertExtensions.Throws(null, () => Metafile.GetMetafileHeader(IntPtr.Zero)); + using (var metafile = new Metafile(GetPath(WmfFile))) + { + AssertExtensions.Throws(null, () => Metafile.GetMetafileHeader(metafile.GetHenhmetafile())); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(@"fileNo*-//\\#@(found")] + [InlineData("")] + public void Static_GetMetafileHeader_InvalidPath_ThrowsArgumentException(string fileName) + { + AssertExtensions.Throws("path", null, () => Metafile.GetMetafileHeader(fileName)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Static_GetMetafileHeader_NullString_ThrowsArgumentNullException() + { + AssertExtensions.Throws("path", () => Metafile.GetMetafileHeader((string)null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Static_GetMetafileHeader_Stream_ReturnsExpected() + { + using (FileStream stream = File.OpenRead(GetPath(WmfFile))) + { + MetafileHeader header = Metafile.GetMetafileHeader(stream); + AssertMetafileHeader(header); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Static_GetMetafileHeader_NullStream_ThrowsNullReferenceException() + { + Assert.Throws(() => Metafile.GetMetafileHeader((Stream)null)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Static_GetMetafileHeader_EmptyStream_ArgumentException() + { + using (var stream = new MemoryStream()) + { + AssertExtensions.Throws(null, () => Metafile.GetMetafileHeader(stream)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_ReturnsExpected() + { + using (var metafile = new Metafile(GetPath(WmfFile))) + { + MetafileHeader headerA = metafile.GetMetafileHeader(); + MetafileHeader headerB = metafile.GetMetafileHeader(); + AssertMetafileHeader(headerA); + Assert.NotSame(headerA, headerB); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_Disposed_ThrowsArgumentException() + { + var metafile = new Metafile(GetPath(WmfFile)); + metafile.Dispose(); + + AssertExtensions.Throws(null, () => metafile.GetMetafileHeader()); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHenhmetafile_ReturnsExpected() + { + using (var metafile = new Metafile(GetPath(WmfFile))) + { + Assert.NotEqual(IntPtr.Zero, metafile.GetHenhmetafile()); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHenhmetafile_Disposed_ThrowsArgumentException() + { + var metafile = new Metafile(GetPath(WmfFile)); + metafile.Dispose(); + + AssertExtensions.Throws(null, () => metafile.GetHenhmetafile()); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void PlayRecord_Disposed_ThrowsArgumentException() + { + var metafile = new Metafile(GetPath(WmfFile)); + metafile.Dispose(); + + AssertExtensions.Throws(null, () => + metafile.PlayRecord(EmfPlusRecordType.BeginContainer, 0, 1, new byte[1])); + } + + private void DeleteFile(string path) + { + if (File.Exists(path)) + { + File.Delete(path); + } + } + + private string GetPath(string fileName) + { + return Helpers.GetTestBitmapPath(fileName); + } + + private void AssertEmfType(MetafileHeader metafileHeader, EmfType emfType) + { + switch (emfType) + { + case EmfType.EmfOnly: + Assert.True(metafileHeader.IsEmf()); + break; + case EmfType.EmfPlusDual: + Assert.True(metafileHeader.IsEmfPlusDual()); + break; + case EmfType.EmfPlusOnly: + Assert.True(metafileHeader.IsEmfPlusOnly()); + break; + } + } + + private void AssertMetafileIsBlank(Metafile metafile) + { + GraphicsUnit graphicsUnit = (GraphicsUnit)int.MaxValue; + + AssertMetafileHeaderIsBlank(metafile.GetMetafileHeader()); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // This values are incorrect on libgdiplus. + Assert.Equal(new Rectangle(0, 0, 1, 1), metafile.GetBounds(ref graphicsUnit)); + Assert.Equal(GraphicsUnit.Pixel, graphicsUnit); + } + } + + private void AssertMetafileHeaderIsBlank(MetafileHeader metafileHeader) + { + Assert.Equal(new Rectangle(0, 0, 0, 0), metafileHeader.Bounds); + Assert.Equal(0, metafileHeader.MetafileSize); + } + + private void AssertMetafile(Metafile metafile) + { + GraphicsUnit graphicsUnit = (GraphicsUnit)int.MaxValue; + + AssertMetafileHeader(metafile.GetMetafileHeader()); + Assert.Equal(new Rectangle(-30, -40, 3096, 4127), metafile.GetBounds(ref graphicsUnit)); + Assert.Equal(GraphicsUnit.Pixel, graphicsUnit); + } + + private void AssertMetafileHeader(MetafileHeader header) + { + Assert.Equal(MetafileType.WmfPlaceable, header.Type); + Assert.Equal(0x300, header.Version); + Assert.Equal(new Rectangle(-30, -40, 3096, 4127), header.Bounds); + Assert.Equal(606, header.DpiX); + Assert.Equal(606, header.DpiY); + Assert.Equal(0, header.EmfPlusHeaderSize); + Assert.Equal(0, header.LogicalDpiX); + Assert.Equal(0, header.LogicalDpiY); + Assert.Equal(3474, header.MetafileSize); + Assert.NotNull(header.WmfHeader); + Assert.False(header.IsDisplay()); + Assert.False(header.IsEmf()); + Assert.False(header.IsEmfOrEmfPlus()); + Assert.False(header.IsEmfPlus()); + Assert.False(header.IsEmfPlusDual()); + Assert.False(header.IsEmfPlusOnly()); + Assert.True(header.IsWmf()); + Assert.True(header.IsWmfPlaceable()); + + Assert.Equal(9, header.WmfHeader.HeaderSize); + Assert.Equal(98, header.WmfHeader.MaxRecord); + Assert.Equal(3, header.WmfHeader.NoObjects); + Assert.Equal(0, header.WmfHeader.NoParameters); + Assert.Equal(1737, header.WmfHeader.Size); + Assert.Equal((int)MetafileType.Wmf, header.WmfHeader.Type); + Assert.Equal(0x300, header.WmfHeader.Version); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/PropertyItemTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/PropertyItemTests.cs new file mode 100644 index 0000000000..6c603b6851 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/PropertyItemTests.cs @@ -0,0 +1,69 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005-2006 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.Collections.Generic; +using Xunit; + +namespace System.Drawing.Imaging.Tests +{ + public class PropertyItemTests + { + private const string PngFile = "16x16_nonindexed_24bit.png"; + + public static IEnumerable Properties_TestData() + { + yield return new object[] { int.MaxValue, int.MaxValue, short.MaxValue, new byte[1] { 0 } }; + yield return new object[] { int.MinValue, int.MinValue, short.MinValue, new byte[2] { 1, 1} }; + yield return new object[] { 0, 0, 0, new byte[0] }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Properties_TestData))] + public void Properties_SetValues_ReturnsExpected(int id, int len, short type, byte[] value) + { + using (Image image = new Bitmap(Helpers.GetTestBitmapPath(PngFile))) + using (Image clone = (Image)image.Clone()) + { + PropertyItem[] propItems = clone.PropertyItems; + PropertyItem propItem = propItems[0]; + Assert.Equal(771, propItem.Id); + Assert.Equal(1, propItem.Len); + Assert.Equal(1, propItem.Type); + Assert.Equal(new byte[1] { 0 }, propItem.Value); + + propItem.Id = id; + propItem.Len = len; + propItem.Type = type; + propItem.Value = value; + + Assert.Equal(id, propItem.Id); + Assert.Equal(len, propItem.Len); + Assert.Equal(type, propItem.Type); + Assert.Equal(value, propItem.Value); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/Imaging/WmfPlaceableFileHeaderTests.cs b/external/corefx/src/System.Drawing.Common/tests/Imaging/WmfPlaceableFileHeaderTests.cs index 7009fbea57..ccddb480f4 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Imaging/WmfPlaceableFileHeaderTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Imaging/WmfPlaceableFileHeaderTests.cs @@ -8,7 +8,7 @@ namespace System.Drawing.Imaging.Tests { public class WmfPlaceableFileHeaderTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { WmfPlaceableFileHeader fileHeader = new WmfPlaceableFileHeader(); @@ -23,7 +23,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(0, fileHeader.Reserved); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(short.MaxValue)] [InlineData(0)] [InlineData(short.MinValue)] @@ -50,7 +50,7 @@ namespace System.Drawing.Imaging.Tests Assert.Equal(value, fileHeader.Reserved); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(int.MaxValue)] [InlineData(0)] [InlineData(int.MinValue)] diff --git a/external/corefx/src/System.Drawing.Common/tests/PenTests.cs b/external/corefx/src/System.Drawing.Common/tests/PenTests.cs index 7210e14d87..8f06f781ea 100644 --- a/external/corefx/src/System.Drawing.Common/tests/PenTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/PenTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; using Xunit; namespace System.Drawing.Tests @@ -19,7 +20,7 @@ namespace System.Drawing.Tests yield return new object[] { new PathGradientBrush(new Point[] { new Point(1, 2), new Point(2, 3) }), PenType.PathGradient }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Brush_TestData))] public void Ctor_Brush(T brush, PenType penType) where T : Brush { @@ -51,7 +52,7 @@ namespace System.Drawing.Tests yield return new object[] { new SolidBrush(Color.Red), float.MaxValue, PenType.SolidColor }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Brush_Width_TestData))] public void Ctor_Brush_Width(T brush, float width, PenType expectedPenType) where T : Brush { @@ -68,7 +69,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Brush_MakesClone() { using (var brush = new SolidBrush(Color.Red)) @@ -80,14 +81,14 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullBrush_ThrowsArgumentNullException() { AssertExtensions.Throws("brush", () => new Pen(null)); AssertExtensions.Throws("brush", () => new Pen(null, 0)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_DisposedBrush_ThrowsArgumentException() { var brush = new SolidBrush(Color.Red); @@ -97,7 +98,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new Pen(brush, 10)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Color() { using (var pen = new Pen(Color.Red)) @@ -107,7 +108,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(1)] @@ -124,7 +125,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PenAlignment.Center)] [InlineData(PenAlignment.Inset)] [InlineData(PenAlignment.Left)] @@ -140,7 +141,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(PenAlignment.Center - 1)] [InlineData(PenAlignment.Right + 1)] public void Alignment_SetInvalid_ThrowsInvalidEnumArgumentException(PenAlignment aligment) @@ -148,11 +149,11 @@ namespace System.Drawing.Tests using (var brush = new SolidBrush(Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws("value", () => pen.Alignment = aligment); + Assert.ThrowsAny(() => pen.Alignment = aligment); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Alignment_GetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -165,7 +166,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Brush_TestData))] public void Brush_SetValid_GetReturnsExpected(T brush, PenType penType) where T : Brush { @@ -177,7 +178,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Brush_SetCustomBrush_ThrowsArgumentException() { using (var pen = new Pen(Color.Red)) @@ -191,7 +192,7 @@ namespace System.Drawing.Tests public override object Clone() => this; } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Brush_SetNullBrush_ThrowsArgumentNullException() { using (var brush = new SolidBrush(Color.Red)) @@ -201,7 +202,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Brush_SetDisposedBrush_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -213,7 +214,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Brush_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -234,7 +235,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Clone_TestData))] public void Clone_Invoke_ReturnsExpected(Pen pen) { @@ -257,7 +258,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -269,7 +270,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_SolidBrush_ReturnsExpected() { using (var brush = new SolidBrush(Color.Red)) @@ -279,27 +280,39 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_HatchBrush_ThrowsArgumentException() { using (var brush = new HatchBrush(HatchStyle.BackwardDiagonal, Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws(null, () => pen.Color); + ValidateInitialPenColorState(pen); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_LinearGradientBrush_ThrowsArgumentException() { using (var brush = new LinearGradientBrush(Point.Empty, new Point(1, 2), Color.Blue, Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws(null, () => pen.Color); + ValidateInitialPenColorState(pen); } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + private void ValidateInitialPenColorState(Pen pen) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + AssertExtensions.Throws(null, () => pen.Color); + } + else + { + Assert.Equal(Color.FromArgb(0), pen.Color); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Brush_TestData))] public void Color_Set_GetReturnsExpected(Brush brush, PenType _) { @@ -320,7 +333,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_GetSetWhenDisposedWithoutBrush_Success() { var pen = new Pen(Color.Red); @@ -334,7 +347,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => pen.Color = Color.Black); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_GetSetWhenDisposedWithBrush_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -347,7 +360,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { 0, 0 })] [InlineData(new float[] { 1, 1 })] [InlineData(new float[] { float.NaN, 0 })] @@ -365,7 +378,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CompoundArray_SetNullPattern_ThrowsNullReferenceException() { using (var brush = new SolidBrush(Color.Red)) @@ -375,7 +388,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CompoundArray_SetEmptyPattern_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -385,7 +398,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { -1, 0 })] [InlineData(new float[] { float.NegativeInfinity, 0 })] [InlineData(new float[] { float.PositiveInfinity, 0 })] @@ -403,7 +416,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CompoundArray_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -416,7 +429,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomEndCap_SetValid_GetReturnsExpected() { using (var brush = new SolidBrush(Color.Red)) @@ -435,7 +448,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomEndCap_SetNull_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -445,7 +458,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomEndCap_SetDisposedLineCap_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -460,7 +473,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomEndCap_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -476,7 +489,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomStartCap_SetValid_GetReturnsExpected() { using (var brush = new SolidBrush(Color.Red)) @@ -495,7 +508,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomStartCap_SetNull_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -505,7 +518,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomStartCap_SetDisposedLineCap_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -520,7 +533,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void CustomStartCap_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -536,7 +549,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(DashCap.Flat)] [InlineData(DashCap.Round)] [InlineData(DashCap.Triangle)] @@ -550,7 +563,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(DashCap.Flat - 1)] [InlineData(DashCap.Round - 1)] [InlineData(DashCap.Triangle + 1)] @@ -559,11 +572,11 @@ namespace System.Drawing.Tests using (var brush = new SolidBrush(Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws("value", () => pen.DashCap = dashCap); + Assert.ThrowsAny(() => pen.DashCap = dashCap); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashCap_GetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -576,7 +589,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1)] [InlineData(0)] [InlineData(10)] @@ -593,7 +606,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashOffset_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -606,7 +619,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { 1 })] [InlineData(new float[] { 1, 1 })] [InlineData(new float[] { float.MaxValue, float.NaN, float.PositiveInfinity })] @@ -626,7 +639,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashPattern_SetNullPattern_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -636,7 +649,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashPattern_SetEmptyPattern_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -646,7 +659,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(new float[] { -1 })] [InlineData(new float[] { 0 })] [InlineData(new float[] { 1, -1 })] @@ -660,7 +673,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashPattern_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -673,7 +686,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(DashStyle.Dash, new float[] { 3, 1 })] [InlineData(DashStyle.DashDot, new float[] { 3, 1, 1, 1 })] [InlineData(DashStyle.DashDotDot, new float[] { 3, 1, 1, 1, 1, 1 })] @@ -699,7 +712,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashStyle_SetCustomWithDashCount_DoeNotChangePattern() { using (var brush = new SolidBrush(Color.Red)) @@ -713,7 +726,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(DashStyle.Solid - 1)] [InlineData(DashStyle.Custom + 1)] public void DashStyle_SetInvalid_ThrowsInvalidEnumArgumentException(DashStyle dashStyle) @@ -721,11 +734,11 @@ namespace System.Drawing.Tests using (var brush = new SolidBrush(Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws("value", () => pen.DashStyle = dashStyle); + Assert.ThrowsAny(() => pen.DashStyle = dashStyle); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void DashStyle_GetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -753,7 +766,7 @@ namespace System.Drawing.Tests yield return new object[] { LineCap.Custom }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(LineCap_Valid_TestData))] public void EndCap_SetValid_GetReturnsExpected(LineCap lineCap) { @@ -774,18 +787,18 @@ namespace System.Drawing.Tests yield return new object[] { LineCap.Custom + 1 }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(LineCap_Invalid_TestData))] public void EndCap_SetInvalid_ThrowsInvalidEnumArgumentException(LineCap lineCap) { using (var brush = new SolidBrush(Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws("value", () => pen.EndCap = lineCap); + Assert.ThrowsAny(() => pen.EndCap = lineCap); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void EndCap_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -798,7 +811,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineJoin.Bevel)] [InlineData(LineJoin.Miter)] [InlineData(LineJoin.MiterClipped)] @@ -813,7 +826,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineJoin.Miter - 1)] [InlineData(LineJoin.MiterClipped + 1)] public void LineJoin_SetInvalid_ThrowsInvalidEnumArgumentException(LineJoin lineJoin) @@ -821,11 +834,11 @@ namespace System.Drawing.Tests using (var brush = new SolidBrush(Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws("value", () => pen.LineJoin = lineJoin); + Assert.ThrowsAny(() => pen.LineJoin = lineJoin); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LineJoin_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -838,7 +851,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, 1)] [InlineData(0, 1)] [InlineData(10, 10)] @@ -855,7 +868,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MiterLimit_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -876,7 +889,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), new Matrix(2, 3, 4, 5, 6, 7), MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(MultiplyTransform_TestData))] public void MultiplyTransform_Matrix_SetsTransformToExpected(Matrix originalTransform, Matrix matrix, MatrixOrder matrixOrder) { @@ -907,7 +920,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NullMatrix_ThrowsNullReferenceException() { using (var brush = new SolidBrush(Color.Red)) @@ -918,7 +931,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NotInvertibleMatrix_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -930,7 +943,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_DisposedMatrix_Nop() { using (var brush = new SolidBrush(Color.Red)) @@ -949,7 +962,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void MultiplyTransform_InvalidOrder_Nop(MatrixOrder matrixOrder) @@ -966,7 +979,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -980,7 +993,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Invoke_SetsTransformToZero() { using (var brush = new SolidBrush(Color.Red)) @@ -997,7 +1010,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1021,7 +1034,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -45, MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(RotateTransform_TestData))] public void RotateTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float angle, MatrixOrder matrixOrder) { @@ -1051,7 +1064,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void RotateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder) @@ -1063,7 +1076,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateTransform_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1091,7 +1104,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ScaleTransform_TestData))] public void ScaleTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float scaleX, float scaleY, MatrixOrder matrixOrder) { @@ -1121,7 +1134,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void ScaleTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder) @@ -1133,7 +1146,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ScaleTransform_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1147,7 +1160,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(LineCap.Flat, LineCap.Round, DashCap.Triangle)] [InlineData(LineCap.Flat - 1, LineCap.Flat - 1, DashCap.Flat - 1)] [InlineData((LineCap)int.MaxValue, (LineCap)int.MaxValue, (DashCap)int.MaxValue)] @@ -1169,7 +1182,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetLineCap_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1181,7 +1194,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(LineCap_Valid_TestData))] public void StartCap_SetValid_GetReturnsExpected(LineCap lineCap) { @@ -1193,18 +1206,18 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(LineCap_Invalid_TestData))] public void StartCap_SetInvalid_ThrowsInvalidEnumArgumentException(LineCap lineCap) { using (var brush = new SolidBrush(Color.Red)) using (var pen = new Pen(brush)) { - AssertExtensions.Throws("value", () => pen.StartCap = lineCap); + Assert.ThrowsAny(() => pen.StartCap = lineCap); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void StartCap_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1217,7 +1230,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetValid_GetReturnsExpected() { using (var brush = new SolidBrush(Color.Red)) @@ -1234,7 +1247,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetNull_ThrowsArgumentNullException() { using (var brush = new SolidBrush(Color.Red)) @@ -1244,7 +1257,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetNotInvertible_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1255,7 +1268,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetDisposedLineCap_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1268,7 +1281,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1296,7 +1309,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TranslateTransform_TestData))] public void TranslateTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float dX, float dY, MatrixOrder matrixOrder) { @@ -1326,7 +1339,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void TranslateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder) @@ -1338,7 +1351,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TranslateTransform_Disposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) @@ -1352,7 +1365,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-10)] [InlineData(0)] [InlineData(10)] @@ -1369,7 +1382,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Width_GetSetWhenDisposed_ThrowsArgumentException() { using (var brush = new SolidBrush(Color.Red)) diff --git a/external/corefx/src/System.Drawing.Common/tests/PensTests.cs b/external/corefx/src/System.Drawing.Common/tests/PensTests.cs index 74abc41b03..71491f289a 100644 --- a/external/corefx/src/System.Drawing.Common/tests/PensTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/PensTests.cs @@ -157,7 +157,7 @@ namespace System.Drawing.Tests public static object[] Pen(Func getPen, Color expectedColor) => new object[] { getPen, expectedColor }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Pens_TestData))] public void Pens_Get_ReturnsExpected(Func getPen, Color expectedColor) { diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/MarginsTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/MarginsTests.cs index 4f735b52b2..f5f28c884d 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Printing/MarginsTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/MarginsTests.cs @@ -54,6 +54,7 @@ namespace System.Drawing.Printing.Tests Assert.Equal(bottom, m.Bottom); } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Theory] [InlineData(-1, 0, 0, 0)] [InlineData(0, -1, 0, 0)] @@ -116,6 +117,7 @@ namespace System.Drawing.Printing.Tests Assert.Equal(boundValue, m.Top); } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void Bounds_BadValues_ThrowsArgumentException() { diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PageSettingsTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PageSettingsTests.cs index 37e2f77fa0..1e1b7e760b 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Printing/PageSettingsTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/PageSettingsTests.cs @@ -34,9 +34,8 @@ namespace System.Drawing.Printing.Tests public class PageSettingsTests { - private static bool AnyInstalledPrinters => PrinterSettings.InstalledPrinters.Count == 0; - - [ConditionalFact(nameof(AnyInstalledPrinters))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters)] public void Clone_Success() { PageSettings ps = new PageSettings(); diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSizeTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSizeTests.cs index 9413e9ea7e..df2892fbe0 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSizeTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSizeTests.cs @@ -32,6 +32,7 @@ namespace System.Drawing.Printing.Tests { public class PaperSizeTests { + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void Ctor_Default() { @@ -67,6 +68,7 @@ namespace System.Drawing.Printing.Tests AssertExtensions.Throws(null, () => ps.PaperName = "NewName"); } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Theory] [InlineData((int)PaperKind.A4)] [InlineData((int)PaperKind.JapaneseEnvelopeKakuNumber3)] diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSourceTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSourceTests.cs index 111a60c4e0..f7a8f0c794 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSourceTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/PaperSourceTests.cs @@ -32,6 +32,7 @@ namespace System.Drawing.Printing.Tests { public class PaperSourceTests { + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Fact] public void Ctor_Default() { diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs new file mode 100644 index 0000000000..de604b044b --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs @@ -0,0 +1,292 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2005-2006 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 Xunit; + +namespace System.Drawing.Printing.Tests +{ + public class PrintDocumentTests + { + private readonly PageSettings _pageSettings = new PageSettings() + { + PaperSize = new PaperSize() + { + RawKind = (int)PaperKind.A3 + } + }; + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_Default_Success() + { + using (var document = new PrintDocument()) + { + Assert.Equal("document", document.DocumentName); + Assert.False(document.OriginAtMargins); + AssertDefaultPageSettings(document.DefaultPageSettings); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DefaultPageSettings_SetValue_ReturnsExpected() + { + using (var document = new PrintDocument()) + { + document.DefaultPageSettings = null; + Assert.IsAssignableFrom(document.DefaultPageSettings); + + document.DefaultPageSettings = _pageSettings; + Assert.Equal(_pageSettings.PaperSize.Kind, _pageSettings.PaperSize.Kind); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DefaultPageSettings_Null_ReturnsExpected() + { + using (var document = new PrintDocument()) + { + document.DefaultPageSettings = null; + AssertDefaultPageSettings(document.DefaultPageSettings); + } + } + + [Theory] + [InlineData("")] + [InlineData("newDocument")] + public void DocumentName_SetValue_ReturnsExpected(string documentName) + { + using (var document = new PrintDocument()) + { + document.DocumentName = documentName; + Assert.Equal(documentName, document.DocumentName); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DocumentName_Null_ReturnsExpected() + { + using (var document = new PrintDocument()) + { + document.DocumentName = null; + Assert.Equal(string.Empty, document.DocumentName); + } + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public void OriginAtMargins_SetValue_ReturnsExpected(bool originAtMargins) + { + using (var document = new PrintDocument()) + { + document.OriginAtMargins = originAtMargins; + Assert.Equal(originAtMargins, document.OriginAtMargins); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void PrintController_SetValue_ReturnsExpected() + { + using (var document = new PrintDocument()) + { + document.PrintController = null; + Assert.NotNull(document.PrintController); + + var printController = new StandardPrintController(); + document.PrintController = printController; + Assert.Same(printController, document.PrintController); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void PrinterSettings_SetValue_ReturnsExpected() + { + using (var document = new PrintDocument()) + { + document.PrinterSettings = null; + Assert.IsAssignableFrom(document.PrinterSettings); + + var printerSettings = new PrinterSettings(); + document.PrinterSettings = printerSettings; + Assert.Same(printerSettings, document.PrinterSettings); + Assert.Equal( + document.PrinterSettings.DefaultPageSettings.PaperSize.Kind, + document.DefaultPageSettings.PaperSize.Kind); + + document.DefaultPageSettings = _pageSettings; + document.PrinterSettings = printerSettings; + Assert.Equal( + _pageSettings.PaperSize.Kind, + document.DefaultPageSettings.PaperSize.Kind); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void BeginPrint_SetValue_ReturnsExpected() + { + bool flag = false; + var beginPrintHandler = new PrintEventHandler((sender, e) => flag = true); + + using (var document = new PrintDocument()) + { + document.PrintController = new TestPrintController(); + document.BeginPrint += beginPrintHandler; + document.Print(); + Assert.True(flag); + + flag = false; + document.BeginPrint -= beginPrintHandler; + document.Print(); + Assert.False(flag); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void EndPrint_SetValue_ReturnsExpected() + { + bool flag = false; + var endPrintHandler = new PrintEventHandler((sender, e) => flag = true); + + using (var document = new PrintDocument()) + { + document.PrintController = new TestPrintController(); + document.EndPrint += endPrintHandler; + document.Print(); + Assert.True(flag); + + flag = false; + document.EndPrint -= endPrintHandler; + document.Print(); + Assert.False(flag); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void PrintPage_SetValue_ReturnsExpected() + { + bool flag = false; + var printPageHandler = new PrintPageEventHandler((sender, e) => flag = true); + + using (var document = new PrintDocument()) + { + document.PrintController = new TestPrintController(); + document.PrintPage += printPageHandler; + document.Print(); + Assert.True(flag); + + flag = false; + document.PrintPage -= printPageHandler; + document.Print(); + Assert.False(flag); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void QueryPageSettings_SetValue_ReturnsExpected() + { + bool flag = false; + var queryPageSettingsHandler = new QueryPageSettingsEventHandler((sender, e) => flag = true); + + using (var document = new PrintDocument()) + { + document.PrintController = new TestPrintController(); + document.QueryPageSettings += queryPageSettingsHandler; + document.Print(); + Assert.True(flag); + + flag = false; + document.QueryPageSettings -= queryPageSettingsHandler; + document.Print(); + Assert.False(flag); + } + } + + [Fact] + public void ToString_ReturnsExpected() + { + using (var document = new PrintDocument()) + { + var expected = string.Format("[PrintDocument {0}]", document.DocumentName); + Assert.Equal(expected, document.ToString()); + } + } + + private void AssertDefaultPageSettings(PageSettings pageSettings) + { + // A4 and Letter are both common default sizes for systems to have. + switch (pageSettings.PaperSize.Kind) + { + case PaperKind.A4: + Assert.Equal(new Rectangle(0, 0, 827, 1169), pageSettings.Bounds); + break; + + case PaperKind.Letter: + Assert.Equal(new Rectangle(0, 0, 850, 1100), pageSettings.Bounds); + break; + } + + Assert.False(pageSettings.Landscape); + Assert.Equal(PaperSourceKind.FormSource, pageSettings.PaperSource.Kind); + Assert.Equal(PrinterResolutionKind.Custom, pageSettings.PrinterResolution.Kind); + Assert.True(pageSettings.PrinterSettings.IsDefaultPrinter); + } + + private class TestPrintController : PrintController + { + public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e) + { + using (var bitmap = new Bitmap(20, 20)) + { + return Graphics.FromImage(bitmap); + } + } + + public override void OnStartPrint(PrintDocument document, PrintEventArgs e) + { + base.OnStartPrint(document, e); + } + + public override void OnEndPrint(PrintDocument document, PrintEventArgs e) + { + base.OnEndPrint(document, e); + } + + public override void OnEndPage(PrintDocument document, PrintPageEventArgs e) + { + base.OnEndPage(document, e); + e.Graphics.Dispose(); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTest.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTest.cs deleted file mode 100644 index 4978085e39..0000000000 --- a/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTest.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.ComponentModel; -using Xunit; - -namespace System.Drawing.Printing.Test -{ - public class PrinterResolutionTest - { - [Fact] - public void Default_Ctor() - { - PrinterResolution pr = new PrinterResolution(); - Assert.Equal(PrinterResolutionKind.Custom, pr.Kind); - } - - [Theory] - [InlineData(PrinterResolutionKind.High)] - [InlineData(PrinterResolutionKind.Medium)] - [InlineData(PrinterResolutionKind.Low)] - [InlineData(PrinterResolutionKind.Draft)] - [InlineData(PrinterResolutionKind.Custom)] - public void Set_Kind(PrinterResolutionKind kind) - { - PrinterResolution pr = new PrinterResolution(); - pr.Kind = kind; - Assert.Equal(kind, pr.Kind); - } - - [Fact] - public void Set_NotDefinedKind_ThrowsAnException() - { - PrinterResolution pr = new PrinterResolution(); - Assert.Throws(() => pr.Kind = (PrinterResolutionKind)999); - } - - [Theory] - [InlineData(Int32.MaxValue, Int32.MaxValue)] - [InlineData(Int32.MinValue, Int32.MinValue)] - [InlineData(1, 2)] - public void Set_Coordinates(int x, int y) - { - PrinterResolution pr = new PrinterResolution(); - - pr.X = x; - pr.Y = y; - - Assert.Equal(x, pr.X); - Assert.Equal(y, pr.Y); - } - } -} diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTests.cs index b23c7a0dbc..9f6f1d00a8 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterResolutionTests.cs @@ -57,13 +57,14 @@ namespace System.Drawing.Printing.Tests Assert.Equal(kind, pr.Kind); } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] [Theory] [InlineData(PrinterResolutionKind.Custom + 1)] [InlineData(PrinterResolutionKind.High - 1)] public void Kind_InvalidEnum_ThrowsInvalidEnumArgumentException(PrinterResolutionKind overflowKind) { PrinterResolution pr = new PrinterResolution(); - Assert.Throws(() => pr.Kind = overflowKind); + Assert.ThrowsAny(() => pr.Kind = overflowKind); } } } diff --git a/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterSettingsTests.cs b/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterSettingsTests.cs new file mode 100644 index 0000000000..9569246895 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/Printing/PrinterSettingsTests.cs @@ -0,0 +1,633 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Authors: +// Sebastien Pouliot +// +// 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.Collections.Generic; +using System.ComponentModel; +using System.Drawing.Imaging; +using System.Globalization; +using System.Linq; +using Xunit; + +namespace System.Drawing.Printing.Tests +{ + public class PrinterSettingsTests + { + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_Default_Success() + { + var printerSettings = new PrinterSettings(); + Assert.NotNull(printerSettings.DefaultPageSettings); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void CanDuplex_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + bool canDuplex = printerSettings.CanDuplex; + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Copies_Default_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.Equal(1, printerSettings.Copies); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(0)] + [InlineData(short.MaxValue)] + public void Copies_SetValue_ReturnsExpected(short copies) + { + var printerSettings = new PrinterSettings() + { + Copies = copies + }; + + Assert.Equal(copies, printerSettings.Copies); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(-1)] + [InlineData(short.MinValue)] + public void Copies_SetValue_ThrowsArgumentException(short copies) + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.Copies = copies); + } + + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void Collate_Default_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + bool collate = printerSettings.Collate; + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Collate_SetValue_ReturnsExpected() + { + var printerSettings = new PrinterSettings() + { + Collate = false + }; + + Assert.Equal(false, printerSettings.Collate); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DefaultPageSettings_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.NotNull(printerSettings.DefaultPageSettings); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(Duplex.Simplex)] + [InlineData(Duplex.Vertical)] + [InlineData(Duplex.Horizontal)] + public void Duplex_SetValue_ReturnsExpected(Duplex duplex) + { + var printerSettings = new PrinterSettings() + { + Duplex = duplex + }; + + Assert.Equal(duplex, printerSettings.Duplex); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(Duplex.Default - 1)] + [InlineData(Duplex.Horizontal + 1)] + [InlineData((Duplex)int.MaxValue)] + [InlineData((Duplex)int.MinValue)] + public void Duplex_Invalid_ThrowsInvalidEnumArgumentException(Duplex duplex) + { + var printerSettings = new PrinterSettings(); + Assert.ThrowsAny(() => printerSettings.Duplex = duplex); + } + + [Fact] + public void FromPage_Default_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + + Assert.Equal(0, printerSettings.FromPage); + } + + [Theory] + [InlineData(1)] + [InlineData(int.MaxValue)] + public void FromPage_SetValue_ReturnsExpected(int pageNumber) + { + var printerSettings = new PrinterSettings() + { + FromPage = pageNumber + }; + + Assert.Equal(pageNumber, printerSettings.FromPage); + } + + [Theory] + [InlineData(-1)] + [InlineData(int.MinValue)] + public void FromPage_Invalid_ThrowsArgumentException(int pageNumber) + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.FromPage = pageNumber); + } + + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void Static_InstalledPrinters_ReturnsExpected() + { + Assert.NotNull(PrinterSettings.InstalledPrinters); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsDefaultPrinter_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.True(printerSettings.IsDefaultPrinter); + } + + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void IsPlotter_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.False(printerSettings.IsPlotter); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + public void IsValid_ReturnsExpected() + { + var printerSettings = new PrinterSettings() + { + PrinterName = "Invalid Printer" + }; + + Assert.False(printerSettings.IsValid); + } + + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void LandscapeAngle_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + int[] validValues = new[] { 0, 90, 270 }; + Assert.True(validValues.Contains(printerSettings.LandscapeAngle), "PrinterSettings.LandscapeAngle must be 0, 90, or 270 degrees."); + } + + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void MaximumCopies_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.True(printerSettings.MaximumCopies >= 0, "PrinterSettings.MaximumCopies should not be negative."); + } + + [Fact] + public void MaximumPage_Default_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + + Assert.Equal(9999, printerSettings.MaximumPage); + } + + [Theory] + [InlineData(20)] + [InlineData(int.MaxValue)] + public void MaximumPage_SetValue_ReturnsExpected(int maximumPage) + { + var printerSettings = new PrinterSettings() + { + MaximumPage = maximumPage + }; + + Assert.Equal(maximumPage, printerSettings.MaximumPage); + } + + [Theory] + [InlineData(-1)] + [InlineData(int.MinValue)] + public void MaximumPage_Invalid_ThrowsArgumentException(int maximumPage) + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.MaximumPage = maximumPage); + } + + [Fact] + public void MinimumPage_Default_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.Equal(0, printerSettings.MinimumPage); + } + + [Theory] + [InlineData(20)] + [InlineData(int.MaxValue)] + public void MinimumPage_SetValue_ReturnsExpected(int minimumPage) + { + var printerSettings = new PrinterSettings() + { + MinimumPage = minimumPage + }; + + Assert.Equal(minimumPage, printerSettings.MinimumPage); + } + + [Theory] + [InlineData(-1)] + [InlineData(int.MinValue)] + public void MinimumPage_Invalid_ThrowsArgumentException(int minimumPage) + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.MinimumPage = minimumPage); + } + + [Fact] + public void PrintFileName_SetValue_ReturnsExpected() + { + var printFileName = "fileName"; + var printerSettings = new PrinterSettings() + { + PrintFileName = printFileName + }; + + Assert.Equal(printFileName, printerSettings.PrintFileName); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [Fact] + public void PrintFileName_Null_ThrowsArgumentNullException() + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.PrintFileName = null); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [Fact] + public void PrintFileName_Empty_ThrowsArgumentNullException() + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(string.Empty, () => printerSettings.PrintFileName = string.Empty); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void PaperSizes_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.NotNull(printerSettings.PaperSizes); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void PaperSources_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.NotNull(printerSettings.PaperSources); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [Theory] + [InlineData(PrintRange.AllPages)] + [InlineData(PrintRange.CurrentPage)] + [InlineData(PrintRange.Selection)] + [InlineData(PrintRange.SomePages)] + public void PrintRange_SetValue_ReturnsExpected(PrintRange printRange) + { + var printerSettings = new PrinterSettings() + { + PrintRange = printRange + }; + + Assert.Equal(printRange, printerSettings.PrintRange); + } + + [Theory] + [InlineData(PrintRange.AllPages - 1)] + [InlineData(PrintRange.SomePages + 1)] + [InlineData((PrintRange)int.MaxValue)] + [InlineData((PrintRange)int.MinValue)] + public void PrintRange_Invalid_ThrowsInvalidEnumArgumentException(PrintRange printRange) + { + var printerSettings = new PrinterSettings(); + Assert.ThrowsAny(() => printerSettings.PrintRange = printRange); + } + + [Fact] + public void PrintToFile_SetValue_ReturnsExpected() + { + var printToFile = true; + var printerSettings = new PrinterSettings() + { + PrintToFile = printToFile + }; + + Assert.Equal(printToFile, printerSettings.PrintToFile); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [Theory] + [InlineData("")] + [InlineData("My printer")] + public void PrinterName_SetValue_ReturnsExpected(string printerName) + { + var printerSettings = new PrinterSettings() + { + PrinterName = printerName + }; + + Assert.Equal(printerName, printerSettings.PrinterName); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void PrinterName_Null_ReturnsExpected() + { + var printerSettings = new PrinterSettings() + { + PrinterName = null + }; + + Assert.NotNull(printerSettings.PrinterName); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void PrinterResolutions_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.NotNull(printerSettings.PrinterResolutions); + } + + public static IEnumerable IsDirectPrintingSupported_ImageFormatSupported_TestData() + { + yield return new object[] { ImageFormat.Jpeg }; + yield return new object[] { ImageFormat.Png }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + [MemberData(nameof(IsDirectPrintingSupported_ImageFormatSupported_TestData))] + public void IsDirectPrintingSupported_ImageFormatSupported_ReturnsExpected(ImageFormat imageFormat) + { + var printerSettings = new PrinterSettings(); + Assert.Equal(true, printerSettings.IsDirectPrintingSupported(imageFormat)); + } + + public static IEnumerable IsDirectPrintingSupported_ImageFormatNotSupported_TestData() + { + yield return new object[] { ImageFormat.Emf }; + yield return new object[] { ImageFormat.Exif }; + yield return new object[] { ImageFormat.Gif }; + yield return new object[] { ImageFormat.Icon }; + yield return new object[] { ImageFormat.MemoryBmp }; + yield return new object[] { ImageFormat.Tiff }; + yield return new object[] { ImageFormat.Wmf }; + yield return new object[] { ImageFormat.Bmp }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [Theory] + [MemberData(nameof(IsDirectPrintingSupported_ImageFormatNotSupported_TestData))] + public void IsDirectPrintingSupported_ImageFormatNotSupported_ReturnsExpected(ImageFormat imageFormat) + { + var printerSettings = new PrinterSettings(); + Assert.Equal(false, printerSettings.IsDirectPrintingSupported(imageFormat)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsDirectPrintingSupported_ImageNotSupported_ReturnsExpected() + { + using (var bitmap = new Bitmap(10, 10)) + { + var printerSettings = new PrinterSettings(); + Assert.Equal(false, printerSettings.IsDirectPrintingSupported(bitmap)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void SupportsColor_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + Assert.Equal(true, printerSettings.SupportsColor); + } + + [Theory] + [InlineData(20)] + [InlineData(int.MaxValue)] + public void ToPage_SetValue_ReturnsExpected(int toPage) + { + var printerSettings = new PrinterSettings() + { + ToPage = toPage + }; + + Assert.Equal(toPage, printerSettings.ToPage); + } + + [Theory] + [InlineData(-1)] + [InlineData(int.MinValue)] + public void ToPage_Invalid_ThrowsArgumentException(int toPage) + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.ToPage = toPage); + } + + [Fact] + public void Clone_Success() + { + var printerSettings = new PrinterSettings(); + PrinterSettings clone = Assert.IsAssignableFrom(printerSettings.Clone()); + Assert.False(ReferenceEquals(clone, printerSettings)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void CreateMeasurementGraphics_Default_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + using (Graphics graphic = printerSettings.CreateMeasurementGraphics()) + { + Assert.NotNull(graphic); + Assert.Equal(printerSettings.DefaultPageSettings.Bounds.X, graphic.VisibleClipBounds.X, 0); + Assert.Equal(printerSettings.DefaultPageSettings.Bounds.Y, graphic.VisibleClipBounds.Y, 0); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Height, graphic.VisibleClipBounds.Height, 0); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Width, graphic.VisibleClipBounds.Width, 0); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void CreateMeasurementGraphics_Bool_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + using (Graphics graphic = printerSettings.CreateMeasurementGraphics(true)) + { + Assert.NotNull(graphic); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Height, graphic.VisibleClipBounds.Height, 0); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Width, graphic.VisibleClipBounds.Width, 0); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void CreateMeasurementGraphics_PageSettings_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + var pageSettings = new PageSettings(); + using (Graphics graphic = printerSettings.CreateMeasurementGraphics(pageSettings)) + { + Assert.NotNull(graphic); + Assert.Equal(printerSettings.DefaultPageSettings.Bounds.X, graphic.VisibleClipBounds.X, 0); + Assert.Equal(printerSettings.DefaultPageSettings.Bounds.Y, graphic.VisibleClipBounds.Y, 0); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Height, graphic.VisibleClipBounds.Height, 0); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Width, graphic.VisibleClipBounds.Width, 0); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.AnyInstalledPrinters, Helpers.GdiplusIsAvailable)] + public void CreateMeasurementGraphics_PageSettingsBool_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + var pageSettings = new PageSettings(); + using (Graphics graphic = printerSettings.CreateMeasurementGraphics(pageSettings, true)) + { + Assert.NotNull(graphic); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Height, graphic.VisibleClipBounds.Height, 0); + Assert.Equal(printerSettings.DefaultPageSettings.PrintableArea.Width, graphic.VisibleClipBounds.Width, 0); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void CreateMeasurementGraphics_Null_ThrowsNullReferenceException() + { + var printerSettings = new PrinterSettings(); + Assert.Throws(() => printerSettings.CreateMeasurementGraphics(null)); + Assert.Throws(() => printerSettings.CreateMeasurementGraphics(null, true)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHdevmode_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + IntPtr handle = IntPtr.Zero; + + handle = printerSettings.GetHdevmode(); + Assert.NotEqual(IntPtr.Zero, handle); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHdevmode_PageSettings_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + var pageSettings = new PageSettings(); + IntPtr handle = IntPtr.Zero; + + handle = printerSettings.GetHdevmode(pageSettings); + Assert.NotEqual(IntPtr.Zero, handle); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHdevmode_Null_ThrowsNullReferenceException() + { + var printerSettings = new PrinterSettings(); + Assert.Throws(() => printerSettings.GetHdevmode(null)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHdevnames_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + IntPtr handle = IntPtr.Zero; + + handle = printerSettings.GetHdevnames(); + Assert.NotEqual(IntPtr.Zero, handle); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetHdevmode_IntPtr_Success() + { + var printerSettings = new PrinterSettings() { Copies = 3 }; + var newPrinterSettings = new PrinterSettings() { Copies = 6 }; + IntPtr handle = printerSettings.GetHdevmode(); + newPrinterSettings.SetHdevmode(handle); + Assert.Equal(printerSettings.Copies, newPrinterSettings.Copies); + Assert.Equal(printerSettings.Collate, newPrinterSettings.Collate); + Assert.Equal(printerSettings.Duplex, newPrinterSettings.Duplex); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHdevmode_Zero_ThrowsArgumentException() + { + var printerSettings = new PrinterSettings(); + AssertExtensions.Throws(null, () => printerSettings.SetHdevmode(IntPtr.Zero)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetHdevnames_IntPtr_Success() + { + var printerSettings = new PrinterSettings(); + var newPrinterSettings = new PrinterSettings(); + IntPtr handle = printerSettings.GetHdevnames(); + newPrinterSettings.SetHdevnames(handle); + Assert.Equal(newPrinterSettings.PrinterName, printerSettings.PrinterName); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ToString_ReturnsExpected() + { + var printerSettings = new PrinterSettings(); + var expected = "[PrinterSettings " + + printerSettings.PrinterName + + " Copies=" + printerSettings.Copies.ToString(CultureInfo.InvariantCulture) + + " Collate=" + printerSettings.Collate.ToString(CultureInfo.InvariantCulture) + + " Duplex=" + printerSettings.Duplex.ToString() + + " FromPage=" + printerSettings.FromPage.ToString(CultureInfo.InvariantCulture) + + " LandscapeAngle=" + printerSettings.LandscapeAngle.ToString(CultureInfo.InvariantCulture) + + " MaximumCopies=" + printerSettings.MaximumCopies.ToString(CultureInfo.InvariantCulture) + + " OutputPort=" + printerSettings.PrintFileName.ToString(CultureInfo.InvariantCulture) + + " ToPage=" + printerSettings.ToPage.ToString(CultureInfo.InvariantCulture) + + "]"; + + Assert.Equal(expected, printerSettings.ToString()); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/RegionTests.cs b/external/corefx/src/System.Drawing.Common/tests/RegionTests.cs new file mode 100644 index 0000000000..7b32c0c329 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/RegionTests.cs @@ -0,0 +1,2548 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Copyright (C) 2004-2008 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.Collections.Generic; +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; +using Xunit; + +namespace System.Drawing.Tests +{ + public class RegionTests + { + private static readonly Graphics s_graphic = Graphics.FromImage(new Bitmap(1, 1)); + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_Default() + { + using (var region = new Region()) + { + Assert.False(region.IsEmpty(s_graphic)); + Assert.True(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF(-4194304, -4194304, 8388608, 8388608), region.GetBounds(s_graphic)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(-1, -2, -3, -4, true)] + [InlineData(0, 0, 0, 0, true)] + [InlineData(1, 2, 3, 4, false)] + public void Ctor_Rectangle(int x, int y, int width, int height, bool isEmpty) + { + var rectangle = new Rectangle(x, y, width, height); + + using (var region = new Region(rectangle)) + { + Assert.Equal(isEmpty, region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF(x, y, width, height), region.GetBounds(s_graphic)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(1, 2, 3, float.NegativeInfinity, true)] + [InlineData(-1, -2, -3, -4, true)] + [InlineData(0, 0, 0, 0, true)] + [InlineData(1, 2, 3, 4, false)] + [InlineData(float.MaxValue, float.MaxValue, float.MaxValue, float.MaxValue, true)] + public void Ctor_RectangleF(float x, float y, float width, float height, bool isEmpty) + { + var rectangle = new RectangleF(x, y, width, height); + + using (var region = new Region(rectangle)) + { + Assert.Equal(isEmpty, region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(rectangle, region.GetBounds(s_graphic)); + } + } + + public static IEnumerable Region_TestData() + { + yield return new object[] { new Region() }; + yield return new object[] { new Region(new Rectangle(0, 0, 0, 0)) }; + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Region_TestData))] + public void Ctor_RegionData(Region region) + { + try + { + using (var otherRegion = new Region(region.GetRegionData())) + using (var matrix = new Matrix()) + { + Assert.Equal(region.GetBounds(s_graphic), otherRegion.GetBounds(s_graphic)); + Assert.Equal(region.GetRegionScans(matrix), otherRegion.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_RegionDataOfRegionWithPath_Success() + { + using (var graphicsPath = new GraphicsPath()) + { + graphicsPath.AddRectangle(new Rectangle(1, 2, 3, 4)); + Ctor_RegionData(new Region(graphicsPath)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_RegionDataOfRegionWithRegionData_Success() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + { + Ctor_RegionData(new Region(region.GetRegionData())); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullRegionData_ThrowsArgumentNullException() + { + AssertExtensions.Throws("rgnData", () => new Region((RegionData)null)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(0)] + [InlineData(1)] + [InlineData(7)] + [InlineData(256)] + public void Ctor_InvalidRegionData_ThrowsExternalException(int dataLength) + { + using (var region = new Region()) + { + RegionData regionData = region.GetRegionData(); + regionData.Data = new byte[dataLength]; + Assert.Throws(() => new Region(regionData)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_EmptyGraphicsPath_ThrowsExternalException() + { + using (var graphicsPath = new GraphicsPath()) + using (var region = new Region(graphicsPath)) + { + RegionData regionData = region.GetRegionData(); + Assert.Throws(() => new Region(regionData)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullDataInRegionData_ThrowsNullReferenceException() + { + using (var region = new Region()) + { + RegionData regionData = region.GetRegionData(); + regionData.Data = null; + Assert.Throws(() => new Region(regionData)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_GraphicsPath() + { + using (var graphicsPath = new GraphicsPath()) + { + graphicsPath.AddRectangle(new Rectangle(1, 2, 3, 4)); + graphicsPath.AddRectangle(new Rectangle(4, 5, 6, 7)); + + using (var region = new Region(graphicsPath)) + using (var matrix = new Matrix()) + { + Assert.Equal(new RectangleF[] + { + new RectangleF(1, 2, 3, 3), + new RectangleF(1, 5, 9, 1), + new RectangleF(4, 6, 6, 6) + }, region.GetRegionScans(matrix)); + Assert.Equal(new RectangleF(1, 2, 9, 10), region.GetBounds(s_graphic)); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_EmptyGraphicsPath() + { + using (var graphicsPath = new GraphicsPath()) + using (var region = new Region(graphicsPath)) + using (var matrix = new Matrix()) + { + Assert.True(region.IsEmpty(s_graphic)); + Assert.Empty(region.GetRegionScans(matrix)); + } + } + + public static IEnumerable Ctor_InfiniteGraphicsPath_TestData() + { + var path1 = new GraphicsPath(); + path1.AddRectangle(new Rectangle(-4194304, -4194304, 8388608, 8388608)); + yield return new object[] { path1, true }; + + var path2 = new GraphicsPath(); + path2.AddRectangle(new Rectangle(-4194304, -4194304, 8388608, 8388608)); + path2.AddRectangle(Rectangle.Empty); + yield return new object[] { path2, true }; + + var path3 = new GraphicsPath(); + path3.AddRectangle(new Rectangle(-4194304, -4194304, 8388608, 8388608)); + path3.AddRectangle(new Rectangle(1, 2, 3, 4)); + yield return new object[] { path3, false }; + + var path4 = new GraphicsPath(); + path4.AddCurve(new Point[] { new Point(-4194304, -4194304), new Point(4194304, 4194304) }); + yield return new object[] { path4, false }; + + var path5 = new GraphicsPath(); + path5.AddPolygon(new Point[] { new Point(-4194304, -4194304), new Point(-4194304, 4194304), new Point(4194304, 4194304), new Point(4194304, -4194304) }); + yield return new object[] { path5, true }; + + var path6 = new GraphicsPath(); + path6.AddPolygon(new Point[] { new Point(-4194304, -4194304), new Point(-4194304, 4194304), new Point(4194304, 4194304), new Point(4194304, -4194304), new Point(-4194304, -4194304) }); + yield return new object[] { path6, true }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Ctor_InfiniteGraphicsPath_TestData))] + public void Ctor_InfiniteGraphicsPath_IsInfinite(GraphicsPath path, bool isInfinite) + { + try + { + using (var region = new Region(path)) + { + Assert.Equal(isInfinite, region.IsInfinite(s_graphic)); + } + } + finally + { + path.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_GraphicsPathTooLarge_SetsToEmpty() + { + using (var path = new GraphicsPath()) + { + path.AddCurve(new Point[] { new Point(-4194304, -4194304), new Point(4194304, 4194304) }); + + using (var region = new Region(path)) + using (var matrix = new Matrix()) + { + Assert.Empty(region.GetRegionScans(matrix)); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_NullGraphicsPath_ThrowsArgumentNullException() + { + AssertExtensions.Throws("path", () => new Region((GraphicsPath)null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Ctor_DisposedGraphicsPath_ThrowsArgumentException() + { + var path = new GraphicsPath(); + path.Dispose(); + + AssertExtensions.Throws(null, () => new Region(path)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Region_TestData))] + public void Clone(Region region) + { + try + { + using (Region clone = Assert.IsType(region.Clone())) + using (var matrix = new Matrix()) + { + Assert.NotSame(region, clone); + + Assert.Equal(region.GetBounds(s_graphic), clone.GetBounds(s_graphic)); + Assert.Equal(region.GetRegionScans(matrix), clone.GetRegionScans(matrix)); + } + } + finally + { + region.Clone(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Clone_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + AssertExtensions.Throws(null, () => region.Clone()); + } + + public static IEnumerable Complement_TestData() + { + yield return new object[] + { + new Region(new RectangleF(10, 10, 100, 100)), + new RectangleF[] { new RectangleF(40, 60, 100, 20) }, + new RectangleF[] { new RectangleF(110, 60, 30, 20) } + }; + + yield return new object[] + { + new Region(new RectangleF(70, 10, 100, 100)), + new RectangleF[] { new RectangleF(40, 60, 100, 20) }, + new RectangleF[] { new RectangleF(40, 60, 30, 20) } + }; + + yield return new object[] + { + new Region(new RectangleF(40, 100, 100, 100)), + new RectangleF[] { new RectangleF(70, 80, 50, 40) }, + new RectangleF[] { new RectangleF(70, 80, 50, 20) } + }; + + yield return new object[] + { + new Region(new RectangleF(40, 10, 100, 100)), + new RectangleF[] { new RectangleF(70, 80, 50, 40) }, + new RectangleF[] { new RectangleF(70, 110, 50, 10) } + }; + + yield return new object[] + { + new Region(new RectangleF(30, 30, 80, 80)), + new RectangleF[] + { + new RectangleF(45, 45, 200, 200), + new RectangleF(160, 260, 10, 10), + new RectangleF(170, 260, 10, 10), + }, + new RectangleF[] { new RectangleF(170, 260, 10, 10) } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[0] + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { new RectangleF(1, 2, 3, 4) }, + new RectangleF[0] + }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Complement_TestData))] + public void Complement_Region_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var other = new Region(rect)) + { + region.Complement(other); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_UnionRegion_Success() + { + using (var region = new Region(new Rectangle(20, 20, 20, 20))) + using (var other = new Region(new Rectangle(20, 80, 20, 10))) + using (var matrix = new Matrix()) + { + other.Union(new Rectangle(60, 60, 30, 10)); + + region.Complement(other); + Assert.Equal(new RectangleF[] + { + new RectangleF(60, 60, 30, 10), + new RectangleF(20, 80, 20, 10) + }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_InfiniteAndWithIntersectRegion_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + { + region.Intersect(new Rectangle(5, 5, -10, -10)); + region.Complement(new Rectangle(-5, -5, 12, 12)); + + Assert.False(region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] + { + new RectangleF(5, -5, 2, 10), + new RectangleF(-5, 5, 12, 2) + }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_InfiniteRegion_Success() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + using (var matrix = new Matrix()) + using (var other = new Region()) + { + region.Complement(other); + + Assert.Equal(new RectangleF[] + { + new RectangleF(-4194304, -4194304, 8388608, 4194306), + new RectangleF(-4194304, 2, 4194305, 4), + new RectangleF(4, 2, 4194300, 4), + new RectangleF(-4194304, 6, 8388608, 4194298) + }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_NullRegion_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("region", () => region.Complement((Region)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_DisposedRegion_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => new Region().Complement(region)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_SameRegion_ThrowsInvalidOperationException() + { + using (var region = new Region()) + { + Assert.Throws(() => region.Complement(region)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Complement_TestData))] + public void Complement_Rectangle_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Complement(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height)); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Complement_TestData))] + public void Complement_RectangleF_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Complement(rect); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Complement_TestData))] + public void Complement_GraphicsPath_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + foreach (RectangleF rect in rectangles) + { + using (var path = new GraphicsPath()) + { + path.AddRectangle(rect); + region.Complement(path); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + + [ActiveIssue(24525, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_GraphicsPathWithMultipleRectangles_Success() + { + Graphics graphics = Graphics.FromImage(new Bitmap(600, 800)); + + var rect1 = new Rectangle(20, 30, 60, 80); + var rect2 = new Rectangle(50, 40, 60, 80); + using (var region1 = new Region(rect1)) + using (var region2 = new Region(rect2)) + using (var matrix = new Matrix()) + { + graphics.DrawRectangle(Pens.Green, rect1); + graphics.DrawRectangle(Pens.Red, rect2); + + region1.Complement(region2); + graphics.FillRegion(Brushes.Blue, region1); + graphics.DrawRectangles(Pens.Yellow, region1.GetRegionScans(matrix)); + + Assert.Equal(new RectangleF[] + { + new RectangleF(80, 40, 30, 70), + new RectangleF(50, 110, 60, 10) + }, region1.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_EmptyPathWithInfiniteRegion_MakesEmpty() + { + using (var region = new Region()) + using (var graphicsPath = new GraphicsPath()) + { + region.Complement(graphicsPath); + Assert.True(region.IsEmpty(s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_NullGraphicsPath_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("path", () => region.Complement((GraphicsPath)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Complement_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var graphicPath = new GraphicsPath()) + using (var other = new Region()) + { + AssertExtensions.Throws(null, () => region.Complement(graphicPath)); + AssertExtensions.Throws(null, () => region.Complement(new Rectangle())); + AssertExtensions.Throws(null, () => region.Complement(new RectangleF())); + AssertExtensions.Throws(null, () => region.Complement(region)); + } + } + + public static IEnumerable Equals_TestData() + { + Func empty = () => + { + var emptyRegion = new Region(); + emptyRegion.MakeEmpty(); + return emptyRegion; + }; + + var createdRegion = new Region(); + yield return new object[] { createdRegion, createdRegion, true }; + yield return new object[] { new Region(), new Region(), true }; + yield return new object[] { new Region(), empty(), false }; + yield return new object[] { new Region(), new Region(new Rectangle(1, 2, 3, 4)), false }; + + yield return new object[] { empty(), empty(), true }; + yield return new object[] { empty(), new Region(new Rectangle(0, 0, 0, 0)), true }; + yield return new object[] { empty(), new Region(new Rectangle(1, 2, 3, 3)), false }; + + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)), new Region(new Rectangle(1, 2, 3, 4)), true }; + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)), new Region(new RectangleF(1, 2, 3, 4)), true }; + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)), new Region(new Rectangle(2, 2, 3, 4)), false }; + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)), new Region(new Rectangle(1, 3, 3, 4)), false }; + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)), new Region(new Rectangle(1, 2, 4, 4)), false }; + yield return new object[] { new Region(new Rectangle(1, 2, 3, 4)), new Region(new Rectangle(1, 2, 3, 5)), false }; + + var graphics1 = new GraphicsPath(); + graphics1.AddRectangle(new Rectangle(1, 2, 3, 4)); + + var graphics2 = new GraphicsPath(); + graphics2.AddRectangle(new Rectangle(1, 2, 3, 4)); + + var graphics3 = new GraphicsPath(); + graphics3.AddRectangle(new Rectangle(2, 2, 3, 4)); + + var graphics4 = new GraphicsPath(); + graphics4.AddRectangle(new Rectangle(1, 3, 3, 4)); + + var graphics5 = new GraphicsPath(); + graphics5.AddRectangle(new Rectangle(1, 2, 4, 4)); + + var graphics6 = new GraphicsPath(); + graphics6.AddRectangle(new Rectangle(1, 2, 3, 5)); + + yield return new object[] { new Region(graphics1), new Region(graphics1), true }; + yield return new object[] { new Region(graphics1), new Region(graphics2), true }; + yield return new object[] { new Region(graphics1), new Region(graphics3), false }; + yield return new object[] { new Region(graphics1), new Region(graphics4), false }; + yield return new object[] { new Region(graphics1), new Region(graphics5), false }; + yield return new object[] { new Region(graphics1), new Region(graphics6), false }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Equals_TestData))] + public void Equals_Valid_ReturnsExpected(Region region, Region other, bool expected) + { + try + { + Assert.Equal(expected, region.Equals(other, s_graphic)); + } + finally + { + region.Dispose(); + other.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Equals_NullRegion_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("region", () => region.Equals(null, s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Equals_NullGraphics_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("g", () => region.Equals(region, null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Equals_DisposedGraphics_ThrowsArgumentException() + { + using (var region = new Region()) + using (var other = new Region()) + using (var image = new Bitmap(10, 10)) + { + var graphics = Graphics.FromImage(image); + graphics.Dispose(); + AssertExtensions.Throws(null, () => region.Equals(region, graphics)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Equals_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.Equals(new Region(), s_graphic)); + AssertExtensions.Throws(null, () => new Region().Equals(region, s_graphic)); + } + + public static IEnumerable Exclude_TestData() + { + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { new RectangleF(500, 30, 60, 80) }, + new RectangleF[0] + }; + + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[] { new RectangleF(500, 30, 60, 80) } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { new RectangleF(520, 40, 60, 80) }, + new RectangleF[] + { + new RectangleF(-4194304, -4194304, 8388608, 4194344), + new RectangleF(-4194304, 40, 4194824, 80), + new RectangleF(580, 40, 4193724, 80), + new RectangleF(-4194304, 120, 8388608, 4194184) + } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[] { new Rectangle(-4194304, -4194304, 8388608, 8388608) } + }; + + // Intersecting from the right. + yield return new object[] + { + new Region(new Rectangle(10, 10, 100, 100)), + new RectangleF[] { new RectangleF(40, 60, 100, 20) }, + new RectangleF[] + { + new RectangleF(10, 10, 100, 50), + new RectangleF(10, 60, 30, 20), + new RectangleF(10, 80, 100, 30) + } + }; + + // Intersecting from the left. + yield return new object[] + { + new Region(new Rectangle(70, 10, 100, 100)), + new RectangleF[] { new RectangleF(40, 60, 100, 20) }, + new RectangleF[] + { + new RectangleF(70, 10, 100, 50), + new RectangleF(140, 60, 30, 20), + new RectangleF(70, 80, 100, 30) + } + }; + + // Intersecting from the top. + yield return new object[] + { + new Region(new Rectangle(40, 100, 100, 100)), + new RectangleF[] { new RectangleF(70, 80, 50, 40) }, + new RectangleF[] + { + new RectangleF(40, 100, 30, 20), + new RectangleF(120, 100, 20, 20), + new RectangleF(40, 120, 100, 80) + } + }; + + // Intersecting from the bottom. + yield return new object[] + { + new Region(new Rectangle(40, 10, 100, 100)), + new RectangleF[] { new RectangleF(70, 80, 50, 40) }, + new RectangleF[] + { + new RectangleF(40, 10, 100, 70), + new RectangleF(40, 80, 30, 30), + new RectangleF(120, 80, 20, 30) + } + }; + + // Multiple regions. + yield return new object[] + { + new Region(new Rectangle(30, 30, 80, 80)), + new RectangleF[] + { + new RectangleF(45, 45, 200, 200), + new RectangleF(160, 260, 10, 10), + new RectangleF(170, 260, 10, 10) + }, + new RectangleF[] + { + new RectangleF(30, 30, 80, 15), + new RectangleF(30, 45, 15, 65) + } + }; + + // Intersecting from the top with a larger rect. + yield return new object[] + { + new Region(new Rectangle(50, 100, 100, 100)), + new RectangleF[] { new RectangleF(30, 70, 150, 40) }, + new RectangleF[] { new RectangleF(50, 110, 100, 90) } + }; + + // Intersecting from the right with a larger rect. + yield return new object[] + { + new Region(new Rectangle(70, 60, 100, 70)), + new RectangleF[] { new RectangleF(40, 10, 100, 150) }, + new RectangleF[] { new RectangleF(140, 60, 30, 70) } + }; + + // Intersecting from the left with a larger rect. + yield return new object[] + { + new Region(new Rectangle(70, 60, 100, 70)), + new RectangleF[] { new RectangleF(100, 10, 100, 150) }, + new RectangleF[] { new RectangleF(70, 60, 30, 70) } + }; + + // Intersecting from the bottom with a larger rect. + yield return new object[] + { + new Region(new Rectangle(20, 20, 100, 100)), + new RectangleF[] { new RectangleF(10, 80, 140, 150) }, + new RectangleF[] { new RectangleF(20, 20, 100, 60) } + }; + + yield return new object[] + { + new Region(new Rectangle(130, 30, 60, 80)), + new RectangleF[] { new RectangleF(170, 40, 60, 80) }, + new RectangleF[] + { + new RectangleF(130, 30, 60, 10), + new RectangleF(130, 40, 40, 70) + } + }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Exclude_TestData))] + public void Exclude_Region_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + foreach (RectangleF rect in rectangles) + { + using (var other = new Region(rect)) + { + region.Exclude(other); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_UnionRegion_Success() + { + using (var region = new Region(new RectangleF(20, 20, 20, 20))) + using (var union = new Region(new RectangleF(20, 80, 20, 10))) + using (var matrix = new Matrix()) + { + union.Union(new RectangleF(60, 60, 30, 10)); + region.Exclude(union); + Assert.Equal(new RectangleF[] { new RectangleF(20, 20, 20, 20) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_InfiniteRegion_Success() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + using (var other = new Region()) + using (var matrix = new Matrix()) + { + region.Exclude(other); + Assert.Equal(new RectangleF[0], region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_NullRegion_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("region", () => region.Exclude((Region)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_DisposedRegion_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => new Region().Exclude(region)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_SameRegion_ThrowsInvalidOperationException() + { + using (var region = new Region()) + { + Assert.Throws(() => region.Exclude(region)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Exclude_TestData))] + public void Exclude_Rectangle_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Exclude(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height)); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Exclude_TestData))] + public void Exclude_RectangleF_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Exclude(rect); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Exclude_TestData))] + public void Exclude_GraphicsPath_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var path = new GraphicsPath()) + { + path.AddRectangle(rect); + region.Exclude(path); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_EmptyPathWithInfiniteRegion_MakesInfinite() + { + using (var region = new Region()) + using (var graphicsPath = new GraphicsPath()) + { + region.Exclude(graphicsPath); + Assert.True(region.IsInfinite(s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_NullGraphicsPath_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("path", () => region.Exclude((GraphicsPath)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Exclude_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var graphicsPath = new GraphicsPath()) + using (var other = new Region()) + { + AssertExtensions.Throws(null, () => region.Exclude(graphicsPath)); + AssertExtensions.Throws(null, () => region.Exclude(new Rectangle())); + AssertExtensions.Throws(null, () => region.Exclude(new RectangleF())); + AssertExtensions.Throws(null, () => region.Exclude(other)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void FromHrgn_ValidHrgn_ReturnsExpected() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + { + IntPtr handle1 = region.GetHrgn(s_graphic); + IntPtr handle2 = region.GetHrgn(s_graphic); + Assert.NotEqual(IntPtr.Zero, handle1); + Assert.NotEqual(handle1, handle2); + + Region newRegion = Region.FromHrgn(handle1); + IntPtr handle3 = newRegion.GetHrgn(s_graphic); + Assert.NotEqual(handle3, handle1); + Assert.Equal(new RectangleF(1, 2, 3, 4), newRegion.GetBounds(s_graphic)); + + region.ReleaseHrgn(handle1); + region.ReleaseHrgn(handle2); + newRegion.ReleaseHrgn(handle3); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void FromHrgn_ZeroHrgn_ThrowsArgumentException() + { + AssertExtensions.Throws(null, () => Region.FromHrgn(IntPtr.Zero)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHrgn_Infinite_ReturnsZero() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + { + IntPtr handle = region.GetHrgn(s_graphic); + Assert.NotEqual(IntPtr.Zero, handle); + region.ReleaseHrgn(handle); + + region.MakeInfinite(); + Assert.Equal(IntPtr.Zero, region.GetHrgn(s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHrgn_Empty_ReturnsNonZero() + { + using (var region = new Region()) + { + Assert.Equal(IntPtr.Zero, region.GetHrgn(s_graphic)); + + region.MakeEmpty(); + IntPtr handle = region.GetHrgn(s_graphic); + Assert.NotEqual(IntPtr.Zero, handle); + region.ReleaseHrgn(handle); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHrgn_NullGraphics_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("g", () => region.GetHrgn(null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetHrgn_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.GetHrgn(s_graphic)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void ReleaseHrgn_ZeroHandle_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("regionHandle", () => region.ReleaseHrgn(IntPtr.Zero)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetBounds_NullGraphics_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("g", () => region.GetBounds(null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetBounds_DisposedGraphics_ThrowsArgumentException() + { + using (var region = new Region()) + using (var image = new Bitmap(10, 10)) + { + var graphics = Graphics.FromImage(image); + graphics.Dispose(); + AssertExtensions.Throws(null, () => region.GetBounds(graphics)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetBounds_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.GetBounds(s_graphic)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetRegionData_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.GetRegionData()); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetRegionScans_CustomMatrix_TransformsRegionScans() + { + using (var matrix = new Matrix()) + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + using (var emptyMatrix = new Matrix()) + { + matrix.Translate(10, 11); + matrix.Scale(5, 6); + + Assert.Equal(new RectangleF[] { new RectangleF(1, 2, 3, 4) }, region.GetRegionScans(emptyMatrix)); + Assert.Equal(new RectangleF[] { new RectangleF(15, 23, 15, 24) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetRegionScans_NullMatrix_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("matrix", () => region.GetRegionScans(null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetRegionScans_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var matrix = new Matrix()) + { + AssertExtensions.Throws(null, () => region.GetRegionScans(matrix)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetRegionScans_DisposedMatrix_ThrowsArgumentException() + { + using (var region = new Region()) + { + var matrix = new Matrix(); + matrix.Dispose(); + AssertExtensions.Throws(null, () => region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_SmallerRect_Success() + { + using (var clipRegion = new Region()) + using (var matrix = new Matrix()) + { + Rectangle smaller = new Rectangle(5, 5, -10, -10); + + clipRegion.Intersect(smaller); + Assert.False(clipRegion.IsEmpty(s_graphic)); + Assert.False(clipRegion.IsInfinite(s_graphic)); + + RectangleF[] rects = clipRegion.GetRegionScans(matrix); + Assert.Equal(1, rects.Length); + Assert.Equal(new RectangleF(-5, -5, 10, 10), rects[0]); + } + } + + public static IEnumerable Intersect_TestData() + { + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { new RectangleF(500, 30, 60, 80) }, + new RectangleF[] { new RectangleF(500, 30, 60, 80) } + }; + yield return new object[] + { + new Region(new Rectangle(0, 0, 0, 0)), + new RectangleF[] { new RectangleF(500, 30, 60, 80) }, + new RectangleF[0] + }; + + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[0] + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { new RectangleF(520, 40, 60, 80) }, + new RectangleF[] { new Rectangle(520, 40, 60, 80) } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[0] + }; + + yield return new object[] + { + new Region(new RectangleF(260, 30, 60, 80)), + new RectangleF[] { new RectangleF(290, 40, 60, 90) }, + new RectangleF[] { new RectangleF(290, 40, 30, 70) } + }; + + yield return new object[] + { + new Region(new RectangleF(20, 330, 40, 50)), + new RectangleF[] + { + new RectangleF(50, 340, 40, 50), + new RectangleF(70, 360, 30, 50), + new RectangleF(80, 400, 30, 10) + }, + new RectangleF[0] + }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Intersect_TestData))] + public void Intersect_Region_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Intersect(new Region(rect)); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_InfiniteRegion_Success() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + using (var matrix = new Matrix()) + { + region.Intersect(new Region()); + + Assert.Equal(new RectangleF[] { new Rectangle(1, 2, 3, 4) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_NullRegion_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("region", () => region.Intersect((Region)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_DisposedRegion_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => new Region().Intersect(region)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_SameRegion_ThrowsInvalidOperationException() + { + using (var region = new Region()) + { + Assert.Throws(() => region.Intersect(region)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Intersect_TestData))] + public void Intersect_Rectangle_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Intersect(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height)); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_InfiniteRegionWithSmallerRectangle_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + { + region.Intersect(new Rectangle(5, 5, -10, -10)); + + Assert.False(region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(-5, -5, 10, 10) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Intersect_TestData))] + public void Intersect_RectangleF_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Intersect(rect); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_InfiniteRegionWithSmallerRectangleF_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + { + region.Intersect(new RectangleF(5, 5, -10, -10)); + + Assert.False(region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(-5, -5, 10, 10) }, region.GetRegionScans(matrix)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Intersect_TestData))] + public void Intersect_GraphicsPath_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var path = new GraphicsPath()) + { + path.AddRectangle(rect); + region.Intersect(path); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_EmptyPathWithInfiniteRegion_MakesEmpty() + { + using (var region = new Region()) + using (var graphicsPath = new GraphicsPath()) + { + region.Intersect(graphicsPath); + Assert.True(region.IsEmpty(s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_NullGraphicsPath_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("path", () => region.Intersect((GraphicsPath)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Intersect_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var graphicsPath = new GraphicsPath()) + using (var other = new Region()) + { + AssertExtensions.Throws(null, () => region.Intersect(graphicsPath)); + AssertExtensions.Throws(null, () => region.Intersect(new Rectangle())); + AssertExtensions.Throws(null, () => region.Intersect(new RectangleF())); + AssertExtensions.Throws(null, () => region.Intersect(other)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsEmpty_NullGraphics_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("g", () => region.IsEmpty(null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsEmpty_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.IsEmpty(s_graphic)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsInfinite_NullGraphics_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("g", () => region.IsInfinite(null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsInfinite_DisposedGraphics_ThrowsArgumentException() + { + using (var region = new Region()) + using (var image = new Bitmap(10, 10)) + { + var graphics = Graphics.FromImage(image); + graphics.Dispose(); + AssertExtensions.Throws(null, () => region.IsInfinite(graphics)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsInfinite_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.IsInfinite(s_graphic)); + } + + public static IEnumerable IsVisible_Rectangle_TestData() + { + var infiniteExclude = new Region(); + infiniteExclude.Exclude(new Rectangle(387, 292, 189, 133)); + infiniteExclude.Exclude(new Rectangle(387, 66, 189, 133)); + + yield return new object[] { infiniteExclude, new Rectangle(66, 292, 189, 133), true }; + yield return new object[] { new Region(), Rectangle.Empty, false }; + + yield return new object[] { new Region(new Rectangle(0, 0, 10, 10)), new Rectangle(0, 0, 0, 1), false }; + yield return new object[] { new Region(new Rectangle(500, 30, 60, 80)), new Rectangle(500, 30, 60, 80), true }; + yield return new object[] { new Region(new Rectangle(500, 30, 60, 80)), new Rectangle(520, 40, 60, 80), true }; + + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(1, 1, 2, 1), true }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(1, 1, 2, 2), true }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(1, 1, 10, 10), true }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(1, 1, 1, 1), true }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(2, 2, 1, 1), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(0, 0, 1, 1), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Rectangle(3, 3, 1, 1), false }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(IsVisible_Rectangle_TestData))] + public void IsVisible_Rectangle_ReturnsExpected(Region region, Rectangle rectangle, bool expected) + { + try + { + using (var image = new Bitmap(10, 10)) + { + var disposedGraphics = Graphics.FromImage(image); + disposedGraphics.Dispose(); + + Assert.Equal(expected, region.IsVisible(rectangle)); + Assert.Equal(expected, region.IsVisible((RectangleF)rectangle)); + Assert.Equal(expected, region.IsVisible(rectangle, s_graphic)); + Assert.Equal(expected, region.IsVisible(rectangle, disposedGraphics)); + Assert.Equal(expected, region.IsVisible(rectangle, null)); + Assert.Equal(expected, region.IsVisible((RectangleF)rectangle, s_graphic)); + Assert.Equal(expected, region.IsVisible((RectangleF)rectangle, disposedGraphics)); + Assert.Equal(expected, region.IsVisible((RectangleF)rectangle, null)); + + Assert.Equal(expected, region.IsVisible(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height)); + Assert.Equal(expected, region.IsVisible((float)rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height)); + Assert.Equal(expected, region.IsVisible(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, s_graphic)); + Assert.Equal(expected, region.IsVisible(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, disposedGraphics)); + Assert.Equal(expected, region.IsVisible(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, null)); + Assert.Equal(expected, region.IsVisible((float)rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, s_graphic)); + Assert.Equal(expected, region.IsVisible((float)rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, disposedGraphics)); + Assert.Equal(expected, region.IsVisible((float)rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, null)); + } + } + finally + { + region.Dispose(); + } + } + + public static IEnumerable IsVisible_Point_TestData() + { + var infiniteExclude = new Region(); + infiniteExclude.Exclude(new Rectangle(387, 292, 189, 133)); + infiniteExclude.Exclude(new Rectangle(387, 66, 189, 133)); + + yield return new object[] { infiniteExclude, new Point(66, 292), true }; + yield return new object[] { new Region(), Point.Empty, true }; + + yield return new object[] { new Region(new Rectangle(500, 30, 60, 80)), new Point(500, 29), false }; + yield return new object[] { new Region(new Rectangle(500, 30, 60, 80)), new Point(500, 30), true }; + + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(0, 1), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(1, 0), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(2, 0), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(3, 0), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(1, 1), true }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(2, 1), true }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(3, 1), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(0, 2), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(2, 2), false }; + yield return new object[] { new Region(new Rectangle(1, 1, 2, 1)), new Point(3, 2), false }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(IsVisible_Point_TestData))] + public void IsVisible_Point_ReturnsExpected(Region region, Point point, bool expected) + { + try + { + using (var image = new Bitmap(10, 10)) + { + var disposedGraphics = Graphics.FromImage(image); + disposedGraphics.Dispose(); + + Assert.Equal(expected, region.IsVisible(point)); + Assert.Equal(expected, region.IsVisible((PointF)point)); + Assert.Equal(expected, region.IsVisible(point, s_graphic)); + Assert.Equal(expected, region.IsVisible(point, disposedGraphics)); + Assert.Equal(expected, region.IsVisible(point, null)); + Assert.Equal(expected, region.IsVisible((PointF)point, s_graphic)); + Assert.Equal(expected, region.IsVisible((PointF)point, disposedGraphics)); + Assert.Equal(expected, region.IsVisible((PointF)point, null)); + + Assert.Equal(expected, region.IsVisible(point.X, point.Y)); + Assert.Equal(expected, region.IsVisible(point.X, point.Y, s_graphic)); + Assert.Equal(expected, region.IsVisible(point.X, point.Y, disposedGraphics)); + Assert.Equal(expected, region.IsVisible(point.X, point.Y, null)); + + Assert.Equal(expected, region.IsVisible(point.X, point.Y, s_graphic)); + Assert.Equal(expected, region.IsVisible(point.X, point.Y, disposedGraphics)); + Assert.Equal(expected, region.IsVisible(point.X, point.Y, null)); + Assert.Equal(expected, region.IsVisible((float)point.X, point.Y, s_graphic)); + Assert.Equal(expected, region.IsVisible((float)point.X, point.Y, disposedGraphics)); + Assert.Equal(expected, region.IsVisible((float)point.X, point.Y, null)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void IsVisible_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.IsVisible(1f, 2f)); + AssertExtensions.Throws(null, () => region.IsVisible(new PointF(1, 2))); + AssertExtensions.Throws(null, () => region.IsVisible(new Point(1, 2))); + + AssertExtensions.Throws(null, () => region.IsVisible(1f, 2f, s_graphic)); + AssertExtensions.Throws(null, () => region.IsVisible(new PointF(1, 2), s_graphic)); + AssertExtensions.Throws(null, () => region.IsVisible(new Point(1, 2), s_graphic)); + + AssertExtensions.Throws(null, () => region.IsVisible(1f, 2f, 3f, 4f)); + AssertExtensions.Throws(null, () => region.IsVisible(new Rectangle(1, 2, 3, 4))); + AssertExtensions.Throws(null, () => region.IsVisible(new RectangleF(1, 2, 3, 4))); + + AssertExtensions.Throws(null, () => region.IsVisible(1f, 2f, 3f, 4f, s_graphic)); + AssertExtensions.Throws(null, () => region.IsVisible(new Rectangle(1, 2, 3, 4), s_graphic)); + AssertExtensions.Throws(null, () => region.IsVisible(new RectangleF(1, 2, 3, 4), s_graphic)); + + AssertExtensions.Throws(null, () => region.IsVisible(1, 2, s_graphic)); + AssertExtensions.Throws(null, () => region.IsVisible(1, 2, 3, 4)); + AssertExtensions.Throws(null, () => region.IsVisible(1, 2, 3, 4, s_graphic)); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Region_TestData))] + public void MakeEmpty_NonEmpty_Success(Region region) + { + try + { + region.MakeEmpty(); + Assert.True(region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(RectangleF.Empty, region.GetBounds(s_graphic)); + + using (var matrix = new Matrix()) + { + Assert.Empty(region.GetRegionScans(matrix)); + } + + region.MakeEmpty(); + Assert.True(region.IsEmpty(s_graphic)); + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void MakeEmpty_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.MakeEmpty()); + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Region_TestData))] + public void MakeInfinite_NonInfinity_Success(Region region) + { + try + { + region.MakeInfinite(); + Assert.False(region.IsEmpty(s_graphic)); + Assert.True(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF(-4194304, -4194304, 8388608, 8388608), region.GetBounds(s_graphic)); + + region.MakeInfinite(); + Assert.False(region.IsEmpty(s_graphic)); + Assert.True(region.IsInfinite(s_graphic)); + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void MakeInfinite_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.MakeInfinite()); + } + + public static IEnumerable Union_TestData() + { + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { new RectangleF(500, 30, 60, 80) }, + new RectangleF[] { new RectangleF(500, 30, 60, 80) } + }; + + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[] { new RectangleF(500, 30, 60, 80) } + }; + + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { new RectangleF(520, 30, 60, 80) }, + new RectangleF[] { new RectangleF(500, 30, 80, 80) } + }; + + yield return new object[] + { + new Region(new Rectangle(500, 30, 60, 80)), + new RectangleF[] { new RectangleF(520, 40, 60, 80) }, + new RectangleF[] + { + new RectangleF(500, 30, 60, 10), + new RectangleF(500, 40, 80, 70), + new RectangleF(520, 110, 60, 10), + } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { new RectangleF(520, 40, 60, 80) }, + new RectangleF[] { new Rectangle(-4194304, -4194304, 8388608, 8388608) } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[] { new Rectangle(-4194304, -4194304, 8388608, 8388608) } + }; + + // No intersecting rects. + yield return new object[] + { + new Region(new Rectangle(20, 20, 20, 20)), + new RectangleF[] + { + new RectangleF(20, 80, 20, 10), + new RectangleF(60, 60, 30, 10) + }, + new RectangleF[] + { + new RectangleF(20, 20, 20, 20), + new RectangleF(60, 60, 30, 10), + new RectangleF(20, 80, 20, 10) + } + }; + + yield return new object[] + { + new Region(new Rectangle(20, 180, 40, 50)), + new RectangleF[] + { + new RectangleF(50, 190, 40, 50), + new RectangleF(70, 210, 30, 50) + }, + new RectangleF[] + { + new RectangleF(20, 180, 40, 10), + new RectangleF(20, 190, 70, 20), + new RectangleF(20, 210, 80, 20), + new RectangleF(50, 230, 50, 10), + new RectangleF(70, 240, 30, 20) + } + }; + + yield return new object[] + { + new Region(new Rectangle(20, 330, 40, 50)), + new RectangleF[] + { + new RectangleF(50, 340, 40, 50), + new RectangleF(70, 360, 30, 50), + new RectangleF(80, 400, 30, 10) + }, + new RectangleF[] + { + new RectangleF(20, 330, 40, 10), + new RectangleF(20, 340, 70, 20), + new RectangleF(20, 360, 80, 20), + new RectangleF(50, 380, 50, 10), + new RectangleF(70, 390, 30, 10), + new RectangleF(70, 400, 40, 10) + } + }; + + yield return new object[] + { + new Region(new Rectangle(10, 20, 50, 50)), + new RectangleF[] + { + new RectangleF(100, 100, 60, 60), + new RectangleF(200, 200, 80, 80) + }, + new RectangleF[] + { + new RectangleF(10, 20, 50, 50), + new RectangleF(100, 100, 60, 60), + new RectangleF(200, 200, 80, 80) + } + }; + + // Intersecting from the right. + yield return new object[] + { + new Region(new Rectangle(10, 10, 100, 100)), + new RectangleF[] { new RectangleF(40, 60, 100, 20) }, + new RectangleF[] + { + new RectangleF(10, 10, 100, 50), + new RectangleF(10, 60, 130, 20), + new RectangleF(10, 80, 100, 30) + } + }; + + // Intersecting from the left. + yield return new object[] + { + new Region(new Rectangle(70, 10, 100, 100)), + new RectangleF[] { new RectangleF(40, 60, 100, 20) }, + new RectangleF[] + { + new RectangleF(70, 10, 100, 50), + new RectangleF(40, 60, 130, 20), + new RectangleF(70, 80, 100, 30) + } + }; + + // Intersecting from the top. + yield return new object[] + { + new Region(new Rectangle(40, 100, 100, 100)), + new RectangleF[] { new RectangleF(70, 80, 50, 40) }, + new RectangleF[] + { + new RectangleF(70, 80, 50, 20), + new RectangleF(40, 100, 100, 100) + } + }; + + // Intersecting from the bottom. + yield return new object[] + { + new Region(new Rectangle(40, 10, 100, 100)), + new RectangleF[] { new RectangleF(70, 80, 50, 40) }, + new RectangleF[] + { + new RectangleF(40, 10, 100, 100), + new RectangleF(70, 110, 50, 10) + } + }; + + // Multiple regions separated by 0 pixels. + yield return new object[] + { + new Region(new Rectangle(30, 30, 80, 80)), + new RectangleF[] + { + new RectangleF(45, 45, 200, 200), + new RectangleF(160, 260, 10, 10), + new RectangleF(170, 260, 10, 10) + }, + new RectangleF[] + { + new RectangleF(30, 30, 80, 15), + new RectangleF(30, 45, 215, 65), + new RectangleF(45, 110, 200, 135), + new RectangleF(160, 260, 20, 10) + } + }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Union_TestData))] + public void Union_Region_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var other = new Region(rect)) + { + region.Union(other); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_InfiniteRegion_Success() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + using (var other = new Region()) + using (var matrix = new Matrix()) + { + region.Union(other); + + Assert.Equal(new RectangleF[] { new Rectangle(-4194304, -4194304, 8388608, 8388608) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_NullRegion_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("region", () => region.Union((Region)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_DisposedRegion_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => new Region().Union(region)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_SameRegion_ThrowsInvalidOperationException() + { + using (var region = new Region()) + { + Assert.Throws(() => region.Union(region)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Union_TestData))] + public void Union_Rectangle_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Union(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height)); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Union_TestData))] + public void Union_RectangleF_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Union(rect); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Union_TestData))] + public void Union_GraphicsPath_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var path = new GraphicsPath()) + { + path.AddRectangle(rect); + region.Union(path); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_EmptyPathWithInfiniteRegion_MakesInfinite() + { + using (var region = new Region()) + using (var graphicsPath = new GraphicsPath()) + { + region.Union(graphicsPath); + Assert.True(region.IsInfinite(s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_NullGraphicsPath_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("path", () => region.Union((GraphicsPath)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Union_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var graphicsPath = new GraphicsPath()) + using (var other = new Region()) + { + AssertExtensions.Throws(null, () => region.Union(graphicsPath)); + AssertExtensions.Throws(null, () => region.Union(new Rectangle())); + AssertExtensions.Throws(null, () => region.Union(new RectangleF())); + AssertExtensions.Throws(null, () => region.Union(region)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Transform_EmptyMatrix_Nop() + { + using (var region = new Region(new RectangleF(1, 2, 3, 4))) + using (var matrix = new Matrix()) + { + region.Transform(matrix); + Assert.Equal(new RectangleF[] { new RectangleF(1, 2, 3, 4) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Transform_CustomMatrix_Success() + { + using (var region = new Region(new RectangleF(1, 2, 3, 4))) + using (var matrix = new Matrix()) + using (var emptyMatrix = new Matrix()) + { + matrix.Translate(10, 11); + matrix.Scale(5, 6); + + region.Transform(matrix); + Assert.Equal(new RectangleF[] { new RectangleF(15, 23, 15, 24) }, region.GetRegionScans(emptyMatrix)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(1, 2, 0, 0, 0)] + [InlineData(0, 0, 2, 2, 0)] + [InlineData(0, 0, 0.5, 0.5, 0)] + [InlineData(0, 0, 1, 1, 45)] + public void Transform_Infinity_Nop(int x, int y, float scaleX, float scaleY, int angle) + { + using (var region = new Region()) + using (var matrix = new Matrix()) + using (var emptyMatrix = new Matrix()) + { + matrix.Translate(10, 11); + matrix.Scale(scaleX, scaleY); + matrix.Rotate(angle); + + region.Transform(matrix); + Assert.True(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(-4194304, -4194304, 8388608, 8388608) }, region.GetRegionScans(emptyMatrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Tranform_InfinityIntersectScale_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + using (var emptyMatrix = new Matrix()) + { + matrix.Scale(2, 0.5f); + + region.Intersect(new Rectangle(-10, -10, 20, 20)); + region.Transform(matrix); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(-20, -5, 40, 10) }, region.GetRegionScans(emptyMatrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Tranform_InfinityIntersectTransform_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix(2, 0, 0, 0.5f, 10, 10)) + using (var emptyMatrix = new Matrix()) + { + region.Intersect(new Rectangle(-10, -10, 20, 20)); + region.Transform(matrix); + + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(-10, 5, 40, 10) }, region.GetRegionScans(emptyMatrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Transform_NullMatrix_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("matrix", () => region.Transform(null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Transform_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var matrix = new Matrix()) + { + AssertExtensions.Throws(null, () => region.Transform(matrix)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(0, 0)] + [InlineData(2, 3)] + [InlineData(-2, -3)] + public void Translate_Int_Success(float dx, float dy) + { + using (var region = new Region(new RectangleF(1, 2, 3, 4))) + using (var matrix = new Matrix()) + { + region.Translate(dx, dy); + Assert.Equal(new RectangleF[] { new RectangleF(1 + dx, 2 + dy, 3, 4) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Translate_IntInfinityIntersect_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + { + region.Intersect(new Rectangle(-10, -10, 20, 20)); + region.Translate(10, 10); + + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(0, 0, 20, 20) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(0, 0)] + [InlineData(2, 3)] + public void Translate_Float_Success(int dx, int dy) + { + using (var region = new Region(new RectangleF(1, 2, 3, 4))) + using (var matrix = new Matrix()) + { + region.Translate(dx, dy); + Assert.Equal(new RectangleF[] { new RectangleF(1 + dx, 2 + dy, 3, 4) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Translate_FloatInfinityIntersect_Success() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + { + region.Intersect(new Rectangle(-10, -10, 20, 20)); + region.Translate(10f, 10f); + + Assert.False(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(0, 0, 20, 20) }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Translate_Infinity_Nop() + { + using (var region = new Region()) + using (var matrix = new Matrix()) + { + region.Translate(10, 10); + region.Translate(10f, 10f); + + Assert.True(region.IsInfinite(s_graphic)); + Assert.Equal(new RectangleF[] { new RectangleF(-4194304, -4194304, 8388608, 8388608) }, region.GetRegionScans(matrix)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [InlineData(float.MaxValue)] + [InlineData(float.MinValue)] + [InlineData(float.NaN)] + [InlineData(float.PositiveInfinity)] + [InlineData(float.NegativeInfinity)] + public void Translate_InvalidFloatValue_EmptiesRegion(float f) + { + using (var region = new Region(new RectangleF(1, 2, 3, 4))) + using (var matrix = new Matrix()) + { + region.Translate(f, 0); + + Assert.True(region.IsEmpty(s_graphic)); + Assert.False(region.IsInfinite(s_graphic)); + Assert.Empty(region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Translate_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => region.Translate(1, 2)); + AssertExtensions.Throws(null, () => region.Translate(1f, 2f)); + } + + public static IEnumerable Xor_TestData() + { + yield return new object[] + { + new Region(new RectangleF(500, 30, 60, 80)), + new RectangleF[] { new RectangleF(500, 30, 60, 80) }, + new RectangleF[0] + }; + + yield return new object[] + { + new Region(new RectangleF(500, 30, 60, 80)), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[] { new RectangleF(500, 30, 60, 80) } + }; + + yield return new object[] + { + new Region(new RectangleF(0, 0, 0, 0)), + new RectangleF[] { new RectangleF(500, 30, 60, 80) }, + new RectangleF[] { new RectangleF(500, 30, 60, 80) } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { new RectangleF(520, 40, 60, 80) }, + new RectangleF[] + { + new RectangleF(-4194304, -4194304, 8388608, 4194344), + new RectangleF(-4194304, 40, 4194824, 80), + new RectangleF(580, 40, 4193724, 80), + new RectangleF(-4194304, 120, 8388608, 4194184) + } + }; + + yield return new object[] + { + new Region(), + new RectangleF[] { RectangleF.Empty }, + new RectangleF[] { new Rectangle(-4194304, -4194304, 8388608, 8388608) } + }; + + yield return new object[] + { + new Region(new RectangleF(380, 30, 60, 80)), + new RectangleF[] { new RectangleF(410, 40, 60, 80) }, + new RectangleF[] + { + new RectangleF(380, 30, 60, 10), + new RectangleF(380, 40, 30, 70), + new RectangleF(440, 40, 30, 70), + new RectangleF(410, 110, 60, 10) + } + }; + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Xor_TestData))] + public void Xor_Region_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var other = new Region(rect)) + { + region.Xor(other); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_InfiniteRegion_Success() + { + using (var region = new Region(new Rectangle(1, 2, 3, 4))) + using (var other = new Region()) + using (var matrix = new Matrix()) + { + region.Xor(other); + + Assert.Equal(new RectangleF[] + { + new RectangleF(-4194304, -4194304, 8388608, 4194306), + new RectangleF(-4194304, 2, 4194305, 4), + new RectangleF(4, 2, 4194300, 4), + new RectangleF(-4194304, 6, 8388608, 4194298) + }, region.GetRegionScans(matrix)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_NullRegion_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("region", () => region.Xor((Region)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_DisposedRegion_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + AssertExtensions.Throws(null, () => new Region().Xor(region)); + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_SameRegion_ThrowsInvalidOperationException() + { + using (var region = new Region()) + { + Assert.Throws(() => region.Xor(region)); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Xor_TestData))] + public void Xor_Rectangle_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Xor(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height)); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Xor_TestData))] + public void Xor_RectangleF_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + region.Xor(rect); + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(Xor_TestData))] + public void Xor_GraphicsPath_Success(Region region, RectangleF[] rectangles, RectangleF[] expectedScans) + { + try + { + foreach (RectangleF rect in rectangles) + { + using (var path = new GraphicsPath()) + { + path.AddRectangle(rect); + region.Xor(path); + } + } + + using (var matrix = new Matrix()) + { + Assert.Equal(expectedScans, region.GetRegionScans(matrix)); + } + } + finally + { + region.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_EmptyPathWithInfiniteRegion_MakesInfinite() + { + using (var region = new Region()) + using (var graphicsPath = new GraphicsPath()) + { + region.Xor(graphicsPath); + Assert.True(region.IsInfinite(s_graphic)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_NullGraphicsPath_ThrowsArgumentNullException() + { + using (var region = new Region()) + { + AssertExtensions.Throws("path", () => region.Xor((GraphicsPath)null)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Xor_Disposed_ThrowsArgumentException() + { + var region = new Region(); + region.Dispose(); + + using (var graphicsPath = new GraphicsPath()) + using (var other = new Region()) + { + AssertExtensions.Throws(null, () => region.Xor(graphicsPath)); + AssertExtensions.Throws(null, () => region.Xor(new Rectangle())); + AssertExtensions.Throws(null, () => region.Xor(new RectangleF())); + AssertExtensions.Throws(null, () => region.Xor(other)); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/RegionTests.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/tests/RegionTests.cs.REMOVED.git-id deleted file mode 100644 index 6fcaa92d58..0000000000 --- a/external/corefx/src/System.Drawing.Common/tests/RegionTests.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5c23df5b7398602948af5dbc2b760fab68d9651c \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/tests/SolidBrushTests.cs b/external/corefx/src/System.Drawing.Common/tests/SolidBrushTests.cs index cf39ff2780..0383794795 100644 --- a/external/corefx/src/System.Drawing.Common/tests/SolidBrushTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/SolidBrushTests.cs @@ -14,7 +14,8 @@ namespace System.Drawing.Tests yield return new object[] { Color.PapayaWhip, Color.PapayaWhip }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Colors_TestData))] public void Ctor_Color(Color color, Color expectedColor) { @@ -22,7 +23,7 @@ namespace System.Drawing.Tests Assert.Equal(expectedColor, brush.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Color_ReturnsClone() { var brush = new SolidBrush(Color.PeachPuff); @@ -39,7 +40,7 @@ namespace System.Drawing.Tests Assert.NotEqual(Color.PapayaWhip, clone.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_ImmutableColor_ReturnsMutableClone() { SolidBrush brush = Assert.IsType(Brushes.Bisque); @@ -50,7 +51,7 @@ namespace System.Drawing.Tests Assert.Equal(Color.Bisque, brush.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { var brush = new SolidBrush(Color.LavenderBlush); @@ -59,7 +60,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => brush.Clone()); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_EmptyAndGetDisposed_ThrowsArgumentException() { var brush = new SolidBrush(new Color()); @@ -68,7 +70,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => brush.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_NonEmptyAndGetDisposed_ReturnsExpected() { var brush = new SolidBrush(Color.Aquamarine); @@ -77,14 +79,14 @@ namespace System.Drawing.Tests Assert.Equal(Color.Aquamarine, brush.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_SetValid_GetReturnsExpected() { var brush = new SolidBrush(Color.Goldenrod) { Color = Color.GhostWhite }; Assert.Equal(Color.GhostWhite, brush.Color); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_SetDisposed_ThrowsArgumentException() { var brush = new SolidBrush(new Color()); @@ -93,14 +95,14 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => brush.Color = Color.WhiteSmoke); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Color_SetImmutable_ThrowsArgumentException() { SolidBrush brush = Assert.IsType(SystemBrushes.ActiveBorder); AssertExtensions.Throws(null, () => brush.Color = Color.AntiqueWhite); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Success() { var brush = new SolidBrush(Color.Plum); @@ -108,7 +110,7 @@ namespace System.Drawing.Tests brush.Dispose(); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_SetImmutable_ThrowsArgumentException() { SolidBrush brush = Assert.IsType(SystemBrushes.ActiveBorder); diff --git a/external/corefx/src/System.Drawing.Common/tests/StringFormatTests.cs b/external/corefx/src/System.Drawing.Common/tests/StringFormatTests.cs index cf489c42ff..a39913348b 100644 --- a/external/corefx/src/System.Drawing.Common/tests/StringFormatTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/StringFormatTests.cs @@ -14,7 +14,7 @@ namespace System.Drawing.Tests private const int RandomLanguageCode = 10; private const int EnglishLanguageCode = 2057; - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { using (var format = new StringFormat()) @@ -29,7 +29,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringFormatFlags.DirectionRightToLeft | StringFormatFlags.DirectionVertical)] [InlineData((StringFormatFlags)(-1))] public void Ctor_Options(StringFormatFlags options) @@ -46,7 +46,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringFormatFlags.DirectionRightToLeft | StringFormatFlags.DirectionVertical, RandomLanguageCode)] [InlineData(StringFormatFlags.NoClip, EnglishLanguageCode)] [InlineData((StringFormatFlags)(-1), -1)] @@ -64,7 +64,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Format() { using (var original = new StringFormat(StringFormatFlags.NoClip, EnglishLanguageCode)) @@ -90,7 +90,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws("format", () => new StringFormat(null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_DisposedFormat_ThrowsArgumentException() { var format = new StringFormat(); @@ -99,7 +99,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new StringFormat(format)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Success() { var format = new StringFormat(); @@ -107,7 +107,7 @@ namespace System.Drawing.Tests format.Dispose(); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Valid_Success() { using (var original = new StringFormat(StringFormatFlags.NoClip, EnglishLanguageCode)) @@ -127,7 +127,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -136,7 +136,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.Clone()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, StringDigitSubstitute.None, 0)] [InlineData(EnglishLanguageCode, StringDigitSubstitute.Traditional, EnglishLanguageCode)] [InlineData(int.MaxValue, StringDigitSubstitute.Traditional + 1, 65535)] @@ -151,7 +152,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetDigitSubstitution_Disposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -160,7 +161,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.SetDigitSubstitution(0, StringDigitSubstitute.None)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0, new float[0])] [InlineData(10, new float[] { 1, 2.3f, 4, float.PositiveInfinity, float.NaN })] public void SetTabStops_GetTabStops_ReturnsExpected(float firstTabOffset, float[] tabStops) @@ -174,7 +175,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetTabStops_NullTabStops_ThrowsNullReferenceException() { using (var format = new StringFormat()) @@ -183,7 +184,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetTabStops_NegativeFirstTabOffset_ThrowsArgumentException() { using (var format = new StringFormat()) @@ -192,7 +193,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetTabStops_NegativeInfinityInTabStops_ThrowsNotImplementedException() { using (var format = new StringFormat()) @@ -201,7 +202,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetTabStops_Disposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -210,7 +211,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.SetTabStops(0, new float[0])); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetTabStops_Disposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -227,7 +228,7 @@ namespace System.Drawing.Tests yield return new object[] { new CharacterRange[32] }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(SetMeasurableCharacterRanges_TestData))] public void SetMeasurableCharacterRanges_Valid_Success(CharacterRange[] ranges) { @@ -237,7 +238,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetMeasurableCharacterRanges_NullRanges_ThrowsNullReferenceException() { using (var format = new StringFormat()) @@ -246,7 +247,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetMeasurableCharacterRanges_RangesTooLarge_ThrowsOverflowException() { using (var format = new StringFormat()) @@ -255,7 +256,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void SetMeasurableCharacterRanges_Disposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -264,7 +265,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.SetMeasurableCharacterRanges(new CharacterRange[0])); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringAlignment.Center)] [InlineData(StringAlignment.Far)] [InlineData(StringAlignment.Near)] @@ -276,18 +277,18 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringAlignment.Near - 1)] [InlineData(StringAlignment.Far + 1)] public void Alignment_SetInvalid_ThrowsInvalidEnumArgumentException(StringAlignment alignment) { using (var format = new StringFormat()) { - AssertExtensions.Throws("value", () => format.Alignment = alignment); + Assert.ThrowsAny(() => format.Alignment = alignment); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Alignment_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -297,8 +298,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.Alignment = StringAlignment.Center); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - public void DigitSubstituionMethod_GetSetWhenDisposed_ThrowsArgumentException() + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DigitSubstitutionMethod_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); format.Dispose(); @@ -306,8 +307,8 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.DigitSubstitutionMethod); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - public void DigitSubstituionLanguage_GetSetWhenDisposed_ThrowsArgumentException() + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DigitSubstitutionLanguage_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); format.Dispose(); @@ -315,7 +316,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.DigitSubstitutionLanguage); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringFormatFlags.DirectionRightToLeft)] [InlineData((StringFormatFlags)int.MinValue)] [InlineData((StringFormatFlags)int.MaxValue)] @@ -327,7 +328,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void FormatFlags_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -337,7 +338,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.FormatFlags = StringFormatFlags.NoClip); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringAlignment.Center)] [InlineData(StringAlignment.Far)] [InlineData(StringAlignment.Near)] @@ -349,18 +350,18 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringAlignment.Near - 1)] [InlineData(StringAlignment.Far + 1)] public void LineAlignment_SetInvalid_ThrowsInvalidEnumArgumentException(StringAlignment alignment) { using (var format = new StringFormat()) { - AssertExtensions.Throws("value", () => format.LineAlignment = alignment); + Assert.ThrowsAny(() => format.LineAlignment = alignment); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void LineAlignment_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -370,7 +371,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.LineAlignment = StringAlignment.Center); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(HotkeyPrefix.Hide)] [InlineData(HotkeyPrefix.None)] [InlineData(HotkeyPrefix.Show)] @@ -382,18 +383,18 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(HotkeyPrefix.None - 1)] [InlineData(HotkeyPrefix.Hide + 1)] public void HotKeyPrefix_SetInvalid_ThrowsInvalidEnumArgumentException(HotkeyPrefix prefix) { using (var format = new StringFormat()) { - AssertExtensions.Throws("value", () => format.HotkeyPrefix = prefix); + Assert.ThrowsAny(() => format.HotkeyPrefix = prefix); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void HotkeyPrefix_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -403,7 +404,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.HotkeyPrefix = HotkeyPrefix.Hide); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringTrimming.Word)] public void Trimming_SetValid_GetReturnsExpected(StringTrimming trimming) { @@ -413,18 +414,18 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(StringTrimming.None - 1)] [InlineData(StringTrimming.EllipsisPath + 1)] public void Trimming_SetInvalid_ThrowsInvalidEnumArgumentException(StringTrimming trimming) { using (var format = new StringFormat()) { - AssertExtensions.Throws("value", () => format.Trimming = trimming); + Assert.ThrowsAny(() => format.Trimming = trimming); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Trimming_GetSetWhenDisposed_ThrowsArgumentException() { var format = new StringFormat(); @@ -435,7 +436,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => format.Trimming = StringTrimming.Word); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GenericDefault_Get_ReturnsExpected() { StringFormat format = StringFormat.GenericDefault; @@ -450,7 +451,7 @@ namespace System.Drawing.Tests Assert.Equal(StringTrimming.Character, format.Trimming); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GenericTypographic_Get_ReturnsExpected() { StringFormat format = StringFormat.GenericTypographic; @@ -465,7 +466,7 @@ namespace System.Drawing.Tests Assert.Equal(StringTrimming.None, format.Trimming); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToString_Flags_ReturnsExpected() { using (var format = new StringFormat(StringFormatFlags.DirectionVertical)) @@ -474,7 +475,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ToString_Disposed_ThrowsArgumentException() { var format = new StringFormat(StringFormatFlags.DirectionVertical); diff --git a/external/corefx/src/System.Drawing.Common/tests/System.Drawing.Common.Tests.csproj b/external/corefx/src/System.Drawing.Common/tests/System.Drawing.Common.Tests.csproj index d63b84f2ce..6a24e7f28d 100644 --- a/external/corefx/src/System.Drawing.Common/tests/System.Drawing.Common.Tests.csproj +++ b/external/corefx/src/System.Drawing.Common/tests/System.Drawing.Common.Tests.csproj @@ -3,11 +3,8 @@ {4B93E684-0630-45F4-8F63-6C7788C9892F} + true - - - - @@ -28,6 +25,18 @@ + + + + + + + + + + + + @@ -41,6 +50,8 @@ + + @@ -61,9 +72,6 @@ Common\System\Diagnostics\DebuggerAttributes.cs - - Common\System\PlatformDetection.cs - Common\System\ThreadCultureChange.cs @@ -72,19 +80,19 @@ - + %(RecursiveDir)%(Filename)%(Extension) - + System.Drawing.Tests.48x48_multiple_entries_4bit.ico - + System.Drawing.Tests.bitmap_173x183_indexed_8bit.bmp - + System.Drawing.Tests.empty.file - + System.Drawing.Tests.invalid.ico @@ -101,4 +109,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Drawing.Common/tests/SystemBrushesTests.cs b/external/corefx/src/System.Drawing.Common/tests/SystemBrushesTests.cs index 33c3bf2430..a22a292e99 100644 --- a/external/corefx/src/System.Drawing.Common/tests/SystemBrushesTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/SystemBrushesTests.cs @@ -49,7 +49,7 @@ namespace System.Drawing.Tests public static object[] Brush(Func getBrush, Color expectedColor) => new object[] { getBrush, expectedColor }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(SystemBrushes_TestData))] public void SystemBrushes_Get_ReturnsExpected(Func getBrush, Color expectedColor) { diff --git a/external/corefx/src/System.Drawing.Common/tests/SystemFontsTests.cs b/external/corefx/src/System.Drawing.Common/tests/SystemFontsTests.cs index ce33e27b47..642a06781c 100644 --- a/external/corefx/src/System.Drawing.Common/tests/SystemFontsTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/SystemFontsTests.cs @@ -10,6 +10,32 @@ namespace System.Drawing.Tests public class SystemFontsTests { public static IEnumerable SystemFonts_TestData() + { + yield return new object[] { (Func)(() => SystemFonts.CaptionFont) }; + yield return new object[] { (Func)(() => SystemFonts.IconTitleFont) }; + yield return new object[] { (Func)(() => SystemFonts.MenuFont) }; + yield return new object[] { (Func)(() => SystemFonts.MessageBoxFont) }; + yield return new object[] { (Func)(() => SystemFonts.SmallCaptionFont) }; + yield return new object[] { (Func)(() => SystemFonts.StatusFont) }; + } + + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SystemFonts_TestData))] + public void SystemFont_Get_ReturnsExpected(Func getFont) + { + using (Font font = getFont()) + using (Font otherFont = getFont()) + { + Assert.NotNull(font); + Assert.NotNull(otherFont); + Assert.NotSame(font, otherFont); + + // Assert.Equal on a font will use the native handle to assert equality, which is not always guaranteed. + Assert.Equal(font.Name, otherFont.Name); + } + } + + public static IEnumerable SystemFonts_WindowsNames_TestData() { yield return Font(() => SystemFonts.CaptionFont, "CaptionFont", "Segoe UI"); yield return Font(() => SystemFonts.IconTitleFont, "IconTitleFont", "Segoe UI"); @@ -27,9 +53,10 @@ namespace System.Drawing.Tests public static object[] Font(Func getFont, string systemFontName, string windowsFontName) => new object[] { getFont, systemFontName, windowsFontName }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] - [MemberData(nameof(SystemFonts_TestData))] - public void SystemFont_Get_ReturnsExpected(Func getFont, string systemFontName, string windowsFontName) + [PlatformSpecific(TestPlatforms.Windows)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] + [MemberData(nameof(SystemFonts_WindowsNames_TestData))] + public void SystemFont_Get_ReturnsExpected_WindowsNames(Func getFont, string systemFontName, string windowsFontName) { using (Font font = getFont()) using (Font otherFont = getFont()) diff --git a/external/corefx/src/System.Drawing.Common/tests/SystemIconsTests.cs b/external/corefx/src/System.Drawing.Common/tests/SystemIconsTests.cs index b232c6c05e..aa765ab7b6 100644 --- a/external/corefx/src/System.Drawing.Common/tests/SystemIconsTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/SystemIconsTests.cs @@ -24,7 +24,7 @@ namespace System.Drawing.Tests public static object[] Icon(Func getIcon) => new object[] { getIcon }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(SystemIcons_TestData))] public void SystemIcons_Get_ReturnsExpected(Func getIcon) { diff --git a/external/corefx/src/System.Drawing.Common/tests/SystemPensTest.cs b/external/corefx/src/System.Drawing.Common/tests/SystemPensTest.cs index 4d367e212e..669c55c91c 100644 --- a/external/corefx/src/System.Drawing.Common/tests/SystemPensTest.cs +++ b/external/corefx/src/System.Drawing.Common/tests/SystemPensTest.cs @@ -49,7 +49,7 @@ namespace System.Drawing.Tests public static object[] Pen(Func getPen, Color expectedColor) => new object[] { getPen, expectedColor }; - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(SystemPens_TestData))] public void SystemPens_Get_ReturnsExpected(Func getPen, Color expectedColor) { diff --git a/external/corefx/src/System.Drawing.Common/tests/Text/InstalledFontCollectionTests.cs b/external/corefx/src/System.Drawing.Common/tests/Text/InstalledFontCollectionTests.cs index 9eb0fff190..e35710dd90 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Text/InstalledFontCollectionTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Text/InstalledFontCollectionTests.cs @@ -7,7 +7,7 @@ namespace System.Drawing.Text.Tests { public class InstalledFontCollectionTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)] public void Ctor_Default() { using (var fontCollection = new InstalledFontCollection()) @@ -16,7 +16,7 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiPlusIsAvailableNotRedhat73)] public void Families_GetWhenDisposed_ReturnsNonEmpty() { var fontCollection = new InstalledFontCollection(); @@ -25,7 +25,7 @@ namespace System.Drawing.Text.Tests Assert.NotEmpty(fontCollection.Families); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Nop() { var fontCollection = new InstalledFontCollection(); diff --git a/external/corefx/src/System.Drawing.Common/tests/Text/PrivateFontCollectionTests.cs b/external/corefx/src/System.Drawing.Common/tests/Text/PrivateFontCollectionTests.cs index e07bf9da03..e67cba91f2 100644 --- a/external/corefx/src/System.Drawing.Common/tests/Text/PrivateFontCollectionTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/Text/PrivateFontCollectionTests.cs @@ -12,7 +12,7 @@ namespace System.Drawing.Text.Tests { public class PrivateFontCollectionTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_Default() { using (var fontCollection = new PrivateFontCollection()) @@ -21,7 +21,7 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_AbsolutePath_Success() { // GDI+ on Windows 7 incorrectly throws a FileNotFoundException. @@ -40,7 +40,7 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_RelativePath_Success() { // GDI+ on Windows 7 incorrectly throws a FileNotFoundException. @@ -58,8 +58,8 @@ namespace System.Drawing.Text.Tests Assert.Equal("Code New Roman", fontFamily.Name); } } - - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_SamePathMultipleTimes_FamiliesContainsOnlyOneFont() { // GDI+ on Windows 7 incorrectly throws a FileNotFoundException. @@ -78,7 +78,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_SameNameMultipleTimes_FamiliesContainsFirstFontOnly() { // GDI+ on Windows 7 incorrectly throws a FileNotFoundException. @@ -101,7 +102,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_NullFileName_ThrowsArgumentNullException() { using (var fontCollection = new PrivateFontCollection()) @@ -110,7 +112,7 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_InvalidPath_ThrowsArgumentException() { using (var fontCollection = new PrivateFontCollection()) @@ -119,7 +121,7 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_NoSuchFilePath_ThrowsFileNotFoundException() { using (var fontCollection = new PrivateFontCollection()) @@ -128,7 +130,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] + [ActiveIssue("https://github.com/dotnet/corefx/issues/8655")] public void AddFontFile_LongFilePath_ThrowsException() { using (var fontCollection = new PrivateFontCollection()) @@ -147,7 +150,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_Directory_ThrowsExternalException() { // GDI+ on Windows 7 and Windows 8.1 incorrectly does not throw. @@ -162,7 +166,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddFontFile_Disposed_ThrowsArgumentException() { var fontCollection = new PrivateFontCollection(); @@ -171,7 +176,7 @@ namespace System.Drawing.Text.Tests AssertExtensions.Throws(null, () => fontCollection.AddFontFile("fileName")); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddMemoryFont_ValidMemory_Success() { using (var fontCollection = new PrivateFontCollection()) @@ -194,7 +199,7 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddMemoryFont_ZeroMemory_ThrowsArgumentException() { using (var fontCollection = new PrivateFontCollection()) @@ -203,7 +208,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(0)] [InlineData(-1)] public void AddMemoryFont_InvalidLength_ThrowsArgumentException(int length) @@ -231,7 +237,8 @@ namespace System.Drawing.Text.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void AddMemoryFont_Disposed_ThrowsArgumentException() { var fontCollection = new PrivateFontCollection(); @@ -239,8 +246,8 @@ namespace System.Drawing.Text.Tests AssertExtensions.Throws(null, () => fontCollection.AddMemoryFont((IntPtr)10, 100)); } - - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Families_GetWhenDisposed_ThrowsArgumentException() { var fontCollection = new PrivateFontCollection(); @@ -249,7 +256,7 @@ namespace System.Drawing.Text.Tests AssertExtensions.Throws(null, () => fontCollection.Families); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Dispose_MultipleTimes_Nop() { var fontCollection = new PrivateFontCollection(); diff --git a/external/corefx/src/System.Drawing.Common/tests/TextureBrushTests.cs b/external/corefx/src/System.Drawing.Common/tests/TextureBrushTests.cs index ef914d3f37..02e3e4cc39 100644 --- a/external/corefx/src/System.Drawing.Common/tests/TextureBrushTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/TextureBrushTests.cs @@ -17,7 +17,8 @@ namespace System.Drawing.Tests yield return new object[] { new Metafile(Helpers.GetTestBitmapPath("telescope_01.wmf")), PixelFormat.Format32bppArgb, new Size(490, 654) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Bitmap_TestData))] public void Ctor_Bitmap(Image bitmap, PixelFormat expectedPixelFormat, Size expectedSize) { @@ -40,7 +41,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_BitmapFromIconHandle_Success() { using (var icon = new Icon(Helpers.GetTestBitmapPath("10x16_one_entry_32bit.ico"))) @@ -62,7 +64,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_WrapMode_TestData))] public void Ctor_Image_WrapMode(Image image, WrapMode wrapMode, PixelFormat expectedPixelFormat, Size expectedSize) { @@ -91,7 +94,8 @@ namespace System.Drawing.Tests yield return new object[] { new Bitmap(10, 10), new Rectangle(5, 5, 5, 5) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_Rectangle_TestData))] public void Ctor_Image_Rectangle(Image image, Rectangle rectangle) { @@ -114,7 +118,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_Rectangle_TestData))] public void Ctor_Image_RectangleF(Image image, Rectangle rectangle) { @@ -149,7 +154,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_WrapMode_Rectangle_TestData))] public void Ctor_Image_WrapMode_Rectangle(Image image, WrapMode wrapMode, Rectangle rectangle) { @@ -172,7 +178,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_WrapMode_Rectangle_TestData))] public void Ctor_Image_WrapMode_RectangleF(Image image, WrapMode wrapMode, Rectangle rectangle) { @@ -208,7 +215,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_Rectangle_ImageAttributes_TestData))] public void Ctor_Image_Rectangle_ImageAttributes(Image image, Rectangle rectangle, ImageAttributes attributes, WrapMode expectedWrapMode) { @@ -232,7 +240,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_Image_Rectangle_ImageAttributes_TestData))] public void Ctor_Image_RectangleF_ImageAttributes(Image image, Rectangle rectangle, ImageAttributes attributes, WrapMode expectedWrapMode) { @@ -256,7 +265,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_NullImage_ThrowsArgumentNullException() { AssertExtensions.Throws("image", () => new TextureBrush(null)); @@ -269,7 +278,7 @@ namespace System.Drawing.Tests AssertExtensions.Throws("image", () => new TextureBrush(null, WrapMode.Tile, Rectangle.Empty)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Ctor_DisposedImage_ThrowsArgumentException() { var image = new Bitmap(10, 10); @@ -285,20 +294,20 @@ namespace System.Drawing.Tests AssertExtensions.Throws(null, () => new TextureBrush(image, WrapMode.Tile, Rectangle.Empty)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(WrapMode.Tile - 1)] [InlineData(WrapMode.Clamp + 1)] public void Ctor_InvalidWrapMode_ThrowsInvalidEnumArgumentException(WrapMode wrapMode) { using (var image = new Bitmap(10, 10)) { - AssertExtensions.Throws("wrapMode", () => new TextureBrush(image, wrapMode)); - AssertExtensions.Throws("wrapMode", () => new TextureBrush(image, wrapMode, RectangleF.Empty)); - AssertExtensions.Throws("wrapMode", () => new TextureBrush(image, wrapMode, Rectangle.Empty)); + Assert.ThrowsAny(() => new TextureBrush(image, wrapMode)); + Assert.ThrowsAny(() => new TextureBrush(image, wrapMode, RectangleF.Empty)); + Assert.ThrowsAny(() => new TextureBrush(image, wrapMode, Rectangle.Empty)); } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(-1, 0, 1, 1)] [InlineData(10, 0, 1, 1)] [InlineData(5, 0, 6, 1)] @@ -321,7 +330,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Invoke_Success() { using (var image = new Bitmap(10, 10)) @@ -335,7 +344,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Clone_Disposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -347,7 +356,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Image_GetWhenDisposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -367,7 +376,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), new Matrix(2, 3, 4, 5, 6, 7), MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(MultiplyTransform_TestData))] public void MultiplyTransform_Matrix_SetsTransformToExpected(Matrix originalTransform, Matrix matrix, MatrixOrder matrixOrder) { @@ -398,7 +407,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NullMatrix_ThrowsArgumentNullException() { using (var image = new Bitmap(10, 10)) @@ -409,7 +418,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_NotInvertibleMatrix_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -421,7 +430,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_DisposedMatrix_Nop() { using (var image = new Bitmap(10, 10)) @@ -440,7 +449,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void MultiplyTransform_InvalidOrder_Nop(MatrixOrder matrixOrder) @@ -457,7 +467,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void MultiplyTransform_Disposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -471,7 +481,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Invoke_SetsTransformToZero() { using (var image = new Bitmap(10, 10)) @@ -488,7 +498,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ResetTransform_Disposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -512,7 +522,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -45, MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(RotateTransform_TestData))] public void RotateTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float angle, MatrixOrder matrixOrder) { @@ -542,7 +552,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void RotateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder) @@ -554,7 +564,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void RotateTransform_Disposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -582,7 +592,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(ScaleTransform_TestData))] public void ScaleTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float scaleX, float scaleY, MatrixOrder matrixOrder) { @@ -612,7 +622,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void ScaleTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder) @@ -624,7 +634,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void ScaleTransform_Disposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -638,7 +648,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetValid_GetReturnsExpected() { using (var image = new Bitmap(10, 10)) @@ -650,7 +660,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetNull_ThrowsArgumentNullException() { using (var image = new Bitmap(10, 10)) @@ -660,7 +670,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_SetDisposedMatrix_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -673,7 +683,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void Transform_GetSetWhenDisposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -701,7 +711,7 @@ namespace System.Drawing.Tests yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Append }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(TranslateTransform_TestData))] public void TranslateTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float dX, float dY, MatrixOrder matrixOrder) { @@ -731,7 +741,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(MatrixOrder.Prepend - 1)] [InlineData(MatrixOrder.Append + 1)] public void TranslateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder) @@ -743,7 +753,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void TranslateTransform_Disposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -757,7 +767,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(WrapMode.Clamp)] [InlineData(WrapMode.Tile)] [InlineData(WrapMode.TileFlipX)] @@ -773,7 +783,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(WrapMode.Tile - 1)] [InlineData(WrapMode.Clamp + 1)] public void WrapMode_SetInvalid_ThrowsInvalidEnumArgumentException(WrapMode wrapMode) @@ -781,11 +791,11 @@ namespace System.Drawing.Tests using (var image = new Bitmap(10, 10)) using (var brush = new TextureBrush(image)) { - AssertExtensions.Throws("value", () => brush.WrapMode = wrapMode); + Assert.ThrowsAny(() => brush.WrapMode = wrapMode); } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_GetSetWhenDisposed_ThrowsArgumentException() { using (var image = new Bitmap(10, 10)) @@ -798,7 +808,7 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_Clamp_ReturnsExpected() { // R|G|_|_ @@ -815,7 +825,7 @@ namespace System.Drawing.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_Tile_ReturnsExpected() { // R|G|R|G @@ -831,7 +841,8 @@ namespace System.Drawing.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_TileFlipX_ReturnsExpected() { // R|G|G|R @@ -847,7 +858,8 @@ namespace System.Drawing.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_TileFlipY_ReturnsExpected() { // R|G|R|G @@ -863,7 +875,8 @@ namespace System.Drawing.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void WrapMode_TileFlipXY_ReturnsExpected() { // R|G|G|R diff --git a/external/corefx/src/System.Drawing.Common/tests/ToolboxBitmapAttributeTests.cs b/external/corefx/src/System.Drawing.Common/tests/ToolboxBitmapAttributeTests.cs index 3634fc27ea..d6c9e86bd3 100644 --- a/external/corefx/src/System.Drawing.Common/tests/ToolboxBitmapAttributeTests.cs +++ b/external/corefx/src/System.Drawing.Common/tests/ToolboxBitmapAttributeTests.cs @@ -21,7 +21,8 @@ namespace System.Drawing.Tests yield return new object[] { Helpers.GetTestBitmapPath("invalid.ico"), new Size(0, 0) }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Ctor_FileName_TestData))] public void Ctor_FileName(string fileName, Size size) { @@ -40,7 +41,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(null, -1, -1)] [InlineData(typeof(ClassWithNoNamespace), -1, -1)] [InlineData(typeof(bitmap_173x183_indexed_8bit), 173, 183)] @@ -61,7 +63,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData(null, null, -1, -1)] [InlineData(null, "invalid.ico", -1, -1)] [InlineData(typeof(ClassWithNoNamespace), null, -1, -1)] @@ -90,7 +93,7 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [InlineData("bitmap_173x183_indexed_8bit.bmp", 173, 183)] [InlineData("48x48_multiple_entries_4bit.ico", 16, 16)] public void GetImage_TypeFileNameBool_ReturnsExpected(string fileName, int width, int height) @@ -107,7 +110,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetImage_NullComponent_ReturnsNull() { var attribute = new ToolboxBitmapAttribute((string)null); @@ -115,7 +119,7 @@ namespace System.Drawing.Tests Assert.Null(attribute.GetImage((object)null, true)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetImage_Component_ReturnsExpected() { ToolboxBitmapAttribute attribute = new ToolboxBitmapAttribute((string)null); @@ -131,7 +135,8 @@ namespace System.Drawing.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.GdiplusIsAvailable)] public void GetImage_Default_ReturnsExpected() { ToolboxBitmapAttribute attribute = ToolboxBitmapAttribute.Default; @@ -156,7 +161,8 @@ namespace System.Drawing.Tests yield return new object[] { ToolboxBitmapAttribute.Default, null, false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalTheory(Helpers.GdiplusIsAvailable)] [MemberData(nameof(Equals_TestData))] public void Equals_Other_ReturnsExpected(ToolboxBitmapAttribute attribute, object other, bool expected) { diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/BmpCodecTests.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/BmpCodecTests.cs new file mode 100644 index 0000000000..1d8dca31c6 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/BmpCodecTests.cs @@ -0,0 +1,540 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// BMPCodec class testing unit +// +// Authors: +// Jordi Mas i Hernàndez (jordi@ximian.com) +// Sebastien Pouliot +// +// (C) 2004 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004-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.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Xunit; + +namespace MonoTests.System.Drawing.Imaging +{ + public class BmpCodecTest + { + /* Checks bitmap features on a known 1bbp bitmap */ + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap1bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver1bit.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format4bppIndexed, bmp.PixelFormat); + Assert.Equal(173, bmp.Width); + Assert.Equal(183, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(173, rect.Width); + Assert.Equal(183, rect.Height); + + Assert.Equal(173, bmp.Size.Width); + Assert.Equal(183, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap1bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver1bit.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-1, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-8355840, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-8355840, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(160, 160).ToArgb()); + } + } + + /* Checks bitmap features on a known 8bbp bitmap */ + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver8bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format8bppIndexed, bmp.PixelFormat); + Assert.Equal(173, bmp.Width); + Assert.Equal(183, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(173, rect.Width); + Assert.Equal(183, rect.Height); + + Assert.Equal(173, bmp.Size.Width); + Assert.Equal(183, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver8bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-1040, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-6250304, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-12566464, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-6258560, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-8355776, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-12566464, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-2039680, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-4153280, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-12566464, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-6258560, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-12566464, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-1040, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-4144960, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-4137792, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-8355712, bmp.GetPixel(160, 160).ToArgb()); + } + } + + /* Checks bitmap features on a known 24-bits bitmap */ + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap24bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format24bppRgb, bmp.PixelFormat); + Assert.Equal(173, bmp.Width); + Assert.Equal(183, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(173, rect.Width); + Assert.Equal(183, rect.Height); + + Assert.Equal(173, bmp.Size.Width); + Assert.Equal(183, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap24bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-1645353, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-461332, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-330005, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-2237489, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-1251105, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-3024947, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-2699070, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-2366734, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-4538413, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-6116681, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-7369076, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-13024729, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-7174020, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-51, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-16053503, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-8224431, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-16579326, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-2502457, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-9078395, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-12696508, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-70772, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-4346279, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-11583193, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-724763, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-7238268, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-2169612, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-3683883, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-12892867, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-3750464, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-3222844, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-65806, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-2961726, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-2435382, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-2501944, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-9211799, bmp.GetPixel(160, 160).ToArgb()); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap24bitData() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + Assert.Equal(-3355456, bmp.GetPixel(163, 1).ToArgb()); + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(520, data.Stride); + Assert.Equal(183, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(217, *(scan + 0)); + Assert.Equal(192, *(scan + 1009)); + Assert.Equal(210, *(scan + 2018)); + Assert.Equal(196, *(scan + 3027)); + Assert.Equal(216, *(scan + 4036)); + Assert.Equal(215, *(scan + 5045)); + Assert.Equal(218, *(scan + 6054)); + Assert.Equal(218, *(scan + 7063)); + Assert.Equal(95, *(scan + 8072)); + Assert.Equal(9, *(scan + 9081)); + Assert.Equal(247, *(scan + 10090)); + Assert.Equal(161, *(scan + 11099)); + Assert.Equal(130, *(scan + 12108)); + Assert.Equal(131, *(scan + 13117)); + Assert.Equal(175, *(scan + 14126)); + Assert.Equal(217, *(scan + 15135)); + Assert.Equal(201, *(scan + 16144)); + Assert.Equal(183, *(scan + 17153)); + Assert.Equal(236, *(scan + 18162)); + Assert.Equal(242, *(scan + 19171)); + Assert.Equal(125, *(scan + 20180)); + Assert.Equal(193, *(scan + 21189)); + Assert.Equal(227, *(scan + 22198)); + Assert.Equal(44, *(scan + 23207)); + Assert.Equal(230, *(scan + 24216)); + Assert.Equal(224, *(scan + 25225)); + Assert.Equal(164, *(scan + 26234)); + Assert.Equal(43, *(scan + 27243)); + Assert.Equal(200, *(scan + 28252)); + Assert.Equal(255, *(scan + 29261)); + Assert.Equal(226, *(scan + 30270)); + Assert.Equal(230, *(scan + 31279)); + Assert.Equal(178, *(scan + 32288)); + Assert.Equal(224, *(scan + 33297)); + Assert.Equal(233, *(scan + 34306)); + Assert.Equal(212, *(scan + 35315)); + Assert.Equal(153, *(scan + 36324)); + Assert.Equal(143, *(scan + 37333)); + Assert.Equal(215, *(scan + 38342)); + Assert.Equal(116, *(scan + 39351)); + Assert.Equal(26, *(scan + 40360)); + Assert.Equal(28, *(scan + 41369)); + Assert.Equal(75, *(scan + 42378)); + Assert.Equal(50, *(scan + 43387)); + Assert.Equal(244, *(scan + 44396)); + Assert.Equal(191, *(scan + 45405)); + Assert.Equal(200, *(scan + 46414)); + Assert.Equal(197, *(scan + 47423)); + Assert.Equal(232, *(scan + 48432)); + Assert.Equal(186, *(scan + 49441)); + Assert.Equal(210, *(scan + 50450)); + Assert.Equal(215, *(scan + 51459)); + Assert.Equal(155, *(scan + 52468)); + Assert.Equal(56, *(scan + 53477)); + Assert.Equal(149, *(scan + 54486)); + Assert.Equal(137, *(scan + 55495)); + Assert.Equal(141, *(scan + 56504)); + Assert.Equal(36, *(scan + 57513)); + Assert.Equal(39, *(scan + 58522)); + Assert.Equal(25, *(scan + 59531)); + Assert.Equal(44, *(scan + 60540)); + Assert.Equal(12, *(scan + 61549)); + Assert.Equal(161, *(scan + 62558)); + Assert.Equal(179, *(scan + 63567)); + Assert.Equal(181, *(scan + 64576)); + Assert.Equal(165, *(scan + 65585)); + Assert.Equal(182, *(scan + 66594)); + Assert.Equal(186, *(scan + 67603)); + Assert.Equal(201, *(scan + 68612)); + Assert.Equal(49, *(scan + 69621)); + Assert.Equal(161, *(scan + 70630)); + Assert.Equal(140, *(scan + 71639)); + Assert.Equal(2, *(scan + 72648)); + Assert.Equal(15, *(scan + 73657)); + Assert.Equal(33, *(scan + 74666)); + Assert.Equal(17, *(scan + 75675)); + Assert.Equal(0, *(scan + 76684)); + Assert.Equal(47, *(scan + 77693)); + Assert.Equal(4, *(scan + 78702)); + Assert.Equal(142, *(scan + 79711)); + Assert.Equal(151, *(scan + 80720)); + Assert.Equal(124, *(scan + 81729)); + Assert.Equal(81, *(scan + 82738)); + Assert.Equal(214, *(scan + 83747)); + Assert.Equal(217, *(scan + 84756)); + Assert.Equal(30, *(scan + 85765)); + Assert.Equal(185, *(scan + 86774)); + Assert.Equal(200, *(scan + 87783)); + Assert.Equal(37, *(scan + 88792)); + Assert.Equal(2, *(scan + 89801)); + Assert.Equal(41, *(scan + 90810)); + Assert.Equal(16, *(scan + 91819)); + Assert.Equal(0, *(scan + 92828)); + Assert.Equal(146, *(scan + 93837)); + Assert.Equal(163, *(scan + 94846)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + /* Checks bitmap features on a known 32-bits bitmap (codec)*/ + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap32bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(173, bmp.Width); + Assert.Equal(183, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(173, rect.Width); + Assert.Equal(183, rect.Height); + + Assert.Equal(173, bmp.Size.Width); + Assert.Equal(183, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap32bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + Assert.Equal(PixelFormat.Format32bppRgb, bmp.PixelFormat); + // sampling values from a well known bitmap + Assert.Equal(-1579559, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-1645353, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-461332, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-330005, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-2237489, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-1251105, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-3024947, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-2699070, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-2366734, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-4538413, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-6116681, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-7369076, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-13024729, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-7174020, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-51, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-16053503, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-8224431, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-16579326, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-2502457, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-9078395, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-12696508, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-70772, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-4346279, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-11583193, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-724763, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-7238268, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-2169612, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-3683883, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-12892867, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-3750464, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-3222844, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-65806, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-2961726, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-2435382, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-2501944, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-9211799, bmp.GetPixel(160, 160).ToArgb()); + } + } + + private void Save(PixelFormat original, PixelFormat expected, bool colorCheck) + { + string sOutFile = $"linerect-{expected}.bmp"; + + // Save + Bitmap bmp = new Bitmap(100, 100, original); + Graphics gr = Graphics.FromImage(bmp); + + using (Pen p = new Pen(Color.BlueViolet, 2)) + { + gr.DrawLine(p, 10.0F, 10.0F, 90.0F, 90.0F); + gr.DrawRectangle(p, 10.0F, 10.0F, 80.0F, 80.0F); + } + + try + { + bmp.Save(sOutFile, ImageFormat.Bmp); + + // Load + using (Bitmap bmpLoad = new Bitmap(sOutFile)) + { + Assert.Equal(expected, bmpLoad.PixelFormat); + if (colorCheck) + { + Color color = bmpLoad.GetPixel(10, 10); + Assert.Equal(Color.FromArgb(255, 138, 43, 226), color); + } + } + } + finally + { + gr.Dispose(); + bmp.Dispose(); + try + { + File.Delete(sOutFile); + } + catch + { + } + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_24bppRgb() + { + Save(PixelFormat.Format24bppRgb, PixelFormat.Format24bppRgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppRgb() + { + Save(PixelFormat.Format32bppRgb, PixelFormat.Format32bppRgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppArgb() + { + Save(PixelFormat.Format32bppArgb, PixelFormat.Format32bppRgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppPArgb() + { + Save(PixelFormat.Format32bppPArgb, PixelFormat.Format32bppRgb, true); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void NonInvertedBitmap() + { + // regression check against http://bugzilla.ximian.com/show_bug.cgi?id=80751 + string sInFile = Helpers.GetTestBitmapPath("non-inverted.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(90, bmp.Width); + Assert.Equal(60, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(90, rect.Width); + Assert.Equal(60, rect.Height); + + Assert.Equal(90, bmp.Size.Width); + Assert.Equal(60, bmp.Size.Height); + + // sampling values from a well known bitmap + Assert.Equal(-16777216, bmp.GetPixel(12, 21).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(21, 37).ToArgb()); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/GifCodecTests.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/GifCodecTests.cs new file mode 100644 index 0000000000..6f854bf00b --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/GifCodecTests.cs @@ -0,0 +1,266 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// GIF Codec class testing unit +// +// Authors: +// Jordi Mas i Hernàndez (jordi@ximian.com) +// Sebastien Pouliot +// +// Copyright (C) 2006, 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.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Xunit; + +namespace MonoTests.System.Drawing.Imaging +{ + public class GifCodecTest + { + /* Checks bitmap features on a known 1bbp bitmap */ + private void Bitmap8bitsFeatures(string filename) + { + using (Bitmap bmp = new Bitmap(filename)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format8bppIndexed, bmp.PixelFormat); + Assert.Equal(110, bmp.Width); + Assert.Equal(100, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(110, rect.Width); + Assert.Equal(100, rect.Height); + + Assert.Equal(110, bmp.Size.Width); + Assert.Equal(100, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitsFeatures_Gif89() + { + Bitmap8bitsFeatures(Helpers.GetTestBitmapPath("nature24bits.gif")); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitsFeatures_Gif87() + { + Bitmap8bitsFeatures(Helpers.GetTestBitmapPath("nature24bits87.gif")); + } + + private void Bitmap8bitsPixels(string filename) + { + using (Bitmap bmp = new Bitmap(filename)) + { + // sampling values from a well known bitmap + Assert.Equal(-10644802, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-12630705, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-14537409, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-14672099, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-526863, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-10263970, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-10461317, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-9722415, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-131076, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-2702435, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-6325922, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-12411924, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-131076, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-7766649, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-11512986, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-12616230, bmp.GetPixel(96, 96).ToArgb()); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitsPixels_Gif89() + { + Bitmap8bitsPixels(Helpers.GetTestBitmapPath("nature24bits.gif")); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitsPixels_Gif87() + { + Bitmap8bitsPixels(Helpers.GetTestBitmapPath("nature24bits87.gif")); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap8bitsData() + { + string sInFile = Helpers.GetTestBitmapPath("nature24bits.gif"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(332, data.Stride); + Assert.Equal(100, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(190, *(scan + 0)); + Assert.Equal(217, *(scan + 1009)); + Assert.Equal(120, *(scan + 2018)); + Assert.Equal(253, *(scan + 3027)); + Assert.Equal(233, *(scan + 4036)); + Assert.Equal(176, *(scan + 5045)); + Assert.Equal(151, *(scan + 6054)); + Assert.Equal(220, *(scan + 7063)); + Assert.Equal(139, *(scan + 8072)); + Assert.Equal(121, *(scan + 9081)); + Assert.Equal(160, *(scan + 10090)); + Assert.Equal(92, *(scan + 11099)); + Assert.Equal(96, *(scan + 12108)); + Assert.Equal(64, *(scan + 13117)); + Assert.Equal(156, *(scan + 14126)); + Assert.Equal(68, *(scan + 15135)); + Assert.Equal(156, *(scan + 16144)); + Assert.Equal(84, *(scan + 17153)); + Assert.Equal(55, *(scan + 18162)); + Assert.Equal(68, *(scan + 19171)); + Assert.Equal(116, *(scan + 20180)); + Assert.Equal(61, *(scan + 21189)); + Assert.Equal(69, *(scan + 22198)); + Assert.Equal(75, *(scan + 23207)); + Assert.Equal(61, *(scan + 24216)); + Assert.Equal(66, *(scan + 25225)); + Assert.Equal(40, *(scan + 26234)); + Assert.Equal(55, *(scan + 27243)); + Assert.Equal(53, *(scan + 28252)); + Assert.Equal(215, *(scan + 29261)); + Assert.Equal(99, *(scan + 30270)); + Assert.Equal(67, *(scan + 31279)); + Assert.Equal(142, *(scan + 32288)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Interlaced() + { + string sInFile = Helpers.GetTestBitmapPath("81773-interlaced.gif"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + for (int i = 0; i < 255; i++) + { + Color c = bmp.GetPixel(0, i); + Assert.Equal(255, c.A); + Assert.Equal(i, c.R); + Assert.Equal(i, c.G); + Assert.Equal(i, c.B); + } + } + } + + private void Save(PixelFormat original, PixelFormat expected, bool exactColorCheck) + { + string sOutFile = $"linerect-{expected}.gif"; + + // Save + Bitmap bmp = new Bitmap(100, 100, original); + Graphics gr = Graphics.FromImage(bmp); + + using (Pen p = new Pen(Color.Red, 2)) + { + gr.DrawLine(p, 10.0F, 10.0F, 90.0F, 90.0F); + gr.DrawRectangle(p, 10.0F, 10.0F, 80.0F, 80.0F); + } + + try + { + bmp.Save(sOutFile, ImageFormat.Gif); + + // Load + using (Bitmap bmpLoad = new Bitmap(sOutFile)) + { + Assert.Equal(expected, bmpLoad.PixelFormat); + Color color = bmpLoad.GetPixel(10, 10); + if (exactColorCheck) + { + Assert.Equal(Color.FromArgb(255, 255, 0, 0), color); + } + else + { + // FIXME: we don't save a pure red (F8 instead of FF) into the file so the color-check assert will fail + // this is due to libgif's QuantizeBuffer. An alternative would be to make our own that checks if less than 256 colors + // are used in the bitmap (or else use QuantizeBuffer). + Assert.Equal(255, color.A); + Assert.True(color.R >= 248); + Assert.Equal(0, color.G); + Assert.Equal(0, color.B); + } + } + } + finally + { + gr.Dispose(); + bmp.Dispose(); + try + { + File.Delete(sOutFile); + } + catch + { + } + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_24bppRgb() + { + Save(PixelFormat.Format24bppRgb, PixelFormat.Format8bppIndexed, false); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppRgb() + { + Save(PixelFormat.Format32bppRgb, PixelFormat.Format8bppIndexed, false); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppArgb() + { + Save(PixelFormat.Format32bppArgb, PixelFormat.Format8bppIndexed, false); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppPArgb() + { + Save(PixelFormat.Format32bppPArgb, PixelFormat.Format8bppIndexed, false); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/IconCodecTests.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/IconCodecTests.cs.REMOVED.git-id new file mode 100644 index 0000000000..a429219aaa --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/IconCodecTests.cs.REMOVED.git-id @@ -0,0 +1 @@ +af810fb9fe6497ead4511c7981993dc49cdadc6e \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/JpegCodecTests.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/JpegCodecTests.cs new file mode 100644 index 0000000000..98ae8d0007 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/JpegCodecTests.cs @@ -0,0 +1,428 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// JpegCodec class testing unit +// +// Authors: +// Jordi Mas i Hernàndez (jordi@ximian.com) +// Sebastien Pouliot +// +// (C) 2004 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004-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.Drawing; +using System.Drawing.Imaging; +using Xunit; +using System.IO; +using System.Security.Permissions; + +namespace MonoTests.System.Drawing.Imaging +{ + public class JpegCodecTest + { + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap8bbpIndexedGreyscaleFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("nature-greyscale.jpg"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format8bppIndexed, bmp.PixelFormat); + Assert.Equal(110, bmp.Width); + Assert.Equal(100, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(110, rect.Width); + Assert.Equal(100, rect.Height); + + Assert.Equal(110, bmp.Size.Width); + Assert.Equal(100, bmp.Size.Height); + + Assert.Equal(110, bmp.PhysicalDimension.Width); + Assert.Equal(100, bmp.PhysicalDimension.Height); + + Assert.Equal(72, bmp.HorizontalResolution); + Assert.Equal(72, bmp.VerticalResolution); + + // This value is not consistent accross Windows & Unix + // Assert.Equal(77896, bmp.Flags); + + ColorPalette cp = bmp.Palette; + Assert.Equal(256, cp.Entries.Length); + + // This value is not consistent accross Windows & Unix + // Assert.Equal(0, cp.Flags); + for (int i = 0; i < 256; i++) + { + Color c = cp.Entries[i]; + Assert.Equal(0xFF, c.A); + Assert.Equal(i, c.R); + Assert.Equal(i, c.G); + Assert.Equal(i, c.B); + } + } + } + + [ConditionalFact(Helpers.GdiPlusIsAvailableNotWindows7)] + public void Bitmap8bbpIndexedGreyscalePixels() + { + string sInFile = Helpers.GetTestBitmapPath("nature-greyscale.jpg"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-7697782, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-12171706, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-14013910, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-15132391, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-328966, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-9934744, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-10263709, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-7368817, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-4276546, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-9079435, bmp.GetPixel(64, 64).ToArgb()); + // Assert.Equal(-7697782, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-8224126, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-11053225, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-9211021, bmp.GetPixel(96, 96).ToArgb()); + } + } + + [ConditionalFact(Helpers.GdiPlusIsAvailableNotWindows7)] + public void Bitmap8bbpIndexedGreyscaleData() + { + string sInFile = Helpers.GetTestBitmapPath("nature-greyscale.jpg"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(100, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(138, *(scan + 0)); + Assert.Equal(203, *(scan + 1009)); + Assert.Equal(156, *(scan + 2018)); + Assert.Equal(248, *(scan + 3027)); + Assert.Equal(221, *(scan + 4036)); + Assert.Equal(185, *(scan + 5045)); + Assert.Equal(128, *(scan + 6054)); + Assert.Equal(205, *(scan + 7063)); + Assert.Equal(153, *(scan + 8072)); + Assert.Equal(110, *(scan + 9081)); + Assert.Equal(163, *(scan + 10090)); + Assert.Equal(87, *(scan + 11099)); + Assert.Equal(90, *(scan + 12108)); + Assert.Equal(81, *(scan + 13117)); + // Assert.Equal(124, *(scan + 14126)); + Assert.Equal(99, *(scan + 15135)); + Assert.Equal(153, *(scan + 16144)); + Assert.Equal(57, *(scan + 17153)); + Assert.Equal(89, *(scan + 18162)); + Assert.Equal(71, *(scan + 19171)); + Assert.Equal(106, *(scan + 20180)); + Assert.Equal(55, *(scan + 21189)); + Assert.Equal(75, *(scan + 22198)); + Assert.Equal(77, *(scan + 23207)); + Assert.Equal(58, *(scan + 24216)); + Assert.Equal(69, *(scan + 25225)); + Assert.Equal(43, *(scan + 26234)); + Assert.Equal(55, *(scan + 27243)); + Assert.Equal(74, *(scan + 28252)); + Assert.Equal(145, *(scan + 29261)); + Assert.Equal(87, *(scan + 30270)); + Assert.Equal(85, *(scan + 31279)); + Assert.Equal(106, *(scan + 32288)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + /* Checks bitmap features on a known 24-bits bitmap */ + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap24bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("nature24bits.jpg"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format24bppRgb, bmp.PixelFormat); + Assert.Equal(110, bmp.Width); + Assert.Equal(100, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(110, rect.Width); + Assert.Equal(100, rect.Height); + + Assert.Equal(110, bmp.Size.Width); + Assert.Equal(100, bmp.Size.Height); + + Assert.Equal(110, bmp.PhysicalDimension.Width); + Assert.Equal(100, bmp.PhysicalDimension.Height); + + Assert.Equal(72, bmp.HorizontalResolution); + Assert.Equal(72, bmp.VerticalResolution); + + /* note: under MS flags aren't constant between executions in this case (no palette) */ + // Assert.Equal(77960, bmp.Flags); + + Assert.Equal(0, bmp.Palette.Entries.Length); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap24bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("nature24bits.jpg"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-10447423, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-12171958, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-15192259, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-15131110, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-395272, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-10131359, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-10984322, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-11034683, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-3163242, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-7311538, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-12149780, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-8224378, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-11053718, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-12944166, bmp.GetPixel(96, 96).ToArgb()); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap24bitData() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(520, data.Stride); + Assert.Equal(183, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(217, *(scan + 0)); + Assert.Equal(192, *(scan + 1009)); + Assert.Equal(210, *(scan + 2018)); + Assert.Equal(196, *(scan + 3027)); + Assert.Equal(216, *(scan + 4036)); + Assert.Equal(215, *(scan + 5045)); + Assert.Equal(218, *(scan + 6054)); + Assert.Equal(218, *(scan + 7063)); + Assert.Equal(95, *(scan + 8072)); + Assert.Equal(9, *(scan + 9081)); + Assert.Equal(247, *(scan + 10090)); + Assert.Equal(161, *(scan + 11099)); + Assert.Equal(130, *(scan + 12108)); + Assert.Equal(131, *(scan + 13117)); + Assert.Equal(175, *(scan + 14126)); + Assert.Equal(217, *(scan + 15135)); + Assert.Equal(201, *(scan + 16144)); + Assert.Equal(183, *(scan + 17153)); + Assert.Equal(236, *(scan + 18162)); + Assert.Equal(242, *(scan + 19171)); + Assert.Equal(125, *(scan + 20180)); + Assert.Equal(193, *(scan + 21189)); + Assert.Equal(227, *(scan + 22198)); + Assert.Equal(44, *(scan + 23207)); + Assert.Equal(230, *(scan + 24216)); + Assert.Equal(224, *(scan + 25225)); + Assert.Equal(164, *(scan + 26234)); + Assert.Equal(43, *(scan + 27243)); + Assert.Equal(200, *(scan + 28252)); + Assert.Equal(255, *(scan + 29261)); + Assert.Equal(226, *(scan + 30270)); + Assert.Equal(230, *(scan + 31279)); + Assert.Equal(178, *(scan + 32288)); + Assert.Equal(224, *(scan + 33297)); + Assert.Equal(233, *(scan + 34306)); + Assert.Equal(212, *(scan + 35315)); + Assert.Equal(153, *(scan + 36324)); + Assert.Equal(143, *(scan + 37333)); + Assert.Equal(215, *(scan + 38342)); + Assert.Equal(116, *(scan + 39351)); + Assert.Equal(26, *(scan + 40360)); + Assert.Equal(28, *(scan + 41369)); + Assert.Equal(75, *(scan + 42378)); + Assert.Equal(50, *(scan + 43387)); + Assert.Equal(244, *(scan + 44396)); + Assert.Equal(191, *(scan + 45405)); + Assert.Equal(200, *(scan + 46414)); + Assert.Equal(197, *(scan + 47423)); + Assert.Equal(232, *(scan + 48432)); + Assert.Equal(186, *(scan + 49441)); + Assert.Equal(210, *(scan + 50450)); + Assert.Equal(215, *(scan + 51459)); + Assert.Equal(155, *(scan + 52468)); + Assert.Equal(56, *(scan + 53477)); + Assert.Equal(149, *(scan + 54486)); + Assert.Equal(137, *(scan + 55495)); + Assert.Equal(141, *(scan + 56504)); + Assert.Equal(36, *(scan + 57513)); + Assert.Equal(39, *(scan + 58522)); + Assert.Equal(25, *(scan + 59531)); + Assert.Equal(44, *(scan + 60540)); + Assert.Equal(12, *(scan + 61549)); + Assert.Equal(161, *(scan + 62558)); + Assert.Equal(179, *(scan + 63567)); + Assert.Equal(181, *(scan + 64576)); + Assert.Equal(165, *(scan + 65585)); + Assert.Equal(182, *(scan + 66594)); + Assert.Equal(186, *(scan + 67603)); + Assert.Equal(201, *(scan + 68612)); + Assert.Equal(49, *(scan + 69621)); + Assert.Equal(161, *(scan + 70630)); + Assert.Equal(140, *(scan + 71639)); + Assert.Equal(2, *(scan + 72648)); + Assert.Equal(15, *(scan + 73657)); + Assert.Equal(33, *(scan + 74666)); + Assert.Equal(17, *(scan + 75675)); + Assert.Equal(0, *(scan + 76684)); + Assert.Equal(47, *(scan + 77693)); + Assert.Equal(4, *(scan + 78702)); + Assert.Equal(142, *(scan + 79711)); + Assert.Equal(151, *(scan + 80720)); + Assert.Equal(124, *(scan + 81729)); + Assert.Equal(81, *(scan + 82738)); + Assert.Equal(214, *(scan + 83747)); + Assert.Equal(217, *(scan + 84756)); + Assert.Equal(30, *(scan + 85765)); + Assert.Equal(185, *(scan + 86774)); + Assert.Equal(200, *(scan + 87783)); + Assert.Equal(37, *(scan + 88792)); + Assert.Equal(2, *(scan + 89801)); + Assert.Equal(41, *(scan + 90810)); + Assert.Equal(16, *(scan + 91819)); + Assert.Equal(0, *(scan + 92828)); + Assert.Equal(146, *(scan + 93837)); + Assert.Equal(163, *(scan + 94846)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + private void Save(PixelFormat original, PixelFormat expected) + { + string sOutFile = $"linerect-{expected}.jpeg"; + + // Save + Bitmap bmp = new Bitmap(100, 100, original); + Graphics gr = Graphics.FromImage(bmp); + + using (Pen p = new Pen(Color.Red, 2)) + { + gr.DrawLine(p, 10.0F, 10.0F, 90.0F, 90.0F); + gr.DrawRectangle(p, 10.0F, 10.0F, 80.0F, 80.0F); + } + + try + { + bmp.Save(sOutFile, ImageFormat.Jpeg); + + // Load + using (Bitmap bmpLoad = new Bitmap(sOutFile)) + { + Assert.Equal(expected, bmpLoad.PixelFormat); + Color color = bmpLoad.GetPixel(10, 10); + // by default JPEG isn't lossless - so value is "near" read + Assert.True(color.R >= 195); + Assert.True(color.G < 60); + Assert.True(color.B < 60); + Assert.Equal(0xFF, color.A); + } + } + finally + { + gr.Dispose(); + bmp.Dispose(); + try + { + File.Delete(sOutFile); + } + catch + { + } + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_24bppRgb() + { + Save(PixelFormat.Format24bppRgb, PixelFormat.Format24bppRgb); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppRgb() + { + Save(PixelFormat.Format32bppRgb, PixelFormat.Format24bppRgb); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppArgb() + { + Save(PixelFormat.Format32bppArgb, PixelFormat.Format24bppRgb); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppPArgb() + { + Save(PixelFormat.Format32bppPArgb, PixelFormat.Format24bppRgb); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/PngCodecTesst.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/PngCodecTesst.cs new file mode 100644 index 0000000000..cba232a669 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/PngCodecTesst.cs @@ -0,0 +1,687 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// PNG Codec class testing unit +// +// Authors: +// Jordi Mas i Hernàndez (jordi@ximian.com) +// Sebastien Pouliot +// +// Copyright (C) 2006, 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.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Xunit; + +namespace MonoTests.System.Drawing.Imaging +{ + [ActiveIssue(24354, TestPlatforms.AnyUnix)] + public class PngCodecTest + { + private bool IsArm64Process() + { + if (Environment.OSVersion.Platform != PlatformID.Unix || !Environment.Is64BitProcess) + return false; + + try + { + var process = new global::System.Diagnostics.Process(); + process.StartInfo.FileName = "uname"; + process.StartInfo.Arguments = "-m"; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.UseShellExecute = false; + process.Start(); + process.WaitForExit(); + var output = process.StandardOutput.ReadToEnd(); + + return output.Trim() == "aarch64"; + } + catch + { + return false; + } + } + + /* Checks bitmap features on a known 1bbp bitmap */ + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap1bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("1bit.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format1bppIndexed, bmp.PixelFormat); + + Assert.Equal(0, bmp.Palette.Flags); + Assert.Equal(2, bmp.Palette.Entries.Length); + Assert.Equal(-16777216, bmp.Palette.Entries[0].ToArgb()); + Assert.Equal(-1, bmp.Palette.Entries[1].ToArgb()); + + Assert.Equal(288, bmp.Width); + Assert.Equal(384, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(288, rect.Width); + Assert.Equal(384, rect.Height); + + Assert.Equal(288, bmp.Size.Width); + Assert.Equal(384, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap1bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("1bit.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-1, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(0, 192).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(0, 224).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 256).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(0, 288).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(0, 320).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(0, 352).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(32, 192).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 224).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(32, 256).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(32, 288).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 320).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(32, 352).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 192).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 224).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 256).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 288).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 320).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 352).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(96, 192).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 224).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 256).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(96, 288).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(96, 320).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(96, 352).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 192).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 224).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(128, 256).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 288).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 320).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(128, 352).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-1, bmp.GetPixel(160, 160).ToArgb()); + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap1bitData() + { + string sInFile = Helpers.GetTestBitmapPath("1bit.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(864, data.Stride); + Assert.Equal(384, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(255, *(scan + 0)); + Assert.Equal(255, *(scan + 1009)); + Assert.Equal(255, *(scan + 2018)); + Assert.Equal(255, *(scan + 3027)); + Assert.Equal(255, *(scan + 4036)); + Assert.Equal(255, *(scan + 5045)); + Assert.Equal(255, *(scan + 6054)); + Assert.Equal(255, *(scan + 7063)); + Assert.Equal(255, *(scan + 8072)); + Assert.Equal(255, *(scan + 9081)); + Assert.Equal(255, *(scan + 10090)); + Assert.Equal(0, *(scan + 11099)); + Assert.Equal(255, *(scan + 12108)); + Assert.Equal(255, *(scan + 13117)); + Assert.Equal(0, *(scan + 14126)); + Assert.Equal(255, *(scan + 15135)); + Assert.Equal(255, *(scan + 16144)); + Assert.Equal(0, *(scan + 17153)); + Assert.Equal(0, *(scan + 18162)); + Assert.Equal(255, *(scan + 19171)); + Assert.Equal(0, *(scan + 20180)); + Assert.Equal(255, *(scan + 21189)); + Assert.Equal(255, *(scan + 22198)); + Assert.Equal(0, *(scan + 23207)); + Assert.Equal(0, *(scan + 24216)); + Assert.Equal(0, *(scan + 25225)); + Assert.Equal(0, *(scan + 26234)); + Assert.Equal(255, *(scan + 27243)); + Assert.Equal(255, *(scan + 28252)); + Assert.Equal(0, *(scan + 29261)); + Assert.Equal(255, *(scan + 30270)); + Assert.Equal(0, *(scan + 31279)); + Assert.Equal(0, *(scan + 32288)); + Assert.Equal(255, *(scan + 33297)); + Assert.Equal(255, *(scan + 34306)); + Assert.Equal(255, *(scan + 35315)); + Assert.Equal(255, *(scan + 36324)); + Assert.Equal(0, *(scan + 37333)); + Assert.Equal(255, *(scan + 38342)); + Assert.Equal(255, *(scan + 39351)); + Assert.Equal(255, *(scan + 40360)); + Assert.Equal(255, *(scan + 41369)); + Assert.Equal(255, *(scan + 42378)); + Assert.Equal(0, *(scan + 43387)); + Assert.Equal(0, *(scan + 44396)); + Assert.Equal(255, *(scan + 45405)); + Assert.Equal(255, *(scan + 46414)); + Assert.Equal(255, *(scan + 47423)); + Assert.Equal(255, *(scan + 48432)); + Assert.Equal(255, *(scan + 49441)); + Assert.Equal(0, *(scan + 50450)); + Assert.Equal(0, *(scan + 51459)); + Assert.Equal(255, *(scan + 52468)); + Assert.Equal(255, *(scan + 53477)); + Assert.Equal(255, *(scan + 54486)); + Assert.Equal(0, *(scan + 55495)); + Assert.Equal(0, *(scan + 56504)); + Assert.Equal(0, *(scan + 57513)); + Assert.Equal(255, *(scan + 58522)); + Assert.Equal(255, *(scan + 59531)); + Assert.Equal(0, *(scan + 60540)); + Assert.Equal(0, *(scan + 61549)); + Assert.Equal(0, *(scan + 62558)); + Assert.Equal(0, *(scan + 63567)); + Assert.Equal(255, *(scan + 64576)); + Assert.Equal(0, *(scan + 65585)); + Assert.Equal(255, *(scan + 66594)); + Assert.Equal(255, *(scan + 67603)); + Assert.Equal(0, *(scan + 68612)); + Assert.Equal(0, *(scan + 69621)); + Assert.Equal(0, *(scan + 70630)); + Assert.Equal(0, *(scan + 71639)); + Assert.Equal(0, *(scan + 72648)); + Assert.Equal(255, *(scan + 73657)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + /* Checks bitmap features on a known 2bbp bitmap */ + [ConditionalFact(Helpers.RecentGdiplusIsAvailable2)] + public void Bitmap2bitFeatures() + { + if (IsArm64Process()) + Assert.True(false, "https://bugzilla.xamarin.com/show_bug.cgi?id=41171"); + + string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + // quite a promotion! (2 -> 32) + Assert.Equal(PixelFormat.Format32bppArgb, bmp.PixelFormat); + + // MS returns a random Flags value (not a good sign) + //Assert.Equal (0, bmp.Palette.Flags); + Assert.Equal(0, bmp.Palette.Entries.Length); + + Assert.Equal(100, bmp.Width); + Assert.Equal(100, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(100, rect.Width); + Assert.Equal(100, rect.Height); + + Assert.Equal(100, bmp.Size.Width); + Assert.Equal(100, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable2)] + public void Bitmap2bitPixels() + { + if (IsArm64Process()) + Assert.True(false, "https://bugzilla.xamarin.com/show_bug.cgi?id=41171"); + + string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-11249559, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-16777216, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-11249559, bmp.GetPixel(96, 96).ToArgb()); + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable2)] + public void Bitmap2bitData() + { + if (IsArm64Process()) + Assert.True(false, "https://bugzilla.xamarin.com/show_bug.cgi?id=41171"); + + string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(300, data.Stride); + Assert.Equal(100, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(105, *(scan + 0)); + Assert.Equal(88, *(scan + 1009)); + Assert.Equal(255, *(scan + 2018)); + Assert.Equal(105, *(scan + 3027)); + Assert.Equal(88, *(scan + 4036)); + Assert.Equal(84, *(scan + 5045)); + Assert.Equal(255, *(scan + 6054)); + Assert.Equal(88, *(scan + 7063)); + Assert.Equal(84, *(scan + 8072)); + Assert.Equal(0, *(scan + 9081)); + Assert.Equal(0, *(scan + 10090)); + Assert.Equal(84, *(scan + 11099)); + Assert.Equal(0, *(scan + 12108)); + Assert.Equal(88, *(scan + 13117)); + Assert.Equal(84, *(scan + 14126)); + Assert.Equal(105, *(scan + 15135)); + Assert.Equal(88, *(scan + 16144)); + Assert.Equal(84, *(scan + 17153)); + Assert.Equal(0, *(scan + 18162)); + Assert.Equal(88, *(scan + 19171)); + Assert.Equal(84, *(scan + 20180)); + Assert.Equal(0, *(scan + 21189)); + Assert.Equal(88, *(scan + 22198)); + Assert.Equal(84, *(scan + 23207)); + Assert.Equal(105, *(scan + 24216)); + Assert.Equal(88, *(scan + 25225)); + Assert.Equal(0, *(scan + 26234)); + Assert.Equal(105, *(scan + 27243)); + Assert.Equal(88, *(scan + 28252)); + Assert.Equal(84, *(scan + 29261)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + /* Checks bitmap features on a known 4bbp bitmap */ + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap4bitFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("4bit.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + + Assert.Equal(PixelFormat.Format4bppIndexed, bmp.PixelFormat); + + Assert.Equal(0, bmp.Palette.Flags); + Assert.Equal(16, bmp.Palette.Entries.Length); + Assert.Equal(-12106173, bmp.Palette.Entries[0].ToArgb()); + Assert.Equal(-10979957, bmp.Palette.Entries[1].ToArgb()); + Assert.Equal(-8879241, bmp.Palette.Entries[2].ToArgb()); + Assert.Equal(-10381134, bmp.Palette.Entries[3].ToArgb()); + Assert.Equal(-7441574, bmp.Palette.Entries[4].ToArgb()); + Assert.Equal(-6391673, bmp.Palette.Entries[5].ToArgb()); + Assert.Equal(-5861009, bmp.Palette.Entries[6].ToArgb()); + Assert.Equal(-3824008, bmp.Palette.Entries[7].ToArgb()); + Assert.Equal(-5790569, bmp.Palette.Entries[8].ToArgb()); + Assert.Equal(-6178617, bmp.Palette.Entries[9].ToArgb()); + Assert.Equal(-4668490, bmp.Palette.Entries[10].ToArgb()); + Assert.Equal(-5060143, bmp.Palette.Entries[11].ToArgb()); + Assert.Equal(-3492461, bmp.Palette.Entries[12].ToArgb()); + Assert.Equal(-2967099, bmp.Palette.Entries[13].ToArgb()); + Assert.Equal(-2175574, bmp.Palette.Entries[14].ToArgb()); + Assert.Equal(-1314578, bmp.Palette.Entries[15].ToArgb()); + + Assert.Equal(288, bmp.Width); + Assert.Equal(384, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(288, rect.Width); + Assert.Equal(384, rect.Height); + + Assert.Equal(288, bmp.Size.Width); + Assert.Equal(384, bmp.Size.Height); + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap4bitPixels() + { + string sInFile = Helpers.GetTestBitmapPath("4bit.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-10381134, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-3824008, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(0, 192).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(0, 224).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(0, 256).ToArgb()); + Assert.Equal(-7441574, bmp.GetPixel(0, 288).ToArgb()); + Assert.Equal(-3492461, bmp.GetPixel(0, 320).ToArgb()); + Assert.Equal(-5861009, bmp.GetPixel(0, 352).ToArgb()); + Assert.Equal(-10381134, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-7441574, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(32, 192).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(32, 224).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(32, 256).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(32, 288).ToArgb()); + Assert.Equal(-3492461, bmp.GetPixel(32, 320).ToArgb()); + Assert.Equal(-2175574, bmp.GetPixel(32, 352).ToArgb()); + Assert.Equal(-6178617, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 192).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 224).ToArgb()); + Assert.Equal(-5790569, bmp.GetPixel(64, 256).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 288).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(64, 320).ToArgb()); + Assert.Equal(-5790569, bmp.GetPixel(64, 352).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-10381134, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-7441574, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-5790569, bmp.GetPixel(96, 192).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(96, 224).ToArgb()); + Assert.Equal(-4668490, bmp.GetPixel(96, 256).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(96, 288).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(96, 320).ToArgb()); + Assert.Equal(-3492461, bmp.GetPixel(96, 352).ToArgb()); + Assert.Equal(-5861009, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-7441574, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-7441574, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 192).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 224).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 256).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 288).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 320).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(128, 352).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-1314578, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-5790569, bmp.GetPixel(160, 160).ToArgb()); + Assert.Equal(-12106173, bmp.GetPixel(160, 192).ToArgb()); + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Bitmap4bitData() + { + string sInFile = Helpers.GetTestBitmapPath("4bit.png"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(864, data.Stride); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(178, *(scan + 0)); + Assert.Equal(184, *(scan + 1009)); + Assert.Equal(235, *(scan + 2018)); + Assert.Equal(209, *(scan + 3027)); + Assert.Equal(240, *(scan + 4036)); + Assert.Equal(142, *(scan + 5045)); + Assert.Equal(139, *(scan + 6054)); + Assert.Equal(152, *(scan + 7063)); + Assert.Equal(235, *(scan + 8072)); + Assert.Equal(209, *(scan + 9081)); + Assert.Equal(240, *(scan + 10090)); + Assert.Equal(142, *(scan + 11099)); + Assert.Equal(199, *(scan + 12108)); + Assert.Equal(201, *(scan + 13117)); + Assert.Equal(97, *(scan + 14126)); + Assert.Equal(238, *(scan + 15135)); + Assert.Equal(240, *(scan + 16144)); + Assert.Equal(158, *(scan + 17153)); + Assert.Equal(119, *(scan + 18162)); + Assert.Equal(201, *(scan + 19171)); + Assert.Equal(88, *(scan + 20180)); + Assert.Equal(238, *(scan + 21189)); + Assert.Equal(240, *(scan + 22198)); + Assert.Equal(120, *(scan + 23207)); + Assert.Equal(182, *(scan + 24216)); + Assert.Equal(70, *(scan + 25225)); + Assert.Equal(71, *(scan + 26234)); + Assert.Equal(238, *(scan + 27243)); + Assert.Equal(240, *(scan + 28252)); + Assert.Equal(120, *(scan + 29261)); + Assert.Equal(238, *(scan + 30270)); + Assert.Equal(70, *(scan + 31279)); + Assert.Equal(71, *(scan + 32288)); + Assert.Equal(238, *(scan + 33297)); + Assert.Equal(240, *(scan + 34306)); + Assert.Equal(210, *(scan + 35315)); + Assert.Equal(238, *(scan + 36324)); + Assert.Equal(70, *(scan + 37333)); + Assert.Equal(97, *(scan + 38342)); + Assert.Equal(238, *(scan + 39351)); + Assert.Equal(240, *(scan + 40360)); + Assert.Equal(235, *(scan + 41369)); + Assert.Equal(238, *(scan + 42378)); + Assert.Equal(117, *(scan + 43387)); + Assert.Equal(158, *(scan + 44396)); + Assert.Equal(170, *(scan + 45405)); + Assert.Equal(240, *(scan + 46414)); + Assert.Equal(235, *(scan + 47423)); + Assert.Equal(209, *(scan + 48432)); + Assert.Equal(120, *(scan + 49441)); + Assert.Equal(71, *(scan + 50450)); + Assert.Equal(119, *(scan + 51459)); + Assert.Equal(240, *(scan + 52468)); + Assert.Equal(235, *(scan + 53477)); + Assert.Equal(209, *(scan + 54486)); + Assert.Equal(70, *(scan + 55495)); + Assert.Equal(71, *(scan + 56504)); + Assert.Equal(67, *(scan + 57513)); + Assert.Equal(240, *(scan + 58522)); + Assert.Equal(167, *(scan + 59531)); + Assert.Equal(67, *(scan + 60540)); + Assert.Equal(70, *(scan + 61549)); + Assert.Equal(71, *(scan + 62558)); + Assert.Equal(67, *(scan + 63567)); + Assert.Equal(240, *(scan + 64576)); + Assert.Equal(120, *(scan + 65585)); + Assert.Equal(182, *(scan + 66594)); + Assert.Equal(70, *(scan + 67603)); + Assert.Equal(120, *(scan + 68612)); + Assert.Equal(67, *(scan + 69621)); + Assert.Equal(70, *(scan + 70630)); + Assert.Equal(71, *(scan + 71639)); + Assert.Equal(90, *(scan + 72648)); + Assert.Equal(240, *(scan + 73657)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + private void Save(PixelFormat original, PixelFormat expected, bool colorCheck) + { + string sOutFile = $"linerect-{expected}.png"; + + // Save + Bitmap bmp = new Bitmap(100, 100, original); + Graphics gr = Graphics.FromImage(bmp); + + using (Pen p = new Pen(Color.BlueViolet, 2)) + { + gr.DrawLine(p, 10.0F, 10.0F, 90.0F, 90.0F); + gr.DrawRectangle(p, 10.0F, 10.0F, 80.0F, 80.0F); + } + + try + { + bmp.Save(sOutFile, ImageFormat.Png); + + // Load + using (Bitmap bmpLoad = new Bitmap(sOutFile)) + { + Assert.Equal(expected, bmpLoad.PixelFormat); + if (colorCheck) + { + Color color = bmpLoad.GetPixel(10, 10); + Assert.Equal(Color.FromArgb(255, 138, 43, 226), color); + } + } + } + finally + { + gr.Dispose(); + bmp.Dispose(); + try + { + File.Delete(sOutFile); + } + catch + { + } + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_24bppRgb() + { + Save(PixelFormat.Format24bppRgb, PixelFormat.Format24bppRgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppRgb() + { + Save(PixelFormat.Format32bppRgb, PixelFormat.Format32bppArgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppArgb() + { + Save(PixelFormat.Format32bppArgb, PixelFormat.Format32bppArgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppPArgb() + { + Save(PixelFormat.Format32bppPArgb, PixelFormat.Format32bppArgb, true); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/TiffCodecTests.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/TiffCodecTests.cs new file mode 100644 index 0000000000..63e904b409 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing.Imaging/TiffCodecTests.cs @@ -0,0 +1,315 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// TIFF Codec class testing unit +// +// Authors: +// Jordi Mas i Hernàndez (jordi@ximian.com) +// Sebastien Pouliot +// +// Copyright (C) 2006, 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.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Xunit; + +namespace MonoTests.System.Drawing.Imaging +{ + public class TiffCodecTest + { + /* Checks bitmap features on a known 32bbp bitmap */ + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap32bitsFeatures() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.tif"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + GraphicsUnit unit = GraphicsUnit.World; + RectangleF rect = bmp.GetBounds(ref unit); + // MS reports 24 bpp while we report 32 bpp + // Assert.Equal (PixelFormat.Format24bppRgb, bmp.PixelFormat); + Assert.Equal(173, bmp.Width); + Assert.Equal(183, bmp.Height); + + Assert.Equal(0, rect.X); + Assert.Equal(0, rect.Y); + Assert.Equal(173, rect.Width); + Assert.Equal(183, rect.Height); + + Assert.Equal(173, bmp.Size.Width); + Assert.Equal(183, bmp.Size.Height); + } + } + + /* Checks bitmap features on a known 32bbp bitmap */ + [ConditionalFact(Helpers.GdiplusIsAvailable)] + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + public void Bitmap32bitsPixelFormat() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.tif"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // GDI+ reports 24 bpp while libgdiplus reports 32 bpp + Assert.Equal (PixelFormat.Format24bppRgb, bmp.PixelFormat); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap32bitsPixels() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.tif"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + // sampling values from a well known bitmap + Assert.Equal(-1579559, bmp.GetPixel(0, 0).ToArgb()); + Assert.Equal(-1645353, bmp.GetPixel(0, 32).ToArgb()); + Assert.Equal(-461332, bmp.GetPixel(0, 64).ToArgb()); + Assert.Equal(-330005, bmp.GetPixel(0, 96).ToArgb()); + Assert.Equal(-2237489, bmp.GetPixel(0, 128).ToArgb()); + Assert.Equal(-1251105, bmp.GetPixel(0, 160).ToArgb()); + Assert.Equal(-3024947, bmp.GetPixel(32, 0).ToArgb()); + Assert.Equal(-2699070, bmp.GetPixel(32, 32).ToArgb()); + Assert.Equal(-2366734, bmp.GetPixel(32, 64).ToArgb()); + Assert.Equal(-4538413, bmp.GetPixel(32, 96).ToArgb()); + Assert.Equal(-6116681, bmp.GetPixel(32, 128).ToArgb()); + Assert.Equal(-7369076, bmp.GetPixel(32, 160).ToArgb()); + Assert.Equal(-13024729, bmp.GetPixel(64, 0).ToArgb()); + Assert.Equal(-7174020, bmp.GetPixel(64, 32).ToArgb()); + Assert.Equal(-51, bmp.GetPixel(64, 64).ToArgb()); + Assert.Equal(-16053503, bmp.GetPixel(64, 96).ToArgb()); + Assert.Equal(-8224431, bmp.GetPixel(64, 128).ToArgb()); + Assert.Equal(-16579326, bmp.GetPixel(64, 160).ToArgb()); + Assert.Equal(-2502457, bmp.GetPixel(96, 0).ToArgb()); + Assert.Equal(-9078395, bmp.GetPixel(96, 32).ToArgb()); + Assert.Equal(-12696508, bmp.GetPixel(96, 64).ToArgb()); + Assert.Equal(-70772, bmp.GetPixel(96, 96).ToArgb()); + Assert.Equal(-4346279, bmp.GetPixel(96, 128).ToArgb()); + Assert.Equal(-11583193, bmp.GetPixel(96, 160).ToArgb()); + Assert.Equal(-724763, bmp.GetPixel(128, 0).ToArgb()); + Assert.Equal(-7238268, bmp.GetPixel(128, 32).ToArgb()); + Assert.Equal(-2169612, bmp.GetPixel(128, 64).ToArgb()); + Assert.Equal(-3683883, bmp.GetPixel(128, 96).ToArgb()); + Assert.Equal(-12892867, bmp.GetPixel(128, 128).ToArgb()); + Assert.Equal(-3750464, bmp.GetPixel(128, 160).ToArgb()); + Assert.Equal(-3222844, bmp.GetPixel(160, 0).ToArgb()); + Assert.Equal(-65806, bmp.GetPixel(160, 32).ToArgb()); + Assert.Equal(-2961726, bmp.GetPixel(160, 64).ToArgb()); + Assert.Equal(-2435382, bmp.GetPixel(160, 96).ToArgb()); + Assert.Equal(-2501944, bmp.GetPixel(160, 128).ToArgb()); + Assert.Equal(-9211799, bmp.GetPixel(160, 160).ToArgb()); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Bitmap32bitsData() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.tif"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(bmp.Height, data.Height); + Assert.Equal(bmp.Width, data.Width); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.Equal(520, data.Stride); + Assert.Equal(183, data.Height); + + unsafe + { + byte* scan = (byte*)data.Scan0; + // sampling values from a well known bitmap + Assert.Equal(217, *(scan + 0)); + Assert.Equal(192, *(scan + 1009)); + Assert.Equal(210, *(scan + 2018)); + Assert.Equal(196, *(scan + 3027)); + Assert.Equal(216, *(scan + 4036)); + Assert.Equal(215, *(scan + 5045)); + Assert.Equal(218, *(scan + 6054)); + Assert.Equal(218, *(scan + 7063)); + Assert.Equal(95, *(scan + 8072)); + Assert.Equal(9, *(scan + 9081)); + Assert.Equal(247, *(scan + 10090)); + Assert.Equal(161, *(scan + 11099)); + Assert.Equal(130, *(scan + 12108)); + Assert.Equal(131, *(scan + 13117)); + Assert.Equal(175, *(scan + 14126)); + Assert.Equal(217, *(scan + 15135)); + Assert.Equal(201, *(scan + 16144)); + Assert.Equal(183, *(scan + 17153)); + Assert.Equal(236, *(scan + 18162)); + Assert.Equal(242, *(scan + 19171)); + Assert.Equal(125, *(scan + 20180)); + Assert.Equal(193, *(scan + 21189)); + Assert.Equal(227, *(scan + 22198)); + Assert.Equal(44, *(scan + 23207)); + Assert.Equal(230, *(scan + 24216)); + Assert.Equal(224, *(scan + 25225)); + Assert.Equal(164, *(scan + 26234)); + Assert.Equal(43, *(scan + 27243)); + Assert.Equal(200, *(scan + 28252)); + Assert.Equal(255, *(scan + 29261)); + Assert.Equal(226, *(scan + 30270)); + Assert.Equal(230, *(scan + 31279)); + Assert.Equal(178, *(scan + 32288)); + Assert.Equal(224, *(scan + 33297)); + Assert.Equal(233, *(scan + 34306)); + Assert.Equal(212, *(scan + 35315)); + Assert.Equal(153, *(scan + 36324)); + Assert.Equal(143, *(scan + 37333)); + Assert.Equal(215, *(scan + 38342)); + Assert.Equal(116, *(scan + 39351)); + Assert.Equal(26, *(scan + 40360)); + Assert.Equal(28, *(scan + 41369)); + Assert.Equal(75, *(scan + 42378)); + Assert.Equal(50, *(scan + 43387)); + Assert.Equal(244, *(scan + 44396)); + Assert.Equal(191, *(scan + 45405)); + Assert.Equal(200, *(scan + 46414)); + Assert.Equal(197, *(scan + 47423)); + Assert.Equal(232, *(scan + 48432)); + Assert.Equal(186, *(scan + 49441)); + Assert.Equal(210, *(scan + 50450)); + Assert.Equal(215, *(scan + 51459)); + Assert.Equal(155, *(scan + 52468)); + Assert.Equal(56, *(scan + 53477)); + Assert.Equal(149, *(scan + 54486)); + Assert.Equal(137, *(scan + 55495)); + Assert.Equal(141, *(scan + 56504)); + Assert.Equal(36, *(scan + 57513)); + Assert.Equal(39, *(scan + 58522)); + Assert.Equal(25, *(scan + 59531)); + Assert.Equal(44, *(scan + 60540)); + Assert.Equal(12, *(scan + 61549)); + Assert.Equal(161, *(scan + 62558)); + Assert.Equal(179, *(scan + 63567)); + Assert.Equal(181, *(scan + 64576)); + Assert.Equal(165, *(scan + 65585)); + Assert.Equal(182, *(scan + 66594)); + Assert.Equal(186, *(scan + 67603)); + Assert.Equal(201, *(scan + 68612)); + Assert.Equal(49, *(scan + 69621)); + Assert.Equal(161, *(scan + 70630)); + Assert.Equal(140, *(scan + 71639)); + Assert.Equal(2, *(scan + 72648)); + Assert.Equal(15, *(scan + 73657)); + Assert.Equal(33, *(scan + 74666)); + Assert.Equal(17, *(scan + 75675)); + Assert.Equal(0, *(scan + 76684)); + Assert.Equal(47, *(scan + 77693)); + Assert.Equal(4, *(scan + 78702)); + Assert.Equal(142, *(scan + 79711)); + Assert.Equal(151, *(scan + 80720)); + Assert.Equal(124, *(scan + 81729)); + Assert.Equal(81, *(scan + 82738)); + Assert.Equal(214, *(scan + 83747)); + Assert.Equal(217, *(scan + 84756)); + Assert.Equal(30, *(scan + 85765)); + Assert.Equal(185, *(scan + 86774)); + Assert.Equal(200, *(scan + 87783)); + Assert.Equal(37, *(scan + 88792)); + Assert.Equal(2, *(scan + 89801)); + Assert.Equal(41, *(scan + 90810)); + Assert.Equal(16, *(scan + 91819)); + Assert.Equal(0, *(scan + 92828)); + Assert.Equal(146, *(scan + 93837)); + Assert.Equal(163, *(scan + 94846)); + } + } + finally + { + bmp.UnlockBits(data); + } + } + } + + private void Save(PixelFormat original, PixelFormat expected, bool colorCheck) + { + string sOutFile = $"linerect-{expected}.tif"; + + // Save + Bitmap bmp = new Bitmap(100, 100, original); + Graphics gr = Graphics.FromImage(bmp); + + using (Pen p = new Pen(Color.BlueViolet, 2)) + { + gr.DrawLine(p, 10.0F, 10.0F, 90.0F, 90.0F); + gr.DrawRectangle(p, 10.0F, 10.0F, 80.0F, 80.0F); + } + + try + { + bmp.Save(sOutFile, ImageFormat.Tiff); + + // Load + using (Bitmap bmpLoad = new Bitmap(sOutFile)) + { + Assert.Equal(expected, bmpLoad.PixelFormat); + if (colorCheck) + { + Color color = bmpLoad.GetPixel(10, 10); + Assert.Equal(Color.FromArgb(255, 138, 43, 226), color); + } + } + } + finally + { + gr.Dispose(); + bmp.Dispose(); + try + { + File.Delete(sOutFile); + } + catch + { + } + } + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_24bppRgb() + { + Save(PixelFormat.Format24bppRgb, PixelFormat.Format24bppRgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppRgb() + { + Save(PixelFormat.Format32bppRgb, PixelFormat.Format32bppArgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppArgb() + { + Save(PixelFormat.Format32bppArgb, PixelFormat.Format32bppArgb, true); + } + + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + public void Save_32bppPArgb() + { + Save(PixelFormat.Format32bppPArgb, PixelFormat.Format32bppArgb, true); + } + } +} diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs new file mode 100644 index 0000000000..f11f2999cb --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs @@ -0,0 +1,1583 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Bitmap class testing unit +// +// Authors: +// Jordi Mas i Hernàndez (jmas@softcatala.org> +// Jonathan Gilbert +// Sebastien Pouliot +// +// (C) 2004 Ximian, Inc. http://www.ximian.com +// Copyright (C) 2004,2006-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.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; +using System.Security.Cryptography; +using System.Security.Permissions; +using System.Text; +using System.Xml.Serialization; +using Xunit; + +namespace MonoTests.System.Drawing +{ + + public class TestBitmap + { + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void TestPixels() + { + // Tests GetSetPixel/SetPixel + Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppRgb); + bmp.SetPixel(0, 0, Color.FromArgb(255, 128, 128, 128)); + Color color = bmp.GetPixel(0, 0); + + Assert.Equal(Color.FromArgb(255, 128, 128, 128), color); + + bmp.SetPixel(99, 99, Color.FromArgb(255, 255, 0, 155)); + Color color2 = bmp.GetPixel(99, 99); + Assert.Equal(Color.FromArgb(255, 255, 0, 155), color2); + } + + [ActiveIssue(20884)] + public void LockBits_IndexedWrite_NonIndexed() + { + using (Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format8bppIndexed)) + { + Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); + Assert.Throws(() => bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb)); + } + } + + [ActiveIssue(20884)] + public void LockBits_NonIndexedWrite_ToIndexed() + { + using (Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppRgb)) + { + BitmapData bd = new BitmapData(); + Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height); + Assert.Throws(() => bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed, bd)); + + // test to see if there's a leak or not in this case + Assert.Equal(IntPtr.Zero, bd.Scan0); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBits_ImageLockMode_Invalid() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format24bppRgb)) + { + Rectangle r = new Rectangle(4, 4, 4, 4); + BitmapData data = bmp.LockBits(r, (ImageLockMode)0, PixelFormat.Format24bppRgb); + try + { + Assert.Equal(4, data.Height); + Assert.Equal(4, data.Width); + Assert.True(data.Stride >= 12); + Assert.Equal(PixelFormat.Format24bppRgb, data.PixelFormat); + Assert.False(IntPtr.Zero.Equals(data.Scan0)); + } + finally + { + bmp.UnlockBits(data); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBits_Double() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format24bppRgb)) + { + Rectangle r = new Rectangle(4, 4, 4, 4); + BitmapData data = bmp.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + Assert.Throws(() => bmp.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)); + } + finally + { + bmp.UnlockBits(data); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format1bppIndexed() + { + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format1bppIndexed)) + { + Color c = bmp.GetPixel(0, 0); + Assert.Equal(-16777216, c.ToArgb()); + Assert.Throws(() => bmp.SetPixel(0, 0, c)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format4bppIndexed() + { + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format4bppIndexed)) + { + Color c = bmp.GetPixel(0, 0); + Assert.Equal(-16777216, c.ToArgb()); + Assert.Throws(() => bmp.SetPixel(0, 0, c)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format8bppIndexed() + { + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed)) + { + Color c = bmp.GetPixel(0, 0); + Assert.Equal(-16777216, c.ToArgb()); + Assert.Throws(() => bmp.SetPixel(0, 0, c)); + } + } + + private void FormatTest(PixelFormat format) + { + bool alpha = Image.IsAlphaPixelFormat(format); + int size = Image.GetPixelFormatSize(format) / 8 * 2; + using (Bitmap bmp = new Bitmap(2, 1, format)) + { + Color a = Color.FromArgb(128, 64, 32, 16); + Color b = Color.FromArgb(192, 96, 48, 24); + bmp.SetPixel(0, 0, a); + bmp.SetPixel(1, 0, b); + Color c = bmp.GetPixel(0, 0); + Color d = bmp.GetPixel(1, 0); + if (size == 4) + { + Assert.Equal(255, c.A); + Assert.Equal(66, c.R); + if (format == PixelFormat.Format16bppRgb565) + { + Assert.Equal(32, c.G); + } + else + { + Assert.Equal(33, c.G); + } + Assert.Equal(16, c.B); + + Assert.Equal(255, d.A); + Assert.Equal(99, d.R); + if (format == PixelFormat.Format16bppRgb565) + { + Assert.Equal(48, d.G); + } + else + { + Assert.Equal(49, d.G); + } + Assert.Equal(24, d.B); + } + else if (alpha) + { + if (format == PixelFormat.Format32bppPArgb) + { + Assert.Equal(a.A, c.A); + // note sure why the -1 + Assert.Equal(a.R - 1, c.R); + Assert.Equal(a.G - 1, c.G); + Assert.Equal(a.B - 1, c.B); + + Assert.Equal(b.A, d.A); + // note sure why the -1 + Assert.Equal(b.R - 1, d.R); + Assert.Equal(b.G - 1, d.G); + Assert.Equal(b.B - 1, d.B); + } + else + { + Assert.Equal(a, c); + Assert.Equal(b, d); + } + } + else + { + Assert.Equal(Color.FromArgb(255, 64, 32, 16), c); + Assert.Equal(Color.FromArgb(255, 96, 48, 24), d); + } + BitmapData bd = bmp.LockBits(new Rectangle(0, 0, 2, 1), ImageLockMode.ReadOnly, format); + try + { + byte[] data = new byte[size]; + Marshal.Copy(bd.Scan0, data, 0, size); + if (format == PixelFormat.Format32bppPArgb) + { + Assert.Equal(Math.Ceiling((float)c.B * c.A / 255), data[0]); + Assert.Equal(Math.Ceiling((float)c.G * c.A / 255), data[1]); + Assert.Equal(Math.Ceiling((float)c.R * c.A / 255), data[2]); + Assert.Equal(c.A, data[3]); + Assert.Equal(Math.Ceiling((float)d.B * d.A / 255), data[4]); + Assert.Equal(Math.Ceiling((float)d.G * d.A / 255), data[5]); + Assert.Equal(Math.Ceiling((float)d.R * d.A / 255), data[6]); + Assert.Equal(d.A, data[7]); + } + else if (size == 4) + { + int n = 0; + switch (format) + { + case PixelFormat.Format16bppRgb565: + Assert.Equal(2, data[n++]); + Assert.Equal(65, data[n++]); + Assert.Equal(131, data[n++]); + Assert.Equal(97, data[n++]); + break; + case PixelFormat.Format16bppArgb1555: + Assert.Equal(130, data[n++]); + Assert.Equal(160, data[n++]); + Assert.Equal(195, data[n++]); + Assert.Equal(176, data[n++]); + break; + case PixelFormat.Format16bppRgb555: + Assert.Equal(130, data[n++]); + Assert.Equal(32, data[n++]); + Assert.Equal(195, data[n++]); + Assert.Equal(48, data[n++]); + break; + } + } + else + { + int n = 0; + Assert.Equal(c.B, data[n++]); + Assert.Equal(c.G, data[n++]); + Assert.Equal(c.R, data[n++]); + if (size % 4 == 0) + Assert.Equal(c.A, data[n++]); + Assert.Equal(d.B, data[n++]); + Assert.Equal(d.G, data[n++]); + Assert.Equal(d.R, data[n++]); + if (size % 4 == 0) + Assert.Equal(d.A, data[n++]); + } + } + finally + { + bmp.UnlockBits(bd); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format32bppArgb() + { + FormatTest(PixelFormat.Format32bppArgb); + } + + [ActiveIssue(20884)] + public void Format32bppRgb() + { + FormatTest(PixelFormat.Format32bppRgb); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format24bppRgb() + { + FormatTest(PixelFormat.Format24bppRgb); + } + + /* Get the output directory depending on the runtime and location*/ + public static string getOutSubDir() + { + string sSub, sRslt; + + if (Environment.GetEnvironmentVariable("MSNet") == null) + sSub = "mono/"; + else + sSub = "MSNet/"; + + sRslt = Path.GetFullPath(sSub); + + if (!Directory.Exists(sRslt)) + { + sRslt = "Test/System.Drawing/" + sSub; + } + + if (sRslt.Length > 0) + { + if (sRslt[sRslt.Length - 1] != '\\' && sRslt[sRslt.Length - 1] != '/') + { + sRslt += "/"; + } + } + + return sRslt; + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Clone() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + Rectangle rect = new Rectangle(0, 0, 50, 50); + using (Bitmap bmp = new Bitmap(sInFile)) + using (Bitmap bmpNew = bmp.Clone(rect, PixelFormat.Format32bppArgb)) + { + Color colororg0 = bmp.GetPixel(0, 0); + Color colororg50 = bmp.GetPixel(49, 49); + Color colornew0 = bmpNew.GetPixel(0, 0); + Color colornew50 = bmpNew.GetPixel(49, 49); + + Assert.Equal(colororg0, colornew0); + Assert.Equal(colororg50, colornew50); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void CloneImage() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + using (Bitmap bmpNew = (Bitmap)bmp.Clone()) + { + Assert.Equal(bmp.Width, bmpNew.Width); + Assert.Equal(bmp.Height, bmpNew.Height); + Assert.Equal(bmp.PixelFormat, bmpNew.PixelFormat); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Frames() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + int cnt = bmp.GetFrameCount(FrameDimension.Page); + int active = bmp.SelectActiveFrame(FrameDimension.Page, 0); + + Assert.Equal(1, cnt); + Assert.Equal(0, active); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void FileDoesNotExists() + { + Assert.Throws(() => new Bitmap("FileDoesNotExists.jpg")); + } + + static string ByteArrayToString(byte[] arrInput) + { + StringBuilder sOutput = new StringBuilder(arrInput.Length); + for (int i = 0; i < arrInput.Length - 1; i++) + { + sOutput.Append(arrInput[i].ToString("X2")); + } + return sOutput.ToString(); + } + + + public string RotateBmp(Bitmap src, RotateFlipType rotate) + { + int width = 150, height = 150, index = 0; + byte[] pixels = new byte[width * height * 3]; + byte[] hash; + Color clr; + + using (Bitmap bmp_rotate = src.Clone(new RectangleF(0, 0, width, height), PixelFormat.Format32bppArgb)) + { + bmp_rotate.RotateFlip(rotate); + + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + clr = bmp_rotate.GetPixel(x, y); + pixels[index++] = clr.R; + pixels[index++] = clr.G; + pixels[index++] = clr.B; + } + } + + hash = MD5.Create().ComputeHash(pixels); + return ByteArrayToString(hash); + } + } + public string RotateIndexedBmp(Bitmap src, RotateFlipType type) + { + int pixels_per_byte; + + switch (src.PixelFormat) + { + case PixelFormat.Format1bppIndexed: + pixels_per_byte = 8; + break; + case PixelFormat.Format4bppIndexed: + pixels_per_byte = 2; + break; + case PixelFormat.Format8bppIndexed: + pixels_per_byte = 1; + break; + + default: + throw new Exception("Cannot pass a bitmap of format " + src.PixelFormat + " to RotateIndexedBmp"); + } + + using (Bitmap test = src.Clone() as Bitmap) + { + test.RotateFlip(type); + + BitmapData data = null; + byte[] pixel_data; + + try + { + data = test.LockBits(new Rectangle(0, 0, test.Width, test.Height), ImageLockMode.ReadOnly, test.PixelFormat); + + int scan_size = (data.Width + pixels_per_byte - 1) / pixels_per_byte; + pixel_data = new byte[data.Height * scan_size]; + + for (int y = 0; y < data.Height; y++) + { + IntPtr src_ptr = (IntPtr)(y * data.Stride + data.Scan0.ToInt64()); + int dest_offset = y * scan_size; + for (int x = 0; x < scan_size; x++) + pixel_data[dest_offset + x] = Marshal.ReadByte(src_ptr, x); + } + } + finally + { + if (test != null && data != null) + { + try + { test.UnlockBits(data); } + catch { } + } + } + + if (pixel_data == null) + return "--ERROR--"; + + byte[] hash = MD5.Create().ComputeHash(pixel_data); + return ByteArrayToString(hash); + } + } + + + // Rotate bitmap in diffent ways, and check the result + // pixels using MD5 + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Rotate() + { + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bmp = new Bitmap(sInFile)) + { + Assert.Equal("312958A3C67402E1299413794988A3", RotateBmp(bmp, RotateFlipType.Rotate90FlipNone)); + Assert.Equal("BF70D8DA4F1545AEDD77D0296B47AE", RotateBmp(bmp, RotateFlipType.Rotate180FlipNone)); + Assert.Equal("15AD2ADBDC7090C0EC744D0F7ACE2F", RotateBmp(bmp, RotateFlipType.Rotate270FlipNone)); + Assert.Equal("2E10FEC1F4FD64ECC51D7CE68AEB18", RotateBmp(bmp, RotateFlipType.RotateNoneFlipX)); + Assert.Equal("E63204779B566ED01162B90B49BD9E", RotateBmp(bmp, RotateFlipType.Rotate90FlipX)); + Assert.Equal("B1ECB17B5093E13D04FF55CFCF7763", RotateBmp(bmp, RotateFlipType.Rotate180FlipX)); + Assert.Equal("71A173882C16755D86F4BC26532374", RotateBmp(bmp, RotateFlipType.Rotate270FlipX)); + } + } + + // Rotate 1- and 4-bit bitmaps in different ways and check the + // resulting pixels using MD5 + [ConditionalFact(Helpers.RecentGdiplusIsAvailable)] + [PlatformSpecific(TestPlatforms.AnyUnix)] + public void Rotate1bit4bit() + { + string[] files = { + Helpers.GetTestBitmapPath ("1bit.png"), + Helpers.GetTestBitmapPath ("4bit.png") + }; + + StringBuilder md5s = new StringBuilder(); + + foreach (string file in files) + { + using (Bitmap bmp = new Bitmap(file)) + { + foreach (RotateFlipType type in Enum.GetValues(typeof(RotateFlipType))) + { + md5s.Append(RotateIndexedBmp(bmp, type)); + } + } + } + + using (StreamWriter writer = new StreamWriter("/tmp/md5s.txt")) + { + writer.WriteLine(md5s); + } + + Assert.Equal( + "A4DAF507C92BDE10626BC7B34FEFE5" + // 1-bit RotateNoneFlipNone + "A4DAF507C92BDE10626BC7B34FEFE5" + // 1-bit Rotate180FlipXY + "C0975EAFD2FC1CC9CC7AF20B92FC9F" + // 1-bit Rotate90FlipNone + "C0975EAFD2FC1CC9CC7AF20B92FC9F" + // 1-bit Rotate270FlipXY + "64AE60858A02228F7B1B18C7812FB6" + // 1-bit Rotate180FlipNone + "64AE60858A02228F7B1B18C7812FB6" + // 1-bit RotateNoneFlipXY + "E96D3390938350F9DE2608C4364424" + // 1-bit Rotate270FlipNone + "E96D3390938350F9DE2608C4364424" + // 1-bit Rotate90FlipXY + "23947CE822C1DDE6BEA69C01F8D0D9" + // 1-bit RotateNoneFlipX + "23947CE822C1DDE6BEA69C01F8D0D9" + // 1-bit Rotate180FlipY + "BE45F685BDEBD7079AA1B2CBA46723" + // 1-bit Rotate90FlipX + "BE45F685BDEBD7079AA1B2CBA46723" + // 1-bit Rotate270FlipY + "353E937CFF31B1BF6C3DD0A031ACB5" + // 1-bit Rotate180FlipX + "353E937CFF31B1BF6C3DD0A031ACB5" + // 1-bit RotateNoneFlipY + "AEA18A770A845E25B6A8CE28DD6DCB" + // 1-bit Rotate270FlipX + "AEA18A770A845E25B6A8CE28DD6DCB" + // 1-bit Rotate90FlipY + "3CC874B571902366AACED5D619E87D" + // 4-bit RotateNoneFlipNone + "3CC874B571902366AACED5D619E87D" + // 4-bit Rotate180FlipXY + "8DE25C7E1BE4A3B535DB5D83198D83" + // 4-bit Rotate90FlipNone + "8DE25C7E1BE4A3B535DB5D83198D83" + // 4-bit Rotate270FlipXY + "27CF5E9CE70BE9EBC47FB996721B95" + // 4-bit Rotate180FlipNone + "27CF5E9CE70BE9EBC47FB996721B95" + // 4-bit RotateNoneFlipXY + "A919CCB8F97CAD7DC1F01026D11A5D" + // 4-bit Rotate270FlipNone + "A919CCB8F97CAD7DC1F01026D11A5D" + // 4-bit Rotate90FlipXY + "545876C99ACF833E69FBFFBF436034" + // 4-bit RotateNoneFlipX + "545876C99ACF833E69FBFFBF436034" + // 4-bit Rotate180FlipY + "5DB56687757CDEFC52D89C77CA9223" + // 4-bit Rotate90FlipX + "5DB56687757CDEFC52D89C77CA9223" + // 4-bit Rotate270FlipY + "05A77EDDCDF20D5B0AC0169E95D7D7" + // 4-bit Rotate180FlipX + "05A77EDDCDF20D5B0AC0169E95D7D7" + // 4-bit RotateNoneFlipY + "B6B6245796C836923ABAABDF368B29" + // 4-bit Rotate270FlipX + "B6B6245796C836923ABAABDF368B29", // 4-bit Rotate90FlipY + md5s.ToString()); + } + + private Bitmap CreateBitmap(int width, int height, PixelFormat fmt) + { + Bitmap bmp = new Bitmap(width, height, fmt); + using (Graphics gr = Graphics.FromImage(bmp)) + { + Color c = Color.FromArgb(255, 100, 200, 250); + for (int x = 1; x < 80; x++) + { + bmp.SetPixel(x, 1, c); + bmp.SetPixel(x, 2, c); + bmp.SetPixel(x, 78, c); + bmp.SetPixel(x, 79, c); + } + for (int y = 3; y < 78; y++) + { + bmp.SetPixel(1, y, c); + bmp.SetPixel(2, y, c); + bmp.SetPixel(78, y, c); + bmp.SetPixel(79, y, c); + } + } + return bmp; + } + + private byte[] HashPixels(Bitmap bmp) + { + int len = bmp.Width * bmp.Height * 4; + int index = 0; + byte[] pixels = new byte[len]; + + for (int y = 0; y < bmp.Height; y++) + { + for (int x = 0; x < bmp.Width; x++) + { + Color clr = bmp.GetPixel(x, y); + pixels[index++] = clr.R; + pixels[index++] = clr.G; + pixels[index++] = clr.B; + } + } + return MD5.Create().ComputeHash(pixels); + } + + private byte[] HashLock(Bitmap bmp, int width, int height, PixelFormat fmt, ImageLockMode mode) + { + int len = bmp.Width * bmp.Height * 4; + byte[] pixels = new byte[len]; + BitmapData bd = bmp.LockBits(new Rectangle(0, 0, width, height), mode, fmt); + try + { + int index = 0; + int bbps = Image.GetPixelFormatSize(fmt); + long pos = bd.Scan0.ToInt64(); + byte[] btv = new byte[1]; + for (int y = 0; y < bd.Height; y++) + { + for (int x = 0; x < bd.Width; x++) + { + + /* Read the pixels*/ + for (int bt = 0; bt < bbps / 8; bt++, index++) + { + long cur = pos; + cur += y * bd.Stride; + cur += x * bbps / 8; + cur += bt; + Marshal.Copy((IntPtr)cur, btv, 0, 1); + pixels[index] = btv[0]; + + /* Make change of all the colours = 250 to 10*/ + if (btv[0] == 250) + { + btv[0] = 10; + Marshal.Copy(btv, 0, (IntPtr)cur, 1); + } + } + } + } + + for (int i = index; i < len; i++) + pixels[index] = 0; + } + finally + { + bmp.UnlockBits(bd); + } + return MD5.Create().ComputeHash(pixels); + } + + // Tests the LockBitmap functions. Makes a hash of the block of pixels that it returns + // firsts, changes them, and then using GetPixel does another check of the changes. + // The results match the .Net framework + private static byte[] DefaultBitmapHash = new byte[] { 0xD8, 0xD3, 0x68, 0x9C, 0x86, 0x7F, 0xB6, 0xA0, 0x76, 0xD6, 0x00, 0xEF, 0xFF, 0xE5, 0x8E, 0x1B }; + private static byte[] FinalWholeBitmapHash = new byte[] { 0x5F, 0x52, 0x98, 0x37, 0xE3, 0x94, 0xE1, 0xA6, 0x06, 0x6C, 0x5B, 0xF1, 0xA9, 0xC2, 0xA9, 0x43 }; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBitmap_Format32bppArgb_Format32bppArgb_ReadWrite_Whole() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0x89, 0x6A, 0x6B, 0x35, 0x5C, 0x89, 0xD9, 0xE9, 0xF4, 0x51, 0xD5, 0x89, 0xED, 0x28, 0x68, 0x5C }; + byte[] actual = HashLock(bmp, bmp.Width, bmp.Height, PixelFormat.Format32bppArgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalWholeBitmapHash, HashPixels(bmp)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBitmap_Format32bppArgb_Format32bppPArgb_ReadWrite_Whole() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0x89, 0x6A, 0x6B, 0x35, 0x5C, 0x89, 0xD9, 0xE9, 0xF4, 0x51, 0xD5, 0x89, 0xED, 0x28, 0x68, 0x5C }; + byte[] actual = HashLock(bmp, bmp.Width, bmp.Height, PixelFormat.Format32bppPArgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalWholeBitmapHash, HashPixels(bmp)); + } + } + + [ActiveIssue(20884)] + public void LockBitmap_Format32bppArgb_Format32bppRgb_ReadWrite_Whole() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0xC0, 0x28, 0xB5, 0x2E, 0x86, 0x90, 0x6F, 0x37, 0x09, 0x5F, 0x49, 0xA4, 0x91, 0xDA, 0xEE, 0xB9 }; + byte[] actual = HashLock(bmp, bmp.Width, bmp.Height, PixelFormat.Format32bppRgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalWholeBitmapHash, HashPixels(bmp)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBitmap_Format32bppArgb_Format24bppRgb_ReadWrite_Whole() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0xA7, 0xB2, 0x50, 0x04, 0x11, 0x12, 0x64, 0x68, 0x6B, 0x7D, 0x2F, 0x6E, 0x69, 0x24, 0xCB, 0x14 }; + byte[] actual = HashLock(bmp, bmp.Width, bmp.Height, PixelFormat.Format24bppRgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalWholeBitmapHash, HashPixels(bmp)); + } + } + + private static byte[] FinalPartialBitmapHash = new byte[] { 0xED, 0xD8, 0xDC, 0x9B, 0x44, 0x00, 0x22, 0x9B, 0x07, 0x06, 0x4A, 0x21, 0x70, 0xA7, 0x31, 0x1D }; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBitmap_Format32bppArgb_Format32bppArgb_ReadWrite_Partial() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0x5D, 0xFF, 0x02, 0x34, 0xEB, 0x7C, 0xF7, 0x42, 0xD4, 0xB7, 0x70, 0x49, 0xB4, 0x06, 0x79, 0xBC }; + byte[] actual = HashLock(bmp, 50, 50, PixelFormat.Format32bppArgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalPartialBitmapHash, HashPixels(bmp)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBitmap_Format32bppArgb_Format32bppPArgb_ReadWrite_Partial() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0x5D, 0xFF, 0x02, 0x34, 0xEB, 0x7C, 0xF7, 0x42, 0xD4, 0xB7, 0x70, 0x49, 0xB4, 0x06, 0x79, 0xBC }; + byte[] actual = HashLock(bmp, 50, 50, PixelFormat.Format32bppPArgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalPartialBitmapHash, HashPixels(bmp)); + } + } + + [ActiveIssue(20884)] + public void LockBitmap_Format32bppArgb_Format32bppRgb_ReadWrite_Partial() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0x72, 0x33, 0x09, 0x67, 0x53, 0x65, 0x38, 0xF9, 0xE4, 0x58, 0xE1, 0x0A, 0xAA, 0x6A, 0xCC, 0xB8 }; + byte[] actual = HashLock(bmp, 50, 50, PixelFormat.Format32bppRgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalPartialBitmapHash, HashPixels(bmp)); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockBitmap_Format32bppArgb_Format24bppRgb_ReadWrite_Partial() + { + using (Bitmap bmp = CreateBitmap(100, 100, PixelFormat.Format32bppArgb)) + { + Assert.Equal(DefaultBitmapHash, HashPixels(bmp)); + byte[] expected = { 0x4D, 0x39, 0x21, 0x88, 0xC2, 0x17, 0x14, 0x5F, 0x89, 0x9E, 0x02, 0x75, 0xF3, 0x64, 0xD8, 0xF0 }; + byte[] actual = HashLock(bmp, 50, 50, PixelFormat.Format24bppRgb, ImageLockMode.ReadWrite); + Assert.Equal(expected, actual); + Assert.Equal(FinalPartialBitmapHash, HashPixels(bmp)); + } + } + + // Tests the LockBitmap and UnlockBitmap functions, specifically the copying + // of bitmap data in the directions indicated by the ImageLockMode. + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void LockUnlockBitmap() + { + BitmapData data; + int pixel_value; + Color pixel_colour; + + Color red = Color.FromArgb(Color.Red.A, Color.Red.R, Color.Red.G, Color.Red.B); + Color blue = Color.FromArgb(Color.Blue.A, Color.Blue.R, Color.Blue.G, Color.Blue.B); + + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppRgb)) + { + bmp.SetPixel(0, 0, red); + pixel_colour = bmp.GetPixel(0, 0); + Assert.Equal(red, pixel_colour); + + data = bmp.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + try + { + pixel_value = Marshal.ReadByte(data.Scan0, 0); + pixel_value |= Marshal.ReadByte(data.Scan0, 1) << 8; + pixel_value |= Marshal.ReadByte(data.Scan0, 2) << 16; + pixel_value |= Marshal.ReadByte(data.Scan0, 3) << 24; + + pixel_colour = Color.FromArgb(pixel_value); + // Disregard alpha information in the test + pixel_colour = Color.FromArgb(red.A, pixel_colour.R, pixel_colour.G, pixel_colour.B); + Assert.Equal(red, pixel_colour); + + // write blue but we're locked in read-only... + Marshal.WriteByte(data.Scan0, 0, blue.B); + Marshal.WriteByte(data.Scan0, 1, blue.G); + Marshal.WriteByte(data.Scan0, 2, blue.R); + Marshal.WriteByte(data.Scan0, 3, blue.A); + } + finally + { + bmp.UnlockBits(data); + pixel_colour = bmp.GetPixel(0, 0); + // Disregard alpha information in the test + pixel_colour = Color.FromArgb(red.A, pixel_colour.R, pixel_colour.G, pixel_colour.B); + // ...so we still read red after unlocking + Assert.Equal(red, pixel_colour); + } + + data = bmp.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + try + { + // write blue + Marshal.WriteByte(data.Scan0, 0, blue.B); + Marshal.WriteByte(data.Scan0, 1, blue.G); + Marshal.WriteByte(data.Scan0, 2, blue.R); + Marshal.WriteByte(data.Scan0, 3, blue.A); + } + finally + { + bmp.UnlockBits(data); + pixel_colour = bmp.GetPixel(0, 0); + // Disregard alpha information in the test + pixel_colour = Color.FromArgb(blue.A, pixel_colour.R, pixel_colour.G, pixel_colour.B); + // read blue + Assert.Equal(blue, pixel_colour); + } + } + + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format32bppArgb)) + { + bmp.SetPixel(0, 0, red); + + data = bmp.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); + try + { + byte b = Marshal.ReadByte(data.Scan0, 0); + byte g = Marshal.ReadByte(data.Scan0, 1); + byte r = Marshal.ReadByte(data.Scan0, 2); + pixel_colour = Color.FromArgb(red.A, r, g, b); + Assert.Equal(red, pixel_colour); + // write blue but we're locked in read-only... + Marshal.WriteByte(data.Scan0, 0, blue.B); + Marshal.WriteByte(data.Scan0, 1, blue.G); + Marshal.WriteByte(data.Scan0, 2, blue.R); + } + finally + { + bmp.UnlockBits(data); + // ...so we still read red after unlocking + Assert.Equal(red, bmp.GetPixel(0, 0)); + } + + data = bmp.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); + try + { + // write blue + Marshal.WriteByte(data.Scan0, 0, blue.B); + Marshal.WriteByte(data.Scan0, 1, blue.G); + Marshal.WriteByte(data.Scan0, 2, blue.R); + } + finally + { + bmp.UnlockBits(data); + // read blue + Assert.Equal(blue, bmp.GetPixel(0, 0)); + } + } + } + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DefaultFormat1() + { + using (Bitmap bmp = new Bitmap(20, 20)) + { + Assert.Equal(ImageFormat.MemoryBmp, bmp.RawFormat); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void DefaultFormat2() + { + string filename = Path.GetTempFileName(); + using (Bitmap bmp = new Bitmap(20, 20)) + { + bmp.Save(filename); + } + + using (Bitmap other = new Bitmap(filename)) + { + Assert.Equal(ImageFormat.Png, other.RawFormat); + } + File.Delete(filename); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BmpDataStride1() + { + Bitmap bmp = new Bitmap(184, 184, PixelFormat.Format1bppIndexed); + BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format1bppIndexed); + try + { + Assert.Equal(24, data.Stride); + } + finally + { + bmp.UnlockBits(data); + bmp.Dispose(); + } + } + + private Stream Serialize(object o) + { + MemoryStream ms = new MemoryStream(); + IFormatter formatter = new BinaryFormatter(); + formatter.Serialize(ms, o); + ms.Position = 0; + return ms; + } + + private object Deserialize(Stream s) + { + return new BinaryFormatter().Deserialize(s); + } + + [ActiveIssue(20844)] + public void Serialize_Icon() + { + // this cause a problem with resgen, see http://bugzilla.ximian.com/show_bug.cgi?id=80565 + string filename = Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"); + using (Bitmap icon = new Bitmap(filename)) + { + using (Stream s = Serialize(icon)) + { + using (Bitmap copy = (Bitmap)Deserialize(s)) + { + Assert.Equal(icon.Height, copy.Height); + Assert.Equal(icon.Width, copy.Width); + Assert.Equal(icon.PixelFormat, copy.PixelFormat); + Assert.Equal(icon.RawFormat, ImageFormat.Icon); + Assert.Equal(copy.RawFormat, ImageFormat.Png); + } + } + } + } + + static int[] palette1 = { + -16777216, + -1, + }; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format1bppIndexed_Palette() + { + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format1bppIndexed)) + { + ColorPalette pal = bmp.Palette; + Assert.Equal(2, pal.Entries.Length); + for (int i = 0; i < pal.Entries.Length; i++) + { + Assert.Equal(palette1[i], pal.Entries[i].ToArgb()); + } + Assert.Equal(2, pal.Flags); + } + } + + static int[] palette16 = { + -16777216, + -8388608, + -16744448, + -8355840, + -16777088, + -8388480, + -16744320, + -8355712, + -4144960, + -65536, + -16711936, + -256, + -16776961, + -65281, + -16711681, + -1, + }; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format4bppIndexed_Palette() + { + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format4bppIndexed)) + { + ColorPalette pal = bmp.Palette; + Assert.Equal(16, pal.Entries.Length); + for (int i = 0; i < pal.Entries.Length; i++) + { + Assert.Equal(palette16[i], pal.Entries[i].ToArgb()); + } + Assert.Equal(0, pal.Flags); + } + } + + static int[] palette256 = { + -16777216, + -8388608, + -16744448, + -8355840, + -16777088, + -8388480, + -16744320, + -8355712, + -4144960, + -65536, + -16711936, + -256, + -16776961, + -65281, + -16711681, + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + -16777216, + -16777165, + -16777114, + -16777063, + -16777012, + -16776961, + -16764160, + -16764109, + -16764058, + -16764007, + -16763956, + -16763905, + -16751104, + -16751053, + -16751002, + -16750951, + -16750900, + -16750849, + -16738048, + -16737997, + -16737946, + -16737895, + -16737844, + -16737793, + -16724992, + -16724941, + -16724890, + -16724839, + -16724788, + -16724737, + -16711936, + -16711885, + -16711834, + -16711783, + -16711732, + -16711681, + -13434880, + -13434829, + -13434778, + -13434727, + -13434676, + -13434625, + -13421824, + -13421773, + -13421722, + -13421671, + -13421620, + -13421569, + -13408768, + -13408717, + -13408666, + -13408615, + -13408564, + -13408513, + -13395712, + -13395661, + -13395610, + -13395559, + -13395508, + -13395457, + -13382656, + -13382605, + -13382554, + -13382503, + -13382452, + -13382401, + -13369600, + -13369549, + -13369498, + -13369447, + -13369396, + -13369345, + -10092544, + -10092493, + -10092442, + -10092391, + -10092340, + -10092289, + -10079488, + -10079437, + -10079386, + -10079335, + -10079284, + -10079233, + -10066432, + -10066381, + -10066330, + -10066279, + -10066228, + -10066177, + -10053376, + -10053325, + -10053274, + -10053223, + -10053172, + -10053121, + -10040320, + -10040269, + -10040218, + -10040167, + -10040116, + -10040065, + -10027264, + -10027213, + -10027162, + -10027111, + -10027060, + -10027009, + -6750208, + -6750157, + -6750106, + -6750055, + -6750004, + -6749953, + -6737152, + -6737101, + -6737050, + -6736999, + -6736948, + -6736897, + -6724096, + -6724045, + -6723994, + -6723943, + -6723892, + -6723841, + -6711040, + -6710989, + -6710938, + -6710887, + -6710836, + -6710785, + -6697984, + -6697933, + -6697882, + -6697831, + -6697780, + -6697729, + -6684928, + -6684877, + -6684826, + -6684775, + -6684724, + -6684673, + -3407872, + -3407821, + -3407770, + -3407719, + -3407668, + -3407617, + -3394816, + -3394765, + -3394714, + -3394663, + -3394612, + -3394561, + -3381760, + -3381709, + -3381658, + -3381607, + -3381556, + -3381505, + -3368704, + -3368653, + -3368602, + -3368551, + -3368500, + -3368449, + -3355648, + -3355597, + -3355546, + -3355495, + -3355444, + -3355393, + -3342592, + -3342541, + -3342490, + -3342439, + -3342388, + -3342337, + -65536, + -65485, + -65434, + -65383, + -65332, + -65281, + -52480, + -52429, + -52378, + -52327, + -52276, + -52225, + -39424, + -39373, + -39322, + -39271, + -39220, + -39169, + -26368, + -26317, + -26266, + -26215, + -26164, + -26113, + -13312, + -13261, + -13210, + -13159, + -13108, + -13057, + -256, + -205, + -154, + -103, + -52, + -1, + }; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Format8bppIndexed_Palette() + { + using (Bitmap bmp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed)) + { + ColorPalette pal = bmp.Palette; + Assert.Equal(256, pal.Entries.Length); + for (int i = 0; i < pal.Entries.Length; i++) + { + Assert.Equal(palette256[i], pal.Entries[i].ToArgb()); + } + Assert.Equal(4, pal.Flags); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void XmlSerialization() + { + new XmlSerializer(typeof(Bitmap)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapImageCtor() + { + Assert.Throws(() => new Bitmap((Image)null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapImageSizeCtor() + { + Assert.Throws(() => new Bitmap((Image)null, Size.Empty)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapImageIntIntCtor() + { + Assert.Throws(() => new Bitmap((Image)null, Int32.MinValue, Int32.MaxValue)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapIntIntCtor() + { + Assert.Throws(() => new Bitmap(Int32.MinValue, Int32.MaxValue)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapIntIntGraphicCtor() + { + Assert.Throws(() => new Bitmap(1, 1, null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapIntIntPixelFormatCtor() + { + Assert.Throws(() => new Bitmap(Int32.MinValue, Int32.MaxValue, PixelFormat.Format1bppIndexed)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapStreamCtor() + { + AssertExtensions.Throws("stream", null, () => new Bitmap((Stream)null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapStreamBoolCtor() + { + AssertExtensions.Throws("stream", null, () => new Bitmap((Stream)null, true)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapStringCtor() + { + Assert.Throws(() => new Bitmap((string)null)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapStringBoolCtor() + { + Assert.Throws(() => new Bitmap((string)null, false)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapTypeStringCtor1() + { + Assert.Throws(() => new Bitmap((Type)null, "mono")); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapTypeStringCtor2() + { + Assert.Throws(() => new Bitmap(typeof(Bitmap), null)); + } + + private void SetResolution(float x, float y) + { + using (Bitmap bmp = new Bitmap(1, 1)) + { + bmp.SetResolution(x, y); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_Zero() + { + Assert.Throws(() => SetResolution(0.0f, 0.0f)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_Negative_X() + { + Assert.Throws(() => SetResolution(-1.0f, 1.0f)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_Negative_Y() + { + Assert.Throws(() => SetResolution(1.0f, -1.0f)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_MaxValue() + { + SetResolution(Single.MaxValue, Single.MaxValue); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_PositiveInfinity() + { + SetResolution(Single.PositiveInfinity, Single.PositiveInfinity); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_NaN() + { + Assert.Throws(() => SetResolution(Single.NaN, Single.NaN)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void SetResolution_NegativeInfinity() + { + Assert.Throws(() => SetResolution(Single.NegativeInfinity, Single.NegativeInfinity)); + } + } + + public class BitmapFullTrustTest + { + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void BitmapIntIntIntPixelFormatIntPtrCtor() + { + new Bitmap(1, 1, 1, PixelFormat.Format1bppIndexed, IntPtr.Zero); + } + + // BitmapFromHicon## is *almost* the same as IconTest.Icon##ToBitmap except + // for the Flags property + + private void HiconTest(string msg, Bitmap b, int size) + { + Assert.Equal(PixelFormat.Format32bppArgb, b.PixelFormat); + // unlike the GDI+ icon decoder the palette isn't kept + Assert.Equal(0, b.Palette.Entries.Length); + Assert.Equal(size, b.Height); + Assert.Equal(size, b.Width); + Assert.Equal(b.RawFormat, ImageFormat.MemoryBmp); + Assert.Equal(335888, b.Flags); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Hicon16() + { + IntPtr hicon; + int size; + using (Icon icon = new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) + { + size = icon.Width; + using (Bitmap bitmap = Bitmap.FromHicon(icon.Handle)) + { + HiconTest("Icon.Handle/FromHicon", bitmap, size); + hicon = bitmap.GetHicon(); + } + } + using (Bitmap bitmap2 = Bitmap.FromHicon(hicon)) + { + // hicon survives bitmap and icon disposal + HiconTest("GetHicon/FromHicon", bitmap2, size); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Hicon32() + { + IntPtr hicon; + int size; + using (Icon icon = new Icon(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico"))) + { + size = icon.Width; + using (Bitmap bitmap = Bitmap.FromHicon(icon.Handle)) + { + HiconTest("Icon.Handle/FromHicon", bitmap, size); + hicon = bitmap.GetHicon(); + } + } + using (Bitmap bitmap2 = Bitmap.FromHicon(hicon)) + { + // hicon survives bitmap and icon disposal + HiconTest("GetHicon/FromHicon", bitmap2, size); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Hicon64() + { + IntPtr hicon; + int size; + using (Icon icon = new Icon(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico"))) + { + size = icon.Width; + using (Bitmap bitmap = Bitmap.FromHicon(icon.Handle)) + { + HiconTest("Icon.Handle/FromHicon", bitmap, size); + hicon = bitmap.GetHicon(); + } + } + using (Bitmap bitmap2 = Bitmap.FromHicon(hicon)) + { + // hicon survives bitmap and icon disposal + HiconTest("GetHicon/FromHicon", bitmap2, size); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Hicon96() + { + IntPtr hicon; + int size; + using (Icon icon = new Icon(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico"))) + { + size = icon.Width; + using (Bitmap bitmap = Bitmap.FromHicon(icon.Handle)) + { + HiconTest("Icon.Handle/FromHicon", bitmap, size); + hicon = bitmap.GetHicon(); + } + } + using (Bitmap bitmap2 = Bitmap.FromHicon(hicon)) + { + // hicon survives bitmap and icon disposal + HiconTest("GetHicon/FromHicon", bitmap2, size); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void HBitmap() + { + IntPtr hbitmap; + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bitmap = new Bitmap(sInFile)) + { + Assert.Equal(PixelFormat.Format24bppRgb, bitmap.PixelFormat); + Assert.Equal(0, bitmap.Palette.Entries.Length); + Assert.Equal(183, bitmap.Height); + Assert.Equal(173, bitmap.Width); + Assert.Equal(73744, bitmap.Flags); + Assert.Equal(bitmap.RawFormat, ImageFormat.Bmp); + hbitmap = bitmap.GetHbitmap(); + } + + // hbitmap survives original bitmap disposal + using (Image image = Image.FromHbitmap(hbitmap)) + { + //Assert.Equal (PixelFormat.Format32bppRgb, image.PixelFormat); + Assert.Equal(0, image.Palette.Entries.Length); + Assert.Equal(183, image.Height); + Assert.Equal(173, image.Width); + Assert.Equal(335888, image.Flags); + Assert.Equal(image.RawFormat, ImageFormat.MemoryBmp); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void CreateMultipleBitmapFromSameHBITMAP() + { + IntPtr hbitmap; + string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp"); + using (Bitmap bitmap = new Bitmap(sInFile)) + { + Assert.Equal(PixelFormat.Format24bppRgb, bitmap.PixelFormat); + Assert.Equal(0, bitmap.Palette.Entries.Length); + Assert.Equal(183, bitmap.Height); + Assert.Equal(173, bitmap.Width); + Assert.Equal(73744, bitmap.Flags); + Assert.Equal(bitmap.RawFormat, ImageFormat.Bmp); + hbitmap = bitmap.GetHbitmap(); + } + // hbitmap survives original bitmap disposal + using (Image image = Image.FromHbitmap(hbitmap)) + { + //Assert.Equal (PixelFormat.Format32bppRgb, image.PixelFormat); + Assert.Equal(0, image.Palette.Entries.Length); + Assert.Equal(183, image.Height); + Assert.Equal(173, image.Width); + Assert.Equal(335888, image.Flags); + Assert.Equal(image.RawFormat, ImageFormat.MemoryBmp); + } + using (Image image2 = Image.FromHbitmap(hbitmap)) + { + //Assert.Equal (PixelFormat.Format32bppRgb, image2.PixelFormat); + Assert.Equal(0, image2.Palette.Entries.Length); + Assert.Equal(183, image2.Height); + Assert.Equal(173, image2.Width); + Assert.Equal(335888, image2.Flags); + Assert.Equal(image2.RawFormat, ImageFormat.MemoryBmp); + } + } + } +} + diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs.REMOVED.git-id b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs.REMOVED.git-id new file mode 100644 index 0000000000..0bdb783c77 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs.REMOVED.git-id @@ -0,0 +1 @@ +a87fb83b6b538180f1ce3085e60e2841c430dc73 \ No newline at end of file diff --git a/external/corefx/src/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs b/external/corefx/src/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs new file mode 100644 index 0000000000..f58f13d1d7 --- /dev/null +++ b/external/corefx/src/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs @@ -0,0 +1,485 @@ +// Licensed to the .NET Foundation under one or more agreements. +// See the LICENSE file in the project root for more information. +// +// Metafile class unit tests +// +// Authors: +// Sebastien Pouliot +// +// 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.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.IO; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using Xunit; + +namespace MonoTests.System.Drawing.Imaging +{ + + public class MetafileTest + { + + public const string Bitmap = "non-inverted.bmp"; + public const string WmfPlaceable = "telescope_01.wmf"; + public const string Emf = "milkmateya01.emf"; + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Metafile_String() + { + string filename = Helpers.GetTestBitmapPath(WmfPlaceable); + using (Metafile mf = new Metafile(filename)) + using (Metafile clone = (Metafile)mf.Clone()) + { + } + } + + static public void Check_MetaHeader_WmfPlaceable(MetaHeader mh) + { + Assert.Equal(9, mh.HeaderSize); + Assert.Equal(98, mh.MaxRecord); + Assert.Equal(3, mh.NoObjects); + Assert.Equal(0, mh.NoParameters); + Assert.Equal(1737, mh.Size); + Assert.Equal(1, mh.Type); + Assert.Equal(0x300, mh.Version); + } + + public static void Check_MetafileHeader_WmfPlaceable(MetafileHeader header) + { + Assert.Equal(MetafileType.WmfPlaceable, header.Type); + Assert.Equal(0x300, header.Version); + // filesize - 22, which happens to be the size (22) of a PLACEABLEMETAHEADER struct + Assert.Equal(3474, header.MetafileSize); + + Assert.Equal(-30, header.Bounds.X); + Assert.Equal(-40, header.Bounds.Y); + Assert.Equal(3096, header.Bounds.Width); + Assert.Equal(4127, header.Bounds.Height); + Assert.Equal(606, header.DpiX); + Assert.Equal(606, header.DpiY); + Assert.Equal(0, header.EmfPlusHeaderSize); + Assert.Equal(0, header.LogicalDpiX); + Assert.Equal(0, header.LogicalDpiY); + + Assert.NotNull(header.WmfHeader); + Check_MetaHeader_WmfPlaceable(header.WmfHeader); + + Assert.False(header.IsDisplay()); + Assert.False(header.IsEmf()); + Assert.False(header.IsEmfOrEmfPlus()); + Assert.False(header.IsEmfPlus()); + Assert.False(header.IsEmfPlusDual()); + Assert.False(header.IsEmfPlusOnly()); + Assert.True(header.IsWmf()); + Assert.True(header.IsWmfPlaceable()); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_FromFile_WmfPlaceable() + { + using (Metafile mf = new Metafile(Helpers.GetTestBitmapPath(WmfPlaceable))) + { + MetafileHeader header1 = mf.GetMetafileHeader(); + Check_MetafileHeader_WmfPlaceable(header1); + + MetaHeader mh1 = header1.WmfHeader; + Check_MetaHeader_WmfPlaceable(mh1); + + MetaHeader mh2 = mf.GetMetafileHeader().WmfHeader; + Assert.NotSame(mh1, mh2); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_FromFileStream_WmfPlaceable() + { + using (FileStream fs = File.OpenRead(Helpers.GetTestBitmapPath(WmfPlaceable))) + using (Metafile mf = new Metafile(fs)) + { + MetafileHeader header1 = mf.GetMetafileHeader(); + Check_MetafileHeader_WmfPlaceable(header1); + + MetaHeader mh1 = header1.WmfHeader; + Check_MetaHeader_WmfPlaceable(mh1); + + MetaHeader mh2 = mf.GetMetafileHeader().WmfHeader; + Assert.NotSame(mh1, mh2); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_FromMemoryStream_WmfPlaceable() + { + string filename = Helpers.GetTestBitmapPath(WmfPlaceable); + using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(filename))) + using (Metafile mf = new Metafile(ms)) + { + MetafileHeader header1 = mf.GetMetafileHeader(); + Check_MetafileHeader_WmfPlaceable(header1); + + MetaHeader mh1 = header1.WmfHeader; + Check_MetaHeader_WmfPlaceable(mh1); + + MetaHeader mh2 = mf.GetMetafileHeader().WmfHeader; + Assert.NotSame(mh1, mh2); + } + } + + public static void Check_MetafileHeader_Emf(MetafileHeader header) + { + Assert.Equal(MetafileType.Emf, header.Type); + Assert.Equal(65536, header.Version); + // extactly the filesize + Assert.Equal(20456, header.MetafileSize); + + Assert.Equal(0, header.Bounds.X); + Assert.Equal(0, header.Bounds.Y); + + Assert.Throws(() => header.WmfHeader); + + Assert.False(header.IsDisplay()); + Assert.True(header.IsEmf()); + Assert.True(header.IsEmfOrEmfPlus()); + Assert.False(header.IsEmfPlus()); + Assert.False(header.IsEmfPlusDual()); + Assert.False(header.IsEmfPlusOnly()); + Assert.False(header.IsWmf()); + Assert.False(header.IsWmfPlaceable()); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_FromFile_Emf() + { + using (Metafile mf = new Metafile(Helpers.GetTestBitmapPath(Emf))) + { + MetafileHeader header1 = mf.GetMetafileHeader(); + Check_MetafileHeader_Emf(header1); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_FromFileStream_Emf() + { + using (FileStream fs = File.OpenRead(Helpers.GetTestBitmapPath(Emf))) + using (Metafile mf = new Metafile(fs)) + { + MetafileHeader header1 = mf.GetMetafileHeader(); + Check_MetafileHeader_Emf(header1); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void GetMetafileHeader_FromMemoryStream_Emf() + { + string filename = Helpers.GetTestBitmapPath(Emf); + using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(filename))) + using (Metafile mf = new Metafile(ms)) + { + MetafileHeader header1 = mf.GetMetafileHeader(); + Check_MetafileHeader_Emf(header1); + } + } + } + + public class MetafileFulltrustTest + { + private void CheckEmptyHeader(Metafile mf, EmfType type) + { + MetafileHeader mh = mf.GetMetafileHeader(); + Assert.Equal(0, mh.Bounds.X); + Assert.Equal(0, mh.Bounds.Y); + Assert.Equal(0, mh.Bounds.Width); + Assert.Equal(0, mh.Bounds.Height); + Assert.Equal(0, mh.MetafileSize); + switch (type) + { + case EmfType.EmfOnly: + Assert.Equal(MetafileType.Emf, mh.Type); + break; + case EmfType.EmfPlusDual: + Assert.Equal(MetafileType.EmfPlusDual, mh.Type); + break; + case EmfType.EmfPlusOnly: + Assert.Equal(MetafileType.EmfPlusOnly, mh.Type); + break; + default: + Assert.True(false, string.Format("Unknown EmfType '{0}'", type)); + break; + } + } + + private void Metafile_IntPtrEmfType(EmfType type) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + { + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + Metafile mf = new Metafile(hdc, type); + CheckEmptyHeader(mf, type); + } + finally + { + g.ReleaseHdc(hdc); + } + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Metafile_IntPtrRectangle_Empty() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + Metafile mf = new Metafile(hdc, new Rectangle()); + CheckEmptyHeader(mf, EmfType.EmfPlusDual); + } + finally + { + g.ReleaseHdc(hdc); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Metafile_IntPtrRectangleF_Empty() + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + Metafile mf = new Metafile(hdc, new RectangleF()); + CheckEmptyHeader(mf, EmfType.EmfPlusDual); + } + finally + { + g.ReleaseHdc(hdc); + } + } + } + + private void Metafile_StreamEmfType(Stream stream, EmfType type) + { + using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + Metafile mf = new Metafile(stream, hdc, type); + CheckEmptyHeader(mf, type); + } + finally + { + g.ReleaseHdc(hdc); + } + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Metafile_StreamIntPtrEmfType_Null() + { + Assert.Throws(() => Metafile_StreamEmfType(null, EmfType.EmfOnly)); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Metafile_StreamIntPtrEmfType_EmfOnly() + { + using (MemoryStream ms = new MemoryStream()) + { + Metafile_StreamEmfType(ms, EmfType.EmfOnly); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Metafile_StreamIntPtrEmfType_Invalid() + { + using (MemoryStream ms = new MemoryStream()) + { + Assert.Throws(() => Metafile_StreamEmfType(ms, (EmfType)Int32.MinValue)); + } + } + + private void CreateFilename(EmfType type, bool single) + { + string name = string.Format("{0}-{1}.emf", type, single ? "Single" : "Multiple"); + string filename = Path.Combine(Path.GetTempPath(), name); + Metafile mf; + using (Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb)) + { + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + mf = new Metafile(filename, hdc, type); + Assert.Equal(0, new FileInfo(filename).Length); + } + finally + { + g.ReleaseHdc(hdc); + } + } + long size = 0; + using (Graphics g = Graphics.FromImage(mf)) + { + g.FillRectangle(Brushes.BlueViolet, 10, 10, 80, 80); + size = new FileInfo(filename).Length; + Assert.Equal(0, size); + } + + if (!single) + { + using (Graphics g = Graphics.FromImage(mf)) + { + g.DrawRectangle(Pens.Azure, 10, 10, 80, 80); + } + } + mf.Dispose(); + Assert.Equal(size, new FileInfo(filename).Length); + } + } + + [ActiveIssue(20844)] + public void CreateFilename_SingleGraphics_EmfOnly() + { + CreateFilename(EmfType.EmfOnly, true); + } + + [ActiveIssue(20844)] + public void CreateFilename_SingleGraphics_EmfPlusDual() + { + CreateFilename(EmfType.EmfPlusDual, true); + } + + [ActiveIssue(20844)] + public void CreateFilename_SingleGraphics_EmfPlusOnly() + { + CreateFilename(EmfType.EmfPlusOnly, true); + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void Measure() + { + Font test_font = new Font(FontFamily.GenericMonospace, 12); + + Metafile mf; + using (Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb)) + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + mf = new Metafile(hdc, EmfType.EmfPlusOnly); + } + finally + { + g.ReleaseHdc(hdc); + } + } + using (Graphics g = Graphics.FromImage(mf)) + { + string text = "this\nis a test"; + CharacterRange[] ranges = new CharacterRange[2]; + ranges[0] = new CharacterRange(0, 5); + ranges[1] = new CharacterRange(5, 9); + + SizeF size = g.MeasureString(text, test_font); + Assert.False(size.IsEmpty); + + StringFormat sf = new StringFormat(); + sf.FormatFlags = StringFormatFlags.NoClip; + sf.SetMeasurableCharacterRanges(ranges); + + RectangleF rect = new RectangleF(0, 0, size.Width, size.Height); + Region[] region = g.MeasureCharacterRanges(text, test_font, rect, sf); + Assert.Equal(2, region.Length); + mf.Dispose(); + } + } + + [ConditionalFact(Helpers.GdiplusIsAvailable)] + public void WorldTransforms() + { + Metafile mf; + using (Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb)) + { + using (Graphics g = Graphics.FromImage(bmp)) + { + IntPtr hdc = g.GetHdc(); + try + { + mf = new Metafile(hdc, EmfType.EmfPlusOnly); + } + finally + { + g.ReleaseHdc(hdc); + } + } + using (Graphics g = Graphics.FromImage(mf)) + { + Assert.True(g.Transform.IsIdentity); + g.ScaleTransform(2f, 0.5f); + Assert.False(g.Transform.IsIdentity); + g.RotateTransform(90); + g.TranslateTransform(-2, 2); + Matrix m = g.Transform; + g.MultiplyTransform(m); + // check + float[] elements = g.Transform.Elements; + Assert.Equal(-1f, elements[0], 5); + Assert.Equal(0f, elements[1], 5); + Assert.Equal(0f, elements[2], 5); + Assert.Equal(-1f, elements[3], 5); + Assert.Equal(-2f, elements[4], 5); + Assert.Equal(-3f, elements[5], 5); + + g.Transform = m; + elements = g.Transform.Elements; + Assert.Equal(0f, elements[0], 5); + Assert.Equal(0.5f, elements[1], 5); + Assert.Equal(-2f, elements[2], 5); + Assert.Equal(0f, elements[3], 5); + Assert.Equal(-4f, elements[4], 5); + Assert.Equal(-1f, elements[5], 5); + + g.ResetTransform(); + Assert.True(g.Transform.IsIdentity); + } + mf.Dispose(); + } + } + } +} diff --git a/external/corefx/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj b/external/corefx/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj index 2b49c5a61a..75f440ee09 100644 --- a/external/corefx/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj +++ b/external/corefx/src/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj @@ -38,13 +38,18 @@ System\Drawing\ColorTable.cs + + System\Drawing\ColorUtil.netcoreapp21.cs + + + System\Drawing\KnownColor.cs + System\Drawing\KnownColorTable.cs Common\System\Numerics\Hashing\HashHelpers.cs - diff --git a/external/corefx/src/System.Drawing.Primitives/src/System/Drawing/Color.cs b/external/corefx/src/System.Drawing.Primitives/src/System/Drawing/Color.cs index e5fd831d7f..a57c7d2c6b 100644 --- a/external/corefx/src/System.Drawing.Primitives/src/System/Drawing/Color.cs +++ b/external/corefx/src/System.Drawing.Primitives/src/System/Drawing/Color.cs @@ -454,16 +454,8 @@ namespace System.Drawing public static Color FromArgb(int red, int green, int blue) => FromArgb(255, red, green, blue); - public static Color FromKnownColor(KnownColor color) - { - var value = (int)color; - if (value < (int)KnownColor.FirstColor || value > (int)KnownColor.LastColor) - { - return FromName(color.ToString()); - } - - return new Color(color); - } + public static Color FromKnownColor(KnownColor color) => + color <= 0 || color > KnownColor.MenuHighlight ? FromName(color.ToString()) : new Color(color); public static Color FromName(string name) { @@ -487,11 +479,23 @@ namespace System.Drawing max = r; min = r; - if (g > max) max = g; - if (b > max) max = b; + if (g > max) + { + max = g; + } + else if (g < min) + { + min = g; + } - if (g < min) min = g; - if (b < min) min = b; + if (b > max) + { + max = b; + } + else if (b < min) + { + min = b; + } return (max + min) / 2; } @@ -508,15 +512,27 @@ namespace System.Drawing float max, min; float delta; - float hue = 0.0f; + float hue; max = r; min = r; - if (g > max) max = g; - if (b > max) max = b; + if (g > max) + { + max = g; + } + else if (g < min) + { + min = g; + } - if (g < min) min = g; - if (b < min) min = b; + if (b > max) + { + max = b; + } + else if (b < min) + { + min = b; + } delta = max - min; @@ -528,8 +544,9 @@ namespace System.Drawing { hue = 2 + (b - r) / delta; } - else if (b == max) + else { + Debug.Assert(b == max); hue = 4 + (r - g) / delta; } hue *= 60; @@ -552,11 +569,23 @@ namespace System.Drawing float max = r; float min = r; - if (g > max) max = g; - if (b > max) max = b; + if (g > max) + { + max = g; + } + else if (g < min) + { + min = g; + } - if (g < min) min = g; - if (b < min) min = b; + if (b > max) + { + max = b; + } + else if (b < min) + { + min = b; + } // if max == min, then there is no color and // the saturation is zero. diff --git a/external/corefx/src/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs b/external/corefx/src/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs new file mode 100644 index 0000000000..513fd4aaea --- /dev/null +++ b/external/corefx/src/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs @@ -0,0 +1,172 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Xunit; + +namespace System.Drawing.Primitives.Tests +{ + public partial class ColorTests + { + public static readonly IEnumerable AllKnownColors = Enum.GetValues(typeof(KnownColor)).Cast() + .Where(kc => kc != 0) + .Select(kc => new object[] { kc }) + .ToArray(); + + public static readonly IEnumerable SystemColors = + new[] + { + KnownColor.ActiveBorder, KnownColor.ActiveCaption, KnownColor.ActiveCaptionText, + KnownColor.AppWorkspace, KnownColor.Control, KnownColor.ControlDark, KnownColor.ControlDarkDark, + KnownColor.ControlLight, KnownColor.ControlLightLight, KnownColor.ControlText, KnownColor.Desktop, + KnownColor.GrayText, KnownColor.Highlight, KnownColor.HighlightText, KnownColor.HotTrack, + KnownColor.InactiveBorder, KnownColor.InactiveCaption, KnownColor.InactiveCaptionText, KnownColor.Info, + KnownColor.InfoText, KnownColor.Menu, KnownColor.MenuText, KnownColor.ScrollBar, KnownColor.Window, + KnownColor.WindowFrame, KnownColor.WindowText, KnownColor.ButtonFace, KnownColor.ButtonHighlight, + KnownColor.ButtonShadow, KnownColor.GradientActiveCaption, KnownColor.GradientInactiveCaption, + KnownColor.MenuBar, KnownColor.MenuHighlight + }.Select(kc => new object[] { kc }).ToArray(); + + public static readonly IEnumerable NonSystemColors = + new[] + { + KnownColor.Transparent, KnownColor.AliceBlue, KnownColor.AntiqueWhite, KnownColor.Aqua, + KnownColor.Aquamarine, KnownColor.Azure, KnownColor.Beige, KnownColor.Bisque, KnownColor.Black, + KnownColor.BlanchedAlmond, KnownColor.Blue, KnownColor.BlueViolet, KnownColor.Brown, + KnownColor.BurlyWood, KnownColor.CadetBlue, KnownColor.Chartreuse, KnownColor.Chocolate, + KnownColor.Coral, KnownColor.CornflowerBlue, KnownColor.Cornsilk, KnownColor.Crimson, KnownColor.Cyan, + KnownColor.DarkBlue, KnownColor.DarkCyan, KnownColor.DarkGoldenrod, KnownColor.DarkGray, + KnownColor.DarkGreen, KnownColor.DarkKhaki, KnownColor.DarkMagenta, KnownColor.DarkOliveGreen, + KnownColor.DarkOrange, KnownColor.DarkOrchid, KnownColor.DarkRed, KnownColor.DarkSalmon, + KnownColor.DarkSeaGreen, KnownColor.DarkSlateBlue, KnownColor.DarkSlateGray, KnownColor.DarkTurquoise, + KnownColor.DarkViolet, KnownColor.DeepPink, KnownColor.DeepSkyBlue, KnownColor.DimGray, + KnownColor.DodgerBlue, KnownColor.Firebrick, KnownColor.FloralWhite, KnownColor.ForestGreen, + KnownColor.Fuchsia, KnownColor.Gainsboro, KnownColor.GhostWhite, KnownColor.Gold, KnownColor.Goldenrod, + KnownColor.Gray, KnownColor.Green, KnownColor.GreenYellow, KnownColor.Honeydew, KnownColor.HotPink, + KnownColor.IndianRed, KnownColor.Indigo, KnownColor.Ivory, KnownColor.Khaki, KnownColor.Lavender, + KnownColor.LavenderBlush, KnownColor.LawnGreen, KnownColor.LemonChiffon, KnownColor.LightBlue, + KnownColor.LightCoral, KnownColor.LightCyan, KnownColor.LightGoldenrodYellow, KnownColor.LightGray, + KnownColor.LightGreen, KnownColor.LightPink, KnownColor.LightSalmon, KnownColor.LightSeaGreen, + KnownColor.LightSkyBlue, KnownColor.LightSlateGray, KnownColor.LightSteelBlue, KnownColor.LightYellow, + KnownColor.Lime, KnownColor.LimeGreen, KnownColor.Linen, KnownColor.Magenta, KnownColor.Maroon, + KnownColor.MediumAquamarine, KnownColor.MediumBlue, KnownColor.MediumOrchid, KnownColor.MediumPurple, + KnownColor.MediumSeaGreen, KnownColor.MediumSlateBlue, KnownColor.MediumSpringGreen, + KnownColor.MediumTurquoise, KnownColor.MediumVioletRed, KnownColor.MidnightBlue, KnownColor.MintCream, + KnownColor.MistyRose, KnownColor.Moccasin, KnownColor.NavajoWhite, KnownColor.Navy, KnownColor.OldLace, + KnownColor.Olive, KnownColor.OliveDrab, KnownColor.Orange, KnownColor.OrangeRed, KnownColor.Orchid, + KnownColor.PaleGoldenrod, KnownColor.PaleGreen, KnownColor.PaleTurquoise, KnownColor.PaleVioletRed, + KnownColor.PapayaWhip, KnownColor.PeachPuff, KnownColor.Peru, KnownColor.Pink, KnownColor.Plum, + KnownColor.PowderBlue, KnownColor.Purple, KnownColor.Red, KnownColor.RosyBrown, KnownColor.RoyalBlue, + KnownColor.SaddleBrown, KnownColor.Salmon, KnownColor.SandyBrown, KnownColor.SeaGreen, + KnownColor.SeaShell, KnownColor.Sienna, KnownColor.Silver, KnownColor.SkyBlue, KnownColor.SlateBlue, + KnownColor.SlateGray, KnownColor.Snow, KnownColor.SpringGreen, KnownColor.SteelBlue, KnownColor.Tan, + KnownColor.Teal, KnownColor.Thistle, KnownColor.Tomato, KnownColor.Turquoise, KnownColor.Violet, + KnownColor.Wheat, KnownColor.White, KnownColor.WhiteSmoke, KnownColor.Yellow, KnownColor.YellowGreen + }.Select(kc => new object[] { kc }).ToArray(); + + [Theory, MemberData(nameof(NamedArgbValues))] + public void FromKnownColor(string name, int alpha, int red, int green, int blue) + { + Color color = Color.FromKnownColor(Enum.Parse(name)); + Assert.Equal(alpha, color.A); + Assert.Equal(red, color.R); + Assert.Equal(green, color.G); + Assert.Equal(blue, color.B); + } + + [Theory] + [InlineData(-1)] + [InlineData(0)] + [InlineData(KnownColor.MenuHighlight + 1)] + public void FromOutOfRangeKnownColor(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Assert.Equal(0, color.A); + Assert.Equal(0, color.R); + Assert.Equal(0, color.G); + Assert.Equal(0, color.B); + } + + [Theory, MemberData(nameof(AllKnownColors))] + public void ToKnownColor(KnownColor known) => Assert.Equal(known, Color.FromKnownColor(known).ToKnownColor()); + + [Theory, MemberData(nameof(AllKnownColors))] + public void ToKnownColorMatchesButIsNotKnown(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Color match = Color.FromArgb(color.A, color.R, color.G, color.B); + Assert.Equal((KnownColor)0, match.ToKnownColor()); + } + + [Theory] + [InlineData(-1)] + [InlineData(0)] + [InlineData(KnownColor.MenuHighlight + 1)] + public void FromOutOfRangeKnownColorToKnownColor(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Assert.Equal((KnownColor)0, color.ToKnownColor()); + } + + [Theory, MemberData(nameof(SystemColors))] + public void IsSystemColorTrue(KnownColor known) => Assert.True(Color.FromKnownColor(known).IsSystemColor); + + [Theory, MemberData(nameof(NonSystemColors))] + public void IsSystemColorFalse(KnownColor known) => Assert.False(Color.FromKnownColor(known).IsSystemColor); + + [Theory, MemberData(nameof(SystemColors))] + public void IsSystemColorFalseOnMatching(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Color match = Color.FromArgb(color.A, color.R, color.G, color.B); + Assert.False(match.IsSystemColor); + } + + [Theory] + [InlineData(-1)] + [InlineData(0)] + [InlineData(KnownColor.MenuHighlight + 1)] + public void IsSystemColorOutOfRangeKnown(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Assert.False(color.IsSystemColor); + } + + [Theory, MemberData(nameof(AllKnownColors))] + public void IsKnownColorTrue(KnownColor known) + { + Assert.True(Color.FromKnownColor(known).IsKnownColor); + } + + [Theory, MemberData(nameof(AllKnownColors))] + public void IsKnownColorMatchFalse(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Color match = Color.FromArgb(color.A, color.R, color.G, color.B); + Assert.False(match.IsKnownColor); + } + + [Theory] + [InlineData(-1)] + [InlineData(0)] + [InlineData(KnownColor.MenuHighlight + 1)] + public void IsKnownColorOutOfRangeKnown(KnownColor known) + { + Color color = Color.FromKnownColor(known); + Assert.False(color.IsKnownColor); + } + + [Fact] + public void GetHashCodeForUnknownNamed() + { + // NetFX gives all such colors the same hash code. CoreFX makes more effort with them. + Color c1 = Color.FromName("SomeUnknownColorName"); + Color c2 = Color.FromName("AnotherUnknownColorName"); + Assert.NotEqual(c2.GetHashCode(), c1.GetHashCode()); + Assert.Equal(c1.GetHashCode(), c1.GetHashCode()); + } + } +} diff --git a/external/corefx/src/System.Drawing.Primitives/tests/SerializationTests.cs b/external/corefx/src/System.Drawing.Primitives/tests/SerializationTests.cs deleted file mode 100644 index 30cc4d5ec8..0000000000 --- a/external/corefx/src/System.Drawing.Primitives/tests/SerializationTests.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Runtime.Serialization.Formatters.Tests; -using Xunit; - -namespace System.Drawing.Primitives.Tests -{ - public class SerializationTests - { - public static IEnumerable Color_Roundtrip_MemberData() - { - yield return new object[] { default(Color) }; - yield return new object[] { Color.FromName("AliceBlue") }; - yield return new object[] { Color.AliceBlue }; - yield return new object[] { Color.FromArgb(255, 1, 2, 3) }; - yield return new object[] { Color.FromArgb(0, 1, 2, 3) }; - yield return new object[] { Color.FromArgb(1, 2, 3) }; - yield return new object[] { Color.FromName("SomeName") }; - } - - [Theory] - [MemberData(nameof(Color_Roundtrip_MemberData))] - public void Color_Roundtrip(Color c) - { - Assert.Equal(c, BinaryFormatterHelpers.Clone(c)); - } - - [Fact] - public void Size_Roundtrip() - { - SizeF s = new SizeF(123.4f, 567.8f); - Assert.Equal(s, BinaryFormatterHelpers.Clone(s)); - Assert.Equal(s.ToSize(), BinaryFormatterHelpers.Clone(s.ToSize())); - } - - [Fact] - public void Point_Roundtrip() - { - PointF p = new PointF(123.4f, 567.8f); - Assert.Equal(p, BinaryFormatterHelpers.Clone(p)); - Assert.Equal(Point.Truncate(p), BinaryFormatterHelpers.Clone(Point.Truncate(p))); - } - - [Fact] - public void Rectangle_Roundtrip() - { - RectangleF r = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f); - Assert.Equal(r, BinaryFormatterHelpers.Clone(r)); - Assert.Equal(Rectangle.Truncate(r), BinaryFormatterHelpers.Clone(Rectangle.Truncate(r))); - } - } -} diff --git a/external/corefx/src/System.Drawing.Primitives/tests/System.Drawing.Primitives.Tests.csproj b/external/corefx/src/System.Drawing.Primitives/tests/System.Drawing.Primitives.Tests.csproj index 29a26cc198..3897e8dbac 100644 --- a/external/corefx/src/System.Drawing.Primitives/tests/System.Drawing.Primitives.Tests.csproj +++ b/external/corefx/src/System.Drawing.Primitives/tests/System.Drawing.Primitives.Tests.csproj @@ -19,22 +19,14 @@ - - - Common\System\PlatformDetection.cs - Common\System\Diagnostics\DebuggerAttributes.cs - - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs - - - + - \ No newline at end of file + diff --git a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs index fde96f0f3a..854e406785 100644 --- a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs +++ b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs @@ -2238,8 +2238,6 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.indexer.regclas memberClassStatus = MemberClass.t_status; } - - Assert.Equal(0, Verify()); } private static int Verify() @@ -2276,8 +2274,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.indexer.regclas RequireLifetimesEnded(); GC.Collect(); GC.WaitForPendingFinalizers(); - GC.Collect(); - GC.WaitForPendingFinalizers(); + Assert.Equal(0, Verify()); } } // diff --git a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs index 6a6182dbb1..65bd192c52 100644 --- a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs +++ b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs @@ -921,10 +921,6 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.method.genmetho } } - public void Foo() - { - } - private static int Verify() { lock (Test.locker) @@ -943,7 +939,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.method.genmetho { Test t = new Test(); Test.s_field = "Field"; - t.Foo(); + GC.KeepAlive(t); } [Fact] diff --git a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs index 02f1d430f7..c25e2b58c6 100644 --- a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs +++ b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs @@ -1755,10 +1755,6 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.regclas } } - public void Foo() - { - } - private static int Verify() { lock (Test.locker) @@ -1783,7 +1779,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.regclas { Test t = new Test(); Test.s_field = null; - t.Foo(); + GC.KeepAlive(t); } [Fact] @@ -3437,10 +3433,6 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.regclas } } - public void Foo() - { - } - private static int Verify() { lock (Test.locker) @@ -3465,7 +3457,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.operate.regclas { Test t = new Test(); Test.s_field = null; - t.Foo(); + GC.KeepAlive(t); } [Fact] diff --git a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.property.autoproperty.regclass.cs b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.property.autoproperty.regclass.cs index 999e6dca40..918297f930 100644 --- a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.property.autoproperty.regclass.cs +++ b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.property.autoproperty.regclass.cs @@ -498,10 +498,6 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.property.autopr } } - public void Foo() - { - } - private static int Verify() { lock (Test.locker) @@ -520,7 +516,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.context.property.autopr { Test t = new Test(); Test.s_field = "Field"; - t.Foo(); + GC.KeepAlive(t); } [Fact] diff --git a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.NamedAndOptional/Conformance.dynamic.namedandoptional.decl.other.cs b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.NamedAndOptional/Conformance.dynamic.namedandoptional.decl.other.cs index ef6bc7621f..77c37e64d1 100644 --- a/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.NamedAndOptional/Conformance.dynamic.namedandoptional.decl.other.cs +++ b/external/corefx/src/System.Dynamic.Runtime/tests/Dynamic.NamedAndOptional/Conformance.dynamic.namedandoptional.decl.other.cs @@ -8,7 +8,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.namedandoptional.decl.o { // Declaration of Methods with Optional Parameters // Declaration of Optional Params - // Simple Declaration of a an Extension method with optional parameters + // Simple Declaration of an Extension method with optional parameters // // public static class Extension @@ -46,7 +46,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.namedandoptional.decl.o { // Declaration of Methods with Optional Parameters // Declaration of Optional Params - // Simple Declaration of a an Extension method with optional parameters + // Simple Declaration of an Extension method with optional parameters // // public static class Extension @@ -95,7 +95,7 @@ namespace ManagedTests.DynamicCSharp.Conformance.dynamic.namedandoptional.decl.o { // Declaration of Methods with Optional Parameters // Declaration of Optional Params - // Simple Declaration of a an Extension method with optional parameters + // Simple Declaration of an Extension method with optional parameters // // public static class Extension diff --git a/external/corefx/src/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj b/external/corefx/src/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj index c847b00e46..090d2d11b2 100644 --- a/external/corefx/src/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj +++ b/external/corefx/src/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj @@ -156,9 +156,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Globalization.Calendars/tests/System.Globalization.Calendars.Tests.csproj b/external/corefx/src/System.Globalization.Calendars/tests/System.Globalization.Calendars.Tests.csproj index ed9fddc213..43113c8308 100644 --- a/external/corefx/src/System.Globalization.Calendars/tests/System.Globalization.Calendars.Tests.csproj +++ b/external/corefx/src/System.Globalization.Calendars/tests/System.Globalization.Calendars.Tests.csproj @@ -109,9 +109,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Globalization.Extensions/dir.props b/external/corefx/src/System.Globalization.Extensions/dir.props index e09fa64586..e063359772 100644 --- a/external/corefx/src/System.Globalization.Extensions/dir.props +++ b/external/corefx/src/System.Globalization.Extensions/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Globalization.Extensions/ref/Configurations.props b/external/corefx/src/System.Globalization.Extensions/ref/Configurations.props index 7de0087598..c701755863 100644 --- a/external/corefx/src/System.Globalization.Extensions/ref/Configurations.props +++ b/external/corefx/src/System.Globalization.Extensions/ref/Configurations.props @@ -4,7 +4,6 @@ netcoreapp; uap; - netfx; \ No newline at end of file diff --git a/external/corefx/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj b/external/corefx/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj index 9323be9594..286fca0138 100644 --- a/external/corefx/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj +++ b/external/corefx/src/System.Globalization.Extensions/ref/System.Globalization.Extensions.csproj @@ -6,8 +6,6 @@ - - diff --git a/external/corefx/src/System.Globalization.Extensions/src/Configurations.props b/external/corefx/src/System.Globalization.Extensions/src/Configurations.props index 72bafb787d..62eb1c4776 100644 --- a/external/corefx/src/System.Globalization.Extensions/src/Configurations.props +++ b/external/corefx/src/System.Globalization.Extensions/src/Configurations.props @@ -4,7 +4,6 @@ netcoreapp-Unix; netcoreapp-Windows_NT; - netfx-Windows_NT; uap-Windows_NT; diff --git a/external/corefx/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj b/external/corefx/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj index 30024335c8..310c8ff612 100644 --- a/external/corefx/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj +++ b/external/corefx/src/System.Globalization.Extensions/src/System.Globalization.Extensions.csproj @@ -15,8 +15,6 @@ - - diff --git a/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/Data/Unicode_Win7/Unicode_Win7_IdnaTest.cs b/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/Data/Unicode_Win7/Unicode_Win7_IdnaTest.cs index ba88e9ae32..d5948517f7 100644 --- a/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/Data/Unicode_Win7/Unicode_Win7_IdnaTest.cs +++ b/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/Data/Unicode_Win7/Unicode_Win7_IdnaTest.cs @@ -10,7 +10,7 @@ namespace System.Globalization.Tests /// /// contained in Data\Unicode_Win7\IdnaTest_Win7.txt /// - /// The structure of the data set is a semicolon deliminated list with the following columns: + /// The structure of the data set is a semicolon delimited list with the following columns: /// /// Column 1: type - T for transitional, N for nontransitional, B for both /// Column 2: source - the source string to be tested diff --git a/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/IdnMappingIdnaConformanceTests.cs b/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/IdnMappingIdnaConformanceTests.cs index a31e88ac3d..c4203a49a4 100644 --- a/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/IdnMappingIdnaConformanceTests.cs +++ b/external/corefx/src/System.Globalization.Extensions/tests/IdnMapping/IdnMappingIdnaConformanceTests.cs @@ -80,7 +80,7 @@ namespace System.Globalization.Tests /// from the 6.0\IdnaTest.txt. To find them, search for "GETASCII DOES NOT FAIL ON WINDOWS 8.1" /// Same applies to Windows 10 >= 10.0.15063 in the IdnaTest_9.txt file /// - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/21332 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/21332 public void GetAscii_Invalid() { Assert.All(Factory.GetDataset().Where(entry => !entry.ASCIIResult.Success), entry => diff --git a/external/corefx/src/System.Globalization.Extensions/tests/System.Globalization.Extensions.Tests.csproj b/external/corefx/src/System.Globalization.Extensions/tests/System.Globalization.Extensions.Tests.csproj index 86c311de54..4edfc8e6b3 100644 --- a/external/corefx/src/System.Globalization.Extensions/tests/System.Globalization.Extensions.Tests.csproj +++ b/external/corefx/src/System.Globalization.Extensions/tests/System.Globalization.Extensions.Tests.csproj @@ -22,9 +22,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Globalization/tests/CompareInfo/CompareInfoTests.cs b/external/corefx/src/System.Globalization/tests/CompareInfo/CompareInfoTests.cs index ce51685591..be6deba776 100644 --- a/external/corefx/src/System.Globalization/tests/CompareInfo/CompareInfoTests.cs +++ b/external/corefx/src/System.Globalization/tests/CompareInfo/CompareInfoTests.cs @@ -410,8 +410,9 @@ namespace System.Globalization.Tests { SortVersion sv1 = CultureInfo.GetCultureInfo("en-US").CompareInfo.Version; SortVersion sv2 = CultureInfo.GetCultureInfo("ja-JP").CompareInfo.Version; + SortVersion sv3 = CultureInfo.GetCultureInfo("en").CompareInfo.Version; - Assert.Equal(sv1.FullVersion, sv2.FullVersion); + Assert.Equal(sv1.FullVersion, sv3.FullVersion); Assert.NotEqual(sv1.SortId, sv2.SortId); } } diff --git a/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs b/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs index adc3cffa85..763126eb7c 100644 --- a/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs +++ b/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoCurrentCulture.cs @@ -14,7 +14,7 @@ namespace System.Globalization.Tests [Fact] public void CurrentCulture() { - if (PlatformDetection.IsNetNative && !PlatformDetection.IsWinRT) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. + if (PlatformDetection.IsNetNative && !PlatformDetection.IsInAppContainer) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. return; RemoteInvoke(() => @@ -43,7 +43,7 @@ namespace System.Globalization.Tests [Fact] public void CurrentUICulture() { - if (PlatformDetection.IsNetNative && !PlatformDetection.IsWinRT) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. + if (PlatformDetection.IsNetNative && !PlatformDetection.IsInAppContainer) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. return; RemoteInvoke(() => diff --git a/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoDateTimeFormat.cs b/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoDateTimeFormat.cs index f584f78e03..c10e86d654 100644 --- a/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoDateTimeFormat.cs +++ b/external/corefx/src/System.Globalization/tests/CultureInfo/CultureInfoDateTimeFormat.cs @@ -35,9 +35,6 @@ namespace System.Globalization.Tests [Fact] public void TestSettingThreadCultures() { - if (PlatformDetection.IsNetNative && !PlatformDetection.IsWinRT) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. - return; - RemoteInvoke(() => { CultureInfo culture = new CultureInfo("ja-JP"); diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyDecimalDigits.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyDecimalDigits.cs index b276ccd253..950e6d3115 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyDecimalDigits.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyDecimalDigits.cs @@ -13,8 +13,8 @@ namespace System.Globalization.Tests public static IEnumerable CurrencyDecimalDigits_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, 2, 2 }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, 2, 2 }; - yield return new object[] { new CultureInfo("ko").NumberFormat, 0, 2 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, 2, 2 }; + yield return new object[] { CultureInfo.GetCultureInfo("ko").NumberFormat, 0, 2 }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs index a84d8b9a0e..c9b25d03e2 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyGroupSizes.cs @@ -12,12 +12,12 @@ namespace System.Globalization.Tests public static IEnumerable CurrencyGroupSizes_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, new int[] { 3 } }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } }; if ((!PlatformDetection.IsUbuntu || PlatformDetection.IsUbuntu1404) && !PlatformDetection.IsWindows7 && !PlatformDetection.IsWindows8x && !PlatformDetection.IsFedora) { - yield return new object[] { new CultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 } }; + yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, new int[] { 3, 2 } }; } } diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyNegativePattern.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyNegativePattern.cs index 90670e4c68..c6960c612a 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyNegativePattern.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyNegativePattern.cs @@ -13,7 +13,7 @@ namespace System.Globalization.Tests public static IEnumerable CurrencyNegativePattern_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 0 } }; - yield return new object[] { new CultureInfo("bg-BG").NumberFormat, new int[] { 8 } }; + yield return new object[] { CultureInfo.GetCultureInfo("bg-BG").NumberFormat, new int[] { 8 } }; } [Theory] @@ -36,7 +36,7 @@ namespace System.Globalization.Tests CultureInfo culture; try { - culture = new CultureInfo(locale); + culture = CultureInfo.GetCultureInfo(locale); } catch(CultureNotFoundException) { diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyPositivePattern.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyPositivePattern.cs index 373c6db599..90a5b7c810 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyPositivePattern.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencyPositivePattern.cs @@ -12,8 +12,8 @@ namespace System.Globalization.Tests public static IEnumerable CurrencyPositivePattern_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, 0 }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, 0 }; - yield return new object[] { new CultureInfo("fr-FR").NumberFormat, 3 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, 0 }; + yield return new object[] { CultureInfo.GetCultureInfo("fr-FR").NumberFormat, 3 }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencySymbol.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencySymbol.cs index 4bb33ebe33..a68b7303f6 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencySymbol.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrencySymbol.cs @@ -14,7 +14,7 @@ namespace System.Globalization.Tests [InlineData("", "\x00a4")] // international public void CurrencySymbol_Get(string name, string expected) { - Assert.Equal(expected, new CultureInfo(name).NumberFormat.CurrencySymbol); + Assert.Equal(expected, CultureInfo.GetCultureInfo(name).NumberFormat.CurrencySymbol); } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrentInfo.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrentInfo.cs index 5bb18223c5..2954a52780 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrentInfo.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoCurrentInfo.cs @@ -12,8 +12,8 @@ namespace System.Globalization.Tests { public static IEnumerable CurrentInfo_CustomCulture_TestData() { - yield return new object[] { new CultureInfo("en") }; - yield return new object[] { new CultureInfo("en-US") }; + yield return new object[] { CultureInfo.GetCultureInfo("en") }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US") }; yield return new object[] { CultureInfo.InvariantCulture }; } @@ -21,12 +21,9 @@ namespace System.Globalization.Tests [MemberData(nameof(CurrentInfo_CustomCulture_TestData))] public void CurrentInfo_CustomCulture(CultureInfo newCurrentCulture) { - if (PlatformDetection.IsNetNative && !PlatformDetection.IsWinRT) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. - return; - RemoteInvoke((cultureName) => { - CultureInfo newCulture = new CultureInfo(cultureName); + CultureInfo newCulture = CultureInfo.GetCultureInfo(cultureName); CultureInfo.CurrentCulture = newCulture; Assert.Same(newCulture.NumberFormat, NumberFormatInfo.CurrentInfo); return SuccessExitCode; @@ -36,9 +33,6 @@ namespace System.Globalization.Tests [Fact] public void CurrentInfo_Subclass_OverridesGetFormat() { - if (PlatformDetection.IsNetNative && !PlatformDetection.IsWinRT) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. - return; - RemoteInvoke(() => { CultureInfo.CurrentCulture = new CultureInfoSubclassOverridesGetFormat("en-US"); @@ -50,9 +44,6 @@ namespace System.Globalization.Tests [Fact] public void CurrentInfo_Subclass_OverridesNumberFormat() { - if (PlatformDetection.IsNetNative && !PlatformDetection.IsWinRT) // Tide us over until .Net Native ILC tests run are run inside an appcontainer. - return; - RemoteInvoke(() => { CultureInfo.CurrentCulture = new CultureInfoSubclassOverridesNumberFormat("en-US"); @@ -65,7 +56,7 @@ namespace System.Globalization.Tests { public CultureInfoSubclassOverridesGetFormat(string name): base(name) { } - public static NumberFormatInfo CustomFormat { get; } = new CultureInfo("fr-FR").NumberFormat; + public static NumberFormatInfo CustomFormat { get; } = CultureInfo.GetCultureInfo("fr-FR").NumberFormat; public override object GetFormat(Type formatType) => CustomFormat; } @@ -74,7 +65,7 @@ namespace System.Globalization.Tests { public CultureInfoSubclassOverridesNumberFormat(string name): base(name) { } - public static NumberFormatInfo CustomFormat { get; } = new CultureInfo("fr-FR").NumberFormat; + public static NumberFormatInfo CustomFormat { get; } = CultureInfo.GetCultureInfo("fr-FR").NumberFormat; public override NumberFormatInfo NumberFormat { diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs index de89807751..675de22d56 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoData.cs @@ -8,17 +8,7 @@ namespace System.Globalization.Tests { public static int[] UrINNumberGroupSizes() { - if ( - (PlatformDetection.IsWindows && PlatformDetection.WindowsVersion >= 10) -#if !uap - || - (PlatformDetection.IsOSX && PlatformDetection.OSXKernelVersion >= new Version(15, 0)) -#endif - || (PlatformDetection.IsUbuntu && !PlatformDetection.IsUbuntu1404) - || PlatformDetection.IsFedora - || (PlatformDetection.IsDebian && !PlatformDetection.IsDebian8) - || PlatformDetection.IsTizen - ) + if (PlatformDetection.WindowsVersion >= 10 || PlatformDetection.ICUVersion.Major >= 55) { return new int[] { 3 }; } @@ -49,6 +39,10 @@ namespace System.Globalization.Tests { return (PlatformDetection.WindowsVersion < 10) ? new int[] { 3 } : new int[] { 6, 3 }; } + if (PlatformDetection.ICUVersion.Major >= 59) + { + return new int[] { 8 }; + } else { return new int[] { 1, 0 }; @@ -74,7 +68,7 @@ namespace System.Globalization.Tests return PlatformDetection.IsWindows ? new int[] { 15 } : new int[] { 8, 15 }; } - throw DateTimeFormatInfoData.GetCultureNotSupportedException(new CultureInfo(localeName)); + throw DateTimeFormatInfoData.GetCultureNotSupportedException(CultureInfo.GetCultureInfo(localeName)); } } } diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoGetInstance.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoGetInstance.cs index 26b51308e3..23e053df2e 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoGetInstance.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoGetInstance.cs @@ -11,7 +11,7 @@ namespace System.Globalization.Tests { public static IEnumerable GetInstance_TestData() { - CultureInfo frFRCulture = new CultureInfo("fr-FR"); + CultureInfo frFRCulture = CultureInfo.GetCultureInfo("fr-FR"); yield return new object[] { frFRCulture, frFRCulture.NumberFormat }; yield return new object[] { frFRCulture.NumberFormat, frFRCulture.NumberFormat }; yield return new object[] { new CustomFormatProvider(), CustomFormatProvider.CustomFormat }; @@ -55,7 +55,7 @@ namespace System.Globalization.Tests private class CustomFormatProvider : IFormatProvider { - public static NumberFormatInfo CustomFormat { get; } = new CultureInfo("fr-FR").NumberFormat; + public static NumberFormatInfo CustomFormat { get; } = CultureInfo.GetCultureInfo("fr-FR").NumberFormat; public object GetFormat(Type formatType) => CustomFormat; } diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeInfinitySymbol.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeInfinitySymbol.cs index 2a8fc36df3..327b76dd8c 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeInfinitySymbol.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeInfinitySymbol.cs @@ -12,8 +12,8 @@ namespace System.Globalization.Tests public static IEnumerable NegativeInfinitySymbol_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo }; - yield return new object[] { new CultureInfo("en-US").NumberFormat }; - yield return new object[] { new CultureInfo("fr-FR").NumberFormat }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat }; + yield return new object[] { CultureInfo.GetCultureInfo("fr-FR").NumberFormat }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeSign.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeSign.cs index 1bf3bb1411..5949f328ea 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeSign.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNegativeSign.cs @@ -12,7 +12,7 @@ namespace System.Globalization.Tests public static IEnumerable NegativeSign_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, "-" }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, "-" }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, "-" }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberDecimalDigits.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberDecimalDigits.cs index 26da474545..030d28bb21 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberDecimalDigits.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberDecimalDigits.cs @@ -13,7 +13,7 @@ namespace System.Globalization.Tests public static IEnumerable NumberDecimalDigits_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, 2, 2 }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, 2, 3 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, 2, 3 }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs index 31752d563a..fa16372e29 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs @@ -12,12 +12,12 @@ namespace System.Globalization.Tests public static IEnumerable NumberGroupSizes_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, new int[] { 3 } }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } }; // Culture does not exist on Windows 7 if (!PlatformDetection.IsWindows7) { - yield return new object[] { new CultureInfo("ur-IN").NumberFormat, NumberFormatInfoData.UrINNumberGroupSizes() }; + yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, NumberFormatInfoData.UrINNumberGroupSizes() }; } } diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberNegativePattern.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberNegativePattern.cs index aafacb9c2c..516fa21f7d 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberNegativePattern.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberNegativePattern.cs @@ -12,7 +12,7 @@ namespace System.Globalization.Tests public static IEnumerable NumberNegativePattern_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, 1 }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, 1 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, 1 }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentGroupSizes.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentGroupSizes.cs index f20884a9b2..8a0320979f 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentGroupSizes.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentGroupSizes.cs @@ -12,7 +12,7 @@ namespace System.Globalization.Tests public static IEnumerable PercentGroupSizes_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, new int[] { 3 } }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentNegativePattern.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentNegativePattern.cs index 5e750d1190..bd1afebef4 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentNegativePattern.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentNegativePattern.cs @@ -12,9 +12,9 @@ namespace System.Globalization.Tests { public static IEnumerable PercentNegativePattern_TestData() { - yield return new object[] { new CultureInfo("en-US").NumberFormat, 1 }; - yield return new object[] { new CultureInfo("en-MY").NumberFormat, 1 }; - yield return new object[] { new CultureInfo("tr").NumberFormat, 2 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, 1 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-MY").NumberFormat, 1 }; + yield return new object[] { CultureInfo.GetCultureInfo("tr").NumberFormat, 2 }; } /// diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentPositivePattern.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentPositivePattern.cs index 8211d28999..5f595dc76a 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentPositivePattern.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentPositivePattern.cs @@ -12,9 +12,9 @@ namespace System.Globalization.Tests { public static IEnumerable PercentPositivePattern_TestData() { - yield return new object[] { new CultureInfo("en-US").NumberFormat, 1 }; - yield return new object[] { new CultureInfo("en-MY").NumberFormat, 1 }; - yield return new object[] { new CultureInfo("tr").NumberFormat, 2 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, 1 }; + yield return new object[] { CultureInfo.GetCultureInfo("en-MY").NumberFormat, 1 }; + yield return new object[] { CultureInfo.GetCultureInfo("tr").NumberFormat, 2 }; } /// diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentSymbol.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentSymbol.cs index 37973c2c66..c13cdfd8a9 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentSymbol.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPercentSymbol.cs @@ -12,7 +12,7 @@ namespace System.Globalization.Tests public static IEnumerable PercentSymbol_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, "%" }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, "%" }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, "%" }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveInfinitySymbol.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveInfinitySymbol.cs index 9cbef54072..21f7a42cab 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveInfinitySymbol.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveInfinitySymbol.cs @@ -12,8 +12,8 @@ namespace System.Globalization.Tests public static IEnumerable PositiveInfinitySymbol_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo }; - yield return new object[] { new CultureInfo("en-US").NumberFormat }; - yield return new object[] { new CultureInfo("fr-FR").NumberFormat }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat }; + yield return new object[] { CultureInfo.GetCultureInfo("fr-FR").NumberFormat }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveSign.cs b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveSign.cs index ffc2e677cd..92b8bf9ff8 100644 --- a/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveSign.cs +++ b/external/corefx/src/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoPositiveSign.cs @@ -12,7 +12,7 @@ namespace System.Globalization.Tests public static IEnumerable PositiveSign_TestData() { yield return new object[] { NumberFormatInfo.InvariantInfo, "+" }; - yield return new object[] { new CultureInfo("en-US").NumberFormat, "+" }; + yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, "+" }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/Performance/Configurations.props b/external/corefx/src/System.Globalization/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Globalization/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs b/external/corefx/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs index bba87ca74b..f3f607da1c 100644 --- a/external/corefx/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs +++ b/external/corefx/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs @@ -3,37 +3,40 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Xunit; namespace System.Globalization.Tests { - public class RegionInfoPropertyTests + public class RegionInfoPropertyTests : RemoteExecutorTestBase { [Fact] public void CurrentRegion() { - CultureInfo oldThreadCulture = CultureInfo.CurrentCulture; - - try + RemoteInvoke(() => { CultureInfo.CurrentCulture = new CultureInfo("en-US"); RegionInfo ri = new RegionInfo(new RegionInfo(CultureInfo.CurrentCulture.Name).TwoLetterISORegionName); Assert.True(RegionInfo.CurrentRegion.Equals(ri) || RegionInfo.CurrentRegion.Equals(new RegionInfo(CultureInfo.CurrentCulture.Name))); Assert.Same(RegionInfo.CurrentRegion, RegionInfo.CurrentRegion); - } - finally - { - CultureInfo.CurrentCulture = oldThreadCulture; - } + + return SuccessExitCode; + }).Dispose(); } [Theory] [InlineData("en-US", "United States")] public void DisplayName(string name, string expected) { - Assert.Equal(expected, new RegionInfo(name).DisplayName); + RemoteInvoke((string _name, string _expected) => + { + CultureInfo.CurrentUICulture = new CultureInfo(_name); + Assert.Equal(_expected, new RegionInfo(_name).DisplayName); + + return SuccessExitCode; + }, name, expected).Dispose(); } [Theory] @@ -104,7 +107,7 @@ namespace System.Globalization.Tests "SAU", "SAU" }; yield return new object[] { 0x412, 134, "South Korean Won", "Korean Won", PlatformDetection.IsWindows ? "\uc6d0" : "\ub300\ud55c\ubbfc\uad6d\u0020\uc6d0", "KOR", "KOR" }; yield return new object[] { 0x40d, 117, "Israeli New Shekel", "Israeli New Sheqel", - PlatformDetection.IsWindows ? "\u05e9\u05e7\u05dc\u0020\u05d7\u05d3\u05e9" : "\u05e9\u05f4\u05d7", "ISR", "ISR" }; + PlatformDetection.IsWindows || PlatformDetection.ICUVersion.Major >= 59 ? "\u05e9\u05e7\u05dc\u0020\u05d7\u05d3\u05e9" : "\u05e9\u05f4\u05d7", "ISR", "ISR" }; } [Theory] diff --git a/external/corefx/src/System.Globalization/tests/System.Globalization.Tests.csproj b/external/corefx/src/System.Globalization/tests/System.Globalization.Tests.csproj index dde763ee8b..5edd084b28 100644 --- a/external/corefx/src/System.Globalization/tests/System.Globalization.Tests.csproj +++ b/external/corefx/src/System.Globalization/tests/System.Globalization.Tests.csproj @@ -131,16 +131,10 @@ - - Common\System\PlatformDetection.cs - - - Common\System\PlatformDetection.Unix.cs - Common\System\RandomDataGenerator.cs - + {69e46a6f-9966-45a5-8945-2559fe337827} RemoteExecutorConsoleApp diff --git a/external/corefx/src/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj b/external/corefx/src/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj index 0c1a87fcef..e5343a1ba6 100644 --- a/external/corefx/src/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj +++ b/external/corefx/src/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj @@ -18,6 +18,9 @@ Common\System\IO\TempDirectory.cs + + Common\System\IO\StreamSpanExtensions.netstandard.cs + Common\System\IO\Compression\CRC.cs diff --git a/external/corefx/src/System.IO.Compression.ZipFile/tests/ZipFileConvenienceMethods.cs b/external/corefx/src/System.IO.Compression.ZipFile/tests/ZipFileConvenienceMethods.cs index 2c6f0865a7..69c822e3fc 100644 --- a/external/corefx/src/System.IO.Compression.ZipFile/tests/ZipFileConvenienceMethods.cs +++ b/external/corefx/src/System.IO.Compression.ZipFile/tests/ZipFileConvenienceMethods.cs @@ -89,7 +89,7 @@ namespace System.IO.Compression.Tests AssertExtensions.Throws("sourceArchiveFileName", () => ZipFile.ExtractToDirectory(null, GetTestFilePath())); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMacOsHighSierraOrHigher))] public void ExtractToDirectoryUnicode() { string zipFileName = zfile("unicode.zip"); @@ -175,7 +175,7 @@ namespace System.IO.Compression.Tests } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMacOsHighSierraOrHigher))] public void ExtractToDirectoryExtension_Unicode() { using (ZipArchive archive = ZipFile.OpenRead(zfile("unicode.zip"))) diff --git a/external/corefx/src/System.IO.Compression/dir.props b/external/corefx/src/System.IO.Compression/dir.props index 988a62597c..4d0d97a320 100644 --- a/external/corefx/src/System.IO.Compression/dir.props +++ b/external/corefx/src/System.IO.Compression/dir.props @@ -6,6 +6,5 @@ ECMA true true - true \ No newline at end of file diff --git a/external/corefx/src/System.IO.Compression/ref/Configurations.props b/external/corefx/src/System.IO.Compression/ref/Configurations.props index 7de0087598..c701755863 100644 --- a/external/corefx/src/System.IO.Compression/ref/Configurations.props +++ b/external/corefx/src/System.IO.Compression/ref/Configurations.props @@ -4,7 +4,6 @@ netcoreapp; uap; - netfx; \ No newline at end of file diff --git a/external/corefx/src/System.IO.Compression/ref/System.IO.Compression.csproj b/external/corefx/src/System.IO.Compression/ref/System.IO.Compression.csproj index 6c72b74e38..aa2e71eca6 100644 --- a/external/corefx/src/System.IO.Compression/ref/System.IO.Compression.csproj +++ b/external/corefx/src/System.IO.Compression/ref/System.IO.Compression.csproj @@ -7,8 +7,6 @@ - - diff --git a/external/corefx/src/System.IO.Compression/src/Configurations.props b/external/corefx/src/System.IO.Compression/src/Configurations.props index 6b9a954087..62eb1c4776 100644 --- a/external/corefx/src/System.IO.Compression/src/Configurations.props +++ b/external/corefx/src/System.IO.Compression/src/Configurations.props @@ -5,7 +5,6 @@ netcoreapp-Unix; netcoreapp-Windows_NT; uap-Windows_NT; - netfx-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Unix.cs b/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Unix.cs index fb6bfc3c17..871f6c3a65 100644 --- a/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Unix.cs +++ b/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Unix.cs @@ -33,13 +33,7 @@ internal static partial class Interop [DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_InflateEnd")] internal static extern ZLibNative.ErrorCode InflateEnd(ref ZLibNative.ZStream stream); - internal static unsafe uint crc32(uint crc, byte[] buffer, int offset, int len) - { - fixed (byte* buf = &buffer[offset]) - return Crc32(crc, buf, len); - } - [DllImport(Libraries.CompressionNative, EntryPoint = "CompressionNative_Crc32")] - private static extern unsafe uint Crc32(uint crc, byte* buffer, int len); + internal static extern unsafe uint crc32(uint crc, byte* buffer, int len); } } diff --git a/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Windows.cs b/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Windows.cs index 812fdb0839..1004846ac9 100644 --- a/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Windows.cs +++ b/external/corefx/src/System.IO.Compression/src/Interop/Interop.zlib.Windows.cs @@ -49,12 +49,6 @@ internal static partial class Interop } } - internal static unsafe uint crc32(uint crc, byte[] buffer, int offset, int len) - { - fixed (byte* buf = &buffer[offset]) - return crc32(crc, buf, len); - } - internal static unsafe ZLibNative.ErrorCode Deflate(ref ZLibNative.ZStream stream, ZLibNative.FlushCode flush) { fixed (ZLibNative.ZStream* streamBytes = &stream) diff --git a/external/corefx/src/System.IO.Compression/src/System.IO.Compression.csproj b/external/corefx/src/System.IO.Compression/src/System.IO.Compression.csproj index 412e0b80f6..471e378957 100644 --- a/external/corefx/src/System.IO.Compression/src/System.IO.Compression.csproj +++ b/external/corefx/src/System.IO.Compression/src/System.IO.Compression.csproj @@ -13,12 +13,9 @@ - - - @@ -52,12 +49,16 @@ + + + + Common\System\IO\PathInternal.cs @@ -65,6 +66,9 @@ Common\System\IO\StreamHelpers.CopyValidation.cs + + + diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.Managed.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.Managed.cs new file mode 100644 index 0000000000..971d9d3006 --- /dev/null +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.Managed.cs @@ -0,0 +1,508 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// File implements Slicing-by-8 CRC Generation, as described in +// "Novel Table Lookup-Based Algorithms for High-Performance CRC Generation" +// IEEE TRANSACTIONS ON COMPUTERS, VOL. 57, NO. 11, NOVEMBER 2008 + +/* + * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved + * + * + * This software program is licensed subject to the BSD License, + * available at http://www.opensource.org/licenses/bsd-license.html. + */ + +using System.Diagnostics; + +namespace System.IO.Compression +{ + /// + /// Since Desktop compression uses this file alongside the Open ZipArchive, we cannot remove it + /// without breaking the Desktop build. Note that in CoreFX the Zlib Crc32 function is always called. + /// + internal static class Crc32Helper + { + // Calculate CRC based on the old CRC and the new bytes + // See RFC1952 for details. + public static uint UpdateCrc32(uint crc32, byte[] buffer, int offset, int length) + { + Debug.Assert((buffer != null) && (offset >= 0) && (length >= 0) && (offset <= buffer.Length - length)); + Debug.Assert(BitConverter.IsLittleEndian, "ManagedCrc32 Expects Little Endian"); + + uint term1, term2, term3 = 0; + + crc32 ^= 0xFFFFFFFFU; + int runningLength = (length / 8) * 8; + int endBytes = length - runningLength; + + for (int i = 0; i < runningLength / 8; i++) + { + crc32 ^= unchecked((uint)(buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24)); + offset += 4; + term1 = s_crcTable_7[crc32 & 0x000000FF] ^ + s_crcTable_6[(crc32 >> 8) & 0x000000FF]; + term2 = crc32 >> 16; + crc32 = term1 ^ + s_crcTable_5[term2 & 0x000000FF] ^ + s_crcTable_4[(term2 >> 8) & 0x000000FF]; + + term3 = unchecked((uint)(buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24)); + offset += 4; + term1 = s_crcTable_3[term3 & 0x000000FF] ^ + s_crcTable_2[(term3 >> 8) & 0x000000FF]; + term2 = term3 >> 16; + crc32 ^= term1 ^ + s_crcTable_1[term2 & 0x000000FF] ^ + s_crcTable_0[(term2 >> 8) & 0x000000FF]; + } + + for (int i = 0; i < endBytes; i++) + { + crc32 = s_crcTable_0[(crc32 ^ buffer[offset++]) & 0x000000FF] ^ (crc32 >> 8); + } + + crc32 ^= 0xFFFFFFFFU; + return crc32; + } + + // Generated tables for managed crc calculation. + // Each table n (starting at 0) contains remainders from the long division of + // all possible byte values, shifted by an offset of (n * 4 bits). + // The divisor used is the crc32 standard polynomial 0xEDB88320 + // Please see cited paper for more details. + private static readonly uint[] s_crcTable_0 = new uint[256] { + 0x00000000u, 0x77073096u, 0xee0e612cu, 0x990951bau, 0x076dc419u, + 0x706af48fu, 0xe963a535u, 0x9e6495a3u, 0x0edb8832u, 0x79dcb8a4u, + 0xe0d5e91eu, 0x97d2d988u, 0x09b64c2bu, 0x7eb17cbdu, 0xe7b82d07u, + 0x90bf1d91u, 0x1db71064u, 0x6ab020f2u, 0xf3b97148u, 0x84be41deu, + 0x1adad47du, 0x6ddde4ebu, 0xf4d4b551u, 0x83d385c7u, 0x136c9856u, + 0x646ba8c0u, 0xfd62f97au, 0x8a65c9ecu, 0x14015c4fu, 0x63066cd9u, + 0xfa0f3d63u, 0x8d080df5u, 0x3b6e20c8u, 0x4c69105eu, 0xd56041e4u, + 0xa2677172u, 0x3c03e4d1u, 0x4b04d447u, 0xd20d85fdu, 0xa50ab56bu, + 0x35b5a8fau, 0x42b2986cu, 0xdbbbc9d6u, 0xacbcf940u, 0x32d86ce3u, + 0x45df5c75u, 0xdcd60dcfu, 0xabd13d59u, 0x26d930acu, 0x51de003au, + 0xc8d75180u, 0xbfd06116u, 0x21b4f4b5u, 0x56b3c423u, 0xcfba9599u, + 0xb8bda50fu, 0x2802b89eu, 0x5f058808u, 0xc60cd9b2u, 0xb10be924u, + 0x2f6f7c87u, 0x58684c11u, 0xc1611dabu, 0xb6662d3du, 0x76dc4190u, + 0x01db7106u, 0x98d220bcu, 0xefd5102au, 0x71b18589u, 0x06b6b51fu, + 0x9fbfe4a5u, 0xe8b8d433u, 0x7807c9a2u, 0x0f00f934u, 0x9609a88eu, + 0xe10e9818u, 0x7f6a0dbbu, 0x086d3d2du, 0x91646c97u, 0xe6635c01u, + 0x6b6b51f4u, 0x1c6c6162u, 0x856530d8u, 0xf262004eu, 0x6c0695edu, + 0x1b01a57bu, 0x8208f4c1u, 0xf50fc457u, 0x65b0d9c6u, 0x12b7e950u, + 0x8bbeb8eau, 0xfcb9887cu, 0x62dd1ddfu, 0x15da2d49u, 0x8cd37cf3u, + 0xfbd44c65u, 0x4db26158u, 0x3ab551ceu, 0xa3bc0074u, 0xd4bb30e2u, + 0x4adfa541u, 0x3dd895d7u, 0xa4d1c46du, 0xd3d6f4fbu, 0x4369e96au, + 0x346ed9fcu, 0xad678846u, 0xda60b8d0u, 0x44042d73u, 0x33031de5u, + 0xaa0a4c5fu, 0xdd0d7cc9u, 0x5005713cu, 0x270241aau, 0xbe0b1010u, + 0xc90c2086u, 0x5768b525u, 0x206f85b3u, 0xb966d409u, 0xce61e49fu, + 0x5edef90eu, 0x29d9c998u, 0xb0d09822u, 0xc7d7a8b4u, 0x59b33d17u, + 0x2eb40d81u, 0xb7bd5c3bu, 0xc0ba6cadu, 0xedb88320u, 0x9abfb3b6u, + 0x03b6e20cu, 0x74b1d29au, 0xead54739u, 0x9dd277afu, 0x04db2615u, + 0x73dc1683u, 0xe3630b12u, 0x94643b84u, 0x0d6d6a3eu, 0x7a6a5aa8u, + 0xe40ecf0bu, 0x9309ff9du, 0x0a00ae27u, 0x7d079eb1u, 0xf00f9344u, + 0x8708a3d2u, 0x1e01f268u, 0x6906c2feu, 0xf762575du, 0x806567cbu, + 0x196c3671u, 0x6e6b06e7u, 0xfed41b76u, 0x89d32be0u, 0x10da7a5au, + 0x67dd4accu, 0xf9b9df6fu, 0x8ebeeff9u, 0x17b7be43u, 0x60b08ed5u, + 0xd6d6a3e8u, 0xa1d1937eu, 0x38d8c2c4u, 0x4fdff252u, 0xd1bb67f1u, + 0xa6bc5767u, 0x3fb506ddu, 0x48b2364bu, 0xd80d2bdau, 0xaf0a1b4cu, + 0x36034af6u, 0x41047a60u, 0xdf60efc3u, 0xa867df55u, 0x316e8eefu, + 0x4669be79u, 0xcb61b38cu, 0xbc66831au, 0x256fd2a0u, 0x5268e236u, + 0xcc0c7795u, 0xbb0b4703u, 0x220216b9u, 0x5505262fu, 0xc5ba3bbeu, + 0xb2bd0b28u, 0x2bb45a92u, 0x5cb36a04u, 0xc2d7ffa7u, 0xb5d0cf31u, + 0x2cd99e8bu, 0x5bdeae1du, 0x9b64c2b0u, 0xec63f226u, 0x756aa39cu, + 0x026d930au, 0x9c0906a9u, 0xeb0e363fu, 0x72076785u, 0x05005713u, + 0x95bf4a82u, 0xe2b87a14u, 0x7bb12baeu, 0x0cb61b38u, 0x92d28e9bu, + 0xe5d5be0du, 0x7cdcefb7u, 0x0bdbdf21u, 0x86d3d2d4u, 0xf1d4e242u, + 0x68ddb3f8u, 0x1fda836eu, 0x81be16cdu, 0xf6b9265bu, 0x6fb077e1u, + 0x18b74777u, 0x88085ae6u, 0xff0f6a70u, 0x66063bcau, 0x11010b5cu, + 0x8f659effu, 0xf862ae69u, 0x616bffd3u, 0x166ccf45u, 0xa00ae278u, + 0xd70dd2eeu, 0x4e048354u, 0x3903b3c2u, 0xa7672661u, 0xd06016f7u, + 0x4969474du, 0x3e6e77dbu, 0xaed16a4au, 0xd9d65adcu, 0x40df0b66u, + 0x37d83bf0u, 0xa9bcae53u, 0xdebb9ec5u, 0x47b2cf7fu, 0x30b5ffe9u, + 0xbdbdf21cu, 0xcabac28au, 0x53b39330u, 0x24b4a3a6u, 0xbad03605u, + 0xcdd70693u, 0x54de5729u, 0x23d967bfu, 0xb3667a2eu, 0xc4614ab8u, + 0x5d681b02u, 0x2a6f2b94u, 0xb40bbe37u, 0xc30c8ea1u, 0x5a05df1bu, + 0x2d02ef8du + }; + private static readonly uint[] s_crcTable_1 = new uint[256] { + 0x00000000u, 0x191B3141u, 0x32366282u, 0x2B2D53C3u, 0x646CC504u, + 0x7D77F445u, 0x565AA786u, 0x4F4196C7u, 0xC8D98A08u, 0xD1C2BB49u, + 0xFAEFE88Au, 0xE3F4D9CBu, 0xACB54F0Cu, 0xB5AE7E4Du, 0x9E832D8Eu, + 0x87981CCFu, 0x4AC21251u, 0x53D92310u, 0x78F470D3u, 0x61EF4192u, + 0x2EAED755u, 0x37B5E614u, 0x1C98B5D7u, 0x05838496u, 0x821B9859u, + 0x9B00A918u, 0xB02DFADBu, 0xA936CB9Au, 0xE6775D5Du, 0xFF6C6C1Cu, + 0xD4413FDFu, 0xCD5A0E9Eu, 0x958424A2u, 0x8C9F15E3u, 0xA7B24620u, + 0xBEA97761u, 0xF1E8E1A6u, 0xE8F3D0E7u, 0xC3DE8324u, 0xDAC5B265u, + 0x5D5DAEAAu, 0x44469FEBu, 0x6F6BCC28u, 0x7670FD69u, 0x39316BAEu, + 0x202A5AEFu, 0x0B07092Cu, 0x121C386Du, 0xDF4636F3u, 0xC65D07B2u, + 0xED705471u, 0xF46B6530u, 0xBB2AF3F7u, 0xA231C2B6u, 0x891C9175u, + 0x9007A034u, 0x179FBCFBu, 0x0E848DBAu, 0x25A9DE79u, 0x3CB2EF38u, + 0x73F379FFu, 0x6AE848BEu, 0x41C51B7Du, 0x58DE2A3Cu, 0xF0794F05u, + 0xE9627E44u, 0xC24F2D87u, 0xDB541CC6u, 0x94158A01u, 0x8D0EBB40u, + 0xA623E883u, 0xBF38D9C2u, 0x38A0C50Du, 0x21BBF44Cu, 0x0A96A78Fu, + 0x138D96CEu, 0x5CCC0009u, 0x45D73148u, 0x6EFA628Bu, 0x77E153CAu, + 0xBABB5D54u, 0xA3A06C15u, 0x888D3FD6u, 0x91960E97u, 0xDED79850u, + 0xC7CCA911u, 0xECE1FAD2u, 0xF5FACB93u, 0x7262D75Cu, 0x6B79E61Du, + 0x4054B5DEu, 0x594F849Fu, 0x160E1258u, 0x0F152319u, 0x243870DAu, + 0x3D23419Bu, 0x65FD6BA7u, 0x7CE65AE6u, 0x57CB0925u, 0x4ED03864u, + 0x0191AEA3u, 0x188A9FE2u, 0x33A7CC21u, 0x2ABCFD60u, 0xAD24E1AFu, + 0xB43FD0EEu, 0x9F12832Du, 0x8609B26Cu, 0xC94824ABu, 0xD05315EAu, + 0xFB7E4629u, 0xE2657768u, 0x2F3F79F6u, 0x362448B7u, 0x1D091B74u, + 0x04122A35u, 0x4B53BCF2u, 0x52488DB3u, 0x7965DE70u, 0x607EEF31u, + 0xE7E6F3FEu, 0xFEFDC2BFu, 0xD5D0917Cu, 0xCCCBA03Du, 0x838A36FAu, + 0x9A9107BBu, 0xB1BC5478u, 0xA8A76539u, 0x3B83984Bu, 0x2298A90Au, + 0x09B5FAC9u, 0x10AECB88u, 0x5FEF5D4Fu, 0x46F46C0Eu, 0x6DD93FCDu, + 0x74C20E8Cu, 0xF35A1243u, 0xEA412302u, 0xC16C70C1u, 0xD8774180u, + 0x9736D747u, 0x8E2DE606u, 0xA500B5C5u, 0xBC1B8484u, 0x71418A1Au, + 0x685ABB5Bu, 0x4377E898u, 0x5A6CD9D9u, 0x152D4F1Eu, 0x0C367E5Fu, + 0x271B2D9Cu, 0x3E001CDDu, 0xB9980012u, 0xA0833153u, 0x8BAE6290u, + 0x92B553D1u, 0xDDF4C516u, 0xC4EFF457u, 0xEFC2A794u, 0xF6D996D5u, + 0xAE07BCE9u, 0xB71C8DA8u, 0x9C31DE6Bu, 0x852AEF2Au, 0xCA6B79EDu, + 0xD37048ACu, 0xF85D1B6Fu, 0xE1462A2Eu, 0x66DE36E1u, 0x7FC507A0u, + 0x54E85463u, 0x4DF36522u, 0x02B2F3E5u, 0x1BA9C2A4u, 0x30849167u, + 0x299FA026u, 0xE4C5AEB8u, 0xFDDE9FF9u, 0xD6F3CC3Au, 0xCFE8FD7Bu, + 0x80A96BBCu, 0x99B25AFDu, 0xB29F093Eu, 0xAB84387Fu, 0x2C1C24B0u, + 0x350715F1u, 0x1E2A4632u, 0x07317773u, 0x4870E1B4u, 0x516BD0F5u, + 0x7A468336u, 0x635DB277u, 0xCBFAD74Eu, 0xD2E1E60Fu, 0xF9CCB5CCu, + 0xE0D7848Du, 0xAF96124Au, 0xB68D230Bu, 0x9DA070C8u, 0x84BB4189u, + 0x03235D46u, 0x1A386C07u, 0x31153FC4u, 0x280E0E85u, 0x674F9842u, + 0x7E54A903u, 0x5579FAC0u, 0x4C62CB81u, 0x8138C51Fu, 0x9823F45Eu, + 0xB30EA79Du, 0xAA1596DCu, 0xE554001Bu, 0xFC4F315Au, 0xD7626299u, + 0xCE7953D8u, 0x49E14F17u, 0x50FA7E56u, 0x7BD72D95u, 0x62CC1CD4u, + 0x2D8D8A13u, 0x3496BB52u, 0x1FBBE891u, 0x06A0D9D0u, 0x5E7EF3ECu, + 0x4765C2ADu, 0x6C48916Eu, 0x7553A02Fu, 0x3A1236E8u, 0x230907A9u, + 0x0824546Au, 0x113F652Bu, 0x96A779E4u, 0x8FBC48A5u, 0xA4911B66u, + 0xBD8A2A27u, 0xF2CBBCE0u, 0xEBD08DA1u, 0xC0FDDE62u, 0xD9E6EF23u, + 0x14BCE1BDu, 0x0DA7D0FCu, 0x268A833Fu, 0x3F91B27Eu, 0x70D024B9u, + 0x69CB15F8u, 0x42E6463Bu, 0x5BFD777Au, 0xDC656BB5u, 0xC57E5AF4u, + 0xEE530937u, 0xF7483876u, 0xB809AEB1u, 0xA1129FF0u, 0x8A3FCC33u, + 0x9324FD72u + }; + private static readonly uint[] s_crcTable_2 = new uint[256] { + 0x00000000u, 0x01C26A37u, 0x0384D46Eu, 0x0246BE59u, 0x0709A8DCu, + 0x06CBC2EBu, 0x048D7CB2u, 0x054F1685u, 0x0E1351B8u, 0x0FD13B8Fu, + 0x0D9785D6u, 0x0C55EFE1u, 0x091AF964u, 0x08D89353u, 0x0A9E2D0Au, + 0x0B5C473Du, 0x1C26A370u, 0x1DE4C947u, 0x1FA2771Eu, 0x1E601D29u, + 0x1B2F0BACu, 0x1AED619Bu, 0x18ABDFC2u, 0x1969B5F5u, 0x1235F2C8u, + 0x13F798FFu, 0x11B126A6u, 0x10734C91u, 0x153C5A14u, 0x14FE3023u, + 0x16B88E7Au, 0x177AE44Du, 0x384D46E0u, 0x398F2CD7u, 0x3BC9928Eu, + 0x3A0BF8B9u, 0x3F44EE3Cu, 0x3E86840Bu, 0x3CC03A52u, 0x3D025065u, + 0x365E1758u, 0x379C7D6Fu, 0x35DAC336u, 0x3418A901u, 0x3157BF84u, + 0x3095D5B3u, 0x32D36BEAu, 0x331101DDu, 0x246BE590u, 0x25A98FA7u, + 0x27EF31FEu, 0x262D5BC9u, 0x23624D4Cu, 0x22A0277Bu, 0x20E69922u, + 0x2124F315u, 0x2A78B428u, 0x2BBADE1Fu, 0x29FC6046u, 0x283E0A71u, + 0x2D711CF4u, 0x2CB376C3u, 0x2EF5C89Au, 0x2F37A2ADu, 0x709A8DC0u, + 0x7158E7F7u, 0x731E59AEu, 0x72DC3399u, 0x7793251Cu, 0x76514F2Bu, + 0x7417F172u, 0x75D59B45u, 0x7E89DC78u, 0x7F4BB64Fu, 0x7D0D0816u, + 0x7CCF6221u, 0x798074A4u, 0x78421E93u, 0x7A04A0CAu, 0x7BC6CAFDu, + 0x6CBC2EB0u, 0x6D7E4487u, 0x6F38FADEu, 0x6EFA90E9u, 0x6BB5866Cu, + 0x6A77EC5Bu, 0x68315202u, 0x69F33835u, 0x62AF7F08u, 0x636D153Fu, + 0x612BAB66u, 0x60E9C151u, 0x65A6D7D4u, 0x6464BDE3u, 0x662203BAu, + 0x67E0698Du, 0x48D7CB20u, 0x4915A117u, 0x4B531F4Eu, 0x4A917579u, + 0x4FDE63FCu, 0x4E1C09CBu, 0x4C5AB792u, 0x4D98DDA5u, 0x46C49A98u, + 0x4706F0AFu, 0x45404EF6u, 0x448224C1u, 0x41CD3244u, 0x400F5873u, + 0x4249E62Au, 0x438B8C1Du, 0x54F16850u, 0x55330267u, 0x5775BC3Eu, + 0x56B7D609u, 0x53F8C08Cu, 0x523AAABBu, 0x507C14E2u, 0x51BE7ED5u, + 0x5AE239E8u, 0x5B2053DFu, 0x5966ED86u, 0x58A487B1u, 0x5DEB9134u, + 0x5C29FB03u, 0x5E6F455Au, 0x5FAD2F6Du, 0xE1351B80u, 0xE0F771B7u, + 0xE2B1CFEEu, 0xE373A5D9u, 0xE63CB35Cu, 0xE7FED96Bu, 0xE5B86732u, + 0xE47A0D05u, 0xEF264A38u, 0xEEE4200Fu, 0xECA29E56u, 0xED60F461u, + 0xE82FE2E4u, 0xE9ED88D3u, 0xEBAB368Au, 0xEA695CBDu, 0xFD13B8F0u, + 0xFCD1D2C7u, 0xFE976C9Eu, 0xFF5506A9u, 0xFA1A102Cu, 0xFBD87A1Bu, + 0xF99EC442u, 0xF85CAE75u, 0xF300E948u, 0xF2C2837Fu, 0xF0843D26u, + 0xF1465711u, 0xF4094194u, 0xF5CB2BA3u, 0xF78D95FAu, 0xF64FFFCDu, + 0xD9785D60u, 0xD8BA3757u, 0xDAFC890Eu, 0xDB3EE339u, 0xDE71F5BCu, + 0xDFB39F8Bu, 0xDDF521D2u, 0xDC374BE5u, 0xD76B0CD8u, 0xD6A966EFu, + 0xD4EFD8B6u, 0xD52DB281u, 0xD062A404u, 0xD1A0CE33u, 0xD3E6706Au, + 0xD2241A5Du, 0xC55EFE10u, 0xC49C9427u, 0xC6DA2A7Eu, 0xC7184049u, + 0xC25756CCu, 0xC3953CFBu, 0xC1D382A2u, 0xC011E895u, 0xCB4DAFA8u, + 0xCA8FC59Fu, 0xC8C97BC6u, 0xC90B11F1u, 0xCC440774u, 0xCD866D43u, + 0xCFC0D31Au, 0xCE02B92Du, 0x91AF9640u, 0x906DFC77u, 0x922B422Eu, + 0x93E92819u, 0x96A63E9Cu, 0x976454ABu, 0x9522EAF2u, 0x94E080C5u, + 0x9FBCC7F8u, 0x9E7EADCFu, 0x9C381396u, 0x9DFA79A1u, 0x98B56F24u, + 0x99770513u, 0x9B31BB4Au, 0x9AF3D17Du, 0x8D893530u, 0x8C4B5F07u, + 0x8E0DE15Eu, 0x8FCF8B69u, 0x8A809DECu, 0x8B42F7DBu, 0x89044982u, + 0x88C623B5u, 0x839A6488u, 0x82580EBFu, 0x801EB0E6u, 0x81DCDAD1u, + 0x8493CC54u, 0x8551A663u, 0x8717183Au, 0x86D5720Du, 0xA9E2D0A0u, + 0xA820BA97u, 0xAA6604CEu, 0xABA46EF9u, 0xAEEB787Cu, 0xAF29124Bu, + 0xAD6FAC12u, 0xACADC625u, 0xA7F18118u, 0xA633EB2Fu, 0xA4755576u, + 0xA5B73F41u, 0xA0F829C4u, 0xA13A43F3u, 0xA37CFDAAu, 0xA2BE979Du, + 0xB5C473D0u, 0xB40619E7u, 0xB640A7BEu, 0xB782CD89u, 0xB2CDDB0Cu, + 0xB30FB13Bu, 0xB1490F62u, 0xB08B6555u, 0xBBD72268u, 0xBA15485Fu, + 0xB853F606u, 0xB9919C31u, 0xBCDE8AB4u, 0xBD1CE083u, 0xBF5A5EDAu, + 0xBE9834EDu + }; + private static readonly uint[] s_crcTable_3 = new uint[256] { + 0x00000000u, 0xB8BC6765u, 0xAA09C88Bu, 0x12B5AFEEu, 0x8F629757u, + 0x37DEF032u, 0x256B5FDCu, 0x9DD738B9u, 0xC5B428EFu, 0x7D084F8Au, + 0x6FBDE064u, 0xD7018701u, 0x4AD6BFB8u, 0xF26AD8DDu, 0xE0DF7733u, + 0x58631056u, 0x5019579Fu, 0xE8A530FAu, 0xFA109F14u, 0x42ACF871u, + 0xDF7BC0C8u, 0x67C7A7ADu, 0x75720843u, 0xCDCE6F26u, 0x95AD7F70u, + 0x2D111815u, 0x3FA4B7FBu, 0x8718D09Eu, 0x1ACFE827u, 0xA2738F42u, + 0xB0C620ACu, 0x087A47C9u, 0xA032AF3Eu, 0x188EC85Bu, 0x0A3B67B5u, + 0xB28700D0u, 0x2F503869u, 0x97EC5F0Cu, 0x8559F0E2u, 0x3DE59787u, + 0x658687D1u, 0xDD3AE0B4u, 0xCF8F4F5Au, 0x7733283Fu, 0xEAE41086u, + 0x525877E3u, 0x40EDD80Du, 0xF851BF68u, 0xF02BF8A1u, 0x48979FC4u, + 0x5A22302Au, 0xE29E574Fu, 0x7F496FF6u, 0xC7F50893u, 0xD540A77Du, + 0x6DFCC018u, 0x359FD04Eu, 0x8D23B72Bu, 0x9F9618C5u, 0x272A7FA0u, + 0xBAFD4719u, 0x0241207Cu, 0x10F48F92u, 0xA848E8F7u, 0x9B14583Du, + 0x23A83F58u, 0x311D90B6u, 0x89A1F7D3u, 0x1476CF6Au, 0xACCAA80Fu, + 0xBE7F07E1u, 0x06C36084u, 0x5EA070D2u, 0xE61C17B7u, 0xF4A9B859u, + 0x4C15DF3Cu, 0xD1C2E785u, 0x697E80E0u, 0x7BCB2F0Eu, 0xC377486Bu, + 0xCB0D0FA2u, 0x73B168C7u, 0x6104C729u, 0xD9B8A04Cu, 0x446F98F5u, + 0xFCD3FF90u, 0xEE66507Eu, 0x56DA371Bu, 0x0EB9274Du, 0xB6054028u, + 0xA4B0EFC6u, 0x1C0C88A3u, 0x81DBB01Au, 0x3967D77Fu, 0x2BD27891u, + 0x936E1FF4u, 0x3B26F703u, 0x839A9066u, 0x912F3F88u, 0x299358EDu, + 0xB4446054u, 0x0CF80731u, 0x1E4DA8DFu, 0xA6F1CFBAu, 0xFE92DFECu, + 0x462EB889u, 0x549B1767u, 0xEC277002u, 0x71F048BBu, 0xC94C2FDEu, + 0xDBF98030u, 0x6345E755u, 0x6B3FA09Cu, 0xD383C7F9u, 0xC1366817u, + 0x798A0F72u, 0xE45D37CBu, 0x5CE150AEu, 0x4E54FF40u, 0xF6E89825u, + 0xAE8B8873u, 0x1637EF16u, 0x048240F8u, 0xBC3E279Du, 0x21E91F24u, + 0x99557841u, 0x8BE0D7AFu, 0x335CB0CAu, 0xED59B63Bu, 0x55E5D15Eu, + 0x47507EB0u, 0xFFEC19D5u, 0x623B216Cu, 0xDA874609u, 0xC832E9E7u, + 0x708E8E82u, 0x28ED9ED4u, 0x9051F9B1u, 0x82E4565Fu, 0x3A58313Au, + 0xA78F0983u, 0x1F336EE6u, 0x0D86C108u, 0xB53AA66Du, 0xBD40E1A4u, + 0x05FC86C1u, 0x1749292Fu, 0xAFF54E4Au, 0x322276F3u, 0x8A9E1196u, + 0x982BBE78u, 0x2097D91Du, 0x78F4C94Bu, 0xC048AE2Eu, 0xD2FD01C0u, + 0x6A4166A5u, 0xF7965E1Cu, 0x4F2A3979u, 0x5D9F9697u, 0xE523F1F2u, + 0x4D6B1905u, 0xF5D77E60u, 0xE762D18Eu, 0x5FDEB6EBu, 0xC2098E52u, + 0x7AB5E937u, 0x680046D9u, 0xD0BC21BCu, 0x88DF31EAu, 0x3063568Fu, + 0x22D6F961u, 0x9A6A9E04u, 0x07BDA6BDu, 0xBF01C1D8u, 0xADB46E36u, + 0x15080953u, 0x1D724E9Au, 0xA5CE29FFu, 0xB77B8611u, 0x0FC7E174u, + 0x9210D9CDu, 0x2AACBEA8u, 0x38191146u, 0x80A57623u, 0xD8C66675u, + 0x607A0110u, 0x72CFAEFEu, 0xCA73C99Bu, 0x57A4F122u, 0xEF189647u, + 0xFDAD39A9u, 0x45115ECCu, 0x764DEE06u, 0xCEF18963u, 0xDC44268Du, + 0x64F841E8u, 0xF92F7951u, 0x41931E34u, 0x5326B1DAu, 0xEB9AD6BFu, + 0xB3F9C6E9u, 0x0B45A18Cu, 0x19F00E62u, 0xA14C6907u, 0x3C9B51BEu, + 0x842736DBu, 0x96929935u, 0x2E2EFE50u, 0x2654B999u, 0x9EE8DEFCu, + 0x8C5D7112u, 0x34E11677u, 0xA9362ECEu, 0x118A49ABu, 0x033FE645u, + 0xBB838120u, 0xE3E09176u, 0x5B5CF613u, 0x49E959FDu, 0xF1553E98u, + 0x6C820621u, 0xD43E6144u, 0xC68BCEAAu, 0x7E37A9CFu, 0xD67F4138u, + 0x6EC3265Du, 0x7C7689B3u, 0xC4CAEED6u, 0x591DD66Fu, 0xE1A1B10Au, + 0xF3141EE4u, 0x4BA87981u, 0x13CB69D7u, 0xAB770EB2u, 0xB9C2A15Cu, + 0x017EC639u, 0x9CA9FE80u, 0x241599E5u, 0x36A0360Bu, 0x8E1C516Eu, + 0x866616A7u, 0x3EDA71C2u, 0x2C6FDE2Cu, 0x94D3B949u, 0x090481F0u, + 0xB1B8E695u, 0xA30D497Bu, 0x1BB12E1Eu, 0x43D23E48u, 0xFB6E592Du, + 0xE9DBF6C3u, 0x516791A6u, 0xCCB0A91Fu, 0x740CCE7Au, 0x66B96194u, + 0xDE0506F1u + }; + private static readonly uint[] s_crcTable_4 = new uint[256] { + 0x00000000u, 0x3D6029B0u, 0x7AC05360u, 0x47A07AD0u, 0xF580A6C0u, + 0xC8E08F70u, 0x8F40F5A0u, 0xB220DC10u, 0x30704BC1u, 0x0D106271u, + 0x4AB018A1u, 0x77D03111u, 0xC5F0ED01u, 0xF890C4B1u, 0xBF30BE61u, + 0x825097D1u, 0x60E09782u, 0x5D80BE32u, 0x1A20C4E2u, 0x2740ED52u, + 0x95603142u, 0xA80018F2u, 0xEFA06222u, 0xD2C04B92u, 0x5090DC43u, + 0x6DF0F5F3u, 0x2A508F23u, 0x1730A693u, 0xA5107A83u, 0x98705333u, + 0xDFD029E3u, 0xE2B00053u, 0xC1C12F04u, 0xFCA106B4u, 0xBB017C64u, + 0x866155D4u, 0x344189C4u, 0x0921A074u, 0x4E81DAA4u, 0x73E1F314u, + 0xF1B164C5u, 0xCCD14D75u, 0x8B7137A5u, 0xB6111E15u, 0x0431C205u, + 0x3951EBB5u, 0x7EF19165u, 0x4391B8D5u, 0xA121B886u, 0x9C419136u, + 0xDBE1EBE6u, 0xE681C256u, 0x54A11E46u, 0x69C137F6u, 0x2E614D26u, + 0x13016496u, 0x9151F347u, 0xAC31DAF7u, 0xEB91A027u, 0xD6F18997u, + 0x64D15587u, 0x59B17C37u, 0x1E1106E7u, 0x23712F57u, 0x58F35849u, + 0x659371F9u, 0x22330B29u, 0x1F532299u, 0xAD73FE89u, 0x9013D739u, + 0xD7B3ADE9u, 0xEAD38459u, 0x68831388u, 0x55E33A38u, 0x124340E8u, + 0x2F236958u, 0x9D03B548u, 0xA0639CF8u, 0xE7C3E628u, 0xDAA3CF98u, + 0x3813CFCBu, 0x0573E67Bu, 0x42D39CABu, 0x7FB3B51Bu, 0xCD93690Bu, + 0xF0F340BBu, 0xB7533A6Bu, 0x8A3313DBu, 0x0863840Au, 0x3503ADBAu, + 0x72A3D76Au, 0x4FC3FEDAu, 0xFDE322CAu, 0xC0830B7Au, 0x872371AAu, + 0xBA43581Au, 0x9932774Du, 0xA4525EFDu, 0xE3F2242Du, 0xDE920D9Du, + 0x6CB2D18Du, 0x51D2F83Du, 0x167282EDu, 0x2B12AB5Du, 0xA9423C8Cu, + 0x9422153Cu, 0xD3826FECu, 0xEEE2465Cu, 0x5CC29A4Cu, 0x61A2B3FCu, + 0x2602C92Cu, 0x1B62E09Cu, 0xF9D2E0CFu, 0xC4B2C97Fu, 0x8312B3AFu, + 0xBE729A1Fu, 0x0C52460Fu, 0x31326FBFu, 0x7692156Fu, 0x4BF23CDFu, + 0xC9A2AB0Eu, 0xF4C282BEu, 0xB362F86Eu, 0x8E02D1DEu, 0x3C220DCEu, + 0x0142247Eu, 0x46E25EAEu, 0x7B82771Eu, 0xB1E6B092u, 0x8C869922u, + 0xCB26E3F2u, 0xF646CA42u, 0x44661652u, 0x79063FE2u, 0x3EA64532u, + 0x03C66C82u, 0x8196FB53u, 0xBCF6D2E3u, 0xFB56A833u, 0xC6368183u, + 0x74165D93u, 0x49767423u, 0x0ED60EF3u, 0x33B62743u, 0xD1062710u, + 0xEC660EA0u, 0xABC67470u, 0x96A65DC0u, 0x248681D0u, 0x19E6A860u, + 0x5E46D2B0u, 0x6326FB00u, 0xE1766CD1u, 0xDC164561u, 0x9BB63FB1u, + 0xA6D61601u, 0x14F6CA11u, 0x2996E3A1u, 0x6E369971u, 0x5356B0C1u, + 0x70279F96u, 0x4D47B626u, 0x0AE7CCF6u, 0x3787E546u, 0x85A73956u, + 0xB8C710E6u, 0xFF676A36u, 0xC2074386u, 0x4057D457u, 0x7D37FDE7u, + 0x3A978737u, 0x07F7AE87u, 0xB5D77297u, 0x88B75B27u, 0xCF1721F7u, + 0xF2770847u, 0x10C70814u, 0x2DA721A4u, 0x6A075B74u, 0x576772C4u, + 0xE547AED4u, 0xD8278764u, 0x9F87FDB4u, 0xA2E7D404u, 0x20B743D5u, + 0x1DD76A65u, 0x5A7710B5u, 0x67173905u, 0xD537E515u, 0xE857CCA5u, + 0xAFF7B675u, 0x92979FC5u, 0xE915E8DBu, 0xD475C16Bu, 0x93D5BBBBu, + 0xAEB5920Bu, 0x1C954E1Bu, 0x21F567ABu, 0x66551D7Bu, 0x5B3534CBu, + 0xD965A31Au, 0xE4058AAAu, 0xA3A5F07Au, 0x9EC5D9CAu, 0x2CE505DAu, + 0x11852C6Au, 0x562556BAu, 0x6B457F0Au, 0x89F57F59u, 0xB49556E9u, + 0xF3352C39u, 0xCE550589u, 0x7C75D999u, 0x4115F029u, 0x06B58AF9u, + 0x3BD5A349u, 0xB9853498u, 0x84E51D28u, 0xC34567F8u, 0xFE254E48u, + 0x4C059258u, 0x7165BBE8u, 0x36C5C138u, 0x0BA5E888u, 0x28D4C7DFu, + 0x15B4EE6Fu, 0x521494BFu, 0x6F74BD0Fu, 0xDD54611Fu, 0xE03448AFu, + 0xA794327Fu, 0x9AF41BCFu, 0x18A48C1Eu, 0x25C4A5AEu, 0x6264DF7Eu, + 0x5F04F6CEu, 0xED242ADEu, 0xD044036Eu, 0x97E479BEu, 0xAA84500Eu, + 0x4834505Du, 0x755479EDu, 0x32F4033Du, 0x0F942A8Du, 0xBDB4F69Du, + 0x80D4DF2Du, 0xC774A5FDu, 0xFA148C4Du, 0x78441B9Cu, 0x4524322Cu, + 0x028448FCu, 0x3FE4614Cu, 0x8DC4BD5Cu, 0xB0A494ECu, 0xF704EE3Cu, + 0xCA64C78Cu + }; + private static readonly uint[] s_crcTable_5 = new uint[256] { + 0x00000000u, 0xCB5CD3A5u, 0x4DC8A10Bu, 0x869472AEu, 0x9B914216u, + 0x50CD91B3u, 0xD659E31Du, 0x1D0530B8u, 0xEC53826Du, 0x270F51C8u, + 0xA19B2366u, 0x6AC7F0C3u, 0x77C2C07Bu, 0xBC9E13DEu, 0x3A0A6170u, + 0xF156B2D5u, 0x03D6029Bu, 0xC88AD13Eu, 0x4E1EA390u, 0x85427035u, + 0x9847408Du, 0x531B9328u, 0xD58FE186u, 0x1ED33223u, 0xEF8580F6u, + 0x24D95353u, 0xA24D21FDu, 0x6911F258u, 0x7414C2E0u, 0xBF481145u, + 0x39DC63EBu, 0xF280B04Eu, 0x07AC0536u, 0xCCF0D693u, 0x4A64A43Du, + 0x81387798u, 0x9C3D4720u, 0x57619485u, 0xD1F5E62Bu, 0x1AA9358Eu, + 0xEBFF875Bu, 0x20A354FEu, 0xA6372650u, 0x6D6BF5F5u, 0x706EC54Du, + 0xBB3216E8u, 0x3DA66446u, 0xF6FAB7E3u, 0x047A07ADu, 0xCF26D408u, + 0x49B2A6A6u, 0x82EE7503u, 0x9FEB45BBu, 0x54B7961Eu, 0xD223E4B0u, + 0x197F3715u, 0xE82985C0u, 0x23755665u, 0xA5E124CBu, 0x6EBDF76Eu, + 0x73B8C7D6u, 0xB8E41473u, 0x3E7066DDu, 0xF52CB578u, 0x0F580A6Cu, + 0xC404D9C9u, 0x4290AB67u, 0x89CC78C2u, 0x94C9487Au, 0x5F959BDFu, + 0xD901E971u, 0x125D3AD4u, 0xE30B8801u, 0x28575BA4u, 0xAEC3290Au, + 0x659FFAAFu, 0x789ACA17u, 0xB3C619B2u, 0x35526B1Cu, 0xFE0EB8B9u, + 0x0C8E08F7u, 0xC7D2DB52u, 0x4146A9FCu, 0x8A1A7A59u, 0x971F4AE1u, + 0x5C439944u, 0xDAD7EBEAu, 0x118B384Fu, 0xE0DD8A9Au, 0x2B81593Fu, + 0xAD152B91u, 0x6649F834u, 0x7B4CC88Cu, 0xB0101B29u, 0x36846987u, + 0xFDD8BA22u, 0x08F40F5Au, 0xC3A8DCFFu, 0x453CAE51u, 0x8E607DF4u, + 0x93654D4Cu, 0x58399EE9u, 0xDEADEC47u, 0x15F13FE2u, 0xE4A78D37u, + 0x2FFB5E92u, 0xA96F2C3Cu, 0x6233FF99u, 0x7F36CF21u, 0xB46A1C84u, + 0x32FE6E2Au, 0xF9A2BD8Fu, 0x0B220DC1u, 0xC07EDE64u, 0x46EAACCAu, + 0x8DB67F6Fu, 0x90B34FD7u, 0x5BEF9C72u, 0xDD7BEEDCu, 0x16273D79u, + 0xE7718FACu, 0x2C2D5C09u, 0xAAB92EA7u, 0x61E5FD02u, 0x7CE0CDBAu, + 0xB7BC1E1Fu, 0x31286CB1u, 0xFA74BF14u, 0x1EB014D8u, 0xD5ECC77Du, + 0x5378B5D3u, 0x98246676u, 0x852156CEu, 0x4E7D856Bu, 0xC8E9F7C5u, + 0x03B52460u, 0xF2E396B5u, 0x39BF4510u, 0xBF2B37BEu, 0x7477E41Bu, + 0x6972D4A3u, 0xA22E0706u, 0x24BA75A8u, 0xEFE6A60Du, 0x1D661643u, + 0xD63AC5E6u, 0x50AEB748u, 0x9BF264EDu, 0x86F75455u, 0x4DAB87F0u, + 0xCB3FF55Eu, 0x006326FBu, 0xF135942Eu, 0x3A69478Bu, 0xBCFD3525u, + 0x77A1E680u, 0x6AA4D638u, 0xA1F8059Du, 0x276C7733u, 0xEC30A496u, + 0x191C11EEu, 0xD240C24Bu, 0x54D4B0E5u, 0x9F886340u, 0x828D53F8u, + 0x49D1805Du, 0xCF45F2F3u, 0x04192156u, 0xF54F9383u, 0x3E134026u, + 0xB8873288u, 0x73DBE12Du, 0x6EDED195u, 0xA5820230u, 0x2316709Eu, + 0xE84AA33Bu, 0x1ACA1375u, 0xD196C0D0u, 0x5702B27Eu, 0x9C5E61DBu, + 0x815B5163u, 0x4A0782C6u, 0xCC93F068u, 0x07CF23CDu, 0xF6999118u, + 0x3DC542BDu, 0xBB513013u, 0x700DE3B6u, 0x6D08D30Eu, 0xA65400ABu, + 0x20C07205u, 0xEB9CA1A0u, 0x11E81EB4u, 0xDAB4CD11u, 0x5C20BFBFu, + 0x977C6C1Au, 0x8A795CA2u, 0x41258F07u, 0xC7B1FDA9u, 0x0CED2E0Cu, + 0xFDBB9CD9u, 0x36E74F7Cu, 0xB0733DD2u, 0x7B2FEE77u, 0x662ADECFu, + 0xAD760D6Au, 0x2BE27FC4u, 0xE0BEAC61u, 0x123E1C2Fu, 0xD962CF8Au, + 0x5FF6BD24u, 0x94AA6E81u, 0x89AF5E39u, 0x42F38D9Cu, 0xC467FF32u, + 0x0F3B2C97u, 0xFE6D9E42u, 0x35314DE7u, 0xB3A53F49u, 0x78F9ECECu, + 0x65FCDC54u, 0xAEA00FF1u, 0x28347D5Fu, 0xE368AEFAu, 0x16441B82u, + 0xDD18C827u, 0x5B8CBA89u, 0x90D0692Cu, 0x8DD55994u, 0x46898A31u, + 0xC01DF89Fu, 0x0B412B3Au, 0xFA1799EFu, 0x314B4A4Au, 0xB7DF38E4u, + 0x7C83EB41u, 0x6186DBF9u, 0xAADA085Cu, 0x2C4E7AF2u, 0xE712A957u, + 0x15921919u, 0xDECECABCu, 0x585AB812u, 0x93066BB7u, 0x8E035B0Fu, + 0x455F88AAu, 0xC3CBFA04u, 0x089729A1u, 0xF9C19B74u, 0x329D48D1u, + 0xB4093A7Fu, 0x7F55E9DAu, 0x6250D962u, 0xA90C0AC7u, 0x2F987869u, + 0xE4C4ABCCu + }; + private static readonly uint[] s_crcTable_6 = new uint[256] { + 0x00000000u, 0xA6770BB4u, 0x979F1129u, 0x31E81A9Du, 0xF44F2413u, + 0x52382FA7u, 0x63D0353Au, 0xC5A73E8Eu, 0x33EF4E67u, 0x959845D3u, + 0xA4705F4Eu, 0x020754FAu, 0xC7A06A74u, 0x61D761C0u, 0x503F7B5Du, + 0xF64870E9u, 0x67DE9CCEu, 0xC1A9977Au, 0xF0418DE7u, 0x56368653u, + 0x9391B8DDu, 0x35E6B369u, 0x040EA9F4u, 0xA279A240u, 0x5431D2A9u, + 0xF246D91Du, 0xC3AEC380u, 0x65D9C834u, 0xA07EF6BAu, 0x0609FD0Eu, + 0x37E1E793u, 0x9196EC27u, 0xCFBD399Cu, 0x69CA3228u, 0x582228B5u, + 0xFE552301u, 0x3BF21D8Fu, 0x9D85163Bu, 0xAC6D0CA6u, 0x0A1A0712u, + 0xFC5277FBu, 0x5A257C4Fu, 0x6BCD66D2u, 0xCDBA6D66u, 0x081D53E8u, + 0xAE6A585Cu, 0x9F8242C1u, 0x39F54975u, 0xA863A552u, 0x0E14AEE6u, + 0x3FFCB47Bu, 0x998BBFCFu, 0x5C2C8141u, 0xFA5B8AF5u, 0xCBB39068u, + 0x6DC49BDCu, 0x9B8CEB35u, 0x3DFBE081u, 0x0C13FA1Cu, 0xAA64F1A8u, + 0x6FC3CF26u, 0xC9B4C492u, 0xF85CDE0Fu, 0x5E2BD5BBu, 0x440B7579u, + 0xE27C7ECDu, 0xD3946450u, 0x75E36FE4u, 0xB044516Au, 0x16335ADEu, + 0x27DB4043u, 0x81AC4BF7u, 0x77E43B1Eu, 0xD19330AAu, 0xE07B2A37u, + 0x460C2183u, 0x83AB1F0Du, 0x25DC14B9u, 0x14340E24u, 0xB2430590u, + 0x23D5E9B7u, 0x85A2E203u, 0xB44AF89Eu, 0x123DF32Au, 0xD79ACDA4u, + 0x71EDC610u, 0x4005DC8Du, 0xE672D739u, 0x103AA7D0u, 0xB64DAC64u, + 0x87A5B6F9u, 0x21D2BD4Du, 0xE47583C3u, 0x42028877u, 0x73EA92EAu, + 0xD59D995Eu, 0x8BB64CE5u, 0x2DC14751u, 0x1C295DCCu, 0xBA5E5678u, + 0x7FF968F6u, 0xD98E6342u, 0xE86679DFu, 0x4E11726Bu, 0xB8590282u, + 0x1E2E0936u, 0x2FC613ABu, 0x89B1181Fu, 0x4C162691u, 0xEA612D25u, + 0xDB8937B8u, 0x7DFE3C0Cu, 0xEC68D02Bu, 0x4A1FDB9Fu, 0x7BF7C102u, + 0xDD80CAB6u, 0x1827F438u, 0xBE50FF8Cu, 0x8FB8E511u, 0x29CFEEA5u, + 0xDF879E4Cu, 0x79F095F8u, 0x48188F65u, 0xEE6F84D1u, 0x2BC8BA5Fu, + 0x8DBFB1EBu, 0xBC57AB76u, 0x1A20A0C2u, 0x8816EAF2u, 0x2E61E146u, + 0x1F89FBDBu, 0xB9FEF06Fu, 0x7C59CEE1u, 0xDA2EC555u, 0xEBC6DFC8u, + 0x4DB1D47Cu, 0xBBF9A495u, 0x1D8EAF21u, 0x2C66B5BCu, 0x8A11BE08u, + 0x4FB68086u, 0xE9C18B32u, 0xD82991AFu, 0x7E5E9A1Bu, 0xEFC8763Cu, + 0x49BF7D88u, 0x78576715u, 0xDE206CA1u, 0x1B87522Fu, 0xBDF0599Bu, + 0x8C184306u, 0x2A6F48B2u, 0xDC27385Bu, 0x7A5033EFu, 0x4BB82972u, + 0xEDCF22C6u, 0x28681C48u, 0x8E1F17FCu, 0xBFF70D61u, 0x198006D5u, + 0x47ABD36Eu, 0xE1DCD8DAu, 0xD034C247u, 0x7643C9F3u, 0xB3E4F77Du, + 0x1593FCC9u, 0x247BE654u, 0x820CEDE0u, 0x74449D09u, 0xD23396BDu, + 0xE3DB8C20u, 0x45AC8794u, 0x800BB91Au, 0x267CB2AEu, 0x1794A833u, + 0xB1E3A387u, 0x20754FA0u, 0x86024414u, 0xB7EA5E89u, 0x119D553Du, + 0xD43A6BB3u, 0x724D6007u, 0x43A57A9Au, 0xE5D2712Eu, 0x139A01C7u, + 0xB5ED0A73u, 0x840510EEu, 0x22721B5Au, 0xE7D525D4u, 0x41A22E60u, + 0x704A34FDu, 0xD63D3F49u, 0xCC1D9F8Bu, 0x6A6A943Fu, 0x5B828EA2u, + 0xFDF58516u, 0x3852BB98u, 0x9E25B02Cu, 0xAFCDAAB1u, 0x09BAA105u, + 0xFFF2D1ECu, 0x5985DA58u, 0x686DC0C5u, 0xCE1ACB71u, 0x0BBDF5FFu, + 0xADCAFE4Bu, 0x9C22E4D6u, 0x3A55EF62u, 0xABC30345u, 0x0DB408F1u, + 0x3C5C126Cu, 0x9A2B19D8u, 0x5F8C2756u, 0xF9FB2CE2u, 0xC813367Fu, + 0x6E643DCBu, 0x982C4D22u, 0x3E5B4696u, 0x0FB35C0Bu, 0xA9C457BFu, + 0x6C636931u, 0xCA146285u, 0xFBFC7818u, 0x5D8B73ACu, 0x03A0A617u, + 0xA5D7ADA3u, 0x943FB73Eu, 0x3248BC8Au, 0xF7EF8204u, 0x519889B0u, + 0x6070932Du, 0xC6079899u, 0x304FE870u, 0x9638E3C4u, 0xA7D0F959u, + 0x01A7F2EDu, 0xC400CC63u, 0x6277C7D7u, 0x539FDD4Au, 0xF5E8D6FEu, + 0x647E3AD9u, 0xC209316Du, 0xF3E12BF0u, 0x55962044u, 0x90311ECAu, + 0x3646157Eu, 0x07AE0FE3u, 0xA1D90457u, 0x579174BEu, 0xF1E67F0Au, + 0xC00E6597u, 0x66796E23u, 0xA3DE50ADu, 0x05A95B19u, 0x34414184u, + 0x92364A30u + }; + private static readonly uint[] s_crcTable_7 = new uint[256] { + 0x00000000u, 0xCCAA009Eu, 0x4225077Du, 0x8E8F07E3u, 0x844A0EFAu, + 0x48E00E64u, 0xC66F0987u, 0x0AC50919u, 0xD3E51BB5u, 0x1F4F1B2Bu, + 0x91C01CC8u, 0x5D6A1C56u, 0x57AF154Fu, 0x9B0515D1u, 0x158A1232u, + 0xD92012ACu, 0x7CBB312Bu, 0xB01131B5u, 0x3E9E3656u, 0xF23436C8u, + 0xF8F13FD1u, 0x345B3F4Fu, 0xBAD438ACu, 0x767E3832u, 0xAF5E2A9Eu, + 0x63F42A00u, 0xED7B2DE3u, 0x21D12D7Du, 0x2B142464u, 0xE7BE24FAu, + 0x69312319u, 0xA59B2387u, 0xF9766256u, 0x35DC62C8u, 0xBB53652Bu, + 0x77F965B5u, 0x7D3C6CACu, 0xB1966C32u, 0x3F196BD1u, 0xF3B36B4Fu, + 0x2A9379E3u, 0xE639797Du, 0x68B67E9Eu, 0xA41C7E00u, 0xAED97719u, + 0x62737787u, 0xECFC7064u, 0x205670FAu, 0x85CD537Du, 0x496753E3u, + 0xC7E85400u, 0x0B42549Eu, 0x01875D87u, 0xCD2D5D19u, 0x43A25AFAu, + 0x8F085A64u, 0x562848C8u, 0x9A824856u, 0x140D4FB5u, 0xD8A74F2Bu, + 0xD2624632u, 0x1EC846ACu, 0x9047414Fu, 0x5CED41D1u, 0x299DC2EDu, + 0xE537C273u, 0x6BB8C590u, 0xA712C50Eu, 0xADD7CC17u, 0x617DCC89u, + 0xEFF2CB6Au, 0x2358CBF4u, 0xFA78D958u, 0x36D2D9C6u, 0xB85DDE25u, + 0x74F7DEBBu, 0x7E32D7A2u, 0xB298D73Cu, 0x3C17D0DFu, 0xF0BDD041u, + 0x5526F3C6u, 0x998CF358u, 0x1703F4BBu, 0xDBA9F425u, 0xD16CFD3Cu, + 0x1DC6FDA2u, 0x9349FA41u, 0x5FE3FADFu, 0x86C3E873u, 0x4A69E8EDu, + 0xC4E6EF0Eu, 0x084CEF90u, 0x0289E689u, 0xCE23E617u, 0x40ACE1F4u, + 0x8C06E16Au, 0xD0EBA0BBu, 0x1C41A025u, 0x92CEA7C6u, 0x5E64A758u, + 0x54A1AE41u, 0x980BAEDFu, 0x1684A93Cu, 0xDA2EA9A2u, 0x030EBB0Eu, + 0xCFA4BB90u, 0x412BBC73u, 0x8D81BCEDu, 0x8744B5F4u, 0x4BEEB56Au, + 0xC561B289u, 0x09CBB217u, 0xAC509190u, 0x60FA910Eu, 0xEE7596EDu, + 0x22DF9673u, 0x281A9F6Au, 0xE4B09FF4u, 0x6A3F9817u, 0xA6959889u, + 0x7FB58A25u, 0xB31F8ABBu, 0x3D908D58u, 0xF13A8DC6u, 0xFBFF84DFu, + 0x37558441u, 0xB9DA83A2u, 0x7570833Cu, 0x533B85DAu, 0x9F918544u, + 0x111E82A7u, 0xDDB48239u, 0xD7718B20u, 0x1BDB8BBEu, 0x95548C5Du, + 0x59FE8CC3u, 0x80DE9E6Fu, 0x4C749EF1u, 0xC2FB9912u, 0x0E51998Cu, + 0x04949095u, 0xC83E900Bu, 0x46B197E8u, 0x8A1B9776u, 0x2F80B4F1u, + 0xE32AB46Fu, 0x6DA5B38Cu, 0xA10FB312u, 0xABCABA0Bu, 0x6760BA95u, + 0xE9EFBD76u, 0x2545BDE8u, 0xFC65AF44u, 0x30CFAFDAu, 0xBE40A839u, + 0x72EAA8A7u, 0x782FA1BEu, 0xB485A120u, 0x3A0AA6C3u, 0xF6A0A65Du, + 0xAA4DE78Cu, 0x66E7E712u, 0xE868E0F1u, 0x24C2E06Fu, 0x2E07E976u, + 0xE2ADE9E8u, 0x6C22EE0Bu, 0xA088EE95u, 0x79A8FC39u, 0xB502FCA7u, + 0x3B8DFB44u, 0xF727FBDAu, 0xFDE2F2C3u, 0x3148F25Du, 0xBFC7F5BEu, + 0x736DF520u, 0xD6F6D6A7u, 0x1A5CD639u, 0x94D3D1DAu, 0x5879D144u, + 0x52BCD85Du, 0x9E16D8C3u, 0x1099DF20u, 0xDC33DFBEu, 0x0513CD12u, + 0xC9B9CD8Cu, 0x4736CA6Fu, 0x8B9CCAF1u, 0x8159C3E8u, 0x4DF3C376u, + 0xC37CC495u, 0x0FD6C40Bu, 0x7AA64737u, 0xB60C47A9u, 0x3883404Au, + 0xF42940D4u, 0xFEEC49CDu, 0x32464953u, 0xBCC94EB0u, 0x70634E2Eu, + 0xA9435C82u, 0x65E95C1Cu, 0xEB665BFFu, 0x27CC5B61u, 0x2D095278u, + 0xE1A352E6u, 0x6F2C5505u, 0xA386559Bu, 0x061D761Cu, 0xCAB77682u, + 0x44387161u, 0x889271FFu, 0x825778E6u, 0x4EFD7878u, 0xC0727F9Bu, + 0x0CD87F05u, 0xD5F86DA9u, 0x19526D37u, 0x97DD6AD4u, 0x5B776A4Au, + 0x51B26353u, 0x9D1863CDu, 0x1397642Eu, 0xDF3D64B0u, 0x83D02561u, + 0x4F7A25FFu, 0xC1F5221Cu, 0x0D5F2282u, 0x079A2B9Bu, 0xCB302B05u, + 0x45BF2CE6u, 0x89152C78u, 0x50353ED4u, 0x9C9F3E4Au, 0x121039A9u, + 0xDEBA3937u, 0xD47F302Eu, 0x18D530B0u, 0x965A3753u, 0x5AF037CDu, + 0xFF6B144Au, 0x33C114D4u, 0xBD4E1337u, 0x71E413A9u, 0x7B211AB0u, + 0xB78B1A2Eu, 0x39041DCDu, 0xF5AE1D53u, 0x2C8E0FFFu, 0xE0240F61u, + 0x6EAB0882u, 0xA201081Cu, 0xA8C40105u, 0x646E019Bu, 0xEAE10678u, + 0x264B06E6u + }; + } +} diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.ZLib.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.ZLib.cs new file mode 100644 index 0000000000..bbfe6acd6e --- /dev/null +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.ZLib.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.IO.Compression +{ + internal static class Crc32Helper + { + // Calculate CRC based on the old CRC and the new bytes + public static unsafe uint UpdateCrc32(uint crc32, byte[] buffer, int offset, int length) + { + Debug.Assert((buffer != null) && (offset >= 0) && (length >= 0) && (offset <= buffer.Length - length)); + fixed (byte* bufferPtr = buffer) + { + return Interop.zlib.crc32(crc32, bufferPtr, length); + } + } + + public static unsafe uint UpdateCrc32(uint crc32, ReadOnlySpan buffer) + { + fixed (byte* bufferPtr = &buffer.DangerousGetPinnableReference()) + { + return Interop.zlib.crc32(crc32, bufferPtr, buffer.Length); + } + } + } +} diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.cs deleted file mode 100644 index 0e0ca4bcb3..0000000000 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/Crc32Helper.cs +++ /dev/null @@ -1,526 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// File implements Slicing-by-8 CRC Generation, as described in -// "Novel Table Lookup-Based Algorithms for High-Performance CRC Generation" -// IEEE TRANSACTIONS ON COMPUTERS, VOL. 57, NO. 11, NOVEMBER 2008 - -/* - * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved - * - * - * This software program is licensed subject to the BSD License, - * available at http://www.opensource.org/licenses/bsd-license.html. - */ - -using System.Diagnostics; - -namespace System.IO.Compression -{ - /// - /// This class contains a managed Crc32 function as well as an indirection to the Interop.Zlib.Crc32 call. - /// Since Desktop compression uses this file alongside the Open ZipArchive, we cannot remove it - /// without breaking the Desktop build. - /// - /// Note that in CoreFX the ZlibCrc32 function is always called. - /// - internal static class Crc32Helper - { - // Calculate CRC based on the old CRC and the new bytes - // See RFC1952 for details. - public static uint UpdateCrc32(uint crc32, byte[] buffer, int offset, int length) - { - Debug.Assert((buffer != null) && (offset >= 0) && (length >= 0) - && (offset <= buffer.Length - length), "check the caller"); -#if FEATURE_ZLIB - return Interop.zlib.crc32(crc32, buffer, offset, length); -#else - return ManagedCrc32(crc32, buffer, offset, length); -#endif - - } - -#if !FEATURE_ZLIB - - // Generated tables for managed crc calculation. - // Each table n (starting at 0) contains remainders from the long division of - // all possible byte values, shifted by an offset of (n * 4 bits). - // The divisor used is the crc32 standard polynomial 0xEDB88320 - // Please see cited paper for more details. - private static readonly uint[] s_crcTable_0 = new uint[256] { - 0x00000000u, 0x77073096u, 0xee0e612cu, 0x990951bau, 0x076dc419u, - 0x706af48fu, 0xe963a535u, 0x9e6495a3u, 0x0edb8832u, 0x79dcb8a4u, - 0xe0d5e91eu, 0x97d2d988u, 0x09b64c2bu, 0x7eb17cbdu, 0xe7b82d07u, - 0x90bf1d91u, 0x1db71064u, 0x6ab020f2u, 0xf3b97148u, 0x84be41deu, - 0x1adad47du, 0x6ddde4ebu, 0xf4d4b551u, 0x83d385c7u, 0x136c9856u, - 0x646ba8c0u, 0xfd62f97au, 0x8a65c9ecu, 0x14015c4fu, 0x63066cd9u, - 0xfa0f3d63u, 0x8d080df5u, 0x3b6e20c8u, 0x4c69105eu, 0xd56041e4u, - 0xa2677172u, 0x3c03e4d1u, 0x4b04d447u, 0xd20d85fdu, 0xa50ab56bu, - 0x35b5a8fau, 0x42b2986cu, 0xdbbbc9d6u, 0xacbcf940u, 0x32d86ce3u, - 0x45df5c75u, 0xdcd60dcfu, 0xabd13d59u, 0x26d930acu, 0x51de003au, - 0xc8d75180u, 0xbfd06116u, 0x21b4f4b5u, 0x56b3c423u, 0xcfba9599u, - 0xb8bda50fu, 0x2802b89eu, 0x5f058808u, 0xc60cd9b2u, 0xb10be924u, - 0x2f6f7c87u, 0x58684c11u, 0xc1611dabu, 0xb6662d3du, 0x76dc4190u, - 0x01db7106u, 0x98d220bcu, 0xefd5102au, 0x71b18589u, 0x06b6b51fu, - 0x9fbfe4a5u, 0xe8b8d433u, 0x7807c9a2u, 0x0f00f934u, 0x9609a88eu, - 0xe10e9818u, 0x7f6a0dbbu, 0x086d3d2du, 0x91646c97u, 0xe6635c01u, - 0x6b6b51f4u, 0x1c6c6162u, 0x856530d8u, 0xf262004eu, 0x6c0695edu, - 0x1b01a57bu, 0x8208f4c1u, 0xf50fc457u, 0x65b0d9c6u, 0x12b7e950u, - 0x8bbeb8eau, 0xfcb9887cu, 0x62dd1ddfu, 0x15da2d49u, 0x8cd37cf3u, - 0xfbd44c65u, 0x4db26158u, 0x3ab551ceu, 0xa3bc0074u, 0xd4bb30e2u, - 0x4adfa541u, 0x3dd895d7u, 0xa4d1c46du, 0xd3d6f4fbu, 0x4369e96au, - 0x346ed9fcu, 0xad678846u, 0xda60b8d0u, 0x44042d73u, 0x33031de5u, - 0xaa0a4c5fu, 0xdd0d7cc9u, 0x5005713cu, 0x270241aau, 0xbe0b1010u, - 0xc90c2086u, 0x5768b525u, 0x206f85b3u, 0xb966d409u, 0xce61e49fu, - 0x5edef90eu, 0x29d9c998u, 0xb0d09822u, 0xc7d7a8b4u, 0x59b33d17u, - 0x2eb40d81u, 0xb7bd5c3bu, 0xc0ba6cadu, 0xedb88320u, 0x9abfb3b6u, - 0x03b6e20cu, 0x74b1d29au, 0xead54739u, 0x9dd277afu, 0x04db2615u, - 0x73dc1683u, 0xe3630b12u, 0x94643b84u, 0x0d6d6a3eu, 0x7a6a5aa8u, - 0xe40ecf0bu, 0x9309ff9du, 0x0a00ae27u, 0x7d079eb1u, 0xf00f9344u, - 0x8708a3d2u, 0x1e01f268u, 0x6906c2feu, 0xf762575du, 0x806567cbu, - 0x196c3671u, 0x6e6b06e7u, 0xfed41b76u, 0x89d32be0u, 0x10da7a5au, - 0x67dd4accu, 0xf9b9df6fu, 0x8ebeeff9u, 0x17b7be43u, 0x60b08ed5u, - 0xd6d6a3e8u, 0xa1d1937eu, 0x38d8c2c4u, 0x4fdff252u, 0xd1bb67f1u, - 0xa6bc5767u, 0x3fb506ddu, 0x48b2364bu, 0xd80d2bdau, 0xaf0a1b4cu, - 0x36034af6u, 0x41047a60u, 0xdf60efc3u, 0xa867df55u, 0x316e8eefu, - 0x4669be79u, 0xcb61b38cu, 0xbc66831au, 0x256fd2a0u, 0x5268e236u, - 0xcc0c7795u, 0xbb0b4703u, 0x220216b9u, 0x5505262fu, 0xc5ba3bbeu, - 0xb2bd0b28u, 0x2bb45a92u, 0x5cb36a04u, 0xc2d7ffa7u, 0xb5d0cf31u, - 0x2cd99e8bu, 0x5bdeae1du, 0x9b64c2b0u, 0xec63f226u, 0x756aa39cu, - 0x026d930au, 0x9c0906a9u, 0xeb0e363fu, 0x72076785u, 0x05005713u, - 0x95bf4a82u, 0xe2b87a14u, 0x7bb12baeu, 0x0cb61b38u, 0x92d28e9bu, - 0xe5d5be0du, 0x7cdcefb7u, 0x0bdbdf21u, 0x86d3d2d4u, 0xf1d4e242u, - 0x68ddb3f8u, 0x1fda836eu, 0x81be16cdu, 0xf6b9265bu, 0x6fb077e1u, - 0x18b74777u, 0x88085ae6u, 0xff0f6a70u, 0x66063bcau, 0x11010b5cu, - 0x8f659effu, 0xf862ae69u, 0x616bffd3u, 0x166ccf45u, 0xa00ae278u, - 0xd70dd2eeu, 0x4e048354u, 0x3903b3c2u, 0xa7672661u, 0xd06016f7u, - 0x4969474du, 0x3e6e77dbu, 0xaed16a4au, 0xd9d65adcu, 0x40df0b66u, - 0x37d83bf0u, 0xa9bcae53u, 0xdebb9ec5u, 0x47b2cf7fu, 0x30b5ffe9u, - 0xbdbdf21cu, 0xcabac28au, 0x53b39330u, 0x24b4a3a6u, 0xbad03605u, - 0xcdd70693u, 0x54de5729u, 0x23d967bfu, 0xb3667a2eu, 0xc4614ab8u, - 0x5d681b02u, 0x2a6f2b94u, 0xb40bbe37u, 0xc30c8ea1u, 0x5a05df1bu, - 0x2d02ef8du - }; - private static readonly uint[] s_crcTable_1 = new uint[256] { - 0x00000000u, 0x191B3141u, 0x32366282u, 0x2B2D53C3u, 0x646CC504u, - 0x7D77F445u, 0x565AA786u, 0x4F4196C7u, 0xC8D98A08u, 0xD1C2BB49u, - 0xFAEFE88Au, 0xE3F4D9CBu, 0xACB54F0Cu, 0xB5AE7E4Du, 0x9E832D8Eu, - 0x87981CCFu, 0x4AC21251u, 0x53D92310u, 0x78F470D3u, 0x61EF4192u, - 0x2EAED755u, 0x37B5E614u, 0x1C98B5D7u, 0x05838496u, 0x821B9859u, - 0x9B00A918u, 0xB02DFADBu, 0xA936CB9Au, 0xE6775D5Du, 0xFF6C6C1Cu, - 0xD4413FDFu, 0xCD5A0E9Eu, 0x958424A2u, 0x8C9F15E3u, 0xA7B24620u, - 0xBEA97761u, 0xF1E8E1A6u, 0xE8F3D0E7u, 0xC3DE8324u, 0xDAC5B265u, - 0x5D5DAEAAu, 0x44469FEBu, 0x6F6BCC28u, 0x7670FD69u, 0x39316BAEu, - 0x202A5AEFu, 0x0B07092Cu, 0x121C386Du, 0xDF4636F3u, 0xC65D07B2u, - 0xED705471u, 0xF46B6530u, 0xBB2AF3F7u, 0xA231C2B6u, 0x891C9175u, - 0x9007A034u, 0x179FBCFBu, 0x0E848DBAu, 0x25A9DE79u, 0x3CB2EF38u, - 0x73F379FFu, 0x6AE848BEu, 0x41C51B7Du, 0x58DE2A3Cu, 0xF0794F05u, - 0xE9627E44u, 0xC24F2D87u, 0xDB541CC6u, 0x94158A01u, 0x8D0EBB40u, - 0xA623E883u, 0xBF38D9C2u, 0x38A0C50Du, 0x21BBF44Cu, 0x0A96A78Fu, - 0x138D96CEu, 0x5CCC0009u, 0x45D73148u, 0x6EFA628Bu, 0x77E153CAu, - 0xBABB5D54u, 0xA3A06C15u, 0x888D3FD6u, 0x91960E97u, 0xDED79850u, - 0xC7CCA911u, 0xECE1FAD2u, 0xF5FACB93u, 0x7262D75Cu, 0x6B79E61Du, - 0x4054B5DEu, 0x594F849Fu, 0x160E1258u, 0x0F152319u, 0x243870DAu, - 0x3D23419Bu, 0x65FD6BA7u, 0x7CE65AE6u, 0x57CB0925u, 0x4ED03864u, - 0x0191AEA3u, 0x188A9FE2u, 0x33A7CC21u, 0x2ABCFD60u, 0xAD24E1AFu, - 0xB43FD0EEu, 0x9F12832Du, 0x8609B26Cu, 0xC94824ABu, 0xD05315EAu, - 0xFB7E4629u, 0xE2657768u, 0x2F3F79F6u, 0x362448B7u, 0x1D091B74u, - 0x04122A35u, 0x4B53BCF2u, 0x52488DB3u, 0x7965DE70u, 0x607EEF31u, - 0xE7E6F3FEu, 0xFEFDC2BFu, 0xD5D0917Cu, 0xCCCBA03Du, 0x838A36FAu, - 0x9A9107BBu, 0xB1BC5478u, 0xA8A76539u, 0x3B83984Bu, 0x2298A90Au, - 0x09B5FAC9u, 0x10AECB88u, 0x5FEF5D4Fu, 0x46F46C0Eu, 0x6DD93FCDu, - 0x74C20E8Cu, 0xF35A1243u, 0xEA412302u, 0xC16C70C1u, 0xD8774180u, - 0x9736D747u, 0x8E2DE606u, 0xA500B5C5u, 0xBC1B8484u, 0x71418A1Au, - 0x685ABB5Bu, 0x4377E898u, 0x5A6CD9D9u, 0x152D4F1Eu, 0x0C367E5Fu, - 0x271B2D9Cu, 0x3E001CDDu, 0xB9980012u, 0xA0833153u, 0x8BAE6290u, - 0x92B553D1u, 0xDDF4C516u, 0xC4EFF457u, 0xEFC2A794u, 0xF6D996D5u, - 0xAE07BCE9u, 0xB71C8DA8u, 0x9C31DE6Bu, 0x852AEF2Au, 0xCA6B79EDu, - 0xD37048ACu, 0xF85D1B6Fu, 0xE1462A2Eu, 0x66DE36E1u, 0x7FC507A0u, - 0x54E85463u, 0x4DF36522u, 0x02B2F3E5u, 0x1BA9C2A4u, 0x30849167u, - 0x299FA026u, 0xE4C5AEB8u, 0xFDDE9FF9u, 0xD6F3CC3Au, 0xCFE8FD7Bu, - 0x80A96BBCu, 0x99B25AFDu, 0xB29F093Eu, 0xAB84387Fu, 0x2C1C24B0u, - 0x350715F1u, 0x1E2A4632u, 0x07317773u, 0x4870E1B4u, 0x516BD0F5u, - 0x7A468336u, 0x635DB277u, 0xCBFAD74Eu, 0xD2E1E60Fu, 0xF9CCB5CCu, - 0xE0D7848Du, 0xAF96124Au, 0xB68D230Bu, 0x9DA070C8u, 0x84BB4189u, - 0x03235D46u, 0x1A386C07u, 0x31153FC4u, 0x280E0E85u, 0x674F9842u, - 0x7E54A903u, 0x5579FAC0u, 0x4C62CB81u, 0x8138C51Fu, 0x9823F45Eu, - 0xB30EA79Du, 0xAA1596DCu, 0xE554001Bu, 0xFC4F315Au, 0xD7626299u, - 0xCE7953D8u, 0x49E14F17u, 0x50FA7E56u, 0x7BD72D95u, 0x62CC1CD4u, - 0x2D8D8A13u, 0x3496BB52u, 0x1FBBE891u, 0x06A0D9D0u, 0x5E7EF3ECu, - 0x4765C2ADu, 0x6C48916Eu, 0x7553A02Fu, 0x3A1236E8u, 0x230907A9u, - 0x0824546Au, 0x113F652Bu, 0x96A779E4u, 0x8FBC48A5u, 0xA4911B66u, - 0xBD8A2A27u, 0xF2CBBCE0u, 0xEBD08DA1u, 0xC0FDDE62u, 0xD9E6EF23u, - 0x14BCE1BDu, 0x0DA7D0FCu, 0x268A833Fu, 0x3F91B27Eu, 0x70D024B9u, - 0x69CB15F8u, 0x42E6463Bu, 0x5BFD777Au, 0xDC656BB5u, 0xC57E5AF4u, - 0xEE530937u, 0xF7483876u, 0xB809AEB1u, 0xA1129FF0u, 0x8A3FCC33u, - 0x9324FD72u - }; - private static readonly uint[] s_crcTable_2 = new uint[256] { - 0x00000000u, 0x01C26A37u, 0x0384D46Eu, 0x0246BE59u, 0x0709A8DCu, - 0x06CBC2EBu, 0x048D7CB2u, 0x054F1685u, 0x0E1351B8u, 0x0FD13B8Fu, - 0x0D9785D6u, 0x0C55EFE1u, 0x091AF964u, 0x08D89353u, 0x0A9E2D0Au, - 0x0B5C473Du, 0x1C26A370u, 0x1DE4C947u, 0x1FA2771Eu, 0x1E601D29u, - 0x1B2F0BACu, 0x1AED619Bu, 0x18ABDFC2u, 0x1969B5F5u, 0x1235F2C8u, - 0x13F798FFu, 0x11B126A6u, 0x10734C91u, 0x153C5A14u, 0x14FE3023u, - 0x16B88E7Au, 0x177AE44Du, 0x384D46E0u, 0x398F2CD7u, 0x3BC9928Eu, - 0x3A0BF8B9u, 0x3F44EE3Cu, 0x3E86840Bu, 0x3CC03A52u, 0x3D025065u, - 0x365E1758u, 0x379C7D6Fu, 0x35DAC336u, 0x3418A901u, 0x3157BF84u, - 0x3095D5B3u, 0x32D36BEAu, 0x331101DDu, 0x246BE590u, 0x25A98FA7u, - 0x27EF31FEu, 0x262D5BC9u, 0x23624D4Cu, 0x22A0277Bu, 0x20E69922u, - 0x2124F315u, 0x2A78B428u, 0x2BBADE1Fu, 0x29FC6046u, 0x283E0A71u, - 0x2D711CF4u, 0x2CB376C3u, 0x2EF5C89Au, 0x2F37A2ADu, 0x709A8DC0u, - 0x7158E7F7u, 0x731E59AEu, 0x72DC3399u, 0x7793251Cu, 0x76514F2Bu, - 0x7417F172u, 0x75D59B45u, 0x7E89DC78u, 0x7F4BB64Fu, 0x7D0D0816u, - 0x7CCF6221u, 0x798074A4u, 0x78421E93u, 0x7A04A0CAu, 0x7BC6CAFDu, - 0x6CBC2EB0u, 0x6D7E4487u, 0x6F38FADEu, 0x6EFA90E9u, 0x6BB5866Cu, - 0x6A77EC5Bu, 0x68315202u, 0x69F33835u, 0x62AF7F08u, 0x636D153Fu, - 0x612BAB66u, 0x60E9C151u, 0x65A6D7D4u, 0x6464BDE3u, 0x662203BAu, - 0x67E0698Du, 0x48D7CB20u, 0x4915A117u, 0x4B531F4Eu, 0x4A917579u, - 0x4FDE63FCu, 0x4E1C09CBu, 0x4C5AB792u, 0x4D98DDA5u, 0x46C49A98u, - 0x4706F0AFu, 0x45404EF6u, 0x448224C1u, 0x41CD3244u, 0x400F5873u, - 0x4249E62Au, 0x438B8C1Du, 0x54F16850u, 0x55330267u, 0x5775BC3Eu, - 0x56B7D609u, 0x53F8C08Cu, 0x523AAABBu, 0x507C14E2u, 0x51BE7ED5u, - 0x5AE239E8u, 0x5B2053DFu, 0x5966ED86u, 0x58A487B1u, 0x5DEB9134u, - 0x5C29FB03u, 0x5E6F455Au, 0x5FAD2F6Du, 0xE1351B80u, 0xE0F771B7u, - 0xE2B1CFEEu, 0xE373A5D9u, 0xE63CB35Cu, 0xE7FED96Bu, 0xE5B86732u, - 0xE47A0D05u, 0xEF264A38u, 0xEEE4200Fu, 0xECA29E56u, 0xED60F461u, - 0xE82FE2E4u, 0xE9ED88D3u, 0xEBAB368Au, 0xEA695CBDu, 0xFD13B8F0u, - 0xFCD1D2C7u, 0xFE976C9Eu, 0xFF5506A9u, 0xFA1A102Cu, 0xFBD87A1Bu, - 0xF99EC442u, 0xF85CAE75u, 0xF300E948u, 0xF2C2837Fu, 0xF0843D26u, - 0xF1465711u, 0xF4094194u, 0xF5CB2BA3u, 0xF78D95FAu, 0xF64FFFCDu, - 0xD9785D60u, 0xD8BA3757u, 0xDAFC890Eu, 0xDB3EE339u, 0xDE71F5BCu, - 0xDFB39F8Bu, 0xDDF521D2u, 0xDC374BE5u, 0xD76B0CD8u, 0xD6A966EFu, - 0xD4EFD8B6u, 0xD52DB281u, 0xD062A404u, 0xD1A0CE33u, 0xD3E6706Au, - 0xD2241A5Du, 0xC55EFE10u, 0xC49C9427u, 0xC6DA2A7Eu, 0xC7184049u, - 0xC25756CCu, 0xC3953CFBu, 0xC1D382A2u, 0xC011E895u, 0xCB4DAFA8u, - 0xCA8FC59Fu, 0xC8C97BC6u, 0xC90B11F1u, 0xCC440774u, 0xCD866D43u, - 0xCFC0D31Au, 0xCE02B92Du, 0x91AF9640u, 0x906DFC77u, 0x922B422Eu, - 0x93E92819u, 0x96A63E9Cu, 0x976454ABu, 0x9522EAF2u, 0x94E080C5u, - 0x9FBCC7F8u, 0x9E7EADCFu, 0x9C381396u, 0x9DFA79A1u, 0x98B56F24u, - 0x99770513u, 0x9B31BB4Au, 0x9AF3D17Du, 0x8D893530u, 0x8C4B5F07u, - 0x8E0DE15Eu, 0x8FCF8B69u, 0x8A809DECu, 0x8B42F7DBu, 0x89044982u, - 0x88C623B5u, 0x839A6488u, 0x82580EBFu, 0x801EB0E6u, 0x81DCDAD1u, - 0x8493CC54u, 0x8551A663u, 0x8717183Au, 0x86D5720Du, 0xA9E2D0A0u, - 0xA820BA97u, 0xAA6604CEu, 0xABA46EF9u, 0xAEEB787Cu, 0xAF29124Bu, - 0xAD6FAC12u, 0xACADC625u, 0xA7F18118u, 0xA633EB2Fu, 0xA4755576u, - 0xA5B73F41u, 0xA0F829C4u, 0xA13A43F3u, 0xA37CFDAAu, 0xA2BE979Du, - 0xB5C473D0u, 0xB40619E7u, 0xB640A7BEu, 0xB782CD89u, 0xB2CDDB0Cu, - 0xB30FB13Bu, 0xB1490F62u, 0xB08B6555u, 0xBBD72268u, 0xBA15485Fu, - 0xB853F606u, 0xB9919C31u, 0xBCDE8AB4u, 0xBD1CE083u, 0xBF5A5EDAu, - 0xBE9834EDu - }; - private static readonly uint[] s_crcTable_3 = new uint[256] { - 0x00000000u, 0xB8BC6765u, 0xAA09C88Bu, 0x12B5AFEEu, 0x8F629757u, - 0x37DEF032u, 0x256B5FDCu, 0x9DD738B9u, 0xC5B428EFu, 0x7D084F8Au, - 0x6FBDE064u, 0xD7018701u, 0x4AD6BFB8u, 0xF26AD8DDu, 0xE0DF7733u, - 0x58631056u, 0x5019579Fu, 0xE8A530FAu, 0xFA109F14u, 0x42ACF871u, - 0xDF7BC0C8u, 0x67C7A7ADu, 0x75720843u, 0xCDCE6F26u, 0x95AD7F70u, - 0x2D111815u, 0x3FA4B7FBu, 0x8718D09Eu, 0x1ACFE827u, 0xA2738F42u, - 0xB0C620ACu, 0x087A47C9u, 0xA032AF3Eu, 0x188EC85Bu, 0x0A3B67B5u, - 0xB28700D0u, 0x2F503869u, 0x97EC5F0Cu, 0x8559F0E2u, 0x3DE59787u, - 0x658687D1u, 0xDD3AE0B4u, 0xCF8F4F5Au, 0x7733283Fu, 0xEAE41086u, - 0x525877E3u, 0x40EDD80Du, 0xF851BF68u, 0xF02BF8A1u, 0x48979FC4u, - 0x5A22302Au, 0xE29E574Fu, 0x7F496FF6u, 0xC7F50893u, 0xD540A77Du, - 0x6DFCC018u, 0x359FD04Eu, 0x8D23B72Bu, 0x9F9618C5u, 0x272A7FA0u, - 0xBAFD4719u, 0x0241207Cu, 0x10F48F92u, 0xA848E8F7u, 0x9B14583Du, - 0x23A83F58u, 0x311D90B6u, 0x89A1F7D3u, 0x1476CF6Au, 0xACCAA80Fu, - 0xBE7F07E1u, 0x06C36084u, 0x5EA070D2u, 0xE61C17B7u, 0xF4A9B859u, - 0x4C15DF3Cu, 0xD1C2E785u, 0x697E80E0u, 0x7BCB2F0Eu, 0xC377486Bu, - 0xCB0D0FA2u, 0x73B168C7u, 0x6104C729u, 0xD9B8A04Cu, 0x446F98F5u, - 0xFCD3FF90u, 0xEE66507Eu, 0x56DA371Bu, 0x0EB9274Du, 0xB6054028u, - 0xA4B0EFC6u, 0x1C0C88A3u, 0x81DBB01Au, 0x3967D77Fu, 0x2BD27891u, - 0x936E1FF4u, 0x3B26F703u, 0x839A9066u, 0x912F3F88u, 0x299358EDu, - 0xB4446054u, 0x0CF80731u, 0x1E4DA8DFu, 0xA6F1CFBAu, 0xFE92DFECu, - 0x462EB889u, 0x549B1767u, 0xEC277002u, 0x71F048BBu, 0xC94C2FDEu, - 0xDBF98030u, 0x6345E755u, 0x6B3FA09Cu, 0xD383C7F9u, 0xC1366817u, - 0x798A0F72u, 0xE45D37CBu, 0x5CE150AEu, 0x4E54FF40u, 0xF6E89825u, - 0xAE8B8873u, 0x1637EF16u, 0x048240F8u, 0xBC3E279Du, 0x21E91F24u, - 0x99557841u, 0x8BE0D7AFu, 0x335CB0CAu, 0xED59B63Bu, 0x55E5D15Eu, - 0x47507EB0u, 0xFFEC19D5u, 0x623B216Cu, 0xDA874609u, 0xC832E9E7u, - 0x708E8E82u, 0x28ED9ED4u, 0x9051F9B1u, 0x82E4565Fu, 0x3A58313Au, - 0xA78F0983u, 0x1F336EE6u, 0x0D86C108u, 0xB53AA66Du, 0xBD40E1A4u, - 0x05FC86C1u, 0x1749292Fu, 0xAFF54E4Au, 0x322276F3u, 0x8A9E1196u, - 0x982BBE78u, 0x2097D91Du, 0x78F4C94Bu, 0xC048AE2Eu, 0xD2FD01C0u, - 0x6A4166A5u, 0xF7965E1Cu, 0x4F2A3979u, 0x5D9F9697u, 0xE523F1F2u, - 0x4D6B1905u, 0xF5D77E60u, 0xE762D18Eu, 0x5FDEB6EBu, 0xC2098E52u, - 0x7AB5E937u, 0x680046D9u, 0xD0BC21BCu, 0x88DF31EAu, 0x3063568Fu, - 0x22D6F961u, 0x9A6A9E04u, 0x07BDA6BDu, 0xBF01C1D8u, 0xADB46E36u, - 0x15080953u, 0x1D724E9Au, 0xA5CE29FFu, 0xB77B8611u, 0x0FC7E174u, - 0x9210D9CDu, 0x2AACBEA8u, 0x38191146u, 0x80A57623u, 0xD8C66675u, - 0x607A0110u, 0x72CFAEFEu, 0xCA73C99Bu, 0x57A4F122u, 0xEF189647u, - 0xFDAD39A9u, 0x45115ECCu, 0x764DEE06u, 0xCEF18963u, 0xDC44268Du, - 0x64F841E8u, 0xF92F7951u, 0x41931E34u, 0x5326B1DAu, 0xEB9AD6BFu, - 0xB3F9C6E9u, 0x0B45A18Cu, 0x19F00E62u, 0xA14C6907u, 0x3C9B51BEu, - 0x842736DBu, 0x96929935u, 0x2E2EFE50u, 0x2654B999u, 0x9EE8DEFCu, - 0x8C5D7112u, 0x34E11677u, 0xA9362ECEu, 0x118A49ABu, 0x033FE645u, - 0xBB838120u, 0xE3E09176u, 0x5B5CF613u, 0x49E959FDu, 0xF1553E98u, - 0x6C820621u, 0xD43E6144u, 0xC68BCEAAu, 0x7E37A9CFu, 0xD67F4138u, - 0x6EC3265Du, 0x7C7689B3u, 0xC4CAEED6u, 0x591DD66Fu, 0xE1A1B10Au, - 0xF3141EE4u, 0x4BA87981u, 0x13CB69D7u, 0xAB770EB2u, 0xB9C2A15Cu, - 0x017EC639u, 0x9CA9FE80u, 0x241599E5u, 0x36A0360Bu, 0x8E1C516Eu, - 0x866616A7u, 0x3EDA71C2u, 0x2C6FDE2Cu, 0x94D3B949u, 0x090481F0u, - 0xB1B8E695u, 0xA30D497Bu, 0x1BB12E1Eu, 0x43D23E48u, 0xFB6E592Du, - 0xE9DBF6C3u, 0x516791A6u, 0xCCB0A91Fu, 0x740CCE7Au, 0x66B96194u, - 0xDE0506F1u - }; - private static readonly uint[] s_crcTable_4 = new uint[256] { - 0x00000000u, 0x3D6029B0u, 0x7AC05360u, 0x47A07AD0u, 0xF580A6C0u, - 0xC8E08F70u, 0x8F40F5A0u, 0xB220DC10u, 0x30704BC1u, 0x0D106271u, - 0x4AB018A1u, 0x77D03111u, 0xC5F0ED01u, 0xF890C4B1u, 0xBF30BE61u, - 0x825097D1u, 0x60E09782u, 0x5D80BE32u, 0x1A20C4E2u, 0x2740ED52u, - 0x95603142u, 0xA80018F2u, 0xEFA06222u, 0xD2C04B92u, 0x5090DC43u, - 0x6DF0F5F3u, 0x2A508F23u, 0x1730A693u, 0xA5107A83u, 0x98705333u, - 0xDFD029E3u, 0xE2B00053u, 0xC1C12F04u, 0xFCA106B4u, 0xBB017C64u, - 0x866155D4u, 0x344189C4u, 0x0921A074u, 0x4E81DAA4u, 0x73E1F314u, - 0xF1B164C5u, 0xCCD14D75u, 0x8B7137A5u, 0xB6111E15u, 0x0431C205u, - 0x3951EBB5u, 0x7EF19165u, 0x4391B8D5u, 0xA121B886u, 0x9C419136u, - 0xDBE1EBE6u, 0xE681C256u, 0x54A11E46u, 0x69C137F6u, 0x2E614D26u, - 0x13016496u, 0x9151F347u, 0xAC31DAF7u, 0xEB91A027u, 0xD6F18997u, - 0x64D15587u, 0x59B17C37u, 0x1E1106E7u, 0x23712F57u, 0x58F35849u, - 0x659371F9u, 0x22330B29u, 0x1F532299u, 0xAD73FE89u, 0x9013D739u, - 0xD7B3ADE9u, 0xEAD38459u, 0x68831388u, 0x55E33A38u, 0x124340E8u, - 0x2F236958u, 0x9D03B548u, 0xA0639CF8u, 0xE7C3E628u, 0xDAA3CF98u, - 0x3813CFCBu, 0x0573E67Bu, 0x42D39CABu, 0x7FB3B51Bu, 0xCD93690Bu, - 0xF0F340BBu, 0xB7533A6Bu, 0x8A3313DBu, 0x0863840Au, 0x3503ADBAu, - 0x72A3D76Au, 0x4FC3FEDAu, 0xFDE322CAu, 0xC0830B7Au, 0x872371AAu, - 0xBA43581Au, 0x9932774Du, 0xA4525EFDu, 0xE3F2242Du, 0xDE920D9Du, - 0x6CB2D18Du, 0x51D2F83Du, 0x167282EDu, 0x2B12AB5Du, 0xA9423C8Cu, - 0x9422153Cu, 0xD3826FECu, 0xEEE2465Cu, 0x5CC29A4Cu, 0x61A2B3FCu, - 0x2602C92Cu, 0x1B62E09Cu, 0xF9D2E0CFu, 0xC4B2C97Fu, 0x8312B3AFu, - 0xBE729A1Fu, 0x0C52460Fu, 0x31326FBFu, 0x7692156Fu, 0x4BF23CDFu, - 0xC9A2AB0Eu, 0xF4C282BEu, 0xB362F86Eu, 0x8E02D1DEu, 0x3C220DCEu, - 0x0142247Eu, 0x46E25EAEu, 0x7B82771Eu, 0xB1E6B092u, 0x8C869922u, - 0xCB26E3F2u, 0xF646CA42u, 0x44661652u, 0x79063FE2u, 0x3EA64532u, - 0x03C66C82u, 0x8196FB53u, 0xBCF6D2E3u, 0xFB56A833u, 0xC6368183u, - 0x74165D93u, 0x49767423u, 0x0ED60EF3u, 0x33B62743u, 0xD1062710u, - 0xEC660EA0u, 0xABC67470u, 0x96A65DC0u, 0x248681D0u, 0x19E6A860u, - 0x5E46D2B0u, 0x6326FB00u, 0xE1766CD1u, 0xDC164561u, 0x9BB63FB1u, - 0xA6D61601u, 0x14F6CA11u, 0x2996E3A1u, 0x6E369971u, 0x5356B0C1u, - 0x70279F96u, 0x4D47B626u, 0x0AE7CCF6u, 0x3787E546u, 0x85A73956u, - 0xB8C710E6u, 0xFF676A36u, 0xC2074386u, 0x4057D457u, 0x7D37FDE7u, - 0x3A978737u, 0x07F7AE87u, 0xB5D77297u, 0x88B75B27u, 0xCF1721F7u, - 0xF2770847u, 0x10C70814u, 0x2DA721A4u, 0x6A075B74u, 0x576772C4u, - 0xE547AED4u, 0xD8278764u, 0x9F87FDB4u, 0xA2E7D404u, 0x20B743D5u, - 0x1DD76A65u, 0x5A7710B5u, 0x67173905u, 0xD537E515u, 0xE857CCA5u, - 0xAFF7B675u, 0x92979FC5u, 0xE915E8DBu, 0xD475C16Bu, 0x93D5BBBBu, - 0xAEB5920Bu, 0x1C954E1Bu, 0x21F567ABu, 0x66551D7Bu, 0x5B3534CBu, - 0xD965A31Au, 0xE4058AAAu, 0xA3A5F07Au, 0x9EC5D9CAu, 0x2CE505DAu, - 0x11852C6Au, 0x562556BAu, 0x6B457F0Au, 0x89F57F59u, 0xB49556E9u, - 0xF3352C39u, 0xCE550589u, 0x7C75D999u, 0x4115F029u, 0x06B58AF9u, - 0x3BD5A349u, 0xB9853498u, 0x84E51D28u, 0xC34567F8u, 0xFE254E48u, - 0x4C059258u, 0x7165BBE8u, 0x36C5C138u, 0x0BA5E888u, 0x28D4C7DFu, - 0x15B4EE6Fu, 0x521494BFu, 0x6F74BD0Fu, 0xDD54611Fu, 0xE03448AFu, - 0xA794327Fu, 0x9AF41BCFu, 0x18A48C1Eu, 0x25C4A5AEu, 0x6264DF7Eu, - 0x5F04F6CEu, 0xED242ADEu, 0xD044036Eu, 0x97E479BEu, 0xAA84500Eu, - 0x4834505Du, 0x755479EDu, 0x32F4033Du, 0x0F942A8Du, 0xBDB4F69Du, - 0x80D4DF2Du, 0xC774A5FDu, 0xFA148C4Du, 0x78441B9Cu, 0x4524322Cu, - 0x028448FCu, 0x3FE4614Cu, 0x8DC4BD5Cu, 0xB0A494ECu, 0xF704EE3Cu, - 0xCA64C78Cu - }; - private static readonly uint[] s_crcTable_5 = new uint[256] { - 0x00000000u, 0xCB5CD3A5u, 0x4DC8A10Bu, 0x869472AEu, 0x9B914216u, - 0x50CD91B3u, 0xD659E31Du, 0x1D0530B8u, 0xEC53826Du, 0x270F51C8u, - 0xA19B2366u, 0x6AC7F0C3u, 0x77C2C07Bu, 0xBC9E13DEu, 0x3A0A6170u, - 0xF156B2D5u, 0x03D6029Bu, 0xC88AD13Eu, 0x4E1EA390u, 0x85427035u, - 0x9847408Du, 0x531B9328u, 0xD58FE186u, 0x1ED33223u, 0xEF8580F6u, - 0x24D95353u, 0xA24D21FDu, 0x6911F258u, 0x7414C2E0u, 0xBF481145u, - 0x39DC63EBu, 0xF280B04Eu, 0x07AC0536u, 0xCCF0D693u, 0x4A64A43Du, - 0x81387798u, 0x9C3D4720u, 0x57619485u, 0xD1F5E62Bu, 0x1AA9358Eu, - 0xEBFF875Bu, 0x20A354FEu, 0xA6372650u, 0x6D6BF5F5u, 0x706EC54Du, - 0xBB3216E8u, 0x3DA66446u, 0xF6FAB7E3u, 0x047A07ADu, 0xCF26D408u, - 0x49B2A6A6u, 0x82EE7503u, 0x9FEB45BBu, 0x54B7961Eu, 0xD223E4B0u, - 0x197F3715u, 0xE82985C0u, 0x23755665u, 0xA5E124CBu, 0x6EBDF76Eu, - 0x73B8C7D6u, 0xB8E41473u, 0x3E7066DDu, 0xF52CB578u, 0x0F580A6Cu, - 0xC404D9C9u, 0x4290AB67u, 0x89CC78C2u, 0x94C9487Au, 0x5F959BDFu, - 0xD901E971u, 0x125D3AD4u, 0xE30B8801u, 0x28575BA4u, 0xAEC3290Au, - 0x659FFAAFu, 0x789ACA17u, 0xB3C619B2u, 0x35526B1Cu, 0xFE0EB8B9u, - 0x0C8E08F7u, 0xC7D2DB52u, 0x4146A9FCu, 0x8A1A7A59u, 0x971F4AE1u, - 0x5C439944u, 0xDAD7EBEAu, 0x118B384Fu, 0xE0DD8A9Au, 0x2B81593Fu, - 0xAD152B91u, 0x6649F834u, 0x7B4CC88Cu, 0xB0101B29u, 0x36846987u, - 0xFDD8BA22u, 0x08F40F5Au, 0xC3A8DCFFu, 0x453CAE51u, 0x8E607DF4u, - 0x93654D4Cu, 0x58399EE9u, 0xDEADEC47u, 0x15F13FE2u, 0xE4A78D37u, - 0x2FFB5E92u, 0xA96F2C3Cu, 0x6233FF99u, 0x7F36CF21u, 0xB46A1C84u, - 0x32FE6E2Au, 0xF9A2BD8Fu, 0x0B220DC1u, 0xC07EDE64u, 0x46EAACCAu, - 0x8DB67F6Fu, 0x90B34FD7u, 0x5BEF9C72u, 0xDD7BEEDCu, 0x16273D79u, - 0xE7718FACu, 0x2C2D5C09u, 0xAAB92EA7u, 0x61E5FD02u, 0x7CE0CDBAu, - 0xB7BC1E1Fu, 0x31286CB1u, 0xFA74BF14u, 0x1EB014D8u, 0xD5ECC77Du, - 0x5378B5D3u, 0x98246676u, 0x852156CEu, 0x4E7D856Bu, 0xC8E9F7C5u, - 0x03B52460u, 0xF2E396B5u, 0x39BF4510u, 0xBF2B37BEu, 0x7477E41Bu, - 0x6972D4A3u, 0xA22E0706u, 0x24BA75A8u, 0xEFE6A60Du, 0x1D661643u, - 0xD63AC5E6u, 0x50AEB748u, 0x9BF264EDu, 0x86F75455u, 0x4DAB87F0u, - 0xCB3FF55Eu, 0x006326FBu, 0xF135942Eu, 0x3A69478Bu, 0xBCFD3525u, - 0x77A1E680u, 0x6AA4D638u, 0xA1F8059Du, 0x276C7733u, 0xEC30A496u, - 0x191C11EEu, 0xD240C24Bu, 0x54D4B0E5u, 0x9F886340u, 0x828D53F8u, - 0x49D1805Du, 0xCF45F2F3u, 0x04192156u, 0xF54F9383u, 0x3E134026u, - 0xB8873288u, 0x73DBE12Du, 0x6EDED195u, 0xA5820230u, 0x2316709Eu, - 0xE84AA33Bu, 0x1ACA1375u, 0xD196C0D0u, 0x5702B27Eu, 0x9C5E61DBu, - 0x815B5163u, 0x4A0782C6u, 0xCC93F068u, 0x07CF23CDu, 0xF6999118u, - 0x3DC542BDu, 0xBB513013u, 0x700DE3B6u, 0x6D08D30Eu, 0xA65400ABu, - 0x20C07205u, 0xEB9CA1A0u, 0x11E81EB4u, 0xDAB4CD11u, 0x5C20BFBFu, - 0x977C6C1Au, 0x8A795CA2u, 0x41258F07u, 0xC7B1FDA9u, 0x0CED2E0Cu, - 0xFDBB9CD9u, 0x36E74F7Cu, 0xB0733DD2u, 0x7B2FEE77u, 0x662ADECFu, - 0xAD760D6Au, 0x2BE27FC4u, 0xE0BEAC61u, 0x123E1C2Fu, 0xD962CF8Au, - 0x5FF6BD24u, 0x94AA6E81u, 0x89AF5E39u, 0x42F38D9Cu, 0xC467FF32u, - 0x0F3B2C97u, 0xFE6D9E42u, 0x35314DE7u, 0xB3A53F49u, 0x78F9ECECu, - 0x65FCDC54u, 0xAEA00FF1u, 0x28347D5Fu, 0xE368AEFAu, 0x16441B82u, - 0xDD18C827u, 0x5B8CBA89u, 0x90D0692Cu, 0x8DD55994u, 0x46898A31u, - 0xC01DF89Fu, 0x0B412B3Au, 0xFA1799EFu, 0x314B4A4Au, 0xB7DF38E4u, - 0x7C83EB41u, 0x6186DBF9u, 0xAADA085Cu, 0x2C4E7AF2u, 0xE712A957u, - 0x15921919u, 0xDECECABCu, 0x585AB812u, 0x93066BB7u, 0x8E035B0Fu, - 0x455F88AAu, 0xC3CBFA04u, 0x089729A1u, 0xF9C19B74u, 0x329D48D1u, - 0xB4093A7Fu, 0x7F55E9DAu, 0x6250D962u, 0xA90C0AC7u, 0x2F987869u, - 0xE4C4ABCCu - }; - private static readonly uint[] s_crcTable_6 = new uint[256] { - 0x00000000u, 0xA6770BB4u, 0x979F1129u, 0x31E81A9Du, 0xF44F2413u, - 0x52382FA7u, 0x63D0353Au, 0xC5A73E8Eu, 0x33EF4E67u, 0x959845D3u, - 0xA4705F4Eu, 0x020754FAu, 0xC7A06A74u, 0x61D761C0u, 0x503F7B5Du, - 0xF64870E9u, 0x67DE9CCEu, 0xC1A9977Au, 0xF0418DE7u, 0x56368653u, - 0x9391B8DDu, 0x35E6B369u, 0x040EA9F4u, 0xA279A240u, 0x5431D2A9u, - 0xF246D91Du, 0xC3AEC380u, 0x65D9C834u, 0xA07EF6BAu, 0x0609FD0Eu, - 0x37E1E793u, 0x9196EC27u, 0xCFBD399Cu, 0x69CA3228u, 0x582228B5u, - 0xFE552301u, 0x3BF21D8Fu, 0x9D85163Bu, 0xAC6D0CA6u, 0x0A1A0712u, - 0xFC5277FBu, 0x5A257C4Fu, 0x6BCD66D2u, 0xCDBA6D66u, 0x081D53E8u, - 0xAE6A585Cu, 0x9F8242C1u, 0x39F54975u, 0xA863A552u, 0x0E14AEE6u, - 0x3FFCB47Bu, 0x998BBFCFu, 0x5C2C8141u, 0xFA5B8AF5u, 0xCBB39068u, - 0x6DC49BDCu, 0x9B8CEB35u, 0x3DFBE081u, 0x0C13FA1Cu, 0xAA64F1A8u, - 0x6FC3CF26u, 0xC9B4C492u, 0xF85CDE0Fu, 0x5E2BD5BBu, 0x440B7579u, - 0xE27C7ECDu, 0xD3946450u, 0x75E36FE4u, 0xB044516Au, 0x16335ADEu, - 0x27DB4043u, 0x81AC4BF7u, 0x77E43B1Eu, 0xD19330AAu, 0xE07B2A37u, - 0x460C2183u, 0x83AB1F0Du, 0x25DC14B9u, 0x14340E24u, 0xB2430590u, - 0x23D5E9B7u, 0x85A2E203u, 0xB44AF89Eu, 0x123DF32Au, 0xD79ACDA4u, - 0x71EDC610u, 0x4005DC8Du, 0xE672D739u, 0x103AA7D0u, 0xB64DAC64u, - 0x87A5B6F9u, 0x21D2BD4Du, 0xE47583C3u, 0x42028877u, 0x73EA92EAu, - 0xD59D995Eu, 0x8BB64CE5u, 0x2DC14751u, 0x1C295DCCu, 0xBA5E5678u, - 0x7FF968F6u, 0xD98E6342u, 0xE86679DFu, 0x4E11726Bu, 0xB8590282u, - 0x1E2E0936u, 0x2FC613ABu, 0x89B1181Fu, 0x4C162691u, 0xEA612D25u, - 0xDB8937B8u, 0x7DFE3C0Cu, 0xEC68D02Bu, 0x4A1FDB9Fu, 0x7BF7C102u, - 0xDD80CAB6u, 0x1827F438u, 0xBE50FF8Cu, 0x8FB8E511u, 0x29CFEEA5u, - 0xDF879E4Cu, 0x79F095F8u, 0x48188F65u, 0xEE6F84D1u, 0x2BC8BA5Fu, - 0x8DBFB1EBu, 0xBC57AB76u, 0x1A20A0C2u, 0x8816EAF2u, 0x2E61E146u, - 0x1F89FBDBu, 0xB9FEF06Fu, 0x7C59CEE1u, 0xDA2EC555u, 0xEBC6DFC8u, - 0x4DB1D47Cu, 0xBBF9A495u, 0x1D8EAF21u, 0x2C66B5BCu, 0x8A11BE08u, - 0x4FB68086u, 0xE9C18B32u, 0xD82991AFu, 0x7E5E9A1Bu, 0xEFC8763Cu, - 0x49BF7D88u, 0x78576715u, 0xDE206CA1u, 0x1B87522Fu, 0xBDF0599Bu, - 0x8C184306u, 0x2A6F48B2u, 0xDC27385Bu, 0x7A5033EFu, 0x4BB82972u, - 0xEDCF22C6u, 0x28681C48u, 0x8E1F17FCu, 0xBFF70D61u, 0x198006D5u, - 0x47ABD36Eu, 0xE1DCD8DAu, 0xD034C247u, 0x7643C9F3u, 0xB3E4F77Du, - 0x1593FCC9u, 0x247BE654u, 0x820CEDE0u, 0x74449D09u, 0xD23396BDu, - 0xE3DB8C20u, 0x45AC8794u, 0x800BB91Au, 0x267CB2AEu, 0x1794A833u, - 0xB1E3A387u, 0x20754FA0u, 0x86024414u, 0xB7EA5E89u, 0x119D553Du, - 0xD43A6BB3u, 0x724D6007u, 0x43A57A9Au, 0xE5D2712Eu, 0x139A01C7u, - 0xB5ED0A73u, 0x840510EEu, 0x22721B5Au, 0xE7D525D4u, 0x41A22E60u, - 0x704A34FDu, 0xD63D3F49u, 0xCC1D9F8Bu, 0x6A6A943Fu, 0x5B828EA2u, - 0xFDF58516u, 0x3852BB98u, 0x9E25B02Cu, 0xAFCDAAB1u, 0x09BAA105u, - 0xFFF2D1ECu, 0x5985DA58u, 0x686DC0C5u, 0xCE1ACB71u, 0x0BBDF5FFu, - 0xADCAFE4Bu, 0x9C22E4D6u, 0x3A55EF62u, 0xABC30345u, 0x0DB408F1u, - 0x3C5C126Cu, 0x9A2B19D8u, 0x5F8C2756u, 0xF9FB2CE2u, 0xC813367Fu, - 0x6E643DCBu, 0x982C4D22u, 0x3E5B4696u, 0x0FB35C0Bu, 0xA9C457BFu, - 0x6C636931u, 0xCA146285u, 0xFBFC7818u, 0x5D8B73ACu, 0x03A0A617u, - 0xA5D7ADA3u, 0x943FB73Eu, 0x3248BC8Au, 0xF7EF8204u, 0x519889B0u, - 0x6070932Du, 0xC6079899u, 0x304FE870u, 0x9638E3C4u, 0xA7D0F959u, - 0x01A7F2EDu, 0xC400CC63u, 0x6277C7D7u, 0x539FDD4Au, 0xF5E8D6FEu, - 0x647E3AD9u, 0xC209316Du, 0xF3E12BF0u, 0x55962044u, 0x90311ECAu, - 0x3646157Eu, 0x07AE0FE3u, 0xA1D90457u, 0x579174BEu, 0xF1E67F0Au, - 0xC00E6597u, 0x66796E23u, 0xA3DE50ADu, 0x05A95B19u, 0x34414184u, - 0x92364A30u - }; - private static readonly uint[] s_crcTable_7 = new uint[256] { - 0x00000000u, 0xCCAA009Eu, 0x4225077Du, 0x8E8F07E3u, 0x844A0EFAu, - 0x48E00E64u, 0xC66F0987u, 0x0AC50919u, 0xD3E51BB5u, 0x1F4F1B2Bu, - 0x91C01CC8u, 0x5D6A1C56u, 0x57AF154Fu, 0x9B0515D1u, 0x158A1232u, - 0xD92012ACu, 0x7CBB312Bu, 0xB01131B5u, 0x3E9E3656u, 0xF23436C8u, - 0xF8F13FD1u, 0x345B3F4Fu, 0xBAD438ACu, 0x767E3832u, 0xAF5E2A9Eu, - 0x63F42A00u, 0xED7B2DE3u, 0x21D12D7Du, 0x2B142464u, 0xE7BE24FAu, - 0x69312319u, 0xA59B2387u, 0xF9766256u, 0x35DC62C8u, 0xBB53652Bu, - 0x77F965B5u, 0x7D3C6CACu, 0xB1966C32u, 0x3F196BD1u, 0xF3B36B4Fu, - 0x2A9379E3u, 0xE639797Du, 0x68B67E9Eu, 0xA41C7E00u, 0xAED97719u, - 0x62737787u, 0xECFC7064u, 0x205670FAu, 0x85CD537Du, 0x496753E3u, - 0xC7E85400u, 0x0B42549Eu, 0x01875D87u, 0xCD2D5D19u, 0x43A25AFAu, - 0x8F085A64u, 0x562848C8u, 0x9A824856u, 0x140D4FB5u, 0xD8A74F2Bu, - 0xD2624632u, 0x1EC846ACu, 0x9047414Fu, 0x5CED41D1u, 0x299DC2EDu, - 0xE537C273u, 0x6BB8C590u, 0xA712C50Eu, 0xADD7CC17u, 0x617DCC89u, - 0xEFF2CB6Au, 0x2358CBF4u, 0xFA78D958u, 0x36D2D9C6u, 0xB85DDE25u, - 0x74F7DEBBu, 0x7E32D7A2u, 0xB298D73Cu, 0x3C17D0DFu, 0xF0BDD041u, - 0x5526F3C6u, 0x998CF358u, 0x1703F4BBu, 0xDBA9F425u, 0xD16CFD3Cu, - 0x1DC6FDA2u, 0x9349FA41u, 0x5FE3FADFu, 0x86C3E873u, 0x4A69E8EDu, - 0xC4E6EF0Eu, 0x084CEF90u, 0x0289E689u, 0xCE23E617u, 0x40ACE1F4u, - 0x8C06E16Au, 0xD0EBA0BBu, 0x1C41A025u, 0x92CEA7C6u, 0x5E64A758u, - 0x54A1AE41u, 0x980BAEDFu, 0x1684A93Cu, 0xDA2EA9A2u, 0x030EBB0Eu, - 0xCFA4BB90u, 0x412BBC73u, 0x8D81BCEDu, 0x8744B5F4u, 0x4BEEB56Au, - 0xC561B289u, 0x09CBB217u, 0xAC509190u, 0x60FA910Eu, 0xEE7596EDu, - 0x22DF9673u, 0x281A9F6Au, 0xE4B09FF4u, 0x6A3F9817u, 0xA6959889u, - 0x7FB58A25u, 0xB31F8ABBu, 0x3D908D58u, 0xF13A8DC6u, 0xFBFF84DFu, - 0x37558441u, 0xB9DA83A2u, 0x7570833Cu, 0x533B85DAu, 0x9F918544u, - 0x111E82A7u, 0xDDB48239u, 0xD7718B20u, 0x1BDB8BBEu, 0x95548C5Du, - 0x59FE8CC3u, 0x80DE9E6Fu, 0x4C749EF1u, 0xC2FB9912u, 0x0E51998Cu, - 0x04949095u, 0xC83E900Bu, 0x46B197E8u, 0x8A1B9776u, 0x2F80B4F1u, - 0xE32AB46Fu, 0x6DA5B38Cu, 0xA10FB312u, 0xABCABA0Bu, 0x6760BA95u, - 0xE9EFBD76u, 0x2545BDE8u, 0xFC65AF44u, 0x30CFAFDAu, 0xBE40A839u, - 0x72EAA8A7u, 0x782FA1BEu, 0xB485A120u, 0x3A0AA6C3u, 0xF6A0A65Du, - 0xAA4DE78Cu, 0x66E7E712u, 0xE868E0F1u, 0x24C2E06Fu, 0x2E07E976u, - 0xE2ADE9E8u, 0x6C22EE0Bu, 0xA088EE95u, 0x79A8FC39u, 0xB502FCA7u, - 0x3B8DFB44u, 0xF727FBDAu, 0xFDE2F2C3u, 0x3148F25Du, 0xBFC7F5BEu, - 0x736DF520u, 0xD6F6D6A7u, 0x1A5CD639u, 0x94D3D1DAu, 0x5879D144u, - 0x52BCD85Du, 0x9E16D8C3u, 0x1099DF20u, 0xDC33DFBEu, 0x0513CD12u, - 0xC9B9CD8Cu, 0x4736CA6Fu, 0x8B9CCAF1u, 0x8159C3E8u, 0x4DF3C376u, - 0xC37CC495u, 0x0FD6C40Bu, 0x7AA64737u, 0xB60C47A9u, 0x3883404Au, - 0xF42940D4u, 0xFEEC49CDu, 0x32464953u, 0xBCC94EB0u, 0x70634E2Eu, - 0xA9435C82u, 0x65E95C1Cu, 0xEB665BFFu, 0x27CC5B61u, 0x2D095278u, - 0xE1A352E6u, 0x6F2C5505u, 0xA386559Bu, 0x061D761Cu, 0xCAB77682u, - 0x44387161u, 0x889271FFu, 0x825778E6u, 0x4EFD7878u, 0xC0727F9Bu, - 0x0CD87F05u, 0xD5F86DA9u, 0x19526D37u, 0x97DD6AD4u, 0x5B776A4Au, - 0x51B26353u, 0x9D1863CDu, 0x1397642Eu, 0xDF3D64B0u, 0x83D02561u, - 0x4F7A25FFu, 0xC1F5221Cu, 0x0D5F2282u, 0x079A2B9Bu, 0xCB302B05u, - 0x45BF2CE6u, 0x89152C78u, 0x50353ED4u, 0x9C9F3E4Au, 0x121039A9u, - 0xDEBA3937u, 0xD47F302Eu, 0x18D530B0u, 0x965A3753u, 0x5AF037CDu, - 0xFF6B144Au, 0x33C114D4u, 0xBD4E1337u, 0x71E413A9u, 0x7B211AB0u, - 0xB78B1A2Eu, 0x39041DCDu, 0xF5AE1D53u, 0x2C8E0FFFu, 0xE0240F61u, - 0x6EAB0882u, 0xA201081Cu, 0xA8C40105u, 0x646E019Bu, 0xEAE10678u, - 0x264B06E6u - }; - - private static uint ManagedCrc32(uint crc32, byte[] buffer, int offset, int length) - { - Debug.Assert(BitConverter.IsLittleEndian, "ManagedCrc32 Expects Little Endian"); - - uint term1, term2, term3 = 0; - - crc32 ^= 0xFFFFFFFFU; - int runningLength = (length / 8) * 8; - int endBytes = length - runningLength; - - for (int i = 0; i < runningLength / 8; i++) - { - crc32 ^= unchecked((uint)(buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24)); - offset += 4; - term1 = s_crcTable_7[crc32 & 0x000000FF] ^ - s_crcTable_6[(crc32 >> 8) & 0x000000FF]; - term2 = crc32 >> 16; - crc32 = term1 ^ - s_crcTable_5[term2 & 0x000000FF] ^ - s_crcTable_4[(term2 >> 8) & 0x000000FF]; - - - term3 = unchecked((uint)(buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24)); - offset += 4; - term1 = s_crcTable_3[term3 & 0x000000FF] ^ - s_crcTable_2[(term3 >> 8) & 0x000000FF]; - term2 = term3 >> 16; - crc32 ^= term1 ^ - s_crcTable_1[term2 & 0x000000FF] ^ - s_crcTable_0[(term2 >> 8) & 0x000000FF]; - } - - for (int i = 0; i < endBytes; i++) - { - crc32 = s_crcTable_0[(crc32 ^ buffer[offset++]) & 0x000000FF] ^ (crc32 >> 8); - } - - crc32 ^= 0xFFFFFFFFU; - return crc32; - } -#endif - } -} diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs index b82eaab37f..3fa6f5d438 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs @@ -26,22 +26,6 @@ namespace System.IO.Compression private bool _wroteHeader; private bool _wroteBytes; - public DeflateManagedStream(Stream stream, CompressionMode mode) : this(stream, mode, leaveOpen: false) - { - } - - // Since a reader is being taken, CompressionMode.Decompress is implied - internal DeflateManagedStream(Stream stream, bool leaveOpen, IFileFormatReader reader) - { - Debug.Assert(reader != null, "The IFileFormatReader passed to the internal DeflateStream constructor must be non-null"); - if (stream == null) - throw new ArgumentNullException(nameof(stream)); - if (!stream.CanRead) - throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream)); - - InitializeInflater(stream, leaveOpen, reader); - } - // A specific constructor to allow decompression of Deflate64 internal DeflateManagedStream(Stream stream, ZipArchiveEntry.CompressionMethodValues method) { @@ -53,41 +37,6 @@ namespace System.IO.Compression InitializeInflater(stream, false, null, method); } - public DeflateManagedStream(Stream stream, CompressionMode mode, bool leaveOpen) - { - if (stream == null) - throw new ArgumentNullException(nameof(stream)); - - switch (mode) - { - case CompressionMode.Decompress: - InitializeInflater(stream, leaveOpen); - break; - - case CompressionMode.Compress: - InitializeDeflater(stream, leaveOpen, CompressionLevel.Optimal); - break; - - default: - throw new ArgumentException(SR.ArgumentOutOfRange_Enum, nameof(mode)); - } - } - - // Implies mode = Compress - public DeflateManagedStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) - { - } - - // Implies mode = Compress - public DeflateManagedStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) - { - if (stream == null) - throw new ArgumentNullException(nameof(stream)); - - InitializeDeflater(stream, leaveOpen, compressionLevel); - } - - /// /// Sets up this DeflateManagedStream to be used for Inflation/Decompression /// @@ -106,23 +55,6 @@ namespace System.IO.Compression _buffer = new byte[DefaultBufferSize]; } - /// - /// Sets up this DeflateManagedStream to be used for Deflation/Compression - /// - internal void InitializeDeflater(Stream stream, bool leaveOpen, CompressionLevel compressionLevel) - { - Debug.Assert(stream != null); - if (!stream.CanWrite) - throw new ArgumentException(SR.NotSupported_UnwritableStream, nameof(stream)); - - _deflater = new DeflaterManaged(); - - _stream = stream; - _mode = CompressionMode.Compress; - _leaveOpen = leaveOpen; - _buffer = new byte[DefaultBufferSize]; - } - internal void SetFileFormatWriter(IFileFormatWriter writer) { if (writer != null) @@ -131,8 +63,6 @@ namespace System.IO.Compression } } - public Stream BaseStream => _stream; - public override bool CanRead { get diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/FileFormats.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/FileFormats.cs index f0b7b37c10..f54ad5d85a 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/FileFormats.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/FileFormats.cs @@ -17,29 +17,5 @@ namespace System.IO.Compression bool ReadFooter(InputBuffer input); void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy); void Validate(); - - /// - /// A reader corresponds to an expected file format and contains methods - /// to read header/footer data from a file of that format. If the Zlib library - /// is instead being used and the file format is supported, we can simply pass - /// a supported WindowSize and let Zlib do the header/footer parsing for us. - /// - /// This Property allows getting of a ZLibWindowSize that can be used in place - /// of manually parsing the raw data stream. - /// - /// - /// For raw data, return -8..-15 - /// For GZip header detection and decoding, return 16..31 - /// For GZip and Zlib header detection and decoding, return 32..47 - /// - /// - /// The windowBits parameter for inflation must be greater than or equal to the - /// windowBits parameter used in deflation. - /// - /// - /// If the incorrect header information is used, zlib inflation will likely throw a - /// Z_DATA_ERROR exception. - /// - int ZLibWindowSize { get; } } } diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs index b9550d50ed..7c896f502b 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs @@ -36,12 +36,12 @@ namespace System.IO.Compression // Extra bits for length code 257 - 285. private static readonly byte[] s_extraLengthBits = - { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,16,56,62 }; + { 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,16 }; // The base length for length code 257 - 285. // The formula to get the real length for a length code is lengthBase[code - 257] + (value stored in extraBits) private static readonly int[] s_lengthBase = - { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,3,0,0 }; + { 3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,3}; // The base distance for distance code 0 - 31 // The real distance for a distance code is distanceBasePosition[code] + (value stored in extraBits) @@ -91,17 +91,6 @@ namespace System.IO.Compression private IFileFormatReader _formatReader; // class to decode header and footer (e.g. gzip) - public InflaterManaged(bool deflate64) - { - _output = new OutputWindow(); - _input = new InputBuffer(); - - _codeList = new byte[HuffmanTree.MaxLiteralTreeElements + HuffmanTree.MaxDistTreeElements]; - _codeLengthTreeCodeLength = new byte[HuffmanTree.NumberOfCodeLengthTreeElements]; - _deflate64 = deflate64; - Reset(); - } - internal InflaterManaged(IFileFormatReader reader, bool deflate64) { _output = new OutputWindow(); @@ -118,13 +107,6 @@ namespace System.IO.Compression Reset(); } - public void SetFileFormatReader(IFileFormatReader reader) - { - _formatReader = reader; - _hasFormatReader = true; - Reset(); - } - private void Reset() { _state = _hasFormatReader ? @@ -139,8 +121,6 @@ namespace System.IO.Compression public int AvailableOutput => _output.AvailableBytes; - public bool NeedsInput() => _input.NeedsInput(); - public int Inflate(byte[] bytes, int offset, int length) { // copy bytes from output to outputbytes if we have available bytes @@ -401,9 +381,10 @@ namespace System.IO.Compression end_of_block_code_seen = false; int freeBytes = _output.FreeBytes; // it is a little bit faster than frequently accessing the property - while (freeBytes > 258) + while (freeBytes > 65536) { - // 258 means we can safely do decoding since maximum repeat length is 258 + // With Deflate64 we can have up to a 64kb length, so we ensure at least that much space is available + // in the OutputWindow to avoid overwriting previous unflushed output data. int symbol; switch (_state) @@ -506,7 +487,7 @@ namespace System.IO.Compression goto case InflaterState.HaveDistCode; case InflaterState.HaveDistCode: - // To avoid a table lookup we note that for distanceCode >= 2, + // To avoid a table lookup we note that for distanceCode > 3, // extra_bits = (distanceCode-2) >> 1 int offset; if (_distanceCode > 3) @@ -524,7 +505,6 @@ namespace System.IO.Compression offset = _distanceCode + 1; } - Debug.Assert(freeBytes >= 258, "following operation is not safe!"); _output.WriteLengthDistance(_length, offset); freeBytes -= _length; _state = InflaterState.DecodeTop; diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/OutputWindow.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/OutputWindow.cs index ad4ad816bf..df3cf010e0 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/OutputWindow.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateManaged/OutputWindow.cs @@ -15,10 +15,13 @@ namespace System.IO.Compression /// internal sealed class OutputWindow { - private const int WindowSize = 65536; - private const int WindowMask = 65535; + // With Deflate64 we can have up to a 65536 length as well as up to a 65538 distance. This means we need a Window that is at + // least 131074 bytes long so we have space to retrieve up to a full 64kb in lookback and place it in our buffer without + // overwriting existing data. OutputWindow requires that the WindowSize be an exponent of 2, so we round up to 2^18. + private const int WindowSize = 262144; + private const int WindowMask = 262143; - private readonly byte[] _window = new byte[WindowSize]; // The window is 2^15 bytes + private readonly byte[] _window = new byte[WindowSize]; // The window is 2^18 bytes private int _end; // this is the position to where we should write next byte private int _bytesUsed; // The number of bytes in the output window which is not consumed. @@ -34,14 +37,14 @@ namespace System.IO.Compression public void WriteLengthDistance(int length, int distance) { Debug.Assert((_bytesUsed + length) <= WindowSize, "No Enough space"); - + // move backwards distance bytes in the output stream, // and copy length bytes from this position to the output stream. _bytesUsed += length; int copyStart = (_end - distance) & WindowMask; // start position for coping. int border = WindowSize - length; - if (copyStart <= border && _end < border) + if (copyStart <= border && _end < border) { if (length <= distance) { diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs index 34cb58f698..9371a98fdd 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs @@ -23,7 +23,7 @@ namespace System.IO.Compression private int _activeAsyncOperation; // 1 == true, 0 == false private bool _wroteBytes; - public DeflateStream(Stream stream, CompressionMode mode): this(stream, mode, leaveOpen: false) + public DeflateStream(Stream stream, CompressionMode mode) : this(stream, mode, leaveOpen: false) { } @@ -232,22 +232,38 @@ namespace System.IO.Compression public override int Read(byte[] array, int offset, int count) { - EnsureDecompressionMode(); ValidateParameters(array, offset, count); + return ReadCore(new Span(array, offset, count)); + } + + public override int Read(Span destination) + { + if (GetType() != typeof(DeflateStream)) + { + // DeflateStream is not sealed, and a derived type may have overridden Read(byte[], int, int) prior + // to this Read(Span) overload being introduced. In that case, this Read(Span) overload + // should use the behavior of Read(byte[],int,int) overload. + return base.Read(destination); + } + else + { + return ReadCore(destination); + } + } + + internal int ReadCore(Span destination) + { + EnsureDecompressionMode(); EnsureNotDisposed(); EnsureBufferInitialized(); - int bytesRead; - int currentOffset = offset; - int remainingCount = count; + int totalRead = 0; while (true) { - bytesRead = _inflater.Inflate(array, currentOffset, remainingCount); - currentOffset += bytesRead; - remainingCount -= bytesRead; - - if (remainingCount == 0) + int bytesRead = _inflater.Inflate(destination.Slice(totalRead)); + totalRead += bytesRead; + if (totalRead == destination.Length) { break; } @@ -274,7 +290,7 @@ namespace System.IO.Compression _inflater.SetInput(_buffer, 0, bytes); } - return count - remainingCount; + return totalRead; } private void ValidateParameters(byte[] array, int offset, int count) @@ -336,58 +352,73 @@ namespace System.IO.Compression public override Task ReadAsync(byte[] array, int offset, int count, CancellationToken cancellationToken) { - // We use this checking order for compat to earlier versions: + ValidateParameters(array, offset, count); + return ReadAsyncMemory(new Memory(array, offset, count), cancellationToken).AsTask(); + } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) + { + if (GetType() != typeof(DeflateStream)) + { + // Ensure that existing streams derived from DeflateStream and that override ReadAsync(byte[],...) + // get their existing behaviors when the newer Memory-based overload is used. + return base.ReadAsync(destination, cancellationToken); + } + else + { + return ReadAsyncMemory(destination, cancellationToken); + } + } + + internal ValueTask ReadAsyncMemory(Memory destination, CancellationToken cancellationToken) + { EnsureDecompressionMode(); EnsureNoActiveAsyncOperation(); - ValidateParameters(array, offset, count); EnsureNotDisposed(); if (cancellationToken.IsCancellationRequested) { - return Task.FromCanceled(cancellationToken); + return new ValueTask(Task.FromCanceled(cancellationToken)); } EnsureBufferInitialized(); - Task readTask = null; + bool cleanup = true; AsyncOperationStarting(); try { // Try to read decompressed data in output buffer - int bytesRead = _inflater.Inflate(array, offset, count); + int bytesRead = _inflater.Inflate(destination.Span); if (bytesRead != 0) { // If decompression output buffer is not empty, return immediately. - return Task.FromResult(bytesRead); + return new ValueTask(bytesRead); } if (_inflater.Finished()) { // end of compression stream - return Task.FromResult(0); + return new ValueTask(0); } // If there is no data on the output buffer and we are not at // the end of the stream, we need to get more data from the base stream - readTask = _stream.ReadAsync(_buffer, 0, _buffer.Length, cancellationToken); - if (readTask == null) - { - throw new InvalidOperationException(SR.NotSupported_UnreadableStream); - } - - return ReadAsyncCore(readTask, array, offset, count, cancellationToken); + ValueTask readTask = _stream.ReadAsync(_buffer, cancellationToken); + cleanup = false; + return FinishReadAsyncMemory(readTask, destination, cancellationToken); } finally { // if we haven't started any async work, decrement the counter to end the transaction - if (readTask == null) + if (cleanup) { AsyncOperationCompleting(); } } } - private async Task ReadAsyncCore(Task readTask, byte[] array, int offset, int count, CancellationToken cancellationToken) + private async ValueTask FinishReadAsyncMemory( + ValueTask readTask, Memory destination, CancellationToken cancellationToken) { try { @@ -412,17 +443,13 @@ namespace System.IO.Compression // Feed the data from base stream into decompression engine _inflater.SetInput(_buffer, 0, bytesRead); - bytesRead = _inflater.Inflate(array, offset, count); + bytesRead = _inflater.Inflate(destination.Span); if (bytesRead == 0 && !_inflater.Finished()) { // We could have read in head information and didn't get any data. // Read from the base stream again. - readTask = _stream.ReadAsync(_buffer, 0, _buffer.Length, cancellationToken); - if (readTask == null) - { - throw new InvalidOperationException(SR.NotSupported_UnreadableStream); - } + readTask = _stream.ReadAsync(_buffer, cancellationToken); } else { @@ -438,18 +465,43 @@ namespace System.IO.Compression public override void Write(byte[] array, int offset, int count) { - // Validate the state and the parameters - EnsureCompressionMode(); ValidateParameters(array, offset, count); + WriteCore(new ReadOnlySpan(array, offset, count)); + } + + public override void Write(ReadOnlySpan source) + { + if (GetType() != typeof(DeflateStream)) + { + // DeflateStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior + // to this Write(ReadOnlySpan) overload being introduced. In that case, this Write(ReadOnlySpan) overload + // should use the behavior of Write(byte[],int,int) overload. + base.Write(source); + } + else + { + WriteCore(source); + } + } + + internal void WriteCore(ReadOnlySpan source) + { + EnsureCompressionMode(); EnsureNotDisposed(); // Write compressed the bytes we already passed to the deflater: WriteDeflaterOutput(); - // Pass new bytes through deflater and write them too: - _deflater.SetInput(array, offset, count); - WriteDeflaterOutput(); - _wroteBytes = true; + unsafe + { + // Pass new bytes through deflater and write them too: + fixed (byte* bufferPtr = &source.DangerousGetPinnableReference()) + { + _deflater.SetInput(bufferPtr, source.Length); + WriteDeflaterOutput(); + _wroteBytes = true; + } + } } private void WriteDeflaterOutput() @@ -591,19 +643,36 @@ namespace System.IO.Compression public override Task WriteAsync(byte[] array, int offset, int count, CancellationToken cancellationToken) { - // We use this checking order for compat to earlier versions: - EnsureCompressionMode(); - EnsureNoActiveAsyncOperation(); ValidateParameters(array, offset, count); - EnsureNotDisposed(); - - if (cancellationToken.IsCancellationRequested) - return Task.FromCanceled(cancellationToken); - - return WriteAsyncCore(array, offset, count, cancellationToken); + return WriteAsyncMemory(new ReadOnlyMemory(array, offset, count), cancellationToken); } - private async Task WriteAsyncCore(byte[] array, int offset, int count, CancellationToken cancellationToken) + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + if (GetType() != typeof(DeflateStream)) + { + // Ensure that existing streams derived from DeflateStream and that override WriteAsync(byte[],...) + // get their existing behaviors when the newer Memory-based overload is used. + return base.WriteAsync(source, cancellationToken); + } + else + { + return WriteAsyncMemory(source, cancellationToken); + } + } + + internal Task WriteAsyncMemory(ReadOnlyMemory source, CancellationToken cancellationToken) + { + EnsureCompressionMode(); + EnsureNoActiveAsyncOperation(); + EnsureNotDisposed(); + + return cancellationToken.IsCancellationRequested ? + Task.FromCanceled(cancellationToken) : + WriteAsyncMemoryCore(source, cancellationToken); + } + + private async Task WriteAsyncMemoryCore(ReadOnlyMemory source, CancellationToken cancellationToken) { AsyncOperationStarting(); try @@ -611,7 +680,7 @@ namespace System.IO.Compression await WriteDeflaterOutputAsync(cancellationToken).ConfigureAwait(false); // Pass new bytes through deflater - _deflater.SetInput(array, offset, count); + _deflater.SetInput(source); await WriteDeflaterOutputAsync(cancellationToken).ConfigureAwait(false); diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Deflater.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Deflater.cs index c7d83d675e..35cd2af261 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Deflater.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Deflater.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.Diagnostics; using System.Diagnostics.Contracts; -using System.Runtime.InteropServices; using System.Security; using ZErrorCode = System.IO.Compression.ZLibNative.ErrorCode; @@ -18,7 +18,7 @@ namespace System.IO.Compression internal sealed class Deflater : IDisposable { private ZLibNative.ZLibStreamHandle _zlibStream; - private GCHandle _inputBufferHandle; + private MemoryHandle _inputBufferHandle; private bool _isDisposed; private const int minWindowBits = -15; // WindowBits must be between -8..-15 to write no header, 8..15 for a private const int maxWindowBits = 31; // zlib header, or 24..31 for a GZip header @@ -83,29 +83,46 @@ namespace System.IO.Compression if (disposing) _zlibStream.Dispose(); - if (_inputBufferHandle.IsAllocated) - DeallocateInputBufferHandle(); + DeallocateInputBufferHandle(); _isDisposed = true; } } public bool NeedsInput() => 0 == _zlibStream.AvailIn; - internal void SetInput(byte[] inputBuffer, int startIndex, int count) + internal unsafe void SetInput(ReadOnlyMemory inputBuffer) { Debug.Assert(NeedsInput(), "We have something left in previous input!"); - Debug.Assert(null != inputBuffer); - Debug.Assert(startIndex >= 0 && count >= 0 && count + startIndex <= inputBuffer.Length); - Debug.Assert(!_inputBufferHandle.IsAllocated); + Debug.Assert(_inputBufferHandle.PinnedPointer == null); - if (0 == count) + if (0 == inputBuffer.Length) + { return; + } lock (SyncLock) { - _inputBufferHandle = GCHandle.Alloc(inputBuffer, GCHandleType.Pinned); + _inputBufferHandle = inputBuffer.Retain(pin: true); - _zlibStream.NextIn = _inputBufferHandle.AddrOfPinnedObject() + startIndex; + _zlibStream.NextIn = (IntPtr)_inputBufferHandle.PinnedPointer; + _zlibStream.AvailIn = (uint)inputBuffer.Length; + } + } + + internal unsafe void SetInput(byte* inputBufferPtr, int count) + { + Debug.Assert(NeedsInput(), "We have something left in previous input!"); + Debug.Assert(inputBufferPtr != null); + Debug.Assert(_inputBufferHandle.PinnedPointer == null); + + if (count == 0) + { + return; + } + + lock (SyncLock) + { + _zlibStream.NextIn = (IntPtr)inputBufferPtr; _zlibStream.AvailIn = (uint)count; } } @@ -116,7 +133,6 @@ namespace System.IO.Compression Debug.Assert(null != outputBuffer, "Can't pass in a null output buffer!"); Debug.Assert(!NeedsInput(), "GetDeflateOutput should only be called after providing input"); - Debug.Assert(_inputBufferHandle.IsAllocated); try { @@ -127,8 +143,10 @@ namespace System.IO.Compression finally { // Before returning, make sure to release input buffer if necessary: - if (0 == _zlibStream.AvailIn && _inputBufferHandle.IsAllocated) + if (0 == _zlibStream.AvailIn) + { DeallocateInputBufferHandle(); + } } } @@ -156,7 +174,10 @@ namespace System.IO.Compression Debug.Assert(null != outputBuffer, "Can't pass in a null output buffer!"); Debug.Assert(outputBuffer.Length > 0, "Can't pass in an empty output buffer!"); Debug.Assert(NeedsInput(), "We have something left in previous input!"); - Debug.Assert(!_inputBufferHandle.IsAllocated); + unsafe + { + Debug.Assert(_inputBufferHandle.PinnedPointer == null); + } // Note: we require that NeedsInput() == true, i.e. that 0 == _zlibStream.AvailIn. // If there is still input left we should never be getting here; instead we @@ -174,7 +195,10 @@ namespace System.IO.Compression Debug.Assert(null != outputBuffer, "Can't pass in a null output buffer!"); Debug.Assert(outputBuffer.Length > 0, "Can't pass in an empty output buffer!"); Debug.Assert(NeedsInput(), "We have something left in previous input!"); - Debug.Assert(!_inputBufferHandle.IsAllocated); + unsafe + { + Debug.Assert(_inputBufferHandle.PinnedPointer == null); + } // Note: we require that NeedsInput() == true, i.e. that 0 == _zlibStream.AvailIn. // If there is still input left we should never be getting here; instead we @@ -185,13 +209,11 @@ namespace System.IO.Compression private void DeallocateInputBufferHandle() { - Debug.Assert(_inputBufferHandle.IsAllocated); - lock (SyncLock) { _zlibStream.AvailIn = 0; _zlibStream.NextIn = ZLibNative.ZNullPtr; - _inputBufferHandle.Free(); + _inputBufferHandle.Dispose(); } } diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs index 3ab6f503f0..8950ceb7d9 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/Inflater.cs @@ -64,6 +64,18 @@ namespace System.IO.Compression } } + public unsafe int Inflate(Span destination) + { + // If Inflate is called on an invalid or unready inflater, return 0 to indicate no bytes have been read. + if (destination.Length == 0) + return 0; + + fixed (byte* bufPtr = &destination.DangerousGetPinnableReference()) + { + return InflateVerified(bufPtr, destination.Length); + } + } + public unsafe int InflateVerified(byte* bufPtr, int length) { // State is valid; attempt inflation diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs index ee55a4931e..c7b2a9c5f7 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibException.cs @@ -39,14 +39,6 @@ namespace System.IO.Compression /// public ZLibException() { } - /// - /// This constructor is provided in compliance with common NetFx design patterns; - /// developers should prefer using the constructor - /// public ZLibException(string message, string zlibErrorContext, ZLibNative.ErrorCode zlibErrorCode, string zlibErrorMessage). - /// - /// The error message that explains the reason for the exception. - public ZLibException(string message) : base(message) { } - /// /// This constructor is provided in compliance with common NetFx design patterns; /// developers should prefer using the constructor @@ -55,23 +47,5 @@ namespace System.IO.Compression /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception, or a null. public ZLibException(string message, Exception innerException) : base(message, innerException) { } - - public string ZLibContext - { - [SecurityCritical] - get { return _zlibErrorContext; } - } - - public int ZLibErrorCode - { - [SecurityCritical] - get { return (int)_zlibErrorCode; } - } - - public string ZLibErrorMessage - { - [SecurityCritical] - get { return _zlibErrorMessage; } - } } } diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibNative.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibNative.cs index 540cb030ee..f61af39965 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibNative.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/DeflateZLib/ZLibNative.cs @@ -327,29 +327,6 @@ namespace System.IO.Compression return errC; } - /// - /// This function is equivalent to inflateEnd followed by inflateInit. - /// The stream will keep attributes that may have been set by inflateInit2. - /// - [SecurityCritical] - public ErrorCode InflateReset(int windowBits) - { - EnsureNotDisposed(); - EnsureState(State.InitializedForInflate); - - ErrorCode errC = Interop.zlib.InflateEnd(ref _zStream); - if (errC != ErrorCode.Ok) - { - _initializationState = State.Disposed; - return errC; - } - - errC = Interop.zlib.InflateInit2_(ref _zStream, windowBits); - _initializationState = State.InitializedForInflate; - - return errC; - } - // This can work even after XxflateEnd(). [SecurityCritical] public string GetErrorMessage() => _zStream.msg != ZNullPtr ? Marshal.PtrToStringAnsi(_zStream.msg) : string.Empty; diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs index 36e732dee6..4796b9b39b 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs @@ -84,6 +84,22 @@ namespace System.IO.Compression return _deflateStream.Read(array, offset, count); } + public override int Read(Span destination) + { + if (GetType() != typeof(GZipStream)) + { + // GZipStream is not sealed, and a derived type may have overridden Read(byte[], int, int) prior + // to this Read(Span) overload being introduced. In that case, this Read(Span) overload + // should use the behavior of Read(byte[],int,int) overload. + return base.Read(destination); + } + else + { + CheckDeflateStream(); + return _deflateStream.ReadCore(destination); + } + } + public override IAsyncResult BeginWrite(byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState) => TaskToApm.Begin(WriteAsync(array, offset, count, CancellationToken.None), asyncCallback, asyncState); @@ -96,6 +112,28 @@ namespace System.IO.Compression _deflateStream.Write(array, offset, count); } + public override void Write(ReadOnlySpan source) + { + if (GetType() != typeof(GZipStream)) + { + // GZipStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior + // to this Write(ReadOnlySpan) overload being introduced. In that case, this Write(ReadOnlySpan) overload + // should use the behavior of Write(byte[],int,int) overload. + base.Write(source); + } + else + { + CheckDeflateStream(); + _deflateStream.WriteCore(source); + } + } + + public override void CopyTo(Stream destination, int bufferSize) + { + CheckDeflateStream(); + _deflateStream.CopyTo(destination, bufferSize); + } + protected override void Dispose(bool disposing) { try @@ -120,12 +158,44 @@ namespace System.IO.Compression return _deflateStream.ReadAsync(array, offset, count, cancellationToken); } + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) + { + if (GetType() != typeof(GZipStream)) + { + // GZipStream is not sealed, and a derived type may have overridden ReadAsync(byte[], int, int) prior + // to this ReadAsync(Memory) overload being introduced. In that case, this ReadAsync(Memory) overload + // should use the behavior of ReadAsync(byte[],int,int) overload. + return base.ReadAsync(destination, cancellationToken); + } + else + { + CheckDeflateStream(); + return _deflateStream.ReadAsyncMemory(destination, cancellationToken); + } + } + public override Task WriteAsync(byte[] array, int offset, int count, CancellationToken cancellationToken) { CheckDeflateStream(); return _deflateStream.WriteAsync(array, offset, count, cancellationToken); } + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) + { + if (GetType() != typeof(GZipStream)) + { + // GZipStream is not sealed, and a derived type may have overridden WriteAsync(byte[], int, int) prior + // to this WriteAsync(ReadOnlyMemory) overload being introduced. In that case, this + // WriteAsync(ReadOnlyMemory) overload should use the behavior of Write(byte[],int,int) overload. + return base.WriteAsync(source, cancellationToken); + } + else + { + CheckDeflateStream(); + return _deflateStream.WriteAsyncMemory(source, cancellationToken); + } + } + public override Task FlushAsync(CancellationToken cancellationToken) { CheckDeflateStream(); diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.cs index cc7eff4a41..6daf909819 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace System.IO.Compression { - internal sealed class PositionPreservingWriteOnlyStreamWrapper : Stream + internal sealed partial class PositionPreservingWriteOnlyStreamWrapper : Stream { private readonly Stream _stream; private long _position; diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.netcoreapp.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.netcoreapp.cs new file mode 100644 index 0000000000..1c5aa7b6e2 --- /dev/null +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.netcoreapp.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; + +namespace System.IO.Compression +{ + internal sealed partial class PositionPreservingWriteOnlyStreamWrapper : Stream + { + public override void Write(ReadOnlySpan source) + { + _position += source.Length; + _stream.Write(source); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) + { + _position += source.Length; + return _stream.WriteAsync(source, cancellationToken); + } + } +} diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs index 1bc85c731b..f99101a4f1 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs @@ -48,13 +48,6 @@ namespace System.IO.Compression private byte[] _fileComment; private CompressionLevel? _compressionLevel; - // Initializes, attaches it to archive - internal ZipArchiveEntry(ZipArchive archive, ZipCentralDirectoryFileHeader cd, CompressionLevel compressionLevel) - : this(archive, cd) - { - _compressionLevel = compressionLevel; - } - // Initializes, attaches it to archive internal ZipArchiveEntry(ZipArchive archive, ZipCentralDirectoryFileHeader cd) { @@ -460,7 +453,7 @@ namespace System.IO.Compression BinaryWriter writer = new BinaryWriter(_archive.ArchiveStream); // _entryname only gets set when we read in or call moveTo. MoveTo does a check, and - // reading in should not be able to produce a entryname longer than ushort.MaxValue + // reading in should not be able to produce an entryname longer than ushort.MaxValue Debug.Assert(_storedEntryNameBytes.Length <= ushort.MaxValue); // decide if we need the Zip64 extra field: @@ -786,7 +779,7 @@ namespace System.IO.Compression BinaryWriter writer = new BinaryWriter(_archive.ArchiveStream); // _entryname only gets set when we read in or call moveTo. MoveTo does a check, and - // reading in should not be able to produce a entryname longer than ushort.MaxValue + // reading in should not be able to produce an entryname longer than ushort.MaxValue Debug.Assert(_storedEntryNameBytes.Length <= ushort.MaxValue); // decide if we need the Zip64 extra field: @@ -1089,7 +1082,7 @@ namespace System.IO.Compression return path; } - private sealed class DirectToArchiveWriterStream : Stream + private sealed partial class DirectToArchiveWriterStream : Stream { private long _position; private CheckSumAndSizeWriteStream _crcSizeStream; @@ -1239,7 +1232,5 @@ namespace System.IO.Compression private enum BitFlagValues : ushort { DataDescriptor = 0x8, UnicodeFileName = 0x800 } internal enum CompressionMethodValues : ushort { Stored = 0x0, Deflate = 0x8, Deflate64 = 0x9, BZip2 = 0xC, LZMA = 0xE } - - private enum OpenableValues { Openable, FileNonExistent, FileTooLarge } } } diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.netcoreapp.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.netcoreapp.cs new file mode 100644 index 0000000000..8a122d4296 --- /dev/null +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.netcoreapp.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.IO.Compression +{ + public partial class ZipArchiveEntry + { + private sealed partial class DirectToArchiveWriterStream : Stream + { + public override void Write(ReadOnlySpan source) + { + ThrowIfDisposed(); + Debug.Assert(CanWrite); + + // if we're not actually writing anything, we don't want to trigger the header + if (source.Length == 0) + return; + + if (!_everWritten) + { + _everWritten = true; + // write local header, we are good to go + _usedZip64inLH = _entry.WriteLocalFileHeader(isEmptyFile: false); + } + + _crcSizeStream.Write(source); + _position += source.Length; + } + } + } +} diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs index b6b6b116eb..899e890d35 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs @@ -7,7 +7,7 @@ using System.Diagnostics; namespace System.IO.Compression { - internal sealed class WrappedStream : Stream + internal sealed partial class WrappedStream : Stream { private readonly Stream _baseStream; private readonly bool _closeBaseStream; @@ -145,7 +145,7 @@ namespace System.IO.Compression } } - internal sealed class SubReadStream : Stream + internal sealed partial class SubReadStream : Stream { private readonly long _startInSuperStream; private long _positionInSuperStream; @@ -271,7 +271,7 @@ namespace System.IO.Compression } } - internal sealed class CheckSumAndSizeWriteStream : Stream + internal sealed partial class CheckSumAndSizeWriteStream : Stream { private readonly Stream _baseStream; private readonly Stream _baseBaseStream; diff --git a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.netcoreapp.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.netcoreapp.cs new file mode 100644 index 0000000000..c6ba0b044a --- /dev/null +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.netcoreapp.cs @@ -0,0 +1,68 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.IO.Compression +{ + internal sealed partial class WrappedStream : Stream + { + public override void Write(ReadOnlySpan source) + { + ThrowIfDisposed(); + ThrowIfCantWrite(); + + _baseStream.Write(source); + } + } + + internal sealed partial class SubReadStream : Stream + { + public override int Read(Span destination) + { + // parameter validation sent to _superStream.Read + int origCount = destination.Length; + int count = destination.Length; + + ThrowIfDisposed(); + ThrowIfCantRead(); + + if (_superStream.Position != _positionInSuperStream) + _superStream.Seek(_positionInSuperStream, SeekOrigin.Begin); + if (_positionInSuperStream + count > _endInSuperStream) + count = (int)(_endInSuperStream - _positionInSuperStream); + + Debug.Assert(count >= 0); + Debug.Assert(count <= origCount); + + int ret = _superStream.Read(destination.Slice(0, count)); + + _positionInSuperStream += ret; + return ret; + } + } + + internal sealed partial class CheckSumAndSizeWriteStream : Stream + { + public override void Write(ReadOnlySpan source) + { + // if we're not actually writing anything, we don't want to trigger as if we did write something + ThrowIfDisposed(); + Debug.Assert(CanWrite); + + if (source.Length == 0) + return; + + if (!_everWritten) + { + _initialPosition = _baseBaseStream.Position; + _everWritten = true; + } + + _checksum = Crc32Helper.UpdateCrc32(_checksum, source); + _baseStream.Write(source); + _position += source.Length; + } + } +} diff --git a/external/corefx/src/System.IO.Compression/tests/Configurations.props b/external/corefx/src/System.IO.Compression/tests/Configurations.props index 742254e254..e245e48733 100644 --- a/external/corefx/src/System.IO.Compression/tests/Configurations.props +++ b/external/corefx/src/System.IO.Compression/tests/Configurations.props @@ -6,6 +6,7 @@ netstandard-Windows_NT; netcoreapp-Unix; netcoreapp-Windows_NT; + uap-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.cs b/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.cs index 837f35ecf6..e2cf6737f7 100644 --- a/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.cs +++ b/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.cs @@ -436,60 +436,44 @@ namespace System.IO.Compression.Tests } } - [Fact] - public async Task RoundtripCompressDecompress() + public enum ReadWriteMode { - await RoundtripCompressDecompress(useAsync: false, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); - await RoundtripCompressDecompress(useAsync: true, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); - } - - [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] - public async Task RoundTripWithFlush() - { - await RoundTripWithFlush(useAsync: false, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); - await RoundTripWithFlush(useAsync: true, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); - } - - [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] - public async Task WriteAfterFlushing() - { - await WriteAfterFlushing(useAsync: false, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); - await WriteAfterFlushing(useAsync: true, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); - } - - [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] - public async Task FlushBeforeFirstWrites() - { - await FlushBeforeFirstWrites(useAsync: false, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); - await FlushBeforeFirstWrites(useAsync: true, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); + SyncArray, + SyncSpan, + AsyncArray, + AsyncMemory } public static IEnumerable RoundtripCompressDecompressOuterData { get { - foreach (bool useAsync in new[] { true, false }) // whether to use Read/Write or ReadAsync/WriteAsync + foreach (ReadWriteMode readWriteMode in new[] { ReadWriteMode.SyncArray, ReadWriteMode.SyncSpan, ReadWriteMode.AsyncArray, ReadWriteMode.AsyncMemory }) { foreach (bool useGzip in new[] { true, false }) // whether to add on gzip headers/footers { foreach (var level in new[] { CompressionLevel.Fastest, CompressionLevel.Optimal, CompressionLevel.NoCompression }) // compression level { - yield return new object[] { useAsync, useGzip, 1, 5, level }; // smallest possible writes - yield return new object[] { useAsync, useGzip, 1023, 1023 * 10, level }; // overflowing internal buffer - yield return new object[] { useAsync, useGzip, 1024 * 1024, 1024 * 1024, level }; // large single write + yield return new object[] { readWriteMode, useGzip, 1, 5, level }; // smallest possible writes + yield return new object[] { readWriteMode, useGzip, 1023, 1023 * 10, level }; // overflowing internal buffer + yield return new object[] { readWriteMode, useGzip, 1024 * 1024, 1024 * 1024, level }; // large single write } } } } } + [Fact] + public async Task RoundtripCompressDecompress() + { + await RoundtripCompressDecompress(ReadWriteMode.SyncArray, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); + await RoundtripCompressDecompress(ReadWriteMode.AsyncArray, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); + } + [OuterLoop] [Theory] [MemberData(nameof(RoundtripCompressDecompressOuterData))] - public async Task RoundtripCompressDecompress(bool useAsync, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) + public async Task RoundtripCompressDecompress(ReadWriteMode readWriteMode, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) { byte[] data = new byte[totalSize]; new Random(42).NextBytes(data); @@ -499,23 +483,41 @@ namespace System.IO.Compression.Tests { for (int i = 0; i < data.Length; i += chunkSize) // not using CopyTo{Async} due to optimizations in MemoryStream's implementation that avoid what we're trying to test { - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.WriteAsync(data, i, chunkSize); break; - case false: compressor.Write(data, i, chunkSize); break; + case ReadWriteMode.AsyncArray: + await compressor.WriteAsync(data, i, chunkSize); + break; + case ReadWriteMode.SyncArray: + compressor.Write(data, i, chunkSize); + break; + case ReadWriteMode.SyncSpan: + compressor.Write(new ReadOnlySpan(data, i, chunkSize)); + break; + case ReadWriteMode.AsyncMemory: + await compressor.WriteAsync(new ReadOnlyMemory(data, i, chunkSize)); + break; } } } compressed.Position = 0; - await ValidateCompressedData(useAsync, useGzip, chunkSize, compressed, data); + await ReadAndValidateCompressedData(readWriteMode, useGzip, chunkSize, compressed, data); compressed.Dispose(); } + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] + public async Task RoundTripWithFlush() + { + await RoundTripWithFlush(ReadWriteMode.SyncArray, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); + await RoundTripWithFlush(ReadWriteMode.AsyncArray, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); + } + [OuterLoop] [Theory] [MemberData(nameof(RoundtripCompressDecompressOuterData))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] - public async Task RoundTripWithFlush(bool useAsync, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) + public async Task RoundTripWithFlush(ReadWriteMode readWriteMode, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) { byte[] data = new byte[totalSize]; new Random(42).NextBytes(data); @@ -525,27 +527,51 @@ namespace System.IO.Compression.Tests { for (int i = 0; i < data.Length; i += chunkSize) // not using CopyTo{Async} due to optimizations in MemoryStream's implementation that avoid what we're trying to test { - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.WriteAsync(data, i, chunkSize); break; - case false: compressor.Write(data, i, chunkSize); break; + case ReadWriteMode.AsyncArray: + await compressor.WriteAsync(data, i, chunkSize); + break; + case ReadWriteMode.SyncArray: + compressor.Write(data, i, chunkSize); + break; + case ReadWriteMode.SyncSpan: + compressor.Write(new ReadOnlySpan(data, i, chunkSize)); + break; + case ReadWriteMode.AsyncMemory: + await compressor.WriteAsync(new ReadOnlyMemory(data, i, chunkSize)); + break; } } - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.FlushAsync(); break; - case false: compressor.Flush(); break; + case ReadWriteMode.AsyncArray: + case ReadWriteMode.AsyncMemory: + await compressor.FlushAsync(); + break; + case ReadWriteMode.SyncSpan: + case ReadWriteMode.SyncArray: + compressor.Flush(); + break; } compressed.Position = 0; - await ValidateCompressedData(useAsync, useGzip, chunkSize, compressed, data); + await ReadAndValidateCompressedData(readWriteMode, useGzip, chunkSize, compressed, data); } } + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] + public async Task WriteAfterFlushing() + { + await WriteAfterFlushing(ReadWriteMode.SyncArray, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); + await WriteAfterFlushing(ReadWriteMode.AsyncArray, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); + } + [OuterLoop] [Theory] [MemberData(nameof(RoundtripCompressDecompressOuterData))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] - public async Task WriteAfterFlushing(bool useAsync, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) + public async Task WriteAfterFlushing(ReadWriteMode readWriteMode, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) { byte[] data = new byte[totalSize]; List expected = new List(); @@ -556,32 +582,56 @@ namespace System.IO.Compression.Tests { for (int i = 0; i < data.Length; i += chunkSize) // not using CopyTo{Async} due to optimizations in MemoryStream's implementation that avoid what we're trying to test { - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.WriteAsync(data, i, chunkSize); break; - case false: compressor.Write(data, i, chunkSize); break; + case ReadWriteMode.AsyncArray: + await compressor.WriteAsync(data, i, chunkSize); + break; + case ReadWriteMode.SyncArray: + compressor.Write(data, i, chunkSize); + break; + case ReadWriteMode.SyncSpan: + compressor.Write(new ReadOnlySpan(data, i, chunkSize)); + break; + case ReadWriteMode.AsyncMemory: + await compressor.WriteAsync(new ReadOnlyMemory(data, i, chunkSize)); + break; } for (int j = i; j < i + chunkSize; j++) expected.Insert(j, data[j]); - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.FlushAsync(); break; - case false: compressor.Flush(); break; + case ReadWriteMode.AsyncArray: + case ReadWriteMode.AsyncMemory: + await compressor.FlushAsync(); + break; + case ReadWriteMode.SyncSpan: + case ReadWriteMode.SyncArray: + compressor.Flush(); + break; } MemoryStream partiallyCompressed = new MemoryStream(compressed.ToArray()); partiallyCompressed.Position = 0; - await ValidateCompressedData(useAsync, useGzip, chunkSize, partiallyCompressed, expected.ToArray()); + await ReadAndValidateCompressedData(readWriteMode, useGzip, chunkSize, partiallyCompressed, expected.ToArray()); } } } + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] + public async Task FlushBeforeFirstWrites() + { + await FlushBeforeFirstWrites(ReadWriteMode.SyncArray, useGzip: false, chunkSize: 1, totalSize: 10, level: CompressionLevel.Fastest); + await FlushBeforeFirstWrites(ReadWriteMode.AsyncArray, useGzip: true, chunkSize: 1024, totalSize: 8192, level: CompressionLevel.Optimal); + } + [OuterLoop] [Theory] [MemberData(nameof(RoundtripCompressDecompressOuterData))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full Framework Flush is a no-op.")] - public async Task FlushBeforeFirstWrites(bool useAsync, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) + public async Task FlushBeforeFirstWrites(ReadWriteMode readWriteMode, bool useGzip, int chunkSize, int totalSize, CompressionLevel level) { byte[] data = new byte[totalSize]; new Random(42).NextBytes(data); @@ -589,28 +639,50 @@ namespace System.IO.Compression.Tests using (var compressed = new MemoryStream()) using (var compressor = useGzip ? (Stream)new GZipStream(compressed, level, true) : new DeflateStream(compressed, level, true)) { - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.FlushAsync(); break; - case false: compressor.Flush(); break; + case ReadWriteMode.AsyncArray: + case ReadWriteMode.AsyncMemory: + await compressor.FlushAsync(); + break; + case ReadWriteMode.SyncSpan: + case ReadWriteMode.SyncArray: + compressor.Flush(); + break; } for (int i = 0; i < data.Length; i += chunkSize) // not using CopyTo{Async} due to optimizations in MemoryStream's implementation that avoid what we're trying to test { - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.WriteAsync(data, i, chunkSize); break; - case false: compressor.Write(data, i, chunkSize); break; + case ReadWriteMode.AsyncArray: + await compressor.WriteAsync(data, i, chunkSize); + break; + case ReadWriteMode.SyncArray: + compressor.Write(data, i, chunkSize); + break; + case ReadWriteMode.SyncSpan: + compressor.Write(new ReadOnlySpan(data, i, chunkSize)); + break; + case ReadWriteMode.AsyncMemory: + await compressor.WriteAsync(new ReadOnlyMemory(data, i, chunkSize)); + break; } } - switch (useAsync) + switch (readWriteMode) { - case true: await compressor.FlushAsync(); break; - case false: compressor.Flush(); break; + case ReadWriteMode.AsyncArray: + case ReadWriteMode.AsyncMemory: + await compressor.FlushAsync(); + break; + case ReadWriteMode.SyncSpan: + case ReadWriteMode.SyncArray: + compressor.Flush(); + break; } compressed.Position = 0; - await ValidateCompressedData(useAsync, useGzip, chunkSize, compressed, data); + await ReadAndValidateCompressedData(readWriteMode, useGzip, chunkSize, compressed, data); } } @@ -618,50 +690,115 @@ namespace System.IO.Compression.Tests /// Given a MemoryStream of compressed data and a byte array of desired output, decompresses /// the stream and validates that it is equal to the expected array. /// - private async Task ValidateCompressedData(bool useAsync, bool useGzip, int chunkSize, MemoryStream compressed, byte[] expected) + private async Task ReadAndValidateCompressedData(ReadWriteMode readWriteMode, bool useGzip, int chunkSize, MemoryStream compressed, byte[] expected) { using (MemoryStream decompressed = new MemoryStream()) using (Stream decompressor = useGzip ? (Stream)new GZipStream(compressed, CompressionMode.Decompress, true) : new DeflateStream(compressed, CompressionMode.Decompress, true)) { - if (useAsync) - decompressor.CopyTo(decompressed, chunkSize); - else - await decompressor.CopyToAsync(decompressed, chunkSize, CancellationToken.None); + int bytesRead; + var buffer = new byte[chunkSize]; + switch (readWriteMode) + { + case ReadWriteMode.SyncSpan: + while ((bytesRead = decompressor.Read(new Span(buffer))) != 0) + { + decompressed.Write(buffer, 0, bytesRead); + } + break; + case ReadWriteMode.SyncArray: + while ((bytesRead = decompressor.Read(buffer, 0, buffer.Length)) != 0) + { + decompressed.Write(buffer, 0, bytesRead); + } + break; + case ReadWriteMode.AsyncArray: + while ((bytesRead = await decompressor.ReadAsync(buffer, 0, buffer.Length)) != 0) + { + decompressed.Write(buffer, 0, bytesRead); + } + break; + case ReadWriteMode.AsyncMemory: + while ((bytesRead = await decompressor.ReadAsync(new Memory(buffer))) != 0) + { + decompressed.Write(buffer, 0, bytesRead); + } + break; + } Assert.Equal(expected, decompressed.ToArray()); } } - [Fact] - public void SequentialReadsOnMemoryStream_Return_SameBytes() + [Theory] + [InlineData(ReadWriteMode.SyncArray, false)] + [InlineData(ReadWriteMode.AsyncArray, false)] + [InlineData(ReadWriteMode.SyncSpan, false)] + [InlineData(ReadWriteMode.SyncSpan, true)] + [InlineData(ReadWriteMode.AsyncMemory, false)] + [InlineData(ReadWriteMode.AsyncMemory, true)] + public async Task SequentialReadsOnMemoryStream_Return_SameBytes(ReadWriteMode readWriteMode, bool derived) { byte[] data = new byte[1024 * 10]; new Random(42).NextBytes(data); var compressed = new MemoryStream(); - using (var compressor = new DeflateStream(compressed, CompressionMode.Compress, true)) + using (var compressor = derived ? + new DerivedDeflateStream(compressed, CompressionMode.Compress, true) : + new DeflateStream(compressed, CompressionMode.Compress, true)) { for (int i = 0; i < data.Length; i += 1024) { - compressor.Write(data, i, 1024); + switch (readWriteMode) + { + case ReadWriteMode.SyncArray: compressor.Write(data, i, 1024); break; + case ReadWriteMode.AsyncArray: await compressor.WriteAsync(data, i, 1024); break; + case ReadWriteMode.SyncSpan: compressor.Write(new Span(data, i, 1024)); break; + case ReadWriteMode.AsyncMemory: await compressor.WriteAsync(new ReadOnlyMemory(data, i, 1024)); break; + } } + + Assert.Equal( + derived && (readWriteMode == ReadWriteMode.SyncArray || readWriteMode == ReadWriteMode.SyncSpan), + compressor is DerivedDeflateStream dds && dds.WriteArrayInvoked); } compressed.Position = 0; - using (var decompressor = new DeflateStream(compressed, CompressionMode.Decompress, true)) + using (var decompressor = derived ? + new DerivedDeflateStream(compressed, CompressionMode.Decompress, true) : + new DeflateStream(compressed, CompressionMode.Decompress, true)) { int i, j; byte[] array = new byte[100]; byte[] array2 = new byte[100]; // only read in the first 100 bytes - decompressor.Read(array, 0, array.Length); + switch (readWriteMode) + { + case ReadWriteMode.SyncArray: decompressor.Read(array, 0, array.Length); break; + case ReadWriteMode.AsyncArray: await decompressor.ReadAsync(array, 0, array.Length); break; + case ReadWriteMode.SyncSpan: decompressor.Read(new Span(array)); break; + case ReadWriteMode.AsyncMemory: await decompressor.ReadAsync(new Memory(array)); break; + } for (i = 0; i < array.Length; i++) + { Assert.Equal(data[i], array[i]); + } // read in the next 100 bytes and make sure nothing is missing - decompressor.Read(array2, 0, array2.Length); + switch (readWriteMode) + { + case ReadWriteMode.SyncArray: decompressor.Read(array2, 0, array2.Length); break; + case ReadWriteMode.AsyncArray: await decompressor.ReadAsync(array2, 0, array2.Length); break; + case ReadWriteMode.SyncSpan: decompressor.Read(new Span(array2)); break; + case ReadWriteMode.AsyncMemory: await decompressor.ReadAsync(new Memory(array2)); break; + } for (j = 0; j < array2.Length; j++) + { Assert.Equal(data[j], array[j]); + } + + Assert.Equal( + derived && (readWriteMode == ReadWriteMode.SyncArray || readWriteMode == ReadWriteMode.SyncSpan), + decompressor is DerivedDeflateStream dds && dds.ReadArrayInvoked); } } @@ -690,7 +827,7 @@ namespace System.IO.Compression.Tests public async Task WrapNullReturningTasksStream() { using (var ds = new DeflateStream(new BadWrappedStream(BadWrappedStream.Mode.ReturnNullTasks), CompressionMode.Decompress)) - await Assert.ThrowsAsync(() => ds.ReadAsync(new byte[1024], 0, 1024)); + await Assert.ThrowsAsync(() => ds.ReadAsync(new byte[1024], 0, 1024)); } [Fact] @@ -701,11 +838,15 @@ namespace System.IO.Compression.Tests Assert.Throws(() => ds.Read(new byte[1024], 0, 1024)); using (var ds = new DeflateStream(new BadWrappedStream(BadWrappedStream.Mode.ReturnTooLargeCounts), CompressionMode.Decompress)) await Assert.ThrowsAsync(() => ds.ReadAsync(new byte[1024], 0, 1024)); + using (var ds = new DeflateStream(new BadWrappedStream(BadWrappedStream.Mode.ReturnTooLargeCounts), CompressionMode.Decompress)) + await Assert.ThrowsAsync(async () => { await ds.ReadAsync(new Memory(new byte[1024])); }); using (var ds = new DeflateStream(new BadWrappedStream(BadWrappedStream.Mode.ReturnTooSmallCounts), CompressionMode.Decompress)) Assert.Equal(0, ds.Read(new byte[1024], 0, 1024)); using (var ds = new DeflateStream(new BadWrappedStream(BadWrappedStream.Mode.ReturnTooSmallCounts), CompressionMode.Decompress)) Assert.Equal(0, await ds.ReadAsync(new byte[1024], 0, 1024)); + using (var ds = new DeflateStream(new BadWrappedStream(BadWrappedStream.Mode.ReturnTooSmallCounts), CompressionMode.Decompress)) + Assert.Equal(0, await ds.ReadAsync(new Memory(new byte[1024]))); } public static IEnumerable CopyToAsync_Roundtrip_OutputMatchesInput_MemberData() @@ -755,6 +896,25 @@ namespace System.IO.Compression.Tests Assert.Equal(expectedDecrypted, m.ToArray()); } + private sealed class DerivedDeflateStream : DeflateStream + { + public bool ReadArrayInvoked = false, WriteArrayInvoked = false; + internal DerivedDeflateStream(Stream stream, CompressionMode mode) : base(stream, mode) { } + internal DerivedDeflateStream(Stream stream, CompressionMode mode, bool leaveOpen) : base(stream, mode, leaveOpen) { } + + public override int Read(byte[] array, int offset, int count) + { + ReadArrayInvoked = true; + return base.Read(array, offset, count); + } + + public override void Write(byte[] array, int offset, int count) + { + WriteArrayInvoked = true; + base.Write(array, offset, count); + } + } + private sealed class BadWrappedStream : Stream { public enum Mode @@ -805,7 +965,7 @@ namespace System.IO.Compression.Tests } } - public class ManualSyncMemoryStream : MemoryStream + public partial class ManualSyncMemoryStream : MemoryStream { private bool isSync; public ManualResetEventSlim manualResetEvent = new ManualResetEventSlim(initialState: false); diff --git a/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.netcoreapp.cs b/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.netcoreapp.cs new file mode 100644 index 0000000000..fb0c0b2d53 --- /dev/null +++ b/external/corefx/src/System.IO.Compression/tests/DeflateStreamTests.netcoreapp.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; + +namespace System.IO.Compression.Tests +{ + public partial class ManualSyncMemoryStream : MemoryStream + { + public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken) + { + ReadHit = true; + + if (isSync) + { + manualResetEvent.Wait(cancellationToken); + } + else + { + await Task.Run(() => manualResetEvent.Wait(cancellationToken)); + } + + return await base.ReadAsync(destination, cancellationToken); + } + + public override async Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + WriteHit = true; + + if (isSync) + { + manualResetEvent.Wait(cancellationToken); + } + else + { + await Task.Run(() => manualResetEvent.Wait(cancellationToken)); + } + + await base.WriteAsync(source, cancellationToken); + } + } +} diff --git a/external/corefx/src/System.IO.Compression/tests/GZipStreamTests.cs b/external/corefx/src/System.IO.Compression/tests/GZipStreamTests.cs index ca4bb655aa..cce3d58069 100644 --- a/external/corefx/src/System.IO.Compression/tests/GZipStreamTests.cs +++ b/external/corefx/src/System.IO.Compression/tests/GZipStreamTests.cs @@ -381,5 +381,41 @@ namespace System.IO.Compression.Tests zip.Dispose(); Assert.False(zip.CanSeek); } + + [Fact] + public void DerivedStream_ReadWriteSpan_UsesReadWriteArray() + { + var ms = new MemoryStream(); + using (var compressor = new DerivedGZipStream(ms, CompressionMode.Compress, leaveOpen:true)) + { + compressor.Write(new Span(new byte[1])); + Assert.True(compressor.WriteArrayInvoked); + } + ms.Position = 0; + using (var compressor = new DerivedGZipStream(ms, CompressionMode.Decompress, leaveOpen: true)) + { + compressor.Read(new Span(new byte[1])); + Assert.True(compressor.ReadArrayInvoked); + } + } + + private sealed class DerivedGZipStream : GZipStream + { + public bool ReadArrayInvoked, WriteArrayInvoked; + + public DerivedGZipStream(Stream stream, CompressionMode mode, bool leaveOpen) : base(stream, mode, leaveOpen) { } + + public override int Read(byte[] array, int offset, int count) + { + ReadArrayInvoked = true; + return base.Read(array, offset, count); + } + + public override void Write(byte[] array, int offset, int count) + { + WriteArrayInvoked = true; + base.Write(array, offset, count); + } + } } } diff --git a/external/corefx/src/System.IO.Compression/tests/System.IO.Compression.Tests.csproj b/external/corefx/src/System.IO.Compression/tests/System.IO.Compression.Tests.csproj index 22ad61d3bc..9496693e27 100644 --- a/external/corefx/src/System.IO.Compression/tests/System.IO.Compression.Tests.csproj +++ b/external/corefx/src/System.IO.Compression/tests/System.IO.Compression.Tests.csproj @@ -12,6 +12,8 @@ + + @@ -27,6 +29,9 @@ Common\System\IO\PathFeatures.cs + + Common\System\IO\StreamSpanExtensions.netstandard.cs + Common\System\IO\Compression\CRC.cs @@ -49,8 +54,9 @@ Common\System\Threading\Tasks\TaskToApm.cs - + + diff --git a/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_CreateTests.cs b/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_CreateTests.cs index 0f2af1bbe6..6addc89918 100644 --- a/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_CreateTests.cs +++ b/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_CreateTests.cs @@ -53,16 +53,17 @@ namespace System.IO.Compression.Tests } [Theory] - [InlineData("small")] - [InlineData("normal")] - [InlineData("empty")] - [InlineData("emptydir")] - public static async Task CreateNormal_Seekable(string folder) + [InlineData("small", false)] + [InlineData("normal", false)] + [InlineData("normal", true)] + [InlineData("empty", false)] + [InlineData("emptydir", false)] + public static async Task CreateNormal_Seekable(string folder, bool useSpansForWriting) { using (var s = new MemoryStream()) { var testStream = new WrappedStream(s, false, true, true, null); - await CreateFromDir(zfolder(folder), testStream, ZipArchiveMode.Create); + await CreateFromDir(zfolder(folder), testStream, ZipArchiveMode.Create, useSpansForWriting); IsZipSameAsDir(s, zfolder(folder), ZipArchiveMode.Read, requireExplicit: true, checkTimes: true); } diff --git a/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs b/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs index a2240d2a30..aa2b62782e 100644 --- a/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs +++ b/external/corefx/src/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Runtime.InteropServices; +using System.Text; using System.Threading.Tasks; using Xunit; @@ -134,8 +135,10 @@ namespace System.IO.Compression.Tests IsZipSameAsDir(testArchive, zmodified("deleteMove"), ZipArchiveMode.Read, requireExplicit: true, checkTimes: true); } - [Fact] - public static async Task AppendToEntry() + [Theory] + [InlineData(false)] + [InlineData(true)] + public static async Task AppendToEntry(bool writeWithSpans) { //append Stream testArchive = await StreamHelpers.CreateTempCopyStream(zfile("normal.zip")); @@ -143,12 +146,19 @@ namespace System.IO.Compression.Tests using (ZipArchive archive = new ZipArchive(testArchive, ZipArchiveMode.Update, true)) { ZipArchiveEntry e = archive.GetEntry("first.txt"); - - using (StreamWriter s = new StreamWriter(e.Open())) + using (Stream s = e.Open()) { - s.BaseStream.Seek(0, SeekOrigin.End); + s.Seek(0, SeekOrigin.End); - s.Write("\r\n\r\nThe answer my friend, is blowin' in the wind."); + byte[] data = Encoding.ASCII.GetBytes("\r\n\r\nThe answer my friend, is blowin' in the wind."); + if (writeWithSpans) + { + s.Write(data, 0, data.Length); + } + else + { + s.Write(new ReadOnlySpan(data)); + } } var file = FileData.GetFile(zmodified(Path.Combine("append", "first.txt"))); diff --git a/external/corefx/src/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln b/external/corefx/src/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln index b732004556..8b2d0ec22a 100644 --- a/external/corefx/src/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln +++ b/external/corefx/src/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl.sln @@ -30,10 +30,10 @@ Global {5915DD11-5D57-45A9-BFB0-56FEB7741E1F}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {5915DD11-5D57-45A9-BFB0-56FEB7741E1F}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU {5915DD11-5D57-45A9-BFB0-56FEB7741E1F}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU - {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {D77FBA6C-1AA6-45A4-93E2-97A370672C53}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {88A04AB0-F61E-4DD2-9E12-928DCA261263}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {88A04AB0-F61E-4DD2-9E12-928DCA261263}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {88A04AB0-F61E-4DD2-9E12-928DCA261263}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU diff --git a/external/corefx/src/System.IO.FileSystem.AccessControl/pkg/System.IO.FileSystem.AccessControl.pkgproj b/external/corefx/src/System.IO.FileSystem.AccessControl/pkg/System.IO.FileSystem.AccessControl.pkgproj index 011929572b..fdc93492c8 100644 --- a/external/corefx/src/System.IO.FileSystem.AccessControl/pkg/System.IO.FileSystem.AccessControl.pkgproj +++ b/external/corefx/src/System.IO.FileSystem.AccessControl/pkg/System.IO.FileSystem.AccessControl.pkgproj @@ -10,11 +10,7 @@ netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem.AccessControl/src/Configurations.props b/external/corefx/src/System.IO.FileSystem.AccessControl/src/Configurations.props index 7de94fe533..802d7df110 100644 --- a/external/corefx/src/System.IO.FileSystem.AccessControl/src/Configurations.props +++ b/external/corefx/src/System.IO.FileSystem.AccessControl/src/Configurations.props @@ -3,8 +3,8 @@ netfx-Windows_NT; - netcoreapp-Windows_NT; - netcoreapp-Unix; + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; netstandard; diff --git a/external/corefx/src/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx b/external/corefx/src/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx index 6a9497fc2c..6627b9f335 100644 --- a/external/corefx/src/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx +++ b/external/corefx/src/System.IO.FileSystem.AccessControl/src/Resources/Strings.resx @@ -1,5 +1,64 @@  + @@ -58,12 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - The access rule is not the correct type. - - - The audit rule is not the correct type. - The supplied handle is invalid. This can happen when trying to set an ACL on an anonymous kernel object. diff --git a/external/corefx/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj b/external/corefx/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj index 2482240f5e..bed54d05f4 100644 --- a/external/corefx/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj +++ b/external/corefx/src/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj @@ -7,15 +7,15 @@ System.IO.FileSystem.AccessControl {D77FBA6C-1AA6-45A4-93E2-97A370672C53} - true + true true SR.PlatformNotSupported_AccessControl - - - - + + + + diff --git a/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs b/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs index 8d58676005..65b155e679 100644 --- a/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs +++ b/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs @@ -60,7 +60,7 @@ namespace System.IO.FileSystem.DriveInfoTests Assert.Equal(invalidDriveName, invalidDrive.VolumeLabel); // VolumeLabel is equivalent to Name on Unix } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/dotnet/corefx/issues/11570 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/dotnet/corefx/issues/11570 [PlatformSpecific(TestPlatforms.AnyUnix)] public void PropertiesOfValidDrive() { diff --git a/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Windows.Tests.cs b/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Windows.Tests.cs index ec4cbdb4f4..ec841e5b22 100644 --- a/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Windows.Tests.cs +++ b/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Windows.Tests.cs @@ -80,7 +80,7 @@ namespace System.IO.FileSystem.DriveInfoTests Assert.NotNull(validDrive.Name); Assert.NotNull(validDrive.RootDirectory.Name); - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { Assert.Throws(() => validDrive.AvailableFreeSpace); Assert.Throws(() => validDrive.DriveFormat); @@ -218,7 +218,7 @@ namespace System.IO.FileSystem.DriveInfoTests } }; - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { Assert.Throws(() => DoDriveCheck()); } @@ -234,7 +234,7 @@ namespace System.IO.FileSystem.DriveInfoTests { DriveInfo drive = DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.Fixed).First(); // Inside an AppContainer access to VolumeLabel is denied. - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { Assert.Throws(() => drive.VolumeLabel); return; diff --git a/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj b/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj index 8faded10c4..47a347703c 100644 --- a/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj +++ b/external/corefx/src/System.IO.FileSystem.DriveInfo/tests/System.IO.FileSystem.DriveInfo.Tests.csproj @@ -12,9 +12,6 @@ - - Common\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/PinvokeAnalyzerExceptionList.analyzerdata.uap b/external/corefx/src/System.IO.FileSystem.Watcher/src/PinvokeAnalyzerExceptionList.analyzerdata.uap deleted file mode 100644 index 0719fa0f9d..0000000000 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/PinvokeAnalyzerExceptionList.analyzerdata.uap +++ /dev/null @@ -1,3 +0,0 @@ -## need to create a uap config that uses CreateFileFromApp, then remove this baseline ## -# https://github.com/dotnet/corefx/issues/21025 -kernel32.dll!CreateFileW \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/external/corefx/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index 6fe4526ccb..91f7d75d8f 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -41,9 +41,6 @@ Common\Interop\Windows\Interop.Libraries.cs - - Common\Interop\Windows\kernel32\Interop.CreateFile.cs - Common\Interop\Windows\Interop.BOOL.cs @@ -58,6 +55,30 @@ + + + + Common\Interop\Windows\Interop.UnsafeCreateFile.cs + + + Common\Interop\Windows\Interop.CreateFile.cs + + + + + + Common\Interop\Windows\Interop.CreateFile2.cs + + + Common\Interop\Windows\Interop.UnsafeCreateFile.uap.cs + + + Common\Interop\Windows\Interop.COPYFILE2_EXTENDED_PARAMETERS.cs + + + Common\Interop\Windows\Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs + + Common\Interop\Unix\Interop.Libraries.cs diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs index 6de6aba533..04cdfb9c2a 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs @@ -69,7 +69,7 @@ namespace System.IO // active operations to all be outstanding at the same time. var runner = new RunningInstance( this, handle, _directory, - IncludeSubdirectories, TranslateFilters(NotifyFilter), cancellation.Token); + IncludeSubdirectories, NotifyFilter, cancellation.Token); // Now that we've created the runner, store the cancellation object and mark the instance // as running. We wait to do this so that if there was a failure, StartRaisingEvents @@ -256,7 +256,8 @@ namespace System.IO /// /// Filters to use when adding a watch on directories. /// - private readonly Interop.Sys.NotifyEvents _notifyFilters; + private readonly NotifyFilters _notifyFilters; + private readonly Interop.Sys.NotifyEvents _watchFilters; /// /// Whether to monitor subdirectories. Unlike Win32, inotify does not implicitly monitor subdirectories; /// watches must be explicitly added for those subdirectories. @@ -282,7 +283,7 @@ namespace System.IO /// Initializes the instance with all state necessary to operate a watch. internal RunningInstance( FileSystemWatcher watcher, SafeFileHandle inotifyHandle, string directoryPath, - bool includeSubdirectories, Interop.Sys.NotifyEvents notifyFilters, CancellationToken cancellationToken) + bool includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken) { Debug.Assert(watcher != null); Debug.Assert(inotifyHandle != null && !inotifyHandle.IsInvalid && !inotifyHandle.IsClosed); @@ -295,6 +296,7 @@ namespace System.IO Debug.Assert(_buffer != null && _buffer.Length > (c_INotifyEventSize + NAME_MAX + 1)); _includeSubdirectories = includeSubdirectories; _notifyFilters = notifyFilters; + _watchFilters = TranslateFilters(notifyFilters); _cancellationToken = cancellationToken; // Add a watch for this starting directory. We keep track of the watch descriptor => directory information @@ -358,7 +360,7 @@ namespace System.IO // the existing descriptor. This works even in the case of a rename. We also add the DONT_FOLLOW // and EXCL_UNLINK flags to keep parity with Windows where we don't pickup symlinks or unlinked // files (which don't exist in Windows) - int wd = Interop.Sys.INotifyAddWatch(_inotifyHandle, fullPath, (uint)(this._notifyFilters | Interop.Sys.NotifyEvents.IN_DONT_FOLLOW | Interop.Sys.NotifyEvents.IN_EXCL_UNLINK)); + int wd = Interop.Sys.INotifyAddWatch(_inotifyHandle, fullPath, (uint)(this._watchFilters | Interop.Sys.NotifyEvents.IN_DONT_FOLLOW | Interop.Sys.NotifyEvents.IN_EXCL_UNLINK)); if (wd == -1) { // If we get an error when trying to add the watch, don't let that tear down processing. Instead, @@ -637,10 +639,21 @@ namespace System.IO AddDirectoryWatch(associatedDirectoryEntry, nextEvent.name); } - const Interop.Sys.NotifyEvents switchMask = - Interop.Sys.NotifyEvents.IN_IGNORED |Interop.Sys.NotifyEvents.IN_CREATE | Interop.Sys.NotifyEvents.IN_DELETE | - Interop.Sys.NotifyEvents.IN_ACCESS | Interop.Sys.NotifyEvents.IN_MODIFY | Interop.Sys.NotifyEvents.IN_ATTRIB | - Interop.Sys.NotifyEvents.IN_MOVED_FROM | Interop.Sys.NotifyEvents.IN_MOVED_TO; + // Check if the event should have been filtered but was unable because of inotify's inability + // to filter files vs directories. + const Interop.Sys.NotifyEvents fileDirEvents = Interop.Sys.NotifyEvents.IN_CREATE | + Interop.Sys.NotifyEvents.IN_DELETE | + Interop.Sys.NotifyEvents.IN_MOVED_FROM | + Interop.Sys.NotifyEvents.IN_MOVED_TO; + if ((((uint)fileDirEvents & mask) > 0) && + (isDir && ((_notifyFilters & NotifyFilters.DirectoryName) == 0) || + (!isDir && ((_notifyFilters & NotifyFilters.FileName) == 0)))) + { + continue; + } + + const Interop.Sys.NotifyEvents switchMask = fileDirEvents | Interop.Sys.NotifyEvents.IN_IGNORED | + Interop.Sys.NotifyEvents.IN_ACCESS | Interop.Sys.NotifyEvents.IN_MODIFY | Interop.Sys.NotifyEvents.IN_ATTRIB; switch ((Interop.Sys.NotifyEvents)(mask & (uint)switchMask)) { case Interop.Sys.NotifyEvents.IN_CREATE: diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs index 541ada33b4..a0b8ae9d18 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs @@ -27,7 +27,7 @@ namespace System.IO // Create handle to directory being monitored var defaultSecAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES); - _directoryHandle = Interop.Kernel32.CreateFile( + _directoryHandle = Interop.Kernel32.UnsafeCreateFile( lpFileName: _directory, dwDesiredAccess: Interop.Kernel32.FileOperations.FILE_LIST_DIRECTORY, dwShareMode: FileShare.Read | FileShare.Delete | FileShare.Write, diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs index f390e58913..fbcf20d35d 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs @@ -87,8 +87,6 @@ namespace System.IO.Tests WatcherChangeTypes expected = 0; if (filter == NotifyFilters.DirectoryName) expected |= WatcherChangeTypes.Renamed; - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && (filter == NotifyFilters.FileName)) - expected |= WatcherChangeTypes.Renamed; ExpectEvent(watcher, expected, action, cleanup, targetPath); } @@ -140,6 +138,33 @@ namespace System.IO.Tests } } + [Theory] + [OuterLoop] + [MemberData(nameof(FilterTypes))] + public void FileSystemWatcher_Directory_NotifyFilter_LastWriteTime_TwoFilters(NotifyFilters filter) + { + Assert.All(FilterTypes(), (filter2Arr => + { + using (var testDirectory = new TempDirectory(GetTestFilePath())) + using (var dir = new TempDirectory(Path.Combine(testDirectory.Path, "dir"))) + using (var watcher = new FileSystemWatcher(testDirectory.Path, Path.GetFileName(dir.Path))) + { + filter |= (NotifyFilters)filter2Arr[0]; + watcher.NotifyFilter = filter; + Action action = () => Directory.SetLastWriteTime(dir.Path, DateTime.Now + TimeSpan.FromSeconds(10)); + + WatcherChangeTypes expected = 0; + if ((filter & NotifyFilters.LastWrite) > 0) + expected |= WatcherChangeTypes.Changed; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && ((filter & LinuxFiltersForAttribute) > 0)) + expected |= WatcherChangeTypes.Changed; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && ((filter & OSXFiltersForModify) > 0)) + expected |= WatcherChangeTypes.Changed; + ExpectEvent(watcher, expected, action, expectedPath: dir.Path); + } + })); + } + [Theory] [MemberData(nameof(FilterTypes))] [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes to set security info @@ -255,5 +280,35 @@ namespace System.IO.Tests ExpectEvent(watcher, expected, action, cleanup, new string[] { otherDir, dir.Path }); } } + + [Fact] + public void FileSystemWatcher_Directory_NotifyFilter_DirectoryNameDoesntTriggerOnFileEvent() + { + using (var testDirectory = new TempDirectory(GetTestFilePath())) + using (var dir = new TempDirectory(Path.Combine(testDirectory.Path, "dir"))) + using (var watcher = new FileSystemWatcher(testDirectory.Path, "*")) + { + watcher.NotifyFilter = NotifyFilters.FileName; + string renameDirSource = Path.Combine(testDirectory.Path, "dir2_source"); + string renameDirDest = Path.Combine(testDirectory.Path, "dir2_dest"); + string otherDir = Path.Combine(testDirectory.Path, "dir3"); + Directory.CreateDirectory(renameDirSource); + + Action action = () => + { + Directory.CreateDirectory(otherDir); + Directory.Move(renameDirSource, renameDirDest); + Directory.SetLastWriteTime(dir.Path, DateTime.Now + TimeSpan.FromSeconds(10)); + Directory.Delete(otherDir); + }; + Action cleanup = () => + { + Directory.Move(renameDirDest, renameDirSource); + }; + + WatcherChangeTypes expected = 0; + ExpectEvent(watcher, expected, action, cleanup, new string[] { otherDir, dir.Path }); + } + } } } \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs index b9c8f44363..b14449b3c8 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Create.cs @@ -102,4 +102,4 @@ namespace System.IO.Tests } } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs index 30789b2546..991d42c296 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs @@ -91,9 +91,6 @@ namespace System.IO.Tests if (filter == NotifyFilters.DirectoryName) expected |= WatcherChangeTypes.Renamed; - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && (filter == NotifyFilters.FileName)) - expected |= WatcherChangeTypes.Renamed; - ExpectEvent(watcher, expected, action, cleanup, targetPath); } } @@ -167,6 +164,36 @@ namespace System.IO.Tests } } + [Theory] + [OuterLoop] + [MemberData(nameof(FilterTypes))] + public void FileSystemWatcher_File_NotifyFilter_Size_TwoFilters(NotifyFilters filter) + { + Assert.All(FilterTypes(), (filter2Arr => + { + using (var testDirectory = new TempDirectory(GetTestFilePath())) + using (var file = new TempFile(Path.Combine(testDirectory.Path, "file"))) + using (var watcher = new FileSystemWatcher(testDirectory.Path, Path.GetFileName(file.Path))) + { + filter |= (NotifyFilters)filter2Arr[0]; + watcher.NotifyFilter = filter; + Action action = () => File.AppendAllText(file.Path, "longText!"); + Action cleanup = () => File.AppendAllText(file.Path, "short"); + + WatcherChangeTypes expected = 0; + if (((filter & NotifyFilters.Size) > 0) || ((filter & NotifyFilters.LastWrite) > 0)) + expected |= WatcherChangeTypes.Changed; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && ((filter & LinuxFiltersForModify) > 0)) + expected |= WatcherChangeTypes.Changed; + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && ((filter & OSXFiltersForModify) > 0)) + expected |= WatcherChangeTypes.Changed; + else if (PlatformDetection.IsWindows7 && ((filter & NotifyFilters.Attributes) > 0)) // win7 FSW Size change passes the Attribute filter + expected |= WatcherChangeTypes.Changed; + ExpectEvent(watcher, expected, action, expectedPath: file.Path); + } + })); + } + [Theory] [MemberData(nameof(FilterTypes))] [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes to set security info @@ -281,5 +308,34 @@ namespace System.IO.Tests ExpectEvent(watcher, expected, action, cleanup, new string[] { otherFile, file.Path }); } } + + [Fact] + public void FileSystemWatcher_File_NotifyFilter_FileNameDoesntTriggerOnDirectoryEvent() + { + using (var testDirectory = new TempDirectory(GetTestFilePath())) + using (var file = new TempFile(Path.Combine(testDirectory.Path, "file"))) + using (var sourcePath = new TempFile(Path.Combine(testDirectory.Path, "sourceFile"))) + using (var watcher = new FileSystemWatcher(testDirectory.Path, "*")) + { + watcher.NotifyFilter = NotifyFilters.DirectoryName; + string otherFile = Path.Combine(testDirectory.Path, "file2"); + string destPath = Path.Combine(testDirectory.Path, "destFile"); + + Action action = () => + { + File.Create(otherFile).Dispose(); + File.SetLastWriteTime(file.Path, DateTime.Now + TimeSpan.FromSeconds(10)); + File.Delete(otherFile); + File.Move(sourcePath.Path, destPath); + }; + Action cleanup = () => + { + File.Move(destPath, sourcePath.Path); + }; + + WatcherChangeTypes expected = 0; + ExpectEvent(watcher, expected, action, cleanup, new string[] { otherFile, file.Path }); + } + } } } \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs index 1bf1a12a61..f9e7fa446d 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs @@ -497,7 +497,7 @@ namespace System.IO.Tests watcher.Path = "."; Assert.Equal(".", watcher.Path); - if (!PlatformDetection.IsWinRT) + if (!PlatformDetection.IsInAppContainer) { watcher.Path = ".."; Assert.Equal("..", watcher.Path); diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj b/external/corefx/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj index 4f6c267837..2b4989a1c1 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj @@ -43,9 +43,6 @@ Common\System\IO\TempDirectory.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs index 342f37b804..6614b83f67 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs @@ -202,26 +202,14 @@ namespace System.IO.Tests AutoResetEvent changed = null, created = null, deleted = null, renamed = null; string[] expectedFullPaths = expectedPaths == null ? null : expectedPaths.Select(e => Path.GetFullPath(e)).ToArray(); - // On OSX we get a number of extra events tacked onto valid events. As such, we can not ever confidently - // say that a event won't occur, only that one will occur. - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - if (verifyChanged = ((expectedEvents & WatcherChangeTypes.Changed) > 0)) - changed = WatchChanged(watcher, expectedPaths); - if (verifyCreated = ((expectedEvents & WatcherChangeTypes.Created) > 0)) - created = WatchCreated(watcher, expectedPaths); - if (verifyDeleted = ((expectedEvents & WatcherChangeTypes.Deleted) > 0)) - deleted = WatchDeleted(watcher, expectedPaths); - if (verifyRenamed = ((expectedEvents & WatcherChangeTypes.Renamed) > 0)) - renamed = WatchRenamed(watcher, expectedPaths); - } - else - { - changed = WatchChanged(watcher, (expectedEvents & WatcherChangeTypes.Changed) > 0 ? expectedPaths : null); - created = WatchCreated(watcher, (expectedEvents & WatcherChangeTypes.Created) > 0 ? expectedPaths : null); - deleted = WatchDeleted(watcher, (expectedEvents & WatcherChangeTypes.Deleted) > 0 ? expectedPaths : null); - renamed = WatchRenamed(watcher, (expectedEvents & WatcherChangeTypes.Renamed) > 0 ? expectedPaths : null); - } + if (verifyChanged = ((expectedEvents & WatcherChangeTypes.Changed) > 0)) + changed = WatchChanged(watcher, expectedPaths); + if (verifyCreated = ((expectedEvents & WatcherChangeTypes.Created) > 0)) + created = WatchCreated(watcher, expectedPaths); + if (verifyDeleted = ((expectedEvents & WatcherChangeTypes.Deleted) > 0)) + deleted = WatchDeleted(watcher, expectedPaths); + if (verifyRenamed = ((expectedEvents & WatcherChangeTypes.Renamed) > 0)) + renamed = WatchRenamed(watcher, expectedPaths); watcher.EnableRaisingEvents = true; action(); @@ -443,4 +431,4 @@ namespace System.IO.Tests NotifyFilters.LastWrite | NotifyFilters.Size; } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj b/external/corefx/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj index c604f2f0af..9160591924 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj +++ b/external/corefx/src/System.IO.FileSystem/src/System.IO.FileSystem.csproj @@ -6,11 +6,7 @@ System.IO.FileSystem true true - - false + true $(NoWarn);414 @@ -101,9 +97,6 @@ Common\Interop\Windows\Interop.SECURITY_ATTRIBUTES.cs - - Common\Interop\Windows\Interop.CreateDirectory.cs - Common\Interop\Windows\Interop.SecurityOptions.cs @@ -137,21 +130,9 @@ Common\Interop\Windows\Interop.WriteFile_IntPtr.cs - - Common\Interop\Windows\Interop.DeleteFile.cs - Common\Interop\Windows\Interop.SetFileInformationByHandle.cs - - Common\Interop\Windows\Interop.GetFileAttributesEx.cs - - - Common\Interop\Windows\Interop.SetFileAttributes.cs - - - Common\Interop\Windows\Interop.MoveFileEx.cs - Common\Interop\Windows\Interop.GetCurrentDirectory.cs @@ -161,12 +142,6 @@ Common\Interop\Windows\Interop.GetLongPathName.cs - - Common\Interop\Windows\Interop.RemoveDirectory.cs - - - Common\Interop\Windows\Interop.FindFirstFileEx.cs - Common\Interop\Windows\Interop.FindNextFile.cs @@ -188,61 +163,92 @@ Common\Interop\Windows\Interop.SafeCreateFile.cs + + Common\Interop\Windows\Interop.WIN32_FIND_DATA.cs + + + Common\Interop\Windows\Interop.FILE_TIME.cs + + + Common\Interop\Windows\Interop.FINDEX_INFO_LEVELS.cs + + + Common\Interop\Windows\Interop.FINDEX_SEARCH_OPS.cs + + + Common\Interop\Windows\Interop.WIN32_FILE_ATTRIBUTE_DATA.cs + + + Common\Interop\Windows\Interop.GET_FILEEX_INFO_LEVELS.cs + + + + + Common\Interop\Windows\Interop.SetThreadErrorMode.cs + + + Common\Interop\Windows\Interop.GetLogicalDrive.cs + + + Common\Interop\Windows\Interop.DeleteVolumeMountPoint.cs + + + Common\System\Memory\FixedBufferExtensions.cs + + + Common\Interop\Windows\Interop.DeleteFile.cs + + + Common\Interop\Windows\Interop.CreateDirectory.cs + + + Common\Interop\Windows\Interop.SetFileAttributes.cs + + + Common\Interop\Windows\Interop.MoveFileEx.cs + + + Common\Interop\Windows\Interop.GetFileAttributesEx.cs + + + Common\Interop\Windows\Interop.RemoveDirectory.cs + + + Common\Interop\Windows\Interop.FindFirstFileEx.cs + Common\Interop\Windows\Interop.ReplaceFile.cs + + Common\Interop\Windows\Interop.CopyFile.cs + + + Common\Interop\Windows\Interop.CopyFileEx.cs + Common\Interop\Windows\Interop.UnsafeCreateFile.cs - - Common\Interop\Windows\Interop.CopyFile.cs - - - Common\Interop\Windows\Interop.GetLogicalDrive.cs - - - Common\Interop\Windows\Interop.CreateFile.cs - - Common\Interop\Windows\Interop.CopyFileEx.cs - - - Common\Interop\Windows\Interop.DeleteVolumeMountPoint.cs - - - Common\Interop\Windows\Interop.SetThreadErrorMode.cs - - - - Common\Interop\Windows\Interop.UnsafeCreateFile.Uap.cs - - - Common\Interop\Windows\Interop.CopyFile.Uap.cs - - - Common\Interop\Windows\Interop.DeleteVolumeMountPoint.Uap.cs - - - Common\Interop\Windows\Interop.SetThreadErrorMode.Uap.cs - - - - - - - - Common\Interop\Windows\Interop.CopyFile2.cs - + Common\Interop\Windows\Interop.CreateFile2.cs + + Common\Interop\Windows\Interop.UnsafeCreateFile.uap.cs + + + Common\Interop\Windows\Interop.COPYFILE2_EXTENDED_PARAMETERS.cs + + + Common\Interop\Windows\Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs + @@ -362,6 +368,7 @@ + @@ -373,9 +380,5 @@ - - - - \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.Windows.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.Windows.cs index 351b0d5b77..4f14a8f050 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.Windows.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.Windows.cs @@ -11,9 +11,9 @@ namespace System.IO { [SecurityCritical] internal DirectoryInfo(string fullPath, ref Interop.Kernel32.WIN32_FIND_DATA findData) - : this(fullPath, findData.cFileName) + : this(fullPath, findData.cFileName.GetStringFromFixedBuffer()) { - Debug.Assert(string.Equals(findData.cFileName, Path.GetFileName(fullPath), StringComparison.Ordinal)); + Debug.Assert(findData.cFileName.FixedBufferEqualsString(Path.GetFileName(fullPath))); Init(ref findData); } } diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs index ca6261e8e7..aa10e8d883 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/DisableMediaInsertionPrompt.cs @@ -14,14 +14,16 @@ namespace System.IO /// prompt won't happen. You have to have had media in at least once to get /// the file system to load and then have removed it. /// - public sealed class DisableMediaInsertionPrompt : IDisposable + internal struct DisableMediaInsertionPrompt : IDisposable { private bool _disableSuccess; private uint _oldMode; - public DisableMediaInsertionPrompt() + public static DisableMediaInsertionPrompt Create() { - _disableSuccess = Interop.Kernel32.SetThreadErrorMode(Interop.Kernel32.SEM_FAILCRITICALERRORS, out _oldMode); + DisableMediaInsertionPrompt prompt = new DisableMediaInsertionPrompt(); + prompt._disableSuccess = Interop.Kernel32.SetThreadErrorMode(Interop.Kernel32.SEM_FAILCRITICALERRORS, out prompt._oldMode); + return prompt; } public void Dispose() diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/Error.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/Error.cs index c0fd1450e2..5be1939ece 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/Error.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/Error.cs @@ -16,25 +16,5 @@ namespace System.IO { return new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF); } - - internal static Exception GetFileNotOpen() - { - return new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed); - } - - internal static Exception GetReadNotSupported() - { - return new NotSupportedException(SR.NotSupported_UnreadableStream); - } - - internal static Exception GetSeekNotSupported() - { - return new NotSupportedException(SR.NotSupported_UnseekableStream); - } - - internal static Exception GetWriteNotSupported() - { - return new NotSupportedException(SR.NotSupported_UnwritableStream); - } } } diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/FileInfo.Windows.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/FileInfo.Windows.cs index a555c0bc23..5a4d18e6fb 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/FileInfo.Windows.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/FileInfo.Windows.cs @@ -11,9 +11,9 @@ namespace System.IO { [SecurityCritical] internal FileInfo(string fullPath, ref Interop.Kernel32.WIN32_FIND_DATA findData) - : this(fullPath, findData.cFileName) + : this(fullPath, findData.cFileName.GetStringFromFixedBuffer()) { - Debug.Assert(string.Equals(findData.cFileName, Path.GetFileName(fullPath), StringComparison.Ordinal)); + Debug.Assert(findData.cFileName.FixedBufferEqualsString(Path.GetFileName(fullPath))); Init(ref findData); } } diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/PathHelpers.Windows.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/PathHelpers.Windows.cs index 126c7e3836..06d3f21765 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/PathHelpers.Windows.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/PathHelpers.Windows.cs @@ -9,19 +9,19 @@ namespace System.IO internal static partial class PathHelpers { // Trim trailing whitespace, tabs etc but don't be aggressive in removing everything that has UnicodeCategory of trailing space. - // string.WhitespaceChars will trim more aggressively than what the underlying FS does (for ex, NTFS, FAT). + // string.WhitespaceChars will trim more aggressively than what the underlying FS does (for ex, NTFS, FAT). internal static readonly char[] TrimEndChars = { (char)0x9, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20, (char)0x85, (char)0xA0 }; internal static readonly char[] TrimStartChars = { ' ' }; internal static bool ShouldReviseDirectoryPathToCurrent(string path) { - // In situations where this method is invoked, ":" should be special-cased + // In situations where this method is invoked, ":" should be special-cased // to instead go to the current directory. return path.Length == 2 && path[1] == ':'; } // ".." can only be used if it is specified as a part of a valid File/Directory name. We disallow - // the user being able to use it to move up directories. Here are some examples eg + // the user being able to use it to move up directories. Here are some examples eg // Valid: a..b abc..d // Invalid: ..ab ab.. .. abc..d\abc.. // @@ -30,7 +30,7 @@ namespace System.IO for (int index = 0; (index = searchPattern.IndexOf("..", index, StringComparison.Ordinal)) != -1; index += 2) { // Terminal ".." or "..\". File and directory names cannot end in "..". - if (index + 2 == searchPattern.Length || + if (index + 2 == searchPattern.Length || PathInternal.IsDirectorySeparator(searchPattern[index + 2])) { throw new ArgumentException(SR.Arg_InvalidSearchPattern, nameof(searchPattern)); @@ -38,47 +38,6 @@ namespace System.IO } } - // this is a lightweight version of GetDirectoryName that doesn't renormalize - internal static string GetDirectoryNameInternal(string path) - { - string directory, file; - SplitDirectoryFile(path, out directory, out file); - - // file is null when we reach the root - return (file == null) ? null : directory; - } - - internal static void SplitDirectoryFile(string path, out string directory, out string file) - { - directory = null; - file = null; - - // assumes a validated full path - if (path != null) - { - int length = path.Length; - int rootLength = PathInternal.GetRootLength(path); - - // ignore a trailing slash - if (length > rootLength && EndsInDirectorySeparator(path)) - length--; - - // find the pivot index between end of string and root - for (int pivot = length - 1; pivot >= rootLength; pivot--) - { - if (PathInternal.IsDirectorySeparator(path[pivot])) - { - directory = path.Substring(0, pivot); - file = path.Substring(pivot + 1, length - pivot - 1); - return; - } - } - - // no pivot, return just the trimmed directory - directory = path.Substring(0, length); - } - } - internal static string NormalizeSearchPattern(string searchPattern) { Debug.Assert(searchPattern != null); diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystem.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystem.cs index 8e5b9d13bd..5e562b7cc0 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystem.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystem.cs @@ -46,11 +46,7 @@ namespace System.IO public override void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors) { - int flags = Interop.Kernel32.REPLACEFILE_WRITE_THROUGH; - if (ignoreMetadataErrors) - { - flags |= Interop.Kernel32.REPLACEFILE_IGNORE_MERGE_ERRORS; - } + int flags = ignoreMetadataErrors ? Interop.Kernel32.REPLACEFILE_IGNORE_MERGE_ERRORS : 0; if (!Interop.Kernel32.ReplaceFile(destFullPath, sourceFullPath, destBackupFullPath, flags, IntPtr.Zero, IntPtr.Zero)) { @@ -227,7 +223,7 @@ namespace System.IO // Neither GetFileAttributes or FindFirstFile like trailing separators path = path.TrimEnd(PathHelpers.DirectorySeparatorChars); - using (new DisableMediaInsertionPrompt()) + using (DisableMediaInsertionPrompt.Create()) { if (!Interop.Kernel32.GetFileAttributesEx(path, Interop.Kernel32.GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, ref data)) { @@ -421,180 +417,159 @@ namespace System.IO } return handle; } + public override void RemoveDirectory(string fullPath, bool recursive) { - // Do not recursively delete through reparse points. Perhaps in a - // future version we will add a new flag to control this behavior, - // but for now we're much safer if we err on the conservative side. - // This applies to symbolic links and mount points. + // Do not recursively delete through reparse points. + if (!recursive || IsReparsePoint(fullPath)) + { + RemoveDirectoryInternal(fullPath, topLevel: true); + return; + } + + // We want extended syntax so we can delete "extended" subdirectories and files + // (most notably ones with trailing whitespace or periods) + fullPath = PathInternal.EnsureExtendedPrefix(fullPath); + + Interop.Kernel32.WIN32_FIND_DATA findData = new Interop.Kernel32.WIN32_FIND_DATA(); + RemoveDirectoryRecursive(fullPath, ref findData, topLevel: true); + } + + private static bool IsReparsePoint(string fullPath) + { Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data = new Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA(); int errorCode = FillAttributeInfo(fullPath, ref data, returnErrorOnNotFound: true); - if (errorCode != 0) + if (errorCode != Interop.Errors.ERROR_SUCCESS) { - // Ensure we throw a DirectoryNotFoundException. + // File not found doesn't make much sense coming from a directory delete. if (errorCode == Interop.Errors.ERROR_FILE_NOT_FOUND) errorCode = Interop.Errors.ERROR_PATH_NOT_FOUND; throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath); } - if (((FileAttributes)data.fileAttributes & FileAttributes.ReparsePoint) != 0) - recursive = false; - - // We want extended syntax so we can delete "extended" subdirectories and files - // (most notably ones with trailing whitespace or periods) - RemoveDirectoryHelper(PathInternal.EnsureExtendedPrefix(fullPath), recursive, true); + return (((FileAttributes)data.fileAttributes & FileAttributes.ReparsePoint) != 0); } - [System.Security.SecurityCritical] // auto-generated - private static void RemoveDirectoryHelper(string fullPath, bool recursive, bool throwOnTopLevelDirectoryNotFound) + private static void RemoveDirectoryRecursive(string fullPath, ref Interop.Kernel32.WIN32_FIND_DATA findData, bool topLevel) { - bool r; int errorCode; - Exception ex = null; + Exception exception = null; - // Do not recursively delete through reparse points. Perhaps in a - // future version we will add a new flag to control this behavior, - // but for now we're much safer if we err on the conservative side. - // This applies to symbolic links and mount points. - // Note the logic to check whether fullPath is a reparse point is - // in Delete(string, string, bool), and will set "recursive" to false. - // Note that Win32's DeleteFile and RemoveDirectory will just delete - // the reparse point itself. - - if (recursive) + using (SafeFindHandle handle = Interop.Kernel32.FindFirstFile(Directory.EnsureTrailingDirectorySeparator(fullPath) + "*", ref findData)) { - Interop.Kernel32.WIN32_FIND_DATA data = new Interop.Kernel32.WIN32_FIND_DATA(); + if (handle.IsInvalid) + throw Win32Marshal.GetExceptionForLastWin32Error(fullPath); - // Open a Find handle - using (SafeFindHandle hnd = Interop.Kernel32.FindFirstFile(Directory.EnsureTrailingDirectorySeparator(fullPath) + "*", ref data)) + do { - if (hnd.IsInvalid) - throw Win32Marshal.GetExceptionForLastWin32Error(fullPath); - - do + if ((findData.dwFileAttributes & Interop.Kernel32.FileAttributes.FILE_ATTRIBUTE_DIRECTORY) == 0) { - bool isDir = (0 != (data.dwFileAttributes & Interop.Kernel32.FileAttributes.FILE_ATTRIBUTE_DIRECTORY)); - if (isDir) + // File + string fileName = findData.cFileName.GetStringFromFixedBuffer(); + if (!Interop.Kernel32.DeleteFile(Path.Combine(fullPath, fileName)) && exception == null) { - // Skip ".", "..". - if (data.cFileName.Equals(".") || data.cFileName.Equals("..")) - continue; + errorCode = Marshal.GetLastWin32Error(); - // Recurse for all directories, unless they are - // reparse points. Do not follow mount points nor - // symbolic links, but do delete the reparse point - // itself. - bool shouldRecurse = (0 == (data.dwFileAttributes & (int)FileAttributes.ReparsePoint)); - if (shouldRecurse) + // We don't care if something else deleted the file first + if (errorCode != Interop.Errors.ERROR_FILE_NOT_FOUND) { - string newFullPath = Path.Combine(fullPath, data.cFileName); - try - { - RemoveDirectoryHelper(newFullPath, recursive, false); - } - catch (Exception e) - { - if (ex == null) - ex = e; - } + exception = Win32Marshal.GetExceptionForWin32Error(errorCode, fileName); } - else - { - // Check to see if this is a mount point, and - // unmount it. - if (data.dwReserved0 == Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_MOUNT_POINT) - { - // Use full path plus a trailing '\' - string mountPoint = Path.Combine(fullPath, data.cFileName + PathHelpers.DirectorySeparatorCharAsString); - if (!Interop.Kernel32.DeleteVolumeMountPoint(mountPoint)) - { - errorCode = Marshal.GetLastWin32Error(); - - if (errorCode != Interop.Errors.ERROR_SUCCESS && - errorCode != Interop.Errors.ERROR_PATH_NOT_FOUND) - { - try - { - throw Win32Marshal.GetExceptionForWin32Error(errorCode, data.cFileName); - } - catch (Exception e) - { - if (ex == null) - ex = e; - } - } - } - } + } + } + else + { + // Directory, skip ".", "..". + if (findData.cFileName.FixedBufferEqualsString(".") || findData.cFileName.FixedBufferEqualsString("..")) + continue; - // RemoveDirectory on a symbolic link will - // remove the link itself. - string reparsePoint = Path.Combine(fullPath, data.cFileName); - r = Interop.Kernel32.RemoveDirectory(reparsePoint); - if (!r) - { - errorCode = Marshal.GetLastWin32Error(); - if (errorCode != Interop.Errors.ERROR_PATH_NOT_FOUND) - { - try - { - throw Win32Marshal.GetExceptionForWin32Error(errorCode, data.cFileName); - } - catch (Exception e) - { - if (ex == null) - ex = e; - } - } - } + string fileName = findData.cFileName.GetStringFromFixedBuffer(); + if ((findData.dwFileAttributes & (int)FileAttributes.ReparsePoint) == 0) + { + // Not a reparse point, recurse. + try + { + RemoveDirectoryRecursive( + Path.Combine(fullPath, fileName), + findData: ref findData, + topLevel: false); + } + catch (Exception e) + { + if (exception == null) + exception = e; } } else { - string fileName = Path.Combine(fullPath, data.cFileName); - r = Interop.Kernel32.DeleteFile(fileName); - if (!r) + // Reparse point, don't recurse, just remove. (dwReserved0 is documented for this flag) + if (findData.dwReserved0 == Interop.Kernel32.IOReparseOptions.IO_REPARSE_TAG_MOUNT_POINT) { - errorCode = Marshal.GetLastWin32Error(); - if (errorCode != Interop.Errors.ERROR_FILE_NOT_FOUND) + // Mount point. Unmount using full path plus a trailing '\'. + // (Note: This doesn't remove the underlying directory) + string mountPoint = Path.Combine(fullPath, fileName + PathHelpers.DirectorySeparatorCharAsString); + if (!Interop.Kernel32.DeleteVolumeMountPoint(mountPoint) && exception == null) { - try + errorCode = Marshal.GetLastWin32Error(); + if (errorCode != Interop.Errors.ERROR_SUCCESS && + errorCode != Interop.Errors.ERROR_PATH_NOT_FOUND) { - throw Win32Marshal.GetExceptionForWin32Error(errorCode, data.cFileName); - } - catch (Exception e) - { - if (ex == null) - ex = e; + exception = Win32Marshal.GetExceptionForWin32Error(errorCode, fileName); } } } - } - } while (Interop.Kernel32.FindNextFile(hnd, ref data)); - // Make sure we quit with a sensible error. - errorCode = Marshal.GetLastWin32Error(); - } - if (ex != null) - throw ex; - if (errorCode != 0 && errorCode != Interop.Errors.ERROR_NO_MORE_FILES) + // Note that RemoveDirectory on a symbolic link will remove the link itself. + if (!Interop.Kernel32.RemoveDirectory(Path.Combine(fullPath, fileName)) && exception == null) + { + errorCode = Marshal.GetLastWin32Error(); + if (errorCode != Interop.Errors.ERROR_PATH_NOT_FOUND) + { + exception = Win32Marshal.GetExceptionForWin32Error(errorCode, fileName); + } + } + } + } + } while (Interop.Kernel32.FindNextFile(handle, ref findData)); + + if (exception != null) + throw exception; + + errorCode = Marshal.GetLastWin32Error(); + if (errorCode != Interop.Errors.ERROR_SUCCESS && errorCode != Interop.Errors.ERROR_NO_MORE_FILES) throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath); } - r = Interop.Kernel32.RemoveDirectory(fullPath); + // As we successfully removed all of the files we shouldn't care about the directory itself + // not being empty. As file deletion is just a marker to remove the file when all handles + // are closed we could still have contents hanging around. + RemoveDirectoryInternal(fullPath, topLevel: topLevel, allowDirectoryNotEmpty: true); + } - if (!r) + private static void RemoveDirectoryInternal(string fullPath, bool topLevel, bool allowDirectoryNotEmpty = false) + { + if (!Interop.Kernel32.RemoveDirectory(fullPath)) { - errorCode = Marshal.GetLastWin32Error(); - if (errorCode == Interop.Errors.ERROR_FILE_NOT_FOUND) // A dubious error code. - errorCode = Interop.Errors.ERROR_PATH_NOT_FOUND; - // This check was originally put in for Win9x (unfortunately without special casing it to be for Win9x only). We can't change the NT codepath now for backcomp reasons. - if (errorCode == Interop.Errors.ERROR_ACCESS_DENIED) - throw new IOException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, fullPath)); - - // don't throw the DirectoryNotFoundException since this is a subdir and - // there could be a race condition between two Directory.Delete callers - if (errorCode == Interop.Errors.ERROR_PATH_NOT_FOUND && !throwOnTopLevelDirectoryNotFound) - return; + int errorCode = Marshal.GetLastWin32Error(); + switch (errorCode) + { + case Interop.Errors.ERROR_FILE_NOT_FOUND: + // File not found doesn't make much sense coming from a directory delete. + errorCode = Interop.Errors.ERROR_PATH_NOT_FOUND; + goto case Interop.Errors.ERROR_PATH_NOT_FOUND; + case Interop.Errors.ERROR_PATH_NOT_FOUND: + // We only throw for the top level directory not found, not for any contents. + if (!topLevel) + return; + break; + case Interop.Errors.ERROR_DIR_NOT_EMPTY: + if (allowDirectoryNotEmpty) + return; + break; + case Interop.Errors.ERROR_ACCESS_DENIED: + // This conversion was originally put in for Win9x. Keeping for compatibility. + throw new IOException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, fullPath)); + } throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath); } diff --git a/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystemEnumerable.cs b/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystemEnumerable.cs index cc1d3daf6d..ea46672197 100644 --- a/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystemEnumerable.cs +++ b/external/corefx/src/System.IO.FileSystem/src/System/IO/Win32FileSystemEnumerable.cs @@ -99,8 +99,8 @@ namespace System.IO private SafeFindHandle _hnd = null; // empty means we know in advance that we won?t find any search results, which can happen if: - // 1. we don?t have a search pattern - // 2. we?re enumerating only the top directory and found no matches during the first call + // 1. we don't have a search pattern + // 2. we're enumerating only the top directory and found no matches during the first call // This flag allows us to return early for these cases. We can?t know this in advance for // SearchOption.AllDirectories because we do a ?*? search for subdirs and then use the // searchPattern at each directory level. @@ -161,7 +161,7 @@ namespace System.IO Interop.Kernel32.WIN32_FIND_DATA data = new Interop.Kernel32.WIN32_FIND_DATA(); - using (new DisableMediaInsertionPrompt()) + using (DisableMediaInsertionPrompt.Create()) { // Open a Find handle _hnd = Interop.Kernel32.FindFirstFile(searchPath, ref data); @@ -287,6 +287,7 @@ namespace System.IO { Debug.Assert(_searchOption != SearchOption.TopDirectoryOnly, "should not reach this code path if searchOption == TopDirectoryOnly"); Debug.Assert(_searchList != null, "_searchList should not be null"); + // Traverse directory structure. We need to get '*' while (_searchList.Count > 0) { @@ -301,7 +302,7 @@ namespace System.IO // Execute searchCriteria against the current directory string searchPath = Path.Combine(_searchData.FullPath, _searchCriteria); - using (new DisableMediaInsertionPrompt()) + using (DisableMediaInsertionPrompt.Create()) { // Open a Find handle _hnd = Interop.Kernel32.FindFirstFile(searchPath, ref data); @@ -342,7 +343,7 @@ namespace System.IO { if (_hnd != null) { - using (new DisableMediaInsertionPrompt()) + using (DisableMediaInsertionPrompt.Create()) { // Keep asking for more matching files/dirs, add it to the list while (Interop.Kernel32.FindNextFile(_hnd, ref data)) @@ -398,7 +399,7 @@ namespace System.IO [SecurityCritical] private bool IsResultIncluded(ref Interop.Kernel32.WIN32_FIND_DATA findData, out TSource result) { - Debug.Assert(findData.cFileName.Length != 0 && !Path.IsPathRooted(findData.cFileName), + Debug.Assert(findData.cFileName.Length != 0 && !Path.IsPathRooted(findData.cFileName.GetStringFromFixedBuffer()), "Expected file system enumeration to not have empty file/directory name and not have rooted name"); return _resultHandler.IsResultIncluded(_searchData.FullPath, _searchData.UserPath, ref findData, out result); @@ -419,7 +420,7 @@ namespace System.IO Interop.Kernel32.WIN32_FIND_DATA data = new Interop.Kernel32.WIN32_FIND_DATA(); try { - using (new DisableMediaInsertionPrompt()) + using (DisableMediaInsertionPrompt.Create()) { // Get all files and dirs hnd = Interop.Kernel32.FindFirstFile(searchPath, ref data); @@ -450,11 +451,13 @@ namespace System.IO { if (Win32FileSystemEnumerableHelpers.IsDir(ref data)) { - Debug.Assert(data.cFileName.Length != 0 && !Path.IsPathRooted(data.cFileName), + string fileName = data.cFileName.GetStringFromFixedBuffer(); + + Debug.Assert(fileName.Length != 0 && !Path.IsPathRooted(fileName), "Expected file system enumeration to not have empty file/directory name and not have rooted name"); - string tempFullPath = Path.Combine(localSearchData.FullPath, data.cFileName); - string tempUserPath = Path.Combine(localSearchData.UserPath, data.cFileName); + string tempFullPath = Path.Combine(localSearchData.FullPath, fileName); + string tempUserPath = Path.Combine(localSearchData.UserPath, fileName); // Setup search data for the sub directory and push it into the list PathPair searchDataSubDir = new PathPair(tempUserPath, tempFullPath); @@ -565,7 +568,7 @@ namespace System.IO if ((_includeFiles && Win32FileSystemEnumerableHelpers.IsFile(ref findData)) || (_includeDirs && Win32FileSystemEnumerableHelpers.IsDir(ref findData))) { - result = Path.Combine(userPath, findData.cFileName); + result = Path.Combine(userPath, findData.cFileName.GetStringFromFixedBuffer()); return true; } @@ -581,7 +584,7 @@ namespace System.IO { if (Win32FileSystemEnumerableHelpers.IsFile(ref findData)) { - string fullPathFinal = Path.Combine(fullPath, findData.cFileName); + string fullPathFinal = Path.Combine(fullPath, findData.cFileName.GetStringFromFixedBuffer()); result = new FileInfo(fullPathFinal, ref findData); return true; } @@ -598,7 +601,7 @@ namespace System.IO { if (Win32FileSystemEnumerableHelpers.IsDir(ref findData)) { - string fullPathFinal = Path.Combine(fullPath, findData.cFileName); + string fullPathFinal = Path.Combine(fullPath, findData.cFileName.GetStringFromFixedBuffer()); result = new DirectoryInfo(fullPathFinal, ref findData); return true; } @@ -615,13 +618,13 @@ namespace System.IO { if (Win32FileSystemEnumerableHelpers.IsFile(ref findData)) { - string fullPathFinal = Path.Combine(fullPath, findData.cFileName); + string fullPathFinal = Path.Combine(fullPath, findData.cFileName.GetStringFromFixedBuffer()); result = new FileInfo(fullPathFinal, ref findData); return true; } else if (Win32FileSystemEnumerableHelpers.IsDir(ref findData)) { - string fullPathFinal = Path.Combine(fullPath, findData.cFileName); + string fullPathFinal = Path.Combine(fullPath, findData.cFileName.GetStringFromFixedBuffer()); result = new DirectoryInfo(fullPathFinal, ref findData); return true; } @@ -639,7 +642,7 @@ namespace System.IO { // Don't add "." nor ".." return (0 != (data.dwFileAttributes & Interop.Kernel32.FileAttributes.FILE_ATTRIBUTE_DIRECTORY)) - && !data.cFileName.Equals(".") && !data.cFileName.Equals(".."); + && !data.cFileName.FixedBufferEqualsString(".") && !data.cFileName.FixedBufferEqualsString(".."); } [SecurityCritical] // auto-generated diff --git a/external/corefx/src/System.IO.FileSystem/tests/Configurations.props b/external/corefx/src/System.IO.FileSystem/tests/Configurations.props index 742254e254..e245e48733 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/Configurations.props +++ b/external/corefx/src/System.IO.FileSystem/tests/Configurations.props @@ -6,6 +6,7 @@ netstandard-Windows_NT; netcoreapp-Unix; netcoreapp-Windows_NT; + uap-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.IO.FileSystem/tests/Directory/Delete.cs b/external/corefx/src/System.IO.FileSystem/tests/Directory/Delete.cs index 4974ed5e12..b7b9cb7176 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/Directory/Delete.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/Directory/Delete.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Text; using Xunit; using Xunit.NetCore.Extensions; @@ -207,6 +208,9 @@ namespace System.IO.Tests [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] public void Unix_NotFoundDirectory_ReadOnlyVolume() { + if (PlatformDetection.IsRedHat69) + return; // [ActiveIssue(https://github.com/dotnet/corefx/issues/21920)] + ReadOnly_FileSystemHelper(readOnlyDirectory => { Assert.Throws(() => Delete(Path.Combine(readOnlyDirectory, "DoesNotExist"))); @@ -249,6 +253,35 @@ namespace System.IO.Tests Assert.False(testDir.Exists); } + [Fact] + [ActiveIssue(24242)] + [PlatformSpecific(TestPlatforms.Windows)] + [OuterLoop("This test is very slow.")] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Desktop does not have the fix for #22596")] + public void RecursiveDelete_DeepNesting() + { + // Create a 2000 level deep directory and recursively delete from the root. + // This number can be dropped if we find it problematic on low memory machines + // and/or we can look at skipping in such environments. + // + // On debug we were overflowing the stack with directories that were under 1000 + // levels deep. Testing on a 32GB box I consistently fell over around 1300. + // With optimizations to the Delete helper I was able to raise this to around 3200. + // Release binaries don't stress the stack nearly as much (10K+ is doable, but can + // take 5 minutes on an SSD). + + string rootDirectory = GetTestFilePath(); + StringBuilder sb = new StringBuilder(5000); + sb.Append(rootDirectory); + for (int i = 0; i < 2000; i++) + { + sb.Append(@"\a"); + } + string path = sb.ToString(); + Directory.CreateDirectory(path); + Delete(rootDirectory, recursive: true); + } + [Fact] [PlatformSpecific(TestPlatforms.Windows)] // Recursive delete throws IOException if directory contains in-use file public void RecursiveDelete_ShouldThrowIOExceptionIfContainedFileInUse() diff --git a/external/corefx/src/System.IO.FileSystem/tests/Directory/GetFiles.cs b/external/corefx/src/System.IO.FileSystem/tests/Directory/GetFiles.cs index 3c4724334f..79c22762df 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/Directory/GetFiles.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/Directory/GetFiles.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Linq; -using System.Runtime.InteropServices; using Xunit; namespace System.IO.Tests @@ -42,6 +41,45 @@ namespace System.IO.Tests File.Delete(linkPath); Assert.Equal(0, GetEntries(containingFolder.FullName).Count()); } + + [ConditionalFact(nameof(AreAllLongPathsAvailable))] + public void EnumerateFilesOverLegacyMaxPath() + { + // We want to test that directories under the legacy MAX_PATH (260 characters, including the null) can iterate files + // even if the full path is over 260. + + string directory = IOServices.GetPath(GetTestFilePath(), 250); + Assert.Equal(250, directory.Length); + Assert.True(Directory.CreateDirectory(directory).Exists); + + for (int i = 0; i < 6; i++) + { + string testFile = Path.Combine(directory, new string((char)('0' + i), i + 7)); + File.Create(testFile).Dispose(); + } + + string[] files = GetEntries(directory); + Assert.Equal(6, files.Length); + } + + [ConditionalFact(nameof(AreAllLongPathsAvailable))] + public void EnumerateFilesDirectoryOverLegacyMaxPath() + { + // Check enumerating when the entire path is over MAX_PATH + + string directory = IOServices.GetPath(GetTestFilePath(), 270); + Assert.Equal(270, directory.Length); + Assert.True(Directory.CreateDirectory(directory).Exists); + + for (int i = 0; i < 6; i++) + { + string testFile = Path.Combine(directory, new string((char)('0' + i), i + 7)); + File.Create(testFile).Dispose(); + } + + string[] files = GetEntries(directory); + Assert.Equal(6, files.Length); + } } public class Directory_GetFiles_str_str : Directory_GetFileSystemEntries_str_str diff --git a/external/corefx/src/System.IO.FileSystem/tests/File/Copy.cs b/external/corefx/src/System.IO.FileSystem/tests/File/Copy.cs index 5f567f967c..036dedae6a 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/File/Copy.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/File/Copy.cs @@ -9,7 +9,7 @@ using Xunit; namespace System.IO.Tests { - public class File_Copy_str_str : FileSystemTest + public partial class File_Copy_str_str : FileSystemTest { #region Utilities @@ -184,7 +184,6 @@ namespace System.IO.Tests Assert.True(File.Exists(testFile)); Assert.True(File.Exists(Path.Combine(TestDirectory, valid))); } - #endregion } diff --git a/external/corefx/src/System.IO.FileSystem/tests/File/Delete.cs b/external/corefx/src/System.IO.FileSystem/tests/File/Delete.cs index 2c74a91b33..f6f7ade21f 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/File/Delete.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/File/Delete.cs @@ -129,6 +129,9 @@ namespace System.IO.Tests [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] public void Unix_NonExistentPath_ReadOnlyVolume() { + if (PlatformDetection.IsRedHat69) + return; // [ActiveIssue(https://github.com/dotnet/corefx/issues/21920)] + ReadOnly_FileSystemHelper(readOnlyDirectory => { Delete(Path.Combine(readOnlyDirectory, "DoesNotExist")); @@ -141,6 +144,9 @@ namespace System.IO.Tests [Trait(XunitConstants.Category, XunitConstants.RequiresElevation)] public void Unix_ExistingDirectory_ReadOnlyVolume() { + if (PlatformDetection.IsRedHat69) + return; // [ActiveIssue(https://github.com/dotnet/corefx/issues/21920)] + ReadOnly_FileSystemHelper(readOnlyDirectory => { Assert.Throws(() => Delete(Path.Combine(readOnlyDirectory, "subdir"))); diff --git a/external/corefx/src/System.IO.FileSystem/tests/File/Move.cs b/external/corefx/src/System.IO.FileSystem/tests/File/Move.cs index 18b7437ec5..bc1199e122 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/File/Move.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/File/Move.cs @@ -43,7 +43,7 @@ namespace System.IO.Tests Assert.Throws(() => Move(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), testFile.FullName)); } - [Theory MemberData(nameof(PathsWithInvalidCharacters))] + [Theory, MemberData(nameof(PathsWithInvalidCharacters))] public void PathWithIllegalCharacters(string invalidPath) { FileInfo testFile = new FileInfo(GetTestFilePath()); @@ -223,7 +223,7 @@ namespace System.IO.Tests #region PlatformSpecific - [Theory MemberData(nameof(PathsWithInvalidColons))] + [Theory, MemberData(nameof(PathsWithInvalidColons))] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Versions of netfx older than 4.6.2 throw an ArgumentException instead of NotSupportedException. Until all of our machines run netfx against the actual latest version, these will fail.")] public void WindowsPathWithIllegalColons(string invalidPath) diff --git a/external/corefx/src/System.IO.FileSystem/tests/FileStream/ReadWriteSpan.netcoreapp.cs b/external/corefx/src/System.IO.FileSystem/tests/FileStream/ReadWriteSpan.netcoreapp.cs new file mode 100644 index 0000000000..272b19769e --- /dev/null +++ b/external/corefx/src/System.IO.FileSystem/tests/FileStream/ReadWriteSpan.netcoreapp.cs @@ -0,0 +1,339 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public abstract class FileStream_ReadWrite_Span : FileSystemTest + { + protected abstract FileStream CreateFileStream(string path, FileMode mode, FileAccess access = FileAccess.ReadWrite); + + [Fact] + public void DisposedStream_ReadWrite_Throws() + { + var fs = CreateFileStream(GetTestFilePath(), FileMode.Create); + fs.Dispose(); + Assert.Throws(() => fs.Read(new Span(new byte[1]))); + Assert.Throws(() => fs.Write(new Span(new byte[1]))); + } + + [Fact] + public void EmptyFile_Read_Succeeds() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create)) + { + // use a recognizable pattern + var buffer = (byte[])TestBuffer.Clone(); + + Assert.Equal(0, fs.Read(Span.Empty)); + Assert.Equal(0, fs.Read(new Span(buffer, 0, 1))); + Assert.Equal(TestBuffer, buffer); + + Assert.Equal(0, fs.Read(new Span(buffer, 0, buffer.Length))); + Assert.Equal(TestBuffer, buffer); + + Assert.Equal(0, fs.Read(new Span(buffer, buffer.Length - 1, 1))); + Assert.Equal(TestBuffer, buffer); + + Assert.Equal(0, fs.Read(new Span(buffer, buffer.Length / 2, buffer.Length - buffer.Length / 2))); + Assert.Equal(TestBuffer, buffer); + } + } + + [Fact] + public void NonEmptyFile_Read_GetsExpectedData() + { + string fileName = GetTestFilePath(); + File.WriteAllBytes(fileName, TestBuffer); + + using (var fs = CreateFileStream(fileName, FileMode.Open)) + { + var buffer = new byte[TestBuffer.Length]; + Assert.Equal(TestBuffer.Length, fs.Read(new Span(buffer, 0, buffer.Length))); + Assert.Equal(TestBuffer, buffer); + + // Larger than needed buffer, read into beginning, rest remains untouched + fs.Position = 0; + buffer = new byte[TestBuffer.Length * 2]; + Assert.Equal(TestBuffer.Length, fs.Read(new Span(buffer))); + Assert.Equal(TestBuffer, buffer.Take(TestBuffer.Length)); + Assert.Equal(new byte[buffer.Length - TestBuffer.Length], buffer.Skip(TestBuffer.Length)); + + // Larger than needed buffer, read into middle, beginning and end remain untouched + fs.Position = 0; + buffer = new byte[TestBuffer.Length * 2]; + Assert.Equal(TestBuffer.Length, fs.Read(new Span(buffer, 2, buffer.Length - 2))); + Assert.Equal(TestBuffer, buffer.Skip(2).Take(TestBuffer.Length)); + Assert.Equal(new byte[2], buffer.Take(2)); + Assert.Equal(new byte[buffer.Length - TestBuffer.Length - 2], buffer.Skip(2 + TestBuffer.Length)); + } + } + + [Fact] + public void ReadOnly_Write_Throws() + { + string fileName = GetTestFilePath(); + File.WriteAllBytes(fileName, TestBuffer); + + using (var fs = CreateFileStream(fileName, FileMode.Open, FileAccess.Read)) + { + Assert.Throws(() => fs.Write(new Span(new byte[1]))); + fs.Dispose(); + Assert.Throws(() => fs.Write(new Span(new byte[1]))); // Disposed checking happens first + } + } + + [Fact] + public void WriteOnly_Read_Throws() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create, FileAccess.Write)) + { + Assert.Throws(() => fs.Read(new Span(new byte[1]))); + fs.Dispose(); + Assert.Throws(() => fs.Read(new Span(new byte[1]))); // Disposed checking happens first + } + } + + [Fact] + public void EmptyWrites_NoDataWritten() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create)) + { + fs.Write(Span.Empty); + Assert.Equal(0, fs.Length); + Assert.Equal(0, fs.Position); + } + } + + [Fact] + public void NonEmptyWrite_WritesExpectedData() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create)) + { + fs.Write(new Span(TestBuffer)); + Assert.Equal(TestBuffer.Length, fs.Length); + Assert.Equal(TestBuffer.Length, fs.Position); + + fs.Position = 0; + var buffer = new byte[TestBuffer.Length]; + Assert.Equal(TestBuffer.Length, fs.Read(new Span(buffer))); + Assert.Equal(TestBuffer, buffer); + } + } + + [Fact] + public void DisposedStream_ReadWriteAsync_Throws() + { + var fs = CreateFileStream(GetTestFilePath(), FileMode.Create); + fs.Dispose(); + Assert.Throws(() => { fs.ReadAsync(new Memory(new byte[1])); }); + Assert.Throws(() => { fs.WriteAsync(new ReadOnlyMemory(new byte[1])); }); + } + + [Fact] + public async Task EmptyFile_ReadAsync_Succeeds() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create)) + { + // use a recognizable pattern + var buffer = (byte[])TestBuffer.Clone(); + + Assert.Equal(0, await fs.ReadAsync(Memory.Empty)); + Assert.Equal(0, await fs.ReadAsync(new Memory(buffer, 0, 1))); + Assert.Equal(TestBuffer, buffer); + + Assert.Equal(0, await fs.ReadAsync(new Memory(buffer, 0, buffer.Length))); + Assert.Equal(TestBuffer, buffer); + + Assert.Equal(0, await fs.ReadAsync(new Memory(buffer, buffer.Length - 1, 1))); + Assert.Equal(TestBuffer, buffer); + + Assert.Equal(0, await fs.ReadAsync(new Memory(buffer, buffer.Length / 2, buffer.Length - buffer.Length / 2))); + Assert.Equal(TestBuffer, buffer); + } + } + + [Fact] + public async Task NonEmptyFile_ReadAsync_GetsExpectedData() + { + string fileName = GetTestFilePath(); + File.WriteAllBytes(fileName, TestBuffer); + + using (var fs = CreateFileStream(fileName, FileMode.Open)) + { + var buffer = new byte[TestBuffer.Length]; + Assert.Equal(TestBuffer.Length, await fs.ReadAsync(new Memory(buffer, 0, buffer.Length))); + Assert.Equal(TestBuffer, buffer); + + // Larger than needed buffer, read into beginning, rest remains untouched + fs.Position = 0; + buffer = new byte[TestBuffer.Length * 2]; + Assert.Equal(TestBuffer.Length, await fs.ReadAsync(new Memory(buffer))); + Assert.Equal(TestBuffer, buffer.Take(TestBuffer.Length)); + Assert.Equal(new byte[buffer.Length - TestBuffer.Length], buffer.Skip(TestBuffer.Length)); + + // Larger than needed buffer, read into middle, beginning and end remain untouched + fs.Position = 0; + buffer = new byte[TestBuffer.Length * 2]; + Assert.Equal(TestBuffer.Length, await fs.ReadAsync(new Memory(buffer, 2, buffer.Length - 2))); + Assert.Equal(TestBuffer, buffer.Skip(2).Take(TestBuffer.Length)); + Assert.Equal(new byte[2], buffer.Take(2)); + Assert.Equal(new byte[buffer.Length - TestBuffer.Length - 2], buffer.Skip(2 + TestBuffer.Length)); + } + } + + [Fact] + public void ReadOnly_WriteAsync_Throws() + { + string fileName = GetTestFilePath(); + File.WriteAllBytes(fileName, TestBuffer); + + using (var fs = CreateFileStream(fileName, FileMode.Open, FileAccess.Read)) + { + Assert.Throws(() => { fs.WriteAsync(new ReadOnlyMemory(new byte[1])); }); + fs.Dispose(); + Assert.Throws(() => { fs.WriteAsync(new ReadOnlyMemory(new byte[1])); }); // Disposed checking happens first + } + } + + [Fact] + public void WriteOnly_ReadAsync_Throws() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create, FileAccess.Write)) + { + Assert.Throws(() => { fs.ReadAsync(new Memory(new byte[1])); }); + fs.Dispose(); + Assert.Throws(() => { fs.ReadAsync(new Memory(new byte[1])); });// Disposed checking happens first + } + } + + [Fact] + public async Task EmptyWriteAsync_NoDataWritten() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create)) + { + await fs.WriteAsync(Memory.Empty); + Assert.Equal(0, fs.Length); + Assert.Equal(0, fs.Position); + } + } + + [Fact] + public async Task NonEmptyWriteAsync_WritesExpectedData() + { + using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create)) + { + await fs.WriteAsync(new Memory(TestBuffer)); + Assert.Equal(TestBuffer.Length, fs.Length); + Assert.Equal(TestBuffer.Length, fs.Position); + + fs.Position = 0; + var buffer = new byte[TestBuffer.Length]; + Assert.Equal(TestBuffer.Length, await fs.ReadAsync(new Memory(buffer))); + Assert.Equal(TestBuffer, buffer); + } + } + } + + public class Sync_FileStream_ReadWrite_Span : FileStream_ReadWrite_Span + { + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) => + new FileStream(path, mode, access, FileShare.None, 0x1000, FileOptions.None); + } + + public class Async_FileStream_ReadWrite_Span : FileStream_ReadWrite_Span + { + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) => + new FileStream(path, mode, access, FileShare.None, 0x1000, FileOptions.Asynchronous); + } + + public sealed class Sync_DerivedFileStream_ReadWrite_Span : Sync_FileStream_ReadWrite_Span + { + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) => + new DerivedFileStream(path, mode, access, FileShare.None, 0x1000, FileOptions.None); + + [Fact] + public void CallSpanReadWriteOnDerivedFileStream_ArrayMethodsUsed() + { + using (var fs = (DerivedFileStream)CreateFileStream(GetTestFilePath(), FileMode.Create, FileAccess.ReadWrite)) + { + Assert.False(fs.WriteArrayInvoked); + Assert.False(fs.ReadArrayInvoked); + + fs.Write(new ReadOnlySpan(new byte[1])); + Assert.True(fs.WriteArrayInvoked); + Assert.False(fs.ReadArrayInvoked); + + fs.Position = 0; + fs.Read(new Span(new byte[1])); + Assert.True(fs.WriteArrayInvoked); + Assert.True(fs.ReadArrayInvoked); + } + } + + [Fact] + public async Task CallMemoryReadWriteAsyncOnDerivedFileStream_ArrayMethodsUsed() + { + using (var fs = (DerivedFileStream)CreateFileStream(GetTestFilePath(), FileMode.Create, FileAccess.ReadWrite)) + { + Assert.False(fs.WriteAsyncArrayInvoked); + Assert.False(fs.ReadAsyncArrayInvoked); + + await fs.WriteAsync(new ReadOnlyMemory(new byte[1])); + Assert.True(fs.WriteAsyncArrayInvoked); + Assert.False(fs.ReadAsyncArrayInvoked); + + fs.Position = 0; + await fs.ReadAsync(new Memory(new byte[1])); + Assert.True(fs.WriteAsyncArrayInvoked); + Assert.True(fs.ReadAsyncArrayInvoked); + } + } + } + + public sealed class Async_DerivedFileStream_ReadWrite_Span : Async_FileStream_ReadWrite_Span + { + protected override FileStream CreateFileStream(string path, FileMode mode, FileAccess access) => + new DerivedFileStream(path, mode, access, FileShare.None, 0x1000, FileOptions.Asynchronous); + } + + internal sealed class DerivedFileStream : FileStream + { + public bool ReadArrayInvoked = false, WriteArrayInvoked = false; + public bool ReadAsyncArrayInvoked = false, WriteAsyncArrayInvoked = false; + + public DerivedFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) : + base(path, mode, access, share, bufferSize, options) + { + } + + public override int Read(byte[] array, int offset, int count) + { + ReadArrayInvoked = true; + return base.Read(array, offset, count); + } + + public override void Write(byte[] array, int offset, int count) + { + WriteArrayInvoked = true; + base.Write(array, offset, count); + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ReadAsyncArrayInvoked = true; + return base.ReadAsync(buffer, offset, count, cancellationToken); + } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + WriteAsyncArrayInvoked = true; + return base.WriteAsync(buffer, offset, count, cancellationToken); + } + } +} diff --git a/external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs b/external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs index bfe5e508d7..c3e0adfe30 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/FileStream/ctor_str_fm_fa_fs.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.IO; using Xunit; namespace System.IO.Tests @@ -117,5 +118,26 @@ namespace System.IO.Tests } } } + + [Theory] + [InlineData(FileMode.Create)] + [InlineData(FileMode.Truncate)] + public void NoTruncateOnFileShareViolation(FileMode fileMode) + { + string fileName = GetTestFilePath(); + + using (FileStream fs = CreateFileStream(fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) + { + fs.Write(new byte[] { 42 }, 0, 1); + fs.Flush(); + FSAssert.ThrowsSharingViolation(() => CreateFileStream(fileName, fileMode, FileAccess.Write, FileShare.None).Dispose()); + } + using (FileStream reader = CreateFileStream(fileName, FileMode.Open, FileAccess.Read)) + { + byte[] buf = new byte[1]; + Assert.Equal(1, reader.Read(buf, 0, 1)); + Assert.Equal(42, buf[0]); + } + } } } diff --git a/external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs b/external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs index 7fcae98914..4e593f27b8 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/FileSystemTest.cs @@ -61,7 +61,7 @@ namespace System.IO.Tests protected string GetNamedPipeServerStreamName() { - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { return @"LOCAL\" + Guid.NewGuid().ToString("N"); } diff --git a/external/corefx/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj b/external/corefx/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj index d2d398b95c..afcd6a3da8 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj +++ b/external/corefx/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj @@ -30,9 +30,6 @@ Common\System\IO\PathFeatures.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.IO.FileSystem/tests/PortedCommon/IOServices.cs b/external/corefx/src/System.IO.FileSystem/tests/PortedCommon/IOServices.cs index 41d8b5f1fe..6b45e65b5a 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/PortedCommon/IOServices.cs +++ b/external/corefx/src/System.IO.FileSystem/tests/PortedCommon/IOServices.cs @@ -228,7 +228,7 @@ internal class IOServices public static bool IsDriveNTFS(string drive) { - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { // we cannot determine filesystem so assume NTFS return true; diff --git a/external/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/external/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj index 0f878bfa16..1ecc4c4585 100644 --- a/external/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj +++ b/external/corefx/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj @@ -4,6 +4,7 @@ {F0D49126-6A1C-42D5-9428-4374C868BAF8} InnerLoop;OuterLoop + true @@ -13,6 +14,8 @@ + + @@ -49,6 +52,7 @@ + @@ -165,14 +169,15 @@ Common\System\IO\PathFeatures.cs - - Common\System\PlatformDetection.cs - {69e46a6f-9966-45a5-8945-2559fe337827} RemoteExecutorConsoleApp + + + + diff --git a/external/corefx/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.cs b/external/corefx/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.cs index 29ce5cbfab..79974e4da7 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.cs @@ -138,7 +138,7 @@ namespace System.IO.IsolatedStorage // We can save a bunch of work if the directory we want to create already exists. This also // saves us in the case where sub paths are inaccessible (due to ERROR_ACCESS_DENIED) but the - // final path is accessable and the directory already exists. For example, consider trying + // final path is accessible and the directory already exists. For example, consider trying // to create c:\Foo\Bar\Baz, where everything already exists but ACLS prevent access to c:\Foo // and c:\Foo\Bar. In that case, this code will think it needs to create c:\Foo, and c:\Foo\Bar // and fail to due so, causing an exception to be thrown. This is not what we want. diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj b/external/corefx/src/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj index 09c047a542..86f46c3702 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System.IO.IsolatedStorage.Tests.csproj @@ -53,9 +53,6 @@ Common\System\Security\IdentityHelper.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/ContainsUnknownFilesTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/ContainsUnknownFilesTests.cs index a8b5d44f85..35d48996ce 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/ContainsUnknownFilesTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/ContainsUnknownFilesTests.cs @@ -13,7 +13,7 @@ namespace System.IO.IsolatedStorage private static MethodInfo s_containsUnknownFilesMethod = typeof(IsolatedStorageFile).GetMethod("ContainsUnknownFiles", BindingFlags.NonPublic | BindingFlags.Instance); - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void ContainsUnknownFiles_CleanStore(PresetScopes scope) { @@ -25,7 +25,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void ContainsUnknownFiles_OkFiles(PresetScopes scope) { @@ -45,7 +45,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void ContainsUnknownFiles_NotOkFiles(PresetScopes scope) { @@ -68,7 +68,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void ContainsUnknownFiles_NotOkDirectory(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CopyFileTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CopyFileTests.cs index c3a9770de6..4409f63563 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CopyFileTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CopyFileTests.cs @@ -83,7 +83,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void CopyFile_CopyOver(PresetScopes scope) { @@ -100,7 +100,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void CopyFile_CopiesFile(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateDirectoryTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateDirectoryTests.cs index e391e0c228..be703cd30e 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateDirectoryTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateDirectoryTests.cs @@ -58,7 +58,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18268", TargetFrameworkMonikers.NetFramework)] public void CreateDirectory_Existance(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateFileTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateFileTests.cs index 09268409a8..ea81ed782f 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateFileTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/CreateFileTests.cs @@ -58,7 +58,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18268", TargetFrameworkMonikers.NetFramework)] public void CreateFile_Existence(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteDirectoryTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteDirectoryTests.cs index 8a47594b99..9f2481aa59 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteDirectoryTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteDirectoryTests.cs @@ -77,7 +77,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void DeleteDirectory_DeletesDirectory(PresetScopes scope) { @@ -105,7 +105,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void DeleteDirectory_CannotDeleteWithContent(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteFileTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteFileTests.cs index 52624591cd..2bdd937ddf 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteFileTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/DeleteFileTests.cs @@ -58,7 +58,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void DeleteFile_DeletesFile(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetFileNamesTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetFileNamesTests.cs index 78fb2f2c83..16d84a11d0 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetFileNamesTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetFileNamesTests.cs @@ -61,7 +61,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void GetFileNames_GetsFileNames(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetStoreTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetStoreTests.cs index 1f24180625..b9bbb621c9 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetStoreTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/GetStoreTests.cs @@ -18,7 +18,7 @@ namespace System.IO.IsolatedStorage s_verifyScopeMethod = typeof(IsolatedStorage).GetMethod("VerifyScope", BindingFlags.NonPublic | BindingFlags.Static); } - [Theory + [Theory, MemberData(nameof(ValidScopes)) ] public void InitStore_ValidScopes(IsolatedStorageScope scope) @@ -26,9 +26,9 @@ namespace System.IO.IsolatedStorage s_verifyScopeMethod.Invoke(null, new object[] { scope }); } - [Theory - InlineData(IsolatedStorageScope.None) - InlineData(IsolatedStorageScope.Machine | IsolatedStorageScope.Roaming) + [Theory, + InlineData(IsolatedStorageScope.None), + InlineData(IsolatedStorageScope.Machine | IsolatedStorageScope.Roaming), InlineData(IsolatedStorageScope.Machine | IsolatedStorageScope.User) ] public void InitStore_InvalidScopes(IsolatedStorageScope scope) diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/HelperTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/HelperTests.cs index d998dca8e1..1709c51a91 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/HelperTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/HelperTests.cs @@ -46,7 +46,7 @@ namespace System.IO.IsolatedStorage.Tests { // Machine scope is behind a policy that isn't enabled by default // https://github.com/dotnet/corefx/issues/19839 - if (scope == IsolatedStorageScope.Machine && PlatformDetection.IsWinRT) + if (scope == IsolatedStorageScope.Machine && PlatformDetection.IsInAppContainer) return; string path = Helper.GetDataDirectory(scope); diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IdentityTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IdentityTests.cs index 06d0c33c04..02513cf4e7 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IdentityTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IdentityTests.cs @@ -37,8 +37,8 @@ namespace System.IO.IsolatedStorage Assert.Throws(() => storage.DomainIdentity); } - [Theory - InlineData(IsolatedStorageScope.Application | IsolatedStorageScope.User) + [Theory, + InlineData(IsolatedStorageScope.Application | IsolatedStorageScope.User), InlineData(IsolatedStorageScope.Application | IsolatedStorageScope.User | IsolatedStorageScope.Roaming) // https://github.com/dotnet/corefx/issues/12628 // InlineData(IsolatedStorageScope.Application | IsolatedStorageScope.Machine) @@ -51,8 +51,8 @@ namespace System.IO.IsolatedStorage Assert.Throws(() => storage.DomainIdentity); } - [Theory - InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.User) + [Theory, + InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.User), InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.User | IsolatedStorageScope.Roaming) // https://github.com/dotnet/corefx/issues/12628 // InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine) @@ -65,8 +65,8 @@ namespace System.IO.IsolatedStorage Assert.Throws(() => storage.DomainIdentity); } - [Theory - InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.User | IsolatedStorageScope.Domain) + [Theory, + InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.User | IsolatedStorageScope.Domain), InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Domain) // https://github.com/dotnet/corefx/issues/12628 // InlineData(IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine | IsolatedStorageScope.Domain) diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IsoStorageTest.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IsoStorageTest.cs index 01b02ca156..7c401c00d6 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IsoStorageTest.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/IsoStorageTest.cs @@ -81,7 +81,7 @@ namespace System.IO.IsolatedStorage // https://github.com/dotnet/corefx/issues/12628 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - && !PlatformDetection.IsWinRT) + && !PlatformDetection.IsInAppContainer) { validScopes.Add(PresetScopes.MachineStoreForApplication); validScopes.Add(PresetScopes.MachineStoreForAssembly); @@ -95,7 +95,7 @@ namespace System.IO.IsolatedStorage /* * Template for Store test method * - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] public void ExampleTest(PresetScopes scope) { // If a dirty state will fail the test, use this diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveDirectoryTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveDirectoryTests.cs index 6bbf9c6ac9..624d640c19 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveDirectoryTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveDirectoryTests.cs @@ -79,7 +79,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void MoveDirectory_MoveOver(PresetScopes scope) { @@ -93,7 +93,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void MoveDirectory_MovesDirectory(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveFileTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveFileTests.cs index 818aeecff2..6895e367ab 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveFileTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/MoveFileTests.cs @@ -80,7 +80,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void MoveFile_MoveOver(PresetScopes scope) { @@ -94,7 +94,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void MoveFile_MovesFile(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/OpenFileTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/OpenFileTests.cs index 84fab2e035..bdd1a72eba 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/OpenFileTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/OpenFileTests.cs @@ -131,7 +131,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void OpenFile_Existence(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs index bd7556f64a..dae0afb8e8 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs @@ -59,7 +59,7 @@ namespace System.IO.IsolatedStorage } } - [Theory MemberData(nameof(ValidStores))] + [Theory, MemberData(nameof(ValidStores))] [ActiveIssue("dotnet/corefx #18265", TargetFrameworkMonikers.NetFramework)] public void RemoveStoreWithContent(PresetScopes scope) { diff --git a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.cs b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.cs index 0b99d04cc3..583b71a756 100644 --- a/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.cs +++ b/external/corefx/src/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.cs @@ -35,7 +35,7 @@ namespace System.IO.IsolatedStorage // https://github.com/dotnet/corefx/issues/12628 // https://github.com/dotnet/corefx/issues/19839 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - && !PlatformDetection.IsWinRT) + && !PlatformDetection.IsInAppContainer) { s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine)); } diff --git a/external/corefx/src/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs b/external/corefx/src/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs index 2c4800c492..6095bd6e22 100644 --- a/external/corefx/src/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs +++ b/external/corefx/src/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.Windows.cs @@ -13,7 +13,7 @@ namespace Microsoft.Win32.SafeHandles { IntPtr h = handle; handle = IntPtr.Zero; - return Interop.Kernel32.UnmapViewOfFile(h) != 0; + return Interop.Kernel32.UnmapViewOfFile(h); } } } diff --git a/external/corefx/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/external/corefx/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj index 9b57c2bd08..b7cd99bfd5 100644 --- a/external/corefx/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj +++ b/external/corefx/src/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj @@ -189,6 +189,7 @@ + diff --git a/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs b/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs index 38d4d411ac..24ea3a4658 100644 --- a/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs +++ b/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.Windows.cs @@ -14,7 +14,7 @@ namespace System.IO.MemoryMappedFiles { /// /// Used by the 2 Create factory method groups. A null fileHandle specifies that the - /// memory mapped file should not be associated with an exsiting file on disk (i.e. start + /// memory mapped file should not be associated with an existing file on disk (i.e. start /// out empty). /// @@ -146,7 +146,7 @@ namespace System.IO.MemoryMappedFiles } else { - ThreadSleep(waitSleep); + Thread.Sleep(waitSleep); waitSleep *= 2; } } @@ -256,13 +256,5 @@ namespace System.IO.MemoryMappedFiles } return secAttrs; } - - /// - /// Replacement for Thread.Sleep(milliseconds), which isn't available. - /// - internal static void ThreadSleep(int milliseconds) - { - new ManualResetEventSlim(initialState: false).Wait(milliseconds); - } } } diff --git a/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs b/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs index 711b40a0eb..5d203ea499 100644 --- a/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs +++ b/external/corefx/src/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs @@ -30,7 +30,7 @@ namespace System.IO.MemoryMappedFiles ulong nativeSize; long extraMemNeeded, newOffset; ValidateSizeAndOffset( - size, offset, GetSystemPageAllocationGranularity(), + size, offset, GetSystemPageAllocationGranularity(), out nativeSize, out extraMemNeeded, out newOffset); // if request is >= than total virtual, then MapViewOfFile will fail with meaningless error message @@ -107,9 +107,8 @@ namespace System.IO.MemoryMappedFiles { _viewHandle.AcquirePointer(ref firstPagePtr); - bool success = Interop.Kernel32.FlushViewOfFile((IntPtr)firstPagePtr, capacity) != 0; - if (success) - return; // This will visit the finally block. + if (Interop.Kernel32.FlushViewOfFile((IntPtr)firstPagePtr, capacity)) + return; // It is a known issue within the NTFS transaction log system that // causes FlushViewOfFile to intermittently fail with ERROR_LOCK_VIOLATION @@ -119,24 +118,25 @@ namespace System.IO.MemoryMappedFiles // this strategy successfully flushed the view after no more than 3 retries. int error = Marshal.GetLastWin32Error(); - bool canRetry = (!success && error == Interop.Errors.ERROR_LOCK_VIOLATION); + if (error != Interop.Errors.ERROR_LOCK_VIOLATION) + throw Win32Marshal.GetExceptionForWin32Error(error); SpinWait spinWait = new SpinWait(); - for (int w = 0; canRetry && w < MaxFlushWaits; w++) + for (int w = 0; w < MaxFlushWaits; w++) { int pause = (1 << w); // MaxFlushRetries should never be over 30 - MemoryMappedFile.ThreadSleep(pause); + Thread.Sleep(pause); - for (int r = 0; canRetry && r < MaxFlushRetriesPerWait; r++) + for (int r = 0; r < MaxFlushRetriesPerWait; r++) { - success = Interop.Kernel32.FlushViewOfFile((IntPtr)firstPagePtr, capacity) != 0; - if (success) - return; // This will visit the finally block. - - spinWait.SpinOnce(); + if (Interop.Kernel32.FlushViewOfFile((IntPtr)firstPagePtr, capacity)) + return; error = Marshal.GetLastWin32Error(); - canRetry = (error == Interop.Errors.ERROR_LOCK_VIOLATION); + if (error != Interop.Errors.ERROR_LOCK_VIOLATION) + throw Win32Marshal.GetExceptionForWin32Error(error); + + spinWait.SpinOnce(); } } diff --git a/external/corefx/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs b/external/corefx/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs index 867ee66ae2..1916d09836 100644 --- a/external/corefx/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs +++ b/external/corefx/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CrossProcess.cs @@ -27,7 +27,7 @@ namespace System.IO.MemoryMappedFiles.Tests acc.Flush(); // Spawn and then wait for the other process, which will verify the data and write its own known pattern - RemoteInvoke(DataShared_OtherProcess, file.Path).Dispose(); + RemoteInvoke(new Func(DataShared_OtherProcess), file.Path).Dispose(); // Now verify we're seeing the data from the other process for (int i = 0; i < capacity; i++) diff --git a/external/corefx/src/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj b/external/corefx/src/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj index 272fbf3c64..50e1d85d95 100644 --- a/external/corefx/src/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj +++ b/external/corefx/src/System.IO.MemoryMappedFiles/tests/System.IO.MemoryMappedFiles.Tests.csproj @@ -26,9 +26,6 @@ Common\System\IO\TempFile.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs b/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs index 117f067410..80efc16d11 100644 --- a/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs +++ b/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs @@ -147,7 +147,7 @@ namespace System.IO.Packaging /// ReadOnly /// Consider following Content type - /// type/subtype ; param1=value1 ; param2=value2 ; param3="value3" - /// This will return a enumerator over a dictionary of the parameter/value pairs. + /// This will return an enumerator over a dictionary of the parameter/value pairs. /// internal Dictionary.Enumerator ParameterValuePairs { diff --git a/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs b/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs index d95b1b4a82..6ad4b12f51 100644 --- a/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs +++ b/external/corefx/src/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs @@ -397,8 +397,8 @@ namespace System.IO.Packaging // If the binding is an assignment rather than an initialization, set the dirty flag. _dirty = !initializing; } - // Case of an initial value being set for a property. - else + // Case of an initial value being set for a property. If value is null, no need to do anything + else if (value != null) { _propertyDictionary.Add(propertyenum, value); // If the binding is an assignment rather than an initialization, set the dirty flag. diff --git a/external/corefx/src/System.IO.Packaging/tests/Tests.cs.REMOVED.git-id b/external/corefx/src/System.IO.Packaging/tests/Tests.cs.REMOVED.git-id index 9c3daf46f7..c80493d266 100644 --- a/external/corefx/src/System.IO.Packaging/tests/Tests.cs.REMOVED.git-id +++ b/external/corefx/src/System.IO.Packaging/tests/Tests.cs.REMOVED.git-id @@ -1 +1 @@ -e4d619fa97dd2761f3bac0c5185840082045446b \ No newline at end of file +87891326908725ee0e8de1f4e31d1a29b0404d04 \ No newline at end of file diff --git a/external/corefx/src/System.IO.Pipes.AccessControl/pkg/System.IO.Pipes.AccessControl.pkgproj b/external/corefx/src/System.IO.Pipes.AccessControl/pkg/System.IO.Pipes.AccessControl.pkgproj index a6a0a563b4..107007637e 100644 --- a/external/corefx/src/System.IO.Pipes.AccessControl/pkg/System.IO.Pipes.AccessControl.pkgproj +++ b/external/corefx/src/System.IO.Pipes.AccessControl/pkg/System.IO.Pipes.AccessControl.pkgproj @@ -10,11 +10,7 @@ netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/System.IO.Pipes.AccessControl/tests/System.IO.Pipes.AccessControl.Tests.csproj b/external/corefx/src/System.IO.Pipes.AccessControl/tests/System.IO.Pipes.AccessControl.Tests.csproj index b531986ec2..d7ed7f6aa9 100644 --- a/external/corefx/src/System.IO.Pipes.AccessControl/tests/System.IO.Pipes.AccessControl.Tests.csproj +++ b/external/corefx/src/System.IO.Pipes.AccessControl/tests/System.IO.Pipes.AccessControl.Tests.csproj @@ -11,9 +11,6 @@ - - Common\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.IO.Pipes/src/PinvokeAnalyzerExceptionList.analyzerdata b/external/corefx/src/System.IO.Pipes/src/PinvokeAnalyzerExceptionList.analyzerdata deleted file mode 100644 index 0719fa0f9d..0000000000 --- a/external/corefx/src/System.IO.Pipes/src/PinvokeAnalyzerExceptionList.analyzerdata +++ /dev/null @@ -1,3 +0,0 @@ -## need to create a uap config that uses CreateFileFromApp, then remove this baseline ## -# https://github.com/dotnet/corefx/issues/21025 -kernel32.dll!CreateFileW \ No newline at end of file diff --git a/external/corefx/src/System.IO.Pipes/src/System.IO.Pipes.csproj b/external/corefx/src/System.IO.Pipes/src/System.IO.Pipes.csproj index 7abd3d26fa..f0c917351b 100644 --- a/external/corefx/src/System.IO.Pipes/src/System.IO.Pipes.csproj +++ b/external/corefx/src/System.IO.Pipes/src/System.IO.Pipes.csproj @@ -95,9 +95,6 @@ Common\Interop\Windows\Interop.GetNamedPipeInfo.cs - - Common\Interop\Windows\Interop.CreateNamedPipeClient.cs - Common\Interop\Windows\Interop.SetNamedPipeHandleState.cs @@ -146,6 +143,21 @@ + + + + Common\Interop\Windows\Interop.CreateNamedPipeClient.cs + + + + + + Common\Interop\Windows\Interop.CreateNamedPipeClient.Uap.cs + + + Common\Interop\Windows\Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs + + diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ConnectionCompletionSource.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ConnectionCompletionSource.cs index 2966835eaf..7d12edb443 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ConnectionCompletionSource.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ConnectionCompletionSource.cs @@ -11,8 +11,8 @@ namespace System.IO.Pipes private readonly NamedPipeServerStream _serverStream; // Using RunContinuationsAsynchronously for compat reasons (old API used ThreadPool.QueueUserWorkItem for continuations) - internal ConnectionCompletionSource(NamedPipeServerStream server, CancellationToken cancellationToken) - : base(server._threadPoolBinding, cancellationToken, pinData: null) + internal ConnectionCompletionSource(NamedPipeServerStream server) + : base(server._threadPoolBinding, ReadOnlyMemory.Empty) { _serverStream = server; } diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs index 861ac5ed77..a48e5665dc 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs @@ -33,31 +33,6 @@ namespace System.IO.Pipes _pipeFlags |= (((int)_impersonationLevel - 1) << 16); } - if (!Interop.Kernel32.WaitNamedPipe(_normalizedPipePath, timeout)) - { - int errorCode = Marshal.GetLastWin32Error(); - - // Server is not yet created - if (errorCode == Interop.Errors.ERROR_FILE_NOT_FOUND) - { - return false; - } - - // The timeout has expired. - if (errorCode == Interop.Errors.ERROR_SUCCESS) - { - if (cancellationToken.CanBeCanceled) - { - // It may not be real timeout. - return false; - } - throw new TimeoutException(); - } - - throw Win32Marshal.GetExceptionForWin32Error(errorCode); - } - - // Pipe server should be free. Let's try to connect to it. int access = 0; if ((PipeDirection.In & _direction) != 0) { @@ -67,6 +42,8 @@ namespace System.IO.Pipes { access |= Interop.Kernel32.GenericOperations.GENERIC_WRITE; } + + // Let's try to connect first SafePipeHandle handle = Interop.Kernel32.CreateNamedPipeClient(_normalizedPipePath, access, // read and write access 0, // sharing: none @@ -79,14 +56,58 @@ namespace System.IO.Pipes { int errorCode = Marshal.GetLastWin32Error(); - // Handle the possible race condition of someone else connecting to the server - // between our calls to WaitNamedPipe & CreateFile. - if (errorCode == Interop.Errors.ERROR_PIPE_BUSY) + if (errorCode != Interop.Errors.ERROR_PIPE_BUSY && + errorCode != Interop.Errors.ERROR_FILE_NOT_FOUND) { - return false; + throw Win32Marshal.GetExceptionForWin32Error(errorCode); } - throw Win32Marshal.GetExceptionForWin32Error(errorCode); + if (!Interop.Kernel32.WaitNamedPipe(_normalizedPipePath, timeout)) + { + errorCode = Marshal.GetLastWin32Error(); + + // Server is not yet created + if (errorCode == Interop.Errors.ERROR_FILE_NOT_FOUND) + { + return false; + } + + // The timeout has expired. + if (errorCode == Interop.Errors.ERROR_SUCCESS) + { + if (cancellationToken.CanBeCanceled) + { + // It may not be real timeout. + return false; + } + throw new TimeoutException(); + } + + throw Win32Marshal.GetExceptionForWin32Error(errorCode); + } + + // Pipe server should be free. Let's try to connect to it. + handle = Interop.Kernel32.CreateNamedPipeClient(_normalizedPipePath, + access, // read and write access + 0, // sharing: none + ref secAttrs, // security attributes + FileMode.Open, // open existing + _pipeFlags, // impersonation flags + IntPtr.Zero); // template file: null + + if (handle.IsInvalid) + { + errorCode = Marshal.GetLastWin32Error(); + + // Handle the possible race condition of someone else connecting to the server + // between our calls to WaitNamedPipe & CreateFile. + if (errorCode == Interop.Errors.ERROR_PIPE_BUSY) + { + return false; + } + + throw Win32Marshal.GetExceptionForWin32Error(errorCode); + } } // Success! diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs index 4c0cf38304..f9b62ee23b 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs @@ -171,11 +171,11 @@ namespace System.IO.Pipes // now handle win32 impersonate/revert specific errors by throwing corresponding exceptions if (execHelper._impersonateErrorCode != 0) { - WinIOError(execHelper._impersonateErrorCode); + throw WinIOError(execHelper._impersonateErrorCode); } else if (execHelper._revertImpersonateErrorCode != 0) { - WinIOError(execHelper._revertImpersonateErrorCode); + throw WinIOError(execHelper._revertImpersonateErrorCode); } } @@ -248,7 +248,7 @@ namespace System.IO.Pipes throw new InvalidOperationException(SR.InvalidOperation_PipeNotAsync); } - var completionSource = new ConnectionCompletionSource(this, cancellationToken); + var completionSource = new ConnectionCompletionSource(this); if (!Interop.Kernel32.ConnectNamedPipe(InternalHandle, completionSource.Overlapped)) { @@ -280,7 +280,7 @@ namespace System.IO.Pipes } // If we are here then connection is pending. - completionSource.RegisterForCancellation(); + completionSource.RegisterForCancellation(cancellationToken); return completionSource.Task; } diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs index 7796871fac..9ca9e011df 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.Diagnostics; +using System.Runtime.InteropServices; using System.Security; using System.Threading; using System.Threading.Tasks; -using System.Runtime.InteropServices; namespace System.IO.Pipes { @@ -18,12 +19,12 @@ namespace System.IO.Pipes private const int RegisteringCancellation = 4; private const int CompletedCallback = 8; - private readonly CancellationToken _cancellationToken; private readonly ThreadPoolBoundHandle _threadPoolBinding; private CancellationTokenRegistration _cancellationRegistration; private int _errorCode; private NativeOverlapped* _overlapped; + private MemoryHandle _pinnedMemory; private int _state; #if DEBUG @@ -31,22 +32,22 @@ namespace System.IO.Pipes #endif // Using RunContinuationsAsynchronously for compat reasons (old API used ThreadPool.QueueUserWorkItem for continuations) - protected PipeCompletionSource(ThreadPoolBoundHandle handle, CancellationToken cancellationToken, object pinData) + protected PipeCompletionSource(ThreadPoolBoundHandle handle, ReadOnlyMemory bufferToPin) : base(TaskCreationOptions.RunContinuationsAsynchronously) { Debug.Assert(handle != null, "handle is null"); _threadPoolBinding = handle; - _cancellationToken = cancellationToken; _state = NoResult; + _pinnedMemory = bufferToPin.Retain(pin: true); _overlapped = _threadPoolBinding.AllocateNativeOverlapped((errorCode, numBytes, pOverlapped) => { var completionSource = (PipeCompletionSource)ThreadPoolBoundHandle.GetNativeOverlappedState(pOverlapped); Debug.Assert(completionSource.Overlapped == pOverlapped); completionSource.AsyncCallback(errorCode, numBytes); - }, this, pinData); + }, this, null); } internal NativeOverlapped* Overlapped @@ -54,7 +55,7 @@ namespace System.IO.Pipes [SecurityCritical]get { return _overlapped; } } - internal void RegisterForCancellation() + internal void RegisterForCancellation(CancellationToken cancellationToken) { #if DEBUG Debug.Assert(!_cancellationHasBeenRegistered, "Cannot register for cancellation twice"); @@ -62,14 +63,14 @@ namespace System.IO.Pipes #endif // Quick check to make sure that the cancellation token supports cancellation, and that the IO hasn't completed - if (_cancellationToken.CanBeCanceled && Overlapped != null) + if (cancellationToken.CanBeCanceled && Overlapped != null) { // Register the cancellation only if the IO hasn't completed int state = Interlocked.CompareExchange(ref _state, RegisteringCancellation, NoResult); if (state == NoResult) { // Register the cancellation - _cancellationRegistration = _cancellationToken.Register(thisRef => ((PipeCompletionSource)thisRef).Cancel(), this); + _cancellationRegistration = cancellationToken.Register(thisRef => ((PipeCompletionSource)thisRef).Cancel(), this); // Grab the state for case if IO completed while we were setting the registration. state = Interlocked.Exchange(ref _state, NoResult); @@ -96,11 +97,13 @@ namespace System.IO.Pipes // NOTE: The cancellation must *NOT* be running at this point, or it may observe freed memory // (this is why we disposed the registration above) - if (Overlapped != null) + if (_overlapped != null) { _threadPoolBinding.FreeNativeOverlapped(Overlapped); _overlapped = null; } + + _pinnedMemory.Dispose(); } internal abstract void SetCompletedSynchronously(); @@ -155,6 +158,7 @@ namespace System.IO.Pipes private void CompleteCallback(int resultState) { Debug.Assert(resultState == ResultSuccess || resultState == ResultError, "Unexpected result state " + resultState); + CancellationToken cancellationToken = _cancellationRegistration.Token; ReleaseResources(); @@ -162,14 +166,14 @@ namespace System.IO.Pipes { if (_errorCode == Interop.Errors.ERROR_OPERATION_ABORTED) { - if (_cancellationToken.CanBeCanceled && !_cancellationToken.IsCancellationRequested) + if (cancellationToken.CanBeCanceled && !cancellationToken.IsCancellationRequested) { HandleUnexpectedCancellation(); } else { // otherwise set canceled - TrySetCanceled(_cancellationToken); + TrySetCanceled(cancellationToken); } } else diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs index c6dce69dce..84fc05a8fb 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs @@ -88,9 +88,9 @@ namespace System.IO.Pipes // nop } - private unsafe int ReadCore(byte[] buffer, int offset, int count) + private unsafe int ReadCore(Span buffer) { - DebugAssertReadWriteArgs(buffer, offset, count, _handle); + DebugAssertHandleValid(_handle); // For named pipes, receive on the socket. Socket socket = _handle.NamedPipeSocket; @@ -102,7 +102,7 @@ namespace System.IO.Pipes // is already handled by Socket.Receive, so we use it here. try { - return socket.Receive(buffer, offset, count, SocketFlags.None); + return socket.Receive(buffer, SocketFlags.None); } catch (SocketException e) { @@ -111,18 +111,17 @@ namespace System.IO.Pipes } // For anonymous pipes, read from the file descriptor. - fixed (byte* bufPtr = buffer) + fixed (byte* bufPtr = &buffer.DangerousGetPinnableReference()) { - int result = CheckPipeCall(Interop.Sys.Read(_handle, bufPtr + offset, count)); - Debug.Assert(result <= count); - + int result = CheckPipeCall(Interop.Sys.Read(_handle, bufPtr, buffer.Length)); + Debug.Assert(result <= buffer.Length); return result; } } - private unsafe void WriteCore(byte[] buffer, int offset, int count) + private unsafe void WriteCore(ReadOnlySpan buffer) { - DebugAssertReadWriteArgs(buffer, offset, count, _handle); + DebugAssertHandleValid(_handle); // For named pipes, send to the socket. Socket socket = _handle.NamedPipeSocket; @@ -134,13 +133,10 @@ namespace System.IO.Pipes // Such a case is already handled by Socket.Send, so we use it here. try { - while (count > 0) + while (buffer.Length > 0) { - int bytesWritten = socket.Send(buffer, offset, count, SocketFlags.None); - Debug.Assert(bytesWritten <= count); - - count -= bytesWritten; - offset += bytesWritten; + int bytesWritten = socket.Send(buffer, SocketFlags.None); + buffer = buffer.Slice(bytesWritten); } } catch (SocketException e) @@ -150,48 +146,64 @@ namespace System.IO.Pipes } // For anonymous pipes, write the file descriptor. - fixed (byte* bufPtr = buffer) + fixed (byte* bufPtr = &buffer.DangerousGetPinnableReference()) { - while (count > 0) + while (buffer.Length > 0) { - int bytesWritten = CheckPipeCall(Interop.Sys.Write(_handle, bufPtr + offset, count)); - Debug.Assert(bytesWritten <= count); - - count -= bytesWritten; - offset += bytesWritten; + int bytesWritten = CheckPipeCall(Interop.Sys.Write(_handle, bufPtr, buffer.Length)); + buffer = buffer.Slice(bytesWritten); } } } - private async Task ReadAsyncCore(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + private async Task ReadAsyncCore(Memory destination, CancellationToken cancellationToken) { Debug.Assert(this is NamedPipeClientStream || this is NamedPipeServerStream, $"Expected a named pipe, got a {GetType()}"); Socket socket = InternalHandle.NamedPipeSocket; - // If a cancelable token is used, we have a choice: we can either ignore it and use a true async operation - // with Socket.ReceiveAsync, or we can use a polling loop on a worker thread to block for short intervals - // and check for cancellation in between. We do the latter. - if (cancellationToken.CanBeCanceled) - { - await Task.CompletedTask.ForceAsync(); // queue the remainder of the work to avoid blocking the caller - int timeout = 10000; - const int MaxTimeoutMicroseconds = 500000; - while (true) - { - cancellationToken.ThrowIfCancellationRequested(); - if (socket.Poll(timeout, SelectMode.SelectRead)) - { - return ReadCore(buffer, offset, count); - } - timeout = Math.Min(timeout * 2, MaxTimeoutMicroseconds); - } - } - - // The token wasn't cancelable, so we can simply use an async receive on the socket. try { - return await socket.ReceiveAsync(new ArraySegment(buffer, offset, count), SocketFlags.None).ConfigureAwait(false); + // TODO #22608: + // Remove all of this cancellation workaround once Socket.ReceiveAsync + // that accepts a CancellationToken is available. + + // If a cancelable token is used and there's no data, issue a zero-length read so that + // we're asynchronously notified when data is available, and concurrently monitor the + // supplied cancellation token. If cancellation is requested, we will end up "leaking" + // the zero-length read until data becomes available, at which point it'll be satisfied. + // But it's very rare to reuse a stream after an operation has been canceled, so even if + // we do incur such a situation, it's likely to be very short lived. + if (cancellationToken.CanBeCanceled) + { + cancellationToken.ThrowIfCancellationRequested(); + if (socket.Available == 0) + { + Task t = socket.ReceiveAsync(Array.Empty(), SocketFlags.None); + if (!t.IsCompletedSuccessfully) + { + var cancelTcs = new TaskCompletionSource(); + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetResult(true), cancelTcs)) + { + if (t == await Task.WhenAny(t, cancelTcs.Task).ConfigureAwait(false)) + { + t.GetAwaiter().GetResult(); // propagate any failure + } + cancellationToken.ThrowIfCancellationRequested(); + + // At this point there was data available. In the rare case where multiple concurrent + // ReadAsyncs are issued against the PipeStream, worst case is the reads that lose + // the race condition for the data will end up in a non-cancelable state as part of + // the actual async receive operation. + } + } + } + } + + // Issue the asynchronous read. + return await (destination.TryGetArray(out ArraySegment buffer) ? + socket.ReceiveAsync(buffer, SocketFlags.None) : + socket.ReceiveAsync(destination.ToArray(), SocketFlags.None)).ConfigureAwait(false); } catch (SocketException e) { @@ -199,11 +211,28 @@ namespace System.IO.Pipes } } - private async Task WriteAsyncCore(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + private async Task WriteAsyncCore(ReadOnlyMemory source, CancellationToken cancellationToken) { Debug.Assert(this is NamedPipeClientStream || this is NamedPipeServerStream, $"Expected a named pipe, got a {GetType()}"); try { + // TODO #22608: Remove this terribly inefficient special-case once Socket.SendAsync + // accepts a Memory in the near future. + byte[] buffer; + int offset, count; + if (source.DangerousTryGetArray(out ArraySegment segment)) + { + buffer = segment.Array; + offset = segment.Offset; + count = segment.Count; + } + else + { + buffer = source.ToArray(); + offset = 0; + count = buffer.Length; + } + while (count > 0) { // cancellationToken is (mostly) ignored. We could institute a polling loop like we do for reads if diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs index 1b870c844b..ade06d3870 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs @@ -54,10 +54,10 @@ namespace System.IO.Pipes } [SecurityCritical] - private unsafe int ReadCore(byte[] buffer, int offset, int count) + private unsafe int ReadCore(Span buffer) { int errorCode = 0; - int r = ReadFileNative(_handle, buffer, offset, count, null, out errorCode); + int r = ReadFileNative(_handle, buffer, null, out errorCode); if (r == -1) { @@ -81,16 +81,16 @@ namespace System.IO.Pipes } [SecuritySafeCritical] - private Task ReadAsyncCore(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + private Task ReadAsyncCore(Memory buffer, CancellationToken cancellationToken) { - var completionSource = new ReadWriteCompletionSource(this, buffer, cancellationToken, isWrite: false); + var completionSource = new ReadWriteCompletionSource(this, buffer, isWrite: false); // Queue an async ReadFile operation and pass in a packed overlapped int errorCode = 0; int r; unsafe { - r = ReadFileNative(_handle, buffer, offset, count, completionSource.Overlapped, out errorCode); + r = ReadFileNative(_handle, buffer.Span, completionSource.Overlapped, out errorCode); } // ReadFile, the OS version, will return 0 on failure, but this ReadFileNative wrapper @@ -131,15 +131,15 @@ namespace System.IO.Pipes } } - completionSource.RegisterForCancellation(); + completionSource.RegisterForCancellation(cancellationToken); return completionSource.Task; } [SecurityCritical] - private unsafe void WriteCore(byte[] buffer, int offset, int count) + private unsafe void WriteCore(ReadOnlySpan buffer) { int errorCode = 0; - int r = WriteFileNative(_handle, buffer, offset, count, null, out errorCode); + int r = WriteFileNative(_handle, buffer, null, out errorCode); if (r == -1) { @@ -149,16 +149,16 @@ namespace System.IO.Pipes } [SecuritySafeCritical] - private Task WriteAsyncCore(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + private Task WriteAsyncCore(ReadOnlyMemory buffer, CancellationToken cancellationToken) { - var completionSource = new ReadWriteCompletionSource(this, buffer, cancellationToken, isWrite: true); + var completionSource = new ReadWriteCompletionSource(this, buffer, isWrite: true); int errorCode = 0; // Queue an async WriteFile operation and pass in a packed overlapped int r; unsafe { - r = WriteFileNative(_handle, buffer, offset, count, completionSource.Overlapped, out errorCode); + r = WriteFileNative(_handle, buffer.Span, completionSource.Overlapped, out errorCode); } // WriteFile, the OS version, will return 0 on failure, but this WriteFileNative @@ -177,7 +177,7 @@ namespace System.IO.Pipes throw WinIOError(errorCode); } - completionSource.RegisterForCancellation(); + completionSource.RegisterForCancellation(cancellationToken); return completionSource.Task; } @@ -336,10 +336,9 @@ namespace System.IO.Pipes // ----------------------------- [SecurityCritical] - private unsafe int ReadFileNative(SafePipeHandle handle, byte[] buffer, int offset, int count, - NativeOverlapped* overlapped, out int errorCode) + private unsafe int ReadFileNative(SafePipeHandle handle, Span buffer, NativeOverlapped* overlapped, out int errorCode) { - DebugAssertReadWriteArgs(buffer, offset, count, handle); + DebugAssertHandleValid(handle); Debug.Assert((_isAsync && overlapped != null) || (!_isAsync && overlapped == null), "Async IO parameter screwup in call to ReadFileNative."); // You can't use the fixed statement on an array of length 0. Note that async callers @@ -353,43 +352,32 @@ namespace System.IO.Pipes int r = 0; int numBytesRead = 0; - fixed (byte* p = &buffer[0]) + fixed (byte* p = &buffer.DangerousGetPinnableReference()) { - if (_isAsync) - { - r = Interop.Kernel32.ReadFile(handle, p + offset, count, IntPtr.Zero, overlapped); - } - else - { - r = Interop.Kernel32.ReadFile(handle, p + offset, count, out numBytesRead, IntPtr.Zero); - } + r = _isAsync ? + Interop.Kernel32.ReadFile(handle, p, buffer.Length, IntPtr.Zero, overlapped) : + Interop.Kernel32.ReadFile(handle, p, buffer.Length, out numBytesRead, IntPtr.Zero); } if (r == 0) { - errorCode = Marshal.GetLastWin32Error(); - // In message mode, the ReadFile can inform us that there is more data to come. - if (errorCode == Interop.Errors.ERROR_MORE_DATA) - { - return numBytesRead; - } - - return -1; + errorCode = Marshal.GetLastWin32Error(); + return errorCode == Interop.Errors.ERROR_MORE_DATA ? + numBytesRead : + -1; } else { errorCode = 0; + return numBytesRead; } - - return numBytesRead; } [SecurityCritical] - private unsafe int WriteFileNative(SafePipeHandle handle, byte[] buffer, int offset, int count, - NativeOverlapped* overlapped, out int errorCode) + private unsafe int WriteFileNative(SafePipeHandle handle, ReadOnlySpan buffer, NativeOverlapped* overlapped, out int errorCode) { - DebugAssertReadWriteArgs(buffer, offset, count, handle); + DebugAssertHandleValid(handle); Debug.Assert((_isAsync && overlapped != null) || (!_isAsync && overlapped == null), "Async IO parameter screwup in call to WriteFileNative."); // You can't use the fixed statement on an array of length 0. Note that async callers @@ -400,19 +388,14 @@ namespace System.IO.Pipes return 0; } - int numBytesWritten = 0; int r = 0; + int numBytesWritten = 0; - fixed (byte* p = &buffer[0]) + fixed (byte* p = &buffer.DangerousGetPinnableReference()) { - if (_isAsync) - { - r = Interop.Kernel32.WriteFile(handle, p + offset, count, IntPtr.Zero, overlapped); - } - else - { - r = Interop.Kernel32.WriteFile(handle, p + offset, count, out numBytesWritten, IntPtr.Zero); - } + r = _isAsync ? + Interop.Kernel32.WriteFile(handle, p, buffer.Length, IntPtr.Zero, overlapped) : + Interop.Kernel32.WriteFile(handle, p, buffer.Length, out numBytesWritten, IntPtr.Zero); } if (r == 0) @@ -423,9 +406,8 @@ namespace System.IO.Pipes else { errorCode = 0; + return numBytesWritten; } - - return numBytesWritten; } [SecurityCritical] diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs index 394ace2808..928ad8a18a 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs @@ -126,7 +126,23 @@ namespace System.IO.Pipes } CheckReadOperations(); - return ReadCore(buffer, offset, count); + return ReadCore(new Span(buffer, offset, count)); + } + + public override int Read(Span destination) + { + if (_isAsync) + { + return base.Read(destination); + } + + if (!CanRead) + { + throw Error.GetReadNotSupported(); + } + CheckReadOperations(); + + return ReadCore(destination); } [SecuritySafeCritical] @@ -156,7 +172,35 @@ namespace System.IO.Pipes return s_zeroTask; } - return ReadAsyncCore(buffer, offset, count, cancellationToken); + return ReadAsyncCore(new Memory(buffer, offset, count), cancellationToken); + } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) + { + if (!_isAsync) + { + return base.ReadAsync(destination, cancellationToken); + } + + if (!CanRead) + { + throw Error.GetReadNotSupported(); + } + + if (cancellationToken.IsCancellationRequested) + { + return new ValueTask(Task.FromCanceled(cancellationToken)); + } + + CheckReadOperations(); + + if (destination.Length == 0) + { + UpdateMessageCompletion(false); + return new ValueTask(0); + } + + return new ValueTask(ReadAsyncCore(destination, cancellationToken)); } public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) @@ -191,7 +235,24 @@ namespace System.IO.Pipes } CheckWriteOperations(); - WriteCore(buffer, offset, count); + WriteCore(new ReadOnlySpan(buffer, offset, count)); + } + + public override void Write(ReadOnlySpan source) + { + if (_isAsync) + { + base.Write(source); + return; + } + + if (!CanWrite) + { + throw Error.GetWriteNotSupported(); + } + CheckWriteOperations(); + + WriteCore(source); } [SecuritySafeCritical] @@ -220,7 +281,34 @@ namespace System.IO.Pipes return Task.CompletedTask; } - return WriteAsyncCore(buffer, offset, count, cancellationToken); + return WriteAsyncCore(new ReadOnlyMemory(buffer, offset, count), cancellationToken); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) + { + if (!_isAsync) + { + return base.WriteAsync(source, cancellationToken); + } + + if (!CanWrite) + { + throw Error.GetWriteNotSupported(); + } + + if (cancellationToken.IsCancellationRequested) + { + return Task.FromCanceled(cancellationToken); + } + + CheckWriteOperations(); + + if (source.Length == 0) + { + return Task.CompletedTask; + } + + return WriteAsyncCore(source, cancellationToken); } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) @@ -251,6 +339,13 @@ namespace System.IO.Pipes throw new ArgumentException(SR.Argument_InvalidOffLen); } + [Conditional("DEBUG")] + private static void DebugAssertHandleValid(SafePipeHandle handle) + { + Debug.Assert(handle != null, "handle is null"); + Debug.Assert(!handle.IsClosed, "handle is closed"); + } + [Conditional("DEBUG")] private static void DebugAssertReadWriteArgs(byte[] buffer, int offset, int count, SafePipeHandle handle) { @@ -258,35 +353,22 @@ namespace System.IO.Pipes Debug.Assert(offset >= 0, "offset is negative"); Debug.Assert(count >= 0, "count is negative"); Debug.Assert(offset <= buffer.Length - count, "offset + count is too big"); - Debug.Assert(handle != null, "handle is null"); - Debug.Assert(!handle.IsClosed, "handle is closed"); - } - - [ThreadStatic] - private static byte[] t_singleByteArray; - - private static byte[] SingleByteArray - { - get { return t_singleByteArray ?? (t_singleByteArray = new byte[1]); } + DebugAssertHandleValid(handle); } // Reads a byte from the pipe stream. Returns the byte cast to an int // or -1 if the connection has been broken. [SecurityCritical] - public override int ReadByte() + public override unsafe int ReadByte() { - byte[] buffer = SingleByteArray; - return Read(buffer, 0, 1) > 0 ? - buffer[0] : - -1; + byte b; + return Read(new Span(&b, 1)) > 0 ? b : -1; } [SecurityCritical] - public override void WriteByte(byte value) + public override unsafe void WriteByte(byte value) { - byte[] buffer = SingleByteArray; - buffer[0] = value; - Write(buffer, 0, 1); + Write(new ReadOnlySpan(&value, 1)); } // Does nothing on PipeStreams. We cannot call Interop.FlushFileBuffers here because we can deadlock diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ReadWriteCompletionSource.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ReadWriteCompletionSource.cs index 174aba72e3..cac234a3bf 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ReadWriteCompletionSource.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ReadWriteCompletionSource.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics; using System.Threading; namespace System.IO.Pipes @@ -15,11 +14,9 @@ namespace System.IO.Pipes private bool _isMessageComplete; private int _numBytes; // number of buffer read OR written - internal ReadWriteCompletionSource(PipeStream stream, byte[] buffer, CancellationToken cancellationToken, bool isWrite) - : base(stream._threadPoolBinding, cancellationToken, pinData: buffer) + internal ReadWriteCompletionSource(PipeStream stream, ReadOnlyMemory bufferToPin, bool isWrite) + : base(stream._threadPoolBinding, bufferToPin) { - Debug.Assert(buffer != null, "buffer is null"); - _pipeStream = stream; _isWrite = isWrite; _isMessageComplete = true; diff --git a/external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs b/external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs index b35086fa31..69d0a2ab2c 100644 --- a/external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs +++ b/external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs @@ -79,7 +79,7 @@ namespace System.IO.Pipes.Tests } } - [Fact] + [ConditionalFact(typeof(PlatformDetection), "IsNotRedHat69")] [PlatformSpecific(TestPlatforms.Linux)] // On Linux, setting the buffer size of the server will also set the buffer size of the client public static void Linux_BufferSizeRoundtrips() { diff --git a/external/corefx/src/System.IO.Pipes/tests/Configurations.props b/external/corefx/src/System.IO.Pipes/tests/Configurations.props index cfc57211a4..742254e254 100644 --- a/external/corefx/src/System.IO.Pipes/tests/Configurations.props +++ b/external/corefx/src/System.IO.Pipes/tests/Configurations.props @@ -4,6 +4,8 @@ netstandard-Unix; netstandard-Windows_NT; + netcoreapp-Unix; + netcoreapp-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs index 9df741d1bf..482d5f5910 100644 --- a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs +++ b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CrossProcess.cs @@ -88,7 +88,7 @@ namespace System.IO.Pipes.Tests private static string GetUniquePipeName() { - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { return @"LOCAL\" + Path.GetRandomFileName(); } diff --git a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Read.cs b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Read.cs index 0585223659..c55abab909 100644 --- a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Read.cs +++ b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Read.cs @@ -67,8 +67,7 @@ namespace System.IO.Pipes.Tests return ret; } - // InOut pipes can be written/read from either direction - public override void WriteToReadOnlyPipe_Throws_NotSupportedException() { } + public override bool SupportsBidirectionalReadingWriting => true; } [ActiveIssue(22271, TargetFrameworkMonikers.UapNotUapAot)] @@ -90,7 +89,6 @@ namespace System.IO.Pipes.Tests return ret; } - // InOut pipes can be written/read from either direction - public override void WriteToReadOnlyPipe_Throws_NotSupportedException() { } + public override bool SupportsBidirectionalReadingWriting => true; } } diff --git a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Windows.cs b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Windows.cs index a3e56015e7..479b01cc0a 100644 --- a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.RunAsClient.Windows.cs @@ -13,14 +13,19 @@ namespace System.IO.Pipes.Tests { public partial class NamedPipeTest_RunAsClient : RemoteExecutorTestBase { - [Fact] + [Theory] + [InlineData(TokenImpersonationLevel.None)] + [InlineData(TokenImpersonationLevel.Anonymous)] + [InlineData(TokenImpersonationLevel.Identification)] + [InlineData(TokenImpersonationLevel.Impersonation)] + [InlineData(TokenImpersonationLevel.Delegation)] [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes [ActiveIssue(22271, TargetFrameworkMonikers.UapNotUapAot)] - public async Task RunAsClient_Windows() + public async Task RunAsClient_Windows(TokenImpersonationLevel tokenImpersonationLevel) { string pipeName = GetUniquePipeName(); using (var server = new NamedPipeServerStream(pipeName)) - using (var client = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation)) + using (var client = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.None, tokenImpersonationLevel)) { Task serverTask = server.WaitForConnectionAsync(); @@ -28,14 +33,22 @@ namespace System.IO.Pipes.Tests await serverTask; bool ran = false; - server.RunAsClient(() => ran = true); - Assert.True(ran, "Expected delegate to have been invoked"); + if (tokenImpersonationLevel == TokenImpersonationLevel.None) + { + Assert.Throws(() => server.RunAsClient(() => ran = true)); + Assert.False(ran, "Expected delegate to not have been invoked"); + } + else + { + server.RunAsClient(() => ran = true); + Assert.True(ran, "Expected delegate to have been invoked"); + } } } private static string GetUniquePipeName() { - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { return @"LOCAL\" + Path.GetRandomFileName(); } diff --git a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs index 77ca84565f..fde032b1f3 100644 --- a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs +++ b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs @@ -365,7 +365,7 @@ namespace System.IO.Pipes.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1011 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/1011 [PlatformSpecific(TestPlatforms.AnyUnix)] // Unix implemented on sockets, where disposal information doesn't propagate public async Task Unix_OperationsOnNamedServerWithDisposedClient() { diff --git a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs index 598c2212db..caaf0a8179 100644 --- a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs +++ b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs @@ -80,7 +80,7 @@ namespace System.IO.Pipes.Tests [InlineData(PipeOptions.None)] [InlineData(PipeOptions.Asynchronous)] [PlatformSpecific(TestPlatforms.Windows)] // Unix currently doesn't support message mode - public async Task Windows_MessagePipeTransissionMode(PipeOptions serverOptions) + public void Windows_MessagePipeTransmissionMode(PipeOptions serverOptions) { byte[] msg1 = new byte[] { 5, 7, 9, 10 }; byte[] msg2 = new byte[] { 2, 4 }; @@ -99,10 +99,10 @@ namespace System.IO.Pipes.Tests server.ReadMode = PipeTransmissionMode.Message; Assert.Equal(PipeTransmissionMode.Message, server.ReadMode); + client.Connect(); + Task clientTask = Task.Run(() => { - client.Connect(); - client.Write(msg1, 0, msg1.Length); client.Write(msg2, 0, msg2.Length); client.Write(msg1, 0, msg1.Length); @@ -115,54 +115,57 @@ namespace System.IO.Pipes.Tests Assert.Equal(1, serverCount); }); - server.WaitForConnection(); - - int len1 = server.Read(received1, 0, msg1.Length); - Assert.True(server.IsMessageComplete); - Assert.Equal(msg1.Length, len1); - Assert.Equal(msg1, received1); - - int len2 = server.Read(received2, 0, msg2.Length); - Assert.True(server.IsMessageComplete); - Assert.Equal(msg2.Length, len2); - Assert.Equal(msg2, received2); - - int expectedRead = msg1.Length - 1; - int len3 = server.Read(received3, 0, expectedRead); // read one less than message - Assert.False(server.IsMessageComplete); - Assert.Equal(expectedRead, len3); - for (int i = 0; i < expectedRead; ++i) + Task serverTask = Task.Run(async () => { - Assert.Equal(msg1[i], received3[i]); - } + server.WaitForConnection(); - expectedRead = msg1.Length - expectedRead; - Assert.Equal(expectedRead, server.Read(received3, len3, expectedRead)); - Assert.True(server.IsMessageComplete); - Assert.Equal(msg1, received3); + int len1 = server.Read(received1, 0, msg1.Length); + Assert.True(server.IsMessageComplete); + Assert.Equal(msg1.Length, len1); + Assert.Equal(msg1, received1); - Assert.Equal(msg1.Length, await server.ReadAsync(received4, 0, msg1.Length)); - Assert.True(server.IsMessageComplete); - Assert.Equal(msg1, received4); + int len2 = server.Read(received2, 0, msg2.Length); + Assert.True(server.IsMessageComplete); + Assert.Equal(msg2.Length, len2); + Assert.Equal(msg2, received2); - Assert.Equal(msg2.Length, await server.ReadAsync(received5, 0, msg2.Length)); - Assert.True(server.IsMessageComplete); - Assert.Equal(msg2, received5); + int expectedRead = msg1.Length - 1; + int len3 = server.Read(received3, 0, expectedRead); // read one less than message + Assert.False(server.IsMessageComplete); + Assert.Equal(expectedRead, len3); + for (int i = 0; i < expectedRead; ++i) + { + Assert.Equal(msg1[i], received3[i]); + } - expectedRead = msg1.Length - 1; - Assert.Equal(expectedRead, await server.ReadAsync(received6, 0, expectedRead)); // read one less than message - Assert.False(server.IsMessageComplete); - for (int i = 0; i < expectedRead; ++i) - { - Assert.Equal(msg1[i], received6[i]); - } + expectedRead = msg1.Length - expectedRead; + Assert.Equal(expectedRead, server.Read(received3, len3, expectedRead)); + Assert.True(server.IsMessageComplete); + Assert.Equal(msg1, received3); - expectedRead = msg1.Length - expectedRead; - Assert.Equal(expectedRead, await server.ReadAsync(received6, msg1.Length - expectedRead, expectedRead)); - Assert.True(server.IsMessageComplete); - Assert.Equal(msg1, received6); + Assert.Equal(msg1.Length, await server.ReadAsync(received4, 0, msg1.Length)); + Assert.True(server.IsMessageComplete); + Assert.Equal(msg1, received4); - await clientTask; + Assert.Equal(msg2.Length, await server.ReadAsync(received5, 0, msg2.Length)); + Assert.True(server.IsMessageComplete); + Assert.Equal(msg2, received5); + + expectedRead = msg1.Length - 1; + Assert.Equal(expectedRead, await server.ReadAsync(received6, 0, expectedRead)); // read one less than message + Assert.False(server.IsMessageComplete); + for (int i = 0; i < expectedRead; ++i) + { + Assert.Equal(msg1[i], received6[i]); + } + + expectedRead = msg1.Length - expectedRead; + Assert.Equal(expectedRead, await server.ReadAsync(received6, msg1.Length - expectedRead, expectedRead)); + Assert.True(server.IsMessageComplete); + Assert.Equal(msg1, received6); + }); + + Assert.True(Task.WaitAll(new[] { clientTask, serverTask }, TimeSpan.FromSeconds(15))); } } } @@ -233,7 +236,7 @@ namespace System.IO.Pipes.Tests [Fact] [PlatformSpecific(TestPlatforms.AnyUnix)] // Unix currently doesn't support message mode - public void Unix_MessagePipeTransissionMode() + public void Unix_MessagePipeTransmissionMode() { Assert.Throws(() => new NamedPipeServerStream(GetUniquePipeName(), PipeDirection.InOut, 1, PipeTransmissionMode.Message)); } diff --git a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Write.cs b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Write.cs index 6a92b0beea..6ec57c07c3 100644 --- a/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Write.cs +++ b/external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Write.cs @@ -68,6 +68,6 @@ namespace System.IO.Pipes.Tests } // InOut pipes can be written/read from either direction - public override void ReadOnWriteOnlyPipe_Throws_NotSupportedException() { } + public override bool SupportsBidirectionalReadingWriting => true; } } diff --git a/external/corefx/src/System.IO.Pipes/tests/Performance/System.IO.Pipes.Performance.Tests.csproj b/external/corefx/src/System.IO.Pipes/tests/Performance/System.IO.Pipes.Performance.Tests.csproj index cec61713df..b9bfa0f15b 100644 --- a/external/corefx/src/System.IO.Pipes/tests/Performance/System.IO.Pipes.Performance.Tests.csproj +++ b/external/corefx/src/System.IO.Pipes/tests/Performance/System.IO.Pipes.Performance.Tests.csproj @@ -18,9 +18,6 @@ Common\System\PerfUtils.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.cs b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.cs index ab63f28bd7..86ad322241 100644 --- a/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.cs +++ b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.cs @@ -16,6 +16,8 @@ namespace System.IO.Pipes.Tests /// public abstract partial class PipeTest_Read : PipeTestBase { + public virtual bool SupportsBidirectionalReadingWriting => false; + [Fact] public void ReadWithNullBuffer_Throws_ArgumentNullException() { @@ -117,8 +119,13 @@ namespace System.IO.Pipes.Tests } [Fact] - public virtual void WriteToReadOnlyPipe_Throws_NotSupportedException() + public void WriteToReadOnlyPipe_Throws_NotSupportedException() { + if (SupportsBidirectionalReadingWriting) + { + return; + } + using (ServerClientPair pair = CreateServerClientPair()) { PipeStream pipe = pair.readablePipe; diff --git a/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.netcoreapp.cs b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.netcoreapp.cs new file mode 100644 index 0000000000..ecaedc9c73 --- /dev/null +++ b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.netcoreapp.cs @@ -0,0 +1,134 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Pipes.Tests +{ + public abstract partial class PipeTest_Read : PipeTestBase + { + [Fact] + public void WriteToReadOnlyPipe_Span_Throws_NotSupportedException() + { + if (SupportsBidirectionalReadingWriting) + { + return; + } + + using (ServerClientPair pair = CreateServerClientPair()) + { + PipeStream pipe = pair.readablePipe; + Assert.True(pipe.IsConnected); + Assert.False(pipe.CanWrite); + Assert.False(pipe.CanSeek); + + Assert.Throws(() => pipe.Write(new ReadOnlySpan(new byte[5]))); + Assert.Throws(() => { pipe.WriteAsync(new ReadOnlyMemory(new byte[5])); }); + } + } + + [Fact] + public async Task ReadWithZeroLengthBuffer_Span_Nop() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + PipeStream pipe = pair.readablePipe; + var buffer = new byte[] { }; + + Assert.Equal(0, pipe.Read(new Span(buffer))); + ValueTask read = pipe.ReadAsync(new Memory(buffer)); + Assert.Equal(0, await read); + } + } + + [Fact] + public void ReadOnDisposedReadablePipe_Span_Throws_ObjectDisposedException() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + PipeStream pipe = pair.readablePipe; + pipe.Dispose(); + byte[] buffer = new byte[] { 0, 0, 0, 0 }; + + Assert.Throws(() => pipe.Read(new Span(buffer))); + Assert.Throws(() => { pipe.ReadAsync(new Memory(buffer)); }); + } + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "There is a bug in netfx around async read on a broken PipeStream. See #2601 and #2899. This bug is fixed in netcore.")] + public virtual async Task ReadFromPipeWithClosedPartner_Span_ReadNoBytes() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + pair.writeablePipe.Dispose(); + byte[] buffer = new byte[] { 0, 0, 0, 0 }; + + // The pipe won't be marked as Broken until the first read, so prime it + // to test both the case where it's not yet marked as "Broken" and then + // where it is. + Assert.Equal(0, pair.readablePipe.Read(new Span(buffer))); + + Assert.Equal(0, pair.readablePipe.Read(new Span(buffer))); + Assert.Equal(0, await pair.readablePipe.ReadAsync(new Memory(buffer))); + } + } + + [Fact] + public async Task ValidWriteAsync_Span_ValidReadAsync() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + Assert.True(pair.writeablePipe.IsConnected); + Assert.True(pair.readablePipe.IsConnected); + + byte[] sent = new byte[] { 123, 0, 5 }; + byte[] received = new byte[] { 0, 0, 0 }; + + Task write = pair.writeablePipe.WriteAsync(new ReadOnlyMemory(sent)); + Assert.Equal(sent.Length, await pair.readablePipe.ReadAsync(new Memory(received, 0, sent.Length))); + Assert.Equal(sent, received); + await write; + } + } + + [Theory] + [OuterLoop] + [MemberData(nameof(AsyncReadWriteChain_MemberData))] + public async Task AsyncReadWriteChain_Span_ReadWrite(int iterations, int writeBufferSize, int readBufferSize, bool cancelableToken) + { + var writeBuffer = new byte[writeBufferSize]; + var readBuffer = new byte[readBufferSize]; + var rand = new Random(); + var cancellationToken = cancelableToken ? new CancellationTokenSource().Token : CancellationToken.None; + + using (ServerClientPair pair = CreateServerClientPair()) + { + // Repeatedly and asynchronously write to the writable pipe and read from the readable pipe, + // verifying that the correct data made it through. + for (int iter = 0; iter < iterations; iter++) + { + rand.NextBytes(writeBuffer); + Task writerTask = pair.writeablePipe.WriteAsync(new ReadOnlyMemory(writeBuffer), cancellationToken); + + int totalRead = 0; + while (totalRead < writeBuffer.Length) + { + int numRead = await pair.readablePipe.ReadAsync(new Memory(readBuffer), cancellationToken); + Assert.True(numRead > 0); + Assert.Equal( + new ArraySegment(writeBuffer, totalRead, numRead), + new ArraySegment(readBuffer, 0, numRead)); + totalRead += numRead; + } + Assert.Equal(writeBuffer.Length, totalRead); + + await writerTask; + } + } + } + } +} diff --git a/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.cs b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.cs index 2a97ce3608..9d7d4dc9fc 100644 --- a/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.cs +++ b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.cs @@ -12,8 +12,10 @@ namespace System.IO.Pipes.Tests /// Tests that cover Write and WriteAsync behaviors that are shared between /// AnonymousPipes and NamedPipes /// - public abstract class PipeTest_Write : PipeTestBase + public abstract partial class PipeTest_Write : PipeTestBase { + public virtual bool SupportsBidirectionalReadingWriting => false; + [Fact] public void WriteWithNullBuffer_Throws_ArgumentNullException() { @@ -117,8 +119,13 @@ namespace System.IO.Pipes.Tests } [Fact] - public virtual void ReadOnWriteOnlyPipe_Throws_NotSupportedException() + public void ReadOnWriteOnlyPipe_Throws_NotSupportedException() { + if (SupportsBidirectionalReadingWriting) + { + return; + } + using (ServerClientPair pair = CreateServerClientPair()) { PipeStream pipe = pair.writeablePipe; diff --git a/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.netcoreapp.cs b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.netcoreapp.cs new file mode 100644 index 0000000000..c6d34da58c --- /dev/null +++ b/external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.netcoreapp.cs @@ -0,0 +1,84 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Pipes.Tests +{ + /// + /// Tests that cover Write and WriteAsync behaviors that are shared between + /// AnonymousPipes and NamedPipes + /// + public abstract partial class PipeTest_Write : PipeTestBase + { + [Fact] + public void ReadOnWriteOnlyPipe_Span_Throws_NotSupportedException() + { + if (SupportsBidirectionalReadingWriting) + { + return; + } + + using (ServerClientPair pair = CreateServerClientPair()) + { + PipeStream pipe = pair.writeablePipe; + Assert.True(pipe.IsConnected); + Assert.False(pipe.CanRead); + + Assert.Throws(() => pipe.Read(new Span(new byte[9]))); + Assert.Throws(() => { pipe.ReadAsync(new Memory(new byte[10])); }); + } + } + + [Fact] + public async Task WriteZeroLengthBuffer_Span_Nop() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + PipeStream pipe = pair.writeablePipe; + + // Shouldn't throw + pipe.Write(new Span(Array.Empty())); + await pipe.WriteAsync(new Memory(Array.Empty())); + } + } + + [Fact] + public void WriteToDisposedWriteablePipe_Span_Throws_ObjectDisposedException() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + PipeStream pipe = pair.writeablePipe; + pipe.Dispose(); + byte[] buffer = new byte[] { 0, 0, 0, 0 }; + + Assert.Throws(() => pipe.Write(new Span(buffer))); + Assert.Throws(() => { pipe.WriteAsync(new Memory(buffer)); }); + } + } + + [Fact] + public virtual void WriteToPipeWithClosedPartner_Span_Throws_IOException() + { + using (ServerClientPair pair = CreateServerClientPair()) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + (pair.readablePipe is NamedPipeClientStream || pair.writeablePipe is NamedPipeClientStream)) + { + // On Unix, NamedPipe*Stream is implemented in term of sockets, where information + // about shutdown is not immediately propagated. + return; + } + + pair.readablePipe.Dispose(); + byte[] buffer = new byte[] { 0, 0, 0, 0 }; + + Assert.Throws(() => pair.writeablePipe.Write(new Span(buffer))); + Assert.Throws(() => { pair.writeablePipe.WriteAsync(new Memory(buffer)); }); + } + } + } +} diff --git a/external/corefx/src/System.IO.Pipes/tests/PipeTestBase.cs b/external/corefx/src/System.IO.Pipes/tests/PipeTestBase.cs index b1efd342bd..796ee5688a 100644 --- a/external/corefx/src/System.IO.Pipes/tests/PipeTestBase.cs +++ b/external/corefx/src/System.IO.Pipes/tests/PipeTestBase.cs @@ -80,7 +80,7 @@ namespace System.IO.Pipes.Tests /// protected static string GetUniquePipeName() { - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsInAppContainer) { return @"LOCAL\" + Path.GetRandomFileName(); } diff --git a/external/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj b/external/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj index 1c8c200b42..e60965a979 100644 --- a/external/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj +++ b/external/corefx/src/System.IO.Pipes/tests/System.IO.Pipes.Tests.csproj @@ -11,6 +11,10 @@ + + + + @@ -29,13 +33,12 @@ + + - - Common\System\PlatformDetection.cs - @@ -53,4 +56,4 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.IO.Ports/dir.props b/external/corefx/src/System.IO.Ports/dir.props index af5b293385..1ddb900033 100644 --- a/external/corefx/src/System.IO.Ports/dir.props +++ b/external/corefx/src/System.IO.Ports/dir.props @@ -4,5 +4,6 @@ 4.0.1.0 Open + true - \ No newline at end of file + diff --git a/external/corefx/src/System.IO.Ports/pkg/System.IO.Ports.pkgproj b/external/corefx/src/System.IO.Ports/pkg/System.IO.Ports.pkgproj index e7bf5ee818..f070b7c577 100644 --- a/external/corefx/src/System.IO.Ports/pkg/System.IO.Ports.pkgproj +++ b/external/corefx/src/System.IO.Ports/pkg/System.IO.Ports.pkgproj @@ -3,9 +3,16 @@ - net461;netcoreapp2.0;$(AllXamarinFrameworks) + net461;netcoreapp2.0;$(AllXamarinFrameworks);$(UAPvNextTFM) + + runtimes/win/lib/$(UAPvNextTFM) + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.IO.Ports/ref/Configurations.props b/external/corefx/src/System.IO.Ports/ref/Configurations.props index d9777d8275..d2022d3a60 100644 --- a/external/corefx/src/System.IO.Ports/ref/Configurations.props +++ b/external/corefx/src/System.IO.Ports/ref/Configurations.props @@ -6,4 +6,4 @@ netfx; - \ No newline at end of file + diff --git a/external/corefx/src/System.IO.Ports/ref/System.IO.Ports.csproj b/external/corefx/src/System.IO.Ports/ref/System.IO.Ports.csproj index b1225e47c8..0f40a66c0f 100644 --- a/external/corefx/src/System.IO.Ports/ref/System.IO.Ports.csproj +++ b/external/corefx/src/System.IO.Ports/ref/System.IO.Ports.csproj @@ -4,6 +4,9 @@ {75DE4259-43BB-4067-9F30-3AC920D51AEC} true + + 4.0.1.0 diff --git a/external/corefx/src/System.IO.Ports/src/Configurations.props b/external/corefx/src/System.IO.Ports/src/Configurations.props index 1e18dd02c0..b611284f77 100644 --- a/external/corefx/src/System.IO.Ports/src/Configurations.props +++ b/external/corefx/src/System.IO.Ports/src/Configurations.props @@ -1,10 +1,14 @@ - + netstandard-Windows_NT; netstandard; netfx; + + + $(PackageConfigurations) + uap-Windows_NT; diff --git a/external/corefx/src/System.IO.Ports/src/PinvokeAnalyzerExceptionList.analyzerdata b/external/corefx/src/System.IO.Ports/src/PinvokeAnalyzerExceptionList.analyzerdata deleted file mode 100644 index 0719fa0f9d..0000000000 --- a/external/corefx/src/System.IO.Ports/src/PinvokeAnalyzerExceptionList.analyzerdata +++ /dev/null @@ -1,3 +0,0 @@ -## need to create a uap config that uses CreateFileFromApp, then remove this baseline ## -# https://github.com/dotnet/corefx/issues/21025 -kernel32.dll!CreateFileW \ No newline at end of file diff --git a/external/corefx/src/System.IO.Ports/src/PinvokeAnalyzerExceptionList.analyzerdata.netstandard b/external/corefx/src/System.IO.Ports/src/PinvokeAnalyzerExceptionList.analyzerdata.netstandard new file mode 100644 index 0000000000..a60530e769 --- /dev/null +++ b/external/corefx/src/System.IO.Ports/src/PinvokeAnalyzerExceptionList.analyzerdata.netstandard @@ -0,0 +1,2 @@ +# not available in OneCore +kernel32.dll!CreateFileW diff --git a/external/corefx/src/System.IO.Ports/src/Resources/Strings.resx b/external/corefx/src/System.IO.Ports/src/Resources/Strings.resx index c3b92f3169..51b49f2db4 100644 --- a/external/corefx/src/System.IO.Ports/src/Resources/Strings.resx +++ b/external/corefx/src/System.IO.Ports/src/Resources/Strings.resx @@ -121,9 +121,6 @@ Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader. - - BindHandle for ThreadPool failed on this handle. - The I/O operation has been aborted because of either a thread exit or an application request. @@ -169,4 +166,7 @@ System.IO.Ports is currently only supported on Windows. + + Enumeration of serial port names is not supported on the current platform. + diff --git a/external/corefx/src/System.IO.Ports/src/System.IO.Ports.csproj b/external/corefx/src/System.IO.Ports/src/System.IO.Ports.csproj index 9a9f9ce8ac..e9268ac8d0 100644 --- a/external/corefx/src/System.IO.Ports/src/System.IO.Ports.csproj +++ b/external/corefx/src/System.IO.Ports/src/System.IO.Ports.csproj @@ -15,12 +15,15 @@ + + + @@ -28,10 +31,7 @@ - - Component - - + @@ -85,9 +85,6 @@ Common\Interop\Windows\kernel32\Interop.WaitCommEvent.cs - - Common\Interop\Windows\kernel32\Interop.CreateFile.cs - Common\Interop\Windows\kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs @@ -115,6 +112,9 @@ Common\Interop\Windows\Interop.FileTypes.cs + + Common\Interop\Windows\kernelbase\Interop.OpenCommPort.cs + Common\System\IO\PathInternal.Windows.cs @@ -131,6 +131,19 @@ Common\Interop\Windows\Interop.BOOL.cs + + + Common\Interop\Windows\kernel32\Interop.CreateFile.cs + + + + + + + + + + @@ -138,5 +151,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.Uap.cs b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.Uap.cs new file mode 100644 index 0000000000..bb01e74a7a --- /dev/null +++ b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.Uap.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; + +namespace System.IO.Ports +{ + public partial class SerialPort : Component + { + public static string[] GetPortNames() + { + // See https://github.com/dotnet/corefx/issues/20588 for more information. + throw new PlatformNotSupportedException(System.SR.PlatformNotSupported_SerialPort_GetPortNames); + } + } +} diff --git a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.Win32.cs b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.Win32.cs new file mode 100644 index 0000000000..3daea6766a --- /dev/null +++ b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.Win32.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32; +using System.ComponentModel; + +namespace System.IO.Ports +{ + public partial class SerialPort : Component + { + public static string[] GetPortNames() + { + // Hitting the registry for this isn't the only way to get the ports. + // + // WMI: https://msdn.microsoft.com/en-us/library/aa394413.aspx + // QueryDosDevice: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365461.aspx + // + // QueryDosDevice involves finding any ports that map to \Device\Serialx (call with null to get all, then iterate to get the actual device name) + + using (RegistryKey serialKey = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DEVICEMAP\SERIALCOMM")) + { + if (serialKey != null) + { + string[] result = serialKey.GetValueNames(); + for (int i = 0; i < result.Length; i++) + { + // Replace the name in the array with its value. + result[i] = (string)serialKey.GetValue(result[i]); + } + return result; + } + } + + return Array.Empty(); + } + } +} diff --git a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.cs b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.cs index b8462eb6b3..1a867ba269 100644 --- a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.cs +++ b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialPort.cs @@ -9,7 +9,7 @@ using System.Text; namespace System.IO.Ports { - public class SerialPort : Component + public partial class SerialPort : Component { public const int InfiniteTimeout = -1; @@ -555,32 +555,6 @@ namespace System.IO.Ports _internalSerialStream.DiscardOutBuffer(); } - public static string[] GetPortNames() - { - // Hitting the registry for this isn't the only way to get the ports. - // - // WMI: https://msdn.microsoft.com/en-us/library/aa394413.aspx - // QueryDosDevice: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365461.aspx - // - // QueryDosDevice involves finding any ports that map to \Device\Serialx (call with null to get all, then iterate to get the actual device name) - - using (RegistryKey serialKey = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DEVICEMAP\SERIALCOMM")) - { - if (serialKey != null) - { - string[] result = serialKey.GetValueNames(); - for (int i = 0; i < result.Length; i++) - { - // Replace the name in the array with its value. - result[i] = (string)serialKey.GetValue(result[i]); - } - return result; - } - } - - return Array.Empty(); - } - // SerialPort is open <=> SerialPort has an associated SerialStream. // The two statements are functionally equivalent here, so this method basically calls underlying Stream's // constructor from the main properties specified in SerialPort: baud, stopBits, parity, dataBits, diff --git a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.Uap.cs b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.Uap.cs new file mode 100644 index 0000000000..7bd49a1677 --- /dev/null +++ b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.Uap.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; + +namespace System.IO.Ports +{ + internal sealed partial class SerialStream + { + public SafeFileHandle OpenPort(uint portNumber) + { + return Interop.KernelBase.OpenCommPort( + portNumber, + Interop.Kernel32.GenericOperations.GENERIC_READ | Interop.Kernel32.GenericOperations.GENERIC_WRITE, + NativeMethods.FILE_FLAG_OVERLAPPED); + } + } +} diff --git a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.Win32.cs b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.Win32.cs new file mode 100644 index 0000000000..c59acebb5e --- /dev/null +++ b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.Win32.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System.Globalization; + +namespace System.IO.Ports +{ + internal sealed partial class SerialStream + { + public SafeFileHandle OpenPort(uint portNumber) + { + return Interop.Kernel32.CreateFileDefaultSecurity( + @"\\?\COM" + portNumber.ToString(CultureInfo.InvariantCulture), + Interop.Kernel32.GenericOperations.GENERIC_READ | Interop.Kernel32.GenericOperations.GENERIC_WRITE, + 0, // comm devices must be opened w/exclusive-access + FileMode.Open, // comm devices must use OPEN_EXISTING + NativeMethods.FILE_FLAG_OVERLAPPED); + } + } +} diff --git a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs index d84a2510de..b24bee7377 100644 --- a/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs +++ b/external/corefx/src/System.IO.Ports/src/System/IO/Ports/SerialStream.cs @@ -23,7 +23,7 @@ using System.Threading.Tasks; namespace System.IO.Ports { - internal sealed class SerialStream : Stream + internal sealed partial class SerialStream : Stream { private const int ErrorEvents = (int)(SerialError.Frame | SerialError.Overrun | SerialError.RXOver | SerialError.RXParity | SerialError.TXFull); @@ -50,9 +50,9 @@ namespace System.IO.Ports private Interop.Kernel32.COMSTAT _comStat; private Interop.Kernel32.COMMPROP _commProp; - // internal-use members - internal SafeFileHandle _handle = null; - internal EventLoopRunner _eventRunner; + private SafeFileHandle _handle = null; + private ThreadPoolBoundHandle _threadPoolBinding = null; + private EventLoopRunner _eventRunner; private Task _waitForComEventTask = null; private byte[] _tempBuf; // used to avoid multiple array allocations in ReadByte() @@ -590,19 +590,16 @@ namespace System.IO.Ports internal SerialStream(string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits, int readTimeout, int writeTimeout, Handshake handshake, bool dtrEnable, bool rtsEnable, bool discardNull, byte parityReplace) { - int flags = NativeMethods.FILE_FLAG_OVERLAPPED; - - if ((portName == null) || !portName.StartsWith("COM", StringComparison.OrdinalIgnoreCase)) + if ((portName == null) || + !portName.StartsWith("COM", StringComparison.OrdinalIgnoreCase) || + !uint.TryParse(portName.Substring(3), out uint portNumber)) + { throw new ArgumentException(SR.Arg_InvalidSerialPort, nameof(portName)); + } // Error checking done in SerialPort. - SafeFileHandle tempHandle = Interop.Kernel32.CreateFileDefaultSecurity( - @"\\?\" + portName, - Interop.Kernel32.GenericOperations.GENERIC_READ | Interop.Kernel32.GenericOperations.GENERIC_WRITE, - 0, // comm devices must be opened w/exclusive-access - FileMode.Open, // comm devices must use OPEN_EXISTING - flags); + SafeFileHandle tempHandle = OpenPort(portNumber); if (tempHandle.IsInvalid) { @@ -705,10 +702,7 @@ namespace System.IO.Ports if (_isAsync) { - if (!ThreadPool.BindHandle(_handle)) - { - throw new IOException(SR.IO_BindHandleFailed); - } + _threadPoolBinding = ThreadPoolBoundHandle.BindHandle(_handle); } // monitor all events except TXEMPTY @@ -725,6 +719,7 @@ namespace System.IO.Ports // handle before we let them continue up. tempHandle.Close(); _handle = null; + _threadPoolBinding?.Dispose(); throw; } } @@ -805,6 +800,7 @@ namespace System.IO.Ports { _handle.Close(); _handle = null; + _threadPoolBinding.Dispose(); } #pragma warning restore CA2002 } @@ -812,6 +808,7 @@ namespace System.IO.Ports { _handle.Close(); _handle = null; + _threadPoolBinding.Dispose(); } base.Dispose(disposing); } @@ -957,7 +954,12 @@ namespace System.IO.Ports // Free memory, GC handles. NativeOverlapped* overlappedPtr = afsar._overlapped; if (overlappedPtr != null) - Overlapped.Free(overlappedPtr); + { + // Legacy behavior as indicated by tests (e.g.: System.IO.Ports.Tests.SerialStream_EndRead.EndReadAfterClose) + // expects to be able to call EndRead after Close/Dispose - even if disposed _threadPoolBinding can free the + // native overlapped. + _threadPoolBinding.FreeNativeOverlapped(overlappedPtr); + } // Check for non-timeout errors during the read. if (afsar._errorCode != 0) @@ -1016,7 +1018,12 @@ namespace System.IO.Ports // Free memory, GC handles. NativeOverlapped* overlappedPtr = afsar._overlapped; if (overlappedPtr != null) - Overlapped.Free(overlappedPtr); + { + // Legacy behavior as indicated by tests (e.g.: System.IO.Ports.Tests.SerialStream_EndWrite.EndWriteAfterSerialStreamClose) + // expects to be able to call EndWrite after Close/Dispose - even if disposed _threadPoolBinding can free the + // native overlapped. + _threadPoolBinding.FreeNativeOverlapped(overlappedPtr); + } // Now check for any error during the write. if (afsar._errorCode != 0) @@ -1396,7 +1403,6 @@ namespace System.IO.Ports unsafe private SerialStreamAsyncResult BeginReadCore(byte[] array, int offset, int numBytes, AsyncCallback userCallback, Object stateObject) { - // Create and store async stream class library specific data in the // async result SerialStreamAsyncResult asyncResult = new SerialStreamAsyncResult(); @@ -1409,20 +1415,14 @@ namespace System.IO.Ports ManualResetEvent waitHandle = new ManualResetEvent(false); asyncResult._waitHandle = waitHandle; - // Create a managed overlapped class - // We will set the file offsets later - Overlapped overlapped = new Overlapped(0, 0, IntPtr.Zero, asyncResult); - - // Pack the Overlapped class, and store it in the async result - NativeOverlapped* intOverlapped = overlapped.Pack(s_IOCallback, array); + NativeOverlapped* intOverlapped = _threadPoolBinding.AllocateNativeOverlapped(s_IOCallback, asyncResult, array); asyncResult._overlapped = intOverlapped; // queue an async ReadFile operation and pass in a packed overlapped //int r = ReadFile(_handle, array, numBytes, null, intOverlapped); int hr = 0; - int r = ReadFileNative(array, offset, numBytes, - intOverlapped, out hr); + int r = ReadFileNative(array, offset, numBytes, intOverlapped, out hr); // ReadFile, the OS version, will return 0 on failure. But // my ReadFileNative wrapper returns -1. My wrapper will return @@ -1462,12 +1462,7 @@ namespace System.IO.Ports ManualResetEvent waitHandle = new ManualResetEvent(false); asyncResult._waitHandle = waitHandle; - // Create a managed overlapped class - // We will set the file offsets later - Overlapped overlapped = new Overlapped(0, 0, IntPtr.Zero, asyncResult); - - // Pack the Overlapped class, and store it in the async result - NativeOverlapped* intOverlapped = overlapped.Pack(s_IOCallback, array); + NativeOverlapped* intOverlapped = _threadPoolBinding.AllocateNativeOverlapped(s_IOCallback, asyncResult, array); asyncResult._overlapped = intOverlapped; @@ -1603,14 +1598,11 @@ namespace System.IO.Ports // This is a the callback prompted when a thread completes any async I/O operation. unsafe private static void AsyncFSCallback(uint errorCode, uint numBytes, NativeOverlapped* pOverlapped) { - // Unpack overlapped - Overlapped overlapped = Overlapped.Unpack(pOverlapped); - // Extract async the result from overlapped structure SerialStreamAsyncResult asyncResult = - (SerialStreamAsyncResult)overlapped.AsyncResult; - asyncResult._numBytes = (int)numBytes; + (SerialStreamAsyncResult)ThreadPoolBoundHandle.GetNativeOverlappedState(pOverlapped); + asyncResult._numBytes = (int)numBytes; asyncResult._errorCode = (int)errorCode; // Call the user-provided callback. Note that it can and often should @@ -1642,6 +1634,7 @@ namespace System.IO.Ports private WeakReference streamWeakReference; internal ManualResetEvent waitCommEventWaitHandle = new ManualResetEvent(false); private SafeFileHandle handle = null; + private ThreadPoolBoundHandle threadPoolBinding = null; private bool isAsync; internal bool endEventLoop; private int eventsOccurred; @@ -1658,6 +1651,7 @@ namespace System.IO.Ports internal unsafe EventLoopRunner(SerialStream stream) { handle = stream._handle; + threadPoolBinding = stream._threadPoolBinding; streamWeakReference = new WeakReference(stream); callErrorEvents = new WaitCallback(CallErrorEvents); @@ -1703,9 +1697,8 @@ namespace System.IO.Ports asyncResult._waitHandle = waitCommEventWaitHandle; waitCommEventWaitHandle.Reset(); - Overlapped overlapped = new Overlapped(0, 0, waitCommEventWaitHandle.SafeWaitHandle.DangerousGetHandle(), asyncResult); - // Pack the Overlapped class, and store it in the async result - intOverlapped = overlapped.Pack(freeNativeOverlappedCallback, null); + intOverlapped = threadPoolBinding.AllocateNativeOverlapped(freeNativeOverlappedCallback, asyncResult, null); + intOverlapped->EventHandle = waitCommEventWaitHandle.SafeWaitHandle.DangerousGetHandle(); } fixed (int* eventsOccurredPtr = &eventsOccurred) @@ -1763,7 +1756,7 @@ namespace System.IO.Ports if (isAsync) { if (Interlocked.Decrement(ref asyncResult._numBytes) == 0) - Overlapped.Free(intOverlapped); + threadPoolBinding.FreeNativeOverlapped(intOverlapped); } } // while (!ShutdownLoop) @@ -1771,21 +1764,18 @@ namespace System.IO.Ports { // the rest will be handled in Dispose() endEventLoop = true; - Overlapped.Free(intOverlapped); + threadPoolBinding.FreeNativeOverlapped(intOverlapped); } } private unsafe void FreeNativeOverlappedCallback(uint errorCode, uint numBytes, NativeOverlapped* pOverlapped) { - // Unpack overlapped - Overlapped overlapped = Overlapped.Unpack(pOverlapped); - // Extract the async result from overlapped structure - SerialStreamAsyncResult asyncResult = - (SerialStreamAsyncResult)overlapped.AsyncResult; + SerialStreamAsyncResult asyncResult = + (SerialStreamAsyncResult)ThreadPoolBoundHandle.GetNativeOverlappedState(pOverlapped); if (Interlocked.Decrement(ref asyncResult._numBytes) == 0) - Overlapped.Free(pOverlapped); + threadPoolBinding.FreeNativeOverlapped(pOverlapped); } private void CallEvents(int nativeEvents) @@ -1804,7 +1794,7 @@ namespace System.IO.Ports // We don't want to throw an exception from the background thread which is un-catchable and hence tear down the process. // At present we don't have a first class event that we can raise for this class of fatal errors. One possibility is // to overload SeralErrors event to include another enum (perhaps CE_IOE) that we can use for this purpose. - // In the absene of that, it is better to eat this error silently than tearing down the process (lesser of the evil). + // In the absence of that, it is better to eat this error silently than tearing down the process (lesser of the evil). // This uncleared comm error will most likely blow up when the device is accessed by other APIs (such as Read) on the // main thread and hence become known. It is bit roundabout but acceptable. // diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/AbortOnError.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/AbortOnError.cs index b76a57efc5..d83e030d1e 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/AbortOnError.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/AbortOnError.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Diagnostics; using System.IO.PortsTests; using System.Reflection; @@ -28,6 +29,9 @@ namespace System.IO.Ports.Tests /// 3. Verify that the fAbortOnError flag is clear /// /// + // This test requires access, via reflection, to internal type SerialStream and respective methods GetDcbFlag and + // SetDcbFlag, however, that requires either changes to the public type (increasing its size) or to the test itself. + [ActiveIssue("https://github.com/dotnet/corefx/issues/23234", TargetFrameworkMonikers.Uap)] [ConditionalFact(nameof(HasOneSerialPort))] public void AbortOnErrorShouldBeClearedOnOpen() { diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/BreakState.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/BreakState.cs index 8af835a4dd..c0262976fc 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/BreakState.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/BreakState.cs @@ -51,7 +51,6 @@ namespace System.IO.Ports.Tests } } - [ConditionalFact(nameof(HasNullModem))] public void BreakState_true() { @@ -73,7 +72,7 @@ namespace System.IO.Ports.Tests } } - + [ConditionalFact(nameof(HasNullModem))] public void BreakState_false() { diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ErrorEvent.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ErrorEvent.cs index eea73c7ef3..4490876695 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ErrorEvent.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ErrorEvent.cs @@ -187,8 +187,6 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { ErrorEventHandler errEventHandler = new ErrorEventHandler(com1); - byte[] frameErrorBytes = new byte[1]; - Random rndGen = new Random(); Debug.WriteLine("Verifying Frame event"); com1.DataBits = 7; @@ -199,16 +197,10 @@ namespace System.IO.Ports.Tests com1.ErrorReceived += errEventHandler.HandleEvent; - for (int i = 0; i < frameErrorBytes.Length; i++) - { - frameErrorBytes[i] = (byte)rndGen.Next(0, 256); - } - //This should cause a frame error since the 8th bit is not set //and com1 is set to 7 data bits ao the 8th bit will +12v where //com1 expects the stop bit at the 8th bit to be -12v - frameErrorBytes[0] = 0x01; - + var frameErrorBytes = new byte[] { 0x01 }; for (int i = 0; i < NUM_TRYS; i++) { Debug.WriteLine("Verifying Frame event try: {0}", i); @@ -221,7 +213,7 @@ namespace System.IO.Ports.Tests errEventHandler.Validate(SerialError.Frame, -1); } } - + lock (com1) { if (com1.IsOpen) diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Event_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Event_Generic.cs index 4fd0fc219e..56352e132a 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Event_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Event_Generic.cs @@ -179,6 +179,10 @@ namespace System.IO.Ports.Tests } } + Assert.True(pinChangedEventHandler.SuccessfulWait, "pinChangedEventHandler did not receive resume handle event"); + Assert.True(receivedEventHandler.SuccessfulWait, "receivedEventHandler did not receive resume handle event"); + Assert.True(errorEventHandler.SuccessfulWait, "errorEventHandler did not receive resume handle event"); + if (!pinChangedEventHandler.WaitForEvent(MAX_TIME_WAIT, 3)) { Fail("Err_2288ajied Expected 3 PinChangedEvents to be fired and only {0} occurred", @@ -249,8 +253,8 @@ namespace System.IO.Ports.Tests Thread.Sleep(5000); pinChangedEventHandler.ResumeHandleEvent(); - TCSupport.WaitForTaskCompletion(task); + Assert.True(pinChangedEventHandler.SuccessfulWait, "pinChangedEventHandler did not receive resume handle event"); } } @@ -288,8 +292,8 @@ namespace System.IO.Ports.Tests Thread.Sleep(5000); receivedEventHandler.ResumeHandleEvent(); - TCSupport.WaitForTaskCompletion(task); + Assert.True(receivedEventHandler.SuccessfulWait, "receivedEventHandler did not receive resume handle event"); } } @@ -327,6 +331,7 @@ namespace System.IO.Ports.Tests errorEventHandler.ResumeHandleEvent(); TCSupport.WaitForTaskCompletion(task); + Assert.True(errorEventHandler.SuccessfulWait, "errorEventHandler did not receive resume handle event"); } } #endregion diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/OpenDevices.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/OpenDevices.cs index 88e15972a7..cc25099097 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/OpenDevices.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/OpenDevices.cs @@ -13,7 +13,7 @@ namespace System.IO.Ports.Tests public class OpenDevices : PortsTest { [Fact] - [ActiveIssue(21156, TargetFrameworkMonikers.Uap)] + [ActiveIssue("https://github.com/dotnet/corefx/issues/23294", TargetFrameworkMonikers.Uap)] public void OpenDevices01() { DosDevices dosDevices = new DosDevices(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Open_Stress.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Open_Stress.cs index 246e7ee177..c9c7f70bd7 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Open_Stress.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Open_Stress.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -15,31 +16,33 @@ namespace System.IO.Ports.Tests [ConditionalFact(nameof(HasNullModem))] public void OpenReceiveData() { - Thread workerThread = new Thread(OpenReceiveData_WorkerThread); using (CancellationTokenSource cts = new CancellationTokenSource()) - using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - Debug.WriteLine("Open and Close port while the port is receiving data"); - - workerThread.Start(cts.Token); - - try + var workerTask = new Task(() => OpenReceiveData_WorkerThread(cts.Token)); + using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - int iterationCount = TCSupport.RunShortStressTests ? 10 : 1000; - for (int i = 0; i < iterationCount; ++i) + Debug.WriteLine("Open and Close port while the port is receiving data"); + + workerTask.Start(); + + try { - com.RtsEnable = true; - com.Open(); - com.Close(); + int iterationCount = TCSupport.RunShortStressTests ? 10 : 1000; + for (int i = 0; i < iterationCount; ++i) + { + com.RtsEnable = true; + com.Open(); + com.Close(); + } + } + finally + { + cts.Cancel(); } } - finally - { - cts.Cancel(); - } - } - workerThread.Join(); + workerTask.Wait(); + } } private void OpenReceiveData_WorkerThread(object token) @@ -64,41 +67,43 @@ namespace System.IO.Ports.Tests [ConditionalFact(nameof(HasNullModem), nameof(HasHardwareFlowControl))] public void OpenReceiveDataAndRTS() { - Thread workerThread = new Thread(OpenReceiveDataAndRTS_WorkerThread); using (CancellationTokenSource cts = new CancellationTokenSource()) - using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - Debug.WriteLine("Open and Close port while the port is recieving data and the RTS pin is changing states"); - - workerThread.Start(cts.Token); - - byte[] xmitBytes = new byte[16]; - - for (int i = 0; i < xmitBytes.Length; ++i) - xmitBytes[i] = (byte)i; - - try + var workerTask = new Task(() => OpenReceiveDataAndRTS_WorkerThread(cts.Token)); + using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - int iterationCount = TCSupport.RunShortStressTests ? 10 : 1000; - for (int i = 0; i < iterationCount; ++i) + Debug.WriteLine("Open and Close port while the port is recieving data and the RTS pin is changing states"); + + workerTask.Start(); + + byte[] xmitBytes = new byte[16]; + + for (int i = 0; i < xmitBytes.Length; ++i) + xmitBytes[i] = (byte)i; + + try { - com.Open(); - com.Handshake = Handshake.RequestToSend; - com.Write(xmitBytes, 0, xmitBytes.Length); - com.Close(); + int iterationCount = TCSupport.RunShortStressTests ? 10 : 1000; + for (int i = 0; i < iterationCount; ++i) + { + com.Open(); + com.Handshake = Handshake.RequestToSend; + com.Write(xmitBytes, 0, xmitBytes.Length); + com.Close(); + } + } + catch (Exception e) + { + Debug.WriteLine("Thread1 threw the following exception:\n{0}", e); + } + finally + { + cts.Cancel(); } } - catch (Exception e) - { - Debug.WriteLine("Thread1 threw the following exception:\n{0}", e); - } - finally - { - cts.Cancel(); - } - } - workerThread.Join(); + workerTask.Wait(); + } } diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte.cs index 5f1dd1596a..e2cdb5f0da 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -73,7 +74,7 @@ namespace System.IO.Ports.Tests byte[] byteXmitBuffer = TCSupport.GetRandomBytes(512); byte[] byteRcvBuffer = new byte[byteXmitBuffer.Length]; ASyncRead asyncRead = new ASyncRead(com1); - Thread asyncReadThread = new Thread(asyncRead.Read); + var asyncReadTask = new Task(asyncRead.Read); Debug.WriteLine( "Verifying that ReadByte() will read bytes that have been received after the call to Read was made"); @@ -87,7 +88,7 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - asyncReadThread.Start(); + asyncReadTask.Start(); asyncRead.ReadStartedEvent.WaitOne(); //This only tells us that the thread has started to execute code in the method Thread.Sleep(2000); //We need to wait to guarentee that we are executing code in SerialPort @@ -127,6 +128,8 @@ namespace System.IO.Ports.Tests } } } + + TCSupport.WaitForTaskCompletion(asyncReadTask); } } #endregion diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte_Generic.cs index 7f86749041..f728c54cc0 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadByte_Generic.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -113,7 +114,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { Random rndGen = new Random(-55); - Thread t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -132,9 +133,7 @@ namespace System.IO.Ports.Tests { } - //Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); //Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar.cs index 2b176846a5..c194cccb6d 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -292,8 +293,7 @@ namespace System.IO.Ports.Tests char[] charXmitBuffer = TCSupport.GetRandomChars(512, TCSupport.CharacterOptions.None); char[] charRcvBuffer = new char[charXmitBuffer.Length]; ASyncRead asyncRead = new ASyncRead(com1); - Thread asyncReadThread = - new Thread(asyncRead.Read); + var asyncReadTask = new Task(asyncRead.Read); Debug.WriteLine( @@ -308,7 +308,7 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - asyncReadThread.Start(); + asyncReadTask.Start(); asyncRead.ReadStartedEvent.WaitOne(); //This only tells us that the thread has started to execute code in the method Thread.Sleep(2000); //We need to wait to guarentee that we are executing code in SerialPort @@ -335,6 +335,8 @@ namespace System.IO.Ports.Tests Assert.Equal(receivedLength, charXmitBuffer.Length); Assert.Equal(charXmitBuffer, charRcvBuffer); } + + TCSupport.WaitForTaskCompletion(asyncReadTask); } } diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar_Generic.cs index 3a3a4515ee..8df85fefd4 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadChar_Generic.cs @@ -7,6 +7,7 @@ using System.IO.PortsTests; using System.Linq; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -114,7 +115,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { Random rndGen = new Random(-55); - Thread t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -135,9 +136,7 @@ namespace System.IO.Ports.Tests { } - //Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); //Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine.cs index 878090d880..ed062efb42 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -353,7 +354,7 @@ namespace System.IO.Ports.Tests { char[] charXmitBuffer = TCSupport.GetRandomChars(512, TCSupport.CharacterOptions.None); var asyncRead = new ASyncRead(com1); - var asyncReadThread = new Thread(new ThreadStart(asyncRead.Read)); + var asyncReadTask = new Task(asyncRead.Read); char endLineChar = com1.NewLine[0]; char notEndLineChar = TCSupport.GetRandomOtherChar(endLineChar, TCSupport.CharacterOptions.None); @@ -380,7 +381,7 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - asyncReadThread.Start(); + asyncReadTask.Start(); asyncRead.ReadStartedEvent.WaitOne(); //This only tells us that the thread has started to execute code in the method Thread.Sleep(2000); //We need to wait to guarentee that we are executing code in SerialPort @@ -462,7 +463,7 @@ namespace System.IO.Ports.Tests var continueRunning = true; var numberOfIterations = 0; - var writeToCom2Thread = new Thread(delegate () + var writeToCom2Task = new Task(delegate () { while (continueRunning) { @@ -498,12 +499,12 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - writeToCom2Thread.Start(); + writeToCom2Task.Start(); Assert.Throws(() => com2.ReadLine()); continueRunning = false; - writeToCom2Thread.Join(); + writeToCom2Task.Wait(); com1.Write(com1.NewLine); @@ -883,4 +884,4 @@ namespace System.IO.Ports.Tests #endregion } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine_Generic.cs index 55ed2aab94..f5586fb25e 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadLine_Generic.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -122,7 +123,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { Random rndGen = new Random(-55); - Thread t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -141,9 +142,7 @@ namespace System.IO.Ports.Tests { } - //Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); //Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo.cs index 371eac2cd9..007be6b054 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -313,7 +314,7 @@ namespace System.IO.Ports.Tests { using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - Debug.WriteLine("Verifying read method thows ArgumentExcpetion with a null NewLine string"); + Debug.WriteLine("Verifying read method throws ArgumentExcpetion with a null NewLine string"); com.Open(); VerifyReadException(com, null, typeof(ArgumentNullException)); @@ -325,7 +326,7 @@ namespace System.IO.Ports.Tests { using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - Debug.WriteLine("Verifying read method thows ArgumentExcpetion with a empty NewLine string"); + Debug.WriteLine("Verifying read method throws ArgumentExcpetion with an empty NewLine string"); com.Open(); VerifyReadException(com, "", typeof(ArgumentException)); @@ -361,8 +362,7 @@ namespace System.IO.Ports.Tests char[] charXmitBuffer = TCSupport.GetRandomChars(512, TCSupport.CharacterOptions.None); string endString = "END"; ASyncRead asyncRead = new ASyncRead(com1, endString); - Thread asyncReadThread = - new Thread(asyncRead.Read); + var asyncReadTask = new Task(asyncRead.Read); char endChar = endString[0]; char notEndChar = TCSupport.GetRandomOtherChar(endChar, TCSupport.CharacterOptions.None); @@ -389,7 +389,7 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - asyncReadThread.Start(); + asyncReadTask.Start(); asyncRead.ReadStartedEvent.WaitOne(); //This only tells us that the thread has started to execute code in the method Thread.Sleep(2000); //We need to wait to guarentee that we are executing code in SerialPort @@ -489,7 +489,7 @@ namespace System.IO.Ports.Tests bool continueRunning = true; int numberOfIterations = 0; - Thread writeToCom2Thread = new Thread(delegate () + var writeToCom2Task = new Task(delegate () { while (continueRunning) { @@ -524,12 +524,12 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - writeToCom2Thread.Start(); + writeToCom2Task.Start(); Assert.Throws(() => com2.ReadTo(new string(endChar, 1))); continueRunning = false; - writeToCom2Thread.Join(); + writeToCom2Task.Wait(); com1.Write(new string(endChar, 1)); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo_Generic.cs index 27f1b545bf..2a9f4ebd94 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/ReadTo_Generic.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -122,7 +123,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { Random rndGen = new Random(-55); - Thread t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -142,9 +143,7 @@ namespace System.IO.Ports.Tests { } - //Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); //Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int.cs index 4a7e9a3cf9..b60f98995b 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -26,10 +27,10 @@ namespace System.IO.Ports.Tests private const int defaultByteOffset = 0; private const int defaultByteCount = 1; - //The maximum buffer size when a exception occurs + //The maximum buffer size when an exception occurs private const int maxBufferSizeForException = 255; - //The maximum buffer size when a exception is not expected + //The maximum buffer size when an exception is not expected private const int maxBufferSize = 8; private enum ReadDataFromEnum { NonBuffered, Buffered, BufferedAndNonBuffered }; @@ -299,8 +300,7 @@ namespace System.IO.Ports.Tests byte[] byteXmitBuffer = TCSupport.GetRandomBytes(512); byte[] byteRcvBuffer = new byte[byteXmitBuffer.Length]; ASyncRead asyncRead = new ASyncRead(com1, byteRcvBuffer, 0, byteRcvBuffer.Length); - Thread asyncReadThread = - new Thread(asyncRead.Read); + var asyncReadTask = new Task(asyncRead.Read); Debug.WriteLine( @@ -315,7 +315,7 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - asyncReadThread.Start(); + asyncReadTask.Start(); asyncRead.ReadStartedEvent.WaitOne(); //This only tells us that the thread has started to execute code in the method Thread.Sleep(2000); //We need to wait to guarentee that we are executing code in SerialPort @@ -354,6 +354,8 @@ namespace System.IO.Ports.Tests } } } + + TCSupport.WaitForTaskCompletion(asyncReadTask); } } #endregion diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int_Generic.cs index 99ac62f6f9..50abe56628 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_byte_int_int_Generic.cs @@ -7,6 +7,7 @@ using System.IO.PortsTests; using System.Linq; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -124,7 +125,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { Random rndGen = new Random(); - Thread t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -144,9 +145,7 @@ namespace System.IO.Ports.Tests { } - //Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); //Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int.cs index 7f998968df..9f960bfff2 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int.cs @@ -7,6 +7,7 @@ using System.IO.PortsTests; using System.Linq; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -27,10 +28,10 @@ namespace System.IO.Ports.Tests private const int defaultCharOffset = 0; private const int defaultCharCount = 1; - //The maximum buffer size when a exception occurs + //The maximum buffer size when an exception occurs private const int maxBufferSizeForException = 255; - //The maximum buffer size when a exception is not expected + //The maximum buffer size when an exception is not expected private const int maxBufferSize = 8; public enum ReadDataFromEnum { NonBuffered, Buffered, BufferedAndNonBuffered }; @@ -380,7 +381,7 @@ namespace System.IO.Ports.Tests char[] charXmitBuffer = TCSupport.GetRandomChars(512, TCSupport.CharacterOptions.None); char[] charRcvBuffer = new char[charXmitBuffer.Length]; ASyncRead asyncRead = new ASyncRead(com1, charRcvBuffer, 0, charRcvBuffer.Length); - Thread asyncReadThread = new Thread(asyncRead.Read); + var asyncReadTask = new Task(asyncRead.Read); Debug.WriteLine( @@ -395,7 +396,7 @@ namespace System.IO.Ports.Tests if (!com2.IsOpen) //This is necessary since com1 and com2 might be the same port if we are using a loopback com2.Open(); - asyncReadThread.Start(); + asyncReadTask.Start(); asyncRead.ReadStartedEvent.WaitOne(); // The WaitOne only tells us that the thread has started to execute code in the method Thread.Sleep(2000); // We need to wait to guarantee that we are executing code in SerialPort @@ -419,6 +420,8 @@ namespace System.IO.Ports.Tests Assert.Equal(charXmitBuffer.Length, receivedLength); Assert.Equal(charXmitBuffer, charRcvBuffer); } + + TCSupport.WaitForTaskCompletion(asyncReadTask); } } @@ -431,7 +434,7 @@ namespace System.IO.Ports.Tests char[] charXmitBuffer = TCSupport.GetRandomChars(1023, TCSupport.CharacterOptions.ASCII); int readResult; - Debug.WriteLine("Verifying that Read(char[], int, int) will compact data in the buffer buffer"); + Debug.WriteLine("Verifying that Read(char[], int, int) will compact data in the buffer"); com1.Encoding = Encoding.ASCII; com2.Encoding = Encoding.ASCII; diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int_Generic.cs index 235d0eb1ea..b96f8b2d15 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Read_char_int_int_Generic.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -127,7 +128,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { Random rndGen = new Random(-55); - Thread t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -147,9 +148,7 @@ namespace System.IO.Ports.Tests { } - //Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); //Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/WriteLine_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/WriteLine_Generic.cs index 55c979d3d9..9fee788b45 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/WriteLine_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/WriteLine_Generic.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -140,9 +139,7 @@ namespace System.IO.Ports.Tests { Random rndGen = new Random(-55); AsyncEnableRts asyncEnableRts = new AsyncEnableRts(); - Thread t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime; + var t = new Task(asyncEnableRts.EnableRTS); com1.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Handshake = Handshake.RequestToSend; @@ -154,13 +151,7 @@ namespace System.IO.Ports.Tests //Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed //before the timeout is reached t.Start(); - waitTime = 0; - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); try { @@ -171,9 +162,7 @@ namespace System.IO.Ports.Tests } asyncEnableRts.Stop(); - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); VerifyTimeout(com1); } } @@ -184,10 +173,9 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com, s_STRING_SIZE_BYTES_TO_WRITE); - Thread t = new Thread(asyncWriteRndStr.WriteRndStr); + var t = new Task(asyncWriteRndStr.WriteRndStr); int numNewLineBytes; - int waitTime; Debug.WriteLine("Case BytesToWrite : Verifying BytesToWrite with one call to Write"); @@ -199,19 +187,12 @@ namespace System.IO.Ports.Tests //Write a random string asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForWriteBufferToLoad(com, s_STRING_SIZE_BYTES_TO_WRITE + numNewLineBytes); - //Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -221,11 +202,10 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com, s_STRING_SIZE_BYTES_TO_WRITE); - Thread t1 = new Thread(asyncWriteRndStr.WriteRndStr); - Thread t2 = new Thread(asyncWriteRndStr.WriteRndStr); + var t1 = new Task(asyncWriteRndStr.WriteRndStr); + var t2 = new Task(asyncWriteRndStr.WriteRndStr); int numNewLineBytes; - int waitTime; Debug.WriteLine("Case BytesToWriteSuccessive : Verifying BytesToWrite with successive calls to Write"); @@ -236,29 +216,18 @@ namespace System.IO.Ports.Tests //Write a random string asynchronously so we can verify some things while the write call is blocking t1.Start(); - waitTime = 0; - while (t1.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t1); TCSupport.WaitForWriteBufferToLoad(com, s_STRING_SIZE_BYTES_TO_WRITE + numNewLineBytes); //Write a random string asynchronously so we can verify some things while the write call is blocking t2.Start(); - waitTime = 0; - while (t2.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t2); TCSupport.WaitForWriteBufferToLoad(com, (s_STRING_SIZE_BYTES_TO_WRITE + numNewLineBytes) * 2); //Wait for both write methods to timeout - while (t1.IsAlive || t2.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t1); + var aggregatedException = Assert.Throws(() => TCSupport.WaitForTaskCompletion(t2)); + Assert.IsType(aggregatedException.InnerException); } } @@ -268,27 +237,14 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com, s_STRING_SIZE_HANDSHAKE); - Thread t = new Thread(asyncWriteRndStr.WriteRndStr); - - int waitTime; + var t = new Task(asyncWriteRndStr.WriteRndStr); //Write a random string asynchronously so we can verify some things while the write call is blocking Debug.WriteLine("Case Handshake_None : Verifying Handshake=None"); com.Open(); t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - //Wait for both write methods to timeout - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); Assert.Equal(0, com.BytesToWrite); } } diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs index 63d95abbd9..1e8a12325f 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs @@ -23,10 +23,10 @@ namespace System.IO.Ports.Tests private const int DEFAULT_BUFFER_OFFSET = 0; private const int DEFAULT_BUFFER_COUNT = 1; - //The maximum buffer size when a exception occurs + //The maximum buffer size when an exception occurs private const int MAX_BUFFER_SIZE_FOR_EXCEPTION = 255; - //The maximum buffer size when a exception is not expected + //The maximum buffer size when an exception is not expected private const int MAX_BUFFER_SIZE = 8; //The default number of times the write method is called when verifying write diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int_Generic.cs index bf691a0ef7..42fb8a4864 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_byte_int_int_Generic.cs @@ -6,10 +6,10 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -141,9 +141,7 @@ namespace System.IO.Ports.Tests { Random rndGen = new Random(-55); AsyncEnableRts asyncEnableRts = new AsyncEnableRts(); - Thread t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime; + var t = new Task(asyncEnableRts.EnableRTS); com1.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Handshake = Handshake.RequestToSend; @@ -155,14 +153,7 @@ namespace System.IO.Ports.Tests //Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed //before the timeout is reached t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); try { @@ -174,9 +165,7 @@ namespace System.IO.Ports.Tests asyncEnableRts.Stop(); - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); VerifyTimeout(com1); } } @@ -187,9 +176,7 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com, BYTE_SIZE_BYTES_TO_WRITE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - - int waitTime; + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); Debug.WriteLine("Verifying BytesToWrite with one call to Write"); @@ -199,19 +186,11 @@ namespace System.IO.Ports.Tests //Write a random byte[] asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForExactWriteBufferLoad(com, BYTE_SIZE_BYTES_TO_WRITE); //Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -222,10 +201,8 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com, BYTE_SIZE_BYTES_TO_WRITE); - Thread t1 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - Thread t2 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - - int waitTime; + var t1 = new Task(asyncWriteRndByteArray.WriteRndByteArray); + var t2 = new Task(asyncWriteRndByteArray.WriteRndByteArray); Debug.WriteLine("Verifying BytesToWrite with successive calls to Write"); com.Handshake = Handshake.RequestToSend; @@ -234,30 +211,18 @@ namespace System.IO.Ports.Tests //Write a random byte[] asynchronously so we can verify some things while the write call is blocking t1.Start(); - waitTime = 0; - - while (t1.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t1); TCSupport.WaitForExactWriteBufferLoad(com, BYTE_SIZE_BYTES_TO_WRITE); //Write a random byte[] asynchronously so we can verify some things while the write call is blocking t2.Start(); - waitTime = 0; - while (t2.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t2); TCSupport.WaitForExactWriteBufferLoad(com, BYTE_SIZE_BYTES_TO_WRITE * 2); //Wait for both write methods to timeout - while (t1.IsAlive || t2.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t1); + var aggregatedException = Assert.Throws(() => TCSupport.WaitForTaskCompletion(t2)); + Assert.IsType(aggregatedException.InnerException); } } @@ -267,26 +232,14 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com, BYTE_SIZE_HANDSHAKE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - - int waitTime; + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); //Write a random byte[] asynchronously so we can verify some things while the write call is blocking Debug.WriteLine("Verifying Handshake=None"); com.Open(); t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - //Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); if (0 != com.BytesToWrite) { @@ -435,11 +388,10 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, BYTE_SIZE_HANDSHAKE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); byte[] XOffBuffer = new byte[1]; byte[] XOnBuffer = new byte[1]; - int waitTime; XOffBuffer[0] = 19; XOnBuffer[0] = 17; @@ -464,16 +416,7 @@ namespace System.IO.Ports.Tests //Write a random byte asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - waitTime = 0; - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForExactWriteBufferLoad(com1, BYTE_SIZE_HANDSHAKE); //Verify that CtsHolding is false if the RequestToSend or RequestToSendXOnXOff handshake method is used @@ -493,10 +436,7 @@ namespace System.IO.Ports.Tests com2.Write(XOnBuffer, 0, 1); } - //Wait till write finishes - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); Assert.Equal(0, com1.BytesToWrite); //Verify that CtsHolding is true if the RequestToSend or RequestToSendXOnXOff handshake method is used diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int.cs index 1f2bf7115c..1cebe54ede 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int.cs @@ -23,10 +23,10 @@ namespace System.IO.Ports.Tests private const int DEFAULT_CHAR_OFFSET = 0; private const int DEFAULT_CHAR_COUNT = 1; - //The maximum buffer size when a exception occurs + //The maximum buffer size when an exception occurs private const int MAX_BUFFER_SIZE_FOR_EXCEPTION = 255; - //The maximum buffer size when a exception is not expected + //The maximum buffer size when an exception is not expected private const int MAX_BUFFER_SIZE = 8; //The default number of times the write method is called when verifying write diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs index 850be56901..dc61a4569c 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs @@ -6,10 +6,10 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -146,9 +146,7 @@ namespace System.IO.Ports.Tests { Random rndGen = new Random(-55); AsyncEnableRts asyncEnableRts = new AsyncEnableRts(); - Thread t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime = 0; + var t = new Task(asyncEnableRts.EnableRTS); com1.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Handshake = Handshake.RequestToSend; @@ -160,14 +158,7 @@ namespace System.IO.Ports.Tests //Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed //before the timeout is reached t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); try { @@ -179,8 +170,7 @@ namespace System.IO.Ports.Tests asyncEnableRts.Stop(); - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); VerifyTimeout(com1); } @@ -192,9 +182,7 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndCharArray asyncWriteRndCharArray = new AsyncWriteRndCharArray(com, CHAR_SIZE_BYTES_TO_WRITE); - Thread t = new Thread(asyncWriteRndCharArray.WriteRndCharArray); - - int waitTime = 0; + var t = new Task(asyncWriteRndCharArray.WriteRndCharArray); Debug.WriteLine("Verifying BytesToWrite with one call to Write"); @@ -204,19 +192,9 @@ namespace System.IO.Ports.Tests //Write a random char[] asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForExactWriteBufferLoad(com, CHAR_SIZE_BYTES_TO_WRITE); - - //Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -226,10 +204,8 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndCharArray asyncWriteRndCharArray = new AsyncWriteRndCharArray(com, CHAR_SIZE_BYTES_TO_WRITE); - Thread t1 = new Thread(asyncWriteRndCharArray.WriteRndCharArray); - Thread t2 = new Thread(asyncWriteRndCharArray.WriteRndCharArray); - - int waitTime = 0; + var t1 = new Task(asyncWriteRndCharArray.WriteRndCharArray); + var t2 = new Task(asyncWriteRndCharArray.WriteRndCharArray); Debug.WriteLine("Verifying BytesToWrite with successive calls to Write"); @@ -239,31 +215,18 @@ namespace System.IO.Ports.Tests //Write a random char[] asynchronously so we can verify some things while the write call is blocking t1.Start(); - waitTime = 0; - - while (t1.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t1); TCSupport.WaitForExactWriteBufferLoad(com, CHAR_SIZE_BYTES_TO_WRITE); //Write a random char[] asynchronously so we can verify some things while the write call is blocking t2.Start(); - waitTime = 0; - - while (t2.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t2); TCSupport.WaitForExactWriteBufferLoad(com, CHAR_SIZE_BYTES_TO_WRITE * 2); //Wait for both write methods to timeout - while (t1.IsAlive || t2.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t1); + var aggregatedException = Assert.Throws(() => TCSupport.WaitForTaskCompletion(t2)); + Assert.IsType(aggregatedException.InnerException); } } @@ -273,9 +236,7 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndCharArray asyncWriteRndCharArray = new AsyncWriteRndCharArray(com, CHAR_SIZE_HANDSHAKE); - Thread t = new Thread(asyncWriteRndCharArray.WriteRndCharArray); - - int waitTime; + var t = new Task(asyncWriteRndCharArray.WriteRndCharArray); //Write a random char[] asynchronously so we can verify some things while the write call is blocking Debug.WriteLine("Verifying Handshake=None"); @@ -283,17 +244,7 @@ namespace System.IO.Ports.Tests com.Open(); t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - //Wait for both write methods to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); Assert.Equal(0, com.BytesToWrite); } @@ -438,12 +389,10 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { AsyncWriteRndCharArray asyncWriteRndCharArray = new AsyncWriteRndCharArray(com1, CHAR_SIZE_HANDSHAKE); - Thread t = - new Thread(asyncWriteRndCharArray.WriteRndCharArray); + var t = new Task(asyncWriteRndCharArray.WriteRndCharArray); byte[] XOffBuffer = new byte[1]; byte[] XOnBuffer = new byte[1]; - int waitTime = 0; XOffBuffer[0] = 19; XOnBuffer[0] = 17; @@ -468,15 +417,7 @@ namespace System.IO.Ports.Tests //Write a random char array asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForExactWriteBufferLoad(com1, CHAR_SIZE_HANDSHAKE); //Verify that CtsHolding is false if the RequestToSend or RequestToSendXOnXOff handshake method is used @@ -496,9 +437,7 @@ namespace System.IO.Ports.Tests com2.Write(XOnBuffer, 0, 1); } - //Wait till write finishes - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); //Verify that the correct number of bytes are in the buffer Assert.Equal(0, com1.BytesToWrite); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs index 5048acedc6..b2a230e5e2 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs @@ -6,10 +6,10 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -142,9 +142,7 @@ namespace System.IO.Ports.Tests { Random rndGen = new Random(-55); AsyncEnableRts asyncEnableRts = new AsyncEnableRts(); - Thread t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime; + var t = new Task(asyncEnableRts.EnableRTS); com1.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Handshake = Handshake.RequestToSend; @@ -158,14 +156,7 @@ namespace System.IO.Ports.Tests //Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed //before the timeout is reached t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); try { @@ -177,8 +168,7 @@ namespace System.IO.Ports.Tests asyncEnableRts.Stop(); - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); VerifyTimeout(com1); } @@ -190,9 +180,7 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com, s_STRING_SIZE_BYTES_TO_WRITE); - Thread t = new Thread(asyncWriteRndStr.WriteRndStr); - - int waitTime; + var t = new Task(asyncWriteRndStr.WriteRndStr); Debug.WriteLine("Verifying BytesToWrite with one call to Write"); com.Handshake = Handshake.RequestToSend; @@ -201,20 +189,9 @@ namespace System.IO.Ports.Tests //Write a random string asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForWriteBufferToLoad(com, s_STRING_SIZE_BYTES_TO_WRITE); - - //Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -224,10 +201,8 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com, s_STRING_SIZE_BYTES_TO_WRITE); - var t1 = new Thread(asyncWriteRndStr.WriteRndStr); - var t2 = new Thread(asyncWriteRndStr.WriteRndStr); - - int waitTime; + var t1 = new Task(asyncWriteRndStr.WriteRndStr); + var t2 = new Task(asyncWriteRndStr.WriteRndStr); Debug.WriteLine("Verifying BytesToWrite with successive calls to Write"); com.Handshake = Handshake.RequestToSend; @@ -236,33 +211,18 @@ namespace System.IO.Ports.Tests //Write a random string asynchronously so we can verify some things while the write call is blocking t1.Start(); - waitTime = 0; - - while (t1.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t1); TCSupport.WaitForWriteBufferToLoad(com, s_STRING_SIZE_BYTES_TO_WRITE); //Write a random string asynchronously so we can verify some things while the write call is blocking t2.Start(); - waitTime = 0; - - while (t2.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t2); TCSupport.WaitForWriteBufferToLoad(com, s_STRING_SIZE_BYTES_TO_WRITE * 2); //Wait for both write methods to timeout - while (t1.IsAlive || t2.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t1); + var aggregatedException = Assert.Throws(() => TCSupport.WaitForTaskCompletion(t2)); + Assert.IsType(aggregatedException.InnerException); } } @@ -272,27 +232,14 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com, STRING_SIZE_HANDSHAKE); - Thread t = new Thread(asyncWriteRndStr.WriteRndStr); - - int waitTime; + var t = new Task(asyncWriteRndStr.WriteRndStr); //Write a random string asynchronously so we can verify some things while the write call is blocking Debug.WriteLine("Verifying Handshake=None"); com.Open(); t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - //Wait for both write methods to timeout - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); Assert.Equal(0, com.BytesToWrite); } } @@ -438,11 +385,10 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { AsyncWriteRndStr asyncWriteRndStr = new AsyncWriteRndStr(com1, STRING_SIZE_HANDSHAKE); - Thread t = new Thread(asyncWriteRndStr.WriteRndStr); + var t = new Task(asyncWriteRndStr.WriteRndStr); byte[] XOffBuffer = new byte[1]; byte[] XOnBuffer = new byte[1]; - int waitTime; XOffBuffer[0] = 19; XOnBuffer[0] = 17; @@ -467,15 +413,7 @@ namespace System.IO.Ports.Tests //Write a random string asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - //Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForExactWriteBufferLoad(com1, STRING_SIZE_HANDSHAKE); //Verify that CtsHolding is false if the RequestToSend or RequestToSendXOnXOff handshake method is used @@ -496,8 +434,7 @@ namespace System.IO.Ports.Tests } //Wait till write finishes - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); //Verify that the correct number of bytes are in the buffer if (0 != com1.BytesToWrite) diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead.cs index f6fae70314..a637413f9b 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead.cs @@ -26,10 +26,10 @@ namespace System.IO.Ports.Tests private const int defaultByteOffset = 0; private const int defaultByteCount = 1; - // The maximum buffer size when a exception occurs + // The maximum buffer size when an exception occurs private const int maxBufferSizeForException = 255; - // The maximum buffer size when a exception is not expected + // The maximum buffer size when an exception is not expected private const int maxBufferSize = 8; // Maximum time to wait for processing the read command to complete diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs index a0f1397046..e7c1007b14 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs @@ -6,9 +6,9 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -238,8 +238,7 @@ namespace System.IO.Ports.Tests IAsyncResult readAsyncResult; var asyncRead = new AsyncRead(com1); - var asyncEndRead = new Thread(asyncRead.EndRead); - int waitTime; + var asyncEndRead = new Task(asyncRead.EndRead); var asyncCallbackCalled = false; com1.Open(); @@ -260,24 +259,11 @@ namespace System.IO.Ports.Tests } asyncEndRead.Start(); - - waitTime = 0; - while (asyncEndRead.ThreadState == ThreadState.Unstarted && waitTime < MAX_WAIT_THREAD) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - if (MAX_WAIT_THREAD <= waitTime) - { - Fail("Err_018158ajied!!!: Expected EndRead to have returned"); - } - + TCSupport.WaitForTaskToStart(asyncEndRead); Thread.Sleep(100 < com1.ReadTimeout ? 2 * com1.ReadTimeout : 200); // Sleep for 200ms or 2 times the ReadTimeout - if (!asyncEndRead.IsAlive) + if (!asyncEndRead.IsCompleted) { // Verify EndRead is blocking and is still alive Fail("Err_4085858aiehe!!!: Expected read to not have completed"); @@ -290,19 +276,8 @@ namespace System.IO.Ports.Tests com2.Write(new byte[8], 0, 8); - waitTime = 0; - while (asyncEndRead.IsAlive && waitTime < MAX_WAIT_THREAD) - { - Thread.Sleep(50); - waitTime += 50; - } - - if (MAX_WAIT_THREAD <= waitTime) - { - Fail("Err_018158ajied!!!: Expected EndRead to have returned"); - } - - waitTime = 0; + TCSupport.WaitForTaskCompletion(asyncEndRead); + var waitTime = 0; while (!asyncCallbackCalled && waitTime < 5000) { Thread.Sleep(50); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite.cs index 40934daf83..37dd8a5066 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite.cs @@ -23,10 +23,10 @@ namespace System.IO.Ports.Tests private const int DEFAULT_BUFFER_OFFSET = 0; private const int DEFAULT_BUFFER_COUNT = 1; - // The maximum buffer size when a exception occurs + // The maximum buffer size when an exception occurs private const int MAX_BUFFER_SIZE_FOR_EXCEPTION = 255; - // The maximum buffer size when a exception is not expected + // The maximum buffer size when an exception is not expected private const int MAX_BUFFER_SIZE = 8; // The default number of times the write method is called when verifying write diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite_Generic.cs index 6271ade570..e4af930b0a 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/BeginWrite_Generic.cs @@ -5,9 +5,9 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -268,8 +268,7 @@ namespace System.IO.Ports.Tests using (var com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { var asyncRead = new AsyncWrite(com1); - var asyncEndWrite = new Thread(asyncRead.EndWrite); - int waitTime; + var asyncEndWrite = new Task(asyncRead.EndWrite); var asyncCallbackCalled = false; com1.Open(); @@ -290,24 +289,11 @@ namespace System.IO.Ports.Tests } asyncEndWrite.Start(); - - waitTime = 0; - while (asyncEndWrite.ThreadState == ThreadState.Unstarted && waitTime < MAX_WAIT_THREAD) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - if (MAX_WAIT_THREAD <= waitTime) - { - Fail("Err_018158ajied!!!: Expected EndRead to have returned"); - } - + TCSupport.WaitForTaskToStart(asyncEndWrite); Thread.Sleep(100 < com1.WriteTimeout ? 2 * com1.WriteTimeout : 200); // Sleep for 200ms or 2 times the WriteTimeout - if (!asyncEndWrite.IsAlive) + if (asyncEndWrite.IsCompleted) { // Verify EndRead is blocking and is still alive Fail("Err_4085858aiehe!!!: Expected read to not have completed"); @@ -320,19 +306,8 @@ namespace System.IO.Ports.Tests com2.RtsEnable = true; - waitTime = 0; - while (asyncEndWrite.IsAlive && waitTime < MAX_WAIT_THREAD) - { - Thread.Sleep(50); - waitTime += 50; - } - - if (MAX_WAIT_THREAD <= waitTime) - { - Fail("Err_018158ajied!!!: Expected EndRead to have returned"); - } - - waitTime = 0; + TCSupport.WaitForTaskCompletion(asyncEndWrite); + var waitTime = 0; while (!asyncCallbackCalled && waitTime < 5000) { Thread.Sleep(50); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/Flush.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/Flush.cs index 2ae8a711fe..c90ab87558 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/Flush.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/Flush.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; @@ -133,7 +134,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, DEFAULT_BUFFER_SIZE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); Debug.WriteLine("Verifying Flush method after output buffer has been filled"); @@ -147,9 +148,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); - // Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -159,7 +158,7 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, DEFAULT_BUFFER_SIZE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); Debug.WriteLine("Verifying call Flush method several times after output buffer has been filled"); @@ -175,9 +174,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); VerifyFlush(com1); - // Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -187,8 +184,8 @@ namespace System.IO.Ports.Tests using (SerialPort com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, DEFAULT_BUFFER_SIZE); - Thread t1 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - Thread t2 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t1 = new Task(asyncWriteRndByteArray.WriteRndByteArray); + var t2 = new Task(asyncWriteRndByteArray.WriteRndByteArray); int elapsedTime; @@ -210,9 +207,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); - // Wait for write method to timeout - while (t1.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t1); t2.Start(); @@ -220,9 +215,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); - // Wait for write method to timeout - while (t2.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t2); } } @@ -233,7 +226,7 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, DEFAULT_BUFFER_SIZE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); byte[] xmitBytes = new byte[DEFAULT_BUFFER_SIZE]; @@ -256,9 +249,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); - // Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -269,7 +260,7 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, DEFAULT_BUFFER_SIZE); - Thread t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); int elapsedTime = 0; byte[] xmitBytes = new byte[DEFAULT_BUFFER_SIZE]; @@ -301,9 +292,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); VerifyFlush(com1); - // Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -314,8 +303,8 @@ namespace System.IO.Ports.Tests using (SerialPort com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { AsyncWriteRndByteArray asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, DEFAULT_BUFFER_SIZE); - Thread t1 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - Thread t2 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t1 = new Task(asyncWriteRndByteArray.WriteRndByteArray); + var t2 = new Task(asyncWriteRndByteArray.WriteRndByteArray); byte[] xmitBytes = new byte[DEFAULT_BUFFER_SIZE]; @@ -339,9 +328,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); - // Wait for write method to timeout - while (t1.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t1); t2.Start(); @@ -353,9 +340,7 @@ namespace System.IO.Ports.Tests VerifyFlush(com1); - // Wait for write method to timeout - while (t2.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t2); } } diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadByte_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadByte_Generic.cs index 19922f2376..f4060fbab1 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadByte_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadByte_Generic.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -105,7 +106,7 @@ namespace System.IO.Ports.Tests using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var rndGen = new Random(-55); - var t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); @@ -128,9 +129,7 @@ namespace System.IO.Ports.Tests { } - // Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); // Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadTimeout.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadTimeout.cs index 4e8f360e39..63f149973a 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadTimeout.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/ReadTimeout.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -164,7 +165,7 @@ namespace System.IO.Ports.Tests { using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - var t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.Open(); Stream stream = com1.BaseStream; @@ -186,9 +187,7 @@ namespace System.IO.Ports.Tests { } - // Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); // Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); @@ -220,7 +219,7 @@ namespace System.IO.Ports.Tests { using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { - var t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.Open(); Stream stream = com1.BaseStream; @@ -242,9 +241,7 @@ namespace System.IO.Ports.Tests { } - // Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); // Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); @@ -376,7 +373,7 @@ namespace System.IO.Ports.Tests com1.BaseStream.ReadTimeout = readTimeout; Assert.True(readTimeout == com1.BaseStream.ReadTimeout, - string.Format("Err_7071ahpsb!!! Expected ReadTimeout to be {0} actaul {1}", readTimeout, + string.Format("Err_7071ahpsb!!! Expected ReadTimeout to be {0} actual {1}", readTimeout, com1.BaseStream.ReadTimeout)); VerifyLongTimeout(readMethod, com1, com2); @@ -386,19 +383,18 @@ namespace System.IO.Ports.Tests private void VerifyLongTimeout(ReadMethodDelegate readMethod, SerialPort com1, SerialPort com2) { var readThread = new ReadDelegateThread(com1.BaseStream, readMethod); - var t = new Thread(readThread.CallRead); + var t = new Task(readThread.CallRead); t.Start(); Thread.Sleep(DEFAULT_WAIT_LONG_TIMEOUT); - Assert.True(t.IsAlive, + Assert.False(t.IsCompleted, string.Format("Err_17071ahpa!!! {0} terminated with a long timeout of {1}ms", readMethod.Method.Name, com1.BaseStream.ReadTimeout)); com2.Write(new byte[8], 0, 8); - while (t.IsAlive) - Thread.Sleep(10); + TCSupport.WaitForTaskCompletion(t); } private void VerifyTimeout(ReadMethodDelegate readMethod, int readTimeout) @@ -412,7 +408,7 @@ namespace System.IO.Ports.Tests com1.BaseStream.ReadTimeout = readTimeout; Assert.True(readTimeout == com1.BaseStream.ReadTimeout, - string.Format("Err_236897ahpbm!!! Expected ReadTimeout to be {0} actaul {1}", readTimeout, + string.Format("Err_236897ahpbm!!! Expected ReadTimeout to be {0} actual {1}", readTimeout, com1.BaseStream.ReadTimeout)); VerifyTimeout(readMethod, com1.BaseStream); @@ -481,7 +477,7 @@ namespace System.IO.Ports.Tests com1.BaseStream.ReadTimeout = 0; Assert.True(0 == com1.BaseStream.ReadTimeout, - string.Format("Err_72072ahps!!! Expected ReadTimeout to be {0} actaul {1}", 0, + string.Format("Err_72072ahps!!! Expected ReadTimeout to be {0} actual {1}", 0, com1.BaseStream.ReadTimeout)); Verify0Timeout(readMethod, com1.BaseStream); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int.cs index 5564f751fe..144bfe2e72 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int.cs @@ -25,10 +25,10 @@ namespace System.IO.Ports.Tests private const int defaultByteOffset = 0; private const int defaultByteCount = 1; - // The maximum buffer size when a exception occurs + // The maximum buffer size when an exception occurs private const int maxBufferSizeForException = 255; - // The maximum buffer size when a exception is not expected + // The maximum buffer size when an exception is not expected private const int maxBufferSize = 8; #region Test Cases diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int_Generic.cs index 057daf1b26..1b8184d485 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/Read_byte_int_int_Generic.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; @@ -117,7 +118,7 @@ namespace System.IO.Ports.Tests using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var rndGen = new Random(-55); - var t = new Thread(WriteToCom1); + var t = new Task(WriteToCom1); com1.ReadTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Encoding = new UTF8Encoding(); @@ -138,9 +139,7 @@ namespace System.IO.Ports.Tests { } - // Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); // Make sure there is no bytes in the buffer so the next call to read will timeout com1.DiscardInBuffer(); diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteByte_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteByte_Generic.cs index 88ec79e975..b6b846d415 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteByte_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteByte_Generic.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -124,9 +123,7 @@ namespace System.IO.Ports.Tests { var rndGen = new Random(-55); var asyncEnableRts = new AsyncEnableRts(); - var t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime; + var t = new Task(asyncEnableRts.EnableRTS); com1.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Handshake = Handshake.RequestToSend; @@ -140,15 +137,7 @@ namespace System.IO.Ports.Tests // Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed // before the timeout is reached t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); try { com1.BaseStream.WriteByte(DEFAULT_BYTE); @@ -158,10 +147,7 @@ namespace System.IO.Ports.Tests } asyncEnableRts.Stop(); - - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); VerifyTimeout(com1); } } diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteTimeout.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteTimeout.cs index 3e6b8d171a..e01e2bafd0 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteTimeout.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/WriteTimeout.cs @@ -5,10 +5,10 @@ using System.Diagnostics; using System.IO.PortsTests; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -193,9 +193,7 @@ namespace System.IO.Ports.Tests using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var asyncEnableRts = new AsyncEnableRts(); - var t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime; + var t = new Task(asyncEnableRts.EnableRTS); com1.Open(); com1.Handshake = Handshake.RequestToSend; @@ -209,15 +207,7 @@ namespace System.IO.Ports.Tests // Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed // before the timeout is reached t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); try { stream.Write(new byte[s_DEFAULT_WRITE_BYTE_ARRAY_SIZE], 0, s_DEFAULT_WRITE_BYTE_ARRAY_SIZE); @@ -228,9 +218,7 @@ namespace System.IO.Ports.Tests asyncEnableRts.Stop(); - // Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); // Make sure there is no bytes in the buffer so the next call to write will timeout com1.DiscardInBuffer(); @@ -265,9 +253,7 @@ namespace System.IO.Ports.Tests using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var asyncEnableRts = new AsyncEnableRts(); - var t = new Thread(asyncEnableRts.EnableRTS); - - int waitTime; + var t = new Task(asyncEnableRts.EnableRTS); com1.Open(); com1.Handshake = Handshake.RequestToSend; @@ -281,15 +267,7 @@ namespace System.IO.Ports.Tests // Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed // before the timeout is reached t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); try { stream.WriteByte(DEFAULT_WRITE_BYTE); @@ -300,9 +278,7 @@ namespace System.IO.Ports.Tests asyncEnableRts.Stop(); - // Wait for the thread to finish - while (t.IsAlive) - Thread.Sleep(50); + TCSupport.WaitForTaskCompletion(t); // Make sure there is no bytes in the buffer so the next call to write will timeout com1.DiscardInBuffer(); @@ -418,15 +394,14 @@ namespace System.IO.Ports.Tests private void VerifyLongTimeout(WriteMethodDelegate writeMethod, SerialPort com1) { var writeThread = new WriteDelegateThread(com1.BaseStream, writeMethod); - var t = new Thread(writeThread.CallWrite); + var t = new Task(writeThread.CallWrite); t.Start(); Thread.Sleep(DEFAULT_WAIT_LONG_TIMEOUT); - Assert.True(t.IsAlive, + Assert.False(t.IsCompleted, string.Format("Err_17071ahpa!!! {0} terminated with a long timeout of {1}ms", writeMethod.Method.Name, com1.BaseStream.WriteTimeout)); com1.Handshake = Handshake.None; - while (t.IsAlive) - Thread.Sleep(10); + TCSupport.WaitForTaskCompletion(t); } private void VerifyTimeout(WriteMethodDelegate writeMethod, int WriteTimeout) diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int.cs index 33b650e9db..170bdfeb01 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int.cs @@ -23,10 +23,10 @@ namespace System.IO.Ports.Tests private const int DEFAULT_BUFFER_OFFSET = 0; private const int DEFAULT_BUFFER_COUNT = 1; - // The maximum buffer size when a exception occurs + // The maximum buffer size when an exception occurs private const int MAX_BUFFER_SIZE_FOR_EXCEPTION = 255; - // The maximum buffer size when a exception is not expected + // The maximum buffer size when an exception is not expected private const int MAX_BUFFER_SIZE = 8; // The default number of times the write method is called when verifying write diff --git a/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int_Generic.cs b/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int_Generic.cs index 8b348d5c70..3d7ca41107 100644 --- a/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int_Generic.cs +++ b/external/corefx/src/System.IO.Ports/tests/SerialStream/Write_byte_int_int_Generic.cs @@ -2,15 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Configuration; using System.Diagnostics; using System.IO.PortsTests; using System.Text; using System.Threading; +using System.Threading.Tasks; using Legacy.Support; using Xunit; using Xunit.NetCore.Extensions; -using ThreadState = System.Threading.ThreadState; namespace System.IO.Ports.Tests { @@ -136,7 +135,7 @@ namespace System.IO.Ports.Tests { var rndGen = new Random(-55); var asyncEnableRts = new AsyncEnableRts(); - var t = new Thread(asyncEnableRts.EnableRTS); + var t = new Task(asyncEnableRts.EnableRTS); com1.WriteTimeout = rndGen.Next(minRandomTimeout, maxRandomTimeout); com1.Handshake = Handshake.RequestToSend; @@ -150,14 +149,7 @@ namespace System.IO.Ports.Tests // Call EnableRTS asynchronously this will enable RTS in the middle of the following write call allowing it to succeed // before the timeout is reached t.Start(); - var waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); try { @@ -169,9 +161,7 @@ namespace System.IO.Ports.Tests asyncEnableRts.Stop(); - while (t.IsAlive) - Thread.Sleep(100); - + TCSupport.WaitForTaskCompletion(t); VerifyTimeout(com1); } } @@ -182,7 +172,7 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var asyncWriteRndByteArray = new AsyncWriteRndByteArray(com, s_BYTE_SIZE_BYTES_TO_WRITE); - var t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); Debug.WriteLine("Verifying BytesToWrite with one call to Write"); @@ -192,20 +182,11 @@ namespace System.IO.Ports.Tests // Write a random byte[] asynchronously so we can verify some things while the write call is blocking t.Start(); - var waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForWriteBufferToLoad(com, s_BYTE_SIZE_BYTES_TO_WRITE); - // Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); } } @@ -216,8 +197,8 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var asyncWriteRndByteArray = new AsyncWriteRndByteArray(com, s_BYTE_SIZE_BYTES_TO_WRITE); - var t1 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); - var t2 = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t1 = new Task(asyncWriteRndByteArray.WriteRndByteArray); + var t2 = new Task(asyncWriteRndByteArray.WriteRndByteArray); Debug.WriteLine("Verifying BytesToWrite with successive calls to Write"); @@ -227,33 +208,17 @@ namespace System.IO.Ports.Tests // Write a random byte[] asynchronously so we can verify some things while the write call is blocking t1.Start(); - var waitTime = 0; - - while (t1.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t1); TCSupport.WaitForExactWriteBufferLoad(com, s_BYTE_SIZE_BYTES_TO_WRITE); // Write a random byte[] asynchronously so we can verify some things while the write call is blocking t2.Start(); - waitTime = 0; - - while (t2.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t2); TCSupport.WaitForExactWriteBufferLoad(com, s_BYTE_SIZE_BYTES_TO_WRITE * 2); // Wait for both write methods to timeout - while (t1.IsAlive || t2.IsAlive) - Thread.Sleep(100); + var aggregatedException = Assert.Throws(() => TCSupport.WaitForTaskCompletion(t2)); + Assert.IsType(aggregatedException.InnerException); } } @@ -263,25 +228,14 @@ namespace System.IO.Ports.Tests using (SerialPort com = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) { var asyncWriteRndByteArray = new AsyncWriteRndByteArray(com, s_BYTE_SIZE_HANDSHAKE); - var t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); // Write a random byte[] asynchronously so we can verify some things while the write call is blocking Debug.WriteLine("Verifying Handshake=None"); com.Open(); t.Start(); - var waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - - // Wait for write method to timeout - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); Assert.Equal(0, com.BytesToWrite); } @@ -438,11 +392,10 @@ namespace System.IO.Ports.Tests using (var com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) { var asyncWriteRndByteArray = new AsyncWriteRndByteArray(com1, s_BYTE_SIZE_HANDSHAKE); - var t = new Thread(asyncWriteRndByteArray.WriteRndByteArray); + var t = new Task(asyncWriteRndByteArray.WriteRndByteArray); var XOffBuffer = new byte[1]; var XOnBuffer = new byte[1]; - int waitTime; XOffBuffer[0] = 19; XOnBuffer[0] = 17; @@ -467,15 +420,7 @@ namespace System.IO.Ports.Tests // Write a random byte asynchronously so we can verify some things while the write call is blocking t.Start(); - waitTime = 0; - - while (t.ThreadState == ThreadState.Unstarted && waitTime < 2000) - { - // Wait for the thread to start - Thread.Sleep(50); - waitTime += 50; - } - + TCSupport.WaitForTaskToStart(t); TCSupport.WaitForWriteBufferToLoad(com1, s_BYTE_SIZE_HANDSHAKE); // Verify that CtsHolding is false if the RequestToSend or RequestToSendXOnXOff handshake method is used @@ -496,9 +441,7 @@ namespace System.IO.Ports.Tests com2.BaseStream.Write(XOnBuffer, 0, 1); } - // Wait till write finishes - while (t.IsAlive) - Thread.Sleep(100); + TCSupport.WaitForTaskCompletion(t); // Verify that the correct number of bytes are in the buffer Assert.Equal(0, com1.BytesToWrite); diff --git a/external/corefx/src/System.IO.Ports/tests/Support/PortHelper.cs b/external/corefx/src/System.IO.Ports/tests/Support/PortHelper.cs index 6f052265f5..fce77e6916 100644 --- a/external/corefx/src/System.IO.Ports/tests/Support/PortHelper.cs +++ b/external/corefx/src/System.IO.Ports/tests/Support/PortHelper.cs @@ -20,9 +20,9 @@ namespace Legacy.Support public static string[] GetPorts() { - if (PlatformDetection.IsWinRT) + if (PlatformDetection.IsUap) { - return new string[0]; // we are waiting for a Win32 new QueryDosDevice API since the current doesn't work for Uap https://github.com/dotnet/corefx/issues/21156 + return new [] { "COM3", "COM4", "COM5", "COM6", "COM7" }; // we are waiting for a Win32 new QueryDosDevice API since the current doesn't work for Uap https://github.com/dotnet/corefx/issues/21156 } List ports = new List(); diff --git a/external/corefx/src/System.IO.Ports/tests/Support/PortsTest.cs b/external/corefx/src/System.IO.Ports/tests/Support/PortsTest.cs index 38e446ca86..74148b20a3 100644 --- a/external/corefx/src/System.IO.Ports/tests/Support/PortsTest.cs +++ b/external/corefx/src/System.IO.Ports/tests/Support/PortsTest.cs @@ -28,7 +28,7 @@ namespace System.IO.PortsTests /// /// Shows that we can inhibit transmission using hardware flow control - /// Some kinds of virtual port or RS485 adaptor can't do this + /// Some kinds of virtual port or RS485 adapter can't do this /// public static bool HasHardwareFlowControl => TCSupport.HardwareWriteBlockingAvailable; diff --git a/external/corefx/src/System.IO.Ports/tests/Support/SerialPortProperties.cs b/external/corefx/src/System.IO.Ports/tests/Support/SerialPortProperties.cs index 11039aef3f..8f251737c1 100644 --- a/external/corefx/src/System.IO.Ports/tests/Support/SerialPortProperties.cs +++ b/external/corefx/src/System.IO.Ports/tests/Support/SerialPortProperties.cs @@ -301,7 +301,7 @@ namespace Legacy.Support object retVal = null; // Only Set the default value if it exists in the defaultProperties Hashtable - // This will prevent the abilility to create arbitrary keys(Property names) + // This will prevent the ability to create arbitrary keys(Property names) if (null != defaultProperties[name]) { retVal = _properties[name]; diff --git a/external/corefx/src/System.IO.Ports/tests/Support/TCSupport.cs b/external/corefx/src/System.IO.Ports/tests/Support/TCSupport.cs index 812b931851..ce3448c171 100644 --- a/external/corefx/src/System.IO.Ports/tests/Support/TCSupport.cs +++ b/external/corefx/src/System.IO.Ports/tests/Support/TCSupport.cs @@ -150,8 +150,9 @@ namespace Legacy.Support openablePortNames.Add(portName); } - catch (Exception) + catch (Exception e) { + PrintInfo("Exception opening port {0}: {1}", portName, e); } } } diff --git a/external/corefx/src/System.IO.Ports/tests/Support/TestEventHandler.cs b/external/corefx/src/System.IO.Ports/tests/Support/TestEventHandler.cs index 18b6af5012..eed41b74d5 100644 --- a/external/corefx/src/System.IO.Ports/tests/Support/TestEventHandler.cs +++ b/external/corefx/src/System.IO.Ports/tests/Support/TestEventHandler.cs @@ -27,8 +27,10 @@ namespace Legacy.Support private readonly bool _shouldWait; private readonly AutoResetEvent _eventHandlerWait = new AutoResetEvent(false); private readonly object _lock = new object(); + private bool _successfulWait; public int NumEventsHandled { get; private set; } + public bool SuccessfulWait => !_shouldWait || _successfulWait; /// /// If you set this filter, then it must return 'true' to record an event @@ -78,7 +80,7 @@ namespace Legacy.Support if (_shouldWait) { - Assert.True(_eventHandlerWait.WaitOne(10000)); + _successfulWait = _eventHandlerWait.WaitOne(10000); } } @@ -144,7 +146,7 @@ namespace Legacy.Support } } } - Assert.True(false, $"Failed to validate event type {eventType}"); + Assert.True(false, $"Failed to validate event type {eventType}. Received: {string.Join(", ", _eventTypes)}"); } public int NumberOfOccurrencesOfType(T eventType) @@ -172,4 +174,4 @@ namespace Legacy.Support return sb.ToString(); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.IO.Ports/tests/System.IO.Ports.Tests.csproj b/external/corefx/src/System.IO.Ports/tests/System.IO.Ports.Tests.csproj index f0412cb9ab..4a0c0ce5ba 100644 --- a/external/corefx/src/System.IO.Ports/tests/System.IO.Ports.Tests.csproj +++ b/external/corefx/src/System.IO.Ports/tests/System.IO.Ports.Tests.csproj @@ -5,11 +5,11 @@ {4259DCE9-3480-40BB-B08A-64A2D446264B} InnerLoop;OuterLoop + - @@ -118,9 +118,6 @@ - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream.sln b/external/corefx/src/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream.sln index 881110f514..a7fb85a5d9 100644 --- a/external/corefx/src/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream.sln +++ b/external/corefx/src/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream.sln @@ -26,10 +26,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {55F26FB1-D4AF-48CA-A470-83113AE7BFDB}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU {BCF9255A-4321-4277-AD7D-F5094092C554}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU {BCF9255A-4321-4277-AD7D-F5094092C554}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {BCF9255A-4321-4277-AD7D-F5094092C554}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/Configurations.props b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/Configurations.props index c398e42e89..77a4b65bc9 100644 --- a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/Configurations.props +++ b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/Configurations.props @@ -3,6 +3,7 @@ netstandard; + netcoreapp; \ No newline at end of file diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/System.IO.UnmanagedMemoryStream.Tests.csproj b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/System.IO.UnmanagedMemoryStream.Tests.csproj index 935064fd8b..d3b733ccf2 100644 --- a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/System.IO.UnmanagedMemoryStream.Tests.csproj +++ b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/System.IO.UnmanagedMemoryStream.Tests.csproj @@ -7,6 +7,8 @@ + + @@ -17,15 +19,14 @@ - + + - - - \ No newline at end of file + diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsRead.cs b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsRead.cs deleted file mode 100644 index 8f7aa3a4c3..0000000000 --- a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsRead.cs +++ /dev/null @@ -1,197 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace System.IO.Tests -{ - public class UmsReadTests - { - [Fact] - public static void EmptyStreamRead() - { - using (var manager = new UmsManager(FileAccess.Read, 0)) - { - UnmanagedMemoryStream stream = manager.Stream; - UmsTests.ReadUmsInvariants(stream); - - var position = stream.Position; - Assert.Equal(manager.Stream.ReadByte(), -1); // end of stream - Assert.Equal(stream.Position, position); - } - - using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(1)) - using (var stream = new UnmanagedMemoryStream(buffer, 0, 0)) - { - var position = stream.Position; - Assert.Equal(stream.ReadByte(), -1); // end of stream - Assert.Equal(stream.Position, position); - } - } - - [Fact] - public static void OneByteStreamRead() - { - using (var manager = new UmsManager(FileAccess.Read, new byte[] { 100 })) - { - UnmanagedMemoryStream stream = manager.Stream; - UmsTests.ReadUmsInvariants(stream); - - var position = stream.Position; - Assert.Equal(stream.ReadByte(), 100); - Assert.Equal(stream.Position, position + 1); - - position = stream.Position; - Assert.Equal(stream.ReadByte(), -1); // end of stream - Assert.Equal(stream.Position, position); - } - - using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(1)) - using (var stream = new UnmanagedMemoryStream(buffer, 0, 1, FileAccess.ReadWrite)) - { - buffer.Write(0, (byte)100); - - var position = stream.Position; - Assert.Equal(stream.ReadByte(), 100); - Assert.Equal(stream.Position, position + 1); - - Assert.Equal(stream.ReadByte(), -1); // end of stream - Assert.Equal(stream.Position, position + 1); - } - } - - [Fact] - public static void CannotReadFromWriteStream() - { - using (var manager = new UmsManager(FileAccess.Write, 100)) - { - Stream stream = manager.Stream; - Assert.Throws(() => stream.ReadByte()); - } - - using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(100)) - using (var stream = new UnmanagedMemoryStream(buffer, 0, 100, FileAccess.Write)) - { - Assert.Throws(() => stream.ReadByte()); - } - } - - void ReadToEnd(UmsManager manager) - { - Stream stream = manager.Stream; - if (stream.CanRead) - { - byte[] read = ReadAllBytes(stream); - Assert.Equal(stream.Position, read.Length); - Assert.Equal(manager.ToArray(), read, ArrayHelpers.Comparer()); - } - else - { - Assert.Throws(() => stream.ReadByte()); - } - } - - [Fact] - public static void InvalidReadWrite() - { - const int length = 1000; - using (var manager = new UmsManager(FileAccess.Read, length)) - { - UnmanagedMemoryStream stream = manager.Stream; - - //case#3: call Read with null, ArgumentNullException should be thrown. - Assert.Throws(() => stream.Read(null, 0, 3)); - Assert.Throws(() => stream.ReadAsync(null, 0, 3).GetAwaiter().GetResult()); - Assert.Throws(() => stream.Write(null, 0, 7)); - Assert.Throws(() => stream.WriteAsync(null, 0, 7).GetAwaiter().GetResult()); - - //case#4: call Read with start<0, ArgumentOutOfRangeException should be thrown. - Assert.Throws(() => stream.Read(new byte[] { }, SByte.MinValue, 9)); - Assert.Throws(() => stream.ReadAsync(new byte[] { }, SByte.MinValue, 9).GetAwaiter().GetResult()); - Assert.Throws(() => stream.Write(new byte[] { }, -1, 6)); - Assert.Throws(() => stream.WriteAsync(new byte[] { }, -1, 6).GetAwaiter().GetResult()); - - //case#5: call Read with count<0, ArgumentOutOfRangeException should be thrown. - Assert.Throws(() => stream.Read(new byte[] { }, 0, -1)); - Assert.Throws(() => stream.ReadAsync(new byte[] { }, 0, -1).GetAwaiter().GetResult()); - Assert.Throws(() => stream.Write(new byte[] { }, 1, -2)); - Assert.Throws(() => stream.WriteAsync(new byte[] { }, 1, -2).GetAwaiter().GetResult()); - - //case#6: call Read with count > ums.Length-startIndex, ArgumentOutOfRangeException should be thrown. - AssertExtensions.Throws(null, () => stream.Read(new byte[10], 0, 11)); // "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection." - AssertExtensions.Throws(null, () => stream.ReadAsync(new byte[10], 0, 11).GetAwaiter().GetResult()); - AssertExtensions.Throws(null, () => stream.Write(new byte[3], 0, 4)); - AssertExtensions.Throws(null, () => stream.WriteAsync(new byte[3], 0, 4).GetAwaiter().GetResult()); - - //case#10: Call Read on a n length stream, (Capacity is implicitly n), position is set to end, call it, should throw ArgumentException. - AssertExtensions.Throws(null, () => stream.Read(new byte[] { }, 0, 1)); - AssertExtensions.Throws(null, () => stream.Write(new byte[] { }, 0, 1)); - } - } - - public static byte[] ReadAllBytes(Stream stream) - { - List read = new List(); - while (true) - { - byte[] buffer = new byte[1024]; - int bytesRead = stream.Read(buffer, 0, buffer.Length); - if (bytesRead == 0) { break; } - read.AddRange(new ArraySegment(buffer, 0, bytesRead)); - } - return read.ToArray(); - } - - [Fact] - public static unsafe void ReadFromBufferBackedStream() - { - const int length = 8192; - byte[] data = new byte[length]; - - using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(length)) - { - for (ulong i = 0; i < length; i++) - buffer.Write(i, unchecked((byte)i)); - - Action validateData = () => { - for (int i = 0; i < length; i++) - Assert.Equal(unchecked((byte)i), data[i]); - }; - - using (var stream = new UnmanagedMemoryStream(buffer, 0, length, FileAccess.Read)) - { - stream.Position = 0; - Assert.Equal(length, stream.Read(data, 0, length)); - validateData(); - Array.Clear(data, 0, data.Length); - - stream.Position = 0; - Assert.Equal(length / 2, stream.Read(data, 0, length / 2)); - Assert.Equal(length / 2, stream.Read(data, length / 2, length / 2)); - validateData(); - Array.Clear(data, 0, data.Length); - - Assert.True(stream.ReadAsync(data, 0, data.Length, new CancellationToken(true)).IsCanceled); - - stream.Position = 0; - Task t = stream.ReadAsync(data, 0, length / 4); - Assert.True(t.Status == TaskStatus.RanToCompletion); - Assert.Equal(length / 4, t.Result); - t = stream.ReadAsync(data, length / 4, length / 4); - Assert.True(t.Status == TaskStatus.RanToCompletion); - Assert.Equal(length / 4, t.Result); - t = stream.ReadAsync(data, length / 2, length / 2); - Assert.True(t.Status == TaskStatus.RanToCompletion); - Assert.Equal(length / 2, t.Result); - validateData(); - Array.Clear(data, 0, data.Length); - } - } - } - - } -} diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs index 24947fe3c6..a89773ca4d 100644 --- a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs +++ b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs @@ -2,15 +2,194 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.IO.Tests { - public class UmsReadWriteTests + public sealed class ArrayUmsReadWriteTests : UmsReadWriteTests { + public override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + stream.Read(array, offset, count); + public override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + stream.Write(array, offset, count); + + [Fact] + public static void InvalidReadWrite() + { + const int length = 1000; + using (var manager = new UmsManager(FileAccess.Read, length)) + { + UnmanagedMemoryStream stream = manager.Stream; + + //case#3: call Read with null, ArgumentNullException should be thrown. + Assert.Throws(() => stream.Read(null, 0, 3)); + Assert.Throws(() => stream.ReadAsync(null, 0, 3).GetAwaiter().GetResult()); + Assert.Throws(() => stream.Write(null, 0, 7)); + Assert.Throws(() => stream.WriteAsync(null, 0, 7).GetAwaiter().GetResult()); + + //case#4: call Read with start<0, ArgumentOutOfRangeException should be thrown. + Assert.Throws(() => stream.Read(new byte[] { }, SByte.MinValue, 9)); + Assert.Throws(() => stream.ReadAsync(new byte[] { }, SByte.MinValue, 9).GetAwaiter().GetResult()); + Assert.Throws(() => stream.Write(new byte[] { }, -1, 6)); + Assert.Throws(() => stream.WriteAsync(new byte[] { }, -1, 6).GetAwaiter().GetResult()); + + //case#5: call Read with count<0, ArgumentOutOfRangeException should be thrown. + Assert.Throws(() => stream.Read(new byte[] { }, 0, -1)); + Assert.Throws(() => stream.ReadAsync(new byte[] { }, 0, -1).GetAwaiter().GetResult()); + Assert.Throws(() => stream.Write(new byte[] { }, 1, -2)); + Assert.Throws(() => stream.WriteAsync(new byte[] { }, 1, -2).GetAwaiter().GetResult()); + + //case#6: call Read with count > ums.Length-startIndex, ArgumentOutOfRangeException should be thrown. + AssertExtensions.Throws(null, () => stream.Read(new byte[10], 0, 11)); // "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection." + AssertExtensions.Throws(null, () => stream.ReadAsync(new byte[10], 0, 11).GetAwaiter().GetResult()); + AssertExtensions.Throws(null, () => stream.Write(new byte[3], 0, 4)); + AssertExtensions.Throws(null, () => stream.WriteAsync(new byte[3], 0, 4).GetAwaiter().GetResult()); + + //case#10: Call Read on a n length stream, (Capacity is implicitly n), position is set to end, call it, should throw ArgumentException. + AssertExtensions.Throws(null, () => stream.Read(new byte[] { }, 0, 1)); + AssertExtensions.Throws(null, () => stream.Write(new byte[] { }, 0, 1)); + } + } + } + + public abstract class UmsReadWriteTests + { + public abstract int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count); + public abstract void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count); + + [Fact] + public void EmptyStreamRead() + { + using (var manager = new UmsManager(FileAccess.Read, 0)) + { + UnmanagedMemoryStream stream = manager.Stream; + UmsTests.ReadUmsInvariants(stream); + + var position = stream.Position; + Assert.Equal(manager.Stream.ReadByte(), -1); // end of stream + Assert.Equal(stream.Position, position); + } + + using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(1)) + using (var stream = new UnmanagedMemoryStream(buffer, 0, 0)) + { + var position = stream.Position; + Assert.Equal(stream.ReadByte(), -1); // end of stream + Assert.Equal(stream.Position, position); + } + } + + [Fact] + public void OneByteStreamRead() + { + using (var manager = new UmsManager(FileAccess.Read, new byte[] { 100 })) + { + UnmanagedMemoryStream stream = manager.Stream; + UmsTests.ReadUmsInvariants(stream); + + var position = stream.Position; + Assert.Equal(stream.ReadByte(), 100); + Assert.Equal(stream.Position, position + 1); + + position = stream.Position; + Assert.Equal(stream.ReadByte(), -1); // end of stream + Assert.Equal(stream.Position, position); + } + + using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(1)) + using (var stream = new UnmanagedMemoryStream(buffer, 0, 1, FileAccess.ReadWrite)) + { + buffer.Write(0, (byte)100); + + var position = stream.Position; + Assert.Equal(stream.ReadByte(), 100); + Assert.Equal(stream.Position, position + 1); + + Assert.Equal(stream.ReadByte(), -1); // end of stream + Assert.Equal(stream.Position, position + 1); + } + } + + [Fact] + public void CannotReadFromWriteStream() + { + using (var manager = new UmsManager(FileAccess.Write, 100)) + { + Stream stream = manager.Stream; + Assert.Throws(() => stream.ReadByte()); + } + + using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(100)) + using (var stream = new UnmanagedMemoryStream(buffer, 0, 100, FileAccess.Write)) + { + Assert.Throws(() => stream.ReadByte()); + } + } + + private byte[] ReadAllBytes(UnmanagedMemoryStream stream) + { + var buffer = new byte[1024]; + int numRead; + var result = new MemoryStream(); + while ((numRead = Read(stream, buffer, 0, buffer.Length)) > 0) + { + result.Write(buffer, 0, numRead); + } + return result.ToArray(); + } + + [Fact] + public unsafe void ReadFromBufferBackedStream() + { + const int length = 8192; + byte[] data = new byte[length]; + + using (HGlobalSafeBuffer buffer = new HGlobalSafeBuffer(length)) + { + for (ulong i = 0; i < length; i++) + buffer.Write(i, unchecked((byte)i)); + + Action validateData = () => { + for (int i = 0; i < length; i++) + Assert.Equal(unchecked((byte)i), data[i]); + }; + + using (var stream = new UnmanagedMemoryStream(buffer, 0, length, FileAccess.Read)) + { + stream.Position = 0; + Assert.Equal(length, Read(stream, data, 0, length)); + validateData(); + Array.Clear(data, 0, data.Length); + + stream.Position = 0; + Assert.Equal(length / 2, Read(stream, data, 0, length / 2)); + Assert.Equal(length / 2, Read(stream, data, length / 2, length / 2)); + validateData(); + Array.Clear(data, 0, data.Length); + + Assert.True(stream.ReadAsync(data, 0, data.Length, new CancellationToken(true)).IsCanceled); + + stream.Position = 0; + Task t = stream.ReadAsync(data, 0, length / 4); + Assert.True(t.Status == TaskStatus.RanToCompletion); + Assert.Equal(length / 4, t.Result); + t = stream.ReadAsync(data, length / 4, length / 4); + Assert.True(t.Status == TaskStatus.RanToCompletion); + Assert.Equal(length / 4, t.Result); + t = stream.ReadAsync(data, length / 2, length / 2); + Assert.True(t.Status == TaskStatus.RanToCompletion); + Assert.Equal(length / 2, t.Result); + validateData(); + Array.Clear(data, 0, data.Length); + } + } + } + // TODO: add tests for different offsets and lengths [Fact] - public static void ReadWrite() + public void ReadWrite() { const int length = 1000; using (var manager = new UmsManager(FileAccess.ReadWrite, length)) @@ -21,25 +200,25 @@ namespace System.IO.Tests var bytes = ArrayHelpers.CreateByteArray(length); var copy = bytes.Copy(); - stream.Write(copy, 0, length); + Write(stream, copy, 0, length); var memory = manager.ToArray(); Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); stream.Seek(0, SeekOrigin.Begin); - byte[] read = UmsReadTests.ReadAllBytes(stream); + byte[] read = ReadAllBytes(stream); Assert.Equal(stream.Position, read.Length); byte[] current = manager.ToArray(); Assert.Equal(current, read, ArrayHelpers.Comparer()); Assert.Equal(bytes, read, ArrayHelpers.Comparer()); - stream.Write(new byte[0], 0, 0); + Write(stream, new byte[0], 0, 0); } } [Fact] - public static void ReadWriteByte() + public void ReadWriteByte() { const int length = 1000; using (var manager = new UmsManager(FileAccess.ReadWrite, length)) @@ -63,5 +242,112 @@ namespace System.IO.Tests Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); } } + + + [Fact] + public void Write() + { + const int length = 1000; + using (var manager = new UmsManager(FileAccess.Write, length)) + { + UnmanagedMemoryStream stream = manager.Stream; + UmsTests.WriteUmsInvariants(stream); + Assert.Equal(stream.Length, length); + + var bytes = ArrayHelpers.CreateByteArray(length); + Write(stream, bytes.Copy(), 0, length); + var memory = manager.ToArray(); + Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); + + Write(stream, new byte[0], 0, 0); + + stream.SetLength(1); + Assert.Equal(1, stream.Length); + stream.SetLength(4); + Assert.Equal(4, stream.Length); + stream.SetLength(0); + Assert.Equal(0, stream.Length); + + stream.Position = 1; + bytes = ArrayHelpers.CreateByteArray(length - 1); + Write(stream, bytes, 0, length - 1); + memory = manager.ToArray(); + for (int i = 0; i < bytes.Length; i++) + { + Assert.Equal(bytes[i], memory[i + 1]); + } + + Assert.True(stream.WriteAsync(bytes, 0, bytes.Length, new CancellationToken(true)).IsCanceled); + + stream.Position = 0; + bytes = ArrayHelpers.CreateByteArray(length); + for (int i = 0; i < 4; i++) + { + Task t = stream.WriteAsync(bytes, i * (bytes.Length / 4), bytes.Length / 4); + Assert.True(t.Status == TaskStatus.RanToCompletion); + } + Assert.Equal(bytes, manager.ToArray(), ArrayHelpers.Comparer()); + } + } + + [Fact] + public void WriteByte() + { + const int length = 1000; + using (var manager = new UmsManager(FileAccess.Write, length)) + { + UnmanagedMemoryStream stream = manager.Stream; + UmsTests.WriteUmsInvariants(stream); + + var bytes = ArrayHelpers.CreateByteArray(length); + for (int index = 0; index < bytes.Length; index++) + { + stream.WriteByte(bytes[index]); + } + var memory = manager.ToArray(); + Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); + + stream.SetLength(0); + stream.Position = 1; + bytes = ArrayHelpers.CreateByteArray(length); + for (int index = 1; index < bytes.Length; index++) + { + stream.WriteByte(bytes[index]); + } + stream.Position = 0; + stream.WriteByte(bytes[0]); + memory = manager.ToArray(); + Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); + } + } + + [Fact] + public void CannotWriteToReadStream() + { + using (var manager = new UmsManager(FileAccess.Read, 1000)) + { + UnmanagedMemoryStream stream = manager.Stream; + UmsTests.ReadUmsInvariants(stream); + + var bytes = new byte[3]; + Assert.Throws(() => Write(stream, bytes, 0, bytes.Length)); + Assert.Throws(() => stream.WriteByte(1)); + } + } + + [Fact] + public void CannotWriteWithOverflow() + { + using (var manager = new UmsManager(FileAccess.Write, 1000)) + { + UnmanagedMemoryStream stream = manager.Stream; + UmsTests.WriteUmsInvariants(stream); + + stream.Position = long.MaxValue; + var bytes = new byte[3]; + Assert.Throws(() => Write(stream, bytes, 0, bytes.Length)); + Assert.Throws(() => stream.WriteByte(1)); + } + } } } diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs new file mode 100644 index 0000000000..a438d9cf42 --- /dev/null +++ b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.IO.Tests +{ + public sealed class SpanUmsReadWriteTests : UmsReadWriteTests + { + public override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + stream.Read(new Span(array, offset, count)); + public override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + stream.Write(new Span(array, offset, count)); + } + + public sealed class MemoryUmsReadWriteTests : UmsReadWriteTests + { + public override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + stream.ReadAsync(new Memory(array, offset, count)).GetAwaiter().GetResult(); + public override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + stream.WriteAsync(new Memory(array, offset, count)).GetAwaiter().GetResult(); + } +} diff --git a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsWrite.cs b/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsWrite.cs deleted file mode 100644 index e5df54bd15..0000000000 --- a/external/corefx/src/System.IO.UnmanagedMemoryStream/tests/UmsWrite.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace System.IO.Tests -{ - public class UmsWriteTests - { - [Fact] - public static void Write() - { - const int length = 1000; - using (var manager = new UmsManager(FileAccess.Write, length)) - { - UnmanagedMemoryStream stream = manager.Stream; - UmsTests.WriteUmsInvariants(stream); - Assert.Equal(stream.Length, length); - - var bytes = ArrayHelpers.CreateByteArray(length); - stream.Write(bytes.Copy(), 0, length); - var memory = manager.ToArray(); - Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); - - stream.Write(new byte[0], 0, 0); - - stream.SetLength(1); - Assert.Equal(1, stream.Length); - stream.SetLength(4); - Assert.Equal(4, stream.Length); - stream.SetLength(0); - Assert.Equal(0, stream.Length); - - stream.Position = 1; - bytes = ArrayHelpers.CreateByteArray(length - 1); - stream.Write(bytes, 0, length - 1); - memory = manager.ToArray(); - for (int i = 0; i < bytes.Length; i++) - { - Assert.Equal(bytes[i], memory[i + 1]); - } - - Assert.True(stream.WriteAsync(bytes, 0, bytes.Length, new CancellationToken(true)).IsCanceled); - - stream.Position = 0; - bytes = ArrayHelpers.CreateByteArray(length); - for (int i = 0; i < 4; i++) - { - Task t = stream.WriteAsync(bytes, i * (bytes.Length / 4), bytes.Length / 4); - Assert.True(t.Status == TaskStatus.RanToCompletion); - } - Assert.Equal(bytes, manager.ToArray(), ArrayHelpers.Comparer()); - } - } - - [Fact] - public static void WriteByte() - { - const int length = 1000; - using (var manager = new UmsManager(FileAccess.Write, length)) - { - UnmanagedMemoryStream stream = manager.Stream; - UmsTests.WriteUmsInvariants(stream); - - var bytes = ArrayHelpers.CreateByteArray(length); - for (int index = 0; index < bytes.Length; index++) - { - stream.WriteByte(bytes[index]); - } - var memory = manager.ToArray(); - Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); - - stream.SetLength(0); - stream.Position = 1; - bytes = ArrayHelpers.CreateByteArray(length); - for (int index = 1; index < bytes.Length; index++) - { - stream.WriteByte(bytes[index]); - } - stream.Position = 0; - stream.WriteByte(bytes[0]); - memory = manager.ToArray(); - Assert.Equal(bytes, memory, ArrayHelpers.Comparer()); - } - } - - [Fact] - public static void CannotWriteToReadStream() - { - using (var manager = new UmsManager(FileAccess.Read, 1000)) - { - UnmanagedMemoryStream stream = manager.Stream; - UmsTests.ReadUmsInvariants(stream); - - var bytes = new byte[3]; - Assert.Throws(() => stream.Write(bytes, 0, bytes.Length)); - Assert.Throws(() => stream.WriteByte(1)); - } - } - - [Fact] - public static void CannotWriteWithOverflow() - { - using (var manager = new UmsManager(FileAccess.Write, 1000)) - { - UnmanagedMemoryStream stream = manager.Stream; - UmsTests.WriteUmsInvariants(stream); - - stream.Position = long.MaxValue; - var bytes = new byte[3]; - Assert.Throws(() => stream.Write(bytes, 0, bytes.Length)); - Assert.Throws(() => stream.WriteByte(1)); - } - } - - } -} diff --git a/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.cs b/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.cs index 7764e7b60d..f64de6936f 100644 --- a/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.cs +++ b/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.cs @@ -5,12 +5,13 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using Xunit; namespace System.IO.Tests { - public class BinaryReaderTests + public partial class BinaryReaderTests { protected virtual Stream CreateStream() { @@ -130,5 +131,62 @@ namespace System.IO.Tests } } } + + [Theory] + [InlineData(100, 0, 100, 100, 100)] + [InlineData(100, 25, 50, 100, 50)] + [InlineData(50, 0, 100, 100, 50)] + [InlineData(0, 0, 10, 10, 0)] + public void Read_CharArray(int sourceSize, int index, int count, int destinationSize, int expectedReadLength) + { + using (var stream = CreateStream()) + { + var source = new char[sourceSize]; + var random = new Random(345); + + for (int i = 0; i < sourceSize; i++) + { + source[i] = (char)random.Next(0, 127); + } + + stream.Write(Encoding.ASCII.GetBytes(source), 0, source.Length); + stream.Position = 0; + + using (var reader = new BinaryReader(stream, Encoding.ASCII)) + { + var destination = new char[destinationSize]; + + int readCount = reader.Read(destination, index, count); + + Assert.Equal(expectedReadLength, readCount); + Assert.Equal(source.Take(readCount), destination.Skip(index).Take(readCount)); + + // Make sure we didn't write past the end + Assert.True(destination.Skip(readCount + index).All(b => b == default(char))); + } + } + } + + [Theory] + [InlineData(new[] { 'h', 'e', 'l', 'l', 'o' }, 5, new[] { 'h', 'e', 'l', 'l', 'o' })] + [InlineData(new[] { 'h', 'e', 'l', 'l', 'o' }, 8, new[] { 'h', 'e', 'l', 'l', 'o' })] + [InlineData(new[] { 'h', 'e', '\0', '\0', 'o' }, 5, new[] { 'h', 'e', '\0', '\0', 'o' })] + [InlineData(new[] { 'h', 'e', 'l', 'l', 'o' }, 0, new char[0])] + [InlineData(new char[0], 5, new char[0])] + public void ReadChars(char[] source, int readLength, char[] expected) + { + using (var stream = CreateStream()) + { + stream.Write(Encoding.ASCII.GetBytes(source), 0, source.Length); + stream.Position = 0; + + using (var reader = new BinaryReader(stream)) + { + var destination = reader.ReadChars(readLength); + + Assert.Equal(expected, destination); + } + } + } } } diff --git a/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.netcoreapp.cs new file mode 100644 index 0000000000..8cd56e7169 --- /dev/null +++ b/external/corefx/src/System.IO/tests/BinaryReader/BinaryReaderTests.netcoreapp.cs @@ -0,0 +1,97 @@ +using System.Linq; +using System.Text; +using Xunit; + +namespace System.IO.Tests +{ + public partial class BinaryReaderTests + { + [Theory] + [InlineData(100, 100, 100)] + [InlineData(100, 50, 50)] + [InlineData(50, 100, 50)] + [InlineData(10, 0, 0)] + [InlineData(0, 10, 0)] + public void Read_ByteSpan(int sourceSize, int destinationSize, int expectedReadLength) + { + using (var stream = CreateStream()) + { + var source = new byte[sourceSize]; + new Random(345).NextBytes(source); + stream.Write(source, 0, source.Length); + stream.Position = 0; + + using (var reader = new BinaryReader(stream)) + { + var destination = new byte[destinationSize]; + + int readCount = reader.Read(new Span(destination)); + + Assert.Equal(expectedReadLength, readCount); + Assert.Equal(source.Take(expectedReadLength), destination.Take(expectedReadLength)); + + // Make sure we didn't write past the end + Assert.True(destination.Skip(expectedReadLength).All(b => b == default(byte))); + } + } + } + + [Fact] + public void Read_ByteSpan_ThrowIfDisposed() + { + using (var memStream = CreateStream()) + { + var binaryReader = new BinaryReader(memStream); + binaryReader.Dispose(); + Assert.Throws(() => binaryReader.Read(new Span())); + } + } + + [Theory] + [InlineData(100, 100, 100)] + [InlineData(100, 50, 50)] + [InlineData(50, 100, 50)] + [InlineData(10, 0, 0)] + [InlineData(0, 10, 0)] + public void Read_CharSpan(int sourceSize, int destinationSize, int expectedReadLength) + { + using (var stream = CreateStream()) + { + var source = new char[sourceSize]; + var random = new Random(345); + + for (int i = 0; i < sourceSize; i++) + { + source[i] = (char)random.Next(0, 127); + } + + stream.Write(Encoding.ASCII.GetBytes(source), 0, source.Length); + stream.Position = 0; + + using (var reader = new BinaryReader(stream, Encoding.ASCII)) + { + var destination = new char[destinationSize]; + + int readCount = reader.Read(new Span(destination)); + + Assert.Equal(expectedReadLength, readCount); + Assert.Equal(source.Take(expectedReadLength), destination.Take(expectedReadLength)); + + // Make sure we didn't write past the end + Assert.True(destination.Skip(expectedReadLength).All(b => b == default(char))); + } + } + } + + [Fact] + public void Read_CharSpan_ThrowIfDisposed() + { + using (var memStream = CreateStream()) + { + var binaryReader = new BinaryReader(memStream); + binaryReader.Dispose(); + Assert.Throws(() => binaryReader.Read(new Span())); + } + } + } +} diff --git a/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.cs b/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.cs index d1d70747bd..f003820acd 100644 --- a/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.cs +++ b/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.cs @@ -9,7 +9,7 @@ using System.Text; namespace System.IO.Tests { - public class BinaryWriter_WriteByteCharTests + public partial class BinaryWriter_WriteByteCharTests { protected virtual Stream CreateStream() { diff --git a/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.netcoreapp.cs new file mode 100644 index 0000000000..32167f23f0 --- /dev/null +++ b/external/corefx/src/System.IO/tests/BinaryWriter/BinaryWriter.WriteByteCharTests.netcoreapp.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System; +using System.IO; +using System.Text; + +namespace System.IO.Tests +{ + public partial class BinaryWriter_WriteByteCharTests + { + [Fact] + public void BinaryWriter_WriteSpan() + { + byte[] bytes = new byte[] { 4, 2, 7, 0xFF }; + char[] chars = new char[] { 'a', '7', Char.MaxValue }; + Span byteSpan = new Span(bytes); + Span charSpan = new Span(chars); + + using (Stream memoryStream = CreateStream()) + { + using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.Unicode)) + { + binaryWriter.Write(byteSpan); + binaryWriter.Write(charSpan); + + Stream baseStream = binaryWriter.BaseStream; + baseStream.Position = 2; + + Assert.Equal(7, baseStream.ReadByte()); + Assert.Equal(0xFF, baseStream.ReadByte()); + + char testChar; + + testChar = BitConverter.ToChar(new byte[] { (byte)baseStream.ReadByte(), (byte)baseStream.ReadByte() }, 0); + Assert.Equal('a', testChar); + + testChar = BitConverter.ToChar(new byte[] { (byte)baseStream.ReadByte(), (byte)baseStream.ReadByte() }, 0); + Assert.Equal('7', testChar); + + testChar = BitConverter.ToChar(new byte[] { (byte)baseStream.ReadByte(), (byte)baseStream.ReadByte() }, 0); + Assert.Equal(Char.MaxValue, testChar); + } + } + } + } +} diff --git a/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.cs b/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.cs index b8a9cf44f0..17d4f2d502 100644 --- a/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.cs +++ b/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.cs @@ -29,7 +29,7 @@ namespace System.IO.Tests { tasks[i] = stream.WriteAsync(data, 250 * i, 250); } - Assert.False(tasks.All(t => t.IsCompleted)); + Assert.All(tasks, t => Assert.Equal(TaskStatus.WaitingForActivation, t.Status)); mcaos.Release(); await Task.WhenAll(tasks); @@ -54,8 +54,10 @@ namespace System.IO.Tests Assert.Equal(TaskStatus.Faulted, stream.FlushAsync().Status); } - [Fact] - public async Task CopyToAsyncTest_RequiresAsyncFlushingOfWrites() + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task CopyToTest_RequiresFlushingOfWrites(bool copyAsynchronously) { byte[] data = Enumerable.Range(0, 1000).Select(i => (byte)(i % 256)).ToArray(); @@ -70,17 +72,27 @@ namespace System.IO.Tests src.WriteByte(42); dst.WriteByte(42); - Task copyTask = src.CopyToAsync(dst); - manualReleaseStream.Release(); - await copyTask; + if (copyAsynchronously) + { + Task copyTask = src.CopyToAsync(dst); + manualReleaseStream.Release(); + await copyTask; + } + else + { + manualReleaseStream.Release(); + src.CopyTo(dst); + } Assert.Equal(data, dst.ToArray()); } [Theory] - [InlineData(false)] - [InlineData(true)] - public async Task CopyToAsyncTest_ReadBeforeCopy_CopiesAllData(bool wrappedStreamCanSeek) + [InlineData(false, false)] + [InlineData(false, true)] + [InlineData(true, false)] + [InlineData(true, true)] + public async Task CopyToTest_ReadBeforeCopy_CopiesAllData(bool copyAsynchronously, bool wrappedStreamCanSeek) { byte[] data = Enumerable.Range(0, 1000).Select(i => (byte)(i % 256)).ToArray(); @@ -94,7 +106,14 @@ namespace System.IO.Tests src.ReadByte(); var dst = new MemoryStream(); - await src.CopyToAsync(dst); + if (copyAsynchronously) + { + await src.CopyToAsync(dst); + } + else + { + src.CopyTo(dst); + } var expected = new byte[data.Length - 1]; Array.Copy(data, 1, expected, 0, expected.Length); @@ -245,13 +264,22 @@ namespace System.IO.Tests } } - internal sealed class ManuallyReleaseAsyncOperationsStream : MemoryStream + internal sealed class ManuallyReleaseAsyncOperationsStream : Stream { + private readonly MemoryStream _stream = new MemoryStream(); private readonly TaskCompletionSource _tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); private bool _canSeek = true; public override bool CanSeek => _canSeek; + public override bool CanRead => _stream.CanRead; + + public override bool CanWrite => _stream.CanWrite; + + public override long Length => _stream.Length; + + public override long Position { get => _stream.Position; set => _stream.Position = value; } + public void SetCanSeek(bool canSeek) => _canSeek = canSeek; public void Release() { _tcs.SetResult(true); } @@ -259,38 +287,44 @@ namespace System.IO.Tests public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { await _tcs.Task; - return await base.ReadAsync(buffer, offset, count, cancellationToken); + return await _stream.ReadAsync(buffer, offset, count, cancellationToken); } public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { await _tcs.Task; - await base.WriteAsync(buffer, offset, count, cancellationToken); + await _stream.WriteAsync(buffer, offset, count, cancellationToken); } public override async Task FlushAsync(CancellationToken cancellationToken) { await _tcs.Task; - await base.FlushAsync(cancellationToken); + await _stream.FlushAsync(cancellationToken); } + + public override void Flush() => _stream.Flush(); + public override int Read(byte[] buffer, int offset, int count) => _stream.Read(buffer, offset, count); + public override long Seek(long offset, SeekOrigin origin) => _stream.Seek(offset, origin); + public override void SetLength(long value) => _stream.SetLength(value); + public override void Write(byte[] buffer, int offset, int count) => _stream.Write(buffer, offset, count); } internal sealed class ThrowsExceptionFromAsyncOperationsStream : MemoryStream { - public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { + public override int Read(byte[] buffer, int offset, int count) => throw new InvalidOperationException("Exception from ReadAsync"); - } - public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { + public override void Write(byte[] buffer, int offset, int count) => + throw new InvalidOperationException("Exception from ReadAsync"); + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => + throw new InvalidOperationException("Exception from ReadAsync"); + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => throw new InvalidOperationException("Exception from WriteAsync"); - } - public override Task FlushAsync(CancellationToken cancellationToken) - { + public override Task FlushAsync(CancellationToken cancellationToken) => throw new InvalidOperationException("Exception from FlushAsync"); - } } public class BufferedStream_NS17 diff --git a/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.netcoreapp.cs index 01ad4e0e3a..7ead9aa31e 100644 --- a/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.netcoreapp.cs +++ b/external/corefx/src/System.IO/tests/BufferedStream/BufferedStreamTests.netcoreapp.cs @@ -2,7 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.IO; +using System.Threading; +using System.Threading.Tasks; using Xunit; namespace System.IO.Tests @@ -23,5 +24,67 @@ namespace System.IO.Tests var bufferedStream = new BufferedStream(new MemoryStream(), 1234); Assert.Equal(1234, bufferedStream.BufferSize); } + + [Theory] + [InlineData(1, 1)] + [InlineData(1, 2)] + [InlineData(1024, 4096)] + [InlineData(4096, 4097)] + [InlineData(4096, 1)] + [InlineData(2047, 4096)] + public void ReadSpan_WriteSpan_AllDataCopied(int spanSize, int bufferSize) + { + byte[] data = new byte[80000]; + new Random(42).NextBytes(data); + + var result = new MemoryStream(); + using (var output = new BufferedStream(result, bufferSize)) + using (var input = new BufferedStream(new MemoryStream(data), bufferSize)) + { + Span span = new byte[spanSize]; + int bytesRead; + while ((bytesRead = input.Read(span)) != 0) + { + output.Write(span.Slice(0, bytesRead)); + } + } + Assert.Equal(data, result.ToArray()); + } + + [Theory] + [InlineData(1, 1)] + [InlineData(1, 2)] + [InlineData(1024, 4096)] + [InlineData(4096, 4097)] + [InlineData(4096, 1)] + [InlineData(2047, 4096)] + public async Task ReadMemory_WriteMemory_AllDataCopied(int spanSize, int bufferSize) + { + byte[] data = new byte[80000]; + new Random(42).NextBytes(data); + + var result = new MemoryStream(); + using (var output = new BufferedStream(result, bufferSize)) + using (var input = new BufferedStream(new MemoryStream(data), bufferSize)) + { + Memory memory = new byte[spanSize]; + int bytesRead; + while ((bytesRead = await input.ReadAsync(memory)) != 0) + { + await output.WriteAsync(memory.Slice(0, bytesRead)); + } + } + Assert.Equal(data, result.ToArray()); + } + + [Fact] + public void ReadWriteMemory_Precanceled_Throws() + { + using (var bs = new BufferedStream(new MemoryStream())) + { + Assert.Equal(TaskStatus.Canceled, bs.ReadAsync(new byte[1], new CancellationToken(true)).AsTask().Status); + Assert.Equal(TaskStatus.Canceled, bs.WriteAsync(new byte[1], new CancellationToken(true)).Status); + } + } } } diff --git a/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.cs b/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.cs index f57ac616e7..57112c244f 100644 --- a/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.cs +++ b/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.cs @@ -3,14 +3,11 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System; using System.Collections.Generic; -using System.Threading.Tasks; -using System.Threading; namespace System.IO.Tests { - public class MemoryStreamTests + public partial class MemoryStreamTests { [Fact] public static void MemoryStream_Write_BeyondCapacity() @@ -204,7 +201,7 @@ namespace System.IO.Tests using (memoryStream = new MemoryStream()) { AssertExtensions.Throws("destination", () => memoryStream.CopyTo(destination: null)); - + // Validate the destination parameter first. AssertExtensions.Throws("destination", () => memoryStream.CopyTo(destination: null, bufferSize: 0)); AssertExtensions.Throws("destination", () => memoryStream.CopyTo(destination: null, bufferSize: -1)); @@ -263,7 +260,7 @@ namespace System.IO.Tests var stream2 = new MemoryStream(data2) { Position = 1 }; yield return new object[] { stream2, new byte[] { 0xf3, 0xf0 } }; - + // Stream is positioned after end of data var data3 = data2; var stream3 = new MemoryStream(data3) { Position = data3.Length + 1 }; diff --git a/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.netcoreapp.cs new file mode 100644 index 0000000000..4ea914b071 --- /dev/null +++ b/external/corefx/src/System.IO/tests/MemoryStream/MemoryStreamTests.netcoreapp.cs @@ -0,0 +1,180 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace System.IO.Tests +{ + public partial class MemoryStreamTests + { + [Fact] + public void WriteSpan_DataWrittenAndPositionUpdated_Success() + { + const int Iters = 100; + var rand = new Random(); + byte[] data = Enumerable.Range(0, (Iters * (Iters + 1)) / 2).Select(_ => (byte)rand.Next(256)).ToArray(); + var s = new MemoryStream(); + + int expectedPos = 0; + for (int i = 0; i <= Iters; i++) + { + s.Write(new ReadOnlySpan(data, expectedPos, i)); + expectedPos += i; + Assert.Equal(expectedPos, s.Position); + } + + Assert.Equal(data, s.ToArray()); + } + + [Fact] + public void ReadSpan_DataReadAndPositionUpdated_Success() + { + const int Iters = 100; + var rand = new Random(); + byte[] data = Enumerable.Range(0, (Iters * (Iters + 1)) / 2).Select(_ => (byte)rand.Next(256)).ToArray(); + var s = new MemoryStream(data); + + int expectedPos = 0; + for (int i = 0; i <= Iters; i++) + { + var toRead = new Span(new byte[i * 3]); // enough room to read the data and have some offset and have slack at the end + + // Do the read and validate we read the expected number of bytes + Assert.Equal(i, s.Read(toRead.Slice(i, i))); + + // The contents prior to and after the read should be empty. + Assert.Equal(new byte[i], toRead.Slice(0, i).ToArray()); + Assert.Equal(new byte[i], toRead.Slice(i * 2, i).ToArray()); + + // And the data read should match what was expected. + Assert.Equal(new Span(data, expectedPos, i).ToArray(), toRead.Slice(i, i).ToArray()); + + // Updated position should match + expectedPos += i; + Assert.Equal(expectedPos, s.Position); + } + + // A final read should be empty + Assert.Equal(0, s.Read(new Span(new byte[1]))); + } + + [Fact] + public void DerivedMemoryStream_ReadWriteSpanCalled_ReadWriteArrayUsed() + { + var s = new ReadWriteOverridingMemoryStream(); + Assert.False(s.WriteArrayInvoked); + Assert.False(s.ReadArrayInvoked); + + s.Write((ReadOnlySpan)new byte[1]); + Assert.True(s.WriteArrayInvoked); + Assert.False(s.ReadArrayInvoked); + + s.Position = 0; + s.Read((Span)new byte[1]); + Assert.True(s.WriteArrayInvoked); + Assert.True(s.ReadArrayInvoked); + } + + [Fact] + public async Task WriteAsyncReadOnlyMemory_DataWrittenAndPositionUpdated_Success() + { + const int Iters = 100; + var rand = new Random(); + byte[] data = Enumerable.Range(0, (Iters * (Iters + 1)) / 2).Select(_ => (byte)rand.Next(256)).ToArray(); + var s = new MemoryStream(); + + int expectedPos = 0; + for (int i = 0; i <= Iters; i++) + { + await s.WriteAsync(new ReadOnlyMemory(data, expectedPos, i)); + expectedPos += i; + Assert.Equal(expectedPos, s.Position); + } + + Assert.Equal(data, s.ToArray()); + } + + [Fact] + public async Task ReadAsyncMemory_DataReadAndPositionUpdated_Success() + { + const int Iters = 100; + var rand = new Random(); + byte[] data = Enumerable.Range(0, (Iters * (Iters + 1)) / 2).Select(_ => (byte)rand.Next(256)).ToArray(); + var s = new MemoryStream(data); + + int expectedPos = 0; + for (int i = 0; i <= Iters; i++) + { + var toRead = new Memory(new byte[i * 3]); // enough room to read the data and have some offset and have slack at the end + + // Do the read and validate we read the expected number of bytes + Assert.Equal(i, await s.ReadAsync(toRead.Slice(i, i))); + + // The contents prior to and after the read should be empty. + Assert.Equal(new byte[i], toRead.Slice(0, i).ToArray()); + Assert.Equal(new byte[i], toRead.Slice(i * 2, i).ToArray()); + + // And the data read should match what was expected. + Assert.Equal(new Span(data, expectedPos, i).ToArray(), toRead.Slice(i, i).ToArray()); + + // Updated position should match + expectedPos += i; + Assert.Equal(expectedPos, s.Position); + } + + // A final read should be empty + Assert.Equal(0, await s.ReadAsync(new Memory(new byte[1]))); + } + + [Fact] + public async Task DerivedMemoryStream_ReadWriteAsyncMemoryCalled_ReadWriteAsyncArrayUsed() + { + var s = new ReadWriteOverridingMemoryStream(); + Assert.False(s.WriteArrayInvoked); + Assert.False(s.ReadArrayInvoked); + + await s.WriteAsync((ReadOnlyMemory)new byte[1]); + Assert.True(s.WriteArrayInvoked); + Assert.False(s.ReadArrayInvoked); + + s.Position = 0; + await s.ReadAsync((Memory)new byte[1]); + Assert.True(s.WriteArrayInvoked); + Assert.True(s.ReadArrayInvoked); + } + + private class ReadWriteOverridingMemoryStream : MemoryStream + { + public bool ReadArrayInvoked, WriteArrayInvoked; + public bool ReadAsyncArrayInvoked, WriteAsyncArrayInvoked; + + public override int Read(byte[] buffer, int offset, int count) + { + ReadArrayInvoked = true; + return base.Read(buffer, offset, count); + } + + public override void Write(byte[] buffer, int offset, int count) + { + WriteArrayInvoked = true; + base.Write(buffer, offset, count); + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ReadAsyncArrayInvoked = true; + return base.ReadAsync(buffer, offset, count, cancellationToken); + } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + WriteAsyncArrayInvoked = true; + return base.WriteAsync(buffer, offset, count, cancellationToken); + } + } + } +} diff --git a/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.cs b/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.cs index fcf6e3bb85..e803b74578 100644 --- a/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.cs +++ b/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,7 +10,7 @@ using Xunit; namespace System.IO.Tests { - public class NullTests + public partial class NullTests { [Fact] public async static Task TestNullStream_Flush() @@ -87,8 +85,8 @@ namespace System.IO.Tests int read = source.Read(buffer, offset, count); Assert.Equal(0, read); Assert.Equal(copy, buffer); // Make sure Read doesn't modify the buffer - Assert.Equal(0, source.Position); - + Assert.Equal(0, source.Position); + read = await source.ReadAsync(buffer, offset, count); Assert.Equal(0, read); Assert.Equal(copy, buffer); @@ -114,8 +112,8 @@ namespace System.IO.Tests source.Write(buffer, offset, count); Assert.Equal(copy, buffer); // Make sure Write doesn't modify the buffer - Assert.Equal(0, source.Position); - + Assert.Equal(0, source.Position); + await source.WriteAsync(buffer, offset, count); Assert.Equal(copy, buffer); Assert.Equal(0, source.Position); diff --git a/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.netcoreapp.cs new file mode 100644 index 0000000000..fd6b6bedf7 --- /dev/null +++ b/external/corefx/src/System.IO/tests/Stream/Stream.NullTests.netcoreapp.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using Xunit; + +namespace System.IO.Tests +{ + public partial class NullTests + { + [Theory] + [MemberData(nameof(NullStream_ReadWriteData))] + public void TestNullStream_ReadSpan(byte[] buffer, int offset, int count) + { + if (buffer == null) return; + + byte[] copy = buffer.ToArray(); + Stream source = Stream.Null; + + int read = source.Read(new Span(buffer, offset, count)); + Assert.Equal(0, read); + Assert.Equal(copy, buffer); // Make sure Read doesn't modify the buffer + Assert.Equal(0, source.Position); + } + + [Theory] + [MemberData(nameof(NullStream_ReadWriteData))] + public void TestNullStream_WriteSpan(byte[] buffer, int offset, int count) + { + if (buffer == null) return; + + byte[] copy = buffer.ToArray(); + Stream source = Stream.Null; + + source.Write(new Span(buffer, offset, count)); + Assert.Equal(copy, buffer); // Make sure Write doesn't modify the buffer + Assert.Equal(0, source.Position); + } + } +} diff --git a/external/corefx/src/System.IO/tests/Stream/Stream.ReadWriteSpan.netcoreapp.cs b/external/corefx/src/System.IO/tests/Stream/Stream.ReadWriteSpan.netcoreapp.cs new file mode 100644 index 0000000000..6bdea544b0 --- /dev/null +++ b/external/corefx/src/System.IO/tests/Stream/Stream.ReadWriteSpan.netcoreapp.cs @@ -0,0 +1,189 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public class Stream_ReadWriteSpan + { + [Fact] + public void ReadSpan_DelegatesToRead_Success() + { + bool readInvoked = false; + var s = new DelegateStream( + canReadFunc: () => true, + readFunc: (array, offset, count) => + { + readInvoked = true; + Assert.NotNull(array); + Assert.Equal(0, offset); + Assert.Equal(20, count); + + for (int i = 0; i < 10; i++) array[offset + i] = (byte)i; + return 10; + }); + + Span totalSpan = new byte[30]; + Span targetSpan = totalSpan.Slice(5, 20); + + Assert.Equal(10, s.Read(targetSpan)); + Assert.True(readInvoked); + for (int i = 0; i < 10; i++) Assert.Equal(i, targetSpan[i]); + for (int i = 10; i < 20; i++) Assert.Equal(0, targetSpan[i]); + readInvoked = false; + } + + [Fact] + public void WriteSpan_DelegatesToWrite_Success() + { + bool writeInvoked = false; + var s = new DelegateStream( + canWriteFunc: () => true, + writeFunc: (array, offset, count) => + { + writeInvoked = true; + Assert.NotNull(array); + Assert.Equal(0, offset); + Assert.Equal(3, count); + + for (int i = 0; i < count; i++) Assert.Equal(i, array[offset + i]); + }); + + Span span = new byte[10]; + span[3] = 1; + span[4] = 2; + s.Write(span.Slice(2, 3)); + Assert.True(writeInvoked); + writeInvoked = false; + } + + [Fact] + public async Task ReadAsyncMemory_WrapsArray_DelegatesToReadAsyncArray_Success() + { + bool readInvoked = false; + var s = new DelegateStream( + canReadFunc: () => true, + readAsyncFunc: (array, offset, count, cancellationToken) => + { + readInvoked = true; + Assert.NotNull(array); + Assert.Equal(5, offset); + Assert.Equal(20, count); + + for (int i = 0; i < 10; i++) + { + array[offset + i] = (byte)i; + } + return Task.FromResult(10); + }); + + Memory totalMemory = new byte[30]; + Memory targetMemory = totalMemory.Slice(5, 20); + + Assert.Equal(10, await s.ReadAsync(targetMemory)); + Assert.True(readInvoked); + for (int i = 0; i < 10; i++) + Assert.Equal(i, targetMemory.Span[i]); + for (int i = 10; i < 20; i++) + Assert.Equal(0, targetMemory.Span[i]); + readInvoked = false; + } + + [Fact] + public async Task ReadAsyncMemory_WrapsNative_DelegatesToReadAsyncArrayWithPool_Success() + { + bool readInvoked = false; + var s = new DelegateStream( + canReadFunc: () => true, + readAsyncFunc: (array, offset, count, cancellationToken) => + { + readInvoked = true; + Assert.NotNull(array); + Assert.Equal(0, offset); + Assert.Equal(20, count); + + for (int i = 0; i < 10; i++) + { + array[offset + i] = (byte)i; + } + return Task.FromResult(10); + }); + + using (var totalNativeMemory = new NativeOwnedMemory(30)) + { + Memory totalMemory = totalNativeMemory.Memory; + Memory targetMemory = totalMemory.Slice(5, 20); + + Assert.Equal(10, await s.ReadAsync(targetMemory)); + Assert.True(readInvoked); + for (int i = 0; i < 10; i++) + Assert.Equal(i, targetMemory.Span[i]); + readInvoked = false; + } + } + + [Fact] + public async Task WriteAsyncMemory_WrapsArray_DelegatesToWrite_Success() + { + bool writeInvoked = false; + var s = new DelegateStream( + canWriteFunc: () => true, + writeAsyncFunc: (array, offset, count, cancellationToken) => + { + writeInvoked = true; + Assert.NotNull(array); + Assert.Equal(2, offset); + Assert.Equal(3, count); + + for (int i = 0; i < count; i++) + Assert.Equal(i, array[offset + i]); + + return Task.CompletedTask; + }); + + Memory memory = new byte[10]; + memory.Span[3] = 1; + memory.Span[4] = 2; + await s.WriteAsync(memory.Slice(2, 3)); + Assert.True(writeInvoked); + writeInvoked = false; + } + + [Fact] + public async Task WriteAsyncMemory_WrapsNative_DelegatesToWrite_Success() + { + bool writeInvoked = false; + var s = new DelegateStream( + canWriteFunc: () => true, + writeAsyncFunc: (array, offset, count, cancellationToken) => + { + writeInvoked = true; + Assert.NotNull(array); + Assert.Equal(0, offset); + Assert.Equal(3, count); + + for (int i = 0; i < count; i++) + Assert.Equal(i, array[i]); + + return Task.CompletedTask; + }); + + using (var nativeMemory = new NativeOwnedMemory(10)) + { + Memory memory = nativeMemory.Memory; + memory.Span[2] = 0; + memory.Span[3] = 1; + memory.Span[4] = 2; + await s.WriteAsync(memory.Slice(2, 3)); + Assert.True(writeInvoked); + writeInvoked = false; + } + } + } +} diff --git a/external/corefx/src/System.IO/tests/StreamReader/StreamReaderTests.cs b/external/corefx/src/System.IO/tests/StreamReader/StreamReaderTests.cs index 0a70a82028..a127c809be 100644 --- a/external/corefx/src/System.IO/tests/StreamReader/StreamReaderTests.cs +++ b/external/corefx/src/System.IO/tests/StreamReader/StreamReaderTests.cs @@ -40,33 +40,7 @@ namespace System.IO.Tests protected Tuple GetCharArrayStream() { - var chArr = new char[]{ - char.MinValue - ,char.MaxValue - ,'\t' - ,' ' - ,'$' - ,'@' - ,'#' - ,'\0' - ,'\v' - ,'\'' - ,'\u3190' - ,'\uC3A0' - ,'A' - ,'5' - ,'\r' - ,'\uFE70' - ,'-' - ,';' - ,'\r' - ,'\n' - ,'T' - ,'3' - ,'\n' - ,'K' - ,'\u00E6' - }; + var chArr = TestDataProvider.CharData; var ms = CreateStream(); var sw = new StreamWriter(ms); diff --git a/external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.WriteTests.cs b/external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.WriteTests.cs index 5c913da954..b36033d118 100644 --- a/external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.WriteTests.cs +++ b/external/corefx/src/System.IO/tests/StreamWriter/StreamWriter.WriteTests.cs @@ -20,7 +20,7 @@ namespace System.IO.Tests [Fact] public void WriteChars() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; // [] Write a wide variety of characters and read them back @@ -40,30 +40,6 @@ namespace System.IO.Tests } } - private static char[] setupArray() - { - return new char[]{ - char.MinValue - ,char.MaxValue - ,'\t' - ,' ' - ,'$' - ,'@' - ,'#' - ,'\0' - ,'\v' - ,'\'' - ,'\u3190' - ,'\uC3A0' - ,'A' - ,'5' - ,'\uFE70' - ,'-' - ,';' - ,'\u00E6' - }; - } - [Fact] public void NullArray() { @@ -78,7 +54,7 @@ namespace System.IO.Tests [Fact] public void NegativeOffset() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; // [] Exception if offset is negative Stream ms = CreateStream(); @@ -91,7 +67,7 @@ namespace System.IO.Tests [Fact] public void NegativeCount() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; // [] Exception if count is negative Stream ms = CreateStream(); @@ -104,7 +80,7 @@ namespace System.IO.Tests [Fact] public void WriteCustomLenghtStrings() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; // [] Write some custom length strings Stream ms = CreateStream(); @@ -127,7 +103,7 @@ namespace System.IO.Tests [Fact] public void WriteToStreamWriter() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; // [] Just construct a streamwriter and write to it //------------------------------------------------- Stream ms = CreateStream(); @@ -149,7 +125,7 @@ namespace System.IO.Tests [Fact] public void TestWritingPastEndOfArray() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; Stream ms = CreateStream(); StreamWriter sw = new StreamWriter(ms); @@ -160,7 +136,7 @@ namespace System.IO.Tests [Fact] public void VerifyWrittenString() { - char[] chArr = setupArray(); + char[] chArr = TestDataProvider.CharData; // [] Write string with wide selection of characters and read it back StringBuilder sb = new StringBuilder(40); diff --git a/external/corefx/src/System.IO/tests/StringReader/StringReader.CtorTests.cs b/external/corefx/src/System.IO/tests/StringReader/StringReader.CtorTests.cs index 2144054af3..cec91adbb6 100644 --- a/external/corefx/src/System.IO/tests/StringReader/StringReader.CtorTests.cs +++ b/external/corefx/src/System.IO/tests/StringReader/StringReader.CtorTests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.IO.Tests { - public class ReaderTests + public partial class StringReaderTests { [Fact] public static void StringReaderWithNullString() diff --git a/external/corefx/src/System.IO/tests/StringReader/StringReaderTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/StringReader/StringReaderTests.netcoreapp.cs new file mode 100644 index 0000000000..cf9ea48ba2 --- /dev/null +++ b/external/corefx/src/System.IO/tests/StringReader/StringReaderTests.netcoreapp.cs @@ -0,0 +1,122 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public partial class StringReaderTests + { + [Fact] + public void ReadSpan_Success() + { + string input = "abcdef"; + var reader = new StringReader(input); + Span s = new char[2]; + + Assert.Equal(2, reader.Read(s)); + Assert.Equal("ab", new string(s.ToArray())); + + Assert.Equal(1, reader.Read(s.Slice(0, 1))); + Assert.Equal("cb", new string(s.ToArray())); + + Assert.Equal(2, reader.Read(s)); + Assert.Equal("de", new string(s.ToArray())); + + Assert.Equal(1, reader.Read(s)); + Assert.Equal("f", new string(s.Slice(0, 1).ToArray())); + + Assert.Equal(0, reader.Read(s)); + } + + [Fact] + public void ReadBlockSpan_Success() + { + string input = "abcdef"; + var reader = new StringReader(input); + Span s = new char[2]; + + Assert.Equal(2, reader.ReadBlock(s)); + Assert.Equal("ab", new string(s.ToArray())); + + Assert.Equal(1, reader.ReadBlock(s.Slice(0, 1))); + Assert.Equal("cb", new string(s.ToArray())); + + Assert.Equal(2, reader.ReadBlock(s)); + Assert.Equal("de", new string(s.ToArray())); + + Assert.Equal(1, reader.ReadBlock(s)); + Assert.Equal("f", new string(s.Slice(0, 1).ToArray())); + + Assert.Equal(0, reader.ReadBlock(s)); + } + + [Fact] + public async Task ReadMemoryAsync_Success() + { + string input = "abcdef"; + var reader = new StringReader(input); + Memory m = new char[2]; + + Assert.Equal(2, await reader.ReadAsync(m)); + Assert.Equal("ab", new string(m.ToArray())); + + Assert.Equal(1, await reader.ReadAsync(m.Slice(0, 1))); + Assert.Equal("cb", new string(m.ToArray())); + + Assert.Equal(2, await reader.ReadAsync(m)); + Assert.Equal("de", new string(m.ToArray())); + + Assert.Equal(1, await reader.ReadAsync(m)); + Assert.Equal("f", new string(m.Slice(0, 1).ToArray())); + + Assert.Equal(0, await reader.ReadAsync(m)); + } + + [Fact] + public async Task ReadBlockMemoryAsync_Success() + { + string input = "abcdef"; + var reader = new StringReader(input); + Memory m = new char[2]; + + Assert.Equal(2, await reader.ReadBlockAsync(m)); + Assert.Equal("ab", new string(m.ToArray())); + + Assert.Equal(1, await reader.ReadBlockAsync(m.Slice(0, 1))); + Assert.Equal("cb", new string(m.ToArray())); + + Assert.Equal(2, await reader.ReadBlockAsync(m)); + Assert.Equal("de", new string(m.ToArray())); + + Assert.Equal(1, await reader.ReadBlockAsync(m)); + Assert.Equal("f", new string(m.Slice(0, 1).ToArray())); + + Assert.Equal(0, await reader.ReadBlockAsync(m)); + } + + [Fact] + public void Disposed_ThrowsException() + { + var reader = new StringReader("abc"); + reader.Dispose(); + + Assert.Throws(() => reader.Read(Span.Empty)); + Assert.Throws(() => reader.ReadBlock(Span.Empty)); + Assert.Throws(() => { reader.ReadAsync(Memory.Empty); }); + Assert.Throws(() => { reader.ReadBlockAsync(Memory.Empty); }); + } + + [Fact] + public async Task Precanceled_ThrowsException() + { + var reader = new StringReader("abc"); + + await Assert.ThrowsAnyAsync(() => reader.ReadAsync(Memory.Empty, new CancellationToken(true)).AsTask()); + await Assert.ThrowsAnyAsync(() => reader.ReadBlockAsync(Memory.Empty, new CancellationToken(true)).AsTask()); + } + } +} diff --git a/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.cs b/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.cs index 6655a2d548..4155c9d0c3 100644 --- a/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.cs +++ b/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.cs @@ -11,39 +11,15 @@ using System.Threading.Tasks; namespace System.IO.Tests { - public class StringWriterTests + public partial class StringWriterTests { static int[] iArrInvalidValues = new int[] { -1, -2, -100, -1000, -10000, -100000, -1000000, -10000000, -100000000, -1000000000, int.MinValue, short.MinValue }; static int[] iArrLargeValues = new int[] { int.MaxValue, int.MaxValue - 1, int.MaxValue / 2, int.MaxValue / 10, int.MaxValue / 100 }; static int[] iArrValidValues = new int[] { 10000, 100000, int.MaxValue / 2000, int.MaxValue / 5000, short.MaxValue }; - private static char[] getCharArray() - { - return new char[]{ - char.MinValue - ,char.MaxValue - ,'\t' - ,' ' - ,'$' - ,'@' - ,'#' - ,'\0' - ,'\v' - ,'\'' - ,'\u3190' - ,'\uC3A0' - ,'A' - ,'5' - ,'\uFE70' - ,'-' - ,';' - ,'\u00E6' - }; - } - private static StringBuilder getSb() { - var chArr = getCharArray(); + var chArr = TestDataProvider.CharData; var sb = new StringBuilder(40); for (int i = 0; i < chArr.Length; i++) sb.Append(chArr[i]); @@ -88,7 +64,7 @@ namespace System.IO.Tests [Fact] public static void WriteArray() { - var chArr = getCharArray(); + var chArr = TestDataProvider.CharData; StringBuilder sb = getSb(); StringWriter sw = new StringWriter(sb); @@ -125,7 +101,7 @@ namespace System.IO.Tests [Fact] public static void CantWriteIndexLargeValues() { - var chArr = getCharArray(); + var chArr = TestDataProvider.CharData; for (int i = 0; i < iArrLargeValues.Length; i++) { StringWriter sw = new StringWriter(); @@ -136,7 +112,7 @@ namespace System.IO.Tests [Fact] public static void CantWriteCountLargeValues() { - var chArr = getCharArray(); + var chArr = TestDataProvider.CharData; for (int i = 0; i < iArrLargeValues.Length; i++) { StringWriter sw = new StringWriter(); @@ -150,7 +126,7 @@ namespace System.IO.Tests StringWriter sw = new StringWriter(); StringReader sr; - var chArr = getCharArray(); + var chArr = TestDataProvider.CharData; sw.Write(chArr, 2, 5); diff --git a/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.netcoreapp.cs new file mode 100644 index 0000000000..afc1702665 --- /dev/null +++ b/external/corefx/src/System.IO/tests/StringWriter/StringWriterTests.netcoreapp.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public partial class StringWriterTests + { + [Fact] + public async Task WriteSpanMemory_Success() + { + var sw = new StringWriter(); + + sw.Write((Span)new char[0]); + sw.Write((Span)new char[] { 'a' }); + sw.Write((Span)new char[] { 'b', 'c', 'd' }); + sw.WriteLine((Span)new char[] { 'e' }); + + await sw.WriteAsync((ReadOnlyMemory)new char[0]); + await sw.WriteAsync((ReadOnlyMemory)new char[] { 'f' }); + await sw.WriteAsync((ReadOnlyMemory)new char[] { 'g', 'h', 'i' }); + await sw.WriteLineAsync((ReadOnlyMemory)new char[] { 'j' }); + + Assert.Equal("abcde" + Environment.NewLine + "fghij" + Environment.NewLine, sw.ToString()); + } + + [Fact] + public async Task Precanceled_ThrowsException() + { + var writer = new StringWriter(); + + await Assert.ThrowsAnyAsync(() => writer.WriteAsync(Memory.Empty, new CancellationToken(true))); + await Assert.ThrowsAnyAsync(() => writer.WriteLineAsync(Memory.Empty, new CancellationToken(true))); + } + } +} diff --git a/external/corefx/src/System.IO/tests/System.IO.Tests.csproj b/external/corefx/src/System.IO/tests/System.IO.Tests.csproj index c677a92cfb..7273e968b5 100644 --- a/external/corefx/src/System.IO/tests/System.IO.Tests.csproj +++ b/external/corefx/src/System.IO/tests/System.IO.Tests.csproj @@ -5,6 +5,7 @@ System.IO System.IO.Tests {492EC54D-D2C4-4B3F-AC1F-646B3F7EBB02} + true @@ -12,6 +13,7 @@ + @@ -22,6 +24,7 @@ + @@ -32,6 +35,7 @@ + @@ -39,14 +43,21 @@ + + + + + + Common\System\Buffers\NativeOwnedMemory.cs + Common\System\IO\CallTrackingStream.cs @@ -56,6 +67,13 @@ Common\System\IO\WrappedMemoryStream.cs + + + + + + + diff --git a/external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs b/external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs new file mode 100644 index 0000000000..b7e37ddff1 --- /dev/null +++ b/external/corefx/src/System.IO/tests/TestDataProvider/TestDataProvider.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace System.IO.Tests +{ + public static class TestDataProvider + { + private static readonly char[] s_charData; + private static readonly char[] s_smallData; + private static readonly char[] s_largeData; + + public static object FirstObject { get; } = (object)1; + public static object SecondObject { get; } = (object)"[second object]"; + public static object ThirdObject { get; } = (object)""; + public static object[] MultipleObjects { get; } = new object[] { FirstObject, SecondObject, ThirdObject }; + + public static string FormatStringOneObject { get; } = "Object is {0}"; + public static string FormatStringTwoObjects { get; } = $"Object are '{0}', {SecondObject}"; + public static string FormatStringThreeObjects { get; } = $"Objects are {0}, {SecondObject}, {ThirdObject}"; + public static string FormatStringMultipleObjects { get; } = "Multiple Objects are: {0}, {1}, {2}"; + + static TestDataProvider() + { + s_charData = new char[] + { + char.MinValue, + char.MaxValue, + '\t', + ' ', + '$', + '@', + '#', + '\0', + '\v', + '\'', + '\u3190', + '\uC3A0', + 'A', + '5', + '\r', + '\uFE70', + '-', + ';', + '\r', + '\n', + 'T', + '3', + '\n', + 'K', + '\u00E6' + }; + + s_smallData = "HELLO".ToCharArray(); + + var data = new List(); + for (int count = 0; count < 1000; ++count) + { + data.AddRange(s_smallData); + } + s_largeData = data.ToArray(); + } + + public static char[] CharData => s_charData; + + public static char[] SmallData => s_smallData; + + public static char[] LargeData => s_largeData; + } +} diff --git a/external/corefx/src/System.IO/tests/TextReader/CharArrayTextReader.cs b/external/corefx/src/System.IO/tests/TextReader/CharArrayTextReader.cs new file mode 100644 index 0000000000..c82f2bb321 --- /dev/null +++ b/external/corefx/src/System.IO/tests/TextReader/CharArrayTextReader.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.IO.Tests +{ + public class CharArrayTextReader : TextReader + { + private readonly char[] _charBuffer; + private int _charPos = 0; + + public bool EndOfStream => _charPos >= _charBuffer.Length; + + public CharArrayTextReader(char[] data) + { + _charBuffer = data; + } + + public override int Peek() + { + if (_charPos == _charBuffer.Length) + { + return -1; + } + return _charBuffer[_charPos]; + } + + public override int Read() + { + if (_charPos == _charBuffer.Length) + { + return -1; + } + return _charBuffer[_charPos++]; + } + } +} diff --git a/external/corefx/src/System.IO/tests/TextReader/TextReaderTests.cs b/external/corefx/src/System.IO/tests/TextReader/TextReaderTests.cs new file mode 100644 index 0000000000..befc068cb6 --- /dev/null +++ b/external/corefx/src/System.IO/tests/TextReader/TextReaderTests.cs @@ -0,0 +1,248 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public partial class TextReaderTests + { + protected (char[] chArr, CharArrayTextReader textReader) GetCharArray() + { + CharArrayTextReader tr = new CharArrayTextReader(TestDataProvider.CharData); + return (TestDataProvider.CharData, tr); + } + + [Fact] + public void EndOfStream() + { + using (CharArrayTextReader tr = new CharArrayTextReader(TestDataProvider.SmallData)) + { + var result = tr.ReadToEnd(); + + Assert.Equal("HELLO", result); + + Assert.True(tr.EndOfStream, "End of TextReader was not true after ReadToEnd"); + } + } + + [Fact] + public void NotEndOfStream() + { + using (CharArrayTextReader tr = new CharArrayTextReader(TestDataProvider.SmallData)) + { + char[] charBuff = new char[3]; + var result = tr.Read(charBuff, 0, 3); + + Assert.Equal(3, result); + + Assert.Equal("HEL", new string(charBuff)); + + Assert.False(tr.EndOfStream, "End of TextReader was true after ReadToEnd"); + } + } + + [Fact] + public async Task ReadToEndAsync() + { + using (CharArrayTextReader tr = new CharArrayTextReader(TestDataProvider.LargeData)) + { + var result = await tr.ReadToEndAsync(); + + Assert.Equal(5000, result.Length); + } + } + + [Fact] + public void TestRead() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + for (int count = 0; count < baseInfo.chArr.Length; ++count) + { + int tmp = tr.Read(); + Assert.Equal((int)baseInfo.chArr[count], tmp); + } + } + } + + [Fact] + public void ArgumentNullOnNullArray() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + Assert.Throws(() => tr.Read(null, 0, 0)); + } + } + + [Fact] + public void ArgumentOutOfRangeOnInvalidOffset() + { + using (CharArrayTextReader tr = GetCharArray().textReader) + { + Assert.Throws(() => tr.Read(new char[0], -1, 0)); + } + } + + [Fact] + public void ArgumentOutOfRangeOnNegativCount() + { + using (CharArrayTextReader tr = GetCharArray().textReader) + { + AssertExtensions.Throws(null, () => tr.Read(new char[0], 0, 1)); + } + } + + [Fact] + public void ArgumentExceptionOffsetAndCount() + { + using (CharArrayTextReader tr = GetCharArray().textReader) + { + AssertExtensions.Throws(null, () => tr.Read(new char[0], 2, 0)); + } + } + + [Fact] + public void EmptyInput() + { + using (CharArrayTextReader tr = new CharArrayTextReader(new char[] { })) + { + char[] buffer = new char[10]; + int read = tr.Read(buffer, 0, 1); + Assert.Equal(0, read); + } + } + + [Fact] + public void ReadCharArr() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + char[] chArr = new char[baseInfo.chArr.Length]; + + var read = tr.Read(chArr, 0, chArr.Length); + Assert.Equal(chArr.Length, read); + + for (int count = 0; count < baseInfo.chArr.Length; ++count) + { + Assert.Equal(baseInfo.chArr[count], chArr[count]); + } + } + } + + [Fact] + public void ReadBlockCharArr() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + char[] chArr = new char[baseInfo.chArr.Length]; + + var read = tr.ReadBlock(chArr, 0, chArr.Length); + Assert.Equal(chArr.Length, read); + + for (int count = 0; count < baseInfo.chArr.Length; ++count) + { + Assert.Equal(baseInfo.chArr[count], chArr[count]); + } + } + } + + [Fact] + public async void ReadBlockAsyncCharArr() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + char[] chArr = new char[baseInfo.chArr.Length]; + + var read = await tr.ReadBlockAsync(chArr, 0, chArr.Length); + Assert.Equal(chArr.Length, read); + + for (int count = 0; count < baseInfo.chArr.Length; ++count) + { + Assert.Equal(baseInfo.chArr[count], chArr[count]); + } + } + } + + [Fact] + public async Task ReadAsync() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + char[] chArr = new char[baseInfo.chArr.Length]; + + var read = await tr.ReadAsync(chArr, 4, 3); + Assert.Equal(read, 3); + + for (int count = 0; count < 3; ++count) + { + Assert.Equal(baseInfo.chArr[count], chArr[count + 4]); + } + } + } + + [Fact] + public void ReadLines() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + string valueString = new string(baseInfo.chArr); + + var data = tr.ReadLine(); + Assert.Equal(valueString.Substring(0, valueString.IndexOf('\r')), data); + + data = tr.ReadLine(); + Assert.Equal(valueString.Substring(valueString.IndexOf('\r') + 1, 3), data); + + data = tr.ReadLine(); + Assert.Equal(valueString.Substring(valueString.IndexOf('\n') + 1, 2), data); + + data = tr.ReadLine(); + Assert.Equal((valueString.Substring(valueString.LastIndexOf('\n') + 1)), data); + } + } + + [Fact] + public void ReadLines2() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + string valueString = new string(baseInfo.chArr); + + char[] temp = new char[10]; + tr.Read(temp, 0, 1); + var data = tr.ReadLine(); + + Assert.Equal(valueString.Substring(1, valueString.IndexOf('\r') - 1), data); + } + } + + [Fact] + public async Task ReadLineAsyncContinuousNewLinesAndTabs() + { + char[] newLineTabData = new char[] { '\n', '\n', '\r', '\r', '\n' }; + using (CharArrayTextReader tr = new CharArrayTextReader(newLineTabData)) + { + for (int count = 0; count < 4; ++count) + { + var data = await tr.ReadLineAsync(); + Assert.Equal(string.Empty, data); + } + + var eol = await tr.ReadLineAsync(); + Assert.Null(eol); + } + } + } +} diff --git a/external/corefx/src/System.IO/tests/TextReader/TextReaderTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/TextReader/TextReaderTests.netcoreapp.cs new file mode 100644 index 0000000000..6ed515a57e --- /dev/null +++ b/external/corefx/src/System.IO/tests/TextReader/TextReaderTests.netcoreapp.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public partial class TextReaderTests + { + [Fact] + public void ReadSpan() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + char[] chArr = new char[baseInfo.chArr.Length]; + var chSpan = new Span(chArr, 0, baseInfo.chArr.Length); + + var read = tr.Read(chSpan); + Assert.Equal(chArr.Length, read); + + for (int i = 0; i < baseInfo.chArr.Length; i++) + { + Assert.Equal(baseInfo.chArr[i], chArr[i]); + } + } + } + + [Fact] + public void ReadBlockSpan() + { + (char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray(); + using (CharArrayTextReader tr = baseInfo.textReader) + { + char[] chArr = new char[baseInfo.chArr.Length]; + var chSpan = new Span(chArr, 0, baseInfo.chArr.Length); + + var read = tr.ReadBlock(chSpan); + Assert.Equal(chArr.Length, read); + + for (int i = 0; i < baseInfo.chArr.Length; i++) + { + Assert.Equal(baseInfo.chArr[i], chArr[i]); + } + } + } + } +} diff --git a/external/corefx/src/System.IO/tests/TextWriter/CharArrayTextWriter.cs b/external/corefx/src/System.IO/tests/TextWriter/CharArrayTextWriter.cs new file mode 100644 index 0000000000..0eb9b61942 --- /dev/null +++ b/external/corefx/src/System.IO/tests/TextWriter/CharArrayTextWriter.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Text; + +namespace System.IO.Tests +{ + public class CharArrayTextWriter : TextWriter + { + private StringBuilder _sb; + + public override Encoding Encoding => Encoding.Unicode; + + public CharArrayTextWriter() + { + _sb = new StringBuilder(); + } + + public override void Write(char value) + { + _sb.Append(value); + } + + public string Text => _sb.ToString(); + + public void Clear() => _sb.Clear(); + } +} diff --git a/external/corefx/src/System.IO/tests/TextWriter/TextWriterTests.cs b/external/corefx/src/System.IO/tests/TextWriter/TextWriterTests.cs new file mode 100644 index 0000000000..2a7aaf7658 --- /dev/null +++ b/external/corefx/src/System.IO/tests/TextWriter/TextWriterTests.cs @@ -0,0 +1,543 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public partial class TextWriterTests + { + protected static CharArrayTextWriter NewTextWriter => new CharArrayTextWriter() { NewLine = "---" }; + + #region Write Overloads + + [Fact] + public void WriteCharTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + for (int count = 0; count < TestDataProvider.CharData.Length; ++count) + { + tw.Write(TestDataProvider.CharData[count]); + } + Assert.Equal(new string(TestDataProvider.CharData), tw.Text); + } + } + + [Fact] + public void WriteCharArrayTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.CharData); + Assert.Equal(new string(TestDataProvider.CharData), tw.Text); + } + } + + [Fact] + public void WriteCharArrayIndexCountTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.CharData, 3, 5); + Assert.Equal(new string(TestDataProvider.CharData, 3, 5), tw.Text); + } + } + + [Fact] + public void WriteBoolTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(true); + Assert.Equal("True", tw.Text); + + tw.Clear(); + tw.Write(false); + Assert.Equal("False", tw.Text); + } + } + + [Fact] + public void WriteIntTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(int.MinValue); + Assert.Equal(int.MinValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(int.MaxValue); + Assert.Equal(int.MaxValue.ToString(), tw.Text); + } + } + + [Fact] + public void WriteUIntTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(uint.MinValue); + Assert.Equal(uint.MinValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(uint.MaxValue); + Assert.Equal(uint.MaxValue.ToString(), tw.Text); + } + } + + [Fact] + public void WriteLongTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(long.MinValue); + Assert.Equal(long.MinValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(long.MaxValue); + Assert.Equal(long.MaxValue.ToString(), tw.Text); + } + } + + [Fact] + public void WriteULongTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(ulong.MinValue); + Assert.Equal(ulong.MinValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(ulong.MaxValue); + Assert.Equal(ulong.MaxValue.ToString(), tw.Text); + + } + } + + [Fact] + public void WriteFloatTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(float.MinValue); + Assert.Equal(float.MinValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(float.MaxValue); + Assert.Equal(float.MaxValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(float.NaN); + Assert.Equal(float.NaN.ToString(), tw.Text); + } + } + + [Fact] + public void WriteDoubleTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(double.MinValue); + Assert.Equal(double.MinValue.ToString(), tw.Text); + tw.Clear(); + + tw.Write(double.MaxValue); + Assert.Equal(double.MaxValue.ToString(), tw.Text); + tw.Clear(); + + tw.Write(double.NaN); + Assert.Equal(double.NaN.ToString(), tw.Text); + tw.Clear(); + } + } + + [Fact] + public void WriteDecimalTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(decimal.MinValue); + Assert.Equal(decimal.MinValue.ToString(), tw.Text); + + tw.Clear(); + tw.Write(decimal.MaxValue); + Assert.Equal(decimal.MaxValue.ToString(), tw.Text); + } + } + + [Fact] + public void WriteStringTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(new string(TestDataProvider.CharData)); + Assert.Equal(new string(TestDataProvider.CharData), tw.Text); + } + } + + [Fact] + public void WriteObjectTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.FirstObject); + Assert.Equal(TestDataProvider.FirstObject.ToString(), tw.Text); + } + } + + [Fact] + public void WriteStringObjectTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.FormatStringOneObject, TestDataProvider.FirstObject); + Assert.Equal(string.Format(TestDataProvider.FormatStringOneObject, TestDataProvider.FirstObject), tw.Text); + } + } + + [Fact] + public void WriteStringTwoObjectsTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.FormatStringTwoObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject); + Assert.Equal(string.Format(TestDataProvider.FormatStringTwoObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject), tw.Text); + } + } + + [Fact] + public void WriteStringThreeObjectsTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.FormatStringThreeObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject); + Assert.Equal(string.Format(TestDataProvider.FormatStringThreeObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject), tw.Text); + } + } + + [Fact] + public void WriteStringMultipleObjectsTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.Write(TestDataProvider.FormatStringMultipleObjects, TestDataProvider.MultipleObjects); + Assert.Equal(string.Format(TestDataProvider.FormatStringMultipleObjects, TestDataProvider.MultipleObjects), tw.Text); + } + } + + #endregion + + #region WriteLine Overloads + + [Fact] + public void WriteLineTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(); + Assert.Equal(tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineCharTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + for (int count = 0; count < TestDataProvider.CharData.Length; ++count) + { + tw.WriteLine(TestDataProvider.CharData[count]); + } + Assert.Equal(string.Join(tw.NewLine, TestDataProvider.CharData.Select(ch => ch.ToString()).ToArray()) + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineCharArrayTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.CharData); + Assert.Equal(new string(TestDataProvider.CharData) + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineCharArrayIndexCountTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.CharData, 3, 5); + Assert.Equal(new string(TestDataProvider.CharData, 3, 5) + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineBoolTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(true); + Assert.Equal("True" + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(false); + Assert.Equal("False" + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineIntTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(int.MinValue); + Assert.Equal(int.MinValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(int.MaxValue); + Assert.Equal(int.MaxValue.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineUIntTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(uint.MinValue); + Assert.Equal(uint.MinValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(uint.MaxValue); + Assert.Equal(uint.MaxValue.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineLongTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(long.MinValue); + Assert.Equal(long.MinValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(long.MaxValue); + Assert.Equal(long.MaxValue.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineULongTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(ulong.MinValue); + Assert.Equal(ulong.MinValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(ulong.MaxValue); + Assert.Equal(ulong.MaxValue.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineFloatTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(float.MinValue); + Assert.Equal(float.MinValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(float.MaxValue); + Assert.Equal(float.MaxValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(float.NaN); + Assert.Equal(float.NaN.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineDoubleTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(double.MinValue); + Assert.Equal(double.MinValue.ToString() + tw.NewLine, tw.Text); + tw.Clear(); + + tw.WriteLine(double.MaxValue); + Assert.Equal(double.MaxValue.ToString() + tw.NewLine, tw.Text); + tw.Clear(); + + tw.WriteLine(double.NaN); + Assert.Equal(double.NaN.ToString() + tw.NewLine, tw.Text); + tw.Clear(); + } + } + + [Fact] + public void WriteLineDecimalTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(decimal.MinValue); + Assert.Equal(decimal.MinValue.ToString() + tw.NewLine, tw.Text); + + tw.Clear(); + tw.WriteLine(decimal.MaxValue); + Assert.Equal(decimal.MaxValue.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineStringTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(new string(TestDataProvider.CharData)); + Assert.Equal(new string(TestDataProvider.CharData) + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineObjectTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.FirstObject); + Assert.Equal(TestDataProvider.FirstObject.ToString() + tw.NewLine, tw.Text); + } + } + + [Fact] + public void WriteLineStringObjectTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.FormatStringOneObject, TestDataProvider.FirstObject); + Assert.Equal(string.Format(TestDataProvider.FormatStringOneObject + tw.NewLine, TestDataProvider.FirstObject), tw.Text); + } + } + + [Fact] + public void WriteLineStringTwoObjectsTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.FormatStringTwoObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject); + Assert.Equal(string.Format(TestDataProvider.FormatStringTwoObjects + tw.NewLine, TestDataProvider.FirstObject, TestDataProvider.SecondObject), tw.Text); + } + } + + [Fact] + public void WriteLineStringThreeObjectsTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.FormatStringThreeObjects, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject); + Assert.Equal(string.Format(TestDataProvider.FormatStringThreeObjects + tw.NewLine, TestDataProvider.FirstObject, TestDataProvider.SecondObject, TestDataProvider.ThirdObject), tw.Text); + } + } + + [Fact] + public void WriteLineStringMultipleObjectsTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + tw.WriteLine(TestDataProvider.FormatStringMultipleObjects, TestDataProvider.MultipleObjects); + Assert.Equal(string.Format(TestDataProvider.FormatStringMultipleObjects + tw.NewLine, TestDataProvider.MultipleObjects), tw.Text); + } + } + + #endregion + + #region Write Async Overloads + + [Fact] + public async void WriteAsyncCharTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + await tw.WriteAsync('a'); + Assert.Equal("a", tw.Text); + } + } + + [Fact] + public async void WriteAsyncStringTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + var toWrite = new string(TestDataProvider.CharData); + await tw.WriteAsync(toWrite); + Assert.Equal(toWrite, tw.Text); + } + } + + [Fact] + public async void WriteAsyncCharArrayIndexCountTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + await tw.WriteAsync(TestDataProvider.CharData, 3, 5); + Assert.Equal(new string(TestDataProvider.CharData, 3, 5), tw.Text); + } + } + + #endregion + + #region WriteLineAsync Overloads + + [Fact] + public async void WriteLineAsyncTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + await tw.WriteLineAsync(); + Assert.Equal(tw.NewLine, tw.Text); + } + } + + [Fact] + public async void WriteLineAsyncCharTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + await tw.WriteLineAsync('a'); + Assert.Equal("a" + tw.NewLine, tw.Text); + } + } + + [Fact] + public async void WriteLineAsyncStringTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + var toWrite = new string(TestDataProvider.CharData); + await tw.WriteLineAsync(toWrite); + Assert.Equal(toWrite + tw.NewLine, tw.Text); + } + } + + [Fact] + public async void WriteLineAsyncCharArrayIndexCount() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + await tw.WriteLineAsync(TestDataProvider.CharData, 3, 5); + Assert.Equal(new string(TestDataProvider.CharData, 3, 5) + tw.NewLine, tw.Text); + } + } + + #endregion + } +} diff --git a/external/corefx/src/System.IO/tests/TextWriter/TextWriterTests.netcoreapp.cs b/external/corefx/src/System.IO/tests/TextWriter/TextWriterTests.netcoreapp.cs new file mode 100644 index 0000000000..fb23dfcd24 --- /dev/null +++ b/external/corefx/src/System.IO/tests/TextWriter/TextWriterTests.netcoreapp.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; +using Xunit; + +namespace System.IO.Tests +{ + public partial class TextWriterTests + { + [Fact] + public void WriteCharSpanTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + var rs = new ReadOnlySpan(TestDataProvider.CharData, 4, 6); + tw.Write(rs); + Assert.Equal(new string(rs), tw.Text); + } + } + + [Fact] + public void WriteLineCharSpanTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + var rs = new ReadOnlySpan(TestDataProvider.CharData, 4, 6); + tw.WriteLine(rs); + Assert.Equal(new string(rs) + tw.NewLine, tw.Text); + } + } + + [Fact] + public async Task WriteCharMemoryTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + var rs = new Memory(TestDataProvider.CharData, 4, 6); + await tw.WriteAsync(rs); + Assert.Equal(new string(rs.Span), tw.Text); + } + } + + [Fact] + public async Task WriteLineCharMemoryTest() + { + using (CharArrayTextWriter tw = NewTextWriter) + { + var rs = new Memory(TestDataProvider.CharData, 4, 6); + await tw.WriteLineAsync(rs); + Assert.Equal(new string(rs.Span) + tw.NewLine, tw.Text); + } + } + } +} diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs index d8b1c61f74..042140e9ca 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs @@ -171,7 +171,7 @@ namespace System.Linq.Expressions.Compiler // Optimization: inline code for literal lambda's directly // - // This is worth it because otherwise we end up with a extra call + // This is worth it because otherwise we end up with an extra call // to DynamicMethod.CreateDelegate, which is expensive. // if (node.LambdaOperand != null) diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.ChildRewriter.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.ChildRewriter.cs index 6a35b8928f..db72765f1b 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.ChildRewriter.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.ChildRewriter.cs @@ -292,7 +292,7 @@ namespace System.Linq.Expressions.Compiler } /// - /// Gets a Boolean value indicating whether the parent expression shoud be + /// Gets a Boolean value indicating whether the parent expression should be /// rewritten by using . /// internal bool Rewrite => _action != RewriteAction.None; diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionType.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionType.cs index a4f9d67870..c9aa32455e 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionType.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionType.cs @@ -334,7 +334,7 @@ namespace System.Linq.Expressions /// PostDecrementAssign, /// - /// A node that represents a exact type test. + /// A node that represents an exact type test. /// TypeEqual, /// diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/AddInstruction.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/AddInstruction.cs index b508a4555e..202238da8f 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/AddInstruction.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/AddInstruction.cs @@ -21,17 +21,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((short)((short)left + (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((short)((short)l + (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -40,17 +39,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject(unchecked((int)left + (int)right)); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject(unchecked((int)l + (int)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -59,17 +57,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((long)left + (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((long)l + (long)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -78,17 +75,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ushort)((ushort)left + (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((ushort)((ushort)l + (ushort)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -97,17 +93,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((uint)left + (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((uint)l + (uint)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -116,17 +111,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ulong)left + (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((ulong)l + (ulong)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -135,17 +129,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((float)left + (float)right); } - else - { - frame.Data[frame.StackIndex - 2] = (float)l + (float)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -154,17 +147,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((double)left + (double)right); } - else - { - frame.Data[frame.StackIndex - 2] = (double)l + (double)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -202,17 +194,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((short)((short)left + (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = checked((short)((short)l + (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -221,17 +212,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject(checked((int)left + (int)right)); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject(checked((int)l + (int)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -240,17 +230,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((long)left + (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((long)l + (long)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -259,17 +248,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((ushort)((ushort)left + (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = checked((ushort)((ushort)l + (ushort)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -278,17 +266,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((uint)left + (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((uint)l + (uint)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -297,17 +284,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((ulong)left + (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((ulong)l + (ulong)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/DivInstruction.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/DivInstruction.cs index 23cda655b2..6c6742e4e6 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/DivInstruction.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/DivInstruction.cs @@ -21,17 +21,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((short)((short)left / (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((short)((short)l / (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -40,17 +39,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject((int)left / (int)right); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject((int)l / (int)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -59,17 +57,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((long)left / (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = (long)l / (long)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -78,17 +75,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ushort)((ushort)left / (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = (ushort)((ushort)l / (ushort)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -97,17 +93,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((uint)left / (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = (uint)l / (uint)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -116,17 +111,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((ulong)left / (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = (ulong)l / (ulong)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -135,17 +129,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((float)left / (float)right); } - else - { - frame.Data[frame.StackIndex - 2] = (float)l / (float)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -154,17 +147,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((double)left / (double)right); } - else - { - frame.Data[frame.StackIndex - 2] = (double)l / (double)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ModuloInstruction.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ModuloInstruction.cs index 6edf63ce2d..f35894cd0c 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ModuloInstruction.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ModuloInstruction.cs @@ -21,17 +21,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((short)((short)left % (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = (short)((short)l % (short)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -40,17 +39,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject((int)left % (int)right); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject((int)l % (int)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -59,17 +57,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((long)left % (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = (long)l % (long)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -78,17 +75,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ushort)((ushort)left % (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = (ushort)((ushort)l % (ushort)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -97,17 +93,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((uint)left % (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = (uint)l % (uint)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -116,17 +111,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((ulong)left % (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = (ulong)l % (ulong)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -135,17 +129,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((float)left % (float)right); } - else - { - frame.Data[frame.StackIndex - 2] = (float)l % (float)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -154,17 +147,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((double)left % (double)right); } - else - { - frame.Data[frame.StackIndex - 2] = (double)l % (double)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/MulInstruction.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/MulInstruction.cs index ccb9d6c450..254432af65 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/MulInstruction.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/MulInstruction.cs @@ -21,17 +21,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((short)((short)left * (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((short)((short)l * (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -40,17 +39,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject(unchecked((int)left * (int)right)); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject(unchecked((int)l * (int)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -59,17 +57,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((long)left * (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((long)l * (long)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -78,17 +75,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ushort)((ushort)left * (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((ushort)((ushort)l * (ushort)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -97,17 +93,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((uint)left * (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((uint)l * (uint)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -116,17 +111,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ulong)left * (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((ulong)l * (ulong)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -135,17 +129,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((float)left * (float)right); } - else - { - frame.Data[frame.StackIndex - 2] = (float)l * (float)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -154,17 +147,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((double)left * (double)right); } - else - { - frame.Data[frame.StackIndex - 2] = (double)l * (double)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -203,17 +195,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((short)((short)left * (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = checked((short)((short)l * (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -222,17 +213,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject(checked((int)left * (int)right)); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject(checked((int)l * (int)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -241,17 +231,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((long)left * (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((long)l * (long)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -260,17 +249,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((ushort)((ushort)left * (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = checked((ushort)((ushort)l * (ushort)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -279,17 +267,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((uint)left * (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((uint)l * (uint)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -298,17 +285,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((ulong)left * (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((ulong)l * (ulong)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } diff --git a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/SubInstruction.cs b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/SubInstruction.cs index 47720939ac..17acd512a0 100644 --- a/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/SubInstruction.cs +++ b/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/SubInstruction.cs @@ -21,17 +21,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((short)((short)left - (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((short)((short)l - (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -40,17 +39,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject(unchecked((int)left - (int)right)); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject(unchecked((int)l - (int)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -59,17 +57,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((long)left - (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((long)l - (long)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -78,17 +75,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ushort)((ushort)left - (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((ushort)((ushort)l - (ushort)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -97,17 +93,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((uint)left - (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((uint)l - (uint)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -116,17 +111,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)unchecked((ulong)left - (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = unchecked((ulong)l - (ulong)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -135,17 +129,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((float)left - (float)right); } - else - { - frame.Data[frame.StackIndex - 2] = (float)l - (float)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -154,17 +147,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)((double)left - (double)right); } - else - { - frame.Data[frame.StackIndex - 2] = (double)l - (double)r; - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -202,17 +194,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((short)((short)left - (short)right)); } - else - { - frame.Data[frame.StackIndex - 2] = checked((short)((short)l - (short)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -221,17 +212,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : ScriptingRuntimeHelpers.Int32ToObject(checked((int)left - (int)right)); } - else - { - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject(checked((int)l - (int)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -240,17 +230,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((long)left - (long)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((long)l - (long)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -259,17 +248,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((ushort)((ushort)left - (ushort)right)); } - else - { - frame.Data[frame.StackIndex - 2] = checked((ushort)((ushort)l - (ushort)r)); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -278,17 +266,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((uint)left - (uint)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((uint)l - (uint)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } @@ -297,17 +284,16 @@ namespace System.Linq.Expressions.Interpreter { public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - if (l == null || r == null) + int index = frame.StackIndex; + object[] stack = frame.Data; + object left = stack[index - 2]; + if (left != null) { - frame.Data[frame.StackIndex - 2] = null; + object right = stack[index - 1]; + stack[index - 2] = right == null ? null : (object)checked((ulong)left - (ulong)right); } - else - { - frame.Data[frame.StackIndex - 2] = checked((ulong)l - (ulong)r); - } - frame.StackIndex--; + + frame.StackIndex = index - 1; return 1; } } diff --git a/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayAccessTests.cs b/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayAccessTests.cs index 8d94ec108d..02344a663f 100644 --- a/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayAccessTests.cs +++ b/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayAccessTests.cs @@ -12,7 +12,7 @@ namespace System.Linq.Expressions.Tests { private static IEnumerable Ranks() => Enumerable.Range(1, 5).Select(i => new object[] {i}); - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] [ClassData(typeof(CompilationTypes))] public static void ArrayAccess_MultiDimensionalOf1(bool useInterpreter) { @@ -30,7 +30,7 @@ namespace System.Linq.Expressions.Tests Assert.Equal(42, get()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] [ClassData(typeof(CompilationTypes))] public static void ArrayIndex_MultiDimensionalOf1(bool useInterpreter) { @@ -77,7 +77,7 @@ namespace System.Linq.Expressions.Tests AssertExtensions.Throws("indexes", () => Expression.ArrayAccess(instance, index)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] [ClassData(typeof(CompilationTypes))] public static void NonZeroBasedOneDimensionalArrayAccess(bool useInterpreter) { diff --git a/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayIndexTests.cs.REMOVED.git-id b/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayIndexTests.cs.REMOVED.git-id index b3c57977b1..8883cb28ef 100644 --- a/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayIndexTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayIndexTests.cs.REMOVED.git-id @@ -1 +1 @@ -389b6d47b316f20c52847e6c98776e95d6654046 \ No newline at end of file +d09e34c661a9d9a2eaf34c476123b81ce0cf1495 \ No newline at end of file diff --git a/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayLengthTests.cs b/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayLengthTests.cs index 836d74b105..374352e1c7 100644 --- a/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayLengthTests.cs +++ b/external/corefx/src/System.Linq.Expressions/tests/Array/ArrayLengthTests.cs @@ -1605,7 +1605,7 @@ namespace System.Linq.Expressions.Tests AssertExtensions.Throws("array", () => Expression.ArrayLength(Expression.Constant(arr))); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public static void ArrayTypeArrayNotAllowedIfNonZeroBoundArray() { Array arr = Array.CreateInstance(typeof(int), new[] { 3 }, new[] { -1 }); diff --git a/external/corefx/src/System.Linq.Expressions/tests/Dynamic/BinaryOperationTests.cs b/external/corefx/src/System.Linq.Expressions/tests/Dynamic/BinaryOperationTests.cs index 72db72f867..37db7d45d4 100644 --- a/external/corefx/src/System.Linq.Expressions/tests/Dynamic/BinaryOperationTests.cs +++ b/external/corefx/src/System.Linq.Expressions/tests/Dynamic/BinaryOperationTests.cs @@ -6,6 +6,9 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Linq.Expressions.Tests; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.CompilerServices; using Microsoft.CSharp.RuntimeBinder; using Xunit; @@ -745,6 +748,27 @@ namespace System.Dynamic.Tests Assert.Equal("42", func().ToString()); } +#if FEATURE_COMPILE // We're not testing compilation, but we do need Reflection.Emit for the test + [Fact] + public void OperationOnTwoObjectsDifferentTypesOfSameName() + { + object objX = Activator.CreateInstance( + AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.Run) + .DefineDynamicModule("TestModule").DefineType("TestType", TypeAttributes.Public).CreateType()); + object objY = Activator.CreateInstance( + AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.Run) + .DefineDynamicModule("TestModule").DefineType("TestType", TypeAttributes.Public).CreateType()); + + CallSiteBinder binder = + Microsoft.CSharp.RuntimeBinder.Binder.BinaryOperation( + CSharpBinderFlags.None, ExpressionType.Equal, + GetType(), new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) }); + var cs = CallSite>.Create(binder); + var t = cs.Target; + Assert.Throws(() => t(cs, objX, objY)); + } +#endif + private class BinaryCallSiteBinder : BinaryOperationBinder { public BinaryCallSiteBinder() : base(ExpressionType.Add) {} diff --git a/external/corefx/src/System.Linq.Expressions/tests/Dynamic/DynamicAttributeTests.cs b/external/corefx/src/System.Linq.Expressions/tests/Dynamic/DynamicAttributeTests.cs new file mode 100644 index 0000000000..271e81a8db --- /dev/null +++ b/external/corefx/src/System.Linq.Expressions/tests/Dynamic/DynamicAttributeTests.cs @@ -0,0 +1,93 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Reflection; +using Xunit; + +namespace System.Runtime.CompilerServices.Tests +{ + public class DynamicAttributeTests + { + [Fact] + public void NullToCtor() + { + AssertExtensions.Throws("transformFlags", () => new DynamicAttribute(null)); + } + + [Fact] + public void DefaultCtorSingleTrueFlag() + { + IList flags = new DynamicAttribute().TransformFlags; + Assert.Equal(1, flags.Count); + Assert.True(flags[0]); + } + + public static dynamic ParamsAndReturns( + dynamic d, dynamic[] da, List ld, Dictionary dido, + Dictionary diod, Dictionary>> dolddi) + { + return null; + } + + [Fact] + public void DefaultForDynamicParam() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).GetParameters()[0] + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(1, flags.Count); + Assert.True(flags[0]); + } + + + [Fact] + public void DefaultForDynamicReturn() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).ReturnParameter + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(1, flags.Count); + Assert.True(flags[0]); + } + + [Fact] + public void ArrayOfDynamic() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).GetParameters()[1] + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(new[] { false, true }, flags); + } + + [Fact] + public void ListOfDynamic() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).GetParameters()[2] + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(new[] { false, true }, flags); + } + + [Fact] + public void DictionaryWithDynamicKey() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).GetParameters()[3] + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(new[] { false, true, false }, flags); + } + + [Fact] + public void DictionaryWithDynamicValue() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).GetParameters()[4] + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(new[] { false, false, true }, flags); + } + + [Fact] + public void ComplexGenericWithDynamic() + { + IList flags = ((DynamicAttribute)GetType().GetMethod(nameof(ParamsAndReturns)).GetParameters()[5] + .GetCustomAttribute(typeof(DynamicAttribute))).TransformFlags; + Assert.Equal(new[] { false, true, false, false, true, false }, flags); + } + } +} diff --git a/external/corefx/src/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs b/external/corefx/src/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs index a5eb3b3fa5..a27639c468 100644 --- a/external/corefx/src/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs +++ b/external/corefx/src/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Reflection; +using System.Reflection.Emit; using Microsoft.CSharp.RuntimeBinder; using Xunit; @@ -182,5 +184,94 @@ namespace System.Dynamic.Tests CallInfo info = new CallInfo(0); Assert.Same(info, new MinimumOverrideInvokeMemberBinding("name", false, info).CallInfo); } + +#if FEATURE_COMPILE // We're not testing compilation, but we do need Reflection.Emit for the test + + private static dynamic GetObjectWithNonIndexerParameterProperty(bool hasGetter, bool hasSetter) + { + TypeBuilder typeBuild = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.Run) + .DefineDynamicModule("TestModule") + .DefineType("TestType", TypeAttributes.Public); + FieldBuilder field = typeBuild.DefineField("_value", typeof(int), FieldAttributes.Private); + + PropertyBuilder property = typeBuild.DefineProperty( + "ItemProp", PropertyAttributes.None, typeof(int), new[] { typeof(int) }); + + if (hasGetter) + { + MethodBuilder getter = typeBuild.DefineMethod( + "get_ItemProp", + MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig + | MethodAttributes.PrivateScope, typeof(int), new[] { typeof(int) }); + + ILGenerator ilGen = getter.GetILGenerator(); + ilGen.Emit(OpCodes.Ldarg_0); + ilGen.Emit(OpCodes.Ldfld, field); + ilGen.Emit(OpCodes.Ret); + + property.SetGetMethod(getter); + } + + if (hasSetter) + { + + MethodBuilder setter = typeBuild.DefineMethod( + "set_ItemProp", + MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig + | MethodAttributes.PrivateScope, typeof(void), new[] { typeof(int), typeof(int) }); + + ILGenerator ilGen = setter.GetILGenerator(); + ilGen.Emit(OpCodes.Ldarg_0); + ilGen.Emit(OpCodes.Ldarg_2); + ilGen.Emit(OpCodes.Stfld, field); + ilGen.Emit(OpCodes.Ret); + + property.SetSetMethod(setter); + } + + return Activator.CreateInstance(typeBuild.CreateType()); + } + + [Fact] + public void NonIndexerParameterizedDirectAccess() + { + // If a paramterized property isn't the type's indexer, we should be allowed to use the + // getter or setter directly. + dynamic d = GetObjectWithNonIndexerParameterProperty(true, true); + d.set_ItemProp(2, 19); + int value = d.get_ItemProp(2); + Assert.Equal(19, value); + } + + [Fact] + public void NonIndexerParamterizedGetterAndSetterIndexAccess() + { + dynamic d = GetObjectWithNonIndexerParameterProperty(true, true); + RuntimeBinderException ex = Assert.Throws(() => d.ItemProp[2] = 3); + // Similar message to CS1545 advises about getter and setter methods. + Assert.Contains("get_ItemProp", ex.Message); + Assert.Contains("set_ItemProp", ex.Message); + } + + [Fact] + public void NonIndexerParamterizedGetterOnlyIndexAccess() + { + dynamic d = GetObjectWithNonIndexerParameterProperty(true, false); + int dump; + RuntimeBinderException ex = Assert.Throws(() => dump = d.ItemProp[2]); + // Similar message to CS1546 advises about getter method. + Assert.Contains("get_ItemProp", ex.Message); + } + + [Fact] + public void NonIndexerParamterizedSetterOnlyIndexAccess() + { + dynamic d = GetObjectWithNonIndexerParameterProperty(false, true); + RuntimeBinderException ex = Assert.Throws(() => d.ItemProp[2] = 9); + // Similar message to CS1546 advises about setter method. + Assert.Contains("set_ItemProp", ex.Message); + } + +#endif } } diff --git a/external/corefx/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj b/external/corefx/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj index 3d5fc211d9..eab29a1042 100644 --- a/external/corefx/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj +++ b/external/corefx/src/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj @@ -131,6 +131,7 @@ + @@ -261,9 +262,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/SynchronousChannelMergeEnumerator.cs b/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/SynchronousChannelMergeEnumerator.cs index 82bd6e022f..87059c5d42 100644 --- a/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/SynchronousChannelMergeEnumerator.cs +++ b/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/SynchronousChannelMergeEnumerator.cs @@ -16,7 +16,7 @@ namespace System.Linq.Parallel /// This enumerator merges multiple input channels into a single output stream. The merging process just /// goes from left-to-right, enumerating each channel in succession in its entirety. /// Assumptions: - /// Before enumerating this object, all producers for all channels must have finished enqueueing new + /// Before enumerating this object, all producers for all channels must have finished enqueuing new /// elements. /// /// diff --git a/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs b/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs index 28ce1da212..e8d63e766e 100644 --- a/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs +++ b/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs @@ -105,7 +105,7 @@ namespace System.Linq.Parallel for (int i = 0; i < outputStream.PartitionCount; i++) { outputStream[i] = new SortQueryOperatorEnumerator( - inputStream[i], _keySelector, _comparer); + inputStream[i], _keySelector); } recipient.Receive(outputStream); @@ -185,22 +185,19 @@ namespace System.Linq.Parallel { private readonly QueryOperatorEnumerator _source; // Data source to sort. private readonly Func _keySelector; // Key selector used when sorting. - private readonly IComparer _keyComparer; // Key comparison logic to use during sorting. //--------------------------------------------------------------------------------------- // Instantiates a new sort operator enumerator. // internal SortQueryOperatorEnumerator(QueryOperatorEnumerator source, - Func keySelector, IComparer keyComparer) + Func keySelector) { Debug.Assert(source != null); Debug.Assert(keySelector != null, "need a key comparer"); - Debug.Assert(keyComparer != null, "expected a compiled operator"); _source = source; _keySelector = keySelector; - _keyComparer = keyComparer; } //--------------------------------------------------------------------------------------- // Accessor for the key comparison routine. diff --git a/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs b/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs index d4aa20daca..3e23d659c6 100644 --- a/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs +++ b/external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs @@ -82,7 +82,7 @@ namespace System.Linq.Parallel } /// - /// This method is responsible for enumerating results and enqueueing them to + /// This method is responsible for enumerating results and enqueuing them to /// the output buffer as appropriate. Each base class implements its own. /// protected override void SpoolingWork() diff --git a/external/corefx/src/System.Linq.Parallel/tests/Helpers/UnorderedSources.cs b/external/corefx/src/System.Linq.Parallel/tests/Helpers/UnorderedSources.cs index a87246ddbb..6a4e7ce52e 100644 --- a/external/corefx/src/System.Linq.Parallel/tests/Helpers/UnorderedSources.cs +++ b/external/corefx/src/System.Linq.Parallel/tests/Helpers/UnorderedSources.cs @@ -166,7 +166,7 @@ namespace System.Linq.Parallel.Tests /// Entries for test data. /// The first element is the left Labeled{ParallelQuery{int}} range, the second element is the left count, /// the third element is the right Labeled{ParallelQuery{int}} range, the fourth element is the right count, - /// and the fifth is the right start.. + /// and the fifth is the right start. public static IEnumerable BinaryRanges(IEnumerable leftCounts, Func rightStart, IEnumerable rightCounts) { foreach (object[] left in Ranges(leftCounts)) diff --git a/external/corefx/src/System.Linq/src/System/Linq/OrderedEnumerable.cs b/external/corefx/src/System.Linq/src/System/Linq/OrderedEnumerable.cs index d07b0dc515..0f58510b90 100644 --- a/external/corefx/src/System.Linq/src/System/Linq/OrderedEnumerable.cs +++ b/external/corefx/src/System.Linq/src/System/Linq/OrderedEnumerable.cs @@ -522,69 +522,74 @@ namespace System.Linq internal TElement ElementAt(TElement[] elements, int count, int idx) => elements[QuickSelect(ComputeMap(elements, count), count - 1, idx)]; - private int CompareKeys(int index1, int index2) => index1 == index2 ? 0 : CompareAnyKeys(index1, index2); - - private void QuickSort(int[] map, int left, int right) - { - do - { - int i = left; - int j = right; - int x = map[i + ((j - i) >> 1)]; - do - { - while (i < map.Length && CompareKeys(x, map[i]) > 0) - { - i++; - } - - while (j >= 0 && CompareKeys(x, map[j]) < 0) - { - j--; - } - - if (i > j) - { - break; - } - - if (i < j) - { - int temp = map[i]; - map[i] = map[j]; - map[j] = temp; - } - - i++; - j--; - } - while (i <= j); - - if (j - left <= right - i) - { - if (left < j) - { - QuickSort(map, left, j); - } - - left = i; - } - else - { - if (i < right) - { - QuickSort(map, i, right); - } - - right = j; - } - } - while (left < right); - } + protected abstract void QuickSort(int[] map, int left, int right); // Sorts the k elements between minIdx and maxIdx without sorting all elements // Time complexity: O(n + k log k) best and average case. O(n^2) worse case. - private void PartialQuickSort(int[] map, int left, int right, int minIdx, int maxIdx) + protected abstract void PartialQuickSort(int[] map, int left, int right, int minIdx, int maxIdx); + + // Finds the element that would be at idx if the collection was sorted. + // Time complexity: O(n) best and average case. O(n^2) worse case. + protected abstract int QuickSelect(int[] map, int right, int idx); + } + + internal sealed class EnumerableSorter : EnumerableSorter + { + private readonly Func _keySelector; + private readonly IComparer _comparer; + private readonly bool _descending; + private readonly EnumerableSorter _next; + private TKey[] _keys; + + internal EnumerableSorter(Func keySelector, IComparer comparer, bool descending, EnumerableSorter next) + { + _keySelector = keySelector; + _comparer = comparer; + _descending = descending; + _next = next; + } + + internal override void ComputeKeys(TElement[] elements, int count) + { + _keys = new TKey[count]; + for (int i = 0; i < count; i++) + { + _keys[i] = _keySelector(elements[i]); + } + + _next?.ComputeKeys(elements, count); + } + + internal override int CompareAnyKeys(int index1, int index2) + { + int c = _comparer.Compare(_keys[index1], _keys[index2]); + if (c == 0) + { + if (_next == null) + { + return index1 - index2; // ensure stability of sort + } + + return _next.CompareAnyKeys(index1, index2); + } + + // -c will result in a negative value for int.MinValue (-int.MinValue == int.MinValue). + // Flipping keys earlier is more likely to trigger something strange in a comparer, + // particularly as it comes to the sort being stable. + return (_descending != (c > 0)) ? 1 : -1; + } + + + private int CompareKeys(int index1, int index2) => index1 == index2 ? 0 : CompareAnyKeys(index1, index2); + + protected override void QuickSort(int[] keys, int lo, int hi) => + Array.Sort(keys, lo, hi - lo + 1, Comparer.Create(CompareAnyKeys)); // TODO #24115: Remove Create call when delegate-based overload is available + + + + // Sorts the k elements between minIdx and maxIdx without sorting all elements + // Time complexity: O(n + k log k) best and average case. O(n^2) worse case. + protected override void PartialQuickSort(int[] map, int left, int right, int minIdx, int maxIdx) { do { @@ -653,7 +658,7 @@ namespace System.Linq // Finds the element that would be at idx if the collection was sorted. // Time complexity: O(n) best and average case. O(n^2) worse case. - private int QuickSelect(int[] map, int right, int idx) + protected override int QuickSelect(int[] map, int right, int idx) { int left = 0; do @@ -723,51 +728,4 @@ namespace System.Linq return map[idx]; } } - - internal sealed class EnumerableSorter : EnumerableSorter - { - private readonly Func _keySelector; - private readonly IComparer _comparer; - private readonly bool _descending; - private readonly EnumerableSorter _next; - private TKey[] _keys; - - internal EnumerableSorter(Func keySelector, IComparer comparer, bool descending, EnumerableSorter next) - { - _keySelector = keySelector; - _comparer = comparer; - _descending = descending; - _next = next; - } - - internal override void ComputeKeys(TElement[] elements, int count) - { - _keys = new TKey[count]; - for (int i = 0; i < count; i++) - { - _keys[i] = _keySelector(elements[i]); - } - - _next?.ComputeKeys(elements, count); - } - - internal override int CompareAnyKeys(int index1, int index2) - { - int c = _comparer.Compare(_keys[index1], _keys[index2]); - if (c == 0) - { - if (_next == null) - { - return index1 - index2; - } - - return _next.CompareAnyKeys(index1, index2); - } - - // -c will result in a negative value for int.MinValue (-int.MinValue == int.MinValue). - // Flipping keys earlier is more likely to trigger something strange in a comparer, - // particularly as it comes to the sort being stable. - return (_descending != (c > 0)) ? 1 : -1; - } - } } diff --git a/external/corefx/src/System.Linq/src/System/Linq/SequenceEqual.cs b/external/corefx/src/System.Linq/src/System/Linq/SequenceEqual.cs index aa4aaf31e2..df8600f477 100644 --- a/external/corefx/src/System.Linq/src/System/Linq/SequenceEqual.cs +++ b/external/corefx/src/System.Linq/src/System/Linq/SequenceEqual.cs @@ -28,9 +28,26 @@ namespace System.Linq throw Error.ArgumentNull(nameof(second)); } - if (first is ICollection firstCol && second is ICollection secondCol && firstCol.Count != secondCol.Count) + if (first is ICollection firstCol && second is ICollection secondCol) { - return false; + if (firstCol.Count != secondCol.Count) + { + return false; + } + + if (firstCol is IList firstList && secondCol is IList secondList) + { + int count = firstCol.Count; + for (int i = 0; i < count; i++) + { + if (!comparer.Equals(firstList[i], secondList[i])) + { + return false; + } + } + + return true; + } } using (IEnumerator e1 = first.GetEnumerator()) diff --git a/external/corefx/src/System.Linq/src/System/Linq/Take.cs b/external/corefx/src/System.Linq/src/System/Linq/Take.cs index 7a53ece2b1..b73fab326a 100644 --- a/external/corefx/src/System.Linq/src/System/Linq/Take.cs +++ b/external/corefx/src/System.Linq/src/System/Linq/Take.cs @@ -116,10 +116,18 @@ namespace System.Linq Debug.Assert(source != null); Debug.Assert(count > 0); - var queue = new Queue(); + Queue queue; using (IEnumerator e = source.GetEnumerator()) { + if (!e.MoveNext()) + { + yield break; + } + + queue = new Queue(); + queue.Enqueue(e.Current); + while (e.MoveNext()) { if (queue.Count < count) diff --git a/external/corefx/src/System.Linq/tests/ConcatTests.cs b/external/corefx/src/System.Linq/tests/ConcatTests.cs index 89b9052942..425fefbdd7 100644 --- a/external/corefx/src/System.Linq/tests/ConcatTests.cs +++ b/external/corefx/src/System.Linq/tests/ConcatTests.cs @@ -421,5 +421,123 @@ namespace System.Linq.Tests Assert.Equal(0xf00, en.Current); } } + + [Theory] + [MemberData(nameof(GetToArrayDataSources))] + public void CollectionInterleavedWithLazyEnumerables_ToArray(IEnumerable[] arrays) + { + // See https://github.com/dotnet/corefx/issues/23680 + + IEnumerable concats = arrays[0]; + + for (int i = 1; i < arrays.Length; i++) + { + concats = concats.Concat(arrays[i]); + } + + int[] results = concats.ToArray(); + + for (int i = 0; i < results.Length; i++) + { + Assert.Equal(i, results[i]); + } + } + + private static IEnumerable GetToArrayDataSources() + { + // Marker at the end + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(new int[] { 0 }), + new TestEnumerable(new int[] { 1 }), + new TestEnumerable(new int[] { 2 }), + new int[] { 3 }, + } + }; + + // Marker at beginning + yield return new object[] + { + new IEnumerable[] + { + new int[] { 0 }, + new TestEnumerable(new int[] { 1 }), + new TestEnumerable(new int[] { 2 }), + new TestEnumerable(new int[] { 3 }), + } + }; + + // Marker in middle + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(new int[] { 0 }), + new int[] { 1 }, + new TestEnumerable(new int[] { 2 }), + } + }; + + // Non-marker in middle + yield return new object[] + { + new IEnumerable[] + { + new int[] { 0 }, + new TestEnumerable(new int[] { 1 }), + new int[] { 2 }, + } + }; + + // Big arrays (marker in middle) + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(Enumerable.Range(0, 100).ToArray()), + Enumerable.Range(100, 100).ToArray(), + new TestEnumerable(Enumerable.Range(200, 100).ToArray()), + } + }; + + // Big arrays (non-marker in middle) + yield return new object[] + { + new IEnumerable[] + { + Enumerable.Range(0, 100).ToArray(), + new TestEnumerable(Enumerable.Range(100, 100).ToArray()), + Enumerable.Range(200, 100).ToArray(), + } + }; + + // Interleaved (first marker) + yield return new object[] + { + new IEnumerable[] + { + new int[] { 0 }, + new TestEnumerable(new int[] { 1 }), + new int[] { 2 }, + new TestEnumerable(new int[] { 3 }), + new int[] { 4 }, + } + }; + + // Interleaved (first non-marker) + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(new int[] { 0 }), + new int[] { 1 }, + new TestEnumerable(new int[] { 2 }), + new int[] { 3 }, + new TestEnumerable(new int[] { 4 }), + } + }; + } } } diff --git a/external/corefx/src/System.Linq/tests/OrderByDescendingTests.cs b/external/corefx/src/System.Linq/tests/OrderByDescendingTests.cs index d2e1b6a749..660970ea4e 100644 --- a/external/corefx/src/System.Linq/tests/OrderByDescendingTests.cs +++ b/external/corefx/src/System.Linq/tests/OrderByDescendingTests.cs @@ -184,5 +184,50 @@ namespace System.Linq.Tests Func keySelector = null; AssertExtensions.Throws("keySelector", () => Enumerable.Empty().OrderByDescending(keySelector)); } + + [Fact] + public void SortsLargeAscendingEnumerableCorrectly() + { + const int Items = 1_000_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => i); + IOrderedEnumerable ordered = unordered.OrderByDescending(i => -i); + + Assert.Equal(expected, ordered); + } + + [Fact] + public void SortsLargeDescendingEnumerableCorrectly() + { + const int Items = 1_000_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => Items - i - 1); + IOrderedEnumerable ordered = unordered.OrderByDescending(i => -i); + + Assert.Equal(expected, ordered); + } + + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + [InlineData(8)] + [InlineData(16)] + [InlineData(1024)] + [InlineData(4096)] + [InlineData(1_000_000)] + public void SortsRandomizedEnumerableCorrectly(int items) + { + var r = new Random(42); + + int[] randomized = Enumerable.Range(0, items).Select(i => r.Next()).ToArray(); + int[] ordered = ForceNotCollection(randomized).OrderByDescending(i => -i).ToArray(); + + Array.Sort(randomized, (a, b) => a - b); + Assert.Equal(randomized, ordered); + } } } diff --git a/external/corefx/src/System.Linq/tests/OrderByTests.cs b/external/corefx/src/System.Linq/tests/OrderByTests.cs index c98bb251ba..7b39a07763 100644 --- a/external/corefx/src/System.Linq/tests/OrderByTests.cs +++ b/external/corefx/src/System.Linq/tests/OrderByTests.cs @@ -377,5 +377,50 @@ namespace System.Linq.Tests Enumerable.Range(0, 100).Select(i => i.ToString()).OrderBy(i => i.Length).ThenBy(i => i).ToArray(); Assert.Equal(expected, ordered); } + + [Fact] + public void SortsLargeAscendingEnumerableCorrectly() + { + const int Items = 1_000_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => i); + IOrderedEnumerable ordered = unordered.OrderBy(i => i); + + Assert.Equal(expected, ordered); + } + + [Fact] + public void SortsLargeDescendingEnumerableCorrectly() + { + const int Items = 1_000_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => Items - i - 1); + IOrderedEnumerable ordered = unordered.OrderBy(i => i); + + Assert.Equal(expected, ordered); + } + + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + [InlineData(8)] + [InlineData(16)] + [InlineData(1024)] + [InlineData(4096)] + [InlineData(1_000_000)] + public void SortsRandomizedEnumerableCorrectly(int items) + { + var r = new Random(42); + + int[] randomized = Enumerable.Range(0, items).Select(i => r.Next()).ToArray(); + int[] ordered = ForceNotCollection(randomized).OrderBy(i => i).ToArray(); + + Array.Sort(randomized); + Assert.Equal(randomized, ordered); + } } } diff --git a/external/corefx/src/System.Linq/tests/Performance/Configurations.props b/external/corefx/src/System.Linq/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Linq/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Linq/tests/SelectManyTests.cs b/external/corefx/src/System.Linq/tests/SelectManyTests.cs index 10eb908b72..1026e93698 100644 --- a/external/corefx/src/System.Linq/tests/SelectManyTests.cs +++ b/external/corefx/src/System.Linq/tests/SelectManyTests.cs @@ -477,5 +477,116 @@ namespace System.Linq.Tests IEnumerable iterator = counts.SelectMany(c => Enumerable.Range(1, c)); Assert.Throws(() => iterator.Count()); } + + [Theory] + [MemberData(nameof(GetToArrayDataSources))] + public void CollectionInterleavedWithLazyEnumerables_ToArray(IEnumerable[] arrays) + { + // See https://github.com/dotnet/corefx/issues/23680 + + int[] results = arrays.SelectMany(ar => ar).ToArray(); + + for (int i = 0; i < results.Length; i++) + { + Assert.Equal(i, results[i]); + } + } + + private static IEnumerable GetToArrayDataSources() + { + // Marker at the end + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(new int[] { 0 }), + new TestEnumerable(new int[] { 1 }), + new TestEnumerable(new int[] { 2 }), + new int[] { 3 }, + } + }; + + // Marker at beginning + yield return new object[] + { + new IEnumerable[] + { + new int[] { 0 }, + new TestEnumerable(new int[] { 1 }), + new TestEnumerable(new int[] { 2 }), + new TestEnumerable(new int[] { 3 }), + } + }; + + // Marker in middle + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(new int[] { 0 }), + new int[] { 1 }, + new TestEnumerable(new int[] { 2 }), + } + }; + + // Non-marker in middle + yield return new object[] + { + new IEnumerable[] + { + new int[] { 0 }, + new TestEnumerable(new int[] { 1 }), + new int[] { 2 }, + } + }; + + // Big arrays (marker in middle) + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(Enumerable.Range(0, 100).ToArray()), + Enumerable.Range(100, 100).ToArray(), + new TestEnumerable(Enumerable.Range(200, 100).ToArray()), + } + }; + + // Big arrays (non-marker in middle) + yield return new object[] + { + new IEnumerable[] + { + Enumerable.Range(0, 100).ToArray(), + new TestEnumerable(Enumerable.Range(100, 100).ToArray()), + Enumerable.Range(200, 100).ToArray(), + } + }; + + // Interleaved (first marker) + yield return new object[] + { + new IEnumerable[] + { + new int[] { 0 }, + new TestEnumerable(new int[] { 1 }), + new int[] { 2 }, + new TestEnumerable(new int[] { 3 }), + new int[] { 4 }, + } + }; + + // Interleaved (first non-marker) + yield return new object[] + { + new IEnumerable[] + { + new TestEnumerable(new int[] { 0 }), + new int[] { 1 }, + new TestEnumerable(new int[] { 2 }), + new int[] { 3 }, + new TestEnumerable(new int[] { 4 }), + } + }; + } } } diff --git a/external/corefx/src/System.Linq/tests/System.Linq.Tests.csproj b/external/corefx/src/System.Linq/tests/System.Linq.Tests.csproj index f9da3173ae..ddfef7245e 100644 --- a/external/corefx/src/System.Linq/tests/System.Linq.Tests.csproj +++ b/external/corefx/src/System.Linq/tests/System.Linq.Tests.csproj @@ -77,9 +77,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Linq\SkipTakeData.cs diff --git a/external/corefx/src/System.Linq/tests/ThenByDescendingTests.cs b/external/corefx/src/System.Linq/tests/ThenByDescendingTests.cs index 0610faa7a2..a8fd10e1e5 100644 --- a/external/corefx/src/System.Linq/tests/ThenByDescendingTests.cs +++ b/external/corefx/src/System.Linq/tests/ThenByDescendingTests.cs @@ -165,5 +165,71 @@ And Immortality.".Split(new[] { ' ', '\n', '\r', '—' }, StringSplitOptions.Rem Func keySelector = null; AssertExtensions.Throws("keySelector", () => Enumerable.Empty().OrderBy(e => e).ThenByDescending(keySelector, null)); } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void SortsLargeAscendingEnumerableCorrectly(int thenBys) + { + const int Items = 100_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => i); + IOrderedEnumerable ordered = unordered.OrderBy(_ => 0); + switch (thenBys) + { + case 1: ordered = ordered.ThenByDescending(i => -i); break; + case 2: ordered = ordered.ThenByDescending(i => 0).ThenByDescending(i => -i); break; + case 3: ordered = ordered.ThenByDescending(i => 0).ThenByDescending(i => 0).ThenByDescending(i => -i); break; + } + + Assert.Equal(expected, ordered); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void SortsLargeDescendingEnumerableCorrectly(int thenBys) + { + const int Items = 100_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => Items - i - 1); + IOrderedEnumerable ordered = unordered.OrderBy(_ => 0); + switch (thenBys) + { + case 1: ordered = ordered.ThenByDescending(i => -i); break; + case 2: ordered = ordered.ThenByDescending(i => 0).ThenByDescending(i => -i); break; + case 3: ordered = ordered.ThenByDescending(i => 0).ThenByDescending(i => 0).ThenByDescending(i => -i); break; + } + + Assert.Equal(expected, ordered); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void SortsLargeRandomizedEnumerableCorrectly(int thenBys) + { + const int Items = 100_000; + var r = new Random(42); + + int[] randomized = Enumerable.Range(0, Items).Select(i => r.Next()).ToArray(); + + IOrderedEnumerable orderedEnumerable = randomized.OrderBy(_ => 0); + switch (thenBys) + { + case 1: orderedEnumerable = orderedEnumerable.ThenByDescending(i => -i); break; + case 2: orderedEnumerable = orderedEnumerable.ThenByDescending(i => 0).ThenByDescending(i => -i); break; + case 3: orderedEnumerable = orderedEnumerable.ThenByDescending(i => 0).ThenByDescending(i => 0).ThenByDescending(i => -i); break; + } + int[] ordered = orderedEnumerable.ToArray(); + + Array.Sort(randomized, (a, b) => a - b); + Assert.Equal(randomized, orderedEnumerable); + } } } diff --git a/external/corefx/src/System.Linq/tests/ThenByTests.cs b/external/corefx/src/System.Linq/tests/ThenByTests.cs index 6b9955a805..126c47aa1c 100644 --- a/external/corefx/src/System.Linq/tests/ThenByTests.cs +++ b/external/corefx/src/System.Linq/tests/ThenByTests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Linq.Tests { - public class ThenByTests + public class ThenByTests : EnumerableTests { [Fact] public void SameResultsRepeatCallsIntQuery() @@ -170,5 +170,71 @@ And Immortality.".Split(new[] { ' ', '\n', '\r', '—' }, StringSplitOptions.Rem Func keySelector = null; AssertExtensions.Throws("keySelector", () => Enumerable.Empty().OrderBy(e => e).ThenBy(keySelector, null)); } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void SortsLargeAscendingEnumerableCorrectly(int thenBys) + { + const int Items = 100_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => i); + IOrderedEnumerable ordered = unordered.OrderBy(_ => 0); + switch (thenBys) + { + case 1: ordered = ordered.ThenBy(i => i); break; + case 2: ordered = ordered.ThenBy(i => 0).ThenBy(i => i); break; + case 3: ordered = ordered.ThenBy(i => 0).ThenBy(i => 0).ThenBy(i => i); break; + } + + Assert.Equal(expected, ordered); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void SortsLargeDescendingEnumerableCorrectly(int thenBys) + { + const int Items = 100_000; + IEnumerable expected = NumberRangeGuaranteedNotCollectionType(0, Items); + + IEnumerable unordered = expected.Select(i => Items - i - 1); + IOrderedEnumerable ordered = unordered.OrderBy(_ => 0); + switch (thenBys) + { + case 1: ordered = ordered.ThenBy(i => i); break; + case 2: ordered = ordered.ThenBy(i => 0).ThenBy(i => i); break; + case 3: ordered = ordered.ThenBy(i => 0).ThenBy(i => 0).ThenBy(i => i); break; + } + + Assert.Equal(expected, ordered); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public void SortsLargeRandomizedEnumerableCorrectly(int thenBys) + { + const int Items = 100_000; + var r = new Random(42); + + int[] randomized = Enumerable.Range(0, Items).Select(i => r.Next()).ToArray(); + + IOrderedEnumerable orderedEnumerable = randomized.OrderBy(_ => 0); + switch (thenBys) + { + case 1: orderedEnumerable = orderedEnumerable.ThenBy(i => i); break; + case 2: orderedEnumerable = orderedEnumerable.ThenBy(i => 0).ThenBy(i => i); break; + case 3: orderedEnumerable = orderedEnumerable.ThenBy(i => 0).ThenBy(i => 0).ThenBy(i => i); break; + } + int[] ordered = orderedEnumerable.ToArray(); + + Array.Sort(randomized, (a, b) => a - b); + Assert.Equal(randomized, orderedEnumerable); + } } } diff --git a/external/corefx/src/System.Memory/System.Memory.sln b/external/corefx/src/System.Memory/System.Memory.sln index fed12b170d..15d7f65e81 100644 --- a/external/corefx/src/System.Memory/System.Memory.sln +++ b/external/corefx/src/System.Memory/System.Memory.sln @@ -43,10 +43,10 @@ Global {4BBC8F69-D03E-4432-AA8A-D458FA5B235A}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {4BBC8F69-D03E-4432-AA8A-D458FA5B235A}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU {4BBC8F69-D03E-4432-AA8A-D458FA5B235A}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU - {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {E883935B-D8FD-4FC9-A189-9D9E7F7EF550}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/external/corefx/src/System.Memory/dir.props b/external/corefx/src/System.Memory/dir.props index 85eb617dd7..87260a1999 100644 --- a/external/corefx/src/System.Memory/dir.props +++ b/external/corefx/src/System.Memory/dir.props @@ -4,8 +4,7 @@ 4.0.1.0 Open - - true - false + true + true \ No newline at end of file diff --git a/external/corefx/src/System.Memory/pkg/System.Memory.pkgproj b/external/corefx/src/System.Memory/pkg/System.Memory.pkgproj index e2d31e705b..ff57701606 100644 --- a/external/corefx/src/System.Memory/pkg/System.Memory.pkgproj +++ b/external/corefx/src/System.Memory/pkg/System.Memory.pkgproj @@ -4,9 +4,18 @@ - net45;netcore45;wp8;wpa81;netcoreapp1.0;$(AllXamarinFrameworks) + net45;netcore45;wpa81;netcoreapp1.0;$(AllXamarinFrameworks) + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Memory/ref/Configurations.props b/external/corefx/src/System.Memory/ref/Configurations.props index 129adad32f..41873b4f7e 100644 --- a/external/corefx/src/System.Memory/ref/Configurations.props +++ b/external/corefx/src/System.Memory/ref/Configurations.props @@ -2,8 +2,10 @@ + netstandard1.1; netstandard; - netstandard1.0; + netcoreapp; + uap; - \ No newline at end of file + diff --git a/external/corefx/src/System.Memory/ref/System.Memory.cs b/external/corefx/src/System.Memory/ref/System.Memory.cs index b13ac7a0b5..e3a12d5c2e 100644 --- a/external/corefx/src/System.Memory/ref/System.Memory.cs +++ b/external/corefx/src/System.Memory/ref/System.Memory.cs @@ -5,29 +5,30 @@ // Changes to this file must follow the http://aka.ms/api-review process. // ------------------------------------------------------------------------------ -#pragma warning disable 0809 //warning CS0809: Obsolete member 'Span.Equals(object)' overrides non-obsolete member 'object.Equals(object)' namespace System { - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct ReadOnlySpan + public readonly ref struct ReadOnlySpan { public static ReadOnlySpan Empty { get { throw null; } } public ReadOnlySpan(T[] array) { throw null;} - public ReadOnlySpan(T[] array, int start) { throw null;} public ReadOnlySpan(T[] array, int start, int length) { throw null;} public unsafe ReadOnlySpan(void* pointer, int length) { throw null;} public bool IsEmpty { get { throw null; } } public T this[int index] { get { throw null; }} public int Length { get { throw null; } } public void CopyTo(Span destination) { } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public static ReadOnlySpan DangerousCreate(object obj, ref T objectData, int length) { throw null; } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public ref T DangerousGetPinnableReference() { throw null; } +#pragma warning disable 0809 //warning CS0809: Obsolete member 'Span.Equals(object)' overrides non-obsolete member 'object.Equals(object)' [System.ObsoleteAttribute("Equals() on ReadOnlySpan will always throw an exception. Use == instead.")] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ObsoleteAttribute("GetHashCode() on ReadOnlySpan will always throw an exception.")] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } +#pragma warning restore 0809 public static bool operator ==(ReadOnlySpan left, ReadOnlySpan right) { throw null; } public static implicit operator ReadOnlySpan (T[] array) { throw null; } public static implicit operator ReadOnlySpan (ArraySegment arraySegment) { throw null; } @@ -38,12 +39,10 @@ namespace System public bool TryCopyTo(Span destination) { throw null; } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct Span + public readonly ref struct Span { public static Span Empty { get { throw null; } } public Span(T[] array) { throw null;} - public Span(T[] array, int start) { throw null;} public Span(T[] array, int start, int length) { throw null;} public unsafe Span(void* pointer, int length) { throw null;} public bool IsEmpty { get { throw null; } } @@ -52,14 +51,18 @@ namespace System public void Clear() { } public void Fill(T value) { } public void CopyTo(Span destination) { } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public static Span DangerousCreate(object obj, ref T objectData, int length) { throw null; } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public ref T DangerousGetPinnableReference() { throw null; } +#pragma warning disable 0809 //warning CS0809: Obsolete member 'Span.Equals(object)' overrides non-obsolete member 'object.Equals(object)' [System.ObsoleteAttribute("Equals() on Span will always throw an exception. Use == instead.")] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } [System.ObsoleteAttribute("GetHashCode() on Span will always throw an exception.")] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } +#pragma warning restore 0809 public static bool operator ==(Span left, Span right) { throw null; } public static implicit operator Span (T[] array) { throw null; } public static implicit operator Span (ArraySegment arraySegment) { throw null; } @@ -119,5 +122,158 @@ namespace System public static ReadOnlySpan NonPortableCast(this ReadOnlySpan source) where TFrom : struct where TTo : struct { throw null; } } + + public readonly struct ReadOnlyMemory + { + public static ReadOnlyMemory Empty { get { throw null; } } + public ReadOnlyMemory(T[] array) { throw null;} + public ReadOnlyMemory(T[] array, int start, int length) { throw null;} + public bool IsEmpty { get { throw null; } } + public int Length { get { throw null; } } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + public bool Equals(ReadOnlyMemory other) { throw null; } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static implicit operator ReadOnlyMemory(T[] array) { throw null; } + public static implicit operator ReadOnlyMemory(ArraySegment arraySegment) { throw null; } + public ReadOnlyMemory Slice(int start) { throw null; } + public ReadOnlyMemory Slice(int start, int length) { throw null; } + public ReadOnlySpan Span { get { throw null; } } + public unsafe Buffers.MemoryHandle Retain(bool pin = false) { throw null; } + public T[] ToArray() { throw null; } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public bool DangerousTryGetArray(out ArraySegment arraySegment) { throw null; } + } + + public readonly struct Memory + { + public static Memory Empty { get { throw null; } } + public Memory(T[] array) { throw null;} + public Memory(T[] array, int start, int length) { throw null;} + public bool IsEmpty { get { throw null; } } + public int Length { get { throw null; } } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + public bool Equals(Memory other) { throw null; } + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static implicit operator Memory(T[] array) { throw null; } + public static implicit operator Memory(ArraySegment arraySegment) { throw null; } + public static implicit operator ReadOnlyMemory(Memory memory) { throw null; } + public Memory Slice(int start) { throw null; } + public Memory Slice(int start, int length) { throw null; } + public Span Span { get { throw null; } } + public unsafe Buffers.MemoryHandle Retain(bool pin = false) { throw null; } + public T[] ToArray() { throw null; } + public bool TryGetArray(out ArraySegment arraySegment) { throw null; } + } } +namespace System.Buffers +{ + public unsafe struct MemoryHandle : IDisposable + { + public MemoryHandle(IRetainable owner, void* pinnedPointer = null, System.Runtime.InteropServices.GCHandle handle = default(System.Runtime.InteropServices.GCHandle)) { throw null; } + public void* PinnedPointer { get { throw null; } } + public void Dispose() { throw null; } + } + + public interface IRetainable + { + bool Release(); + void Retain(); + } + + public abstract class OwnedMemory : IDisposable, IRetainable + { + public Memory Memory { get { throw null; } } + public abstract bool IsDisposed { get; } + protected abstract bool IsRetained { get; } + public abstract int Length { get; } + public abstract Span Span { get; } + public void Dispose() { throw null; } + protected abstract void Dispose(bool disposing); + public abstract MemoryHandle Pin(); + public abstract bool Release(); + public abstract void Retain(); + protected internal abstract bool TryGetArray(out ArraySegment arraySegment); + } +} + +namespace System.Buffers.Binary +{ + public static class BinaryPrimitives + { + public static sbyte ReverseEndianness(sbyte value) { throw null; } + public static byte ReverseEndianness(byte value) { throw null; } + public static short ReverseEndianness(short value) { throw null; } + public static ushort ReverseEndianness(ushort value) { throw null; } + public static int ReverseEndianness(int value) { throw null; } + public static uint ReverseEndianness(uint value) { throw null; } + public static long ReverseEndianness(long value) { throw null; } + public static ulong ReverseEndianness(ulong value) { throw null; } + + public static T ReadMachineEndian(ReadOnlySpan buffer) where T : struct { throw null; } + public static bool TryReadMachineEndian(ReadOnlySpan buffer, out T value) where T : struct { throw null; } + + public static short ReadInt16LittleEndian(ReadOnlySpan buffer) { throw null; } + public static int ReadInt32LittleEndian(ReadOnlySpan buffer) { throw null; } + public static long ReadInt64LittleEndian(ReadOnlySpan buffer) { throw null; } + public static ushort ReadUInt16LittleEndian(ReadOnlySpan buffer) { throw null; } + public static uint ReadUInt32LittleEndian(ReadOnlySpan buffer) { throw null; } + public static ulong ReadUInt64LittleEndian(ReadOnlySpan buffer) { throw null; } + + public static bool TryReadInt16LittleEndian(ReadOnlySpan buffer, out short value) { throw null; } + public static bool TryReadInt32LittleEndian(ReadOnlySpan buffer, out int value) { throw null; } + public static bool TryReadInt64LittleEndian(ReadOnlySpan buffer, out long value) { throw null; } + public static bool TryReadUInt16LittleEndian(ReadOnlySpan buffer, out ushort value) { throw null; } + public static bool TryReadUInt32LittleEndian(ReadOnlySpan buffer, out uint value) { throw null; } + public static bool TryReadUInt64LittleEndian(ReadOnlySpan buffer, out ulong value) { throw null; } + + public static short ReadInt16BigEndian(ReadOnlySpan buffer) { throw null; } + public static int ReadInt32BigEndian(ReadOnlySpan buffer) { throw null; } + public static long ReadInt64BigEndian(ReadOnlySpan buffer) { throw null; } + public static ushort ReadUInt16BigEndian(ReadOnlySpan buffer) { throw null; } + public static uint ReadUInt32BigEndian(ReadOnlySpan buffer) { throw null; } + public static ulong ReadUInt64BigEndian(ReadOnlySpan buffer) { throw null; } + + public static bool TryReadInt16BigEndian(ReadOnlySpan buffer, out short value) { throw null; } + public static bool TryReadInt32BigEndian(ReadOnlySpan buffer, out int value) { throw null; } + public static bool TryReadInt64BigEndian(ReadOnlySpan buffer, out long value) { throw null; } + public static bool TryReadUInt16BigEndian(ReadOnlySpan buffer, out ushort value) { throw null; } + public static bool TryReadUInt32BigEndian(ReadOnlySpan buffer, out uint value) { throw null; } + public static bool TryReadUInt64BigEndian(ReadOnlySpan buffer, out ulong value) { throw null; } + + public static void WriteMachineEndian(Span buffer, ref T value) where T : struct { throw null; } + public static bool TryWriteMachineEndian(Span buffer, ref T value) where T : struct { throw null; } + + public static void WriteInt16LittleEndian(Span buffer, short value) { throw null; } + public static void WriteInt32LittleEndian(Span buffer, int value) { throw null; } + public static void WriteInt64LittleEndian(Span buffer, long value) { throw null; } + public static void WriteUInt16LittleEndian(Span buffer, ushort value) { throw null; } + public static void WriteUInt32LittleEndian(Span buffer, uint value) { throw null; } + public static void WriteUInt64LittleEndian(Span buffer, ulong value) { throw null; } + + public static bool TryWriteInt16LittleEndian(Span buffer, short value) { throw null; } + public static bool TryWriteInt32LittleEndian(Span buffer, int value) { throw null; } + public static bool TryWriteInt64LittleEndian(Span buffer, long value) { throw null; } + public static bool TryWriteUInt16LittleEndian(Span buffer, ushort value) { throw null; } + public static bool TryWriteUInt32LittleEndian(Span buffer, uint value) { throw null; } + public static bool TryWriteUInt64LittleEndian(Span buffer, ulong value) { throw null; } + + public static void WriteInt16BigEndian(Span buffer, short value) { throw null; } + public static void WriteInt32BigEndian(Span buffer, int value) { throw null; } + public static void WriteInt64BigEndian(Span buffer, long value) { throw null; } + public static void WriteUInt16BigEndian(Span buffer, ushort value) { throw null; } + public static void WriteUInt32BigEndian(Span buffer, uint value) { throw null; } + public static void WriteUInt64BigEndian(Span buffer, ulong value) { throw null; } + + public static bool TryWriteInt16BigEndian(Span buffer, short value) { throw null; } + public static bool TryWriteInt32BigEndian(Span buffer, int value) { throw null; } + public static bool TryWriteInt64BigEndian(Span buffer, long value) { throw null; } + public static bool TryWriteUInt16BigEndian(Span buffer, ushort value) { throw null; } + public static bool TryWriteUInt32BigEndian(Span buffer, uint value) { throw null; } + public static bool TryWriteUInt64BigEndian(Span buffer, ulong value) { throw null; } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Memory/ref/System.Memory.csproj b/external/corefx/src/System.Memory/ref/System.Memory.csproj index 3d399b0d9d..0d0db9a2fd 100644 --- a/external/corefx/src/System.Memory/ref/System.Memory.csproj +++ b/external/corefx/src/System.Memory/ref/System.Memory.csproj @@ -5,16 +5,26 @@ true false {E883935B-D8FD-4FC9-A189-9D9E7F7EF550} + true - - + + + + + + - + + + + + + - \ No newline at end of file + diff --git a/external/corefx/src/System.Memory/src/Configurations.props b/external/corefx/src/System.Memory/src/Configurations.props index dbb4f7264c..3026f5c782 100644 --- a/external/corefx/src/System.Memory/src/Configurations.props +++ b/external/corefx/src/System.Memory/src/Configurations.props @@ -2,7 +2,7 @@ - netstandard1.0; + netstandard1.1; netstandard; netcoreapp-Windows_NT; netcoreapp-Unix; diff --git a/external/corefx/src/System.Memory/src/Resources/Strings.resx b/external/corefx/src/System.Memory/src/Resources/Strings.resx index 797f8e29eb..9fd5a70774 100644 --- a/external/corefx/src/System.Memory/src/Resources/Strings.resx +++ b/external/corefx/src/System.Memory/src/Resources/Strings.resx @@ -1,5 +1,64 @@  + @@ -73,4 +132,10 @@ Destination is too short. - + + Memory<T> has been disposed. + + + Release all references before disposing this instance. + + \ No newline at end of file diff --git a/external/corefx/src/System.Memory/src/System.Memory.csproj b/external/corefx/src/System.Memory/src/System.Memory.csproj index 2945135c16..f0e48299b7 100644 --- a/external/corefx/src/System.Memory/src/System.Memory.csproj +++ b/external/corefx/src/System.Memory/src/System.Memory.csproj @@ -7,8 +7,9 @@ false $(OutputPath)$(MSBuildProjectName).xml true + $(DefineConstants);netstandard $(DefineConstants);netcoreapp - $(DefineConstants);netstandard10 + $(DefineConstants);netstandard11 @@ -16,14 +17,20 @@ - - + + + + + + + + @@ -34,15 +41,22 @@ + + + + + + - - - + + + + @@ -55,4 +69,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs new file mode 100644 index 0000000000..0dbf7edd3f --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs @@ -0,0 +1,151 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime; +using System.Runtime.CompilerServices; + +namespace System.Buffers.Binary +{ + /// + /// Reads bytes as primitives with specific endianness + /// + /// + /// For native formats, SpanExtensions.Read<T> should be used. + /// Use these helpers when you need to read specific endinanness. + /// + public static partial class BinaryPrimitives + { + /// + /// This is a no-op and added only for consistency. + /// This allows the caller to read a struct of numeric primitives and reverse each field + /// rather than having to skip sbyte fields. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static sbyte ReverseEndianness(sbyte value) + { + return value; + } + + /// + /// Reverses a primitive value - performs an endianness swap + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static short ReverseEndianness(short value) + { + return (short)((value & 0x00FF) << 8 | (value & 0xFF00) >> 8); + } + + /// + /// Reverses a primitive value - performs an endianness swap + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static int ReverseEndianness(int value) => (int)ReverseEndianness((uint)value); + + /// + /// Reverses a primitive value - performs an endianness swap + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static long ReverseEndianness(long value) => (long)ReverseEndianness((ulong)value); + + /// + /// This is a no-op and added only for consistency. + /// This allows the caller to read a struct of numeric primitives and reverse each field + /// rather than having to skip byte fields. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static byte ReverseEndianness(byte value) + { + return value; + } + + /// + /// Reverses a primitive value - performs an endianness swap + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static ushort ReverseEndianness(ushort value) + { + return (ushort)((value & 0x00FFU) << 8 | (value & 0xFF00U) >> 8); + } + + /// + /// Reverses a primitive value - performs an endianness swap + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint ReverseEndianness(uint value) + { + value = (value << 16) | (value >> 16); + value = (value & 0x00FF00FF) << 8 | (value & 0xFF00FF00) >> 8; + return value; + } + + /// + /// Reverses a primitive value - performs an endianness swap + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static ulong ReverseEndianness(ulong value) + { + value = (value << 32) | (value >> 32); + value = (value & 0x0000FFFF0000FFFF) << 16 | (value & 0xFFFF0000FFFF0000) >> 16; + value = (value & 0x00FF00FF00FF00FF) << 8 | (value & 0xFF00FF00FF00FF00) >> 8; + return value; + } + + /// + /// Reads a structure of type T out of a read-only span of bytes. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static T ReadMachineEndian(ReadOnlySpan buffer) + where T : struct + { +#if netstandard + if (SpanHelpers.IsReferenceOrContainsReferences()) + { + ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T)); + } +#else + if (RuntimeHelpers.IsReferenceOrContainsReferences()) + { + throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeWithPointersNotSupported, typeof(T))); + } +#endif + if (Unsafe.SizeOf() > buffer.Length) + { + throw new ArgumentOutOfRangeException(); + } + return Unsafe.ReadUnaligned(ref buffer.DangerousGetPinnableReference()); + } + + /// + /// Reads a structure of type T out of a span of bytes. + /// If the span is too small to contain the type T, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadMachineEndian(ReadOnlySpan buffer, out T value) + where T : struct + { +#if netstandard + if (SpanHelpers.IsReferenceOrContainsReferences()) + { + ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T)); + } +#else + if (RuntimeHelpers.IsReferenceOrContainsReferences()) + { + throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeWithPointersNotSupported, typeof(T))); + } +#endif + if (Unsafe.SizeOf() > (uint)buffer.Length) + { +#if __MonoCS__ + value = default(T); +#else + value = default; +#endif + return false; + } + value = Unsafe.ReadUnaligned(ref buffer.DangerousGetPinnableReference()); + return true; + } + } +} diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs new file mode 100644 index 0000000000..a98d91588c --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs @@ -0,0 +1,186 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; + +namespace System.Buffers.Binary +{ + public static partial class BinaryPrimitives + { + /// + /// Reads an Int16 out of a read-only span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static short ReadInt16BigEndian(ReadOnlySpan buffer) + { + short result = ReadMachineEndian(buffer); + if (BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads an Int32 out of a read-only span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static int ReadInt32BigEndian(ReadOnlySpan buffer) + { + int result = ReadMachineEndian(buffer); + if (BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads an Int64 out of a read-only span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static long ReadInt64BigEndian(ReadOnlySpan buffer) + { + long result = ReadMachineEndian(buffer); + if (BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads a UInt16 out of a read-only span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static ushort ReadUInt16BigEndian(ReadOnlySpan buffer) + { + ushort result = ReadMachineEndian(buffer); + if (BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads a UInt32 out of a read-only span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint ReadUInt32BigEndian(ReadOnlySpan buffer) + { + uint result = ReadMachineEndian(buffer); + if (BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads a UInt64 out of a read-only span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static ulong ReadUInt64BigEndian(ReadOnlySpan buffer) + { + ulong result = ReadMachineEndian(buffer); + if (BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads an Int16 out of a read-only span of bytes as big endian. + /// If the span is too small to contain an Int16, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadInt16BigEndian(ReadOnlySpan buffer, out short value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads an Int32 out of a read-only span of bytes as big endian. + /// If the span is too small to contain an Int32, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadInt32BigEndian(ReadOnlySpan buffer, out int value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads an Int64 out of a read-only span of bytes as big endian. + /// If the span is too small to contain an Int64, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadInt64BigEndian(ReadOnlySpan buffer, out long value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads a UInt16 out of a read-only span of bytes as big endian. + /// If the span is too small to contain a UInt16, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadUInt16BigEndian(ReadOnlySpan buffer, out ushort value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads a UInt32 out of a read-only span of bytes as big endian. + /// If the span is too small to contain a UInt32, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadUInt32BigEndian(ReadOnlySpan buffer, out uint value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads a UInt64 out of a read-only span of bytes as big endian. + /// If the span is too small to contain a UInt64, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadUInt64BigEndian(ReadOnlySpan buffer, out ulong value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + } +} + diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs new file mode 100644 index 0000000000..09dd7d8801 --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs @@ -0,0 +1,185 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; + +namespace System.Buffers.Binary +{ + public static partial class BinaryPrimitives + { + /// + /// Reads an Int16 out of a read-only span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static short ReadInt16LittleEndian(ReadOnlySpan buffer) + { + short result = ReadMachineEndian(buffer); + if (!BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads an Int32 out of a read-only span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static int ReadInt32LittleEndian(ReadOnlySpan buffer) + { + int result = ReadMachineEndian(buffer); + if (!BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads an Int64 out of a read-only span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static long ReadInt64LittleEndian(ReadOnlySpan buffer) + { + long result = ReadMachineEndian(buffer); + if (!BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads a UInt16 out of a read-only span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static ushort ReadUInt16LittleEndian(ReadOnlySpan buffer) + { + ushort result = ReadMachineEndian(buffer); + if (!BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads a UInt32 out of a read-only span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static uint ReadUInt32LittleEndian(ReadOnlySpan buffer) + { + uint result = ReadMachineEndian(buffer); + if (!BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads a UInt64 out of a read-only span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static ulong ReadUInt64LittleEndian(ReadOnlySpan buffer) + { + ulong result = ReadMachineEndian(buffer); + if (!BitConverter.IsLittleEndian) + { + result = ReverseEndianness(result); + } + return result; + } + + /// + /// Reads an Int16 out of a read-only span of bytes as little endian. + /// If the span is too small to contain an Int16, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadInt16LittleEndian(ReadOnlySpan buffer, out short value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads an Int32 out of a read-only span of bytes as little endian. + /// If the span is too small to contain an Int32, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadInt32LittleEndian(ReadOnlySpan buffer, out int value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads an Int64 out of a read-only span of bytes as little endian. + /// If the span is too small to contain an Int64, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadInt64LittleEndian(ReadOnlySpan buffer, out long value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads a UInt16 out of a read-only span of bytes as little endian. + /// If the span is too small to contain a UInt16, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadUInt16LittleEndian(ReadOnlySpan buffer, out ushort value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads a UInt32 out of a read-only span of bytes as little endian. + /// If the span is too small to contain a UInt32, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadUInt32LittleEndian(ReadOnlySpan buffer, out uint value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + + /// + /// Reads a UInt64 out of a read-only span of bytes as little endian. + /// If the span is too small to contain a UInt64, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryReadUInt64LittleEndian(ReadOnlySpan buffer, out ulong value) + { + bool success = TryReadMachineEndian(buffer, out value); + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return success; + } + } +} diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs new file mode 100644 index 0000000000..9834986f4a --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs @@ -0,0 +1,65 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime; +using System.Runtime.CompilerServices; + +namespace System.Buffers.Binary +{ + public static partial class BinaryPrimitives + { + /// + /// Writes a structure of type T into a span of bytes. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteMachineEndian(Span buffer, ref T value) + where T : struct + { +#if netstandard + if (SpanHelpers.IsReferenceOrContainsReferences()) + { + ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T)); + } +#else + if (RuntimeHelpers.IsReferenceOrContainsReferences()) + { + throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeWithPointersNotSupported, typeof(T))); + } +#endif + if ((uint)Unsafe.SizeOf() > (uint)buffer.Length) + { + throw new ArgumentOutOfRangeException(); + } + Unsafe.WriteUnaligned(ref buffer.DangerousGetPinnableReference(), value); + } + + /// + /// Writes a structure of type T into a span of bytes. + /// If the span is too small to contain the type T, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteMachineEndian(Span buffer, ref T value) + where T : struct + { +#if netstandard + if (SpanHelpers.IsReferenceOrContainsReferences()) + { + ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T)); + } +#else + if (RuntimeHelpers.IsReferenceOrContainsReferences()) + { + throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeWithPointersNotSupported, typeof(T))); + } +#endif + if (Unsafe.SizeOf() > (uint)buffer.Length) + { + return false; + } + Unsafe.WriteUnaligned(ref buffer.DangerousGetPinnableReference(), value); + return true; + } + } +} + diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs new file mode 100644 index 0000000000..ebfb0968d8 --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs @@ -0,0 +1,173 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; + +namespace System.Buffers.Binary +{ + public static partial class BinaryPrimitives + { + /// + /// Writes an Int16 into a span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteInt16BigEndian(Span buffer, short value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int32 into a span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteInt32BigEndian(Span buffer, int value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int64 into a span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteInt64BigEndian(Span buffer, long value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt16 into a span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteUInt16BigEndian(Span buffer, ushort value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt32 into a span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteUInt32BigEndian(Span buffer, uint value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt64 into a span of bytes as big endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteUInt64BigEndian(Span buffer, ulong value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int16 into a span of bytes as big endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteInt16BigEndian(Span buffer, short value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int32 into a span of bytes as big endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteInt32BigEndian(Span buffer, int value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int64 into a span of bytes as big endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteInt64BigEndian(Span buffer, long value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt16 into a span of bytes as big endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteUInt16BigEndian(Span buffer, ushort value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt32 into a span of bytes as big endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteUInt32BigEndian(Span buffer, uint value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt64 into a span of bytes as big endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteUInt64BigEndian(Span buffer, ulong value) + { + if (BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + } +} diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs new file mode 100644 index 0000000000..34c317b0f2 --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs @@ -0,0 +1,173 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; + +namespace System.Buffers.Binary +{ + public static partial class BinaryPrimitives + { + /// + /// Writes an Int16 into a span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteInt16LittleEndian(Span buffer, short value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int32 into a span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteInt32LittleEndian(Span buffer, int value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int64 into a span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteInt64LittleEndian(Span buffer, long value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt16 into a span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteUInt16LittleEndian(Span buffer, ushort value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt32 into a span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteUInt32LittleEndian(Span buffer, uint value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt64 into a span of bytes as little endian. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void WriteUInt64LittleEndian(Span buffer, ulong value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + WriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int16 into a span of bytes as little endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteInt16LittleEndian(Span buffer, short value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int32 into a span of bytes as little endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteInt32LittleEndian(Span buffer, int value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Writes an Int64 into a span of bytes as little endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteInt64LittleEndian(Span buffer, long value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt16 into a span of bytes as little endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteUInt16LittleEndian(Span buffer, ushort value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt32 into a span of bytes as little endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteUInt32LittleEndian(Span buffer, uint value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + + /// + /// Write a UInt64 into a span of bytes as little endian. + /// If the span is too small to contain the value, return false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool TryWriteUInt64LittleEndian(Span buffer, ulong value) + { + if (!BitConverter.IsLittleEndian) + { + value = ReverseEndianness(value); + } + return TryWriteMachineEndian(buffer, ref value); + } + } +} diff --git a/external/corefx/src/System.Memory/src/System/Buffers/IRetainable.cs b/external/corefx/src/System.Memory/src/System/Buffers/IRetainable.cs new file mode 100644 index 0000000000..3a92b3d5f5 --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/IRetainable.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime; +using System.Runtime.CompilerServices; + +namespace System.Buffers +{ + /// + /// Provides a mechanism for manual lifetime management. + /// + public interface IRetainable + { + /// + /// Call this method to indicate that the IRetainable object is in use. + /// Do not dispose until Release is called. + /// + void Retain(); + + /// + /// Call this method to indicate that the IRetainable object is no longer in use. + /// The object can now be disposed. + /// + bool Release(); + } +} diff --git a/external/corefx/src/System.Memory/src/System/Buffers/MemoryHandle.cs b/external/corefx/src/System.Memory/src/System/Buffers/MemoryHandle.cs new file mode 100644 index 0000000000..68c4b4892f --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/MemoryHandle.cs @@ -0,0 +1,75 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime; +using System.Runtime.InteropServices; + +namespace System.Buffers +{ + /// + /// A handle for the memory. + /// + public unsafe struct MemoryHandle : IDisposable + { + private IRetainable _retainable; + private void* _pointer; + private GCHandle _handle; + + /// + /// Creates a new memory handle for the memory. + /// + /// reference to manually managed object + /// pointer to the buffer, or null if the buffer is not pinned + /// handle used to pin array buffers + public MemoryHandle(IRetainable retainable, void* pinnedPointer = null, GCHandle handle = default(GCHandle)) + { + _retainable = retainable; + _pointer = pinnedPointer; + _handle = handle; + } + + /// + /// Returns the address of the pinned object, or null if the object is not pinned. + /// + public void* PinnedPointer => _pointer; + + /// + /// Adds an offset to the pinned pointer. + /// + /// + /// Throw when pinned pointer is null. + /// + internal void AddOffset(int offset) + { + if (_pointer == null) + { + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.pointer); + } + else + { + _pointer = (void*)((byte*)_pointer + offset); + } + } + + /// + /// Frees the pinned handle and releases IRetainable. + /// + public void Dispose() + { + if (_handle.IsAllocated) + { + _handle.Free(); + } + + if (_retainable != null) + { + _retainable.Release(); + _retainable = null; + } + + _pointer = null; + } + + } +} diff --git a/external/corefx/src/System.Memory/src/System/Buffers/OwnedMemory.cs b/external/corefx/src/System.Memory/src/System/Buffers/OwnedMemory.cs new file mode 100644 index 0000000000..3daae843da --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Buffers/OwnedMemory.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime; +using System.Runtime.CompilerServices; + +namespace System.Buffers +{ + + /// + /// Owner of Memory that provides appropriate lifetime management mechanisms for it. + /// + public abstract class OwnedMemory : IDisposable, IRetainable + { + + /// + /// The number of items in the Memory. + /// + public abstract int Length { get; } + + /// + /// Returns a span wrapping the underlying memory. + /// + public abstract Span Span { get; } + + /// + /// Returns a Memory if the underlying memory has not been freed. + /// + /// + /// Thrown when the underlying memory has already been disposed. + /// + public Memory Memory + { + get + { + if (IsDisposed) + { + ThrowHelper.ThrowObjectDisposedException_MemoryDisposed(nameof(OwnedMemory)); + } + return new Memory(this, 0, Length); + } + } + + /// + /// Returns a handle for the array that has been pinned and hence its address can be taken + /// + public abstract MemoryHandle Pin(); + + /// + /// Returns an array segment. + /// + protected internal abstract bool TryGetArray(out ArraySegment arraySegment); + + /// + /// Implements IDisposable. + /// + /// + /// Throw when there are still retained references to the memory + /// + public void Dispose() + { + if (IsRetained) + { + ThrowHelper.ThrowInvalidOperationException_OutstandingReferences(); + } + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Clean up of any leftover managed and unmanaged resources. + /// + protected abstract void Dispose(bool disposing); + + /// + /// Return true if someone is holding a reference to the memory. + /// + protected abstract bool IsRetained { get; } + + /// + /// Return true if the underlying memory has been freed. + /// + public abstract bool IsDisposed { get; } + + /// + /// Implements IRetainable. Prevent accidental disposal of the memory. + /// + public abstract void Retain(); + + /// + /// Implements IRetainable. The memory can now be diposed. + /// + public abstract bool Release(); + + } +} diff --git a/external/corefx/src/System.Memory/src/System/Memory.cs b/external/corefx/src/System.Memory/src/System/Memory.cs new file mode 100644 index 0000000000..491d7702f6 --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/Memory.cs @@ -0,0 +1,311 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +#if !MONO +using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute; +using EditorBrowsableState = System.ComponentModel.EditorBrowsableState; +#endif +using System.Diagnostics; +using System.Runtime; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace System +{ + /// + /// Memory represents a contiguous region of arbitrary memory similar to Span. + /// Unlike Span, it is not a byref-like type. + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + [DebuggerTypeProxy(typeof(MemoryDebugView<>))] + public readonly struct Memory + { + // The highest order bit of _index is used to discern whether _arrayOrOwnedMemory is an array or an owned memory + // if (_index >> 31) == 1, object _arrayOrOwnedMemory is an OwnedMemory + // else, object _arrayOrOwnedMemory is a T[] + private readonly object _arrayOrOwnedMemory; + private readonly int _index; + private readonly int _length; + + private const int RemoveOwnedFlagBitMask = 0x7FFFFFFF; + + /// + /// Creates a new memory over the entirety of the target array. + /// + /// The target array. + /// Thrown when is a null + /// reference (Nothing in Visual Basic). + /// Thrown when is covariant and array's type is not exactly T[]. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public Memory(T[] array) + { + if (array == null) + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); + if (default(T) == null && array.GetType() != typeof(T[])) + ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T)); + + _arrayOrOwnedMemory = array; + _index = 0; + _length = array.Length; + } + + /// + /// Creates a new memory over the portion of the target array beginning + /// at 'start' index and ending at 'end' index (exclusive). + /// + /// The target array. + /// The index at which to begin the memory. + /// The number of items in the memory. + /// Thrown when is a null + /// reference (Nothing in Visual Basic). + /// Thrown when is covariant and array's type is not exactly T[]. + /// + /// Thrown when the specified or end index is not in the range (<0 or >=Length). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public Memory(T[] array, int start, int length) + { + if (array == null) + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); + if (default(T) == null && array.GetType() != typeof(T[])) + ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T)); + if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start)) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + _arrayOrOwnedMemory = array; + _index = start; + _length = length; + } + + // Constructor for internal use only. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal Memory(OwnedMemory owner, int index, int length) + { + if (owner == null) + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.ownedMemory); + if (index < 0 || length < 0) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + _arrayOrOwnedMemory = owner; + _index = index | (1 << 31); // Before using _index, check if _index < 0, then 'and' it with RemoveOwnedFlagBitMask + _length = length; + } + + //Debugger Display = {T[length]} + private string DebuggerDisplay => string.Format("{{{0}[{1}]}}", typeof(T).Name, _length); + + /// + /// Defines an implicit conversion of an array to a + /// + public static implicit operator Memory(T[] array) => new Memory(array); + + /// + /// Defines an implicit conversion of a to a + /// + public static implicit operator Memory(ArraySegment arraySegment) => new Memory(arraySegment.Array, arraySegment.Offset, arraySegment.Count); + + /// + /// Defines an implicit conversion of a to a + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static implicit operator ReadOnlyMemory(Memory memory) + { + if (memory._index < 0) + return new ReadOnlyMemory((OwnedMemory)memory._arrayOrOwnedMemory, memory._index & RemoveOwnedFlagBitMask, memory._length); + return new ReadOnlyMemory((T[])memory._arrayOrOwnedMemory, memory._index, memory._length); + } + + /// + /// Returns an empty + /// + public static Memory Empty { get; } = SpanHelpers.PerTypeValues.EmptyArray; + + /// + /// The number of items in the memory. + /// + public int Length => _length; + + /// + /// Returns true if Length is 0. + /// + public bool IsEmpty => _length == 0; + + /// + /// Forms a slice out of the given memory, beginning at 'start'. + /// + /// The index at which to begin this slice. + /// + /// Thrown when the specified index is not in range (<0 or >=Length). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public Memory Slice(int start) + { + if ((uint)start > (uint)_length) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + if (_index < 0) + return new Memory((OwnedMemory)_arrayOrOwnedMemory, (_index & RemoveOwnedFlagBitMask) + start, _length - start); + return new Memory((T[])_arrayOrOwnedMemory, _index + start, _length - start); + } + + /// + /// Forms a slice out of the given memory, beginning at 'start', of given length + /// + /// The index at which to begin this slice. + /// The desired length for the slice (exclusive). + /// + /// Thrown when the specified or end index is not in range (<0 or >=Length). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public Memory Slice(int start, int length) + { + if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start)) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + if (_index < 0) + return new Memory((OwnedMemory)_arrayOrOwnedMemory, (_index & RemoveOwnedFlagBitMask) + start, length); + return new Memory((T[])_arrayOrOwnedMemory, _index + start, length); + } + + /// + /// Returns a span from the memory. + /// + public Span Span + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + if (_index < 0) + return ((OwnedMemory)_arrayOrOwnedMemory).Span.Slice(_index & RemoveOwnedFlagBitMask, _length); + return new Span((T[])_arrayOrOwnedMemory, _index, _length); + } + } + + /// + /// Returns a handle for the array. + /// If pin is true, the GC will not move the array and hence its address can be taken + /// + public unsafe MemoryHandle Retain(bool pin = false) + { + MemoryHandle memoryHandle; + if (pin) + { + if (_index < 0) + { + memoryHandle = ((OwnedMemory)_arrayOrOwnedMemory).Pin(); + memoryHandle.AddOffset((_index & RemoveOwnedFlagBitMask) * Unsafe.SizeOf()); + } + else + { + var array = (T[])_arrayOrOwnedMemory; + var handle = GCHandle.Alloc(array, GCHandleType.Pinned); + void* pointer = Unsafe.Add((void*)handle.AddrOfPinnedObject(), _index); + memoryHandle = new MemoryHandle(null, pointer, handle); + } + } + else + { + if (_index < 0) + { + ((OwnedMemory)_arrayOrOwnedMemory).Retain(); + memoryHandle = new MemoryHandle((OwnedMemory)_arrayOrOwnedMemory); + } + else + { + memoryHandle = new MemoryHandle(null); + } + } + return memoryHandle; + } + + /// + /// Get an array segment from the underlying memory. + /// If unable to get the array segment, return false with a default array segment. + /// + public bool TryGetArray(out ArraySegment arraySegment) + { + if (_index < 0) + { + if (((OwnedMemory)_arrayOrOwnedMemory).TryGetArray(out var segment)) + { + arraySegment = new ArraySegment(segment.Array, segment.Offset + (_index & RemoveOwnedFlagBitMask), _length); + return true; + } + } + else + { + arraySegment = new ArraySegment((T[])_arrayOrOwnedMemory, _index, _length); + return true; + } + + arraySegment = default(ArraySegment); + return false; + } + + /// + /// Copies the contents from the memory into a new array. This heap + /// allocates, so should generally be avoided, however it is sometimes + /// necessary to bridge the gap with APIs written in terms of arrays. + /// + public T[] ToArray() => Span.ToArray(); + + /// + /// Determines whether the specified object is equal to the current object. + /// Returns true if the object is Memory or ReadOnlyMemory and if both objects point to the same array and have the same length. + /// +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif + public override bool Equals(object obj) + { + if (obj is ReadOnlyMemory) + { + return ((ReadOnlyMemory)obj).Equals(this); + } + else if (obj is Memory memory) + { + return Equals(memory); + } + else + { + return false; + } + } + + /// + /// Returns true if the memory points to the same array and has the same length. Note that + /// this does *not* check to see if the *contents* are equal. + /// + public bool Equals(Memory other) + { + return + _arrayOrOwnedMemory == other._arrayOrOwnedMemory && + _index == other._index && + _length == other._length; + } + + /// + /// Serves as the default hash function. + /// +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif + public override int GetHashCode() + { + return CombineHashCodes(_arrayOrOwnedMemory.GetHashCode(), (_index & RemoveOwnedFlagBitMask).GetHashCode(), _length.GetHashCode()); + } + + private static int CombineHashCodes(int left, int right) + { + return ((left << 5) + left) ^ right; + } + + private static int CombineHashCodes(int h1, int h2, int h3) + { + return CombineHashCodes(CombineHashCodes(h1, h2), h3); + } + + } +} diff --git a/external/corefx/src/System.Memory/src/System/MemoryDebugView.cs b/external/corefx/src/System.Memory/src/System/MemoryDebugView.cs new file mode 100644 index 0000000000..3ade65f268 --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/MemoryDebugView.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System +{ + internal sealed class MemoryDebugView + { + private readonly ReadOnlyMemory _memory; + + public MemoryDebugView(Memory memory) + { + _memory = memory; + } + + public MemoryDebugView(ReadOnlyMemory memory) + { + _memory = memory; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public T[] Items + { + // This is a work around since we cannot use _memory.ToArray() due to + // https://devdiv.visualstudio.com/DevDiv/_workitems?id=286592 + get + { + if (_memory.DangerousTryGetArray(out ArraySegment segment)) + { + T[] array = new T[_memory.Length]; + Array.Copy(segment.Array, segment.Offset, array, 0, array.Length); + return array; + } + return SpanHelpers.PerTypeValues.EmptyArray; + } + } + } +} diff --git a/external/corefx/src/System.Memory/src/System/ReadOnlyMemory.cs b/external/corefx/src/System.Memory/src/System/ReadOnlyMemory.cs new file mode 100644 index 0000000000..3295b214ef --- /dev/null +++ b/external/corefx/src/System.Memory/src/System/ReadOnlyMemory.cs @@ -0,0 +1,298 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +#if !MONO +using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute; +using EditorBrowsableState = System.ComponentModel.EditorBrowsableState; +#endif +using System.Diagnostics; +using System.Runtime; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace System +{ + /// + /// ReadOnlyMemory represents a contiguous region of arbitrary similar to ReadOnlySpan. + /// Unlike ReadOnlySpan, it is not a byref-like type. + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + [DebuggerTypeProxy(typeof(MemoryDebugView<>))] + public readonly struct ReadOnlyMemory + { + // The highest order bit of _index is used to discern whether _arrayOrOwnedMemory is an array or an owned memory + // if (_index >> 31) == 1, object _arrayOrOwnedMemory is an OwnedMemory + // else, object _arrayOrOwnedMemory is a T[] + private readonly object _arrayOrOwnedMemory; + private readonly int _index; + private readonly int _length; + + private const int RemoveOwnedFlagBitMask = 0x7FFFFFFF; + + /// + /// Creates a new memory over the entirety of the target array. + /// + /// The target array. + /// Thrown when is a null + /// reference (Nothing in Visual Basic). + /// Thrown when is covariant and array's type is not exactly T[]. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ReadOnlyMemory(T[] array) + { + if (array == null) + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); + + _arrayOrOwnedMemory = array; + _index = 0; + _length = array.Length; + } + + /// + /// Creates a new memory over the portion of the target array beginning + /// at 'start' index and ending at 'end' index (exclusive). + /// + /// The target array. + /// The index at which to begin the memory. + /// The number of items in the memory. + /// Thrown when is a null + /// reference (Nothing in Visual Basic). + /// Thrown when is covariant and array's type is not exactly T[]. + /// + /// Thrown when the specified or end index is not in the range (<0 or >=Length). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ReadOnlyMemory(T[] array, int start, int length) + { + if (array == null) + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); + if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start)) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + _arrayOrOwnedMemory = array; + _index = start; + _length = length; + } + + // Constructor for internal use only. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal ReadOnlyMemory(OwnedMemory owner, int index, int length) + { + if (owner == null) + ThrowHelper.ThrowArgumentNullException(ExceptionArgument.ownedMemory); + if (index < 0 || length < 0) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + _arrayOrOwnedMemory = owner; + _index = index | (1 << 31); // Before using _index, check if _index < 0, then 'and' it with RemoveOwnedFlagBitMask + _length = length; + } + + //Debugger Display = {T[length]} + private string DebuggerDisplay => string.Format("{{{0}[{1}]}}", typeof(T).Name, _length); + + /// + /// Defines an implicit conversion of an array to a + /// + public static implicit operator ReadOnlyMemory(T[] array) => new ReadOnlyMemory(array); + + /// + /// Defines an implicit conversion of a to a + /// + public static implicit operator ReadOnlyMemory(ArraySegment arraySegment) => new ReadOnlyMemory(arraySegment.Array, arraySegment.Offset, arraySegment.Count); + + /// + /// Returns an empty + /// + public static ReadOnlyMemory Empty { get; } = SpanHelpers.PerTypeValues.EmptyArray; + + /// + /// The number of items in the memory. + /// + public int Length => _length; + + /// + /// Returns true if Length is 0. + /// + public bool IsEmpty => _length == 0; + + /// + /// Forms a slice out of the given memory, beginning at 'start'. + /// + /// The index at which to begin this slice. + /// + /// Thrown when the specified index is not in range (<0 or >=Length). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ReadOnlyMemory Slice(int start) + { + if ((uint)start > (uint)_length) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + if (_index < 0) + return new ReadOnlyMemory((OwnedMemory)_arrayOrOwnedMemory, (_index & RemoveOwnedFlagBitMask) + start, _length - start); + return new ReadOnlyMemory((T[])_arrayOrOwnedMemory, _index + start, _length - start); + } + + /// + /// Forms a slice out of the given memory, beginning at 'start', of given length + /// + /// The index at which to begin this slice. + /// The desired length for the slice (exclusive). + /// + /// Thrown when the specified or end index is not in range (<0 or >=Length). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ReadOnlyMemory Slice(int start, int length) + { + if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start)) + ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); + + if (_index < 0) + return new ReadOnlyMemory((OwnedMemory)_arrayOrOwnedMemory, (_index & RemoveOwnedFlagBitMask) + start, length); + return new ReadOnlyMemory((T[])_arrayOrOwnedMemory, _index + start, length); + } + + /// + /// Returns a span from the memory. + /// + public ReadOnlySpan Span + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + if (_index < 0) + return ((OwnedMemory)_arrayOrOwnedMemory).Span.Slice(_index & RemoveOwnedFlagBitMask, _length); + return new ReadOnlySpan((T[])_arrayOrOwnedMemory, _index, _length); + } + } + + /// + /// Returns a handle for the array. + /// If pin is true, the GC will not move the array and hence its address can be taken + /// + public unsafe MemoryHandle Retain(bool pin = false) + { + MemoryHandle memoryHandle; + if (pin) + { + if (_index < 0) + { + memoryHandle = ((OwnedMemory)_arrayOrOwnedMemory).Pin(); + memoryHandle.AddOffset((_index & RemoveOwnedFlagBitMask) * Unsafe.SizeOf()); + } + else + { + var array = (T[])_arrayOrOwnedMemory; + var handle = GCHandle.Alloc(array, GCHandleType.Pinned); + void* pointer = Unsafe.Add((void*)handle.AddrOfPinnedObject(), _index); + memoryHandle = new MemoryHandle(null, pointer, handle); + } + } + else + { + if (_index < 0) + { + ((OwnedMemory)_arrayOrOwnedMemory).Retain(); + memoryHandle = new MemoryHandle((OwnedMemory)_arrayOrOwnedMemory); + } + else + { + memoryHandle = new MemoryHandle(null); + } + } + return memoryHandle; + } + + /// + /// Get an array segment from the underlying memory. + /// If unable to get the array segment, return false with a default array segment. + /// +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif + public bool DangerousTryGetArray(out ArraySegment arraySegment) + { + if (_index < 0) + { + if (((OwnedMemory)_arrayOrOwnedMemory).TryGetArray(out var segment)) + { + arraySegment = new ArraySegment(segment.Array, segment.Offset + (_index & RemoveOwnedFlagBitMask), _length); + return true; + } + } + else + { + arraySegment = new ArraySegment((T[])_arrayOrOwnedMemory, _index, _length); + return true; + } + + arraySegment = default(ArraySegment); + return false; + } + + /// + /// Copies the contents from the memory into a new array. This heap + /// allocates, so should generally be avoided, however it is sometimes + /// necessary to bridge the gap with APIs written in terms of arrays. + /// + public T[] ToArray() => Span.ToArray(); + + /// + /// Determines whether the specified object is equal to the current object. + /// +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif + public override bool Equals(object obj) + { + if (obj is ReadOnlyMemory readOnlyMemory) + { + return Equals(readOnlyMemory); + } + else if (obj is Memory memory) + { + return Equals(memory); + } + else + { + return false; + } + } + + /// + /// Returns true if the memory points to the same array and has the same length. Note that + /// this does *not* check to see if the *contents* are equal. + /// + public bool Equals(ReadOnlyMemory other) + { + return + _arrayOrOwnedMemory == other._arrayOrOwnedMemory && + _index == other._index && + _length == other._length; + } + + /// + /// Serves as the default hash function. + /// +#if !MONO + [EditorBrowsable( EditorBrowsableState.Never)] +#endif + public override int GetHashCode() + { + return CombineHashCodes(_arrayOrOwnedMemory.GetHashCode(), (_index & RemoveOwnedFlagBitMask).GetHashCode(), _length.GetHashCode()); + } + + private static int CombineHashCodes(int left, int right) + { + return ((left << 5) + left) ^ right; + } + + private static int CombineHashCodes(int h1, int h2, int h3) + { + return CombineHashCodes(CombineHashCodes(h1, h2), h3); + } + + } +} diff --git a/external/corefx/src/System.Memory/src/System/ReadOnlySpan.cs b/external/corefx/src/System.Memory/src/System/ReadOnlySpan.cs index 7f8e0e745a..fdc51469b0 100644 --- a/external/corefx/src/System.Memory/src/System/ReadOnlySpan.cs +++ b/external/corefx/src/System.Memory/src/System/ReadOnlySpan.cs @@ -2,10 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if MONO +using System.Diagnostics.Private; +#endif using System.Diagnostics; using System.Runtime.CompilerServices; +#if !MONO using EditorBrowsableState = System.ComponentModel.EditorBrowsableState; using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute; +#endif #pragma warning disable 0809 //warning CS0809: Obsolete member 'Span.Equals(object)' overrides non-obsolete member 'object.Equals(object)' @@ -15,7 +20,9 @@ namespace System /// ReadOnlySpan represents a contiguous region of arbitrary memory. Unlike arrays, it can point to either managed /// or native memory, or to memory allocated on the stack. It is type- and memory-safe. /// - public struct ReadOnlySpan + [DebuggerTypeProxy(typeof(SpanDebugView<>))] + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public readonly ref struct ReadOnlySpan { /// /// Creates a new read-only span over the entirety of the target array. @@ -35,33 +42,6 @@ namespace System _byteOffset = SpanHelpers.PerTypeValues.ArrayAdjustment; } - /// - /// Creates a new read-only span over the portion of the target array beginning - /// at 'start' index and covering the remainder of the array. - /// - /// The target array. - /// The index at which to begin the read-only span. - /// Thrown when is a null - /// reference (Nothing in Visual Basic). - /// Thrown when is covariant and array's type is not exactly T[]. - /// - /// Thrown when the specified is not in the range (<0 or >=Length). - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ReadOnlySpan(T[] array, int start) - { - if (array == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); - - int arrayLength = array.Length; - if ((uint)start > (uint)arrayLength) - ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); - - _length = arrayLength - start; - _pinnable = Unsafe.As>(array); - _byteOffset = SpanHelpers.PerTypeValues.ArrayAdjustment.Add(start); - } - /// /// Creates a new read-only span over the portion of the target array beginning /// at 'start' index and ending at 'end' index (exclusive). @@ -125,6 +105,9 @@ namespace System /// A reference to data within that object. /// The number of elements the memory contains. [MethodImpl(MethodImplOptions.AggressiveInlining)] +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif public static ReadOnlySpan DangerousCreate(object obj, ref T objectData, int length) { Pinnable pinnable = Unsafe.As>(obj); @@ -143,6 +126,9 @@ namespace System _byteOffset = byteOffset; } + //Debugger Display = {T[length]} + private string DebuggerDisplay => string.Format("{{{0}[{1}]}}", typeof(T).Name, _length); + /// /// The number of items in the read-only span. /// @@ -241,7 +227,9 @@ namespace System /// /// [Obsolete("Equals() on Span will always throw an exception. Use == instead.")] +#if !MONO [EditorBrowsable(EditorBrowsableState.Never)] +#endif public override bool Equals(object obj) { throw new NotSupportedException(SR.CannotCallEqualsOnSpan); @@ -254,7 +242,9 @@ namespace System /// /// [Obsolete("GetHashCode() on Span will always throw an exception.")] +#if !MONO [EditorBrowsable(EditorBrowsableState.Never)] +#endif public override int GetHashCode() { throw new NotSupportedException(SR.CannotCallGetHashCodeOnSpan); @@ -331,6 +321,9 @@ namespace System /// would have been stored. Such a reference can be used for pinning but must never be dereferenced. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif public ref T DangerousGetPinnableReference() { if (_pinnable == null) diff --git a/external/corefx/src/System.Memory/src/System/Span.cs b/external/corefx/src/System.Memory/src/System/Span.cs index 8df86446b3..8f50d5b8df 100644 --- a/external/corefx/src/System.Memory/src/System/Span.cs +++ b/external/corefx/src/System.Memory/src/System/Span.cs @@ -3,9 +3,14 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; +#if MONO +using System.Diagnostics.Private; +#endif using System.Runtime.CompilerServices; +#if !MONO using EditorBrowsableState = System.ComponentModel.EditorBrowsableState; using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute; +#endif #pragma warning disable 0809 //warning CS0809: Obsolete member 'Span.Equals(object)' overrides non-obsolete member 'object.Equals(object)' @@ -16,8 +21,8 @@ namespace System /// or native memory, or to memory allocated on the stack. It is type- and memory-safe. /// [DebuggerTypeProxy(typeof(SpanDebugView<>))] - [DebuggerDisplay("Length = {Length}")] - public struct Span + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public readonly ref struct Span { /// /// Creates a new span over the entirety of the target array. @@ -39,35 +44,6 @@ namespace System _byteOffset = SpanHelpers.PerTypeValues.ArrayAdjustment; } - /// - /// Creates a new span over the portion of the target array beginning - /// at 'start' index and covering the remainder of the array. - /// - /// The target array. - /// The index at which to begin the span. - /// Thrown when is a null - /// reference (Nothing in Visual Basic). - /// Thrown when is covariant and array's type is not exactly T[]. - /// - /// Thrown when the specified is not in the range (<0 or >=Length). - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Span(T[] array, int start) - { - if (array == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); - if (default(T) == null && array.GetType() != typeof(T[])) - ThrowHelper.ThrowArrayTypeMismatchException_ArrayTypeMustBeExactMatch(typeof(T)); - - int arrayLength = array.Length; - if ((uint)start > (uint)arrayLength) - ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start); - - _length = arrayLength - start; - _pinnable = Unsafe.As>(array); - _byteOffset = SpanHelpers.PerTypeValues.ArrayAdjustment.Add(start); - } - /// /// Creates a new span over the portion of the target array beginning /// at 'start' index and ending at 'end' index (exclusive). @@ -133,6 +109,9 @@ namespace System /// A reference to data within that object. /// The number of elements the memory contains. [MethodImpl(MethodImplOptions.AggressiveInlining)] +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif public static Span DangerousCreate(object obj, ref T objectData, int length) { Pinnable pinnable = Unsafe.As>(obj); @@ -151,6 +130,9 @@ namespace System _byteOffset = byteOffset; } + //Debugger Display = {T[length]} + private string DebuggerDisplay => string.Format("{{{0}[{1}]}}", typeof(T).Name, _length); + /// /// The number of items in the span. /// @@ -351,7 +333,9 @@ namespace System /// /// [Obsolete("Equals() on Span will always throw an exception. Use == instead.")] +#if !MONO [EditorBrowsable(EditorBrowsableState.Never)] +#endif public override bool Equals(object obj) { throw new NotSupportedException(SR.CannotCallEqualsOnSpan); @@ -364,7 +348,9 @@ namespace System /// /// [Obsolete("GetHashCode() on Span will always throw an exception.")] +#if !MONO [EditorBrowsable(EditorBrowsableState.Never)] +#endif public override int GetHashCode() { throw new NotSupportedException(SR.CannotCallGetHashCodeOnSpan); @@ -446,6 +432,9 @@ namespace System /// would have been stored. Such a reference can be used for pinning but must never be dereferenced. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] +#if !MONO + [EditorBrowsable(EditorBrowsableState.Never)] +#endif public ref T DangerousGetPinnableReference() { if (_pinnable == null) diff --git a/external/corefx/src/System.Memory/src/System/SpanDebugView.cs b/external/corefx/src/System.Memory/src/System/SpanDebugView.cs index fdb7f79a32..2633028322 100644 --- a/external/corefx/src/System.Memory/src/System/SpanDebugView.cs +++ b/external/corefx/src/System.Memory/src/System/SpanDebugView.cs @@ -21,6 +21,13 @@ namespace System _length = collection.Length; } + public SpanDebugView(ReadOnlySpan collection) + { + _pinnable = (T[])(object)collection.Pinnable; + _byteOffset = collection.ByteOffset; + _length = collection.Length; + } + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public unsafe T[] Items { diff --git a/external/corefx/src/System.Memory/src/System/SpanExtensions.Fast.cs b/external/corefx/src/System.Memory/src/System/SpanExtensions.Fast.cs index 1795296373..364427b7a8 100644 --- a/external/corefx/src/System.Memory/src/System/SpanExtensions.Fast.cs +++ b/external/corefx/src/System.Memory/src/System/SpanExtensions.Fast.cs @@ -45,7 +45,7 @@ namespace System /// /// The target string. /// Thrown when is null. - public static ReadOnlySpan AsReadOnlySpan(this string text) => Span.AsSpan(text); + public static ReadOnlySpan AsReadOnlySpan(this string text) => Span.AsReadOnlySpan(text); /// /// Casts a Span of one primitive type to another primitive type . diff --git a/external/corefx/src/System.Memory/src/System/SpanHelpers.T.cs b/external/corefx/src/System.Memory/src/System/SpanHelpers.T.cs index 607d01be36..485f476580 100644 --- a/external/corefx/src/System.Memory/src/System/SpanHelpers.T.cs +++ b/external/corefx/src/System.Memory/src/System/SpanHelpers.T.cs @@ -4,6 +4,9 @@ using System.Diagnostics; using System.Runtime.CompilerServices; +#if MONO +using System.Diagnostics.Private; +#endif namespace System { @@ -101,7 +104,7 @@ namespace System } return -1; - Found: // Workaround for https://github.com/dotnet/coreclr/issues/9692 + Found: // Workaround for https://github.com/dotnet/coreclr/issues/13549 return (int)(byte*)index; Found1: return (int)(byte*)(index + 1); @@ -179,7 +182,7 @@ namespace System Equal: return true; - NotEqual: // Workaround for https://github.com/dotnet/coreclr/issues/9692 + NotEqual: // Workaround for https://github.com/dotnet/coreclr/issues/13549 return false; } } diff --git a/external/corefx/src/System.Memory/src/System/SpanHelpers.byte.cs b/external/corefx/src/System.Memory/src/System/SpanHelpers.byte.cs index 197709db79..798f49c444 100644 --- a/external/corefx/src/System.Memory/src/System/SpanHelpers.byte.cs +++ b/external/corefx/src/System.Memory/src/System/SpanHelpers.byte.cs @@ -5,10 +5,14 @@ using System.Diagnostics; using System.Runtime.CompilerServices; -#if !netstandard10 +#if !netstandard11 && !MONO using System.Numerics; #endif +#if MONO +using System.Diagnostics.Private; +#endif + namespace System { internal static partial class SpanHelpers @@ -75,7 +79,7 @@ namespace System uint uValue = value; // Use uint for comparisons to avoid unnecessary 8->32 extensions IntPtr index = (IntPtr)0; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations IntPtr nLength = (IntPtr)(uint)length; -#if !netstandard10 +#if !netstandard11 && !MONO if (Vector.IsHardwareAccelerated && length >= Vector.Count * 2) { unchecked @@ -135,13 +139,9 @@ namespace System index += 1; } -#if !netstandard10 - if (Vector.IsHardwareAccelerated) +#if !netstandard11 && !MONO + if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length)) { - if ((int)(byte*)index >= length) - { - goto NotFound; - } nLength = (IntPtr)(uint)((length - (uint)index) & ~(Vector.Count - 1)); // Get comparison Vector Vector vComparison = GetVector(value); @@ -153,17 +153,11 @@ namespace System index += Vector.Count; continue; } - // Found match, reuse Vector vComparison to keep register pressure low - vComparison = vMatches; - // goto rather than inline return to keep function smaller https://github.com/dotnet/coreclr/issues/9692 - goto VectorFound; + // Find offset of first match + return (int)(byte*)index + LocateFirstFoundByte(vMatches); } - if ((int)(byte*)index >= length) - { - goto NotFound; - } - else + if ((int)(byte*)index < length) { unchecked { @@ -171,14 +165,10 @@ namespace System } goto SequentialScan; } - VectorFound: - // Find offset of first match - return (int)(byte*)index + LocateFirstFoundByte(vComparison); } - NotFound: // Workaround for https://github.com/dotnet/coreclr/issues/9692 #endif return -1; - Found: // Workaround for https://github.com/dotnet/coreclr/issues/9692 + Found: // Workaround for https://github.com/dotnet/coreclr/issues/13549 return (int)(byte*)index; Found1: return (int)(byte*)(index + 1); @@ -204,7 +194,7 @@ namespace System uint uValue1 = value1; // Use uint for comparisons to avoid unnecessary 8->32 extensions IntPtr index = (IntPtr)0; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations IntPtr nLength = (IntPtr)(uint)length; -#if !netstandard10 +#if !netstandard11 && !MONO if (Vector.IsHardwareAccelerated && length >= Vector.Count * 2) { unchecked @@ -278,13 +268,9 @@ namespace System index += 1; } -#if !netstandard10 - if (Vector.IsHardwareAccelerated) +#if !netstandard11 && !MONO + if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length)) { - if ((int)(byte*)index >= length) - { - goto NotFound; - } nLength = (IntPtr)(uint)((length - (uint)index) & ~(Vector.Count - 1)); // Get comparison Vector Vector values0 = GetVector(value0); @@ -301,17 +287,11 @@ namespace System index += Vector.Count; continue; } - // Found match, reuse Vector vComparison to keep register pressure low - values0 = vMatches; - // goto rather than inline return to keep function smaller https://github.com/dotnet/coreclr/issues/9692 - goto VectorFound; + // Find offset of first match + return (int)(byte*)index + LocateFirstFoundByte(vMatches); } - if ((int)(byte*)index >= length) - { - goto NotFound; - } - else + if ((int)(byte*)index < length) { unchecked { @@ -319,14 +299,10 @@ namespace System } goto SequentialScan; } - VectorFound: - // Find offset of first match - return (int)(byte*)index + LocateFirstFoundByte(values0); } - NotFound: // Workaround for https://github.com/dotnet/coreclr/issues/9692 #endif return -1; - Found: // Workaround for https://github.com/dotnet/coreclr/issues/9692 + Found: // Workaround for https://github.com/dotnet/coreclr/issues/13549 return (int)(byte*)index; Found1: return (int)(byte*)(index + 1); @@ -353,7 +329,7 @@ namespace System uint uValue2 = value2; // Use uint for comparisons to avoid unnecessary 8->32 extensions IntPtr index = (IntPtr)0; // Use UIntPtr for arithmetic to avoid unnecessary 64->32->64 truncations IntPtr nLength = (IntPtr)(uint)length; -#if !netstandard10 +#if !netstandard11 && !MONO if (Vector.IsHardwareAccelerated && length >= Vector.Count * 2) { unchecked @@ -427,13 +403,9 @@ namespace System index += 1; } -#if !netstandard10 - if (Vector.IsHardwareAccelerated) +#if !netstandard11 && !MONO + if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length)) { - if ((int)(byte*)index >= length) - { - goto NotFound; - } nLength = (IntPtr)(uint)((length - (uint)index) & ~(Vector.Count - 1)); // Get comparison Vector Vector values0 = GetVector(value0); @@ -454,17 +426,11 @@ namespace System index += Vector.Count; continue; } - // Found match, reuse Vector vComparison to keep register pressure low - values0 = vMatches; - // goto rather than inline return to keep function smaller https://github.com/dotnet/coreclr/issues/9692 - goto VectorFound; + // Find offset of first match + return (int)(byte*)index + LocateFirstFoundByte(vMatches); } - if ((int)(byte*)index >= length) - { - goto NotFound; - } - else + if ((int)(byte*)index < length) { unchecked { @@ -472,14 +438,10 @@ namespace System } goto SequentialScan; } - VectorFound: - // Find offset of first match - return (int)(byte*)index + LocateFirstFoundByte(values0); } - NotFound: // Workaround for https://github.com/dotnet/coreclr/issues/9692 #endif return -1; - Found: // Workaround for https://github.com/dotnet/coreclr/issues/9692 + Found: // Workaround for https://github.com/dotnet/coreclr/issues/13549 return (int)(byte*)index; Found1: return (int)(byte*)(index + 1); @@ -507,7 +469,7 @@ namespace System IntPtr i = (IntPtr)0; // Use IntPtr and byte* for arithmetic to avoid unnecessary 64->32->64 truncations IntPtr n = (IntPtr)length; -#if !netstandard10 +#if !netstandard11 && !MONO if (Vector.IsHardwareAccelerated && (byte*)n >= (byte*)Vector.Count) { n -= Vector.Count; @@ -551,11 +513,11 @@ namespace System Equal: return true; - NotEqual: // Workaround for https://github.com/dotnet/coreclr/issues/9692 + NotEqual: // Workaround for https://github.com/dotnet/coreclr/issues/13549 return false; } -#if !netstandard10 +#if !netstandard11 && !MONO // Vector sub-search adapted from https://github.com/aspnet/KestrelHttpServer/pull/1138 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int LocateFirstFoundByte(Vector match) @@ -578,7 +540,7 @@ namespace System } #endif -#if !netstandard10 +#if !netstandard11 && !MONO [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int LocateFirstFoundByte(ulong match) { @@ -587,12 +549,12 @@ namespace System // Flag least significant power of two bit var powerOfTwoFlag = match ^ (match - 1); // Shift all powers of two into the high byte and extract - return (int)((powerOfTwoFlag * xorPowerOfTwoToHighByte) >> 57); + return (int)((powerOfTwoFlag * XorPowerOfTwoToHighByte) >> 57); } } #endif -#if !netstandard10 +#if !netstandard11 && !MONO [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Vector GetVector(byte vectorByte) { @@ -607,9 +569,9 @@ namespace System } #endif -#if !netstandard10 - private const ulong xorPowerOfTwoToHighByte = (0x07ul | - 0x06ul << 8 | +#if !netstandard11 && !MONO + private const ulong XorPowerOfTwoToHighByte = (0x07ul | + 0x06ul << 8 | 0x05ul << 16 | 0x04ul << 24 | 0x03ul << 32 | diff --git a/external/corefx/src/System.Memory/src/System/SpanHelpers.cs b/external/corefx/src/System.Memory/src/System/SpanHelpers.cs index 0e80ebb0f7..69014b56a5 100644 --- a/external/corefx/src/System.Memory/src/System/SpanHelpers.cs +++ b/external/corefx/src/System.Memory/src/System/SpanHelpers.cs @@ -3,7 +3,9 @@ // See the LICENSE file in the project root for more information. using System.Reflection; -using System.Diagnostics; +#if MONO +using System.Diagnostics.Private; +#endif using System.Runtime.InteropServices; using System.Runtime.CompilerServices; diff --git a/external/corefx/src/System.Memory/src/System/ThrowHelper.cs b/external/corefx/src/System.Memory/src/System/ThrowHelper.cs index d09882926a..4adc35bdda 100644 --- a/external/corefx/src/System.Memory/src/System/ThrowHelper.cs +++ b/external/corefx/src/System.Memory/src/System/ThrowHelper.cs @@ -21,7 +21,7 @@ namespace System // factory methods - still maintaining advantages 1 & 2 // - internal static class ThrowHelper + internal static partial class ThrowHelper { internal static void ThrowArgumentNullException(ExceptionArgument argument) { throw CreateArgumentNullException(argument); } [MethodImpl(MethodImplOptions.NoInlining)] @@ -46,8 +46,16 @@ namespace System internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument) { throw CreateArgumentOutOfRangeException(argument); } [MethodImpl(MethodImplOptions.NoInlining)] private static Exception CreateArgumentOutOfRangeException(ExceptionArgument argument) { return new ArgumentOutOfRangeException(argument.ToString()); } - } + internal static void ThrowInvalidOperationException_OutstandingReferences() { throw CreateInvalidOperationException_OutstandingReferences(); } + [MethodImpl(MethodImplOptions.NoInlining)] + private static Exception CreateInvalidOperationException_OutstandingReferences() { return new InvalidOperationException(SR.OutstandingReferences); } + + internal static void ThrowObjectDisposedException_MemoryDisposed(string objectName) { throw CreateObjectDisposedException_MemoryDisposed(objectName); } + [MethodImpl(MethodImplOptions.NoInlining)] + private static Exception CreateObjectDisposedException_MemoryDisposed(string objectName) { return new ObjectDisposedException(objectName, SR.MemoryDisposed); } + } +#if !MONO internal enum ExceptionArgument { array, @@ -55,5 +63,8 @@ namespace System start, text, obj, + ownedMemory, + pointer } +#endif } diff --git a/external/corefx/src/System.Memory/tests/Binary/BinaryReaderUnitTests.cs b/external/corefx/src/System.Memory/tests/Binary/BinaryReaderUnitTests.cs new file mode 100644 index 0000000000..5b776244de --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Binary/BinaryReaderUnitTests.cs @@ -0,0 +1,483 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Xunit; + +using static System.Buffers.Binary.BinaryPrimitives; +using static System.TestHelpers; + +namespace System.Buffers.Binary.Tests +{ + public class BinaryReaderUnitTests + { + [Fact] + public void SpanRead() + { + Assert.True(BitConverter.IsLittleEndian); + + ulong value = 0x8877665544332211; // [11 22 33 44 55 66 77 88] + Span span; + unsafe { + span = new Span(&value, 8); + } + + Assert.Equal(0x11, ReadMachineEndian(span)); + Assert.True(TryReadMachineEndian(span, out byte byteValue)); + Assert.Equal(0x11, byteValue); + + Assert.Equal(0x11, ReadMachineEndian(span)); + Assert.True(TryReadMachineEndian(span, out byte sbyteValue)); + Assert.Equal(0x11, byteValue); + + Assert.Equal(0x1122, ReadUInt16BigEndian(span)); + Assert.True(TryReadUInt16BigEndian(span, out ushort ushortValue)); + Assert.Equal(0x1122, ushortValue); + + Assert.Equal(0x2211, ReadUInt16LittleEndian(span)); + Assert.True(TryReadUInt16LittleEndian(span, out ushortValue)); + Assert.Equal(0x2211, ushortValue); + + Assert.Equal(0x1122, ReadInt16BigEndian(span)); + Assert.True(TryReadInt16BigEndian(span, out short shortValue)); + Assert.Equal(0x1122, shortValue); + + Assert.Equal(0x2211, ReadInt16LittleEndian(span)); + Assert.True(TryReadInt16LittleEndian(span, out shortValue)); + Assert.Equal(0x2211, ushortValue); + + Assert.Equal(0x11223344, ReadUInt32BigEndian(span)); + Assert.True(TryReadUInt32BigEndian(span, out uint uintValue)); + Assert.Equal(0x11223344, uintValue); + + Assert.Equal(0x44332211, ReadUInt32LittleEndian(span)); + Assert.True(TryReadUInt32LittleEndian(span, out uintValue)); + Assert.Equal(0x44332211, uintValue); + + Assert.Equal(0x11223344, ReadInt32BigEndian(span)); + Assert.True(TryReadInt32BigEndian(span, out int intValue)); + Assert.Equal(0x11223344, intValue); + + Assert.Equal(0x44332211, ReadInt32LittleEndian(span)); + Assert.True(TryReadInt32LittleEndian(span, out intValue)); + Assert.Equal(0x44332211, intValue); + + Assert.Equal(0x1122334455667788, ReadUInt64BigEndian(span)); + Assert.True(TryReadUInt64BigEndian(span, out ulong ulongValue)); + Assert.Equal(0x1122334455667788, ulongValue); + + Assert.Equal(0x8877665544332211, ReadUInt64LittleEndian(span)); + Assert.True(TryReadUInt64LittleEndian(span, out ulongValue)); + Assert.Equal(0x8877665544332211, ulongValue); + + Assert.Equal(0x1122334455667788, ReadInt64BigEndian(span)); + Assert.True(TryReadInt64BigEndian(span, out long longValue)); + Assert.Equal(0x1122334455667788, longValue); + + Assert.Equal(unchecked((long)0x8877665544332211), ReadInt64LittleEndian(span)); + Assert.True(TryReadInt64LittleEndian(span, out longValue)); + Assert.Equal(unchecked((long)0x8877665544332211), longValue); + } + + [Fact] + public void ReadOnlySpanRead() + { + Assert.True(BitConverter.IsLittleEndian); + + ulong value = 0x8877665544332211; // [11 22 33 44 55 66 77 88] + ReadOnlySpan span; + unsafe { + span = new ReadOnlySpan(&value, 8); + } + + Assert.Equal(0x11, ReadMachineEndian(span)); + Assert.True(TryReadMachineEndian(span, out byte byteValue)); + Assert.Equal(0x11, byteValue); + + Assert.Equal(0x11, ReadMachineEndian(span)); + Assert.True(TryReadMachineEndian(span, out byte sbyteValue)); + Assert.Equal(0x11, byteValue); + + Assert.Equal(0x1122, ReadUInt16BigEndian(span)); + Assert.True(TryReadUInt16BigEndian(span, out ushort ushortValue)); + Assert.Equal(0x1122, ushortValue); + + Assert.Equal(0x2211, ReadUInt16LittleEndian(span)); + Assert.True(TryReadUInt16LittleEndian(span, out ushortValue)); + Assert.Equal(0x2211, ushortValue); + + Assert.Equal(0x1122, ReadInt16BigEndian(span)); + Assert.True(TryReadInt16BigEndian(span, out short shortValue)); + Assert.Equal(0x1122, shortValue); + + Assert.Equal(0x2211, ReadInt16LittleEndian(span)); + Assert.True(TryReadInt16LittleEndian(span, out shortValue)); + Assert.Equal(0x2211, ushortValue); + + Assert.Equal(0x11223344, ReadUInt32BigEndian(span)); + Assert.True(TryReadUInt32BigEndian(span, out uint uintValue)); + Assert.Equal(0x11223344, uintValue); + + Assert.Equal(0x44332211, ReadUInt32LittleEndian(span)); + Assert.True(TryReadUInt32LittleEndian(span, out uintValue)); + Assert.Equal(0x44332211, uintValue); + + Assert.Equal(0x11223344, ReadInt32BigEndian(span)); + Assert.True(TryReadInt32BigEndian(span, out int intValue)); + Assert.Equal(0x11223344, intValue); + + Assert.Equal(0x44332211, ReadInt32LittleEndian(span)); + Assert.True(TryReadInt32LittleEndian(span, out intValue)); + Assert.Equal(0x44332211, intValue); + + Assert.Equal(0x1122334455667788, ReadUInt64BigEndian(span)); + Assert.True(TryReadUInt64BigEndian(span, out ulong ulongValue)); + Assert.Equal(0x1122334455667788, ulongValue); + + Assert.Equal(0x8877665544332211, ReadUInt64LittleEndian(span)); + Assert.True(TryReadUInt64LittleEndian(span, out ulongValue)); + Assert.Equal(0x8877665544332211, ulongValue); + + Assert.Equal(0x1122334455667788, ReadInt64BigEndian(span)); + Assert.True(TryReadInt64BigEndian(span, out long longValue)); + Assert.Equal(0x1122334455667788, longValue); + + Assert.Equal(unchecked((long)0x8877665544332211), ReadInt64LittleEndian(span)); + Assert.True(TryReadInt64LittleEndian(span, out longValue)); + Assert.Equal(unchecked((long)0x8877665544332211), longValue); + } + + [Fact] + public void SpanReadFail() + { + Span span = new byte[] { 1 }; + + Assert.Equal(1, ReadMachineEndian(span)); + Assert.True(TryReadMachineEndian(span, out byte byteValue)); + Assert.Equal(1, byteValue); + + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out short shortValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out int intValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out long longValue)); + + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out ushort ushortValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out uint uintValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out ulong ulongValue)); + + Span largeSpan = new byte[100]; + TestHelpers.AssertThrows(largeSpan, (_span) => ReadMachineEndian(_span)); + TestHelpers.AssertThrows(largeSpan, (_span) => TryReadMachineEndian(_span, out TestHelpers.TestValueTypeWithReference stringValue)); + } + + [Fact] + public void ReadOnlySpanReadFail() + { + ReadOnlySpan span = new byte[] { 1 }; + + Assert.Equal(1, ReadMachineEndian(span)); + Assert.True(TryReadMachineEndian(span, out byte byteValue)); + Assert.Equal(1, byteValue); + + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out short shortValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out int intValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out long longValue)); + + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out ushort ushortValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out uint uintValue)); + TestHelpers.AssertThrows(span, (_span) => ReadMachineEndian(_span)); + Assert.False(TryReadMachineEndian(span, out ulong ulongValue)); + + ReadOnlySpan largeSpan = new byte[100]; + TestHelpers.AssertThrows(largeSpan, (_span) => ReadMachineEndian(_span)); + TestHelpers.AssertThrows(largeSpan, (_span) => TryReadMachineEndian(_span, out TestHelpers.TestValueTypeWithReference stringValue)); + } + + [Fact] + public void ReverseByteDoesNothing() + { + byte valueMax = byte.MaxValue; + byte valueMin = byte.MinValue; + sbyte signedValueMax = sbyte.MaxValue; + sbyte signedValueMin = sbyte.MinValue; + + Assert.Equal(valueMax, ReverseEndianness(valueMax)); + Assert.Equal(valueMin, ReverseEndianness(valueMin)); + Assert.Equal(signedValueMax, ReverseEndianness(signedValueMax)); + Assert.Equal(signedValueMin, ReverseEndianness(signedValueMin)); + } + + [Fact] + public void SpanWriteAndReadBigEndianHeterogeneousStruct() + { + Assert.True(BitConverter.IsLittleEndian); + + Span spanBE = new byte[Unsafe.SizeOf()]; + + WriteInt16BigEndian(spanBE, testStruct.S0); + WriteInt32BigEndian(spanBE.Slice(2), testStruct.I0); + WriteInt64BigEndian(spanBE.Slice(6), testStruct.L0); + WriteUInt16BigEndian(spanBE.Slice(14), testStruct.US0); + WriteUInt32BigEndian(spanBE.Slice(16), testStruct.UI0); + WriteUInt64BigEndian(spanBE.Slice(20), testStruct.UL0); + WriteInt16BigEndian(spanBE.Slice(28), testStruct.S1); + WriteInt32BigEndian(spanBE.Slice(30), testStruct.I1); + WriteInt64BigEndian(spanBE.Slice(34), testStruct.L1); + WriteUInt16BigEndian(spanBE.Slice(42), testStruct.US1); + WriteUInt32BigEndian(spanBE.Slice(44), testStruct.UI1); + WriteUInt64BigEndian(spanBE.Slice(48), testStruct.UL1); + + ReadOnlySpan readOnlySpanBE = new ReadOnlySpan(spanBE.ToArray()); + + var readStruct = new TestStruct + { + S0 = ReadInt16BigEndian(spanBE), + I0 = ReadInt32BigEndian(spanBE.Slice(2)), + L0 = ReadInt64BigEndian(spanBE.Slice(6)), + US0 = ReadUInt16BigEndian(spanBE.Slice(14)), + UI0 = ReadUInt32BigEndian(spanBE.Slice(16)), + UL0 = ReadUInt64BigEndian(spanBE.Slice(20)), + S1 = ReadInt16BigEndian(spanBE.Slice(28)), + I1 = ReadInt32BigEndian(spanBE.Slice(30)), + L1 = ReadInt64BigEndian(spanBE.Slice(34)), + US1 = ReadUInt16BigEndian(spanBE.Slice(42)), + UI1 = ReadUInt32BigEndian(spanBE.Slice(44)), + UL1 = ReadUInt64BigEndian(spanBE.Slice(48)) + }; + + var readStructFromReadOnlySpan = new TestStruct + { + S0 = ReadInt16BigEndian(readOnlySpanBE), + I0 = ReadInt32BigEndian(readOnlySpanBE.Slice(2)), + L0 = ReadInt64BigEndian(readOnlySpanBE.Slice(6)), + US0 = ReadUInt16BigEndian(readOnlySpanBE.Slice(14)), + UI0 = ReadUInt32BigEndian(readOnlySpanBE.Slice(16)), + UL0 = ReadUInt64BigEndian(readOnlySpanBE.Slice(20)), + S1 = ReadInt16BigEndian(readOnlySpanBE.Slice(28)), + I1 = ReadInt32BigEndian(readOnlySpanBE.Slice(30)), + L1 = ReadInt64BigEndian(readOnlySpanBE.Slice(34)), + US1 = ReadUInt16BigEndian(readOnlySpanBE.Slice(42)), + UI1 = ReadUInt32BigEndian(readOnlySpanBE.Slice(44)), + UL1 = ReadUInt64BigEndian(readOnlySpanBE.Slice(48)) + }; + + Assert.Equal(testStruct, readStruct); + Assert.Equal(testStruct, readStructFromReadOnlySpan); + } + + [Fact] + public void SpanWriteAndReadLittleEndianHeterogeneousStruct() + { + Assert.True(BitConverter.IsLittleEndian); + + Span spanLE = new byte[Unsafe.SizeOf()]; + + WriteInt16LittleEndian(spanLE, testStruct.S0); + WriteInt32LittleEndian(spanLE.Slice(2), testStruct.I0); + WriteInt64LittleEndian(spanLE.Slice(6), testStruct.L0); + WriteUInt16LittleEndian(spanLE.Slice(14), testStruct.US0); + WriteUInt32LittleEndian(spanLE.Slice(16), testStruct.UI0); + WriteUInt64LittleEndian(spanLE.Slice(20), testStruct.UL0); + WriteInt16LittleEndian(spanLE.Slice(28), testStruct.S1); + WriteInt32LittleEndian(spanLE.Slice(30), testStruct.I1); + WriteInt64LittleEndian(spanLE.Slice(34), testStruct.L1); + WriteUInt16LittleEndian(spanLE.Slice(42), testStruct.US1); + WriteUInt32LittleEndian(spanLE.Slice(44), testStruct.UI1); + WriteUInt64LittleEndian(spanLE.Slice(48), testStruct.UL1); + + ReadOnlySpan readOnlySpanLE = new ReadOnlySpan(spanLE.ToArray()); + + var readStruct = new TestStruct + { + S0 = ReadInt16LittleEndian(spanLE), + I0 = ReadInt32LittleEndian(spanLE.Slice(2)), + L0 = ReadInt64LittleEndian(spanLE.Slice(6)), + US0 = ReadUInt16LittleEndian(spanLE.Slice(14)), + UI0 = ReadUInt32LittleEndian(spanLE.Slice(16)), + UL0 = ReadUInt64LittleEndian(spanLE.Slice(20)), + S1 = ReadInt16LittleEndian(spanLE.Slice(28)), + I1 = ReadInt32LittleEndian(spanLE.Slice(30)), + L1 = ReadInt64LittleEndian(spanLE.Slice(34)), + US1 = ReadUInt16LittleEndian(spanLE.Slice(42)), + UI1 = ReadUInt32LittleEndian(spanLE.Slice(44)), + UL1 = ReadUInt64LittleEndian(spanLE.Slice(48)) + }; + + var readStructFromReadOnlySpan = new TestStruct + { + S0 = ReadInt16LittleEndian(readOnlySpanLE), + I0 = ReadInt32LittleEndian(readOnlySpanLE.Slice(2)), + L0 = ReadInt64LittleEndian(readOnlySpanLE.Slice(6)), + US0 = ReadUInt16LittleEndian(readOnlySpanLE.Slice(14)), + UI0 = ReadUInt32LittleEndian(readOnlySpanLE.Slice(16)), + UL0 = ReadUInt64LittleEndian(readOnlySpanLE.Slice(20)), + S1 = ReadInt16LittleEndian(readOnlySpanLE.Slice(28)), + I1 = ReadInt32LittleEndian(readOnlySpanLE.Slice(30)), + L1 = ReadInt64LittleEndian(readOnlySpanLE.Slice(34)), + US1 = ReadUInt16LittleEndian(readOnlySpanLE.Slice(42)), + UI1 = ReadUInt32LittleEndian(readOnlySpanLE.Slice(44)), + UL1 = ReadUInt64LittleEndian(readOnlySpanLE.Slice(48)) + }; + + Assert.Equal(testStruct, readStruct); + Assert.Equal(testStruct, readStructFromReadOnlySpan); + } + + [Fact] + public void ReadingStructFieldByFieldOrReadAndReverseEndianness() + { + Assert.True(BitConverter.IsLittleEndian); + Span spanBE = new byte[Unsafe.SizeOf()]; + + var testExplicitStruct = new TestHelpers.TestStructExplicit + { + S0 = short.MaxValue, + I0 = int.MaxValue, + L0 = long.MaxValue, + US0 = ushort.MaxValue, + UI0 = uint.MaxValue, + UL0 = ulong.MaxValue, + S1 = short.MinValue, + I1 = int.MinValue, + L1 = long.MinValue, + US1 = ushort.MinValue, + UI1 = uint.MinValue, + UL1 = ulong.MinValue + }; + + WriteInt16BigEndian(spanBE, testExplicitStruct.S0); + WriteInt32BigEndian(spanBE.Slice(2), testExplicitStruct.I0); + WriteInt64BigEndian(spanBE.Slice(6), testExplicitStruct.L0); + WriteUInt16BigEndian(spanBE.Slice(14), testExplicitStruct.US0); + WriteUInt32BigEndian(spanBE.Slice(16), testExplicitStruct.UI0); + WriteUInt64BigEndian(spanBE.Slice(20), testExplicitStruct.UL0); + WriteInt16BigEndian(spanBE.Slice(28), testExplicitStruct.S1); + WriteInt32BigEndian(spanBE.Slice(30), testExplicitStruct.I1); + WriteInt64BigEndian(spanBE.Slice(34), testExplicitStruct.L1); + WriteUInt16BigEndian(spanBE.Slice(42), testExplicitStruct.US1); + WriteUInt32BigEndian(spanBE.Slice(44), testExplicitStruct.UI1); + WriteUInt64BigEndian(spanBE.Slice(48), testExplicitStruct.UL1); + + Assert.Equal(56, spanBE.Length); + + ReadOnlySpan readOnlySpanBE = new ReadOnlySpan(spanBE.ToArray()); + + var readStructAndReverse = ReadMachineEndian(spanBE); + if (BitConverter.IsLittleEndian) + { + readStructAndReverse.S0 = ReverseEndianness(readStructAndReverse.S0); + readStructAndReverse.I0 = ReverseEndianness(readStructAndReverse.I0); + readStructAndReverse.L0 = ReverseEndianness(readStructAndReverse.L0); + readStructAndReverse.US0 = ReverseEndianness(readStructAndReverse.US0); + readStructAndReverse.UI0 = ReverseEndianness(readStructAndReverse.UI0); + readStructAndReverse.UL0 = ReverseEndianness(readStructAndReverse.UL0); + readStructAndReverse.S1 = ReverseEndianness(readStructAndReverse.S1); + readStructAndReverse.I1 = ReverseEndianness(readStructAndReverse.I1); + readStructAndReverse.L1 = ReverseEndianness(readStructAndReverse.L1); + readStructAndReverse.US1 = ReverseEndianness(readStructAndReverse.US1); + readStructAndReverse.UI1 = ReverseEndianness(readStructAndReverse.UI1); + readStructAndReverse.UL1 = ReverseEndianness(readStructAndReverse.UL1); + } + + var readStructFieldByField = new TestHelpers.TestStructExplicit + { + S0 = ReadInt16BigEndian(spanBE), + I0 = ReadInt32BigEndian(spanBE.Slice(2)), + L0 = ReadInt64BigEndian(spanBE.Slice(6)), + US0 = ReadUInt16BigEndian(spanBE.Slice(14)), + UI0 = ReadUInt32BigEndian(spanBE.Slice(16)), + UL0 = ReadUInt64BigEndian(spanBE.Slice(20)), + S1 = ReadInt16BigEndian(spanBE.Slice(28)), + I1 = ReadInt32BigEndian(spanBE.Slice(30)), + L1 = ReadInt64BigEndian(spanBE.Slice(34)), + US1 = ReadUInt16BigEndian(spanBE.Slice(42)), + UI1 = ReadUInt32BigEndian(spanBE.Slice(44)), + UL1 = ReadUInt64BigEndian(spanBE.Slice(48)) + }; + + var readStructAndReverseFromReadOnlySpan = ReadMachineEndian(readOnlySpanBE); + if (BitConverter.IsLittleEndian) + { + readStructAndReverseFromReadOnlySpan.S0 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.S0); + readStructAndReverseFromReadOnlySpan.I0 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.I0); + readStructAndReverseFromReadOnlySpan.L0 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.L0); + readStructAndReverseFromReadOnlySpan.US0 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.US0); + readStructAndReverseFromReadOnlySpan.UI0 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.UI0); + readStructAndReverseFromReadOnlySpan.UL0 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.UL0); + readStructAndReverseFromReadOnlySpan.S1 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.S1); + readStructAndReverseFromReadOnlySpan.I1 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.I1); + readStructAndReverseFromReadOnlySpan.L1 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.L1); + readStructAndReverseFromReadOnlySpan.US1 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.US1); + readStructAndReverseFromReadOnlySpan.UI1 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.UI1); + readStructAndReverseFromReadOnlySpan.UL1 = ReverseEndianness(readStructAndReverseFromReadOnlySpan.UL1); + } + + var readStructFieldByFieldFromReadOnlySpan = new TestHelpers.TestStructExplicit + { + S0 = ReadInt16BigEndian(readOnlySpanBE), + I0 = ReadInt32BigEndian(readOnlySpanBE.Slice(2)), + L0 = ReadInt64BigEndian(readOnlySpanBE.Slice(6)), + US0 = ReadUInt16BigEndian(readOnlySpanBE.Slice(14)), + UI0 = ReadUInt32BigEndian(readOnlySpanBE.Slice(16)), + UL0 = ReadUInt64BigEndian(readOnlySpanBE.Slice(20)), + S1 = ReadInt16BigEndian(readOnlySpanBE.Slice(28)), + I1 = ReadInt32BigEndian(readOnlySpanBE.Slice(30)), + L1 = ReadInt64BigEndian(readOnlySpanBE.Slice(34)), + US1 = ReadUInt16BigEndian(readOnlySpanBE.Slice(42)), + UI1 = ReadUInt32BigEndian(readOnlySpanBE.Slice(44)), + UL1 = ReadUInt64BigEndian(readOnlySpanBE.Slice(48)) + }; + + Assert.Equal(testExplicitStruct, readStructAndReverse); + Assert.Equal(testExplicitStruct, readStructFieldByField); + + Assert.Equal(testExplicitStruct, readStructAndReverseFromReadOnlySpan); + Assert.Equal(testExplicitStruct, readStructFieldByFieldFromReadOnlySpan); + } + + private static TestStruct testStruct = new TestStruct + { + S0 = short.MaxValue, + I0 = int.MaxValue, + L0 = long.MaxValue, + US0 = ushort.MaxValue, + UI0 = uint.MaxValue, + UL0 = ulong.MaxValue, + S1 = short.MinValue, + I1 = int.MinValue, + L1 = long.MinValue, + US1 = ushort.MinValue, + UI1 = uint.MinValue, + UL1 = ulong.MinValue + }; + + [StructLayout(LayoutKind.Sequential)] + private struct TestStruct + { + public short S0; + public int I0; + public long L0; + public ushort US0; + public uint UI0; + public ulong UL0; + public short S1; + public int I1; + public long L1; + public ushort US1; + public uint UI1; + public ulong UL1; + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Binary/BinaryWriterUnitTests.cs b/external/corefx/src/System.Memory/tests/Binary/BinaryWriterUnitTests.cs new file mode 100644 index 0000000000..7b2c8a06c2 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Binary/BinaryWriterUnitTests.cs @@ -0,0 +1,313 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Xunit; + +using static System.Buffers.Binary.BinaryPrimitives; +using static System.TestHelpers; + +namespace System.Buffers.Binary.Tests +{ + public class BinaryWriterUnitTests + { + [Fact] + public void SpanWrite() + { + Assert.True(BitConverter.IsLittleEndian); + + Span span = new byte[8]; + + byte byteValue = 0x11; + WriteMachineEndian(span, ref byteValue); + TestHelpers.Validate(span, byteValue); + Assert.True(TryWriteMachineEndian(span, ref byteValue)); + TestHelpers.Validate(span, byteValue); + + sbyte sbyteValue = 0x11; + WriteMachineEndian(span, ref sbyteValue); + TestHelpers.Validate(span, sbyteValue); + Assert.True(TryWriteMachineEndian(span, ref sbyteValue)); + TestHelpers.Validate(span, sbyteValue); + + ushort ushortValue = 0x1122; + WriteMachineEndian(span, ref ushortValue); + TestHelpers.Validate(span, ushortValue); + Assert.True(TryWriteMachineEndian(span, ref ushortValue)); + TestHelpers.Validate(span, ushortValue); + + uint uintValue = 0x11223344; + WriteMachineEndian(span, ref uintValue); + TestHelpers.Validate(span, uintValue); + Assert.True(TryWriteMachineEndian(span, ref uintValue)); + TestHelpers.Validate(span, uintValue); + + ulong ulongValue = 0x1122334455667788; + WriteMachineEndian(span, ref ulongValue); + TestHelpers.Validate(span, ulongValue); + Assert.True(TryWriteMachineEndian(span, ref ulongValue)); + TestHelpers.Validate(span, ulongValue); + + short shortValue = 0x1122; + WriteMachineEndian(span, ref shortValue); + TestHelpers.Validate(span, shortValue); + Assert.True(TryWriteMachineEndian(span, ref shortValue)); + TestHelpers.Validate(span, shortValue); + + int intValue = 0x11223344; + WriteMachineEndian(span, ref intValue); + TestHelpers.Validate(span, intValue); + Assert.True(TryWriteMachineEndian(span, ref intValue)); + TestHelpers.Validate(span, intValue); + + long longValue = 0x1122334455667788; + WriteMachineEndian(span, ref longValue); + TestHelpers.Validate(span, longValue); + Assert.True(TryWriteMachineEndian(span, ref longValue)); + TestHelpers.Validate(span, longValue); + } + + [Theory] + [InlineData(short.MaxValue)] + [InlineData(short.MinValue)] + [InlineData(0x7F00)] + [InlineData(0x00FF)] + public void SpanWriteInt16(short value) + { + Assert.True(BitConverter.IsLittleEndian); + var span = new Span(new byte[2]); + WriteInt16BigEndian(span, value); + short read = ReadInt16BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteInt16BigEndian(span, value)); + read = ReadInt16BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + WriteInt16LittleEndian(span, value); + read = ReadInt16LittleEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteInt16LittleEndian(span, value)); + read = ReadInt16LittleEndian(span); + Assert.Equal(value, read); + } + + [Theory] + [InlineData(ushort.MaxValue)] + [InlineData(ushort.MinValue)] + [InlineData(0xFF00)] + [InlineData(0x00FF)] + public void SpanWriteUInt16(ushort value) + { + Assert.True(BitConverter.IsLittleEndian); + var span = new Span(new byte[2]); + WriteUInt16BigEndian(span, value); + ushort read = ReadUInt16BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteUInt16BigEndian(span, value)); + read = ReadUInt16BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + WriteUInt16LittleEndian(span, value); + read = ReadUInt16LittleEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteUInt16LittleEndian(span, value)); + read = ReadUInt16LittleEndian(span); + Assert.Equal(value, read); + } + + [Theory] + [InlineData(int.MaxValue)] + [InlineData(int.MinValue)] + [InlineData(0x7F000000)] + [InlineData(0x00FF0000)] + [InlineData(0x0000FF00)] + [InlineData(0x000000FF)] + public void SpanWriteInt32(int value) + { + Assert.True(BitConverter.IsLittleEndian); + var span = new Span(new byte[4]); + WriteInt32BigEndian(span, value); + int read = ReadInt32BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteInt32BigEndian(span, value)); + read = ReadInt32BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + WriteInt32LittleEndian(span, value); + read = ReadInt32LittleEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteInt32LittleEndian(span, value)); + read = ReadInt32LittleEndian(span); + Assert.Equal(value, read); + } + + [Theory] + [InlineData(uint.MaxValue)] + [InlineData(uint.MinValue)] + [InlineData(0xFF000000)] + [InlineData(0x00FF0000)] + [InlineData(0x0000FF00)] + [InlineData(0x000000FF)] + public void SpanWriteUInt32(uint value) + { + Assert.True(BitConverter.IsLittleEndian); + var span = new Span(new byte[4]); + WriteUInt32BigEndian(span, value); + uint read = ReadUInt32BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteUInt32BigEndian(span, value)); + read = ReadUInt32BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + WriteUInt32LittleEndian(span, value); + read = ReadUInt32LittleEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteUInt32LittleEndian(span, value)); + read = ReadUInt32LittleEndian(span); + Assert.Equal(value, read); + } + + [Theory] + [InlineData(long.MaxValue)] + [InlineData(long.MinValue)] + [InlineData(0x7F00000000000000)] + [InlineData(0x00FF000000000000)] + [InlineData(0x0000FF0000000000)] + [InlineData(0x000000FF00000000)] + [InlineData(0x00000000FF000000)] + [InlineData(0x0000000000FF0000)] + [InlineData(0x000000000000FF00)] + [InlineData(0x00000000000000FF)] + public void SpanWriteInt64(long value) + { + Assert.True(BitConverter.IsLittleEndian); + var span = new Span(new byte[8]); + WriteInt64BigEndian(span, value); + long read = ReadInt64BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteInt64BigEndian(span, value)); + read = ReadInt64BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + WriteInt64LittleEndian(span, value); + read = ReadInt64LittleEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteInt64LittleEndian(span, value)); + read = ReadInt64LittleEndian(span); + Assert.Equal(value, read); + } + + [Theory] + [InlineData(ulong.MaxValue)] + [InlineData(ulong.MinValue)] + [InlineData(0xFF00000000000000)] + [InlineData(0x00FF000000000000)] + [InlineData(0x0000FF0000000000)] + [InlineData(0x000000FF00000000)] + [InlineData(0x00000000FF000000)] + [InlineData(0x0000000000FF0000)] + [InlineData(0x000000000000FF00)] + [InlineData(0x00000000000000FF)] + public void SpanWriteUInt64(ulong value) + { + Assert.True(BitConverter.IsLittleEndian); + var span = new Span(new byte[8]); + WriteUInt64BigEndian(span, value); + ulong read = ReadUInt64BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteUInt64BigEndian(span, value)); + read = ReadUInt64BigEndian(span); + Assert.Equal(value, read); + + span.Clear(); + WriteUInt64LittleEndian(span, value); + read = ReadUInt64LittleEndian(span); + Assert.Equal(value, read); + + span.Clear(); + Assert.True(TryWriteUInt64LittleEndian(span, value)); + read = ReadUInt64LittleEndian(span); + Assert.Equal(value, read); + } + + [Fact] + public void SpanWriteFail() + { + byte byteValue = 1; + sbyte sbyteValue = 1; + short shortValue = 1; + ushort ushortValue = 1; + int intValue = 1; + uint uintValue = 1; + long longValue = 1; + ulong ulongValue = 1; + + Span span = new byte[1]; + + WriteMachineEndian(span, ref byteValue); + byte read = ReadMachineEndian(span); + Assert.Equal(byteValue, read); + + span.Clear(); + Assert.True(TryWriteMachineEndian(span, ref byteValue)); + read = ReadMachineEndian(span); + Assert.Equal(byteValue, read); + + WriteMachineEndian(span, ref sbyteValue); + sbyte readSbyte = ReadMachineEndian(span); + Assert.Equal(sbyteValue, readSbyte); + + span.Clear(); + Assert.True(TryWriteMachineEndian(span, ref sbyteValue)); + readSbyte = ReadMachineEndian(span); + Assert.Equal(sbyteValue, readSbyte); + + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref shortValue)); + Assert.False(TryWriteMachineEndian(span, ref shortValue)); + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref intValue)); + Assert.False(TryWriteMachineEndian(span, ref intValue)); + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref longValue)); + Assert.False(TryWriteMachineEndian(span, ref longValue)); + + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref ushortValue)); + Assert.False(TryWriteMachineEndian(span, ref ushortValue)); + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref uintValue)); + Assert.False(TryWriteMachineEndian(span, ref uintValue)); + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref ulongValue)); + Assert.False(TryWriteMachineEndian(span, ref ulongValue)); + + var structValue = new TestHelpers.TestValueTypeWithReference{ I = 1, S = "1" }; + TestHelpers.AssertThrows(span, (_span) => WriteMachineEndian(_span, ref structValue)); + TestHelpers.AssertThrows(span, (_span) => TryWriteMachineEndian(_span, ref structValue)); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Configurations.props b/external/corefx/src/System.Memory/tests/Configurations.props index 3efbed0bcd..78953dfc88 100644 --- a/external/corefx/src/System.Memory/tests/Configurations.props +++ b/external/corefx/src/System.Memory/tests/Configurations.props @@ -2,8 +2,7 @@ - netcoreapp; - netfx; + netstandard; diff --git a/external/corefx/src/System.Memory/tests/Memory/CtorArray.cs b/external/corefx/src/System.Memory/tests/Memory/CtorArray.cs new file mode 100644 index 0000000000..d5b153768f --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/CtorArray.cs @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + // + // Tests for Memory.ctor(T[]) + // + // These tests will also exercise the matching codepaths in Memory.ctor(T[], int, int). This makes it easier to ensure + // that these parallel tests stay consistent, and avoid excess repetition in the files devoted to those specific overloads. + // + public static partial class MemoryTests + { + [Fact] + public static void CtorArrayInt() + { + int[] a = { 91, 92, -93, 94 }; + Memory memory; + + memory = new Memory(a); + memory.Validate(91, 92, -93, 94); + + memory = new Memory(a, 0, a.Length); + memory.Validate(91, 92, -93, 94); + } + + [Fact] + public static void CtorArrayLong() + { + long[] a = { 91, -92, 93, 94, -95 }; + Memory memory; + + memory = new Memory(a); + memory.Validate(91, -92, 93, 94, -95); + + memory = new Memory(a, 0, a.Length); + memory.Validate(91, -92, 93, 94, -95); + } + + [Fact] + public static void CtorArrayObject() + { + object o1 = new object(); + object o2 = new object(); + object[] a = { o1, o2 }; + Memory memory; + + memory = new Memory(a); + memory.ValidateReferenceType(o1, o2); + + memory = new Memory(a, 0, a.Length); + memory.ValidateReferenceType(o1, o2); + } + + [Fact] + public static void CtorArrayZeroLength() + { + int[] empty = Array.Empty(); + Memory memory; + + memory = new Memory(empty); + memory.Validate(); + + memory = new Memory(empty, 0, empty.Length); + memory.Validate(); + } + + [Fact] + public static void CtorArrayNullArray() + { + Assert.Throws(() => new Memory(null)); + Assert.Throws(() => new Memory(null, 0, 0)); + } + + [Fact] + public static void CtorArrayWrongArrayType() + { + // Cannot pass variant array, if array type is not a valuetype. + string[] a = { "Hello" }; + Assert.Throws(() => new Memory(a)); + Assert.Throws(() => new Memory(a, 0, a.Length)); + } + + [Fact] + public static void CtorArrayWrongValueType() + { + // Can pass variant array, if array type is a valuetype. + + uint[] a = { 42u, 0xffffffffu }; + int[] aAsIntArray = (int[])(object)a; + Memory memory; + + memory = new Memory(aAsIntArray); + memory.Validate(42, -1); + + memory = new Memory(aAsIntArray, 0, aAsIntArray.Length); + memory.Validate(42, -1); + } + } +} + diff --git a/external/corefx/src/System.Memory/tests/Memory/CtorArrayIntInt.cs b/external/corefx/src/System.Memory/tests/Memory/CtorArrayIntInt.cs new file mode 100644 index 0000000000..251fbf2551 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/CtorArrayIntInt.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + // + // Tests for MemoryTests.ctor(T[], int, int). If the test is not specific to this overload, consider putting it in CtorArray.cs instread. + // + public static partial class MemoryTests + { + [Fact] + public static void CtorArrayWithStartAndLengthInt() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; + var memory = new Memory(a, 3, 2); + memory.Validate(93, 94); + } + + [Fact] + public static void CtorArrayWithStartAndLengthLong() + { + long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; + var memory = new Memory(a, 4, 3); + memory.Validate(94, 95, 96); + } + + [Fact] + public static void CtorArrayWithStartAndLengthRangeExtendsToEndOfArray() + { + long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; + var memory = new Memory(a, 4, 5); + memory.Validate(94, 95, 96, 97, 98); + } + + [Fact] + public static void CtorArrayWithNegativeStartAndLength() + { + int[] a = new int[3]; + Assert.Throws(() => new Memory(a, -1, 0)); + } + + [Fact] + public static void CtorArrayWithStartTooLargeAndLength() + { + int[] a = new int[3]; + Assert.Throws(() => new Memory(a, 4, 0)); + } + + [Fact] + public static void CtorArrayWithStartAndNegativeLength() + { + int[] a = new int[3]; + Assert.Throws(() => new Memory(a, 0, -1)); + } + + [Fact] + public static void CtorArrayWithStartAndLengthTooLarge() + { + int[] a = new int[3]; + Assert.Throws(() => new Memory(a, 3, 1)); + Assert.Throws(() => new Memory(a, 2, 2)); + Assert.Throws(() => new Memory(a, 1, 3)); + Assert.Throws(() => new Memory(a, 0, 4)); + Assert.Throws(() => new Memory(a, int.MaxValue, int.MaxValue)); + } + + [Fact] + public static void CtorArrayWithStartAndLengthBothEqual() + { + // Valid for start to equal the array length. This returns an empty memory that starts "just past the array." + int[] a = { 91, 92, 93 }; + var memory = new Memory(a, 3, 0); + memory.Validate(); + } + } +} + diff --git a/external/corefx/src/System.Memory/tests/Memory/CustomMemoryForTest.cs b/external/corefx/src/System.Memory/tests/Memory/CustomMemoryForTest.cs new file mode 100644 index 0000000000..ae23459eac --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/CustomMemoryForTest.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +using System.Buffers; +using System.Runtime.InteropServices; +using System.Threading; + +namespace System.MemoryTests +{ + public class CustomMemoryForTest : OwnedMemory + { + private bool _disposed; + private int _referenceCount; + private int _noReferencesCalledCount; + private T[] _array; + + public CustomMemoryForTest(T[] array) + { + _array = array; + } + + public int OnNoRefencesCalledCount => _noReferencesCalledCount; + + public override int Length => _array.Length; + + public override bool IsDisposed => _disposed; + + protected override bool IsRetained => _referenceCount > 0; + + public override Span Span + { + get + { + if (IsDisposed) + throw new ObjectDisposedException(nameof(CustomMemoryForTest)); + return new Span(_array, 0, _array.Length); + } + } + + public override MemoryHandle Pin() + { + unsafe + { + Retain(); + var handle = GCHandle.Alloc(_array, GCHandleType.Pinned); + return new MemoryHandle(this, (void*)handle.AddrOfPinnedObject(), handle); + } + } + + protected override bool TryGetArray(out ArraySegment arraySegment) + { + if (IsDisposed) + throw new ObjectDisposedException(nameof(CustomMemoryForTest)); + arraySegment = new ArraySegment(_array); + return true; + } + + protected override void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + _array = null; + } + + _disposed = true; + + } + + public override void Retain() + { + if (IsDisposed) + throw new ObjectDisposedException(nameof(CustomMemoryForTest)); + Interlocked.Increment(ref _referenceCount); + } + + public override bool Release() + { + int newRefCount = Interlocked.Decrement(ref _referenceCount); + + if (newRefCount < 0) + throw new InvalidOperationException(); + + if (newRefCount == 0) + { + _noReferencesCalledCount++; + return false; + } + return true; + } + } +} + diff --git a/external/corefx/src/System.Memory/tests/Memory/Empty.cs b/external/corefx/src/System.Memory/tests/Memory/Empty.cs new file mode 100644 index 0000000000..73738f76a4 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/Empty.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void Empty() + { + Memory empty = Memory.Empty; + Assert.True(empty.IsEmpty); + Assert.Equal(0, empty.Length); + } + + [Fact] + public static void IsEmpty() + { + Memory empty = new int[0]; + Assert.True(empty.IsEmpty); + Assert.Equal(0, empty.Length); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/Equality.cs b/external/corefx/src/System.Memory/tests/Memory/Equality.cs new file mode 100644 index 0000000000..f81068b5bf --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/Equality.cs @@ -0,0 +1,245 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using Xunit; + +#pragma warning disable 1718 //Comparison made to same variable; did you mean to compare something else? + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void EqualityTrue() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 2, 3); + var right = new Memory(a, 2, 3); + + Assert.True(left.Equals(right)); + Assert.True(right.Equals(left)); + } + + [Fact] + public static void EqualityReflexivity() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 2, 3); + + Assert.True(left.Equals(left)); + } + + [Fact] + public static void EqualityIncludesLength() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 2, 1); + var right = new Memory(a, 2, 3); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + + [Fact] + public static void EqualityIncludesBase() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 1, 3); + var right = new Memory(a, 2, 3); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + + [Fact] + public static void EqualityComparesRangeNotContent() + { + var left = new Memory(new int[] { 0, 1, 2 }, 1, 1); + var right = new Memory(new int[] { 0, 1, 2 }, 1, 1); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + + [Fact] + public static void EmptyMemoryNotUnified() + { + var left = new Memory(new int[0]); + var right = new Memory(new int[0]); + + Memory memoryFromNonEmptyArrayButWithZeroLength = new Memory(new int[1] { 123 }).Slice(0, 0); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + + Assert.False(memoryFromNonEmptyArrayButWithZeroLength.Equals(left)); + Assert.False(left.Equals(memoryFromNonEmptyArrayButWithZeroLength)); + + // Empty property is equal + left = Memory.Empty; + right = Memory.Empty; + + Assert.True(left.Equals(right)); + Assert.True(right.Equals(left)); + } + + [Fact] + public static void MemoryCanBeBoxed() + { + Memory memory = Memory.Empty; + object memoryAsObject = memory; + Assert.True(memory.Equals(memoryAsObject)); + + ReadOnlyMemory readOnlyMemory = ReadOnlyMemory.Empty; + object readOnlyMemoryAsObject = readOnlyMemory; + Assert.True(readOnlyMemory.Equals(readOnlyMemoryAsObject)); + + Assert.False(memory.Equals(new object())); + Assert.False(readOnlyMemory.Equals(new object())); + + Assert.False(memory.Equals((object)(new Memory(new byte[] { 1, 2 })))); + Assert.False(readOnlyMemory.Equals((object)(new ReadOnlyMemory(new byte[] { 1, 2 })))); + + Assert.True(memory.Equals(readOnlyMemoryAsObject)); + Assert.True(readOnlyMemory.Equals(memoryAsObject)); + } + + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void MemoryReferencingSameMemoryAreEqualInEveryAspect(byte[] bytes, int start, int length) + { + var memory = new Memory(bytes, start, length); + var pointingToSameMemory = new Memory(bytes, start, length); + Memory structCopy = memory; + + Assert.True(memory.Equals(pointingToSameMemory)); + Assert.True(pointingToSameMemory.Equals(memory)); + + Assert.True(memory.Equals(structCopy)); + Assert.True(structCopy.Equals(memory)); + } + + [Theory] + [MemberData(nameof(FullArraySegments))] + public static void MemoryArrayEquivalenceAndImplicitCastsAreEqual(byte[] bytes) + { + var memory = new Memory(bytes); + var readOnlyMemory = new ReadOnlyMemory(bytes); + ReadOnlyMemory implicitReadOnlyMemory = memory; + Memory implicitMemoryArray = bytes; + ReadOnlyMemory implicitReadOnlyMemoryArray = bytes; + + Assert.True(memory.Equals(bytes)); + Assert.True(readOnlyMemory.Equals(bytes)); + Assert.True(implicitReadOnlyMemory.Equals(bytes)); + Assert.True(implicitMemoryArray.Equals(bytes)); + Assert.True(implicitReadOnlyMemoryArray.Equals(bytes)); + + Assert.True(readOnlyMemory.Equals(memory)); + Assert.True(implicitReadOnlyMemory.Equals(memory)); + Assert.True(implicitMemoryArray.Equals(memory)); + Assert.True(implicitReadOnlyMemoryArray.Equals(memory)); + + Assert.True(memory.Equals(readOnlyMemory)); + Assert.True(implicitReadOnlyMemory.Equals(readOnlyMemory)); + Assert.True(implicitMemoryArray.Equals(readOnlyMemory)); + Assert.True(implicitReadOnlyMemoryArray.Equals(readOnlyMemory)); + + Assert.True(memory.Equals(implicitMemoryArray)); + Assert.True(readOnlyMemory.Equals(implicitMemoryArray)); + Assert.True(implicitReadOnlyMemory.Equals(implicitMemoryArray)); + Assert.True(implicitReadOnlyMemoryArray.Equals(implicitMemoryArray)); + + Assert.True(memory.Equals(implicitReadOnlyMemory)); + Assert.True(readOnlyMemory.Equals(implicitReadOnlyMemory)); + Assert.True(implicitMemoryArray.Equals(implicitReadOnlyMemory)); + Assert.True(implicitReadOnlyMemoryArray.Equals(implicitReadOnlyMemory)); + + Assert.True(memory.Equals(implicitReadOnlyMemoryArray)); + Assert.True(readOnlyMemory.Equals(implicitReadOnlyMemoryArray)); + Assert.True(implicitReadOnlyMemory.Equals(implicitReadOnlyMemoryArray)); + Assert.True(implicitMemoryArray.Equals(implicitReadOnlyMemoryArray)); + } + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void RangedMemoryEquivalenceAndImplicitCastsAreEqual(byte[] bytes, int start, int length) + { + var memory = new Memory(bytes, start, length); + var readOnlyMemory = new ReadOnlyMemory(bytes, start, length); + ReadOnlyMemory implicitReadOnlyMemory = memory; + + Assert.True(readOnlyMemory.Equals(memory)); + Assert.True(implicitReadOnlyMemory.Equals(memory)); + + Assert.True(memory.Equals(readOnlyMemory)); + Assert.True(implicitReadOnlyMemory.Equals(readOnlyMemory)); + + Assert.True(memory.Equals(implicitReadOnlyMemory)); + Assert.True(readOnlyMemory.Equals(implicitReadOnlyMemory)); + } + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void MemoryOfEqualValuesAreNotEqual(byte[] bytes, int start, int length) + { + byte[] bytesCopy = bytes.ToArray(); + + var memory = new Memory(bytes, start, length); + var ofSameValues = new Memory(bytesCopy, start, length); + + Assert.False(memory.Equals(ofSameValues)); + Assert.False(ofSameValues.Equals(memory)); + } + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void MemoryOfDifferentValuesAreNotEqual(byte[] bytes, int start, int length) + { + byte[] differentBytes = bytes.Select(value => ++value).ToArray(); + + var memory = new Memory(bytes, start, length); + var ofDifferentValues = new Memory(differentBytes, start, length); + + Assert.False(memory.Equals(ofDifferentValues)); + Assert.False(ofDifferentValues.Equals(memory)); + } + + public static IEnumerable ValidArraySegments + { + get + { + return new List + { + new object[] { new byte[1] { 0 }, 0, 1}, + new object[] { new byte[2] { 0, 0 }, 0, 2}, + new object[] { new byte[2] { 0, 0 }, 0, 1}, + new object[] { new byte[2] { 0, 0 }, 1, 1}, + new object[] { new byte[3] { 0, 0, 0 }, 0, 3}, + new object[] { new byte[3] { 0, 0, 0 }, 0, 2}, + new object[] { new byte[3] { 0, 0, 0 }, 1, 2}, + new object[] { new byte[3] { 0, 0, 0 }, 1, 1}, + new object[] { Enumerable.Range(0, 100000).Select(i => (byte)i).ToArray(), 0, 100000 } + }; + } + } + + public static IEnumerable FullArraySegments + { + get + { + return new List + { + new object[] { new byte[1] { 0 } }, + new object[] { new byte[2] { 0, 0 } }, + new object[] { new byte[3] { 0, 0, 0 } }, + new object[] { Enumerable.Range(0, 100000).Select(i => (byte)i).ToArray() } + }; + } + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/GetHashCode.cs b/external/corefx/src/System.Memory/tests/Memory/GetHashCode.cs new file mode 100644 index 0000000000..e4a4c2bac0 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/GetHashCode.cs @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void SameObjectsHaveSameHashCodes() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 2, 3); + var right = new Memory(a, 2, 3); + + int[] b = { 1, 2, 3, 4, 5 }; + var different = new Memory(b, 2, 3); + + Assert.Equal(left.GetHashCode(), right.GetHashCode()); + Assert.NotEqual(left.GetHashCode(), different.GetHashCode()); + } + + [Fact] + public static void HashCodeIncludesLength() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 2, 1); + var right = new Memory(a, 2, 3); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void HashCodeIncludesBase() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new Memory(a, 1, 3); + var right = new Memory(a, 2, 3); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void HashCodesDifferentForSameContent() + { + var left = new Memory(new int[] { 0, 1, 2 }, 1, 1); + var right = new Memory(new int[] { 0, 1, 2 }, 1, 1); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void EmptyMemoryHashCodeNotUnified() + { + var left = new Memory(new int[0]); + var right = new Memory(new int[0]); + + Memory memoryFromNonEmptyArrayButWithZeroLength = new Memory(new int[1] { 123 }).Slice(0, 0); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + Assert.NotEqual(left.GetHashCode(), memoryFromNonEmptyArrayButWithZeroLength.GetHashCode()); + Assert.NotEqual(right.GetHashCode(), memoryFromNonEmptyArrayButWithZeroLength.GetHashCode()); + + // Empty property hashcode is equal + left = Memory.Empty; + right = Memory.Empty; + + Assert.Equal(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void HashCodesForImplicitCastsAreEqual() + { + byte[] bytes = new byte[10]; + var memory = new Memory(bytes); + var readOnlyMemory = new ReadOnlyMemory(bytes); + ReadOnlyMemory implicitReadOnlyMemory = memory; + Memory implicitMemoryArray = bytes; + ReadOnlyMemory implicitReadOnlyMemoryArray = bytes; + + Assert.Equal(readOnlyMemory.GetHashCode(), memory.GetHashCode()); + Assert.Equal(implicitReadOnlyMemory.GetHashCode(), memory.GetHashCode()); + Assert.Equal(implicitMemoryArray.GetHashCode(), memory.GetHashCode()); + Assert.Equal(implicitReadOnlyMemoryArray.GetHashCode(), memory.GetHashCode()); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/ImplicitConversion.cs b/external/corefx/src/System.Memory/tests/Memory/ImplicitConversion.cs new file mode 100644 index 0000000000..75a545167d --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/ImplicitConversion.cs @@ -0,0 +1,120 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void CtorImplicitArray() + { + int[] intArray = { 19, -17 }; + Cast(intArray, 19, -17); + + Memory memoryInt = intArray; + CastReadOnly(memoryInt, 19, -17); + + long[] longArray = { 1, -3, 7, -15, 31 }; + Cast(longArray, 1, -3, 7, -15, 31); + + Memory memoryLong = longArray; + CastReadOnly(memoryLong, 1, -3, 7, -15, 31); + + object o1 = new object(); + object o2 = new object(); + object o3 = new object(); + object o4 = new object(); + object[] objectArray = { o1, o2, o3, o4 }; + CastReference(objectArray, o1, o2, o3, o4); + + Memory memoryObject = objectArray; + CastReadOnlyReference(memoryObject, o1, o2, o3, o4); + } + + [Fact] + public static void CtorImplicitZeroLengthArray() + { + int[] emptyArray1 = Array.Empty(); + Cast(emptyArray1); + + Memory memoryEmpty = emptyArray1; + CastReadOnly(memoryEmpty); + + int[] emptyArray2 = new int[0]; + Cast(emptyArray2); + + Memory memoryEmptyInt = emptyArray2; + CastReadOnly(memoryEmptyInt); + } + + [Fact] + public static void CtorImplicitArraySegment() + { + int[] a = { 19, -17 }; + ArraySegment segmentInt = new ArraySegment(a, 1, 1); + Cast(segmentInt, -17); + + Memory memoryInt = segmentInt; + CastReadOnly(memoryInt, -17); + + long[] b = { 1, -3, 7, -15, 31 }; + ArraySegment segmentLong = new ArraySegment(b, 1, 3); + Cast(segmentLong, -3, 7, -15); + + Memory memoryLong = segmentLong; + CastReadOnly(memoryLong, -3, 7, -15); + + object o1 = new object(); + object o2 = new object(); + object o3 = new object(); + object o4 = new object(); + object[] c = { o1, o2, o3, o4 }; + ArraySegment segmentObject = new ArraySegment(c, 0, 2); + CastReference(segmentObject, o1, o2); + + Memory memoryObject = segmentObject; + CastReadOnlyReference(memoryObject, o1, o2); + } + + [Fact] + public static void CtorImplicitZeroLengthArraySegment() + { + int[] empty = Array.Empty(); + ArraySegment emptySegment = new ArraySegment(empty); + Cast(emptySegment); + + Memory memoryEmpty = emptySegment; + CastReadOnly(memoryEmpty); + + int[] a = { 19, -17 }; + ArraySegment segmentInt = new ArraySegment(a, 1, 0); + Cast(segmentInt); + + Memory memoryEmptyInt = segmentInt; + CastReadOnly(memoryEmptyInt); + } + + private static void Cast(Memory memory, params T[] expected) where T : struct, IEquatable + { + memory.Validate(expected); + } + + private static void CastReference(Memory memory, params T[] expected) + { + memory.ValidateReferenceType(expected); + } + + private static void CastReadOnly(ReadOnlyMemory memory, params T[] expected) where T : struct, IEquatable + { + memory.Validate(expected); + } + + private static void CastReadOnlyReference(ReadOnlyMemory memory, params T[] expected) + { + memory.ValidateReferenceType(expected); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/OwnedMemory.cs b/external/corefx/src/System.Memory/tests/Memory/OwnedMemory.cs new file mode 100644 index 0000000000..cef1264f91 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/OwnedMemory.cs @@ -0,0 +1,96 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + // + // Tests for internal Memory.ctor(OwnedMemory, int , int) + // + public static partial class MemoryTests + { + [Fact] + public static void MemoryFromOwnedMemoryInt() + { + int[] a = { 91, 92, -93, 94 }; + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memory = owner.Memory; + memory.Validate(91, 92, -93, 94); + } + + [Fact] + public static void MemoryFromOwnedMemoryLong() + { + long[] a = { 91, -92, 93, 94, -95 }; + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memory = owner.Memory; + memory.Validate(91, -92, 93, 94, -95); + } + + [Fact] + public static void MemoryFromOwnedMemoryObject() + { + object o1 = new object(); + object o2 = new object(); + object[] a = { o1, o2 }; + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memory = owner.Memory; + memory.ValidateReferenceType(o1, o2); + } + + [Fact] + public static void ImplicitReadOnlyMemoryFromOwnedMemory() + { + long[] a = { 91, -92, 93, 94, -95 }; + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memory = owner.Memory; + CastReadOnly(memory, 91, -92, 93, 94, -95); + } + + [Fact] + public static void OwnedMemoryDispose() + { + int[] a = { 91, 92, -93, 94 }; + OwnedMemory owner = new CustomMemoryForTest(a); + Assert.False(owner.IsDisposed); + owner.Dispose(); + Assert.True(owner.IsDisposed); + } + + [Fact] + public static void MemoryFromOwnedMemoryAfterDispose() + { + int[] a = { 91, 92, -93, 94 }; + OwnedMemory owner = new CustomMemoryForTest(a); + owner.Dispose(); + Assert.Throws(() => owner.Memory); + } + + [Fact] + public static void DisposeOwnedMemoryAfterRetain() + { + int[] a = { 91, 92, -93, 94 }; + OwnedMemory owner = new CustomMemoryForTest(a); + owner.Retain(); + Assert.Throws(() => owner.Dispose()); + owner.Release(); + } + + [Fact] + public static void DisposeOwnedMemoryAfterRetainAndRelease() + { + int[] a = { 91, 92, -93, 94 }; + OwnedMemory owner = new CustomMemoryForTest(a); + owner.Retain(); + owner.Release(); + owner.Dispose(); + Assert.True(owner.IsDisposed); + } + } + +} + diff --git a/external/corefx/src/System.Memory/tests/Memory/Retain.cs b/external/corefx/src/System.Memory/tests/Memory/Retain.cs new file mode 100644 index 0000000000..e48301b87d --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/Retain.cs @@ -0,0 +1,142 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + + [Fact] + public static void MemoryRetainWithoutPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + Memory memory = array; + MemoryHandle handle = memory.Retain(); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer == null); + } + handle.Dispose(); + } + + [Fact] + public static void MemoryRetainWithPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + Memory memory = array; + MemoryHandle handle = memory.Retain(pin: true); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i], pointer[i]); + } + } + handle.Dispose(); + } + + [Fact] + public static void MemoryRetainWithPinningAndSlice() + { + int[] array = { 1, 2, 3, 4, 5 }; + Memory memory = array; + memory = memory.Slice(1); + MemoryHandle handle = memory.Retain(pin: true); + Span span = memory.Span; + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], pointer[i]); + } + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], span[i]); + } + } + handle.Dispose(); + } + + [Fact] + public static void OwnedMemoryRetainWithoutPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + OwnedMemory owner = new CustomMemoryForTest(array); + Memory memory = owner.Memory; + MemoryHandle handle = memory.Retain(); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer == null); + } + handle.Dispose(); + } + + [Fact] + public static void OwnedMemoryRetainWithPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + OwnedMemory owner = new CustomMemoryForTest(array); + Memory memory = owner.Memory; + MemoryHandle handle = memory.Retain(pin: true); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i], pointer[i]); + } + } + handle.Dispose(); + } + + [ActiveIssue(24384, TargetFrameworkMonikers.UapAot)] + [Fact] + public static void OwnedMemoryRetainWithPinningAndSlice() + { + int[] array = { 1, 2, 3, 4, 5 }; + OwnedMemory owner = new CustomMemoryForTest(array); + Memory memory = owner.Memory.Slice(1); + MemoryHandle handle = memory.Retain(pin: true); + Span span = memory.Span; + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], pointer[i]); + } + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], span[i]); + } + } + handle.Dispose(); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/Slice.cs b/external/corefx/src/System.Memory/tests/Memory/Slice.cs new file mode 100644 index 0000000000..70dcdb26e7 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/Slice.cs @@ -0,0 +1,112 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System.Runtime.CompilerServices; +using System.Buffers; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void SliceWithStart() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Memory memory = new Memory(a).Slice(6); + Assert.Equal(4, memory.Length); + Assert.True(Unsafe.AreSame(ref a[6], ref memory.Span.DangerousGetPinnableReference())); + + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memoryFromOwner = owner.Memory.Slice(6); + + Assert.Equal(4, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[6], ref memoryFromOwner.Span.DangerousGetPinnableReference())); + } + + [Fact] + public static void SliceWithStartPastEnd() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Memory memory = new Memory(a).Slice(a.Length); + Assert.Equal(0, memory.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memory.Span.DangerousGetPinnableReference(), 1))); + + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memoryFromOwner = owner.Memory.Slice(a.Length); + + Assert.Equal(0, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memoryFromOwner.Span.DangerousGetPinnableReference(), 1))); + } + + [Fact] + public static void SliceWithStartAndLength() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Memory memory = new Memory(a).Slice(3, 5); + Assert.Equal(5, memory.Length); + Assert.True(Unsafe.AreSame(ref a[3], ref memory.Span.DangerousGetPinnableReference())); + + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memoryFromOwner = owner.Memory.Slice(3, 5); + + Assert.Equal(5, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[3], ref memoryFromOwner.Span.DangerousGetPinnableReference())); + } + + [Fact] + public static void SliceWithStartAndLengthUpToEnd() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Memory memory = new Memory(a).Slice(4, 6); + Assert.Equal(6, memory.Length); + Assert.True(Unsafe.AreSame(ref a[4], ref memory.Span.DangerousGetPinnableReference())); + + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memoryFromOwner = owner.Memory.Slice(4, 6); + + Assert.Equal(6, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[4], ref memoryFromOwner.Span.DangerousGetPinnableReference())); + } + + [Fact] + public static void SliceWithStartAndLengthPastEnd() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Memory memory = new Memory(a).Slice(a.Length, 0); + Assert.Equal(0, memory.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memory.Span.DangerousGetPinnableReference(), 1))); + + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memoryFromOwner = owner.Memory.Slice(a.Length, 0); + + Assert.Equal(0, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memoryFromOwner.Span.DangerousGetPinnableReference(), 1))); + } + + [Fact] + public static void SliceRangeChecks() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Assert.Throws(() => new Memory(a).Slice(-1)); + Assert.Throws(() => new Memory(a).Slice(a.Length + 1)); + Assert.Throws(() => new Memory(a).Slice(-1, 0)); + Assert.Throws(() => new Memory(a).Slice(0, a.Length + 1)); + Assert.Throws(() => new Memory(a).Slice(2, a.Length + 1 - 2)); + Assert.Throws(() => new Memory(a).Slice(a.Length + 1, 0)); + Assert.Throws(() => new Memory(a).Slice(a.Length, 1)); + + OwnedMemory owner = new CustomMemoryForTest(a); + Memory memory = owner.Memory; + + Assert.Throws(() => memory.Slice(-1)); + Assert.Throws(() => memory.Slice(a.Length + 1)); + Assert.Throws(() => memory.Slice(-1, 0)); + Assert.Throws(() => memory.Slice(0, a.Length + 1)); + Assert.Throws(() => memory.Slice(2, a.Length + 1 - 2)); + Assert.Throws(() => memory.Slice(a.Length + 1, 0)); + Assert.Throws(() => memory.Slice(a.Length, 1)); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/Span.cs b/external/corefx/src/System.Memory/tests/Memory/Span.cs new file mode 100644 index 0000000000..1ff80d774e --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/Span.cs @@ -0,0 +1,98 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void SpanFromCtorArrayInt() + { + int[] a = { 91, 92, -93, 94 }; + Memory memory; + + memory = new Memory(a); + memory.Span.Validate(91, 92, -93, 94); + + memory = new Memory(a, 0, a.Length); + memory.Span.Validate(91, 92, -93, 94); + + OwnedMemory owner = new CustomMemoryForTest(a); + owner.Memory.Span.Validate(91, 92, -93, 94); + } + + [Fact] + public static void SpanFromCtorArrayLong() + { + long[] a = { 91, -92, 93, 94, -95 }; + Memory memory; + + memory = new Memory(a); + memory.Span.Validate(91, -92, 93, 94, -95); + + memory = new Memory(a, 0, a.Length); + memory.Span.Validate(91, -92, 93, 94, -95); + + OwnedMemory owner = new CustomMemoryForTest(a); + owner.Memory.Span.Validate(91, -92, 93, 94, -95); + } + + [Fact] + public static void SpanFromCtorArrayObject() + { + object o1 = new object(); + object o2 = new object(); + object[] a = { o1, o2 }; + Memory memory; + + memory = new Memory(a); + memory.Span.ValidateReferenceType(o1, o2); + + memory = new Memory(a, 0, a.Length); + memory.Span.ValidateReferenceType(o1, o2); + + OwnedMemory owner = new CustomMemoryForTest(a); + owner.Memory.Span.ValidateReferenceType(o1, o2); + } + + [Fact] + public static void SpanFromCtorArrayZeroLength() + { + int[] empty = Array.Empty(); + Memory memory; + + memory = new Memory(empty); + memory.Span.Validate(); + + memory = new Memory(empty, 0, empty.Length); + memory.Span.Validate(); + + OwnedMemory owner = new CustomMemoryForTest(empty); + owner.Memory.Span.Validate(); + } + + [Fact] + public static void SpanFromCtorArrayWrongValueType() + { + // Can pass variant array, if array type is a valuetype. + + uint[] a = { 42u, 0xffffffffu }; + int[] aAsIntArray = (int[])(object)a; + Memory memory; + + memory = new Memory(aAsIntArray); + memory.Span.Validate(42, -1); + + memory = new Memory(aAsIntArray, 0, aAsIntArray.Length); + memory.Span.Validate(42, -1); + + OwnedMemory owner = new CustomMemoryForTest(aAsIntArray); + owner.Memory.Span.Validate(42, -1); + } + + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/ToArray.cs b/external/corefx/src/System.Memory/tests/Memory/ToArray.cs new file mode 100644 index 0000000000..f3fa252ad7 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/ToArray.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void ToArray1() + { + int[] a = { 91, 92, 93 }; + var memory = new Memory(a); + int[] copy = memory.ToArray(); + Assert.Equal(a, copy); + Assert.NotSame(a, copy); + } + + [Fact] + public static void ToArrayWithIndex() + { + int[] a = { 91, 92, 93, 94, 95 }; + var memory = new Memory(a); + int[] copy = memory.Slice(2).ToArray(); + + Assert.Equal(new int[] { 93, 94, 95 }, copy); + } + + [Fact] + public static void ToArrayWithIndexAndLength() + { + int[] a = { 91, 92, 93 }; + var memory = new Memory(a, 1, 1); + int[] copy = memory.ToArray(); + Assert.Equal(new int[] { 92 }, copy); + } + + [Fact] + public static void ToArrayEmpty() + { + Memory memory = Memory.Empty; + int[] copy = memory.ToArray(); + Assert.Equal(0, copy.Length); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Memory/TryGetArray.cs b/external/corefx/src/System.Memory/tests/Memory/TryGetArray.cs new file mode 100644 index 0000000000..b2cbc098b7 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Memory/TryGetArray.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + public static partial class MemoryTests + { + [Fact] + public static void MemoryTryGetArray() + { + int[] array = new int[10]; + Memory memory = array; + Assert.True(memory.TryGetArray(out ArraySegment segment)); + Assert.Equal(array.Length, segment.Count); + + for (int i = segment.Offset; i < segment.Count + segment.Offset; i++) + { + Assert.Equal(array[i], segment.Array[i]); + } + } + + [Fact] + public static void OwnedMemoryTryGetArray() + { + int[] array = new int[10]; + OwnedMemory owner = new CustomMemoryForTest(array); + Memory memory = owner.Memory; + Assert.True(memory.TryGetArray(out ArraySegment segment)); + Assert.Equal(array.Length, segment.Count); + + for (int i = segment.Offset; i < segment.Count + segment.Offset; i++) + { + Assert.Equal(array[i], segment.Array[i]); + } + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Performance/Configurations.props b/external/corefx/src/System.Memory/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Memory/tests/Performance/Perf.Span.BinaryReadAndWrite.cs b/external/corefx/src/System.Memory/tests/Performance/Perf.Span.BinaryReadAndWrite.cs new file mode 100644 index 0000000000..dbcdc998fb --- /dev/null +++ b/external/corefx/src/System.Memory/tests/Performance/Perf.Span.BinaryReadAndWrite.cs @@ -0,0 +1,281 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Xunit.Performance; +using Xunit; +using System.Net; + +using static System.Buffers.Binary.BinaryPrimitives; +using static System.TestHelpers; + +namespace System.Buffers.Binary.Tests +{ + public class BinaryReadAndWriteTests + { + private const int InnerCount = 100000; + + [Benchmark(InnerIterationCount = InnerCount)] + private static void ReadStructAndReverseBE() + { + Span spanBE = TestHelpers.GetSpanBE(); + + var readStruct = new TestHelpers.TestStructExplicit(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + readStruct = ReadMachineEndian(spanBE); + if (BitConverter.IsLittleEndian) + { + readStruct.S0 = ReverseEndianness(readStruct.S0); + readStruct.I0 = ReverseEndianness(readStruct.I0); + readStruct.L0 = ReverseEndianness(readStruct.L0); + readStruct.US0 = ReverseEndianness(readStruct.US0); + readStruct.UI0 = ReverseEndianness(readStruct.UI0); + readStruct.UL0 = ReverseEndianness(readStruct.UL0); + readStruct.S1 = ReverseEndianness(readStruct.S1); + readStruct.I1 = ReverseEndianness(readStruct.I1); + readStruct.L1 = ReverseEndianness(readStruct.L1); + readStruct.US1 = ReverseEndianness(readStruct.US1); + readStruct.UI1 = ReverseEndianness(readStruct.UI1); + readStruct.UL1 = ReverseEndianness(readStruct.UL1); + } + } + } + } + + Assert.Equal(TestHelpers.testExplicitStruct, readStruct); + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void ReadStructAndReverseLE() + { + Span spanLE = TestHelpers.GetSpanLE(); + + var readStruct = new TestHelpers.TestStructExplicit(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + readStruct = ReadMachineEndian(spanLE); + if (!BitConverter.IsLittleEndian) + { + readStruct.S0 = ReverseEndianness(readStruct.S0); + readStruct.I0 = ReverseEndianness(readStruct.I0); + readStruct.L0 = ReverseEndianness(readStruct.L0); + readStruct.US0 = ReverseEndianness(readStruct.US0); + readStruct.UI0 = ReverseEndianness(readStruct.UI0); + readStruct.UL0 = ReverseEndianness(readStruct.UL0); + readStruct.S1 = ReverseEndianness(readStruct.S1); + readStruct.I1 = ReverseEndianness(readStruct.I1); + readStruct.L1 = ReverseEndianness(readStruct.L1); + readStruct.US1 = ReverseEndianness(readStruct.US1); + readStruct.UI1 = ReverseEndianness(readStruct.UI1); + readStruct.UL1 = ReverseEndianness(readStruct.UL1); + } + } + } + } + + Assert.Equal(TestHelpers.testExplicitStruct, readStruct); + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void ReadStructFieldByFieldBE() + { + Span spanBE = TestHelpers.GetSpanBE(); + + var readStruct = new TestHelpers.TestStructExplicit(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + readStruct = new TestHelpers.TestStructExplicit + { + S0 = ReadInt16BigEndian(spanBE), + I0 = ReadInt32BigEndian(spanBE.Slice(2)), + L0 = ReadInt64BigEndian(spanBE.Slice(6)), + US0 = ReadUInt16BigEndian(spanBE.Slice(14)), + UI0 = ReadUInt32BigEndian(spanBE.Slice(16)), + UL0 = ReadUInt64BigEndian(spanBE.Slice(20)), + S1 = ReadInt16BigEndian(spanBE.Slice(28)), + I1 = ReadInt32BigEndian(spanBE.Slice(30)), + L1 = ReadInt64BigEndian(spanBE.Slice(34)), + US1 = ReadUInt16BigEndian(spanBE.Slice(42)), + UI1 = ReadUInt32BigEndian(spanBE.Slice(44)), + UL1 = ReadUInt64BigEndian(spanBE.Slice(48)) + }; + } + } + } + + Assert.Equal(TestHelpers.testExplicitStruct, readStruct); + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void ReadStructFieldByFieldLE() + { + Span spanLE = TestHelpers.GetSpanLE(); + + var readStruct = new TestHelpers.TestStructExplicit(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + readStruct = new TestHelpers.TestStructExplicit + { + S0 = ReadInt16LittleEndian(spanLE), + I0 = ReadInt32LittleEndian(spanLE.Slice(2)), + L0 = ReadInt64LittleEndian(spanLE.Slice(6)), + US0 = ReadUInt16LittleEndian(spanLE.Slice(14)), + UI0 = ReadUInt32LittleEndian(spanLE.Slice(16)), + UL0 = ReadUInt64LittleEndian(spanLE.Slice(20)), + S1 = ReadInt16LittleEndian(spanLE.Slice(28)), + I1 = ReadInt32LittleEndian(spanLE.Slice(30)), + L1 = ReadInt64LittleEndian(spanLE.Slice(34)), + US1 = ReadUInt16LittleEndian(spanLE.Slice(42)), + UI1 = ReadUInt32LittleEndian(spanLE.Slice(44)), + UL1 = ReadUInt64LittleEndian(spanLE.Slice(48)) + }; + } + } + } + + Assert.Equal(TestHelpers.testExplicitStruct, readStruct); + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void ReadStructFieldByFieldUsingBitConverterLE() + { + Span spanLE = TestHelpers.GetSpanLE(); + byte[] arrayLE = spanLE.ToArray(); + + var readStruct = new TestHelpers.TestStructExplicit(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + readStruct = new TestHelpers.TestStructExplicit + { + S0 = BitConverter.ToInt16(arrayLE, 0), + I0 = BitConverter.ToInt32(arrayLE, 2), + L0 = BitConverter.ToInt64(arrayLE, 6), + US0 = BitConverter.ToUInt16(arrayLE, 14), + UI0 = BitConverter.ToUInt32(arrayLE, 16), + UL0 = BitConverter.ToUInt64(arrayLE, 20), + S1 = BitConverter.ToInt16(arrayLE, 28), + I1 = BitConverter.ToInt32(arrayLE, 30), + L1 = BitConverter.ToInt64(arrayLE, 34), + US1 = BitConverter.ToUInt16(arrayLE, 42), + UI1 = BitConverter.ToUInt32(arrayLE, 44), + UL1 = BitConverter.ToUInt64(arrayLE, 48), + }; + } + } + } + + Assert.Equal(TestHelpers.testExplicitStruct, readStruct); + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void ReadStructFieldByFieldUsingBitConverterBE() + { + Span spanBE = TestHelpers.GetSpanBE(); + byte[] arrayBE = spanBE.ToArray(); + + var readStruct = new TestHelpers.TestStructExplicit(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + readStruct = new TestHelpers.TestStructExplicit + { + S0 = BitConverter.ToInt16(arrayBE, 0), + I0 = BitConverter.ToInt32(arrayBE, 2), + L0 = BitConverter.ToInt64(arrayBE, 6), + US0 = BitConverter.ToUInt16(arrayBE, 14), + UI0 = BitConverter.ToUInt32(arrayBE, 16), + UL0 = BitConverter.ToUInt64(arrayBE, 20), + S1 = BitConverter.ToInt16(arrayBE, 28), + I1 = BitConverter.ToInt32(arrayBE, 30), + L1 = BitConverter.ToInt64(arrayBE, 34), + US1 = BitConverter.ToUInt16(arrayBE, 42), + UI1 = BitConverter.ToUInt32(arrayBE, 44), + UL1 = BitConverter.ToUInt64(arrayBE, 48), + }; + if (BitConverter.IsLittleEndian) + { + readStruct.S0 = ReverseEndianness(readStruct.S0); + readStruct.I0 = ReverseEndianness(readStruct.I0); + readStruct.L0 = ReverseEndianness(readStruct.L0); + readStruct.US0 = ReverseEndianness(readStruct.US0); + readStruct.UI0 = ReverseEndianness(readStruct.UI0); + readStruct.UL0 = ReverseEndianness(readStruct.UL0); + readStruct.S1 = ReverseEndianness(readStruct.S1); + readStruct.I1 = ReverseEndianness(readStruct.I1); + readStruct.L1 = ReverseEndianness(readStruct.L1); + readStruct.US1 = ReverseEndianness(readStruct.US1); + readStruct.UI1 = ReverseEndianness(readStruct.UI1); + readStruct.UL1 = ReverseEndianness(readStruct.UL1); + } + } + } + } + + Assert.Equal(TestHelpers.testExplicitStruct, readStruct); + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void MeasureReverseEndianness() + { + var myArray = new int[1000]; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + for (int j = 0; j < myArray.Length; j++) + { + myArray[j] = ReverseEndianness(myArray[j]); + } + } + } + } + } + + [Benchmark(InnerIterationCount = InnerCount)] + private static void MeasureReverseUsingNtoH() + { + var myArray = new int[1000]; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + for (int j = 0; j < myArray.Length; j++) + { + myArray[j] = IPAddress.NetworkToHostOrder(myArray[j]); + } + } + } + } + } + } +} diff --git a/external/corefx/src/System.Memory/tests/Performance/System.Memory.Performance.Tests.csproj b/external/corefx/src/System.Memory/tests/Performance/System.Memory.Performance.Tests.csproj index cfb2b7fb80..c4b6188eab 100644 --- a/external/corefx/src/System.Memory/tests/Performance/System.Memory.Performance.Tests.csproj +++ b/external/corefx/src/System.Memory/tests/Performance/System.Memory.Performance.Tests.csproj @@ -9,9 +9,12 @@ + + + Common\System\PerfUtils.cs diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/CtorArray.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/CtorArray.cs new file mode 100644 index 0000000000..046398c076 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/CtorArray.cs @@ -0,0 +1,119 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using static System.TestHelpers; + +namespace System.MemoryTests +{ + // + // Tests for Memory.ctor(T[]) + // + // These tests will also exercise the matching codepaths in Memory.ctor(T[], int, int). This makes it easier to ensure + // that these parallel tests stay consistent, and avoid excess repetition in the files devoted to those specific overloads. + // + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void CtorArrayInt() + { + int[] a = { 91, 92, -93, 94 }; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(a); + memory.Validate(91, 92, -93, 94); + + memory = new ReadOnlyMemory(a, 0, a.Length); + memory.Validate(91, 92, -93, 94); + } + + [Fact] + public static void CtorArrayLong() + { + long[] a = { 91, -92, 93, 94, -95 }; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(a); + memory.Validate(91, -92, 93, 94, -95); + + memory = new ReadOnlyMemory(a, 0, a.Length); + memory.Validate(91, -92, 93, 94, -95); + } + + [Fact] + public static void CtorArrayObject() + { + object o1 = new object(); + object o2 = new object(); + object[] a = { o1, o2 }; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(a); + memory.ValidateReferenceType(o1, o2); + + memory = new ReadOnlyMemory(a, 0, a.Length); + memory.ValidateReferenceType(o1, o2); + } + + [Fact] + public static void CtorArrayZeroLength() + { + int[] empty = Array.Empty(); + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(empty); + memory.Validate(); + + memory = new ReadOnlyMemory(empty, 0, empty.Length); + memory.Validate(); + } + + [Fact] + public static void CtorArrayNullArray() + { + Assert.Throws(() => new ReadOnlyMemory(null)); + Assert.Throws(() => new ReadOnlyMemory(null, 0, 0)); + } + + [Fact] + public static void CtorArrayWrongValueType() + { + // Can pass variant array, if array type is a valuetype. + + uint[] a = { 42u, 0xffffffffu }; + int[] aAsIntArray = (int[])(object)a; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(aAsIntArray); + memory.Validate(42, -1); + + memory = new ReadOnlyMemory(aAsIntArray, 0, aAsIntArray.Length); + memory.Validate(42, -1); + } + + [Fact] + public static void CtorVariantArrayType() + { + // For ReadOnlyMemory, variant arrays are allowed for string to object + // and reference type to object. + + ReadOnlyMemory memory; + + string[] strArray = { "Hello" }; + memory = new ReadOnlyMemory(strArray); + memory.ValidateReferenceType("Hello"); + memory = new ReadOnlyMemory(strArray, 0, strArray.Length); + memory.ValidateReferenceType("Hello"); + + TestClass c1 = new TestClass(); + TestClass c2 = new TestClass(); + TestClass[] clsArray = { c1, c2 }; + memory = new ReadOnlyMemory(clsArray); + memory.ValidateReferenceType(c1, c2); + memory = new ReadOnlyMemory(clsArray, 0, clsArray.Length); + memory.ValidateReferenceType(c1, c2); + } + } +} + diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/CtorArrayIntInt.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/CtorArrayIntInt.cs new file mode 100644 index 0000000000..2ca4c20df1 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/CtorArrayIntInt.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + // + // Tests for MemoryTests.ctor(T[], int, int). If the test is not specific to this overload, consider putting it in CtorArray.cs instread. + // + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void CtorArrayWithStartAndLengthInt() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; + var memory = new ReadOnlyMemory(a, 3, 2); + memory.Validate(93, 94); + } + + [Fact] + public static void CtorArrayWithStartAndLengthLong() + { + long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; + var memory = new ReadOnlyMemory(a, 4, 3); + memory.Validate(94, 95, 96); + } + + [Fact] + public static void CtorArrayWithStartAndLengthRangeExtendsToEndOfArray() + { + long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; + var memory = new ReadOnlyMemory(a, 4, 5); + memory.Validate(94, 95, 96, 97, 98); + } + + [Fact] + public static void CtorArrayWithNegativeStartAndLength() + { + int[] a = new int[3]; + Assert.Throws(() => new ReadOnlyMemory(a, -1, 0)); + } + + [Fact] + public static void CtorArrayWithStartTooLargeAndLength() + { + int[] a = new int[3]; + Assert.Throws(() => new ReadOnlyMemory(a, 4, 0)); + } + + [Fact] + public static void CtorArrayWithStartAndNegativeLength() + { + int[] a = new int[3]; + Assert.Throws(() => new ReadOnlyMemory(a, 0, -1)); + } + + [Fact] + public static void CtorArrayWithStartAndLengthTooLarge() + { + int[] a = new int[3]; + Assert.Throws(() => new ReadOnlyMemory(a, 3, 1)); + Assert.Throws(() => new ReadOnlyMemory(a, 2, 2)); + Assert.Throws(() => new ReadOnlyMemory(a, 1, 3)); + Assert.Throws(() => new ReadOnlyMemory(a, 0, 4)); + Assert.Throws(() => new ReadOnlyMemory(a, int.MaxValue, int.MaxValue)); + } + + [Fact] + public static void CtorArrayWithStartAndLengthBothEqual() + { + // Valid for start to equal the array length. This returns an empty memory that starts "just past the array." + int[] a = { 91, 92, 93 }; + var memory = new ReadOnlyMemory(a, 3, 0); + memory.Validate(); + } + } +} + diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/DangerousTryGetArray.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/DangerousTryGetArray.cs new file mode 100644 index 0000000000..f6a9c7baf5 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/DangerousTryGetArray.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void MemoryDangerousTryGetArray() + { + int[] array = new int[10]; + ReadOnlyMemory memory = array; + Assert.True(memory.DangerousTryGetArray(out ArraySegment segment)); + Assert.Equal(array.Length, segment.Count); + + for (int i = segment.Offset; i < segment.Count + segment.Offset; i++) + { + Assert.Equal(array[i], segment.Array[i]); + } + } + + [Fact] + public static void OwnedMemoryTryGetArray() + { + int[] array = new int[10]; + OwnedMemory owner = new CustomMemoryForTest(array); + ReadOnlyMemory memory = owner.Memory; + Assert.True(memory.DangerousTryGetArray(out ArraySegment segment)); + Assert.Equal(array.Length, segment.Count); + + for (int i = segment.Offset; i < segment.Count + segment.Offset; i++) + { + Assert.Equal(array[i], segment.Array[i]); + } + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Empty.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Empty.cs new file mode 100644 index 0000000000..c53b3c6bbc --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Empty.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void Empty() + { + ReadOnlyMemory empty = ReadOnlyMemory.Empty; + Assert.True(empty.IsEmpty); + Assert.Equal(0, empty.Length); + } + + [Fact] + public static void IsEmpty() + { + ReadOnlyMemory empty = new int[0]; + Assert.True(empty.IsEmpty); + Assert.Equal(0, empty.Length); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Equality.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Equality.cs new file mode 100644 index 0000000000..a6dd5a9000 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Equality.cs @@ -0,0 +1,163 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using Xunit; + +#pragma warning disable 1718 //Comparison made to same variable; did you mean to compare something else? + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void EqualityTrue() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 2, 3); + var right = new ReadOnlyMemory(a, 2, 3); + + Assert.True(left.Equals(right)); + Assert.True(right.Equals(left)); + } + + [Fact] + public static void EqualityReflexivity() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 2, 3); + + Assert.True(left.Equals(left)); + } + + [Fact] + public static void EqualityIncludesLength() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 2, 1); + var right = new ReadOnlyMemory(a, 2, 3); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + + [Fact] + public static void EqualityIncludesBase() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 1, 3); + var right = new ReadOnlyMemory(a, 2, 3); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + + [Fact] + public static void EqualityComparesRangeNotContent() + { + var left = new ReadOnlyMemory(new int[] { 0, 1, 2 }, 1, 1); + var right = new ReadOnlyMemory(new int[] { 0, 1, 2 }, 1, 1); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + } + + [Fact] + public static void EmptyMemoryNotUnified() + { + var left = new ReadOnlyMemory(new int[0]); + var right = new ReadOnlyMemory(new int[0]); + + ReadOnlyMemory memoryFromNonEmptyArrayButWithZeroLength = new ReadOnlyMemory(new int[1] { 123 }).Slice(0, 0); + + Assert.False(left.Equals(right)); + Assert.False(right.Equals(left)); + + Assert.False(memoryFromNonEmptyArrayButWithZeroLength.Equals(left)); + Assert.False(left.Equals(memoryFromNonEmptyArrayButWithZeroLength)); + + // Empty property is equal + left = ReadOnlyMemory.Empty; + right = ReadOnlyMemory.Empty; + + Assert.True(left.Equals(right)); + Assert.True(right.Equals(left)); + } + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void MemoryReferencingSameMemoryAreEqualInEveryAspect(byte[] bytes, int start, int length) + { + var memory = new ReadOnlyMemory(bytes, start, length); + var pointingToSameMemory = new ReadOnlyMemory(bytes, start, length); + ReadOnlyMemory structCopy = memory; + + Assert.True(memory.Equals(pointingToSameMemory)); + Assert.True(pointingToSameMemory.Equals(memory)); + + Assert.True(memory.Equals(structCopy)); + Assert.True(structCopy.Equals(memory)); + } + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void MemoryOfEqualValuesAreNotEqual(byte[] bytes, int start, int length) + { + byte[] bytesCopy = bytes.ToArray(); + + var memory = new ReadOnlyMemory(bytes, start, length); + var ofSameValues = new ReadOnlyMemory(bytesCopy, start, length); + + Assert.False(memory.Equals(ofSameValues)); + Assert.False(ofSameValues.Equals(memory)); + } + + [Theory] + [MemberData(nameof(ValidArraySegments))] + public static void MemoryOfDifferentValuesAreNotEqual(byte[] bytes, int start, int length) + { + byte[] differentBytes = bytes.Select(value => ++value).ToArray(); + + var memory = new ReadOnlyMemory(bytes, start, length); + var ofDifferentValues = new ReadOnlyMemory(differentBytes, start, length); + + Assert.False(memory.Equals(ofDifferentValues)); + Assert.False(ofDifferentValues.Equals(memory)); + } + + public static IEnumerable ValidArraySegments + { + get + { + return new List + { + new object[] { new byte[1] { 0 }, 0, 1}, + new object[] { new byte[2] { 0, 0 }, 0, 2}, + new object[] { new byte[2] { 0, 0 }, 0, 1}, + new object[] { new byte[2] { 0, 0 }, 1, 1}, + new object[] { new byte[3] { 0, 0, 0 }, 0, 3}, + new object[] { new byte[3] { 0, 0, 0 }, 0, 2}, + new object[] { new byte[3] { 0, 0, 0 }, 1, 2}, + new object[] { new byte[3] { 0, 0, 0 }, 1, 1}, + new object[] { Enumerable.Range(0, 100000).Select(i => (byte)i).ToArray(), 0, 100000 } + }; + } + } + + public static IEnumerable FullArraySegments + { + get + { + return new List + { + new object[] { new byte[1] { 0 } }, + new object[] { new byte[2] { 0, 0 } }, + new object[] { new byte[3] { 0, 0, 0 } }, + new object[] { Enumerable.Range(0, 100000).Select(i => (byte)i).ToArray() } + }; + } + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/GetHashCode.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/GetHashCode.cs new file mode 100644 index 0000000000..1e53747c32 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/GetHashCode.cs @@ -0,0 +1,73 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void SameObjectsHaveSameHashCodes() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 2, 3); + var right = new ReadOnlyMemory(a, 2, 3); + + int[] b = { 1, 2, 3, 4, 5 }; + var different = new ReadOnlyMemory(b, 2, 3); + + Assert.Equal(left.GetHashCode(), right.GetHashCode()); + Assert.NotEqual(left.GetHashCode(), different.GetHashCode()); + } + + [Fact] + public static void HashCodeIncludesLength() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 2, 1); + var right = new ReadOnlyMemory(a, 2, 3); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void HashCodeIncludesBase() + { + int[] a = { 91, 92, 93, 94, 95 }; + var left = new ReadOnlyMemory(a, 1, 3); + var right = new ReadOnlyMemory(a, 2, 3); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void HashCodesDifferentForSameContent() + { + var left = new ReadOnlyMemory(new int[] { 0, 1, 2 }, 1, 1); + var right = new ReadOnlyMemory(new int[] { 0, 1, 2 }, 1, 1); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + } + + [Fact] + public static void EmptyMemoryHashCodeNotUnified() + { + var left = new ReadOnlyMemory(new int[0]); + var right = new ReadOnlyMemory(new int[0]); + + ReadOnlyMemory memoryFromNonEmptyArrayButWithZeroLength = new Memory(new int[1] { 123 }).Slice(0, 0); + + Assert.NotEqual(left.GetHashCode(), right.GetHashCode()); + Assert.NotEqual(left.GetHashCode(), memoryFromNonEmptyArrayButWithZeroLength.GetHashCode()); + Assert.NotEqual(right.GetHashCode(), memoryFromNonEmptyArrayButWithZeroLength.GetHashCode()); + + // Empty property hashcode is equal + left = ReadOnlyMemory.Empty; + right = ReadOnlyMemory.Empty; + + Assert.Equal(left.GetHashCode(), right.GetHashCode()); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/ImplicitConversion.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/ImplicitConversion.cs new file mode 100644 index 0000000000..205dfd28c3 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/ImplicitConversion.cs @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void CtorImplicitArray() + { + int[] intArray = { 19, -17 }; + CastReadOnly(intArray, 19, -17); + + long[] longArray = { 1, -3, 7, -15, 31 }; + CastReadOnly(longArray, 1, -3, 7, -15, 31); + + object o1 = new object(); + object o2 = new object(); + object o3 = new object(); + object o4 = new object(); + object[] objectArray = { o1, o2, o3, o4 }; + CastReadOnlyReference(objectArray, o1, o2, o3, o4); + } + + [Fact] + public static void CtorImplicitZeroLengthArray() + { + int[] emptyArray1 = Array.Empty(); + CastReadOnly(emptyArray1); + + int[] emptyArray2 = new int[0]; + CastReadOnly(emptyArray2); + } + + [Fact] + public static void CtorImplicitArraySegment() + { + int[] a = { 19, -17 }; + ArraySegment segmentInt = new ArraySegment(a, 1, 1); + CastReadOnly(segmentInt, -17); + + long[] b = { 1, -3, 7, -15, 31 }; + ArraySegment segmentLong = new ArraySegment(b, 1, 3); + CastReadOnly(segmentLong, -3, 7, -15); + + object o1 = new object(); + object o2 = new object(); + object o3 = new object(); + object o4 = new object(); + object[] c = { o1, o2, o3, o4 }; + ArraySegment segmentObject = new ArraySegment(c, 0, 2); + CastReadOnlyReference(segmentObject, o1, o2); + } + + [Fact] + public static void CtorImplicitZeroLengthArraySegment() + { + int[] empty = Array.Empty(); + ArraySegment emptySegment = new ArraySegment(empty); + CastReadOnly(emptySegment); + + int[] a = { 19, -17 }; + ArraySegment segmentInt = new ArraySegment(a, 1, 0); + CastReadOnly(segmentInt); + } + + private static void CastReadOnly(ReadOnlyMemory memory, params T[] expected) where T : struct, IEquatable + { + memory.Validate(expected); + } + + private static void CastReadOnlyReference(ReadOnlyMemory memory, params T[] expected) + { + memory.ValidateReferenceType(expected); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Retain.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Retain.cs new file mode 100644 index 0000000000..87dc45912f --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Retain.cs @@ -0,0 +1,142 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + + [Fact] + public static void MemoryRetainWithoutPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + ReadOnlyMemory memory = array; + MemoryHandle handle = memory.Retain(); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer == null); + } + handle.Dispose(); + } + + [Fact] + public static void MemoryRetainWithPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + ReadOnlyMemory memory = array; + MemoryHandle handle = memory.Retain(pin: true); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i], pointer[i]); + } + } + handle.Dispose(); + } + + [Fact] + public static void MemoryRetainWithPinningAndSlice() + { + int[] array = { 1, 2, 3, 4, 5 }; + ReadOnlyMemory memory = array; + memory = memory.Slice(1); + MemoryHandle handle = memory.Retain(pin: true); + ReadOnlySpan span = memory.Span; + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], pointer[i]); + } + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], span[i]); + } + } + handle.Dispose(); + } + + [Fact] + public static void OwnedMemoryRetainWithoutPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + OwnedMemory owner = new CustomMemoryForTest(array); + ReadOnlyMemory memory = owner.Memory; + MemoryHandle handle = memory.Retain(); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer == null); + } + handle.Dispose(); + } + + [Fact] + public static void OwnedMemoryRetainWithPinning() + { + int[] array = { 1, 2, 3, 4, 5 }; + OwnedMemory owner = new CustomMemoryForTest(array); + ReadOnlyMemory memory = owner.Memory; + MemoryHandle handle = memory.Retain(pin: true); + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i], pointer[i]); + } + } + handle.Dispose(); + } + + [ActiveIssue(24384, TargetFrameworkMonikers.UapAot)] + [Fact] + public static void OwnedMemoryRetainWithPinningAndSlice() + { + int[] array = { 1, 2, 3, 4, 5 }; + OwnedMemory owner = new CustomMemoryForTest(array); + ReadOnlyMemory memory = owner.Memory.Slice(1); + MemoryHandle handle = memory.Retain(pin: true); + ReadOnlySpan span = memory.Span; + unsafe + { + int* pointer = (int*)handle.PinnedPointer; + Assert.True(pointer != null); + + GC.Collect(); + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], pointer[i]); + } + + for (int i = 0; i < memory.Length; i++) + { + Assert.Equal(array[i + 1], span[i]); + } + } + handle.Dispose(); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Slice.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Slice.cs new file mode 100644 index 0000000000..edeeb9d53f --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Slice.cs @@ -0,0 +1,112 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System.Runtime.CompilerServices; +using System.Buffers; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void SliceWithStart() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + ReadOnlyMemory memory = new ReadOnlyMemory(a).Slice(6); + Assert.Equal(4, memory.Length); + Assert.True(Unsafe.AreSame(ref a[6], ref memory.Span.DangerousGetPinnableReference())); + + OwnedMemory owner = new CustomMemoryForTest(a); + ReadOnlyMemory memoryFromOwner = ((ReadOnlyMemory)owner.Memory).Slice(6); + + Assert.Equal(4, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[6], ref memoryFromOwner.Span.DangerousGetPinnableReference())); + } + + [Fact] + public static void SliceWithStartPastEnd() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + ReadOnlyMemory memory = new ReadOnlyMemory(a).Slice(a.Length); + Assert.Equal(0, memory.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memory.Span.DangerousGetPinnableReference(), 1))); + + OwnedMemory owner = new CustomMemoryForTest(a); + ReadOnlyMemory memoryFromOwner = ((ReadOnlyMemory)owner.Memory).Slice(a.Length); + + Assert.Equal(0, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memoryFromOwner.Span.DangerousGetPinnableReference(), 1))); + } + + [Fact] + public static void SliceWithStartAndLength() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + ReadOnlyMemory memory = new ReadOnlyMemory(a).Slice(3, 5); + Assert.Equal(5, memory.Length); + Assert.True(Unsafe.AreSame(ref a[3], ref memory.Span.DangerousGetPinnableReference())); + + OwnedMemory owner = new CustomMemoryForTest(a); + ReadOnlyMemory memoryFromOwner = ((ReadOnlyMemory)owner.Memory).Slice(3, 5); + + Assert.Equal(5, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[3], ref memoryFromOwner.Span.DangerousGetPinnableReference())); + } + + [Fact] + public static void SliceWithStartAndLengthUpToEnd() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + ReadOnlyMemory memory = new ReadOnlyMemory(a).Slice(4, 6); + Assert.Equal(6, memory.Length); + Assert.True(Unsafe.AreSame(ref a[4], ref memory.Span.DangerousGetPinnableReference())); + + OwnedMemory owner = new CustomMemoryForTest(a); + ReadOnlyMemory memoryFromOwner = ((ReadOnlyMemory)owner.Memory).Slice(4, 6); + + Assert.Equal(6, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[4], ref memoryFromOwner.Span.DangerousGetPinnableReference())); + } + + [Fact] + public static void SliceWithStartAndLengthPastEnd() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + ReadOnlyMemory memory = new ReadOnlyMemory(a).Slice(a.Length, 0); + Assert.Equal(0, memory.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memory.Span.DangerousGetPinnableReference(), 1))); + + OwnedMemory owner = new CustomMemoryForTest(a); + ReadOnlyMemory memoryFromOwner = ((ReadOnlyMemory)owner.Memory).Slice(a.Length, 0); + + Assert.Equal(0, memoryFromOwner.Length); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref memoryFromOwner.Span.DangerousGetPinnableReference(), 1))); + } + + [Fact] + public static void SliceRangeChecks() + { + int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; + Assert.Throws(() => new ReadOnlyMemory(a).Slice(-1)); + Assert.Throws(() => new ReadOnlyMemory(a).Slice(a.Length + 1)); + Assert.Throws(() => new ReadOnlyMemory(a).Slice(-1, 0)); + Assert.Throws(() => new ReadOnlyMemory(a).Slice(0, a.Length + 1)); + Assert.Throws(() => new ReadOnlyMemory(a).Slice(2, a.Length + 1 - 2)); + Assert.Throws(() => new ReadOnlyMemory(a).Slice(a.Length + 1, 0)); + Assert.Throws(() => new ReadOnlyMemory(a).Slice(a.Length, 1)); + + OwnedMemory owner = new CustomMemoryForTest(a); + ReadOnlyMemory memory = owner.Memory; + + Assert.Throws(() => memory.Slice(-1)); + Assert.Throws(() => memory.Slice(a.Length + 1)); + Assert.Throws(() => memory.Slice(-1, 0)); + Assert.Throws(() => memory.Slice(0, a.Length + 1)); + Assert.Throws(() => memory.Slice(2, a.Length + 1 - 2)); + Assert.Throws(() => memory.Slice(a.Length + 1, 0)); + Assert.Throws(() => memory.Slice(a.Length, 1)); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Span.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Span.cs new file mode 100644 index 0000000000..bd125929f7 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/Span.cs @@ -0,0 +1,98 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void SpanFromCtorArrayInt() + { + int[] a = { 91, 92, -93, 94 }; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(a); + memory.Span.Validate(91, 92, -93, 94); + + memory = new ReadOnlyMemory(a, 0, a.Length); + memory.Span.Validate(91, 92, -93, 94); + + OwnedMemory owner = new CustomMemoryForTest(a); + ((ReadOnlyMemory)owner.Memory).Span.Validate(91, 92, -93, 94); + } + + [Fact] + public static void SpanFromCtorArrayLong() + { + long[] a = { 91, -92, 93, 94, -95 }; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(a); + memory.Span.Validate(91, -92, 93, 94, -95); + + memory = new ReadOnlyMemory(a, 0, a.Length); + memory.Span.Validate(91, -92, 93, 94, -95); + + OwnedMemory owner = new CustomMemoryForTest(a); + ((ReadOnlyMemory)owner.Memory).Span.Validate(91, -92, 93, 94, -95); + } + + [Fact] + public static void SpanFromCtorArrayObject() + { + object o1 = new object(); + object o2 = new object(); + object[] a = { o1, o2 }; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(a); + memory.Span.ValidateReferenceType(o1, o2); + + memory = new ReadOnlyMemory(a, 0, a.Length); + memory.Span.ValidateReferenceType(o1, o2); + + OwnedMemory owner = new CustomMemoryForTest(a); + ((ReadOnlyMemory)owner.Memory).Span.ValidateReferenceType(o1, o2); + } + + [Fact] + public static void SpanFromCtorArrayZeroLength() + { + int[] empty = Array.Empty(); + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(empty); + memory.Span.Validate(); + + memory = new ReadOnlyMemory(empty, 0, empty.Length); + memory.Span.Validate(); + + OwnedMemory owner = new CustomMemoryForTest(empty); + ((ReadOnlyMemory)owner.Memory).Span.Validate(); + } + + [Fact] + public static void SpanFromCtorArrayWrongValueType() + { + // Can pass variant array, if array type is a valuetype. + + uint[] a = { 42u, 0xffffffffu }; + int[] aAsIntArray = (int[])(object)a; + ReadOnlyMemory memory; + + memory = new ReadOnlyMemory(aAsIntArray); + memory.Span.Validate(42, -1); + + memory = new ReadOnlyMemory(aAsIntArray, 0, aAsIntArray.Length); + memory.Span.Validate(42, -1); + + OwnedMemory owner = new CustomMemoryForTest(aAsIntArray); + ((ReadOnlyMemory)owner.Memory).Span.Validate(42, -1); + } + + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlyMemory/ToArray.cs b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/ToArray.cs new file mode 100644 index 0000000000..0d5d71dac6 --- /dev/null +++ b/external/corefx/src/System.Memory/tests/ReadOnlyMemory/ToArray.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.MemoryTests +{ + public static partial class ReadOnlyMemoryTests + { + [Fact] + public static void ToArray1() + { + int[] a = { 91, 92, 93 }; + var memory = new ReadOnlyMemory(a); + int[] copy = memory.ToArray(); + Assert.Equal(a, copy); + Assert.NotSame(a, copy); + } + + [Fact] + public static void ToArrayWithIndex() + { + int[] a = { 91, 92, 93, 94, 95 }; + var memory = new Memory(a); + int[] copy = memory.Slice(2).ToArray(); + + Assert.Equal(new int[] { 93, 94, 95 }, copy); + } + + [Fact] + public static void ToArrayWithIndexAndLength() + { + int[] a = { 91, 92, 93 }; + var memory = new Memory(a, 1, 1); + int[] copy = memory.ToArray(); + Assert.Equal(new int[] { 92 }, copy); + } + + [Fact] + public static void ToArrayEmpty() + { + ReadOnlyMemory memory = ReadOnlyMemory.Empty; + int[] copy = memory.ToArray(); + Assert.Equal(0, copy.Length); + } + } +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsBytes.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsBytes.cs index 18e6775e86..9493f7a1b2 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsBytes.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsBytes.cs @@ -16,7 +16,7 @@ namespace System.SpanTests ReadOnlySpan span = new ReadOnlySpan(a); ReadOnlySpan asBytes = span.AsBytes(); - Assert.True(Unsafe.AreSame(ref Unsafe.As(ref span.DangerousGetPinnableReference()), ref asBytes.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref Unsafe.As(ref span.DangerousGetPinnableReference()), ref asBytes.DangerousGetPinnableReference())); asBytes.Validate(0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88); } @@ -24,7 +24,7 @@ namespace System.SpanTests public static void AsBytesContainsReferences() { ReadOnlySpan span = new ReadOnlySpan(Array.Empty()); - AssertThrows(span, (_span) => _span.AsBytes().DontBox()); + TestHelpers.AssertThrows(span, (_span) => _span.AsBytes().DontBox()); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs index 5281c96870..76e11345ab 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsReadOnlySpan.cs @@ -3,36 +3,43 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.CompilerServices; namespace System.SpanTests { public static partial class ReadOnlySpanTests { [Fact] - public static void ArrayAsReadOnlySpan() + public static void IntArrayAsReadOnlySpan() { int[] a = { 19, -17 }; ReadOnlySpan spanInt = a.AsReadOnlySpan(); - spanInt.Validate(19, -17); + spanInt.Validate(19, -17); + } + [Fact] + public static void LongArrayAsReadOnlySpan() + { long[] b = { 1, -3, 7, -15, 31 }; ReadOnlySpan spanLong = b.AsReadOnlySpan(); - spanLong.Validate(1, -3, 7, -15, 31); + spanLong.Validate(1, -3, 7, -15, 31); + } + [ActiveIssue(23952, TargetFrameworkMonikers.UapAot)] + [Fact] + public static void ObjectArrayAsReadOnlySpan() + { object o1 = new object(); object o2 = new object(); object[] c = { o1, o2 }; ReadOnlySpan spanObject = c.AsReadOnlySpan(); - spanObject.Validate(o1, o2); + spanObject.ValidateReferenceType(o1, o2); } [Fact] public static void NullArrayAsReadOnlySpan() { int[] a = null; - ReadOnlySpan span; - AssertThrows(span, _span => _span = a.AsReadOnlySpan()); + Assert.Throws(() => a.AsReadOnlySpan().DontBox()); } [Fact] @@ -40,22 +47,30 @@ namespace System.SpanTests { int[] empty = Array.Empty(); ReadOnlySpan span = empty.AsReadOnlySpan(); - span.Validate(); + span.Validate(); } [Fact] - public static void ArraySegmentAsSpan() + public static void IntArraySegmentAsSpan() { int[] a = { 19, -17 }; ArraySegment segmentInt = new ArraySegment(a, 1, 1); ReadOnlySpan spanInt = segmentInt.AsReadOnlySpan(); - spanInt.Validate(-17); + spanInt.Validate(-17); + } + [Fact] + public static void LongArraySegmentAsSpan() + { long[] b = { 1, -3, 7, -15, 31 }; ArraySegment segmentLong = new ArraySegment(b, 1, 3); ReadOnlySpan spanLong = segmentLong.AsReadOnlySpan(); - spanLong.Validate(-3, 7, -15); + spanLong.Validate(-3, 7, -15); + } + [Fact] + public static void ObjectArraySegmentAsSpan() + { object o1 = new object(); object o2 = new object(); object o3 = new object(); @@ -63,7 +78,7 @@ namespace System.SpanTests object[] c = { o1, o2, o3, o4 }; ArraySegment segmentObject = new ArraySegment(c, 0, 2); ReadOnlySpan spanObject = segmentObject.AsReadOnlySpan(); - spanObject.Validate(o1, o2); + spanObject.ValidateReferenceType(o1, o2); } [Fact] @@ -72,12 +87,37 @@ namespace System.SpanTests int[] empty = Array.Empty(); ArraySegment emptySegment = new ArraySegment(empty); ReadOnlySpan span = emptySegment.AsReadOnlySpan(); - span.Validate(); + span.Validate(); int[] a = { 19, -17 }; ArraySegment segmentInt = new ArraySegment(a, 1, 0); ReadOnlySpan spanInt = segmentInt.AsReadOnlySpan(); - spanInt.Validate(); + spanInt.Validate(); + } + + [Fact] + public static void StringAsReadOnlySpanNullary() + { + string s = "Hello"; + ReadOnlySpan span = s.AsReadOnlySpan(); + char[] expected = s.ToCharArray(); + span.Validate(expected); + } + + [Fact] + public static void StringAsReadOnlySpanEmptyString() + { + string s = ""; + ReadOnlySpan span = s.AsReadOnlySpan(); + char[] expected = s.ToCharArray(); + span.Validate(expected); + } + + [Fact] + public static void StringAsReadOnlySpanNullChecked() + { + string s = null; + Assert.Throws(() => s.AsReadOnlySpan().DontBox()); } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsSpan.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsSpan.cs deleted file mode 100644 index 37aaf54cfb..0000000000 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/AsSpan.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; -using System.Runtime.CompilerServices; - -namespace System.SpanTests -{ - public static partial class ReadOnlySpanTests - { - [Fact] - public static void StringAsSpanNullary() - { - string s = "Hello"; - ReadOnlySpan span = s.AsReadOnlySpan(); - char[] expected = s.ToCharArray(); - span.Validate(expected); - } - - [Fact] - public static void StringAsSpanEmptyString() - { - string s = ""; - ReadOnlySpan span = s.AsReadOnlySpan(); - char[] expected = s.ToCharArray(); - span.Validate(expected); - } - - [Fact] - public static void StringAsSpanNullChecked() - { - string s = null; - Assert.Throws(() => s.AsReadOnlySpan().DontBox()); - } - } -} diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CopyTo.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CopyTo.cs index 92036a72c3..4dd30a179d 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CopyTo.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CopyTo.cs @@ -92,7 +92,7 @@ namespace System.SpanTests int[] dst = { 99, 100 }; ReadOnlySpan srcSpan = new ReadOnlySpan(src); - AssertThrows(srcSpan, (_srcSpan) => _srcSpan.CopyTo(dst)); + TestHelpers.AssertThrows(srcSpan, (_srcSpan) => _srcSpan.CopyTo(dst)); int[] expected = { 99, 100 }; Assert.Equal(expected, dst); // CopyTo() checks for sufficient space before doing any copying. } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArray.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArray.cs index eedc15b9fa..53a7a70b86 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArray.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArray.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Xunit; +using static System.TestHelpers; namespace System.SpanTests { @@ -21,13 +22,10 @@ namespace System.SpanTests ReadOnlySpan span; span = new ReadOnlySpan(a); - span.Validate(91, 92, -93, 94); - - span = new ReadOnlySpan(a, 0); - span.Validate(91, 92, -93, 94); + span.Validate(91, 92, -93, 94); span = new ReadOnlySpan(a, 0, a.Length); - span.Validate(91, 92, -93, 94); + span.Validate(91, 92, -93, 94); } [Fact] @@ -37,13 +35,10 @@ namespace System.SpanTests ReadOnlySpan span; span = new ReadOnlySpan(a); - span.Validate(91, -92, 93, 94, -95); - - span = new ReadOnlySpan(a, 0); - span.Validate(91, -92, 93, 94, -95); + span.Validate(91, -92, 93, 94, -95); span = new ReadOnlySpan(a, 0, a.Length); - span.Validate(91, -92, 93, 94, -95); + span.Validate(91, -92, 93, 94, -95); } [Fact] @@ -55,13 +50,10 @@ namespace System.SpanTests ReadOnlySpan span; span = new ReadOnlySpan(a); - span.Validate(o1, o2); - - span = new ReadOnlySpan(a, 0); - span.Validate(o1, o2); + span.ValidateReferenceType(o1, o2); span = new ReadOnlySpan(a, 0, a.Length); - span.Validate(o1, o2); + span.ValidateReferenceType(o1, o2); } [Fact] @@ -71,21 +63,17 @@ namespace System.SpanTests ReadOnlySpan span; span = new ReadOnlySpan(empty); - span.Validate(); - - span = new ReadOnlySpan(empty, 0); - span.Validate(); + span.Validate(); span = new ReadOnlySpan(empty, 0, empty.Length); - span.Validate(); + span.Validate(); } [Fact] public static void CtorArrayNullArray() { - Assert.Throws(() => new ReadOnlySpan((int[])null).DontBox()); - Assert.Throws(() => new ReadOnlySpan((int[])null, 0).DontBox()); - Assert.Throws(() => new ReadOnlySpan((int[])null, 0, 0).DontBox()); + Assert.Throws(() => new ReadOnlySpan(null).DontBox()); + Assert.Throws(() => new ReadOnlySpan(null, 0, 0).DontBox()); } [Fact] @@ -98,13 +86,10 @@ namespace System.SpanTests ReadOnlySpan span; span = new ReadOnlySpan(aAsIntArray); - span.Validate(42, -1); - - span = new ReadOnlySpan(aAsIntArray, 0); - span.Validate(42, -1); + span.Validate(42, -1); span = new ReadOnlySpan(aAsIntArray, 0, aAsIntArray.Length); - span.Validate(42, -1); + span.Validate(42, -1); } [Fact] @@ -117,21 +102,17 @@ namespace System.SpanTests string[] strArray = { "Hello" }; span = new ReadOnlySpan(strArray); - span.Validate("Hello"); - span = new ReadOnlySpan(strArray, 0); - span.Validate("Hello"); + span.ValidateReferenceType("Hello"); span = new ReadOnlySpan(strArray, 0, strArray.Length); - span.Validate("Hello"); + span.ValidateReferenceType("Hello"); TestClass c1 = new TestClass(); TestClass c2 = new TestClass(); TestClass[] clsArray = { c1, c2 }; span = new ReadOnlySpan(clsArray); - span.Validate(c1, c2); - span = new ReadOnlySpan(clsArray, 0); - span.Validate(c1, c2); + span.ValidateReferenceType(c1, c2); span = new ReadOnlySpan(clsArray, 0, clsArray.Length); - span.Validate(c1, c2); + span.ValidateReferenceType(c1, c2); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayInt.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayInt.cs deleted file mode 100644 index c63094c58d..0000000000 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayInt.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; - -namespace System.SpanTests -{ - // - // Tests for Span.ctor(T[], int). If the test is not specific to this overload, consider putting it in CtorArray.cs instread. - // - public static partial class ReadOnlySpanTests - { - [Fact] - public static void CtorArrayInt1() - { - int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; - ReadOnlySpan span = new ReadOnlySpan(a, 3); - span.Validate(93, 94, 95, 96, 97, 98); - } - - [Fact] - public static void CtorArrayInt2() - { - long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; - ReadOnlySpan span = new ReadOnlySpan(a, 3); - span.Validate(93, 94, 95, 96, 97, 98); - } - - [Fact] - public static void CtorArrayIntNegativeStart() - { - int[] a = new int[3]; - Assert.Throws(() => new ReadOnlySpan(a, -1).DontBox()); - } - - [Fact] - public static void CtorArrayIntStartTooLarge() - { - int[] a = new int[3]; - Assert.Throws(() => new ReadOnlySpan(a, 4).DontBox()); - } - - [Fact] - public static void CtorArrayIntStartEqualsLength() - { - // Valid for start to equal the array length. This returns an empty span that starts "just past the array." - int[] a = { 91, 92, 93 }; - ReadOnlySpan span = new ReadOnlySpan(a, 3); - span.Validate(); - } - } -} - diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayIntInt.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayIntInt.cs index 518da9d1eb..b29198cfbb 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayIntInt.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorArrayIntInt.cs @@ -16,7 +16,7 @@ namespace System.SpanTests { int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; ReadOnlySpan span = new ReadOnlySpan(a, 3, 2); - span.Validate(93, 94); + span.Validate(93, 94); } [Fact] @@ -24,7 +24,7 @@ namespace System.SpanTests { long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; ReadOnlySpan span = new ReadOnlySpan(a, 4, 3); - span.Validate(94, 95, 96); + span.Validate(94, 95, 96); } [Fact] @@ -32,7 +32,7 @@ namespace System.SpanTests { long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; ReadOnlySpan span = new ReadOnlySpan(a, 4, 5); - span.Validate(94, 95, 96, 97, 98); + span.Validate(94, 95, 96, 97, 98); } [Fact] @@ -73,7 +73,7 @@ namespace System.SpanTests // Valid for start to equal the array length. This returns an empty span that starts "just past the array." int[] a = { 91, 92, 93 }; ReadOnlySpan span = new ReadOnlySpan(a, 3, 0); - span.Validate(); + span.Validate(); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorPointerInt.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorPointerInt.cs index 1851b6d770..3cf399b055 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorPointerInt.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/CtorPointerInt.cs @@ -20,8 +20,8 @@ namespace System.SpanTests fixed (int *pa = a) { ReadOnlySpan span = new ReadOnlySpan(pa, 3); - span.Validate(90, 91, 92); - Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(pa), ref span.DangerousGetPinnableReference())); + span.Validate(90, 91, 92); + Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(pa), ref span.DangerousGetPinnableReference())); } } } @@ -32,8 +32,8 @@ namespace System.SpanTests unsafe { ReadOnlySpan span = new ReadOnlySpan((void*)null, 0); - span.Validate(); - Assert.True(Unsafe.AreSame(ref Unsafe.AsRef((void*)null), ref span.DangerousGetPinnableReference())); + span.Validate(); + Assert.True(Unsafe.AreSame(ref Unsafe.AsRef((void*)null), ref span.DangerousGetPinnableReference())); } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousCreate.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousCreate.cs index 9346ef85f3..fd1be1656b 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousCreate.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousCreate.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; +using static System.TestHelpers; namespace System.SpanTests { @@ -13,17 +13,19 @@ namespace System.SpanTests [Fact] public static void DangerousCreate1() { - TestClass testClass = new TestClass(); - testClass.C0 = 'a'; - testClass.C1 = 'b'; - testClass.C2 = 'c'; - testClass.C3 = 'd'; - testClass.C4 = 'e'; + TestClass testClass = new TestClass + { + C0 = 'a', + C1 = 'b', + C2 = 'c', + C3 = 'd', + C4 = 'e' + }; ReadOnlySpan span = ReadOnlySpan.DangerousCreate(testClass, ref testClass.C1, 3); - span.Validate('b', 'c', 'd'); + span.Validate('b', 'c', 'd'); ref char pc1 = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref testClass.C1, ref pc1)); + Assert.True(Unsafe.AreSame(ref testClass.C1, ref pc1)); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousGetPinnableReference.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousGetPinnableReference.cs index 4fc1796955..9f93501235 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousGetPinnableReference.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/DangerousGetPinnableReference.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; +using static System.TestHelpers; namespace System.SpanTests { @@ -16,7 +16,7 @@ namespace System.SpanTests int[] a = { 91, 92, 93, 94, 95 }; ReadOnlySpan span = new ReadOnlySpan(a, 1, 3); ref int pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref a[1], ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref a[1], ref pinnableReference)); } [Fact] @@ -29,7 +29,7 @@ namespace System.SpanTests ReadOnlySpan span = new ReadOnlySpan(a, a.Length, 0); ref int pinnableReference = ref span.DangerousGetPinnableReference(); ref int expected = ref Unsafe.Add(ref a[a.Length - 1], 1); - Assert.True(Unsafe.AreSame(ref expected, ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref expected, ref pinnableReference)); } [Fact] @@ -40,7 +40,7 @@ namespace System.SpanTests int i = 42; ReadOnlySpan span = new ReadOnlySpan(&i, 1); ref int pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref i, ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref i, ref pinnableReference)); } } @@ -51,7 +51,7 @@ namespace System.SpanTests ReadOnlySpan span = ReadOnlySpan.DangerousCreate(testClass, ref testClass.C1, 3); ref char pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref testClass.C1, ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref testClass.C1, ref pinnableReference)); } [Fact] @@ -61,7 +61,7 @@ namespace System.SpanTests { ReadOnlySpan span = ReadOnlySpan.Empty; ref int pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(null), ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(null), ref pinnableReference)); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/Empty.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/Empty.cs index 11ebb2b27c..0af910dfec 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/Empty.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/Empty.cs @@ -19,7 +19,7 @@ namespace System.SpanTests { ref int expected = ref Unsafe.AsRef(null); ref int actual = ref empty.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref expected, ref actual)); + Assert.True(Unsafe.AreSame(ref expected, ref actual)); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.T.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.T.cs index 7e1cdbf2a0..3ace67ee0e 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.T.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.T.cs @@ -80,7 +80,7 @@ namespace System.SpanTests foreach (TInt elem in a) { int numCompares = log.CountCompares(elem.Value, 9999); - Assert.True(numCompares == 1); + Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.byte.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.byte.cs index 1e98500187..09182a4bc1 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.byte.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/IndexOf.byte.cs @@ -193,7 +193,7 @@ namespace System.SpanTests } var found = span[index]; - Assert.Equal((byte)expectResult, (byte)found); + Assert.Equal((byte)expectResult, found); Assert.Equal(expectIndex, index); } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/NonPortableCast.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/NonPortableCast.cs index 12af06bf4a..2a360a205c 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/NonPortableCast.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/NonPortableCast.cs @@ -24,14 +24,14 @@ namespace System.SpanTests public static void PortableCastToTypeContainsReferences() { ReadOnlySpan span = new ReadOnlySpan(Array.Empty()); - AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); + TestHelpers.AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); } [Fact] public static void PortableCastFromTypeContainsReferences() { ReadOnlySpan span = new ReadOnlySpan(Array.Empty()); - AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); + TestHelpers.AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/Overflow.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/Overflow.cs index 6c42890253..dc9ed088e7 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/Overflow.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/Overflow.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; namespace System.SpanTests @@ -41,7 +40,7 @@ namespace System.SpanTests int bigIndex = checked(GuidTwoGiBLimit + 1); uint byteOffset = checked((uint)bigIndex * (uint)sizeof(Guid)); - Assert.True(byteOffset > (uint)int.MaxValue); // Make sure byteOffset actually overflows 2Gb, or this test is pointless. + Assert.True(byteOffset > int.MaxValue); // Make sure byteOffset actually overflows 2Gb, or this test is pointless. Guid expectedGuid = Guid.NewGuid(); ref Guid expected = ref Unsafe.Add(ref memory, bigIndex); expected = expectedGuid; diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/SequenceEqual.T.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/SequenceEqual.T.cs index d2d9c91d8e..45571867d6 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/SequenceEqual.T.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/SequenceEqual.T.cs @@ -64,7 +64,7 @@ namespace System.SpanTests foreach (TInt elem in first) { int numCompares = log.CountCompares(elem.Value, elem.Value); - Assert.True(numCompares == 1); + Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/Slice.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/Slice.cs index 1760b436d0..5efa1f1b3e 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/Slice.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/Slice.cs @@ -15,7 +15,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; ReadOnlySpan span = new ReadOnlySpan(a).Slice(6); Assert.Equal(4, span.Length); - Assert.True(Unsafe.AreSame(ref a[6], ref span.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref a[6], ref span.DangerousGetPinnableReference())); } [Fact] @@ -24,7 +24,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; ReadOnlySpan span = new ReadOnlySpan(a).Slice(a.Length); Assert.Equal(0, span.Length); - Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); } [Fact] @@ -33,7 +33,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; ReadOnlySpan span = new ReadOnlySpan(a).Slice(3, 5); Assert.Equal(5, span.Length); - Assert.True(Unsafe.AreSame(ref a[3], ref span.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref a[3], ref span.DangerousGetPinnableReference())); } [Fact] @@ -42,7 +42,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; ReadOnlySpan span = new ReadOnlySpan(a).Slice(4, 6); Assert.Equal(6, span.Length); - Assert.True(Unsafe.AreSame(ref a[4], ref span.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref a[4], ref span.DangerousGetPinnableReference())); } [Fact] @@ -51,7 +51,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; ReadOnlySpan span = new ReadOnlySpan(a).Slice(a.Length, 0); Assert.Equal(0, span.Length); - Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); } [Fact] diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/StartsWith.T.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/StartsWith.T.cs index 221fada56d..7d3771de35 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/StartsWith.T.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/StartsWith.T.cs @@ -85,7 +85,7 @@ namespace System.SpanTests foreach (TInt elem in first) { int numCompares = log.CountCompares(elem.Value, elem.Value); - Assert.True(numCompares == 1); + Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/TestHelpers.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/TestHelpers.cs deleted file mode 100644 index bbeba43e57..0000000000 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/TestHelpers.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; -using System.Runtime.InteropServices; - -namespace System.SpanTests -{ - public static partial class ReadOnlySpanTests - { - private static void Validate(this ReadOnlySpan span, params T[] expected) - { - bool isValueType = default(T) != null || Nullable.GetUnderlyingType(typeof(T)) != null; - Assert.Equal(span.Length, expected.Length); - for (int i = 0; i < expected.Length; i++) - { - T actual = span[i]; - if (isValueType) - Assert.Equal(expected[i], actual); - else - Assert.Same(expected[i], actual); - } - - object ignore; - AssertThrows(span, (_span) => ignore = _span[expected.Length]); - } - - private delegate void AssertThrowsAction(ReadOnlySpan span); - - // Cannot use standard Assert.Throws() when testing Span - Span and closures don't get along. - private static void AssertThrows(ReadOnlySpan span, AssertThrowsAction action) where E:Exception - { - try - { - action(span); - Assert.False(true, "Expected exception: " + typeof(E).GetType()); - } - catch (E) - { - } - catch (Exception wrongException) - { - Assert.False(true, "Wrong exception thrown: Expected " + typeof(E).GetType() + ": Actual: " + wrongException.GetType()); - } - } - - // - // The innocent looking construct: - // - // Assert.Throws( () => new Span() ); - // - // generates a hidden box of the Span as the return value of the lambda. This makes the IL illegal and unloadable on - // runtimes that enforce the actual Span rules (never mind that we expect never to reach the box instruction...) - // - // The workaround is to code it like this: - // - // Assert.Throws( () => new Span().DontBox() ); - // - // which turns the lambda return type back to "void" and eliminates the troublesome box instruction. - // - private static void DontBox(this ReadOnlySpan span) - { - // This space intentionally left blank. - } - - [StructLayout(LayoutKind.Sequential)] - private sealed class TestClass - { - private double _d; - public char C0; - public char C1; - public char C2; - public char C3; - public char C4; - } - } -} - diff --git a/external/corefx/src/System.Memory/tests/ReadOnlySpan/ToArray.cs b/external/corefx/src/System.Memory/tests/ReadOnlySpan/ToArray.cs index 8053ced3be..3c1a6c7646 100644 --- a/external/corefx/src/System.Memory/tests/ReadOnlySpan/ToArray.cs +++ b/external/corefx/src/System.Memory/tests/ReadOnlySpan/ToArray.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.CompilerServices; namespace System.SpanTests { @@ -19,6 +18,25 @@ namespace System.SpanTests Assert.NotSame(a, copy); } + [Fact] + public static void ToArrayWithIndex() + { + int[] a = { 91, 92, 93, 94, 95 }; + var span = new Span(a); + int[] copy = span.Slice(2).ToArray(); + + Assert.Equal(new int[] { 93, 94, 95 }, copy); + } + + [Fact] + public static void ToArrayWithIndexAndLength() + { + int[] a = { 91, 92, 93 }; + var span = new Span(a, 1, 1); + int[] copy = span.ToArray(); + Assert.Equal(new int[] { 92 }, copy); + } + [Fact] public static void ToArrayEmpty() { diff --git a/external/corefx/src/System.Memory/tests/Span/AsBytes.cs b/external/corefx/src/System.Memory/tests/Span/AsBytes.cs index 7603ac7b88..0eabb23aba 100644 --- a/external/corefx/src/System.Memory/tests/Span/AsBytes.cs +++ b/external/corefx/src/System.Memory/tests/Span/AsBytes.cs @@ -24,7 +24,7 @@ namespace System.SpanTests public static void AsBytesContainsReferences() { Span span = new Span(Array.Empty()); - AssertThrows(span, (_span) => _span.AsBytes().DontBox()); + TestHelpers.AssertThrows(span, (_span) => _span.AsBytes().DontBox()); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/AsSpan.cs b/external/corefx/src/System.Memory/tests/Span/AsSpan.cs index ce7f33451a..8413a454a0 100644 --- a/external/corefx/src/System.Memory/tests/Span/AsSpan.cs +++ b/external/corefx/src/System.Memory/tests/Span/AsSpan.cs @@ -3,28 +3,35 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.CompilerServices; namespace System.SpanTests { public static partial class SpanTests { [Fact] - public static void ArrayAsSpan() + public static void IntArrayAsSpan() { int[] a = { 91, 92, -93, 94 }; Span spanInt = a.AsSpan(); - spanInt.Validate(91, 92, -93, 94); + spanInt.Validate(91, 92, -93, 94); + } + [Fact] + public static void LongArrayAsSpan() + { long[] b = { 91, -92, 93, 94, -95 }; Span spanLong = b.AsSpan(); - spanLong.Validate(91, -92, 93, 94, -95); + spanLong.Validate(91, -92, 93, 94, -95); + } + [Fact] + public static void ObjectArrayAsSpan() + { object o1 = new object(); object o2 = new object(); object[] c = { o1, o2 }; Span spanObject = c.AsSpan(); - spanObject.Validate(o1, o2); + spanObject.ValidateReferenceType(o1, o2); } [Fact] @@ -32,22 +39,30 @@ namespace System.SpanTests { int[] empty = Array.Empty(); Span span = empty.AsSpan(); - span.Validate(); + span.Validate(); } [Fact] - public static void ArraySegmentAsSpan() + public static void IntArraySegmentAsSpan() { int[] a = { 91, 92, -93, 94 }; ArraySegment segmentInt = new ArraySegment(a, 1, 2); Span spanInt = segmentInt.AsSpan(); - spanInt.Validate(92, -93); + spanInt.Validate(92, -93); + } + [Fact] + public static void LongArraySegmentAsSpan() + { long[] b = { 91, -92, 93, 94, -95 }; ArraySegment segmentLong = new ArraySegment(b, 1, 3); Span spanLong = segmentLong.AsSpan(); - spanLong.Validate(-92, 93, 94); + spanLong.Validate(-92, 93, 94); + } + [Fact] + public static void ObjectArraySegmentAsSpan() + { object o1 = new object(); object o2 = new object(); object o3 = new object(); @@ -55,7 +70,7 @@ namespace System.SpanTests object[] c = { o1, o2, o3, o4 }; ArraySegment segmentObject = new ArraySegment(c, 1, 2); Span spanObject = segmentObject.AsSpan(); - spanObject.Validate(o2, o3); + spanObject.ValidateReferenceType(o2, o3); } [Fact] @@ -64,12 +79,12 @@ namespace System.SpanTests int[] empty = Array.Empty(); ArraySegment segmentEmpty = new ArraySegment(empty); Span spanEmpty = segmentEmpty.AsSpan(); - spanEmpty.Validate(); + spanEmpty.Validate(); int[] a = { 91, 92, -93, 94 }; ArraySegment segmentInt = new ArraySegment(a, 0, 0); Span spanInt = segmentInt.AsSpan(); - spanInt.Validate(); + spanInt.Validate(); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/Clear.cs b/external/corefx/src/System.Memory/tests/Span/Clear.cs index 433143b6c9..ecd0c4a34f 100644 --- a/external/corefx/src/System.Memory/tests/Span/Clear.cs +++ b/external/corefx/src/System.Memory/tests/Span/Clear.cs @@ -4,6 +4,7 @@ using Xunit; using System.Runtime.CompilerServices; +using static System.TestHelpers; namespace System.SpanTests { diff --git a/external/corefx/src/System.Memory/tests/Span/CopyTo.cs b/external/corefx/src/System.Memory/tests/Span/CopyTo.cs index d547232f38..a626ad2a3b 100644 --- a/external/corefx/src/System.Memory/tests/Span/CopyTo.cs +++ b/external/corefx/src/System.Memory/tests/Span/CopyTo.cs @@ -92,7 +92,7 @@ namespace System.SpanTests int[] dst = { 99, 100 }; Span srcSpan = new Span(src); - AssertThrows(srcSpan, (_srcSpan) => _srcSpan.CopyTo(dst)); + TestHelpers.AssertThrows(srcSpan, (_srcSpan) => _srcSpan.CopyTo(dst)); int[] expected = { 99, 100 }; Assert.Equal(expected, dst); // CopyTo() checks for sufficient space before doing any copying. } @@ -177,7 +177,7 @@ namespace System.SpanTests int[] src = { 1, 2, 3 }; int[] dst = { 99, 100 }; - AssertThrows(src, (_src) => _src.CopyTo(dst)); + TestHelpers.AssertThrows(src, (_src) => _src.CopyTo(dst)); int[] expected = { 99, 100 }; Assert.Equal(expected, dst); // CopyTo() checks for sufficient space before doing any copying. } diff --git a/external/corefx/src/System.Memory/tests/Span/CtorArray.cs b/external/corefx/src/System.Memory/tests/Span/CtorArray.cs index 625dc62b81..15c4c6eef9 100644 --- a/external/corefx/src/System.Memory/tests/Span/CtorArray.cs +++ b/external/corefx/src/System.Memory/tests/Span/CtorArray.cs @@ -21,13 +21,10 @@ namespace System.SpanTests Span span; span = new Span(a); - span.Validate(91, 92, -93, 94); - - span = new Span(a, 0); - span.Validate(91, 92, -93, 94); + span.Validate(91, 92, -93, 94); span = new Span(a, 0, a.Length); - span.Validate(91, 92, -93, 94); + span.Validate(91, 92, -93, 94); } [Fact] @@ -37,13 +34,10 @@ namespace System.SpanTests Span span; span = new Span(a); - span.Validate(91, -92, 93, 94, -95); - - span = new Span(a, 0); - span.Validate(91, -92, 93, 94, -95); + span.Validate(91, -92, 93, 94, -95); span = new Span(a, 0, a.Length); - span.Validate(91, -92, 93, 94, -95); + span.Validate(91, -92, 93, 94, -95); } [Fact] @@ -55,13 +49,10 @@ namespace System.SpanTests Span span; span = new Span(a); - span.Validate(o1, o2); - - span = new Span(a, 0); - span.Validate(o1, o2); + span.ValidateReferenceType(o1, o2); span = new Span(a, 0, a.Length); - span.Validate(o1, o2); + span.ValidateReferenceType(o1, o2); } [Fact] @@ -71,21 +62,17 @@ namespace System.SpanTests Span span; span = new Span(empty); - span.Validate(); - - span = new Span(empty, 0); - span.Validate(); + span.Validate(); span = new Span(empty, 0, empty.Length); - span.Validate(); + span.Validate(); } [Fact] public static void CtorArrayNullArray() { - Assert.Throws(() => new Span((int[])null).DontBox()); - Assert.Throws(() => new Span((int[])null, 0).DontBox()); - Assert.Throws(() => new Span((int[])null, 0, 0).DontBox()); + Assert.Throws(() => new Span(null).DontBox()); + Assert.Throws(() => new Span(null, 0, 0).DontBox()); } [Fact] @@ -94,7 +81,6 @@ namespace System.SpanTests // Cannot pass variant array, if array type is not a valuetype. string[] a = { "Hello" }; Assert.Throws(() => new Span(a).DontBox()); - Assert.Throws(() => new Span(a, 0).DontBox()); Assert.Throws(() => new Span(a, 0, a.Length).DontBox()); } @@ -108,13 +94,10 @@ namespace System.SpanTests Span span; span = new Span(aAsIntArray); - span.Validate(42, -1); - - span = new Span(aAsIntArray, 0); - span.Validate(42, -1); + span.Validate(42, -1); span = new Span(aAsIntArray, 0, aAsIntArray.Length); - span.Validate(42, -1); + span.Validate(42, -1); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/CtorArrayInt.cs b/external/corefx/src/System.Memory/tests/Span/CtorArrayInt.cs deleted file mode 100644 index e838d6268b..0000000000 --- a/external/corefx/src/System.Memory/tests/Span/CtorArrayInt.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; - -namespace System.SpanTests -{ - // - // Tests for Span.ctor(T[], int). If the test is not specific to this overload, consider putting it in CtorArray.cs instread. - // - public static partial class SpanTests - { - [Fact] - public static void CtorArrayInt1() - { - int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; - Span span = new Span(a, 3); - span.Validate(93, 94, 95, 96, 97, 98); - } - - [Fact] - public static void CtorArrayInt2() - { - long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; - Span span = new Span(a, 3); - span.Validate(93, 94, 95, 96, 97, 98); - } - - [Fact] - public static void CtorArrayIntNegativeStart() - { - int[] a = new int[3]; - Assert.Throws(() => new Span(a, -1).DontBox()); - } - - [Fact] - public static void CtorArrayIntStartTooLarge() - { - int[] a = new int[3]; - Assert.Throws(() => new Span(a, 4).DontBox()); - } - - [Fact] - public static void CtorArrayIntStartEqualsLength() - { - // Valid for start to equal the array length. This returns an empty span that starts "just past the array." - int[] a = { 91, 92, 93 }; - Span span = new Span(a, 3); - span.Validate(); - } - } -} - diff --git a/external/corefx/src/System.Memory/tests/Span/CtorArrayIntInt.cs b/external/corefx/src/System.Memory/tests/Span/CtorArrayIntInt.cs index 5618db5fbf..26a8c97eac 100644 --- a/external/corefx/src/System.Memory/tests/Span/CtorArrayIntInt.cs +++ b/external/corefx/src/System.Memory/tests/Span/CtorArrayIntInt.cs @@ -16,7 +16,7 @@ namespace System.SpanTests { int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; Span span = new Span(a, 3, 2); - span.Validate(93, 94); + span.Validate(93, 94); } [Fact] @@ -24,7 +24,7 @@ namespace System.SpanTests { long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; Span span = new Span(a, 4, 3); - span.Validate(94, 95, 96); + span.Validate(94, 95, 96); } [Fact] @@ -32,7 +32,7 @@ namespace System.SpanTests { long[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98 }; Span span = new Span(a, 4, 5); - span.Validate(94, 95, 96, 97, 98); + span.Validate(94, 95, 96, 97, 98); } [Fact] @@ -73,7 +73,7 @@ namespace System.SpanTests // Valid for start to equal the array length. This returns an empty span that starts "just past the array." int[] a = { 91, 92, 93 }; Span span = new Span(a, 3, 0); - span.Validate(); + span.Validate(); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/CtorPointerInt.cs b/external/corefx/src/System.Memory/tests/Span/CtorPointerInt.cs index 600801b94e..2d11fa5829 100644 --- a/external/corefx/src/System.Memory/tests/Span/CtorPointerInt.cs +++ b/external/corefx/src/System.Memory/tests/Span/CtorPointerInt.cs @@ -20,8 +20,8 @@ namespace System.SpanTests fixed (int *pa = a) { Span span = new Span(pa, 3); - span.Validate(90, 91, 92); - Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(pa), ref span.DangerousGetPinnableReference())); + span.Validate(90, 91, 92); + Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(pa), ref span.DangerousGetPinnableReference())); } } } @@ -32,8 +32,8 @@ namespace System.SpanTests unsafe { Span span = new Span((void*)null, 0); - span.Validate(); - Assert.True(Unsafe.AreSame(ref Unsafe.AsRef((void*)null), ref span.DangerousGetPinnableReference())); + span.Validate(); + Assert.True(Unsafe.AreSame(ref Unsafe.AsRef((void*)null), ref span.DangerousGetPinnableReference())); } } diff --git a/external/corefx/src/System.Memory/tests/Span/DangerousCreate.cs b/external/corefx/src/System.Memory/tests/Span/DangerousCreate.cs index ea2715b9c5..f41fa1e9ec 100644 --- a/external/corefx/src/System.Memory/tests/Span/DangerousCreate.cs +++ b/external/corefx/src/System.Memory/tests/Span/DangerousCreate.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; +using static System.TestHelpers; namespace System.SpanTests { @@ -13,17 +13,19 @@ namespace System.SpanTests [Fact] public static void DangerousCreate1() { - TestClass testClass = new TestClass(); - testClass.C0 = 'a'; - testClass.C1 = 'b'; - testClass.C2 = 'c'; - testClass.C3 = 'd'; - testClass.C4 = 'e'; + TestClass testClass = new TestClass + { + C0 = 'a', + C1 = 'b', + C2 = 'c', + C3 = 'd', + C4 = 'e' + }; Span span = Span.DangerousCreate(testClass, ref testClass.C1, 3); - span.Validate('b', 'c', 'd'); + span.Validate('b', 'c', 'd'); ref char pc1 = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref testClass.C1, ref pc1)); + Assert.True(Unsafe.AreSame(ref testClass.C1, ref pc1)); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/DangerousGetPinnableReference.cs b/external/corefx/src/System.Memory/tests/Span/DangerousGetPinnableReference.cs index 199e7048a3..11e0bcf31c 100644 --- a/external/corefx/src/System.Memory/tests/Span/DangerousGetPinnableReference.cs +++ b/external/corefx/src/System.Memory/tests/Span/DangerousGetPinnableReference.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; +using static System.TestHelpers; namespace System.SpanTests { @@ -16,7 +16,7 @@ namespace System.SpanTests int[] a = { 91, 92, 93, 94, 95 }; Span span = new Span(a, 1, 3); ref int pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref a[1], ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref a[1], ref pinnableReference)); } [Fact] @@ -29,7 +29,7 @@ namespace System.SpanTests Span span = new Span(a, a.Length, 0); ref int pinnableReference = ref span.DangerousGetPinnableReference(); ref int expected = ref Unsafe.Add(ref a[a.Length - 1], 1); - Assert.True(Unsafe.AreSame(ref expected, ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref expected, ref pinnableReference)); } [Fact] @@ -40,7 +40,7 @@ namespace System.SpanTests int i = 42; Span span = new Span(&i, 1); ref int pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref i, ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref i, ref pinnableReference)); } } @@ -51,7 +51,7 @@ namespace System.SpanTests Span span = Span.DangerousCreate(testClass, ref testClass.C1, 3); ref char pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref testClass.C1, ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref testClass.C1, ref pinnableReference)); } [Fact] @@ -61,7 +61,7 @@ namespace System.SpanTests { Span span = Span.Empty; ref int pinnableReference = ref span.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(null), ref pinnableReference)); + Assert.True(Unsafe.AreSame(ref Unsafe.AsRef(null), ref pinnableReference)); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/Empty.cs b/external/corefx/src/System.Memory/tests/Span/Empty.cs index 50e2e5196b..8d8d1a4dc7 100644 --- a/external/corefx/src/System.Memory/tests/Span/Empty.cs +++ b/external/corefx/src/System.Memory/tests/Span/Empty.cs @@ -19,7 +19,7 @@ namespace System.SpanTests { ref int expected = ref Unsafe.AsRef(null); ref int actual = ref empty.DangerousGetPinnableReference(); - Assert.True(Unsafe.AreSame(ref expected, ref actual)); + Assert.True(Unsafe.AreSame(ref expected, ref actual)); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/Fill.cs b/external/corefx/src/System.Memory/tests/Span/Fill.cs index 4976bd815f..929ebede79 100644 --- a/external/corefx/src/System.Memory/tests/Span/Fill.cs +++ b/external/corefx/src/System.Memory/tests/Span/Fill.cs @@ -4,6 +4,7 @@ using System.Runtime.InteropServices; using Xunit; +using static System.TestHelpers; namespace System.SpanTests { diff --git a/external/corefx/src/System.Memory/tests/Span/IndexOf.T.cs b/external/corefx/src/System.Memory/tests/Span/IndexOf.T.cs index b3b197a725..8d9736be83 100644 --- a/external/corefx/src/System.Memory/tests/Span/IndexOf.T.cs +++ b/external/corefx/src/System.Memory/tests/Span/IndexOf.T.cs @@ -80,7 +80,7 @@ namespace System.SpanTests foreach (TInt elem in a) { int numCompares = log.CountCompares(elem.Value, 9999); - Assert.True(numCompares == 1); + Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/IndexOf.byte.cs b/external/corefx/src/System.Memory/tests/Span/IndexOf.byte.cs index c6014cf3a1..265bda555d 100644 --- a/external/corefx/src/System.Memory/tests/Span/IndexOf.byte.cs +++ b/external/corefx/src/System.Memory/tests/Span/IndexOf.byte.cs @@ -193,7 +193,7 @@ namespace System.SpanTests } var found = span[index]; - Assert.Equal((byte)expectResult, (byte)found); + Assert.Equal((byte)expectResult, found); Assert.Equal(expectIndex, index); } diff --git a/external/corefx/src/System.Memory/tests/Span/NonPortableCast.cs b/external/corefx/src/System.Memory/tests/Span/NonPortableCast.cs index 0927ebb888..18b80f7b49 100644 --- a/external/corefx/src/System.Memory/tests/Span/NonPortableCast.cs +++ b/external/corefx/src/System.Memory/tests/Span/NonPortableCast.cs @@ -24,14 +24,14 @@ namespace System.SpanTests public static void PortableCastToTypeContainsReferences() { Span span = new Span(Array.Empty()); - AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); + TestHelpers.AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); } [Fact] public static void PortableCastFromTypeContainsReferences() { Span span = new Span(Array.Empty()); - AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); + TestHelpers.AssertThrows(span, (_span) => _span.NonPortableCast().DontBox()); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/Overflow.cs b/external/corefx/src/System.Memory/tests/Span/Overflow.cs index e5335a0f9e..b9f9070f1b 100644 --- a/external/corefx/src/System.Memory/tests/Span/Overflow.cs +++ b/external/corefx/src/System.Memory/tests/Span/Overflow.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.InteropServices; using System.Runtime.CompilerServices; namespace System.SpanTests @@ -41,7 +40,7 @@ namespace System.SpanTests int bigIndex = checked(GuidTwoGiBLimit + 1); uint byteOffset = checked((uint)bigIndex * (uint)sizeof(Guid)); - Assert.True(byteOffset > (uint)int.MaxValue); // Make sure byteOffset actually overflows 2Gb, or this test is pointless. + Assert.True(byteOffset > int.MaxValue); // Make sure byteOffset actually overflows 2Gb, or this test is pointless. ref Guid expected = ref Unsafe.Add(ref memory, bigIndex); Assert.True(Unsafe.AreSame(ref expected, ref span[bigIndex])); diff --git a/external/corefx/src/System.Memory/tests/Span/SequenceEqual.T.cs b/external/corefx/src/System.Memory/tests/Span/SequenceEqual.T.cs index 5f88a1acce..9444cac7d8 100644 --- a/external/corefx/src/System.Memory/tests/Span/SequenceEqual.T.cs +++ b/external/corefx/src/System.Memory/tests/Span/SequenceEqual.T.cs @@ -64,7 +64,7 @@ namespace System.SpanTests foreach (TInt elem in first) { int numCompares = log.CountCompares(elem.Value, elem.Value); - Assert.True(numCompares == 1); + Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/Slice.cs b/external/corefx/src/System.Memory/tests/Span/Slice.cs index e15f4cb2bb..968f66ca00 100644 --- a/external/corefx/src/System.Memory/tests/Span/Slice.cs +++ b/external/corefx/src/System.Memory/tests/Span/Slice.cs @@ -15,7 +15,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; Span span = new Span(a).Slice(6); Assert.Equal(4, span.Length); - Assert.True(Unsafe.AreSame(ref a[6], ref span.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref a[6], ref span.DangerousGetPinnableReference())); } [Fact] @@ -24,7 +24,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; Span span = new Span(a).Slice(a.Length); Assert.Equal(0, span.Length); - Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); } [Fact] @@ -33,7 +33,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; Span span = new Span(a).Slice(3, 5); Assert.Equal(5, span.Length); - Assert.True(Unsafe.AreSame(ref a[3], ref span.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref a[3], ref span.DangerousGetPinnableReference())); } [Fact] @@ -42,7 +42,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; Span span = new Span(a).Slice(4, 6); Assert.Equal(6, span.Length); - Assert.True(Unsafe.AreSame(ref a[4], ref span.DangerousGetPinnableReference())); + Assert.True(Unsafe.AreSame(ref a[4], ref span.DangerousGetPinnableReference())); } [Fact] @@ -51,7 +51,7 @@ namespace System.SpanTests int[] a = { 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; Span span = new Span(a).Slice(a.Length, 0); Assert.Equal(0, span.Length); - Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); + Assert.True(Unsafe.AreSame(ref a[a.Length - 1], ref Unsafe.Subtract(ref span.DangerousGetPinnableReference(), 1))); } [Fact] diff --git a/external/corefx/src/System.Memory/tests/Span/StartsWith.T.cs b/external/corefx/src/System.Memory/tests/Span/StartsWith.T.cs index ec7e46c469..c13e777c25 100644 --- a/external/corefx/src/System.Memory/tests/Span/StartsWith.T.cs +++ b/external/corefx/src/System.Memory/tests/Span/StartsWith.T.cs @@ -85,7 +85,7 @@ namespace System.SpanTests foreach (TInt elem in first) { int numCompares = log.CountCompares(elem.Value, elem.Value); - Assert.True(numCompares == 1); + Assert.True(numCompares == 1, $"Expected {numCompares} == 1 for element {elem.Value}."); } } } diff --git a/external/corefx/src/System.Memory/tests/Span/TestHelpers.cs b/external/corefx/src/System.Memory/tests/Span/TestHelpers.cs deleted file mode 100644 index 0e00c970cd..0000000000 --- a/external/corefx/src/System.Memory/tests/Span/TestHelpers.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; -using System.Runtime.InteropServices; - -namespace System.SpanTests -{ - public static partial class SpanTests - { - private static void Validate(this Span span, params T[] expected) - { - bool isValueType = default(T) != null || Nullable.GetUnderlyingType(typeof(T)) != null; - Assert.Equal(span.Length, expected.Length); - for (int i = 0; i < expected.Length; i++) - { - T actual = span[i]; - if (isValueType) - Assert.Equal(expected[i], actual); - else - Assert.Same(expected[i], actual); - } - - object ignore; - AssertThrows(span, (_span) => ignore = _span[expected.Length]); - } - - private delegate void AssertThrowsAction(Span span); - - // Cannot use standard Assert.Throws() when testing Span - Span and closures don't get along. - private static void AssertThrows(Span span, AssertThrowsAction action) where E:Exception - { - try - { - action(span); - Assert.False(true, "Expected exception: " + typeof(E).GetType()); - } - catch (E) - { - } - catch (Exception wrongException) - { - Assert.False(true, "Wrong exception thrown: Expected " + typeof(E).GetType() + ": Actual: " + wrongException.GetType()); - } - } - - // - // The innocent looking construct: - // - // Assert.Throws( () => new Span() ); - // - // generates a hidden box of the Span as the return value of the lambda. This makes the IL illegal and unloadable on - // runtimes that enforce the actual Span rules (never mind that we expect never to reach the box instruction...) - // - // The workaround is to code it like this: - // - // Assert.Throws( () => new Span().DontBox() ); - // - // which turns the lambda return type back to "void" and eliminates the troublesome box instruction. - // - private static void DontBox(this Span span) - { - // This space intentionally left blank. - } - - [StructLayout(LayoutKind.Sequential)] - private sealed class TestClass - { - private double _d; - public char C0; - public char C1; - public char C2; - public char C3; - public char C4; - } - - [StructLayout(LayoutKind.Sequential)] - private struct TestValueTypeWithReference - { - public int I; - public string S; - } - - private enum TestEnum - { - e0, - e1, - e2, - e3, - e4, - } - } -} - diff --git a/external/corefx/src/System.Memory/tests/Span/ToArray.cs b/external/corefx/src/System.Memory/tests/Span/ToArray.cs index ecabef0684..2fbf38ca09 100644 --- a/external/corefx/src/System.Memory/tests/Span/ToArray.cs +++ b/external/corefx/src/System.Memory/tests/Span/ToArray.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Xunit; -using System.Runtime.CompilerServices; namespace System.SpanTests { @@ -19,6 +18,25 @@ namespace System.SpanTests Assert.NotSame(a, copy); } + [Fact] + public static void ToArrayWithIndex() + { + int[] a = { 91, 92, 93, 94, 95 }; + var span = new Span(a); + int[] copy = span.Slice(2).ToArray(); + + Assert.Equal(new int[] { 93, 94, 95 }, copy); + } + + [Fact] + public static void ToArrayWithIndexAndLength() + { + int[] a = { 91, 92, 93 }; + var span = new Span(a, 1, 1); + int[] copy = span.ToArray(); + Assert.Equal(new int[] { 92 }, copy); + } + [Fact] public static void ToArrayEmpty() { diff --git a/external/corefx/src/System.Memory/tests/System.Memory.Tests.csproj b/external/corefx/src/System.Memory/tests/System.Memory.Tests.csproj index 156b5a9edb..28cffcde3f 100644 --- a/external/corefx/src/System.Memory/tests/System.Memory.Tests.csproj +++ b/external/corefx/src/System.Memory/tests/System.Memory.Tests.csproj @@ -5,13 +5,12 @@ true {15DB0DCC-68B4-4CFB-8BD2-F26BCCAF5A3F} - - - - + + + @@ -20,7 +19,6 @@ - @@ -43,16 +41,13 @@ - - - @@ -74,8 +69,39 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Memory/tests/TInt.cs b/external/corefx/src/System.Memory/tests/TInt.cs index e4a74643ab..e6dba18fe8 100644 --- a/external/corefx/src/System.Memory/tests/TInt.cs +++ b/external/corefx/src/System.Memory/tests/TInt.cs @@ -5,8 +5,6 @@ using System.Collections.Generic; using System.Linq; -using Xunit; - #pragma warning disable 0809 //warning CS0809: Obsolete member overrides non-obsolete member namespace System diff --git a/external/corefx/src/System.Memory/tests/TestHelpers.cs b/external/corefx/src/System.Memory/tests/TestHelpers.cs new file mode 100644 index 0000000000..8c40b3039f --- /dev/null +++ b/external/corefx/src/System.Memory/tests/TestHelpers.cs @@ -0,0 +1,281 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +using static System.Buffers.Binary.BinaryPrimitives; + +namespace System +{ + public static class TestHelpers + { + public static void Validate(this Span span, params T[] expected) where T : struct, IEquatable + { + Assert.True(span.SequenceEqual(expected)); + } + + public static void ValidateReferenceType(this Span span, params T[] expected) + { + Assert.Equal(span.Length, expected.Length); + for (int i = 0; i < expected.Length; i++) + { + T actual = span[i]; + Assert.Same(expected[i], actual); + } + + T ignore; + AssertThrows(span, (_span) => ignore = _span[expected.Length]); + } + + public delegate void AssertThrowsAction(Span span); + + // Cannot use standard Assert.Throws() when testing Span - Span and closures don't get along. + public static void AssertThrows(Span span, AssertThrowsAction action) where E:Exception + { + try + { + action(span); + Assert.False(true, "Expected exception: " + typeof(E).GetType()); + } + catch (E) + { + } + catch (Exception wrongException) + { + Assert.False(true, "Wrong exception thrown: Expected " + typeof(E).GetType() + ": Actual: " + wrongException.GetType()); + } + } + + // + // The innocent looking construct: + // + // Assert.Throws( () => new Span() ); + // + // generates a hidden box of the Span as the return value of the lambda. This makes the IL illegal and unloadable on + // runtimes that enforce the actual Span rules (never mind that we expect never to reach the box instruction...) + // + // The workaround is to code it like this: + // + // Assert.Throws( () => new Span().DontBox() ); + // + // which turns the lambda return type back to "void" and eliminates the troublesome box instruction. + // + public static void DontBox(this Span span) + { + // This space intentionally left blank. + } + + public static void Validate(this ReadOnlySpan span, params T[] expected) where T : struct, IEquatable + { + Assert.True(span.SequenceEqual(expected)); + } + + public static void ValidateReferenceType(this ReadOnlySpan span, params T[] expected) + { + Assert.Equal(span.Length, expected.Length); + for (int i = 0; i < expected.Length; i++) + { + T actual = span[i]; + Assert.Same(expected[i], actual); + } + + T ignore; + AssertThrows(span, (_span) => ignore = _span[expected.Length]); + } + + public delegate void AssertThrowsActionReadOnly(ReadOnlySpan span); + + // Cannot use standard Assert.Throws() when testing Span - Span and closures don't get along. + public static void AssertThrows(ReadOnlySpan span, AssertThrowsActionReadOnly action) where E:Exception + { + try + { + action(span); + Assert.False(true, "Expected exception: " + typeof(E).GetType()); + } + catch (E) + { + } + catch (Exception wrongException) + { + Assert.False(true, "Wrong exception thrown: Expected " + typeof(E).GetType() + ": Actual: " + wrongException.GetType()); + } + } + + // + // The innocent looking construct: + // + // Assert.Throws( () => new Span() ); + // + // generates a hidden box of the Span as the return value of the lambda. This makes the IL illegal and unloadable on + // runtimes that enforce the actual Span rules (never mind that we expect never to reach the box instruction...) + // + // The workaround is to code it like this: + // + // Assert.Throws( () => new Span().DontBox() ); + // + // which turns the lambda return type back to "void" and eliminates the troublesome box instruction. + // + public static void DontBox(this ReadOnlySpan span) + { + // This space intentionally left blank. + } + + public static void Validate(this Memory memory, params T[] expected) where T : struct, IEquatable + { + Assert.True(memory.Span.SequenceEqual(expected)); + } + + public static void ValidateReferenceType(this Memory memory, params T[] expected) + { + T[] bufferArray = memory.ToArray(); + Assert.Equal(memory.Length, expected.Length); + for (int i = 0; i < expected.Length; i++) + { + T actual = bufferArray[i]; + Assert.Same(expected[i], actual); + } + } + + public static void Validate(this ReadOnlyMemory memory, params T[] expected) where T : struct, IEquatable + { + Assert.True(memory.Span.SequenceEqual(expected)); + } + + public static void ValidateReferenceType(this ReadOnlyMemory memory, params T[] expected) + { + T[] bufferArray = memory.ToArray(); + Assert.Equal(memory.Length, expected.Length); + for (int i = 0; i < expected.Length; i++) + { + T actual = bufferArray[i]; + Assert.Same(expected[i], actual); + } + } + + public static void Validate(Span span, T value) where T : struct + { + T read = ReadMachineEndian(span); + Assert.Equal(value, read); + span.Clear(); + } + + public static TestStructExplicit testExplicitStruct = new TestStructExplicit + { + S0 = short.MaxValue, + I0 = int.MaxValue, + L0 = long.MaxValue, + US0 = ushort.MaxValue, + UI0 = uint.MaxValue, + UL0 = ulong.MaxValue, + S1 = short.MinValue, + I1 = int.MinValue, + L1 = long.MinValue, + US1 = ushort.MinValue, + UI1 = uint.MinValue, + UL1 = ulong.MinValue + }; + + public static Span GetSpanBE() + { + Span spanBE = new byte[Unsafe.SizeOf()]; + + WriteInt16BigEndian(spanBE, testExplicitStruct.S0); + WriteInt32BigEndian(spanBE.Slice(2), testExplicitStruct.I0); + WriteInt64BigEndian(spanBE.Slice(6), testExplicitStruct.L0); + WriteUInt16BigEndian(spanBE.Slice(14), testExplicitStruct.US0); + WriteUInt32BigEndian(spanBE.Slice(16), testExplicitStruct.UI0); + WriteUInt64BigEndian(spanBE.Slice(20), testExplicitStruct.UL0); + WriteInt16BigEndian(spanBE.Slice(28), testExplicitStruct.S1); + WriteInt32BigEndian(spanBE.Slice(30), testExplicitStruct.I1); + WriteInt64BigEndian(spanBE.Slice(34), testExplicitStruct.L1); + WriteUInt16BigEndian(spanBE.Slice(42), testExplicitStruct.US1); + WriteUInt32BigEndian(spanBE.Slice(44), testExplicitStruct.UI1); + WriteUInt64BigEndian(spanBE.Slice(48), testExplicitStruct.UL1); + + Assert.Equal(56, spanBE.Length); + return spanBE; + } + + public static Span GetSpanLE() + { + Span spanLE = new byte[Unsafe.SizeOf()]; + + WriteInt16LittleEndian(spanLE, testExplicitStruct.S0); + WriteInt32LittleEndian(spanLE.Slice(2), testExplicitStruct.I0); + WriteInt64LittleEndian( spanLE.Slice(6), testExplicitStruct.L0); + WriteUInt16LittleEndian(spanLE.Slice(14), testExplicitStruct.US0); + WriteUInt32LittleEndian(spanLE.Slice(16), testExplicitStruct.UI0); + WriteUInt64LittleEndian(spanLE.Slice(20), testExplicitStruct.UL0); + WriteInt16LittleEndian(spanLE.Slice(28), testExplicitStruct.S1); + WriteInt32LittleEndian(spanLE.Slice(30), testExplicitStruct.I1); + WriteInt64LittleEndian(spanLE.Slice(34), testExplicitStruct.L1); + WriteUInt16LittleEndian(spanLE.Slice(42), testExplicitStruct.US1); + WriteUInt32LittleEndian(spanLE.Slice(44), testExplicitStruct.UI1); + WriteUInt64LittleEndian(spanLE.Slice(48), testExplicitStruct.UL1); + + Assert.Equal(56, spanLE.Length); + return spanLE; + } + + [StructLayout(LayoutKind.Explicit)] + public struct TestStructExplicit + { + [FieldOffset(0)] + public short S0; + [FieldOffset(2)] + public int I0; + [FieldOffset(6)] + public long L0; + [FieldOffset(14)] + public ushort US0; + [FieldOffset(16)] + public uint UI0; + [FieldOffset(20)] + public ulong UL0; + [FieldOffset(28)] + public short S1; + [FieldOffset(30)] + public int I1; + [FieldOffset(34)] + public long L1; + [FieldOffset(42)] + public ushort US1; + [FieldOffset(44)] + public uint UI1; + [FieldOffset(48)] + public ulong UL1; + } + + [StructLayout(LayoutKind.Sequential)] + public sealed class TestClass + { + private double _d; + public char C0; + public char C1; + public char C2; + public char C3; + public char C4; + } + + [StructLayout(LayoutKind.Sequential)] + public struct TestValueTypeWithReference + { + public int I; + public string S; + } + + public enum TestEnum + { + e0, + e1, + e2, + e3, + e4, + } + } +} + diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/pkg/System.Net.Http.WinHttpHandler.pkgproj b/external/corefx/src/System.Net.Http.WinHttpHandler/pkg/System.Net.Http.WinHttpHandler.pkgproj index 73c40a00b5..bb6883ec8b 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/pkg/System.Net.Http.WinHttpHandler.pkgproj +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/pkg/System.Net.Http.WinHttpHandler.pkgproj @@ -10,11 +10,7 @@ netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj index 4c0e2e8e3a..78b6c50387 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj @@ -35,6 +35,9 @@ Common\System\Net\HttpVersionInternal.cs + + Common\System\Net\Logging\NetEventSource.Common.cs + diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild index 2661bfcf9b..eca0378858 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.msbuild @@ -5,11 +5,13 @@ + + @@ -17,8 +19,8 @@ - + diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpCertificateHelper.cs b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpCertificateHelper.cs index 6868120114..ca315bcf41 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpCertificateHelper.cs +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpCertificateHelper.cs @@ -16,6 +16,7 @@ namespace System.Net.Http // TODO: Issue #2165. Merge with similar code used in System.Net.Security move to Common/src//System/Net. public static void BuildChain( X509Certificate2 certificate, + X509Certificate2Collection remoteCertificateStore, string hostName, bool checkCertificateRevocationList, out X509Chain chain, @@ -32,6 +33,19 @@ namespace System.Net.Http // Authenticate the remote party: (e.g. when operating in client mode, authenticate the server). chain.ChainPolicy.ApplicationPolicy.Add(s_serverAuthOid); + if (remoteCertificateStore.Count > 0) + { + if (WinHttpTraceHelper.IsTraceEnabled()) + { + foreach (X509Certificate cert in remoteCertificateStore) + { + WinHttpTraceHelper.Trace("WinHttpCertificateHelper.BuildChain: adding cert to ExtraStore: {0}", cert.Subject); + } + } + + chain.ChainPolicy.ExtraStore.AddRange(remoteCertificateStore); + } + if (!chain.Build(certificate)) { sslPolicyErrors |= SslPolicyErrors.RemoteCertificateChainErrors; diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs index 636229ad3f..7bea4857cb 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs @@ -258,7 +258,11 @@ namespace System.Net.Http throw WinHttpException.CreateExceptionUsingError(lastError); } - + + // Get any additional certificates sent from the remote server during the TLS/SSL handshake. + X509Certificate2Collection remoteCertificateStore = + UnmanagedCertificateContext.GetRemoteCertificatesFromStoreContext(certHandle); + // Create a managed wrapper around the certificate handle. Since this results in duplicating // the handle, we will close the original handle after creating the wrapper. var serverCertificate = new X509Certificate2(certHandle); @@ -266,26 +270,28 @@ namespace System.Net.Http X509Chain chain = null; SslPolicyErrors sslPolicyErrors; + bool result = false; try { WinHttpCertificateHelper.BuildChain( serverCertificate, + remoteCertificateStore, state.RequestMessage.RequestUri.Host, state.CheckCertificateRevocationList, out chain, out sslPolicyErrors); - bool result = state.ServerCertificateValidationCallback( + result = state.ServerCertificateValidationCallback( state.RequestMessage, serverCertificate, chain, sslPolicyErrors); - if (!result) - { - throw WinHttpException.CreateExceptionUsingError( - (int)Interop.WinHttp.ERROR_WINHTTP_SECURE_FAILURE); - } + } + catch (Exception ex) + { + throw WinHttpException.CreateExceptionUsingError( + (int)Interop.WinHttp.ERROR_WINHTTP_SECURE_FAILURE, ex); } finally { @@ -296,6 +302,12 @@ namespace System.Net.Http serverCertificate.Dispose(); } + + if (!result) + { + throw WinHttpException.CreateExceptionUsingError( + (int)Interop.WinHttp.ERROR_WINHTTP_SECURE_FAILURE); + } } } diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs b/external/corefx/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs index 7b7857172f..0aad931e89 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs @@ -111,14 +111,16 @@ namespace System.Net.Http.WinHttpHandlerFunctional.Tests [OuterLoop] // TODO: Issue #11345 [Fact] - public async Task UseCallback_CallbackThrowsSpecificException_ThrowsInnerSpecificException() + public async Task UseCallback_CallbackThrowsSpecificException_SpecificExceptionPropagatesAsBaseException() { var handler = new WinHttpHandler(); handler.ServerCertificateValidationCallback = CustomServerCertificateValidationCallback; using (var client = new HttpClient(handler)) { _validationCallbackHistory.ThrowException = true; - await Assert.ThrowsAsync(() => client.GetAsync(System.Net.Test.Common.Configuration.Http.SecureRemoteEchoServer)); + HttpRequestException ex = await Assert.ThrowsAsync(() => + client.GetAsync(System.Net.Test.Common.Configuration.Http.SecureRemoteEchoServer)); + Assert.True(ex.GetBaseException() is CustomException); } } diff --git a/external/corefx/src/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj b/external/corefx/src/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj index 9892003c2a..871e66692e 100644 --- a/external/corefx/src/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj +++ b/external/corefx/src/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj @@ -19,12 +19,18 @@ Common\Interop\Windows\Interop.Libraries.cs + + Common\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs + Common\Interop\Windows\Crypt32\Interop.certificates_types.cs Common\Interop\Windows\Interop.HRESULT_FROM_WIN32.cs + + Common\Interop\Windows\SChannel\UnmanagedCertificateContext.IntPtr.cs + Common\Interop\Windows\winhttp\Interop.SafeWinHttpHandle.cs @@ -52,6 +58,9 @@ Common\System\Net\HttpVersionInternal.cs + + Common\System\Net\Logging\NetEventSource.Common.cs + Common\System\Net\UriScheme.cs diff --git a/external/corefx/src/System.Net.Http/dir.props b/external/corefx/src/System.Net.Http/dir.props index b5dea7fb76..b89fb6fc11 100644 --- a/external/corefx/src/System.Net.Http/dir.props +++ b/external/corefx/src/System.Net.Http/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Net.Http/ref/Configurations.props b/external/corefx/src/System.Net.Http/ref/Configurations.props index 960bd47f9e..c701755863 100644 --- a/external/corefx/src/System.Net.Http/ref/Configurations.props +++ b/external/corefx/src/System.Net.Http/ref/Configurations.props @@ -3,8 +3,6 @@ netcoreapp; - netfx; - net46; uap; diff --git a/external/corefx/src/System.Net.Http/ref/System.Net.Http.cs b/external/corefx/src/System.Net.Http/ref/System.Net.Http.cs index e3c4085fc4..c4ad870c81 100644 --- a/external/corefx/src/System.Net.Http/ref/System.Net.Http.cs +++ b/external/corefx/src/System.Net.Http/ref/System.Net.Http.cs @@ -225,6 +225,12 @@ namespace System.Net.Http public void Add(System.Net.Http.HttpContent content, string name) { } public void Add(System.Net.Http.HttpContent content, string name, string fileName) { } } + public sealed partial class ReadOnlyMemoryContent : System.Net.Http.HttpContent + { + public ReadOnlyMemoryContent(System.ReadOnlyMemory content) { } + protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext context) => throw null; + protected internal override bool TryComputeLength(out long length) => throw null; + } public partial class StreamContent : System.Net.Http.HttpContent { public StreamContent(System.IO.Stream content) { } diff --git a/external/corefx/src/System.Net.Http/ref/System.Net.Http.csproj b/external/corefx/src/System.Net.Http/ref/System.Net.Http.csproj index bd399cd31b..bc043b82d7 100644 --- a/external/corefx/src/System.Net.Http/ref/System.Net.Http.csproj +++ b/external/corefx/src/System.Net.Http/ref/System.Net.Http.csproj @@ -4,12 +4,8 @@ {132BF813-FC40-4D39-8B6F-E55D7633F0ED} - - - - diff --git a/external/corefx/src/System.Net.Http/src/AssemblyInfo.Net46.cs b/external/corefx/src/System.Net.Http/src/AssemblyInfo.Net46.cs deleted file mode 100644 index 5ecf5ea1b4..0000000000 --- a/external/corefx/src/System.Net.Http/src/AssemblyInfo.Net46.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Security; -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("System.Net.Http.WebRequest, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293", AllInternalsVisible = false)] -[assembly: AllowPartiallyTrustedCallers] diff --git a/external/corefx/src/System.Net.Http/src/Configurations.props b/external/corefx/src/System.Net.Http/src/Configurations.props index 7306909691..8c59b78a84 100644 --- a/external/corefx/src/System.Net.Http/src/Configurations.props +++ b/external/corefx/src/System.Net.Http/src/Configurations.props @@ -6,8 +6,6 @@ netcoreapp-OSX; netcoreapp-Unix; netcoreapp-Windows_NT; - net46-Windows_NT; - netfx-Windows_NT; diff --git a/external/corefx/src/System.Net.Http/src/HttpDiagnosticsGuide.md b/external/corefx/src/System.Net.Http/src/HttpDiagnosticsGuide.md index 145da9de5b..50aba47b65 100644 --- a/external/corefx/src/System.Net.Http/src/HttpDiagnosticsGuide.md +++ b/external/corefx/src/System.Net.Http/src/HttpDiagnosticsGuide.md @@ -3,7 +3,7 @@ This document describes `HttpClientHandler` instrumentation with [DiagnosticSource](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md). # Overview -Applications typically log outgoing HTTP requests; typically it's done with DelegatingHandler implementation that logs every request. However in existing system it may require extensive code changes, since DelegatingHandler needs to be added to HttpClient pipeline every time when new client is created. +Applications typically log outgoing HTTP requests; typically it's done with DelegatingHandler implementation that logs every request. However in an existing system it may require extensive code changes, since DelegatingHandler needs to be added to HttpClient pipeline every time when new client is created. DiagnosticListener instrumentation allows to enable outgoing request tracing with a few lines of code; it also provides context necessary to correlate logs. Context is represented as `System.Diagnostics.Activity` class. Activity may be started as a child of another Activity and the whole operation is represented with a tree of Activities. You can find more details in [Activity User Guide](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/ActivityUserGuide.md). @@ -12,16 +12,15 @@ Activity carries useful properties for logging such as Id, start time, Tags, Bag Instrumentation ensures `Activity.Current` represents current outgoing request in Write event callbacks (if request is instrumented). Consumers **should not** assume `Activity.Current` is accurate in IsEnabled callbacks. -In microservice environment some context should flow with outgoing requests to correlate telemtry from all services involved in operation processing. +In a microservice environment some context should flow with outgoing requests to correlate telemetry from all services involved in processing an operation. Instrumentation adds context into the request headers: * Request-Id header with `Activity.Id` value * Correlation-Context header with `Activity.Baggage` key-value pair list in `k1=v1, k2=v2` format -See [Http Protocol proposal](https://github.com/lmolkova/correlation/blob/master/http_protocol_proposal_v1.md) for more details -[comment]: TODO: Update link once it's moved +See [HTTP Protocol proposal](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md) for more details. ## Subscription -Instrumentation is off by default; to enable it, consumer first needs to subscribe to DiagnosticListener called "HttpHandlerDiagnosticListener". +Instrumentation is off by default; to enable it, consumer first needs to subscribe to a DiagnosticListener called "HttpHandlerDiagnosticListener". ```C# var subscription = DiagnosticListener.AllListeners.Subscribe(delegate (DiagnosticListener listener) @@ -37,7 +36,7 @@ var subscription = DiagnosticListener.AllListeners.Subscribe(delegate (Diagnosti ``` ## Events -If there is **at least one consumer**, subscribed for "HttpHandlerDiagnosticListener" events, `HttpClientHandler` instruments outgoing request depending on subscription and request properties. +If there is **at least one consumer** subscribed for "HttpHandlerDiagnosticListener" events, `HttpClientHandler` instruments outgoing request depending on subscription and request properties. Note that DiagnosticListener best practice is to guard every `Write` method with `IsEnabled` check. In case there is more than one consumer, **each consumer** will receive Write event if **at least one** consumer returned true for `IsEnabled`. diff --git a/external/corefx/src/System.Net.Http/src/Internal/UriHelper.cs b/external/corefx/src/System.Net.Http/src/Internal/UriHelper.cs deleted file mode 100644 index 257306ec7a..0000000000 --- a/external/corefx/src/System.Net.Http/src/Internal/UriHelper.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text; - -namespace System -{ - internal static class UriHelper - { - const char c_DummyChar = (char)0xFFFF; - private static readonly char[] HexUpperChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - - private static char EscapedAscii(char digit, char next) - { - if (!(((digit >= '0') && (digit <= '9')) - || ((digit >= 'A') && (digit <= 'F')) - || ((digit >= 'a') && (digit <= 'f')))) - { - return c_DummyChar; - } - - int res = (digit <= '9') - ? ((int)digit - (int)'0') - : (((digit <= 'F') - ? ((int)digit - (int)'A') - : ((int)digit - (int)'a')) - + 10); - - if (!(((next >= '0') && (next <= '9')) - || ((next >= 'A') && (next <= 'F')) - || ((next >= 'a') && (next <= 'f')))) - { - return c_DummyChar; - } - - return (char)((res << 4) + ((next <= '9') - ? ((int)next - (int)'0') - : (((next <= 'F') - ? ((int)next - (int)'A') - : ((int)next - (int)'a')) - + 10))); - } - - private static void EscapeAsciiChar(char ch, char[] to, ref int pos) - { - to[pos++] = '%'; - to[pos++] = HexUpperChars[(ch & 0xf0) >> 4]; - to[pos++] = HexUpperChars[ch & 0xf]; - } - - public static bool IsHexEncoding(string pattern, int index) - { - if ((pattern.Length - index) < 3) - { - return false; - } - if ((pattern[index] == '%') && EscapedAscii(pattern[index + 1], pattern[index + 2]) != c_DummyChar) - { - return true; - } - return false; - } - - public static string HexEscape(char character) - { - if (character > '\xff') - { - throw new ArgumentOutOfRangeException(nameof(character)); - } - char[] chars = new char[3]; - int pos = 0; - EscapeAsciiChar(character, chars, ref pos); - return new string(chars); - } - - public static char HexUnescape(string pattern, ref int index) - { - if ((index < 0) || (index >= pattern.Length)) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - if ((pattern[index] == '%') - && (pattern.Length - index >= 3)) - { - char ret = EscapedAscii(pattern[index + 1], pattern[index + 2]); - if (ret != c_DummyChar) - { - index += 3; - return ret; - } - } - return pattern[index++]; - } - - public static bool IsDefaultPort(Uri uri) - { - Uri defaultPortUri = new Uri(uri.Scheme + "://" + uri.Host); - return defaultPortUri.Port == uri.Port; - } - } -} diff --git a/external/corefx/src/System.Net.Http/src/Resources/Strings.resx b/external/corefx/src/System.Net.Http/src/Resources/Strings.resx index 4419c29e3a..f73a721dc8 100644 --- a/external/corefx/src/System.Net.Http/src/Resources/Strings.resx +++ b/external/corefx/src/System.Net.Http/src/Resources/Strings.resx @@ -1,5 +1,64 @@  + @@ -64,6 +123,9 @@ The format of the HTTP method is invalid. + + The HTTP method '{0}' is not supported on this platform. + The reason phrase must not contain new-line characters. @@ -265,7 +327,7 @@ The stream does not support concurrent I/O read or write operations. - + The server returned an invalid or unrecognized response. @@ -304,4 +366,25 @@ Client certificate was not found in the personal (\"MY\") certificate store. In UWP, client certificates are only supported if they have been added to that certificate store. + + The response code indicates a redirect, but the 'Location' header is missing. + + + The maximum number of redirects was exceeded. + + + Only the 'http' scheme is allowed for proxies. + + + Request headers must contain only ASCII characters. + + + The SSL connection could not be established, see inner exception. + + + HTTP 1.0 does not support chunking. + + + An attempt was made to move the position before the beginning of the stream. + diff --git a/external/corefx/src/System.Net.Http/src/Shims/Uri.cs b/external/corefx/src/System.Net.Http/src/Shims/Uri.cs deleted file mode 100644 index fc909b4f14..0000000000 --- a/external/corefx/src/System.Net.Http/src/Shims/Uri.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace System -{ - // TODO (#5715): Move this class to System.Net.Common. - internal class UriShim - { - private const char c_DummyChar = (char)0xFFFF; - private static readonly char[] s_hexUpperChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - - // Transforms a character into its hexadecimal representation. - public static string HexEscape(char character) - { - if (character > '\xff') - { - throw new ArgumentOutOfRangeException(nameof(character)); - } - char[] chars = new char[3]; - int pos = 0; - UriShim.EscapeAsciiChar(character, chars, ref pos); - return new string(chars); - } - - // HexUnescape - // - // Converts a substring of the form "%XX" to the single character represented - // by the hexadecimal value XX. If the substring s[Index] does not conform to - // the hex encoding format then the character at s[Index] is returned - // - // Inputs: - // pattern - // String from which to read the hexadecimal encoded substring - // - // index - // Offset within from which to start reading the hexadecimal - // encoded substring - // - // Outputs: - // index - // Incremented to the next character position within the string. This - // may be EOS if this was the last character/encoding within - // - // Returns: - // Either the converted character if [] was hex encoded, or - // the character at [] - // - // Throws: - // ArgumentOutOfRangeException - public static char HexUnescape(string pattern, ref int index) - { - if ((index < 0) || (index >= pattern.Length)) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - if ((pattern[index] == '%') - && (pattern.Length - index >= 3)) - { - char ret = UriShim.EscapedAscii(pattern[index + 1], pattern[index + 2]); - if (ret != c_DummyChar) - { - index += 3; - return ret; - } - } - return pattern[index++]; - } - - // IsHexEncoding - // - // Determines whether a substring has the URI hex encoding format of '%' - // followed by 2 hexadecimal characters - // - // Inputs: - // pattern - // String to check - // - // index - // Offset in at which to check substring for hex encoding - // - // Assumes: - // 0 <= < .Length - // - // Returns: - // true if [] is hex encoded, else false - // - // Throws: - // Nothing - public static bool IsHexEncoding(string pattern, int index) - { - if ((pattern.Length - index) < 3) - { - return false; - } - if ((pattern[index] == '%') && UriShim.EscapedAscii(pattern[index + 1], pattern[index + 2]) != c_DummyChar) - { - return true; - } - return false; - } - - internal static void EscapeAsciiChar(char ch, char[] to, ref int pos) - { - to[pos++] = '%'; - to[pos++] = s_hexUpperChars[(ch & 0xf0) >> 4]; - to[pos++] = s_hexUpperChars[ch & 0xf]; - } - - private static char EscapedAscii(char digit, char next) - { - if (!(((digit >= '0') && (digit <= '9')) - || ((digit >= 'A') && (digit <= 'F')) - || ((digit >= 'a') && (digit <= 'f')))) - { - return c_DummyChar; - } - - int res = (digit <= '9') - ? ((int)digit - (int)'0') - : (((digit <= 'F') - ? ((int)digit - (int)'A') - : ((int)digit - (int)'a')) - + 10); - - if (!(((next >= '0') && (next <= '9')) - || ((next >= 'A') && (next <= 'F')) - || ((next >= 'a') && (next <= 'f')))) - { - return c_DummyChar; - } - - return (char)((res << 4) + ((next <= '9') - ? ((int)next - (int)'0') - : (((next <= 'F') - ? ((int)next - (int)'A') - : ((int)next - (int)'a')) - + 10))); - } - } -} diff --git a/external/corefx/src/System.Net.Http/src/System.Net.Http.csproj b/external/corefx/src/System.Net.Http/src/System.Net.Http.csproj index a04f0d9fa9..b048009e70 100644 --- a/external/corefx/src/System.Net.Http/src/System.Net.Http.csproj +++ b/external/corefx/src/System.Net.Http/src/System.Net.Http.csproj @@ -11,16 +11,12 @@ true $(DefineConstants);HTTP_DLL - - - - @@ -30,16 +26,16 @@ $(DefineConstants);SYSNETHTTP_NO_OPENSSL - - - - + + + + @@ -57,6 +53,7 @@ + @@ -70,6 +67,7 @@ + @@ -110,6 +108,9 @@ Common\System\IO\DelegatingStream.cs + + Common\System\IO\ReadOnlyMemoryStream.cs + Common\System\IO\StringBuilderCache.cs @@ -121,23 +122,32 @@ - + + + + + + + + + + - - + + @@ -166,7 +176,7 @@ - + @@ -177,29 +187,13 @@ HttpMessageHandler.cs. We also use the HTTP_DLL define to change public classes into internal ones to remove confusion if someone looks at the implementation dlls. They are public in the separate WinHttpHandler.dll binary. --> - + - + - - - $(DefineConstants);NET46 - true - - - - - - Common\System\Threading\Tasks\TaskToApm.cs - - - - - - true @@ -422,6 +416,7 @@ + @@ -429,12 +424,16 @@ + + + + diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/ByteArrayHelpers.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/ByteArrayHelpers.cs new file mode 100644 index 0000000000..0105cc7e18 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/ByteArrayHelpers.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Text; + +namespace System +{ + internal static class ByteArrayHelpers + { + internal static bool EqualsOrdinalAsciiIgnoreCase(string left, ReadOnlySpan right) + { + Debug.Assert(left != null, "Expected non-null string"); + + if (left.Length != right.Length) + { + return false; + } + + for (int i = 0; i < left.Length; i++) + { + uint charA = left[i]; + uint charB = right[i]; + + unchecked + { + // We're only interested in ASCII characters here. + if ((charA - 'a') <= ('z' - 'a')) + charA -= ('a' - 'A'); + if ((charB - 'a') <= ('z' - 'a')) + charB -= ('a' - 'A'); + } + + if (charA != charB) + { + return false; + } + } + + return true; + } + + internal static unsafe string GetStringFromByteSpan(ReadOnlySpan bytes) + { + // TODO #22431: Use new Span-based Encoding overload when available + fixed (byte* p = &bytes.DangerousGetPinnableReference()) + { + return Encoding.ASCII.GetString(p, bytes.Length); + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs index 0e95a0015d..f6e99d800f 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs @@ -406,7 +406,7 @@ namespace System.Net.Http.Headers string processedValue = string.Empty; if (parameter.EndsWith("*", StringComparison.Ordinal)) { - processedValue = Encode5987(value); + processedValue = HeaderUtilities.Encode5987(value); } else { @@ -532,35 +532,6 @@ namespace System.Net.Http.Headers return false; } - // Encode a string using RFC 5987 encoding. - // encoding'lang'PercentEncodedSpecials - private string Encode5987(string input) - { - StringBuilder builder = new StringBuilder("utf-8\'\'"); - foreach (char c in input) - { - // attr-char = ALPHA / DIGIT / "!" / "#" / "$" / "&" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" - // ; token except ( "*" / "'" / "%" ) - if (c > 0x7F) // Encodes as multiple utf-8 bytes - { - byte[] bytes = Encoding.UTF8.GetBytes(c.ToString()); - foreach (byte b in bytes) - { - builder.Append(UriShim.HexEscape((char)b)); - } - } - else if (!HttpRuleParser.IsTokenChar(c) || c == '*' || c == '\'' || c == '%') - { - // ASCII - Only one encoded byte. - builder.Append(UriShim.HexEscape(c)); - } - else - { - builder.Append(c); - } - } - return builder.ToString(); - } // Attempt to decode using RFC 5987 encoding. // encoding'language'my%20string @@ -592,10 +563,10 @@ namespace System.Net.Http.Headers int unescapedBytesCount = 0; for (int index = 0; index < dataString.Length; index++) { - if (UriShim.IsHexEncoding(dataString, index)) // %FF + if (Uri.IsHexEncoding(dataString, index)) // %FF { // Unescape and cache bytes, multi-byte characters must be decoded all at once. - unescapedBytes[unescapedBytesCount++] = (byte)UriShim.HexUnescape(dataString, ref index); + unescapedBytes[unescapedBytesCount++] = (byte)Uri.HexUnescape(dataString, ref index); index--; // HexUnescape did +=3; Offset the for loop's ++ } else diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs new file mode 100644 index 0000000000..3737e44709 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderDescriptor.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.Net.Http.Headers +{ + // This struct represents a particular named header -- + // if the header is one of our known headers, then it contains a reference to the KnownHeader object; + // otherwise, for custom headers, it just contains a string for the header name. + // Use HeaderDescriptor.TryGet to resolve an arbitrary header name to a HeaderDescriptor. + internal struct HeaderDescriptor : IEquatable + { + private readonly string _headerName; + private readonly KnownHeader _knownHeader; + + public HeaderDescriptor(KnownHeader knownHeader) + { + _knownHeader = knownHeader; + _headerName = knownHeader.Name; + } + + // This should not be used directly; use static TryGet below + private HeaderDescriptor(string headerName) + { + _headerName = headerName; + _knownHeader = null; + } + + public string Name => _headerName; + public HttpHeaderParser Parser => _knownHeader?.Parser; + public HttpHeaderType HeaderType => _knownHeader == null ? HttpHeaderType.Custom : _knownHeader.HeaderType; + + public bool Equals(HeaderDescriptor other) => + _knownHeader == null ? + string.Equals(_headerName, other._headerName, StringComparison.OrdinalIgnoreCase) : + _knownHeader == other._knownHeader; + public override int GetHashCode() => _knownHeader?.GetHashCode() ?? StringComparer.OrdinalIgnoreCase.GetHashCode(_headerName); + public override bool Equals(object obj) => throw new InvalidOperationException(); // Ensure this is never called, to avoid boxing + public static bool operator ==(HeaderDescriptor left, HeaderDescriptor right) => left.Equals(right); + public static bool operator !=(HeaderDescriptor left, HeaderDescriptor right) => !left.Equals(right); + + // Returns false for invalid header name. + public static bool TryGet(string headerName, out HeaderDescriptor descriptor) + { + Debug.Assert(!string.IsNullOrEmpty(headerName)); + + KnownHeader knownHeader = KnownHeaders.TryGetKnownHeader(headerName); + if (knownHeader != null) + { + descriptor = new HeaderDescriptor(knownHeader); + return true; + } + + if (!HttpRuleParser.IsToken(headerName)) + { + descriptor = default(HeaderDescriptor); + return false; + } + + descriptor = new HeaderDescriptor(headerName); + return true; + } + + // Returns false for invalid header name. + public static bool TryGet(ReadOnlySpan headerName, out HeaderDescriptor descriptor) + { + Debug.Assert(headerName.Length > 0); + + KnownHeader knownHeader = KnownHeaders.TryGetKnownHeader(headerName); + if (knownHeader != null) + { + descriptor = new HeaderDescriptor(knownHeader); + return true; + } + + if (!HttpRuleParser.IsToken(headerName)) + { + descriptor = default(HeaderDescriptor); + return false; + } + + descriptor = new HeaderDescriptor(ByteArrayHelpers.GetStringFromByteSpan(headerName)); + return true; + } + + public HeaderDescriptor AsCustomHeader() + { + Debug.Assert(_knownHeader != null); + Debug.Assert(_knownHeader.HeaderType != HttpHeaderType.Custom); + return new HeaderDescriptor(_knownHeader.Name); + } + + public string GetHeaderValue(ReadOnlySpan headerValue) + { + if (headerValue.Length == 0) + { + return string.Empty; + } + + // If it's a known header value, use the known value instead of allocating a new string. + if (_knownHeader != null && _knownHeader.KnownValues != null) + { + string[] knownValues = _knownHeader.KnownValues; + for (int i = 0; i < knownValues.Length; i++) + { + if (ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(knownValues[i], headerValue)) + { + return knownValues[i]; + } + } + } + + return ByteArrayHelpers.GetStringFromByteSpan(headerValue); + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs index 4c67343974..75a8ef8e09 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Globalization; +using System.IO; using System.Net.Mail; using System.Text; @@ -26,6 +27,8 @@ namespace System.Net.Http.Headers // Validator internal static readonly Action, string> TokenValidator = ValidateToken; + private static readonly char[] s_hexUpperChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + internal static void SetQuality(ObjectCollection parameters, double? value) { Debug.Assert(parameters != null); @@ -63,6 +66,64 @@ namespace System.Net.Http.Headers } } + // Encode a string using RFC 5987 encoding. + // encoding'lang'PercentEncodedSpecials + internal static string Encode5987(string input) + { + string output; + IsInputEncoded5987(input, out output); + + return output; + } + + internal static bool IsInputEncoded5987(string input, out string output) + { + // Encode a string using RFC 5987 encoding. + // encoding'lang'PercentEncodedSpecials + bool wasEncoded = false; + StringBuilder builder = StringBuilderCache.Acquire(); + builder.Append("utf-8\'\'"); + foreach (char c in input) + { + // attr-char = ALPHA / DIGIT / "!" / "#" / "$" / "&" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + // ; token except ( "*" / "'" / "%" ) + if (c > 0x7F) // Encodes as multiple utf-8 bytes + { + byte[] bytes = Encoding.UTF8.GetBytes(c.ToString()); + foreach (byte b in bytes) + { + AddHexEscaped((char)b, builder); + wasEncoded = true; + } + } + else if (!HttpRuleParser.IsTokenChar(c) || c == '*' || c == '\'' || c == '%') + { + // ASCII - Only one encoded byte. + AddHexEscaped(c, builder); + wasEncoded = true; + } + else + { + builder.Append(c); + } + + } + + output = StringBuilderCache.GetStringAndRelease(builder); + return wasEncoded; + } + + /// Transforms an ASCII character into its hexadecimal representation, adding the characters to a StringBuilder. + private static void AddHexEscaped(char c, StringBuilder destination) + { + Debug.Assert(destination != null); + Debug.Assert(c <= 0xFF); + + destination.Append('%'); + destination.Append(s_hexUpperChars[(c & 0xf0) >> 4]); + destination.Append(s_hexUpperChars[c & 0xf]); + } + internal static double? GetQuality(ObjectCollection parameters) { Debug.Assert(parameters != null); @@ -225,11 +286,11 @@ namespace System.Net.Http.Headers return current; } - internal static DateTimeOffset? GetDateTimeOffsetValue(string headerName, HttpHeaders store) + internal static DateTimeOffset? GetDateTimeOffsetValue(HeaderDescriptor descriptor, HttpHeaders store) { Debug.Assert(store != null); - object storedValue = store.GetParsedValues(headerName); + object storedValue = store.GetParsedValues(descriptor); if (storedValue != null) { return (DateTimeOffset)storedValue; @@ -237,11 +298,11 @@ namespace System.Net.Http.Headers return null; } - internal static TimeSpan? GetTimeSpanValue(string headerName, HttpHeaders store) + internal static TimeSpan? GetTimeSpanValue(HeaderDescriptor descriptor, HttpHeaders store) { Debug.Assert(store != null); - object storedValue = store.GetParsedValues(headerName); + object storedValue = store.GetParsedValues(descriptor); if (storedValue != null) { return (TimeSpan)storedValue; @@ -270,17 +331,14 @@ namespace System.Net.Http.Headers tmpResult > int.MaxValue / 10 || // will overflow when shifting digits (tmpResult == int.MaxValue / 10 && digit > 7)) // will overflow when adding in digit { - goto ReturnFalse; // Remove goto once https://github.com/dotnet/coreclr/issues/9692 is addressed + result = 0; + return false; } tmpResult = (tmpResult * 10) + digit; } result = tmpResult; return true; - - ReturnFalse: - result = 0; - return false; } internal static bool TryParseInt64(string value, int offset, int length, out long result) // TODO #21281: Replace with int.TryParse(Span) once it's available @@ -301,17 +359,14 @@ namespace System.Net.Http.Headers tmpResult > long.MaxValue / 10 || // will overflow when shifting digits (tmpResult == long.MaxValue / 10 && digit > 7)) // will overflow when adding in digit { - goto ReturnFalse; // Remove goto once https://github.com/dotnet/coreclr/issues/9692 is addressed + result = 0; + return false; } tmpResult = (tmpResult * 10) + digit; } result = tmpResult; return true; - - ReturnFalse: - result = 0; - return false; } internal static string DumpHeaders(params HttpHeaders[] headers) diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs index fd3ca87f19..974de64e83 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs @@ -12,9 +12,6 @@ namespace System.Net.Http.Headers Justification = "This is not a collection")] public sealed class HttpContentHeaders : HttpHeaders { - private static readonly Dictionary s_parserStore = CreateParserStore(); - private static readonly HashSet s_invalidHeaders = CreateInvalidHeaders(); - private readonly HttpContent _parent; private bool _contentLengthSet; @@ -28,7 +25,7 @@ namespace System.Net.Http.Headers { if (_allow == null) { - _allow = new HttpHeaderValueCollection(HttpKnownHeaderNames.Allow, + _allow = new HttpHeaderValueCollection(KnownHeaders.Allow.Descriptor, this, HeaderUtilities.TokenValidator); } return _allow; @@ -37,8 +34,8 @@ namespace System.Net.Http.Headers public ContentDispositionHeaderValue ContentDisposition { - get { return (ContentDispositionHeaderValue)GetParsedValues(HttpKnownHeaderNames.ContentDisposition); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ContentDisposition, value); } + get { return (ContentDispositionHeaderValue)GetParsedValues(KnownHeaders.ContentDisposition.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ContentDisposition.Descriptor, value); } } // Must be a collection (and not provide properties like "GZip", "Deflate", etc.) since the @@ -49,7 +46,7 @@ namespace System.Net.Http.Headers { if (_contentEncoding == null) { - _contentEncoding = new HttpHeaderValueCollection(HttpKnownHeaderNames.ContentEncoding, + _contentEncoding = new HttpHeaderValueCollection(KnownHeaders.ContentEncoding.Descriptor, this, HeaderUtilities.TokenValidator); } return _contentEncoding; @@ -62,7 +59,7 @@ namespace System.Net.Http.Headers { if (_contentLanguage == null) { - _contentLanguage = new HttpHeaderValueCollection(HttpKnownHeaderNames.ContentLanguage, + _contentLanguage = new HttpHeaderValueCollection(KnownHeaders.ContentLanguage.Descriptor, this, HeaderUtilities.TokenValidator); } return _contentLanguage; @@ -74,7 +71,7 @@ namespace System.Net.Http.Headers get { // 'Content-Length' can only hold one value. So either we get 'null' back or a boxed long value. - object storedValue = GetParsedValues(HttpKnownHeaderNames.ContentLength); + object storedValue = GetParsedValues(KnownHeaders.ContentLength.Descriptor); // Only try to calculate the length if the user didn't set the value explicitly using the setter. if (!_contentLengthSet && (storedValue == null)) @@ -86,7 +83,7 @@ namespace System.Net.Http.Headers if (calculatedLength != null) { - SetParsedValue(HttpKnownHeaderNames.ContentLength, (object)calculatedLength.Value); + SetParsedValue(KnownHeaders.ContentLength.Descriptor, (object)calculatedLength.Value); } return calculatedLength; @@ -103,101 +100,53 @@ namespace System.Net.Http.Headers } set { - SetOrRemoveParsedValue(HttpKnownHeaderNames.ContentLength, value); // box long value + SetOrRemoveParsedValue(KnownHeaders.ContentLength.Descriptor, value); // box long value _contentLengthSet = true; } } public Uri ContentLocation { - get { return (Uri)GetParsedValues(HttpKnownHeaderNames.ContentLocation); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ContentLocation, value); } + get { return (Uri)GetParsedValues(KnownHeaders.ContentLocation.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ContentLocation.Descriptor, value); } } [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "In this case the 'value' is the byte array. I.e. the array is treated as a value.")] public byte[] ContentMD5 { - get { return (byte[])GetParsedValues(HttpKnownHeaderNames.ContentMD5); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ContentMD5, value); } + get { return (byte[])GetParsedValues(KnownHeaders.ContentMD5.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ContentMD5.Descriptor, value); } } public ContentRangeHeaderValue ContentRange { - get { return (ContentRangeHeaderValue)GetParsedValues(HttpKnownHeaderNames.ContentRange); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ContentRange, value); } + get { return (ContentRangeHeaderValue)GetParsedValues(KnownHeaders.ContentRange.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ContentRange.Descriptor, value); } } public MediaTypeHeaderValue ContentType { - get { return (MediaTypeHeaderValue)GetParsedValues(HttpKnownHeaderNames.ContentType); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ContentType, value); } + get { return (MediaTypeHeaderValue)GetParsedValues(KnownHeaders.ContentType.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ContentType.Descriptor, value); } } public DateTimeOffset? Expires { - get { return HeaderUtilities.GetDateTimeOffsetValue(HttpKnownHeaderNames.Expires, this); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.Expires, value); } + get { return HeaderUtilities.GetDateTimeOffsetValue(KnownHeaders.Expires.Descriptor, this); } + set { SetOrRemoveParsedValue(KnownHeaders.Expires.Descriptor, value); } } public DateTimeOffset? LastModified { - get { return HeaderUtilities.GetDateTimeOffsetValue(HttpKnownHeaderNames.LastModified, this); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.LastModified, value); } + get { return HeaderUtilities.GetDateTimeOffsetValue(KnownHeaders.LastModified.Descriptor, this); } + set { SetOrRemoveParsedValue(KnownHeaders.LastModified.Descriptor, value); } } internal HttpContentHeaders(HttpContent parent) + : base(HttpHeaderType.Content | HttpHeaderType.Custom, HttpHeaderType.None) { _parent = parent; - - SetConfiguration(s_parserStore, s_invalidHeaders); - } - - private static Dictionary CreateParserStore() - { - var parserStore = new Dictionary(11, StringComparer.OrdinalIgnoreCase); - - parserStore.Add(HttpKnownHeaderNames.Allow, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.ContentDisposition, GenericHeaderParser.ContentDispositionParser); - parserStore.Add(HttpKnownHeaderNames.ContentEncoding, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.ContentLanguage, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.ContentLength, Int64NumberHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.ContentLocation, UriHeaderParser.RelativeOrAbsoluteUriParser); - parserStore.Add(HttpKnownHeaderNames.ContentMD5, ByteArrayHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.ContentRange, GenericHeaderParser.ContentRangeParser); - parserStore.Add(HttpKnownHeaderNames.ContentType, MediaTypeHeaderParser.SingleValueParser); - parserStore.Add(HttpKnownHeaderNames.Expires, DateHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.LastModified, DateHeaderParser.Parser); - - return parserStore; - } - - private static HashSet CreateInvalidHeaders() - { - var invalidHeaders = new HashSet(StringComparer.OrdinalIgnoreCase); - - HttpRequestHeaders.AddKnownHeaders(invalidHeaders); - HttpResponseHeaders.AddKnownHeaders(invalidHeaders); - HttpGeneralHeaders.AddKnownHeaders(invalidHeaders); - - return invalidHeaders; - } - - internal static void AddKnownHeaders(HashSet headerSet) - { - Debug.Assert(headerSet != null); - - headerSet.Add(HttpKnownHeaderNames.Allow); - headerSet.Add(HttpKnownHeaderNames.ContentDisposition); - headerSet.Add(HttpKnownHeaderNames.ContentEncoding); - headerSet.Add(HttpKnownHeaderNames.ContentLanguage); - headerSet.Add(HttpKnownHeaderNames.ContentLength); - headerSet.Add(HttpKnownHeaderNames.ContentLocation); - headerSet.Add(HttpKnownHeaderNames.ContentMD5); - headerSet.Add(HttpKnownHeaderNames.ContentRange); - headerSet.Add(HttpKnownHeaderNames.ContentType); - headerSet.Add(HttpKnownHeaderNames.Expires); - headerSet.Add(HttpKnownHeaderNames.LastModified); } } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs index 16cbbfec2f..b2cd436cb0 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs @@ -24,8 +24,8 @@ namespace System.Net.Http.Headers public CacheControlHeaderValue CacheControl { - get { return (CacheControlHeaderValue)_parent.GetParsedValues(HttpKnownHeaderNames.CacheControl); } - set { _parent.SetOrRemoveParsedValue(HttpKnownHeaderNames.CacheControl, value); } + get { return (CacheControlHeaderValue)_parent.GetParsedValues(KnownHeaders.CacheControl.Descriptor); } + set { _parent.SetOrRemoveParsedValue(KnownHeaders.CacheControl.Descriptor, value); } } public HttpHeaderValueCollection Connection @@ -70,7 +70,7 @@ namespace System.Net.Http.Headers return true; } } - else if (parent.ContainsParsedValue(HttpKnownHeaderNames.Connection, HeaderUtilities.ConnectionClose)) + else if (parent.ContainsParsedValue(KnownHeaders.Connection.Descriptor, HeaderUtilities.ConnectionClose)) { return true; } @@ -83,8 +83,8 @@ namespace System.Net.Http.Headers public DateTimeOffset? Date { - get { return HeaderUtilities.GetDateTimeOffsetValue(HttpKnownHeaderNames.Date, _parent); } - set { _parent.SetOrRemoveParsedValue(HttpKnownHeaderNames.Date, value); } + get { return HeaderUtilities.GetDateTimeOffsetValue(KnownHeaders.Date.Descriptor, _parent); } + set { _parent.SetOrRemoveParsedValue(KnownHeaders.Date.Descriptor, value); } } public HttpHeaderValueCollection Pragma @@ -93,7 +93,7 @@ namespace System.Net.Http.Headers { if (_pragma == null) { - _pragma = new HttpHeaderValueCollection(HttpKnownHeaderNames.Pragma, _parent); + _pragma = new HttpHeaderValueCollection(KnownHeaders.Pragma.Descriptor, _parent); } return _pragma; } @@ -105,7 +105,7 @@ namespace System.Net.Http.Headers { if (_trailer == null) { - _trailer = new HttpHeaderValueCollection(HttpKnownHeaderNames.Trailer, + _trailer = new HttpHeaderValueCollection(KnownHeaders.Trailer.Descriptor, _parent, HeaderUtilities.TokenValidator); } return _trailer; @@ -130,7 +130,7 @@ namespace System.Net.Http.Headers return true; } } - else if (parent.ContainsParsedValue(HttpKnownHeaderNames.TransferEncoding, HeaderUtilities.TransferEncodingChunked)) + else if (parent.ContainsParsedValue(KnownHeaders.TransferEncoding.Descriptor, HeaderUtilities.TransferEncodingChunked)) { return true; } @@ -171,7 +171,7 @@ namespace System.Net.Http.Headers { if (_upgrade == null) { - _upgrade = new HttpHeaderValueCollection(HttpKnownHeaderNames.Upgrade, _parent); + _upgrade = new HttpHeaderValueCollection(KnownHeaders.Upgrade.Descriptor, _parent); } return _upgrade; } @@ -183,7 +183,7 @@ namespace System.Net.Http.Headers { if (_via == null) { - _via = new HttpHeaderValueCollection(HttpKnownHeaderNames.Via, _parent); + _via = new HttpHeaderValueCollection(KnownHeaders.Via.Descriptor, _parent); } return _via; } @@ -195,7 +195,7 @@ namespace System.Net.Http.Headers { if (_warning == null) { - _warning = new HttpHeaderValueCollection(HttpKnownHeaderNames.Warning, _parent); + _warning = new HttpHeaderValueCollection(KnownHeaders.Warning.Descriptor, _parent); } return _warning; } @@ -207,7 +207,7 @@ namespace System.Net.Http.Headers { if (_connection == null) { - _connection = new HttpHeaderValueCollection(HttpKnownHeaderNames.Connection, + _connection = new HttpHeaderValueCollection(KnownHeaders.Connection.Descriptor, _parent, HeaderUtilities.ConnectionClose, HeaderUtilities.TokenValidator); } return _connection; @@ -221,7 +221,7 @@ namespace System.Net.Http.Headers if (_transferEncoding == null) { _transferEncoding = new HttpHeaderValueCollection( - HttpKnownHeaderNames.TransferEncoding, _parent, HeaderUtilities.TransferEncodingChunked); + KnownHeaders.TransferEncoding.Descriptor, _parent, HeaderUtilities.TransferEncodingChunked); } return _transferEncoding; } @@ -234,36 +234,6 @@ namespace System.Net.Http.Headers _parent = parent; } - internal static void AddParsers(Dictionary parserStore) - { - Debug.Assert(parserStore != null); - - parserStore.Add(HttpKnownHeaderNames.CacheControl, CacheControlHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.Connection, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.Date, DateHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.Pragma, GenericHeaderParser.MultipleValueNameValueParser); - parserStore.Add(HttpKnownHeaderNames.Trailer, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.TransferEncoding, TransferCodingHeaderParser.MultipleValueParser); - parserStore.Add(HttpKnownHeaderNames.Upgrade, GenericHeaderParser.MultipleValueProductParser); - parserStore.Add(HttpKnownHeaderNames.Via, GenericHeaderParser.MultipleValueViaParser); - parserStore.Add(HttpKnownHeaderNames.Warning, GenericHeaderParser.MultipleValueWarningParser); - } - - internal static void AddKnownHeaders(HashSet headerSet) - { - Debug.Assert(headerSet != null); - - headerSet.Add(HttpKnownHeaderNames.CacheControl); - headerSet.Add(HttpKnownHeaderNames.Connection); - headerSet.Add(HttpKnownHeaderNames.Date); - headerSet.Add(HttpKnownHeaderNames.Pragma); - headerSet.Add(HttpKnownHeaderNames.Trailer); - headerSet.Add(HttpKnownHeaderNames.TransferEncoding); - headerSet.Add(HttpKnownHeaderNames.Upgrade); - headerSet.Add(HttpKnownHeaderNames.Via); - headerSet.Add(HttpKnownHeaderNames.Warning); - } - internal void AddSpecialsFrom(HttpGeneralHeaders sourceHeaders) { // Copy special values, but do not overwrite diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderType.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderType.cs new file mode 100644 index 0000000000..8fe488b26e --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderType.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Net.Http.Headers +{ + [Flags] + internal enum HttpHeaderType : byte + { + General = 0b1, + Request = 0b10, + Response = 0b100, + Content = 0b1000, + Custom = 0b10000, + + All = 0b11111, + None = 0 + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderValueCollection.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderValueCollection.cs index 6d82ca132c..a8e7284f3f 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderValueCollection.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaderValueCollection.cs @@ -34,7 +34,7 @@ namespace System.Net.Http.Headers // - Property TransferEncodingChunked: is set to "true". public sealed class HttpHeaderValueCollection : ICollection where T : class { - private string _headerName; + private HeaderDescriptor _descriptor; private HttpHeaders _store; private T _specialValue; private Action, T> _validator; @@ -58,34 +58,34 @@ namespace System.Net.Http.Headers { return false; } - return _store.ContainsParsedValue(_headerName, _specialValue); + return _store.ContainsParsedValue(_descriptor, _specialValue); } } - internal HttpHeaderValueCollection(string headerName, HttpHeaders store) - : this(headerName, store, null, null) + internal HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store) + : this(descriptor, store, null, null) { } - internal HttpHeaderValueCollection(string headerName, HttpHeaders store, + internal HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store, Action, T> validator) - : this(headerName, store, null, validator) + : this(descriptor, store, null, validator) { } - internal HttpHeaderValueCollection(string headerName, HttpHeaders store, T specialValue) - : this(headerName, store, specialValue, null) + internal HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store, T specialValue) + : this(descriptor, store, specialValue, null) { } - internal HttpHeaderValueCollection(string headerName, HttpHeaders store, T specialValue, + internal HttpHeaderValueCollection(HeaderDescriptor descriptor, HttpHeaders store, T specialValue, Action, T> validator) { - Debug.Assert(headerName != null); + Debug.Assert(descriptor.Name != null); Debug.Assert(store != null); _store = store; - _headerName = headerName; + _descriptor = descriptor; _specialValue = specialValue; _validator = validator; } @@ -93,28 +93,28 @@ namespace System.Net.Http.Headers public void Add(T item) { CheckValue(item); - _store.AddParsedValue(_headerName, item); + _store.AddParsedValue(_descriptor, item); } public void ParseAdd(string input) { - _store.Add(_headerName, input); + _store.Add(_descriptor, input); } public bool TryParseAdd(string input) { - return _store.TryParseAndAddValue(_headerName, input); + return _store.TryParseAndAddValue(_descriptor, input); } public void Clear() { - _store.Remove(_headerName); + _store.Remove(_descriptor); } public bool Contains(T item) { CheckValue(item); - return _store.ContainsParsedValue(_headerName, item); + return _store.ContainsParsedValue(_descriptor, item); } public void CopyTo(T[] array, int arrayIndex) @@ -129,7 +129,7 @@ namespace System.Net.Http.Headers throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } - object storeValue = _store.GetParsedValues(_headerName); + object storeValue = _store.GetParsedValues(_descriptor); if (storeValue == null) { @@ -158,14 +158,14 @@ namespace System.Net.Http.Headers public bool Remove(T item) { CheckValue(item); - return _store.RemoveParsedValue(_headerName, item); + return _store.RemoveParsedValue(_descriptor, item); } #region IEnumerable Members public IEnumerator GetEnumerator() { - object storeValue = _store.GetParsedValues(_headerName); + object storeValue = _store.GetParsedValues(_descriptor); if (storeValue == null) { @@ -203,7 +203,7 @@ namespace System.Net.Http.Headers public override string ToString() { - return _store.GetHeaderString(_headerName); + return _store.GetHeaderString(_descriptor); } internal string GetHeaderStringWithoutSpecial() @@ -212,7 +212,7 @@ namespace System.Net.Http.Headers { return ToString(); } - return _store.GetHeaderString(_headerName, _specialValue); + return _store.GetHeaderString(_descriptor, _specialValue); } internal void SetSpecialValue() @@ -220,9 +220,9 @@ namespace System.Net.Http.Headers Debug.Assert(_specialValue != null, "This method can only be used if the collection has a 'special value' set."); - if (!_store.ContainsParsedValue(_headerName, _specialValue)) + if (!_store.ContainsParsedValue(_descriptor, _specialValue)) { - _store.AddParsedValue(_headerName, _specialValue); + _store.AddParsedValue(_descriptor, _specialValue); } } @@ -233,7 +233,7 @@ namespace System.Net.Http.Headers // We're not interested in the return value. It's OK if the "special value" wasn't in the store // before calling RemoveParsedValue(). - _store.RemoveParsedValue(_headerName, _specialValue); + _store.RemoveParsedValue(_descriptor, _specialValue); } private void CheckValue(T item) @@ -254,7 +254,7 @@ namespace System.Net.Http.Headers { // This is an O(n) operation. - object storeValue = _store.GetParsedValues(_headerName); + object storeValue = _store.GetParsedValues(_descriptor); if (storeValue == null) { diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs index f5064a123e..c6c2930023 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs @@ -34,9 +34,9 @@ namespace System.Net.Http.Headers Justification = "This is not a collection")] public abstract class HttpHeaders : IEnumerable>> { - private Dictionary _headerStore; - private Dictionary _parserStore; - private HashSet _invalidHeaders; + private Dictionary _headerStore; + private readonly HttpHeaderType _allowedHeaderTypes; + private readonly HttpHeaderType _treatAsCustomHeaderTypes; private enum StoreLocation { @@ -46,41 +46,58 @@ namespace System.Net.Http.Headers } protected HttpHeaders() + : this(HttpHeaderType.All, HttpHeaderType.None) { } + internal HttpHeaders(HttpHeaderType allowedHeaderTypes, HttpHeaderType treatAsCustomHeaderTypes) + { + // Should be no overlap + Debug.Assert((allowedHeaderTypes & treatAsCustomHeaderTypes) == 0); + + _allowedHeaderTypes = allowedHeaderTypes; + _treatAsCustomHeaderTypes = treatAsCustomHeaderTypes; + } + public void Add(string name, string value) { - CheckHeaderName(name); + Add(GetHeaderDescriptor(name), value); + } + internal void Add(HeaderDescriptor descriptor, string value) + { // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing // the value then throws, we would have to remove the header from the store again. So just get a // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header. HeaderStoreItemInfo info; bool addToStore; - PrepareHeaderInfoForAdd(name, out info, out addToStore); + PrepareHeaderInfoForAdd(descriptor, out info, out addToStore); - ParseAndAddValue(name, info, value); + ParseAndAddValue(descriptor, info, value); // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add // it to the store if we added at least one value. if (addToStore && (info.ParsedValue != null)) { - AddHeaderToStore(name, info); + AddHeaderToStore(descriptor, info); } } public void Add(string name, IEnumerable values) + { + Add(GetHeaderDescriptor(name), values); + } + + internal void Add(HeaderDescriptor descriptor, IEnumerable values) { if (values == null) { throw new ArgumentNullException(nameof(values)); } - CheckHeaderName(name); HeaderStoreItemInfo info; bool addToStore; - PrepareHeaderInfoForAdd(name, out info, out addToStore); + PrepareHeaderInfoForAdd(descriptor, out info, out addToStore); try { @@ -88,7 +105,7 @@ namespace System.Net.Http.Headers // will be added to the store before the exception for the invalid value is thrown. foreach (string value in values) { - ParseAndAddValue(name, info, value); + ParseAndAddValue(descriptor, info, value); } } finally @@ -100,18 +117,17 @@ namespace System.Net.Http.Headers // However, if all values for a _new_ header were invalid, then don't add the header. if (addToStore && (info.ParsedValue != null)) { - AddHeaderToStore(name, info); + AddHeaderToStore(descriptor, info); } } } - public bool TryAddWithoutValidation(string name, string value) - { - if (!TryCheckHeaderName(name)) - { - return false; - } + public bool TryAddWithoutValidation(string name, string value) => + TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor) && + TryAddWithoutValidation(descriptor, value); + internal bool TryAddWithoutValidation(HeaderDescriptor descriptor, string value) + { if (value == null) { // We allow empty header values. (e.g. "My-Header: "). If the user adds multiple null/empty @@ -120,24 +136,24 @@ namespace System.Net.Http.Headers value = string.Empty; } - HeaderStoreItemInfo info = GetOrCreateHeaderInfo(name, false); + HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor, false); AddValue(info, value, StoreLocation.Raw); return true; } - public bool TryAddWithoutValidation(string name, IEnumerable values) + public bool TryAddWithoutValidation(string name, IEnumerable values) => + TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor) && + TryAddWithoutValidation(descriptor, values); + + internal bool TryAddWithoutValidation(HeaderDescriptor descriptor, IEnumerable values) { if (values == null) { throw new ArgumentNullException(nameof(values)); } - if (!TryCheckHeaderName(name)) - { - return false; - } - HeaderStoreItemInfo info = GetOrCreateHeaderInfo(name, false); + HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor, false); foreach (string value in values) { // We allow empty header values. (e.g. "My-Header: "). If the user adds multiple null/empty @@ -159,22 +175,18 @@ namespace System.Net.Http.Headers public bool Remove(string name) { - CheckHeaderName(name); - - if (_headerStore == null) - { - return false; - } - - return _headerStore.Remove(name); + return Remove(GetHeaderDescriptor(name)); } public IEnumerable GetValues(string name) { - CheckHeaderName(name); + return GetValues(GetHeaderDescriptor(name)); + } + internal IEnumerable GetValues(HeaderDescriptor descriptor) + { IEnumerable values; - if (!TryGetValues(name, out values)) + if (!TryGetValues(descriptor, out values)) { throw new InvalidOperationException(SR.net_http_headers_not_found); } @@ -184,12 +196,18 @@ namespace System.Net.Http.Headers public bool TryGetValues(string name, out IEnumerable values) { - if (!TryCheckHeaderName(name)) + HeaderDescriptor descriptor; + if (!TryGetHeaderDescriptor(name, out descriptor)) { values = null; return false; } + return TryGetValues(descriptor, out values); + } + + internal bool TryGetValues(HeaderDescriptor descriptor, out IEnumerable values) + { if (_headerStore == null) { values = null; @@ -197,9 +215,9 @@ namespace System.Net.Http.Headers } HeaderStoreItemInfo info = null; - if (TryGetAndParseHeaderInfo(name, out info)) + if (TryGetAndParseHeaderInfo(descriptor, out info)) { - values = GetValuesAsStrings(info); + values = GetValuesAsStrings(descriptor, info); return true; } @@ -209,8 +227,11 @@ namespace System.Net.Http.Headers public bool Contains(string name) { - CheckHeaderName(name); + return Contains(GetHeaderDescriptor(name)); + } + internal bool Contains(HeaderDescriptor descriptor) + { if (_headerStore == null) { return false; @@ -220,7 +241,7 @@ namespace System.Net.Http.Headers // anymore (if the value contains invalid newline chars, we remove the header). So try to parse the // header value. HeaderStoreItemInfo info = null; - return TryGetAndParseHeaderInfo(name, out info); + return TryGetAndParseHeaderInfo(descriptor, out info); } public override string ToString() @@ -235,11 +256,12 @@ namespace System.Net.Http.Headers // HeaderName2: Value1 // ... StringBuilder sb = new StringBuilder(); - foreach (var header in this) + foreach (var header in GetHeaderStrings()) { sb.Append(header.Key); sb.Append(": "); - sb.Append(this.GetHeaderString(header.Key)); + + sb.Append(header.Value); sb.Append("\r\n"); } @@ -255,40 +277,38 @@ namespace System.Net.Http.Headers foreach (var header in _headerStore) { - HeaderStoreItemInfo info = header.Value; + string stringValue = GetHeaderString(header.Key, header.Value); - string stringValue = GetHeaderString(info); - - yield return new KeyValuePair(header.Key, stringValue); + yield return new KeyValuePair(header.Key.Name, stringValue); } } - internal string GetHeaderString(string headerName) + internal string GetHeaderString(string name) { - return GetHeaderString(headerName, null); - } - - internal string GetHeaderString(string headerName, object exclude) - { - HeaderStoreItemInfo info; - if (!TryGetHeaderInfo(headerName, out info)) + if (!TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor)) { return string.Empty; } - return GetHeaderString(info, exclude); + return GetHeaderString(descriptor); } - private string GetHeaderString(HeaderStoreItemInfo info) + internal string GetHeaderString(HeaderDescriptor descriptor, object exclude = null) { - return GetHeaderString(info, null); + HeaderStoreItemInfo info; + if (!TryGetHeaderInfo(descriptor, out info)) + { + return string.Empty; + } + + return GetHeaderString(descriptor, info, exclude); } - private string GetHeaderString(HeaderStoreItemInfo info, object exclude) + private string GetHeaderString(HeaderDescriptor descriptor, HeaderStoreItemInfo info, object exclude = null) { string stringValue; - string[] values = GetValuesAsStrings(info, exclude); + string[] values = GetValuesAsStrings(descriptor, info, exclude); if (values.Length == 1) { @@ -299,9 +319,9 @@ namespace System.Net.Http.Headers // Note that if we get multiple values for a header that doesn't support multiple values, we'll // just separate the values using a comma (default separator). string separator = HttpHeaderParser.DefaultSeparator; - if ((info.Parser != null) && (info.Parser.SupportsMultipleValues)) + if ((descriptor.Parser != null) && (descriptor.Parser.SupportsMultipleValues)) { - separator = info.Parser.Separator; + separator = descriptor.Parser.Separator; } stringValue = string.Join(separator, values); } @@ -309,7 +329,7 @@ namespace System.Net.Http.Headers return stringValue; } - #region IEnumerable>> Members +#region IEnumerable>> Members public IEnumerator>> GetEnumerator() { @@ -320,29 +340,30 @@ namespace System.Net.Http.Headers private IEnumerator>> GetEnumeratorCore() { - List invalidHeaders = null; + List invalidHeaders = null; foreach (var header in _headerStore) { + HeaderDescriptor descriptor = header.Key; HeaderStoreItemInfo info = header.Value; // Make sure we parse all raw values before returning the result. Note that this has to be // done before we calculate the array length (next line): A raw value may contain a list of // values. - if (!ParseRawHeaderValues(header.Key, info, false)) + if (!ParseRawHeaderValues(descriptor, info, false)) { // We have an invalid header value (contains invalid newline chars). Mark it as "to-be-deleted" // and skip this header. if (invalidHeaders == null) { - invalidHeaders = new List(); + invalidHeaders = new List(); } - invalidHeaders.Add(header.Key); + invalidHeaders.Add(descriptor); } else { - string[] values = GetValuesAsStrings(info); - yield return new KeyValuePair>(header.Key, values); + string[] values = GetValuesAsStrings(descriptor, info); + yield return new KeyValuePair>(descriptor.Name, values); } } @@ -352,59 +373,46 @@ namespace System.Net.Http.Headers if (invalidHeaders != null) { Debug.Assert(_headerStore != null); - foreach (string invalidHeader in invalidHeaders) + foreach (HeaderDescriptor invalidheaderInfo in invalidHeaders) { - _headerStore.Remove(invalidHeader); + _headerStore.Remove(invalidheaderInfo); } } } - #endregion +#endregion - #region IEnumerable Members +#region IEnumerable Members Collections.IEnumerator Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } - #endregion +#endregion - internal void SetConfiguration(Dictionary parserStore, - HashSet invalidHeaders) + internal void AddParsedValue(HeaderDescriptor descriptor, object value) { - Debug.Assert(_parserStore == null, "Parser store was already set."); - - _parserStore = parserStore; - _invalidHeaders = invalidHeaders; - } - - internal void AddParsedValue(string name, object value) - { - Debug.Assert((name != null) && (name.Length > 0)); - Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); Debug.Assert(value != null); + Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); - HeaderStoreItemInfo info = GetOrCreateHeaderInfo(name, true); - Debug.Assert(info.Parser != null, "Can't add parsed value if there is no parser available."); + HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor, true); // If the current header has only one value, we can't add another value. The strongly typed property // must not call AddParsedValue(), but SetParsedValue(). E.g. for headers like 'Date', 'Host'. - Debug.Assert(info.CanAddValue, "Header '" + name + "' doesn't support multiple values"); + Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values"); AddValue(info, value, StoreLocation.Parsed); } - internal void SetParsedValue(string name, object value) + internal void SetParsedValue(HeaderDescriptor descriptor, object value) { - Debug.Assert((name != null) && (name.Length > 0)); - Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); Debug.Assert(value != null); + Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); // This method will first clear all values. This is used e.g. when setting the 'Date' or 'Host' header. // I.e. headers not supporting collections. - HeaderStoreItemInfo info = GetOrCreateHeaderInfo(name, true); - Debug.Assert(info.Parser != null, "Can't add parsed value if there is no parser available."); + HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor, true); info.InvalidValue = null; info.ParsedValue = null; @@ -413,22 +421,30 @@ namespace System.Net.Http.Headers AddValue(info, value, StoreLocation.Parsed); } - internal void SetOrRemoveParsedValue(string name, object value) + internal void SetOrRemoveParsedValue(HeaderDescriptor descriptor, object value) { if (value == null) { - Remove(name); + Remove(descriptor); } else { - SetParsedValue(name, value); + SetParsedValue(descriptor, value); } } - internal bool RemoveParsedValue(string name, object value) + internal bool Remove(HeaderDescriptor descriptor) + { + if (_headerStore == null) + { + return false; + } + + return _headerStore.Remove(descriptor); + } + + internal bool RemoveParsedValue(HeaderDescriptor descriptor, object value) { - Debug.Assert((name != null) && (name.Length > 0)); - Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); Debug.Assert(value != null); if (_headerStore == null) @@ -439,10 +455,10 @@ namespace System.Net.Http.Headers // If we have a value for this header, then verify if we have a single value. If so, compare that // value with 'item'. If we have a list of values, then remove 'item' from the list. HeaderStoreItemInfo info = null; - if (TryGetAndParseHeaderInfo(name, out info)) + if (TryGetAndParseHeaderInfo(descriptor, out info)) { - Debug.Assert(info.Parser != null, "Can't add parsed value if there is no parser available."); - Debug.Assert(info.Parser.SupportsMultipleValues, + Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); + Debug.Assert(descriptor.Parser.SupportsMultipleValues, "This method should not be used for single-value headers. Use Remove(string) instead."); bool result = false; @@ -453,7 +469,7 @@ namespace System.Net.Http.Headers return false; } - IEqualityComparer comparer = info.Parser.Comparer; + IEqualityComparer comparer = descriptor.Parser.Comparer; List parsedValues = info.ParsedValue as List; if (parsedValues == null) @@ -494,8 +510,8 @@ namespace System.Net.Http.Headers // If there is no value for the header left, remove the header. if (info.IsEmpty) { - bool headerRemoved = Remove(name); - Debug.Assert(headerRemoved, "Existing header '" + name + "' couldn't be removed."); + bool headerRemoved = Remove(descriptor); + Debug.Assert(headerRemoved, "Existing header '" + descriptor.Name + "' couldn't be removed."); } return result; @@ -503,10 +519,8 @@ namespace System.Net.Http.Headers return false; } - internal bool ContainsParsedValue(string name, object value) + internal bool ContainsParsedValue(HeaderDescriptor descriptor, object value) { - Debug.Assert((name != null) && (name.Length > 0)); - Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); Debug.Assert(value != null); if (_headerStore == null) @@ -517,10 +531,10 @@ namespace System.Net.Http.Headers // If we have a value for this header, then verify if we have a single value. If so, compare that // value with 'item'. If we have a list of values, then compare each item in the list with 'item'. HeaderStoreItemInfo info = null; - if (TryGetAndParseHeaderInfo(name, out info)) + if (TryGetAndParseHeaderInfo(descriptor, out info)) { - Debug.Assert(info.Parser != null, "Can't add parsed value if there is no parser available."); - Debug.Assert(info.Parser.SupportsMultipleValues, + Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); + Debug.Assert(descriptor.Parser.SupportsMultipleValues, "This method should not be used for single-value headers. Use equality comparer instead."); // If there is no entry, just return. @@ -531,7 +545,7 @@ namespace System.Net.Http.Headers List parsedValues = info.ParsedValue as List; - IEqualityComparer comparer = info.Parser.Comparer; + IEqualityComparer comparer = descriptor.Parser.Comparer; if (parsedValues == null) { @@ -562,15 +576,14 @@ namespace System.Net.Http.Headers internal virtual void AddHeaders(HttpHeaders sourceHeaders) { Debug.Assert(sourceHeaders != null); - Debug.Assert(_parserStore == sourceHeaders._parserStore, - "Can only copy headers from an instance with the same header parsers."); + Debug.Assert(GetType() == sourceHeaders.GetType(), "Can only copy headers from an instance of the same type."); if (sourceHeaders._headerStore == null) { return; } - List invalidHeaders = null; + List invalidHeaders = null; foreach (var header in sourceHeaders._headerStore) { @@ -590,7 +603,7 @@ namespace System.Net.Http.Headers // invalid newline chars), mark this header as 'to-be-deleted' and skip to the next header. if (invalidHeaders == null) { - invalidHeaders = new List(); + invalidHeaders = new List(); } invalidHeaders.Add(header.Key); @@ -605,22 +618,19 @@ namespace System.Net.Http.Headers if (invalidHeaders != null) { Debug.Assert(sourceHeaders._headerStore != null); - foreach (string invalidHeader in invalidHeaders) + foreach (HeaderDescriptor invalidheaderInfo in invalidHeaders) { - sourceHeaders._headerStore.Remove(invalidHeader); + sourceHeaders._headerStore.Remove(invalidheaderInfo); } } } - private void AddHeaderInfo(string headerName, HeaderStoreItemInfo sourceInfo) + private void AddHeaderInfo(HeaderDescriptor descriptor, HeaderStoreItemInfo sourceInfo) { - HeaderStoreItemInfo destinationInfo = CreateAndAddHeaderToStore(headerName); - Debug.Assert(sourceInfo.Parser == destinationInfo.Parser, - "Expected same parser on both source and destination header store for header '" + headerName + - "'."); + HeaderStoreItemInfo destinationInfo = CreateAndAddHeaderToStore(descriptor); // We have custom header values. The parsed values are strings. - if (destinationInfo.Parser == null) + if (descriptor.Parser == null) { Debug.Assert((sourceInfo.RawValue == null) && (sourceInfo.InvalidValue == null), "No raw or invalid values expected for custom headers."); @@ -692,52 +702,49 @@ namespace System.Net.Http.Headers } } - private HeaderStoreItemInfo GetOrCreateHeaderInfo(string name, bool parseRawValues) + private HeaderStoreItemInfo GetOrCreateHeaderInfo(HeaderDescriptor descriptor, bool parseRawValues) { - Debug.Assert((name != null) && (name.Length > 0)); - Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); Contract.Ensures(Contract.Result() != null); HeaderStoreItemInfo result = null; bool found = false; if (parseRawValues) { - found = TryGetAndParseHeaderInfo(name, out result); + found = TryGetAndParseHeaderInfo(descriptor, out result); } else { - found = TryGetHeaderInfo(name, out result); + found = TryGetHeaderInfo(descriptor, out result); } if (!found) { - result = CreateAndAddHeaderToStore(name); + result = CreateAndAddHeaderToStore(descriptor); } return result; } - private HeaderStoreItemInfo CreateAndAddHeaderToStore(string name) + private HeaderStoreItemInfo CreateAndAddHeaderToStore(HeaderDescriptor descriptor) { // If we don't have the header in the store yet, add it now. - HeaderStoreItemInfo result = new HeaderStoreItemInfo(GetParser(name)); + HeaderStoreItemInfo result = new HeaderStoreItemInfo(); - AddHeaderToStore(name, result); + AddHeaderToStore(descriptor, result); return result; } - private void AddHeaderToStore(string name, HeaderStoreItemInfo info) + private void AddHeaderToStore(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { if (_headerStore == null) { - _headerStore = new Dictionary( - StringComparer.OrdinalIgnoreCase); + _headerStore = new Dictionary(); } - _headerStore.Add(name, info); + _headerStore.Add(descriptor, info); } - private bool TryGetHeaderInfo(string name, out HeaderStoreItemInfo info) + private bool TryGetHeaderInfo(HeaderDescriptor descriptor, out HeaderStoreItemInfo info) { if (_headerStore == null) { @@ -745,20 +752,20 @@ namespace System.Net.Http.Headers return false; } - return _headerStore.TryGetValue(name, out info); + return _headerStore.TryGetValue(descriptor, out info); } - private bool TryGetAndParseHeaderInfo(string name, out HeaderStoreItemInfo info) + private bool TryGetAndParseHeaderInfo(HeaderDescriptor key, out HeaderStoreItemInfo info) { - if (TryGetHeaderInfo(name, out info)) + if (TryGetHeaderInfo(key, out info)) { - return ParseRawHeaderValues(name, info, true); + return ParseRawHeaderValues(key, info, true); } return false; } - private bool ParseRawHeaderValues(string name, HeaderStoreItemInfo info, bool removeEmptyHeader) + private bool ParseRawHeaderValues(HeaderDescriptor descriptor, HeaderStoreItemInfo info, bool removeEmptyHeader) { // Prevent multiple threads from parsing the raw value at the same time, or else we would get // false duplicates or false nulls. @@ -772,11 +779,11 @@ namespace System.Net.Http.Headers if (rawValues == null) { - ParseSingleRawHeaderValue(name, info); + ParseSingleRawHeaderValue(descriptor, info); } else { - ParseMultipleRawHeaderValues(name, info, rawValues); + ParseMultipleRawHeaderValues(descriptor, info, rawValues); } // At this point all values are either in info.ParsedValue, info.InvalidValue, or were removed since they @@ -793,7 +800,7 @@ namespace System.Net.Http.Headers // After parsing the raw value, no value is left because all values contain invalid newline // chars. Debug.Assert(_headerStore != null); - _headerStore.Remove(name); + _headerStore.Remove(descriptor); } return false; } @@ -803,13 +810,13 @@ namespace System.Net.Http.Headers return true; } - private static void ParseMultipleRawHeaderValues(string name, HeaderStoreItemInfo info, List rawValues) + private static void ParseMultipleRawHeaderValues(HeaderDescriptor descriptor, HeaderStoreItemInfo info, List rawValues) { - if (info.Parser == null) + if (descriptor.Parser == null) { foreach (string rawValue in rawValues) { - if (!ContainsInvalidNewLine(rawValue, name)) + if (!ContainsInvalidNewLine(rawValue, descriptor.Name)) { AddValue(info, rawValue, StoreLocation.Parsed); } @@ -819,68 +826,68 @@ namespace System.Net.Http.Headers { foreach (string rawValue in rawValues) { - if (!TryParseAndAddRawHeaderValue(name, info, rawValue, true)) + if (!TryParseAndAddRawHeaderValue(descriptor, info, rawValue, true)) { - if (NetEventSource.IsEnabled) NetEventSource.Log.HeadersInvalidValue(name, rawValue); + if (NetEventSource.IsEnabled) NetEventSource.Log.HeadersInvalidValue(descriptor.Name, rawValue); } } } } - private static void ParseSingleRawHeaderValue(string name, HeaderStoreItemInfo info) + private static void ParseSingleRawHeaderValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { string rawValue = info.RawValue as string; Debug.Assert(rawValue != null, "RawValue must either be List or string."); - if (info.Parser == null) + if (descriptor.Parser == null) { - if (!ContainsInvalidNewLine(rawValue, name)) + if (!ContainsInvalidNewLine(rawValue, descriptor.Name)) { AddValue(info, rawValue, StoreLocation.Parsed); } } else { - if (!TryParseAndAddRawHeaderValue(name, info, rawValue, true)) + if (!TryParseAndAddRawHeaderValue(descriptor, info, rawValue, true)) { - if (NetEventSource.IsEnabled) NetEventSource.Log.HeadersInvalidValue(name, rawValue); + if (NetEventSource.IsEnabled) NetEventSource.Log.HeadersInvalidValue(descriptor.Name, rawValue); } } } // See Add(name, string) - internal bool TryParseAndAddValue(string name, string value) + internal bool TryParseAndAddValue(HeaderDescriptor descriptor, string value) { // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing // the value then throws, we would have to remove the header from the store again. So just get a // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header. HeaderStoreItemInfo info; bool addToStore; - PrepareHeaderInfoForAdd(name, out info, out addToStore); + PrepareHeaderInfoForAdd(descriptor, out info, out addToStore); - bool result = TryParseAndAddRawHeaderValue(name, info, value, false); + bool result = TryParseAndAddRawHeaderValue(descriptor, info, value, false); if (result && addToStore && (info.ParsedValue != null)) { // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add // it to the store if we added at least one value. - AddHeaderToStore(name, info); + AddHeaderToStore(descriptor, info); } return result; } // See ParseAndAddValue - private static bool TryParseAndAddRawHeaderValue(string name, HeaderStoreItemInfo info, string value, bool addWhenInvalid) + private static bool TryParseAndAddRawHeaderValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, string value, bool addWhenInvalid) { Debug.Assert(info != null); - Debug.Assert(info.Parser != null); + Debug.Assert(descriptor.Parser != null); // Values are added as 'invalid' if we either can't parse the value OR if we already have a value // and the current header doesn't support multiple values: e.g. trying to add a date/time value // to the 'Date' header if we already have a date/time value will result in the second value being // added to the 'invalid' header values. - if (!info.CanAddValue) + if (!info.CanAddValue(descriptor.Parser)) { if (addWhenInvalid) { @@ -892,7 +899,7 @@ namespace System.Net.Http.Headers int index = 0; object parsedValue = null; - if (info.Parser.TryParseValue(value, info.ParsedValue, ref index, out parsedValue)) + if (descriptor.Parser.TryParseValue(value, info.ParsedValue, ref index, out parsedValue)) { // The raw string only represented one value (which was successfully parsed). Add the value and return. if ((value == null) || (index == value.Length)) @@ -915,7 +922,7 @@ namespace System.Net.Http.Headers while (index < value.Length) { - if (info.Parser.TryParseValue(value, info.ParsedValue, ref index, out parsedValue)) + if (descriptor.Parser.TryParseValue(value, info.ParsedValue, ref index, out parsedValue)) { if (parsedValue != null) { @@ -924,7 +931,7 @@ namespace System.Net.Http.Headers } else { - if (!ContainsInvalidNewLine(value, name) && addWhenInvalid) + if (!ContainsInvalidNewLine(value, descriptor.Name) && addWhenInvalid) { AddValue(info, value, StoreLocation.Invalid); } @@ -940,7 +947,7 @@ namespace System.Net.Http.Headers return true; } - if (!ContainsInvalidNewLine(value, name) && addWhenInvalid) + if (!ContainsInvalidNewLine(value, descriptor.Name) && addWhenInvalid) { AddValue(info, value ?? string.Empty, StoreLocation.Invalid); } @@ -956,9 +963,6 @@ namespace System.Net.Http.Headers // - if 'T', i.e. we have already a value stored (but no list), create a list, add the stored value // to the list and append 'value' at the end of the newly created list. - Debug.Assert((info.Parser != null) || ((info.Parser == null) && (value.GetType() == typeof(string))), - "If no parser is defined, then the value must be string."); - object currentStoreValue = null; switch (location) { @@ -1018,14 +1022,11 @@ namespace System.Net.Http.Headers // Since most of the time we just have 1 value, we don't create a List for one value, but we change // the return type to 'object'. The caller has to deal with the return type (object vs. List). This // is to optimize the most common scenario where a header has only one value. - internal object GetParsedValues(string name) + internal object GetParsedValues(HeaderDescriptor descriptor) { - Debug.Assert((name != null) && (name.Length > 0)); - Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); - HeaderStoreItemInfo info = null; - if (!TryGetAndParseHeaderInfo(name, out info)) + if (!TryGetAndParseHeaderInfo(descriptor, out info)) { return null; } @@ -1033,22 +1034,22 @@ namespace System.Net.Http.Headers return info.ParsedValue; } - private void PrepareHeaderInfoForAdd(string name, out HeaderStoreItemInfo info, out bool addToStore) + private void PrepareHeaderInfoForAdd(HeaderDescriptor descriptor, out HeaderStoreItemInfo info, out bool addToStore) { info = null; addToStore = false; - if (!TryGetAndParseHeaderInfo(name, out info)) + if (!TryGetAndParseHeaderInfo(descriptor, out info)) { - info = new HeaderStoreItemInfo(GetParser(name)); + info = new HeaderStoreItemInfo(); addToStore = true; } } - private void ParseAndAddValue(string name, HeaderStoreItemInfo info, string value) + private void ParseAndAddValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, string value) { Debug.Assert(info != null); - if (info.Parser == null) + if (descriptor.Parser == null) { // If we don't have a parser for the header, we consider the value valid if it doesn't contains // invalid newline characters. We add the values as "parsed value". Note that we allow empty values. @@ -1059,13 +1060,13 @@ namespace System.Net.Http.Headers // If the header only supports 1 value, we can add the current value only if there is no // value already set. - if (!info.CanAddValue) + if (!info.CanAddValue(descriptor.Parser)) { - throw new FormatException(string.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_single_value_header, name)); + throw new FormatException(string.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_single_value_header, descriptor.Name)); } int index = 0; - object parsedValue = info.Parser.ParseValue(value, info.ParsedValue, ref index); + object parsedValue = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); // The raw string only represented one value (which was successfully parsed). Add the value and return. // If value is null we still have to first call ParseValue() to allow the parser to decide whether null is @@ -1092,7 +1093,7 @@ namespace System.Net.Http.Headers while (index < value.Length) { - parsedValue = info.Parser.ParseValue(value, info.ParsedValue, ref index); + parsedValue = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); if (parsedValue != null) { parsedValues.Add(parsedValue); @@ -1106,58 +1107,54 @@ namespace System.Net.Http.Headers } } - private HttpHeaderParser GetParser(string name) - { - if (_parserStore == null) - { - return null; - } - - HttpHeaderParser parser = null; - if (_parserStore.TryGetValue(name, out parser)) - { - return parser; - } - - return null; - } - - private void CheckHeaderName(string name) + private HeaderDescriptor GetHeaderDescriptor(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException(SR.net_http_argument_empty_string, nameof(name)); } - if (HttpRuleParser.GetTokenLength(name, 0) != name.Length) + if (!HeaderDescriptor.TryGet(name, out HeaderDescriptor descriptor)) { throw new FormatException(SR.net_http_headers_invalid_header_name); } - if ((_invalidHeaders != null) && (_invalidHeaders.Contains(name))) + if ((descriptor.HeaderType & _allowedHeaderTypes) != 0) { - throw new InvalidOperationException(SR.net_http_headers_not_allowed_header_name); + return descriptor; } + else if ((descriptor.HeaderType & _treatAsCustomHeaderTypes) != 0) + { + return descriptor.AsCustomHeader(); + } + + throw new InvalidOperationException(SR.net_http_headers_not_allowed_header_name); } - private bool TryCheckHeaderName(string name) + private bool TryGetHeaderDescriptor(string name, out HeaderDescriptor descriptor) { if (string.IsNullOrEmpty(name)) { + descriptor = default(HeaderDescriptor); return false; } - if (HttpRuleParser.GetTokenLength(name, 0) != name.Length) + if (!HeaderDescriptor.TryGet(name, out descriptor)) { return false; } - if ((_invalidHeaders != null) && (_invalidHeaders.Contains(name))) + if ((descriptor.HeaderType & _allowedHeaderTypes) != 0) { - return false; + return true; + } + else if ((descriptor.HeaderType & _treatAsCustomHeaderTypes) != 0) + { + descriptor = descriptor.AsCustomHeader(); + return true; } - return true; + return false; } private static void CheckInvalidNewLine(string value) @@ -1183,13 +1180,7 @@ namespace System.Net.Http.Headers return false; } - private static string[] GetValuesAsStrings(HeaderStoreItemInfo info) - { - return GetValuesAsStrings(info, null); - } - - // When doing exclusion comparison, assume raw values have been parsed. - private static string[] GetValuesAsStrings(HeaderStoreItemInfo info, object exclude) + private static string[] GetValuesAsStrings(HeaderDescriptor descriptor, HeaderStoreItemInfo info, object exclude = null) { Contract.Ensures(Contract.Result() != null); @@ -1202,7 +1193,7 @@ namespace System.Net.Http.Headers int currentIndex = 0; ReadStoreValues(values, info.RawValue, null, null, ref currentIndex); - ReadStoreValues(values, info.ParsedValue, info.Parser, exclude, ref currentIndex); + ReadStoreValues(values, info.ParsedValue, descriptor.Parser, exclude, ref currentIndex); // Set parser parameter to 'null' for invalid values: The invalid values is always a string so we // don't need the parser to "serialize" the value to a string. @@ -1315,14 +1306,13 @@ namespace System.Net.Http.Headers return value.Equals(storeValue); } - #region Private Classes +#region Private Classes private class HeaderStoreItemInfo { private object _rawValue; private object _invalidValue; private object _parsedValue; - private HttpHeaderParser _parser; internal object RawValue { @@ -1342,29 +1332,21 @@ namespace System.Net.Http.Headers set { _parsedValue = value; } } - internal HttpHeaderParser Parser + internal bool CanAddValue(HttpHeaderParser parser) { - get { return _parser; } - } + Debug.Assert(parser != null, + "There should be no reason to call CanAddValue if there is no parser for the current header."); - internal bool CanAddValue - { - get - { - Debug.Assert(_parser != null, - "There should be no reason to call CanAddValue if there is no parser for the current header."); - - // If the header only supports one value, and we have already a value set, then we can't add - // another value. E.g. the 'Date' header only supports one value. We can't add multiple timestamps - // to 'Date'. - // So if this is a known header, ask the parser if it supports multiple values and check whether - // we already have a (valid or invalid) value. - // Note that we ignore the rawValue by purpose: E.g. we are parsing 2 raw values for a header only - // supporting 1 value. When the first value gets parsed, CanAddValue returns true and we add the - // parsed value to ParsedValue. When the second value is parsed, CanAddValue returns false, because - // we have already a parsed value. - return ((_parser.SupportsMultipleValues) || ((_invalidValue == null) && (_parsedValue == null))); - } + // If the header only supports one value, and we have already a value set, then we can't add + // another value. E.g. the 'Date' header only supports one value. We can't add multiple timestamps + // to 'Date'. + // So if this is a known header, ask the parser if it supports multiple values and check whether + // we already have a (valid or invalid) value. + // Note that we ignore the rawValue by purpose: E.g. we are parsing 2 raw values for a header only + // supporting 1 value. When the first value gets parsed, CanAddValue returns true and we add the + // parsed value to ParsedValue. When the second value is parsed, CanAddValue returns false, because + // we have already a parsed value. + return ((parser.SupportsMultipleValues) || ((_invalidValue == null) && (_parsedValue == null))); } internal bool IsEmpty @@ -1372,12 +1354,10 @@ namespace System.Net.Http.Headers get { return ((_rawValue == null) && (_invalidValue == null) && (_parsedValue == null)); } } - internal HeaderStoreItemInfo(HttpHeaderParser parser) + internal HeaderStoreItemInfo() { - // Can be null. - _parser = parser; } } - #endregion +#endregion } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs index b547aa1f37..c49e36a382 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; @@ -12,9 +11,6 @@ namespace System.Net.Http.Headers Justification = "This is not a collection")] public sealed class HttpRequestHeaders : HttpHeaders { - private static readonly Dictionary s_parserStore = CreateParserStore(); - private static readonly HashSet s_invalidHeaders = CreateInvalidHeaders(); - private const int AcceptSlot = 0; private const int AcceptCharsetSlot = 1; private const int AcceptEncodingSlot = 2; @@ -47,22 +43,22 @@ namespace System.Net.Http.Headers } public HttpHeaderValueCollection Accept => - GetSpecializedCollection(AcceptSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.Accept, thisRef)); + GetSpecializedCollection(AcceptSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.Accept.Descriptor, thisRef)); [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Charset", Justification = "The HTTP header name is 'Accept-Charset'.")] public HttpHeaderValueCollection AcceptCharset => - GetSpecializedCollection(AcceptCharsetSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.AcceptCharset, thisRef)); + GetSpecializedCollection(AcceptCharsetSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.AcceptCharset.Descriptor, thisRef)); public HttpHeaderValueCollection AcceptEncoding => - GetSpecializedCollection(AcceptEncodingSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.AcceptEncoding, thisRef)); + GetSpecializedCollection(AcceptEncodingSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.AcceptEncoding.Descriptor, thisRef)); public HttpHeaderValueCollection AcceptLanguage => - GetSpecializedCollection(AcceptLanguageSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.AcceptLanguage, thisRef)); + GetSpecializedCollection(AcceptLanguageSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.AcceptLanguage.Descriptor, thisRef)); public AuthenticationHeaderValue Authorization { - get { return (AuthenticationHeaderValue)GetParsedValues(HttpKnownHeaderNames.Authorization); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.Authorization, value); } + get { return (AuthenticationHeaderValue)GetParsedValues(KnownHeaders.Authorization.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.Authorization.Descriptor, value); } } public HttpHeaderValueCollection Expect @@ -101,7 +97,7 @@ namespace System.Net.Http.Headers public string From { - get { return (string)GetParsedValues(HttpKnownHeaderNames.From); } + get { return (string)GetParsedValues(KnownHeaders.From.Descriptor); } set { // Null and empty string are equivalent. In this case it means, remove the From header value (if any). @@ -114,13 +110,13 @@ namespace System.Net.Http.Headers { throw new FormatException(SR.net_http_headers_invalid_from_header); } - SetOrRemoveParsedValue(HttpKnownHeaderNames.From, value); + SetOrRemoveParsedValue(KnownHeaders.From.Descriptor, value); } } public string Host { - get { return (string)GetParsedValues(HttpKnownHeaderNames.Host); } + get { return (string)GetParsedValues(KnownHeaders.Host.Descriptor); } set { // Null and empty string are equivalent. In this case it means, remove the Host header value (if any). @@ -134,75 +130,75 @@ namespace System.Net.Http.Headers { throw new FormatException(SR.net_http_headers_invalid_host_header); } - SetOrRemoveParsedValue(HttpKnownHeaderNames.Host, value); + SetOrRemoveParsedValue(KnownHeaders.Host.Descriptor, value); } } public HttpHeaderValueCollection IfMatch => - GetSpecializedCollection(IfMatchSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.IfMatch, thisRef)); + GetSpecializedCollection(IfMatchSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.IfMatch.Descriptor, thisRef)); public DateTimeOffset? IfModifiedSince { - get { return HeaderUtilities.GetDateTimeOffsetValue(HttpKnownHeaderNames.IfModifiedSince, this); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.IfModifiedSince, value); } + get { return HeaderUtilities.GetDateTimeOffsetValue(KnownHeaders.IfModifiedSince.Descriptor, this); } + set { SetOrRemoveParsedValue(KnownHeaders.IfModifiedSince.Descriptor, value); } } public HttpHeaderValueCollection IfNoneMatch => - GetSpecializedCollection(IfNoneMatchSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.IfNoneMatch, thisRef)); + GetSpecializedCollection(IfNoneMatchSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.IfNoneMatch.Descriptor, thisRef)); public RangeConditionHeaderValue IfRange { - get { return (RangeConditionHeaderValue)GetParsedValues(HttpKnownHeaderNames.IfRange); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.IfRange, value); } + get { return (RangeConditionHeaderValue)GetParsedValues(KnownHeaders.IfRange.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.IfRange.Descriptor, value); } } public DateTimeOffset? IfUnmodifiedSince { - get { return HeaderUtilities.GetDateTimeOffsetValue(HttpKnownHeaderNames.IfUnmodifiedSince, this); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.IfUnmodifiedSince, value); } + get { return HeaderUtilities.GetDateTimeOffsetValue(KnownHeaders.IfUnmodifiedSince.Descriptor, this); } + set { SetOrRemoveParsedValue(KnownHeaders.IfUnmodifiedSince.Descriptor, value); } } public int? MaxForwards { get { - object storedValue = GetParsedValues(HttpKnownHeaderNames.MaxForwards); + object storedValue = GetParsedValues(KnownHeaders.MaxForwards.Descriptor); if (storedValue != null) { return (int)storedValue; } return null; } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.MaxForwards, value); } + set { SetOrRemoveParsedValue(KnownHeaders.MaxForwards.Descriptor, value); } } public AuthenticationHeaderValue ProxyAuthorization { - get { return (AuthenticationHeaderValue)GetParsedValues(HttpKnownHeaderNames.ProxyAuthorization); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ProxyAuthorization, value); } + get { return (AuthenticationHeaderValue)GetParsedValues(KnownHeaders.ProxyAuthorization.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ProxyAuthorization.Descriptor, value); } } public RangeHeaderValue Range { - get { return (RangeHeaderValue)GetParsedValues(HttpKnownHeaderNames.Range); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.Range, value); } + get { return (RangeHeaderValue)GetParsedValues(KnownHeaders.Range.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.Range.Descriptor, value); } } public Uri Referrer { - get { return (Uri)GetParsedValues(HttpKnownHeaderNames.Referer); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.Referer, value); } + get { return (Uri)GetParsedValues(KnownHeaders.Referer.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.Referer.Descriptor, value); } } public HttpHeaderValueCollection TE => - GetSpecializedCollection(TransferEncodingSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.TE, thisRef)); + GetSpecializedCollection(TransferEncodingSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.TE.Descriptor, thisRef)); public HttpHeaderValueCollection UserAgent => - GetSpecializedCollection(UserAgentSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.UserAgent, thisRef)); + GetSpecializedCollection(UserAgentSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.UserAgent.Descriptor, thisRef)); private HttpHeaderValueCollection ExpectCore => - GetSpecializedCollection(ExpectSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.Expect, thisRef, HeaderUtilities.ExpectContinue)); + GetSpecializedCollection(ExpectSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.Expect.Descriptor, thisRef, HeaderUtilities.ExpectContinue)); #endregion @@ -270,73 +266,8 @@ namespace System.Net.Http.Headers #endregion internal HttpRequestHeaders() + : base(HttpHeaderType.General | HttpHeaderType.Request | HttpHeaderType.Custom, HttpHeaderType.Response) { - base.SetConfiguration(s_parserStore, s_invalidHeaders); - } - - private static Dictionary CreateParserStore() - { - var parserStore = new Dictionary(StringComparer.OrdinalIgnoreCase); - - parserStore.Add(HttpKnownHeaderNames.Accept, MediaTypeHeaderParser.MultipleValuesParser); - parserStore.Add(HttpKnownHeaderNames.AcceptCharset, GenericHeaderParser.MultipleValueStringWithQualityParser); - parserStore.Add(HttpKnownHeaderNames.AcceptEncoding, GenericHeaderParser.MultipleValueStringWithQualityParser); - parserStore.Add(HttpKnownHeaderNames.AcceptLanguage, GenericHeaderParser.MultipleValueStringWithQualityParser); - parserStore.Add(HttpKnownHeaderNames.Authorization, GenericHeaderParser.SingleValueAuthenticationParser); - parserStore.Add(HttpKnownHeaderNames.Expect, GenericHeaderParser.MultipleValueNameValueWithParametersParser); - parserStore.Add(HttpKnownHeaderNames.From, GenericHeaderParser.MailAddressParser); - parserStore.Add(HttpKnownHeaderNames.Host, GenericHeaderParser.HostParser); - parserStore.Add(HttpKnownHeaderNames.IfMatch, GenericHeaderParser.MultipleValueEntityTagParser); - parserStore.Add(HttpKnownHeaderNames.IfModifiedSince, DateHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.IfNoneMatch, GenericHeaderParser.MultipleValueEntityTagParser); - parserStore.Add(HttpKnownHeaderNames.IfRange, GenericHeaderParser.RangeConditionParser); - parserStore.Add(HttpKnownHeaderNames.IfUnmodifiedSince, DateHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.MaxForwards, Int32NumberHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.ProxyAuthorization, GenericHeaderParser.SingleValueAuthenticationParser); - parserStore.Add(HttpKnownHeaderNames.Range, GenericHeaderParser.RangeParser); - parserStore.Add(HttpKnownHeaderNames.Referer, UriHeaderParser.RelativeOrAbsoluteUriParser); - parserStore.Add(HttpKnownHeaderNames.TE, TransferCodingHeaderParser.MultipleValueWithQualityParser); - parserStore.Add(HttpKnownHeaderNames.UserAgent, ProductInfoHeaderParser.MultipleValueParser); - - HttpGeneralHeaders.AddParsers(parserStore); - - return parserStore; - } - - private static HashSet CreateInvalidHeaders() - { - var invalidHeaders = new HashSet(StringComparer.OrdinalIgnoreCase); - HttpContentHeaders.AddKnownHeaders(invalidHeaders); - return invalidHeaders; - - // Note: Reserved response header names are allowed as custom request header names. Reserved response - // headers have no defined meaning or format when used on a request. This enables a server to accept - // any headers sent from the client as either content headers or request headers. - } - - internal static void AddKnownHeaders(HashSet headerSet) - { - Debug.Assert(headerSet != null); - - headerSet.Add(HttpKnownHeaderNames.Accept); - headerSet.Add(HttpKnownHeaderNames.AcceptCharset); - headerSet.Add(HttpKnownHeaderNames.AcceptEncoding); - headerSet.Add(HttpKnownHeaderNames.AcceptLanguage); - headerSet.Add(HttpKnownHeaderNames.Authorization); - headerSet.Add(HttpKnownHeaderNames.Expect); - headerSet.Add(HttpKnownHeaderNames.From); - headerSet.Add(HttpKnownHeaderNames.Host); - headerSet.Add(HttpKnownHeaderNames.IfMatch); - headerSet.Add(HttpKnownHeaderNames.IfModifiedSince); - headerSet.Add(HttpKnownHeaderNames.IfNoneMatch); - headerSet.Add(HttpKnownHeaderNames.IfRange); - headerSet.Add(HttpKnownHeaderNames.IfUnmodifiedSince); - headerSet.Add(HttpKnownHeaderNames.MaxForwards); - headerSet.Add(HttpKnownHeaderNames.ProxyAuthorization); - headerSet.Add(HttpKnownHeaderNames.Range); - headerSet.Add(HttpKnownHeaderNames.Referer); - headerSet.Add(HttpKnownHeaderNames.TE); - headerSet.Add(HttpKnownHeaderNames.UserAgent); } internal override void AddHeaders(HttpHeaders sourceHeaders) diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpResponseHeaders.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpResponseHeaders.cs index ed8d9b60af..e16f307948 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpResponseHeaders.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/HttpResponseHeaders.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; @@ -12,9 +11,6 @@ namespace System.Net.Http.Headers Justification = "This is not a collection")] public sealed class HttpResponseHeaders : HttpHeaders { - private static readonly Dictionary s_parserStore = CreateParserStore(); - private static readonly HashSet s_invalidHeaders = CreateInvalidHeaders(); - private const int AcceptRangesSlot = 0; private const int ProxyAuthenticateSlot = 1; private const int ServerSlot = 2; @@ -42,43 +38,43 @@ namespace System.Net.Http.Headers } public HttpHeaderValueCollection AcceptRanges => - GetSpecializedCollection(AcceptRangesSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.AcceptRanges, thisRef, HeaderUtilities.TokenValidator)); + GetSpecializedCollection(AcceptRangesSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.AcceptRanges.Descriptor, thisRef, HeaderUtilities.TokenValidator)); public TimeSpan? Age { - get { return HeaderUtilities.GetTimeSpanValue(HttpKnownHeaderNames.Age, this); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.Age, value); } + get { return HeaderUtilities.GetTimeSpanValue(KnownHeaders.Age.Descriptor, this); } + set { SetOrRemoveParsedValue(KnownHeaders.Age.Descriptor, value); } } public EntityTagHeaderValue ETag { - get { return (EntityTagHeaderValue)GetParsedValues(HttpKnownHeaderNames.ETag); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.ETag, value); } + get { return (EntityTagHeaderValue)GetParsedValues(KnownHeaders.ETag.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.ETag.Descriptor, value); } } public Uri Location { - get { return (Uri)GetParsedValues(HttpKnownHeaderNames.Location); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.Location, value); } + get { return (Uri)GetParsedValues(KnownHeaders.Location.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.Location.Descriptor, value); } } public HttpHeaderValueCollection ProxyAuthenticate => - GetSpecializedCollection(ProxyAuthenticateSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.ProxyAuthenticate, thisRef)); + GetSpecializedCollection(ProxyAuthenticateSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.ProxyAuthenticate.Descriptor, thisRef)); public RetryConditionHeaderValue RetryAfter { - get { return (RetryConditionHeaderValue)GetParsedValues(HttpKnownHeaderNames.RetryAfter); } - set { SetOrRemoveParsedValue(HttpKnownHeaderNames.RetryAfter, value); } + get { return (RetryConditionHeaderValue)GetParsedValues(KnownHeaders.RetryAfter.Descriptor); } + set { SetOrRemoveParsedValue(KnownHeaders.RetryAfter.Descriptor, value); } } public HttpHeaderValueCollection Server => - GetSpecializedCollection(ServerSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.Server, thisRef)); + GetSpecializedCollection(ServerSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.Server.Descriptor, thisRef)); public HttpHeaderValueCollection Vary => - GetSpecializedCollection(VarySlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.Vary, thisRef, HeaderUtilities.TokenValidator)); + GetSpecializedCollection(VarySlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.Vary.Descriptor, thisRef, HeaderUtilities.TokenValidator)); public HttpHeaderValueCollection WwwAuthenticate => - GetSpecializedCollection(WwwAuthenticateSlot, thisRef => new HttpHeaderValueCollection(HttpKnownHeaderNames.WWWAuthenticate, thisRef)); + GetSpecializedCollection(WwwAuthenticateSlot, thisRef => new HttpHeaderValueCollection(KnownHeaders.WWWAuthenticate.Descriptor, thisRef)); #endregion @@ -146,53 +142,8 @@ namespace System.Net.Http.Headers #endregion internal HttpResponseHeaders() + : base(HttpHeaderType.General | HttpHeaderType.Response | HttpHeaderType.Custom, HttpHeaderType.Request) { - base.SetConfiguration(s_parserStore, s_invalidHeaders); - } - - private static Dictionary CreateParserStore() - { - var parserStore = new Dictionary(StringComparer.OrdinalIgnoreCase); - - parserStore.Add(HttpKnownHeaderNames.AcceptRanges, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.Age, TimeSpanHeaderParser.Parser); - parserStore.Add(HttpKnownHeaderNames.ETag, GenericHeaderParser.SingleValueEntityTagParser); - parserStore.Add(HttpKnownHeaderNames.Location, UriHeaderParser.RelativeOrAbsoluteUriParser); - parserStore.Add(HttpKnownHeaderNames.ProxyAuthenticate, GenericHeaderParser.MultipleValueAuthenticationParser); - parserStore.Add(HttpKnownHeaderNames.RetryAfter, GenericHeaderParser.RetryConditionParser); - parserStore.Add(HttpKnownHeaderNames.Server, ProductInfoHeaderParser.MultipleValueParser); - parserStore.Add(HttpKnownHeaderNames.Vary, GenericHeaderParser.TokenListParser); - parserStore.Add(HttpKnownHeaderNames.WWWAuthenticate, GenericHeaderParser.MultipleValueAuthenticationParser); - - HttpGeneralHeaders.AddParsers(parserStore); - - return parserStore; - } - - private static HashSet CreateInvalidHeaders() - { - var invalidHeaders = new HashSet(StringComparer.OrdinalIgnoreCase); - HttpContentHeaders.AddKnownHeaders(invalidHeaders); - return invalidHeaders; - - // Note: Reserved request header names are allowed as custom response header names. Reserved request - // headers have no defined meaning or format when used on a response. This enables a client to accept - // any headers sent from the server as either content headers or response headers. - } - - internal static void AddKnownHeaders(HashSet headerSet) - { - Debug.Assert(headerSet != null); - - headerSet.Add(HttpKnownHeaderNames.AcceptRanges); - headerSet.Add(HttpKnownHeaderNames.Age); - headerSet.Add(HttpKnownHeaderNames.ETag); - headerSet.Add(HttpKnownHeaderNames.Location); - headerSet.Add(HttpKnownHeaderNames.ProxyAuthenticate); - headerSet.Add(HttpKnownHeaderNames.RetryAfter); - headerSet.Add(HttpKnownHeaderNames.Server); - headerSet.Add(HttpKnownHeaderNames.Vary); - headerSet.Add(HttpKnownHeaderNames.WWWAuthenticate); } internal override void AddHeaders(HttpHeaders sourceHeaders) diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/KnownHeader.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/KnownHeader.cs new file mode 100644 index 0000000000..d71e240950 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/KnownHeader.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.Net.Http.Headers +{ + internal sealed class KnownHeader + { + private readonly string _name; + private readonly HttpHeaderType _headerType; + private readonly HttpHeaderParser _parser; + private readonly string[] _knownValues; + + public KnownHeader(string name, HttpHeaderType headerType, HttpHeaderParser parser, string[] knownValues = null) + { + Debug.Assert(!string.IsNullOrEmpty(name)); + Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); + Debug.Assert(headerType != HttpHeaderType.Custom); + Debug.Assert(parser != null); + + _name = name; + _headerType = headerType; + _parser = parser; + _knownValues = knownValues; + } + + public KnownHeader(string name) + { + Debug.Assert(!string.IsNullOrEmpty(name)); + Debug.Assert(HttpRuleParser.GetTokenLength(name, 0) == name.Length); + + _name = name; + _headerType = HttpHeaderType.Custom; + _parser = null; + } + + public string Name => _name; + public HttpHeaderParser Parser => _parser; + public HttpHeaderType HeaderType => _headerType; + public string[] KnownValues => _knownValues; + public HeaderDescriptor Descriptor => new HeaderDescriptor(this); + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs new file mode 100644 index 0000000000..ac209a1fba --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs @@ -0,0 +1,385 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.Net.Http.Headers +{ + internal static class KnownHeaders + { + // If you add a new entry here, you need to add it to TryGetKnownHeader below as well. + + public static readonly KnownHeader Accept = new KnownHeader("Accept", HttpHeaderType.Request, MediaTypeHeaderParser.MultipleValuesParser); + public static readonly KnownHeader AcceptCharset = new KnownHeader("Accept-Charset", HttpHeaderType.Request, GenericHeaderParser.MultipleValueStringWithQualityParser); + public static readonly KnownHeader AcceptEncoding = new KnownHeader("Accept-Encoding", HttpHeaderType.Request, GenericHeaderParser.MultipleValueStringWithQualityParser); + public static readonly KnownHeader AcceptLanguage = new KnownHeader("Accept-Language", HttpHeaderType.Request, GenericHeaderParser.MultipleValueStringWithQualityParser); + public static readonly KnownHeader AcceptPatch = new KnownHeader("Accept-Patch"); + public static readonly KnownHeader AcceptRanges = new KnownHeader("Accept-Ranges", HttpHeaderType.Response, GenericHeaderParser.TokenListParser); + public static readonly KnownHeader AccessControlAllowCredentials = new KnownHeader("Access-Control-Allow-Credentials"); + public static readonly KnownHeader AccessControlAllowHeaders = new KnownHeader("Access-Control-Allow-Headers"); + public static readonly KnownHeader AccessControlAllowMethods = new KnownHeader("Access-Control-Allow-Methods"); + public static readonly KnownHeader AccessControlAllowOrigin = new KnownHeader("Access-Control-Allow-Origin"); + public static readonly KnownHeader AccessControlExposeHeaders = new KnownHeader("Access-Control-Expose-Headers"); + public static readonly KnownHeader AccessControlMaxAge = new KnownHeader("Access-Control-Max-Age"); + public static readonly KnownHeader Age = new KnownHeader("Age", HttpHeaderType.Response, TimeSpanHeaderParser.Parser); + public static readonly KnownHeader Allow = new KnownHeader("Allow", HttpHeaderType.Content, GenericHeaderParser.TokenListParser); + public static readonly KnownHeader AltSvc = new KnownHeader("Alt-Svc"); + public static readonly KnownHeader Authorization = new KnownHeader("Authorization", HttpHeaderType.Request, GenericHeaderParser.SingleValueAuthenticationParser); + public static readonly KnownHeader CacheControl = new KnownHeader("Cache-Control", HttpHeaderType.General, CacheControlHeaderParser.Parser); + public static readonly KnownHeader Connection = new KnownHeader("Connection", HttpHeaderType.General, GenericHeaderParser.TokenListParser, new string[] { "close" }); + public static readonly KnownHeader ContentDisposition = new KnownHeader("Content-Disposition", HttpHeaderType.Content, GenericHeaderParser.ContentDispositionParser); + public static readonly KnownHeader ContentEncoding = new KnownHeader("Content-Encoding", HttpHeaderType.Content, GenericHeaderParser.TokenListParser, new string[] { "gzip", "deflate" }); + public static readonly KnownHeader ContentLanguage = new KnownHeader("Content-Language", HttpHeaderType.Content, GenericHeaderParser.TokenListParser); + public static readonly KnownHeader ContentLength = new KnownHeader("Content-Length", HttpHeaderType.Content, Int64NumberHeaderParser.Parser); + public static readonly KnownHeader ContentLocation = new KnownHeader("Content-Location", HttpHeaderType.Content, UriHeaderParser.RelativeOrAbsoluteUriParser); + public static readonly KnownHeader ContentMD5 = new KnownHeader("Content-MD5", HttpHeaderType.Content, ByteArrayHeaderParser.Parser); + public static readonly KnownHeader ContentRange = new KnownHeader("Content-Range", HttpHeaderType.Content, GenericHeaderParser.ContentRangeParser); + public static readonly KnownHeader ContentSecurityPolicy = new KnownHeader("Content-Security-Policy"); + public static readonly KnownHeader ContentType = new KnownHeader("Content-Type", HttpHeaderType.Content, MediaTypeHeaderParser.SingleValueParser); + public static readonly KnownHeader Cookie = new KnownHeader("Cookie"); + public static readonly KnownHeader Cookie2 = new KnownHeader("Cookie2"); + public static readonly KnownHeader Date = new KnownHeader("Date", HttpHeaderType.General, DateHeaderParser.Parser); + public static readonly KnownHeader ETag = new KnownHeader("ETag", HttpHeaderType.Response, GenericHeaderParser.SingleValueEntityTagParser); + public static readonly KnownHeader Expect = new KnownHeader("Expect", HttpHeaderType.Request, GenericHeaderParser.MultipleValueNameValueWithParametersParser, new string[] { "100-continue" }); + public static readonly KnownHeader Expires = new KnownHeader("Expires", HttpHeaderType.Content, DateHeaderParser.Parser); + public static readonly KnownHeader From = new KnownHeader("From", HttpHeaderType.Request, GenericHeaderParser.MailAddressParser); + public static readonly KnownHeader Host = new KnownHeader("Host", HttpHeaderType.Request, GenericHeaderParser.HostParser); + public static readonly KnownHeader IfMatch = new KnownHeader("If-Match", HttpHeaderType.Request, GenericHeaderParser.MultipleValueEntityTagParser); + public static readonly KnownHeader IfModifiedSince = new KnownHeader("If-Modified-Since", HttpHeaderType.Request, DateHeaderParser.Parser); + public static readonly KnownHeader IfNoneMatch = new KnownHeader("If-None-Match", HttpHeaderType.Request, GenericHeaderParser.MultipleValueEntityTagParser); + public static readonly KnownHeader IfRange = new KnownHeader("If-Range", HttpHeaderType.Request, GenericHeaderParser.RangeConditionParser); + public static readonly KnownHeader IfUnmodifiedSince = new KnownHeader("If-Unmodified-Since", HttpHeaderType.Request, DateHeaderParser.Parser); + public static readonly KnownHeader KeepAlive = new KnownHeader("Keep-Alive"); + public static readonly KnownHeader LastModified = new KnownHeader("Last-Modified", HttpHeaderType.Content, DateHeaderParser.Parser); + public static readonly KnownHeader Link = new KnownHeader("Link"); + public static readonly KnownHeader Location = new KnownHeader("Location", HttpHeaderType.Response, UriHeaderParser.RelativeOrAbsoluteUriParser); + public static readonly KnownHeader MaxForwards = new KnownHeader("Max-Forwards", HttpHeaderType.Request, Int32NumberHeaderParser.Parser); + public static readonly KnownHeader Origin = new KnownHeader("Origin"); + public static readonly KnownHeader P3P = new KnownHeader("P3P"); + public static readonly KnownHeader Pragma = new KnownHeader("Pragma", HttpHeaderType.General, GenericHeaderParser.MultipleValueNameValueParser); + public static readonly KnownHeader ProxyAuthenticate = new KnownHeader("Proxy-Authenticate", HttpHeaderType.Response, GenericHeaderParser.MultipleValueAuthenticationParser); + public static readonly KnownHeader ProxyAuthorization = new KnownHeader("Proxy-Authorization", HttpHeaderType.Request, GenericHeaderParser.SingleValueAuthenticationParser); + public static readonly KnownHeader ProxyConnection = new KnownHeader("Proxy-Connection"); + public static readonly KnownHeader PublicKeyPins = new KnownHeader("Public-Key-Pins"); + public static readonly KnownHeader Range = new KnownHeader("Range", HttpHeaderType.Request, GenericHeaderParser.RangeParser); + public static readonly KnownHeader Referer = new KnownHeader("Referer", HttpHeaderType.Request, UriHeaderParser.RelativeOrAbsoluteUriParser); // NB: The spelling-mistake "Referer" for "Referrer" must be matched. + public static readonly KnownHeader RetryAfter = new KnownHeader("Retry-After", HttpHeaderType.Response, GenericHeaderParser.RetryConditionParser); + public static readonly KnownHeader SecWebSocketAccept = new KnownHeader("Sec-WebSocket-Accept"); + public static readonly KnownHeader SecWebSocketExtensions = new KnownHeader("Sec-WebSocket-Extensions"); + public static readonly KnownHeader SecWebSocketKey = new KnownHeader("Sec-WebSocket-Key"); + public static readonly KnownHeader SecWebSocketProtocol = new KnownHeader("Sec-WebSocket-Protocol"); + public static readonly KnownHeader SecWebSocketVersion = new KnownHeader("Sec-WebSocket-Version"); + public static readonly KnownHeader Server = new KnownHeader("Server", HttpHeaderType.Response, ProductInfoHeaderParser.MultipleValueParser); + public static readonly KnownHeader SetCookie = new KnownHeader("Set-Cookie"); + public static readonly KnownHeader SetCookie2 = new KnownHeader("Set-Cookie2"); + public static readonly KnownHeader StrictTransportSecurity = new KnownHeader("Strict-Transport-Security"); + public static readonly KnownHeader TE = new KnownHeader("TE", HttpHeaderType.Request, TransferCodingHeaderParser.MultipleValueWithQualityParser); + public static readonly KnownHeader TSV = new KnownHeader("TSV"); + public static readonly KnownHeader Trailer = new KnownHeader("Trailer", HttpHeaderType.General, GenericHeaderParser.TokenListParser); + public static readonly KnownHeader TransferEncoding = new KnownHeader("Transfer-Encoding", HttpHeaderType.General, TransferCodingHeaderParser.MultipleValueParser, new string[] { "chunked" }); + public static readonly KnownHeader Upgrade = new KnownHeader("Upgrade", HttpHeaderType.General, GenericHeaderParser.MultipleValueProductParser); + public static readonly KnownHeader UpgradeInsecureRequests = new KnownHeader("Upgrade-Insecure-Requests"); + public static readonly KnownHeader UserAgent = new KnownHeader("User-Agent", HttpHeaderType.Request, ProductInfoHeaderParser.MultipleValueParser); + public static readonly KnownHeader Vary = new KnownHeader("Vary", HttpHeaderType.Response, GenericHeaderParser.TokenListParser); + public static readonly KnownHeader Via = new KnownHeader("Via", HttpHeaderType.General, GenericHeaderParser.MultipleValueViaParser); + public static readonly KnownHeader WWWAuthenticate = new KnownHeader("WWW-Authenticate", HttpHeaderType.Response, GenericHeaderParser.MultipleValueAuthenticationParser); + public static readonly KnownHeader Warning = new KnownHeader("Warning", HttpHeaderType.General, GenericHeaderParser.MultipleValueWarningParser); + public static readonly KnownHeader XAspNetVersion = new KnownHeader("X-AspNet-Version"); + public static readonly KnownHeader XContentDuration = new KnownHeader("X-Content-Duration"); + public static readonly KnownHeader XContentTypeOptions = new KnownHeader("X-Content-Type-Options"); + public static readonly KnownHeader XFrameOptions = new KnownHeader("X-Frame-Options"); + public static readonly KnownHeader XMSEdgeRef = new KnownHeader("X-MSEdge-Ref"); + public static readonly KnownHeader XPoweredBy = new KnownHeader("X-Powered-By"); + public static readonly KnownHeader XRequestID = new KnownHeader("X-Request-ID"); + public static readonly KnownHeader XUACompatible = new KnownHeader("X-UA-Compatible"); + + // Helper interface for making GetCandidate generic over strings, utf8, etc + private interface IHeaderNameAccessor + { + int Length { get; } + char this[int index] { get; } + } + + private struct StringAccessor : IHeaderNameAccessor + { + private readonly string _string; + + public StringAccessor(string s) + { + _string = s; + } + + public int Length => _string.Length; + public char this[int index] => _string[index]; + } + + // Can't use Span here as it's unsupported. + private unsafe struct BytePtrAccessor : IHeaderNameAccessor + { + private readonly byte* _p; + private readonly int _length; + + public BytePtrAccessor(byte* p, int length) + { + _p = p; + _length = length; + } + + public int Length => _length; + public char this[int index] => (char)_p[index]; + } + + // Find possible known header match via lookup on length and a distinguishing char for that length. + // Matching is case-insenstive. + // NOTE: Because of this, we do not preserve the case of the original header, + // whether from the wire or from the user explicitly setting a known header using a header name string. + private static KnownHeader GetCandidate(T key) + where T : struct, IHeaderNameAccessor // Enforce struct for performance + { + int length = key.Length; + switch (length) + { + case 2: + return TE; // TE + + case 3: + switch (key[0]) + { + case 'A': case 'a': return Age; // [A]ge + case 'P': case 'p': return P3P; // [P]3P + case 'T': case 't': return TSV; // [T]SV + case 'V': case 'v': return Via; // [V]ia + } + break; + + case 4: + switch (key[0]) + { + case 'D': case 'd': return Date; // [D]ate + case 'E': case 'e': return ETag; // [E]Tag + case 'F': case 'f': return From; // [F]rom + case 'H': case 'h': return Host; // [H]ost + case 'L': case 'l': return Link; // [L]ink + case 'V': case 'v': return Vary; // [V]ary + } + break; + + case 5: + switch (key[0]) + { + case 'A': case 'a': return Allow; // [A]llow + case 'R': case 'r': return Range; // [R]ange + } + break; + + case 6: + switch (key[0]) + { + case 'A': case 'a': return Accept; // [A]ccept + case 'C': case 'c': return Cookie; // [C]ookie + case 'E': case 'e': return Expect; // [E]xpect + case 'O': case 'o': return Origin; // [O]rigin + case 'P': case 'p': return Pragma; // [P]ragma + case 'S': case 's': return Server; // [S]erver + } + break; + + case 7: + switch (key[0]) + { + case 'A': case 'a': return AltSvc; // [A]lt-Svc + case 'C': case 'c': return Cookie2; // [C]ookie2 + case 'E': case 'e': return Expires; // [E]xpires + case 'R': case 'r': return Referer; // [R]eferer + case 'T': case 't': return Trailer; // [T]railer + case 'U': case 'u': return Upgrade; // [U]pgrade + case 'W': case 'w': return Warning; // [W]arning + } + break; + + case 8: + switch (key[3]) + { + case 'M': case 'm': return IfMatch; // If-[M]atch + case 'R': case 'r': return IfRange; // If-[R]ange + case 'A': case 'a': return Location; // Loc[a]tion + } + break; + + case 10: + switch (key[0]) + { + case 'C': case 'c': return Connection; // [C]onnection + case 'K': case 'k': return KeepAlive; // [K]eep-Alive + case 'S': case 's': return SetCookie; // [S]et-Cookie + case 'U': case 'u': return UserAgent; // [U]ser-Agent + } + break; + + case 11: + switch (key[0]) + { + case 'C': case 'c': return ContentMD5; // [C]ontent-MD5 + case 'R': case 'r': return RetryAfter; // [R]etry-After + case 'S': case 's': return SetCookie2; // [S]et-Cookie2 + } + break; + + case 12: + switch (key[2]) + { + case 'C': case 'c': return AcceptPatch; // Ac[c]ept-Patch + case 'N': case 'n': return ContentType; // Co[n]tent-Type + case 'X': case 'x': return MaxForwards; // Ma[x]-Forwards + case 'M': case 'm': return XMSEdgeRef; // X-[M]SEdge-Ref + case 'P': case 'p': return XPoweredBy; // X-[P]owered-By + case 'R': case 'r': return XRequestID; // X-[R]equest-ID + } + break; + + case 13: + switch (key[6]) + { + case '-': return AcceptRanges; // Accept[-]Ranges + case 'I': case 'i': return Authorization; // Author[i]zation + case 'C': case 'c': return CacheControl; // Cache-[C]ontrol + case 'T': case 't': return ContentRange; // Conten[t]-Range + case 'E': case 'e': return IfNoneMatch; // If-Non[e]-Match + case 'O': case 'o': return LastModified; // Last-M[o]dified + } + break; + + case 14: + switch (key[0]) + { + case 'A': case 'a': return AcceptCharset; // [A]ccept-Charset + case 'C': case 'c': return ContentLength; // [C]ontent-Length + } + break; + + case 15: + switch (key[7]) + { + case '-': return XFrameOptions; // X-Frame[-]Options + case 'M': case 'm': return XUACompatible; // X-UA-Co[m]patible + case 'E': case 'e': return AcceptEncoding; // Accept-[E]ncoding + case 'K': case 'k': return PublicKeyPins; // Public-[K]ey-Pins + case 'L': case 'l': return AcceptLanguage; // Accept-[L]anguage + } + break; + + case 16: + switch (key[11]) + { + case 'O': case 'o': return ContentEncoding; // Content-Enc[o]ding + case 'G': case 'g': return ContentLanguage; // Content-Lan[g]uage + case 'A': case 'a': return ContentLocation; // Content-Loc[a]tion + case 'C': case 'c': return ProxyConnection; // Proxy-Conne[c]tion + case 'I': case 'i': return WWWAuthenticate; // WWW-Authent[i]cate + case 'R': case 'r': return XAspNetVersion; // X-AspNet-Ve[r]sion + } + break; + + case 17: + switch (key[0]) + { + case 'I': case 'i': return IfModifiedSince; // [I]f-Modified-Since + case 'S': case 's': return SecWebSocketKey; // [S]ec-WebSocket-Key + case 'T': case 't': return TransferEncoding; // [T]ransfer-Encoding + } + break; + + case 18: + switch (key[0]) + { + case 'P': case 'p': return ProxyAuthenticate; // [P]roxy-Authenticate + case 'X': case 'x': return XContentDuration; // [X]-Content-Duration + } + break; + + case 19: + switch (key[0]) + { + case 'C': case 'c': return ContentDisposition; // [C]ontent-Disposition + case 'I': case 'i': return IfUnmodifiedSince; // [I]f-Unmodified-Since + case 'P': case 'p': return ProxyAuthorization; // [P]roxy-Authorization + } + break; + + case 20: + return SecWebSocketAccept; // Sec-WebSocket-Accept + + case 21: + return SecWebSocketVersion; // Sec-WebSocket-Version + + case 22: + switch (key[0]) + { + case 'A': case 'a': return AccessControlMaxAge; // [A]ccess-Control-Max-Age + case 'S': case 's': return SecWebSocketProtocol; // [S]ec-WebSocket-Protocol + case 'X': case 'x': return XContentTypeOptions; // [X]-Content-Type-Options + } + break; + + case 23: + return ContentSecurityPolicy; // Content-Security-Policy + + case 24: + return SecWebSocketExtensions; // Sec-WebSocket-Extensions + + case 25: + switch (key[0]) + { + case 'S': case 's': return StrictTransportSecurity; // [S]trict-Transport-Security + case 'U': case 'u': return UpgradeInsecureRequests; // [U]pgrade-Insecure-Requests + } + break; + + case 27: + return AccessControlAllowOrigin; // Access-Control-Allow-Origin + + case 28: + switch (key[21]) + { + case 'H': case 'h': return AccessControlAllowHeaders; // Access-Control-Allow-[H]eaders + case 'M': case 'm': return AccessControlAllowMethods; // Access-Control-Allow-[M]ethods + } + break; + + case 29: + return AccessControlExposeHeaders; // Access-Control-Expose-Headers + + case 32: + return AccessControlAllowCredentials; // Access-Control-Allow-Credentials + } + + return null; + } + + internal static KnownHeader TryGetKnownHeader(string name) + { + KnownHeader candidate = GetCandidate(new StringAccessor(name)); + if (candidate != null && StringComparer.OrdinalIgnoreCase.Equals(name, candidate.Name)) + { + return candidate; + } + + return null; + } + + internal unsafe static KnownHeader TryGetKnownHeader(ReadOnlySpan name) + { + fixed (byte* p = &name.DangerousGetPinnableReference()) + { + KnownHeader candidate = GetCandidate(new BytePtrAccessor(p, name.Length)); + if (candidate != null && ByteArrayHelpers.EqualsOrdinalAsciiIgnoreCase(candidate.Name, name)) + { + return candidate; + } + } + + return null; + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs index 08206cb6b3..92315b1f78 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Headers/ObjectCollection.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics; namespace System.Net.Http.Headers { @@ -23,6 +24,7 @@ namespace System.Net.Http.Headers public ObjectCollection(Action validator) : base(new List()) { + Debug.Assert(validator != null, $"{nameof(validator)} must not be null."); _validator = validator; } @@ -35,19 +37,13 @@ namespace System.Net.Http.Headers protected override void InsertItem(int index, T item) { - if (_validator != null) - { - _validator(item); - } + _validator(item); base.InsertItem(index, item); } protected override void SetItem(int index, T item) { - if (_validator != null) - { - _validator(item); - } + _validator(item); base.SetItem(index, item); } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Net46.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Net46.cs deleted file mode 100644 index 9cb108d9cf..0000000000 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Net46.cs +++ /dev/null @@ -1,1212 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Diagnostics.Contracts; -using System.Globalization; -using System.IO; -using System.Net.Http.Headers; -using System.Net.Security; -using System.Runtime.CompilerServices; -using System.Security; -using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; -using System.Security.Principal; -using System.Security.Permissions; -using System.Threading; -using System.Threading.Tasks; - -namespace System.Net.Http -{ - public partial class HttpClientHandler : HttpMessageHandler - { - #region Fields - - private static readonly Action s_onCancel = OnCancel; - - private readonly Action _startRequest; - private readonly AsyncCallback _getRequestStreamCallback; - private readonly AsyncCallback _getResponseCallback; - - private volatile bool _operationStarted; - private volatile bool _disposed; - - private long _maxRequestContentBufferSize; - private int _maxResponseHeadersLength; - private CookieContainer _cookieContainer; - private bool _useCookies; - private DecompressionMethods _automaticDecompression; - private IWebProxy _proxy; - private bool _useProxy; - private ICredentials _defaultProxyCredentials; - private bool _preAuthenticate; - private bool _useDefaultCredentials; - private ICredentials _credentials; - private bool _allowAutoRedirect; - private int _maxAutomaticRedirections; - private string _connectionGroupName; - private ClientCertificateOption _clientCertOptions; - private X509Certificate2Collection _clientCertificates; - private IDictionary _properties; - private int _maxConnectionsPerServer; - private Func< - HttpRequestMessage, - X509Certificate2, - X509Chain, - SslPolicyErrors, - bool> _serverCertificateCustomValidationCallback; - - #endregion Fields - - #region Properties - - public bool AllowAutoRedirect - { - get - { - return _allowAutoRedirect; - } - - set - { - CheckDisposedOrStarted(); - _allowAutoRedirect = value; - } - } - - public DecompressionMethods AutomaticDecompression - { - get - { - return _automaticDecompression; - } - - set - { - CheckDisposedOrStarted(); - _automaticDecompression = value; - } - } - - public bool CheckCertificateRevocationList - { - // TODO: Issue #11100. - get - { - throw new PlatformNotSupportedException(); - } - - set - { - CheckDisposedOrStarted(); - throw new PlatformNotSupportedException(); - } - } - - public ClientCertificateOption ClientCertificateOptions - { - get - { - return _clientCertOptions; - } - - set - { - if (value != ClientCertificateOption.Manual - && value != ClientCertificateOption.Automatic) - { - throw new ArgumentOutOfRangeException("value"); - } - - CheckDisposedOrStarted(); - _clientCertOptions = value; - } - } - - public X509CertificateCollection ClientCertificates - { - get - { - if (_clientCertOptions != ClientCertificateOption.Manual) - { - throw new InvalidOperationException(SR.Format(SR.net_http_invalid_enable_first, "ClientCertificateOptions", "Manual")); - } - - if (_clientCertificates == null) - { - _clientCertificates = new X509Certificate2Collection(); - } - - return _clientCertificates; - } - } - - public CookieContainer CookieContainer - { - get - { - return _cookieContainer; - } - - set - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - - if (!UseCookies) - { - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, - SR.net_http_invalid_enable_first, "UseCookies", "true")); - } - - CheckDisposedOrStarted(); - _cookieContainer = value; - } - } - - public ICredentials Credentials - { - get - { - return _credentials; - } - - set - { - CheckDisposedOrStarted(); - _credentials = value; - } - } - - public ICredentials DefaultProxyCredentials - { - get - { - return _defaultProxyCredentials; - } - - set - { - CheckDisposedOrStarted(); - _defaultProxyCredentials = value; - } - } - - public int MaxAutomaticRedirections - { - get - { - return _maxAutomaticRedirections; - } - - set - { - if (value <= 0) - { - throw new ArgumentOutOfRangeException("value"); - } - - CheckDisposedOrStarted(); - _maxAutomaticRedirections = value; - } - } - - public int MaxConnectionsPerServer - { - get - { - return _maxConnectionsPerServer; - } - - set - { - if (value < 1) - { - throw new ArgumentOutOfRangeException( - nameof(value), - value, - SR.Format(SR.net_http_value_must_be_greater_than, 0)); - } - - CheckDisposedOrStarted(); - _maxConnectionsPerServer = value; - } - } - - public long MaxRequestContentBufferSize - { - get - { - return _maxRequestContentBufferSize; - } - - set - { - // Setting the value to 0 is OK: It means the user doesn't want the handler to buffer content. - if (value < 0) - { - throw new ArgumentOutOfRangeException("value"); - } - - if (value > HttpContent.MaxBufferSize) - { - throw new ArgumentOutOfRangeException("value", value, - string.Format(CultureInfo.InvariantCulture, SR.net_http_content_buffersize_limit, - HttpContent.MaxBufferSize)); - } - - CheckDisposedOrStarted(); - _maxRequestContentBufferSize = value; - } - } - - public int MaxResponseHeadersLength - { - get - { - return _maxResponseHeadersLength; - } - - set - { - if (value <= 0) - { - throw new ArgumentOutOfRangeException("value"); - } - - CheckDisposedOrStarted(); - _maxResponseHeadersLength = value; - } - } - - public bool PreAuthenticate - { - get - { - return _preAuthenticate; - } - - set - { - CheckDisposedOrStarted(); - _preAuthenticate = value; - } - } - - public IDictionary Properties - { - get - { - if (_properties == null) - { - _properties = new Dictionary(); - } - - return _properties; - } - } - - public IWebProxy Proxy - { - get - { - return _proxy; - } - - [SecuritySafeCritical] - set - { - if (!UseProxy && value != null) - { - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, - SR.net_http_invalid_enable_first, "UseProxy", "true")); - } - CheckDisposedOrStarted(); - ExceptionHelper.WebPermissionUnrestricted.Demand(); - _proxy = value; - } - } - - public Func ServerCertificateCustomValidationCallback - { - get - { - return _serverCertificateCustomValidationCallback; - } - - set - { - CheckDisposedOrStarted(); - _serverCertificateCustomValidationCallback = value; - } - } - - public SslProtocols SslProtocols - { - // TODO: Issue #11100. - get - { - throw new PlatformNotSupportedException(); - } - - set - { - CheckDisposedOrStarted(); - throw new PlatformNotSupportedException(); - } - } - - public virtual bool SupportsAutomaticDecompression - { - get - { - return true; - } - } - - public virtual bool SupportsProxy - { - get - { - return true; - } - } - - public virtual bool SupportsRedirectConfiguration - { - get - { - return true; - } - } - - public bool UseCookies - { - get - { - return _useCookies; - } - - set - { - CheckDisposedOrStarted(); - _useCookies = value; - } - } - - public bool UseDefaultCredentials - { - get - { - return _useDefaultCredentials; - } - - set - { - CheckDisposedOrStarted(); - _useDefaultCredentials = value; - } - } - - public bool UseProxy - { - get - { - return _useProxy; - } - - set - { - CheckDisposedOrStarted(); - _useProxy = value; - } - } - - #endregion Properties - - #region De/Constructors - - public HttpClientHandler() - { - _startRequest = StartRequest; - _getRequestStreamCallback = GetRequestStreamCallback; - _getResponseCallback = GetResponseCallback; - - _connectionGroupName = RuntimeHelpers.GetHashCode(this).ToString(NumberFormatInfo.InvariantInfo); - - // Set HWR default values - _allowAutoRedirect = true; - _maxRequestContentBufferSize = HttpContent.MaxBufferSize; - _automaticDecompression = DecompressionMethods.None; - _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies. - _credentials = null; - _maxAutomaticRedirections = 50; - _preAuthenticate = false; - _proxy = null; - _useProxy = true; - _useCookies = true; // deal with cookies by default. - _useDefaultCredentials = false; - _clientCertOptions = ClientCertificateOption.Manual; - - // New properties not in .NET Framework HttpClientHandler. - _maxResponseHeadersLength = HttpWebRequest.DefaultMaximumResponseHeadersLength; - _defaultProxyCredentials = null; - _clientCertificates = null; // only create collection when required. - _properties = null; // only create collection when required. - _maxConnectionsPerServer = ServicePointManager.DefaultConnectionLimit; - _serverCertificateCustomValidationCallback = null; - } - - protected override void Dispose(bool disposing) - { - if (disposing && !_disposed) - { - _disposed = true; - // Close all connection groups created by the current handler instance. Since every instance uses a - // unique connection group name, disposing a handler will remove all these unique connection groups to - // save resources. - ServicePointManager.CloseConnectionGroups(_connectionGroupName); - } - base.Dispose(disposing); - } - - #endregion De/Constructors - - #region Request Setup - - private HttpWebRequest CreateAndPrepareWebRequest(HttpRequestMessage request) - { - HttpWebRequest webRequest = null; - - // If we have a request-content, make sure to provide HWR with a delegate to CopyTo(). This allows HWR - // to serialize the content multiple times in case of redirect/authentication. - // Also note that the connection group name provided is considered an 'internal' connection group. I.e. - // HWR will add 'I>' after the string we provided. I.e. by default the actual connection group name looks - // like '123456S>I>' or '123456U>I>' if UnsafeAuthenticatedConnectionSharing is true. Even is users use the - // same hashcode for their HWR connection group, they'll end up using a different one, since 'I>' is not - // added ('123456S>' or '123456U>'). - if (request.Content != null) - { - webRequest = new HttpWebRequest(request.RequestUri, true, _connectionGroupName, request.Content.CopyTo); - } - else - { - webRequest = new HttpWebRequest(request.RequestUri, true, _connectionGroupName, null); - } - - if (Logging.On) Logging.Associate(Logging.Http, request, webRequest); - - webRequest.Method = request.Method.Method; - webRequest.ProtocolVersion = request.Version; - - SetDefaultOptions(webRequest); - SetConnectionOptions(webRequest, request); - SetServicePointOptions(webRequest, request); - SetRequestHeaders(webRequest, request); - SetContentHeaders(webRequest, request); - - // New properties for this OOB HttpClientHandler. - webRequest.ServicePoint.ConnectionLimit = _maxConnectionsPerServer; - webRequest.MaximumResponseHeadersLength = _maxResponseHeadersLength; - if ((ClientCertificateOptions == ClientCertificateOption.Manual) - && (_clientCertificates != null) && (_clientCertificates.Count > 0)) - { - webRequest.ClientCertificates = _clientCertificates; - } - - if (_serverCertificateCustomValidationCallback != null) - { - webRequest.ServerCertificateValidationCallback = ServerCertificateValidationCallback; - } - - if (_defaultProxyCredentials != null && _useProxy && _proxy == null && webRequest.Proxy != null) - { - // The HttpClientHandler has specified to use a proxy but has not set an explicit IWebProxy. - // That means to use the default proxy on the underlying webrequest object. The initial value - // of the webrequest.Proxy when first created comes from the static WebRequest.DefaultWebProxy. - // In the default case, this value is non-null. But can be set later to null. That is why the - // 'if' check above validates for a non-null webRequest.Proxy. - webRequest.Proxy.Credentials = _defaultProxyCredentials; - } - - // For Extensibility - InitializeWebRequest(request, webRequest); - - return webRequest; - } - - // Used to map the ServerCertificateCustomValidationCallback which uses Func to the - // HttpWebRequest based RemoteCertificateValidationCallback delegate type. - private bool ServerCertificateValidationCallback( - object sender, - X509Certificate certificate, - X509Chain chain, - SslPolicyErrors sslPolicyErrors) - { - return _serverCertificateCustomValidationCallback( - null, // TODO Issue #11100: How to map sender (which is an HttpWebRequest) to an HttpRequestMessage? - (X509Certificate2)certificate, // This cast will usually always be safe. - chain, - sslPolicyErrors); - } - - // Needs to be internal so that WebRequestHandler can access it from a different assembly. - internal virtual void InitializeWebRequest(HttpRequestMessage request, HttpWebRequest webRequest) - { - } - - private void SetDefaultOptions(HttpWebRequest webRequest) - { - webRequest.Timeout = Timeout.Infinite; // Timeouts are handled by HttpClient. - - webRequest.AllowAutoRedirect = _allowAutoRedirect; - webRequest.AutomaticDecompression = _automaticDecompression; - webRequest.PreAuthenticate = _preAuthenticate; - - if (_useDefaultCredentials) - { - webRequest.UseDefaultCredentials = true; - } - else - { - webRequest.Credentials = _credentials; - } - - if (_allowAutoRedirect) - { - webRequest.MaximumAutomaticRedirections = _maxAutomaticRedirections; - } - - if (_useProxy) - { - // If 'UseProxy' is true and 'Proxy' is null (default), let HWR figure out the proxy to use. Otherwise - // set the custom proxy. - if (_proxy != null) - { - webRequest.Proxy = _proxy; - } - } - else - { - // The use explicitly specified to not use a proxy. Set HWR.Proxy to null to make sure HWR doesn't use - // a proxy for this request. - webRequest.Proxy = null; - } - - if (_useCookies) - { - webRequest.CookieContainer = _cookieContainer; - } - - if (_clientCertOptions == ClientCertificateOption.Automatic && ComNetOS.IsWin7orLater) - { - X509CertificateCollection automaticClientCerts - = UnsafeNclNativeMethods.NativePKI.FindClientCertificates(); - if (automaticClientCerts.Count > 0) - { - webRequest.ClientCertificates = automaticClientCerts; - } - } - } - - private static void SetConnectionOptions(HttpWebRequest webRequest, HttpRequestMessage request) - { - if (request.Version <= HttpVersion.Version10) - { - // HTTP 1.0 had some support for persistent connections by allowing "Connection: Keep-Alive". Check - // whether this value is set. - bool keepAliveSet = false; - foreach (string item in request.Headers.Connection) - { - if (string.Compare(item, "Keep-Alive", StringComparison.OrdinalIgnoreCase) == 0) - { - keepAliveSet = true; - break; - } - } - webRequest.KeepAlive = keepAliveSet; - } - else - { - // HTTP 1.1 uses persistent connections by default. If the user doesn't want to use persistent - // connections, he can set 'ConnectionClose' to true (equivalent to header "Connection: close"). - if (request.Headers.ConnectionClose == true) - { - webRequest.KeepAlive = false; - } - } - } - - private void SetServicePointOptions(HttpWebRequest webRequest, HttpRequestMessage request) - { - HttpRequestHeaders headers = request.Headers; - ServicePoint currentServicePoint = null; - - // We have to update the ServicePoint in order to support "Expect: 100-continue". This setting may affect - // also requests sent by other HWR instances (or HttpClient instances). This is a known limitation. - bool? expectContinue = headers.ExpectContinue; - if (expectContinue != null) - { - currentServicePoint = webRequest.ServicePoint; - currentServicePoint.Expect100Continue = (bool)expectContinue; - } - } - - private static void SetRequestHeaders(HttpWebRequest webRequest, HttpRequestMessage request) - { - WebHeaderCollection webRequestHeaders = webRequest.Headers; - HttpRequestHeaders headers = request.Headers; - - // Most headers are just added directly to HWR's internal headers collection. But there are some exceptions - // requiring different handling. - // The following bool vars are used to skip string comparison when not required: E.g. if the 'Host' header - // was not set, we don't need to compare every header in the collection with 'Host' to make sure we don't - // add it to HWR's header collection. - bool isHostSet = headers.Contains(HttpKnownHeaderNames.Host); - bool isExpectSet = headers.Contains(HttpKnownHeaderNames.Expect); - bool isTransferEncodingSet = headers.Contains(HttpKnownHeaderNames.TransferEncoding); - bool isConnectionSet = headers.Contains(HttpKnownHeaderNames.Connection); - - if (isHostSet) - { - string host = headers.Host; - if (host != null) - { - webRequest.Host = host; - } - } - - // The following headers (Expect, Transfer-Encoding, Connection) have both a collection property and a - // bool property indicating a special value. Internally (in HttpHeaders) we don't distinguish between - // "special" values and other values. So we must make sure that we add all but the special value to HWR. - // E.g. the 'Transfer-Encoding: chunked' value must be set using HWR.SendChunked, whereas all other values - // can be added to the 'Transfer-Encoding'. - if (isExpectSet) - { - string expectHeader = headers.Expect.GetHeaderStringWithoutSpecial(); - // Was at least one non-special value set? - if (!String.IsNullOrEmpty(expectHeader) || !headers.Expect.IsSpecialValueSet) - { - webRequestHeaders.AddInternal(HttpKnownHeaderNames.Expect, expectHeader); - } - } - - if (isTransferEncodingSet) - { - string transferEncodingHeader = headers.TransferEncoding.GetHeaderStringWithoutSpecial(); - // Was at least one non-special value set? - if (!String.IsNullOrEmpty(transferEncodingHeader) || !headers.TransferEncoding.IsSpecialValueSet) - { - webRequestHeaders.AddInternal(HttpKnownHeaderNames.TransferEncoding, transferEncodingHeader); - } - } - - if (isConnectionSet) - { - string connectionHeader = headers.Connection.GetHeaderStringWithoutSpecial(); - - // Was at least one non-special value set? - if (!String.IsNullOrEmpty(connectionHeader) || !headers.Connection.IsSpecialValueSet) - { - webRequestHeaders.AddInternal(HttpKnownHeaderNames.Connection, connectionHeader); - } - } - - foreach (var header in request.Headers.GetHeaderStrings()) - { - string headerName = header.Key; - - if ((isHostSet && AreEqual(HttpKnownHeaderNames.Host, headerName)) || - (isExpectSet && AreEqual(HttpKnownHeaderNames.Expect, headerName)) || - (isTransferEncodingSet && AreEqual(HttpKnownHeaderNames.TransferEncoding, headerName)) || - (isConnectionSet && AreEqual(HttpKnownHeaderNames.Connection, headerName))) - { - continue; // Header was already added. - } - - // Use AddInternal() to skip validation. - webRequestHeaders.AddInternal(header.Key, header.Value); - } - } - - private static void SetContentHeaders(HttpWebRequest webRequest, HttpRequestMessage request) - { - if (request.Content != null) - { - HttpContentHeaders headers = request.Content.Headers; - - // All content headers besides Content-Length can be added directly to HWR. So just check whether we - // have the Content-Length header set. If not, add all headers, otherwise skip the Content-Length - // header. - // Note that this method is called _before_ PrepareWebRequestForContentUpload(): I.e. in most scenarios - // this means that no one accessed Headers.ContentLength property yet, thus there will be no - // Content-Length header in the store. I.e. we'll end up in the 'else' block providing better perf, - // since no string comparison is required. - if (headers.Contains(HttpKnownHeaderNames.ContentLength)) - { - foreach (var header in request.Content.Headers) - { - if (string.Compare(HttpKnownHeaderNames.ContentLength, header.Key, StringComparison.OrdinalIgnoreCase) != 0) - { - // Use AddInternal() to skip validation. - webRequest.Headers.AddInternal(header.Key, string.Join(", ", header.Value)); - } - } - } - else - { - foreach (var header in request.Content.Headers) - { - // Use AddInternal() to skip validation. - webRequest.Headers.AddInternal(header.Key, string.Join(", ", header.Value)); - } - } - } - } - - #endregion Message Setup - - #region Request Processing - - protected internal override Task SendAsync(HttpRequestMessage request, - CancellationToken cancellationToken) - { - if (request == null) - { - throw new ArgumentNullException("request", SR.net_http_handler_norequest); - } - CheckDisposed(); - - if (Logging.On) Logging.Enter(Logging.Http, this, "SendAsync", request); - - SetOperationStarted(); - - TaskCompletionSource tcs = new TaskCompletionSource(); - RequestState state = new RequestState(); - state.tcs = tcs; - state.cancellationToken = cancellationToken; - state.requestMessage = request; - - try - { - // Cancellation: Note that there is no race here: If the token gets canceled before we register the - // callback, the token will invoke the callback immediately. I.e. HWR gets aborted before we use it. - HttpWebRequest webRequest = CreateAndPrepareWebRequest(request); - state.webRequest = webRequest; - cancellationToken.Register(s_onCancel, webRequest); - - // Preserve context for authentication - if (ExecutionContext.IsFlowSuppressed()) - { - // Check for proxy auth - IWebProxy currentProxy = null; - if (_useProxy) - { - currentProxy = _proxy ?? WebRequest.DefaultWebProxy; - } - - if ((UseDefaultCredentials || Credentials != null - || (currentProxy != null && currentProxy.Credentials != null))) - { - SafeCaptureIdenity(state); - } - } - - // BeginGetResponse/BeginGetRequestStream have a lot of setup work to do before becoming async - // (proxy, dns, connection pooling, etc). Run these on a separate thread. - // Do not provide a cancellation token; if this helper task could be canceled before starting then - // nobody would complete the tcs. - Task.Factory.StartNew(_startRequest, state); - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - - if (Logging.On) Logging.Exit(Logging.Http, this, "SendAsync", tcs.Task); - return tcs.Task; - } - - private void StartRequest(object obj) - { - RequestState state = obj as RequestState; - Contract.Assert(state != null); - - try - { - if (state.requestMessage.Content != null) - { - PrepareAndStartContentUpload(state); - } - else - { - state.webRequest.ContentLength = 0; - StartGettingResponse(state); - } - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - } - - private void PrepareAndStartContentUpload(RequestState state) - { - HttpContent requestContent = state.requestMessage.Content; - Contract.Assert(requestContent != null); - - try - { - // Determine how to communicate the length of the request content. - if (state.requestMessage.Headers.TransferEncodingChunked == true) - { - state.webRequest.SendChunked = true; - StartGettingRequestStream(state); - } - else - { - long? contentLength = requestContent.Headers.ContentLength; - if (contentLength != null) - { - state.webRequest.ContentLength = (long)contentLength; - StartGettingRequestStream(state); - } - else - { - // If we don't have a content length and we don't use chunked, then we must buffer the content. - // If the user specified a zero buffer size, we throw. - if (_maxRequestContentBufferSize == 0) - { - throw new HttpRequestException(SR.net_http_handler_nocontentlength); - } - - // HttpContent couldn't calculate the content length. Chunked is not specified. Buffer the - // content to get the content length. - requestContent.LoadIntoBufferAsync(_maxRequestContentBufferSize).ContinueWithStandard(task => - { - if (task.IsFaulted) - { - HandleAsyncException(state, task.Exception.GetBaseException()); - return; - } - - try - { - contentLength = requestContent.Headers.ContentLength; - Contract.Assert(contentLength != null, "After buffering content, ContentLength must not be null."); - state.webRequest.ContentLength = (long)contentLength; - StartGettingRequestStream(state); - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - }); - } - } - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - } - - private void StartGettingRequestStream(RequestState state) - { - // Manually flow identity context if captured. - if (state.identity != null) - { - using (state.identity.Impersonate()) - { - state.webRequest.BeginGetRequestStream(_getRequestStreamCallback, state); - } - } - else - { - state.webRequest.BeginGetRequestStream(_getRequestStreamCallback, state); - } - } - - private void GetRequestStreamCallback(IAsyncResult ar) - { - RequestState state = ar.AsyncState as RequestState; - Contract.Assert(state != null); - - try - { - TransportContext context = null; - Stream requestStream = state.webRequest.EndGetRequestStream(ar, out context) as Stream; - state.requestStream = requestStream; - state.requestMessage.Content.CopyToAsync(requestStream, context).ContinueWithStandard(task => - { - try - { - if (task.IsFaulted) - { - HandleAsyncException(state, task.Exception.GetBaseException()); - return; - } - - if (task.IsCanceled) - { - state.tcs.TrySetCanceled(); - return; - } - - state.requestStream.Close(); - StartGettingResponse(state); - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - - }); - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - } - - private void StartGettingResponse(RequestState state) - { - // Manually flow identity context if captured. - if (state.identity != null) - { - using (state.identity.Impersonate()) - { - state.webRequest.BeginGetResponse(_getResponseCallback, state); - } - } - else - { - state.webRequest.BeginGetResponse(_getResponseCallback, state); - } - } - - private void GetResponseCallback(IAsyncResult ar) - { - RequestState state = ar.AsyncState as RequestState; - Contract.Assert(state != null); - - try - { - HttpWebResponse webResponse = state.webRequest.EndGetResponse(ar) as HttpWebResponse; - state.tcs.TrySetResult(CreateResponseMessage(webResponse, state.requestMessage)); - } - catch (Exception e) - { - HandleAsyncException(state, e); - } - } - - private HttpResponseMessage CreateResponseMessage(HttpWebResponse webResponse, HttpRequestMessage request) - { - HttpResponseMessage response = new HttpResponseMessage(webResponse.StatusCode); - response.ReasonPhrase = webResponse.StatusDescription; - response.Version = webResponse.ProtocolVersion; - response.RequestMessage = request; - response.Content = new StreamContent(new WebExceptionWrapperStream(webResponse.GetResponseStream())); - - // Update Request-URI to reflect the URI actually leading to the response message. - request.RequestUri = webResponse.ResponseUri; - - WebHeaderCollection webResponseHeaders = webResponse.Headers; - HttpContentHeaders contentHeaders = response.Content.Headers; - HttpResponseHeaders responseHeaders = response.Headers; - - // HttpWebResponse.ContentLength is set to -1 if no Content-Length header is provided. - if (webResponse.ContentLength >= 0) - { - contentHeaders.ContentLength = webResponse.ContentLength; - } - - for (int i = 0; i < webResponseHeaders.Count; i++) - { - string currentHeader = webResponseHeaders.GetKey(i); - - // We already set Content-Length - if (string.Compare(currentHeader, HttpKnownHeaderNames.ContentLength, - StringComparison.OrdinalIgnoreCase) == 0) - { - continue; - } - - string[] values = webResponseHeaders.GetValues(i); - - if (!responseHeaders.TryAddWithoutValidation(currentHeader, values)) - { - bool result = contentHeaders.TryAddWithoutValidation(currentHeader, values); - // WebHeaderCollection should never return us invalid header names. - Contract.Assert(result, "Invalid header name."); - } - } - - return response; - } - - private void HandleAsyncException(RequestState state, Exception e) - { - // Use 'SendAsync' as method name, since this method is only called by methods in the async code path. Using - // 'SendAsync' as method name helps relate the exception to the operation in log files. - if (Logging.On) Logging.Exception(Logging.Http, this, "SendAsync", e); - - // If the WebException was due to the cancellation token being canceled, throw cancellation exception. - if (state.cancellationToken.IsCancellationRequested) - { - state.tcs.TrySetCanceled(); - } - // Wrap expected exceptions as HttpRequestExceptions since this is considered an error during - // execution. All other exception types, including ArgumentExceptions and ProtocolViolationExceptions - // are 'unexpected' or caused by user error and should not be wrapped. - else if (e is WebException || e is IOException) - { - state.tcs.TrySetException(new HttpRequestException(SR.net_http_client_execution_error, e)); - } - else - { - state.tcs.TrySetException(e); - } - } - - private static void OnCancel(object state) - { - HttpWebRequest webRequest = state as HttpWebRequest; - Contract.Assert(webRequest != null); - - webRequest.Abort(); - } - - #endregion Request Processing - - #region Helpers - - private void SetOperationStarted() - { - if (!_operationStarted) - { - _operationStarted = true; - } - } - - private void CheckDisposed() - { - if (_disposed) - { - throw new ObjectDisposedException(GetType().FullName); - } - } - - internal void CheckDisposedOrStarted() - { - CheckDisposed(); - if (_operationStarted) - { - throw new InvalidOperationException(SR.net_http_operation_started); - } - } - - private static bool AreEqual(string x, string y) - { - return (string.Compare(x, y, StringComparison.OrdinalIgnoreCase) == 0); - } - - // Security: We need an assert for a call into WindowsIdentity.GetCurrent - [SecuritySafeCritical] - [SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.ControlPrincipal)] - [SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts", Justification="Needed for identity flow.")] - private void SafeCaptureIdenity(RequestState state) - { - state.identity = WindowsIdentity.GetCurrent(); - } - - #endregion Helpers - - private class RequestState - { - internal HttpWebRequest webRequest; - internal TaskCompletionSource tcs; - internal CancellationToken cancellationToken; - internal HttpRequestMessage requestMessage; - internal Stream requestStream; - internal WindowsIdentity identity; - } - - // The ConnectStream returned by HttpWebResponse may throw a WebException when aborted. Wrap them in - // IOExceptions. The ConnectStream will be read-only so we don't need to wrap the write methods. - private class WebExceptionWrapperStream : DelegatingStream - { - internal WebExceptionWrapperStream(Stream innerStream) - : base(innerStream) - { - } - - public override int Read(byte[] buffer, int offset, int count) - { - try - { - return base.Read(buffer, offset, count); - } - catch (WebException wex) - { - throw new IOException(SR.net_http_io_read, wex); - } - } - - public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) - { - try - { - return base.BeginRead(buffer, offset, count, callback, state); - } - catch (WebException wex) - { - throw new IOException(SR.net_http_io_read, wex); - } - } - - public override int EndRead(IAsyncResult asyncResult) - { - try - { - return base.EndRead(asyncResult); - } - catch (WebException wex) - { - throw new IOException(SR.net_http_io_read, wex); - } - } - - public override async Task ReadAsync(byte[] buffer, int offset, int count, - CancellationToken cancellationToken) - { - try - { - return await base.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); - } - catch (WebException wex) - { - throw new IOException(SR.net_http_io_read, wex); - } - } - - public override int ReadByte() - { - try - { - return base.ReadByte(); - } - catch (WebException wex) - { - throw new IOException(SR.net_http_io_read, wex); - } - } - } - } -} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs index 1203fb6512..aaadad33e3 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.cs @@ -2,16 +2,52 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; using System.Net.Security; using System.Security.Cryptography.X509Certificates; +using System.Threading; namespace System.Net.Http { public partial class HttpClientHandler : HttpMessageHandler { // This partial implementation contains members common to all HttpClientHandler implementations. - - private static bool UseManagedHandler => Environment.GetEnvironmentVariable("COMPlus_UseManagedHttpClientHandler") == "true"; + private const string ManagedHandlerSettingName = "COMPlus_UseManagedHttpClientHandler"; + + private static LocalDataStoreSlot s_useManagedHandlerSlot; + + private static bool UseManagedHandler + { + get + { + // Check the environment variable to see if it's been set to true. If it has, use the managed handler. + if (Environment.GetEnvironmentVariable(ManagedHandlerSettingName) == "true") + { + return true; + } + + // Then check whether a thread local has been set with the same name. + // If it's been set to a Boolean true, also use the managed handler. + LocalDataStoreSlot slot = LazyInitializer.EnsureInitialized(ref s_useManagedHandlerSlot, () => + { + LocalDataStoreSlot local = Thread.GetNamedDataSlot(ManagedHandlerSettingName); + if (local == null) + { + try + { + local = Thread.AllocateNamedDataSlot(ManagedHandlerSettingName); + } + catch (ArgumentException) + { + local = Thread.GetNamedDataSlot(ManagedHandlerSettingName); + } + } + return local; + }); + Debug.Assert(slot != null); + return Thread.GetData(slot) is bool result && result; + } + } public static Func DangerousAcceptAnyServerCertificateValidator { get; } = delegate { return true; }; } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpContent.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpContent.cs index 092b753e10..7f7509509c 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpContent.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpContent.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if !NET46 using System.Buffers; -#endif using System.Diagnostics; using System.Diagnostics.Contracts; using System.IO; @@ -145,9 +143,6 @@ namespace System.Net.Http internal bool TryGetBuffer(out ArraySegment buffer) { -#if NET46 - buffer = default(ArraySegment); -#endif return _bufferedContent != null && _bufferedContent.TryGetBuffer(out buffer); } @@ -351,15 +346,6 @@ namespace System.Net.Http return CopyToAsync(stream, null); } -#if NET46 - // Workaround for HttpWebRequest synchronous resubmit. This code is required because the underlying - // .NET Framework HttpWebRequest implementation cannot use CopyToAsync and only uses sync based CopyTo. - internal void CopyTo(Stream stream) - { - CopyToAsync(stream).Wait(); - } -#endif - public Task LoadIntoBufferAsync() { return LoadIntoBufferAsync(MaxBufferSize); @@ -773,7 +759,6 @@ namespace System.Net.Http } } -#if !NET46 internal sealed class LimitArrayPoolWriteStream : Stream { private const int MaxByteArrayLength = 0x7FFFFFC7; @@ -868,12 +853,25 @@ namespace System.Net.Http _length += count; } + public override void Write(ReadOnlySpan source) + { + EnsureCapacity(_length + source.Length); + source.CopyTo(new Span(_buffer, _length, source.Length)); + _length += source.Length; + } + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { Write(buffer, offset, count); return Task.CompletedTask; } + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + Write(source.Span); + return Task.CompletedTask; + } + public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) => TaskToApm.Begin(WriteAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState); @@ -901,6 +899,5 @@ namespace System.Net.Http public override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(); } public override void SetLength(long value) { throw new NotSupportedException(); } } -#endif } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpMethod.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpMethod.cs index 33c44b04a6..89234ac9d3 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpMethod.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpMethod.cs @@ -119,7 +119,7 @@ namespace System.Net.Http public override string ToString() { - return _method.ToString(); + return _method; } public static bool operator ==(HttpMethod left, HttpMethod right) diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs index 514be9b5c2..e104353ebe 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs @@ -115,6 +115,34 @@ namespace System.Net.Http return input.Length - startIndex; } + [Pure] + internal static bool IsToken(string input) + { + for (int i = 0; i < input.Length; i++) + { + if (!IsTokenChar(input[i])) + { + return false; + } + } + + return true; + } + + [Pure] + internal static bool IsToken(ReadOnlySpan input) + { + for (int i = 0; i < input.Length; i++) + { + if (!IsTokenChar((char) input[i])) + { + return false; + } + } + + return true; + } + internal static int GetWhitespaceLength(string input, int startIndex) { Debug.Assert(input != null); diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHandler.cs index 0d81bd3947..5ae0562595 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHandler.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; +using System.Net; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; @@ -11,10 +12,10 @@ namespace System.Net.Http { internal sealed class AuthenticationHandler : HttpMessageHandler { - private const string Basic = "Basic"; private readonly HttpMessageHandler _innerHandler; private readonly bool _preAuthenticate; - private readonly ICredentials _credentials; + private ICredentials _credentials; + private AuthenticationHelper.DigestResponse _digestResponse; public AuthenticationHandler(bool preAuthenticate, ICredentials credentials, HttpMessageHandler innerHandler) { @@ -26,44 +27,78 @@ namespace System.Net.Http _innerHandler = innerHandler; } - private bool TrySetBasicAuthToken(HttpRequestMessage request) - { - NetworkCredential credential = _credentials.GetCredential(request.RequestUri, Basic); - if (credential == null) - { - return false; - } - - request.Headers.Authorization = new AuthenticationHeaderValue(Basic, BasicAuthenticationHelper.GetBasicTokenForCredential(credential)); - return true; - } - protected internal override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { if (_preAuthenticate) { - TrySetBasicAuthToken(request); + // Try using previous digest response WWWAuthenticate header + if (_digestResponse != null) + { + await AuthenticationHelper.TrySetDigestAuthToken(request, _credentials, _digestResponse, HttpKnownHeaderNames.Authorization).ConfigureAwait(false); + } + else + { + AuthenticationHelper.TrySetBasicAuthToken(request, _credentials); + } } HttpResponseMessage response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); - if (!_preAuthenticate && response.StatusCode == HttpStatusCode.Unauthorized) + // In case of redirection, ensure _credentials as CredentialCache + if (AutoRedirectHandler.RequestNeedsRedirect(response)) + { + // Just as with WinHttpHandler and CurlHandler, for security reasons, we drop the server credential if it is + // anything other than a CredentialCache. We allow credentials in a CredentialCache since they + // are specifically tied to URIs. + _credentials = _credentials as CredentialCache; + } + else if (_credentials != null && !_preAuthenticate && response.StatusCode == HttpStatusCode.Unauthorized) { HttpHeaderValueCollection authenticateValues = response.Headers.WwwAuthenticate; foreach (AuthenticationHeaderValue h in authenticateValues) { - // We only support Basic auth, ignore others - if (h.Scheme == Basic) + // We only support Basic and digest auth, ignore others + if (h.Scheme == AuthenticationHelper.Basic) { - if (!TrySetBasicAuthToken(request)) + if (AuthenticationHelper.TrySetBasicAuthToken(request, _credentials)) { + response.Dispose(); + response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); break; } + } + else if (h.Scheme == AuthenticationHelper.Digest) + { + // Update digest response with new parameter from WWWAuthenticate + _digestResponse = new AuthenticationHelper.DigestResponse(h.Parameter); + if (await AuthenticationHelper.TrySetDigestAuthToken(request, _credentials, _digestResponse, HttpKnownHeaderNames.Authorization).ConfigureAwait(false)) + { + response.Dispose(); + response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); - response.Dispose(); - response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); - break; + // Retry in case of nonce timeout in server. + if (response.StatusCode == HttpStatusCode.Unauthorized) + { + foreach (AuthenticationHeaderValue ahv in response.Headers.WwwAuthenticate) + { + if (ahv.Scheme == AuthenticationHelper.Digest) + { + _digestResponse = new AuthenticationHelper.DigestResponse(ahv.Parameter); + if (AuthenticationHelper.IsServerNonceStale(_digestResponse) && + await AuthenticationHelper.TrySetDigestAuthToken(request, _credentials, _digestResponse, HttpKnownHeaderNames.Authorization).ConfigureAwait(false)) + { + response.Dispose(); + response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); + } + + break; + } + } + } + + break; + } } } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHelper.Basic.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHelper.Basic.cs new file mode 100644 index 0000000000..1e55050131 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHelper.Basic.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Net.Http.Headers; +using System.Text; + +namespace System.Net.Http +{ + internal partial class AuthenticationHelper + { + public const string Basic = "Basic"; + + public static bool TrySetBasicAuthToken(HttpRequestMessage request, ICredentials credentials) + { + NetworkCredential credential = credentials.GetCredential(request.RequestUri, Basic); + if (credential == null) + { + return false; + } + + request.Headers.Authorization = new AuthenticationHeaderValue(Basic, GetBasicTokenForCredential(credential)); + return true; + } + + public static string GetBasicTokenForCredential(NetworkCredential credential) + { + if (credential.UserName.IndexOf(':') != -1) + { + // TODO #23135: What's the right way to handle this? + throw new NotImplementedException($"Basic auth: can't handle ':' in username \"{credential.UserName}\""); + } + + string userPass = credential.UserName + ":" + credential.Password; + if (!string.IsNullOrEmpty(credential.Domain)) + { + if (credential.Domain.IndexOf(':') != -1) + { + // TODO #23135: What's the right way to handle this? + throw new NotImplementedException($"Basic auth: can't handle ':' in domain \"{credential.Domain}\""); + } + + userPass = credential.Domain + "\\" + userPass; + } + + return Convert.ToBase64String(Encoding.UTF8.GetBytes(userPass)); + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHelper.Digest.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHelper.Digest.cs new file mode 100644 index 0000000000..8630562f6d --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AuthenticationHelper.Digest.cs @@ -0,0 +1,405 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Net.Http.Headers; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal partial class AuthenticationHelper + { + public const string Digest = "Digest"; + + // Define digest constants + private const string Qop = "qop"; + private const string Auth = "auth"; + private const string AuthInt = "auth-int"; + private const string Nonce = "nonce"; + private const string NC = "nc"; + private const string Realm = "realm"; + private const string UserHash = "userhash"; + private const string Username = "username"; + private const string UsernameStar = "username*"; + private const string Algorithm = "algorithm"; + private const string Uri = "uri"; + private const string Sha256 = "SHA-256"; + private const string Md5 = "MD5"; + private const string Sha256Sess = "SHA-256-sess"; + private const string MD5Sess = "MD5-sess"; + private const string CNonce = "cnonce"; + private const string Opaque = "opaque"; + private const string Response = "response"; + private const string Stale = "stale"; + + // Define alphanumeric characters for cnonce + // 48='0', 65='A', 97='a' + private static int[] s_alphaNumChooser = new int[] { 48, 65, 97 }; + + // Define a random number generator for cnonce + private static RandomNumberGenerator s_rng = RandomNumberGenerator.Create(); + + public async static Task TrySetDigestAuthToken(HttpRequestMessage request, ICredentials credentials, DigestResponse digestResponse, string authHeader) + { + NetworkCredential credential = credentials.GetCredential(request.RequestUri, Digest); + if (credential == null) + { + return false; + } + + string parameter = await GetDigestTokenForCredential(credential, request, digestResponse).ConfigureAwait(false); + + // Any errors in obtaining parameter return false + if (string.IsNullOrEmpty(parameter)) + return false; + + if (authHeader == HttpKnownHeaderNames.Authorization) + { + request.Headers.Authorization = new AuthenticationHeaderValue(Digest, parameter); + } + else if (authHeader == HttpKnownHeaderNames.ProxyAuthorization) + { + request.Headers.ProxyAuthorization = new AuthenticationHeaderValue(Digest, parameter); + } + + return true; + } + + public static async Task GetDigestTokenForCredential(NetworkCredential credential, HttpRequestMessage request, DigestResponse digestResponse) + { + StringBuilder sb = StringBuilderCache.Acquire(); + + // It is mandatory for servers to implement sha-256 per RFC 7616 + // Keep MD5 for backward compatibility. + string algorithm; + if (digestResponse.Parameters.TryGetValue(Algorithm, out algorithm)) + { + if (algorithm != Sha256 && algorithm != Md5 && algorithm != Sha256Sess && algorithm != MD5Sess) + return null; + } + else + { + algorithm = Md5; + } + + // Check if nonce is there in challenge + string nonce; + if (!digestResponse.Parameters.TryGetValue(Nonce, out nonce)) + { + return null; + } + + string opaque; + if (!digestResponse.Parameters.TryGetValue(Opaque, out opaque)) + { + return null; + } + + string realm = digestResponse.Parameters.ContainsKey(Realm) ? digestResponse.Parameters[Realm] : string.Empty; + + // Add username + string userhash; + if (digestResponse.Parameters.TryGetValue(UserHash, out userhash) && userhash == "true") + { + sb.AppendKeyValue(Username, ComputeHash(credential.UserName + ":" + realm, algorithm)); + sb.AppendKeyValue(UserHash, userhash, includeQuotes: false); + } + else + { + string usernameStar; + if (HeaderUtilities.IsInputEncoded5987(credential.UserName, out usernameStar)) + { + sb.AppendKeyValue(UsernameStar, usernameStar, includeQuotes: false); + } + else + { + sb.AppendKeyValue(Username, credential.UserName); + } + } + + // Add realm + if (realm != string.Empty) + sb.AppendKeyValue(Realm, realm); + + // If nonce is same as previous request, update nonce count. + if (nonce == digestResponse.Nonce) + { + digestResponse.NonceCount++; + } + + // Add nonce + sb.AppendKeyValue(Nonce, nonce); + digestResponse.Nonce = nonce; + + // Add uri + sb.AppendKeyValue(Uri, request.RequestUri.PathAndQuery); + + // Set qop, default is auth + string qop = Auth; + if (digestResponse.Parameters.ContainsKey(Qop)) + { + // Check if auth-int present in qop string + int index1 = digestResponse.Parameters[Qop].IndexOf(AuthInt); + if (index1 != -1) + { + // Get index of auth if present in qop string + int index2 = digestResponse.Parameters[Qop].IndexOf(Auth); + + // If index2 < index1, auth option is available + // If index2 == index1, check if auth option available later in string after auth-int. + if (index2 == index1) + { + index2 = digestResponse.Parameters[Qop].IndexOf(Auth, index1 + AuthInt.Length); + if (index2 == -1) + { + qop = AuthInt; + } + } + } + } + + // Set cnonce + string cnonce = GetRandomAlphaNumericString(); + + // Calculate response + string a1 = credential.UserName + ":" + realm + ":" + credential.Password; + if (algorithm == Sha256Sess || algorithm == MD5Sess) + { + algorithm = algorithm == Sha256Sess ? Sha256 : Md5; + a1 = ComputeHash(a1, algorithm) + ":" + nonce + ":" + cnonce; + } + + string a2 = request.Method.Method + ":" + request.RequestUri.PathAndQuery; + if (qop == AuthInt) + { + string content = request.Content == null ? string.Empty : await request.Content.ReadAsStringAsync().ConfigureAwait(false); + a2 = a2 + ":" + ComputeHash(content, algorithm); + } + + string response = ComputeHash(ComputeHash(a1, algorithm) + ":" + + nonce + ":" + + digestResponse.NonceCount.ToString("x8") + ":" + + cnonce + ":" + + qop + ":" + + ComputeHash(a2, algorithm), algorithm); + + // Add response + sb.AppendKeyValue(Response, response); + + // Add algorithm + sb.AppendKeyValue(Algorithm, algorithm, includeQuotes: false); + + // Add opaque + sb.AppendKeyValue(Opaque, opaque); + + // Add qop + sb.AppendKeyValue(Qop, qop, includeQuotes: false); + + // Add nc + sb.AppendKeyValue(NC, digestResponse.NonceCount.ToString("x8"), includeQuotes: false); + + // Add cnonce + sb.AppendKeyValue(CNonce, cnonce, includeComma: false); + + return StringBuilderCache.GetStringAndRelease(sb); + } + + public static bool IsServerNonceStale(DigestResponse digestResponse) + { + string stale = null; + return digestResponse.Parameters.TryGetValue(Stale, out stale) && stale == "true"; + } + + private static string GetRandomAlphaNumericString() + { + const int Length = 16; + Span randomNumbers = stackalloc byte[Length * 2]; + s_rng.GetBytes(randomNumbers); + + StringBuilder sb = StringBuilderCache.Acquire(Length); + for (int i = 0; i < randomNumbers.Length; ) + { + // Get a random digit 0-9, a random alphabet in a-z, or a random alphabeta in A-Z + int rangeIndex = randomNumbers[i++] % 3; + int value = randomNumbers[i++] % (rangeIndex == 0 ? 10 : 26); + sb.Append((char)(s_alphaNumChooser[rangeIndex] + value)); + } + + return StringBuilderCache.GetStringAndRelease(sb); + } + + private static string ComputeHash(string data, string algorithm) + { + // Disable MD5 insecure warning. +#pragma warning disable CA5351 + using (HashAlgorithm hash = algorithm == Sha256 ? SHA256.Create() : (HashAlgorithm)MD5.Create()) +#pragma warning restore CA5351 + { + Encoding enc = Encoding.UTF8; + byte[] result = hash.ComputeHash(enc.GetBytes(data)); + + StringBuilder sb = StringBuilderCache.Acquire(result.Length * 2); + foreach (byte b in result) + sb.Append(b.ToString("x2")); + + return StringBuilderCache.GetStringAndRelease(sb); + } + } + + public class DigestResponse + { + public readonly Dictionary Parameters = new Dictionary(StringComparer.OrdinalIgnoreCase); + + // Keep track of request values for this response. + public string Nonce; + public uint NonceCount; + + public DigestResponse(string challenge) + { + Nonce = null; + NonceCount = 1; + + Parse(challenge); + } + + private unsafe string GetNextKey(ref char* p) + { + // It is generally cheaper to change a local and then write back to ref at the end + // rather than updating the ref on each operation. + char* temp = p; + + StringBuilder sb = StringBuilderCache.Acquire(); + + // Skip leading whitespace + while (*temp == ' ') + { + temp++; + } + + // Start parsing key + while (*temp != '=') + { + // Key cannot have whitespace + if (*temp == ' ') + break; + + sb.Append(*temp); + temp++; + } + + // Skip trailing whitespace and '=' + while (*temp == ' ' || *temp == '=') + { + temp++; + } + + // Set the ref p to temp + p = temp; + + return StringBuilderCache.GetStringAndRelease(sb); + } + + private unsafe string GetNextValue(ref char* p) + { + // It is generally cheaper to change a local and then write back to ref at the end + // rather than updating the ref on each operation. + char* temp = p; + + StringBuilder sb = StringBuilderCache.Acquire(); + + // Skip leading whitespace + while (*temp == ' ') + { + temp++; + } + + // If quoted value, skip first quote. + bool quotedValue = false; + if (*temp == '"') + { + quotedValue = true; + temp++; + } + + while ((quotedValue && *temp != '"') || (!quotedValue && *temp != ',' && *temp != '\0')) + { + sb.Append(*temp); + temp++; + + if (!quotedValue && *temp == ' ') + break; + + if (quotedValue && *temp == '"' && *(temp - 1) == '\\') + { + // Include the escaped quote. + sb.Append(*temp); + temp++; + } + } + + // Return if this is last value. + if (*temp == '\0') + return sb.ToString(); + + // Skip the end quote or ',' or whitespace + temp++; + + // Skip whitespace and , + while (*temp == ' ' || *temp == ',') + { + temp++; + } + + // Set ref p to temp + p = temp; + + return StringBuilderCache.GetStringAndRelease(sb); + } + + private unsafe void Parse(string challenge) + { + fixed (char* p = challenge) + { + char* counter = p; + while (*counter != '\0') + { + string key = GetNextKey(ref counter); + string value = GetNextValue(ref counter); + + Parameters.Add(key, value); + } + } + } + } + } + + internal static class StringBuilderExtensions + { + public static void AppendKeyValue(this StringBuilder sb, string key, string value, bool includeQuotes = true, bool includeComma = true) + { + sb.Append(key); + sb.Append('='); + if (includeQuotes) + { + sb.Append('"'); + } + + sb.Append(value); + if (includeQuotes) + { + sb.Append('"'); + } + + if (includeComma) + { + sb.Append(','); + sb.Append(' '); + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AutoRedirectHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AutoRedirectHandler.cs index 0c15093451..193add2fe2 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AutoRedirectHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/AutoRedirectHandler.cs @@ -23,38 +23,48 @@ namespace System.Net.Http _maxAutomaticRedirections = maxAutomaticRedirections; } + internal static bool RequestNeedsRedirect(HttpResponseMessage response) + { + bool needRedirect = false; + switch (response.StatusCode) + { + case HttpStatusCode.Moved: + case HttpStatusCode.Found: + case HttpStatusCode.SeeOther: + case HttpStatusCode.TemporaryRedirect: + needRedirect = true; + break; + + case HttpStatusCode.MultipleChoices: + needRedirect = response.Headers.Location != null; // Don't redirect if no Location specified + break; + } + + return needRedirect; + } + + private static bool RequestRequiresForceGet(HttpStatusCode statusCode, HttpMethod requestMethod) + { + if (statusCode == HttpStatusCode.Moved || + statusCode == HttpStatusCode.Found || + statusCode == HttpStatusCode.SeeOther || + statusCode == HttpStatusCode.MultipleChoices) + { + return requestMethod == HttpMethod.Post; + } + + return false; + } + protected internal override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { - HttpResponseMessage response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); - + HttpResponseMessage response; uint redirectCount = 0; while (true) { - bool needRedirect = false; - bool forceGet = false; - switch (response.StatusCode) - { - case HttpStatusCode.Moved: - case HttpStatusCode.TemporaryRedirect: - needRedirect = true; - break; + response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); - case HttpStatusCode.Found: - case HttpStatusCode.SeeOther: - needRedirect = true; - forceGet = true; - break; - - case HttpStatusCode.MultipleChoices: - // Don't redirect if no Location specified - if (response.Headers.Location != null) - { - needRedirect = true; - } - break; - } - - if (!needRedirect) + if (!RequestNeedsRedirect(response)) { break; } @@ -62,7 +72,7 @@ namespace System.Net.Http Uri location = response.Headers.Location; if (location == null) { - throw new HttpRequestException("no Location header for redirect"); + throw new HttpRequestException(SR.net_http_headers_missing_location); } if (!location.IsAbsoluteUri) @@ -82,13 +92,13 @@ namespace System.Net.Http redirectCount++; if (redirectCount > _maxAutomaticRedirections) { - throw new HttpRequestException("max redirects exceeded"); + throw new HttpRequestException(SR.net_http_max_redirects); } // Set up for the automatic redirect request.RequestUri = location; - if (forceGet) + if (RequestRequiresForceGet(response.StatusCode, request.Method)) { request.Method = HttpMethod.Get; request.Content = null; @@ -96,7 +106,6 @@ namespace System.Net.Http // Do the redirect. response.Dispose(); - response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); } return response; diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/BasicAuthenticationHelper.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/BasicAuthenticationHelper.cs deleted file mode 100644 index f35cca907c..0000000000 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/BasicAuthenticationHelper.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Text; - -namespace System.Net.Http -{ - internal static class BasicAuthenticationHelper - { - public static string GetBasicTokenForCredential(NetworkCredential credential) - { - if (credential.UserName.IndexOf(':') != -1) - { - // TODO #21452: What's the right way to handle this? - throw new NotImplementedException($"Basic auth: can't handle ':' in username \"{credential.UserName}\""); - } - - string userPass = credential.UserName + ":" + credential.Password; - if (!string.IsNullOrEmpty(credential.Domain)) - { - if (credential.Domain.IndexOf(':') != -1) - { - // TODO #21452: What's the right way to handle this? - throw new NotImplementedException($"Basic auth: can't handle ':' in domain \"{credential.Domain}\""); - } - - userPass = credential.Domain + "\\" + userPass; - } - - return Convert.ToBase64String(Encoding.UTF8.GetBytes(userPass)); - } - } -} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ChunkedEncodingReadStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ChunkedEncodingReadStream.cs new file mode 100644 index 0000000000..9b8b5670eb --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ChunkedEncodingReadStream.cs @@ -0,0 +1,159 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection + { + private sealed class ChunkedEncodingReadStream : HttpContentReadStream + { + private ulong _chunkBytesRemaining; + + public ChunkedEncodingReadStream(HttpConnection connection) + : base(connection) + { + _chunkBytesRemaining = 0; + } + + private async Task TryGetNextChunk(CancellationToken cancellationToken) + { + Debug.Assert(_chunkBytesRemaining == 0); + + // Start of chunk, read chunk size. + ulong chunkSize = ParseHexSize(await _connection.ReadNextLineAsync(cancellationToken).ConfigureAwait(false)); + _chunkBytesRemaining = chunkSize; + + if (chunkSize > 0) + { + return true; + } + + // Indicates end of response body. We expect final CRLF after this. + await _connection.ReadCrLfAsync(cancellationToken).ConfigureAwait(false); + _connection.ReturnConnectionToPool(); + _connection = null; + return false; + } + + private ulong ParseHexSize(ArraySegment line) + { + ulong size = 0; + try + { + for (int i = 0; i < line.Count; i++) + { + char c = (char)line[i]; + if ((uint)(c - '0') <= '9' - '0') + { + size = checked(size * 16 + ((ulong)c - '0')); + } + else if ((uint)(c - 'a') <= ('f' - 'a')) + { + size = checked(size * 16 + ((ulong)c - 'a' + 10)); + } + else if ((uint)(c - 'A') <= ('F' - 'A')) + { + size = checked(size * 16 + ((ulong)c - 'A' + 10)); + } + else + { + if (c == '\r' && i > 0) + { + break; + } + throw new IOException(SR.net_http_invalid_response); + } + } + } + catch (OverflowException e) + { + throw new IOException(SR.net_http_invalid_response, e); + } + return size; + } + + private async Task ConsumeChunkBytes(ulong bytesConsumed, CancellationToken cancellationToken) + { + Debug.Assert(bytesConsumed <= _chunkBytesRemaining); + _chunkBytesRemaining -= bytesConsumed; + if (_chunkBytesRemaining == 0) + { + await _connection.ReadCrLfAsync(cancellationToken).ConfigureAwait(false); + } + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, count); + return ReadAsync(new Memory(buffer, offset, count)).AsTask(); + } + + public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) + { + if (_connection == null || destination.Length == 0) + { + // Response body fully consumed or the caller didn't ask for any data + return 0; + } + + if (_chunkBytesRemaining == 0) + { + if (!await TryGetNextChunk(cancellationToken).ConfigureAwait(false)) + { + // End of response body + return 0; + } + } + + if (_chunkBytesRemaining < (ulong)destination.Length) + { + destination = destination.Slice(0, (int)_chunkBytesRemaining); + } + + int bytesRead = await _connection.ReadAsync(destination, cancellationToken).ConfigureAwait(false); + + if (bytesRead <= 0) + { + // Unexpected end of response stream + throw new IOException(SR.net_http_invalid_response); + } + + await ConsumeChunkBytes((ulong)bytesRead, cancellationToken).ConfigureAwait(false); + + return bytesRead; + } + + public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + if (_connection == null) + { + // Response body fully consumed + return; + } + + if (_chunkBytesRemaining > 0) + { + await _connection.CopyToAsync(destination, _chunkBytesRemaining, cancellationToken).ConfigureAwait(false); + await ConsumeChunkBytes(_chunkBytesRemaining, cancellationToken).ConfigureAwait(false); + } + + while (await TryGetNextChunk(cancellationToken).ConfigureAwait(false)) + { + await _connection.CopyToAsync(destination, _chunkBytesRemaining, cancellationToken).ConfigureAwait(false); + await ConsumeChunkBytes(_chunkBytesRemaining, cancellationToken).ConfigureAwait(false); + } + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ChunkedEncodingWriteStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ChunkedEncodingWriteStream.cs new file mode 100644 index 0000000000..16fad17c4d --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ChunkedEncodingWriteStream.cs @@ -0,0 +1,91 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class ChunkedEncodingWriteStream : HttpContentWriteStream + { + private static readonly byte[] s_finalChunkBytes = { (byte)'0', (byte)'\r', (byte)'\n', (byte)'\r', (byte)'\n' }; + + public ChunkedEncodingWriteStream(HttpConnection connection, CancellationToken cancellationToken) : + base(connection, cancellationToken) + { + } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken ignored) + { + ValidateBufferArgs(buffer, offset, count); + return WriteAsync(new Memory(buffer, offset, count), ignored); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + if (source.Length == 0) + { + // Don't write if nothing was given, especially since we don't want to accidentally send a 0 chunk, + // which would indicate end of body. Instead, just ensure no content is stuck in the buffer. + return _connection.FlushAsync(RequestCancellationToken); + } + + if (_connection._currentRequest == null) + { + // Avoid sending anything if the response has already completed, in which case there's no point + // sending further data (this might happen, for example, on a redirect.) + return Task.CompletedTask; + } + + return WriteChunkAsync(source); + } + + private async Task WriteChunkAsync(ReadOnlyMemory source) + { + // Write chunk length -- hex representation of count + bool digitWritten = false; + for (int i = 7; i >= 0; i--) + { + int shift = i * 4; + int mask = 0xF << shift; + int digit = (source.Length & mask) >> shift; + if (digitWritten || digit != 0) + { + await _connection.WriteByteAsync((byte)(digit < 10 ? '0' + digit : 'A' + digit - 10), RequestCancellationToken).ConfigureAwait(false); + digitWritten = true; + } + } + + // End chunk length + await _connection.WriteTwoBytesAsync((byte)'\r', (byte)'\n', RequestCancellationToken).ConfigureAwait(false); + + // Write chunk contents + await _connection.WriteAsync(source, RequestCancellationToken).ConfigureAwait(false); + await _connection.WriteTwoBytesAsync((byte)'\r', (byte)'\n', RequestCancellationToken).ConfigureAwait(false); + + // Flush the chunk. This is reasonable from the standpoint of having just written a standalone piece + // of data, but is also necessary to support duplex communication, where a CopyToAsync is taking the + // data from content and writing it here; if there was no flush, we might not send the data until the + // source was empty, and it might be kept open to enable subsequent communication. And it's necessary + // in general for at least the first write, as we need to ensure if it's the entirety of the content + // and if all of the headers and content fit in the write buffer that we've actually sent the request. + await _connection.FlushAsync(RequestCancellationToken).ConfigureAwait(false); + } + + public override Task FlushAsync(CancellationToken ignored) + { + return _connection.FlushAsync(RequestCancellationToken); + } + + public override async Task FinishAsync() + { + // Send 0 byte chunk to indicate end, then final CrLf + await _connection.WriteBytesAsync(s_finalChunkBytes, RequestCancellationToken).ConfigureAwait(false); + _connection = null; + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectHelper.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectHelper.cs index aca4b488af..d96ff6547d 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectHelper.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectHelper.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.IO; using System.Net.Sockets; using System.Threading.Tasks; @@ -9,12 +10,12 @@ namespace System.Net.Http { internal static class ConnectHelper { - public static async ValueTask ConnectAsync(string host, int port) + public static async ValueTask ConnectAsync(string host, int port) { var socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; try { - // TODO #21452: No cancellationToken on ConnectAsync? + // TODO #23151: cancellation support? await (IPAddress.TryParse(host, out IPAddress address) ? socket.ConnectAsync(address, port) : socket.ConnectAsync(host, port)).ConfigureAwait(false); @@ -25,17 +26,7 @@ namespace System.Net.Http throw new HttpRequestException(se.Message, se); } - return new NetworkStream(socket, ownsSocket: true) - { -#if false - // TODO #21452: Timeouts? - // Default timeout should be something less than infinity (the Socket default) - // Timeouts probably need to be configurable - // However, timeouts are also a huge pain when debugging, so consider that too. - ReadTimeout = 5000, - WriteTimeout = 5000 -#endif - }; + return new NetworkStream(socket, ownsSocket: true); } } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectionCloseReadStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectionCloseReadStream.cs new file mode 100644 index 0000000000..ac4cb984c1 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ConnectionCloseReadStream.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class ConnectionCloseReadStream : HttpContentReadStream + { + public ConnectionCloseReadStream(HttpConnection connection) + : base(connection) + { + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, count); + return ReadAsync(new Memory(buffer, offset, count), cancellationToken).AsTask(); + } + + public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) + { + if (_connection == null || destination.Length == 0) + { + // Response body fully consumed or the caller didn't ask for any data + return 0; + } + + int bytesRead = await _connection.ReadAsync(destination, cancellationToken).ConfigureAwait(false); + if (bytesRead == 0) + { + // We cannot reuse this connection, so close it. + _connection.Dispose(); + _connection = null; + return 0; + } + + return bytesRead; + } + + public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + if (_connection == null) + { + // Response body fully consumed + return; + } + + await _connection.CopyToAsync(destination, cancellationToken).ConfigureAwait(false); + + // We cannot reuse this connection, so close it. + _connection.Dispose(); + _connection = null; + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ContentLengthReadStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ContentLengthReadStream.cs new file mode 100644 index 0000000000..d7b9f739bc --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ContentLengthReadStream.cs @@ -0,0 +1,88 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class ContentLengthReadStream : HttpContentReadStream + { + private ulong _contentBytesRemaining; + + public ContentLengthReadStream(HttpConnection connection, ulong contentLength) + : base(connection) + { + Debug.Assert(contentLength > 0, "Caller should have checked for 0."); + _contentBytesRemaining = contentLength; + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, count); + return ReadAsync(new Memory(buffer, offset, count), cancellationToken).AsTask(); + } + + public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) + { + if (_connection == null || destination.Length == 0) + { + // Response body fully consumed or the caller didn't ask for any data + return 0; + } + + Debug.Assert(_contentBytesRemaining > 0); + + if ((ulong)destination.Length > _contentBytesRemaining) + { + destination = destination.Slice(0, (int)_contentBytesRemaining); + } + + int bytesRead = await _connection.ReadAsync(destination, cancellationToken).ConfigureAwait(false); + + if (bytesRead <= 0) + { + // Unexpected end of response stream + throw new IOException(SR.net_http_invalid_response); + } + + Debug.Assert((ulong)bytesRead <= _contentBytesRemaining); + _contentBytesRemaining -= (ulong)bytesRead; + + if (_contentBytesRemaining == 0) + { + // End of response body + _connection.ReturnConnectionToPool(); + _connection = null; + } + + return bytesRead; + } + + public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + if (_connection == null) + { + // Response body fully consumed + return; + } + + await _connection.CopyToAsync(destination, _contentBytesRemaining, cancellationToken).ConfigureAwait(false); + + _contentBytesRemaining = 0; + _connection.ReturnConnectionToPool(); + _connection = null; + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ContentLengthWriteStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ContentLengthWriteStream.cs new file mode 100644 index 0000000000..de00dd7468 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ContentLengthWriteStream.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class ContentLengthWriteStream : HttpContentWriteStream + { + public ContentLengthWriteStream(HttpConnection connection, CancellationToken cancellationToken) : + base(connection, cancellationToken) + { + } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken ignored) + { + ValidateBufferArgs(buffer, offset, count); + return WriteAsync(new ReadOnlyMemory(buffer, offset, count), ignored); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + if (_connection._currentRequest == null) + { + // Avoid sending anything if the response has already completed, in which case there's no point + // sending further data (this might happen, for example, on a redirect.) + return Task.CompletedTask; + } + + // Have the connection write the data, skipping the buffer. Importantly, this will + // force a flush of anything already in the buffer, i.e. any remaining request headers + // that are still buffered. + return _connection.WriteWithoutBufferingAsync(source, RequestCancellationToken); + } + + public override Task FlushAsync(CancellationToken ignored) + { + return _connection.FlushAsync(RequestCancellationToken); + } + + public override Task FinishAsync() + { + _connection = null; + return Task.CompletedTask; + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/DecompressionHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/DecompressionHandler.cs index eed7a72e80..cd72dd3293 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/DecompressionHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/DecompressionHandler.cs @@ -131,7 +131,7 @@ namespace System.Net.Http { if (_contentConsumed) { - throw new InvalidOperationException("content already consumed"); + throw new InvalidOperationException(SR.net_http_content_stream_already_read); } _contentConsumed = true; diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/EmptyReadStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/EmptyReadStream.cs new file mode 100644 index 0000000000..2de314374d --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/EmptyReadStream.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class EmptyReadStream : HttpContentReadStream + { + private readonly static Task s_zeroTask = Task.FromResult(0); + + internal static EmptyReadStream Instance { get; } = new EmptyReadStream(); + + private EmptyReadStream() : base(null) { } + + protected override void Dispose(bool disposing) { /* nop */ } + public override void Close() { /* nop */ } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, count); + return s_zeroTask; + } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) => + new ValueTask(0); + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnection.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnection.cs index 3251dc5fd9..3524fea3fd 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnection.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnection.cs @@ -7,22 +7,27 @@ using System.Diagnostics; using System.Globalization; using System.IO; using System.Net.Http.Headers; +using System.Net.Security; +using System.Runtime.CompilerServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace System.Net.Http { - internal sealed class HttpConnection : IDisposable + internal sealed partial class HttpConnection : IDisposable { - private const int BufferSize = + private const int InitialReadBufferSize = #if DEBUG 10; #else 4096; #endif + private const int InitialWriteBufferSize = InitialReadBufferSize; + private const int Expect100TimeoutMilliseconds = 1000; private static readonly byte[] s_contentLength0NewlineAsciiBytes = Encoding.ASCII.GetBytes("Content-Length: 0\r\n"); + private static readonly byte[] s_spaceHttp10NewlineAsciiBytes = Encoding.ASCII.GetBytes(" HTTP/1.0\r\n"); private static readonly byte[] s_spaceHttp11NewlineAsciiBytes = Encoding.ASCII.GetBytes(" HTTP/1.1\r\n"); private static readonly byte[] s_hostKeyAndSeparator = Encoding.ASCII.GetBytes(HttpKnownHeaderNames.Host + ": "); @@ -33,507 +38,19 @@ namespace System.Net.Http private readonly bool _usingProxy; private readonly byte[] _idnHostAsciiBytes; - private ValueStringBuilder _sb; // mutable struct, do not make this readonly - + private HttpRequestMessage _currentRequest; + private Task _sendRequestContentTask; private readonly byte[] _writeBuffer; private int _writeOffset; + private Exception _pendingException; private Task _readAheadTask; - private readonly byte[] _readBuffer; + private byte[] _readBuffer; private int _readOffset; private int _readLength; - private bool _connectionClose; // Connection: close was seen on last response - - private bool _disposed; - - private sealed class HttpConnectionContent : HttpContent - { - private readonly CancellationToken _cancellationToken; - private HttpContentReadStream _stream; - - public HttpConnectionContent(CancellationToken cancellationToken) - { - _cancellationToken = cancellationToken; - } - - public void SetStream(HttpContentReadStream stream) - { - Debug.Assert(stream != null); - Debug.Assert(stream.CanRead); - - _stream = stream; - } - - private HttpContentReadStream ConsumeStream() - { - if (_stream == null) - { - throw new InvalidOperationException("content already consumed"); - } - - HttpContentReadStream stream = _stream; - _stream = null; - return stream; - } - - protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context) - { - Debug.Assert(stream != null); - - using (HttpContentReadStream contentStream = ConsumeStream()) - { - const int BufferSize = 8192; - await contentStream.CopyToAsync(stream, BufferSize, _cancellationToken).ConfigureAwait(false); - } - } - - protected internal override bool TryComputeLength(out long length) - { - length = 0; - return false; - } - - protected override Task CreateContentReadStreamAsync() => - Task.FromResult(ConsumeStream()); - - internal override Stream TryCreateContentReadStream() => - ConsumeStream(); - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (_stream != null) - { - _stream.Dispose(); - _stream = null; - } - } - - base.Dispose(disposing); - } - } - - private sealed class ContentLengthReadStream : HttpContentReadStream - { - private long _contentBytesRemaining; - - public ContentLengthReadStream(HttpConnection connection, long contentLength) - : base(connection) - { - if (contentLength == 0) - { - _connection = null; - _contentBytesRemaining = 0; - connection.ReturnConnectionToPool(); - } - else - { - _contentBytesRemaining = contentLength; - } - } - - public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - if (buffer == null) - { - throw new ArgumentNullException(nameof(buffer)); - } - - if (offset < 0 || offset > buffer.Length) - { - throw new ArgumentOutOfRangeException(nameof(offset)); - } - - if (count < 0 || count > buffer.Length - offset) - { - throw new ArgumentOutOfRangeException(nameof(count)); - } - - if (_connection == null || count == 0) - { - // Response body fully consumed or the caller didn't ask for any data - return 0; - } - - Debug.Assert(_contentBytesRemaining > 0); - - count = (int)Math.Min(count, _contentBytesRemaining); - - int bytesRead = await _connection.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); - - if (bytesRead == 0) - { - // Unexpected end of response stream - throw new IOException("Unexpected end of content stream"); - } - - Debug.Assert(bytesRead <= _contentBytesRemaining); - _contentBytesRemaining -= bytesRead; - - if (_contentBytesRemaining == 0) - { - // End of response body - _connection.ReturnConnectionToPool(); - _connection = null; - } - - return bytesRead; - } - - public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) - { - if (destination == null) - { - throw new ArgumentNullException(nameof(destination)); - } - - if (_connection == null) - { - // Response body fully consumed - return; - } - - await _connection.CopyChunkToAsync(destination, _contentBytesRemaining, cancellationToken).ConfigureAwait(false); - - _contentBytesRemaining = 0; - _connection.ReturnConnectionToPool(); - _connection = null; - } - } - - private sealed class ChunkedEncodingReadStream : HttpContentReadStream - { - private int _chunkBytesRemaining; - - public ChunkedEncodingReadStream(HttpConnection connection) - : base(connection) - { - _chunkBytesRemaining = 0; - } - - private async Task TryGetNextChunk(CancellationToken cancellationToken) - { - Debug.Assert(_chunkBytesRemaining == 0); - - // Start of chunk, read chunk size - int chunkSize = 0; - char c = await _connection.ReadCharAsync(cancellationToken).ConfigureAwait(false); - while (true) - { - // Get hex digit - if ((uint)(c - '0') <= '9' - '0') - { - chunkSize = chunkSize * 16 + (c - '0'); - } - else if ((uint)(c - 'a') <= ('f' - 'a')) - { - chunkSize = chunkSize * 16 + (c - 'a' + 10); - } - else if ((uint)(c - 'A') <= ('F' - 'A')) - { - chunkSize = chunkSize * 16 + (c - 'A' + 10); - } - else - { - throw new IOException("Invalid chunk size in response stream"); - } - - c = await _connection.ReadCharAsync(cancellationToken).ConfigureAwait(false); - if (c == '\r') - { - if (await _connection.ReadCharAsync(cancellationToken).ConfigureAwait(false) != '\n') - { - throw new IOException("Saw CR without LF while parsing chunk size"); - } - - break; - } - } - - _chunkBytesRemaining = chunkSize; - if (chunkSize == 0) - { - // Indicates end of response body - - // We expect final CRLF after this - if (await _connection.ReadByteAsync(cancellationToken).ConfigureAwait(false) != (byte)'\r' || - await _connection.ReadByteAsync(cancellationToken).ConfigureAwait(false) != (byte)'\n') - { - throw new IOException("missing final CRLF for chunked encoding"); - } - - _connection.ReturnConnectionToPool(); - _connection = null; - return false; - } - - return true; - } - - private async Task ConsumeChunkBytes(int bytesConsumed, CancellationToken cancellationToken) - { - Debug.Assert(bytesConsumed <= _chunkBytesRemaining); - _chunkBytesRemaining -= bytesConsumed; - - if (_chunkBytesRemaining == 0) - { - // Parse CRLF at end of chunk - if (await _connection.ReadCharAsync(cancellationToken).ConfigureAwait(false) != '\r' || - await _connection.ReadCharAsync(cancellationToken).ConfigureAwait(false) != '\n') - { - throw new IOException("missing CRLF for end of chunk"); - } - } - } - - public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - if (buffer == null) - { - throw new ArgumentNullException(nameof(buffer)); - } - - if (offset < 0 || offset > buffer.Length) - { - throw new ArgumentOutOfRangeException(nameof(offset)); - } - - if (count < 0 || count > buffer.Length - offset) - { - throw new ArgumentOutOfRangeException(nameof(count)); - } - - if (_connection == null || count == 0) - { - // Response body fully consumed or the caller didn't ask for any data - return 0; - } - - if (_chunkBytesRemaining == 0) - { - if (!await TryGetNextChunk(cancellationToken).ConfigureAwait(false)) - { - // End of response body - return 0; - } - } - - count = Math.Min(count, _chunkBytesRemaining); - - int bytesRead = await _connection.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); - - if (bytesRead == 0) - { - // Unexpected end of response stream - throw new IOException("Unexpected end of content stream while processing chunked response body"); - } - - await ConsumeChunkBytes(bytesRead, cancellationToken).ConfigureAwait(false); - - return bytesRead; - } - - public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) - { - if (destination == null) - { - throw new ArgumentNullException(nameof(destination)); - } - - if (_connection == null) - { - // Response body fully consumed - return; - } - - if (_chunkBytesRemaining > 0) - { - await _connection.CopyChunkToAsync(destination, _chunkBytesRemaining, cancellationToken).ConfigureAwait(false); - await ConsumeChunkBytes(_chunkBytesRemaining, cancellationToken).ConfigureAwait(false); - } - - while (await TryGetNextChunk(cancellationToken).ConfigureAwait(false)) - { - await _connection.CopyChunkToAsync(destination, _chunkBytesRemaining, cancellationToken).ConfigureAwait(false); - await ConsumeChunkBytes(_chunkBytesRemaining, cancellationToken).ConfigureAwait(false); - } - } - } - - private sealed class ConnectionCloseReadStream : HttpContentReadStream - { - public ConnectionCloseReadStream(HttpConnection connection) - : base(connection) - { - } - - public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - if (buffer == null) - { - throw new ArgumentNullException(nameof(buffer)); - } - - if (offset < 0 || offset > buffer.Length) - { - throw new ArgumentOutOfRangeException(nameof(offset)); - } - - if (count < 0 || count > buffer.Length - offset) - { - throw new ArgumentOutOfRangeException(nameof(count)); - } - - if (_connection == null || count == 0) - { - // Response body fully consumed or the caller didn't ask for any data - return 0; - } - - int bytesRead = await _connection.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); - - if (bytesRead == 0) - { - // We cannot reuse this connection, so close it. - _connection.Dispose(); - _connection = null; - return 0; - } - - return bytesRead; - } - - public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) - { - if (destination == null) - { - throw new ArgumentNullException(nameof(destination)); - } - - if (_connection == null) - { - // Response body fully consumed - return; - } - - await _connection.CopyToAsync(destination, cancellationToken).ConfigureAwait(false); - - // We cannot reuse this connection, so close it. - _connection.Dispose(); - _connection = null; - } - } - - private sealed class ChunkedEncodingWriteStream : HttpContentWriteStream - { - public ChunkedEncodingWriteStream(HttpConnection connection) - : base (connection) - { - } - - public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - if (buffer == null) - { - throw new ArgumentNullException(nameof(buffer)); - } - - if (offset < 0 || offset > buffer.Length) - { - throw new ArgumentOutOfRangeException(nameof(offset)); - } - - if (count < 0 || count > buffer.Length - offset) - { - throw new ArgumentOutOfRangeException(nameof(count)); - } - - // Don't write if nothing was given - // Especially since we don't want to accidentally send a 0 chunk, which would indicate end of body - if (count == 0) - { - return; - } - - // Write chunk length -- hex representation of count - bool digitWritten = false; - for (int i = 7; i >= 0; i--) - { - int shift = i * 4; - int mask = 0xF << shift; - int digit = (count & mask) >> shift; - if (digitWritten || digit != 0) - { - await _connection.WriteByteAsync((byte)(digit < 10 ? '0' + digit : 'A' + digit - 10), cancellationToken).ConfigureAwait(false); - digitWritten = true; - } - } - - await _connection.WriteTwoBytesAsync((byte)'\r', (byte)'\n', cancellationToken).ConfigureAwait(false); - - // Write chunk contents - await _connection.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); - await _connection.WriteTwoBytesAsync((byte)'\r', (byte)'\n', cancellationToken).ConfigureAwait(false); - } - - public override Task FlushAsync(CancellationToken cancellationToken) - { - return _connection.FlushAsync(cancellationToken); - } - - public override async Task FinishAsync(CancellationToken cancellationToken) - { - // Send 0 byte chunk to indicate end - await _connection.WriteByteAsync((byte)'0', cancellationToken).ConfigureAwait(false); - await _connection.WriteTwoBytesAsync((byte)'\r', (byte)'\n', cancellationToken).ConfigureAwait(false); - - // Send final _CRLF - await _connection.WriteTwoBytesAsync((byte)'\r', (byte)'\n', cancellationToken).ConfigureAwait(false); - - _connection = null; - } - } - - public sealed class ContentLengthWriteStream : HttpContentWriteStream - { - public ContentLengthWriteStream(HttpConnection connection) - : base(connection) - { - } - - public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) - { - if (buffer == null) - { - throw new ArgumentNullException(nameof(buffer)); - } - - if (offset < 0 || offset > buffer.Length) - { - throw new ArgumentOutOfRangeException(nameof(offset)); - } - - if (count < 0 || count > buffer.Length - offset) - { - throw new ArgumentOutOfRangeException(nameof(count)); - } - - return _connection.WriteAsync(buffer, offset, count, cancellationToken); - } - - public override Task FlushAsync(CancellationToken cancellationToken) - { - return _connection.FlushAsync(cancellationToken); - } - - public override Task FinishAsync(CancellationToken cancellationToken) - { - _connection = null; - return Task.CompletedTask; - } - } + private bool _connectionClose; // Connection: close was seen on last response + private int _disposed; // 1 yes, 0 no public HttpConnection( HttpConnectionPool pool, @@ -556,38 +73,40 @@ namespace System.Net.Http _idnHostAsciiBytes = Encoding.ASCII.GetBytes(requestIdnHost); } - const int DefaultCapacity = 16; - _sb = new ValueStringBuilder(DefaultCapacity); + _writeBuffer = new byte[InitialWriteBufferSize]; + _readBuffer = new byte[InitialReadBufferSize]; - _writeBuffer = new byte[BufferSize]; - _writeOffset = 0; - - _readBuffer = new byte[BufferSize]; - _readLength = 0; - _readOffset = 0; - - _connectionClose = false; - _disposed = false; + if (NetEventSource.IsEnabled) + { + if (_stream is SslStream sslStream) + { + Trace( + $"Secure connection created to {key.Host}:{key.Port}. " + + $"SslProtocol:{sslStream.SslProtocol}, " + + $"CipherAlgorithm:{sslStream.CipherAlgorithm}, CipherStrength:{sslStream.CipherStrength}, " + + $"HashAlgorithm:{sslStream.HashAlgorithm}, HashStrength:{sslStream.HashStrength}, " + + $"KeyExchangeAlgorithm:{sslStream.KeyExchangeAlgorithm}, KeyExchangeStrength:{sslStream.KeyExchangeStrength}, " + + $"LocalCert:{sslStream.LocalCertificate}, RemoteCert:{sslStream.RemoteCertificate}"); + } + else + { + Trace($"Connection created to {key.Host}:{key.Port}."); + } + } } public void Dispose() { -#if DEBUG - GC.SuppressFinalize(this); -#endif - if (!_disposed) + // Ensure we're only disposed once. Dispose could be called concurrently, for example, + // if the request and the response were running concurrently and both incurred an exception. + if (Interlocked.Exchange(ref _disposed, 1) == 0) { - _disposed = true; + if (NetEventSource.IsEnabled) Trace("Connection closing."); _pool.DecrementConnectionCount(); _stream.Dispose(); } } -#if DEBUG - private readonly string _debugCreationStackTrace = Environment.StackTrace; - ~HttpConnection() => Environment.FailFast($"Dropped HttpConnection without disposing it, created at: {_debugCreationStackTrace}"); -#endif - public bool ReadAheadCompleted { get @@ -642,7 +161,7 @@ namespace System.Net.Http const int MaxFormattedInt32Length = 10; // number of digits in int.MaxValue.ToString() // If the maximum possible number of digits fits in our buffer, we can format synchronously - if (_writeOffset <= BufferSize - MaxFormattedInt32Length) + if (_writeOffset <= _writeBuffer.Length - MaxFormattedInt32Length) { if (value == 0) { @@ -665,38 +184,43 @@ namespace System.Net.Http return WriteAsciiStringAsync(value.ToString(CultureInfo.InvariantCulture), cancellationToken); } - public async Task SendAsync(HttpRequestMessage request, - CancellationToken cancellationToken) + public async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { + TaskCompletionSource allowExpect100ToContinue = null; + Debug.Assert(_currentRequest == null, $"Expected null {nameof(_currentRequest)}."); + _currentRequest = request; try { + bool isHttp10 = request.Version.Major == 1 && request.Version.Minor == 0; + // Send the request. - - if (request.Version.Major != 1 || request.Version.Minor != 1) - { - throw new PlatformNotSupportedException($"Only HTTP 1.1 supported -- request.Version was {request.Version}"); - } - - HttpContent requestContent = request.Content; + if (NetEventSource.IsEnabled) Trace($"Sending request: {request}"); // Add headers to define content transfer, if not present - if (requestContent != null && + if (request.Content != null && (!request.HasHeaders || request.Headers.TransferEncodingChunked != true) && - requestContent.Headers.ContentLength == null) + request.Content.Headers.ContentLength == null) { // We have content, but neither Transfer-Encoding or Content-Length is set. request.Headers.TransferEncodingChunked = true; } + if (isHttp10 && request.HasHeaders && request.Headers.TransferEncodingChunked == true) + { + // HTTP 1.0 does not support chunking + throw new NotSupportedException(SR.net_http_unsupported_chunking); + } + // Write request line await WriteStringAsync(request.Method.Method, cancellationToken).ConfigureAwait(false); await WriteByteAsync((byte)' ', cancellationToken).ConfigureAwait(false); - await WriteStringAsync( _usingProxy ? request.RequestUri.AbsoluteUri : request.RequestUri.PathAndQuery, cancellationToken).ConfigureAwait(false); - await WriteBytesAsync(s_spaceHttp11NewlineAsciiBytes, cancellationToken).ConfigureAwait(false); + // fall-back to 1.1 for all versions other than 1.0 + await WriteBytesAsync(isHttp10 ? s_spaceHttp10NewlineAsciiBytes : s_spaceHttp11NewlineAsciiBytes, + cancellationToken).ConfigureAwait(false); // Write request headers if (request.HasHeaders) @@ -704,12 +228,11 @@ namespace System.Net.Http await WriteHeadersAsync(request.Headers, cancellationToken).ConfigureAwait(false); } - if (requestContent == null) + if (request.Content == null) { - // Write out Content-Length: 0 header to indicate no body, + // Write out Content-Length: 0 header to indicate no body, // unless this is a method that never has a body. - if (request.Method != HttpMethod.Get && - request.Method != HttpMethod.Head) + if (request.Method != HttpMethod.Get && request.Method != HttpMethod.Head) { await WriteBytesAsync(s_contentLength0NewlineAsciiBytes, cancellationToken).ConfigureAwait(false); } @@ -717,7 +240,7 @@ namespace System.Net.Http else { // Write content headers - await WriteHeadersAsync(requestContent.Headers, cancellationToken).ConfigureAwait(false); + await WriteHeadersAsync(request.Content.Headers, cancellationToken).ConfigureAwait(false); } // Write special additional headers. If a host isn't in the headers list, then a Host header @@ -730,247 +253,430 @@ namespace System.Net.Http // CRLF for end of headers. await WriteTwoBytesAsync((byte)'\r', (byte)'\n', cancellationToken).ConfigureAwait(false); - // Write body, if any - if (requestContent != null) + Debug.Assert(_sendRequestContentTask == null); + if (request.Content == null) { - HttpContentWriteStream stream = (request.HasHeaders && request.Headers.TransferEncodingChunked == true ? - (HttpContentWriteStream)new ChunkedEncodingWriteStream(this) : - (HttpContentWriteStream)new ContentLengthWriteStream(this)); + // We have nothing more to send, so flush out any headers we haven't yet sent. + await FlushAsync(cancellationToken).ConfigureAwait(false); + } + else + { + // Asynchronously send the body if there is one. This can run concurrently with receiving + // the response. The write content streams will handle ensuring appropriate flushes are done + // to ensure the headers and content are sent. + bool transferEncodingChunked = request.HasHeaders && request.Headers.TransferEncodingChunked == true; + HttpContentWriteStream stream = transferEncodingChunked ? (HttpContentWriteStream) + new ChunkedEncodingWriteStream(this, cancellationToken) : + new ContentLengthWriteStream(this, cancellationToken); - // TODO #21452: CopyToAsync doesn't take a CancellationToken, how do we deal with Cancellation here? - // TODO #21452: We need to enable duplex communication, which means not waiting here until all data is sent. - await request.Content.CopyToAsync(stream, _transportContext).ConfigureAwait(false); - await stream.FinishAsync(cancellationToken).ConfigureAwait(false); + if (!request.HasHeaders || request.Headers.ExpectContinue != true) + { + // Start the copy from the request. We do this here in case it synchronously throws + // an exception, e.g. StreamContent throwing for non-rewindable content, and because if + // we did it in SendRequestContentAsync, that exception would get trapped in the returned + // task... at that point, we might get stuck waiting to receive a response from the server + // that'll never come, as the server is still expecting us to send data. + _sendRequestContentTask = SendRequestContentAsync(request.Content.CopyToAsync(stream, _transportContext), stream); + } + else + { + // We're sending an Expect: 100-continue header. We need to flush headers so that the server receives + // all of them, and we need to do so before initiating the send, as once we do that, it effectively + // owns the right to write, and we don't want to concurrently be accessing the write buffer. + await FlushAsync(cancellationToken).ConfigureAwait(false); + + // Create a TCS we'll use to block the request content from being sent, and create a timer that's used + // as a fail-safe to unblock the request content if we don't hear back from the server in a timely manner. + // Then kick off the request. + allowExpect100ToContinue = new TaskCompletionSource(); + var expect100Timer = new Timer( + s => ((TaskCompletionSource)s).TrySetResult(Expect100ContinueSignal.Timeout), + allowExpect100ToContinue, TimeSpan.FromMilliseconds(Expect100TimeoutMilliseconds), Timeout.InfiniteTimeSpan); + _sendRequestContentTask = SendRequestContentWithExpect100ContinueAsync(request, allowExpect100ToContinue.Task, stream, expect100Timer); + } } - await FlushAsync(cancellationToken).ConfigureAwait(false); - - // Parse the response. - - var response = new HttpResponseMessage() { RequestMessage = request }; - - if (await ReadCharAsync(cancellationToken).ConfigureAwait(false) != 'H' || - await ReadCharAsync(cancellationToken).ConfigureAwait(false) != 'T' || - await ReadCharAsync(cancellationToken).ConfigureAwait(false) != 'T' || - await ReadCharAsync(cancellationToken).ConfigureAwait(false) != 'P' || - await ReadCharAsync(cancellationToken).ConfigureAwait(false) != '/') + // Parse the response status line. + var response = new HttpResponseMessage() { RequestMessage = request, Content = new HttpConnectionContent(CancellationToken.None) }; + ParseStatusLine(await ReadNextLineAsync(cancellationToken).ConfigureAwait(false), response); + + if (allowExpect100ToContinue != null) { - throw new HttpRequestException("could not read response HTTP version"); + // We sent an Expect: 100-continue header. Handle the response accordingly. + if (response.StatusCode == HttpStatusCode.Continue) + { + // We got our continue header. Read the subsequent \r\n, and allow the request content to continue. + if (!LineIsEmpty(await ReadNextLineAsync(cancellationToken).ConfigureAwait(false))) + { + ThrowInvalidHttpResponse(); + } + allowExpect100ToContinue.TrySetResult(Expect100ContinueSignal.Received100StatusCode); + + // Then redo the status line read in order to read the real one. + ParseStatusLine(await ReadNextLineAsync(cancellationToken).ConfigureAwait(false), response); + } + else + { + // For any response status code other than 100, we want to try to avoid sending the content + // but otherwise just continue handling this request as we would any other. + allowExpect100ToContinue.TrySetResult(Expect100ContinueSignal.ReceivedOtherStatusCode); + } } - // Set the response HttpVersion. - char majorVersion = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - if (!char.IsDigit(majorVersion) || - await ReadCharAsync(cancellationToken).ConfigureAwait(false) != '.') - { - throw new HttpRequestException("could not read response HTTP version"); - } - char minorVersion = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - if (!char.IsDigit(minorVersion)) - { - throw new HttpRequestException("could not read response HTTP version"); - } - response.Version = - (majorVersion == '1' && minorVersion == '1') ? HttpVersionInternal.Version11 : - (majorVersion == '1' && minorVersion == '0') ? HttpVersionInternal.Version10 : - (majorVersion == '2' && minorVersion == '0') ? HttpVersionInternal.Version20 : - HttpVersionInternal.Unknown; - - if (await ReadCharAsync(cancellationToken).ConfigureAwait(false) != ' ') - { - throw new HttpRequestException("Invalid characters in response"); - } - - char status1 = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - char status2 = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - char status3 = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - - if (!char.IsDigit(status1) || - !char.IsDigit(status2) || - !char.IsDigit(status3)) - { - throw new HttpRequestException("could not read response status code"); - } - - int status = 100 * (status1 - '0') + 10 * (status2 - '0') + (status3 - '0'); - response.StatusCode = (HttpStatusCode)status; - - // Parse (optional) reason phrase - _sb.Clear(); - char c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - if (c == ' ') - { - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - } - else if (c != '\r') - { - throw new HttpRequestException("Invalid characters in response line"); - } - - while (c != '\r') - { - _sb.Append(c); - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - } - - if (await ReadCharAsync(cancellationToken).ConfigureAwait(false) != '\n') - { - throw new HttpRequestException("Saw CR without LF while parsing response line"); - } - - string knownReasonPhrase = HttpStatusDescription.Get(response.StatusCode); - response.ReasonPhrase = knownReasonPhrase != null && CharArrayHelpers.EqualsOrdinal(knownReasonPhrase, _sb.Chars, 0, _sb.Length) ? - knownReasonPhrase : - _sb.ToString(); - - var responseContent = new HttpConnectionContent(CancellationToken.None); - - // Parse headers - _sb.Clear(); - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); + // Parse the response headers. while (true) { - if (c == '\r') + ArraySegment line = await ReadNextLineAsync(cancellationToken).ConfigureAwait(false); + if (LineIsEmpty(line)) { - if (await ReadCharAsync(cancellationToken).ConfigureAwait(false) != '\n') - { - throw new HttpRequestException("Saw CR without LF while parsing headers"); - } - break; } - - // Get header name - while (c != ':') - { - _sb.Append(c); - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - } - - string headerName; - if (!HttpKnownHeaderNames.TryGetHeaderName(_sb.Chars, 0, _sb.Length, out headerName)) - { - headerName = _sb.ToString(); - } - - _sb.Clear(); - - // Get header value - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - while (c == ' ') - { - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - } - - while (c != '\r') - { - _sb.Append(c); - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); - } - - if (await ReadCharAsync(cancellationToken).ConfigureAwait(false) != '\n') - { - throw new HttpRequestException("Saw CR without LF while parsing headers"); - } - - string headerValue = HttpKnownHeaderNames.GetHeaderValue(headerName, _sb.Chars, 0, _sb.Length); - - // TryAddWithoutValidation will fail if the header name has trailing whitespace. - // So, trim it here. - // TODO #21452: Not clear to me from the RFC that this is really correct; RFC seems to indicate this should be an error. - // However, tests claim this is important for compat in practice. - headerName = headerName.TrimEnd(); - - // Add header to appropriate collection - if (!response.Headers.TryAddWithoutValidation(headerName, headerValue)) - { - // The existing handlers ignore headers that couldn't be added. Do the same here. - responseContent.Headers.TryAddWithoutValidation(headerName, headerValue); - } - - _sb.Clear(); - - c = await ReadCharAsync(cancellationToken).ConfigureAwait(false); + ParseHeaderNameValue(line, response); } - if (response.Headers.ConnectionClose ?? false) + // Determine whether we need to force close the connection when the request/response has completed. + if (response.Headers.ConnectionClose.GetValueOrDefault()) { _connectionClose = true; } - // Instantiate responseStream - HttpContentReadStream responseStream = - request.Method == HttpMethod.Head || status == 204 || status == 304 ? new ContentLengthReadStream(this, 0) : // no response body - responseContent.Headers.ContentLength != null ? new ContentLengthReadStream(this, responseContent.Headers.ContentLength.Value) : - response.Headers.TransferEncodingChunked == true ? new ChunkedEncodingReadStream(this) : - (HttpContentReadStream)new ConnectionCloseReadStream(this); + // Before creating the response stream, check to see if we're done sending any content, + // and propagate any exceptions that may have occurred. The most common case is that + // the server won't send back response content until it's received the whole request, + // so the majority of the time this task will be complete. + Task sendRequestContentTask = _sendRequestContentTask; + if (sendRequestContentTask != null && sendRequestContentTask.IsCompleted) + { + sendRequestContentTask.GetAwaiter().GetResult(); + _sendRequestContentTask = null; + } - // TODO #21452: When there's no response body, why is there any content here at all? - // i.e. why not just set response.Content = null? This is legal for request bodies (e.g. GET). - // However, setting response.Content = null causes a bunch of tests to fail. + // Create the response stream. + HttpContentReadStream responseStream; + if (request.Method == HttpMethod.Head || (int)response.StatusCode == 204 || (int)response.StatusCode == 304) + { + responseStream = EmptyReadStream.Instance; + ReturnConnectionToPool(); + } + else if (response.Content.Headers.ContentLength != null) + { + long contentLength = response.Content.Headers.ContentLength.GetValueOrDefault(); + if (contentLength <= 0) + { + responseStream = EmptyReadStream.Instance; + ReturnConnectionToPool(); + } + else + { + responseStream = new ContentLengthReadStream(this, (ulong)contentLength); + } + } + else if (response.Headers.TransferEncodingChunked == true) + { + responseStream = new ChunkedEncodingReadStream(this); + } + else + { + responseStream = new ConnectionCloseReadStream(this); + } + ((HttpConnectionContent)response.Content).SetStream(responseStream); - responseContent.SetStream(responseStream); - response.Content = responseContent; + if (NetEventSource.IsEnabled) Trace($"Received response: {response}"); return response; } - catch (Exception inner) + catch (Exception error) { + // Make sure to complete the allowExpect100ToContinue task if it exists. + allowExpect100ToContinue?.TrySetResult(Expect100ContinueSignal.Error); + + if (NetEventSource.IsEnabled) Trace($"Error sending request: {error}"); Dispose(); - if (inner is InvalidOperationException || inner is IOException) + if (_pendingException != null) { - throw new HttpRequestException(SR.net_http_client_execution_error, inner); + // If we incurred an exception in non-linear control flow such that + // the exception didn't bubble up here (e.g. concurrent sending of + // the request content), use that error instead. + throw new HttpRequestException(SR.net_http_client_execution_error, _pendingException); + } + + // Otherwise, propagate this exception, wrapping it if necessary to + // match exception type expectations. + if (error is InvalidOperationException || error is IOException) + { + throw new HttpRequestException(SR.net_http_client_execution_error, error); } throw; } } - private void WriteToBuffer(byte[] buffer, int offset, int count) + private static bool LineIsEmpty(ArraySegment line) { - Debug.Assert(count <= BufferSize - _writeOffset); - - Buffer.BlockCopy(buffer, offset, _writeBuffer, _writeOffset, count); - _writeOffset += count; + Debug.Assert(line.Count >= 2, "Lines should always be \r\n terminated."); + return line.Count == 2; } - private async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + private async Task SendRequestContentAsync(Task copyTask, HttpContentWriteStream stream) { - int remaining = BufferSize - _writeOffset; + try + { + // Wait for all of the data to be copied to the server. + await copyTask.ConfigureAwait(false); - if (count <= remaining) + // Finish the content; with a chunked upload, this includes writing the terminating chunk. + await stream.FinishAsync().ConfigureAwait(false); + + // Flush any content that might still be buffered. + await FlushAsync(stream.RequestCancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + _pendingException = e; + if (NetEventSource.IsEnabled) Trace($"Error while sending request content: {e}"); + Dispose(); + throw; + } + } + + private async Task SendRequestContentWithExpect100ContinueAsync( + HttpRequestMessage request, Task allowExpect100ToContinueTask, HttpContentWriteStream stream, Timer expect100Timer) + { + // Wait until we receive a trigger notification that it's ok to continue sending content. + // This will come either when the timer fires or when we receive a response status line from the server. + Expect100ContinueSignal signal = await allowExpect100ToContinueTask.ConfigureAwait(false); + if (NetEventSource.IsEnabled) Trace($"Received signal \"{signal}\" for Expect: 100-continue request content transfer."); + + // Clean up the timer; it's no longer needed. + expect100Timer.Dispose(); + + // If we received a 100 Continue status code or if we timeout waiting for one, send the request content. Otherwise, nothing more to do. + switch (signal) + { + case Expect100ContinueSignal.Received100StatusCode: + case Expect100ContinueSignal.Timeout: + await SendRequestContentAsync(request.Content.CopyToAsync(stream, _transportContext), stream).ConfigureAwait(false); + break; + } + } + + // TODO: Remove this overload once https://github.com/dotnet/roslyn/issues/17287 is addressed + // and the compiler doesn't lift the span temporary from the call site into the async state + // machine in debug builds. + private void ParseStatusLine(ArraySegment line, HttpResponseMessage response) => + ParseStatusLine((Span)line, response); + + private void ParseStatusLine(Span line, HttpResponseMessage response) + { + if (line.Length < 14 || // "HTTP/1.1 123\r\n" with optional phrase before the crlf + line[0] != 'H' || + line[1] != 'T' || + line[2] != 'T' || + line[3] != 'P' || + line[4] != '/' || + line[8] != ' ') + { + ThrowInvalidHttpResponse(); + } + + // Set the response HttpVersion and status code + byte majorVersion = line[5], minorVersion = line[7]; + byte status1 = line[9], status2 = line[10], status3 = line[11]; + if (!IsDigit(majorVersion) || line[6] != (byte)'.' || !IsDigit(minorVersion) || + !IsDigit(status1) || !IsDigit(status2) || !IsDigit(status3)) + { + ThrowInvalidHttpResponse(); + } + response.Version = + (majorVersion == '1' && minorVersion == '1') ? HttpVersionInternal.Version11 : + (majorVersion == '1' && minorVersion == '0') ? HttpVersionInternal.Version10 : + (majorVersion == '2' && minorVersion == '0') ? HttpVersionInternal.Version20 : + HttpVersionInternal.Unknown; + response.StatusCode = + (HttpStatusCode)(100 * (status1 - '0') + 10 * (status2 - '0') + (status3 - '0')); + + // Parse (optional) reason phrase + byte c = line[12]; + if (c == '\r') + { + response.ReasonPhrase = string.Empty; + } + else if (c != ' ') + { + ThrowInvalidHttpResponse(); + } + else + { + Span reasonBytes = line.Slice(13, line.Length - 13 - 2); // 2 == \r\n ending trimmed off + string knownReasonPhrase = HttpStatusDescription.Get(response.StatusCode); + if (knownReasonPhrase != null && EqualsOrdinal(knownReasonPhrase, reasonBytes)) + { + response.ReasonPhrase = knownReasonPhrase; + } + else + { + unsafe + { + try + { + fixed (byte* reasonPtr = &reasonBytes.DangerousGetPinnableReference()) + { + response.ReasonPhrase = Encoding.ASCII.GetString(reasonPtr, reasonBytes.Length); + } + } + catch (FormatException e) + { + ThrowInvalidHttpResponse(e); + } + } + } + } + } + + // TODO: Remove this overload once https://github.com/dotnet/roslyn/issues/17287 is addressed + // and the compiler doesn't lift the span temporary from the call site into the async state + // machine in debug builds. + private void ParseHeaderNameValue(ArraySegment line, HttpResponseMessage response) => + ParseHeaderNameValue((Span)line, response); + + private void ParseHeaderNameValue(Span line, HttpResponseMessage response) + { + int pos = 0; + while (line[pos] != (byte)':' && line[pos] != (byte)' ') + { + pos++; + if (pos == line.Length) + { + // Ignore invalid header line that doesn't contain ':'. + return; + } + } + + if (pos == 0) + { + // Ignore invalid empty header name. + return; + } + + // CONSIDER: trailing whitespace? + + if (!HeaderDescriptor.TryGet(line.Slice(0, pos), out HeaderDescriptor descriptor)) + { + // Ignore invalid header name + return; + } + + // Eat any trailing whitespace + while (line[pos] == (byte)' ') + { + pos++; + if (pos == line.Length) + { + // Ignore invalid header line that doesn't contain ':'. + return; + } + } + + if (line[pos++] != ':') + { + // Ignore invalid header line that doesn't contain ':'. + return; + } + + // Skip whitespace after colon + while (pos < line.Length && (line[pos] == (byte)' ' || line[pos] == '\t')) + { + pos++; + } + + string headerValue = descriptor.GetHeaderValue(line.Slice(pos, line.Length - pos - 2)); // trim trailing \r\n + + // Note we ignore the return value from TryAddWithoutValidation; + // if the header can't be added, we silently drop it. + if (descriptor.HeaderType == HttpHeaderType.Content) + { + response.Content.Headers.TryAddWithoutValidation(descriptor, headerValue); + } + else + { + response.Headers.TryAddWithoutValidation(descriptor, headerValue); + } + } + + private static bool IsDigit(byte c) => (uint)(c - '0') <= '9' - '0'; + + private void WriteToBuffer(ReadOnlyMemory source) + { + Debug.Assert(source.Length <= _writeBuffer.Length - _writeOffset); + source.Span.CopyTo(new Span(_writeBuffer, _writeOffset, source.Length)); + _writeOffset += source.Length; + } + + private async Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + int remaining = _writeBuffer.Length - _writeOffset; + + if (source.Length <= remaining) { // Fits in current write buffer. Just copy and return. - WriteToBuffer(buffer, offset, count); + WriteToBuffer(source); return; } if (_writeOffset != 0) { // Fit what we can in the current write buffer and flush it. - WriteToBuffer(buffer, offset, remaining); + WriteToBuffer(source.Slice(0, remaining)); + source = source.Slice(remaining); await FlushAsync(cancellationToken).ConfigureAwait(false); - - // Update offset and count to reflect the write we just did. - offset += remaining; - count -= remaining; } - if (count >= BufferSize) + if (source.Length >= _writeBuffer.Length) { // Large write. No sense buffering this. Write directly to stream. // CONSIDER: May want to be a bit smarter here? Think about how large writes should work... - await _stream.WriteAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); + await WriteToStreamAsync(source, cancellationToken).ConfigureAwait(false); } else { // Copy remainder into buffer - WriteToBuffer(buffer, offset, count); + WriteToBuffer(source); } } + private Task WriteWithoutBufferingAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + if (_writeOffset == 0) + { + // There's nothing in the write buffer we need to flush. + // Just write the supplied data out to the stream. + return WriteToStreamAsync(source, cancellationToken); + } + + int remaining = _writeBuffer.Length - _writeOffset; + if (source.Length <= remaining) + { + // There's something already in the write buffer, but the content + // we're writing can also fit after it in the write buffer. Copy + // the content to the write buffer and then flush it, so that we + // can do a single send rather than two. + WriteToBuffer(source); + return FlushAsync(cancellationToken); + } + + // There's data in the write buffer and the data we're writing doesn't fit after it. + // Do two writes, one to flush the buffer and then another to write the supplied content. + return FlushThenWriteWithoutBufferingAsync(source, cancellationToken); + } + + private async Task FlushThenWriteWithoutBufferingAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + await FlushAsync(cancellationToken).ConfigureAwait(false); + await WriteToStreamAsync(source, cancellationToken).ConfigureAwait(false); + } + private Task WriteByteAsync(byte b, CancellationToken cancellationToken) { - if (_writeOffset < BufferSize) + if (_writeOffset < _writeBuffer.Length) { _writeBuffer[_writeOffset++] = b; return Task.CompletedTask; @@ -980,7 +686,8 @@ namespace System.Net.Http private async Task WriteByteSlowAsync(byte b, CancellationToken cancellationToken) { - await _stream.WriteAsync(_writeBuffer, 0, BufferSize, cancellationToken).ConfigureAwait(false); + Debug.Assert(_writeOffset == _writeBuffer.Length); + await WriteToStreamAsync(_writeBuffer, cancellationToken).ConfigureAwait(false); _writeBuffer[0] = b; _writeOffset = 1; @@ -988,7 +695,7 @@ namespace System.Net.Http private Task WriteTwoBytesAsync(byte b1, byte b2, CancellationToken cancellationToken) { - if (_writeOffset <= BufferSize - 2) + if (_writeOffset <= _writeBuffer.Length - 2) { byte[] buffer = _writeBuffer; buffer[_writeOffset++] = b1; @@ -1006,7 +713,7 @@ namespace System.Net.Http private Task WriteBytesAsync(byte[] bytes, CancellationToken cancellationToken) { - if (_writeOffset <= BufferSize - bytes.Length) + if (_writeOffset <= _writeBuffer.Length - bytes.Length) { Buffer.BlockCopy(bytes, 0, _writeBuffer, _writeOffset, bytes.Length); _writeOffset += bytes.Length; @@ -1021,20 +728,20 @@ namespace System.Net.Http while (true) { int remaining = bytes.Length - offset; - int toCopy = Math.Min(remaining, BufferSize - _writeOffset); + int toCopy = Math.Min(remaining, _writeBuffer.Length - _writeOffset); Buffer.BlockCopy(bytes, offset, _writeBuffer, _writeOffset, toCopy); _writeOffset += toCopy; offset += toCopy; Debug.Assert(offset <= bytes.Length, $"Expected {nameof(offset)} to be <= {bytes.Length}, got {offset}"); - Debug.Assert(_writeOffset <= BufferSize, $"Expected {nameof(_writeOffset)} to be <= {BufferSize}, got {_writeOffset}"); + Debug.Assert(_writeOffset <= _writeBuffer.Length, $"Expected {nameof(_writeOffset)} to be <= {_writeBuffer.Length}, got {_writeOffset}"); if (offset == bytes.Length) { break; } - else if (_writeOffset == BufferSize) + else if (_writeOffset == _writeBuffer.Length) { - await _stream.WriteAsync(_writeBuffer, 0, BufferSize, cancellationToken).ConfigureAwait(false); + await WriteToStreamAsync(_writeBuffer, cancellationToken).ConfigureAwait(false); _writeOffset = 0; } } @@ -1045,14 +752,14 @@ namespace System.Net.Http // If there's enough space in the buffer to just copy all of the string's bytes, do so. // Unlike WriteAsciiStringAsync, validate each char along the way. int offset = _writeOffset; - if (s.Length <= BufferSize - offset) + if (s.Length <= _writeBuffer.Length - offset) { byte[] writeBuffer = _writeBuffer; foreach (char c in s) { if ((c & 0xFF80) != 0) { - throw new HttpRequestException("Non-ASCII characters found"); + throw new HttpRequestException(SR.net_http_request_invalid_char_encoding); } writeBuffer[offset++] = (byte)c; } @@ -1069,7 +776,7 @@ namespace System.Net.Http { // If there's enough space in the buffer to just copy all of the string's bytes, do so. int offset = _writeOffset; - if (s.Length <= BufferSize - offset) + if (s.Length <= _writeBuffer.Length - offset) { byte[] writeBuffer = _writeBuffer; foreach (char c in s) @@ -1092,7 +799,7 @@ namespace System.Net.Http char c = s[i]; if ((c & 0xFF80) != 0) { - throw new HttpRequestException("Non-ASCII characters found"); + throw new HttpRequestException(SR.net_http_request_invalid_char_encoding); } await WriteByteAsync((byte)c, cancellationToken).ConfigureAwait(false); } @@ -1102,117 +809,142 @@ namespace System.Net.Http { if (_writeOffset > 0) { - Task t = _stream.WriteAsync(_writeBuffer, 0, _writeOffset, cancellationToken); + Task t = WriteToStreamAsync(new ReadOnlyMemory(_writeBuffer, 0, _writeOffset), cancellationToken); _writeOffset = 0; return t; } return Task.CompletedTask; } - private Task FillAsync(CancellationToken cancellationToken) + private Task WriteToStreamAsync(ReadOnlyMemory source, CancellationToken cancellationToken) { - Debug.Assert(_readOffset == _readLength); - - _readOffset = 0; - Task t; - if (_readAheadTask != null) - { - // When the connection is put back into the pool, a pre-emptive read is performed - // into the read buffer. That read should not complete prior to us using the - // connection again, as that would mean the connection was either closed or had - // erroneous data sent on it by the server in response to no request from us. - // We need to consume that read prior to issuing another read request. - t = _readAheadTask; - _readAheadTask = null; - } - else - { - t = _stream.ReadAsync(_readBuffer, 0, BufferSize, cancellationToken); - } - - if (t.IsCompleted) - { - _readLength = t.GetAwaiter().GetResult(); - return Task.CompletedTask; - } - else - { - // Using async/await results in slightly higher allocations for the case of a single await, - // and it's simple to transform this one into ContinueWith. - return t.ContinueWith((completed, state) => - ((HttpConnection)state)._readLength = completed.GetAwaiter().GetResult(), - this, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); - } + if (NetEventSource.IsEnabled) Trace($"Writing {source.Length} bytes."); + return _stream.WriteAsync(source, cancellationToken); } - private async ValueTask ReadByteSlowAsync(CancellationToken cancellationToken) + private async ValueTask> ReadNextLineAsync(CancellationToken cancellationToken) { - await FillAsync(cancellationToken).ConfigureAwait(false); - - if (_readLength == 0) + int searchOffset = 0; + while (true) { - // End of stream - throw new IOException("unexpected end of stream"); - } - - return _readBuffer[_readOffset++]; - } - - // TODO #21452: Revisit perf characteristics of this approach - private ValueTask ReadByteAsync(CancellationToken cancellationToken) - { - if (_readOffset < _readLength) - { - return new ValueTask(_readBuffer[_readOffset++]); - } - - return ReadByteSlowAsync(cancellationToken); - } - - private async ValueTask ReadCharSlowAsync(CancellationToken cancellationToken) - { - await FillAsync(cancellationToken).ConfigureAwait(false); - - if (_readLength == 0) - { - // End of stream - throw new IOException("unexpected end of stream"); - } - - byte b = _readBuffer[_readOffset++]; - if ((b & 0x80) != 0) - { - throw new HttpRequestException("Invalid character read from stream"); - } - - return (char)b; - } - - private ValueTask ReadCharAsync(CancellationToken cancellationToken) - { - if (_readOffset < _readLength) - { - byte b = _readBuffer[_readOffset++]; - if ((b & 0x80) != 0) + int startIndex = _readOffset + searchOffset; + int length = _readLength - startIndex; + int crPos = Array.IndexOf(_readBuffer, (byte)'\r', startIndex, length); + if (crPos < 0) { - return new ValueTask(Task.FromException(new HttpRequestException("Invalid character read from stream"))); + // Couldn't find a \r. Read more. + searchOffset = length; + await FillAsync(cancellationToken).ConfigureAwait(false); } + else if (crPos + 1 >= _readLength) + { + // We found a \r, but we don't have enough data buffered to read the \n. + searchOffset = length - 1; + await FillAsync(cancellationToken).ConfigureAwait(false); + } + else if (_readBuffer[crPos + 1] == '\n') + { + // We found a \r\n. Return the data up to and including it. + int lineLength = crPos - _readOffset + 2; + var result = new ArraySegment(_readBuffer, _readOffset, lineLength); + _readOffset += lineLength; + return result; + } + else + { + ThrowInvalidHttpResponse(); + } + } + } - return new ValueTask((char)b); + private async Task ReadCrLfAsync(CancellationToken cancellationToken) + { + while (_readLength - _readOffset < 2) + { + // We have fewer than 2 chars buffered. Get more. + await FillAsync(cancellationToken).ConfigureAwait(false); } - return ReadCharSlowAsync(cancellationToken); + // We expect \r\n. If so, consume them. If not, it's an error. + if (_readBuffer[_readOffset] != '\r' || _readBuffer[_readOffset + 1] != '\n') + { + ThrowInvalidHttpResponse(); + } + + _readOffset += 2; } - private void ReadFromBuffer(byte[] buffer, int offset, int count) + // Throws IOException on EOF. This is only called when we expect more data. + private async Task FillAsync(CancellationToken cancellationToken) { - Debug.Assert(count <= _readLength - _readOffset); + int remaining = _readLength - _readOffset; + Debug.Assert(remaining >= 0); - Buffer.BlockCopy(_readBuffer, _readOffset, buffer, offset, count); - _readOffset += count; + if (remaining == 0) + { + // No data in the buffer. Simply reset the offset and length to 0 to allow + // the whole buffer to be filled. + _readOffset = _readLength = 0; + } + else if (_readOffset > 0) + { + // There's some data in the buffer but it's not at the beginning. Shift it + // down to make room for more. + Buffer.BlockCopy(_readBuffer, _readOffset, _readBuffer, 0, remaining); + _readOffset = 0; + _readLength = remaining; + } + else if (remaining == _readBuffer.Length) + { + // The whole buffer is full, but the caller is still requesting more data, + // so increase the size of the buffer. + Debug.Assert(_readOffset == 0); + Debug.Assert(_readLength == _readBuffer.Length); + + byte[] newReadBuffer = new byte[_readBuffer.Length * 2]; + Buffer.BlockCopy(_readBuffer, 0, newReadBuffer, 0, remaining); + _readBuffer = newReadBuffer; + _readOffset = 0; + _readLength = remaining; + } + + // When the connection was put back into the pool, a pre-emptive read was performed + // into the read buffer. That read should not complete prior to us using the + // connection again, as that would mean the connection was either closed or had + // erroneous data sent on it by the server in response to no request from us. + // We need to consume that read prior to issuing another read request. + Task t = _readAheadTask; + int bytesRead; + if (t != null) + { + Debug.Assert(_readOffset == 0); + Debug.Assert(_readLength == 0); + _readAheadTask = null; + bytesRead = await t.ConfigureAwait(false); + } + else + { + ValueTask vt = _stream.ReadAsync(new Memory(_readBuffer, _readLength, _readBuffer.Length - _readLength), cancellationToken); + bytesRead = vt.IsCompletedSuccessfully ? vt.Result : await vt.AsTask().ConfigureAwait(false); + } + + if (NetEventSource.IsEnabled) Trace($"Received {bytesRead} bytes."); + if (bytesRead == 0) + { + throw new IOException(SR.net_http_invalid_response); + } + _readLength += bytesRead; } - private async ValueTask ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + private void ReadFromBuffer(Span buffer) + { + Debug.Assert(buffer.Length <= _readLength - _readOffset); + + new Span(_readBuffer, _readOffset, buffer.Length).CopyTo(buffer); + _readOffset += buffer.Length; + } + + private async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken) { // This is called when reading the response body @@ -1220,27 +952,23 @@ namespace System.Net.Http if (remaining > 0) { // We have data in the read buffer. Return it to the caller. - count = Math.Min(count, remaining); - ReadFromBuffer(buffer, offset, count); - return count; + if (destination.Length <= remaining) + { + ReadFromBuffer(destination.Span); + return destination.Length; + } + else + { + ReadFromBuffer(destination.Span.Slice(0, remaining)); + return remaining; + } } // No data in read buffer. - if (count < BufferSize / 2) - { - // Caller requested a small read size (less than half the read buffer size). - // Read into the buffer, so that we read as much as possible, hopefully. - await FillAsync(cancellationToken).ConfigureAwait(false); - - count = Math.Min(count, _readLength); - ReadFromBuffer(buffer, offset, count); - return count; - } - - // Large read size, and no buffered data. // Do an unbuffered read directly against the underlying stream. Debug.Assert(_readAheadTask == null, "Read ahead task should have been consumed as part of the headers."); - count = await _stream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); + int count = await _stream.ReadAsync(destination, cancellationToken).ConfigureAwait(false); + if (NetEventSource.IsEnabled) Trace($"Received {count} bytes."); return count; } @@ -1248,6 +976,7 @@ namespace System.Net.Http { Debug.Assert(count <= _readLength - _readOffset); + if (NetEventSource.IsEnabled) Trace($"Copying {count} bytes to stream."); await destination.WriteAsync(_readBuffer, _readOffset, count, cancellationToken).ConfigureAwait(false); _readOffset += count; } @@ -1264,7 +993,11 @@ namespace System.Net.Http while (true) { - await FillAsync(cancellationToken).ConfigureAwait(false); + _readOffset = 0; + + // Don't use FillAsync here as it will throw on EOF. + Debug.Assert(_readAheadTask == null); + _readLength = await _stream.ReadAsync(_readBuffer, cancellationToken).ConfigureAwait(false); if (_readLength == 0) { // End of stream @@ -1276,7 +1009,7 @@ namespace System.Net.Http } // Copy *exactly* [length] bytes into destination; throws on end of stream. - private async Task CopyChunkToAsync(Stream destination, long length, CancellationToken cancellationToken) + private async Task CopyToAsync(Stream destination, ulong length, CancellationToken cancellationToken) { Debug.Assert(destination != null); Debug.Assert(length > 0); @@ -1284,10 +1017,13 @@ namespace System.Net.Http int remaining = _readLength - _readOffset; if (remaining > 0) { - remaining = (int)Math.Min(remaining, length); + if ((ulong)remaining > length) + { + remaining = (int)length; + } await CopyFromBufferAsync(destination, remaining, cancellationToken).ConfigureAwait(false); - length -= remaining; + length -= (ulong)remaining; if (length == 0) { return; @@ -1297,15 +1033,11 @@ namespace System.Net.Http while (true) { await FillAsync(cancellationToken).ConfigureAwait(false); - if (_readLength == 0) - { - throw new HttpRequestException("unexpected end of stream"); - } - remaining = (int)Math.Min(_readLength, length); + remaining = (ulong)_readLength < length ? _readLength : (int)length; await CopyFromBufferAsync(destination, remaining, cancellationToken).ConfigureAwait(false); - length -= remaining; + length -= (ulong)remaining; if (length == 0) { return; @@ -1317,12 +1049,69 @@ namespace System.Net.Http { Debug.Assert(_writeOffset == 0, "Everything in write buffer should have been flushed."); Debug.Assert(_readAheadTask == null, "Expected a previous initial read to already be consumed."); + Debug.Assert(_currentRequest != null, "Expected the connection to be associated with a request."); + + // Disassociate the connection from a request. If there's an in-flight request content still + // being sent, it'll see this nulled out and stop sending. Also clear out other request-specific content. + _currentRequest = null; + _pendingException = null; + + // Check to see if we're still sending request content. + Task sendRequestContentTask = _sendRequestContentTask; + if (sendRequestContentTask != null) + { + if (!sendRequestContentTask.IsCompleted) + { + // We're still transferring request content. Only put the connection back into the + // pool when we're done transferring. + if (NetEventSource.IsEnabled) Trace("Still transferring request content. Delaying returning connection to pool."); + sendRequestContentTask.ContinueWith((_, state) => + { + var innerConnection = (HttpConnection)state; + if (NetEventSource.IsEnabled) innerConnection.Trace("Request content send completed."); + innerConnection.ReturnConnectionToPoolCore(); + }, this, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Default); + return; + } + + // We're done transferring request content. Check whether we incurred an exception, + // and if we did, propagate it to our caller. + if (!sendRequestContentTask.IsCompletedSuccessfully) + { + sendRequestContentTask.GetAwaiter().GetResult(); + } + } + + ReturnConnectionToPoolCore(); + } + + private void ReturnConnectionToPoolCore() + { + Debug.Assert(_sendRequestContentTask == null || _sendRequestContentTask.IsCompleted); + + if (NetEventSource.IsEnabled) + { + if (_connectionClose) + { + Trace("Server requested connection be closed."); + } + if (_sendRequestContentTask != null && _sendRequestContentTask.IsFaulted) + { + Trace($"Sending request content incurred an exception: {_sendRequestContentTask.Exception.InnerException}"); + } + } // If server told us it's closing the connection, don't put this back in the pool. - if (!_connectionClose) + // And if we incurred an error while transferring request content, also skip the pool. + if (!_connectionClose && + (_sendRequestContentTask == null || _sendRequestContentTask.IsCompletedSuccessfully)) { try { + // Null out the associated request before the connection is potentially reused by another. + _currentRequest = null; + _sendRequestContentTask = null; + // When putting a connection back into the pool, we initiate a pre-emptive // read on the stream. When the connection is subsequently taken out of the // pool, this can be used in place of the first read on the stream that would @@ -1346,31 +1135,50 @@ namespace System.Net.Http Dispose(); } - private struct ValueStringBuilder + private static bool EqualsOrdinal(string left, Span right) { - public char[] Chars; - public int Length; + Debug.Assert(left != null, "Expected non-null string"); - public ValueStringBuilder(int initialCapacity) + if (left.Length != right.Length) { - Chars = new char[initialCapacity]; - Length = 0; + return false; } - public void Append(char c) + for (int i = 0; i < left.Length; i++) { - if (Length == Chars.Length) + if (left[i] != right[i]) { - Grow(); + return false; } - Chars[Length++] = c; } - private void Grow() => Array.Resize(ref Chars, Chars.Length * 2); + return true; + } - public void Clear() => Length = 0; + public override string ToString() => $"{nameof(HttpConnection)}(Host:{_key.Host})"; // Description for diagnostic purposes - public override string ToString() => new string(Chars, 0, Length); + private static void ThrowInvalidHttpResponse() => throw new HttpRequestException(SR.net_http_invalid_response); + + private static void ThrowInvalidHttpResponse(Exception innerException) => throw new HttpRequestException(SR.net_http_invalid_response, innerException); + + internal void Trace(string message, [CallerMemberName] string memberName = null) => + NetEventSource.Log.HandlerMessage( + _pool?.GetHashCode() ?? 0, // pool ID + GetHashCode(), // connection ID + _currentRequest?.GetHashCode() ?? 0, // request ID + memberName, // method name + ToString() + ": " + message); // message + + private enum Expect100ContinueSignal : byte + { + /// Signal to the request content that a 100 Continue status was received from the server. + Received100StatusCode, + /// Signal to the request content that it should send anyway due to not hearing back from the server within the timeout period. + Timeout, + /// Signal to the request content that a non-100 status was received from the server. + ReceivedOtherStatusCode, + /// Signal to the request content that an arbitrary failure occurred during request/response processing. + Error } } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionContent.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionContent.cs new file mode 100644 index 0000000000..6ce4fea1cf --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionContent.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class HttpConnectionContent : HttpContent + { + private readonly CancellationToken _cancellationToken; + private HttpContentReadStream _stream; + + public HttpConnectionContent(CancellationToken cancellationToken) + { + _cancellationToken = cancellationToken; + } + + public void SetStream(HttpContentReadStream stream) + { + Debug.Assert(stream != null); + Debug.Assert(stream.CanRead); + + _stream = stream; + } + + private HttpContentReadStream ConsumeStream() + { + if (_stream == null) + { + throw new InvalidOperationException(SR.net_http_content_stream_already_read); + } + + HttpContentReadStream stream = _stream; + _stream = null; + return stream; + } + + protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context) + { + Debug.Assert(stream != null); + + using (HttpContentReadStream contentStream = ConsumeStream()) + { + const int BufferSize = 8192; + await contentStream.CopyToAsync(stream, BufferSize, _cancellationToken).ConfigureAwait(false); + } + } + + protected internal override bool TryComputeLength(out long length) + { + length = 0; + return false; + } + + protected override Task CreateContentReadStreamAsync() => + Task.FromResult(ConsumeStream()); + + internal override Stream TryCreateContentReadStream() => + ConsumeStream(); + + protected override void Dispose(bool disposing) + { + if (disposing) + { + if (_stream != null) + { + _stream.Dispose(); + _stream = null; + } + } + + base.Dispose(disposing); + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionHandler.cs index f61d25a1fc..67d901083b 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionHandler.cs @@ -50,7 +50,14 @@ namespace System.Net.Http { callback = (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => { - return _settings._serverCertificateCustomValidationCallback(request, certificate as X509Certificate2, chain, sslPolicyErrors); + try + { + return _settings._serverCertificateCustomValidationCallback(request, certificate as X509Certificate2, chain, sslPolicyErrors); + } + catch (Exception e) + { + throw new HttpRequestException(SR.net_http_ssl_connection_failed, e); + } }; } @@ -58,7 +65,7 @@ namespace System.Net.Http try { - // TODO #21452: No cancellationToken? + // TODO https://github.com/dotnet/corefx/issues/23077#issuecomment-321807131: No cancellationToken? await sslStream.AuthenticateAsClientAsync(host, _settings._clientCertificates, _settings._sslProtocols, _settings._checkCertificateRevocationList).ConfigureAwait(false); } catch (Exception e) @@ -66,8 +73,7 @@ namespace System.Net.Http sslStream.Dispose(); if (e is AuthenticationException || e is IOException) { - // TODO #21452: Tests expect HttpRequestException here. Is that correct behavior? - throw new HttpRequestException("could not establish SSL connection", e); + throw new HttpRequestException(SR.net_http_ssl_connection_failed, e); } throw; } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionKey.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionKey.cs index 1f2fc57363..d4e4185551 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionKey.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionKey.cs @@ -15,7 +15,7 @@ namespace System.Net.Http UsingSSL = uri.Scheme == UriScheme.Http ? false : uri.Scheme == UriScheme.Https ? true : - throw new ArgumentException("Invalid Uri scheme", nameof(uri)); + throw new ArgumentException(SR.net_http_client_http_baseaddress_required, nameof(uri)); Host = uri.Host; Port = uri.Port; diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPool.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPool.cs index dc9cb80622..c2529d2f61 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPool.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPool.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -54,17 +55,21 @@ namespace System.Net.Http while (list.Count > 0) { CachedConnection cachedConnection = list[list.Count - 1]; + HttpConnection conn = cachedConnection._connection; + list.RemoveAt(list.Count - 1); if (cachedConnection.IsUsable()) { // We found a valid collection. Return it. - return new ValueTask(cachedConnection._connection); + if (NetEventSource.IsEnabled) conn.Trace("Found usable connection in pool."); + return new ValueTask(conn); } // We got a connection, but it was already closed by the server or the // server sent unexpected data or the connection is too old. In any case, // we can't use the connection, so get rid of it and try again. - cachedConnection._connection.Dispose(); + if (NetEventSource.IsEnabled) conn.Trace("Found invalid connection in pool."); + conn.Dispose(); } // No valid cached connections, so we need to create a new one. If @@ -73,6 +78,7 @@ namespace System.Net.Http // connection. if (_waiters == null || _associatedConnectionCount < _maxConnections) { + if (NetEventSource.IsEnabled) Trace("Creating new connection for pool."); IncrementConnectionCountNoLock(); return WaitForCreatedConnectionAsync(createConnection(state)); } @@ -85,6 +91,7 @@ namespace System.Net.Http // be signaled with the created connection when one is returned or // space is available and the provided creation func has successfully // created the connection to be used. + if (NetEventSource.IsEnabled) Trace("Limit reached. Waiting to create new connection."); var waiter = new ConnectionWaiter(this, createConnection, state); _waiters.Enqueue(waiter); return new ValueTask(waiter.Task); @@ -128,6 +135,7 @@ namespace System.Net.Http { Debug.Assert(Monitor.IsEntered(SyncObj), $"Expected to be holding {nameof(SyncObj)}"); + if (NetEventSource.IsEnabled) Trace(null); _usedSinceLastCleanup = true; Debug.Assert( @@ -143,6 +151,7 @@ namespace System.Net.Http /// public void DecrementConnectionCount() { + if (NetEventSource.IsEnabled) Trace(null); lock (SyncObj) { Debug.Assert(_associatedConnectionCount > 0 && _associatedConnectionCount <= _maxConnections, @@ -224,6 +233,7 @@ namespace System.Net.Http // transfer this one to them rather than pooling it. if (_waiters != null && _waiters.TryDequeue(out ConnectionWaiter waiter)) { + if (NetEventSource.IsEnabled) connection.Trace("Transferring connection returned to pool."); waiter.SetResult(connection); return; } @@ -234,12 +244,14 @@ namespace System.Net.Http // the pool was disposed of. if (_disposed) { + if (NetEventSource.IsEnabled) connection.Trace("Disposing connection returned to disposed pool."); connection.Dispose(); return; } // Pool the connection by adding it to the list. list.Add(new CachedConnection(connection)); + if (NetEventSource.IsEnabled) connection.Trace("Stored connection in pool."); } } @@ -251,6 +263,7 @@ namespace System.Net.Http { if (!_disposed) { + if (NetEventSource.IsEnabled) Trace("Disposing pool."); _disposed = true; list.ForEach(c => c._connection.Dispose()); list.Clear(); @@ -273,6 +286,7 @@ namespace System.Net.Http bool tookLock = false; try { + if (NetEventSource.IsEnabled) Trace("Cleaning pool."); Monitor.Enter(SyncObj, ref tookLock); // Get the current time. This is compared against each connection's last returned @@ -351,6 +365,16 @@ namespace System.Net.Http return false; } + public override string ToString() => $"{nameof(HttpConnectionPool)}(Connections:{_associatedConnectionCount})"; // Description for diagnostic purposes + + private void Trace(string message, [CallerMemberName] string memberName = null) => + NetEventSource.Log.HandlerMessage( + GetHashCode(), // pool ID + 0, // connection ID + 0, // request ID + memberName, // method name + ToString() + ":" + message); // message + /// A cached idle connection and metadata about it. [StructLayout(LayoutKind.Auto)] private struct CachedConnection : IEquatable @@ -374,7 +398,7 @@ namespace System.Net.Http public bool IsUsable() => !_connection.ReadAheadCompleted; /// Gets whether the connection is currently usable, factoring in expiration time. - /// The current time. Passed in to ammortize the cost of calling DateTime.UtcNow. + /// The current time. Passed in to amortize the cost of calling DateTime.UtcNow. /// /// true if we believe the connection can be reused; otherwise, false. There is an inherent race condition here, /// in that the server could terminate the connection or otherwise make it unusable immediately after we check it, @@ -430,7 +454,7 @@ namespace System.Net.Http /// /// /// Implemented as a non-generic base type with a generic derived type to support - /// passing in arbitrary funcs and associated state while mininimizing allocations. + /// passing in arbitrary funcs and associated state while minimizing allocations. /// The method will be implemented on the derived /// type that is able to work with the supplied state generically. /// diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPools.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPools.cs index a22d96ea66..2650b7bab3 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPools.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpConnectionPools.cs @@ -21,9 +21,16 @@ namespace System.Net.Http /// The pools, indexed by endpoint. private readonly ConcurrentDictionary _pools; /// Timer used to initiate cleaning of the pools. - private readonly Timer _cleaningTimer; // TODO: Consider changing this to stop when _pools is empty. + private readonly Timer _cleaningTimer; /// The maximum number of connections allowed per pool. indicates unlimited. private readonly int _maxConnectionsPerServer; + /// + /// Keeps track of whether or not the cleanup timer is running. It helps us avoid the expensive + /// call. + /// + private bool _timerIsRunning; + /// Object used to synchronize access to state in the pool. + private object SyncObj => _pools; /// Initializes the pools. /// The maximum number of connections allowed per pool. indicates unlimited. @@ -31,14 +38,37 @@ namespace System.Net.Http { _maxConnectionsPerServer = maxConnectionsPerServer; _pools = new ConcurrentDictionary(); - _cleaningTimer = new Timer(s => ((HttpConnectionPools)s).RemoveStalePools(), this, CleanPoolTimeoutMilliseconds, CleanPoolTimeoutMilliseconds); + // Start out with the timer not running, since we have no pools. + _cleaningTimer = new Timer(s => ((HttpConnectionPools)s).RemoveStalePools(), this, Timeout.Infinite, Timeout.Infinite); } /// Gets a pool for the specified endpoint, adding one if none existed. /// The endpoint for the pool. /// The retrieved pool. - public HttpConnectionPool GetOrAddPool(HttpConnectionKey key) => - _pools.GetOrAdd(key, (k, s) => new HttpConnectionPool(s), _maxConnectionsPerServer); + public HttpConnectionPool GetOrAddPool(HttpConnectionKey key) + { + HttpConnectionPool pool; + while (!_pools.TryGetValue(key, out pool)) + { + pool = new HttpConnectionPool(_maxConnectionsPerServer); + if (_pools.TryAdd(key, pool)) + { + // We need to ensure the cleanup timer is running if it isn't + // already now that we added a new connection pool. + lock (SyncObj) + { + if (!_timerIsRunning) + { + _cleaningTimer.Change(CleanPoolTimeoutMilliseconds, CleanPoolTimeoutMilliseconds); + _timerIsRunning = true; + } + } + break; + } + } + + return pool; + } /// Disposes of the pools, disposing of each individual pool. public void Dispose() @@ -66,6 +96,16 @@ namespace System.Net.Http } } + // Stop running the timer if we don't have any pools to clean up. + lock (SyncObj) + { + if (_pools.IsEmpty) + { + _cleaningTimer.Change(Timeout.Infinite, Timeout.Infinite); + _timerIsRunning = false; + } + } + // NOTE: There is a possible race condition with regards to a pool getting cleaned up at the same // time it's about to be used for another request. The timer cleanup could start running, see that // a pool is empty, and initiate its disposal. Concurrently, the pools could hand out the pool diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentDuplexStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentDuplexStream.cs new file mode 100644 index 0000000000..022e876067 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentDuplexStream.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.IO; +using System.Threading; + +namespace System.Net.Http +{ + internal abstract class HttpContentDuplexStream : HttpContentStream + { + public HttpContentDuplexStream(HttpConnection connection) : base(connection) + { + } + + public override bool CanRead => true; + public override bool CanWrite => true; + + public override void Flush() => FlushAsync().GetAwaiter().GetResult(); + + public override int Read(byte[] buffer, int offset, int count) + { + ValidateBufferArgs(buffer, offset, count); + return ReadAsync(new Memory(buffer, offset, count), CancellationToken.None).GetAwaiter().GetResult(); + } + + public override void Write(byte[] buffer, int offset, int count) => + WriteAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult(); + + public override void CopyTo(Stream destination, int bufferSize) => + CopyToAsync(destination, bufferSize, CancellationToken.None).GetAwaiter().GetResult(); + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentReadStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentReadStream.cs index 13350c6daa..c277cf8df7 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentReadStream.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentReadStream.cs @@ -7,7 +7,7 @@ using System.Threading; namespace System.Net.Http { - internal abstract class HttpContentReadStream : Stream + internal abstract class HttpContentReadStream : HttpContentStream { protected HttpConnection _connection; @@ -36,14 +36,14 @@ namespace System.Net.Http public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); - public override int Read(byte[] buffer, int offset, int count) => - ReadAsync(buffer, offset, count, CancellationToken.None).Result; + public override int Read(byte[] buffer, int offset, int count) + { + ValidateBufferArgs(buffer, offset, count); + return ReadAsync(new Memory(buffer, offset, count), CancellationToken.None).GetAwaiter().GetResult(); + } - // TODO #21452: Restore this once we address unit test build's target - //public override void CopyTo(Stream destination, int bufferSize) - //{ - // CopyToAsync(destination, bufferSize, CancellationToken.None).Wait(); - //} + public override void CopyTo(Stream destination, int bufferSize) => + CopyToAsync(destination, bufferSize, CancellationToken.None).GetAwaiter().GetResult(); protected override void Dispose(bool disposing) { diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentStream.cs new file mode 100644 index 0000000000..991ea06bc0 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentStream.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; + +namespace System.Net.Http +{ + internal abstract class HttpContentStream : Stream + { + protected static void ValidateBufferArgs(byte[] buffer, int offset, int count) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if ((uint)offset > buffer.Length) + { + throw new ArgumentOutOfRangeException(nameof(offset)); + } + + if ((uint)count > buffer.Length - offset) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentWriteStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentWriteStream.cs index a297a3d060..a998366083 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentWriteStream.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpContentWriteStream.cs @@ -9,16 +9,25 @@ using System.Threading.Tasks; namespace System.Net.Http { - internal abstract class HttpContentWriteStream : Stream + internal abstract class HttpContentWriteStream : HttpContentStream { protected HttpConnection _connection; - public HttpContentWriteStream(HttpConnection connection) + public HttpContentWriteStream(HttpConnection connection, CancellationToken cancellationToken) { Debug.Assert(connection != null); _connection = connection; + RequestCancellationToken = cancellationToken; } + /// Cancellation token associated with the send operation. + /// + /// Because of how this write stream is used, the CancellationToken passed into the individual + /// stream operations will be the default non-cancelable token and can be ignored. Instead, + /// this token is used. + /// + internal CancellationToken RequestCancellationToken { get; } + public override bool CanRead => false; public override bool CanSeek => false; public override bool CanWrite => true; @@ -42,7 +51,7 @@ namespace System.Net.Http public override void Write(byte[] buffer, int offset, int count) => WriteAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult(); - public abstract Task FinishAsync(CancellationToken cancellationToken); + public abstract Task FinishAsync(); protected override void Dispose(bool disposing) { diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpProxyConnectionHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpProxyConnectionHandler.cs index 9404891d51..82374d3cbe 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpProxyConnectionHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/HttpProxyConnectionHandler.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Concurrent; using System.Diagnostics; using System.IO; using System.Net.Http.Headers; @@ -22,9 +21,11 @@ namespace System.Net.Http public HttpProxyConnectionHandler(HttpConnectionSettings settings, HttpMessageHandler innerHandler) { Debug.Assert(innerHandler != null); + Debug.Assert(settings._useProxy); + Debug.Assert(settings._proxy != null || s_proxyFromEnvironment.Value != null); _innerHandler = innerHandler; - _proxy = settings._useProxy ? settings._proxy : new PassthroughWebProxy(s_proxyFromEnvironment.Value); + _proxy = settings._proxy ?? new PassthroughWebProxy(s_proxyFromEnvironment.Value); _defaultCredentials = settings._defaultProxyCredentials; _connectionPools = new HttpConnectionPools(settings._maxConnectionsPerServer); } @@ -42,7 +43,7 @@ namespace System.Net.Http catch (Exception) { // Eat any exception from the IWebProxy and just treat it as no proxy. - // TODO #21452: This seems a bit questionable, but it's what the tests expect + // This matches the behavior of other handlers. } return proxyUri == null ? @@ -55,12 +56,12 @@ namespace System.Net.Http { if (proxyUri.Scheme != UriScheme.Http) { - throw new InvalidOperationException($"invalid scheme {proxyUri.Scheme} for proxy"); + throw new InvalidOperationException(SR.net_http_invalid_proxy_scheme); } if (request.RequestUri.Scheme == UriScheme.Https) { - // TODO #21452: Implement SSL tunneling through proxy + // TODO #23136: Implement SSL tunneling through proxy throw new NotImplementedException("no support for SSL tunneling through proxy"); } @@ -74,19 +75,18 @@ namespace System.Net.Http foreach (AuthenticationHeaderValue h in response.Headers.ProxyAuthenticate) { // We only support Basic auth, ignore others - const string Basic = "Basic"; - if (h.Scheme == Basic) + if (h.Scheme == AuthenticationHelper.Basic) { NetworkCredential credential = - _proxy.Credentials?.GetCredential(proxyUri, Basic) ?? - _defaultCredentials?.GetCredential(proxyUri, Basic); + _proxy.Credentials?.GetCredential(proxyUri, AuthenticationHelper.Basic) ?? + _defaultCredentials?.GetCredential(proxyUri, AuthenticationHelper.Basic); if (credential != null) { response.Dispose(); - request.Headers.ProxyAuthorization = new AuthenticationHeaderValue(Basic, - BasicAuthenticationHelper.GetBasicTokenForCredential(credential)); + request.Headers.ProxyAuthorization = new AuthenticationHeaderValue(AuthenticationHelper.Basic, + AuthenticationHelper.GetBasicTokenForCredential(credential)); connection = await GetOrCreateConnection(request, proxyUri).ConfigureAwait(false); response = await connection.SendAsync(request, cancellationToken).ConfigureAwait(false); @@ -94,6 +94,46 @@ namespace System.Net.Http break; } + else if (h.Scheme == AuthenticationHelper.Digest) + { + NetworkCredential credential = + _proxy.Credentials?.GetCredential(proxyUri, AuthenticationHelper.Digest) ?? + _defaultCredentials?.GetCredential(proxyUri, AuthenticationHelper.Digest); + + if (credential != null) + { + // Update digest response with new parameter from Proxy-Authenticate + AuthenticationHelper.DigestResponse digestResponse = new AuthenticationHelper.DigestResponse(h.Parameter); + + if (await AuthenticationHelper.TrySetDigestAuthToken(request, credential, digestResponse, HttpKnownHeaderNames.ProxyAuthorization).ConfigureAwait(false)) + { + response.Dispose(); + response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); + + // Retry in case of nonce timeout in server. + if (response.StatusCode == HttpStatusCode.Unauthorized) + { + foreach (AuthenticationHeaderValue ahv in response.Headers.ProxyAuthenticate) + { + if (ahv.Scheme == AuthenticationHelper.Digest) + { + digestResponse = new AuthenticationHelper.DigestResponse(ahv.Parameter); + if (AuthenticationHelper.IsServerNonceStale(digestResponse) && + await AuthenticationHelper.TrySetDigestAuthToken(request, credential, digestResponse, HttpKnownHeaderNames.ProxyAuthorization).ConfigureAwait(false)) + { + response.Dispose(); + response = await _innerHandler.SendAsync(request, cancellationToken).ConfigureAwait(false); + } + + break; + } + } + } + } + + break; + } + } } } @@ -127,7 +167,7 @@ namespace System.Net.Http private static readonly Lazy s_proxyFromEnvironment = new Lazy(() => { // http_proxy is standard on Unix, used e.g. by libcurl. - // TODO #21452: We should support the full array of environment variables here, + // TODO #23150: We should support the full array of environment variables here, // including no_proxy, all_proxy, etc. string proxyString = Environment.GetEnvironmentVariable("http_proxy"); diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ManagedHandler.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ManagedHandler.cs index 1ae7e4189b..cf1a1798f3 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ManagedHandler.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/ManagedHandler.cs @@ -263,8 +263,8 @@ namespace System.Net.Http { HttpMessageHandler handler = new HttpConnectionHandler(_settings); - if ((_settings._useProxy && _settings._proxy != null) || - HttpProxyConnectionHandler.EnvironmentProxyConfigured) + if (_settings._useProxy && + (_settings._proxy != null || HttpProxyConnectionHandler.EnvironmentProxyConfigured)) { handler = new HttpProxyConnectionHandler(_settings, handler); } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/RawConnectionStream.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/RawConnectionStream.cs new file mode 100644 index 0000000000..375006bacd --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Managed/RawConnectionStream.cs @@ -0,0 +1,78 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + internal sealed partial class HttpConnection : IDisposable + { + private sealed class RawConnectionStream : HttpContentDuplexStream + { + public RawConnectionStream(HttpConnection connection) : base(connection) + { + } + + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, count); + return ReadAsync(new Memory(buffer, offset, count), cancellationToken).AsTask(); + } + + public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) + { + if (_connection == null || destination.Length == 0) + { + // Response body fully consumed or the caller didn't ask for any data + return 0; + } + + int bytesRead = await _connection.ReadAsync(destination, cancellationToken).ConfigureAwait(false); + if (bytesRead == 0) + { + // We cannot reuse this connection, so close it. + _connection.Dispose(); + _connection = null; + return 0; + } + + return bytesRead; + } + + public override async Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + if (_connection != null) // null if response body fully consumed + { + await _connection.CopyToAsync(destination, cancellationToken).ConfigureAwait(false); + + // We cannot reuse this connection, so close it. + _connection.Dispose(); + _connection = null; + } + } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + ValidateBufferArgs(buffer, offset, count); + return WriteAsync(new ReadOnlyMemory(buffer, offset, count), cancellationToken); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) => + _connection == null ? Task.FromException(new IOException(SR.net_http_io_write)) : + source.Length > 0 ? _connection.WriteWithoutBufferingAsync(source, cancellationToken) : + Task.CompletedTask; + + public override Task FlushAsync(CancellationToken cancellationToken) => + _connection != null ? _connection.FlushAsync(cancellationToken) : + Task.CompletedTask; + } + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/MultipartContent.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/MultipartContent.cs index cc440f08dd..40216b5a27 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/MultipartContent.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/MultipartContent.cs @@ -417,32 +417,63 @@ namespace System.Net.Http } } + public override int Read(Span destination) + { + if (destination.Length == 0) + { + return 0; + } + + while (true) + { + if (_current != null) + { + int bytesRead = _current.Read(destination); + if (bytesRead != 0) + { + _position += bytesRead; + return bytesRead; + } + + _current = null; + } + + if (_next >= _streams.Length) + { + return 0; + } + + _current = _streams[_next++]; + } + } + public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateReadArgs(buffer, offset, count); - return ReadAsyncPrivate(buffer, offset, count, cancellationToken); + return ReadAsyncPrivate(new Memory(buffer, offset, count), cancellationToken).AsTask(); } + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) => + ReadAsyncPrivate(destination, cancellationToken); + public override IAsyncResult BeginRead(byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState) => TaskToApm.Begin(ReadAsync(array, offset, count, CancellationToken.None), asyncCallback, asyncState); public override int EndRead(IAsyncResult asyncResult) => TaskToApm.End(asyncResult); - public async Task ReadAsyncPrivate(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + public async ValueTask ReadAsyncPrivate(Memory destination, CancellationToken cancellationToken) { - if (count == 0) + if (destination.Length == 0) { return 0; } while (true) { - cancellationToken.ThrowIfCancellationRequested(); - if (_current != null) { - int bytesRead = await _current.ReadAsync(buffer, offset, count).ConfigureAwait(false); + int bytesRead = await _current.ReadAsync(destination, cancellationToken).ConfigureAwait(false); if (bytesRead != 0) { _position += bytesRead; @@ -550,7 +581,9 @@ namespace System.Net.Http public override void Flush() { } public override void SetLength(long value) { throw new NotSupportedException(); } public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException(); } + public override void Write(ReadOnlySpan source) { throw new NotSupportedException(); } public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { throw new NotSupportedException(); } + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { throw new NotSupportedException(); } } #endregion Serialization } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/ReadOnlyMemoryContent.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/ReadOnlyMemoryContent.cs new file mode 100644 index 0000000000..2f42bd1973 --- /dev/null +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/ReadOnlyMemoryContent.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Threading.Tasks; + +namespace System.Net.Http +{ + public sealed class ReadOnlyMemoryContent : HttpContent + { + private readonly ReadOnlyMemory _content; + + public ReadOnlyMemoryContent(ReadOnlyMemory content) + { + _content = content; + if (content.DangerousTryGetArray(out ArraySegment array)) + { + // If we have an array, allow HttpClient to take optimized paths by just + // giving it the array content to use as its already buffered data. + SetBuffer(array.Array, array.Offset, array.Count); + } + } + + protected override Task SerializeToStreamAsync(Stream stream, TransportContext context) => + stream.WriteAsync(_content); + + protected internal override bool TryComputeLength(out long length) + { + length = _content.Length; + return true; + } + + protected override Task CreateContentReadStreamAsync() => + Task.FromResult(new ReadOnlyMemoryStream(_content)); + + internal override Stream TryCreateContentReadStream() => + new ReadOnlyMemoryStream(_content); + } +} diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/StreamContent.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/StreamContent.cs index 39101e65f4..edc8c3d826 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/StreamContent.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/StreamContent.cs @@ -15,7 +15,6 @@ namespace System.Net.Http private Stream _content; private int _bufferSize; - private CancellationToken _cancellationToken; private bool _contentConsumed; private long _start; @@ -25,16 +24,6 @@ namespace System.Net.Http } public StreamContent(Stream content, int bufferSize) - : this(content, bufferSize, CancellationToken.None) - { - } - - internal StreamContent(Stream content, CancellationToken cancellationToken) - : this(content, DefaultBufferSize, cancellationToken) - { - } - - private StreamContent(Stream content, int bufferSize, CancellationToken cancellationToken) { if (content == null) { @@ -47,7 +36,6 @@ namespace System.Net.Http _content = content; _bufferSize = bufferSize; - _cancellationToken = cancellationToken; if (content.CanSeek) { _start = content.Position; @@ -61,7 +49,7 @@ namespace System.Net.Http PrepareContent(); // If the stream can't be re-read, make sure that it gets disposed once it is consumed. - return StreamToStreamCopy.CopyAsync(_content, stream, _bufferSize, !_content.CanSeek, _cancellationToken); + return StreamToStreamCopy.CopyAsync(_content, stream, _bufferSize, !_content.CanSeek); } protected internal override bool TryComputeLength(out long length) @@ -117,7 +105,7 @@ namespace System.Net.Http _contentConsumed = true; } - private class ReadOnlyStream : DelegatingStream + private sealed class ReadOnlyStream : DelegatingStream { public override bool CanWrite { @@ -155,6 +143,11 @@ namespace System.Net.Http throw new NotSupportedException(SR.net_http_content_readonly_stream); } + public override void Write(ReadOnlySpan source) + { + throw new NotSupportedException(SR.net_http_content_readonly_stream); + } + public override void WriteByte(byte value) { throw new NotSupportedException(SR.net_http_content_readonly_stream); @@ -164,6 +157,11 @@ namespace System.Net.Http { throw new NotSupportedException(SR.net_http_content_readonly_stream); } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + throw new NotSupportedException(SR.net_http_content_readonly_stream); + } } } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.CurlResponseMessage.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.CurlResponseMessage.cs index 486338cb03..1fafd9681d 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.CurlResponseMessage.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.CurlResponseMessage.cs @@ -51,14 +51,11 @@ namespace System.Net.Http /// private sealed class CurlResponseStream : Stream { - /// A cached task storing the Int32 value 0. - private static readonly Task s_zeroTask = Task.FromResult(0); - /// /// A sentinel object used in the field to indicate that /// the stream completed successfully. /// - private static readonly Exception s_completionSentinel = new Exception("s_completionSentinel"); + private static readonly Exception s_completionSentinel = new Exception(nameof(s_completionSentinel)); /// A object used to synchronize all access to state on this response stream. private readonly object _lockObject = new object(); @@ -199,9 +196,9 @@ namespace System.Net.Http // There's no data in the buffer and there is a pending read request. // Transfer as much data as we can to the read request, completing it. - int numBytesForTask = (int)Math.Min(length, _pendingReadRequest._count); + int numBytesForTask = (int)Math.Min(length, _pendingReadRequest._buffer.Length); Debug.Assert(numBytesForTask > 0, "We must be copying a positive amount."); - Marshal.Copy(pointer, _pendingReadRequest._buffer, _pendingReadRequest._offset, numBytesForTask); + unsafe { new Span((byte*)pointer, numBytesForTask).CopyTo(_pendingReadRequest._buffer.Span); } EventSourceTrace("Completing pending read with {0} bytes", numBytesForTask); _pendingReadRequest.SetResult(numBytesForTask); ClearPendingReadRequest(); @@ -252,15 +249,21 @@ namespace System.Net.Http if (offset < 0) throw new ArgumentOutOfRangeException(nameof(offset)); if (count < 0) throw new ArgumentOutOfRangeException(nameof(count)); if (offset > buffer.Length - count) throw new ArgumentException(SR.net_http_buffer_insufficient_length, nameof(buffer)); + + return ReadAsync(new Memory(buffer, offset, count), cancellationToken).AsTask(); + } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) + { CheckDisposed(); - EventSourceTrace("Buffer: {0}, Offset: {1}, Count: {2}", buffer.Length, offset, count); + EventSourceTrace("Buffer: {0}", destination.Length); // Check for cancellation if (cancellationToken.IsCancellationRequested) { EventSourceTrace("Canceled"); - return Task.FromCanceled(cancellationToken); + return new ValueTask(Task.FromCanceled(cancellationToken)); } lock (_lockObject) @@ -271,7 +274,7 @@ namespace System.Net.Http if (_pendingReadRequest != null) { EventSourceTrace("Failing due to existing pending read; concurrent reads not supported."); - return Task.FromException(new InvalidOperationException(SR.net_http_content_no_concurrent_reads)); + return new ValueTask(Task.FromException(new InvalidOperationException(SR.net_http_content_no_concurrent_reads))); } // If the stream was already completed with failure, complete the read as a failure. @@ -280,23 +283,23 @@ namespace System.Net.Http EventSourceTrace("Failing read with error: {0}", _completed); OperationCanceledException oce = _completed as OperationCanceledException; - return (oce != null && oce.CancellationToken.IsCancellationRequested) ? + return new ValueTask((oce != null && oce.CancellationToken.IsCancellationRequested) ? Task.FromCanceled(oce.CancellationToken) : - Task.FromException(MapToReadWriteIOException(_completed, isRead: true)); + Task.FromException(MapToReadWriteIOException(_completed, isRead: true))); } // Quick check for if no data was actually requested. We do this after the check // for errors so that we can still fail the read and transfer the exception if we should. - if (count == 0) + if (destination.Length == 0) { - return s_zeroTask; + return new ValueTask(0); } // If there's any data left over from a previous call, grab as much as we can. if (_remainingDataCount > 0) { - int bytesToCopy = Math.Min(count, _remainingDataCount); - Buffer.BlockCopy(_remainingData, _remainingDataOffset, buffer, offset, bytesToCopy); + int bytesToCopy = Math.Min(destination.Length, _remainingDataCount); + new Span(_remainingData, _remainingDataOffset, bytesToCopy).CopyTo(destination.Span); _remainingDataOffset += bytesToCopy; _remainingDataCount -= bytesToCopy; @@ -304,14 +307,14 @@ namespace System.Net.Http Debug.Assert(_remainingDataOffset <= _remainingData.Length, "The remaining offset should never exceed the buffer size"); EventSourceTrace("Read {0} bytes", bytesToCopy); - return Task.FromResult(bytesToCopy); + return new ValueTask(bytesToCopy); } // If the stream has already been completed, complete the read immediately. if (_completed == s_completionSentinel) { EventSourceTrace("Stream already completed"); - return s_zeroTask; + return new ValueTask(0); } // Finally, the stream is still alive, and we want to read some data, but there's no data @@ -329,20 +332,20 @@ namespace System.Net.Http // the cancellation token. Dispose on the registration won't return until the action // associated with the registration has completed, but if that action is currently // executing and is blocked on the lock that's held while calling Dispose... deadlock. - var crs = new CancelableReadState(buffer, offset, count, this, cancellationToken); + var crs = new CancelableReadState(destination, this); crs._registration = cancellationToken.Register(s1 => { ((CancelableReadState)s1)._stream.EventSourceTrace("Cancellation invoked. Queueing work item to cancel read state"); Task.Factory.StartNew(s2 => { var crsRef = (CancelableReadState)s2; - Debug.Assert(crsRef._token.IsCancellationRequested, "We should only be here if cancellation was requested."); lock (crsRef._stream._lockObject) { + Debug.Assert(crsRef._registration.Token.IsCancellationRequested, "We should only be here if cancellation was requested."); if (crsRef._stream._pendingReadRequest == crsRef) { crsRef._stream.EventSourceTrace("Canceling"); - crsRef.TrySetCanceled(crsRef._token); + crsRef.TrySetCanceled(crsRef._registration.Token); crsRef._stream.ClearPendingReadRequest(); } } @@ -353,12 +356,12 @@ namespace System.Net.Http else { // The token isn't cancelable. Just create a normal read state. - _pendingReadRequest = new ReadState(buffer, offset, count); + _pendingReadRequest = new ReadState(destination); } _easy._associatedMultiAgent.RequestUnpause(_easy); _easy._selfStrongToWeakReference.MakeStrong(); // convert from a weak to a strong ref to keep the easy alive during the read - return _pendingReadRequest.Task; + return new ValueTask(_pendingReadRequest.Task); } } @@ -501,19 +504,11 @@ namespace System.Net.Http /// State associated with a pending read request. private class ReadState : TaskCompletionSource { - internal readonly byte[] _buffer; - internal readonly int _offset; - internal readonly int _count; + internal readonly Memory _buffer; - internal ReadState(byte[] buffer, int offset, int count) : - base(TaskCreationOptions.RunContinuationsAsynchronously) + internal ReadState(Memory buffer) : base(TaskCreationOptions.RunContinuationsAsynchronously) { - Debug.Assert(buffer != null, "Need non-null buffer"); - Debug.Assert(offset >= 0, "Need non-negative offset"); - Debug.Assert(count > 0, "Need positive count"); _buffer = buffer; - _offset = offset; - _count = count; } } @@ -521,18 +516,13 @@ namespace System.Net.Http private sealed class CancelableReadState : ReadState { internal readonly CurlResponseStream _stream; - internal readonly CancellationToken _token; internal CancellationTokenRegistration _registration; - internal CancelableReadState(byte[] buffer, int offset, int count, - CurlResponseStream responseStream, CancellationToken cancellationToken) : - base(buffer, offset, count) + internal CancelableReadState(Memory buffer, CurlResponseStream responseStream) : base(buffer) { _stream = responseStream; - _token = cancellationToken; } } - } } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.MultiAgent.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.MultiAgent.cs index db20c778a3..797f5cd4b7 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.MultiAgent.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.MultiAgent.cs @@ -434,7 +434,7 @@ namespace System.Net.Http } /// - /// Drains the incoming requests queue, dequeueing each request and handling it according to its type. + /// Drains the incoming requests queue, dequeuing each request and handling it according to its type. /// private void HandleIncomingRequests() { @@ -1198,26 +1198,26 @@ namespace System.Net.Http // Make sure we actually have a stream to read from. This will be null if either // this is the first time we're reading it, or if the stream was reset as part // of curl trying to rewind. Then do the read. - Task asyncRead; + ValueTask asyncRead; if (easy._requestContentStream == null) { multi.EventSourceTrace("Calling ReadAsStreamAsync to get new request stream", easy: easy); Task readAsStreamTask = easy._requestMessage.Content.ReadAsStreamAsync(); asyncRead = readAsStreamTask.IsCompleted ? StoreRetrievedContentStreamAndReadAsync(readAsStreamTask, easy, sts, length) : - easy._requestMessage.Content.ReadAsStreamAsync().ContinueWith((t, s) => + new ValueTask(easy._requestMessage.Content.ReadAsStreamAsync().ContinueWith((t, s) => { var stateAndRequest = (Tuple)s; return StoreRetrievedContentStreamAndReadAsync(t, - stateAndRequest.Item3, stateAndRequest.Item2, stateAndRequest.Item1); + stateAndRequest.Item3, stateAndRequest.Item2, stateAndRequest.Item1).AsTask(); }, Tuple.Create(length, sts, easy), CancellationToken.None, - TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default).Unwrap(); + TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default).Unwrap()); } else { multi.EventSourceTrace("Starting async read", easy: easy); asyncRead = easy._requestContentStream.ReadAsync( - sts.Buffer, 0, Math.Min(sts.Buffer.Length, length), easy._cancellationToken); + new Memory(sts.Buffer, 0, Math.Min(sts.Buffer.Length, length)), easy._cancellationToken); } Debug.Assert(asyncRead != null, "Badly implemented stream returned a null task from ReadAsync"); @@ -1225,7 +1225,7 @@ namespace System.Net.Http // Check to see if it did, in which case we can also satisfy the libcurl request synchronously in this callback. if (asyncRead.IsCompleted) { - multi.EventSourceTrace("Async read completed immediately: {0}", asyncRead.Status, easy: easy); + multi.EventSourceTrace("Async read completed immediately", easy: easy); // Get the amount of data read. int bytesRead = asyncRead.GetAwaiter().GetResult(); // will throw if read failed @@ -1245,7 +1245,7 @@ namespace System.Net.Http if (bytesToCopy < bytesRead) { multi.EventSourceTrace("Storing {0} bytes for later", bytesRead - bytesToCopy, easy: easy); - sts.SetTaskOffsetCount(asyncRead, bytesToCopy, bytesRead); + sts.SetTaskOffsetCount(asyncRead.AsTask(), bytesToCopy, bytesRead); } // Return the number of bytes read. @@ -1254,8 +1254,8 @@ namespace System.Net.Http // Otherwise, the read completed asynchronously. Store the task, and hook up a continuation // such that the connection will be unpaused once the task completes. - sts.SetTaskOffsetCount(asyncRead, 0, 0); - asyncRead.ContinueWith((t, s) => + sts.SetTaskOffsetCount(asyncRead.AsTask(), 0, 0); + sts.Task.ContinueWith((t, s) => { EasyRequest easyRef = (EasyRequest)s; easyRef._associatedMultiAgent.RequestUnpause(easyRef); @@ -1270,7 +1270,7 @@ namespace System.Net.Http /// Given a completed task used to retrieve the content stream asynchronously, extracts the stream, /// stores it into , and does an initial read on it. /// - private static Task StoreRetrievedContentStreamAndReadAsync( + private static ValueTask StoreRetrievedContentStreamAndReadAsync( Task readAsStreamTask, EasyRequest easy, EasyRequest.SendTransferState sts, int length) { Debug.Assert(readAsStreamTask.IsCompleted, $"Expected {nameof(readAsStreamTask)} to be completed, got {readAsStreamTask.Status}"); @@ -1294,17 +1294,17 @@ namespace System.Net.Http // Now that we have a stream, do the desired read multi.EventSourceTrace("Starting async read", easy: easy); - return easy._requestContentStream.ReadAsync(sts.Buffer, 0, Math.Min(sts.Buffer.Length, length), easy._cancellationToken); + return easy._requestContentStream.ReadAsync(new Memory(sts.Buffer, 0, Math.Min(sts.Buffer.Length, length)), easy._cancellationToken); } catch (OperationCanceledException oce) { - return oce.CancellationToken.IsCancellationRequested ? + return new ValueTask(oce.CancellationToken.IsCancellationRequested ? Task.FromCanceled(oce.CancellationToken) : - Task.FromCanceled(new CancellationToken(true)); + Task.FromCanceled(new CancellationToken(true))); } catch (Exception exc) { - return Task.FromException(exc); + return new ValueTask(Task.FromException(exc)); } } diff --git a/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlResponseHeaderReader.cs b/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlResponseHeaderReader.cs index 65a39bba7f..dd330e728d 100644 --- a/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlResponseHeaderReader.cs +++ b/external/corefx/src/System.Net.Http/src/System/Net/Http/Unix/CurlResponseHeaderReader.cs @@ -116,7 +116,7 @@ namespace System.Net.Http { if (!condition) { - throw new HttpRequestException(SR.net_http_unix_invalid_response); + throw new HttpRequestException(SR.net_http_invalid_response); } } diff --git a/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs b/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs index 50147daaef..64b1be0073 100644 --- a/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs +++ b/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs @@ -39,7 +39,7 @@ namespace System.Net.Http private static Oid s_serverAuthOid = new Oid("1.3.6.1.5.5.7.3.1", "1.3.6.1.5.5.7.3.1"); private static readonly Lazy s_RTCookieUsageBehaviorSupported = new Lazy(InitRTCookieUsageBehaviorSupported); - private static bool RTCookieUsageBehaviorSupported => s_RTCookieUsageBehaviorSupported.Value; + internal static bool RTCookieUsageBehaviorSupported => s_RTCookieUsageBehaviorSupported.Value; private static readonly Lazy s_RTNoCacheSupported = new Lazy(InitRTNoCacheSupported); private static bool RTNoCacheSupported => s_RTNoCacheSupported.Value; @@ -49,14 +49,16 @@ namespace System.Net.Http #region Fields - private readonly RTHttpBaseProtocolFilter _rtFilter; private readonly HttpHandlerToFilter _handlerToFilter; private readonly HttpMessageHandler _diagnosticsPipeline; + private RTHttpBaseProtocolFilter _rtFilter; private ClientCertificateOption _clientCertificateOptions; private CookieContainer _cookieContainer; private bool _useCookies; private DecompressionMethods _automaticDecompression; + private bool _allowAutoRedirect; + private int _maxAutomaticRedirections; private ICredentials _defaultProxyCredentials; private ICredentials _credentials; private IWebProxy _proxy; @@ -227,19 +229,23 @@ namespace System.Net.Http public bool AllowAutoRedirect { - get { return _rtFilter.AllowAutoRedirect; } + get { return _allowAutoRedirect; } set { CheckDisposedOrStarted(); - _rtFilter.AllowAutoRedirect = value; + _allowAutoRedirect = value; } } public int MaxAutomaticRedirections { - get { return 10; } // WinRT Windows.Web.Http constant via use of native WinINet. + get { return _maxAutomaticRedirections; } set { + if (value <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value)); + } CheckDisposedOrStarted(); } } @@ -350,36 +356,51 @@ namespace System.Net.Http public HttpClientHandler() { - _rtFilter = new RTHttpBaseProtocolFilter(); - _handlerToFilter = new HttpHandlerToFilter(_rtFilter); + _rtFilter = CreateFilter(); + + _handlerToFilter = new HttpHandlerToFilter(_rtFilter, this); _handlerToFilter.RequestMessageLookupKey = RequestMessageLookupKey; _handlerToFilter.SavedExceptionDispatchInfoLookupKey = SavedExceptionDispatchInfoLookupKey; _diagnosticsPipeline = new DiagnosticsHandler(_handlerToFilter); _clientCertificateOptions = ClientCertificateOption.Manual; + _useCookies = true; // deal with cookies by default. + _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies. + + _allowAutoRedirect = true; + _maxAutomaticRedirections = 50; + + _automaticDecompression = DecompressionMethods.None; + } + + private RTHttpBaseProtocolFilter CreateFilter() + { + var filter = new RTHttpBaseProtocolFilter(); + // Always turn off WinRT cookie processing if the WinRT API supports turning it off. // Use .NET CookieContainer handling only. if (RTCookieUsageBehaviorSupported) { - _rtFilter.CookieUsageBehavior = RTHttpCookieUsageBehavior.NoCookies; + filter.CookieUsageBehavior = RTHttpCookieUsageBehavior.NoCookies; } - _useCookies = true; // deal with cookies by default. - _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies. + // Handle redirections at the .NET layer so that we can see cookies on redirect responses + // and have control of the number of redirections allowed. + filter.AllowAutoRedirect = false; - // Managed at this layer for granularity, but uses the desktop default. - _rtFilter.AutomaticDecompression = false; - _automaticDecompression = DecompressionMethods.None; + filter.AutomaticDecompression = false; // We don't support using the UI model in HttpBaseProtocolFilter() especially for auto-handling 401 responses. - _rtFilter.AllowUI = false; - + filter.AllowUI = false; + // The .NET Desktop System.Net Http APIs (based on HttpWebRequest/HttpClient) uses no caching by default. // To preserve app-compat, we turn off caching in the WinRT HttpClient APIs. - _rtFilter.CacheControl.ReadBehavior = RTNoCacheSupported ? + filter.CacheControl.ReadBehavior = RTNoCacheSupported ? RTHttpCacheReadBehavior.NoCache : RTHttpCacheReadBehavior.MostRecent; - _rtFilter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache; + filter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache; + + return filter; } protected override void Dispose(bool disposing) @@ -408,27 +429,11 @@ namespace System.Net.Http private async Task ConfigureRequest(HttpRequestMessage request) { - ApplyRequestCookies(request); - ApplyDecompressionSettings(request); await ApplyClientCertificateSettings().ConfigureAwait(false); } - // Taken from System.Net.CookieModule.OnSendingHeaders - private void ApplyRequestCookies(HttpRequestMessage request) - { - if (UseCookies) - { - string cookieHeader = CookieContainer.GetCookieHeader(request.RequestUri); - if (!string.IsNullOrWhiteSpace(cookieHeader)) - { - bool success = request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.Cookie, cookieHeader); - Debug.Assert(success); - } - } - } - private void ApplyDecompressionSettings(HttpRequestMessage request) { // Decompression: Add the Gzip and Deflate headers if not already present. @@ -586,6 +591,13 @@ namespace System.Net.Http HttpResponseMessage response; try { + if (string.Equals(request.Method.Method, HttpMethod.Trace.Method, StringComparison.OrdinalIgnoreCase)) + { + // https://github.com/dotnet/corefx/issues/22161 + throw new PlatformNotSupportedException(string.Format(CultureInfo.InvariantCulture, + SR.net_http_httpmethod_notsupported_error, request.Method.Method)); + } + await ConfigureRequest(request).ConfigureAwait(false); Task responseTask = DiagnosticsHandler.IsEnabled() ? @@ -604,68 +616,11 @@ namespace System.Net.Http throw new HttpRequestException(SR.net_http_client_execution_error, ex); } - ProcessResponse(response); return response; } #endregion Request Execution - #region Response Processing - - private void ProcessResponse(HttpResponseMessage response) - { - ProcessResponseCookies(response); - } - - // Taken from System.Net.CookieModule.OnReceivedHeaders - private void ProcessResponseCookies(HttpResponseMessage response) - { - if (UseCookies) - { - IEnumerable values; - if (response.Headers.TryGetValues(HttpKnownHeaderNames.SetCookie, out values)) - { - foreach (string cookieString in values) - { - if (!string.IsNullOrWhiteSpace(cookieString)) - { - try - { - // Parse the cookies so that we can filter some of them out - CookieContainer helper = new CookieContainer(); - helper.SetCookies(response.RequestMessage.RequestUri, cookieString); - CookieCollection cookies = helper.GetCookies(response.RequestMessage.RequestUri); - foreach (Cookie cookie in cookies) - { - // We don't want to put HttpOnly cookies in the CookieContainer if the system - // doesn't support the RTHttpBaseProtocolFilter CookieUsageBehavior property. - // Prior to supporting that, the WinRT HttpClient could not turn off cookie - // processing. So, it would always be storing all cookies in its internal container. - // Putting HttpOnly cookies in the .NET CookieContainer would cause problems later - // when the .NET layer tried to add them on outgoing requests and conflicted with - // the WinRT internal cookie processing. - // - // With support for WinRT CookieUsageBehavior, cookie processing is turned off - // within the WinRT layer. This allows us to process cookies using only the .NET - // layer. So, we need to add all applicable cookies that are received to the - // CookieContainer. - if (RTCookieUsageBehaviorSupported || !cookie.HttpOnly) - { - CookieContainer.Add(response.RequestMessage.RequestUri, cookie); - } - } - } - catch (Exception) - { - } - } - } - } - } - } - - #endregion Response Processing - #region Helpers private void SetOperationStarted() @@ -728,7 +683,7 @@ namespace System.Net.Http "ServerCustomValidationRequested"); } - private void RTServerCertificateCallback(RTHttpBaseProtocolFilter sender, RTHttpServerCustomValidationRequestedEventArgs args) + internal void RTServerCertificateCallback(RTHttpBaseProtocolFilter sender, RTHttpServerCustomValidationRequestedEventArgs args) { bool success = RTServerCertificateCallbackHelper( args.RequestMessage, diff --git a/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs b/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs index dc75083cd6..53e7b9b2bf 100644 --- a/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs +++ b/external/corefx/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs @@ -21,23 +21,35 @@ using RTHttpVersion = Windows.Web.Http.HttpVersion; using RTIHttpContent = Windows.Web.Http.IHttpContent; using RTIInputStream = Windows.Storage.Streams.IInputStream; using RTHttpBaseProtocolFilter = Windows.Web.Http.Filters.HttpBaseProtocolFilter; +using RTChainValidationResult = Windows.Security.Cryptography.Certificates.ChainValidationResult; namespace System.Net.Http { internal class HttpHandlerToFilter : HttpMessageHandler { - private readonly RTHttpBaseProtocolFilter _next; - private int _filterMaxVersionSet; + // We need two different WinRT filters because we need to remove credentials during redirection requests + // and WinRT doesn't allow changing the filter properties after the first request. + private readonly RTHttpBaseProtocolFilter _filter; + private Lazy _filterWithNoCredentials; + private RTHttpBaseProtocolFilter FilterWithNoCredentials => _filterWithNoCredentials.Value; - internal HttpHandlerToFilter(RTHttpBaseProtocolFilter filter) + private int _filterMaxVersionSet; + private HttpClientHandler _handler; + + internal HttpHandlerToFilter( + RTHttpBaseProtocolFilter filter, + HttpClientHandler handler) { if (filter == null) { throw new ArgumentNullException(nameof(filter)); } - _next = filter; + _filter = filter; _filterMaxVersionSet = 0; + _handler = handler; + + _filterWithNoCredentials = new Lazy(InitFilterWithNoCredentials); } internal string RequestMessageLookupKey { get; set; } @@ -45,46 +57,205 @@ namespace System.Net.Http protected internal override async Task SendAsync(HttpRequestMessage request, CancellationToken cancel) { + int redirects = 0; + HttpMethod requestHttpMethod; + bool skipRequestContentIfPresent = false; + HttpResponseMessage response = null; + if (request == null) { throw new ArgumentNullException(nameof(request)); } - cancel.ThrowIfCancellationRequested(); - RTHttpRequestMessage rtRequest = await ConvertRequestAsync(request).ConfigureAwait(false); + requestHttpMethod = request.Method; - RTHttpResponseMessage rtResponse; - try + while (true) { - rtResponse = await _next.SendRequestAsync(rtRequest).AsTask(cancel).ConfigureAwait(false); - } - catch (TaskCanceledException) - { - throw; - } - catch (Exception) - { - object info; - if (rtRequest.Properties.TryGetValue(SavedExceptionDispatchInfoLookupKey, out info)) + cancel.ThrowIfCancellationRequested(); + + if (response != null) { - ((ExceptionDispatchInfo)info).Throw(); + response.Dispose(); + response = null; } - throw; + RTHttpRequestMessage rtRequest = await ConvertRequestAsync( + request, + requestHttpMethod, + skipRequestContentIfPresent).ConfigureAwait(false); + + RTHttpResponseMessage rtResponse; + try + { + rtResponse = await (redirects > 0 ? FilterWithNoCredentials : _filter).SendRequestAsync(rtRequest).AsTask(cancel).ConfigureAwait(false); + } + catch (TaskCanceledException) + { + throw; + } + catch + { + if (rtRequest.Properties.TryGetValue(SavedExceptionDispatchInfoLookupKey, out object info)) + { + ((ExceptionDispatchInfo)info).Throw(); + } + + throw; + } + + response = ConvertResponse(rtResponse); + + ProcessResponseCookies(response, request.RequestUri); + + if (!_handler.AllowAutoRedirect) + { + break; + } + + if (response.StatusCode != HttpStatusCode.MultipleChoices && + response.StatusCode != HttpStatusCode.MovedPermanently && + response.StatusCode != HttpStatusCode.Redirect && + response.StatusCode != HttpStatusCode.RedirectMethod && + response.StatusCode != HttpStatusCode.RedirectKeepVerb) + { + break; + } + + redirects++; + if (redirects > _handler.MaxAutomaticRedirections) + { + break; + } + + Uri redirectUri = response.Headers.Location; + if (redirectUri == null) + { + break; + } + + if (!redirectUri.IsAbsoluteUri) + { + redirectUri = new Uri(request.RequestUri, redirectUri.OriginalString); + } + + if (redirectUri.Scheme != Uri.UriSchemeHttp && + redirectUri.Scheme != Uri.UriSchemeHttps) + { + break; + } + + if (request.RequestUri.Scheme == Uri.UriSchemeHttps && + redirectUri.Scheme == Uri.UriSchemeHttp) + { + break; + } + + // Follow HTTP RFC 7231 rules. In general, 3xx responses + // except for 307 will keep verb except POST becomes GET. + // 307 responses have all verbs stay the same. + // https://tools.ietf.org/html/rfc7231#section-6.4 + if (response.StatusCode != HttpStatusCode.RedirectKeepVerb && + requestHttpMethod == HttpMethod.Post) + { + requestHttpMethod = HttpMethod.Get; + skipRequestContentIfPresent = true; + } + + request.RequestUri = redirectUri; } - // Update in case of redirects - request.RequestUri = rtRequest.RequestUri; - - HttpResponseMessage response = ConvertResponse(rtResponse); response.RequestMessage = request; return response; } - private async Task ConvertRequestAsync(HttpRequestMessage request) + private RTHttpBaseProtocolFilter InitFilterWithNoCredentials() { - RTHttpRequestMessage rtRequest = new RTHttpRequestMessage(new RTHttpMethod(request.Method.Method), request.RequestUri); + RTHttpBaseProtocolFilter filter = new RTHttpBaseProtocolFilter(); + + filter.AllowAutoRedirect = _filter.AllowAutoRedirect; + filter.AllowUI = _filter.AllowUI; + filter.AutomaticDecompression = _filter.AutomaticDecompression; + filter.CacheControl.ReadBehavior = _filter.CacheControl.ReadBehavior; + filter.CacheControl.WriteBehavior = _filter.CacheControl.WriteBehavior; + + if (HttpClientHandler.RTCookieUsageBehaviorSupported) + { + filter.CookieUsageBehavior = _filter.CookieUsageBehavior; + } + + filter.MaxConnectionsPerServer = _filter.MaxConnectionsPerServer; + filter.MaxVersion = _filter.MaxVersion; + filter.UseProxy = _filter.UseProxy; + + if (_handler.ServerCertificateCustomValidationCallback != null) + { + foreach (RTChainValidationResult error in _filter.IgnorableServerCertificateErrors) + { + filter.IgnorableServerCertificateErrors.Add(error); + } + + filter.ServerCustomValidationRequested += _handler.RTServerCertificateCallback; + } + + return filter; + } + + // Taken from System.Net.CookieModule.OnReceivedHeaders + private void ProcessResponseCookies(HttpResponseMessage response, Uri uri) + { + if (_handler.UseCookies) + { + IEnumerable values; + if (response.Headers.TryGetValues(HttpKnownHeaderNames.SetCookie, out values)) + { + foreach (string cookieString in values) + { + if (!string.IsNullOrWhiteSpace(cookieString)) + { + try + { + // Parse the cookies so that we can filter some of them out + CookieContainer helper = new CookieContainer(); + helper.SetCookies(uri, cookieString); + CookieCollection cookies = helper.GetCookies(uri); + foreach (Cookie cookie in cookies) + { + // We don't want to put HttpOnly cookies in the CookieContainer if the system + // doesn't support the RTHttpBaseProtocolFilter CookieUsageBehavior property. + // Prior to supporting that, the WinRT HttpClient could not turn off cookie + // processing. So, it would always be storing all cookies in its internal container. + // Putting HttpOnly cookies in the .NET CookieContainer would cause problems later + // when the .NET layer tried to add them on outgoing requests and conflicted with + // the WinRT internal cookie processing. + // + // With support for WinRT CookieUsageBehavior, cookie processing is turned off + // within the WinRT layer. This allows us to process cookies using only the .NET + // layer. So, we need to add all applicable cookies that are received to the + // CookieContainer. + if (HttpClientHandler.RTCookieUsageBehaviorSupported || !cookie.HttpOnly) + { + _handler.CookieContainer.Add(uri, cookie); + } + } + } + catch (Exception) + { + } + } + } + } + } + } + + private async Task ConvertRequestAsync( + HttpRequestMessage request, + HttpMethod httpMethod, + bool skipRequestContentIfPresent) + { + RTHttpRequestMessage rtRequest = new RTHttpRequestMessage( + new RTHttpMethod(httpMethod.Method), + request.RequestUri); // Add a reference from the WinRT object back to the .NET object. rtRequest.Properties.Add(RequestMessageLookupKey, request); @@ -117,7 +288,7 @@ namespace System.Net.Http // So, we only have to change it if we don't want HTTP/2.0. if (maxVersion != RTHttpVersion.Http20) { - _next.MaxVersion = maxVersion; + _filter.MaxVersion = maxVersion; } } @@ -131,6 +302,17 @@ namespace System.Net.Http } } + // Cookies + if (_handler.UseCookies) + { + string cookieHeader = _handler.CookieContainer.GetCookieHeader(request.RequestUri); + if (!string.IsNullOrWhiteSpace(cookieHeader)) + { + bool success = rtRequest.Headers.TryAppendWithoutValidation(HttpKnownHeaderNames.Cookie, cookieHeader); + Debug.Assert(success); + } + } + // Properties foreach (KeyValuePair propertyPair in request.Properties) { @@ -138,7 +320,7 @@ namespace System.Net.Http } // Content - if (request.Content != null) + if (!skipRequestContentIfPresent && request.Content != null) { rtRequest.Content = await CreateRequestContentAsync(request, rtRequest.Headers).ConfigureAwait(false); } diff --git a/external/corefx/src/System.Net.Http/src/uap/System/Net/cookie.cs b/external/corefx/src/System.Net.Http/src/uap/System/Net/cookie.cs index 9a94a76e79..6233da39f6 100644 --- a/external/corefx/src/System.Net.Http/src/uap/System/Net/cookie.cs +++ b/external/corefx/src/System.Net.Http/src/uap/System/Net/cookie.cs @@ -360,15 +360,8 @@ namespace System.Net { // // +1 in the host length is to account for the leading dot in domain - if ((host.Length + 1 == domain.Length) && - (string.Compare(host, 0, domain, 1, host.Length, StringComparison.OrdinalIgnoreCase) == 0)) - { - return true; - } - else - { - return false; - } + return (host.Length + 1 == domain.Length) && + (string.Compare(host, 0, domain, 1, host.Length, StringComparison.OrdinalIgnoreCase) == 0); } // @@ -1280,7 +1273,8 @@ namespace System.Net } ++m_index; } - else + + if (Eof) { m_cookieLength = m_index - m_cookieStartIndex; } diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs index f97b8fee1d..f29922b17c 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/CancellationTest.cs @@ -13,7 +13,7 @@ using Xunit.Abstractions; namespace System.Net.Http.Functional.Tests { - public class CancellationTest + public class CancellationTest : HttpClientTestBase { private readonly ITestOutputHelper _output; @@ -37,8 +37,10 @@ namespace System.Net.Http.Functional.Tests TimeSpan timeout = useTimeout ? new TimeSpan(0, 0, 1) : Timeout.InfiniteTimeSpan; CancellationToken cancellationToken = useTimeout ? CancellationToken.None : cts.Token; - using (var client = new HttpClient() { Timeout = timeout }) + using (HttpClient client = CreateHttpClient()) { + client.Timeout = timeout; + var triggerResponseWrite = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var triggerRequestCancel = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); @@ -107,7 +109,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task ReadAsStreamAsync_ReadAsync_Cancel_TaskCanceledQuickly(bool startResponseBody) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { await LoopbackServer.CreateServerAsync(async (server, url) => { diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/DefaultCredentialsTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/DefaultCredentialsTest.cs index c3e31a0a54..2e003ac80b 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/DefaultCredentialsTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/DefaultCredentialsTest.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Net.Test.Common; using System.Security.Principal; using System.Threading.Tasks; @@ -15,7 +14,8 @@ namespace System.Net.Http.Functional.Tests // TODO: #2383 - Consolidate the use of the environment variable settings to Common/tests. [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "dotnet/corefx #20010")] - public class DefaultCredentialsTest + [PlatformSpecific(TestPlatforms.Windows)] + public class DefaultCredentialsTest : HttpClientTestBase { private static string DomainJoinedTestServer => Configuration.Http.DomainJoinedHttpHost; private static bool DomainJoinedTestsEnabled => !string.IsNullOrEmpty(DomainJoinedTestServer); @@ -50,7 +50,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task UseDefaultCredentials_DefaultValue_Unauthorized(bool useProxy) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.UseProxy = useProxy; using (var client = new HttpClient(handler)) @@ -67,7 +67,9 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task UseDefaultCredentials_SetFalse_Unauthorized(bool useProxy) { - var handler = new HttpClientHandler { UseProxy = useProxy, UseDefaultCredentials = false }; + HttpClientHandler handler = CreateHttpClientHandler(); + handler.UseProxy = useProxy; + handler.UseDefaultCredentials = false; using (var client = new HttpClient(handler)) using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer)) @@ -83,7 +85,9 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task UseDefaultCredentials_SetTrue_ConnectAsCurrentIdentity(bool useProxy) { - var handler = new HttpClientHandler { UseProxy = useProxy, UseDefaultCredentials = true }; + HttpClientHandler handler = CreateHttpClientHandler(); + handler.UseProxy = useProxy; + handler.UseDefaultCredentials = true; using (var client = new HttpClient(handler)) using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer)) @@ -104,7 +108,9 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task UseDefaultCredentials_SetTrueAndServerOffersMultipleSchemes_Ok(bool useProxy) { - var handler = new HttpClientHandler { UseProxy = useProxy, UseDefaultCredentials = true }; + HttpClientHandler handler = CreateHttpClientHandler(); + handler.UseProxy = useProxy; + handler.UseDefaultCredentials = true; using (var client = new HttpClient(handler)) using (HttpResponseMessage response = await client.GetAsync(s_multipleSchemesAuthenticatedServer)) @@ -125,10 +131,10 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task Credentials_SetToSpecificCredential_ConnectAsSpecificIdentity(bool useProxy) { - var handler = new HttpClientHandler { - UseProxy = useProxy, - UseDefaultCredentials = false, - Credentials = _specificCredential }; + HttpClientHandler handler = CreateHttpClientHandler(); + handler.UseProxy = useProxy; + handler.UseDefaultCredentials = false; + handler.Credentials = _specificCredential; using (var client = new HttpClient(handler)) using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer)) @@ -147,7 +153,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task Credentials_SetToWrappedDefaultCredential_ConnectAsCurrentIdentity(bool useProxy) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.UseProxy = useProxy; handler.Credentials = new CredentialWrapper { @@ -171,7 +177,7 @@ namespace System.Net.Http.Functional.Tests [ConditionalFact(nameof(DomainProxyTestsEnabled))] public async Task Proxy_UseAuthenticatedProxyWithNoCredentials_ProxyAuthenticationRequired() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Proxy = new AuthenticatedProxy(null); using (var client = new HttpClient(handler)) @@ -186,7 +192,7 @@ namespace System.Net.Http.Functional.Tests [ConditionalFact(nameof(DomainProxyTestsEnabled))] public async Task Proxy_UseAuthenticatedProxyWithDefaultCredentials_OK() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Proxy = new AuthenticatedProxy(CredentialCache.DefaultCredentials); using (var client = new HttpClient(handler)) @@ -205,7 +211,7 @@ namespace System.Net.Http.Functional.Tests InnerCredentials = CredentialCache.DefaultCredentials }; - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Proxy = new AuthenticatedProxy(wrappedCreds); using (var client = new HttpClient(handler)) diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs index 8942afaf81..f899baa83f 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/DiagnosticsTests.cs @@ -6,7 +6,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Tracing; -using System.IO; using System.Linq; using System.Net.Http.Headers; using System.Net.Test.Common; @@ -21,7 +20,7 @@ namespace System.Net.Http.Functional.Tests [ActiveIssue(20470, TargetFrameworkMonikers.UapAot)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetEventSource is only part of .NET Core.")] - public class DiagnosticsTest : RemoteExecutorTestBase + public class DiagnosticsTest : HttpClientTestBase { [Fact] public static void EventSource_ExistsWithCorrectId() @@ -48,7 +47,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void SendAsync_ExpectedDiagnosticSourceLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool requestLogged = false; Guid requestGuid = Guid.Empty; @@ -90,7 +89,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable( s => !s.Contains("HttpRequestOut")); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { client.GetAsync(Configuration.Http.RemoteEchoServer).Result.Dispose(); } @@ -105,7 +104,7 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } /// @@ -116,7 +115,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void SendAsync_ExpectedDiagnosticSourceNoLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool requestLogged = false; bool responseLogged = false; @@ -145,7 +144,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { LoopbackServer.CreateServerAsync(async (server, url) => { @@ -165,14 +164,15 @@ namespace System.Net.Http.Functional.Tests Assert.False(activityStopLogged, "HttpRequestOut.Stop was logged while logging disabled."); } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } + [ActiveIssue(23771, TestPlatforms.AnyUnix)] [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_HttpTracingEnabled_Succeeds() { - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { using (var listener = new TestEventListener("Microsoft-System-Net-Http", EventLevel.Verbose)) { @@ -180,7 +180,7 @@ namespace System.Net.Http.Functional.Tests await listener.RunWithCallbackAsync(events.Enqueue, async () => { // Exercise various code paths to get coverage of tracing - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { // Do a get to a loopback server await LoopbackServer.CreateServerAsync(async (server, url) => @@ -209,14 +209,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticExceptionLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool exceptionLogged = false; bool responseLogged = false; @@ -242,7 +242,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(s => !s.Contains("HttpRequestOut")); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { Assert.ThrowsAsync(() => client.GetAsync($"http://{Guid.NewGuid()}.com")).Wait(); } @@ -254,14 +254,15 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } + [ActiveIssue(23209)] [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticCancelledLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool cancelLogged = false; var diagnosticListenerObserver = new FakeDiagnosticListenerObserver(kvp => @@ -278,7 +279,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(s => !s.Contains("HttpRequestOut")); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { LoopbackServer.CreateServerAsync(async (server, url) => { @@ -300,14 +301,14 @@ namespace System.Net.Http.Functional.Tests diagnosticListenerObserver.Disable(); return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticSourceActivityLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool requestLogged = false; bool responseLogged = false; @@ -353,7 +354,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(s => s.Contains("HttpRequestOut")); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { LoopbackServer.CreateServerAsync(async (server, url) => { @@ -377,14 +378,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticSourceUrlFilteredActivityLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool activityStartLogged = false; bool activityStopLogged = false; @@ -407,7 +408,7 @@ namespace System.Net.Http.Functional.Tests } return true; }); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { client.GetAsync(Configuration.Http.RemoteEchoServer).Result.Dispose(); } @@ -418,14 +419,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticExceptionActivityLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool exceptionLogged = false; bool activityStopLogged = false; @@ -452,7 +453,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { Assert.ThrowsAsync(() => client.GetAsync($"http://{Guid.NewGuid()}.com")).Wait(); } @@ -464,14 +465,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticSourceNewAndDeprecatedEventsLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool requestLogged = false; bool responseLogged = false; @@ -489,7 +490,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { client.GetAsync(Configuration.Http.RemoteEchoServer).Result.Dispose(); } @@ -503,14 +504,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticExceptionOnlyActivityLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool exceptionLogged = false; bool activityLogged = false; @@ -529,7 +530,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(s => s.Equals("System.Net.Http.Exception")); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { Assert.ThrowsAsync(() => client.GetAsync($"http://{Guid.NewGuid()}.com")).Wait(); } @@ -541,14 +542,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticStopOnlyActivityLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool activityStartLogged = false; bool activityStopLogged = false; @@ -566,7 +567,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(s => s.Equals("System.Net.Http.HttpRequestOut")); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { client.GetAsync(Configuration.Http.RemoteEchoServer).Result.Dispose(); } @@ -578,14 +579,14 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void SendAsync_ExpectedDiagnosticCancelledActivityLogging() { - RemoteInvoke(() => + RemoteInvoke(useManagedHandlerString => { bool cancelLogged = false; var diagnosticListenerObserver = new FakeDiagnosticListenerObserver(kvp => @@ -603,7 +604,7 @@ namespace System.Net.Http.Functional.Tests using (DiagnosticListener.AllListeners.Subscribe(diagnosticListenerObserver)) { diagnosticListenerObserver.Enable(); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient(useManagedHandlerString)) { LoopbackServer.CreateServerAsync(async (server, url) => { @@ -625,7 +626,7 @@ namespace System.Net.Http.Functional.Tests diagnosticListenerObserver.Disable(); return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } private static T GetPropertyValueFromAnonymousTypeInstance(object obj, string propertyName) diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientEKUTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientEKUTest.cs index 1e849bf967..d5c693a6fd 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientEKUTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientEKUTest.cs @@ -15,8 +15,7 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - [ActiveIssue(21738, TargetFrameworkMonikers.Uap)] // If Capability.IsTrustedRootCertificateInstalled()==true, the tests are hanging. - public class HttpClientEKUTest + public class HttpClientEKUTest : HttpClientTestBase { // Curl + OSX SecureTransport doesn't support the custom certificate callback. private static bool BackendSupportsCustomCertificateHandling => @@ -57,7 +56,7 @@ namespace System.Net.Http.Functional.Tests options.ServerCertificate = serverCertificateNoEku; using (var server = new HttpsTestServer(options)) - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { server.Start(); @@ -79,7 +78,7 @@ namespace System.Net.Http.Functional.Tests options.ServerCertificate = serverCertificateWrongEku; using (var server = new HttpsTestServer(options)) - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { server.Start(); @@ -102,7 +101,7 @@ namespace System.Net.Http.Functional.Tests options.RequireClientAuthentication = true; using (var server = new HttpsTestServer(options)) - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { server.Start(); @@ -126,7 +125,7 @@ namespace System.Net.Http.Functional.Tests options.RequireClientAuthentication = true; using (var server = new HttpsTestServer(options)) - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { server.Start(); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AcceptAllCerts.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AcceptAllCerts.cs index d041d0f0dd..b1544255b1 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AcceptAllCerts.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.AcceptAllCerts.cs @@ -5,7 +5,6 @@ using System.Net.Security; using System.Net.Test.Common; using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; using Xunit; @@ -13,7 +12,7 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - public class HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test + public class HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test : HttpClientTestBase { // TODO: https://github.com/dotnet/corefx/issues/7812 private static bool ClientSupportsDHECipherSuites => (!PlatformDetection.IsWindows || PlatformDetection.IsWindows10Version1607OrGreater); @@ -35,14 +34,16 @@ namespace System.Net.Http.Functional.Tests [InlineData(SslProtocols.None, true)] public async Task SetDelegate_ConnectionSucceeds(SslProtocols acceptedProtocol, bool requestOnlyThisProtocol) { - using (var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator }) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; + // Refer issue: #22089 // When the server uses SslProtocols.Tls, on MacOS, SecureTransport ends up picking a cipher suite // for TLS1.2, even though server said it was only using TLS1.0. LibreSsl throws error that // wrong cipher is used for TLs1.0. - if (requestOnlyThisProtocol || (PlatformDetection.IsMacOsHighSierra && acceptedProtocol == SslProtocols.Tls)) + if (requestOnlyThisProtocol || (PlatformDetection.IsMacOsHighSierraOrHigher && acceptedProtocol == SslProtocols.Tls)) { handler.SslProtocols = acceptedProtocol; } @@ -69,8 +70,10 @@ namespace System.Net.Http.Functional.Tests [MemberData(nameof(InvalidCertificateServers))] public async Task InvalidCertificateServers_CertificateValidationDisabled_Succeeds(string url) { - using (var client = new HttpClient(new HttpClientHandler() { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator })) + using (HttpClientHandler handler = CreateHttpClientHandler()) + using (var client = new HttpClient(handler)) { + handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; (await client.GetAsync(url)).Dispose(); } } diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs index 2b8dd5aca9..9530ce22fe 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ClientCertificates.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics; using System.Net.Security; using System.Net.Sockets; using System.Net.Test.Common; @@ -15,13 +14,13 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - public class HttpClientHandler_ClientCertificates_Test : RemoteExecutorTestBase + public class HttpClientHandler_ClientCertificates_Test : HttpClientTestBase { - public static bool CanTestCertificates => + public bool CanTestCertificates => Capability.IsTrustedRootCertificateInstalled() && (BackendSupportsCustomCertificateHandling || Capability.AreHostsFileNamesInstalled()); - public static bool CanTestClientCertificates => + public bool CanTestClientCertificates => CanTestCertificates && BackendSupportsCustomCertificateHandling; public HttpClientHandler_ClientCertificates_Test(ITestOutputHelper output) @@ -33,7 +32,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void ClientCertificateOptions_Default() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Equal(ClientCertificateOption.Manual, handler.ClientCertificateOptions); } @@ -44,7 +43,7 @@ namespace System.Net.Http.Functional.Tests [InlineData((ClientCertificateOption)(-1))] public void ClientCertificateOptions_InvalidArg_ThrowsException(ClientCertificateOption option) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { AssertExtensions.Throws("value", () => handler.ClientCertificateOptions = option); } @@ -55,7 +54,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(ClientCertificateOption.Manual)] public void ClientCertificateOptions_ValueArg_Roundtrips(ClientCertificateOption option) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { handler.ClientCertificateOptions = option; Assert.Equal(option, handler.ClientCertificateOptions); @@ -65,7 +64,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void ClientCertificates_ClientCertificateOptionsAutomatic_ThrowsException() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { handler.ClientCertificateOptions = ClientCertificateOption.Automatic; Assert.Throws(() => handler.ClientCertificates); @@ -81,8 +80,10 @@ namespace System.Net.Http.Functional.Tests return; } - using (var client = new HttpClient(new HttpClientHandler() { ClientCertificateOptions = ClientCertificateOption.Automatic })) + using (HttpClientHandler handler = CreateHttpClientHandler()) + using (var client = new HttpClient(handler)) { + handler.ClientCertificateOptions = ClientCertificateOption.Automatic; await Assert.ThrowsAsync(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer)); } } @@ -96,7 +97,7 @@ namespace System.Net.Http.Functional.Tests return; } - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.ClientCertificates.Add(Configuration.Certificates.GetClientCertificate()); using (var client = new HttpClient(handler)) { @@ -117,10 +118,10 @@ namespace System.Net.Http.Functional.Tests // UAP HTTP stack caches connections per-process. This causes interference when these tests run in // the same process as the other tests. Each test needs to be isolated to its own process. // See dicussion: https://github.com/dotnet/corefx/issues/21945 - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { var cert = Configuration.Certificates.GetClientCertificate(); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.ClientCertificates.Add(cert); using (var client = new HttpClient(handler)) { @@ -134,16 +135,16 @@ namespace System.Net.Http.Functional.Tests return SuccessExitCode; } - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 [Fact] public void Manual_SendClientCertificateWithServerAuthEKUToRemoteServer_Forbidden() { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The managed handler is currently sending out client certificates when it shouldn't. + // TODO #23128: The managed handler is currently sending out client certificates when it shouldn't. return; } @@ -156,10 +157,10 @@ namespace System.Net.Http.Functional.Tests // UAP HTTP stack caches connections per-process. This causes interference when these tests run in // the same process as the other tests. Each test needs to be isolated to its own process. // See dicussion: https://github.com/dotnet/corefx/issues/21945 - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { var cert = Configuration.Certificates.GetServerCertificate(); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.ClientCertificates.Add(cert); using (var client = new HttpClient(handler)) { @@ -168,7 +169,7 @@ namespace System.Net.Http.Functional.Tests return SuccessExitCode; } - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 @@ -184,10 +185,10 @@ namespace System.Net.Http.Functional.Tests // UAP HTTP stack caches connections per-process. This causes interference when these tests run in // the same process as the other tests. Each test needs to be isolated to its own process. // See dicussion: https://github.com/dotnet/corefx/issues/21945 - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { var cert = Configuration.Certificates.GetNoEKUCertificate(); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.ClientCertificates.Add(cert); using (var client = new HttpClient(handler)) { @@ -201,7 +202,7 @@ namespace System.Net.Http.Functional.Tests return SuccessExitCode; } - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "dotnet/corefx #20010")] @@ -214,7 +215,7 @@ namespace System.Net.Http.Functional.Tests int numberOfRequests, bool reuseClient) // validate behavior with and without connection pooling, which impacts client cert usage { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler { _output.WriteLine($"Skipping {nameof(Manual_CertificateSentMatchesCertificateReceived_Success)}()"); return; @@ -224,7 +225,8 @@ namespace System.Net.Http.Functional.Tests Func createClient = (cert) => { - var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = delegate { return true; } }; + HttpClientHandler handler = CreateHttpClientHandler(); + handler.ServerCertificateCustomValidationCallback = delegate { return true; }; handler.ClientCertificates.Add(cert); return new HttpClient(handler); }; @@ -279,9 +281,8 @@ namespace System.Net.Http.Functional.Tests }, options); } - private static bool BackendSupportsCustomCertificateHandling => - HttpClientHandler_ServerCertificates_Test.BackendSupportsCustomCertificateHandling; - - private static bool BackendDoesNotSupportCustomCertificateHandling => !BackendSupportsCustomCertificateHandling; + private bool BackendSupportsCustomCertificateHandling => + UseManagedHandler || + new HttpClientHandler_ServerCertificates_Test().BackendSupportsCustomCertificateHandling; } } diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.DefaultProxyCredentials.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.DefaultProxyCredentials.cs index 085cb57da5..547ea250aa 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.DefaultProxyCredentials.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.DefaultProxyCredentials.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Net.Test.Common; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Xunit; @@ -12,12 +13,12 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - public class HttpClientHandler_DefaultProxyCredentials_Test : RemoteExecutorTestBase + public class HttpClientHandler_DefaultProxyCredentials_Test : HttpClientTestBase { [Fact] public void Default_Get_Null() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Null(handler.DefaultProxyCredentials); } @@ -26,7 +27,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void SetGet_Roundtrips() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { var creds = new NetworkCredential("username", "password", "domain"); @@ -41,6 +42,7 @@ namespace System.Net.Http.Functional.Tests } } + [ActiveIssue(23702, TargetFrameworkMonikers.NetFramework)] [ActiveIssue(20010, TargetFrameworkMonikers.Uap)] [OuterLoop] // TODO: Issue #11345 [Fact] @@ -53,7 +55,7 @@ namespace System.Net.Http.Functional.Tests var rightCreds = new NetworkCredential("rightusername", "rightpassword"); var wrongCreds = new NetworkCredential("wrongusername", "wrongpassword"); - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { handler.Proxy = new UseSpecifiedUriWebProxy(proxyUrl, rightCreds); @@ -75,12 +77,23 @@ namespace System.Net.Http.Functional.Tests } [OuterLoop] // TODO: Issue #11345 - [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] // proxies set via the http_proxy environment variable are specific to Unix - public void ProxySetViaEnvironmentVariable_DefaultProxyCredentialsUsed() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void ProxySetViaEnvironmentVariable_DefaultProxyCredentialsUsed(bool useProxy) { - int port; - Task proxyTask = LoopbackGetRequestHttpProxy.StartAsync(out port, requireAuth: true, expectCreds: true); + bool envVarsSupported = UseManagedHandler || !RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + if (!envVarsSupported) + { + return; + } + + int port = 0; + Task proxyTask = null; + if (useProxy) + { + proxyTask = LoopbackGetRequestHttpProxy.StartAsync(out port, requireAuth: true, expectCreds: true); + } const string ExpectedUsername = "rightusername"; const string ExpectedPassword = "rightpassword"; @@ -90,13 +103,14 @@ namespace System.Net.Http.Functional.Tests // test in another process. var psi = new ProcessStartInfo(); psi.Environment.Add("http_proxy", $"http://localhost:{port}"); - RemoteInvoke(() => + RemoteInvoke((useProxyString, useManagedHandlerString) => { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString)) using (var client = new HttpClient(handler)) { var creds = new NetworkCredential(ExpectedUsername, ExpectedPassword); handler.DefaultProxyCredentials = creds; + handler.UseProxy = bool.Parse(useProxyString); Task responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer); Task responseStringTask = responseTask.ContinueWith(t => @@ -108,9 +122,12 @@ namespace System.Net.Http.Functional.Tests TestHelper.VerifyResponseBody(responseStringTask.Result, responseTask.Result.Content.Headers.ContentMD5, false, null); } return SuccessExitCode; - }, new RemoteInvokeOptions { StartInfo = psi }).Dispose(); + }, useProxy.ToString(), UseManagedHandler.ToString(), new RemoteInvokeOptions { StartInfo = psi }).Dispose(); - Assert.Equal($"{ExpectedUsername}:{ExpectedPassword}", proxyTask.Result.AuthenticationHeaderValue); + if (useProxy) + { + Assert.Equal($"{ExpectedUsername}:{ExpectedPassword}", proxyTask.Result.AuthenticationHeaderValue); + } } // The purpose of this test is mainly to validate the .NET Framework OOB System.Net.Http implementation @@ -122,7 +139,7 @@ namespace System.Net.Http.Functional.Tests { WebRequest.DefaultWebProxy = null; - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { handler.DefaultProxyCredentials = new NetworkCredential("UsernameNotUsed", "PasswordNotUsed"); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxConnectionsPerServer.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxConnectionsPerServer.cs index 87aa8dcee5..f53be768eb 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxConnectionsPerServer.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxConnectionsPerServer.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Linq; -using System.Net.Test.Common; using System.Runtime.InteropServices; using System.Threading.Tasks; @@ -14,13 +13,13 @@ namespace System.Net.Http.Functional.Tests using Configuration = System.Net.Test.Common.Configuration; [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "dotnet/corefx #20010")] - public class HttpClientHandler_MaxConnectionsPerServer_Test + public class HttpClientHandler_MaxConnectionsPerServer_Test : HttpClientTestBase { [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "MaxConnectionsPerServer either returns two or int.MaxValue depending if ctor of HttpClientHandlerTest executed first. Disabling cause of random xunit execution order.")] public void Default_ExpectedValue() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Equal(int.MaxValue, handler.MaxConnectionsPerServer); } @@ -31,7 +30,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(-1)] public void Set_InvalidValues_Throws(int invalidValue) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Throws(() => handler.MaxConnectionsPerServer = invalidValue); } @@ -44,7 +43,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(int.MaxValue - 1)] public void Set_ValidValues_Success(int validValue) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { try { @@ -68,8 +67,10 @@ namespace System.Net.Http.Functional.Tests [InlineData(3, 5, false)] public async Task GetAsync_MaxLimited_ConcurrentCallsStillSucceed(int maxConnections, int numRequests, bool secure) { - using (var client = new HttpClient(new HttpClientHandler { MaxConnectionsPerServer = maxConnections })) + using (HttpClientHandler handler = CreateHttpClientHandler()) + using (var client = new HttpClient(handler)) { + handler.MaxConnectionsPerServer = maxConnections; await Task.WhenAll( from i in Enumerable.Range(0, numRequests) select client.GetAsync(secure ? Configuration.Http.RemoteEchoServer : Configuration.Http.SecureRemoteEchoServer)); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs index c04259a14e..1a666845c9 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.MaxResponseHeadersLength.cs @@ -3,9 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Net.Sockets; using System.Net.Test.Common; using System.Text; using System.Threading.Tasks; @@ -15,7 +12,7 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - public class HttpClientHandler_MaxResponseHeadersLength_Test : RemoteExecutorTestBase + public class HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientTestBase { [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not currently supported on UAP")] [Theory] @@ -23,7 +20,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(-1)] public void InvalidValue_ThrowsException(int invalidValue) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { AssertExtensions.Throws("value", () => handler.MaxResponseHeadersLength = invalidValue); } @@ -36,7 +33,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(int.MaxValue)] public void ValidValue_SetGet_Roundtrips(int validValue) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { handler.MaxResponseHeadersLength = validValue; Assert.Equal(validValue, handler.MaxResponseHeadersLength); @@ -46,7 +43,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task SetAfterUse_Throws() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { handler.MaxResponseHeadersLength = int.MaxValue; @@ -62,9 +59,10 @@ namespace System.Net.Http.Functional.Tests { await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var handler = new HttpClientHandler() { MaxResponseHeadersLength = maxResponseHeadersLength }) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.MaxResponseHeadersLength = maxResponseHeadersLength; Task getAsync = client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead); await LoopbackServer.AcceptSocketAsync(server, async (s, serverStream, reader, writer) => diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Unix.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Unix.cs index bb9d8e4901..132c930e66 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Unix.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Unix.cs @@ -14,17 +14,12 @@ using Xunit; namespace System.Net.Http.Functional.Tests { - public partial class HttpClientHandler_ServerCertificates_Test : RemoteExecutorTestBase + public partial class HttpClientHandler_ServerCertificates_Test { private static bool ShouldSuppressRevocationException { get { - if (ManagedHandlerTestHelpers.IsEnabled) - { - return false; - } - if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return false; @@ -53,11 +48,11 @@ namespace System.Net.Http.Functional.Tests } } - internal static bool BackendSupportsCustomCertificateHandling + internal bool BackendSupportsCustomCertificateHandling { get { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { return true; } @@ -73,8 +68,6 @@ namespace System.Net.Http.Functional.Tests } } - private static bool BackendDoesNotSupportCustomCertificateHandling => !BackendSupportsCustomCertificateHandling; - [DllImport("System.Net.Http.Native", EntryPoint = "HttpNative_GetSslVersionDescription")] private static extern string CurlSslVersionDescription(); } diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Windows.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Windows.cs index b44163a41e..c213aab296 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Windows.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.Windows.cs @@ -2,24 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; -using System.Diagnostics; -using System.Net.Security; -using System.Net.Test.Common; -using System.Runtime.InteropServices; -using System.Security.Authentication.ExtendedProtection; -using System.Security.Cryptography.X509Certificates; -using System.Threading.Tasks; -using Xunit; - namespace System.Net.Http.Functional.Tests { - public partial class HttpClientHandler_ServerCertificates_Test : RemoteExecutorTestBase + public partial class HttpClientHandler_ServerCertificates_Test { private static bool ShouldSuppressRevocationException => false; - internal static bool BackendSupportsCustomCertificateHandling => true; + internal bool BackendSupportsCustomCertificateHandling => true; - private static bool BackendDoesNotSupportCustomCertificateHandling => !BackendSupportsCustomCertificateHandling; + private bool BackendDoesNotSupportCustomCertificateHandling => !BackendSupportsCustomCertificateHandling; } } diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs index 4c2b426e3c..43fef62f82 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Net.Security; using System.Net.Test.Common; @@ -18,18 +17,18 @@ namespace System.Net.Http.Functional.Tests using Configuration = System.Net.Test.Common.Configuration; [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework throws PNSE for ServerCertificateCustomValidationCallback")] - public partial class HttpClientHandler_ServerCertificates_Test : RemoteExecutorTestBase + public partial class HttpClientHandler_ServerCertificates_Test : HttpClientTestBase { // TODO: https://github.com/dotnet/corefx/issues/7812 private static bool ClientSupportsDHECipherSuites => (!PlatformDetection.IsWindows || PlatformDetection.IsWindows10Version1607OrGreater); - private static bool BackendSupportsCustomCertificateHandlingAndClientSupportsDHECipherSuites => + private bool BackendSupportsCustomCertificateHandlingAndClientSupportsDHECipherSuites => (BackendSupportsCustomCertificateHandling && ClientSupportsDHECipherSuites); [Fact] [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)] public void Ctor_ExpectedDefaultPropertyValues_UapPlatform() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Null(handler.ServerCertificateCustomValidationCallback); Assert.True(handler.CheckCertificateRevocationList); @@ -40,7 +39,7 @@ namespace System.Net.Http.Functional.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap)] public void Ctor_ExpectedDefaultValues_NotUapPlatform() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Null(handler.ServerCertificateCustomValidationCallback); Assert.False(handler.CheckCertificateRevocationList); @@ -51,7 +50,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task NoCallback_ValidCertificate_SuccessAndExpectedPropertyBehavior() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); using (var client = new HttpClient(handler)) { using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.SecureRemoteEchoServer)) @@ -66,12 +65,16 @@ namespace System.Net.Http.Functional.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP won't send requests through a custom proxy")] [OuterLoop] // TODO: Issue #11345 - [ConditionalFact(nameof(BackendSupportsCustomCertificateHandling))] + [Fact] public async Task UseCallback_HaveNoCredsAndUseAuthenticatedCustomProxyAndPostToSecureServer_ProxyAuthenticationRequiredStatusCode() { - if (ManagedHandlerTestHelpers.IsEnabled) + if (!BackendSupportsCustomCertificateHandling) { - return; // TODO #21452: SSL proxy tunneling not yet implemented in ManagedHandler + return; + } + if (UseManagedHandler) + { + return; // TODO #23136: SSL proxy tunneling not yet implemented in ManagedHandler } int port; @@ -81,7 +84,7 @@ namespace System.Net.Http.Functional.Tests expectCreds: false); Uri proxyUrl = new Uri($"http://localhost:{port}"); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Proxy = new UseSpecifiedUriWebProxy(proxyUrl, null); handler.ServerCertificateCustomValidationCallback = delegate { return true; }; using (var client = new HttpClient(handler)) @@ -101,13 +104,13 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task UseCallback_NotSecureConnection_CallbackNotCalled() { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) { Console.WriteLine($"Skipping {nameof(UseCallback_NotSecureConnection_CallbackNotCalled)}()"); return; } - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); using (var client = new HttpClient(handler)) { bool callbackCalled = false; @@ -142,13 +145,13 @@ namespace System.Net.Http.Functional.Tests [MemberData(nameof(UseCallback_ValidCertificate_ExpectedValuesDuringCallback_Urls))] public async Task UseCallback_ValidCertificate_ExpectedValuesDuringCallback(Uri url, bool checkRevocation) { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) { Console.WriteLine($"Skipping {nameof(UseCallback_ValidCertificate_ExpectedValuesDuringCallback)}({url}, {checkRevocation})"); return; } - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); using (var client = new HttpClient(handler)) { bool callbackCalled = false; @@ -190,13 +193,13 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task UseCallback_CallbackReturnsFailure_ThrowsException() { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) { Console.WriteLine($"Skipping {nameof(UseCallback_CallbackReturnsFailure_ThrowsException)}()"); return; } - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); using (var client = new HttpClient(handler)) { handler.ServerCertificateCustomValidationCallback = delegate { return false; }; @@ -204,25 +207,24 @@ namespace System.Net.Http.Functional.Tests } } - [ActiveIssue(21904, ~TargetFrameworkMonikers.Uap)] [OuterLoop] // TODO: Issue #11345 - [ConditionalFact(nameof(BackendSupportsCustomCertificateHandling))] - public async Task UseCallback_CallbackThrowsException_ExceptionPropagatesAsInnerException() + [Fact] + public async Task UseCallback_CallbackThrowsException_ExceptionPropagatesAsBaseException() { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) { - Console.WriteLine($"Skipping {nameof(UseCallback_CallbackThrowsException_ExceptionPropagatesAsInnerException)}()"); + Console.WriteLine($"Skipping {nameof(UseCallback_CallbackThrowsException_ExceptionPropagatesAsBaseException)}()"); return; } - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); using (var client = new HttpClient(handler)) { var e = new DivideByZeroException(); handler.ServerCertificateCustomValidationCallback = delegate { throw e; }; HttpRequestException ex = await Assert.ThrowsAsync(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer)); - Assert.Same(e, ex.InnerException); + Assert.Same(e, ex.GetBaseException()); } } @@ -238,7 +240,7 @@ namespace System.Net.Http.Functional.Tests [MemberData(nameof(CertificateValidationServers))] public async Task NoCallback_BadCertificate_ThrowsException(string url) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { await Assert.ThrowsAsync(() => client.GetAsync(url)); } @@ -254,7 +256,7 @@ namespace System.Net.Http.Functional.Tests // CheckCertificateRevocationList throws in the general case. try { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RevokedCertRemoteServer)) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -262,7 +264,7 @@ namespace System.Net.Http.Functional.Tests } catch (HttpRequestException) { - if (!ShouldSuppressRevocationException) + if (UseManagedHandler || !ShouldSuppressRevocationException) throw; } } @@ -271,13 +273,14 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task NoCallback_RevokedCertificate_RevocationChecking_Fails() { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) { Console.WriteLine($"Skipping {nameof(NoCallback_RevokedCertificate_RevocationChecking_Fails)}()"); return; } - var handler = new HttpClientHandler() { CheckCertificateRevocationList = true }; + HttpClientHandler handler = CreateHttpClientHandler(); + handler.CheckCertificateRevocationList = true; using (var client = new HttpClient(handler)) { await Assert.ThrowsAsync(() => client.GetAsync(Configuration.Http.RevokedCertRemoteServer)); @@ -291,15 +294,15 @@ namespace System.Net.Http.Functional.Tests new object[] { Configuration.Http.WrongHostNameCertRemoteServer , SslPolicyErrors.RemoteCertificateNameMismatch}, }; - public async Task UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(string url, SslPolicyErrors expectedErrors) + private async Task UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(string url, bool useManagedHandler, SslPolicyErrors expectedErrors) { - if (BackendDoesNotSupportCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (!BackendSupportsCustomCertificateHandling) { Console.WriteLine($"Skipping {nameof(UseCallback_BadCertificate_ExpectedPolicyErrors)}({url}, {expectedErrors})"); return; } - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandler); using (var client = new HttpClient(handler)) { bool callbackCalled = false; @@ -310,9 +313,9 @@ namespace System.Net.Http.Functional.Tests Assert.NotNull(request); Assert.NotNull(cert); Assert.NotNull(chain); - if (!ManagedHandlerTestHelpers.IsEnabled) + if (!useManagedHandler) { - // TODO #21452: This test is failing with the managed handler on the exact value of the managed errors, + // TODO #23137: This test is failing with the managed handler on the exact value of the managed errors, // e.g. reporting "RemoteCertificateNameMismatch, RemoteCertificateChainErrors" when we only expect // "RemoteCertificateChainErrors" Assert.Equal(expectedErrors, errors); @@ -330,27 +333,33 @@ namespace System.Net.Http.Functional.Tests } [OuterLoop] // TODO: Issue #11345 - [ConditionalTheory(nameof(BackendSupportsCustomCertificateHandlingAndClientSupportsDHECipherSuites))] + [Theory] [MemberData(nameof(CertificateValidationServersAndExpectedPolicies))] public async Task UseCallback_BadCertificate_ExpectedPolicyErrors(string url, SslPolicyErrors expectedErrors) { + if (!BackendSupportsCustomCertificateHandlingAndClientSupportsDHECipherSuites) + { + return; + } + if (PlatformDetection.IsUap) { // UAP HTTP stack caches connections per-process. This causes interference when these tests run in // the same process as the other tests. Each test needs to be isolated to its own process. // See dicussion: https://github.com/dotnet/corefx/issues/21945 - RemoteInvoke((remoteUrl, remoteExpectedErrors) => + RemoteInvoke((remoteUrl, remoteExpectedErrors, useManagedHandlerString) => { UseCallback_BadCertificate_ExpectedPolicyErrors_Helper( remoteUrl, + bool.Parse(useManagedHandlerString), (SslPolicyErrors)Enum.Parse(typeof(SslPolicyErrors), remoteExpectedErrors)).Wait(); return SuccessExitCode; - }, url, expectedErrors.ToString()).Dispose(); + }, url, expectedErrors.ToString(), UseManagedHandler.ToString()).Dispose(); } else { - await UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(url, expectedErrors); + await UseCallback_BadCertificate_ExpectedPolicyErrors_Helper(url, UseManagedHandler, expectedErrors); } } @@ -358,12 +367,14 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task SSLBackendNotSupported_Callback_ThrowsPlatformNotSupportedException() { - if (BackendSupportsCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (BackendSupportsCustomCertificateHandling) { return; } - using (var client = new HttpClient(new HttpClientHandler() { ServerCertificateCustomValidationCallback = delegate { return true; } })) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.ServerCertificateCustomValidationCallback = delegate { return true; }; + using (var client = new HttpClient(handler)) { await Assert.ThrowsAsync(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer)); } @@ -375,12 +386,14 @@ namespace System.Net.Http.Functional.Tests [PlatformSpecific(~TestPlatforms.OSX)] public async Task SSLBackendNotSupported_Revocation_ThrowsPlatformNotSupportedException() { - if (BackendSupportsCustomCertificateHandling) // can't use [Conditional*] right now as it's evaluated at the wrong time for the managed handler + if (BackendSupportsCustomCertificateHandling) { return; } - using (var client = new HttpClient(new HttpClientHandler() { CheckCertificateRevocationList = true })) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.CheckCertificateRevocationList = true; + using (var client = new HttpClient(handler)) { await Assert.ThrowsAsync(() => client.GetAsync(Configuration.Http.SecureRemoteEchoServer)); } @@ -392,7 +405,7 @@ namespace System.Net.Http.Functional.Tests public async Task PostAsync_Post_ChannelBinding_ConfiguredCorrectly() { var content = new ChannelBindingAwareContent("Test contest"); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.PostAsync(Configuration.Http.SecureRemoteEchoServer, content)) { // Validate status. diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Unix.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Unix.cs index 83b32ec77f..56377d5e69 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Unix.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Unix.cs @@ -16,11 +16,11 @@ namespace System.Net.Http.Functional.Tests { public partial class HttpClientHandler_SslProtocols_Test { - private static bool BackendSupportsSslConfiguration => - ManagedHandlerTestHelpers.IsEnabled || + private bool BackendSupportsSslConfiguration => + UseManagedHandler || (CurlSslVersionDescription()?.StartsWith("OpenSSL") ?? false); - private static bool SSLv3DisabledByDefault => + private bool SSLv3DisabledByDefault => BackendSupportsSslConfiguration || Version.Parse(CurlVersionDescription()) >= new Version(7, 39); // libcurl disables SSLv3 by default starting in v7.39 diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Windows.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Windows.cs index 8f390f1288..28b5e9c8ce 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Windows.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.Windows.cs @@ -2,20 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.IO; -using System.Net.Security; -using System.Net.Sockets; -using System.Net.Test.Common; -using System.Runtime.InteropServices; -using System.Security.Authentication; -using System.Threading; -using System.Threading.Tasks; -using Xunit; namespace System.Net.Http.Functional.Tests { - using Configuration = System.Net.Test.Common.Configuration; - public partial class HttpClientHandler_SslProtocols_Test { private static bool BackendSupportsSslConfiguration => true; diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs index aa8b5d6f36..d7cb6c3a0f 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.SslProtocols.cs @@ -4,11 +4,8 @@ using System.IO; using System.Net.Security; -using System.Net.Sockets; using System.Net.Test.Common; -using System.Runtime.InteropServices; using System.Security.Authentication; -using System.Threading; using System.Threading.Tasks; using Xunit; @@ -18,12 +15,12 @@ namespace System.Net.Http.Functional.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "SslProtocols not supported on UAP")] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #16805")] - public partial class HttpClientHandler_SslProtocols_Test + public partial class HttpClientHandler_SslProtocols_Test : HttpClientTestBase { [Fact] public void DefaultProtocols_MatchesExpected() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Equal(SslProtocols.None, handler.SslProtocols); } @@ -40,7 +37,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12)] public void SetGetProtocols_Roundtrips(SslProtocols protocols) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { handler.SslProtocols = protocols; Assert.Equal(protocols, handler.SslProtocols); @@ -48,12 +45,18 @@ namespace System.Net.Http.Functional.Tests } [OuterLoop] // TODO: Issue #11345 - [ConditionalFact(nameof(BackendSupportsSslConfiguration))] + [Fact] public async Task SetProtocols_AfterRequest_ThrowsException() { - using (var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates }) + if (!BackendSupportsSslConfiguration) + { + return; + } + + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates; await LoopbackServer.CreateServerAsync(async (server, url) => { await TestHelper.WhenAllCompletedOrAnyFailed( @@ -75,14 +78,14 @@ namespace System.Net.Http.Functional.Tests #pragma warning restore 0618 public void DisabledProtocols_SetSslProtocols_ThrowsException(SslProtocols disabledProtocols) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Throws(() => handler.SslProtocols = disabledProtocols); } } [OuterLoop] // TODO: Issue #11345 - [ConditionalTheory(nameof(BackendSupportsSslConfiguration))] + [Theory] [InlineData(SslProtocols.Tls, false)] [InlineData(SslProtocols.Tls, true)] [InlineData(SslProtocols.Tls11, false)] @@ -91,15 +94,21 @@ namespace System.Net.Http.Functional.Tests [InlineData(SslProtocols.Tls12, true)] public async Task GetAsync_AllowedSSLVersion_Succeeds(SslProtocols acceptedProtocol, bool requestOnlyThisProtocol) { - if (ManagedHandlerTestHelpers.IsEnabled) + if (!BackendSupportsSslConfiguration) { - // TODO #21452: The managed handler is failing. + return; + } + if (UseManagedHandler) + { + // TODO #23138: The managed handler is failing. return; } - using (var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates }) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates; + if (requestOnlyThisProtocol) { handler.SslProtocols = acceptedProtocol; @@ -130,13 +139,13 @@ namespace System.Net.Http.Functional.Tests [MemberData(nameof(SupportedSSLVersionServers))] public async Task GetAsync_SupportedSSLVersion_Succeeds(SslProtocols sslProtocols, string url) { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The managed handler is failing. + // TODO #23138: The managed handler is failing. return; } - using (HttpClientHandler handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { if (PlatformDetection.IsCentos7) { @@ -162,30 +171,38 @@ namespace System.Net.Http.Functional.Tests // when trying to use such an SslStream, we can't stand up a localhost server that // only speaks those protocols. [OuterLoop("Avoid www.ssllabs.com dependency in innerloop.")] - [ConditionalTheory(nameof(SSLv3DisabledByDefault))] + [Theory] [MemberData(nameof(NotSupportedSSLVersionServers))] public async Task GetAsync_UnsupportedSSLVersion_Throws(string name, string url) { - if (ManagedHandlerTestHelpers.IsEnabled && !PlatformDetection.IsWindows10Version1607OrGreater) + if (!SSLv3DisabledByDefault) + { + return; + } + + if (UseManagedHandler && !PlatformDetection.IsWindows10Version1607OrGreater) { // On Windows, https://github.com/dotnet/corefx/issues/21925#issuecomment-313408314 // On Linux, an older version of OpenSSL may permit negotiating SSLv3. return; } - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { await Assert.ThrowsAsync(() => client.GetAsync(url)); } } [OuterLoop] // TODO: Issue #11345 - [ConditionalFact(nameof(BackendSupportsSslConfiguration), nameof(SslDefaultsToTls12))] + [ConditionalFact(nameof(SslDefaultsToTls12))] public async Task GetAsync_NoSpecifiedProtocol_DefaultsToTls12() { - using (var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates }) + if (!BackendSupportsSslConfiguration) return; + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates; + var options = new LoopbackServer.Options { UseSsl = true }; await LoopbackServer.CreateServerAsync(async (server, url) => { @@ -202,16 +219,20 @@ namespace System.Net.Http.Functional.Tests } [OuterLoop] // TODO: Issue #11345 - [ConditionalTheory(nameof(BackendSupportsSslConfiguration))] + [Theory] [InlineData(SslProtocols.Tls11, SslProtocols.Tls, typeof(IOException))] [InlineData(SslProtocols.Tls12, SslProtocols.Tls11, typeof(IOException))] [InlineData(SslProtocols.Tls, SslProtocols.Tls12, typeof(AuthenticationException))] public async Task GetAsync_AllowedSSLVersionDiffersFromServer_ThrowsException( SslProtocols allowedProtocol, SslProtocols acceptedProtocol, Type exceptedServerException) { - using (var handler = new HttpClientHandler() { SslProtocols = allowedProtocol, ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates }) + if (!BackendSupportsSslConfiguration) return; + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.SslProtocols = allowedProtocol; + handler.ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates; + var options = new LoopbackServer.Options { UseSsl = true, SslProtocols = acceptedProtocol }; await LoopbackServer.CreateServerAsync(async (server, url) => { @@ -227,9 +248,12 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_DisallowTls10_AllowTls11_AllowTls12() { - using (var handler = new HttpClientHandler() { SslProtocols = SslProtocols.Tls11 | SslProtocols.Tls12, ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates }) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.SslProtocols = SslProtocols.Tls11 | SslProtocols.Tls12; + handler.ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates; + if (BackendSupportsSslConfiguration) { LoopbackServer.Options options = new LoopbackServer.Options { UseSsl = true }; diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs index f6036491af..9f2aa8db2f 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs @@ -7,11 +7,9 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Sockets; -using System.Net.Security; using System.Net.Test.Common; using System.Runtime.InteropServices; using System.Security.Authentication; -using System.Security.Authentication.ExtendedProtection; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; @@ -26,7 +24,7 @@ namespace System.Net.Http.Functional.Tests // Note: Disposing the HttpClient object automatically disposes the handler within. So, it is not necessary // to separately Dispose (or have a 'using' statement) for the handler. - public class HttpClientHandlerTest : RemoteExecutorTestBase + public class HttpClientHandlerTest : HttpClientTestBase { readonly ITestOutputHelper _output; private const string ExpectedContent = "Test contest"; @@ -67,6 +65,28 @@ namespace System.Net.Http.Functional.Tests new object[] { 307 } }; + public static readonly object[][] RedirectStatusCodesOldMethodsNewMethods = { + new object[] { 300, "GET", "GET" }, + new object[] { 300, "POST", "GET" }, + new object[] { 300, "HEAD", "HEAD" }, + + new object[] { 301, "GET", "GET" }, + new object[] { 301, "POST", "GET" }, + new object[] { 301, "HEAD", "HEAD" }, + + new object[] { 302, "GET", "GET" }, + new object[] { 302, "POST", "GET" }, + new object[] { 302, "HEAD", "HEAD" }, + + new object[] { 303, "GET", "GET" }, + new object[] { 303, "POST", "GET" }, + new object[] { 303, "HEAD", "HEAD" }, + + new object[] { 307, "GET", "GET" }, + new object[] { 307, "POST", "POST" }, + new object[] { 307, "HEAD", "HEAD" }, + }; + // Standard HTTP methods defined in RFC7231: http://tools.ietf.org/html/rfc7231#section-4.3 // "GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "TRACE" public static readonly IEnumerable HttpMethods = @@ -104,7 +124,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Ctor_ExpectedDefaultPropertyValues_CommonPlatform() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { // Same as .NET Framework (Desktop). Assert.Equal(DecompressionMethods.None, handler.AutomaticDecompression); @@ -114,6 +134,7 @@ namespace System.Net.Http.Functional.Tests Assert.NotNull(cookies); Assert.Equal(0, cookies.Count); Assert.Null(handler.Credentials); + Assert.Equal(50, handler.MaxAutomaticRedirections); Assert.NotNull(handler.Properties); Assert.Equal(null, handler.Proxy); Assert.True(handler.SupportsAutomaticDecompression); @@ -127,10 +148,9 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Ctor_ExpectedDefaultPropertyValues_NotUapPlatform() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { // Same as .NET Framework (Desktop). - Assert.Equal(50, handler.MaxAutomaticRedirections); Assert.Equal(64, handler.MaxResponseHeadersLength); Assert.False(handler.PreAuthenticate); Assert.True(handler.SupportsProxy); @@ -146,13 +166,12 @@ namespace System.Net.Http.Functional.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsUap))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsUap))] public void Ctor_ExpectedDefaultPropertyValues_UapPlatform() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.True(handler.CheckCertificateRevocationList); - Assert.Equal(10, handler.MaxAutomaticRedirections); Assert.Equal(0, handler.MaxRequestContentBufferSize); Assert.Equal(-1, handler.MaxResponseHeadersLength); Assert.True(handler.PreAuthenticate); @@ -165,7 +184,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Credentials_SetGet_Roundtrips() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { var creds = new NetworkCredential("username", "password", "domain"); @@ -180,12 +199,23 @@ namespace System.Net.Http.Functional.Tests } } + [Theory] + [InlineData(-1)] + [InlineData(0)] + public void MaxAutomaticRedirections_InvalidValue_Throws(int redirects) + { + using (HttpClientHandler handler = CreateHttpClientHandler()) + { + Assert.Throws(() => handler.MaxAutomaticRedirections = redirects); + } + } + [Theory] [InlineData(-1)] [InlineData((long)int.MaxValue + (long)1)] public void MaxRequestContentBufferSize_SetInvalidValue_ThrowsArgumentOutOfRangeException(long value) { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { Assert.Throws(() => handler.MaxRequestContentBufferSize = value); } @@ -197,7 +227,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task UseDefaultCredentials_SetToFalseAndServerNeedsAuth_StatusCodeUnauthorized(bool useProxy) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.UseProxy = useProxy; handler.UseDefaultCredentials = false; using (var client = new HttpClient(handler)) @@ -214,7 +244,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Properties_Get_CountIsZero() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { IDictionary dict = handler.Properties; Assert.Same(dict, handler.Properties); @@ -225,7 +255,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Properties_AddItemToDictionary_ItemPresent() { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) { IDictionary dict = handler.Properties; @@ -242,7 +272,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(EchoServers))] public async Task SendAsync_SimpleGet_Success(Uri remoteServer) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.GetAsync(remoteServer)) { string responseContent = await response.Content.ReadAsStringAsync(); @@ -260,7 +290,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_IPv6LinkLocalAddressUri_Success() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var options = new LoopbackServer.Options { Address = LoopbackServer.GetIPv6LinkLocalAddress() }; await LoopbackServer.CreateServerAsync(async (server, url) => @@ -278,7 +308,7 @@ namespace System.Net.Http.Functional.Tests [MemberData(nameof(GetAsync_IPBasedUri_Success_MemberData))] public async Task GetAsync_IPBasedUri_Success(IPAddress address) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var options = new LoopbackServer.Options { Address = address }; await LoopbackServer.CreateServerAsync(async (server, url) => @@ -306,7 +336,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task SendAsync_MultipleRequestsReusingSameClient_Success() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { for (int i = 0; i < 3; i++) { @@ -322,7 +352,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_ResponseContentAfterClientAndHandlerDispose_Success() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.SecureRemoteEchoServer)) { client.Dispose(); @@ -339,7 +369,7 @@ namespace System.Net.Http.Functional.Tests { var cts = new CancellationTokenSource(); cts.Cancel(); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var request = new HttpRequestMessage(HttpMethod.Post, Configuration.Http.RemoteEchoServer); OperationCanceledException ex = await Assert.ThrowsAnyAsync(() => @@ -357,7 +387,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(CompressedServers))] public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed(Uri server) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; using (var client = new HttpClient(handler)) { @@ -379,7 +409,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(CompressedServers))] public async Task GetAsync_SetAutomaticDecompression_HeadersRemoved(Uri server) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; using (var client = new HttpClient(handler)) using (HttpResponseMessage response = await client.GetAsync(server, HttpCompletionOption.ResponseHeadersRead)) @@ -395,7 +425,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_ServerNeedsBasicAuthAndSetDefaultCredentials_StatusCodeUnauthorized() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Credentials = CredentialCache.DefaultCredentials; using (var client = new HttpClient(handler)) { @@ -411,7 +441,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_ServerNeedsAuthAndSetCredential_StatusCodeOK() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Credentials = _credential; using (var client = new HttpClient(handler)) { @@ -430,9 +460,9 @@ namespace System.Net.Http.Functional.Tests // UAP HTTP stack caches connections per-process. This causes interference when these tests run in // the same process as the other tests. Each test needs to be isolated to its own process. // See dicussion: https://github.com/dotnet/corefx/issues/21945 - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { - using (var client = new HttpClient()) + using (var client = CreateHttpClient(useManagedHandlerString)) { Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: Username, password: Password); using (HttpResponseMessage response = await client.GetAsync(uri)) @@ -442,7 +472,7 @@ namespace System.Net.Http.Functional.Tests return SuccessExitCode; } - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [OuterLoop] // TODO: Issue #11345 @@ -456,15 +486,15 @@ namespace System.Net.Http.Functional.Tests _output.WriteLine(responseHeaders); await LoopbackServer.CreateServerAsync(async (server, url) => { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Credentials = new NetworkCredential("unused", "unused"); using (var client = new HttpClient(handler)) { - Task getResponse = client.GetAsync(url); + Task getResponseTask = client.GetAsync(url); + Task> serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(server, responseHeaders); - await LoopbackServer.ReadRequestAndSendResponseAsync(server, responseHeaders); - - using (HttpResponseMessage response = await getResponse) + await TestHelper.WhenAllCompletedOrAnyFailed(getResponseTask, serverTask); + using (HttpResponseMessage response = await getResponseTask) { Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); } @@ -476,7 +506,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(RedirectStatusCodes))] public async Task GetAsync_AllowAutoRedirectFalse_RedirectFromHttpToHttp_StatusCodeRedirect(int statusCode) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AllowAutoRedirect = false; using (var client = new HttpClient(handler)) { @@ -494,11 +524,54 @@ namespace System.Net.Http.Functional.Tests } } + [ActiveIssue(23769)] + [ActiveIssue(22707, TestPlatforms.AnyUnix)] + [OuterLoop] // TODO: Issue #11345 + [Theory, MemberData(nameof(RedirectStatusCodesOldMethodsNewMethods))] + public async Task AllowAutoRedirect_True_ValidateNewMethodUsedOnRedirection( + int statusCode, string oldMethod, string newMethod) + { + HttpClientHandler handler = CreateHttpClientHandler(); + using (var client = new HttpClient(handler)) + { + await LoopbackServer.CreateServerAsync(async (origServer, origUrl) => + { + var request = new HttpRequestMessage(new HttpMethod(oldMethod), origUrl); + + Task getResponseTask = client.SendAsync(request); + + Task> serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(origServer, + $"HTTP/1.1 {statusCode} OK\r\n" + + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + + $"Location: {origUrl}\r\n" + + "\r\n"); + await Task.WhenAny(getResponseTask, serverTask); + Assert.False(getResponseTask.IsCompleted, $"{getResponseTask.Status}: {getResponseTask.Exception}"); + await serverTask; + + serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(origServer, + $"HTTP/1.1 200 OK\r\n" + + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + + "\r\n"); + await TestHelper.WhenAllCompletedOrAnyFailed(getResponseTask, serverTask); + + List receivedRequest = await serverTask; + string[] statusLineParts = receivedRequest[0].Split(' '); + + using (HttpResponseMessage response = await getResponseTask) + { + Assert.Equal(200, (int)response.StatusCode); + Assert.Equal(newMethod, statusLineParts[0]); + } + }); + } + } + [OuterLoop] // TODO: Issue #11345 [Theory, MemberData(nameof(RedirectStatusCodes))] public async Task GetAsync_AllowAutoRedirectTrue_RedirectFromHttpToHttp_StatusCodeOK(int statusCode) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AllowAutoRedirect = true; using (var client = new HttpClient(handler)) { @@ -520,7 +593,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_AllowAutoRedirectTrue_RedirectFromHttpToHttps_StatusCodeOK() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AllowAutoRedirect = true; using (var client = new HttpClient(handler)) { @@ -543,7 +616,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_AllowAutoRedirectTrue_RedirectFromHttpsToHttp_StatusCodeRedirect() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AllowAutoRedirect = true; using (var client = new HttpClient(handler)) { @@ -553,23 +626,11 @@ namespace System.Net.Http.Functional.Tests destinationUri: Configuration.Http.RemoteEchoServer, hops: 1); _output.WriteLine("Uri: {0}", uri); - - if (PlatformDetection.IsUap) + + using (HttpResponseMessage response = await client.GetAsync(uri)) { - // UAP platform does not allow redirecting from HTTPS to HTTP (same as .NET Core). - // But in addition, it will throw an exception - // - // HttpRequestException: "An error occurred while sending the request." - // COMException: "A redirect request will change a secure to a non-secure connection" - await Assert.ThrowsAsync(() => client.GetAsync(uri)); - } - else - { - using (HttpResponseMessage response = await client.GetAsync(uri)) - { - Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); - Assert.Equal(uri, response.RequestMessage.RequestUri); - } + Assert.Equal(HttpStatusCode.Redirect, response.StatusCode); + Assert.Equal(uri, response.RequestMessage.RequestUri); } } } @@ -578,7 +639,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_AllowAutoRedirectTrue_RedirectToUriWithParams_RequestMsgUriSet() { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.AllowAutoRedirect = true; Uri targetUri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: Username, password: Password); using (var client = new HttpClient(handler)) @@ -619,7 +680,9 @@ namespace System.Net.Http.Functional.Tests return; } - using (var client = new HttpClient(new HttpClientHandler() { MaxAutomaticRedirections = maxHops })) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.MaxAutomaticRedirections = maxHops; + using (var client = new HttpClient(handler)) { Task t = client.GetAsync(Configuration.Http.RedirectUriForDestinationUri( secure: false, @@ -646,7 +709,9 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_AllowAutoRedirectTrue_RedirectWithRelativeLocation() { - using (var client = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = true })) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.AllowAutoRedirect = true; + using (var client = new HttpClient(handler)) { Uri uri = Configuration.Http.RedirectUriForDestinationUri( secure: false, @@ -671,24 +736,27 @@ namespace System.Net.Http.Functional.Tests [InlineData(400)] public async Task GetAsync_AllowAutoRedirectTrue_NonRedirectStatusCode_LocationHeader_NoRedirect(int statusCode) { - using (var handler = new HttpClientHandler() { AllowAutoRedirect = true }) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.AllowAutoRedirect = true; using (var client = new HttpClient(handler)) { await LoopbackServer.CreateServerAsync(async (origServer, origUrl) => { await LoopbackServer.CreateServerAsync(async (redirectServer, redirectUrl) => { - Task getResponse = client.GetAsync(origUrl); + Task getResponseTask = client.GetAsync(origUrl); Task redirectTask = LoopbackServer.ReadRequestAndSendResponseAsync(redirectServer); - await LoopbackServer.ReadRequestAndSendResponseAsync(origServer, + await TestHelper.WhenAllCompletedOrAnyFailed( + getResponseTask, + LoopbackServer.ReadRequestAndSendResponseAsync(origServer, $"HTTP/1.1 {statusCode} OK\r\n" + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + $"Location: {redirectUrl}\r\n" + - "\r\n"); + "\r\n")); - using (HttpResponseMessage response = await getResponse) + using (HttpResponseMessage response = await getResponseTask) { Assert.Equal(statusCode, (int)response.StatusCode); Assert.Equal(origUrl, response.RequestMessage.RequestUri); @@ -710,7 +778,8 @@ namespace System.Net.Http.Functional.Tests public async Task GetAsync_AllowAutoRedirectTrue_RetainsOriginalFragmentIfAppropriate( string origFragment, string redirFragment, string expectedFragment, bool useRelativeRedirect) { - using (var handler = new HttpClientHandler() { AllowAutoRedirect = true }) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.AllowAutoRedirect = true; using (var client = new HttpClient(handler)) { await LoopbackServer.CreateServerAsync(async (origServer, origUrl) => @@ -744,17 +813,10 @@ namespace System.Net.Http.Functional.Tests } } - [OuterLoop] // TODO: Issue #11345 [Fact] public async Task GetAsync_CredentialIsNetworkCredentialUriRedirect_StatusCodeUnauthorized() { - if (ManagedHandlerTestHelpers.IsEnabled) - { - // TODO #21452: The managed handler is currently getting Ok when it should be getting Unauthorized. - return; - } - - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.Credentials = _credential; using (var client = new HttpClient(handler)) { @@ -785,7 +847,7 @@ namespace System.Net.Http.Functional.Tests var credentialCache = new CredentialCache(); credentialCache.Add(uri, "Basic", _credential); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); if (PlatformDetection.IsUap) { // UAP does not support CredentialCache for Credentials. @@ -809,7 +871,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_DefaultCoookieContainer_NoCookieSent() { - using (HttpClient client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { using (HttpResponseMessage httpResponse = await client.GetAsync(Configuration.Http.RemoteEchoServer)) { @@ -825,7 +887,7 @@ namespace System.Net.Http.Functional.Tests [InlineData("cookieName1", "cookieValue1")] public async Task GetAsync_SetCookieContainer_CookieSent(string cookieName, string cookieValue) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); var cookieContainer = new CookieContainer(); cookieContainer.Add(Configuration.Http.RemoteEchoServer, new Cookie(cookieName, cookieValue)); handler.CookieContainer = cookieContainer; @@ -841,7 +903,6 @@ namespace System.Net.Http.Functional.Tests } } - [ActiveIssue(9003, TargetFrameworkMonikers.Uap)] [OuterLoop] // TODO: Issue #11345 [Theory] [InlineData("cookieName1", "cookieValue1")] @@ -852,7 +913,7 @@ namespace System.Net.Http.Functional.Tests statusCode: 302, destinationUri: Configuration.Http.RemoteEchoServer, hops: 1); - using (HttpClient client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { client.DefaultRequestHeaders.Add( "X-SetCookie", @@ -871,7 +932,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(HeaderWithEmptyValueAndUris))] public async Task GetAsync_RequestHeadersAddCustomHeaders_HeaderAndEmptyValueSent(string name, string value, Uri uri) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { _output.WriteLine($"name={name}, value={value}"); client.DefaultRequestHeaders.Add(name, value); @@ -889,7 +950,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(HeaderValueAndUris))] public async Task GetAsync_RequestHeadersAddCustomHeaders_HeaderAndValueSent(string name, string value, Uri uri) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { _output.WriteLine($"name={name}, value={value}"); client.DefaultRequestHeaders.Add(name, value); @@ -959,20 +1020,21 @@ namespace System.Net.Http.Functional.Tests await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { - Task getResponse = client.GetAsync(url); - - await LoopbackServer.ReadRequestAndSendResponseAsync(server, + Task getResponseTask = client.GetAsync(url); + await TestHelper.WhenAllCompletedOrAnyFailed( + getResponseTask, + LoopbackServer.ReadRequestAndSendResponseAsync(server, $"HTTP/1.1 200 OK\r\n" + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + $"Set-Cookie: {cookie1.Key}={cookie1.Value}; Path=/\r\n" + $"Set-Cookie : {cookie2.Key}={cookie2.Value}; Path=/\r\n" + // space before colon to verify header is trimmed and recognized $"Set-Cookie: {cookie3.Key}={cookie3.Value}; Path=/\r\n" + - "\r\n"); + "\r\n")); - using (HttpResponseMessage response = await getResponse) + using (HttpResponseMessage response = await getResponseTask) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); CookieCollection cookies = handler.CookieContainer.GetCookies(url); @@ -993,20 +1055,21 @@ namespace System.Net.Http.Functional.Tests [InlineData(true)] public async Task GetAsync_TrailingHeaders_Ignored(bool includeTrailerHeader) { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The managed handler isn't correctly handling trailing headers. + // TODO #23130: The managed handler isn't correctly handling trailing headers. return; } await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { - Task getResponse = client.GetAsync(url); - - await LoopbackServer.ReadRequestAndSendResponseAsync(server, + Task getResponseTask = client.GetAsync(url); + await TestHelper.WhenAllCompletedOrAnyFailed( + getResponseTask, + LoopbackServer.ReadRequestAndSendResponseAsync(server, "HTTP/1.1 200 OK\r\n" + "Transfer-Encoding: chunked\r\n" + (includeTrailerHeader ? "Trailer: MyCoolTrailerHeader\r\n" : "") + @@ -1015,9 +1078,9 @@ namespace System.Net.Http.Functional.Tests "data\r\n" + "0\r\n" + "MyCoolTrailerHeader: amazingtrailer\r\n" + - "\r\n"); + "\r\n")); - using (HttpResponseMessage response = await getResponse) + using (HttpResponseMessage response = await getResponseTask) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); if (includeTrailerHeader) @@ -1030,11 +1093,42 @@ namespace System.Net.Http.Functional.Tests }); } + [OuterLoop] // TODO: Issue #11345 + [Theory] + [InlineData("")] // missing size + [InlineData("10000000000000000")] // overflowing size + public async Task GetAsync_InvalidChunkSize_ThrowsHttpRequestException(string chunkSize) + { + await LoopbackServer.CreateServerAsync(async (server, url) => + { + using (HttpClient client = CreateHttpClient()) + { + string partialResponse = "HTTP/1.1 200 OK\r\n" + + "Transfer-Encoding: chunked\r\n" + + "\r\n" + + $"{chunkSize}\r\n"; + + var tcs = new TaskCompletionSource(); + Task serverTask = + LoopbackServer.AcceptSocketAsync(server, async (s, stream, reader, writer) => + { + var list = await LoopbackServer.ReadWriteAcceptedAsync(s, reader, writer, partialResponse, shutdown: false); + await tcs.Task; + return list; + }, null); + + await Assert.ThrowsAsync(() => client.GetAsync(url)); + tcs.SetResult(true); + await serverTask; + } + }); + } + [OuterLoop] // TODO: Issue #11345 [Fact] public async Task GetAsync_ResponseHeadersRead_ReadFromEachIterativelyDoesntDeadlock() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { const int NumGets = 5; Task[] responseTasks = (from _ in Enumerable.Range(0, NumGets) @@ -1060,7 +1154,7 @@ namespace System.Net.Http.Functional.Tests public async Task SendAsync_HttpRequestMsgResponseHeadersRead_StatusCodeOK() { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Configuration.Http.SecureRemoteEchoServer); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { using (HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead)) { @@ -1082,7 +1176,7 @@ namespace System.Net.Http.Functional.Tests { await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Task getResponse = client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead); @@ -1117,9 +1211,9 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task Dispose_DisposingHandlerCancelsActiveOperationsWithoutResponses() { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The ManagedHandler isn't correctly handling disposal of the handler. + // TODO #23131: The ManagedHandler isn't correctly handling disposal of the handler. // It should cause the outstanding requests to be canceled with OperationCanceledExceptions, // whereas currently it's resulting in ObjectDisposedExceptions. return; @@ -1164,7 +1258,7 @@ namespace System.Net.Http.Functional.Tests // Make three requests Task get1, get2; HttpResponseMessage response3; - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { get1 = client.GetAsync(url1, HttpCompletionOption.ResponseHeadersRead); get2 = client.GetAsync(url2, HttpCompletionOption.ResponseHeadersRead); @@ -1186,32 +1280,6 @@ namespace System.Net.Http.Functional.Tests }); } - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(200)] - [InlineData(500)] - [InlineData(600)] - [InlineData(900)] - [InlineData(999)] - public async Task GetAsync_ExpectedStatusCode(int statusCode) - { - await LoopbackServer.CreateServerAsync(async (server, url) => - { - using (var client = new HttpClient()) - { - Task getResponse = client.GetAsync(url); - await LoopbackServer.ReadRequestAndSendResponseAsync(server, - $"HTTP/1.1 {statusCode}\r\n" + - $"Date: {DateTimeOffset.UtcNow:R}\r\n" + - "\r\n"); - using (HttpResponseMessage response = await getResponse) - { - Assert.Equal(statusCode, (int)response.StatusCode); - } - } - }); - } - [OuterLoop] // TODO: Issue #11345 [Theory] [InlineData(99)] @@ -1226,15 +1294,15 @@ namespace System.Net.Http.Functional.Tests await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { - Task getResponse = client.GetAsync(url); + Task getResponseTask = client.GetAsync(url); await LoopbackServer.ReadRequestAndSendResponseAsync(server, $"HTTP/1.1 {statusCode}\r\n" + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + "\r\n"); - await Assert.ThrowsAsync(() => getResponse); + await Assert.ThrowsAsync(() => getResponseTask); } }); } @@ -1245,7 +1313,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(VerifyUploadServers))] public async Task PostAsync_CallMethodTwice_StringContent(Uri remoteServer) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { string data = "Test String"; var content = new StringContent(data, Encoding.UTF8); @@ -1270,7 +1338,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(VerifyUploadServers))] public async Task PostAsync_CallMethod_UnicodeStringContent(Uri remoteServer) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { string data = "\ub4f1\uffc7\u4e82\u67ab4\uc6d4\ud1a0\uc694\uc77c\uffda3\u3155\uc218\uffdb"; var content = new StringContent(data, Encoding.UTF8); @@ -1287,7 +1355,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(VerifyUploadServersStreamsAndExpectedData))] public async Task PostAsync_CallMethod_StreamContent(Uri remoteServer, HttpContent content, byte[] expectedData) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { content.Headers.ContentMD5 = TestHelper.ComputeMD5Hash(expectedData); @@ -1428,7 +1496,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(EchoServers))] public async Task PostAsync_CallMethod_NullContent(Uri remoteServer) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { using (HttpResponseMessage response = await client.PostAsync(remoteServer, null)) { @@ -1449,7 +1517,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(EchoServers))] public async Task PostAsync_CallMethod_EmptyContent(Uri remoteServer) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var content = new StringContent(string.Empty); using (HttpResponseMessage response = await client.PostAsync(remoteServer, content)) @@ -1467,6 +1535,40 @@ namespace System.Net.Http.Functional.Tests } } + [OuterLoop] // TODO: Issue #11345 + [Theory] + [InlineData(false)] + [InlineData(true)] + [InlineData(null)] + public async Task PostAsync_ExpectContinue_Success(bool? expectContinue) + { + using (HttpClient client = CreateHttpClient()) + { + var req = new HttpRequestMessage(HttpMethod.Post, Configuration.Http.RemoteEchoServer) + { + Content = new StringContent("Test String", Encoding.UTF8) + }; + req.Headers.ExpectContinue = expectContinue; + + using (HttpResponseMessage response = await client.SendAsync(req)) + { + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + if (UseManagedHandler) + { + const string ExpectedReqHeader = "\"Expect\": \"100-continue\""; + if (expectContinue == true) + { + Assert.Contains(ExpectedReqHeader, await response.Content.ReadAsStringAsync()); + } + else + { + Assert.DoesNotContain(ExpectedReqHeader, await response.Content.ReadAsStringAsync()); + } + } + } + } + } + [OuterLoop] // TODO: Issue #11345 [Theory] [InlineData(false)] @@ -1481,7 +1583,7 @@ namespace System.Net.Http.Functional.Tests secure ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer, 1); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.PostAsync(redirectUri, content)) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -1491,6 +1593,7 @@ namespace System.Net.Http.Functional.Tests } } + [ActiveIssue(23768)] [ActiveIssue(22191, TargetFrameworkMonikers.Uap)] [OuterLoop] // takes several seconds [Fact] @@ -1518,7 +1621,7 @@ namespace System.Net.Http.Functional.Tests Uri redirectUri = Configuration.Http.RedirectUriForDestinationUri(false, statusCode, Configuration.Http.SecureRemoteEchoServer, 1); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.PostAsync(redirectUri, new StreamContent(fs))) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -1535,7 +1638,7 @@ namespace System.Net.Http.Functional.Tests public async Task PostAsync_ReuseRequestContent_Success(Uri remoteServer) { const string ContentString = "This is the content string."; - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var content = new StringContent(ContentString); for (int i = 0; i < 2; i++) @@ -1555,7 +1658,7 @@ namespace System.Net.Http.Functional.Tests [InlineData(HttpStatusCode.MethodNotAllowed, "")] public async Task GetAsync_CallMethod_ExpectedStatusLine(HttpStatusCode statusCode, string reasonPhrase) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.StatusCodeUri( false, @@ -1572,22 +1675,30 @@ namespace System.Net.Http.Functional.Tests #region Various HTTP Method Tests - [ActiveIssue(22161, TargetFrameworkMonikers.Uap)] [OuterLoop] // TODO: Issue #11345 [Theory, MemberData(nameof(HttpMethods))] public async Task SendAsync_SendRequestUsingMethodToEchoServerWithNoContent_MethodCorrectlySent( string method, bool secureServer) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var request = new HttpRequestMessage( new HttpMethod(method), secureServer ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer); - using (HttpResponseMessage response = await client.SendAsync(request)) + + if (PlatformDetection.IsUap && method == "TRACE") { - Assert.Equal(HttpStatusCode.OK, response.StatusCode); - TestHelper.VerifyRequestMethod(response, method); + HttpRequestException ex = await Assert.ThrowsAsync(() => client.SendAsync(request)); + Assert.IsType(ex.InnerException); + } + else + { + using (HttpResponseMessage response = await client.SendAsync(request)) + { + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + TestHelper.VerifyRequestMethod(response, method); + } } } } @@ -1605,7 +1716,7 @@ namespace System.Net.Http.Functional.Tests return; } - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var request = new HttpRequestMessage( new HttpMethod(method), @@ -1635,7 +1746,7 @@ namespace System.Net.Http.Functional.Tests [InlineData("12345678910", 5)] public async Task SendAsync_SendSameRequestMultipleTimesDirectlyOnHandler_Success(string stringContent, int startingPosition) { - using (var handler = new HttpMessageInvoker(new HttpClientHandler())) + using (var handler = new HttpMessageInvoker(CreateHttpClientHandler())) { byte[] byteContent = Encoding.ASCII.GetBytes(stringContent); var content = new MemoryStream(); @@ -1684,7 +1795,7 @@ namespace System.Net.Http.Functional.Tests return; } - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { var request = new HttpRequestMessage( new HttpMethod(method), @@ -1695,7 +1806,7 @@ namespace System.Net.Http.Functional.Tests using (HttpResponseMessage response = await client.SendAsync(request)) { - if (method == "TRACE" && (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || ManagedHandlerTestHelpers.IsEnabled)) + if (method == "TRACE" && (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || UseManagedHandler)) { // .NET Framework also allows the HttpWebRequest and HttpClient APIs to send a request using 'TRACE' // verb and a request body. The usual response from a server is "400 Bad Request". @@ -1720,12 +1831,6 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task SendAsync_RequestVersion10_ServerReceivesVersion10Request() { - if (ManagedHandlerTestHelpers.IsEnabled) - { - // TODO #21452: The test is hanging with the managed handler. - return; - } - Version receivedRequestVersion = await SendRequestAndGetRequestVersionAsync(new Version(1, 0)); Assert.Equal(new Version(1, 0), receivedRequestVersion); } @@ -1743,18 +1848,13 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task SendAsync_RequestVersionNotSpecified_ServerReceivesVersion11Request() { - if (ManagedHandlerTestHelpers.IsEnabled) - { - // TODO #21452: The test is hanging with the managed handler. - return; - } - // The default value for HttpRequestMessage.Version is Version(1,1). // So, we need to set something different (0,0), to test the "unknown" version. Version receivedRequestVersion = await SendRequestAndGetRequestVersionAsync(new Version(0, 0)); Assert.Equal(new Version(1, 1), receivedRequestVersion); } + [ActiveIssue(23770, TestPlatforms.AnyUnix)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Specifying Version(2,0) throws exception on netfx")] [OuterLoop] // TODO: Issue #11345 [Theory] @@ -1767,9 +1867,9 @@ namespace System.Net.Http.Functional.Tests _output.WriteLine("Skipping test due to Windows 10 version prior to Version 1703."); return; } - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The managed handler doesn't yet support HTTP/2. + // TODO #23134: The managed handler doesn't yet support HTTP/2. return; } @@ -1778,7 +1878,7 @@ namespace System.Net.Http.Functional.Tests var request = new HttpRequestMessage(HttpMethod.Get, server); request.Version = new Version(2, 0); - using (var handler = new HttpClientHandler()) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler, false)) { // It is generally expected that the test hosts will be trusted, so we don't register a validation @@ -1819,9 +1919,9 @@ namespace System.Net.Http.Functional.Tests [ConditionalTheory(nameof(IsWindows10Version1607OrGreater)), MemberData(nameof(Http2NoPushServers))] public async Task SendAsync_RequestVersion20_ResponseVersion20(Uri server) { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The managed handler doesn't yet support HTTP/2. + // TODO #23134: The managed handler doesn't yet support HTTP/2. return; } @@ -1829,7 +1929,7 @@ namespace System.Net.Http.Functional.Tests var request = new HttpRequestMessage(HttpMethod.Get, server); request.Version = new Version(2, 0); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); using (var client = new HttpClient(handler)) { using (HttpResponseMessage response = await client.SendAsync(request)) @@ -1849,12 +1949,13 @@ namespace System.Net.Http.Functional.Tests var request = new HttpRequestMessage(HttpMethod.Get, url); request.Version = requestVersion; - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Task getResponse = client.SendAsync(request); + Task> serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(server); + await TestHelper.WhenAllCompletedOrAnyFailed(getResponse, serverTask); - List receivedRequest = await LoopbackServer.ReadRequestAndSendResponseAsync(server); - + List receivedRequest = await serverTask; using (HttpResponseMessage response = await getResponse) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -1886,11 +1987,11 @@ namespace System.Net.Http.Functional.Tests [OuterLoop] // TODO: Issue #11345 [Theory] [MemberData(nameof(CredentialsForProxy))] - public void Proxy_BypassFalse_GetRequestGoesThroughCustomProxy(ICredentials creds, bool wrapCredsInCache) + public async Task Proxy_BypassFalse_GetRequestGoesThroughCustomProxy(ICredentials creds, bool wrapCredsInCache) { - if (ManagedHandlerTestHelpers.IsEnabled) + if (UseManagedHandler) { - // TODO #21452: The test is hanging with the managed handler for some of the theory inputs. + // TODO #23135: ManagedHandler currently gets error "System.NotImplementedException : Basic auth: can't handle ':' in domain "dom:\ain"" return; } @@ -1910,12 +2011,14 @@ namespace System.Net.Http.Functional.Tests creds = cache; } - using (var handler = new HttpClientHandler() { Proxy = new UseSpecifiedUriWebProxy(proxyUrl, creds) }) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.Proxy = new UseSpecifiedUriWebProxy(proxyUrl, creds); + Task responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer); Task responseStringTask = responseTask.ContinueWith(t => t.Result.Content.ReadAsStringAsync(), TaskScheduler.Default).Unwrap(); - Task.WaitAll(proxyTask, responseTask, responseStringTask); + await TestHelper.WhenAllCompletedOrAnyFailed(proxyTask, responseTask, responseStringTask); using (responseTask.Result) { @@ -1938,7 +2041,9 @@ namespace System.Net.Http.Functional.Tests [MemberData(nameof(BypassedProxies))] public async Task Proxy_BypassTrue_GetRequestDoesntGoesThroughCustomProxy(IWebProxy proxy) { - using (var client = new HttpClient(new HttpClientHandler() { Proxy = proxy })) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.Proxy = proxy; + using (var client = new HttpClient(handler)) using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer)) { TestHelper.VerifyResponseBody( @@ -1961,7 +2066,8 @@ namespace System.Net.Http.Functional.Tests expectCreds: false); Uri proxyUrl = new Uri($"http://localhost:{port}"); - using (var handler = new HttpClientHandler() { Proxy = new UseSpecifiedUriWebProxy(proxyUrl, null) }) + HttpClientHandler handler = CreateHttpClientHandler(); + handler.Proxy = new UseSpecifiedUriWebProxy(proxyUrl, null); using (var client = new HttpClient(handler)) { Task responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer); @@ -2002,13 +2108,14 @@ namespace System.Net.Http.Functional.Tests var request = new HttpRequestMessage(HttpMethod.Get, uri); string statusLine = string.Empty; - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { - Task getResponse = client.SendAsync(request); + Task getResponseTask = client.SendAsync(request); + Task> serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(server); - List receivedRequest = await LoopbackServer.ReadRequestAndSendResponseAsync(server); - - using (HttpResponseMessage response = await getResponse) + await TestHelper.WhenAllCompletedOrAnyFailed(getResponseTask, serverTask); + List receivedRequest = await serverTask; + using (HttpResponseMessage response = await getResponseTask) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.True(receivedRequest[0].Contains(uri.PathAndQuery), $"statusLine should contain {uri.PathAndQuery}"); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs index 2d4d07b15b..7866a00087 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientMiniStressTest.cs @@ -14,7 +14,7 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - public class HttpClientMiniStress + public class HttpClientMiniStress : HttpClientTestBase { private static bool HttpStressEnabled => Configuration.Http.StressEnabled; @@ -23,7 +23,7 @@ namespace System.Net.Http.Functional.Tests public void SingleClient_ManyGets_Sync(int numRequests, int dop, HttpCompletionOption completionOption) { string responseText = CreateResponse("abcdefghijklmnopqrstuvwxyz"); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Parallel.For(0, numRequests, new ParallelOptions { MaxDegreeOfParallelism = dop, TaskScheduler = new ThreadPerTaskScheduler() }, _ => { @@ -36,7 +36,7 @@ namespace System.Net.Http.Functional.Tests public async Task SingleClient_ManyGets_Async(int numRequests, int dop, HttpCompletionOption completionOption) { string responseText = CreateResponse("abcdefghijklmnopqrstuvwxyz"); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { await ForCountAsync(numRequests, dop, i => CreateServerAndGetAsync(client, completionOption, responseText)); } @@ -49,7 +49,7 @@ namespace System.Net.Http.Functional.Tests string responseText = CreateResponse("abcdefghijklmnopqrstuvwxyz"); Parallel.For(0, numRequests, new ParallelOptions { MaxDegreeOfParallelism = dop, TaskScheduler = new ThreadPerTaskScheduler() }, _ => { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { CreateServerAndGet(client, completionOption, responseText); } @@ -63,7 +63,7 @@ namespace System.Net.Http.Functional.Tests string responseText = CreateResponse(""); await ForCountAsync(numRequests, dop, async i => { - using (HttpClient client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { await CreateServerAndPostAsync(client, numBytes, responseText); } @@ -76,7 +76,7 @@ namespace System.Net.Http.Functional.Tests { for (int i = 0; i < numClients; i++) { - new HttpClient().Dispose(); + CreateHttpClient().Dispose(); } } @@ -86,7 +86,7 @@ namespace System.Net.Http.Functional.Tests { await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { client.Timeout = Timeout.InfiniteTimeSpan; @@ -193,7 +193,7 @@ namespace System.Net.Http.Functional.Tests { await LoopbackServer.CreateServerAsync(async (server, url) => { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Func> getAsync = async () => new WeakReference(await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead)); Task wrt = getAsync(); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs index 72e56853a8..5be76eb659 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs @@ -2,13 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Concurrent; -using System.Diagnostics; -using System.Diagnostics.Tracing; using System.IO; using System.Linq; using System.Net.Test.Common; -using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -16,14 +12,12 @@ using Xunit; namespace System.Net.Http.Functional.Tests { - using Configuration = System.Net.Test.Common.Configuration; - - public class HttpClientTest + public class HttpClientTest : HttpClientTestBase { [Fact] public void Dispose_MultipleTimes_Success() { - var client = new HttpClient(); + HttpClient client = CreateHttpClient(); client.Dispose(); client.Dispose(); } @@ -31,7 +25,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void DefaultRequestHeaders_Idempotent() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Assert.NotNull(client.DefaultRequestHeaders); Assert.Same(client.DefaultRequestHeaders, client.DefaultRequestHeaders); @@ -41,7 +35,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void BaseAddress_Roundtrip_Equal() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Assert.Null(client.BaseAddress); @@ -57,7 +51,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void BaseAddress_InvalidUri_Throws() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { AssertExtensions.Throws("value", () => client.BaseAddress = new Uri("ftp://onlyhttpsupported")); AssertExtensions.Throws("value", () => client.BaseAddress = new Uri("/onlyabsolutesupported", UriKind.Relative)); @@ -67,7 +61,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Timeout_Roundtrip_Equal() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { client.Timeout = Timeout.InfiniteTimeSpan; Assert.Equal(Timeout.InfiniteTimeSpan, client.Timeout); @@ -80,7 +74,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Timeout_OutOfRange_Throws() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { AssertExtensions.Throws("value", () => client.Timeout = TimeSpan.FromSeconds(-2)); AssertExtensions.Throws("value", () => client.Timeout = TimeSpan.FromSeconds(0)); @@ -91,7 +85,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void MaxResponseContentBufferSize_Roundtrip_Equal() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { client.MaxResponseContentBufferSize = 1; Assert.Equal(1, client.MaxResponseContentBufferSize); @@ -104,7 +98,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void MaxResponseContentBufferSize_OutOfRange_Throws() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { AssertExtensions.Throws("value", () => client.MaxResponseContentBufferSize = -1); AssertExtensions.Throws("value", () => client.MaxResponseContentBufferSize = 0); @@ -124,24 +118,28 @@ namespace System.Net.Http.Functional.Tests [InlineData(1000, 1000, false)] public async Task MaxResponseContentBufferSize_ThrowsIfTooSmallForContent(int maxSize, int contentLength, bool exceptionExpected) { - using (var client = new HttpClient() { MaxResponseContentBufferSize = maxSize }) + using (HttpClient client = CreateHttpClient()) { + client.MaxResponseContentBufferSize = maxSize; + await LoopbackServer.CreateServerAsync(async (server, url) => { - Task t = client.GetStringAsync(url); - await LoopbackServer.ReadRequestAndSendResponseAsync(server, + Task getTask = client.GetStringAsync(url); + Task serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(server, $"HTTP/1.1 200 OK\r\n" + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + $"Content-Length: {contentLength}\r\n" + "\r\n" + new string('s', contentLength)); + Task bothTasks = TestHelper.WhenAllCompletedOrAnyFailed(getTask, serverTask); + if (exceptionExpected) { - await Assert.ThrowsAsync(() => t); + await Assert.ThrowsAsync(() => bothTasks); } else { - await t; + await bothTasks; } }); } @@ -164,7 +162,7 @@ namespace System.Net.Http.Functional.Tests [InlineData("/something.html")] public void GetAsync_NoBaseAddress_InvalidUri_ThrowsException(string uri) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { Assert.Throws(() => { client.GetAsync(uri == null ? null : new Uri(uri, UriKind.RelativeOrAbsolute)); }); } @@ -251,7 +249,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_InvalidUrl_ExpectedExceptionThrown() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { await Assert.ThrowsAsync(() => client.GetAsync(CreateFakeUri())); await Assert.ThrowsAsync(() => client.GetStringAsync(CreateFakeUri())); @@ -361,7 +359,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Dispose_UseAfterDispose_Throws() { - var client = new HttpClient(); + HttpClient client = CreateHttpClient(); client.Dispose(); Assert.Throws(() => client.BaseAddress = null); @@ -409,8 +407,10 @@ namespace System.Net.Http.Functional.Tests [OuterLoop("One second delay in getting server's response")] public async Task Timeout_SetTo30AndGetResponseFromLoopbackQuickly_Success() { - using (var client = new HttpClient() { Timeout = TimeSpan.FromSeconds(30) }) + using (HttpClient client = CreateHttpClient()) { + client.Timeout = TimeSpan.FromSeconds(30); + await LoopbackServer.CreateServerAsync(async (server, url) => { Task getTask = client.GetStringAsync(url); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTestBase.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTestBase.cs new file mode 100644 index 0000000000..c8220d916b --- /dev/null +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpClientTestBase.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Threading; + +namespace System.Net.Http.Functional.Tests +{ + public abstract class HttpClientTestBase : RemoteExecutorTestBase + { + private const string ManagedHandlerEnvVar = "COMPlus_UseManagedHttpClientHandler"; + private static readonly LocalDataStoreSlot s_managedHandlerSlot; + + static HttpClientTestBase() + { + s_managedHandlerSlot = Thread.GetNamedDataSlot(ManagedHandlerEnvVar); + if (s_managedHandlerSlot == null) + { + try + { + s_managedHandlerSlot = Thread.AllocateNamedDataSlot(ManagedHandlerEnvVar); + } + catch (ArgumentException) + { + s_managedHandlerSlot = Thread.GetNamedDataSlot(ManagedHandlerEnvVar); + } + } + Debug.Assert(s_managedHandlerSlot != null); + } + + protected virtual bool UseManagedHandler => false; + + protected HttpClient CreateHttpClient() => new HttpClient(CreateHttpClientHandler()); + + protected HttpClientHandler CreateHttpClientHandler() => CreateHttpClientHandler(UseManagedHandler); + + protected static HttpClient CreateHttpClient(string useManagedHandlerBoolString) => + new HttpClient(CreateHttpClientHandler(useManagedHandlerBoolString)); + + protected static HttpClientHandler CreateHttpClientHandler(string useManagedHandlerBoolString) => + CreateHttpClientHandler(bool.Parse(useManagedHandlerBoolString)); + + protected static HttpClientHandler CreateHttpClientHandler(bool useManagedHandler) => + useManagedHandler ? CreateManagedHttpClientHandler() : new HttpClientHandler(); + + private static HttpClientHandler CreateManagedHttpClientHandler() + { + try + { + Thread.SetData(s_managedHandlerSlot, true); + return new HttpClientHandler(); + } + finally + { + Thread.SetData(s_managedHandlerSlot, null); + } + } + } +} diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs new file mode 100644 index 0000000000..6df3d74381 --- /dev/null +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/HttpProtocolTests.cs @@ -0,0 +1,143 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Net.Test.Common; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.Net.Http.Functional.Tests +{ + public class HttpProtocolTests : HttpClientTest + { + protected virtual Stream GetStream(Stream s) => s; + + [Theory] + [InlineData("HTTP/1.1 200 OK", 200, "OK")] + [InlineData("HTTP/1.1 200 Sure why not?", 200, "Sure why not?")] + [InlineData("HTTP/1.1 200 OK\x0080", 200, "OK?")] + [InlineData("HTTP/1.1 200 O K", 200, "O K")] + [InlineData("HTTP/1.1 201 Created", 201, "Created")] + [InlineData("HTTP/1.1 202 Accepted", 202, "Accepted")] + [InlineData("HTTP/1.1 299 This is not a real status code", 299, "This is not a real status code")] + [InlineData("HTTP/1.1 345 redirect to nowhere", 345, "redirect to nowhere")] + [InlineData("HTTP/1.1 400 Bad Request", 400, "Bad Request")] + [InlineData("HTTP/1.1 500 Internal Server Error", 500, "Internal Server Error")] + [InlineData("HTTP/1.1 555 we just don't like you", 555, "we just don't like you")] + [InlineData("HTTP/1.1 600 still valid", 600, "still valid")] + // TODO #24713: The following pass on Windows on .NET Core but fail on .NET Framework. + //[InlineData("HTTP/1.1 200 ", 200, "")] + //[InlineData("HTTP/1.1 200 Something", 200, "Something")] + //[InlineData("HTTP/1.1\t200 OK", 200, "OK")] + //[InlineData("HTTP/1.1 200\tOK", 200, "OK")] + //[InlineData("HTTP/1.1 200", 200, "")] + //[InlineData("HTTP/1.1 200\t", 200, "")] + //[InlineData("HTTP/1.1 200 O\tK", 200, "O\tK")] + //[InlineData("HTTP/1.1 200 O \t\t \t\t\t\t \t K", 200, "O \t\t \t\t\t\t \t K")] + //[InlineData("HTTP/1.1 999 this\ttoo\t", 999, "this\ttoo\t")] + public async Task GetAsync_ExpectedStatusCodeAndReason_Success(string statusLine, int expectedStatusCode, string expectedReason) + { + await LoopbackServer.CreateServerAsync(async (server, url) => + { + using (HttpClient client = CreateHttpClient()) + { + Task getResponseTask = client.GetAsync(url); + await TestHelper.WhenAllCompletedOrAnyFailed( + getResponseTask, + LoopbackServer.ReadRequestAndSendResponseAsync(server, + $"{statusLine}\r\n" + + $"Date: {DateTimeOffset.UtcNow:R}\r\n" + + "\r\n", + new LoopbackServer.Options { ResponseStreamWrapper = GetStream })); + using (HttpResponseMessage response = await getResponseTask) + { + Assert.Equal(expectedStatusCode, (int)response.StatusCode); + Assert.Equal(expectedReason, response.ReasonPhrase); + } + } + }); + } + + [Theory] + [InlineData("HTTP/1.1 2345")] + [InlineData("HTTP/A.1 200 OK")] + [InlineData("HTTP/X.Y.Z 200 OK")] + // TODO #24713: The following pass on Windows on .NET Core but fail on .NET Framework. + //[InlineData("HTTP/0.1 200 OK")] + //[InlineData("HTTP/3.5 200 OK")] + //[InlineData("HTTP/1.12 200 OK")] + //[InlineData("HTTP/12.1 200 OK")] + // TODO #24713: The following pass on Windows on .NET Core but fail on UWP / WinRT. + //[InlineData("HTTP/1.1 200 O\nK")] + //[InlineData("HTTP/1.1 200OK")] + //[InlineData("HTTP/1.1 20c")] + //[InlineData("HTTP/1.1 23")] + //[InlineData("HTTP/1.1 2bc")] + // TODO #24713: The following pass on Windows but fail on CurlHandler on Linux. + //[InlineData("NOTHTTP/1.1")] + //[InlineData("HTTP/1.A 200 OK")] + //[InlineData("HTTP 1.1 200 OK")] + //[InlineData("ABCD/1.1 200 OK")] + //[InlineData("HTTP/1.1")] + //[InlineData("HTTP\\1.1 200 OK")] + //[InlineData("HTTP/1.1 ")] + //[InlineData("HTTP/1.1 !11")] + //[InlineData("HTTP/1.1 a11")] + //[InlineData("HTTP/1.1 abc")] + //[InlineData("HTTP/1.1 200 O\rK")] + //[InlineData("HTTP/1.1\t\t")] + //[InlineData("HTTP/1.1\t")] + //[InlineData("HTTP/1.1 ")] + //[InlineData("NOTHTTP/1.1 200 OK")] + public async Task GetAsync_InvalidStatusLine_ThrowsException(string responseString) + { + await LoopbackServer.CreateServerAsync(async (server, url) => + { + using (HttpClient client = CreateHttpClient()) + { + Task ignoredServerTask = LoopbackServer.ReadRequestAndSendResponseAsync( + server, + responseString + "\r\nContent-Length: 0\r\n\r\n", + new LoopbackServer.Options { ResponseStreamWrapper = GetStream }); + + await Assert.ThrowsAsync(() => client.GetAsync(url)); + } + }); + } + } + + public class HttpProtocolTests_Dribble : HttpProtocolTests, IDisposable + { + protected override Stream GetStream(Stream s) => new DribbleStream(s); + + private sealed class DribbleStream : Stream + { + private readonly Stream _wrapped; + + public DribbleStream(Stream wrapped) => _wrapped = wrapped; + + public override async Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + for (int i = 0; i < count; i++) + { + await _wrapped.WriteAsync(buffer, offset + i, 1); + await Task.Yield(); // introduce short delays, enough to send packets individually but so long as to extend test duration significantly + } + } + + public override bool CanRead => false; + public override bool CanSeek => false; + public override bool CanWrite => _wrapped.CanWrite; + public override long Length => throw new NotSupportedException(); + public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); } + public override void Flush() => _wrapped.Flush(); + public override Task FlushAsync(CancellationToken cancellationToken) => _wrapped.FlushAsync(cancellationToken); + public override int Read(byte[] buffer, int offset, int count) => throw new NotImplementedException(); + public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException(); + public override void SetLength(long value) => throw new NotImplementedException(); + public override void Write(byte[] buffer, int offset, int count) => throw new NotImplementedException(); + } + } +} diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTest.cs index 3c7c04500e..3658fb78ff 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTest.cs @@ -2,169 +2,260 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Concurrent; using System.IO; using System.Net.Sockets; using System.Text; +using System.Threading; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; -// NOTE: -// Currently the managed handler is opt-in on both Windows and Unix, due to still being a nascent implementation -// that's missing features, robustness, perf, etc. One opts into it currently by setting an environment variable, -// which makes it a bit difficult to test. There are two straightforward ways to test it: -// - This file contains test classes that derive from the other test classes in the project that create -// HttpClient{Handler} instances, and in the ctor sets the env var and in Dispose removes the env var. -// That has the effect of running all of those same tests again, but with the managed handler enabled. -// - By setting the env var prior to running tests, every test will implicitly use the managed handler, -// at which point the tests in this file are duplicative and can be commented out. - -// For now parallelism is disabled because we use an env var to turn on the managed handler, and the env var -// impacts any tests running concurrently in the process. We can remove this restriction in the future once -// plans around the ManagedHandler are better understood. -[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true, MaxParallelThreads = 1)] - namespace System.Net.Http.Functional.Tests { - public sealed class ManagedHandler_HttpClientTest : HttpClientTest, IDisposable + public sealed class ManagedHandler_HttpProtocolTests : HttpProtocolTests { - public ManagedHandler_HttpClientTest() => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_DiagnosticsTest : DiagnosticsTest, IDisposable + public sealed class ManagedHandler_HttpProtocolTests_Dribble : HttpProtocolTests_Dribble { - public ManagedHandler_DiagnosticsTest() => ManagedHandlerTestHelpers.SetEnvVar(); - public new void Dispose() - { - ManagedHandlerTestHelpers.RemoveEnvVar(); - base.Dispose(); - } + protected override bool UseManagedHandler => true; } - // TODO #21452: Tests on this class fail when the associated condition is enabled. - //public sealed class ManagedHandler_HttpClientEKUTest : HttpClientEKUTest, IDisposable - //{ - // public ManagedHandler_HttpClientEKUTest() => ManagedHandlerTestHelpers.SetEnvVar(); - // public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); - //} - - public sealed class ManagedHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test : HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test, IDisposable + public sealed class ManagedHandler_HttpClientTest : HttpClientTest { - public ManagedHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_HttpClientHandler_ClientCertificates_Test : HttpClientHandler_ClientCertificates_Test, IDisposable + public sealed class ManagedHandler_DiagnosticsTest : DiagnosticsTest { - public ManagedHandler_HttpClientHandler_ClientCertificates_Test(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - public new void Dispose() - { - ManagedHandlerTestHelpers.RemoveEnvVar(); - base.Dispose(); - } + protected override bool UseManagedHandler => true; } - // TODO #21452: Tests started hanging with updated connection pooling. Needs to be investigated. - //public sealed class ManagedHandler_HttpClientHandler_DefaultProxyCredentials_Test : HttpClientHandler_DefaultProxyCredentials_Test, IDisposable - //{ - // public ManagedHandler_HttpClientHandler_DefaultProxyCredentials_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - // public new void Dispose() - // { - // ManagedHandlerTestHelpers.RemoveEnvVar(); - // base.Dispose(); - // } - //} - - public sealed class ManagedHandler_HttpClientHandler_MaxConnectionsPerServer_Test : HttpClientHandler_MaxConnectionsPerServer_Test, IDisposable + public sealed class ManagedHandler_HttpClientEKUTest : HttpClientEKUTest { - public ManagedHandler_HttpClientHandler_MaxConnectionsPerServer_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_HttpClientHandler_ServerCertificates_Test : HttpClientHandler_ServerCertificates_Test, IDisposable + public sealed class ManagedHandler_HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test : HttpClientHandler_DangerousAcceptAllCertificatesValidator_Test { - public ManagedHandler_HttpClientHandler_ServerCertificates_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - public new void Dispose() - { - ManagedHandlerTestHelpers.RemoveEnvVar(); - base.Dispose(); - } + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_PostScenarioTest : PostScenarioTest, IDisposable + public sealed class ManagedHandler_HttpClientHandler_ClientCertificates_Test : HttpClientHandler_ClientCertificates_Test { - public ManagedHandler_PostScenarioTest(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + public ManagedHandler_HttpClientHandler_ClientCertificates_Test(ITestOutputHelper output) : base(output) { } + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_ResponseStreamTest : ResponseStreamTest, IDisposable + public sealed class ManagedHandler_HttpClientHandler_DefaultProxyCredentials_Test : HttpClientHandler_DefaultProxyCredentials_Test { - public ManagedHandler_ResponseStreamTest(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); - } - - public sealed class ManagedHandler_HttpClientHandler_SslProtocols_Test : HttpClientHandler_SslProtocols_Test, IDisposable - { - public ManagedHandler_HttpClientHandler_SslProtocols_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_SchSendAuxRecordHttpTest : SchSendAuxRecordHttpTest, IDisposable + public sealed class ManagedHandler_HttpClientHandler_MaxConnectionsPerServer_Test : HttpClientHandler_MaxConnectionsPerServer_Test { - public ManagedHandler_SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; } - public sealed class ManagedHandler_HttpClientMiniStress : HttpClientMiniStress, IDisposable + public sealed class ManagedHandler_HttpClientHandler_ServerCertificates_Test : HttpClientHandler_ServerCertificates_Test { - public ManagedHandler_HttpClientMiniStress() => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; } - // TODO #21452: - //public sealed class ManagedHandler_DefaultCredentialsTest : DefaultCredentialsTest, IDisposable - //{ - // public ManagedHandler_DefaultCredentialsTest(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - // public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); - //} - - public sealed class ManagedHandler_HttpClientHandlerTest : HttpClientHandlerTest, IDisposable + public sealed class ManagedHandler_PostScenarioTest : PostScenarioTest { - public ManagedHandler_HttpClientHandlerTest(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - public new void Dispose() - { - ManagedHandlerTestHelpers.RemoveEnvVar(); - base.Dispose(); - } + public ManagedHandler_PostScenarioTest(ITestOutputHelper output) : base(output) { } + protected override bool UseManagedHandler => true; } - // TODO #21452: Socket's don't support canceling individual operations, so ReadStream on NetworkStream + public sealed class ManagedHandler_ResponseStreamTest : ResponseStreamTest + { + public ManagedHandler_ResponseStreamTest(ITestOutputHelper output) : base(output) { } + protected override bool UseManagedHandler => true; + } + + public sealed class ManagedHandler_HttpClientHandler_SslProtocols_Test : HttpClientHandler_SslProtocols_Test + { + protected override bool UseManagedHandler => true; + } + + public sealed class ManagedHandler_SchSendAuxRecordHttpTest : SchSendAuxRecordHttpTest + { + public ManagedHandler_SchSendAuxRecordHttpTest(ITestOutputHelper output) : base(output) { } + protected override bool UseManagedHandler => true; + } + + public sealed class ManagedHandler_HttpClientMiniStress : HttpClientMiniStress + { + protected override bool UseManagedHandler => true; + } + + public sealed class ManagedHandler_HttpClientHandlerTest : HttpClientHandlerTest + { + public ManagedHandler_HttpClientHandlerTest(ITestOutputHelper output) : base(output) { } + protected override bool UseManagedHandler => true; + } + + public sealed class ManagedHandler_DefaultCredentialsTest : DefaultCredentialsTest + { + public ManagedHandler_DefaultCredentialsTest(ITestOutputHelper output) : base(output) { } + protected override bool UseManagedHandler => true; + } + + // TODO #23141: Socket's don't support canceling individual operations, so ReadStream on NetworkStream // isn't cancelable once the operation has started. We either need to wrap the operation with one that's // "cancelable", meaning that the underlying operation will still be running even though we've returned "canceled", // or we need to just recognize that cancellation in such situations can be left up to the caller to do the // same thing if it's really important. - //public sealed class ManagedHandler_CancellationTest : CancellationTest, IDisposable + //public sealed class ManagedHandler_CancellationTest : CancellationTest //{ - // public ManagedHandler_CancellationTest(ITestOutputHelper output) : base(output) => ManagedHandlerTestHelpers.SetEnvVar(); - // public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + // public ManagedHandler_CancellationTest(ITestOutputHelper output) : base(output) { } + // protected override bool UseManagedHandler => true; //} - // TODO #21452: The managed handler doesn't currently track how much data was written for the response headers. - //public sealed class ManagedHandler_HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientHandler_MaxResponseHeadersLength_Test, IDisposable + // TODO #23142: The managed handler doesn't currently track how much data was written for the response headers. + //public sealed class ManagedHandler_HttpClientHandler_MaxResponseHeadersLength_Test : HttpClientHandler_MaxResponseHeadersLength_Test //{ - // public ManagedHandler_HttpClientHandler_MaxResponseHeadersLength_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - // public new void Dispose() - // { - // ManagedHandlerTestHelpers.RemoveEnvVar(); - // base.Dispose(); - // } + // protected override bool UseManagedHandler => true; //} - public sealed class ManagedHandler_HttpClientHandler_ConnectionPooling_Test : IDisposable + public sealed class ManagedHandler_HttpClientHandler_DuplexCommunication_Test : HttpClientTestBase { - public ManagedHandler_HttpClientHandler_ConnectionPooling_Test() => ManagedHandlerTestHelpers.SetEnvVar(); - public void Dispose() => ManagedHandlerTestHelpers.RemoveEnvVar(); + protected override bool UseManagedHandler => true; + + [Fact] + public async Task SendBytesBackAndForthBetweenClientAndServer_Success() + { + using (HttpClient client = CreateHttpClient()) + using (var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); + listener.Listen(1); + var ep = (IPEndPoint)listener.LocalEndPoint; + + var clientToServerStream = new ProducerConsumerStream(); + clientToServerStream.WriteByte(0); + + var reqMsg = new HttpRequestMessage + { + RequestUri = new Uri($"http://{ep.Address}:{ep.Port}/"), + Content = new StreamContent(clientToServerStream), + }; + Task req = client.SendAsync(reqMsg, HttpCompletionOption.ResponseHeadersRead); + + using (Socket server = await listener.AcceptAsync()) + using (var serverStream = new NetworkStream(server, ownsSocket: false)) + { + // Skip request headers. + while (true) + { + if (serverStream.ReadByte() == '\r') + { + serverStream.ReadByte(); + break; + } + while (serverStream.ReadByte() != '\r') { } + serverStream.ReadByte(); + } + + // Send response headers. + await server.SendAsync( + new ArraySegment(Encoding.ASCII.GetBytes($"HTTP/1.1 200 OK\r\nConnection: close\r\nDate: {DateTimeOffset.UtcNow:R}\r\n\r\n")), + SocketFlags.None); + + HttpResponseMessage resp = await req; + Stream serverToClientStream = await resp.Content.ReadAsStreamAsync(); + + // Communication should now be open between the client and server. + // Ping pong bytes back and forth. + for (byte i = 0; i < 100; i++) + { + // Send a byte from the client to the server. The server will receive + // the byte as a chunk. + if (i > 0) clientToServerStream.WriteByte(i); // 0 was already seeded when the stream was created above + Assert.Equal('1', serverStream.ReadByte()); + Assert.Equal('\r', serverStream.ReadByte()); + Assert.Equal('\n', serverStream.ReadByte()); + Assert.Equal(i, serverStream.ReadByte()); + Assert.Equal('\r', serverStream.ReadByte()); + Assert.Equal('\n', serverStream.ReadByte()); + + // Send a byte from the server to the client. The client will receive + // the byte on its own, with HttpClient stripping away the chunk encoding. + serverStream.WriteByte(i); + Assert.Equal(i, serverToClientStream.ReadByte()); + } + + clientToServerStream.DoneWriting(); + server.Shutdown(SocketShutdown.Send); + Assert.Equal(-1, clientToServerStream.ReadByte()); + } + } + } + + private sealed class ProducerConsumerStream : Stream + { + private readonly BlockingCollection _buffers = new BlockingCollection(); + private ArraySegment _remaining; + + public override void Write(byte[] buffer, int offset, int count) + { + if (count > 0) + { + byte[] tmp = new byte[count]; + Buffer.BlockCopy(buffer, offset, tmp, 0, count); + _buffers.Add(tmp); + } + } + + public override int Read(byte[] buffer, int offset, int count) + { + if (count > 0) + { + if (_remaining.Count == 0) + { + if (!_buffers.TryTake(out byte[] tmp, Timeout.Infinite)) + { + return 0; + } + _remaining = new ArraySegment(tmp, 0, tmp.Length); + } + + if (_remaining.Count <= count) + { + count = _remaining.Count; + Buffer.BlockCopy(_remaining.Array, _remaining.Offset, buffer, offset, count); + _remaining = default(ArraySegment); + } + else + { + Buffer.BlockCopy(_remaining.Array, _remaining.Offset, buffer, offset, count); + _remaining = new ArraySegment(_remaining.Array, _remaining.Offset + count, _remaining.Count - count); + } + } + + return count; + } + + public void DoneWriting() => _buffers.CompleteAdding(); + + public override bool CanRead => true; + public override bool CanSeek => false; + public override bool CanWrite => true; + public override long Length => throw new NotImplementedException(); + public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override void Flush() { } + public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException(); + public override void SetLength(long value) => throw new NotImplementedException(); + } + + } + + public sealed class ManagedHandler_HttpClientHandler_ConnectionPooling_Test : HttpClientTestBase + { + protected override bool UseManagedHandler => true; // TODO: Currently the subsequent tests sometimes fail/hang with WinHttpHandler / CurlHandler. // In theory they should pass with any handler that does appropriate connection pooling. @@ -174,7 +265,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task MultipleIterativeRequests_SameConnectionReused() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); @@ -213,7 +304,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task ServerDisconnectsAfterInitialRequest_SubsequentRequestUsesDifferentConnection() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); @@ -252,7 +343,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task ServerSendsConnectionClose_SubsequentRequestUsesDifferentConnection() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTestHelpers.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTestHelpers.cs deleted file mode 100644 index 758dbdceb0..0000000000 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ManagedHandlerTestHelpers.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; -using Xunit.Abstractions; - -namespace System.Net.Http.Functional.Tests -{ - internal static class ManagedHandlerTestHelpers - { - private const string ManagedHandlerEnvVar = "COMPlus_UseManagedHttpClientHandler"; - public static void SetEnvVar() => Environment.SetEnvironmentVariable(ManagedHandlerEnvVar, "true"); - public static void RemoveEnvVar() => Environment.SetEnvironmentVariable(ManagedHandlerEnvVar, null); - public static bool IsEnabled => Environment.GetEnvironmentVariable(ManagedHandlerEnvVar) == "true"; - } -} diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/MultipartContentTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/MultipartContentTest.cs index a8ada40504..b7d5ca5592 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/MultipartContentTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/MultipartContentTest.cs @@ -199,7 +199,7 @@ namespace System.Net.Http.Functional.Tests form.Add(new ByteArrayContent(bytes), "file", Guid.NewGuid().ToString()); } - long totalAsyncRead = 0, totalSyncRead = 0; + long totalAsyncRead = 0, totalSyncArrayRead = 0, totalSyncSpanRead = 0; int bytesRead; using (Stream s = await form.ReadAsStreamAsync()) @@ -213,11 +213,18 @@ namespace System.Net.Http.Functional.Tests s.Position = 0; while ((bytesRead = s.Read(bytes, 0, bytes.Length)) > 0) { - totalSyncRead += bytesRead; + totalSyncArrayRead += bytesRead; + } + + s.Position = 0; + while ((bytesRead = s.Read(new Span(bytes, 0, bytes.Length))) > 0) + { + totalSyncSpanRead += bytesRead; } } - Assert.Equal(totalAsyncRead, totalSyncRead); + Assert.Equal(totalAsyncRead, totalSyncArrayRead); + Assert.Equal(totalAsyncRead, totalSyncSpanRead); Assert.InRange(totalAsyncRead, PerContent * ContentCount, long.MaxValue); } @@ -319,6 +326,7 @@ namespace System.Net.Http.Functional.Tests AssertExtensions.Throws("origin", () => s.Seek(0, (SeekOrigin)42)); Assert.Throws(() => s.Write(new byte[1], 0, 0)); + Assert.Throws(() => s.Write(new Span(new byte[1], 0, 0))); Assert.Throws(() => { s.WriteAsync(new byte[1], 0, 0); }); Assert.Throws(() => s.SetLength(1)); } @@ -331,6 +339,7 @@ namespace System.Net.Http.Functional.Tests using (Stream s = await mc.ReadAsStreamAsync()) { Assert.Equal(0, s.Read(new byte[1], 0, 0)); + Assert.Equal(0, s.Read(new Span(new byte[1], 0, 0))); Assert.Equal(0, s.Position); Assert.Equal(0, await s.ReadAsync(new byte[1], 0, 0)); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs index d1a7823b7b..5c5ee93fe8 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs @@ -2,14 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.IO; -using System.Net.Http.Headers; -using System.Net.Test.Common; -using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; - using Xunit; using Xunit.Abstractions; @@ -20,7 +14,7 @@ namespace System.Net.Http.Functional.Tests // Note: Disposing the HttpClient object automatically disposes the handler within. So, it is not necessary // to separately Dispose (or have a 'using' statement) for the handler. [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "dotnet/corefx #20010")] - public class PostScenarioTest + public class PostScenarioTest : HttpClientTestBase { private const string ExpectedContent = "Test contest"; private const string UserName = "user1"; @@ -178,7 +172,7 @@ namespace System.Net.Http.Functional.Tests [Theory, MemberData(nameof(EchoServers))] public async Task PostAsync_EmptyContent_ContentTypeHeaderNotSent(Uri serverUri) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.PostAsync(serverUri, null)) { string responseContent = await response.Content.ReadAsStringAsync(); @@ -195,7 +189,7 @@ namespace System.Net.Http.Functional.Tests bool useContentLengthUpload, bool useChunkedEncodingUpload) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { if (!useContentLengthUpload && requestContent != null) { @@ -234,7 +228,7 @@ namespace System.Net.Http.Functional.Tests NetworkCredential credential, bool preAuthenticate) { - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(); handler.PreAuthenticate = preAuthenticate; handler.Credentials = credential; using (var client = new HttpClient(handler)) diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioUWPTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioUWPTest.cs index 1cce398e2b..1c58ff83eb 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioUWPTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/PostScenarioUWPTest.cs @@ -15,7 +15,7 @@ namespace System.Net.Http.Functional.Tests { using Configuration = System.Net.Test.Common.Configuration; - public class PostScenarioUWPTest : RemoteExecutorTestBase + public class PostScenarioUWPTest : HttpClientTestBase { private readonly ITestOutputHelper _output; @@ -27,15 +27,15 @@ namespace System.Net.Http.Functional.Tests [Fact] public void Authentication_UseStreamContent_Throws() { - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { // This test validates the current limitation of CoreFx's NetFxToWinRtStreamAdapter // which throws exceptions when trying to rewind a .NET Stream when it needs to be // re-POST'd to the server. string username = "testuser"; string password = "password"; - Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: username, password: password); - var handler = new HttpClientHandler(); + Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: username, password: password); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.Credentials = new NetworkCredential(username, password); using (var client = new HttpClient(handler)) @@ -48,18 +48,18 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [Fact] public void Authentication_UseMultiInterfaceNonRewindableStreamContent_Throws() { - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { string username = "testuser"; string password = "password"; Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: username, password: password); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.Credentials = new NetworkCredential(username, password); using (var client = new HttpClient(handler)) @@ -72,18 +72,18 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [Fact] public void Authentication_UseMultiInterfaceStreamContent_Success() { - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { string username = "testuser"; string password = "password"; Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: username, password: password); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.Credentials = new NetworkCredential(username, password); using (var client = new HttpClient(handler)) @@ -100,18 +100,18 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [Fact] public void Authentication_UseMemoryStreamVisibleBufferContent_Success() { - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { string username = "testuser"; string password = "password"; Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: username, password: password); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.Credentials = new NetworkCredential(username, password); using (var client = new HttpClient(handler)) @@ -128,18 +128,18 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } [Fact] public void Authentication_UseMemoryStreamNotVisibleBufferContent_Success() { - RemoteInvoke(async () => + RemoteInvoke(async useManagedHandlerString => { string username = "testuser"; string password = "password"; Uri uri = Configuration.Http.BasicAuthUriForCreds(secure: false, userName: username, password: password); - var handler = new HttpClientHandler(); + HttpClientHandler handler = CreateHttpClientHandler(useManagedHandlerString); handler.Credentials = new NetworkCredential(username, password); using (var client = new HttpClient(handler)) @@ -156,7 +156,7 @@ namespace System.Net.Http.Functional.Tests } return SuccessExitCode; - }).Dispose(); + }, UseManagedHandler.ToString()).Dispose(); } } } diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ReadOnlyMemoryContentTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ReadOnlyMemoryContentTest.cs new file mode 100644 index 0000000000..01334a8c3f --- /dev/null +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ReadOnlyMemoryContentTest.cs @@ -0,0 +1,404 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Buffers; +using System.Collections.Generic; +using System.IO; +using System.IO.Tests; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.Net.Http.Functional.Tests +{ + public class ReadOnlyMemoryContentTest + { + public static IEnumerable ContentLengthsAndUseArrays() + { + foreach (int length in new[] { 0, 1, 4096 }) + { + foreach (bool useArray in new[] { true, false }) + { + yield return new object[] { length, useArray }; + } + } + } + + public static IEnumerable TrueFalse() + { + yield return new object[] { true }; + yield return new object[] { false }; + } + + [Theory] + [MemberData(nameof(ContentLengthsAndUseArrays))] + public void ContentLength_LengthMatchesArrayLength(int contentLength, bool useArray) + { + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(contentLength, useArray, out memory, out ownedMemory); + + Assert.Equal(contentLength, content.Headers.ContentLength); + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(TrueFalse))] + public async Task ReadAsStreamAsync_TrivialMembersHaveExpectedValuesAndBehavior(bool useArray) + { + const int ContentLength = 42; + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + using (Stream stream = await content.ReadAsStreamAsync()) + { + // property values + Assert.Equal(ContentLength, stream.Length); + Assert.Equal(0, stream.Position); + Assert.True(stream.CanRead); + Assert.True(stream.CanSeek); + Assert.False(stream.CanWrite); + + // not supported + Assert.Throws(() => stream.SetLength(12345)); + Assert.Throws(() => stream.WriteByte(0)); + Assert.Throws(() => stream.Write(new byte[1], 0, 1)); + Assert.Throws(() => stream.Write(new ReadOnlySpan(new byte[1]))); + await Assert.ThrowsAsync(() => stream.WriteAsync(new byte[1], 0, 1)); + await Assert.ThrowsAsync(() => stream.WriteAsync(new ReadOnlyMemory(new byte[1]))); + + // nops + stream.Flush(); + await stream.FlushAsync(); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(TrueFalse))] + public async Task ReadAsStreamAsync_Seek(bool useArray) + { + const int ContentLength = 42; + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + using (Stream s = await content.ReadAsStreamAsync()) + { + foreach (int pos in new[] { 0, ContentLength / 2, ContentLength - 1 }) + { + s.Position = pos; + Assert.Equal(pos, s.Position); + Assert.Equal(memory.Span[pos], s.ReadByte()); + } + + foreach (int pos in new[] { 0, ContentLength / 2, ContentLength - 1 }) + { + Assert.Equal(0, s.Seek(0, SeekOrigin.Begin)); + Assert.Equal(memory.Span[0], s.ReadByte()); + } + + Assert.Equal(ContentLength, s.Seek(0, SeekOrigin.End)); + Assert.Equal(s.Position, s.Length); + Assert.Equal(-1, s.ReadByte()); + + Assert.Equal(0, s.Seek(-ContentLength, SeekOrigin.End)); + Assert.Equal(0, s.Position); + Assert.Equal(memory.Span[0], s.ReadByte()); + + s.Position = 0; + Assert.Equal(0, s.Seek(0, SeekOrigin.Current)); + Assert.Equal(0, s.Position); + + Assert.Equal(1, s.Seek(1, SeekOrigin.Current)); + Assert.Equal(1, s.Position); + Assert.Equal(memory.Span[1], s.ReadByte()); + Assert.Equal(2, s.Position); + Assert.Equal(3, s.Seek(1, SeekOrigin.Current)); + Assert.Equal(1, s.Seek(-2, SeekOrigin.Current)); + + Assert.Equal(int.MaxValue, s.Seek(int.MaxValue, SeekOrigin.Begin)); + Assert.Equal(int.MaxValue, s.Position); + Assert.Equal(int.MaxValue, s.Seek(0, SeekOrigin.Current)); + Assert.Equal(int.MaxValue, s.Position); + Assert.Equal(int.MaxValue, s.Seek(int.MaxValue - ContentLength, SeekOrigin.End)); + Assert.Equal(int.MaxValue, s.Position); + Assert.Equal(-1, s.ReadByte()); + Assert.Equal(int.MaxValue, s.Position); + + Assert.Throws("value", () => s.Position = -1); + Assert.Throws(() => s.Seek(-1, SeekOrigin.Begin)); + + AssertExtensions.Throws("value", () => s.Position = (long)int.MaxValue + 1); + AssertExtensions.Throws("offset", () => s.Seek((long)int.MaxValue + 1, SeekOrigin.Begin)); + + Assert.ThrowsAny(() => s.Seek(0, (SeekOrigin)42)); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(ContentLengthsAndUseArrays))] + public async Task ReadAsStreamAsync_ReadByte_MatchesInput(int contentLength, bool useArray) + { + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(contentLength, useArray, out memory, out ownedMemory); + + using (Stream stream = await content.ReadAsStreamAsync()) + { + for (int i = 0; i < contentLength; i++) + { + Assert.Equal(memory.Span[i], stream.ReadByte()); + Assert.Equal(i + 1, stream.Position); + } + Assert.Equal(-1, stream.ReadByte()); + Assert.Equal(stream.Length, stream.Position); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(TrueFalse))] + public async Task ReadAsStreamAsync_Read_InvalidArguments(bool useArray) + { + const int ContentLength = 42; + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + using (Stream stream = await content.ReadAsStreamAsync()) + { + AssertExtensions.Throws("buffer", () => stream.Read(null, 0, 0)); + AssertExtensions.Throws("buffer", () => { stream.ReadAsync(null, 0, 0); }); + + AssertExtensions.Throws("offset", () => stream.Read(new byte[1], -1, 1)); + AssertExtensions.Throws("offset", () => stream.Read(new byte[1], -1, 1)); + + AssertExtensions.Throws("count", () => stream.Read(new byte[1], 0, -1)); + AssertExtensions.Throws("count", () => stream.Read(new byte[1], 0, -1)); + + Assert.ThrowsAny(() => { stream.ReadAsync(new byte[1], 2, 0); }); + Assert.ThrowsAny(() => { stream.ReadAsync(new byte[1], 2, 0); }); + Assert.ThrowsAny(() => { stream.ReadAsync(new byte[1], 0, 2); }); + Assert.ThrowsAny(() => { stream.ReadAsync(new byte[1], 0, 2); }); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [InlineData(0, false)] // Read(byte[], ...) + [InlineData(1, false)] // Read(Span, ...) + [InlineData(2, false)] // ReadAsync(byte[], ...) + [InlineData(3, false)] // ReadAsync(Memory,...) + [InlineData(4, false)] // Begin/EndRead(byte[],...) + [InlineData(0, true)] // Read(byte[], ...) + [InlineData(1, true)] // Read(Span, ...) + [InlineData(2, true)] // ReadAsync(byte[], ...) + [InlineData(3, true)] // ReadAsync(Memory,...) + [InlineData(4, true)] // Begin/EndRead(byte[],...) + public async Task ReadAsStreamAsync_ReadMultipleBytes_MatchesInput(int mode, bool useArray) + { + const int ContentLength = 1024; + + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + var buffer = new byte[3]; + + using (Stream stream = await content.ReadAsStreamAsync()) + { + for (int i = 0; i < ContentLength; i += buffer.Length) + { + int bytesRead = + mode == 0 ? stream.Read(buffer, 0, buffer.Length) : + mode == 1 ? stream.Read(new Span(buffer)) : + mode == 2 ? await stream.ReadAsync(buffer, 0, buffer.Length) : + mode == 3 ? await stream.ReadAsync(new Memory(buffer)) : + await Task.Factory.FromAsync(stream.BeginRead, stream.EndRead, buffer, 0, buffer.Length, null); + + Assert.Equal(Math.Min(buffer.Length, ContentLength - i), bytesRead); + for (int j = 0; j < bytesRead; j++) + { + Assert.Equal(memory.Span[i + j], buffer[j]); + } + + Assert.Equal(i + bytesRead, stream.Position); + } + + Assert.Equal(0, + mode == 0 ? stream.Read(buffer, 0, buffer.Length) : + mode == 1 ? stream.Read(new Span(buffer)) : + mode == 2 ? await stream.ReadAsync(buffer, 0, buffer.Length) : + mode == 3 ? await stream.ReadAsync(new Memory(buffer)) : + await Task.Factory.FromAsync(stream.BeginRead, stream.EndRead, buffer, 0, buffer.Length, null)); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(TrueFalse))] + public async Task ReadAsStreamAsync_ReadWithCancelableToken_MatchesInput(bool useArray) + { + const int ContentLength = 100; + + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + var buffer = new byte[1]; + var cts = new CancellationTokenSource(); + int bytesRead; + + using (Stream stream = await content.ReadAsStreamAsync()) + { + for (int i = 0; i < ContentLength; i++) + { + switch (i % 2) + { + case 0: + bytesRead = await stream.ReadAsync(buffer, 0, 1, cts.Token); + break; + default: + bytesRead = await stream.ReadAsync(new Memory(buffer), cts.Token); + break; + } + Assert.Equal(1, bytesRead); + Assert.Equal(memory.Span[i], buffer[0]); + } + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(TrueFalse))] + public async Task ReadAsStreamAsync_ReadWithCanceledToken_MatchesInput(bool useArray) + { + const int ContentLength = 2; + + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + using (Stream stream = await content.ReadAsStreamAsync()) + { + await Assert.ThrowsAnyAsync(() => stream.ReadAsync(new byte[1], 0, 1, new CancellationToken(true))); + await Assert.ThrowsAnyAsync(async () => await stream.ReadAsync(new Memory(new byte[1]), new CancellationToken(true))); + await Assert.ThrowsAnyAsync(async () => await stream.CopyToAsync(new MemoryStream(), 1, new CancellationToken(true))); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(ContentLengthsAndUseArrays))] + public async Task CopyToAsync_AllContentCopied(int contentLength, bool useArray) + { + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(contentLength, useArray, out memory, out ownedMemory); + + var destination = new MemoryStream(); + await content.CopyToAsync(destination); + + Assert.Equal(memory.ToArray(), destination.ToArray()); + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(ContentLengthsAndUseArrays))] + public async Task ReadAsStreamAsync_CopyTo_AllContentCopied(int contentLength, bool useArray) + { + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(contentLength, useArray, out memory, out ownedMemory); + + var destination = new MemoryStream(); + using (Stream s = await content.ReadAsStreamAsync()) + { + s.CopyTo(destination); + } + + Assert.Equal(memory.ToArray(), destination.ToArray()); + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(TrueFalse))] + public async Task ReadAsStreamAsync_CopyTo_InvalidArguments(bool useArray) + { + const int ContentLength = 42; + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(ContentLength, useArray, out memory, out ownedMemory); + + using (Stream s = await content.ReadAsStreamAsync()) + { + AssertExtensions.Throws("destination", () => s.CopyTo(null)); + AssertExtensions.Throws("destination", () => { s.CopyToAsync(null); }); + + AssertExtensions.Throws("bufferSize", () => s.CopyTo(new MemoryStream(), 0)); + AssertExtensions.Throws("bufferSize", () => { s.CopyToAsync(new MemoryStream(), 0); }); + + Assert.Throws(() => s.CopyTo(new MemoryStream(new byte[1], writable:false))); + Assert.Throws(() => { s.CopyToAsync(new MemoryStream(new byte[1], writable: false)); }); + + var disposedDestination = new MemoryStream(); + disposedDestination.Dispose(); + Assert.Throws(() => s.CopyTo(disposedDestination)); + Assert.Throws(() => { s.CopyToAsync(disposedDestination); }); + } + + ownedMemory?.Dispose(); + } + + [Theory] + [MemberData(nameof(ContentLengthsAndUseArrays))] + public async Task ReadAsStreamAsync_CopyToAsync_AllContentCopied(int contentLength, bool useArray) + { + Memory memory; + OwnedMemory ownedMemory; + ReadOnlyMemoryContent content = CreateContent(contentLength, useArray, out memory, out ownedMemory); + + var destination = new MemoryStream(); + using (Stream s = await content.ReadAsStreamAsync()) + { + await s.CopyToAsync(destination); + } + + Assert.Equal(memory.ToArray(), destination.ToArray()); + + ownedMemory?.Dispose(); + } + + private static ReadOnlyMemoryContent CreateContent(int contentLength, bool useArray, out Memory memory, out OwnedMemory ownedMemory) + { + if (useArray) + { + memory = new byte[contentLength]; + ownedMemory = null; + } + else + { + ownedMemory = new NativeOwnedMemory(contentLength); + memory = ownedMemory.Memory; + } + + new Random(contentLength).NextBytes(memory.Span); + + return new ReadOnlyMemoryContent(memory); + } + } +} diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs index ee6add5d71..d067473b05 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/ResponseStreamTest.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.IO; -using System.Net.Sockets; using System.Net.Test.Common; using System.Text; using System.Threading; @@ -17,7 +16,7 @@ namespace System.Net.Http.Functional.Tests using Configuration = System.Net.Test.Common.Configuration; [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "dotnet/corefx #20010")] - public class ResponseStreamTest + public class ResponseStreamTest : HttpClientTestBase { private readonly ITestOutputHelper _output; @@ -27,24 +26,82 @@ namespace System.Net.Http.Functional.Tests } [OuterLoop] // TODO: Issue #11345 - [Fact] - public async Task GetStreamAsync_ReadToEnd_Success() + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + [InlineData(4)] + [InlineData(5)] + public async Task GetStreamAsync_ReadToEnd_Success(int readMode) { - var customHeaderValue = Guid.NewGuid().ToString("N"); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { + string customHeaderValue = Guid.NewGuid().ToString("N"); client.DefaultRequestHeaders.Add("X-ResponseStreamTest", customHeaderValue); - Stream stream = await client.GetStreamAsync(Configuration.Http.RemoteEchoServer); - using (var reader = new StreamReader(stream)) + using (Stream stream = await client.GetStreamAsync(Configuration.Http.RemoteEchoServer)) { - string responseBody = reader.ReadToEnd(); - _output.WriteLine(responseBody); + var ms = new MemoryStream(); + int bytesRead; + var buffer = new byte[10]; + string responseBody; + + // Read all of the response content in various ways + switch (readMode) + { + case 0: + // StreamReader.ReadToEnd + responseBody = new StreamReader(stream).ReadToEnd(); + break; + + case 1: + // StreamReader.ReadToEndAsync + responseBody = await new StreamReader(stream).ReadToEndAsync(); + break; + + case 2: + // Individual calls to Read(Array) + while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0) + { + ms.Write(buffer, 0, bytesRead); + } + responseBody = Encoding.UTF8.GetString(ms.ToArray()); + break; + + case 3: + // Individual calls to ReadAsync(Array) + while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) != 0) + { + ms.Write(buffer, 0, bytesRead); + } + responseBody = Encoding.UTF8.GetString(ms.ToArray()); + break; + + case 4: + // Individual calls to Read(Span) + while ((bytesRead = stream.Read(new Span(buffer))) != 0) + { + ms.Write(buffer, 0, bytesRead); + } + responseBody = Encoding.UTF8.GetString(ms.ToArray()); + break; + + case 5: + // CopyToAsync + await stream.CopyToAsync(ms); + responseBody = Encoding.UTF8.GetString(ms.ToArray()); + break; + + default: + throw new Exception($"Unexpected test mode {readMode}"); + } // Calling GetStreamAsync() means we don't have access to the HttpResponseMessage. // So, we can't use the MD5 hash validation to verify receipt of the response body. // For this test, we can use a simpler verification of a custom header echo'ing back. - Assert.True(responseBody.Contains(customHeaderValue)); + _output.WriteLine(responseBody); + Assert.Contains(customHeaderValue, responseBody); } } } @@ -53,7 +110,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_UseResponseHeadersReadAndCallLoadIntoBuffer_Success() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead)) { await response.Content.LoadIntoBufferAsync(); @@ -72,7 +129,7 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetAsync_UseResponseHeadersReadAndCopyToMemoryStream_Success() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead)) { var memoryStream = new MemoryStream(); @@ -96,11 +153,12 @@ namespace System.Net.Http.Functional.Tests [Fact] public async Task GetStreamAsync_ReadZeroBytes_Success() { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (Stream stream = await client.GetStreamAsync(Configuration.Http.RemoteEchoServer)) { - int bytesRead = await stream.ReadAsync(new byte[1], 0, 0); - Assert.Equal(0, bytesRead); + Assert.Equal(0, stream.Read(new byte[1], 0, 0)); + Assert.Equal(0, stream.Read(new Span(new byte[1], 0, 0))); + Assert.Equal(0, await stream.ReadAsync(new byte[1], 0, 0)); } } @@ -110,7 +168,7 @@ namespace System.Net.Http.Functional.Tests { var cts = new CancellationTokenSource(); - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.RemoteEchoServer, HttpCompletionOption.ResponseHeadersRead)) using (Stream stream = await response.Content.ReadAsStreamAsync()) @@ -184,7 +242,7 @@ namespace System.Net.Http.Functional.Tests private async Task ReadAsStreamHelper(IPEndPoint serverEndPoint) { - using (var client = new HttpClient()) + using (HttpClient client = CreateHttpClient()) { using (var response = await client.GetAsync( new Uri($"http://{serverEndPoint.Address}:{(serverEndPoint).Port}/"), diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/SchSendAuxRecordHttpTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/SchSendAuxRecordHttpTest.cs index 50de6a06ea..c02e2f1eb6 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/SchSendAuxRecordHttpTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/SchSendAuxRecordHttpTest.cs @@ -11,10 +11,8 @@ using Xunit.Abstractions; namespace System.Net.Http.Functional.Tests { - using Configuration = System.Net.Test.Common.Configuration; - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "dotnet/corefx #20010")] - public class SchSendAuxRecordHttpTest + public class SchSendAuxRecordHttpTest : HttpClientTestBase { readonly ITestOutputHelper _output; @@ -32,9 +30,10 @@ namespace System.Net.Http.Functional.Tests options.AllowedProtocols = SslProtocols.Tls; using (var server = new HttpsTestServer(options)) - using (var handler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates }) + using (HttpClientHandler handler = CreateHttpClientHandler()) using (var client = new HttpClient(handler)) { + handler.ServerCertificateCustomValidationCallback = LoopbackServer.AllowAllCertificates; server.Start(); var tasks = new Task[2]; diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/StreamContentTest.cs b/external/corefx/src/System.Net.Http/tests/FunctionalTests/StreamContentTest.cs index 7c64ffead5..d512edbcc5 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/StreamContentTest.cs +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/StreamContentTest.cs @@ -239,6 +239,10 @@ namespace System.Net.Http.Functional.Tests Assert.Equal(1, contentReadStream.Read(byteOnIndex5, 0, 1)); Assert.Equal(data[5], byteOnIndex5[0]); + byte[] byteOnIndex6 = new byte[1]; + Assert.Equal(1, contentReadStream.Read(new Span(byteOnIndex6, 0, 1))); + Assert.Equal(data[6], byteOnIndex6[0]); + contentReadStream.ReadTimeout = 123; Assert.Equal(123, source.ReadTimeout); Assert.Equal(123, contentReadStream.ReadTimeout); @@ -256,6 +260,7 @@ namespace System.Net.Http.Functional.Tests Assert.Throws(() => contentReadStream.Flush()); Assert.Throws(() => contentReadStream.SetLength(1)); Assert.Throws(() => contentReadStream.Write(null, 0, 0)); + Assert.Throws(() => contentReadStream.Write(new Span(Array.Empty()))); Assert.Throws(() => contentReadStream.WriteByte(1)); Assert.Equal(0, source.DisposeCount); diff --git a/external/corefx/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/external/corefx/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index e6aeb07908..27f5a02d77 100644 --- a/external/corefx/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/external/corefx/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -5,6 +5,7 @@ {C85CF035-7804-41FF-9557-48B7C948B58D} $(DefineConstants);netcoreapp $(DefineConstants);TargetsWindows + true @@ -17,12 +18,15 @@ - - Common\System\PlatformDetection.cs + + Common\System\Buffers\NativeOwnedMemory.cs Common\System\Diagnostics\Tracing\TestEventListener.cs + + Common\System\Diagnostics\Tracing\ConsoleEventListener.cs + Common\System\IO\DelegateStream.cs @@ -78,12 +82,14 @@ + + @@ -98,14 +104,17 @@ - - - + + + + + Common\System\IO\StreamSpanExtensions.netstandard.cs + @@ -123,5 +132,8 @@ + + + \ No newline at end of file diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/Configurations.props b/external/corefx/src/System.Net.Http/tests/UnitTests/Configurations.props index 9c9469d8ed..d8cfd389a8 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/Configurations.props +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap-Windows_NT; diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpContentHeadersTest.cs b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpContentHeadersTest.cs index d6ba0afb56..ee051bb7d9 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpContentHeadersTest.cs +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpContentHeadersTest.cs @@ -38,16 +38,16 @@ namespace System.Net.Http.Tests // The delegate is invoked to return the length. Assert.Equal(15, _headers.ContentLength); - Assert.Equal((long)15, _headers.GetParsedValues(HttpKnownHeaderNames.ContentLength)); + Assert.Equal((long)15, _headers.GetParsedValues(KnownHeaders.ContentLength.Descriptor)); // After getting the calculated content length, set it to null. _headers.ContentLength = null; Assert.Equal(null, _headers.ContentLength); - Assert.False(_headers.Contains(HttpKnownHeaderNames.ContentLength)); + Assert.False(_headers.Contains(KnownHeaders.ContentLength.Name)); _headers.ContentLength = 27; Assert.Equal((long)27, _headers.ContentLength); - Assert.Equal((long)27, _headers.GetParsedValues(HttpKnownHeaderNames.ContentLength)); + Assert.Equal((long)27, _headers.GetParsedValues(KnownHeaders.ContentLength.Descriptor)); } [Fact] @@ -57,12 +57,12 @@ namespace System.Net.Http.Tests _headers.ContentLength = 27; Assert.Equal((long)27, _headers.ContentLength); - Assert.Equal((long)27, _headers.GetParsedValues(HttpKnownHeaderNames.ContentLength)); + Assert.Equal((long)27, _headers.GetParsedValues(KnownHeaders.ContentLength.Descriptor)); // After explicitly setting the content length, set it to null. _headers.ContentLength = null; Assert.Equal(null, _headers.ContentLength); - Assert.False(_headers.Contains(HttpKnownHeaderNames.ContentLength)); + Assert.False(_headers.Contains(KnownHeaders.ContentLength.Name)); // Make sure the header gets serialized correctly _headers.ContentLength = 12345; @@ -181,13 +181,13 @@ namespace System.Net.Http.Tests public void ContentLocation_UseAddMethodWithInvalidValue_InvalidValueRecognized() { _headers.TryAddWithoutValidation("Content-Location", " http://example.com http://other"); - Assert.Null(_headers.GetParsedValues("Content-Location")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.ContentLocation.Descriptor)); Assert.Equal(1, _headers.GetValues("Content-Location").Count()); Assert.Equal(" http://example.com http://other", _headers.GetValues("Content-Location").First()); _headers.Clear(); _headers.TryAddWithoutValidation("Content-Location", "http://host /other"); - Assert.Null(_headers.GetParsedValues("Content-Location")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.ContentLocation.Descriptor)); Assert.Equal(1, _headers.GetValues("Content-Location").Count()); Assert.Equal("http://host /other", _headers.GetValues("Content-Location").First()); } @@ -319,13 +319,13 @@ namespace System.Net.Http.Tests public void ContentMD5_UseAddMethodWithInvalidValue_InvalidValueRecognized() { _headers.TryAddWithoutValidation("Content-MD5", "AQ--"); - Assert.Null(_headers.GetParsedValues("Content-MD5")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.ContentMD5.Descriptor)); Assert.Equal(1, _headers.GetValues("Content-MD5").Count()); Assert.Equal("AQ--", _headers.GetValues("Content-MD5").First()); _headers.Clear(); _headers.TryAddWithoutValidation("Content-MD5", "AQ==, CD"); - Assert.Null(_headers.GetParsedValues("Content-MD5")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.ContentMD5.Descriptor)); Assert.Equal(1, _headers.GetValues("Content-MD5").Count()); Assert.Equal("AQ==, CD", _headers.GetValues("Content-MD5").First()); } @@ -405,13 +405,13 @@ namespace System.Net.Http.Tests public void Expires_UseAddMethodWithInvalidValue_InvalidValueRecognized() { _headers.TryAddWithoutValidation("Expires", " Sun, 06 Nov 1994 08:49:37 GMT ,"); - Assert.Null(_headers.GetParsedValues("Expires")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.Expires.Descriptor)); Assert.Equal(1, _headers.GetValues("Expires").Count()); Assert.Equal(" Sun, 06 Nov 1994 08:49:37 GMT ,", _headers.GetValues("Expires").First()); _headers.Clear(); _headers.TryAddWithoutValidation("Expires", " Sun, 06 Nov "); - Assert.Null(_headers.GetParsedValues("Expires")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.Expires.Descriptor)); Assert.Equal(1, _headers.GetValues("Expires").Count()); Assert.Equal(" Sun, 06 Nov ", _headers.GetValues("Expires").First()); } @@ -445,13 +445,13 @@ namespace System.Net.Http.Tests public void LastModified_UseAddMethodWithInvalidValue_InvalidValueRecognized() { _headers.TryAddWithoutValidation("Last-Modified", " Sun, 06 Nov 1994 08:49:37 GMT ,"); - Assert.Null(_headers.GetParsedValues("Last-Modified")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.LastModified.Descriptor)); Assert.Equal(1, _headers.GetValues("Last-Modified").Count()); Assert.Equal(" Sun, 06 Nov 1994 08:49:37 GMT ,", _headers.GetValues("Last-Modified").First()); _headers.Clear(); _headers.TryAddWithoutValidation("Last-Modified", " Sun, 06 Nov "); - Assert.Null(_headers.GetParsedValues("Last-Modified")); + Assert.Null(_headers.GetParsedValues(KnownHeaders.LastModified.Descriptor)); Assert.Equal(1, _headers.GetValues("Last-Modified").Count()); Assert.Equal(" Sun, 06 Nov ", _headers.GetValues("Last-Modified").First()); } diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeaderValueCollectionTest.cs b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeaderValueCollectionTest.cs index 40b8a10635..5aef09989b 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeaderValueCollectionTest.cs +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeaderValueCollectionTest.cs @@ -15,7 +15,10 @@ namespace System.Net.Http.Tests { public class HttpHeaderValueCollectionTest { - private const string knownHeader = "known-header"; + // Note: These are not real known headers, so they won't be returned if we call HeaderDescriptor.Get(). + private static readonly HeaderDescriptor knownStringHeader = (new KnownHeader("known-string-header", HttpHeaderType.General, new MockHeaderParser(typeof(string)))).Descriptor; + private static readonly HeaderDescriptor knownUriHeader = (new KnownHeader("known-uri-header", HttpHeaderType.General, new MockHeaderParser(typeof(Uri)))).Descriptor; + private static readonly Uri specialValue = new Uri("http://special/"); private static readonly Uri invalidValue = new Uri("http://invalid/"); private static readonly TransferCodingHeaderValue specialChunked = new TransferCodingHeaderValue("chunked"); @@ -26,8 +29,8 @@ namespace System.Net.Http.Tests [Fact] public void IsReadOnly_CallProperty_AlwaysFalse() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(string))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownStringHeader, headers); Assert.False(collection.IsReadOnly); } @@ -35,47 +38,47 @@ namespace System.Net.Http.Tests [Fact] public void Count_AddSingleValueThenQueryCount_ReturnsValueCountWithSpecialValues() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(string))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownStringHeader, headers, "special"); Assert.Equal(0, collection.Count); - headers.Add(knownHeader, "value2"); + headers.Add(knownStringHeader, "value2"); Assert.Equal(1, collection.Count); headers.Clear(); - headers.Add(knownHeader, "special"); + headers.Add(knownStringHeader, "special"); Assert.Equal(1, collection.Count); - headers.Add(knownHeader, "special"); - headers.Add(knownHeader, "special"); + headers.Add(knownStringHeader, "special"); + headers.Add(knownStringHeader, "special"); Assert.Equal(3, collection.Count); } [Fact] public void Count_AddMultipleValuesThenQueryCount_ReturnsValueCountWithSpecialValues() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(string))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownStringHeader, headers, "special"); Assert.Equal(0, collection.Count); collection.Add("value1"); - headers.Add(knownHeader, "special"); + headers.Add(knownStringHeader, "special"); Assert.Equal(2, collection.Count); - headers.Add(knownHeader, "special"); - headers.Add(knownHeader, "value2"); - headers.Add(knownHeader, "special"); + headers.Add(knownStringHeader, "special"); + headers.Add(knownStringHeader, "value2"); + headers.Add(knownStringHeader, "special"); Assert.Equal(5, collection.Count); } [Fact] public void Add_CallWithNullValue_Throw() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); Assert.Throws(() => { collection.Add(null); }); } @@ -83,8 +86,8 @@ namespace System.Net.Http.Tests [Fact] public void Add_AddValues_AllValuesAdded() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/1/")); @@ -144,8 +147,8 @@ namespace System.Net.Http.Tests [Fact] public void ParseAdd_CallWithNullValue_NothingAdded() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.ParseAdd(null); Assert.False(collection.IsSpecialValueSet); @@ -156,8 +159,8 @@ namespace System.Net.Http.Tests [Fact] public void ParseAdd_AddValues_AllValuesAdded() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.ParseAdd("http://www.example.org/1/"); @@ -170,8 +173,8 @@ namespace System.Net.Http.Tests [Fact] public void ParseAdd_UseSpecialValue_Added() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.ParseAdd(specialValue.AbsoluteUri); @@ -204,8 +207,8 @@ namespace System.Net.Http.Tests [Fact] public void TryParseAdd_AddValues_AllAdded() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); Assert.True(collection.TryParseAdd("http://www.example.org/1/")); @@ -218,8 +221,8 @@ namespace System.Net.Http.Tests [Fact] public void TryParseAdd_UseSpecialValue_Added() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); Assert.True(collection.TryParseAdd(specialValue.AbsoluteUri)); @@ -252,8 +255,8 @@ namespace System.Net.Http.Tests [Fact] public void Clear_AddValuesThenClear_NoElementsInCollection() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -269,8 +272,8 @@ namespace System.Net.Http.Tests [Fact] public void Clear_AddValuesAndSpecialValueThenClear_EverythingCleared() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.SetSpecialValue(); @@ -290,8 +293,8 @@ namespace System.Net.Http.Tests [Fact] public void Contains_CallWithNullValue_Throw() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); Assert.Throws(() => { collection.Contains(null); }); } @@ -299,8 +302,8 @@ namespace System.Net.Http.Tests [Fact] public void Contains_AddValuesThenCallContains_ReturnsTrueForExistingItemsFalseOtherwise() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -346,8 +349,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_CallWithStartIndexPlusElementCountGreaterArrayLength_Throw() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -361,8 +364,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_EmptyToEmpty_Success() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); Uri[] array = new Uri[0]; collection.CopyTo(array, 0); @@ -371,8 +374,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_NoValues_DoesNotChangeArray() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); Uri[] array = new Uri[4]; collection.CopyTo(array, 0); @@ -386,8 +389,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_AddSingleValue_ContainsSingleValue() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/")); @@ -398,7 +401,7 @@ namespace System.Net.Http.Tests // Now only set the special value: nothing should be added to the array. headers.Clear(); - headers.Add(knownHeader, specialValue.ToString()); + headers.Add(knownUriHeader, specialValue.ToString()); array[0] = null; collection.CopyTo(array, 0); Assert.Equal(specialValue, array[0]); @@ -407,8 +410,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_AddMultipleValues_ContainsAllValuesInTheRightOrder() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -427,8 +430,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_AddValuesAndSpecialValue_AllValuesCopied() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/1/")); @@ -451,14 +454,14 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_OnlySpecialValue_Copied() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.SetSpecialValue(); - headers.Add(knownHeader, specialValue.ToString()); - headers.Add(knownHeader, specialValue.ToString()); - headers.Add(knownHeader, specialValue.ToString()); + headers.Add(knownUriHeader, specialValue.ToString()); + headers.Add(knownUriHeader, specialValue.ToString()); + headers.Add(knownUriHeader, specialValue.ToString()); Uri[] array = new Uri[4]; array[0] = null; @@ -475,12 +478,12 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_OnlySpecialValueEmptyDestination_Copied() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.SetSpecialValue(); - headers.Add(knownHeader, specialValue.ToString()); + headers.Add(knownUriHeader, specialValue.ToString()); Uri[] array = new Uri[2]; collection.CopyTo(array, 0); @@ -494,8 +497,8 @@ namespace System.Net.Http.Tests [Fact] public void CopyTo_ArrayTooSmall_Throw() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(string))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownStringHeader, headers, "special"); string[] array = new string[1]; @@ -508,20 +511,20 @@ namespace System.Net.Http.Tests Assert.Throws(() => { collection.CopyTo(array, -1); }); Assert.Throws(() => { collection.CopyTo(array, 2); }); - headers.Add(knownHeader, "special"); + headers.Add(knownStringHeader, "special"); array = new string[0]; AssertExtensions.Throws(null, () => { collection.CopyTo(array, 0); }); - headers.Add(knownHeader, "special"); - headers.Add(knownHeader, "special"); + headers.Add(knownStringHeader, "special"); + headers.Add(knownStringHeader, "special"); array = new string[1]; AssertExtensions.Throws("destinationArray", "", () => { collection.CopyTo(array, 0); }); - headers.Add(knownHeader, "value1"); + headers.Add(knownStringHeader, "value1"); array = new string[0]; AssertExtensions.Throws("destinationArray", "", () => { collection.CopyTo(array, 0); }); - headers.Add(knownHeader, "value2"); + headers.Add(knownStringHeader, "value2"); array = new string[1]; AssertExtensions.Throws("destinationArray", "", () => { collection.CopyTo(array, 0); }); @@ -533,7 +536,7 @@ namespace System.Net.Http.Tests public void Remove_CallWithNullValue_Throw() { MockHeaders headers = new MockHeaders(); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); Assert.Throws(() => { collection.Remove(null); }); } @@ -541,8 +544,8 @@ namespace System.Net.Http.Tests [Fact] public void Remove_AddValuesThenCallRemove_ReturnsTrueWhenRemovingExistingValuesFalseOtherwise() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -601,8 +604,8 @@ namespace System.Net.Http.Tests [Fact] public void GetEnumerator_AddSingleValueAndGetEnumerator_AllValuesReturned() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/")); @@ -617,8 +620,8 @@ namespace System.Net.Http.Tests [Fact] public void GetEnumerator_AddValuesAndGetEnumerator_AllValuesReturned() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -635,8 +638,8 @@ namespace System.Net.Http.Tests [Fact] public void GetEnumerator_NoValues_EmptyEnumerator() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); IEnumerator enumerator = collection.GetEnumerator(); @@ -646,8 +649,8 @@ namespace System.Net.Http.Tests [Fact] public void GetEnumerator_AddValuesAndGetEnumeratorFromInterface_AllValuesReturned() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers); + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); @@ -666,8 +669,8 @@ namespace System.Net.Http.Tests [Fact] public void GetEnumerator_AddValuesAndSpecialValueAndGetEnumeratorFromInterface_AllValuesReturned() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/1/")); @@ -701,8 +704,8 @@ namespace System.Net.Http.Tests [Fact] public void GetEnumerator_AddValuesAndSpecialValue_AllValuesReturned() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/1/")); @@ -736,8 +739,8 @@ namespace System.Net.Http.Tests public void IsSpecialValueSet_NoSpecialValueUsed_ReturnsFalse() { // Create a new collection _without_ specifying a special value. - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, null, null); Assert.False(collection.IsSpecialValueSet, @@ -747,65 +750,65 @@ namespace System.Net.Http.Tests [Fact] public void RemoveSpecialValue_AddRemoveSpecialValue_SpecialValueGetsRemoved() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.SetSpecialValue(); Assert.True(collection.IsSpecialValueSet, "Special value not set."); - Assert.Equal(1, headers.GetValues(knownHeader).Count()); + Assert.Equal(1, headers.GetValues(knownUriHeader).Count()); collection.RemoveSpecialValue(); Assert.False(collection.IsSpecialValueSet, "Special value is set."); // Since the only header value was the "special value", removing it will remove the whole header // from the collection. - Assert.False(headers.Contains(knownHeader)); + Assert.False(headers.Contains(knownUriHeader)); } [Fact] public void RemoveSpecialValue_AddValueAndSpecialValueThenRemoveSpecialValue_SpecialValueGetsRemoved() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/")); collection.SetSpecialValue(); Assert.True(collection.IsSpecialValueSet, "Special value not set."); - Assert.Equal(2, headers.GetValues(knownHeader).Count()); + Assert.Equal(2, headers.GetValues(knownUriHeader).Count()); collection.RemoveSpecialValue(); Assert.False(collection.IsSpecialValueSet, "Special value is set."); - Assert.Equal(1, headers.GetValues(knownHeader).Count()); + Assert.Equal(1, headers.GetValues(knownUriHeader).Count()); } [Fact] public void RemoveSpecialValue_AddTwoValuesAndSpecialValueThenRemoveSpecialValue_SpecialValueGetsRemoved() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue); collection.Add(new Uri("http://www.example.org/1/")); collection.Add(new Uri("http://www.example.org/2/")); collection.SetSpecialValue(); Assert.True(collection.IsSpecialValueSet, "Special value not set."); - Assert.Equal(3, headers.GetValues(knownHeader).Count()); + Assert.Equal(3, headers.GetValues(knownUriHeader).Count()); // The difference between this test and the previous one is that HttpHeaders in this case will use // a List to store the two remaining values, whereas in the previous case it will just store // the remaining value (no list). collection.RemoveSpecialValue(); Assert.False(collection.IsSpecialValueSet, "Special value is set."); - Assert.Equal(2, headers.GetValues(knownHeader).Count()); + Assert.Equal(2, headers.GetValues(knownUriHeader).Count()); } [Fact] public void Ctor_ProvideValidator_ValidatorIsUsedWhenAddingValues() { - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, MockValidator); // Adding an arbitrary Uri should not throw. @@ -819,8 +822,8 @@ namespace System.Net.Http.Tests public void Ctor_ProvideValidator_ValidatorIsUsedWhenRemovingValues() { // Use different ctor overload than in previous test to make sure all ctor overloads work correctly. - MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); - HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownHeader, headers, + MockHeaders headers = new MockHeaders(); + HttpHeaderValueCollection collection = new HttpHeaderValueCollection(knownUriHeader, headers, specialValue, MockValidator); // When we remove 'invalidValue' our MockValidator will throw. @@ -913,13 +916,6 @@ namespace System.Net.Http.Tests public MockHeaders() { } - - public MockHeaders(string headerName, HttpHeaderParser parser) - { - Dictionary parserStore = new Dictionary(); - parserStore.Add(headerName, parser); - SetConfiguration(parserStore, new HashSet()); - } } private class MockHeaderParser : HttpHeaderParser diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs index cb578e5ad7..8d28e08255 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs @@ -15,35 +15,50 @@ namespace System.Net.Http.Tests { public class HttpHeadersTest { - private const string knownHeader = "known-header"; - private const string customHeader = "custom-header"; + // Note: These are not real known headers, so they won't be returned if we call HeaderDescriptor.Get(). + private static readonly HeaderDescriptor known1Header = (new KnownHeader("known1", HttpHeaderType.General, new MockHeaderParser())).Descriptor; + private static readonly HeaderDescriptor known2Header = (new KnownHeader("known2", HttpHeaderType.General, new MockHeaderParser())).Descriptor; + private static readonly HeaderDescriptor known3Header = (new KnownHeader("known3", HttpHeaderType.General, new MockHeaderParser())).Descriptor; + private static readonly HeaderDescriptor known4Header = (new KnownHeader("known3", HttpHeaderType.General, new CustomTypeHeaderParser())).Descriptor; + + private static readonly HeaderDescriptor noComparerHeader = (new KnownHeader("noComparerHeader", HttpHeaderType.General, new NoComparerHeaderParser())).Descriptor; + private static readonly HeaderDescriptor customTypeHeader = (new KnownHeader("customTypeHeader", HttpHeaderType.General, new CustomTypeHeaderParser())).Descriptor; + + private static readonly HeaderDescriptor customHeader; + + static HttpHeadersTest() + { + HeaderDescriptor.TryGet("custom", out customHeader); + } + + private const string customHeaderName = "custom-header"; private const string rawPrefix = "raw"; private const string parsedPrefix = "parsed"; private const string invalidHeaderValue = "invalid"; - [Fact] - public void TryAddWithoutValidation_UseNullHeader_False() + [Theory] + [InlineData(null)] + [InlineData("")] + public void TryAddWithoutValidation_UseEmptyHeaderName_False(string headerName) { MockHeaders headers = new MockHeaders(); - Assert.False(headers.TryAddWithoutValidation(null, "value")); + Assert.False(headers.TryAddWithoutValidation(headerName, "value")); } - [Fact] - public void TryAddWithoutValidation_UseInvalidHeader_False() + [Theory] + [MemberData(nameof(GetInvalidHeaderNames))] + public void TryAddWithoutValidation_UseInvalidHeaderName_False(string headerName) { MockHeaders headers = new MockHeaders(); - // Spaces are not allowed in header names. This test is used to validate private method - // HttpHeaders.CheckHeaders(). Since that helper method is used in all other public methods, this - // test is not repeated for other public methods. - Assert.False(headers.TryAddWithoutValidation("invalid header", "value")); + Assert.False(headers.TryAddWithoutValidation(headerName, "value")); } [Fact] public void TryAddWithoutValidation_AddSingleValue_ValueParsed() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); Assert.Equal(1, headers.Count()); Assert.Equal(1, headers.First().Value.Count()); @@ -56,8 +71,8 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddTwoSingleValues_BothValuesParsed() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -74,7 +89,7 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddTwoValidValuesAsOneString_BothValuesParsed() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1," + rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1," + rawPrefix + "2"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -93,7 +108,7 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddTwoValuesOneValidOneInvalidAsOneString_RawStringAddedAsInvalid() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1," + invalidHeaderValue); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1," + invalidHeaderValue); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -112,8 +127,8 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddTwoValueStringAndThirdValue_AllValuesParsed() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1," + rawPrefix + "2"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "3"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1," + rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "3"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -131,8 +146,8 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddInvalidAndValidValueString_BothValuesParsed() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -153,7 +168,7 @@ namespace System.Net.Http.Tests // The parser returns 'true' to indicate that it could parse the value (empty values allowed) and an // value of 'null'. HttpHeaders will remove the header from the collection since the known header doesn't // have a value. - headers.TryAddWithoutValidation(knownHeader, string.Empty); + headers.TryAddWithoutValidation(headers.Descriptor, string.Empty); Assert.Equal(0, headers.Parser.TryParseValueCallCount); Assert.Equal(0, headers.Count()); @@ -168,8 +183,8 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddValidAndInvalidValueString_BothValuesParsed() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -190,7 +205,7 @@ namespace System.Net.Http.Tests Assert.Equal(2, headers.Parser.TryParseValueCallCount); - string expected = knownHeader + ": " + parsedPrefix + ", " + invalidHeaderValue + "\r\n"; + string expected = headers.Descriptor.Name + ": " + parsedPrefix + ", " + invalidHeaderValue + "\r\n"; Assert.Equal(expected, headers.ToString()); } @@ -198,7 +213,7 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddNullValueForKnownHeader_ParserRejectsNullEmptyStringAdded() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, (string)null); + headers.TryAddWithoutValidation(headers.Descriptor, (string)null); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -213,7 +228,7 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddNullValueForUnknownHeader_EmptyStringAddedAsValue() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(customHeader, (string)null); + headers.TryAddWithoutValidation(customHeaderName, (string)null); Assert.Equal(1, headers.Count()); Assert.Equal(1, headers.First().Value.Count()); @@ -229,7 +244,7 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddValueForUnknownHeader_ValueAddedToStore() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(customHeader, "custom value"); + headers.TryAddWithoutValidation(customHeaderName, "custom value"); Assert.Equal(1, headers.Count()); Assert.Equal(1, headers.First().Value.Count()); @@ -243,8 +258,8 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddNullAndEmptyValuesToKnownHeader_HeaderRemovedFromCollection() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, (string)null); - headers.TryAddWithoutValidation(knownHeader, string.Empty); + headers.TryAddWithoutValidation(headers.Descriptor, (string)null); + headers.TryAddWithoutValidation(headers.Descriptor, string.Empty); Assert.Equal(0, headers.Parser.TryParseValueCallCount); Assert.Equal(0, headers.Count()); @@ -261,8 +276,8 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_AddNullAndEmptyValuesToUnknownHeader_TwoEmptyStringsAddedAsValues() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(customHeader, (string)null); - headers.TryAddWithoutValidation(customHeader, string.Empty); + headers.TryAddWithoutValidation(customHeaderName, (string)null); + headers.TryAddWithoutValidation(customHeaderName, string.Empty); Assert.Equal(1, headers.Count()); Assert.Equal(2, headers.First().Value.Count()); @@ -279,8 +294,8 @@ namespace System.Net.Http.Tests { MockHeaderParser parser = new MockHeaderParser(false); // doesn't support multiple values. MockHeaders headers = new MockHeaders(parser); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -302,7 +317,7 @@ namespace System.Net.Http.Tests { MockHeaderParser parser = new MockHeaderParser(false); // doesn't support multiple values. MockHeaders headers = new MockHeaders(parser); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1," + rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1," + rawPrefix + "2"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -323,7 +338,7 @@ namespace System.Net.Http.Tests // The header parser rejects both of the following values. Both values contain new line chars. According // to the RFC, LWS supports newlines followed by whitespace. I.e. the first value gets rejected by the // parser, but added to the list of invalid values. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\n other: value"); // OK, LWS is allowed + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\n other: value"); // OK, LWS is allowed Assert.Equal(1, headers.Count()); Assert.Equal(1, headers.First().Value.Count()); Assert.Equal(invalidHeaderValue + "\r\n other: value", headers.First().Value.First()); @@ -333,8 +348,8 @@ namespace System.Net.Http.Tests // TryAddWithoutValidation() only causes the header value to be analyzed when it gets actually accessed, no // exception is thrown. Instead the value is discarded and a warning is logged. headers.Clear(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\nother:value"); - Assert.False(headers.Contains(knownHeader)); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\nother:value"); + Assert.False(headers.Contains(headers.Descriptor)); Assert.Equal(0, headers.Count()); // Adding newline followed by whitespace to a custom header is OK. @@ -354,9 +369,9 @@ namespace System.Net.Http.Tests // Also ending a value with newline is invalid. Verify that valid values are added. headers.Clear(); headers.Parser.TryParseValueCallCount = 0; - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "\rvalid"); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\n"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "\n," + invalidHeaderValue + "\r\nother"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "\rvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\n"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "\n," + invalidHeaderValue + "\r\nother"); Assert.Equal(1, headers.Count()); Assert.Equal(1, headers.First().Value.Count()); Assert.Equal(parsedPrefix + "\rvalid", headers.First().Value.First()); @@ -375,10 +390,10 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_MultipleAddInvalidValuesToNonExistingHeader_AddHeader() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, new string[] { invalidHeaderValue }); + headers.TryAddWithoutValidation(headers.Descriptor, new string[] { invalidHeaderValue }); // Make sure the header did not get added since we just tried to add an invalid value. - Assert.True(headers.Contains(knownHeader)); + Assert.True(headers.Contains(headers.Descriptor)); Assert.Equal(1, headers.First().Value.Count()); Assert.Equal(invalidHeaderValue, headers.First().Value.ElementAt(0)); } @@ -387,10 +402,10 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_MultipleAddValidValueThenAddInvalidValuesToExistingHeader_AddValues() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, new string[] { rawPrefix + "2", invalidHeaderValue }); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, new string[] { rawPrefix + "2", invalidHeaderValue }); - Assert.True(headers.Contains(knownHeader)); + Assert.True(headers.Contains(headers.Descriptor)); Assert.Equal(3, headers.First().Value.Count()); Assert.Equal(parsedPrefix + "1", headers.First().Value.ElementAt(0)); Assert.Equal(parsedPrefix + "2", headers.First().Value.ElementAt(1)); @@ -401,9 +416,9 @@ namespace System.Net.Http.Tests public void TryAddWithoutValidation_MultipleAddValidValueThenAddInvalidValuesToNonExistingHeader_AddHeader() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, new string[] { rawPrefix + "1", invalidHeaderValue }); + headers.TryAddWithoutValidation(headers.Descriptor, new string[] { rawPrefix + "1", invalidHeaderValue }); - Assert.True(headers.Contains(knownHeader)); + Assert.True(headers.Contains(headers.Descriptor)); Assert.Equal(2, headers.First().Value.Count()); Assert.Equal(parsedPrefix + "1", headers.First().Value.ElementAt(0)); Assert.Equal(invalidHeaderValue, headers.First().Value.ElementAt(1)); @@ -415,15 +430,26 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); string[] values = null; - Assert.Throws(() => { headers.TryAddWithoutValidation(knownHeader, values); }); + Assert.Throws(() => { headers.TryAddWithoutValidation(headers.Descriptor, values); }); } - [Fact] - public void Add_SingleUseNullHeaderName_Throw() + [Theory] + [InlineData(null)] + [InlineData("")] + public void Add_SingleUseEmptyHeaderName_Throw(string headerName) { MockHeaders headers = new MockHeaders(); - AssertExtensions.Throws("name", () => { headers.Add(null, "value"); }); + AssertExtensions.Throws("name", () => { headers.Add(headerName, "value"); }); + } + + [Theory] + [MemberData(nameof(GetInvalidHeaderNames))] + public void Add_SingleUseInvalidHeaderName_Throw(string headerName) + { + MockHeaders headers = new MockHeaders(); + + Assert.Throws(() => { headers.Add(headerName, "value"); }); } [Fact] @@ -441,7 +467,7 @@ namespace System.Net.Http.Tests public void Add_SingleAddValidValue_ValueParsedCorrectly() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix); + headers.Add(headers.Descriptor, rawPrefix); // Add() should trigger parsing. Assert.Equal(1, headers.Parser.TryParseValueCallCount); @@ -459,9 +485,9 @@ namespace System.Net.Http.Tests public void Add_SingleAddEmptyValueMultipleTimes_EmptyHeaderAdded() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, (string)null); - headers.Add(knownHeader, string.Empty); - headers.Add(knownHeader, string.Empty); + headers.Add(headers.Descriptor, (string)null); + headers.Add(headers.Descriptor, string.Empty); + headers.Add(headers.Descriptor, string.Empty); // Add() should trigger parsing. Assert.Equal(3, headers.Parser.TryParseValueCallCount); @@ -474,10 +500,10 @@ namespace System.Net.Http.Tests { // Since Add() immediately parses the value, it will throw an exception if the value is invalid. MockHeaders headers = new MockHeaders(); - Assert.Throws(() => { headers.Add(knownHeader, invalidHeaderValue); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, invalidHeaderValue); }); // Make sure the header did not get added to the store. - Assert.False(headers.Contains(knownHeader), + Assert.False(headers.Contains(headers.Descriptor), "No header expected to be added since header value was invalid."); } @@ -485,12 +511,12 @@ namespace System.Net.Http.Tests public void Add_SingleAddValidValueThenAddInvalidValue_ThrowAndHeaderContainsValidValue() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix); + headers.Add(headers.Descriptor, rawPrefix); - Assert.Throws(() => { headers.Add(knownHeader, invalidHeaderValue); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, invalidHeaderValue); }); // Make sure the header did not get removed due to the failed add. - Assert.True(headers.Contains(knownHeader), "Header was removed even if there is a valid header value."); + Assert.True(headers.Contains(headers.Descriptor), "Header was removed even if there is a valid header value."); Assert.Equal(1, headers.First().Value.Count()); Assert.Equal(parsedPrefix, headers.First().Value.ElementAt(0)); } @@ -500,23 +526,23 @@ namespace System.Net.Http.Tests { MockHeaders headers = new MockHeaders(); - Assert.Throws(() => { headers.Add(knownHeader, new string[] { invalidHeaderValue }); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, new string[] { invalidHeaderValue }); }); // Make sure the header did not get added since we just tried to add an invalid value. - Assert.False(headers.Contains(knownHeader), "Header was added even if we just added an invalid value."); + Assert.False(headers.Contains(headers.Descriptor), "Header was added even if we just added an invalid value."); } [Fact] public void Add_MultipleAddValidValueThenAddInvalidValuesToExistingHeader_ThrowAndDontAddHeader() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "1"); - Assert.Throws(() => { headers.Add(knownHeader, new string[] { rawPrefix + "2", invalidHeaderValue }); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, new string[] { rawPrefix + "2", invalidHeaderValue }); }); // Make sure the header did not get removed due to the failed add. Note that the first value in the array // is valid, so it gets added. I.e. we have 2 values. - Assert.True(headers.Contains(knownHeader), "Header was removed even if there is a valid header value."); + Assert.True(headers.Contains(headers.Descriptor), "Header was removed even if there is a valid header value."); Assert.Equal(2, headers.First().Value.Count()); Assert.Equal(parsedPrefix + "1", headers.First().Value.ElementAt(0)); Assert.Equal(parsedPrefix + "2", headers.First().Value.ElementAt(1)); @@ -527,11 +553,11 @@ namespace System.Net.Http.Tests { MockHeaders headers = new MockHeaders(); - Assert.Throws(() => { headers.Add(knownHeader, new string[] { rawPrefix + "1", invalidHeaderValue }); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, new string[] { rawPrefix + "1", invalidHeaderValue }); }); // Make sure the header got added due to the valid add. Note that the first value in the array // is valid, so it gets added. - Assert.True(headers.Contains(knownHeader), "Header was not added even though we added 1 valid value."); + Assert.True(headers.Contains(headers.Descriptor), "Header was not added even though we added 1 valid value."); Assert.Equal(1, headers.First().Value.Count()); Assert.Equal(parsedPrefix + "1", headers.First().Value.ElementAt(0)); } @@ -540,9 +566,9 @@ namespace System.Net.Http.Tests public void Add_SingleAddThreeValidValues_ValuesParsedCorrectly() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.Add(knownHeader, rawPrefix + "2"); - headers.Add(knownHeader, rawPrefix + "3"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "3"); // Add() should trigger parsing. Assert.Equal(3, headers.Parser.TryParseValueCallCount); @@ -564,9 +590,9 @@ namespace System.Net.Http.Tests MockHeaderParser parser = new MockHeaderParser(false); // doesn't support multiple values. MockHeaders headers = new MockHeaders(parser); - headers.Add(knownHeader, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "1"); // Can only add headers once. - Assert.Throws(() => { headers.Add(knownHeader, rawPrefix + "2"); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, rawPrefix + "2"); }); // Verify that the first header value is still there. Assert.Equal(1, headers.First().Value.Count()); @@ -576,8 +602,8 @@ namespace System.Net.Http.Tests public void Add_SingleFirstTryAddWithoutValidationForValidValueThenAdd_TwoParsedValuesAdded() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); - headers.Add(knownHeader, rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "2"); // Add() should trigger parsing. TryAddWithoutValidation() doesn't trigger parsing, but Add() triggers // parsing of raw header values (TryParseValue() is called) @@ -597,8 +623,8 @@ namespace System.Net.Http.Tests public void Add_SingleFirstTryAddWithoutValidationForInvalidValueThenAdd_TwoParsedValuesAdded() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); - headers.Add(knownHeader, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); + headers.Add(headers.Descriptor, rawPrefix + "1"); // Add() should trigger parsing. TryAddWithoutValidation() doesn't trigger parsing, but Add() triggers // parsing of raw header values (TryParseValue() is called) @@ -618,8 +644,8 @@ namespace System.Net.Http.Tests public void Add_SingleFirstTryAddWithoutValidationForEmptyValueThenAdd_OneParsedValueAddedEmptyIgnored() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, string.Empty); - headers.Add(knownHeader, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, string.Empty); + headers.Add(headers.Descriptor, rawPrefix + "1"); // Add() should trigger parsing. TryAddWithoutValidation() doesn't trigger parsing, but Add() triggers // parsing of raw header values (TryParseValue() is called) @@ -638,8 +664,8 @@ namespace System.Net.Http.Tests public void Add_SingleFirstAddThenTryAddWithoutValidation_TwoParsedValuesAdded() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); // Add() should trigger parsing. Since TryAddWithoutValidation() is called afterwards the second value is // not parsed yet. @@ -659,9 +685,9 @@ namespace System.Net.Http.Tests public void Add_SingleAddThenTryAddWithoutValidationThenAdd_ThreeParsedValuesAdded() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); - headers.Add(knownHeader, rawPrefix + "3"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "3"); // The second Add() triggers also parsing of the value added by TryAddWithoutValidation() Assert.Equal(3, headers.Parser.TryParseValueCallCount); @@ -683,8 +709,8 @@ namespace System.Net.Http.Tests MockHeaderParser parser = new MockHeaderParser(false); // doesn't support multiple values. MockHeaders headers = new MockHeaders(parser); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); - Assert.Throws(() => {headers.Add(knownHeader, rawPrefix + "2"); }); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); + Assert.Throws(() => {headers.Add(headers.Descriptor, rawPrefix + "2"); }); } [Fact] @@ -692,8 +718,8 @@ namespace System.Net.Http.Tests { MockHeaderParser parser = new MockHeaderParser(false); // doesn't support multiple values. MockHeaders headers = new MockHeaders(parser); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); Assert.Equal(1, headers.Parser.TryParseValueCallCount); @@ -714,7 +740,7 @@ namespace System.Net.Http.Tests { MockHeaders headers = new MockHeaders(); string[] values = new string[] { rawPrefix + "1", rawPrefix + "2", rawPrefix + "3" }; - headers.Add(knownHeader, values); + headers.Add(headers.Descriptor, values); // Add() should trigger parsing. Assert.Equal(3, headers.Parser.TryParseValueCallCount); @@ -734,7 +760,7 @@ namespace System.Net.Http.Tests public void Add_MultipleAddThreeValidValuesAsOneString_BothValuesParsed() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1," + rawPrefix + "2," + rawPrefix + "3"); + headers.Add(headers.Descriptor, rawPrefix + "1," + rawPrefix + "2," + rawPrefix + "3"); Assert.Equal(3, headers.Parser.TryParseValueCallCount); @@ -752,14 +778,14 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); string[] values = null; - Assert.Throws(() => { headers.Add(knownHeader, values); }); + Assert.Throws(() => { headers.Add(headers.Descriptor, values); }); } [Fact] public void Add_SingleAddCustomHeaderWithNullValue_HeaderIsAddedWithEmptyStringValue() { MockHeaders headers = new MockHeaders(); - headers.Add(customHeader, (string)null); + headers.Add(customHeaderName, (string)null); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -808,10 +834,10 @@ namespace System.Net.Http.Tests public void RemoveParsedValue_AddValueAndRemoveIt_NoHeader() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "1"); // Remove the parsed value (note the original string 'raw1' was "parsed" to 'parsed1') - Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1")); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "1")); Assert.Equal(1, headers.Parser.TryParseValueCallCount); @@ -821,42 +847,42 @@ namespace System.Net.Http.Tests Assert.Equal(1, headers.Parser.TryParseValueCallCount); // Remove the value again: It shouldn't be found in the store. - Assert.False(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1")); + Assert.False(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "1")); } [Fact] public void RemoveParsedValue_AddInvalidValueAndRemoveValidValue_InvalidValueRemains() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); // Remove a valid value which is not in the store. - Assert.False(headers.RemoveParsedValue(knownHeader, parsedPrefix)); + Assert.False(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix)); Assert.Equal(1, headers.Parser.TryParseValueCallCount); // Note that when the last value of a header gets removed, the whole header gets removed. Assert.Equal(1, headers.Count()); - Assert.Equal(invalidHeaderValue, headers.GetValues(knownHeader).First()); + Assert.Equal(invalidHeaderValue, headers.GetValues(headers.Descriptor).First()); Assert.Equal(1, headers.Parser.TryParseValueCallCount); // Remove the value again: It shouldn't be found in the store. - Assert.False(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1")); + Assert.False(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "1")); } [Fact] public void RemoveParsedValue_ParserWithNoEqualityComparer_CaseSensitiveComparison() { - CustomTypeHeaders headers = new CustomTypeHeaders("noComparerHeader", new NoComparerHeaderParser()); - headers.AddParsedValue("noComparerHeader", "lowercasevalue"); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.AddParsedValue(noComparerHeader, "lowercasevalue"); // Since we don't provide a comparer, the default string.Equals() is called which is case-sensitive. So // the following call should return false. - Assert.False(headers.RemoveParsedValue("noComparerHeader", "LOWERCASEVALUE")); + Assert.False(headers.RemoveParsedValue(noComparerHeader, "LOWERCASEVALUE")); // Now we try to remove the value using the correct casing. This should work. - Assert.True(headers.RemoveParsedValue("noComparerHeader", "lowercasevalue")); + Assert.True(headers.RemoveParsedValue(noComparerHeader, "lowercasevalue")); // Note that when the last value of a header gets removed, the whole header gets removed. Assert.Equal(0, headers.Count()); @@ -866,12 +892,12 @@ namespace System.Net.Http.Tests public void RemoveParsedValue_AddTwoValuesAndRemoveThem_NoHeader() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.Add(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "2"); // Remove the parsed value (note the original string 'raw1' was "parsed" to 'parsed1') - Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1")); - Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "2")); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "1")); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "2")); Assert.Equal(2, headers.Parser.TryParseValueCallCount); @@ -885,11 +911,11 @@ namespace System.Net.Http.Tests public void RemoveParsedValue_AddTwoValuesAndRemoveFirstOne_SecondValueRemains() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.Add(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "2"); // Remove the parsed value (note the original string 'raw1' was "parsed" to 'parsed1') - Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1")); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "1")); Assert.Equal(2, headers.Parser.TryParseValueCallCount); @@ -905,11 +931,11 @@ namespace System.Net.Http.Tests public void RemoveParsedValue_AddTwoValuesAndRemoveSecondOne_FirstValueRemains() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.Add(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "2"); // Remove the parsed value (note the original string 'raw2' was "parsed" to 'parsed2') - Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "2")); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "2")); Assert.Equal(2, headers.Parser.TryParseValueCallCount); @@ -925,10 +951,10 @@ namespace System.Net.Http.Tests public void RemoveParsedValue_RemoveFromNonExistingHeader_ReturnsFalse() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix); + headers.Add(headers.Descriptor, rawPrefix); // Header 'non-existing-header' can't be found, so false is returned. - Assert.False(headers.RemoveParsedValue("non-existing-header", "doesntexist")); + Assert.False(headers.RemoveParsedValue(customHeader, "doesntexist")); } [Fact] @@ -938,19 +964,19 @@ namespace System.Net.Http.Tests // If we never add a header value, the whole header (and also the header store) doesn't exist. // Make sure we considered this case. - Assert.False(headers.RemoveParsedValue(knownHeader, "doesntexist")); + Assert.False(headers.RemoveParsedValue(headers.Descriptor, "doesntexist")); } [Fact] public void RemoveParsedValue_AddOneValueToKnownHeaderAndCompareWithValueThatDiffersInCase_CustomComparerUsedForComparison() { MockHeaders headers = new MockHeaders(); - headers.AddParsedValue(knownHeader, "value"); + headers.AddParsedValue(headers.Descriptor, "value"); // Our custom comparer (MockComparer) does case-insensitive value comparison. Verify that our custom // comparer is used to compare the header value. - Assert.True(headers.RemoveParsedValue(knownHeader, "VALUE")); - Assert.False(headers.Contains(knownHeader), "Header should be removed after removing value."); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, "VALUE")); + Assert.False(headers.Contains(headers.Descriptor), "Header should be removed after removing value."); Assert.Equal(1, headers.Parser.MockComparer.EqualsCount); } @@ -958,15 +984,15 @@ namespace System.Net.Http.Tests public void RemoveParsedValue_AddTwoValuesToKnownHeaderAndCompareWithValueThatDiffersInCase_CustomComparerUsedForComparison() { MockHeaders headers = new MockHeaders(); - headers.AddParsedValue(knownHeader, "differentvalue"); - headers.AddParsedValue(knownHeader, "value"); + headers.AddParsedValue(headers.Descriptor, "differentvalue"); + headers.AddParsedValue(headers.Descriptor, "value"); // Our custom comparer (MockComparer) does case-insensitive value comparison. Verify that our custom // comparer is used to compare the header value. // Note that since we added 2 values a different code path than in the previous test is used. In this // case we have stored the values as List internally. - Assert.True(headers.RemoveParsedValue(knownHeader, "VALUE")); - Assert.Equal(1, headers.GetValues(knownHeader).Count()); + Assert.True(headers.RemoveParsedValue(headers.Descriptor, "VALUE")); + Assert.Equal(1, headers.GetValues(headers.Descriptor).Count()); Assert.Equal(2, headers.Parser.MockComparer.EqualsCount); } @@ -976,13 +1002,13 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Add header value with invalid newline chars. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - headers.RemoveParsedValue(knownHeader, ""); + headers.RemoveParsedValue(headers.Descriptor, ""); - Assert.False(headers.Contains(knownHeader), "Store should not have an entry for 'knownHeader'."); + Assert.False(headers.Contains(headers.Descriptor), "Store should not have an entry for 'knownHeader'."); } [Fact] @@ -991,22 +1017,22 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Add header value with invalid newline chars. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - headers.RemoveParsedValue(knownHeader, parsedPrefix + "1"); + headers.RemoveParsedValue(headers.Descriptor, parsedPrefix + "1"); - Assert.False(headers.Contains(knownHeader), "Store should not have an entry for 'knownHeader'."); + Assert.False(headers.Contains(headers.Descriptor), "Store should not have an entry for 'knownHeader'."); } [Fact] public void Clear_AddMultipleHeadersAndThenClear_NoHeadersInCollection() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); headers.Add("custom1", "customValue1"); headers.Add("custom2", "customValue2"); headers.Add("custom3", "customValue3"); @@ -1026,20 +1052,31 @@ namespace System.Net.Http.Tests Assert.Equal(2, headers.Parser.TryParseValueCallCount); } - [Fact] - public void Remove_UseNullHeader_Throw() + [Theory] + [InlineData(null)] + [InlineData("")] + public void Remove_UseEmptyHeaderName_Throw(string headerName) { MockHeaders headers = new MockHeaders(); - AssertExtensions.Throws("name", () => { headers.Remove(null); }); + AssertExtensions.Throws("name", () => { headers.Remove(headerName); }); + } + + [Theory] + [MemberData(nameof(GetInvalidHeaderNames))] + public void Remove_UseInvalidHeaderName_Throw(string headerName) + { + MockHeaders headers = new MockHeaders(); + + Assert.Throws(() => { headers.Remove(headerName); }); } [Fact] public void Remove_AddMultipleHeadersAndDeleteFirstAndLast_FirstAndLastHeaderRemoved() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); headers.Add("custom1", "customValue1"); headers.Add("custom2", "customValue2"); headers.Add("lastheader", "customValue3"); @@ -1051,7 +1088,7 @@ namespace System.Net.Http.Tests Assert.Equal(4, headers.Count()); // Remove first header - Assert.True(headers.Remove(knownHeader)); + Assert.True(headers.Remove(headers.Descriptor)); Assert.Equal(3, headers.Count()); // Remove last header @@ -1069,7 +1106,7 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Remove header from uninitialized store (store collection is null) - Assert.False(headers.Remove(knownHeader)); + Assert.False(headers.Remove(headers.Descriptor)); Assert.Equal(0, headers.Count()); } @@ -1086,14 +1123,27 @@ namespace System.Net.Http.Tests Assert.Equal(1, headers.Count()); } - [Fact] - public void TryGetValues_UseNullHeader_False() + [Theory] + [InlineData(null)] + [InlineData("")] + public void TryGetValues_UseEmptyHeaderName_False(string headerName) { MockHeaders headers = new MockHeaders(); IEnumerable values = null; - Assert.False(headers.TryGetValues(null, out values)); + Assert.False(headers.TryGetValues(headerName, out values)); + } + + [Theory] + [MemberData(nameof(GetInvalidHeaderNames))] + public void TryGetValues_UseInvalidHeaderName_False(string headerName) + { + MockHeaders headers = new MockHeaders(); + + IEnumerable values = null; + + Assert.False(headers.TryGetValues(headerName, out values)); } [Fact] @@ -1125,16 +1175,16 @@ namespace System.Net.Http.Tests public void TryGetValues_GetValuesForExistingHeader_ReturnsTrueAndListOfValues() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); - headers.TryAddWithoutValidation(knownHeader, string.Empty); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, string.Empty); // Only 1 value should get parsed (call to Add() with known header value). Assert.Equal(1, headers.Parser.TryParseValueCallCount); IEnumerable values = null; - Assert.True(headers.TryGetValues(knownHeader, out values)); + Assert.True(headers.TryGetValues(headers.Descriptor, out values)); Assert.NotNull(values); // TryGetValues() should trigger parsing of values added with TryAddWithoutValidation() @@ -1147,12 +1197,23 @@ namespace System.Net.Http.Tests Assert.Equal(parsedPrefix + "2", values.ElementAt(1)); } - [Fact] - public void GetValues_UseNullHeader_Throw() + [Theory] + [InlineData(null)] + [InlineData("")] + public void GetValues_UseEmptyHeaderName_Throw(string headerName) { MockHeaders headers = new MockHeaders(); - AssertExtensions.Throws("name", () => { headers.GetValues(null); }); + AssertExtensions.Throws("name", () => { headers.GetValues(headerName); }); + } + + [Theory] + [MemberData(nameof(GetInvalidHeaderNames))] + public void GetValues_UseInvalidHeaderName_Throw(string headerName) + { + MockHeaders headers = new MockHeaders(); + + Assert.Throws(() => { headers.GetValues(headerName); }); } [Fact] @@ -1179,13 +1240,13 @@ namespace System.Net.Http.Tests { MockHeaders headers = new MockHeaders(); headers.TryAddWithoutValidation("custom", rawPrefix + "0"); // this must not influence the result. - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); // Only 1 value should get parsed (call to Add() with known header value). Assert.Equal(1, headers.Parser.TryParseValueCallCount); - IEnumerable values = headers.GetValues(knownHeader); + IEnumerable values = headers.GetValues(headers.Descriptor); Assert.NotNull(values); // GetValues() should trigger parsing of values added with TryAddWithoutValidation() @@ -1202,18 +1263,18 @@ namespace System.Net.Http.Tests public void GetValues_HeadersWithEmptyValues_ReturnsEmptyArray() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(customHeader, (string)null); - headers.Add(knownHeader, string.Empty); + headers.TryAddWithoutValidation(customHeaderName, (string)null); + headers.Add(headers.Descriptor, string.Empty); // In the known header case, the MockParser accepts empty values but tells the store to not add the value. // Since no value is added for 'knownHeader', HttpHeaders removes the header from the store. This is only // done for known headers. Custom headers are allowed to have empty/null values as shown by // 'valuesForCustomHeaders' below - Assert.False(headers.Contains(knownHeader)); + Assert.False(headers.Contains(headers.Descriptor)); // In the custom header case, we add whatever the users adds (besides that we add string.Empty if the // user adds null). So here we do have 1 value: string.Empty. - IEnumerable valuesForCustomHeader = headers.GetValues(customHeader); + IEnumerable valuesForCustomHeader = headers.GetValues(customHeaderName); Assert.NotNull(valuesForCustomHeader); Assert.Equal(1, valuesForCustomHeader.Count()); Assert.Equal(string.Empty, valuesForCustomHeader.First()); @@ -1225,7 +1286,7 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Get header values from uninitialized store (store collection is null). - object storeValue = headers.GetParsedValues("doesntexist"); + object storeValue = headers.GetParsedValues(customHeader); Assert.Null(storeValue); } @@ -1236,7 +1297,7 @@ namespace System.Net.Http.Tests headers.Add("custom1", "customValue1"); // Get header values for non-existing header (but other headers exist in the store). - object storeValue = headers.GetParsedValues("doesntexist"); + object storeValue = headers.GetParsedValues(customHeader); Assert.Null(storeValue); } @@ -1244,10 +1305,10 @@ namespace System.Net.Http.Tests public void GetParsedValues_GetSingleValueForExistingHeader_ReturnsAddedValue() { MockHeaders headers = new MockHeaders(); - headers.Add("custom1", "customValue1"); + headers.Add(customHeader.Name, "customValue1"); // Get header values for non-existing header (but other headers exist in the store). - object storeValue = headers.GetParsedValues("custom1"); + object storeValue = headers.GetParsedValues(customHeader); Assert.NotNull(storeValue); // If we only have one value, then GetValues() should return just the value and not wrap it in a List. @@ -1258,9 +1319,9 @@ namespace System.Net.Http.Tests public void GetParsedValues_HeaderWithEmptyValues_ReturnsEmpty() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, string.Empty); + headers.Add(headers.Descriptor, string.Empty); - object storeValue = headers.GetParsedValues(knownHeader); + object storeValue = headers.GetParsedValues(headers.Descriptor); Assert.Null(storeValue); } @@ -1269,13 +1330,13 @@ namespace System.Net.Http.Tests { MockHeaders headers = new MockHeaders(); headers.TryAddWithoutValidation("custom", rawPrefix + "0"); // this must not influence the result. - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); // Only 1 value should get parsed (call to Add() with known header value). Assert.Equal(1, headers.Parser.TryParseValueCallCount); - object storeValue = headers.GetParsedValues(knownHeader); + object storeValue = headers.GetParsedValues(headers.Descriptor); Assert.NotNull(storeValue); // GetValues() should trigger parsing of values added with TryAddWithoutValidation() @@ -1294,17 +1355,17 @@ namespace System.Net.Http.Tests public void GetParsedValues_GetValuesForExistingHeaderWithInvalidValues_ReturnsOnlyParsedValues() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix); + headers.Add(headers.Descriptor, rawPrefix); // Here we add an invalid value. GetValues only returns parsable values. So this value should get // parsed, however it will be added to the 'invalid values' list and thus is not part of the collection // returned by the enumerator. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); // Only 1 value should get parsed (call to Add() with known header value). Assert.Equal(1, headers.Parser.TryParseValueCallCount); - object storeValue = headers.GetParsedValues(knownHeader); + object storeValue = headers.GetParsedValues(headers.Descriptor); Assert.NotNull(storeValue); // GetValues() should trigger parsing of values added with TryAddWithoutValidation() @@ -1322,11 +1383,11 @@ namespace System.Net.Http.Tests // Here we add an invalid value. GetValues only returns parsable values. So this value should get // parsed, however it will be added to the 'invalid values' list and thus is not part of the collection // returned by the enumerator. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - object storeValue = headers.GetParsedValues(knownHeader); + object storeValue = headers.GetParsedValues(headers.Descriptor); Assert.Null(storeValue); // GetValues() should trigger parsing of values added with TryAddWithoutValidation() @@ -1337,13 +1398,13 @@ namespace System.Net.Http.Tests public void GetParsedValues_AddInvalidValueToHeader_HeaderGetsRemovedAndNullReturned() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - object storeValue = headers.GetParsedValues(knownHeader); + object storeValue = headers.GetParsedValues(headers.Descriptor); Assert.Null(storeValue); - Assert.False(headers.Contains(knownHeader)); + Assert.False(headers.Contains(headers.Descriptor)); } [Fact] @@ -1352,10 +1413,10 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Add header value with invalid newline chars. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - Assert.Null(headers.GetParsedValues(knownHeader)); + Assert.Null(headers.GetParsedValues(headers.Descriptor)); Assert.Equal(0, headers.Count()); Assert.Equal(1, headers.Parser.TryParseValueCallCount); } @@ -1367,13 +1428,13 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(parser); // Add header value with invalid newline chars. - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, "value2,value3"); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, "value2,value3"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); foreach (var header in headers.GetHeaderStrings()) { - Assert.Equal(knownHeader, header.Key); + Assert.Equal(headers.Descriptor.Name, header.Key); // Note that raw values don't get parsed but just added to the result. Assert.Equal("value2,value3---" + invalidHeaderValue + "---" + parsedPrefix + "1", header.Value); } @@ -1386,13 +1447,13 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(parser); // Add header value with invalid newline chars. - headers.Add(knownHeader, rawPrefix + "1"); + headers.Add(headers.Descriptor, rawPrefix + "1"); headers.Add("header2", "value2"); headers.Add("header3", (string)null); headers.Add("header4", "value41"); headers.Add("header4", "value42"); - string[] expectedHeaderNames = { knownHeader, "header2", "header3", "header4" }; + string[] expectedHeaderNames = { headers.Descriptor.Name, "header2", "header3", "header4" }; string[] expectedHeaderValues = { parsedPrefix + "1", "value2", "", "value41, value42" }; int i = 0; @@ -1411,23 +1472,34 @@ namespace System.Net.Http.Tests MockHeaderParser parser = new MockHeaderParser(false); MockHeaders headers = new MockHeaders(parser); - headers.TryAddWithoutValidation(knownHeader, "value1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, "value1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); foreach (var header in headers.GetHeaderStrings()) { - Assert.Equal(knownHeader, header.Key); + Assert.Equal(headers.Descriptor.Name, header.Key); // Note that the added rawPrefix did not get parsed Assert.Equal("value1, " + rawPrefix, header.Value); } } - [Fact] - public void Contains_UseNullHeader_Throw() + [Theory] + [InlineData(null)] + [InlineData("")] + public void Contains_UseEmptyHeaderName_Throw(string headerName) { MockHeaders headers = new MockHeaders(); - AssertExtensions.Throws("name", () => { headers.Contains(null); }); + AssertExtensions.Throws("name", () => { headers.Contains(headerName); }); + } + + [Theory] + [MemberData(nameof(GetInvalidHeaderNames))] + public void Contains_UseInvalidHeaderName_Throw(string headerName) + { + MockHeaders headers = new MockHeaders(); + + Assert.Throws(() => { headers.Contains(headerName); }); } [Fact] @@ -1441,7 +1513,7 @@ namespace System.Net.Http.Tests public void Contains_CallContainsForNonExistingHeader_ReturnsFalse() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix); + headers.Add(headers.Descriptor, rawPrefix); Assert.False(headers.Contains("doesntexist")); } @@ -1449,8 +1521,8 @@ namespace System.Net.Http.Tests public void Contains_CallContainsForEmptyHeader_ReturnsFalse() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, string.Empty); - Assert.False(headers.Contains(knownHeader)); + headers.Add(headers.Descriptor, string.Empty); + Assert.False(headers.Contains(headers.Descriptor)); } [Fact] @@ -1461,13 +1533,13 @@ namespace System.Net.Http.Tests headers.Add("custom2", "customValue2"); headers.Add("custom3", "customValue3"); headers.Add("custom4", "customValue4"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); // Nothing got parsed so far since we just added custom headers and for the known header we called // TryAddWithoutValidation(). Assert.Equal(0, headers.Parser.TryParseValueCallCount); - Assert.True(headers.Contains(knownHeader)); + Assert.True(headers.Contains(headers.Descriptor)); // Contains() should trigger parsing of values added with TryAddWithoutValidation(): If the value was invalid, // i.e. contains invalid newline chars, then the header will be removed from the collection. @@ -1479,10 +1551,10 @@ namespace System.Net.Http.Tests { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); headers.TryAddWithoutValidation("custom", "invalid\r\nvalue"); - Assert.False(headers.Contains(knownHeader), "Store should not have an entry for 'knownHeader'."); + Assert.False(headers.Contains(headers.Descriptor), "Store should not have an entry for 'knownHeader'."); Assert.False(headers.Contains("custom"), "Store should not have an entry for 'custom'."); } @@ -1499,9 +1571,9 @@ namespace System.Net.Http.Tests public void GetEnumerator_FirstHeaderWithOneValueSecondHeaderWithTwoValues_EnumeratorReturnsTwoHeaders() { MockHeaders headers = new MockHeaders(); - headers.Add(customHeader, "custom0"); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(customHeaderName, "custom0"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); // The value added with TryAddWithoutValidation() wasn't parsed yet. Assert.Equal(1, headers.Parser.TryParseValueCallCount); @@ -1512,7 +1584,7 @@ namespace System.Net.Http.Tests Assert.Equal(1, headers.Parser.TryParseValueCallCount); Assert.True(enumerator.MoveNext()); - Assert.Equal(customHeader, enumerator.Current.Key); + Assert.Equal(customHeaderName, enumerator.Current.Key); Assert.Equal(1, enumerator.Current.Value.Count()); Assert.Equal("custom0", enumerator.Current.Value.ElementAt(0)); @@ -1521,7 +1593,7 @@ namespace System.Net.Http.Tests Assert.Equal(1, headers.Parser.TryParseValueCallCount); Assert.True(enumerator.MoveNext()); - Assert.Equal(knownHeader, enumerator.Current.Key); + Assert.Equal(headers.Descriptor.Name, enumerator.Current.Key); Assert.Equal(2, enumerator.Current.Value.Count()); Assert.Equal(parsedPrefix + "1", enumerator.Current.Value.ElementAt(0)); Assert.Equal(parsedPrefix + "2", enumerator.Current.Value.ElementAt(1)); @@ -1536,13 +1608,13 @@ namespace System.Net.Http.Tests public void GetEnumerator_FirstCustomHeaderWithEmptyValueSecondKnownHeaderWithEmptyValue_EnumeratorReturnsOneHeader() { MockHeaders headers = new MockHeaders(); - headers.Add(customHeader, string.Empty); - headers.Add(knownHeader, string.Empty); + headers.Add(customHeaderName, string.Empty); + headers.Add(headers.Descriptor, string.Empty); var enumerator = headers.GetEnumerator(); Assert.True(enumerator.MoveNext()); - Assert.Equal(customHeader, enumerator.Current.Key); + Assert.Equal(customHeaderName, enumerator.Current.Key); Assert.Equal(1, enumerator.Current.Value.Count()); Assert.Equal(string.Empty, enumerator.Current.Value.ElementAt(0)); @@ -1580,10 +1652,10 @@ namespace System.Net.Http.Tests { Uri headerValue = new Uri("http://example.org/"); - CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); - headers.AddParsedValue("myheader", headerValue); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.AddParsedValue(customTypeHeader, headerValue); - Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); + Assert.True(headers.Contains(customTypeHeader), "Store doesn't have the header after adding a value to it."); Assert.Equal(headerValue.ToString(), headers.First().Value.ElementAt(0)); } @@ -1593,10 +1665,10 @@ namespace System.Net.Http.Tests { int headerValue = 5; - CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); - headers.AddParsedValue("myheader", headerValue); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.AddParsedValue(customTypeHeader, headerValue); - Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); + Assert.True(headers.Contains(customTypeHeader), "Store doesn't have the header after adding a value to it."); Assert.Equal(headerValue.ToString(), headers.First().Value.ElementAt(0)); } @@ -1607,15 +1679,15 @@ namespace System.Net.Http.Tests Uri headerValue1 = new Uri("http://example.org/1/"); Uri headerValue2 = new Uri("http://example.org/2/"); - CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); - headers.AddParsedValue("myheader", headerValue1); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.AddParsedValue(customTypeHeader, headerValue1); // Adding a second value will cause a List to be created in order to store values. If we just add // one value, no List is created, but the header is just added as store value. - headers.AddParsedValue("myheader", headerValue2); + headers.AddParsedValue(customTypeHeader, headerValue2); - Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); - Assert.Equal(2, headers.GetValues("myheader").Count()); + Assert.True(headers.Contains(customTypeHeader), "Store doesn't have the header after adding a value to it."); + Assert.Equal(2, headers.GetValues(customTypeHeader).Count()); Assert.Equal(headerValue1.ToString(), headers.First().Value.ElementAt(0)); Assert.Equal(headerValue2.ToString(), headers.First().Value.ElementAt(1)); @@ -1625,17 +1697,17 @@ namespace System.Net.Http.Tests public void AddParsedValue_UseDifferentAddMethods_AllValuesAddedCorrectly() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); Assert.Equal(1, headers.Parser.TryParseValueCallCount); - headers.AddParsedValue(knownHeader, parsedPrefix + "3"); + headers.AddParsedValue(headers.Descriptor, parsedPrefix + "3"); // Adding a parsed value, will trigger all raw values to be parsed. Assert.Equal(2, headers.Parser.TryParseValueCallCount); - Assert.Equal(3, headers.GetValues(knownHeader).Count()); + Assert.Equal(3, headers.GetValues(headers.Descriptor).Count()); Assert.Equal(parsedPrefix + "1", headers.First().Value.ElementAt(0)); Assert.Equal(parsedPrefix + "2", headers.First().Value.ElementAt(1)); Assert.Equal(parsedPrefix + "3", headers.First().Value.ElementAt(2)); @@ -1647,15 +1719,15 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Add header value with invalid newline chars. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - headers.AddParsedValue(knownHeader, parsedPrefix + "1"); + headers.AddParsedValue(headers.Descriptor, parsedPrefix + "1"); - Assert.True(headers.Contains(knownHeader), "Store should have an entry for 'knownHeader'."); - Assert.Equal(1, headers.GetValues(knownHeader).Count()); - Assert.Equal(parsedPrefix + "1", headers.GetValues(knownHeader).First()); + Assert.True(headers.Contains(headers.Descriptor), "Store should have an entry for 'knownHeader'."); + Assert.Equal(1, headers.GetValues(headers.Descriptor).Count()); + Assert.Equal(parsedPrefix + "1", headers.GetValues(headers.Descriptor).First()); } [Fact] @@ -1664,17 +1736,17 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // Add header value with invalid newline chars. - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue + "\r\ninvalid"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "0"); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue + "\r\ninvalid"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "0"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - headers.AddParsedValue(knownHeader, parsedPrefix + "1"); + headers.AddParsedValue(headers.Descriptor, parsedPrefix + "1"); - Assert.True(headers.Contains(knownHeader), "Store should have an entry for 'knownHeader'."); - Assert.Equal(2, headers.GetValues(knownHeader).Count()); - Assert.Equal(parsedPrefix + "0", headers.GetValues(knownHeader).ElementAt(0)); - Assert.Equal(parsedPrefix + "1", headers.GetValues(knownHeader).ElementAt(1)); + Assert.True(headers.Contains(headers.Descriptor), "Store should have an entry for 'knownHeader'."); + Assert.Equal(2, headers.GetValues(headers.Descriptor).Count()); + Assert.Equal(parsedPrefix + "0", headers.GetValues(headers.Descriptor).ElementAt(0)); + Assert.Equal(parsedPrefix + "1", headers.GetValues(headers.Descriptor).ElementAt(1)); } [Fact] @@ -1682,10 +1754,10 @@ namespace System.Net.Http.Tests { Uri headerValue = new Uri("http://example.org/"); - CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); - headers.SetParsedValue("myheader", headerValue); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.SetParsedValue(customTypeHeader, headerValue); - Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); + Assert.True(headers.Contains(customTypeHeader), "Store doesn't have the header after adding a value to it."); Assert.Equal(headerValue.ToString(), headers.First().Value.ElementAt(0)); } @@ -1696,14 +1768,14 @@ namespace System.Net.Http.Tests Uri headerValue1 = new Uri("http://example.org/1/"); Uri headerValue2 = new Uri("http://example.org/2/"); - CustomTypeHeaders headers = new CustomTypeHeaders("myheader", new CustomTypeHeaderParser()); - headers.SetParsedValue("myheader", headerValue1); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.SetParsedValue(customTypeHeader, headerValue1); // The following line will remove the previously added values and replace them with the provided value. - headers.SetParsedValue("myheader", headerValue2); + headers.SetParsedValue(customTypeHeader, headerValue2); - Assert.True(headers.Contains("myheader"), "Store doesn't have the header after adding a value to it."); - Assert.Equal(1, headers.GetValues("myheader").Count()); + Assert.True(headers.Contains(customTypeHeader), "Store doesn't have the header after adding a value to it."); + Assert.Equal(1, headers.GetValues(customTypeHeader).Count()); // The second value replaces the first value. Assert.Equal(headerValue2.ToString(), headers.First().Value.ElementAt(0)); @@ -1713,17 +1785,17 @@ namespace System.Net.Http.Tests public void SetParsedValue_SetValueAfterAddingMultipleValues_SetValueReplacesOtherValues() { MockHeaders headers = new MockHeaders(); - headers.Add(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); + headers.Add(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); Assert.Equal(1, headers.Parser.TryParseValueCallCount); - headers.SetParsedValue(knownHeader, parsedPrefix + "3"); + headers.SetParsedValue(headers.Descriptor, parsedPrefix + "3"); // Adding a parsed value, will trigger all raw values to be parsed. Assert.Equal(2, headers.Parser.TryParseValueCallCount); - Assert.Equal(1, headers.GetValues(knownHeader).Count()); + Assert.Equal(1, headers.GetValues(headers.Descriptor).Count()); Assert.Equal(parsedPrefix + "3", headers.First().Value.ElementAt(0)); } @@ -1738,7 +1810,7 @@ namespace System.Net.Http.Tests public void ContainsParsedValue_ContainsParsedValueForNonExistingHeader_ReturnsFalse() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); Assert.Equal(0, headers.Parser.TryParseValueCallCount); @@ -1746,7 +1818,7 @@ namespace System.Net.Http.Tests // ContainsParsedValue() must not trigger raw value parsing for headers other than the requested one. // In this case we expect ContainsParsedValue(customeHeader) not to trigger raw value parsing for - // 'knownHeader'. + // 'headers.Descriptor'. Assert.Equal(0, headers.Parser.TryParseValueCallCount); } @@ -1754,22 +1826,22 @@ namespace System.Net.Http.Tests public void ContainsParsedValue_ContainsParsedValueForNonExistingHeaderValue_ReturnsFalse() { MockHeaders headers = new MockHeaders(); - headers.AddParsedValue(knownHeader, "value1"); - headers.AddParsedValue(knownHeader, "value2"); + headers.AddParsedValue(headers.Descriptor, "value1"); + headers.AddParsedValue(headers.Descriptor, "value2"); // After adding two values to header 'knownHeader' we ask for a non-existing value. - Assert.False(headers.ContainsParsedValue(knownHeader, "doesntexist")); + Assert.False(headers.ContainsParsedValue(headers.Descriptor, "doesntexist")); } [Fact] public void ContainsParsedValue_ContainsParsedValueForExistingHeaderButNonAvailableValue_ReturnsFalse() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - Assert.False(headers.ContainsParsedValue(knownHeader, "custom1")); + Assert.False(headers.ContainsParsedValue(headers.Descriptor, "custom1")); // ContainsParsedValue() must trigger raw value parsing for the header it was asked for. Assert.Equal(1, headers.Parser.TryParseValueCallCount); @@ -1779,14 +1851,14 @@ namespace System.Net.Http.Tests public void ContainsParsedValue_ContainsParsedValueForExistingHeaderWithAvailableValue_ReturnsTrue() { MockHeaders headers = new MockHeaders(); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "3"); - headers.TryAddWithoutValidation(knownHeader, rawPrefix + "4"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "1"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "2"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "3"); + headers.TryAddWithoutValidation(headers.Descriptor, rawPrefix + "4"); Assert.Equal(0, headers.Parser.TryParseValueCallCount); - Assert.True(headers.ContainsParsedValue(knownHeader, parsedPrefix + "3")); + Assert.True(headers.ContainsParsedValue(headers.Descriptor, parsedPrefix + "3")); // ContainsParsedValue() must trigger raw value parsing for the header it was asked for. Assert.Equal(4, headers.Parser.TryParseValueCallCount); @@ -1796,45 +1868,45 @@ namespace System.Net.Http.Tests public void ContainsParsedValue_AddOneValueToKnownHeaderAndCompareWithValueThatDiffersInCase_CustomComparerUsedForComparison() { MockHeaders headers = new MockHeaders(); - headers.AddParsedValue(knownHeader, "value"); + headers.AddParsedValue(headers.Descriptor, "value"); // Our custom comparer (MockComparer) does case-insensitive value comparison. Verify that our custom // comparer is used to compare the header value. - Assert.True(headers.ContainsParsedValue(knownHeader, "VALUE")); + Assert.True(headers.ContainsParsedValue(headers.Descriptor, "VALUE")); Assert.Equal(1, headers.Parser.MockComparer.EqualsCount); headers.Clear(); - headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue); - Assert.False(headers.ContainsParsedValue(knownHeader, invalidHeaderValue)); + headers.TryAddWithoutValidation(headers.Descriptor, invalidHeaderValue); + Assert.False(headers.ContainsParsedValue(headers.Descriptor, invalidHeaderValue)); } [Fact] public void ContainsParsedValue_AddTwoValuesToKnownHeaderAndCompareWithValueThatDiffersInCase_CustomComparerUsedForComparison() { MockHeaders headers = new MockHeaders(); - headers.AddParsedValue(knownHeader, "differentvalue"); - headers.AddParsedValue(knownHeader, "value"); + headers.AddParsedValue(headers.Descriptor, "differentvalue"); + headers.AddParsedValue(headers.Descriptor, "value"); // Our custom comparer (MockComparer) does case-insensitive value comparison. Verify that our custom // comparer is used to compare the header value. // Note that since we added 2 values a different code path than in the previous test is used. In this // case we have stored the values as List internally. - Assert.True(headers.ContainsParsedValue(knownHeader, "VALUE")); + Assert.True(headers.ContainsParsedValue(headers.Descriptor, "VALUE")); Assert.Equal(2, headers.Parser.MockComparer.EqualsCount); } [Fact] public void ContainsParsedValue_ParserWithNoEqualityComparer_CaseSensitiveComparison() { - CustomTypeHeaders headers = new CustomTypeHeaders("noComparerHeader", new NoComparerHeaderParser()); - headers.AddParsedValue("noComparerHeader", "lowercasevalue"); + CustomTypeHeaders headers = new CustomTypeHeaders(); + headers.AddParsedValue(noComparerHeader, "lowercasevalue"); // Since we don't provide a comparer, the default string.Equals() is called which is case-sensitive. So // the following call should return false. - Assert.False(headers.ContainsParsedValue("noComparerHeader", "LOWERCASEVALUE")); + Assert.False(headers.ContainsParsedValue(noComparerHeader, "LOWERCASEVALUE")); // Now we try to use the correct casing. This should return true. - Assert.True(headers.ContainsParsedValue("noComparerHeader", "lowercasevalue")); + Assert.True(headers.ContainsParsedValue(noComparerHeader, "lowercasevalue")); } [Fact] @@ -1843,46 +1915,40 @@ namespace System.Net.Http.Tests MockHeaders headers = new MockHeaders(); // This will create a header entry with no value. - headers.Add(knownHeader, string.Empty); + headers.Add(headers.Descriptor, string.Empty); - Assert.False(headers.Contains(knownHeader), "Expected known header to be in the store."); + Assert.False(headers.Contains(headers.Descriptor), "Expected known header to be in the store."); // This will just return fals and not touch the header. - Assert.False(headers.ContainsParsedValue(knownHeader, "x"), + Assert.False(headers.ContainsParsedValue(headers.Descriptor, "x"), "Expected 'ContainsParsedValue' to return false."); } [Fact] public void AddHeaders_SourceAndDestinationStoreHaveMultipleHeaders_OnlyHeadersNotInDestinationAreCopiedFromSource() { - Dictionary parserStore = new Dictionary(); - parserStore.Add("known1", new MockHeaderParser()); - parserStore.Add("known2", new MockHeaderParser()); - parserStore.Add("known3", new MockHeaderParser()); - parserStore.Add("known4", new CustomTypeHeaderParser()); - // Add header values to the source store. - MockHeaders source = new MockHeaders(parserStore); + MockHeaders source = new MockHeaders(); source.Add("custom1", "source10"); source.Add("custom1", "source11"); source.TryAddWithoutValidation("custom2", "source2"); - source.Add("known1", rawPrefix + "3"); - source.TryAddWithoutValidation("known1", rawPrefix + "4"); + source.Add(known1Header, rawPrefix + "3"); + source.TryAddWithoutValidation(known1Header, rawPrefix + "4"); - source.TryAddWithoutValidation("known2", rawPrefix + "5"); - source.TryAddWithoutValidation("known2", invalidHeaderValue); - source.TryAddWithoutValidation("known2", rawPrefix + "7"); + source.TryAddWithoutValidation(known2Header, rawPrefix + "5"); + source.TryAddWithoutValidation(known2Header, invalidHeaderValue); + source.TryAddWithoutValidation(known2Header, rawPrefix + "7"); // this header value gets removed when it gets parsed. - source.TryAddWithoutValidation("known3", (string)null); - source.Add("known3", string.Empty); + source.TryAddWithoutValidation(known3Header, (string)null); + source.Add(known3Header, string.Empty); DateTimeOffset known4Value1 = new DateTimeOffset(2010, 6, 15, 18, 31, 34, TimeSpan.Zero); DateTimeOffset known4Value2 = new DateTimeOffset(2010, 4, 8, 11, 21, 04, TimeSpan.Zero); - source.AddParsedValue("known4", known4Value1); - source.AddParsedValue("known4", known4Value2); + source.AddParsedValue(known4Header, known4Value1); + source.AddParsedValue(known4Header, known4Value2); source.Add("custom5", "source5"); source.TryAddWithoutValidation("custom6", (string)null); @@ -1893,9 +1959,9 @@ namespace System.Net.Http.Tests source.Add("custom7", string.Empty); // Add header values to the destination store. - MockHeaders destination = new MockHeaders(parserStore); + MockHeaders destination = new MockHeaders(); destination.Add("custom2", "destination1"); - destination.Add("known1", rawPrefix + "9"); + destination.Add(known1Header, rawPrefix + "9"); // Now add all headers that are in source but not destination to destination. destination.AddHeaders(source); @@ -1911,22 +1977,22 @@ namespace System.Net.Http.Tests Assert.Equal("destination1", destination.GetValues("custom2").First()); // This value was set in destination. The header in source was ignored. - Assert.Equal(1, destination.GetValues("known1").Count()); - Assert.Equal(parsedPrefix + "9", destination.GetValues("known1").First()); + Assert.Equal(1, destination.GetValues(known1Header).Count()); + Assert.Equal(parsedPrefix + "9", destination.GetValues(known1Header).First()); // The header in source gets first parsed and then copied to destination. Note that here we have one // invalid value. - Assert.Equal(3, destination.GetValues("known2").Count()); - Assert.Equal(parsedPrefix + "5", destination.GetValues("known2").ElementAt(0)); - Assert.Equal(parsedPrefix + "7", destination.GetValues("known2").ElementAt(1)); - Assert.Equal(invalidHeaderValue, destination.GetValues("known2").ElementAt(2)); + Assert.Equal(3, destination.GetValues(known2Header).Count()); + Assert.Equal(parsedPrefix + "5", destination.GetValues(known2Header).ElementAt(0)); + Assert.Equal(parsedPrefix + "7", destination.GetValues(known2Header).ElementAt(1)); + Assert.Equal(invalidHeaderValue, destination.GetValues(known2Header).ElementAt(2)); // Header 'known3' should not be copied, since it doesn't contain any values. - Assert.False(destination.Contains("known3"), "'known3' header value count."); + Assert.False(destination.Contains(known3Header), "'known3' header value count."); - Assert.Equal(2, destination.GetValues("known4").Count()); - Assert.Equal(known4Value1.ToString(), destination.GetValues("known4").ElementAt(0)); - Assert.Equal(known4Value2.ToString(), destination.GetValues("known4").ElementAt(1)); + Assert.Equal(2, destination.GetValues(known4Header).Count()); + Assert.Equal(known4Value1.ToString(), destination.GetValues(known4Header).ElementAt(0)); + Assert.Equal(known4Value2.ToString(), destination.GetValues(known4Header).ElementAt(1)); Assert.Equal("source5", destination.GetValues("custom5").First()); @@ -1942,13 +2008,10 @@ namespace System.Net.Http.Tests [Fact] public void AddHeaders_SourceHasEmptyHeaderStore_DestinationRemainsUnchanged() { - Dictionary parserStore = new Dictionary(); - parserStore.Add("known1", new MockHeaderParser()); + MockHeaders source = new MockHeaders(); - MockHeaders source = new MockHeaders(parserStore); - - MockHeaders destination = new MockHeaders(parserStore); - destination.Add("known1", rawPrefix); + MockHeaders destination = new MockHeaders(); + destination.Add(known1Header, rawPrefix); destination.AddHeaders(source); @@ -1958,13 +2021,10 @@ namespace System.Net.Http.Tests [Fact] public void AddHeaders_DestinationHasEmptyHeaderStore_DestinationHeaderStoreGetsCreatedAndValuesAdded() { - Dictionary parserStore = new Dictionary(); - parserStore.Add("known1", new MockHeaderParser()); + MockHeaders source = new MockHeaders(); + source.Add(known1Header, rawPrefix); - MockHeaders source = new MockHeaders(parserStore); - source.Add("known1", rawPrefix); - - MockHeaders destination = new MockHeaders(parserStore); + MockHeaders destination = new MockHeaders(); destination.AddHeaders(source); @@ -1974,53 +2034,67 @@ namespace System.Net.Http.Tests [Fact] public void AddHeaders_SourceHasInvalidHeaderValues_InvalidHeadersRemovedFromSourceAndNotCopiedToDestination() { - Dictionary parserStore = new Dictionary(); - parserStore.Add("known", new MockHeaderParser()); - - MockHeaders source = new MockHeaders(parserStore); - source.TryAddWithoutValidation("known", invalidHeaderValue + "\r\ninvalid"); + MockHeaders source = new MockHeaders(); + source.TryAddWithoutValidation(known1Header, invalidHeaderValue + "\r\ninvalid"); source.TryAddWithoutValidation("custom", "invalid\r\nvalue"); - MockHeaders destination = new MockHeaders(parserStore); + MockHeaders destination = new MockHeaders(); destination.AddHeaders(source); Assert.Equal(0, source.Count()); - Assert.False(source.Contains("known"), "source contains 'known' header."); + Assert.False(source.Contains(known1Header), "source contains 'known' header."); Assert.False(source.Contains("custom"), "source contains 'custom' header."); Assert.Equal(0, destination.Count()); - Assert.False(destination.Contains("known"), "destination contains 'known' header."); + Assert.False(destination.Contains(known1Header), "destination contains 'known' header."); Assert.False(destination.Contains("custom"), "destination contains 'custom' header."); } + public static IEnumerable GetInvalidHeaderNames() + { + yield return new object[] { "invalid header" }; + yield return new object[] { "invalid\theader" }; + yield return new object[] { "invalid\rheader" }; + yield return new object[] { "invalid\nheader" }; + yield return new object[] { "invalid(header" }; + yield return new object[] { "invalid)header" }; + yield return new object[] { "invalidheader" }; + yield return new object[] { "invalid@header" }; + yield return new object[] { "invalid,header" }; + yield return new object[] { "invalid;header" }; + yield return new object[] { "invalid:header" }; + yield return new object[] { "invalid\\header" }; + yield return new object[] { "invalid\"header" }; + yield return new object[] { "invalid/header" }; + yield return new object[] { "invalid[header" }; + yield return new object[] { "invalid]header" }; + yield return new object[] { "invalid?header" }; + yield return new object[] { "invalid=header" }; + yield return new object[] { "invalid{header" }; + yield return new object[] { "invalid}header" }; + } + #region Helper methods private class MockHeaders : HttpHeaders { - private MockHeaderParser parser; + private MockHeaderParser _parser; + private HeaderDescriptor _descriptor; - public MockHeaderParser Parser - { - get { return parser; } - } + public MockHeaderParser Parser => _parser; + public HeaderDescriptor Descriptor => _descriptor; public MockHeaders(MockHeaderParser parser) : base() { - Dictionary parserStore = new Dictionary(); - this.parser = parser; - parserStore.Add(knownHeader, this.parser); - SetConfiguration(parserStore, new HashSet()); + _parser = parser; + _descriptor = (new KnownHeader("known", HttpHeaderType.General, parser)).Descriptor; } public MockHeaders() : this(new MockHeaderParser()) { } - - public MockHeaders(Dictionary parserStore) - { - SetConfiguration(parserStore, new HashSet()); - } } private class MockHeaderParser : HttpHeaderParser @@ -2046,7 +2120,7 @@ namespace System.Net.Http.Tests this.MockComparer = new MockComparer(); } - #region IHeaderParser Members +#region IHeaderParser Members public override IEqualityComparer Comparer { @@ -2106,7 +2180,7 @@ namespace System.Net.Http.Tests Assert.StartsWith(invalidHeaderValue, tempValue, StringComparison.Ordinal); return false; } - #endregion +#endregion } private class MockComparer : IEqualityComparer @@ -2114,7 +2188,7 @@ namespace System.Net.Http.Tests public int GetHashCodeCount { get; private set; } public int EqualsCount { get; private set; } - #region IEqualityComparer Members +#region IEqualityComparer Members public new bool Equals(object x, object y) { @@ -2139,7 +2213,7 @@ namespace System.Net.Http.Tests GetHashCodeCount++; return obj.GetHashCode(); } - #endregion +#endregion } private class CustomTypeHeaders : HttpHeaders @@ -2147,13 +2221,6 @@ namespace System.Net.Http.Tests public CustomTypeHeaders() { } - - public CustomTypeHeaders(string headerName, HttpHeaderParser parser) - { - Dictionary parserStore = new Dictionary(); - parserStore.Add(headerName, parser); - SetConfiguration(parserStore, new HashSet()); - } } private class CustomTypeHeaderParser : HttpHeaderParser @@ -2178,7 +2245,7 @@ namespace System.Net.Http.Tests private class CustomTypeComparer : IEqualityComparer { - #region IEqualityComparer Members +#region IEqualityComparer Members public new bool Equals(object x, object y) { @@ -2192,7 +2259,7 @@ namespace System.Net.Http.Tests Assert.NotNull(obj); return obj.GetHashCode(); } - #endregion +#endregion } private class NoComparerHeaderParser : HttpHeaderParser @@ -2207,6 +2274,6 @@ namespace System.Net.Http.Tests throw new NotImplementedException(); } } - #endregion +#endregion } } diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpRequestHeadersTest.cs b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpRequestHeadersTest.cs index dfda6d795b..2905ff633e 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpRequestHeadersTest.cs +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpRequestHeadersTest.cs @@ -615,26 +615,26 @@ namespace System.Net.Http.Tests public void UserAgent_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("User-Agent", "custom\u4F1A"); - Assert.Null(headers.GetParsedValues("User-Agent")); + Assert.Null(headers.GetParsedValues(KnownHeaders.UserAgent.Descriptor)); Assert.Equal(1, headers.GetValues("User-Agent").Count()); Assert.Equal("custom\u4F1A", headers.GetValues("User-Agent").First()); headers.Clear(); // Note that "User-Agent" uses whitespace as separators, so the following is an invalid value headers.TryAddWithoutValidation("User-Agent", "custom1, custom2"); - Assert.Null(headers.GetParsedValues("User-Agent")); + Assert.Null(headers.GetParsedValues(KnownHeaders.UserAgent.Descriptor)); Assert.Equal(1, headers.GetValues("User-Agent").Count()); Assert.Equal("custom1, custom2", headers.GetValues("User-Agent").First()); headers.Clear(); headers.TryAddWithoutValidation("User-Agent", "custom1, "); - Assert.Null(headers.GetParsedValues("User-Agent")); + Assert.Null(headers.GetParsedValues(KnownHeaders.UserAgent.Descriptor)); Assert.Equal(1, headers.GetValues("User-Agent").Count()); Assert.Equal("custom1, ", headers.GetValues("User-Agent").First()); headers.Clear(); headers.TryAddWithoutValidation("User-Agent", ",custom1"); - Assert.Null(headers.GetParsedValues("User-Agent")); + Assert.Null(headers.GetParsedValues(KnownHeaders.UserAgent.Descriptor)); Assert.Equal(1, headers.GetValues("User-Agent").Count()); Assert.Equal(",custom1", headers.GetValues("User-Agent").First()); } @@ -686,13 +686,13 @@ namespace System.Net.Http.Tests public void IfRange_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("If-Range", "\"tag\"\u4F1A"); - Assert.Null(headers.GetParsedValues("If-Range")); + Assert.Null(headers.GetParsedValues(KnownHeaders.IfRange.Descriptor)); Assert.Equal(1, headers.GetValues("If-Range").Count()); Assert.Equal("\"tag\"\u4F1A", headers.GetValues("If-Range").First()); headers.Clear(); headers.TryAddWithoutValidation("If-Range", " \"tag\", "); - Assert.Null(headers.GetParsedValues("If-Range")); + Assert.Null(headers.GetParsedValues(KnownHeaders.IfRange.Descriptor)); Assert.Equal(1, headers.GetValues("If-Range").Count()); Assert.Equal(" \"tag\", ", headers.GetValues("If-Range").First()); } @@ -730,13 +730,13 @@ namespace System.Net.Http.Tests public void From_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("From", " info@example.com ,"); - Assert.Null(headers.GetParsedValues("From")); + Assert.Null(headers.GetParsedValues(KnownHeaders.From.Descriptor)); Assert.Equal(1, headers.GetValues("From").Count()); Assert.Equal(" info@example.com ,", headers.GetValues("From").First()); headers.Clear(); headers.TryAddWithoutValidation("From", "info@"); - Assert.Null(headers.GetParsedValues("From")); + Assert.Null(headers.GetParsedValues(KnownHeaders.From.Descriptor)); Assert.Equal(1, headers.GetValues("From").Count()); Assert.Equal("info@", headers.GetValues("From").First()); } @@ -771,13 +771,13 @@ namespace System.Net.Http.Tests public void IfModifiedSince_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("If-Modified-Since", " Sun, 06 Nov 1994 08:49:37 GMT ,"); - Assert.Null(headers.GetParsedValues("If-Modified-Since")); + Assert.Null(headers.GetParsedValues(KnownHeaders.IfModifiedSince.Descriptor)); Assert.Equal(1, headers.GetValues("If-Modified-Since").Count()); Assert.Equal(" Sun, 06 Nov 1994 08:49:37 GMT ,", headers.GetValues("If-Modified-Since").First()); headers.Clear(); headers.TryAddWithoutValidation("If-Modified-Since", " Sun, 06 Nov "); - Assert.Null(headers.GetParsedValues("If-Modified-Since")); + Assert.Null(headers.GetParsedValues(KnownHeaders.IfModifiedSince.Descriptor)); Assert.Equal(1, headers.GetValues("If-Modified-Since").Count()); Assert.Equal(" Sun, 06 Nov ", headers.GetValues("If-Modified-Since").First()); } @@ -812,13 +812,13 @@ namespace System.Net.Http.Tests public void IfUnmodifiedSince_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("If-Unmodified-Since", " Sun, 06 Nov 1994 08:49:37 GMT ,"); - Assert.Null(headers.GetParsedValues("If-Unmodified-Since")); + Assert.Null(headers.GetParsedValues(KnownHeaders.IfUnmodifiedSince.Descriptor)); Assert.Equal(1, headers.GetValues("If-Unmodified-Since").Count()); Assert.Equal(" Sun, 06 Nov 1994 08:49:37 GMT ,", headers.GetValues("If-Unmodified-Since").First()); headers.Clear(); headers.TryAddWithoutValidation("If-Unmodified-Since", " Sun, 06 Nov "); - Assert.Null(headers.GetParsedValues("If-Unmodified-Since")); + Assert.Null(headers.GetParsedValues(KnownHeaders.IfUnmodifiedSince.Descriptor)); Assert.Equal(1, headers.GetValues("If-Unmodified-Since").Count()); Assert.Equal(" Sun, 06 Nov ", headers.GetValues("If-Unmodified-Since").First()); } @@ -853,13 +853,13 @@ namespace System.Net.Http.Tests public void Referrer_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Referer", " http://example.com http://other"); - Assert.Null(headers.GetParsedValues("Referer")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Referer.Descriptor)); Assert.Equal(1, headers.GetValues("Referer").Count()); Assert.Equal(" http://example.com http://other", headers.GetValues("Referer").First()); headers.Clear(); headers.TryAddWithoutValidation("Referer", "http://host /other"); - Assert.Null(headers.GetParsedValues("Referer")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Referer.Descriptor)); Assert.Equal(1, headers.GetValues("Referer").Count()); Assert.Equal("http://host /other", headers.GetValues("Referer").First()); } @@ -897,13 +897,13 @@ namespace System.Net.Http.Tests public void MaxForwards_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Max-Forwards", "15,"); - Assert.Null(headers.GetParsedValues("Max-Forwards")); + Assert.Null(headers.GetParsedValues(KnownHeaders.MaxForwards.Descriptor)); Assert.Equal(1, headers.GetValues("Max-Forwards").Count()); Assert.Equal("15,", headers.GetValues("Max-Forwards").First()); headers.Clear(); headers.TryAddWithoutValidation("Max-Forwards", "1.0"); - Assert.Null(headers.GetParsedValues("Max-Forwards")); + Assert.Null(headers.GetParsedValues(KnownHeaders.MaxForwards.Descriptor)); Assert.Equal(1, headers.GetValues("Max-Forwards").Count()); Assert.Equal("1.0", headers.GetValues("Max-Forwards").First()); } @@ -1173,13 +1173,13 @@ namespace System.Net.Http.Tests public void TransferEncoding_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Transfer-Encoding", "custom\u4F1A"); - Assert.Null(headers.GetParsedValues("Transfer-Encoding")); + Assert.Null(headers.GetParsedValues(KnownHeaders.TransferEncoding.Descriptor)); Assert.Equal(1, headers.GetValues("Transfer-Encoding").Count()); Assert.Equal("custom\u4F1A", headers.GetValues("Transfer-Encoding").First()); headers.Clear(); headers.TryAddWithoutValidation("Transfer-Encoding", "custom1 custom2"); - Assert.Null(headers.GetParsedValues("Transfer-Encoding")); + Assert.Null(headers.GetParsedValues(KnownHeaders.TransferEncoding.Descriptor)); Assert.Equal(1, headers.GetValues("Transfer-Encoding").Count()); Assert.Equal("custom1 custom2", headers.GetValues("Transfer-Encoding").First()); @@ -1227,13 +1227,13 @@ namespace System.Net.Http.Tests public void Upgrade_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Upgrade", "custom\u4F1A"); - Assert.Null(headers.GetParsedValues("Upgrade")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Upgrade.Descriptor)); Assert.Equal(1, headers.GetValues("Upgrade").Count()); Assert.Equal("custom\u4F1A", headers.GetValues("Upgrade").First()); headers.Clear(); headers.TryAddWithoutValidation("Upgrade", "custom1 custom2"); - Assert.Null(headers.GetParsedValues("Upgrade")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Upgrade.Descriptor)); Assert.Equal(1, headers.GetValues("Upgrade").Count()); Assert.Equal("custom1 custom2", headers.GetValues("Upgrade").First()); } @@ -1272,13 +1272,13 @@ namespace System.Net.Http.Tests public void Date_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Date", " Sun, 06 Nov 1994 08:49:37 GMT ,"); - Assert.Null(headers.GetParsedValues("Date")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Date.Descriptor)); Assert.Equal(1, headers.GetValues("Date").Count()); Assert.Equal(" Sun, 06 Nov 1994 08:49:37 GMT ,", headers.GetValues("Date").First()); headers.Clear(); headers.TryAddWithoutValidation("Date", " Sun, 06 Nov "); - Assert.Null(headers.GetParsedValues("Date")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Date.Descriptor)); Assert.Equal(1, headers.GetValues("Date").Count()); Assert.Equal(" Sun, 06 Nov ", headers.GetValues("Date").First()); } diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpResponseHeadersTest.cs b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpResponseHeadersTest.cs index 633c840bce..b23112e18b 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpResponseHeadersTest.cs +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/Headers/HttpResponseHeadersTest.cs @@ -57,7 +57,7 @@ namespace System.Net.Http.Tests public void Location_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Location", " http://example.com http://other"); - Assert.Null(headers.GetParsedValues("Location")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Location.Descriptor)); Assert.Equal(1, headers.GetValues("Location").Count()); Assert.Equal(" http://example.com http://other", headers.GetValues("Location").First()); } @@ -311,26 +311,26 @@ namespace System.Net.Http.Tests public void Server_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Server", "custom会"); - Assert.Null(headers.GetParsedValues("Server")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Server.Descriptor)); Assert.Equal(1, headers.GetValues("Server").Count()); Assert.Equal("custom会", headers.GetValues("Server").First()); headers.Clear(); // Note that "Server" uses whitespace as separators, so the following is an invalid value headers.TryAddWithoutValidation("Server", "custom1, custom2"); - Assert.Null(headers.GetParsedValues("Server")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Server.Descriptor)); Assert.Equal(1, headers.GetValues("Server").Count()); Assert.Equal("custom1, custom2", headers.GetValues("Server").First()); headers.Clear(); headers.TryAddWithoutValidation("Server", "custom1, "); - Assert.Null(headers.GetParsedValues("Server")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Server.Descriptor)); Assert.Equal(1, headers.GetValues("Server").Count()); Assert.Equal("custom1, ", headers.GetValues("Server").First()); headers.Clear(); headers.TryAddWithoutValidation("Server", ",custom1"); - Assert.Null(headers.GetParsedValues("Server")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Server.Descriptor)); Assert.Equal(1, headers.GetValues("Server").Count()); Assert.Equal(",custom1", headers.GetValues("Server").First()); } @@ -454,13 +454,13 @@ namespace System.Net.Http.Tests public void Age_UseAddMethodWithInvalidValue_InvalidValueRecognized() { headers.TryAddWithoutValidation("Age", "10,"); - Assert.Null(headers.GetParsedValues("Age")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Age.Descriptor)); Assert.Equal(1, headers.GetValues("Age").Count()); Assert.Equal("10,", headers.GetValues("Age").First()); headers.Clear(); headers.TryAddWithoutValidation("Age", "1.1"); - Assert.Null(headers.GetParsedValues("Age")); + Assert.Null(headers.GetParsedValues(KnownHeaders.Age.Descriptor)); Assert.Equal(1, headers.GetValues("Age").Count()); Assert.Equal("1.1", headers.GetValues("Age").First()); } diff --git a/external/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj b/external/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj index 90394d8abf..2cea1bc17a 100644 --- a/external/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj +++ b/external/corefx/src/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj @@ -5,14 +5,11 @@ {5F9C3C9F-652E-461E-B2D6-85D264F5A733} ../../src/Resources/Strings.resx true - $(NoWarn);0436 - $(DefineConstants);NET46 + $(NoWarn);0436 $(DefineConstants);uap - - @@ -87,12 +84,6 @@ ProductionCode\Common\System\Threading\Tasks\TaskToApm.cs - - ProductionCode\Internal\UriHelper.cs - - - ProductionCode\Shims\Uri.cs - ProductionCode\System\Net\Http\ByteArrayContent.cs @@ -105,6 +96,9 @@ ProductionCode\System\IO\DelegatingStream.cs + + ProductionCode\System\Net\Http\ByteArrayHelpers.cs + ProductionCode\System\Net\Http\FormUrlEncodedContent.cs @@ -138,6 +132,9 @@ ProductionCode\System\Net\Http\Headers\GenericHeaderParser.cs + + ProductionCode\System\Net\Http\Headers\HeaderDescriptor.cs + ProductionCode\System\Net\Http\Headers\HeaderUtilities.cs @@ -153,6 +150,9 @@ ProductionCode\System\Net\Http\Headers\HttpHeaders.cs + + ProductionCode\System\Net\Http\Headers\HttpHeaderType.cs + ProductionCode\System\Net\Http\Headers\HttpHeaderValueCollection.cs @@ -168,6 +168,12 @@ ProductionCode\System\Net\Http\Headers\Int64NumberHeaderParser.cs + + ProductionCode\System\Net\Http\Headers\KnownHeaders.cs + + + ProductionCode\System\Net\Http\Headers\KnownHeader.cs + ProductionCode\System\Net\Http\Headers\MediaTypeHeaderParser.cs diff --git a/external/corefx/src/System.Net.HttpListener/System.Net.HttpListener.sln b/external/corefx/src/System.Net.HttpListener/System.Net.HttpListener.sln index aac038f034..204f40ae01 100644 --- a/external/corefx/src/System.Net.HttpListener/System.Net.HttpListener.sln +++ b/external/corefx/src/System.Net.HttpListener/System.Net.HttpListener.sln @@ -26,10 +26,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {851A40FE-7F07-415D-8592-5FE2096E84D3}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {851A40FE-7F07-415D-8592-5FE2096E84D3}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {851A40FE-7F07-415D-8592-5FE2096E84D3}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {851A40FE-7F07-415D-8592-5FE2096E84D3}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {851A40FE-7F07-415D-8592-5FE2096E84D3}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU + {851A40FE-7F07-415D-8592-5FE2096E84D3}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU + {851A40FE-7F07-415D-8592-5FE2096E84D3}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU + {851A40FE-7F07-415D-8592-5FE2096E84D3}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU {31E8D18B-9E7D-4924-AFD8-5BD8D75C31FB}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU {31E8D18B-9E7D-4924-AFD8-5BD8D75C31FB}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {31E8D18B-9E7D-4924-AFD8-5BD8D75C31FB}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU diff --git a/external/corefx/src/System.Net.HttpListener/src/System/Net/Managed/HttpListenerResponse.Managed.cs b/external/corefx/src/System.Net.HttpListener/src/System/Net/Managed/HttpListenerResponse.Managed.cs index 9a8914146b..4825b54efa 100644 --- a/external/corefx/src/System.Net.HttpListener/src/System/Net/Managed/HttpListenerResponse.Managed.cs +++ b/external/corefx/src/System.Net.HttpListener/src/System/Net/Managed/HttpListenerResponse.Managed.cs @@ -284,7 +284,7 @@ namespace System.Net writer.Write(FormatHeaders(_webHeaders)); writer.Flush(); - int preamble = encoding.GetPreamble().Length; + int preamble = encoding.Preamble.Length; EnsureResponseStream(); /* Assumes that the ms was at position 0 */ diff --git a/external/corefx/src/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketBase.cs.REMOVED.git-id b/external/corefx/src/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketBase.cs.REMOVED.git-id index 2eb4746b9e..e3365b1bce 100644 --- a/external/corefx/src/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketBase.cs.REMOVED.git-id +++ b/external/corefx/src/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketBase.cs.REMOVED.git-id @@ -1 +1 @@ -315df4438d42d454b452f33fda69a9992e67f286 \ No newline at end of file +31673dc61d14d1cb989ff0a53efbebf6e4efee8a \ No newline at end of file diff --git a/external/corefx/src/System.Net.HttpListener/tests/Configurations.props b/external/corefx/src/System.Net.HttpListener/tests/Configurations.props index 8c2fedd2ad..7817fb09cb 100644 --- a/external/corefx/src/System.Net.HttpListener/tests/Configurations.props +++ b/external/corefx/src/System.Net.HttpListener/tests/Configurations.props @@ -2,9 +2,9 @@ - netcoreapp-OSX; - netcoreapp-Unix; - netcoreapp-Windows_NT; + netstandard-Windows_NT; + netstandard-OSX; + netstandard-Unix; diff --git a/external/corefx/src/System.Net.HttpListener/tests/GetContextHelper.cs b/external/corefx/src/System.Net.HttpListener/tests/GetContextHelper.cs index da8540b11b..2db9942d24 100644 --- a/external/corefx/src/System.Net.HttpListener/tests/GetContextHelper.cs +++ b/external/corefx/src/System.Net.HttpListener/tests/GetContextHelper.cs @@ -30,18 +30,6 @@ namespace System.Net.Tests return context.Response; } - public async Task GetRequest(bool chunked) - { - // We need to create a mock request to give the HttpListener a context. - Task serverContext = _listener.GetContextAsync(); - - _client.DefaultRequestHeaders.TransferEncodingChunked = chunked; - Task clientTask = _client.PostAsync(_listeningUrl, new StringContent("Hello")); - - HttpListenerContext context = await serverContext; - return context.Request; - } - public void Dispose() { _client.Dispose(); diff --git a/external/corefx/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs b/external/corefx/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs index e8d781a0c6..80d19c33b9 100644 --- a/external/corefx/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs +++ b/external/corefx/src/System.Net.HttpListener/tests/HttpRequestStreamTests.cs @@ -76,7 +76,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(true, "")] [InlineData(false, "")] @@ -203,6 +202,7 @@ namespace System.Net.Tests Assert.Equal(expected, buffer); context.Response.Close(); + await clientTask; } } @@ -242,10 +242,10 @@ namespace System.Net.Tests Assert.Equal(expected, buffer); context.Response.Close(); + await clientTask; } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(true)] [InlineData(false)] @@ -268,10 +268,10 @@ namespace System.Net.Tests Assert.Equal(expected.Concat(new byte[5]), buffer); context.Response.Close(); + await clientTask; } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(true)] [InlineData(false)] @@ -294,6 +294,7 @@ namespace System.Net.Tests Assert.Equal(expected.Concat(new byte[5]), buffer); context.Response.Close(); + await clientTask; } } @@ -318,10 +319,10 @@ namespace System.Net.Tests Assert.Equal(buffer.Length, bytesRead); context.Response.Close(); + await clientTask; } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(true)] [InlineData(false)] @@ -347,54 +348,86 @@ namespace System.Net.Tests Assert.Equal(new byte[bufferSize], buffer); context.Response.Close(); + await clientTask; } } [Fact] public async Task CanSeek_Get_ReturnsFalse() { - HttpListenerRequest response = await _helper.GetRequest(chunked: true); - using (Stream inputStream = response.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - Assert.False(inputStream.CanSeek); + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); - Assert.Throws(() => inputStream.Length); - Assert.Throws(() => inputStream.SetLength(1)); + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; - Assert.Throws(() => inputStream.Position); - Assert.Throws(() => inputStream.Position = 1); + using (Stream inputStream = request.InputStream) + { + Assert.False(inputStream.CanSeek); + + Assert.Throws(() => inputStream.Length); + Assert.Throws(() => inputStream.SetLength(1)); + + Assert.Throws(() => inputStream.Position); + Assert.Throws(() => inputStream.Position = 1); + + Assert.Throws(() => inputStream.Seek(0, SeekOrigin.Begin)); + } - Assert.Throws(() => inputStream.Seek(0, SeekOrigin.Begin)); + context.Response.Close(); + await clientTask; } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Fact] public async Task CanRead_Get_ReturnsTrue() { - HttpListenerRequest request = await _helper.GetRequest(chunked: true); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - Assert.True(inputStream.CanRead); + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; + + using (Stream inputStream = request.InputStream) + { + Assert.True(inputStream.CanRead); + } + + context.Response.Close(); + await clientTask; } } - [ActiveIssue(22066, TargetFrameworkMonikers.UapAot)] [Fact] public async Task CanWrite_Get_ReturnsFalse() { - HttpListenerRequest request = await _helper.GetRequest(chunked: true); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - Assert.False(inputStream.CanWrite); + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); - Assert.Throws(() => inputStream.Write(new byte[0], 0, 0)); - await Assert.ThrowsAsync(() => inputStream.WriteAsync(new byte[0], 0, 0)); - Assert.Throws(() => inputStream.EndWrite(null)); + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; - // Flushing the output stream is a no-op. - inputStream.Flush(); - Assert.Equal(Task.CompletedTask, inputStream.FlushAsync(CancellationToken.None)); + using (Stream inputStream = request.InputStream) + { + Assert.False(inputStream.CanWrite); + + Assert.Throws(() => inputStream.Write(new byte[0], 0, 0)); + await Assert.ThrowsAsync(() => inputStream.WriteAsync(new byte[0], 0, 0)); + Assert.Throws(() => inputStream.EndWrite(null)); + + // Flushing the output stream is a no-op. + inputStream.Flush(); + Assert.Equal(Task.CompletedTask, inputStream.FlushAsync(CancellationToken.None)); + } + + context.Response.Close(); + await clientTask; } } @@ -403,15 +436,26 @@ namespace System.Net.Tests [InlineData(false)] public async Task Read_NullBuffer_ThrowsArgumentNullException(bool chunked) { - HttpListenerRequest request = await _helper.GetRequest(chunked); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - AssertExtensions.Throws("buffer", () => inputStream.Read(null, 0, 0)); - await AssertExtensions.ThrowsAsync("buffer", () => inputStream.ReadAsync(null, 0, 0)); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; + + using (Stream inputStream = request.InputStream) + { + AssertExtensions.Throws("buffer", () => inputStream.Read(null, 0, 0)); + await AssertExtensions.ThrowsAsync("buffer", () => inputStream.ReadAsync(null, 0, 0)); + } + + context.Response.Close(); + await clientTask; } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(-1, true)] [InlineData(3, true)] @@ -419,15 +463,26 @@ namespace System.Net.Tests [InlineData(3, false)] public async Task Read_InvalidOffset_ThrowsArgumentOutOfRangeException(int offset, bool chunked) { - HttpListenerRequest request = await _helper.GetRequest(chunked); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - AssertExtensions.Throws("offset", () => inputStream.Read(new byte[2], offset, 0)); - await AssertExtensions.ThrowsAsync("offset", () => inputStream.ReadAsync(new byte[2], offset, 0)); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; + + using (Stream inputStream = request.InputStream) + { + AssertExtensions.Throws("offset", () => inputStream.Read(new byte[2], offset, 0)); + await AssertExtensions.ThrowsAsync("offset", () => inputStream.ReadAsync(new byte[2], offset, 0)); + } + + context.Response.Close(); + await clientTask; } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(0, 3, true)] [InlineData(1, 2, true)] @@ -437,11 +492,23 @@ namespace System.Net.Tests [InlineData(2, 1, false)] public async Task Read_InvalidOffsetSize_ThrowsArgumentOutOfRangeException(int offset, int size, bool chunked) { - HttpListenerRequest request = await _helper.GetRequest(chunked); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - AssertExtensions.Throws("size", () => inputStream.Read(new byte[2], offset, size)); - await AssertExtensions.ThrowsAsync("size", () => inputStream.ReadAsync(new byte[2], offset, size)); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; + + using (Stream inputStream = request.InputStream) + { + AssertExtensions.Throws("size", () => inputStream.Read(new byte[2], offset, size)); + await AssertExtensions.ThrowsAsync("size", () => inputStream.ReadAsync(new byte[2], offset, size)); + } + + context.Response.Close(); + await clientTask; } } @@ -450,10 +517,22 @@ namespace System.Net.Tests [InlineData(false)] public async Task EndRead_NullAsyncResult_ThrowsArgumentNullException(bool chunked) { - HttpListenerRequest request = await _helper.GetRequest(chunked); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - AssertExtensions.Throws("asyncResult", () => inputStream.EndRead(null)); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; + + using (Stream inputStream = request.InputStream) + { + AssertExtensions.Throws("asyncResult", () => inputStream.EndRead(null)); + } + + context.Response.Close(); + await clientTask; } } @@ -462,16 +541,34 @@ namespace System.Net.Tests [InlineData(false)] public async Task EndRead_InvalidAsyncResult_ThrowsArgumentException(bool chunked) { - HttpListenerRequest request1 = await _helper.GetRequest(chunked); - HttpListenerRequest request2 = await _helper.GetRequest(chunked); - - using (Stream inputStream1 = request1.InputStream) - using (Stream inputStream2 = request2.InputStream) + using (HttpClient client = new HttpClient()) { - IAsyncResult beginReadResult = inputStream1.BeginRead(new byte[0], 0, 0, null, null); - - AssertExtensions.Throws("asyncResult", () => inputStream2.EndRead(new CustomAsyncResult())); - AssertExtensions.Throws("asyncResult", () => inputStream2.EndRead(beginReadResult)); + Task contextTask1 = _listener.GetContextAsync(); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask1 = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + HttpListenerContext context1 = await contextTask1; + HttpListenerRequest request1 = context1.Request; + + Task contextTask2 = _listener.GetContextAsync(); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask2 = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); + HttpListenerContext context2 = await contextTask2; + HttpListenerRequest request2 = context2.Request; + + using (Stream inputStream1 = request1.InputStream) + using (Stream inputStream2 = request2.InputStream) + { + IAsyncResult beginReadResult = inputStream1.BeginRead(new byte[0], 0, 0, null, null); + + AssertExtensions.Throws("asyncResult", () => inputStream2.EndRead(new CustomAsyncResult())); + AssertExtensions.Throws("asyncResult", () => inputStream2.EndRead(beginReadResult)); + } + + context1.Response.Close(); + await clientTask1; + + context2.Response.Close(); + await clientTask2; } } @@ -480,13 +577,25 @@ namespace System.Net.Tests [InlineData(false)] public async Task EndRead_CalledTwice_ThrowsInvalidOperationException(bool chunked) { - HttpListenerRequest request = await _helper.GetRequest(chunked); - using (Stream inputStream = request.InputStream) + Task contextTask = _listener.GetContextAsync(); + using (HttpClient client = new HttpClient()) { - IAsyncResult beginReadResult = inputStream.BeginRead(new byte[0], 0, 0, null, null); - inputStream.EndRead(beginReadResult); + client.DefaultRequestHeaders.TransferEncodingChunked = chunked; + Task clientTask = client.PostAsync(_factory.ListeningUrl, new StringContent("Hello")); - Assert.Throws(() => inputStream.EndRead(beginReadResult)); + HttpListenerContext context = await contextTask; + HttpListenerRequest request = context.Request; + + using (Stream inputStream = request.InputStream) + { + IAsyncResult beginReadResult = inputStream.BeginRead(new byte[0], 0, 0, null, null); + inputStream.EndRead(beginReadResult); + + Assert.Throws(() => inputStream.EndRead(beginReadResult)); + } + + context.Response.Close(); + await clientTask; } } diff --git a/external/corefx/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs b/external/corefx/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs index 7ef9b23f01..869e325201 100644 --- a/external/corefx/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs +++ b/external/corefx/src/System.Net.HttpListener/tests/HttpResponseStreamTests.cs @@ -137,7 +137,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Fact] public async Task SimpleRequest_WriteSynchronouslyInParts_Succeeds() { @@ -167,7 +166,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Fact] public async Task SimpleRequest_WriteAynchronouslyEmpty_Succeeds() { @@ -232,7 +230,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22066, TargetFrameworkMonikers.UapAot)] [Fact] public async Task CanRead_Get_ReturnsFalse() { @@ -285,7 +282,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(0, 3)] [InlineData(1, 2)] @@ -539,7 +535,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Theory] [InlineData(true)] [InlineData(false)] @@ -553,7 +548,6 @@ namespace System.Net.Tests } } - [ActiveIssue(22110, TargetFrameworkMonikers.UapAot)] [Fact] public async Task EndWrite_InvalidAsyncResult_ThrowsArgumentException() { diff --git a/external/corefx/src/System.Net.HttpListener/tests/System.Net.HttpListener.Tests.csproj b/external/corefx/src/System.Net.HttpListener/tests/System.Net.HttpListener.Tests.csproj index 73d8edd249..9f7b02a8db 100644 --- a/external/corefx/src/System.Net.HttpListener/tests/System.Net.HttpListener.Tests.csproj +++ b/external/corefx/src/System.Net.HttpListener/tests/System.Net.HttpListener.Tests.csproj @@ -6,8 +6,12 @@ true ../src/Resources/Strings.resx - - + + + + + + @@ -27,12 +31,6 @@ - - Common\tests\System\PlatformDetection.cs - - - Common\tests\System\Net\PlatformDetection.Networking.cs - diff --git a/external/corefx/src/System.Net.Mail/src/System/Net/BufferBuilder.cs b/external/corefx/src/System.Net.Mail/src/System/Net/BufferBuilder.cs index 184236c00c..dc401624a4 100644 --- a/external/corefx/src/System.Net.Mail/src/System/Net/BufferBuilder.cs +++ b/external/corefx/src/System.Net.Mail/src/System/Net/BufferBuilder.cs @@ -66,8 +66,10 @@ namespace System.Net.Mail { if (allowUnicode) { - byte[] bytes = Encoding.UTF8.GetBytes(value.ToCharArray(), offset, count); - Append(bytes); + int byteCount = Encoding.UTF8.GetByteCount(value, offset, count); + EnsureBuffer(byteCount); + Encoding.UTF8.GetBytes(value, offset, count, _buffer, _offset); + _offset += byteCount; } else { diff --git a/external/corefx/src/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs b/external/corefx/src/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs index 8056bda85d..08ec5d89e1 100644 --- a/external/corefx/src/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs +++ b/external/corefx/src/System.Net.Mail/src/System/Net/Mail/SmtpConnection.cs @@ -152,7 +152,7 @@ namespace System.Net.Mail _channelBindingToken.Close(); } - _networkStream.Close(); + _networkStream?.Close(); _tcpClient.Dispose(); } @@ -439,11 +439,11 @@ namespace System.Net.Mail IAsyncResult result = _connection.BeginInitializeConnection(_host, _port, InitializeConnectionCallback, this); if (result.CompletedSynchronously) { - _connection.EndInitializeConnection(result); - if (NetEventSource.IsEnabled) NetEventSource.Info(this, "Connect returned"); - try { + _connection.EndInitializeConnection(result); + if (NetEventSource.IsEnabled) NetEventSource.Info(this, "Connect returned"); + Handshake(); } catch (Exception e) @@ -458,11 +458,11 @@ namespace System.Net.Mail if (!result.CompletedSynchronously) { ConnectAndHandshakeAsyncResult thisPtr = (ConnectAndHandshakeAsyncResult)result.AsyncState; - thisPtr._connection.EndInitializeConnection(result); - if (NetEventSource.IsEnabled) NetEventSource.Info(null, $"Connect returned {thisPtr}"); - try { + thisPtr._connection.EndInitializeConnection(result); + if (NetEventSource.IsEnabled) NetEventSource.Info(null, $"Connect returned {thisPtr}"); + thisPtr.Handshake(); } catch (Exception e) diff --git a/external/corefx/src/System.Net.Mail/tests/Functional/SmtpClientTest.cs b/external/corefx/src/System.Net.Mail/tests/Functional/SmtpClientTest.cs index 8b0ca8cbe9..618ebf85c7 100644 --- a/external/corefx/src/System.Net.Mail/tests/Functional/SmtpClientTest.cs +++ b/external/corefx/src/System.Net.Mail/tests/Functional/SmtpClientTest.cs @@ -271,6 +271,24 @@ namespace System.Net.Mail.Tests Assert.Equal(value, Smtp.Timeout); } + [Fact] + public void Send_ServerDoesntExist_Throws() + { + using (var smtp = new SmtpClient(Guid.NewGuid().ToString("N"))) + { + Assert.Throws(() => smtp.Send("anyone@anyone.com", "anyone@anyone.com", "subject", "body")); + } + } + + [Fact] + public async Task SendAsync_ServerDoesntExist_Throws() + { + using (var smtp = new SmtpClient(Guid.NewGuid().ToString("N"))) + { + await Assert.ThrowsAsync(() => smtp.SendMailAsync("anyone@anyone.com", "anyone@anyone.com", "subject", "body")); + } + } + [Fact] public void TestMailDelivery() { diff --git a/external/corefx/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj b/external/corefx/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj index d6fbd4a78c..6b4b016d26 100644 --- a/external/corefx/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj +++ b/external/corefx/src/System.Net.NameResolution/src/System.Net.NameResolution.csproj @@ -40,6 +40,9 @@ Common\System\Net\Sockets\SocketType.cs + + Common\System\Net\IPAddressParserStatics.cs + Common\System\Net\IPEndPointStatics.cs diff --git a/external/corefx/src/System.Net.NameResolution/src/System/Net/IPHostEntry.cs b/external/corefx/src/System.Net.NameResolution/src/System/Net/IPHostEntry.cs index 2ce6496a30..a202426858 100644 --- a/external/corefx/src/System.Net.NameResolution/src/System/Net/IPHostEntry.cs +++ b/external/corefx/src/System.Net.NameResolution/src/System/Net/IPHostEntry.cs @@ -6,7 +6,7 @@ namespace System.Net { // Host information /// - /// Provides a container class for Internet host address information.. + /// Provides a container class for Internet host address information. /// public class IPHostEntry { diff --git a/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Unix.cs b/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Unix.cs index a943070b49..3e93367e76 100644 --- a/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Unix.cs +++ b/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Unix.cs @@ -141,6 +141,12 @@ namespace System.Net public static unsafe IPHostEntry GetHostByName(string hostName) { + if (hostName == "") + { + // To match documented behavior on Windows, if an empty string is passed in, use the local host's name. + hostName = Dns.GetHostName(); + } + Interop.Sys.HostEntry entry; int err = Interop.Sys.GetHostByName(hostName, &entry); if (err != 0) @@ -167,6 +173,12 @@ namespace System.Net public static unsafe SocketError TryGetAddrInfo(string name, out IPHostEntry hostinfo, out int nativeErrorCode) { + if (name == "") + { + // To match documented behavior on Windows, if an empty string is passed in, use the local host's name. + name = Dns.GetHostName(); + } + Interop.Sys.HostEntry entry; int result = Interop.Sys.GetHostEntryForName(name, &entry); if (result != 0) diff --git a/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs b/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs index f6568082cc..36a69f8637 100644 --- a/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs +++ b/external/corefx/src/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs @@ -172,7 +172,9 @@ namespace System.Net public static IPHostEntry GetHostByAddr(IPAddress address) { // TODO #2891: Optimize this (or decide if this legacy code can be removed): - int addressAsInt = unchecked((int)address.GetAddress()); +#pragma warning disable CS0618 // Address is marked obsolete + int addressAsInt = unchecked((int)address.Address); +#pragma warning restore CS0618 #if BIGENDIAN // TODO #2891: above code needs testing for BIGENDIAN. diff --git a/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostByNameTest.cs b/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostByNameTest.cs index cbd4eacf3e..0ccdc17e82 100644 --- a/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostByNameTest.cs +++ b/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostByNameTest.cs @@ -101,5 +101,23 @@ namespace System.Net.NameResolution.Tests Assert.Equal(1, entry.AddressList.Length); Assert.Equal(IPAddress.IPv6Loopback, entry.AddressList[0]); } + + [Fact] + public void DnsObsoleteGetHostByName_EmptyString_ReturnsHostName() + { + IPHostEntry entry = Dns.GetHostByName(""); + + // DNS labels should be compared as case insensitive for ASCII characters. See RFC 4343. + Assert.Contains(Dns.GetHostName(), entry.HostName, StringComparison.OrdinalIgnoreCase); + } + + [Fact] + public void DnsObsoleteBeginEndGetHostByName_EmptyString_ReturnsHostName() + { + IPHostEntry entry = Dns.EndGetHostByName(Dns.BeginGetHostByName("", null, null)); + + // DNS labels should be compared as case insensitive for ASCII characters. See RFC 4343. + Assert.Contains(Dns.GetHostName(), entry.HostName, StringComparison.OrdinalIgnoreCase); + } } } diff --git a/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs b/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs index 55de4e7fe1..e5b5174e43 100644 --- a/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs +++ b/external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/GetHostEntryTest.cs @@ -20,10 +20,20 @@ namespace System.Net.NameResolution.Tests TestGetHostEntryAsync(() => Dns.GetHostEntryAsync(localIPAddress)); } - [Fact] - public void Dns_GetHostEntryAsync_HostString_Ok() + [Theory] + [InlineData("")] + [InlineData(TestSettings.LocalHost)] + public void Dns_GetHostEntry_HostString_Ok(string hostName) { - TestGetHostEntryAsync(() => Dns.GetHostEntryAsync(TestSettings.LocalHost)); + TestGetHostEntryAsync(() => Task.FromResult(Dns.GetHostEntry(hostName))); + } + + [Theory] + [InlineData("")] + [InlineData(TestSettings.LocalHost)] + public void Dns_GetHostEntryAsync_HostString_Ok(string hostName) + { + TestGetHostEntryAsync(() => Dns.GetHostEntryAsync(hostName)); } [Fact] @@ -81,34 +91,6 @@ namespace System.Net.NameResolution.Tests await Assert.ThrowsAsync(() => Dns.GetHostEntryAsync(addressString)); } - public static IEnumerable GetNoneAddresses() - { - yield return new object[] { IPAddress.None }; - } - - [PlatformSpecific(~TestPlatforms.OSX)] // macOS will resolve IPAddress.None to broadcasthost and produce a valid listing - [Theory] - [MemberData(nameof(GetNoneAddresses))] - public async Task Dns_GetHostEntryAsync_NoneIPAddress_Fail(IPAddress address) - { - string addressString = address.ToString(); - - await Assert.ThrowsAnyAsync(() => Dns.GetHostEntryAsync(address)); - await Assert.ThrowsAnyAsync(() => Dns.GetHostEntryAsync(addressString)); - } - - [PlatformSpecific(TestPlatforms.OSX)] // macOS will resolve IPAddress.None to broadcasthost and produce a valid listing - [Theory] - [MemberData(nameof(GetNoneAddresses))] - public async Task Dns_GetHostEntryAsync_NoneIPAddress_Success(IPAddress address) - { - IPHostEntry result = await Dns.GetHostEntryAsync(address); - Assert.NotNull(result); - Assert.NotNull(result.AddressList); - Assert.Equal(1, result.AddressList.Length); - Assert.Equal(address, result.AddressList[0]); - } - [Fact] public void DnsBeginGetHostEntry_BadName_Throws() { diff --git a/external/corefx/src/System.Net.NameResolution/tests/PalTests/Fakes/DnsFake.cs b/external/corefx/src/System.Net.NameResolution/tests/PalTests/Fakes/DnsFake.cs new file mode 100644 index 0000000000..e8ca1f7df9 --- /dev/null +++ b/external/corefx/src/System.Net.NameResolution/tests/PalTests/Fakes/DnsFake.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Net +{ + internal static class Dns + { + public static string GetHostName() => string.Empty; + } +} diff --git a/external/corefx/src/System.Net.NameResolution/tests/PalTests/Fakes/IPAddressFakeExtensions.cs b/external/corefx/src/System.Net.NameResolution/tests/PalTests/Fakes/IPAddressFakeExtensions.cs new file mode 100644 index 0000000000..e6777d45c4 --- /dev/null +++ b/external/corefx/src/System.Net.NameResolution/tests/PalTests/Fakes/IPAddressFakeExtensions.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.Net +{ + internal static class IPAddressFakeExtensions + { + public static bool TryWriteBytes(this IPAddress address, Span destination, out int bytesWritten) + { + byte[] bytes = address.GetAddressBytes(); + if (bytes.Length >= destination.Length) + { + new ReadOnlySpan(bytes).CopyTo(destination); + bytesWritten = bytes.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } + } + } +} diff --git a/external/corefx/src/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj b/external/corefx/src/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj index eab97617a1..333aa11cc1 100644 --- a/external/corefx/src/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj +++ b/external/corefx/src/System.Net.NameResolution/tests/PalTests/System.Net.NameResolution.Pal.Tests.csproj @@ -26,6 +26,8 @@ + + Common\System\Net\Logging\NetEventSource.cs @@ -41,6 +43,9 @@ Common\System\Net\IPEndPointStatics.cs + + Common\System\Net\IPAddressParserStatics.cs + Common\System\Net\Configuration.cs @@ -65,10 +70,6 @@ Common\System\Net\DebugSafeHandle.cs - - - Common\System\Net\Internals\IPAddressExtensions.cs - Interop\Windows\Interop.Libraries.cs @@ -170,4 +171,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/FileUtil.cs b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/FileUtil.cs index faad68cd10..d51628e3a1 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/FileUtil.cs +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/FileUtil.cs @@ -14,7 +14,7 @@ namespace System.Net.NetworkInformation.Tests /// public static void NormalizeLineEndings(string source, string normalizedDest) { - string contents = File.ReadAllText(TestFile(source)); + string contents = File.ReadAllText(source); if (Environment.NewLine == "\r\n") { if (!contents.Contains(Environment.NewLine)) @@ -32,14 +32,5 @@ namespace System.Net.NetworkInformation.Tests File.WriteAllText(normalizedDest, contents); } - - /// - /// Gets a path to the desired test file - /// - /// The correct path to a valid test file - public static string TestFile(string source) - { - return Path.Combine("NetworkFiles", source); - } } } diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Linux.cs b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Linux.cs index 95ef43db87..b2aec957e2 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Linux.cs +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Linux.cs @@ -20,7 +20,7 @@ namespace System.Net.NetworkInformation.Tests _log = TestLogging.GetInstance(); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void IPInfoTest_AccessAllProperties_NoErrors() { foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) @@ -102,7 +102,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void IPInfoTest_AccessAllIPv4Properties_NoErrors() { foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) @@ -125,7 +125,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void IPInfoTest_AccessAllIPv6Properties_NoErrors() { foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) @@ -150,7 +150,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv6", "true")] public void IPv6ScopeId_AccessAllValues_Success() { diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/MiscParsingTests.cs b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/MiscParsingTests.cs index 669af3f26d..54152936aa 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/MiscParsingTests.cs +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/MiscParsingTests.cs @@ -30,27 +30,27 @@ namespace System.Net.NetworkInformation.Tests [Fact] public static void RawIntFileParsing() { - int val = StringParsingHelpers.ParseRawIntFile(FileUtil.TestFile("rawint")); + int val = StringParsingHelpers.ParseRawIntFile("rawint"); Assert.Equal(12, val); - int max = StringParsingHelpers.ParseRawIntFile(FileUtil.TestFile("rawint_maxvalue")); + int max = StringParsingHelpers.ParseRawIntFile("rawint_maxvalue"); Assert.Equal(int.MaxValue, max); } [Fact] public static void RawLongFileParsing() { - long val = StringParsingHelpers.ParseRawLongFile(FileUtil.TestFile("rawlong")); + long val = StringParsingHelpers.ParseRawLongFile("rawlong"); Assert.Equal(3147483647L, val); - long max = StringParsingHelpers.ParseRawLongFile(FileUtil.TestFile("rawlong_maxvalue")); + long max = StringParsingHelpers.ParseRawLongFile("rawlong_maxvalue"); Assert.Equal(long.MaxValue, max); } [Fact] public static void RawHexIntParsing() { - int val = StringParsingHelpers.ParseRawHexFileAsInt(FileUtil.TestFile("rawhexint")); + int val = StringParsingHelpers.ParseRawHexFileAsInt("rawhexint"); Assert.Equal(10, val); } } diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkFiles/smb.conf b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkFiles/smb.conf index f1a5f495e7..89feb9c059 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkFiles/smb.conf +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkFiles/smb.conf @@ -165,7 +165,7 @@ wins server = 255.1.255.1 ############ Misc ############ -# Using the following line enables you to customise your configuration +# Using the following line enables you to customize your configuration # on a per machine basis. The %m gets replaced with the netbios name # of the machine that is connecting ; include = /home/samba/etc/smb.conf.%m diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs index fd996102cf..4c43121085 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs @@ -20,7 +20,7 @@ namespace System.Net.NetworkInformation.Tests _log = TestLogging.GetInstance(); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void BasicTest_GetNetworkInterfaces_AtLeastOne() { Assert.NotEqual(0, NetworkInterface.GetAllNetworkInterfaces().Length); @@ -51,7 +51,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [PlatformSpecific(TestPlatforms.Linux)] // Some APIs are not supported on Linux public void BasicTest_AccessInstanceProperties_NoExceptions_Linux() { @@ -109,7 +109,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv4", "true")] public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface() { @@ -131,7 +131,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv4", "true")] public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported() { @@ -140,7 +140,7 @@ namespace System.Net.NetworkInformation.Tests _log.WriteLine("Loopback IPv4 index: " + NetworkInterface.LoopbackInterfaceIndex); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv6", "true")] public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface() { @@ -164,7 +164,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [Trait("IPv6", "true")] public void BasicTest_StaticIPv6LoopbackIndex_ExceptionIfV6NotSupported() { @@ -196,7 +196,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [PlatformSpecific(TestPlatforms.Linux)] // Some APIs are not supported on Linux public void BasicTest_GetIPInterfaceStatistics_Success_Linux() { @@ -244,13 +244,13 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void BasicTest_GetIsNetworkAvailable_Success() { Assert.True(NetworkInterface.GetIsNetworkAvailable()); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [PlatformSpecific(~TestPlatforms.OSX)] [InlineData(false)] [InlineData(true)] diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs index e985046a01..2aa59259ef 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs @@ -45,7 +45,7 @@ namespace System.Net.NetworkInformation.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 [PlatformSpecific(TestPlatforms.Linux)] // Some APIs are not supported on Linux public void BasicTest_GetIPv4InterfaceStatistics_Success_Linux() { diff --git a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj index cf54d1dec8..f4c94c454d 100644 --- a/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj +++ b/external/corefx/src/System.Net.NetworkInformation/tests/FunctionalTests/System.Net.NetworkInformation.Functional.Tests.csproj @@ -68,9 +68,6 @@ Common\System\IO\RowConfigReader.cs - - Common\tests\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs b/external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs index c731beab21..59e7ca0f53 100644 --- a/external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs +++ b/external/corefx/src/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs @@ -90,7 +90,9 @@ namespace System.Net.NetworkInformation pingEventSafeWaitHandle, IntPtr.Zero, IntPtr.Zero, - (uint)address.GetAddress(), +#pragma warning disable CS0618 // Address is marked obsolete + (uint)address.Address, +#pragma warning restore CS0618 _requestBuffer, (ushort)buffer.Length, ref ipOptions, diff --git a/external/corefx/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/external/corefx/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs index 947e7a346e..c4a31ebe24 100644 --- a/external/corefx/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs +++ b/external/corefx/src/System.Net.Ping/tests/FunctionalTests/PingTest.cs @@ -2,7 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Net.Sockets; using System.Net.Test.Common; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -32,6 +34,19 @@ namespace System.Net.NetworkInformation.Tests } } + private static void PingResultValidator(PingReply pingReply, IPAddress localIpAddress) + { + if (pingReply.Status == IPStatus.TimedOut) + { + // Workaround OSX ping6 bug, refer issue #15018 + Assert.Equal(AddressFamily.InterNetworkV6, localIpAddress.AddressFamily); + Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.OSX)); + return; + } + + Assert.Equal(IPStatus.Success, pingReply.Status); + Assert.True(pingReply.Address.Equals(localIpAddress)); + } [Fact] public async Task SendPingAsync_InvalidArgs() @@ -90,8 +105,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); }); } @@ -105,8 +119,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress.ToString()), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); }); } @@ -120,8 +133,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress, TestSettings.PingTimeout), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); }); } @@ -137,9 +149,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress, TestSettings.PingTimeout, buffer), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); - + PingResultValidator(pingReply, localIpAddress); Assert.Equal(buffer, pingReply.Buffer); }); } @@ -155,8 +165,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress, TestSettings.PingTimeout, buffer), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); // Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply. if (Capability.CanUseRawSockets(localIpAddress.AddressFamily)) @@ -183,8 +192,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress, TestSettings.PingTimeout, buffer, options), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); Assert.Equal(buffer, pingReply.Buffer); Assert.InRange(pingReply.RoundtripTime, 0, long.MaxValue); }); @@ -201,8 +209,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(localIpAddress, TestSettings.PingTimeout, buffer, new PingOptions()), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); // Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply. if (Capability.CanUseRawSockets(localIpAddress.AddressFamily)) @@ -226,8 +233,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(TestSettings.LocalHost), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); }); } @@ -241,8 +247,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(TestSettings.LocalHost, TestSettings.PingTimeout), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); }); } @@ -258,9 +263,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(TestSettings.LocalHost, TestSettings.PingTimeout, buffer), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); - + PingResultValidator(pingReply, localIpAddress); Assert.Equal(buffer, pingReply.Buffer); }); } @@ -276,8 +279,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(TestSettings.LocalHost, TestSettings.PingTimeout, buffer), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); // Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply. if (Capability.CanUseRawSockets(localIpAddress.AddressFamily)) @@ -303,8 +305,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(TestSettings.LocalHost, TestSettings.PingTimeout, buffer, new PingOptions()), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); Assert.Equal(buffer, pingReply.Buffer); }); @@ -321,8 +322,7 @@ namespace System.Net.NetworkInformation.Tests (ping) => ping.SendPingAsync(TestSettings.LocalHost, TestSettings.PingTimeout, buffer, new PingOptions()), (pingReply) => { - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); // Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply. if (Capability.CanUseRawSockets(localIpAddress.AddressFamily)) @@ -347,8 +347,7 @@ namespace System.Net.NetworkInformation.Tests for (int i = 0; i < 3; i++) { PingReply pingReply = await p.SendPingAsync(TestSettings.LocalHost); - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); } } } @@ -364,8 +363,7 @@ namespace System.Net.NetworkInformation.Tests for (int i = 0; i < 3; i++) { PingReply pingReply = p.Send(TestSettings.LocalHost); - Assert.Equal(IPStatus.Success, pingReply.Status); - Assert.True(pingReply.Address.Equals(localIpAddress)); + PingResultValidator(pingReply, localIpAddress); } } } @@ -399,8 +397,7 @@ namespace System.Net.NetworkInformation.Tests await tcs.Task; Assert.NotNull(ea); - Assert.Equal(IPStatus.Success, ea.Reply.Status); - Assert.True(ea.Reply.Address.Equals(localIpAddress)); + PingResultValidator(ea.Reply, localIpAddress); } // Several canceled iterations diff --git a/external/corefx/src/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj b/external/corefx/src/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj index 5cb412390a..52fa777c22 100644 --- a/external/corefx/src/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj +++ b/external/corefx/src/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj @@ -26,9 +26,6 @@ Common\System\Net\Capability.RawSocketPermissions.cs - - Common\tests\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs b/external/corefx/src/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs index 8346b9448c..62e9191af9 100644 --- a/external/corefx/src/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs +++ b/external/corefx/src/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Net.Sockets; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Xunit; @@ -22,7 +23,7 @@ namespace System.Net.NetworkInformation.Tests [InlineData(1)] [InlineData(50)] [InlineData(1000)] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests un-priviledged Ping support on Unix + [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests un-priviledged Ping support on Unix public static async Task PacketSizeIsRespected(int payloadSize) { IPAddress localAddress = await TestSettings.GetLocalIPAddress(); @@ -39,6 +40,13 @@ namespace System.Net.NetworkInformation.Tests string pingOutput = p.StandardOutput.ReadToEnd(); Assert.True(p.WaitForExit(TestSettings.PingTimeout), "Ping process did not exit in " + TestSettings.PingTimeout + " ms."); + if (p.ExitCode == 1 || p.ExitCode == 2) + { + // Workaround known OSX bug in ping6 utility. + Assert.Equal(utilityPath, UnixCommandLinePing.Ping6UtilityPath); + Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.OSX)); + return; + } try { diff --git a/external/corefx/src/System.Net.Primitives/System.Net.Primitives.sln b/external/corefx/src/System.Net.Primitives/System.Net.Primitives.sln index 380882b714..a067ee28cd 100644 --- a/external/corefx/src/System.Net.Primitives/System.Net.Primitives.sln +++ b/external/corefx/src/System.Net.Primitives/System.Net.Primitives.sln @@ -41,18 +41,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU - {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU - {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU - {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU + {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {E671BC9F-A64C-4504-8B00-7A3215B99AF9}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU {7860A11A-1841-4416-8A30-28EEEB42C6BB}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU {7860A11A-1841-4416-8A30-28EEEB42C6BB}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {7860A11A-1841-4416-8A30-28EEEB42C6BB}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU {7860A11A-1841-4416-8A30-28EEEB42C6BB}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU - {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU - {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU - {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU - {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU + {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {86256B36-4C78-4A71-A80A-CCA35C4AE758}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU {FCFF9C63-CE7A-476E-8241-7B7236FFDBFB}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU {FCFF9C63-CE7A-476E-8241-7B7236FFDBFB}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {FCFF9C63-CE7A-476E-8241-7B7236FFDBFB}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU diff --git a/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.cs b/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.cs index 16dfbef5ca..f5123e3d7e 100644 --- a/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.cs +++ b/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.cs @@ -191,7 +191,9 @@ namespace System.Net public static readonly System.Net.IPAddress Loopback; public static readonly System.Net.IPAddress None; public IPAddress(byte[] address) { } + public IPAddress(ReadOnlySpan address) { } public IPAddress(byte[] address, long scopeid) { } + public IPAddress(ReadOnlySpan address, long scopeid) { } public IPAddress(long newAddress) { } public System.Net.Sockets.AddressFamily AddressFamily { get { throw null; } } public bool IsIPv4MappedToIPv6 { get { throw null; } } @@ -202,6 +204,7 @@ namespace System.Net public long ScopeId { get { throw null; } set { } } public override bool Equals(object comparand) { throw null; } public byte[] GetAddressBytes() { throw null; } + public bool TryWriteBytes(Span destination, out int bytesWritten) { throw null; } public override int GetHashCode() { throw null; } public static short HostToNetworkOrder(short host) { throw null; } public static int HostToNetworkOrder(int host) { throw null; } @@ -213,8 +216,11 @@ namespace System.Net public static int NetworkToHostOrder(int network) { throw null; } public static long NetworkToHostOrder(long network) { throw null; } public static System.Net.IPAddress Parse(string ipString) { throw null; } + public static System.Net.IPAddress Parse(ReadOnlySpan ipString) { throw null; } public override string ToString() { throw null; } + public bool TryFormat(Span destination, out int charsWritten) { throw null; } public static bool TryParse(string ipString, out System.Net.IPAddress address) { throw null; } + public static bool TryParse(ReadOnlySpan ipString, out System.Net.IPAddress address) { throw null; } [Obsolete("This property has been deprecated. It is address family dependent. Please use IPAddress.Equals method to perform comparisons. http://go.microsoft.com/fwlink/?linkid=14202")] public long Address { get { throw null; } set { } } } diff --git a/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.csproj b/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.csproj index 189b9b29b7..d89bb66a6a 100644 --- a/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.csproj +++ b/external/corefx/src/System.Net.Primitives/ref/System.Net.Primitives.csproj @@ -13,9 +13,10 @@ + - \ No newline at end of file + diff --git a/external/corefx/src/System.Net.Primitives/src/System.Net.Primitives.csproj b/external/corefx/src/System.Net.Primitives/src/System.Net.Primitives.csproj index be78612c07..6e4bc560ae 100644 --- a/external/corefx/src/System.Net.Primitives/src/System.Net.Primitives.csproj +++ b/external/corefx/src/System.Net.Primitives/src/System.Net.Primitives.csproj @@ -89,6 +89,9 @@ Common\System\Net\NetworkInformation\HostInformation.cs + + Common\System\Marvin.cs + Common\System\IO\StringBuilderCache.cs @@ -194,13 +197,16 @@ + + + diff --git a/external/corefx/src/System.Net.Primitives/src/System/Net/CookieContainer.cs b/external/corefx/src/System.Net.Primitives/src/System/Net/CookieContainer.cs index a8269d1f54..32fa5f3951 100644 --- a/external/corefx/src/System.Net.Primitives/src/System/Net/CookieContainer.cs +++ b/external/corefx/src/System.Net.Primitives/src/System/Net/CookieContainer.cs @@ -225,7 +225,9 @@ namespace System.Net if (cookie.Domain.Length == 0) { - throw new ArgumentException(SR.net_emptystringcall, "cookie.Domain"); + throw new ArgumentException( + SR.Format(SR.net_emptystringcall, nameof(cookie) + "." + nameof(cookie.Domain)), + nameof(cookie) + "." + nameof(cookie.Domain)); } Uri uri; @@ -736,7 +738,7 @@ namespace System.Net return null; } - bool isSecure = (uri.Scheme == UriScheme.Https); + bool isSecure = (uri.Scheme == UriScheme.Https || uri.Scheme == UriScheme.Wss); int port = uri.Port; CookieCollection cookies = null; diff --git a/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddress.cs b/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddress.cs index 5a1d5e3812..16be2f6374 100644 --- a/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddress.cs +++ b/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddress.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Net.Sockets; +using System.Runtime.CompilerServices; namespace System.Net { @@ -41,11 +42,10 @@ namespace System.Net /// /// A lazily initialized cache of the result of calling . /// - [NonSerialized] private string _toString; /// - /// This field is only used for IPv6 addresses. A lazily initialized cache of the value. + /// A lazily initialized cache of the value. /// private int _hashCode; @@ -84,6 +84,8 @@ namespace System.Net set { Debug.Assert(IsIPv4); + _toString = null; + _hashCode = 0; _addressOrScopeId = value; } } @@ -98,6 +100,8 @@ namespace System.Net set { Debug.Assert(IsIPv6); + _toString = null; + _hashCode = 0; _addressOrScopeId = value; } } @@ -123,13 +127,13 @@ namespace System.Net /// Constructor for an IPv6 Address with a specified Scope. /// /// - public IPAddress(byte[] address, long scopeid) + public IPAddress(byte[] address, long scopeid) : + this(new ReadOnlySpan(address ?? ThrowAddressNullException()), scopeid) { - if (address == null) - { - throw new ArgumentNullException(nameof(address)); - } + } + public IPAddress(ReadOnlySpan address, long scopeid) + { if (address.Length != IPAddressParserStatics.IPv6AddressBytes) { throw new ArgumentException(SR.dns_bad_ip_address, nameof(address)); @@ -152,27 +156,6 @@ namespace System.Net PrivateScopeId = (uint)scopeid; } - internal unsafe IPAddress(byte* address, int addressLength, long scopeid) - { - Debug.Assert(address != null); - Debug.Assert(addressLength == IPAddressParserStatics.IPv6AddressBytes); - - // Consider: Since scope is only valid for link-local and site-local - // addresses we could implement some more robust checking here - if (scopeid < 0 || scopeid > 0x00000000FFFFFFFF) - { - throw new ArgumentOutOfRangeException(nameof(scopeid)); - } - - _numbers = new ushort[NumberOfLabels]; - for (int i = 0; i < NumberOfLabels; i++) - { - _numbers[i] = (ushort)(address[i * 2] * 256 + address[i * 2 + 1]); - } - - PrivateScopeId = (uint)scopeid; - } - internal unsafe IPAddress(ushort* numbers, int numbersLength, uint scopeid) { Debug.Assert(numbers != null); @@ -202,22 +185,18 @@ namespace System.Net /// Constructor for IPv4 and IPv6 Address. /// /// - public IPAddress(byte[] address) + public IPAddress(byte[] address) : + this(new ReadOnlySpan(address ?? ThrowAddressNullException())) { - if (address == null) - { - throw new ArgumentNullException(nameof(address)); - } - if (address.Length != IPAddressParserStatics.IPv4AddressBytes && address.Length != IPAddressParserStatics.IPv6AddressBytes) - { - throw new ArgumentException(SR.dns_bad_ip_address, nameof(address)); - } + } + public IPAddress(ReadOnlySpan address) + { if (address.Length == IPAddressParserStatics.IPv4AddressBytes) { PrivateAddress = (uint)((address[3] << 24 | address[2] << 16 | address[1] << 8 | address[0]) & 0x0FFFFFFFF); } - else + else if (address.Length == IPAddressParserStatics.IPv6AddressBytes) { _numbers = new ushort[NumberOfLabels]; @@ -226,27 +205,9 @@ namespace System.Net _numbers[i] = (ushort)(address[i * 2] * 256 + address[i * 2 + 1]); } } - } - - internal unsafe IPAddress(byte* address, int addressLength) - { - Debug.Assert(address != null); - Debug.Assert(addressLength > 0); - Debug.Assert( - addressLength == IPAddressParserStatics.IPv4AddressBytes || - addressLength == IPAddressParserStatics.IPv6AddressBytes); - - if (addressLength == IPAddressParserStatics.IPv4AddressBytes) - { - PrivateAddress = (uint)((address[3] << 24 | address[2] << 16 | address[1] << 8 | address[0]) & 0x0FFFFFFFF); - } else { - _numbers = new ushort[NumberOfLabels]; - for (int i = 0; i < NumberOfLabels; i++) - { - _numbers[i] = (ushort)(address[i * 2] * 256 + address[i * 2 + 1]); - } + throw new ArgumentException(SR.dns_bad_ip_address, nameof(address)); } } @@ -264,13 +225,85 @@ namespace System.Net /// public static bool TryParse(string ipString, out IPAddress address) { - address = IPAddressParser.Parse(ipString, true); + if (ipString == null) + { + address = null; + return false; + } + + address = IPAddressParser.Parse(ipString.AsReadOnlySpan(), tryParse: true); + return (address != null); + } + + public static bool TryParse(ReadOnlySpan ipSpan, out IPAddress address) + { + address = IPAddressParser.Parse(ipSpan, tryParse: true); return (address != null); } public static IPAddress Parse(string ipString) { - return IPAddressParser.Parse(ipString, false); + if (ipString == null) + { + throw new ArgumentNullException(nameof(ipString)); + } + + return IPAddressParser.Parse(ipString.AsReadOnlySpan(), tryParse: false); + } + + public static IPAddress Parse(ReadOnlySpan ipSpan) + { + return IPAddressParser.Parse(ipSpan, tryParse: false); + } + + public bool TryWriteBytes(Span destination, out int bytesWritten) + { + if (IsIPv6) + { + if (destination.Length < IPAddressParserStatics.IPv6AddressBytes) + { + bytesWritten = 0; + return false; + } + + WriteIPv6Bytes(destination); + bytesWritten = IPAddressParserStatics.IPv6AddressBytes; + } + else + { + if (destination.Length < IPAddressParserStatics.IPv4AddressBytes) + { + bytesWritten = 0; + return false; + } + + WriteIPv4Bytes(destination); + bytesWritten = IPAddressParserStatics.IPv4AddressBytes; + } + + return true; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void WriteIPv6Bytes(Span destination) + { + Debug.Assert(_numbers != null && _numbers.Length == NumberOfLabels); + int j = 0; + for (int i = 0; i < NumberOfLabels; i++) + { + destination[j++] = (byte)((_numbers[i] >> 8) & 0xFF); + destination[j++] = (byte)((_numbers[i]) & 0xFF); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void WriteIPv4Bytes(Span destination) + { + uint address = PrivateAddress; + destination[0] = (byte)(address); + destination[1] = (byte)(address >> 8); + destination[2] = (byte)(address >> 16); + destination[3] = (byte)(address >> 24); } /// @@ -280,33 +313,19 @@ namespace System.Net /// public byte[] GetAddressBytes() { - byte[] bytes; if (IsIPv6) { Debug.Assert(_numbers != null && _numbers.Length == NumberOfLabels); - - bytes = new byte[IPAddressParserStatics.IPv6AddressBytes]; - int j = 0; - for (int i = 0; i < NumberOfLabels; i++) - { - bytes[j++] = (byte)((_numbers[i] >> 8) & 0xFF); - bytes[j++] = (byte)((_numbers[i]) & 0xFF); - } + byte[] bytes = new byte[IPAddressParserStatics.IPv6AddressBytes]; + WriteIPv6Bytes(bytes); + return bytes; } else { - uint address = PrivateAddress; - bytes = new byte[IPAddressParserStatics.IPv4AddressBytes]; - - unchecked - { - bytes[0] = (byte)(address); - bytes[1] = (byte)(address >> 8); - bytes[2] = (byte)(address >> 16); - bytes[3] = (byte)(address >> 24); - } + byte[] bytes = new byte[IPAddressParserStatics.IPv4AddressBytes]; + WriteIPv4Bytes(bytes); + return bytes; } - return bytes; } public AddressFamily AddressFamily @@ -371,13 +390,23 @@ namespace System.Net return _toString; } + public bool TryFormat(Span destination, out int charsWritten) + { + return IsIPv4 ? + IPAddressParser.IPv4AddressToString(PrivateAddress, destination, out charsWritten) : + IPAddressParser.IPv6AddressToString(_numbers, PrivateScopeId, destination, out charsWritten); + } + public static long HostToNetworkOrder(long host) { #if BIGENDIAN return host; #else - return (((long)HostToNetworkOrder(unchecked((int)host)) & 0xFFFFFFFF) << 32) - | ((long)HostToNetworkOrder(unchecked((int)(host >> 32))) & 0xFFFFFFFF); + ulong value = (ulong)host; + value = (value << 32) | (value >> 32); + value = (value & 0x0000FFFF0000FFFF) << 16 | (value & 0xFFFF0000FFFF0000) >> 16; + value = (value & 0x00FF00FF00FF00FF) << 8 | (value & 0xFF00FF00FF00FF00) >> 8; + return (long)value; #endif } @@ -386,8 +415,10 @@ namespace System.Net #if BIGENDIAN return host; #else - return (((int)HostToNetworkOrder(unchecked((short)host)) & 0xFFFF) << 16) - | ((int)HostToNetworkOrder(unchecked((short)(host >> 16))) & 0xFFFF); + uint value = (uint)host; + value = (value << 16) | (value >> 16); + value = (value & 0x00FF00FF) << 8 | (value & 0xFF00FF00) >> 8; + return (int)value; #endif } @@ -419,7 +450,7 @@ namespace System.Net { if (address == null) { - throw new ArgumentNullException(nameof(address)); + ThrowAddressNullException(); } if (address.IsIPv6) @@ -532,7 +563,6 @@ namespace System.Net { if (PrivateAddress != value) { - _toString = null; PrivateAddress = unchecked((uint)value); } } @@ -586,23 +616,40 @@ namespace System.Net public override int GetHashCode() { - // For IPv6 addresses, we cannot simply return the integer - // representation as the hashcode. Instead, we calculate - // the hashcode from the string representation of the address. + if (_hashCode != 0) + { + return _hashCode; + } + + // For IPv6 addresses, we calculate the hashcode by using Marvin + // on a stack-allocated array containing the Address bytes and ScopeId. + int hashCode; if (IsIPv6) { - if (_hashCode == 0) - { - _hashCode = StringComparer.OrdinalIgnoreCase.GetHashCode(ToString()); - } + const int addressAndScopeIdLength = IPAddressParserStatics.IPv6AddressBytes + sizeof(uint); + Span addressAndScopeIdSpan = stackalloc byte[addressAndScopeIdLength]; - return _hashCode; + new ReadOnlySpan(_numbers).AsBytes().CopyTo(addressAndScopeIdSpan); + Span scopeIdSpan = addressAndScopeIdSpan.Slice(IPAddressParserStatics.IPv6AddressBytes); + bool scopeWritten = BitConverter.TryWriteBytes(scopeIdSpan, _addressOrScopeId); + Debug.Assert(scopeWritten); + + hashCode = Marvin.ComputeHash32( + ref addressAndScopeIdSpan[0], + addressAndScopeIdLength, + Marvin.DefaultSeed); } else { - // For IPv4 addresses, we can simply use the integer representation. - return unchecked((int)PrivateAddress); + // For IPv4 addresses, we use Marvin on the integer representation of the Address. + hashCode = Marvin.ComputeHash32( + ref Unsafe.As(ref _addressOrScopeId), + sizeof(uint), + Marvin.DefaultSeed); } + + _hashCode = hashCode; + return _hashCode; } // For security, we need to be able to take an IPAddress and make a copy that's immutable and not derived. @@ -647,5 +694,8 @@ namespace System.Net return new IPAddress(address); } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static byte[] ThrowAddressNullException() => throw new ArgumentNullException("address"); } } diff --git a/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddressParser.cs b/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddressParser.cs index 99fc88d37e..ba02a6278d 100644 --- a/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddressParser.cs +++ b/external/corefx/src/System.Net.Primitives/src/System/Net/IPAddressParser.cs @@ -11,35 +11,23 @@ namespace System.Net { internal class IPAddressParser { - internal static unsafe IPAddress Parse(string ipString, bool tryParse) - { - if (ipString == null) - { - if (tryParse) - { - return null; - } - throw new ArgumentNullException(nameof(ipString)); - } + private const int MaxIPv4StringLength = 15; // 4 numbers separated by 3 periods, with up to 3 digits per number - if (ipString.IndexOf(':') != -1) + internal static unsafe IPAddress Parse(ReadOnlySpan ipSpan, bool tryParse) + { + if (ipSpan.IndexOf(':') >= 0) { - // If the address string contains the colon character then it can only be an IPv6 address. - // This is valid because we don't support/parse a port specification at the end of an IPv4 address. - uint scope; + // The address is parsed as IPv6 if and only if it contains a colon. This is valid because + // we don't support/parse a port specification at the end of an IPv4 address. ushort* numbers = stackalloc ushort[IPAddressParserStatics.IPv6AddressShorts]; - if (Ipv6StringToAddress(ipString, numbers, IPAddressParserStatics.IPv6AddressShorts, out scope)) + if (Ipv6StringToAddress(ipSpan, numbers, IPAddressParserStatics.IPv6AddressShorts, out uint scope)) { return new IPAddress(numbers, IPAddressParserStatics.IPv6AddressShorts, scope); } } - else + else if (Ipv4StringToAddress(ipSpan, out long address)) { - long address; - if (Ipv4StringToAddress(ipString, out address)) - { - return new IPAddress(address); - } + return new IPAddress(address); } if (tryParse) @@ -52,19 +40,40 @@ namespace System.Net internal static unsafe string IPv4AddressToString(uint address) { - const int MaxLength = 15; - char* addressString = stackalloc char[MaxLength]; - int offset = MaxLength; + char* addressString = stackalloc char[MaxIPv4StringLength]; + int charsWritten = IPv4AddressToStringHelper(address, addressString); + return new string(addressString, 0, charsWritten); + } + + internal static unsafe bool IPv4AddressToString(uint address, Span formatted, out int charsWritten) + { + if (formatted.Length < MaxIPv4StringLength) + { + charsWritten = 0; + return false; + } + + fixed (char* formattedPtr = &formatted.DangerousGetPinnableReference()) + { + charsWritten = IPv4AddressToStringHelper(address, formattedPtr); + } + + return true; + } + + private static unsafe int IPv4AddressToStringHelper(uint address, char* addressString) + { + int offset = 0; - FormatIPv4AddressNumber((int)((address >> 24) & 0xFF), addressString, ref offset); - addressString[--offset] = '.'; - FormatIPv4AddressNumber((int)((address >> 16) & 0xFF), addressString, ref offset); - addressString[--offset] = '.'; - FormatIPv4AddressNumber((int)((address >> 8) & 0xFF), addressString, ref offset); - addressString[--offset] = '.'; FormatIPv4AddressNumber((int)(address & 0xFF), addressString, ref offset); + addressString[offset++] = '.'; + FormatIPv4AddressNumber((int)((address >> 8) & 0xFF), addressString, ref offset); + addressString[offset++] = '.'; + FormatIPv4AddressNumber((int)((address >> 16) & 0xFF), addressString, ref offset); + addressString[offset++] = '.'; + FormatIPv4AddressNumber((int)((address >> 24) & 0xFF), addressString, ref offset); - return new string(addressString, offset, MaxLength - offset); + return offset; } internal static string IPv6AddressToString(ushort[] address, uint scopeId) @@ -72,6 +81,35 @@ namespace System.Net Debug.Assert(address != null); Debug.Assert(address.Length == IPAddressParserStatics.IPv6AddressShorts); + StringBuilder buffer = IPv6AddressToStringHelper(address, scopeId); + + return StringBuilderCache.GetStringAndRelease(buffer); + } + + internal static bool IPv6AddressToString(ushort[] address, uint scopeId, Span destination, out int charsWritten) + { + Debug.Assert(address != null); + Debug.Assert(address.Length == IPAddressParserStatics.IPv6AddressShorts); + + StringBuilder buffer = IPv6AddressToStringHelper(address, scopeId); + + if (destination.Length < buffer.Length) + { + StringBuilderCache.Release(buffer); + charsWritten = 0; + return false; + } + + buffer.CopyTo(0, destination, buffer.Length); + charsWritten = buffer.Length; + + StringBuilderCache.Release(buffer); + + return true; + } + + internal static StringBuilder IPv6AddressToStringHelper(ushort[] address, uint scopeId) + { const int INET6_ADDRSTRLEN = 65; StringBuilder buffer = StringBuilderCache.Acquire(INET6_ADDRSTRLEN); @@ -99,33 +137,35 @@ namespace System.Net buffer.Append('%').Append(scopeId); } - return StringBuilderCache.GetStringAndRelease(buffer); + return buffer; } private static unsafe void FormatIPv4AddressNumber(int number, char* addressString, ref int offset) { + // Math.DivRem has no overload for byte, assert here for safety + Debug.Assert(number < 256); + + offset += number > 99 ? 3 : number > 9 ? 2 : 1; + int i = offset; do { - int rem; - number = Math.DivRem(number, 10, out rem); + number = Math.DivRem(number, 10, out int rem); addressString[--i] = (char)('0' + rem); } while (number != 0); - offset = i; } - public static unsafe bool Ipv4StringToAddress(string ipString, out long address) + public static unsafe bool Ipv4StringToAddress(ReadOnlySpan ipSpan, out long address) { - Debug.Assert(ipString != null); - + int end = ipSpan.Length; long tmpAddr; - int end = ipString.Length; - fixed (char* ipStringPtr = ipString) + + fixed (char* ipStringPtr = &ipSpan.DangerousGetPinnableReference()) { tmpAddr = IPv4AddressHelper.ParseNonCanonical(ipStringPtr, 0, ref end, notImplicitFile: true); } - if (tmpAddr != IPv4AddressHelper.Invalid && end == ipString.Length) + if (tmpAddr != IPv4AddressHelper.Invalid && end == ipSpan.Length) { // IPv4AddressHelper.ParseNonCanonical returns the bytes in the inverse order. // Reverse them and return success. @@ -144,49 +184,51 @@ namespace System.Net } } - public static unsafe bool Ipv6StringToAddress(string ipString, ushort* numbers, int numbersLength, out uint scope) + public static unsafe bool Ipv6StringToAddress(ReadOnlySpan ipSpan, ushort* numbers, int numbersLength, out uint scope) { - Debug.Assert(ipString != null); Debug.Assert(numbers != null); Debug.Assert(numbersLength >= IPAddressParserStatics.IPv6AddressShorts); - int end = ipString.Length; - fixed (char* name = ipString) - { - if (IPv6AddressHelper.IsValidStrict(name, 0, ref end) || (end != ipString.Length)) - { - string scopeId = null; - IPv6AddressHelper.Parse(ipString, numbers, 0, ref scopeId); + int end = ipSpan.Length; - long result = 0; - if (!string.IsNullOrEmpty(scopeId)) + bool isValid = false; + fixed (char* ipStringPtr = &ipSpan.DangerousGetPinnableReference()) + { + isValid = IPv6AddressHelper.IsValidStrict(ipStringPtr, 0, ref end); + } + if (isValid || (end != ipSpan.Length)) + { + string scopeId = null; + IPv6AddressHelper.Parse(ipSpan, numbers, 0, ref scopeId); + + long result = 0; + if (!string.IsNullOrEmpty(scopeId)) + { + if (scopeId.Length < 2) { - if (scopeId.Length < 2) + scope = 0; + return false; + } + + for (int i = 1; i < scopeId.Length; i++) + { + char c = scopeId[i]; + if (c < '0' || c > '9') { scope = 0; return false; } - - for (int i = 1; i < scopeId.Length; i++) + result = (result * 10) + (c - '0'); + if (result > uint.MaxValue) { - char c = scopeId[i]; - if (c < '0' || c > '9') - { - scope = 0; - return false; - } - result = (result * 10) + (c - '0'); - if (result > uint.MaxValue) - { - scope = 0; - return false; - } + scope = 0; + return false; } } - - scope = (uint)result; - return true; } + + scope = (uint)result; + return true; } scope = 0; diff --git a/external/corefx/src/System.Net.Primitives/src/System/Net/IPv4AddressHelper.cs b/external/corefx/src/System.Net.Primitives/src/System/Net/IPv4AddressHelper.cs index 26f958b98b..f7c2e7b124 100644 --- a/external/corefx/src/System.Net.Primitives/src/System/Net/IPv4AddressHelper.cs +++ b/external/corefx/src/System.Net.Primitives/src/System/Net/IPv4AddressHelper.cs @@ -15,7 +15,7 @@ namespace System private const int NumberOfLabels = 4; // Only called from the IPv6Helper, only parse the canonical format - internal static unsafe int ParseHostNumber(string str, int start, int end) + internal static unsafe int ParseHostNumber(ReadOnlySpan str, int start, int end) { byte* numbers = stackalloc byte[NumberOfLabels]; ParseCanonical(str, numbers, start, end); @@ -309,7 +309,7 @@ namespace System // of 8-bit numbers and the characters '.' // Address may terminate with ':' or with the end of the string // - private static unsafe bool ParseCanonical(string name, byte* numbers, int start, int end) + private static unsafe bool ParseCanonical(ReadOnlySpan name, byte* numbers, int start, int end) { for (int i = 0; i < NumberOfLabels; ++i) { diff --git a/external/corefx/src/System.Net.Primitives/src/System/Net/IPv6AddressHelper.cs b/external/corefx/src/System.Net.Primitives/src/System/Net/IPv6AddressHelper.cs index 12582da222..ae348c5267 100644 --- a/external/corefx/src/System.Net.Primitives/src/System/Net/IPv6AddressHelper.cs +++ b/external/corefx/src/System.Net.Primitives/src/System/Net/IPv6AddressHelper.cs @@ -242,9 +242,12 @@ namespace System if (sequenceLength != 0) { + if (sequenceLength > 4) + { + return false; + } + ++sequenceCount; - lastSequence = i - sequenceLength; - sequenceLength = 0; } // these sequence counts are -1 because it is implied in end-of-sequence @@ -252,7 +255,6 @@ namespace System const int ExpectedSequenceCount = 8; return !expectingNumber && - (sequenceLength <= 4) && (haveCompressor ? (sequenceCount < ExpectedSequenceCount) : (sequenceCount == ExpectedSequenceCount)) && !needsClosingBracket; } @@ -282,7 +284,7 @@ namespace System // Nothing // - internal static unsafe void Parse(string address, ushort* numbers, int start, ref string scopeId) + internal static unsafe void Parse(ReadOnlySpan address, ushort* numbers, int start, ref string scopeId) { int number = 0; int index = 0; @@ -311,7 +313,7 @@ namespace System for (++i; i < address.Length && address[i] != ']' && address[i] != '/'; ++i) { } - scopeId = address.Substring(start, i - start); + scopeId = new string(address.Slice(start, i - start)); // ignore prefix if any for (; i < address.Length && address[i] != ']'; ++i) { diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Configurations.props b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Configurations.props index cfc57211a4..b0d8c5c32a 100644 --- a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Configurations.props +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Configurations.props @@ -4,6 +4,8 @@ netstandard-Unix; netstandard-Windows_NT; + netcoreapp-Windows_NT; + netcoreapp-Unix; - \ No newline at end of file + diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsing.cs b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsing.cs index 8832207b87..a57aac898d 100644 --- a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsing.cs +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsing.cs @@ -2,267 +2,312 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; using System.Net.Sockets; using Xunit; namespace System.Net.Primitives.Functional.Tests { - public class IPAddressParsing + public sealed class IPAddressParsing_String : IPAddressParsing { + public override IPAddress Parse(string ipString) => IPAddress.Parse(ipString); + public override bool TryParse(string ipString, out IPAddress address) => IPAddress.TryParse(ipString, out address); + + [Fact] + public void Parse_Null_Throws() + { + Assert.Throws(() => Parse((string)null)); + + Assert.False(TryParse((string)null, out IPAddress ipAddress)); + Assert.Null(ipAddress); + } + } + + public abstract class IPAddressParsing + { + public abstract IPAddress Parse(string ipString); + public abstract bool TryParse(string ipString, out IPAddress address); + + public static readonly object[][] ValidIpv4Addresses = + { + // Decimal + new object[] { "192.168.0.1", "192.168.0.1" }, + new object[] { "0.0.0.0", "0.0.0.0" }, + new object[] { "0", "0.0.0.0" }, + new object[] { "12", "0.0.0.12" }, + new object[] { "12.1.7", "12.1.0.7" }, + new object[] { "12.1.7", "12.1.0.7" }, + new object[] { "255.255.255.255", "255.255.255.255" }, + new object[] { "20.65535", "20.0.255.255" }, + new object[] { "157.3873051", "157.59.25.27" }, + new object[] { "157.6427", "157.0.25.27" }, + new object[] { "65535", "0.0.255.255" }, + new object[] { "65536", "0.1.0.0" }, + new object[] { "1434328179", "85.126.28.115" }, + new object[] { "2637895963", "157.59.25.27" }, + new object[] { "3397943208", "202.136.127.168" }, + new object[] { "4294967294", "255.255.255.254" }, + new object[] { "4294967295", "255.255.255.255" }, + //Hex + new object[] { "0xFF.0xFF.0xFF.0xFF", "255.255.255.255" }, + new object[] { "0x0", "0.0.0.0" }, + new object[] { "0xFFFFFFFE", "255.255.255.254" }, + new object[] { "0xFFFFFFFF", "255.255.255.255" }, + new object[] { "0x9D3B191B", "157.59.25.27" }, + new object[] { "0X9D.0x3B.0X19.0x1B", "157.59.25.27" }, + new object[] { "0x89.0xab.0xcd.0xef", "137.171.205.239" }, + new object[] { "0xff.0x7f.0x20.0x01", "255.127.32.1" }, + // Octal + new object[] { "0313.027035210", "203.92.58.136" }, + new object[] { "0313.0134.035210", "203.92.58.136" }, + new object[] { "0377.0377.0377.0377", "255.255.255.255" }, + new object[] { "037777777776", "255.255.255.254" }, + new object[] { "037777777777", "255.255.255.255" }, + new object[] { "023516614433", "157.59.25.27" }, + new object[] { "00000023516614433", "157.59.25.27" }, + new object[] { "000235.000073.0000031.00000033", "157.59.25.27" }, + new object[] { "0235.073.031.033", "157.59.25.27" }, + new object[] { "157.59.25.033", "157.59.25.27" }, // Partial octal + // Mixed base + new object[] { "157.59.25.0x1B", "157.59.25.27" }, + new object[] { "157.59.0x001B", "157.59.0.27" }, + new object[] { "157.0x00001B", "157.0.0.27" }, + new object[] { "157.59.0x25.033", "157.59.37.27" }, + }; + [Theory] - // Decimal - [InlineData("192.168.0.1", "192.168.0.1")] - [InlineData("0.0.0.0", "0.0.0.0")] - [InlineData("0", "0.0.0.0")] - [InlineData("12", "0.0.0.12")] - [InlineData("12.1.7", "12.1.0.7")] - [InlineData("12.1.7", "12.1.0.7")] - [InlineData("255.255.255.255", "255.255.255.255")] - [InlineData("20.65535", "20.0.255.255")] - [InlineData("157.3873051", "157.59.25.27")] - [InlineData("157.6427", "157.0.25.27")] - [InlineData("65535", "0.0.255.255")] - [InlineData("65536", "0.1.0.0")] - [InlineData("1434328179", "85.126.28.115")] - [InlineData("2637895963", "157.59.25.27")] - [InlineData("3397943208", "202.136.127.168")] - [InlineData("4294967294", "255.255.255.254")] - [InlineData("4294967295", "255.255.255.255")] - //Hex - [InlineData("0xFF.0xFF.0xFF.0xFF", "255.255.255.255")] - [InlineData("0x0", "0.0.0.0")] - [InlineData("0xFFFFFFFE", "255.255.255.254")] - [InlineData("0xFFFFFFFF", "255.255.255.255")] - [InlineData("0x9D3B191B", "157.59.25.27")] - [InlineData("0X9D.0x3B.0X19.0x1B", "157.59.25.27")] - [InlineData("0x89.0xab.0xcd.0xef", "137.171.205.239")] - [InlineData("0xff.0x7f.0x20.0x01", "255.127.32.1")] - // Octal - [InlineData("0313.027035210", "203.92.58.136")] - [InlineData("0313.0134.035210", "203.92.58.136")] - [InlineData("0377.0377.0377.0377", "255.255.255.255")] - [InlineData("037777777776", "255.255.255.254")] - [InlineData("037777777777", "255.255.255.255")] - [InlineData("023516614433", "157.59.25.27")] - [InlineData("00000023516614433", "157.59.25.27")] - [InlineData("000235.000073.0000031.00000033", "157.59.25.27")] - [InlineData("0235.073.031.033", "157.59.25.27")] - [InlineData("157.59.25.033", "157.59.25.27")] // Partial octal - // Mixed base - [InlineData("157.59.25.0x1B", "157.59.25.27")] - [InlineData("157.59.0x001B", "157.59.0.27")] - [InlineData("157.0x00001B", "157.0.0.27")] - [InlineData("157.59.0x25.033", "157.59.37.27")] + [MemberData(nameof(ValidIpv4Addresses))] public void ParseIPv4_ValidAddress_Success(string address, string expected) { - IPAddress ip = IPAddress.Parse(address); + IPAddress ip = Parse(address); // Validate the ToString of the parsed address matches the expected value Assert.Equal(expected, ip.ToString()); Assert.Equal(AddressFamily.InterNetwork, ip.AddressFamily); // Validate the ToString representation can be parsed as well back into the same IP - IPAddress ip2 = IPAddress.Parse(ip.ToString()); + IPAddress ip2 = Parse(ip.ToString()); Assert.Equal(ip, ip2); } + public static readonly object[][] InvalidIpv4Addresses = + { + new object[] { " 127.0.0.1" }, // leading whitespace + new object[] { "127.0.0.1 " }, // trailing whitespace + new object[] { " 127.0.0.1 " }, // leading and trailing whitespace + new object[] { "192.168.0.0/16" }, // with subnet + new object[] { "157.3B191B" }, // Hex without 0x + new object[] { "1.1.1.0x" }, // Empty trailing hex segment + new object[] { "0000X9D.0x3B.0X19.0x1B" }, // Leading zeros on hex + new object[] { "0x.1.1.1" }, // Empty leading hex segment + new object[] { "260.156" }, // Left dotted segments can't be more than 255 + new object[] { "255.260.156" }, // Left dotted segments can't be more than 255 + new object[] { "255.1.1.256" }, // Right dotted segment can't be more than 255 + new object[] { "0xFF.0xFFFFFF.0xFF" }, // Middle segment too large + new object[] { "0xFFFFFF.0xFF.0xFFFFFF" }, // Leading segment too large + new object[] { "4294967296" }, // Decimal overflow by 1 + new object[] { "040000000000" }, // Octal overflow by 1 + new object[] { "01011101001110110001100100011011" }, // Binary? Read as octal, overflows + new object[] { "10011101001110110001100100011011" }, // Binary? Read as decimal, overflows + new object[] { "0x100000000" }, // Hex overflow by 1 + new object[] { "1.1\u67081.1.1" }, // Invalid char (unicode) + new object[] { "..." }, // Empty sections + new object[] { "1.1.1." }, // Empty trailing section + new object[] { "1..1.1" }, // Empty internal section + new object[] { ".1.1.1" }, // Empty leading section + new object[] { "..11.1" }, // Empty sections + new object[] { " text" }, // alpha text + new object[] { "1.. ." }, // whitespace section + new object[] { "12.1.8. " }, // trailing whitespace section + new object[] { "12.+1.1.4" }, // plus sign in section + new object[] { "12.1.-1.5" }, // minus sign in section + new object[] { "12.1.abc.5" }, // text in section + }; + + public static readonly object[][] InvalidIpv4AddressesStandalone = // but valid as part of IPv6 addresses + { + new object[] { "" }, // empty + new object[] { " " }, // whitespace + new object[] { " " }, // whitespace + new object[] { "0.0.0.089" }, // Octal (leading zero) but with 8 or 9 + }; + [Theory] - [InlineData("")] // empty - [InlineData(" ")] // whitespace - [InlineData(" ")] // whitespace - [InlineData(" 127.0.0.1")] // leading whitespace - [InlineData("127.0.0.1 ")] // trailing whitespace - [InlineData(" 127.0.0.1 ")] // leading and trailing whitespace - [InlineData("192.168.0.0/16")] // with subnet - [InlineData("157.3B191B")] // Hex without 0x - [InlineData("1.1.1.0x")] // Empty trailing hex segment - [InlineData("0000X9D.0x3B.0X19.0x1B")] // Leading zeros on hex - [InlineData("0x.1.1.1")] // Empty leading hex segment - [InlineData("0.0.0.089")] // Octal (leading zero) but with 8 or 9 - [InlineData("260.156")] // Left dotted segments can't be more than 255 - [InlineData("255.260.156")] // Left dotted segments can't be more than 255 - [InlineData("255.1.1.256")] // Right dotted segment can't be more than 255 - [InlineData("0xFF.0xFFFFFF.0xFF")] // Middle segment too large - [InlineData("0xFFFFFF.0xFF.0xFFFFFF")] // Leading segment too large - [InlineData("4294967296")] // Decimal overflow by 1 - [InlineData("040000000000")] // Octal overflow by 1 - [InlineData("01011101001110110001100100011011")] // Binary? Read as octal, overflows - [InlineData("10011101001110110001100100011011")] // Binary? Read as decimal, overflows - [InlineData("0x100000000")] // Hex overflow by 1 - [InlineData("1.1\u67081.1.1")] // Invalid char (unicode) - [InlineData("...")] // Empty sections - [InlineData("1.1.1.")] // Empty trailing section - [InlineData("1..1.1")] // Empty internal section - [InlineData(".1.1.1")] // Empty leading section - [InlineData("..11.1")] // Empty sections - [InlineData(" text")] // alpha text - [InlineData("1.. .")] // whitespace section - [InlineData("12.1.8. ")] // trailing whitespace section - [InlineData("12.+1.1.4")] // plus sign in section - [InlineData("12.1.-1.5")] // minus sign in section - [InlineData("12.1.abc.5")] // text in section + [MemberData(nameof(InvalidIpv4Addresses))] + [MemberData(nameof(InvalidIpv4AddressesStandalone))] public void ParseIPv4_InvalidAddress_Failure(string address) { ParseInvalidAddress(address, hasInnerSocketException: !PlatformDetection.IsFullFramework); } + + public static readonly object[][] Ipv4AddressesWithPort = + { + new object[] { "192.168.0.0:80" }, // with port + new object[] { "192.168.0.1:80" }, // with port + }; + [Theory] - [InlineData("192.168.0.0:80")] // with port - [InlineData("192.168.0.1:80")] // with port + [MemberData(nameof(Ipv4AddressesWithPort))] public void ParseIPv4_InvalidAddress_ThrowsFormatExceptionWithInnerException(string address) { ParseInvalidAddress(address, hasInnerSocketException: true); } + public static readonly object[][] ValidIpv6Addresses = + { + new object[] { "Fe08::1", "fe08::1" }, + new object[] { "0000:0000:0000:0000:0000:0000:0000:0000", "::" }, + new object[] { "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" }, + new object[] { "0:0:0:0:0:0:0:0", "::" }, + new object[] { "1:0:0:0:0:0:0:0", "1::" }, + new object[] { "0:1:0:0:0:0:0:0", "0:1::" }, + new object[] { "0:0:1:0:0:0:0:0", "0:0:1::" }, + new object[] { "0:0:0:1:0:0:0:0", "0:0:0:1::" }, + new object[] { "0:0:0:0:1:0:0:0", "::1:0:0:0" }, + new object[] { "0:0:0:0:0:1:0:0", "::1:0:0" }, + new object[] { "0:0:0:0:0:0:1:0", "::0.1.0.0" }, + new object[] { "0:0:0:0:0:0:2:0", "::0.2.0.0" }, + new object[] { "0:0:0:0:0:0:F:0", "::0.15.0.0" }, + new object[] { "0:0:0:0:0:0:10:0", "::0.16.0.0" }, + new object[] { "0:0:0:0:0:0:A0:0", "::0.160.0.0" }, + new object[] { "0:0:0:0:0:0:F0:0", "::0.240.0.0" }, + new object[] { "0:0:0:0:0:0:FF:0", "::0.255.0.0" }, + new object[] { "0:0:0:0:0:0:0:1", "::1" }, + new object[] { "0:0:0:0:0:0:0:2", "::2" }, + new object[] { "0:0:0:0:0:0:0:F", "::F" }, + new object[] { "0:0:0:0:0:0:0:10", "::10" }, + new object[] { "0:0:0:0:0:0:0:1A", "::1A" }, + new object[] { "0:0:0:0:0:0:0:A0", "::A0" }, + new object[] { "0:0:0:0:0:0:0:F0", "::F0" }, + new object[] { "0:0:0:0:0:0:0:FF", "::FF" }, + new object[] { "0:0:0:0:0:0:0:1001", "::1001" }, + new object[] { "0:0:0:0:0:0:0:1002", "::1002" }, + new object[] { "0:0:0:0:0:0:0:100F", "::100F" }, + new object[] { "0:0:0:0:0:0:0:1010", "::1010" }, + new object[] { "0:0:0:0:0:0:0:10A0", "::10A0" }, + new object[] { "0:0:0:0:0:0:0:10F0", "::10F0" }, + new object[] { "0:0:0:0:0:0:0:10FF", "::10FF" }, + new object[] { "0:0:0:0:0:0:1:1", "::0.1.0.1" }, + new object[] { "0:0:0:0:0:0:2:2", "::0.2.0.2" }, + new object[] { "0:0:0:0:0:0:F:F", "::0.15.0.15" }, + new object[] { "0:0:0:0:0:0:10:10", "::0.16.0.16" }, + new object[] { "0:0:0:0:0:0:A0:A0", "::0.160.0.160" }, + new object[] { "0:0:0:0:0:0:F0:F0", "::0.240.0.240" }, + new object[] { "0:0:0:0:0:0:FF:FF", "::0.255.0.255" }, + new object[] { "0:0:0:0:0:FFFF:0:1", "::FFFF:0:1" }, + new object[] { "0:0:0:0:0:FFFF:0:2", "::FFFF:0:2" }, + new object[] { "0:0:0:0:0:FFFF:0:F", "::FFFF:0:F" }, + new object[] { "0:0:0:0:0:FFFF:0:10", "::FFFF:0:10" }, + new object[] { "0:0:0:0:0:FFFF:0:A0", "::FFFF:0:A0" }, + new object[] { "0:0:0:0:0:FFFF:0:F0", "::FFFF:0:F0" }, + new object[] { "0:0:0:0:0:FFFF:0:FF", "::FFFF:0:FF" }, + new object[] { "0:0:0:0:0:FFFF:1:0", "::FFFF:0.1.0.0" }, + new object[] { "0:0:0:0:0:FFFF:2:0", "::FFFF:0.2.0.0" }, + new object[] { "0:0:0:0:0:FFFF:F:0", "::FFFF:0.15.0.0" }, + new object[] { "0:0:0:0:0:FFFF:10:0", "::FFFF:0.16.0.0" }, + new object[] { "0:0:0:0:0:FFFF:A0:0", "::FFFF:0.160.0.0" }, + new object[] { "0:0:0:0:0:FFFF:F0:0", "::FFFF:0.240.0.0" }, + new object[] { "0:0:0:0:0:FFFF:FF:0", "::FFFF:0.255.0.0" }, + new object[] { "0:0:0:0:0:FFFF:0:1001", "::FFFF:0:1001" }, + new object[] { "0:0:0:0:0:FFFF:0:1002", "::FFFF:0:1002" }, + new object[] { "0:0:0:0:0:FFFF:0:100F", "::FFFF:0:100F" }, + new object[] { "0:0:0:0:0:FFFF:0:1010", "::FFFF:0:1010" }, + new object[] { "0:0:0:0:0:FFFF:0:10A0", "::FFFF:0:10A0" }, + new object[] { "0:0:0:0:0:FFFF:0:10F0", "::FFFF:0:10F0" }, + new object[] { "0:0:0:0:0:FFFF:0:10FF", "::FFFF:0:10FF" }, + new object[] { "0:0:0:0:0:FFFF:1:1", "::FFFF:0.1.0.1" }, + new object[] { "0:0:0:0:0:FFFF:2:2", "::FFFF:0.2.0.2" }, + new object[] { "0:0:0:0:0:FFFF:F:F", "::FFFF:0.15.0.15" }, + new object[] { "0:0:0:0:0:FFFF:10:10", "::FFFF:0.16.0.16" }, + new object[] { "0:0:0:0:0:FFFF:A0:A0", "::FFFF:0.160.0.160" }, + new object[] { "0:0:0:0:0:FFFF:F0:F0", "::FFFF:0.240.0.240" }, + new object[] { "0:0:0:0:0:FFFF:FF:FF", "::FFFF:0.255.0.255" }, + new object[] { "0:7:7:7:7:7:7:7", "0:7:7:7:7:7:7:7" }, + new object[] { "1:0:0:0:0:0:0:1", "1::1" }, + new object[] { "1:1:0:0:0:0:0:0", "1:1::" }, + new object[] { "2:2:0:0:0:0:0:0", "2:2::" }, + new object[] { "1:1:0:0:0:0:0:1", "1:1::1" }, + new object[] { "1:0:1:0:0:0:0:1", "1:0:1::1" }, + new object[] { "1:0:0:1:0:0:0:1", "1:0:0:1::1" }, + new object[] { "1:0:0:0:1:0:0:1", "1::1:0:0:1" }, + new object[] { "1:0:0:0:0:1:0:1", "1::1:0:1" }, + new object[] { "1:0:0:0:0:0:1:1", "1::1:1" }, + new object[] { "1:1:0:0:1:0:0:1", "1:1::1:0:0:1" }, + new object[] { "1:0:1:0:0:1:0:1", "1:0:1::1:0:1" }, + new object[] { "1:0:0:1:0:0:1:1", "1::1:0:0:1:1" }, + new object[] { "1:1:0:0:0:1:0:1", "1:1::1:0:1" }, + new object[] { "1:0:0:0:1:0:1:1", "1::1:0:1:1" }, + new object[] { "1:1:1:1:1:1:1:0", "1:1:1:1:1:1:1:0" }, + new object[] { "7:7:7:7:7:7:7:0", "7:7:7:7:7:7:7:0" }, + new object[] { "E:0:0:0:0:0:0:1", "E::1" }, + new object[] { "E:0:0:0:0:0:2:2", "E::2:2" }, + new object[] { "E:0:6:6:6:6:6:6", "E:0:6:6:6:6:6:6" }, + new object[] { "E:E:0:0:0:0:0:1", "E:E::1" }, + new object[] { "E:E:0:0:0:0:2:2", "E:E::2:2" }, + new object[] { "E:E:0:5:5:5:5:5", "E:E:0:5:5:5:5:5" }, + new object[] { "E:E:E:0:0:0:0:1", "E:E:E::1" }, + new object[] { "E:E:E:0:0:0:2:2", "E:E:E::2:2" }, + new object[] { "E:E:E:0:4:4:4:4", "E:E:E:0:4:4:4:4" }, + new object[] { "E:E:E:E:0:0:0:1", "E:E:E:E::1" }, + new object[] { "E:E:E:E:0:0:2:2", "E:E:E:E::2:2" }, + new object[] { "E:E:E:E:0:3:3:3", "E:E:E:E:0:3:3:3" }, + new object[] { "E:E:E:E:E:0:0:1", "E:E:E:E:E::1" }, + new object[] { "E:E:E:E:E:0:2:2", "E:E:E:E:E:0:2:2" }, + new object[] { "E:E:E:E:E:E:0:1", "E:E:E:E:E:E:0:1" }, + new object[] { "::FFFF:192.168.0.1", "::FFFF:192.168.0.1" }, + new object[] { "::FFFF:0.168.0.1", "::FFFF:0.168.0.1" }, + new object[] { "::0.0.255.255", "::FFFF" }, + new object[] { "::EEEE:10.0.0.1", "::EEEE:A00:1" }, + new object[] { "::10.0.0.1", "::10.0.0.1" }, + new object[] { "1234:0:0:0:0:1234:0:0", "1234::1234:0:0" }, + new object[] { "1:0:1:0:1:0:1:0", "1:0:1:0:1:0:1:0" }, + new object[] { "1:1:1:0:0:1:1:0", "1:1:1::1:1:0" }, + new object[] { "0:0:0:0:0:1234:0:0", "::1234:0:0" }, + new object[] { "3ffe:38e1::0100:1:0001", "3ffe:38e1::100:1:1" }, + new object[] { "0:0:1:2:00:00:000:0000", "0:0:1:2::" }, + new object[] { "100:0:1:2:0:0:000:abcd", "100:0:1:2::abcd" }, + new object[] { "ffff:0:0:0:0:0:00:abcd", "ffff::abcd" }, + new object[] { "ffff:0:0:2:0:0:00:abcd", "ffff:0:0:2::abcd" }, + new object[] { "0:0:1:2:0:00:0000:0000", "0:0:1:2::" }, + new object[] { "0000:0000::1:0000:0000", "::1:0:0" }, + new object[] { "0:0:111:234:5:6:789A:0", "::111:234:5:6:789a:0" }, + new object[] { "11:22:33:44:55:66:77:8", "11:22:33:44:55:66:77:8" }, + new object[] { "::7711:ab42:1230:0:0:0", "0:0:7711:ab42:1230::" }, + new object[] { "::", "::" }, + new object[] { "[Fe08::1]", "fe08::1" }, // brackets dropped + new object[] { "[Fe08::1]:0x80", "fe08::1" }, // brackets and port dropped + new object[] { "[Fe08::1]:0xFA", "fe08::1" }, // brackets and port dropped + new object[] { "2001:0db8::0001", "2001:db8::1" }, // leading 0s suppressed + new object[] { "3731:54:65fe:2::a7", "3731:54:65fe:2::a7" }, // Unicast + new object[] { "3731:54:65fe:2::a8", "3731:54:65fe:2::a8" }, // Anycast + // ScopeID + new object[] { "Fe08::1%13542", "fe08::1%13542" }, + new object[] { "1::%1", "1::%1" }, + new object[] { "::1%12", "::1%12" }, + new object[] { "::%123", "::%123" }, + // v4 as v6 + new object[] { "FE08::192.168.0.1", "fe08::c0a8:1" }, // Output is not IPv4 mapped + new object[] { "::192.168.0.1", "::192.168.0.1" }, + new object[] { "::FFFF:192.168.0.1", "::ffff:192.168.0.1" }, // SIIT + new object[] { "::FFFF:0:192.168.0.1", "::ffff:0:192.168.0.1" }, // SIIT + new object[] { "::5EFE:192.168.0.1", "::5efe:192.168.0.1" }, // ISATAP + new object[] { "1::5EFE:192.168.0.1", "1::5efe:192.168.0.1" }, // ISATAP + new object[] { "::192.168.0.010", "::192.168.0.10" }, // Embedded IPv4 octal, read as decimal + }; + [Theory] - [InlineData("Fe08::1", "fe08::1")] - [InlineData("0000:0000:0000:0000:0000:0000:0000:0000", "::")] - [InlineData("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")] - [InlineData("0:0:0:0:0:0:0:0", "::")] - [InlineData("1:0:0:0:0:0:0:0", "1::")] - [InlineData("0:1:0:0:0:0:0:0", "0:1::")] - [InlineData("0:0:1:0:0:0:0:0", "0:0:1::")] - [InlineData("0:0:0:1:0:0:0:0", "0:0:0:1::")] - [InlineData("0:0:0:0:1:0:0:0", "::1:0:0:0")] - [InlineData("0:0:0:0:0:1:0:0", "::1:0:0")] - [InlineData("0:0:0:0:0:0:1:0", "::0.1.0.0")] - [InlineData("0:0:0:0:0:0:2:0", "::0.2.0.0")] - [InlineData("0:0:0:0:0:0:F:0", "::0.15.0.0")] - [InlineData("0:0:0:0:0:0:10:0", "::0.16.0.0")] - [InlineData("0:0:0:0:0:0:A0:0", "::0.160.0.0")] - [InlineData("0:0:0:0:0:0:F0:0", "::0.240.0.0")] - [InlineData("0:0:0:0:0:0:FF:0", "::0.255.0.0")] - [InlineData("0:0:0:0:0:0:0:1", "::1")] - [InlineData("0:0:0:0:0:0:0:2", "::2")] - [InlineData("0:0:0:0:0:0:0:F", "::F")] - [InlineData("0:0:0:0:0:0:0:10", "::10")] - [InlineData("0:0:0:0:0:0:0:1A", "::1A")] - [InlineData("0:0:0:0:0:0:0:A0", "::A0")] - [InlineData("0:0:0:0:0:0:0:F0", "::F0")] - [InlineData("0:0:0:0:0:0:0:FF", "::FF")] - [InlineData("0:0:0:0:0:0:0:1001", "::1001")] - [InlineData("0:0:0:0:0:0:0:1002", "::1002")] - [InlineData("0:0:0:0:0:0:0:100F", "::100F")] - [InlineData("0:0:0:0:0:0:0:1010", "::1010")] - [InlineData("0:0:0:0:0:0:0:10A0", "::10A0")] - [InlineData("0:0:0:0:0:0:0:10F0", "::10F0")] - [InlineData("0:0:0:0:0:0:0:10FF", "::10FF")] - [InlineData("0:0:0:0:0:0:1:1", "::0.1.0.1")] - [InlineData("0:0:0:0:0:0:2:2", "::0.2.0.2")] - [InlineData("0:0:0:0:0:0:F:F", "::0.15.0.15")] - [InlineData("0:0:0:0:0:0:10:10", "::0.16.0.16")] - [InlineData("0:0:0:0:0:0:A0:A0", "::0.160.0.160")] - [InlineData("0:0:0:0:0:0:F0:F0", "::0.240.0.240")] - [InlineData("0:0:0:0:0:0:FF:FF", "::0.255.0.255")] - [InlineData("0:0:0:0:0:FFFF:0:1", "::FFFF:0:1")] - [InlineData("0:0:0:0:0:FFFF:0:2", "::FFFF:0:2")] - [InlineData("0:0:0:0:0:FFFF:0:F", "::FFFF:0:F")] - [InlineData("0:0:0:0:0:FFFF:0:10", "::FFFF:0:10")] - [InlineData("0:0:0:0:0:FFFF:0:A0", "::FFFF:0:A0")] - [InlineData("0:0:0:0:0:FFFF:0:F0", "::FFFF:0:F0")] - [InlineData("0:0:0:0:0:FFFF:0:FF", "::FFFF:0:FF")] - [InlineData("0:0:0:0:0:FFFF:1:0", "::FFFF:0.1.0.0")] - [InlineData("0:0:0:0:0:FFFF:2:0", "::FFFF:0.2.0.0")] - [InlineData("0:0:0:0:0:FFFF:F:0", "::FFFF:0.15.0.0")] - [InlineData("0:0:0:0:0:FFFF:10:0", "::FFFF:0.16.0.0")] - [InlineData("0:0:0:0:0:FFFF:A0:0", "::FFFF:0.160.0.0")] - [InlineData("0:0:0:0:0:FFFF:F0:0", "::FFFF:0.240.0.0")] - [InlineData("0:0:0:0:0:FFFF:FF:0", "::FFFF:0.255.0.0")] - [InlineData("0:0:0:0:0:FFFF:0:1001", "::FFFF:0:1001")] - [InlineData("0:0:0:0:0:FFFF:0:1002", "::FFFF:0:1002")] - [InlineData("0:0:0:0:0:FFFF:0:100F", "::FFFF:0:100F")] - [InlineData("0:0:0:0:0:FFFF:0:1010", "::FFFF:0:1010")] - [InlineData("0:0:0:0:0:FFFF:0:10A0", "::FFFF:0:10A0")] - [InlineData("0:0:0:0:0:FFFF:0:10F0", "::FFFF:0:10F0")] - [InlineData("0:0:0:0:0:FFFF:0:10FF", "::FFFF:0:10FF")] - [InlineData("0:0:0:0:0:FFFF:1:1", "::FFFF:0.1.0.1")] - [InlineData("0:0:0:0:0:FFFF:2:2", "::FFFF:0.2.0.2")] - [InlineData("0:0:0:0:0:FFFF:F:F", "::FFFF:0.15.0.15")] - [InlineData("0:0:0:0:0:FFFF:10:10", "::FFFF:0.16.0.16")] - [InlineData("0:0:0:0:0:FFFF:A0:A0", "::FFFF:0.160.0.160")] - [InlineData("0:0:0:0:0:FFFF:F0:F0", "::FFFF:0.240.0.240")] - [InlineData("0:0:0:0:0:FFFF:FF:FF", "::FFFF:0.255.0.255")] - [InlineData("0:7:7:7:7:7:7:7", "0:7:7:7:7:7:7:7")] - [InlineData("1:0:0:0:0:0:0:1", "1::1")] - [InlineData("1:1:0:0:0:0:0:0", "1:1::")] - [InlineData("2:2:0:0:0:0:0:0", "2:2::")] - [InlineData("1:1:0:0:0:0:0:1", "1:1::1")] - [InlineData("1:0:1:0:0:0:0:1", "1:0:1::1")] - [InlineData("1:0:0:1:0:0:0:1", "1:0:0:1::1")] - [InlineData("1:0:0:0:1:0:0:1", "1::1:0:0:1")] - [InlineData("1:0:0:0:0:1:0:1", "1::1:0:1")] - [InlineData("1:0:0:0:0:0:1:1", "1::1:1")] - [InlineData("1:1:0:0:1:0:0:1", "1:1::1:0:0:1")] - [InlineData("1:0:1:0:0:1:0:1", "1:0:1::1:0:1")] - [InlineData("1:0:0:1:0:0:1:1", "1::1:0:0:1:1")] - [InlineData("1:1:0:0:0:1:0:1", "1:1::1:0:1")] - [InlineData("1:0:0:0:1:0:1:1", "1::1:0:1:1")] - [InlineData("1:1:1:1:1:1:1:0", "1:1:1:1:1:1:1:0")] - [InlineData("7:7:7:7:7:7:7:0", "7:7:7:7:7:7:7:0")] - [InlineData("E:0:0:0:0:0:0:1", "E::1")] - [InlineData("E:0:0:0:0:0:2:2", "E::2:2")] - [InlineData("E:0:6:6:6:6:6:6", "E:0:6:6:6:6:6:6")] - [InlineData("E:E:0:0:0:0:0:1", "E:E::1")] - [InlineData("E:E:0:0:0:0:2:2", "E:E::2:2")] - [InlineData("E:E:0:5:5:5:5:5", "E:E:0:5:5:5:5:5")] - [InlineData("E:E:E:0:0:0:0:1", "E:E:E::1")] - [InlineData("E:E:E:0:0:0:2:2", "E:E:E::2:2")] - [InlineData("E:E:E:0:4:4:4:4", "E:E:E:0:4:4:4:4")] - [InlineData("E:E:E:E:0:0:0:1", "E:E:E:E::1")] - [InlineData("E:E:E:E:0:0:2:2", "E:E:E:E::2:2")] - [InlineData("E:E:E:E:0:3:3:3", "E:E:E:E:0:3:3:3")] - [InlineData("E:E:E:E:E:0:0:1", "E:E:E:E:E::1")] - [InlineData("E:E:E:E:E:0:2:2", "E:E:E:E:E:0:2:2")] - [InlineData("E:E:E:E:E:E:0:1", "E:E:E:E:E:E:0:1")] - [InlineData("::FFFF:192.168.0.1", "::FFFF:192.168.0.1")] - [InlineData("::FFFF:0.168.0.1", "::FFFF:0.168.0.1")] - [InlineData("::0.0.255.255", "::FFFF")] - [InlineData("::EEEE:10.0.0.1", "::EEEE:A00:1")] - [InlineData("::10.0.0.1", "::10.0.0.1")] - [InlineData("1234:0:0:0:0:1234:0:0", "1234::1234:0:0")] - [InlineData("1:0:1:0:1:0:1:0", "1:0:1:0:1:0:1:0")] - [InlineData("1:1:1:0:0:1:1:0", "1:1:1::1:1:0")] - [InlineData("0:0:0:0:0:1234:0:0", "::1234:0:0")] - [InlineData("3ffe:38e1::0100:1:0001", "3ffe:38e1::100:1:1")] - [InlineData("0:0:1:2:00:00:000:0000", "0:0:1:2::")] - [InlineData("100:0:1:2:0:0:000:abcd", "100:0:1:2::abcd")] - [InlineData("ffff:0:0:0:0:0:00:abcd", "ffff::abcd")] - [InlineData("ffff:0:0:2:0:0:00:abcd", "ffff:0:0:2::abcd")] - [InlineData("0:0:1:2:0:00:0000:0000", "0:0:1:2::")] - [InlineData("0000:0000::1:0000:0000", "::1:0:0")] - [InlineData("0:0:111:234:5:6:789A:0", "::111:234:5:6:789a:0")] - [InlineData("11:22:33:44:55:66:77:8", "11:22:33:44:55:66:77:8")] - [InlineData("::7711:ab42:1230:0:0:0", "0:0:7711:ab42:1230::")] - [InlineData("::", "::")] - [InlineData("[Fe08::1]", "fe08::1")] // brackets dropped - [InlineData("[Fe08::1]:0x80", "fe08::1")] // brackets and port dropped - [InlineData("[Fe08::1]:0xFA", "fe08::1")] // brackets and port dropped - [InlineData("2001:0db8::0001", "2001:db8::1")] // leading 0s suppressed - [InlineData("3731:54:65fe:2::a7", "3731:54:65fe:2::a7")] // Unicast - [InlineData("3731:54:65fe:2::a8", "3731:54:65fe:2::a8")] // Anycast - // ScopeID - [InlineData("Fe08::1%13542", "fe08::1%13542")] - [InlineData("1::%1", "1::%1")] - [InlineData("::1%12", "::1%12")] - [InlineData("::%123", "::%123")] - // v4 as v6 - [InlineData("FE08::192.168.0.1", "fe08::c0a8:1")] // Output is not IPv4 mapped - [InlineData("::192.168.0.1", "::192.168.0.1")] - [InlineData("::FFFF:192.168.0.1", "::ffff:192.168.0.1")] // SIIT - [InlineData("::FFFF:0:192.168.0.1", "::ffff:0:192.168.0.1")] // SIIT - [InlineData("::5EFE:192.168.0.1", "::5efe:192.168.0.1")] // ISATAP - [InlineData("1::5EFE:192.168.0.1", "1::5efe:192.168.0.1")] // ISATAP - [InlineData("::192.168.0.010", "::192.168.0.10")] // Embedded IPv4 octal, read as decimal + [MemberData(nameof(ValidIpv6Addresses))] public void ParseIPv6_ValidAddress_RoundtripMatchesExpected(string address, string expected) { - IPAddress ip = IPAddress.Parse(address); + IPAddress ip = Parse(address); // Validate the ToString of the parsed address matches the expected value Assert.Equal(expected.ToLowerInvariant(), ip.ToString()); Assert.Equal(AddressFamily.InterNetworkV6, ip.AddressFamily); // Validate the ToString representation can be parsed as well back into the same IP - IPAddress ip2 = IPAddress.Parse(ip.ToString()); + IPAddress ip2 = Parse(ip.ToString()); Assert.Equal(ip, ip2); // Validate that anything that doesn't already start with brackets @@ -271,68 +316,122 @@ namespace System.Net.Primitives.Functional.Tests { Assert.Equal( expected.ToLowerInvariant(), - IPAddress.Parse("[" + address + "]").ToString()); + Parse("[" + address + "]").ToString()); } } [Theory] - [InlineData(":::4df")] - [InlineData("4df:::")] - [InlineData("0:::4df")] - [InlineData("4df:::0")] - [InlineData("::4df:::")] - [InlineData("0::4df:::")] - [InlineData(" ::1")] - [InlineData(":: 1")] - [InlineData(":")] - [InlineData("0:0:0:0:0:0:0:0:0")] - [InlineData("0:0:0:0:0:0:0")] - [InlineData("0FFFF::")] - [InlineData("FFFF0::")] - [InlineData("[::1")] - [InlineData("Fe08::/64")] // with subnet - [InlineData("[Fe08::1]:80Z")] // brackets and invalid port - [InlineData("[Fe08::1")] // leading bracket - [InlineData("[[Fe08::1")] // two leading brackets - [InlineData("Fe08::1]")] // trailing bracket - [InlineData("Fe08::1]]")] // two trailing brackets - [InlineData("[Fe08::1]]")] // one leading and two trailing brackets - [InlineData(":1")] // leading single colon - [InlineData("1:")] // trailing single colon - [InlineData(" ::1")] // leading whitespace - [InlineData("::1 ")] // trailing whitespace - [InlineData(" ::1 ")] // leading and trailing whitespace - [InlineData("1::1::1")] // ambiguous failure - [InlineData("1234::ABCD:1234::ABCD:1234:ABCD")] // can only use :: once - [InlineData("1:1\u67081:1:1")] // invalid char - [InlineData("FE08::260.168.0.1")] // out of range - [InlineData("::192.168.0.0x0")] // hex failure - [InlineData("G::")] // invalid hex - [InlineData("FFFFF::")] // invalid value - [InlineData(":%12")] // colon scope - [InlineData("::%1a")] // alphanumeric scope - [InlineData("[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]:443/")] // errneous ending slash after ignored port - [InlineData("::1234%0x12")] // invalid scope ID + [MemberData(nameof(ValidIpv6Addresses))] + public void TryParseIPv6_ValidAddress_RoundtripMatchesExpected(string address, string expected) + { + Assert.True(TryParse(address, out IPAddress ip)); + + // Validate the ToString of the parsed address matches the expected value + Assert.Equal(expected.ToLowerInvariant(), ip.ToString()); + Assert.Equal(AddressFamily.InterNetworkV6, ip.AddressFamily); + + // Validate the ToString representation can be parsed as well back into the same IP + Assert.True(TryParse(ip.ToString(), out IPAddress ip2)); + Assert.Equal(ip, ip2); + + // Validate that anything that doesn't already start with brackets + // can be surrounded with brackets and still parse successfully. + if (!address.StartsWith("[")) + { + Assert.Equal( + expected.ToLowerInvariant(), + Parse("[" + address + "]").ToString()); + } + } + + public static IEnumerable InvalidIpv6Addresses() + { + yield return new object[] { ":::4df" }; + yield return new object[] { "4df:::" }; + yield return new object[] { "0:::4df" }; + yield return new object[] { "4df:::0" }; + yield return new object[] { "::4df:::" }; + yield return new object[] { "0::4df:::" }; + yield return new object[] { " ::1" }; + yield return new object[] { ":: 1" }; + yield return new object[] { ":" }; + yield return new object[] { "0:0:0:0:0:0:0:0:0" }; + yield return new object[] { "0:0:0:0:0:0:0" }; + yield return new object[] { "0FFFF::" }; + yield return new object[] { "FFFF0::" }; + yield return new object[] { "[::1" }; // missing closing bracket + yield return new object[] { "Fe08::/64" }; // with subnet + yield return new object[] { "[Fe08::1]:80Z" }; // brackets and invalid port + yield return new object[] { "[Fe08::1" }; // leading bracket + yield return new object[] { "[[Fe08::1" }; // two leading brackets + yield return new object[] { "Fe08::1]" }; // trailing bracket + yield return new object[] { "Fe08::1]]" }; // two trailing brackets + yield return new object[] { "[Fe08::1]]" }; // one leading and two trailing brackets + yield return new object[] { ":1" }; // leading single colon + yield return new object[] { "1:" }; // trailing single colon + yield return new object[] { " ::1" }; // leading whitespace + yield return new object[] { "::1 " }; // trailing whitespace + yield return new object[] { " ::1 " }; // leading and trailing whitespace + yield return new object[] { "1::1::1" }; // ambiguous failure + yield return new object[] { "1234::ABCD:1234::ABCD:1234:ABCD" }; // can only use :: once + yield return new object[] { "1:1\u67081:1:1" }; // invalid char + yield return new object[] { "FE08::260.168.0.1" }; // out of range + yield return new object[] { "::192.168.0.0x0" }; // hex failure + yield return new object[] { "G::" }; // invalid hex + yield return new object[] { "FFFFF::" }; // invalid value + yield return new object[] { ":%12" }; // colon scope + yield return new object[] { "::%1a" }; // alphanumeric scope + yield return new object[] { "[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]:443/" }; // errneous ending slash after ignored port + yield return new object[] { "::1234%0x12" }; // invalid scope ID + + yield return new object[] { "e3fff:ffff:ffff:ffff:ffff:ffff:ffff:abcd" }; // 1st number too long + yield return new object[] { "3fff:effff:ffff:ffff:ffff:ffff:ffff:abcd" }; // 2nd number too long + yield return new object[] { "3fff:ffff:effff:ffff:ffff:ffff:ffff:abcd" }; // 3rd number too long + yield return new object[] { "3fff:ffff:ffff:effff:ffff:ffff:ffff:abcd" }; // 4th number too long + yield return new object[] { "3fff:ffff:ffff:ffff:effff:ffff:ffff:abcd" }; // 5th number too long + yield return new object[] { "3fff:ffff:ffff:ffff:ffff:effff:ffff:abcd" }; // 6th number too long + yield return new object[] { "3fff:ffff:ffff:ffff:ffff:ffff:effff:abcd" }; // 7th number too long + yield return new object[] { "3fff:ffff:ffff:ffff:ffff:ffff:ffff:eabcd" }; // 8th number too long + + // Various IPv6 addresses including invalid IPv4 addresses + foreach (object[] invalidIPv4AddressArray in InvalidIpv4Addresses) + { + string invalidIPv4Address = (string)invalidIPv4AddressArray[0]; + yield return new object[] { "3fff:ffff:ffff:ffff:ffff:ffff:ffff:" + invalidIPv4Address }; + yield return new object[] { "::" + invalidIPv4Address }; // SIIT + yield return new object[] { "::FF:" + invalidIPv4Address }; // SIIT + yield return new object[] { "::5EFE:" + invalidIPv4Address }; // ISATAP + yield return new object[] { "1::5EFE:" + invalidIPv4Address }; // ISATAP + } + } + + [Theory] + [MemberData(nameof(InvalidIpv6Addresses))] public void ParseIPv6_InvalidAddress_ThrowsFormatException(string invalidAddress) { ParseInvalidAddress(invalidAddress, hasInnerSocketException: true); } + public static readonly object[][] InvalidIpv6AddressesNoInner = + { + new object[] { "" }, // empty + new object[] { " " }, // whitespace + new object[] { " " }, // whitespace + new object[] { "%12" }, // just scope + new object[] { "[192.168.0.1]" }, // raw v4 + new object[] { "[1]" }, // incomplete + }; + [Theory] - [InlineData("")] // empty - [InlineData(" ")] // whitespace - [InlineData(" ")] // whitespace - [InlineData("%12")] // just scope - [InlineData("[192.168.0.1]")] // raw v4 - [InlineData("[1]")] // incomplete + [MemberData(nameof(InvalidIpv6AddressesNoInner))] public void ParseIPv6_InvalidAddress_ThrowsFormatExceptionWithNoInnerExceptionInNetfx(string invalidAddress) { ParseInvalidAddress(invalidAddress, hasInnerSocketException: !PlatformDetection.IsFullFramework); } - private static void ParseInvalidAddress(string invalidAddress, bool hasInnerSocketException) + private void ParseInvalidAddress(string invalidAddress, bool hasInnerSocketException) { - FormatException fe = Assert.Throws(() => IPAddress.Parse(invalidAddress)); + FormatException fe = Assert.Throws(() => Parse(invalidAddress)); if (hasInnerSocketException) { SocketException se = Assert.IsType(fe.InnerException); @@ -344,18 +443,8 @@ namespace System.Net.Primitives.Functional.Tests } IPAddress result = IPAddress.Loopback; - Assert.False(IPAddress.TryParse(invalidAddress, out result)); + Assert.False(TryParse(invalidAddress, out result)); Assert.Null(result); } - - [Fact] - public void Parse_Null_Throws() - { - Assert.Throws(() => { IPAddress.Parse(null); }); - - IPAddress ipAddress; - Assert.False(IPAddress.TryParse(null, out ipAddress)); - Assert.Null(ipAddress); - } } } diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsingSpan.cs b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsingSpan.cs new file mode 100644 index 0000000000..b8f38d10d4 --- /dev/null +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressParsingSpan.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Net.Sockets; +using Xunit; + +namespace System.Net.Primitives.Functional.Tests +{ + public sealed class IPAddressParsing_Span : IPAddressParsing + { + public override IPAddress Parse(string ipString) => IPAddress.Parse(ipString.AsReadOnlySpan()); + public override bool TryParse(string ipString, out IPAddress address) => IPAddress.TryParse(ipString.AsReadOnlySpan(), out address); + + + [Theory] + [MemberData(nameof(ValidIpv4Addresses))] + [MemberData(nameof(ValidIpv6Addresses))] + public void TryFormat_ProvidedBufferLargerThanNeeded_Success(string addressString, string expected) + { + IPAddress address = IPAddress.Parse(addressString); + + const int IPv4MaxLength = 15; // TryFormat currently requires at least this amount of space for IPv4 addresses + int requiredLength = address.AddressFamily == AddressFamily.InterNetwork ? + IPv4MaxLength : + address.ToString().Length; + + var largerThanRequired = new char[requiredLength + 1]; + Assert.True(address.TryFormat(new Span(largerThanRequired), out int charsWritten)); + Assert.Equal(expected.Length, charsWritten); + Assert.Equal( + address.AddressFamily == AddressFamily.InterNetworkV6 ? expected.ToLowerInvariant() : expected, + new string(largerThanRequired, 0, charsWritten)); + } + + [Theory] + [MemberData(nameof(ValidIpv4Addresses))] + [MemberData(nameof(ValidIpv6Addresses))] + public void TryFormat_ProvidedBufferTooSmall_Failure(string addressString, string expected) + { + IPAddress address = IPAddress.Parse(addressString); + var result = new char[address.ToString().Length - 1]; + Assert.False(address.TryFormat(new Span(result), out int charsWritten)); + Assert.Equal(0, charsWritten); + Assert.Equal(new char[result.Length], result); + } + } +} diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressSpanTest.cs b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressSpanTest.cs new file mode 100644 index 0000000000..890ef3b14a --- /dev/null +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressSpanTest.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Net.Sockets; + +using Xunit; + +namespace System.Net.Primitives.Functional.Tests +{ + public static class IPAddressSpanTest + { + public static readonly object[][] IpAddresses = + { + new object[] { new byte[] { 0x8f, 0x18, 0x14, 0x24 } }, + new object[] { new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 } }, + }; + + [Theory] + [MemberData(nameof(IpAddresses))] + public static void TryWriteBytes_RightSizeBuffer_Success(byte[] address) + { + var result = new byte[address.Length]; + IPAddress ip = new IPAddress(address); + + Assert.True(ip.TryWriteBytes(new Span(result), out int bytesWritten)); + Assert.Equal(address, result); + Assert.Equal(address.Length, bytesWritten); + } + + [Theory] + [MemberData(nameof(IpAddresses))] + public static void TryWriteBytes_LargerBuffer_Success(byte[] address) + { + var result = new byte[address.Length + 1]; + IPAddress ip = new IPAddress(address); + + Assert.True(ip.TryWriteBytes(new Span(result), out int bytesWritten)); + Assert.Equal(address, result.AsSpan().Slice(0, bytesWritten).ToArray()); + Assert.Equal(address.Length, bytesWritten); + } + + [Theory] + [MemberData(nameof(IpAddresses))] + public static void TryWriteBytes_TooSmallBuffer_Failure(byte[] address) + { + int bufferSize = address.Length - 1; + var result = new byte[bufferSize]; + IPAddress ip = new IPAddress(address); + + Assert.False(ip.TryWriteBytes(new Span(result), out int bytesWritten)); + Assert.Equal(0, bytesWritten); + Assert.Equal(new byte[bufferSize], result); + } + } +} diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressTest.cs b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressTest.cs index 4c0d94deb4..3ebdc94eb0 100644 --- a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressTest.cs +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/IPAddressTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Linq; using System.Net.Sockets; using Xunit; @@ -17,22 +18,32 @@ namespace System.Net.Primitives.Functional.Tests private const long MinScopeId = 0; private const long MaxScopeId = 0xFFFFFFFF; - private static byte[] ipV6AddressBytes1 = new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; - private static byte[] ipV6AddressBytes2 = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + private const string IpV4AddressString1 = "192.168.0.9"; + private const string IpV4AddressString2 = "169.192.1.10"; + private const string IpV6AddressString = "fe80::200:f8ff:fe21:67cf"; - private static IPAddress IPV4Address() + private static readonly byte[] IpV4AddressBytes = { 0x01, 0x02, 0x03, 0x04 }; + private static readonly byte[] IpV6AddressBytes1 = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + private static readonly byte[] IpV6AddressBytes2 = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 }; + + private static IPAddress IPV4Address1() { - return IPAddress.Parse("192.168.0.9"); + return IPAddress.Parse(IpV4AddressString1); + } + + private static IPAddress IPV4Address2() + { + return IPAddress.Parse(IpV4AddressString2); } private static IPAddress IPV6Address1() { - return new IPAddress(ipV6AddressBytes1); + return new IPAddress(IpV6AddressBytes1); } private static IPAddress IPV6Address2() { - return new IPAddress(ipV6AddressBytes2); + return new IPAddress(IpV6AddressBytes2); } [Theory] @@ -69,8 +80,8 @@ namespace System.Net.Primitives.Functional.Tests public static object[][] AddressBytesAndFamilies = { new object[] { new byte[] { 0x8f, 0x18, 0x14, 0x24 }, AddressFamily.InterNetwork }, - new object[] { ipV6AddressBytes1, AddressFamily.InterNetworkV6 }, - new object[] { ipV6AddressBytes2, AddressFamily.InterNetworkV6 } + new object[] { IpV6AddressBytes1, AddressFamily.InterNetworkV6 }, + new object[] { IpV6AddressBytes2, AddressFamily.InterNetworkV6 } }; [Fact] @@ -96,8 +107,8 @@ namespace System.Net.Primitives.Functional.Tests { foreach (long scopeId in new long[] { MinScopeId, MaxScopeId, 500 }) { - yield return new object[] { ipV6AddressBytes1, scopeId }; - yield return new object[] { ipV6AddressBytes2, scopeId }; + yield return new object[] { IpV6AddressBytes1, scopeId }; + yield return new object[] { IpV6AddressBytes2, scopeId }; } } } @@ -109,8 +120,8 @@ namespace System.Net.Primitives.Functional.Tests AssertExtensions.Throws("address", () => new IPAddress(new byte[] { 0x01, 0x01, 0x02 }, 500)); - AssertExtensions.Throws("scopeid", () => new IPAddress(ipV6AddressBytes1, MinScopeId - 1)); - AssertExtensions.Throws("scopeid", () => new IPAddress(ipV6AddressBytes1, MaxScopeId + 1)); + AssertExtensions.Throws("scopeid", () => new IPAddress(IpV6AddressBytes1, MinScopeId - 1)); + AssertExtensions.Throws("scopeid", () => new IPAddress(IpV6AddressBytes1, MaxScopeId + 1)); } [Fact] @@ -128,7 +139,7 @@ namespace System.Net.Primitives.Functional.Tests [Fact] public static void ScopeId_Set_Invalid() { - IPAddress ip = IPV4Address(); //IpV4 + IPAddress ip = IPV4Address1(); //IpV4 Assert.ThrowsAny(() => ip.ScopeId = 500); Assert.ThrowsAny(() => ip.ScopeId); @@ -142,26 +153,34 @@ namespace System.Net.Primitives.Functional.Tests { long l1 = (long)0x1350; long l2 = (long)0x5013000000000000; + long l3 = (long)0x0123456789ABCDEF; + long l4 = unchecked((long)0xEFCDAB8967452301); int i1 = (int)0x1350; int i2 = (int)0x50130000; - + int i3 = (int)0x01234567; + int i4 = (int)0x67452301; + short s1 = (short)0x1350; short s2 = (short)0x5013; - + Assert.Equal(l2, IPAddress.HostToNetworkOrder(l1)); + Assert.Equal(l4, IPAddress.HostToNetworkOrder(l3)); Assert.Equal(i2, IPAddress.HostToNetworkOrder(i1)); + Assert.Equal(i4, IPAddress.HostToNetworkOrder(i3)); Assert.Equal(s2, IPAddress.HostToNetworkOrder(s1)); Assert.Equal(l1, IPAddress.NetworkToHostOrder(l2)); + Assert.Equal(l3, IPAddress.NetworkToHostOrder(l4)); Assert.Equal(i1, IPAddress.NetworkToHostOrder(i2)); + Assert.Equal(i3, IPAddress.NetworkToHostOrder(i4)); Assert.Equal(s1, IPAddress.NetworkToHostOrder(s2)); } [Fact] public static void IsLoopback_Get_Success() { - IPAddress ip = IPV4Address(); //IpV4 + IPAddress ip = IPV4Address1(); //IpV4 Assert.False(IPAddress.IsLoopback(ip)); ip = new IPAddress(IPAddress.Loopback.GetAddressBytes()); //IpV4 loopback @@ -185,7 +204,7 @@ namespace System.Net.Primitives.Functional.Tests { Assert.True(IPAddress.Parse("ff02::1").IsIPv6Multicast); Assert.False(IPAddress.Parse("Fe08::1").IsIPv6Multicast); - Assert.False(IPV4Address().IsIPv6Multicast); + Assert.False(IPV4Address1().IsIPv6Multicast); } [Fact] @@ -193,7 +212,7 @@ namespace System.Net.Primitives.Functional.Tests { Assert.True(IPAddress.Parse("fe80::1").IsIPv6LinkLocal); Assert.False(IPAddress.Parse("Fe08::1").IsIPv6LinkLocal); - Assert.False(IPV4Address().IsIPv6LinkLocal); + Assert.False(IPV4Address1().IsIPv6LinkLocal); } [Fact] @@ -201,7 +220,7 @@ namespace System.Net.Primitives.Functional.Tests { Assert.True(IPAddress.Parse("FEC0::1").IsIPv6SiteLocal); Assert.False(IPAddress.Parse("Fe08::1").IsIPv6SiteLocal); - Assert.False(IPV4Address().IsIPv6SiteLocal); + Assert.False(IPV4Address1().IsIPv6SiteLocal); } [Fact] @@ -209,19 +228,19 @@ namespace System.Net.Primitives.Functional.Tests { Assert.True(IPAddress.Parse("2001::1").IsIPv6Teredo); Assert.False(IPAddress.Parse("Fe08::1").IsIPv6Teredo); - Assert.False(IPV4Address().IsIPv6Teredo); + Assert.False(IPV4Address1().IsIPv6Teredo); } [Fact] public static void Equals_Compare_Success() { - IPAddress ip1 = IPAddress.Parse("192.168.0.9"); //IpV4 - IPAddress ip2 = IPAddress.Parse("192.168.0.9"); //IpV4 - IPAddress ip3 = IPAddress.Parse("169.192.1.10"); //IpV4 + IPAddress ip1 = IPAddress.Parse(IpV4AddressString1); //IpV4 + IPAddress ip2 = IPAddress.Parse(IpV4AddressString1); //IpV4 + IPAddress ip3 = IPAddress.Parse(IpV4AddressString2); //IpV4 - IPAddress ip4 = new IPAddress(ipV6AddressBytes1); //IpV6 - IPAddress ip5 = new IPAddress(ipV6AddressBytes1); //IpV6 - IPAddress ip6 = new IPAddress(ipV6AddressBytes2); //IpV6 + IPAddress ip4 = IPV6Address1(); //IpV6 + IPAddress ip5 = IPV6Address1(); //IpV6 + IPAddress ip6 = IPV6Address2(); //IpV6 Assert.True(ip1.Equals(ip2)); Assert.True(ip2.Equals(ip1)); @@ -242,23 +261,56 @@ namespace System.Net.Primitives.Functional.Tests Assert.False(ip4.GetHashCode().Equals(ip6.GetHashCode())); } + [Theory] + [MemberData(nameof(GetValidIPAddresses))] + [MemberData(nameof(GeneratedIPAddresses))] + public static void GetHashCode_ValidIPAddresses_Success(IPAddress ip) + { + Assert.Equal(ip.GetHashCode(), ip.GetHashCode()); + + var clonedIp = ip.AddressFamily == AddressFamily.InterNetworkV6 ? + new IPAddress(ip.GetAddressBytes(), ip.ScopeId) : + new IPAddress(ip.GetAddressBytes()); + + Assert.Equal(ip.GetHashCode(), clonedIp.GetHashCode()); + } + + private static IEnumerable GetValidIPAddresses() + { + return IPAddressParsing.ValidIpv4Addresses + .Concat(IPAddressParsing.ValidIpv6Addresses) + .Select(array => new object[] {IPAddress.Parse((string)array[0])}); + } + + public static readonly object[][] GeneratedIPAddresses = + { + new object[] {IPAddress.Parse(IpV4AddressString1)}, + new object[] {IPAddress.Parse(IpV6AddressString)}, + new object[] {new IPAddress(MinAddress)}, + new object[] {new IPAddress(MaxAddress)}, + new object[] {new IPAddress(IpV4AddressBytes)}, + new object[] {new IPAddress(IpV6AddressBytes1)}, + new object[] {new IPAddress(IpV6AddressBytes1, MinScopeId)}, + }; + #pragma warning disable 618 - [Fact] - public static void Address_Property_Failure() - { - IPAddress ip1 = IPAddress.Parse("fe80::200:f8ff:fe21:67cf"); - Assert.Throws(() => ip1.Address); - } - - [Fact] - public static void Address_Property_Success() - { - IPAddress ip1 = IPAddress.Parse("192.168.0.9"); - //192.168.0.10 - long newIp4Address = 192 << 24 | 168 << 16 | 0 << 8 | 10; - ip1.Address = newIp4Address; - Assert.Equal("10.0.168.192" , ip1.ToString()); - } + [Fact] + public static void Address_Property_Failure() + { + IPAddress ip = IPAddress.Parse("fe80::200:f8ff:fe21:67cf"); + Assert.Throws(() => ip.Address); + } + + [Fact] + public static void Address_Property_Success() + { + IPAddress ip1 = IPV4Address1(); + IPAddress ip2 = IPV4Address2(); + ip1.Address = ip2.Address; + + Assert.Equal(ip1, ip2); + Assert.Equal(ip1.GetHashCode(), ip2.GetHashCode()); + } #pragma warning restore 618 } } diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Resources/System.Net.Primitives.Functional.Tests.rd.xml b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Resources/System.Net.Primitives.Functional.Tests.rd.xml new file mode 100644 index 0000000000..6d1c95958f --- /dev/null +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/Resources/System.Net.Primitives.Functional.Tests.rd.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/System.Net.Primitives.Functional.Tests.csproj b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/System.Net.Primitives.Functional.Tests.csproj index 83b231ede5..c7d6316009 100644 --- a/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/System.Net.Primitives.Functional.Tests.csproj +++ b/external/corefx/src/System.Net.Primitives/tests/FunctionalTests/System.Net.Primitives.Functional.Tests.csproj @@ -8,6 +8,10 @@ + + + + @@ -18,7 +22,9 @@ + + @@ -27,9 +33,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Diagnostics\Tracing\TestEventListener.cs @@ -43,5 +46,11 @@ RemoteExecutorConsoleApp + + + + + + - \ No newline at end of file + diff --git a/external/corefx/src/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj b/external/corefx/src/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj index 890fff8bdc..818d010db0 100644 --- a/external/corefx/src/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj +++ b/external/corefx/src/System.Net.Primitives/tests/PalTests/System.Net.Primitives.Pal.Tests.csproj @@ -51,6 +51,9 @@ ProductionCode\System\Net\EndPoint.cs + + ProductionCode\Common\System\Marvin.cs + ProductionCode\Common\System\IO\StringBuilderCache.cs diff --git a/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/Configurations.props b/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/Configurations.props index cfc57211a4..ebe64f0dc4 100644 --- a/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/Configurations.props +++ b/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/Configurations.props @@ -4,6 +4,8 @@ netstandard-Unix; netstandard-Windows_NT; + netcoreapp-Unix; + netcoreapp-Windows_NT; - \ No newline at end of file + diff --git a/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/IPAddressPerformanceTests.cs b/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/IPAddressPerformanceTests.cs new file mode 100644 index 0000000000..babc47ab09 --- /dev/null +++ b/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/IPAddressPerformanceTests.cs @@ -0,0 +1,156 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Xunit.Performance; +using Xunit; + +namespace System.Net.Primitives.Tests +{ + public static class IPAddressPerformanceTests + { + public static readonly object[][] TestAddresses = + { + new object[] { new byte[] { 0x8f, 0x18, 0x14, 0x24 } }, + new object[] { new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 } }, + }; + + [Benchmark] + [MeasureGCCounts] + [MemberData(nameof(TestAddresses))] + public static void TryWriteBytes(byte[] address) + { + var ip = new IPAddress(address); + var bytes = new byte[address.Length]; + var bytesSpan = new Span(bytes); + int bytesWritten = 0; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 10000; ++i) + { + ip.TryWriteBytes(bytesSpan, out bytesWritten); ip.TryWriteBytes(bytesSpan, out bytesWritten); + ip.TryWriteBytes(bytesSpan, out bytesWritten); ip.TryWriteBytes(bytesSpan, out bytesWritten); + ip.TryWriteBytes(bytesSpan, out bytesWritten); ip.TryWriteBytes(bytesSpan, out bytesWritten); + ip.TryWriteBytes(bytesSpan, out bytesWritten); ip.TryWriteBytes(bytesSpan, out bytesWritten); + } + } + } + } + + [Benchmark] + [MeasureGCCounts] + [MemberData(nameof(TestAddresses))] + public static void GetAddressBytes(byte[] address) + { + var ip = new IPAddress(address); + byte[] bytes; + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 10000; ++i) + { + bytes = ip.GetAddressBytes(); bytes = ip.GetAddressBytes(); + bytes = ip.GetAddressBytes(); bytes = ip.GetAddressBytes(); + bytes = ip.GetAddressBytes(); bytes = ip.GetAddressBytes(); + } + } + } + } + + [Benchmark] + [MeasureGCCounts] + [MemberData(nameof(TestAddresses))] + public static void Ctor_Bytes(byte[] address) + { + IPAddress ip; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 10000; ++i) + { + ip = new IPAddress(address); ip = new IPAddress(address); + ip = new IPAddress(address); ip = new IPAddress(address); + ip = new IPAddress(address); ip = new IPAddress(address); + ip = new IPAddress(address); ip = new IPAddress(address); + } + } + } + } + + [Benchmark] + [MeasureGCCounts] + [MemberData(nameof(TestAddresses))] + public static void Ctor_Span(byte[] address) + { + var span = new ReadOnlySpan(address); + IPAddress ip; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 10000; ++i) + { + ip = new IPAddress(span); ip = new IPAddress(span); + ip = new IPAddress(span); ip = new IPAddress(span); + ip = new IPAddress(span); ip = new IPAddress(span); + ip = new IPAddress(span); ip = new IPAddress(span); + } + } + } + } + + [Benchmark] + [MeasureGCCounts] + [MemberData(nameof(TestAddresses))] + public static void TryFormat(byte[] address) + { + const int INET6_ADDRSTRLEN = 65; + var buffer = new char[INET6_ADDRSTRLEN]; + var result = new Span(buffer); + int charsWritten; + + var ip = new IPAddress(address); + + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 10000; ++i) + { + ip.TryFormat(result, out charsWritten); + } + } + } + } + + [Benchmark] + [MeasureGCCounts] + [MemberData(nameof(TestAddresses))] + public static void ToString(byte[] address) + { + var ip = new IPAddress(address); + + string result; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 10000; ++i) + { + result = ip.ToString(); result = ip.ToString(); + result = ip.ToString(); result = ip.ToString(); + result = ip.ToString(); result = ip.ToString(); + result = ip.ToString(); result = ip.ToString(); + result = ip.ToString(); result = ip.ToString(); + result = ip.ToString(); result = ip.ToString(); + } + } + } + } + } +} diff --git a/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj b/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj index ab3d3f1b29..29d032a546 100644 --- a/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj +++ b/external/corefx/src/System.Net.Primitives/tests/PerformanceTests/System.Net.Primitives.Performance.Tests.csproj @@ -9,8 +9,13 @@ + + + + + @@ -19,4 +24,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs b/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs index 3f44d62515..ce3414061f 100644 --- a/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs +++ b/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieContainerTest.cs @@ -517,6 +517,30 @@ namespace System.Net.Primitives.Unit.Tests Assert.Equal(c4, cc2[2]); } + [Fact] + [ActiveIssue(24368)] + public void GetCookies_DifferentPaths_ReturnsConsistentResults() + { + Cookie c1 = new Cookie("name1", "value", "/base", ".url.com"); + Cookie c2 = new Cookie("name2", "value", "/base/url1", ".url.com"); + Cookie c3 = new Cookie("name3", "value", "/base/url2", ".url.com"); + + CookieContainer cc1 = new CookieContainer(); + cc1.Add(c1); + cc1.Add(c2); + cc1.Add(c3); + + CookieCollection cc2 = cc1.GetCookies(new Uri("http://url.com/base/url1")); + Assert.Equal(2, cc2.Count); + Assert.Equal(c2, cc2[0]); + Assert.Equal(c1, cc2[1]); + + CookieCollection cc3 = cc1.GetCookies(new Uri("http://url.com/base/url2")); + Assert.Equal(2, cc3.Count); + Assert.Equal(c3, cc3[0]); + Assert.Equal(c1, cc3[1]); + } + [Fact] public async Task GetCookies_RemovesExpired_Cookies() { diff --git a/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieInternalTest.cs b/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieInternalTest.cs index 0683162f9b..35653d720d 100644 --- a/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieInternalTest.cs +++ b/external/corefx/src/System.Net.Primitives/tests/UnitTests/CookieInternalTest.cs @@ -41,5 +41,72 @@ namespace NetPrimitivesUnitTests Assert.Equal(1, cookies.Count); Assert.False(cookies[CookieName].DomainImplicit); } + + [Theory] + [InlineData("cookie_name=cookie_value")] + [InlineData("cookie_name=cookie_value;")] + [InlineData("cookie_name1=cookie_value1;cookie_name2=cookie_value2")] + [InlineData("cookie_name1=cookie_value1;cookie_name2=cookie_value2;")] + public void CookieParserGetString_SetCookieHeaderValue_Success(string cookieString) + { + var parser = new CookieParser(cookieString); + string actual = parser.GetString(); + Assert.Equal(cookieString, actual); + } + + [Theory] + [InlineData("cookie_name=cookie_value", new[] { "cookie_name", "cookie_value" })] + [InlineData("cookie_name=cookie_value;", new[] { "cookie_name", "cookie_value" })] + [InlineData("cookie_name1=cookie_value1;cookie_name2=cookie_value2", new[] { "cookie_name1", "cookie_value1", "cookie_name2", "cookie_value2" })] + [InlineData("cookie_name1=cookie_value1;cookie_name2=cookie_value2;", new[] { "cookie_name1", "cookie_value1", "cookie_name2", "cookie_value2" })] + public void CookieParserGetServer_SetCookieHeaderValue_Success(string cookieString, string[] expectedStrings) + { + int index = 0; + int cookieCount = 0; + var parser = new CookieParser(cookieString); + while (true) + { + Cookie cookie = parser.GetServer(); + if (cookie == null) + { + break; + } + + cookieCount++; + Assert.Equal(expectedStrings[index++], cookie.Name); + Assert.Equal(expectedStrings[index++], cookie.Value); + } + + int expectedCookieCount = expectedStrings.Length >> 1; + Assert.Equal(expectedCookieCount, cookieCount); + } + + [ActiveIssue(22925)] + [Theory] + [InlineData("cookie_name=cookie_value", new[] { "cookie_name", "cookie_value" })] + [InlineData("cookie_name=cookie_value;", new[] { "cookie_name", "cookie_value" })] + [InlineData("cookie_name1=cookie_value1;cookie_name2=cookie_value2", new[] { "cookie_name1", "cookie_value1", "cookie_name2", "cookie_value2" })] + [InlineData("cookie_name1=cookie_value1;cookie_name2=cookie_value2;", new[] { "cookie_name1", "cookie_value1", "cookie_name2", "cookie_value2" })] + public void CookieParserGet_SetCookieHeaderValue_Success(string cookieString, string[] expectedStrings) + { + int index = 0; + int cookieCount = 0; + var parser = new CookieParser(cookieString); + while (true) + { + Cookie cookie = parser.Get(); + if (cookie == null) + { + break; + } + + cookieCount++; + Assert.Equal(expectedStrings[index++], cookie.Name); + Assert.Equal(expectedStrings[index++], cookie.Value); + } + + int expectedCookieCount = expectedStrings.Length >> 1; + Assert.Equal(expectedCookieCount, cookieCount); + } } } diff --git a/external/corefx/src/System.Net.Primitives/tests/UnitTests/Fakes/IPv6AddressHelper.cs b/external/corefx/src/System.Net.Primitives/tests/UnitTests/Fakes/IPv6AddressHelper.cs index 2b0cd555ca..56e14dba69 100644 --- a/external/corefx/src/System.Net.Primitives/tests/UnitTests/Fakes/IPv6AddressHelper.cs +++ b/external/corefx/src/System.Net.Primitives/tests/UnitTests/Fakes/IPv6AddressHelper.cs @@ -12,6 +12,6 @@ namespace System ushort[] numbers, int fromInclusive, int toExclusive) => (-1, -1); internal unsafe static bool ShouldHaveIpv4Embedded(ushort[] numbers) => false; internal unsafe static bool IsValidStrict(char* name, int start, ref int end) => false; - internal static unsafe bool Parse(string address, ushort* numbers, int start, ref string scopeId) => false; + internal static unsafe bool Parse(ReadOnlySpan ipSpan, ushort* numbers, int start, ref string scopeId) => false; } } diff --git a/external/corefx/src/System.Net.Primitives/tests/UnitTests/System.Net.Primitives.UnitTests.Tests.csproj b/external/corefx/src/System.Net.Primitives/tests/UnitTests/System.Net.Primitives.UnitTests.Tests.csproj index 775697471f..9185a900ed 100644 --- a/external/corefx/src/System.Net.Primitives/tests/UnitTests/System.Net.Primitives.UnitTests.Tests.csproj +++ b/external/corefx/src/System.Net.Primitives/tests/UnitTests/System.Net.Primitives.UnitTests.Tests.csproj @@ -95,6 +95,9 @@ ProductionCode\Common\System\Net\UriScheme.cs + + Common\System\Marvin.cs + Common\System\IO\StringBuilderCache.cs diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/CommandStream.cs b/external/corefx/src/System.Net.Requests/src/System/Net/CommandStream.cs index caf3a4f9c4..436378c722 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/CommandStream.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/CommandStream.cs @@ -177,9 +177,9 @@ namespace System.Net } } - /// Pipelined command resoluton. + /// Pipelined command resolution. /// How this works: - /// A list of commands that need to be sent to the FTP server are spliced together into a array, + /// A list of commands that need to be sent to the FTP server are spliced together into an array, /// each command such STOR, PORT, etc, is sent to the server, then the response is parsed into a string, /// with the response, the delegate is called, which returns an instruction (either continue, stop, or read additional /// responses from server). diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/FtpControlStream.cs b/external/corefx/src/System.Net.Requests/src/System/Net/FtpControlStream.cs index 7057ac1783..ee5cd00b5a 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/FtpControlStream.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/FtpControlStream.cs @@ -1234,7 +1234,7 @@ namespace System.Net } /// - /// Determnines whether the stream we return is Writeable or Readable + /// Determines whether the stream we return is Writeable or Readable /// private TriState IsFtpDataStreamWriteable() { diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/FtpWebResponse.cs b/external/corefx/src/System.Net.Requests/src/System/Net/FtpWebResponse.cs index 0486695ec2..53bd353234 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/FtpWebResponse.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/FtpWebResponse.cs @@ -141,7 +141,7 @@ namespace System.Net } /// - /// Last status code retrived + /// Last status code retrieved /// public FtpStatusCode StatusCode { @@ -152,7 +152,7 @@ namespace System.Net } /// - /// Last status line retrived + /// Last status line retrieved /// public string StatusDescription { @@ -163,7 +163,7 @@ namespace System.Net } /// - /// Returns last modified date time for given file (null if not relavant/avail) + /// Returns last modified date time for given file (null if not relevant/avail) /// public DateTime LastModified { diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/GlobalProxySelection.cs b/external/corefx/src/System.Net.Requests/src/System/Net/GlobalProxySelection.cs index bb62fe324f..011bbe4d8c 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/GlobalProxySelection.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/GlobalProxySelection.cs @@ -34,7 +34,6 @@ namespace System.Net [Serializable] private sealed class EmptyWebProxy : IWebProxy { - [NonSerialized] private ICredentials _credentials; public EmptyWebProxy() diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/HttpDateParse.cs b/external/corefx/src/System.Net.Requests/src/System/Net/HttpDateParse.cs index 81b9bd3436..1eec59f08a 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/HttpDateParse.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/HttpDateParse.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -//-------------------------------------------------------------------------- - -using System.Globalization; namespace System.Net { @@ -14,7 +11,7 @@ namespace System.Net // // Date indicies used to figure out what each entry is. // - + private const int DATE_INDEX_DAY_OF_WEEK = 0; private const int DATE_1123_INDEX_DAY = 1; @@ -71,56 +68,25 @@ namespace System.Net private const int DATE_TOKEN_ERROR = (DATE_TOKEN_LAST+1); - - // - // MAKE_UPPER - takes an assumed lower character and bit manipulates into a upper. - // (make sure the character is Lower case alpha char to begin, - // otherwise it corrupts) - // - - private - static - char - MAKE_UPPER(char c) { - return(Char.ToUpper(c)); - } - - /*++ - - Routine Description: - - Looks at the first three bytes of string to determine if we're looking - at a Day of the Week, or Month, or "GMT" string. Is inlined so that - the compiler can optimize this code into the caller FInternalParseHttpDate. - - Arguments: - - lpszDay - a string ptr to the first byte of the string in question. - - Return Value: - - DWORD - Success - The Correct date token, 0-6 for day of the week, 1-14 for month, etc - - Failure - DATE_TOKEN_ERROR - - --*/ - - private - static - int - MapDayMonthToDword( - char [] lpszDay, - int index - ) { - switch (MAKE_UPPER(lpszDay[index])) { // make uppercase + /// + /// Looks at the first three chars of a string at the index to determine if we're looking + /// at a Day of the Week, or Month, or "GMT" string. + /// + /// + /// The correct date token (0-6 for day of the week, 1-14 for month, etc.) if successful, + /// otherwise, DATE_TOKEN_ERROR. + /// + private static int MapDayMonthToDword(string day, int index) + { + switch (char.ToUpper(day[index])) + { case 'A': - switch (MAKE_UPPER(lpszDay[index+1])) { + switch (char.ToUpper(day[index + 1])) + { case 'P': return DATE_TOKEN_APRIL; case 'U': return DATE_TOKEN_AUGUST; - } return DATE_TOKEN_ERROR; @@ -128,25 +94,26 @@ namespace System.Net return DATE_TOKEN_DECEMBER; case 'F': - switch (MAKE_UPPER(lpszDay[index+1])) { + switch (char.ToUpper(day[index + 1])) + { case 'R': return DATE_TOKEN_FRIDAY; case 'E': return DATE_TOKEN_FEBRUARY; } - return DATE_TOKEN_ERROR; case 'G': return DATE_TOKEN_GMT; case 'M': - - switch (MAKE_UPPER(lpszDay[index+1])) { + switch (char.ToUpper(day[index + 1])) + { case 'O': return DATE_TOKEN_MONDAY; case 'A': - switch (MAKE_UPPER(lpszDay[index+2])) { + switch (char.ToUpper(day[index + 2])) + { case 'R': return DATE_TOKEN_MARCH; case 'Y': @@ -156,20 +123,20 @@ namespace System.Net // fall through to error break; } - return DATE_TOKEN_ERROR; case 'N': return DATE_TOKEN_NOVEMBER; case 'J': - - switch (MAKE_UPPER(lpszDay[index+1])) { + switch (char.ToUpper(day[index + 1])) + { case 'A': return DATE_TOKEN_JANUARY; case 'U': - switch (MAKE_UPPER(lpszDay[index+2])) { + switch (char.ToUpper(day[index + 2])) + { case 'N': return DATE_TOKEN_JUNE; case 'L': @@ -179,15 +146,14 @@ namespace System.Net // fall through to error break; } - return DATE_TOKEN_ERROR; case 'O': return DATE_TOKEN_OCTOBER; case 'S': - - switch (MAKE_UPPER(lpszDay[index+1])) { + switch (char.ToUpper(day[index + 1])) + { case 'A': return DATE_TOKEN_SATURDAY; case 'U': @@ -195,18 +161,16 @@ namespace System.Net case 'E': return DATE_TOKEN_SEPTEMBER; } - return DATE_TOKEN_ERROR; - case 'T': - switch (MAKE_UPPER(lpszDay[index+1])) { + switch (char.ToUpper(day[index + 1])) + { case 'U': return DATE_TOKEN_TUESDAY; case 'H': return DATE_TOKEN_THURSDAY; } - return DATE_TOKEN_ERROR; case 'U': @@ -214,54 +178,22 @@ namespace System.Net case 'W': return DATE_TOKEN_WEDNESDAY; - } return DATE_TOKEN_ERROR; } - /*++ - - Routine Description: - - Parses through a ANSI, RFC850, or RFC1123 date format and covents it into - a FILETIME/SYSTEMTIME time format. - - Important this a time-critical function and should only be changed - with the intention of optimizing or a critical need work item. - - Arguments: - - lpft - Ptr to FILETIME structure. Used to store converted result. - Must be NULL if not intended to be used !!! - - lpSysTime - Ptr to SYSTEMTIME struture. Used to return Systime if needed. - - lpcszDateStr - Const Date string to parse. - - Return Value: - - BOOL - Success - TRUE - - Failure - FALSE - - --*/ - public - static - bool - ParseHttpDate( - String DateString, - out DateTime dtOut - ) { + /// + /// Parses through an ANSI, RFC850, or RFC1123 date format and converts it to a . + /// + public static bool ParseHttpDate(string dateString, out DateTime result) + { int index = 0; int i = 0, iLastLettered = -1; - bool fIsANSIDateFormat = false; - int [] rgdwDateParseResults = new int[MAX_FIELD_DATE_ENTRIES]; - bool fRet = true; - char [] lpInputBuffer = DateString.ToCharArray(); + bool isANSIDateFormat = false; + int[] dateParseResults = new int[MAX_FIELD_DATE_ENTRIES]; - dtOut = new DateTime(); + result = new DateTime(); // // Date Parsing v2 (1 more to go), and here is how it works... @@ -269,53 +201,53 @@ namespace System.Net // integers to integers, Month,Day, and GMT strings into integers, // and all is then placed IN order in a temp array. // - // At the completetion of the parse stage, we simple look at - // the data, and then map the results into the correct - // places in the SYSTIME structure. Simple, No allocations, and - // No dirting the data. + // At the completion of the parse stage, we simple look at + // the data, and then map the results into a new DateTime. // // The end of the function does something munging and pretting // up of the results to handle the year 2000, and TZ offsets // Note: do we need to fully handle TZs anymore? // - while (index < DateString.Length && i < MAX_FIELD_DATE_ENTRIES) { - if (lpInputBuffer[index] >= '0' && lpInputBuffer[index] <= '9') { + while (index < dateString.Length && i < MAX_FIELD_DATE_ENTRIES) + { + if (dateString[index] >= '0' && dateString[index] <= '9') + { // // we have a numerical entry, scan through it and convent to DWORD // - rgdwDateParseResults[i] = 0; + dateParseResults[i] = 0; - do { - rgdwDateParseResults[i] *= BASE_DEC; - rgdwDateParseResults[i] += (lpInputBuffer[index] - '0'); + do + { + dateParseResults[i] *= BASE_DEC; + dateParseResults[i] += (dateString[index] - '0'); index++; - } while (index < DateString.Length && - lpInputBuffer[index] >= '0' && - lpInputBuffer[index] <= '9'); + } while (index < dateString.Length && + dateString[index] >= '0' && + dateString[index] <= '9'); i++; // next token } - else if ((lpInputBuffer[index] >= 'A' && lpInputBuffer[index] <= 'Z') || - (lpInputBuffer[index] >= 'a' && lpInputBuffer[index] <= 'z')) { + else if ((dateString[index] >= 'A' && dateString[index] <= 'Z') || + (dateString[index] >= 'a' && dateString[index] <= 'z')) + { // // we have a string, should be a day, month, or GMT // lets skim to the end of the string // - rgdwDateParseResults[i] = - MapDayMonthToDword(lpInputBuffer, index); + dateParseResults[i] = MapDayMonthToDword(dateString, index); iLastLettered = i; // We want to ignore the possibility of a time zone such as PST or EST in a non-standard // date format such as "Thu Dec 17 16:01:28 PST 1998" (Notice that the year is _after_ the time zone - if ((rgdwDateParseResults[i] == DATE_TOKEN_ERROR) - && - !(fIsANSIDateFormat && (i==DATE_ANSI_INDEX_YEAR))) { - fRet = false; - goto quit; + if ((dateParseResults[i] == DATE_TOKEN_ERROR) && + !(isANSIDateFormat && (i == DATE_ANSI_INDEX_YEAR))) + { + return false; } // @@ -324,8 +256,9 @@ namespace System.Net // looking at a ANSI type DATE format. // - if (i == DATE_ANSI_INDEX_MONTH) { - fIsANSIDateFormat = true; + if (i == DATE_ANSI_INDEX_MONTH) + { + isANSIDateFormat = true; } // @@ -333,15 +266,17 @@ namespace System.Net // as MapDayMonthToDword only peeks at a few characters // - do { + do + { index++; - } while (index < DateString.Length && - ( (lpInputBuffer[index] >= 'A' && lpInputBuffer[index] <= 'Z') || - (lpInputBuffer[index] >= 'a' && lpInputBuffer[index] <= 'z') )); + } while ((index < dateString.Length) && + ((dateString[index] >= 'A' && dateString[index] <= 'Z') || + (dateString[index] >= 'a' && dateString[index] <= 'z'))); i++; // next token } - else { + else + { // // For the generic case its either a space, comma, semi-colon, etc. // the point is we really don't care, nor do we need to waste time @@ -368,30 +303,34 @@ namespace System.Net int second; int millisecond; - millisecond = 0; + millisecond = 0; - if (fIsANSIDateFormat) { - day = rgdwDateParseResults[DATE_ANSI_INDEX_DAY]; - month = rgdwDateParseResults[DATE_ANSI_INDEX_MONTH]; - hour = rgdwDateParseResults[DATE_ANSI_INDEX_HRS]; - minute = rgdwDateParseResults[DATE_ANSI_INDEX_MINS]; - second = rgdwDateParseResults[DATE_ANSI_INDEX_SECS]; - if (iLastLettered != DATE_ANSI_INDEX_YEAR) { - year = rgdwDateParseResults[DATE_ANSI_INDEX_YEAR]; + if (isANSIDateFormat) + { + day = dateParseResults[DATE_ANSI_INDEX_DAY]; + month = dateParseResults[DATE_ANSI_INDEX_MONTH]; + hour = dateParseResults[DATE_ANSI_INDEX_HRS]; + minute = dateParseResults[DATE_ANSI_INDEX_MINS]; + second = dateParseResults[DATE_ANSI_INDEX_SECS]; + if (iLastLettered != DATE_ANSI_INDEX_YEAR) + { + year = dateParseResults[DATE_ANSI_INDEX_YEAR]; } - else { + else + { // This is a fix to get around toString/toGMTstring (where the timezone is // appended at the end. (See above) - year = rgdwDateParseResults[DATE_INDEX_TZ]; + year = dateParseResults[DATE_INDEX_TZ]; } } - else { - day = rgdwDateParseResults[DATE_1123_INDEX_DAY]; - month = rgdwDateParseResults[DATE_1123_INDEX_MONTH]; - year = rgdwDateParseResults[DATE_1123_INDEX_YEAR]; - hour = rgdwDateParseResults[DATE_1123_INDEX_HRS]; - minute = rgdwDateParseResults[DATE_1123_INDEX_MINS]; - second = rgdwDateParseResults[DATE_1123_INDEX_SECS]; + else + { + day = dateParseResults[DATE_1123_INDEX_DAY]; + month = dateParseResults[DATE_1123_INDEX_MONTH]; + year = dateParseResults[DATE_1123_INDEX_YEAR]; + hour = dateParseResults[DATE_1123_INDEX_HRS]; + minute = dateParseResults[DATE_1123_INDEX_MINS]; + second = dateParseResults[DATE_1123_INDEX_SECS]; } // @@ -400,7 +339,8 @@ namespace System.Net // we all look bad. // - if (year < 100) { + if (year < 100) + { year += ((year < 80) ? 2000 : 1900); } @@ -409,29 +349,30 @@ namespace System.Net // !lpszHrs || !lpszMins || !lpszSec // - if ((i < 4) - || (day > 31) - || (hour > 23) - || (minute > 59) - || (second > 59)) { - fRet = false; - goto quit; + if ((i < 4) || + (day > 31) || + (hour > 23) || + (minute > 59) || + (second > 59)) + { + return false; } // // Now do the DateTime conversion // - dtOut = new DateTime (year, month, day, hour, minute, second, millisecond); + result = new DateTime(year, month, day, hour, minute, second, millisecond); // // we want the system time to be accurate. This is _suhlow_ // The time passed in is in the local time zone; we have to convert this into GMT. // - if (iLastLettered==DATE_ANSI_INDEX_YEAR) { + if (iLastLettered == DATE_ANSI_INDEX_YEAR) + { // this should be an unusual case. - dtOut = dtOut.ToUniversalTime(); + result = result.ToUniversalTime(); } // @@ -439,27 +380,23 @@ namespace System.Net // then convert to appropriate GMT time // - if ((i > DATE_INDEX_TZ && - rgdwDateParseResults[DATE_INDEX_TZ] != DATE_TOKEN_GMT)) { + if (i > DATE_INDEX_TZ && + dateParseResults[DATE_INDEX_TZ] != DATE_TOKEN_GMT) + { // // if we received +/-nnnn as offset (hhmm), modify the output FILETIME // - double offset; - - offset = (double) rgdwDateParseResults[DATE_INDEX_TZ]; - dtOut.AddHours(offset); + double offset = dateParseResults[DATE_INDEX_TZ]; + result.AddHours(offset); } // In the end, we leave it all in LocalTime - dtOut = dtOut.ToLocalTime(); + result = result.ToLocalTime(); - quit: - - return fRet; + return true; } } - -} // namespace System.Net +} diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/HttpWebRequest.cs b/external/corefx/src/System.Net.Requests/src/System/Net/HttpWebRequest.cs index b16b62d886..043108c264 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/HttpWebRequest.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/HttpWebRequest.cs @@ -1201,6 +1201,8 @@ namespace System.Net request.Headers.ConnectionClose = true; } + request.Version = ProtocolVersion; + _sendRequestTask = client.SendAsync( request, _allowReadStreamBuffering ? HttpCompletionOption.ResponseContentRead : HttpCompletionOption.ResponseHeadersRead, diff --git a/external/corefx/src/System.Net.Requests/src/System/Net/WebRequest.cs b/external/corefx/src/System.Net.Requests/src/System/Net/WebRequest.cs index cb7a0f3e52..e8a57a5b86 100644 --- a/external/corefx/src/System.Net.Requests/src/System/Net/WebRequest.cs +++ b/external/corefx/src/System.Net.Requests/src/System/Net/WebRequest.cs @@ -574,6 +574,7 @@ namespace System.Net lock (s_internalSyncObject) { s_DefaultWebProxy = value; + s_DefaultWebProxyInitialized = true; } } } diff --git a/external/corefx/src/System.Net.Requests/tests/HttpWebRequestTest.cs b/external/corefx/src/System.Net.Requests/tests/HttpWebRequestTest.cs index c049886d3b..7b7c230310 100644 --- a/external/corefx/src/System.Net.Requests/tests/HttpWebRequestTest.cs +++ b/external/corefx/src/System.Net.Requests/tests/HttpWebRequestTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net.Cache; @@ -279,6 +280,7 @@ namespace System.Net.Tests Assert.Equal(int.MaxValue, request.Timeout); } + [ActiveIssue(22627)] [Fact] public async Task Timeout_SetTenMillisecondsOnLoopback_ThrowsWebException() { @@ -734,6 +736,44 @@ namespace System.Net.Tests Assert.Equal(HttpVersion.Version11, request.ProtocolVersion); } + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP does not allow HTTP/1.0 requests.")] + [OuterLoop] + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task ProtocolVersion_SetThenSendRequest_CorrectHttpRequestVersionSent(bool isVersion10) + { + Version requestVersion = isVersion10 ? HttpVersion.Version10 : HttpVersion.Version11; + Version receivedRequestVersion = null; + + await LoopbackServer.CreateServerAsync(async (server, url) => + { + HttpWebRequest request = WebRequest.CreateHttp(url); + request.ProtocolVersion = requestVersion; + + Task getResponse = request.GetResponseAsync(); + Task> serverTask = LoopbackServer.ReadRequestAndSendResponseAsync(server); + + using (HttpWebResponse response = (HttpWebResponse) await getResponse) + { + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + } + + List receivedRequest = await serverTask; + string statusLine = receivedRequest[0]; + if (statusLine.Contains("/1.0")) + { + receivedRequestVersion = HttpVersion.Version10; + } + else if (statusLine.Contains("/1.1")) + { + receivedRequestVersion = HttpVersion.Version11; + } + }); + + Assert.Equal(requestVersion, receivedRequestVersion); + } + [Fact] public void ReadWriteTimeout_SetThenGet_ValuesMatch() { diff --git a/external/corefx/src/System.Net.Requests/tests/System.Net.Requests.Tests.csproj b/external/corefx/src/System.Net.Requests/tests/System.Net.Requests.Tests.csproj index 3f2b042ec9..7b8600d644 100644 --- a/external/corefx/src/System.Net.Requests/tests/System.Net.Requests.Tests.csproj +++ b/external/corefx/src/System.Net.Requests/tests/System.Net.Requests.Tests.csproj @@ -12,9 +12,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Net\Configuration.cs diff --git a/external/corefx/src/System.Net.Requests/tests/WebRequestTest.cs b/external/corefx/src/System.Net.Requests/tests/WebRequestTest.cs index 62a4650e09..861a3d4a4c 100644 --- a/external/corefx/src/System.Net.Requests/tests/WebRequestTest.cs +++ b/external/corefx/src/System.Net.Requests/tests/WebRequestTest.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; using Xunit; namespace System.Net.Tests { - public class WebRequestTest + public class WebRequestTest : RemoteExecutorTestBase { static WebRequestTest() { @@ -28,6 +29,20 @@ namespace System.Net.Tests Assert.Null(initialDefaultWebProxyCredentials); } + + [Fact] + public void DefaultWebProxy_SetThenGet_ValuesMatch() + { + RemoteInvoke(() => + { + IWebProxy p = new WebProxy(); + + WebRequest.DefaultWebProxy = p; + Assert.Same(p, WebRequest.DefaultWebProxy); + + return SuccessExitCode; + }).Dispose(); + } [Fact] public void DefaultWebProxy_SetCredentialsToNullThenGet_ValuesMatch() diff --git a/external/corefx/src/System.Net.Security/System.Net.Security.sln b/external/corefx/src/System.Net.Security/System.Net.Security.sln index 7661a94223..60dff9c3d9 100644 --- a/external/corefx/src/System.Net.Security/System.Net.Security.sln +++ b/external/corefx/src/System.Net.Security/System.Net.Security.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26923.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security.Tests", "tests\FunctionalTests\System.Net.Security.Tests.csproj", "{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}" ProjectSection(ProjectDependencies) = postProject @@ -57,4 +57,7 @@ Global {89F37791-6254-4D60-AB96-ACD3CCA0E771} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} {A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {72DFF69F-F9E9-4112-91E8-5FC8169B6F1F} + EndGlobalSection EndGlobal diff --git a/external/corefx/src/System.Net.Security/src/System.Net.Security.csproj b/external/corefx/src/System.Net.Security/src/System.Net.Security.csproj index b901f52574..03f8063a06 100644 --- a/external/corefx/src/System.Net.Security/src/System.Net.Security.csproj +++ b/external/corefx/src/System.Net.Security/src/System.Net.Security.csproj @@ -18,10 +18,11 @@ - + + @@ -163,6 +164,9 @@ Common\Interop\Windows\SChannel\UnmanagedCertificateContext.cs + + Common\Interop\Windows\SChannel\UnmanagedCertificateContext.IntPtr.cs + Common\Interop\Windows\sspicli\SecPkgContext_Bindings.cs @@ -386,6 +390,7 @@ + diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Logging/NetEventSource.cs b/external/corefx/src/System.Net.Security/src/System/Net/Logging/NetEventSource.cs new file mode 100644 index 0000000000..39760bf3fd --- /dev/null +++ b/external/corefx/src/System.Net.Security/src/System/Net/Logging/NetEventSource.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics.Tracing; +using System.Runtime.CompilerServices; + +namespace System.Net +{ + internal sealed partial class NetEventSource : EventSource + { + /// Logs the contents of a buffer + /// `this`, or another object that serves to provide context for the operation. + /// The buffer to be logged. + /// The calling member. + [NonEvent] + public static void DumpBuffer(object thisOrContextObject, ReadOnlyMemory buffer, [CallerMemberName] string memberName = null) + { + if (IsEnabled) + { + int count = Math.Min(buffer.Length, MaxDumpSize); + + byte[] slice = buffer.Slice(0, count).ToArray(); + Log.DumpBuffer(IdOf(thisOrContextObject), memberName, slice); + } + } + } +} diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SecureChannel.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SecureChannel.cs index f623b2fdbf..6f4cadecd2 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SecureChannel.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SecureChannel.cs @@ -897,41 +897,19 @@ namespace System.Net.Security size - output - Encrypted bytes --*/ - internal SecurityStatusPal Encrypt(byte[] buffer, int offset, int size, ref byte[] output, out int resultSize) + internal SecurityStatusPal Encrypt(ReadOnlyMemory buffer, ref byte[] output, out int resultSize) { if (NetEventSource.IsEnabled) { - NetEventSource.Enter(this, buffer, offset, size); - NetEventSource.DumpBuffer(this, buffer, 0, Math.Min(buffer.Length, 128)); + NetEventSource.Enter(this, buffer, buffer.Length); + NetEventSource.DumpBuffer(this, buffer); } byte[] writeBuffer = output; - - try - { - if (offset < 0 || offset > (buffer == null ? 0 : buffer.Length)) - { - throw new ArgumentOutOfRangeException(nameof(offset)); - } - - if (size < 0 || size > (buffer == null ? 0 : buffer.Length - offset)) - { - throw new ArgumentOutOfRangeException(nameof(size)); - } - - resultSize = 0; - } - catch (Exception e) when (!ExceptionCheck.IsFatal(e)) - { - NetEventSource.Fail(this, "Arguments out of range."); - throw; - } - + SecurityStatusPal secStatus = SslStreamPal.EncryptMessage( _securityContext, buffer, - offset, - size, _headerSize, _trailerSize, ref writeBuffer, diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs index 40f77b3b2d..f681f47f29 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs @@ -37,7 +37,7 @@ namespace System.Net.Security DataKeySize = dataKeySize; DataHashKeySize = dataHashKeySize; - //Openssl does not provide a way to return a exchange key size. + //Openssl does not provide a way to return an exchange key size. //It internally does calculate the key size before generating key to exchange //It is not a constant (Algorthim specific) either that we can hardcode and return. KeyExchKeySize = 0; diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslState.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslState.cs index f44975c581..100d1c3c5e 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslState.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslState.cs @@ -479,10 +479,10 @@ namespace System.Net.Security } } - internal SecurityStatusPal EncryptData(byte[] buffer, int offset, int count, ref byte[] outBuffer, out int outSize) + internal SecurityStatusPal EncryptData(ReadOnlyMemory buffer, ref byte[] outBuffer, out int outSize) { CheckThrow(true); - return Context.Encrypt(buffer, offset, count, ref outBuffer, out outSize); + return Context.Encrypt(buffer, ref outBuffer, out outSize); } internal SecurityStatusPal DecryptData(byte[] buffer, ref int offset, ref int count) @@ -1279,10 +1279,31 @@ namespace System.Net.Security } } - // Returns: - // true - operation queued - // false - operation can proceed - internal bool CheckEnqueueWrite(AsyncProtocolRequest asyncRequest) + internal Task CheckEnqueueWriteAsync() + { + // Clear previous request. + int lockState = Interlocked.CompareExchange(ref _lockWriteState, LockWrite, LockNone); + if (lockState != LockHandshake) + { + return Task.CompletedTask; + } + + lock (this) + { + if (_lockWriteState != LockHandshake) + { + CheckThrow(authSuccessCheck: true); + return Task.CompletedTask; + } + + _lockWriteState = LockPendingWrite; + TaskCompletionSource completionSource = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + _queuedWriteStateRequest = completionSource; + return completionSource.Task; + } + } + + internal void CheckEnqueueWrite() { // Clear previous request. _queuedWriteStateRequest = null; @@ -1290,7 +1311,7 @@ namespace System.Net.Security if (lockState != LockHandshake) { // Proceed with write. - return false; + return; } LazyAsyncResult lazyResult = null; @@ -1299,27 +1320,20 @@ namespace System.Net.Security if (_lockWriteState != LockHandshake) { // Handshake has completed before we grabbed the lock. - CheckThrow(true); - return false; + CheckThrow(authSuccessCheck: true); + return; } _lockWriteState = LockPendingWrite; - // Still pending, wait or enqueue. - if (asyncRequest != null) - { - _queuedWriteStateRequest = asyncRequest; - return true; - } - lazyResult = new LazyAsyncResult(null, null, /*must be */null); _queuedWriteStateRequest = lazyResult; } // Need to exit from lock before waiting. lazyResult.InternalWaitForCompletion(); - CheckThrow(true); - return false; + CheckThrow(authSuccessCheck: true); + return; } internal void FinishWrite() @@ -1332,25 +1346,27 @@ namespace System.Net.Security lock (this) { - object obj = _queuedWriteStateRequest; - if (obj == null) - { - // A repeated call. - return; - } + HandleWriteCallback(); + } + } - _queuedWriteStateRequest = null; - if (obj is LazyAsyncResult) - { - // Sync handshake is waiting on other thread. - ((LazyAsyncResult)obj).InvokeCallback(); - } - else - { - // Async handshake is pending, start it on other thread. - // Consider: we could start it in on this thread but that will delay THIS write completion + private void HandleWriteCallback() + { + object obj = _queuedWriteStateRequest; + _queuedWriteStateRequest = null; + switch (obj) + { + case null: + break; + case LazyAsyncResult lazy: + lazy.InvokeCallback(); + break; + case TaskCompletionSource tsc: + tsc.SetResult(0); + break; + default: ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncResumeHandshake), obj); - } + break; } } @@ -1411,26 +1427,7 @@ namespace System.Net.Security } _lockWriteState = LockWrite; - object obj = _queuedWriteStateRequest; - if (obj == null) - { - // We finished before Write has grabbed the lock. - return; - } - - _queuedWriteStateRequest = null; - - if (obj is LazyAsyncResult) - { - // Sync write is waiting on other thread. - ((LazyAsyncResult)obj).InvokeCallback(); - } - else - { - // Async write is pending, start it on other thread. - // Consider: we could start it in on this thread but that will delay THIS handshake completion - ThreadPool.QueueUserWorkItem(new WaitCallback(CompleteRequestWaitCallback), obj); - } + HandleWriteCallback(); } } finally diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStream.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStream.cs index 22cefaa220..c110f932ab 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStream.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStream.cs @@ -281,7 +281,7 @@ namespace System.Net.Security public virtual Task ShutdownAsync() => Task.Factory.FromAsync( (callback, state) => ((SslStream)state).BeginShutdown(callback, state), - iar => ((SslStream)iar.AsyncState).EndShutdown(iar), + iar => ((SslStream)iar.AsyncState).EndShutdown(iar), this); #endregion @@ -565,5 +565,15 @@ namespace System.Net.Security { _sslState.SecureStream.EndWrite(asyncResult); } + + public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + return _sslState.SecureStream.WriteAsync(buffer, offset, count, cancellationToken); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + return _sslState.SecureStream.WriteAsync(source, cancellationToken); + } } } diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.Adapters.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.Adapters.cs new file mode 100644 index 0000000000..48f0c13c57 --- /dev/null +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.Adapters.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using System.Threading; +using System.Threading.Tasks; + +namespace System.Net.Security +{ + // This contains adapters to allow a single code path for sync/async logic + internal partial class SslStreamInternal + { + private interface ISslWriteAdapter + { + Task LockAsync(); + Task WriteAsync(byte[] buffer, int offset, int count); + } + + private struct SslWriteAsync : ISslWriteAdapter + { + private readonly SslState _sslState; + private readonly CancellationToken _cancellationToken; + + public SslWriteAsync(SslState sslState, CancellationToken cancellationToken) + { + _sslState = sslState; + _cancellationToken = cancellationToken; + } + + public Task LockAsync() => _sslState.CheckEnqueueWriteAsync(); + + public Task WriteAsync(byte[] buffer, int offset, int count) => _sslState.InnerStream.WriteAsync(buffer, offset, count, _cancellationToken); + } + + private struct SslWriteSync : ISslWriteAdapter + { + private readonly SslState _sslState; + + public SslWriteSync(SslState sslState) => _sslState = sslState; + + public Task LockAsync() + { + _sslState.CheckEnqueueWrite(); + return Task.CompletedTask; + } + + public Task WriteAsync(byte[] buffer, int offset, int count) + { + _sslState.InnerStream.Write(buffer, offset, count); + return Task.CompletedTask; + } + } + } +} diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs index 7b11fb88f6..97160861ad 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.Diagnostics; using System.IO; using System.Runtime.ExceptionServices; @@ -13,31 +14,22 @@ namespace System.Net.Security // // This is a wrapping stream that does data encryption/decryption based on a successfully authenticated SSPI context. // - internal class SslStreamInternal + internal partial class SslStreamInternal { - private static readonly AsyncCallback s_writeCallback = new AsyncCallback(WriteCallback); - private static readonly AsyncProtocolCallback s_resumeAsyncWriteCallback = new AsyncProtocolCallback(ResumeAsyncWriteCallback); private static readonly AsyncProtocolCallback s_resumeAsyncReadCallback = new AsyncProtocolCallback(ResumeAsyncReadCallback); private static readonly AsyncProtocolCallback s_readHeaderCallback = new AsyncProtocolCallback(ReadHeaderCallback); private static readonly AsyncProtocolCallback s_readFrameCallback = new AsyncProtocolCallback(ReadFrameCallback); - private const int PinnableReadBufferSize = 4096 * 4 + 32; // We read in 16K chunks + headers. - private static PinnableBufferCache s_PinnableReadBufferCache = new PinnableBufferCache("System.Net.SslStream", PinnableReadBufferSize); - private const int PinnableWriteBufferSize = 4096 + 1024; // We write in 4K chunks + encryption overhead. - private static PinnableBufferCache s_PinnableWriteBufferCache = new PinnableBufferCache("System.Net.SslStream", PinnableWriteBufferSize); + private const int FrameOverhead = 32; + private const int ReadBufferSize = 4096 * 4 + FrameOverhead; // We read in 16K chunks + headers. - private SslState _sslState; + private readonly SslState _sslState; private int _nestedWrite; private int _nestedRead; private AsyncProtocolRequest _readProtocolRequest; // cached, reusable AsyncProtocolRequest used for read operations - private AsyncProtocolRequest _writeProtocolRequest; // cached, reusable AsyncProtocolRequest used for write operations // Never updated directly, special properties are used. This is the read buffer. private byte[] _internalBuffer; - private bool _internalBufferFromPinnableCache; - - private byte[] _pinnableOutputBuffer; // Used for writes when we can do it. - private byte[] _pinnableOutputBufferInUse; // Remembers what UNENCRYPTED buffer is using _PinnableOutputBuffer. private int _internalOffset; private int _internalBufferCount; @@ -47,48 +39,33 @@ namespace System.Net.Security internal SslStreamInternal(SslState sslState) { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage1("CTOR: In System.Net._SslStream.SslStream", this.GetHashCode()); - } - _sslState = sslState; _decryptedBytesOffset = 0; _decryptedBytesCount = 0; } - // If we have a read buffer from the pinnable cache, return it. - private void FreeReadBuffer() + //We will only free the read buffer if it + //actually contains no decrypted or encrypted bytes + private void ReturnReadBufferIfEmpty() { - if (_internalBufferFromPinnableCache) + if (_internalBuffer != null && _decryptedBytesCount == 0 && _internalBufferCount == 0) { - s_PinnableReadBufferCache.FreeBuffer(_internalBuffer); - _internalBufferFromPinnableCache = false; + ArrayPool.Shared.Return(_internalBuffer); + _internalBuffer = null; + _internalBufferCount = 0; + _internalOffset = 0; + _decryptedBytesCount = 0; + _decryptedBytesOffset = 0; } - - _internalBuffer = null; } ~SslStreamInternal() { - if (_internalBufferFromPinnableCache) + if (_internalBuffer != null) { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage2("DTOR: In System.Net._SslStream.~SslStream Freeing Read Buffer", this.GetHashCode(), PinnableBufferCacheEventSource.AddressOfByteArray(_internalBuffer)); - } - - FreeReadBuffer(); - } - if (_pinnableOutputBuffer != null) - { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage2("DTOR: In System.Net._SslStream.~SslStream Freeing Write Buffer", this.GetHashCode(), PinnableBufferCacheEventSource.AddressOfByteArray(_pinnableOutputBuffer)); - } - - s_PinnableWriteBufferCache.FreeBuffer(_pinnableOutputBuffer); + ArrayPool.Shared.Return(_internalBuffer); + _internalBuffer = null; } } @@ -104,8 +81,9 @@ namespace System.Net.Security { if (_decryptedBytesCount > 0) { - int b = InternalBuffer[_decryptedBytesOffset++]; + int b = _internalBuffer[_decryptedBytesOffset++]; _decryptedBytesCount--; + ReturnReadBufferIfEmpty(); return b; } } @@ -126,14 +104,14 @@ namespace System.Net.Security return bytesRead == 1 ? oneByte[0] : -1; } - internal int Read(byte[] buffer, int offset, int count) - { - return ProcessRead(buffer, offset, count, null); - } + internal int Read(byte[] buffer, int offset, int count) => ProcessRead(buffer, offset, count, null); internal void Write(byte[] buffer, int offset, int count) { - ProcessWrite(buffer, offset, count, null); + ValidateParameters(buffer, offset, count); + + SslWriteSync writeAdapter = new SslWriteSync(_sslState); + WriteAsyncInternal(writeAdapter, new ReadOnlyMemory(buffer, offset, count)).GetAwaiter().GetResult(); } internal IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) @@ -179,98 +157,40 @@ namespace System.Net.Security internal IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { - var lazyResult = new LazyAsyncResult(this, asyncState, asyncCallback); - ProcessWrite(buffer, offset, count, lazyResult); - return lazyResult; + return TaskToApm.Begin(WriteAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState); } - internal void EndWrite(IAsyncResult asyncResult) + internal void EndWrite(IAsyncResult asyncResult) => TaskToApm.End(asyncResult); + + internal Task WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken) { - if (asyncResult == null) - { - throw new ArgumentNullException(nameof(asyncResult)); - } - - LazyAsyncResult lazyResult = asyncResult as LazyAsyncResult; - if (lazyResult == null) - { - throw new ArgumentException(SR.Format(SR.net_io_async_result, asyncResult.GetType().FullName), nameof(asyncResult)); - } - - if (Interlocked.Exchange(ref _nestedWrite, 0) == 0) - { - throw new InvalidOperationException(SR.Format(SR.net_io_invalidendcall, "EndWrite")); - } - - // No "artificial" timeouts implemented so far, InnerStream controls timeout. - lazyResult.InternalWaitForCompletion(); - - if (lazyResult.Result is Exception e) - { - if (e is IOException) - { - ExceptionDispatchInfo.Throw(e); - } - - throw new IOException(SR.net_io_write, e); - } + SslWriteAsync writeAdapter = new SslWriteAsync(_sslState, cancellationToken); + return WriteAsyncInternal(writeAdapter, buffer); } - private byte[] InternalBuffer + internal Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { - get - { - return _internalBuffer; - } + ValidateParameters(buffer, offset, count); + return WriteAsync(new ReadOnlyMemory(buffer, offset, count), cancellationToken); } - private void EnsureInternalBufferSize(int newSize) + private void ResetReadBuffer() { - if (_internalBuffer == null || _internalBuffer.Length < newSize) + Debug.Assert(_decryptedBytesCount == 0); + Debug.Assert(_internalBuffer == null || _internalBufferCount > 0); + + if (_internalBuffer == null) { - bool wasPinnable = _internalBufferFromPinnableCache; - byte[] saved = _internalBuffer; - - if (newSize <= PinnableReadBufferSize) - { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage2("In System.Net._SslStream.EnsureInternalBufferSize IS pinnable", this.GetHashCode(), newSize); - } - - _internalBufferFromPinnableCache = true; - _internalBuffer = s_PinnableReadBufferCache.AllocateBuffer(); - } - else - { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage2("In System.Net._SslStream.EnsureInternalBufferSize NOT pinnable", this.GetHashCode(), newSize); - } - - _internalBufferFromPinnableCache = false; - _internalBuffer = new byte[newSize]; - } - - if (saved != null && _internalBufferCount != 0) - { - Buffer.BlockCopy(saved, _internalOffset, _internalBuffer, 0, _internalBufferCount); - } - - if (wasPinnable) - { - s_PinnableReadBufferCache.FreeBuffer(saved); - } + _internalBuffer = ArrayPool.Shared.Rent(ReadBufferSize); } - else if (_internalOffset > 0 && _internalBufferCount > 0) + else if (_internalOffset > 0) { // We have buffered data at a non-zero offset. // To maximize the buffer space available for the next read, // copy the existing data down to the beginning of the buffer. Buffer.BlockCopy(_internalBuffer, _internalOffset, _internalBuffer, 0, _internalBufferCount); + _internalOffset = 0; } - - _internalOffset = 0; } // @@ -320,164 +240,125 @@ namespace System.Net.Security return request; } - // - // Sync write method. - // - private void ProcessWrite(byte[] buffer, int offset, int count, LazyAsyncResult asyncResult) + private Task WriteAsyncInternal(TWriteAdapter writeAdapter, ReadOnlyMemory buffer) + where TWriteAdapter : struct, ISslWriteAdapter { - _sslState.CheckThrow(authSuccessCheck:true, shutdownCheck:true); - ValidateParameters(buffer, offset, count); + _sslState.CheckThrow(authSuccessCheck: true, shutdownCheck: true); + + if (buffer.Length == 0 && !SslStreamPal.CanEncryptEmptyMessage) + { + // If it's an empty message and the PAL doesn't support that, we're done. + return Task.CompletedTask; + } if (Interlocked.Exchange(ref _nestedWrite, 1) == 1) { - throw new NotSupportedException(SR.Format(SR.net_io_invalidnestedcall, "Write", "write")); + throw new NotSupportedException(SR.Format(SR.net_io_invalidnestedcall, nameof(WriteAsync), "write")); } - // If this is an async operation, get the AsyncProtocolRequest to use. - // We do this only after we verify we're the sole write operation in flight. - AsyncProtocolRequest asyncRequest = GetOrCreateProtocolRequest(ref _writeProtocolRequest, asyncResult); + Task t = buffer.Length < _sslState.MaxDataSize ? + WriteSingleChunk(writeAdapter, buffer) : + WriteAsyncChunked(writeAdapter, buffer); - bool failed = false; - - try + if (t.IsCompletedSuccessfully) { - StartWriting(buffer, offset, count, asyncRequest); + _nestedWrite = 0; + return t; } - catch (Exception e) - { - _sslState.FinishWrite(); + return ExitWriteAsync(t); - failed = true; - if (e is IOException) + async Task ExitWriteAsync(Task task) + { + try { - throw; + await task.ConfigureAwait(false); } + catch (Exception e) + { + _sslState.FinishWrite(); - throw new IOException(SR.net_io_write, e); - } - finally - { - if (asyncRequest == null || failed) + if (e is IOException) + { + throw; + } + + throw new IOException(SR.net_io_write, e); + } + finally { _nestedWrite = 0; } } } - private void StartWriting(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest) + private Task WriteSingleChunk(TWriteAdapter writeAdapter, ReadOnlyMemory buffer) + where TWriteAdapter : struct, ISslWriteAdapter { - if (asyncRequest != null) + // Request a write IO slot. + Task ioSlot = writeAdapter.LockAsync(); + if (!ioSlot.IsCompletedSuccessfully) { - asyncRequest.SetNextRequest(buffer, offset, count, s_resumeAsyncWriteCallback); + // Operation is async and has been queued, return. + return WaitForWriteIOSlot(writeAdapter, ioSlot, buffer); } - // We loop to this method from the callback. - // If the last chunk was just completed from async callback (count < 0), we complete user request. - if (count >= 0 ) + byte[] rentedBuffer = ArrayPool.Shared.Rent(buffer.Length + FrameOverhead); + byte[] outBuffer = rentedBuffer; + + SecurityStatusPal status = _sslState.EncryptData(buffer, ref outBuffer, out int encryptedBytes); + + if (status.ErrorCode != SecurityStatusPalErrorCode.OK) { - byte[] outBuffer = null; - if (_pinnableOutputBufferInUse == null) - { - if (_pinnableOutputBuffer == null) - { - _pinnableOutputBuffer = s_PinnableWriteBufferCache.AllocateBuffer(); - } + // Re-handshake status is not supported. + ArrayPool.Shared.Return(rentedBuffer); + ProtocolToken message = new ProtocolToken(null, status); + return Task.FromException(new IOException(SR.net_io_encrypt, message.GetException())); + } - _pinnableOutputBufferInUse = buffer; - outBuffer = _pinnableOutputBuffer; - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage3("In System.Net._SslStream.StartWriting Trying Pinnable", this.GetHashCode(), count, PinnableBufferCacheEventSource.AddressOfByteArray(outBuffer)); - } + Task t = writeAdapter.WriteAsync(outBuffer, 0, encryptedBytes); + if (t.IsCompletedSuccessfully) + { + ArrayPool.Shared.Return(rentedBuffer); + _sslState.FinishWrite(); + return t; + } + else + { + return CompleteAsync(t, rentedBuffer); + } + + async Task WaitForWriteIOSlot(TWriteAdapter wAdapter, Task lockTask, ReadOnlyMemory buff) + { + await lockTask.ConfigureAwait(false); + await WriteSingleChunk(wAdapter, buff).ConfigureAwait(false); + } + + async Task CompleteAsync(Task writeTask, byte[] bufferToReturn) + { + try + { + await writeTask.ConfigureAwait(false); } - else + finally { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage2("In System.Net._SslStream.StartWriting BufferInUse", this.GetHashCode(), count); - } - } - - do - { - if (count == 0 && !SslStreamPal.CanEncryptEmptyMessage) - { - // If it's an empty message and the PAL doesn't support that, - // we're done. - break; - } - - // Request a write IO slot. - if (_sslState.CheckEnqueueWrite(asyncRequest)) - { - // Operation is async and has been queued, return. - return; - } - - int chunkBytes = Math.Min(count, _sslState.MaxDataSize); - int encryptedBytes; - SecurityStatusPal status = _sslState.EncryptData(buffer, offset, chunkBytes, ref outBuffer, out encryptedBytes); - if (status.ErrorCode != SecurityStatusPalErrorCode.OK) - { - // Re-handshake status is not supported. - ProtocolToken message = new ProtocolToken(null, status); - throw new IOException(SR.net_io_encrypt, message.GetException()); - } - - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage3("In System.Net._SslStream.StartWriting Got Encrypted Buffer", - this.GetHashCode(), encryptedBytes, PinnableBufferCacheEventSource.AddressOfByteArray(outBuffer)); - } - - if (asyncRequest != null) - { - // Prepare for the next request. - asyncRequest.SetNextRequest(buffer, offset + chunkBytes, count - chunkBytes, s_resumeAsyncWriteCallback); - Task t = _sslState.InnerStream.WriteAsync(outBuffer, 0, encryptedBytes); - if (t.IsCompleted) - { - t.GetAwaiter().GetResult(); - } - else - { - IAsyncResult ar = TaskToApm.Begin(t, s_writeCallback, asyncRequest); - if (!ar.CompletedSynchronously) - { - return; - } - TaskToApm.End(ar); - } - } - else - { - _sslState.InnerStream.Write(outBuffer, 0, encryptedBytes); - } - - offset += chunkBytes; - count -= chunkBytes; - - // Release write IO slot. + ArrayPool.Shared.Return(bufferToReturn); _sslState.FinishWrite(); - - } while (count != 0); - } - - if (asyncRequest != null) - { - asyncRequest.CompleteUser(); - } - - if (buffer == _pinnableOutputBufferInUse) - { - _pinnableOutputBufferInUse = null; - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.DebugMessage1("In System.Net._SslStream.StartWriting Freeing buffer.", this.GetHashCode()); } } } + private async Task WriteAsyncChunked(TWriteAdapter writeAdapter, ReadOnlyMemory buffer) + where TWriteAdapter : struct, ISslWriteAdapter + { + do + { + int chunkBytes = Math.Min(buffer.Length, _sslState.MaxDataSize); + await WriteSingleChunk(writeAdapter, buffer.Slice(0, chunkBytes)).ConfigureAwait(false); + buffer = buffer.Slice(chunkBytes); + + } while (buffer.Length != 0); + } + // Fill the buffer up to the minimum specified size (or more, if possible). // Returns 0 if EOF on initial read, otherwise throws on EOF. // Returns minSize on success. @@ -489,7 +370,7 @@ namespace System.Net.Security int initialCount = _internalBufferCount; do { - int bytes = _sslState.InnerStream.Read(InternalBuffer, _internalBufferCount, InternalBuffer.Length - _internalBufferCount); + int bytes = _sslState.InnerStream.Read(_internalBuffer, _internalBufferCount, _internalBuffer.Length - _internalBufferCount); if (bytes == 0) { if (_internalBufferCount != initialCount) @@ -518,7 +399,7 @@ namespace System.Net.Security int initialCount = _internalBufferCount; do { - int bytes = await _sslState.InnerStream.ReadAsync(InternalBuffer, _internalBufferCount, InternalBuffer.Length - _internalBufferCount, CancellationToken.None).ConfigureAwait(false); + int bytes = await _sslState.InnerStream.ReadAsync(_internalBuffer, _internalBufferCount, _internalBuffer.Length - _internalBufferCount, CancellationToken.None).ConfigureAwait(false); if (bytes == 0) { if (_internalBufferCount != initialCount) @@ -589,8 +470,6 @@ namespace System.Net.Security return minSize; } - EnsureInternalBufferSize(minSize); - int bytesRead; if (asyncRequest != null) { @@ -620,11 +499,7 @@ namespace System.Net.Security _internalOffset += byteCount; _internalBufferCount -= byteCount; - if (_internalBufferCount == 0) - { - // No remaining buffered bytes, so reset the offset to the beginning for the next read. - _internalOffset = 0; - } + ReturnReadBufferIfEmpty(); } private int CopyDecryptedData(byte[] buffer, int offset, int count) @@ -634,12 +509,12 @@ namespace System.Net.Security int copyBytes = _decryptedBytesCount > count ? count : _decryptedBytesCount; if (copyBytes != 0) { - Buffer.BlockCopy(InternalBuffer, _decryptedBytesOffset, buffer, offset, copyBytes); + Buffer.BlockCopy(_internalBuffer, _decryptedBytesOffset, buffer, offset, copyBytes); _decryptedBytesOffset += copyBytes; _decryptedBytesCount -= copyBytes; } - + ReturnReadBufferIfEmpty(); return copyBytes; } @@ -652,7 +527,7 @@ namespace System.Net.Security if (Interlocked.Exchange(ref _nestedRead, 1) == 1) { - throw new NotSupportedException(SR.Format(SR.net_io_invalidnestedcall, (asyncResult!=null? "BeginRead":"Read"), "read")); + throw new NotSupportedException(SR.Format(SR.net_io_invalidnestedcall, (asyncResult != null ? "BeginRead" : "Read"), "read")); } // If this is an async operation, get the AsyncProtocolRequest to use. @@ -666,9 +541,9 @@ namespace System.Net.Security if (_decryptedBytesCount != 0) { int copyBytes = CopyDecryptedData(buffer, offset, count); - + asyncRequest?.CompleteUser(copyBytes); - + return copyBytes; } @@ -737,13 +612,14 @@ namespace System.Net.Security private int StartFrameHeader(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest) { + ResetReadBuffer(); int readBytes = EnsureBufferedBytes(SecureChannel.ReadHeaderSize, asyncRequest, s_readHeaderCallback); if (readBytes == -1) { Debug.Assert(asyncRequest != null); return 0; } - + return StartFrameBody(readBytes, buffer, offset, count, asyncRequest); } @@ -758,7 +634,7 @@ namespace System.Net.Security Debug.Assert(readBytes == SecureChannel.ReadHeaderSize); - int payloadBytes = _sslState.GetRemainingFrameSize(InternalBuffer, _internalOffset, readBytes); + int payloadBytes = _sslState.GetRemainingFrameSize(_internalBuffer, _internalOffset, readBytes); if (payloadBytes < 0) { throw new IOException(SR.net_frame_read_size); @@ -772,7 +648,7 @@ namespace System.Net.Security } Debug.Assert(readBytes == 0 || readBytes == SecureChannel.ReadHeaderSize + payloadBytes); - + return ProcessFrameBody(readBytes, buffer, offset, count, asyncRequest); } @@ -792,7 +668,7 @@ namespace System.Net.Security // DecryptData will decrypt in-place and modify these to point to the actual decrypted data, which may be smaller. _decryptedBytesOffset = _internalOffset; _decryptedBytesCount = readBytes; - SecurityStatusPal status = _sslState.DecryptData(InternalBuffer, ref _decryptedBytesOffset, ref _decryptedBytesCount); + SecurityStatusPal status = _sslState.DecryptData(_internalBuffer, ref _decryptedBytesOffset, ref _decryptedBytesCount); // Treat the bytes we just decrypted as consumed // Note, we won't do another buffer read until the decrypted bytes are processed @@ -804,7 +680,7 @@ namespace System.Net.Security if (_decryptedBytesCount != 0) { extraBuffer = new byte[_decryptedBytesCount]; - Buffer.BlockCopy(InternalBuffer, _decryptedBytesOffset, extraBuffer, 0, _decryptedBytesCount); + Buffer.BlockCopy(_internalBuffer, _decryptedBytesOffset, extraBuffer, 0, _decryptedBytesCount); _decryptedBytesCount = 0; } @@ -829,7 +705,8 @@ namespace System.Net.Security private int ProcessReadErrorCode(SecurityStatusPal status, AsyncProtocolRequest asyncRequest, byte[] extraBuffer) { ProtocolToken message = new ProtocolToken(null, status); - if (NetEventSource.IsEnabled) NetEventSource.Info(null, $"***Processing an error Status = {message.Status}"); + if (NetEventSource.IsEnabled) + NetEventSource.Info(null, $"***Processing an error Status = {message.Status}"); if (message.Renegotiate) { @@ -850,48 +727,6 @@ namespace System.Net.Security throw new IOException(SR.net_io_decrypt, message.GetException()); } - private static void WriteCallback(IAsyncResult transportResult) - { - if (transportResult.CompletedSynchronously) - { - return; - } - - if (!(transportResult.AsyncState is AsyncProtocolRequest)) - { - NetEventSource.Fail(transportResult, "State type is wrong, expected AsyncProtocolRequest."); - } - - AsyncProtocolRequest asyncRequest = (AsyncProtocolRequest)transportResult.AsyncState; - - var sslStream = (SslStreamInternal)asyncRequest.AsyncObject; - - try - { - TaskToApm.End(transportResult); - sslStream._sslState.FinishWrite(); - - if (asyncRequest.Count == 0) - { - // This was the last chunk. - asyncRequest.Count = -1; - } - - sslStream.StartWriting(asyncRequest.Buffer, asyncRequest.Offset, asyncRequest.Count, asyncRequest); - } - catch (Exception e) - { - if (asyncRequest.IsUserCompleted) - { - // This will throw on a worker thread. - throw; - } - - sslStream._sslState.FinishWrite(); - asyncRequest.CompleteUserWithError(e); - } - } - // // This is used in a rare situation when async Read is resumed from completed handshake. // @@ -914,28 +749,6 @@ namespace System.Net.Security } } - // - // This is used in a rare situation when async Write is resumed from completed handshake. - // - private static void ResumeAsyncWriteCallback(AsyncProtocolRequest asyncRequest) - { - try - { - ((SslStreamInternal)asyncRequest.AsyncObject).StartWriting(asyncRequest.Buffer, asyncRequest.Offset, asyncRequest.Count, asyncRequest); - } - catch (Exception e) - { - if (asyncRequest.IsUserCompleted) - { - // This will throw on a worker thread. - throw; - } - - ((SslStreamInternal)asyncRequest.AsyncObject)._sslState.FinishWrite(); - asyncRequest.CompleteUserWithError(e); - } - } - private static void ReadHeaderCallback(AsyncProtocolRequest asyncRequest) { try diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs index f32cc26b35..b426ebe466 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs @@ -2,14 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.ComponentModel; using System.Diagnostics; using System.Security.Authentication; using System.Security.Authentication.ExtendedProtection; using System.Security.Cryptography.X509Certificates; -using PAL_TlsHandshakeState=Interop.AppleCrypto.PAL_TlsHandshakeState; -using PAL_TlsIo=Interop.AppleCrypto.PAL_TlsIo; +using PAL_TlsHandshakeState = Interop.AppleCrypto.PAL_TlsHandshakeState; +using PAL_TlsIo = Interop.AppleCrypto.PAL_TlsIo; namespace System.Net.Security { @@ -76,9 +77,7 @@ namespace System.Net.Security public static SecurityStatusPal EncryptMessage( SafeDeleteContext securityContext, - byte[] input, - int offset, - int size, + ReadOnlyMemory input, int headerSize, int trailerSize, ref byte[] output, @@ -86,7 +85,7 @@ namespace System.Net.Security { resultSize = 0; - Debug.Assert(size > 0, $"{nameof(size)} > 0 since {nameof(CanEncryptEmptyMessage)} is false"); + Debug.Assert(input.Length > 0, $"{nameof(input.Length)} > 0 since {nameof(CanEncryptEmptyMessage)} is false"); try { @@ -95,10 +94,10 @@ namespace System.Net.Security unsafe { - fixed (byte* offsetInput = &input[offset]) + MemoryHandle memHandle = input.Retain(pin: true); + try { - int written; - PAL_TlsIo status = Interop.AppleCrypto.SslWrite(sslHandle, offsetInput, size, out written); + PAL_TlsIo status = Interop.AppleCrypto.SslWrite(sslHandle, (byte*)memHandle.PinnedPointer, input.Length, out int written); if (status < 0) { @@ -128,6 +127,10 @@ namespace System.Net.Security return new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError); } } + finally + { + memHandle.Dispose(); + } } } catch (Exception e) diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs index a0a4d65781..6eb1b6296e 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs @@ -36,12 +36,12 @@ namespace System.Net.Security public static SecurityStatusPal InitializeSecurityContext(ref SafeFreeCredentials credential, ref SafeDeleteContext context, string targetName, SecurityBuffer inputBuffer, SecurityBuffer outputBuffer) - { + { return HandshakeInternal(credential, ref context, inputBuffer, outputBuffer, false, false); } public static SecurityStatusPal InitializeSecurityContext(SafeFreeCredentials credential, ref SafeDeleteContext context, string targetName, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer) - { + { Debug.Assert(inputBuffers.Length == 2); Debug.Assert(inputBuffers[1].token == null); return HandshakeInternal(credential, ref context, inputBuffers[0], outputBuffer, false, false); @@ -53,16 +53,15 @@ namespace System.Net.Security return new SafeFreeSslCredentials(certificate, protocols, policy); } - public static SecurityStatusPal EncryptMessage(SafeDeleteContext securityContext, byte[] input, int offset, int size, int headerSize, int trailerSize, ref byte[] output, out int resultSize) + public static SecurityStatusPal EncryptMessage(SafeDeleteContext securityContext, ReadOnlyMemory input, int headerSize, int trailerSize, ref byte[] output, out int resultSize) { - return EncryptDecryptHelper(securityContext, input, offset, size, true, ref output, out resultSize); + return EncryptDecryptHelper(securityContext, input, offset:0, size: 0, encrypt: true, output: ref output, resultSize: out resultSize); } public static SecurityStatusPal DecryptMessage(SafeDeleteContext securityContext, byte[] buffer, ref int offset, ref int count) { - int resultSize; - SecurityStatusPal retVal = EncryptDecryptHelper(securityContext, buffer, offset, count, false, ref buffer, out resultSize); - if (retVal.ErrorCode == SecurityStatusPalErrorCode.OK || + SecurityStatusPal retVal = EncryptDecryptHelper(securityContext, buffer, offset, count, false, ref buffer, out int resultSize); + if (retVal.ErrorCode == SecurityStatusPalErrorCode.OK || retVal.ErrorCode == SecurityStatusPalErrorCode.Renegotiate) { count = resultSize; @@ -136,11 +135,11 @@ namespace System.Net.Security } catch (Exception exc) { - return new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError, exc); + return new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError, exc); } } - private static SecurityStatusPal EncryptDecryptHelper(SafeDeleteContext securityContext, byte[] input, int offset, int size, bool encrypt, ref byte[] output, out int resultSize) + private static SecurityStatusPal EncryptDecryptHelper(SafeDeleteContext securityContext, ReadOnlyMemory input, int offset, int size, bool encrypt, ref byte[] output, out int resultSize) { resultSize = 0; try @@ -150,12 +149,11 @@ namespace System.Net.Security if (encrypt) { - resultSize = Interop.OpenSsl.Encrypt(scHandle, input, offset, size, ref output, out errorCode); + resultSize = Interop.OpenSsl.Encrypt(scHandle, input, ref output, out errorCode); } else { - Debug.Assert(ReferenceEquals(input, output), "Expected input==output when decrypting"); - resultSize = Interop.OpenSsl.Decrypt(scHandle, input, offset, size, out errorCode); + resultSize = Interop.OpenSsl.Decrypt(scHandle, output, offset, size, out errorCode); } switch (errorCode) diff --git a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs index 9429ca4cd1..54e91d66e8 100644 --- a/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs +++ b/external/corefx/src/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs @@ -131,13 +131,13 @@ namespace System.Net.Security return AcquireCredentialsHandle(direction, secureCredential); } - public static unsafe SecurityStatusPal EncryptMessage(SafeDeleteContext securityContext, byte[] input, int offset, int size, int headerSize, int trailerSize, ref byte[] output, out int resultSize) + public static unsafe SecurityStatusPal EncryptMessage(SafeDeleteContext securityContext, ReadOnlyMemory input, int headerSize, int trailerSize, ref byte[] output, out int resultSize) { // Ensure that there is sufficient space for the message output. int bufferSizeNeeded; try { - bufferSizeNeeded = checked(size + headerSize + trailerSize); + bufferSizeNeeded = checked(input.Length + headerSize + trailerSize); } catch { @@ -150,8 +150,8 @@ namespace System.Net.Security } // Copy the input into the output buffer to prepare for SCHANNEL's expectations - Buffer.BlockCopy(input, offset, output, headerSize, size); - + input.Span.CopyTo(new Span(output, headerSize, input.Length)); + const int NumSecBuffers = 4; // header + data + trailer + empty var unmanagedBuffer = stackalloc Interop.SspiCli.SecBuffer[NumSecBuffers]; var sdcInOut = new Interop.SspiCli.SecBufferDesc(NumSecBuffers); @@ -166,11 +166,11 @@ namespace System.Net.Security Interop.SspiCli.SecBuffer* dataSecBuffer = &unmanagedBuffer[1]; dataSecBuffer->BufferType = SecurityBufferType.SECBUFFER_DATA; dataSecBuffer->pvBuffer = (IntPtr)(outputPtr + headerSize); - dataSecBuffer->cbBuffer = size; + dataSecBuffer->cbBuffer = input.Length; Interop.SspiCli.SecBuffer* trailerSecBuffer = &unmanagedBuffer[2]; trailerSecBuffer->BufferType = SecurityBufferType.SECBUFFER_STREAM_TRAILER; - trailerSecBuffer->pvBuffer = (IntPtr)(outputPtr + headerSize + size); + trailerSecBuffer->pvBuffer = (IntPtr)(outputPtr + headerSize + input.Length); trailerSecBuffer->cbBuffer = trailerSize; Interop.SspiCli.SecBuffer* emptySecBuffer = &unmanagedBuffer[3]; diff --git a/external/corefx/src/System.Net.Security/src/System/PinnableBufferCache.cs b/external/corefx/src/System.Net.Security/src/System/PinnableBufferCache.cs deleted file mode 100644 index 7e58893350..0000000000 --- a/external/corefx/src/System.Net.Security/src/System/PinnableBufferCache.cs +++ /dev/null @@ -1,589 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics.Tracing; -using System.Runtime.InteropServices; -using System.Threading; - -namespace System -{ - internal sealed class PinnableBufferCache - { - /// - /// Create a new cache for pinned byte[] buffers. - /// - /// A name used in diagnostic messages - /// The size of byte[] buffers in the cache (they are all the same size) - public PinnableBufferCache(string cacheName, int numberOfElements) : this(cacheName, () => new byte[numberOfElements]) { } - - /// - /// Get a buffer from the buffer manager. If no buffers exist, allocate a new one. - /// - public byte[] AllocateBuffer() { return (byte[])Allocate(); } - - /// - /// Return a buffer back to the buffer manager. - /// - public void FreeBuffer(byte[] buffer) { Free(buffer); } - - /// - /// Create a PinnableBufferCache that works on any object (it is intended for OverlappedData) - /// - internal PinnableBufferCache(string cacheName, Func factory) - { - _notGen2 = new List(DefaultNumberOfBuffers); - _factory = factory; - - PinnableBufferCacheEventSource.Log.Create(cacheName); - _cacheName = cacheName; - } - - /// - /// Get a object from the buffer manager. If no buffers exist, allocate a new one. - /// - [System.Security.SecuritySafeCritical] - internal object Allocate() - { - // Fast path, get it from our Gen2 aged _freeList. - object returnBuffer; - if (!_freeList.TryPop(out returnBuffer)) - { - Restock(out returnBuffer); - } - - // Computing free count is expensive enough that we don't want to compute it unless logging is on. - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - int numAllocCalls = Interlocked.Increment(ref _numAllocCalls); - if (numAllocCalls >= 1024) - { - lock (this) - { - int previousNumAllocCalls = Interlocked.Exchange(ref _numAllocCalls, 0); - if (previousNumAllocCalls >= 1024) - { - int nonGen2Count = 0; - foreach (object o in _freeList) - { - if (GC.GetGeneration(o) < GC.MaxGeneration) - { - nonGen2Count++; - } - } - - PinnableBufferCacheEventSource.Log.WalkFreeListResult(_cacheName, _freeList.Count, nonGen2Count); - } - } - } - - PinnableBufferCacheEventSource.Log.AllocateBuffer(_cacheName, PinnableBufferCacheEventSource.AddressOf(returnBuffer), returnBuffer.GetHashCode(), GC.GetGeneration(returnBuffer), _freeList.Count); - } - return returnBuffer; - } - - /// - /// Return a buffer back to the buffer manager. - /// - [System.Security.SecuritySafeCritical] - internal void Free(object buffer) - { - if (PinnableBufferCacheEventSource.Log.IsEnabled()) - { - PinnableBufferCacheEventSource.Log.FreeBuffer(_cacheName, PinnableBufferCacheEventSource.AddressOf(buffer), buffer.GetHashCode(), _freeList.Count); - } - - - // After we've done 3 gen1 GCs, assume that all buffers have aged into gen2 on the free path. - if ((_gen1CountAtLastRestock + 3) > GC.CollectionCount(GC.MaxGeneration - 1)) - { - lock (this) - { - if (GC.GetGeneration(buffer) < GC.MaxGeneration) - { - // The buffer is not aged, so put it in the non-aged free list. - _moreThanFreeListNeeded = true; - PinnableBufferCacheEventSource.Log.FreeBufferStillTooYoung(_cacheName, _notGen2.Count); - _notGen2.Add(buffer); - _gen1CountAtLastRestock = GC.CollectionCount(GC.MaxGeneration - 1); - return; - } - } - } - - // If we discovered that it is indeed Gen2, great, put it in the Gen2 list. - _freeList.Push(buffer); - } - - #region Private - - /// - /// Called when we don't have any buffers in our free list to give out. - /// - /// - [System.Security.SecuritySafeCritical] - private void Restock(out object returnBuffer) - { - lock (this) - { - // Try again after getting the lock as another thread could have just filled the free list. If we don't check - // then we unnecessarily grab a new set of buffers because we think we are out. - if (_freeList.TryPop(out returnBuffer)) - { - return; - } - - // Lazy init, Ask that TrimFreeListIfNeeded be called on every Gen 2 GC. - if (_restockSize == 0) - { - Gen2GcCallback.Register(Gen2GcCallbackFunc, this); - } - - // Indicate to the trimming policy that the free list is insufficient. - _moreThanFreeListNeeded = true; - PinnableBufferCacheEventSource.Log.AllocateBufferFreeListEmpty(_cacheName, _notGen2.Count); - - // Get more buffers if needed. - if (_notGen2.Count == 0) - { - CreateNewBuffers(); - } - - // We have no buffers in the aged freelist, so get one from the newer list. Try to pick the best one. - int idx = _notGen2.Count - 1; - if (GC.GetGeneration(_notGen2[idx]) < GC.MaxGeneration && GC.GetGeneration(_notGen2[0]) == GC.MaxGeneration) - { - idx = 0; - } - - returnBuffer = _notGen2[idx]; - _notGen2.RemoveAt(idx); - - // Remember any sub-optimal buffer so we don't put it on the free list when it gets freed. - if (PinnableBufferCacheEventSource.Log.IsEnabled() && GC.GetGeneration(returnBuffer) < GC.MaxGeneration) - { - PinnableBufferCacheEventSource.Log.AllocateBufferFromNotGen2(_cacheName, _notGen2.Count); - } - - // If we have a Gen1 collection, then everything on _notGen2 should have aged. Move them to the _freeList. - if (!AgePendingBuffers()) - { - // Before we could age at set of buffers, we have handed out half of them. - // This implies we should be proactive about allocating more (since we will trim them if we over-allocate). - if (_notGen2.Count == _restockSize / 2) - { - PinnableBufferCacheEventSource.Log.DebugMessage("Proactively adding more buffers to aging pool"); - CreateNewBuffers(); - } - } - } - } - - /// - /// See if we can promote the buffers to the free list. Returns true if successful. - /// - [System.Security.SecuritySafeCritical] - private bool AgePendingBuffers() - { - if (_gen1CountAtLastRestock < GC.CollectionCount(GC.MaxGeneration - 1)) - { - // Allocate a temp list of buffers that are not actually in gen2, and swap it in once - // we're done scanning all buffers. - int promotedCount = 0; - List notInGen2 = new List(); - PinnableBufferCacheEventSource.Log.AllocateBufferAged(_cacheName, _notGen2.Count); - for (int i = 0; i < _notGen2.Count; i++) - { - // We actually check every object to ensure that we aren't putting non-aged buffers into the free list. - object currentBuffer = _notGen2[i]; - if (GC.GetGeneration(currentBuffer) >= GC.MaxGeneration) - { - _freeList.Push(currentBuffer); - promotedCount++; - } - else - { - notInGen2.Add(currentBuffer); - } - } - PinnableBufferCacheEventSource.Log.AgePendingBuffersResults(_cacheName, promotedCount, notInGen2.Count); - _notGen2 = notInGen2; - - return true; - } - return false; - } - - /// - /// Generates some buffers to age into Gen2. - /// - private void CreateNewBuffers() - { - // We choose a very modest number of buffers initially because for the client case. This is often enough. - if (_restockSize == 0) - { - _restockSize = 4; - } - else if (_restockSize < DefaultNumberOfBuffers) - { - _restockSize = DefaultNumberOfBuffers; - } - else if (_restockSize < 256) - { - _restockSize = _restockSize * 2; // Grow quickly at small sizes - } - else if (_restockSize < 4096) - { - _restockSize = _restockSize * 3 / 2; // Less aggressively at large ones - } - else - { - _restockSize = 4096; // Cap how aggressive we are - } - - // Ensure we hit our minimums - if (_minBufferCount > _buffersUnderManagement) - _restockSize = Math.Max(_restockSize, _minBufferCount - _buffersUnderManagement); - - PinnableBufferCacheEventSource.Log.AllocateBufferCreatingNewBuffers(_cacheName, _buffersUnderManagement, _restockSize); - for (int i = 0; i < _restockSize; i++) - { - // Make a new buffer. - object newBuffer = _factory(); - - // Create space between the objects. We do this because otherwise it forms a single plug (group of objects) - // and the GC pins the entire plug making them NOT move to Gen1 and Gen2. by putting space between them - // we ensure that object get a chance to move independently (even if some are pinned). - var dummyObject = new object(); - _notGen2.Add(newBuffer); - } - _buffersUnderManagement += _restockSize; - _gen1CountAtLastRestock = GC.CollectionCount(GC.MaxGeneration - 1); - } - - /// - /// This is the static function that is called from the gen2 GC callback. - /// The input object is the cache itself. - /// NOTE: The reason that we make this function static and take the cache as a parameter is that - /// otherwise, we root the cache to the Gen2GcCallback object, and leak the cache even when - /// the application no longer needs it. - /// - [System.Security.SecuritySafeCritical] - private static bool Gen2GcCallbackFunc(object targetObj) - { - return ((PinnableBufferCache)(targetObj)).TrimFreeListIfNeeded(); - } - - /// - /// This is called on every gen2 GC to see if we need to trim the free list. - /// NOTE: DO NOT CALL THIS DIRECTLY FROM THE GEN2GCCALLBACK. INSTEAD CALL IT VIA A STATIC FUNCTION (SEE ABOVE). - /// If you register a non-static function as a callback, then this object will be leaked. - /// - [System.Security.SecuritySafeCritical] - private bool TrimFreeListIfNeeded() - { - int curMSec = Environment.TickCount; - int deltaMSec = curMSec - _msecNoUseBeyondFreeListSinceThisTime; - PinnableBufferCacheEventSource.Log.TrimCheck(_cacheName, _buffersUnderManagement, _moreThanFreeListNeeded, deltaMSec); - - // If we needed more than just the set of aged buffers since the last time we were called, - // we obviously should not be trimming any memory, so do nothing except reset the flag - if (_moreThanFreeListNeeded) - { - _moreThanFreeListNeeded = false; - _trimmingExperimentInProgress = false; - _msecNoUseBeyondFreeListSinceThisTime = curMSec; - return true; - } - - // We require a minimum amount of clock time to pass (10 seconds) before we trim. Ideally this time - // is larger than the typical buffer hold time. - if (0 <= deltaMSec && deltaMSec < 10000) - { - return true; - } - - // If we got here we have spend the last few second without needing to lengthen the free list. Thus - // we have 'enough' buffers, but maybe we have too many. - // See if we can trim - lock (this) - { - // Hit a race, try again later. - if (_moreThanFreeListNeeded) - { - _moreThanFreeListNeeded = false; - _trimmingExperimentInProgress = false; - _msecNoUseBeyondFreeListSinceThisTime = curMSec; - return true; - } - - var freeCount = _freeList.Count; // This is expensive to fetch, do it once. - - // If there is something in _notGen2 it was not used for the last few seconds, it is trim-able. - if (_notGen2.Count > 0) - { - // If we are not performing an experiment and we have stuff that is waiting to go into the - // free list but has not made it there, it could be because the 'slow path' of restocking - // has not happened, so force this (which should flush the list) and start over. - if (!_trimmingExperimentInProgress) - { - PinnableBufferCacheEventSource.Log.TrimFlush(_cacheName, _buffersUnderManagement, freeCount, _notGen2.Count); - AgePendingBuffers(); - _trimmingExperimentInProgress = true; - return true; - } - - PinnableBufferCacheEventSource.Log.TrimFree(_cacheName, _buffersUnderManagement, freeCount, _notGen2.Count); - _buffersUnderManagement -= _notGen2.Count; - - // Possibly revise the restocking down. We don't want to grow aggressively if we are trimming. - var newRestockSize = _buffersUnderManagement / 4; - if (newRestockSize < _restockSize) - { - _restockSize = Math.Max(newRestockSize, DefaultNumberOfBuffers); - } - - _notGen2.Clear(); - _trimmingExperimentInProgress = false; - return true; - } - - // Set up an experiment where we use 25% less buffers in our free list. We put them in - // _notGen2, and if they are needed they will be put back in the free list again. - var trimSize = freeCount / 4 + 1; - - // We are OK with a 15% overhead, do nothing in that case. - if (freeCount * 15 <= _buffersUnderManagement || _buffersUnderManagement - trimSize <= _minBufferCount) - { - PinnableBufferCacheEventSource.Log.TrimFreeSizeOK(_cacheName, _buffersUnderManagement, freeCount); - return true; - } - - // Move buffers from the free list back to the non-aged list. If we don't use them by next time, then we'll consider trimming them. - PinnableBufferCacheEventSource.Log.TrimExperiment(_cacheName, _buffersUnderManagement, freeCount, trimSize); - object buffer; - for (int i = 0; i < trimSize; i++) - { - if (_freeList.TryPop(out buffer)) - { - _notGen2.Add(buffer); - } - } - _msecNoUseBeyondFreeListSinceThisTime = curMSec; - _trimmingExperimentInProgress = true; - } - - // Indicate that we want to be called back on the next Gen 2 GC. - return true; - } - - private const int DefaultNumberOfBuffers = 16; - private string _cacheName; - private Func _factory; - - /// - /// Contains 'good' buffers to reuse. They are guaranteed to be Gen 2 ENFORCED! - /// - private ConcurrentStack _freeList = new ConcurrentStack(); - /// - /// Contains buffers that are not gen 2 and thus we do not wish to give out unless we have to. - /// To implement trimming we sometimes put aged buffers in here as a place to 'park' them - /// before true deletion. - /// - private List _notGen2; - /// - /// What was the gen 1 count the last time re restocked? If it is now greater, then - /// we know that all objects are in Gen 2 so we don't have to check. Should be updated - /// every time something gets added to the _notGen2 list. - /// - private int _gen1CountAtLastRestock; - - /// - /// Used to ensure we have a minimum time between trimmings. - /// - private int _msecNoUseBeyondFreeListSinceThisTime; - /// - /// To trim, we remove things from the free list (which is Gen 2) and see if we 'hit bottom' - /// This flag indicates that we hit bottom (we really needed a bigger free list). - /// - private bool _moreThanFreeListNeeded; - /// - /// The total number of buffers that this cache has ever allocated. - /// Used in trimming heuristics. - /// - private int _buffersUnderManagement; - /// - /// The number of buffers we added the last time we restocked. - /// - private int _restockSize; - /// - /// Did we put some buffers into _notGen2 to see if we can trim? - /// - private bool _trimmingExperimentInProgress; - /// - /// A forced minimum number of buffers. - /// - private int _minBufferCount = 0; - /// - /// The number of calls to Allocate. - /// - private int _numAllocCalls; - #endregion - } - - /// - /// Schedules a callback roughly every gen 2 GC (you may see a Gen 0 an Gen 1 but only once) - /// (We can fix this by capturing the Gen 2 count at startup and testing, but I mostly don't care) - /// - internal sealed class Gen2GcCallback //: CriticalFinalizerObject - { - [System.Security.SecuritySafeCritical] - public Gen2GcCallback() - : base() - { - } - - /// - /// Schedule 'callback' to be called in the next GC. If the callback returns true it is - /// rescheduled for the next Gen 2 GC. Otherwise the callbacks stop. - /// - /// NOTE: This callback will be kept alive until either the callback function returns false, - /// or the target object dies. - /// - public static void Register(Func callback, object targetObj) - { - // Create a unreachable object that remembers the callback function and target object. - Gen2GcCallback gcCallback = new Gen2GcCallback(); - gcCallback.Setup(callback, targetObj); - } - - #region Private - - private Func _callback; - private GCHandle _weakTargetObj; - - [System.Security.SecuritySafeCritical] - private void Setup(Func callback, object targetObj) - { - _callback = callback; - _weakTargetObj = GCHandle.Alloc(targetObj, GCHandleType.Weak); - } - - [System.Security.SecuritySafeCritical] - ~Gen2GcCallback() - { - // Check to see if the target object is still alive. - object targetObj = _weakTargetObj.Target; - if (targetObj == null) - { - // The target object is dead, so this callback object is no longer needed. - _weakTargetObj.Free(); - return; - } - - // Execute the callback method. - try - { - if (!_callback(targetObj)) - { - // If the callback returns false, this callback object is no longer needed. - return; - } - } - catch - { - // Ensure that we still get a chance to resurrect this object, even if the callback throws an exception. - } - - // Resurrect ourselves by re-registering for finalization. - if (!Environment.HasShutdownStarted) - { - GC.ReRegisterForFinalize(this); - } - } - #endregion - } - - /// - /// PinnableBufferCacheEventSource is a private eventSource that we are using to - /// debug and monitor the effectiveness of PinnableBufferCache - /// - - // The following EventSource Name must be unique per DLL: - [EventSource(Name = "Microsoft-DotNETRuntime-PinnableBufferCache-Networking")] - internal sealed class PinnableBufferCacheEventSource : EventSource - { - public static readonly PinnableBufferCacheEventSource Log = new PinnableBufferCacheEventSource(); - - [Event(1, Level = EventLevel.Verbose)] - public void DebugMessage(string message) { if (IsEnabled()) WriteEvent(1, message); } - [Event(2, Level = EventLevel.Verbose)] - public void DebugMessage1(string message, long value) { if (IsEnabled()) WriteEvent(2, message, value); } - [Event(3, Level = EventLevel.Verbose)] - public void DebugMessage2(string message, long value1, long value2) { if (IsEnabled()) WriteEvent(3, message, value1, value2); } - [Event(18, Level = EventLevel.Verbose)] - public void DebugMessage3(string message, long value1, long value2, long value3) { if (IsEnabled()) WriteEvent(18, message, value1, value2, value3); } - - [Event(4)] - public void Create(string cacheName) { if (IsEnabled()) WriteEvent(4, cacheName); } - - [Event(5, Level = EventLevel.Verbose)] - public void AllocateBuffer(string cacheName, ulong objectId, int objectHash, int objectGen, int freeCountAfter) { if (IsEnabled()) WriteEvent(5, cacheName, objectId, objectHash, objectGen, freeCountAfter); } - [Event(6)] - public void AllocateBufferFromNotGen2(string cacheName, int notGen2CountAfter) { if (IsEnabled()) WriteEvent(6, cacheName, notGen2CountAfter); } - [Event(7)] - public void AllocateBufferCreatingNewBuffers(string cacheName, int totalBuffsBefore, int objectCount) { if (IsEnabled()) WriteEvent(7, cacheName, totalBuffsBefore, objectCount); } - [Event(8)] - public void AllocateBufferAged(string cacheName, int agedCount) { if (IsEnabled()) WriteEvent(8, cacheName, agedCount); } - [Event(9)] - public void AllocateBufferFreeListEmpty(string cacheName, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(9, cacheName, notGen2CountBefore); } - - [Event(10, Level = EventLevel.Verbose)] - public void FreeBuffer(string cacheName, ulong objectId, int objectHash, int freeCountBefore) { if (IsEnabled()) WriteEvent(10, cacheName, objectId, objectHash, freeCountBefore); } - [Event(11)] - public void FreeBufferStillTooYoung(string cacheName, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(11, cacheName, notGen2CountBefore); } - - [Event(13)] - public void TrimCheck(string cacheName, int totalBuffs, bool neededMoreThanFreeList, int deltaMSec) { if (IsEnabled()) WriteEvent(13, cacheName, totalBuffs, neededMoreThanFreeList, deltaMSec); } - [Event(14)] - public void TrimFree(string cacheName, int totalBuffs, int freeListCount, int toBeFreed) { if (IsEnabled()) WriteEvent(14, cacheName, totalBuffs, freeListCount, toBeFreed); } - [Event(15)] - public void TrimExperiment(string cacheName, int totalBuffs, int freeListCount, int numTrimTrial) { if (IsEnabled()) WriteEvent(15, cacheName, totalBuffs, freeListCount, numTrimTrial); } - [Event(16)] - public void TrimFreeSizeOK(string cacheName, int totalBuffs, int freeListCount) { if (IsEnabled()) WriteEvent(16, cacheName, totalBuffs, freeListCount); } - [Event(17)] - public void TrimFlush(string cacheName, int totalBuffs, int freeListCount, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(17, cacheName, totalBuffs, freeListCount, notGen2CountBefore); } - [Event(20)] - public void AgePendingBuffersResults(string cacheName, int promotedToFreeListCount, int heldBackCount) { if (IsEnabled()) WriteEvent(20, cacheName, promotedToFreeListCount, heldBackCount); } - [Event(21)] - public void WalkFreeListResult(string cacheName, int freeListCount, int gen0BuffersInFreeList) { if (IsEnabled()) WriteEvent(21, cacheName, freeListCount, gen0BuffersInFreeList); } - - - internal static ulong AddressOf(object obj) - { - var asByteArray = obj as byte[]; - if (asByteArray != null) - { - return (ulong)AddressOfByteArray(asByteArray); - } - - return 0; - } - - [System.Security.SecuritySafeCritical] - internal static unsafe long AddressOfByteArray(byte[] array) - { - if (array == null) - { - return 0; - } - - fixed (byte* ptr = array) - { - return (long)(ptr - 2 * sizeof(void*)); - } - } - } -} diff --git a/external/corefx/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs b/external/corefx/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs index 531e791233..c97cc82193 100644 --- a/external/corefx/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs +++ b/external/corefx/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; @@ -73,7 +74,6 @@ namespace System.Net.Security.Tests // Clear the credentials var startInfo = new ProcessStartInfo(KDestroyCmd); - startInfo.UseShellExecute = true; startInfo.CreateNoWindow = true; startInfo.Arguments = "-A"; using (Process clearCreds = Process.Start(startInfo)) diff --git a/external/corefx/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/external/corefx/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index 42bfbd468b..cd80ae7090 100644 --- a/external/corefx/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/external/corefx/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -47,9 +47,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Net\Capability.Security.cs diff --git a/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeAuthenticatedStream.cs b/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeAuthenticatedStream.cs index a4b95de3c2..89e892b2cd 100644 --- a/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeAuthenticatedStream.cs +++ b/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeAuthenticatedStream.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System.IO; +using System.Threading; +using System.Threading.Tasks; namespace System.Net.Security { @@ -30,6 +32,8 @@ namespace System.Net.Security public abstract bool IsEncrypted { get; } public abstract bool IsSigned { get; } public abstract bool IsServer { get; } + + public abstract Task WriteAsync(ReadOnlyMemory buffer, CancellationToken token); } } diff --git a/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeSslState.cs b/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeSslState.cs index 34f1310cb6..caae4c7923 100644 --- a/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeSslState.cs +++ b/external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/FakeSslState.cs @@ -268,8 +268,8 @@ namespace System.Net.Security { throw new NotImplementedException(); } - - public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) + + public Task WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/external/corefx/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj b/external/corefx/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj index fd8c1b14f2..db48c79c53 100644 --- a/external/corefx/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj +++ b/external/corefx/src/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -16,11 +16,9 @@ - - @@ -33,9 +31,6 @@ - - ProductionCode\System\PinnableBufferCache.cs - ProductionCode\System\Net\Security\SslStream.cs diff --git a/external/corefx/src/System.Net.Security/tests/UnitTests/System/PinnableBufferCacheTest.cs b/external/corefx/src/System.Net.Security/tests/UnitTests/System/PinnableBufferCacheTest.cs deleted file mode 100644 index 2d6bc23062..0000000000 --- a/external/corefx/src/System.Net.Security/tests/UnitTests/System/PinnableBufferCacheTest.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; - -namespace System.Net.Security.Tests -{ - public class PinnableBufferCacheTest - { - [Fact] - public void PinnableBufferCache_AllocateBuffer_Ok() - { - string cacheName = "Test"; - int numberOfElements = 5; - PinnableBufferCache p = new PinnableBufferCache(cacheName, numberOfElements); - - byte[] a = p.AllocateBuffer(); - - Assert.Equal(numberOfElements, a.Length); - foreach (byte t in a) - { - Assert.Equal(0, t); - } - } - } -} diff --git a/external/corefx/src/System.Net.Sockets/System.Net.Sockets.sln b/external/corefx/src/System.Net.Sockets/System.Net.Sockets.sln index 8a3f64f578..1c41accd25 100644 --- a/external/corefx/src/System.Net.Sockets/System.Net.Sockets.sln +++ b/external/corefx/src/System.Net.Sockets/System.Net.Sockets.sln @@ -31,10 +31,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {8CBA022C-635F-4C8D-9D29-CD8AAC68C8E6}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU {BB5C85AD-C51A-4903-80E9-6F6E1AC1AD34}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU {BB5C85AD-C51A-4903-80E9-6F6E1AC1AD34}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU {BB5C85AD-C51A-4903-80E9-6F6E1AC1AD34}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU diff --git a/external/corefx/src/System.Net.Sockets/dir.props b/external/corefx/src/System.Net.Sockets/dir.props index b5dea7fb76..b89fb6fc11 100644 --- a/external/corefx/src/System.Net.Sockets/dir.props +++ b/external/corefx/src/System.Net.Sockets/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/ref/Configurations.props b/external/corefx/src/System.Net.Sockets/ref/Configurations.props index 7de0087598..c701755863 100644 --- a/external/corefx/src/System.Net.Sockets/ref/Configurations.props +++ b/external/corefx/src/System.Net.Sockets/ref/Configurations.props @@ -4,7 +4,6 @@ netcoreapp; uap; - netfx; \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.csproj b/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.csproj index 887d4e9d92..38a85e3ef2 100644 --- a/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.csproj +++ b/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.csproj @@ -7,14 +7,13 @@ - - + diff --git a/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.netcoreapp.cs b/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.netcoreapp.cs new file mode 100644 index 0000000000..25170e64d1 --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/ref/System.Net.Sockets.netcoreapp.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the http://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + + +namespace System.Net.Sockets +{ + public partial class Socket : System.IDisposable + { + public int Receive(Span buffer) { throw null; } + public int Receive(Span buffer, System.Net.Sockets.SocketFlags socketFlags) { throw null; } + public int Receive(Span buffer, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode) { throw null; } + public int Send(ReadOnlySpan buffer) { throw null; } + public int Send(ReadOnlySpan buffer, System.Net.Sockets.SocketFlags socketFlags) { throw null; } + public int Send(ReadOnlySpan buffer, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode) { throw null; } + } + + public partial static class SocketTaskExtensions + { + public static System.Threading.Tasks.ValueTask ReceiveAsync(this System.Net.Sockets.Socket socket, System.Memory buffer, System.Net.Sockets.SocketFlags socketFlags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask SendAsync(this System.Net.Sockets.Socket socket, System.ReadOnlyMemory buffer, System.Net.Sockets.SocketFlags socketFlags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + + public partial class SocketAsyncEventArgs : System.EventArgs, System.IDisposable + { + public System.Memory GetBuffer() { throw null; } + public void SetBuffer(System.Memory buffer) { throw null; } + } +} diff --git a/external/corefx/src/System.Net.Sockets/src/Configurations.props b/external/corefx/src/System.Net.Sockets/src/Configurations.props index 4149e4ad8d..1d686837b0 100644 --- a/external/corefx/src/System.Net.Sockets/src/Configurations.props +++ b/external/corefx/src/System.Net.Sockets/src/Configurations.props @@ -5,7 +5,6 @@ uap-Windows_NT; netcoreapp-Unix; netcoreapp-Windows_NT; - netfx-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/src/System.Net.Sockets.csproj b/external/corefx/src/System.Net.Sockets/src/System.Net.Sockets.csproj index ea149da00b..4883cb0ac4 100644 --- a/external/corefx/src/System.Net.Sockets/src/System.Net.Sockets.csproj +++ b/external/corefx/src/System.Net.Sockets/src/System.Net.Sockets.csproj @@ -12,8 +12,6 @@ - - @@ -401,6 +399,7 @@ + @@ -417,4 +416,4 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs index ef46091784..64a3b7803c 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/NetworkStream.cs @@ -305,6 +305,34 @@ namespace System.Net.Sockets #endif } + public override int Read(Span destination) + { + if (GetType() != typeof(NetworkStream)) + { + // NetworkStream is not sealed, and a derived type may have overridden Read(byte[], int, int) prior + // to this Read(Span) overload being introduced. In that case, this Read(Span) overload + // should use the behavior of Read(byte[],int,int) overload. + return base.Read(destination); + } + + if (_cleanedUp) throw new ObjectDisposedException(GetType().FullName); + if (!CanRead) throw new InvalidOperationException(SR.net_writeonlystream); + + int bytesRead = _streamSocket.Receive(destination, SocketFlags.None, out SocketError errorCode); + if (errorCode != SocketError.Success) + { + var exception = new SocketException((int)errorCode); + throw new IOException(SR.Format(SR.net_io_readfailure, exception.Message), exception); + } + return bytesRead; + } + + public override unsafe int ReadByte() + { + int b; + return Read(new Span(&b, 1)) == 0 ? -1 : b; + } + // Write - provide core Write functionality. // // Provide core write functionality. All we do is call through to the @@ -368,6 +396,31 @@ namespace System.Net.Sockets #endif } + public override void Write(ReadOnlySpan source) + { + if (GetType() != typeof(NetworkStream)) + { + // NetworkStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior + // to this Write(ReadOnlySpan) overload being introduced. In that case, this Write(ReadOnlySpan) + // overload should use the behavior of Write(byte[],int,int) overload. + base.Write(source); + return; + } + + if (_cleanedUp) throw new ObjectDisposedException(GetType().FullName); + if (!CanWrite) throw new InvalidOperationException(SR.net_readonlystream); + + _streamSocket.Send(source, SocketFlags.None, out SocketError errorCode); + if (errorCode != SocketError.Success) + { + var exception = new SocketException((int)errorCode); + throw new IOException(SR.Format(SR.net_io_writefailure, exception.Message), exception); + } + } + + public override unsafe void WriteByte(byte value) => + Write(new ReadOnlySpan(&value, 1)); + private int _closeTimeout = Socket.DefaultCloseTimeout; // -1 = respect linger options public void Close(int timeout) @@ -696,6 +749,34 @@ namespace System.Net.Sockets } } + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken) + { + bool canRead = CanRead; // Prevent race with Dispose. + if (_cleanedUp) + { + throw new ObjectDisposedException(this.GetType().FullName); + } + if (!canRead) + { + throw new InvalidOperationException(SR.net_writeonlystream); + } + + try + { + return _streamSocket.ReceiveAsync( + destination, + SocketFlags.None, + fromNetworkStream: true, + cancellationToken: cancellationToken); + } + catch (Exception exception) when (!(exception is OutOfMemoryException)) + { + // Some sort of error occurred on the socket call, + // set the SocketException as InnerException and throw. + throw new IOException(SR.Format(SR.net_io_readfailure, exception.Message), exception); + } + } + // WriteAsync - provide async write functionality. // // This method provides async write functionality. All we do is @@ -757,6 +838,38 @@ namespace System.Net.Sockets } } + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken) + { + bool canWrite = CanWrite; // Prevent race with Dispose. + if (_cleanedUp) + { + throw new ObjectDisposedException(this.GetType().FullName); + } + if (!canWrite) + { + throw new InvalidOperationException(SR.net_readonlystream); + } + + try + { + ValueTask t = _streamSocket.SendAsync( + source, + SocketFlags.None, + fromNetworkStream: true, + cancellationToken: cancellationToken); + + return t.IsCompletedSuccessfully ? + Task.CompletedTask : + t.AsTask(); + } + catch (Exception exception) when (!(exception is OutOfMemoryException)) + { + // Some sort of error occurred on the socket call, + // set the SocketException as InnerException and throw. + throw new IOException(SR.Format(SR.net_io_writefailure, exception.Message), exception); + } + } + public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) { // Validate arguments as would the base CopyToAsync diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs index 7c3023d193..65b9a76655 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -195,17 +196,72 @@ namespace System.Net.Sockets } } - /// Implements Task-returning ReceiveAsync on top of Begin/EndReceive. - private Task ReceiveAsyncApm(ArraySegment buffer, SocketFlags socketFlags) + internal ValueTask ReceiveAsync(Memory buffer, SocketFlags socketFlags, bool fromNetworkStream, CancellationToken cancellationToken) { - var tcs = new TaskCompletionSource(this); - BeginReceive(buffer.Array, buffer.Offset, buffer.Count, socketFlags, iar => + if (cancellationToken.IsCancellationRequested) { - var innerTcs = (TaskCompletionSource)iar.AsyncState; - try { innerTcs.TrySetResult(((Socket)innerTcs.Task.AsyncState).EndReceive(iar)); } - catch (Exception e) { innerTcs.TrySetException(e); } - }, tcs); - return tcs.Task; + return new ValueTask(Task.FromCanceled(cancellationToken)); + } + + // TODO https://github.com/dotnet/corefx/issues/24430: + // Fully plumb cancellation down into socket operations. + + Int32TaskSocketAsyncEventArgs saea = RentSocketAsyncEventArgs(isReceive: true); + if (saea != null) + { + // We got a cached instance. Configure the buffer and initate the operation. + ConfigureBuffer(saea, buffer, socketFlags, wrapExceptionsInIOExceptions: fromNetworkStream); + return GetValueTaskForSendReceive(ReceiveAsync(saea), saea, fromNetworkStream, isReceive: true); + } + else + { + // We couldn't get a cached instance, due to a concurrent receive operation on the socket. + // Fall back to wrapping APM. + return new ValueTask(ReceiveAsyncApm(buffer, socketFlags)); + } + } + + /// Implements Task-returning ReceiveAsync on top of Begin/EndReceive. + private Task ReceiveAsyncApm(Memory buffer, SocketFlags socketFlags) + { + if (buffer.TryGetArray(out ArraySegment bufferArray)) + { + // We were able to extract the underlying byte[] from the Memory. Use it. + var tcs = new TaskCompletionSource(this); + BeginReceive(bufferArray.Array, bufferArray.Offset, bufferArray.Count, socketFlags, iar => + { + var innerTcs = (TaskCompletionSource)iar.AsyncState; + try { innerTcs.TrySetResult(((Socket)innerTcs.Task.AsyncState).EndReceive(iar)); } + catch (Exception e) { innerTcs.TrySetException(e); } + }, tcs); + return tcs.Task; + } + else + { + // We weren't able to extract an underlying byte[] from the Memory. + // Instead read into an ArrayPool array, then copy from that into the memory. + byte[] poolArray = ArrayPool.Shared.Rent(buffer.Length); + var tcs = new TaskCompletionSource(this); + BeginReceive(poolArray, 0, buffer.Length, socketFlags, iar => + { + var state = (Tuple, Memory, byte[]>)iar.AsyncState; + try + { + int bytesCopied = ((Socket)state.Item1.Task.AsyncState).EndReceive(iar); + new ReadOnlyMemory(state.Item3, 0, bytesCopied).Span.CopyTo(state.Item2.Span); + state.Item1.TrySetResult(bytesCopied); + } + catch (Exception e) + { + state.Item1.TrySetException(e); + } + finally + { + ArrayPool.Shared.Return(state.Item3); + } + }, Tuple.Create(tcs, buffer, poolArray)); + return tcs.Task; + } } internal Task ReceiveAsync(IList> buffers, SocketFlags socketFlags) @@ -304,17 +360,70 @@ namespace System.Net.Sockets } } - /// Implements Task-returning SendAsync on top of Begin/EndSend. - private Task SendAsyncApm(ArraySegment buffer, SocketFlags socketFlags) + internal ValueTask SendAsync(ReadOnlyMemory buffer, SocketFlags socketFlags, bool fromNetworkStream, CancellationToken cancellationToken) { - var tcs = new TaskCompletionSource(this); - BeginSend(buffer.Array, buffer.Offset, buffer.Count, socketFlags, iar => + if (cancellationToken.IsCancellationRequested) { - var innerTcs = (TaskCompletionSource)iar.AsyncState; - try { innerTcs.TrySetResult(((Socket)innerTcs.Task.AsyncState).EndSend(iar)); } - catch (Exception e) { innerTcs.TrySetException(e); } - }, tcs); - return tcs.Task; + return new ValueTask(Task.FromCanceled(cancellationToken)); + } + + // TODO https://github.com/dotnet/corefx/issues/24430: + // Fully plumb cancellation down into socket operations. + + Int32TaskSocketAsyncEventArgs saea = RentSocketAsyncEventArgs(isReceive: false); + if (saea != null) + { + // We got a cached instance. Configure the buffer and initate the operation. + ConfigureBuffer(saea, Unsafe.As,Memory>(ref buffer), socketFlags, wrapExceptionsInIOExceptions: fromNetworkStream); + return GetValueTaskForSendReceive(SendAsync(saea), saea, fromNetworkStream, isReceive: false); + } + else + { + // We couldn't get a cached instance, due to a concurrent send operation on the socket. + // Fall back to wrapping APM. + return new ValueTask(SendAsyncApm(buffer, socketFlags)); + } + } + + /// Implements Task-returning SendAsync on top of Begin/EndSend. + private Task SendAsyncApm(ReadOnlyMemory buffer, SocketFlags socketFlags) + { + if (buffer.DangerousTryGetArray(out ArraySegment bufferArray)) + { + var tcs = new TaskCompletionSource(this); + BeginSend(bufferArray.Array, bufferArray.Offset, bufferArray.Count, socketFlags, iar => + { + var innerTcs = (TaskCompletionSource)iar.AsyncState; + try { innerTcs.TrySetResult(((Socket)innerTcs.Task.AsyncState).EndSend(iar)); } + catch (Exception e) { innerTcs.TrySetException(e); } + }, tcs); + return tcs.Task; + } + else + { + // We weren't able to extract an underlying byte[] from the Memory. + // Instead read into an ArrayPool array, then copy from that into the memory. + byte[] poolArray = ArrayPool.Shared.Rent(buffer.Length); + buffer.Span.CopyTo(poolArray); + var tcs = new TaskCompletionSource(this); + BeginSend(poolArray, 0, buffer.Length, socketFlags, iar => + { + var state = (Tuple, byte[]>)iar.AsyncState; + try + { + state.Item1.TrySetResult(((Socket)state.Item1.Task.AsyncState).EndSend(iar)); + } + catch (Exception e) + { + state.Item1.TrySetException(e); + } + finally + { + ArrayPool.Shared.Return(state.Item2); + } + }, Tuple.Create(tcs, poolArray)); + return tcs.Task; + } } internal Task SendAsync(IList> buffers, SocketFlags socketFlags) @@ -393,14 +502,14 @@ namespace System.Net.Sockets } private static void ConfigureBuffer( - Int32TaskSocketAsyncEventArgs saea, ArraySegment buffer, SocketFlags socketFlags, bool wrapExceptionsInIOExceptions) + Int32TaskSocketAsyncEventArgs saea, Memory buffer, SocketFlags socketFlags, bool wrapExceptionsInIOExceptions) { // Configure the buffer. We don't clear the buffers when returning the SAEA to the pool, // so as to minimize overhead if the same buffer is used for subsequent operations (which is likely). // But SAEA doesn't support having both a buffer and a buffer list configured, so clear out a buffer list // if there is one before we set the desired buffer. if (saea.BufferList != null) saea.BufferList = null; - saea.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); + saea.SetBuffer(buffer); saea.SocketFlags = socketFlags; saea._wrapExceptionsInIOExceptions = wrapExceptionsInIOExceptions; } @@ -486,6 +595,48 @@ namespace System.Net.Sockets return t; } + /// Gets a value task to represent the operation. + /// true if the operation completes asynchronously; false if it completed synchronously. + /// The event args instance used with the operation. + /// + /// true if the request is coming from NetworkStream, which has special semantics for + /// exceptions and cached tasks; otherwise, false. + /// + /// true if this is a receive; false if this is a send. + private ValueTask GetValueTaskForSendReceive( + bool pending, Int32TaskSocketAsyncEventArgs saea, + bool fromNetworkStream, bool isReceive) + { + ValueTask t; + + if (pending) + { + // The operation is completing asynchronously (it may have already completed). + // Get the task for the operation, with appropriate synchronization to coordinate + // with the async callback that'll be completing the task. + bool responsibleForReturningToPool; + t = new ValueTask(saea.GetCompletionResponsibility(out responsibleForReturningToPool).Task); + if (responsibleForReturningToPool) + { + // We're responsible for returning it only if the callback has already been invoked + // and gotten what it needs from the SAEA; otherwise, the callback will return it. + ReturnSocketAsyncEventArgs(saea, isReceive); + } + } + else + { + // The operation completed synchronously. Return a ValueTask for it. + t = saea.SocketError == SocketError.Success ? + new ValueTask(saea.BytesTransferred) : + new ValueTask(Task.FromException(GetException(saea.SocketError, wrapExceptionsInIOExceptions: fromNetworkStream))); + + // There won't be a callback, and we're done with the SAEA, so return it to the pool. + ReturnSocketAsyncEventArgs(saea, isReceive); + } + + return t; + } + /// Completes the SocketAsyncEventArg's Task with the result of the send or receive, and returns it to the specified pool. private static void CompleteAccept(Socket s, TaskSocketAsyncEventArgs saea) { diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.cs.REMOVED.git-id b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.cs.REMOVED.git-id index f216e8ef13..28a4fe4897 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.cs.REMOVED.git-id +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/Socket.cs.REMOVED.git-id @@ -1 +1 @@ -c07087cce038e6a59b3d3a584b6fd28bf65a5be4 \ No newline at end of file +b7edd69b9b150d3c51ac0b5efb82a99dbf85290e \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs index 9ae7c44be7..db4604fe41 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs @@ -3,10 +3,8 @@ // See the LICENSE file in the project root for more information. using Microsoft.Win32.SafeHandles; -using System; using System.Collections.Generic; using System.Diagnostics; -using System.Runtime.InteropServices; using System.Threading; namespace System.Net.Sockets @@ -180,62 +178,102 @@ namespace System.Net.Sockets private abstract class WriteOperation : AsyncOperation { - } + } - private sealed class SendOperation : WriteOperation + private abstract class SendOperation : WriteOperation { - public byte[] Buffer; - public int Offset; - public int Count; public SocketFlags Flags; public int BytesTransferred; - public IList> Buffers; - public int BufferIndex; + public int Offset; + public int Count; protected sealed override void Abort() { } public Action Callback { - private get { return (Action)CallbackOrEvent; } - set { CallbackOrEvent = value; } + set => CallbackOrEvent = value; } - protected sealed override void InvokeCallback() - { - Callback(BytesTransferred, SocketAddress, SocketAddressLen, SocketFlags.None, ErrorCode); - } + protected sealed override void InvokeCallback() => + ((Action)CallbackOrEvent)(BytesTransferred, SocketAddress, SocketAddressLen, SocketFlags.None, ErrorCode); + } + + private sealed class BufferArraySendOperation : SendOperation + { + public byte[] Buffer; + protected override bool DoTryComplete(SocketAsyncContext context) { - return SocketPal.TryCompleteSendTo(context._socket, Buffer, Buffers, ref BufferIndex, ref Offset, ref Count, Flags, SocketAddress, SocketAddressLen, ref BytesTransferred, out ErrorCode); + int bufferIndex = 0; + return SocketPal.TryCompleteSendTo(context._socket, Buffer, null, ref bufferIndex, ref Offset, ref Count, Flags, SocketAddress, SocketAddressLen, ref BytesTransferred, out ErrorCode); } } - private sealed class ReceiveOperation : ReadOperation + private sealed class BufferListSendOperation : SendOperation { - public byte[] Buffer; - public int Offset; - public int Count; - public SocketFlags Flags; - public int BytesTransferred; - public SocketFlags ReceivedFlags; public IList> Buffers; + public int BufferIndex; + + protected override bool DoTryComplete(SocketAsyncContext context) + { + return SocketPal.TryCompleteSendTo(context._socket, default(ReadOnlySpan), Buffers, ref BufferIndex, ref Offset, ref Count, Flags, SocketAddress, SocketAddressLen, ref BytesTransferred, out ErrorCode); + } + } + + private sealed unsafe class BufferPtrSendOperation : SendOperation + { + public byte* BufferPtr; + + protected override bool DoTryComplete(SocketAsyncContext context) + { + int bufferIndex = 0; + return SocketPal.TryCompleteSendTo(context._socket, new ReadOnlySpan(BufferPtr, Offset + Count), null, ref bufferIndex, ref Offset, ref Count, Flags, SocketAddress, SocketAddressLen, ref BytesTransferred, out ErrorCode); + } + } + + private abstract class ReceiveOperation : ReadOperation + { + public SocketFlags Flags; + public SocketFlags ReceivedFlags; + public int BytesTransferred; protected sealed override void Abort() { } public Action Callback { - private get { return (Action)CallbackOrEvent; } - set { CallbackOrEvent = value; } + set => CallbackOrEvent = value; } - protected sealed override void InvokeCallback() - { - Callback(BytesTransferred, SocketAddress, SocketAddressLen, ReceivedFlags, ErrorCode); - } - protected override bool DoTryComplete(SocketAsyncContext context) - { - return SocketPal.TryCompleteReceiveFrom(context._socket, Buffer, Buffers, Offset, Count, Flags, SocketAddress, ref SocketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode); - } + protected sealed override void InvokeCallback() => + ((Action)CallbackOrEvent)( + BytesTransferred, SocketAddress, SocketAddressLen, ReceivedFlags, ErrorCode); + } + + private sealed class BufferArrayReceiveOperation : ReceiveOperation + { + public byte[] Buffer; + public int Offset; + public int Count; + + protected override bool DoTryComplete(SocketAsyncContext context) => + SocketPal.TryCompleteReceiveFrom(context._socket, new Span(Buffer, Offset, Count), null, Flags, SocketAddress, ref SocketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode); + } + + private sealed class BufferListReceiveOperation : ReceiveOperation + { + public IList> Buffers; + + protected override bool DoTryComplete(SocketAsyncContext context) => + SocketPal.TryCompleteReceiveFrom(context._socket, default(Span), Buffers, Flags, SocketAddress, ref SocketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode); + } + + private sealed unsafe class BufferPtrReceiveOperation : ReceiveOperation + { + public byte* BufferPtr; + public int Length; + + protected override bool DoTryComplete(SocketAsyncContext context) => + SocketPal.TryCompleteReceiveFrom(context._socket, new Span(BufferPtr, Length), null, Flags, SocketAddress, ref SocketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode); } private sealed class ReceiveMessageFromOperation : ReadOperation @@ -256,19 +294,15 @@ namespace System.Net.Sockets public Action Callback { - private get { return (Action)CallbackOrEvent; } - set { CallbackOrEvent = value; } + set => CallbackOrEvent = value; } - protected override bool DoTryComplete(SocketAsyncContext context) - { - return SocketPal.TryCompleteReceiveMessageFrom(context._socket, Buffer, Buffers, Offset, Count, Flags, SocketAddress, ref SocketAddressLen, IsIPv4, IsIPv6, out BytesTransferred, out ReceivedFlags, out IPPacketInformation, out ErrorCode); - } + protected override bool DoTryComplete(SocketAsyncContext context) => + SocketPal.TryCompleteReceiveMessageFrom(context._socket, Buffer, Buffers, Offset, Count, Flags, SocketAddress, ref SocketAddressLen, IsIPv4, IsIPv6, out BytesTransferred, out ReceivedFlags, out IPPacketInformation, out ErrorCode); - protected override void InvokeCallback() - { - Callback(BytesTransferred, SocketAddress, SocketAddressLen, ReceivedFlags, IPPacketInformation, ErrorCode); - } + protected override void InvokeCallback() => + ((Action)CallbackOrEvent)( + BytesTransferred, SocketAddress, SocketAddressLen, ReceivedFlags, IPPacketInformation, ErrorCode); } private sealed class AcceptOperation : ReadOperation @@ -277,14 +311,11 @@ namespace System.Net.Sockets public Action Callback { - private get { return (Action)CallbackOrEvent; } - set { CallbackOrEvent = value; } + set => CallbackOrEvent = value; } - protected override void Abort() - { + protected override void Abort() => AcceptedFileDescriptor = (IntPtr)(-1); - } protected override bool DoTryComplete(SocketAsyncContext context) { @@ -293,18 +324,16 @@ namespace System.Net.Sockets return completed; } - protected override void InvokeCallback() - { - Callback(AcceptedFileDescriptor, SocketAddress, SocketAddressLen, ErrorCode); - } + protected override void InvokeCallback() => + ((Action)CallbackOrEvent)( + AcceptedFileDescriptor, SocketAddress, SocketAddressLen, ErrorCode); } private sealed class ConnectOperation : WriteOperation { public Action Callback { - private get { return (Action)CallbackOrEvent; } - set { CallbackOrEvent = value; } + set => CallbackOrEvent = value; } protected override void Abort() { } @@ -316,10 +345,8 @@ namespace System.Net.Sockets return result; } - protected override void InvokeCallback() - { - Callback(ErrorCode); - } + protected override void InvokeCallback() => + ((Action)CallbackOrEvent)(ErrorCode); } private sealed class SendFileOperation : WriteOperation @@ -333,19 +360,14 @@ namespace System.Net.Sockets public Action Callback { - private get { return (Action)CallbackOrEvent; } - set { CallbackOrEvent = value; } + set => CallbackOrEvent = value; } - protected override void InvokeCallback() - { - Callback(BytesTransferred, ErrorCode); - } + protected override void InvokeCallback() => + ((Action)CallbackOrEvent)(BytesTransferred, ErrorCode); - protected override bool DoTryComplete(SocketAsyncContext context) - { - return SocketPal.TryCompleteSendFile(context._socket, FileHandle, ref Offset, ref Count, ref BytesTransferred, out ErrorCode); - } + protected override bool DoTryComplete(SocketAsyncContext context) => + SocketPal.TryCompleteSendFile(context._socket, FileHandle, ref Offset, ref Count, ref BytesTransferred, out ErrorCode); } private enum QueueState @@ -786,6 +808,12 @@ namespace System.Net.Sockets return ReceiveFrom(buffer, offset, count, ref flags, null, ref socketAddressLen, timeout, out bytesReceived); } + public SocketError Receive(Span buffer, ref SocketFlags flags, int timeout, out int bytesReceived) + { + int socketAddressLen = 0; + return ReceiveFrom(buffer, ref flags, null, ref socketAddressLen, timeout, out bytesReceived); + } + public SocketError ReceiveAsync(byte[] buffer, int offset, int count, SocketFlags flags, out int bytesReceived, out SocketFlags receivedFlags, Action callback) { int socketAddressLen = 0; @@ -814,7 +842,7 @@ namespace System.Net.Sockets @event = new ManualResetEventSlim(false, 0); - operation = new ReceiveOperation + operation = new BufferArrayReceiveOperation { Event = @event, Buffer = buffer, @@ -853,10 +881,78 @@ namespace System.Net.Sockets } finally { - if (@event != null) @event.Dispose(); + @event?.Dispose(); } } + public unsafe SocketError ReceiveFrom(Span buffer, ref SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, int timeout, out int bytesReceived) + { + Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); + + fixed (byte* bufferPtr = &buffer.DangerousGetPinnableReference()) + { + ManualResetEventSlim @event = null; + try + { + ReceiveOperation operation; + lock (_receiveQueue.QueueLock) + { + SocketFlags receivedFlags; + SocketError errorCode; + + if (_receiveQueue.IsEmpty && + SocketPal.TryCompleteReceiveFrom(_socket, buffer, flags, socketAddress, ref socketAddressLen, out bytesReceived, out receivedFlags, out errorCode)) + { + flags = receivedFlags; + return errorCode; + } + + @event = new ManualResetEventSlim(false, 0); + + operation = new BufferPtrReceiveOperation + { + Event = @event, + BufferPtr = bufferPtr, + Length = buffer.Length, + Flags = flags, + SocketAddress = socketAddress, + SocketAddressLen = socketAddressLen, + }; + + bool isStopped; + while (!TryBeginOperation(ref _receiveQueue, operation, Interop.Sys.SocketEvents.Read, maintainOrder: true, isStopped: out isStopped)) + { + if (isStopped) + { + flags = operation.ReceivedFlags; + bytesReceived = operation.BytesTransferred; + return SocketError.Interrupted; + } + + if (operation.TryComplete(this)) + { + socketAddressLen = operation.SocketAddressLen; + flags = operation.ReceivedFlags; + bytesReceived = operation.BytesTransferred; + return operation.ErrorCode; + } + } + } + + bool signaled = operation.Wait(timeout); + socketAddressLen = operation.SocketAddressLen; + flags = operation.ReceivedFlags; + bytesReceived = operation.BytesTransferred; + return signaled ? operation.ErrorCode : SocketError.TimedOut; + } + finally + { + @event?.Dispose(); + } + } + } + + public SocketError ReceiveFromAsync(byte[] buffer, int offset, int count, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, Action callback) { SetNonBlocking(); @@ -872,7 +968,7 @@ namespace System.Net.Sockets return errorCode; } - var operation = new ReceiveOperation + var operation = new BufferArrayReceiveOperation { Callback = callback, Buffer = buffer, @@ -941,7 +1037,7 @@ namespace System.Net.Sockets @event = new ManualResetEventSlim(false, 0); - operation = new ReceiveOperation + operation = new BufferListReceiveOperation { Event = @event, Buffers = buffers, @@ -979,7 +1075,7 @@ namespace System.Net.Sockets } finally { - if (@event != null) @event.Dispose(); + @event?.Dispose(); } } @@ -999,7 +1095,7 @@ namespace System.Net.Sockets return errorCode; } - operation = new ReceiveOperation + operation = new BufferListReceiveOperation { Callback = callback, Buffers = buffers, @@ -1102,7 +1198,7 @@ namespace System.Net.Sockets } finally { - if (@event != null) @event.Dispose(); + @event?.Dispose(); } } @@ -1163,6 +1259,9 @@ namespace System.Net.Sockets } } + public SocketError Send(ReadOnlySpan buffer, SocketFlags flags, int timeout, out int bytesSent) => + SendTo(buffer, flags, null, 0, timeout, out bytesSent); + public SocketError Send(byte[] buffer, int offset, int count, SocketFlags flags, int timeout, out int bytesSent) { return SendTo(buffer, offset, count, flags, null, 0, timeout, out bytesSent); @@ -1181,7 +1280,7 @@ namespace System.Net.Sockets ManualResetEventSlim @event = null; try { - SendOperation operation; + BufferArraySendOperation operation; lock (_sendQueue.QueueLock) { @@ -1196,7 +1295,7 @@ namespace System.Net.Sockets @event = new ManualResetEventSlim(false, 0); - operation = new SendOperation + operation = new BufferArraySendOperation { Event = @event, Buffer = buffer, @@ -1231,7 +1330,72 @@ namespace System.Net.Sockets } finally { - if (@event != null) @event.Dispose(); + @event?.Dispose(); + } + } + + public unsafe SocketError SendTo(ReadOnlySpan buffer, SocketFlags flags, byte[] socketAddress, int socketAddressLen, int timeout, out int bytesSent) + { + Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); + + fixed (byte* bufferPtr = &buffer.DangerousGetPinnableReference()) + { + ManualResetEventSlim @event = null; + try + { + BufferPtrSendOperation operation; + + lock (_sendQueue.QueueLock) + { + bytesSent = 0; + SocketError errorCode; + + int bufferIndexIgnored = 0, offset = 0, count = buffer.Length; + if (_sendQueue.IsEmpty && + SocketPal.TryCompleteSendTo(_socket, buffer, null, ref bufferIndexIgnored, ref offset, ref count, flags, socketAddress, socketAddressLen, ref bytesSent, out errorCode)) + { + return errorCode; + } + + @event = new ManualResetEventSlim(false, 0); + + operation = new BufferPtrSendOperation + { + Event = @event, + BufferPtr = bufferPtr, + Offset = offset, + Count = count, + Flags = flags, + SocketAddress = socketAddress, + SocketAddressLen = socketAddressLen, + BytesTransferred = bytesSent + }; + + bool isStopped; + while (!TryBeginOperation(ref _sendQueue, operation, Interop.Sys.SocketEvents.Write, maintainOrder: true, isStopped: out isStopped)) + { + if (isStopped) + { + bytesSent = operation.BytesTransferred; + return SocketError.Interrupted; + } + + if (operation.TryComplete(this)) + { + bytesSent = operation.BytesTransferred; + return operation.ErrorCode; + } + } + } + + bool signaled = operation.Wait(timeout); + bytesSent = operation.BytesTransferred; + return signaled ? operation.ErrorCode : SocketError.TimedOut; + } + finally + { + @event?.Dispose(); + } } } @@ -1251,7 +1415,7 @@ namespace System.Net.Sockets return errorCode; } - var operation = new SendOperation + var operation = new BufferArraySendOperation { Callback = callback, Buffer = buffer, @@ -1300,7 +1464,7 @@ namespace System.Net.Sockets ManualResetEventSlim @event = null; try { - SendOperation operation; + BufferListSendOperation operation; lock (_sendQueue.QueueLock) { @@ -1317,7 +1481,7 @@ namespace System.Net.Sockets @event = new ManualResetEventSlim(false, 0); - operation = new SendOperation + operation = new BufferListSendOperation { Event = @event, Buffers = buffers, @@ -1352,12 +1516,10 @@ namespace System.Net.Sockets } finally { - if (@event != null) @event.Dispose(); + @event?.Dispose(); } } - - public SocketError SendToAsync(IList> buffers, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesSent, Action callback) { SetNonBlocking(); @@ -1376,7 +1538,7 @@ namespace System.Net.Sockets return errorCode; } - var operation = new SendOperation + var operation = new BufferListSendOperation { Callback = callback, Buffers = buffers, @@ -1461,7 +1623,7 @@ namespace System.Net.Sockets } finally { - if (@event != null) @event.Dispose(); + @event?.Dispose(); } } diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs index 8aa08a26f8..5b5eb8c38d 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs @@ -104,6 +104,15 @@ namespace System.Net.Sockets get { return _buffer; } } + public Memory GetBuffer() + { + // TODO https://github.com/dotnet/corefx/issues/24429: + // Actually support Memory natively. + return _buffer != null ? + new Memory(_buffer, _offset, _count) : + Memory.Empty; + } + public int Offset { get { return _offset; } @@ -283,6 +292,18 @@ namespace System.Net.Sockets SetBufferInternal(_buffer, offset, count); } + public void SetBuffer(Memory buffer) + { + if (!buffer.TryGetArray(out ArraySegment array)) + { + // TODO https://github.com/dotnet/corefx/issues/24429: + // Actually support Memory natively. + throw new ArgumentException(); + } + + SetBuffer(array.Array, array.Offset, array.Count); + } + internal bool HasMultipleBuffers { get { return _bufferList != null; } diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Unix.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Unix.cs index 213d99916a..0c44554357 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Unix.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Unix.cs @@ -16,7 +16,6 @@ namespace System.Net.Sockets { public const bool SupportsMultipleConnectAttempts = false; private static readonly bool SupportsDualModeIPv4PacketInfo = GetPlatformSupportsDualModeIPv4PacketInfo(); - private static readonly byte[] s_peekBuffer = new byte[1]; private static bool GetPlatformSupportsDualModeIPv4PacketInfo() { @@ -62,24 +61,19 @@ namespace System.Net.Sockets return SafeCloseSocket.CreateSocket(addressFamily, socketType, protocolType, out socket); } - private static unsafe int Receive(SafeCloseSocket socket, SocketFlags flags, byte[] buffer, int offset, int count, byte[] socketAddress, ref int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno) + private static unsafe int Receive(SafeCloseSocket socket, SocketFlags flags, Span buffer, byte[] socketAddress, ref int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno) { Debug.Assert(socketAddress != null || socketAddressLen == 0, $"Unexpected values: socketAddress={socketAddress}, socketAddressLen={socketAddressLen}"); long received; - - int sockAddrLen = 0; - if (socketAddress != null) - { - sockAddrLen = socketAddressLen; - } + int sockAddrLen = socketAddress != null ? socketAddressLen : 0; fixed (byte* sockAddr = socketAddress) - fixed (byte* b = buffer) + fixed (byte* b = &buffer.DangerousGetPinnableReference()) { var iov = new Interop.Sys.IOVector { - Base = (b == null) ? null : &b[offset], - Count = (UIntPtr)count + Base = b, + Count = (UIntPtr)buffer.Length }; var messageHeader = new Interop.Sys.MessageHeader { @@ -109,27 +103,22 @@ namespace System.Net.Sockets return checked((int)received); } - private static unsafe int Send(SafeCloseSocket socket, SocketFlags flags, byte[] buffer, ref int offset, ref int count, byte[] socketAddress, int socketAddressLen, out Interop.Error errno) + private static unsafe int Send(SafeCloseSocket socket, SocketFlags flags, ReadOnlySpan buffer, ref int offset, ref int count, byte[] socketAddress, int socketAddressLen, out Interop.Error errno) { int sent; - - int sockAddrLen = 0; - if (socketAddress != null) - { - sockAddrLen = socketAddressLen; - } - fixed (byte* sockAddr = socketAddress) - fixed (byte* b = buffer) + fixed (byte* b = &buffer.DangerousGetPinnableReference()) { - var iov = new Interop.Sys.IOVector { + var iov = new Interop.Sys.IOVector + { Base = &b[offset], Count = (UIntPtr)count }; - var messageHeader = new Interop.Sys.MessageHeader { + var messageHeader = new Interop.Sys.MessageHeader + { SocketAddress = sockAddr, - SocketAddressLen = sockAddrLen, + SocketAddressLen = socketAddress != null ? socketAddressLen : 0, IOVectors = &iov, IOVectorCount = 1 }; @@ -150,7 +139,6 @@ namespace System.Net.Sockets return -1; } - offset += sent; count -= sent; return sent; @@ -265,8 +253,8 @@ namespace System.Net.Sockets } if (available == 0) { - // Always request at least one byte. - available = 1; + // Don't truncate iovecs. + available = int.MaxValue; } // Pin buffers and set up iovecs. @@ -594,17 +582,16 @@ namespace System.Net.Sockets return true; } - public static bool TryCompleteReceiveFrom(SafeCloseSocket socket, byte[] buffer, int offset, int count, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) - { - return TryCompleteReceiveFrom(socket, buffer, null, offset, count, flags, socketAddress, ref socketAddressLen, out bytesReceived, out receivedFlags, out errorCode); - } + public static bool TryCompleteReceiveFrom(SafeCloseSocket socket, byte[] buffer, int offset, int count, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) => + TryCompleteReceiveFrom(socket, new Span(buffer, offset, count), null, flags, socketAddress, ref socketAddressLen, out bytesReceived, out receivedFlags, out errorCode); - public static bool TryCompleteReceiveFrom(SafeCloseSocket socket, IList> buffers, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) - { - return TryCompleteReceiveFrom(socket, null, buffers, 0, 0, flags, socketAddress, ref socketAddressLen, out bytesReceived, out receivedFlags, out errorCode); - } + public static bool TryCompleteReceiveFrom(SafeCloseSocket socket, Span buffer, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) => + TryCompleteReceiveFrom(socket, buffer, null, flags, socketAddress, ref socketAddressLen, out bytesReceived, out receivedFlags, out errorCode); - public static unsafe bool TryCompleteReceiveFrom(SafeCloseSocket socket, byte[] buffer, IList> buffers, int offset, int count, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) + public static bool TryCompleteReceiveFrom(SafeCloseSocket socket, IList> buffers, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) => + TryCompleteReceiveFrom(socket, default(Span), buffers, flags, socketAddress, ref socketAddressLen, out bytesReceived, out receivedFlags, out errorCode); + + public static unsafe bool TryCompleteReceiveFrom(SafeCloseSocket socket, Span buffer, IList> buffers, SocketFlags flags, byte[] socketAddress, ref int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) { try { @@ -614,16 +601,16 @@ namespace System.Net.Sockets if (buffers != null) { // Receive into a set of buffers - Debug.Assert(buffer == null); received = Receive(socket, flags, buffers, socketAddress, ref socketAddressLen, out receivedFlags, out errno); } - else if (count == 0) + else if (buffer.Length == 0) { // Special case a receive of 0 bytes into a single buffer. A common pattern is to ReceiveAsync 0 bytes in order // to be asynchronously notified when data is available, without needing to dedicate a buffer. Some platforms (e.g. macOS), // however complete a 0-byte read successfully when data isn't available, as the request can logically be satisfied // synchronously. As such, we treat 0 specially, and perform a 1-byte peek. - received = Receive(socket, flags | SocketFlags.Peek, s_peekBuffer, 0, s_peekBuffer.Length, socketAddress, ref socketAddressLen, out receivedFlags, out errno); + byte oneBytePeekBuffer; + received = Receive(socket, flags | SocketFlags.Peek, new Span(&oneBytePeekBuffer, 1), socketAddress, ref socketAddressLen, out receivedFlags, out errno); if (received > 0) { // Peeked for 1-byte, but the actual request was for 0. @@ -633,7 +620,7 @@ namespace System.Net.Sockets else { // Receive > 0 bytes into a single buffer - received = Receive(socket, flags, buffer, offset, count, socketAddress, ref socketAddressLen, out receivedFlags, out errno); + received = Receive(socket, flags, buffer, socketAddress, ref socketAddressLen, out receivedFlags, out errno); } if (received != -1) @@ -713,28 +700,30 @@ namespace System.Net.Sockets return TryCompleteSendTo(socket, buffer, null, ref bufferIndex, ref offset, ref count, flags, socketAddress, socketAddressLen, ref bytesSent, out errorCode); } + public static bool TryCompleteSendTo(SafeCloseSocket socket, ReadOnlySpan buffer, SocketFlags flags, byte[] socketAddress, int socketAddressLen, ref int bytesSent, out SocketError errorCode) + { + int bufferIndex = 0, offset = 0, count = buffer.Length; + return TryCompleteSendTo(socket, buffer, null, ref bufferIndex, ref offset, ref count, flags, socketAddress, socketAddressLen, ref bytesSent, out errorCode); + } + public static bool TryCompleteSendTo(SafeCloseSocket socket, IList> buffers, ref int bufferIndex, ref int offset, SocketFlags flags, byte[] socketAddress, int socketAddressLen, ref int bytesSent, out SocketError errorCode) { int count = 0; - return TryCompleteSendTo(socket, null, buffers, ref bufferIndex, ref offset, ref count, flags, socketAddress, socketAddressLen, ref bytesSent, out errorCode); + return TryCompleteSendTo(socket, default(ReadOnlySpan), buffers, ref bufferIndex, ref offset, ref count, flags, socketAddress, socketAddressLen, ref bytesSent, out errorCode); } - public static bool TryCompleteSendTo(SafeCloseSocket socket, byte[] buffer, IList> buffers, ref int bufferIndex, ref int offset, ref int count, SocketFlags flags, byte[] socketAddress, int socketAddressLen, ref int bytesSent, out SocketError errorCode) + public static bool TryCompleteSendTo(SafeCloseSocket socket, ReadOnlySpan buffer, IList> buffers, ref int bufferIndex, ref int offset, ref int count, SocketFlags flags, byte[] socketAddress, int socketAddressLen, ref int bytesSent, out SocketError errorCode) { + bool successfulSend = false; for (;;) { int sent; Interop.Error errno; try { - if (buffer != null) - { - sent = Send(socket, flags, buffer, ref offset, ref count, socketAddress, socketAddressLen, out errno); - } - else - { - sent = Send(socket, flags, buffers, ref bufferIndex, ref offset, socketAddress, socketAddressLen, out errno); - } + sent = buffers != null ? + Send(socket, flags, buffers, ref bufferIndex, ref offset, socketAddress, socketAddressLen, out errno) : + Send(socket, flags, buffer, ref offset, ref count, socketAddress, socketAddressLen, out errno); } catch (ObjectDisposedException) { @@ -745,20 +734,21 @@ namespace System.Net.Sockets if (sent == -1) { - if (errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) + if (!successfulSend && errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) { errorCode = GetSocketErrorForErrorCode(errno); return true; } - errorCode = SocketError.Success; + errorCode = successfulSend ? SocketError.Success : SocketError.WouldBlock; return false; } + successfulSend = true; bytesSent += sent; bool isComplete = sent == 0 || - (buffer != null && count == 0) || + (buffers == null && count == 0) || (buffers != null && bufferIndex == buffers.Count); if (isComplete) { @@ -902,8 +892,8 @@ namespace System.Net.Sockets int bufferIndex = 0; int offset = 0; SocketError errorCode; - bool completed = TryCompleteSendTo(handle, bufferList, ref bufferIndex, ref offset, socketFlags, null, 0, ref bytesTransferred, out errorCode); - return completed ? errorCode : SocketError.WouldBlock; + TryCompleteSendTo(handle, bufferList, ref bufferIndex, ref offset, socketFlags, null, 0, ref bytesTransferred, out errorCode); + return errorCode; } public static SocketError Send(SafeCloseSocket handle, byte[] buffer, int offset, int count, SocketFlags socketFlags, out int bytesTransferred) @@ -915,8 +905,21 @@ namespace System.Net.Sockets bytesTransferred = 0; SocketError errorCode; - bool completed = TryCompleteSendTo(handle, buffer, ref offset, ref count, socketFlags, null, 0, ref bytesTransferred, out errorCode); - return completed ? errorCode : SocketError.WouldBlock; + TryCompleteSendTo(handle, buffer, ref offset, ref count, socketFlags, null, 0, ref bytesTransferred, out errorCode); + return errorCode; + } + + public static SocketError Send(SafeCloseSocket handle, ReadOnlySpan buffer, SocketFlags socketFlags, out int bytesTransferred) + { + if (!handle.IsNonBlocking) + { + return handle.AsyncContext.Send(buffer, socketFlags, handle.SendTimeout, out bytesTransferred); + } + + bytesTransferred = 0; + SocketError errorCode; + TryCompleteSendTo(handle, buffer, socketFlags, null, 0, ref bytesTransferred, out errorCode); + return errorCode; } public static SocketError SendFile(SafeCloseSocket handle, FileStream fileStream) @@ -947,8 +950,8 @@ namespace System.Net.Sockets bytesTransferred = 0; SocketError errorCode; - bool completed = TryCompleteSendTo(handle, buffer, ref offset, ref count, socketFlags, socketAddress, socketAddressLen, ref bytesTransferred, out errorCode); - return completed ? errorCode : SocketError.WouldBlock; + TryCompleteSendTo(handle, buffer, ref offset, ref count, socketFlags, socketAddress, socketAddressLen, ref bytesTransferred, out errorCode); + return errorCode; } public static SocketError Receive(SafeCloseSocket handle, IList> buffers, ref SocketFlags socketFlags, out int bytesTransferred) @@ -983,6 +986,19 @@ namespace System.Net.Sockets return completed ? errorCode : SocketError.WouldBlock; } + public static SocketError Receive(SafeCloseSocket handle, Span buffer, SocketFlags socketFlags, out int bytesTransferred) + { + if (!handle.IsNonBlocking) + { + return handle.AsyncContext.Receive(buffer, ref socketFlags, handle.ReceiveTimeout, out bytesTransferred); + } + + int socketAddressLen = 0; + SocketError errorCode; + bool completed = TryCompleteReceiveFrom(handle, buffer, socketFlags, null, ref socketAddressLen, out bytesTransferred, out socketFlags, out errorCode); + return completed ? errorCode : SocketError.WouldBlock; + } + public static SocketError ReceiveMessageFrom(Socket socket, SafeCloseSocket handle, byte[] buffer, int offset, int count, ref SocketFlags socketFlags, Internals.SocketAddress socketAddress, out Internals.SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred) { byte[] socketAddressBuffer = socketAddress.Buffer; @@ -1044,15 +1060,17 @@ namespace System.Net.Sockets { if (optionName == SocketOptionName.ReceiveTimeout) { + // Note, setting a non-infinite timeout will force the handle into nonblocking mode handle.ReceiveTimeout = optionValue == 0 ? -1 : optionValue; - err = Interop.Sys.SetReceiveTimeout(handle, optionValue); - return GetErrorAndTrackSetting(handle, optionLevel, optionName, err); + handle.TrackOption(optionLevel, optionName); + return SocketError.Success; } else if (optionName == SocketOptionName.SendTimeout) { + // Note, setting a non-infinite timeout will force the handle into nonblocking mode handle.SendTimeout = optionValue == 0 ? -1 : optionValue; - err = Interop.Sys.SetSendTimeout(handle, optionValue); - return GetErrorAndTrackSetting(handle, optionLevel, optionName, err); + handle.TrackOption(optionLevel, optionName); + return SocketError.Success; } } else if (optionLevel == SocketOptionLevel.IP) @@ -1114,11 +1132,14 @@ namespace System.Net.Sockets IPAddress localAddress = optionValue.LocalAddress ?? IPAddress.Any; - var opt = new Interop.Sys.IPv4MulticastOption { - MulticastAddress = unchecked((uint)optionValue.Group.GetAddress()), - LocalAddress = unchecked((uint)localAddress.GetAddress()), +#pragma warning disable CS0618 // Address is marked obsolete + var opt = new Interop.Sys.IPv4MulticastOption + { + MulticastAddress = unchecked((uint)optionValue.Group.Address), + LocalAddress = unchecked((uint)localAddress.Address), InterfaceIndex = optionValue.InterfaceIndex }; +#pragma warning restore CS0618 Interop.Error err = Interop.Sys.SetIPv4MulticastOption(handle, optName, &opt); return GetErrorAndTrackSetting(handle, SocketOptionLevel.IP, optionName, err); diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Windows.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Windows.cs index ac8460a650..6e8e34f4db 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Windows.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Windows.cs @@ -174,23 +174,15 @@ namespace System.Net.Sockets } } - public static unsafe SocketError Send(SafeCloseSocket handle, byte[] buffer, int offset, int size, SocketFlags socketFlags, out int bytesTransferred) + public static unsafe SocketError Send(SafeCloseSocket handle, byte[] buffer, int offset, int size, SocketFlags socketFlags, out int bytesTransferred) => + Send(handle, new ReadOnlySpan(buffer, offset, size), socketFlags, out bytesTransferred); + + public static unsafe SocketError Send(SafeCloseSocket handle, ReadOnlySpan buffer, SocketFlags socketFlags, out int bytesTransferred) { int bytesSent; - if (buffer.Length == 0) + fixed (byte* bufferPtr = &buffer.DangerousGetPinnableReference()) { - bytesSent = Interop.Winsock.send(handle.DangerousGetHandle(), null, 0, socketFlags); - } - else - { - fixed (byte* pinnedBuffer = &buffer[0]) - { - bytesSent = Interop.Winsock.send( - handle.DangerousGetHandle(), - pinnedBuffer + offset, - size, - socketFlags); - } + bytesSent = Interop.Winsock.send(handle.DangerousGetHandle(), bufferPtr, buffer.Length, socketFlags); } if (bytesSent == (int)SocketError.SocketError) @@ -302,19 +294,15 @@ namespace System.Net.Sockets } } - public static unsafe SocketError Receive(SafeCloseSocket handle, byte[] buffer, int offset, int size, SocketFlags socketFlags, out int bytesTransferred) + public static unsafe SocketError Receive(SafeCloseSocket handle, byte[] buffer, int offset, int size, SocketFlags socketFlags, out int bytesTransferred) => + Receive(handle, new Span(buffer, offset, size), socketFlags, out bytesTransferred); + + public static unsafe SocketError Receive(SafeCloseSocket handle, Span buffer, SocketFlags socketFlags, out int bytesTransferred) { int bytesReceived; - if (buffer?.Length == 0) + fixed (byte* bufferPtr = &buffer.DangerousGetPinnableReference()) { - bytesReceived = Interop.Winsock.recv(handle.DangerousGetHandle(), null, 0, socketFlags); - } - else - { - fixed (byte* pinnedBuffer = buffer) - { - bytesReceived = Interop.Winsock.recv(handle.DangerousGetHandle(), pinnedBuffer + offset, size, socketFlags); - } + bytesReceived = Interop.Winsock.recv(handle.DangerousGetHandle(), bufferPtr, buffer.Length, socketFlags); } if (bytesReceived == (int)SocketError.SocketError) @@ -335,13 +323,9 @@ namespace System.Net.Sockets public static unsafe IPPacketInformation GetIPPacketInformation(Interop.Winsock.ControlDataIPv6* controlBuffer) { - IPAddress address = IPAddress.IPv6None; - if (controlBuffer->length != UIntPtr.Zero) - { - var addressArray = new byte[Interop.Winsock.IPv6AddressLength]; - Marshal.Copy((IntPtr)(controlBuffer->address), addressArray, 0, Interop.Winsock.IPv6AddressLength); - address = new IPAddress(addressArray); - } + IPAddress address = controlBuffer->length != UIntPtr.Zero ? + new IPAddress(new Span(controlBuffer->address, Interop.Winsock.IPv6AddressLength)) : + IPAddress.IPv6None; return new IPPacketInformation(address, (int)controlBuffer->index); } @@ -503,11 +487,15 @@ namespace System.Net.Sockets { Interop.Winsock.IPMulticastRequest ipmr = new Interop.Winsock.IPMulticastRequest(); - ipmr.MulticastAddress = unchecked((int)optionValue.Group.GetAddress()); +#pragma warning disable CS0618 // Address is marked obsolete + ipmr.MulticastAddress = unchecked((int)optionValue.Group.Address); +#pragma warning restore CS0618 if (optionValue.LocalAddress != null) { - ipmr.InterfaceAddress = unchecked((int)optionValue.LocalAddress.GetAddress()); +#pragma warning disable CS0618 // Address is marked obsolete + ipmr.InterfaceAddress = unchecked((int)optionValue.LocalAddress.Address); +#pragma warning restore CS0618 } else { //this structure works w/ interfaces as well diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketTaskExtensions.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketTaskExtensions.cs index dac945a7ec..7407206222 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketTaskExtensions.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/SocketTaskExtensions.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; namespace System.Net.Sockets @@ -25,6 +26,8 @@ namespace System.Net.Sockets public static Task ReceiveAsync(this Socket socket, ArraySegment buffer, SocketFlags socketFlags) => socket.ReceiveAsync(buffer, socketFlags, fromNetworkStream: false); + public static ValueTask ReceiveAsync(this Socket socket, Memory buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default) => + socket.ReceiveAsync(buffer, socketFlags, fromNetworkStream: false, cancellationToken: cancellationToken); public static Task ReceiveAsync(this Socket socket, IList> buffers, SocketFlags socketFlags) => socket.ReceiveAsync(buffers, socketFlags); public static Task ReceiveFromAsync(this Socket socket, ArraySegment buffer, SocketFlags socketFlags, EndPoint remoteEndPoint) => @@ -34,6 +37,8 @@ namespace System.Net.Sockets public static Task SendAsync(this Socket socket, ArraySegment buffer, SocketFlags socketFlags) => socket.SendAsync(buffer, socketFlags, fromNetworkStream: false); + public static ValueTask SendAsync(this Socket socket, ReadOnlyMemory buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default) => + socket.SendAsync(buffer, socketFlags, fromNetworkStream: false, cancellationToken: cancellationToken); public static Task SendAsync(this Socket socket, IList> buffers, SocketFlags socketFlags) => socket.SendAsync(buffers, socketFlags); public static Task SendToAsync(this Socket socket, ArraySegment buffer, SocketFlags socketFlags, EndPoint remoteEP) => diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Accept.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Accept.cs new file mode 100644 index 0000000000..270b35599b --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Accept.cs @@ -0,0 +1,286 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; +using Xunit; + +namespace System.Net.Sockets.Tests +{ + public abstract class Accept : SocketTestHelperBase where T : SocketHelperBase, new() + { + [OuterLoop] // TODO: Issue #11345 + [Theory] + [MemberData(nameof(Loopbacks))] + public async Task Accept_Success(IPAddress listenAt) + { + using (Socket listen = new Socket(listenAt.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) + { + int port = listen.BindToAnonymousPort(listenAt); + listen.Listen(1); + + Task acceptTask = AcceptAsync(listen); + Assert.False(acceptTask.IsCompleted); + + using (Socket client = new Socket(listenAt.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) + { + await ConnectAsync(client, new IPEndPoint(listenAt, port)); + Socket accept = await acceptTask; + Assert.NotNull(accept); + Assert.True(accept.Connected); + Assert.Equal(client.LocalEndPoint, accept.RemoteEndPoint); + Assert.Equal(accept.LocalEndPoint, client.RemoteEndPoint); + } + } + } + + [OuterLoop] // TODO: Issue #11345 + [Theory] + [InlineData(2)] + [InlineData(5)] + public async Task Accept_ConcurrentAcceptsBeforeConnects_Success(int numberAccepts) + { + // The SyncForceNonBlocking implementation currently toggles the listener's Blocking setting + // back and force on every Accept, which causes pending sync Accepts to return EWOULDBLOCK. + // For now, just skip the test for SyncForceNonBlocking. + // TODO: Issue #22885 + if (typeof(T) == typeof(SocketHelperSyncForceNonBlocking)) + return; + + using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); + listener.Listen(numberAccepts); + + var clients = new Socket[numberAccepts]; + var servers = new Task[numberAccepts]; + + try + { + for (int i = 0; i < numberAccepts; i++) + { + clients[i] = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + servers[i] = AcceptAsync(listener); + } + + foreach (Socket client in clients) + { + await ConnectAsync(client, listener.LocalEndPoint); + } + + await Task.WhenAll(servers); + Assert.All(servers, s => Assert.Equal(TaskStatus.RanToCompletion, s.Status)); + Assert.All(servers, s => Assert.NotNull(s.Result)); + Assert.All(servers, s => Assert.True(s.Result.Connected)); + } + finally + { + foreach (Socket client in clients) + { + client?.Dispose(); + } + + foreach (Task server in servers) + { + if (server?.Status == TaskStatus.RanToCompletion) + { + server.Result.Dispose(); + } + } + } + } + } + + [OuterLoop] // TODO: Issue #11345 + [Theory] + [InlineData(2)] + [InlineData(5)] + public async Task Accept_ConcurrentAcceptsAfterConnects_Success(int numberAccepts) + { + // The SyncForceNonBlocking implementation currently toggles the listener's Blocking setting + // back and force on every Accept, which causes pending sync Accepts to return EWOULDBLOCK. + // For now, just skip the test for SyncForceNonBlocking. + // TODO: Issue #22885 + if (typeof(T) == typeof(SocketHelperSyncForceNonBlocking)) + return; + + using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); + listener.Listen(numberAccepts); + + var clients = new Socket[numberAccepts]; + var clientConnects = new Task[numberAccepts]; + var servers = new Task[numberAccepts]; + + try + { + for (int i = 0; i < numberAccepts; i++) + { + clients[i] = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + clientConnects[i] = ConnectAsync(clients[i], listener.LocalEndPoint); + } + + for (int i = 0; i < numberAccepts; i++) + { + servers[i] = AcceptAsync(listener); + } + + await Task.WhenAll(clientConnects); + Assert.All(clientConnects, c => Assert.Equal(TaskStatus.RanToCompletion, c.Status)); + + await Task.WhenAll(servers); + Assert.All(servers, s => Assert.Equal(TaskStatus.RanToCompletion, s.Status)); + Assert.All(servers, s => Assert.NotNull(s.Result)); + Assert.All(servers, s => Assert.True(s.Result.Connected)); + } + finally + { + foreach (Socket client in clients) + { + client?.Dispose(); + } + + foreach (Task server in servers) + { + if (server?.Status == TaskStatus.RanToCompletion) + { + server.Result.Dispose(); + } + } + } + } + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [ActiveIssue(17209, TestPlatforms.AnyUnix)] + public async Task Accept_WithTargetSocket_Success() + { + if (!SupportsAcceptIntoExistingSocket) + return; + + using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = listener.BindToAnonymousPort(IPAddress.Loopback); + listener.Listen(1); + + Task acceptTask = AcceptAsync(listener, server); + client.Connect(IPAddress.Loopback, port); + + Socket accepted = await acceptTask; + Assert.Same(server, accepted); + Assert.True(accepted.Connected); + } + } + + [ActiveIssue(22808, TargetFrameworkMonikers.NetFramework)] + [ActiveIssue(17209, TestPlatforms.AnyUnix)] + [OuterLoop] // TODO: Issue #11345 + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task Accept_WithTargetSocket_ReuseAfterDisconnect_Success(bool reuseSocket) + { + if (!SupportsAcceptIntoExistingSocket) + return; + + // APM mode fails currently. Issue: #22764 + if (typeof(T) == typeof(SocketHelperApm)) + return; + + using (var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (var server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = listener.BindToAnonymousPort(IPAddress.Loopback); + listener.Listen(1); + + using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + Task acceptTask = AcceptAsync(listener, server); + client.Connect(IPAddress.Loopback, port); + + Socket accepted = await acceptTask; + Assert.Same(server, accepted); + Assert.True(accepted.Connected); + } + + server.Disconnect(reuseSocket); + Assert.False(server.Connected); + + if (reuseSocket) + { + using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + Task acceptTask = AcceptAsync(listener, server); + client.Connect(IPAddress.Loopback, port); + + Socket accepted = await acceptTask; + Assert.Same(server, accepted); + Assert.True(accepted.Connected); + } + } + else + { + SocketException se = await Assert.ThrowsAsync(() => AcceptAsync(listener, server)); + Assert.Equal(SocketError.InvalidArgument, se.SocketErrorCode); + } + } + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [ActiveIssue(17209, TestPlatforms.AnyUnix)] + public void Accept_WithAlreadyBoundTargetSocket_Fails() + { + if (!SupportsAcceptIntoExistingSocket) + return; + + using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = listener.BindToAnonymousPort(IPAddress.Loopback); + listener.Listen(1); + + server.BindToAnonymousPort(IPAddress.Loopback); + + Assert.Throws(() => { AcceptAsync(listener, server); }); + } + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [ActiveIssue(17209, TestPlatforms.AnyUnix)] + public async Task Accept_WithInUseTargetSocket_Fails() + { + if (!SupportsAcceptIntoExistingSocket) + return; + + using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = listener.BindToAnonymousPort(IPAddress.Loopback); + listener.Listen(1); + + Task acceptTask = AcceptAsync(listener, server); + client.Connect(IPAddress.Loopback, port); + + Socket accepted = await acceptTask; + Assert.Same(server, accepted); + Assert.True(accepted.Connected); + + Assert.Throws(() => { AcceptAsync(listener, server); }); + } + } + } + + public sealed class AcceptSync : Accept { } + public sealed class AcceptSyncForceNonBlocking : Accept { } + public sealed class AcceptApm : Accept { } + public sealed class AcceptTask : Accept { } + public sealed class AcceptEap : Accept { } +} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/AcceptAsync.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/AcceptAsync.cs deleted file mode 100644 index 49047fa6f2..0000000000 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/AcceptAsync.cs +++ /dev/null @@ -1,410 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Net.Test.Common; -using System.Threading; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace System.Net.Sockets.Tests -{ - public class AcceptAsync - { - private readonly ITestOutputHelper _log; - - public AcceptAsync(ITestOutputHelper output) - { - _log = TestLogging.GetInstance(); - } - - public void OnAcceptCompleted(object sender, SocketAsyncEventArgs args) - { - _log.WriteLine("OnAcceptCompleted event handler"); - EventWaitHandle handle = (EventWaitHandle)args.UserToken; - handle.Set(); - } - public void OnConnectCompleted(object sender, SocketAsyncEventArgs args) - { - _log.WriteLine("OnConnectCompleted event handler"); - EventWaitHandle handle = (EventWaitHandle)args.UserToken; - handle.Set(); - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [Trait("IPv4", "true")] - public void AcceptAsync_IpV4_Success() - { - Assert.True(Capability.IPv4Support()); - - AutoResetEvent completed = new AutoResetEvent(false); - AutoResetEvent completedClient = new AutoResetEvent(false); - - using (Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - int port = sock.BindToAnonymousPort(IPAddress.Loopback); - sock.Listen(1); - - SocketAsyncEventArgs args = new SocketAsyncEventArgs(); - args.Completed += OnAcceptCompleted; - args.UserToken = completed; - - Assert.True(sock.AcceptAsync(args)); - _log.WriteLine("IPv4 Server: Waiting for clients."); - - using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - SocketAsyncEventArgs argsClient = new SocketAsyncEventArgs(); - argsClient.RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, port); - argsClient.Completed += OnConnectCompleted; - argsClient.UserToken = completedClient; - client.ConnectAsync(argsClient); - - _log.WriteLine("IPv4 Client: Connecting."); - Assert.True(completed.WaitOne(5000), "IPv4: Timed out while waiting for connection"); - - Assert.Equal(SocketError.Success, args.SocketError); - Assert.NotNull(args.AcceptSocket); - Assert.True(args.AcceptSocket.Connected, "IPv4 Accept Socket was not connected"); - Assert.NotNull(args.AcceptSocket.RemoteEndPoint); - Assert.Equal(client.LocalEndPoint, args.AcceptSocket.RemoteEndPoint); - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [Trait("IPv6", "true")] - public void AcceptAsync_IPv6_Success() - { - Assert.True(Capability.IPv6Support()); - - AutoResetEvent completed = new AutoResetEvent(false); - AutoResetEvent completedClient = new AutoResetEvent(false); - - using (Socket sock = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) - { - int port = sock.BindToAnonymousPort(IPAddress.IPv6Loopback); - sock.Listen(1); - - SocketAsyncEventArgs args = new SocketAsyncEventArgs(); - args.Completed += OnAcceptCompleted; - args.UserToken = completed; - - Assert.True(sock.AcceptAsync(args)); - _log.WriteLine("IPv6 Server: Waiting for clients."); - - using (Socket client = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) - { - SocketAsyncEventArgs argsClient = new SocketAsyncEventArgs(); - argsClient.RemoteEndPoint = new IPEndPoint(IPAddress.IPv6Loopback, port); - argsClient.Completed += OnConnectCompleted; - argsClient.UserToken = completedClient; - client.ConnectAsync(argsClient); - - _log.WriteLine("IPv6 Client: Connecting."); - Assert.True(completed.WaitOne(5000), "IPv6: Timed out while waiting for connection"); - - Assert.Equal(SocketError.Success, args.SocketError); - Assert.NotNull(args.AcceptSocket); - Assert.True(args.AcceptSocket.Connected, "IPv6 Accept Socket was not connected"); - Assert.NotNull(args.AcceptSocket.RemoteEndPoint); - Assert.Equal(client.LocalEndPoint, args.AcceptSocket.RemoteEndPoint); - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(2)] - [InlineData(5)] - public async Task AcceptAsync_ConcurrentAcceptsBeforeConnects_Success(int numberAccepts) - { - using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); - listener.Listen(numberAccepts); - - var clients = new Socket[numberAccepts]; - var servers = new Task[numberAccepts]; - - try - { - for (int i = 0; i < numberAccepts; i++) - { - clients[i] = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - servers[i] = listener.AcceptAsync(); - } - - foreach (Socket client in clients) - { - client.Connect(listener.LocalEndPoint); - } - - await Task.WhenAll(servers); - Assert.All(servers, s => Assert.Equal(TaskStatus.RanToCompletion, s.Status)); - Assert.All(servers, s => Assert.NotNull(s.Result)); - Assert.All(servers, s => Assert.True(s.Result.Connected)); - } - finally - { - foreach (Socket client in clients) - { - client?.Dispose(); - } - - foreach (Task server in servers) - { - if (server?.Status == TaskStatus.RanToCompletion) - { - server.Result.Dispose(); - } - } - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(2)] - [InlineData(5)] - public async Task AcceptAsync_ConcurrentAcceptsAfterConnects_Success(int numberAccepts) - { - using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - listener.Bind(new IPEndPoint(IPAddress.Loopback, 0)); - listener.Listen(numberAccepts); - - var clients = new Socket[numberAccepts]; - var clientConnects = new Task[numberAccepts]; - var servers = new Task[numberAccepts]; - - try - { - for (int i = 0; i < numberAccepts; i++) - { - clients[i] = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - clientConnects[i] = clients[i].ConnectAsync(listener.LocalEndPoint); - } - - for (int i = 0; i < numberAccepts; i++) - { - servers[i] = listener.AcceptAsync(); - } - - await Task.WhenAll(clientConnects); - Assert.All(clientConnects, c => Assert.Equal(TaskStatus.RanToCompletion, c.Status)); - - await Task.WhenAll(servers); - Assert.All(servers, s => Assert.Equal(TaskStatus.RanToCompletion, s.Status)); - Assert.All(servers, s => Assert.NotNull(s.Result)); - Assert.All(servers, s => Assert.True(s.Result.Connected)); - } - finally - { - foreach (Socket client in clients) - { - client?.Dispose(); - } - - foreach (Task server in servers) - { - if (server?.Status == TaskStatus.RanToCompletion) - { - server.Result.Dispose(); - } - } - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [PlatformSpecific(TestPlatforms.Windows)] // Unix platforms don't yet support receiving data with AcceptAsync. - public void AcceptAsync_WithReceiveBuffer_Success() - { - Assert.True(Capability.IPv4Support()); - - AutoResetEvent accepted = new AutoResetEvent(false); - - using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - int port = server.BindToAnonymousPort(IPAddress.Loopback); - server.Listen(1); - - const int acceptBufferOverheadSize = 288; // see https://msdn.microsoft.com/en-us/library/system.net.sockets.socket.acceptasync(v=vs.110).aspx - const int acceptBufferDataSize = 256; - const int acceptBufferSize = acceptBufferOverheadSize + acceptBufferDataSize; - - byte[] sendBuffer = new byte[acceptBufferDataSize]; - new Random().NextBytes(sendBuffer); - - SocketAsyncEventArgs acceptArgs = new SocketAsyncEventArgs(); - acceptArgs.Completed += OnAcceptCompleted; - acceptArgs.UserToken = accepted; - acceptArgs.SetBuffer(new byte[acceptBufferSize], 0, acceptBufferSize); - - Assert.True(server.AcceptAsync(acceptArgs)); - _log.WriteLine("IPv4 Server: Waiting for clients."); - - using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - client.Connect(IPAddress.Loopback, port); - client.Send(sendBuffer); - client.Shutdown(SocketShutdown.Both); - } - - Assert.True( - accepted.WaitOne(TestSettings.PassingTestTimeout), "Test completed in alotted time"); - - Assert.Equal( - SocketError.Success, acceptArgs.SocketError); - - Assert.Equal( - acceptBufferDataSize, acceptArgs.BytesTransferred); - - Assert.Equal( - new ArraySegment(sendBuffer), - new ArraySegment(acceptArgs.Buffer, 0, acceptArgs.BytesTransferred)); - } - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [PlatformSpecific(TestPlatforms.Windows)] // Unix platforms don't yet support receiving data with AcceptAsync. - public void AcceptAsync_WithTooSmallReceiveBuffer_Failure() - { - using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - int port = server.BindToAnonymousPort(IPAddress.Loopback); - server.Listen(1); - - SocketAsyncEventArgs acceptArgs = new SocketAsyncEventArgs(); - acceptArgs.Completed += OnAcceptCompleted; - acceptArgs.UserToken = new ManualResetEvent(false); - - byte[] buffer = new byte[1]; - acceptArgs.SetBuffer(buffer, 0, buffer.Length); - - AssertExtensions.Throws(null, () => server.AcceptAsync(acceptArgs)); - } - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [ActiveIssue(17209, TestPlatforms.AnyUnix)] - public void AcceptAsync_WithTargetSocket_Success() - { - using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - int port = listener.BindToAnonymousPort(IPAddress.Loopback); - listener.Listen(1); - - Task acceptTask = listener.AcceptAsync(server); - client.Connect(IPAddress.Loopback, port); - Assert.Same(server, acceptTask.Result); - } - } - - [ActiveIssue(17209, TestPlatforms.AnyUnix)] - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(false)] - [InlineData(true)] - public void AcceptAsync_WithTargetSocket_ReuseAfterDisconnect_Success(bool reuseSocket) - { - using (var listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - using (var server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - using (var saea = new SocketAsyncEventArgs()) - { - int port = listener.BindToAnonymousPort(IPAddress.Loopback); - listener.Listen(1); - - var are = new AutoResetEvent(false); - saea.Completed += delegate { are.Set(); }; - saea.AcceptSocket = server; - - using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - Assert.True(listener.AcceptAsync(saea)); - client.Connect(IPAddress.Loopback, port); - are.WaitOne(); - Assert.Same(server, saea.AcceptSocket); - Assert.True(server.Connected); - } - - server.Disconnect(reuseSocket); - Assert.False(server.Connected); - - if (reuseSocket) - { - using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - Assert.True(listener.AcceptAsync(saea)); - client.Connect(IPAddress.Loopback, port); - are.WaitOne(); - Assert.Same(server, saea.AcceptSocket); - Assert.True(server.Connected); - } - } - else - { - if (listener.AcceptAsync(saea)) - { - are.WaitOne(); - } - Assert.Equal(SocketError.InvalidArgument, saea.SocketError); - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [ActiveIssue(17209, TestPlatforms.AnyUnix)] - public void AcceptAsync_WithAlreadyBoundTargetSocket_Failed() - { - using (Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - int port = listener.BindToAnonymousPort(IPAddress.Loopback); - listener.Listen(1); - - server.BindToAnonymousPort(IPAddress.Loopback); - - Assert.Throws(() => { listener.AcceptAsync(server); }); - } - } - - [OuterLoop] // TODO: Issue #11345 - [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Unix platforms don't yet support receiving data with AcceptAsync. - public void AcceptAsync_WithReceiveBuffer_Failure() - { - // - // Unix platforms don't yet support receiving data with AcceptAsync. - // - - Assert.True(Capability.IPv4Support()); - - using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - int port = server.BindToAnonymousPort(IPAddress.Loopback); - server.Listen(1); - - SocketAsyncEventArgs acceptArgs = new SocketAsyncEventArgs(); - acceptArgs.Completed += OnAcceptCompleted; - acceptArgs.UserToken = new ManualResetEvent(false); - - byte[] buffer = new byte[1024]; - acceptArgs.SetBuffer(buffer, 0, buffer.Length); - - Assert.Throws(() => server.AcceptAsync(acceptArgs)); - } - } - } -} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ArgumentValidationTests.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ArgumentValidationTests.cs index 9784c5d1b5..436e324462 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ArgumentValidationTests.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ArgumentValidationTests.cs @@ -254,7 +254,7 @@ namespace System.Net.Sockets.Tests public void Send_Buffers_NullBuffers_Throws_ArgumentNull() { SocketError errorCode; - Assert.Throws(() => GetSocket().Send(null, SocketFlags.None, out errorCode)); + Assert.Throws(() => GetSocket().Send((IList>)null, SocketFlags.None, out errorCode)); } [Fact] @@ -321,7 +321,7 @@ namespace System.Net.Sockets.Tests public void Receive_Buffers_NullBuffers_Throws_ArgumentNull() { SocketError errorCode; - Assert.Throws(() => GetSocket().Receive(null, SocketFlags.None, out errorCode)); + Assert.Throws(() => GetSocket().Receive((IList>)null, SocketFlags.None, out errorCode)); } [Fact] diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Configurations.props b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Configurations.props index c398e42e89..77a4b65bc9 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Configurations.props +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Configurations.props @@ -3,6 +3,7 @@ netstandard; + netcoreapp; \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Connect.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Connect.cs new file mode 100644 index 0000000000..4b1c372ecc --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Connect.cs @@ -0,0 +1,94 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; +using Xunit; + +namespace System.Net.Sockets.Tests +{ + public abstract class Connect : SocketTestHelperBase where T : SocketHelperBase, new() + { + [OuterLoop] // TODO: Issue #11345 + [Theory] + [MemberData(nameof(Loopbacks))] + public void Connect_Success(IPAddress listenAt) + { + int port; + using (SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, listenAt, out port)) + { + using (Socket client = new Socket(listenAt.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) + { + Task connectTask = ConnectAsync(client, new IPEndPoint(listenAt, port)); + Assert.True(connectTask.Wait(TestSettings.PassingTestTimeout), "IPv4: Timed out while waiting for connection"); + Assert.True(client.Connected); + } + } + } + + [OuterLoop] // TODO: Issue #11345 + [Theory] + [MemberData(nameof(Loopbacks))] + public void Connect_MultipleIPAddresses_Success(IPAddress listenAt) + { + if (!SupportsMultiConnect) + return; + + int port; + using (SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, listenAt, out port)) + using (Socket client = new Socket(listenAt.AddressFamily, SocketType.Stream, ProtocolType.Tcp)) + { + Task connectTask = MultiConnectAsync(client, new IPAddress[] { IPAddress.Loopback, IPAddress.IPv6Loopback }, port); + Assert.True(connectTask.Wait(TestSettings.PassingTestTimeout), "Timed out while waiting for connection"); + Assert.True(client.Connected); + } + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [ActiveIssue(22765, TestPlatforms.AnyUnix)] + public async Task Connect_OnConnectedSocket_Fails() + { + int port; + using (SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, IPAddress.Loopback, out port)) + using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + await ConnectAsync(client, new IPEndPoint(IPAddress.Loopback, port)); + + // In the sync case, we throw a derived exception here, so need to use ThrowsAnyAsync + SocketException se = await Assert.ThrowsAnyAsync(() => ConnectAsync(client, new IPEndPoint(IPAddress.Loopback, port))); + Assert.Equal(SocketError.IsConnected, se.SocketErrorCode); + } + } + + [PlatformSpecific(TestPlatforms.Windows)] // Unix currently does not support Disconnect + [OuterLoop] // TODO: Issue #11345 + [Fact] + public async Task Connect_AfterDisconnect_Fails() + { + int port; + using (SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, IPAddress.Loopback, out port)) + using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + await ConnectAsync(client, new IPEndPoint(IPAddress.Loopback, port)); + client.Disconnect(reuseSocket: false); + + if (ConnectAfterDisconnectResultsInInvalidOperationException) + { + await Assert.ThrowsAsync(() => ConnectAsync(client, new IPEndPoint(IPAddress.Loopback, port))); + } + else + { + SocketException se = await Assert.ThrowsAsync(() => ConnectAsync(client, new IPEndPoint(IPAddress.Loopback, port))); + Assert.Equal(SocketError.IsConnected, se.SocketErrorCode); + } + } + } + } + + public sealed class ConnectSync : Connect { } + public sealed class ConnectSyncForceNonBlocking : Connect { } + public sealed class ConnectApm : Connect { } + public sealed class ConnectTask : Connect { } + public sealed class ConnectEap : Connect { } +} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ConnectAsync.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ConnectAsync.cs deleted file mode 100644 index 475a4e50fb..0000000000 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ConnectAsync.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Net.Test.Common; -using System.Threading; -using System.Threading.Tasks; -using Xunit; -using Xunit.Abstractions; - -namespace System.Net.Sockets.Tests -{ - public class ConnectAsync - { - private readonly ITestOutputHelper _log; - - public ConnectAsync(ITestOutputHelper output) - { - _log = TestLogging.GetInstance(); - Assert.True(Capability.IPv4Support() || Capability.IPv6Support()); - } - - public void OnConnectCompleted(object sender, SocketAsyncEventArgs args) - { - EventWaitHandle handle = (EventWaitHandle)args.UserToken; - handle.Set(); - } - - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(SocketImplementationType.APM)] - [InlineData(SocketImplementationType.Async)] - [Trait("IPv4", "true")] - public void ConnectAsync_IPv4_Success(SocketImplementationType type) - { - Assert.True(Capability.IPv4Support()); - - AutoResetEvent completed = new AutoResetEvent(false); - - int port; - using (SocketTestServer.SocketTestServerFactory(type, IPAddress.Loopback, out port)) - { - SocketAsyncEventArgs args = new SocketAsyncEventArgs(); - args.RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, port); - args.Completed += OnConnectCompleted; - args.UserToken = completed; - - using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - Assert.True(client.ConnectAsync(args)); - Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "IPv4: Timed out while waiting for connection"); - Assert.Equal(SocketError.Success, args.SocketError); - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(SocketImplementationType.APM)] - [InlineData(SocketImplementationType.Async)] - [Trait("IPv6", "true")] - public void ConnectAsync_IPv6_Success(SocketImplementationType type) - { - Assert.True(Capability.IPv6Support()); - - AutoResetEvent completed = new AutoResetEvent(false); - - int port; - using (SocketTestServer.SocketTestServerFactory(type, IPAddress.IPv6Loopback, out port)) - { - SocketAsyncEventArgs args = new SocketAsyncEventArgs(); - args.RemoteEndPoint = new IPEndPoint(IPAddress.IPv6Loopback, port); - args.Completed += OnConnectCompleted; - args.UserToken = completed; - - using (Socket client = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) - { - Assert.True(client.ConnectAsync(args)); - Assert.True(completed.WaitOne(TestSettings.PassingTestTimeout), "IPv6: Timed out while waiting for connection"); - Assert.Equal(SocketError.Success, args.SocketError); - } - } - } - - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(AddressFamily.InterNetwork)] - [InlineData(AddressFamily.InterNetworkV6)] - public async Task ConnectTaskAsync_IPAddresss_Success(AddressFamily family) - { - int port; - using (SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, family == AddressFamily.InterNetwork ? IPAddress.Loopback : IPAddress.IPv6Loopback, out port)) - using (Socket client = new Socket(family, SocketType.Stream, ProtocolType.Tcp)) - { - await client.ConnectAsync(new IPAddress[] { IPAddress.Loopback, IPAddress.IPv6Loopback }, port); - Assert.True(client.Connected); - } - } - - [PlatformSpecific(TestPlatforms.Windows)] // Unix currently does not support Disconnect - [OuterLoop] // TODO: Issue #11345 - [Fact] - public async Task Connect_AfterDisconnect_Fails() - { - int port; - using (SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, IPAddress.Loopback, out port)) - using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) - { - await client.ConnectAsync(IPAddress.Loopback, port); - client.Disconnect(reuseSocket: false); - Assert.Throws(() => client.Connect(IPAddress.Loopback, port)); - Assert.Throws(() => client.Connect(new IPEndPoint(IPAddress.Loopback, port))); - } - } - } -} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ConnectExTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ConnectExTest.cs deleted file mode 100644 index 779f8b9f17..0000000000 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ConnectExTest.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Net.Test.Common; -using System.Threading; - -using Xunit; -using Xunit.Abstractions; - -namespace System.Net.Sockets.Tests -{ - public class ConnectExTest - { - private readonly ITestOutputHelper _log; - - public ConnectExTest(ITestOutputHelper output) - { - _log = TestLogging.GetInstance(); - } - - private static void OnConnectAsyncCompleted(object sender, SocketAsyncEventArgs args) - { - ManualResetEvent complete = (ManualResetEvent)args.UserToken; - complete.Set(); - } - - [OuterLoop] // TODO: Issue #11345 - [Theory] - [InlineData(SocketImplementationType.APM)] - [InlineData(SocketImplementationType.Async)] - [Trait("IPv4", "true")] - [Trait("IPv6", "true")] - public void ConnectEx_Success(SocketImplementationType type) - { - Assert.True(Capability.IPv4Support() && Capability.IPv6Support()); - - int port; - SocketTestServer server = SocketTestServer.SocketTestServerFactory(type, IPAddress.Loopback, out port); - - int port6; - SocketTestServer server6 = SocketTestServer.SocketTestServerFactory(type, IPAddress.IPv6Loopback, out port6); - - Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - - try - { - SocketAsyncEventArgs args = new SocketAsyncEventArgs(); - args.RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, port); - args.Completed += OnConnectAsyncCompleted; - - ManualResetEvent complete = new ManualResetEvent(false); - args.UserToken = complete; - - Assert.True(sock.ConnectAsync(args)); - Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "IPv4: Timed out while waiting for connection"); - Assert.True(args.SocketError == SocketError.Success); - - sock.Dispose(); - - sock = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp); - args.RemoteEndPoint = new IPEndPoint(IPAddress.IPv6Loopback, port6); - complete.Reset(); - - Assert.True(sock.ConnectAsync(args)); - Assert.True(complete.WaitOne(TestSettings.PassingTestTimeout), "IPv6: Timed out while waiting for connection"); - Assert.True(args.SocketError == SocketError.Success); - } - finally - { - sock.Dispose(); - - server.Dispose(); - server6.Dispose(); - } - } - } -} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs.REMOVED.git-id b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs.REMOVED.git-id index 477f765021..4fa3b94bc0 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs.REMOVED.git-id +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs.REMOVED.git-id @@ -1 +1 @@ -ef120ada456f292695655c3e53e9b882ec68bd5d \ No newline at end of file +fba1acd2981dbca4cd81d47d3c20272000a172bb \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs index ed563de7ad..8be951fd69 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/LoggingTest.cs @@ -6,7 +6,6 @@ using System.Collections.Concurrent; using System.Diagnostics; using System.Diagnostics.Tracing; using Xunit; -using Xunit.Abstractions; namespace System.Net.Sockets.Tests { @@ -41,17 +40,17 @@ namespace System.Net.Sockets.Tests { // Invoke several tests to execute code paths while tracing is enabled - new SendReceiveSync(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); - new SendReceiveSync(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); + new SendReceiveSync().SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); + new SendReceiveSync().SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); - new SendReceiveTask(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); - new SendReceiveTask(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); + new SendReceiveTask().SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); + new SendReceiveTask().SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); - new SendReceiveEap(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); - new SendReceiveEap(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); + new SendReceiveEap().SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); + new SendReceiveEap().SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); - new SendReceiveApm(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); - new SendReceiveApm(new NullTestOutputHelper()).SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); + new SendReceiveApm().SendRecv_Stream_TCP(IPAddress.Loopback, false).GetAwaiter(); + new SendReceiveApm().SendRecv_Stream_TCP(IPAddress.Loopback, true).GetAwaiter(); new NetworkStreamTest().CopyToAsync_AllDataCopied(4096).GetAwaiter().GetResult(); new NetworkStreamTest().Timeout_ValidData_Roundtrips().GetAwaiter().GetResult(); @@ -62,11 +61,5 @@ namespace System.Net.Sockets.Tests return SuccessExitCode; }).Dispose(); } - - private sealed class NullTestOutputHelper : ITestOutputHelper - { - public void WriteLine(string message) { } - public void WriteLine(string format, params object[] args) { } - } } } diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs index e6e36ae068..d4a50d03a6 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs @@ -10,7 +10,7 @@ using Xunit; namespace System.Net.Sockets.Tests { - public class NetworkStreamTest + public partial class NetworkStreamTest { [Fact] public void Ctor_NullSocket_ThrowsArgumentNullExceptions() @@ -455,7 +455,7 @@ namespace System.Net.Sockets.Tests } [Fact] - public async Task ReadWrite_Success() + public async Task ReadWrite_Array_Success() { await RunWithConnectedNetworkStreamsAsync((server, client) => { diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.netcoreapp.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.netcoreapp.cs new file mode 100644 index 0000000000..bcf29d4bb5 --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.netcoreapp.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.Net.Sockets.Tests +{ + public partial class NetworkStreamTest + { + [Fact] + public async Task ReadWrite_Span_Success() + { + await RunWithConnectedNetworkStreamsAsync((server, client) => + { + var clientData = new byte[] { 42 }; + + client.Write((ReadOnlySpan)clientData); + + var serverData = new byte[clientData.Length]; + Assert.Equal(serverData.Length, server.Read((Span)serverData)); + + Assert.Equal(clientData, serverData); + return Task.CompletedTask; + }); + } + + [Fact] + public async Task ReadWrite_Memory_Success() + { + await RunWithConnectedNetworkStreamsAsync(async (server, client) => + { + var clientData = new byte[] { 42 }; + + await client.WriteAsync((ReadOnlyMemory)clientData); + + var serverData = new byte[clientData.Length]; + Assert.Equal(serverData.Length, await server.ReadAsync((Memory)serverData)); + + Assert.Equal(clientData, serverData); + }); + } + + [Fact] + public async Task ReadWrite_Precanceled_Throws() + { + await RunWithConnectedNetworkStreamsAsync(async (server, client) => + { + await Assert.ThrowsAnyAsync(() => server.WriteAsync((ArraySegment)new byte[0], new CancellationToken(true))); + await Assert.ThrowsAnyAsync(() => server.ReadAsync((ArraySegment)new byte[0], new CancellationToken(true)).AsTask()); + + await Assert.ThrowsAnyAsync(() => server.WriteAsync((ReadOnlyMemory)new byte[0], new CancellationToken(true))); + await Assert.ThrowsAnyAsync(() => server.ReadAsync((Memory)new byte[0], new CancellationToken(true)).AsTask()); + }); + } + } +} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs index 5bb5f6d6f6..da3fd07c59 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs @@ -11,8 +11,10 @@ namespace System.Net.Sockets.Tests public class ReceiveMessageFrom { [OuterLoop] // TODO: Issue #11345 - [Fact] - public void Success() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void Success(bool forceNonBlocking) { if (Socket.OSSupportsIPv4) { @@ -21,9 +23,13 @@ namespace System.Net.Sockets.Tests int port = receiver.BindToAnonymousPort(IPAddress.Loopback); receiver.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.PacketInformation, true); + receiver.ForceNonBlocking(forceNonBlocking); + Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sender.Bind(new IPEndPoint(IPAddress.Loopback, 0)); + sender.ForceNonBlocking(forceNonBlocking); + for (int i = 0; i < TestSettings.UDPRedundancy; i++) { sender.SendTo(new byte[1024], new IPEndPoint(IPAddress.Loopback, port)); @@ -45,8 +51,10 @@ namespace System.Net.Sockets.Tests } [OuterLoop] // TODO: Issue #11345 - [Fact] - public void Success_IPv6() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void Success_IPv6(bool forceNonBlocking) { if (Socket.OSSupportsIPv6) { @@ -55,9 +63,13 @@ namespace System.Net.Sockets.Tests int port = receiver.BindToAnonymousPort(IPAddress.IPv6Loopback); receiver.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.PacketInformation, true); + receiver.ForceNonBlocking(forceNonBlocking); + Socket sender = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp); sender.Bind(new IPEndPoint(IPAddress.IPv6Loopback, 0)); + sender.ForceNonBlocking(forceNonBlocking); + for (int i = 0; i < TestSettings.UDPRedundancy; i++) { sender.SendTo(new byte[1024], new IPEndPoint(IPAddress.IPv6Loopback, port)); diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs index a76534664d..720eca5913 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs @@ -146,7 +146,7 @@ namespace System.Net.Sockets.Tests } [PlatformSpecific(~TestPlatforms.OSX)] // typical OSX install has very low max open file descriptors value - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/989 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // https://github.com/Microsoft/BashOnWindows/issues/308 public void Select_Error_OneReadyAtATime() { const int Errors = 90; // value larger than the internal value in SocketPal.Unix that swaps between stack and heap allocation diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendFile.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendFile.cs index 1d73451148..dd6c0e1241 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendFile.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendFile.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -27,6 +28,15 @@ namespace System.Net.Sockets.Tests } } + public static IEnumerable SendFileSync_MemberData() + { + foreach (object[] memberData in SendFile_MemberData()) + { + yield return memberData.Concat(new object[] { true }).ToArray(); + yield return memberData.Concat(new object[] { false }).ToArray(); + } + } + private string CreateFileToSend(int size, bool sendPreAndPostBuffers, out byte[] preBuffer, out byte[] postBuffer, out Fletcher32 checksum) { // Create file to send @@ -97,8 +107,8 @@ namespace System.Net.Sockets.Tests [OuterLoop] // TODO: Issue #11345 [Theory] - [MemberData(nameof(SendFile_MemberData))] - public void SendFile_Synchronous(IPAddress listenAt, bool sendPreAndPostBuffers, int bytesToSend) + [MemberData(nameof(SendFileSync_MemberData))] + public void SendFile_Synchronous(IPAddress listenAt, bool sendPreAndPostBuffers, int bytesToSend, bool forceNonBlocking) { const int ListenBacklog = 1; const int TestTimeout = 30000; @@ -115,6 +125,8 @@ namespace System.Net.Sockets.Tests server.Listen(ListenBacklog); + server.ForceNonBlocking(forceNonBlocking); + int bytesReceived = 0; var receivedChecksum = new Fletcher32(); var serverThread = new Thread(() => @@ -124,6 +136,8 @@ namespace System.Net.Sockets.Tests Socket remote = server.Accept(); Assert.NotNull(remote); + remote.ForceNonBlocking(forceNonBlocking); + using (remote) { var recvBuffer = new byte[256]; @@ -146,6 +160,9 @@ namespace System.Net.Sockets.Tests // Run client EndPoint clientEndpoint = server.LocalEndPoint; var client = new Socket(clientEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + + client.ForceNonBlocking(forceNonBlocking); + client.Connect(clientEndpoint); using (client) diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs index 0ca741d082..fa4274f14d 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.cs @@ -3,37 +3,14 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Xunit; -using Xunit.Abstractions; namespace System.Net.Sockets.Tests { - public abstract class SendReceive : MemberDatas + public abstract class SendReceive : SocketTestHelperBase where T : SocketHelperBase, new() { - private readonly ITestOutputHelper _log; - - public SendReceive(ITestOutputHelper output) - { - _log = output; - } - - public abstract Task AcceptAsync(Socket s); - public abstract Task ConnectAsync(Socket s, EndPoint endPoint); - public abstract Task ReceiveAsync(Socket s, ArraySegment buffer); - public abstract Task ReceiveFromAsync( - Socket s, ArraySegment buffer, EndPoint endPoint); - public abstract Task ReceiveAsync(Socket s, IList> bufferList); - public abstract Task SendAsync(Socket s, ArraySegment buffer); - public abstract Task SendAsync(Socket s, IList> bufferList); - public abstract Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endpoint); - public virtual bool GuaranteedSendOrdering => true; - public virtual bool ValidatesArrayArguments => true; - public virtual bool UsesSync => false; - public virtual bool DisposeDuringOperationResultsInDisposedException => false; - [Theory] [InlineData(null, 0, 0)] // null array [InlineData(1, -1, 0)] // offset low @@ -858,6 +835,207 @@ namespace System.Net.Sockets.Tests } } + public class SendReceive + { + [Fact] + public void SendRecvIovMaxTcp_Success() + { + // sending/receiving more than IOV_MAX segments causes EMSGSIZE on some platforms. + // This is handled internally for stream sockets so this error shouldn't surface. + + // Use more than IOV_MAX (1024 on Linux & macOS) segments. + const int SegmentCount = 2400; + using (var server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + server.BindToAnonymousPort(IPAddress.Loopback); + server.Listen(1); + + var sendBuffer = new byte[SegmentCount]; + Task serverProcessingTask = Task.Run(() => + { + using (Socket acceptSocket = server.Accept()) + { + // send data as SegmentCount (> IOV_MAX) 1-byte segments. + var sendSegments = new List>(); + for (int i = 0; i < SegmentCount; i++) + { + sendBuffer[i] = (byte)i; + sendSegments.Add(new ArraySegment(sendBuffer, i, 1)); + } + SocketError error; + // Send blocks until all segments are sent. + int bytesSent = acceptSocket.Send(sendSegments, SocketFlags.None, out error); + + Assert.Equal(SegmentCount, bytesSent); + Assert.Equal(SocketError.Success, error); + } + }); + + using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + client.Connect(server.LocalEndPoint); + + // receive data as 1-byte segments. + var receiveBuffer = new byte[SegmentCount]; + var receiveSegments = new List>(); + for (int i = 0; i < SegmentCount; i++) + { + receiveSegments.Add(new ArraySegment(receiveBuffer, i, 1)); + } + var bytesReceivedTotal = 0; + do + { + SocketError error; + // Receive can return up to IOV_MAX segments. + int bytesReceived = client.Receive(receiveSegments, SocketFlags.None, out error); + bytesReceivedTotal += bytesReceived; + // Offset receiveSegments for next Receive. + receiveSegments.RemoveRange(0, bytesReceived); + + Assert.NotEqual(0, bytesReceived); + Assert.Equal(SocketError.Success, error); + } while (bytesReceivedTotal != SegmentCount); + + Assert.Equal(sendBuffer, receiveBuffer); + } + } + } + + [Fact] + public void SendIovMaxUdp_SuccessOrMessageSize() + { + // sending more than IOV_MAX segments causes EMSGSIZE on some platforms. + // We handle this for stream sockets by truncating. + // This test verifies we are not truncating non-stream sockets. + + // Use more than IOV_MAX (1024 on Linux & macOS) segments + // and less than Ethernet MTU. + const int SegmentCount = 1200; + using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) + { + socket.BindToAnonymousPort(IPAddress.Loopback); + // Use our own address as destination. + socket.Connect(socket.LocalEndPoint); + + var sendBuffer = new byte[SegmentCount]; + var sendSegments = new List>(); + for (int i = 0; i < SegmentCount; i++) + { + sendBuffer[i] = (byte)i; + sendSegments.Add(new ArraySegment(sendBuffer, i, 1)); + } + + SocketError error; + // send data as SegmentCount (> IOV_MAX) 1-byte segments. + int bytesSent = socket.Send(sendSegments, SocketFlags.None, out error); + if (error == SocketError.Success) + { + // platform sent message with > IOV_MAX segments + Assert.Equal(SegmentCount, bytesSent); + } + else + { + // platform returns EMSGSIZE + Assert.Equal(SocketError.MessageSize, error); + Assert.Equal(0, bytesSent); + } + } + } + + [Fact] + public async Task ReceiveIovMaxUdp_SuccessOrMessageSize() + { + // receiving more than IOV_MAX segments causes EMSGSIZE on some platforms. + // We handle this for stream sockets by truncating. + // This test verifies we are not truncating non-stream sockets. + + // Use more than IOV_MAX (1024 on Linux & macOS) segments + // and less than Ethernet MTU. + const int SegmentCount = 1200; + var sender = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + sender.BindToAnonymousPort(IPAddress.Loopback); + var receiver = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + receiver.Connect(sender.LocalEndPoint); // only receive from sender + EndPoint receiverEndPoint = receiver.LocalEndPoint; + + Task receiveTask = Task.Run(() => + { + using (receiver) + { + var receiveBuffer = new byte[SegmentCount]; + var receiveSegments = new List>(); + for (int i = 0; i < SegmentCount; i++) + { + receiveSegments.Add(new ArraySegment(receiveBuffer, i, 1)); + } + // receive data as SegmentCount (> IOV_MAX) 1-byte segments. + SocketError error; + int bytesReceived = receiver.Receive(receiveSegments, SocketFlags.None, out error); + + if (error == SocketError.Success) + { + // platform received message in > IOV_MAX segments + Assert.Equal(SegmentCount, bytesReceived); + } + else + { + // platform returns EMSGSIZE + Assert.Equal(SocketError.MessageSize, error); + Assert.Equal(0, bytesReceived); + } + } + }); + + using (sender) + { + sender.Connect(receiverEndPoint); + var sendBuffer = new byte[SegmentCount]; + for (int i = 0; i < 10; i++) // UDPRedundancy + { + int bytesSent = sender.Send(sendBuffer); + Assert.Equal(SegmentCount, bytesSent); + await Task.WhenAny(receiveTask, Task.Delay(1)); + if (receiveTask.IsCompleted) + { + break; + } + } + } + + Assert.True(receiveTask.IsCompleted); + await receiveTask; + } + + [Fact] + [PlatformSpecific(~TestPlatforms.Windows)] // All data is sent, even when very large (100M). + public void SocketSendWouldBlock_ReturnsBytesSent() + { + using (var server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + // listen + server.BindToAnonymousPort(IPAddress.Loopback); + server.Listen(1); + // connect + client.Connect(server.LocalEndPoint); + // accept + using (Socket socket = server.Accept()) + { + // We send a large amount of data but don't read it. + // A chunck will be sent, attempts to send more will return SocketError.WouldBlock. + // Socket.Send must return the success of the partial send. + socket.Blocking = false; + var data = new byte[5_000_000]; + SocketError error; + int bytesSent = socket.Send(data, 0, data.Length, SocketFlags.None, out error); + + Assert.Equal(SocketError.Success, error); + Assert.InRange(bytesSent, 1, data.Length - 1); + } + } + } + } + public sealed class SendReceiveUdpClient : MemberDatas { [OuterLoop] // TODO: Issue #11345 @@ -870,8 +1048,8 @@ namespace System.Net.Sockets.Tests // TODO #5185: harden against packet loss const int DatagramSize = 256; const int DatagramsToSend = 256; - const int AckTimeout = 1000; - const int TestTimeout = 30000; + const int AckTimeout = 10000; + const int TestTimeout = 60000; using (var left = new UdpClient(new IPEndPoint(leftAddress, 0))) using (var right = new UdpClient(new IPEndPoint(rightAddress, 0))) @@ -1014,229 +1192,9 @@ namespace System.Net.Sockets.Tests } } - public sealed class SendReceiveSync : SendReceive - { - public SendReceiveSync(ITestOutputHelper output) : base(output) { } - public override Task AcceptAsync(Socket s) => - Task.Run(() => s.Accept()); - public override Task ConnectAsync(Socket s, EndPoint endPoint) => - Task.Run(() => s.Connect(endPoint)); - public override Task ReceiveAsync(Socket s, ArraySegment buffer) => - Task.Run(() => s.Receive(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None)); - public override Task ReceiveAsync(Socket s, IList> bufferList) => - Task.Run(() => s.Receive(bufferList, SocketFlags.None)); - public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - Task.Run(() => - { - int received = s.ReceiveFrom(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, ref endPoint); - return new SocketReceiveFromResult - { - ReceivedBytes = received, - RemoteEndPoint = endPoint - }; - }); - public override Task SendAsync(Socket s, ArraySegment buffer) => - Task.Run(() => s.Send(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None)); - public override Task SendAsync(Socket s, IList> bufferList) => - Task.Run(() => s.Send(bufferList, SocketFlags.None)); - public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - Task.Run(() => s.SendTo(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, endPoint)); - - public override bool GuaranteedSendOrdering => false; - public override bool UsesSync => true; - } - - public sealed class SendReceiveApm : SendReceive - { - public SendReceiveApm(ITestOutputHelper output) : base(output) { } - public override bool DisposeDuringOperationResultsInDisposedException => true; - public override Task AcceptAsync(Socket s) => - Task.Factory.FromAsync(s.BeginAccept, s.EndAccept, null); - public override Task ConnectAsync(Socket s, EndPoint endPoint) => - Task.Factory.FromAsync(s.BeginConnect, s.EndConnect, endPoint, null); - public override Task ReceiveAsync(Socket s, ArraySegment buffer) => - Task.Factory.FromAsync((callback, state) => - s.BeginReceive(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, callback, state), - s.EndReceive, null); - public override Task ReceiveAsync(Socket s, IList> bufferList) => - Task.Factory.FromAsync(s.BeginReceive, s.EndReceive, bufferList, SocketFlags.None, null); - public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) - { - var tcs = new TaskCompletionSource(); - s.BeginReceiveFrom(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, ref endPoint, iar => - { - try - { - int receivedBytes = s.EndReceiveFrom(iar, ref endPoint); - tcs.TrySetResult(new SocketReceiveFromResult - { - ReceivedBytes = receivedBytes, - RemoteEndPoint = endPoint - }); - } - catch (Exception e) { tcs.TrySetException(e); } - }, null); - return tcs.Task; - } - public override Task SendAsync(Socket s, ArraySegment buffer) => - Task.Factory.FromAsync((callback, state) => - s.BeginSend(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, callback, state), - s.EndSend, null); - public override Task SendAsync(Socket s, IList> bufferList) => - Task.Factory.FromAsync(s.BeginSend, s.EndSend, bufferList, SocketFlags.None, null); - public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - Task.Factory.FromAsync( - (callback, state) => s.BeginSendTo(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, endPoint, callback, state), - s.EndSendTo, null); - } - - public sealed class SendReceiveTask : SendReceive - { - public SendReceiveTask(ITestOutputHelper output) : base(output) { } - public override bool DisposeDuringOperationResultsInDisposedException => - PlatformDetection.IsFullFramework; // due to SocketTaskExtensions.netfx implementation wrapping APM rather than EAP - public override Task AcceptAsync(Socket s) => - s.AcceptAsync(); - public override Task ConnectAsync(Socket s, EndPoint endPoint) => - s.ConnectAsync(endPoint); - public override Task ReceiveAsync(Socket s, ArraySegment buffer) => - s.ReceiveAsync(buffer, SocketFlags.None); - public override Task ReceiveAsync(Socket s, IList> bufferList) => - s.ReceiveAsync(bufferList, SocketFlags.None); - public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - s.ReceiveFromAsync(buffer, SocketFlags.None, endPoint); - public override Task SendAsync(Socket s, ArraySegment buffer) => - s.SendAsync(buffer, SocketFlags.None); - public override Task SendAsync(Socket s, IList> bufferList) => - s.SendAsync(bufferList, SocketFlags.None); - public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - s.SendToAsync(buffer, SocketFlags.None, endPoint); - } - - public sealed class SendReceiveEap : SendReceive - { - public SendReceiveEap(ITestOutputHelper output) : base(output) { } - - public override bool ValidatesArrayArguments => false; - - public override Task AcceptAsync(Socket s) => - InvokeAsync(s, e => e.AcceptSocket, e => s.AcceptAsync(e)); - public override Task ConnectAsync(Socket s, EndPoint endPoint) => - InvokeAsync(s, e => true, e => - { - e.RemoteEndPoint = endPoint; - return s.ConnectAsync(e); - }); - public override Task ReceiveAsync(Socket s, ArraySegment buffer) => - InvokeAsync(s, e => e.BytesTransferred, e => - { - e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); - return s.ReceiveAsync(e); - }); - public override Task ReceiveAsync(Socket s, IList> bufferList) => - InvokeAsync(s, e => e.BytesTransferred, e => - { - e.BufferList = bufferList; - return s.ReceiveAsync(e); - }); - public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - InvokeAsync(s, e => new SocketReceiveFromResult { ReceivedBytes = e.BytesTransferred, RemoteEndPoint = e.RemoteEndPoint }, e => - { - e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); - e.RemoteEndPoint = endPoint; - return s.ReceiveFromAsync(e); - }); - public override Task SendAsync(Socket s, ArraySegment buffer) => - InvokeAsync(s, e => e.BytesTransferred, e => - { - e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); - return s.SendAsync(e); - }); - public override Task SendAsync(Socket s, IList> bufferList) => - InvokeAsync(s, e => e.BytesTransferred, e => - { - e.BufferList = bufferList; - return s.SendAsync(e); - }); - public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => - InvokeAsync(s, e => e.BytesTransferred, e => - { - e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); - e.RemoteEndPoint = endPoint; - return s.SendToAsync(e); - }); - - private static Task InvokeAsync( - Socket s, - Func getResult, - Func invoke) - { - var tcs = new TaskCompletionSource(); - var saea = new SocketAsyncEventArgs(); - EventHandler handler = (_, e) => - { - if (e.SocketError == SocketError.Success) tcs.SetResult(getResult(e)); - else tcs.SetException(new SocketException((int)e.SocketError)); - saea.Dispose(); - }; - saea.Completed += handler; - if (!invoke(saea)) handler(s, saea); - return tcs.Task; - } - - [Theory] - [InlineData(1, -1, 0)] // offset low - [InlineData(1, 2, 0)] // offset high - [InlineData(1, 0, -1)] // count low - [InlineData(1, 1, 2)] // count high - public void BufferList_InvalidArguments_Throws(int length, int offset, int count) - { - using (var e = new SocketAsyncEventArgs()) - { - ArraySegment invalidBuffer = new FakeArraySegment { Array = new byte[length], Offset = offset, Count = count }.ToActual(); - Assert.Throws(() => e.BufferList = new List> { invalidBuffer }); - - ArraySegment validBuffer = new ArraySegment(new byte[1]); - Assert.Throws(() => e.BufferList = new List> { validBuffer, invalidBuffer }); - } - } - } - - public abstract class MemberDatas - { - public static readonly object[][] Loopbacks = new[] - { - new object[] { IPAddress.Loopback }, - new object[] { IPAddress.IPv6Loopback }, - }; - - public static readonly object[][] LoopbacksAndBuffers = new object[][] - { - new object[] { IPAddress.IPv6Loopback, true }, - new object[] { IPAddress.IPv6Loopback, false }, - new object[] { IPAddress.Loopback, true }, - new object[] { IPAddress.Loopback, false }, - }; - } - - internal struct FakeArraySegment - { - public byte[] Array; - public int Offset; - public int Count; - - public ArraySegment ToActual() - { - ArraySegmentWrapper wrapper = default(ArraySegmentWrapper); - wrapper.Fake = this; - return wrapper.Actual; - } - } - - [StructLayout(LayoutKind.Explicit)] - internal struct ArraySegmentWrapper - { - [FieldOffset(0)] public ArraySegment Actual; - [FieldOffset(0)] public FakeArraySegment Fake; - } + public sealed class SendReceiveSync : SendReceive { } + public sealed class SendReceiveSyncForceNonBlocking : SendReceive { } + public sealed class SendReceiveApm : SendReceive { } + public sealed class SendReceiveTask : SendReceive { } + public sealed class SendReceiveEap : SendReceive { } } diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.netcoreapp.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.netcoreapp.cs new file mode 100644 index 0000000000..3fb00890bd --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SendReceive.netcoreapp.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Net.Sockets.Tests +{ + public sealed class SendReceiveSpanSync : SendReceive { } + public sealed class SendReceiveSpanSyncForceNonBlocking : SendReceive { } + public sealed class SendReceiveMemoryArrayTask : SendReceive { } +} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Shutdown.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Shutdown.cs index d56739725d..1a15b231d1 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Shutdown.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/Shutdown.cs @@ -42,6 +42,7 @@ namespace System.Net.Sockets.Tests var client = (Socket)args.UserToken; if (args.BytesTransferred == 0) { + client.Shutdown(SocketShutdown.Send); client.Dispose(); break; } diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs index d6cf16679b..0223850cf7 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Net.Test.Common; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -249,6 +250,23 @@ namespace System.Net.Sockets.Tests } } + [Theory] + [InlineData(1, -1, 0)] // offset low + [InlineData(1, 2, 0)] // offset high + [InlineData(1, 0, -1)] // count low + [InlineData(1, 1, 2)] // count high + public void BufferList_InvalidArguments_Throws(int length, int offset, int count) + { + using (var e = new SocketAsyncEventArgs()) + { + ArraySegment invalidBuffer = new FakeArraySegment { Array = new byte[length], Offset = offset, Count = count }.ToActual(); + Assert.Throws(() => e.BufferList = new List> { invalidBuffer }); + + ArraySegment validBuffer = new ArraySegment(new byte[1]); + Assert.Throws(() => e.BufferList = new List> { validBuffer, invalidBuffer }); + } + } + [Fact] public async Task Completed_RegisterThenInvoked_UnregisterThenNotInvoked() { @@ -333,7 +351,8 @@ namespace System.Net.Sockets.Tests connectSaea.Completed += (s, e) => tcs.SetResult(e.SocketError); connectSaea.RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, ((IPEndPoint)listen.LocalEndPoint).Port); - Assert.True(Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, connectSaea), $"ConnectAsync completed synchronously with SocketError == {connectSaea.SocketError}"); + bool pending = Socket.ConnectAsync(SocketType.Stream, ProtocolType.Tcp, connectSaea); + if (!pending) tcs.SetResult(connectSaea.SocketError); if (tcs.Task.IsCompleted) { Assert.NotEqual(SocketError.Success, tcs.Task.Result); @@ -454,5 +473,105 @@ namespace System.Net.Sockets.Tests } } } + + public void OnAcceptCompleted(object sender, SocketAsyncEventArgs args) + { + EventWaitHandle handle = (EventWaitHandle)args.UserToken; + handle.Set(); + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] // Unix platforms don't yet support receiving data with AcceptAsync. + public void AcceptAsync_WithReceiveBuffer_Success() + { + Assert.True(Capability.IPv4Support()); + + AutoResetEvent accepted = new AutoResetEvent(false); + + using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = server.BindToAnonymousPort(IPAddress.Loopback); + server.Listen(1); + + const int acceptBufferOverheadSize = 288; // see https://msdn.microsoft.com/en-us/library/system.net.sockets.socket.acceptasync(v=vs.110).aspx + const int acceptBufferDataSize = 256; + const int acceptBufferSize = acceptBufferOverheadSize + acceptBufferDataSize; + + byte[] sendBuffer = new byte[acceptBufferDataSize]; + new Random().NextBytes(sendBuffer); + + SocketAsyncEventArgs acceptArgs = new SocketAsyncEventArgs(); + acceptArgs.Completed += OnAcceptCompleted; + acceptArgs.UserToken = accepted; + acceptArgs.SetBuffer(new byte[acceptBufferSize], 0, acceptBufferSize); + + Assert.True(server.AcceptAsync(acceptArgs)); + + using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + client.Connect(IPAddress.Loopback, port); + client.Send(sendBuffer); + client.Shutdown(SocketShutdown.Both); + } + + Assert.True( + accepted.WaitOne(TestSettings.PassingTestTimeout), "Test completed in allotted time"); + + Assert.Equal( + SocketError.Success, acceptArgs.SocketError); + + Assert.Equal( + acceptBufferDataSize, acceptArgs.BytesTransferred); + + Assert.Equal( + new ArraySegment(sendBuffer), + new ArraySegment(acceptArgs.Buffer, 0, acceptArgs.BytesTransferred)); + } + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] // Unix platforms don't yet support receiving data with AcceptAsync. + public void AcceptAsync_WithTooSmallReceiveBuffer_Failure() + { + using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = server.BindToAnonymousPort(IPAddress.Loopback); + server.Listen(1); + + SocketAsyncEventArgs acceptArgs = new SocketAsyncEventArgs(); + acceptArgs.Completed += OnAcceptCompleted; + acceptArgs.UserToken = new ManualResetEvent(false); + + byte[] buffer = new byte[1]; + acceptArgs.SetBuffer(buffer, 0, buffer.Length); + + AssertExtensions.Throws(null, () => server.AcceptAsync(acceptArgs)); + } + } + + [OuterLoop] // TODO: Issue #11345 + [Fact] + [PlatformSpecific(TestPlatforms.AnyUnix)] // Unix platforms don't yet support receiving data with AcceptAsync. + public void AcceptAsync_WithReceiveBuffer_Failure() + { + Assert.True(Capability.IPv4Support()); + + using (Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + int port = server.BindToAnonymousPort(IPAddress.Loopback); + server.Listen(1); + + SocketAsyncEventArgs acceptArgs = new SocketAsyncEventArgs(); + acceptArgs.Completed += OnAcceptCompleted; + acceptArgs.UserToken = new ManualResetEvent(false); + + byte[] buffer = new byte[1024]; + acceptArgs.SetBuffer(buffer, 0, buffer.Length); + + Assert.Throws(() => server.AcceptAsync(acceptArgs)); + } + } } } diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs index 7321dbda29..0baa055ae3 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Net.Test.Common; using System.Runtime.InteropServices; using System.Text; +using System.Threading; using System.Threading.Tasks; using Xunit; @@ -86,6 +87,11 @@ namespace System.Net.Sockets.Tests [Fact] public async Task MulticastInterface_Set_AnyInterface_Succeeds() { + if (PlatformDetection.IsFedora) + { + return; // [ActiveIssue(24008)] + } + // On all platforms, index 0 means "any interface" await MulticastInterface_Set_Helper(0); } @@ -130,6 +136,10 @@ namespace System.Net.Sockets.Tests sendSocket.SendTo(Encoding.UTF8.GetBytes(message), new IPEndPoint(multicastAddress, port)); } + var cts = new CancellationTokenSource(); + Assert.True(await Task.WhenAny(receiveTask, Task.Delay(20_000, cts.Token)) == receiveTask, "Waiting for received data timed out"); + cts.Cancel(); + int bytesReceived = await receiveTask; string receivedMessage = Encoding.UTF8.GetString(receiveBuffer, 0, bytesReceived); @@ -150,7 +160,7 @@ namespace System.Net.Sockets.Tests } [OuterLoop] // TODO: Issue #11345 - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // In WSL, the connect() call fails immediately. + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // In WSL, the connect() call fails immediately. [InlineData(false)] [InlineData(true)] public void FailedConnect_GetSocketOption_SocketOptionNameError(bool simpleGet) diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs new file mode 100644 index 0000000000..362db55b6f --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs @@ -0,0 +1,313 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace System.Net.Sockets.Tests +{ + // Abstract base class for various different socket "modes" (sync, async, etc) + // See SendReceive.cs for usage + public abstract class SocketHelperBase + { + public abstract Task AcceptAsync(Socket s); + public abstract Task AcceptAsync(Socket s, Socket acceptSocket); + public abstract Task ConnectAsync(Socket s, EndPoint endPoint); + public abstract Task MultiConnectAsync(Socket s, IPAddress[] addresses, int port); + public abstract Task ReceiveAsync(Socket s, ArraySegment buffer); + public abstract Task ReceiveFromAsync( + Socket s, ArraySegment buffer, EndPoint endPoint); + public abstract Task ReceiveAsync(Socket s, IList> bufferList); + public abstract Task SendAsync(Socket s, ArraySegment buffer); + public abstract Task SendAsync(Socket s, IList> bufferList); + public abstract Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endpoint); + public virtual bool GuaranteedSendOrdering => true; + public virtual bool ValidatesArrayArguments => true; + public virtual bool UsesSync => false; + public virtual bool DisposeDuringOperationResultsInDisposedException => false; + public virtual bool ConnectAfterDisconnectResultsInInvalidOperationException => false; + public virtual bool SupportsMultiConnect => true; + public virtual bool SupportsAcceptIntoExistingSocket => true; + } + + public class SocketHelperArraySync : SocketHelperBase + { + public override Task AcceptAsync(Socket s) => + Task.Run(() => s.Accept()); + public override Task AcceptAsync(Socket s, Socket acceptSocket) => throw new NotSupportedException(); + public override Task ConnectAsync(Socket s, EndPoint endPoint) => + Task.Run(() => s.Connect(endPoint)); + public override Task MultiConnectAsync(Socket s, IPAddress[] addresses, int port) => + Task.Run(() => s.Connect(addresses, port)); + public override Task ReceiveAsync(Socket s, ArraySegment buffer) => + Task.Run(() => s.Receive(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None)); + public override Task ReceiveAsync(Socket s, IList> bufferList) => + Task.Run(() => s.Receive(bufferList, SocketFlags.None)); + public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + Task.Run(() => + { + int received = s.ReceiveFrom(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, ref endPoint); + return new SocketReceiveFromResult + { + ReceivedBytes = received, + RemoteEndPoint = endPoint + }; + }); + public override Task SendAsync(Socket s, ArraySegment buffer) => + Task.Run(() => s.Send(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None)); + public override Task SendAsync(Socket s, IList> bufferList) => + Task.Run(() => s.Send(bufferList, SocketFlags.None)); + public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + Task.Run(() => s.SendTo(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, endPoint)); + + public override bool GuaranteedSendOrdering => false; + public override bool UsesSync => true; + public override bool ConnectAfterDisconnectResultsInInvalidOperationException => true; + public override bool SupportsAcceptIntoExistingSocket => false; + } + + public sealed class SocketHelperSyncForceNonBlocking : SocketHelperArraySync + { + public override Task AcceptAsync(Socket s) => + Task.Run(() => { s.ForceNonBlocking(true); Socket accepted = s.Accept(); accepted.ForceNonBlocking(true); return accepted; }); + public override Task ConnectAsync(Socket s, EndPoint endPoint) => + Task.Run(() => { s.ForceNonBlocking(true); s.Connect(endPoint); }); + } + + public sealed class SocketHelperApm : SocketHelperBase + { + public override bool DisposeDuringOperationResultsInDisposedException => true; + public override Task AcceptAsync(Socket s) => + Task.Factory.FromAsync(s.BeginAccept, s.EndAccept, null); + public override Task AcceptAsync(Socket s, Socket acceptSocket) => + Task.Factory.FromAsync(s.BeginAccept, s.EndAccept, acceptSocket, 0, null); + public override Task ConnectAsync(Socket s, EndPoint endPoint) => + Task.Factory.FromAsync(s.BeginConnect, s.EndConnect, endPoint, null); + public override Task MultiConnectAsync(Socket s, IPAddress[] addresses, int port) => + Task.Factory.FromAsync(s.BeginConnect, s.EndConnect, addresses, port, null); + public override Task ReceiveAsync(Socket s, ArraySegment buffer) => + Task.Factory.FromAsync((callback, state) => + s.BeginReceive(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, callback, state), + s.EndReceive, null); + public override Task ReceiveAsync(Socket s, IList> bufferList) => + Task.Factory.FromAsync(s.BeginReceive, s.EndReceive, bufferList, SocketFlags.None, null); + public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) + { + var tcs = new TaskCompletionSource(); + s.BeginReceiveFrom(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, ref endPoint, iar => + { + try + { + int receivedBytes = s.EndReceiveFrom(iar, ref endPoint); + tcs.TrySetResult(new SocketReceiveFromResult + { + ReceivedBytes = receivedBytes, + RemoteEndPoint = endPoint + }); + } + catch (Exception e) { tcs.TrySetException(e); } + }, null); + return tcs.Task; + } + public override Task SendAsync(Socket s, ArraySegment buffer) => + Task.Factory.FromAsync((callback, state) => + s.BeginSend(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, callback, state), + s.EndSend, null); + public override Task SendAsync(Socket s, IList> bufferList) => + Task.Factory.FromAsync(s.BeginSend, s.EndSend, bufferList, SocketFlags.None, null); + public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + Task.Factory.FromAsync( + (callback, state) => s.BeginSendTo(buffer.Array, buffer.Offset, buffer.Count, SocketFlags.None, endPoint, callback, state), + s.EndSendTo, null); + } + + public class SocketHelperTask : SocketHelperBase + { + public override bool DisposeDuringOperationResultsInDisposedException => + PlatformDetection.IsFullFramework; // due to SocketTaskExtensions.netfx implementation wrapping APM rather than EAP + public override Task AcceptAsync(Socket s) => + s.AcceptAsync(); + public override Task AcceptAsync(Socket s, Socket acceptSocket) => + s.AcceptAsync(acceptSocket); + public override Task ConnectAsync(Socket s, EndPoint endPoint) => + s.ConnectAsync(endPoint); + public override Task MultiConnectAsync(Socket s, IPAddress[] addresses, int port) => + s.ConnectAsync(addresses, port); + public override Task ReceiveAsync(Socket s, ArraySegment buffer) => + s.ReceiveAsync(buffer, SocketFlags.None); + public override Task ReceiveAsync(Socket s, IList> bufferList) => + s.ReceiveAsync(bufferList, SocketFlags.None); + public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + s.ReceiveFromAsync(buffer, SocketFlags.None, endPoint); + public override Task SendAsync(Socket s, ArraySegment buffer) => + s.SendAsync(buffer, SocketFlags.None); + public override Task SendAsync(Socket s, IList> bufferList) => + s.SendAsync(bufferList, SocketFlags.None); + public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + s.SendToAsync(buffer, SocketFlags.None, endPoint); + } + + public sealed class SocketHelperEap : SocketHelperBase + { + public override bool ValidatesArrayArguments => false; + + public override Task AcceptAsync(Socket s) => + InvokeAsync(s, e => e.AcceptSocket, e => s.AcceptAsync(e)); + public override Task AcceptAsync(Socket s, Socket acceptSocket) => + InvokeAsync(s, e => e.AcceptSocket, e => + { + e.AcceptSocket = acceptSocket; + return s.AcceptAsync(e); + }); + public override Task ConnectAsync(Socket s, EndPoint endPoint) => + InvokeAsync(s, e => true, e => + { + e.RemoteEndPoint = endPoint; + return s.ConnectAsync(e); + }); + public override Task MultiConnectAsync(Socket s, IPAddress[] addresses, int port) => throw new NotSupportedException(); + public override Task ReceiveAsync(Socket s, ArraySegment buffer) => + InvokeAsync(s, e => e.BytesTransferred, e => + { + e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); + return s.ReceiveAsync(e); + }); + public override Task ReceiveAsync(Socket s, IList> bufferList) => + InvokeAsync(s, e => e.BytesTransferred, e => + { + e.BufferList = bufferList; + return s.ReceiveAsync(e); + }); + public override Task ReceiveFromAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + InvokeAsync(s, e => new SocketReceiveFromResult { ReceivedBytes = e.BytesTransferred, RemoteEndPoint = e.RemoteEndPoint }, e => + { + e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); + e.RemoteEndPoint = endPoint; + return s.ReceiveFromAsync(e); + }); + public override Task SendAsync(Socket s, ArraySegment buffer) => + InvokeAsync(s, e => e.BytesTransferred, e => + { + e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); + return s.SendAsync(e); + }); + public override Task SendAsync(Socket s, IList> bufferList) => + InvokeAsync(s, e => e.BytesTransferred, e => + { + e.BufferList = bufferList; + return s.SendAsync(e); + }); + public override Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endPoint) => + InvokeAsync(s, e => e.BytesTransferred, e => + { + e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); + e.RemoteEndPoint = endPoint; + return s.SendToAsync(e); + }); + + private static Task InvokeAsync( + Socket s, + Func getResult, + Func invoke) + { + var tcs = new TaskCompletionSource(); + var saea = new SocketAsyncEventArgs(); + EventHandler handler = (_, e) => + { + if (e.SocketError == SocketError.Success) + tcs.SetResult(getResult(e)); + else + tcs.SetException(new SocketException((int)e.SocketError)); + saea.Dispose(); + }; + saea.Completed += handler; + if (!invoke(saea)) + handler(s, saea); + return tcs.Task; + } + + public override bool SupportsMultiConnect => false; + } + + public abstract class SocketTestHelperBase : MemberDatas + where T : SocketHelperBase, new() + { + private readonly T _socketHelper; + + public SocketTestHelperBase() + { + _socketHelper = new T(); + } + + // + // Methods that delegate to SocketHelper implementation + // + + public Task AcceptAsync(Socket s) => _socketHelper.AcceptAsync(s); + public Task AcceptAsync(Socket s, Socket acceptSocket) => _socketHelper.AcceptAsync(s, acceptSocket); + public Task ConnectAsync(Socket s, EndPoint endPoint) => _socketHelper.ConnectAsync(s, endPoint); + public Task MultiConnectAsync(Socket s, IPAddress[] addresses, int port) => _socketHelper.MultiConnectAsync(s, addresses, port); + public Task ReceiveAsync(Socket s, ArraySegment buffer) => _socketHelper.ReceiveAsync(s, buffer); + public Task ReceiveFromAsync( + Socket s, ArraySegment buffer, EndPoint endPoint) => _socketHelper.ReceiveFromAsync(s, buffer, endPoint); + public Task ReceiveAsync(Socket s, IList> bufferList) => _socketHelper.ReceiveAsync(s, bufferList); + public Task SendAsync(Socket s, ArraySegment buffer) => _socketHelper.SendAsync(s, buffer); + public Task SendAsync(Socket s, IList> bufferList) => _socketHelper.SendAsync(s, bufferList); + public Task SendToAsync(Socket s, ArraySegment buffer, EndPoint endpoint) => _socketHelper.SendToAsync(s, buffer, endpoint); + public bool GuaranteedSendOrdering => _socketHelper.GuaranteedSendOrdering; + public bool ValidatesArrayArguments => _socketHelper.ValidatesArrayArguments; + public bool UsesSync => _socketHelper.UsesSync; + public bool DisposeDuringOperationResultsInDisposedException => _socketHelper.DisposeDuringOperationResultsInDisposedException; + public bool ConnectAfterDisconnectResultsInInvalidOperationException => _socketHelper.ConnectAfterDisconnectResultsInInvalidOperationException; + public bool SupportsMultiConnect => _socketHelper.SupportsMultiConnect; + public bool SupportsAcceptIntoExistingSocket => _socketHelper.SupportsAcceptIntoExistingSocket; + } + + // + // MemberDatas that are generally useful + // + + public abstract class MemberDatas + { + public static readonly object[][] Loopbacks = new[] + { + new object[] { IPAddress.Loopback }, + new object[] { IPAddress.IPv6Loopback }, + }; + + public static readonly object[][] LoopbacksAndBuffers = new object[][] + { + new object[] { IPAddress.IPv6Loopback, true }, + new object[] { IPAddress.IPv6Loopback, false }, + new object[] { IPAddress.Loopback, true }, + new object[] { IPAddress.Loopback, false }, + }; + } + + // + // Utility stuff + // + + internal struct FakeArraySegment + { + public byte[] Array; + public int Offset; + public int Count; + + public ArraySegment ToActual() + { + ArraySegmentWrapper wrapper = default(ArraySegmentWrapper); + wrapper.Fake = this; + return wrapper.Actual; + } + } + + [StructLayout(LayoutKind.Explicit)] + internal struct ArraySegmentWrapper + { + [FieldOffset(0)] public ArraySegment Actual; + [FieldOffset(0)] public FakeArraySegment Fake; + } +} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.netcoreapp.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.netcoreapp.cs new file mode 100644 index 0000000000..dacd87ac73 --- /dev/null +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.netcoreapp.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; + +namespace System.Net.Sockets.Tests +{ + public class SocketHelperSpanSync : SocketHelperArraySync + { + public override Task ReceiveAsync(Socket s, ArraySegment buffer) => + Task.Run(() => s.Receive((Span)buffer, SocketFlags.None)); + public override Task SendAsync(Socket s, ArraySegment buffer) => + Task.Run(() => s.Send((ReadOnlySpan)buffer, SocketFlags.None)); + } + + public sealed class SocketHelperSpanSyncForceNonBlocking : SocketHelperSpanSync + { + public override Task AcceptAsync(Socket s) => + Task.Run(() => { s.ForceNonBlocking(true); Socket accepted = s.Accept(); accepted.ForceNonBlocking(true); return accepted; }); + public override Task ConnectAsync(Socket s, EndPoint endPoint) => + Task.Run(() => { s.ForceNonBlocking(true); s.Connect(endPoint); }); + } + + public sealed class SocketHelperMemoryArrayTask : SocketHelperTask + { + public override Task ReceiveAsync(Socket s, ArraySegment buffer) => + s.ReceiveAsync((Memory)buffer, SocketFlags.None).AsTask(); + public override Task SendAsync(Socket s, ArraySegment buffer) => + s.SendAsync((ReadOnlyMemory)buffer, SocketFlags.None).AsTask(); + } +} diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj index 96e6f63ae0..088fd2ba4d 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/System.Net.Sockets.Tests.csproj @@ -6,14 +6,15 @@ + + - + - - + @@ -23,6 +24,7 @@ + @@ -31,6 +33,9 @@ + + + @@ -71,9 +76,6 @@ SocketCommon\SocketImplementationType.cs - - Common\System\PlatformDetection.cs - Common\System\Net\TestLogging.cs @@ -106,4 +108,4 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs index d4bd3d49e2..2f5031dfc5 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/TimeoutTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Diagnostics; using Xunit; namespace System.Net.Sockets.Tests @@ -40,9 +41,16 @@ namespace System.Net.Sockets.Tests } } + // Use a Timeout large enough so that we can effectively detect when it's not accurate, + // but also not so large that it takes too long to run. + const int Timeout = 2000; + + [ActiveIssue(23767, TestPlatforms.AnyUnix)] [OuterLoop] // TODO: Issue #11345 - [Fact] - public void ReceiveTimesOut_Throws() + [Theory] + [InlineData(true)] + [InlineData(false)] + public void ReceiveTimesOut_Throws(bool forceNonBlocking) { using (Socket localSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) using (Socket remoteSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) @@ -51,24 +59,38 @@ namespace System.Net.Sockets.Tests localSocket.Listen(1); IAsyncResult localAsync = localSocket.BeginAccept(null, null); + remoteSocket.ForceNonBlocking(forceNonBlocking); + remoteSocket.Connect(IPAddress.IPv6Loopback, port); Socket acceptedSocket = localSocket.EndAccept(localAsync); - acceptedSocket.ReceiveTimeout = TestSettings.FailingTestTimeout; + acceptedSocket.ReceiveTimeout = Timeout; + + acceptedSocket.ForceNonBlocking(forceNonBlocking); + + DateTime start = default(DateTime); SocketException sockEx = Assert.Throws(() => - { - acceptedSocket.Receive(new byte[1]); - }); + { + start = DateTime.UtcNow; + acceptedSocket.Receive(new byte[1]); + }); + + double elapsed = (DateTime.UtcNow - start).TotalMilliseconds; Assert.Equal(SocketError.TimedOut, sockEx.SocketErrorCode); Assert.True(acceptedSocket.Connected); + + // Try to ensure that the elapsed timeout is reasonably correct + Assert.InRange(elapsed, Timeout * 0.75, Timeout * 1.5); } } [OuterLoop] // TODO: Issue #11345 - [Fact] - public void SocketSendTimeout_Send_Success() + [Theory] + [InlineData(true)] + [InlineData(false)] + public void SendTimesOut_Throws(bool forceNonBlocking) { using (Socket localSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) using (Socket remoteSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp)) @@ -77,15 +99,35 @@ namespace System.Net.Sockets.Tests localSocket.Listen(1); IAsyncResult localAsync = localSocket.BeginAccept(null, null); + remoteSocket.ForceNonBlocking(forceNonBlocking); + remoteSocket.Connect(IPAddress.IPv6Loopback, port); Socket acceptedSocket = localSocket.EndAccept(localAsync); - acceptedSocket.SendTimeout = TestSettings.PassingTestTimeout; + acceptedSocket.SendTimeout = Timeout; - // Note that Send almost never times out because it only has to copy the data to the native buffer. - int bytes = acceptedSocket.Send(new byte[100]); - Assert.Equal(100, bytes); + acceptedSocket.ForceNonBlocking(forceNonBlocking); + + var sw = new Stopwatch(); + + // Force Send to timeout by filling the kernel buffer. + var sendBuffer = new byte[16 * 1024]; + SocketException sockEx = Assert.Throws((Action) (() => + { + while (true) + { + sw.Restart(); + acceptedSocket.Send(sendBuffer); + } + })); + + double elapsed = sw.Elapsed.TotalMilliseconds; + + Assert.Equal(SocketError.TimedOut, sockEx.SocketErrorCode); Assert.True(acceptedSocket.Connected); + + // Try to ensure that the elapsed timeout is reasonably correct + Assert.InRange(elapsed, Timeout * 0.5, Timeout * 2); } } } diff --git a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/UnixDomainSocketTest.cs b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/UnixDomainSocketTest.cs index b21739f053..e6c1dd8a5f 100644 --- a/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/UnixDomainSocketTest.cs +++ b/external/corefx/src/System.Net.Sockets/tests/FunctionalTests/UnixDomainSocketTest.cs @@ -4,8 +4,10 @@ using System.Diagnostics; using System.IO; +using System.Linq; using System.Net.Test.Common; using System.Text; +using System.Threading; using System.Threading.Tasks; using Xunit; @@ -124,7 +126,7 @@ namespace System.Net.Sockets.Tests [OuterLoop] // TODO: Issue #11345 [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests SendReceive sucess for UnixDomainSocketEndPoint on Unix + [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests SendReceive success for UnixDomainSocketEndPoint on Unix public void Socket_SendReceive_Success() { string path = GetRandomNonExistingFilePath(); @@ -163,7 +165,7 @@ namespace System.Net.Sockets.Tests [OuterLoop] // TODO: Issue #11345 [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests SendReceiveAsync sucess for UnixDomainSocketEndPoint on Unix + [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests SendReceiveAsync success for UnixDomainSocketEndPoint on Unix public async Task Socket_SendReceiveAsync_Success() { string path = GetRandomNonExistingFilePath(); @@ -206,7 +208,7 @@ namespace System.Net.Sockets.Tests [InlineData(500, 18, 21)] [InlineData(500, 21, 18)] [InlineData(5, 128000, 64000)] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests SendReceiveAsync sucess for UnixDomainSocketEndPoint on Unix + [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests SendReceiveAsync success for UnixDomainSocketEndPoint on Unix public async Task Socket_SendReceiveAsync_PropagateToStream_Success(int iterations, int writeBufferSize, int readBufferSize) { var writeBuffer = new byte[writeBufferSize * iterations]; @@ -259,10 +261,57 @@ namespace System.Net.Sockets.Tests } } + [OuterLoop] // TODO: Issue #11345 + [Theory] + [InlineData(false)] + [InlineData(true)] + [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests ConcurrentSendReceive success for UnixDomainSocketEndPoint on Unix + public void ConcurrentSendReceive(bool forceNonBlocking) + { + using (Socket server = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified)) + using (Socket client = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified)) + { + const int Iters = 25; + byte[] sendData = new byte[Iters]; + byte[] receiveData = new byte[sendData.Length]; + new Random().NextBytes(sendData); + + string path = GetRandomNonExistingFilePath(); + + server.Bind(new UnixDomainSocketEndPoint(path)); + server.Listen(1); + + Task acceptTask = server.AcceptAsync(); + client.Connect(new UnixDomainSocketEndPoint(path)); + acceptTask.Wait(); + Socket accepted = acceptTask.Result; + + client.ForceNonBlocking(forceNonBlocking); + accepted.ForceNonBlocking(forceNonBlocking); + + Task[] writes = new Task[Iters]; + Task[] reads = new Task[Iters]; + for (int i = 0; i < Iters; i++) + { + reads[i] = Task.Factory.StartNew(s => accepted.Receive(receiveData, (int)s, 1, SocketFlags.None), i, + CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); + } + for (int i = 0; i < Iters; i++) + { + writes[i] = Task.Factory.StartNew(s => client.Send(sendData, (int)s, 1, SocketFlags.None), i, + CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); + } + Task.WaitAll(writes); + Task.WaitAll(reads); + + Assert.Equal(sendData.OrderBy(i => i), receiveData.OrderBy(i => i)); + } + } + [OuterLoop] // TODO: Issue #11345 [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests ConcurrentSendReceive sucess for UnixDomainSocketEndPoint on Unix - public void ConcurrentSendReceive() + [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests ConcurrentSendReceive success for UnixDomainSocketEndPoint on Unix + public void ConcurrentSendReceiveAsync() { using (Socket server = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified)) using (Socket client = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified)) diff --git a/external/corefx/src/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj b/external/corefx/src/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj index 7d65e9ca30..7c5b8ceec6 100644 --- a/external/corefx/src/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj +++ b/external/corefx/src/System.Net.WebClient/tests/System.Net.WebClient.Tests.csproj @@ -8,9 +8,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Net\Configuration.cs diff --git a/external/corefx/src/System.Net.WebHeaderCollection/tests/System.Net.WebHeaderCollection.Tests.csproj b/external/corefx/src/System.Net.WebHeaderCollection/tests/System.Net.WebHeaderCollection.Tests.csproj index 08c6465bc7..ff1f3889e0 100644 --- a/external/corefx/src/System.Net.WebHeaderCollection/tests/System.Net.WebHeaderCollection.Tests.csproj +++ b/external/corefx/src/System.Net.WebHeaderCollection/tests/System.Net.WebHeaderCollection.Tests.csproj @@ -9,9 +9,6 @@ - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Net.WebProxy/tests/WebProxyTest.cs b/external/corefx/src/System.Net.WebProxy/tests/WebProxyTest.cs index 2a4c11e1a9..dd74d8196b 100644 --- a/external/corefx/src/System.Net.WebProxy/tests/WebProxyTest.cs +++ b/external/corefx/src/System.Net.WebProxy/tests/WebProxyTest.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Net.NetworkInformation; using System.Net.Sockets; +using System.Runtime.InteropServices; using Xunit; namespace System.Net.Tests @@ -175,17 +176,29 @@ namespace System.Net.Tests yield return new object[] { new Uri($"http://{IPAddress.None}"), false }; } + [ActiveIssue(23766, TestPlatforms.AnyUnix)] [Theory] [MemberData(nameof(BypassOnLocal_MemberData))] public static void WebProxy_BypassOnLocal_MatchesExpected(Uri destination, bool isLocal) { Uri proxyUri = new Uri("http://microsoft.com"); - Assert.Equal(isLocal, new WebProxy(proxyUri, true).IsBypassed(destination)); - Assert.False(new WebProxy(proxyUri, false).IsBypassed(destination)); + try + { + Assert.Equal(isLocal, new WebProxy(proxyUri, true).IsBypassed(destination)); + Assert.False(new WebProxy(proxyUri, false).IsBypassed(destination)); - Assert.Equal(isLocal ? destination : proxyUri, new WebProxy(proxyUri, true).GetProxy(destination)); - Assert.Equal(proxyUri, new WebProxy(proxyUri, false).GetProxy(destination)); + Assert.Equal(isLocal ? destination : proxyUri, new WebProxy(proxyUri, true).GetProxy(destination)); + Assert.Equal(proxyUri, new WebProxy(proxyUri, false).GetProxy(destination)); + } + catch (SocketException exception) + { + // On Unix, getaddrinfo returns host not found, if all the machine discovery settings on the local network + // is turned off. Hence dns lookup for it's own hostname fails. + Assert.Equal(SocketError.HostNotFound, exception.SocketErrorCode); + Assert.Throws(() => Dns.GetHostEntryAsync(Dns.GetHostName()).GetAwaiter().GetResult()); + Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)); + } } [Fact] diff --git a/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs b/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs index 17f0b8eedb..39d2292754 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs +++ b/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WebSocketHandle.Managed.cs @@ -21,7 +21,7 @@ namespace System.Net.WebSockets [ThreadStatic] private static StringBuilder t_cachedStringBuilder; - /// Default encoding for HTTP requests. Latin alphabeta no 1, ISO/IEC 8859-1. + /// Default encoding for HTTP requests. Latin alphabet no 1, ISO/IEC 8859-1. private static readonly Encoding s_defaultHttpEncoding = Encoding.GetEncoding(28591); /// Size of the receive buffer to use. diff --git a/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WinRTWebSocket.cs b/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WinRTWebSocket.cs index 8eb116315b..f00c66c3c8 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WinRTWebSocket.cs +++ b/external/corefx/src/System.Net.WebSockets.Client/src/System/Net/WebSockets/WinRTWebSocket.cs @@ -22,7 +22,7 @@ using Windows.Web; using RTCertificate = Windows.Security.Cryptography.Certificates.Certificate; using RTCertificateQuery = Windows.Security.Cryptography.Certificates.CertificateQuery; using RTCertificateStores = Windows.Security.Cryptography.Certificates.CertificateStores; -using RTWeb​Socket​Error = Windows.Networking.Sockets.Web​Socket​Error; +using RTWebSocketError = Windows.Networking.Sockets.WebSocketError; namespace System.Net.WebSockets { @@ -131,7 +131,7 @@ namespace System.Net.WebSockets X509Certificate2 dotNetClientCert = CertificateHelper.GetEligibleClientCertificate(options.ClientCertificates); if (dotNetClientCert != null) { - RTCertificate winRtClientCert = await CertificateHelper.ConvertDotNetClientCertToWinRtClientCertAsync(dotNetClientCert); + RTCertificate winRtClientCert = await CertificateHelper.ConvertDotNetClientCertToWinRtClientCertAsync(dotNetClientCert).ConfigureAwait(false); if (winRtClientCert == null) { throw new PlatformNotSupportedException(string.Format( @@ -159,7 +159,7 @@ namespace System.Net.WebSockets _closeWebSocketReceiveResultTcs = new TaskCompletionSource(); _messageWebSocket.MessageReceived += OnMessageReceived; _messageWebSocket.Closed += OnCloseReceived; - await _messageWebSocket.ConnectAsync(uri).AsTask(cancellationToken); + await _messageWebSocket.ConnectAsync(uri).AsTask(cancellationToken).ConfigureAwait(false); _subProtocol = _messageWebSocket.Information.Protocol; _messageWriter = new DataWriter(_messageWebSocket.OutputStream); } @@ -265,7 +265,7 @@ namespace System.Net.WebSockets _messageWebSocket.Close((ushort) closeStatus, statusDescription ?? String.Empty); } - var result = await _closeWebSocketReceiveResultTcs.Task; + var result = await _closeWebSocketReceiveResultTcs.Task.ConfigureAwait(false); _closeStatus = result.CloseStatus; _closeStatusDescription = result.CloseStatusDescription; InterlockedCheckAndUpdateCloseState(WebSocketState.CloseReceived, s_validCloseStates); @@ -313,7 +313,6 @@ namespace System.Net.WebSockets } private static readonly WebSocketState[] s_validReceiveStates = { WebSocketState.Open, WebSocketState.CloseSent }; - private static readonly WebSocketState[] s_validAfterReceiveStates = { WebSocketState.Open, WebSocketState.CloseSent, WebSocketState.CloseReceived, WebSocketState.Closed }; public override async Task ReceiveAsync(ArraySegment buffer, CancellationToken cancellationToken) { @@ -326,7 +325,8 @@ namespace System.Net.WebSockets Task completedTask = await Task.WhenAny( _webSocketReceiveResultTcs.Task, - _closeWebSocketReceiveResultTcs.Task); + _closeWebSocketReceiveResultTcs.Task).ConfigureAwait(false); + WebSocketReceiveResult result = await completedTask; if (result.MessageType == WebSocketMessageType.Close) @@ -340,7 +340,6 @@ namespace System.Net.WebSockets _webSocketReceiveResultTcs = new TaskCompletionSource(); } - InterlockedCheckValidStates(s_validAfterReceiveStates); return result; } } @@ -401,7 +400,7 @@ namespace System.Net.WebSockets { // WinRT WebSockets always throw exceptions of type System.Exception. However, we can determine whether // or not we're dealing with a known error by using WinRT's WebSocketError.GetStatus method. - WebErrorStatus status = RTWeb​Socket​Error.GetStatus(exc.HResult); + WebErrorStatus status = RTWebSocketError.GetStatus(exc.HResult); WebSocketError actualError = WebSocketError.Faulted; switch (status) { @@ -446,7 +445,7 @@ namespace System.Net.WebSockets _messageWebSocket.Control.MessageType = messageType == WebSocketMessageType.Binary ? SocketMessageType.Binary : SocketMessageType.Utf8; - await _messageWriter.StoreAsync().AsTask(cancellationToken); + await _messageWriter.StoreAsync().AsTask(cancellationToken).ConfigureAwait(false); } } catch (Exception) diff --git a/external/corefx/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs b/external/corefx/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs index 844d022fa2..cc614458be 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs +++ b/external/corefx/src/System.Net.WebSockets.Client/tests/ClientWebSocketOptionsTests.cs @@ -43,19 +43,25 @@ namespace System.Net.WebSockets.Client.Tests Assert.False(cws.Options.UseDefaultCredentials); } - [ActiveIssue(20358, TargetFrameworkMonikers.NetFramework)] [ConditionalFact(nameof(WebSocketsSupported))] public static void SetBuffer_InvalidArgs_Throws() { + // Recreate the minimum WebSocket buffer size values from the .NET Framework version of WebSocket, + // and pick the correct name of the buffer used when throwing an ArgumentOutOfRangeException. + int minSendBufferSize = PlatformDetection.IsFullFramework ? 16 : 1; + int minReceiveBufferSize = PlatformDetection.IsFullFramework ? 256 : 1; + string bufferName = PlatformDetection.IsFullFramework ? "internalBuffer" : "buffer"; + var cws = new ClientWebSocket(); + AssertExtensions.Throws("receiveBufferSize", () => cws.Options.SetBuffer(0, 0)); - AssertExtensions.Throws("receiveBufferSize", () => cws.Options.SetBuffer(0, 1)); - AssertExtensions.Throws("sendBufferSize", () => cws.Options.SetBuffer(1, 0)); + AssertExtensions.Throws("receiveBufferSize", () => cws.Options.SetBuffer(0, minSendBufferSize)); + AssertExtensions.Throws("sendBufferSize", () => cws.Options.SetBuffer(minReceiveBufferSize, 0)); AssertExtensions.Throws("receiveBufferSize", () => cws.Options.SetBuffer(0, 0, new ArraySegment(new byte[1]))); - AssertExtensions.Throws("receiveBufferSize", () => cws.Options.SetBuffer(0, 1, new ArraySegment(new byte[1]))); - AssertExtensions.Throws("sendBufferSize", () => cws.Options.SetBuffer(1, 0, new ArraySegment(new byte[1]))); - AssertExtensions.Throws("buffer.Array", () => cws.Options.SetBuffer(1, 1, default(ArraySegment))); - AssertExtensions.Throws("buffer", () => cws.Options.SetBuffer(1, 1, new ArraySegment(new byte[0]))); + AssertExtensions.Throws("receiveBufferSize", () => cws.Options.SetBuffer(0, minSendBufferSize, new ArraySegment(new byte[1]))); + AssertExtensions.Throws("sendBufferSize", () => cws.Options.SetBuffer(minReceiveBufferSize, 0, new ArraySegment(new byte[1]))); + AssertExtensions.Throws("buffer.Array", () => cws.Options.SetBuffer(minReceiveBufferSize, minSendBufferSize, default(ArraySegment))); + AssertExtensions.Throws(bufferName, () => cws.Options.SetBuffer(minReceiveBufferSize, minSendBufferSize, new ArraySegment(new byte[0]))); } [ConditionalFact(nameof(WebSocketsSupported))] diff --git a/external/corefx/src/System.Net.WebSockets.Client/tests/ConnectTest.cs b/external/corefx/src/System.Net.WebSockets.Client/tests/ConnectTest.cs index bf68cb4084..f41b3ffc9a 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/tests/ConnectTest.cs +++ b/external/corefx/src/System.Net.WebSockets.Client/tests/ConnectTest.cs @@ -137,8 +137,15 @@ namespace System.Net.WebSockets.Client.Tests { Assert.Null(cws.Options.Cookies); cws.Options.Cookies = new CookieContainer(); - cws.Options.Cookies.Add(server, new Cookie("Cookies", "Are Yummy")); - cws.Options.Cookies.Add(server, new Cookie("Especially", "Chocolate Chip")); + + Cookie cookie1 = new Cookie("Cookies", "Are Yummy"); + Cookie cookie2 = new Cookie("Especially", "Chocolate Chip"); + Cookie secureCookie = new Cookie("Occasionally", "Raisin"); + secureCookie.Secure = true; + + cws.Options.Cookies.Add(server, cookie1); + cws.Options.Cookies.Add(server, cookie2); + cws.Options.Cookies.Add(server, secureCookie); using (var cts = new CancellationTokenSource(TimeOutMilliseconds)) { @@ -163,8 +170,10 @@ namespace System.Net.WebSockets.Client.Tests Assert.Equal(WebSocketMessageType.Text, recvResult.MessageType); string headers = WebSocketData.GetTextFromBuffer(segment); + Assert.True(headers.Contains("Cookies=Are Yummy")); Assert.True(headers.Contains("Especially=Chocolate Chip")); + Assert.Equal(server.Scheme == "wss", headers.Contains("Occasionally=Raisin")); await cws.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None); } diff --git a/external/corefx/src/System.Net.WebSockets.Client/tests/KeepAliveTest.cs b/external/corefx/src/System.Net.WebSockets.Client/tests/KeepAliveTest.cs index c56d354092..cb38db0b11 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/tests/KeepAliveTest.cs +++ b/external/corefx/src/System.Net.WebSockets.Client/tests/KeepAliveTest.cs @@ -16,6 +16,7 @@ namespace System.Net.WebSockets.Client.Tests { public KeepAliveTest(ITestOutputHelper output) : base(output) { } + [ActiveIssue(23204, TargetFrameworkMonikers.Uap)] [ConditionalFact(nameof(WebSocketsSupported))] [OuterLoop] // involves long delay public async Task KeepAlive_LongDelayBetweenSendReceives_Succeeds() diff --git a/external/corefx/src/System.Net.WebSockets.Client/tests/SendReceiveTest.cs b/external/corefx/src/System.Net.WebSockets.Client/tests/SendReceiveTest.cs index d05b3e5bb0..ec7cc95415 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/tests/SendReceiveTest.cs +++ b/external/corefx/src/System.Net.WebSockets.Client/tests/SendReceiveTest.cs @@ -285,6 +285,7 @@ namespace System.Net.WebSockets.Client.Tests } } + [ActiveIssue(23765)] [OuterLoop] // TODO: Issue #11345 [ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))] public async Task SendReceive_VaryingLengthBuffers_Success(Uri server) diff --git a/external/corefx/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj b/external/corefx/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj index 414c600604..a29a05b5c5 100644 --- a/external/corefx/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj +++ b/external/corefx/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj @@ -14,12 +14,6 @@ - - Common\System\PlatformDetection.cs - - - Common\System\Net\PlatformDetection.Networking.cs - Common\System\Net\Capability.Security.cs diff --git a/external/corefx/src/System.Net.WebSockets/tests/System.Net.WebSockets.Tests.csproj b/external/corefx/src/System.Net.WebSockets/tests/System.Net.WebSockets.Tests.csproj index 32f323ad22..2ff981eabb 100644 --- a/external/corefx/src/System.Net.WebSockets/tests/System.Net.WebSockets.Tests.csproj +++ b/external/corefx/src/System.Net.WebSockets/tests/System.Net.WebSockets.Tests.csproj @@ -13,9 +13,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs b/external/corefx/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs index 2035e85305..bb4bd13a8a 100644 --- a/external/corefx/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs +++ b/external/corefx/src/System.Net.WebSockets/tests/WebSocketExceptionTests.cs @@ -180,7 +180,7 @@ namespace System.Net.WebSockets.Tests Assert.Same(inner, wse.InnerException); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsFullFramework))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsFullFramework))] public void GetObjectData_Success() { var wse = new WebSocketException(); diff --git a/external/corefx/src/System.Numerics.Vectors/pkg/System.Numerics.Vectors.pkgproj b/external/corefx/src/System.Numerics.Vectors/pkg/System.Numerics.Vectors.pkgproj index 0a8bbc7c0c..fb09f270ed 100644 --- a/external/corefx/src/System.Numerics.Vectors/pkg/System.Numerics.Vectors.pkgproj +++ b/external/corefx/src/System.Numerics.Vectors/pkg/System.Numerics.Vectors.pkgproj @@ -15,14 +15,21 @@ - - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Numerics.Vectors/tests/Performance/Configurations.props b/external/corefx/src/System.Numerics.Vectors/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Numerics.Vectors/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj b/external/corefx/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj index d952677904..def338a5d1 100644 --- a/external/corefx/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj +++ b/external/corefx/src/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj @@ -32,9 +32,6 @@ - - Common\System\PlatformDetection.cs - System\MathF.netstandard.cs diff --git a/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs b/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs index b4111394da..7afcffd7c7 100644 --- a/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs +++ b/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs @@ -270,7 +270,7 @@ namespace System.Collections.ObjectModel } /// - /// Disallow reentrant attempts to change this collection. E.g. a event handler + /// Disallow reentrant attempts to change this collection. E.g. an event handler /// of the CollectionChanged event is not allowed to make changes to this collection. /// /// diff --git a/external/corefx/src/System.ObjectModel/tests/KeyedCollection/Serialization.cs b/external/corefx/src/System.ObjectModel/tests/KeyedCollection/Serialization.cs index 31be8b2da1..1881e6d63c 100644 --- a/external/corefx/src/System.ObjectModel/tests/KeyedCollection/Serialization.cs +++ b/external/corefx/src/System.ObjectModel/tests/KeyedCollection/Serialization.cs @@ -19,7 +19,6 @@ namespace System.Collections.ObjectModel.Tests [Theory] [MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")] public void SerializeDeserialize_Roundtrips(TestCollection c) { TestCollection clone = BinaryFormatterHelpers.Clone(c); diff --git a/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs b/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs index 89cbcf26fc..8c58ae1766 100644 --- a/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs +++ b/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.ObjectModel.Tests @@ -123,8 +124,20 @@ namespace System.Collections.ObjectModel.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot)] public static void DebuggerAttributeTests() { - DebuggerAttributes.ValidateDebuggerDisplayReferences(new ObservableCollection()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ObservableCollection()); + ObservableCollection col = new ObservableCollection(new[] {1, 2, 3, 4}); + DebuggerAttributes.ValidateDebuggerDisplayReferences(col); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + int[] items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(col, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void DebuggerAttribute_NullCollection_ThrowsArgumentNullException() + { + TargetInvocationException ex = Assert.Throws(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ObservableCollection), null)); + ArgumentNullException argumentNullException = Assert.IsType(ex.InnerException); } private partial class ObservableCollectionSubclass : ObservableCollection diff --git a/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_Serialization.cs b/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_Serialization.cs index b47a7f303f..f823536519 100644 --- a/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_Serialization.cs +++ b/external/corefx/src/System.ObjectModel/tests/ObservableCollection/ObservableCollection_Serialization.cs @@ -20,7 +20,6 @@ namespace System.Collections.ObjectModel.Tests [Theory] [MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")] public void SerializeDeserialize_Roundtrips(ObservableCollection c) { ObservableCollection clone = BinaryFormatterHelpers.Clone(c); diff --git a/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs b/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs index b49678d4a6..02ef40812e 100644 --- a/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs +++ b/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs @@ -214,11 +214,24 @@ namespace System.Collections.ObjectModel.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] public static void DebuggerAttributeTests() { - DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyDictionary(new Dictionary())); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ReadOnlyDictionary(new Dictionary())); + ReadOnlyDictionary dict = new ReadOnlyDictionary(new Dictionary{{1, 2}, {2, 4}, {3, 6}}); + DebuggerAttributes.ValidateDebuggerDisplayReferences(dict); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + KeyValuePair[] pairs = itemProperty.GetValue(info.Instance) as KeyValuePair[]; + Assert.Equal(dict, pairs); - DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyDictionary(new Dictionary()).Keys); - DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyDictionary(new Dictionary()).Values); + DebuggerAttributes.ValidateDebuggerDisplayReferences(dict.Keys); + info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ReadOnlyDictionary.KeyCollection), new Type[] { typeof(int) }, dict.Keys); + itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + int[] items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(dict.Keys, items); + + DebuggerAttributes.ValidateDebuggerDisplayReferences(dict.Values); + info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ReadOnlyDictionary.KeyCollection), new Type[] { typeof(int) }, dict.Values); + itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(dict.Values, items); } [Fact] diff --git a/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs b/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs index b862c9bbe3..6cd977a4c7 100644 --- a/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs +++ b/external/corefx/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs @@ -19,7 +19,6 @@ namespace System.Collections.ObjectModel.Tests [Theory] [MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")] public void SerializeDeserialize_Roundtrips(ReadOnlyDictionary d) { ReadOnlyDictionary clone = BinaryFormatterHelpers.Clone(d); diff --git a/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs b/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs index 116dda0479..2ce299cc17 100644 --- a/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs +++ b/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using System.Reflection; using Xunit; namespace System.Collections.ObjectModel.Tests @@ -202,8 +204,20 @@ namespace System.Collections.ObjectModel.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot)] public static void DebuggerAttribute_Tests() { - DebuggerAttributes.ValidateDebuggerDisplayReferences(new ReadOnlyObservableCollection(new ObservableCollection())); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(new ReadOnlyObservableCollection(new ObservableCollection())); + ReadOnlyObservableCollection col = new ReadOnlyObservableCollection(new ObservableCollection(new[] {1, 2, 3, 4})); + DebuggerAttributes.ValidateDebuggerDisplayReferences(col); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + int[] items = itemProperty.GetValue(info.Instance) as int[]; + Assert.Equal(col, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.UapAot, "Cannot do DebuggerAttribute testing on UapAot: requires internal Reflection on framework types.")] + public static void DebuggerAttribute_NullCollection_ThrowsArgumentNullException() + { + TargetInvocationException ex = Assert.Throws(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(ReadOnlyObservableCollection), null)); + ArgumentNullException argumentNullException = Assert.IsType(ex.InnerException); } } diff --git a/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollection_SerializationTests.cs b/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollection_SerializationTests.cs index 70c2aeb98f..2750f02740 100644 --- a/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollection_SerializationTests.cs +++ b/external/corefx/src/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollection_SerializationTests.cs @@ -20,7 +20,6 @@ namespace System.Collections.ObjectModel.Tests [Theory] [MemberData(nameof(SerializeDeserialize_Roundtrips_MemberData))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Serialization still WIP in UapAot: https://github.com/dotnet/corefx/issues/18942")] public void SerializeDeserialize_Roundtrips(ReadOnlyObservableCollection c) { ReadOnlyObservableCollection clone = BinaryFormatterHelpers.Clone(c); diff --git a/external/corefx/src/System.ObjectModel/tests/System.ObjectModel.Tests.csproj b/external/corefx/src/System.ObjectModel/tests/System.ObjectModel.Tests.csproj index c7dada54f2..24fa08ad61 100644 --- a/external/corefx/src/System.ObjectModel/tests/System.ObjectModel.Tests.csproj +++ b/external/corefx/src/System.ObjectModel/tests/System.ObjectModel.Tests.csproj @@ -27,9 +27,6 @@ Common\System\CollectionsIDictionaryTest.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/CollectionDataContract.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/CollectionDataContract.cs index 21d871b7a5..f72b25ab9f 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/CollectionDataContract.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/CollectionDataContract.cs @@ -1299,6 +1299,10 @@ namespace System.Runtime.Serialization if (addMethod == null) { Type[] parentInterfaceTypes = interfaceType.GetInterfaces(); + // The for loop below depeneds on the order for the items in parentInterfaceTypes, which + // doesnt' seem right. But it's the behavior of DCS on the full framework. + // Sorting the array to make sure the behavior is consistent with Desktop's. + Array.Sort(parentInterfaceTypes, (x, y) => string.Compare(x.FullName, y.FullName)); foreach (Type parentInterfaceType in parentInterfaceTypes) { if (IsKnownInterface(parentInterfaceType)) diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs.REMOVED.git-id b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs.REMOVED.git-id index 96940dc303..b2532c0fd7 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContract.cs.REMOVED.git-id @@ -1 +1 @@ -257107efef5642950e450c041348b02bbd3e9008 \ No newline at end of file +84eb6a8bf3754202195b1c8829a1e0b6baf268bd \ No newline at end of file diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs index 7dfde5650b..89b4e34977 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Globals.cs @@ -896,7 +896,6 @@ namespace System.Runtime.Serialization // instead of string comparison method calls in IL.) public static readonly string NewObjectId = string.Empty; public const string NullObjectId = null; - public const string SimpleSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*$"; public const string FullSRSInternalsVisiblePattern = @"^[\s]*System\.Runtime\.Serialization[\s]*,[\s]*PublicKey[\s]*=[\s]*(?i:00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab)[\s]*$"; public const string Space = " "; public const string XsiPrefix = "i"; @@ -1031,4 +1030,4 @@ namespace System.Runtime.Serialization "; } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs index 4b3a4c3f88..e55100d2ae 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs @@ -374,6 +374,7 @@ namespace System.Runtime.Serialization.Json } else { + _ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod); value = ReadValue(memberType, dataMember.Name); _ilg.LoadAddress(_objectLocal); _ilg.ConvertAddress(_objectLocal.LocalType, _objectType); diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs index 3a5ddb404b..7546651697 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs @@ -225,6 +225,12 @@ namespace System.Runtime.Serialization.Json _ilg.Load(_contextArg); _ilg.Call(XmlFormatGeneratorStatics.StoreIsGetOnlyCollectionMethod); } + else + { + _ilg.Load(_contextArg); + _ilg.Call(XmlFormatGeneratorStatics.ResetIsGetOnlyCollectionMethod); + } + if (!member.EmitDefaultValue) { memberValue = LoadMemberValue(member); diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs index c701d42cac..d6ece99f5e 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/ReflectionJsonFormatWriter.cs @@ -207,6 +207,10 @@ namespace System.Runtime.Serialization.Json { context.StoreIsGetOnlyCollection(); } + else + { + context.ResetIsGetOnlyCollection(); + } bool shouldWriteValue = true; diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs index 03227916ae..bdf92cb05d 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/XmlJsonWriter.cs @@ -23,14 +23,45 @@ namespace System.Runtime.Serialization.Json private const char WHITESPACE = ' '; private const char CARRIAGE_RETURN = '\r'; private const char NEWLINE = '\n'; - private const char BACKSPACE = '\b'; - private const char FORM_FEED = '\f'; - private const char HORIZONTAL_TABULATION = '\t'; private const string xmlNamespace = "http://www.w3.org/XML/1998/namespace"; private const string xmlnsNamespace = "http://www.w3.org/2000/xmlns/"; // This array was part of a perf improvement for escaping characters < WHITESPACE. - private static readonly string[] s_escapedJsonStringTable = CreateEscapedJsonStringTable(); + private static readonly string[] s_escapedJsonStringTable = + { + "\\u0000", + "\\u0001", + "\\u0002", + "\\u0003", + "\\u0004", + "\\u0005", + "\\u0006", + "\\u0007", + "\\b", + "\\t", + "\\n", + "\\u000b", + "\\f", + "\\r", + "\\u000e", + "\\u000f", + "\\u0010", + "\\u0011", + "\\u0012", + "\\u0013", + "\\u0014", + "\\u0015", + "\\u0016", + "\\u0017", + "\\u0018", + "\\u0019", + "\\u001a", + "\\u001b", + "\\u001c", + "\\u001d", + "\\u001e", + "\\u001f" + }; private static BinHexEncoding s_binHexEncoding; @@ -72,20 +103,6 @@ namespace System.Runtime.Serialization.Json InitializeWriter(); } - private static string[] CreateEscapedJsonStringTable() - { - var table = new string[WHITESPACE]; - for (int ch = 0; ch < WHITESPACE; ch++) - { - char abbrev; - table[ch] = TryEscapeControlCharacter((char)ch, out abbrev) ? - string.Concat(BACK_SLASH, abbrev) : - string.Format(CultureInfo.InvariantCulture, "\\u{0:x4}", ch); - } - - return table; - } - private enum JsonDataType { None, @@ -1418,33 +1435,6 @@ namespace System.Runtime.Serialization.Json } } - private static bool TryEscapeControlCharacter(char ch, out char abbrev) - { - switch (ch) - { - case BACKSPACE: - abbrev = 'b'; - break; - case FORM_FEED: - abbrev = 'f'; - break; - case NEWLINE: - abbrev = 'n'; - break; - case CARRIAGE_RETURN: - abbrev = 'r'; - break; - case HORIZONTAL_TABULATION: - abbrev = 't'; - break; - default: - abbrev = ' '; - return false; - } - - return true; - } - private void WriteIndent() { for (int i = 0; i < _indentLevel; i++) diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionReader.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionReader.cs index ca443a34c2..a5a037fa80 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionReader.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionReader.cs @@ -205,6 +205,7 @@ namespace System.Runtime.Serialization } else { + context.ResetCollectionMemberInfo(); var value = ReflectionReadValue(xmlReader, context, dataMember, classContract.StableName.Namespace); MemberInfo memberInfo = dataMember.MemberInfo; Debug.Assert(memberInfo != null); diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionXmlFormatWriter.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionXmlFormatWriter.cs index 9733bba377..c961520e3d 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionXmlFormatWriter.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/ReflectionXmlFormatWriter.cs @@ -144,6 +144,10 @@ namespace System.Runtime.Serialization { context.StoreIsGetOnlyCollection(); } + else + { + context.ResetIsGetOnlyCollection(); + } bool shouldWriteValue = true; object memberValue = null; diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatGeneratorStatics.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatGeneratorStatics.cs index 51f1187a5a..bc09f458ff 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatGeneratorStatics.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatGeneratorStatics.cs @@ -249,6 +249,20 @@ namespace System.Runtime.Serialization } } + private static MethodInfo s_resetCollectionMemberInfoMethod; + internal static MethodInfo ResetCollectionMemberInfoMethod + { + get + { + if (s_resetCollectionMemberInfoMethod == null) + { + s_resetCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ResetCollectionMemberInfo", Globals.ScanAllMembers, new Type[] { }); + Debug.Assert(s_resetCollectionMemberInfoMethod != null); + } + return s_resetCollectionMemberInfoMethod; + } + } + private static MethodInfo s_storeIsGetOnlyCollectionMethod; internal static MethodInfo StoreIsGetOnlyCollectionMethod { @@ -263,6 +277,20 @@ namespace System.Runtime.Serialization } } + private static MethodInfo s_resetIsGetOnlyCollection; + internal static MethodInfo ResetIsGetOnlyCollectionMethod + { + get + { + if (s_resetIsGetOnlyCollection == null) + { + s_resetIsGetOnlyCollection = typeof(XmlObjectSerializerWriteContext).GetMethod("ResetIsGetOnlyCollection", Globals.ScanAllMembers); + Debug.Assert(s_resetIsGetOnlyCollection != null); + } + return s_resetIsGetOnlyCollection; + } + } + private static MethodInfo s_throwNullValueReturnedForGetOnlyCollectionExceptionMethod; internal static MethodInfo ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod { diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatReaderGenerator.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatReaderGenerator.cs index e30d874f17..937c297d06 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatReaderGenerator.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatReaderGenerator.cs @@ -422,6 +422,7 @@ namespace System.Runtime.Serialization } else { + _ilg.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod); value = ReadValue(memberType, dataMember.Name, classContract.StableName.Namespace); _ilg.LoadAddress(_objectLocal); _ilg.ConvertAddress(_objectLocal.LocalType, _objectType); diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatWriterGenerator.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatWriterGenerator.cs index 999b73388c..4f89c3436e 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatWriterGenerator.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlFormatWriterGenerator.cs @@ -286,6 +286,12 @@ namespace System.Runtime.Serialization _ilg.Load(_contextArg); _ilg.Call(XmlFormatGeneratorStatics.StoreIsGetOnlyCollectionMethod); } + else + { + _ilg.Load(_contextArg); + _ilg.Call(XmlFormatGeneratorStatics.ResetIsGetOnlyCollectionMethod); + } + if (!member.EmitDefaultValue) { memberValue = LoadMemberValue(member); diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs index f636b16e46..74c0b9ab13 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs @@ -67,6 +67,12 @@ namespace System.Runtime.Serialization _isGetOnlyCollection = true; } + internal void ResetCollectionMemberInfo() + { + _getOnlyCollectionValue = null; + _isGetOnlyCollection = false; + } + #if USE_REFEMIT public static void ThrowNullValueReturnedForGetOnlyCollectionException(Type type) #else diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs index ce397dcba2..0d11ca950d 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs @@ -96,6 +96,11 @@ namespace System.Runtime.Serialization _isGetOnlyCollection = true; } + internal void ResetIsGetOnlyCollection() + { + _isGetOnlyCollection = false; + } + #if USE_REFEMIT public void InternalSerializeReference(XmlWriterDelegator xmlWriter, object obj, bool isDeclaredType, bool writeXsiType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle) #else @@ -178,18 +183,16 @@ namespace System.Runtime.Serialization protected virtual void SerializeWithXsiType(XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType) { bool verifyKnownType = false; -#if !uapaot DataContract dataContract; if (declaredType.IsInterface && CollectionDataContract.IsCollectionInterface(declaredType)) { +#if !uapaot dataContract = GetDataContractSkipValidation(DataContract.GetId(objectTypeHandle), objectTypeHandle, objectType); if (OnHandleIsReference(xmlWriter, dataContract, obj)) return; dataContract = GetDataContract(declaredTypeHandle, declaredType); #else - DataContract dataContract = DataContract.GetDataContract(declaredType); - if (dataContract.TypeIsInterface && dataContract.TypeIsCollectionInterface) - { + dataContract = DataContract.GetDataContract(declaredType); if (OnHandleIsReference(xmlWriter, dataContract, obj)) return; if (this.Mode == SerializationMode.SharedType && dataContract.IsValidContract(this.Mode)) diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/EncodingStreamWrapper.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/EncodingStreamWrapper.cs index 93054af22e..63254e7bb3 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/EncodingStreamWrapper.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/EncodingStreamWrapper.cs @@ -206,9 +206,9 @@ namespace System.Xml // Emit BOM if (emitBOM) { - byte[] bom = _encoding.GetPreamble(); + ReadOnlySpan bom = _encoding.Preamble; if (bom.Length > 0) - _stream.Write(bom, 0, bom.Length); + _stream.Write(bom); } } } diff --git a/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/ValueHandle.cs b/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/ValueHandle.cs index ef525b761b..cafc3ba948 100644 --- a/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/ValueHandle.cs +++ b/external/corefx/src/System.Private.DataContractSerialization/src/System/Xml/ValueHandle.cs @@ -326,8 +326,11 @@ namespace System.Xml if (type == ValueHandleType.Double) { double value = GetDouble(); - if ((value >= Single.MinValue && value <= Single.MaxValue) || double.IsInfinity(value) || double.IsNaN(value)) + + if ((value >= Single.MinValue && value <= Single.MaxValue) || !double.IsFinite(value)) + { return (Single)value; + } } if (type == ValueHandleType.Zero) return 0; diff --git a/external/corefx/src/System.Private.Reflection.Metadata.Ecma335/src/Resources/Strings.resx b/external/corefx/src/System.Private.Reflection.Metadata.Ecma335/src/Resources/Strings.resx index 9d38c67902..75779ebbda 100644 --- a/external/corefx/src/System.Private.Reflection.Metadata.Ecma335/src/Resources/Strings.resx +++ b/external/corefx/src/System.Private.Reflection.Metadata.Ecma335/src/Resources/Strings.resx @@ -410,10 +410,10 @@ Invalid exception region bounds: start offset ({0}) is greater than end offset ({1}). - Object is not a array with the same initialization state as the array to compare it to. + Object is not an array with the same initialization state as the array to compare it to. - Object is not a array with the same number of elements as the array to compare it to. + Object is not an array with the same number of elements as the array to compare it to. Cannot find the old value diff --git a/external/corefx/src/System.Private.Uri/src/System/IPv6AddressHelper.cs b/external/corefx/src/System.Private.Uri/src/System/IPv6AddressHelper.cs index f9dbd4698f..6c15656a81 100644 --- a/external/corefx/src/System.Private.Uri/src/System/IPv6AddressHelper.cs +++ b/external/corefx/src/System.Private.Uri/src/System/IPv6AddressHelper.cs @@ -188,7 +188,7 @@ namespace System int i; for (i = start; i < end; ++i) { - if (havePrefix ? (name[i] >= '0' && name[i] <= '9') : UriHelper.IsHexDigit(name[i])) + if (havePrefix ? (name[i] >= '0' && name[i] <= '9') : Uri.IsHexDigit(name[i])) { ++sequenceLength; expectingNumber = false; @@ -539,7 +539,7 @@ namespace System break; default: - number = number * 16 + UriHelper.FromHex(address[i++]); + number = number * 16 + Uri.FromHex(address[i++]); break; } } diff --git a/external/corefx/src/System.Private.Uri/src/System/Uri.cs.REMOVED.git-id b/external/corefx/src/System.Private.Uri/src/System/Uri.cs.REMOVED.git-id index c1fbb06296..129d2d0098 100644 --- a/external/corefx/src/System.Private.Uri/src/System/Uri.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Uri/src/System/Uri.cs.REMOVED.git-id @@ -1 +1 @@ -75097df175d066a977d4123419651e7561af14a9 \ No newline at end of file +264ccdb37390f7aa4c199c35004ec15e2c18b94d \ No newline at end of file diff --git a/external/corefx/src/System.Private.Uri/src/System/UriExt.cs b/external/corefx/src/System.Private.Uri/src/System/UriExt.cs index feaba6df4e..8c03b1f85e 100644 --- a/external/corefx/src/System.Private.Uri/src/System/UriExt.cs +++ b/external/corefx/src/System.Private.Uri/src/System/UriExt.cs @@ -224,7 +224,7 @@ namespace System { for (int i = 0; i < data.Length - 2; ++i) { - if (tempPtr[i] == '%' && UriHelper.IsHexDigit(tempPtr[i + 1]) && UriHelper.IsHexDigit(tempPtr[i + 2]) + if (tempPtr[i] == '%' && IsHexDigit(tempPtr[i + 1]) && IsHexDigit(tempPtr[i + 2]) && tempPtr[i + 1] >= '0' && tempPtr[i + 1] <= '7') // max 0x7F { char ch = UriHelper.EscapedAscii(tempPtr[i + 1], tempPtr[i + 2]); diff --git a/external/corefx/src/System.Private.Uri/src/System/UriHelper.cs b/external/corefx/src/System.Private.Uri/src/System/UriHelper.cs index abf7109f49..6bf0afef92 100644 --- a/external/corefx/src/System.Private.Uri/src/System/UriHelper.cs +++ b/external/corefx/src/System.Private.Uri/src/System/UriHelper.cs @@ -9,7 +9,7 @@ namespace System { internal static class UriHelper { - private static readonly char[] s_hexUpperChars = { + internal static readonly char[] s_hexUpperChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; @@ -715,52 +715,6 @@ namespace System return (ch == ':' || ch == '/' || ch == '?' || ch == '#' || ch == '[' || ch == ']' || ch == '@'); } - // - // IsHexDigit - // - // Determines whether a character is a valid hexadecimal digit in the range - // [0..9] | [A..F] | [a..f] - // - // Inputs: - // character - // Character to test - // - // Returns: - // true if is a hexadecimal digit character - // - // Throws: - // Nothing - // - internal static bool IsHexDigit(char character) - { - return ((character >= '0') && (character <= '9')) - || ((character >= 'A') && (character <= 'F')) - || ((character >= 'a') && (character <= 'f')); - } - - // - // Returns: - // Number in the range 0..15 - // - // Throws: - // ArgumentException - // - internal static int FromHex(char digit) - { - if (((digit >= '0') && (digit <= '9')) - || ((digit >= 'A') && (digit <= 'F')) - || ((digit >= 'a') && (digit <= 'f'))) - { - return (digit <= '9') - ? ((int)digit - (int)'0') - : (((digit <= 'F') - ? ((int)digit - (int)'A') - : ((int)digit - (int)'a')) - + 10); - } - throw new ArgumentOutOfRangeException(nameof(digit)); - } - internal static readonly char[] s_WSchars = new char[] { ' ', '\n', '\r', '\t' }; internal static bool IsLWS(char ch) diff --git a/external/corefx/src/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj b/external/corefx/src/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj index dafeadbd56..9797bea754 100644 --- a/external/corefx/src/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj +++ b/external/corefx/src/System.Private.Uri/tests/FunctionalTests/System.Private.Uri.Functional.Tests.csproj @@ -30,9 +30,6 @@ Common\System\ThreadCultureChange.cs - - Common\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs b/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs index 4e204362a1..c38f8cb7cc 100644 --- a/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs +++ b/external/corefx/src/System.Private.Xml.Linq/src/System/Xml/Linq/XElement.cs @@ -1867,7 +1867,7 @@ namespace System.Xml.Linq } /// - /// Generates a from its XML respresentation. + /// Generates a from its XML representation. /// /// /// The stream from which the diff --git a/external/corefx/src/System.Private.Xml.Linq/tests/XDocument.Common/ManagedNodeWriter.cs b/external/corefx/src/System.Private.Xml.Linq/tests/XDocument.Common/ManagedNodeWriter.cs index ae566d7640..9a6f35f46c 100644 --- a/external/corefx/src/System.Private.Xml.Linq/tests/XDocument.Common/ManagedNodeWriter.cs +++ b/external/corefx/src/System.Private.Xml.Linq/tests/XDocument.Common/ManagedNodeWriter.cs @@ -247,7 +247,7 @@ namespace CoreXml.Test.XLinq } /// - /// This method is a conveinience method and a shortcut to create an XML string. Each character in the pattern + /// This method is a convenience method and a shortcut to create an XML string. Each character in the pattern /// maps to a particular Put/Open function and calls it for you. For e.g. XEAA/ will call PutDecl, OpenElement, /// PutAttribute, PutAttribute and CloseElement for you. /// The following is the list of all allowed characters and their function mappings : diff --git a/external/corefx/src/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj b/external/corefx/src/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj index 993626a53f..7ef7bfd746 100644 --- a/external/corefx/src/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj +++ b/external/corefx/src/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj @@ -13,9 +13,6 @@ Common\System\Collections\DictionaryExtensions.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Private.Xml/src/Resources/Strings.resx.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/Resources/Strings.resx.REMOVED.git-id index 0b1ba51cee..21e9d4f811 100644 --- a/external/corefx/src/System.Private.Xml/src/Resources/Strings.resx.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/Resources/Strings.resx.REMOVED.git-id @@ -1 +1 @@ -e77bbd0d6502c25da8491caec88d062627d0a114 \ No newline at end of file +c3943b26f7a36fe94f98d5240a9c1018939cc2ed \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System.Private.Xml.csproj b/external/corefx/src/System.Private.Xml/src/System.Private.Xml.csproj index cf2a04bbd9..79811fa6f7 100644 --- a/external/corefx/src/System.Private.Xml/src/System.Private.Xml.csproj +++ b/external/corefx/src/System.Private.Xml/src/System.Private.Xml.csproj @@ -6,7 +6,7 @@ System.Private.Xml System.Xml true - $(NoWarn),649 + $(NoWarn),649,169,414 true $(DefineConstants);FEATURE_COMPILED_XSL $(DefineConstants);FEATURE_SERIALIZATION_UAPAOT;UAPAOT diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/HtmlRawTextWriterGenerator.cxx b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/HtmlRawTextWriterGenerator.cxx index 74145926f1..10c3fc6d35 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/HtmlRawTextWriterGenerator.cxx +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/HtmlRawTextWriterGenerator.cxx @@ -762,7 +762,7 @@ namespace System.Xml { // int indentLevel; - // for detecting SE SC sitution + // for detecting SE SC situation int endBlockPos; // settings diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlEncodedRawTextWriter.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlEncodedRawTextWriter.cs index 4c7860d105..a1e6c3e1d2 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlEncodedRawTextWriter.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlEncodedRawTextWriter.cs @@ -180,10 +180,10 @@ namespace System.Xml if (!stream.CanSeek || stream.Position == 0) { - byte[] bom = encoding.GetPreamble(); + ReadOnlySpan bom = encoding.Preamble; if (bom.Length != 0) { - this.stream.Write(bom, 0, bom.Length); + this.stream.Write(bom); } } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlRawTextWriterGenerator.cxx b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlRawTextWriterGenerator.cxx index 478b502c5c..14fd08339a 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlRawTextWriterGenerator.cxx +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlRawTextWriterGenerator.cxx @@ -210,9 +210,9 @@ namespace System.Xml { // Output UTF-8 byte order mark if Encoding object wants it if ( !stream.CanSeek || stream.Position == 0 ) { - byte[] bom = encoding.GetPreamble(); + ReadOnlySpan bom = encoding.Preamble; if ( bom.Length != 0 ) { - Buffer.BlockCopy( bom, 0, bufBytes, 1, bom.Length ); + bom.CopyTo(new Span(bufBytes).Slice(1)); bufPos += bom.Length; textPos += bom.Length; } @@ -237,9 +237,9 @@ namespace System.Xml { encoder = encoding.GetEncoder(); if ( !stream.CanSeek || stream.Position == 0 ) { - byte[] bom = encoding.GetPreamble(); + ReadOnlySpan bom = encoding.Preamble; if ( bom.Length != 0 ) { - this.stream.Write( bom, 0, bom.Length ); + this.stream.Write( bom ); } } #endif @@ -370,7 +370,7 @@ namespace System.Xml { // StartElementContent is always called; therefore, in order to allow shortcut syntax, we save the // position of the '>' character. If WriteEndElement is called and no other characters have been - // output, then the '>' character can be be overwritten with the shortcut syntax " />". + // output, then the '>' character can be overwritten with the shortcut syntax " />". contentPos = bufPos; } @@ -1558,7 +1558,7 @@ namespace System.Xml { } } - // Following methods do not check whether pDst is beyond the bufSize because the buffer was allocated with a OVERFLOW to accomodate + // Following methods do not check whether pDst is beyond the bufSize because the buffer was allocated with a OVERFLOW to accommodate // for the writes of small constant-length string as below. // Entitize '<' as "<". Return an updated pointer. diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlReaderSettings.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlReaderSettings.cs index 58304768d2..e72c3abcb8 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlReaderSettings.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlReaderSettings.cs @@ -57,6 +57,12 @@ namespace System.Xml // read-only flag private bool _isReadOnly; + // Creation of validating readers is hidden behind a delegate which is only initialized if the ValidationType + // property is set. This is for AOT builds where the tree shaker can reduce the validating readers away + // if nobody calls the ValidationType setter. Might also help with non-AOT build when ILLinker is used. + delegate XmlReader AddValidationFunc(XmlReader reader, XmlResolver resolver, bool addConformanceWrapper); + private AddValidationFunc _addValidationFunc; + // // Constructor // @@ -317,6 +323,12 @@ namespace System.Xml { CheckReadOnly("ValidationType"); + // This introduces a dependency on the validation readers and along with that + // on XmlSchema and so on. For AOT builds this brings in a LOT of code + // which we would like to avoid unless it's needed. So the first approximation + // is to only reference this method when somebody explicitly sets the ValidationType. + _addValidationFunc = AddValidationInternal; + if ((uint)value > (uint)ValidationType.Schema) { throw new ArgumentOutOfRangeException(nameof(value)); @@ -574,34 +586,68 @@ namespace System.Xml internal XmlReader AddValidation(XmlReader reader) { + XmlResolver resolver = null; if (_validationType == ValidationType.Schema) { - XmlResolver resolver = GetXmlResolver_CheckConfig(); + resolver = GetXmlResolver_CheckConfig(); if (resolver == null && !this.IsXmlResolverSet) { resolver = new XmlUrlResolver(); } - reader = new XsdValidatingReader(reader, resolver, this); } - else if (_validationType == ValidationType.DTD) - { - reader = CreateDtdValidatingReader(reader); - } - return reader; + + return AddValidationAndConformanceInternal(reader, resolver, addConformanceWrapper: false); } private XmlReader AddValidationAndConformanceWrapper(XmlReader reader) + { + XmlResolver resolver = null; + if (_validationType == ValidationType.Schema) + { + resolver = GetXmlResolver_CheckConfig(); + } + + return AddValidationAndConformanceInternal(reader, resolver, addConformanceWrapper: true); + } + + private XmlReader AddValidationAndConformanceInternal(XmlReader reader, XmlResolver resolver, bool addConformanceWrapper) + { + // We have to avoid calling the _addValidationFunc delegate if there's no validation to setup + // since it would not be initialized (to allow AOT compilers to reduce it away). + // So if that's the case and we still need conformance wrapper add it here directly. + // This is a slight code duplication, but it's necessary due to ordering constrains + // of the reader wrapping as described in AddValidationInternal. + if (_validationType == ValidationType.None) + { + if (addConformanceWrapper) + { + reader = AddConformanceWrapper(reader); + } + } + else + { + reader = _addValidationFunc(reader, resolver, addConformanceWrapper); + } + + return reader; + } + + private XmlReader AddValidationInternal(XmlReader reader, XmlResolver resolver, bool addConformanceWrapper) { // wrap with DTD validating reader if (_validationType == ValidationType.DTD) { reader = CreateDtdValidatingReader(reader); } - // add conformance checking (must go after DTD validation because XmlValidatingReader works only on XmlTextReader), - // but before XSD validation because of typed value access - reader = AddConformanceWrapper(reader); + + if (addConformanceWrapper) + { + // add conformance checking (must go after DTD validation because XmlValidatingReader works only on XmlTextReader), + // but before XSD validation because of typed value access + reader = AddConformanceWrapper(reader); + } if (_validationType == ValidationType.Schema) { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs.REMOVED.git-id index 505a4c6c99..71f0515ce1 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImpl.cs.REMOVED.git-id @@ -1 +1 @@ -ea72797ef07aa4d2362a1c076b5011737e90a5a7 \ No newline at end of file +f61ee01bc81ab91baf7cfa91e2518476df8748bb \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImplAsync.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImplAsync.cs.REMOVED.git-id index 4cae2e147f..a74edbc14a 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImplAsync.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlTextReaderImplAsync.cs.REMOVED.git-id @@ -1 +1 @@ -7cd3a428d01a47811be8493a650592d7d91fec12 \ No newline at end of file +4dc66f8de506c8032ca0c6634ccf946e2d4a3f72 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlUtf8RawTextWriter.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlUtf8RawTextWriter.cs index 276b793cbe..cdf5290c91 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlUtf8RawTextWriter.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlUtf8RawTextWriter.cs @@ -125,10 +125,10 @@ namespace System.Xml // Output UTF-8 byte order mark if Encoding object wants it if (!stream.CanSeek || stream.Position == 0) { - byte[] bom = encoding.GetPreamble(); + ReadOnlySpan bom = encoding.Preamble; if (bom.Length != 0) { - Buffer.BlockCopy(bom, 0, bufBytes, 1, bom.Length); + bom.CopyTo(new Span(bufBytes).Slice(1)); bufPos += bom.Length; textPos += bom.Length; } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlValidatingReaderImpl.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlValidatingReaderImpl.cs index 191db08572..c2c10347e7 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlValidatingReaderImpl.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XmlValidatingReaderImpl.cs @@ -57,7 +57,7 @@ namespace System.Xml { _eventHandler(_reader, new ValidationEventArgs((XmlSchemaException)exception, severity)); } - else if (_reader.ValidationType != ValidationType.None && severity == XmlSeverityType.Error) + else if (_reader._validationType != ValidationType.None && severity == XmlSeverityType.Error) { throw exception; } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs index afc0d51c94..0c4862631e 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs @@ -247,7 +247,7 @@ namespace System.Xml string prefix = _validator.GetDefaultAttributePrefix(_cachedNode.Namespace); if (prefix != null && prefix.Length != 0) { - return string.Concat(prefix + ":" + _cachedNode.LocalName); + return prefix + ":" + _cachedNode.LocalName; } return _cachedNode.LocalName; } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNode.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNode.cs index 53e5d54a28..fd52964ea8 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNode.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNode.cs @@ -1419,5 +1419,50 @@ namespace System.Xml nextNode.parentNode = prevNode.ParentNode; } + + private object debuggerDisplayProxy { get { return new DebuggerDisplayXmlNodeProxy(this); } } + + [DebuggerDisplay("{ToString()}")] + internal struct DebuggerDisplayXmlNodeProxy + { + private readonly XmlNode _node; + + public DebuggerDisplayXmlNodeProxy(XmlNode node) + { + _node = node; + } + + public override string ToString() + { + XmlNodeType nodeType = _node.NodeType; + string result = nodeType.ToString(); + switch (nodeType) + { + case XmlNodeType.Element: + case XmlNodeType.EntityReference: + result += ", Name=\"" + _node.Name + "\""; + break; + case XmlNodeType.Attribute: + case XmlNodeType.ProcessingInstruction: + result += ", Name=\"" + _node.Name + "\", Value=\"" + XmlConvert.EscapeValueForDebuggerDisplay(_node.Value) + "\""; + break; + case XmlNodeType.Text: + case XmlNodeType.CDATA: + case XmlNodeType.Comment: + case XmlNodeType.Whitespace: + case XmlNodeType.SignificantWhitespace: + case XmlNodeType.XmlDeclaration: + result += ", Value=\"" + XmlConvert.EscapeValueForDebuggerDisplay(_node.Value) + "\""; + break; + case XmlNodeType.DocumentType: + XmlDocumentType documentType = (XmlDocumentType)_node; + result += ", Name=\"" + documentType.Name + "\", SYSTEM=\"" + documentType.SystemId + "\", PUBLIC=\"" + documentType.PublicId + "\", Value=\"" + XmlConvert.EscapeValueForDebuggerDisplay(documentType.InternalSubset) + "\""; + break; + default: + break; + } + return result; + } + } } } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs index 87a3382605..a02d29aa8f 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Dom/XmlNodeReader.cs @@ -550,7 +550,7 @@ namespace System.Xml } //The function has to be used in pair with ResetMove when the operation fails after LogMove() is - // called because it relies on the values of nOrigLevel, logNav and nOrigAttrInd to be acurate. + // called because it relies on the values of nOrigLevel, logNav and nOrigAttrInd to be accurate. public void RollBackMove(ref int level) { _curNode = _logNode; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/ContentValidator.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/ContentValidator.cs index 9d743ae2dd..6be131d8f5 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/ContentValidator.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/ContentValidator.cs @@ -31,9 +31,9 @@ namespace System.Xml.Schema /// /// SymbolsDictionary is a map between names that ContextValidator recognizes and symbols - int symbol[XmlQualifiedName name]. - /// There are two types of name - full names and wildcards (namespace is specified, local name is anythig). + /// There are two types of name - full names and wildcards (namespace is specified, local name is anything). /// Wildcard excludes all full names that would match by the namespace part. - /// SymbolsDictionry alwas recognizes all the symbols - the last one is a true wildcard - + /// SymbolsDictionary always recognizes all the symbols - the last one is a true wildcard - /// both name and namespace can be anything that none of the other symbols matched. /// internal class SymbolsDictionary diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs.REMOVED.git-id index a8b4b50964..ae8b6bdeca 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs.REMOVED.git-id @@ -1 +1 @@ -264c03a7c537921da59208229fbf3fae1c7d7ec4 \ No newline at end of file +77789d10cda8fba2840c7d9e511f02bf820c2066 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/Preprocessor.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/Preprocessor.cs index 32da9380b0..4e34a7dfb2 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/Preprocessor.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/Preprocessor.cs @@ -128,7 +128,7 @@ namespace System.Xml.Schema XmlSchema listSchema; try { - //Accquire locks on all schema objects; Need to lock only on pre-created schemas and not parsed schemas + //Acquire locks on all schema objects; Need to lock only on pre-created schemas and not parsed schemas for (schemaIndex = 0; schemaIndex < _lockList.Count; schemaIndex++) { listSchema = (XmlSchema)_lockList.GetByIndex(schemaIndex); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XdrBuilder.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XdrBuilder.cs index 40144b2650..47425b23eb 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XdrBuilder.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XdrBuilder.cs @@ -1120,7 +1120,7 @@ namespace System.Xml.Schema goto cleanup; } - // a attributes of type id is not supposed to have a default value + // an attribute of type id is not supposed to have a default value if (builder._AttributeDef._Default != null && ttype == XmlTokenizedType.ID) { code = SR.Sch_DefaultIdValue; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs index 7b734fa40c..13fa157b06 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs @@ -22,7 +22,6 @@ namespace System.Xml.Schema private int _lineNumber; private int _linePosition; - [NonSerialized] private XmlSchemaObject _sourceSchemaObject; // message != null for V1 exceptions deserialized in Whidbey diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaSet.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaSet.cs index 624847c35e..089b14a4bb 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaSet.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaSet.cs @@ -621,7 +621,7 @@ namespace System.Xml.Schema } try { //First thing to do in the try block is to acquire locks since finally will try to release them. - //If we dont accuire the locks first, and an exception occurs in the code before the locking code, then Threading.SynchronizationLockException will be thrown + //If we don't acquire the locks first, and an exception occurs in the code before the locking code, then Threading.SynchronizationLockException will be thrown //when attempting to release it in the finally block XmlSchema currentSchema; XmlSchema xmlNSSchema = Preprocessor.GetBuildInSchema(); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs.REMOVED.git-id index e886ed06ca..66e9602508 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs.REMOVED.git-id @@ -1 +1 @@ -42563d4172cc430396037dd7c4b01b3903220056 \ No newline at end of file +536e0995153ae463df98c67ec18a8d0819eaf992 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeGenerationoptions.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeGenerationoptions.cs index 0e0b7cd200..ad75d457e4 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeGenerationoptions.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeGenerationoptions.cs @@ -14,10 +14,14 @@ namespace System.Xml.Serialization /// /// - /// Specifies varoius flavours of XmlCodeExporter generated code. + /// Specifies various flavours of XmlCodeExporter generated code. /// [Flags] +#if XMLSERIALIZERGENERATOR + internal enum CodeGenerationOptions +#else public enum CodeGenerationOptions +#endif { /// /// diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs index c4bd5f2aa7..943a0e9ae0 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifier.cs @@ -20,7 +20,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class CodeIdentifier +#else public class CodeIdentifier +#endif { internal const int MaxIdentifierLength = 511; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifiers.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifiers.cs index 12169ea56c..a95a0b492c 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifiers.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/CodeIdentifiers.cs @@ -38,7 +38,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class CodeIdentifiers +#else public class CodeIdentifiers +#endif { private Hashtable _identifiers; private Hashtable _reservedIdentifiers; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs index c4a70601d0..73f1f8fe54 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs @@ -172,9 +172,10 @@ namespace System.Xml.Serialization name.Name = serializerName; name.CodeBase = null; name.CultureInfo = CultureInfo.InvariantCulture; + string serializerPath = Path.Combine(Path.GetDirectoryName(type.Assembly.Location), serializerName + ".dll"); try { - serializer = Assembly.LoadFile(Path.GetFullPath(serializerName) + ".dll"); + serializer = Assembly.LoadFile(serializerPath); } catch (Exception e) { @@ -232,12 +233,6 @@ namespace System.Xml.Serialization } #if XMLSERIALIZERGENERATOR - internal static class ThisAssembly - { - internal const string Version = "1.0.0.0"; - internal const string InformationalVersion = "1.0.0.0"; - } - private static string GenerateAssemblyId(Type type) { Module[] modules = type.Assembly.GetModules(); @@ -420,7 +415,7 @@ namespace System.Xml.Serialization string assemblyName = "Microsoft.GeneratedCode"; AssemblyBuilder assemblyBuilder = CodeGenerator.CreateAssemblyBuilder(assemblyName); - // Add AssemblyVersion attribute to match parent accembly version + // Add AssemblyVersion attribute to match parent assembly version if (types != null && types.Length > 0 && types[0] != null) { ConstructorInfo AssemblyVersionAttribute_ctor = typeof(AssemblyVersionAttribute).GetConstructor( diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/IXmlTextParser.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/IXmlTextParser.cs index f2fadba5f7..1a317459e0 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/IXmlTextParser.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/IXmlTextParser.cs @@ -15,7 +15,11 @@ namespace System.Xml.Serialization /// /// This class is . /// +#if XMLSERIALIZERGENERATOR + internal interface IXmlTextParser +#else public interface IXmlTextParser +#endif { /// /// diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapReflectionImporter.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapReflectionImporter.cs index 603a8d3a8a..f1bd443a62 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapReflectionImporter.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapReflectionImporter.cs @@ -23,7 +23,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class SoapReflectionImporter +#else public class SoapReflectionImporter +#endif { private TypeScope _typeScope; private SoapAttributeOverrides _attributeOverrides; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapSchemamember.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapSchemamember.cs index a15a8ded68..1f056c0d5a 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapSchemamember.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/SoapSchemamember.cs @@ -13,7 +13,11 @@ namespace System.Xml.Serialization /// /// +#if XMLSERIALIZERGENERATOR + internal class SoapSchemaMember +#else public class SoapSchemaMember +#endif { private string _memberName; private XmlQualifiedName _type = XmlQualifiedName.Empty; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs index 9cbe48db38..d24e2666ae 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributeOverrides.cs @@ -19,7 +19,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlAttributeOverrides +#else public class XmlAttributeOverrides +#endif { private readonly Dictionary> _types = new Dictionary>(); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributes.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributes.cs index 35357b8531..eea7dd42b7 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributes.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlAttributes.cs @@ -35,7 +35,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlAttributes +#else public class XmlAttributes +#endif { private XmlElementAttributes _xmlElements = new XmlElementAttributes(); private XmlArrayItemAttributes _xmlArrayItems = new XmlArrayItemAttributes(); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMapping.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMapping.cs index 981c9497ef..f44af553e5 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMapping.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMapping.cs @@ -16,7 +16,11 @@ namespace System.Xml.Serialization #endif { [Flags] +#if XMLSERIALIZERGENERATOR + internal enum XmlMappingAccess +#else public enum XmlMappingAccess +#endif { None = 0x00, Read = 0x01, @@ -27,7 +31,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal abstract class XmlMapping +#else public abstract class XmlMapping +#endif { private TypeScope _scope; private bool _generateSerializer = false; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMemberMapping.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMemberMapping.cs index f11b052b94..44cfa83562 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMemberMapping.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMemberMapping.cs @@ -13,7 +13,11 @@ namespace System.Xml.Serialization #endif { /// +#if XMLSERIALIZERGENERATOR + internal class XmlMemberMapping +#else public class XmlMemberMapping +#endif { private MemberMapping _mapping; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs index 8a5634783b..5578e133f5 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlMembersMapping.cs @@ -17,7 +17,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlMembersMapping : XmlMapping +#else public class XmlMembersMapping : XmlMapping +#endif { private XmlMemberMapping[] _mappings; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionImporter.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionImporter.cs.REMOVED.git-id index 8a7b6bd282..ad84bf754e 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionImporter.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionImporter.cs.REMOVED.git-id @@ -1 +1 @@ -880513fae7ed8a9496d3e8b3b680364e8e9513ae \ No newline at end of file +d131f471f55694f3d6068c6a29640a9eeb8e789d \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionMember.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionMember.cs index bd154a8d69..2ef1c0373e 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionMember.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlReflectionMember.cs @@ -16,7 +16,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlReflectionMember +#else public class XmlReflectionMember +#endif { private string _memberName; private Type _type; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationGeneratedCode.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationGeneratedCode.cs index 83c6afe19d..caabe4b045 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationGeneratedCode.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationGeneratedCode.cs @@ -18,7 +18,11 @@ namespace System.Xml.Serialization using System.Globalization; /// +#if XMLSERIALIZERGENERATOR + internal abstract class XmlSerializationGeneratedCode +#else public abstract class XmlSerializationGeneratedCode +#endif { internal void Init(TempAssembly tempAssembly) { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs index a39f9c45e4..8229bf3465 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReader.cs @@ -24,7 +24,11 @@ namespace System.Xml.Serialization using System.Xml.Serialization.Configuration; /// +#if XMLSERIALIZERGENERATOR + internal abstract class XmlSerializationReader : XmlSerializationGeneratedCode +#else public abstract class XmlSerializationReader : XmlSerializationGeneratedCode +#endif { private XmlReader _r; private XmlCountingReader _countingReader; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs index db54775549..ef0541fe1d 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationWriter.cs @@ -25,7 +25,11 @@ namespace System.Xml.Serialization using System.Xml; /// +#if XMLSERIALIZERGENERATOR + internal abstract class XmlSerializationWriter : XmlSerializationGeneratedCode +#else public abstract class XmlSerializationWriter : XmlSerializationGeneratedCode +#endif { private XmlWriter _w; private XmlSerializerNamespaces _namespaces; @@ -1440,7 +1444,12 @@ namespace System.Xml.Serialization /// +#if XMLSERIALIZERGENERATOR + internal delegate void XmlSerializationWriteCallback(object o); +#else public delegate void XmlSerializationWriteCallback(object o); +#endif + internal static class DynamicAssemblies { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs index 81293b5bf6..18532d5659 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs @@ -28,7 +28,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal struct XmlDeserializationEvents +#else public struct XmlDeserializationEvents +#endif { private XmlNodeEventHandler _onUnknownNode; private XmlAttributeEventHandler _onUnknownAttribute; @@ -97,7 +101,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal abstract class XmlSerializerImplementation +#else public abstract class XmlSerializerImplementation +#endif { /// public virtual XmlSerializationReader Reader { get { throw new NotSupportedException(); } } @@ -115,23 +123,32 @@ namespace System.Xml.Serialization public virtual XmlSerializer GetSerializer(Type type) { throw new NotSupportedException(); } } + // This enum is intentionally kept outside of the XmlSerializer class since if it would be a subclass + // of XmlSerializer, then any access to this enum would be treated by AOT compilers as access to the XmlSerializer + // as well, which has a large static ctor which brings in a lot of code. So keeping the enum separate + // makes sure that using just the enum itself doesn't bring in the whole of serialization code base. +#if FEATURE_SERIALIZATION_UAPAOT + public enum SerializationMode +#else + internal enum SerializationMode +#endif + { + CodeGenOnly, + ReflectionOnly, + ReflectionAsBackup, + PreGenOnly + } + /// /// /// [To be supplied.] /// - public class XmlSerializer - { -#if FEATURE_SERIALIZATION_UAPAOT - public enum SerializationMode +#if XMLSERIALIZERGENERATOR + internal class XmlSerializer #else - internal enum SerializationMode + public class XmlSerializer #endif - { - CodeGenOnly, - ReflectionOnly, - ReflectionAsBackup - } - + { #if FEATURE_SERIALIZATION_UAPAOT public static SerializationMode Mode { get; set; } = SerializationMode.ReflectionAsBackup; #else @@ -277,6 +294,13 @@ namespace System.Xml.Serialization Assembly assembly = TempAssembly.LoadGeneratedAssembly(type, defaultNamespace, out contract); if (assembly == null) { + if (Mode == SerializationMode.PreGenOnly) + { + AssemblyName name = type.Assembly.GetName(); + var serializerName = Compiler.GetTempAssemblyName(name, defaultNamespace); + throw new FileLoadException(SR.Format(SR.FailLoadAssemblyUnderPregenMode, serializerName)); + } + // need to reflect and generate new serialization assembly XmlReflectionImporter importer = new XmlReflectionImporter(defaultNamespace); _mapping = importer.ImportTypeMapping(type, null, defaultNamespace); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerFactory.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerFactory.cs index a239856af0..737106267f 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerFactory.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerFactory.cs @@ -25,7 +25,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlSerializerFactory +#else public class XmlSerializerFactory +#endif { private static TempAssemblyCache s_cache = new TempAssemblyCache(); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerNamespaces.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerNamespaces.cs index d923dac5c5..f4444900fa 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerNamespaces.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlSerializerNamespaces.cs @@ -20,7 +20,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlSerializerNamespaces +#else public class XmlSerializerNamespaces +#endif { private Dictionary _namespaces = null; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs index 4a8ebc6bb3..59debad11c 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/XmlTypeMapping.cs @@ -15,7 +15,11 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlTypeMapping : XmlMapping +#else public class XmlTypeMapping : XmlMapping +#endif { internal XmlTypeMapping(TypeScope scope, ElementAccessor accessor) : base(scope, accessor) { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/_Events.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/_Events.cs index 476744a5ab..0b681f3547 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/_Events.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Serialization/_Events.cs @@ -18,13 +18,22 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// + +#if XMLSERIALIZERGENERATOR + internal delegate void XmlAttributeEventHandler(object sender, XmlAttributeEventArgs e); +#else public delegate void XmlAttributeEventHandler(object sender, XmlAttributeEventArgs e); +#endif /// /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlAttributeEventArgs : EventArgs +#else public class XmlAttributeEventArgs : EventArgs +#endif { private object _o; private XmlAttribute _attr; @@ -96,10 +105,18 @@ namespace System.Xml.Serialization } /// +#if XMLSERIALIZERGENERATOR + internal delegate void XmlElementEventHandler(object sender, XmlElementEventArgs e); +#else public delegate void XmlElementEventHandler(object sender, XmlElementEventArgs e); +#endif /// +#if XMLSERIALIZERGENERATOR + internal class XmlElementEventArgs : EventArgs +#else public class XmlElementEventArgs : EventArgs +#endif { private object _o; private XmlElement _elem; @@ -156,13 +173,22 @@ namespace System.Xml.Serialization /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal delegate void XmlNodeEventHandler(object sender, XmlNodeEventArgs e); +#else public delegate void XmlNodeEventHandler(object sender, XmlNodeEventArgs e); +#endif + /// /// /// [To be supplied.] /// +#if XMLSERIALIZERGENERATOR + internal class XmlNodeEventArgs : EventArgs +#else public class XmlNodeEventArgs : EventArgs +#endif { private object _o; private XmlNode _xmlNode; @@ -257,10 +283,18 @@ namespace System.Xml.Serialization } /// +#if XMLSERIALIZERGENERATOR + internal delegate void UnreferencedObjectEventHandler(object sender, UnreferencedObjectEventArgs e); +#else public delegate void UnreferencedObjectEventHandler(object sender, UnreferencedObjectEventArgs e); +#endif /// +#if XMLSERIALIZERGENERATOR + internal class UnreferencedObjectEventArgs : EventArgs +#else public class UnreferencedObjectEventArgs : EventArgs +#endif { private object _o; private string _id; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/XmlEncoding.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/XmlEncoding.cs index 5f0f1b0c2c..6a7f584601 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/XmlEncoding.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/XmlEncoding.cs @@ -303,6 +303,7 @@ namespace System.Xml return new Ucs4Encoding2143(); } } + internal static Encoding UCS4_3412 { get @@ -312,8 +313,10 @@ namespace System.Xml } } - internal class Ucs4Encoding1234 : Ucs4Encoding + internal sealed class Ucs4Encoding1234 : Ucs4Encoding { + private static readonly byte[] s_preamble = new byte[4] { 0x00, 0x00, 0xfe, 0xff }; + public Ucs4Encoding1234() { ucs4Decoder = new Ucs4Decoder1234(); @@ -331,10 +334,14 @@ namespace System.Xml { return new byte[4] { 0x00, 0x00, 0xfe, 0xff }; } + + public override ReadOnlySpan Preamble => s_preamble; } - internal class Ucs4Encoding4321 : Ucs4Encoding + internal sealed class Ucs4Encoding4321 : Ucs4Encoding { + private static readonly byte[] s_preamble = new byte[4] { 0xff, 0xfe, 0x00, 0x00 }; + public Ucs4Encoding4321() { ucs4Decoder = new Ucs4Decoder4321(); @@ -352,10 +359,14 @@ namespace System.Xml { return new byte[4] { 0xff, 0xfe, 0x00, 0x00 }; } + + public override ReadOnlySpan Preamble => s_preamble; } - internal class Ucs4Encoding2143 : Ucs4Encoding + internal sealed class Ucs4Encoding2143 : Ucs4Encoding { + private static readonly byte[] s_preamble = new byte[4] { 0x00, 0x00, 0xff, 0xfe }; + public Ucs4Encoding2143() { ucs4Decoder = new Ucs4Decoder2143(); @@ -372,10 +383,14 @@ namespace System.Xml { return new byte[4] { 0x00, 0x00, 0xff, 0xfe }; } + + public override ReadOnlySpan Preamble => s_preamble; } - internal class Ucs4Encoding3412 : Ucs4Encoding + internal sealed class Ucs4Encoding3412 : Ucs4Encoding { + private static readonly byte[] s_preamble = new byte[4] { 0xfe, 0xff, 0x00, 0x00 }; + public Ucs4Encoding3412() { ucs4Decoder = new Ucs4Decoder3412(); @@ -393,6 +408,8 @@ namespace System.Xml { return new byte[4] { 0xfe, 0xff, 0x00, 0x00 }; } + + public override ReadOnlySpan Preamble => s_preamble; } internal abstract class Ucs4Decoder : Decoder diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs index e042aa8ed3..bb91f2d2ed 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs @@ -17,8 +17,6 @@ namespace System.Xml { private string _name; private string _ns; - - [NonSerialized] private Int32 _hash; /// diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/GenerateHelper.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/GenerateHelper.cs index 0d5ff81fb7..6da2423594 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/GenerateHelper.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/GenerateHelper.cs @@ -866,38 +866,6 @@ namespace System.Xml.Xsl.IlGen } } - // BUGBUG: This method is only necessary to work around VS Bug 478350 - public void CallToken(MethodInfo meth) - { - Debug.Assert(!(_methInfo is ConstructorBuilder)); - MethodBuilder methBldr = _methInfo as MethodBuilder; - - if (methBldr != null) - { - // Using regular reflection emit, so get a token for the specified method. - // The token is only valid within scope of this method's body. - OpCode opcode = meth.IsVirtual || meth.IsAbstract ? OpCodes.Callvirt : OpCodes.Call; - - TraceCall(opcode, meth); - - _ilgen.Emit(opcode, ((ModuleBuilder)methBldr.Module).MetadataToken); - - if (_lastSourceInfo != null) - { - // Emit a "no source" sequence point, otherwise the debugger would return to the wrong line - // once the call has finished. We are guaranteed not to emit adjacent sequence points because - // the Call instruction precedes this sequence point, and a nop instruction precedes other - // sequence points. - MarkSequencePoint(SourceLineInfo.NoSource); - } - } - else - { - // Using LCG, so no need to workaround - Call(meth); - } - } - public void Construct(ConstructorInfo constr) { Emit(OpCodes.Newobj, constr); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILConstructAnalyzer.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILConstructAnalyzer.cs index a8b7f9a99c..5e308fbb0c 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILConstructAnalyzer.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlILConstructAnalyzer.cs @@ -357,7 +357,7 @@ namespace System.Xml.Xsl.IlGen } /// - /// This annotation is only applicable to Function nodes. It contains a list of XmlILConstructInfo annontations + /// This annotation is only applicable to Function nodes. It contains a list of XmlILConstructInfo annotations /// for all QilInvoke nodes which call the annotated function. /// public ArrayList CallersInfo diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlIlVisitor.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlIlVisitor.cs.REMOVED.git-id index a8b9d369a6..d781634100 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlIlVisitor.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/IlGen/XmlIlVisitor.cs.REMOVED.git-id @@ -1 +1 @@ -79be13b66558a8dbede03c2da993d1d7087c6739 \ No newline at end of file +923100a232ff88f4c31fe529d3e63f16dfcfd297 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeEarlyBound.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeEarlyBound.cs index 0859fe8e0f..6809b080a9 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeEarlyBound.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeEarlyBound.cs @@ -9,7 +9,7 @@ using System.Reflection; namespace System.Xml.Xsl.Qil { /// - /// A function invocation node which reperesents a call to an early bound Clr function. + /// A function invocation node which represents a call to an early bound Clr function. /// internal class QilInvokeEarlyBound : QilTernary { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeLateBound.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeLateBound.cs index 0e1cd0ff62..25d7ff0274 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeLateBound.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilInvokeLateBound.cs @@ -8,7 +8,7 @@ using System.Diagnostics; namespace System.Xml.Xsl.Qil { /// - /// A function invocation node which reperesents a call to an late bound function. + /// A function invocation node which represents a call to an late bound function. /// internal class QilInvokeLateBound : QilBinary { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilName.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilName.cs index 13ee5525d6..602f557e9b 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilName.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilName.cs @@ -99,7 +99,7 @@ namespace System.Xml.Xsl.Qil } /// - /// Implement operator == to prevent exidental referential comarison + /// Implement operator == to prevent accidental referential comparison /// /// Does not compare their prefixes (if any). public static bool operator ==(QilName a, QilName b) @@ -116,7 +116,7 @@ namespace System.Xml.Xsl.Qil } /// - /// Implement operator != to prevent exidental referential comarison + /// Implement operator != to prevent accidental referential comparison /// /// Does not compare their prefixes (if any). public static bool operator !=(QilName a, QilName b) diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilPatternFactory.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilPatternFactory.cs index 2da6e617a7..cb087e5b31 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilPatternFactory.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/QilPatternFactory.cs @@ -226,7 +226,7 @@ namespace System.Xml.Xsl.Qil //----------------------------------------------- private static void CheckLogicArg(QilNode arg) { - Debug.Assert(arg != null, "Argulent shouldn't be null"); + Debug.Assert(arg != null, "Argument shouldn't be null"); Debug.Assert(arg.XmlType.TypeCode == XmlTypeCode.Boolean && arg.XmlType.IsSingleton, "The operand must be boolean-typed" ); diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/SubstitutionList.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/SubstitutionList.cs index cb9606eecd..21c9895b6b 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/SubstitutionList.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/SubstitutionList.cs @@ -24,7 +24,7 @@ namespace System.Xml.Xsl.Qil } /// - /// Add a substituion pair + /// Add a substitution pair /// /// a node to be replaced /// its replacement @@ -35,7 +35,7 @@ namespace System.Xml.Xsl.Qil } /// - /// Remove the last a substituion pair + /// Remove the last a substitution pair /// public void RemoveLastSubstitutionPair() { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs index 1ae1701a81..b8f85ce607 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs @@ -53,7 +53,7 @@ namespace System.Xml.Xsl.Runtime } /// - /// Override GetHashCode since Equals is overriden. + /// Override GetHashCode since Equals is overridden. /// public override int GetHashCode() { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlAttributeCache.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlAttributeCache.cs index d1b06c2dfd..b14a2cd31a 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlAttributeCache.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlAttributeCache.cs @@ -167,7 +167,7 @@ namespace System.Xml.Xsl.Runtime } /// - /// Send cached, non-overriden attributes to the specified writer. Calling this method has + /// Send cached, non-overridden attributes to the specified writer. Calling this method has /// the side effect of clearing the attribute cache. /// internal override void StartElementContent() diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlExtensionFunction.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlExtensionFunction.cs index dced86b180..28849e6c41 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlExtensionFunction.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Runtime/XmlExtensionFunction.cs @@ -331,7 +331,7 @@ namespace System.Xml.Xsl.Runtime } /// - /// Infer an Xml type from a Clr type using Xslt infererence rules + /// Infer an Xml type from a Clr type using Xslt inference rules /// private XmlQueryType InferXmlType(Type clrType) { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathBuilder.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathBuilder.cs index 6af8916b41..6f63812b35 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathBuilder.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathBuilder.cs @@ -452,7 +452,7 @@ namespace System.Xml.Xsl.XPath if (isReverseStep) { Debug.Assert(nodeset.NodeType == QilNodeType.DocOrderDistinct, - "ReverseAxe in Qil is actuly reverse and we compile them here in builder by wrapping to DocOrderDistinct()" + "ReverseAxe in Qil is actually reverse and we compile them here in builder by wrapping to DocOrderDistinct()" ); // The trick here is that we unwarp it back, compile as regular predicate and wrap again. // this way this wat we hold invariant that path expresion are always DOD and make predicates on reverse axe diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryType.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryType.cs index f0d740d6a4..e2d972055f 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryType.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryType.cs @@ -60,7 +60,7 @@ namespace System.Xml.Xsl public abstract XmlTypeCode TypeCode { get; } /// - /// Set of alowed names for element, document{element}, attribute and PI + /// Set of allowed names for element, document{element}, attribute and PI /// Returns XmlQualifiedName.Wildcard for all other types /// public abstract XmlQualifiedNameTest NameTest { get; } @@ -70,7 +70,7 @@ namespace System.Xml.Xsl /// SchemaType will follow these rules: /// 1. If TypeCode is an atomic type code, then SchemaType will be the corresponding non-null simple type /// 2. If TypeCode is Element or Attribute, then SchemaType will be the non-null content type - /// 3. If TypeCode is Item, Node, Comment, PI, Text, Document, Namespacce, None, then SchemaType will be AnyType + /// 3. If TypeCode is Item, Node, Comment, PI, Text, Document, Namespace, None, then SchemaType will be AnyType /// public abstract XmlSchemaType SchemaType { get; } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryTypeFactory.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryTypeFactory.cs index e6439022bd..fa37f8093c 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryTypeFactory.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XmlQueryTypeFactory.cs @@ -1346,7 +1346,7 @@ namespace System.Xml.Xsl } /// - /// Converts type of sequence of items to type of sequnce of atomic value + /// Converts type of sequence of items to type of sequence of atomic value // See http://www.w3.org/TR/2004/xquery-semantics/#jd_data for the detailed description /// /// source type @@ -1529,7 +1529,7 @@ namespace System.Xml.Xsl case XmlTypeCode.Element: XmlSchemaType sourceSchemaType = sourceItem.SchemaType; if (sourceSchemaType == XmlSchemaComplexType.UntypedAnyType) { - // attfibutes of of xdt:untypedAny are attribute(*, xdt:untypedAtomic)* + // attributes of xdt:untypedAny are attribute(*, xdt:untypedAtomic)* card |= AddFilteredPrime(list, UntypedAttribute, filter) * XmlQueryCardinality.ZeroOrOne; } else { diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/InvokeGenerator.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/InvokeGenerator.cs index c636c38660..d3727ba865 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/InvokeGenerator.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/InvokeGenerator.cs @@ -11,13 +11,13 @@ namespace System.Xml.Xsl.Xslt using T = XmlQueryTypeFactory; /** - InvokeGenerator is one of the trikest peaces here. + InvokeGenerator is one of the trickiest peaces here. ARGS: QilFunction func -- Functions which should be invoked. Arguments of this function (formalArgs) are Let nodes - anotated with names and default valies. - Problem 1 is that default values can contain references to previouse args of this function. - Problem 2 is that default values shouldn't contain fixup nodes. - ArrayList actualArgs -- Array of QilNodes anotated with names. When name of formalArg match name actualArg last one + annotated with names and default values. + Problem 1 is that default values can contain references to previous args of this function. + Problem 2 is that default values shouldn't contain fix-up nodes. + ArrayList actualArgs -- Array of QilNodes annotated with names. When name of formalArg match name actualArg last one is used as invokeArg, otherwise formalArg's default value is cloned and used. **/ diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/OutputScopeManager.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/OutputScopeManager.cs index 213357655e..54e6f4cf2a 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/OutputScopeManager.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/OutputScopeManager.cs @@ -146,7 +146,7 @@ namespace System.Xml.Xsl.Xslt --record // in reverce direction ) { - Debug.Assert(0 < record, "first record is lookup bariaer, so we don't need to check this condition runtime"); + Debug.Assert(0 < record, "first record is lookup barrier, so we don't need to check this condition runtime"); if (_records[record].prefix == prefix) { return _records[record].nsUri; diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XPathPatternBuilder.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XPathPatternBuilder.cs index f940c9ae1a..e72d268b38 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XPathPatternBuilder.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XPathPatternBuilder.cs @@ -42,7 +42,7 @@ namespace System.Xml.Xsl.Xslt public virtual void StartBuild() { - Debug.Assert(!_inTheBuild, "XPathBuilder is buisy!"); + Debug.Assert(!_inTheBuild, "XPathBuilder is busy!"); _inTheBuild = true; return; } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XsltLoader.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XsltLoader.cs.REMOVED.git-id index b1beb98f72..e5b23cae7c 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XsltLoader.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/XsltLoader.cs.REMOVED.git-id @@ -1 +1 @@ -a420975c2140934a09678c0b31d8b91dce2c2e43 \ No newline at end of file +af3f09442b7ddddedfd76e0ffe2c6db580344aeb \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/CompiledAction.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/CompiledAction.cs index 4309dcb65c..e95437de7d 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/CompiledAction.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/CompiledAction.cs @@ -45,7 +45,7 @@ namespace System.Xml.Xsl.XsltOld else { // In ForwardCompatibility mode we ignoreing all unknown or incorrect attributes - // If it's mandatory attribute we'l notice it absents later. + // If it's mandatory attribute we'll notice it absence later. } } } diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/SequentialOutput.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/SequentialOutput.cs index d229b28b36..4f64766fb2 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/SequentialOutput.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/XsltOld/SequentialOutput.cs @@ -163,7 +163,7 @@ namespace System.Xml.Xsl.XsltOld if (mainNode.IsEmptyTag) { - Debug.Assert(!_isHtmlOutput || mainNode.Prefix != null, "Html can't have abreviated elements"); + Debug.Assert(!_isHtmlOutput || mainNode.Prefix != null, "Html can't have abbreviated elements"); Write(s_SlashGreaterThan); } else diff --git a/external/corefx/src/System.Private.Xml/src/System/Xml/Xslt/XslCompiledTransform.cs b/external/corefx/src/System.Private.Xml/src/System/Xml/Xslt/XslCompiledTransform.cs index 6cd161d427..f516f9479e 100644 --- a/external/corefx/src/System.Private.Xml/src/System/Xml/Xslt/XslCompiledTransform.cs +++ b/external/corefx/src/System.Private.Xml/src/System/Xml/Xslt/XslCompiledTransform.cs @@ -46,15 +46,10 @@ namespace System.Xml.Xsl public sealed class XslCompiledTransform { // Reader settings used when creating XmlReader from inputUri - private static readonly XmlReaderSettings s_readerSettings = null; + private static readonly XmlReaderSettings s_readerSettings = new XmlReaderSettings(); // Version for GeneratedCodeAttribute - private readonly string _version = typeof(XslCompiledTransform).Assembly.GetName().Version.ToString(); - - static XslCompiledTransform() - { - s_readerSettings = new XmlReaderSettings(); - } + private static readonly Version s_version = typeof(XslCompiledTransform).Assembly.GetName().Version; // Options of compilation private bool _enableDebug = false; @@ -227,9 +222,9 @@ namespace System.Xml.Xsl // If GeneratedCodeAttribute is not there, it is not a compiled stylesheet class if (generatedCodeAttr != null && generatedCodeAttr.Tool == typeof(XslCompiledTransform).FullName) { - if (new Version(_version).CompareTo(new Version(generatedCodeAttr.Version)) < 0) + if (s_version < Version.Parse(generatedCodeAttr.Version)) { - throw new ArgumentException(SR.Format(SR.Xslt_IncompatibleCompiledStylesheetVersion, generatedCodeAttr.Version, _version), nameof(compiledStylesheet)); + throw new ArgumentException(SR.Format(SR.Xslt_IncompatibleCompiledStylesheetVersion, generatedCodeAttr.Version, s_version), nameof(compiledStylesheet)); } FieldInfo fldData = compiledStylesheet.GetField(XmlQueryStaticData.DataFieldName, BindingFlags.Static | BindingFlags.NonPublic); diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/CharReaderTests.cs b/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/CharReaderTests.cs index 8f6505e90a..71c061ccd3 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/CharReaderTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/CharReaderTests.cs @@ -2,6 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections; +using System.Collections.Generic; +using System.Text; using OLEDB.Test.ModuleCore; using Xunit; @@ -9,352 +12,67 @@ namespace System.Xml.Tests { public partial class CharCheckingReaderTest : CGenericTestModule { - private static void RunTestCaseAsync(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); + testCase.Run(); } - private static void RunTestCase(Func testCaseGenerator) + public static CTestModule Create() { var module = new CharCheckingReaderTest(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "CharCheckingReader" } }); + module.AddChild(new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "CharCheckingReader" } }); + module.AddChild(new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "CharCheckingReader" } }); + module.AddChild(new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "CharCheckingReader" } }); + module.AddChild(new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "CharCheckingReader" } }); + module.AddChild(new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "CharCheckingReader" } }); + module.AddChild(new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "CharCheckingReader" } }); + module.AddChild(new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadOuterXmlReader() { Attribute = new TestCase() { Name = "ReadOuterXml", Desc = "CharCheckingReader" } }); + module.AddChild(new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "CharCheckingReader" } }); + module.AddChild(new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "CharCheckingReader" } }); + module.AddChild(new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "CharCheckingReader" } }); + module.AddChild(new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "CharCheckingReader" } }); + module.AddChild(new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "CharCheckingReader" } }); + module.AddChild(new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "CharCheckingReader" } }); + module.AddChild(new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "CharCheckingReader" } }); + module.AddChild(new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "CharCheckingReader" } }); + module.AddChild(new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "CharCheckingReader" } }); + module.AddChild(new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "CharCheckingReader" } }); + module.AddChild(new TCAttributeXmlDeclarationReader() { Attribute = new TestCase() { Name = "Attributes test on XmlDeclaration", Desc = "CharCheckingReader" } }); + module.AddChild(new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name", Desc = "CharCheckingReader" } }); + module.AddChild(new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "CharCheckingReader" } }); + module.AddChild(new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "CharCheckingReader" } }); + module.AddChild(new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "CharCheckingReader" } }); + module.AddChild(new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "CharCheckingReader" } }); + module.AddChild(new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "CharCheckingReader" } }); + module.AddChild(new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "CharCheckingReader" } }); + module.AddChild(new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "CharCheckingReader" } }); + module.AddChild(new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "CharCheckingReader" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); + module.AddChild(new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "CharCheckingReader" } }); + module.AddChild(new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "CharCheckingReader" } }); - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - RunTestCase(testCaseGenerator); - RunTestCaseAsync(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void ErrorConditionReader() - { - RunTest(() => new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void DepthReader() - { - RunTest(() => new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void NamespaceReader() - { - RunTest(() => new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsEmptyElementReader() - { - RunTest(() => new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlSpaceReader() - { - RunTest(() => new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlLangReader() - { - RunTest(() => new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void SkipReader() - { - RunTest(() => new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void InvalidXMLReader() - { - RunTest(() => new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadOuterXmlReader() - { - RunTest(() => new TCReadOuterXmlReader() { Attribute = new TestCase() { Name = "ReadOuterXml", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeAccessReader() - { - RunTest(() => new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisNameReader() - { - RunTest(() => new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeReader() - { - RunTest(() => new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeOrdinalReader() - { - RunTest(() => new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeNameReader() - { - RunTest(() => new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisOrdinalReader() - { - RunTest(() => new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeOrdinalReader() - { - RunTest(() => new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToFirstAttributeReader() - { - RunTest(() => new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToNextAttributeReader() - { - RunTest(() => new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeTestReader() - { - RunTest(() => new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeXmlDeclarationReader() - { - RunTest(() => new TCAttributeXmlDeclarationReader() { Attribute = new TestCase() { Name = "Attributes test on XmlDeclaration", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsReader() - { - RunTest(() => new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsPrefixReader() - { - RunTest(() => new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadInnerXmlReader() - { - RunTest(() => new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "CharCheckingReader" } }); - } - [Fact] - [OuterLoop] - public static void MoveToContentReader() - { - RunTest(() => new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsStartElementReader() - { - RunTest(() => new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadStartElementReader() - { - RunTest(() => new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadEndElementReader() - { - RunTest(() => new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "CharCheckingReader" } }); - } - [Fact] - [OuterLoop] - public static void ResolveEntityReader() - { - RunTest(() => new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void HasValueReader() - { - RunTest(() => new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadAttributeValueReader() - { - RunTest(() => new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "CharCheckingReader" } }); - } - [Fact] - [OuterLoop] - public static void ReadReader() - { - RunTest(() => new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToElementReader() - { - RunTest(() => new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void DisposeReader() - { - RunTest(() => new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void BufferBoundariesReader() - { - RunTest(() => new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileBeforeRead() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterCloseInMiddle() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterClose() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterReadIsFalse() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); - } - - [Fact] - [OuterLoop] - public static void ReadSubtreeReader() - { - RunTest(() => new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToDescendantReader() - { - RunTest(() => new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToNextSiblingReader() - { - RunTest(() => new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadValueReader() - { - RunTest(() => new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBase64Reader() - { - RunTest(() => new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "CharCheckingReader" } }); - } - [Fact] - [OuterLoop] - public static void ReadElementContentAsBase64Reader() - { - RunTest(() => new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBinHexReader() - { - RunTest(() => new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBinHexReader() - { - RunTest(() => new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToFollowingReader() - { - RunTest(() => new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "CharCheckingReader" } }); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/System.Xml.RW.CharCheckingReader.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/System.Xml.RW.CharCheckingReader.Tests.csproj index a5c4cf3293..035805eaff 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/System.Xml.RW.CharCheckingReader.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/CharCheckingReader/System.Xml.RW.CharCheckingReader.Tests.csproj @@ -13,6 +13,7 @@ + @@ -20,4 +21,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/CReaderTestModule.cs b/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/CReaderTestModule.cs index c07d683d5a..1a1b06aa2a 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/CReaderTestModule.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/CReaderTestModule.cs @@ -9,34 +9,21 @@ namespace System.Xml.Tests { public partial class CReaderTestModule : CGenericTestModule { - private static void RunTestCaseAsync(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); + testCase.Run(); } - private static void RunTestCase(Func testCaseGenerator) + public static CTestModule Create() { var module = new CReaderTestModule(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "CustomInheritedReader" } }); - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - RunTestCase(testCaseGenerator); - RunTestCaseAsync(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void RunTests() - { - RunTest(() => new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "CustomInheritedReader" } }); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/System.Xml.RW.CustomReader.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/System.Xml.RW.CustomReader.Tests.csproj index 1a20f15eb1..77307fafb0 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/System.Xml.RW.CustomReader.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/CustomReader/System.Xml.RW.CustomReader.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/FactoryReaderTests.cs b/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/FactoryReaderTests.cs index 116295fca2..a59a5ee6c3 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/FactoryReaderTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/FactoryReaderTests.cs @@ -9,398 +9,73 @@ namespace System.Xml.Tests { public partial class FactoryReaderTest : CGenericTestModule { - private static void RunTestCaseAsync(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); + testCase.Run(); } - private static void RunTestCase(Func testCaseGenerator) + public static CTestModule Create() { var module = new FactoryReaderTest(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "FactoryReader" } }); + module.AddChild(new TCXMLExceptionReader() { Attribute = new TestCase() { Name = "XMLException", Desc = "FactoryReader" } }); + module.AddChild(new TCLinePosReader() { Attribute = new TestCase() { Name = "LinePos", Desc = "FactoryReader" } }); + module.AddChild(new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "FactoryReader" } }); + module.AddChild(new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "FactoryReader" } }); + module.AddChild(new TCLookupNamespaceReader() { Attribute = new TestCase() { Name = "LookupNamespace", Desc = "FactoryReader" } }); + module.AddChild(new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "FactoryReader" } }); + module.AddChild(new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "FactoryReader" } }); + module.AddChild(new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "FactoryReader" } }); + module.AddChild(new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "FactoryReader" } }); + module.AddChild(new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "FactoryReader" } }); + module.AddChild(new TCBaseURIReader() { Attribute = new TestCase() { Name = "BaseURI", Desc = "FactoryReader" } }); + module.AddChild(new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "FactoryReader" } }); + module.AddChild(new TCReadOuterXmlReader() { Attribute = new TestCase() { Name = "ReadOuterXml", Desc = "FactoryReader" } }); + module.AddChild(new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "FactoryReader" } }); + module.AddChild(new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "FactoryReader" } }); + module.AddChild(new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "FactoryReader" } }); + module.AddChild(new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "FactoryReader" } }); + module.AddChild(new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "FactoryReader" } }); + module.AddChild(new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "FactoryReader" } }); + module.AddChild(new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "FactoryReader" } }); + module.AddChild(new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "FactoryReader" } }); + module.AddChild(new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "FactoryReader" } }); + module.AddChild(new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "FactoryReader" } }); + module.AddChild(new TCAttributeXmlDeclarationReader() { Attribute = new TestCase() { Name = "Attributes test on XmlDeclaration", Desc = "FactoryReader" } }); + module.AddChild(new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name", Desc = "FactoryReader" } }); + module.AddChild(new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix", Desc = "FactoryReader" } }); + module.AddChild(new TCReadStateReader() { Attribute = new TestCase() { Name = "ReadState", Desc = "FactoryReader" } }); + module.AddChild(new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "FactoryReader" } }); + module.AddChild(new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "FactoryReader" } }); + module.AddChild(new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "FactoryReader" } }); + module.AddChild(new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "FactoryReader" } }); + module.AddChild(new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "FactoryReader" } }); + module.AddChild(new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "FactoryReader" } }); + module.AddChild(new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "FactoryReader" } }); + module.AddChild(new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "FactoryReader" } }); + module.AddChild(new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "FactoryReader" } }); + module.AddChild(new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "FactoryReader" } }); + module.AddChild(new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "FactoryReader" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); + module.AddChild(new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "FactoryReader" } }); + module.AddChild(new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "FactoryReader" } }); + module.AddChild(new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "FactoryReader" } }); + module.AddChild(new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "FactoryReader" } }); + module.AddChild(new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "FactoryReader" } }); + module.AddChild(new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "FactoryReader" } }); + module.AddChild(new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "FactoryReader" } }); + module.AddChild(new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "FactoryReader" } }); + module.AddChild(new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "FactoryReader" } }); + module.AddChild(new TCNormalization() { Attribute = new TestCase() { Name = "FactoryReader Normalization", Desc = "FactoryReader" } }); - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - RunTestCase(testCaseGenerator); - RunTestCaseAsync(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void ErrorConditionReader() - { - RunTest(() => new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void XMLExceptionReader() - { - RunTest(() => new TCXMLExceptionReader() { Attribute = new TestCase() { Name = "XMLException", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void LinePosReader() - { - RunTest(() => new TCLinePosReader() { Attribute = new TestCase() { Name = "LinePos", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void DepthReader() - { - RunTest(() => new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void NamespaceReader() - { - RunTest(() => new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void LookupNamespaceReader() - { - RunTest(() => new TCLookupNamespaceReader() { Attribute = new TestCase() { Name = "LookupNamespace", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void HasValueReader() - { - RunTest(() => new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsEmptyElementReader() - { - RunTest(() => new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlSpaceReader() - { - RunTest(() => new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlLangReader() - { - RunTest(() => new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void SkipReader() - { - RunTest(() => new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void BaseURIReader() - { - RunTest(() => new TCBaseURIReader() { Attribute = new TestCase() { Name = "BaseURI", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void InvalidXMLReader() - { - RunTest(() => new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadOuterXmlReader() - { - RunTest(() => new TCReadOuterXmlReader() { Attribute = new TestCase() { Name = "ReadOuterXml", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeAccessReader() - { - RunTest(() => new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisNameReader() - { - RunTest(() => new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeReader() - { - RunTest(() => new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeOrdinalReader() - { - RunTest(() => new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeNameReader() - { - RunTest(() => new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisOrdinalReader() - { - RunTest(() => new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeOrdinalReader() - { - RunTest(() => new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToFirstAttributeReader() - { - RunTest(() => new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToNextAttributeReader() - { - RunTest(() => new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeTestReader() - { - RunTest(() => new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeXmlDeclarationReader() - { - RunTest(() => new TCAttributeXmlDeclarationReader() { Attribute = new TestCase() { Name = "Attributes test on XmlDeclaration", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsReader() - { - RunTest(() => new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsPrefixReader() - { - RunTest(() => new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadStateReader() - { - RunTest(() => new TCReadStateReader() { Attribute = new TestCase() { Name = "ReadState", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadInnerXmlReader() - { - RunTest(() => new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToContentReader() - { - RunTest(() => new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsStartElementReader() - { - RunTest(() => new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadStartElementReader() - { - RunTest(() => new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadEndElementReader() - { - RunTest(() => new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ResolveEntityReader() - { - RunTest(() => new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadAttributeValueReader() - { - RunTest(() => new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadReader() - { - RunTest(() => new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToElementReader() - { - RunTest(() => new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void DisposeReader() - { - RunTest(() => new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void BufferBoundariesReader() - { - RunTest(() => new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileBeforeRead() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterCloseInMiddle() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterClose() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterReadIsFalse() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); - } - - [Fact] - [OuterLoop] - public static void ReadSubtreeReader() - { - RunTest(() => new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToDescendantReader() - { - RunTest(() => new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToNextSiblingReader() - { - RunTest(() => new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadValueReader() - { - RunTest(() => new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBase64Reader() - { - RunTest(() => new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBase64Reader() - { - RunTest(() => new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBinHexReader() - { - RunTest(() => new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBinHexReader() - { - RunTest(() => new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToFollowingReader() - { - RunTest(() => new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "FactoryReader" } }); - } - - [Fact] - [OuterLoop] - public static void Normalization() - { - RunTest(() => new TCNormalization() { Attribute = new TestCase() { Name = "FactoryReader Normalization", Desc = "FactoryReader" } }); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/System.Xml.RW.FactoryReader.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/System.Xml.RW.FactoryReader.Tests.csproj index f13a26481b..6738ad1ee6 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/System.Xml.RW.FactoryReader.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/FactoryReader/System.Xml.RW.FactoryReader.Tests.csproj @@ -14,6 +14,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/CNameTableTestModule.cs b/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/CNameTableTestModule.cs index 0bb31888a7..a5ca1f3745 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/CNameTableTestModule.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/CNameTableTestModule.cs @@ -9,96 +9,35 @@ namespace System.Xml.Tests { public partial class CNameTableTestModule : CTestModule { - private static void RunTestCaseAsync(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); + testCase.Run(); } - private static void RunTestCase(Func testCaseGenerator) + public static CTestModule Create() { var module = new CNameTableTestModule(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCUserNameTable() { Attribute = new TestCase() { Name = "XmlNameTable user scenario inheritance", Desc = "XmlNameTable inheritance" } }); + module.AddChild(new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWGetChar", Desc = "VerifyWGetChar" } }); + module.AddChild(new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWAddChar", Desc = "VerifyWAddChar" } }); + module.AddChild(new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWAddString", Desc = "VerifyWAddString" } }); + module.AddChild(new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWGetString", Desc = "VerifyWGetString" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddChar", Desc = "VerifyWAddChar" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetChar", Desc = "VerifyWGetChar" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddString", Desc = "VerifyWAddString" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetString", Desc = "VerifyWGetString" } }); + module.AddChild(new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWAddString", Desc = "VerifyWAddString" } }); + module.AddChild(new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWGetString", Desc = "VerifyWGetString" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddChar", Desc = "VerifyWAddChar" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetChar", Desc = "VerifyWGetChar" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddString", Desc = "VerifyWAddString" } }); + module.AddChild(new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetString", Desc = "VerifyWGetString" } }); - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - RunTestCase(testCaseGenerator); - RunTestCaseAsync(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void TCUserNameTable() - { - RunTest(() => new TCUserNameTable() { Attribute = new TestCase() { Name = "XmlNameTable user scenario inheritance", Desc = "XmlNameTable inheritance" } }); - } - - [Fact] - [OuterLoop] - public static void NameTableVerifyWGetChar() - { - RunTest(() => new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWGetChar", Desc = "VerifyWGetChar" } }); - } - - [Fact] - [OuterLoop] - public static void NameTableVerifyWAddChar() - { - RunTest(() => new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWAddChar", Desc = "VerifyWAddChar" } }); - RunTest(() => new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWAddString", Desc = "VerifyWAddString" } }); - RunTest(() => new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWGetString", Desc = "VerifyWGetString" } }); - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddChar", Desc = "VerifyWAddChar" } }); - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetChar", Desc = "VerifyWGetChar" } }); - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddString", Desc = "VerifyWAddString" } }); - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetString", Desc = "VerifyWGetString" } }); - } - - [Fact] - [OuterLoop] - public static void NameTableVerifyWAddString() - { - RunTest(() => new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWAddString", Desc = "VerifyWAddString" } }); - } - - [Fact] - [OuterLoop] - public static void NameTableVerifyWGetString() - { - RunTest(() => new TCRecordNameTableGet() { Attribute = new TestCase() { Name = "NameTable(Get) VerifyWGetString", Desc = "VerifyWGetString" } }); - } - - [Fact] - [OuterLoop] - public static void TCRecordNameTableAddVerifyWAddChar() - { - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddChar", Desc = "VerifyWAddChar" } }); - } - - [Fact] - [OuterLoop] - public static void TCRecordNameTableAddVerifyWGetChar() - { - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetChar", Desc = "VerifyWGetChar" } }); - } - - [Fact] - [OuterLoop] - public static void TCRecordNameTableAddVerifyWAddString() - { - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWAddString", Desc = "VerifyWAddString" } }); - } - - [Fact] - [OuterLoop] - public static void TCRecordNameTableAddVerifyWGetString() - { - RunTest(() => new TCRecordNameTableAdd() { Attribute = new TestCase() { Name = "NameTable(Add) VerifyWGetString", Desc = "VerifyWGetString" } }); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/System.Xml.RW.NameTable.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/System.Xml.RW.NameTable.Tests.csproj index d15a5abb4d..e73c76f249 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/System.Xml.RW.NameTable.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/NameTable/System.Xml.RW.NameTable.Tests.csproj @@ -17,6 +17,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/CReaderTestModule.cs b/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/CReaderTestModule.cs index a8712e8905..e88f8a0d9b 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/CReaderTestModule.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/CReaderTestModule.cs @@ -9,198 +9,45 @@ namespace System.Xml.Tests { public partial class CReaderTestModule : CGenericTestModule { - private static void RunTestCase(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) + { + testCase.Run(); + } + + public static CTestModule Create() { var module = new CReaderTestModule(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCConformanceSettings() { Attribute = new TestCase() { Name = "Conformance Settings", Desc = "Conformance Settings" } }); + module.AddChild(new TCCreateOverloads() { Attribute = new TestCase() { Name = "Create Overloads", Desc = "Create Overloads" } }); + module.AddChild(new TCFilterSettings() { Attribute = new TestCase() { Name = "Filter Settings", Desc = "Filter Settings" } }); + module.AddChild(new TCLineInfo() { Attribute = new TestCase() { Name = "LineInfo", Desc = "LineInfo" } }); + module.AddChild(new TCMaxSettings() { Attribute = new TestCase() { Name = "MaxCharacters Settings", Desc = "MaxCharacters Settings" } }); + module.AddChild(new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CharCheckingReader", Param = "CharCheckingReader" } }); + module.AddChild(new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.SubtreeReader", Param = "SubtreeReader" } }); + module.AddChild(new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CoreReader", Param = "CoreReader" } }); + module.AddChild(new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.WrappedReader", Param = "WrappedReader" } }); + module.AddChild(new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.WrappedReader", Param = "WrappedReader" } }); + module.AddChild(new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.CharCheckingReader", Param = "CharCheckingReader" } }); + module.AddChild(new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.CoreReader", Param = "CoreReader" } }); + module.AddChild(new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.SubtreeReader", Param = "SubtreeReader" } }); + module.AddChild(new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CharCheckingReader", Param = "CharCheckingReader" } }); + module.AddChild(new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CoreReader", Param = "CoreReader" } }); + module.AddChild(new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.WrappedReader", Param = "WrappedReader" } }); + module.AddChild(new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.SubtreeReader", Param = "SubtreeReader" } }); + module.AddChild(new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.CharCheckingReader", Param = "CharCheckingReader" } }); + module.AddChild(new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.CoreReader", Param = "CoreReader" } }); + module.AddChild(new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.WrappedReader", Param = "WrappedReader" } }); + module.AddChild(new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.SubtreeReader", Param = "SubtreeReader" } }); + module.AddChild(new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.CharCheckingReader", Param = "CharCheckingReader" } }); + module.AddChild(new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.SubtreeReader", Param = "SubtreeReader" } }); + module.AddChild(new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.CoreReader", Param = "CoreReader" } }); + module.AddChild(new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.WrappedReader", Param = "WrappedReader" } }); - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - CModInfo.CommandLine = ""; - RunTestCase(testCaseGenerator); - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void TCConformanceSettings() - { - RunTest(() => new TCConformanceSettings() { Attribute = new TestCase() { Name = "Conformance Settings", Desc = "Conformance Settings" } }); - } - - [Fact] - [OuterLoop] - public static void TCCreateOverloads() - { - RunTest(() => new TCCreateOverloads() { Attribute = new TestCase() { Name = "Create Overloads", Desc = "Create Overloads" } }); - } - - [Fact] - [OuterLoop] - public static void TCFilterSettings() - { - RunTest(() => new TCFilterSettings() { Attribute = new TestCase() { Name = "Filter Settings", Desc = "Filter Settings" } }); - } - - [Fact] - [OuterLoop] - public static void TCLineInfo() - { - RunTest(() => new TCLineInfo() { Attribute = new TestCase() { Name = "LineInfo", Desc = "LineInfo" } }); - } - - [Fact] - [OuterLoop] - public static void TCMaxSettings() - { - RunTest(() => new TCMaxSettings() { Attribute = new TestCase() { Name = "MaxCharacters Settings", Desc = "MaxCharacters Settings" } }); - } - - [Fact] - [OuterLoop] - public static void TCReaderSettingsGenericTestsCharCheckingReader() - { - RunTest(() => new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CharCheckingReader", Param = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCReaderSettingsGenericTestsSubtreeReader() - { - RunTest(() => new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.SubtreeReader", Param = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCReaderSettingsGenericTestsCoreReader() - { - RunTest(() => new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CoreReader", Param = "CoreReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCReaderSettingsGenericTestsWrappedReader() - { - RunTest(() => new TCReaderSettings() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.WrappedReader", Param = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCCloseInputWrappedReader() - { - RunTest(() => new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.WrappedReader", Param = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCCloseInputCharCheckingReader() - { - RunTest(() => new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.CharCheckingReader", Param = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCCloseInputCoreReader() - { - RunTest(() => new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.CoreReader", Param = "CoreReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCCloseInputSubtreeReader() - { - RunTest(() => new TCCloseInput() { Attribute = new TestCase() { Name = "CloseInput.SubtreeReader", Param = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCRSGenericCharCheckingReader() - { - RunTest(() => new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CharCheckingReader", Param = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCRSGenericCoreReader() - { - RunTest(() => new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.CoreReader", Param = "CoreReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCRSGenericWrappedReader() - { - RunTest(() => new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.WrappedReader", Param = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCRSGenericSubtreeReader() - { - RunTest(() => new TCRSGeneric() { Attribute = new TestCase() { Name = "ReaderSettings Generic Tests.SubtreeReader", Param = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCDtdProcessingCoreReaderCharCheckingReader() - { - RunTest(() => new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.CharCheckingReader", Param = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCDtdProcessingCoreReaderCoreReader() - { - RunTest(() => new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.CoreReader", Param = "CoreReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCDtdProcessingCoreReaderWrappedReader() - { - RunTest(() => new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.WrappedReader", Param = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCDtdProcessingCoreReaderSubtreeReader() - { - RunTest(() => new TCDtdProcessingCoreReader() { Attribute = new TestCase() { Name = "TCDtdProcessingCoreReader.SubtreeReader", Param = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCOneByteStreamCharCheckingReader() - { - RunTest(() => new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.CharCheckingReader", Param = "CharCheckingReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCOneByteStreamSubtreeReader() - { - RunTest(() => new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.SubtreeReader", Param = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCOneByteStreamCoreReader() - { - RunTest(() => new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.CoreReader", Param = "CoreReader" } }); - } - - [Fact] - [OuterLoop] - public static void TCOneByteStreamWrappedReader() - { - RunTest(() => new TCOneByteStream() { Attribute = new TestCase() { Name = "Read xml as one byte stream.WrappedReader", Param = "WrappedReader" } }); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/System.Xml.RW.ReaderSettings.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/System.Xml.RW.ReaderSettings.Tests.csproj index a556378423..9597aebbea 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/System.Xml.RW.ReaderSettings.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/ReaderSettings/System.Xml.RW.ReaderSettings.Tests.csproj @@ -28,6 +28,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/SubtreeReaderTests.cs b/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/SubtreeReaderTests.cs index 41a34cda37..ba3b3f5ab4 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/SubtreeReaderTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/SubtreeReaderTests.cs @@ -9,356 +9,69 @@ namespace System.Xml.Tests { public partial class SubtreeReaderTest : CGenericTestModule { - private static void RunTestCaseAsync(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); + testCase.Run(); } - private static void RunTestCase(Func testCaseGenerator) + public static CTestModule Create() { var module = new SubtreeReaderTest(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "SubtreeReader" } }); + module.AddChild(new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "SubtreeReader" } }); + module.AddChild(new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "SubtreeReader" } }); + module.AddChild(new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "SubtreeReader" } }); + module.AddChild(new TCLookupNamespaceReader() { Attribute = new TestCase() { Name = "LookupNamespace", Desc = "SubtreeReader" } }); + module.AddChild(new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "SubtreeReader" } }); + module.AddChild(new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "SubtreeReader" } }); + module.AddChild(new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "SubtreeReader" } }); + module.AddChild(new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadOuterXmlReader() { Attribute = new TestCase() { Name = "ReadOuterXml", Desc = "SubtreeReader" } }); + module.AddChild(new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "SubtreeReader" } }); + module.AddChild(new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "SubtreeReader" } }); + module.AddChild(new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "SubtreeReader" } }); + module.AddChild(new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "SubtreeReader" } }); + module.AddChild(new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "SubtreeReader" } }); + module.AddChild(new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "SubtreeReader" } }); + module.AddChild(new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "SubtreeReader" } }); + module.AddChild(new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "SubtreeReader" } }); + module.AddChild(new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "SubtreeReader" } }); + module.AddChild(new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "SubtreeReader" } }); + module.AddChild(new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name DCR50345", Desc = "SubtreeReader" } }); + module.AddChild(new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix DCR50881", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "SubtreeReader" } }); + module.AddChild(new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "SubtreeReader" } }); + module.AddChild(new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "SubtreeReader" } }); + module.AddChild(new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "SubtreeReader" } }); + module.AddChild(new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "SubtreeReader" } }); + module.AddChild(new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "SubtreeReader" } }); + module.AddChild(new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "SubtreeReader" } }); + module.AddChild(new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "SubtreeReader" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); + module.AddChild(new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "SubtreeReader" } }); + module.AddChild(new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "SubtreeReader" } }); - Assert.Equal(0, module.FailCount); + return module; } - private static void RunTest(Func testCaseGenerator) - { - RunTestCase(testCaseGenerator); - RunTestCaseAsync(testCaseGenerator); - } - [Fact] - [OuterLoop] - public static void InvalidXMLReader() - { - RunTest(() => new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ErrorConditionReader() - { - RunTest(() => new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void DepthReader() - { - RunTest(() => new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void NamespaceReader() - { - RunTest(() => new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void LookupNamespaceReader() - { - RunTest(() => new TCLookupNamespaceReader() { Attribute = new TestCase() { Name = "LookupNamespace", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsEmptyElementReader() - { - RunTest(() => new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlSpaceReader() - { - RunTest(() => new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlLangReader() - { - RunTest(() => new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void SkipReader() - { - RunTest(() => new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadOuterXmlReader() - { - RunTest(() => new TCReadOuterXmlReader() { Attribute = new TestCase() { Name = "ReadOuterXml", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeAccessReader() - { - RunTest(() => new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisNameReader() - { - RunTest(() => new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeReader() - { - RunTest(() => new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeOrdinalReader() - { - RunTest(() => new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeNameReader() - { - RunTest(() => new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisOrdinalReader() - { - RunTest(() => new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeOrdinalReader() - { - RunTest(() => new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToFirstAttributeReader() - { - RunTest(() => new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToNextAttributeReader() - { - RunTest(() => new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeTestReader() - { - RunTest(() => new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsReader() - { - RunTest(() => new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name DCR50345", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsPrefixReader() - { - RunTest(() => new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix DCR50881", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadInnerXmlReader() - { - RunTest(() => new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToContentReader() - { - RunTest(() => new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsStartElementReader() - { - RunTest(() => new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadStartElementReader() - { - RunTest(() => new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadEndElementReader() - { - RunTest(() => new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ResolveEntityReader() - { - RunTest(() => new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void HasValueReader() - { - RunTest(() => new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadAttributeValueReader() - { - RunTest(() => new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadReader() - { - RunTest(() => new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToElementReader() - { - RunTest(() => new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void DisposeReader() - { - RunTest(() => new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void BufferBoundariesReader() - { - RunTest(() => new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileBeforeRead() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterCloseInMiddle() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterClose() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterReadIsFalse() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); - } - - [Fact] - [OuterLoop] - public static void ReadSubtreeReader() - { - RunTest(() => new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToDescendantReader() - { - RunTest(() => new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToNextSiblingReader() - { - RunTest(() => new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadValueReader() - { - RunTest(() => new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBase64Reader() - { - RunTest(() => new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBase64Reader() - { - RunTest(() => new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBinHexReader() - { - RunTest(() => new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBinHexReader() - { - RunTest(() => new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "SubtreeReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToFollowingReader() - { - RunTest(() => new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "SubtreeReader" } }); - } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/System.Xml.RW.SubtreeReader.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/System.Xml.RW.SubtreeReader.Tests.csproj index 539f05e296..93aba863f0 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/System.Xml.RW.SubtreeReader.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/SubtreeReader/System.Xml.RW.SubtreeReader.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/System.Xml.RW.WrappedReader.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/System.Xml.RW.WrappedReader.Tests.csproj index 1436b99538..589a3111b5 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/System.Xml.RW.WrappedReader.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/System.Xml.RW.WrappedReader.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/WrappedReaderTests.cs b/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/WrappedReaderTests.cs index 7912339391..e8bd8f2e8d 100644 --- a/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/WrappedReaderTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/Readers/WrappedReader/WrappedReaderTests.cs @@ -9,370 +9,69 @@ namespace System.Xml.Tests { public partial class WrappedReaderTest : CGenericTestModule { - private static void RunTestCaseAsync(Func testCaseGenerator) + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = "/async"; - RunTestCase(testCaseGenerator); + testCase.Run(); } - private static void RunTestCase(Func testCaseGenerator) + public static CTestModule Create() { var module = new WrappedReaderTest(); module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); + module.AddChild(new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "WrappedReader" } }); + module.AddChild(new TCXMLExceptionReader() { Attribute = new TestCase() { Name = "XMLException", Desc = "WrappedReader" } }); + module.AddChild(new TCLinePosReader() { Attribute = new TestCase() { Name = "LinePos", Desc = "WrappedReader" } }); + module.AddChild(new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "WrappedReader" } }); + module.AddChild(new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "WrappedReader" } }); + module.AddChild(new TCLookupNamespaceReader() { Attribute = new TestCase() { Name = "LookupNamespace", Desc = "WrappedReader" } }); + module.AddChild(new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "WrappedReader" } }); + module.AddChild(new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "WrappedReader" } }); + module.AddChild(new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "WrappedReader" } }); + module.AddChild(new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "WrappedReader" } }); + module.AddChild(new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "WrappedReader" } }); + module.AddChild(new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "WrappedReader" } }); + module.AddChild(new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "WrappedReader" } }); + module.AddChild(new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "WrappedReader" } }); + module.AddChild(new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "WrappedReader" } }); + module.AddChild(new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "WrappedReader" } }); + module.AddChild(new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "WrappedReader" } }); + module.AddChild(new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "WrappedReader" } }); + module.AddChild(new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "WrappedReader" } }); + module.AddChild(new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "WrappedReader" } }); + module.AddChild(new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "WrappedReader" } }); + module.AddChild(new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "WrappedReader" } }); + module.AddChild(new TCAttributeXmlDeclarationReader() { Attribute = new TestCase() { Name = "Attributes test on XmlDeclaration DCR52258", Desc = "WrappedReader" } }); + module.AddChild(new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name DCR50345", Desc = "WrappedReader" } }); + module.AddChild(new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix DCR50881", Desc = "WrappedReader" } }); + module.AddChild(new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "WrappedReader" } }); + module.AddChild(new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "WrappedReader" } }); + module.AddChild(new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "WrappedReader" } }); + module.AddChild(new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "WrappedReader" } }); + module.AddChild(new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "WrappedReader" } }); + module.AddChild(new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "WrappedReader" } }); + module.AddChild(new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "WrappedReader" } }); + module.AddChild(new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "WrappedReader" } }); + module.AddChild(new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "WrappedReader" } }); + module.AddChild(new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "WrappedReader" } }); + module.AddChild(new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "WrappedReader" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); + module.AddChild(new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); + module.AddChild(new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "WrappedReader" } }); + module.AddChild(new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "WrappedReader" } }); + module.AddChild(new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "WrappedReader" } }); + module.AddChild(new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "WrappedReader" } }); + module.AddChild(new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "WrappedReader" } }); + module.AddChild(new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "WrappedReader" } }); + module.AddChild(new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "WrappedReader" } }); + module.AddChild(new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "WrappedReader" } }); + module.AddChild(new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "WrappedReader" } }); - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - RunTestCase(testCaseGenerator); - RunTestCaseAsync(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void ErrorConditionReader() - { - RunTest(() => new TCErrorConditionReader() { Attribute = new TestCase() { Name = "ErrorCondition", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void XMLExceptionReader() - { - RunTest(() => new TCXMLExceptionReader() { Attribute = new TestCase() { Name = "XMLException", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void LinePosReader() - { - RunTest(() => new TCLinePosReader() { Attribute = new TestCase() { Name = "LinePos", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void DepthReader() - { - RunTest(() => new TCDepthReader() { Attribute = new TestCase() { Name = "Depth", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void NamespaceReader() - { - RunTest(() => new TCNamespaceReader() { Attribute = new TestCase() { Name = "Namespace", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void LookupNamespaceReader() - { - RunTest(() => new TCLookupNamespaceReader() { Attribute = new TestCase() { Name = "LookupNamespace", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void HasValueReader() - { - RunTest(() => new TCHasValueReader() { Attribute = new TestCase() { Name = "HasValue", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsEmptyElementReader() - { - RunTest(() => new TCIsEmptyElementReader() { Attribute = new TestCase() { Name = "IsEmptyElement", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlSpaceReader() - { - RunTest(() => new TCXmlSpaceReader() { Attribute = new TestCase() { Name = "XmlSpace", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlLangReader() - { - RunTest(() => new TCXmlLangReader() { Attribute = new TestCase() { Name = "XmlLang", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void SkipReader() - { - RunTest(() => new TCSkipReader() { Attribute = new TestCase() { Name = "Skip", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void InvalidXMLReader() - { - RunTest(() => new TCInvalidXMLReader() { Attribute = new TestCase() { Name = "InvalidXML", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeAccessReader() - { - RunTest(() => new TCAttributeAccessReader() { Attribute = new TestCase() { Name = "AttributeAccess", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisNameReader() - { - RunTest(() => new TCThisNameReader() { Attribute = new TestCase() { Name = "This(Name) and This(Name, Namespace)", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeReader() - { - RunTest(() => new TCMoveToAttributeReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Name) and MoveToAttribute(Name, Namespace)", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeOrdinalReader() - { - RunTest(() => new TCGetAttributeOrdinalReader() { Attribute = new TestCase() { Name = "GetAttribute (Ordinal)", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void GetAttributeNameReader() - { - RunTest(() => new TCGetAttributeNameReader() { Attribute = new TestCase() { Name = "GetAttribute(Name) and GetAttribute(Name, Namespace)", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ThisOrdinalReader() - { - RunTest(() => new TCThisOrdinalReader() { Attribute = new TestCase() { Name = "This [Ordinal]", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToAttributeOrdinalReader() - { - RunTest(() => new TCMoveToAttributeOrdinalReader() { Attribute = new TestCase() { Name = "MoveToAttribute(Ordinal)", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToFirstAttributeReader() - { - RunTest(() => new TCMoveToFirstAttributeReader() { Attribute = new TestCase() { Name = "MoveToFirstAttribute()", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToNextAttributeReader() - { - RunTest(() => new TCMoveToNextAttributeReader() { Attribute = new TestCase() { Name = "MoveToNextAttribute()", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeTestReader() - { - RunTest(() => new TCAttributeTestReader() { Attribute = new TestCase() { Name = "Attribute Test when NodeType != Attributes", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void AttributeXmlDeclarationReader() - { - RunTest(() => new TCAttributeXmlDeclarationReader() { Attribute = new TestCase() { Name = "Attributes test on XmlDeclaration DCR52258", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsReader() - { - RunTest(() => new TCXmlnsReader() { Attribute = new TestCase() { Name = "xmlns as local name DCR50345", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlnsPrefixReader() - { - RunTest(() => new TCXmlnsPrefixReader() { Attribute = new TestCase() { Name = "bounded namespace to xmlns prefix DCR50881", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadInnerXmlReader() - { - RunTest(() => new TCReadInnerXmlReader() { Attribute = new TestCase() { Name = "ReadInnerXml", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToContentReader() - { - RunTest(() => new TCMoveToContentReader() { Attribute = new TestCase() { Name = "MoveToContent", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void IsStartElementReader() - { - RunTest(() => new TCIsStartElementReader() { Attribute = new TestCase() { Name = "IsStartElement", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadStartElementReader() - { - RunTest(() => new TCReadStartElementReader() { Attribute = new TestCase() { Name = "ReadStartElement", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadEndElementReader() - { - RunTest(() => new TCReadEndElementReader() { Attribute = new TestCase() { Name = "ReadEndElement", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ResolveEntityReader() - { - RunTest(() => new TCResolveEntityReader() { Attribute = new TestCase() { Name = "ResolveEntity and ReadAttributeValue", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadAttributeValueReader() - { - RunTest(() => new TCReadAttributeValueReader() { Attribute = new TestCase() { Name = "ReadAttributeValue", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadReader() - { - RunTest(() => new TCReadReader() { Attribute = new TestCase() { Name = "Read", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void MoveToElementReader() - { - RunTest(() => new TCMoveToElementReader() { Attribute = new TestCase() { Name = "MoveToElement", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void DisposeReader() - { - RunTest(() => new TCDisposeReader() { Attribute = new TestCase() { Name = "Dispose", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void BufferBoundariesReader() - { - RunTest(() => new TCBufferBoundariesReader() { Attribute = new TestCase() { Name = "Buffer Boundaries", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterClose() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterClose", Desc = "AfterClose" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterCloseInMiddle() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterCloseInTheMiddle", Desc = "AfterCloseInTheMiddle" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileBeforeRead() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "BeforeRead", Desc = "BeforeRead" } }); - } - - [Fact] - [OuterLoop] - public static void XmlNodeIntegrityTestFileAfterReadIsFalse() - { - RunTest(() => new TCXmlNodeIntegrityTestFile() { Attribute = new TestCase() { Name = "AfterReadIsFalse", Desc = "AfterReadIsFalse" } }); - } - - [Fact] - [OuterLoop] - public static void ReadSubtreeReader() - { - RunTest(() => new TCReadSubtreeReader() { Attribute = new TestCase() { Name = "Read Subtree", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToDescendantReader() - { - RunTest(() => new TCReadToDescendantReader() { Attribute = new TestCase() { Name = "ReadToDescendant", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToNextSiblingReader() - { - RunTest(() => new TCReadToNextSiblingReader() { Attribute = new TestCase() { Name = "ReadToNextSibling", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadValueReader() - { - RunTest(() => new TCReadValueReader() { Attribute = new TestCase() { Name = "ReadValue", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBase64Reader() - { - RunTest(() => new TCReadContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadContentAsBase64", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBase64Reader() - { - RunTest(() => new TCReadElementContentAsBase64Reader() { Attribute = new TestCase() { Name = "ReadElementContentAsBase64", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadContentAsBinHexReader() - { - RunTest(() => new TCReadContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadContentAsBinHex", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadElementContentAsBinHexReader() - { - RunTest(() => new TCReadElementContentAsBinHexReader() { Attribute = new TestCase() { Name = "ReadElementContentAsBinHex", Desc = "WrappedReader" } }); - } - - [Fact] - [OuterLoop] - public static void ReadToFollowingReader() - { - RunTest(() => new TCReadToFollowingReader() { Attribute = new TestCase() { Name = "ReadToFollowing", Desc = "WrappedReader" } }); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/CFactoryModule.cs b/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/CFactoryModule.cs index bca2f5dd09..33e5b0fe09 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/CFactoryModule.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/CFactoryModule.cs @@ -9,26 +9,20 @@ namespace System.Xml.Tests { public partial class CFactoryModule : CXmlDriverModule { - [Fact] - [OuterLoop] - public static void RunTests() + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - CModInfo.CommandLine = ""; - var module = new CFactoryModule(); - - module.Init(null); - module.Execute(); + testCase.Run(); } - [Fact] - [OuterLoop] - public static void RunTestsAsync() + public static CTestModule Create() { - CModInfo.CommandLine = "/async"; var module = new CFactoryModule(); module.Init(null); - module.Execute(); + + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/System.Xml.RW.RwFactory.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/System.Xml.RW.RwFactory.Tests.csproj index b02e4eb875..ebfbf9a48b 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/System.Xml.RW.RwFactory.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Writers/RwFactory/System.Xml.RW.RwFactory.Tests.csproj @@ -21,6 +21,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/CommonTests.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/CommonTests.cs.REMOVED.git-id deleted file mode 100644 index 0516842496..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/CommonTests.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b66452f2afd4d5aeb8452aac5901018256d1df53 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/DisableParallelization.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/DisableParallelization.cs new file mode 100644 index 0000000000..5814b2aced --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/DisableParallelization.cs @@ -0,0 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Tests are old and depend on the static state +[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)] diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/EndOfLineHandlingTests.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/EndOfLineHandlingTests.cs index 482cb426ee..1946a5f307 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/EndOfLineHandlingTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/EndOfLineHandlingTests.cs @@ -6,27 +6,16 @@ using OLEDB.Test.ModuleCore; using System.IO; using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - //[TestCase(Name="XmlWriterSettings: NewLineHandling")] - public partial class TCEOFHandling : XmlFactoryWriterTestCaseBase + public partial class TCEOFHandling { - public override int Init(object o) - { - if (WriterType == WriterType.UnicodeWriter || WriterType == WriterType.UTF8Writer || WriterType == WriterType.WrappedWriter - || WriterType == WriterType.CharCheckingWriter || WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent) - { - int i = base.Init(0); - return i; - } - return TEST_SKIPPED; - } - private static NewLineHandling[] s_nlHandlingMembers = { NewLineHandling.Entitize, NewLineHandling.Replace, NewLineHandling.None }; private StringWriter _strWriter = null; - private XmlWriter CreateMemWriter(XmlWriterSettings settings) + private XmlWriter CreateMemWriter(XmlWriterUtils utils, XmlWriterSettings settings) { XmlWriterSettings wSettings = settings.Clone(); wSettings.CloseOutput = false; @@ -34,47 +23,47 @@ namespace System.Xml.Tests wSettings.CheckCharacters = false; XmlWriter w = null; - switch (WriterType) + switch (utils.WriterType) { case WriterType.UTF8Writer: wSettings.Encoding = Encoding.UTF8; if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - w = WriterHelper.Create(_strWriter, wSettings); + w = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.UnicodeWriter: wSettings.Encoding = Encoding.Unicode; if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - w = WriterHelper.Create(_strWriter, wSettings); + w = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.WrappedWriter: if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - XmlWriter ww = WriterHelper.Create(_strWriter, wSettings); - w = WriterHelper.Create(ww, wSettings); + XmlWriter ww = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); + w = WriterHelper.Create(ww, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.CharCheckingWriter: if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - XmlWriter cw = WriterHelper.Create(_strWriter, wSettings); + XmlWriter cw = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); XmlWriterSettings cws = settings.Clone(); cws.CheckCharacters = true; - w = WriterHelper.Create(cw, cws); + w = WriterHelper.Create(cw, cws, overrideAsync: true, async: utils.Async); break; case WriterType.UTF8WriterIndent: wSettings.Encoding = Encoding.UTF8; wSettings.Indent = true; if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - w = WriterHelper.Create(_strWriter, wSettings); + w = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.UnicodeWriterIndent: wSettings.Encoding = Encoding.Unicode; wSettings.Indent = true; if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - w = WriterHelper.Create(_strWriter, wSettings); + w = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); break; default: throw new Exception("Unknown writer type"); @@ -100,7 +89,7 @@ namespace System.Xml.Tests { output = output.Replace("\r\n", "\n"); output = output.Replace("\r", "\n"); - output = output.Replace("\n", nl); + output = output.Replace("\n", Environment.NewLine); } else { @@ -130,67 +119,69 @@ namespace System.Xml.Tests /*================== Constructors ==================*/ - //[Variation(Desc = "NewLineHandling Default value - NewLineHandling.Replace", id = 1, Pri = 0)] - public int EOF_Handling_01() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom)] + public void EOF_Handling_01(XmlWriterUtils utils) { XmlWriterSettings wSettings = new XmlWriterSettings(); CError.Compare(wSettings.NewLineHandling, NewLineHandling.Replace, "Incorrect default value for XmlWriterSettings.NewLineHandling"); - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); w.Dispose(); CError.Compare(w.Settings.NewLineHandling, NewLineHandling.Replace, "Incorrect default value for XmlWriter.Settings.NewLineHandling"); - - return TEST_PASS; } - //[Variation(Desc = "XmlWriter creation with NewLineHandling.Entitize", Param = NewLineHandling.Entitize, id = 2, Pri = 0)] - //[Variation(Desc = "XmlWriter creation with NewLineHandling.Replace", Param = NewLineHandling.Replace, id = 3, Pri = 0)] - //[Variation(Desc = "XmlWriter creation with NewLineHandling.None", Param = NewLineHandling.None, id = 4, Pri = 0)] - public int EOF_Handling_02() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_02(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; - XmlWriter w = CreateMemWriter(wSettings); + wSettings.NewLineHandling = nlHandling; + XmlWriter w = CreateMemWriter(utils, wSettings); CError.Compare(w != null, "XmlWriter creation failed"); - CError.Compare(w.Settings.NewLineHandling, (NewLineHandling)CurVariation.Param, "Invalid NewLineHandling assignment"); + CError.Compare(w.Settings.NewLineHandling, nlHandling, "Invalid NewLineHandling assignment"); w.Dispose(); - return TEST_PASS; + return; } /*================== Verification in Text Nodes ==================*/ - //[Variation(Desc = "Check for combinations of NewLine characters in element with 'Entitize'", Param = NewLineHandling.Entitize, id = 5, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters in element with 'Replace'", Param = NewLineHandling.Replace, id = 6, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters in element with 'None'", Param = NewLineHandling.None, id = 7, Pri = 0)] - public int EOF_Handling_03() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_03(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLineCombinations = "\r \n \r\n \n\r \r\r \n\n \r\n\r \n\r\n"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteElementString("root", NewLineCombinations); w.Dispose(); - VerifyOutput("" + ExpectedOutput(NewLineCombinations, (NewLineHandling)CurVariation.Param, false) + ""); + VerifyOutput("" + ExpectedOutput(NewLineCombinations, nlHandling, false) + ""); - return TEST_PASS; + return; } - //[Variation(Desc = "Check for combinations of entities in element with 'Entitize'", Param = NewLineHandling.Entitize, id = 8, Pri = 0)] - //[Variation(Desc = "Check for combinations of entities in element with 'Replace'", Param = NewLineHandling.Replace, id = 9, Pri = 0)] - //[Variation(Desc = "Check for combinations of entities in element with 'None'", Param = NewLineHandling.None, id = 10, Pri = 0)] - public int EOF_Handling_04() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_04(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLineCombinations = "\r \n \r\n \n\r \r\r \n\n \r\n\r \n\r\n"; string NewLineEntities = " "; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); for (int i = 0; i < NewLineCombinations.Length; i++) @@ -201,22 +192,23 @@ namespace System.Xml.Tests w.WriteEndElement(); w.Dispose(); - VerifyOutput("" + ExpectedOutput(NewLineEntities, (NewLineHandling)CurVariation.Param, false) + ""); + VerifyOutput("" + ExpectedOutput(NewLineEntities, nlHandling, false) + ""); - return TEST_PASS; + return; } - //[Variation(Desc = "Check for combinations of NewLine characters and entities in element with 'Entitize'", Param = NewLineHandling.Entitize, id = 11, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters and entities in element with 'Replace'", Param = NewLineHandling.Replace, id = 12, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters and entities in element with 'None'", Param = NewLineHandling.None, id = 13, Pri = 0)] - public int EOF_Handling_05() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_05(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLines = "\r \n \r \n \n \r"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); // '\r ' @@ -247,23 +239,23 @@ namespace System.Xml.Tests w.WriteEndElement(); w.Dispose(); - VerifyOutput("" + ExpectedOutput(NewLines, (NewLineHandling)CurVariation.Param, false) + ""); + VerifyOutput("" + ExpectedOutput(NewLines, nlHandling, false) + ""); - return TEST_PASS; + return; } - - //[Variation(Desc = "Check for tab character in element with 'Entitize'", Param = NewLineHandling.Entitize, id = 14, Pri = 0)] - //[Variation(Desc = "Check for tab character in element with 'Replace'", Param = NewLineHandling.Replace, id = 15, Pri = 0)] - //[Variation(Desc = "Check for tab character in element with 'None'", Param = NewLineHandling.None, id = 16, Pri = 0)] - public int EOF_Handling_06() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_06(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string Tabs = "foo\tbar foo\n\tbar\t\n\t"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteString("foo\tbar"); @@ -272,46 +264,48 @@ namespace System.Xml.Tests w.WriteEndElement(); w.Dispose(); - VerifyOutput("" + ExpectedOutput(Tabs, (NewLineHandling)CurVariation.Param, false) + ""); + VerifyOutput("" + ExpectedOutput(Tabs, nlHandling, false) + ""); - return TEST_PASS; + return; } /*================== Verification in Attributes ==================*/ - //[Variation(Desc = "Check for combinations of NewLine characters in attribute with 'Entitize'", Param = NewLineHandling.Entitize, id = 17, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters in attribute with 'Replace'", Param = NewLineHandling.Replace, id = 18, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters in attribute with 'None'", Param = NewLineHandling.None, id = 19, Pri = 0)] - public int EOF_Handling_07() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_07(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLineCombinations = "\r \n \r\n \n\r \r\r \n\n \r\n\r \n\r\n"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteAttributeString("foo", NewLineCombinations); w.WriteEndElement(); w.Dispose(); - VerifyOutput(""); + VerifyOutput(""); - return TEST_PASS; + return; } - //[Variation(Desc = "Check for combinations of entities in attribute with 'Entitize'", Param = NewLineHandling.Entitize, id = 20, Pri = 0)] - //[Variation(Desc = "Check for combinations of entities in attribute with 'Replace'", Param = NewLineHandling.Replace, id = 21, Pri = 0)] - //[Variation(Desc = "Check for combinations of entities in attribute with 'None'", Param = NewLineHandling.None, id = 22, Pri = 0)] - public int EOF_Handling_08() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_08(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLineCombinations = "\r \n \r\n \n\r \r\r \n\n \r\n\r \n\r\n"; string NewLineEntities = " "; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteStartAttribute("foo"); @@ -324,22 +318,23 @@ namespace System.Xml.Tests w.WriteEndAttribute(); w.WriteEndElement(); w.Dispose(); - VerifyOutput(""); + VerifyOutput(""); - return TEST_PASS; + return; } - //[Variation(Desc = "Check for combinations of NewLine characters and entities in element with 'Entitize'", Param = NewLineHandling.Entitize, id = 23, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters and entities in element with 'Replace'", Param = NewLineHandling.Replace, id = 24, Pri = 0)] - //[Variation(Desc = "Check for combinations of NewLine characters and entities in element with 'None'", Param = NewLineHandling.None, id = 25, Pri = 0)] - public int EOF_Handling_09() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_09(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLines = "\r \n \r \n \n \r"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteStartAttribute("foo"); @@ -372,22 +367,23 @@ namespace System.Xml.Tests w.WriteEndAttribute(); w.WriteEndElement(); w.Dispose(); - VerifyOutput(""); + VerifyOutput(""); - return TEST_PASS; + return; } - //[Variation(Desc = "Check for tab character in attribute with 'Entitize'", Param = NewLineHandling.Entitize, id = 26, Pri = 0)] - //[Variation(Desc = "Check for tab character in attribute with 'Replace'", Param = NewLineHandling.Replace, id = 27, Pri = 0)] - //[Variation(Desc = "Check for tab character in attribute with 'None'", Param = NewLineHandling.None, id = 28, Pri = 0)] - public int EOF_Handling_10() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_10(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); string Tabs = "foo\tbar foo\n\tbar\t\n\t"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteStartAttribute("foo"); @@ -398,26 +394,27 @@ namespace System.Xml.Tests w.WriteEndAttribute(); w.WriteEndElement(); w.Dispose(); - VerifyOutput(""); + VerifyOutput(""); - return TEST_PASS; + return; } /*================== NewLineChars, IndentChars ==================*/ - //[Variation(Desc = "NewLineChars and IndentChars Default values and test for proper indentation, Entitize", Param = NewLineHandling.Entitize, id = 29, Pri = 1)] - //[Variation(Desc = "NewLineChars and IndentChars Default values and test for proper indentation, Replace", Param = NewLineHandling.Replace, id = 30, Pri = 1)] - //[Variation(Desc = "NewLineChars and IndentChars Default values and test for proper indentation, None", Param = NewLineHandling.None, id = 31, Pri = 1)] - public int EOF_Handling_11() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_11(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - XmlWriter w = CreateMemWriter(wSettings); - CError.Compare(w.Settings.NewLineChars, nl, "Incorrect default value for XmlWriter.Settings.NewLineChars"); + XmlWriter w = CreateMemWriter(utils, wSettings); + CError.Compare(w.Settings.NewLineChars, Environment.NewLine, "Incorrect default value for XmlWriter.Settings.NewLineChars"); CError.Compare(w.Settings.IndentChars, " ", "Incorrect default value for XmlWriter.Settings.IndentChars"); w.WriteStartElement("root"); @@ -427,31 +424,30 @@ namespace System.Xml.Tests w.WriteEndElement(); w.Dispose(); - VerifyOutput(string.Format("{0} {0} {0} {0}", nl)); - - return TEST_PASS; + VerifyOutput(string.Format("{0} {0} {0} {0}", Environment.NewLine)); } - //[Variation(Desc = "1.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\\r', ' '", Params = new object[] { NewLineHandling.Entitize, "\r", " " }, id = 32, Pri = 2)] - //[Variation(Desc = "2.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\\r', ' '", Params = new object[] { NewLineHandling.Replace, "\r", " " }, id = 33, Pri = 2)] - //[Variation(Desc = "3.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\\r', ' '", Params = new object[] { NewLineHandling.None, "\r", " " }, id = 34, Pri = 2)] - //[Variation(Desc = "4.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, ' ', ' '", Params = new object[] { NewLineHandling.Entitize, " ", " " }, id = 35, Pri = 2)] - //[Variation(Desc = "5.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, ' ', ' '", Params = new object[] { NewLineHandling.Replace, " ", " " }, id = 36, Pri = 2)] - //[Variation(Desc = "6.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, ' ', ' '", Params = new object[] { NewLineHandling.None, " ", " " }, id = 37, Pri = 2)] - //[Variation(Desc = "7.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\\r', '\\n'", Params = new object[] { NewLineHandling.Entitize, "\r", "\n" }, id = 38, Pri = 2)] - //[Variation(Desc = "8.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\\r', '\\n'", Params = new object[] { NewLineHandling.Replace, "\r", "\n" }, id = 39, Pri = 2)] - //[Variation(Desc = "9.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\\r', '\\n'", Params = new object[] { NewLineHandling.None, "\r", "\n" }, id = 40, Pri = 2)] - public int EOF_Handling_13() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r", " " )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r", " " )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r", " " )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, " ", " " )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, " ", " " )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, " ", " " )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r", "\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r", "\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r", "\n" )] + public void EOF_Handling_13(XmlWriterUtils utils, NewLineHandling nlHandling, string newLineChars, string indentChars) { XmlWriterSettings wSettings = new XmlWriterSettings(); string PrototypeOutput = "&NewLine&Indent&NewLine&Indent&Indent&NewLine&Indent&NewLine"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - wSettings.NewLineChars = CurVariation.Params[1].ToString(); - wSettings.IndentChars = CurVariation.Params[2].ToString(); + wSettings.NewLineChars = newLineChars; + wSettings.IndentChars = indentChars; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteStartElement("foo"); w.WriteElementString("bar", ""); @@ -459,117 +455,112 @@ namespace System.Xml.Tests w.WriteEndElement(); w.Dispose(); - VerifyOutput(PrototypeOutput.Replace("&NewLine", CurVariation.Params[1].ToString()).Replace("&Indent", CurVariation.Params[2].ToString())); + VerifyOutput(PrototypeOutput.Replace("&NewLine", newLineChars).Replace("&Indent", indentChars)); - return TEST_PASS; + return; } - //[Variation(Desc = "NewLine handling in text node when Indent=true; Entitize, '\\r\\n'", Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 41, Pri = 1)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; Replace, '\\r\\n'", Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 42, Pri = 1)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; None, '\\r\\n'", Params = new object[] { NewLineHandling.None, "\r\n" }, id = 43, Pri = 1)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; Entitize, '\\r'", Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 44, Pri = 2)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; Replace, '\\r'", Params = new object[] { NewLineHandling.Replace, "\r" }, id = 45, Pri = 2)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; None, '\\r'", Params = new object[] { NewLineHandling.None, "\r" }, id = 46, Pri = 2)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; Entitize, '---'", Params = new object[] { NewLineHandling.Entitize, "---" }, id = 47, Pri = 2)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; Replace, '---'", Params = new object[] { NewLineHandling.Replace, "---" }, id = 48, Pri = 2)] - //[Variation(Desc = "NewLine handling in text node when Indent=true; None, '---'", Params = new object[] { NewLineHandling.None, "---" }, id = 49, Pri = 2)] - public int EOF_Handling_14() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "---" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "---" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "---" )] + public void EOF_Handling_14(XmlWriterUtils utils, NewLineHandling nlHandling, string newLineChars) { XmlWriterSettings wSettings = new XmlWriterSettings(); string PrototypeOutput = "foo&NewLinefoo&NewLinefoo&NewLinefoo\tfoo"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - wSettings.NewLineChars = CurVariation.Params[1].ToString(); + wSettings.NewLineChars = newLineChars; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteElementString("root", "foo\r\nfoo\nfoo\rfoo\tfoo"); w.Dispose(); - if ((NewLineHandling)CurVariation.Params[0] == NewLineHandling.Replace) - VerifyOutput(PrototypeOutput.Replace("&NewLine", CurVariation.Params[1].ToString())); + if (nlHandling == NewLineHandling.Replace) + VerifyOutput(PrototypeOutput.Replace("&NewLine", newLineChars)); else - VerifyOutput("" + ExpectedOutput("foo\r\nfoo\nfoo\rfoo\tfoo", (NewLineHandling)CurVariation.Params[0], false) + ""); - - return TEST_PASS; + VerifyOutput("" + ExpectedOutput("foo\r\nfoo\nfoo\rfoo\tfoo", nlHandling, false) + ""); } - //[Variation(Desc = "NewLine handling in attribute when Indent=true; Entitize, '\\r\\n'", Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 50, Pri = 1)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; Replace, '\\r\\n'", Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 51, Pri = 1)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; None, '\\r\\n'", Params = new object[] { NewLineHandling.None, "\r\n" }, id = 52, Pri = 1)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; Entitize, '\\r'", Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 53, Pri = 2)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; Replace, '\\r'", Params = new object[] { NewLineHandling.Replace, "\r" }, id = 54, Pri = 2)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; None, '\\r'", Params = new object[] { NewLineHandling.None, "\r" }, id = 54, Pri = 2)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; Entitize, '---'", Params = new object[] { NewLineHandling.Entitize, "---" }, id = 54, Pri = 2)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; Replace, '---'", Params = new object[] { NewLineHandling.Replace, "---" }, id = 55, Pri = 2)] - //[Variation(Desc = "NewLine handling in attribute when Indent=true; None, '---'", Params = new object[] { NewLineHandling.None, "---" })] - public int EOF_Handling_15() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r\n" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "---" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "---" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "---" )] + public void EOF_Handling_15(XmlWriterUtils utils, NewLineHandling nlHandling, string newLineChars) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - wSettings.NewLineChars = CurVariation.Params[1].ToString(); + wSettings.NewLineChars = newLineChars; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteAttributeString("foo", "foo\r\nfoo\nfoo\rfoo\tfoo"); w.WriteEndElement(); w.Dispose(); - VerifyOutput(""); - - return TEST_PASS; + VerifyOutput(""); } - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; Entitize, '\\r\\n'", Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 56, Pri = 1)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; Replace, '\\r\\n'", Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 57, Pri = 1)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; None, '\\r\\n'", Params = new object[] { NewLineHandling.None, "\r\n" }, id = 58, Pri = 1)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; Entitize, '\\r'", Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 59, Pri = 2)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; Replace, '\\r'", Params = new object[] { NewLineHandling.Replace, "\r" }, id = 60, Pri = 2)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; None, '\\r'", Params = new object[] { NewLineHandling.None, "\r" }, id = 61, Pri = 2)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; Entitize, '---'", Params = new object[] { NewLineHandling.Entitize, "---" }, id = 62, Pri = 2)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; Replace, '---'", Params = new object[] { NewLineHandling.Replace, "---" }, id = 63, Pri = 2)] - //[Variation(Desc = "NewLine handling between attributes when NewLineOnAttributes=true; None, '---'", Params = new object[] { NewLineHandling.None, "---" }, id = 64, Pri = 2)] - public int EOF_Handling_16() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r\n")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r\n")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r\n")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "---")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "---")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "---")] + public void EOF_Handling_16(XmlWriterUtils utils, NewLineHandling nlHandling, string newLineChars) { XmlWriterSettings wSettings = new XmlWriterSettings(); string PrototypeOutput = ""; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - wSettings.NewLineChars = CurVariation.Params[1].ToString(); + wSettings.NewLineChars = newLineChars; wSettings.NewLineOnAttributes = true; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteAttributeString("foo", "fooval"); w.WriteAttributeString("bar", "barval"); w.WriteEndElement(); w.Dispose(); - VerifyOutput(PrototypeOutput.Replace("&NewLine", CurVariation.Params[1].ToString())); - - return TEST_PASS; + VerifyOutput(PrototypeOutput.Replace("&NewLine", newLineChars)); } /*================== Other types of nodes ==================*/ - //[Variation(Desc = "Sanity tests for various types of nodes with 'Entitize'", Param = NewLineHandling.Entitize, id = 65, Pri = 0)] - //[Variation(Desc = "Sanity tests for various types of nodes with 'Replace'", Param = NewLineHandling.Replace, id = 66, Pri = 0)] - //[Variation(Desc = "Sanity tests for various types of nodes with 'None'", Param = NewLineHandling.None, id = 67, Pri = 0)] - public int EOF_Handling_17() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NewLineHandling.None)] + public void EOF_Handling_17(XmlWriterUtils utils, NewLineHandling nlHandling) { - if (WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent) - return TEST_SKIPPED; - XmlWriterSettings wSettings = new XmlWriterSettings(); string NewLines = "\r \n \r\n"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteCData(NewLines); w.WriteChars(NewLines.ToCharArray(), 0, NewLines.Length); @@ -581,35 +572,34 @@ namespace System.Xml.Tests // Inside Comments and CDATA blocks NewLines are never entitized (needs spec BUG) string expOut; - if ((NewLineHandling)CurVariation.Param == NewLineHandling.Entitize) + if (nlHandling == NewLineHandling.Entitize) expOut = "" + ExpectedOutput(NewLines, NewLineHandling.Entitize, false) + "" + "" + ExpectedOutput(NewLines, NewLineHandling.Entitize, false) + ""; else - expOut = ExpectedOutput("" + NewLines + "" + NewLines + "", (NewLineHandling)CurVariation.Param, false); + expOut = ExpectedOutput("" + NewLines + "" + NewLines + "", nlHandling, false); VerifyOutput(expOut); - - return TEST_PASS; } - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; Entitize, '\\r\\n'", Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 68, Pri = 1)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; Replace, '\\r\\n'", Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 69, Pri = 1)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; None, '\\r\\n'", Params = new object[] { NewLineHandling.None, "\r\n" }, id = 70, Pri = 1)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; Entitize, '\\r'", Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 71, Pri = 2)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; Replace, '\\r'", Params = new object[] { NewLineHandling.Replace, "\r" }, id = 72, Pri = 2)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; None, '\\r'", Params = new object[] { NewLineHandling.None, "\r" }, id = 73, Pri = 2)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; Entitize, '---'", Params = new object[] { NewLineHandling.Entitize, "---" }, id = 74, Pri = 2)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; Replace, '---'", Params = new object[] { NewLineHandling.Replace, "---" }, id = 75, Pri = 2)] - //[Variation(Desc = "Custom NewLineChars inside CDATA & Comment when Indent=true; None, '---'", Params = new object[] { NewLineHandling.None, "---" }, id = 76, Pri = 2)] - public int EOF_Handling_18() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r\n")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r\n")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r\n")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\r")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\r")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\r")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "---")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "---")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "---")] + public void EOF_Handling_18(XmlWriterUtils utils, NewLineHandling nlHandling, string newLineChars) { XmlWriterSettings wSettings = new XmlWriterSettings(); string PrototypeOutput = "&NewLine&NewLine"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - wSettings.NewLineChars = CurVariation.Params[1].ToString(); + wSettings.NewLineChars = newLineChars; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteCData("foo\r\nfoo\nfoo\rfoo\tfoo"); w.WriteEndElement(); @@ -617,32 +607,30 @@ namespace System.Xml.Tests w.WriteComment("foo\r\nfoo\nfoo\rfoo\tfoo"); w.Dispose(); - if ((NewLineHandling)CurVariation.Params[0] == NewLineHandling.Replace) - VerifyOutput(PrototypeOutput.Replace("&NewLine", CurVariation.Params[1].ToString())); + if (nlHandling == NewLineHandling.Replace) + VerifyOutput(PrototypeOutput.Replace("&NewLine", newLineChars)); else - VerifyOutput("&NewLine&NewLine".Replace("&NewLine", CurVariation.Params[1].ToString())); + VerifyOutput("&NewLine&NewLine".Replace("&NewLine", newLineChars)); - return TEST_PASS; + return; } - - //[Variation(Desc = "Wrapped writer tests for various types of nodes with 'Entitize'", Param = NewLineHandling.Entitize, Priority = 2)] - //[Variation(Desc = "Wrapped writer tests for various types of nodes with 'Replace'", Param = NewLineHandling.Replace, Priority = 2)] - //[Variation(Desc = "Wrapped writer tests for various types of nodes with 'None'", Param = NewLineHandling.None, Priority = 2)] - public int EOF_Handling_19() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NewLineHandling.None)] + public void EOF_Handling_19(XmlWriterUtils utils, NewLineHandling nlHandling) { - if (WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent) - CError.Skip("skipped"); XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Param; + wSettings.NewLineHandling = nlHandling; wSettings.CheckCharacters = false; - XmlWriter ww = CreateMemWriter(wSettings); + XmlWriter ww = CreateMemWriter(utils, wSettings); XmlWriterSettings ws = wSettings.Clone(); ws.NewLineHandling = NewLineHandling.Replace; ws.CheckCharacters = true; - XmlWriter w = WriterHelper.Create(ww, ws); + XmlWriter w = WriterHelper.Create(ww, ws, overrideAsync: true, async: utils.Async); - string NewLines = "\r \n " + nl; + string NewLines = "\r \n " + Environment.NewLine; w.WriteStartElement("root"); w.WriteCData(NewLines); @@ -654,31 +642,32 @@ namespace System.Xml.Tests w.Dispose(); string expOut; - if ((NewLineHandling)CurVariation.Param == NewLineHandling.Entitize) + if (nlHandling == NewLineHandling.Entitize) expOut = "" + ExpectedOutput(NewLines, NewLineHandling.Entitize, false) + "" + "" + ExpectedOutput(NewLines, NewLineHandling.Entitize, false) + ""; else expOut = ExpectedOutput("" + NewLines + "" + NewLines + "", NewLineHandling.Replace, false); VerifyOutput(expOut); - return TEST_PASS; + return; } - //[Variation(Desc = "XmlWriterSettings.IndentChars - valid values", Priority = 2, Param = 1)] - //[Variation(Desc = "XmlWriterSettings.NewLineChars - valid values", Priority = 2, Param = 2)] - //[Variation(Desc = "XmlWriterSettings.IndentChars - valid values", Priority = 2, Param = 3)] - //[Variation(Desc = "XmlWriterSettings.NewLineChars - valid values", Priority = 2, Param = 4)] - //[Variation(Desc = "XmlWriterSettings.IndentChars - valid values", Priority = 2, Param = 5)] - //[Variation(Desc = "XmlWriterSettings.NewLineChars - valid values", Priority = 2, Param = 6)] - //[Variation(Desc = "XmlWriterSettings.IndentChars - valid values", Priority = 2, Param = 7)] - //[Variation(Desc = "XmlWriterSettings.NewLineChars - valid values", Priority = 2, Param = 8)] - //[Variation(Desc = "XmlWriterSettings.IndentChars - valid values", Priority = 2, Param = 9)] - //[Variation(Desc = "XmlWriterSettings.NewLineChars - valid values", Priority = 2, Param = 10)] - //[Variation(Desc = "XmlWriterSettings.Indent - valid values", Priority = 2, Param = 11)] - //[Variation(Desc = "XmlWriterSettings.Indent - valid values", Priority = 2, Param = 12)] - public int EOF_Handling_20() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 1)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 2)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 3)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 4)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 5)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 6)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 7)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 8)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 9)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 10)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 11)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, 12)] + public void EOF_Handling_20(XmlWriterUtils utils, int param) { XmlWriterSettings ws = new XmlWriterSettings(); - switch ((int)CurVariation.Param) + switch (param) { case 1: ws.IndentChars = ""; break; case 2: ws.NewLineChars = ""; break; @@ -693,26 +682,27 @@ namespace System.Xml.Tests case 11: ws.Indent = true; break; case 12: ws.Indent = false; break; } - return TEST_PASS; + return; } - //[Variation(Desc = "10.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\uD800\uDC00', '\uD800\uDC00'", Params = new object[] { NewLineHandling.Entitize, "\uD800\uDC00", "\uD800\uDC00" })] - //[Variation(Desc = "11.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\uD800\uDC00', ' '", Params = new object[] { NewLineHandling.Replace, "\uD800\uDC00", "\uD800\uDC00" })] - //[Variation(Desc = "12.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\uD800\uDC00', '<>'", Params = new object[] { NewLineHandling.None, "\uD800\uDC00", "\uD800\uDC00" })] - //[Variation(Desc = "13.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '<>', '<>'", Params = new object[] { NewLineHandling.Entitize, "<>", "<>" })] - //[Variation(Desc = "14.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '<>', '<>'", Params = new object[] { NewLineHandling.Replace, "<>", "<>" })] - //[Variation(Desc = "15.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '<>', '<>'", Params = new object[] { NewLineHandling.None, "<>", "<>" })] - public int EOF_Handling_21() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "\uD800\uDC00", "\uD800\uDC00" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "\uD800\uDC00", "\uD800\uDC00" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "\uD800\uDC00", "\uD800\uDC00" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize, "<>", "<>" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace, "<>", "<>" )] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None, "<>", "<>" )] + public void EOF_Handling_21(XmlWriterUtils utils, NewLineHandling nlHandling, string newLineChars, string indentChars) { XmlWriterSettings wSettings = new XmlWriterSettings(); string PrototypeOutput = "&NewLine&Indent&NewLine&Indent&Indent&NewLine&Indent&NewLine"; - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; - wSettings.NewLineChars = CurVariation.Params[1].ToString(); - wSettings.IndentChars = CurVariation.Params[2].ToString(); + wSettings.NewLineChars = newLineChars; + wSettings.IndentChars = indentChars; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("root"); w.WriteStartElement("foo"); w.WriteElementString("bar", ""); @@ -720,30 +710,31 @@ namespace System.Xml.Tests w.WriteEndElement(); w.Dispose(); - VerifyOutput(PrototypeOutput.Replace("&NewLine", CurVariation.Params[1].ToString()).Replace("&Indent", CurVariation.Params[2].ToString())); - return TEST_PASS; + VerifyOutput(PrototypeOutput.Replace("&NewLine", newLineChars).Replace("&Indent", indentChars)); + return; } - //[Variation(Desc = "16.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\uDE40\uDA72', '\uDE40\uDA72'", Params = new object[] { NewLineHandling.Entitize })] - //[Variation(Desc = "17.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\uDE40\uDA72', '\uDE40\uDA72'", Params = new object[] { NewLineHandling.Replace })] - //[Variation(Desc = "18.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\uDE40\uDA72', '\uDE40\uDA72'", Params = new object[] { NewLineHandling.None })] - public int EOF_Handling_22() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Entitize)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.Replace)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom, NewLineHandling.None)] + public void EOF_Handling_22(XmlWriterUtils utils, NewLineHandling nlHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NewLineHandling = (NewLineHandling)CurVariation.Params[0]; + wSettings.NewLineHandling = nlHandling; wSettings.Indent = true; wSettings.NewLineChars = "\uDE40\uDA72"; wSettings.IndentChars = "\uDE40\uDA72"; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); try { w.WriteStartElement("root"); w.WriteStartElement("foo"); w.Dispose(); } - catch (ArgumentException e) { CError.WriteLine(e.Message); return TEST_PASS; } - return TEST_FAIL; + catch (ArgumentException e) { CError.WriteLine(e.Message); return; } + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ErrorCondition.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ErrorCondition.cs index fa0fba6fee..4aa001771f 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ErrorCondition.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ErrorCondition.cs @@ -7,58 +7,52 @@ using System.IO; using System.Linq; using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - //[TestCase(Name = "ErrorCondition")] - public partial class TCErrorConditionWriter : XmlWriterTestCaseBase + public partial class TCErrorConditionWriter// : XmlWriterTestCaseBase { - public override int Init(object o) - { - int i = base.Init(0); - return i; - } - public static string file = "writerErr.out"; - //[Variation(Desc = "XmlWriter.Create((Stream)null)", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter.Create((TextWriter)null)", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter.Create((StringBuilder)null)", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter.Create((XmlWriter)null)", Pri = 2, Param = 4)] - //[Variation(Desc = "XmlWriter.Create((Stream)null, ws)", Pri = 2, Param = 5)] - //[Variation(Desc = "XmlWriter.Create((TextWriter)null, ws)", Pri = 2, Param = 6)] - //[Variation(Desc = "XmlWriter.Create((StringBuilder)null, ws)", Pri = 2, Param = 7)] - //[Variation(Desc = "XmlWriter.Create((XmlWriter)null, ws)", Pri = 2, Param = 8)] - public int var_01() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + public void var_01(XmlWriterUtils utils, int param) { XmlWriterSettings ws = new XmlWriterSettings(); - int param = (int)CurVariation.Param; try { switch (param) { - case 1: XmlWriter w1 = WriterHelper.Create((Stream)null); break; - case 2: XmlWriter w2 = WriterHelper.Create((TextWriter)null); break; - case 3: XmlWriter w3 = WriterHelper.Create((StringBuilder)null); break; - case 4: XmlWriter w4 = WriterHelper.Create((XmlWriter)null); break; - case 5: XmlWriter w5 = WriterHelper.Create((Stream)null, ws); break; - case 6: XmlWriter w6 = WriterHelper.Create((TextWriter)null, ws); break; - case 7: XmlWriter w7 = WriterHelper.Create((StringBuilder)null, ws); break; - case 8: XmlWriter w8 = WriterHelper.Create((XmlWriter)null, ws); break; + case 1: XmlWriter w1 = WriterHelper.Create((Stream)null, overrideAsync: true, async: utils.Async); break; + case 2: XmlWriter w2 = WriterHelper.Create((TextWriter)null, overrideAsync: true, async: utils.Async); break; + case 3: XmlWriter w3 = WriterHelper.Create((StringBuilder)null, overrideAsync: true, async: utils.Async); break; + case 4: XmlWriter w4 = WriterHelper.Create((XmlWriter)null, overrideAsync: true, async: utils.Async); break; + case 5: XmlWriter w5 = WriterHelper.Create((Stream)null, ws, overrideAsync: true, async: utils.Async); break; + case 6: XmlWriter w6 = WriterHelper.Create((TextWriter)null, ws, overrideAsync: true, async: utils.Async); break; + case 7: XmlWriter w7 = WriterHelper.Create((StringBuilder)null, ws, overrideAsync: true, async: utils.Async); break; + case 8: XmlWriter w8 = WriterHelper.Create((XmlWriter)null, ws, overrideAsync: true, async: utils.Async); break; } } - catch (ArgumentNullException) { return TEST_PASS; } - return TEST_FAIL; + catch (ArgumentNullException) { return; } + Assert.True(false); } - //[Variation(Desc = "XmlWriter.WriteAttributes(null, true)", Pri = 2, Param = true)] - //[Variation(Desc = "XmlWriter.WriteAttributes(null, false)", Pri = 2, Param = false)] - public int var_02() + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void var_02(XmlWriterUtils utils, bool param) { - bool param = (bool)CurVariation.Param; bool result = false; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); try { w.WriteAttributes(null, param); @@ -75,17 +69,17 @@ namespace System.Xml.Tests { w.Dispose(); } - return (result) ? TEST_PASS : TEST_FAIL; + Assert.True(result); } - //[Variation(Desc = "XmlWriter.WriteNode((XmlReader)null, true)", Pri = 2, Param = true)] - //[Variation(Desc = "XmlWriter.WriteNode((XmlReader)null, false)", Pri = 2, Param = false)] - public int var_03() + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void var_03(XmlWriterUtils utils, bool param) { - bool param = (bool)CurVariation.Param; bool result = false; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); try { w.WriteNode((XmlReader)null, param); @@ -102,35 +96,35 @@ namespace System.Xml.Tests { w.Dispose(); } - return (result) ? TEST_PASS : TEST_FAIL; + Assert.True((result)); } - //[Variation(Desc = "XmlWriter.WriteAttributeString(null, null)", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter.WriteAttributeString(null, null, null)", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter.WriteAttributeString('a', null, null, null)", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter.WriteAttributeString(null, null, 'a', null)", Pri = 2, Param = 4)] - //[Variation(Desc = "XmlWriter.WriteDocType(null, null, null, null)", Pri = 2, Param = 5)] - //[Variation(Desc = "XmlWriter.WriteElementString(null, null)", Pri = 2, Param = 6)] - //[Variation(Desc = "XmlWriter.WriteElementString(null, null, null)", Pri = 2, Param = 7)] - //[Variation(Desc = "XmlWriter.WriteElementString('a', null, null, null)", Pri = 2, Param = 8)] - //[Variation(Desc = "XmlWriter.WriteElementString('a', null, 'a', null)", Pri = 2, Param = 9)] - //[Variation(Desc = "XmlWriter.WriteEntityRef(null)", Pri = 2, Param = 10)] - //[Variation(Desc = "XmlWriter.WriteName(null)", Pri = 2, Param = 11)] - //[Variation(Desc = "XmlWriter.WriteNmToken(null)", Pri = 2, Param = 12)] - //[Variation(Desc = "XmlWriter.WriteProcessingInstruction(null, null)", Pri = 2, Param = 13)] - //[Variation(Desc = "XmlWriter.WriteQualifiedName(null, null)", Pri = 2, Param = 14)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute(null)", Pri = 2, Param = 15)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute(null, null)", Pri = 2, Param = 16)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute('a', null, null)", Pri = 2, Param = 17)] - //[Variation(Desc = "XmlWriter.WriteStartElement(null)", Pri = 2, Param = 18)] - //[Variation(Desc = "XmlWriter.WriteStartElement(null, null)", Pri = 2, Param = 19)] - //[Variation(Desc = "XmlWriter.WriteStartElement('a', null, null)", Pri = 2, Param = 20)] - public int var_04() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + [XmlWriterInlineData(11)] + [XmlWriterInlineData(12)] + [XmlWriterInlineData(13)] + [XmlWriterInlineData(14)] + [XmlWriterInlineData(15)] + [XmlWriterInlineData(16)] + [XmlWriterInlineData(17)] + [XmlWriterInlineData(18)] + [XmlWriterInlineData(19)] + [XmlWriterInlineData(20)] + public void var_04(XmlWriterUtils utils, int param) { - int param = (int)CurVariation.Param; bool result = false; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); try { switch (param) @@ -199,27 +193,30 @@ namespace System.Xml.Tests case 14: w.WriteQualifiedName(null, null); break; } } - catch (NullReferenceException) { result = (WriterType == WriterType.CharCheckingWriter) ? true : false; } + catch (NullReferenceException) + { + result = (utils.WriterType == WriterType.CharCheckingWriter); + } } finally { w.Dispose(); } - return (result || param == 14 && WriterType == WriterType.CustomWriter) ? TEST_PASS : TEST_FAIL; + Assert.True((result || param == 14 && utils.WriterType == WriterType.CustomWriter)); } - //[Variation(Desc = "XmlWriter.WriteBinHex(null)", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter.WriteBase64(null)", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter.WriteChars(null)", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter.LookupPrefix(null)", Pri = 2, Param = 4)] - //[Variation(Desc = "XmlWriter.WriteRaw(null)", Pri = 2, Param = 5)] - //[Variation(Desc = "XmlWriter.WriteValue((object)null)", Pri = 2, Param = 6)] - public int var_05() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + public void var_05(XmlWriterUtils utils, int param) { - int param = (int)CurVariation.Param; bool result = false; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); w.WriteStartElement("Root"); try { @@ -254,52 +251,52 @@ namespace System.Xml.Tests { w.Dispose(); } - return (result) ? TEST_PASS : TEST_FAIL; + Assert.True((result)); } - //[Variation(Desc = "XmlWriter.WriteComment", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter.WriteCharEntity", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter.WriteCData", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter.WriteEntityRef", Pri = 2, Param = 4)] - //[Variation(Desc = "XmlWriter.WriteRaw", Pri = 2, Param = 5)] - //[Variation(Desc = "XmlWriter.WriteString", Pri = 2, Param = 6)] - //[Variation(Desc = "XmlWriter.WriteSurrogateCharEntity", Pri = 2, Param = 7)] - //[Variation(Desc = "XmlWriter.WriteValue((string)null)", Pri = 2, Param = 8)] - //[Variation(Desc = "XmlWriter.WriteWhitespace", Pri = 2, Param = 9)] - //[Variation(Desc = "XmlWriter.WriteAttributeString('\ud800', '\ud800')", Pri = 2, Param = 10)] - //[Variation(Desc = "XmlWriter.WriteAttributeString('a', '\ud800', '\ud800')", Pri = 2, Param = 11)] - //[Variation(Desc = "XmlWriter.WriteAttributeString('a', 'b', '\ud800', '\ud800')", Pri = 2, Param = 12)] - //[Variation(Desc = "XmlWriter.WriteAttributeString('a', 'b', 'c', '\ud800')", Pri = 2, Param = 13)] - //[Variation(Desc = "XmlWriter.WriteDocType('\ud800', '\ud800', '\ud800', '\ud800')", Pri = 2, Param = 14)] - //[Variation(Desc = "XmlWriter.WriteElementString('\ud800', '\ud800')", Pri = 2, Param = 15)] - //[Variation(Desc = "XmlWriter.WriteElementString('a', '\ud800', '\ud800')", Pri = 2, Param = 16)] - //[Variation(Desc = "XmlWriter.WriteElementString('a', 'b', '\ud800', '\ud800')", Pri = 2, Param = 17)] - //[Variation(Desc = "XmlWriter.WriteElementString('a', 'b', 'c', '\ud800')", Pri = 2, Param = 18)] - //[Variation(Desc = "XmlWriter.WriteEntityRef('\ud800')", Pri = 2, Param = 19)] - //[Variation(Desc = "XmlWriter.WriteName('\ud800')", Pri = 2, Param = 20)] - //[Variation(Desc = "XmlWriter.WriteNmToken('\ud800')", Pri = 2, Param = 21)] - //[Variation(Desc = "XmlWriter.WriteProcessingInstruction('\ud800', '\ud800')", Pri = 2, Param = 22)] - //[Variation(Desc = "XmlWriter.WriteQualifiedName('\ud800', '\ud800')", Pri = 2, Param = 23)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute('\ud800')", Pri = 2, Param = 24)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute('\ud800', '\ud800')", Pri = 2, Param = 25)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute('a', '\ud800', '\ud800')", Pri = 2, Param = 26)] - //[Variation(Desc = "XmlWriter.WriteStartElement('\ud800')", Pri = 2, Param = 27)] - //[Variation(Desc = "XmlWriter.WriteStartElement('\ud800', '\ud800')", Pri = 2, Param = 28)] - //[Variation(Desc = "XmlWriter.WriteStartElement('a', '\ud800', '\ud800')", Pri = 2, Param = 29)] - //[Variation(Desc = "XmlWriter.WriteDocType('a', '\ud800', '\ud800', '\ud800')", Pri = 2, Param = 30)] - //[Variation(Desc = "XmlWriter.WriteDocType('a', 'b', '\ud800', '\ud800')", Pri = 2, Param = 31)] - //[Variation(Desc = "XmlWriter.WriteDocType('a', 'b', 'c', '\ud800')", Pri = 2, Param = 32)] - //[Variation(Desc = "XmlWriter.WriteAttributeString('a', '\ud800')", Pri = 2, Param = 33)] - //[Variation(Desc = "XmlWriter.WriteElementString('a', '\ud800')", Pri = 2, Param = 34)] - //[Variation(Desc = "XmlWriter.WriteProcessingInstruction('a', '\ud800')", Pri = 2, Param = 35)] - //[Variation(Desc = "XmlWriter.WriteQualifiedName('a', '\ud800')", Pri = 2, Param = 36)] - public int var_07() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + [XmlWriterInlineData(11)] + [XmlWriterInlineData(12)] + [XmlWriterInlineData(13)] + [XmlWriterInlineData(14)] + [XmlWriterInlineData(15)] + [XmlWriterInlineData(16)] + [XmlWriterInlineData(17)] + [XmlWriterInlineData(18)] + [XmlWriterInlineData(19)] + [XmlWriterInlineData(20)] + [XmlWriterInlineData(21)] + [XmlWriterInlineData(22)] + [XmlWriterInlineData(23)] + [XmlWriterInlineData(24)] + [XmlWriterInlineData(25)] + [XmlWriterInlineData(26)] + [XmlWriterInlineData(27)] + [XmlWriterInlineData(28)] + [XmlWriterInlineData(29)] + [XmlWriterInlineData(30)] + [XmlWriterInlineData(31)] + [XmlWriterInlineData(32)] + [XmlWriterInlineData(33)] + [XmlWriterInlineData(34)] + [XmlWriterInlineData(35)] + [XmlWriterInlineData(36)] + public void var_07(XmlWriterUtils utils, int param) { - int param = (int)CurVariation.Param; bool result = false; int[] skipParams = new int[] { 14, 20, 21 }; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); if (param != 30 && param != 31 && param != 32) w.WriteStartElement("Root"); switch (param) @@ -396,8 +393,8 @@ namespace System.Xml.Tests case 36: w.WriteQualifiedName("a", "\ud800\ud800"); break; } } - catch (InvalidOperationException) { return TEST_PASS; } - catch (ArgumentException) { return TEST_PASS; } + catch (InvalidOperationException) { return; } + catch (ArgumentException) { return; } } catch (XmlException) { @@ -411,8 +408,12 @@ namespace System.Xml.Tests case 32: w.WriteDocType("a", "b", "c", "\ud800\ud800"); break; } } - catch (XmlException) { return (param == 14) ? TEST_PASS : TEST_FAIL; } - catch (InvalidOperationException) { return TEST_FAIL; } + catch (XmlException) + { + Assert.True((param == 14), "exception expected only for doctype"); + return; + } + catch (InvalidOperationException) { Assert.True(false, "InvalidOperationException not expected here"); } } finally { @@ -420,16 +421,20 @@ namespace System.Xml.Tests { w.Dispose(); } - catch (ArgumentException) { result = true; } + catch (ArgumentException) + { + result = true; + } } - return (result || (WriterType == WriterType.CharCheckingWriter && skipParams.Contains(param))) ? TEST_PASS : TEST_FAIL; + Assert.True(result || (utils.WriterType == WriterType.CharCheckingWriter && skipParams.Contains(param))); } - //[Variation(Desc = "XmlWriter:WriteChars with wrong size throws wrong exception", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter:WriteRaw with wrong size throws wrong exception", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter:WriteBinHex with wrong size throws wrong exception", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter:WriteBase64 with wrong size throws wrong exception", Pri = 2, Param = 4)] - public int var_10() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + public void var_10(XmlWriterUtils utils, int param) { int iBufferSize = 5; int iIndex = 0; @@ -444,11 +449,11 @@ namespace System.Xml.Tests XmlWriterSettings ws = new XmlWriterSettings(); ws.ConformanceLevel = ConformanceLevel.Auto; - using (XmlWriter w = CreateWriter(ws)) + using (XmlWriter w = utils.CreateWriter(ws)) { try { - switch ((int)CurVariation.Param) + switch (param) { case 1: w.WriteChars(charBuffer, iIndex, iCount); break; case 2: w.WriteRaw(charBuffer, iIndex, iCount); break; @@ -460,7 +465,7 @@ namespace System.Xml.Tests { try { - switch ((int)CurVariation.Param) + switch (param) { case 1: w.WriteChars(charBuffer, iIndex, iCount); break; case 2: w.WriteRaw(charBuffer, iIndex, iCount); break; @@ -468,34 +473,35 @@ namespace System.Xml.Tests case 4: w.WriteBase64(byteBuffer, iIndex, iCount); break; } } - catch (ArgumentOutOfRangeException) { return TEST_PASS; } - catch (InvalidOperationException) { return TEST_PASS; } + catch (ArgumentOutOfRangeException) { return; } + catch (InvalidOperationException) { return; } } catch (IndexOutOfRangeException) { try { - switch ((int)CurVariation.Param) + switch (param) { case 1: w.WriteChars(charBuffer, iIndex, iCount); break; } } - catch (IndexOutOfRangeException) { return (WriterType == WriterType.CharCheckingWriter) ? TEST_PASS : TEST_FAIL; } + catch (IndexOutOfRangeException) { Assert.True((utils.WriterType == WriterType.CharCheckingWriter)); } } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "XmlWriterSettings.ConformanceLevel - invalid values", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriterSettings.NewLineHandling - invalid values", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriterSettings.ConformanceLevel - invalid values", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriterSettings.NewLineHandling - invalid values", Pri = 2, Param = 4)] - public int var_11() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + public void var_11(XmlWriterUtils utils, int param) { XmlWriterSettings ws = new XmlWriterSettings(); try { - switch ((int)CurVariation.Param) + switch (param) { case 1: ws.ConformanceLevel = (ConformanceLevel)777; break; case 2: ws.NewLineHandling = (NewLineHandling)777; break; @@ -507,7 +513,7 @@ namespace System.Xml.Tests { try { - switch ((int)CurVariation.Param) + switch (param) { case 1: ws.ConformanceLevel = (ConformanceLevel)555; break; case 2: ws.NewLineHandling = (NewLineHandling)555; break; @@ -515,72 +521,72 @@ namespace System.Xml.Tests case 4: ws.NewLineHandling = (NewLineHandling)(-1); break; } } - catch (ArgumentOutOfRangeException) { return TEST_PASS; } + catch (ArgumentOutOfRangeException) { return; } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "XmlWriter.Create((Stream))", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter.Create((TextWriter))", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter.Create((StringBuilder)l)", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter.Create((XmlWriter))", Pri = 2, Param = 4)] - //[Variation(Desc = "XmlWriter.Create((Stream), ws)", Pri = 2, Param = 5)] - //[Variation(Desc = "XmlWriter.Create((TextWriter), ws)", Pri = 2, Param = 6)] - //[Variation(Desc = "XmlWriter.Create((StringBuilder), ws)", Pri = 2, Param = 7)] - //[Variation(Desc = "XmlWriter.Create((XmlWriter), ws)", Pri = 2, Param = 8)] - public int var_12() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + public void var_12(XmlWriterUtils utils, int param) { XmlWriterSettings ws = new XmlWriterSettings(); TextWriter stringWriter = new StringWriter(); - int param = (int)CurVariation.Param; switch (param) { - case 1: XmlWriter w1 = WriterHelper.Create(stringWriter); break; - case 2: XmlWriter w2 = WriterHelper.Create(stringWriter); break; - case 3: XmlWriter w3 = WriterHelper.Create(new StringBuilder()); break; - case 4: XmlWriter w4 = WriterHelper.Create(WriterHelper.Create(stringWriter)); break; - case 5: XmlWriter w5 = WriterHelper.Create(stringWriter, ws); break; - case 6: XmlWriter w6 = WriterHelper.Create(stringWriter, ws); break; - case 7: XmlWriter w7 = WriterHelper.Create(new StringBuilder(), ws); break; - case 8: XmlWriter w8 = WriterHelper.Create(WriterHelper.Create(stringWriter), ws); break; + case 1: XmlWriter w1 = WriterHelper.Create(stringWriter, overrideAsync: true, async: utils.Async); break; + case 2: XmlWriter w2 = WriterHelper.Create(stringWriter, overrideAsync: true, async: utils.Async); break; + case 3: XmlWriter w3 = WriterHelper.Create(new StringBuilder(), overrideAsync: true, async: utils.Async); break; + case 4: XmlWriter w4 = WriterHelper.Create(WriterHelper.Create(stringWriter, overrideAsync: true, async: utils.Async), overrideAsync: true, async: utils.Async); break; + case 5: XmlWriter w5 = WriterHelper.Create(stringWriter, ws, overrideAsync: true, async: utils.Async); break; + case 6: XmlWriter w6 = WriterHelper.Create(stringWriter, ws, overrideAsync: true, async: utils.Async); break; + case 7: XmlWriter w7 = WriterHelper.Create(new StringBuilder(), ws, overrideAsync: true, async: utils.Async); break; + case 8: XmlWriter w8 = WriterHelper.Create(WriterHelper.Create(stringWriter, overrideAsync: true, async: utils.Async), ws, overrideAsync: true, async: utils.Async); break; } - return TEST_PASS; + return; } - //[Variation(Desc = "XmlWriter.WriteComment(String.Empty)", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriter.WriteCData(String.Empty)", Pri = 2, Param = 2)] - //[Variation(Desc = "XmlWriter.WriteEntityRef(String.Empty)", Pri = 2, Param = 3)] - //[Variation(Desc = "XmlWriter.WriteRaw(String.Empty)", Pri = 2, Param = 4)] - //[Variation(Desc = "XmlWriter.WriteString(String.Empty)", Pri = 2, Param = 5)] - //[Variation(Desc = "XmlWriter.WriteValue(String.Empty)", Pri = 2, Param = 6)] - //[Variation(Desc = "XmlWriter.WriteWhitespace(String.Empty)", Pri = 2, Param = 7)] - //[Variation(Desc = "XmlWriter.WriteAttributeString(String.Empty)", Pri = 2, Param = 8)] - //[Variation(Desc = "XmlWriter.WriteAttributeString(String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 9)] - //[Variation(Desc = "XmlWriter.WriteAttributeString(String.Empty, String.Empty, 'String.Empty, String.Empty)", Pri = 2, Param = 10)] - //[Variation(Desc = "XmlWriter.WriteDocType(String.Empty, String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 11)] - //[Variation(Desc = "XmlWriter.WriteElementString(String.Empty, String.Empty)", Pri = 2, Param = 12)] - //[Variation(Desc = "XmlWriter.WriteElementString(String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 13)] - //[Variation(Desc = "XmlWriter.WriteElementString(String.Empty, String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 14)] - //[Variation(Desc = "XmlWriter.WriteEntityRef(String.Empty)", Pri = 2, Param = 15)] - //[Variation(Desc = "XmlWriter.WriteName(String.Empty)", Pri = 2, Param = 16)] - //[Variation(Desc = "XmlWriter.WriteNmToken(String.Empty)", Pri = 2, Param = 17)] - //[Variation(Desc = "XmlWriter.WriteProcessingInstruction(String.Empty, String.Empty)", Pri = 2, Param = 18)] - //[Variation(Desc = "XmlWriter.WriteQualifiedName(String.Empty, String.Empty)", Pri = 2, Param = 19)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute(String.Empty)", Pri = 2, Param = 20)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute(String.Empty, String.Empty)", Pri = 2, Param = 21)] - //[Variation(Desc = "XmlWriter.WriteStartAttribute(String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 22)] - //[Variation(Desc = "XmlWriter.WriteStartElement(String.Empty)", Pri = 2, Param = 23)] - //[Variation(Desc = "XmlWriter.WriteStartElement(String.Empty, String.Empty)", Pri = 2, Param = 24)] - //[Variation(Desc = "XmlWriter.WriteStartElement(String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 25)] - //[Variation(Desc = "XmlWriter.WriteDocType(String.Empty, String.Empty, String.Empty, String.Empty)", Pri = 2, Param = 26)] - //[Variation(Desc = "XmlWriter.WriteProcessingInstruction(String.Empty, String.Empty)", Pri = 2, Param = 27)] - public int var_13() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + [XmlWriterInlineData(11)] + [XmlWriterInlineData(12)] + [XmlWriterInlineData(13)] + [XmlWriterInlineData(14)] + [XmlWriterInlineData(15)] + [XmlWriterInlineData(16)] + [XmlWriterInlineData(17)] + [XmlWriterInlineData(18)] + [XmlWriterInlineData(19)] + [XmlWriterInlineData(20)] + [XmlWriterInlineData(21)] + [XmlWriterInlineData(22)] + [XmlWriterInlineData(23)] + [XmlWriterInlineData(24)] + [XmlWriterInlineData(25)] + [XmlWriterInlineData(26)] + [XmlWriterInlineData(27)] + public void var_13(XmlWriterUtils utils, int param) { - int param = (int)CurVariation.Param; XmlWriterSettings ws = new XmlWriterSettings(); ws.ConformanceLevel = ConformanceLevel.Document; - XmlWriter w = CreateWriter(ws); + XmlWriter w = utils.CreateWriter(ws); bool result = false; if (param != 30 && param != 31 && param != 32) w.WriteStartElement("Root"); @@ -655,17 +661,18 @@ namespace System.Xml.Tests { w.Dispose(); } - return (result || param == 19 && WriterType == WriterType.CustomWriter) ? TEST_PASS : TEST_FAIL; + Assert.True((result || param == 19 && utils.WriterType == WriterType.CustomWriter)); } - //[Variation(Desc = "XmlWriterSettings.IndentChars - invalid values", Pri = 2, Param = 1)] - //[Variation(Desc = "XmlWriterSettings.NewLineChars - invalid values", Pri = 2, Param = 2)] - public int var_14() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + public void var_14(XmlWriterUtils utils, int param) { XmlWriterSettings ws = new XmlWriterSettings(); try { - switch ((int)CurVariation.Param) + switch (param) { case 1: ws.IndentChars = null; break; case 2: ws.NewLineChars = null; break; @@ -675,23 +682,24 @@ namespace System.Xml.Tests { try { - switch ((int)CurVariation.Param) + switch (param) { case 1: ws.IndentChars = null; break; case 2: ws.NewLineChars = null; break; } } - catch (ArgumentNullException) { return TEST_PASS; } + catch (ArgumentNullException) { return; } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "XmlWriter properties after Dispose", Pri = 2)] - public int var_15() + [Theory] + [XmlWriterInlineData] + public void var_15(XmlWriterUtils utils) { - XmlWriter w = CreateWriter(); - bool isUnicode = (WriterType == WriterType.UnicodeWriter || WriterType == WriterType.UnicodeWriterIndent) ? true : false; - bool isIndent = (WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent) ? true : false; + XmlWriter w = utils.CreateWriter(); + bool isUnicode = (utils.WriterType == WriterType.UnicodeWriter || utils.WriterType == WriterType.UnicodeWriterIndent) ? true : false; + bool isIndent = (utils.WriterType == WriterType.UTF8WriterIndent || utils.WriterType == WriterType.UnicodeWriterIndent) ? true : false; w.WriteElementString("a", "b"); ((IDisposable)w).Dispose(); @@ -701,28 +709,29 @@ namespace System.Xml.Tests CError.Compare(w.WriteState, WriteState.Closed, "WriteState"); CError.Compare(w.XmlLang, null, "XmlLang"); CError.Compare(w.XmlSpace, XmlSpace.None, "XmlSpace"); - if (WriterType != WriterType.CustomWriter) + if (utils.WriterType != WriterType.CustomWriter) { CError.Compare(w.Settings.CheckCharacters, true, "CheckCharacters"); CError.Compare(w.Settings.CloseOutput, false, "CloseOutput"); CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "ConformanceLevel"); CError.Compare(w.Settings.Indent, (isIndent) ? true : false, "Indent"); CError.Compare(w.Settings.IndentChars, " ", "IndentChars"); - CError.Compare(w.Settings.NewLineChars, nl, "NewLineChars"); + CError.Compare(w.Settings.NewLineChars, Environment.NewLine, "NewLineChars"); CError.Compare(w.Settings.NewLineHandling, NewLineHandling.Replace, "NewLineHandling"); CError.Compare(w.Settings.NewLineOnAttributes, false, "NewLineOnAttributes"); CError.Compare(w.Settings.OmitXmlDeclaration, true, "OmitXmlDeclaration"); CError.Compare(w.Settings.Encoding.WebName, (isUnicode) ? "utf-16" : "utf-8", "Encoding"); } - return TEST_PASS; + return; } - //[Variation(Desc = "XmlWriter properties after Error", Pri = 2)] - public int var_16() + [Theory] + [XmlWriterInlineData] + public void var_16(XmlWriterUtils utils) { - XmlWriter w = CreateWriter(); - bool isUnicode = (WriterType == WriterType.UnicodeWriter || WriterType == WriterType.UnicodeWriterIndent) ? true : false; - bool isIndent = (WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent) ? true : false; + XmlWriter w = utils.CreateWriter(); + bool isUnicode = (utils.WriterType == WriterType.UnicodeWriter || utils.WriterType == WriterType.UnicodeWriterIndent) ? true : false; + bool isIndent = (utils.WriterType == WriterType.UTF8WriterIndent || utils.WriterType == WriterType.UnicodeWriterIndent) ? true : false; w.WriteElementString("a", "b"); try @@ -735,26 +744,27 @@ namespace System.Xml.Tests CError.Compare(w.WriteState, WriteState.Error, "WriteState"); CError.Compare(w.XmlLang, null, "XmlLang"); CError.Compare(w.XmlSpace, XmlSpace.None, "XmlSpace"); - if (WriterType != WriterType.CustomWriter) + if (utils.WriterType != WriterType.CustomWriter) { CError.Compare(w.Settings.CheckCharacters, true, "CheckCharacters"); CError.Compare(w.Settings.CloseOutput, false, "CloseOutput"); CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "ConformanceLevel"); CError.Compare(w.Settings.Indent, (isIndent) ? true : false, "Indent"); CError.Compare(w.Settings.IndentChars, " ", "IndentChars"); - CError.Compare(w.Settings.NewLineChars, nl, "NewLineChars"); + CError.Compare(w.Settings.NewLineChars, Environment.NewLine, "NewLineChars"); CError.Compare(w.Settings.NewLineHandling, NewLineHandling.Replace, "NewLineHandling"); CError.Compare(w.Settings.NewLineOnAttributes, false, "NewLineOnAttributes"); CError.Compare(w.Settings.OmitXmlDeclaration, true, "OmitXmlDeclaration"); CError.Compare(w.Settings.Encoding.WebName, (isUnicode) ? "utf-16" : "utf-8", "Encoding"); } - return TEST_PASS; + return; } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "XmlWriter.WriteStartElement() should inspect attributes before emitting the element tag", Pri = 2)] - public int bug601305() + [Theory] + [XmlWriterInlineData(WriterType.All & ~WriterType.Async)] + public void bug601305(XmlWriterUtils utils) { CError.WriteLine("expected:"); CError.WriteLine(""); @@ -762,31 +772,31 @@ namespace System.Xml.Tests XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; StringWriter sw = new StringWriter(); - using (XmlWriter w = WriterHelper.Create(sw, ws)) + using (XmlWriter w = WriterHelper.Create(sw, ws, overrideAsync: true, async: utils.Async)) { w.WriteStartElement("root", "uri"); w.WriteStartAttribute("xmlns", "p", "http://www.w3.org/2000/xmlns/"); w.WriteString("uri"); } CError.Compare(sw.ToString(), "", "writer output"); - return TEST_PASS; + return; } - //[Variation(Desc = "writer.Settings.CheckCharacters - readonly", Pri = 2, Param = 1)] - //[Variation(Desc = "writer.Settings.CloseOutput - readonly", Pri = 2, Param = 2)] - //[Variation(Desc = "writer.Settings.ConformanceLevel - readonly", Pri = 2, Param = 3)] - //[Variation(Desc = "writer.Settings.Encoding - readonly", Pri = 2, Param = 4)] - //[Variation(Desc = "writer.Settings.Indent - readonly", Pri = 2, Param = 5)] - //[Variation(Desc = "writer.Settings.IndentChars - readonly", Pri = 2, Param = 6)] - //[Variation(Desc = "writer.Settings.NewLineChars - readonly", Pri = 2, Param = 7)] - //[Variation(Desc = "writer.Settings.NewLineHandling - readonly", Pri = 2, Param = 8)] - //[Variation(Desc = "writer.Settings.NewLineOnAttributes - readonly", Pri = 2, Param = 9)] - //[Variation(Desc = "writer.Settings.OmitXmlDeclaration - readonly", Pri = 2, Param = 10)] - public int var17() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + public void var17(XmlWriterUtils utils, int param) { - if (WriterType == WriterType.CustomWriter) return TEST_PASS; - int param = (int)CurVariation.Param; - XmlWriter writer = CreateWriter(); + if (utils.WriterType == WriterType.CustomWriter) return; + XmlWriter writer = utils.CreateWriter(); try { switch (param) @@ -821,47 +831,47 @@ namespace System.Xml.Tests case 10: writer.Settings.OmitXmlDeclaration = true; break; } } - catch (XmlException) { return TEST_PASS; } + catch (XmlException) { return; } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "WriteQualifiedName after close", Pri = 2, Param = 1)] - //[Variation(Desc = "WriteAttributes after close", Pri = 2, Param = 2)] - //[Variation(Desc = "WriteAttributeString after close", Pri = 2, Param = 3)] - //[Variation(Desc = "WriteBase64 after close", Pri = 2, Param = 4)] - //[Variation(Desc = "WriteBinHex after close", Pri = 2, Param = 5)] - //[Variation(Desc = "WriteCData after close", Pri = 2, Param = 6)] - //[Variation(Desc = "WriteCharEntity after close", Pri = 2, Param = 7)] - //[Variation(Desc = "WriteChars after close", Pri = 2, Param = 8)] - //[Variation(Desc = "WriteComment after close", Pri = 2, Param = 9)] - //[Variation(Desc = "WriteDocType after close", Pri = 2, Param = 10)] - //[Variation(Desc = "WriteElementString after close", Pri = 2, Param = 11)] - //[Variation(Desc = "WriteEndAttribute after close", Pri = 2, Param = 12)] - //[Variation(Desc = "WriteEndDocument after close", Pri = 2, Param = 13)] - //[Variation(Desc = "WriteEndElement after close", Pri = 2, Param = 14)] - //[Variation(Desc = "WriteEntityRef after close", Pri = 2, Param = 15)] - //[Variation(Desc = "WriteFullEndElement after close", Pri = 2, Param = 16)] - //[Variation(Desc = "WriteName after close", Pri = 2, Param = 17)] - //[Variation(Desc = "WriteNmToken after close", Pri = 2, Param = 18)] - //[Variation(Desc = "WriteNode after close", Pri = 2, Param = 19)] - //[Variation(Desc = "WriteProcessingInstruction after close", Pri = 2, Param = 20)] - //[Variation(Desc = "WriteRaw(string) after close", Pri = 2, Param = 21)] - //[Variation(Desc = "WriteRaw(buffer) after close", Pri = 2, Param = 22)] - //[Variation(Desc = "WriteStartAttribute after close", Pri = 2, Param = 23)] - //[Variation(Desc = "WriteStartDocument after close", Pri = 2, Param = 24)] - //[Variation(Desc = "WriteStartElement after close", Pri = 2, Param = 25)] - //[Variation(Desc = "WriteString after close", Pri = 2, Param = 26)] - //[Variation(Desc = "WriteSurrogateCharEntity after close", Pri = 2, Param = 27)] - //[Variation(Desc = "WriteValue after close", Pri = 2, Param = 28)] - //[Variation(Desc = "WriteWhitespace after close", Pri = 2, Param = 29)] - public int var_18() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + [XmlWriterInlineData(11)] + [XmlWriterInlineData(12)] + [XmlWriterInlineData(13)] + [XmlWriterInlineData(14)] + [XmlWriterInlineData(15)] + [XmlWriterInlineData(16)] + [XmlWriterInlineData(17)] + [XmlWriterInlineData(18)] + [XmlWriterInlineData(19)] + [XmlWriterInlineData(20)] + [XmlWriterInlineData(21)] + [XmlWriterInlineData(22)] + [XmlWriterInlineData(23)] + [XmlWriterInlineData(24)] + [XmlWriterInlineData(25)] + [XmlWriterInlineData(26)] + [XmlWriterInlineData(27)] + [XmlWriterInlineData(28)] + [XmlWriterInlineData(29)] + public void var_18(XmlWriterUtils utils, int param) { - int param = (int)CurVariation.Param; XmlReader r = ReaderHelper.Create(new StringReader("")); byte[] buffer = new byte[10]; char[] chbuffer = new char[10]; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); w.WriteElementString("a", "b"); w.Dispose(); CError.Compare(w.WriteState, WriteState.Closed, "WriteState should be Error"); @@ -935,7 +945,7 @@ namespace System.Xml.Tests case 29: w.WriteWhitespace(""); break; } } - catch (InvalidOperationException) { return TEST_PASS; } + catch (InvalidOperationException) { return; } } catch (ArgumentException) { @@ -947,7 +957,7 @@ namespace System.Xml.Tests case 27: w.WriteSurrogateCharEntity('\uD812', '\uDD12'); break; } } - catch (ArgumentException) { return TEST_PASS; } + catch (ArgumentException) { return; } } catch (XmlException) { @@ -958,47 +968,47 @@ namespace System.Xml.Tests case 2: w.WriteAttributes(r, true); break; } } - catch (XmlException) { return TEST_PASS; } + catch (XmlException) { return; } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "WriteQualifiedName after error", Pri = 2, Param = 1)] - //[Variation(Desc = "WriteAttributes after error", Pri = 2, Param = 2)] - //[Variation(Desc = "WriteAttributeString after error", Pri = 2, Param = 3)] - //[Variation(Desc = "WriteBase64 after error", Pri = 2, Param = 4)] - //[Variation(Desc = "WriteBinHex after error", Pri = 2, Param = 5)] - //[Variation(Desc = "WriteCData after error", Pri = 2, Param = 6)] - //[Variation(Desc = "WriteCharEntity after error", Pri = 2, Param = 7)] - //[Variation(Desc = "WriteChars after error", Pri = 2, Param = 8)] - //[Variation(Desc = "WriteComment after error", Pri = 2, Param = 9)] - //[Variation(Desc = "WriteDocType after error", Pri = 2, Param = 10)] - //[Variation(Desc = "WriteElementString after error", Pri = 2, Param = 11)] - //[Variation(Desc = "WriteEndAttribute after error", Pri = 2, Param = 12)] - //[Variation(Desc = "WriteEndDocument after error", Pri = 2, Param = 13)] - //[Variation(Desc = "WriteEndElement after error", Pri = 2, Param = 14)] - //[Variation(Desc = "WriteEntityRef after error", Pri = 2, Param = 15)] - //[Variation(Desc = "WriteFullEndElement after error", Pri = 2, Param = 16)] - //[Variation(Desc = "WriteName after error", Pri = 2, Param = 17)] - //[Variation(Desc = "WriteNmToken after error", Pri = 2, Param = 18)] - //[Variation(Desc = "WriteNode after error", Pri = 2, Param = 19)] - //[Variation(Desc = "WriteProcessingInstruction after error", Pri = 2, Param = 20)] - //[Variation(Desc = "WriteRaw(string) after error", Pri = 2, Param = 21)] - //[Variation(Desc = "WriteRaw(buffer) after error", Pri = 2, Param = 22)] - //[Variation(Desc = "WriteStartAttribute after error", Pri = 2, Param = 23)] - //[Variation(Desc = "WriteStartDocument after error", Pri = 2, Param = 24)] - //[Variation(Desc = "WriteStartElement after error", Pri = 2, Param = 25)] - //[Variation(Desc = "WriteString after error", Pri = 2, Param = 26)] - //[Variation(Desc = "WriteSurrogateCharEntity after error", Pri = 2, Param = 27)] - //[Variation(Desc = "WriteValue after error", Pri = 2, Param = 28)] - //[Variation(Desc = "WriteWhitespace after error", Pri = 2, Param = 29)] - public int var_19() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + [XmlWriterInlineData(11)] + [XmlWriterInlineData(12)] + [XmlWriterInlineData(13)] + [XmlWriterInlineData(14)] + [XmlWriterInlineData(15)] + [XmlWriterInlineData(16)] + [XmlWriterInlineData(17)] + [XmlWriterInlineData(18)] + [XmlWriterInlineData(19)] + [XmlWriterInlineData(20)] + [XmlWriterInlineData(21)] + [XmlWriterInlineData(22)] + [XmlWriterInlineData(23)] + [XmlWriterInlineData(24)] + [XmlWriterInlineData(25)] + [XmlWriterInlineData(26)] + [XmlWriterInlineData(27)] + [XmlWriterInlineData(28)] + [XmlWriterInlineData(29)] + public void var_19(XmlWriterUtils utils, int param) { - int param = (int)CurVariation.Param; XmlReader r = ReaderHelper.Create(new StringReader("")); byte[] buffer = new byte[10]; char[] chbuffer = new char[10]; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); try { w.WriteStartDocument(); @@ -1077,7 +1087,7 @@ namespace System.Xml.Tests case 29: w.WriteWhitespace(""); break; } } - catch (InvalidOperationException) { return TEST_PASS; } + catch (InvalidOperationException) { return; } } catch (ArgumentException) { @@ -1089,7 +1099,7 @@ namespace System.Xml.Tests case 27: w.WriteSurrogateCharEntity('\uD812', '\uDD12'); break; } } - catch (ArgumentException) { return TEST_PASS; } + catch (ArgumentException) { return; } } catch (XmlException) { @@ -1100,16 +1110,17 @@ namespace System.Xml.Tests case 2: w.WriteAttributes(r, true); break; } } - catch (XmlException) { return TEST_PASS; } + catch (XmlException) { return; } } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "Assert when write attribute value with invalid surrogate pair and encoding ASCII")] - public int var_20() + [Theory] + [XmlWriterInlineData] + public void var_20(XmlWriterUtils utils) { - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); w.WriteStartElement("root"); try { @@ -1124,56 +1135,56 @@ namespace System.Xml.Tests w.WriteAttributeString("attr2", "\uD812\uD812"); w.WriteEndElement(); } - catch (InvalidOperationException ioe) { CError.WriteLine(ioe); return TEST_PASS; } - catch (ArgumentException ae) { CError.WriteLine(ae); return TEST_PASS; } + catch (InvalidOperationException ioe) { CError.WriteLine(ioe); return; } + catch (ArgumentException ae) { CError.WriteLine(ae); return; } } finally { w.Dispose(); } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "WriteValue attr swap surrogate pair", Param = 1)] - //[Variation(Desc = "WriteComment attr swap surrogate pair", Param = 2)] - //[Variation(Desc = "WriteCData attr swap surrogate pair", Param = 3)] - //[Variation(Desc = "WriteProcessingInstruction attr swap surrogate pair", Param = 4)] - //[Variation(Desc = "WriteRaw attr swap surrogate pair", Param = 5)] - //[Variation(Desc = "WriteValue elem swap surrogate pair", Param = 6)] - //[Variation(Desc = "WriteComment elem swap surrogate pair", Param = 7)] - //[Variation(Desc = "WriteCData elem swap surrogate pair", Param = 8)] - //[Variation(Desc = "WriteProcessingInstruction elem swap surrogate pair", Param = 9)] - //[Variation(Desc = "WriteRaw elem swap surrogate pair", Param = 10)] - //[Variation(Desc = "WriteAttributeString swap surrogate pair", Param = 11)] - //[Variation(Desc = "WriteCharEntity swap surrogate pair", Param = 12)] - //[Variation(Desc = "WriteDocType pubid swap surrogate pair", Param = 13)] - //[Variation(Desc = "WriteDocType sysid swap surrogate pair", Param = 14)] - //[Variation(Desc = "WriteDocType subset swap surrogate pair", Param = 15)] - //[Variation(Desc = "WriteElementString1 swap surrogate pair", Param = 16)] - //[Variation(Desc = "WriteElementString2 swap surrogate pair", Param = 17)] - //[Variation(Desc = "WriteElementString3 swap surrogate pair", Param = 18)] - //[Variation(Desc = "WriteElementString4 swap surrogate pair", Param = 19)] - //[Variation(Desc = "WriteEntityRef swap surrogate pair", Param = 20)] - //[Variation(Desc = "WriteName swap surrogate pair", Param = 21)] - //[Variation(Desc = "WriteNmToken swap surrogate pair", Param = 22)] - //[Variation(Desc = "WriteQualifiedName1 swap surrogate pair", Param = 23)] - //[Variation(Desc = "WriteQualifiedName2 swap surrogate pair", Param = 24)] - //[Variation(Desc = "WriteStartAttribute1 swap surrogate pair", Param = 25)] - //[Variation(Desc = "WriteStartAttribute2 swap surrogate pair", Param = 26)] - //[Variation(Desc = "WriteStartAttribute3 swap surrogate pair", Param = 27)] - //[Variation(Desc = "WriteStartElemen1 swap surrogate pair", Param = 28)] - //[Variation(Desc = "WriteStartElemen2 swap surrogate pair", Param = 29)] - //[Variation(Desc = "WriteStartElemen3 swap surrogate pair", Param = 30)] - //[Variation(Desc = "WriteString swap surrogate pair", Param = 31)] - //[Variation(Desc = "WriteWhitespace swap surrogate pair", Param = 32)] - //[Variation(Desc = "WriteString attr swap surrogate pair", Param = 33)] - //[Variation(Desc = "WriteSurrogateCharEntity swap surrogate pair", Param = 34)] - public int var_21() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + [XmlWriterInlineData(7)] + [XmlWriterInlineData(8)] + [XmlWriterInlineData(9)] + [XmlWriterInlineData(10)] + [XmlWriterInlineData(11)] + [XmlWriterInlineData(12)] + [XmlWriterInlineData(13)] + [XmlWriterInlineData(14)] + [XmlWriterInlineData(15)] + [XmlWriterInlineData(16)] + [XmlWriterInlineData(17)] + [XmlWriterInlineData(18)] + [XmlWriterInlineData(19)] + [XmlWriterInlineData(20)] + [XmlWriterInlineData(21)] + [XmlWriterInlineData(22)] + [XmlWriterInlineData(23)] + [XmlWriterInlineData(24)] + [XmlWriterInlineData(25)] + [XmlWriterInlineData(26)] + [XmlWriterInlineData(27)] + [XmlWriterInlineData(28)] + [XmlWriterInlineData(29)] + [XmlWriterInlineData(30)] + [XmlWriterInlineData(31)] + [XmlWriterInlineData(32)] + [XmlWriterInlineData(33)] + [XmlWriterInlineData(34)] + public void var_21(XmlWriterUtils utils, int param) { - int param = (int)this.CurVariation.Param; bool result = false; string val = "\uDE34\uD9A2"; - XmlWriter w = CreateWriter(); + XmlWriter w = utils.CreateWriter(); if (param != 13 && param != 14 && param != 15) w.WriteStartElement("a", "b"); try { @@ -1275,7 +1286,10 @@ namespace System.Xml.Tests case 22: w.WriteNmToken(val); break; } } - catch (XmlException) { result = (WriterType == WriterType.CharCheckingWriter && (param == 21 || param == 22)) ? true : false; } + catch (XmlException) + { + result = (utils.WriterType == WriterType.CharCheckingWriter && (param == 21 || param == 22)); + } catch (InvalidOperationException) { result = false; } } finally @@ -1286,16 +1300,16 @@ namespace System.Xml.Tests } catch (ArgumentException) { result = true; } } - return result ? TEST_PASS : TEST_FAIL; + Assert.True(result); } - //[Variation(Desc = "System.Xml.XmlWriter::WriteAttributes", Param = 1)] - //[Variation(Desc = "System.Xml.XmlWriter::WriteAttributes", Param = 2)] - //[Variation(Desc = "System.Xml.XmlWriter::WriteAttributes", Param = 3)] - //[Variation(Desc = "System.Xml.XmlWriter::WriteAttributes", Param = 4)] - public int bug600541() + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + public void bug600541(XmlWriterUtils utils, int param) { - int param = (int)this.CurVariation.Param; string xml = ""; switch (param) { @@ -1309,7 +1323,7 @@ namespace System.Xml.Tests r.Read(); CError.Compare(r.NodeType, XmlNodeType.Element, "XNT"); CError.Compare(r.MoveToFirstAttribute(), true, "MFA"); - using (XmlWriter w = CreateWriter()) + using (XmlWriter w = utils.CreateWriter()) { w.WriteStartElement("root"); switch (param) @@ -1321,13 +1335,14 @@ namespace System.Xml.Tests } w.WriteAttributes(r, true); w.Dispose(); - return (CompareString(xml)) ? TEST_PASS : TEST_FAIL; + Assert.True((utils.CompareString(xml))); } } } - //[Variation(Desc = "Schema.XmlUntypedStringConverter::ToString")] - public int bug630890() + [Theory] + [XmlWriterInlineData] + public void bug630890(XmlWriterUtils utils) { object obj = (object)1; for (int i = 0; i < 100000; i++) @@ -1335,7 +1350,7 @@ namespace System.Xml.Tests obj = new object[1] { obj }; } - using (XmlWriter w = CreateWriter()) + using (XmlWriter w = utils.CreateWriter()) { w.WriteStartElement("Root"); try @@ -1351,15 +1366,16 @@ namespace System.Xml.Tests w.WriteValue(obj); CError.Compare(false, "Failed1"); } - catch (InvalidOperationException) { CError.WriteLine(e.Message); return TEST_PASS; } - catch (InvalidCastException) { CError.WriteLine(e.Message); return TEST_PASS; } + catch (InvalidOperationException) { CError.WriteLine(e.Message); return; } + catch (InvalidCastException) { CError.WriteLine(e.Message); return; } } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "XMLWriter.WriteValue fails with ArgumentNullException if passed an array which has null/empty items")] - public int PassingArrayWithNullOrEmptyItemsCausesWriteValueToFail() + [Theory] + [XmlWriterInlineData] + public void PassingArrayWithNullOrEmptyItemsCausesWriteValueToFail(XmlWriterUtils utils) { string[] a = new string[5]; string exp = "a a1 "; @@ -1368,12 +1384,12 @@ namespace System.Xml.Tests a[3] = null; a[4] = ""; - using (XmlWriter w = CreateWriter()) + using (XmlWriter w = utils.CreateWriter()) { w.WriteStartElement("b"); w.WriteValue(a); } - return (CompareString(exp)) ? TEST_PASS : TEST_FAIL; + Assert.True((utils.CompareString(exp))); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/NamespaceHandlingTests.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/NamespaceHandlingTests.cs index 9509d4fc38..4bfed997b4 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/NamespaceHandlingTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/NamespaceHandlingTests.cs @@ -6,26 +6,17 @@ using OLEDB.Test.ModuleCore; using System.IO; using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { //[TestCase(Name = "XmlWriterSettings: NamespaceHandling")] - public partial class TCNamespaceHandling : XmlFactoryWriterTestCaseBase + public partial class TCNamespaceHandling { - public override int Init(object o) - { - if (!(WriterType == WriterType.CustomWriter || WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent /*|| WriterType == WriterType.DOMWriter || WriterType == WriterType.XmlTextWriter*/)) - { - int i = base.Init(0); - return i; - } - return TEST_SKIPPED; - } - private static NamespaceHandling[] s_nlHandlingMembers = { NamespaceHandling.Default, NamespaceHandling.OmitDuplicates }; private StringWriter _strWriter = null; - private XmlWriter CreateMemWriter(XmlWriterSettings settings) + private XmlWriter CreateMemWriter(XmlWriterUtils utils, XmlWriterSettings settings) { XmlWriterSettings wSettings = settings.Clone(); wSettings.CloseOutput = false; @@ -33,33 +24,33 @@ namespace System.Xml.Tests wSettings.CheckCharacters = false; XmlWriter w = null; - switch (WriterType) + switch (utils.WriterType) { case WriterType.UTF8Writer: wSettings.Encoding = Encoding.UTF8; if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - w = WriterHelper.Create(_strWriter, wSettings); + w = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.UnicodeWriter: wSettings.Encoding = Encoding.Unicode; if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - w = WriterHelper.Create(_strWriter, wSettings); + w = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.WrappedWriter: if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - XmlWriter ww = WriterHelper.Create(_strWriter, wSettings); - w = WriterHelper.Create(ww, wSettings); + XmlWriter ww = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); + w = WriterHelper.Create(ww, wSettings, overrideAsync: true, async: utils.Async); break; case WriterType.CharCheckingWriter: if (_strWriter != null) _strWriter.Dispose(); _strWriter = new StringWriter(); - XmlWriter cw = WriterHelper.Create(_strWriter, wSettings); + XmlWriter cw = WriterHelper.Create(_strWriter, wSettings, overrideAsync: true, async: utils.Async); XmlWriterSettings cws = settings.Clone(); cws.CheckCharacters = true; - w = WriterHelper.Create(cw, cws); + w = WriterHelper.Create(cw, cws, overrideAsync: true, async: utils.Async); break; default: throw new Exception("Unknown writer type"); @@ -79,70 +70,75 @@ namespace System.Xml.Tests } } - //[Variation(Desc = "NamespaceHandling Default value - NamespaceHandling.Default")] - public int NS_Handling_1() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting)] + public void NS_Handling_1(XmlWriterUtils utils) { XmlWriterSettings wSettings = new XmlWriterSettings(); CError.Compare(wSettings.NamespaceHandling, NamespaceHandling.Default, "Incorrect default value for XmlWriterSettings.NamespaceHandling"); - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { CError.Compare(w.Settings.NamespaceHandling, NamespaceHandling.Default, "Incorrect default value for XmlWriter.Settings.NamespaceHandling"); } - return TEST_PASS; + return; } - //[Variation(Desc = "XmlWriter creation with NamespaceHandling.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "XmlWriter creation with NamespaceHandling.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_2() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_2(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { CError.Compare(w != null, "XmlWriter creation failed"); - CError.Compare(w.Settings.NamespaceHandling, (NamespaceHandling)this.CurVariation.Param, "Invalid NamespaceHandling assignment"); + CError.Compare(w.Settings.NamespaceHandling, nsHandling, "Invalid NamespaceHandling assignment"); } - return TEST_PASS; + return; } - //[Variation(Desc = "NamespaceHandling = NamespaceHandling.Default | NamespaceHandling.OmitDuplicates")] - public int NS_Handling_2a() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting)] + public void NS_Handling_2a(XmlWriterUtils utils) { XmlWriterSettings wSettings = new XmlWriterSettings(); wSettings.NamespaceHandling = NamespaceHandling.Default | NamespaceHandling.OmitDuplicates; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { CError.Compare(w.Settings.NamespaceHandling, NamespaceHandling.OmitDuplicates, "Invalid NamespaceHandling assignment"); } - return TEST_PASS; + return; } - //[Variation(Desc = "NamespaceHandling override with Default.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "NamespaceHandling override with Default.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_3() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_3(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); wSettings.NamespaceHandling = NamespaceHandling.OmitDuplicates; - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { wSettings.NamespaceHandling = NamespaceHandling.Default; CError.Compare(w != null, "XmlWriter creation failed"); - CError.Compare(w.Settings.NamespaceHandling, (NamespaceHandling)this.CurVariation.Param, "Invalid NamespaceHandling assignment"); + CError.Compare(w.Settings.NamespaceHandling, nsHandling, "Invalid NamespaceHandling assignment"); } - return TEST_PASS; + return; } - //[Variation(Desc = "NamespaceHandling override with negativeVal.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "NamespaceHandling override with negativeVal.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_3a() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_3a(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; try { wSettings.NamespaceHandling = (NamespaceHandling)(-1); @@ -158,104 +154,106 @@ namespace System.Xml.Tests catch (ArgumentOutOfRangeException) { } } - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { CError.Compare(w != null, "XmlWriter creation failed"); - CError.Compare(w.Settings.NamespaceHandling, (NamespaceHandling)this.CurVariation.Param, "Invalid NamespaceHandling assignment"); + CError.Compare(w.Settings.NamespaceHandling, nsHandling, "Invalid NamespaceHandling assignment"); } - return TEST_PASS; + return; } - //[Variation(Desc = "1.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "",null })] - //[Variation(Desc = "1.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "","" })] - //[Variation(Desc = "2.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "2.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "","" })] - //[Variation(Desc = "3.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "",null })] - //[Variation(Desc = "3.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "",null })] - //[Variation(Desc = "4.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "",null })] - //[Variation(Desc = "4.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "",null })] - //[Variation(Desc = "5.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "5.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "", "" })] - //[Variation(Desc = "6.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "6.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "","" })] - //[Variation(Desc = "7.NamespaceHandling.Default", Params = new object[] { NamespaceHandling.Default, "

", null })] - //[Variation(Desc = "7.NamespaceHandling.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "

","

" })] - //[Variation(Desc = "8.NamespaceHandling.Default NS Redefinition.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "8.NamespaceHandling.Default NS Redefinition.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "", null })] - //[Variation(Desc = "9.Unused namespace declarations.Default", Params = new object[] { NamespaceHandling.Default, " ", null })] - //[Variation(Desc = "9.Unused namespace declarations.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, " ", null })] - //[Variation(Desc = "10.NamespaceHandling.Same NS.Diff prefix.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "10.NamespaceHandling.Same NS.Diff prefix.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "", null })] - //[Variation(Desc = "11.NamespaceHandling.Diff NS.Same prefix.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "11.NamespaceHandling.Diff NS.Same prefix.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "", null })] - //[Variation(Desc = "12.NamespaceHandling.NS Redefinition.Unused NS.Default", Params = new object[] { NamespaceHandling.Default, "", null })] - //[Variation(Desc = "12.NamespaceHandling.NS Redefinition.Unused NS.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "", null })] - public int NS_Handling_3b() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", "")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", "")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", "")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", "")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "

", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "

", "

")] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, " ", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, " ", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "", null)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "", null)] + public void NS_Handling_3b(XmlWriterUtils utils, NamespaceHandling nsHandling, string xml, string exp) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - string xml = (string)this.CurVariation.Params[1]; - string exp = (string)this.CurVariation.Params[2]; + wSettings.NamespaceHandling = nsHandling; using (XmlReader r = ReaderHelper.Create(new StringReader(xml))) { - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteNode(r, false); w.Dispose(); VerifyOutput(exp == null ? xml : exp); } } - return TEST_PASS; + return; } - //[Variation(Desc = "NamespaceHandling wrap with Default.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "NamespaceHandling wrap with Default.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_4a() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_4a(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter ww = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter ww = CreateMemWriter(utils, wSettings)) { XmlWriterSettings ws = wSettings.Clone(); ws.NamespaceHandling = NamespaceHandling.Default; ws.CheckCharacters = true; - using (XmlWriter w = WriterHelper.Create(ww, ws)) + using (XmlWriter w = WriterHelper.Create(ww, ws, overrideAsync: true, async: utils.Async)) { CError.Compare(w != null, "XmlWriter creation failed"); - CError.Compare(w.Settings.NamespaceHandling, (NamespaceHandling)this.CurVariation.Param, "Invalid NamespaceHandling assignment"); + CError.Compare(w.Settings.NamespaceHandling, nsHandling, "Invalid NamespaceHandling assignment"); } } - return TEST_PASS; + return; } - //[Variation(Desc = "NamespaceHandling wrap with OmitDuplicates.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "NamespaceHandling wrap with OmitDuplicates.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_4b() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_4b(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter ww = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter ww = CreateMemWriter(utils, wSettings)) { XmlWriterSettings ws = wSettings.Clone(); ws.NamespaceHandling = NamespaceHandling.OmitDuplicates; ws.CheckCharacters = true; - using (XmlWriter w = WriterHelper.Create(ww, ws)) + using (XmlWriter w = WriterHelper.Create(ww, ws, overrideAsync: true, async: utils.Async)) { CError.Compare(w != null, "XmlWriter creation failed"); - CError.Compare(w.Settings.NamespaceHandling, (NamespaceHandling)this.CurVariation.Param, "Invalid NamespaceHandling assignment"); + CError.Compare(w.Settings.NamespaceHandling, nsHandling, "Invalid NamespaceHandling assignment"); } } - return TEST_PASS; + return; } - //[Variation(Desc = "XmlWriter.WriteStartElement() should inspect attributes before emitting the element tag.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "XmlWriter.WriteStartElement() should inspect attributes before emitting the element tag.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_5() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_5(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("root", "uri"); w.WriteStartAttribute("xmlns", "p", "http://www.w3.org/2000/xmlns/"); @@ -263,135 +261,143 @@ namespace System.Xml.Tests w.WriteEndElement(); } VerifyOutput(""); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString with null prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString with null prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_6() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_6(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement(null, "e", "ns"); w.WriteAttributeString(null, "attr", "ns", "val"); w.WriteElementString(null, "el", "ns", "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString with empty prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString with empty prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_7() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_7(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement(String.Empty, "e", "ns"); w.WriteAttributeString(String.Empty, "attr", "ns", "val"); w.WriteElementString(String.Empty, "el", "ns", "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString with not null prefix and namespace.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString with not null prefix and namespace.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_8() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_8(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("a", "e", "ns"); w.WriteAttributeString("a", "attr", "ns", "val"); w.WriteElementString("a", "el", "ns", "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString without prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString without prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_9() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_9(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("e", "ns"); w.WriteAttributeString("attr", "ns", "val"); w.WriteElementString("el", "ns", "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString with null namespace,prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString with null namespace,prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_10() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_10(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement(null, "e", null); w.WriteAttributeString(null, "attr", null, "val"); w.WriteElementString(null, "el", null, "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString with empty namespace,prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString with empty namespace,prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_11() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_11(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement(String.Empty, "e", String.Empty); w.WriteAttributeString(String.Empty, "attr", String.Empty, "val"); w.WriteElementString(String.Empty, "el", String.Empty, "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartElement,AttrString without namespace,prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartElement,AttrString without namespace,prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_12() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_12(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("e"); w.WriteAttributeString("attr", "val"); w.WriteElementString("el", "val"); } VerifyOutput("val"); - return TEST_PASS; + return; } - //[Variation(Desc = "LookupPrefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "LookupPrefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_16() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_16(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("a", "foo", "b"); CError.Compare(w.LookupPrefix("foo"), null, "FailedEl"); @@ -401,16 +407,17 @@ namespace System.Xml.Tests CError.Compare(w.LookupPrefix("foo"), "p1", "FailedEl"); } VerifyOutput("b"); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteAttributeString with dup.namespace,w/o prefix.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteAttributeString with dup.namespace,w/o prefix.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_17() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_17(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteDocType("a", null, null, ""); w.WriteStartElement("Root"); @@ -423,22 +430,22 @@ namespace System.Xml.Tests w.WriteAttributeString("a", "n" + 999, "val"); CError.Compare(false, "Failed"); } - catch (XmlException e) { CError.WriteLine(e); return TEST_PASS; } + catch (XmlException e) { CError.WriteLine(e); return; } } - return TEST_FAIL; + Assert.True(false); } - //[Variation(Desc = "WriteAttributeString with prefix bind to the same ns.Default", Params = new object[] { NamespaceHandling.Default, true })] - //[Variation(Desc = "WriteAttributeString with prefix bind to the same ns.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, true })] - //[Variation(Desc = "WriteElementString with prefix bind to the same ns.Default", Params = new object[] { NamespaceHandling.Default, false })] - //[Variation(Desc = "WriteElementString with prefix bind to the same ns.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, false })] - public int NS_Handling_17a() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, false)] + public void NS_Handling_17a(XmlWriterUtils utils, NamespaceHandling nsHandling, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - bool isAttr = (bool)this.CurVariation.Params[1]; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteDocType("a", null, null, ""); w.WriteStartElement("Root"); @@ -454,20 +461,20 @@ namespace System.Xml.Tests "]>" : "]>valvalvalvalvalvalvalvalvalval"; VerifyOutput(exp); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteAttributeString with prefix bind to default ns.Default", Params = new object[] { NamespaceHandling.Default, true })] - //[Variation(Desc = "WriteAttributeString with prefix bind to default ns.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, true })] - //[Variation(Desc = "WriteElementString with prefix bind to default ns.Default", Params = new object[] { NamespaceHandling.Default, false })] - //[Variation(Desc = "WriteElementString with prefix bind to default ns.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, false })] - public int NS_Handling_17b() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, false)] + public void NS_Handling_17b(XmlWriterUtils utils, NamespaceHandling nsHandling, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - bool isAttr = (bool)this.CurVariation.Params[1]; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("Root"); for (int i = 0; i < 5; i++) @@ -482,20 +489,20 @@ namespace System.Xml.Tests "" : "valvalvalvalval"; VerifyOutput(exp); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteAttributeString with prefix bind to non-default ns.dup.namespace.Default", Params = new object[] { NamespaceHandling.Default, true })] - //[Variation(Desc = "WriteAttributeString with prefix bind to non-default ns.dup.namespace.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, true })] - //[Variation(Desc = "WriteElementString with prefix bind to non-default ns.dup.namespace.Default", Params = new object[] { NamespaceHandling.Default, false })] - //[Variation(Desc = "WriteElementString with prefix bind to non-default ns.dup.namespace.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, false })] - public int NS_Handling_17c() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, false)] + public void NS_Handling_17c(XmlWriterUtils utils, NamespaceHandling nsHandling, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - bool isAttr = (bool)this.CurVariation.Params[1]; + wSettings.NamespaceHandling = nsHandling; - XmlWriter w = CreateMemWriter(wSettings); + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("Root"); for (int i = 0; i < 5; i++) { @@ -523,20 +530,20 @@ namespace System.Xml.Tests "val0val1val2val3val4val"; VerifyOutput(exp); } - return TEST_PASS; + return; } - //[Variation(Desc = "WriteAttributeString with prefix bind to ns uri.Default", Params = new object[] { NamespaceHandling.Default, true })] - //[Variation(Desc = "WriteAttributeString with prefix bind to ns uri.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, true })] - //[Variation(Desc = "WriteElementString with prefix bind to ns uri.Default", Params = new object[] { NamespaceHandling.Default, false })] - //[Variation(Desc = "WriteElementString with prefix bind to ns uri.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, false })] - public int NS_Handling_17d() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, false)] + public void NS_Handling_17d(XmlWriterUtils utils, NamespaceHandling nsHandling, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - bool isAttr = (bool)this.CurVariation.Params[1]; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("Root"); for (int i = 0; i < 5; i++) @@ -555,20 +562,21 @@ namespace System.Xml.Tests string exp = isAttr ? "" : "valvalvalvalval"; - VerifyOutput(exp); return TEST_PASS; + VerifyOutput(exp); + return; } - //[Variation(Desc = "WriteAttributeString with ns uri.Default", Params = new object[] { NamespaceHandling.Default, true })] - //[Variation(Desc = "WriteAttributeString with ns uri.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, true })] - //[Variation(Desc = "WriteElementString with ns uri.Default", Params = new object[] { NamespaceHandling.Default, false })] - //[Variation(Desc = "WriteElementString with ns uri.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, false })] - public int NS_Handling_17e() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, false)] + public void NS_Handling_17e(XmlWriterUtils utils, NamespaceHandling nsHandling, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - bool isAttr = (bool)this.CurVariation.Params[1]; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("Root"); for (int i = 0; i < 5; i++) @@ -582,16 +590,18 @@ namespace System.Xml.Tests string exp = isAttr ? "" : "valvalvalvalval"; - VerifyOutput(exp); return TEST_PASS; + VerifyOutput(exp); + return; } - //[Variation(Desc = "WriteAttribute/ElemString with prefixes.namespace.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteAttribute/ElemString with prefixes.namespace.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_18() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_18(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("test"); w.WriteAttributeString("p", "a1", "ns1", "v"); @@ -603,16 +613,18 @@ namespace System.Xml.Tests w.WriteEndElement(); } string exp = "v"; - VerifyOutput(exp); return TEST_PASS; + VerifyOutput(exp); + return; } - //[Variation(Desc = "WriteAttribute/ElemString with xmlns:xml,space,lang.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteAttribute/ElemString with xmlns:xml,space,lang.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_19() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_19(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("Root"); w.WriteAttributeString("xmlns", "xml", null, "http://www.w3.org/XML/1998/namespace"); @@ -623,34 +635,33 @@ namespace System.Xml.Tests w.WriteElementString("xml", "xml", null, "http://www.w3.org/XML/1998/namespace"); w.WriteEndElement(); } - string exp = ((NamespaceHandling)this.CurVariation.Param == NamespaceHandling.OmitDuplicates) ? + string exp = (nsHandling == NamespaceHandling.OmitDuplicates) ? "jpndefaulthttp://www.w3.org/XML/1998/namespace" : "jpndefaulthttp://www.w3.org/XML/1998/namespace"; - VerifyOutput(exp); return TEST_PASS; + VerifyOutput(exp); + return; } - //[Variation(Desc = "WriteAttributeString with null val,ns.attr=xmlns:xml.Default", Params = new object[] { NamespaceHandling.Default, "xmlns", "xml", true })] - //[Variation(Desc = "WriteAttributeString with null val,ns.attr=xmlns:xml.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "xmlns", "xml", true })] - //[Variation(Desc = "WriteAttributeString with null val,ns.elem=xmlns:xml.Default", Params = new object[] { NamespaceHandling.Default, "xmlns", "xml", false })] - //[Variation(Desc = "WriteAttributeString with null val,ns.elem=xmlns:xml.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "xmlns", "xml", false })] + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "xmlns", "xml", true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "xmlns", "xml", true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "xmlns", "xml", false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "xmlns", "xml", false)] - //[Variation(Desc = "WriteAttributeString with null val,ns.attr=xml:space.Default", Params = new object[] { NamespaceHandling.Default, "xml", "space", true })] - //[Variation(Desc = "WriteAttributeString with null val,ns.attr=xml:space.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "xml", "space", true })] - //[Variation(Desc = "WriteAttributeString with null val,ns.elem=xmlns:space.Default", Params = new object[] { NamespaceHandling.Default, "xmlns", "space", false })] - //[Variation(Desc = "WriteAttributeString with null val,ns.elem=xmlns:space.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "xmlns", "space", false })] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "xml", "space", true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "xml", "space", true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "xmlns", "space", false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "xmlns", "space", false)] - //[Variation(Desc = "WriteAttributeString with null val,ns.attr=xmlns:lang.Default", Params = new object[] { NamespaceHandling.Default, "xmlns", "lang", true })] - //[Variation(Desc = "WriteAttributeString with null val,ns.attr=xmlns:lang.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "xmlns", "lang", true })] - //[Variation(Desc = "WriteAttributeString with null val,ns.elem=xmlns:lang.Default", Params = new object[] { NamespaceHandling.Default, "xmlns", "lang", false })] - //[Variation(Desc = "WriteAttributeString with null val,ns.elem=xmlns:lang.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, "xmlns", "lang", false })] - public int NS_Handling_19a() + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "xmlns", "lang", true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "xmlns", "lang", true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, "xmlns", "lang", false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, "xmlns", "lang", false)] + public void NS_Handling_19a(XmlWriterUtils utils, NamespaceHandling nsHandling, string prefix, string name, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - string prefix = (string)this.CurVariation.Params[1]; - string name = (string)this.CurVariation.Params[2]; - bool isAttr = (bool)this.CurVariation.Params[3]; - XmlWriter w = CreateMemWriter(wSettings); + wSettings.NamespaceHandling = nsHandling; + XmlWriter w = CreateMemWriter(utils, wSettings); w.WriteStartElement("Root"); try { @@ -666,20 +677,20 @@ namespace System.Xml.Tests w.Dispose(); CError.Compare(w.WriteState, WriteState.Closed, "state"); } - return TEST_PASS; + return; } - //[Variation(Desc = "WriteAttributeString in error state.Default", Params = new object[] { NamespaceHandling.Default, true })] - //[Variation(Desc = "WriteAttributeString in error state.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, true })] - //[Variation(Desc = "WriteElementString in error state.Default", Params = new object[] { NamespaceHandling.Default, false })] - //[Variation(Desc = "WriteElementString in error state.OmitDuplicates", Params = new object[] { NamespaceHandling.OmitDuplicates, false })] - public int NS_Handling_19b() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, true)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default, false)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates, false)] + public void NS_Handling_19b(XmlWriterUtils utils, NamespaceHandling nsHandling, bool isAttr) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; - bool isAttr = (bool)this.CurVariation.Params[1]; + wSettings.NamespaceHandling = nsHandling; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("Root"); try @@ -692,16 +703,18 @@ namespace System.Xml.Tests catch (ArgumentException e) { CError.WriteLine(e.Message); } } string exp = isAttr ? ""); - return TEST_PASS; + return; } - //[Variation(Desc = "WriteStartAttribute(xml:lang),WriteRaw(0,0).Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartAttribute(xml:lang),WriteRaw(0,0).OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_21() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_21(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; string strraw = "abc"; char[] buffer = strraw.ToCharArray(); - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("root"); w.WriteStartAttribute("xml", "lang", null); @@ -734,18 +748,20 @@ namespace System.Xml.Tests w.WriteRaw(buffer, 0, 2); w.WriteEndElement(); } - VerifyOutput(""); return TEST_PASS; + VerifyOutput(""); + return; } - //[Variation(Desc = "WriteStartAttribute(xml:lang),WriteBinHex(0,0).Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartAttribute(xml:lang),WriteBinHex(0,0).OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_22() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_22(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; byte[] buffer = new byte[] { (byte)'a', (byte)'b', (byte)'c' }; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("root"); w.WriteStartAttribute("xml", "lang", null); @@ -754,18 +770,20 @@ namespace System.Xml.Tests w.WriteBinHex(buffer, 0, 2); w.WriteEndElement(); } - VerifyOutput(""); return TEST_PASS; + VerifyOutput(""); + return; } - //[Variation(Desc = "WriteStartAttribute(xml:lang),WriteBase64(0,0).Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "WriteStartAttribute(xml:lang),WriteBase64(0,0).OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_23() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_23(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; + wSettings.NamespaceHandling = nsHandling; byte[] buffer = new byte[] { (byte)'a', (byte)'b', (byte)'c' }; - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("root"); w.WriteStartAttribute("a", "b", null); @@ -774,16 +792,18 @@ namespace System.Xml.Tests w.WriteBase64(buffer, 0, 2); w.WriteEndElement(); } - VerifyOutput(""); return TEST_PASS; + VerifyOutput(""); + return; } - //[Variation(Desc = "Duplicate attribute conflict when the namespace decl. is being omitted.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "Duplicate attribute conflict when the namespace decl. is being omitted.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_24() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_24(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - XmlWriter w = CreateMemWriter(wSettings); + wSettings.NamespaceHandling = nsHandling; + XmlWriter w = CreateMemWriter(utils, wSettings); byte[] buffer = new byte[] { (byte)'a', (byte)'b', (byte)'c' }; w.WriteStartElement("A"); @@ -799,14 +819,15 @@ namespace System.Xml.Tests finally { w.Dispose(); - VerifyOutput((NamespaceHandling)this.CurVariation.Param == NamespaceHandling.OmitDuplicates ? "" + "Bob Worker

Nassau Street" + @@ -814,42 +835,46 @@ namespace System.Xml.Tests ""; XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; + wSettings.NamespaceHandling = nsHandling; using (XmlReader r = ReaderHelper.Create(new StringReader(xml))) { - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteNode(r, false); } } - VerifyOutput(xml); return TEST_PASS; + VerifyOutput(xml); + return; } - //[Variation(Desc = "2.Default Namespace redefinition.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "2.Default Namespace redefinition.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_25a() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_25a(XmlWriterUtils utils, NamespaceHandling nsHandling) { string xml = ""; XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; + wSettings.NamespaceHandling = nsHandling; using (XmlReader r = ReaderHelper.Create(new StringReader(xml))) { - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteNode(r, false); } } - VerifyOutput(xml); return TEST_PASS; + VerifyOutput(xml); + return; } - //[Variation(Desc = "Namespaces with the same prefix different NS value.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "Namespaces with the same prefix different NS value.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_26() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_26(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("p", "e", "uri1"); w.WriteAttributeString("p", "e", "uri1", "val"); @@ -858,16 +883,17 @@ namespace System.Xml.Tests w.WriteElementString("p", "e", "uri2", "val"); } VerifyOutput("valval"); - return TEST_PASS; + return; } - //[Variation(Desc = "Namespaces with the same NS value but different prefixes.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "Namespaces with the same NS value but different prefixes.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_27() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_27(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("p1", "e", "uri"); w.WriteAttributeString("p1", "e", "uri", "val"); @@ -876,12 +902,13 @@ namespace System.Xml.Tests w.WriteElementString("p2", "e", "uri", "val"); } VerifyOutput("valval"); - return TEST_PASS; + return; } - //[Variation(Desc = "Reader got the namespaces as a fixed value from DTD.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "Reader got the namespaces as a fixed value from DTD.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_29() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_29(XmlWriterUtils utils, NamespaceHandling nsHandling) { string xml = " " + " " + @@ -890,21 +917,24 @@ namespace System.Xml.Tests " & "; XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; + wSettings.NamespaceHandling = nsHandling; XmlReaderSettings rs = new XmlReaderSettings(); + rs.DtdProcessing = DtdProcessing.Parse; using (XmlReader r = ReaderHelper.Create(new StringReader(xml), rs)) { - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteNode(r, false); } } - VerifyOutput(xml); return TEST_PASS; + VerifyOutput(xml); + return; } - //[Variation(Desc = "Reader got the namespaces as default attribute from DTD.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "Reader got the namespaces as default attribute from DTD.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_30() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_30(XmlWriterUtils utils, NamespaceHandling nsHandling) { string xml = "" + @@ -922,26 +952,29 @@ namespace System.Xml.Tests " BB&e1;BB" + " World" + ""; - string exp = ((NamespaceHandling)this.CurVariation.Param == NamespaceHandling.OmitDuplicates) ? + string exp = (nsHandling == NamespaceHandling.OmitDuplicates) ? "]> xmlns:p='x' AAxmlns:p='x'AA BBxmlns:p='x'BB World" : "]> xmlns:p='x' AAxmlns:p='x'AA BBxmlns:p='x'BB World"; XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; + wSettings.NamespaceHandling = nsHandling; XmlReaderSettings rs = new XmlReaderSettings(); + rs.DtdProcessing = DtdProcessing.Parse; using (XmlReader r = ReaderHelper.Create(new StringReader(xml), rs)) { - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteNode(r, false); } } - VerifyOutput(exp); return TEST_PASS; + VerifyOutput(exp); + return; } - //[Variation(Desc = "Reader got the default namespaces as default attribute from DTD.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "Reader got the default namespaces as default attribute from DTD.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_30a() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_30a(XmlWriterUtils utils, NamespaceHandling nsHandling) { string xml = "" + @@ -959,30 +992,33 @@ namespace System.Xml.Tests " BB&e1;BB" + " World" + ""; - string exp = ((NamespaceHandling)this.CurVariation.Param == NamespaceHandling.OmitDuplicates) ? + string exp = (nsHandling == NamespaceHandling.OmitDuplicates) ? "]> xmlns='x' AAxmlns='x'AA BBxmlns='x'BB World" : "]> xmlns='x' AAxmlns='x'AA BBxmlns='x'BB World"; XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Params[0]; + wSettings.NamespaceHandling = nsHandling; XmlReaderSettings rs = new XmlReaderSettings(); + rs.DtdProcessing = DtdProcessing.Parse; using (XmlReader r = ReaderHelper.Create(new StringReader(xml), rs)) { - using (XmlWriter w = CreateMemWriter(wSettings)) + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteNode(r, false); } } - VerifyOutput(exp); return TEST_PASS; + VerifyOutput(exp); + return; } - //[Variation(Desc = "XmlTextWriter : Wrong prefix management if the same prefix is used at inner level.Default", Param = NamespaceHandling.Default)] - //[Variation(Desc = "XmlTextWriter : Wrong prefix management if the same prefix is used at inner level.OmitDuplicates", Param = NamespaceHandling.OmitDuplicates)] - public int NS_Handling_31() + [Theory] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.Default)] + [XmlWriterInlineData(~WriterType.Async & WriterType.AllButCustom & WriterType.AllButIndenting, NamespaceHandling.OmitDuplicates)] + public void NS_Handling_31(XmlWriterUtils utils, NamespaceHandling nsHandling) { XmlWriterSettings wSettings = new XmlWriterSettings(); - wSettings.NamespaceHandling = (NamespaceHandling)this.CurVariation.Param; - using (XmlWriter w = CreateMemWriter(wSettings)) + wSettings.NamespaceHandling = nsHandling; + using (XmlWriter w = CreateMemWriter(utils, wSettings)) { w.WriteStartElement("test"); w.WriteAttributeString("p", "a1", "ns1", "v"); @@ -993,7 +1029,7 @@ namespace System.Xml.Tests w.WriteEndElement(); } VerifyOutput(""); - return TEST_PASS; + return; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ReaderParamTestCase.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ReaderParamTestCase.cs index 69c03aaa9b..4ffdc6dd78 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ReaderParamTestCase.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/ReaderParamTestCase.cs @@ -13,29 +13,9 @@ namespace System.Xml.Tests CoreReader } - public partial class ReaderParamTestCase : XmlWriterTestCaseBase + public partial class ReaderParamTestCase { - protected ReaderType readerType; - - public override int Init(object o) - { - int i = base.Init(0); - - if (this.Param != null) - { - switch (this.Param.ToString().ToUpperInvariant()) - { - case "COREREADER": - readerType = ReaderType.CoreReader; - break; - default: - CError.Compare(false, "Unknown reader type: " + readerType); - break; - } - } - - return i; - } + internal const ReaderType readerType = ReaderType.CoreReader; public bool IsXPathDataModelReader() { @@ -47,14 +27,6 @@ namespace System.Xml.Tests return true; } - public bool ReaderSupportsEntityRef() - { - if (readerType == ReaderType.CoreReader) - return false; - else - return true; - } - public bool ReaderStripsWhitespace() { return false; @@ -75,21 +47,38 @@ namespace System.Xml.Tests fileName = Path.GetFileNameWithoutExtension(fileName); StreamReader sr = null; - sr = new StreamReader(FilePathUtil.getStream(FullPath(fileName + ".xml"))); + sr = new StreamReader(FilePathUtil.getStream(XmlWriterUtils.FullPath(fileName + ".xml"))); return CreateReader(sr); } public XmlReader CreateReaderIgnoreWS(string fileName) { StreamReader sr = null; - sr = new StreamReader(FilePathUtil.getStream(FullPath(fileName))); + sr = new StreamReader(FilePathUtil.getStream(XmlWriterUtils.FullPath(fileName))); return CreateReaderIgnoreWS(sr); } + public XmlReader CreateReaderIgnoreWSFromString(string xml) + { + StringReader sr = null; + sr = new StringReader(xml); + return CreateReaderIgnoreWS(sr); + } + +#pragma warning disable CS0162 // Unreachable code + public bool ReaderSupportsEntityRef() + { + if (readerType == ReaderType.CoreReader) + return false; + else + return true; + } + public XmlReader CreateReader(TextReader sr) { XmlReader xr = null; XmlReaderSettings readerSettings = new XmlReaderSettings(); + readerSettings.DtdProcessing = DtdProcessing.Parse; readerSettings.CloseInput = true; switch (readerType) @@ -108,6 +97,7 @@ namespace System.Xml.Tests { XmlReader xr = null; XmlReaderSettings readerSettings = new XmlReaderSettings(); + readerSettings.DtdProcessing = DtdProcessing.Parse; readerSettings.CloseInput = true; readerSettings.IgnoreWhitespace = true; @@ -122,5 +112,6 @@ namespace System.Xml.Tests } return xr; } +#pragma warning restore CS0162 } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/System.Xml.RW.XmlWriterApi.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/System.Xml.RW.XmlWriterApi.Tests.csproj index 7392dc88d5..c41513faeb 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/System.Xml.RW.XmlWriterApi.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/System.Xml.RW.XmlWriterApi.Tests.csproj @@ -10,44 +10,42 @@ - + + + - + - + - - - + - + - + - - diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAttribute.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAttribute.cs index bfd145aedd..2c935d51ef 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAttribute.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAttribute.cs @@ -1,189 +1,523 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCAttribute : XmlWriterTestCaseBase + public class TCAttribute { - // Type is System.Xml.Tests.TCAttribute - // Test Case - public override void AddChildren() + // Sanity test for WriteAttribute + [Theory] + [XmlWriterInlineData] + public void attribute_1(XmlWriterUtils utils) { - // for function attribute_1 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_1) { Attribute = new Variation("Sanity test for WriteAttribute") { id = 1, Pri = 0 } }); + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr1"); + w.WriteEndAttribute(); + w.WriteAttributeString("attr2", "val2"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Missing EndAttribute should be fixed + [Theory] + [XmlWriterInlineData] + public void attribute_2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr1"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // WriteStartAttribute followed by WriteStartAttribute + [Theory] + [XmlWriterInlineData] + public void attribute_3(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr1"); + w.WriteStartAttribute("attr2"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Multiple WritetAttributeString + [Theory] + [XmlWriterInlineData] + public void attribute_4(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributeString("attr1", "val1"); + w.WriteAttributeString("attr2", "val2"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // WriteStartAttribute followed by WriteString + [Theory] + [XmlWriterInlineData] + public void attribute_5(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr1"); + w.WriteString("test"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Sanity test for overload WriteStartAttribute(name, ns) + [Theory] + [XmlWriterInlineData] + public void attribute_6(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr1", "http://my.com"); + w.WriteEndAttribute(); + w.WriteEndElement(); + } + Assert.True(utils.CompareString("")); + } + + // Sanity test for overload WriteStartAttribute(prefix, name, ns) + [Theory] + [XmlWriterInlineData] + public void attribute_7(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("pre1", "attr1", "http://my.com"); + w.WriteEndAttribute(); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // DCR 64183: Duplicate attribute 'attr1' + [Theory] + [XmlWriterInlineData] + public void attribute_8(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr1"); + w.WriteStartAttribute("attr1"); + } + catch (XmlException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // Duplicate attribute 'ns1:attr1' + [Theory] + [XmlWriterInlineData] + public void attribute_9(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("ns1", "attr1", "http://my.com"); + w.WriteStartAttribute("ns1", "attr1", "http://my.com"); + } + catch (XmlException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // Attribute name = String.Empty should error + [Theory] + [XmlWriterInlineData] + public void attribute_10(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement("Root"); + w.WriteStartAttribute(String.Empty); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, (utils.WriterType == WriterType.CharCheckingWriter) ? WriteState.Element : WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // Attribute name = null + [Theory] + [XmlWriterInlineData] + public void attribute_11(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement("Root"); + w.WriteStartAttribute(null); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, (utils.WriterType == WriterType.CharCheckingWriter) ? WriteState.Element : WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // WriteAttribute with names Foo, fOo, foO, FOO + [Theory] + [XmlWriterInlineData] + public void attribute_12(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + string[] attrNames = { "Foo", "fOo", "foO", "FOO" }; + w.WriteStartElement("Root"); + for (int i = 0; i < attrNames.Length; i++) + { + w.WriteAttributeString(attrNames[i], "x"); + } + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Invalid value of xml:space + [Theory] + [XmlWriterInlineData] + public void attribute_13(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement("Root"); + w.WriteAttributeString("xml", "space", "http://www.w3.org/XML/1998/namespace", "invalid"); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // SingleQuote in attribute value should be allowed + [Theory] + [XmlWriterInlineData] + public void attribute_14(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributeString("a", null, "b'c"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // DoubleQuote in attribute value should be escaped + [Theory] + [XmlWriterInlineData] + public void attribute_15(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributeString("a", null, "b\"c"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // WriteAttribute with value = &, #65, #x20 + [Theory] + [XmlWriterInlineData] + public void attribute_16(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributeString("a", "&"); + w.WriteAttributeString("b", "A"); + w.WriteAttributeString("c", "C"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // WriteAttributeString followed by WriteString + [Theory] + [XmlWriterInlineData] + public void attribute_17(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributeString("a", null, "b"); + w.WriteString("test"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("test")); + } + + // WriteAttribute followed by WriteString + [Theory] + [XmlWriterInlineData] + public void attribute_18(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("a"); + w.WriteString("test"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // WriteAttribute with all whitespace characters + [Theory] + [XmlWriterInlineData] + public void attribute_19(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributeString("a", null, "\x20\x9\xD\xA"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - // for function attribute_2 + // < > & chars should be escaped in attribute value + [Theory] + [XmlWriterInlineData] + public void attribute_20(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_2) { Attribute = new Variation("Missing EndAttribute should be fixed") { id = 2, Pri = 0 } }); + w.WriteStartElement("Root"); + w.WriteAttributeString("a", null, "< > &"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - - // for function attribute_3 + // Redefine auto generated prefix n1 + [Theory] + [XmlWriterInlineData] + public void attribute_21(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_3) { Attribute = new Variation("WriteStartAttribute followed by WriteStartAttribute") { id = 3, Pri = 0 } }); + w.WriteStartElement("test"); + w.WriteAttributeString("xmlns", "n1", null, "http://testbasens"); + w.WriteStartElement("base"); + w.WriteAttributeString("id", "http://testbasens", "5"); + w.WriteAttributeString("lang", "http://common", "en"); + w.WriteEndElement(); + w.WriteEndElement(); } + string exp = utils.IsIndent() ? + "" + Environment.NewLine + " " + Environment.NewLine + "" : + ""; + Assert.True(utils.CompareString(exp)); + } + // Reuse and redefine existing prefix + [Theory] + [XmlWriterInlineData] + public void attribute_22(XmlWriterUtils utils) + { + string exp = ""; - // for function attribute_4 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_4) { Attribute = new Variation("Multiple WritetAttributeString") { id = 4, Pri = 0 } }); + w.WriteStartElement("test"); + w.WriteAttributeString("p", "a1", "ns1", "v"); + w.WriteStartElement("base"); + w.WriteAttributeString("a2", "ns1", "v"); + w.WriteAttributeString("p", "a3", "ns2", "v"); + w.WriteEndElement(); + w.WriteEndElement(); } + exp = utils.IsIndent() ? + "" + Environment.NewLine + " " + Environment.NewLine + "" : exp; + Assert.True(utils.CompareString(exp)); + } - - // for function attribute_5 + // WriteStartAttribute(attr) sanity test + [Theory] + [XmlWriterInlineData] + public void attribute_23(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_5) { Attribute = new Variation("WriteStartAttribute followed by WriteString") { id = 5, Pri = 0 } }); + w.WriteStartElement("test"); + w.WriteStartAttribute("attr"); + w.WriteEndAttribute(); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - - // for function attribute_6 + // WriteStartAttribute(attr) inside an element with changed default namespace + [Theory] + [XmlWriterInlineData] + public void attribute_24(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_6) { Attribute = new Variation("Sanity test for overload WriteStartAttribute(name, ns)") { id = 6, Pri = 1 } }); + w.WriteStartElement(string.Empty, "test", "ns"); + w.WriteStartAttribute("attr"); + w.WriteEndAttribute(); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - - // for function attribute_7 + // WriteStartAttribute(attr) and duplicate attrs + [Theory] + [XmlWriterInlineData] + public void attribute_25(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_7) { Attribute = new Variation("Sanity test for overload WriteStartAttribute(prefix, name, ns)") { id = 7, Pri = 0 } }); + try + { + w.WriteStartElement("test"); + w.WriteStartAttribute(null, "attr", null); + w.WriteStartAttribute("attr"); + } + catch (XmlException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + return; + } } + CError.WriteLine("Did not throw error for duplicate attrs"); + Assert.True(false); + } - - // for function attribute_8 + // WriteStartAttribute(attr) when element has ns:attr + [Theory] + [XmlWriterInlineData] + public void attribute_26(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_8) { Attribute = new Variation("DCR 64183: Duplicate attribute 'attr1'") { id = 8, Pri = 1 } }); + w.WriteStartElement("pre", "test", "ns"); + w.WriteStartAttribute(null, "attr", "ns"); + w.WriteStartAttribute("attr"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } + // XmlCharCheckingWriter should not normalize newLines in attribute values when NewLinesHandling = Replace + [Theory] + [XmlWriterInlineData] + public void attribute_27(XmlWriterUtils utils) + { + XmlWriterSettings s = new XmlWriterSettings(); + s.NewLineHandling = NewLineHandling.Replace; - // for function attribute_9 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_9) { Attribute = new Variation("DCR 64183: Duplicate attribute 'ns1:attr1'") { id = 9, Pri = 1 } }); + w.WriteStartElement("root"); + w.WriteAttributeString("a", "|\x0D|\x0A|\x0D\x0A|"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } + // Wrapped XmlTextWriter: Invalid replacement of newline characters in text values + [Theory] + [XmlWriterInlineData] + public void attribute_28(XmlWriterUtils utils) + { + XmlWriterSettings s = new XmlWriterSettings(); + s.NewLineHandling = NewLineHandling.Replace; - // for function attribute_10 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_10) { Attribute = new Variation("Attribute name = String.Empty should error") { id = 10, Pri = 1 } }); + w.WriteStartElement("root"); + w.WriteAttributeString("a", "|\x0D\x0A|"); + w.WriteElementString("foo", "|\x0D\x0A|"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("|\x0D\x0A|")); + } - - // for function attribute_11 + // WriteAttributeString doesn't fail on invalid surrogate pair sequences + [Theory] + [XmlWriterInlineData] + public void attribute_29(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(attribute_11) { Attribute = new Variation("Attribute name = null") { id = 11, Pri = 1 } }); - } - - - // for function attribute_12 - { - this.AddChild(new CVariation(attribute_12) { Attribute = new Variation("DCR 64183: WriteAttribute with names Foo, fOo, foO, FOO") { id = 12, Pri = 1 } }); - } - - - // for function attribute_13 - { - this.AddChild(new CVariation(attribute_13) { Attribute = new Variation("Invalid value of xml:space") { id = 13, Pri = 1 } }); - } - - - // for function attribute_14 - { - this.AddChild(new CVariation(attribute_14) { Attribute = new Variation("SingleQuote in attribute value should be allowed") { id = 14 } }); - } - - - // for function attribute_15 - { - this.AddChild(new CVariation(attribute_15) { Attribute = new Variation("DoubleQuote in attribute value should be escaped") { id = 15 } }); - } - - - // for function attribute_16 - { - this.AddChild(new CVariation(attribute_16) { Attribute = new Variation("WriteAttribute with value = &, #65, #x20") { id = 16, Pri = 1 } }); - } - - - // for function attribute_17 - { - this.AddChild(new CVariation(attribute_17) { Attribute = new Variation("WriteAttributeString followed by WriteString") { id = 17, Pri = 1 } }); - } - - - // for function attribute_18 - { - this.AddChild(new CVariation(attribute_18) { Attribute = new Variation("WriteAttribute followed by WriteString") { id = 18, Pri = 1 } }); - } - - - // for function attribute_19 - { - this.AddChild(new CVariation(attribute_19) { Attribute = new Variation("WriteAttribute with all whitespace characters") { id = 19, Pri = 1 } }); - } - - - // for function attribute_20 - { - this.AddChild(new CVariation(attribute_20) { Attribute = new Variation("< > & chars should be escaped in attribute value") { id = 20, Pri = 1 } }); - } - - - // for function attribute_21 - { - this.AddChild(new CVariation(attribute_21) { Attribute = new Variation("Bug 73919 testcase: Redefine auto generated prefix n1") { id = 21 } }); - } - - - // for function attribute_22 - { - this.AddChild(new CVariation(attribute_22) { Attribute = new Variation("Bug 74758 testcase: Reuse and redefine existing prefix") { id = 22 } }); - } - - - // for function attribute_23 - { - this.AddChild(new CVariation(attribute_23) { Attribute = new Variation("DCR 100451: WriteStartAttribute(attr) sanity test") { id = 23 } }); - } - - - // for function attribute_24 - { - this.AddChild(new CVariation(attribute_24) { Attribute = new Variation("DCR 100451: WriteStartAttribute(attr) inside an element with changed default namespace") { id = 24 } }); - } - - - // for function attribute_25 - { - this.AddChild(new CVariation(attribute_25) { Attribute = new Variation("DCR 100451: WriteStartAttribute(attr) and duplicate attrs") { id = 25 } }); - } - - - // for function attribute_26 - { - this.AddChild(new CVariation(attribute_26) { Attribute = new Variation("DCR 100451: WriteStartAttribute(attr) when element has ns:attr") { id = 26 } }); - } - - - // for function attribute_27 - { - this.AddChild(new CVariation(attribute_27) { Attribute = new Variation("BUG 397795: XmlCharCheckingWriter should not normalize newLines in attribute values when NewLinesHandling = Replace") { id = 27 } }); - } - - - // for function attribute_28 - { - this.AddChild(new CVariation(attribute_28) { Attribute = new Variation("BUG 396978: Wrapped XmlTextWriter: Invalid replacement of newline characters in text values") { id = 28 } }); - } - - - // for function attribute_29 - { - this.AddChild(new CVariation(attribute_29) { Attribute = new Variation("442897: WriteAttributeString doesn't fail on invalid surrogate pair sequences") { id = 29 } }); + w.WriteStartElement("root"); + try + { + w.WriteAttributeString("attribute", "\ud800\ud800"); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore(e.ToString()); + return; + } } + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoCL.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoCL.cs index e4d1bcd85a..4f69988df2 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoCL.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoCL.cs @@ -1,81 +1,262 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.IO; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCAutoCL : XmlFactoryWriterTestCaseBase + public class TCAutoCL { - // Type is System.Xml.Tests.TCAutoCL - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void auto_1(XmlWriterUtils utils) { - if (WriterType == WriterType.CustomWriter) + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Auto, "Error"); + w.WriteStartDocument(); + + // PROLOG + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Error"); + w.WriteStartElement("root"); + w.WriteEndElement(); + + // Try writing another root element, should error + try + { + w.WriteStartElement("root"); + } + catch (InvalidOperationException) { return; } - // for function auto_1 + finally { - this.AddChild(new CVariation(auto_1) { Attribute = new Variation("Change to CL Document after WriteStartDocument()") { id = 1, Pri = 0 } }); + w.Dispose(); } + CError.WriteLine("Conformance level = Document did not take effect"); + Assert.True(false); + } + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom, true)] + [XmlWriterInlineData(WriterType.AllButCustom, false)] + public void auto_2(XmlWriterUtils utils, bool writeStartDocument) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Auto, "Error"); + w.WriteStartDocument(writeStartDocument); - // for function auto_2 + // PROLOG + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Error"); + w.WriteStartElement("root"); + // ELEMENT CONTENT + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Error"); + // Inside Attribute + w.WriteStartAttribute("attr"); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Error"); + w.WriteEndElement(); + + // Try writing another root element, should error + try { - this.AddChild(new CVariation(auto_2) { Attribute = new Variation("Change to CL Document after WriteStartDocument(standalone = true)") { Param = "true", id = 2, Pri = 0 } }); - this.AddChild(new CVariation(auto_2) { Attribute = new Variation("Change to CL Document after WriteStartDocument(standalone = false)") { Param = "false", id = 3, Pri = 0 } }); + w.WriteStartElement("root"); } - - - // for function auto_3 + catch (InvalidOperationException) { - this.AddChild(new CVariation(auto_3) { Attribute = new Variation("Change to CL Document when you write DocType decl") { id = 4, Pri = 0 } }); + return; } - - - // for function auto_4 + finally { - this.AddChild(new CVariation(auto_4) { Attribute = new Variation("Change to CL Fragment when you write a root element") { id = 5, Pri = 1 } }); + w.Dispose(); } + CError.WriteLine("Conformance level = Document did not take effect"); + Assert.True(false); + } + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void auto_3(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + w.WriteDocType("ROOT", "publicid", "sysid", ""); + // PROLOG + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Should switch to Document from Auto when you write top level DTD"); + w.WriteStartElement("Root"); + w.WriteEndElement(); - // for function auto_5 + // Try writing text at root level, should error + try { - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteChars at top level") { Param = "Chars", id = 11, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteRaw at top level") { Param = "Raw", id = 12, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteString at top level") { Param = "String", id = 6, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteCData at top level") { Param = "CData", id = 7, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteEntityRef at top level") { Param = "EntityRef", id = 8, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteCharEntity at top level") { Param = "CharEntity", id = 9, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteSurrogateCharEntity at top level") { Param = "SurrogateCharEntity", id = 10, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteBase64 at top level") { Param = "Base64", id = 13, Pri = 1 } }); - this.AddChild(new CVariation(auto_5) { Attribute = new Variation("Change to CL Fragment for WriteBinHex at top level") { Param = "BinHex", id = 14, Pri = 1 } }); + w.WriteString("text"); } - - - // for function auto_6 + catch (InvalidOperationException) { - this.AddChild(new CVariation(auto_6) { Attribute = new Variation("WriteWhitespace at top level, followed by DTD, expected CL = Document") { Param = "WS", id = 17, Pri = 2 } }); - this.AddChild(new CVariation(auto_6) { Attribute = new Variation("WritePI at top level, followed by DTD, expected CL = Document") { Param = "PI", id = 15, Pri = 2 } }); - this.AddChild(new CVariation(auto_6) { Attribute = new Variation("WriteComment at top level, followed by DTD, expected CL = Document") { Param = "Comment", id = 16, Pri = 2 } }); + return; } - - - // for function auto_7 + finally { - this.AddChild(new CVariation(auto_7) { Attribute = new Variation("WriteWhitespace at top level, followed by text, expected CL = Fragment") { Param = "WS", id = 20, Pri = 2 } }); - this.AddChild(new CVariation(auto_7) { Attribute = new Variation("WritePI at top level, followed by text, expected CL = Fragment") { Param = "PI", id = 18, Pri = 2 } }); - this.AddChild(new CVariation(auto_7) { Attribute = new Variation("WriteComment at top level, followed by text, expected CL = Fragment") { Param = "Comment", id = 19, Pri = 2 } }); + w.Dispose(); } + CError.WriteLine("Conformance level = Document did not take effect"); + Assert.True(false); + } + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void auto_4(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + w.WriteStartElement("root"); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Fragment, "Error"); + w.WriteEndElement(); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Fragment, "Error"); + w.WriteStartElement("root"); + w.WriteEndElement(); + w.Dispose(); + return; + } - // for function auto_10 + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom, "String")] + [XmlWriterInlineData(WriterType.AllButCustom, "CData")] + [XmlWriterInlineData(WriterType.AllButCustom, "EntityRef")] + [XmlWriterInlineData(WriterType.AllButCustom, "CharEntity")] + [XmlWriterInlineData(WriterType.AllButCustom, "SurrogateCharEntity")] + [XmlWriterInlineData(WriterType.AllButCustom, "Chars")] + [XmlWriterInlineData(WriterType.AllButCustom, "Raw")] + [XmlWriterInlineData(WriterType.AllButCustom, "Base64")] + [XmlWriterInlineData(WriterType.AllButCustom, "BinHex")] + public void auto_5(XmlWriterUtils utils, string tokenType) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + byte[] buffer = new byte[10]; + + switch (tokenType) { - this.AddChild(new CVariation(auto_10) { Attribute = new Variation("WriteNode(XmlReader) when reader positioned on text node, expected CL = Fragment") { id = 22, Pri = 2 } }); + case "String": + w.WriteString("text"); + break; + case "CData": + w.WriteCData("cdata text"); + break; + case "EntityRef": + w.WriteEntityRef("ent"); + break; + case "CharEntity": + w.WriteCharEntity('\uD23E'); + break; + case "SurrogateCharEntity": + w.WriteSurrogateCharEntity('\uDF41', '\uD920'); + break; + case "Chars": + string s = "test"; + char[] buf = s.ToCharArray(); + w.WriteChars(buf, 0, 1); + break; + case "Raw": + w.WriteRaw(""); + break; + case "BinHex": + w.WriteBinHex(buffer, 0, 1); + break; + case "Base64": + w.WriteBase64(buffer, 0, 1); + break; + default: + CError.Compare(false, "Invalid param in testcase"); + break; } + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Fragment, "Error"); + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom, "PI")] + [XmlWriterInlineData(WriterType.AllButCustom, "Comment")] + [XmlWriterInlineData(WriterType.AllButCustom, "WS")] + public void auto_6(XmlWriterUtils utils, string tokenType) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + switch (tokenType) + { + case "PI": + w.WriteProcessingInstruction("pi", "text"); + break; + case "Comment": + w.WriteComment("text"); + break; + case "WS": + w.WriteWhitespace(" "); + break; + default: + CError.Compare(false, "Invalid param in testcase"); + break; + } + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Auto, "Error"); + w.WriteDocType("ROOT", "publicid", "sysid", ""); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Error"); + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void auto_7(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + w.WriteProcessingInstruction("pi", "text"); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Auto, "Error"); + w.WriteString("text"); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Fragment, "Error"); + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void auto_8(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + + string strxml = "]>"; + XmlReaderSettings rSettings = new XmlReaderSettings(); + rSettings.CloseInput = true; + rSettings.DtdProcessing = DtdProcessing.Parse; + XmlReader xr = ReaderHelper.Create(new StringReader(strxml), rSettings, (string)null); + + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Auto, "Error"); + xr.Read(); + CError.Compare(xr.NodeType.ToString(), "DocumentType", "Error"); + w.WriteNode(xr, false); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Error"); + w.Dispose(); + xr.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void auto_10(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + + string strxml = "text"; + XmlReader xr = ReaderHelper.Create(new StringReader(strxml)); + + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Auto, "Error"); + xr.Read(); xr.Read(); + CError.Compare(xr.NodeType.ToString(), "Text", "Error"); + w.WriteNode(xr, false); + CError.Compare(w.Settings.ConformanceLevel, ConformanceLevel.Fragment, "Error"); + w.Dispose(); + xr.Dispose(); + return; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoComplete.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoComplete.cs index e225646e11..dab6b85236 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoComplete.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCAutoComplete.cs @@ -1,51 +1,135 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using Xunit; namespace System.Xml.Tests { - public partial class TCAutoComplete : XmlWriterTestCaseBase + ////[TestCase(Name = "Auto-completion of tokens")] + public class TCAutoComplete { - // Type is System.Xml.Tests.TCAutoComplete - // Test Case - public override void AddChildren() + // Missing EndAttr, followed by element + [Theory] + [XmlWriterInlineData] + public void var_1(XmlWriterUtils utils) { - // for function var_1 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(var_1) { Attribute = new Variation("Missing EndAttr, followed by element") { id = 1, Pri = 1 } }); + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - - // for function var_2 + // Missing EndAttr, followed by comment + [Theory] + [XmlWriterInlineData] + public void var_2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(var_2) { Attribute = new Variation("Missing EndAttr, followed by comment") { id = 2, Pri = 1 } }); + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr"); + w.WriteComment("This text is a comment"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - - // for function var_3 + // Write EndDocument with unclosed element tag + [Theory] + [XmlWriterInlineData] + public void var_3(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(var_3) { Attribute = new Variation("Write EndDocument with unclosed element tag") { id = 3, Pri = 1 } }); + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndDocument(); } + Assert.True(utils.CompareReader("")); + } - - // for function var_4 + // WriteStartDocument - WriteEndDocument + [Theory] + [XmlWriterInlineData] + public void var_4(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(var_4) { Attribute = new Variation("WriteStartDocument - WriteEndDocument") { id = 4, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteEndDocument(); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + + Assert.True(false); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function var_5 + // WriteEndElement without WriteStartElement + [Theory] + [XmlWriterInlineData] + public void var_5(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(var_5) { Attribute = new Variation("WriteEndElement without WriteStartElement") { id = 5, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteEndElement(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function var_6 + // WriteFullEndElement without WriteStartElement + [Theory] + [XmlWriterInlineData] + public void var_6(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(var_6) { Attribute = new Variation("WriteFullEndElement without WriteStartElement") { id = 6, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteFullEndElement(); + w.WriteFullEndElement(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCheckChars.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCheckChars.cs index 91af55e4b5..54d0400017 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCheckChars.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCheckChars.cs @@ -1,100 +1,426 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCCheckChars : XmlFactoryWriterTestCaseBase + public class TCCheckChars { - // Type is System.Xml.Tests.TCCheckChars - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "String")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "CData")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Comment")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "CharEntity")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "EntityRef")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "SurrogateCharEntity")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "PI")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Whitespace")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Chars")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "RawString")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "RawChars")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "WriteValue")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "WriteDocTypeName")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "WriteDocTypeSysid")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "WriteDocTypePubid")] + public void checkChars_1(XmlWriterUtils utils, string tokenType) { - if (WriterType == WriterType.CustomWriter || WriterType == WriterType.CharCheckingWriter) + char[] invalidXML = { '\u0000', '\u0008', '\u000B', '\u000C', '\u000E', '\u001F', '\uFFFE', '\uFFFF' }; + + XmlWriter w = utils.CreateWriter(ConformanceLevel.Auto); + + try { + switch (tokenType) + { + case "WriteDocTypeName": + w.WriteDocType(":badname", "sysid", "pubid", "subset"); + break; + + case "WriteDocTypeSysid": + w.WriteDocType("name", invalidXML[1].ToString(), "pubid", "subset"); + break; + + case "WriteDocTypePubid": + w.WriteDocType("name", "sysid", invalidXML[1].ToString(), "subset"); + break; + + case "String": + w.WriteString(invalidXML[0].ToString()); + break; + + case "CData": + w.WriteCData(invalidXML[1].ToString()); + break; + + case "Comment": + w.WriteComment(invalidXML[2].ToString()); + break; + + case "CharEntity": + w.WriteCharEntity(invalidXML[3]); + break; + + case "EntityRef": + w.WriteEntityRef(invalidXML[4].ToString()); + break; + + case "SurrogateCharEntity": + w.WriteSurrogateCharEntity(invalidXML[5], invalidXML[1]); + break; + + case "PI": + w.WriteProcessingInstruction("pi", invalidXML[6].ToString()); + break; + + case "Whitespace": + w.WriteWhitespace(invalidXML[7].ToString()); + break; + + case "Chars": + w.WriteChars(invalidXML, 1, 5); + break; + + case "RawString": + w.WriteRaw(invalidXML[4].ToString()); + break; + + case "RawChars": + w.WriteRaw(invalidXML, 6, 2); + break; + + case "WriteValue": + w.WriteValue(invalidXML[3].ToString()); + break; + + default: + CError.Compare(false, "Invalid param value"); + break; + } + } + catch (XmlException e1) + { + CError.WriteLineIgnore("Exception: " + e1.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); return; } - // for function checkChars_1 + catch (ArgumentException e2) { - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteString") { Param = "String", id = 1, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteEntityRef") { Param = "EntityRef", id = 5, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteSurrogateCharEntity") { Param = "SurrogateCharEntity", id = 6, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WritePI") { Param = "PI", id = 7, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteWhitespace") { Param = "Whitespace", id = 8, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteChars") { Param = "Chars", id = 9, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteRaw(String)") { Param = "RawString", id = 10, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteRaw(Chars)") { Param = "RawChars", id = 11, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteValue(string)") { Param = "WriteValue", id = 12, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid name chars WriteDocType(name)") { Param = "WriteDocTypeName", id = 13, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid name chars WriteDocType(sysid)") { Param = "WriteDocTypeSysid", id = 14, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid name chars WriteDocType(pubid)") { Param = "WriteDocTypePubid", id = 15, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteCData") { Param = "CData", id = 2, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteComment") { Param = "Comment", id = 3, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_1) { Attribute = new Variation("CheckChars=true, invalid XML test WriteCharEntity") { Param = "CharEntity", id = 4, Pri = 1 } }); + CError.WriteLineIgnore("Exception: " + e2.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } + finally + { + w.Dispose(); + } + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "String")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "CharEntity")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Chars")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "WriteValue")] + public void checkChars_2(XmlWriterUtils utils, string tokenType) + { + char[] invalidXML = { '\u0000', '\u0008', '\u000B', '\u000C', '\u000E', '\u001F', '\uFFFE', '\uFFFF' }; + + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = false; + wSettings.CloseOutput = false; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.CheckCharacters, false, "Mismatch in CheckCharacters"); + try + { + w.WriteStartElement("Root"); + switch (tokenType) + { + case "String": + w.WriteString(invalidXML[0].ToString()); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareReader("")); + return; + case "CharEntity": + w.WriteCharEntity(invalidXML[3]); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareReader(" ")); + return; + case "Chars": + w.WriteChars(invalidXML, 1, 5); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareReader(" ")); + return; + case "WriteValue": + w.WriteValue(invalidXML[3].ToString()); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareReader(" ")); + return; + default: + CError.Compare(false, "Invalid param value"); + break; + } + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + Assert.True(false); + } + finally + { + w.Dispose(); + } + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Comment")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "PI")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "CData")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "RawString")] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "RawChars")] + public void checkChars_3(XmlWriterUtils utils, string tokenType) + { + char[] invalidXML = { '\u0000', '\u0008', '\u000B', '\u000C', '\u000E', '\u001F', '\uFFFE', '\uFFFF' }; + + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = false; + wSettings.CloseOutput = true; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.CheckCharacters, false, "Mismatch in CheckCharacters"); + w.WriteStartElement("Root"); + switch (tokenType) + { + case "Comment": + w.WriteComment(invalidXML[2].ToString()); + w.WriteEndElement(); + w.Dispose(); + string exp = utils.IsIndent() ? "" + Environment.NewLine + " " + Environment.NewLine + "" : ""; + Assert.True(utils.CompareString(exp)); + break; + case "PI": + w.WriteProcessingInstruction("pi", invalidXML[6].ToString()); + w.WriteEndElement(); + w.Dispose(); + exp = utils.IsIndent() ? "" + Environment.NewLine + " " + Environment.NewLine + "" : ""; + Assert.True(utils.CompareString(exp)); + break; + case "RawString": + w.WriteRaw(invalidXML[4].ToString()); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("\u000E")); + break; + case "RawChars": + w.WriteRaw(invalidXML, 6, 2); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("\uFFFE\uFFFF")); + break; + case "CData": + w.WriteCData(invalidXML[1].ToString()); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("")); + break; + default: + CError.Compare(false, "Invalid param value"); + Assert.True(false); + break; + } + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Whitespace", false)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Surrogate", false)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "EntityRef", false)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Name", false)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "NmToken", false)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "QName", false)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Whitespace", true)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Surrogate", true)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "EntityRef", true)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "Name", true)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "NmToken", true)] + [XmlWriterInlineData(WriterType.AllButCustom & ~WriterType.CharCheckingWriter, "QName", true)] + public void checkChars_4(XmlWriterUtils utils, string tokenType, bool checkCharacters) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = checkCharacters; + wSettings.CloseOutput = true; + + char[] invalidXML = { '\u0000', '\u0008', '\u000B', '\u000C', '\u000E', '\u001F', '\uFFFE', '\uFFFF' }; + XmlWriter w = utils.CreateWriter(wSettings); + try + { + w.WriteStartElement("Root"); + switch (tokenType) + { + case "Whitespace": + w.WriteWhitespace(invalidXML[7].ToString()); + break; + case "Surrogate": + w.WriteSurrogateCharEntity(invalidXML[7], invalidXML[0]); + break; + case "EntityRef": + w.WriteEntityRef(invalidXML[4].ToString()); + break; + case "Name": + w.WriteName(invalidXML[6].ToString()); + break; + case "NmToken": + w.WriteNmToken(invalidXML[5].ToString()); + break; + case "QName": + w.WriteQualifiedName(invalidXML[3].ToString(), ""); + break; + default: + CError.Compare(false, "Invalid param value"); + break; + } + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + //By design + if ((utils.WriterType == WriterType.UTF8Writer || utils.WriterType == WriterType.UnicodeWriter || utils.WriterType == WriterType.WrappedWriter || utils.IsIndent()) && + (tokenType == "Name" || tokenType == "NmToken")) + { + CError.Compare(w.WriteState, WriteState.Element, "WriteState should be Element"); + } + else + { + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + } + return; + } + finally + { + w.Dispose(); + } + Assert.True(false); + } + + /*============================================================================= + The writer contructor will throw XmlException when CheckCharacters=true and + - IndentChars or NewLineChars contains non-whitespace character when NewLineOnAttributes=true + or + - IndentChars or NewLineChars contains <, &, ]]> or an invalid surrogate character when NewLineOnAttributes=false + ===============================================================================*/ + + [Theory] + [XmlWriterInlineData("<")] + [XmlWriterInlineData("&")] + [XmlWriterInlineData("]]>")] + [XmlWriterInlineData("~surogate~")] + public void checkChars_7(XmlWriterUtils utils, string indentChars) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = true; + wSettings.CloseOutput = true; + wSettings.Indent = true; + wSettings.IndentChars = indentChars; + if (indentChars == "~surogate~") + wSettings.IndentChars = "\uDD12\uDD01"; + + XmlWriter w = null; + try + { + w = WriterHelper.Create("writer.out", wSettings, overrideAsync: true, async: utils.Async); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore(e.ToString()); + return; + } + finally + { + if (w != null) + w.Dispose(); } + Assert.True(false, "Did not throw exception"); + } - // for function checkChars_2 + [Theory] + [XmlWriterInlineData("<")] + [XmlWriterInlineData("&")] + [XmlWriterInlineData("]]>")] + [XmlWriterInlineData("~surogate~")] + public void checkChars_8(XmlWriterUtils utils, string newLineChars) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = true; + wSettings.CloseOutput = true; + wSettings.NewLineChars = newLineChars; + if (newLineChars == "~surogate~") + wSettings.NewLineChars = "\uDD12\uDD01"; + + XmlWriter w = null; + try { - this.AddChild(new CVariation(checkChars_2) { Attribute = new Variation("CheckChars=false, invalid XML characters should be escaped, WriteValue(string)") { Param = "WriteValue", id = 23, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_2) { Attribute = new Variation("CheckChars=false, invalid XML characters should be escaped, WriteCharEntity") { Param = "CharEntity", id = 21, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_2) { Attribute = new Variation("CheckChars=false, invalid XML characters should be escaped, WriteChars") { Param = "Chars", id = 22, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_2) { Attribute = new Variation("CheckChars=false, invalid XML characters should be escaped, WriteString") { Param = "String", id = 20, Pri = 1 } }); + w = WriterHelper.Create("writer.out", wSettings, overrideAsync: true, async: utils.Async); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore(e.ToString()); + return; + } + finally + { + if (w != null) + w.Dispose(); } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - // for function checkChars_3 + [Theory] + [XmlWriterInlineData] + public void checkChars_9(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = true; + wSettings.CloseOutput = true; + wSettings.NewLineOnAttributes = true; + wSettings.Indent = true; + wSettings.IndentChars = "foo"; + + XmlWriter w = null; + try { - this.AddChild(new CVariation(checkChars_3) { Attribute = new Variation("CheckChars=false, invalid XML characters in WritePI are not escaped") { Param = "PI", id = 32, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_3) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteRaw(String) are not escaped") { Param = "RawString", id = 34, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_3) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteRaw(Chars) are not escaped") { Param = "RawChars", id = 35, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_3) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteComment are not escaped") { Param = "Comment", id = 30, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_3) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteCData are not escaped") { Param = "CData", id = 33, Pri = 1 } }); + w = WriterHelper.Create("writer.out", wSettings, overrideAsync: true, async: utils.Async); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore(e.ToString()); + return; + } + finally + { + if (w != null) + w.Dispose(); } - - // for function checkChars_4 - { - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteEntityRef should error") { Params = new object[] { "EntityRef", false }, id = 42, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=true, invalid XML characters in WriteEntityRef should error") { Params = new object[] { "EntityRef", true }, id = 48, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=true, invalid XML characters in WriteName should error") { Params = new object[] { "Name", true }, id = 49, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=true, invalid XML characters in WriteNmToken should error") { Params = new object[] { "NmToken", true }, id = 50, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=true, invalid XML characters in WriteQualifiedName should error") { Params = new object[] { "QName", true }, id = 51, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteSurrogateCharEntity should error") { Params = new object[] { "Surrogate", false }, id = 41, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteWhitespace should error") { Params = new object[] { "Whitespace", false }, id = 40, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteName should error") { Params = new object[] { "Name", false }, id = 43, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteNmToken should error") { Params = new object[] { "NmToken", false }, id = 44, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=false, invalid XML characters in WriteQualifiedName should error") { Params = new object[] { "QName", false }, id = 45, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=true, invalid XML characters in WriteWhitespace should error") { Params = new object[] { "Whitespace", true }, id = 46, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_4) { Attribute = new Variation("CheckChars=true, invalid XML characters in WriteSurrogateCharEntity should error") { Params = new object[] { "Surrogate", true }, id = 47, Pri = 1 } }); - } - - - // for function checkChars_7 - { - this.AddChild(new CVariation(checkChars_7) { Attribute = new Variation("CheckChars = true and IndentChars contains invalid surrogate char") { Param = "~surogate~", id = 83, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_7) { Attribute = new Variation("CheckChars = true and IndentChars contains <") { Param = "<", id = 80, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_7) { Attribute = new Variation("CheckChars = true and IndentChars contains &") { Param = "&", id = 81, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_7) { Attribute = new Variation("CheckChars = true and IndentChars contains ]]>") { Param = "]]>", id = 82, Pri = 1 } }); - } - - - // for function checkChars_8 - { - this.AddChild(new CVariation(checkChars_8) { Attribute = new Variation("CheckChars = true and NewLineChars contains <") { Param = "<", id = 90, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_8) { Attribute = new Variation("CheckChars = true and NewLineChars contains ]]>") { Param = "]]>", id = 92, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_8) { Attribute = new Variation("CheckChars = true and NewLineChars contains &") { Param = "&", id = 91, Pri = 1 } }); - this.AddChild(new CVariation(checkChars_8) { Attribute = new Variation("CheckChars = true and NewLineChars contains invalid surrogate char") { Param = "~surogate~", id = 93, Pri = 1 } }); - } - - - // for function checkChars_9 - { - this.AddChild(new CVariation(checkChars_9) { Attribute = new Variation("CheckChars = true, NewLineOnAttributes = true and IndentChars contains non-whitespace char") { id = 99, Pri = 1 } }); - } + CError.WriteLine("Did not throw exception"); + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCloseOutput.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCloseOutput.cs index 617ccb3594..9f6754ec7c 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCloseOutput.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCCloseOutput.cs @@ -1,48 +1,191 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.IO; +using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCCloseOutput : XmlFactoryWriterTestCaseBase + public class TCCloseOutput { - // Type is System.Xml.Tests.TCCloseOutput - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData(WriterType.UTF8Writer | WriterType.UnicodeWriter, "Stream")] + [XmlWriterInlineData(WriterType.UTF8Writer | WriterType.UnicodeWriter, "Textwriter")] + public void CloseOutput_1(XmlWriterUtils utils, string outputType) { - if (WriterType == WriterType.CustomWriter) + XmlWriterSettings wSettings = new XmlWriterSettings(); + XmlWriter w = null; + switch (utils.WriterType) { + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + break; + } + Stream writerStream = new MemoryStream(); + switch (outputType) + { + case "Stream": + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case "Textwriter": + StreamWriter tw = new StreamWriter(writerStream, wSettings.Encoding); + w = WriterHelper.Create(tw, wSettings, overrideAsync: true, async: utils.Async); + break; + } + + w.WriteStartElement("root"); + w.WriteEndElement(); + w.Dispose(); + + if (writerStream.CanWrite) + { + writerStream.Dispose(); return; } - // for function CloseOutput_1 + CError.WriteLine("Error: XmlWriter closed the stream when CloseOutput = false"); + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData(WriterType.UTF8Writer | WriterType.UnicodeWriter, true)] + [XmlWriterInlineData(WriterType.UTF8Writer | WriterType.UnicodeWriter, false)] + public void CloseOutput_2(XmlWriterUtils utils, bool closeOutput) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + switch (utils.WriterType) { - this.AddChild(new CVariation(CloseOutput_1) { Attribute = new Variation("Check that underlying stream is NOT CLOSED when CloseOutput = FALSE and Create(TextWriter)") { Param = "Textwriter", id = 2, Pri = 0 } }); - this.AddChild(new CVariation(CloseOutput_1) { Attribute = new Variation("Check that underlying stream is NOT CLOSED when CloseOutput = FALSE and Create(Stream)") { Param = "Stream", id = 1, Pri = 0 } }); + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + break; + } + wSettings.CloseOutput = closeOutput; + + XmlWriter w = WriterHelper.Create("writer.out", wSettings, overrideAsync: true, async: utils.Async); + w.WriteStartElement("root"); + w.WriteEndElement(); + w.Dispose(); + + // Check if you can open the file in ReadWrite mode + Stream fs = null; + try + { + fs = FilePathUtil.getStream("writer.out");/*new FileStream("writer.out", FileMode.Open, FileAccess.ReadWrite);*/ + } + catch (Exception e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.WriteLine("Uri stream is not closed by writer"); + Assert.True(false); + } + finally + { + fs.Dispose(); + } + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.NoAsync | WriterType.UTF8Writer | WriterType.UnicodeWriter, "Stream")] + [XmlWriterInlineData(WriterType.NoAsync | WriterType.UTF8Writer | WriterType.UnicodeWriter, "Textwriter")] + public void CloseOutput_3(XmlWriterUtils utils, string outputType) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.CloseOutput = true; + XmlWriter w = null; + + switch (utils.WriterType) + { + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + break; } - - // for function CloseOutput_2 + Stream writerStream = FilePathUtil.getStream("writer.out"); + switch (outputType) { - this.AddChild(new CVariation(CloseOutput_2) { Attribute = new Variation("Check that underlying stream is CLOSED when CloseOutput = FALSE and Create(Uri)") { Param = "false", id = 3, Pri = 0 } }); - this.AddChild(new CVariation(CloseOutput_2) { Attribute = new Variation("Check that underlying stream is CLOSED when CloseOutput = TRUE and Create(Uri)") { Param = "true", id = 4, Pri = 0 } }); + case "Stream": + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case "Textwriter": + StreamWriter tw = new StreamWriter(writerStream, wSettings.Encoding); + w = WriterHelper.Create(tw, wSettings, overrideAsync: true, async: utils.Async); + break; } + w.WriteStartElement("root"); + w.WriteEndElement(); + w.Dispose(); - // for function CloseOutput_3 + if (writerStream.CanWrite) { - this.AddChild(new CVariation(CloseOutput_3) { Attribute = new Variation("Check that underlying stream is CLOSED when CloseOutput = TRUE and Create(Textwriter)") { Param = "Textwriter", id = 6, Pri = 0 } }); - this.AddChild(new CVariation(CloseOutput_3) { Attribute = new Variation("Check that underlying stream is CLOSED when CloseOutput = TRUE and Create(Stream)") { Param = "Stream", id = 5, Pri = 0 } }); + writerStream.Dispose(); + Assert.True(false); + } + } + + [Theory] + [XmlWriterInlineData(WriterType.UTF8Writer | WriterType.UnicodeWriter, "Stream")] + [XmlWriterInlineData(WriterType.UTF8Writer | WriterType.UnicodeWriter, "Textwriter")] + public void CloseOutput_4(XmlWriterUtils utils, string outputType) + { + Stream writerStream = FilePathUtil.getStream("writer.out"); + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.CloseOutput = true; + XmlWriter w = null; + + switch (utils.WriterType) + { + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + break; } - - // for function CloseOutput_4 + switch (outputType) { - this.AddChild(new CVariation(CloseOutput_4) { Attribute = new Variation("Writer should not close underlying stream when an exception is thrown before Close (Textwriter)") { Param = "Textwriter", id = 8, Pri = 1 } }); - this.AddChild(new CVariation(CloseOutput_4) { Attribute = new Variation("Writer should not close underlying stream when an exception is thrown before Close (Stream)") { Param = "Stream", id = 7, Pri = 1 } }); + case "Stream": + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case "Textwriter": + StreamWriter tw = new StreamWriter(writerStream, wSettings.Encoding); + w = WriterHelper.Create(tw, wSettings, overrideAsync: true, async: utils.Async); + break; } + + bool bResult = false; + try + { + w.WriteStartDocument(); + w.WriteStartDocument(); + } + catch (Exception e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + if (writerStream != null && writerStream.CanWrite) + bResult = true; + else + bResult = false; + } + finally + { + writerStream.Dispose(); + } + Assert.True(bResult); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDefaultWriterSettings.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDefaultWriterSettings.cs deleted file mode 100644 index 4aa198efbd..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDefaultWriterSettings.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using OLEDB.Test.ModuleCore; -using XmlCoreTest.Common; - -namespace System.Xml.Tests -{ - public partial class TCDefaultWriterSettings : XmlFactoryWriterTestCaseBase - { - // Type is System.Xml.Tests.TCDefaultWriterSettings - // Test Case - public override void AddChildren() - { - if (WriterType == WriterType.CustomWriter) - { - return; - } - // for function default_1 - { - this.AddChild(new CVariation(default_1) { Attribute = new Variation("Default value of Encoding") { id = 1 } }); - } - - - // for function default_2 - { - this.AddChild(new CVariation(default_2) { Attribute = new Variation("Default value of OmitXmlDeclaration") { id = 2 } }); - } - - - // for function default_3 - { - this.AddChild(new CVariation(default_3) { Attribute = new Variation("Default value of NewLineHandling") { id = 3 } }); - } - - - // for function default_4 - { - this.AddChild(new CVariation(default_4) { Attribute = new Variation("Default value of NewLineChars") { id = 4 } }); - } - - - // for function default_5 - { - this.AddChild(new CVariation(default_5) { Attribute = new Variation("Default value of Indent") { id = 5 } }); - } - - - // for function default_6 - { - this.AddChild(new CVariation(default_6) { Attribute = new Variation("Default value of IndentChars") { id = 6 } }); - } - - - // for function default_7 - { - this.AddChild(new CVariation(default_7) { Attribute = new Variation("Default value of NewLineOnAttributes") { id = 7 } }); - } - - - // for function default_8 - { - this.AddChild(new CVariation(default_8) { Attribute = new Variation("Default value of CloseOutput") { id = 8 } }); - } - - - // for function default_10 - { - this.AddChild(new CVariation(default_10) { Attribute = new Variation("Default value of CheckCharacters") { id = 10 } }); - } - - - // for function default_11 - { - this.AddChild(new CVariation(default_11) { Attribute = new Variation("Default value of ConformanceLevel") { id = 11 } }); - } - - - // for function default_13 - { - this.AddChild(new CVariation(default_13) { Attribute = new Variation("Default value of WriteEndDocumentOnClose") { id = 13 } }); - } - } - } -} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDefaultWriterSettingsTests.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDefaultWriterSettingsTests.cs new file mode 100644 index 0000000000..756782d2e7 --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDefaultWriterSettingsTests.cs @@ -0,0 +1,175 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Text; +using OLEDB.Test.ModuleCore; +using XmlCoreTest.Common; +using Xunit; + +namespace System.Xml.Tests +{ + public class TCDefaultWriterSettings + { + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_1(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Compare(wSettings.Encoding, Encoding.UTF8, "Incorrect default value of Encoding"); + + XmlWriter w = utils.CreateWriter(); + switch (utils.WriterType) + { + case WriterType.UTF8Writer: + case WriterType.UTF8WriterIndent: + case WriterType.CharCheckingWriter: + case WriterType.WrappedWriter: + CError.Compare(w.Settings.Encoding.WebName, "utf-8", "Incorrect default value of Encoding"); + break; + case WriterType.UnicodeWriter: + case WriterType.UnicodeWriterIndent: + CError.Compare(w.Settings.Encoding.WebName, "utf-16", "Incorrect default value of Encoding"); + break; + } + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_2(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Compare(wSettings.OmitXmlDeclaration, false, "Incorrect default value of OmitXmlDeclaration"); + + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_3(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Compare(wSettings.NewLineHandling, NewLineHandling.Replace, "Incorrect default value of NewLineHandling"); + + XmlWriter w = utils.CreateWriter(); + switch (utils.WriterType) + { + case WriterType.UTF8Writer: + case WriterType.UnicodeWriter: + CError.Compare(w.Settings.NewLineHandling, NewLineHandling.Replace, "Incorrect default value of NewLineHandling"); + break; + } + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_4(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Equals(wSettings.NewLineChars, Environment.NewLine, "Incorrect default value of NewLineChars"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.NewLineChars, Environment.NewLine, "Incorrect default value of NewLineChars"); + + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_5(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Equals(wSettings.Indent, false, "Incorrect default value of wSettings.Indent"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.Indent, utils.IsIndent(), "Incorrect default value of w.Settings.Indent"); + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_6(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Equals(wSettings.IndentChars, " ", "Incorrect default value of IndentChars"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.IndentChars, " ", "Incorrect default value of IndentChars"); + + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_7(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Equals(wSettings.NewLineOnAttributes, false, "Incorrect default value of NewLineOnAttributes"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.NewLineOnAttributes, false, "Incorrect default value of NewLineOnAttributes"); + + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_8(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Compare(wSettings.CloseOutput, false, "Incorrect default value of CloseOutput"); + + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_10(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Equals(wSettings.CheckCharacters, true, "Incorrect default value of CheckCharacters"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.CheckCharacters, true, "Incorrect default value of CheckCharacters"); + + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_11(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + CError.Equals(wSettings.ConformanceLevel, ConformanceLevel.Document, "Incorrect default value of ConformanceLevel"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.ConformanceLevel, ConformanceLevel.Document, "Incorrect default value of ConformanceLevel"); + + w.Dispose(); + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void default_13(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + CError.Equals(ws.WriteEndDocumentOnClose, true, "Incorrect default value of WriteEndDocumentOnClose"); + + XmlWriter w = utils.CreateWriter(); + CError.Equals(w.Settings.WriteEndDocumentOnClose, true, "Incorrect default value of WriteEndDocumentOnClose"); + + w.Dispose(); + + return; + } + } + +} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocType.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocType.cs index f8c1f6cd6b..9e9ba7e2b6 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocType.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocType.cs @@ -1,58 +1,170 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCDocType : XmlWriterTestCaseBase + //[TestCase(Name = "WriteDocType")] + public class TCDocType { - // Type is System.Xml.Tests.TCDocType - // Test Case - public override void AddChildren() + // Sanity test + [Theory] + [XmlWriterInlineData] + public void docType_1(XmlWriterUtils utils) { - // for function docType_1 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_1) { Attribute = new Variation("Sanity test") { id = 1, Pri = 1 } }); + w.WriteDocType("ROOT", "publicid", "sysid", ""); + w.WriteStartElement("ROOT"); + w.WriteEndElement(); } + string exp = utils.IsIndent() ? + "]>" + Environment.NewLine + "" : + "]>"; + Assert.True(utils.CompareString(exp)); + } - // for function docType_2 + // WriteDocType pubid = null and sysid = null + [Theory] + [XmlWriterInlineData] + public void docType_2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_2) { Attribute = new Variation("WriteDocType pubid = null and sysid = null") { id = 2, Pri = 1 } }); + w.WriteDocType("test", null, null, ""); + w.WriteStartElement("Root"); + w.WriteEndElement(); } + string exp = utils.IsIndent() ? + "]>" + Environment.NewLine + "" : + "]>"; + Assert.True(utils.CompareString(exp)); + } - - // for function docType_3 + // Call WriteDocType twice + [Theory] + [XmlWriterInlineData] + public void docType_3(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_3) { Attribute = new Variation("Call WriteDocType twice") { id = 3, Pri = 1 } }); + try + { + w.WriteDocType("doc1", null, null, ""); + w.WriteDocType("doc2", null, null, ""); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore(e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function docType_4 + [Theory] + [XmlWriterInlineData("String.Empty")] + [XmlWriterInlineData("null")] + public void docType_4(XmlWriterUtils utils, string param) + { + String docName = ""; + if (param == "String.Empty") + docName = String.Empty; + else if (param == "null") + docName = null; + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_4) { Attribute = new Variation("WriteDocType with name value = String.Empty") { Param = "String.Empty", id = 4, Pri = 1 } }); - this.AddChild(new CVariation(docType_4) { Attribute = new Variation("WriteDocType with name value = null") { Param = "null", id = 5, Pri = 1 } }); + try + { + w.WriteDocType(docName, null, null, "test1"); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore(e.ToString()); + CError.Compare(w.WriteState, (utils.WriterType == WriterType.CharCheckingWriter) ? WriteState.Start : WriteState.Error, "WriteState should be Error"); + return; + } + catch (NullReferenceException e) + { + CError.WriteLineIgnore(e.ToString()); + CError.Compare(w.WriteState, (utils.WriterType == WriterType.CharCheckingWriter) ? WriteState.Start : WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function docType_5 + // WriteDocType with DocType end tag in the value + [Theory] + [XmlWriterInlineData] + public void docType_5(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_5) { Attribute = new Variation("Bug 53726: WriteDocType with DocType end tag in the value") { id = 6, Pri = 1 } }); + String docName = "Root"; + String docValue = "]>"; + w.WriteDocType(docName, null, null, docValue); + w.WriteStartElement("Root"); + w.WriteEndElement(); } + string exp = utils.IsIndent() ? "]>" + Environment.NewLine + "" : "]>"; + Assert.True(utils.CompareString(exp)); + } - - // for function docType_6 + // Call WriteDocType in the root element + [Theory] + [XmlWriterInlineData] + public void docType_6(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_6) { Attribute = new Variation("Call WriteDocType in the root element") { id = 7, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteDocType("doc1", null, null, "test1"); + w.WriteEndElement(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore(e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function docType_7 + // Call WriteDocType following root element + [Theory] + [XmlWriterInlineData] + public void docType_7(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(docType_7) { Attribute = new Variation("Call WriteDocType following root element") { id = 8, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteDocType("doc1", null, null, "test1"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore(e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocument.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocument.cs index 731d85d42f..bfde6c2014 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocument.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCDocument.cs @@ -1,87 +1,279 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using Xunit; namespace System.Xml.Tests { - public partial class TCDocument : XmlWriterTestCaseBase + //[TestCase(Name = "WriteStart/EndDocument")] + public class TCDocument { - // Type is System.Xml.Tests.TCDocument - // Test Case - public override void AddChildren() + // StartDocument-EndDocument Sanity Test + [Theory] + [XmlWriterInlineData] + public void document_1(XmlWriterUtils utils) { - // for function document_1 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_1) { Attribute = new Variation("StartDocument-EndDocument Sanity Test") { id = 1, Pri = 0 } }); + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteEndDocument(); } + Assert.True(utils.CompareReader("")); + } - - // for function document_2 + // Multiple StartDocument should error + [Theory] + [XmlWriterInlineData] + public void document_2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_2) { Attribute = new Variation("Multiple StartDocument should error") { id = 2, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartDocument(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function document_3 + // Missing StartDocument should be fixed + [Theory] + [XmlWriterInlineData] + public void document_3(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_3) { Attribute = new Variation("Missing StartDocument should be fixed") { id = 3, Pri = 1 } }); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteEndDocument(); } + Assert.True(utils.CompareReader("")); + } - // for function document_4 + // Multiple EndDocument should error + [Theory] + [XmlWriterInlineData] + public void document_4(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_4) { Attribute = new Variation("Multiple EndDocument should error") { id = 4, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteEndDocument(); + w.WriteEndDocument(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function document_5 + // Missing EndDocument should be fixed + [Theory] + [XmlWriterInlineData] + public void document_5(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_5) { Attribute = new Variation("Missing EndDocument should be fixed") { id = 5, Pri = 1 } }); + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); } + Assert.True(utils.CompareReader("")); + } - - // for function document_6 + // Call Start-EndDocument multiple times, should error + [Theory] + [XmlWriterInlineData] + public void document_6(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_6) { Attribute = new Variation("Call Start-EndDocument multiple times, should error") { id = 6, Pri = 2 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteEndDocument(); + + w.WriteStartDocument(); + w.WriteEndDocument(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function document_7 + // Multiple root elements should error + [Theory] + [XmlWriterInlineData] + public void document_7(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_7) { Attribute = new Variation("Multiple root elements should error") { id = 7, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteStartElement("Root"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function document_8 + // Start-EndDocument without any element should error + [Theory] + [XmlWriterInlineData] + public void document_8(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_8) { Attribute = new Variation("Start-EndDocument without any element should error") { id = 8, Pri = 2 } }); + try + { + w.WriteStartDocument(); + w.WriteEndDocument(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function document_9 + // Top level text should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void document_9(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_9) { Attribute = new Variation("Top level text should error - PROLOG") { id = 9, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteString("Top level text"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function document_10 + // Top level text should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void document_10(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_10) { Attribute = new Variation("Top level text should error - EPILOG") { id = 10, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteString("Top level text"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - // for function document_11 + // Top level atomic value should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void document_11(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_11) { Attribute = new Variation("Top level atomic value should error - PROLOG") { id = 11, Pri = 1 } }); + try + { + w.WriteStartDocument(); + int i = 1; + w.WriteValue(i); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + Assert.True(false); + } - - // for function document_12 + // Top level atomic value should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void document_12(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(document_12) { Attribute = new Variation("Top level atomic value should error - EPILOG") { id = 12, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + int i = 1; + w.WriteValue(i); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCEOFHandling.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCEOFHandling.cs deleted file mode 100644 index 0cbbe7c56f..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCEOFHandling.cs +++ /dev/null @@ -1,229 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using OLEDB.Test.ModuleCore; -using XmlCoreTest.Common; - -namespace System.Xml.Tests -{ - public partial class TCEOFHandling : XmlFactoryWriterTestCaseBase - { - // Type is System.Xml.Tests.TCEOFHandling - // Test Case - public override void AddChildren() - { - if (!(WriterType == WriterType.UnicodeWriter || WriterType == WriterType.UTF8Writer || WriterType == WriterType.WrappedWriter - || WriterType == WriterType.CharCheckingWriter || WriterType == WriterType.UTF8WriterIndent || WriterType == WriterType.UnicodeWriterIndent)) - { - return; - } - // for function EOF_Handling_01 - { - this.AddChild(new CVariation(EOF_Handling_01) { Attribute = new Variation("NewLineHandling Default value - NewLineHandling.Replace") { id = 1, Pri = 0 } }); - } - - - // for function EOF_Handling_02 - { - this.AddChild(new CVariation(EOF_Handling_02) { Attribute = new Variation("XmlWriter creation with NewLineHandling.None") { Param = 2, id = 4, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_02) { Attribute = new Variation("XmlWriter creation with NewLineHandling.Replace") { Param = 0, id = 3, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_02) { Attribute = new Variation("XmlWriter creation with NewLineHandling.Entitize") { Param = 1, id = 2, Pri = 0 } }); - } - - - // for function EOF_Handling_03 - { - this.AddChild(new CVariation(EOF_Handling_03) { Attribute = new Variation("Check for combinations of NewLine characters in element with 'Entitize'") { Param = 1, id = 5, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_03) { Attribute = new Variation("Check for combinations of NewLine characters in element with 'Replace'") { Param = 0, id = 6, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_03) { Attribute = new Variation("Check for combinations of NewLine characters in element with 'None'") { Param = 2, id = 7, Pri = 0 } }); - } - - - // for function EOF_Handling_04 - { - this.AddChild(new CVariation(EOF_Handling_04) { Attribute = new Variation("Check for combinations of entities in element with 'None'") { Param = 2, id = 10, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_04) { Attribute = new Variation("Check for combinations of entities in element with 'Replace'") { Param = 0, id = 9, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_04) { Attribute = new Variation("Check for combinations of entities in element with 'Entitize'") { Param = 1, id = 8, Pri = 0 } }); - } - - - // for function EOF_Handling_05 - { - this.AddChild(new CVariation(EOF_Handling_05) { Attribute = new Variation("Check for combinations of NewLine characters and entities in element with 'Replace'") { Param = 0, id = 12, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_05) { Attribute = new Variation("Check for combinations of NewLine characters and entities in element with 'Entitize'") { Param = 1, id = 11, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_05) { Attribute = new Variation("Check for combinations of NewLine characters and entities in element with 'None'") { Param = 2, id = 13, Pri = 0 } }); - } - - - // for function EOF_Handling_06 - { - this.AddChild(new CVariation(EOF_Handling_06) { Attribute = new Variation("Check for tab character in element with 'Entitize'") { Param = 1, id = 14, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_06) { Attribute = new Variation("Check for tab character in element with 'Replace'") { Param = 0, id = 15, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_06) { Attribute = new Variation("Check for tab character in element with 'None'") { Param = 2, id = 16, Pri = 0 } }); - } - - - // for function EOF_Handling_07 - { - this.AddChild(new CVariation(EOF_Handling_07) { Attribute = new Variation("Check for combinations of NewLine characters in attribute with 'Entitize'") { Param = 1, id = 17, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_07) { Attribute = new Variation("Check for combinations of NewLine characters in attribute with 'None'") { Param = 2, id = 19, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_07) { Attribute = new Variation("Check for combinations of NewLine characters in attribute with 'Replace'") { Param = 0, id = 18, Pri = 0 } }); - } - - - // for function EOF_Handling_08 - { - this.AddChild(new CVariation(EOF_Handling_08) { Attribute = new Variation("Check for combinations of entities in attribute with 'Entitize'") { Param = 1, id = 20, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_08) { Attribute = new Variation("Check for combinations of entities in attribute with 'None'") { Param = 2, id = 22, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_08) { Attribute = new Variation("Check for combinations of entities in attribute with 'Replace'") { Param = 0, id = 21, Pri = 0 } }); - } - - - // for function EOF_Handling_09 - { - this.AddChild(new CVariation(EOF_Handling_09) { Attribute = new Variation("Check for combinations of NewLine characters and entities in element with 'Entitize'") { Param = 1, id = 23, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_09) { Attribute = new Variation("Check for combinations of NewLine characters and entities in element with 'Replace'") { Param = 0, id = 24, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_09) { Attribute = new Variation("Check for combinations of NewLine characters and entities in element with 'None'") { Param = 2, id = 25, Pri = 0 } }); - } - - - // for function EOF_Handling_10 - { - this.AddChild(new CVariation(EOF_Handling_10) { Attribute = new Variation("Check for tab character in attribute with 'Replace'") { Param = 0, id = 27, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_10) { Attribute = new Variation("Check for tab character in attribute with 'None'") { Param = 2, id = 28, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_10) { Attribute = new Variation("Check for tab character in attribute with 'Entitize'") { Param = 1, id = 26, Pri = 0 } }); - } - - - // for function EOF_Handling_11 - { - this.AddChild(new CVariation(EOF_Handling_11) { Attribute = new Variation("NewLineChars and IndentChars Default values and test for proper indentation, Entitize") { Param = 1, id = 29, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_11) { Attribute = new Variation("NewLineChars and IndentChars Default values and test for proper indentation, None") { Param = 2, id = 31, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_11) { Attribute = new Variation("NewLineChars and IndentChars Default values and test for proper indentation, Replace") { Param = 0, id = 30, Pri = 1 } }); - } - - - // for function EOF_Handling_13 - { - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("6.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, ' ', ' '") { Params = new object[] { NewLineHandling.None, " ", " " }, id = 37, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("1.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\\r', ' '") { Params = new object[] { NewLineHandling.Entitize, "\r", " " }, id = 32, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("7.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\\r', '\\n'") { Params = new object[] { NewLineHandling.Entitize, "\r", "\n" }, id = 38, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("9.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\\r', '\\n'") { Params = new object[] { NewLineHandling.None, "\r", "\n" }, id = 40, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("2.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\\r', ' '") { Params = new object[] { NewLineHandling.Replace, "\r", " " }, id = 33, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("3.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\\r', ' '") { Params = new object[] { NewLineHandling.None, "\r", " " }, id = 34, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("4.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, ' ', ' '") { Params = new object[] { NewLineHandling.Entitize, " ", " " }, id = 35, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("5.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, ' ', ' '") { Params = new object[] { NewLineHandling.Replace, " ", " " }, id = 36, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_13) { Attribute = new Variation("8.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\\r', '\\n'") { Params = new object[] { NewLineHandling.Replace, "\r", "\n" }, id = 39, Pri = 2 } }); - } - - - // for function EOF_Handling_14 - { - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; None, '---'") { Params = new object[] { NewLineHandling.None, "---" }, id = 49, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; Entitize, '\\r\\n'") { Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 41, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; Replace, '\\r\\n'") { Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 42, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; None, '\\r\\n'") { Params = new object[] { NewLineHandling.None, "\r\n" }, id = 43, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; Entitize, '\\r'") { Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 44, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; Replace, '\\r'") { Params = new object[] { NewLineHandling.Replace, "\r" }, id = 45, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; None, '\\r'") { Params = new object[] { NewLineHandling.None, "\r" }, id = 46, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; Entitize, '---'") { Params = new object[] { NewLineHandling.Entitize, "---" }, id = 47, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_14) { Attribute = new Variation("NewLine handling in text node when Indent=true; Replace, '---'") { Params = new object[] { NewLineHandling.Replace, "---" }, id = 48, Pri = 2 } }); - } - - - // for function EOF_Handling_15 - { - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; None, '---'") { Params = new object[] { NewLineHandling.None, "---" } } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; Entitize, '---'") { Params = new object[] { NewLineHandling.Entitize, "---" }, id = 54, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; Replace, '---'") { Params = new object[] { NewLineHandling.Replace, "---" }, id = 55, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; Entitize, '\\r\\n'") { Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 50, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; Replace, '\\r\\n'") { Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 51, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; None, '\\r\\n'") { Params = new object[] { NewLineHandling.None, "\r\n" }, id = 52, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; Entitize, '\\r'") { Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 53, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; Replace, '\\r'") { Params = new object[] { NewLineHandling.Replace, "\r" }, id = 54, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_15) { Attribute = new Variation("NewLine handling in attribute when Indent=true; None, '\\r'") { Params = new object[] { NewLineHandling.None, "\r" }, id = 54, Pri = 2 } }); - } - - - // for function EOF_Handling_16 - { - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; Replace, '\\r\\n'") { Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 57, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; Entitize, '\\r\\n'") { Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 56, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; None, '\\r\\n'") { Params = new object[] { NewLineHandling.None, "\r\n" }, id = 58, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; Entitize, '\\r'") { Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 59, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; Replace, '\\r'") { Params = new object[] { NewLineHandling.Replace, "\r" }, id = 60, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; None, '\\r'") { Params = new object[] { NewLineHandling.None, "\r" }, id = 61, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; Entitize, '---'") { Params = new object[] { NewLineHandling.Entitize, "---" }, id = 62, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; Replace, '---'") { Params = new object[] { NewLineHandling.Replace, "---" }, id = 63, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_16) { Attribute = new Variation("NewLine handling between attributes when NewLineOnAttributes=true; None, '---'") { Params = new object[] { NewLineHandling.None, "---" }, id = 64, Pri = 2 } }); - } - - - // for function EOF_Handling_17 - { - this.AddChild(new CVariation(EOF_Handling_17) { Attribute = new Variation("Sanity tests for various types of nodes with 'Entitize'") { Param = 1, id = 65, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_17) { Attribute = new Variation("Sanity tests for various types of nodes with 'Replace'") { Param = 0, id = 66, Pri = 0 } }); - this.AddChild(new CVariation(EOF_Handling_17) { Attribute = new Variation("Sanity tests for various types of nodes with 'None'") { Param = 2, id = 67, Pri = 0 } }); - } - - - // for function EOF_Handling_18 - { - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; None, '\\r\\n'") { Params = new object[] { NewLineHandling.None, "\r\n" }, id = 70, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; None, '---'") { Params = new object[] { NewLineHandling.None, "---" }, id = 76, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; Replace, '\\r\\n'") { Params = new object[] { NewLineHandling.Replace, "\r\n" }, id = 69, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; Entitize, '\\r\\n'") { Params = new object[] { NewLineHandling.Entitize, "\r\n" }, id = 68, Pri = 1 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; Entitize, '\\r'") { Params = new object[] { NewLineHandling.Entitize, "\r" }, id = 71, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; Replace, '\\r'") { Params = new object[] { NewLineHandling.Replace, "\r" }, id = 72, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; None, '\\r'") { Params = new object[] { NewLineHandling.None, "\r" }, id = 73, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; Entitize, '---'") { Params = new object[] { NewLineHandling.Entitize, "---" }, id = 74, Pri = 2 } }); - this.AddChild(new CVariation(EOF_Handling_18) { Attribute = new Variation("Custom NewLineChars inside CDATA & Comment when Indent=true; Replace, '---'") { Params = new object[] { NewLineHandling.Replace, "---" }, id = 75, Pri = 2 } }); - } - - - // for function EOF_Handling_19 - { - this.AddChild(new CVariation(EOF_Handling_19) { Attribute = new Variation("Wrapped writer tests for various types of nodes with 'Replace'") { Param = 0, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_19) { Attribute = new Variation("Wrapped writer tests for various types of nodes with 'None'") { Param = 2, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_19) { Attribute = new Variation("Wrapped writer tests for various types of nodes with 'Entitize'") { Param = 1, Priority = 2 } }); - } - - - // for function EOF_Handling_20 - { - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.Indent - valid values") { Param = 12, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.Indent - valid values") { Param = 11, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.IndentChars - valid values") { Param = 1, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.NewLineChars - valid values") { Param = 2, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.IndentChars - valid values") { Param = 3, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.NewLineChars - valid values") { Param = 4, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.IndentChars - valid values") { Param = 5, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.NewLineChars - valid values") { Param = 6, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.IndentChars - valid values") { Param = 7, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.NewLineChars - valid values") { Param = 8, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.IndentChars - valid values") { Param = 9, Priority = 2 } }); - this.AddChild(new CVariation(EOF_Handling_20) { Attribute = new Variation("XmlWriterSettings.NewLineChars - valid values") { Param = 10, Priority = 2 } }); - } - - - // for function EOF_Handling_21 - { - this.AddChild(new CVariation(EOF_Handling_21) { Attribute = new Variation("10.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\ud800\udc00', '\ud800\udc00'") { Params = new object[] { NewLineHandling.Entitize, "\ud800\udc00", "\ud800\udc00" } } }); - this.AddChild(new CVariation(EOF_Handling_21) { Attribute = new Variation("11.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\ud800\udc00', ' '") { Params = new object[] { NewLineHandling.Replace, "\ud800\udc00", "\ud800\udc00" } } }); - this.AddChild(new CVariation(EOF_Handling_21) { Attribute = new Variation("14.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '<>', '<>'") { Params = new object[] { NewLineHandling.Replace, "<>", "<>" } } }); - this.AddChild(new CVariation(EOF_Handling_21) { Attribute = new Variation("12.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\ud800\udc00', '<>'") { Params = new object[] { NewLineHandling.None, "\ud800\udc00", "\ud800\udc00" } } }); - this.AddChild(new CVariation(EOF_Handling_21) { Attribute = new Variation("15.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '<>', '<>'") { Params = new object[] { NewLineHandling.None, "<>", "<>" } } }); - this.AddChild(new CVariation(EOF_Handling_21) { Attribute = new Variation("13.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '<>', '<>'") { Params = new object[] { NewLineHandling.Entitize, "<>", "<>" } } }); - } - - - // for function EOF_Handling_22 - { - this.AddChild(new CVariation(EOF_Handling_22) { Attribute = new Variation("18.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; None, '\uDE40\uDA72', '\uDE40\uDA72'") { Params = new object[] { NewLineHandling.None } } }); - this.AddChild(new CVariation(EOF_Handling_22) { Attribute = new Variation("17.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Replace, '\uDE40\uDA72', '\uDE40\uDA72'") { Params = new object[] { NewLineHandling.Replace } } }); - this.AddChild(new CVariation(EOF_Handling_22) { Attribute = new Variation("16.Test fo proper indentation and newline handling when Indent = true, with custom NewLineChars and IndentChars; Entitize, '\uDE40\uDA72', '\uDE40\uDA72'") { Params = new object[] { NewLineHandling.Entitize } } }); - } - } - } -} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCElement.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCElement.cs index 5108e15821..a14ddffda8 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCElement.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCElement.cs @@ -1,126 +1,412 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.IO; +using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCElement : XmlWriterTestCaseBase + //[TestCase(Name = "WriteStart/EndElement")] + public class TCElement { - // Type is System.Xml.Tests.TCElement - // Test Case - public override void AddChildren() + // StartElement-EndElement Sanity Test + [Theory] + [XmlWriterInlineData] + public void element_1(XmlWriterUtils utils) { - // for function element_1 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(element_1) { Attribute = new Variation("StartElement-EndElement Sanity Test") { id = 1, Pri = 0 } }); + w.WriteStartElement("Root"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Sanity test for overload WriteStartElement(string prefix, string name, string ns) + [Theory] + [XmlWriterInlineData] + public void element_2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("pre1", "Root", "http://my.com"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Sanity test for overload WriteStartElement(string name, string ns) + [Theory] + [XmlWriterInlineData] + public void element_3(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root", "http://my.com"); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Element name = String.Empty should error + [Theory] + [XmlWriterInlineData] + public void element_4(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement(String.Empty); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, (utils.WriterType == WriterType.CharCheckingWriter) ? WriteState.Start : WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // Element name = null should error + [Theory] + [XmlWriterInlineData] + public void element_5(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteStartElement(null); + } + catch (ArgumentException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, (utils.WriterType == WriterType.CharCheckingWriter) ? WriteState.Start : WriteState.Error, "WriteState should be Error"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // Element NS = String.Empty + [Theory] + [XmlWriterInlineData] + public void element_6(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root", String.Empty); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Element NS = null + [Theory] + [XmlWriterInlineData] + public void element_7(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root", null); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + // Write 100 nested elements + [Theory] + [XmlWriterInlineData] + public void element_8(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + for (int i = 0; i < 100; i++) + { + string eName = "Node" + i.ToString(); + w.WriteStartElement(eName); + } + for (int i = 0; i < 100; i++) + w.WriteEndElement(); } + string exp = (utils.WriterType == WriterType.UTF8WriterIndent || utils.WriterType == WriterType.UnicodeWriterIndent) ? + "100ElementsIndent.txt" : "100Elements.txt"; + Assert.True(utils.CompareBaseline(exp)); + } - // for function element_2 + // WriteDecl with start element with prefix and namespace + [Theory] + [XmlWriterInlineData] + public void element_9(XmlWriterUtils utils) + { + string enc = (utils.WriterType == WriterType.UnicodeWriter || utils.WriterType == WriterType.UnicodeWriterIndent) ? "16" : "8"; + string exp = (utils.WriterType == WriterType.UTF8WriterIndent || utils.WriterType == WriterType.UnicodeWriterIndent) ? + String.Format("" + Environment.NewLine + "", enc) : + String.Format("", enc); + + XmlWriterSettings ws = new XmlWriterSettings(); + ws.OmitXmlDeclaration = false; + using (XmlWriter w = utils.CreateWriter(ws)) { - this.AddChild(new CVariation(element_2) { Attribute = new Variation("Sanity test for overload WriteStartElement(string prefix, string name, string ns)") { id = 2, Pri = 0 } }); + w.WriteStartElement("a", "b", "c"); } + Assert.True((utils.CompareString(exp))); + } - // for function element_3 + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void element_10(XmlWriterUtils utils, bool defattr) + { + string xml = ""; + XmlReader r = ReaderHelper.Create(new StringReader(xml)); + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(element_3) { Attribute = new Variation("Sanity test for overload WriteStartElement(string name, string ns)") { id = 3, Pri = 0 } }); + w.WriteNode(r, defattr); } + Assert.True((utils.CompareString(xml))); + } - // for function element_4 + // Write many attributes and dup namespace + [Theory] + [XmlWriterInlineData] + public void element_10a(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(); + w.WriteDocType("a", null, null, ""); + w.WriteStartElement("Root"); + for (int i = 0; i < 200; i++) { - this.AddChild(new CVariation(element_4) { Attribute = new Variation("Element name = String.Empty should error") { id = 4, Pri = 1 } }); + w.WriteAttributeString("a", "n" + i, "val"); + } + try + { + w.WriteAttributeString("a", "n" + 199, "val"); + } + catch (XmlException) { return; } + finally + { + w.Dispose(); + } + Assert.True(false); + } + + + // Write many attributes and dup name + [Theory] + [XmlWriterInlineData] + public void element_10b(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(); + w.WriteDocType("a", null, null, ""); + w.WriteStartElement("Root"); + for (int i = 0; i < 200; i++) + { + w.WriteAttributeString("a" + i, "val"); + } + try + { + w.WriteAttributeString("a" + 199, "val"); + } + catch (XmlException) { return; } + finally + { + w.Dispose(); + } + Assert.True(false); + } + + // Write many attributes and dup prefix + [Theory] + [XmlWriterInlineData] + public void element_10c(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(); + w.WriteDocType("a", null, null, ""); + w.WriteStartElement("Root"); + for (int i = 0; i < 200; i++) + { + w.WriteAttributeString("p", "a", "n" + i, "val"); + } + try + { + w.WriteAttributeString("p", "a", "n" + 199, "val"); + } + catch (XmlException) { return; } + finally + { + w.Dispose(); + } + Assert.True(false); + } + + // Write invalid DOCTYPE with many attributes with prefix + [Theory] + [XmlWriterInlineData] + public void element_10d(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + w.WriteDocType("a", "b", "c", "d"); + w.WriteStartElement("Root"); + for (int i = 0; i < 200; i++) + { + w.WriteAttributeString("p", "a", "n" + i, "val"); + } + w.Dispose(); + } + catch (XmlException e) + { + CError.WriteLine(e); + Assert.True(false); + } + } + return; + } + + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + public void element_11(XmlWriterUtils utils, int param) + { + string exp = ""; + bool isIndent = false; + if (utils.WriterType == WriterType.UTF8WriterIndent || utils.WriterType == WriterType.UnicodeWriterIndent) + isIndent = true; + + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteDocType("root", null, null, ""); + w.WriteStartElement("root"); + w.WriteStartAttribute("xml", "lang", null); + switch (param) + { + case 1: + w.WriteEntityRef("apos"); + exp = !isIndent ? "]>" : + "]>" + Environment.NewLine + ""; + break; + case 2: + w.WriteEntityRef("lt"); + exp = !isIndent ? "]>" : + "]>" + Environment.NewLine + ""; + break; + case 3: + w.WriteEntityRef("quot"); + exp = !isIndent ? "]>" : + "]>" + Environment.NewLine + ""; + break; + } + w.WriteString("<"); + w.WriteEndAttribute(); + w.WriteEndElement(); + } + Assert.True((utils.CompareString(exp))); + } + + [Theory] + [XmlWriterInlineData(1)] + [XmlWriterInlineData(2)] + [XmlWriterInlineData(3)] + [XmlWriterInlineData(4)] + [XmlWriterInlineData(5)] + [XmlWriterInlineData(6)] + public void element_12(XmlWriterUtils utils, int param) + { + XmlWriter w = utils.CreateWriter(); + w.WriteStartElement("Root"); + string exp = ""; + switch (param) + { + case 1: + exp = ""; + break; + case 2: + exp = ""; + break; + case 3: + exp = ""; + break; + case 4: + exp = ""; + break; + case 5: + exp = ""; + break; + case 6: + exp = ""; + break; } - - // for function element_5 + switch (param) { - this.AddChild(new CVariation(element_5) { Attribute = new Variation("Element name = null should error") { id = 5, Pri = 1 } }); + case 1: + w.WriteStartAttribute("xml", "xmlns", null); + break; + case 2: + w.WriteStartAttribute("xml", "space", null); + break; + case 3: + w.WriteStartAttribute("xml", "lang", null); + break; + case 4: + w.WriteStartAttribute("xml", "xmlns"); + break; + case 5: + w.WriteStartAttribute("xml", "space"); + break; + case 6: + w.WriteStartAttribute("xml", "lang"); + break; } - - - // for function element_6 + w.WriteValue("default"); + try { - this.AddChild(new CVariation(element_6) { Attribute = new Variation("Element NS = String.Empty") { id = 6, Pri = 1 } }); + w.WriteWhitespace(" "); + w.WriteEndAttribute(); + w.WriteEndElement(); + w.Dispose(); } - - - // for function element_7 + catch (InvalidOperationException e) { - this.AddChild(new CVariation(element_7) { Attribute = new Variation("Element NS = null") { id = 7, Pri = 1 } }); + CError.WriteLine(e); + Assert.True(false); } + Assert.True(utils.CompareString(exp)); + } + [Theory] + [XmlWriterInlineData(false, "-0")] + [XmlWriterInlineData(true, "")] + public void element_13(XmlWriterUtils utils, bool isAttr, string exp) + { + double a = 1; + double b = 0; + double c = 1; + double d = -a * b / c; - // for function element_8 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(element_8) { Attribute = new Variation("Write 100 nested elements") }); - } - - - // for function element_9 - { - this.AddChild(new CVariation(element_9) { Attribute = new Variation("WriteDecl with start element with prefix and namespace") { id = 9 } }); - } - - - // for function element_10 - { - this.AddChild(new CVariation(element_10) { Attribute = new Variation("Write many attributes with same names and diff.namespaces") { Param = false } }); - this.AddChild(new CVariation(element_10) { Attribute = new Variation("Write many attributes with same names and diff.namespaces") { Param = true } }); - } - - - // for function element_10a - { - this.AddChild(new CVariation(element_10a) { Attribute = new Variation("Write many attributes and dup namespace") }); - } - - - // for function element_10b - { - this.AddChild(new CVariation(element_10b) { Attribute = new Variation("Write many attributes and dup name") }); - } - - - // for function element_10c - { - this.AddChild(new CVariation(element_10c) { Attribute = new Variation("Write many attributes and dup prefix") }); - } - - - // for function element_10d - { - this.AddChild(new CVariation(element_10d) { Attribute = new Variation("Write invalid DOCTYPE with many attributes with prefix") }); - } - - - // for function element_11 - { - this.AddChild(new CVariation(element_11) { Attribute = new Variation("WriteEntityRef with XmlWellformedWriter for 'lt'") { Param = 2 } }); - this.AddChild(new CVariation(element_11) { Attribute = new Variation("WriteEntityRef with XmlWellformedWriter for 'quot'") { Param = 3 } }); - this.AddChild(new CVariation(element_11) { Attribute = new Variation("WriteEntityRef with XmlWellformedWriter for 'apos'") { Param = 1 } }); - } - - - // for function element_12 - { - this.AddChild(new CVariation(element_12) { Attribute = new Variation("WriteValue & WriteWhitespace on a special attribute value \u2013 xmlns") { Param = 4 } }); - this.AddChild(new CVariation(element_12) { Attribute = new Variation("WriteValue & WriteWhitespace on a special attribute value \u2013 xml:xmlns") { Param = 1 } }); - this.AddChild(new CVariation(element_12) { Attribute = new Variation("WriteValue & WriteWhitespace on a special attribute value \u2013 space") { Param = 5 } }); - this.AddChild(new CVariation(element_12) { Attribute = new Variation("WriteValue & WriteWhitespace on a special attribute value \u2013 lang") { Param = 6 } }); - this.AddChild(new CVariation(element_12) { Attribute = new Variation("WriteValue & WriteWhitespace on a special attribute value \u2013 xml:space") { Param = 2 } }); - this.AddChild(new CVariation(element_12) { Attribute = new Variation("WriteValue & WriteWhitespace on a special attribute value \u2013 xml:lang") { Param = 3 } }); - } - - - // for function element_13 - { - this.AddChild(new CVariation(element_13) { Attribute = new Variation("WriteValue element double value") { Params = new object[] { false, "-0" } } }); - this.AddChild(new CVariation(element_13) { Attribute = new Variation("WriteValue attribute double value") { Params = new object[] { true, "" } } }); + w.WriteStartElement("Root"); + if (isAttr) + w.WriteStartAttribute("b"); + w.WriteValue(d); + w.WriteEndElement(); } + Assert.True((utils.CompareString(exp))); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorConditionWriter.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorConditionWriter.cs deleted file mode 100644 index 1ad85afea9..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorConditionWriter.cs +++ /dev/null @@ -1,356 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using OLEDB.Test.ModuleCore; - -namespace System.Xml.Tests -{ - public partial class TCErrorConditionWriter : XmlWriterTestCaseBase - { - // Type is System.Xml.Tests.TCErrorConditionWriter - // Test Case - public override void AddChildren() - { - // for function var_01 - { - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((Stream)null, ws)") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((XmlWriter)null)") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((TextWriter)null, ws)") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((StringBuilder)null, ws)") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((XmlWriter)null, ws)") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((Stream)null)") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((TextWriter)null)") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_01) { Attribute = new Variation("XmlWriter.Create((StringBuilder)null)") { Param = 3, Pri = 2 } }); - } - - - // for function var_02 - { - this.AddChild(new CVariation(var_02) { Attribute = new Variation("XmlWriter.WriteAttributes(null, false)") { Param = false, Pri = 2 } }); - this.AddChild(new CVariation(var_02) { Attribute = new Variation("XmlWriter.WriteAttributes(null, true)") { Param = true, Pri = 2 } }); - } - - - // for function var_03 - { - this.AddChild(new CVariation(var_03) { Attribute = new Variation("XmlWriter.WriteNode((XmlReader)null, true)") { Param = true, Pri = 2 } }); - this.AddChild(new CVariation(var_03) { Attribute = new Variation("XmlWriter.WriteNode((XmlReader)null, false)") { Param = false, Pri = 2 } }); - } - - - // for function var_04 - { - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteProcessingInstruction(null, null)") { Param = 13, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteNmToken(null)") { Param = 12, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteStartElement('a', null, null)") { Param = 20, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteAttributeString(null, null, null)") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteAttributeString('a', null, null, null)") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteAttributeString(null, null, 'a', null)") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteDocType(null, null, null, null)") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteElementString(null, null)") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteElementString(null, null, null)") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteElementString('a', null, null, null)") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteElementString('a', null, 'a', null)") { Param = 9, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteEntityRef(null)") { Param = 10, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteName(null)") { Param = 11, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteAttributeString(null, null)") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteQualifiedName(null, null)") { Param = 14, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteStartAttribute(null)") { Param = 15, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteStartAttribute(null, null)") { Param = 16, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteStartAttribute('a', null, null)") { Param = 17, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteStartElement(null)") { Param = 18, Pri = 2 } }); - this.AddChild(new CVariation(var_04) { Attribute = new Variation("XmlWriter.WriteStartElement(null, null)") { Param = 19, Pri = 2 } }); - } - - - // for function var_05 - { - this.AddChild(new CVariation(var_05) { Attribute = new Variation("XmlWriter.WriteValue((object)null)") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_05) { Attribute = new Variation("XmlWriter.WriteRaw(null)") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_05) { Attribute = new Variation("XmlWriter.WriteBinHex(null)") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_05) { Attribute = new Variation("XmlWriter.WriteBase64(null)") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_05) { Attribute = new Variation("XmlWriter.WriteChars(null)") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_05) { Attribute = new Variation("XmlWriter.LookupPrefix(null)") { Param = 4, Pri = 2 } }); - } - - - // for function var_07 - { - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteDocType('a', '\ud800', '\ud800', '\ud800')") { Param = 30, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteNmToken('\ud800')") { Param = 21, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteStartAttribute('a', '\ud800', '\ud800')") { Param = 26, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteStartElement('\ud800')") { Param = 27, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteStartElement('\ud800', '\ud800')") { Param = 28, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteStartElement('a', '\ud800', '\ud800')") { Param = 29, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteComment") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteDocType('a', 'b', '\ud800', '\ud800')") { Param = 31, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteDocType('a', 'b', 'c', '\ud800')") { Param = 32, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteAttributeString('a', '\ud800')") { Param = 33, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteElementString('a', '\ud800')") { Param = 34, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteProcessingInstruction('a', '\ud800')") { Param = 35, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteQualifiedName('a', '\ud800')") { Param = 36, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteRaw") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteName('\ud800')") { Param = 20, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteProcessingInstruction('\ud800', '\ud800')") { Param = 22, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteQualifiedName('\ud800', '\ud800')") { Param = 23, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteStartAttribute('\ud800')") { Param = 24, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteStartAttribute('\ud800', '\ud800')") { Param = 25, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteCharEntity") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteCData") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteEntityRef") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteString") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteSurrogateCharEntity") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteValue((string)null)") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteWhitespace") { Param = 9, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteAttributeString('\ud800', '\ud800')") { Param = 10, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteAttributeString('a', '\ud800', '\ud800')") { Param = 11, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteAttributeString('a', 'b', '\ud800', '\ud800')") { Param = 12, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteAttributeString('a', 'b', 'c', '\ud800')") { Param = 13, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteDocType('\ud800', '\ud800', '\ud800', '\ud800')") { Param = 14, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteElementString('\ud800', '\ud800')") { Param = 15, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteElementString('a', '\ud800', '\ud800')") { Param = 16, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteElementString('a', 'b', '\ud800', '\ud800')") { Param = 17, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteElementString('a', 'b', 'c', '\ud800')") { Param = 18, Pri = 2 } }); - this.AddChild(new CVariation(var_07) { Attribute = new Variation("XmlWriter.WriteEntityRef('\ud800')") { Param = 19, Pri = 2 } }); - } - - - // for function var_10 - { - this.AddChild(new CVariation(var_10) { Attribute = new Variation("XmlWriter:WriteRaw with wrong size throws wrong exception") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_10) { Attribute = new Variation("XmlWriter:WriteBase64 with wrong size throws wrong exception") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_10) { Attribute = new Variation("XmlWriter:WriteBinHex with wrong size throws wrong exception") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_10) { Attribute = new Variation("XmlWriter:WriteChars with wrong size throws wrong exception") { Param = 1, Pri = 2 } }); - } - - - // for function var_11 - { - this.AddChild(new CVariation(var_11) { Attribute = new Variation("XmlWriterSettings.ConformanceLevel - invalid values") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_11) { Attribute = new Variation("XmlWriterSettings.NewLineHandling - invalid values") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_11) { Attribute = new Variation("XmlWriterSettings.ConformanceLevel - invalid values") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_11) { Attribute = new Variation("XmlWriterSettings.NewLineHandling - invalid values") { Param = 4, Pri = 2 } }); - } - - - // for function var_12 - { - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((TextWriter), ws)") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((XmlWriter))") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((Stream), ws)") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((Stream))") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((StringBuilder), ws)") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((XmlWriter), ws)") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((TextWriter))") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_12) { Attribute = new Variation("XmlWriter.Create((StringBuilder)l)") { Param = 3, Pri = 2 } }); - } - - - // for function var_13 - { - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteElementString(String.Empty, String.Empty, String.Empty, String.Empty)") { Param = 14, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteStartElement(String.Empty, String.Empty, String.Empty)") { Param = 25, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteDocType(String.Empty, String.Empty, String.Empty, String.Empty)") { Param = 26, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteProcessingInstruction(String.Empty, String.Empty)") { Param = 27, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteAttributeString(String.Empty, String.Empty, 'String.Empty, String.Empty)") { Param = 10, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteDocType(String.Empty, String.Empty, String.Empty, String.Empty)") { Param = 11, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteStartElement(String.Empty, String.Empty)") { Param = 24, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteCData(String.Empty)") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteEntityRef(String.Empty)") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteRaw(String.Empty)") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteString(String.Empty)") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteValue(String.Empty)") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteWhitespace(String.Empty)") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteAttributeString(String.Empty)") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteAttributeString(String.Empty, String.Empty, String.Empty)") { Param = 9, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteElementString(String.Empty, String.Empty)") { Param = 12, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteElementString(String.Empty, String.Empty, String.Empty)") { Param = 13, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteComment(String.Empty)") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteEntityRef(String.Empty)") { Param = 15, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteName(String.Empty)") { Param = 16, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteNmToken(String.Empty)") { Param = 17, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteProcessingInstruction(String.Empty, String.Empty)") { Param = 18, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteQualifiedName(String.Empty, String.Empty)") { Param = 19, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteStartAttribute(String.Empty)") { Param = 20, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteStartAttribute(String.Empty, String.Empty)") { Param = 21, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteStartAttribute(String.Empty, String.Empty, String.Empty)") { Param = 22, Pri = 2 } }); - this.AddChild(new CVariation(var_13) { Attribute = new Variation("XmlWriter.WriteStartElement(String.Empty)") { Param = 23, Pri = 2 } }); - } - - - // for function var_14 - { - this.AddChild(new CVariation(var_14) { Attribute = new Variation("XmlWriterSettings.NewLineChars - invalid values") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_14) { Attribute = new Variation("XmlWriterSettings.IndentChars - invalid values") { Param = 1, Pri = 2 } }); - } - - - // for function var_15 - { - this.AddChild(new CVariation(var_15) { Attribute = new Variation("XmlWriter properties after Dispose") { Pri = 2 } }); - } - - - // for function var_16 - { - this.AddChild(new CVariation(var_16) { Attribute = new Variation("XmlWriter properties after Error") { Pri = 2 } }); - } - - - // for function bug601305 - { - this.AddChild(new CVariation(bug601305) { Attribute = new Variation("601305 XmlWriter.WriteStartElement() should inspect attributes before emitting the element tag") { Pri = 2 } }); - } - - - // for function var17 - { - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.CheckCharacters - readonly") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.Indent - readonly") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.IndentChars - readonly") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.OmitXmlDeclaration - readonly") { Param = 10, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.CloseOutput - readonly") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.ConformanceLevel - readonly") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.Encoding - readonly") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.NewLineChars - readonly") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.NewLineHandling - readonly") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var17) { Attribute = new Variation("writer.Settings.NewLineOnAttributes - readonly") { Param = 9, Pri = 2 } }); - } - - - // for function var_18 - { - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteName after close") { Param = 17, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteStartElement after close") { Param = 25, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteString after close") { Param = 26, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteSurrogateCharEntity after close") { Param = 27, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteValue after close") { Param = 28, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteWhitespace after close") { Param = 29, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteNmToken after close") { Param = 18, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteNode after close") { Param = 19, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteProcessingInstruction after close") { Param = 20, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteEntityRef after close") { Param = 15, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteFullEndElement after close") { Param = 16, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteRaw(string) after close") { Param = 21, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteRaw(buffer) after close") { Param = 22, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteStartAttribute after close") { Param = 23, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteStartDocument after close") { Param = 24, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteQualifiedName after close") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteAttributes after close") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteAttributeString after close") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteBase64 after close") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteBinHex after close") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteCData after close") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteCharEntity after close") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteChars after close") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteComment after close") { Param = 9, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteDocType after close") { Param = 10, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteElementString after close") { Param = 11, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteEndAttribute after close") { Param = 12, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteEndDocument after close") { Param = 13, Pri = 2 } }); - this.AddChild(new CVariation(var_18) { Attribute = new Variation("WriteEndElement after close") { Param = 14, Pri = 2 } }); - } - - - // for function var_19 - { - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteQualifiedName after error") { Param = 1, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteStartDocument after error") { Param = 24, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteString after error") { Param = 26, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteSurrogateCharEntity after error") { Param = 27, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteValue after error") { Param = 28, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteWhitespace after error") { Param = 29, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteElementString after error") { Param = 11, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteStartElement after error") { Param = 25, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteAttributes after error") { Param = 2, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteAttributeString after error") { Param = 3, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteBase64 after error") { Param = 4, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteBinHex after error") { Param = 5, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteCData after error") { Param = 6, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteCharEntity after error") { Param = 7, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteChars after error") { Param = 8, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteComment after error") { Param = 9, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteDocType after error") { Param = 10, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteName after error") { Param = 17, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteStartAttribute after error") { Param = 23, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteEndDocument after error") { Param = 13, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteEndElement after error") { Param = 14, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteEntityRef after error") { Param = 15, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteFullEndElement after error") { Param = 16, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteEndAttribute after error") { Param = 12, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteNmToken after error") { Param = 18, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteNode after error") { Param = 19, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteProcessingInstruction after error") { Param = 20, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteRaw(string) after error") { Param = 21, Pri = 2 } }); - this.AddChild(new CVariation(var_19) { Attribute = new Variation("WriteRaw(buffer) after error") { Param = 22, Pri = 2 } }); - } - - - // for function var_20 - { - this.AddChild(new CVariation(var_20) { Attribute = new Variation("504503:Assert when write attribute value with invalid surrogate pair and encoding ASCII") }); - } - - - // for function var_21 - { - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteString attr swap surrogate pair") { Param = 33 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteQualifiedName1 swap surrogate pair") { Param = 23 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteStartAttribute2 swap surrogate pair") { Param = 26 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteStartAttribute3 swap surrogate pair") { Param = 27 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteStartElemen1 swap surrogate pair") { Param = 28 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteStartElemen2 swap surrogate pair") { Param = 29 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteStartElemen3 swap surrogate pair") { Param = 30 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteString swap surrogate pair") { Param = 31 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteWhitespace swap surrogate pair") { Param = 32 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteValue attr swap surrogate pair") { Param = 1 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteSurrogateCharEntity swap surrogate pair") { Param = 34 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteValue elem swap surrogate pair") { Param = 6 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteNmToken swap surrogate pair") { Param = 22 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteComment attr swap surrogate pair") { Param = 2 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteQualifiedName2 swap surrogate pair") { Param = 24 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteStartAttribute1 swap surrogate pair") { Param = 25 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteCData attr swap surrogate pair") { Param = 3 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteProcessingInstruction attr swap surrogate pair") { Param = 4 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteRaw attr swap surrogate pair") { Param = 5 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteComment elem swap surrogate pair") { Param = 7 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteCData elem swap surrogate pair") { Param = 8 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteProcessingInstruction elem swap surrogate pair") { Param = 9 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteRaw elem swap surrogate pair") { Param = 10 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteAttributeString swap surrogate pair") { Param = 11 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteCharEntity swap surrogate pair") { Param = 12 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteDocType pubid swap surrogate pair") { Param = 13 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteDocType sysid swap surrogate pair") { Param = 14 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteDocType subset swap surrogate pair") { Param = 15 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteElementString1 swap surrogate pair") { Param = 16 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteElementString2 swap surrogate pair") { Param = 17 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteElementString3 swap surrogate pair") { Param = 18 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteElementString4 swap surrogate pair") { Param = 19 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteEntityRef swap surrogate pair") { Param = 20 } }); - this.AddChild(new CVariation(var_21) { Attribute = new Variation("WriteName swap surrogate pair") { Param = 21 } }); - } - - - // for function bug600541 - { - this.AddChild(new CVariation(bug600541) { Attribute = new Variation("System.Xml.XmlWriter::WriteAttributes") { Param = 2 } }); - this.AddChild(new CVariation(bug600541) { Attribute = new Variation("System.Xml.XmlWriter::WriteAttributes") { Param = 3 } }); - this.AddChild(new CVariation(bug600541) { Attribute = new Variation("System.Xml.XmlWriter::WriteAttributes") { Param = 1 } }); - this.AddChild(new CVariation(bug600541) { Attribute = new Variation("System.Xml.XmlWriter::WriteAttributes") { Param = 4 } }); - } - - - // for function bug630890 - { - this.AddChild(new CVariation(bug630890) { Attribute = new Variation("Schema.XmlUntypedStringConverter::ToString") }); - } - - - // for function PassingArrayWithNullOrEmptyItemsCausesWriteValueToFail - { - this.AddChild(new CVariation(PassingArrayWithNullOrEmptyItemsCausesWriteValueToFail) { Attribute = new Variation("PassingArrayWithNullOrEmptyItemsCausesWriteValueToFail:XMLWriter.WriteValue fails with ArgumentNullException if passed an array which has null/empty items") }); - } - } - } -} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorState.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorState.cs index 55954969d6..4c0d219d3c 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorState.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCErrorState.cs @@ -1,87 +1,301 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCErrorState : XmlWriterTestCaseBase + //[TestCase(Name = "Invalid State Combinations", Pri = 1)] + public class TCErrorState { - // Type is System.Xml.Tests.TCErrorState - // Test Case - public override void AddChildren() + // EntityRef after Document should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void state_1(XmlWriterUtils utils) { - // for function state_1 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_1) { Attribute = new Variation("EntityRef after Document should error - PROLOG") { id = 1, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteEntityRef("ent"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_2 + // EntityRef after Document should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void state_2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_2) { Attribute = new Variation("EntityRef after Document should error - EPILOG") { id = 2, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteEntityRef("ent"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_3 + // CharEntity after Document should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void state_3(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_3) { Attribute = new Variation("CharEntity after Document should error - PROLOG") { id = 3, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteCharEntity('\uD23E'); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_4 + // CharEntity after Document should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void state_4(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_4) { Attribute = new Variation("CharEntity after Document should error - EPILOG") { id = 4, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteCharEntity('\uD23E'); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_5 + // SurrogateCharEntity after Document should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void state_5(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_5) { Attribute = new Variation("SurrogateCharEntity after Document should error - PROLOG") { id = 5, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteSurrogateCharEntity('\uDF41', '\uD920'); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_6 + // SurrogateCharEntity after Document should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void state_6(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_6) { Attribute = new Variation("SurrogateCharEntity after Document should error - EPILOG") { id = 6, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteSurrogateCharEntity('\uDF41', '\uD920'); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_7 + // Attribute after Document should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void state_7(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_7) { Attribute = new Variation("Attribute after Document should error - PROLOG") { id = 7, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartAttribute("attr", ""); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_8 + // Attribute after Document should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void state_8(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_8) { Attribute = new Variation("Attribute after Document should error - EPILOG") { id = 8, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteStartAttribute("attr", ""); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_9 + // CDATA after Document should error - PROLOG + [Theory] + [XmlWriterInlineData] + public void state_9(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_9) { Attribute = new Variation("CDATA after Document should error - PROLOG") { id = 9, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteCData("Invalid"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + return; + } - - // for function state_10 + // CDATA after Document should error - EPILOG + [Theory] + [XmlWriterInlineData] + public void state_10(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_10) { Attribute = new Variation("CDATA after Document should error - EPILOG") { id = 10, Pri = 1 } }); + try + { + w.WriteStartDocument(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteCData("Invalid"); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_11 + // Element followed by Document should error + [Theory] + [XmlWriterInlineData] + public void state_11(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_11) { Attribute = new Variation("Element followed by Document should error") { id = 11, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteStartDocument(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } - - // for function state_12 + // Element followed by DocType should error + [Theory] + [XmlWriterInlineData] + public void state_12(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(state_12) { Attribute = new Variation("Element followed by DocType should error") { id = 12, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteDocType("Test", null, null, ""); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFlushClose.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFlushClose.cs index 356a91762b..0aced7e95f 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFlushClose.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFlushClose.cs @@ -1,38 +1,184 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.IO; +using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCFlushClose : XmlFactoryWriterTestCaseBase + public class TCFlushClose { - // Type is System.Xml.Tests.TCFlushClose - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom, true)] + [XmlWriterInlineData(WriterType.AllButCustom, false)] + public void flush_1(XmlWriterUtils utils, bool closeOutput) { - if (WriterType == WriterType.CustomWriter) + Stream writerStream = new MemoryStream(); + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.NewLineChars = "\r\n"; + XmlWriter w = null; + long expectedLength = 0; + wSettings.CloseOutput = closeOutput; + + switch (utils.WriterType) { - return; - } - // for function flush_1 - { - this.AddChild(new CVariation(flush_1) { Attribute = new Variation("Verify Flush() flushes underlying stream when CloseOutput = false") { Param = "false", id = 2, Pri = 1 } }); + case WriterType.WrappedWriter: + expectedLength = 113; + XmlWriter ww = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + w = WriterHelper.Create(ww, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.CharCheckingWriter: + expectedLength = 113; + XmlWriter w1 = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + XmlWriterSettings ws1 = new XmlWriterSettings(); + ws1.CheckCharacters = true; + w = WriterHelper.Create(w1, ws1, overrideAsync: true, async: utils.Async); + break; + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + expectedLength = 113; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + expectedLength = 224; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.UTF8WriterIndent: + wSettings.Encoding = Encoding.UTF8; + expectedLength = 125; + wSettings.Indent = true; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.UnicodeWriterIndent: + wSettings.Encoding = Encoding.Unicode; + expectedLength = 248; + wSettings.Indent = true; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + default: + Assert.True(false, "unknown writer"); + break; } + wSettings.CloseOutput = closeOutput; - // for function close_1 + var beginning = writerStream.Length; + + try { - this.AddChild(new CVariation(close_1) { Attribute = new Variation("Verify Close() flushes underlying stream when CloseOutput = false") { Param = "false", id = 4, Pri = 1 } }); + w.WriteStartElement("root"); + w.WriteStartElement("OneChar"); + w.WriteAttributeString("a", "myAttribute"); + w.WriteString("a"); + w.WriteEndElement(); + + w.WriteStartElement("twoChars"); + w.WriteString("ab"); + w.WriteEndElement(); + w.WriteEndElement(); + + Assert.Equal(writerStream.Length, beginning); + + w.Flush(); + + Assert.Equal(expectedLength, writerStream.Length); + } + finally + { + w.Dispose(); + writerStream.Dispose(); + } + } + + [Theory] + [XmlWriterInlineData(WriterType.NoAsync | WriterType.UTF8Writer | WriterType.UnicodeWriter)] + public void close_1(XmlWriterUtils utils) + { + Stream writerStream = new MemoryStream(); + XmlWriterSettings wSettings = new XmlWriterSettings(); + + long expectedLength1 = 0; + long expectedLength2 = 0; + + switch (utils.WriterType) + { + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + expectedLength1 = 83; + expectedLength2 = 113; + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + expectedLength1 = 164; + expectedLength2 = 224; + break; } + wSettings.CloseOutput = false; - // for function close_2 + XmlWriter w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + + try { - this.AddChild(new CVariation(close_2) { Attribute = new Variation("Verify WriterSettings after Close()") { id = 5, Pri = 1 } }); + var beginning = writerStream.Length; + + w.WriteStartElement("root"); + w.WriteStartElement("OneChar"); + w.WriteAttributeString("a", "myAttribute"); + w.WriteString("a"); + w.WriteEndElement(); + + CError.WriteLine("File Size Before Flush: {0}", writerStream.Length); + CError.Compare(writerStream.Length, beginning, "Before Flush"); + + // Flush mid-way + w.Flush(); + CError.WriteLine("File Size After Flush: {0}", writerStream.Length); + CError.Compare(writerStream.Length, expectedLength1, "After Flush"); + + w.WriteStartElement("twoChars"); + w.WriteString("ab"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + + // Now check that Close() called Flush() + CError.WriteLine("File Size After Writer.Close: {0}", writerStream.Length); + CError.Compare(writerStream.Length, expectedLength2, "After Writer.Close"); + + // Finally, close the underlying stream, it should be flushed now + writerStream.Flush(); + CError.WriteLine("File Size After Stream.Close: {0}", writerStream.Length); + CError.Compare(writerStream.Length, expectedLength2, "After Stream.Close"); } + catch (XmlException) + { + Assert.True(false); + } + finally + { + if (writerStream != null) + writerStream.Dispose(); + if (w != null) + w.Dispose(); + } + + return; + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void close_2(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(); + w.Dispose(); + CError.Equals(w.Settings.Indent, utils.IsIndent(), "Incorrect default value of Indent"); + CError.Equals(w.Settings.CheckCharacters, true, "Incorrect default value of CheckCharacters"); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFragmentCL.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFragmentCL.cs index c2a4b14329..bc9cabc66a 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFragmentCL.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFragmentCL.cs @@ -1,68 +1,137 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; -using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCFragmentCL : XmlFactoryWriterTestCaseBase + public class TCFragmentCL { - // Type is System.Xml.Tests.TCFragmentCL - // Test Case - public override void AddChildren() + // Multiple root elements should be allowed + [Theory] + [XmlWriterInlineData] + public void frag_1(XmlWriterUtils utils) { - if (WriterType == WriterType.CustomWriter) + XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareReader("")); + } + + // Top level text should be allowed - PROLOG + [Theory] + [XmlWriterInlineData] + public void frag_2(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment); + w.WriteString("Top level text"); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareReader("Top level text")); + } + + // Top level text should be allowed - EPILOG + [Theory] + [XmlWriterInlineData] + public void frag_3(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteString("Top level text"); + w.Dispose(); + Assert.True(utils.CompareReader("Top level text")); + } + + // Top level atomic value should be allowed - PROLOG + [Theory] + [XmlWriterInlineData] + public void frag_4(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment); + int i = 1; + w.WriteValue(i); + w.WriteElementString("Root", "test"); + w.Dispose(); + Assert.True(utils.CompareReader("1test")); + } + + // Top level atomic value should be allowed - EPILOG + [Theory] + [XmlWriterInlineData] + public void frag_5(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment); + w.WriteElementString("Root", "test"); + int i = 1; + w.WriteValue(i); + w.Dispose(); + Assert.True(utils.CompareReader("test1")); + } + + // Multiple top level atomic values + [Theory] + [XmlWriterInlineData] + public void frag_6(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment); + int i = 1; + w.WriteValue(i); w.WriteValue(i); w.WriteValue(i); w.WriteValue(i); + w.WriteStartElement("Root"); + w.WriteEndElement(); + w.WriteValue(i); w.WriteValue(i); w.WriteValue(i); w.WriteValue(i); + w.Dispose(); + Assert.True(utils.CompareReader("11111111")); + } + + // WriteDocType should error when CL=fragment + [Theory] + [XmlWriterInlineData] + public void frag_7(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment)) { - return; + try + { + w.WriteDocType("ROOT", "publicid", "sysid", ""); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } - // for function frag_1 + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // WriteStartDocument() should error when CL=fragment + [Theory] + [XmlWriterInlineData] + public void frag_8(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter(ConformanceLevel.Fragment)) { - this.AddChild(new CVariation(frag_1) { Attribute = new Variation("Multiple root elements should be allowed") { id = 1, Pri = 1 } }); - } - - - // for function frag_2 - { - this.AddChild(new CVariation(frag_2) { Attribute = new Variation("Top level text should be allowed - PROLOG") { id = 2, Pri = 1 } }); - } - - - // for function frag_3 - { - this.AddChild(new CVariation(frag_3) { Attribute = new Variation("Top level text should be allowed - EPILOG") { id = 3, Pri = 1 } }); - } - - - // for function frag_4 - { - this.AddChild(new CVariation(frag_4) { Attribute = new Variation("Top level atomic value should be allowed - PROLOG") { id = 4, Pri = 1 } }); - } - - - // for function frag_5 - { - this.AddChild(new CVariation(frag_5) { Attribute = new Variation("Top level atomic value should be allowed - EPILOG") { id = 5, Pri = 1 } }); - } - - - // for function frag_6 - { - this.AddChild(new CVariation(frag_6) { Attribute = new Variation("Multiple top level atomic values") { id = 6, Pri = 1 } }); - } - - - // for function frag_7 - { - this.AddChild(new CVariation(frag_7) { Attribute = new Variation("WriteDocType should error when CL=fragment") { id = 7, Pri = 1 } }); - } - - - // for function frag_8 - { - this.AddChild(new CVariation(frag_8) { Attribute = new Variation("WriteStartDocument() should error when CL=fragment") { id = 8, Pri = 1 } }); + try + { + w.WriteStartDocument(); + } + catch (InvalidOperationException e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs.REMOVED.git-id index 935c6c59ce..98532f95ef 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs.REMOVED.git-id @@ -1 +1 @@ -d02a9a62b3cc9070b626660d4d4e8b745929c340 \ No newline at end of file +afb534ae18d226b6299692bf9d4ce8f122ed5b94 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndent.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndent.cs index 5c32865c46..ab1b54f2d0 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndent.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndent.cs @@ -1,209 +1,627 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.Text; +using Xunit; using XmlCoreTest.Common; namespace System.Xml.Tests { - public partial class TCIndent : XmlFactoryWriterTestCaseBase + public class TCIndent { - // Type is System.Xml.Tests.TCIndent - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData(WriterType.AllButIndenting & WriterType.AllButCustom)] + public void indent_1(XmlWriterUtils utils) { - if (WriterType == WriterType.CustomWriter) + XmlWriter w = utils.CreateWriter(); + CError.Compare(w.Settings.Indent, false, "Mismatch in Indent"); + w.WriteStartElement("Root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_2(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("Root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + "")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_3(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(); + w.WriteStartElement("Root"); + w.WriteString(""); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("")); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void indent_4(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.Indent, true, "Mismatch in Indent"); + w.WriteStartElement("Root"); + w.WriteString(""); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_5(XmlWriterUtils utils) + { + XmlWriter w = utils.CreateWriter(); + w.WriteStartElement("Root"); + w.WriteString(""); + w.WriteFullEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_6(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("Root"); + w.WriteString(""); + w.WriteFullEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_7(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("Root"); + w.WriteString("test"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("test")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_8(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("Root"); + w.WriteString("test"); + w.WriteStartElement("child"); + w.WriteFullEndElement(); + w.WriteFullEndElement(); + w.Dispose(); + Assert.True(utils.CompareString("test")); + } + + [Theory] + [XmlWriterInlineData] + public void indent_9(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteProcessingInstruction("xml", "version=\"1.0\""); + w.WriteDocType("root", null, null, "foo"); + w.WriteStartElement("root"); + w.WriteProcessingInstruction("pi", "pi"); + w.WriteComment("comment"); + w.WriteElementString("foo", ""); + w.WriteEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + "" + wSettings.NewLineChars + "" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + ""), ""); + return; + } + + // Mixed content after child + [Theory] + [XmlWriterInlineData] + public void indent_10(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("master"); + w.WriteStartElement("root"); + w.WriteStartElement("foo"); + w.WriteString("text"); + w.WriteEndElement(); + w.WriteEndElement(); + w.WriteString("text"); + w.WriteStartElement("foo"); + w.WriteElementString("bar", "text2"); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " text" + wSettings.NewLineChars + " texttext2"), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_11(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("root"); + w.WriteCData("text"); + w.WriteElementString("foo", ""); + w.WriteEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString(""), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_12(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("root"); + w.WriteWhitespace(" "); + w.WriteElementString("foo", ""); + w.WriteEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString(" "), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_13(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("root"); + w.WriteRaw("text"); + w.WriteElementString("foo", ""); + w.WriteEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString("text"), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_14(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("root"); + w.WriteEntityRef("e"); + w.WriteElementString("foo", ""); + w.WriteEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString("&e;"), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_15(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("e1"); + w.WriteStartElement("e2"); + w.WriteStartElement("e3"); + w.WriteStartElement("e4"); + w.WriteEndDocument(); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + ""), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_16(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("e1"); + w.WriteStartElement("e2"); + w.WriteStartElement("e3"); + w.WriteStartElement("e4"); + w.WriteEndElement(); + w.WriteEndElement(); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + ""), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_17(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("e1"); + w.WriteStartElement("e2"); + w.WriteStartElement("e3"); + w.WriteStartElement("e4"); + w.WriteFullEndElement(); + w.WriteFullEndElement(); + w.WriteFullEndElement(); + w.WriteFullEndElement(); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + ""), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_18(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteElementString("root", ""); + w.WriteComment("c"); + w.WriteProcessingInstruction("pi", "pi"); + w.WriteWhitespace(" "); + w.WriteComment("c"); + w.WriteProcessingInstruction("pi", "pi"); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + "" + wSettings.NewLineChars + " "), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_19(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartElement("root"); + w.WriteAttributeString("a1", "value"); + w.WriteStartElement("foo"); + w.WriteAttributeString("a2", "value"); + w.WriteEndDocument(); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + ""), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_20(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartDocument(); + w.WriteProcessingInstruction("pi", "value"); + w.WriteStartElement("root"); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + ""), ""); + return; + } + + [Theory] + [XmlWriterInlineData] + public void indent_21(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + + XmlWriter w = utils.CreateWriter(wSettings); + w.WriteStartDocument(); + w.WriteComment("value"); + w.WriteStartElement("root"); + w.Dispose(); + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + ""), ""); + return; + } + + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + public void indent_22(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; + + using (XmlWriter w = utils.CreateWriter(wSettings)) { - return; + w.WriteStartElement("root"); + w.WriteString("text"); + w.WriteStartElement("child"); + w.WriteProcessingInstruction("pi", "value"); } - // for function indent_1 + CError.Compare(utils.CompareString("text"), ""); + return; + } + + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + public void indent_24(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; + + using (XmlWriter w = utils.CreateWriter(wSettings)) { - this.AddChild(new CVariation(indent_1) { Attribute = new Variation("Simple test when false") { id = 1, Pri = 0 } }); + w.WriteStartElement("root"); + w.WriteString("text"); + w.WriteStartElement("child"); + w.WriteComment("value"); } + CError.Compare(utils.CompareString("text"), ""); + return; + } + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + public void indent_26(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; - // for function indent_2 + using (XmlWriter w = utils.CreateWriter(wSettings)) { - this.AddChild(new CVariation(indent_2) { Attribute = new Variation("Simple test when true") { id = 2, Pri = 0 } }); + w.WriteStartElement("root"); + w.WriteStartElement("child"); + w.WriteStartElement("a"); + w.WriteEndElement(); + w.WriteString("text"); + w.WriteStartElement("a"); } + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " text" + wSettings.NewLineChars + ""), ""); + return; + } - - // for function indent_3 + [Theory] + [XmlWriterInlineData] + public void indent_28(XmlWriterUtils utils) + { + // The output should be the same for ConformanceLevel.Document/Auto + // and with WriteStartDocument called or not + int i; + for (i = 0; i < 4; i++) { - this.AddChild(new CVariation(indent_3) { Attribute = new Variation("Indent = false, element content is empty") { id = 3, Pri = 0 } }); + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.ConformanceLevel = (i % 2) == 0 ? ConformanceLevel.Auto : ConformanceLevel.Document; + CError.WriteLine("ConformanceLevel: {0}", wSettings.ConformanceLevel.ToString()); + + using (XmlWriter w = utils.CreateWriter(wSettings)) + { + if (i > 1) + { + CError.WriteLine("WriteStartDocument called."); + w.WriteStartDocument(); + } + else + { + CError.WriteLine("WriteStartDocument not called."); + } + w.WriteStartElement("root"); + } + CError.Compare(utils.CompareString(""), ""); } + return; + } - - // for function indent_4 + // First element - with decl + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void indent_29(XmlWriterUtils utils) + { + // The output should be the same for ConformanceLevel.Document/Auto + int i; + for (i = 0; i < 2; i++) { - this.AddChild(new CVariation(indent_4) { Attribute = new Variation("Indent = true, element content is empty") { id = 4, Pri = 0 } }); + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = false; + wSettings.Indent = true; + wSettings.ConformanceLevel = (i % 2) == 0 ? ConformanceLevel.Auto : ConformanceLevel.Document; + CError.WriteLine("ConformanceLevel: {0}", wSettings.ConformanceLevel.ToString()); + + XmlWriter w = utils.CreateWriter(wSettings); + Encoding encoding = w.Settings.Encoding; + if (wSettings.ConformanceLevel == ConformanceLevel.Auto) + { + // Write the decl as PI - since WriteStartDocument would switch to Document mode + w.WriteProcessingInstruction("xml", string.Format("version=\"1.0\" encoding=\"{0}\"", encoding.WebName)); + } + else + { + w.WriteStartDocument(); + } + w.WriteStartElement("root"); + w.Dispose(); + string expectedResult = string.Format("" + wSettings.NewLineChars + "", encoding.WebName); + CError.Compare(utils.CompareString(expectedResult), ""); } + } + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + [XmlWriterInlineData(ConformanceLevel.Fragment)] + public void indent_30(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; - // for function indent_5 + using (XmlWriter w = utils.CreateWriter(wSettings)) { - this.AddChild(new CVariation(indent_5) { Attribute = new Variation("Indent = false, element content is empty, FullEndElement") { id = 5, Pri = 0 } }); + w.WriteStartElement("root"); + w.WriteStartElement("e1"); + w.WriteStartElement("e2"); + w.WriteEndElement(); + w.WriteString("text"); + w.WriteEndElement(); + w.WriteEndElement(); } + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " text" + wSettings.NewLineChars + ""), ""); + return; + } + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + public void indent_33(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; - // for function indent_6 + using (XmlWriter w = utils.CreateWriter(wSettings)) { - this.AddChild(new CVariation(indent_6) { Attribute = new Variation("Indent = true, element content is empty, FullEndElement") { id = 6, Pri = 0 } }); + w.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); + w.WriteProcessingInstruction("piname1", "pitext1"); + w.WriteProcessingInstruction("piname2", "pitext2"); + w.WriteStartElement("root"); + w.WriteEndElement(); } + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + "" + wSettings.NewLineChars + "" + wSettings.NewLineChars + ""), ""); + return; + } + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + public void indent_36(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; - // for function indent_7 + using (XmlWriter w = utils.CreateWriter(wSettings)) { - this.AddChild(new CVariation(indent_7) { Attribute = new Variation("Indent = true, mixed content") { id = 7, Pri = 0 } }); + w.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); + w.WriteDocType("name", "publicid", "systemid", "subset"); + w.WriteProcessingInstruction("piname1", "pitext1"); + w.WriteProcessingInstruction("piname2", "pitext2"); + w.WriteStartElement("root"); } + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + "" + wSettings.NewLineChars + "" + wSettings.NewLineChars + "" + wSettings.NewLineChars + ""), ""); + return; + } + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + [XmlWriterInlineData(ConformanceLevel.Fragment)] + public void indent_39(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.ConformanceLevel = conformanceLevel; - // for function indent_8 + using (XmlWriter w = utils.CreateWriter(wSettings)) { - this.AddChild(new CVariation(indent_8) { Attribute = new Variation("Indent = true, mixed content, FullEndElement") { id = 8, Pri = 0 } }); - } - - - // for function indent_9 - { - this.AddChild(new CVariation(indent_9) { Attribute = new Variation("Other types of non-text nodes") { id = 9, Priority = 0 } }); - } - - - // for function indent_10 - { - this.AddChild(new CVariation(indent_10) { Attribute = new Variation("Mixed content after child") { id = 10, Priority = 0 } }); - } - - - // for function indent_11 - { - this.AddChild(new CVariation(indent_11) { Attribute = new Variation("Mixed content - CData") { id = 11, Priority = 0 } }); - } - - - // for function indent_12 - { - this.AddChild(new CVariation(indent_12) { Attribute = new Variation("Mixed content - Whitespace") { id = 12, Priority = 0 } }); - } - - - // for function indent_13 - { - this.AddChild(new CVariation(indent_13) { Attribute = new Variation("Mixed content - Raw") { id = 13, Priority = 0 } }); - } - - - // for function indent_14 - { - this.AddChild(new CVariation(indent_14) { Attribute = new Variation("Mixed content - EntityRef") { id = 14, Priority = 0 } }); - } - - - // for function indent_15 - { - this.AddChild(new CVariation(indent_15) { Attribute = new Variation("Nested Elements - with EndDocument") { id = 15, Priority = 0 } }); - } - - - // for function indent_16 - { - this.AddChild(new CVariation(indent_16) { Attribute = new Variation("Nested Elements - with EndElement") { id = 16, Priority = 0 } }); - } - - - // for function indent_17 - { - this.AddChild(new CVariation(indent_17) { Attribute = new Variation("Nested Elements - with FullEndElement") { id = 17, Priority = 0 } }); - } - - - // for function indent_18 - { - this.AddChild(new CVariation(indent_18) { Attribute = new Variation("NewLines after root element") { id = 18, Priority = 0 } }); - } - - - // for function indent_19 - { - this.AddChild(new CVariation(indent_19) { Attribute = new Variation("Elements with attributes") { id = 19, Priority = 0 } }); - } - - - // for function indent_20 - { - this.AddChild(new CVariation(indent_20) { Attribute = new Variation("First PI with start document no xmldecl") { id = 20, Priority = 1 } }); - } - - - // for function indent_21 - { - this.AddChild(new CVariation(indent_21) { Attribute = new Variation("First comment with start document no xmldecl") { id = 21, Priority = 1 } }); - } - - - // for function indent_22 - { - this.AddChild(new CVariation(indent_22) { Attribute = new Variation("PI in mixed content - Auto") { Param = 0, id = 23, Priority = 1 } }); - this.AddChild(new CVariation(indent_22) { Attribute = new Variation("PI in mixed content - Document") { Param = 2, id = 22, Priority = 1 } }); - } - - - // for function indent_24 - { - this.AddChild(new CVariation(indent_24) { Attribute = new Variation("Comment in mixed content - Document") { Param = 2, id = 24, Priority = 1 } }); - this.AddChild(new CVariation(indent_24) { Attribute = new Variation("Comment in mixed content - Auto") { Param = 0, id = 25, Priority = 1 } }); - } - - - // for function indent_26 - { - this.AddChild(new CVariation(indent_26) { Attribute = new Variation("Mixed content after end element - Auto") { Param = 0, id = 27, Priority = 1 } }); - this.AddChild(new CVariation(indent_26) { Attribute = new Variation("Mixed content after end element - Document") { Param = 2, id = 26, Priority = 1 } }); - } - - - // for function indent_28 - { - this.AddChild(new CVariation(indent_28) { Attribute = new Variation("First element - no decl") { id = 28, Priority = 1 } }); - } - - - // for function indent_29 - { - this.AddChild(new CVariation(indent_29) { Attribute = new Variation("First element - with decl") { Param = true, id = 29, Priority = 1 } }); - } - - - // for function indent_30 - { - this.AddChild(new CVariation(indent_30) { Attribute = new Variation("Bad indentation of elements with mixed content data - Fragment") { Param = 1, id = 32, Priority = 1 } }); - this.AddChild(new CVariation(indent_30) { Attribute = new Variation("Bad indentation of elements with mixed content data - Document") { Param = 2, id = 30, Priority = 1 } }); - this.AddChild(new CVariation(indent_30) { Attribute = new Variation("Bad indentation of elements with mixed content data - Auto") { Param = 0, id = 31, Priority = 1 } }); - } - - - // for function indent_33 - { - this.AddChild(new CVariation(indent_33) { Attribute = new Variation("Indentation error - no new line after PI only if document contains no DocType node - Document") { Param = 2, id = 33, Priority = 1 } }); - this.AddChild(new CVariation(indent_33) { Attribute = new Variation("Indentation error - no new line after PI only if document contains no DocType node - Auto") { Param = 0, id = 34, Priority = 1 } }); - } - - - // for function indent_36 - { - this.AddChild(new CVariation(indent_36) { Attribute = new Variation("Indentation error - no new line after PI only if document contains DocType node - Document") { Param = 2, id = 36, Priority = 1 } }); - this.AddChild(new CVariation(indent_36) { Attribute = new Variation("Indentation error - no new line after PI only if document contains DocType node - Auto") { Param = 0, id = 37, Priority = 1 } }); - } - - - // for function indent_39 - { - this.AddChild(new CVariation(indent_39) { Attribute = new Variation("Auto") { Param = 0, id = 40, Priority = 1 } }); - this.AddChild(new CVariation(indent_39) { Attribute = new Variation("Fragment") { Param = 1, id = 41, Priority = 1 } }); - this.AddChild(new CVariation(indent_39) { Attribute = new Variation("Document") { Param = 2, id = 39, Priority = 1 } }); + w.WriteProcessingInstruction("piname1", "pitext1"); + w.WriteComment("comment1"); + w.WriteProcessingInstruction("piname2", "pitext2"); + w.WriteStartElement("root"); + w.WriteStartElement("e1"); + w.WriteStartElement("e2"); + w.WriteStartElement("e3"); + w.WriteStartElement("e4"); + w.WriteEndElement(); + w.WriteString("text1"); + w.WriteProcessingInstruction("piname3", "pitext3"); + w.WriteEndElement(); + w.WriteComment("comment2"); + w.WriteCData("cdata1"); + w.WriteString("text2"); + w.WriteProcessingInstruction("piname4", "pitext4"); + w.WriteCData("cdata2"); + w.WriteComment("comment3"); + w.WriteProcessingInstruction("piname5", "pitext5"); + w.WriteEndElement(); + w.WriteEndElement(); } + CError.Compare(utils.CompareString("" + wSettings.NewLineChars + "" + wSettings.NewLineChars + "" + wSettings.NewLineChars + "" + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " " + wSettings.NewLineChars + " text1" + wSettings.NewLineChars + " text2" + wSettings.NewLineChars + " " + wSettings.NewLineChars + ""), ""); + return; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndentChars.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndentChars.cs index 5d12d9bc0c..d4bdd96e61 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndentChars.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCIndentChars.cs @@ -1,59 +1,137 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using OLEDB.Test.ModuleCore; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCIndentChars : XmlFactoryWriterTestCaseBase + public class TCIndentChars { - // Type is System.Xml.Tests.TCIndentChars - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void IndentChars_1(XmlWriterUtils utils) { - if (WriterType == WriterType.CustomWriter) + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.IndentChars = "\x9"; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.IndentChars, "\x9", "Mismatch in IndentChars"); + w.WriteStartElement("root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + + Assert.True(utils.CompareString("" + wSettings.NewLineChars + "\x9" + wSettings.NewLineChars + "")); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void IndentChars_2(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.IndentChars = " "; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.IndentChars, " ", "Mismatch in IndentChars"); + w.WriteStartElement("root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + + Assert.True(utils.CompareString("" + wSettings.NewLineChars + " " + wSettings.NewLineChars + "")); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void IndentChars_3(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.IndentChars = "\xA"; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.IndentChars, "\xA", "Mismatch in IndentChars"); + w.WriteStartElement("root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + + Assert.True(utils.CompareString("" + wSettings.NewLineChars + "\xA" + wSettings.NewLineChars + "")); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void IndentChars_4(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.IndentChars = "\xD"; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.IndentChars, "\xD", "Mismatch in IndentChars"); + w.WriteStartElement("root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + + Assert.True(utils.CompareString("" + wSettings.NewLineChars + "\xD" + wSettings.NewLineChars + "")); + } + + [Theory] + [XmlWriterInlineData(WriterType.AllButCustom)] + public void IndentChars_5(XmlWriterUtils utils) + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.OmitXmlDeclaration = true; + wSettings.Indent = true; + wSettings.IndentChars = "\x20"; + + XmlWriter w = utils.CreateWriter(wSettings); + CError.Compare(w.Settings.IndentChars, "\x20", "Mismatch in IndentChars"); + w.WriteStartElement("root"); + w.WriteStartElement("child"); + w.WriteEndElement(); + w.WriteEndElement(); + w.Dispose(); + + Assert.True(utils.CompareString("" + wSettings.NewLineChars + "\x20" + wSettings.NewLineChars + "")); + } + + [Theory] + [XmlWriterInlineData("<")] + [XmlWriterInlineData("&")] + [XmlWriterInlineData(""; + break; + case "EntityReference": + if (!ReaderSupportsEntityRef()) + { + CError.WriteLine("{0} does not support EntityRef node", readerType); + return; + } + strxml = " ]>&e;"; + break; + case "SignificantWhitespace": + strxml = " "; + break; + case "Whitespace": + if (ReaderStripsWhitespace()) + { + CError.WriteLine("{0} strips whitespace nodes by default", readerType); + return; + } + strxml = " "; + break; } + XmlReader xr; + xr = CreateReader(new StringReader(strxml)); - // for function writeAttributes_5 + do + { xr.Read(); } + while ((xr.NodeType.ToString() != tokenType) && (xr.ReadState != ReadState.EndOfFile)); + + if (xr.ReadState == ReadState.EndOfFile || xr.NodeType.ToString() != tokenType) { - this.AddChild(new CVariation(writeAttributes_5) { Attribute = new Variation("Call WriteAttributes when reader is located in the middle attribute") { id = 5, Pri = 1 } }); + xr.Dispose(); + CError.WriteLine("Reader not positioned on correct node"); + CError.WriteLine("ReadState: {0}", xr.ReadState); + CError.WriteLine("NodeType: {0}", xr.NodeType); + Assert.True(false); } - - // for function writeAttributes_6 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(writeAttributes_6) { Attribute = new Variation("Call WriteAttributes when reader is located in the last attribute") { id = 6, Pri = 1 } }); + try + { + if (tokenType != "DocumentType") + w.WriteStartElement("root"); + w.WriteAttributes(xr, false); + } + catch (XmlException e) + { + CError.WriteLineIgnore(e.ToString()); + CError.Compare(w.WriteState, (tokenType == "DocumentType") ? WriteState.Start : WriteState.Element, "WriteState should be Element"); + return; + } + finally + { + xr.Dispose(); + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + // Call WriteAttribute with double quote char in the value + [Theory] + [XmlWriterInlineData] + public void writeAttributes_10(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + using (XmlReader xr = CreateReader("XmlReader.xml")) + { + while (xr.Read()) + { + if (xr.LocalName == "QuoteChar") + { + do + { xr.Read(); } while (xr.LocalName != "node"); + xr.MoveToFirstAttribute(); + break; + } + } + w.WriteStartElement("Root"); + w.WriteAttributes(xr, false); + w.WriteEndElement(); + } + } + Assert.True(utils.CompareReader("")); + } + + // Call WriteAttribute with single quote char in the value + [Theory] + [XmlWriterInlineData] + public void writeAttributes_11(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + using (XmlReader xr = CreateReader("XmlReader.xml")) + { + while (xr.Read()) + { + if (xr.LocalName == "QuoteChar") + { + do + { xr.Read(); } while (xr.LocalName != "node"); + do + { xr.Read(); } while (xr.LocalName != "node"); + xr.MoveToFirstAttribute(); + break; + } + } + w.WriteStartElement("Root"); + w.WriteAttributes(xr, false); + w.WriteEndElement(); + } + } + Assert.True(utils.CompareReader("")); + } + + // Call WriteAttributes with 100 attributes + [Theory] + [XmlWriterInlineData] + public void writeAttributes_12(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + using (XmlReader xr = CreateReader("XmlReader.xml")) + { + while (xr.Read()) + { + if (xr.LocalName == "OneHundredAttributes") + { + xr.MoveToFirstAttribute(); + break; + } + } + + if (xr.NodeType != XmlNodeType.Attribute) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType.ToString()); + xr.Dispose(); + Assert.True(false); + } + w.WriteStartElement("OneHundredAttributes"); + w.WriteAttributes(xr, false); + w.WriteEndElement(); + } + } + Assert.True(utils.CompareBaseline("OneHundredAttributes.xml")); + } + + // WriteAttributes with different builtin entities in attribute value + [Theory] + [XmlWriterInlineData] + public void writeAttributes_13(XmlWriterUtils utils) + { + string strxml = ""; + using (XmlReader xr = CreateReader(new StringReader(strxml))) + { + xr.Read(); + xr.MoveToFirstAttribute(); + + if (xr.NodeType != XmlNodeType.Attribute) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType.ToString()); + xr.Dispose(); + Assert.True(false); + } + + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteAttributes(xr, false); + w.WriteEndElement(); + } + } + Assert.True(utils.CompareReader("")); + } + + // WriteAttributes tries to duplicate attribute + [Theory] + [XmlWriterInlineData] + public void writeAttributes_14(XmlWriterUtils utils) + { + string strxml = ""; + XmlReader xr = CreateReader(new StringReader(strxml)); + xr.Read(); + xr.MoveToFirstAttribute(); + + if (xr.NodeType != XmlNodeType.Attribute) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType.ToString()); + xr.Dispose(); + Assert.True(false); } - - // for function writeAttributes_8 + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(writeAttributes_8) { Attribute = new Variation("Call WriteAttributes with reader on XmlDeclaration") { id = 8, Pri = 1 } }); - } - - - // for function writeAttributes_9 - { - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on Text") { Param = "Text", id = 11, Pri = 1 } }); - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on Comment") { Param = "Comment", id = 13, Pri = 1 } }); - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on CDATA") { Param = "CDATA", id = 10, Pri = 1 } }); - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on PI") { Param = "ProcessingInstruction", id = 12, Pri = 1 } }); - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on EntityRef") { Param = "EntityReference", id = 14, Pri = 1 } }); - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on Whitespace") { Param = "Whitespace", id = 15, Pri = 1 } }); - this.AddChild(new CVariation(writeAttributes_9) { Attribute = new Variation("Call WriteAttributes with reader on SignificantWhitespace") { Param = "SignificantWhitespace", id = 16, Pri = 1 } }); - } - - - // for function writeAttributes_10 - { - this.AddChild(new CVariation(writeAttributes_10) { Attribute = new Variation("Call WriteAttribute with double quote char in the value") { id = 17, Pri = 1 } }); - } - - - // for function writeAttributes_11 - { - this.AddChild(new CVariation(writeAttributes_11) { Attribute = new Variation("Call WriteAttribute with single quote char in the value") { id = 18, Pri = 1 } }); - } - - - // for function writeAttributes_12 - { - this.AddChild(new CVariation(writeAttributes_12) { Attribute = new Variation("Call WriteAttributes with 100 attributes") { id = 19, Pri = 1 } }); - } - - - // for function writeAttributes_13 - { - this.AddChild(new CVariation(writeAttributes_13) { Attribute = new Variation("WriteAttributes with different builtin entities in attribute value") { id = 20, Pri = 1 } }); - } - - - // for function writeAttributes_14 - { - this.AddChild(new CVariation(writeAttributes_14) { Attribute = new Variation("WriteAttributes tries to duplicate attribute") { id = 21, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteStartAttribute("attr"); + w.WriteAttributes(xr, false); + w.WriteEndElement(); + } + catch (Exception e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + CError.Compare(w.WriteState, WriteState.Error, "WriteState should be Error"); + return; + } + finally + { + xr.Dispose(); + } } + CError.WriteLine("Did not throw exception"); + Assert.True(false); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteBuffer.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteBuffer.cs new file mode 100644 index 0000000000..91b4950d72 --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteBuffer.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using OLEDB.Test.ModuleCore; +using Xunit; + +namespace System.Xml.Tests +{ + public abstract class TCWriteBuffer + { + public void VerifyInvalidWrite(XmlWriterUtils utils, string methodName, int iBufferSize, int iIndex, int iCount, Type exceptionType) + { + byte[] byteBuffer = new byte[iBufferSize]; + for (int i = 0; i < iBufferSize; i++) + byteBuffer[i] = (byte)(i + '0'); + + char[] charBuffer = new char[iBufferSize]; + for (int i = 0; i < iBufferSize; i++) + charBuffer[i] = (char)(i + '0'); + + XmlWriter w = utils.CreateWriter(); + w.WriteStartElement("root"); + try + { + switch (methodName) + { + case "WriteBase64": + w.WriteBase64(byteBuffer, iIndex, iCount); + break; + case "WriteRaw": + w.WriteRaw(charBuffer, iIndex, iCount); + break; + case "WriteBinHex": + w.WriteBinHex(byteBuffer, iIndex, iCount); + break; + case "WriteChars": + w.WriteChars(charBuffer, iIndex, iCount); + break; + default: + CError.Compare(false, "Unexpected method name " + methodName); + break; + } + } + catch (Exception e) + { + CError.WriteLineIgnore("Exception: " + e.ToString()); + if (exceptionType.FullName.Equals(e.GetType().FullName)) + { + return; + } + else + { + CError.WriteLine("Did not throw exception of type {0}", exceptionType); + } + } + w.Flush(); + Assert.True(false, "Expected exception"); + } + + public byte[] StringToByteArray(string src) + { + byte[] base64 = new byte[src.Length * 2]; + + for (int i = 0; i < src.Length; i++) + { + byte[] temp = System.BitConverter.GetBytes(src[i]); + base64[2 * i] = temp[0]; + base64[2 * i + 1] = temp[1]; + } + return base64; + } + + public static void ensureSpace(ref byte[] buffer, int len) + { + if (len >= buffer.Length) + { + int originalLen = buffer.Length; + byte[] newBuffer = new byte[(int)(len * 2)]; + for (int i = 0; i < originalLen; newBuffer[i] = buffer[i++]) + { + // Intentionally Empty + } + buffer = newBuffer; + } + } + public static void WriteToBuffer(ref byte[] destBuff, ref int len, byte srcByte) + { + ensureSpace(ref destBuff, len); + destBuff[len++] = srcByte; + } + + public static void WriteToBuffer(ref byte[] destBuff, ref int len, byte[] srcBuff) + { + int srcArrayLen = srcBuff.Length; + WriteToBuffer(ref destBuff, ref len, srcBuff, 0, (int)srcArrayLen); + } + + public static void WriteToBuffer(ref byte[] destBuff, ref int destStart, byte[] srcBuff, int srcStart, int count) + { + ensureSpace(ref destBuff, destStart + count - 1); + for (int i = srcStart; i < srcStart + count; i++) + { + destBuff[destStart++] = srcBuff[i]; + } + } + + public static void WriteToBuffer(ref byte[] destBuffer, ref int destBuffLen, String strValue) + { + for (int i = 0; i < strValue.Length; i++) + { + WriteToBuffer(ref destBuffer, ref destBuffLen, System.BitConverter.GetBytes(strValue[i])); + } + + WriteToBuffer(ref destBuffer, ref destBuffLen, System.BitConverter.GetBytes('\0')); + } + } +} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteEndDocumentOnCloseTest.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteEndDocumentOnCloseTest.cs deleted file mode 100644 index f7d336cd5f..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteEndDocumentOnCloseTest.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using OLEDB.Test.ModuleCore; - -namespace System.Xml.Tests -{ - public partial class TCWriteEndDocumentOnCloseTest : XmlWriterTestCaseBase - { - // Type is System.Xml.Tests.TCWriteEndDocumentOnCloseTest - // Test Case - public override void AddChildren() - { - // for function TestWriteEndDocumentOnCoseForOneElementwithText - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithText) { Attribute = new Variation("write element with text but without end element when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "text" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithText) { Attribute = new Variation("write element with text but without end element when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "text" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForOneElement - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElement) { Attribute = new Variation("write start element and then close when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElement) { Attribute = new Variation("write start element and then close when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForOneElementwithAttribute - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithAttribute) { Attribute = new Variation("write start element and with attribute then close when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithAttribute) { Attribute = new Variation("write start element and with attribute then close when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForOneElementwithAttributeValue - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithAttributeValue) { Attribute = new Variation("write start element and with attribute value then close when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithAttributeValue) { Attribute = new Variation("write start element and with attribute value then close when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForOneElementwithNamespace - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithNamespace) { Attribute = new Variation("write start element and with namespace then close when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementwithNamespace) { Attribute = new Variation("write start element and with namespace then close when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForMultiElements - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForMultiElements) { Attribute = new Variation("write multi start elements then close when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForMultiElements) { Attribute = new Variation("write multi start elements then close when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForElementsWithOneEndElement - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForElementsWithOneEndElement) { Attribute = new Variation("Write two elements only one with end elment when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForElementsWithOneEndElement) { Attribute = new Variation("Write two elements only one with end elment when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - } - - - // for function TestWriteEndDocumentOnCoseForOneElementWithEndElement - { - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementWithEndElement) { Attribute = new Variation("Write one element with end elment when the WriteEndDocumentOnClose = false") { Params = new object[] { false, "" }, Pri = 1 } }); - this.AddChild(new CVariation(TestWriteEndDocumentOnCoseForOneElementWithEndElement) { Attribute = new Variation("Write one element with end elment when the WriteEndDocumentOnClose = true") { Params = new object[] { true, "" }, Pri = 1 } }); - } - } - } -} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteNode_XmlReader.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteNode_XmlReader.cs index 61d91d2ddf..25f309e092 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteNode_XmlReader.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriteNode_XmlReader.cs @@ -1,253 +1,949 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.IO; +using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCWriteNode_XmlReader : ReaderParamTestCase + public class TCWriteNode_XmlReader : ReaderParamTestCase { - // Type is System.Xml.Tests.TCWriteNode_XmlReader - // Test Case - public override void AddChildren() + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader1(XmlWriterUtils utils) { - // for function writeNode_XmlReader1 + XmlReader xr = null; + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(writeNode_XmlReader1) { Attribute = new Variation("WriteNode with null reader") { id = 1, Pri = 1 } }); + try + { + w.WriteStartElement("Root"); + w.WriteNode(xr, false); + } + catch (ArgumentNullException) + { + CError.Compare(w.WriteState, WriteState.Element, "WriteState should be Element"); + return; + } + } + CError.WriteLine("Did not throw exception"); + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader2(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) + { + using (XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml")) + { + while (xr.Read()) + { + if (xr.LocalName == "defattr") + { + xr.Read(); + xr.MoveToFirstAttribute(); + break; + } + } + + if (xr.NodeType != XmlNodeType.Attribute) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType.ToString()); + xr.Dispose(); + w.Dispose(); + Assert.True(false); + } + w.WriteStartElement("Root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader3(XmlWriterUtils utils) + { + using (XmlReader xr = CreateReader(new StringReader(""))) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } } + Assert.True(utils.CompareReader("")); + } - // for function writeNode_XmlReader2 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader4(XmlWriterUtils utils) + { + using (XmlReader xr = CreateReader(new StringReader(""))) { - this.AddChild(new CVariation(writeNode_XmlReader2) { Attribute = new Variation("WriteNode with reader positioned on attribute, no operation") { id = 2, Pri = 1 } }); + xr.Read(); + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } } + Assert.True(utils.CompareReader("")); + } - // for function writeNode_XmlReader3 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader5(XmlWriterUtils utils) + { + using (XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml")) { - this.AddChild(new CVariation(writeNode_XmlReader3) { Attribute = new Variation("WriteNode before reader.Read()") { id = 3, Pri = 1 } }); + while (xr.Read()) + { + if (xr.LocalName == "Middle") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } + CError.Compare(xr.NodeType, XmlNodeType.Comment, "Error"); + CError.Compare(xr.Value, "WriteComment", "Error"); + } + Assert.True(utils.CompareReader("Node Text")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader6(XmlWriterUtils utils) + { + using (XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml")) + { + while (xr.Read()) + { } + + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader7(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { } + xr.Dispose(); + + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader8(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "EmptyElement") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); } + // check reader position + CError.Compare(xr.NodeType, XmlNodeType.EndElement, "Error"); + CError.Compare(xr.Name, "EmptyElement", "Error"); + xr.Dispose(); - // for function writeNode_XmlReader4 + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader9(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) { - this.AddChild(new CVariation(writeNode_XmlReader4) { Attribute = new Variation("WriteNode after first reader.Read()") { id = 4, Pri = 1 } }); + if (xr.LocalName == "OneHundredElements") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } + xr.Dispose(); + Assert.True(utils.CompareBaseline("100Nodes.txt")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader10(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "MixedContent") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); } + // check reader position + CError.Compare(xr.NodeType, XmlNodeType.EndElement, "Error"); + CError.Compare(xr.Name, "MixedContent", "Error"); + xr.Dispose(); - // for function writeNode_XmlReader5 + if (IsXPathDataModelReader()) { - this.AddChild(new CVariation(writeNode_XmlReader5) { Attribute = new Variation("WriteNode when reader is positioned on middle of an element node") { id = 5, Pri = 1 } }); + Assert.True(utils.CompareReader("Textcdata")); } + Assert.True(utils.CompareReader("Text")); + } - // for function writeNode_XmlReader6 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader11(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) { - this.AddChild(new CVariation(writeNode_XmlReader6) { Attribute = new Variation("WriteNode when reader state is EOF") { id = 6, Pri = 1 } }); + if (xr.LocalName == "NamespaceNoPrefix") + { + xr.Read(); + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } + xr.Dispose(); + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader12(XmlWriterUtils utils) + { + using (XmlReader xr = CreateReaderIgnoreWSFromString(" ]>&test;")) + { + bool sanityCheck = false; + while (xr.Read()) + { + if (xr.NodeType == XmlNodeType.Element && xr.LocalName == "node") + { + sanityCheck = true; + break; + } + } + + Assert.True(sanityCheck, "error in input doc"); + + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } } + Assert.Equal("Test Entity", utils.GetString()); + } - // for function writeNode_XmlReader7 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader14(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) { - this.AddChild(new CVariation(writeNode_XmlReader7) { Attribute = new Variation("WriteNode when reader state is Closed") { id = 7, Pri = 1 } }); + if (xr.LocalName == "DiffPrefix") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("x", "bar", "foo"); + w.WriteNode(xr, true); + w.WriteStartElement("blah", "foo"); + w.WriteEndElement(); + w.WriteEndElement(); + } + xr.Dispose(); + + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader15(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "DefaultAttributesTrue") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteNode(xr, true); + w.WriteEndElement(); + } + xr.Dispose(); + if (!ReaderParsesDTD()) + Assert.True(utils.CompareReader("")); + else + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader16(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "DefaultAttributesTrue") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("Root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + xr.Dispose(); + if (ReaderLoosesDefaultAttrInfo()) + Assert.True(utils.CompareReader("")); + else + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader17(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "EmptyElementWithAttributes") + { + xr.Read(); + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader18(XmlWriterUtils utils) + { + string xml = ""; + XmlReader xr = CreateReader(new StringReader(xml)); + xr.Read(); + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); } + xr.Dispose(); + Assert.True(utils.CompareReader("")); + } - // for function writeNode_XmlReader8 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader19(XmlWriterUtils utils) + { + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(writeNode_XmlReader8) { Attribute = new Variation("WriteNode with reader on empty element node") { id = 8, Pri = 1 } }); + string xml = ""; + using (XmlReader xr = CreateReader(new StringReader(xml))) + { + while (xr.Read()) + w.WriteNode(xr, true); + } + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader20(XmlWriterUtils utils) + { + string strxml = ""; + + string exp = utils.IsIndent() ? + "" + Environment.NewLine + "" : + ""; + + using (XmlReader xr = CreateReader(new StringReader(strxml))) + using (XmlWriter w = utils.CreateWriter()) + { + while (xr.NodeType != XmlNodeType.DocumentType) + xr.Read(); + + w.WriteNode(xr, false); + w.WriteStartElement("ROOT"); + w.WriteEndElement(); } + Assert.Equal(exp, utils.GetString()); + } - // for function writeNode_XmlReader9 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader21(XmlWriterUtils utils) + { + string strxml = ""; + XmlReader xr = CreateReader(new StringReader(strxml)); + using (XmlWriter w = utils.CreateWriter()) { - this.AddChild(new CVariation(writeNode_XmlReader9) { Attribute = new Variation("WriteNode with reader on 100 Nodes") { id = 9, Pri = 1 } }); + w.WriteNode(xr, false); } + xr.Dispose(); + Assert.True(utils.CompareReader("")); + } - // for function writeNode_XmlReader10 + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader21a(XmlWriterUtils utils) + { + string strxml = ""; + try { - this.AddChild(new CVariation(writeNode_XmlReader10) { Attribute = new Variation("WriteNode with reader on node with mixed content") { id = 10, Pri = 1 } }); + using (XmlWriter w = utils.CreateWriter()) + { + try + { + using (XmlReader xr = CreateReader(new StringReader(strxml))) + { + w.WriteNode(xr, true); + CError.Compare(false, "Failed"); + } + } + catch (XmlException xe) { CError.WriteLine(xe.Message); return; } + } + } + catch (ObjectDisposedException e) { CError.WriteLine(e.Message); return; } + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader21b(XmlWriterUtils utils) + { + string strxml = "" + +"" + +"" + +"" + +"" + +"" + +"" + +"" + +"]>" + +"" + +" &e2;" + +" AA&e2;AA" + +" BB&e1;BB" + +" World" + +""; + try + { + using (XmlWriter w = utils.CreateWriter()) + { + try + { + using (XmlReader xr = CreateReader(new StringReader(strxml))) + { + w.WriteNode(xr, true); + CError.Compare(false, "Failed"); + } + } + catch (XmlException xe) { CError.WriteLine(xe.Message); return; } + } + } + catch (ObjectDisposedException e) { CError.WriteLine(e.Message); return; } + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader22(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "OneHundredAttributes") + { + break; + } + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + } + xr.Dispose(); + Assert.True(utils.CompareBaseline("OneHundredAttributes.xml")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader23(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "Middle") + { + xr.Read(); + xr.Read(); + break; + } + } + if (xr.NodeType != XmlNodeType.Text) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType); + xr.Dispose(); + Assert.True(false); + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + xr.Dispose(); + Assert.True(utils.CompareReader("Node Text")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader24(XmlWriterUtils utils) + { + if (IsXPathDataModelReader()) + { + CError.WriteLine("XPath data model does not have CDATA node type, so {0} can not be positioned on CDATA", readerType); + return; } - - // for function writeNode_XmlReader11 + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) { - this.AddChild(new CVariation(writeNode_XmlReader11) { Attribute = new Variation("WriteNode with reader on node with declared namespace in parent") { id = 11, Pri = 1 } }); + if (xr.LocalName == "CDataNode") + { + xr.Read(); + break; + } + } + if (xr.NodeType != XmlNodeType.CDATA) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType); + xr.Dispose(); + Assert.True(false); + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + xr.Dispose(); + + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader25(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "PINode") + { + xr.Read(); + break; + } + } + if (xr.NodeType != XmlNodeType.ProcessingInstruction) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType); + xr.Dispose(); + Assert.True(false); + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + xr.Dispose(); + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader26(XmlWriterUtils utils) + { + XmlReader xr = CreateReaderIgnoreWS("XmlReader.xml"); + while (xr.Read()) + { + if (xr.LocalName == "CommentNode") + { + xr.Read(); + break; + } + } + if (xr.NodeType != XmlNodeType.Comment) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType); + xr.Dispose(); + Assert.True(false); + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteStartElement("root"); + w.WriteNode(xr, false); + w.WriteEndElement(); + } + xr.Dispose(); + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader28(XmlWriterUtils utils) + { + string strxml = ""; + XmlReader xr = CreateReader(new StringReader(strxml)); + + xr.Read(); + if (xr.NodeType != XmlNodeType.XmlDeclaration) + { + CError.WriteLine("Reader positioned on {0}", xr.NodeType); + xr.Dispose(); + return; } - // for function writeNode_XmlReader14 + XmlWriterSettings ws = new XmlWriterSettings(); + ws.OmitXmlDeclaration = false; + XmlWriter w = utils.CreateWriter(ws); + w.WriteNode(xr, false); + w.WriteStartElement("Root"); + w.WriteEndElement(); + xr.Dispose(); + w.Dispose(); + strxml = utils.IsIndent() ? "" + Environment.NewLine + "" : strxml; + Assert.True(utils.CompareString(strxml)); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader27(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) { - this.AddChild(new CVariation(writeNode_XmlReader14) { Attribute = new Variation("WriteNode with element that has different prefix") { id = 14, Pri = 1 } }); + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader28b(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + xr.Dispose(); + } + string exp = (utils.WriterType == WriterType.UnicodeWriter) ? "" : ""; + Assert.True(utils.CompareReader(exp)); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader29(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader30(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader31(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader32(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader33(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData] + public void writeNode_XmlReader34(XmlWriterUtils utils) + { + string strxml = @""; + XmlReader xr = CreateReader(new StringReader(strxml)); + while (xr.Read()) + { + if (xr.LocalName == "child") + break; + } + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, false); + xr.Dispose(); + } + Assert.True(utils.CompareReader("")); + } + + [Theory] + [XmlWriterInlineData(ConformanceLevel.Document)] + [XmlWriterInlineData(ConformanceLevel.Auto)] + public void writeNode_XmlReader35(XmlWriterUtils utils, ConformanceLevel conformanceLevel) + { + string strxml = @" text"; + CError.WriteLine(strxml); + XmlReader xr = CreateReader(new StringReader(strxml)); + XmlWriterSettings ws = new XmlWriterSettings(); + ws.ConformanceLevel = conformanceLevel; + ws.Indent = true; + XmlWriter w = utils.CreateWriter(ws); + w.WriteNode(xr, false); + xr.Dispose(); + w.Dispose(); + Assert.True(utils.CompareReader(strxml)); + } + + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void writeNode_XmlReader36(XmlWriterUtils utils, bool defattr) + { + string strxml = ""; + string exp = strxml; + + XmlReader xr = CreateReader(new StringReader(strxml)); + + XmlWriterSettings ws = new XmlWriterSettings(); + ws.OmitXmlDeclaration = true; + XmlWriter w = utils.CreateWriter(ws); + while (!xr.EOF) + { + w.WriteNode(xr, defattr); + } + xr.Dispose(); + w.Dispose(); + Assert.True(utils.CompareString(exp)); + } + + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void writeNode_XmlReader37(XmlWriterUtils utils, bool defattr) + { + string strxml = ""; + string exp = utils.IsIndent() ? + "" + Environment.NewLine + "" : + ""; + + using (XmlReader xr = CreateReader(new StringReader(strxml))) + using (XmlWriter w = utils.CreateWriter()) + { + while (!xr.EOF) + { + w.WriteNode(xr, defattr); + } } + Assert.True(utils.CompareString(exp)); + } - // for function writeNode_XmlReader15 + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void writeNode_XmlReader38(XmlWriterUtils utils, bool defattr) + { + string strxml = ""; + try { - this.AddChild(new CVariation(writeNode_XmlReader15) { Attribute = new Variation("Call WriteNode with default attributes = true and DTD") { id = 15, Pri = 1 } }); + using (XmlReader xr = CreateReader(new StringReader(strxml))) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, defattr); + } + } + } + catch (XmlException e) { CError.WriteLine(e); return; } + Assert.True(false); + } + + [Theory] + [XmlWriterInlineData(true)] + [XmlWriterInlineData(false)] + public void writeNode_XmlReader39(XmlWriterUtils utils, bool defattr) + { + string strxml = ""; + string exp = utils.IsIndent() ? + "" + Environment.NewLine + "" : + ""; + + using (XmlReader xr = CreateReader(new StringReader(strxml))) + { + using (XmlWriter w = utils.CreateWriter()) + { + w.WriteNode(xr, defattr); + } } - - // for function writeNode_XmlReader16 - { - this.AddChild(new CVariation(writeNode_XmlReader16) { Attribute = new Variation("Call WriteNode with default attributes = false and DTD") { id = 16, Pri = 1 } }); - } - - - // for function writeNode_XmlReader17 - { - this.AddChild(new CVariation(writeNode_XmlReader17) { Attribute = new Variation("Bug 53478 testcase: WriteNode with reader on empty element with attributes") { id = 17, Pri = 1 } }); - } - - - // for function writeNode_XmlReader18 - { - this.AddChild(new CVariation(writeNode_XmlReader18) { Attribute = new Variation("Bug 53479 testcase: WriteNode with document containing just empty element with attributes") { id = 18, Pri = 1 } }); - } - - - // for function writeNode_XmlReader19 - { - this.AddChild(new CVariation(writeNode_XmlReader19) { Attribute = new Variation("Bug 53683 testcase: Call WriteNode with special entity references as attribute value") { id = 19, Pri = 1 } }); - } - - - // for function writeNode_XmlReader21 - { - this.AddChild(new CVariation(writeNode_XmlReader21) { Attribute = new Variation("Call WriteNode with full end element") { id = 21, Pri = 1 } }); - } - - - // for function writeNode_XmlReader21a - { - this.AddChild(new CVariation(writeNode_XmlReader21a) { Attribute = new Variation("Call WriteNode with tag mismatch") }); - } - - - // for function writeNode_XmlReader21b - { - this.AddChild(new CVariation(writeNode_XmlReader21b) { Attribute = new Variation("Call WriteNode with default NS from DTD.UnexpToken") }); - } - - - // for function writeNode_XmlReader22 - { - this.AddChild(new CVariation(writeNode_XmlReader22) { Attribute = new Variation("Call WriteNode with reader on element with 100 attributes") { id = 22, Pri = 1 } }); - } - - - // for function writeNode_XmlReader23 - { - this.AddChild(new CVariation(writeNode_XmlReader23) { Attribute = new Variation("Call WriteNode with reader on text node") { id = 23, Pri = 1 } }); - } - - - // for function writeNode_XmlReader24 - { - this.AddChild(new CVariation(writeNode_XmlReader24) { Attribute = new Variation("Call WriteNode with reader on CDATA node") { id = 24, Pri = 1 } }); - } - - - // for function writeNode_XmlReader25 - { - this.AddChild(new CVariation(writeNode_XmlReader25) { Attribute = new Variation("Call WriteNode with reader on PI node") { id = 25, Pri = 1 } }); - } - - - // for function writeNode_XmlReader26 - { - this.AddChild(new CVariation(writeNode_XmlReader26) { Attribute = new Variation("Call WriteNode with reader on Comment node") { id = 26, Pri = 1 } }); - } - - - // for function writeNode_XmlReader28 - { - this.AddChild(new CVariation(writeNode_XmlReader28) { Attribute = new Variation("Call WriteNode with reader on XmlDecl (OmitXmlDecl false)") { Pri = 1 } }); - } - - - // for function writeNode_XmlReader27 - { - this.AddChild(new CVariation(writeNode_XmlReader27) { Attribute = new Variation("WriteNode should only write required namespaces") { id = 27, Pri = 1 } }); - } - - - // for function writeNode_XmlReader28b - { - this.AddChild(new CVariation(writeNode_XmlReader28b) { Attribute = new Variation("Reader.WriteNode should only write required namespaces, include xmlns:xml") { id = 28, Pri = 1 } }); - } - - - // for function writeNode_XmlReader29 - { - this.AddChild(new CVariation(writeNode_XmlReader29) { Attribute = new Variation("WriteNode should only write required namespaces, exclude xmlns:xml") { id = 29, Pri = 1 } }); - } - - - // for function writeNode_XmlReader30 - { - this.AddChild(new CVariation(writeNode_XmlReader30) { Attribute = new Variation("WriteNode should only write required namespaces, change default ns at top level") { id = 30, Pri = 1 } }); - } - - - // for function writeNode_XmlReader31 - { - this.AddChild(new CVariation(writeNode_XmlReader31) { Attribute = new Variation("WriteNode should only write required namespaces, change default ns at same level") { id = 31, Pri = 1 } }); - } - - - // for function writeNode_XmlReader32 - { - this.AddChild(new CVariation(writeNode_XmlReader32) { Attribute = new Variation("WriteNode should only write required namespaces, change default ns at both levels") { id = 32, Pri = 1 } }); - } - - - // for function writeNode_XmlReader33 - { - this.AddChild(new CVariation(writeNode_XmlReader33) { Attribute = new Variation("WriteNode should only write required namespaces, change ns uri for same prefix") { id = 33, Pri = 1 } }); - } - - - // for function writeNode_XmlReader34 - { - this.AddChild(new CVariation(writeNode_XmlReader34) { Attribute = new Variation("WriteNode should only write required namespaces, reuse prefix from top level") { id = 34, Pri = 1 } }); - } - - - // for function writeNode_XmlReader35 - { - this.AddChild(new CVariation(writeNode_XmlReader35) { Attribute = new Variation("XDocument does not format content while Saving") { Param = " text" } }); - this.AddChild(new CVariation(writeNode_XmlReader35) { Attribute = new Variation("XDocument does not format content while Saving") { Param = " text" } }); - } - - - // for function writeNode_XmlReader36 - { - this.AddChild(new CVariation(writeNode_XmlReader36) { Attribute = new Variation("2.WriteNode with ascii encoding") { Param = false } }); - this.AddChild(new CVariation(writeNode_XmlReader36) { Attribute = new Variation("1.WriteNode with ascii encoding") { Param = true } }); - } - - - // for function writeNode_XmlReader37 - { - this.AddChild(new CVariation(writeNode_XmlReader37) { Attribute = new Variation("WriteNode DTD PUBLIC with identifier") { Param = true } }); - this.AddChild(new CVariation(writeNode_XmlReader37) { Attribute = new Variation("WriteNode DTD PUBLIC with identifier") { Param = false } }); - } - - - // for function writeNode_XmlReader38 - { - this.AddChild(new CVariation(writeNode_XmlReader38) { Attribute = new Variation("WriteNode DTD SYSTEM with identifier") { Param = false } }); - this.AddChild(new CVariation(writeNode_XmlReader38) { Attribute = new Variation("WriteNode DTD SYSTEM with identifier") { Param = true } }); - } - - - // for function writeNode_XmlReader39 - { - this.AddChild(new CVariation(writeNode_XmlReader39) { Attribute = new Variation("WriteNode DTD SYSTEM with valid surrogate pair") { Param = false } }); - this.AddChild(new CVariation(writeNode_XmlReader39) { Attribute = new Variation("WriteNode DTD SYSTEM with valid surrogate pair") { Param = true } }); - } + Assert.Equal(exp, utils.GetString()); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterSettingsMisc.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterSettingsMisc.cs index b18a66320f..70119c2578 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterSettingsMisc.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterSettingsMisc.cs @@ -1,32 +1,72 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; -using XmlCoreTest.Common; +using System.Text; +using Xunit; namespace System.Xml.Tests { - public partial class TCWriterSettingsMisc : XmlFactoryWriterTestCaseBase + public class TCWriterSettingsMisc { - // Type is System.Xml.Tests.TCWriterSettingsMisc - // Test Case - public override void AddChildren() + [Fact] + public void Reset_1() { - if (WriterType == WriterType.CustomWriter) - { - return; - } - // for function Reset_1 - { - this.AddChild(new CVariation(Reset_1) { Attribute = new Variation("Test for Reset()") { id = 1, Pri = 0 } }); - } + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.Encoding = Encoding.UTF8; + wSettings.OmitXmlDeclaration = true; + wSettings.NewLineHandling = NewLineHandling.None; + wSettings.NewLineChars = "\n"; + wSettings.IndentChars = "\t\t"; + wSettings.NewLineOnAttributes = true; + wSettings.CloseOutput = true; + wSettings.CheckCharacters = false; + wSettings.ConformanceLevel = ConformanceLevel.Document; + wSettings.WriteEndDocumentOnClose = false; + wSettings.Reset(); + CError.Equals(wSettings.Encoding, Encoding.UTF8, "Encoding"); + CError.Equals(wSettings.OmitXmlDeclaration, false, "OmitXmlDeclaration"); + CError.Equals(wSettings.NewLineHandling, NewLineHandling.Replace, "NewLineHandling"); + CError.Equals(wSettings.NewLineChars, Environment.NewLine, "NewLineChars"); + CError.Equals(wSettings.Indent, false, "Indent"); + CError.Equals(wSettings.IndentChars, " ", "IndentChars"); + CError.Equals(wSettings.NewLineOnAttributes, false, "NewLineOnAttributes"); + CError.Equals(wSettings.CloseOutput, false, "CloseOutput"); + CError.Equals(wSettings.CheckCharacters, true, "CheckCharacters"); + CError.Equals(wSettings.ConformanceLevel, ConformanceLevel.Document, "ConformanceLevel"); + CError.Equals(wSettings.WriteEndDocumentOnClose, true, "WriteEndDocumentOnClose"); + } - // for function Clone_1 - { - this.AddChild(new CVariation(Clone_1) { Attribute = new Variation("Test for Clone()") { id = 2, Pri = 0 } }); - } + [Fact] + public void Clone_1() + { + XmlWriterSettings wSettings = new XmlWriterSettings(); + wSettings.Encoding = Encoding.UTF8; + wSettings.OmitXmlDeclaration = true; + wSettings.NewLineHandling = NewLineHandling.Entitize; + wSettings.NewLineChars = "\n"; + wSettings.IndentChars = " "; + wSettings.NewLineOnAttributes = true; + wSettings.CloseOutput = true; + wSettings.CheckCharacters = false; + wSettings.ConformanceLevel = ConformanceLevel.Document; + wSettings.WriteEndDocumentOnClose = false; + + XmlWriterSettings newSettings = wSettings.Clone(); + + CError.Equals(wSettings.Encoding, newSettings.Encoding, "Encoding"); + CError.Equals(wSettings.OmitXmlDeclaration, newSettings.OmitXmlDeclaration, "OmitXmlDeclaration"); + CError.Equals(wSettings.NewLineHandling, newSettings.NewLineHandling, "NewLineHandling"); + CError.Equals(wSettings.NewLineChars, newSettings.NewLineChars, "NewLineChars"); + CError.Equals(wSettings.Indent, newSettings.Indent, "Indent"); + CError.Equals(wSettings.IndentChars, newSettings.IndentChars, "IndentChars"); + CError.Equals(wSettings.NewLineOnAttributes, newSettings.NewLineOnAttributes, "NewLineOnAttributes"); + CError.Equals(wSettings.CloseOutput, newSettings.CloseOutput, "CloseOutput"); + CError.Equals(wSettings.CheckCharacters, newSettings.CheckCharacters, "CheckCharacters"); + CError.Equals(wSettings.ConformanceLevel, newSettings.ConformanceLevel, "ConformanceLevel"); + CError.Equals(wSettings.WriteEndDocumentOnClose, newSettings.WriteEndDocumentOnClose, "WriteEndDocumentOnClose"); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterWithMemoryStream.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterWithMemoryStream.cs index a0839c5a61..a40c5703bc 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterWithMemoryStream.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCWriterWithMemoryStream.cs @@ -1,33 +1,375 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using OLEDB.Test.ModuleCore; +using System.IO; +using System.Text; using XmlCoreTest.Common; +using Xunit; namespace System.Xml.Tests { - public partial class TCWriterWithMemoryStream : XmlFactoryWriterTestCaseBase + public class TCWriterWithMemoryStream { - // Type is System.Xml.Tests.TCWriterWithMemoryStream - // Test Case - public override void AddChildren() + public XmlWriter CreateMemWriter(XmlWriterUtils utils, Stream writerStream, XmlWriterSettings settings) { - if (WriterType == WriterType.UnicodeWriter || WriterType == WriterType.UnicodeWriterIndent) + XmlWriterSettings wSettings = settings.Clone(); + wSettings.CloseOutput = false; + wSettings.OmitXmlDeclaration = true; + wSettings.CheckCharacters = false; + XmlWriter w = null; + + switch (utils.WriterType) { + case WriterType.UTF8Writer: + wSettings.Encoding = Encoding.UTF8; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.UnicodeWriter: + wSettings.Encoding = Encoding.Unicode; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.WrappedWriter: + XmlWriter ww = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + w = WriterHelper.Create(ww, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.CharCheckingWriter: + XmlWriter cw = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + XmlWriterSettings cws = settings.Clone(); + cws.CheckCharacters = true; + w = WriterHelper.Create(cw, cws, overrideAsync: true, async: utils.Async); + break; + case WriterType.CustomWriter: + wSettings.Async = utils.Async; + w = new CustomWriter(writerStream, wSettings); + break; + case WriterType.UTF8WriterIndent: + wSettings.Encoding = Encoding.UTF8; + wSettings.Indent = true; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + case WriterType.UnicodeWriterIndent: + wSettings.Encoding = Encoding.Unicode; + wSettings.Indent = true; + w = WriterHelper.Create(writerStream, wSettings, overrideAsync: true, async: utils.Async); + break; + default: + throw new Exception("Unknown writer type"); + } + return w; + } + + [Theory] + [XmlWriterInlineData] + public void XmlWellFormedWriterDoesNotThrowIndexOutOfRange0(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteStartElement("foo"); + w.WriteString(new String('a', (2048 * 3) - 50)); + w.WriteCData(String.Empty); + w.WriteComment(String.Empty); + w.WriteCData(String.Empty); + w.WriteComment(String.Empty); + } + } + } + + [Theory] + [XmlWriterInlineData] + public void XmlWellFormedWriterDoesNotThrowIndexOutOfRange1(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteStartElement("foo"); + w.WriteString(new String('a', (2048 * 3) - 50)); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteComment(""); + w.WriteCData(""); + w.WriteRaw(""); + w.WriteCData(""); + } + } + return; + } + + [Theory] + [XmlWriterInlineData] + public void XmlWellFormedWriterDoesNotThrowIndexOutOfRange2(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteStartElement("foo"); + w.WriteString(new String('a', (2048 * 3) - 50)); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteString(""); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteString(""); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteString(""); + } + } + return; + } + + [Theory] + [XmlWriterInlineData] + public void DisposedFileStreamDoesNotCauseCrash0(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + string outputXml; + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteElementString("elem", "text"); + w.Flush(); + ms.Position = 0; + using (StreamReader reader = new StreamReader(ms)) + { + outputXml = reader.ReadToEnd(); + } + } + } + CError.WriteLine("actual: " + outputXml); + CError.Compare(outputXml, "text", "wrong xml"); + Assert.True(false); + } + catch (Exception e) + { + CError.WriteLine("Exception: " + e); + return; + } + } + + [Theory] + [XmlWriterInlineData] + public void DisposedFileStreamDoesNotCauseCrash1(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + string outputXml; + using (Stream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteElementString("elem", "text"); + w.Flush(); + ms.Position = 0; + using (StreamReader reader = new StreamReader(ms)) + { + outputXml = reader.ReadToEnd(); + } + } + } + CError.WriteLine("actual: " + outputXml); + CError.Compare(outputXml, "text", "wrong xml"); + Assert.True(false); + } + catch (Exception e) + { + CError.WriteLine("Exception: " + e); + return; + } + } + + [Theory] + [XmlWriterInlineData] + public void DisposedFileStreamDoesNotCauseCrash2(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + string outputXml; + using (MemoryStream ms = new MemoryStream()) + { + using (Stream bs = ms) + { + using (XmlWriter w = CreateMemWriter(utils, bs, ws)) + { + w.WriteElementString("elem", "text"); + w.Flush(); + bs.Position = 0; + using (StreamReader reader = new StreamReader(bs)) + { + outputXml = reader.ReadToEnd(); + } + } + } + } + CError.WriteLine("actual: " + outputXml); + CError.Compare(outputXml, "text", "wrong xml"); + Assert.True(false); + } + catch (Exception e) + { + CError.WriteLine("Exception: " + e); + return; + } + } + + [Theory] + [XmlWriterInlineData] + public void DisposedFileStreamDoesNotCauseCrash3(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + string outputXml; + using (Stream ms = new MemoryStream()) + { + using (Stream bs = ms) + { + using (XmlWriter w = CreateMemWriter(utils, bs, ws)) + { + w.WriteElementString("elem", "text"); + w.Flush(); + bs.Position = 0; + using (StreamReader reader = new StreamReader(bs)) + { + outputXml = reader.ReadToEnd(); + } + } + } + } + CError.WriteLine("actual: " + outputXml); + CError.Compare(outputXml, "text", "wrong xml"); + Assert.True(false); + } + catch (Exception e) + { + CError.WriteLine("Exception: " + e); + return; + } + } + + [Theory] + [XmlWriterInlineData] + public void DisposedFileStreamDoesNotCauseCrash4(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteStartElement("foo"); + w.WriteString(new String('a', (2048 * 3) - 50)); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteComment(""); + w.WriteCData(""); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteEndElement(); + w.Flush(); + ms.Position = 0; + using (StreamReader reader = new StreamReader(ms)) + { + reader.ReadToEnd(); + } + } + } + Assert.True(false); + } + catch (Exception e) + { + CError.WriteLine("Exception: " + e); + return; + } + } + + [Theory] + [XmlWriterInlineData] + public void DisposedFileStreamDoesNotCauseCrash5(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteStartElement("foo"); + w.WriteString(new String('a', (2048 * 3) - 50)); + w.WriteCData(String.Empty); + w.WriteComment(String.Empty); + w.WriteCData(String.Empty); + w.WriteComment(String.Empty); + w.WriteEndElement(); + w.Flush(); + ms.Position = 0; + using (StreamReader reader = new StreamReader(ms)) + { + reader.ReadToEnd(); + } + } + } + Assert.True(false); + } + catch (Exception e) + { + CError.WriteLine("Exception: " + e); + return; + } + } + + [Theory] + [XmlWriterInlineData(WriterType.All & ~WriterType.Async)] + public void DisposedFileStreamDoesNotCauseCrash6(XmlWriterUtils utils) + { + XmlWriterSettings ws = new XmlWriterSettings(); + try + { + using (MemoryStream ms = new MemoryStream()) + { + using (XmlWriter w = CreateMemWriter(utils, ms, ws)) + { + w.WriteStartElement("foo"); + w.WriteString(new String('a', (2048 * 3) - 50)); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteString(""); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteString(""); + w.WriteRaw(""); + w.WriteCData(""); + w.WriteString(""); + w.Flush(); + ms.Position = 0; + using (StreamReader reader = new StreamReader(ms)) + { + reader.ReadToEnd(); + } + } + } + + Assert.True(false, "Exception was not thrown"); + } + catch (ObjectDisposedException e) + { + CError.WriteLine("Exception: " + e); return; } - - this.AddChild(new CVariation(TFS_661130) { Attribute = new Variation("XmlWellFormedWriter.Close() throws IndexOutOfRangeException") }); - this.AddChild(new CVariation(XmlWellFormedWriterCloseThrowsIndexOutOfRangeException) { Attribute = new Variation("XmlWellFormedWriter.Close() throws IndexOutOfRangeException") }); - this.AddChild(new CVariation(TFS_661130b) { Attribute = new Variation("XmlWellFormedWriter.Close() throws IndexOutOfRangeException") }); - this.AddChild(new CVariation(TFS_860167) { Attribute = new Variation("IPublisher.PublishPackage crashes due to disposed.MS") { Param = "FileStream" } }); - this.AddChild(new CVariation(TFS_860167a) { Attribute = new Variation("IPublisher.PublishPackage crashes due to disposed.FS") }); - this.AddChild(new CVariation(TFS_860167e) { Attribute = new Variation("IPublisher.PublishPackage crashes due to disposed.BS with MS") }); - this.AddChild(new CVariation(TFS_860167f) { Attribute = new Variation("IPublisher.PublishPackage crashes due to disposed.BS with FS") }); - this.AddChild(new CVariation(TFS_860167b) { Attribute = new Variation("IPublisher.PublishPackage crashes due to dispose.MS.WriteRaw") }); - this.AddChild(new CVariation(TFS_860167c) { Attribute = new Variation("IPublisher.PublishPackage crashes due to dispose.MS.WriteComment") }); - this.AddChild(new CVariation(TFS_860167d) { Attribute = new Variation("IPublisher.PublishPackage crashes due to dispose.MS.WriteCData") }); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCXmlWriterTestModule.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCXmlWriterTestModule.cs deleted file mode 100644 index b2a39a83d8..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TCXmlWriterTestModule.cs +++ /dev/null @@ -1,239 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using OLEDB.Test.ModuleCore; -using Xunit; - -namespace System.Xml.Tests -{ - public partial class XmlWriterTestModule : CTestModule - { - private static void RunTestCase(Func testCaseGenerator) - { - var module = new XmlWriterTestModule(); - - module.Init(null); - module.AddChild(testCaseGenerator()); - module.Execute(); - - Assert.Equal(0, module.FailCount); - } - - private static void RunTest(Func testCaseGenerator) - { - CModInfo.CommandLine = "/WriterType UnicodeWriter"; - RunTestCase(testCaseGenerator); - CModInfo.CommandLine = "/WriterType UnicodeWriter /Async true"; - RunTestCase(testCaseGenerator); - CModInfo.CommandLine = "/WriterType UTF8Writer"; - RunTestCase(testCaseGenerator); - CModInfo.CommandLine = "/WriterType UTF8Writer /Async true"; - RunTestCase(testCaseGenerator); - } - - [Fact] - [OuterLoop] - public static void TCErrorState() - { - RunTest(() => new TCErrorState() { Attribute = new TestCase() { Name = "Invalid State Combinations" } }); - } - - [Fact] - [OuterLoop] - public static void TCAutoComplete() - { - RunTest(() => new TCAutoComplete() { Attribute = new TestCase() { Name = "Auto-completion of tokens" } }); - } - - [Fact] - [OuterLoop] - public static void TCDocument() - { - RunTest(() => new TCDocument() { Attribute = new TestCase() { Name = "WriteStart/EndDocument" } }); - } - - [Fact] - [OuterLoop] - public static void TCDocType() - { - RunTest(() => new TCDocType() { Attribute = new TestCase() { Name = "WriteDocType" } }); - } - - [Fact] - [OuterLoop] - public static void TCElement() - { - RunTest(() => new TCElement() { Attribute = new TestCase() { Name = "WriteStart/EndElement" } }); - } - - [Fact] - [OuterLoop] - public static void TCAttribute() - { - RunTest(() => new TCAttribute() { Attribute = new TestCase() { Name = "WriteStart/EndAttribute" } }); - } - - [Fact] - [OuterLoop] - public static void TCWriteAttributes() - { - RunTest(() => new TCWriteAttributes() { Attribute = new TestCase() { Name = "WriteAttributes(CoreReader)", Param = "COREREADER" } }); - } - - [Fact] - [OuterLoop] - public static void TCWriteNode_XmlReader() - { - RunTest(() => new TCWriteNode_XmlReader() { Attribute = new TestCase() { Name = "WriteNode(CoreReader)", Param = "COREREADER" } }); - } - - [Fact] - [OuterLoop] - public static void TCWriteNode_With_ReadValueChunk() - { - RunTest(() => new TCWriteNode_With_ReadValueChunk() { Attribute = new TestCase() { Name = "WriteNode with streaming API ReadValueChunk - COREREADER", Param = "COREREADER" } }); - } - - [Fact] - [OuterLoop] - [ActiveIssue(22042, TargetFrameworkMonikers.UapNotUapAot)] - public static void TCFullEndElement() - { - RunTest(() => new TCFullEndElement() { Attribute = new TestCase() { Name = "WriteFullEndElement" } }); - } - - [Fact] - [OuterLoop] - public static void TCEOFHandling() - { - RunTest(() => new TCEOFHandling() { Attribute = new TestCase() { Name = "XmlWriterSettings: NewLineHandling" } }); - } - - [Fact] - [OuterLoop] - public static void TCErrorConditionWriter() - { - RunTest(() => new TCErrorConditionWriter() { Attribute = new TestCase() { Name = "ErrorCondition" } }); - } - - [Fact] - [OuterLoop] - public static void TCNamespaceHandling() - { - RunTest(() => new TCNamespaceHandling() { Attribute = new TestCase() { Name = "XmlWriterSettings: NamespaceHandling" } }); - } - - [Fact] - [OuterLoop] - public static void TCDefaultWriterSettings() - { - RunTest(() => new TCDefaultWriterSettings() { Attribute = new TestCase() { Name = "XmlWriterSettings: Default Values" } }); - } - - [Fact] - [OuterLoop] - public static void TCWriterSettingsMisc() - { - RunTest(() => new TCWriterSettingsMisc() { Attribute = new TestCase() { Name = "XmlWriterSettings: Reset/Clone" } }); - } - - [Fact] - [OuterLoop] - public static void TCOmitXmlDecl() - { - RunTest(() => new TCOmitXmlDecl() { Attribute = new TestCase() { Name = "XmlWriterSettings: OmitXmlDeclaration" } }); - } - - [Fact] - [OuterLoop] - public static void TCCheckChars() - { - RunTest(() => new TCCheckChars() { Attribute = new TestCase() { Name = "XmlWriterSettings: CheckCharacters" } }); - } - - [Fact] - [OuterLoop] - public static void TCNewLineHandling() - { - RunTest(() => new TCNewLineHandling() { Attribute = new TestCase() { Name = "XmlWriterSettings: NewLineHandling" } }); - } - - [Fact] - [OuterLoop] - public static void TCNewLineChars() - { - RunTest(() => new TCNewLineChars() { Attribute = new TestCase() { Name = "XmlWriterSettings: NewLineChars" } }); - } - - [Fact] - [OuterLoop] - public static void TCIndent() - { - RunTest(() => new TCIndent() { Attribute = new TestCase() { Name = "XmlWriterSettings: Indent" } }); - } - - [Fact] - [OuterLoop] - public static void TCIndentChars() - { - RunTest(() => new TCIndentChars() { Attribute = new TestCase() { Name = "XmlWriterSettings: IndentChars" } }); - } - - [Fact] - [OuterLoop] - public static void TCNewLineOnAttributes() - { - RunTest(() => new TCNewLineOnAttributes() { Attribute = new TestCase() { Name = "XmlWriterSettings: NewLineOnAttributes" } }); - } - - [Fact] - [OuterLoop] - public static void TCStandAlone() - { - RunTest(() => new TCStandAlone() { Attribute = new TestCase() { Name = "Standalone" } }); - } - - [Fact] - [OuterLoop] - public static void TCCloseOutput() - { - RunTest(() => new TCCloseOutput() { Attribute = new TestCase() { Name = "XmlWriterSettings: CloseOutput" } }); - } - - [Fact] - [OuterLoop] - public static void TCFragmentCL() - { - RunTest(() => new TCFragmentCL() { Attribute = new TestCase() { Name = "CL = Fragment Tests" } }); - } - - [Fact] - [OuterLoop] - public static void TCAutoCL() - { - RunTest(() => new TCAutoCL() { Attribute = new TestCase() { Name = "CL = Auto Tests" } }); - } - - [Fact] - [OuterLoop] - public static void TCFlushClose() - { - RunTest(() => new TCFlushClose() { Attribute = new TestCase() { Name = "Close()/Flush()" } }); - } - - [Fact] - [OuterLoop] - public static void TCWriterWithMemoryStream() - { - RunTest(() => new TCWriterWithMemoryStream() { Attribute = new TestCase() { Name = "XmlWriter with MemoryStream" } }); - } - - [Fact] - [OuterLoop] - public static void TCWriteEndDocumentOnCloseTest() - { - RunTest(() => new TCWriteEndDocumentOnCloseTest() { Attribute = new TestCase() { Name = "XmlWriterSettings: WriteEndDocumentOnClose" } }); - } - } -} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TestExtensions.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TestExtensions.cs new file mode 100644 index 0000000000..bea00ae9de --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/TestExtensions.cs @@ -0,0 +1,123 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Xunit.Abstractions; +using Xunit.Sdk; +using XmlCoreTest.Common; + +namespace System.Xml.Tests +{ + // Based on https://github.com/xunit/xunit/blob/bccfcccf26b2c63c90573fe1a17e6572882ef39c/src/xunit.core/Sdk/InlineDataDiscoverer.cs + public class XmlWriterInlineDataDiscoverer : IDataDiscoverer + { + public static IEnumerable GenerateTestCases(WriterType writerTypeFlags, object[] args) + { + bool noAsyncFlag = writerTypeFlags.HasFlag(WriterType.NoAsync); + bool asyncFlag = writerTypeFlags.HasFlag(WriterType.Async); + + if (!noAsyncFlag && !asyncFlag) + { + // flags for writers specified directly, none of those would mean no tests should be run + // this is likely not what was meant + noAsyncFlag = true; + asyncFlag = true; + } + + foreach (WriterType writerType in GetWriterTypes(writerTypeFlags)) + { + if (noAsyncFlag) + yield return Prepend(args, new XmlWriterUtils(writerType, async: false)).ToArray(); + + if (asyncFlag) + yield return Prepend(args, new XmlWriterUtils(writerType, async: true)).ToArray(); + } + } + + private static object[] Prepend(object[] arr, object o) + { + List list = new List(); + list.Add(o); + list.AddRange(arr); + return list.ToArray(); + } + + private static IEnumerable GetWriterTypes(WriterType writerTypeFlags) + { + if (writerTypeFlags.HasFlag(WriterType.UTF8Writer)) + yield return WriterType.UTF8Writer; + + if (writerTypeFlags.HasFlag(WriterType.UnicodeWriter)) + yield return WriterType.UnicodeWriter; + + if (writerTypeFlags.HasFlag(WriterType.CustomWriter)) + yield return WriterType.CustomWriter; + + if (writerTypeFlags.HasFlag(WriterType.CharCheckingWriter)) + yield return WriterType.CharCheckingWriter; + + if (writerTypeFlags.HasFlag(WriterType.UTF8WriterIndent)) + yield return WriterType.UTF8WriterIndent; + + if (writerTypeFlags.HasFlag(WriterType.UnicodeWriterIndent)) + yield return WriterType.UnicodeWriterIndent; + + if (writerTypeFlags.HasFlag(WriterType.WrappedWriter)) + yield return WriterType.WrappedWriter; + } + + public virtual IEnumerable GetData(IAttributeInfo dataAttribute, IMethodInfo testMethod) + { + object[] constructorArgs = dataAttribute.GetConstructorArguments().ToArray(); + + if (constructorArgs.Length == 1) + { + object[] args = ((IEnumerable)constructorArgs[0] ?? new object[] { null }).ToArray(); + return GenerateTestCases(WriterType.All, args); + } + + if (constructorArgs.Length == 2) + { + WriterType writerTypeFlags = (WriterType)constructorArgs[0]; + object[] args = ((IEnumerable)constructorArgs[1] ?? new object[] { null }).ToArray(); + return GenerateTestCases(writerTypeFlags, args); + } + + throw new Exception("Invalid args"); + } + + public virtual bool SupportsDiscoveryEnumeration(IAttributeInfo dataAttribute, IMethodInfo testMethod) + { + return true; + } + } + + // Based on https://github.com/xunit/xunit/blob/bccfcccf26b2c63c90573fe1a17e6572882ef39c/src/xunit.core/InlineDataAttribute.cs + [DataDiscoverer("System.Xml.Tests.XmlWriterInlineDataDiscoverer", "System.Xml.RW.XmlWriterApi.Tests")] + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] + public sealed class XmlWriterInlineDataAttribute : DataAttribute + { + private readonly object[] _data; + WriterType _writerTypeFlags; + + public XmlWriterInlineDataAttribute(params object[] data) + { + _data = data; + _writerTypeFlags = WriterType.All; + } + + public XmlWriterInlineDataAttribute(WriterType writerTypeFlag, params object[] data) + { + _data = data; + _writerTypeFlags = writerTypeFlag; + } + + public override IEnumerable GetData(MethodInfo testMethod) + { + return XmlWriterInlineDataDiscoverer.GenerateTestCases(_writerTypeFlags, _data); + } + } +} diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/WriteEndDocumentOnCloseTest.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/WriteEndDocumentOnCloseTest.cs index 446fca5c74..194300c23d 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/WriteEndDocumentOnCloseTest.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/WriteEndDocumentOnCloseTest.cs @@ -4,18 +4,17 @@ using OLEDB.Test.ModuleCore; using System.IO; +using Xunit; namespace System.Xml.Tests { - //[TestCase(Name = "XmlWriterSettings: WriteEndDocumentOnClose")] - public partial class TCWriteEndDocumentOnCloseTest : XmlWriterTestCaseBase + public partial class TCWriteEndDocumentOnCloseTest { - //[Variation(Desc = "write element with text but without end element when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "text" })] - //[Variation(Desc = "write element with text but without end element when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "text" })] - public int TestWriteEndDocumentOnCoseForOneElementwithText() + [Theory] + [InlineData(false, "text")] + [InlineData(true, "text")] + public void TestWriteEndDocumentOnCoseForOneElementwithText(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -26,17 +25,13 @@ namespace System.Xml.Tests writer.Dispose(); string act = output.ToString(); CError.Compare(act, expected, "FAILED: when one element with text and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - - //[Variation(Desc = "write start element and then close when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "write start element and then close when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForOneElement() + [Theory] + [InlineData(false, "")] + [InlineData(true, "")] + public void TestWriteEndDocumentOnCoseForOneElement(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -47,16 +42,13 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when one start element and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - //[Variation(Desc = "write start element and with attribute then close when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "write start element and with attribute then close when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForOneElementwithAttribute() + [Theory] + [InlineData(false, "")] + [InlineData(true, "")] + public void TestWriteEndDocumentOnCoseForOneElementwithAttribute(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -68,16 +60,13 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when one start element with attribute and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - //[Variation(Desc = "write start element and with attribute value then close when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "write start element and with attribute value then close when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForOneElementwithAttributeValue() + [InlineData(false, "")] + [InlineData(true, "")] + [Theory] + public void TestWriteEndDocumentOnCoseForOneElementwithAttributeValue(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -89,15 +78,13 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when one start element with attribute value and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - //[Variation(Desc = "write start element and with namespace then close when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "write start element and with namespace then close when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForOneElementwithNamespace() + + [Theory] + [InlineData(false, "")] + [InlineData(true, "")] + public void TestWriteEndDocumentOnCoseForOneElementwithNamespace(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -108,17 +95,13 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when one element with namespace and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - - //[Variation(Desc = "write multi start elements then close when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "write multi start elements then close when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForMultiElements() + [Theory] + [InlineData(false, "")] + [InlineData(true, "")] + public void TestWriteEndDocumentOnCoseForMultiElements(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -131,16 +114,13 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when multi element and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - //[Variation(Desc = "Write two elements only one with end elment when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "Write two elements only one with end elment when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForElementsWithOneEndElement() + [Theory] + [InlineData(false, "")] + [InlineData(true, "")] + public void TestWriteEndDocumentOnCoseForElementsWithOneEndElement(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -153,16 +133,13 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when two element with one end element and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } - //[Variation(Desc = "Write one element with end elment when the WriteEndDocumentOnClose = false", Pri = 1, Params = new object[] { false, "" })] - //[Variation(Desc = "Write one element with end elment when the WriteEndDocumentOnClose = true", Pri = 1, Params = new object[] { true, "" })] - public int TestWriteEndDocumentOnCoseForOneElementWithEndElement() + [Theory] + [InlineData(false, "")] + [InlineData(true, "")] + public void TestWriteEndDocumentOnCoseForOneElementWithEndElement(bool writeEndDocument, string expected) { - bool writeEndDocument = (bool)CurVariation.Params[0]; - string expected = (string)CurVariation.Params[1]; StringWriter output = new StringWriter(); XmlWriterSettings ws = new XmlWriterSettings(); ws.OmitXmlDeclaration = true; @@ -174,8 +151,6 @@ namespace System.Xml.Tests string act = output.ToString(); CError.Compare(act, expected, "FAILED: when one element with end element and WriteEndDocumentOnClose = " + ws.WriteEndDocumentOnClose + ", expected: " + expected + ", received: " + act); - - return TEST_PASS; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlFactoryWriterTests.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlFactoryWriterTests.cs.REMOVED.git-id deleted file mode 100644 index b29dd236ea..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlFactoryWriterTests.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f5907a219e93539954f3f42bcecd98572f2a8a04 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestCaseBase.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestCaseBase.cs index ab2a44c748..50ec00159c 100644 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestCaseBase.cs +++ b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestCaseBase.cs @@ -8,61 +8,50 @@ using XmlCoreTest.Common; namespace System.Xml.Tests { - public abstract partial class XmlWriterTestCaseBase : CTestCase + public class XmlWriterUtils { public static string nl = Environment.NewLine; - public XmlWriterTestCaseBase() : base() { } + public bool Async { get; private set; } - public override int Init(object o) - { - return base.Init(o); - } + public WriterType WriterType => WriterFactory.WriterType; - public XmlWriterTestModule XmlWriterTestModule - { - get - { - return (XmlWriterTestModule)this.TestModule; - } - } + internal WriterFactory WriterFactory { get; private set; } - public WriterType WriterType + public XmlWriterUtils(WriterType writerType, bool async) { - get - { - return this.XmlWriterTestModule.WriterFactory.WriterType; - } - } - - public string BaselinePath - { - get - { - return this.XmlWriterTestModule.BaselinePath; - } - } - - public string FullPath(string fileName) - { - if (fileName == null || fileName == String.Empty) - return fileName; - return BaselinePath + fileName; + WriterFactory = new WriterFactory(writerType); + Async = async; } public virtual XmlWriter CreateWriter() { - return this.XmlWriterTestModule.WriterFactory.CreateWriter(); + return WriterFactory.CreateWriter(); } public virtual XmlWriter CreateWriter(XmlWriterSettings s) { - return this.XmlWriterTestModule.WriterFactory.CreateWriter(s); + return WriterFactory.CreateWriter(s); + } + + public virtual XmlWriter CreateWriter(ConformanceLevel cl) + { + return WriterFactory.CreateWriter(cl); } public virtual XmlReader GetReader() { - return this.XmlWriterTestModule.WriterFactory.GetReader(); + return WriterFactory.GetReader(); + } + + internal static string BaselinePath => Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlWriter2\"); + + public static string FullPath(string fileName) + { + if (fileName == null || fileName == string.Empty) + return fileName; + + return BaselinePath + fileName; } public bool CompareReader(string strExpected) @@ -74,39 +63,26 @@ namespace System.Xml.Tests StringReader sr = new StringReader(strExpected); XmlReader xrExpected = XmlReader.Create(sr, readerSettings); - return this.XmlWriterTestModule.WriterFactory.CompareReader(xrExpected); + return WriterFactory.CompareReader(xrExpected); + } + + public virtual string GetString() + { + return WriterFactory.GetString(); } public bool CompareString(string strExpected) { - CError.WriteLine(this.XmlWriterTestModule.WriterFactory.GetString()); + CError.WriteLine(WriterFactory.GetString()); if (strExpected.Contains("~")) - return this.XmlWriterTestModule.WriterFactory.CompareStringWithPrefixes(strExpected); + return WriterFactory.CompareStringWithPrefixes(strExpected); - - return this.XmlWriterTestModule.WriterFactory.CompareString(strExpected); - } - - public string RemoveSpaceInDocType(string xml) - { - int docPos = xml.IndexOf("', docPos + "= buffer.Length) - { - int originalLen = buffer.Length; - byte[] newBuffer = new byte[(int)(len * 2)]; - for (int i = 0; i < originalLen; newBuffer[i] = buffer[i++]) - { - // Intentionally Empty - } - buffer = newBuffer; - } - } - public static void WriteToBuffer(ref byte[] destBuff, ref int len, byte srcByte) - { - ensureSpace(ref destBuff, len); - destBuff[len++] = srcByte; - } - - public static void WriteToBuffer(ref byte[] destBuff, ref int len, byte[] srcBuff) - { - int srcArrayLen = srcBuff.Length; - WriteToBuffer(ref destBuff, ref len, srcBuff, 0, (int)srcArrayLen); - } - - public static void WriteToBuffer(ref byte[] destBuff, ref int destStart, byte[] srcBuff, int srcStart, int count) - { - ensureSpace(ref destBuff, destStart + count - 1); - for (int i = srcStart; i < srcStart + count; i++) - { - destBuff[destStart++] = srcBuff[i]; - } - } - - public static void WriteToBuffer(ref byte[] destBuffer, ref int destBuffLen, String strValue) - { - for (int i = 0; i < strValue.Length; i++) - { - WriteToBuffer(ref destBuffer, ref destBuffLen, System.BitConverter.GetBytes(strValue[i])); - } - - WriteToBuffer(ref destBuffer, ref destBuffLen, System.BitConverter.GetBytes('\0')); + return WriterFactory.CompareReader(xrExpected); } } } diff --git a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestModule.cs b/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestModule.cs deleted file mode 100644 index 0589a0510e..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/Writers/XmlWriterApi/XmlWriterTestModule.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using OLEDB.Test.ModuleCore; -using System.IO; -using XmlCoreTest.Common; - -namespace System.Xml.Tests -{ - //[TestModule(Name="XmlWriter API")] - public partial class XmlWriterTestModule : CTestModule - { - public XmlWriterTestModule() : base() - { - } - - protected WriterType writerType1; - public WriterType WriterType - { - get - { - return writerType1; - } - } - - protected WriterFactory writerFactory1 = null; - public WriterFactory WriterFactory - { - get - { - return writerFactory1; - } - } - - protected string baselinePath1; - public string BaselinePath - { - get - { - return baselinePath1; - } - } - - public override int Init(object objParam) - { - baselinePath1 = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlWriter2\"); - string temp = FilePathUtil.GetVariableValue("WriterType").ToUpperInvariant(); - - switch (temp) - { - case "UTF8WRITER": - writerType1 = WriterType.UTF8Writer; - break; - case "UNICODEWRITER": - writerType1 = WriterType.UnicodeWriter; - break; - case "CUSTOMWRITER": - writerType1 = WriterType.CustomWriter; - break; - case "UTF8WRITERINDENT": - writerType1 = WriterType.UTF8WriterIndent; - break; - case "UNICODEWRITERINDENT": - writerType1 = WriterType.UnicodeWriterIndent; - break; - case "CHARCHECKINGWRITER": - writerType1 = WriterType.CharCheckingWriter; - break; - case "WRAPPEDWRITER": - writerType1 = WriterType.WrappedWriter; - break; - default: - throw new Exception("Unknown writer type: " + temp); - } - - writerFactory1 = new XmlCoreTest.Common.WriterFactory(writerType1); - return base.Init(objParam); - } - } -} diff --git a/external/corefx/src/System.Private.Xml/tests/XmlConvert/System.Xml.RW.XmlConvert.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlConvert/System.Xml.RW.XmlConvert.Tests.csproj index ab7570f2c9..c954f015e3 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlConvert/System.Xml.RW.XmlConvert.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlConvert/System.Xml.RW.XmlConvert.Tests.csproj @@ -44,6 +44,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/XmlConvert/XmlConvertTests.cs b/external/corefx/src/System.Private.Xml/tests/XmlConvert/XmlConvertTests.cs index 51acc9c772..86bd00aee8 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlConvert/XmlConvertTests.cs +++ b/external/corefx/src/System.Private.Xml/tests/XmlConvert/XmlConvertTests.cs @@ -9,204 +9,47 @@ namespace System.Xml.Tests { public class XmlConvertTests : CTestModule { - [Fact] - [OuterLoop] - public static void EncodeDecodeTests() + [Theory] + [XmlTests(nameof(Create))] + public void RunTests(XunitTestCase testCase) { - RunTestCase(new EncodeDecodeTests { Attribute = new TestCase { Name = "EncodeName/DecodeName", Desc = "XmlConvert" } }); + testCase.Run(); } - [Fact] - [OuterLoop] - public static void MiscellaneousTests() - { - RunTestCase(new MiscellaneousTests { Attribute = new TestCase { Name = "Misc. Bug Regressions", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void SqlXmlConvertTests0() - { - RunTestCase(new SqlXmlConvertTests0 { Attribute = new TestCase { Name = "2. XmlConvert (SQL-XML EncodeName) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void SqlXmlConvertTests1() - { - RunTestCase(new SqlXmlConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (SQL-XML EncodeName) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void SqlXmlConvertTests2() - { - RunTestCase(new SqlXmlConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (SQL-XML EncodeName) EncodeName-DecodeName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void SqlXmlConvertTests3() - { - RunTestCase(new SqlXmlConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (SQL-XML EncodeName) EncodeLocalName only", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void ToTypeTests() - { - RunTestCase(new ToTypeTests { Attribute = new TestCase { Name = "XmlConvert type conversion functions", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void VerifyNameTests1() - { - RunTestCase(new VerifyNameTests1 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void VerifyNameTests2() - { - RunTestCase(new VerifyNameTests2 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void VerifyNameTests3() - { - RunTestCase(new VerifyNameTests3 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void VerifyNameTests4() - { - RunTestCase(new VerifyNameTests4 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void VerifyNameTests5() - { - RunTestCase(new VerifyNameTests5 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlBaseCharConvertTests1() - { - RunTestCase(new XmlBaseCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Base Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlBaseCharConvertTests2() - { - RunTestCase(new XmlBaseCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Base Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlBaseCharConvertTests3() - { - RunTestCase(new XmlBaseCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Base Char) EncodeName-DecodeName ", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlCombiningCharConvertTests1() - { - RunTestCase(new XmlCombiningCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Combining Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlCombiningCharConvertTests2() - { - RunTestCase(new XmlCombiningCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Combining Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlCombiningCharConvertTests3() - { - RunTestCase(new XmlCombiningCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Combining Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlDigitCharConvertTests1() - { - RunTestCase(new XmlDigitCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Digit Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlDigitCharConvertTests2() - { - RunTestCase(new XmlDigitCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Digit Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlDigitCharConvertTests3() - { - RunTestCase(new XmlDigitCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Digit Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlEmbeddedNullCharConvertTests1() - { - RunTestCase(new XmlEmbeddedNullCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (EmbeddedNull Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlEmbeddedNullCharConvertTests2() - { - RunTestCase(new XmlEmbeddedNullCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (EmbeddedNull Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlEmbeddedNullCharConvertTests3() - { - RunTestCase(new XmlEmbeddedNullCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (EmbeddedNull Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlIdeographicCharConvertTests1() - { - RunTestCase(new XmlIdeographicCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Ideographic Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlIdeographicCharConvertTests2() - { - RunTestCase(new XmlIdeographicCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Ideographic Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); - } - - [Fact] - [OuterLoop] - public static void XmlIdeographicCharConvertTests3() - { - RunTestCase(new XmlIdeographicCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Ideographic Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); - } - - private static void RunTestCase(CTestBase testCase) + public static CTestModule Create() { var module = new XmlConvertTests(); module.Init(null); - module.AddChild(testCase); - module.Execute(); + module.AddChild(new EncodeDecodeTests { Attribute = new TestCase { Name = "EncodeName/DecodeName", Desc = "XmlConvert" } }); + module.AddChild(new MiscellaneousTests { Attribute = new TestCase { Name = "Misc. Bug Regressions", Desc = "XmlConvert" } }); + module.AddChild(new SqlXmlConvertTests0 { Attribute = new TestCase { Name = "2. XmlConvert (SQL-XML EncodeName) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); + module.AddChild(new SqlXmlConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (SQL-XML EncodeName) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); + module.AddChild(new SqlXmlConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (SQL-XML EncodeName) EncodeName-DecodeName", Desc = "XmlConvert" } }); + module.AddChild(new SqlXmlConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (SQL-XML EncodeName) EncodeLocalName only", Desc = "XmlConvert" } }); + module.AddChild(new ToTypeTests { Attribute = new TestCase { Name = "XmlConvert type conversion functions", Desc = "XmlConvert" } }); + module.AddChild(new VerifyNameTests1 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); + module.AddChild(new VerifyNameTests2 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); + module.AddChild(new VerifyNameTests3 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); + module.AddChild(new VerifyNameTests4 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); + module.AddChild(new VerifyNameTests5 { Attribute = new TestCase { Name = "VerifyName,VerifyNCName,VerifyNMTOKEN,VerifyXmlChar,VerifyWhitespace,VerifyPublicId", Desc = "XmlConvert" } }); + module.AddChild(new XmlBaseCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Base Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); + module.AddChild(new XmlBaseCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Base Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); + module.AddChild(new XmlBaseCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Base Char) EncodeName-DecodeName ", Desc = "XmlConvert" } }); + module.AddChild(new XmlCombiningCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Combining Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); + module.AddChild(new XmlCombiningCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Combining Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); + module.AddChild(new XmlCombiningCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Combining Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); + module.AddChild(new XmlDigitCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Digit Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); + module.AddChild(new XmlDigitCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Digit Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); + module.AddChild(new XmlDigitCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Digit Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); + module.AddChild(new XmlEmbeddedNullCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (EmbeddedNull Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); + module.AddChild(new XmlEmbeddedNullCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (EmbeddedNull Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); + module.AddChild(new XmlEmbeddedNullCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (EmbeddedNull Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); + module.AddChild(new XmlIdeographicCharConvertTests1 { Attribute = new TestCase { Name = "1. XmlConvert (Boundary Ideographic Char) EncodeName-EncodeLocalName", Desc = "XmlConvert" } }); + module.AddChild(new XmlIdeographicCharConvertTests2 { Attribute = new TestCase { Name = "2. XmlConvert (Boundary Ideographic Char) EncodeNmToken-EncodeLocalNmToken", Desc = "XmlConvert" } }); + module.AddChild(new XmlIdeographicCharConvertTests3 { Attribute = new TestCase { Name = "3. XmlConvert (Boundary Ideographic Char) EncodeName-DecodeName", Desc = "XmlConvert" } }); - Assert.Equal(0, module.FailCount); + return module; } } } diff --git a/external/corefx/src/System.Private.Xml/tests/XmlDocument/Performance/Configurations.props b/external/corefx/src/System.Private.Xml/tests/XmlDocument/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/XmlDocument/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/XmlReader/XmlResolver/System.Xml.RW.XmlSystemPathResolver.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlReader/XmlResolver/System.Xml.RW.XmlSystemPathResolver.Tests.csproj index 455fa612b6..15324eeacd 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlReader/XmlResolver/System.Xml.RW.XmlSystemPathResolver.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlReader/XmlResolver/System.Xml.RW.XmlSystemPathResolver.Tests.csproj @@ -11,9 +11,6 @@ - - Common\System\PlatformDetection.cs - TestFiles\%(RecursiveDir)%(Filename)%(Extension) TestFiles\%(RecursiveDir) diff --git a/external/corefx/src/System.Private.Xml/tests/XmlReaderLib/System.Xml.RW.XmlReaderLib.csproj b/external/corefx/src/System.Private.Xml/tests/XmlReaderLib/System.Xml.RW.XmlReaderLib.csproj index 456772fe64..8ee7108742 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlReaderLib/System.Xml.RW.XmlReaderLib.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlReaderLib/System.Xml.RW.XmlReaderLib.csproj @@ -87,4 +87,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSchema/TestFiles/TestData/XMLSchema.xsd b/external/corefx/src/System.Private.Xml/tests/XmlSchema/TestFiles/TestData/XMLSchema.xsd index 0b43d858d8..2785091d5b 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSchema/TestFiles/TestData/XMLSchema.xsd +++ b/external/corefx/src/System.Private.Xml/tests/XmlSchema/TestFiles/TestData/XMLSchema.xsd @@ -391,7 +391,7 @@ Not allowed if simpleContent child is chosen. - May be overriden by setting on complexContent child. + May be overridden by setting on complexContent child. diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/System.Xml.XmlSchemaSet.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/System.Xml.XmlSchemaSet.Tests.csproj index 9c732c3815..f0f80d6f4e 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/System.Xml.XmlSchemaSet.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/System.Xml.XmlSchemaSet.Tests.csproj @@ -44,9 +44,6 @@ Common\System\IO\TempDirectory.cs - - Common\System\PlatformDetection.cs - TestFiles\%(RecursiveDir)%(Filename)%(Extension) TestFiles\%(RecursiveDir) diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs b/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs index 50f358cb82..81b774c6c1 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs +++ b/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs @@ -72,7 +72,7 @@ namespace System.Xml.Tests } } - //[Variation(Desc = "v2 - Bug115049 - XSD: content model validation for an invalid root element should be adandoned", Priority = 2)] + //[Variation(Desc = "v2 - Bug115049 - XSD: content model validation for an invalid root element should be abandoned", Priority = 2)] [InlineData()] [Theory] public void v2() diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests.csproj index 2237e988b7..3077526a8c 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/System.Xml.XmlSchema.XmlSchemaValidatorApi.Tests.csproj @@ -30,9 +30,6 @@ Common\System\IO\TempDirectory.cs - - Common\System\PlatformDetection.cs - TestFiles\%(RecursiveDir)%(Filename)%(Extension) TestFiles\%(RecursiveDir) diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/Performance/System.Xml.XmlSerializer.Performance.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/Performance/System.Xml.XmlSerializer.Performance.Tests.csproj index 3034650f4d..a04c4db3fb 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/Performance/System.Xml.XmlSerializer.Performance.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/Performance/System.Xml.XmlSerializer.Performance.Tests.csproj @@ -13,11 +13,9 @@ + - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj index 5880a07733..11e1057ae5 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj @@ -13,12 +13,11 @@ + + - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj index fb06113c7e..261a6360d6 100644 --- a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/System.Xml.XmlSerializer.Tests.csproj @@ -12,11 +12,10 @@ + - - CommonTest\System\PlatformDetection.cs - + diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs.REMOVED.git-id new file mode 100644 index 0000000000..25b627cf18 --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs.REMOVED.git-id @@ -0,0 +1 @@ +0eb45820c158253fabd99ed1dbdd11060e442cce \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs new file mode 100644 index 0000000000..821329e542 --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs @@ -0,0 +1,1811 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using SerializationTypes; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Schema; +using System.Xml.Serialization; +using Xunit; + +public static partial class XmlSerializerTests +{ +#if ReflectionOnly|| XMLSERIALIZERGENERATORTESTS + private static readonly string SerializationModeSetterName = "set_Mode"; + + static XmlSerializerTests() + { + if (!PlatformDetection.IsFullFramework) + { + MethodInfo method = typeof(XmlSerializer).GetMethod(SerializationModeSetterName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); + Assert.True(method != null, $"No method named {SerializationModeSetterName}"); +#if ReflectionOnly + method.Invoke(null, new object[] { 1 }); +#endif +#if XMLSERIALIZERGENERATORTESTS + method.Invoke(null, new object[] { 3 }); +#endif + } + } +#endif + + private static bool IsTimeSpanSerializationAvailable => !PlatformDetection.IsFullFramework || (AppContext.TryGetSwitch("Switch.System.Xml.EnableTimeSpanSerialization", out bool result) && result); + + [Fact] + public static void Xml_TypeWithDateTimePropertyAsXmlTime() + { + DateTime localTime = new DateTime(549269870000L, DateTimeKind.Local); + TypeWithDateTimePropertyAsXmlTime localTimeOjbect = new TypeWithDateTimePropertyAsXmlTime() + { + Value = localTime + }; + + // This is how we convert DateTime from time to string. + var localTimeDateTime = DateTime.MinValue + localTime.TimeOfDay; + string localTimeString = localTimeDateTime.ToString("HH:mm:ss.fffffffzzzzzz", DateTimeFormatInfo.InvariantInfo); + TypeWithDateTimePropertyAsXmlTime localTimeOjbectRoundTrip = SerializeAndDeserialize(localTimeOjbect, +string.Format(@" +{0}", localTimeString)); + + Assert.StrictEqual(localTimeOjbect.Value, localTimeOjbectRoundTrip.Value); + + TypeWithDateTimePropertyAsXmlTime utcTimeOjbect = new TypeWithDateTimePropertyAsXmlTime() + { + Value = new DateTime(549269870000L, DateTimeKind.Utc) + }; + + if (IsTimeSpanSerializationAvailable) + { + TypeWithDateTimePropertyAsXmlTime utcTimeRoundTrip = SerializeAndDeserialize(utcTimeOjbect, + @" +15:15:26.9870000Z"); + + Assert.StrictEqual(utcTimeOjbect.Value, utcTimeRoundTrip.Value); + } + } + + [Fact] + public static void Xml_ArrayAsGetSet() + { + TypeWithGetSetArrayMembers x = new TypeWithGetSetArrayMembers + { + F1 = new SimpleType[] { new SimpleType { P1 = "ab", P2 = 1 }, new SimpleType { P1 = "cd", P2 = 2 } }, + F2 = new int[] { -1, 3 }, + P1 = new SimpleType[] { new SimpleType { P1 = "ef", P2 = 5 }, new SimpleType { P1 = "gh", P2 = 7 } }, + P2 = new int[] { 11, 12 } + }; + TypeWithGetSetArrayMembers y = SerializeAndDeserialize(x, +@" + + + + ab + 1 + + + cd + 2 + + + + -1 + 3 + + + + ef + 5 + + + gh + 7 + + + + 11 + 12 + +"); + + Assert.NotNull(y); + Utils.Equal(x.F1, y.F1, (a, b) => { return SimpleType.AreEqual(a, b); }); + Assert.Equal(x.F2, y.F2); + Utils.Equal(x.P1, y.P1, (a, b) => { return SimpleType.AreEqual(a, b); }); + Assert.Equal(x.P2, y.P2); + } + + [Fact] + public static void Xml_ArrayAsGetOnly() + { + TypeWithGetOnlyArrayProperties x = new TypeWithGetOnlyArrayProperties(); + x.P1[0] = new SimpleType { P1 = "ab", P2 = 1 }; + x.P1[1] = new SimpleType { P1 = "cd", P2 = 2 }; + x.P2[0] = -1; + x.P2[1] = 3; + + TypeWithGetOnlyArrayProperties y = SerializeAndDeserialize(x, +@" +"); + + Assert.NotNull(y); + // XmlSerializer seems not complain about missing public setter of Array property + // However, it does not serialize the property. So for this test case, I'll use it to verify there are no complaints about missing public setter + } + + [Fact] + public static void Xml_ListRoot() + { + MyList x = new MyList("a1", "a2"); + MyList y = SerializeAndDeserialize(x, +@" + + a1 + a2 +"); + + Assert.NotNull(y); + Assert.True(y.Count == 2); + Assert.StrictEqual((string)x[0], (string)y[0]); + Assert.StrictEqual((string)x[1], (string)y[1]); + } + + [Fact] + public static void Xml_EnumAsRoot() + { + Assert.StrictEqual(SerializeAndDeserialize(MyEnum.Two, +@" +Two"), MyEnum.Two); + Assert.StrictEqual(SerializeAndDeserialize(ByteEnum.Option1, +@" +Option1"), ByteEnum.Option1); + Assert.StrictEqual(SerializeAndDeserialize(SByteEnum.Option1, +@" +Option1"), SByteEnum.Option1); + Assert.StrictEqual(SerializeAndDeserialize(ShortEnum.Option1, +@" +Option1"), ShortEnum.Option1); + Assert.StrictEqual(SerializeAndDeserialize(IntEnum.Option1, +@" +Option1"), IntEnum.Option1); + Assert.StrictEqual(SerializeAndDeserialize(UIntEnum.Option1, +@" +Option1"), UIntEnum.Option1); + Assert.StrictEqual(SerializeAndDeserialize(LongEnum.Option1, +@" +Option1"), LongEnum.Option1); + Assert.StrictEqual(SerializeAndDeserialize(ULongEnum.Option1, +@" +Option1"), ULongEnum.Option1); + } + + [Fact] + public static void Xml_EnumAsMember() + { + TypeWithEnumMembers x = new TypeWithEnumMembers { F1 = MyEnum.Three, P1 = MyEnum.Two }; + TypeWithEnumMembers y = SerializeAndDeserialize(x, +@" + + Three + Two +"); + + Assert.NotNull(y); + Assert.StrictEqual(x.F1, y.F1); + Assert.StrictEqual(x.P1, y.P1); + } + + [Fact] + public static void Xml_DCClassWithEnumAndStruct() + { + DCClassWithEnumAndStruct value = new DCClassWithEnumAndStruct(true); + DCClassWithEnumAndStruct actual = SerializeAndDeserialize(value, +@" + + + Data + + One +"); + + Assert.StrictEqual(value.MyEnum1, actual.MyEnum1); + Assert.StrictEqual(value.MyStruct.Data, actual.MyStruct.Data); + } + + [Fact] + public static void Xml_BuiltInTypes() + { + BuiltInTypes x = new BuiltInTypes + { + ByteArray = new byte[] { 1, 2 } + }; + BuiltInTypes y = SerializeAndDeserialize(x, +@" + + AQI= +"); + + Assert.NotNull(y); + Assert.Equal(x.ByteArray, y.ByteArray); + } + + [Fact] + public static void Xml_TypesWithArrayOfOtherTypes() + { + SerializeAndDeserialize(new TypeHasArrayOfASerializedAsB(true), +@" + + + + typeAValue + + + typeBValue + + +"); + } + + [Fact] + public static void Xml_TypeNamesWithSpecialCharacters() + { + SerializeAndDeserialize<__TypeNameWithSpecialCharacters漢ñ>(new __TypeNameWithSpecialCharacters漢ñ() { PropertyNameWithSpecialCharacters漢ñ = "Test" }, +@" +<__TypeNameWithSpecialCharacters漢ñ xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> + Test +"); + } + + [Fact] + public static void Xml_KnownTypesThroughConstructor() + { + KnownTypesThroughConstructor value = new KnownTypesThroughConstructor() { EnumValue = MyEnum.One, SimpleTypeValue = new SimpleKnownTypeValue() { StrProperty = "PropertyValue" } }; + KnownTypesThroughConstructor actual = SerializeAndDeserialize(value, +@" + + One + + PropertyValue + +", + () => { return new XmlSerializer(typeof(KnownTypesThroughConstructor), new Type[] { typeof(MyEnum), typeof(SimpleKnownTypeValue) }); }); + + Assert.StrictEqual((MyEnum)value.EnumValue, (MyEnum)actual.EnumValue); + Assert.StrictEqual(((SimpleKnownTypeValue)value.SimpleTypeValue).StrProperty, ((SimpleKnownTypeValue)actual.SimpleTypeValue).StrProperty); + } + + [Fact] + public static void Xml_BaseClassAndDerivedClassWithSameProperty() + { + DerivedClassWithSameProperty value = new DerivedClassWithSameProperty() { DateTimeProperty = new DateTime(100), IntProperty = 5, StringProperty = "TestString", ListProperty = new List() }; + value.ListProperty.AddRange(new string[] { "one", "two", "three" }); + + DerivedClassWithSameProperty actual = SerializeAndDeserialize(value, +@" + + TestString + 5 + 0001-01-01T00:00:00.00001 + + one + two + three + +"); + + Assert.StrictEqual(value.DateTimeProperty, actual.DateTimeProperty); + Assert.StrictEqual(value.IntProperty, actual.IntProperty); + Assert.StrictEqual(value.StringProperty, actual.StringProperty); + Assert.Equal(value.ListProperty.ToArray(), actual.ListProperty.ToArray()); + } + + [Fact] + public static void Xml_EnumFlags() + { + EnumFlags value1 = EnumFlags.One | EnumFlags.Four; + var value2 = SerializeAndDeserialize(value1, +@" +One Four"); + Assert.StrictEqual(value1, value2); + } + + [Fact] + public static void Xml_SerializeClassThatImplementsInteface() + { + ClassImplementsInterface value = new ClassImplementsInterface() { ClassID = "ClassID", DisplayName = "DisplayName", Id = "Id", IsLoaded = true }; + ClassImplementsInterface actual = SerializeAndDeserialize(value, +@" + + ClassID + DisplayName + Id + true +"); + + Assert.StrictEqual(value.ClassID, actual.ClassID); + Assert.StrictEqual(value.DisplayName, actual.DisplayName); + Assert.StrictEqual(value.Id, actual.Id); + Assert.StrictEqual(value.IsLoaded, actual.IsLoaded); + } + + + [Fact] + public static void Xml_XmlAttributesTest() + { + var value = new XmlSerializerAttributes(); + var actual = SerializeAndDeserialize(value, +@" + + String choice value + DecimalNumber + + DecimalNumber + Number + Word + None + <xml>Hello XML</xml>XmlNamespaceDeclarationsPropertyValue1onetwothree"); + + Assert.StrictEqual(actual.EnumType, value.EnumType); + Assert.StrictEqual(actual.MyChoice, value.MyChoice); + object[] stringArray = actual.XmlArrayProperty.Where(x => x != null) + .Select(x => x.ToString()) + .ToArray(); + Assert.Equal(stringArray, value.XmlArrayProperty); + Assert.StrictEqual(actual.XmlAttributeProperty, value.XmlAttributeProperty); + Assert.StrictEqual(actual.XmlElementProperty, value.XmlElementProperty); + Assert.Equal(actual.XmlEnumProperty, value.XmlEnumProperty); + Assert.StrictEqual(actual.XmlIncludeProperty, value.XmlIncludeProperty); + Assert.StrictEqual(actual.XmlNamespaceDeclarationsProperty, value.XmlNamespaceDeclarationsProperty); + Assert.StrictEqual(actual.XmlTextProperty, value.XmlTextProperty); + } + + [Fact] + public static void Xml_XmlAnyAttributeTest() + { + var serializer = new XmlSerializer(typeof(TypeWithAnyAttribute)); + const string format = @"{3}"; + const int intProperty = 42; + const string attribute1 = "Technical"; + const string attribute2 = "Red"; + const string name = "MyGroup"; + using (var stream = new MemoryStream()) + { + var writer = new StreamWriter(stream); + writer.Write(format, attribute1, intProperty, attribute2, name); + writer.Flush(); + stream.Position = 0; + var obj = (TypeWithAnyAttribute)serializer.Deserialize(stream); + Assert.NotNull(obj); + Assert.StrictEqual(intProperty, obj.IntProperty); + Assert.StrictEqual(name, obj.Name); + Assert.StrictEqual(2, obj.Attributes.Length); + Assert.StrictEqual(attribute1, obj.Attributes[0].Value); + Assert.StrictEqual(attribute2, obj.Attributes[1].Value); + } + } + + [Fact] + public static void Xml_Struct() + { + var value = new WithStruct { Some = new SomeStruct { A = 1, B = 2 } }; + var result = SerializeAndDeserialize(value, +@" + + + 1 + 2 + +"); + + // Assert + Assert.StrictEqual(result.Some.A, value.Some.A); + Assert.StrictEqual(result.Some.B, value.Some.B); + } + + [Fact] + public static void Xml_Enums() + { + var item = new WithEnums() { Int = IntEnum.Option1, Short = ShortEnum.Option2 }; + var actual = SerializeAndDeserialize(item, +@" + + Option1 + Option2 +"); + Assert.StrictEqual(item.Short, actual.Short); + Assert.StrictEqual(item.Int, actual.Int); + } + + [Fact] + public static void Xml_Nullables() + { + var item = new WithNullables() { Optional = IntEnum.Option1, OptionalInt = 42, Struct1 = new SomeStruct { A = 1, B = 2 } }; + var actual = SerializeAndDeserialize(item, +@" + + Option1 + + 42 + + + 1 + 2 + + +"); + Assert.StrictEqual(item.OptionalInt, actual.OptionalInt); + Assert.StrictEqual(item.Optional, actual.Optional); + Assert.StrictEqual(item.Optionull, actual.Optionull); + Assert.StrictEqual(item.OptionullInt, actual.OptionullInt); + Assert.Null(actual.Struct2); + Assert.StrictEqual(item.Struct1.Value.A, actual.Struct1.Value.A); + Assert.StrictEqual(item.Struct1.Value.B, actual.Struct1.Value.B); + } + + [Fact] + public static void Xml_ClassImplementingIXmlSerialiable() + { + var value = new ClassImplementingIXmlSerialiable() { StringValue = "Hello world" }; + var actual = SerializeAndDeserialize(value, +@" +"); + Assert.StrictEqual(value.StringValue, actual.StringValue); + Assert.StrictEqual(value.GetPrivateMember(), actual.GetPrivateMember()); + Assert.True(ClassImplementingIXmlSerialiable.ReadXmlInvoked); + Assert.True(ClassImplementingIXmlSerialiable.WriteXmlInvoked); + } + + [Fact] + public static void Xml_TypeWithFieldNameEndBySpecified() + { + var value = new TypeWithPropertyNameSpecified() { MyField = "MyField", MyFieldIgnored = 99, MyFieldSpecified = true, MyFieldIgnoredSpecified = false }; + var actual = SerializeAndDeserialize(value, +@"MyField"); + Assert.StrictEqual(value.MyField, actual.MyField); + Assert.StrictEqual(actual.MyFieldIgnored, 0); + } + + [Fact] + public static void XML_TypeWithXmlSchemaFormAttribute() + { + var value = new TypeWithXmlSchemaFormAttribute() { NoneSchemaFormListProperty = new List { "abc" }, QualifiedSchemaFormListProperty = new List { true }, UnqualifiedSchemaFormListProperty = new List { 1 } }; + var acutal = SerializeAndDeserialize(value, +@"1abctrue"); + + Assert.StrictEqual(value.NoneSchemaFormListProperty.Count, acutal.NoneSchemaFormListProperty.Count); + Assert.StrictEqual(value.NoneSchemaFormListProperty[0], acutal.NoneSchemaFormListProperty[0]); + Assert.StrictEqual(value.UnqualifiedSchemaFormListProperty.Count, acutal.UnqualifiedSchemaFormListProperty.Count); + Assert.StrictEqual(value.UnqualifiedSchemaFormListProperty[0], acutal.UnqualifiedSchemaFormListProperty[0]); + Assert.StrictEqual(value.QualifiedSchemaFormListProperty.Count, acutal.QualifiedSchemaFormListProperty.Count); + Assert.StrictEqual(value.QualifiedSchemaFormListProperty[0], acutal.QualifiedSchemaFormListProperty[0]); + } + + [Fact] + public static void XML_TypeWithTypeNameInXmlTypeAttribute() + { + var value = new TypeWithTypeNameInXmlTypeAttribute(); + + SerializeAndDeserialize(value, +@""); + } + + [Fact] + public static void XML_TypeWithXmlTextAttributeOnArray() + { + var original = new TypeWithXmlTextAttributeOnArray() { Text = new string[] { "val1", "val2" } }; + + var actual = SerializeAndDeserialize(original, +@" +val1val2"); + Assert.NotNull(actual.Text); + Assert.StrictEqual(1, actual.Text.Length); + Assert.StrictEqual("val1val2", actual.Text[0]); + } + + [Fact] + public static void Xml_TypeWithSchemaFormInXmlAttribute() + { + var value = new TypeWithSchemaFormInXmlAttribute() { TestProperty = "hello" }; + var actual = SerializeAndDeserialize(value, +@""); + Assert.StrictEqual(value.TestProperty, actual.TestProperty); + } + + + [Fact] + public static void Xml_TypeWithXmlElementProperty() + { + XmlDocument xDoc = new XmlDocument(); + xDoc.LoadXml(@""); + XmlElement productElement = xDoc.CreateElement("Product"); + productElement.InnerText = "Product innertext"; + XmlElement categoryElement = xDoc.CreateElement("Category"); + categoryElement.InnerText = "Category innertext"; + var expected = new TypeWithXmlElementProperty() { Elements = new[] { productElement, categoryElement } }; + var actual = SerializeAndDeserialize(expected, +@"Product innertextCategory innertext"); + Assert.StrictEqual(expected.Elements.Length, actual.Elements.Length); + for (int i = 0; i < expected.Elements.Length; ++i) + { + Assert.StrictEqual(expected.Elements[i].InnerText, actual.Elements[i].InnerText); + } + } + + [Fact] + public static void Xml_TypeWithXmlDocumentProperty() + { + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.LoadXml(@"Head content

Heading1

Text in body
"); + var expected = new TypeWithXmlDocumentProperty() { Document = xmlDoc }; + var actual = SerializeAndDeserialize(expected, +@"Head content

Heading1

Text in body
"); + Assert.NotNull(actual); + Assert.NotNull(actual.Document); + Assert.StrictEqual(expected.Document.OuterXml, actual.Document.OuterXml); + } + + [Fact] + public static void Xml_TypeWithNonPublicDefaultConstructor() + { + System.Reflection.TypeInfo ti = System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(TypeWithNonPublicDefaultConstructor)); + TypeWithNonPublicDefaultConstructor value = null; + value = (TypeWithNonPublicDefaultConstructor)FindDefaultConstructor(ti).Invoke(null); + Assert.StrictEqual("Mr. FooName", value.Name); + var actual = SerializeAndDeserialize(value, +@" + + Mr. FooName +"); + Assert.StrictEqual(value.Name, actual.Name); + } + + private static System.Reflection.ConstructorInfo FindDefaultConstructor(System.Reflection.TypeInfo ti) + { + foreach (System.Reflection.ConstructorInfo ci in ti.DeclaredConstructors) + { + if (!ci.IsStatic && ci.GetParameters().Length == 0) + { + return ci; + } + } + return null; + } + + [Fact] + public static void Xml_TestIgnoreWhitespaceForDeserialization() + { + string xml = @" + + + + + +"; + + XmlSerializer serializer = new XmlSerializer(typeof(ServerSettings)); + StringReader reader = new StringReader(xml); + var value = (ServerSettings)serializer.Deserialize(reader); + Assert.StrictEqual(@" http://s3.amazonaws.com/windows-prod-twc/desktop8/beacons.xml ", value.MetricConfigUrl); + Assert.StrictEqual(@" http://wxdata.weather.com/wxdata/", value.DS2Root); + } + + + [Fact] + public static void Xml_TypeWithBinaryProperty() + { + var obj = new TypeWithBinaryProperty(); + var str = "The quick brown fox jumps over the lazy dog."; + obj.Base64Content = Encoding.Unicode.GetBytes(str); + obj.BinaryHexContent = Encoding.Unicode.GetBytes(str); + var actual = SerializeAndDeserialize(obj, +@"540068006500200071007500690063006B002000620072006F0077006E00200066006F00780020006A0075006D007000730020006F00760065007200200074006800650020006C0061007A007900200064006F0067002E00VABoAGUAIABxAHUAaQBjAGsAIABiAHIAbwB3AG4AIABmAG8AeAAgAGoAdQBtAHAAcwAgAG8AdgBlAHIAIAB0AGgAZQAgAGwAYQB6AHkAIABkAG8AZwAuAA=="); + Assert.StrictEqual(true, Enumerable.SequenceEqual(obj.Base64Content, actual.Base64Content)); + Assert.StrictEqual(true, Enumerable.SequenceEqual(obj.BinaryHexContent, actual.BinaryHexContent)); + } + + [Fact] + public static void Xml_DifferentSerializeDeserializeOverloads() + { + var expected = new SimpleType() { P1 = "p1 value", P2 = 123 }; + var serializer = new XmlSerializer(typeof(SimpleType)); + var writerTypes = new Type[] { typeof(TextWriter), typeof(XmlWriter) }; + Assert.Throws(() => + { + XmlWriter writer = null; + serializer.Serialize(writer, expected); + }); + Assert.Throws(() => + { + XmlReader reader = null; + serializer.Deserialize(reader); + }); + foreach (var writerType in writerTypes) + { + var stream = new MemoryStream(); + + if (writerType == typeof(TextWriter)) + { + var writer = new StreamWriter(stream); + serializer.Serialize(writer, expected); + } + else + { + var writer = XmlWriter.Create(stream); + serializer.Serialize(writer, expected); + } + stream.Position = 0; + var actualOutput = new StreamReader(stream).ReadToEnd(); + const string baseline = + @"p1 value123"; + var result = Utils.Compare(baseline, actualOutput); + Assert.True(result.Equal, string.Format("{1}{0}Test failed for input: {2}{0}Expected: {3}{0}Actual: {4}", Environment.NewLine, result.ErrorMessage, expected, baseline, actualOutput)); + stream.Position = 0; + + // XmlSerializer.CanSerialize(XmlReader) + XmlReader reader = XmlReader.Create(stream); + Assert.True(serializer.CanDeserialize(reader)); + + // XmlSerializer.Deserialize(XmlReader) + var actual = (SimpleType)serializer.Deserialize(reader); + Assert.StrictEqual(expected.P1, actual.P1); + Assert.StrictEqual(expected.P2, actual.P2); + + stream.Dispose(); + } + } + + [ConditionalFact(nameof(IsTimeSpanSerializationAvailable))] + public static void Xml_TypeWithTimeSpanProperty() + { + var obj = new TypeWithTimeSpanProperty { TimeSpanProperty = TimeSpan.FromMilliseconds(1) }; + var deserializedObj = SerializeAndDeserialize(obj, +@" + +PT0.001S +"); + Assert.StrictEqual(obj.TimeSpanProperty, deserializedObj.TimeSpanProperty); + } + + [ConditionalFact(nameof(IsTimeSpanSerializationAvailable))] + public static void Xml_TypeWithDefaultTimeSpanProperty() + { + var obj = new TypeWithDefaultTimeSpanProperty { TimeSpanProperty2 = new TimeSpan(0, 1, 0) }; + var deserializedObj = SerializeAndDeserialize(obj, +@" +PT1M"); + Assert.NotNull(deserializedObj); + Assert.Equal(obj.TimeSpanProperty, deserializedObj.TimeSpanProperty); + Assert.Equal(obj.TimeSpanProperty2, deserializedObj.TimeSpanProperty2); + } + + [Fact] + public static void Xml_TypeWithByteProperty() + { + var obj = new TypeWithByteProperty() { ByteProperty = 123 }; + var deserializedObj = SerializeAndDeserialize(obj, +@" + + 123 +"); + Assert.StrictEqual(obj.ByteProperty, deserializedObj.ByteProperty); + } + + [Fact] + public static void Xml_DeserializeOutOfRangeByteProperty() + { + //Deserialize an instance with out-of-range value for the byte property, expecting exception from deserialization process + var serializer = new XmlSerializer(typeof(TypeWithByteProperty)); + using (var stream = new MemoryStream()) + { + var writer = new StreamWriter(stream); + writer.Write( +@" + + -1 +"); + writer.Flush(); + stream.Position = 0; + Assert.Throws(() => { + var deserializedObj = (TypeWithByteProperty)serializer.Deserialize(stream); + }); + } + } + + [Fact] + public static void Xml_XmlAttributes_RemoveXmlElementAttribute() + { + XmlAttributes attrs = new XmlAttributes(); + + XmlElementAttribute item = new XmlElementAttribute("elem1"); + attrs.XmlElements.Add(item); + Assert.True(attrs.XmlElements.Contains(item)); + + attrs.XmlElements.Remove(item); + Assert.False(attrs.XmlElements.Contains(item)); + } + + [Fact] + public static void Xml_ArrayOfXmlNodeProperty() + { + var obj = new TypeWithXmlNodeArrayProperty() + { + CDATA = new[] { new XmlDocument().CreateCDataSection("test&test") } + }; + var deserializedObj = SerializeAndDeserialize(obj, @""); + Assert.Equal(obj.CDATA.Length, deserializedObj.CDATA.Length); + Assert.Equal(obj.CDATA[0].InnerText, deserializedObj.CDATA[0].InnerText); + } + + [Fact] + public static void Xml_TypeWithTwoDimensionalArrayProperty2() + { + SimpleType[][] simpleType2D = GetObjectwith2DArrayOfSimpleType(); + + var obj = new TypeWith2DArrayProperty2() + { + TwoDArrayOfSimpleType = simpleType2D + }; + + string baseline = "\r\n\r\n \r\n \r\n \r\n 0 0 value\r\n 1\r\n \r\n \r\n 0 1 value\r\n 2\r\n \r\n \r\n \r\n \r\n 1 0 value\r\n 3\r\n \r\n \r\n 1 1 value\r\n 4\r\n \r\n \r\n \r\n"; + TypeWith2DArrayProperty2 actual = SerializeAndDeserialize(obj, baseline); + Assert.NotNull(actual); + Assert.True(SimpleType.AreEqual(simpleType2D[0][0], actual.TwoDArrayOfSimpleType[0][0])); + Assert.True(SimpleType.AreEqual(simpleType2D[0][1], actual.TwoDArrayOfSimpleType[0][1])); + Assert.True(SimpleType.AreEqual(simpleType2D[1][0], actual.TwoDArrayOfSimpleType[1][0])); + Assert.True(SimpleType.AreEqual(simpleType2D[1][1], actual.TwoDArrayOfSimpleType[1][1])); + } + + private static SimpleType[][] GetObjectwith2DArrayOfSimpleType() + { + SimpleType[][] simpleType2D = new SimpleType[2][]; + simpleType2D[0] = new SimpleType[2]; + simpleType2D[1] = new SimpleType[2]; + simpleType2D[0][0] = new SimpleType() { P1 = "0 0 value", P2 = 1 }; + simpleType2D[0][1] = new SimpleType() { P1 = "0 1 value", P2 = 2 }; + simpleType2D[1][0] = new SimpleType() { P1 = "1 0 value", P2 = 3 }; + simpleType2D[1][1] = new SimpleType() { P1 = "1 1 value", P2 = 4 }; + return simpleType2D; + } + + public static void Xml_TypeWithByteArrayAsXmlText() + { + var value = new TypeWithByteArrayAsXmlText() { Value = new byte[] { 1, 2, 3 } }; + var actual = SerializeAndDeserialize(value, "\r\nAQID"); + + Assert.NotNull(actual); + Assert.NotNull(actual.Value); + Assert.Equal(value.Value.Length, actual.Value.Length); + Assert.True(Enumerable.SequenceEqual(value.Value, actual.Value)); + } + + [Fact] + public static void Xml_SimpleType() + { + var serializer = new XmlSerializer(typeof(SimpleType)); + var obj = new SimpleType { P1 = "foo", P2 = 1 }; + var deserializedObj = SerializeAndDeserialize(obj, +@" + + foo + 1 +"); + Assert.NotNull(deserializedObj); + Assert.StrictEqual(obj.P1, deserializedObj.P1); + Assert.StrictEqual(obj.P2, deserializedObj.P2); + } + + [Fact] + public static void Xml_BaseClassAndDerivedClass2WithSameProperty() + { + var value = new DerivedClassWithSameProperty2() { DateTimeProperty = new DateTime(100, DateTimeKind.Utc), IntProperty = 5, StringProperty = "TestString", ListProperty = new List() }; + value.ListProperty.AddRange(new string[] { "one", "two", "three" }); + + var actual = SerializeAndDeserialize(value, +@" + + TestString + 5 + 0001-01-01T00:00:00.00001Z + + one + two + three + +"); + + Assert.StrictEqual(value.DateTimeProperty, actual.DateTimeProperty); + Assert.StrictEqual(value.IntProperty, actual.IntProperty); + Assert.StrictEqual(value.StringProperty, actual.StringProperty); + Assert.Equal(value.ListProperty.ToArray(), actual.ListProperty.ToArray()); + } + + [Fact] + public static void Xml_TypeWithPropertiesHavingDefaultValue_DefaultValue() + { + var value = new TypeWithPropertiesHavingDefaultValue() + { + StringProperty = "DefaultString", + EmptyStringProperty = "", + IntProperty = 11, + CharProperty = 'm' + }; + + var actual = SerializeAndDeserialize(value, "\r\n\r\n 109\r\n"); + + Assert.NotNull(actual); + Assert.StrictEqual(value.StringProperty, actual.StringProperty); + Assert.StrictEqual(value.EmptyStringProperty, actual.EmptyStringProperty); + Assert.StrictEqual(value.IntProperty, actual.IntProperty); + Assert.StrictEqual(value.CharProperty, actual.CharProperty); + } + + [Fact] + public static void Xml_TypeWithStringPropertyWithDefaultValue_NonDefaultValue() + { + var value = new TypeWithPropertiesHavingDefaultValue() + { + StringProperty = "NonDefaultValue", + EmptyStringProperty = "NonEmpty", + IntProperty = 12, + CharProperty = 'n' + }; + + var actual = SerializeAndDeserialize(value, "\r\n\r\n NonEmpty\r\n NonDefaultValue\r\n 12\r\n 110\r\n"); + + Assert.NotNull(actual); + Assert.StrictEqual(value.StringProperty, actual.StringProperty); + } + + [Fact] + public static void Xml_TypeWithEnumPropertyHavingDefaultValue() + { + var value = new TypeWithEnumPropertyHavingDefaultValue() { EnumProperty = IntEnum.Option0 }; + var actual = SerializeAndDeserialize(value, + "\r\n\r\n Option0\r\n", + skipStringCompare: false); + + Assert.NotNull(actual); + Assert.StrictEqual(value.EnumProperty, actual.EnumProperty); + + + value = new TypeWithEnumPropertyHavingDefaultValue() { EnumProperty = IntEnum.Option1 }; + actual = SerializeAndDeserialize(value, + "\r\n", + skipStringCompare: false); + + Assert.NotNull(actual); + Assert.StrictEqual(value.EnumProperty, actual.EnumProperty); + } + + [Fact] + public static void Xml_TypeWithEnumFlagPropertyHavingDefaultValue() + { + var value = new TypeWithEnumFlagPropertyHavingDefaultValue() { EnumProperty = EnumFlags.Two | EnumFlags.Three }; + var actual = SerializeAndDeserialize(value, + "\r\n\r\n Two Three\r\n"); + + Assert.NotNull(actual); + Assert.StrictEqual(value.EnumProperty, actual.EnumProperty); + + + value = new TypeWithEnumFlagPropertyHavingDefaultValue(); + actual = SerializeAndDeserialize(value, + "\r\n"); + + Assert.NotNull(actual); + Assert.StrictEqual(value.EnumProperty, actual.EnumProperty); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #18964")] + public static void Xml_Soap_TypeWithEnumFlagPropertyHavingDefaultValue() + { + var mapping = new SoapReflectionImporter().ImportTypeMapping(typeof(TypeWithEnumFlagPropertyHavingDefaultValue)); + var serializer = new XmlSerializer(mapping); + + var value = new TypeWithEnumFlagPropertyHavingDefaultValue() { EnumProperty = EnumFlags.Two | EnumFlags.Three }; + var actual = SerializeAndDeserialize( + value, + "\r\n\r\n Two Three\r\n", + () => serializer); + + Assert.NotNull(actual); + Assert.StrictEqual(value.EnumProperty, actual.EnumProperty); + + + value = new TypeWithEnumFlagPropertyHavingDefaultValue(); + actual = SerializeAndDeserialize( + value, + "\r\n\r\n One Four\r\n", + () => serializer); + + Assert.NotNull(actual); + Assert.StrictEqual(value.EnumProperty, actual.EnumProperty); + } + + [Fact] + public static void Xml_TypeWithXmlQualifiedName() + { + var value = new TypeWithXmlQualifiedName() + { + Value = new XmlQualifiedName("FooName") + }; + + var actual = SerializeAndDeserialize(value, "\r\n\r\n FooName\r\n", skipStringCompare: false); + + Assert.NotNull(actual); + Assert.StrictEqual(value.Value, actual.Value); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #18964")] + public static void Xml_Soap_TypeWithXmlQualifiedName() + { + var mapping = new SoapReflectionImporter().ImportTypeMapping(typeof(TypeWithXmlQualifiedName)); + var serializer = new XmlSerializer(mapping); + + var value = new TypeWithXmlQualifiedName() + { + Value = new XmlQualifiedName("FooName") + }; + + var actual = SerializeAndDeserialize( + value, + "\r\n\r\n FooName\r\n", + () => serializer); + + Assert.NotNull(actual); + Assert.StrictEqual(value.Value, actual.Value); + } + + [Fact] + public static void Xml_TypeWithShouldSerializeMethod_WithDefaultValue() + { + var value = new TypeWithShouldSerializeMethod(); + + var actual = SerializeAndDeserialize(value, "\r\n"); + + Assert.NotNull(actual); + Assert.StrictEqual(value.Foo, actual.Foo); + } + + [Fact] + public static void Xml_TypeWithShouldSerializeMethod_WithNonDefaultValue() + { + var value = new TypeWithShouldSerializeMethod() { Foo = "SomeValue" }; + + var actual = SerializeAndDeserialize(value, "\r\nSomeValue"); + + Assert.NotNull(actual); + Assert.StrictEqual(value.Foo, actual.Foo); + } + + [Fact] + public static void Xml_KnownTypesThroughConstructorWithArrayProperties() + { + int[] intArray = new int[] { 1, 2, 3 }; + string[] stringArray = new string[] { "a", "b" }; + + var value = new KnownTypesThroughConstructorWithArrayProperties() { IntArrayValue = intArray, StringArrayValue = stringArray }; + var actual = SerializeAndDeserialize(value, + "\r\n\r\n \r\n a\r\n b\r\n \r\n \r\n 1\r\n 2\r\n 3\r\n \r\n", + () => { return new XmlSerializer(typeof(KnownTypesThroughConstructorWithArrayProperties), new Type[] { typeof(int[]), typeof(string[]) }); }, + skipStringCompare: false); + + Assert.NotNull(actual); + + var actualIntArray = (int[])actual.IntArrayValue; + Assert.NotNull(actualIntArray); + Assert.Equal(intArray.Length, actualIntArray.Length); + Assert.True(Enumerable.SequenceEqual(intArray, actualIntArray)); + + var actualStringArray = (string[])actual.StringArrayValue; + Assert.NotNull(actualStringArray); + Assert.True(Enumerable.SequenceEqual(stringArray, actualStringArray)); + Assert.Equal(stringArray.Length, actualStringArray.Length); + } + + [Fact] + public static void Xml_KnownTypesThroughConstructorWithEnumFlags() + { + var enumFlags = EnumFlags.One | EnumFlags.Four; + var value = new KnownTypesThroughConstructorWithValue() { Value = enumFlags }; + var actual = SerializeAndDeserialize(value, + "\r\n\r\n One Four\r\n", + () => { return new XmlSerializer(typeof(KnownTypesThroughConstructorWithValue), new Type[] { typeof(EnumFlags) }); }, + skipStringCompare: false); + + Assert.NotNull(actual); + Assert.Equal((EnumFlags)value.Value, (EnumFlags)actual.Value); + } + + [Fact] + public static void Xml_KnownTypesThroughConstructorWithEnumFlagsXmlQualifiedName() + { + var value = new KnownTypesThroughConstructorWithValue() { Value = new XmlQualifiedName("foo") }; + var actual = SerializeAndDeserialize(value, + "\r\n\r\n foo\r\n", + () => { return new XmlSerializer(typeof(KnownTypesThroughConstructorWithValue), new Type[] { typeof(XmlQualifiedName) }); }, + skipStringCompare: false); + + Assert.NotNull(actual); + Assert.Equal((XmlQualifiedName)value.Value, (XmlQualifiedName)actual.Value); + } + + [Fact] + static void Xml_TypeWithTypesHavingCustomFormatter() + { + var str = "The quick brown fox jumps over the lazy dog."; + var value = new TypeWithTypesHavingCustomFormatter() + { + DateTimeContent = new DateTime(2016, 7, 18, 0, 0, 0, DateTimeKind.Utc), + QNameContent = new XmlQualifiedName("QNameContent"), + DateContent = new DateTime(2016, 7, 18, 0, 0, 0, DateTimeKind.Utc), + NameContent = "NameContent", + NCNameContent = "NCNameContent", + NMTOKENContent = "NMTOKENContent", + NMTOKENSContent = "NMTOKENSContent", + Base64BinaryContent = Encoding.Unicode.GetBytes(str), + HexBinaryContent = Encoding.Unicode.GetBytes(str), + }; + + var actual = SerializeAndDeserialize(value, + "\r\n\r\n 2016-07-18T00:00:00Z\r\n QNameContent\r\n 2016-07-18\r\n NameContent\r\n NCNameContent\r\n NMTOKENContent\r\n NMTOKENSContent\r\n VABoAGUAIABxAHUAaQBjAGsAIABiAHIAbwB3AG4AIABmAG8AeAAgAGoAdQBtAHAAcwAgAG8AdgBlAHIAIAB0AGgAZQAgAGwAYQB6AHkAIABkAG8AZwAuAA==\r\n 540068006500200071007500690063006B002000620072006F0077006E00200066006F00780020006A0075006D007000730020006F00760065007200200074006800650020006C0061007A007900200064006F0067002E00\r\n"); + + Assert.NotNull(actual); + Assert.True(value.DateTimeContent == actual.DateTimeContent, $"Actual DateTimeContent was not as expected. \r\n Expected: {value.DateTimeContent} \r\n Actual: {actual.DateTimeContent}"); + Assert.True(value.QNameContent == actual.QNameContent, $"Actual QNameContent was not as expected. \r\n Expected: {value.QNameContent} \r\n Actual: {actual.QNameContent}"); + Assert.True(value.DateContent == actual.DateContent, $"Actual DateContent was not as expected. \r\n Expected: {value.DateContent} \r\n Actual: {actual.DateContent}"); + Assert.True(value.NameContent == actual.NameContent, $"Actual NameContent was not as expected. \r\n Expected: {value.NameContent} \r\n Actual: {actual.NameContent}"); + Assert.True(value.NCNameContent == actual.NCNameContent, $"Actual NCNameContent was not as expected. \r\n Expected: {value.NCNameContent} \r\n Actual: {actual.NCNameContent}"); + Assert.True(value.NMTOKENContent == actual.NMTOKENContent, $"Actual NMTOKENContent was not as expected. \r\n Expected: {value.NMTOKENContent} \r\n Actual: {actual.NMTOKENContent}"); + Assert.True(value.NMTOKENSContent == actual.NMTOKENSContent, $"Actual NMTOKENSContent was not as expected. \r\n Expected: {value.NMTOKENSContent} \r\n Actual: {actual.NMTOKENSContent}"); + + Assert.NotNull(actual.Base64BinaryContent); + Assert.True(Enumerable.SequenceEqual(value.Base64BinaryContent, actual.Base64BinaryContent), "Actual Base64BinaryContent was not as expected."); + + Assert.NotNull(actual.HexBinaryContent); + Assert.True(Enumerable.SequenceEqual(value.HexBinaryContent, actual.HexBinaryContent), "Actual HexBinaryContent was not as expected."); + } + + [Fact] + public static void Xml_TypeWithArrayPropertyHavingChoice() + { + object[] choices = new object[] { "Food", 5 }; + + // For each item in the choices array, add an + // enumeration value. + MoreChoices[] itemChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount }; + + var value = new TypeWithArrayPropertyHavingChoice() { ManyChoices = choices, ChoiceArray = itemChoices }; + + var actual = SerializeAndDeserialize(value, "\r\n\r\n Food\r\n 5\r\n"); + + Assert.NotNull(actual); + Assert.NotNull(actual.ManyChoices); + Assert.Equal(value.ManyChoices.Length, actual.ManyChoices.Length); + Assert.True(Enumerable.SequenceEqual(value.ManyChoices, actual.ManyChoices)); + } + + [Fact] + public static void XML_TypeWithTypeNameInXmlTypeAttribute_WithValue() + { + var value = new TypeWithTypeNameInXmlTypeAttribute() { XmlAttributeForm = "SomeValue" }; + + var actual = SerializeAndDeserialize(value, + "\r\n", + skipStringCompare: false); + + Assert.NotNull(actual); + Assert.Equal(value.XmlAttributeForm, actual.XmlAttributeForm); + } + + [Fact] + public static void XML_TypeWithFieldsOrdered() + { + var value = new TypeWithFieldsOrdered() + { + IntField1 = 1, + IntField2 = 2, + StringField1 = "foo1", + StringField2 = "foo2" + }; + + var actual = SerializeAndDeserialize(value, "\r\n\r\n 1\r\n 2\r\n foo2\r\n foo1\r\n"); + + Assert.NotNull(actual); + Assert.Equal(value.IntField1, actual.IntField1); + Assert.Equal(value.IntField2, actual.IntField2); + Assert.Equal(value.StringField1, actual.StringField1); + Assert.Equal(value.StringField2, actual.StringField2); + } + + [Fact] + public static void XmlSerializerFactoryTest() + { + string baseline = "\r\n\r\n 5\r\n Bear\r\n GermanShepherd\r\n"; + var xsf = new XmlSerializerFactory(); + Func serializerfunc = () => xsf.CreateSerializer(typeof(Dog)); + var dog1 = new Dog() { Name = "Bear", Age = 5, Breed = DogBreed.GermanShepherd }; + var dog2 = SerializeAndDeserialize(dog1, baseline, serializerfunc); + Assert.Equal(dog1.Name, dog2.Name); + Assert.Equal(dog1.Age, dog2.Age); + Assert.Equal(dog1.Breed, dog2.Breed); + } + + [Fact] + public static void XmlUnknownElementAndEventHandlerTest() + { + List grouplists = new List(); + int count = 0; + XmlSerializer serializer = new XmlSerializer(typeof(Group)); + serializer.UnknownElement += new XmlElementEventHandler((o, args) => + { + Group myGroup = (Group)args.ObjectBeingDeserialized; + Assert.NotNull(myGroup); + grouplists.Add(args.Element.Name); + ++count; + }); + string xmlFileContent = @" + + MyGroup + Large + 444 + West + "; + Group group = (Group)serializer.Deserialize(GetStreamFromString(xmlFileContent)); + Assert.NotNull(group); + Assert.NotNull(group.GroupName); + Assert.Null(group.GroupVehicle); + Assert.Equal(3, count); + Assert.Equal(3, grouplists.Count()); + bool b = grouplists.Contains("GroupSize") && grouplists.Contains("GroupNumber") && grouplists.Contains("GroupBase"); + Assert.True(b); + } + + [Fact] + public static void XmlUnknownNodeAndEventHandlerTest() + { + List grouplists = new List(); + int count = 0; + XmlSerializer serializer = new XmlSerializer(typeof(Group)); + serializer.UnknownNode += new XmlNodeEventHandler((o, args) => + { + Group myGroup = (Group)args.ObjectBeingDeserialized; + Assert.NotNull(myGroup); + grouplists.Add(args.LocalName); + ++count; + }); + string xmlFileContent = @" + + MyGroup + Large + 444 + West + + 1 + Thing1 + + element + + + "; + Group group = (Group)serializer.Deserialize(GetStreamFromString(xmlFileContent)); + Assert.NotNull(group); + Assert.Null(group.GroupName); + Assert.Equal(5, count); + Assert.Equal(5, grouplists.Count()); + bool b = grouplists.Contains("GroupName") && grouplists.Contains("GroupSize") && grouplists.Contains("GroupNumber") && grouplists.Contains("GroupBase") && grouplists.Contains("ThingInfo"); + Assert.True(b); + } + + [Fact] + public static void XmlUnknownAttributeAndEventHandlerTest() + { + List grouplists = new List(); + int count = 0; + XmlSerializer serializer = new XmlSerializer(typeof(Group)); + serializer.UnknownAttribute += new XmlAttributeEventHandler((o, args) => + { + Group myGroup = (Group)args.ObjectBeingDeserialized; + Assert.NotNull(myGroup); + grouplists.Add(args.Attr.LocalName); + ++count; + }); + string xmlFileContent = @" + + MyGroup + "; + Group group = (Group)serializer.Deserialize(GetStreamFromString(xmlFileContent)); + Assert.NotNull(group); + Assert.NotNull(group.GroupName); + Assert.Null(group.GroupVehicle); + Assert.Equal(3, count); + Assert.Equal(3, grouplists.Count()); + bool b = grouplists.Contains("GroupType") && grouplists.Contains("GroupNumber") && grouplists.Contains("GroupBase"); + Assert.True(b); + } + + [Fact] + public static void XmlDeserializationEventsTest() + { + List grouplists = new List(); + int count = 0; + // Create an instance of the XmlSerializer class. + XmlSerializer serializer = new XmlSerializer(typeof(Group)); + XmlDeserializationEvents events = new XmlDeserializationEvents(); + events.OnUnknownAttribute += new XmlAttributeEventHandler((o, args) => + { + Group myGroup = (Group)args.ObjectBeingDeserialized; + Assert.NotNull(myGroup); + grouplists.Add(args.Attr.LocalName); + ++count; + }); + string xmlFileContent = @" + + MyGroup + "; + Group group = (Group)serializer.Deserialize(XmlReader.Create(GetStreamFromString(xmlFileContent)), events); + Assert.NotNull(group); + Assert.NotNull(group.GroupName); + Assert.Null(group.GroupVehicle); + Assert.Equal(3, count); + Assert.Equal(3, grouplists.Count()); + bool b = grouplists.Contains("GroupType") && grouplists.Contains("GroupNumber") && grouplists.Contains("GroupBase"); + Assert.True(b); + } + private static Stream GetStreamFromString(string s) + { + MemoryStream stream = new MemoryStream(); + StreamWriter writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + + [Fact] + public static void XmlSerializerImplementationTest() + { + Employee emp = new Employee() { EmployeeName = "Allice" }; + SerializeIm sm = new SerializeIm(); + Func serializerfunc = () => sm.GetSerializer(typeof(Employee)); + string expected = "\r\n\r\n Allice\r\n"; + SerializeAndDeserialize(emp, expected, serializerfunc); + } + + [Fact] + public static void Xml_HiddenDerivedFieldTest() + { + var value = new DerivedClass { value = "on derived" }; + var actual = SerializeAndDeserialize(value, +@" + + on derived +"); + + Assert.NotNull(actual); + Assert.Null(actual.Value); + Assert.Null(actual.value); + Assert.Null(((DerivedClass)actual).Value); + Assert.Equal(value.value, ((DerivedClass)actual).value); + } + + [Fact] + public static void Xml_NullRefInXmlSerializerCtorTest() + { + string defaultNamespace = "http://www.contoso.com"; + var value = PurchaseOrder.CreateInstance(); + string baseline = +@" + + + 1 Main St. + AnyTown + WA + 00000 + + Monday, 10 April 2017 + + + Widget S + Small widget + 5.23 + 3 + 15.69 + + + 15.69 + 12.51 + 28.20 +"; + + var actual = SerializeAndDeserialize(value, + baseline, + () => new XmlSerializer(value.GetType(), null, null, null, defaultNamespace) + ); + Assert.NotNull(actual); + Assert.Equal(value.OrderDate, actual.OrderDate); + Assert.Equal(value.ShipCost, actual.ShipCost); + Assert.Equal(value.SubTotal, actual.SubTotal); + Assert.Equal(value.TotalCost, actual.TotalCost); + Assert.Equal(value.ShipTo.City, actual.ShipTo.City); + Assert.Equal(value.ShipTo.Line1, actual.ShipTo.Line1); + Assert.Equal(value.ShipTo.Name, actual.ShipTo.Name); + Assert.Equal(value.ShipTo.State, actual.ShipTo.State); + Assert.Equal(value.ShipTo.Zip, actual.ShipTo.Zip); + Assert.Equal(value.OrderedItems.Length, actual.OrderedItems.Length); + for (int i = 0; i < value.OrderedItems.Length; i++) + { + Assert.Equal(value.OrderedItems.ElementAt(i).Description, actual.OrderedItems.ElementAt(i).Description); + Assert.Equal(value.OrderedItems.ElementAt(i).ItemName, actual.OrderedItems.ElementAt(i).ItemName); + Assert.Equal(value.OrderedItems.ElementAt(i).LineTotal, actual.OrderedItems.ElementAt(i).LineTotal); + Assert.Equal(value.OrderedItems.ElementAt(i).Quantity, actual.OrderedItems.ElementAt(i).Quantity); + Assert.Equal(value.OrderedItems.ElementAt(i).UnitPrice, actual.OrderedItems.ElementAt(i).UnitPrice); + } + + actual = SerializeAndDeserialize(value, + baseline, + () => new XmlSerializer(value.GetType(), null, null, null, defaultNamespace, null) + ); + Assert.NotNull(actual); + Assert.Equal(value.OrderDate, actual.OrderDate); + Assert.Equal(value.ShipCost, actual.ShipCost); + Assert.Equal(value.SubTotal, actual.SubTotal); + Assert.Equal(value.TotalCost, actual.TotalCost); + Assert.Equal(value.ShipTo.City, actual.ShipTo.City); + Assert.Equal(value.ShipTo.Line1, actual.ShipTo.Line1); + Assert.Equal(value.ShipTo.Name, actual.ShipTo.Name); + Assert.Equal(value.ShipTo.State, actual.ShipTo.State); + Assert.Equal(value.ShipTo.Zip, actual.ShipTo.Zip); + Assert.Equal(value.OrderedItems.Length, actual.OrderedItems.Length); + for (int i = 0; i < value.OrderedItems.Length; i++) + { + Assert.Equal(value.OrderedItems.ElementAt(i).Description, actual.OrderedItems.ElementAt(i).Description); + Assert.Equal(value.OrderedItems.ElementAt(i).ItemName, actual.OrderedItems.ElementAt(i).ItemName); + Assert.Equal(value.OrderedItems.ElementAt(i).LineTotal, actual.OrderedItems.ElementAt(i).LineTotal); + Assert.Equal(value.OrderedItems.ElementAt(i).Quantity, actual.OrderedItems.ElementAt(i).Quantity); + Assert.Equal(value.OrderedItems.ElementAt(i).UnitPrice, actual.OrderedItems.ElementAt(i).UnitPrice); + } + } + + [Fact] + public static void Xml_AliasedPropertyTest() + { + var inputList = new List { "item0", "item1", "item2", "item3", "item4" }; + var value = new AliasedTestType { Aliased = inputList }; + var actual = SerializeAndDeserialize(value, +@" + + + item0 + item1 + item2 + item3 + item4 + +"); + + Assert.NotNull(actual); + Assert.NotNull(actual.Aliased); + Assert.Equal(inputList.GetType(), actual.Aliased.GetType()); + Assert.Equal(inputList.Count, ((List)actual.Aliased).Count); + for (int i = 0; i < inputList.Count; i++) + { + Assert.Equal(inputList[i], ((List)actual.Aliased).ElementAt(i)); + } + } + + [Fact] + public static void Xml_DeserializeHiddenMembersTest() + { + var xmlSerializer = new XmlSerializer(typeof(DerivedClass1)); + string inputXml = "2012-07-07T00:18:29.7538612Z"; + var dateTime = new DateTime(634772171097538612); + + using (var reader = new StringReader(inputXml)) + { + var derivedClassInstance = (DerivedClass1)xmlSerializer.Deserialize(reader); + Assert.NotNull(derivedClassInstance.Prop); + Assert.Equal(1, derivedClassInstance.Prop.Count()); + Assert.Equal(dateTime, derivedClassInstance.Prop.ElementAt(0)); + } + } + + [Fact] + public static void Xml_SerializeClassNestedInStaticClassTest() + { + var value = new Outer.Person() + { + FirstName = "Harry", + MiddleName = "James", + LastName = "Potter" + }; + + var actual = SerializeAndDeserialize(value, +@" + + Harry + James + Potter +"); + + Assert.NotNull(actual); + Assert.Equal(value.FirstName, actual.FirstName); + Assert.Equal(value.MiddleName, actual.MiddleName); + Assert.Equal(value.LastName, actual.LastName); + } + + [Fact] + public static void Xml_XSCoverTest() + { + var band = new Orchestra(); + var brass = new Brass() + { + Name = "Trumpet", + IsValved = true + }; + Instrument[] myInstruments = { brass }; + band.Instruments = myInstruments; + + var attrs = new XmlAttributes(); + var attr = new XmlElementAttribute() + { + ElementName = "Brass", + Type = typeof(Brass) + }; + + attrs.XmlElements.Add(attr); + var attrOverrides = new XmlAttributeOverrides(); + attrOverrides.Add(typeof(Orchestra), "Instruments", attrs); + + var actual = SerializeAndDeserialize(band, +@" + + Trumpet + true + +", () => { return new XmlSerializer(typeof(Orchestra), attrOverrides); }); + + Assert.Equal(band.Instruments.Length, actual.Instruments.Length); + for (int i = 0; i < band.Instruments.Length; i++) + { + Assert.Equal(((Brass)band.Instruments.ElementAt(i)).Name, ((Brass)actual.Instruments[i]).Name); + Assert.Equal(((Brass)band.Instruments.ElementAt(i)).IsValved, ((Brass)actual.Instruments[i]).IsValved); + } + + band = new Orchestra(); + band.Instruments = new Instrument[1] { new Instrument { Name = "Instrument1" } }; + attrs = new XmlAttributes(); + var xArray = new XmlArrayAttribute("CommonInstruments"); + xArray.Namespace = "http://www.contoso.com"; + attrs.XmlArray = xArray; + attrOverrides = new XmlAttributeOverrides(); + attrOverrides.Add(typeof(Orchestra), "Instruments", attrs); + actual = SerializeAndDeserialize(band, +@" + + + + Instrument1 + + +", () => { return new XmlSerializer(typeof(Orchestra), attrOverrides); }); + Assert.Equal(band.Instruments.Length, actual.Instruments.Length); + for (int i = 0; i < band.Instruments.Length; i++) + { + Assert.Equal((band.Instruments.ElementAt(i)).Name, (actual.Instruments[i]).Name); + } + + band = new Orchestra(); + var trumpet = new Trumpet() { Name = "TrumpetKeyC", IsValved = false, Modulation = 'C' }; + band.Instruments = new Instrument[2] { brass, trumpet }; + + attrs = new XmlAttributes(); + var xArrayItem = new XmlArrayItemAttribute(typeof(Brass)); + xArrayItem.Namespace = "http://www.contoso.com"; + attrs.XmlArrayItems.Add(xArrayItem); + var xArrayItem2 = new XmlArrayItemAttribute(typeof(Trumpet)); + xArrayItem2.Namespace = "http://www.contoso.com"; + attrs.XmlArrayItems.Add(xArrayItem2); + attrOverrides = new XmlAttributeOverrides(); + attrOverrides.Add(typeof(Orchestra), "Instruments", attrs); + actual = SerializeAndDeserialize(band, +@" + + + + Trumpet + true + + + TrumpetKeyC + false + 67 + + +", () => { return new XmlSerializer(typeof(Orchestra), attrOverrides); }); + Assert.Equal(band.Instruments.Length, actual.Instruments.Length); + for (int i = 0; i < band.Instruments.Length; i++) + { + Assert.Equal((band.Instruments.ElementAt(i)).Name, (actual.Instruments[i]).Name); + } + + attrOverrides = new XmlAttributeOverrides(); + attrs = new XmlAttributes(); + Object defaultAnimal = "Cat"; + attrs.XmlDefaultValue = defaultAnimal; + attrOverrides.Add(typeof(Pet), "Animal", attrs); + attrs = new XmlAttributes(); + attrs.XmlIgnore = false; + attrOverrides.Add(typeof(Pet), "Comment", attrs); + attrs = new XmlAttributes(); + var xType = new XmlTypeAttribute(); + xType.TypeName = "CuteFishes"; + xType.IncludeInSchema = true; + attrs.XmlType = xType; + attrOverrides.Add(typeof(Pet), attrs); + + var myPet = new Pet(); + myPet.Animal = "fish"; + myPet.Comment = "What a cute fish!"; + myPet.Comment2 = "I think it is cool!"; + + var actual2 = SerializeAndDeserialize(myPet, +@" + + fish + What a cute fish! + I think it is cool! + +", () => { return new XmlSerializer(typeof(Pet), attrOverrides); }); + Assert.Equal(myPet.Animal, actual2.Animal); + Assert.Equal(myPet.Comment, actual2.Comment); + Assert.Equal(myPet.Comment2, actual2.Comment2); + } + + [Fact] + public static void Xml_TypeWithMyCollectionField() + { + var value = new TypeWithMyCollectionField(); + value.Collection = new MyCollection() { "s1", "s2" }; + var actual = SerializeAndDeserializeWithWrapper(value, new XmlSerializer(typeof(TypeWithMyCollectionField)), "s1s2"); + Assert.NotNull(actual); + Assert.NotNull(actual.Collection); + Assert.True(value.Collection.SequenceEqual(actual.Collection)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #18964")] + public static void Xml_Soap_TypeWithMyCollectionField() + { + XmlTypeMapping myTypeMapping = new SoapReflectionImporter().ImportTypeMapping(typeof(TypeWithMyCollectionField)); + var serializer = new XmlSerializer(myTypeMapping); + var value = new TypeWithMyCollectionField(); + value.Collection = new MyCollection() { "s1", "s2" }; + var actual = SerializeAndDeserializeWithWrapper(value, serializer, "s1s2"); + Assert.NotNull(actual); + Assert.NotNull(actual.Collection); + Assert.True(value.Collection.SequenceEqual(actual.Collection)); + } + + [Fact] + public static void Xml_DefaultValueAttributeSetToNaNTest() + { + var value = new DefaultValuesSetToNaN(); + var actual = SerializeAndDeserialize(value, +@" + + 0 + 0 + 0 + 0 +"); + Assert.NotNull(actual); + Assert.Equal(value, actual); + } + + private static readonly string s_defaultNs = "http://tempuri.org/"; + private static T RoundTripWithXmlMembersMapping(object requestBodyValue, string memberName, string baseline, bool skipStringCompare = false, string wrapperName = null) + { + string ns = s_defaultNs; + object[] value = new object[] { requestBodyValue }; + XmlReflectionMember member = GetReflectionMember(memberName, ns); + var members = new XmlReflectionMember[] { member }; + object[] actual = RoundTripWithXmlMembersMapping(value, baseline, skipStringCompare, members: members, wrapperName: wrapperName); + Assert.Equal(value.Length, actual.Length); + return (T)actual[0]; + } + + private static object[] RoundTripWithXmlMembersMapping(object[] value, string baseline, bool skipStringCompare, XmlReflectionMember[] members, string ns = null, string wrapperName = null, bool rpc = false) + { + ns = ns ?? s_defaultNs; + var importer = new XmlReflectionImporter(null, ns); + var membersMapping = importer.ImportMembersMapping(wrapperName, ns, members, wrapperName != null, rpc: rpc); + var serializer = XmlSerializer.FromMappings(new XmlMapping[] { membersMapping })[0]; + using (var ms = new MemoryStream()) + { + + serializer.Serialize(ms, value); + ms.Flush(); + ms.Position = 0; + string actualOutput = new StreamReader(ms).ReadToEnd(); + if (!skipStringCompare) + { + Utils.CompareResult result = Utils.Compare(baseline, actualOutput); + Assert.True(result.Equal, string.Format("{1}{0}Test failed for input: {2}{0}Expected: {3}{0}Actual: {4}", + Environment.NewLine, result.ErrorMessage, value, baseline, actualOutput)); + } + + ms.Position = 0; + var actual = serializer.Deserialize(ms) as object[]; + Assert.NotNull(actual); + + return actual; + } + } + + private static T RoundTripWithXmlMembersMappingSoap(object item, string memberName, string baseline, bool skipStringCompare = false, string wrapperName = null, bool validate = false) + { + string ns = s_defaultNs; + object[] value = new object[] { item }; + XmlReflectionMember member = GetReflectionMember(memberName, ns); + var members = new XmlReflectionMember[] { member }; + object[] actual = RoundTripWithXmlMembersMappingSoap(value, baseline, skipStringCompare, members: members, wrapperName: wrapperName, validate: validate); + Assert.Equal(value.Length, actual.Length); + return (T)actual[0]; + } + + private static object[] RoundTripWithXmlMembersMappingSoap(object[] value, string baseline, bool skipStringCompare, XmlReflectionMember[] members, string ns = null, string wrapperName = null, bool writeAccessors = false, bool validate = false) + { + ns = ns ?? s_defaultNs; + var importer = new SoapReflectionImporter(null, ns); + var membersMapping = importer.ImportMembersMapping(wrapperName, ns, members, hasWrapperElement: wrapperName != null, writeAccessors: writeAccessors, validate: validate); + var serializer = XmlSerializer.FromMappings(new XmlMapping[] { membersMapping })[0]; + using (var ms = new MemoryStream()) + { + + serializer.Serialize(ms, value); + ms.Flush(); + ms.Position = 0; + string actualOutput = new StreamReader(ms).ReadToEnd(); + if (!skipStringCompare) + { + Utils.CompareResult result = Utils.Compare(baseline, actualOutput); + Assert.True(result.Equal, string.Format("{1}{0}Test failed for input: {2}{0}Expected: {3}{0}Actual: {4}", + Environment.NewLine, result.ErrorMessage, value, baseline, actualOutput)); + } + + ms.Position = 0; + var actual = serializer.Deserialize(ms) as object[]; + Assert.NotNull(actual); + + return actual; + } + } + + private static XmlReflectionMember GetReflectionMember(string memberName) + { + return GetReflectionMember(memberName, s_defaultNs); + } + + private static XmlReflectionMember GetReflectionMember(string memberName, string ns) + { + var member = new XmlReflectionMember(); + member.MemberName = memberName; + member.MemberType = typeof(T); + member.XmlAttributes = new XmlAttributes(); + var elementAttribute = new XmlElementAttribute(); + elementAttribute.ElementName = memberName; + elementAttribute.Namespace = ns; + member.XmlAttributes.XmlElements.Add(elementAttribute); + return member; + } + + private static XmlReflectionMember GetReflectionMemberNoXmlElement(string memberName, string ns = null) + { + ns = ns ?? s_defaultNs; + var member = new XmlReflectionMember(); + member.MemberName = memberName; + member.MemberType = typeof(T); + member.XmlAttributes = new XmlAttributes(); + return member; + } + + private static Stream GenerateStreamFromString(string s) + { + var stream = new MemoryStream(); + var writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + + private static T SerializeAndDeserialize(T value, string baseline, Func serializerFactory = null, + bool skipStringCompare = false, XmlSerializerNamespaces xns = null) + { + XmlSerializer serializer = new XmlSerializer(typeof(T)); + if (serializerFactory != null) + { + serializer = serializerFactory(); + } + + using (MemoryStream ms = new MemoryStream()) + { + if (xns == null) + { + serializer.Serialize(ms, value); + } + else + { + serializer.Serialize(ms, value, xns); + } + + ms.Position = 0; + + string actualOutput = new StreamReader(ms).ReadToEnd(); + + if (!skipStringCompare) + { + Utils.CompareResult result = Utils.Compare(baseline, actualOutput); + Assert.True(result.Equal, string.Format("{1}{0}Test failed for input: {2}{0}Expected: {3}{0}Actual: {4}", + Environment.NewLine, result.ErrorMessage, value, baseline, actualOutput)); + } + + ms.Position = 0; + T deserialized = (T)serializer.Deserialize(ms); + + return deserialized; + } + } + + private static T SerializeAndDeserializeWithWrapper(T value, XmlSerializer serializer, string baseline) + { + T actual; + using (var ms = new MemoryStream()) + { + var writer = new XmlTextWriter(ms, Encoding.UTF8); + writer.WriteStartElement("root"); + serializer.Serialize(writer, value); + writer.WriteEndElement(); + writer.Flush(); + + ms.Position = 0; + string actualOutput = new StreamReader(ms).ReadToEnd(); + Utils.CompareResult result = Utils.Compare(baseline, actualOutput); + Assert.True(result.Equal, string.Format("{1}{0}Test failed for input: {2}{0}Expected: {3}{0}Actual: {4}", + Environment.NewLine, result.ErrorMessage, value, baseline, actualOutput)); + + ms.Position = 0; + using (var reader = new XmlTextReader(ms)) + { + reader.ReadStartElement("root"); + actual = (T)serializer.Deserialize(reader); + } + } + + return actual; + } + + private static void AssertSerializationFailure() where T : new() where ExceptionType : Exception + { + try + { + SerializeAndDeserialize(new T(), string.Empty, skipStringCompare: true); + Assert.True(false, $"Assert.True failed for {typeof(T)}. The above operation should have thrown, but it didn't."); + } + catch (Exception e) + { + Assert.True(e is ExceptionType, $"Assert.True failed for {typeof(T)}. Expected: {typeof(ExceptionType)}; Actual: {e.GetType()}"); + } + } +} diff --git a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs.REMOVED.git-id deleted file mode 100644 index d32027f0f0..0000000000 --- a/external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -0dd5ef1c0bc4daa76bba0b549af8ac44868a7f55 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/System.Xml.Xsl.XslCompiledTransformApi.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/System.Xml.Xsl.XslCompiledTransformApi.Tests.csproj index 673ac18de7..4b9d9fda5b 100644 --- a/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/System.Xml.Xsl.XslCompiledTransformApi.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/System.Xml.Xsl.XslCompiledTransformApi.Tests.csproj @@ -16,6 +16,7 @@ + diff --git a/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompiledTransform.cs.REMOVED.git-id b/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompiledTransform.cs.REMOVED.git-id index ff234f99c6..533b02cb60 100644 --- a/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompiledTransform.cs.REMOVED.git-id +++ b/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompiledTransform.cs.REMOVED.git-id @@ -1 +1 @@ -aeeee05282ed7ded36b58ab1b493967d329d7be6 \ No newline at end of file +f9f00e7d3f5250edd6c46b5b57557b7d6f67dbf3 \ No newline at end of file diff --git a/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompilerTests.cs b/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompilerTests.cs new file mode 100644 index 0000000000..ca26f84c93 --- /dev/null +++ b/external/corefx/src/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslCompilerTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using System.Xml.Xsl; +using Xunit; + +namespace System.Xml.Tests +{ + public class XslCompilerTests + { + [Fact] + public void ValueOfInDebugMode() + { + string xml = @" + + This is my class info +"; + + string xsl = @" + + + + + + +"; + + using (var outWriter = new StringWriter()) + { + using (var xslStringReader = new StringReader(xsl)) + using (var xmlStringReader = new StringReader(xml)) + using (var xslReader = XmlReader.Create(xslStringReader)) + using (var xmlReader = XmlReader.Create(xmlStringReader)) + { + var transform = new XslCompiledTransform(true); + var argsList = new XsltArgumentList(); + + transform.Load(xslReader); + transform.Transform(xmlReader, argsList, outWriter); + } + + Assert.Equal("This is my class info", outWriter.ToString()); + } + } + } +} diff --git a/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/System.Xml.Xsl.XslTransformApi.Tests.csproj b/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/System.Xml.Xsl.XslTransformApi.Tests.csproj index c5a552743f..cf5dd08680 100644 --- a/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/System.Xml.Xsl.XslTransformApi.Tests.csproj +++ b/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/System.Xml.Xsl.XslTransformApi.Tests.csproj @@ -25,9 +25,6 @@ TestFiles\%(RecursiveDir)%(Filename)%(Extension) TestFiles\%(RecursiveDir)
- - CommonTest\System\PlatformDetection.cs -
diff --git a/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs b/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs index 7cfa11895d..a75f8ea73c 100644 --- a/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs +++ b/external/corefx/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs @@ -49,7 +49,7 @@ namespace System.Xml.Tests public class XsltApiTestCaseBase : FileCleanupTestBase { private const string XmlResolverDocumentName = "xmlResolver_document_function.xml"; - private static readonly string s_temporaryResolverDocumentFullName = Path.Combine(Path.GetTempPath(), XmlResolverDocumentName); + private static readonly string s_temporaryResolverDocumentFullName = Path.Combine(Path.GetTempPath(), "XslTransformApi", XmlResolverDocumentName); private static readonly object s_temporaryResolverDocumentLock = new object(); // Generic data for all derived test cases @@ -87,6 +87,8 @@ namespace System.Xml.Tests // On uap access is denied to full path and the code below and related tests cannot run if (!PlatformDetection.IsUap) { + Directory.CreateDirectory(Path.GetDirectoryName(s_temporaryResolverDocumentFullName)); + // Replace absolute URI in xmlResolver_document_function.xml based on the environment string xslFile = Path.Combine("TestFiles", FilePathUtil.GetTestDataPath(), "XsltApi", "xmlResolver_document_function_absolute_uri.xsl"); XmlDocument doc = new XmlDocument(); diff --git a/external/corefx/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs b/external/corefx/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs index d182810177..fd10058cb8 100644 --- a/external/corefx/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs +++ b/external/corefx/src/System.Private.Xml/tests/Xslt/XsltCompiler/XsltCommon.cs @@ -131,7 +131,7 @@ namespace XmlCoreTest.Common /// /// The line to start comparison in the baseline file /// - /// The line to start comparion in the output file + /// The line to start comparison in the output file /// /// /// diff --git a/external/corefx/src/System.Reflection.DispatchProxy/pkg/System.Reflection.DispatchProxy.pkgproj b/external/corefx/src/System.Reflection.DispatchProxy/pkg/System.Reflection.DispatchProxy.pkgproj index c7b214e621..426087ed03 100644 --- a/external/corefx/src/System.Reflection.DispatchProxy/pkg/System.Reflection.DispatchProxy.pkgproj +++ b/external/corefx/src/System.Reflection.DispatchProxy/pkg/System.Reflection.DispatchProxy.pkgproj @@ -13,17 +13,21 @@ - - - - runtimes/aot/lib/$(UAPvNextTFM) - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection.DispatchProxy/src/Configurations.props b/external/corefx/src/System.Reflection.DispatchProxy/src/Configurations.props index 3fbe32b9a2..3fbbd69075 100644 --- a/external/corefx/src/System.Reflection.DispatchProxy/src/Configurations.props +++ b/external/corefx/src/System.Reflection.DispatchProxy/src/Configurations.props @@ -4,12 +4,13 @@ netfx; netstandard; + netcoreapp2.0; + uapaot-Windows_NT; + uap-Windows_NT; $(PackageConfigurations); - uapaot-Windows_NT; netcoreapp; - uap-Windows_NT; diff --git a/external/corefx/src/System.Reflection.Emit/ref/System.Reflection.Emit.cs b/external/corefx/src/System.Reflection.Emit/ref/System.Reflection.Emit.cs index 6019427205..e276ab8355 100644 --- a/external/corefx/src/System.Reflection.Emit/ref/System.Reflection.Emit.cs +++ b/external/corefx/src/System.Reflection.Emit/ref/System.Reflection.Emit.cs @@ -105,6 +105,7 @@ namespace System.Reflection.Emit protected override bool IsArrayImpl() { throw null; } //TYPEINFO public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; } protected override bool IsByRefImpl() { throw null; } + public override bool IsByRefLike { get { throw null; } } protected override bool IsCOMObjectImpl() { throw null; } public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; } protected override bool IsPointerImpl() { throw null; } @@ -204,6 +205,7 @@ namespace System.Reflection.Emit //TYPEINFO: public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; } public override bool IsAssignableFrom(System.Type c) { throw null; } protected override bool IsByRefImpl() { throw null; } + public override bool IsByRefLike { get { throw null; } } protected override bool IsCOMObjectImpl() { throw null; } public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; } protected override bool IsPointerImpl() { throw null; } @@ -335,6 +337,7 @@ namespace System.Reflection.Emit public override System.Reflection.GenericParameterAttributes GenericParameterAttributes { get { throw null; } } public override int GenericParameterPosition { get { throw null; } } public override System.Guid GUID { get { throw null; } } + public override bool IsByRefLike { get { throw null; } } public override bool IsConstructedGenericType { get { throw null; } } public override bool IsGenericParameter { get { throw null; } } public override bool IsGenericType { get { throw null; } } diff --git a/external/corefx/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj b/external/corefx/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj index 5ed63ea17d..1cd8ecb911 100644 --- a/external/corefx/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj +++ b/external/corefx/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj @@ -8,9 +8,6 @@ - - Common\tests\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Reflection.Metadata/pkg/System.Reflection.Metadata.pkgproj b/external/corefx/src/System.Reflection.Metadata/pkg/System.Reflection.Metadata.pkgproj index ebaecb569b..d80cfdefce 100644 --- a/external/corefx/src/System.Reflection.Metadata/pkg/System.Reflection.Metadata.pkgproj +++ b/external/corefx/src/System.Reflection.Metadata/pkg/System.Reflection.Metadata.pkgproj @@ -13,8 +13,15 @@ portable-net45+win8 1.1.37 - - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs.REMOVED.git-id b/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs.REMOVED.git-id index 381d3ba851..a4a919cda6 100644 --- a/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs.REMOVED.git-id +++ b/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs.REMOVED.git-id @@ -1 +1 @@ -d421ee938b951e8fc13b1f093c52ec399c682a2d \ No newline at end of file +507b479bf6a15cb7a5f6d50c79d47577cefd2e94 \ No newline at end of file diff --git a/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.csproj b/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.csproj index 911f70d177..c6ac3d6820 100644 --- a/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.csproj +++ b/external/corefx/src/System.Reflection.Metadata/ref/System.Reflection.Metadata.csproj @@ -5,6 +5,7 @@ {69B25962-B4C2-4295-8809-5653CD03FC75} true false + $(DefineConstants);NETSTANDARD11 @@ -31,4 +32,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj b/external/corefx/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj index af9f8167cf..e75d7ef1bc 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj +++ b/external/corefx/src/System.Reflection.Metadata/src/System.Reflection.Metadata.csproj @@ -73,6 +73,8 @@ + + @@ -181,6 +183,7 @@ + diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs index f60f26b316..dc6b68d1a9 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Internal/MemoryBlocks/AbstractMemoryBlock.cs @@ -31,7 +31,7 @@ namespace System.Reflection.Internal /// Does not check bounds. /// /// Only creates a copy of the data if they are not represented by a managed byte array, - /// or if the specified range doens't span the entire block. + /// or if the specified range doesn't span the entire block. /// public unsafe virtual ImmutableArray GetContentUnchecked(int start, int length) { diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs index 6e2b9f10d7..7527bf4b13 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobReader.cs @@ -116,7 +116,7 @@ namespace System.Reflection.Metadata public int RemainingBytes => (int)(_endPointer - _currentPointer); /// - /// Repositions the reader to the start of the underluing memory block. + /// Repositions the reader to the start of the underlying memory block. /// public void Reset() { diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/Encoding/InstructionEncoder.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/Encoding/InstructionEncoder.cs index 3e63ef1b92..7e6e69b0be 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/Encoding/InstructionEncoder.cs +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/Encoding/InstructionEncoder.cs @@ -20,7 +20,7 @@ namespace System.Reflection.Metadata.Ecma335 /// Builder tracking labels, branches and exception handlers. /// /// - /// If null the encoder doesn't support constuction of control flow. + /// If null the encoder doesn't support construction of control flow. /// public ControlFlowBuilder ControlFlowBuilder { get; } diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs.REMOVED.git-id b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs.REMOVED.git-id index 4f6fd2f831..80a867410d 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs.REMOVED.git-id +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataBuilder.Tables.cs.REMOVED.git-id @@ -1 +1 @@ -161cec5c59c4881faa640b4c15e500dd63cc0042 \ No newline at end of file +f56f0f835cfd63c3f562c4e0569942f4aa99dc63 \ No newline at end of file diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.netstandard.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.netstandard.cs new file mode 100644 index 0000000000..79b0a52d41 --- /dev/null +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/MetadataReader.netstandard.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Reflection.Metadata +{ + public sealed partial class MetadataReader + { + internal AssemblyName GetAssemblyName(StringHandle nameHandle, Version version, StringHandle cultureHandle, BlobHandle publicKeyOrTokenHandle, AssemblyHashAlgorithm assemblyHashAlgorithm, AssemblyFlags flags) + { + string name = GetString(nameHandle); + string cultureName = (!cultureHandle.IsNil) ? GetString(cultureHandle) : null; + var hashAlgorithm = (Configuration.Assemblies.AssemblyHashAlgorithm)assemblyHashAlgorithm; + byte[] publicKeyOrToken = !publicKeyOrTokenHandle.IsNil ? GetBlobBytes(publicKeyOrTokenHandle) : null; + + var assemblyName = new AssemblyName(name) + { + Version = version, + CultureName = cultureName, + HashAlgorithm = hashAlgorithm, + Flags = GetAssemblyNameFlags(flags), + ContentType = GetContentTypeFromAssemblyFlags(flags) + }; + + bool hasPublicKey = (flags & AssemblyFlags.PublicKey) != 0; + if (hasPublicKey) + { + assemblyName.SetPublicKey(publicKeyOrToken); + } + else + { + assemblyName.SetPublicKeyToken(publicKeyOrToken); + } + + return assemblyName; + } + + private AssemblyNameFlags GetAssemblyNameFlags(AssemblyFlags flags) + { + AssemblyNameFlags assemblyNameFlags = AssemblyNameFlags.None; + + if ((flags & AssemblyFlags.PublicKey) != 0) + assemblyNameFlags |= AssemblyNameFlags.PublicKey; + + if ((flags & AssemblyFlags.Retargetable) != 0) + assemblyNameFlags |= AssemblyNameFlags.Retargetable; + + if ((flags & AssemblyFlags.EnableJitCompileTracking) != 0) + assemblyNameFlags |= AssemblyNameFlags.EnableJITcompileTracking; + + if ((flags & AssemblyFlags.DisableJitCompileOptimizer) != 0) + assemblyNameFlags |= AssemblyNameFlags.EnableJITcompileOptimizer; + + return assemblyNameFlags; + } + + private AssemblyContentType GetContentTypeFromAssemblyFlags(AssemblyFlags flags) + { + return (AssemblyContentType)(((int)flags & (int)AssemblyFlags.ContentTypeMask) >> 9); + } + } +} diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.cs index 5935b4bac0..3558a0c62b 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.cs +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.cs @@ -6,7 +6,7 @@ using System.Diagnostics; namespace System.Reflection.Metadata { - public struct AssemblyDefinition + public partial struct AssemblyDefinition { private readonly MetadataReader _reader; diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.netstandard.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.netstandard.cs new file mode 100644 index 0000000000..9191f5f6d2 --- /dev/null +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyDefinition.netstandard.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Reflection.Metadata +{ + public partial struct AssemblyDefinition + { + public AssemblyName GetAssemblyName() + { + return _reader.GetAssemblyName(Name, Version, Culture, PublicKey, HashAlgorithm, Flags); + } + } +} diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.cs index ac128cdd16..9a435c5fd4 100644 --- a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.cs +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.cs @@ -7,7 +7,7 @@ using System.Reflection.Metadata.Ecma335; namespace System.Reflection.Metadata { - public struct AssemblyReference + public partial struct AssemblyReference { private readonly MetadataReader _reader; diff --git a/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.netstandard.cs b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.netstandard.cs new file mode 100644 index 0000000000..5b0d1a92d9 --- /dev/null +++ b/external/corefx/src/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/AssemblyReference.netstandard.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Reflection.Metadata +{ + public partial struct AssemblyReference + { + public AssemblyName GetAssemblyName() + { + return _reader.GetAssemblyName(Name, Version, Culture, PublicKeyOrToken, AssemblyHashAlgorithm.None, Flags); + } + } +} diff --git a/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs index cecd35b13f..92d5442563 100644 --- a/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs +++ b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs @@ -264,7 +264,7 @@ namespace System.Reflection.Metadata.Decoding.Tests // Compiler can generate temporaries or re-order so just check the ones we expect are there. // (They could get optimized away too. If that happens in practice, change this test to use hard-coded signatures.) - Assert.Contains("uint8& pinned", localTypes); + Assert.Contains("uint8[] pinned", localTypes); Assert.Contains("uint8[]", localTypes); } } diff --git a/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Ecma335/MetadataBuilderTests.cs b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Ecma335/MetadataBuilderTests.cs index ea3eb43d0f..053f071fbf 100644 --- a/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Ecma335/MetadataBuilderTests.cs +++ b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/Ecma335/MetadataBuilderTests.cs @@ -203,7 +203,7 @@ namespace System.Reflection.Metadata.Ecma335.Tests } /// - /// Add methods do miminal validation to avoid overhead. + /// Add methods do minimal validation to avoid overhead. /// [Fact] public void Add_ArgumentErrors() diff --git a/external/corefx/src/System.Reflection.Metadata/tests/Metadata/TypeSystem/AssemblyDefinitionTests.cs b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/TypeSystem/AssemblyDefinitionTests.cs new file mode 100644 index 0000000000..8bc7f068c1 --- /dev/null +++ b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/TypeSystem/AssemblyDefinitionTests.cs @@ -0,0 +1,126 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Reflection.Metadata.Tests +{ + public class AssemblyDefinitionTests + { + [Fact] + public void ValidateAssemblyNameWithCultureSet() + { + var assembly = new { Assembly = Misc.Satellite, Name = "SatelliteAssembly.resources", Version = new Version(1, 0, 0, 0), ContentType = AssemblyContentType.Default, Culture = "de-DE" }; + + var reader = MetadataReaderTests.GetMetadataReader(assembly.Assembly, options: MetadataReaderOptions.ApplyWindowsRuntimeProjections); + + foreach (var assemblyRefHandle in reader.AssemblyReferences) + { + var assemblyDef = reader.GetAssemblyDefinition(); + var assemblyRef = reader.GetAssemblyReference(assemblyRefHandle); + var assemblyName = assemblyDef.GetAssemblyName(); + + // Validate against input assembly + Assert.Equal(assembly.Version, assemblyName.Version); + Assert.Equal(assembly.Name, assemblyName.Name); + Assert.Equal(assembly.ContentType, assemblyName.ContentType); + Assert.Equal(assembly.Culture, assemblyName.CultureName); + Assert.Equal(Configuration.Assemblies.AssemblyHashAlgorithm.SHA1, assemblyName.HashAlgorithm); + Assert.Null(assemblyName.GetPublicKey()); + Assert.Null(assemblyName.GetPublicKeyToken()); + Assert.Equal(AssemblyNameFlags.None, assemblyName.Flags); + + // Validate against AssemblyDefinition + ValidateDefinitionAssemblyNameAgainst(assemblyName, reader, assemblyDef); + + // Validate against AssemblyReference + ValidateDefinitionAssemblyNameAgainst(assemblyName, reader, assemblyRef); + } + } + + [Fact] + public void ValidateAssemblyNameWithPublicKey() + { + var assembly = new { Assembly = Misc.Signed, Name = "Signed", Version = new Version(0, 0, 0, 0), ContentType = AssemblyContentType.Default, Flags = AssemblyNameFlags.PublicKey }; + + var reader = MetadataReaderTests.GetMetadataReader(assembly.Assembly, options: MetadataReaderOptions.ApplyWindowsRuntimeProjections); + + foreach (var assemblyRefHandle in reader.AssemblyReferences) + { + var assemblyDef = reader.GetAssemblyDefinition(); + var assemblyRef = reader.GetAssemblyReference(assemblyRefHandle); + var assemblyName = assemblyDef.GetAssemblyName(); + + // Validate against input assembly + Assert.Equal(assembly.Version, assemblyName.Version); + Assert.Equal(assembly.Name, assemblyName.Name); + Assert.Equal(assembly.ContentType, assemblyName.ContentType); + Assert.Null(assemblyName.CultureName); + Assert.Equal(Configuration.Assemblies.AssemblyHashAlgorithm.SHA1, assemblyName.HashAlgorithm); + Assert.Equal(assembly.Flags, assemblyName.Flags); + Assert.NotNull(assemblyName.GetPublicKeyToken()); + Assert.NotNull(assemblyName.GetPublicKey()); + + // Validate against AssemblyDefinition + ValidateDefinitionAssemblyNameAgainst(assemblyName, reader, assemblyDef); + + // Validate against AssemblyReference + ValidateDefinitionAssemblyNameAgainst(assemblyName, reader, assemblyRef); + } + } + + [Fact] + public void ValidateAssemblyNameForAssemblyDefinition() + { + var assemblyItems = new[] + { + new { Assembly = WinRT.Lib, Name = "Lib", Version = new Version(1, 0, 0, 0), ContentType = AssemblyContentType.WindowsRuntime }, + new { Assembly = NetModule.AppCS, Name = "AppCS", Version = new Version(1, 2, 3, 4), ContentType = AssemblyContentType.Default }, + new { Assembly = Namespace.NamespaceTests, Name = "NamespaceTests", Version = new Version(0, 0, 0, 0), ContentType = AssemblyContentType.Default }, + new { Assembly = PortablePdbs.DocumentsDll, Name = "Documents", Version = new Version(0, 0, 0, 0), ContentType = AssemblyContentType.Default } + }; + + foreach (var item in assemblyItems) + { + var reader = MetadataReaderTests.GetMetadataReader(item.Assembly, options: MetadataReaderOptions.ApplyWindowsRuntimeProjections); + + foreach (var assemblyRefHandle in reader.AssemblyReferences) + { + var assemblyDef = reader.GetAssemblyDefinition(); + var assemblyRef = reader.GetAssemblyReference(assemblyRefHandle); + var assemblyName = assemblyDef.GetAssemblyName(); + + // Validate against input assembly + Assert.Equal(item.Version, assemblyName.Version); + Assert.Equal(item.Name, assemblyName.Name); + Assert.Equal(item.ContentType, assemblyName.ContentType); + Assert.Null(assemblyName.CultureName); + Assert.Equal(Configuration.Assemblies.AssemblyHashAlgorithm.SHA1, assemblyName.HashAlgorithm); + Assert.Null(assemblyName.GetPublicKey()); + Assert.Null(assemblyName.GetPublicKeyToken()); + Assert.Equal(AssemblyNameFlags.None, assemblyName.Flags); + + // Validate against AssemblyDefinition + ValidateDefinitionAssemblyNameAgainst(assemblyName, reader, assemblyDef); + + // Validate against AssemblyReference + ValidateDefinitionAssemblyNameAgainst(assemblyName, reader, assemblyRef); + } + } + } + + private void ValidateDefinitionAssemblyNameAgainst(AssemblyName assemblyName, MetadataReader reader, AssemblyDefinition assemblyDef) + { + Assert.Equal(reader.GetString(assemblyDef.Name), assemblyName.Name); + Assert.Equal(assemblyDef.Version, assemblyName.Version); + Assert.Equal((Configuration.Assemblies.AssemblyHashAlgorithm)assemblyDef.HashAlgorithm, assemblyName.HashAlgorithm); + Assert.Equal((AssemblyContentType)(((int)assemblyDef.Flags & (int)AssemblyFlags.ContentTypeMask) >> 9), assemblyName.ContentType); + } + + private void ValidateDefinitionAssemblyNameAgainst(AssemblyName assemblyName, MetadataReader reader, AssemblyReference assemblyRef) + { + Assert.NotEqual(reader.GetString(assemblyRef.Name), assemblyName.Name); + } + } +} diff --git a/external/corefx/src/System.Reflection.Metadata/tests/Metadata/TypeSystem/AssemblyReferenceTests.cs b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/TypeSystem/AssemblyReferenceTests.cs new file mode 100644 index 0000000000..b0d10d3f92 --- /dev/null +++ b/external/corefx/src/System.Reflection.Metadata/tests/Metadata/TypeSystem/AssemblyReferenceTests.cs @@ -0,0 +1,103 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using Xunit; + +namespace System.Reflection.Metadata.Tests +{ + public class AssemblyReferenceTests + { + [Fact] + public void ValidateAssemblyNameForSingleAssemblyReference() + { + var reader = MetadataReaderTests.GetMetadataReader(WinRT.Lib, options: MetadataReaderOptions.ApplyWindowsRuntimeProjections); + var handle = reader.AssemblyReferences.Skip(3).First(); + var assemblyRef = reader.GetAssemblyReference(handle); + var assemblyDef = reader.GetAssemblyDefinition(); + var assemblyName = assemblyRef.GetAssemblyName(); + + // Validate against input assembly + Assert.Equal("System.Runtime", assemblyName.Name); + Assert.Equal(new Version(4, 0, 0, 0), assemblyName.Version); + Assert.Equal(new byte[] { 0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A }, assemblyName.GetPublicKeyToken()); + Assert.Null(assemblyName.CultureName); + Assert.Equal(Configuration.Assemblies.AssemblyHashAlgorithm.None, assemblyName.HashAlgorithm); + Assert.Null(assemblyName.GetPublicKey()); + Assert.Equal(AssemblyNameFlags.None, assemblyName.Flags); + Assert.Equal(AssemblyContentType.Default, assemblyName.ContentType); + + // Validate against AssemblyRefernce + ValidateReferenceAssemblyNameAgainst(assemblyName, reader, assemblyRef); + + // Validate against AssemblyDefinition + ValidateReferenceAssemblyNameAgainst(assemblyName, reader, assemblyDef); + } + + [Fact] + public void ValidateAssemblyNameForMultipleAssemblyReferences() + { + var expRefs = new string[] { "mscorlib", "System.Core", "System", "Microsoft.VisualBasic" }; + + byte[][] expKeys = new byte[][] + { + new byte[] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }, + new byte[] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }, + new byte[] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }, + + // VB: B0 3F 5F 7F 11 D5 0A 3A + new byte[] { 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a } + }; + + var expVers = new Version[] + { + new Version(4, 0, 0, 0), + new Version(4, 0, 0, 0), + new Version(4, 0, 0, 0), + new Version(/*VB*/10, 0, 0, 0), + }; + + var reader = MetadataReaderTests.GetMetadataReader(NetModule.AppCS); + + int i = 0; + foreach (var assemblyRefHandle in reader.AssemblyReferences) + { + var assemblyRef = reader.GetAssemblyReference(assemblyRefHandle); + var assemblyDef = reader.GetAssemblyDefinition(); + var assemblyName = assemblyRef.GetAssemblyName(); + + // Validate against input assembly + Assert.Equal(expRefs[i], assemblyName.Name); + Assert.Equal(expVers[i], assemblyName.Version); + Assert.Equal(expKeys[i], assemblyName.GetPublicKeyToken()); + Assert.Null(assemblyName.CultureName); + Assert.Equal(Configuration.Assemblies.AssemblyHashAlgorithm.None, assemblyName.HashAlgorithm); + Assert.Null(assemblyName.GetPublicKey()); + Assert.Equal(AssemblyNameFlags.None, assemblyName.Flags); + Assert.Equal(AssemblyContentType.Default, assemblyName.ContentType); + + // Validate against AssemblyRefernce + ValidateReferenceAssemblyNameAgainst(assemblyName, reader, assemblyRef); + + // Validate against AssemblyDefinition + ValidateReferenceAssemblyNameAgainst(assemblyName, reader, assemblyDef); + + i++; + } + } + + private void ValidateReferenceAssemblyNameAgainst(AssemblyName assemblyName, MetadataReader reader, AssemblyReference assemblyRef) + { + Assert.Equal(reader.GetString(assemblyRef.Name), assemblyName.Name); + Assert.Equal(assemblyRef.Version, assemblyName.Version); + Assert.Equal(reader.GetBlobBytes(assemblyRef.PublicKeyOrToken), assemblyName.GetPublicKeyToken()); + } + + private void ValidateReferenceAssemblyNameAgainst(AssemblyName assemblyName, MetadataReader reader, AssemblyDefinition assemblyDef) + { + Assert.NotEqual(reader.GetString(assemblyDef.Name), assemblyName.Name); + Assert.NotEqual(assemblyDef.Version, assemblyName.Version); + } + } +} diff --git a/external/corefx/src/System.Reflection.Metadata/tests/Resources/Misc/SatelliteAssembly.resources.cs b/external/corefx/src/System.Reflection.Metadata/tests/Resources/Misc/SatelliteAssembly.resources.cs new file mode 100644 index 0000000000..da2938ba86 --- /dev/null +++ b/external/corefx/src/System.Reflection.Metadata/tests/Resources/Misc/SatelliteAssembly.resources.cs @@ -0,0 +1,10 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// csc /target:library /debug:full Debug.cs + +public class C +{ + public static void Main() { } +} diff --git a/external/corefx/src/System.Reflection.Metadata/tests/Resources/TestResources.cs b/external/corefx/src/System.Reflection.Metadata/tests/Resources/TestResources.cs index a37707cbdc..6111b333d2 100644 --- a/external/corefx/src/System.Reflection.Metadata/tests/Resources/TestResources.cs +++ b/external/corefx/src/System.Reflection.Metadata/tests/Resources/TestResources.cs @@ -26,6 +26,7 @@ namespace System.Reflection.Metadata.Tests public static readonly byte[] Debug = ResourceHelper.GetResource("Misc.Debug.dll"); public static readonly byte[] KeyPair = ResourceHelper.GetResource("Misc.KeyPair.snk"); public static readonly byte[] Signed = ResourceHelper.GetResource("Misc.Signed.exe"); + public static readonly byte[] Satellite = ResourceHelper.GetResource("Misc.SatelliteAssembly.resources.dll"); public static readonly byte[] KeyPair_PublicKey = new byte[] { diff --git a/external/corefx/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj b/external/corefx/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj index f79be12e9d..8850ce334e 100644 --- a/external/corefx/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj +++ b/external/corefx/src/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj @@ -38,6 +38,8 @@ + + @@ -130,14 +132,16 @@ + + - + - \ No newline at end of file + diff --git a/external/corefx/src/System.Reflection.TypeExtensions/pkg/System.Reflection.TypeExtensions.pkgproj b/external/corefx/src/System.Reflection.TypeExtensions/pkg/System.Reflection.TypeExtensions.pkgproj index cb624f57ca..eef231f237 100644 --- a/external/corefx/src/System.Reflection.TypeExtensions/pkg/System.Reflection.TypeExtensions.pkgproj +++ b/external/corefx/src/System.Reflection.TypeExtensions/pkg/System.Reflection.TypeExtensions.pkgproj @@ -3,7 +3,7 @@ - net461;netcoreapp2.0;$(AllXamarinFrameworks) + net461;netcoreapp2.1;$(AllXamarinFrameworks) diff --git a/external/corefx/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj b/external/corefx/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj index 9eb0a5a5f1..86b9334f67 100644 --- a/external/corefx/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj +++ b/external/corefx/src/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.csproj @@ -3,6 +3,9 @@ {C303A051-8D54-4460-8BFD-DE10F0473BDB} + + 4.1.2.0 diff --git a/external/corefx/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj b/external/corefx/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj index 9382cbe54c..cb7d587972 100644 --- a/external/corefx/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj +++ b/external/corefx/src/System.Reflection.TypeExtensions/tests/CoreCLR/System.Reflection.TypeExtensions.CoreCLR.Tests.csproj @@ -18,9 +18,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj b/external/corefx/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj index a92a78b24d..60fb209071 100644 --- a/external/corefx/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj +++ b/external/corefx/src/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj @@ -25,10 +25,5 @@ - - - Common\System\PlatformDetection.cs - - diff --git a/external/corefx/src/System.Reflection/System.Reflection.sln b/external/corefx/src/System.Reflection/System.Reflection.sln index 4bfa3149a6..dcecec23ad 100644 --- a/external/corefx/src/System.Reflection/System.Reflection.sln +++ b/external/corefx/src/System.Reflection/System.Reflection.sln @@ -7,6 +7,61 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests", " {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_0_0_0_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_0_0_0_0.csproj", "{5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_0_0_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_0_0_0.csproj", "{80696796-DE63-42CA-ACB0-A83E5AA7AE06}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_1_0_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_1_0_0.csproj", "{E28C7916-1BCE-434A-B045-9F755A00A7C4}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_1_1_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_1_1_0.csproj", "{0AC47423-D050-46D4-8C4C-E2D44102FAB6}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_1_1_2", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_1_1_2.csproj", "{652B7191-D7FE-4889-8E45-1AF7739C0EAD}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_1_1_3", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_1_1_3.csproj", "{072D1E70-A0A4-44AB-92B8-2F6B772626CC}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_1_2_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_1_2_0.csproj", "{3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_1_3_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_1_3_0.csproj", "{02758899-6A37-4FF1-B765-F1C38B40BC9C}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_2_0_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_2_0_0.csproj", "{510CC907-F5AA-432D-AEEB-14A10AE3F811}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_1_3_0_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_1_3_0_0.csproj", "{68AD3675-F57E-4FB3-9943-49E602678BCA}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.Tests.Assembly_3_0_0_0", "tests\AssemblyVersion\System.Reflection.Tests.Assembly_3_0_0_0.csproj", "{42E66302-6F46-47BE-936B-4264DFD6004F}" + ProjectSection(ProjectDependencies) = postProject + {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.CoreCLR.Tests", "tests\CoreCLR\System.Reflection.CoreCLR.Tests.csproj", "{C8049356-559D-4F34-AC17-56F3AE62C897}" ProjectSection(ProjectDependencies) = postProject {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {68F87E68-E13F-4354-A6D6-B44727FE53EE} @@ -40,6 +95,50 @@ Global {B027C72E-F04E-42E0-A7F7-993AEF8400D2}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {B027C72E-F04E-42E0-A7F7-993AEF8400D2}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU {B027C72E-F04E-42E0-A7F7-993AEF8400D2}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {80696796-DE63-42CA-ACB0-A83E5AA7AE06}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {80696796-DE63-42CA-ACB0-A83E5AA7AE06}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {80696796-DE63-42CA-ACB0-A83E5AA7AE06}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {80696796-DE63-42CA-ACB0-A83E5AA7AE06}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {E28C7916-1BCE-434A-B045-9F755A00A7C4}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {E28C7916-1BCE-434A-B045-9F755A00A7C4}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {E28C7916-1BCE-434A-B045-9F755A00A7C4}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {E28C7916-1BCE-434A-B045-9F755A00A7C4}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {0AC47423-D050-46D4-8C4C-E2D44102FAB6}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {0AC47423-D050-46D4-8C4C-E2D44102FAB6}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {0AC47423-D050-46D4-8C4C-E2D44102FAB6}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {0AC47423-D050-46D4-8C4C-E2D44102FAB6}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {652B7191-D7FE-4889-8E45-1AF7739C0EAD}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {652B7191-D7FE-4889-8E45-1AF7739C0EAD}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {652B7191-D7FE-4889-8E45-1AF7739C0EAD}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {652B7191-D7FE-4889-8E45-1AF7739C0EAD}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {072D1E70-A0A4-44AB-92B8-2F6B772626CC}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {072D1E70-A0A4-44AB-92B8-2F6B772626CC}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {072D1E70-A0A4-44AB-92B8-2F6B772626CC}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {072D1E70-A0A4-44AB-92B8-2F6B772626CC}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {02758899-6A37-4FF1-B765-F1C38B40BC9C}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {02758899-6A37-4FF1-B765-F1C38B40BC9C}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {02758899-6A37-4FF1-B765-F1C38B40BC9C}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {02758899-6A37-4FF1-B765-F1C38B40BC9C}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {510CC907-F5AA-432D-AEEB-14A10AE3F811}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {510CC907-F5AA-432D-AEEB-14A10AE3F811}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {510CC907-F5AA-432D-AEEB-14A10AE3F811}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {510CC907-F5AA-432D-AEEB-14A10AE3F811}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {68AD3675-F57E-4FB3-9943-49E602678BCA}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {68AD3675-F57E-4FB3-9943-49E602678BCA}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {68AD3675-F57E-4FB3-9943-49E602678BCA}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {68AD3675-F57E-4FB3-9943-49E602678BCA}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {42E66302-6F46-47BE-936B-4264DFD6004F}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {42E66302-6F46-47BE-936B-4264DFD6004F}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {42E66302-6F46-47BE-936B-4264DFD6004F}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {42E66302-6F46-47BE-936B-4264DFD6004F}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {C8049356-559D-4F34-AC17-56F3AE62C897}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU {C8049356-559D-4F34-AC17-56F3AE62C897}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU {C8049356-559D-4F34-AC17-56F3AE62C897}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU @@ -62,6 +161,17 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {B027C72E-F04E-42E0-A7F7-993AEF8400D2} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {80696796-DE63-42CA-ACB0-A83E5AA7AE06} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {E28C7916-1BCE-434A-B045-9F755A00A7C4} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {0AC47423-D050-46D4-8C4C-E2D44102FAB6} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {652B7191-D7FE-4889-8E45-1AF7739C0EAD} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {072D1E70-A0A4-44AB-92B8-2F6B772626CC} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {02758899-6A37-4FF1-B765-F1C38B40BC9C} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {510CC907-F5AA-432D-AEEB-14A10AE3F811} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {68AD3675-F57E-4FB3-9943-49E602678BCA} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {42E66302-6F46-47BE-936B-4264DFD6004F} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {C8049356-559D-4F34-AC17-56F3AE62C897} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {8C19B991-41E9-4B38-9602-E19375397F1D} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {68F87E68-E13F-4354-A6D6-B44727FE53EE} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyNameTests.cs b/external/corefx/src/System.Reflection/tests/AssemblyNameTests.cs index d6080359e1..a8e2feb4e2 100644 --- a/external/corefx/src/System.Reflection/tests/AssemblyNameTests.cs +++ b/external/corefx/src/System.Reflection/tests/AssemblyNameTests.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using Xunit; namespace System.Reflection.Tests @@ -304,6 +305,177 @@ namespace System.Reflection.Tests Assert.Contains("Version=255.1.2.3", assemblyName.FullName); } + private static readonly string VersionUnspecifiedStr = ushort.MaxValue.ToString(NumberFormatInfo.InvariantInfo); + + private static IEnumerable Constructor_String_InvalidVersionTest_MemberData() + { + // No components + yield return new object[] { "" }; + yield return new object[] { $"{VersionUnspecifiedStr}" }; + yield return new object[] { $"{VersionUnspecifiedStr}.{VersionUnspecifiedStr}" }; + yield return new object[] { $"{VersionUnspecifiedStr}.{VersionUnspecifiedStr}.{VersionUnspecifiedStr}" }; + yield return new object[] { $"{VersionUnspecifiedStr}.{VersionUnspecifiedStr}.{VersionUnspecifiedStr}.{VersionUnspecifiedStr}" }; + + // No major version + yield return new object[] { $"{VersionUnspecifiedStr}.1" }; + yield return new object[] { $"{VersionUnspecifiedStr}.1.1" }; + yield return new object[] { $"{VersionUnspecifiedStr}.1.1.1" }; + + // No minor version + yield return new object[] { "1" }; + yield return new object[] { $"1.{VersionUnspecifiedStr}" }; + yield return new object[] { $"1.{VersionUnspecifiedStr}.1" }; + yield return new object[] { $"1.{VersionUnspecifiedStr}.1.1" }; + + // Too long + yield return new object[] { "1.1.1.1." }; + yield return new object[] { "1.1.1.1.1" }; + + // Invalid component + foreach (var invalidComponent in new string[] { "", ".", ".1", "-1", "65536", "foo" }) + { + yield return new object[] { "" + invalidComponent }; + yield return new object[] { "1." + invalidComponent }; + yield return new object[] { "1.1." + invalidComponent }; + yield return new object[] { "1.1.1." + invalidComponent }; + } + } + + [Theory] + [MemberData(nameof(Constructor_String_InvalidVersionTest_MemberData))] + [SkipOnTargetFramework( + TargetFrameworkMonikers.NetFramework, + ".NET Core behavior differs from .NET Framework since it does not want to replicate some bugs")] + public static void Constructor_String_InvalidVersionTest(string versionStr) + { + Assert.Throws(() => new AssemblyName("a, Version=" + versionStr)); + + if (versionStr.Split('.').Length < 2 || // Version(string) should throw when the minor version is not specified + ( + // The Version class has components of size int32, while AssemblyName(string) only allows uint16 values + versionStr.IndexOf(VersionUnspecifiedStr, StringComparison.Ordinal) == -1 && + versionStr.IndexOf("65536", StringComparison.Ordinal) == -1 + )) + { + Assert.ThrowsAny(() => new Version(versionStr)); + } + else + { + new Version(versionStr); + } + } + + private static IEnumerable Constructor_String_VersionTest_MemberData() + { + // No build + var expectedVersion = new Version(1, 1); + yield return new object[] { expectedVersion, "1.1" }; + yield return new object[] { expectedVersion, $"1.1.{VersionUnspecifiedStr}" }; + yield return new object[] { expectedVersion, $"1.1.{VersionUnspecifiedStr}.1" }; + + // No revision + expectedVersion = new Version(1, 1, 1); + yield return new object[] { expectedVersion, "1.1.1" }; + yield return new object[] { expectedVersion, $"1.1.1.{VersionUnspecifiedStr}" }; + + // All components + yield return new object[] { new Version(1, 1, 1, 1), "1.1.1.1" }; + // 65535 causes the component to be considered unspecified. That's not very interesting, so using 65534 instead. + yield return new object[] { new Version(65534, 65534, 65534, 65534), "65534.65534.65534.65534" }; + } + + [Theory] + [MemberData(nameof(Constructor_String_VersionTest_MemberData))] + [SkipOnTargetFramework( + TargetFrameworkMonikers.NetFramework, + ".NET Core behavior differs from .NET Framework since it does not want to replicate some bugs")] + public static void Constructor_String_VersionTest(Version expectedVersion, string versionStr) + { + Assert.NotNull(expectedVersion); + + Action verify = + an => + { + if (expectedVersion == null) + { + Assert.Null(an.Version); + } + else + { + Assert.Equal(expectedVersion, an.Version); + } + }; + + var assemblyNameFromStr = new AssemblyName("a, Version=" + versionStr); + verify(assemblyNameFromStr); + verify(new AssemblyName(assemblyNameFromStr.FullName)); + + var versionFromStr = new Version(versionStr); + + // The Version class has components of size int32, while AssemblyName(string) only allows uint16 values + if (versionStr.IndexOf(VersionUnspecifiedStr, StringComparison.Ordinal) == -1) + { + Assert.Equal(expectedVersion, versionFromStr); + } + + assemblyNameFromStr = new AssemblyName("a, Version=" + versionFromStr); + verify(assemblyNameFromStr); + verify(new AssemblyName(assemblyNameFromStr.FullName)); + + assemblyNameFromStr = new AssemblyName() { Name = "a", Version = expectedVersion }; + verify(assemblyNameFromStr); + verify(new AssemblyName(assemblyNameFromStr.FullName)); + } + + [Fact] + [SkipOnTargetFramework( + TargetFrameworkMonikers.NetFramework, + ".NET Core behavior differs from .NET Framework since it does not want to replicate some bugs")] + public static void Constructor_String_LoadVersionTest() + { + string assemblyNamePrefix = "System.Reflection.Tests.Assembly_"; + + // Requested version 1.0 does not load 0.0.0.0, but loads 1.2.0.0, 3.0.0.0 + Assert.Throws(() => Assembly.Load(new AssemblyName(assemblyNamePrefix + "0_0_0_0, Version=1.0"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_2_0_0, Version=1.0"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "3_0_0_0, Version=1.0"))); + + // Requested version 1.1 does not load 1.0.0.0, but loads 1.1.2.0, 1.3.0.0 + Assert.Throws(() => Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_0_0_0, Version=1.1"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_1_2_0, Version=1.1"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_3_0_0, Version=1.1"))); + + // Requested version 1.1.1 does not load 1.1.0.0, but loads 1.1.1.2, 1.1.3.0 + Assert.Throws(() => Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_1_0_0, Version=1.1.1"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_1_1_2, Version=1.1.1"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_1_3_0, Version=1.1.1"))); + + // Requested version 1.1.1.1 does not load 1.1.1.0, but loads 1.1.1.3 + Assert.Throws(() => Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_1_1_0, Version=1.1.1.1"))); + Assert.NotNull(Assembly.Load(new AssemblyName(assemblyNamePrefix + "1_1_1_3, Version=1.1.1.1"))); + + Constructor_String_LoadVersionTest_ReferenceVersionAssemblies(); + } + + [MethodImpl(MethodImplOptions.NoInlining)] // delay type loading so that the test above can run first + private static void Constructor_String_LoadVersionTest_ReferenceVersionAssemblies() + { + // The purpose of this function is only to have a static reference to each of the test assemblies required by + // Constructor_String_LoadVersionTest so that the compiler does not optimize away the project references and ILC can + // include them in the closure. Otherwise, the test does not work on UapAot. + Assert.NotNull(typeof(AssemblyVersion.Program_0_0_0_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_0_0_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_1_0_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_1_1_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_1_1_2)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_1_1_3)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_1_2_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_1_3_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_2_0_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_1_3_0_0)); + Assert.NotNull(typeof(AssemblyVersion.Program_3_0_0_0)); + } + [Theory] [InlineData("Foo")] [InlineData("Hi There")] diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Configurations.props b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_0_0_0_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_0_0_0_0.cs new file mode 100644 index 0000000000..a995f9f9ee --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_0_0_0_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_0_0_0_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_0_0_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_0_0_0.cs new file mode 100644 index 0000000000..dea50e61b7 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_0_0_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_0_0_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_0_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_0_0.cs new file mode 100644 index 0000000000..5e5f79d205 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_0_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_1_0_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_0.cs new file mode 100644 index 0000000000..f4534c4df7 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_1_1_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_2.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_2.cs new file mode 100644 index 0000000000..f2a5691c74 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_2.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_1_1_2 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_3.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_3.cs new file mode 100644 index 0000000000..5d7bdd7bfe --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_1_3.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_1_1_3 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_2_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_2_0.cs new file mode 100644 index 0000000000..b7b3b752e0 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_2_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_1_2_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_3_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_3_0.cs new file mode 100644 index 0000000000..c79be4cf6d --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_1_3_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_1_3_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_2_0_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_2_0_0.cs new file mode 100644 index 0000000000..7fcb9ff62c --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_2_0_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_2_0_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_3_0_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_3_0_0.cs new file mode 100644 index 0000000000..28a1ada8aa --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_1_3_0_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_1_3_0_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_3_0_0_0.cs b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_3_0_0_0.cs new file mode 100644 index 0000000000..bcc2b3d286 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/Program_3_0_0_0.cs @@ -0,0 +1,12 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly: System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAssembly] + +namespace System.Reflection.Tests.AssemblyVersion +{ + public class Program_3_0_0_0 + { + } +} diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_0_0_0_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_0_0_0_0.csproj new file mode 100644 index 0000000000..bcb5ccf8c1 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_0_0_0_0.csproj @@ -0,0 +1,18 @@ + + + + + {5B003EB4-DD06-4BC6-B2E9-A9F0E445CB86} + 0.0.0.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_0_0_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_0_0_0.csproj new file mode 100644 index 0000000000..581206e9db --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_0_0_0.csproj @@ -0,0 +1,18 @@ + + + + + {80696796-DE63-42CA-ACB0-A83E5AA7AE06} + 1.0.0.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_0_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_0_0.csproj new file mode 100644 index 0000000000..86783e98bf --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_0_0.csproj @@ -0,0 +1,18 @@ + + + + + {E28C7916-1BCE-434A-B045-9F755A00A7C4} + 1.1.0.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_0.csproj new file mode 100644 index 0000000000..014ad0f796 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_0.csproj @@ -0,0 +1,18 @@ + + + + + {0AC47423-D050-46D4-8C4C-E2D44102FAB6} + 1.1.1.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_2.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_2.csproj new file mode 100644 index 0000000000..add28faa6f --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_2.csproj @@ -0,0 +1,18 @@ + + + + + {652B7191-D7FE-4889-8E45-1AF7739C0EAD} + 1.1.1.2 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_3.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_3.csproj new file mode 100644 index 0000000000..7665416966 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_1_3.csproj @@ -0,0 +1,18 @@ + + + + + {072D1E70-A0A4-44AB-92B8-2F6B772626CC} + 1.1.1.3 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_2_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_2_0.csproj new file mode 100644 index 0000000000..f0d52a56ca --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_2_0.csproj @@ -0,0 +1,18 @@ + + + + + {3E30213F-6E59-4BE8-BF4A-64D2AAED5B2E} + 1.1.2.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_3_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_3_0.csproj new file mode 100644 index 0000000000..0454ebc2d4 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_1_3_0.csproj @@ -0,0 +1,18 @@ + + + + + {02758899-6A37-4FF1-B765-F1C38B40BC9C} + 1.1.3.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_2_0_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_2_0_0.csproj new file mode 100644 index 0000000000..0ef38b7a69 --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_2_0_0.csproj @@ -0,0 +1,18 @@ + + + + + {510CC907-F5AA-432D-AEEB-14A10AE3F811} + 1.2.0.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_3_0_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_3_0_0.csproj new file mode 100644 index 0000000000..d4bdbd776a --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_1_3_0_0.csproj @@ -0,0 +1,18 @@ + + + + + {68AD3675-F57E-4FB3-9943-49E602678BCA} + 1.3.0.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_3_0_0_0.csproj b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_3_0_0_0.csproj new file mode 100644 index 0000000000..f6702adc9a --- /dev/null +++ b/external/corefx/src/System.Reflection/tests/AssemblyVersion/System.Reflection.Tests.Assembly_3_0_0_0.csproj @@ -0,0 +1,18 @@ + + + + + {42E66302-6F46-47BE-936B-4264DFD6004F} + 3.0.0.0 + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Reflection/tests/System.Reflection.Tests.csproj b/external/corefx/src/System.Reflection/tests/System.Reflection.Tests.csproj index 6da89a1074..11f327df82 100644 --- a/external/corefx/src/System.Reflection/tests/System.Reflection.Tests.csproj +++ b/external/corefx/src/System.Reflection/tests/System.Reflection.Tests.csproj @@ -25,11 +25,6 @@ - - - Common\System\PlatformDetection.cs - - EmbeddedImage.png @@ -39,6 +34,17 @@ + + + + + + + + + + + {8c19b991-41e9-4b38-9602-e19375397f1d} System.Reflection.Tests.TestExe diff --git a/external/corefx/src/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj b/external/corefx/src/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj index f324921b6a..8a7dc9d48b 100644 --- a/external/corefx/src/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj +++ b/external/corefx/src/System.Resources.ResourceManager/tests/System.Resources.ResourceManager.Tests.csproj @@ -18,9 +18,6 @@ TestResx.resx - - CommonTest\System\PlatformDetection.cs - System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.sln b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.sln index dca30455ba..f3576202c9 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.sln +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe.sln @@ -30,10 +30,10 @@ Global {8012DD70-A6D7-45C0-BC8E-DFFB48D86E08}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU {8012DD70-A6D7-45C0-BC8E-DFFB48D86E08}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU {8012DD70-A6D7-45C0-BC8E-DFFB48D86E08}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU - {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {04BA3E3C-6979-4792-B19E-C797AD607F42}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU {649A377C-1E07-4105-B01F-7F1044D3356C}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {649A377C-1E07-4105-B01F-7F1044D3356C}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {649A377C-1E07-4105-B01F-7F1044D3356C}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/dir.props b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/dir.props index 0d81e0a9e8..3e15820477 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/dir.props +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/dir.props @@ -4,5 +4,7 @@ 4.0.4.0 MSFT + true + true \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/pkg/System.Runtime.CompilerServices.Unsafe.pkgproj b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/pkg/System.Runtime.CompilerServices.Unsafe.pkgproj index d73c618a40..310dd2420a 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/pkg/System.Runtime.CompilerServices.Unsafe.pkgproj +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/pkg/System.Runtime.CompilerServices.Unsafe.pkgproj @@ -7,6 +7,15 @@ net45;netcore45;wp8;wpa81;netcoreapp1.0;$(AllXamarinFrameworks) + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/ref/System.Runtime.CompilerServices.Unsafe.cs b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/ref/System.Runtime.CompilerServices.Unsafe.cs index b6bbbb8b98..b53c5d496c 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/ref/System.Runtime.CompilerServices.Unsafe.cs +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/ref/System.Runtime.CompilerServices.Unsafe.cs @@ -16,6 +16,7 @@ namespace System.Runtime.CompilerServices public static bool AreSame(ref T left, ref T right) { throw null; } public unsafe static void* AsPointer(ref T value) { throw null; } public unsafe static ref T AsRef(void* source) { throw null; } + public static ref T AsRef(ref readonly T source) { throw null; } public static T As(object o) where T : class { throw null; } public static ref TTo As(ref TFrom source) { throw null; } public static System.IntPtr ByteOffset(ref T origin, ref T target) { throw null; } diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/Configurations.props b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/Configurations.props index f6b9b507b2..ba6b9bda8a 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/Configurations.props +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/Configurations.props @@ -4,6 +4,7 @@ netstandard1.0; netstandard; - + netcoreapp; + diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il index 4862640fce..07c61f177d 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il @@ -262,6 +262,15 @@ .method public hidebysig static !!T& AsRef(void* source) cil managed aggressiveinlining { .custom instance void System.Runtime.Versioning.NonVersionableAttribute::.ctor() = ( 01 00 00 00 ) +// For .NET Core the roundtrip via a local is no longer needed see: +// https://github.com/dotnet/coreclr/issues/13341 +// and +// https://github.com/dotnet/coreclr/pull/11218 +#ifdef netcoreapp + .maxstack 1 + ldarg.0 + ret +#else .locals (int32&) .maxstack 1 ldarg.0 @@ -269,6 +278,21 @@ stloc.0 ldloc.0 ret +#endif + } // end of method Unsafe::AsRef + + .method public hidebysig static !!T& AsRef(!!T& source) cil managed aggressiveinlining + { + .custom instance void System.Runtime.Versioning.NonVersionableAttribute::.ctor() = ( 01 00 00 00 ) + .param [1] +#ifdef netcoreapp + .custom instance void [CORE_ASSEMBLY]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) +#else + .custom instance void System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 ) +#endif + .maxstack 1 + ldarg.0 + ret } // end of method Unsafe::AsRef .method public hidebysig static !!TTo& As(!!TFrom& source) cil managed aggressiveinlining @@ -413,3 +437,20 @@ } // end of method NonVersionableAttribute::.ctor } // end of class System.Runtime.Versioning.NonVersionableAttribute + +#ifdef netcoreapp +#else +.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.IsReadOnlyAttribute + extends [CORE_ASSEMBLY]System.Attribute +{ + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed + { + .maxstack 1 + ldarg.0 + call instance void [CORE_ASSEMBLY]System.Attribute::.ctor() + ret + } // end of method IsReadOnlyAttribute::.ctor + +} // end of class System.Runtime.CompilerServices.IsReadOnlyAttribute +#endif diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj index b99fd3cf3a..2a61d0a70f 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj @@ -8,6 +8,8 @@ + + diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.xml b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.xml index 4a7ea0d948..c6a85cc991 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.xml +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.xml @@ -72,6 +72,14 @@ The location of the value to reference. A reference to a value of type . + + + Reinterprets the given read-only reference as a reference. + + The type of reference. + The read-only reference to reinterpret. + A reference to a value of type . + Reinterprets the given reference as a reference to a value of type . diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/include/netcoreapp/coreassembly.h b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/include/netcoreapp/coreassembly.h new file mode 100644 index 0000000000..f346bf929b --- /dev/null +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/src/include/netcoreapp/coreassembly.h @@ -0,0 +1,9 @@ +#define CORE_ASSEMBLY "System.Runtime" +#define netcoreapp + +// Metadata version: v4.0.30319 +.assembly extern CORE_ASSEMBLY +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: + .ver 4:0:0:0 +} diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/Configurations.props b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/Configurations.props index d3ac8a63c7..78953dfc88 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/Configurations.props +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/Configurations.props @@ -2,7 +2,7 @@ - netcoreapp; + netstandard; diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/System.Runtime.CompilerServices.Unsafe.Tests.csproj b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/System.Runtime.CompilerServices.Unsafe.Tests.csproj index 6fcc7290de..b97583056b 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/System.Runtime.CompilerServices.Unsafe.Tests.csproj +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/System.Runtime.CompilerServices.Unsafe.Tests.csproj @@ -5,8 +5,8 @@ true {8012DD70-A6D7-45C0-BC8E-DFFB48D86E08} - - + + diff --git a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs index 1df5657747..4a71020ae3 100644 --- a/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs +++ b/external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs @@ -431,6 +431,18 @@ namespace System.Runtime.CompilerServices } } + [Fact] + public static void InAsRef() + { + int[] a = new int[] { 0x123, 0x234, 0x345, 0x456 }; + + ref int r = ref Unsafe.AsRef(a[0]); + Assert.Equal(0x123, r); + + r = 0x42; + Assert.Equal(0x42, a[0]); + } + [Fact] public static void RefAs() { diff --git a/external/corefx/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs.REMOVED.git-id index 955dd72bab..b87bf8378e 100644 --- a/external/corefx/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs.REMOVED.git-id @@ -1 +1 @@ -a5d89b049a96b8d29b311e9e2c4acb0b372bc0a3 \ No newline at end of file +312c20682d4fe5a6eddb4b88be373f41aa9e09ff \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Extensions/src/PinvokeAnalyzerExceptionList.analyzerdata.uap b/external/corefx/src/System.Runtime.Extensions/src/PinvokeAnalyzerExceptionList.analyzerdata.uap deleted file mode 100644 index 9e2ef6b397..0000000000 --- a/external/corefx/src/System.Runtime.Extensions/src/PinvokeAnalyzerExceptionList.analyzerdata.uap +++ /dev/null @@ -1 +0,0 @@ -shell32.dll!SHGetKnownFolderPath diff --git a/external/corefx/src/System.Runtime.Extensions/src/PinvokeAnalyzerExceptionList.analyzerdata.uapaot b/external/corefx/src/System.Runtime.Extensions/src/PinvokeAnalyzerExceptionList.analyzerdata.uapaot deleted file mode 100644 index 9e2ef6b397..0000000000 --- a/external/corefx/src/System.Runtime.Extensions/src/PinvokeAnalyzerExceptionList.analyzerdata.uapaot +++ /dev/null @@ -1 +0,0 @@ -shell32.dll!SHGetKnownFolderPath diff --git a/external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx b/external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx index 7dfe4e5ee1..1b7afc3757 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx +++ b/external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx @@ -1,5 +1,64 @@  + @@ -94,21 +153,12 @@ Specified file length was too large for the file system. - - The path is not of a legal form. - - - The UNC path should be of the form \\\\server\\share. - Illegal characters in path. Path cannot be the empty string or all whitespace. - - The given path's format is not supported. - '{0}' must be greater than zero. @@ -145,9 +195,6 @@ The file '{0}' already exists. - - Unable to use cryptographic functionality. - Illegal enum value: {0} @@ -274,9 +321,6 @@ Collection is read-only. - - Insufficient state to return the real object. - OnDeserialization method was called while the object was not being deserialized. @@ -367,4 +411,7 @@ AppDomain resource monitoring is not supported on this platform. - + + The read operation returned an invalid length. + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj b/external/corefx/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj index b794645871..3141f76790 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj +++ b/external/corefx/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj @@ -89,10 +89,21 @@ Common\System\HResults.cs + + + + + + + Common\Interop\Windows\secur32\Interop.GetUserNameExW.cs + + + Common\Interop\Windows\shell32\Interop.SHGetKnownFolderPath.cs + + - @@ -161,12 +172,6 @@ Common\Interop\Windows\kernel32\Interop.SYSTEM_INFO.cs - - Common\Interop\Windows\secur32\Interop.GetUserNameExW.cs - - - Common\Interop\Windows\shell32\Interop.SHGetKnownFolderPath.cs - Common\System\IO\DriveInfoInternal.Win32.cs @@ -255,9 +260,11 @@ - + + + diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs.REMOVED.git-id index 11e891d0b3..c5366a83c2 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs.REMOVED.git-id @@ -1 +1 @@ -54f909983588e6294053faa44d9651c72bfdf790 \ No newline at end of file +a75a07503254acc305956d1320fe94a031eec954 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs index e921e34ae6..7916a38227 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs @@ -734,13 +734,13 @@ namespace System.Collections private void expand() { int rawsize = HashHelpers.ExpandPrime(_buckets.Length); - rehash(rawsize, false); + rehash(rawsize); } // We occasionally need to rehash the table to clean up the collision bits. private void rehash() { - rehash(_buckets.Length, false); + rehash(_buckets.Length); } private void UpdateVersion() @@ -750,7 +750,7 @@ namespace System.Collections _version++; } - private void rehash(int newsize, bool forceNewHashCode) + private void rehash(int newsize) { // reset occupancy _occupancy = 0; @@ -770,7 +770,7 @@ namespace System.Collections bucket oldb = _buckets[nb]; if ((oldb.key != null) && (oldb.key != _buckets)) { - int hashcode = ((forceNewHashCode ? GetHash(oldb.key) : oldb.hash_coll) & 0x7FFFFFFF); + int hashcode = oldb.hash_coll & 0x7FFFFFFF; putEntry(newBuckets, oldb.key, oldb.val, hashcode); } } @@ -783,7 +783,6 @@ namespace System.Collections _isWriterInProgress = false; // minimum size of hashtable is 3 now and maximum loadFactor is 0.72 now. Debug.Assert(_loadsize < newsize, "Our current implementation means this is not possible."); - return; } // Returns an enumerator for this hashtable. @@ -947,18 +946,7 @@ namespace System.Collections _count++; UpdateVersion(); _isWriterInProgress = false; -#if FEATURE_RANDOMIZED_STRING_HASHING - if (ntry > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_keycomparer)) - { - // PERF: We don't want to rehash if _keycomparer is already a RandomizedObjectEqualityComparer since in some - // cases there may not be any strings in the hashtable and we wouldn't get any mixing. - if (_keycomparer == null || !(_keycomparer is System.Collections.Generic.RandomizedObjectEqualityComparer)) - { - _keycomparer = HashHelpers.GetRandomizedEqualityComparer(_keycomparer); - rehash(buckets.Length, true); - } - } -#endif + return; } @@ -977,18 +965,6 @@ namespace System.Collections UpdateVersion(); _isWriterInProgress = false; -#if FEATURE_RANDOMIZED_STRING_HASHING - if (ntry > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_keycomparer)) - { - // PERF: We don't want to rehash if _keycomparer is already a RandomizedObjectEqualityComparer since in some - // cases there may not be any strings in the hashtable and we wouldn't get any mixing. - if (_keycomparer == null || !(_keycomparer is System.Collections.Generic.RandomizedObjectEqualityComparer)) - { - _keycomparer = HashHelpers.GetRandomizedEqualityComparer(_keycomparer); - rehash(buckets.Length, true); - } - } -#endif return; } @@ -1019,18 +995,6 @@ namespace System.Collections UpdateVersion(); _isWriterInProgress = false; -#if FEATURE_RANDOMIZED_STRING_HASHING - if (buckets.Length > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_keycomparer)) - { - // PERF: We don't want to rehash if _keycomparer is already a RandomizedObjectEqualityComparer since in some - // cases there may not be any strings in the hashtable and we wouldn't get any mixing. - if (_keycomparer == null || !(_keycomparer is System.Collections.Generic.RandomizedObjectEqualityComparer)) - { - _keycomparer = HashHelpers.GetRandomizedEqualityComparer(_keycomparer); - rehash(buckets.Length, true); - } - } -#endif return; } @@ -1696,10 +1660,6 @@ namespace System.Collections internal static class HashHelpers { -#if FEATURE_RANDOMIZED_STRING_HASHING - public const int HashCollisionThreshold = 100; - public static bool s_UseRandomizedStringHashing = String.UseRandomizedHashing(); -#endif // Table of prime numbers to use as hash table sizes. // A typical resize algorithm would pick the smallest prime number in this array // that is larger than twice the previous capacity. @@ -1777,87 +1737,5 @@ namespace System.Collections private static ConditionalWeakTable s_serializationInfoTable; public static ConditionalWeakTable SerializationInfoTable => LazyInitializer.EnsureInitialized(ref s_serializationInfoTable); - -#if FEATURE_RANDOMIZED_STRING_HASHING - public static bool IsWellKnownEqualityComparer(object comparer) - { - return (comparer == null || comparer == System.Collections.Generic.EqualityComparer.Default || comparer is IWellKnownStringEqualityComparer); - } - - public static IEqualityComparer GetRandomizedEqualityComparer(object comparer) - { - Debug.Assert(comparer == null || comparer == System.Collections.Generic.EqualityComparer.Default || comparer is IWellKnownStringEqualityComparer); - - if (comparer == null) - { - return new System.Collections.Generic.RandomizedObjectEqualityComparer(); - } - - if (comparer == System.Collections.Generic.EqualityComparer.Default) - { - return new System.Collections.Generic.RandomizedStringEqualityComparer(); - } - - IWellKnownStringEqualityComparer cmp = comparer as IWellKnownStringEqualityComparer; - - if (cmp != null) - { - return cmp.GetRandomizedEqualityComparer(); - } - - Debug.Fail("Missing case in GetRandomizedEqualityComparer!"); - - return null; - } - - public static object GetEqualityComparerForSerialization(object comparer) - { - if (comparer == null) - { - return null; - } - - IWellKnownStringEqualityComparer cmp = comparer as IWellKnownStringEqualityComparer; - - if (cmp != null) - { - return cmp.GetEqualityComparerForSerialization(); - } - - return comparer; - } - - private const int bufferSize = 1024; - private static RandomNumberGenerator rng; - private static byte[] data; - private static int currentIndex = bufferSize; - private static readonly object lockObj = new Object(); - - internal static long GetEntropy() - { - lock (lockObj) - { - long ret; - - if (currentIndex == bufferSize) - { - if (null == rng) - { - rng = RandomNumberGenerator.Create(); - data = new byte[bufferSize]; - Debug.Assert(bufferSize % 8 == 0, "We increment our current index by 8, so our buffer size must be a multiple of 8"); - } - - rng.GetBytes(data); - currentIndex = 0; - } - - ret = BitConverter.ToInt64(data, currentIndex); - currentIndex += 8; - - return ret; - } - } -#endif // FEATURE_RANDOMIZED_STRING_HASHING } } diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Win32.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Win32.cs index d190545bc3..ca023ced81 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Win32.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Win32.cs @@ -57,5 +57,181 @@ namespace System userDomainName = domainName.ToString(); } + + private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) + { + // We're using SHGetKnownFolderPath instead of SHGetFolderPath as SHGetFolderPath is + // capped at MAX_PATH. + // + // Because we validate both of the input enums we shouldn't have to care about CSIDL and flag + // definitions we haven't mapped. If we remove or loosen the checks we'd have to account + // for mapping here (this includes tweaking as SHGetFolderPath would do). + // + // The only SpecialFolderOption defines we have are equivalent to KnownFolderFlags. + + string folderGuid; + + switch (folder) + { + case SpecialFolder.ApplicationData: + folderGuid = Interop.Shell32.KnownFolders.RoamingAppData; + break; + case SpecialFolder.CommonApplicationData: + folderGuid = Interop.Shell32.KnownFolders.ProgramData; + break; + case SpecialFolder.LocalApplicationData: + folderGuid = Interop.Shell32.KnownFolders.LocalAppData; + break; + case SpecialFolder.Cookies: + folderGuid = Interop.Shell32.KnownFolders.Cookies; + break; + case SpecialFolder.Desktop: + folderGuid = Interop.Shell32.KnownFolders.Desktop; + break; + case SpecialFolder.Favorites: + folderGuid = Interop.Shell32.KnownFolders.Favorites; + break; + case SpecialFolder.History: + folderGuid = Interop.Shell32.KnownFolders.History; + break; + case SpecialFolder.InternetCache: + folderGuid = Interop.Shell32.KnownFolders.InternetCache; + break; + case SpecialFolder.Programs: + folderGuid = Interop.Shell32.KnownFolders.Programs; + break; + case SpecialFolder.MyComputer: + folderGuid = Interop.Shell32.KnownFolders.ComputerFolder; + break; + case SpecialFolder.MyMusic: + folderGuid = Interop.Shell32.KnownFolders.Music; + break; + case SpecialFolder.MyPictures: + folderGuid = Interop.Shell32.KnownFolders.Pictures; + break; + case SpecialFolder.MyVideos: + folderGuid = Interop.Shell32.KnownFolders.Videos; + break; + case SpecialFolder.Recent: + folderGuid = Interop.Shell32.KnownFolders.Recent; + break; + case SpecialFolder.SendTo: + folderGuid = Interop.Shell32.KnownFolders.SendTo; + break; + case SpecialFolder.StartMenu: + folderGuid = Interop.Shell32.KnownFolders.StartMenu; + break; + case SpecialFolder.Startup: + folderGuid = Interop.Shell32.KnownFolders.Startup; + break; + case SpecialFolder.System: + folderGuid = Interop.Shell32.KnownFolders.System; + break; + case SpecialFolder.Templates: + folderGuid = Interop.Shell32.KnownFolders.Templates; + break; + case SpecialFolder.DesktopDirectory: + folderGuid = Interop.Shell32.KnownFolders.Desktop; + break; + case SpecialFolder.Personal: + // Same as Personal + // case SpecialFolder.MyDocuments: + folderGuid = Interop.Shell32.KnownFolders.Documents; + break; + case SpecialFolder.ProgramFiles: + folderGuid = Interop.Shell32.KnownFolders.ProgramFiles; + break; + case SpecialFolder.CommonProgramFiles: + folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommon; + break; + case SpecialFolder.AdminTools: + folderGuid = Interop.Shell32.KnownFolders.AdminTools; + break; + case SpecialFolder.CDBurning: + folderGuid = Interop.Shell32.KnownFolders.CDBurning; + break; + case SpecialFolder.CommonAdminTools: + folderGuid = Interop.Shell32.KnownFolders.CommonAdminTools; + break; + case SpecialFolder.CommonDocuments: + folderGuid = Interop.Shell32.KnownFolders.PublicDocuments; + break; + case SpecialFolder.CommonMusic: + folderGuid = Interop.Shell32.KnownFolders.PublicMusic; + break; + case SpecialFolder.CommonOemLinks: + folderGuid = Interop.Shell32.KnownFolders.CommonOEMLinks; + break; + case SpecialFolder.CommonPictures: + folderGuid = Interop.Shell32.KnownFolders.PublicPictures; + break; + case SpecialFolder.CommonStartMenu: + folderGuid = Interop.Shell32.KnownFolders.CommonStartMenu; + break; + case SpecialFolder.CommonPrograms: + folderGuid = Interop.Shell32.KnownFolders.CommonPrograms; + break; + case SpecialFolder.CommonStartup: + folderGuid = Interop.Shell32.KnownFolders.CommonStartup; + break; + case SpecialFolder.CommonDesktopDirectory: + folderGuid = Interop.Shell32.KnownFolders.PublicDesktop; + break; + case SpecialFolder.CommonTemplates: + folderGuid = Interop.Shell32.KnownFolders.CommonTemplates; + break; + case SpecialFolder.CommonVideos: + folderGuid = Interop.Shell32.KnownFolders.PublicVideos; + break; + case SpecialFolder.Fonts: + folderGuid = Interop.Shell32.KnownFolders.Fonts; + break; + case SpecialFolder.NetworkShortcuts: + folderGuid = Interop.Shell32.KnownFolders.NetHood; + break; + case SpecialFolder.PrinterShortcuts: + folderGuid = Interop.Shell32.KnownFolders.PrintersFolder; + break; + case SpecialFolder.UserProfile: + folderGuid = Interop.Shell32.KnownFolders.Profile; + break; + case SpecialFolder.CommonProgramFilesX86: + folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommonX86; + break; + case SpecialFolder.ProgramFilesX86: + folderGuid = Interop.Shell32.KnownFolders.ProgramFilesX86; + break; + case SpecialFolder.Resources: + folderGuid = Interop.Shell32.KnownFolders.ResourceDir; + break; + case SpecialFolder.LocalizedResources: + folderGuid = Interop.Shell32.KnownFolders.LocalizedResourcesDir; + break; + case SpecialFolder.SystemX86: + folderGuid = Interop.Shell32.KnownFolders.SystemX86; + break; + case SpecialFolder.Windows: + folderGuid = Interop.Shell32.KnownFolders.Windows; + break; + default: + return string.Empty; + } + + return GetKnownFolderPath(folderGuid, option); + } + + private static string GetKnownFolderPath(string folderGuid, SpecialFolderOption option) + { + Guid folderId = new Guid(folderGuid); + + string path; + int hr = Interop.Shell32.SHGetKnownFolderPath(folderId, (uint)option, IntPtr.Zero, out path); + if (hr != 0) // Not S_OK + { + return string.Empty; + } + + return path; + } } } diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Environment.WinRT.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Environment.WinRT.cs new file mode 100644 index 0000000000..bf55d20f97 --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Environment.WinRT.cs @@ -0,0 +1,138 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.Foundation.Metadata; +using Windows.Storage; +using System.IO; + +namespace System +{ + public static partial class Environment + { + private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) + { + // For testing we'll fall back if the needed APIs aren't present. + // + // We're not honoring the special folder options (noverify/create) for a few reasons. One, most of the + // folders always exist (e.g. it is moot). Two, most locations are inaccessible from an appcontainer + // currently - making it impossible to answer the question of existence or create if necessary. Thirdly, + // the Win32 API would create these folders with very specific ACLs, which even in the cases we can create + // are a significant compat risk (trying to replicate internal Windows behavior- it is documented that they + // set specific ACLs, but not which ones). + if (ApiInformation.IsTypePresent("Windows.Storage.UserDataPaths")) + { + return GetFolderPathCoreCurrent(folder); + } + else + { + return GetFolderPathCoreFallBack(folder); + } + } + + private static string GetFolderPathCoreCurrent(SpecialFolder folder) + { + // While all of these give back real paths, most of them are not accessible + // from an appcontainer currently (they will give access denied) + switch (folder) + { + case SpecialFolder.ApplicationData: + return UserDataPaths.GetDefault().RoamingAppData; + case SpecialFolder.CommonApplicationData: + return AppDataPaths.GetDefault().ProgramData; + case SpecialFolder.LocalApplicationData: + return AppDataPaths.GetDefault().LocalAppData; + case SpecialFolder.Cookies: + return AppDataPaths.GetDefault().Cookies; + case SpecialFolder.Desktop: + return AppDataPaths.GetDefault().Desktop; + case SpecialFolder.Favorites: + return AppDataPaths.GetDefault().Favorites; + case SpecialFolder.History: + return AppDataPaths.GetDefault().History; + case SpecialFolder.InternetCache: + return AppDataPaths.GetDefault().InternetCache; + case SpecialFolder.MyMusic: + return UserDataPaths.GetDefault().Music; + case SpecialFolder.MyPictures: + return UserDataPaths.GetDefault().Pictures; + case SpecialFolder.MyVideos: + return UserDataPaths.GetDefault().Videos; + case SpecialFolder.Recent: + return UserDataPaths.GetDefault().Recent; + case SpecialFolder.System: + return SystemDataPaths.GetDefault().System; + case SpecialFolder.Templates: + return UserDataPaths.GetDefault().Templates; + case SpecialFolder.DesktopDirectory: + return UserDataPaths.GetDefault().Desktop; + case SpecialFolder.Personal: + return UserDataPaths.GetDefault().Documents; + case SpecialFolder.CommonDocuments: + return SystemDataPaths.GetDefault().PublicDocuments; + case SpecialFolder.CommonMusic: + return SystemDataPaths.GetDefault().PublicMusic; + case SpecialFolder.CommonPictures: + return SystemDataPaths.GetDefault().PublicPictures; + case SpecialFolder.CommonDesktopDirectory: + return SystemDataPaths.GetDefault().PublicDesktop; + case SpecialFolder.CommonVideos: + return SystemDataPaths.GetDefault().PublicVideos; + case SpecialFolder.UserProfile: + return UserDataPaths.GetDefault().Profile; + case SpecialFolder.SystemX86: + return SystemDataPaths.GetDefault().SystemX86; + case SpecialFolder.Windows: + return SystemDataPaths.GetDefault().Windows; + + // The following aren't available on WinRT. Our default behavior + // is string.Empty for paths that aren't available. + // + // case SpecialFolder.Programs: + // case SpecialFolder.MyComputer: + // case SpecialFolder.SendTo: + // case SpecialFolder.StartMenu: + // case SpecialFolder.Startup: + // case SpecialFolder.ProgramFiles: + // case SpecialFolder.CommonProgramFiles: + // case SpecialFolder.AdminTools: + // case SpecialFolder.CDBurning: + // case SpecialFolder.CommonAdminTools: + // case SpecialFolder.CommonOemLinks: + // case SpecialFolder.CommonStartMenu: + // case SpecialFolder.CommonPrograms: + // case SpecialFolder.CommonStartup: + // case SpecialFolder.CommonTemplates: + // case SpecialFolder.Fonts: + // case SpecialFolder.NetworkShortcuts: + // case SpecialFolder.PrinterShortcuts: + // case SpecialFolder.CommonProgramFilesX86: + // case SpecialFolder.ProgramFilesX86: + // case SpecialFolder.Resources: + // case SpecialFolder.LocalizedResources: + + default: + return string.Empty; + } + } + + private static string GetFolderPathCoreFallBack(SpecialFolder folder) + { + // For testing without the new WinRT APIs. We cannot use Win32 APIs for + // special folders as they are not in the WACK. + switch (folder) + { + case SpecialFolder.ApplicationData: + return ApplicationData.Current.RoamingFolder?.Path; + case SpecialFolder.LocalApplicationData: + return ApplicationData.Current.LocalFolder?.Path; + case SpecialFolder.System: + return SystemDirectory; + case SpecialFolder.Windows: + return Path.GetDirectoryName(SystemDirectory); + default: + return string.Empty; + } + } + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Windows.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Windows.cs index c4781e2f14..72103c01c4 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Windows.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Environment.Windows.cs @@ -120,182 +120,6 @@ namespace System return StringBuilderCache.GetStringAndRelease(result); } - private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) - { - // We're using SHGetKnownFolderPath instead of SHGetFolderPath as SHGetFolderPath is - // capped at MAX_PATH. - // - // Because we validate both of the input enums we shouldn't have to care about CSIDL and flag - // definitions we haven't mapped. If we remove or loosen the checks we'd have to account - // for mapping here (this includes tweaking as SHGetFolderPath would do). - // - // The only SpecialFolderOption defines we have are equivalent to KnownFolderFlags. - - string folderGuid; - - switch (folder) - { - case SpecialFolder.ApplicationData: - folderGuid = Interop.Shell32.KnownFolders.RoamingAppData; - break; - case SpecialFolder.CommonApplicationData: - folderGuid = Interop.Shell32.KnownFolders.ProgramData; - break; - case SpecialFolder.LocalApplicationData: - folderGuid = Interop.Shell32.KnownFolders.LocalAppData; - break; - case SpecialFolder.Cookies: - folderGuid = Interop.Shell32.KnownFolders.Cookies; - break; - case SpecialFolder.Desktop: - folderGuid = Interop.Shell32.KnownFolders.Desktop; - break; - case SpecialFolder.Favorites: - folderGuid = Interop.Shell32.KnownFolders.Favorites; - break; - case SpecialFolder.History: - folderGuid = Interop.Shell32.KnownFolders.History; - break; - case SpecialFolder.InternetCache: - folderGuid = Interop.Shell32.KnownFolders.InternetCache; - break; - case SpecialFolder.Programs: - folderGuid = Interop.Shell32.KnownFolders.Programs; - break; - case SpecialFolder.MyComputer: - folderGuid = Interop.Shell32.KnownFolders.ComputerFolder; - break; - case SpecialFolder.MyMusic: - folderGuid = Interop.Shell32.KnownFolders.Music; - break; - case SpecialFolder.MyPictures: - folderGuid = Interop.Shell32.KnownFolders.Pictures; - break; - case SpecialFolder.MyVideos: - folderGuid = Interop.Shell32.KnownFolders.Videos; - break; - case SpecialFolder.Recent: - folderGuid = Interop.Shell32.KnownFolders.Recent; - break; - case SpecialFolder.SendTo: - folderGuid = Interop.Shell32.KnownFolders.SendTo; - break; - case SpecialFolder.StartMenu: - folderGuid = Interop.Shell32.KnownFolders.StartMenu; - break; - case SpecialFolder.Startup: - folderGuid = Interop.Shell32.KnownFolders.Startup; - break; - case SpecialFolder.System: - folderGuid = Interop.Shell32.KnownFolders.System; - break; - case SpecialFolder.Templates: - folderGuid = Interop.Shell32.KnownFolders.Templates; - break; - case SpecialFolder.DesktopDirectory: - folderGuid = Interop.Shell32.KnownFolders.Desktop; - break; - case SpecialFolder.Personal: - // Same as Personal - // case SpecialFolder.MyDocuments: - folderGuid = Interop.Shell32.KnownFolders.Documents; - break; - case SpecialFolder.ProgramFiles: - folderGuid = Interop.Shell32.KnownFolders.ProgramFiles; - break; - case SpecialFolder.CommonProgramFiles: - folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommon; - break; - case SpecialFolder.AdminTools: - folderGuid = Interop.Shell32.KnownFolders.AdminTools; - break; - case SpecialFolder.CDBurning: - folderGuid = Interop.Shell32.KnownFolders.CDBurning; - break; - case SpecialFolder.CommonAdminTools: - folderGuid = Interop.Shell32.KnownFolders.CommonAdminTools; - break; - case SpecialFolder.CommonDocuments: - folderGuid = Interop.Shell32.KnownFolders.PublicDocuments; - break; - case SpecialFolder.CommonMusic: - folderGuid = Interop.Shell32.KnownFolders.PublicMusic; - break; - case SpecialFolder.CommonOemLinks: - folderGuid = Interop.Shell32.KnownFolders.CommonOEMLinks; - break; - case SpecialFolder.CommonPictures: - folderGuid = Interop.Shell32.KnownFolders.PublicPictures; - break; - case SpecialFolder.CommonStartMenu: - folderGuid = Interop.Shell32.KnownFolders.CommonStartMenu; - break; - case SpecialFolder.CommonPrograms: - folderGuid = Interop.Shell32.KnownFolders.CommonPrograms; - break; - case SpecialFolder.CommonStartup: - folderGuid = Interop.Shell32.KnownFolders.CommonStartup; - break; - case SpecialFolder.CommonDesktopDirectory: - folderGuid = Interop.Shell32.KnownFolders.PublicDesktop; - break; - case SpecialFolder.CommonTemplates: - folderGuid = Interop.Shell32.KnownFolders.CommonTemplates; - break; - case SpecialFolder.CommonVideos: - folderGuid = Interop.Shell32.KnownFolders.PublicVideos; - break; - case SpecialFolder.Fonts: - folderGuid = Interop.Shell32.KnownFolders.Fonts; - break; - case SpecialFolder.NetworkShortcuts: - folderGuid = Interop.Shell32.KnownFolders.NetHood; - break; - case SpecialFolder.PrinterShortcuts: - folderGuid = Interop.Shell32.KnownFolders.PrintersFolder; - break; - case SpecialFolder.UserProfile: - folderGuid = Interop.Shell32.KnownFolders.Profile; - break; - case SpecialFolder.CommonProgramFilesX86: - folderGuid = Interop.Shell32.KnownFolders.ProgramFilesCommonX86; - break; - case SpecialFolder.ProgramFilesX86: - folderGuid = Interop.Shell32.KnownFolders.ProgramFilesX86; - break; - case SpecialFolder.Resources: - folderGuid = Interop.Shell32.KnownFolders.ResourceDir; - break; - case SpecialFolder.LocalizedResources: - folderGuid = Interop.Shell32.KnownFolders.LocalizedResourcesDir; - break; - case SpecialFolder.SystemX86: - folderGuid = Interop.Shell32.KnownFolders.SystemX86; - break; - case SpecialFolder.Windows: - folderGuid = Interop.Shell32.KnownFolders.Windows; - break; - default: - return string.Empty; - } - - return GetKnownFolderPath(folderGuid, option); - } - - private static string GetKnownFolderPath(string folderGuid, SpecialFolderOption option) - { - Guid folderId = new Guid(folderGuid); - - string path; - int hr = Interop.Shell32.SHGetKnownFolderPath(folderId, (uint)option, IntPtr.Zero, out path); - if (hr != 0) // Not S_OK - { - return string.Empty; - } - - return path; - } - private static bool Is64BitOperatingSystemWhen32BitProcess { get @@ -389,13 +213,22 @@ namespace System { get { - StringBuilder sb = StringBuilderCache.Acquire(PathInternal.MaxShortPath); - if (Interop.Kernel32.GetSystemDirectoryW(sb, PathInternal.MaxShortPath) == 0) + // The path will likely be under 32 characters, e.g. C:\Windows\system32 + Span buffer = stackalloc char[32]; + int requiredSize = Interop.Kernel32.GetSystemDirectoryW(buffer); + + if (requiredSize > buffer.Length) + { + buffer = new char[requiredSize]; + requiredSize = Interop.Kernel32.GetSystemDirectoryW(buffer); + } + + if (requiredSize == 0) { - StringBuilderCache.Release(sb); throw Win32Marshal.GetExceptionForLastWin32Error(); } - return StringBuilderCache.GetStringAndRelease(sb); + + return new string(buffer.Slice(0, requiredSize)); } } diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/BufferedStream.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/BufferedStream.cs index 4c88123687..212f821186 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/BufferedStream.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/BufferedStream.cs @@ -430,8 +430,6 @@ namespace System.IO if (readbytes == 0) return 0; - Debug.Assert(readbytes > 0); - if (readbytes > count) readbytes = count; Buffer.BlockCopy(_buffer, _readPos, array, offset, readbytes); @@ -440,6 +438,19 @@ namespace System.IO return readbytes; } + private int ReadFromBuffer(Span destination) + { + int readbytes = Math.Min(_readLen - _readPos, destination.Length); + Debug.Assert(readbytes >= 0); + if (readbytes > 0) + { + bool copied = new Span(_buffer, _readPos, readbytes).TryCopyTo(destination); + Debug.Assert(copied); + _readPos += readbytes; + } + return readbytes; + } + private int ReadFromBuffer(Byte[] array, int offset, int count, out Exception error) { try @@ -518,6 +529,51 @@ namespace System.IO return bytesFromBuffer + alreadySatisfied; } + public override int Read(Span destination) + { + EnsureNotClosed(); + EnsureCanRead(); + + // Try to read from the buffer. + int bytesFromBuffer = ReadFromBuffer(destination); + if (bytesFromBuffer == destination.Length) + { + // We got as many bytes as were asked for; we're done. + return bytesFromBuffer; + } + + // We didn't get as many bytes as were asked for from the buffer, so try filling the buffer once. + + if (bytesFromBuffer > 0) + { + destination = destination.Slice(bytesFromBuffer); + } + + // The read buffer must now be empty. + Debug.Assert(_readLen == _readPos); + _readPos = _readLen = 0; + + // If there was anything in the write buffer, clear it. + if (_writePos > 0) + { + FlushWrite(); + } + + if (destination.Length >= _bufferSize) + { + // If the requested read is larger than buffer size, avoid the buffer and just read + // directly into the destination. + return _stream.Read(destination) + bytesFromBuffer; + } + else + { + // Otherwise, fill the buffer, then read from that. + EnsureBufferAllocated(); + _readLen = _stream.Read(_buffer, 0, _bufferSize); + return ReadFromBuffer(destination) + bytesFromBuffer; + } + } + private Task LastSyncCompletedReadTask(int val) { Task t = _lastSyncCompletedReadTask; @@ -533,7 +589,6 @@ namespace System.IO public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { - if (buffer == null) throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer); if (offset < 0) @@ -589,26 +644,58 @@ namespace System.IO } // Delegate to the async implementation. - return ReadFromUnderlyingStreamAsync(buffer, offset + bytesFromBuffer, count - bytesFromBuffer, cancellationToken, - bytesFromBuffer, semaphoreLockTask); + return ReadFromUnderlyingStreamAsync( + new Memory(buffer, offset + bytesFromBuffer, count - bytesFromBuffer), + cancellationToken, bytesFromBuffer, semaphoreLockTask).AsTask(); + } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) + { + if (cancellationToken.IsCancellationRequested) + { + return new ValueTask(Task.FromCanceled(cancellationToken)); + } + + EnsureNotClosed(); + EnsureCanRead(); + + int bytesFromBuffer = 0; + SemaphoreSlim sem = LazyEnsureAsyncActiveSemaphoreInitialized(); + Task semaphoreLockTask = sem.WaitAsync(); + if (semaphoreLockTask.IsCompletedSuccessfully) + { + bool completeSynchronously = true; + try + { + bytesFromBuffer = ReadFromBuffer(destination.Span); + completeSynchronously = bytesFromBuffer == destination.Length; + if (completeSynchronously) + { + // If we satisfied enough data from the buffer, we can complete synchronously. + return new ValueTask(bytesFromBuffer); + } + } + finally + { + if (completeSynchronously) // if this is FALSE, we will be entering ReadFromUnderlyingStreamAsync and releasing there. + { + sem.Release(); + } + } + } + + // Delegate to the async implementation. + return ReadFromUnderlyingStreamAsync(destination.Slice(bytesFromBuffer), cancellationToken, bytesFromBuffer, semaphoreLockTask); } /// BufferedStream should be as thin a wrapper as possible. We want ReadAsync to delegate to /// ReadAsync of the underlying _stream rather than calling the base Stream which implements the one in terms of the other. /// This allows BufferedStream to affect the semantics of the stream it wraps as little as possible. /// -2 if _bufferSize was set to 0 while waiting on the semaphore; otherwise num of bytes read. - private async Task ReadFromUnderlyingStreamAsync(byte[] array, int offset, int count, - CancellationToken cancellationToken, - int bytesAlreadySatisfied, - Task semaphoreLockTask) + private async ValueTask ReadFromUnderlyingStreamAsync( + Memory buffer, CancellationToken cancellationToken, int bytesAlreadySatisfied, Task semaphoreLockTask) { - // Same conditions validated with exceptions in ReadAsync: - // (These should be Debug.Requires(..) but that method had some issues in async methods; using Assert(..) for now.) - Debug.Assert(array != null); - Debug.Assert(offset >= 0); - Debug.Assert(count >= 0); - Debug.Assert(array.Length - offset >= count); Debug.Assert(_stream != null); Debug.Assert(_stream.CanRead); Debug.Assert(_bufferSize > 0); @@ -618,17 +705,17 @@ namespace System.IO await semaphoreLockTask.ConfigureAwait(false); try { - // The buffer might have been changed by another async task while we were waiting on the semaphore. // Check it now again. - int bytesFromBuffer = ReadFromBuffer(array, offset, count); - if (bytesFromBuffer == count) + int bytesFromBuffer = ReadFromBuffer(buffer.Span); + if (bytesFromBuffer == buffer.Length) + { return bytesAlreadySatisfied + bytesFromBuffer; + } if (bytesFromBuffer > 0) { - count -= bytesFromBuffer; - offset += bytesFromBuffer; + buffer = buffer.Slice(bytesFromBuffer); bytesAlreadySatisfied += bytesFromBuffer; } @@ -637,21 +724,22 @@ namespace System.IO // If there was anything in the write buffer, clear it. if (_writePos > 0) + { await FlushWriteAsync(cancellationToken).ConfigureAwait(false); // no Begin-End read version for Flush. Use Async. + } // If the requested read is larger than buffer size, avoid the buffer and still use a single read: - if (count >= _bufferSize) + if (buffer.Length >= _bufferSize) { - return bytesAlreadySatisfied + await _stream.ReadAsync(array, offset, count, cancellationToken).ConfigureAwait(false); + return bytesAlreadySatisfied + await _stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false); } // Ok. We can fill the buffer: EnsureBufferAllocated(); _readLen = await _stream.ReadAsync(_buffer, 0, _bufferSize, cancellationToken).ConfigureAwait(false); - bytesFromBuffer = ReadFromBuffer(array, offset, count); + bytesFromBuffer = ReadFromBuffer(buffer.Span); return bytesAlreadySatisfied + bytesFromBuffer; - } finally { @@ -713,6 +801,18 @@ namespace System.IO offset += bytesToWrite; } + private int WriteToBuffer(ReadOnlySpan source) + { + int bytesToWrite = Math.Min(_bufferSize - _writePos, source.Length); + if (bytesToWrite > 0) + { + EnsureBufferAllocated(); + source.Slice(0, bytesToWrite).CopyTo(new Span(_buffer, _writePos, bytesToWrite)); + _writePos += bytesToWrite; + } + return bytesToWrite; + } + private void WriteToBuffer(byte[] array, ref int offset, ref int count, out Exception error) { try @@ -726,7 +826,6 @@ namespace System.IO } } - public override void Write(byte[] array, int offset, int count) { if (array == null) @@ -863,10 +962,80 @@ namespace System.IO } } + public override void Write(ReadOnlySpan source) + { + EnsureNotClosed(); + EnsureCanWrite(); + + if (_writePos == 0) + { + ClearReadBufferBeforeWrite(); + } + Debug.Assert(_writePos < _bufferSize, $"Expected {_writePos} < {_bufferSize}"); + + int totalUserbytes; + bool useBuffer; + checked + { + // We do not expect buffer sizes big enough for an overflow, but if it happens, lets fail early: + totalUserbytes = _writePos + source.Length; + useBuffer = (totalUserbytes + source.Length < (_bufferSize + _bufferSize)); + } + + if (useBuffer) + { + // Copy as much data to the buffer as will fit. If there's still room in the buffer, + // everything must have fit. + int bytesWritten = WriteToBuffer(source); + if (_writePos < _bufferSize) + { + Debug.Assert(bytesWritten == source.Length); + return; + } + source = source.Slice(bytesWritten); + + Debug.Assert(_writePos == _bufferSize); + Debug.Assert(_buffer != null); + + // Output the buffer to the underlying stream. + _stream.Write(_buffer, 0, _writePos); + _writePos = 0; + + // Now write the remainder. It must fit, as we're only on this path if that's true. + bytesWritten = WriteToBuffer(source); + Debug.Assert(bytesWritten == source.Length); + + Debug.Assert(_writePos < _bufferSize); + } + else // skip the buffer + { + // Flush anything existing in the buffer. + if (_writePos > 0) + { + Debug.Assert(_buffer != null); + Debug.Assert(totalUserbytes >= _bufferSize); + + // Try avoiding extra write to underlying stream by combining previously buffered data with current user data: + if (totalUserbytes <= (_bufferSize + _bufferSize) && totalUserbytes <= MaxShadowBufferSize) + { + EnsureShadowBufferAllocated(); + source.CopyTo(new Span(_buffer, _writePos, source.Length)); + _stream.Write(_buffer, 0, totalUserbytes); + _writePos = 0; + return; + } + + _stream.Write(_buffer, 0, _writePos); + _writePos = 0; + } + + // Write out user data. + _stream.Write(source); + } + } public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { - if (buffer == null) throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer); if (offset < 0) @@ -876,16 +1045,21 @@ namespace System.IO if (buffer.Length - offset < count) throw new ArgumentException(SR.Argument_InvalidOffLen); + return WriteAsync(new ReadOnlyMemory(buffer, offset, count), cancellationToken); + } + + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) + { // Fast path check for cancellation already requested if (cancellationToken.IsCancellationRequested) + { return Task.FromCanceled(cancellationToken); + } EnsureNotClosed(); EnsureCanWrite(); - // Try to satisfy the request from the buffer synchronously. But still need a sem-lock in case that another - // Async IO Task accesses the buffer concurrently. If we fail to acquire the lock without waiting, make this - // an Async operation. + // Try to satisfy the request from the buffer synchronously. SemaphoreSlim sem = LazyEnsureAsyncActiveSemaphoreInitialized(); Task semaphoreLockTask = sem.WaitAsync(); if (semaphoreLockTask.IsCompletedSuccessfully) @@ -893,25 +1067,20 @@ namespace System.IO bool completeSynchronously = true; try { - if (_writePos == 0) + { ClearReadBufferBeforeWrite(); + } Debug.Assert(_writePos < _bufferSize); // If the write completely fits into the buffer, we can complete synchronously: - completeSynchronously = (count < _bufferSize - _writePos); - + completeSynchronously = source.Length < _bufferSize - _writePos; if (completeSynchronously) { - - Exception error; - WriteToBuffer(buffer, ref offset, ref count, out error); - Debug.Assert(count == 0); - - return (error == null) - ? Task.CompletedTask - : Task.FromException(error); + int bytesWritten = WriteToBuffer(source.Span); + Debug.Assert(bytesWritten == source.Length); + return Task.CompletedTask; } } finally @@ -922,23 +1091,17 @@ namespace System.IO } // Delegate to the async implementation. - return WriteToUnderlyingStreamAsync(buffer, offset, count, cancellationToken, semaphoreLockTask); + return WriteToUnderlyingStreamAsync(source, cancellationToken, semaphoreLockTask); } - /// BufferedStream should be as thin a wrapper as possible. We want WriteAsync to delegate to /// WriteAsync of the underlying _stream rather than calling the base Stream which implements the one /// in terms of the other. This allows BufferedStream to affect the semantics of the stream it wraps as /// little as possible. /// - private async Task WriteToUnderlyingStreamAsync(byte[] array, int offset, int count, - CancellationToken cancellationToken, - Task semaphoreLockTask) + private async Task WriteToUnderlyingStreamAsync( + ReadOnlyMemory source, CancellationToken cancellationToken, Task semaphoreLockTask) { - Debug.Assert(array != null); - Debug.Assert(offset >= 0); - Debug.Assert(count >= 0); - Debug.Assert(array.Length - offset >= count); Debug.Assert(_stream != null); Debug.Assert(_stream.CanWrite); Debug.Assert(_bufferSize > 0); @@ -949,7 +1112,6 @@ namespace System.IO await semaphoreLockTask.ConfigureAwait(false); try { - // The buffer might have been changed by another async task while we were waiting on the semaphore. // However, note that if we recalculate the sync completion condition to TRUE, then useBuffer will also be TRUE. @@ -959,37 +1121,37 @@ namespace System.IO int totalUserBytes; bool useBuffer; checked - { // We do not expect buffer sizes big enough for an overflow, but if it happens, lets fail early: - totalUserBytes = _writePos + count; - useBuffer = (totalUserBytes + count < (_bufferSize + _bufferSize)); + { + // We do not expect buffer sizes big enough for an overflow, but if it happens, lets fail early: + totalUserBytes = _writePos + source.Length; + useBuffer = (totalUserBytes + source.Length < (_bufferSize + _bufferSize)); } if (useBuffer) { - WriteToBuffer(array, ref offset, ref count); + source = source.Slice(WriteToBuffer(source.Span)); if (_writePos < _bufferSize) { - Debug.Assert(count == 0); + Debug.Assert(source.Length == 0); return; } - Debug.Assert(count >= 0); + Debug.Assert(source.Length >= 0); Debug.Assert(_writePos == _bufferSize); Debug.Assert(_buffer != null); - await _stream.WriteAsync(_buffer, 0, _writePos, cancellationToken).ConfigureAwait(false); _writePos = 0; - WriteToBuffer(array, ref offset, ref count); + int bytesWritten = WriteToBuffer(source.Span); + Debug.Assert(bytesWritten == source.Length); - Debug.Assert(count == 0); Debug.Assert(_writePos < _bufferSize); } - else - { // if (!useBuffer) + else // !useBuffer + { // Write out the buffer if necessary. if (_writePos > 0) { @@ -1000,7 +1162,7 @@ namespace System.IO if (totalUserBytes <= (_bufferSize + _bufferSize) && totalUserBytes <= MaxShadowBufferSize) { EnsureShadowBufferAllocated(); - Buffer.BlockCopy(array, offset, _buffer, _writePos, count); + source.Span.CopyTo(new Span(_buffer, _writePos, source.Length)); await _stream.WriteAsync(_buffer, 0, totalUserBytes, cancellationToken).ConfigureAwait(false); _writePos = 0; @@ -1012,7 +1174,7 @@ namespace System.IO } // Write out user data. - await _stream.WriteAsync(array, offset, count, cancellationToken).ConfigureAwait(false); + await _stream.WriteAsync(source, cancellationToken).ConfigureAwait(false); } } finally @@ -1110,6 +1272,30 @@ namespace System.IO _stream.SetLength(value); } + public override void CopyTo(Stream destination, int bufferSize) + { + StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize); + + int readBytes = _readLen - _readPos; + Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); + + if (readBytes > 0) + { + // If there's any read data in the buffer, write it all to the destination stream. + Debug.Assert(_writePos == 0, "Write buffer must be empty if there's data in the read buffer"); + destination.Write(_buffer, _readPos, readBytes); + _readPos = _readLen = 0; + } + else if (_writePos > 0) + { + // If there's write data in the buffer, flush it back to the underlying stream, as does ReadAsync. + FlushWrite(); + } + + // Our buffer is now clear. Copy data directly from the source stream to the destination stream. + _stream.CopyTo(destination, bufferSize); + } + public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) { StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize); @@ -1126,6 +1312,7 @@ namespace System.IO { int readBytes = _readLen - _readPos; Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); + if (readBytes > 0) { // If there's any read data in the buffer, write it all to the destination stream. diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs index 0493600c2a..f8b1baaafd 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs @@ -19,13 +19,6 @@ namespace System.IO // StreamReader.Null is threadsafe. public new static readonly StreamReader Null = new NullStreamReader(); - // Encoding.GetPreamble() always allocates and returns a new byte[] array for - // encodings that have a preamble. - // We can avoid repeated allocations for the default and commonly used Encoding.UTF8 - // encoding by using our own private cached instance of the UTF8 preamble. - // This is lazily allocated the first time it is used. - private static byte[] s_utf8Preamble; - // Using a 1K byte buffer and a 4K FileStream buffer works out pretty well // perf-wise. On even a 40 MB text file, any perf loss by using a 4K // buffer is negated by the win of allocating a smaller byte[], which @@ -40,7 +33,6 @@ namespace System.IO private Decoder _decoder; private byte[] _byteBuffer; private char[] _charBuffer; - private byte[] _preamble; // Encoding's preamble, which identifies this encoding. private int _charPos; private int _charLen; // Record the number of valid bytes in the byteBuffer, for a few checks. @@ -78,7 +70,6 @@ namespace System.IO // We don't guarantee thread safety on StreamReader, but we should at // least prevent users from trying to read anything while an Async // read from the same thread is in progress. - [NonSerialized] private volatile Task _asyncReadTask; private void CheckAsyncTaskInProgress() @@ -208,21 +199,7 @@ namespace System.IO _byteLen = 0; _bytePos = 0; _detectEncoding = detectEncodingFromByteOrderMarks; - - // Encoding.GetPreamble() always allocates and returns a new byte[] array for - // encodings that have a preamble. - // We can avoid repeated allocations for the default and commonly used Encoding.UTF8 - // encoding by using our own private cached instance of the UTF8 preamble. - // We specifically look for Encoding.UTF8 because we know it has a preamble, - // whereas other instances of UTF8Encoding may not have a preamble enabled, and - // there's no public way to tell if the preamble is enabled for an instance other - // than calling GetPreamble(), which we're trying to avoid. - // This means that other instances of UTF8Encoding are excluded from this optimization. - _preamble = object.ReferenceEquals(encoding, Encoding.UTF8) ? - (s_utf8Preamble ?? (s_utf8Preamble = encoding.GetPreamble())) : - encoding.GetPreamble(); - - _checkPreamble = (_preamble.Length > 0); + _checkPreamble = encoding.Preamble.Length > 0; _isBlocked = false; _closable = !leaveOpen; } @@ -562,12 +539,14 @@ namespace System.IO return _checkPreamble; } - Debug.Assert(_bytePos <= _preamble.Length, "_compressPreamble was called with the current bytePos greater than the preamble buffer length. Are two threads using this StreamReader at the same time?"); - int len = (_byteLen >= (_preamble.Length)) ? (_preamble.Length - _bytePos) : (_byteLen - _bytePos); + ReadOnlySpan preamble = _encoding.Preamble; + + Debug.Assert(_bytePos <= preamble.Length, "_compressPreamble was called with the current bytePos greater than the preamble buffer length. Are two threads using this StreamReader at the same time?"); + int len = (_byteLen >= (preamble.Length)) ? (preamble.Length - _bytePos) : (_byteLen - _bytePos); for (int i = 0; i < len; i++, _bytePos++) { - if (_byteBuffer[_bytePos] != _preamble[_bytePos]) + if (_byteBuffer[_bytePos] != preamble[_bytePos]) { _bytePos = 0; _checkPreamble = false; @@ -575,14 +554,14 @@ namespace System.IO } } - Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); + Debug.Assert(_bytePos <= preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); if (_checkPreamble) { - if (_bytePos == _preamble.Length) + if (_bytePos == preamble.Length) { // We have a match - CompressBuffer(_preamble.Length); + CompressBuffer(preamble.Length); _bytePos = 0; _checkPreamble = false; _detectEncoding = false; @@ -606,7 +585,7 @@ namespace System.IO { if (_checkPreamble) { - Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); + Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos); Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class."); @@ -703,7 +682,7 @@ namespace System.IO if (_checkPreamble) { - Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); + Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); int len = _stream.Read(_byteBuffer, _bytePos, _byteBuffer.Length - _bytePos); Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class."); @@ -1060,7 +1039,7 @@ namespace System.IO if (_checkPreamble) { - Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); + Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); int tmpBytePos = _bytePos; int len = await tmpStream.ReadAsync(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos).ConfigureAwait(false); Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class."); @@ -1240,7 +1219,7 @@ namespace System.IO { if (_checkPreamble) { - Debug.Assert(_bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); + Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?"); int tmpBytePos = _bytePos; int len = await tmpStream.ReadAsync(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos).ConfigureAwait(false); Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class."); diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs index 79397d559e..2f902b2110 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs @@ -43,7 +43,6 @@ namespace System.IO // We don't guarantee thread safety on StreamWriter, but we should at // least prevent users from trying to write anything while an Async // write from the same thread is in progress. - [NonSerialized] private volatile Task _asyncWriteTask; private void CheckAsyncTaskInProgress() @@ -248,10 +247,10 @@ namespace System.IO if (!_haveWrittenPreamble) { _haveWrittenPreamble = true; - byte[] preamble = _encoding.GetPreamble(); + ReadOnlySpan preamble = _encoding.Preamble; if (preamble.Length > 0) { - _stream.Write(preamble, 0, preamble.Length); + _stream.Write(preamble); } } diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringReader.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringReader.cs index e76ec4f2e2..15a881c262 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringReader.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringReader.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Contracts; +using System.Threading; using System.Threading.Tasks; namespace System.IO @@ -118,6 +119,37 @@ namespace System.IO return n; } + public override int Read(Span destination) + { + if (GetType() != typeof(StringReader)) + { + // This overload was added affter the Read(char[], ...) overload, and so in case + // a derived type may have overridden it, we need to delegate to it, which the base does. + return base.Read(destination); + } + + if (_s == null) + { + throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed); + } + + int n = _length - _pos; + if (n > 0) + { + if (n > destination.Length) + { + n = destination.Length; + } + + _s.AsReadOnlySpan().Slice(_pos, n).CopyTo(destination); + _pos += n; + } + + return n; + } + + public override int ReadBlock(Span destination) => Read(destination); + public override string ReadToEnd() { if (_s == null) @@ -210,6 +242,10 @@ namespace System.IO return Task.FromResult(ReadBlock(buffer, index, count)); } + public override ValueTask ReadBlockAsync(Memory destination, CancellationToken cancellationToken = default) => + cancellationToken.IsCancellationRequested ? new ValueTask(Task.FromCanceled(cancellationToken)) : + new ValueTask(ReadBlock(destination.Span)); + public override Task ReadAsync(char[] buffer, int index, int count) { if (buffer == null) @@ -227,6 +263,10 @@ namespace System.IO return Task.FromResult(Read(buffer, index, count)); } + + public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) => + cancellationToken.IsCancellationRequested ? new ValueTask(Task.FromCanceled(cancellationToken)) : + new ValueTask(Read(destination.Span)); #endregion } } diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs index c9d49ae505..41603ef090 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs @@ -2,8 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Text; using System.Globalization; +using System.Text; +using System.Threading; using System.Threading.Tasks; namespace System.IO @@ -125,6 +126,24 @@ namespace System.IO _sb.Append(buffer, index, count); } + public override void Write(ReadOnlySpan source) + { + if (GetType() != typeof(StringWriter)) + { + // This overload was added affter the Write(char[], ...) overload, and so in case + // a derived type may have overridden it, we need to delegate to it, which the base does. + base.Write(source); + return; + } + + if (!_isOpen) + { + throw new ObjectDisposedException(null, SR.ObjectDisposed_WriterClosed); + } + + _sb.Append(source); + } + // Writes a string to the underlying string buffer. If the given string is // null, nothing is written. // @@ -141,8 +160,27 @@ namespace System.IO } } + public override void WriteLine(ReadOnlySpan source) + { + if (GetType() != typeof(StringWriter)) + { + // This overload was added affter the WriteLine(char[], ...) overload, and so in case + // a derived type may have overridden it, we need to delegate to it, which the base does. + base.WriteLine(source); + return; + } + + if (!_isOpen) + { + throw new ObjectDisposedException(null, SR.ObjectDisposed_WriterClosed); + } + + _sb.Append(source); + WriteLine(); + } + #region Task based Async APIs - + public override Task WriteAsync(char value) { Write(value); @@ -161,6 +199,17 @@ namespace System.IO return Task.CompletedTask; } + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + if (cancellationToken.IsCancellationRequested) + { + return Task.FromCanceled(cancellationToken); + } + + Write(source.Span); + return Task.CompletedTask; + } + public override Task WriteLineAsync(char value) { WriteLine(value); @@ -179,6 +228,17 @@ namespace System.IO return Task.CompletedTask; } + public override Task WriteLineAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) + { + if (cancellationToken.IsCancellationRequested) + { + return Task.FromCanceled(cancellationToken); + } + + WriteLine(source.Span); + return Task.CompletedTask; + } + public override Task FlushAsync() { return Task.CompletedTask; diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextReader.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextReader.cs index c668a9e175..f3345fce09 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextReader.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextReader.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; +using System.Buffers; namespace System.IO { @@ -101,6 +102,30 @@ namespace System.IO return n; } + // Reads a span of characters. This method will read up to + // count characters from this TextReader into the + // span of characters Returns the actual number of characters read. + // + public virtual int Read(Span destination) + { + char[] buffer = ArrayPool.Shared.Rent(destination.Length); + + try + { + int numRead = Read(buffer, 0, destination.Length); + if ((uint)numRead > destination.Length) + { + throw new IOException(SR.IO_InvalidReadLength); + } + new Span(buffer, 0, numRead).CopyTo(destination); + return numRead; + } + finally + { + ArrayPool.Shared.Return(buffer); + } + } + // Reads all characters from the current position to the end of the // TextReader, and returns them as one string. public virtual string ReadToEnd() @@ -128,6 +153,29 @@ namespace System.IO return n; } + // Blocking version of read for span of characters. Returns only when count + // characters have been read or the end of the file was reached. + // + public virtual int ReadBlock(Span destination) + { + char[] buffer = ArrayPool.Shared.Rent(destination.Length); + + try + { + int numRead = ReadBlock(buffer, 0, destination.Length); + if ((uint)numRead > destination.Length) + { + throw new IOException(SR.IO_InvalidReadLength); + } + new Span(buffer, 0, numRead).CopyTo(destination); + return numRead; + } + finally + { + ArrayPool.Shared.Return(buffer); + } + } + // Reads a line. A line is defined as a sequence of characters followed by // a carriage return ('\r'), a line feed ('\n'), or a carriage return // immediately followed by a line feed. The resulting string does not @@ -200,6 +248,15 @@ namespace System.IO return ReadAsyncInternal(buffer, index, count); } + public virtual ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) => + new ValueTask(destination.TryGetArray(out ArraySegment array) ? + ReadAsync(array.Array, array.Offset, array.Count) : + Task.Factory.StartNew(state => + { + var t = (Tuple>)state; + return t.Item1.Read(t.Item2.Span); + }, Tuple.Create(this, destination), cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default)); + internal virtual Task ReadAsyncInternal(char[] buffer, int index, int count) { Debug.Assert(buffer != null); @@ -234,6 +291,15 @@ namespace System.IO return ReadBlockAsyncInternal(buffer, index, count); } + public virtual ValueTask ReadBlockAsync(Memory destination, CancellationToken cancellationToken = default(CancellationToken)) => + new ValueTask(destination.TryGetArray(out ArraySegment array) ? + ReadBlockAsync(array.Array, array.Offset, array.Count) : + Task.Factory.StartNew(state => + { + var t = (Tuple>)state; + return t.Item1.ReadBlock(t.Item2.Span); + }, Tuple.Create(this, destination), cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default)); + private async Task ReadBlockAsyncInternal(char[] buffer, int index, int count) { Debug.Assert(buffer != null); diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs b/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs index 956f849914..6960810565 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Globalization; using System.Threading.Tasks; using System.Runtime.CompilerServices; +using System.Buffers; namespace System.IO { @@ -162,6 +163,23 @@ namespace System.IO for (int i = 0; i < count; i++) Write(buffer[index + i]); } + // Writes a span of characters to the text stream. + // + public virtual void Write(ReadOnlySpan source) + { + char[] buffer = ArrayPool.Shared.Rent(source.Length); + + try + { + source.CopyTo(new Span(buffer)); + Write(buffer, 0, source.Length); + } + finally + { + ArrayPool.Shared.Return(buffer); + } + } + // Writes the text representation of a boolean to the text stream. This // method outputs either Boolean.TrueString or Boolean.FalseString. // @@ -329,6 +347,21 @@ namespace System.IO WriteLine(); } + public virtual void WriteLine(ReadOnlySpan source) + { + char[] buffer = ArrayPool.Shared.Rent(source.Length); + + try + { + source.CopyTo(new Span(buffer)); + WriteLine(buffer, 0, source.Length); + } + finally + { + ArrayPool.Shared.Return(buffer); + } + } + // Writes the text representation of a boolean followed by a line // terminator to the text stream. // @@ -512,6 +545,15 @@ namespace System.IO tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); } + public virtual Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) => + source.DangerousTryGetArray(out ArraySegment array) ? + WriteAsync(array.Array, array.Offset, array.Count) : + Task.Factory.StartNew(state => + { + var t = (Tuple>)state; + t.Item1.Write(t.Item2.Span); + }, Tuple.Create(this, source), cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); + public virtual Task WriteLineAsync(char value) { var tuple = new Tuple(this, value); @@ -555,6 +597,15 @@ namespace System.IO tuple, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); } + public virtual Task WriteLineAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) => + source.DangerousTryGetArray(out ArraySegment array) ? + WriteLineAsync(array.Array, array.Offset, array.Count) : + Task.Factory.StartNew(state => + { + var t = (Tuple>)state; + t.Item1.WriteLine(t.Item2.Span); + }, Tuple.Create(this, source), cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default); + public virtual Task WriteLineAsync() { return WriteAsync(CoreNewLine); diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs index 0ada5754e3..7ba7528be3 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs @@ -199,7 +199,7 @@ namespace System.Runtime.Versioning } try { - _version = new Version(value); + _version = Version.Parse(value); } catch (Exception e) { diff --git a/external/corefx/src/System.Runtime.Extensions/tests/Configurations.props b/external/corefx/src/System.Runtime.Extensions/tests/Configurations.props index 5055ec1f79..99659fc4c4 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/Configurations.props +++ b/external/corefx/src/System.Runtime.Extensions/tests/Configurations.props @@ -6,6 +6,7 @@ netcoreapp-Unix; netstandard-Windows_NT; netstandard-Unix; + uap-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Extensions/tests/Performance/Configurations.props b/external/corefx/src/System.Runtime.Extensions/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj b/external/corefx/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj index 24ff6e91aa..a7edd58b60 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj +++ b/external/corefx/src/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj @@ -17,7 +17,9 @@ - + + + @@ -31,14 +33,22 @@ + + + + + + + + @@ -93,9 +103,6 @@ Common\System\ShouldNotBeInvokedException.cs - - Common\System\PlatformDetection.cs - @@ -120,4 +127,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/AppDomainTests.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/AppDomainTests.cs index 402ba4c3e8..cf51f3cac9 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/AppDomainTests.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/AppDomainTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; +using System.Globalization; using System.IO; using System.Reflection; using System.Resources; @@ -608,6 +609,40 @@ namespace System.Tests }).Dispose(); } + [Fact] + public void AssemblyResolve_IsNotCalledForCoreLibResources() + { + RemoteInvoke(() => + { + bool assemblyResolveHandlerCalled = false; + AppDomain.CurrentDomain.AssemblyResolve += + (sender, e) => + { + // This implementation violates the contract. AssemblyResolve event handler is supposed to return an assembly + // that matches the requested identity and that is not the case here. + assemblyResolveHandlerCalled = true; + return typeof(AppDomainTests).Assembly; + }; + + CultureInfo previousUICulture = CultureInfo.CurrentUICulture; + CultureInfo.CurrentUICulture = new CultureInfo("de-CH"); + try + { + // The resource lookup for NullReferenceException (generally for CoreLib resources) should not raise the + // AssemblyResolve event because a misbehaving handler could cause an infinite recursion check and fail-fast to + // be triggered when the resource is not found, as the issue would repeat when reporting that error. + Assert.Throws(() => ((string)null).Contains("a")); + Assert.False(assemblyResolveHandlerCalled); + } + finally + { + CultureInfo.CurrentUICulture = previousUICulture; + } + + return SuccessExitCode; + }).Dispose(); + } + [Fact] [ActiveIssue(21680, TargetFrameworkMonikers.UapAot)] public void TypeResolve() diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.cs index e9cf828f04..55d20da4d1 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.cs @@ -108,17 +108,17 @@ namespace System.Tests [Fact] public static void DoubleToInt64Bits() { - Double input = 123456.3234; - Int64 result = BitConverter.DoubleToInt64Bits(input); + double input = 123456.3234; + long result = BitConverter.DoubleToInt64Bits(input); Assert.Equal(4683220267154373240L, result); - Double roundtripped = BitConverter.Int64BitsToDouble(result); + double roundtripped = BitConverter.Int64BitsToDouble(result); Assert.Equal(input, roundtripped); } [Fact] public static void RoundtripBoolean() { - Byte[] bytes = BitConverter.GetBytes(true); + byte[] bytes = BitConverter.GetBytes(true); Assert.Equal(1, bytes.Length); Assert.Equal(1, bytes[0]); Assert.True(BitConverter.ToBoolean(bytes, 0)); @@ -132,79 +132,79 @@ namespace System.Tests [Fact] public static void RoundtripChar() { - Char input = 'A'; - Byte[] expected = { 0x41, 0 }; + char input = 'A'; + byte[] expected = { 0x41, 0 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToChar, input, expected); } [Fact] public static void RoundtripDouble() { - Double input = 123456.3234; - Byte[] expected = { 0x78, 0x7a, 0xa5, 0x2c, 0x05, 0x24, 0xfe, 0x40 }; + double input = 123456.3234; + byte[] expected = { 0x78, 0x7a, 0xa5, 0x2c, 0x05, 0x24, 0xfe, 0x40 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToDouble, input, expected); } [Fact] public static void RoundtripSingle() { - Single input = 8392.34f; - Byte[] expected = { 0x5c, 0x21, 0x03, 0x46 }; + float input = 8392.34f; + byte[] expected = { 0x5c, 0x21, 0x03, 0x46 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToSingle, input, expected); } [Fact] public static void RoundtripInt16() { - Int16 input = 0x1234; - Byte[] expected = { 0x34, 0x12 }; + short input = 0x1234; + byte[] expected = { 0x34, 0x12 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToInt16, input, expected); } [Fact] public static void RoundtripInt32() { - Int32 input = 0x12345678; - Byte[] expected = { 0x78, 0x56, 0x34, 0x12 }; + int input = 0x12345678; + byte[] expected = { 0x78, 0x56, 0x34, 0x12 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToInt32, input, expected); } [Fact] public static void RoundtripInt64() { - Int64 input = 0x0123456789abcdef; - Byte[] expected = { 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01 }; + long input = 0x0123456789abcdef; + byte[] expected = { 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToInt64, input, expected); } [Fact] public static void RoundtripUInt16() { - UInt16 input = 0x1234; - Byte[] expected = { 0x34, 0x12 }; + ushort input = 0x1234; + byte[] expected = { 0x34, 0x12 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToUInt16, input, expected); } [Fact] public static void RoundtripUInt32() { - UInt32 input = 0x12345678; - Byte[] expected = { 0x78, 0x56, 0x34, 0x12 }; + uint input = 0x12345678; + byte[] expected = { 0x78, 0x56, 0x34, 0x12 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToUInt32, input, expected); } [Fact] public static void RoundtripUInt64() { - UInt64 input = 0x0123456789abcdef; - Byte[] expected = { 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01 }; + ulong input = 0x0123456789abcdef; + byte[] expected = { 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01 }; VerifyRoundtrip(BitConverter.GetBytes, BitConverter.ToUInt64, input, expected); } [Fact] public static void RoundtripString() { - Byte[] bytes = { 0x12, 0x34, 0x56, 0x78, 0x9a }; + byte[] bytes = { 0x12, 0x34, 0x56, 0x78, 0x9a }; Assert.Equal("12-34-56-78-9A", BitConverter.ToString(bytes)); Assert.Equal("56-78-9A", BitConverter.ToString(bytes, 2)); @@ -245,7 +245,7 @@ namespace System.Tests private static void VerifyRoundtrip(Func getBytes, Func convertBack, TInput input, Byte[] expectedBytes) { - Byte[] bytes = getBytes(input); + byte[] bytes = getBytes(input); Assert.Equal(expectedBytes.Length, bytes.Length); if (!BitConverter.IsLittleEndian) diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.netcoreapp.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.netcoreapp.cs index 0f1099858f..a903484486 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.netcoreapp.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverter.netcoreapp.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. @@ -11,11 +11,11 @@ namespace System.Tests [Fact] public static void SingleToInt32Bits() { - Single input = 12345.63f; - Int32 result = BitConverter.SingleToInt32Bits(input); + float input = 12345.63f; + int result = BitConverter.SingleToInt32Bits(input); Assert.Equal(1178658437, result); - Single roundtripped = BitConverter.Int32BitsToSingle(result); + float roundtripped = BitConverter.Int32BitsToSingle(result); Assert.Equal(input, roundtripped); } } -} +} \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterArray.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterArray.cs new file mode 100644 index 0000000000..7dca6318f0 --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterArray.cs @@ -0,0 +1,111 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Tests +{ + public class BitConverterArray : BitConverterBase + { + public override void ConvertFromBool(bool boolean, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(boolean)); + } + + public override void ConvertFromShort(short num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromChar(char character, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(character)); + } + + public override void ConvertFromInt(int num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromLong(long num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromUShort(ushort num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromUInt(uint num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromULong(ulong num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromFloat(float num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ConvertFromDouble(double num, byte[] expected) + { + Assert.Equal(expected, BitConverter.GetBytes(num)); + } + + public override void ToChar(int index, char expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToChar(byteArray, index)); + } + + public override void ToInt16(int index, short expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToInt16(byteArray, index)); + } + + public override void ToInt32(int expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToInt32(byteArray, 0)); + } + + public override void ToInt64(int index, long expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToInt64(byteArray, index)); + } + + public override void ToUInt16(int index, ushort expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToUInt16(byteArray, index)); + } + + public override void ToUInt32(int index, uint expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToUInt32(byteArray, index)); + } + + public override void ToUInt64(int index, ulong expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToUInt64(byteArray, index)); + } + + public override void ToSingle(int index, float expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToSingle(byteArray, index)); + } + + public override void ToDouble(int index, double expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToDouble(byteArray, index)); + } + + public override void ToBoolean(int index, bool expected, byte[] byteArray) + { + Assert.Equal(expected, BitConverter.ToBoolean(byteArray, index)); + } + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterBase.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterBase.cs new file mode 100644 index 0000000000..aacbb6d78e --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterBase.cs @@ -0,0 +1,349 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System.Collections.Generic; + +namespace System.Tests +{ + public abstract class BitConverterBase + { + + [Theory] + [InlineData(true, new byte[] { 0x01 })] + [InlineData(false, new byte[] { 0x00 })] + public abstract void ConvertFromBool(bool boolean, byte[] expected); + + [Theory] + [InlineData((short)0, new byte[] { 0x00, 0x00 })] + [InlineData((short)-15, new byte[] { 0xF1, 0xFF })] + [InlineData((short)15, new byte[] { 0x0F, 0x00 })] + [InlineData((short)10000, new byte[] { 0x10, 0x27 })] + [InlineData((short)-10000, new byte[] { 0xF0, 0xD8 })] + [InlineData(short.MinValue, new byte[] { 0x00, 0x80 })] + [InlineData(short.MaxValue, new byte[] { 0xFF, 0x7F })] + public abstract void ConvertFromShort(short num, byte[] expected); + + [Theory] + [InlineData('A', new byte[] { 0x41, 0x00 })] + [InlineData('*', new byte[] { 0x2A, 0x00 })] + [InlineData('3', new byte[] { 0x33, 0x00 })] + [InlineData('[', new byte[] { 0x5B, 0x00 })] + [InlineData('a', new byte[] { 0x61, 0x00 })] + [InlineData('{', new byte[] { 0x7B, 0x00 })] + [InlineData('\0', new byte[] { 0x00, 0x00 })] + [InlineData(' ', new byte[] { 0x20, 0x00 })] + [InlineData('\u263a', new byte[] { 0x3A, 0x26 })] // Smiley Face (☺) + public abstract void ConvertFromChar(char character, byte[] expected); + + [Theory] + [InlineData(0, new byte[] { 0x00, 0x00, 0x00, 0x00 })] + [InlineData(15, new byte[] { 0x0F, 0x00, 0x00, 0x00 })] + [InlineData(-15, new byte[] { 0xF1, 0xFF, 0xFF, 0xFF })] + [InlineData(1048576, new byte[] { 0x00, 0x00, 0x10, 0x00 })] + [InlineData(-1048576, new byte[] { 0x00, 0x00, 0xF0, 0xFF })] + [InlineData(1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B })] + [InlineData(-1000000000, new byte[] { 0x00, 0x36, 0x65, 0xC4 })] + [InlineData(int.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0x7F })] + [InlineData(int.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x80 })] + public abstract void ConvertFromInt(int num, byte[] expected); + + [Theory] + [InlineData(0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })] + [InlineData(16777215, new byte[] { 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 })] + [InlineData(-16777215, new byte[] { 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF })] + [InlineData(1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00, 0x00 })] + [InlineData(-1000000000, new byte[] { 0x00, 0x36, 0x65, 0xC4, 0xFF, 0xFF, 0xFF, 0xFF })] + [InlineData(4294967296, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 })] + [InlineData(-4294967296, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF })] + [InlineData(187649984473770, new byte[] { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00 })] + [InlineData(-187649984473770, new byte[] { 0x56, 0x55, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF })] + [InlineData(1000000000000000000, new byte[] { 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0, 0x0D })] + [InlineData(-1000000000000000000, new byte[] { 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F, 0xF2 })] + [InlineData(long.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 })] + [InlineData(long.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F })] + public abstract void ConvertFromLong(long num, byte[] expected); + + [Theory] + [InlineData((ushort)0, new byte[] { 0x00, 0x00 })] + [InlineData((ushort)15, new byte[] { 0x0F, 0x00 })] + [InlineData((ushort)1023, new byte[] { 0xFF, 0x03 })] + [InlineData((ushort)10000, new byte[] { 0x10, 0x27 })] + [InlineData((ushort)short.MaxValue, new byte[] { 0xFF, 0x7F })] + [InlineData(ushort.MaxValue, new byte[] { 0xFF, 0xFF })] + public abstract void ConvertFromUShort(ushort num, byte[] expected); + + [Theory] + [InlineData((uint)0, new byte[] { 0x00, 0x00, 0x00, 0x00 })] + [InlineData((uint)15, new byte[] { 0x0F, 0x00, 0x00, 0x00 })] + [InlineData((uint)1023, new byte[] { 0xFF, 0x03, 0x00, 0x00 })] + [InlineData((uint)1048576, new byte[] { 0x00, 0x00, 0x10, 0x00 })] + [InlineData((uint)1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B })] + [InlineData(int.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0x7F })] + [InlineData(uint.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF })] + public abstract void ConvertFromUInt(uint num, byte[] expected); + + [Theory] + [InlineData((ulong)0xFFFFFF, new byte[] { 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 })] + [InlineData((ulong)1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00, 0x00 })] + [InlineData((ulong)0x100000000, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 })] + [InlineData((ulong)0xAAAAAAAAAAAA, new byte[] { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00 })] + [InlineData((ulong)1000000000000000000, new byte[] { 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0, 0x0D })] + [InlineData(10000000000000000000, new byte[] { 0x00, 0x00, 0xE8, 0x89, 0x04, 0x23, 0xC7, 0x8A })] + [InlineData((ulong)0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })] + [InlineData(long.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F })] + [InlineData(ulong.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF })] + public abstract void ConvertFromULong(ulong num, byte[] expected); + + [Theory] + [InlineData(0.0F, new byte[] { 0x00, 0x00, 0x00, 0x00 })] + [InlineData(1.0F, new byte[] { 0x00, 0x00, 0x80, 0x3F })] + [InlineData(15.0F, new byte[] { 0x00, 0x00, 0x70, 0x41 })] + [InlineData(65535.0F, new byte[] { 0x00, 0xFF, 0x7F, 0x47 })] + [InlineData(0.00390625F, new byte[] { 0x00, 0x00, 0x80, 0x3B })] + [InlineData(0.00000000023283064365386962890625F, new byte[] { 0x00, 0x00, 0x80, 0x2F })] + [InlineData(1.2345E-35F, new byte[] { 0x49, 0x46, 0x83, 0x05 })] + [InlineData(1.2345671F, new byte[] { 0x4B, 0x06, 0x9E, 0x3F })] + [InlineData(1.2345673F, new byte[] { 0x4D, 0x06, 0x9E, 0x3F })] + [InlineData(1.2345677F, new byte[] { 0x50, 0x06, 0x9E, 0x3F })] + [InlineData(1.23456789E+35F, new byte[] { 0x1E, 0x37, 0xBE, 0x79 })] + [InlineData(float.MinValue, new byte[] { 0xFF, 0xFF, 0x7F, 0xFF })] + [InlineData(float.MaxValue, new byte[] { 0xFF, 0xFF, 0x7F, 0x7F })] + [InlineData(float.Epsilon, new byte[] { 0x01, 0x00, 0x00, 0x00 })] + [InlineData(float.NaN, new byte[] { 0x00, 0x00, 0xC0, 0xFF })] + [InlineData(float.NegativeInfinity, new byte[] { 0x00, 0x00, 0x80, 0xFF })] + [InlineData(float.PositiveInfinity, new byte[] { 0x00, 0x00, 0x80, 0x7F })] + public abstract void ConvertFromFloat(float num, byte[] expected); + + [Theory] + [InlineData(0.0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })] + [InlineData(1.0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F })] + [InlineData(255.0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x6F, 0x40 })] + [InlineData(4294967295.0, new byte[] { 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xEF, 0x41 })] + [InlineData(0.00390625, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x3F })] + [InlineData(0.00000000023283064365386962890625, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D })] + [InlineData(1.23456789012345E-300, new byte[] { 0xDF, 0x88, 0x1E, 0x1C, 0xFE, 0x74, 0xAA, 0x01 })] + [InlineData(1.2345678901234565, new byte[] { 0xFA, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F })] + [InlineData(1.2345678901234567, new byte[] { 0xFB, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F })] + [InlineData(1.2345678901234569, new byte[] { 0xFC, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F })] + [InlineData(1.23456789012345678E+300, new byte[] { 0x52, 0xD3, 0xBB, 0xBC, 0xE8, 0x7E, 0x3D, 0x7E })] + [InlineData(double.MinValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF })] + [InlineData(double.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0x7F })] + [InlineData(double.Epsilon, new byte[] { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 })] + [InlineData(double.NaN, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF })] + [InlineData(double.NegativeInfinity, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF })] + [InlineData(double.PositiveInfinity, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7F })] + public abstract void ConvertFromDouble(double num, byte[] expected); + + private static byte[] s_toCharByteArray = { 32, 0, 0, 42, 0, 65, 0, 125, 0, 197, 0, 168, 3, 41, 4, 172, 32, 0x3A, 0x26 }; + + private static IEnumerable ToCharTestData() + { + yield return new object[] { 0, ' ', s_toCharByteArray}; + yield return new object[] { 1, '\0', s_toCharByteArray }; + yield return new object[] { 3, '*', s_toCharByteArray }; + yield return new object[] { 5, 'A', s_toCharByteArray }; + yield return new object[] { 7, '}', s_toCharByteArray }; + yield return new object[] { 9, '\u00C5', s_toCharByteArray }; // Latin capital letter A with ring above (Å) + yield return new object[] { 11, '\u03A8', s_toCharByteArray }; // Greek capital letter Psi (Ψ) + yield return new object[] { 13, '\u0429', s_toCharByteArray }; // Cyrillic capital letter Shcha (Щ) + yield return new object[] { 15, '\u20AC', s_toCharByteArray }; // Euro sign (€) + yield return new object[] { 17, '\u263A', s_toCharByteArray }; // Smiley Face (☺) + } + + [Theory] + [MemberData(nameof(ToCharTestData))] + public abstract void ToChar(int index, char expected, byte[] byteArray); + + private static byte[] s_toInt16ByteArray = { 15, 0, 0, 128, 16, 39, 240, 216, 241, 255, 127 }; + + private static IEnumerable ToInt16TestData() + { + yield return new object[] { 1, (short)0, s_toInt16ByteArray }; + yield return new object[] { 0, (short)15, s_toInt16ByteArray }; + yield return new object[] { 8, (short)-15, s_toInt16ByteArray }; + yield return new object[] { 4, (short)10000, s_toInt16ByteArray }; + yield return new object[] { 6, (short)-10000, s_toInt16ByteArray }; + yield return new object[] { 9, (short)32767, s_toInt16ByteArray }; + yield return new object[] { 2, (short)-32768, s_toInt16ByteArray }; + } + + [Theory] + [MemberData(nameof(ToInt16TestData))] + public abstract void ToInt16(int index, short expected, byte[] byteArray); + + [Theory] + [InlineData(0x00EC, new byte[] { 0xEC, 0x00, 0x00, 0x00 })] + [InlineData(0x3FFFFFFF, new byte[] { 0xFF, 0xFF, 0xFF, 0x3F })] + [InlineData(0x1000, new byte[] { 0x00, 0x10, 0x00, 0x00 })] + public abstract void ToInt32(int expected, byte[] byteArray); + + private static byte[] s_toInt64ByteArray = + { 0x00, 0x36, 0x65, 0xC4, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xCA, 0x9A, + 0x3B, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x56, 0x55, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, + 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0, 0x0D, 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F, 0xF2 }; + + private static IEnumerable ToInt64TestData() + { + yield return new object[] { 8, (long)0, s_toInt64ByteArray }; + yield return new object[] { 5, (long)16777215, s_toInt64ByteArray }; + yield return new object[] { 34, (long)-16777215, s_toInt64ByteArray }; + yield return new object[] { 17, (long)1000000000, s_toInt64ByteArray }; + yield return new object[] { 0, (long)-1000000000, s_toInt64ByteArray }; + yield return new object[] { 21, 4294967296, s_toInt64ByteArray }; + yield return new object[] { 26, -4294967296, s_toInt64ByteArray }; + yield return new object[] { 53, 187649984473770, s_toInt64ByteArray }; + yield return new object[] { 45, -187649984473770, s_toInt64ByteArray }; + yield return new object[] { 59, 1000000000000000000, s_toInt64ByteArray }; + yield return new object[] { 67, -1000000000000000000, s_toInt64ByteArray }; + yield return new object[] { 37, 9223372036854775807, s_toInt64ByteArray }; + yield return new object[] { 9, -9223372036854775808, s_toInt64ByteArray }; + } + + [Theory] + [MemberData(nameof(ToInt64TestData))] + public abstract void ToInt64(int index, long expected, byte[] byteArray); + + private static byte[] s_toUInt16ByteArray = { 15, 0, 0, 255, 3, 16, 39, 255, 255, 127 }; + + private static IEnumerable ToUInt16TestData() + { + yield return new object[] { 1, (ushort)0, s_toUInt16ByteArray }; + yield return new object[] { 0, (ushort)15, s_toUInt16ByteArray }; + yield return new object[] { 3, (ushort)1023, s_toUInt16ByteArray }; + yield return new object[] { 5, (ushort)10000, s_toUInt16ByteArray }; + yield return new object[] { 8, (ushort)32767, s_toUInt16ByteArray }; + yield return new object[] { 7, (ushort)65535, s_toUInt16ByteArray }; + } + + [Theory] + [MemberData(nameof(ToUInt16TestData))] + public abstract void ToUInt16(int index, ushort expected, byte[] byteArray); + + private static byte[] s_toUInt32ByteArray = { 15, 0, 0, 0, 0, 16, 0, 255, 3, 0, 0, 202, 154, 59, 255, 255, 255, 255, 127 }; + + private static IEnumerable ToUInt32TestData() + { + yield return new object[] { 1, (uint)0, s_toUInt32ByteArray }; + yield return new object[] { 0, (uint)15, s_toUInt32ByteArray }; + yield return new object[] { 7, (uint)1023, s_toUInt32ByteArray }; + yield return new object[] { 3, (uint)1048576, s_toUInt32ByteArray }; + yield return new object[] { 10, (uint)1000000000, s_toUInt32ByteArray }; + yield return new object[] { 15, (uint)2147483647, s_toUInt32ByteArray }; + yield return new object[] { 14, 4294967295, s_toUInt32ByteArray }; + } + + [Theory] + [MemberData(nameof(ToUInt32TestData))] + public abstract void ToUInt32(int index, uint expected, byte[] byteArray); + + private static byte[] s_toUInt64ByteArray = + { 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0xa7, 0xb3, 0xb6, 0xe0, + 0x0d, 0x00, 0xca, 0x9a, 0x3b, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0xe8, 0x89, 0x04, + 0x23, 0xc7, 0x8a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f }; + + private static IEnumerable ToUInt64TestData() + { + yield return new object[] { 3, (ulong)0, s_toUInt64ByteArray }; + yield return new object[] { 0, (ulong)16777215, s_toUInt64ByteArray }; + yield return new object[] { 21, (ulong)1000000000, s_toUInt64ByteArray }; + yield return new object[] { 7, (ulong)4294967296, s_toUInt64ByteArray }; + yield return new object[] { 29, (ulong)187649984473770, s_toUInt64ByteArray }; + yield return new object[] { 13, (ulong)1000000000000000000, s_toUInt64ByteArray }; + yield return new object[] { 35, 10000000000000000000, s_toUInt64ByteArray }; + yield return new object[] { 44, (ulong)9223372036854775807, s_toUInt64ByteArray }; + yield return new object[] { 43, 18446744073709551615, s_toUInt64ByteArray }; + } + + [Theory] + [MemberData(nameof(ToUInt64TestData))] + public abstract void ToUInt64(int index, ulong expected, byte[] byteArray); + + private static byte[] s_toSingleByteArray = + { 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x00, 0x00, 0x70, 0x41, 0x00, 0xFF, 0x7F, 0x47, 0x00, 0x00, 0x80, 0x3B, 0x00, 0x00, + 0x80, 0x2F, 0x49, 0x46, 0x83, 0x05, 0x4B, 0x06, 0x9E, 0x3F, 0x4D, 0x06, 0x9E, 0x3F, 0x50, 0x06, 0x9E, 0x3F, 0x1E, 0x37, + 0xBE, 0x79, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x80, 0xFF, 0x00, + 0x00, 0x80, 0x7F }; + + private static IEnumerable ToSingleTestData() + { + yield return new object[] { 0, 0.0000000E+000, s_toSingleByteArray }; + yield return new object[] { 2, 1.0000000E+000, s_toSingleByteArray }; + yield return new object[] { 6, 1.5000000E+001, s_toSingleByteArray }; + yield return new object[] { 10, 6.5535000E+004, s_toSingleByteArray }; + yield return new object[] { 14, 3.9062500E-003, s_toSingleByteArray }; + yield return new object[] { 18, 2.3283064E-010, s_toSingleByteArray }; + yield return new object[] { 22, 1.2345000E-035, s_toSingleByteArray }; + yield return new object[] { 26, 1.2345671E+000, s_toSingleByteArray }; + yield return new object[] { 30, 1.2345673E+000, s_toSingleByteArray }; + yield return new object[] { 34, 1.2345676E+000, s_toSingleByteArray }; + yield return new object[] { 38, 1.2345679E+035, s_toSingleByteArray }; + yield return new object[] { 42, -3.4028235E+038, s_toSingleByteArray }; + yield return new object[] { 45, 3.4028235E+038, s_toSingleByteArray }; + yield return new object[] { 49, 1.4012985E-045, s_toSingleByteArray }; + yield return new object[] { 51, float.NaN, s_toSingleByteArray }; + yield return new object[] { 55, float.NegativeInfinity, s_toSingleByteArray }; + yield return new object[] { 59, float.PositiveInfinity, s_toSingleByteArray }; + } + + [Theory] + [MemberData(nameof(ToSingleTestData))] + public abstract void ToSingle(int index, float expected, byte[] byteArray); + + private static byte[] s_toDoubleByteArray = + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x6F, 0x40, 0x00, 0x00, + 0xE0, 0xFF, 0xFF, 0xFF, 0xEF, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF0, 0x3D, 0xDF, 0x88, 0x1E, 0x1C, 0xFE, 0x74, 0xAA, 0x01, 0xFA, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F, 0xFB, 0x59, + 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F, 0xFC, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F, 0x52, 0xD3, 0xBB, 0xBC, 0xE8, 0x7E, + 0x3D, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0x7F, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xF0, 0x7F }; + + private static IEnumerable ToDoubleTestData() + { + yield return new object[] { 0, 0.0000000000000000E+000, s_toDoubleByteArray }; + yield return new object[] { 2, 1.0000000000000000E+000, s_toDoubleByteArray }; + yield return new object[] { 10, 2.5500000000000000E+002, s_toDoubleByteArray }; + yield return new object[] { 18, 4.2949672950000000E+009, s_toDoubleByteArray }; + yield return new object[] { 26, 3.9062500000000000E-003, s_toDoubleByteArray }; + yield return new object[] { 34, 2.3283064365386963E-010, s_toDoubleByteArray }; + yield return new object[] { 42, 1.2345678901234500E-300, s_toDoubleByteArray }; + yield return new object[] { 50, 1.2345678901234565E+000, s_toDoubleByteArray }; + yield return new object[] { 58, 1.2345678901234567E+000, s_toDoubleByteArray }; + yield return new object[] { 66, 1.2345678901234569E+000, s_toDoubleByteArray }; + yield return new object[] { 74, 1.2345678901234569E+300, s_toDoubleByteArray }; + yield return new object[] { 82, -1.7976931348623157E+308, s_toDoubleByteArray }; + yield return new object[] { 89, 1.7976931348623157E+308, s_toDoubleByteArray }; + yield return new object[] { 97, 4.9406564584124654E-324, s_toDoubleByteArray }; + yield return new object[] { 99, double.NaN, s_toDoubleByteArray }; + yield return new object[] { 107, double.NegativeInfinity, s_toDoubleByteArray }; + yield return new object[] { 115, double.PositiveInfinity, s_toDoubleByteArray }; + } + + [Theory] + [MemberData(nameof(ToDoubleTestData))] + public abstract void ToDouble(int index, double expected, byte[] byteArray); + + private static byte[] s_toBooleanByteArray = { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }; + + private static IEnumerable ToBooleanTestData() + { + yield return new object[] { 0, false, s_toBooleanByteArray }; + yield return new object[] { 1, true, s_toBooleanByteArray }; + yield return new object[] { 2, true, s_toBooleanByteArray }; + yield return new object[] { 3, true, s_toBooleanByteArray }; + yield return new object[] { 4, true, s_toBooleanByteArray }; + yield return new object[] { 5, true, s_toBooleanByteArray }; + yield return new object[] { 6, true, s_toBooleanByteArray }; + yield return new object[] { 7, true, s_toBooleanByteArray }; + yield return new object[] { 8, true, s_toBooleanByteArray }; + yield return new object[] { 9, true, s_toBooleanByteArray }; + } + + [Theory] + [MemberData(nameof(ToBooleanTestData))] + public abstract void ToBoolean(int index, bool expected, byte[] byteArray); + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterSpan.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterSpan.cs new file mode 100644 index 0000000000..cc8e15b2f8 --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/BitConverterSpan.cs @@ -0,0 +1,172 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Tests +{ + public class BitConverterSpan : BitConverterBase + { + [Fact] + public void TryWriteBytes_DestinationSpanNotLargeEnough() + { + Assert.False(BitConverter.TryWriteBytes(Span.Empty, false)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, 'a')); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, (short)2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, 2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, (long)2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, (ushort)2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, (uint)2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, (ulong)2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, (float)2)); + Assert.False(BitConverter.TryWriteBytes(Span.Empty, 2.0)); + } + + [Fact] + public void ToMethods_DestinationSpanNotLargeEnough() + { + Assert.Throws(() => { BitConverter.ToChar(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToInt16(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToInt32(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToInt64(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToUInt16(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToUInt32(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToUInt64(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToSingle(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToDouble(Span.Empty); }); + Assert.Throws(() => { BitConverter.ToBoolean(Span.Empty); }); + } + + public override void ConvertFromBool(bool boolean, byte[] expected) + { + Span span = new Span(new byte[1]); + Assert.True(BitConverter.TryWriteBytes(span, boolean)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromShort(short num, byte[] expected) + { + Span span = new Span(new byte[2]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromChar(char character, byte[] expected) + { + Span span = new Span(new byte[2]); + Assert.True(BitConverter.TryWriteBytes(span, character)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromInt(int num, byte[] expected) + { + Span span = new Span(new byte[4]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromLong(long num, byte[] expected) + { + Span span = new Span(new byte[8]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromUShort(ushort num, byte[] expected) + { + Span span = new Span(new byte[2]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromUInt(uint num, byte[] expected) + { + Span span = new Span(new byte[4]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromULong(ulong num, byte[] expected) + { + Span span = new Span(new byte[8]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromFloat(float num, byte[] expected) + { + Span span = new Span(new byte[4]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ConvertFromDouble(double num, byte[] expected) + { + Span span = new Span(new byte[8]); + Assert.True(BitConverter.TryWriteBytes(span, num)); + Assert.Equal(expected, span.ToArray()); + } + + public override void ToChar(int index, char expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + BitConverter.ToChar(span); + Assert.Equal(expected, BitConverter.ToChar(span.Slice(index))); + } + + public override void ToInt16(int index, short expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToInt16(span.Slice(index))); + } + + public override void ToInt32(int expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToInt32(byteArray)); + } + + public override void ToInt64(int index, long expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToInt64(span.Slice(index))); + } + + public override void ToUInt16(int index, ushort expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToUInt16(span.Slice(index))); + } + + public override void ToUInt32(int index, uint expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToUInt32(span.Slice(index))); + } + + public override void ToUInt64(int index, ulong expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToUInt64(span.Slice(index))); + } + + public override void ToSingle(int index, float expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToSingle(span.Slice(index))); + } + + public override void ToDouble(int index, double expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToDouble(span.Slice(index))); + } + + public override void ToBoolean(int index, bool expected, byte[] byteArray) + { + ReadOnlySpan span = new ReadOnlySpan(byteArray); + Assert.Equal(expected, BitConverter.ToBoolean(span.Slice(index))); + } + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/Convert.netcoreapp.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/Convert.netcoreapp.cs new file mode 100644 index 0000000000..ec1db8cc18 --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/Convert.netcoreapp.cs @@ -0,0 +1,161 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using Xunit; + +namespace System.Tests +{ + public partial class ConvertTests + { + [Theory] + [InlineData(new byte[0], "")] + [InlineData(new byte[] { 5, 6, 7, 8 }, "BQYHCA==")] + public void ToBase64String_Span_ProducesExpectedOutput(byte[] input, string expected) + { + Assert.Equal(expected, Convert.ToBase64String(input.AsReadOnlySpan())); + Assert.Equal(expected, Convert.ToBase64String(input.AsReadOnlySpan(), Base64FormattingOptions.None)); + Assert.Equal(expected, Convert.ToBase64String(input.AsReadOnlySpan(), Base64FormattingOptions.InsertLineBreaks)); + } + + [Fact] + public void ToBase64String_Span_LongWithOptions_ProducesExpectedOutput() + { + byte[] input = Enumerable.Range(0, 120).Select(i => (byte)i).ToArray(); + + Assert.Equal( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4" + + "OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx" + + "cnN0dXZ3", + Convert.ToBase64String(input)); + + Assert.Equal( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4" + + "OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx" + + "cnN0dXZ3", + Convert.ToBase64String(input, Base64FormattingOptions.None)); + + Assert.Equal( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4\r\n" + + "OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx\r\n" + + "cnN0dXZ3", + Convert.ToBase64String(input, Base64FormattingOptions.InsertLineBreaks)); + } + + [Theory] + [InlineData((Base64FormattingOptions)(-1))] + [InlineData((Base64FormattingOptions)(2))] + public void ToBase64String_Span_InvalidOptions_Throws(Base64FormattingOptions invalidOption) + { + AssertExtensions.Throws("options", () => Convert.ToBase64String(new byte[0].AsReadOnlySpan(), invalidOption)); + } + + [Theory] + [InlineData(new byte[0], "")] + [InlineData(new byte[] { 5, 6, 7, 8 }, "BQYHCA==")] + public void TryToBase64Chars_ProducesExpectedOutput(byte[] input, string expected) + { + Span dest; + + // Just right + dest = new char[expected.Length]; + Assert.True(Convert.TryToBase64Chars(input.AsReadOnlySpan(), dest, out int charsWritten)); + Assert.Equal(expected.Length, charsWritten); + Assert.Equal(expected.ToCharArray(), dest.ToArray()); + + // Too short + if (expected.Length > 0) + { + dest = new char[expected.Length - 1]; + Assert.False(Convert.TryToBase64Chars(input.AsReadOnlySpan(), dest, out charsWritten)); + Assert.Equal(0, charsWritten); + } + + // Longer than needed + dest = new char[expected.Length + 1]; + Assert.True(Convert.TryToBase64Chars(input.AsReadOnlySpan(), dest, out charsWritten)); + Assert.Equal(expected.Length, charsWritten); + Assert.Equal(expected.ToCharArray(), dest.Slice(0, expected.Length).ToArray()); + Assert.Equal(0, dest[dest.Length - 1]); + } + + [Theory] + [InlineData((Base64FormattingOptions)(-1))] + [InlineData((Base64FormattingOptions)(2))] + public void TryToBase64Chars_InvalidOptions_Throws(Base64FormattingOptions invalidOption) + { + AssertExtensions.Throws("options", + () => Convert.TryToBase64Chars(new byte[0].AsReadOnlySpan(), new char[0].AsSpan(), out int charsWritten, invalidOption)); + } + + [Theory] + [InlineData("")] + [InlineData("BQYHCA==")] + [InlineData( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4\r\n" + + "OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx\r\n" + + "cnN0dXZ3")] + public void TryFromBase64String_MatchesFromBase64String(string stringInput) + { + byte[] expected = Convert.FromBase64String(stringInput); + Span dest; + + // Just the right length + dest = new byte[expected.Length]; + Assert.True(Convert.TryFromBase64String(stringInput, dest, out int bytesWritten)); + Assert.Equal(expected.Length, bytesWritten); + Assert.Equal(expected, dest.ToArray()); + + // Too short + if (expected.Length > 0) + { + dest = new byte[expected.Length - 1]; + Assert.False(Convert.TryFromBase64String(stringInput, dest, out bytesWritten)); + Assert.Equal(0, bytesWritten); + } + + // Longer than needed + dest = new byte[expected.Length + 1]; + Assert.True(Convert.TryFromBase64String(stringInput, dest, out bytesWritten)); + Assert.Equal(expected.Length, bytesWritten); + Assert.Equal(expected, dest.Slice(0, expected.Length).ToArray()); + Assert.Equal(0, dest[dest.Length - 1]); + } + + [Theory] + [InlineData("")] + [InlineData("BQYHCA==")] + [InlineData( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4\r\n" + + "OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx\r\n" + + "cnN0dXZ3")] + public void TryFromBase64Chars_MatchesFromBase64CharArray(string stringInput) + { + char[] charArrayInput = stringInput.ToCharArray(); + byte[] expected = Convert.FromBase64CharArray(charArrayInput, 0, charArrayInput.Length); + Span dest; + + // Just the right length + dest = new byte[expected.Length]; + Assert.True(Convert.TryFromBase64Chars(charArrayInput.AsReadOnlySpan(), dest, out int bytesWritten)); + Assert.Equal(expected.Length, bytesWritten); + Assert.Equal(expected, dest.ToArray()); + + // Too short + if (expected.Length > 0) + { + dest = new byte[expected.Length - 1]; + Assert.False(Convert.TryFromBase64Chars(charArrayInput.AsReadOnlySpan(), dest, out bytesWritten)); + Assert.Equal(0, bytesWritten); + } + + // Longer than needed + dest = new byte[expected.Length + 1]; + Assert.True(Convert.TryFromBase64Chars(charArrayInput.AsReadOnlySpan(), dest, out bytesWritten)); + Assert.Equal(expected.Length, bytesWritten); + Assert.Equal(expected, dest.Slice(0, dest.Length - 1).ToArray()); + Assert.Equal(0, dest[dest.Length - 1]); + } + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs index 5b84fecc11..a459ae8e2a 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.Exit.cs @@ -42,7 +42,7 @@ namespace System.Tests [InlineData(2)] // setting ExitCode both from Main and from an Unloading event handler. [InlineData(3)] // using Exit(exitCode) [ActiveIssue("https://github.com/dotnet/corefx/issues/21415", TargetFrameworkMonikers.UapNotUapAot)] - [ActiveIssue("https://github.com/dotnet/corefx/issues/20387 - ILC test pipeline does not accomodate tests in child processes built into custom assemblies.", TargetFrameworkMonikers.UapAot)] + [ActiveIssue("https://github.com/dotnet/corefx/issues/20387 - ILC test pipeline does not accommodate tests in child processes built into custom assemblies.", TargetFrameworkMonikers.UapAot)] public static void ExitCode_VoidMainAppReturnsSetValue(int mode) { int expectedExitCode = 123; diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs index 2f4ef1c10d..285fb6c1f5 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetCommandLineArgs.cs @@ -51,7 +51,7 @@ namespace System.Tests { string[] cmdLineArgs = Environment.GetCommandLineArgs(); - Assert.InRange(cmdLineArgs.Length, 4, int.MaxValue); /*AppName, AssemblyName, TypeName, MethodName*/ + Assert.InRange(cmdLineArgs.Length, 5, int.MaxValue); /*AppName, AssemblyName, TypeName, MethodName, ExceptionFile */ Assert.Contains(TestConsoleApp, cmdLineArgs[0]); /*The host returns the fullName*/ Type t = typeof(GetCommandLineArgs); @@ -63,10 +63,10 @@ namespace System.Tests Assert.Contains("GetCommandLineArgs_Invoke_ReturnsExpected", cmdLineArgs[3]); // Check the arguments sent to the method. - Assert.Equal(args.Length, cmdLineArgs.Length - 4); + Assert.Equal(args.Length, cmdLineArgs.Length - 5); for (int i = 0; i < args.Length; i++) { - Assert.Equal(args[i], cmdLineArgs[i + 4]); + Assert.Equal(args[i], cmdLineArgs[i + 5]); } return SuccessExitCode; diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetEnvironmentVariable.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetEnvironmentVariable.cs index 153279d129..d63d8184a1 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetEnvironmentVariable.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/Environment.GetEnvironmentVariable.cs @@ -170,6 +170,7 @@ namespace System.Tests [Theory] [InlineData(null)] [MemberData(nameof(EnvironmentTests.EnvironmentVariableTargets), MemberType = typeof(EnvironmentTests))] + [ActiveIssue("https://github.com/dotnet/corefx/issues/23003", TargetFrameworkMonikers.NetFramework)] public void GetEnumerator_LinqOverDictionaryEntries_Success(EnvironmentVariableTarget? target) { IDictionary envVars = target != null ? diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs index 4a7e8a3368..18dc2f937d 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs @@ -7,9 +7,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Reflection; using System.Runtime.InteropServices; -using System.Security; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -181,9 +179,9 @@ namespace System.Tests { Assert.True(Environment.WorkingSet > 0, "Expected positive WorkingSet value"); } - + [Fact] - [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)] + [SkipOnTargetFramework(~TargetFrameworkMonikers.Uap)] public void WorkingSet_Valid_Uap() { Assert.Throws(() => Environment.WorkingSet); @@ -276,71 +274,119 @@ namespace System.Tests } } - // The commented out folders aren't set on all systems. - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/19110 - [ActiveIssue(20782, TargetFrameworkMonikers.Uap)] - [InlineData(Environment.SpecialFolder.ApplicationData, false)] - [InlineData(Environment.SpecialFolder.CommonApplicationData, false)] - [InlineData(Environment.SpecialFolder.LocalApplicationData, true)] - [InlineData(Environment.SpecialFolder.Cookies, true)] - [InlineData(Environment.SpecialFolder.Desktop, false)] - [InlineData(Environment.SpecialFolder.Favorites, false)] - [InlineData(Environment.SpecialFolder.History, true)] - [InlineData(Environment.SpecialFolder.InternetCache, true)] - [InlineData(Environment.SpecialFolder.Programs, true)] - // [InlineData(Environment.SpecialFolder.MyComputer)] - [InlineData(Environment.SpecialFolder.MyMusic, false)] - [InlineData(Environment.SpecialFolder.MyPictures, false)] - [InlineData(Environment.SpecialFolder.MyVideos, false)] - [InlineData(Environment.SpecialFolder.Recent, false)] - [InlineData(Environment.SpecialFolder.SendTo, false)] - [InlineData(Environment.SpecialFolder.StartMenu, false)] - [InlineData(Environment.SpecialFolder.Startup, true)] - [InlineData(Environment.SpecialFolder.System, true)] - [InlineData(Environment.SpecialFolder.Templates, false)] - [InlineData(Environment.SpecialFolder.DesktopDirectory, false)] - [InlineData(Environment.SpecialFolder.Personal, false)] - [InlineData(Environment.SpecialFolder.ProgramFiles, true)] - [InlineData(Environment.SpecialFolder.CommonProgramFiles, true)] - [InlineData(Environment.SpecialFolder.AdminTools, true)] - [InlineData(Environment.SpecialFolder.CDBurning, false)] - [InlineData(Environment.SpecialFolder.CommonAdminTools, false)] - [InlineData(Environment.SpecialFolder.CommonDocuments, false)] - [InlineData(Environment.SpecialFolder.CommonMusic, false)] - // [InlineData(Environment.SpecialFolder.CommonOemLinks)] - [InlineData(Environment.SpecialFolder.CommonPictures, false)] - [InlineData(Environment.SpecialFolder.CommonStartMenu, false)] - [InlineData(Environment.SpecialFolder.CommonPrograms, false)] - [InlineData(Environment.SpecialFolder.CommonStartup, false)] - [InlineData(Environment.SpecialFolder.CommonDesktopDirectory, false)] - [InlineData(Environment.SpecialFolder.CommonTemplates, false)] - [InlineData(Environment.SpecialFolder.CommonVideos, false)] - [InlineData(Environment.SpecialFolder.Fonts, true)] - [InlineData(Environment.SpecialFolder.NetworkShortcuts, false)] - // [InlineData(Environment.SpecialFolder.PrinterShortcuts)] - [InlineData(Environment.SpecialFolder.UserProfile, false)] - [InlineData(Environment.SpecialFolder.CommonProgramFilesX86, true)] - [InlineData(Environment.SpecialFolder.ProgramFilesX86, true)] - [InlineData(Environment.SpecialFolder.Resources, true)] - // [InlineData(Environment.SpecialFolder.LocalizedResources)] - [InlineData(Environment.SpecialFolder.SystemX86, true)] - [InlineData(Environment.SpecialFolder.Windows, true)] - [PlatformSpecific(TestPlatforms.Windows)] // Tests OS-specific environment - public unsafe void GetFolderPath_Windows(Environment.SpecialFolder folder, bool existsInAppContainer = true) + // Requires recent RS3 builds and needs to run inside AppContainer + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version16251OrGreater), nameof(PlatformDetection.IsInAppContainer))] + [InlineData(Environment.SpecialFolder.LocalApplicationData)] + [InlineData(Environment.SpecialFolder.Cookies)] + [InlineData(Environment.SpecialFolder.History)] + [InlineData(Environment.SpecialFolder.InternetCache)] + [InlineData(Environment.SpecialFolder.System)] + [InlineData(Environment.SpecialFolder.SystemX86)] + [InlineData(Environment.SpecialFolder.Windows)] + public void GetFolderPath_UapExistAndAccessible(Environment.SpecialFolder folder) { string knownFolder = Environment.GetFolderPath(folder); - // If you are not executing inside an AppContainer or the folder is allowed in it the path must not be empty. - if (!PlatformDetection.IsWinRT || existsInAppContainer) + Assert.NotEmpty(knownFolder); + AssertDirectoryExists(knownFolder); + } + + // Requires recent RS3 builds and needs to run inside AppContainer + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsWindows10Version16251OrGreater), nameof(PlatformDetection.IsInAppContainer))] + [InlineData(Environment.SpecialFolder.ApplicationData)] + [InlineData(Environment.SpecialFolder.MyMusic)] + [InlineData(Environment.SpecialFolder.MyPictures)] + [InlineData(Environment.SpecialFolder.MyVideos)] + [InlineData(Environment.SpecialFolder.Recent)] + [InlineData(Environment.SpecialFolder.Templates)] + [InlineData(Environment.SpecialFolder.DesktopDirectory)] + [InlineData(Environment.SpecialFolder.Personal)] + [InlineData(Environment.SpecialFolder.UserProfile)] + [InlineData(Environment.SpecialFolder.CommonDocuments)] + [InlineData(Environment.SpecialFolder.CommonMusic)] + [InlineData(Environment.SpecialFolder.CommonPictures)] + [InlineData(Environment.SpecialFolder.CommonDesktopDirectory)] + [InlineData(Environment.SpecialFolder.CommonVideos)] + // These are in the package folder + [InlineData(Environment.SpecialFolder.CommonApplicationData)] + [InlineData(Environment.SpecialFolder.Desktop)] + [InlineData(Environment.SpecialFolder.Favorites)] + public void GetFolderPath_UapNotEmpty(Environment.SpecialFolder folder) + { + // The majority of the paths here cannot be accessed from an appcontainer + string knownFolder = Environment.GetFolderPath(folder); + Assert.NotEmpty(knownFolder); + } + + private void AssertDirectoryExists(string path) + { + // Directory.Exists won't tell us if access was denied, etc. Invoking directly + // to get diagnosable test results. + + FileAttributes attributes = GetFileAttributesW(path); + if (attributes == (FileAttributes)(-1)) { - Assert.NotEmpty(knownFolder); - } - else - { - // If you hit this assert it means that SHGetFolderPath inside a UWP has been fixed. - // Check the value is reasonable and update the test data to expect a path from now on. - Assert.Empty(knownFolder); + int error = Marshal.GetLastWin32Error(); + Assert.False(true, $"error {error} getting attributes for {path}"); } + Assert.True((attributes & FileAttributes.Directory) == FileAttributes.Directory, $"not a directory: {path}"); + } + + // The commented out folders aren't set on all systems. + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/19110 + [InlineData(Environment.SpecialFolder.ApplicationData)] + [InlineData(Environment.SpecialFolder.CommonApplicationData)] + [InlineData(Environment.SpecialFolder.LocalApplicationData)] + [InlineData(Environment.SpecialFolder.Cookies)] + [InlineData(Environment.SpecialFolder.Desktop)] + [InlineData(Environment.SpecialFolder.Favorites)] + [InlineData(Environment.SpecialFolder.History)] + [InlineData(Environment.SpecialFolder.InternetCache)] + [InlineData(Environment.SpecialFolder.Programs)] + // [InlineData(Environment.SpecialFolder.MyComputer)] + [InlineData(Environment.SpecialFolder.MyMusic)] + [InlineData(Environment.SpecialFolder.MyPictures)] + [InlineData(Environment.SpecialFolder.MyVideos)] + [InlineData(Environment.SpecialFolder.Recent)] + [InlineData(Environment.SpecialFolder.SendTo)] + [InlineData(Environment.SpecialFolder.StartMenu)] + [InlineData(Environment.SpecialFolder.Startup)] + [InlineData(Environment.SpecialFolder.System)] + [InlineData(Environment.SpecialFolder.Templates)] + [InlineData(Environment.SpecialFolder.DesktopDirectory)] + [InlineData(Environment.SpecialFolder.Personal)] + [InlineData(Environment.SpecialFolder.ProgramFiles)] + [InlineData(Environment.SpecialFolder.CommonProgramFiles)] + [InlineData(Environment.SpecialFolder.AdminTools)] + //[InlineData(Environment.SpecialFolder.CDBurning)] // Not available on Server Core + [InlineData(Environment.SpecialFolder.CommonAdminTools)] + [InlineData(Environment.SpecialFolder.CommonDocuments)] + [InlineData(Environment.SpecialFolder.CommonMusic)] + // [InlineData(Environment.SpecialFolder.CommonOemLinks)] + [InlineData(Environment.SpecialFolder.CommonPictures)] + [InlineData(Environment.SpecialFolder.CommonStartMenu)] + [InlineData(Environment.SpecialFolder.CommonPrograms)] + [InlineData(Environment.SpecialFolder.CommonStartup)] + [InlineData(Environment.SpecialFolder.CommonDesktopDirectory)] + [InlineData(Environment.SpecialFolder.CommonTemplates)] + [InlineData(Environment.SpecialFolder.CommonVideos)] + [InlineData(Environment.SpecialFolder.Fonts)] + [InlineData(Environment.SpecialFolder.NetworkShortcuts)] + // [InlineData(Environment.SpecialFolder.PrinterShortcuts)] + [InlineData(Environment.SpecialFolder.UserProfile)] + [InlineData(Environment.SpecialFolder.CommonProgramFilesX86)] + [InlineData(Environment.SpecialFolder.ProgramFilesX86)] + [InlineData(Environment.SpecialFolder.Resources)] + // [InlineData(Environment.SpecialFolder.LocalizedResources)] + [InlineData(Environment.SpecialFolder.SystemX86)] + [InlineData(Environment.SpecialFolder.Windows)] + [PlatformSpecific(TestPlatforms.Windows)] // Tests OS-specific environment + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap | TargetFrameworkMonikers.UapAot)] // Don't run on UAP + public unsafe void GetFolderPath_Windows(Environment.SpecialFolder folder) + { + string knownFolder = Environment.GetFolderPath(folder); + Assert.NotEmpty(knownFolder); + // Call the older folder API to compare our results. char* buffer = stackalloc char[260]; SHGetFolderPathW(IntPtr.Zero, (int)folder, IntPtr.Zero, 0, buffer); @@ -390,6 +436,9 @@ namespace System.Tests uint dwFlags, char* pszPath); + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + internal static extern FileAttributes GetFileAttributesW(string lpFileName); + public static IEnumerable EnvironmentVariableTargets { get diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/IO/Path.IsPathFullyQualified.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/IO/Path.IsPathFullyQualified.cs new file mode 100644 index 0000000000..9816e1659f --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/IO/Path.IsPathFullyQualified.cs @@ -0,0 +1,85 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.IO.Tests +{ + public static class GetFullyQualifiedPathTests + { + [Fact] + public static void IsPathFullyQualified_NullThrows() + { + Assert.Throws(() => Path.IsPathFullyQualified(null)); + } + + [Fact] + public static void IsPathFullyQualified_Empty() + { + Assert.False(Path.IsPathFullyQualified("")); + } + + [PlatformSpecific(TestPlatforms.Windows)] + [Theory] + [InlineData("/")] + [InlineData(@"\")] + [InlineData(".")] + [InlineData("C:")] + [InlineData("C:foo.txt")] + public static void IsPathFullyQualified_Windows_Invalid(string path) + { + Assert.False(Path.IsPathFullyQualified(path)); + } + + [PlatformSpecific(TestPlatforms.Windows)] + [Theory] + [InlineData(@"\\")] + [InlineData(@"\\\")] + [InlineData(@"\\Server")] + [InlineData(@"\\Server\Foo.txt")] + [InlineData(@"\\Server\Share\Foo.txt")] + [InlineData(@"\\Server\Share\Test\Foo.txt")] + [InlineData(@"C:\")] + [InlineData(@"C:\foo1")] + [InlineData(@"C:\\")] + [InlineData(@"C:\\foo2")] + [InlineData(@"C:/")] + [InlineData(@"C:/foo1")] + [InlineData(@"C://")] + [InlineData(@"C://foo2")] + public static void IsPathFullyQualified_Windows_Valid(string path) + { + Assert.True(Path.IsPathFullyQualified(path)); + } + + [PlatformSpecific(TestPlatforms.AnyUnix)] + [Theory] + [InlineData(@"\")] + [InlineData(@"\\")] + [InlineData(".")] + [InlineData("./foo.txt")] + [InlineData("..")] + [InlineData("../foo.txt")] + [InlineData(@"C:")] + [InlineData(@"C:/")] + [InlineData(@"C://")] + public static void IsPathFullyQualified_Unix_Invalid(string path) + { + Assert.False(Path.IsPathFullyQualified(path)); + } + + [PlatformSpecific(TestPlatforms.AnyUnix)] + [Theory] + [InlineData("/")] + [InlineData("/foo.txt")] + [InlineData("/..")] + [InlineData("//")] + [InlineData("//foo.txt")] + [InlineData("//..")] + public static void IsPathFullyQualified_Unix_Valid(string path) + { + Assert.True(Path.IsPathFullyQualified(path)); + } + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/MathTests.netcoreapp.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/MathTests.netcoreapp.cs index 2439880d91..f179214076 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/MathTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/MathTests.netcoreapp.cs @@ -7,6 +7,7 @@ using Xunit; namespace System.Tests { + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Math.Clamp is not in CoreRT yet.")] public static partial class MathTests { public static IEnumerable Clamp_UnsignedInt_TestData() diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/Random.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/Random.cs index 74f75ae40f..9c15c6b292 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/Random.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/Random.cs @@ -6,7 +6,7 @@ using Xunit; namespace System.Tests { - public static class RandomTests + public static partial class RandomTests { [Fact] public static void Unseeded() @@ -53,14 +53,12 @@ namespace System.Tests } } - [Fact] - public static void ExpectedValues() + // Random has a predictable sequence of values it generates based on its seed. + // So that we'll be made aware if a change to the implementation causes these + // sequences to change, this test verifies the first few numbers for a few seeds. + private static int[][] Values() { - // Random has a predictable sequence of values it generates based on its seed. - // So that we'll be made aware if a change to the implementation causes these - // sequences to change, this test verifies the first few numbers for a few seeds. - - var expectedValues = new int[][] + var expectedValues = new int[][] { new int[] {1559595546, 1755192844, 1649316166, 1198642031, 442452829, 1200195957, 1945678308, 949569752, 2099272109, 587775847}, new int[] {534011718, 237820880, 1002897798, 1657007234, 1412011072, 929393559, 760389092, 2026928803, 217468053, 1379662799}, @@ -83,7 +81,13 @@ namespace System.Tests new int[] {278955818, 212301256, 751203777, 859281097, 714632027, 620720087, 2085308890, 1014679847, 439053806, 1956839101}, new int[] {1400855637, 842412939, 104785409, 1317646300, 1684190270, 349917689, 900019674, 2092038898, 704733397, 601242406}, }; + return (expectedValues); + } + [Fact] + public static void ExpectedValues() + { + int[][] expectedValues = Values(); for (int seed = 0; seed < expectedValues.Length; seed++) { var r = new Random(seed); @@ -94,6 +98,47 @@ namespace System.Tests } } + private static byte[][] ByteValues() + { + var expectedValues = new byte[][] + { + new byte[] { 0x1A, 0xC, 0x46, 0x6F, 0x5D, 0x75, 0xE4, 0xD8, 0xAD, 0x67 }, + new byte[] { 0x46, 0xD0, 0x86, 0x82, 0x40, 0x97, 0xE4, 0xA3, 0x95, 0xCF }, + new byte[] { 0x71, 0x93, 0xC6, 0x95, 0x24, 0xB9, 0xE3, 0x6F, 0x7C, 0x38 }, + new byte[] { 0x9D, 0x56, 0x5, 0xA9, 0x7, 0xDB, 0xE3, 0x3A, 0x63, 0xA0 }, + new byte[] { 0xC8, 0x19, 0x45, 0xBC, 0xEB, 0xFD, 0xE2, 0x6, 0x4A, 0x8 }, + new byte[] { 0xF4, 0xDD, 0x85, 0xCF, 0xCE, 0x1E, 0xE2, 0xD1, 0x31, 0x71 }, + new byte[] { 0x1F, 0xA0, 0xC4, 0xE2, 0xB1, 0x40, 0xE1, 0x9D, 0x18, 0xD9 }, + new byte[] { 0x4B, 0x63, 0x4, 0xF6, 0x95, 0x62, 0xE1, 0x68, 0xFF, 0x41 }, + new byte[] { 0x76, 0x27, 0x44, 0x9, 0x78, 0x84, 0xE0, 0x34, 0xE6, 0xAA }, + new byte[] { 0xA2, 0xEA, 0x84, 0x1C, 0x5C, 0xA6, 0xDF, 0xFF, 0xCE, 0x12 }, + new byte[] { 0xCD, 0xAD, 0xC3, 0x2F, 0x3F, 0xC8, 0xDF, 0xCB, 0xB5, 0x7A }, + new byte[] { 0xF9, 0x71, 0x3, 0x42, 0x23, 0xEA, 0xDE, 0x96, 0x9C, 0xE3 }, + new byte[] { 0x24, 0x34, 0x43, 0x56, 0x6, 0xC, 0xDE, 0x62, 0x83, 0x4B }, + new byte[] { 0x50, 0xF7, 0x82, 0x69, 0xEA, 0x2D, 0xDD, 0x2D, 0x6A, 0xB4 }, + new byte[] { 0x7C, 0xBA, 0xC2, 0x7C, 0xCD, 0x4F, 0xDD, 0xF9, 0x51, 0x1C }, + new byte[] { 0xA7, 0x7E, 0x2, 0x8F, 0xB0, 0x71, 0xDC, 0xC4, 0x38, 0x84 }, + new byte[] { 0xD3, 0x41, 0x41, 0xA2, 0x94, 0x93, 0xDC, 0x90, 0x1F, 0xED }, + new byte[] { 0xFE, 0x4, 0x81, 0xB6, 0x77, 0xB5, 0xDB, 0x5B, 0x7, 0x55 }, + new byte[] { 0x2A, 0xC8, 0xC1, 0xC9, 0x5B, 0xD7, 0xDA, 0x27, 0xEE, 0xBD }, + new byte[] { 0x55, 0x8B, 0x1, 0xDC, 0x3E, 0xF9, 0xDA, 0xF2, 0xD5, 0x26 } + }; + return (expectedValues); + } + + [Fact] + public static void ExpectedValues_NextBytesArray() + { + byte[][] expectedValues = ByteValues(); + for (int seed = 0; seed < expectedValues.Length; seed++) + { + byte[] actualValues = new byte[expectedValues[seed].Length]; + var r = new Random(seed); + r.NextBytes(actualValues); + Assert.Equal(expectedValues[seed], actualValues); + } + } + [Fact] public static void Sample() { diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/Random.netcoreapp.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/Random.netcoreapp.cs new file mode 100644 index 0000000000..5d00083f3f --- /dev/null +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/Random.netcoreapp.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Tests +{ + public static partial class RandomTests + { + [Fact] + public static void Empty_Span() + { + int seed = Environment.TickCount; + Random r = new Random(seed); + r.NextBytes(Span.Empty); + } + + [Fact] + public static void Seeded_Span() + { + int seed = Environment.TickCount; + + Random r1 = new Random(seed); + Random r2 = new Random(seed); + + Span s1 = new Span(new byte[1000]); + r1.NextBytes(s1); + Span s2 = new Span(new byte[1000]); + r2.NextBytes(s2); + for (int i = 0; i < s1.Length; i++) + { + Assert.Equal(s1[i], s2[i]); + } + for (int i = 0; i < s1.Length; i++) + { + int x1 = r1.Next(); + int x2 = r2.Next(); + Assert.Equal(x1, x2); + } + } + + [Fact] + public static void ExpectedValues_NextBytesSpan() + { + byte[][] expectedValues = ByteValues(); + for (int seed = 0; seed < expectedValues.Length; seed++) + { + byte[] actualValues = new byte[expectedValues[seed].Length]; + var r = new Random(seed); + r.NextBytes(new Span(actualValues)); + Assert.Equal(expectedValues[seed], actualValues); + } + } + } +} diff --git a/external/corefx/src/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.netcoreapp.cs b/external/corefx/src/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.netcoreapp.cs index 49b10b0fe3..094a9eeb55 100644 --- a/external/corefx/src/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime.Extensions/tests/System/UnloadingAndProcessExitTests.netcoreapp.cs @@ -7,6 +7,7 @@ namespace System.Tests { public class UnloadingAndProcessExitTests : RemoteExecutorTestBase { + [ActiveIssue("https://github.com/dotnet/corefx/issues/23307", TargetFrameworkMonikers.Uap)] [Fact] public void UnloadingEventMustHappenBeforeProcessExitEvent() { @@ -19,10 +20,12 @@ namespace System.Tests Action OnUnloading = i => File.AppendAllText(f, string.Format("u{0}", i)); Action OnProcessExit = i => File.AppendAllText(f, string.Format("e{0}", i)); + File.AppendAllText(f, "s"); AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(0); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += acl => OnUnloading(0); AppDomain.CurrentDomain.ProcessExit += (sender, e) => OnProcessExit(1); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += acl => OnUnloading(1); + File.AppendAllText(f, "h"); return SuccessExitCode; }; @@ -31,7 +34,7 @@ namespace System.Tests { } - Assert.Equal(File.ReadAllText(fileName), "u0u1e0e1"); + Assert.Equal("shu0u1e0e1", File.ReadAllText(fileName)); } } } diff --git a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/dir.props b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/dir.props index 20750540c2..85a6f1a497 100644 --- a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/dir.props +++ b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/Configurations.props b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/Configurations.props index a566650551..c701755863 100644 --- a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/Configurations.props +++ b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/Configurations.props @@ -3,9 +3,6 @@ netcoreapp; - netfx; - net462; - net47; uap; diff --git a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj index 498d891e81..cd6a201800 100644 --- a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj +++ b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/ref/System.Runtime.InteropServices.RuntimeInformation.csproj @@ -6,12 +6,6 @@ - - - - - - diff --git a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Configurations.props b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Configurations.props index 69dfbdb675..f11a8087a1 100644 --- a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Configurations.props +++ b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Configurations.props @@ -2,17 +2,8 @@ - win8-Windows_NT; - wpa81-Windows_NT; - net45-Windows_NT; - netfx-Windows_NT; - net462-Windows_NT; - net47-Windows_NT; uap-Windows_NT; uapaot-Windows_NT; - netstandard1.1-AnyOS; - netstandard1.1-Unix; - netstandard1.1-Windows_NT; netcoreapp-Unix; netcoreapp-Windows_NT; diff --git a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj index 421a09bc6c..b8d6aaafea 100644 --- a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj +++ b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj @@ -22,32 +22,14 @@ $(MSBuildThisFileDirectory)PInvokeAnalyzer_win8-wpa81-APIs.txt - - - - - - - - - - - - - - - - - - Common\Interop\Unix\System.Native\Interop.GetUnixName.cs diff --git a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj index 760bafe99d..e669059993 100644 --- a/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj +++ b/external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/tests/System.Runtime.InteropServices.RuntimeInformation.Tests.csproj @@ -14,9 +14,6 @@ - - Common\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System.Runtime.InteropServices.WindowsRuntime.Tests.csproj b/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System.Runtime.InteropServices.WindowsRuntime.Tests.csproj index 91c5cc86d7..2ff69478d0 100644 --- a/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System.Runtime.InteropServices.WindowsRuntime.Tests.csproj +++ b/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System.Runtime.InteropServices.WindowsRuntime.Tests.csproj @@ -21,9 +21,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshalTests.cs b/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshalTests.cs index 8eb012208a..0fef0d71e7 100644 --- a/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshalTests.cs +++ b/external/corefx/src/System.Runtime.InteropServices.WindowsRuntime/tests/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshalTests.cs @@ -257,7 +257,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime.Tests AssertExtensions.Throws("removeMethod", () => WindowsRuntimeMarshal.RemoveAllEventHandlers(null)); } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWinRTSupported))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsWinRTSupported))] [InlineData("")] [InlineData("HString")] public void StringToHString_PtrToHString_ReturnsExpected(string s) @@ -281,25 +281,25 @@ namespace System.Runtime.InteropServices.WindowsRuntime.Tests } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWinRTSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWinRTSupported))] public void StringToHString_NullString_ThrowsArgumentNullException() { AssertExtensions.Throws("s", () => WindowsRuntimeMarshal.StringToHString(null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWinRTSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWinRTSupported))] public void StringToHString_WinRTNotSupported_ThrowsPlatformNotSupportedException() { Assert.Throws(() => WindowsRuntimeMarshal.StringToHString(null)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWinRTSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWinRTSupported))] public void PtrToStringHString_WinRTNotSupported_ThrowsPlatformNotSupportedException() { Assert.Throws(() => WindowsRuntimeMarshal.PtrToStringHString(IntPtr.Zero)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWinRTSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWinRTSupported))] public void FreeHString_WinRTNotSupported_ThrowsPlatformNotSupportedException() { Assert.Throws(() => WindowsRuntimeMarshal.FreeHString(IntPtr.Zero)); diff --git a/external/corefx/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/external/corefx/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index b795f5a0aa..3f36a1dd88 100644 --- a/external/corefx/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/external/corefx/src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -7,6 +7,8 @@ // Types moved down into System.Runtime.Handles [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.CriticalHandle))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandle))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandleType))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.SafeHandle))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Reflection.Missing))] @@ -103,11 +105,13 @@ namespace System.IO protected unsafe void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access) { } protected void Initialize(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { } public override int Read(byte[] buffer, int offset, int count) { throw null; } + public override int Read(System.Span destination) { throw null; } public override System.Threading.Tasks.Task ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; } public override int ReadByte() { throw null; } public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; } public override void SetLength(long value) { } public override void Write(byte[] buffer, int offset, int count) { } + public override void Write(System.ReadOnlySpan source) { } public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; } public override void WriteByte(byte value) { } } @@ -391,31 +395,6 @@ namespace System.Runtime.InteropServices public ErrorWrapper(object errorCode) { } public int ErrorCode { get { throw null; } } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct GCHandle - { - public bool IsAllocated { get { throw null; } } - public object Target {get { throw null; } set { } } - public System.IntPtr AddrOfPinnedObject() { throw null; } - public static System.Runtime.InteropServices.GCHandle Alloc(object value) { throw null; } - public static System.Runtime.InteropServices.GCHandle Alloc(object value, System.Runtime.InteropServices.GCHandleType type) { throw null; } - public override bool Equals(object o) { throw null; } - public void Free() { } - public static System.Runtime.InteropServices.GCHandle FromIntPtr(System.IntPtr value) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; } - public static explicit operator System.Runtime.InteropServices.GCHandle(System.IntPtr value) { throw null; } - public static explicit operator System.IntPtr(System.Runtime.InteropServices.GCHandle value) { throw null; } - public static bool operator !=(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; } - public static System.IntPtr ToIntPtr(System.Runtime.InteropServices.GCHandle value) { throw null; } - } - public enum GCHandleType - { - Normal = 2, - Pinned = 3, - Weak = 0, - WeakTrackResurrection = 1, - } [System.AttributeUsageAttribute((System.AttributeTargets)(5149), Inherited = false)] public sealed partial class GuidAttribute : System.Attribute { diff --git a/external/corefx/src/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj b/external/corefx/src/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj index 003e959ba9..596c5f404a 100644 --- a/external/corefx/src/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj +++ b/external/corefx/src/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj @@ -61,9 +61,6 @@ - - Common\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.Windows.cs b/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.Windows.cs index bf3b4ab9c8..916308a1c8 100644 --- a/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.Windows.cs +++ b/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.Windows.cs @@ -13,7 +13,7 @@ namespace System.Runtime.InteropServices.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not approved COM object for app")] public partial class ComAwareEventInfoTests { - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "ComEventsHelper.Combine throws a PNSE in .NET Core")] public void AddEventHandler_DispIdAttribute_ThrowsPlatformNotSupportedException() { @@ -37,7 +37,7 @@ namespace System.Runtime.InteropServices.Tests public void Event() { } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void AddEventHandler_ComObjectWithoutComEventInterfaceAttribute_ThrowsInvalidOperationException() { var attribute = new ComAwareEventInfo(typeof(NonComObject), nameof(NonComObject.Event)); @@ -48,7 +48,7 @@ namespace System.Runtime.InteropServices.Tests Assert.Throws(() => attribute.RemoveEventHandler(target, handler)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void AddEventHandler_ComObjectWithMultipleComEventInterfaceAttribute_ThrowsAmbiguousMatchException() { // C# doesn't let us apply multiple ComEventInterface values, so RefEmit is necessary. @@ -72,7 +72,7 @@ namespace System.Runtime.InteropServices.Tests Assert.Throws(() => attribute.RemoveEventHandler(target, handler)); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void AddEventHandler_NullSourceTypeEventInterface_ThrowsNullReferenceException() { var attribute = new ComAwareEventInfo(typeof(NullSourceType), nameof(NullSourceType.Event)); @@ -89,7 +89,7 @@ namespace System.Runtime.InteropServices.Tests event EventHandler Event; } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void AddEventHandler_NoSuchSourceTypeEventInterface_ThrowsArgumentNullException() { var attribute = new ComAwareEventInfo(typeof(NoSuchSourceType), nameof(NoSuchSourceType.Event)); @@ -106,7 +106,7 @@ namespace System.Runtime.InteropServices.Tests event EventHandler Event; } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] public void AddEventHandler_NoDispIdAttribute_ThrowsInvalidOperationException() { var attribute = new ComAwareEventInfo(typeof(NoDispAttributeInterface), nameof(NoDispAttributeInterface.Event)); diff --git a/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.Windows.cs b/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.Windows.cs index 16c66b9e5f..f6f3c79b10 100644 --- a/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.Windows.cs +++ b/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.Windows.cs @@ -17,7 +17,7 @@ namespace System.Runtime.InteropServices yield return new object[] { new InterfaceComImportObject(), false }; } - [ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] [MemberData(nameof(IsComImport_Windows_ReturnsExpected))] [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Not approved COM object for app")] public void IsComObject_Windows_ReturnsExpected(object value, bool expected) diff --git a/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs b/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs index 4b4f220eec..ebdbfb305a 100644 --- a/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs +++ b/external/corefx/src/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/MarshalTests.cs @@ -245,6 +245,24 @@ namespace System.Runtime.InteropServices } } + [Fact] + public static void ValidateExceptionForHRAPI() + { + int errorCode = -2146231029; + COMException getHRException = Marshal.GetExceptionForHR(errorCode) as COMException; + Assert.NotNull(getHRException); + Assert.Equal(errorCode, getHRException.HResult); + try + { + Marshal.ThrowExceptionForHR(errorCode); + } + catch (COMException e) + { + Assert.Equal(errorCode, e.HResult); + Assert.Equal(e.HResult, getHRException.HResult); + } + } + [Fact] public static void GetHRForException() { @@ -254,7 +272,7 @@ namespace System.Runtime.InteropServices { Assert.Equal(0, Marshal.GetHRForException(null)); - Assert.InRange(Marshal.GetHRForException(e), int.MinValue, -1); + Assert.InRange(Marshal.GetHRForException(e), int.MinValue, -1); Assert.Equal(e.HResult, Marshal.GetHRForException(e)); } finally diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/System.Runtime.Intrinsics.X86.sln b/external/corefx/src/System.Runtime.Intrinsics.X86/System.Runtime.Intrinsics.X86.sln new file mode 100644 index 0000000000..1278c3d520 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/System.Runtime.Intrinsics.X86.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{F8DD26AC-C306-481B-B0DA-E7D4CD4EF6D7}" + ProjectSection(SolutionItems) = preProject + ref\Configurations.props = ref\Configurations.props + ref\System.Runtime.Intrinsics.X86.cs = ref\System.Runtime.Intrinsics.X86.cs + ref\System.Runtime.Intrinsics.X86.csproj = ref\System.Runtime.Intrinsics.X86.csproj + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4F13FF59-6559-4930-B226-5610D85685CD}" + ProjectSection(SolutionItems) = preProject + src\Configurations.props = src\Configurations.props + src\System.Runtime.Intrinsics.X86.csproj = src\System.Runtime.Intrinsics.X86.csproj + EndProjectSection +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/dir.props b/external/corefx/src/System.Runtime.Intrinsics.X86/dir.props new file mode 100644 index 0000000000..37b9ee82d7 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/dir.props @@ -0,0 +1,9 @@ + + + + + 4.0.0.0 + true + Open + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/ref/Configurations.props b/external/corefx/src/System.Runtime.Intrinsics.X86/ref/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/ref/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/ref/System.Runtime.Intrinsics.X86.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Intrinsics.X86/ref/System.Runtime.Intrinsics.X86.cs.REMOVED.git-id new file mode 100644 index 0000000000..f567078865 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/ref/System.Runtime.Intrinsics.X86.cs.REMOVED.git-id @@ -0,0 +1 @@ +c9f0274438bb6177311f1ab1eb284484b6a30b57 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/ref/System.Runtime.Intrinsics.X86.csproj b/external/corefx/src/System.Runtime.Intrinsics.X86/ref/System.Runtime.Intrinsics.X86.csproj new file mode 100644 index 0000000000..50432ac3c5 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/ref/System.Runtime.Intrinsics.X86.csproj @@ -0,0 +1,17 @@ + + + + + true + false + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/src/Configurations.props b/external/corefx/src/System.Runtime.Intrinsics.X86/src/Configurations.props new file mode 100644 index 0000000000..1040c9ba37 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/src/Configurations.props @@ -0,0 +1,9 @@ + + + + + netcoreapp-Windows_NT; + netcoreapp-Unix; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Intrinsics.X86/src/System.Runtime.Intrinsics.X86.csproj b/external/corefx/src/System.Runtime.Intrinsics.X86/src/System.Runtime.Intrinsics.X86.csproj new file mode 100644 index 0000000000..361d1abfa5 --- /dev/null +++ b/external/corefx/src/System.Runtime.Intrinsics.X86/src/System.Runtime.Intrinsics.X86.csproj @@ -0,0 +1,16 @@ + + + + + System.Runtime.Intrinsics.X86 + true + + + + + + + + + + diff --git a/external/corefx/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj b/external/corefx/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj index 5e77a0cd96..8f0e8993c2 100644 --- a/external/corefx/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj +++ b/external/corefx/src/System.Runtime.Loader/ref/System.Runtime.Loader.csproj @@ -4,6 +4,8 @@ true {FB507A82-ACDD-4809-A030-6F9372A71194} + + $(NoWarn);0067 diff --git a/external/corefx/src/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj b/external/corefx/src/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj index 6863d1c5d3..15e9701c2d 100644 --- a/external/corefx/src/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj +++ b/external/corefx/src/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj @@ -20,7 +20,7 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Numerics/System.Runtime.Numerics.sln b/external/corefx/src/System.Runtime.Numerics/System.Runtime.Numerics.sln index 0f063ecf11..780e3dd8ff 100644 --- a/external/corefx/src/System.Runtime.Numerics/System.Runtime.Numerics.sln +++ b/external/corefx/src/System.Runtime.Numerics/System.Runtime.Numerics.sln @@ -7,6 +7,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Numerics.Tes {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B} = {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Numerics.Performance.Tests", "tests\Performance\System.Runtime.Numerics.Performance.Tests.csproj", "{3842BE38-1A99-41B2-81B5-186E64077B95}" + ProjectSection(ProjectDependencies) = postProject + {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B} = {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B} + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Numerics", "src\System.Runtime.Numerics.csproj", "{D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B}" ProjectSection(ProjectDependencies) = postProject {7D5CBF2F-337C-4AEB-B035-A17D33A9BC1F} = {7D5CBF2F-337C-4AEB-B035-A17D33A9BC1F} @@ -26,10 +31,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU - {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU - {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU - {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {28AE24F8-BEF4-4358-B612-ADD9D587C8E1}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {3842BE38-1A99-41B2-81B5-186E64077B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3842BE38-1A99-41B2-81B5-186E64077B95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3842BE38-1A99-41B2-81B5-186E64077B95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3842BE38-1A99-41B2-81B5-186E64077B95}.Release|Any CPU.Build.0 = Release|Any CPU {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU @@ -44,6 +53,7 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {28AE24F8-BEF4-4358-B612-ADD9D587C8E1} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {3842BE38-1A99-41B2-81B5-186E64077B95} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {D2C99D27-0BEF-4319-ADB3-05CBEBA8F69B} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} {7D5CBF2F-337C-4AEB-B035-A17D33A9BC1F} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} EndGlobalSection diff --git a/external/corefx/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs b/external/corefx/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs index eeb9a6fef7..d1e87b9a0a 100644 --- a/external/corefx/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs +++ b/external/corefx/src/System.Runtime.Numerics/ref/System.Runtime.Numerics.cs @@ -13,6 +13,7 @@ namespace System.Numerics { [System.CLSCompliantAttribute(false)] public BigInteger(byte[] value) { throw null; } + public BigInteger(System.ReadOnlySpan value) { throw null; } public BigInteger(decimal value) { throw null; } public BigInteger(double value) { throw null; } public BigInteger(int value) { throw null; } @@ -46,6 +47,7 @@ namespace System.Numerics [System.CLSCompliantAttribute(false)] public bool Equals(ulong other) { throw null; } public override int GetHashCode() { throw null; } + public int GetByteCount() { throw null; } public static System.Numerics.BigInteger GreatestCommonDivisor(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } public static double Log(System.Numerics.BigInteger value) { throw null; } public static double Log(System.Numerics.BigInteger value, double baseValue) { throw null; } @@ -146,6 +148,7 @@ namespace System.Numerics public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } public static System.Numerics.BigInteger Parse(string value, System.IFormatProvider provider) { throw null; } + public static System.Numerics.BigInteger Parse(System.ReadOnlySpan value, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider provider = null) { throw null; } public static System.Numerics.BigInteger Pow(System.Numerics.BigInteger value, int exponent) { throw null; } public static System.Numerics.BigInteger Remainder(System.Numerics.BigInteger dividend, System.Numerics.BigInteger divisor) { throw null; } public static System.Numerics.BigInteger Subtract(System.Numerics.BigInteger left, System.Numerics.BigInteger right) { throw null; } @@ -156,6 +159,8 @@ namespace System.Numerics public string ToString(string format, System.IFormatProvider provider) { throw null; } public static bool TryParse(string value, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Numerics.BigInteger result) { throw null; } public static bool TryParse(string value, out System.Numerics.BigInteger result) { throw null; } + public static bool TryParse(ReadOnlySpan value, out System.Numerics.BigInteger result, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider provider = null) { throw null; } + public bool TryWriteBytes(System.Span destination, out int bytesWritten) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct Complex : System.IEquatable, System.IFormattable diff --git a/external/corefx/src/System.Runtime.Numerics/src/System/Globalization/FormatProvider.BigInteger.cs b/external/corefx/src/System.Runtime.Numerics/src/System/Globalization/FormatProvider.BigInteger.cs index 2db17923bb..c8ff75f9e6 100644 --- a/external/corefx/src/System.Runtime.Numerics/src/System/Globalization/FormatProvider.BigInteger.cs +++ b/external/corefx/src/System.Runtime.Numerics/src/System/Globalization/FormatProvider.BigInteger.cs @@ -33,7 +33,7 @@ namespace System.Globalization [SecurityCritical] internal static bool TryStringToBigInteger( - string s, + ReadOnlySpan s, NumberStyles styles, NumberFormatInfo numberFormatInfo, StringBuilder receiver, // Receives the decimal digits diff --git a/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs b/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs index ac987bf474..82ee609fe8 100644 --- a/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs +++ b/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs @@ -135,10 +135,17 @@ namespace System.Numerics public BigInteger(double value) { - if (double.IsInfinity(value)) - throw new OverflowException(SR.Overflow_BigIntInfinity); - if (double.IsNaN(value)) - throw new OverflowException(SR.Overflow_NotANumber); + if (!double.IsFinite(value)) + { + if (double.IsInfinity(value)) + { + throw new OverflowException(SR.Overflow_BigIntInfinity); + } + else // NaN + { + throw new OverflowException(SR.Overflow_NotANumber); + } + } Contract.EndContractBlock(); _sign = 0; @@ -246,17 +253,32 @@ namespace System.Numerics /// /// [CLSCompliant(false)] - public BigInteger(byte[] value) + public BigInteger(byte[] value) : + this(new ReadOnlySpan(value ?? throw new ArgumentNullException(nameof(value)))) { - if (value == null) - throw new ArgumentNullException(nameof(value)); - Contract.EndContractBlock(); + } + public BigInteger(ReadOnlySpan value) + { int byteCount = value.Length; - bool isNegative = byteCount > 0 && ((value[byteCount - 1] & 0x80) == 0x80); - // Try to conserve space as much as possible by checking for wasted leading byte[] entries - while (byteCount > 0 && value[byteCount - 1] == 0) byteCount--; + bool isNegative; + if (byteCount > 0) + { + byte lastByte = value[byteCount - 1]; + isNegative = (lastByte & 0x80) != 0; + if (lastByte == 0) + { + // Try to conserve space as much as possible by checking for wasted leading byte[] entries + byteCount -= 2; + while (byteCount >= 0 && value[byteCount] == 0) byteCount--; + byteCount++; + } + } + else + { + isNegative = false; + } if (byteCount == 0) { @@ -269,50 +291,42 @@ namespace System.Numerics if (byteCount <= 4) { - if (isNegative) - _sign = unchecked((int)0xffffffff); - else - _sign = 0; + _sign = isNegative ? unchecked((int)0xffffffff) : 0; for (int i = byteCount - 1; i >= 0; i--) { - _sign <<= 8; - _sign |= value[i]; + _sign = (_sign << 8) | value[i]; } - _bits = null; + _bits = null; if (_sign < 0 && !isNegative) { // Int32 overflow // Example: Int64 value 2362232011 (0xCB, 0xCC, 0xCC, 0x8C, 0x0) // can be naively packed into 4 bytes (due to the leading 0x0) // it overflows into the int32 sign bit - _bits = new uint[1]; - _bits[0] = unchecked((uint)_sign); + _bits = new uint[1] { unchecked((uint)_sign) }; _sign = +1; } if (_sign == int.MinValue) + { this = s_bnMinInt; + } } else { int unalignedBytes = byteCount % 4; int dwordCount = byteCount / 4 + (unalignedBytes == 0 ? 0 : 1); - bool isZero = true; uint[] val = new uint[dwordCount]; // Copy all dwords, except but don't do the last one if it's not a full four bytes - int curDword, curByte, byteInDword; - curByte = 3; + int curDword, curByte = 3; for (curDword = 0; curDword < dwordCount - (unalignedBytes == 0 ? 0 : 1); curDword++) { - byteInDword = 0; - while (byteInDword < 4) + for (int byteInDword = 0; byteInDword < 4; byteInDword++) { - if (value[curByte] != 0x00) isZero = false; - val[curDword] <<= 8; - val[curDword] |= value[curByte]; + byte curByteValue = value[curByte]; + val[curDword] = (val[curDword] << 8) | curByteValue; curByte--; - byteInDword++; } curByte += 8; } @@ -323,41 +337,46 @@ namespace System.Numerics if (isNegative) val[dwordCount - 1] = 0xffffffff; for (curByte = byteCount - 1; curByte >= byteCount - unalignedBytes; curByte--) { - if (value[curByte] != 0x00) isZero = false; - val[curDword] <<= 8; - val[curDword] |= value[curByte]; + byte curByteValue = value[curByte]; + val[curDword] = (val[curDword] << 8) | curByteValue; } } - if (isZero) - { - this = s_bnZeroInt; - } - else if (isNegative) + if (isNegative) { NumericsHelpers.DangerousMakeTwosComplement(val); // Mutates val // Pack _bits to remove any wasted space after the twos complement - int len = val.Length; - while (len > 0 && val[len - 1] == 0) - len--; - if (len == 1 && unchecked((int)(val[0])) > 0) + int len = val.Length - 1; + while (len >= 0 && val[len] == 0) len--; + len++; + + if (len == 1) { - if (val[0] == 1 /* abs(-1) */) + switch (val[0]) { - this = s_bnMinusOneInt; - } - else if (val[0] == kuMaskHighBit /* abs(Int32.MinValue) */) - { - this = s_bnMinInt; - } - else - { - _sign = (-1) * ((int)val[0]); - _bits = null; + case 1: // abs(-1) + this = s_bnMinusOneInt; + return; + + case kuMaskHighBit: // abs(Int32.MinValue) + this = s_bnMinInt; + return; + + default: + if (unchecked((int)val[0]) > 0) + { + _sign = (-1) * ((int)val[0]); + _bits = null; + AssertValid(); + return; + } + + break; } } - else if (len != val.Length) + + if (len != val.Length) { _sign = -1; _bits = new uint[len]; @@ -600,6 +619,16 @@ namespace System.Numerics return BigNumber.TryParseBigInteger(value, style, NumberFormatInfo.GetInstance(provider), out result); } + public static BigInteger Parse(ReadOnlySpan value, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) + { + return BigNumber.ParseBigInteger(value, style, NumberFormatInfo.GetInstance(provider)); + } + + public static bool TryParse(ReadOnlySpan value, out BigInteger result, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null) + { + return BigNumber.TryParseBigInteger(value, style, NumberFormatInfo.GetInstance(provider), out result); + } + public static int Compare(BigInteger left, BigInteger right) { return left.CompareTo(right); @@ -1019,10 +1048,76 @@ namespace System.Numerics /// public byte[] ToByteArray() { + int ignored = 0; + return TryGetBytes(GetBytesMode.AllocateArray, default(Span), ref ignored); + } + + /// + /// Copies the value of this BigInteger as little-endian twos-complement + /// bytes, using the fewest number of bytes possible. If the value is zero, + /// outputs one byte whose element is 0x00. + /// + /// The destination span to which the resulting bytes should be written. + /// The number of bytes written to . + /// true if the bytes fit in ; false if not all bytes could be written due to lack of space. + public bool TryWriteBytes(Span destination, out int bytesWritten) + { + bytesWritten = 0; + return TryGetBytes(GetBytesMode.Span, destination, ref bytesWritten) != null; + } + + /// Gets the number of bytes that will be output by and . + /// The number of bytes. + public int GetByteCount() + { + int count = 0; + TryGetBytes(GetBytesMode.Count, default(Span), ref count); + return count; + } + + /// Mode used to enable sharing for multiple purposes. + private enum GetBytesMode { AllocateArray, Count, Span } + + /// Dummy array returned from TryGetBytes to indicate success when in span mode. + private static readonly byte[] s_success = Array.Empty(); + + /// Shared logic for , , and . + /// Which entry point is being used. + /// The destination span, if mode is . + /// + /// If ==, ignored. + /// If ==, the number of bytes that would be written. + /// If ==, the number of bytes written to the span. + /// + /// + /// If ==, the result array. + /// If ==, null. + /// If ==, non-null if the span was long enough, null if there wasn't enough room. + /// + private byte[] TryGetBytes(GetBytesMode mode, Span destination, ref int bytesWritten) + { + Debug.Assert(mode == GetBytesMode.AllocateArray || mode == GetBytesMode.Count || mode == GetBytesMode.Span, $"Unexpected mode {mode}."); + Debug.Assert(mode == GetBytesMode.Span || destination.IsEmpty, $"If we're not in span mode, we shouldn't have been passed a destination."); + int sign = _sign; if (sign == 0) { - return new byte[] { 0 }; + switch (mode) + { + case GetBytesMode.AllocateArray: + return new byte[] { 0 }; + case GetBytesMode.Count: + bytesWritten = 1; + return null; + default: // case GetBytesMode.Span: + if (destination.Length != 0) + { + destination[0] = 0; + bytesWritten = 1; + return s_success; + } + return null; + } } byte highByte; @@ -1091,20 +1186,38 @@ namespace System.Numerics // Ensure high bit is 0 if positive, 1 if negative bool needExtraByte = (msb & 0x80) != (highByte & 0x80); - byte[] bytes; - int curByte = 0; - if (bits == null) + int length = msbIndex + 1 + (needExtraByte ? 1 : 0); + if (bits != null) { - bytes = new byte[msbIndex + 1 + (needExtraByte ? 1 : 0)]; - Debug.Assert(bytes.Length <= 4); + length = checked(4 * (bits.Length - 1) + length); } - else - { - bytes = new byte[checked(4 * (bits.Length - 1) + msbIndex + 1 + (needExtraByte ? 1 : 0))]; + byte[] array; + switch (mode) + { + case GetBytesMode.AllocateArray: + destination = array = new byte[length]; + break; + case GetBytesMode.Count: + bytesWritten = length; + return null; + default: // case GetBytesMode.Span: + if (destination.Length < length) + { + return null; + } + bytesWritten = length; + array = s_success; + break; + } + + int curByte = 0; + if (bits != null) + { for (int i = 0; i < bits.Length - 1; i++) { uint dword = bits[i]; + if (sign == -1) { dword = ~dword; @@ -1113,23 +1226,36 @@ namespace System.Numerics dword = unchecked(dword + 1U); } } - for (int j = 0; j < 4; j++) + + destination[curByte++] = unchecked((byte)dword); + destination[curByte++] = unchecked((byte)(dword >> 8)); + destination[curByte++] = unchecked((byte)(dword >> 16)); + destination[curByte++] = unchecked((byte)(dword >> 24)); + } + } + + Debug.Assert(msbIndex >= 0 && msbIndex <= 3); + destination[curByte] = unchecked((byte)highDword); + if (msbIndex != 0) + { + destination[++curByte] = unchecked((byte)(highDword >> 8)); + if (msbIndex != 1) + { + destination[++curByte] = unchecked((byte)(highDword >> 16)); + if (msbIndex != 2) { - bytes[curByte++] = unchecked((byte)dword); - dword >>= 8; + destination[++curByte] = unchecked((byte)(highDword >> 24)); } } } - for (int j = 0; j <= msbIndex; j++) - { - bytes[curByte++] = unchecked((byte)highDword); - highDword >>= 8; - } + + Debug.Assert((!needExtraByte && curByte == length - 1) || (needExtraByte && curByte == length - 2)); if (needExtraByte) { - bytes[bytes.Length - 1] = highByte; + destination[length - 1] = highByte; } - return bytes; + + return array; } /// diff --git a/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs b/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs index ebc1a92686..ebf3e34593 100644 --- a/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs +++ b/external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs @@ -324,6 +324,18 @@ namespace System.Numerics [SecuritySafeCritical] internal static bool TryParseBigInteger(string value, NumberStyles style, NumberFormatInfo info, out BigInteger result) + { + if (value == null) + { + result = default(BigInteger); + return false; + } + + return TryParseBigInteger(AsReadOnlySpan(value), style, info, out result); + } + + [SecuritySafeCritical] + internal static bool TryParseBigInteger(ReadOnlySpan value, NumberStyles style, NumberFormatInfo info, out BigInteger result) { unsafe { @@ -357,8 +369,26 @@ namespace System.Numerics internal static BigInteger ParseBigInteger(string value, NumberStyles style, NumberFormatInfo info) { if (value == null) + { throw new ArgumentNullException(nameof(value)); + } + return ParseBigInteger(AsReadOnlySpan(value), style, info); + } + + // TODO #22688: Remove this and replace it with the real AsReadOnlySpan extension + // method from System.Memory once the System.Memory package is marked stable + // and the package validation system allows us to take a dependency on it. + private static unsafe ReadOnlySpan AsReadOnlySpan(string s) + { + fixed (char* c = s) + { + return new ReadOnlySpan(c, s.Length); + } + } + + internal static BigInteger ParseBigInteger(ReadOnlySpan value, NumberStyles style, NumberFormatInfo info) + { ArgumentException e; if (!TryValidateParseStyleInteger(style, out e)) throw e; diff --git a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ToByteArray.cs b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ToByteArray.cs index 60e1a9ad9c..224e23f27e 100644 --- a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ToByteArray.cs +++ b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ToByteArray.cs @@ -2,36 +2,42 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; using Xunit; namespace System.Numerics.Tests { - public class ToByteArrayTest + public partial class ExtractBytesMembersTests { + public static IEnumerable FromIntTests_MemberData() + { + yield return new object[] { 0, new byte[] { 0x00 } }; + yield return new object[] { 3, new byte[] { 0x03 } }; + yield return new object[] { 128, new byte[] { 0x80, 0x00 } }; + yield return new object[] { 200, new byte[] { 0xc8, 0x00 } }; + yield return new object[] { 256, new byte[] { 0x00, 0x01 } }; + yield return new object[] { 2005, new byte[] { 0xd5, 0x07 } }; + yield return new object[] { 10197, new byte[] { 0xd5, 0x27 } }; + yield return new object[] { 33023, new byte[] { 0xff, 0x80, 0x00 } }; + yield return new object[] { 2368349, new byte[] { 0x5d, 0x23, 0x24 } }; + yield return new object[] { 10756957, new byte[] { 0x5d, 0x23, 0xa4, 0x00 } }; + yield return new object[] { 193100307, new byte[] { 0x13, 0x7a, 0x82, 0x0b } }; + yield return new object[] { 1266842131, new byte[] { 0x13, 0x7a, 0x82, 0x4b } }; + yield return new object[] { int.MaxValue, new byte[] { 0xff, 0xff, 0xff, 0x7f } }; + yield return new object[] { -1, new byte[] { 0xff } }; + yield return new object[] { -128, new byte[] { 0x80 } }; + yield return new object[] { -172, new byte[] { 0x54, 0xff } }; + yield return new object[] { -23439, new byte[] { 0x71, 0xa4 } }; + yield return new object[] { -51301, new byte[] { 0x9b, 0x37, 0xff } }; + yield return new object[] { -126341, new byte[] { 0x7b, 0x12, 0xfe } }; + yield return new object[] { -13194515, new byte[] { 0xed, 0xaa, 0x36, 0xff } }; + yield return new object[] { -2068145902, new byte[] { 0x12, 0x99, 0xba, 0x84 } }; + yield return new object[] { int.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x80 } }; + } + [Theory] - [InlineData(0, new byte[] { 0x00 })] - [InlineData(3, new byte[] { 0x03 })] - [InlineData(128, new byte[] { 0x80, 0x00 })] - [InlineData(200, new byte[] { 0xc8, 0x00 })] - [InlineData(256, new byte[] { 0x00, 0x01 })] - [InlineData(2005, new byte[] { 0xd5, 0x07 })] - [InlineData(10197, new byte[] { 0xd5, 0x27 })] - [InlineData(33023, new byte[] { 0xff, 0x80, 0x00 })] - [InlineData(2368349, new byte[] { 0x5d, 0x23, 0x24 })] - [InlineData(10756957, new byte[] { 0x5d, 0x23, 0xa4, 0x00 })] - [InlineData(193100307, new byte[] { 0x13, 0x7a, 0x82, 0x0b })] - [InlineData(1266842131, new byte[] { 0x13, 0x7a, 0x82, 0x4b })] - [InlineData(int.MaxValue, new byte[] { 0xff, 0xff, 0xff, 0x7f })] - [InlineData(-1, new byte[] { 0xff })] - [InlineData(-128, new byte[] { 0x80 })] - [InlineData(-172, new byte[] { 0x54, 0xff })] - [InlineData(-23439, new byte[] { 0x71, 0xa4 })] - [InlineData(-51301, new byte[] { 0x9b, 0x37, 0xff })] - [InlineData(-126341, new byte[] { 0x7b, 0x12, 0xfe })] - [InlineData(-13194515, new byte[] { 0xed, 0xaa, 0x36, 0xff })] - [InlineData(-2068145902, new byte[] { 0x12, 0x99, 0xba, 0x84 })] - [InlineData(int.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x80 })] - public void FromIntTests(int i, byte[] expectedBytes) + [MemberData(nameof(FromIntTests_MemberData))] + public void ToByteArray_FromIntTests(int i, byte[] expectedBytes) { BigInteger bi = new BigInteger(i); byte[] bytes = bi.ToByteArray(); @@ -40,34 +46,39 @@ namespace System.Numerics.Tests Assert.Equal(bi, bi2); } + public static IEnumerable FromLongTests_MemberData() + { + yield return new object[] { 0x100112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x01 } }; + yield return new object[] { 0x300112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x03 } }; + yield return new object[] { 0x8000112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x80, 0x00 } }; + yield return new object[] { 0x3cd00112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0xcd, 0x03 } }; + yield return new object[] { 0xf92100112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x21, 0xf9, 0x00 } }; + yield return new object[] { 0x749aa00112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0xaa, 0x49, 0x07 } }; + yield return new object[] { 0x80112200112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x22, 0x11, 0x80, 0x00 } }; + yield return new object[] { 0x7654321000112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x10, 0x32, 0x54, 0x76 } }; + yield return new object[] { long.MaxValue, new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f } }; + yield return new object[] { -0x100112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xfe } }; + yield return new object[] { -0x8000112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0x7f, 0xff } }; + yield return new object[] { -0x3cd00112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0x32, 0xfc } }; + yield return new object[] { -0xf92100112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xde, 0x06, 0xff } }; + yield return new object[] { -0x749aa00112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0x55, 0xb6, 0xf8 } }; + yield return new object[] { -0x80112200112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xdd, 0xee, 0x7f, 0xff } }; + yield return new object[] { -0x7654321000112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xef, 0xcd, 0xab, 0x89 } }; + yield return new object[] { long.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 } }; + yield return new object[] { -0x100000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xff } }; + yield return new object[] { -0x300000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xfd } }; + yield return new object[] { -0x8000000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x80 } }; + yield return new object[] { -0xfe00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x02, 0xff } }; + yield return new object[] { -0xff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0xff } }; + yield return new object[] { -0xfeff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xff } }; + yield return new object[] { -0xffff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff } }; + yield return new object[] { -0xfeffff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0xff } }; + yield return new object[] { -0xffffff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff } }; + } + [Theory] - [InlineData(0x100112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x01 })] - [InlineData(0x300112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x03 })] - [InlineData(0x8000112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x80, 0x00 })] - [InlineData(0x3cd00112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0xcd, 0x03 })] - [InlineData(0xf92100112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x21, 0xf9, 0x00 })] - [InlineData(0x749aa00112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0xaa, 0x49, 0x07 })] - [InlineData(0x80112200112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x22, 0x11, 0x80, 0x00 })] - [InlineData(0x7654321000112233L, new byte[] { 0x33, 0x22, 0x11, 0x00, 0x10, 0x32, 0x54, 0x76 })] - [InlineData(long.MaxValue, new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f })] - [InlineData(-0x100112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xfe })] - [InlineData(-0x8000112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0x7f, 0xff })] - [InlineData(-0x3cd00112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0x32, 0xfc })] - [InlineData(-0xf92100112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xde, 0x06, 0xff })] - [InlineData(-0x749aa00112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0x55, 0xb6, 0xf8 })] - [InlineData(-0x80112200112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xdd, 0xee, 0x7f, 0xff })] - [InlineData(-0x7654321000112233L, new byte[] { 0xcd, 0xdd, 0xee, 0xff, 0xef, 0xcd, 0xab, 0x89 })] - [InlineData(long.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 })] - [InlineData(-0x100000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xff })] - [InlineData(-0x300000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xfd })] - [InlineData(-0x8000000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x80 })] - [InlineData(-0xfe00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x02, 0xff })] - [InlineData(-0xff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0xff })] - [InlineData(-0xfeff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xff })] - [InlineData(-0xffff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff })] - [InlineData(-0xfeffff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0xff })] - [InlineData(-0xffffff00000000L, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff })] - public void FromLongTests(long l, byte[] expectedBytes) + [MemberData(nameof(FromLongTests_MemberData))] + public void ToByteArray_FromLongTests(long l, byte[] expectedBytes) { BigInteger bi = new BigInteger(l); byte[] bytes = bi.ToByteArray(); @@ -76,12 +87,16 @@ namespace System.Numerics.Tests Assert.Equal(bi, bi2); } + public static IEnumerable FromStringTests_MemberData() + { + yield return new object[] { "-18374686475376656384", new byte[] { 0xff, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } }; + yield return new object[] { "-18446744069414584320", new byte[] { 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } }; + yield return new object[] { "12364093636075302621581796971036731159910277399901099375861080574506898189967563102391591201943540153492149033597384108294298661111799425262742266671957323486506857011293831406641316917374615487590434666756862524718179898130435474398176187353530443750986128762955255137790631223519091107256083370837751230886741470719554141609004126665185940207631783192780186624919167901565253877397154522582982120840364212333366972597473045167409184762879376102731157263235904816835054250885637739932914015117504485702897712016943555929710070193511128651378003670520306509417025958556935067307123832592173743652726898616663215056178200135054604939862749863002480827458494339065850786495122398411385446068167146399066035389699059499954747263948595492570959736940353095030589033792026029085438901525807032848103038290802923997216273712349905230080849822000411239032166420681788646737098078876258256753058713515144604794792139863186822520361187685685356628044518258989638970651859178568755065879235553215218267011024902142765549091793970027321040036512883269922219608216030987714165823965404563131018846411947569009598716649463301689241563037584803938711917477764863093448004918315253652379776337794243677630540042379049027", new byte[] { 0x00, 0xf0, 0x1d, 0x7b, 0xa2, 0xfd, 0x50, 0xf9, 0x50, 0x07, 0xce, 0x2a, 0xdf, 0xfb, 0x75, 0x70, 0x49, 0x5e, 0x5d, 0xf7, 0x1b, 0x0a, 0x76, 0x1f, 0xe7, 0xe3, 0xc7, 0x0a, 0xc7, 0xee, 0xca, 0x4e, 0xa2, 0xe6, 0xae, 0xe8, 0x1a, 0x2c, 0x3b, 0xa9, 0x12, 0x77, 0xb1, 0x47, 0x3c, 0xb5, 0xab, 0x32, 0x26, 0x18, 0x0d, 0x43, 0x51, 0x6b, 0x11, 0x0c, 0x45, 0xed, 0x52, 0x7d, 0xce, 0xe8, 0x75, 0x6c, 0xe1, 0xda, 0xaf, 0x42, 0x1c, 0xc6, 0x21, 0x23, 0x1f, 0x5d, 0x2d, 0x48, 0xf8, 0x20, 0x67, 0x2f, 0x49, 0x3d, 0x3e, 0x5d, 0xc2, 0x53, 0xc8, 0xe0, 0x3d, 0xe2, 0xdc, 0x51, 0x2f, 0x44, 0xc9, 0x72, 0xb6, 0x04, 0xa0, 0x19, 0x1f, 0x03, 0xb9, 0x0f, 0x57, 0x80, 0x55, 0x41, 0x10, 0x7e, 0x7c, 0x78, 0xdc, 0xbb, 0x82, 0x6e, 0x6a, 0xd9, 0x0e, 0xac, 0x87, 0x0c, 0xfd, 0xc0, 0x79, 0xdf, 0xf5, 0x98, 0xfe, 0x9c, 0x58, 0xa9, 0x63, 0xc2, 0x99, 0x31, 0x09, 0x1c, 0x50, 0xcf, 0x03, 0x4f, 0x96, 0xef, 0x98, 0x56, 0x44, 0xc2, 0x0f, 0x63, 0x20, 0x19, 0x0b, 0x60, 0x28, 0x09, 0xb2, 0x3e, 0xe5, 0xe3, 0x91, 0xc2, 0x98, 0x3d, 0xc0, 0x81, 0x0b, 0x5a, 0xdd, 0x88, 0x6a, 0xc1, 0xff, 0x94, 0x7f, 0xe0, 0x96, 0x6b, 0x67, 0x75, 0x80, 0x53, 0xa1, 0x89, 0x14, 0x19, 0x59, 0xdc, 0x13, 0x67, 0x01, 0x7c, 0x64, 0xfe, 0xeb, 0x7b, 0x8c, 0x97, 0x2d, 0x1a, 0x90, 0x48, 0x4b, 0xea, 0x48, 0xc0, 0x77, 0x23, 0x68, 0x65, 0x19, 0xcf, 0xcf, 0x1c, 0x89, 0x93, 0xe0, 0xd2, 0xfd, 0x81, 0x6a, 0x6e, 0xd8, 0x76, 0xad, 0x65, 0xb5, 0xe0, 0xe1, 0xe2, 0x9c, 0x13, 0x70, 0x0e, 0x79, 0x1c, 0xaa, 0xac, 0x0d, 0x3f, 0x10, 0x4e, 0x47, 0x36, 0xb9, 0x23, 0xd3, 0x6a, 0x50, 0x9a, 0xe2, 0x83, 0x94, 0xf8, 0x1b, 0x41, 0x4c, 0x22, 0x92, 0x58, 0x9f, 0xc8, 0xad, 0x36, 0x51, 0x59, 0xa6, 0xbb, 0x86, 0x4f, 0x9d, 0x3a, 0x9f, 0x1d, 0x0b, 0x2e, 0x7f, 0xf8, 0x83, 0xfd, 0x1c, 0x3b, 0xe1, 0x3d, 0xb2, 0xdc, 0x13, 0x18, 0x71, 0xec, 0x63, 0xf3, 0xfc, 0x41, 0x6f, 0x14, 0xec, 0xcc, 0x7f, 0x28, 0xeb, 0x12, 0xc6, 0x4c, 0xa4, 0x92, 0x7f, 0x7a, 0x65, 0xcf, 0x8f, 0x63, 0x47, 0x3e, 0x4f, 0xeb, 0x03, 0x7b, 0x20, 0xf8, 0x01, 0xa2, 0x9d, 0xe2, 0x5f, 0x85, 0xfb, 0x7b, 0xdf, 0x10, 0x45, 0x2f, 0x6f, 0xb2, 0x6b, 0xff, 0x69, 0xf5, 0x64, 0x8e, 0x18, 0x71, 0x7a, 0x04, 0x31, 0xc3, 0xf8, 0xa0, 0x6c, 0x0f, 0x0a, 0x57, 0x83, 0x83, 0x58, 0xda, 0xaf, 0x99, 0xe6, 0x68, 0x13, 0xe8, 0x15, 0xbc, 0xd7, 0xef, 0xb2, 0x4b, 0x08, 0x18, 0x97, 0xb2, 0x77, 0x0c, 0xb5, 0x96, 0xdb, 0x21, 0x14, 0x39, 0x52, 0x9f, 0x83, 0x47, 0x96, 0xe8, 0x9f, 0x94, 0xe2, 0x73, 0x40, 0x02, 0x7f, 0xbd, 0xb9, 0x65, 0x6a, 0x33, 0x15, 0xb8, 0xc8, 0x9d, 0x12, 0xf9, 0x14, 0x04, 0x77, 0x56, 0xdc, 0x87, 0xd2, 0xca, 0xb2, 0x05, 0x99, 0xad, 0xa6, 0xd2, 0x81, 0x8f, 0x64, 0xcd, 0xe5, 0x70, 0x2c, 0xbf, 0xc0, 0xb6, 0xb7, 0xa8, 0x4a, 0x45, 0x6b, 0x98, 0x8f, 0x5b, 0xb8, 0x87, 0xf5, 0x64, 0xd1, 0x67, 0xd6, 0xdd, 0x76, 0x29, 0xf0, 0x77, 0x45, 0xfc, 0x27, 0xa4, 0x4a, 0xac, 0xaa, 0x1a, 0x90, 0xbe, 0xf8, 0x91, 0x50, 0x30, 0x6d, 0x73, 0x49, 0x3c, 0xab, 0xa4, 0xaf, 0x13, 0xa8, 0xdd, 0x0a, 0xf5, 0xc3, 0x34, 0x98, 0xb4, 0x7f, 0x0b, 0xb4, 0x63, 0x0f, 0xe3, 0x6e, 0xcc, 0xf8, 0x1d, 0xea, 0x34, 0x71, 0x8b, 0x06, 0xa5, 0x4f, 0x81, 0x12, 0xa9, 0xfd, 0xb8, 0x43 } }; + yield return new object[] { "-1500566381192798663042470094195709329888702572609999105286667163606153967917290138712408909178830809119008530236180974166477902167438722120032328817587204550920260039698718901932896233377293832747667996098291476468951412311792579258943277768740116090186686963715856483147820131067091322876669577393210366426487028489206389247040659375214497672166049911500383423054774768058254673393263777607084960848658501529675225559011863409579602879830226289200557853195239635009395081629845517655774307827048680743808664945667425540772434721298573889660136104342949269877806888346513652384111162522895043239369803590295673472600852282901495791087130835483730406094888840219829189061112151151001898468218215751327382511813082884657126285166508024920536549363279290734920537316417286759974845704859198588552892947264856714040130408613412473996518038227113385600353365608575770837750435553392852567153310861059766627383200108369176626042676222592985818614861742325706568951932845447397512345181981733524874445871904571909006536844113768514813826258460666950996534336842871477679076553532049073323784011247842133811527684859166963235747571306708361946012941167234981369225227878132777327321706825860067928644566542309248", new byte[] { 0xe2, 0xdb, 0xc3, 0xee, 0xdc, 0xd0, 0xa4, 0xdc, 0x41, 0xec, 0xf7, 0xf3, 0x53, 0x2f, 0xd9, 0x5e, 0xe5, 0xbf, 0x5e, 0xea, 0x84, 0xde, 0x00, 0x79, 0x48, 0xc6, 0xf4, 0xd0, 0x29, 0xd9, 0x41, 0xb3, 0xc1, 0x31, 0xe0, 0x18, 0x42, 0xa5, 0x76, 0x88, 0x95, 0x60, 0xe8, 0x55, 0x51, 0x98, 0x01, 0xdb, 0x58, 0x0f, 0x76, 0xe5, 0x23, 0xb3, 0xa3, 0x8b, 0xb6, 0x8b, 0x66, 0x30, 0xd2, 0xb4, 0x13, 0x44, 0xd7, 0xa1, 0x6f, 0xa1, 0xee, 0x41, 0xab, 0x87, 0x5b, 0x64, 0x53, 0x80, 0x1b, 0x1b, 0x15, 0xba, 0x7e, 0x19, 0xbd, 0xc5, 0x9e, 0xfa, 0x1e, 0x59, 0x19, 0x56, 0x59, 0x7e, 0xa3, 0x2d, 0x97, 0xc8, 0xd9, 0x9f, 0xd3, 0x9b, 0x43, 0x25, 0x31, 0x4b, 0x17, 0x5c, 0x5d, 0x95, 0xd2, 0x5a, 0x91, 0xca, 0x83, 0xe9, 0x16, 0x33, 0x10, 0x26, 0x65, 0x31, 0x79, 0xa3, 0xf7, 0x89, 0xd5, 0xe3, 0x8d, 0x45, 0x86, 0x2a, 0xc9, 0xd8, 0x40, 0x93, 0xd8, 0xbf, 0x6f, 0xfa, 0x13, 0xf5, 0x4a, 0x62, 0x15, 0xd9, 0x55, 0xd9, 0xf6, 0xcc, 0xc2, 0xdb, 0xbc, 0xce, 0x50, 0x7a, 0x45, 0xca, 0xca, 0x54, 0x20, 0x76, 0x8e, 0x26, 0x9a, 0x5d, 0x3b, 0x23, 0xad, 0x80, 0xa5, 0xae, 0x63, 0x27, 0x03, 0x10, 0x65, 0x06, 0x6e, 0x65, 0x38, 0x70, 0x10, 0xef, 0xfb, 0xbc, 0xcf, 0xf3, 0x3d, 0x0a, 0x40, 0xe7, 0xd3, 0x20, 0x5d, 0x4f, 0x84, 0xd8, 0xcb, 0xea, 0x65, 0x28, 0x26, 0x15, 0x54, 0x08, 0x77, 0x07, 0xd4, 0x21, 0xb4, 0x69, 0xc6, 0x70, 0x02, 0xd2, 0x5d, 0x4b, 0x7f, 0xf6, 0xb4, 0x11, 0x7d, 0x1b, 0x74, 0x59, 0x1f, 0x2d, 0x5d, 0x75, 0x5c, 0x1a, 0x6e, 0x78, 0xad, 0x12, 0x8d, 0x3b, 0x52, 0x0d, 0x4a, 0x9f, 0x28, 0x22, 0xc4, 0x36, 0xb3, 0xdf, 0xd5, 0xa3, 0xa3, 0xa7, 0x06, 0xea, 0x49, 0x16, 0x01, 0xc8, 0xb2, 0x27, 0xab, 0x04, 0xa2, 0x62, 0x93, 0xcb, 0xdc, 0xfe, 0x33, 0xe4, 0x31, 0x58, 0x7c, 0x08, 0x23, 0x4c, 0x88, 0x1e, 0x9f, 0xc9, 0x39, 0x46, 0xea, 0x7a, 0x69, 0xfa, 0xff, 0x38, 0x87, 0x6b, 0xde, 0x7c, 0x6b, 0xfa, 0x2f, 0x81, 0xff, 0xb1, 0x82, 0x34, 0x38, 0xb8, 0xd1, 0xbf, 0x68, 0x60, 0x07, 0x3d, 0x91, 0x4e, 0xb2, 0x02, 0x1a, 0x05, 0x70, 0xb7, 0x26, 0xbb, 0x95, 0xad, 0xfd, 0xcc, 0x52, 0x80, 0xf9, 0xda, 0x45, 0x04, 0x24, 0xc4, 0x8f, 0x46, 0x22, 0x9a, 0x0d, 0xa0, 0x88, 0x03, 0x54, 0x2d, 0x2f, 0x54, 0x1b, 0xf1, 0xe5, 0xfe, 0xa0, 0x6c, 0x70, 0x31, 0xb1, 0x36, 0x8b, 0xcf, 0x33, 0xf5, 0xc1, 0x77, 0x6c, 0x89, 0xa3, 0xb3, 0xd9, 0x66, 0x5d, 0xb8, 0x40, 0x66, 0xb3, 0x0d, 0xcd, 0x0c, 0xde, 0xd4, 0x6c, 0x55, 0x66, 0x95, 0x78, 0x7f, 0xc9, 0x0a, 0x8e, 0x41, 0x50, 0xc2, 0xe9, 0x88, 0x91, 0xce, 0x56, 0xa2, 0xc6, 0xc4, 0x87, 0xb0, 0x25, 0xc9, 0x74, 0xf6, 0x58, 0xbe, 0xde, 0xf9, 0xee, 0x37, 0x5c, 0xfe, 0x54, 0xc1, 0x68, 0x40, 0x64, 0x99, 0x66, 0x2e, 0x18, 0x6b, 0xa6, 0x0a, 0xfe, 0x13, 0xec, 0x1e, 0x6f, 0xf3, 0xa0, 0xc9, 0x17, 0x9b, 0x6e, 0x92, 0xf2, 0x42, 0xfb, 0xbd, 0xfb, 0x11, 0x53, 0x7c, 0xeb, 0xd4, 0xd2, 0x16, 0xaf, 0x20, 0x5e, 0x42, 0x09, 0xea, 0x92, 0x0b, 0xab, 0x94, 0xaa, 0xaf, 0x23, 0xda, 0xda, 0xe3, 0x40, 0xc1, 0x5a, 0xab, 0xc2, 0xdd, 0x8d, 0x76, 0x62, 0xb3, 0xd4, 0x13, 0xac, 0x0c, 0x06, 0xa9, 0x98, 0x27, 0xa8, 0x34, 0x94, 0xd6, 0x85, 0x99, 0x24, 0x7e, 0x8a, 0xf1, 0xf8, 0x6d, 0xef, 0x66, 0xf0, 0xe6, 0xc9, 0x2c, 0x4d, 0x1f, 0x3e, 0xfa, 0x28, 0x80 } }; + } + [Theory] - [InlineData("-18374686475376656384", new byte[] { 0xff, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 })] - [InlineData("-18446744069414584320", new byte[] { 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 })] - [InlineData("12364093636075302621581796971036731159910277399901099375861080574506898189967563102391591201943540153492149033597384108294298661111799425262742266671957323486506857011293831406641316917374615487590434666756862524718179898130435474398176187353530443750986128762955255137790631223519091107256083370837751230886741470719554141609004126665185940207631783192780186624919167901565253877397154522582982120840364212333366972597473045167409184762879376102731157263235904816835054250885637739932914015117504485702897712016943555929710070193511128651378003670520306509417025958556935067307123832592173743652726898616663215056178200135054604939862749863002480827458494339065850786495122398411385446068167146399066035389699059499954747263948595492570959736940353095030589033792026029085438901525807032848103038290802923997216273712349905230080849822000411239032166420681788646737098078876258256753058713515144604794792139863186822520361187685685356628044518258989638970651859178568755065879235553215218267011024902142765549091793970027321040036512883269922219608216030987714165823965404563131018846411947569009598716649463301689241563037584803938711917477764863093448004918315253652379776337794243677630540042379049027", new byte[] { 0x00, 0xf0, 0x1d, 0x7b, 0xa2, 0xfd, 0x50, 0xf9, 0x50, 0x07, 0xce, 0x2a, 0xdf, 0xfb, 0x75, 0x70, 0x49, 0x5e, 0x5d, 0xf7, 0x1b, 0x0a, 0x76, 0x1f, 0xe7, 0xe3, 0xc7, 0x0a, 0xc7, 0xee, 0xca, 0x4e, 0xa2, 0xe6, 0xae, 0xe8, 0x1a, 0x2c, 0x3b, 0xa9, 0x12, 0x77, 0xb1, 0x47, 0x3c, 0xb5, 0xab, 0x32, 0x26, 0x18, 0x0d, 0x43, 0x51, 0x6b, 0x11, 0x0c, 0x45, 0xed, 0x52, 0x7d, 0xce, 0xe8, 0x75, 0x6c, 0xe1, 0xda, 0xaf, 0x42, 0x1c, 0xc6, 0x21, 0x23, 0x1f, 0x5d, 0x2d, 0x48, 0xf8, 0x20, 0x67, 0x2f, 0x49, 0x3d, 0x3e, 0x5d, 0xc2, 0x53, 0xc8, 0xe0, 0x3d, 0xe2, 0xdc, 0x51, 0x2f, 0x44, 0xc9, 0x72, 0xb6, 0x04, 0xa0, 0x19, 0x1f, 0x03, 0xb9, 0x0f, 0x57, 0x80, 0x55, 0x41, 0x10, 0x7e, 0x7c, 0x78, 0xdc, 0xbb, 0x82, 0x6e, 0x6a, 0xd9, 0x0e, 0xac, 0x87, 0x0c, 0xfd, 0xc0, 0x79, 0xdf, 0xf5, 0x98, 0xfe, 0x9c, 0x58, 0xa9, 0x63, 0xc2, 0x99, 0x31, 0x09, 0x1c, 0x50, 0xcf, 0x03, 0x4f, 0x96, 0xef, 0x98, 0x56, 0x44, 0xc2, 0x0f, 0x63, 0x20, 0x19, 0x0b, 0x60, 0x28, 0x09, 0xb2, 0x3e, 0xe5, 0xe3, 0x91, 0xc2, 0x98, 0x3d, 0xc0, 0x81, 0x0b, 0x5a, 0xdd, 0x88, 0x6a, 0xc1, 0xff, 0x94, 0x7f, 0xe0, 0x96, 0x6b, 0x67, 0x75, 0x80, 0x53, 0xa1, 0x89, 0x14, 0x19, 0x59, 0xdc, 0x13, 0x67, 0x01, 0x7c, 0x64, 0xfe, 0xeb, 0x7b, 0x8c, 0x97, 0x2d, 0x1a, 0x90, 0x48, 0x4b, 0xea, 0x48, 0xc0, 0x77, 0x23, 0x68, 0x65, 0x19, 0xcf, 0xcf, 0x1c, 0x89, 0x93, 0xe0, 0xd2, 0xfd, 0x81, 0x6a, 0x6e, 0xd8, 0x76, 0xad, 0x65, 0xb5, 0xe0, 0xe1, 0xe2, 0x9c, 0x13, 0x70, 0x0e, 0x79, 0x1c, 0xaa, 0xac, 0x0d, 0x3f, 0x10, 0x4e, 0x47, 0x36, 0xb9, 0x23, 0xd3, 0x6a, 0x50, 0x9a, 0xe2, 0x83, 0x94, 0xf8, 0x1b, 0x41, 0x4c, 0x22, 0x92, 0x58, 0x9f, 0xc8, 0xad, 0x36, 0x51, 0x59, 0xa6, 0xbb, 0x86, 0x4f, 0x9d, 0x3a, 0x9f, 0x1d, 0x0b, 0x2e, 0x7f, 0xf8, 0x83, 0xfd, 0x1c, 0x3b, 0xe1, 0x3d, 0xb2, 0xdc, 0x13, 0x18, 0x71, 0xec, 0x63, 0xf3, 0xfc, 0x41, 0x6f, 0x14, 0xec, 0xcc, 0x7f, 0x28, 0xeb, 0x12, 0xc6, 0x4c, 0xa4, 0x92, 0x7f, 0x7a, 0x65, 0xcf, 0x8f, 0x63, 0x47, 0x3e, 0x4f, 0xeb, 0x03, 0x7b, 0x20, 0xf8, 0x01, 0xa2, 0x9d, 0xe2, 0x5f, 0x85, 0xfb, 0x7b, 0xdf, 0x10, 0x45, 0x2f, 0x6f, 0xb2, 0x6b, 0xff, 0x69, 0xf5, 0x64, 0x8e, 0x18, 0x71, 0x7a, 0x04, 0x31, 0xc3, 0xf8, 0xa0, 0x6c, 0x0f, 0x0a, 0x57, 0x83, 0x83, 0x58, 0xda, 0xaf, 0x99, 0xe6, 0x68, 0x13, 0xe8, 0x15, 0xbc, 0xd7, 0xef, 0xb2, 0x4b, 0x08, 0x18, 0x97, 0xb2, 0x77, 0x0c, 0xb5, 0x96, 0xdb, 0x21, 0x14, 0x39, 0x52, 0x9f, 0x83, 0x47, 0x96, 0xe8, 0x9f, 0x94, 0xe2, 0x73, 0x40, 0x02, 0x7f, 0xbd, 0xb9, 0x65, 0x6a, 0x33, 0x15, 0xb8, 0xc8, 0x9d, 0x12, 0xf9, 0x14, 0x04, 0x77, 0x56, 0xdc, 0x87, 0xd2, 0xca, 0xb2, 0x05, 0x99, 0xad, 0xa6, 0xd2, 0x81, 0x8f, 0x64, 0xcd, 0xe5, 0x70, 0x2c, 0xbf, 0xc0, 0xb6, 0xb7, 0xa8, 0x4a, 0x45, 0x6b, 0x98, 0x8f, 0x5b, 0xb8, 0x87, 0xf5, 0x64, 0xd1, 0x67, 0xd6, 0xdd, 0x76, 0x29, 0xf0, 0x77, 0x45, 0xfc, 0x27, 0xa4, 0x4a, 0xac, 0xaa, 0x1a, 0x90, 0xbe, 0xf8, 0x91, 0x50, 0x30, 0x6d, 0x73, 0x49, 0x3c, 0xab, 0xa4, 0xaf, 0x13, 0xa8, 0xdd, 0x0a, 0xf5, 0xc3, 0x34, 0x98, 0xb4, 0x7f, 0x0b, 0xb4, 0x63, 0x0f, 0xe3, 0x6e, 0xcc, 0xf8, 0x1d, 0xea, 0x34, 0x71, 0x8b, 0x06, 0xa5, 0x4f, 0x81, 0x12, 0xa9, 0xfd, 0xb8, 0x43 })] - [InlineData("-1500566381192798663042470094195709329888702572609999105286667163606153967917290138712408909178830809119008530236180974166477902167438722120032328817587204550920260039698718901932896233377293832747667996098291476468951412311792579258943277768740116090186686963715856483147820131067091322876669577393210366426487028489206389247040659375214497672166049911500383423054774768058254673393263777607084960848658501529675225559011863409579602879830226289200557853195239635009395081629845517655774307827048680743808664945667425540772434721298573889660136104342949269877806888346513652384111162522895043239369803590295673472600852282901495791087130835483730406094888840219829189061112151151001898468218215751327382511813082884657126285166508024920536549363279290734920537316417286759974845704859198588552892947264856714040130408613412473996518038227113385600353365608575770837750435553392852567153310861059766627383200108369176626042676222592985818614861742325706568951932845447397512345181981733524874445871904571909006536844113768514813826258460666950996534336842871477679076553532049073323784011247842133811527684859166963235747571306708361946012941167234981369225227878132777327321706825860067928644566542309248", new byte[] { 0xe2, 0xdb, 0xc3, 0xee, 0xdc, 0xd0, 0xa4, 0xdc, 0x41, 0xec, 0xf7, 0xf3, 0x53, 0x2f, 0xd9, 0x5e, 0xe5, 0xbf, 0x5e, 0xea, 0x84, 0xde, 0x00, 0x79, 0x48, 0xc6, 0xf4, 0xd0, 0x29, 0xd9, 0x41, 0xb3, 0xc1, 0x31, 0xe0, 0x18, 0x42, 0xa5, 0x76, 0x88, 0x95, 0x60, 0xe8, 0x55, 0x51, 0x98, 0x01, 0xdb, 0x58, 0x0f, 0x76, 0xe5, 0x23, 0xb3, 0xa3, 0x8b, 0xb6, 0x8b, 0x66, 0x30, 0xd2, 0xb4, 0x13, 0x44, 0xd7, 0xa1, 0x6f, 0xa1, 0xee, 0x41, 0xab, 0x87, 0x5b, 0x64, 0x53, 0x80, 0x1b, 0x1b, 0x15, 0xba, 0x7e, 0x19, 0xbd, 0xc5, 0x9e, 0xfa, 0x1e, 0x59, 0x19, 0x56, 0x59, 0x7e, 0xa3, 0x2d, 0x97, 0xc8, 0xd9, 0x9f, 0xd3, 0x9b, 0x43, 0x25, 0x31, 0x4b, 0x17, 0x5c, 0x5d, 0x95, 0xd2, 0x5a, 0x91, 0xca, 0x83, 0xe9, 0x16, 0x33, 0x10, 0x26, 0x65, 0x31, 0x79, 0xa3, 0xf7, 0x89, 0xd5, 0xe3, 0x8d, 0x45, 0x86, 0x2a, 0xc9, 0xd8, 0x40, 0x93, 0xd8, 0xbf, 0x6f, 0xfa, 0x13, 0xf5, 0x4a, 0x62, 0x15, 0xd9, 0x55, 0xd9, 0xf6, 0xcc, 0xc2, 0xdb, 0xbc, 0xce, 0x50, 0x7a, 0x45, 0xca, 0xca, 0x54, 0x20, 0x76, 0x8e, 0x26, 0x9a, 0x5d, 0x3b, 0x23, 0xad, 0x80, 0xa5, 0xae, 0x63, 0x27, 0x03, 0x10, 0x65, 0x06, 0x6e, 0x65, 0x38, 0x70, 0x10, 0xef, 0xfb, 0xbc, 0xcf, 0xf3, 0x3d, 0x0a, 0x40, 0xe7, 0xd3, 0x20, 0x5d, 0x4f, 0x84, 0xd8, 0xcb, 0xea, 0x65, 0x28, 0x26, 0x15, 0x54, 0x08, 0x77, 0x07, 0xd4, 0x21, 0xb4, 0x69, 0xc6, 0x70, 0x02, 0xd2, 0x5d, 0x4b, 0x7f, 0xf6, 0xb4, 0x11, 0x7d, 0x1b, 0x74, 0x59, 0x1f, 0x2d, 0x5d, 0x75, 0x5c, 0x1a, 0x6e, 0x78, 0xad, 0x12, 0x8d, 0x3b, 0x52, 0x0d, 0x4a, 0x9f, 0x28, 0x22, 0xc4, 0x36, 0xb3, 0xdf, 0xd5, 0xa3, 0xa3, 0xa7, 0x06, 0xea, 0x49, 0x16, 0x01, 0xc8, 0xb2, 0x27, 0xab, 0x04, 0xa2, 0x62, 0x93, 0xcb, 0xdc, 0xfe, 0x33, 0xe4, 0x31, 0x58, 0x7c, 0x08, 0x23, 0x4c, 0x88, 0x1e, 0x9f, 0xc9, 0x39, 0x46, 0xea, 0x7a, 0x69, 0xfa, 0xff, 0x38, 0x87, 0x6b, 0xde, 0x7c, 0x6b, 0xfa, 0x2f, 0x81, 0xff, 0xb1, 0x82, 0x34, 0x38, 0xb8, 0xd1, 0xbf, 0x68, 0x60, 0x07, 0x3d, 0x91, 0x4e, 0xb2, 0x02, 0x1a, 0x05, 0x70, 0xb7, 0x26, 0xbb, 0x95, 0xad, 0xfd, 0xcc, 0x52, 0x80, 0xf9, 0xda, 0x45, 0x04, 0x24, 0xc4, 0x8f, 0x46, 0x22, 0x9a, 0x0d, 0xa0, 0x88, 0x03, 0x54, 0x2d, 0x2f, 0x54, 0x1b, 0xf1, 0xe5, 0xfe, 0xa0, 0x6c, 0x70, 0x31, 0xb1, 0x36, 0x8b, 0xcf, 0x33, 0xf5, 0xc1, 0x77, 0x6c, 0x89, 0xa3, 0xb3, 0xd9, 0x66, 0x5d, 0xb8, 0x40, 0x66, 0xb3, 0x0d, 0xcd, 0x0c, 0xde, 0xd4, 0x6c, 0x55, 0x66, 0x95, 0x78, 0x7f, 0xc9, 0x0a, 0x8e, 0x41, 0x50, 0xc2, 0xe9, 0x88, 0x91, 0xce, 0x56, 0xa2, 0xc6, 0xc4, 0x87, 0xb0, 0x25, 0xc9, 0x74, 0xf6, 0x58, 0xbe, 0xde, 0xf9, 0xee, 0x37, 0x5c, 0xfe, 0x54, 0xc1, 0x68, 0x40, 0x64, 0x99, 0x66, 0x2e, 0x18, 0x6b, 0xa6, 0x0a, 0xfe, 0x13, 0xec, 0x1e, 0x6f, 0xf3, 0xa0, 0xc9, 0x17, 0x9b, 0x6e, 0x92, 0xf2, 0x42, 0xfb, 0xbd, 0xfb, 0x11, 0x53, 0x7c, 0xeb, 0xd4, 0xd2, 0x16, 0xaf, 0x20, 0x5e, 0x42, 0x09, 0xea, 0x92, 0x0b, 0xab, 0x94, 0xaa, 0xaf, 0x23, 0xda, 0xda, 0xe3, 0x40, 0xc1, 0x5a, 0xab, 0xc2, 0xdd, 0x8d, 0x76, 0x62, 0xb3, 0xd4, 0x13, 0xac, 0x0c, 0x06, 0xa9, 0x98, 0x27, 0xa8, 0x34, 0x94, 0xd6, 0x85, 0x99, 0x24, 0x7e, 0x8a, 0xf1, 0xf8, 0x6d, 0xef, 0x66, 0xf0, 0xe6, 0xc9, 0x2c, 0x4d, 0x1f, 0x3e, 0xfa, 0x28, 0x80 })] - public void FromStringTests(string str, byte[] expectedBigEndianBytes) + public void ToByteArray_FromStringTests(string str, byte[] expectedBigEndianBytes) { byte[] expectedBytes = new byte[expectedBigEndianBytes.Length]; for (var i = 0; i < expectedBigEndianBytes.Length; i++) diff --git a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/TryWriteBytes.cs b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/TryWriteBytes.cs new file mode 100644 index 0000000000..66e37b46b7 --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/TryWriteBytes.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Numerics.Tests +{ + public partial class ExtractBytesMembersTests + { + [Theory] + [MemberData(nameof(FromIntTests_MemberData))] + public void TryWriteBytes_FromIntTests(int i, byte[] expectedBytes) => + ValidateGetByteCountAndTryWriteBytes(new BigInteger(i), expectedBytes); + + [Theory] + [MemberData(nameof(FromLongTests_MemberData))] + public void TryWriteBytes_FromLongTests(long l, byte[] expectedBytes) => + ValidateGetByteCountAndTryWriteBytes(new BigInteger(l), expectedBytes); + + [Theory] + [MemberData(nameof(FromStringTests_MemberData))] + public void TryWriteBytes_FromStringTests(string str, byte[] expectedBigEndianBytes) + { + byte[] expectedBytes = (byte[])expectedBigEndianBytes.Clone(); + Array.Reverse(expectedBytes); + ValidateGetByteCountAndTryWriteBytes(BigInteger.Parse(str), expectedBytes); + } + + private void ValidateGetByteCountAndTryWriteBytes(BigInteger bi, byte[] expectedBytes) + { + byte[] bytes = bi.ToByteArray(); + Assert.Equal(expectedBytes, bytes); + + int count = bi.GetByteCount(); + Assert.Equal(expectedBytes.Length, count); + + Validate(new byte[expectedBytes.Length]); // make sure it works with a span just long enough + Validate(new byte[expectedBytes.Length + 1]); // make sure it also works with a longer span + + void Validate(Span destination) + { + // Fails if the span is too small + int bytesWritten; + Assert.False(bi.TryWriteBytes(destination.Slice(0, expectedBytes.Length - 1), out bytesWritten)); + Assert.Equal(0, bytesWritten); + + // Succeeds if the span is sufficiently large + Assert.True(bi.TryWriteBytes(destination, out bytesWritten)); + Assert.Equal(expectedBytes.Length, bytesWritten); + Assert.Equal(expectedBytes, destination.Slice(0, bytesWritten).ToArray()); + } + } + } +} diff --git a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.cs b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.cs index 9fe5c408ce..e0d7ebbcff 100644 --- a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.cs +++ b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.cs @@ -6,7 +6,7 @@ using Xunit; namespace System.Numerics.Tests { - public class BigIntegerConstructorTest + public partial class BigIntegerConstructorTest { private static int s_samples = 10; private static Random s_random = new Random(100); @@ -891,6 +891,10 @@ namespace System.Numerics.Tests // ctor(byte[]): array is UInt32.MaxValue + 1 VerifyCtorByteArray(new byte[] { 0, 0, 0, 0, 1 }, (UInt64)UInt32.MaxValue + 1); + // ctor(byte[]): array is Int32.MinValue with overlong representation. + VerifyCtorByteArray(new byte[] {0, 0, 0, 0x80, 0xFF}); + Assert.Equal(new BigInteger(new byte[] { 0, 0, 0, 0x80, 0xFF, 0xFF, 0xFF }), int.MinValue); + // ctor(byte[]): array is UInt64.MaxValue VerifyCtorByteArray(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0 }, UInt64.MaxValue); @@ -953,6 +957,7 @@ namespace System.Numerics.Tests VerifyCtorByteArray(value); } + static partial void VerifyCtorByteSpan(byte[] value); private static void VerifyCtorByteArray(byte[] value) { @@ -961,6 +966,7 @@ namespace System.Numerics.Tests bool isZero = MyBigIntImp.IsZero(value); bigInteger = new BigInteger(value); + VerifyCtorByteSpan(value); roundTrippedByteArray = bigInteger.ToByteArray(); diff --git a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.netcoreapp.cs b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.netcoreapp.cs new file mode 100644 index 0000000000..d11723b953 --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/ctor.netcoreapp.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Numerics.Tests +{ + public partial class BigIntegerConstructorTest + { + static partial void VerifyCtorByteSpan(byte[] value) => + Assert.Equal(new BigInteger(value), new BigInteger(new ReadOnlySpan(value))); + } +} diff --git a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.cs b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.cs index c3d2a1781d..4caf420344 100644 --- a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.cs +++ b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.cs @@ -9,7 +9,7 @@ using Xunit; namespace System.Numerics.Tests { - public class parseTest + public partial class parseTest { private readonly static int s_samples = 10; private readonly static Random s_random = new Random(100); @@ -403,6 +403,8 @@ namespace System.Numerics.Tests VerifyParseToString(num1, ns, failureNotExpected, Fix(num1.Trim(), ((ns & NumberStyles.AllowHexSpecifier) != 0), failureNotExpected)); } + static partial void VerifyParseSpanToString(string num1, NumberStyles ns, bool failureNotExpected, string expected); + private static void VerifyParseToString(string num1, NumberStyles ns, bool failureNotExpected, string expected) { BigInteger test; @@ -425,8 +427,15 @@ namespace System.Numerics.Tests } Assert.False(BigInteger.TryParse(num1, ns, null, out test), String.Format("Expected TryParse to fail on {0}", num1)); } + + if (num1 != null) + { + VerifyParseSpanToString(num1, ns, failureNotExpected, expected); + } } + static partial void VerifySimpleFormatParseSpan(string num1, NumberFormatInfo nfi, BigInteger expected, bool failureExpected); + private static void VerifySimpleFormatParse(string num1, NumberFormatInfo nfi, BigInteger expected, bool failureExpected = false) { BigInteger test; @@ -442,8 +451,15 @@ namespace System.Numerics.Tests Assert.Throws(() => { BigInteger.Parse(num1, nfi); }); Assert.False(BigInteger.TryParse(num1, NumberStyles.Any, nfi, out test), String.Format("Expected TryParse to fail on {0}", num1)); } + + if (num1 != null) + { + VerifySimpleFormatParseSpan(num1, nfi, expected, failureExpected); + } } - + + static partial void VerifyFormatParseSpan(string s, NumberStyles ns, NumberFormatInfo nfi, BigInteger expected, bool failureExpected); + private static void VerifyFormatParse(string num1, NumberStyles ns, NumberFormatInfo nfi, BigInteger expected, bool failureExpected = false) { BigInteger test; @@ -459,6 +475,11 @@ namespace System.Numerics.Tests Assert.Throws(() => { BigInteger.Parse(num1, ns, nfi); }); Assert.False(BigInteger.TryParse(num1, ns, nfi, out test), String.Format("Expected TryParse to fail on {0}", num1)); } + + if (num1 != null) + { + VerifyFormatParseSpan(num1, ns, nfi, expected, failureExpected); + } } private static String GetDigitSequence(int min, int max, Random random) diff --git a/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.netcoreapp.cs b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.netcoreapp.cs new file mode 100644 index 0000000000..fc3d966713 --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/BigInteger/parse.netcoreapp.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using Xunit; + +namespace System.Numerics.Tests +{ + public partial class parseTest + { + static partial void VerifyParseSpanToString(string num1, NumberStyles ns, bool failureNotExpected, string expected) + { + if (failureNotExpected) + { + Eval(BigInteger.Parse(num1.AsReadOnlySpan(), ns), expected); + Assert.True(BigInteger.TryParse(num1.AsReadOnlySpan(), out BigInteger test, ns)); + Eval(test, expected); + } + else + { + Assert.Throws(() => { BigInteger.Parse(num1.AsReadOnlySpan(), ns); }); + Assert.False(BigInteger.TryParse(num1.AsReadOnlySpan(), out BigInteger test, ns), String.Format("Expected TryParse to fail on {0}", num1)); + } + } + + static partial void VerifySimpleFormatParseSpan(string num1, NumberFormatInfo nfi, BigInteger expected, bool failureExpected) + { + if (!failureExpected) + { + Assert.Equal(expected, BigInteger.Parse(num1.AsReadOnlySpan(), provider: nfi)); + Assert.True(BigInteger.TryParse(num1.AsReadOnlySpan(), out BigInteger test, NumberStyles.Any, nfi)); + Assert.Equal(expected, test); + } + else + { + Assert.Throws(() => { BigInteger.Parse(num1.AsReadOnlySpan(), provider: nfi); }); + Assert.False(BigInteger.TryParse(num1.AsReadOnlySpan(), out BigInteger test, NumberStyles.Any, nfi), String.Format("Expected TryParse to fail on {0}", num1)); + } + } + + static partial void VerifyFormatParseSpan(string num1, NumberStyles ns, NumberFormatInfo nfi, BigInteger expected, bool failureExpected) + { + if (!failureExpected) + { + Assert.Equal(expected, BigInteger.Parse(num1.AsReadOnlySpan(), ns, nfi)); + Assert.True(BigInteger.TryParse(num1.AsReadOnlySpan(), out BigInteger test, NumberStyles.Any, nfi)); + Assert.Equal(expected, test); + } + else + { + Assert.Throws(() => { BigInteger.Parse(num1.AsReadOnlySpan(), ns, nfi); }); + Assert.False(BigInteger.TryParse(num1.AsReadOnlySpan(), out BigInteger test, ns, nfi), String.Format("Expected TryParse to fail on {0}", num1)); + } + } + } +} diff --git a/external/corefx/src/System.Runtime.Numerics/tests/Configurations.props b/external/corefx/src/System.Runtime.Numerics/tests/Configurations.props index 78953dfc88..271a4be4c9 100644 --- a/external/corefx/src/System.Runtime.Numerics/tests/Configurations.props +++ b/external/corefx/src/System.Runtime.Numerics/tests/Configurations.props @@ -3,6 +3,7 @@ netstandard; + netcoreapp; diff --git a/external/corefx/src/System.Runtime.Numerics/tests/Performance/Configurations.props b/external/corefx/src/System.Runtime.Numerics/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.cs b/external/corefx/src/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.cs new file mode 100644 index 0000000000..b0fce5e259 --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xunit.Performance; +using Xunit; + +namespace System.Numerics.Tests +{ + public partial class Perf_BigInteger + { + public static IEnumerable NumberStrings() + { + yield return new object[] { "123" }; + yield return new object[] { int.MinValue.ToString() }; + yield return new object[] { string.Concat(Enumerable.Repeat("1234567890", 20)) }; + } + + // TODO #18249: Port disabled perf tests from tests\BigInteger\PerformanceTests.cs + + [Benchmark] + [MemberData(nameof(NumberStrings))] + public void Ctor_ByteArray(string numberString) + { + byte[] input = BigInteger.Parse(numberString).ToByteArray(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 1000000; i++) + { + var bi = new BigInteger(input); + } + } + } + } + + [Benchmark] + [MemberData(nameof(NumberStrings))] + public void ToByteArray(string numberString) + { + BigInteger bi = BigInteger.Parse(numberString); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 1000000; i++) + { + bi.ToByteArray(); + } + } + } + } + [Benchmark] + [MemberData(nameof(NumberStrings))] + public void Parse(string numberString) + { + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 100000; i++) + { + BigInteger.Parse(numberString); + } + } + } + } + } +} diff --git a/external/corefx/src/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.netcoreapp.cs b/external/corefx/src/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.netcoreapp.cs new file mode 100644 index 0000000000..20d70c9bd6 --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.netcoreapp.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xunit.Performance; +using Xunit; + +namespace System.Numerics.Tests +{ + public partial class Perf_BigInteger + { + [Benchmark] + [MemberData(nameof(NumberStrings))] + public void Ctor_ByteSpan(string numberString) + { + Span input = BigInteger.Parse(numberString).ToByteArray(); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 1000000; i++) + { + var bi = new BigInteger(input); + } + } + } + } + + [Benchmark] + [MemberData(nameof(NumberStrings))] + public void TryWriteBytes(string numberString) + { + BigInteger bi = BigInteger.Parse(numberString); + Span destination = new byte[bi.GetByteCount()]; + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < 1000000; i++) + { + bi.TryWriteBytes(destination, out int bytesWritten); + } + } + } + } + } +} diff --git a/external/corefx/src/System.Runtime.Numerics/tests/Performance/System.Runtime.Numerics.Performance.Tests.csproj b/external/corefx/src/System.Runtime.Numerics/tests/Performance/System.Runtime.Numerics.Performance.Tests.csproj new file mode 100644 index 0000000000..ed5094c1be --- /dev/null +++ b/external/corefx/src/System.Runtime.Numerics/tests/Performance/System.Runtime.Numerics.Performance.Tests.csproj @@ -0,0 +1,26 @@ + + + + + true + {3842BE38-1A99-41B2-81B5-186E64077B95} + true + + + + + + + + + Common\System\PerfUtils.cs + + + + + {69e46a6f-9966-45a5-8945-2559fe337827} + PerfRunner + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj b/external/corefx/src/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj index 3e90f7e24e..f9e1bf76ef 100644 --- a/external/corefx/src/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj +++ b/external/corefx/src/System.Runtime.Numerics/tests/System.Runtime.Numerics.Tests.csproj @@ -7,6 +7,8 @@ + + @@ -17,6 +19,7 @@ + @@ -45,6 +48,7 @@ + @@ -52,10 +56,8 @@ + - - Common\System\PlatformDetection.cs - - + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterHelper.cs b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterHelper.cs deleted file mode 100644 index 36ddefeaf4..0000000000 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterHelper.cs +++ /dev/null @@ -1,335 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.Serialization.Formatters.Binary; -using System.Text; -using System.Text.RegularExpressions; -using Xunit; - -namespace System.Runtime.Serialization.Formatters.Tests -{ - public partial class BinaryFormatterTests - { - private static void CheckForAnyEquals(object obj, object deserializedObj) - { - Assert.True(CheckEquals(obj, deserializedObj), "Error during equality check of type " + obj?.GetType()?.FullName); - } - - public static bool CheckEquals(object objA, object objB) - { - if (objA == null && objB == null) - return true; - - if (objA != null && objB != null) - { - object equalityResult = null; - Type objType = objA.GetType(); - - // Check if custom equality extension method is available - MethodInfo customEqualityCheck = GetExtensionMethod(objType); - if (customEqualityCheck != null) - { - equalityResult = customEqualityCheck.Invoke(objA, new object[] { objA, objB }); - } - else - { - // Check if object.Equals(object) is overridden and if not check if there is a more concrete equality check implementation - bool equalsNotOverridden = objType.GetMethod("Equals", new Type[] { typeof(object) }).DeclaringType == typeof(object); - if (equalsNotOverridden) - { - // If type doesn't override Equals(object) method then check if there is a more concrete implementation - // e.g. if type implements IEquatable. - MethodInfo equalsMethod = objType.GetMethod("Equals", new Type[] { objType }); - if (equalsMethod.DeclaringType != typeof(object)) - { - equalityResult = equalsMethod.Invoke(objA, new object[] { objB }); - } - } - } - - if (equalityResult != null) - { - return (bool)equalityResult; - } - } - - if (objA is IEnumerable objAEnumerable && objB is IEnumerable objBEnumerable) - { - return CheckSequenceEquals(objAEnumerable, objBEnumerable); - } - - return objA.Equals(objB); - } - - public static bool CheckSequenceEquals(IEnumerable a, IEnumerable b) - { - if (a == null || b == null) - return a == b; - - if (a.GetType() != b.GetType()) - return false; - - IEnumerator eA = null; - IEnumerator eB = null; - - try - { - eA = (a as IEnumerable).GetEnumerator(); - eB = (a as IEnumerable).GetEnumerator(); - while (true) - { - bool moved = eA.MoveNext(); - if (moved != eB.MoveNext()) - return false; - if (!moved) - return true; - if (eA.Current == null && eB.Current == null) - return true; - if (!CheckEquals(eA.Current, eB.Current)) - return true; - } - } - finally - { - (eA as IDisposable)?.Dispose(); - (eB as IDisposable)?.Dispose(); - } - } - - private static MethodInfo GetExtensionMethod(Type extendedType) - { - if (extendedType.IsGenericType) - { - MethodInfo method = typeof(EqualityExtensions).GetMethods() - ?.SingleOrDefault(m => - m.Name == "IsEqual" && - m.GetParameters().Length == 2 && - m.GetParameters()[0].ParameterType.Name == extendedType.Name && - m.IsGenericMethodDefinition); - if (method != null) - return method.MakeGenericMethod(extendedType.GenericTypeArguments[0]); - } - - return typeof(EqualityExtensions).GetMethod("IsEqual", new[] { extendedType, extendedType }); - } - - public static void ValidateEqualityComparer(object obj) - { - Type objType = obj.GetType(); - Assert.True(objType.IsGenericType, $"Type `{objType.FullName}` must be generic."); - Assert.Equal("System.Collections.Generic.ObjectEqualityComparer`1", objType.GetGenericTypeDefinition().FullName); - Assert.Equal(obj.GetType().GetGenericArguments()[0], objType.GetGenericArguments()[0]); - } - - private static void SanityCheckBlob(object obj, string[] blobs) - { - // Check if runtime generated blob is the same as the stored one - int frameworkBlobNumber = PlatformDetection.IsFullFramework ? 1 : 0; - if (frameworkBlobNumber < blobs.Length && - // WeakReference and HybridDictionary with default constructor are generating - // different blobs at runtime for some obscure reason. Excluding those from the check. - !(obj is WeakReference) && - !(obj is Collections.Specialized.HybridDictionary) && - !(obj is TimeZoneInfo.AdjustmentRule)) - { - string runtimeBlob = SerializeObjectToBlob(obj, FormatterAssemblyStyle.Full); - - string storedComparableBlob = CreateComparableBlobInfo(blobs[frameworkBlobNumber]); - string runtimeComparableBlob = CreateComparableBlobInfo(runtimeBlob); - - Assert.True(storedComparableBlob == runtimeComparableBlob, - $"The stored blob for type {obj.GetType().FullName} is outdated and needs to be updated.{Environment.NewLine}Stored blob: {blobs[frameworkBlobNumber]}{Environment.NewLine}Generated runtime blob: {runtimeBlob}"); - } - } - - public static string GetTestDataFilePath() - { - string GetRepoRootPath() - { - var exeFile = new FileInfo(Assembly.GetExecutingAssembly().Location); - - DirectoryInfo root = exeFile.Directory; - while (!Directory.Exists(Path.Combine(root.FullName, ".git"))) - { - if (root.Parent == null) - return null; - - root = root.Parent; - } - - return root.FullName; - } - - // Get path to binary formatter test data - string repositoryRootPath = GetRepoRootPath(); - Assert.NotNull(repositoryRootPath); - string testDataFilePath = Path.Combine(repositoryRootPath, "src", "System.Runtime.Serialization.Formatters", "tests", "BinaryFormatterTestData.cs"); - Assert.True(File.Exists(testDataFilePath)); - - return testDataFilePath; - } - - public static IEnumerable GetCoreTypeRecords() - { - // Define all core type records here - return SerializableEqualityComparers_MemberData() - .Concat(SerializableObjects_MemberData()); - } - - public static IEnumerable GetCoreTypeBlobs(IEnumerable records, FormatterAssemblyStyle assemblyStyle) - { - foreach (object[] record in records) - { - yield return SerializeObjectToBlob(record[0], assemblyStyle); - } - } - - public static string CreateComparableBlobInfo(string base64Blob) - { - string lineSeparator = ((char)0x2028).ToString(); - string paragraphSeparator = ((char)0x2029).ToString(); - - byte[] data = Convert.FromBase64String(base64Blob); - base64Blob = Encoding.UTF8.GetString(data); - - return Regex.Replace(base64Blob, @"Version=\d.\d.\d.\d.", "Version=0.0.0.0", RegexOptions.Multiline) - .Replace("\r\n", string.Empty) - .Replace("\n", string.Empty) - .Replace("\r", string.Empty) - .Replace(lineSeparator, string.Empty) - .Replace(paragraphSeparator, string.Empty); - } - - public static (int blobs, int foundBlobs, int updatedBlobs) UpdateCoreTypeBlobs(string testDataFilePath, string[] blobs) - { - // Replace existing test data blobs with updated ones - string[] testDataLines = File.ReadAllLines(testDataFilePath); - List updatedTestDataLines = new List(); - int numberOfBlobs = 0; - int numberOfFoundBlobs = 0; - int numberOfUpdatedBlobs = 0; - - for (int i = 0; i < testDataLines.Length; i++) - { - string testDataLine = testDataLines[i]; - if (!testDataLine.Trim().StartsWith("yield") || numberOfBlobs >= blobs.Length) - { - updatedTestDataLines.Add(testDataLine); - continue; - } - - string pattern = null; - string replacement = null; - if (PlatformDetection.IsFullFramework) - { - pattern = ", \"AAEAAAD[^\"]+\"(?!,)"; - replacement = ", \"" + blobs[numberOfBlobs] + "\""; - } - else - { - pattern = "\"AAEAAAD[^\"]+\","; - replacement = "\"" + blobs[numberOfBlobs] + "\","; - } - - Regex regex = new Regex(pattern); - Match match = regex.Match(testDataLine); - if (match.Success) - { - numberOfFoundBlobs++; - } - string updatedLine = regex.Replace(testDataLine, replacement); - if (testDataLine != updatedLine) - { - numberOfUpdatedBlobs++; - } - testDataLine = updatedLine; - - updatedTestDataLines.Add(testDataLine); - numberOfBlobs++; - } - - // Check if all blobs were recognized and write updates to file - Assert.Equal(numberOfBlobs, blobs.Length); - File.WriteAllLines(testDataFilePath, updatedTestDataLines); - - return (numberOfBlobs, numberOfFoundBlobs, numberOfUpdatedBlobs); - } - - public static byte[] SerializeObjectToRaw(object obj, FormatterAssemblyStyle assemblyStyle) - { - BinaryFormatter bf = new BinaryFormatter(); - bf.AssemblyFormat = assemblyStyle; - using (MemoryStream ms = new MemoryStream()) - { - bf.Serialize(ms, obj); - return ms.ToArray(); - } - } - - public static string SerializeObjectToBlob(object obj, FormatterAssemblyStyle assemblyStyle) - { - byte[] raw = SerializeObjectToRaw(obj, assemblyStyle); - return Convert.ToBase64String(raw); - } - - public static object DeserializeRawToObject(byte[] raw, FormatterAssemblyStyle assemblyStyle) - { - var binaryFormatter = new BinaryFormatter(); - binaryFormatter.AssemblyFormat = assemblyStyle; - using (var serializedStream = new MemoryStream(raw)) - { - return binaryFormatter.Deserialize(serializedStream); - } - } - - public static object DeserializeBlobToObject(string base64Str, FormatterAssemblyStyle assemblyStyle) - { - byte[] raw = Convert.FromBase64String(base64Str); - return DeserializeRawToObject(raw, assemblyStyle); - } - - private static T FormatterClone( - T obj, - ISerializationSurrogate surrogate = null, - FormatterAssemblyStyle assemblyFormat = FormatterAssemblyStyle.Full, - TypeFilterLevel filterLevel = TypeFilterLevel.Full, - FormatterTypeStyle typeFormat = FormatterTypeStyle.TypesAlways) - { - BinaryFormatter f; - if (surrogate == null) - { - f = new BinaryFormatter(); - } - else - { - var c = new StreamingContext(); - var s = new SurrogateSelector(); - s.AddSurrogate(obj.GetType(), c, surrogate); - f = new BinaryFormatter(s, c); - } - f.AssemblyFormat = assemblyFormat; - f.FilterLevel = filterLevel; - f.TypeFormat = typeFormat; - - using (var s = new MemoryStream()) - { - f.Serialize(s, obj); - Assert.NotEqual(0, s.Position); - s.Position = 0; - return (T)(f.Deserialize(s)); - } - } - - private class DelegateBinder : SerializationBinder - { - public Func BindToTypeDelegate = null; - public override Type BindToType(string assemblyName, string typeName) => BindToTypeDelegate?.Invoke(assemblyName, typeName); - } - } -} diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs.REMOVED.git-id index d71bb60e11..8b95c10c91 100644 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs.REMOVED.git-id @@ -1 +1 @@ -49057a28eb5bc34b8c14fc1c1b912c9856c1f7ff \ No newline at end of file +54c78feee065866d1fc7b662d89a2b7e6c479830 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs index 88409fce52..690071e3d3 100644 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs +++ b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Reflection; using System.Runtime.Serialization.Formatters.Binary; using System.Text; +using System.Text.RegularExpressions; using Xunit; namespace System.Runtime.Serialization.Formatters.Tests @@ -19,8 +20,9 @@ namespace System.Runtime.Serialization.Formatters.Tests [MemberData(nameof(BasicObjectsRoundtrip_MemberData))] public void ValidateBasicObjectsRoundtrip(object obj, FormatterAssemblyStyle assemblyFormat, TypeFilterLevel filterLevel, FormatterTypeStyle typeFormat) { - object clone = FormatterClone(obj, null, assemblyFormat, filterLevel, typeFormat); - if (!ReferenceEquals(obj, string.Empty)) // "" is interned and will roundtrip as the same object + object clone = BinaryFormatterHelpers.Clone(obj, null, assemblyFormat, filterLevel, typeFormat); + // string.Empty and DBNull are both singletons + if (!ReferenceEquals(obj, string.Empty) && !(obj is DBNull)) { Assert.NotSame(obj, clone); } @@ -33,8 +35,10 @@ namespace System.Runtime.Serialization.Formatters.Tests public void UpdateBlobs() { string testDataFilePath = GetTestDataFilePath(); - IEnumerable coreTypeRecords = GetCoreTypeRecords(); - string[] coreTypeBlobs = GetCoreTypeBlobs(coreTypeRecords, FormatterAssemblyStyle.Full).ToArray(); + string[] coreTypeBlobs = SerializableEqualityComparers_MemberData() + .Concat(SerializableObjects_MemberData()) + .Select(record => BinaryFormatterHelpers.ToBase64String(record[0])) + .ToArray(); var (numberOfBlobs, numberOfFoundBlobs, numberOfUpdatedBlobs) = UpdateCoreTypeBlobs(testDataFilePath, coreTypeBlobs); Console.WriteLine($"{numberOfBlobs} existing blobs" + @@ -44,7 +48,15 @@ namespace System.Runtime.Serialization.Formatters.Tests [Theory] [MemberData(nameof(SerializableObjects_MemberData))] - public void ValidateAgainstBlobs(object obj, string[] blobs) + public void ValidateAgainstBlobs(object obj, string[] blobs) + => ValidateAndRoundtrip(obj, blobs, false); + + [Theory] + [MemberData(nameof(SerializableEqualityComparers_MemberData))] + public void ValidateEqualityComparersAgainstBlobs(object obj, string[] blobs) + => ValidateAndRoundtrip(obj, blobs, true); + + private static void ValidateAndRoundtrip(object obj, string[] blobs, bool isEqualityComparer) { if (obj == null) { @@ -54,15 +66,23 @@ namespace System.Runtime.Serialization.Formatters.Tests if (blobs == null || blobs.Length == 0) { throw new ArgumentOutOfRangeException($"Type {obj} has no blobs to deserialize and test equality against. Blob: " + - SerializeObjectToBlob(obj, FormatterAssemblyStyle.Full)); + BinaryFormatterHelpers.ToBase64String(obj, FormatterAssemblyStyle.Full)); } SanityCheckBlob(obj, blobs); foreach (string blob in blobs) { - CheckForAnyEquals(obj, DeserializeBlobToObject(blob, FormatterAssemblyStyle.Simple)); - CheckForAnyEquals(obj, DeserializeBlobToObject(blob, FormatterAssemblyStyle.Full)); + if (isEqualityComparer) + { + ValidateEqualityComparer(BinaryFormatterHelpers.FromBase64String(blob, FormatterAssemblyStyle.Simple)); + ValidateEqualityComparer(BinaryFormatterHelpers.FromBase64String(blob, FormatterAssemblyStyle.Full)); + } + else + { + CheckForAnyEquals(obj, BinaryFormatterHelpers.FromBase64String(blob, FormatterAssemblyStyle.Simple)); + CheckForAnyEquals(obj, BinaryFormatterHelpers.FromBase64String(blob, FormatterAssemblyStyle.Full)); + } } } @@ -74,8 +94,8 @@ namespace System.Runtime.Serialization.Formatters.Tests object obj = new ArraySegment(); string corefxBlob = "AAEAAAD/////AQAAAAAAAAAEAQAAAHJTeXN0ZW0uQXJyYXlTZWdtZW50YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAABl9hcnJheQdfb2Zmc2V0Bl9jb3VudAcAAAgICAoAAAAAAAAAAAs="; string netfxBlob = "AAEAAAD/////AQAAAAAAAAAEAQAAAHJTeXN0ZW0uQXJyYXlTZWdtZW50YDFbW1N5c3RlbS5JbnQzMiwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XV0DAAAABl9hcnJheQdfb2Zmc2V0Bl9jb3VudAcAAAgICAoAAAAAAAAAAAs="; - CheckForAnyEquals(obj, DeserializeBlobToObject(corefxBlob, FormatterAssemblyStyle.Full)); - CheckForAnyEquals(obj, DeserializeBlobToObject(netfxBlob, FormatterAssemblyStyle.Full)); + CheckForAnyEquals(obj, BinaryFormatterHelpers.FromBase64String(corefxBlob, FormatterAssemblyStyle.Full)); + CheckForAnyEquals(obj, BinaryFormatterHelpers.FromBase64String(netfxBlob, FormatterAssemblyStyle.Full)); } [Fact] @@ -86,7 +106,7 @@ namespace System.Runtime.Serialization.Formatters.Tests var obj = new SomeType() { SomeField = 7 }; string serializedObj = @"AAEAAAD/////AQAAAAAAAAAMAgAAAHNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249OS45OC43Ljk4NywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAAA2U3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNvbWVUeXBlAQAAAAlTb21lRmllbGQACAIAAAAHAAAACw=="; - var deserialized = (SomeType)DeserializeBlobToObject(serializedObj, FormatterAssemblyStyle.Simple); + var deserialized = (SomeType)BinaryFormatterHelpers.FromBase64String(serializedObj, FormatterAssemblyStyle.Simple); Assert.Equal(obj, deserialized); } @@ -98,34 +118,10 @@ namespace System.Runtime.Serialization.Formatters.Tests var obj = new GenericTypeWithArg() { Test = new SomeType() { SomeField = 9 } }; string serializedObj = @"AAEAAAD/////AQAAAAAAAAAMAgAAAHNTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249OS45OC43Ljk4NywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViBQEAAADxAVN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5HZW5lcmljVHlwZVdpdGhBcmdgMVtbU3lzdGVtLlJ1bnRpbWUuU2VyaWFsaXphdGlvbi5Gb3JtYXR0ZXJzLlRlc3RzLlNvbWVUeXBlLCBTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMsIFZlcnNpb249OS45OC43Ljk4NywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05ZDc3Y2M3YWQzOWI2OGViXV0BAAAABFRlc3QENlN5c3RlbS5SdW50aW1lLlNlcmlhbGl6YXRpb24uRm9ybWF0dGVycy5UZXN0cy5Tb21lVHlwZQIAAAACAAAACQMAAAAFAwAAADZTeXN0ZW0uUnVudGltZS5TZXJpYWxpemF0aW9uLkZvcm1hdHRlcnMuVGVzdHMuU29tZVR5cGUBAAAACVNvbWVGaWVsZAAIAgAAAAkAAAAL"; - var deserialized = (GenericTypeWithArg)DeserializeBlobToObject(serializedObj, FormatterAssemblyStyle.Simple); + var deserialized = (GenericTypeWithArg)BinaryFormatterHelpers.FromBase64String(serializedObj, FormatterAssemblyStyle.Simple); Assert.Equal(obj, deserialized); } - [Theory] - [MemberData(nameof(SerializableEqualityComparers_MemberData))] - public void ValidateEqualityComparersAgainstBlobs(object obj, string[] blobs) - { - if (obj == null) - { - throw new ArgumentNullException("The serializable object must not be null", nameof(obj)); - } - - if (blobs == null || blobs.Length == 0) - { - throw new ArgumentOutOfRangeException($"Type {obj} has no blobs to deserialize and test equality against. Blob: " + - SerializeObjectToBlob(obj, FormatterAssemblyStyle.Full)); - } - - SanityCheckBlob(obj, blobs); - - foreach (string blob in blobs) - { - ValidateEqualityComparer(DeserializeBlobToObject(blob, FormatterAssemblyStyle.Simple)); - ValidateEqualityComparer(DeserializeBlobToObject(blob, FormatterAssemblyStyle.Full)); - } - } - [Fact] public void RoundtripManyObjectsInOneStream() { @@ -150,7 +146,7 @@ namespace System.Runtime.Serialization.Formatters.Tests { object o = new object(); object[] arr = new[] { o, o, o, o, o }; - object[] result = FormatterClone(arr); + object[] result = BinaryFormatterHelpers.Clone(arr); Assert.Equal(arr.Length, result.Length); Assert.NotSame(arr, result); @@ -161,13 +157,6 @@ namespace System.Runtime.Serialization.Formatters.Tests } } - [Theory] - [MemberData(nameof(SerializableExceptions_MemberData))] - public void Roundtrip_Exceptions(Exception expected) - { - BinaryFormatterHelpers.AssertRoundtrips(expected); - } - [Theory] [MemberData(nameof(NonSerializableTypes_MemberData))] public void ValidateNonSerializableTypes(object obj, FormatterAssemblyStyle assemblyFormat, TypeFilterLevel filterLevel, FormatterTypeStyle typeFormat) @@ -189,9 +178,9 @@ namespace System.Runtime.Serialization.Formatters.Tests { var p = new NonSerializablePair() { Value1 = 1, Value2 = "2" }; Assert.False(p.GetType().IsSerializable); - Assert.Throws(() => FormatterClone(p)); + Assert.Throws(() => BinaryFormatterHelpers.Clone(p)); - NonSerializablePair result = FormatterClone(p, new NonSerializablePairSurrogate()); + NonSerializablePair result = BinaryFormatterHelpers.Clone(p, new NonSerializablePairSurrogate()); Assert.NotSame(p, result); Assert.Equal(p.Value1, result.Value1); Assert.Equal(p.Value2, result.Value2); @@ -374,7 +363,7 @@ namespace System.Runtime.Serialization.Formatters.Tests public void ObjectReference_RealObjectSerialized() { var obj = new ObjRefReturnsObj { Real = 42 }; - object real = FormatterClone(obj); + object real = BinaryFormatterHelpers.Clone(obj); Assert.Equal(42, real); } @@ -386,7 +375,7 @@ namespace System.Runtime.Serialization.Formatters.Tests public void Deserialize_FuzzInput(object obj, Random rand) { // Get the serialized data for the object - byte[] data = SerializeObjectToRaw(obj, FormatterAssemblyStyle.Simple); + byte[] data = BinaryFormatterHelpers.ToByteArray(obj, FormatterAssemblyStyle.Simple); // Make some "random" changes to it for (int i = 1; i < rand.Next(1, 100); i++) @@ -397,7 +386,7 @@ namespace System.Runtime.Serialization.Formatters.Tests // Try to deserialize that. try { - DeserializeRawToObject(data, FormatterAssemblyStyle.Simple); + BinaryFormatterHelpers.FromByteArray(data, FormatterAssemblyStyle.Simple); // Since there's no checksum, it's possible we changed data that didn't corrupt the instance } catch (ArgumentOutOfRangeException) { } @@ -470,7 +459,160 @@ namespace System.Runtime.Serialization.Formatters.Tests [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "UAPAOT does not support non-zero lower bounds")] public void Roundtrip_ArrayContainingArrayAtNonZeroLowerBound() { - FormatterClone(Array.CreateInstance(typeof(uint[]), new[] { 5 }, new[] { 1 })); + BinaryFormatterHelpers.Clone(Array.CreateInstance(typeof(uint[]), new[] { 5 }, new[] { 1 })); + } + + private static void CheckForAnyEquals(object obj, object deserializedObj) + { + Assert.True(EqualityExtensions.CheckEquals(obj, deserializedObj), "Error during equality check of type " + obj?.GetType()?.FullName); + } + + private static void ValidateEqualityComparer(object obj) + { + Type objType = obj.GetType(); + Assert.True(objType.IsGenericType, $"Type `{objType.FullName}` must be generic."); + Assert.Equal("System.Collections.Generic.ObjectEqualityComparer`1", objType.GetGenericTypeDefinition().FullName); + Assert.Equal(obj.GetType().GetGenericArguments()[0], objType.GetGenericArguments()[0]); + } + + private static void SanityCheckBlob(object obj, string[] blobs) + { + // These types are unstable during serialization and produce different blobs. + if (obj is WeakReference || + obj is Collections.Specialized.HybridDictionary || + obj is TimeZoneInfo.AdjustmentRule) + { + return; + } + + // Exceptions in Net Native can't be reflected and therefore skipping blob sanity check + if (obj is Exception && PlatformDetection.IsNetNative) + { + return; + } + + // Check if runtime generated blob is the same as the stored one + int frameworkBlobNumber = PlatformDetection.IsFullFramework ? 1 : 0; + if (frameworkBlobNumber < blobs.Length) + { + string runtimeBlob = BinaryFormatterHelpers.ToBase64String(obj, FormatterAssemblyStyle.Full); + + string storedComparableBlob = CreateComparableBlobInfo(blobs[frameworkBlobNumber]); + string runtimeComparableBlob = CreateComparableBlobInfo(runtimeBlob); + + Assert.True(storedComparableBlob == runtimeComparableBlob, + $"The stored blob for type {obj.GetType().FullName} is outdated and needs to be updated.{Environment.NewLine}{Environment.NewLine}" + + $"-------------------- Stored blob ---------------------{Environment.NewLine}" + + $"Encoded: {blobs[frameworkBlobNumber]}{Environment.NewLine}" + + $"Decoded: {storedComparableBlob}{Environment.NewLine}{Environment.NewLine}" + + $"--------------- Runtime generated blob ---------------{Environment.NewLine}" + + $"Encoded: {runtimeBlob}{Environment.NewLine}" + + $"Decoded: {runtimeComparableBlob}"); + } + } + + private static string GetTestDataFilePath() + { + string GetRepoRootPath() + { + var exeFile = new FileInfo(Assembly.GetExecutingAssembly().Location); + + DirectoryInfo root = exeFile.Directory; + while (!Directory.Exists(Path.Combine(root.FullName, ".git"))) + { + if (root.Parent == null) + return null; + + root = root.Parent; + } + + return root.FullName; + } + + // Get path to binary formatter test data + string repositoryRootPath = GetRepoRootPath(); + Assert.NotNull(repositoryRootPath); + string testDataFilePath = Path.Combine(repositoryRootPath, "src", "System.Runtime.Serialization.Formatters", "tests", "BinaryFormatterTestData.cs"); + Assert.True(File.Exists(testDataFilePath)); + + return testDataFilePath; + } + + private static string CreateComparableBlobInfo(string base64Blob) + { + string lineSeparator = ((char)0x2028).ToString(); + string paragraphSeparator = ((char)0x2029).ToString(); + + byte[] data = Convert.FromBase64String(base64Blob); + base64Blob = Encoding.UTF8.GetString(data); + + return Regex.Replace(base64Blob, @"Version=\d.\d.\d.\d.", "Version=0.0.0.0", RegexOptions.Multiline) + .Replace("\r\n", string.Empty) + .Replace("\n", string.Empty) + .Replace("\r", string.Empty) + .Replace(lineSeparator, string.Empty) + .Replace(paragraphSeparator, string.Empty); + } + + private static (int blobs, int foundBlobs, int updatedBlobs) UpdateCoreTypeBlobs(string testDataFilePath, string[] blobs) + { + // Replace existing test data blobs with updated ones + string[] testDataLines = File.ReadAllLines(testDataFilePath); + List updatedTestDataLines = new List(); + int numberOfBlobs = 0; + int numberOfFoundBlobs = 0; + int numberOfUpdatedBlobs = 0; + + for (int i = 0; i < testDataLines.Length; i++) + { + string testDataLine = testDataLines[i]; + if (!testDataLine.Trim().StartsWith("yield") || numberOfBlobs >= blobs.Length) + { + updatedTestDataLines.Add(testDataLine); + continue; + } + + string pattern = null; + string replacement = null; + if (PlatformDetection.IsFullFramework) + { + pattern = ", \"AAEAAAD[^\"]+\"(?!,)"; + replacement = ", \"" + blobs[numberOfBlobs] + "\""; + } + else + { + pattern = "\"AAEAAAD[^\"]+\","; + replacement = "\"" + blobs[numberOfBlobs] + "\","; + } + + Regex regex = new Regex(pattern); + Match match = regex.Match(testDataLine); + if (match.Success) + { + numberOfFoundBlobs++; + } + string updatedLine = regex.Replace(testDataLine, replacement); + if (testDataLine != updatedLine) + { + numberOfUpdatedBlobs++; + } + testDataLine = updatedLine; + + updatedTestDataLines.Add(testDataLine); + numberOfBlobs++; + } + + // Check if all blobs were recognized and write updates to file + Assert.Equal(numberOfBlobs, blobs.Length); + File.WriteAllLines(testDataFilePath, updatedTestDataLines); + + return (numberOfBlobs, numberOfFoundBlobs, numberOfUpdatedBlobs); + } + + private class DelegateBinder : SerializationBinder + { + public Func BindToTypeDelegate = null; + public override Type BindToType(string assemblyName, string typeName) => BindToTypeDelegate?.Invoke(assemblyName, typeName); } } } diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs index 162d0f8ddf..d0bd9245b1 100644 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs +++ b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs @@ -12,6 +12,7 @@ using System.Data.SqlTypes; using System.Globalization; using System.Linq; using System.Net; +using System.Reflection; using System.Runtime.CompilerServices; using Xunit; @@ -19,6 +20,104 @@ namespace System.Runtime.Serialization.Formatters.Tests { public static class EqualityExtensions { + private static MethodInfo GetExtensionMethod(Type extendedType) + { + if (extendedType.IsGenericType) + { + MethodInfo method = typeof(EqualityExtensions).GetMethods() + ?.SingleOrDefault(m => + m.Name == "IsEqual" && + m.GetParameters().Length == 2 && + m.GetParameters()[0].ParameterType.Name == extendedType.Name && + m.IsGenericMethodDefinition); + if (method != null) + return method.MakeGenericMethod(extendedType.GenericTypeArguments[0]); + } + + return typeof(EqualityExtensions).GetMethod("IsEqual", new[] { extendedType, extendedType }); + } + + public static bool CheckEquals(object objA, object objB) + { + if (objA == null && objB == null) + return true; + + if (objA != null && objB != null) + { + object equalityResult = null; + Type objType = objA.GetType(); + + // Check if custom equality extension method is available + MethodInfo customEqualityCheck = GetExtensionMethod(objType); + if (customEqualityCheck != null) + { + equalityResult = customEqualityCheck.Invoke(objA, new object[] { objA, objB }); + } + else + { + // Check if object.Equals(object) is overridden and if not check if there is a more concrete equality check implementation + bool equalsNotOverridden = objType.GetMethod("Equals", new Type[] { typeof(object) }).DeclaringType == typeof(object); + if (equalsNotOverridden) + { + // If type doesn't override Equals(object) method then check if there is a more concrete implementation + // e.g. if type implements IEquatable. + MethodInfo equalsMethod = objType.GetMethod("Equals", new Type[] { objType }); + if (equalsMethod.DeclaringType != typeof(object)) + { + equalityResult = equalsMethod.Invoke(objA, new object[] { objB }); + } + } + } + + if (equalityResult != null) + { + return (bool)equalityResult; + } + } + + if (objA is IEnumerable objAEnumerable && objB is IEnumerable objBEnumerable) + { + return CheckSequenceEquals(objAEnumerable, objBEnumerable); + } + + return objA.Equals(objB); + } + + public static bool CheckSequenceEquals(this IEnumerable @this, IEnumerable other) + { + if (@this == null || other == null) + return @this == other; + + if (@this.GetType() != other.GetType()) + return false; + + IEnumerator eA = null; + IEnumerator eB = null; + + try + { + eA = (@this as IEnumerable).GetEnumerator(); + eB = (@this as IEnumerable).GetEnumerator(); + while (true) + { + bool moved = eA.MoveNext(); + if (moved != eB.MoveNext()) + return false; + if (!moved) + return true; + if (eA.Current == null && eB.Current == null) + return true; + if (!CheckEquals(eA.Current, eB.Current)) + return true; + } + } + finally + { + (eA as IDisposable)?.Dispose(); + (eB as IDisposable)?.Dispose(); + } + } + public static bool IsEqual(this WeakReference @this, WeakReference other) { if (@this == null || other == null) @@ -90,7 +189,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Locale.LCID == other.Locale.LCID && @this.EnforceConstraints == other.EnforceConstraints && @this.ExtendedProperties?.Count == other.ExtendedProperties?.Count && - BinaryFormatterTests.CheckEquals(@this.ExtendedProperties, other.ExtendedProperties); + CheckEquals(@this.ExtendedProperties, other.ExtendedProperties); } public static bool IsEqual(this DataTable @this, DataTable other) @@ -153,7 +252,7 @@ namespace System.Runtime.Serialization.Formatters.Tests for (int i = 0; i < @this.Count; i++) { - if (!BinaryFormatterTests.CheckEquals(@this[i], other[i])) + if (!CheckEquals(@this[i], other[i])) return false; } @@ -170,17 +269,17 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.IsSynchronized == other.IsSynchronized)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return CheckSequenceEquals(@this, other); } public static bool IsEqual(this Dictionary @this, Dictionary other) { if (!(@this != null && other != null && - BinaryFormatterTests.CheckEquals(@this.Comparer, other.Comparer) && + CheckEquals(@this.Comparer, other.Comparer) && @this.Count == other.Count && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values))) + @this.Keys.CheckSequenceEquals(other.Keys) && + @this.Values.CheckSequenceEquals(other.Values))) return false; foreach (var kv in @this) @@ -203,10 +302,10 @@ namespace System.Runtime.Serialization.Formatters.Tests if (!(@this != null && other != null && @this.Count == other.Count && - BinaryFormatterTests.CheckEquals(@this.Comparer, other.Comparer))) + CheckEquals(@this.Comparer, other.Comparer))) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this LinkedListNode @this, LinkedListNode other) @@ -216,7 +315,7 @@ namespace System.Runtime.Serialization.Formatters.Tests return @this != null && other != null && - BinaryFormatterTests.CheckEquals(@this.Value, other.Value); + CheckEquals(@this.Value, other.Value); } public static bool IsEqual(this LinkedList @this, LinkedList other) @@ -228,7 +327,7 @@ namespace System.Runtime.Serialization.Formatters.Tests IsEqual(@this.Last, other.Last))) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this List @this, List other) @@ -239,7 +338,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this Queue @this, Queue other) @@ -249,7 +348,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this SortedList @this, SortedList other) @@ -257,13 +356,13 @@ namespace System.Runtime.Serialization.Formatters.Tests if (!(@this != null && other != null && @this.Capacity == other.Capacity && - BinaryFormatterTests.CheckEquals(@this.Comparer, other.Comparer) && + CheckEquals(@this.Comparer, other.Comparer) && @this.Count == other.Count && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values))) + @this.Keys.CheckSequenceEquals(other.Keys) && + @this.Values.CheckSequenceEquals(other.Values))) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this SortedSet @this, SortedSet other) @@ -271,12 +370,12 @@ namespace System.Runtime.Serialization.Formatters.Tests if (!(@this != null && other != null && @this.Count == other.Count && - BinaryFormatterTests.CheckEquals(@this.Comparer, other.Comparer) && - BinaryFormatterTests.CheckEquals(@this.Min, other.Min) && - BinaryFormatterTests.CheckEquals(@this.Max, other.Max))) + CheckEquals(@this.Comparer, other.Comparer) && + CheckEquals(@this.Min, other.Min) && + CheckEquals(@this.Max, other.Max))) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this Stack @this, Stack other) @@ -286,7 +385,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this Hashtable @this, Hashtable other) @@ -296,14 +395,14 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.IsReadOnly == other.IsReadOnly && @this.IsFixedSize == other.IsFixedSize && @this.IsSynchronized == other.IsSynchronized && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values) && + @this.Keys.CheckSequenceEquals(other.Keys) && + @this.Values.CheckSequenceEquals(other.Values) && @this.Count == other.Count)) return false; foreach (var key in @this.Keys) { - if (!BinaryFormatterTests.CheckEquals(@this[key], other[key])) + if (!CheckEquals(@this[key], other[key])) return false; } @@ -317,7 +416,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this ObservableCollection @this, ObservableCollection other) @@ -327,7 +426,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this ReadOnlyCollection @this, ReadOnlyCollection other) @@ -337,15 +436,15 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this ReadOnlyDictionary @this, ReadOnlyDictionary other) { if (!(@this != null && other != null && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values) && + @this.Keys.CheckSequenceEquals(other.Keys) && + @this.Values.CheckSequenceEquals(other.Values) && @this.Count == other.Count)) return false; @@ -365,7 +464,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this Queue @this, Queue other) @@ -376,7 +475,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.IsSynchronized == other.IsSynchronized)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this SortedList @this, SortedList other) @@ -385,14 +484,14 @@ namespace System.Runtime.Serialization.Formatters.Tests other != null && @this.Capacity == other.Capacity && @this.Count == other.Count && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values) && + @this.Keys.CheckSequenceEquals(other.Keys) && + @this.Values.CheckSequenceEquals(other.Values) && @this.IsReadOnly == other.IsReadOnly && @this.IsFixedSize == other.IsFixedSize && @this.IsSynchronized == other.IsSynchronized)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this HybridDictionary @this, HybridDictionary other) @@ -400,16 +499,16 @@ namespace System.Runtime.Serialization.Formatters.Tests if (!(@this != null && other != null && @this.Count == other.Count && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && + @this.Keys.CheckSequenceEquals(other.Keys) && @this.IsReadOnly == other.IsReadOnly && @this.IsFixedSize == other.IsFixedSize && @this.IsSynchronized == other.IsSynchronized && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values))) + @this.Values.CheckSequenceEquals(other.Values))) return false; foreach (var key in @this.Keys) { - if (!BinaryFormatterTests.CheckEquals(@this[key], other[key])) + if (!CheckEquals(@this[key], other[key])) return false; } @@ -421,16 +520,16 @@ namespace System.Runtime.Serialization.Formatters.Tests if (!(@this != null && other != null && @this.Count == other.Count && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && + @this.Keys.CheckSequenceEquals(other.Keys) && @this.IsReadOnly == other.IsReadOnly && @this.IsFixedSize == other.IsFixedSize && @this.IsSynchronized == other.IsSynchronized && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values))) + @this.Values.CheckSequenceEquals(other.Values))) return false; foreach (var key in @this.Keys) { - if (!BinaryFormatterTests.CheckEquals(@this[key], other[key])) + if (!CheckEquals(@this[key], other[key])) return false; } @@ -441,14 +540,14 @@ namespace System.Runtime.Serialization.Formatters.Tests { if (!(@this != null && other != null && - BinaryFormatterTests.CheckSequenceEquals(@this.AllKeys, other.AllKeys) && + @this.AllKeys.CheckSequenceEquals(other.AllKeys) && @this.Count == other.Count && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys))) + @this.Keys.CheckSequenceEquals(other.Keys))) return false; foreach (var key in @this.AllKeys) { - if (!BinaryFormatterTests.CheckEquals(@this[key], other[key])) + if (!CheckEquals(@this[key], other[key])) return false; } @@ -461,13 +560,13 @@ namespace System.Runtime.Serialization.Formatters.Tests other != null && @this.Count == other.Count && @this.IsReadOnly == other.IsReadOnly && - BinaryFormatterTests.CheckEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckEquals(@this.Values, other.Values))) + CheckEquals(@this.Keys, other.Keys) && + CheckEquals(@this.Values, other.Values))) return false; foreach (var key in @this.Keys) { - if (!BinaryFormatterTests.CheckEquals(@this[key], other[key])) + if (!CheckEquals(@this[key], other[key])) return false; } @@ -483,7 +582,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.IsSynchronized == other.IsSynchronized)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this Stack @this, Stack other) @@ -494,7 +593,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.IsSynchronized == other.IsSynchronized)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this BindingList @this, BindingList other) @@ -508,7 +607,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this BindingList @this, BindingList other) @@ -522,7 +621,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this PropertyCollection @this, PropertyCollection other) @@ -532,12 +631,12 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.IsReadOnly == other.IsReadOnly && @this.IsFixedSize == other.IsFixedSize && @this.IsSynchronized == other.IsSynchronized && - BinaryFormatterTests.CheckSequenceEquals(@this.Keys, other.Keys) && - BinaryFormatterTests.CheckSequenceEquals(@this.Values, other.Values) && + @this.Keys.CheckSequenceEquals(other.Keys) && + @this.Values.CheckSequenceEquals(other.Values) && @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this CompareInfo @this, CompareInfo other) @@ -569,14 +668,14 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Discard == other.Discard && @this.Domain == other.Domain && @this.Expired == other.Expired && - BinaryFormatterTests.CheckEquals(@this.Expires, other.Expires) && + CheckEquals(@this.Expires, other.Expires) && @this.Name == other.Name && @this.Path == other.Path && @this.Port == other.Port && @this.Secure == other.Secure && // This needs to have m_Timestamp set by reflection in order to roundtrip correctly // otherwise this field will change each time you create an object and cause this to fail - BinaryFormatterTests.CheckEquals(@this.TimeStamp, other.TimeStamp) && + CheckEquals(@this.TimeStamp, other.TimeStamp) && @this.Value == other.Value && @this.Version == other.Version; } @@ -588,7 +687,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this BasicISerializableObject @this, BasicISerializableObject other) @@ -672,7 +771,7 @@ namespace System.Runtime.Serialization.Formatters.Tests return false; } - return BinaryFormatterTests.CheckEquals(thisFlattened.Item2, otherFlattened.Item2); + return CheckEquals(thisFlattened.Item2, otherFlattened.Item2); } public static bool IsEqual(this ArraySegment @this, ArraySegment other) @@ -682,19 +781,19 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Offset == other.Offset)) return false; - return @this.Array == null || BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.Array == null || @this.CheckSequenceEquals(other); } public static bool IsEqual(this ObjectWithArrays @this, ObjectWithArrays other) { return @this != null && other != null && - BinaryFormatterTests.CheckEquals(@this.IntArray, other.IntArray) && - BinaryFormatterTests.CheckEquals(@this.StringArray, other.StringArray) && - BinaryFormatterTests.CheckEquals(@this.TreeArray, other.TreeArray) && - BinaryFormatterTests.CheckEquals(@this.ByteArray, other.ByteArray) && - BinaryFormatterTests.CheckEquals(@this.JaggedArray, other.JaggedArray) && - BinaryFormatterTests.CheckEquals(@this.MultiDimensionalArray, other.MultiDimensionalArray); + CheckEquals(@this.IntArray, other.IntArray) && + CheckEquals(@this.StringArray, other.StringArray) && + CheckEquals(@this.TreeArray, other.TreeArray) && + CheckEquals(@this.ByteArray, other.ByteArray) && + CheckEquals(@this.JaggedArray, other.JaggedArray) && + CheckEquals(@this.MultiDimensionalArray, other.MultiDimensionalArray); } public static bool IsEqual(this ObjectWithIntStringUShortUIntULongAndCustomObjectFields @this, ObjectWithIntStringUShortUIntULongAndCustomObjectFields other) @@ -750,7 +849,7 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.Count == other.Count)) return false; - return BinaryFormatterTests.CheckSequenceEquals(@this, other); + return @this.CheckSequenceEquals(other); } public static bool IsEqual(this Tree @this, Tree other) @@ -903,6 +1002,30 @@ namespace System.Runtime.Serialization.Formatters.Tests @this.MinorRevision == other.MinorRevision; } + public static bool IsEqual(this Exception @this, Exception other) + { + return @this != null && + other != null && + // On full framework, line number may be method body start + // On Net Native we can't reflect on Exceptions and change its StackTrace + ((PlatformDetection.IsFullFramework || PlatformDetection.IsNetNative) ? true : + (@this.StackTrace == other.StackTrace && + @this.ToString() == other.ToString())) && + @this.Data.CheckSequenceEquals(other.Data) && + @this.Message == other.Message && + @this.Source == other.Source && + // On Net Native we can't reflect on Exceptions and change its HResult + (PlatformDetection.IsNetNative ? true : @this.HResult == other.HResult) && + @this.HelpLink == other.HelpLink && + CheckEquals(@this.InnerException, other.InnerException); + } + + public static bool IsEqual(this AggregateException @this, AggregateException other) + { + return IsEqual(@this as Exception, other as Exception) && + @this.InnerExceptions.CheckSequenceEquals(other.InnerExceptions); + } + public class ReferenceComparer : IEqualityComparer where T: class { public bool Equals(T x, T y) diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs index 7dd48e984d..7d29a45d2b 100644 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs +++ b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs @@ -127,8 +127,7 @@ namespace System.Runtime.Serialization.Formatters.Tests } #pragma warning disable 0169 // The private field 'class member' is never used - [System.Runtime.CompilerServices.IsByRefLike] - private struct StructWithSpanField + private ref struct StructWithSpanField { Span _bytes; int _position; diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj index 09b8d01e08..4dcd801d24 100644 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Formatters/tests/System.Runtime.Serialization.Formatters.Tests.csproj @@ -10,7 +10,6 @@ - @@ -26,9 +25,6 @@ Common\System\NonRuntimeType.cs - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs @@ -43,4 +39,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs.REMOVED.git-id index 7d40ade2ed..0a29e46e80 100644 --- a/external/corefx/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs.REMOVED.git-id @@ -1 +1 @@ -2d7b6341dda4e648d4f238fc3f81f54ecf0de96b \ No newline at end of file +3b859dcc55dcc1fe42e53cf46dd4eb55195475e3 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Json/tests/Performance/System.Runtime.Serialization.Json.Performance.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Json/tests/Performance/System.Runtime.Serialization.Json.Performance.Tests.csproj index 73492a95cd..1a4a2be2f4 100644 --- a/external/corefx/src/System.Runtime.Serialization.Json/tests/Performance/System.Runtime.Serialization.Json.Performance.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Json/tests/Performance/System.Runtime.Serialization.Json.Performance.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/external/corefx/src/System.Runtime.Serialization.Json/tests/ReflectionOnly/System.Runtime.Serialization.Json.ReflectionOnly.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Json/tests/ReflectionOnly/System.Runtime.Serialization.Json.ReflectionOnly.Tests.csproj index b5b20ca402..35c2c57cb6 100644 --- a/external/corefx/src/System.Runtime.Serialization.Json/tests/ReflectionOnly/System.Runtime.Serialization.Json.ReflectionOnly.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Json/tests/ReflectionOnly/System.Runtime.Serialization.Json.ReflectionOnly.Tests.csproj @@ -12,10 +12,8 @@ + - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.csproj index 9da2683c92..250c5e60a4 100644 --- a/external/corefx/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Json/tests/System.Runtime.Serialization.Json.Tests.csproj @@ -15,10 +15,8 @@ + - - CommonTest\System\PlatformDetection.cs - \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Primitives/dir.props b/external/corefx/src/System.Runtime.Serialization.Primitives/dir.props index b5dea7fb76..b89fb6fc11 100644 --- a/external/corefx/src/System.Runtime.Serialization.Primitives/dir.props +++ b/external/corefx/src/System.Runtime.Serialization.Primitives/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Primitives/ref/Configurations.props b/external/corefx/src/System.Runtime.Serialization.Primitives/ref/Configurations.props index 192309fce5..c701755863 100644 --- a/external/corefx/src/System.Runtime.Serialization.Primitives/ref/Configurations.props +++ b/external/corefx/src/System.Runtime.Serialization.Primitives/ref/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap; diff --git a/external/corefx/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj b/external/corefx/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj index 3b049f5d3c..f36f6c4f8a 100644 --- a/external/corefx/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj @@ -7,8 +7,6 @@ - - diff --git a/external/corefx/src/System.Runtime.Serialization.Primitives/src/Configurations.props b/external/corefx/src/System.Runtime.Serialization.Primitives/src/Configurations.props index 083bbc7b58..dcb70afd11 100644 --- a/external/corefx/src/System.Runtime.Serialization.Primitives/src/Configurations.props +++ b/external/corefx/src/System.Runtime.Serialization.Primitives/src/Configurations.props @@ -4,7 +4,6 @@ uapaot-Windows_NT; uap-Windows_NT; - netfx-Windows_NT; netcoreapp; diff --git a/external/corefx/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj b/external/corefx/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj index f8a3ff3b9e..944f2e2e4e 100644 --- a/external/corefx/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj @@ -14,8 +14,6 @@ - - diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/dir.props b/external/corefx/src/System.Runtime.Serialization.Xml/dir.props index eed54a2340..b4fda06b13 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/dir.props +++ b/external/corefx/src/System.Runtime.Serialization.Xml/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/ref/Configurations.props b/external/corefx/src/System.Runtime.Serialization.Xml/ref/Configurations.props index 192309fce5..c701755863 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/ref/Configurations.props +++ b/external/corefx/src/System.Runtime.Serialization.Xml/ref/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap; diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj b/external/corefx/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj index 7a57534de3..dfed0e9cb8 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Xml/ref/System.Runtime.Serialization.Xml.csproj @@ -7,8 +7,6 @@ - - diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/src/Configurations.props b/external/corefx/src/System.Runtime.Serialization.Xml/src/Configurations.props index 2204d7da51..a8910ef718 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/src/Configurations.props +++ b/external/corefx/src/System.Runtime.Serialization.Xml/src/Configurations.props @@ -3,7 +3,6 @@ uap-Windows_NT; - netfx-Windows_NT; netcoreapp; diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj b/external/corefx/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj index 34068af141..ef2c40e000 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Xml/src/System.Runtime.Serialization.Xml.csproj @@ -6,8 +6,6 @@ true {9D747A18-C8FD-4D7A-8913-4ED7911683B4} - - diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/CryptoCanonicalization/CanonicalWriter.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/CryptoCanonicalization/CanonicalWriter.cs index 39747c6ea2..a29b8ced5a 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/CryptoCanonicalization/CanonicalWriter.cs +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/CryptoCanonicalization/CanonicalWriter.cs @@ -822,7 +822,7 @@ namespace System.Runtime.Serialization.Xml.Canonicalization.Tests { if (prefix.Length != 0) { - throw new InvalidOperationException("Invalid Namespaceffor empty Prefix."); + throw new InvalidOperationException("Invalid Namespace for empty Prefix."); } } else if (prefix.Length == 0) diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/XmlCanonicalizationTest.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/XmlCanonicalizationTest.cs index 63fd2cebd9..b210ddc9c7 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/XmlCanonicalizationTest.cs +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Canonicalization/XmlCanonicalizationTest.cs @@ -188,9 +188,9 @@ namespace System.Runtime.Serialization.Xml.Canonicalization.Tests string rwTypeStr = input.Arguments[0].Value; ReaderWriterFactory.ReaderWriterType rwType = (ReaderWriterFactory.ReaderWriterType)Enum.Parse(typeof(ReaderWriterFactory.ReaderWriterType), rwTypeStr, true); Encoding encoding = Encoding.GetEncoding((string)input.Arguments[1].Value); - string sampleXmlFileName = Path.Combine("baselines", input2.Arguments[0].Value); + string sampleXmlFileName = input2.Arguments[0].Value; bool mustSupportV14N = input.Arguments[2].Value == "true"; - string baselineFileName = Path.Combine("baselines", input2.Arguments[1].Value); + string baselineFileName = input2.Arguments[1].Value; bool testWithComments = input3.Arguments[0].Value == "true"; @@ -253,13 +253,13 @@ namespace System.Runtime.Serialization.Xml.Canonicalization.Tests foreach (var input in params4.Inputs) { count++; - string sampleXmlFileName = Path.Combine("baselines", input.Arguments[3].Value); + string sampleXmlFileName = input.Arguments[3].Value; string rwTypeStr = input.Arguments[0].Value; ReaderWriterFactory.ReaderWriterType rwType = (ReaderWriterFactory.ReaderWriterType)Enum.Parse(typeof(ReaderWriterFactory.ReaderWriterType), rwTypeStr, true); Encoding encoding = Encoding.GetEncoding((string)input.Arguments[1].Value); bool mustSupportV14N = input.Arguments[2].Value == "true"; - string baselineFileName = Path.Combine("baselines", "ReaderWriter_C14N_BaselineXML_OnlyLF.xml"); + string baselineFileName = "ReaderWriter_C14N_BaselineXML_OnlyLF.xml"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; @@ -384,7 +384,7 @@ namespace System.Runtime.Serialization.Xml.Canonicalization.Tests mode = TestMode.StartAtSpecifiedElement; } - xmlBuffer = new XmlBuffer(Path.Combine("baselines", input.Arguments[0].Value)); + xmlBuffer = new XmlBuffer(input.Arguments[0].Value); engine = new Engine(includeComments, inclusivePrefixes, mode == TestMode.FullDocument); XmlReader reader = CreateReader(mode, xmlBuffer, startAt); diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs.REMOVED.git-id index 4d566d8d4a..0472bef766 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs.REMOVED.git-id @@ -1 +1 @@ -12ca06d9a70d231766fc8f723ab2e105371414c6 \ No newline at end of file +65c14ab817ffcb1d434c1403bd9dc6baacc7936b \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Performance/System.Runtime.Serialization.Xml.Performance.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Performance/System.Runtime.Serialization.Xml.Performance.Tests.csproj index af4c88efc9..738256206c 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Performance/System.Runtime.Serialization.Xml.Performance.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Performance/System.Runtime.Serialization.Xml.Performance.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/Resources/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.rd.xml b/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/Resources/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.rd.xml index 969d1fe150..8cec5f715a 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/Resources/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.rd.xml +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/Resources/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.rd.xml @@ -25,5 +25,13 @@ + + + + + + + + diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj index f3756d6307..a60b5fdddb 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/ReflectionOnly/System.Runtime.Serialization.Xml.ReflectionOnly.Tests.csproj @@ -14,24 +14,56 @@ + - - - - - - + Common\System\IO\TempFile.cs - - CommonTest\System\PlatformDetection.cs - SerializationTestTypes\ObjRefSample.cs + + SerializationTestTypes\ComparisonHelper.cs + + + SerializationTestTypes\DataContractResolverLibrary.cs + + + SerializationTestTypes\DCRSampleType.cs + + + SerializationTestTypes\DCRTypeLibrary.cs + + + SerializationTestTypes\Primitives.cs + + + SerializationTestTypes\Collections.cs + + + SerializationTestTypes\DataContract.cs + + + SerializationTestTypes\DCRImplVariations.cs + + + SerializationTestTypes\InheritenceCases.cs + + + SerializationTestTypes\InheritenceObjectRef.cs + + + SerializationTestTypes\SampleIObjectRef.cs + + + SerializationTestTypes\SampleTypes.cs + + + SerializationTestTypes\SelfRefAndCycles.cs + diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/Resources/System.Runtime.Serialization.Xml.Tests.rd.xml b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Resources/System.Runtime.Serialization.Xml.Tests.rd.xml new file mode 100644 index 0000000000..6806e15e9f --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/Resources/System.Runtime.Serialization.Xml.Tests.rd.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Collections.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Collections.cs new file mode 100644 index 0000000000..aed139d9dc --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Collections.cs @@ -0,0 +1,464 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace SerializationTestTypes +{ + public class ContainsLinkedList + { + public LinkedList Data; + + public ContainsLinkedList() { } + public ContainsLinkedList(bool init) + { + this.Data = new LinkedList(); + SimpleDCWithRef d1 = new SimpleDCWithRef(true); + SimpleDCWithRef d2 = new SimpleDCWithRef(true); + d2.Data.Data = d1.RefData.Data; + Data.AddLast(d1); + Data.AddLast(d2); + Data.AddLast(d2); + Data.AddLast(d1); + SimpleDCWithRef d3 = new SimpleDCWithRef(true); + SimpleDCWithRef d4 = new SimpleDCWithRef(true); + d4.Data = d3.RefData; + Data.AddLast(d4); + Data.AddLast(d3); + SimpleDCWithRef d5 = new SimpleDCWithRef(true); + SimpleDCWithRef d6 = new SimpleDCWithRef(true); + SimpleDCWithRef d7 = new SimpleDCWithRef(true); + d6.Data = d5.Data; + d7.Data = d5.RefData; + d7.RefData = d6.RefData; + Data.AddLast(d7); + } + } + + #region Simple CDC + + [CollectionDataContract(Name = "SimpleCDC", ItemName = "Item", IsReference = true)] + public class SimpleCDC : ICollection + { + private List _data = new List(); + public SimpleCDC() { } + public SimpleCDC(bool init) + { + _data.Add("One"); + _data.Add("Two"); + _data.Add("two"); + } + + #region ICollection Members + + public void Add(string item) + { + _data.Add(item); + } + + public void Clear() + { + _data.Clear(); + } + + public bool Contains(string item) + { + return _data.Contains(item); + } + + public void CopyTo(string[] array, int arrayIndex) + { + _data.CopyTo(array, arrayIndex); + } + + public int Count + { + get { return _data.Count; } + } + + public bool IsReadOnly + { + get { return false; } + } + + public bool Remove(string item) + { + return _data.Remove(item); + } + + #endregion + + #region IEnumerable Members + + public IEnumerator GetEnumerator() + { + return _data.GetEnumerator(); + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return _data.GetEnumerator(); + } + + #endregion + } + + [CollectionDataContract(Name = "SimpleCDC2", ItemName = "Item", IsReference = true)] + public class SimpleCDC2 : ICollection + { + private List _data = new List(); + public SimpleCDC2() { } + public SimpleCDC2(bool init) + { + _data.Add("One"); + _data.Add("Two"); + _data.Add("two"); + } + + #region ICollection Members + + public void Add(string item) + { + _data.Add(item); + } + + public void Clear() + { + _data.Clear(); + } + + public bool Contains(string item) + { + return _data.Contains(item); + } + + public void CopyTo(string[] array, int arrayIndex) + { + _data.CopyTo(array, arrayIndex); + } + + public int Count + { + get { return _data.Count; } + } + + public bool IsReadOnly + { + get { return false; } + } + + public bool Remove(string item) + { + return _data.Remove(item); + } + + #endregion + + #region IEnumerable Members + + public IEnumerator GetEnumerator() + { + return _data.GetEnumerator(); + } + + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return _data.GetEnumerator(); + } + + #endregion + } + + [DataContract(IsReference = true)] + public class ContainsSimpleCDC + { + [DataMember] + public SimpleCDC data1; + + [DataMember] + public SimpleCDC2 data2; + + public ContainsSimpleCDC() { } + public ContainsSimpleCDC(bool init) + { + data1 = new SimpleCDC(true); + data2 = new SimpleCDC2(true); + } + } + #endregion + + #region DMs in Collections + + [DataContract(IsReference = true)] + public class DMInCollection1 + { + [DataMember] + public SimpleDC Data1; + + [DataMember] + public List List1; + + public DMInCollection1() { } + public DMInCollection1(bool init) + { + Data1 = new SimpleDC(true); + List1 = new List(); + List1.Add(Data1); + List1.Add(new SimpleDC(true)); + List1.Add(List1[1]); + } + } + + [DataContract(IsReference = true)] + public class DMInCollection2 + { + [DataMember] + public IEnumerable List4; + + [DataMember] + public ICollection List3; + + [DataMember] + public IList List2; + + [DataMember] + public List List1; + + [DataMember] + public SimpleDC Data; + + [DataMember] + public string InnerContent; + + [DataMember] + public string InnerInnerContent; + + public DMInCollection2() { } + public DMInCollection2(bool init) + { + List1 = new List(); + List2 = new List(); + List1.Add(new SimpleDC(true)); + List1.Add(new SimpleDC(true)); + List1.Add(new SimpleDC(true)); + List1.Add(new SimpleDC(true)); + List2.Add(List1[0]); + List2.Add(new SimpleDC(true)); + List1.Add(List2[1]); + List3 = List1; + List4 = List2; + Data = List2[0]; + InnerContent = Data.Data; + InnerInnerContent = List1[3].Data; + } + } + + [DataContract(IsReference = true)] + public class DMInDict1 + { + [DataMember] + public string InnerInnerData1; + + [DataMember] + public Dictionary Dict1; + + [DataMember] + public IDictionary Dict2; + + [DataMember] + public KeyValuePair Kvp1; + + [DataMember] + public SimpleDC Data1; + + [DataMember] + public SimpleDC Data2; + + [DataMember] + public string InnerData1; + + public DMInDict1() { } + public DMInDict1(bool init) + { + Dict1 = new Dictionary(); + Data1 = new SimpleDC(true); + Data2 = new SimpleDC(true); + InnerInnerData1 = new Guid("cd4f6d1f-db5e-49c9-bb43-13e73508a549").ToString(); + InnerData1 = Data1.Data; + + SimpleDC t1 = new SimpleDC(true); + SimpleDC t2 = new SimpleDC(true); + t2.Data = InnerInnerData1; + Dict1.Add(t1, t2); + Dict1.Add(Data1, Data2); + Dict1.Add(new SimpleDC(true), t2); + Dict1.Add(t2, new SimpleDC(true)); + Dict2 = Dict1; + foreach (KeyValuePair kvp in Dict1) + { + Kvp1 = kvp; + } + } + } + + #endregion + + #region DMs in Collection where DMs are of DCs with Ref + + [DataContract(IsReference = true)] + public class DMWithRefInCollection1 + { + [DataMember] + public SimpleDCWithSimpleDMRef Data1; + + [DataMember] + public List List1; + + [DataMember] + public string InnerData1; + + public DMWithRefInCollection1() { } + public DMWithRefInCollection1(bool init) + { + InnerData1 = new Guid("a6d053ed-f7d4-42fb-8e56-e4b425f26fa9").ToString(); + Data1 = new SimpleDCWithSimpleDMRef(true); + List1 = new List(); + List1.Add(Data1); + List1.Add(new SimpleDCWithSimpleDMRef(true)); + List1.Add(List1[1]); + List1[1].Data = InnerData1; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(SimpleDC))] + [KnownType(typeof(SimpleDCWithRef))] + [KnownType(typeof(SimpleDCWithSimpleDMRef))] + [KnownType(typeof(List))] + [KnownType(typeof(List))] + [KnownType(typeof(List))] + public class DMWithRefInCollection2 + { + [DataMember] + public IEnumerable List4; + + [DataMember] + public ICollection List3; + + [DataMember] + public IList List2; + + [DataMember] + public List List1; + + [DataMember] + public List List5; + + [DataMember] + public List List6; + + [DataMember] + public SimpleDC Data; + + [DataMember] + public string InnerContent; + + [DataMember] + public string InnerInnerContent; + + public DMWithRefInCollection2() { } + public DMWithRefInCollection2(bool init) + { + List1 = new List(); + List2 = new List(); + List1.Add(new SimpleDCWithRef(true)); + List1.Add(new SimpleDCWithRef(true)); + List1.Add(new SimpleDCWithRef(true)); + List1.Add(new SimpleDCWithRef(true)); + List2.Add(List1[0]); + List2.Add(new SimpleDCWithRef(true)); + List1.Add(List2[1]); + List3 = List1; + List4 = List2; + Data = List2[0].Data; + InnerContent = Data.Data; + InnerInnerContent = List1[3].Data.Data; + List5 = new List(); + List5.Add(Data); + List5.Add(new SimpleDC(true)); + List5.Add(Data); + List6 = new List(); + List6.Add(new SimpleDC(true)); + List6.Add(new SimpleDCWithRef(true)); + List6.Add(new SimpleDCWithSimpleDMRef(true)); + List6.Add(new List()); + List6.Add(new List()); + List6.Add(new List()); + List6.Add(List1); + List6.Add(List2); + List6.Add(List3); + List6.Add(List4); + List6.Add(List5); + List6.Add(Data); + List6.Add(InnerContent); + List6.Add(InnerInnerContent); + } + } + + [DataContract(IsReference = true)] + public class DMWithRefInDict1 + { + [DataMember] + public string InnerInnerData1; + + [DataMember] + public Dictionary Dict1; + + [DataMember] + public IDictionary Dict2; + + [DataMember] + public KeyValuePair Kvp1; + + [DataMember] + public SimpleDCWithRef Data1; + + [DataMember] + public SimpleDCWithRef Data2; + + [DataMember] + public SimpleDC InnerData1; + + public DMWithRefInDict1() { } + public DMWithRefInDict1(bool init) + { + Dict1 = new Dictionary(); + Data1 = new SimpleDCWithRef(true); + Data2 = new SimpleDCWithRef(true); + InnerInnerData1 = new Guid("6d807157-536f-4794-a157-e463a11029aa").ToString(); + InnerData1 = Data1.Data; + + SimpleDCWithRef t1 = new SimpleDCWithRef(true); + SimpleDCWithRef t2 = new SimpleDCWithRef(true); + t2.Data.Data = InnerInnerData1; + Dict1.Add(t1, t2); + Dict1.Add(Data1, Data2); + Dict1.Add(new SimpleDCWithRef(true), t2); + Dict1.Add(t2, new SimpleDCWithRef(true)); + Dict2 = Dict1; + foreach (KeyValuePair kvp in Dict1) + { + Kvp1 = kvp; + } + } + } + + #endregion +} \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRImplVariations.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRImplVariations.cs new file mode 100644 index 0000000000..38575d46df --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRImplVariations.cs @@ -0,0 +1,97 @@ +using System; +using System.Runtime.Serialization; +using System.Xml; + +namespace SerializationTestTypes +{ + [DataContract] + public class Person1 + { + public object address; + + public Person1(string variation) + { + age = 10; + name = "Tintin"; + address = new Address("rd", "wa", 90012); + } + + public Person1() + { + } + + [DataMember] + public int age; + + [DataMember] + public string name; + } + + [DataContract] + public class Person2 : Person1 + { + [DataMember] + public Guid Uid; + + [DataMember] + public XmlQualifiedName[] XQAArray; + + [DataMember] + public object anyData; + + public Person2() + { + Uid = new Guid("ff816178-54df-2ea8-6511-cfeb4d14ab5a"); + XQAArray = new XmlQualifiedName[] { new XmlQualifiedName("Name1", "http://www.PlayForFun.com"), new XmlQualifiedName("Name2", "http://www.FunPlay.com") }; + anyData = new Kid(); + } + } + + public class Kid : Person1 + { + [DataMember] + public object FavoriteToy; + + public Kid() + { + FavoriteToy = new Blocks("Orange"); + age = 3; + } + } + + [DataContract] + public class Blocks + { + public Blocks(string s) + { + color = s; + } + + [DataMember] + public string color; + } + + [DataContract] + public class Address + { + public Address() + { + } + + public Address(string c, string s, int z) + { + City = c; + State = s; + ZipCode = z; + } + + [DataMember] + public string City; + + [DataMember] + public string State; + + [DataMember] + public int ZipCode; + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRTypeLibrary.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRTypeLibrary.cs index d4104ea70a..d7186f8813 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRTypeLibrary.cs +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DCRTypeLibrary.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization; +using System.Xml.Serialization; namespace SerializationTestTypes { @@ -194,4 +195,757 @@ namespace SerializationTestTypes make = "Chevrolet"; } } + + public class TypeNotFound { }; + + public class TypeLibraryManager + { + private List _primitiveTypeList = new List(); + private List _collectionTypeList = new List(); + private List _selfRefAndCyclesTypeList = new List(); + private List _iobjectRefTypeList = new List(); + private List _sampleTypeList = new List(); + private List _isReferenceTypeList = new List(); + private List _allTypesList = new List(); + private List _fxPrimitivesInCollectionList = new List(); + + private Hashtable _allTypeHashTable = new Hashtable(); + + public Hashtable AllTypesHashtable + { + get + { + if (_allTypeHashTable.Count == 0) + { + _allTypeHashTable = new Hashtable(); + foreach (Type t in AllTypesList) + { + _allTypeHashTable.Add(t.FullName, t); + } + } + return _allTypeHashTable; + } + } + + public List FxPrimitivesInCollectionList + { + get + { + if (_fxPrimitivesInCollectionList.Count == 0) + { + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List)); + _fxPrimitivesInCollectionList.Add(typeof(List>)); + } + return _fxPrimitivesInCollectionList; + } + } + + public List AllTypesList + { + get + { + if (_allTypesList.Count == 0) + { + _allTypesList.AddRange(this.FxPrimitivesInCollectionList); + _allTypesList.AddRange(this.EnumsStructList); + _allTypesList.AddRange(this.SelfRefAndCyclesTypeList); + _allTypesList.AddRange(this.IsReferenceTypeList); + _allTypesList.AddRange(this.IObjectRefTypeList); + _allTypesList.AddRange(this.CollectionsTypeList); + _allTypesList.AddRange(this.SampleTypeList); + } + return _allTypesList; + } + } + + public List IsReferenceTypeList + { + get + { + if (_isReferenceTypeList.Count == 0) + { + _isReferenceTypeList.Add(typeof(TestInheritence9)); + _isReferenceTypeList.Add(typeof(SimpleDC)); + _isReferenceTypeList.Add(typeof(SimpleDCWithSimpleDMRef)); + _isReferenceTypeList.Add(typeof(SimpleDCWithRef)); + _isReferenceTypeList.Add(typeof(ContainsSimpleDCWithRef)); + _isReferenceTypeList.Add(typeof(SimpleDCWithIsRequiredFalse)); + _isReferenceTypeList.Add(typeof(Mixed1)); + _isReferenceTypeList.Add(typeof(SerIser)); + _isReferenceTypeList.Add(typeof(DCVersioned1)); + _isReferenceTypeList.Add(typeof(DCVersioned2)); + _isReferenceTypeList.Add(typeof(DCVersionedContainer1)); + _isReferenceTypeList.Add(typeof(DCVersionedContainerVersion1)); + _isReferenceTypeList.Add(typeof(DCVersionedContainerVersion2)); + _isReferenceTypeList.Add(typeof(DCVersionedContainerVersion3)); + _isReferenceTypeList.Add(typeof(BaseDC)); + _isReferenceTypeList.Add(typeof(BaseSerializable)); + _isReferenceTypeList.Add(typeof(DerivedDC)); + _isReferenceTypeList.Add(typeof(DerivedSerializable)); + _isReferenceTypeList.Add(typeof(DerivedDCIsRefBaseSerializable)); + _isReferenceTypeList.Add(typeof(DerivedDCBaseSerializable)); + _isReferenceTypeList.Add(typeof(Derived2DC)); + _isReferenceTypeList.Add(typeof(BaseDCNoIsRef)); + _isReferenceTypeList.Add(typeof(DerivedPOCOBaseDCNOISRef)); + _isReferenceTypeList.Add(typeof(DerivedIXmlSerializable_POCOBaseDCNOISRef)); + _isReferenceTypeList.Add(typeof(DerivedCDCFromBaseDC)); + _isReferenceTypeList.Add(typeof(Derived2Serializable)); + _isReferenceTypeList.Add(typeof(Derived2SerializablePositive)); + _isReferenceTypeList.Add(typeof(Derived2Derived2Serializable)); + _isReferenceTypeList.Add(typeof(Derived3Derived2Serializable)); + _isReferenceTypeList.Add(typeof(Derived31Derived2SerializablePOCO)); + _isReferenceTypeList.Add(typeof(Derived4Derived2Serializable)); + _isReferenceTypeList.Add(typeof(Derived5Derived2Serializable)); + _isReferenceTypeList.Add(typeof(Derived6Derived2SerializablePOCO)); + _isReferenceTypeList.Add(typeof(BaseWithIsRefTrue)); + _isReferenceTypeList.Add(typeof(DerivedNoIsRef)); + _isReferenceTypeList.Add(typeof(DerivedNoIsRef2)); + _isReferenceTypeList.Add(typeof(DerivedNoIsRef3)); + _isReferenceTypeList.Add(typeof(DerivedNoIsRef4)); + _isReferenceTypeList.Add(typeof(DerivedNoIsRef5)); + _isReferenceTypeList.Add(typeof(DerivedNoIsRefWithIsRefTrue6)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefFalse)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefFalse2)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefFalse3)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefFalse4)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefFalse5)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefTrue6)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefTrueExplicit)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefTrueExplicit2)); + _isReferenceTypeList.Add(typeof(BaseNoIsRef)); + _isReferenceTypeList.Add(typeof(DerivedWithIsRefFalseExplicit)); + _isReferenceTypeList.Add(typeof(TestInheritence)); + _isReferenceTypeList.Add(typeof(TestInheritence91)); + _isReferenceTypeList.Add(typeof(TestInheritence5)); + _isReferenceTypeList.Add(typeof(TestInheritence10)); + _isReferenceTypeList.Add(typeof(TestInheritence2)); + _isReferenceTypeList.Add(typeof(TestInheritence11)); + _isReferenceTypeList.Add(typeof(TestInheritence3)); + _isReferenceTypeList.Add(typeof(TestInheritence16)); + _isReferenceTypeList.Add(typeof(TestInheritence4)); + _isReferenceTypeList.Add(typeof(TestInheritence12)); + _isReferenceTypeList.Add(typeof(TestInheritence6)); + _isReferenceTypeList.Add(typeof(TestInheritence7)); + _isReferenceTypeList.Add(typeof(TestInheritence14)); + _isReferenceTypeList.Add(typeof(TestInheritence8)); + } + return _isReferenceTypeList; + } + } + + public List SelfRefAndCyclesTypeList + { + get + { + if (_selfRefAndCyclesTypeList.Count == 0) + { + _selfRefAndCyclesTypeList.Add(typeof(SelfRef1)); + _selfRefAndCyclesTypeList.Add(typeof(SelfRef1DoubleDM)); + _selfRefAndCyclesTypeList.Add(typeof(SelfRef2)); + _selfRefAndCyclesTypeList.Add(typeof(SelfRef3)); + _selfRefAndCyclesTypeList.Add(typeof(Cyclic1)); + _selfRefAndCyclesTypeList.Add(typeof(Cyclic2)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicA)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicB)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicC)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicD)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD1)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD2)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD3)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD4)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD5)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD6)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD7)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCD8)); + _selfRefAndCyclesTypeList.Add(typeof(CyclicABCDNoCycles)); + _selfRefAndCyclesTypeList.Add(typeof(A1)); + _selfRefAndCyclesTypeList.Add(typeof(B1)); + _selfRefAndCyclesTypeList.Add(typeof(C1)); + _selfRefAndCyclesTypeList.Add(typeof(BB1)); + _selfRefAndCyclesTypeList.Add(typeof(BBB1)); + } + return _selfRefAndCyclesTypeList; + } + } + + public List IObjectRefTypeList + { + get + { + if (_iobjectRefTypeList.Count == 0) + { + _iobjectRefTypeList.Add(typeof(DCExplicitInterfaceIObjRef)); + _iobjectRefTypeList.Add(typeof(DCIObjRef)); + _iobjectRefTypeList.Add(typeof(SerExplicitInterfaceIObjRefReturnsPrivate)); + _iobjectRefTypeList.Add(typeof(SerIObjRefReturnsPrivate)); + _iobjectRefTypeList.Add(typeof(DCExplicitInterfaceIObjRefReturnsPrivate)); + _iobjectRefTypeList.Add(typeof(DCIObjRefReturnsPrivate)); + } + return _iobjectRefTypeList; + } + } + + public List EnumsStructList + { + get + { + if (_primitiveTypeList.Count == 0) + { + _primitiveTypeList.Add(typeof(Person)); + _primitiveTypeList.Add(typeof(CharClass)); + _primitiveTypeList.Add(typeof(AllTypes)); + _primitiveTypeList.Add(typeof(AllTypes2)); + _primitiveTypeList.Add(typeof(DictContainer)); + _primitiveTypeList.Add(typeof(ListContainer)); + _primitiveTypeList.Add(typeof(ArrayContainer)); + _primitiveTypeList.Add(typeof(EnumContainer1)); + _primitiveTypeList.Add(typeof(EnumContainer2)); + _primitiveTypeList.Add(typeof(EnumContainer3)); + _primitiveTypeList.Add(typeof(WithStatic)); + _primitiveTypeList.Add(typeof(DerivedFromPriC)); + _primitiveTypeList.Add(typeof(EmptyDC)); + _primitiveTypeList.Add(typeof(Base)); + _primitiveTypeList.Add(typeof(Derived)); + _primitiveTypeList.Add(typeof(list)); + _primitiveTypeList.Add(typeof(Arrays)); + _primitiveTypeList.Add(typeof(Array3)); + _primitiveTypeList.Add(typeof(Properties)); + _primitiveTypeList.Add(typeof(HaveNS)); + _primitiveTypeList.Add(typeof(OutClass)); + _primitiveTypeList.Add(typeof(Temp)); + _primitiveTypeList.Add(typeof(Array22)); + _primitiveTypeList.Add(typeof(Person2)); + _primitiveTypeList.Add(typeof(BoxedPrim)); + _primitiveTypeList.Add(typeof(MyEnum)); + _primitiveTypeList.Add(typeof(MyPrivateEnum1)); + _primitiveTypeList.Add(typeof(MyPrivateEnum2)); + _primitiveTypeList.Add(typeof(MyPrivateEnum3)); + _primitiveTypeList.Add(typeof(MyEnum1)); + _primitiveTypeList.Add(typeof(MyEnum2)); + _primitiveTypeList.Add(typeof(MyEnum3)); + _primitiveTypeList.Add(typeof(MyEnum4)); + _primitiveTypeList.Add(typeof(MyEnum7)); + _primitiveTypeList.Add(typeof(MyEnum8)); + _primitiveTypeList.Add(typeof(SeasonsEnumContainer)); + } + return _primitiveTypeList; + } + } + + public List CollectionsTypeList + { + get + { + if (_collectionTypeList.Count == 0) + { + _collectionTypeList = new List(); + _collectionTypeList.Add(typeof(ContainsLinkedList)); + _collectionTypeList.Add(typeof(SimpleCDC)); + _collectionTypeList.Add(typeof(SimpleCDC2)); + _collectionTypeList.Add(typeof(ContainsSimpleCDC)); + _collectionTypeList.Add(typeof(DMInCollection1)); + _collectionTypeList.Add(typeof(DMInCollection2)); + _collectionTypeList.Add(typeof(DMInDict1)); + _collectionTypeList.Add(typeof(DMWithRefInCollection1)); + _collectionTypeList.Add(typeof(DMWithRefInCollection2)); + _collectionTypeList.Add(typeof(DMWithRefInDict1)); + } + return _collectionTypeList; + } + } + + public List SampleTypeList + { + get + { + if (_sampleTypeList.Count == 0) + { + _sampleTypeList = new List(); + _sampleTypeList.Add(typeof(TypeNotFound)); + _sampleTypeList.Add(typeof(EmptyDCType)); + _sampleTypeList.Add(typeof(ObjectContainer)); + _sampleTypeList.Add(typeof(POCOObjectContainer)); + _sampleTypeList.Add(typeof(CircularLink)); + _sampleTypeList.Add(typeof(CircularLinkDerived)); + _sampleTypeList.Add(typeof(KT1Base)); + _sampleTypeList.Add(typeof(KT1Derived)); + _sampleTypeList.Add(typeof(KT2Base)); + _sampleTypeList.Add(typeof(KT3BaseKTMReturnsPrivateType)); + _sampleTypeList.Add(typeof(KT2Derived)); + _sampleTypeList.Add(typeof(CB1)); + _sampleTypeList.Add(typeof(ArrayListWithCDCFilledPublicTypes)); + _sampleTypeList.Add(typeof(ArrayListWithCDCFilledWithMixedTypes)); + _sampleTypeList.Add(typeof(CollectionBaseWithCDCFilledPublicTypes)); + _sampleTypeList.Add(typeof(CollectionBaseWithCDCFilledWithMixedTypes)); + _sampleTypeList.Add(typeof(DCHashtableContainerPublic)); + _sampleTypeList.Add(typeof(DCHashtableContainerMixedTypes)); + _sampleTypeList.Add(typeof(CustomGenericContainerPrivateType1)); + _sampleTypeList.Add(typeof(CustomGenericContainerPrivateType2)); + _sampleTypeList.Add(typeof(CustomGenericContainerPrivateType3)); + _sampleTypeList.Add(typeof(CustomGenericContainerPrivateType4)); + _sampleTypeList.Add(typeof(CustomGenericContainerPublicType1)); + _sampleTypeList.Add(typeof(CustomGenericContainerPublicType2)); + _sampleTypeList.Add(typeof(CustomGenericContainerPublicType3)); + _sampleTypeList.Add(typeof(CustomGenericContainerPublicType4)); + _sampleTypeList.Add(typeof(CustomGeneric1)); + _sampleTypeList.Add(typeof(CustomGeneric2)); + _sampleTypeList.Add(typeof(GenericContainer)); + _sampleTypeList.Add(typeof(GenericBase)); + _sampleTypeList.Add(typeof(GenericBase2)); + _sampleTypeList.Add(typeof(SimpleBase)); + _sampleTypeList.Add(typeof(SimpleBaseDerived)); + _sampleTypeList.Add(typeof(SimpleBaseDerived2)); + _sampleTypeList.Add(typeof(SimpleBaseContainer)); + _sampleTypeList.Add(typeof(DCListPrivateTContainer2)); + _sampleTypeList.Add(typeof(DCListPrivateTContainer)); + _sampleTypeList.Add(typeof(DCListPublicTContainer)); + _sampleTypeList.Add(typeof(DCListMixedTContainer)); + _sampleTypeList.Add(typeof(SampleListImplicitWithDC)); + _sampleTypeList.Add(typeof(SampleListImplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleListImplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleListExplicitWithDC)); + _sampleTypeList.Add(typeof(SampleListExplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleListExplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleListExplicitWithCDCContainsPrivateDC)); + _sampleTypeList.Add(typeof(SampleListTImplicitWithDC)); + _sampleTypeList.Add(typeof(SampleListTImplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleListTImplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleListTExplicitWithDC)); + _sampleTypeList.Add(typeof(SampleListTExplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleListTExplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleListTExplicitWithCDCContainsPublicDCClassPrivateDM)); + _sampleTypeList.Add(typeof(SampleListTExplicitWithCDCContainsPrivateDC)); + _sampleTypeList.Add(typeof(SampleICollectionTImplicitWithDC)); + _sampleTypeList.Add(typeof(SampleICollectionTImplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleICollectionTImplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleICollectionTExplicitWithDC)); + _sampleTypeList.Add(typeof(SampleICollectionTExplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleICollectionTExplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleICollectionTExplicitWithCDCContainsPrivateDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTImplicitWithDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTImplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTImplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTExplicitWithDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTExplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTExplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableTExplicitWithCDCContainsPrivateDC)); + _sampleTypeList.Add(typeof(SampleICollectionImplicitWithDC)); + _sampleTypeList.Add(typeof(SampleICollectionImplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleICollectionImplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleICollectionExplicitWithDC)); + _sampleTypeList.Add(typeof(SampleICollectionExplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleICollectionExplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleICollectionExplicitWithCDCContainsPrivateDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableImplicitWithDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableImplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableImplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableExplicitWithDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableExplicitWithoutDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableExplicitWithCDC)); + _sampleTypeList.Add(typeof(SampleIEnumerableExplicitWithCDCContainsPrivateDC)); + _sampleTypeList.Add(typeof(MyIDictionaryContainsPublicDC)); + _sampleTypeList.Add(typeof(MyIDictionaryContainsPublicDCExplicit)); + _sampleTypeList.Add(typeof(MyIDictionaryContainsPrivateDC)); + _sampleTypeList.Add(typeof(MyGenericIDictionaryKVContainsPublicDC)); + _sampleTypeList.Add(typeof(MyGenericIDictionaryKVContainsPublicDCExplicit)); + _sampleTypeList.Add(typeof(MyGenericIDictionaryKVContainsPrivateDC)); + _sampleTypeList.Add(typeof(DCDictionaryPrivateKTContainer)); + _sampleTypeList.Add(typeof(DCDictionaryPublicKTContainer)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer1)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer2)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer3)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer4)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer5)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer6)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer7)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer8)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer9)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer10)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer11)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer12)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer13)); + _sampleTypeList.Add(typeof(DCDictionaryMixedKTContainer14)); + _sampleTypeList.Add(typeof(PublicDC)); + _sampleTypeList.Add(typeof(PublicDCDerivedPublic)); + _sampleTypeList.Add(typeof(DC)); + _sampleTypeList.Add(typeof(DCWithReadOnlyField)); + _sampleTypeList.Add(typeof(IReadWriteXmlWriteBinHex_EqualityDefined)); + _sampleTypeList.Add(typeof(PrivateDefaultCtorIXmlSerializables)); + _sampleTypeList.Add(typeof(PublicIXmlSerializablesWithPublicSchemaProvider)); + _sampleTypeList.Add(typeof(PublicExplicitIXmlSerializablesWithPublicSchemaProvider)); + _sampleTypeList.Add(typeof(PublicIXmlSerializablesWithPrivateSchemaProvider)); + _sampleTypeList.Add(typeof(PublicDCClassPublicDM)); + _sampleTypeList.Add(typeof(PublicDCClassPrivateDM)); + _sampleTypeList.Add(typeof(PublicDCClassInternalDM)); + _sampleTypeList.Add(typeof(PublicDCClassMixedDM)); + _sampleTypeList.Add(typeof(PublicDCClassPublicDM_DerivedDCClassPublic)); + _sampleTypeList.Add(typeof(PublicDCClassPrivateDM_DerivedDCClassPublic)); + _sampleTypeList.Add(typeof(PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassPublicDM_PublicDCClassPrivateDM)); + _sampleTypeList.Add(typeof(Prop_SetPrivate_PublicDCClassPublicDM_PublicDCClassPrivateDM)); + _sampleTypeList.Add(typeof(Prop_GetPrivate_PublicDCClassPublicDM_PublicDCClassPrivateDM)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassPublicDM)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassPrivateDM)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassInternalDM)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassMixedDM)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassPublicDM_DerivedDCClassPublic)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassPrivateDM_DerivedDCClassPublic)); + _sampleTypeList.Add(typeof(Prop_PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM)); + _sampleTypeList.Add(typeof(Prop_SetPrivate_PublicDCClassPublicDM)); + _sampleTypeList.Add(typeof(Prop_GetPrivate_PublicDCClassPublicDM)); + _sampleTypeList.Add(typeof(Derived_Override_Prop_All_Public)); + _sampleTypeList.Add(typeof(Derived_Override_Prop_Private)); + _sampleTypeList.Add(typeof(Derived_Override_Prop_GetPrivate_All_Public)); + _sampleTypeList.Add(typeof(Derived_Override_Prop_GetPrivate_Private)); + _sampleTypeList.Add(typeof(DC1_Version1)); + _sampleTypeList.Add(typeof(DC2_Version1)); + _sampleTypeList.Add(typeof(DC2_Version4)); + _sampleTypeList.Add(typeof(DC2_Version5)); + _sampleTypeList.Add(typeof(DC3_Version1)); + _sampleTypeList.Add(typeof(DC3_Version2)); + _sampleTypeList.Add(typeof(DC3_Version3)); + _sampleTypeList.Add(typeof(CallBackSample_OnSerializing_Public)); + _sampleTypeList.Add(typeof(CallBackSample_OnSerialized_Public)); + _sampleTypeList.Add(typeof(CallBackSample_OnDeserializing_Public)); + _sampleTypeList.Add(typeof(CallBackSample_OnDeserialized_Public)); + _sampleTypeList.Add(typeof(CallBackSample_OnSerializing)); + _sampleTypeList.Add(typeof(CallBackSample_OnSerialized)); + _sampleTypeList.Add(typeof(CallBackSample_OnDeserializing)); + _sampleTypeList.Add(typeof(CallBackSample_OnDeserialized)); + _sampleTypeList.Add(typeof(CallBackSample_IDeserializationCallback)); + _sampleTypeList.Add(typeof(CallBackSample_IDeserializationCallback_Explicit)); + _sampleTypeList.Add(typeof(CallBackSample_OnDeserialized_Private_Base)); + _sampleTypeList.Add(typeof(CallBackSample_OnDeserialized_Public_Derived)); + _sampleTypeList.Add(typeof(CDC_Possitive)); + _sampleTypeList.Add(typeof(CDC_PrivateAdd)); + _sampleTypeList.Add(typeof(Base_Possitive_VirtualAdd)); + _sampleTypeList.Add(typeof(CDC_NewAddToPrivate)); + _sampleTypeList.Add(typeof(CDC_PrivateDefaultCtor)); + _sampleTypeList.Add(typeof(NonDCPerson)); + _sampleTypeList.Add(typeof(PersonSurrogated)); + _sampleTypeList.Add(typeof(DCSurrogate)); + _sampleTypeList.Add(typeof(SerSurrogate)); + _sampleTypeList.Add(typeof(DCSurrogateExplicit)); + _sampleTypeList.Add(typeof(SerSurrogateExplicit)); + _sampleTypeList.Add(typeof(DCSurrogateReturnPrivate)); + _sampleTypeList.Add(typeof(SerSurrogateReturnPrivate)); + _sampleTypeList.Add(typeof(NullableContainerContainsValue)); + _sampleTypeList.Add(typeof(NullableContainerContainsNull)); + _sampleTypeList.Add(typeof(NullablePrivateContainerContainsValue)); + _sampleTypeList.Add(typeof(NullablePrivateContainerContainsNull)); + _sampleTypeList.Add(typeof(NullablePrivateDataInDMContainerContainsValue)); + _sampleTypeList.Add(typeof(NullablePrivateDataInDMContainerContainsNull)); + _sampleTypeList.Add(typeof(DCPublicDatasetPublic)); + _sampleTypeList.Add(typeof(DCPublicDatasetPrivate)); + _sampleTypeList.Add(typeof(SerPublicDatasetPublic)); + _sampleTypeList.Add(typeof(SerPublicDatasetPrivate)); + _sampleTypeList.Add(typeof(CustomGeneric2)); + _sampleTypeList.Add(typeof(DTOContainer)); + } + return _sampleTypeList; + } + } + } + + public static class DCRUtils + { + public static bool CompareIObjectRefTypes(object serialized, object deSerialized) + { + Dictionary> alreadyRefdValues = ObjectRefUtil.GetReferenceCounts(serialized); + Dictionary> alreadyRefdValues2 = ObjectRefUtil.GetReferenceCounts(deSerialized); + if (!ObjectRefUtil.IsEqual(alreadyRefdValues, alreadyRefdValues2)) + { + return false; + } + return true; + } + } + + public class RefData + { + public object Data; + public int RefCount = 0; + + public RefData(object data) + { + Data = data; + } + + public override bool Equals(object obj) + { + RefData other = obj as RefData; + if (other == null) return false; + return (Object.ReferenceEquals(this.Data, other.Data)); + } + + public override int GetHashCode() + { + if (Data != null) + { + return Data.GetHashCode(); + } + else + { + return base.GetHashCode(); + } + } + } + + public class ObjectRefUtil + { + public static Dictionary> GetReferenceCounts(object data) + { + Dictionary> nonRefdValues = new Dictionary>(); + return GetReferenceCounts(data, ref nonRefdValues); + } + + public static Dictionary> GetReferenceCounts(object data, ref Dictionary> nonRefdValues) + { + Dictionary> alreadyRefdValues = new Dictionary>(); + Type type = data.GetType(); + DataContract dataContract = DataContract.GetDataContract(type, supportCollectionDataContract); + s_refStack.Clear(); + FindAndAddRefd(data, dataContract, ref alreadyRefdValues, ref nonRefdValues); + return alreadyRefdValues; + } + + public static bool IsEqual(Dictionary> alreadyRefdValues1, Dictionary> alreadyRefdValues2) + { + if (alreadyRefdValues1.Count != alreadyRefdValues2.Count) return false; + foreach (KeyValuePair> kp in alreadyRefdValues1) + { + if (alreadyRefdValues2.ContainsKey(kp.Key)) + { + if (alreadyRefdValues2[kp.Key].Count != kp.Value.Count) + { + return false; + } + for (int i = 0; i < kp.Value.Count; i++) + { + if (alreadyRefdValues2[kp.Key][i].RefCount != kp.Value[i].RefCount) + { + return false; + } + } + } + else + { + return false; + } + } + return true; + } + + private static Stack s_refStack = new Stack(); + /// + /// + /// + /// + /// + /// + private static void FindAndAddRefd(object data, DataContract dataContract, ref Dictionary> alreadyRefdValues + , ref Dictionary> nonRefdValues) + { + RefData refData = new RefData(data); + FindRefUpdateRef(refData, dataContract, ref alreadyRefdValues, ref nonRefdValues); + if (s_refStack.Contains(refData)) + { + return; + } + else + { + s_refStack.Push(refData); + } + FindRefHandleMembers(data, dataContract, ref alreadyRefdValues, ref nonRefdValues); + s_refStack.Pop(); + } + + public static bool supportCollectionDataContract = true; + private static void FindRefUpdateRef(RefData refData, DataContract dataContract, ref Dictionary> alreadyRefdValues, ref Dictionary> nonRefdValues) + { + if (dataContract.IsReference) + { + if (alreadyRefdValues.ContainsKey(dataContract)) + { + if (!alreadyRefdValues[dataContract].Contains(refData)) + { + alreadyRefdValues[dataContract].Add(refData); + } + else + { + alreadyRefdValues[dataContract][alreadyRefdValues[dataContract].IndexOf(refData)].RefCount++; + } + } + else + { + List list = new List(); + list.Add(refData); + alreadyRefdValues.Add(dataContract, list); + } + } + else if (!(dataContract is PrimitiveDataContract)) + { + if (nonRefdValues.ContainsKey(dataContract)) + { + if (!nonRefdValues[dataContract].Contains(refData)) + { + nonRefdValues[dataContract].Add(refData); + } + else + { + nonRefdValues[dataContract][nonRefdValues[dataContract].IndexOf(refData)].RefCount++; + } + } + else + { + List list = new List(); + list.Add(refData); + nonRefdValues.Add(dataContract, list); + } + } + } + private static void FindRefHandleMembers(object data, DataContract dataContract, ref Dictionary> alreadyRefdValues, ref Dictionary> nonRefdValues) + { + if (dataContract is ClassDataContract) + { + ClassDataContract classContract = dataContract as ClassDataContract; + foreach (DataMember member in classContract.Members) + { + object memberData = member.GetMemberValue(data); + if (memberData != null) + { + FindAndAddRefd(memberData, DataContract.GetDataContract(memberData.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + } + } + else if (dataContract is ArrayDataContract) + { + ArrayDataContract arrayContract = dataContract as ArrayDataContract; + foreach (object obj in (IEnumerable)data) + { + if (obj != null) + { + FindAndAddRefd(obj, DataContract.GetDataContract(obj.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + } + } + else if (dataContract is CollectionDataContract) + { + FindRefHandleCollectionDataContractMembers(data, dataContract, ref alreadyRefdValues, ref nonRefdValues); + } + else if (dataContract is EnumDataContract || dataContract is PrimitiveDataContract) + { + //Nothing to do + } + else + { + throw new Exception("TestDriver Exception: Type Not Supported"); + } + } + + private static void FindRefHandleCollectionDataContractMembers(object data, DataContract dataContract, ref Dictionary> alreadyRefdValues, ref Dictionary> nonRefdValues) + { + CollectionDataContract collectionContract = dataContract as CollectionDataContract; + if (!collectionContract.IsDictionary) + { + foreach (object obj in (IEnumerable)data) + { + if (obj != null) + { + FindAndAddRefd(obj, DataContract.GetDataContract(obj.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + } + } + else + { + IDictionary dictionary = data as IDictionary; + if (dictionary != null) + { + foreach (object key in dictionary.Keys) + { + if (key != null) + { + FindAndAddRefd(key, DataContract.GetDataContract(key.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + } + foreach (object value in dictionary.Values) + { + if (value != null) + { + FindAndAddRefd(value, DataContract.GetDataContract(value.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + } + } + else + { + if (collectionContract.GetEnumeratorMethod != null) + { + object dictEnumObj = null; + try + { + dictEnumObj = collectionContract.GetEnumeratorMethod.Invoke(data, new object[] { }); + } + catch (Exception) { } + IDictionaryEnumerator dictEnum = dictEnumObj as IDictionaryEnumerator; + if (dictEnum != null) + { + while (dictEnum.MoveNext()) + { + FindAndAddRefd(dictEnum.Key, DataContract.GetDataContract(dictEnum.Key.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + dictEnum.Reset(); + while (dictEnum.MoveNext()) + { + if (dictEnum.Value != null) + { + FindAndAddRefd(dictEnum.Value, DataContract.GetDataContract(dictEnum.Value.GetType(), supportCollectionDataContract), ref alreadyRefdValues, ref nonRefdValues); + } + } + } + } + else + { + throw new Exception("TestDriver Exception: Dictionary CollectionDataCotnract Type Not Supported"); + } + } + } + } + } } diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs new file mode 100644 index 0000000000..3b08048095 --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContract.cs @@ -0,0 +1,2052 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Reflection; +using System.Runtime.Serialization; +using System.Security.Cryptography; +using System.Text; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; + +namespace SerializationTestTypes +{ + interface IGenericNameProvider + { + int GetParameterCount(); + string GetParameterName(int paramIndex); + string GetNamespaces(); + string GetGenericTypeName(); + bool ParametersFromBuiltInNamespaces { get; } + } + + class GenericNameProvider : IGenericNameProvider + { + string genericTypeName; + object[] genericParams; + internal GenericNameProvider(Type type) + : this(type.GetGenericTypeDefinition().FullName, type.GetGenericArguments()) + { + } + + internal GenericNameProvider(string genericTypeName, object[] genericParams) + { + this.genericTypeName = genericTypeName; + this.genericParams = new object[genericParams.Length]; + genericParams.CopyTo(this.genericParams, 0); + } + + public int GetParameterCount() + { + return genericParams.Length; + } + + public string GetParameterName(int paramIndex) + { + return GetStableName(paramIndex).Name; + } + + public string GetNamespaces() + { + StringBuilder namespaces = new StringBuilder(); + for (int j = 0; j < GetParameterCount(); j++) + namespaces.Append(" ").Append(GetStableName(j).Namespace); + return namespaces.ToString(); + } + + public string GetGenericTypeName() + { + return genericTypeName; + } + + public bool ParametersFromBuiltInNamespaces + { + get + { + bool parametersFromBuiltInNamespaces = true; + for (int j = 0; j < GetParameterCount(); j++) + { + if (parametersFromBuiltInNamespaces) + parametersFromBuiltInNamespaces = DataContract.IsBuiltInNamespace(GetStableName(j).Namespace); + else + break; + } + return parametersFromBuiltInNamespaces; + } + } + + XmlQualifiedName GetStableName(int i) + { + object o = genericParams[i]; + XmlQualifiedName qname = o as XmlQualifiedName; + if (qname == null) + { + Type paramType = o as Type; + if (paramType != null) + genericParams[i] = qname = DataContract.GetStableName(paramType); + else + genericParams[i] = qname = ((DataContract)o).StableName; + } + return qname; + } + } + + class GenericInfo : IGenericNameProvider + { + string genericTypeName; + XmlQualifiedName stableName; + List paramGenericInfos; + + internal GenericInfo(XmlQualifiedName stableName, string genericTypeName) + { + this.stableName = stableName; + this.genericTypeName = genericTypeName; + } + + internal void Add(GenericInfo actualParamInfo) + { + if (paramGenericInfos == null) + paramGenericInfos = new List(); + paramGenericInfos.Add(actualParamInfo); + } + + internal XmlQualifiedName GetExpandedStableName() + { + if (paramGenericInfos == null) + return stableName; + return new XmlQualifiedName(DataContract.ExpandGenericParameters(XmlConvert.DecodeName(stableName.Name), this), stableName.Namespace); + } + + internal string GetStableNamespace() + { + return stableName.Namespace; + } + + internal XmlQualifiedName StableName + { + get { return stableName; } + } + + internal IList Parameters + { + get { return paramGenericInfos; } + } + + public int GetParameterCount() + { + return paramGenericInfos.Count; + } + + public string GetParameterName(int paramIndex) + { + return paramGenericInfos[paramIndex].GetExpandedStableName().Name; + } + + public string GetNamespaces() + { + StringBuilder namespaces = new StringBuilder(); + for (int j = 0; j < paramGenericInfos.Count; j++) + namespaces.Append(" ").Append(paramGenericInfos[j].GetStableNamespace()); + return namespaces.ToString(); + } + + public string GetGenericTypeName() + { + return genericTypeName; + } + + public bool ParametersFromBuiltInNamespaces + { + get + { + bool parametersFromBuiltInNamespaces = true; + for (int j = 0; j < paramGenericInfos.Count; j++) + { + if (parametersFromBuiltInNamespaces) + parametersFromBuiltInNamespaces = DataContract.IsBuiltInNamespace(paramGenericInfos[j].GetStableNamespace()); + else + break; + } + return parametersFromBuiltInNamespaces; + } + } + + } + + class RuntimeTypeHandleEqualityComparer : IEqualityComparer + { + static RuntimeTypeHandleEqualityComparer comparer; + + static public RuntimeTypeHandleEqualityComparer Comparer + { + get + { + if (comparer == null) + { + comparer = new RuntimeTypeHandleEqualityComparer(); + } + + return comparer; + } + } + + public bool Equals(RuntimeTypeHandle x, RuntimeTypeHandle y) + { + return x.Equals(y); + } + + public int GetHashCode(RuntimeTypeHandle obj) + { + return obj.GetHashCode(); + } + } + + public class DataContract + { + static Dictionary cache = new Dictionary(RuntimeTypeHandleEqualityComparer.Comparer); + static MD5CryptoServiceProvider md5 = null; + + Type underlyingType; + bool isValueType; + XmlQualifiedName stableName; + protected internal bool supportCollectionDataContract; + + public static DataContract GetDataContract(Type type, bool supportCollectionDataContract) + { + return GetDataContract(type.TypeHandle, type, supportCollectionDataContract); + } + + internal static bool IsBuiltInNamespace(string ns) + { + return (ns == Globals.SchemaNamespace || ns == Globals.SerializationNamespace); + } + + internal static string ExpandGenericParameters(string format, IGenericNameProvider genericNameProvider) + { + string digest = null; + StringBuilder typeName = new StringBuilder(); + for (int i = 0; i < format.Length; i++) + { + char ch = format[i]; + if (ch == '{') + { + i++; + int start = i; + for (; i < format.Length; i++) + if (format[i] == '}') + break; + if (i == format.Length) + throw new ArgumentException("GenericNameBraceMismatch"); + if (format[start] == '#' && i == (start + 1)) + { + if (!genericNameProvider.ParametersFromBuiltInNamespaces) + { + if (digest == null) + digest = GetNamespacesDigest(String.Format(CultureInfo.InvariantCulture, " {0}{1}", genericNameProvider.GetParameterCount(), genericNameProvider.GetNamespaces())); + typeName.Append(digest); + } + } + else + { + int paramIndex; + if (!Int32.TryParse(format.Substring(start, i - start), out paramIndex) || paramIndex < 0 || paramIndex >= genericNameProvider.GetParameterCount()) + throw new ArgumentException("GenericParameterNotValid"); + typeName.Append(genericNameProvider.GetParameterName(paramIndex)); + } + } + else + typeName.Append(ch); + } + return typeName.ToString(); + } + + private static string GetNamespacesDigest(string namespaces) + { + if (md5 == null) + md5 = new MD5CryptoServiceProvider(); + byte[] namespaceBytes = Encoding.UTF8.GetBytes(namespaces); + byte[] digestBytes = md5.ComputeHash(namespaceBytes); + char[] digestChars = new char[24]; + const int digestLen = 6; + int digestCharsLen = Convert.ToBase64CharArray(digestBytes, 0, digestLen, digestChars, 0); + StringBuilder digest = new StringBuilder(); + for (int i = 0; i < digestCharsLen; i++) + { + char ch = digestChars[i]; + switch (ch) + { + case '=': + break; + case '/': + digest.Append("_S"); + break; + case '+': + digest.Append("_P"); + break; + default: + digest.Append(ch); + break; + } + } + return digest.ToString(); + } + + internal virtual DataContract BindGenericParameters(DataContract[] paramContracts, Dictionary boundContracts) + { + return this; + } + + public static DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type type) + { + return GetDataContract(typeHandle, type, false); + } + + public static DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type type, bool supportCollectionDataContract) + { + DataContract dataContract = null; + if (!cache.TryGetValue(typeHandle, out dataContract)) + { + lock (cache) + { + if (!cache.TryGetValue(typeHandle, out dataContract)) + { + if (type == null) + type = Type.GetTypeFromHandle(typeHandle); + type = UnwrapNullableType(type); + dataContract = CreateDataContract(type, supportCollectionDataContract); + cache.Add(typeHandle, dataContract); + } + } + } + return dataContract; + } + + internal static Type UnwrapNullableType(Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == Globals.TypeOfNullable) + type = type.GetGenericArguments()[0]; + return type; + } + + public static DataContract CreateDataContract(Type type, bool supportCollectionDataContract) + { + DataContract primitiveContract = PrimitiveDataContract.GetPrimitiveDataContract(type); + + if (primitiveContract != null) + return primitiveContract; + + if (type.IsArray) + return new ArrayDataContract(type); + + if (type.IsEnum) + return new EnumDataContract(type); + if (supportCollectionDataContract) + { + DataContract collectionDataContract; + Type itemType; + if (CollectionDataContract.IsCollectionOrTryCreate(type, true, out collectionDataContract, out itemType, true)) + { + return collectionDataContract; + } + } + return new ClassDataContract(type); + } + + public static XmlQualifiedName GetStableName(Type type) + { + bool hasDataContract; + return GetStableName(type, out hasDataContract); + } + + public static XmlQualifiedName GetStableName(Type type, bool supportCollectionDataContract) + { + bool hasDataContract; + return GetStableName(type, out hasDataContract, supportCollectionDataContract); + } + + public static XmlQualifiedName GetStableName(Type type, out bool hasDataContract) + { + return GetStableName(type, out hasDataContract, false); + } + + public static XmlQualifiedName GetStableName(Type type, out bool hasDataContract, bool supportCollectionDataContract) + { + DataContract primitiveContract = PrimitiveDataContract.GetPrimitiveDataContract(type); + if (primitiveContract != null) + { + hasDataContract = false; + return primitiveContract.StableName; + } + + string name = null, ns = null; + if (type.IsArray) + { + hasDataContract = false; + Type elementType = type; + string arrayOfPrefix = ""; + while (elementType.IsArray) + { + arrayOfPrefix += "ArrayOf"; + elementType = elementType.GetElementType(); + if (elementType == Globals.TypeOfByteArray) + break; + } + XmlQualifiedName elementStableName = GetStableName(elementType, supportCollectionDataContract); + name = arrayOfPrefix + elementStableName.Name; + ns = (elementStableName.Namespace == Globals.SchemaNamespace) ? Globals.SerializationNamespace : elementStableName.Namespace; + } + else if (type.IsSerializable && !type.IsEnum) + { + if (type.IsDefined(Globals.TypeOfDataContractAttribute, false)) + throw new Exception("TypeTwoWaySerializable" + type.FullName); + hasDataContract = false; + name = GetDefaultStableLocalName(type); + ns = GetDefaultStableNamespace(type); + } + else + { + object[] dataContractAttributes = type.GetCustomAttributes(Globals.TypeOfDataContractAttribute, false); + if (dataContractAttributes != null && dataContractAttributes.Length > 0) + { + DataContractAttribute dataContractAttribute = (DataContractAttribute)dataContractAttributes[0]; + hasDataContract = true; + if (dataContractAttribute.Name != null) + { + name = dataContractAttribute.Name; + if (name.Length == 0) + throw new Exception("InvalidDataContractName" + type.FullName); + } + else + name = GetDefaultStableLocalName(type); + + if (dataContractAttribute.Namespace != null) + { + ns = dataContractAttribute.Namespace; + } + else + { + string clrNs = type.Namespace; + if (clrNs == null) + clrNs = String.Empty; + ns = GetGlobalContractNamespace(clrNs, type.Module); + if (ns == null) + ns = GetGlobalContractNamespace(clrNs, type.Assembly); + + if (ns == null) + ns = GetDefaultStableNamespace(type); + } + Uri uri; + if (Uri.TryCreate(ns, UriKind.RelativeOrAbsolute, out uri)) + { + string normalizedNs = uri.ToString(); + + if (normalizedNs == Globals.SerializationNamespace || normalizedNs == Globals.SchemaNamespace || normalizedNs == Globals.SchemaInstanceNamespace) + throw new Exception("InvalidNamespace" + type.FullName + " :" + Globals.SerializationNamespace + " :" + Globals.SchemaNamespace + " :" + Globals.SchemaInstanceNamespace); + } + } + else if (type.IsEnum) + { + hasDataContract = false; + name = GetDefaultStableLocalName(type); + ns = GetDefaultStableNamespace(type); + } + else if (type.GetInterface("System.Xml.Serialization.IXmlSerializable") != null) + { + hasDataContract = false; + name = GetDefaultStableLocalName(type); + ns = GetDefaultStableNamespace(type); + } + else + { + object[] collectionDataContractAttributes = type.GetCustomAttributes(Globals.TypeOfCollectionDataContractAttribute, false); + if (supportCollectionDataContract && collectionDataContractAttributes != null && collectionDataContractAttributes.Length > 0) + { + CollectionDataContractAttribute collectionDataContractAttribute = (CollectionDataContractAttribute)collectionDataContractAttributes[0]; + hasDataContract = true; + if (collectionDataContractAttribute.Name != null) + { + name = collectionDataContractAttribute.Name; + if (name.Length == 0) + throw new Exception("InvalidDataContractName" + type.FullName); + } + else + name = GetDefaultStableLocalName(type); + + if (collectionDataContractAttribute.Namespace != null) + { + ns = collectionDataContractAttribute.Namespace; + } + else + { + string clrNs = type.Namespace; + if (clrNs == null) + clrNs = String.Empty; + ns = GetGlobalContractNamespace(clrNs, type.Module); + if (ns == null) + ns = GetGlobalContractNamespace(clrNs, type.Assembly); + + if (ns == null) + ns = GetDefaultStableNamespace(type); + } + Uri uri; + if (Uri.TryCreate(ns, UriKind.RelativeOrAbsolute, out uri)) + { + string normalizedNs = uri.ToString(); + + if (normalizedNs == Globals.SerializationNamespace || normalizedNs == Globals.SchemaNamespace || normalizedNs == Globals.SchemaInstanceNamespace) + throw new Exception("InvalidNamespace" + type.FullName + " :" + Globals.SerializationNamespace + " :" + Globals.SchemaNamespace + " :" + Globals.SchemaInstanceNamespace); + } + } + else + { + hasDataContract = false; + name = GetDefaultStableLocalName(type); + ns = GetDefaultStableNamespace(type); + } + } + } + return new XmlQualifiedName(name, ns); + } + + static string GetDefaultStableLocalName(Type type) + { + if (type.DeclaringType == null) + return type.Name; + int nsLen = (type.Namespace == null) ? 0 : type.Namespace.Length; + if (nsLen > 0) + nsLen++; + return type.FullName.Substring(nsLen).Replace('+', '.'); + } + + static string GetDefaultStableNamespace(Type type) + { + return GetDefaultStableNamespace(type.Namespace); + } + + public static string GetDefaultStableNamespace(string clrNs) + { + if (clrNs == null) clrNs = String.Empty; + return Globals.DefaultNamespace + clrNs.Replace('.', '/'); + } + + static string GetGlobalContractNamespace(string clrNs, ICustomAttributeProvider customAttribuetProvider) + { + object[] nsAttributes = customAttribuetProvider.GetCustomAttributes(typeof(ContractNamespaceAttribute), false); + string dataContractNs = null; + for (int i = 0; i < nsAttributes.Length; i++) + { + ContractNamespaceAttribute nsAttribute = (ContractNamespaceAttribute)nsAttributes[i]; + string clrNsInAttribute = nsAttribute.ClrNamespace; + if (clrNsInAttribute == null) + clrNsInAttribute = String.Empty; + if (clrNsInAttribute == clrNs) + { + if (nsAttribute.ContractNamespace == null) + throw new Exception("InvalidGlobalContractNamespace:" + clrNs); + if (dataContractNs != null) + throw new Exception("ContractNamespaceAlreadySet:" + dataContractNs + " :: " + nsAttribute.ContractNamespace + " :: " + clrNs); + dataContractNs = nsAttribute.ContractNamespace; + } + } + return dataContractNs; + } + + bool GetIsReferenceValue() + { + Type type = this.UnderlyingType; + { + object[] dataContractAttributes = type.GetCustomAttributes(Globals.TypeOfDataContractAttribute, false); + object[] serAttributes = type.GetCustomAttributes(Globals.TypeOfSerializableAttribute, false); + + if (dataContractAttributes != null && dataContractAttributes.Length > 0) + { + DataContractAttribute dataContractAttribute = (DataContractAttribute)dataContractAttributes[0]; + if (!dataContractAttribute.IsReference && this is ClassDataContract && ((ClassDataContract)this).BaseContract != null) + { + return ((ClassDataContract)this).BaseContract.IsReference; + } + else + { + return dataContractAttribute.IsReference; + } + } + else if (serAttributes != null && serAttributes.Length > 0) + { + if (this is ClassDataContract && ((ClassDataContract)this).BaseContract != null) + { + return ((ClassDataContract)this).BaseContract.IsReference; + } + else + { + return false; + } + } + } + { + object[] collectionDataContractAttributes = type.GetCustomAttributes(Globals.TypeOfCollectionDataContractAttribute, false); + if (collectionDataContractAttributes != null && collectionDataContractAttributes.Length > 0) + { + CollectionDataContractAttribute collectionDataContractAttribute = (CollectionDataContractAttribute)collectionDataContractAttributes[0]; + return collectionDataContractAttribute.IsReference; + } + } + return false; + } + + public DataContract() + { + } + + public DataContract(bool supportCollectionDataContract) + { + this.supportCollectionDataContract = supportCollectionDataContract; + } + + public DataContract(Type type) + { + underlyingType = type; + isValueType = type.IsValueType; + } + + public DataContract(Type type, bool supportCollectionDataContract) + : this(type) + { + this.supportCollectionDataContract = supportCollectionDataContract; + } + + public Type UnderlyingType + { + get { return underlyingType; } + } + + public virtual string TopLevelElementName + { + get { return StableName.Name; } + } + + public virtual string TopLevelElementNamespace + { + get { return StableName.Namespace; } + } + + public bool IsValueType + { + get { return isValueType; } + set { isValueType = value; } + } + + public XmlQualifiedName StableName + { + get { return stableName; } + set { stableName = value; } + } + + public virtual bool IsISerializable + { + get { return false; } + set { throw new InvalidOperationException("RequiresClassDataContractToSetIsISerializable"); } + } + + public bool IsReference + { + get { return GetIsReferenceValue(); } + } + + static bool IsAlpha(char ch) + { + return (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z'); + } + + static bool IsDigit(char ch) + { + return (ch >= '0' && ch <= '9'); + } + + static bool IsAsciiLocalName(string localName) + { + if (String.IsNullOrEmpty(localName) || localName.Length == 0) + return false; + if (!IsAlpha(localName[0])) + return false; + for (int i = 1; i < localName.Length; i++) + { + char ch = localName[i]; + if (!IsAlpha(ch) && !IsDigit(ch)) + return false; + } + return true; + } + + static internal string EncodeLocalName(string localName) + { + if (IsAsciiLocalName(localName)) + return localName; + + if (IsValidNCName(localName)) + return localName; + + return XmlConvert.EncodeLocalName(localName); + } + + internal static bool IsValidNCName(string name) + { + try + { + XmlConvert.VerifyNCName(name); + return true; + } + catch (XmlException) + { + return false; + } + } + + public override bool Equals(object other) + { + if ((object)this == other) + return true; + DataContract dataContract = other as DataContract; + if (dataContract != null) + { + return (StableName.Name == dataContract.StableName.Name && StableName.Namespace == dataContract.StableName.Namespace && IsValueType == dataContract.IsValueType && IsReference == dataContract.IsReference); + } + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + public class ClassDataContract : DataContract + { + ClassDataContract baseContract; + List members; + string[][] memberNames; + bool isISerializable; + bool hasDataContract; + + public ClassDataContract(Type type) + : this(type, false) + { + } + + public ClassDataContract(Type type, bool supportCollectionDataContract) + : base(type, supportCollectionDataContract) + { + Init(type); + } + + + void Init(Type type) + { + this.StableName = DataContract.GetStableName(type, out hasDataContract, supportCollectionDataContract); + Type baseType = type.BaseType; + isISerializable = (Globals.TypeOfISerializable.IsAssignableFrom(type)); + if (isISerializable) + { + if (hasDataContract) + throw new Exception("DataContractTypeCannotBeISerializable: " + type.FullName); + if (!Globals.TypeOfISerializable.IsAssignableFrom(baseType)) + { + while (baseType != null) + { + if (baseType.IsDefined(Globals.TypeOfDataContractAttribute, false)) + throw new Exception("ISerializableCannotInheritFromDataContract:" + type.FullName + "::" + baseType.FullName); + baseType = baseType.BaseType; + } + } + } + if (baseType != null && baseType != Globals.TypeOfObject && baseType != Globals.TypeOfValueType) + this.BaseContract = (ClassDataContract)DataContract.GetDataContract(baseType, supportCollectionDataContract); + else + this.BaseContract = null; + } + + void ImportDataMembers() + { + Type type = this.UnderlyingType; + members = new List(); + Dictionary memberNamesTable = new Dictionary(); + MemberInfo[] memberInfos = type.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + + for (int i = 0; i < memberInfos.Length; i++) + { + MemberInfo member = memberInfos[i]; + if (hasDataContract) + { + object[] memberAttributes = member.GetCustomAttributes(typeof(System.Runtime.Serialization.DataMemberAttribute), false); + if (memberAttributes != null && memberAttributes.Length > 0) + { + if (memberAttributes.Length > 1) + throw new Exception("TooManyDataMembers:" + member.DeclaringType.FullName + "::" + member.Name); + if (member.MemberType == MemberTypes.Property) + { + PropertyInfo property = (PropertyInfo)member; + MethodInfo getMethod = property.GetGetMethod(true); + if (getMethod != null && IsMethodOverriding(getMethod)) + continue; + MethodInfo setMethod = property.GetSetMethod(true); + if (setMethod != null && IsMethodOverriding(setMethod)) + continue; + if (getMethod == null) + throw new Exception(" NoGetMethodForProperty : " + property.DeclaringType + " ::" + property.Name); + if (setMethod == null) + throw new Exception("NoSetMethodForProperty : " + property.DeclaringType + " :: " + property.Name); + if (getMethod.GetParameters().Length > 0) + throw new Exception("IndexedPropertyCannotBeSerialized :" + property.DeclaringType + " :: " + property.Name); + } + else if (member.MemberType != MemberTypes.Field) + throw new Exception("InvalidMember : " + type.FullName + " :: " + member.Name + " :: " + typeof(System.Runtime.Serialization.DataMemberAttribute).FullName); + + DataMember memberContract = new DataMember(member); + System.Runtime.Serialization.DataMemberAttribute memberAttribute = (System.Runtime.Serialization.DataMemberAttribute)memberAttributes[0]; + if (memberAttribute.Name == null) + memberContract.Name = member.Name; + else + memberContract.Name = memberAttribute.Name; + memberContract.Order = memberAttribute.Order; + memberContract.IsRequired = memberAttribute.IsRequired; + CheckAndAddMember(members, memberContract, memberNamesTable); + } + } + else + { + FieldInfo field = member as FieldInfo; + if (field != null && !field.IsNotSerialized) + { + DataMember memberContract = new DataMember(member); + memberContract.Name = member.Name; + object[] optionalFields = field.GetCustomAttributes(Globals.TypeOfOptionalFieldAttribute, false); + if (optionalFields == null || optionalFields.Length == 0) + memberContract.Order = Globals.DefaultVersion; + else + { + memberContract.IsRequired = Globals.DefaultIsRequired; + } + CheckAndAddMember(members, memberContract, memberNamesTable); + } + } + } + if (members.Count > 1) + members.Sort(DataMemberComparer.Singleton); + } + + public static void CheckAndAddMember(List members, DataMember memberContract, Dictionary memberNamesTable) + { + DataMember existingMemberContract; + if (memberNamesTable.TryGetValue(memberContract.Name, out existingMemberContract)) + throw new Exception("DupMemberName :" + existingMemberContract.MemberInfo.Name + " :: " + memberContract.MemberInfo.Name + " :: " + memberContract.MemberInfo.DeclaringType.FullName + " :: " + memberContract.Name); + memberNamesTable.Add(memberContract.Name, memberContract); + members.Add(memberContract); + } + + static bool IsMethodOverriding(MethodInfo method) + { + return method.IsVirtual && ((method.Attributes & MethodAttributes.NewSlot) == 0); + } + + public ClassDataContract BaseContract + { + get { return baseContract; } + set { baseContract = value; } + } + + public string[][] MemberNames + { + get + { + if (memberNames == null) + { + lock (this) + { + if (memberNames == null && Members != null) + { + if (baseContract == null) + memberNames = new string[1][]; + else + { + int baseTypesCount = baseContract.MemberNames.Length; + memberNames = new string[baseTypesCount + 1][]; + Array.Copy(baseContract.MemberNames, 0, memberNames, 0, baseTypesCount); + } + string[] declaredMemberNames = new string[Members.Count]; + for (int i = 0; i < Members.Count; i++) + declaredMemberNames[i] = Members[i].Name; + memberNames[memberNames.Length - 1] = declaredMemberNames; + } + } + } + return memberNames; + } + } + + public List Members + { + get + { + if (members == null && UnderlyingType != null && !IsISerializable) + { + lock (this) + { + if (members == null) + { + ImportDataMembers(); + } + } + } + return members; + } + set { members = value; } + } + + public override bool Equals(object other) + { + if ((object)this == other) + return true; + + if (base.Equals(other)) + { + ClassDataContract dataContract = other as ClassDataContract; + if (dataContract != null) + { + if (IsISerializable) + { + if (!dataContract.IsISerializable) + return false; + } + else + { + if (dataContract.IsISerializable) + return false; + + if (Members == null) + { + if (dataContract.Members != null) + return false; + } + else if (dataContract.Members == null) + return false; + else + { + if (Members.Count != dataContract.Members.Count) + return false; + + for (int i = 0; i < Members.Count; i++) + { + if (!Members[i].Equals(dataContract.Members[i])) + return false; + } + } + } + + if (BaseContract == null) + return (dataContract.BaseContract == null); + else if (dataContract.BaseContract == null) + return false; + else + return BaseContract.StableName.Equals(dataContract.BaseContract.StableName); + } + } + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + public class DataMemberComparer : IComparer + { + public int Compare(DataMember x, DataMember y) + { + if (x.Order < y.Order) + return -1; + if (x.Order > y.Order) + return 1; + return String.Compare(x.Name, y.Name, StringComparison.InvariantCulture); + } + + public bool Equals(DataMember x, DataMember y) + { + return x == y; + } + + public int GetHashCode(DataMember x) + { + return ((object)x).GetHashCode(); + } + public static DataMemberComparer Singleton = new DataMemberComparer(); + } + + public class DataMemberOrderComparer : IComparer + { + public int Compare(DataMember x, DataMember y) + { + return x.Order - y.Order; + } + + public bool Equals(DataMember x, DataMember y) + { + return x.Order == y.Order; + } + + public int GetHashCode(DataMember x) + { + return ((object)x).GetHashCode(); + } + public static DataMemberOrderComparer Singleton = new DataMemberOrderComparer(); + } + + } + + public class DataMember + { + DataContract memberTypeContract; + string name; + int order; + bool isRequired; + bool isNullable; + MemberInfo memberInfo; + protected internal bool supportCollectionDataContract; + + public DataMember() + { + } + + public DataMember(MemberInfo memberInfo) + { + this.memberInfo = memberInfo; + } + + public MemberInfo MemberInfo + { + get { return memberInfo; } + } + + public string Name + { + get { return name; } + set { name = value; } + } + + public int Order + { + get { return order; } + set { order = value; } + } + + internal bool IsNullable + { + get { return isNullable; } + set { isNullable = value; } + } + + public bool IsRequired + { + get { return isRequired; } + set { isRequired = value; } + } + + public object GetMemberValue(object obj) + { + FieldInfo field = MemberInfo as FieldInfo; + + if (field != null) + return ((FieldInfo)MemberInfo).GetValue(obj); + + return ((PropertyInfo)MemberInfo).GetValue(obj, null); + } + + public Type MemberType + { + get + { + FieldInfo field = MemberInfo as FieldInfo; + if (field != null) + return field.FieldType; + return ((PropertyInfo)MemberInfo).PropertyType; + } + } + + public DataContract MemberTypeContract + { + get + { + if (memberTypeContract == null) + { + if (MemberInfo != null) + { + lock (this) + { + if (memberTypeContract == null) + { + memberTypeContract = DataContract.GetDataContract(MemberType, supportCollectionDataContract); + } + } + } + } + return memberTypeContract; + } + set + { + memberTypeContract = value; + } + } + + public override bool Equals(object other) + { + if ((object)this == other) + return true; + + DataMember dataMember = other as DataMember; + if (dataMember != null) + { + return (Name == dataMember.Name + && IsNullable == dataMember.IsNullable + && IsRequired == dataMember.IsRequired + && MemberTypeContract.StableName.Equals(dataMember.MemberTypeContract.StableName)); + } + return false; + } + + public static bool operator <(DataMember dm1, DataMember dm2) + { + if (dm1.Order != dm2.Order) + return dm1.Order < dm2.Order; + else + return ((string.Compare(dm1.Name, dm2.Name) < 0) ? true : false); + } + + public static bool operator >(DataMember dm1, DataMember dm2) + { + if (dm1.Order != dm2.Order) + return dm1.Order > dm2.Order; + else + return ((string.Compare(dm1.Name, dm2.Name) > 0) ? true : false); + } + + public bool NameOrderEquals(object other) + { + if ((object)this == other) + return true; + DataMember dataMember = other as DataMember; + if (dataMember != null) + { + return (Name == dataMember.Name + && Order == dataMember.Order + && MemberTypeContract.StableName.Equals(dataMember.MemberTypeContract.StableName)); + } + return false; + + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + public class PrimitiveDataContract : DataContract + { + static Dictionary typeToContract = new Dictionary(); + static Dictionary nameToContract = new Dictionary(); + static PrimitiveDataContract objectContract = new PrimitiveDataContract(typeof(object)); + + static PrimitiveDataContract() + { + Add(new PrimitiveDataContract(typeof(char))); + Add(new PrimitiveDataContract(typeof(bool))); + Add(new PrimitiveDataContract(typeof(sbyte))); + Add(new PrimitiveDataContract(typeof(byte))); + Add(new PrimitiveDataContract(typeof(short))); + Add(new PrimitiveDataContract(typeof(ushort))); + Add(new PrimitiveDataContract(typeof(int))); + Add(new PrimitiveDataContract(typeof(uint))); + Add(new PrimitiveDataContract(typeof(long))); + Add(new PrimitiveDataContract(typeof(ulong))); + Add(new PrimitiveDataContract(typeof(float))); + Add(new PrimitiveDataContract(typeof(double))); + Add(new PrimitiveDataContract(typeof(decimal))); + Add(new PrimitiveDataContract(typeof(DateTime))); + Add(new PrimitiveDataContract(typeof(string))); + Add(new PrimitiveDataContract(typeof(byte[]))); + Add(new PrimitiveDataContract(typeof(TimeSpan))); + Add(new PrimitiveDataContract(typeof(Guid))); + Add(new PrimitiveDataContract(typeof(Uri))); + Add(objectContract); + } + static public void Add(PrimitiveDataContract primitiveContract) + { + typeToContract.Add(primitiveContract.UnderlyingType, primitiveContract); + nameToContract.Add(primitiveContract.StableName, primitiveContract); + } + + static public PrimitiveDataContract GetPrimitiveDataContract(Type type) + { + PrimitiveDataContract retVal = null; + if (type.IsInterface) + retVal = objectContract; + else + typeToContract.TryGetValue(type, out retVal); + return retVal; + } + + static public PrimitiveDataContract GetPrimitiveDataContract(string name, string ns) + { + PrimitiveDataContract retVal = null; + nameToContract.TryGetValue(new XmlQualifiedName(name, ns), out retVal); + return retVal; + } + + PrimitiveDataContract(Type type) : base(type) + { + string name = null; + string ns = Globals.SchemaNamespace; + switch (Type.GetTypeCode(type)) + { + case TypeCode.Char: + name = "char"; + ns = Globals.SerializationNamespace; + break; + case TypeCode.Boolean: + name = "boolean"; + break; + case TypeCode.SByte: + name = "byte"; + break; + case TypeCode.Byte: + name = "unsignedByte"; + break; + case TypeCode.Int16: + name = "short"; + break; + case TypeCode.UInt16: + name = "unsignedShort"; + break; + case TypeCode.Int32: + name = "int"; + break; + case TypeCode.UInt32: + name = "unsignedInt"; + break; + case TypeCode.Int64: + name = "long"; + break; + case TypeCode.UInt64: + name = "unsignedLong"; + break; + case TypeCode.Single: + name = "float"; + break; + case TypeCode.Double: + name = "double"; + break; + case TypeCode.Decimal: + name = "decimal"; + break; + case TypeCode.DateTime: + name = "dateTime"; + break; + case TypeCode.String: + name = "string"; + break; + default: + if (type == Globals.TypeOfByteArray) + { + name = "base64Binary"; + ns = Globals.SerializationNamespace; + } + else if (type == Globals.TypeOfObject) + { + name = "anyType"; + } + else if (type == Globals.TypeOfTimeSpan) + { + name = "duration"; + } + else if (type == Globals.TypeOfGuid) + { + name = "guid"; + } + else if (type == Globals.TypeOfUri) + { + name = "anyURI"; + } + else + throw new Exception(string.Format("{0} is an invalidPrimitiveType", type.FullName)); + break; + } + StableName = new XmlQualifiedName(name, ns); + } + + public override string TopLevelElementNamespace + { + get { return Globals.SerializationNamespace; } + } + } + + public class ArrayDataContract : DataContract + { + DataContract itemContract; + int rank; + + public ArrayDataContract(Type type, bool supportCollectionDataContract) + : base(type, supportCollectionDataContract) + { + rank = type.GetArrayRank(); + StableName = DataContract.GetStableName(type, supportCollectionDataContract); + } + + public ArrayDataContract(Type type) + : this(type, false) + { + } + + public DataContract ItemContract + { + get + { + if (itemContract == null && UnderlyingType != null) + { + itemContract = DataContract.GetDataContract(UnderlyingType.GetElementType(), supportCollectionDataContract); + } + return itemContract; + } + set + { + itemContract = value; + } + } + + public override bool Equals(object other) + { + if ((object)this == other) + return true; + + if (base.Equals(other)) + { + ArrayDataContract dataContract = other as ArrayDataContract; + if (dataContract != null) + { + return ItemContract.Equals(dataContract.itemContract); + } + } + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + public class EnumDataContract : DataContract + { + PrimitiveDataContract baseContract; + List members; + List values; + bool isULong; + bool isFlags; + bool hasDataContract; + + public EnumDataContract() + { + IsValueType = true; + } + + public EnumDataContract(Type type) : base(type) + { + StableName = DataContract.GetStableName(type, out hasDataContract); + Type baseType = Enum.GetUnderlyingType(type); + baseContract = PrimitiveDataContract.GetPrimitiveDataContract(baseType); + isULong = (baseType == Globals.TypeOfULong); + IsFlags = type.IsDefined(Globals.TypeOfFlagsAttribute, false); + } + + public PrimitiveDataContract BaseContract + { + get + { + return baseContract; + } + set + { + baseContract = value; + isULong = (baseContract.UnderlyingType == Globals.TypeOfULong); + } + } + + void ImportDataMembers() + { + Type type = this.UnderlyingType; + FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public); + members = new List(fields.Length); + Dictionary memberNamesTable = new Dictionary(); + values = new List(fields.Length); + + for (int i = 0; i < fields.Length; i++) + { + FieldInfo field = fields[i]; + bool dataMemberValid = false; + object[] memberAttributes = field.GetCustomAttributes(Globals.TypeOfDataMemberAttribute, false); + if (hasDataContract) + { + if (memberAttributes != null && memberAttributes.Length > 0) + { + if (memberAttributes.Length > 1) + throw new Exception("TooManyDataMembers :" + field.DeclaringType.FullName + " :: " + field.Name); + DataMemberAttribute memberAttribute = (DataMemberAttribute)memberAttributes[0]; + DataMember memberContract = new DataMember(field); + if (memberAttribute.Name == null || memberAttribute.Name.Length == 0) + memberContract.Name = field.Name; + else + memberContract.Name = memberAttribute.Name; + ClassDataContract.CheckAndAddMember(members, memberContract, memberNamesTable); + dataMemberValid = true; + } + } + else + { + if (!field.IsNotSerialized) + { + DataMember memberContract = new DataMember(field); + memberContract.Name = field.Name; + ClassDataContract.CheckAndAddMember(members, memberContract, memberNamesTable); + dataMemberValid = true; + } + } + + if (dataMemberValid) + { + object enumValue = field.GetValue(null); + if (isULong) + values.Add((long)((IConvertible)enumValue).ToUInt64(null)); + else + values.Add(((IConvertible)enumValue).ToInt64(null)); + } + } + } + + public List Members + { + get + { + if (members == null && UnderlyingType != null) + { + lock (this) + { + if (members == null) + { + ImportDataMembers(); + } + } + } + return members; + } + set { members = value; } + } + + public List Values + { + get + { + if (values == null && UnderlyingType != null) + { + lock (this) + { + if (values == null) + { + ImportDataMembers(); + } + } + } + return values; + } + set { values = value; } + } + + public bool IsFlags + { + get { return isFlags; } + set { isFlags = value; } + } + + public override bool Equals(object other) + { + if ((object)this == other) + return true; + + if (base.Equals(other)) + { + EnumDataContract dataContract = other as EnumDataContract; + if (dataContract != null) + { + if (IsFlags != dataContract.IsFlags) + return false; + + if (Members.Count != dataContract.Members.Count || Values.Count != dataContract.Values.Count) + return false; + + for (int i = 0; i < Members.Count; i++) + { + if (Values[i] != dataContract.Values[i] || Members[i].Name != dataContract.Members[i].Name) + return false; + } + + return BaseContract.StableName.Equals(dataContract.BaseContract.StableName); + } + } + return false; + } + public override int GetHashCode() + { + if (members != null) + { + int hash = 0; + foreach (DataMember member in members) + hash += member.Name.GetHashCode(); + hash += base.StableName.GetHashCode(); + return hash; + } + else + { + return base.GetHashCode(); + } + } + } + + public enum CollectionKind : byte + { + None, + GenericDictionary, + Dictionary, + GenericList, + GenericCollection, + List, + GenericEnumerable, + Collection, + Enumerable, + Array, + } + + [DataContractAttribute(Namespace = "http://schemas.microsoft.com/2003/10/Serialization/Arrays")] + public struct KeyValue + { + K key; + V value; + + internal KeyValue(K key, V value) + { + this.key = key; + this.value = value; + } + + [DataMember(IsRequired = true)] + public K Key + { + get { return key; } + set { key = value; } + } + + [DataMember(IsRequired = true)] + public V Value + { + get { return value; } + set { this.value = value; } + } + } + + public class CollectionDataContract : DataContract + { + public CollectionKind Kind; + public Type ItemType; + public string ItemName; + public String CollectionItemName; + public string KeyName; + public string ValueName; + + public bool IsDictionary + { + get { return !String.IsNullOrEmpty(KeyName); } + } + + public MethodInfo GetEnumeratorMethod; + public MethodInfo AddMethod; + public ConstructorInfo Constructor; + + public CollectionDataContract(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo addMethod, ConstructorInfo constructor) + : base(type) + { + this.supportCollectionDataContract = true; + StableName = DataContract.GetStableName(type, true); //TODO + Kind = kind; + this.ItemType = itemType; + this.KeyName = null; + this.ValueName = null; + + this.GetEnumeratorMethod = getEnumeratorMethod; + this.AddMethod = addMethod; + this.Constructor = constructor; + if (itemType != null) + { + itemContract = DataContract.GetDataContract(itemType, true); + } + Init(type); + } + + DataContract itemContract; + public DataContract ItemContract + { + get + { + if (itemContract == null && UnderlyingType != null) + { + itemContract = DataContract.GetDataContract(UnderlyingType.GetElementType(), true); + } + return itemContract; + } + set + { + itemContract = value; + } + } + + void Init(Type type) + { + object[] collectionDataContractAttributes = type.GetCustomAttributes(Globals.TypeOfCollectionDataContractAttribute, false); + CollectionDataContractAttribute collectionContractAttribute = null; + + if (collectionDataContractAttributes != null && collectionDataContractAttributes.Length > 0) + { + collectionContractAttribute = (CollectionDataContractAttribute)collectionDataContractAttributes[0]; + } + + if (ItemType != null) + { + bool isDictionary = (Kind == CollectionKind.Dictionary || Kind == CollectionKind.GenericDictionary); + string itemName = null, keyName = null, valueName = null; + if (collectionContractAttribute != null) + { + if (!String.IsNullOrEmpty(collectionContractAttribute.ItemName)) + { + itemName = DataContract.EncodeLocalName(collectionContractAttribute.ItemName); + } + if (!String.IsNullOrEmpty(collectionContractAttribute.KeyName)) + { + keyName = DataContract.EncodeLocalName(collectionContractAttribute.KeyName); + } + if (!String.IsNullOrEmpty(collectionContractAttribute.ValueName)) + { + valueName = DataContract.EncodeLocalName(collectionContractAttribute.ValueName); + } + } + + this.ItemName = itemName ?? DataContract.GetStableName(DataContract.UnwrapNullableType(ItemType), true).Name; + this.CollectionItemName = this.ItemName; + if (isDictionary) + { + this.KeyName = keyName ?? Globals.KeyLocalName; + this.ValueName = valueName ?? Globals.ValueLocalName; + } + } + } + + static bool IsCollectionHelper(Type type, out Type itemType, bool constructorRequired) + { + if (type.IsArray && DataContract.GetDataContract(type, true) == null) + { + itemType = type.GetElementType(); + return true; + } + DataContract dataContract; + return IsCollectionOrTryCreate(type, false /*tryCreate*/, out dataContract, out itemType, constructorRequired); + } + + internal static bool IsCollectionDataContract(Type type) + { + return type.IsDefined(Globals.TypeOfCollectionDataContractAttribute, false); + } + + public static bool IsCollectionOrTryCreate(Type type, bool tryCreate, out DataContract dataContract, out Type itemType, bool constructorRequired) + { + dataContract = null; + itemType = Globals.TypeOfObject; + MethodInfo addMethod, getEnumeratorMethod; + bool hasCollectionDataContract = IsCollectionDataContract(type); + Type baseType = type.BaseType; + bool isBaseTypeCollection = (baseType != null && baseType != Globals.TypeOfObject + && baseType != Globals.TypeOfValueType && baseType != Globals.TypeOfUri) ? IsCollection(baseType) : false; + + if (!Globals.TypeOfIEnumerable.IsAssignableFrom(type) || + IsDC(type) || Globals.TypeOfIXmlSerializable.IsAssignableFrom(type)) + { + return false; + } + + if (type.IsInterface) + { + Type interfaceTypeToCheck = type.IsGenericType ? type.GetGenericTypeDefinition() : type; + Type[] knownInterfaces = KnownInterfaces; + for (int i = 0; i < knownInterfaces.Length; i++) + { + if (knownInterfaces[i] == interfaceTypeToCheck) + { + addMethod = null; + if (type.IsGenericType) + { + Type[] genericArgs = type.GetGenericArguments(); + if (interfaceTypeToCheck == Globals.TypeOfIDictionaryGeneric) + { + itemType = Globals.TypeOfKeyValue.MakeGenericType(genericArgs); + addMethod = type.GetMethod(Globals.AddMethodName); + getEnumeratorMethod = Globals.TypeOfIEnumerableGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(genericArgs)).GetMethod(Globals.GetEnumeratorMethodName); + } + else + { + itemType = genericArgs[0]; + getEnumeratorMethod = Globals.TypeOfIEnumerableGeneric.MakeGenericType(itemType).GetMethod(Globals.GetEnumeratorMethodName); + } + } + else + { + if (interfaceTypeToCheck == Globals.TypeOfIDictionary) + { + itemType = typeof(KeyValue); + addMethod = type.GetMethod(Globals.AddMethodName); + } + else + { + itemType = Globals.TypeOfObject; + } + getEnumeratorMethod = Globals.TypeOfIEnumerable.GetMethod(Globals.GetEnumeratorMethodName); + } + if (tryCreate) + dataContract = new CollectionDataContract(type, (CollectionKind)(i + 1), itemType, getEnumeratorMethod, addMethod, null/*defaultCtor*/); + return true; + } + } + } + ConstructorInfo defaultCtor = null; + if (!type.IsValueType && constructorRequired) + { + defaultCtor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Globals.EmptyTypeArray, null); + } + + Type knownInterfaceType = null; + CollectionKind kind = CollectionKind.None; + bool multipleDefinitions = false; + Type[] interfaceTypes = type.GetInterfaces(); + foreach (Type interfaceType in interfaceTypes) + { + Type interfaceTypeToCheck = interfaceType.IsGenericType ? interfaceType.GetGenericTypeDefinition() : interfaceType; + Type[] knownInterfaces = KnownInterfaces; + for (int i = 0; i < knownInterfaces.Length; i++) + { + if (knownInterfaces[i] == interfaceTypeToCheck) + { + CollectionKind currentKind = (CollectionKind)(i + 1); + if (kind == CollectionKind.None || currentKind < kind) + { + kind = currentKind; + knownInterfaceType = interfaceType; + multipleDefinitions = false; + } + else if ((kind & currentKind) == currentKind) + multipleDefinitions = true; + break; + } + } + } + + if (kind == CollectionKind.None) + { + throw new Exception("CollectionTypeIsNotIEnumerable"); + } + + if (kind == CollectionKind.Enumerable || kind == CollectionKind.Collection || kind == CollectionKind.GenericEnumerable) + { + if (multipleDefinitions) + knownInterfaceType = Globals.TypeOfIEnumerable; + itemType = knownInterfaceType.IsGenericType ? knownInterfaceType.GetGenericArguments()[0] : Globals.TypeOfObject; + GetCollectionMethods(type, knownInterfaceType, new Type[] { itemType }, + false, + out getEnumeratorMethod, out addMethod); + if (tryCreate) + dataContract = new CollectionDataContract(type, kind, itemType, getEnumeratorMethod, addMethod, defaultCtor); + } + else + { + if (multipleDefinitions) + { + throw new Exception("SR.CollectionTypeHasMultipleDefinitionsOfInterface"); + } + + Type[] addMethodTypeArray = null; + switch (kind) + { + case CollectionKind.GenericDictionary: + addMethodTypeArray = knownInterfaceType.GetGenericArguments(); + bool isOpenGeneric = knownInterfaceType.IsGenericTypeDefinition + || (addMethodTypeArray[0].IsGenericParameter && addMethodTypeArray[1].IsGenericParameter); + itemType = isOpenGeneric ? Globals.TypeOfKeyValue : Globals.TypeOfKeyValue.MakeGenericType(addMethodTypeArray); + break; + case CollectionKind.Dictionary: + addMethodTypeArray = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject }; + itemType = Globals.TypeOfKeyValue.MakeGenericType(addMethodTypeArray); + break; + case CollectionKind.GenericList: + case CollectionKind.GenericCollection: + addMethodTypeArray = knownInterfaceType.GetGenericArguments(); + itemType = addMethodTypeArray[0]; + break; + case CollectionKind.List: + itemType = Globals.TypeOfObject; + addMethodTypeArray = new Type[] { itemType }; + break; + } + if (tryCreate) + { + GetCollectionMethods(type, knownInterfaceType, addMethodTypeArray, + true, + out getEnumeratorMethod, out addMethod); + dataContract = new CollectionDataContract(type, kind, itemType, getEnumeratorMethod, addMethod, defaultCtor); + } + } + return true; + } + + internal static bool IsDC(Type type) + { + if (type.GetCustomAttributes(Globals.TypeOfDataContractAttribute, false) != null && type.GetCustomAttributes(Globals.TypeOfDataContractAttribute, false).Length > 0) + { + return true; + } + else + { + return false; + } + } + + internal static bool IsCollection(Type type) + { + Type itemType; + return IsCollection(type, out itemType); + } + + internal static bool IsCollection(Type type, out Type itemType) + { + return IsCollectionHelper(type, out itemType, true /*constructorRequired*/); + } + + static Type[] _knownInterfaces; + internal static Type[] KnownInterfaces + { + get + { + if (_knownInterfaces == null) + { + _knownInterfaces = new Type[] + { + Globals.TypeOfIDictionaryGeneric, + Globals.TypeOfIDictionary, + Globals.TypeOfIListGeneric, + Globals.TypeOfICollectionGeneric, + Globals.TypeOfIList, + Globals.TypeOfIEnumerableGeneric, + Globals.TypeOfICollection, + Globals.TypeOfIEnumerable + }; + } + return _knownInterfaces; + } + } + + static void FindCollectionMethodsOnInterface(Type type, Type interfaceType, ref MethodInfo addMethod, ref MethodInfo getEnumeratorMethod) + { + InterfaceMapping mapping = type.GetInterfaceMap(interfaceType); + for (int i = 0; i < mapping.TargetMethods.Length; i++) + { + if (mapping.InterfaceMethods[i].Name == Globals.AddMethodName) + addMethod = mapping.InterfaceMethods[i]; + else if (mapping.InterfaceMethods[i].Name == Globals.GetEnumeratorMethodName) + getEnumeratorMethod = mapping.InterfaceMethods[i]; + } + } + + static bool IsKnownInterface(Type type) + { + Type typeToCheck = type.IsGenericType ? type.GetGenericTypeDefinition() : type; + foreach (Type knownInterfaceType in KnownInterfaces) + { + if (typeToCheck == knownInterfaceType) + { + return true; + } + } + return false; + } + + static void GetCollectionMethods(Type type, Type interfaceType, Type[] addMethodTypeArray, bool addMethodOnInterface, out MethodInfo getEnumeratorMethod, out MethodInfo addMethod) + { + addMethod = getEnumeratorMethod = null; + + if (addMethodOnInterface) + { + addMethod = type.GetMethod(Globals.AddMethodName, BindingFlags.Instance | BindingFlags.Public, null, addMethodTypeArray, null); + if (addMethod == null || addMethod.GetParameters()[0].ParameterType != addMethodTypeArray[0]) + { + FindCollectionMethodsOnInterface(type, interfaceType, ref addMethod, ref getEnumeratorMethod); + if (addMethod == null) + { + Type[] parentInterfaceTypes = interfaceType.GetInterfaces(); + foreach (Type parentInterfaceType in parentInterfaceTypes) + { + if (IsKnownInterface(parentInterfaceType)) + { + FindCollectionMethodsOnInterface(type, parentInterfaceType, ref addMethod, ref getEnumeratorMethod); + if (addMethod == null) + { + break; + } + } + } + } + } + } + else + { + addMethod = type.GetMethod(Globals.AddMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, addMethodTypeArray, null); + if (addMethod == null) + return; + } + + if (getEnumeratorMethod == null) + { + getEnumeratorMethod = type.GetMethod(Globals.GetEnumeratorMethodName, BindingFlags.Instance | BindingFlags.Public, null, Globals.EmptyTypeArray, null); + if (getEnumeratorMethod == null || !Globals.TypeOfIEnumerator.IsAssignableFrom(getEnumeratorMethod.ReturnType)) + { + Type ienumerableInterface = interfaceType.GetInterface("System.Collections.Generic.IEnumerable*"); + if (ienumerableInterface == null) + ienumerableInterface = Globals.TypeOfIEnumerable; + getEnumeratorMethod = GetTargetMethodWithName(Globals.GetEnumeratorMethodName, type, ienumerableInterface); + } + } + } + + internal static MethodInfo GetTargetMethodWithName(string name, Type type, Type interfaceType) + { + InterfaceMapping mapping = type.GetInterfaceMap(interfaceType); + for (int i = 0; i < mapping.TargetMethods.Length; i++) + { + if (mapping.InterfaceMethods[i].Name == name) + return mapping.InterfaceMethods[i]; + } + return null; + } + public override bool Equals(object other) + { + if ((object)this == other) + return true; + if (base.Equals(other)) + { + CollectionDataContract collectionContract = other as CollectionDataContract; + if (collectionContract != null) + { + if (!collectionContract.ItemContract.Equals(this.ItemContract)) { return false; } + if (collectionContract.ItemName != this.ItemName) { return false; } + if (collectionContract.KeyName != this.KeyName) { return false; } + if (collectionContract.ValueName != this.ValueName) { return false; } + if (collectionContract.TopLevelElementName != this.TopLevelElementName) { return false; } + if (collectionContract.TopLevelElementNamespace != this.TopLevelElementNamespace) { return false; } + if (collectionContract.IsDictionary != this.IsDictionary) { return false; } + return true; + } + } + return false; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + public static class Globals + { + internal static Type TypeOfObject = typeof(object); + internal static Type TypeOfValueType = typeof(ValueType); + internal static Type TypeOfArray = typeof(Array); + internal static Type TypeOfEnum = typeof(Enum); + internal static Type TypeOfString = typeof(string); + internal static Type TypeOfStringArray = typeof(string[]); + internal static Type TypeOfInt = typeof(int); + internal static Type TypeOfIntArray = typeof(int[]); + internal static Type TypeOfLong = typeof(long); + internal static Type TypeOfULong = typeof(ulong); + internal static Type TypeOfVoid = typeof(void); + internal static Type TypeOfDouble = typeof(double); + internal static Type TypeOfBool = typeof(bool); + internal static Type TypeOfByte = typeof(byte); + internal static Type TypeOfByteArray = typeof(byte[]); + internal static Type TypeOfTimeSpan = typeof(TimeSpan); + internal static Type TypeOfGuid = typeof(Guid); + internal static Type TypeOfUri = typeof(Uri); + internal static Type TypeOfIntPtr = typeof(IntPtr); + internal static Type TypeOfStreamingContext = typeof(StreamingContext); + internal static Type TypeOfISerializable = typeof(ISerializable); + internal static Type TypeOfIDeserializationCallback = typeof(IDeserializationCallback); + internal static Type TypeOfIObjectReference = typeof(IObjectReference); + internal static Type TypeOfBytePtr = typeof(byte*); + internal static Type TypeOfKnownTypeAttribute = typeof(KnownTypeAttribute); + internal static Type TypeOfDataContractAttribute = typeof(DataContractAttribute); + internal static Type TypeOfContractNamespaceAttribute = typeof(ContractNamespaceAttribute); + internal static Type TypeOfDataMemberAttribute = typeof(DataMemberAttribute); + internal static Type TypeOfOptionalFieldAttribute = typeof(OptionalFieldAttribute); + internal static Type TypeOfObjectArray = typeof(object[]); + internal static Type TypeOfOnSerializingAttribute = typeof(OnSerializingAttribute); + internal static Type TypeOfOnSerializedAttribute = typeof(OnSerializedAttribute); + internal static Type TypeOfOnDeserializingAttribute = typeof(OnDeserializingAttribute); + internal static Type TypeOfOnDeserializedAttribute = typeof(OnDeserializedAttribute); + internal static Type TypeOfFlagsAttribute = typeof(FlagsAttribute); + internal static Type TypeOfSerializableAttribute = typeof(SerializableAttribute); + internal static Type TypeOfSerializationInfo = typeof(SerializationInfo); + internal static Type TypeOfSerializationInfoEnumerator = typeof(SerializationInfoEnumerator); + internal static Type TypeOfSerializationEntry = typeof(SerializationEntry); + internal static Type TypeOfIXmlSerializable = typeof(IXmlSerializable); + internal static Type TypeOfXmlSchemaProviderAttribute = typeof(XmlSchemaProviderAttribute); + internal static Type TypeOfXmlRootAttribute = typeof(XmlRootAttribute); + internal static Type TypeOfXmlQualifiedName = typeof(XmlQualifiedName); + internal static Type TypeOfXmlSchemaType = typeof(XmlSchemaType); + internal static Type TypeOfXmlSchemaSet = typeof(XmlSchemaSet); + internal static object[] EmptyObjectArray = new object[0]; + internal static Type[] EmptyTypeArray = new Type[0]; + internal static Type TypeOfIExtensibleDataObject = typeof(IExtensibleDataObject); + internal static Type TypeOfExtensionDataObject = typeof(ExtensionDataObject); + internal static Type TypeOfNullable = typeof(Nullable<>); + internal static Type TypeOfCollectionDataContractAttribute = typeof(CollectionDataContractAttribute); + internal static Type TypeOfIEnumerable = typeof(IEnumerable); + internal static Type TypeOfIDictionaryGeneric = typeof(IDictionary<,>); + internal static Type TypeOfIEnumerableGeneric = typeof(IEnumerable<>); + internal static Type TypeOfIDictionary = typeof(IDictionary); + internal static Type TypeOfKeyValuePair = typeof(KeyValuePair<,>); + internal static Type TypeOfKeyValue = typeof(KeyValue<,>); + internal static Type TypeOfIListGeneric = typeof(IList<>); + internal static Type TypeOfICollectionGeneric = typeof(ICollection<>); + internal static Type TypeOfIList = typeof(IList); + internal static Type TypeOfICollection = typeof(ICollection); + internal static Type TypeOfIEnumerator = typeof(IEnumerator); + public const string KeyLocalName = "Key"; + public const string ValueLocalName = "Value"; + public const string AddMethodName = "Add"; + public static string SchemaInstanceNamespace = XmlSchema.InstanceNamespace; + public static string SchemaNamespace = XmlSchema.Namespace; + public static string DefaultNamespace = "http://tempuri.org/"; + public static bool DefaultIsRequired = false; + public static int DefaultVersion = 1; + public static string GetEnumeratorMethodName = "GetEnumerator"; + public static string SerializationNamespace = "http://schemas.microsoft.com/2003/10/Serialization/"; + } +} diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContractResolverLibrary.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContractResolverLibrary.cs index 0369aa6419..0f4bfd0f5b 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContractResolverLibrary.cs +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/DataContractResolverLibrary.cs @@ -337,4 +337,68 @@ namespace SerializationTestTypes return KTResolver.ResolveName(typeName, typeNamespace, declaredType, null); } } + + [Serializable] + public class SimpleResolver : DataContractResolver + { + private static readonly string s_defaultNS = "http://schemas.datacontract.org/2004/07/"; + + private TypeLibraryManager _mgr = new TypeLibraryManager(); + + public override bool TryResolveType(Type dcType, Type declaredType, DataContractResolver KTResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace) + { + string resolvedTypeName = string.Empty; + string resolvedNamespace = string.Empty; + XmlDictionary dic = new XmlDictionary(); + + if (_mgr.AllTypesList.Contains(dcType)) + { + resolvedTypeName = dcType.FullName + "***"; + resolvedNamespace = s_defaultNS + resolvedTypeName; + typeName = dic.Add(resolvedTypeName); + typeNamespace = dic.Add(resolvedNamespace); + } + else + { + KTResolver.TryResolveType(dcType, declaredType, null, out typeName, out typeNamespace); + } + if (typeName == null || typeNamespace == null) + { + XmlDictionary dictionary = new XmlDictionary(); + typeName = dictionary.Add(dcType.FullName); + typeNamespace = dictionary.Add(dcType.Assembly.FullName); + } + return true; + } + + public override Type ResolveName(string typeName, string typeNamespace, Type declaredType, DataContractResolver KTResolver) + { + TypeLibraryManager mgr = new TypeLibraryManager(); + string inputTypeName = typeName.Trim('*'); + Type result = null; + if (null != mgr.AllTypesHashtable[inputTypeName]) + { + result = (Type)mgr.AllTypesHashtable[inputTypeName]; + } + else + { + result = KTResolver.ResolveName(typeName, typeNamespace, declaredType, null); + } + if (null == result) + { + try + { + result = Type.GetType(String.Format("{0}, {1}", typeName, typeNamespace)); + } + catch (System.IO.FileLoadException) + { + //Type.GetType throws exception on netfx if it cannot find a type while it just returns null on NetCore. + //The behavior difference of Type.GetType is a known issue. + //Catch the exception so that test case can pass on netfx. + return null; + } + } + return result; + } + } } diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/InheritenceCases.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/InheritenceCases.cs new file mode 100644 index 0000000000..7f8ff062f2 --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/InheritenceCases.cs @@ -0,0 +1,664 @@ +using System; +using System.Runtime.Serialization; + +namespace SerializationTestTypes +{ + [DataContract(IsReference = true)] + public class BaseWithIsRefTrue + { + [DataMember] + public SimpleDC Data; + public BaseWithIsRefTrue() { } + public BaseWithIsRefTrue(bool init) + { + Data = new SimpleDC(true); + } + } + + [DataContract] + public class DerivedNoIsRef : BaseWithIsRefTrue + { + [DataMember] + public SimpleDC RefData; + public DerivedNoIsRef() { } + public DerivedNoIsRef(bool init) + : base(init) + { + RefData = Data; + } + } + + [DataContract] + public class DerivedNoIsRef2 : DerivedNoIsRef + { + [DataMember] + public SimpleDC RefData2; + public DerivedNoIsRef2() { } + public DerivedNoIsRef2(bool init) + : base(init) + { + RefData2 = RefData; + } + } + + [DataContract] + public class DerivedNoIsRef3 : DerivedNoIsRef2 + { + [DataMember] + public SimpleDC RefData3; + public DerivedNoIsRef3() { } + public DerivedNoIsRef3(bool init) + : base(init) + { + RefData3 = RefData2; + } + } + + [DataContract] + public class DerivedNoIsRef4 : DerivedNoIsRef3 + { + [DataMember] + public SimpleDC RefData4; + public DerivedNoIsRef4() { } + public DerivedNoIsRef4(bool init) + : base(init) + { + RefData4 = RefData3; + } + } + + [DataContract] + public class DerivedNoIsRef5 : DerivedNoIsRef4 + { + [DataMember] + public SimpleDC RefData5; + public DerivedNoIsRef5() { } + public DerivedNoIsRef5(bool init) + : base(init) + { + RefData5 = RefData4; + } + } + + [DataContract(IsReference = true)] + public class DerivedNoIsRefWithIsRefTrue6 : DerivedNoIsRef5 + { + [DataMember] + public SimpleDC RefData6; + public DerivedNoIsRefWithIsRefTrue6() { } + public DerivedNoIsRefWithIsRefTrue6(bool init) + : base(init) + { + RefData6 = RefData5; + } + } + + [DataContract] + public class DerivedWithIsRefFalse : BaseWithIsRefTrue + { + [DataMember] + public SimpleDC RefData; + public DerivedWithIsRefFalse() { } + public DerivedWithIsRefFalse(bool init) + : base(init) + { + RefData = Data; + } + } + + [DataContract] + public class DerivedWithIsRefFalse2 : DerivedWithIsRefFalse + { + [DataMember] + public SimpleDC RefData2; + public DerivedWithIsRefFalse2() { } + public DerivedWithIsRefFalse2(bool init) + : base(init) + { + RefData2 = RefData; + } + } + + [DataContract] + public class DerivedWithIsRefFalse3 : DerivedWithIsRefFalse2 + { + [DataMember] + public SimpleDC RefData3; + public DerivedWithIsRefFalse3() { } + public DerivedWithIsRefFalse3(bool init) + : base(init) + { + RefData3 = RefData2; + } + } + + [DataContract] + public class DerivedWithIsRefFalse4 : DerivedWithIsRefFalse3 + { + [DataMember] + public SimpleDC RefData4; + public DerivedWithIsRefFalse4() { } + public DerivedWithIsRefFalse4(bool init) + : base(init) + { + RefData4 = RefData3; + } + } + + [DataContract] + public class DerivedWithIsRefFalse5 : DerivedWithIsRefFalse4 + { + [DataMember] + public SimpleDC RefData5; + public DerivedWithIsRefFalse5() { } + public DerivedWithIsRefFalse5(bool init) + : base(init) + { + RefData5 = RefData4; + } + } + + [DataContract(IsReference = true)] + public class DerivedWithIsRefTrue6 : DerivedWithIsRefFalse5 + { + [DataMember] + public SimpleDC RefData6; + public DerivedWithIsRefTrue6() { } + public DerivedWithIsRefTrue6(bool init) + : base(init) + { + RefData6 = RefData5; + } + } + + [DataContract(IsReference = true)] + public class DerivedWithIsRefTrueExplicit : BaseWithIsRefTrue + { + [DataMember] + public SimpleDC RefData; + public DerivedWithIsRefTrueExplicit() { } + public DerivedWithIsRefTrueExplicit(bool init) + : base(init) + { + RefData = Data; + } + } + + [DataContract(IsReference = true)] + public class DerivedWithIsRefTrueExplicit2 : DerivedWithIsRefTrueExplicit + { + [DataMember] + public SimpleDC RefData2; + public DerivedWithIsRefTrueExplicit2() { } + public DerivedWithIsRefTrueExplicit2(bool init) + : base(init) + { + RefData2 = Data; + } + } + + [DataContract()] + public class BaseNoIsRef + { + [DataMember] + public SimpleDC Data; + public BaseNoIsRef() { } + public BaseNoIsRef(bool init) + { + Data = new SimpleDC(true); + } + } + + [DataContract(IsReference = true)] + public class DerivedWithIsRefTrue : BaseNoIsRef + { + [DataMember] + public SimpleDC RefData; + public DerivedWithIsRefTrue() { } + public DerivedWithIsRefTrue(bool init) + : base(true) + { + RefData = Data; + } + } + + [DataContract] + public class DerivedWithIsRefFalseExplicit : BaseNoIsRef + { + [DataMember] + public SimpleDC RefData; + public DerivedWithIsRefFalseExplicit() { } + public DerivedWithIsRefFalseExplicit(bool init) + : base(true) + { + RefData = Data; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(DerivedDC))] + public class TestInheritence + { + private BaseDC _b; + private DerivedDC _d; + [DataMember] + public BaseDC baseDC + { + get + { + return _b; + } + set + { + _b = value; + } + } + + [DataMember] + public DerivedDC derivedDC + { + get + { + return _d; + } + set + { + _d = value; + } + } + + public TestInheritence() + { + } + + public TestInheritence(bool init) + { + derivedDC = new DerivedDC(true); + baseDC = derivedDC; + } + } + + [DataContract] + [KnownType(typeof(DerivedSerializable))] + [KnownType(typeof(Derived2Serializable))] + + public class TestInheritence9 + { + [DataMember] + public BaseSerializable baseDC; + [DataMember] + public DerivedSerializable derivedDC; + [DataMember] + public BaseDC base1; + [DataMember] + public Derived2Serializable derived2; + + public TestInheritence9() + { + } + + public TestInheritence9(bool init) + { + derivedDC = new DerivedSerializable(true); + baseDC = derivedDC; + base1 = new Derived2Serializable(true); + derived2 = (Derived2Serializable)base1; + } + } + + [DataContract] + [KnownType(typeof(DerivedSerializable))] + [KnownType(typeof(Derived2Serializable))] + [KnownType(typeof(Derived3Derived2Serializable))] + public class TestInheritence91 + { + [DataMember] + public BaseSerializable baseDC; + [DataMember] + public DerivedSerializable derivedDC; + [DataMember] + public BaseDC base1; + [DataMember] + public Derived2Serializable derived2; + [DataMember] + public Derived3Derived2Serializable derived3; + + public TestInheritence91() + { + } + + public TestInheritence91(bool init) + { + derivedDC = new DerivedSerializable(true); + baseDC = derivedDC; + base1 = new Derived2Serializable(true); + derived3 = new Derived3Derived2Serializable(true); + derived2 = derived3; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(DerivedDC))] + public class TestInheritence5 + { + [DataMember] + public BaseDC baseDC = null; + + [DataMember] + public DerivedDC derivedDC = null; + + public TestInheritence5() + { + } + + public TestInheritence5(bool init) + { + baseDC = derivedDC; + } + } + + [DataContract] + public class TestInheritence10 + { + public BaseSerializable baseDC = null; + public DerivedSerializable derivedDC = null; + + public TestInheritence10() + { + } + + public TestInheritence10(bool init) + { + baseDC = derivedDC; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(DerivedDC))] + public class TestInheritence2 + { + [DataMember] + public BaseDC baseDC; + + [DataMember] + public DerivedDC derivedDC; + + public TestInheritence2() + { + } + + public TestInheritence2(bool init) + { + derivedDC = new DerivedDC(true); + baseDC = new BaseDC(true); + baseDC.data = derivedDC.data; + derivedDC.Data = "String1"; + baseDC.Data = derivedDC.Data; + baseDC.data = derivedDC.data1; + derivedDC.Data1 = "String2"; + baseDC.Data = derivedDC.Data1; + baseDC.data = baseDC.data2; + baseDC.Data2 = "String3"; + baseDC.Data = baseDC.Data2; + } + } + + [DataContract] + public class TestInheritence11 + { + [DataMember] + public BaseSerializable baseDC; + [DataMember] + public DerivedSerializable derivedDC; + + public TestInheritence11() + { + } + + public TestInheritence11(bool init) + { + derivedDC = new DerivedSerializable(true); + baseDC = new BaseSerializable(true); + baseDC.data = derivedDC.data; + derivedDC.Data = "String1"; + baseDC.Data = derivedDC.Data; + baseDC.data = derivedDC.data1; + derivedDC.Data1 = "String2"; + baseDC.Data = derivedDC.Data1; + baseDC.data = baseDC.data2; + baseDC.Data2 = "String3"; + baseDC.Data = baseDC.Data2; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(DerivedDC))] + public class TestInheritence3 + { + [DataMember] + public BaseDC baseDC; + + [DataMember] + public DerivedDC derivedDC; + + public TestInheritence3() + { + } + + public TestInheritence3(bool init) + { + derivedDC = new DerivedDC(true); + baseDC = new BaseDC(true); + derivedDC.data = baseDC.data; + baseDC.Data = "String1"; + derivedDC.Data = baseDC.Data; + derivedDC.data = baseDC.data2; + baseDC.Data2 = "String2"; + baseDC.Data2 = baseDC.Data2; + derivedDC.data = derivedDC.data1; + derivedDC.Data1 = "String3"; + derivedDC.Data = derivedDC.Data1; + } + } + + [DataContract] + public class TestInheritence16 + { + [DataMember] + public BaseSerializable baseDC; + [DataMember] + public DerivedSerializable derivedDC; + + public TestInheritence16() + { + } + + public TestInheritence16(bool init) + { + derivedDC = new DerivedSerializable(true); + baseDC = new BaseSerializable(true); + derivedDC.data = baseDC.data; + baseDC.Data = "String1"; + derivedDC.Data = baseDC.Data; + derivedDC.data = baseDC.data2; + baseDC.Data2 = "String2"; + baseDC.Data2 = baseDC.Data2; + derivedDC.data = derivedDC.data1; + derivedDC.Data1 = "String3"; + derivedDC.Data = derivedDC.Data1; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(DerivedDC))] + public class TestInheritence4 + { + [DataMember] + public BaseDC baseDC; + + [DataMember] + public DerivedDC derivedDC; + + public TestInheritence4() + { + } + + public TestInheritence4(bool init) + { + derivedDC = new DerivedDC(true); + baseDC = new BaseDC(true); + derivedDC.Data = "String1"; + ((BaseDC)derivedDC).Data = derivedDC.Data; + ((BaseDC)derivedDC).data = derivedDC.data1; + derivedDC.Data1 = "String2"; + ((BaseDC)derivedDC).Data = derivedDC.Data1; + ((BaseDC)derivedDC).data = ((BaseDC)derivedDC).data2; + ((BaseDC)derivedDC).Data2 = "String3"; + ((BaseDC)derivedDC).Data = ((BaseDC)derivedDC).Data2; + } + } + + [DataContract] + public class TestInheritence12 + { + [DataMember] + public BaseSerializable baseDC; + [DataMember] + public DerivedSerializable derivedDC; + + public TestInheritence12() + { + } + + public TestInheritence12(bool init) + { + derivedDC = new DerivedSerializable(true); + baseDC = new BaseSerializable(true); + derivedDC.Data = "String1"; + ((BaseSerializable)derivedDC).Data = derivedDC.Data; + ((BaseSerializable)derivedDC).data = derivedDC.data1; + derivedDC.Data1 = "String2"; + ((BaseSerializable)derivedDC).Data = derivedDC.Data1; + ((BaseSerializable)derivedDC).data = ((BaseSerializable)derivedDC).data2; + ((BaseSerializable)derivedDC).Data2 = "String3"; + ((BaseSerializable)derivedDC).Data = ((BaseSerializable)derivedDC).Data2; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(DerivedDC))] + [KnownType(typeof(Derived2DC))] + public class TestInheritence6 + { + [DataMember] + public BaseDC baseDC; + + [DataMember] + public DerivedDC derivedDC; + + [DataMember] + public Derived2DC derived2DC; + + public TestInheritence6() + { + } + + public TestInheritence6(bool init) + { + baseDC = new BaseDC(true); + derivedDC = new DerivedDC(true); + derived2DC = new Derived2DC(true); + derived2DC.data = derivedDC.data; + derivedDC.Data = "String1"; + derived2DC.Data = derivedDC.Data; + derived2DC.data = derivedDC.data3; + derivedDC.Data3 = "String2"; + derived2DC.Data = derivedDC.Data3; + derived2DC.data4 = derivedDC.data1; + derivedDC.Data1 = "String3"; + derived2DC.Data4 = derivedDC.Data1; + derived2DC.data1 = derived2DC.data2; + derived2DC.Data2 = "String4"; + derived2DC.Data1 = derived2DC.Data2; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(Derived2DC))] + public class TestInheritence7 + { + [DataMember] + public BaseDC baseDC; + + [DataMember] + public Derived2DC derived2DC; + + public TestInheritence7() + { + } + + public TestInheritence7(bool init) + { + baseDC = new BaseDC(true); + derived2DC = new Derived2DC(true); + derived2DC.data = baseDC.data; + baseDC.Data = "String1"; + derived2DC.Data = baseDC.Data; + derived2DC.data = baseDC.data2; + baseDC.Data2 = "String2"; + derived2DC.Data = baseDC.Data2; + } + } + + [DataContract] + public class TestInheritence14 + { + [DataMember] + public BaseSerializable baseDC; + [DataMember] + public Derived2Serializable derived2DC; + + public TestInheritence14() + { + } + + public TestInheritence14(bool init) + { + baseDC = new BaseSerializable(true); + derived2DC = new Derived2Serializable(true); + derived2DC.data = baseDC.data; + baseDC.Data = "String1"; + derived2DC.Data = baseDC.Data; + derived2DC.data = baseDC.data2; + baseDC.Data2 = "String2"; + derived2DC.Data = baseDC.Data2; + } + } + + [DataContract(IsReference = true)] + [KnownType(typeof(Derived2DC))] + public class TestInheritence8 + { + [DataMember] + public BaseDC baseDC; + + [DataMember] + public Derived2DC derived2DC; + + public TestInheritence8() + { + } + + public TestInheritence8(bool init) + { + derived2DC = new Derived2DC(true); + baseDC = new BaseDC(true); + baseDC.data = derived2DC.data; + derived2DC.Data = "String1"; + baseDC.Data = derived2DC.Data; + baseDC.data = derived2DC.data1; + derived2DC.Data1 = "String2"; + baseDC.Data = derived2DC.Data1; + } + } +} diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/InheritenceObjectRef.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/InheritenceObjectRef.cs new file mode 100644 index 0000000000..5bc9b145bc --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/InheritenceObjectRef.cs @@ -0,0 +1,573 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; + +namespace SerializationTestTypes +{ + [DataContract(IsReference = false)] + public class BaseDC + { + [DataMember] + public string data; + [DataMember] + public string data2; + + public BaseDC() { } + + public virtual string Data + { + get + { + return data; + } + set + { + data = value; + } + } + + public virtual string Data2 + { + get + { + return data2; + } + set + { + data2 = value; + } + } + + public BaseDC(bool init) + { + data = "TestString"; + data2 = "TestString2"; + } + } + + [Serializable] + [DataContract(IsReference = false)] + public class BaseSerializable + { + [DataMember] + public string data; + [DataMember] + public string data2; + [DataMember] + public string[] days; + + public BaseSerializable() { } + + public virtual string Data + { + get + { + return data; + } + set + { + data = value; + } + } + + public virtual string Data2 + { + get + { + return data2; + } + set + { + data2 = value; + } + } + + public BaseSerializable(bool init) + { + data = "TestString"; + data2 = "TestString2"; + days = new string[] { "Base1", "Base2", "Base3", "Base4", "Base5", "Base6", "Base7" }; + } + } + + [DataContract(IsReference = false)] + public class DerivedDC : BaseDC + { + [DataMember] + public string data0; + + [DataMember] + public string data1; + + [DataMember] + public string data3; + + public DerivedDC() { } + + public override string Data + { + get + { + return data0; + } + set + { + data0 = value; + } + } + + public virtual string Data1 + { + get + { + return data1; + } + set + { + data1 = value; + } + } + + public string Data3 + { + get + { + return data3; + } + set + { + data3 = value; + } + } + + public DerivedDC(bool init) + : base(init) + { + data0 = "TestString0"; + data1 = "TestString1"; + data3 = "TestString3"; + } + } + + [Serializable] + public class DerivedSerializable : BaseSerializable + { + public string data0; + public string data1; + public string data3; + + public DerivedSerializable() { } + + public override string Data + { + get + { + return data0; + } + set + { + data0 = value; + } + } + + public virtual string Data1 + { + get + { + return data1; + } + set + { + data1 = value; + } + } + + public string Data3 + { + get + { + return data3; + } + set + { + data3 = value; + } + } + + public DerivedSerializable(bool init) + : base(init) + { + data0 = "TestString0"; + data1 = "TestString1"; + data3 = "TestString3"; + } + } + + [DataContract(IsReference = false)] + public class DerivedDCIsRefBaseSerializable : BaseSerializable + { + [DataMember] + public string Data33; + } + + [DataContract(IsReference = false)] + public class DerivedDCBaseSerializable : BaseSerializable + { + [DataMember] + public string Data33; + } + + [DataContract(IsReference = false)] + public class Derived2DC : DerivedDC + { + [DataMember] + public string data11; + [DataMember] + public string data12; + [DataMember] + public string data4; + + public Derived2DC() { } + + public override string Data + { + get + { + return data11; + } + set + { + data11 = value; + } + } + + public override string Data1 + { + get + { + return data12; + } + set + { + data12 = value; + } + } + + public string Data4 + { + get + { + return data4; + } + set + { + data4 = value; + } + } + + public Derived2DC(bool init) + : base(init) + { + data11 = "TestString11"; + data12 = "TestString12"; + data4 = "TestString4"; + } + } + + [DataContract] + public class BaseDCNoIsRef + { + [DataMember] + private string _data; + + public BaseDCNoIsRef() + { + _data = String.Empty; + } + } + + public class DerivedPOCOBaseDCNOISRef : BaseDCNoIsRef + { + public string Data22; + } + + public class DerivedIXmlSerializable_POCOBaseDCNOISRef : DerivedPOCOBaseDCNOISRef, IXmlSerializable + { + public System.Xml.Schema.XmlSchema GetSchema() + { + XmlSchema schema = new XmlSchema(); + XmlSchemaElement element1 = new XmlSchemaElement(); + element1.Name = "Data"; + element1.SchemaType = XmlSchemaSimpleType.GetBuiltInComplexType(new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")); + schema.Items.Add(element1); + schema.Id = "Schema1"; + return schema; + } + + public void ReadXml(System.Xml.XmlReader reader) + { + XmlDictionaryReader xmlReader = XmlDictionaryReader.CreateDictionaryReader(reader); + string data = xmlReader.ReadString(); + } + + public void WriteXml(System.Xml.XmlWriter writer) + { + XmlDictionaryWriter xmlWriter = XmlDictionaryWriter.CreateDictionaryWriter(writer); + xmlWriter.WriteString("TestString"); + } + } + + [CollectionDataContract(IsReference = false)] + public class DerivedCDCFromBaseDC : BaseDC, IList + { + public string Data223 = String.Empty; + private List _internalData = new List(); + + public int IndexOf(string item) + { + return _internalData.IndexOf(item); + } + + public void Insert(int index, string item) + { + _internalData.Insert(index, item); + } + + public void RemoveAt(int index) + { + } + + public string this[int index] + { + get + { + return _internalData[index]; + } + set + { + _internalData[index] = value; + } + } + + public void Add(string item) + { + _internalData.Add(item); + } + + public void Clear() + { + } + + public bool Contains(string item) + { + return _internalData.Contains(item); + } + + public void CopyTo(string[] array, int arrayIndex) + { + } + + public int Count + { + get { return _internalData.Count; } + } + + public bool IsReadOnly + { + get { return false; } + } + + public bool Remove(string item) + { + throw new NotImplementedException(); + } + + public IEnumerator GetEnumerator() + { + return _internalData.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _internalData.GetEnumerator(); + } + + public static DerivedCDCFromBaseDC CreateInstance() + { + DerivedCDCFromBaseDC list = new DerivedCDCFromBaseDC(); + list.Add("112"); + return list; + } + } + + [Serializable] + public class Derived2Serializable : DerivedDC + { + public string data00; + public string data122; + public string data4; + + public Derived2Serializable() { } + + public override string Data + { + get + { + return data00; + } + set + { + data00 = value; + } + } + + public override string Data1 + { + get + { + return data122; + } + set + { + data122 = value; + } + } + + public string Data4 + { + get + { + return data4; + } + set + { + data4 = value; + } + } + + public Derived2Serializable(bool init) + : base(init) + { + data00 = "TestString00"; + data122 = "TestString122"; + data4 = "TestString4"; + } + } + + [Serializable] + public class Derived2SerializablePositive : DerivedDC + { + [OptionalField] + public string data00; + [OptionalField] + public string data122; + [OptionalField] + public string data4; + + public Derived2SerializablePositive() { } + + public override string Data + { + get + { + return data00; + } + set + { + data00 = value; + } + } + + public override string Data1 + { + get + { + return data122; + } + set + { + data122 = value; + } + } + + public string Data4 + { + get + { + return data4; + } + set + { + data4 = value; + } + } + + public Derived2SerializablePositive(bool init) + : base(init) + { + data00 = "TestString00"; + data122 = "TestString122"; + data4 = "TestString4"; + } + } + + [DataContract(IsReference = false)] + public class Derived2Derived2Serializable : Derived2Serializable + { + public Derived2Derived2Serializable() { } + public Derived2Derived2Serializable(bool init) : base(init) { } + } + + [DataContract(IsReference = false)] + public class Derived3Derived2Serializable : Derived2Serializable + { + public Derived3Derived2Serializable() { } + public Derived3Derived2Serializable(bool init) : base(init) { } + } + + public class Derived31Derived2SerializablePOCO : Derived2Serializable + { + public SimpleDCWithRef SimpleDCWithRefData; + public SimpleDCWithRef RefData; + + public Derived31Derived2SerializablePOCO() { } + public Derived31Derived2SerializablePOCO(bool init) + : base(init) + { + SimpleDCWithRefData = new SimpleDCWithRef(true); + RefData = SimpleDCWithRefData; + } + } + + [DataContract] + public class Derived4Derived2Serializable : Derived3Derived2Serializable + { + public Derived4Derived2Serializable() { } + public Derived4Derived2Serializable(bool init) : base(init) { } + } + + [Serializable] + public class Derived5Derived2Serializable : Derived3Derived2Serializable + { + public Derived5Derived2Serializable() { } + public Derived5Derived2Serializable(bool init) : base(init) { } + } + + public class Derived6Derived2SerializablePOCO : Derived3Derived2Serializable + { + public SimpleDCWithRef SimpleDCWithRefData; + public SimpleDCWithRef RefData; + + public Derived6Derived2SerializablePOCO() { } + public Derived6Derived2SerializablePOCO(bool init) + : base(init) + { + SimpleDCWithRefData = new SimpleDCWithRef(true); + RefData = SimpleDCWithRefData; + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/ObjRefSample.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/ObjRefSample.cs index dbcf4fe32a..dcd88632b2 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/ObjRefSample.cs +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/ObjRefSample.cs @@ -3,8 +3,6 @@ using System.Runtime.Serialization; namespace SerializationTestTypes { - #region Simple Class Structs with Ref - [DataContract(IsReference = true)] public class SimpleDC { @@ -13,9 +11,354 @@ namespace SerializationTestTypes public SimpleDC() { } public SimpleDC(bool init) { - Data = DateTime.MaxValue.ToLongTimeString(); + Data = "This is a string"; } } - #endregion + [DataContract(IsReference = true)] + public class SimpleDCWithSimpleDMRef + { + [DataMember] + public string Data; + + [DataMember] + public string RefData; + + public SimpleDCWithSimpleDMRef() { } + public SimpleDCWithSimpleDMRef(bool init) + { + Data = "This is a string"; + RefData = Data; + } + } + + [DataContract(IsReference = true)] + public class SimpleDCWithRef + { + [DataMember] + public SimpleDC Data; + + [DataMember] + public SimpleDC RefData; + + public SimpleDCWithRef() { } + public SimpleDCWithRef(bool init) + { + Data = new SimpleDC(true); + RefData = Data; + } + } + + [DataContract(IsReference = true)] + public class ContainsSimpleDCWithRef + { + [DataMember] + public SimpleDCWithRef Data; + + [DataMember] + public SimpleDCWithRef RefData; + + public ContainsSimpleDCWithRef() { } + public ContainsSimpleDCWithRef(bool init) + { + Data = new SimpleDCWithRef(true); + RefData = Data; + } + } + + [DataContract] + public struct SimpleStructDC + { + [DataMember] + public string Data; + + public SimpleStructDC(bool init) + { + Data = "This is a string"; + } + } + + [DataContract(IsReference = true)] + public class SimpleDCWithIsRequiredFalse + { + [DataMember(IsRequired = false)] + public string Data; + public SimpleDCWithIsRequiredFalse() { } + public SimpleDCWithIsRequiredFalse(bool init) + { + Data = "This is a string"; + } + } + + [DataContract] + public struct SimpleStructDCWithRef + { + [DataMember] + public SimpleStructDC Data; + + [DataMember] + public SimpleStructDC RefData; + public SimpleStructDCWithRef(bool init) + { + Data = new SimpleStructDC(true); + RefData = Data; + } + } + + [DataContract(IsReference = true)] + public class Mixed1 + { + [DataMember] + public SimpleDC Data1; + + [DataMember] + public SimpleDCWithRef Data2; + + [DataMember] + public SimpleDCWithSimpleDMRef Data3; + + [DataMember] + public SimpleStructDC Data4; + + [DataMember] + public SimpleStructDCWithRef Data5; + + public Mixed1() { } + public Mixed1(bool init) + { + Data1 = new SimpleDC(true); + Data2 = new SimpleDCWithRef(true); + Data3 = new SimpleDCWithSimpleDMRef(true); + Data4 = new SimpleStructDC(true); + Data5 = new SimpleStructDCWithRef(true); + } + } + + [DataContract(IsReference = true, Name = "DCVersioned", Namespace = "SerializationTestTypes.ExtensionData")] + public class DCVersioned1 : IExtensibleDataObject + { + [DataMember] + public SimpleDC Data; + + [DataMember] + public SimpleDC RefData; + public DCVersioned1() { } + public DCVersioned1(bool init) + { + this.Data = new SimpleDC(true); + this.RefData = this.Data; + } + + private ExtensionDataObject _extensionData; + + public ExtensionDataObject ExtensionData + { + get + { + return _extensionData; + } + set + { + _extensionData = value; + } + } + } + + [DataContract(IsReference = true, Name = "DCVersioned2", Namespace = "SerializationTestTypes.ExtensionData")] + public class DCVersioned2 : IExtensibleDataObject + { + [DataMember] + public SimpleDC Data; + + public DCVersioned2() { } + public DCVersioned2(bool init) + { + this.Data = new SimpleDC(true); + } + + private ExtensionDataObject _extensionData; + + public ExtensionDataObject ExtensionData + { + get + { + return _extensionData; + } + set + { + _extensionData = value; + } + } + } + + [DataContract(IsReference = true, Name = "DCVersionedContainer", Namespace = "SerializationTestTypes.ExtensionData")] + public class DCVersionedContainer1 : IExtensibleDataObject + { + [DataMember] + public DCVersioned1 DataVersion1; + + public DCVersionedContainer1() { } + public DCVersionedContainer1(bool init) + { + this.DataVersion1 = new DCVersioned1(true); + } + + private ExtensionDataObject _extensionData; + + public ExtensionDataObject ExtensionData + { + get + { + return _extensionData; + } + set + { + _extensionData = value; + } + } + } + + [DataContract(IsReference = true, Name = "DCVersionedContainerV1", Namespace = "SerializationTestTypes.ExtensionData")] + public class DCVersionedContainerVersion1 : IExtensibleDataObject + { + [DataMember] + public DCVersioned1 DataVersion1; + + [DataMember] + public DCVersioned2 DataVersion2; + + [DataMember] + public DCVersioned1 RefDataVersion1; + + [DataMember] + public DCVersioned2 RefDataVersion2; + + + public DCVersionedContainerVersion1() { } + public DCVersionedContainerVersion1(bool init) + { + this.DataVersion1 = new DCVersioned1(true); + this.DataVersion2 = new DCVersioned2(true); + + this.RefDataVersion1 = this.DataVersion1; + this.RefDataVersion2 = this.DataVersion2; + } + + private ExtensionDataObject _extensionData; + + public ExtensionDataObject ExtensionData + { + get + { + return _extensionData; + } + set + { + _extensionData = value; + } + } + } + + [DataContract(IsReference = true, Name = "DCVersionedContainerV2", Namespace = "SerializationTestTypes.ExtensionData")] + public class DCVersionedContainerVersion2 : IExtensibleDataObject + { + [DataMember] + public DCVersioned1 DataVersion1; + + [DataMember] + public DCVersioned2 DataVersion2; + + public DCVersionedContainerVersion2() { } + public DCVersionedContainerVersion2(bool init) + { + this.DataVersion1 = new DCVersioned1(true); + this.DataVersion2 = new DCVersioned2(true); + } + + private ExtensionDataObject _extensionData; + + public ExtensionDataObject ExtensionData + { + get + { + return _extensionData; + } + set + { + _extensionData = value; + } + } + } + + [DataContract(IsReference = true, Name = "DCVersionedContainerV3", Namespace = "SerializationTestTypes.ExtensionData")] + [KnownType(typeof(DCVersioned1))] + public class DCVersionedContainerVersion3 : IExtensibleDataObject + { + [DataMember(Name = "DCVersioned1")] + public object DataVersion1; + + [DataMember] + public object RefDataVersion2; + + [DataMember] + public DCVersioned1 NewRefDataVersion1; + + public DCVersioned2 NewDataVersion2; + + public DCVersionedContainerVersion3() { } + public DCVersionedContainerVersion3(bool init) + { + this.DataVersion1 = new DCVersioned1(true); + this.NewRefDataVersion1 = (DCVersioned1)this.DataVersion1; + this.RefDataVersion2 = this.NewDataVersion2; + } + + private ExtensionDataObject _extensionData; + + public ExtensionDataObject ExtensionData + { + get + { + return _extensionData; + } + set + { + _extensionData = value; + } + } + } + + [Serializable] + [KnownType(typeof(PublicDC))] + public class SerIser : ISerializable + { + [NonSerialized] + public PublicDC containedData = new PublicDC(); + + public SerIser() { } + + public SerIser(SerializationInfo info, StreamingContext context) + { + containedData = (PublicDC)info.GetValue("containedData", typeof(PublicDC)); + } + + public override bool Equals(object obj) + { + return obj.Equals(containedData); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + public void GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("containedData", containedData); + } + } + + public class IgnoreMemberAttribute : Attribute + { + } } diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Primitives.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Primitives.cs index 7da0371cf7..12fbd62c9c 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Primitives.cs +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/Primitives.cs @@ -1,5 +1,8 @@ using System; +using System.Collections; +using System.Collections.Generic; using System.Runtime.Serialization; +using System.Xml; namespace SerializationTestTypes { @@ -124,4 +127,897 @@ namespace SerializationTestTypes [DataMember] public char c3; } + + [DataContract] + [KnownType(typeof(MyEnum1))] + [KnownType(typeof(PublicDCStruct))] + public class AllTypes + { + public AllTypes() + { + a = false; + b = Byte.MaxValue; + c = Byte.MinValue; + e = Decimal.MaxValue; + f = Decimal.MinusOne; + g = Decimal.MinValue; + h = Decimal.One; + i = Decimal.Zero; + j = default(Decimal); + k = default(Double); + l = Double.Epsilon; + m = Double.MaxValue; + n = Double.MinValue; + o = Double.NaN; + p = Double.NegativeInfinity; + q = Double.PositiveInfinity; + r = default(Single); + s = Single.Epsilon; + t = Single.MinValue; + u = Single.MaxValue; + v = Single.NaN; + w = Single.NegativeInfinity; + x = Single.PositiveInfinity; + y = default(Int32); + z = Int32.MaxValue; + z1 = Int32.MinValue; + z2 = default(Int64); + z3 = Int64.MaxValue; + z4 = Int64.MinValue; + z5 = new Object(); + z6 = default(SByte); + z7 = SByte.MaxValue; + z8 = SByte.MinValue; + z9 = default(Int16); + z91 = Int16.MaxValue; + z92 = Int16.MinValue; + z93 = "abc"; + z94 = default(UInt16); + z95 = UInt16.MaxValue; + z96 = UInt16.MinValue; + z97 = default(UInt32); + z98 = UInt32.MaxValue; + z99 = UInt32.MinValue; + z990 = default(UInt64); + z991 = UInt64.MaxValue; + z992 = UInt64.MinValue; + } + + [DataMember] + public Boolean a; + + [DataMember] + public Byte b; + + [DataMember] + public Byte c; + + [DataMember] + public Char d = Char.MaxValue; + + [DataMember] + public DateTime f5 = new DateTime(); + + [DataMember] + public Guid guidData = new Guid("5642b5d2-87c3-a724-2390-997062f3f7a2"); + + [DataMember] + public String strData; + + [DataMember] + public Decimal e; + + [DataMember] + public Decimal f; + + [DataMember] + public Decimal g; + + [DataMember] + public Decimal h; + + [DataMember] + public Decimal i; + + [DataMember] + public Decimal j; + + [DataMember] + public Double k; + + [DataMember] + public Double l; + + [DataMember] + public Double m; + + [DataMember] + public Double n; + + [DataMember] + public Double o; + + [DataMember] + public Double p; + + [DataMember] + public Double q; + + [DataMember] + public Single r; + + [DataMember] + public Single s; + + [DataMember] + public Single t; + + [DataMember] + public Single u; + + [DataMember] + public Single v; + + [DataMember] + public Single w; + + [DataMember] + public Single x; + + [DataMember] + public Int32 y; + + [DataMember] + public Int32 z; + + [DataMember] + public Int32 z1; + + [DataMember] + public Int64 z2; + + [DataMember] + public Int64 z3; + + [DataMember] + public Int64 z4; + + [DataMember] + public Object z5; + + [DataMember] + public SByte z6; + + [DataMember] + public SByte z7; + + [DataMember] + public SByte z8; + + [DataMember] + public Int16 z9; + + [DataMember] + public Int16 z91; + + [DataMember] + public Int16 z92; + + [DataMember] + public String z93; + + [DataMember] + public UInt16 z94; + + [DataMember] + public UInt16 z95; + + [DataMember] + public UInt16 z96; + + [DataMember] + public UInt32 z97; + + [DataMember] + public UInt32 z98; + + [DataMember] + public UInt32 z99; + + [DataMember] + public UInt64 z990; + + [DataMember] + public UInt64 z991; + + [DataMember] + public UInt64 z992; + + [DataMember] + [IgnoreMember] + public MyEnum1[] enumArrayData = new MyEnum1[] { MyEnum1.red }; + + [DataMember] + [IgnoreMember] + public XmlQualifiedName xmlQualifiedName = new XmlQualifiedName("WCF", "http://www.microsoft.com"); + + [DataMember] + [IgnoreMember] + public ValueType timeSpan = TimeSpan.MaxValue; + + [DataMember] + [IgnoreMember] + public object obj = new object(); + + [DataMember] + [IgnoreMember] + public Uri uri = new Uri("http://www.microsoft.com"); + + [DataMember] + [IgnoreMember] + public Enum enumBase1 = MyEnum1.red; + + [DataMember] + [IgnoreMember] + public Array array1 = new object[] { new object(), new object(), new object() }; + + [DataMember] + [IgnoreMember] + public ValueType valType = new PublicDCStruct(true); + + [DataMember] + [IgnoreMember] + public Nullable nDTO = DateTimeOffset.MaxValue; + + [DataMember] + [IgnoreMember] + public List lDTO = new List(); + } + + [DataContract] + [KnownType(typeof(MyEnum1))] + [KnownType(typeof(PublicDCStruct))] + public class AllTypes2 + { + public AllTypes2() + { + a = false; + b = Byte.MaxValue; + c = Byte.MinValue; + e = Decimal.MaxValue; + f = Decimal.MinusOne; + g = Decimal.MinValue; + h = Decimal.One; + i = Decimal.Zero; + j = default(Decimal); + k = default(Double); + l = Double.Epsilon; + m = Double.MaxValue; + n = Double.MinValue; + o = Double.NaN; + p = Double.NegativeInfinity; + q = Double.PositiveInfinity; + r = default(Single); + s = Single.Epsilon; + t = Single.MinValue; + u = Single.MaxValue; + v = Single.NaN; + w = Single.NegativeInfinity; + x = Single.PositiveInfinity; + y = default(Int32); + z = Int32.MaxValue; + z1 = Int32.MinValue; + z2 = default(Int64); + z3 = Int64.MaxValue; + z4 = Int64.MinValue; + z5 = new Object(); + z6 = default(SByte); + z7 = SByte.MaxValue; + z8 = SByte.MinValue; + z9 = default(Int16); + z91 = Int16.MaxValue; + z92 = Int16.MinValue; + z93 = "abc"; + z94 = default(UInt16); + z95 = UInt16.MaxValue; + z96 = UInt16.MinValue; + z97 = default(UInt32); + z98 = UInt32.MaxValue; + z99 = UInt32.MinValue; + z990 = default(UInt64); + z991 = UInt64.MaxValue; + z992 = UInt64.MinValue; + } + + [DataMember] + public Boolean a; + + [DataMember] + public Byte b; + + [DataMember] + public Byte c; + + [DataMember] + public Char d = Char.MaxValue; + + [DataMember] + public DateTime f5 = new DateTime(); + + [DataMember] + public Guid guidData = new Guid("cac76333-577f-7e1f-0389-789b0d97f395"); + + [DataMember] + public String strData; + + [DataMember] + public Decimal e; + + [DataMember] + public Decimal f; + + [DataMember] + public Decimal g; + + [DataMember] + public Decimal h; + + [DataMember] + public Decimal i; + + [DataMember] + public Decimal j; + + [DataMember] + public Double k; + + [DataMember] + public Double l; + + [DataMember] + public Double m; + + [DataMember] + public Double n; + + [DataMember] + public Double o; + + [DataMember] + public Double p; + + [DataMember] + public Double q; + + [DataMember] + public Single r; + + [DataMember] + public Single s; + + [DataMember] + public Single t; + + [DataMember] + public Single u; + + [DataMember] + public Single v; + + [DataMember] + public Single w; + + [DataMember] + public Single x; + + [DataMember] + public Int32 y; + + [DataMember] + public Int32 z; + + [DataMember] + public Int32 z1; + + [DataMember] + public Int64 z2; + + [DataMember] + public Int64 z3; + + [DataMember] + public Int64 z4; + + [DataMember] + public Object z5; + + [DataMember] + public SByte z6; + + [DataMember] + public SByte z7; + + [DataMember] + public SByte z8; + + [DataMember] + public Int16 z9; + + [DataMember] + public Int16 z91; + + [DataMember] + public Int16 z92; + + [DataMember] + public String z93; + + [DataMember] + public UInt16 z94; + + [DataMember] + public UInt16 z95; + + [DataMember] + public UInt16 z96; + + [DataMember] + public UInt32 z97; + + [DataMember] + public UInt32 z98; + + [DataMember] + public UInt32 z99; + + [DataMember] + public UInt64 z990; + + [DataMember] + public UInt64 z991; + + [DataMember] + public UInt64 z992; + + [DataMember] + [IgnoreMember] + public MyEnum1[] enumArrayData = new MyEnum1[] { MyEnum1.red }; + + [DataMember] + [IgnoreMember] + public XmlQualifiedName xmlQualifiedName = new XmlQualifiedName("WCF", "http://www.microsoft.com"); + + [DataMember] + [IgnoreMember] + public TimeSpan timeSpan = TimeSpan.MaxValue; + + [DataMember] + [IgnoreMember] + public object obj = new object(); + + [DataMember] + [IgnoreMember] + public Uri uri = new Uri("http://www.microsoft.com"); + + [DataMember] + [IgnoreMember] + public Enum enumBase1 = MyEnum1.red; + + [DataMember] + [IgnoreMember] + public Array array1 = new object[] { new object(), new object(), new object() }; + + [DataMember] + [IgnoreMember] + public ValueType valType = new PublicDCStruct(true); + + [DataMember] + [IgnoreMember] + public Nullable nDTO = DateTimeOffset.MaxValue; + } + + [DataContract] + public class DictContainer + { + [DataMember] + public Dictionary dictionaryData = new Dictionary(); + + public DictContainer() + { + dictionaryData.Add(new Guid("ec1f7b4b-c2d1-4c6e-95b6-060a111b0afd").ToByteArray(), new Guid("9831dc90-ca4c-4db2-9335-58a1025ecf29").ToByteArray()); + dictionaryData.Add(new Guid("5e689847-1a10-4f72-aaae-19b247cd0878").ToByteArray(), new Guid("e7af8691-43d5-49e7-8775-1b0126bd943c").ToByteArray()); + dictionaryData.Add(new Guid("711168dd-4a00-4de5-9f3e-38ddfbda0144").ToByteArray(), new Guid("2685b4af-09b6-4a56-81db-95231a3d0276").ToByteArray()); + } + } + + [DataContract] + public class ListContainer + { + [DataMember] + public List listData = new List(); + public ListContainer() + { + listData.Add("TestData"); + } + } + + [DataContract] + [KnownType(typeof(string))] + public class ArrayContainer + { + [DataMember] + public ArrayList listData = new ArrayList(); + public ArrayContainer(bool init) + { + listData.Add("TestData"); + listData.Add("Test"); + listData.Add(new Guid("c0a7310f-f369-481e-a990-39b121eae513")); + } + } + + [DataContract] + [KnownType(typeof(MyPrivateEnum1[]))] + public class EnumContainer1 + { + [DataMember] + public object myPrivateEnum1 = new MyPrivateEnum1[] { MyPrivateEnum1.red }; + } + + [DataContract] + [KnownType(typeof(MyPrivateEnum2[]))] + public class EnumContainer2 + { + [DataMember] + public object myPrivateEnum2 = new MyPrivateEnum2[] { MyPrivateEnum2.red }; + } + + [DataContract] + [KnownType(typeof(MyPrivateEnum3[]))] + public class EnumContainer3 + { + [DataMember] + public object myPrivateEnum3 = new MyPrivateEnum3[] { MyPrivateEnum3.red }; + } + + [DataContract] + public class WithStatic + { + public WithStatic() + { + sstr = "static string"; + str = "instance string"; + } + + [DataMember] + public static string sstr; + + [DataMember] + public string str; + } + + [DataContract] + public class PrivateCstor + { + private PrivateCstor() + { + c = 22; + a = 10; + b = "string b"; + c = 11; + } + + public PrivateCstor(int i) + { + c = i; + } + + private PrivateCstor(StreamingContext sc) + { + c = 33; + } + + [DataMember] + public int a; + + [DataMember] + public string b; + + [DataMember] + public int c; + } + + [DataContract] + public class DerivedFromPriC : PrivateCstor + { + public DerivedFromPriC() : base(int.MaxValue) { } + public DerivedFromPriC(int d) + : base(d) + { + this.d = d; + } + [DataMember] + public int d; + } + + [DataContract] + public class EmptyDC + { + public EmptyDC() + { + a = 10; + } + + [DataMember] + public int a; + + public int A + { + set { a = value; } + get { return a; } + } + } + + [DataContract(Name = "Enum")] + public enum MyEnum + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + [DataContract(Name = "Enum1")] + internal enum MyPrivateEnum1 + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + internal enum MyPrivateEnum2 + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + internal enum MyPrivateEnum3 + { + red, + blue, + black + } + + internal interface SomeProperties + { + int A { set; get; } + + String B { set; get; } + } + + [DataContract] + public class Base : SomeProperties + { + private int _a; + private string _b; + + [DataMember] + public virtual int A + { + set { _a = value; } + get { return _a; } + } + + [DataMember] + public virtual string B + { + set { _b = value; } + get { return _b; } + } + } + + [DataContract] + public class Derived : Base + { + private int _a; + private string _b; + + [DataMember] + override public int A + { + set { _a = value; } + get { return _a; } + } + + [DataMember] + override public string B + { + set { _b = value; } + get { return _b; } + } + } + + [DataContract] + public enum MyEnum2 : sbyte + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + [DataContract] + public enum MyEnum3 : short + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + [DataContract] + public enum MyEnum4 : ushort + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + [DataContract] + public enum MyEnum7 : long + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + [DataContract] + public enum MyEnum8 : ulong + { + [EnumMember] + red, + [EnumMember] + blue, + [EnumMember] + black + } + + public class SeasonsEnumContainer + { + [IgnoreMember] + public Seasons1 member1 = Seasons1.Autumn; + [IgnoreMember] + public Seasons2 member2 = Seasons2.Spring; + [IgnoreMember] + public Seasons3 member3 = Seasons3.Winter; + } + + [Flags] + public enum Seasons3 : short + { + None = 0, + Summer = 1, + Autumn = 2, + Winter = 4, + Spring = 8, + All = Summer | Autumn | Winter | Spring, + } + + [DataContract] + public class list + { + [DataMember] + public int value; + + [DataMember] + public list next; + } + + [DataContract] + public class Arrays + { + public Arrays() + { + a1 = new int[] { }; + a2 = new int[] { 1 }; + a3 = new int[] { 1, 2, 3, 4 }; + a4 = new int[10000]; + } + + [DataMember] + public int[] a1; + + [DataMember] + public int[] a2; + + [DataMember] + public int[] a3; + + [DataMember] + public int[] a4; + } + + [DataContract] + public class Array3 + { + [DataMember] + public int[][] a1 = { new int[] { 1 }, new int[] { } }; + } + + [DataContract] + public class Properties + { + private int _a = 5; + + [DataMember] + public int A + { + set { _a = value; } + get { return _a; } + } + } + + [DataContract] + public class HaveNS + { + [DataMember] + public NotSer ns; + } + + [DataContract] + public class OutClass + { + [DataContract] + public class NestedClass + { + [DataMember] + public int a = 10; + } + + [DataMember] + public NestedClass nc = new NestedClass(); + } + + [DataContract] + public class Temp + { + [DataMember] + public int a = 10; + } + + [DataContract] + public class Array22 + { + [DataMember] + public int[] p = new int[] { 1 }; + } + + [DataContract] + [KnownType(typeof(VT))] + public class BoxedPrim + { + [DataMember] + public object p = new Boolean(); + + [DataMember] + public object p2 = new VT(10); + } } diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SampleIObjectRef.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SampleIObjectRef.cs new file mode 100644 index 0000000000..0f71db0f9b --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SampleIObjectRef.cs @@ -0,0 +1,164 @@ +using System; +using System.Runtime.Serialization; + +namespace SerializationTestTypes +{ + [DataContract(IsReference = false)] + [KnownType(typeof(PublicDC))] + public class DCExplicitInterfaceIObjRef : IObjectReference + { + [DataMember] + public SelfRef1 data; + + [NonSerialized] + static public SelfRef1 containedData = new SelfRef1(); + + public DCExplicitInterfaceIObjRef() { } + public DCExplicitInterfaceIObjRef(bool init) + { + data = new SelfRef1(true); + } + + object IObjectReference.GetRealObject(StreamingContext context) + { + return containedData; + } + + public override bool Equals(object obj) + { + return DCRUtils.CompareIObjectRefTypes(containedData, obj); + } + + public override int GetHashCode() + { + return containedData.GetHashCode(); + } + } + + [DataContract(IsReference = false)] + [KnownType(typeof(PublicDC))] + public class DCIObjRef : IObjectReference + { + [DataMember] + public SimpleDCWithRef data; + + [NonSerialized] + private static SimpleDCWithRef s_containedData = new SimpleDCWithRef(true); + + public DCIObjRef() { } + public DCIObjRef(bool init) { } + + public object GetRealObject(StreamingContext context) + { + return s_containedData; + } + + public override bool Equals(object obj) + { + return DCRUtils.CompareIObjectRefTypes(s_containedData, obj); + } + + public override int GetHashCode() + { + return s_containedData.GetHashCode(); + } + } + + [Serializable] + [KnownType(typeof(PrivateDC))] + public class SerExplicitInterfaceIObjRefReturnsPrivate : IObjectReference + { + [NonSerialized] + private static PrivateDC s_containedData = new PrivateDC(); + + object IObjectReference.GetRealObject(StreamingContext context) + { + return s_containedData; + } + + public override bool Equals(object obj) + { + return DCRUtils.CompareIObjectRefTypes(s_containedData, obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + [Serializable] + [KnownType(typeof(PrivateDC))] + public class SerIObjRefReturnsPrivate : IObjectReference + { + [NonSerialized] + private static PrivateDC s_containedData = new PrivateDC(); + + object IObjectReference.GetRealObject(StreamingContext context) + { + return s_containedData; + } + + public override bool Equals(object obj) + { + return DCRUtils.CompareIObjectRefTypes(s_containedData, obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + [DataContract(IsReference = false)] + [KnownType(typeof(PrivateDC))] + public class DCExplicitInterfaceIObjRefReturnsPrivate : IObjectReference + { + [DataMember] + private PrivateDC _data = new PrivateDC(); + + [NonSerialized] + private static PrivateDC s_containedData = new PrivateDC(); + + object IObjectReference.GetRealObject(StreamingContext context) + { + return s_containedData; + } + + public override bool Equals(object obj) + { + return DCRUtils.CompareIObjectRefTypes(s_containedData, obj); + } + + public override int GetHashCode() + { + return s_containedData.GetHashCode(); + } + } + + [DataContract(IsReference = false)] + [KnownType(typeof(PrivateDC))] + public class DCIObjRefReturnsPrivate : IObjectReference + { + [DataMember] + private PrivateDC _data = new PrivateDC(); + + [NonSerialized] + private static PrivateDC s_containedData = new PrivateDC(); + + public object GetRealObject(StreamingContext context) + { + return s_containedData; + } + + public override bool Equals(object obj) + { + return DCRUtils.CompareIObjectRefTypes(s_containedData, obj); + } + + public override int GetHashCode() + { + return s_containedData.GetHashCode(); + } + } +} diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SampleTypes.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SampleTypes.cs.REMOVED.git-id new file mode 100644 index 0000000000..b2182762f7 --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SampleTypes.cs.REMOVED.git-id @@ -0,0 +1 @@ +fb958b20497afc6008ddb2a552427e692816a79b \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SelfRefAndCycles.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SelfRefAndCycles.cs new file mode 100644 index 0000000000..89344be268 --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTestTypes/SelfRefAndCycles.cs @@ -0,0 +1,392 @@ +using System.Runtime.Serialization; + +namespace SerializationTestTypes +{ + [DataContract(IsReference = true)] + public class SelfRef1 + { + [DataMember] + public SelfRef1 Data; + + public SelfRef1() { } + public SelfRef1(bool init) + { + Data = this; + } + } + + [DataContract(IsReference = true)] + public class SelfRef1DoubleDM + { + [DataMember] + public SelfRef1DoubleDM Data; + + [DataMember] + public SelfRef1DoubleDM Data2; + + public SelfRef1DoubleDM() { } + public SelfRef1DoubleDM(bool init) + { + Data = this; + Data2 = Data; + } + } + + [DataContract(IsReference = true)] + public class SelfRef2 + { + [DataMember] + public SelfRef1 Data; + + [DataMember] + public SelfRef1 RefData; + + public SelfRef2() { } + public SelfRef2(bool init) + { + Data = new SelfRef1(true); + RefData = Data; + } + } + + [DataContract(IsReference = true)] + public class SelfRef3 + { + [DataMember] + public SelfRef2 Data; + + [DataMember] + public SelfRef2 RefData; + + public SelfRef3() { } + public SelfRef3(bool init) + { + Data = new SelfRef2(true); + RefData = Data; + } + } + + [DataContract(IsReference = true)] + public class Cyclic1 + { + [DataMember] + public Cyclic2 Data; + public Cyclic1() { } + public Cyclic1(bool init) + { + Data = new Cyclic2(true); + } + } + + [DataContract(IsReference = true)] + public class Cyclic2 + { + [DataMember] + public Cyclic1 Data; + public Cyclic2() { } + public Cyclic2(bool init) + { + Data = new Cyclic1(); + Data.Data = this; + } + } + + [DataContract(IsReference = true)] + public class CyclicA + { + [DataMember] + public CyclicB Data; + public CyclicA() { } + public CyclicA(bool init) + { + Data = new CyclicB(true); + Data.Data.Data.Data = this; + } + } + + [DataContract(IsReference = true)] + public class CyclicB + { + [DataMember] + public CyclicC Data; + public CyclicB() { } + public CyclicB(bool init) + { + Data = new CyclicC(true); + Data.Data.Data.Data = this; + } + } + + [DataContract(IsReference = true)] + public class CyclicC + { + [DataMember] + public CyclicD Data; + public CyclicC() { } + public CyclicC(bool init) + { + Data = new CyclicD(true); + Data.Data.Data.Data = this; + } + } + + [DataContract(IsReference = true)] + public class CyclicD + { + [DataMember] + public CyclicA Data; + public CyclicD() { } + public CyclicD(bool init) + { + Data = new CyclicA(); + Data.Data = new CyclicB(); + Data.Data.Data = new CyclicC(); + Data.Data.Data.Data = this; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD1 + { + [DataMember] + public CyclicA Data; + public CyclicABCD1() { } + public CyclicABCD1(bool init) + { + Data = new CyclicA(true); + Data.Data.Data.Data.Data = Data; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD2 + { + [DataMember] + public CyclicA Data; + public CyclicABCD2() { } + public CyclicABCD2(bool init) + { + Data = new CyclicA(true); + Data.Data.Data.Data.Data = null; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD3 + { + [DataMember] + public CyclicA Data; + public CyclicABCD3() { } + public CyclicABCD3(bool init) + { + Data = new CyclicA(true); + Data.Data.Data = new CyclicC(true); + Data.Data.Data.Data.Data = new CyclicA(true); + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD4 + { + [DataMember] + public CyclicA Data; + public CyclicABCD4() { } + public CyclicABCD4(bool init) + { + Data = new CyclicA(true); + Data.Data.Data = new CyclicC(true); + Data.Data.Data.Data.Data = new CyclicA(true); + Data.Data.Data.Data.Data.Data.Data.Data.Data.Data = new CyclicB(true); + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD5 + { + [DataMember] + public CyclicA Data; + + [DataMember] + public CyclicA Data2; + + public CyclicABCD5() { } + public CyclicABCD5(bool init) + { + Data = new CyclicA(true); + Data2 = new CyclicA(true); + Data.Data.Data.Data.Data = Data2; + Data2.Data.Data.Data.Data = Data; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD6 + { + [DataMember] + public CyclicA Data; + + [DataMember] + public CyclicA Data2; + + [DataMember] + public CyclicB Data3; + + public CyclicABCD6() { } + public CyclicABCD6(bool init) + { + Data = new CyclicA(true); + Data2 = new CyclicA(true); + Data.Data.Data.Data.Data = Data2; + Data2.Data.Data.Data.Data = Data; + Data3 = Data.Data; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD7 + { + [DataMember] + public CyclicA Data; + + [DataMember] + public CyclicA Data2; + + [DataMember] + public CyclicB Data3; + + [DataMember] + public CyclicC Data4; + + public CyclicABCD7() { } + public CyclicABCD7(bool init) + { + Data = new CyclicA(true); + Data2 = new CyclicA(true); + Data4 = new CyclicC(true); + Data4.Data.Data = Data2; + Data2.Data.Data.Data.Data = Data; + Data3 = Data.Data; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCD8 + { + [DataMember] + public CyclicA Data; + + [DataMember] + public CyclicA Data2; + + [DataMember] + public CyclicB Data3; + + [DataMember] + public CyclicC Data4; + + [DataMember] + public CyclicD Data5; + + public CyclicABCD8() { } + public CyclicABCD8(bool init) + { + Data = new CyclicA(true); + Data2 = new CyclicA(true); + Data3 = new CyclicB(true); + Data4 = new CyclicC(true); + Data5 = new CyclicD(true); + Data2.Data = Data3; + Data3.Data.Data.Data = Data2; + Data4.Data = Data5; + Data5.Data = Data; + } + } + + [DataContract(IsReference = true)] + public class CyclicABCDNoCycles + { + [DataMember] + public CyclicA Data; + public CyclicABCDNoCycles() { } + public CyclicABCDNoCycles(bool init) + { + Data = new CyclicA(true); + Data.Data = new CyclicB(true); + Data.Data.Data = new CyclicC(true); + Data.Data.Data.Data = new CyclicD(true); + Data.Data.Data.Data.Data = new CyclicA(true); + } + } + + [DataContract(IsReference = true)] + public class A1 + { + [DataMember] + public B1 Data; + public A1() { } + public A1(bool init) + { + Data = new B1(true); + } + } + + [DataContract(IsReference = true)] + public class B1 + { + [DataMember] + public BB1 Data; + + [DataMember] + public C1 Data2; + + public B1() { } + public B1(bool init) + { + Data = new BB1(true); + Data2 = new C1(true); + } + } + + [DataContract(IsReference = true)] + public class C1 + { + [DataMember] + public B1 Data; + public C1() { } + public C1(bool init) + { + Data = new B1(); + Data.Data2 = new C1(); + Data.Data = new BB1(true); + } + } + + [DataContract(IsReference = true)] + public class BB1 + { + [DataMember] + public BBB1 Data; + public BB1() { } + public BB1(bool init) + { + Data = new BBB1(true); + } + } + + [DataContract(IsReference = true)] + public class BBB1 + { + [DataMember] + public A1 Data; + public BBB1() { } + public BBB1(bool init) + { + Data = new A1(); + Data.Data = new B1(); + Data.Data.Data = new BB1(); + Data.Data.Data2 = new C1(); + Data.Data.Data2.Data = Data.Data; + Data.Data.Data.Data = this; + } + } +} diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs.REMOVED.git-id new file mode 100644 index 0000000000..d0b8dad30b --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs.REMOVED.git-id @@ -0,0 +1 @@ +3a7bba746b850908848db78f2af33d9698797046 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs new file mode 100644 index 0000000000..07ab269f50 --- /dev/null +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs @@ -0,0 +1,1188 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Runtime.CompilerServices; +using System.Runtime.Serialization; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Schema; +using System.Xml.Serialization; +using System.IO; +using System.Text; +using System.Reflection; +using System.Threading.Tasks; +using System.Runtime.Serialization.Json; + +namespace SerializationTypes +{ + public class TypeWithDateTimeStringProperty + { + public string DateTimeString; + public DateTime CurrentDateTime; + + public TypeWithDateTimeStringProperty() { } + } + public class SimpleType + { + public string P1 { get; set; } + public int P2 { get; set; } + + public static bool AreEqual(SimpleType x, SimpleType y) + { + if (x == null) + { + return y == null; + } + else if (y == null) + { + return x == null; + } + else + { + return (x.P1 == y.P1) && (x.P2 == y.P2); + } + } + } + + public class TypeWithGetSetArrayMembers + { + public SimpleType[] F1; + public int[] F2; + + public SimpleType[] P1 { get; set; } + public int[] P2 { get; set; } + } + + public class TypeWithGetOnlyArrayProperties + { + private SimpleType[] _p1 = new SimpleType[2]; + private int[] _p2 = new int[2]; + public SimpleType[] P1 + { + get + { + return _p1; + } + } + + public int[] P2 + { + get + { + return _p2; + } + } + } + + public struct StructNotSerializable + { + public int value; + + public override int GetHashCode() + { + return value; + } + } + + public class MyCollection : ICollection + { + private List _items = new List(); + + public MyCollection() + { + } + + public MyCollection(params T[] values) + { + _items.AddRange(values); + } + + public void Add(T item) + { + _items.Add(item); + } + + public void Clear() + { + _items.Clear(); + } + + public bool Contains(T item) + { + return _items.Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + _items.CopyTo(array, arrayIndex); + } + + public int Count + { + get { return _items.Count; } + } + + public bool IsReadOnly + { + get { return ((ICollection)_items).IsReadOnly; } + } + + public bool Remove(T item) + { + return _items.Remove(item); + } + + public IEnumerator GetEnumerator() + { + return ((ICollection)_items).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable)_items).GetEnumerator(); + } + } + + public class TypeWithMyCollectionField + { + public MyCollection Collection; + } + + public class TypeWithReadOnlyMyCollectionProperty + { + private MyCollection _ro = new MyCollection(); + public MyCollection Collection + { + get + { + return _ro; + } + } + } + + public class MyList : IList + { + private List _items = new List(); + + public MyList() + { + } + + public MyList(params object[] values) + { + _items.AddRange(values); + } + + public int Add(object value) + { + return ((IList)_items).Add(value); + } + + public void Clear() + { + throw new NotImplementedException(); + } + + public bool Contains(object value) + { + return _items.Contains(value); + } + + public int IndexOf(object value) + { + throw new NotImplementedException(); + } + + public void Insert(int index, object value) + { + throw new NotImplementedException(); + } + + public bool IsFixedSize + { + get { throw new NotImplementedException(); } + } + + public bool IsReadOnly + { + get { throw new NotImplementedException(); } + } + + public void Remove(object value) + { + throw new NotImplementedException(); + } + + public void RemoveAt(int index) + { + throw new NotImplementedException(); + } + + public object this[int index] + { + get + { + return _items[index]; + } + set + { + throw new NotImplementedException(); + } + } + + public void CopyTo(Array array, int index) + { + throw new NotImplementedException(); + } + + public int Count + { + get { return _items.Count; } + } + + public bool IsSynchronized + { + get { throw new NotImplementedException(); } + } + + public object SyncRoot + { + get { throw new NotImplementedException(); } + } + + public IEnumerator GetEnumerator() + { + return ((IEnumerable)_items).GetEnumerator(); + } + } + public enum MyEnum + { + [EnumMember] + One, + Two, + [EnumMember] + Three + } + + public class TypeWithEnumMembers + { + public MyEnum F1; + public MyEnum P1 { get; set; } + } + + [DataContract] + public struct DCStruct + { + [DataMember] + public string Data; + public DCStruct(bool init) + { + Data = "Data"; + } + } + + [DataContract] + public class DCClassWithEnumAndStruct + { + [DataMember] + public DCStruct MyStruct; + + [DataMember] + public MyEnum MyEnum1; + + public DCClassWithEnumAndStruct() { } + public DCClassWithEnumAndStruct(bool init) + { + MyStruct = new DCStruct(init); + } + } + public class BuiltInTypes + { + public byte[] ByteArray { get; set; } + } + + public class TypeA + { + public string Name; + } + + public class TypeB + { + public string Name; + + public static implicit operator TypeA(TypeB i) + { + return new TypeA { Name = i.Name }; + } + + public static implicit operator TypeB(TypeA i) + { + return new TypeB { Name = i.Name }; + } + } + + public class TypeHasArrayOfASerializedAsB + { + public TypeA[] Items; + + public TypeHasArrayOfASerializedAsB() { } + public TypeHasArrayOfASerializedAsB(bool init) + { + Items = new TypeA[] + { + new TypeA { Name = "typeAValue" }, + new TypeB { Name = "typeBValue" }, + }; + } + } + + public class __TypeNameWithSpecialCharacters漢ñ + { + public string PropertyNameWithSpecialCharacters漢ñ { get; set; } + } + + public class BaseClassWithSamePropertyName + { + [DataMember] + public string StringProperty; + + [DataMember] + public int IntProperty; + + [DataMember] + public DateTime DateTimeProperty; + + [DataMember] + public List ListProperty; + } + + public class DerivedClassWithSameProperty : BaseClassWithSamePropertyName + { + [DataMember] + public new string StringProperty; + + [DataMember] + public new int IntProperty; + + [DataMember] + public new DateTime DateTimeProperty; + + [DataMember] + public new List ListProperty; + } + + public class DerivedClassWithSameProperty2 : DerivedClassWithSameProperty + { + [DataMember] + public new DateTime DateTimeProperty; + + [DataMember] + public new List ListProperty; + } + + public class TypeWithDateTimePropertyAsXmlTime + { + DateTime _value; + + [XmlText(DataType = "time")] + public DateTime Value + { + get { return _value; } + set { _value = value; } + } + } + + public class TypeWithByteArrayAsXmlText + { + [XmlText(DataType = "base64Binary")] + public byte[] Value; + } + + [DataContract(IsReference = false)] + public class SimpleDC + { + [DataMember] + public string Data; + public SimpleDC() { } + public SimpleDC(bool init) + { + Data = DateTime.MaxValue.ToString("T", CultureInfo.InvariantCulture); + } + } + + [XmlRoot(Namespace = "http://schemas.xmlsoap.org/ws/2005/04/discovery", IsNullable = false)] + public class TypeWithXmlTextAttributeOnArray + { + [XmlText] + public string[] Text; + } + + [Flags] + public enum EnumFlags + { + [EnumMember] + One = 0x01, + [EnumMember] + Two = 0x02, + [EnumMember] + Three = 0x04, + [EnumMember] + Four = 0x08 + } + + public interface IBaseInterface + { + string ClassID { get; } + + string DisplayName { get; set; } + + string Id { get; set; } + + bool IsLoaded { get; set; } + } + + [DataContract] + public class ClassImplementsInterface : IBaseInterface + { + public virtual string ClassID { get; set; } + + [DataMember] + public string DisplayName { get; set; } + + [DataMember] + public string Id { get; set; } + + public bool IsLoaded { get; set; } + } + + + #region XmlSerializer specific + public class WithStruct + { + public SomeStruct Some { get; set; } + } + + public struct SomeStruct + { + public int A; + public int B; + } + + public class WithEnums + { + public IntEnum Int { get; set; } + public ShortEnum Short { get; set; } + } + + public class WithNullables + { + public IntEnum? Optional { get; set; } + public IntEnum? Optionull { get; set; } + public int? OptionalInt { get; set; } + public Nullable OptionullInt { get; set; } + public SomeStruct? Struct1 { get; set; } + public SomeStruct? Struct2 { get; set; } + } + + public enum ByteEnum : byte + { + Option0, Option1, Option2 + } + + public enum SByteEnum : sbyte + { + Option0, Option1, Option2 + } + + public enum ShortEnum : short + { + Option0, Option1, Option2 + } + + public enum IntEnum + { + Option0, Option1, Option2 + } + + public enum UIntEnum : uint + { + Option0, Option1, Option2 + } + + public enum LongEnum : long + { + Option0, Option1, Option2 + } + + public enum ULongEnum : ulong + { + Option0, Option1, Option2 + } + + [XmlRoot(DataType = "XmlSerializerAttributes", ElementName = "AttributeTesting", IsNullable = false)] + [XmlInclude(typeof(ItemChoiceType))] + public class XmlSerializerAttributes + { + public XmlSerializerAttributes() + { + XmlElementProperty = 1; + XmlAttributeProperty = 2; + XmlArrayProperty = new string[] { "one", "two", "three" }; + EnumType = ItemChoiceType.Word; + MyChoice = "String choice value"; + XmlIncludeProperty = ItemChoiceType.DecimalNumber; + XmlEnumProperty = new ItemChoiceType[] { ItemChoiceType.DecimalNumber, ItemChoiceType.Number, ItemChoiceType.Word, ItemChoiceType.None }; + XmlTextProperty = "Hello XML"; + XmlNamespaceDeclarationsProperty = "XmlNamespaceDeclarationsPropertyValue"; + } + + [XmlElement(DataType = "int", ElementName = "XmlElementPropertyNode", Namespace = "http://element", Type = typeof(int))] + public int XmlElementProperty { get; set; } + + [XmlAttribute(AttributeName = "XmlAttributeName")] + public int XmlAttributeProperty { get; set; } + + [XmlArray(ElementName = "CustomXmlArrayProperty", Namespace = "http://mynamespace")] + [XmlArrayItem(typeof(string))] + public object[] XmlArrayProperty { get; set; } + + [XmlChoiceIdentifier("EnumType")] + [XmlElement("Word", typeof(string))] + [XmlElement("Number", typeof(int))] + [XmlElement("DecimalNumber", typeof(double))] + public object MyChoice; + + // Don't serialize this field. The EnumType field contains the enumeration value that corresponds to the MyChoice field value. + [XmlIgnore] + public ItemChoiceType EnumType; + + [XmlElement] + public object XmlIncludeProperty; + + [XmlEnum("EnumProperty")] + public ItemChoiceType[] XmlEnumProperty; + + [XmlText] + public string XmlTextProperty; + + [XmlNamespaceDeclarations] + public string XmlNamespaceDeclarationsProperty; + } + + [XmlType(IncludeInSchema = false)] + public enum ItemChoiceType + { + None, + Word, + Number, + DecimalNumber + } + + public class TypeWithAnyAttribute + { + public string Name; + + [XmlAttribute] + public int IntProperty { get; set; } + + [XmlAnyAttribute] + public XmlAttribute[] Attributes { get; set; } + } + + public class KnownTypesThroughConstructor + { + public object EnumValue; + + public object SimpleTypeValue; + } + + public class SimpleKnownTypeValue + { + public string StrProperty { get; set; } + } + + public class ClassImplementingIXmlSerialiable : IXmlSerializable + { + public static bool WriteXmlInvoked = false; + public static bool ReadXmlInvoked = false; + + public string StringValue { get; set; } + private bool BoolValue { get; set; } + + public ClassImplementingIXmlSerialiable() + { + BoolValue = true; + } + + public bool GetPrivateMember() + { + return BoolValue; + } + + public System.Xml.Schema.XmlSchema GetSchema() + { + return null; + } + + public void ReadXml(System.Xml.XmlReader reader) + { + ReadXmlInvoked = true; + reader.MoveToContent(); + StringValue = reader.GetAttribute("StringValue"); + BoolValue = bool.Parse(reader.GetAttribute("BoolValue")); + } + + public void WriteXml(System.Xml.XmlWriter writer) + { + WriteXmlInvoked = true; + writer.WriteAttributeString("StringValue", StringValue); + writer.WriteAttributeString("BoolValue", BoolValue.ToString()); + } + } + public class TypeWithPropertyNameSpecified + { + public string MyField; + + [XmlIgnore] + public bool MyFieldSpecified; + + public int MyFieldIgnored; + + [XmlIgnore] + public bool MyFieldIgnoredSpecified; + } + + [XmlType(Namespace = ""), XmlRoot(Namespace = "", IsNullable = true)] + public class TypeWithXmlSchemaFormAttribute + { + [XmlArray(Form = XmlSchemaForm.Unqualified)] + public List UnqualifiedSchemaFormListProperty { get; set; } + + [XmlArray(Form = XmlSchemaForm.None), XmlArrayItem("NoneParameter", Form = XmlSchemaForm.None, IsNullable = false)] + public List NoneSchemaFormListProperty { get; set; } + + [XmlArray(Form = XmlSchemaForm.Qualified), XmlArrayItem("QualifiedParameter", Form = XmlSchemaForm.Qualified, IsNullable = false)] + public List QualifiedSchemaFormListProperty { get; set; } + } + + [XmlType(TypeName = "MyXmlType")] + public class TypeWithTypeNameInXmlTypeAttribute + { + [XmlAttribute(Form = XmlSchemaForm.Qualified)] + public string XmlAttributeForm; + } + + [XmlType(AnonymousType = true)] + public class TypeWithSchemaFormInXmlAttribute + { + [XmlAttribute(Form = XmlSchemaForm.Qualified, Namespace = "http://test.com")] + public string TestProperty; + } + + + #endregion + + public class TypeWithNonPublicDefaultConstructor + { + private static string s_prefix; + static TypeWithNonPublicDefaultConstructor() + { + s_prefix = "Mr. "; + } + + private TypeWithNonPublicDefaultConstructor() + { + Name = s_prefix + "FooName"; + } + public string Name { get; set; } + } + + // Comes from app: The Weather Channel. See bug 1101076 for details + public class ServerSettings + { + public string DS2Root { get; set; } + public string MetricConfigUrl { get; set; } + } + + [DataContract] + public class TypeWithXmlQualifiedName + { + [DataMember(IsRequired = true, EmitDefaultValue = false)] + public XmlQualifiedName Value { get; set; } + } + + public class TypeWith2DArrayProperty2 + { + [System.Xml.Serialization.XmlArrayItemAttribute("SimpleType", typeof(SimpleType[]), IsNullable = false)] + public SimpleType[][] TwoDArrayOfSimpleType; + } + + public class TypeWithPropertiesHavingDefaultValue + { + [DefaultValue("")] + public string EmptyStringProperty { get; set; } = ""; + + [DefaultValue("DefaultString")] + public string StringProperty { get; set; } = "DefaultString"; + + [DefaultValue(11)] + public int IntProperty { get; set; } = 11; + + [DefaultValue('m')] + public char CharProperty { get; set; } = 'm'; + } + + public class TypeWithEnumPropertyHavingDefaultValue + { + [DefaultValue(1)] + public IntEnum EnumProperty { get; set; } = IntEnum.Option1; + } + + public class TypeWithEnumFlagPropertyHavingDefaultValue + { + [DefaultValue(EnumFlags.One | EnumFlags.Four)] + public EnumFlags EnumProperty { get; set; } = EnumFlags.One | EnumFlags.Four; + } + + public class TypeWithShouldSerializeMethod + { + private static readonly string DefaultFoo = "default"; + + public string Foo { get; set; } = DefaultFoo; + + public bool ShouldSerializeFoo() + { + return Foo != DefaultFoo; + } + } + + public class KnownTypesThroughConstructorWithArrayProperties + { + public object StringArrayValue; + public object IntArrayValue; + } + + public class KnownTypesThroughConstructorWithValue + { + public object Value; + } + + public class TypeWithTypesHavingCustomFormatter + { + [XmlElement(DataType = "dateTime")] + public DateTime DateTimeContent; + + [XmlElement(DataType = "QName")] + public XmlQualifiedName QNameContent; + + // The case where DataType = "date" is verified by Xml_TypeWithDateTimePropertyAsXmlTime. + [XmlElement(DataType = "date")] + public DateTime DateContent; + + [XmlElement(DataType = "Name")] + public string NameContent; + + [XmlElement(DataType = "NCName")] + public string NCNameContent; + + [XmlElement(DataType = "NMTOKEN")] + public string NMTOKENContent; + + [XmlElement(DataType = "NMTOKENS")] + public string NMTOKENSContent; + + [XmlElement(DataType = "base64Binary")] + public byte[] Base64BinaryContent; + + [XmlElement(DataType = "hexBinary")] + public byte[] HexBinaryContent; + } + + public class TypeWithArrayPropertyHavingChoice + { + // The ManyChoices field can contain an array + // of choices. Each choice must be matched to + // an array item in the ChoiceArray field. + [XmlChoiceIdentifier("ChoiceArray")] + [XmlElement("Item", typeof(string))] + [XmlElement("Amount", typeof(int))] + public object[] ManyChoices; + + // TheChoiceArray field contains the enumeration + // values, one for each item in the ManyChoices array. + [XmlIgnore] + public MoreChoices[] ChoiceArray; + } + + public enum MoreChoices + { + None, + Item, + Amount + } + + public class TypeWithFieldsOrdered + { + [XmlElement(Order = 0)] + public int IntField1; + [XmlElement(Order = 1)] + public int IntField2; + [XmlElement(Order = 3)] + public string StringField1; + [XmlElement(Order = 2)] + public string StringField2; + } + +} + +public class TypeWithXmlElementProperty +{ + [XmlAnyElement] + public XmlElement[] Elements; +} + +public class TypeWithXmlDocumentProperty +{ + public XmlDocument Document; +} + +public class TypeWithBinaryProperty +{ + [XmlElement(DataType = "hexBinary")] + public byte[] BinaryHexContent { get; set; } + [XmlElement(DataType = "base64Binary")] + public byte[] Base64Content { get; set; } +} + +public class TypeWithTimeSpanProperty +{ + public TimeSpan TimeSpanProperty; +} + +public class TypeWithDefaultTimeSpanProperty +{ + public TypeWithDefaultTimeSpanProperty() + { + TimeSpanProperty = GetDefaultValue("TimeSpanProperty"); + TimeSpanProperty2 = GetDefaultValue("TimeSpanProperty2"); + } + + [DefaultValue(typeof(TimeSpan), "00:01:00")] + public TimeSpan TimeSpanProperty { get; set; } + + [DefaultValue(typeof(TimeSpan), "00:00:01")] + public TimeSpan TimeSpanProperty2 { get; set; } + + public TimeSpan GetDefaultValue(string propertyName) + { + var property = this.GetType().GetProperty(propertyName); + + var attribute = property.GetCustomAttribute(typeof(DefaultValueAttribute)) + as DefaultValueAttribute; + + if (attribute != null) + { + return (TimeSpan)attribute.Value; + } + else + { + return new TimeSpan(0, 0, 0); + } + } +} + +public class TypeWithByteProperty +{ + public byte ByteProperty; +} + + +[XmlRoot()] +public class TypeWithXmlNodeArrayProperty +{ + [XmlText] + public XmlNode[] CDATA { get; set; } +} + + +public class Animal +{ + public int Age; + public string Name; +} + +public class Dog : Animal +{ + public DogBreed Breed; +} + +public enum DogBreed +{ + GermanShepherd, + LabradorRetriever +} + +public class Group +{ + public string GroupName; + public Vehicle GroupVehicle; +} + +public class Vehicle +{ + public string LicenseNumber; +} + +[DataContract(Namespace = "www.msn.com/Examples/")] +public class Employee +{ + [DataMember] + public string EmployeeName; + [DataMember] + private string ID = string.Empty; +} + +public class SerializeIm : XmlSerializerImplementation +{ + public override XmlSerializer GetSerializer(Type type) + { + return new XmlSerializer(type); + } +} + +[XmlInclude(typeof(DerivedClass))] +public class BaseClass +{ + public string value { get; set; } + public string Value; +} + +public class DerivedClass : BaseClass +{ + public new string value; + public new string Value { get; set; } +} + +[XmlRootAttribute("PurchaseOrder", Namespace = "http://www.contoso1.com", IsNullable = false)] +public class PurchaseOrder +{ + public Address ShipTo; + public string OrderDate; + + [XmlArrayAttribute("Items")] + public OrderedItem[] OrderedItems; + public decimal SubTotal; + public decimal ShipCost; + public decimal TotalCost; + + public static PurchaseOrder CreateInstance() + { + PurchaseOrder po = new PurchaseOrder(); + Address billAddress = new Address(); + billAddress.Name = "John Doe"; + billAddress.Line1 = "1 Main St."; + billAddress.City = "AnyTown"; + billAddress.State = "WA"; + billAddress.Zip = "00000"; + po.ShipTo = billAddress; + po.OrderDate = new DateTime(2017, 4, 10).ToString("D", CultureInfo.InvariantCulture); + + OrderedItem item = new OrderedItem(); + item.ItemName = "Widget S"; + item.Description = "Small widget"; + item.UnitPrice = (decimal)5.23; + item.Quantity = 3; + item.Calculate(); + + OrderedItem[] items = { item }; + po.OrderedItems = items; + decimal subTotal = new decimal(); + foreach (OrderedItem oi in items) + { + subTotal += oi.LineTotal; + } + po.SubTotal = subTotal; + po.ShipCost = (decimal)12.51; + po.TotalCost = po.SubTotal + po.ShipCost; + return po; + } +} + +public class Address +{ + [XmlAttribute] + public string Name; + public string Line1; + + [XmlElementAttribute(IsNullable = false)] + public string City; + public string State; + public string Zip; + + public static void CreateInstance() + { + Address obj = new Address(); + obj.City = "Pune"; + obj.State = "WA"; + obj.Zip = "98052"; + } +} + +public class OrderedItem +{ + public string ItemName; + public string Description; + public decimal UnitPrice; + public int Quantity; + public decimal LineTotal; + + public void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +} + +[XmlType("AliasedTestType")] +public class AliasedTestType +{ + [XmlElement("X", typeof(List))] + [XmlElement("Y", typeof(List))] + [XmlElement("Z", typeof(List))] + public object Aliased { get; set; } +} + +public class BaseClass1 +{ + [XmlElement] + public MyCollection1 Prop; +} + +public class DerivedClass1 : BaseClass1 +{ + [XmlElement] + new public MyCollection1 Prop; +} + +public class MyCollection1 : IEnumerable, IEnumerable +{ + private List _values = new List(); + + public void Add(DateTime value) + { + _values.Add(value); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _values.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return _values.GetEnumerator(); + } +} + +public static class Outer +{ + public class Person + { + public string FirstName { get; set; } + public string MiddleName { get; set; } + public string LastName { get; set; } + } +} + +public class Orchestra +{ + public Instrument[] Instruments; +} + +public class Instrument +{ + public string Name; +} + +public class Brass : Instrument +{ + public bool IsValved; +} + +public class Trumpet : Brass +{ + public char Modulation; +} + +public class Pet +{ + [DefaultValueAttribute("Dog")] + public string Animal; + [XmlIgnoreAttribute] + public string Comment; + public string Comment2; +} + +public class TypeWithVirtualGenericProperty +{ + public virtual T Value { get; set; } +} + +public class TypeWithVirtualGenericPropertyDerived : TypeWithVirtualGenericProperty +{ + public override T Value { get; set; } +} + +public class DefaultValuesSetToNaN +{ + [DefaultValue(double.NaN)] + public double DoubleProp { get; set; } + + [DefaultValue(float.NaN)] + public float FloatProp { get; set; } + + [DefaultValue(Double.NaN)] + public Double DoubleField; + + [DefaultValue(Single.NaN)] + public Single SingleField; + + public override bool Equals(object obj) + { + var other = obj as DefaultValuesSetToNaN; + return other == null ? false : + other.DoubleProp == this.DoubleProp && other.FloatProp == this.FloatProp && + other.DoubleField == this.DoubleField && other.SingleField == this.SingleField; + } + + public override int GetHashCode() + { + return this.DoubleProp.GetHashCode() ^ this.FloatProp.GetHashCode() ^ + this.DoubleField.GetHashCode() ^ this.SingleField.GetHashCode(); + } +} + +public class TypeWithoutPublicSetter +{ + public string Name { get; private set; } + + [XmlIgnore] + public int Age { get; private set; } + + public Type MyType { get; private set; } + + public string ValidProperty { get; set; } + + public string PropertyWrapper + { + get + { + return ValidProperty; + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs.REMOVED.git-id b/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs.REMOVED.git-id deleted file mode 100644 index f18a055c80..0000000000 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a789c45e14e5b7c313bc4ee22f776d660a852f67 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj b/external/corefx/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj index 959dbaa00d..1e93b0e108 100644 --- a/external/corefx/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj +++ b/external/corefx/src/System.Runtime.Serialization.Xml/tests/System.Runtime.Serialization.Xml.Tests.csproj @@ -13,6 +13,7 @@ + @@ -25,14 +26,22 @@ Common\System\IO\TempFile.cs - - CommonTest\System\PlatformDetection.cs - + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/GridLength.cs b/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/GridLength.cs index 2ff17bd973..682924b720 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/GridLength.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/GridLength.cs @@ -47,7 +47,7 @@ namespace Windows.UI.Xaml public GridLength(double value, GridUnitType type) { - if (Double.IsNaN(value) || Double.IsInfinity(value) || value < 0.0) + if (!double.IsFinite(value) || value < 0.0) { throw new ArgumentException(SR.DirectUI_InvalidArgument, nameof(value)); } diff --git a/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/Media/Animation/RepeatBehavior.cs b/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/Media/Animation/RepeatBehavior.cs index a902e790cc..d8f89ee0cf 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/Media/Animation/RepeatBehavior.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/src/System/Windows/Media/Animation/RepeatBehavior.cs @@ -41,9 +41,7 @@ namespace Windows.UI.Xaml.Media.Animation public RepeatBehavior(double count) { - if (Double.IsInfinity(count) - || Double.IsNaN(count) - || count < 0.0) + if (!double.IsFinite(count) || count < 0.0) { throw new ArgumentOutOfRangeException(nameof(count)); } diff --git a/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/tests/System.Runtime.WindowsRuntime.UI.Xaml.Tests.csproj b/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/tests/System.Runtime.WindowsRuntime.UI.Xaml.Tests.csproj index 4dfe433f89..9f486e225f 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/tests/System.Runtime.WindowsRuntime.UI.Xaml.Tests.csproj +++ b/external/corefx/src/System.Runtime.WindowsRuntime.UI.Xaml/tests/System.Runtime.WindowsRuntime.UI.Xaml.Tests.csproj @@ -22,10 +22,7 @@ - - {263DA4F1-C3BC-4B43-98E7-9F38B419A131} - System.Runtime.WindowsRuntime.UI.Xaml - + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj b/external/corefx/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj index 4ad28632fd..02e0a93c09 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj +++ b/external/corefx/src/System.Runtime.WindowsRuntime/ref/System.Runtime.WindowsRuntime.csproj @@ -22,6 +22,7 @@ + diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/NetFxToWinRtStreamAdapter.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/NetFxToWinRtStreamAdapter.cs index 52ac810801..4bbf2fc978 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/NetFxToWinRtStreamAdapter.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/NetFxToWinRtStreamAdapter.cs @@ -193,7 +193,7 @@ namespace System.IO if (str == null) { ObjectDisposedException ex = new ObjectDisposedException(SR.ObjectDisposed_CannotPerformOperation); - ex.SetErrorCode(HResults.RO_E_CLOSED); + ex.SetErrorCode(__HResults.RO_E_CLOSED); throw ex; } @@ -234,14 +234,14 @@ namespace System.IO if (count < 0 || Int32.MaxValue < count) { ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(count)); - ex.SetErrorCode(HResults.E_INVALIDARG); + ex.SetErrorCode(__HResults.E_INVALIDARG); throw ex; } if (buffer.Capacity < count) { ArgumentException ex = new ArgumentException(SR.Argument_InsufficientBufferCapacity); - ex.SetErrorCode(HResults.E_INVALIDARG); + ex.SetErrorCode(__HResults.E_INVALIDARG); throw ex; } @@ -249,7 +249,7 @@ namespace System.IO { ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(options), SR.ArgumentOutOfRange_InvalidInputStreamOptionsEnumValue); - ex.SetErrorCode(HResults.E_INVALIDARG); + ex.SetErrorCode(__HResults.E_INVALIDARG); throw ex; } @@ -300,7 +300,7 @@ namespace System.IO if (buffer.Capacity < buffer.Length) { ArgumentException ex = new ArgumentException(SR.Argument_BufferLengthExceedsCapacity); - ex.SetErrorCode(HResults.E_INVALIDARG); + ex.SetErrorCode(__HResults.E_INVALIDARG); throw ex; } @@ -335,7 +335,7 @@ namespace System.IO if (position > Int64.MaxValue) { ArgumentException ex = new ArgumentException(SR.IO_CannotSeekBeyondInt64MaxValue); - ex.SetErrorCode(HResults.E_INVALIDARG); + ex.SetErrorCode(__HResults.E_INVALIDARG); throw ex; } @@ -400,7 +400,7 @@ namespace System.IO if (value > Int64.MaxValue) { ArgumentException ex = new ArgumentException(SR.IO_CannotSetSizeBeyondInt64MaxValue); - ex.SetErrorCode(HResults.E_INVALIDARG); + ex.SetErrorCode(__HResults.E_INVALIDARG); throw ex; } @@ -412,7 +412,7 @@ namespace System.IO if (!str.CanWrite) { InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_CannotSetStreamSizeCannotWrite); - ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL); + ex.SetErrorCode(__HResults.E_ILLEGAL_METHOD_CALL); throw ex; } @@ -441,7 +441,7 @@ namespace System.IO private static void ThrowCloningNotSupported(String methodName) { NotSupportedException nse = new NotSupportedException(SR.Format(SR.NotSupported_CloningNotSupported, methodName)); - nse.SetErrorCode(HResults.E_NOTIMPL); + nse.SetErrorCode(__HResults.E_NOTIMPL); throw nse; } diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/StreamOperationsImplementation.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/StreamOperationsImplementation.cs index 1664c81929..f751d4348d 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/StreamOperationsImplementation.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/IO/StreamOperationsImplementation.cs @@ -18,7 +18,7 @@ namespace System.IO /// we want the ReadAsync / WriteAsync / FlushAsync / etc. operation to be implemented /// differently. This is for best performance as we can take advantage of the specifics of particular stream /// types. For instance, ReadAsync currently has a special implementation for memory streams. - /// Moreover, knowledge about the actual runtime type of the IBuffer can also help chosing the optimal + /// Moreover, knowledge about the actual runtime type of the IBuffer can also help choosing the optimal /// implementation. This type provides static methods that encapsulate the performance logic and can be used /// by NetFxToWinRtStreamAdapter. internal static class StreamOperationsImplementation diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/HResults.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/HResults.cs index f1f0fce6fd..c131895da8 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/HResults.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/HResults.cs @@ -9,7 +9,7 @@ namespace System.Runtime.InteropServices /// /// HRESULT values used in this assembly. /// - internal static class HResults + internal static class __HResults { internal const Int32 S_OK = unchecked((Int32)0x00000000); internal const Int32 E_BOUNDS = unchecked((Int32)0x8000000B); diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/MarshalingHelpers.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/MarshalingHelpers.cs index 28af19341f..8fa8c7217a 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/MarshalingHelpers.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/MarshalingHelpers.cs @@ -182,7 +182,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void CollectionChanged.add(NotifyCollectionChangedEventHandler) add { - INotifyCollectionChanged_WinRT _this = JitHelpers.UnsafeCast(this); + INotifyCollectionChanged_WinRT _this = Unsafe.As(this); // call the WinRT eventing support in mscorlib to subscribe the event Func addMethod = @@ -196,7 +196,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void CollectionChanged.remove(NotifyCollectionChangedEventHandler) remove { - INotifyCollectionChanged_WinRT _this = JitHelpers.UnsafeCast(this); + INotifyCollectionChanged_WinRT _this = Unsafe.As(this); // call the WinRT eventing support in mscorlib to unsubscribe the event Action removeMethod = @@ -226,7 +226,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // EventRegistrationToken CollectionChanged.add(NotifyCollectionChangedEventHandler value) internal EventRegistrationToken add_CollectionChanged(NotifyCollectionChangedEventHandler value) { - INotifyCollectionChanged _this = JitHelpers.UnsafeCast(this); + INotifyCollectionChanged _this = Unsafe.As(this); EventRegistrationTokenTable table = s_weakTable.GetOrCreateValue(_this); EventRegistrationToken token = table.AddEventHandler(value); @@ -238,7 +238,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void CollectionChanged.remove(EventRegistrationToken token) internal void remove_CollectionChanged(EventRegistrationToken token) { - INotifyCollectionChanged _this = JitHelpers.UnsafeCast(this); + INotifyCollectionChanged _this = Unsafe.As(this); EventRegistrationTokenTable table = s_weakTable.GetOrCreateValue(_this); NotifyCollectionChangedEventHandler handler = table.ExtractHandler(token); @@ -264,7 +264,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void PropertyChanged.add(PropertyChangedEventHandler) add { - INotifyPropertyChanged_WinRT _this = JitHelpers.UnsafeCast(this); + INotifyPropertyChanged_WinRT _this = Unsafe.As(this); // call the WinRT eventing support in mscorlib to subscribe the event Func addMethod = @@ -278,7 +278,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void PropertyChanged.remove(PropertyChangedEventHandler) remove { - INotifyPropertyChanged_WinRT _this = JitHelpers.UnsafeCast(this); + INotifyPropertyChanged_WinRT _this = Unsafe.As(this); // call the WinRT eventing support in mscorlib to unsubscribe the event Action removeMethod = @@ -308,7 +308,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // EventRegistrationToken PropertyChanged.add(PropertyChangedEventHandler value) internal EventRegistrationToken add_PropertyChanged(PropertyChangedEventHandler value) { - INotifyPropertyChanged _this = JitHelpers.UnsafeCast(this); + INotifyPropertyChanged _this = Unsafe.As(this); EventRegistrationTokenTable table = s_weakTable.GetOrCreateValue(_this); EventRegistrationToken token = table.AddEventHandler(value); @@ -320,7 +320,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void PropertyChanged.remove(EventRegistrationToken token) internal void remove_PropertyChanged(EventRegistrationToken token) { - INotifyPropertyChanged _this = JitHelpers.UnsafeCast(this); + INotifyPropertyChanged _this = Unsafe.As(this); EventRegistrationTokenTable table = s_weakTable.GetOrCreateValue(_this); PropertyChangedEventHandler handler = table.ExtractHandler(token); @@ -350,7 +350,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void CanExecuteChanged.add(EventHandler) add { - ICommand_WinRT _this = JitHelpers.UnsafeCast(this); + ICommand_WinRT _this = Unsafe.As(this); // call the WinRT eventing support in mscorlib to subscribe the event Func, EventRegistrationToken> addMethod = @@ -367,7 +367,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void CanExecuteChanged.remove(EventHandler) remove { - ICommand_WinRT _this = JitHelpers.UnsafeCast(this); + ICommand_WinRT _this = Unsafe.As(this); // call the WinRT eventing support in mscorlib to unsubscribe the event Action removeMethod = @@ -384,13 +384,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime private bool CanExecute(object parameter) { - ICommand_WinRT _this = JitHelpers.UnsafeCast(this); + ICommand_WinRT _this = Unsafe.As(this); return _this.CanExecute(parameter); } private void Execute(object parameter) { - ICommand_WinRT _this = JitHelpers.UnsafeCast(this); + ICommand_WinRT _this = Unsafe.As(this); _this.Execute(parameter); } } @@ -415,7 +415,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // EventRegistrationToken PropertyChanged.add(EventHandler value) private EventRegistrationToken add_CanExecuteChanged(EventHandler value) { - ICommand _this = JitHelpers.UnsafeCast(this); + ICommand _this = Unsafe.As(this); EventRegistrationTokenTable table = s_weakTable.GetOrCreateValue(_this); EventHandler handler = ICommandAdapterHelpers.CreateWrapperHandler(value); @@ -428,7 +428,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // void PropertyChanged.remove(EventRegistrationToken token) private void remove_CanExecuteChanged(EventRegistrationToken token) { - ICommand _this = JitHelpers.UnsafeCast(this); + ICommand _this = Unsafe.As(this); EventRegistrationTokenTable table = s_weakTable.GetOrCreateValue(_this); EventHandler handler = table.ExtractHandler(token); @@ -440,13 +440,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime private bool CanExecute(object parameter) { - ICommand _this = JitHelpers.UnsafeCast(this); + ICommand _this = Unsafe.As(this); return _this.CanExecute(parameter); } private void Execute(object parameter) { - ICommand _this = JitHelpers.UnsafeCast(this); + ICommand _this = Unsafe.As(this); _this.Execute(parameter); } } diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBuffer.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBuffer.cs index 0c01d7ebd8..070b2b6adf 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBuffer.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBuffer.cs @@ -89,7 +89,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime Int32 hr = Interop.mincore.RoGetBufferMarshaler(out proxy); t_winRtMarshalProxy = proxy; - if (hr != HResults.S_OK) + if (hr != __HResults.S_OK) { Exception ex = new Exception(String.Format("{0} ({1}!RoGetBufferMarshaler)", SR.WinRtCOM_Error, WinTypesDLL)); ex.SetErrorCode(hr); @@ -242,7 +242,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (value > ((IBuffer)this).Capacity) { ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException(nameof(value), SR.Argument_BufferLengthExceedsCapacity); - ex.SetErrorCode(HResults.E_BOUNDS); + ex.SetErrorCode(__HResults.E_BOUNDS); throw ex; } diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferExtensions.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferExtensions.cs index 529bd2e4c6..5f588d11d7 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferExtensions.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferExtensions.cs @@ -12,7 +12,7 @@ using Windows.Storage.Streams; namespace System.Runtime.InteropServices.WindowsRuntime { /// - /// Contains a extension methods that expose operations on WinRT Windows.Foundation.IBuffer. + /// Contains extension methods that expose operations on WinRT Windows.Foundation.IBuffer. /// public static class WindowsRuntimeBufferExtensions { @@ -309,7 +309,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime /// - /// Checks if the underlying memory backing two IBuffer intances is actually the same memory. + /// Checks if the underlying memory backing two IBuffer instances is actually the same memory. /// When applied to IBuffer instances backed by managed arrays this method is preferable to a naive comparison /// (such as ((IBufferByteAccess) buffer).Buffer == ((IBufferByteAccess) otherBuffer).Buffer) because it avoids /// pinning the backing array which would be necessary if a direct memory pointer was obtained. diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/AsyncInfoIdGenerator.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/AsyncInfoIdGenerator.cs index d2008124b4..94f9b62222 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/AsyncInfoIdGenerator.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/AsyncInfoIdGenerator.cs @@ -20,7 +20,7 @@ namespace System.Threading.Tasks /// /// We want to avoid ending up with the same ID as a Windows-implemented async info. - /// At the same time we want to be reproducable. So we use a random generator with a fixed seed. + /// At the same time we want to be reproducible. So we use a random generator with a fixed seed. /// private static Random s_idGenerator = new Random(19830118); @@ -44,7 +44,7 @@ namespace System.Threading.Tasks /// Initialises the specified id to a unique Id-value that can be used for an IAsyncInfo object under the /// assumption that another thread may also attempt to initialise id. The thread that changes id /// first from AsyncInfoIdGenerator.InvalidId to another value wins and all other threads will respect that - /// choice and leave id unchanged. The method returns the Id that was ageed upon by the race. + /// choice and leave id unchanged. The method returns the Id that was agreed upon by the race. /// /// The IAsyncInfo ID to initialise. /// The unique value to which the specified reference target was initialised. diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/TaskToAsyncInfoAdapter.cs b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/TaskToAsyncInfoAdapter.cs index c1b8fc790e..9b9c8880b8 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/TaskToAsyncInfoAdapter.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/src/System/Threading/Tasks/TaskToAsyncInfoAdapter.cs @@ -77,7 +77,7 @@ namespace System.Threading.Tasks InvalidOperationException ex = (cause == null) ? new InvalidOperationException(SR.InvalidOperation_CannotGetResultsFromIncompleteOperation) : new InvalidOperationException(SR.InvalidOperation_CannotGetResultsFromIncompleteOperation, cause); - ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL); + ex.SetErrorCode(__HResults.E_ILLEGAL_METHOD_CALL); return ex; } @@ -92,7 +92,7 @@ namespace System.Threading.Tasks /// The async info's ID. InvalidAsyncId stands for not yet been initialised. private UInt32 _id = AsyncInfoIdGenerator.InvalidId; - /// The cached error code used to avoid creatung several exception objects if the ErrorCode + /// The cached error code used to avoid creating several exception objects if the ErrorCode /// property is accessed several times. null indicates either no error or that ErrorCode /// has not yet been called. private Exception _error = null; @@ -100,7 +100,7 @@ namespace System.Threading.Tasks /// The state of the async info. Interlocked operations are used to manipulate this field. private volatile Int32 _state = STATE_NOT_INITIALIZED; - /// For IAsyncInfo intances that completed synchronously (at creation time) this field holds the result; + /// For IAsyncInfo instances that completed synchronously (at creation time) this field holds the result; /// for instances backed by an actual Task, this field holds a reference to the task generated by the task generator. /// Since we always know which of the above is the case, we can always cast this field to TResult in the former case /// or to one of Task or Task{TResult} in the latter case. This approach allows us to save a field on all IAsyncInfos. @@ -114,7 +114,7 @@ namespace System.Threading.Tasks /// Registered progress handler. private TProgressHandler _progressHandler; - /// The synchronization context on which this instance was created/started. Used to callback invokations. + /// The synchronization context on which this instance was created/started. Used to callback invocations. private SynchronizationContext _startingContext; #endregion Instance variables @@ -397,7 +397,7 @@ namespace System.Threading.Tasks return; ObjectDisposedException ex = new ObjectDisposedException(SR.ObjectDisposed_AsyncInfoIsClosed); - ex.SetErrorCode(HResults.E_ILLEGAL_METHOD_CALL); + ex.SetErrorCode(__HResults.E_ILLEGAL_METHOD_CALL); throw ex; } @@ -857,7 +857,7 @@ namespace System.Threading.Tasks if (handlerBefore != null) { InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_CannotSetCompletionHanlderMoreThanOnce); - ex.SetErrorCode(HResults.E_ILLEGAL_DELEGATE_ASSIGNMENT); + ex.SetErrorCode(__HResults.E_ILLEGAL_DELEGATE_ASSIGNMENT); throw ex; } @@ -940,7 +940,7 @@ namespace System.Threading.Tasks if (0 != (_state & STATEMASK_SELECT_ANY_ASYNC_STATE)) { InvalidOperationException ex = new InvalidOperationException(SR.InvalidOperation_IllegalStateChange); - ex.SetErrorCode(HResults.E_ILLEGAL_STATE_CHANGE); + ex.SetErrorCode(__HResults.E_ILLEGAL_STATE_CHANGE); throw ex; } } @@ -981,7 +981,7 @@ namespace System.Threading.Tasks if (aggregateException == null) { error = new Exception(SR.WinRtCOM_Error); - error.SetErrorCode(HResults.E_FAIL); + error.SetErrorCode(__HResults.E_FAIL); } else { diff --git a/external/corefx/src/System.Runtime.WindowsRuntime/tests/System/IO/AsWinRTStreamTests.cs b/external/corefx/src/System.Runtime.WindowsRuntime/tests/System/IO/AsWinRTStreamTests.cs index 582f1348ca..7b6ad375b6 100644 --- a/external/corefx/src/System.Runtime.WindowsRuntime/tests/System/IO/AsWinRTStreamTests.cs +++ b/external/corefx/src/System.Runtime.WindowsRuntime/tests/System/IO/AsWinRTStreamTests.cs @@ -188,7 +188,7 @@ namespace System.IO // asyncReadOp.Id in a progress callback must match the ID of the asyncReadOp to which the callback was assigned Assert.Equal(readOpId, asyncReadOp.Id); - // asyncReadOp.Status must be 'Started' for a asyncReadOp in progress + // asyncReadOp.Status must be 'Started' for an asyncReadOp in progress Assert.Equal(AsyncStatus.Started, asyncReadOp.Status); // bytesCompleted must be in range [0, maxBytesToRead] asyncReadOp in progress @@ -322,7 +322,7 @@ namespace System.IO // asyncWriteOp.Id in a progress callback must match the ID of the asyncWriteOp to which the callback was assigned Assert.Equal(writeOpId, asyncWriteOp.Id); - // asyncWriteOp.Status must be 'Started' for a asyncWriteOp in progress + // asyncWriteOp.Status must be 'Started' for an asyncWriteOp in progress Assert.Equal(AsyncStatus.Started, asyncWriteOp.Status); // bytesCompleted must be in range [0, maxBytesToWrite] asyncWriteOp in progress diff --git a/external/corefx/src/System.Runtime/System.Runtime.sln b/external/corefx/src/System.Runtime/System.Runtime.sln index ef86ff7d3d..c4830a9773 100644 --- a/external/corefx/src/System.Runtime/System.Runtime.sln +++ b/external/corefx/src/System.Runtime/System.Runtime.sln @@ -7,6 +7,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Tests", "tes {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForwardedTypesAssembly", "tests\ForwardedTypesAssembly\ForwardedTypesAssembly.csproj", "{3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C}" + ProjectSection(ProjectDependencies) = postProject + {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime.Performance.Tests", "tests\Performance\System.Runtime.Performance.Tests.csproj", "{E9560F70-79F5-453A-B518-0292CFE4A6AD}" ProjectSection(ProjectDependencies) = postProject {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} @@ -27,6 +32,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Reflection.TestModul {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnloadableAssembly", "tests\UnloadableAssembly\UnloadableAssembly.csproj", "{CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B}" + ProjectSection(ProjectDependencies) = postProject + {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Runtime", "src\System.Runtime.csproj", "{56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}" ProjectSection(ProjectDependencies) = postProject {ADBCF120-3454-4A3C-9D1D-AC4293E795D6} = {ADBCF120-3454-4A3C-9D1D-AC4293E795D6} @@ -50,6 +60,10 @@ Global {B1BF7CE0-CAB5-4FA2-A39C-450B05D5DB1C}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU {B1BF7CE0-CAB5-4FA2-A39C-450B05D5DB1C}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU {B1BF7CE0-CAB5-4FA2-A39C-450B05D5DB1C}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {E9560F70-79F5-453A-B518-0292CFE4A6AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E9560F70-79F5-453A-B518-0292CFE4A6AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {E9560F70-79F5-453A-B518-0292CFE4A6AD}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -66,6 +80,10 @@ Global {3B7489C4-65DB-4E69-BE01-F6234133400C}.Debug|Any CPU.Build.0 = Debug|Any CPU {3B7489C4-65DB-4E69-BE01-F6234133400C}.Release|Any CPU.ActiveCfg = Release|Any CPU {3B7489C4-65DB-4E69-BE01-F6234133400C}.Release|Any CPU.Build.0 = Release|Any CPU + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU @@ -80,10 +98,12 @@ Global EndGlobalSection GlobalSection(NestedProjects) = preSolution {B1BF7CE0-CAB5-4FA2-A39C-450B05D5DB1C} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {E9560F70-79F5-453A-B518-0292CFE4A6AD} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {2EF7D710-A7BD-4BB3-8EF6-3F0298CD4986} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {71DE1A1F-F8E2-452A-9D54-0385F6099DD3} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {3B7489C4-65DB-4E69-BE01-F6234133400C} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {56B9D0A9-44D3-488E-8B42-C14A6E30CAB2} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} {ADBCF120-3454-4A3C-9D1D-AC4293E795D6} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} EndGlobalSection diff --git a/external/corefx/src/System.Runtime/ref/System.Runtime.cs.REMOVED.git-id b/external/corefx/src/System.Runtime/ref/System.Runtime.cs.REMOVED.git-id index 6b82ce8198..5927ecc76a 100644 --- a/external/corefx/src/System.Runtime/ref/System.Runtime.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime/ref/System.Runtime.cs.REMOVED.git-id @@ -1 +1 @@ -66b6b7572706dcddbefe15c1262bbdfe5abc549d \ No newline at end of file +c4a8cb2085a7ac4198b983266ce8af643adc23b8 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/ref/System.Runtime.csproj b/external/corefx/src/System.Runtime/ref/System.Runtime.csproj index 349f7efa20..2947fad3fe 100644 --- a/external/corefx/src/System.Runtime/ref/System.Runtime.csproj +++ b/external/corefx/src/System.Runtime/ref/System.Runtime.csproj @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Runtime/src/System.Runtime.Forwards.cs b/external/corefx/src/System.Runtime/src/System.Runtime.Forwards.cs deleted file mode 100644 index 8b18d3c491..0000000000 --- a/external/corefx/src/System.Runtime/src/System.Runtime.Forwards.cs +++ /dev/null @@ -1,6 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandle))] -[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.GCHandleType))] diff --git a/external/corefx/src/System.Runtime/src/System.Runtime.csproj b/external/corefx/src/System.Runtime/src/System.Runtime.csproj index 2b8f6a551a..9d633654fc 100644 --- a/external/corefx/src/System.Runtime/src/System.Runtime.csproj +++ b/external/corefx/src/System.Runtime/src/System.Runtime.csproj @@ -16,7 +16,6 @@ - diff --git a/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/Configurations.props b/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/ForwardedTypesAssembly.cs b/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/ForwardedTypesAssembly.cs new file mode 100644 index 0000000000..93234aff96 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/ForwardedTypesAssembly.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.CompilerServices; + +[assembly: TypeForwardedTo(typeof(object))] +[assembly: TypeForwardedTo(typeof(TypeInUnloadableAssembly))] + +public static class TypeInForwardedAssembly +{ + public class PublicInner + { + public class PublicInnerInner {} + protected class ProtectedInnerInner {} + internal class InternalInnerInner{} + private class PrivatelInnerInner{} + protected internal class ProjectedInternalInnerInner{} + } + + protected class ProtectedInner {} + internal class InternalInner{} + private class PrivatelInner{} + protected internal class ProjectedInternalInner{} +} + diff --git a/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/ForwardedTypesAssembly.csproj b/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/ForwardedTypesAssembly.csproj new file mode 100644 index 0000000000..b3396e95ed --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/ForwardedTypesAssembly/ForwardedTypesAssembly.csproj @@ -0,0 +1,26 @@ + + + + + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C} + true + + + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B} + UnloadableAssembly + + + + diff --git a/external/corefx/src/System.Runtime/tests/Performance/Configurations.props b/external/corefx/src/System.Runtime/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/tests/Performance/Perf.Double.cs b/external/corefx/src/System.Runtime/tests/Performance/Perf.Double.cs index 099cc6219e..4e8b9a20de 100644 --- a/external/corefx/src/System.Runtime/tests/Performance/Perf.Double.cs +++ b/external/corefx/src/System.Runtime/tests/Performance/Perf.Double.cs @@ -2,29 +2,134 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; using Microsoft.Xunit.Performance; +using Xunit; namespace System.Tests { public class Perf_Double { - public static readonly double dValue = 1.23456789E+5; + private volatile string _string; [Benchmark] - public static void Double_ToString() + [InlineData(104234.343, 1_000_000)] + [InlineData(double.MaxValue, 100_000)] + [InlineData(double.MinValue, 100_000)] + [InlineData(double.MinValue / 2, 100_000)] + [InlineData(double.NaN, 10_000_000)] + [InlineData(double.PositiveInfinity, 10_000_000)] + [InlineData(2.2250738585072009E-308, 100_000)] + public void DefaultToString(double number, int innerIterations) { foreach (var iteration in Benchmark.Iterations) + { using (iteration.StartMeasurement()) - dValue.ToString(); + { + for (int i = 0; i < innerIterations; i++) + { + _string = number.ToString(); + } + } + } } [Benchmark] + [InlineData("zh", 104234.343, 1_000_000)] + [InlineData("zh", double.MaxValue, 100_000)] + [InlineData("zh", double.MinValue, 100_000)] + [InlineData("zh", double.NaN, 20_000_000)] + [InlineData("zh", double.PositiveInfinity, 20_000_000)] + [InlineData("zh", 0.0, 4_000_000)] + public void ToStringWithCultureInfo(string cultureName, double number, int innerIterations) + { + CultureInfo cultureInfo = new CultureInfo(cultureName); + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterations; i++) + { + _string = number.ToString(cultureInfo); + } + } + } + } + + public static IEnumerable ToStringWithFormat_TestData() + { + string[] formats = + { + "R", + "G", + "G17", + "E", + "F50" + }; + + double[] normalTestValues = + { + 0.0, + 250.0, + }; + + double[] edgeTestValues = + { + double.MaxValue, + double.MinValue, + double.Epsilon, + }; + + foreach (string format in formats) + { + foreach (double testValue in normalTestValues) + { + yield return new object[] { format, testValue, 2_000_000 }; + } + + foreach (double testValue in edgeTestValues) + { + yield return new object[] { format, testValue, 100_000 }; + } + } + + yield return new object[] { "G", double.PositiveInfinity, 20_000_000 }; + yield return new object[] { "G", double.NaN, 20_000_000 }; + } + + [Benchmark] + [MemberData(nameof(ToStringWithFormat_TestData))] + public void ToStringWithFormat(string format, double number, int innerIterations) + { + foreach (var iteration in Benchmark.Iterations) + { + using (iteration.StartMeasurement()) + { + for (int i = 0; i < innerIterations; i++) + { + _string = number.ToString(format); + } + } + } + } + + [Benchmark(InnerIterationCount = 4_000_000)] public static void Decimal_ToString() { - decimal decimalNum = new decimal(dValue); + decimal decimalNum = new decimal(1.23456789E+5); foreach (var iteration in Benchmark.Iterations) + { using (iteration.StartMeasurement()) - decimalNum.ToString(); + { + for (int i = 0; i < Benchmark.InnerIterationCount; i++) + { + decimalNum.ToString(); + } + } + } } } } diff --git a/external/corefx/src/System.Runtime/tests/System.Runtime.Tests.csproj b/external/corefx/src/System.Runtime/tests/System.Runtime.Tests.csproj index 3d7021a239..3e24ee11aa 100644 --- a/external/corefx/src/System.Runtime/tests/System.Runtime.Tests.csproj +++ b/external/corefx/src/System.Runtime/tests/System.Runtime.Tests.csproj @@ -112,6 +112,7 @@ + @@ -172,28 +173,40 @@ Common\System\RandomDataGenerator.cs - - Common\System\PlatformDetection.cs - + + + + + + + + + + + + + + + @@ -201,6 +214,10 @@ + + + + @@ -231,6 +248,14 @@ {9F312D76-9AF1-4E90-B3B0-815A1EC6C346} TestLoadAssembly + + {3A3DE9F8-6295-4B68-BAAB-406F1CA0CD9C} + ForwardedTypesAssembly + + + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B} + UnloadableAssembly + diff --git a/external/corefx/src/System.Runtime/tests/System/ActivatorTests.cs b/external/corefx/src/System.Runtime/tests/System/ActivatorTests.cs index 57c4312960..81a4b64275 100644 --- a/external/corefx/src/System.Runtime/tests/System/ActivatorTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/ActivatorTests.cs @@ -308,7 +308,7 @@ namespace System.Tests public static bool Equal(int i) { return cnt == i; } } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsInvokingStaticConstructorsSupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsInvokingStaticConstructorsSupported))] static void TestingBindingFlags() { Assert.Throws(() => Activator.CreateInstance(typeof(ClassWithPrivateCtor), BindingFlags.Public | BindingFlags.Instance, null, null, CultureInfo.CurrentCulture)); diff --git a/external/corefx/src/System.Runtime/tests/System/ArrayTests.cs.REMOVED.git-id b/external/corefx/src/System.Runtime/tests/System/ArrayTests.cs.REMOVED.git-id index a0438cca5c..f1b60ee878 100644 --- a/external/corefx/src/System.Runtime/tests/System/ArrayTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime/tests/System/ArrayTests.cs.REMOVED.git-id @@ -1 +1 @@ -b22bcf41b54ea09a8520935e3472cd56bb44d7f1 \ No newline at end of file +3a677e75cd4698a0b53bfc928e2564c681ccd674 \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/tests/System/AttributeTests.cs b/external/corefx/src/System.Runtime/tests/System/AttributeTests.cs index 8dcb41b81d..2c166d1cb0 100644 --- a/external/corefx/src/System.Runtime/tests/System/AttributeTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/AttributeTests.cs @@ -109,7 +109,7 @@ namespace System.Tests // The implementation of Attribute.GetHashCode uses reflection to // enumerate fields. On .NET core, we add `BindingFlags.DeclaredOnly` - // to fix a bug where the hash code of a a subclass of an attribute can + // to fix a bug where the hash code of a subclass of an attribute can // be equal to an instance of the parent class. // See https://github.com/dotnet/coreclr/pull/6240 Assert.Equal(PlatformDetection.IsFullFramework, s1.GetHashCode().Equals(s2.GetHashCode())); diff --git a/external/corefx/src/System.Runtime/tests/System/BooleanTests.cs b/external/corefx/src/System.Runtime/tests/System/BooleanTests.cs index d4d02c9055..ea5e51773c 100644 --- a/external/corefx/src/System.Runtime/tests/System/BooleanTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/BooleanTests.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; using Xunit; namespace System.Tests { - public class BooleanTests + public partial class BooleanTests { [Fact] public void TrueString_Get_ReturnsTrue() @@ -20,21 +21,26 @@ namespace System.Tests Assert.Equal("False", bool.FalseString); } + public static IEnumerable Parse_Valid_TestData() + { + yield return new object[] { "True", true }; + yield return new object[] { "true", true }; + yield return new object[] { "TRUE", true }; + yield return new object[] { "tRuE", true }; + yield return new object[] { " True ", true }; + yield return new object[] { "True\0", true }; + yield return new object[] { " \0 \0 True \0 ", true }; + yield return new object[] { "False", false }; + yield return new object[] { "false", false }; + yield return new object[] { "FALSE", false }; + yield return new object[] { "fAlSe", false }; + yield return new object[] { "False ", false }; + yield return new object[] { "False\0", false }; + yield return new object[] { " False \0\0\0 ", false }; + } + [Theory] - [InlineData("True", true)] - [InlineData("true", true)] - [InlineData("TRUE", true)] - [InlineData("tRuE", true)] - [InlineData(" True ", true)] - [InlineData("True\0", true)] - [InlineData(" \0 \0 True \0 ", true)] - [InlineData("False", false)] - [InlineData("false", false)] - [InlineData("FALSE", false)] - [InlineData("fAlSe", false)] - [InlineData("False ", false)] - [InlineData("False\0", false)] - [InlineData(" False \0\0\0 ", false)] + [MemberData(nameof(Parse_Valid_TestData))] public void Parse_ValidValue_ReturnsExpected(string value, bool expected) { Assert.True(bool.TryParse(value, out bool result)); @@ -43,20 +49,25 @@ namespace System.Tests Assert.Equal(expected, bool.Parse(value)); } + public static IEnumerable Parse_Invalid_TestData() + { + yield return new object[] { null, typeof(ArgumentNullException) }; + yield return new object[] { "", typeof(FormatException) }; + yield return new object[] { " ", typeof(FormatException) }; + yield return new object[] { "Garbage", typeof(FormatException) }; + yield return new object[] { "True\0Garbage", typeof(FormatException) }; + yield return new object[] { "True\0True", typeof(FormatException) }; + yield return new object[] { "True True", typeof(FormatException) }; + yield return new object[] { "True False", typeof(FormatException) }; + yield return new object[] { "False True", typeof(FormatException) }; + yield return new object[] { "Fa lse", typeof(FormatException) }; + yield return new object[] { "T", typeof(FormatException) }; + yield return new object[] { "0", typeof(FormatException) }; + yield return new object[] { "1", typeof(FormatException) }; + } + [Theory] - [InlineData(null, typeof(ArgumentNullException))] - [InlineData("", typeof(FormatException))] - [InlineData(" ", typeof(FormatException))] - [InlineData("Garbage", typeof(FormatException))] - [InlineData("True\0Garbage", typeof(FormatException))] - [InlineData("True\0True", typeof(FormatException))] - [InlineData("True True", typeof(FormatException))] - [InlineData("True False", typeof(FormatException))] - [InlineData("False True", typeof(FormatException))] - [InlineData("Fa lse", typeof(FormatException))] - [InlineData("T", typeof(FormatException))] - [InlineData("0", typeof(FormatException))] - [InlineData("1", typeof(FormatException))] + [MemberData(nameof(Parse_Invalid_TestData))] public void Parse_InvalidValue_ThrowsException(string value, Type exceptionType) { Assert.Throws(exceptionType, () => bool.Parse(value)); diff --git a/external/corefx/src/System.Runtime/tests/System/BooleanTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/BooleanTests.netcoreapp.cs new file mode 100644 index 0000000000..195c8c8f15 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/BooleanTests.netcoreapp.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Tests +{ + public partial class BooleanTests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, bool expected) + { + Assert.Equal(expected, bool.Parse(value.AsReadOnlySpan())); + + Assert.True(bool.TryParse(value.AsReadOnlySpan(), out bool result)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => bool.Parse(value.AsReadOnlySpan())); + + Assert.False(bool.TryParse(value.AsReadOnlySpan(), out bool result)); + Assert.Equal(false, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/ByteTests.cs b/external/corefx/src/System.Runtime/tests/System/ByteTests.cs index 0068338b80..d917c8d8f8 100644 --- a/external/corefx/src/System.Runtime/tests/System/ByteTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/ByteTests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class ByteTests + public partial class ByteTests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/ByteTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/ByteTests.netcoreapp.cs new file mode 100644 index 0000000000..027f3771ca --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/ByteTests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class ByteTests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, byte expected) + { + Assert.Equal(expected, byte.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(byte.TryParse(value.AsReadOnlySpan(), out byte result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => byte.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(byte.TryParse(value.AsReadOnlySpan(), out byte result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/DateTimeTests.cs b/external/corefx/src/System.Runtime/tests/System/DateTimeTests.cs index f33b1f8ac5..f6d97d3b32 100644 --- a/external/corefx/src/System.Runtime/tests/System/DateTimeTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/DateTimeTests.cs @@ -551,9 +551,65 @@ namespace System.Tests } [Fact] - public static void Parse_NullString_ThrowsArgumentNullException() + public static void Parse_InvalidArguments_Throws() { + AssertExtensions.Throws("s", () => DateTime.Parse(null)); + AssertExtensions.Throws("s", () => DateTime.Parse(null, new MyFormatter())); AssertExtensions.Throws("s", () => DateTime.Parse(null, new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + + Assert.Throws(() => DateTime.Parse("")); + Assert.Throws(() => DateTime.Parse("", new MyFormatter())); + Assert.Throws(() => DateTime.Parse("", new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + public static void TryParse_NullOrEmptyString_ReturnsFalse(string input) + { + Assert.False(DateTime.TryParse(input, out DateTime result)); + Assert.False(DateTime.TryParse(input, new MyFormatter(), DateTimeStyles.None, out result)); + } + + [Fact] + public static void ParseExact_InvalidArguments_Throws() + { + AssertExtensions.Throws("s", () => DateTime.ParseExact(null, "d", new MyFormatter())); + AssertExtensions.Throws("s", () => DateTime.ParseExact(null, "d", new MyFormatter(), DateTimeStyles.None)); + AssertExtensions.Throws("s", () => DateTime.ParseExact(null, new[] { "d" }, new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + + Assert.Throws(() => DateTime.ParseExact("", "d", new MyFormatter())); + Assert.Throws(() => DateTime.ParseExact("", "d", new MyFormatter(), DateTimeStyles.None)); + Assert.Throws(() => DateTime.ParseExact("", new[] { "d" }, new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + + AssertExtensions.Throws("format", () => DateTime.ParseExact("123", null, new MyFormatter())); + AssertExtensions.Throws("format", () => DateTime.ParseExact("123", (string)null, new MyFormatter(), DateTimeStyles.None)); + AssertExtensions.Throws("formats", () => DateTime.ParseExact("123", (string[])null, new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + + Assert.Throws(() => DateTime.ParseExact("123", "", new MyFormatter())); + Assert.Throws(() => DateTime.ParseExact("123", "", new MyFormatter(), DateTimeStyles.None)); + Assert.Throws(() => DateTime.ParseExact("123", new string[0], new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + Assert.Throws(() => DateTime.ParseExact("123", new string[] { null }, new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + Assert.Throws(() => DateTime.ParseExact("123", new[] { "" }, new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); + } + + [Fact] + public static void TryParseExact_InvalidArguments_ReturnsFalse() + { + Assert.False(DateTime.TryParseExact(null, "d", new MyFormatter(), DateTimeStyles.None, out DateTime result)); + Assert.False(DateTime.TryParseExact(null, new[] { "d" }, new MyFormatter(), DateTimeStyles.None, out result)); + + Assert.False(DateTime.TryParseExact("", "d", new MyFormatter(), DateTimeStyles.None, out result)); + Assert.False(DateTime.TryParseExact("", new[] { "d" }, new MyFormatter(), DateTimeStyles.None, out result)); + + Assert.False(DateTime.TryParseExact("abc", (string)null, new MyFormatter(), DateTimeStyles.None, out result)); + Assert.False(DateTime.TryParseExact("abc", (string[])null, new MyFormatter(), DateTimeStyles.None, out result)); + + Assert.False(DateTime.TryParseExact("abc", "", new MyFormatter(), DateTimeStyles.None, out result)); + Assert.False(DateTime.TryParseExact("abc", new string[0], new MyFormatter(), DateTimeStyles.None, out result)); + Assert.False(DateTime.TryParseExact("abc", new string[] { null }, new MyFormatter(), DateTimeStyles.None, out result)); + Assert.False(DateTime.TryParseExact("abc", new[] { "" }, new MyFormatter(), DateTimeStyles.None, out result)); + Assert.False(DateTime.TryParseExact("abc", new[] { "" }, new MyFormatter(), DateTimeStyles.None, out result)); } [Fact] @@ -625,45 +681,69 @@ namespace System.Tests Assert.Equal(0, result.Second); } - [Fact] - public static void ParseExact_String_String_FormatProvider() + public static IEnumerable StandardFormatSpecifiers() { - DateTime expected = DateTime.MaxValue; - string expectedString = expected.ToString("G"); - - DateTime result = DateTime.ParseExact(expectedString, "G", null); - Assert.Equal(expectedString, result.ToString("G")); - } - - [Fact] - public static void ParseExact_String_String_FormatProvider_DateTimeStyles_U() - { - DateTime expected = DateTime.MaxValue; - string expectedString = expected.ToString("u"); - - DateTime result = DateTime.ParseExact(expectedString, "u", null, DateTimeStyles.None); - Assert.Equal(expectedString, result.ToString("u")); - } - - [Fact] - public static void ParseExact_String_String_FormatProvider_DateTimeStyles_G() - { - DateTime expected = DateTime.MaxValue; - string expectedString = expected.ToString("g"); - - DateTime result = DateTime.ParseExact(expectedString, "g", null, DateTimeStyles.None); - Assert.Equal(expectedString, result.ToString("g")); + yield return new object[] { "d" }; + yield return new object[] { "D" }; + yield return new object[] { "f" }; + yield return new object[] { "F" }; + yield return new object[] { "g" }; + yield return new object[] { "G" }; + yield return new object[] { "m" }; + yield return new object[] { "M" }; + yield return new object[] { "o" }; + yield return new object[] { "O" }; + yield return new object[] { "r" }; + yield return new object[] { "R" }; + yield return new object[] { "s" }; + yield return new object[] { "t" }; + yield return new object[] { "T" }; + yield return new object[] { "u" }; + yield return new object[] { "U" }; + yield return new object[] { "y" }; + yield return new object[] { "Y" }; } [Theory] - [MemberData(nameof(Format_String_TestData_O))] - public static void ParseExact_String_String_FormatProvider_DateTimeStyles_O(DateTime dt, string expected) + [MemberData(nameof(StandardFormatSpecifiers))] + public static void ParseExact_ToStringThenParseExactRoundtrip_Success(string standardFormat) { - string actual = dt.ToString("o"); - Assert.Equal(expected, actual); + DateTime dt = DateTime.Now; + string expected = dt.ToString(standardFormat); - DateTime result = DateTime.ParseExact(actual, "o", null, DateTimeStyles.None); - Assert.Equal(expected, result.ToString("o")); + Assert.Equal(expected, DateTime.ParseExact(expected, standardFormat, null).ToString(standardFormat)); + Assert.Equal(expected, DateTime.ParseExact(expected, standardFormat, null, DateTimeStyles.None).ToString(standardFormat)); + Assert.Equal(expected, DateTime.ParseExact(expected, new[] { standardFormat }, null, DateTimeStyles.None).ToString(standardFormat)); + + Assert.True(DateTime.TryParseExact(expected, standardFormat, null, DateTimeStyles.None, out DateTime actual)); + Assert.Equal(expected, actual.ToString(standardFormat)); + Assert.True(DateTime.TryParseExact(expected, new[] { standardFormat }, null, DateTimeStyles.None, out actual)); + Assert.Equal(expected, actual.ToString(standardFormat)); + + // Should also parse with Parse, though may not round trip exactly + DateTime.Parse(expected); + } + + public static IEnumerable InvalidFormatSpecifierRoundtripPairs() + { + yield return new object[] { "d", "f" }; + yield return new object[] { "o", "r" }; + yield return new object[] { "u", "y" }; + } + + [Theory] + [MemberData(nameof(InvalidFormatSpecifierRoundtripPairs))] + public static void ParseExact_ToStringThenParseExact_RoundtripWithOtherFormat_Fails(string toStringFormat, string parseFormat) + { + DateTime dt = DateTime.Now; + string expected = dt.ToString(toStringFormat); + + Assert.Throws(() => DateTime.ParseExact(expected, parseFormat, null)); + Assert.Throws(() => DateTime.ParseExact(expected, parseFormat, null, DateTimeStyles.None)); + Assert.Throws(() => DateTime.ParseExact(expected, new[] { parseFormat }, null, DateTimeStyles.None)); + + Assert.False(DateTime.TryParseExact(expected, parseFormat, null, DateTimeStyles.None, out DateTime result)); + Assert.False(DateTime.TryParseExact(expected, new[] { parseFormat }, null, DateTimeStyles.None, out result)); } public static IEnumerable Format_String_TestData_O() @@ -691,16 +771,6 @@ namespace System.Tests yield return new object[] { new DateTime(1906, 8, 15, 7, 24, 5, 300), "Wed, 15 Aug 1906 07:24:05 GMT" }; } - [Fact] - public static void ParseExact_String_String_FormatProvider_DateTimeStyles_R() - { - DateTime expected = DateTime.MaxValue; - string expectedString = expected.ToString("r"); - - DateTime result = DateTime.ParseExact(expectedString, "r", null, DateTimeStyles.None); - Assert.Equal(expectedString, result.ToString("r")); - } - [Fact] public static void ParseExact_String_String_FormatProvider_DateTimeStyles_CustomFormatProvider() { @@ -896,5 +966,160 @@ namespace System.Tests DateTimeStyles style = DateTimeStyles.AssumeLocal | DateTimeStyles.AssumeUniversal; AssertExtensions.Throws("style", () => DateTime.ParseExact(strDateTime, formats, provider, style)); } + + public static IEnumerable Parse_ValidInput_Suceeds_MemberData() + { + yield return new object[] { "1234 12", CultureInfo.InvariantCulture, new DateTime(1234, 12, 1, 0, 0, 0) }; + yield return new object[] { "12 1234", CultureInfo.InvariantCulture, new DateTime(1234, 12, 1, 0, 0, 0) }; + yield return new object[] { "12 1234 11", CultureInfo.InvariantCulture, new DateTime(1234, 12, 11, 0, 0, 0) }; + yield return new object[] { "1234 12 13", CultureInfo.InvariantCulture, new DateTime(1234, 12, 13, 0, 0, 0) }; + yield return new object[] { "12 13 1234", CultureInfo.InvariantCulture, new DateTime(1234, 12, 13, 0, 0, 0) }; + yield return new object[] { "1 1 1", CultureInfo.InvariantCulture, new DateTime(2001, 1, 1, 0, 0, 0) }; + yield return new object[] { "2 2 2Z", CultureInfo.InvariantCulture, TimeZoneInfo.ConvertTimeFromUtc(new DateTime(2002, 2, 2, 0, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Local) }; + yield return new object[] { "#10/10/2095#\0", CultureInfo.InvariantCulture, new DateTime(2095, 10, 10, 0, 0, 0) }; + + DateTime today = DateTime.Today; + var hebrewCulture = new CultureInfo("he-IL"); + hebrewCulture.DateTimeFormat.Calendar = new HebrewCalendar(); + yield return new object[] { today.ToString(hebrewCulture), hebrewCulture, today }; + + var mongolianCulture = new CultureInfo("mn-MN"); + yield return new object[] { today.ToString(mongolianCulture), mongolianCulture, today }; + } + + [Theory] + [MemberData(nameof(Parse_ValidInput_Suceeds_MemberData))] + public static void Parse_ValidInput_Suceeds(string input, CultureInfo culture, DateTime? expected) + { + Assert.Equal(expected, DateTime.Parse(input, culture)); + } + + public static IEnumerable ParseExact_ValidInput_Succeeds_MemberData() + { + yield return new object[] { "9", "%d", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(DateTime.Now.Year, 1, 9, 0, 0, 0) }; + yield return new object[] { "15", "dd", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(DateTime.Now.Year, 1, 15, 0, 0, 0) }; + + yield return new object[] { "9", "%M", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(DateTime.Now.Year, 9, 1, 0, 0, 0) }; + yield return new object[] { "09", "MM", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(DateTime.Now.Year, 9, 1, 0, 0, 0) }; + yield return new object[] { "Sep", "MMM", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(DateTime.Now.Year, 9, 1, 0, 0, 0) }; + yield return new object[] { "September", "MMMM", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(DateTime.Now.Year, 9, 1, 0, 0, 0) }; + + yield return new object[] { "1", "%y", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(2001, 1, 1, 0, 0, 0) }; + yield return new object[] { "01", "yy", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(2001, 1, 1, 0, 0, 0) }; + yield return new object[] { "2001", "yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(2001, 1, 1, 0, 0, 0) }; + + yield return new object[] { "3", "%H", CultureInfo.InvariantCulture, DateTimeStyles.None, DateTime.Today + TimeSpan.FromHours(3) }; + yield return new object[] { "03", "HH", CultureInfo.InvariantCulture, DateTimeStyles.None, DateTime.Today + TimeSpan.FromHours(3) }; + + yield return new object[] { "3A", "ht", CultureInfo.InvariantCulture, DateTimeStyles.None, DateTime.Today + TimeSpan.FromHours(3) }; + yield return new object[] { "03A", "hht", CultureInfo.InvariantCulture, DateTimeStyles.None, DateTime.Today + TimeSpan.FromHours(3) }; + yield return new object[] { "3P", "ht", CultureInfo.InvariantCulture, DateTimeStyles.None, DateTime.Today + TimeSpan.FromHours(12 + 3) }; + yield return new object[] { "03P", "hht", CultureInfo.InvariantCulture, DateTimeStyles.None, DateTime.Today + TimeSpan.FromHours(12 + 3) }; + + yield return new object[] { "2017-10-11 01:23:45Z", "u", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(2017, 10, 11, 1, 23, 45) }; + yield return new object[] { "9/8/2017 10:11:12 AM", "M/d/yyyy HH':'mm':'ss tt", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(2017, 9, 8, 10, 11, 12) }; + yield return new object[] { "9/8/2017 20:11:12 PM", "M/d/yyyy HH':'mm':'ss tt", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(2017, 9, 8, 20, 11, 12) }; + yield return new object[] { "Fri, 08 Sep 2017 11:18:19 -0000", "ddd, d MMM yyyy H:m:s zzz", new CultureInfo("en-US"), DateTimeStyles.AllowInnerWhite, new DateTime(2017, 9, 8, 11, 18, 19, DateTimeKind.Utc) }; + yield return new object[] { "1234-05-06T07:00:00.8Z", "yyyy-MM-dd'T'HH:mm:ss.FFF'Z'", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(1234, 5, 6, 7, 0, 0, 800) }; + yield return new object[] { "1234-05-06T07:00:00Z", "yyyy-MM-dd'T'HH:mm:ss.FFF'Z'", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(1234, 5, 6, 7, 0, 0, 0) }; + yield return new object[] { "1234-05-06T07:00:00Z", "yyyy-MM-dd'T'HH:mm:ssFFF'Z'", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(1234, 5, 6, 7, 0, 0, 0) }; + yield return new object[] { "1234-05-06T07:00:00Z", "yyyy-MM-dd'T'HH:mm:ssFFF'Z'", CultureInfo.InvariantCulture, DateTimeStyles.None, new DateTime(1234, 5, 6, 7, 0, 0, 0) }; + yield return new object[] { "1234-05-06T07:00:00Z", "yyyy-MM-dd'T'HH:mm:ssFFFZ", CultureInfo.InvariantCulture, DateTimeStyles.None, TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1234, 5, 6, 7, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Local) }; + yield return new object[] { "1234-05-06T07:00:00GMT", "yyyy-MM-dd'T'HH:mm:ssFFFZ", CultureInfo.InvariantCulture, DateTimeStyles.None, TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1234, 5, 6, 7, 0, 0, DateTimeKind.Utc), TimeZoneInfo.Local) }; + + var hebrewCulture = new CultureInfo("he-IL"); + hebrewCulture.DateTimeFormat.Calendar = new HebrewCalendar(); + DateTime today = DateTime.Today; + foreach (string pattern in hebrewCulture.DateTimeFormat.GetAllDateTimePatterns()) + { + yield return new object[] { today.ToString(pattern, hebrewCulture), pattern, hebrewCulture, DateTimeStyles.None, null }; + } + } + + [Theory] + [MemberData(nameof(ParseExact_ValidInput_Succeeds_MemberData))] + public static void ParseExact_ValidInput_Succeeds(string input, string format, CultureInfo culture, DateTimeStyles style, DateTime? expected) + { + DateTime result1 = DateTime.ParseExact(input, format, culture, style); + DateTime result2 = DateTime.ParseExact(input, new[] { format }, culture, style); + + Assert.True(DateTime.TryParseExact(input, format, culture, style, out DateTime result3)); + Assert.True(DateTime.TryParseExact(input, new[] { format }, culture, style, out DateTime result4)); + + Assert.Equal(result1, result2); + Assert.Equal(result1, result3); + Assert.Equal(result1, result4); + + if (expected != null) // some inputs don't roundtrip well + { + // Normalize values to make comparison easier + if (expected.Value.Kind != DateTimeKind.Utc) + { + expected = expected.Value.ToUniversalTime(); + } + if (result1.Kind != DateTimeKind.Utc) + { + result1 = result1.ToUniversalTime(); + } + + Assert.Equal(expected, result1); + } + } + + public static IEnumerable ParseExact_InvalidInputs_Fail_MemberData() + { + yield return new object[] { "6/28/2004 13:00:00 AM", "M/d/yyyy HH':'mm':'ss tt", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "6/28/2004 03:00:00 PM", "M/d/yyyy HH':'mm':'ss tt", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "dd", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "99", "dd", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123", "dd", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "mm", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "99", "mm", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123", "mm", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "ss", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "99", "ss", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123", "ss", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "MM", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "99", "MM", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "Fep", "MMM", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "Jantember", "MMMM", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "123", "YY", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "12345", "YYYY", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "HH", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "99", "HH", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123", "HH", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "hh", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "99", "hh", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123", "hh", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "1", "ff", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123", "ff", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "123456", "fffff", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "1234", "fffff", CultureInfo.InvariantCulture, DateTimeStyles.None }; + + yield return new object[] { "AM", "t", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "PM", "t", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "PM", "ttt", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "AAM", "tt", CultureInfo.InvariantCulture, DateTimeStyles.None }; + yield return new object[] { "CM", "tt", CultureInfo.InvariantCulture, DateTimeStyles.None }; + } + + [Theory] + [MemberData(nameof(ParseExact_InvalidInputs_Fail_MemberData))] + public static void ParseExact_InvalidInputs_Fail(string input, string format, CultureInfo culture, DateTimeStyles style) + { + Assert.Throws(() => DateTime.ParseExact(input, format, culture, style)); + Assert.Throws(() => DateTime.ParseExact(input, new[] { format }, culture, style)); + + Assert.False(DateTime.TryParseExact(input, format, culture, style, out DateTime result)); + Assert.False(DateTime.TryParseExact(input, new[] { format }, culture, style, out result)); + } } } diff --git a/external/corefx/src/System.Runtime/tests/System/DecimalTests.cs b/external/corefx/src/System.Runtime/tests/System/DecimalTests.cs index 1c7738a8ac..ce30b774fd 100644 --- a/external/corefx/src/System.Runtime/tests/System/DecimalTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/DecimalTests.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Linq; +using System.Numerics; using Xunit; namespace System.Tests @@ -1293,5 +1295,388 @@ namespace System.Tests { Assert.Equal(expected, --d); } + + public static class BigIntegerCompare + { + [Fact] + public static void Test() + { + decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals); + for (int i = 0; i < decimalValues.Length; i++) + { + decimal d1 = decimalValues[i]; + BigDecimal b1 = bigDecimals[i]; + for (int j = 0; j < decimalValues.Length; j++) + { + decimal d2 = decimalValues[j]; + int expected = b1.CompareTo(bigDecimals[j]); + int actual = d1.CompareTo(d2); + if (expected != actual) + throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " CMP " + d2); + } + } + } + } + + public static class BigIntegerAdd + { + [Fact] + public static void Test() + { + int overflowBudget = 1000; + decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals); + for (int i = 0; i < decimalValues.Length; i++) + { + decimal d1 = decimalValues[i]; + BigDecimal b1 = bigDecimals[i]; + for (int j = 0; j < decimalValues.Length; j++) + { + decimal d2 = decimalValues[j]; + BigDecimal expected = b1.Add(bigDecimals[j], out bool expectedOverflow); + if (expectedOverflow) + { + if (--overflowBudget < 0) + continue; + try + { + decimal actual = d1 + d2; + throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " + " + d2); + } + catch (OverflowException) { } + } + else + unsafe + { + decimal actual = d1 + d2; + if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0) + throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " + " + d2); + } + } + } + } + } + + public static class BigIntegerMul + { + [Fact] + public static void Test() + { + int overflowBudget = 1000; + decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals); + for (int i = 0; i < decimalValues.Length; i++) + { + decimal d1 = decimalValues[i]; + BigDecimal b1 = bigDecimals[i]; + for (int j = 0; j < decimalValues.Length; j++) + { + decimal d2 = decimalValues[j]; + BigDecimal expected = b1.Mul(bigDecimals[j], out bool expectedOverflow); + if (expectedOverflow) + { + if (--overflowBudget < 0) + continue; + try + { + decimal actual = d1 * d2; + throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " * " + d2); + } + catch (OverflowException) { } + } + else + unsafe + { + decimal actual = d1 * d2; + if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0) + throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " * " + d2); + } + } + } + } + } + + public static class BigIntegerDiv + { + [Fact] + public static void Test() + { + int overflowBudget = 1000; + decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals); + for (int i = 0; i < decimalValues.Length; i++) + { + decimal d1 = decimalValues[i]; + BigDecimal b1 = bigDecimals[i]; + for (int j = 0; j < decimalValues.Length; j++) + { + decimal d2 = decimalValues[j]; + if (Math.Sign(d2) == 0) + continue; + BigDecimal expected = b1.Div(bigDecimals[j], out bool expectedOverflow); + if (expectedOverflow) + { + if (--overflowBudget < 0) + continue; + try + { + decimal actual = d1 / d2; + throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " / " + d2); + } + catch (OverflowException) { } + } + else + unsafe + { + decimal actual = d1 / d2; + if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0) + throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " / " + d2); + } + } + } + } + } + + static decimal[] GetRandomData(out BigDecimal[] bigDecimals) + { + // some static data to test the limits + var list = new List { new decimal(0, 0, 0, true, 0), decimal.Zero, decimal.MinusOne, decimal.One, decimal.MinValue, decimal.MaxValue, + new decimal(1, 0, 0, true, 28), new decimal(1, 0, 0, false, 28), + new decimal(123877878, -16789245, 1086421879, true, 16), new decimal(527635459, -80701438, 1767087216, true, 24), new decimal(253511426, -909347550, -753557281, false, 12) }; + + // ~1000 different random decimals covering every scale and sign with ~20 different bitpatterns each + var rnd = new Random(42); + var unique = new HashSet(); + for (byte scale = 0; scale <= 28; scale++) + for (int sign = 0; sign <= 1; sign++) + for (int high = 0; high <= 96; high = IncBitLimits(high)) + for (int low = 0; low < high || (high | low) == 0; low = IncBitLimits(high)) + { + var d = new decimal(GetDigits(low, high), GetDigits(low - 32, high - 32), GetDigits(low - 64, high - 64), sign != 0, scale); + if (!unique.Add(d.ToString(CultureInfo.InvariantCulture))) + continue; // skip duplicates + list.Add(d); + } + decimal[] decimalValues = list.ToArray(); + bigDecimals = Array.ConvertAll(decimalValues, d => new BigDecimal(d)); + return decimalValues; + + // While the decimals are random in general, + // they are particularly focused on numbers starting or ending at bits 0-3, 30-34, 62-66, 94-96 to focus more on the corner cases around uint32 boundaries. + int IncBitLimits(int i) + { + switch (i) + { + case 3: + return 30; + case 34: + return 62; + case 66: + return 94; + default: + return i + 1; + } + } + + // Generates a random number, only bits between low and high can be set. + int GetDigits(int low, int high) + { + if (high <= 0 || low >= 32) + return 0; + uint res = 0; + if (high <= 32) + res = 1u << (high - 1); + res |= (uint)Math.Ceiling((uint.MaxValue >> Math.Max(0, 32 - high)) * rnd.NextDouble()); + if (low > 0) + res = (res >> low) << low; + return (int)res; + } + } + + /// + /// Decimal implementation roughly based on the oleaut32 native decimal code (especially ScaleResult), but optimized for simplicity instead of speed + /// + struct BigDecimal + { + public readonly BigInteger Integer; + public readonly byte Scale; + + public unsafe BigDecimal(decimal value) + { + Scale = (byte)(*(uint*)&value >> ScaleShift); + *(uint*)&value &= ~ScaleMask; + Integer = new BigInteger(value); + } + + private const uint ScaleMask = 0x00FF0000; + public const int ScaleShift = 16; + + public override string ToString() + { + if (Scale == 0) + return Integer.ToString(); + var s = Integer.ToString("D" + (Scale + 1)); + return s.Insert(s.Length - Scale, "."); + } + + BigDecimal(BigInteger integer, byte scale) + { + Integer = integer; + Scale = scale; + } + + static readonly BigInteger[] Pow10 = Enumerable.Range(0, 60).Select(i => BigInteger.Pow(10, i)).ToArray(); + + public int CompareTo(BigDecimal value) + { + int sd = Scale - value.Scale; + if (sd > 0) + return Integer.CompareTo(value.Integer * Pow10[sd]); + else if (sd < 0) + return (Integer * Pow10[-sd]).CompareTo(value.Integer); + else + return Integer.CompareTo(value.Integer); + } + + public BigDecimal Add(BigDecimal value, out bool overflow) + { + int sd = Scale - value.Scale; + BigInteger a = Integer, b = value.Integer; + if (sd > 0) + b *= Pow10[sd]; + else if (sd < 0) + a *= Pow10[-sd]; + + var res = a + b; + int scale = Math.Max(Scale, value.Scale); + overflow = ScaleResult(ref res, ref scale); + return new BigDecimal(res, (byte)scale); + } + + public BigDecimal Mul(BigDecimal value, out bool overflow) + { + var res = Integer * value.Integer; + int scale = Scale + value.Scale; + if (res.IsZero) + { + overflow = false; + // VarDecMul quirk: multipling by zero results in a scaled zero (e.g., 0.000) only if the intermediate scale is <=47 and both inputs fit in 32 bits! + if (scale <= 47 && BigInteger.Abs(Integer) <= MaxInteger32 && BigInteger.Abs(value.Integer) <= MaxInteger32) + scale = Math.Min(scale, 28); + else + scale = 0; + } + else + { + overflow = ScaleResult(ref res, ref scale); + // VarDecMul quirk: rounding to zero results in a scaled zero (e.g., 0.000), except if the intermediate scale is >47 and both inputs fit in 32 bits! + if (res.IsZero && scale == 28 && Scale + value.Scale > 47 && BigInteger.Abs(Integer) <= MaxInteger32 && BigInteger.Abs(value.Integer) <= MaxInteger32) + scale = 0; + } + return new BigDecimal(res, (byte)scale); + } + + public BigDecimal Div(BigDecimal value, out bool overflow) + { + int scale = Scale - value.Scale; + var dividend = Integer; + if (scale < 0) + { + dividend *= Pow10[-scale]; + scale = 0; + } + + var quo = BigInteger.DivRem(dividend, value.Integer, out var remainder); + if (remainder.IsZero) + overflow = BigInteger.Abs(quo) > MaxInteger; + else + { + // We have computed a quotient based on the natural scale ( - ). + // We have a non-zero remainder, so now we increase the scale to DEC_SCALE_MAX+1 to include more quotient bits. + var pow = Pow10[29 - scale]; + quo *= pow; + quo += BigInteger.DivRem(remainder * pow, value.Integer, out remainder); + scale = 29; + + overflow = ScaleResult(ref quo, ref scale, !remainder.IsZero); + + // Unscale the result (removes extra zeroes). + while (scale > 0 && quo.IsEven) + { + var tmp = BigInteger.DivRem(quo, 10, out remainder); + if (!remainder.IsZero) + break; + quo = tmp; + scale--; + } + } + return new BigDecimal(quo, (byte)scale); + } + + static readonly BigInteger MaxInteger = (new BigInteger(ulong.MaxValue) << 32) | uint.MaxValue; + static readonly BigInteger MaxInteger32 = uint.MaxValue; + static readonly double Log2To10 = Math.Log(2) / Math.Log(10); + + /// + /// Returns Log10 for the given number, offset by 96bits. + /// + static int ScaleOverMaxInteger(BigInteger abs) => abs.IsZero ? -28 : (int)(((int)BigInteger.Log(abs, 2) - 95) * Log2To10); + + /// + /// See if we need to scale the result to fit it in 96 bits. + /// Perform needed scaling. Adjust scale factor accordingly. + /// + static bool ScaleResult(ref BigInteger res, ref int scale, bool sticky = false) + { + int newScale = 0; + var abs = BigInteger.Abs(res); + if (abs > MaxInteger) + { + // Find the min scale factor to make the result to fit it in 96 bits, 0 - 29. + // This reduces the scale factor of the result. If it exceeds the current scale of the result, we'll overflow. + newScale = Math.Max(1, ScaleOverMaxInteger(abs)); + if (newScale > scale) + return true; + } + // Make sure we scale by enough to bring the current scale factor into valid range. + newScale = Math.Max(newScale, scale - 28); + + if (newScale != 0) + { + // Scale by the power of 10 given by newScale. + // This is not guaranteed to bring the number within 96 bits -- it could be 1 power of 10 short. + scale -= newScale; + var pow = Pow10[newScale]; + while (true) + { + abs = BigInteger.DivRem(abs, pow, out var remainder); + // If we didn't scale enough, divide by 10 more. + if (abs > MaxInteger) + { + if (scale == 0) + return true; + pow = 10; + scale--; + sticky |= !remainder.IsZero; + continue; + } + + // Round final result. See if remainder >= 1/2 of divisor. + // If remainder == 1/2 divisor, round up if odd or sticky bit set. + pow >>= 1; + if (remainder < pow || remainder == pow && !sticky && abs.IsEven) + break; + if (++abs <= MaxInteger) + break; + + // The rounding caused us to carry beyond 96 bits. Scale by 10 more. + if (scale == 0) + return true; + pow = 10; + scale--; + sticky = false; + } + res = res.Sign < 0 ? -abs : abs; + } + return false; + } + } } } diff --git a/external/corefx/src/System.Runtime/tests/System/DecimalTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/DecimalTests.netcoreapp.cs new file mode 100644 index 0000000000..da9c64a502 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/DecimalTests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class DecimalTests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, decimal expected) + { + Assert.Equal(expected, decimal.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(decimal.TryParse(value.AsReadOnlySpan(), out decimal result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => decimal.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(decimal.TryParse(value.AsReadOnlySpan(), out decimal result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/DoubleTests.cs b/external/corefx/src/System.Runtime/tests/System/DoubleTests.cs index 1e3b1ad54a..69290976b3 100644 --- a/external/corefx/src/System.Runtime/tests/System/DoubleTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/DoubleTests.cs @@ -9,7 +9,7 @@ using Xunit; namespace System.Tests { - public class DoubleTests : RemoteExecutorTestBase + public partial class DoubleTests : RemoteExecutorTestBase { [Fact] public static void Ctor_Empty() @@ -47,10 +47,19 @@ namespace System.Tests } [Theory] - [InlineData(double.PositiveInfinity, true)] - [InlineData(double.NegativeInfinity, true)] - [InlineData(double.NaN, false)] - [InlineData(0.0, false)] + [InlineData(double.NegativeInfinity, true)] // Negative Infinity + [InlineData(double.MinValue, false)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, false)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, false)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, false)] // Max Negative Subnormal + [InlineData(-0.0, false)] // Negative Zero + [InlineData(double.NaN, false)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, false)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, false)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, false)] // Min Positive Normal + [InlineData(double.MaxValue, false)] // Max Positive Normal + [InlineData(double.PositiveInfinity, true)] // Positive Infinity public static void IsInfinity(double d, bool expected) { Assert.Equal(expected, double.IsInfinity(d)); @@ -63,10 +72,19 @@ namespace System.Tests } [Theory] - [InlineData(double.PositiveInfinity, false)] - [InlineData(double.NegativeInfinity, false)] - [InlineData(double.NaN, true)] - [InlineData(0.0, false)] + [InlineData(double.NegativeInfinity, false)] // Negative Infinity + [InlineData(double.MinValue, false)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, false)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, false)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, false)] // Max Negative Subnormal + [InlineData(-0.0, false)] // Negative Zero + [InlineData(double.NaN, true)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, false)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, false)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, false)] // Min Positive Normal + [InlineData(double.MaxValue, false)] // Max Positive Normal + [InlineData(double.PositiveInfinity, false)] // Positive Infinity public static void IsNaN(double d, bool expected) { Assert.Equal(expected, double.IsNaN(d)); @@ -79,10 +97,19 @@ namespace System.Tests } [Theory] - [InlineData(double.NegativeInfinity, true)] - [InlineData(double.PositiveInfinity, false)] - [InlineData(double.NaN, false)] - [InlineData(0.0, false)] + [InlineData(double.NegativeInfinity, true)] // Negative Infinity + [InlineData(double.MinValue, false)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, false)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, false)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, false)] // Max Negative Subnormal + [InlineData(-0.0, false)] // Negative Zero + [InlineData(double.NaN, false)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, false)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, false)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, false)] // Min Positive Normal + [InlineData(double.MaxValue, false)] // Max Positive Normal + [InlineData(double.PositiveInfinity, false)] // Positive Infinity public static void IsNegativeInfinity(double d, bool expected) { Assert.Equal(expected, double.IsNegativeInfinity(d)); @@ -95,10 +122,19 @@ namespace System.Tests } [Theory] - [InlineData(double.PositiveInfinity, true)] - [InlineData(double.NegativeInfinity, false)] - [InlineData(double.NaN, false)] - [InlineData(0.0, false)] + [InlineData(double.NegativeInfinity, false)] // Negative Infinity + [InlineData(double.MinValue, false)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, false)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, false)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, false)] // Max Negative Subnormal + [InlineData(-0.0, false)] // Negative Zero + [InlineData(double.NaN, false)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, false)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, false)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, false)] // Min Positive Normal + [InlineData(double.MaxValue, false)] // Max Positive Normal + [InlineData(double.PositiveInfinity, true)] // Positive Infinity public static void IsPositiveInfinity(double d, bool expected) { Assert.Equal(expected, double.IsPositiveInfinity(d)); diff --git a/external/corefx/src/System.Runtime/tests/System/DoubleTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/DoubleTests.netcoreapp.cs new file mode 100644 index 0000000000..bb7a26e610 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/DoubleTests.netcoreapp.cs @@ -0,0 +1,113 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class DoubleTests + { + [Theory] + [InlineData(double.NegativeInfinity, false)] // Negative Infinity + [InlineData(double.MinValue, true)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, true)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, true)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, true)] // Max Negative Subnormal + [InlineData(-0.0, true)] // Negative Zero + [InlineData(double.NaN, false)] // NaN + [InlineData(0.0, true)] // Positive Zero + [InlineData(4.94065645841247E-324, true)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, true)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, true)] // Min Positive Normal + [InlineData(double.MaxValue, true)] // Max Positive Normal + [InlineData(double.PositiveInfinity, false)] // Positive Infinity + public static void IsFinite(double d, bool expected) + { + Assert.Equal(expected, double.IsFinite(d)); + } + + [Theory] + [InlineData(double.NegativeInfinity, true)] // Negative Infinity + [InlineData(double.MinValue, true)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, true)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, true)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, true)] // Max Negative Subnormal + [InlineData(-0.0, true)] // Negative Zero + [InlineData(double.NaN, true)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, false)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, false)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, false)] // Min Positive Normal + [InlineData(double.MaxValue, false)] // Max Positive Normal + [InlineData(double.PositiveInfinity, false)] // Positive Infinity + public static void IsNegative(double d, bool expected) + { + Assert.Equal(expected, double.IsNegative(d)); + } + + [Theory] + [InlineData(double.NegativeInfinity, false)] // Negative Infinity + [InlineData(double.MinValue, true)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, true)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, false)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, false)] // Max Negative Subnormal + [InlineData(-0.0, false)] // Negative Zero + [InlineData(double.NaN, false)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, false)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, false)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, true)] // Min Positive Normal + [InlineData(double.MaxValue, true)] // Max Positive Normal + [InlineData(double.PositiveInfinity, false)] // Positive Infinity + public static void IsNormal(double d, bool expected) + { + Assert.Equal(expected, double.IsNormal(d)); + } + + [Theory] + [InlineData(double.NegativeInfinity, false)] // Negative Infinity + [InlineData(double.MinValue, false)] // Min Negative Normal + [InlineData(-2.2250738585072014E-308, false)] // Max Negative Normal + [InlineData(-2.2250738585072009E-308, true)] // Min Negative Subnormal + [InlineData(-4.94065645841247E-324, true)] // Max Negative Subnormal + [InlineData(-0.0, false)] // Negative Zero + [InlineData(double.NaN, false)] // NaN + [InlineData(0.0, false)] // Positive Zero + [InlineData(4.94065645841247E-324, true)] // Min Positive Subnormal + [InlineData(2.2250738585072009E-308, true)] // Max Positive Subnormal + [InlineData(2.2250738585072014E-308, false)] // Min Positive Normal + [InlineData(double.MaxValue, false)] // Max Positive Normal + [InlineData(double.PositiveInfinity, false)] // Positive Infinity + public static void IsSubnormal(double d, bool expected) + { + Assert.Equal(expected, double.IsSubnormal(d)); + } + + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, double expected) + { + Assert.Equal(expected, double.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(double.TryParse(value.AsReadOnlySpan(), out double result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => double.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(double.TryParse(value.AsReadOnlySpan(), out double result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/GCTests.cs b/external/corefx/src/System.Runtime/tests/System/GCTests.cs index 13cda45f6e..d602880789 100644 --- a/external/corefx/src/System.Runtime/tests/System/GCTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/GCTests.cs @@ -51,7 +51,7 @@ namespace System.Tests int oldCollectionCount = GC.CollectionCount(gen); b = null; - GC.Collect(gen, GCCollectionMode.Default); + GC.Collect(gen, mode); Assert.True(GC.CollectionCount(gen) > oldCollectionCount); } @@ -626,15 +626,13 @@ namespace System.Tests options.TimeOut = TimeoutMilliseconds; RemoteInvoke(() => { - // 40kb budget, see below comment - Assert.True(GC.TryStartNoGCRegion(40 * 1024, true)); - Assert.Equal(GCSettings.LatencyMode, GCLatencyMode.NoGCRegion); - - // PLEASE NOTE: the xunit Assert.Throws combinator allocates a lot and you should measure - // how large the GC budget should be *manually* if you use it while in a no GC region. + // The budget for this test is 4mb, because the act of throwing an exception with a message + // contained in a resource file has to potential to allocate a lot on CoreRT. In particular, when compiling + // in multi-file mode, this will trigger a resource lookup in System.Private.CoreLib. // - // In this case, this particular one allocates 23720 bytes, so a budget of 40k should be - // large enough to keep us in a no GC region. + // In addition to this, the Assert.Throws xunit combinator tends to also allocate a lot. + Assert.True(GC.TryStartNoGCRegion(4000 * 1024, true)); + Assert.Equal(GCSettings.LatencyMode, GCLatencyMode.NoGCRegion); Assert.Throws(() => GCSettings.LatencyMode = GCLatencyMode.LowLatency); GC.EndNoGCRegion(); @@ -712,6 +710,39 @@ namespace System.Tests }, options).Dispose(); } + [Theory] + [OuterLoop] + [InlineData(0)] + [InlineData(-1)] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Difference in behavior, full framework doesn't throw, fixed in .NET Core")] + public static void TryStartNoGCRegion_TotalSizeOutOfRange(long size) + { + RemoteInvokeOptions options = new RemoteInvokeOptions(); + options.TimeOut = TimeoutMilliseconds; + RemoteInvoke(sizeString => + { + Assert.Throws("totalSize", () => GC.TryStartNoGCRegion(long.Parse(sizeString))); + return SuccessExitCode; + }, size.ToString(), options).Dispose(); + } + + [Theory] + [OuterLoop] + [InlineData(0)] // invalid because lohSize == + [InlineData(-1)] // invalid because lohSize < 0 + [InlineData(1152921504606846976)] // invalid because lohSize > totalSize + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Difference in behavior, full framework doesn't throw, fixed in .NET Core")] + public static void TryStartNoGCRegion_LOHSizeInvalid(long size) + { + RemoteInvokeOptions options = new RemoteInvokeOptions(); + options.TimeOut = TimeoutMilliseconds; + RemoteInvoke(sizeString => + { + Assert.Throws("lohSize", () => GC.TryStartNoGCRegion(1024, long.Parse(sizeString))); + return SuccessExitCode; + }, size.ToString(), options).Dispose(); + } + public static void TestWait(bool approach, int timeout) { GCNotificationStatus result = GCNotificationStatus.Failed; diff --git a/external/corefx/src/System.Runtime/tests/System/GuidTests.cs b/external/corefx/src/System.Runtime/tests/System/GuidTests.cs index 122bb7bad9..1c8b7afc27 100644 --- a/external/corefx/src/System.Runtime/tests/System/GuidTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/GuidTests.cs @@ -348,14 +348,14 @@ namespace System.Tests public static IEnumerable ToString_TestData() { - yield return new object[] { s_testGuid, "N", "a8a110d5fc4943c5bf46802db8f843ff" }; - yield return new object[] { s_testGuid, "D", "a8a110d5-fc49-43c5-bf46-802db8f843ff" }; - yield return new object[] { s_testGuid, "B", "{a8a110d5-fc49-43c5-bf46-802db8f843ff}" }; - yield return new object[] { s_testGuid, "P", "(a8a110d5-fc49-43c5-bf46-802db8f843ff)" }; - yield return new object[] { s_testGuid, "X", "{0xa8a110d5,0xfc49,0x43c5,{0xbf,0x46,0x80,0x2d,0xb8,0xf8,0x43,0xff}}" }; + yield return new object[] { s_testGuid, "N", "a8a110d5fc4943c5bf46802db8f843ff"}; + yield return new object[] { s_testGuid, "D", "a8a110d5-fc49-43c5-bf46-802db8f843ff"}; + yield return new object[] { s_testGuid, "B", "{a8a110d5-fc49-43c5-bf46-802db8f843ff}"}; + yield return new object[] { s_testGuid, "P", "(a8a110d5-fc49-43c5-bf46-802db8f843ff)"}; + yield return new object[] { s_testGuid, "X", "{0xa8a110d5,0xfc49,0x43c5,{0xbf,0x46,0x80,0x2d,0xb8,0xf8,0x43,0xff}}"}; - yield return new object[] { s_testGuid, null, "a8a110d5-fc49-43c5-bf46-802db8f843ff" }; - yield return new object[] { s_testGuid, "", "a8a110d5-fc49-43c5-bf46-802db8f843ff" }; + yield return new object[] { s_testGuid, null, "a8a110d5-fc49-43c5-bf46-802db8f843ff"}; + yield return new object[] { s_testGuid, "", "a8a110d5-fc49-43c5-bf46-802db8f843ff"}; } [Theory] @@ -372,11 +372,12 @@ namespace System.Tests Assert.Equal(expected, formattable.ToString(format, null)); } - [Fact] - public static void ToString_InvalidFormat_ThrowsFormatException() + [Theory] + [InlineData("Y")] + [InlineData("XX")] + public static void ToString_InvalidFormat_ThrowsFormatException(string format) { - Assert.Throws(() => s_testGuid.ToString("Y")); // Invalid format - Assert.Throws(() => s_testGuid.ToString("XX")); // Invalid format + Assert.Throws(() => s_testGuid.ToString(format)); } public static IEnumerable GuidStrings_Valid_TestData() diff --git a/external/corefx/src/System.Runtime/tests/System/GuidTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/GuidTests.netcoreapp.cs new file mode 100644 index 0000000000..512f35558b --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/GuidTests.netcoreapp.cs @@ -0,0 +1,124 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Tests +{ + public static partial class GuidTests + { + [Theory] + [MemberData(nameof(Ctor_ByteArray_TestData))] + public static void Ctor_ReadOnlySpan(byte[] b, Guid expected) + { + Assert.Equal(expected, new Guid(new ReadOnlySpan(b))); + } + + [Theory] + [InlineData(15)] + [InlineData(17)] + public static void CtorSpan_InvalidLengthByteArray_ThrowsArgumentException(int length) + { + AssertExtensions.Throws("b", null, () => new Guid(new ReadOnlySpan(new byte[length]))); + } + + [Theory] + [MemberData(nameof(Ctor_ByteArray_TestData))] + public static void TryWriteBytes_ValidLength_ReturnsTrue(byte[] b, Guid guid) + { + var bytes = new byte[16]; + Assert.True(guid.TryWriteBytes(new Span(bytes))); + Assert.Equal(b, bytes); + } + + [Theory] + [InlineData(0)] + [InlineData(15)] + public static void TryWriteBytes_LengthTooShort_ReturnsFalse(int length) + { + Assert.False(s_testGuid.TryWriteBytes(new Span(new byte[length]))); + } + + [Theory] + [InlineData("Y")] + [InlineData("XX")] + public static void TryFormat_InvalidFormat_ThrowsFormatException(string format) + { + Assert.Throws(() => s_testGuid.TryFormat(new Span(), out int charsWritten, format)); + } + + [Theory] + [MemberData(nameof(ToString_TestData))] + public static void TryFormat_LengthTooSmall_ReturnsFalse(Guid guid, string format, string expected) + { + Assert.False(guid.TryFormat(new Span(new char[guid.ToString(format).Length - 1]), out int charsWritten, format)); + Assert.Equal(0, charsWritten); + } + + [Theory] + [MemberData(nameof(ToString_TestData))] + public static void TryFormat_CharsWritten_EqualsZero_WhenSpanTooSmall(Guid guid, string format, string expected) + { + Assert.False(guid.TryFormat(new Span(new char[guid.ToString(format).Length - 1]), out int charsWritten, format)); + Assert.Equal(0, charsWritten); + } + + [Theory] + [MemberData(nameof(ToString_TestData))] + public static void TryFormat_ValidLength_ReturnsTrue(Guid guid, string format, string expected) + { + char[] chars = new char[guid.ToString(format).Length]; + Assert.True(guid.TryFormat(new Span(chars), out int charsWritten, format)); + Assert.Equal(chars, expected.ToCharArray()); + } + + [Theory] + [MemberData(nameof(GuidStrings_Valid_TestData))] + public static void Parse_Span_ValidInput_Success(string input, string format, Guid expected) + { + Assert.Equal(expected, Guid.Parse(input.AsReadOnlySpan())); + Assert.Equal(expected, Guid.ParseExact(input.AsReadOnlySpan(), format.ToUpperInvariant())); + Assert.Equal(expected, Guid.ParseExact(input.AsReadOnlySpan(), format.ToLowerInvariant())); // Format should be case insensitive + + Guid result; + + Assert.True(Guid.TryParse(input.AsReadOnlySpan(), out result)); + Assert.Equal(expected, result); + + Assert.True(Guid.TryParseExact(input.AsReadOnlySpan(), format.ToUpperInvariant(), out result)); + Assert.Equal(expected, result); + + Assert.True(Guid.TryParseExact(input.AsReadOnlySpan(), format.ToLowerInvariant(), out result)); // Format should be case insensitive + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(GuidStrings_Invalid_TestData))] + public static void Parse_Span_InvalidInput_Fails(string input, Type exceptionType) + { + if (input == null) + { + return; + } + + // Overflow exceptions throw as format exceptions in Parse + if (exceptionType.Equals(typeof(OverflowException))) + { + exceptionType = typeof(FormatException); + } + Assert.Throws(exceptionType, () => Guid.Parse(input.AsReadOnlySpan())); + + Assert.False(Guid.TryParse(input.AsReadOnlySpan(), out Guid result)); + Assert.Equal(Guid.Empty, result); + + foreach (string format in new[] { "N", "D", "B", "P", "X" }) + { + Assert.Throws(exceptionType, () => Guid.ParseExact(input.AsReadOnlySpan(), format)); + + Assert.False(Guid.TryParseExact(input.AsReadOnlySpan(), format, out result)); + Assert.Equal(Guid.Empty, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/Int16Tests.cs b/external/corefx/src/System.Runtime/tests/System/Int16Tests.cs index 69ae4314ae..a9764b208f 100644 --- a/external/corefx/src/System.Runtime/tests/System/Int16Tests.cs +++ b/external/corefx/src/System.Runtime/tests/System/Int16Tests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class Int16Tests + public partial class Int16Tests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/Int16Tests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Int16Tests.netcoreapp.cs new file mode 100644 index 0000000000..5e2d99e0c8 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/Int16Tests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class Int16Tests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, short expected) + { + Assert.Equal(expected, short.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(short.TryParse(value.AsReadOnlySpan(), out short result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => short.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(short.TryParse(value.AsReadOnlySpan(), out short result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/Int32Tests.cs b/external/corefx/src/System.Runtime/tests/System/Int32Tests.cs index 73561d63d2..1c8dde8707 100644 --- a/external/corefx/src/System.Runtime/tests/System/Int32Tests.cs +++ b/external/corefx/src/System.Runtime/tests/System/Int32Tests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class Int32Tests + public partial class Int32Tests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/Int32Tests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Int32Tests.netcoreapp.cs new file mode 100644 index 0000000000..170dfd7d25 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/Int32Tests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class Int32Tests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, int expected) + { + Assert.Equal(expected, int.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(int.TryParse(value.AsReadOnlySpan(), out int result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => int.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(int.TryParse(value.AsReadOnlySpan(), out int result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/Int64Tests.cs b/external/corefx/src/System.Runtime/tests/System/Int64Tests.cs index 7d25d695f2..197a973767 100644 --- a/external/corefx/src/System.Runtime/tests/System/Int64Tests.cs +++ b/external/corefx/src/System.Runtime/tests/System/Int64Tests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class Int64Tests + public partial class Int64Tests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/Int64Tests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Int64Tests.netcoreapp.cs new file mode 100644 index 0000000000..403b5e6523 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/Int64Tests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class Int64Tests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, long expected) + { + Assert.Equal(expected, long.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(long.TryParse(value.AsReadOnlySpan(), out long result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => long.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(long.TryParse(value.AsReadOnlySpan(), out long result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/Reflection/AssemblyTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Reflection/AssemblyTests.netcoreapp.cs new file mode 100644 index 0000000000..f6e34e35f3 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/Reflection/AssemblyTests.netcoreapp.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using Xunit; + +[assembly:TypeForwardedTo(typeof(string))] +[assembly: TypeForwardedTo(typeof(TypeInForwardedAssembly))] + +namespace System.Reflection.Tests +{ + public static class AssemblyNetCoreAppTests + { + [Fact] + public static void AssemblyGetForwardedTypes() + { + Assembly a = typeof(AssemblyNetCoreAppTests).Assembly; + Type[] forwardedTypes = a.GetForwardedTypes(); + + // ActiveIssue: https://github.com/dotnet/corefx/issues/22773 - UapAot - TypeForwards to System.Runtime types not getting emitted when ILC runs in shared assembly mode. + if (PlatformDetection.IsNetNative) + { + if (!forwardedTypes.Contains(typeof(string))) + { + forwardedTypes = forwardedTypes.Concat(new Type[] { typeof(string) }).ToArray(); + } + } + + forwardedTypes = forwardedTypes.OrderBy(t => t.FullName).ToArray(); + + Type[] expected = { typeof(string), typeof(TypeInForwardedAssembly), typeof(TypeInForwardedAssembly.PublicInner), typeof(TypeInForwardedAssembly.PublicInner.PublicInnerInner) }; + expected = expected.OrderBy(t => t.FullName).ToArray(); + + Assert.Equal(expected, forwardedTypes); + } + + [Fact] + [ActiveIssue("https://github.com/dotnet/corert/issues/4230 - UapAot does not honor the ReferenceAssembly attribute", TargetFrameworkMonikers.UapAot)] + public static void AssemblyGetForwardedTypesLoadFailure() + { + Assembly a = typeof(TypeInForwardedAssembly).Assembly; + ReflectionTypeLoadException rle = Assert.Throws(() => a.GetForwardedTypes()); + Assert.Equal(2, rle.Types.Length); + Assert.Equal(2, rle.LoaderExceptions.Length); + + bool foundSystemObject = false; + bool foundBifException = false; + for (int i = 0; i < rle.Types.Length; i++) + { + Type type = rle.Types[i]; + Exception exception = rle.LoaderExceptions[i]; + + if (type == typeof(object) && exception == null) + foundSystemObject = true; + + if (type == null && exception is BadImageFormatException) + foundBifException = true; + } + + Assert.True(foundSystemObject); + Assert.True(foundBifException); + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/Reflection/BindingFlagsDoNotWrap.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Reflection/BindingFlagsDoNotWrap.netcoreapp.cs new file mode 100644 index 0000000000..2b0052f154 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/Reflection/BindingFlagsDoNotWrap.netcoreapp.cs @@ -0,0 +1,174 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Xunit; + +namespace System.Reflection.Tests +{ + public static class BindingFlagsDoNotWrapTests + { + [Fact] + public static void MethodInvoke() + { + MethodInfo m = typeof(TestClass).GetMethod(nameof(TestClass.Moo), BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); + TestDoNotWrap((bf) => m.Invoke(null, bf, null, Array.Empty(), null)); + } + + [Fact] + public static void ConstructorInvoke() + { + ConstructorInfo c = typeof(TestClass).GetConstructor(BindingFlags.Public|BindingFlags.Instance, null, Array.Empty(), null); + TestDoNotWrap((bf) => c.Invoke(bf, null, Array.Empty(), null)); + } + + [Fact] + public static void ConstructorInvokeStringCtor() + { + // Code coverage: Project N - String constructors go through a separate code path. + ConstructorInfo c = typeof(string).GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(char[]), typeof(int), typeof(int) }, null); + TestDoNotWrap((bf) => c.Invoke(bf, null, new object[] { null, 0, 0 }, null)); + } + + [Fact] + public static void ConstructorInvokeUsingMethodInfoInvoke() + { + ConstructorInfo c = typeof(TestClass).GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, Array.Empty(), null); + TestDoNotWrap((bf) => c.Invoke(new TestClass(0), bf, null, Array.Empty(), null)); + } + + [Fact] + public static void PropertyGet() + { + PropertyInfo p = typeof(TestClass).GetProperty(nameof(TestClass.MyProperty)); + TestDoNotWrap((bf) => p.GetValue(null, bf, null, null, null)); + } + + [Fact] + public static void PropertySet() + { + PropertyInfo p = typeof(TestClass).GetProperty(nameof(TestClass.MyProperty)); + TestDoNotWrap((bf) => p.SetValue(null, 42, bf, null, null, null)); + } + + [Fact] + public static void InvokeMember_Method() + { + Type t = typeof(TestClass); + const BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.InvokeMethod; + TestDoNotWrap((bf) => t.InvokeMember(nameof(TestClass.Moo), bf | flags, null, null, Array.Empty(), null, null, null)); + } + + [Fact] + public static void InvokeMember_PropertyGet() + { + Type t = typeof(TestClass); + const BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.GetProperty; + TestDoNotWrap((bf) => t.InvokeMember(nameof(TestClass.MyProperty), bf | flags, null, null, Array.Empty(), null, null, null)); + } + + [Fact] + public static void InvokeMember_PropertySet() + { + Type t = typeof(TestClass); + const BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.SetProperty; + TestDoNotWrap((bf) => t.InvokeMember(nameof(TestClass.MyProperty), bf | flags, null, null, new object[] { 42 }, null, null, null)); + } + + [Fact] + public static void ActivatorCreateInstance() + { + const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; + TestDoNotWrap((bf) => Activator.CreateInstance(typeof(TestClass), bf | flags, null, Array.Empty(), null, null)); + } + + [Fact] + public static void ActivatorCreateInstanceOneArgument() + { + // For code coverage on CoreCLR: Activator.CreateInstance with parameters uses different code path from one without parameters. + const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; + TestDoNotWrap((bf) => Activator.CreateInstance(typeof(TestClass), bf | flags, null, new object[] { "Hello" }, null, null)); + } + + [Fact] + public static void ActivatorCreateInstanceCaching() + { + // For code coverage on CoreCLR: Activator.CreateInstance - second call after non-throwing call goes through a different path + const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; + TestClassConditional.ThrowInConstructor = true; + TestDoNotWrap((bf) => Activator.CreateInstance(typeof(TestClassConditional), bf | flags, null, Array.Empty(), null, null)); + + TestClassConditional.ThrowInConstructor = false; + Assert.True(Activator.CreateInstance(typeof(TestClassConditional), flags, null, Array.Empty(), null, null) is TestClassConditional); + + TestClassConditional.ThrowInConstructor = true; + TestDoNotWrap((bf) => Activator.CreateInstance(typeof(TestClassConditional), bf | flags, null, Array.Empty(), null, null)); + } + + [Fact] + public static void ActivatorCreateInstance_BadCCtor() + { + const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; + TestDoNotWrap((bf) => Activator.CreateInstance(typeof(TestClassBadCCtor), bf | flags, null, Array.Empty(), null, null)); + } + + [Fact] + public static void AssemblyCreateInstance() + { + Assembly a = typeof(TestClass).Assembly; + const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; + TestDoNotWrap((bf) => a.CreateInstance(typeof(TestClass).FullName, false, bf | flags, null, Array.Empty(), null, null)); + } + + [Fact] + public static void AssemblyCreateInstance_BadCCtor() + { + Assembly a = typeof(TestClass).Assembly; + const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; + TestDoNotWrap((bf) => a.CreateInstance(typeof(TestClassBadCCtor).FullName, false, bf | flags, null, Array.Empty(), null, null)); + } + + private static void TestDoNotWrap(Action action) where T : Exception + { + Assert.Throws(() => action(BindingFlags.DoNotWrapExceptions)); + TargetInvocationException tie = Assert.Throws(() => action(default(BindingFlags))); + Assert.Equal(typeof(T), tie.InnerException.GetType()); + } + + private sealed class TestClass + { + public TestClass() => throw new MyException2(); + public TestClass(int _) { } + public TestClass(string s) => throw new MyException5(); + public static void Moo() => throw new MyException1(); + public static int MyProperty { get { throw new MyException3(); } set { throw new MyException4(); } } + } + + public sealed class TestClassBadCCtor + { + public TestClassBadCCtor() { } + + static TestClassBadCCtor() + { + throw new MyException1(); + } + } + + private sealed class TestClassConditional + { + public TestClassConditional() { if (ThrowInConstructor) throw new MyException6(); } + + public static bool ThrowInConstructor; + } + + private sealed class MyException1 : Exception { } + private sealed class MyException2 : Exception { } + private sealed class MyException3 : Exception { } + private sealed class MyException4 : Exception { } + private sealed class MyException5 : Exception { } + private sealed class MyException6 : Exception { } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/Reflection/MemberInfoTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Reflection/MemberInfoTests.netcoreapp.cs index 34af6255df..cbbbe2805a 100644 --- a/external/corefx/src/System.Runtime/tests/System/Reflection/MemberInfoTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime/tests/System/Reflection/MemberInfoTests.netcoreapp.cs @@ -267,7 +267,7 @@ namespace System.Reflection.Tests [Fact] public static void HasSameMetadataDefinitionAs__CornerCase_HasElementTypes() { - // HasSameMetadataDefinitionAs on a array/byref/pointer type is uninteresting (they'll never be an actual member of a type) + // HasSameMetadataDefinitionAs on an array/byref/pointer type is uninteresting (they'll never be an actual member of a type) // but for future compat, we'll establish their known behavior here. Since these types all return a MetadataToken of 0x02000000, // they'll all "match" each other. diff --git a/external/corefx/src/System.Runtime/tests/System/Reflection/PointerTests.cs b/external/corefx/src/System.Runtime/tests/System/Reflection/PointerTests.cs index 1dd87be3d8..5856e745c3 100644 --- a/external/corefx/src/System.Runtime/tests/System/Reflection/PointerTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/Reflection/PointerTests.cs @@ -82,7 +82,6 @@ namespace System.Reflection.Tests [Theory] [MemberData(nameof(Pointers))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Pointers through Invoke not implemented: https://github.com/dotnet/corert/issues/2113")] public void PointerFieldSetValue(int value) { var obj = new PointerHolder(); @@ -93,7 +92,6 @@ namespace System.Reflection.Tests [Theory] [MemberData(nameof(Pointers))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Pointers through Invoke not implemented: https://github.com/dotnet/corert/issues/2113")] public void IntPtrFieldSetValue(int value) { var obj = new PointerHolder(); @@ -104,7 +102,6 @@ namespace System.Reflection.Tests [Theory] [MemberData(nameof(Pointers))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Pointers through Invoke not implemented: https://github.com/dotnet/corert/issues/2113")] public void PointerFieldSetValue_InvalidType(int value) { var obj = new PointerHolder(); @@ -117,7 +114,6 @@ namespace System.Reflection.Tests [Theory] [MemberData(nameof(Pointers))] - [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Issue https://github.com/dotnet/corefx/issues/17450")] public void PointerFieldGetValue(int value) { var obj = new PointerHolder(); diff --git a/external/corefx/src/System.Runtime/tests/System/Reflection/SignatureTypes.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Reflection/SignatureTypes.netcoreapp.cs new file mode 100644 index 0000000000..66ca3d032c --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/Reflection/SignatureTypes.netcoreapp.cs @@ -0,0 +1,549 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Xunit; + +namespace System.Reflection.Tests +{ + public static class SignatureTypeTests + { + [Fact] + public static void IsSignatureType() + { + // Executing [Theory] logic manually. Signature Types cannot be used in theory data because Xunit preemptively invokes an unguarded + // System.Type pretty printer that invokes members that Signature Types don't support. + foreach (object[] pair in IsSignatureTypeTestData) + { + Type type = (Type)(pair[0]); + bool expected = (bool)(pair[1]); + + Assert.Equal(expected, type.IsSignatureType); + } + } + + private static IEnumerable IsSignatureTypeTestData + { + get + { + yield return new object[] { typeof(int), false }; + yield return new object[] { typeof(int).MakeArrayType(), false }; + yield return new object[] { typeof(int).MakeArrayType(1), false }; + yield return new object[] { typeof(int).MakeArrayType(2), false }; + yield return new object[] { typeof(int).MakeByRefType(), false }; + yield return new object[] { typeof(int).MakePointerType(), false }; + yield return new object[] { typeof(List<>).MakeGenericType(typeof(int)), false }; + yield return new object[] { typeof(List<>).GetGenericArguments()[0], false }; + + Type sigType = Type.MakeGenericMethodParameter(2); + + yield return new object[] { sigType, true }; + yield return new object[] { sigType.MakeArrayType(), true }; + yield return new object[] { sigType.MakeArrayType(1), true }; + yield return new object[] { sigType.MakeArrayType(2), true }; + yield return new object[] { sigType.MakeByRefType(), true }; + yield return new object[] { sigType.MakePointerType(), true }; + yield return new object[] { typeof(List<>).MakeGenericType(sigType), true }; + } + } + + [Fact] + public static void GetMethodWithGenericParameterCount() + { + Type t = typeof(TestClass1); + const BindingFlags bf = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly; + Type[] args = { typeof(int) }; + MethodInfo m; + + Assert.Throws(() => t.GetMethod("Moo", bf, null, args, null)); + + for (int genericParameterCount = 0; genericParameterCount < 4; genericParameterCount++) + { + m = t.GetMethod("Moo", genericParameterCount, bf, null, args, null); + Assert.NotNull(m); + AssertIsMarked(m, genericParameterCount); + + // Verify that generic parameter count filtering occurs before candidates are passed to the binder. + m = t.GetMethod("Moo", genericParameterCount, bf, new InflexibleBinder(genericParameterCount), args, null); + Assert.NotNull(m); + AssertIsMarked(m, genericParameterCount); + } + + m = t.GetMethod("Moo", 4, bf, null, args, null); + Assert.Null(m); + } + + private sealed class InflexibleBinder : Binder + { + public InflexibleBinder(int genericParameterCount) + { + _genericParameterCount = genericParameterCount; + } + + public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture) => throw null; + public sealed override MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state) => throw null; + public sealed override object ChangeType(object value, Type type, CultureInfo culture) => throw null; + public sealed override void ReorderArgumentArray(ref object[] args, object state) => throw null; + + public sealed override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers) + { + foreach (MethodBase methodBase in match) + { + Assert.True(methodBase is MethodInfo methodInfo && methodInfo.GetGenericArguments().Length == _genericParameterCount); + } + return Type.DefaultBinder.SelectMethod(bindingAttr, match, types, modifiers); + } + + public sealed override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers) { throw null; } + + private readonly int _genericParameterCount; + } + + [Fact] + public static void GetMethodWithNegativeGenericParameterCount() + { + Type t = typeof(TestClass1); + const BindingFlags bf = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly; + Type[] args = { typeof(int) }; + Assert.Throws(() => t.GetMethod("Moo", -1, bf, null, args, null)); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void GetMethodOverloadTest(bool exactBinding) + { + Type t = typeof(TestClass2); + BindingFlags bf = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly; + if (exactBinding) + { + bf |= BindingFlags.ExactBinding; + } + Type[] args = { Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(1).MakeArrayType() }; + MethodInfo moo = t.GetMethod("Moo", 2, bf, null, args, null); + AssertIsMarked(moo, 3); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void SignatureTypeComparisonLogicCodeCoverage(bool exactBinding) + { + Type t = typeof(TestClass3<,>); + MethodInfo[] methods = t.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly); + BindingFlags bf = BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly; + if (exactBinding) + { + bf |= BindingFlags.ExactBinding; + } + + foreach (MethodInfo m in methods) + { + ParameterInfo[] parameters = m.GetParameters(); + Type[] sigTypes = new Type[parameters.Length]; + for (int i = 0; i < sigTypes.Length; i++) + { + sigTypes[i] = parameters[i].ParameterType.ToSignatureType(); + } + MethodInfo match = t.GetMethod("Moo", m.GetGenericArguments().Length, bf, null, sigTypes, null); + Assert.NotNull(match); + Assert.True(m.HasSameMetadataDefinitionAs(match)); + } + } + + [Fact] + public static void SigTypeResolutionResilience() + { + // Make sure the framework can't be tricked into throwing an exception because it tried to look up a nonexistent method generic parameter + // or trying to construct a generic type where the constraints don't validate. + Type t = typeof(TestClass4<>); + Type[] args = { typeof(TestClass4<>).MakeGenericType(Type.MakeGenericMethodParameter(1)), Type.MakeGenericMethodParameter(500) }; + CountingBinder binder = new CountingBinder(); + Assert.Null(t.GetMethod("Moo", BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly, binder, args, null)); + Assert.Equal(3, binder.NumCandidatesReceived); + } + + private sealed class CountingBinder : Binder + { + public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture) => throw null; + public sealed override MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state) => throw null; + public sealed override object ChangeType(object value, Type type, CultureInfo culture) => throw null; + public sealed override void ReorderArgumentArray(ref object[] args, object state) => throw null; + + public sealed override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers) + { + NumCandidatesReceived += match.Length; + return Type.DefaultBinder.SelectMethod(bindingAttr, match, types, modifiers); + } + + public sealed override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers) { throw null; } + + public int NumCandidatesReceived { get; private set; } + } + + [Theory] + [InlineData(0)] + [InlineData(3)] + [InlineData(400)] + [InlineData(int.MaxValue)] + public static void MakeGenericMethodParameter(int position) + { + Type t = Type.MakeGenericMethodParameter(position); + Assert.True(t.IsGenericParameter); + Assert.False(t.IsGenericTypeParameter); + Assert.True(t.IsGenericMethodParameter); + Assert.Equal(position, t.GenericParameterPosition); + TestSignatureTypeInvariants(t); + } + + [Theory] + [InlineData(-1)] + [InlineData(-5)] + [InlineData(int.MinValue)] + public static void MakeGenericMethodParameterNegative(int position) + { + Assert.Throws(() => Type.MakeGenericMethodParameter(position)); + } + + [Fact] + public static void MakeSignatureArrayType() + { + Type t = Type.MakeGenericMethodParameter(5); + t = t.MakeArrayType(); + Assert.True(t.IsArray); + Assert.True(t.IsSZArray); + Assert.Equal(1, t.GetArrayRank()); + + Type et = t.GetElementType(); + Assert.True(et.IsSignatureType); + Assert.True(et.IsGenericParameter); + Assert.False(et.IsGenericTypeParameter); + Assert.True(et.IsGenericMethodParameter); + Assert.Equal(5, et.GenericParameterPosition); + + TestSignatureTypeInvariants(t); + } + + [Theory] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + public static void MakeSignatureMdArrayType(int rank) + { + Type t = Type.MakeGenericMethodParameter(5); + t = t.MakeArrayType(rank); + Assert.True(t.IsArray); + Assert.True(t.IsVariableBoundArray); + Assert.Equal(rank, t.GetArrayRank()); + + TestSignatureTypeInvariants(t); + } + + [Fact] + public static void MakeSignatureByRefType() + { + Type t = Type.MakeGenericMethodParameter(5); + t = t.MakeByRefType(); + Assert.True(t.IsByRef); + + Type et = t.GetElementType(); + Assert.True(et.IsSignatureType); + Assert.True(et.IsGenericParameter); + Assert.False(et.IsGenericTypeParameter); + Assert.True(et.IsGenericMethodParameter); + Assert.Equal(5, et.GenericParameterPosition); + + TestSignatureTypeInvariants(t); + } + + [Fact] + public static void MakeSignaturePointerType() + { + Type t = Type.MakeGenericMethodParameter(5); + t = t.MakePointerType(); + Assert.True(t.IsPointer); + + Type et = t.GetElementType(); + Assert.True(et.IsSignatureType); + Assert.True(et.IsGenericParameter); + Assert.False(et.IsGenericTypeParameter); + Assert.True(et.IsGenericMethodParameter); + Assert.Equal(5, et.GenericParameterPosition); + + TestSignatureTypeInvariants(t); + } + + [Theory] + [InlineData(typeof(List<>))] + [InlineData(typeof(Span<>))] + public static void MakeSignatureConstructedGenericType(Type genericTypeDefinition) + { + Type t = Type.MakeGenericMethodParameter(5); + t = genericTypeDefinition.MakeGenericType(t); + + Assert.True(t.IsConstructedGenericType); + Assert.Equal(genericTypeDefinition, t.GetGenericTypeDefinition()); + Assert.Equal(1, t.GenericTypeArguments.Length); + + Type et = t.GenericTypeArguments[0]; + Assert.True(et.IsSignatureType); + Assert.True(et.IsGenericParameter); + Assert.False(et.IsGenericTypeParameter); + Assert.True(et.IsGenericMethodParameter); + Assert.Equal(5, et.GenericParameterPosition); + + TestSignatureTypeInvariants(t); + } + + private static Type ToSignatureType(this Type type) + { + if (type.IsTypeDefinition) + return type; + if (type.IsSZArray) + return type.GetElementType().ToSignatureType().MakeArrayType(); + if (type.IsVariableBoundArray) + return type.GetElementType().ToSignatureType().MakeArrayType(type.GetArrayRank()); + if (type.IsByRef) + return type.GetElementType().ToSignatureType().MakeByRefType(); + if (type.IsPointer) + return type.GetElementType().ToSignatureType().MakePointerType(); + if (type.IsConstructedGenericType) + { + Type[] genericTypeArguments = type.GenericTypeArguments.Select(t => t.ToSignatureType()).ToArray(); + return type.GetGenericTypeDefinition().MakeGenericType(genericTypeArguments); + } + if (type.IsGenericTypeParameter) + return type; + if (type.IsGenericMethodParameter) + return Type.MakeGenericMethodParameter(type.GenericParameterPosition); + + throw new Exception("Unknown type flavor."); + } + + private static void AssertIsMarked(MemberInfo member, int value) + { + MarkerAttribute marker = member.GetCustomAttribute(inherit: false); + Assert.NotNull(marker); + Assert.Equal(value, marker.Value); + } + + [AttributeUsage(AttributeTargets.All, Inherited = false)] + private sealed class MarkerAttribute : Attribute + { + public MarkerAttribute(int value) + { + Value = value; + } + + public int Value { get; } + } + + private sealed class TestClass1 + { + [Marker(0)] public static void Moo(int x) { } + [Marker(1)] public static void Moo(int x) { } + [Marker(2)] public static void Moo(int x) { } + [Marker(3)] public static void Moo(int x) {} + } + + private class TestClass2 + { + [Marker(0)] public static void Moo(int x, int[] y) { } + [Marker(1)] public static void Moo(T x, T[] y) { } + [Marker(2)] public static void Moo(int x, int[] y) { } + [Marker(3)] public static void Moo(T x, U[] y) { } + [Marker(4)] public static void Moo(int x, int[] y) { } + } + + private class TestClass3 + { + public static void Moo(T p1, T[] p2, T[,] p3, ref T p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(U p1, U[] p2, U[,] p3, ref U p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(T p1, T[] p2, T[,] p3, ref T p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(U p1, U[] p2, U[,] p3, ref U p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(M p1, M[] p2, M[,] p3, ref M p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(T p1, T[] p2, T[,] p3, ref T p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(U p1, U[] p2, U[,] p3, ref U p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(M p1, M[] p2, M[,] p3, ref M p4, TestClass3 p5, ref TestClass3[,] p6) { } + public static void Moo(N p1, N[] p2, N[,] p3, ref N p4, TestClass3 p5, ref TestClass3[,] p6) { } + } + + private class TestClass4 where T: NoOneSubclasses, new() + { + public static void Moo(int p1, int p2) where M : NoOneSubclassesThisEither { } + public static void Moo(TestClass4 p1, int p2) where N : NoOneSubclasses, new() { } + public static void Moo(O p1, int p2) where N : NoOneSubclasses, new() { } + } + + private class NoOneSubclasses { } + private class NoOneSubclassesThisEither { } + + private static void TestSignatureTypeInvariants(Type type) + { + Assert.True(type.IsSignatureType); + Assert.False(type.IsTypeDefinition); + Assert.False(type.IsGenericTypeDefinition); + Assert.NotNull(type.Name); + Assert.Null(type.FullName); + Assert.Null(type.AssemblyQualifiedName); + Assert.NotNull(type.ToString()); + Assert.Equal(MemberTypes.TypeInfo, type.MemberType); + Assert.Same(type, type.UnderlyingSystemType); + + // SignatureTypes don't override Equality/GetHashCode at this time, but they don't promise never to do so either. + // Thus, we'll only test the most basic behavior. + Assert.True(type.Equals((object)type)); + Assert.True(type.Equals((Type)type)); + Assert.False(type.Equals((object)null)); + Assert.False(type.Equals((Type)null)); + int _ = type.GetHashCode(); + + bool categorized = false; + if (type.IsArray) + { + Assert.False(categorized); + categorized = true; + Assert.True(type.HasElementType); + Assert.True(type.IsSZArray != type.IsVariableBoundArray); + Assert.Equal(type.GetElementType().ContainsGenericParameters, type.ContainsGenericParameters); + string elementTypeName = type.GetElementType().Name; + if (type.IsSZArray) + { + Assert.Equal(1, type.GetArrayRank()); + + Assert.Equal(elementTypeName + "[]", type.Name); + } + else + { + int rank = type.GetArrayRank(); + Assert.True(rank >= 1); + if (rank == 1) + { + Assert.Equal(elementTypeName + "[*]", type.Name); + } + else + { + Assert.Equal(elementTypeName + "[" + new string(',', rank - 1) + "]", type.Name); + } + } + } + + if (type.IsByRef) + { + Assert.False(categorized); + categorized = true; + + Assert.True(type.HasElementType); + Assert.Equal(type.GetElementType().ContainsGenericParameters, type.ContainsGenericParameters); + string elementTypeName = type.GetElementType().Name; + Assert.Equal(elementTypeName + "&", type.Name); + } + + if (type.IsPointer) + { + Assert.False(categorized); + categorized = true; + + Assert.True(type.HasElementType); + Assert.Equal(type.GetElementType().ContainsGenericParameters, type.ContainsGenericParameters); + string elementTypeName = type.GetElementType().Name; + Assert.Equal(elementTypeName + "*", type.Name); + } + + if (type.IsConstructedGenericType) + { + Assert.False(categorized); + categorized = true; + + Assert.True(type.IsGenericType); + Assert.False(type.HasElementType); + Type genericTypeDefinition = type.GetGenericTypeDefinition(); + Assert.Equal(genericTypeDefinition.IsByRefLike, type.IsByRefLike); + Assert.NotNull(genericTypeDefinition); + Assert.True(genericTypeDefinition.IsGenericTypeDefinition); + Type[] genericTypeArguments = type.GetGenericArguments(); + Type[] genericTypeArgumentsClone = type.GetGenericArguments(); + Assert.NotSame(genericTypeArguments, genericTypeArgumentsClone); + Type[] genericTypeArgumentsFromProperty = type.GenericTypeArguments; + Type[] genericTypeArgumentsFromPropertyClone = type.GenericTypeArguments; + Assert.NotSame(genericTypeArgumentsFromProperty, genericTypeArgumentsFromPropertyClone); + for (int i = 0; i < genericTypeArguments.Length; i++) + { + if (genericTypeArguments[i].IsSignatureType) + { + TestSignatureTypeInvariants(genericTypeArguments[i]); + } + } + Assert.Equal(genericTypeDefinition.Name, type.Name); + Assert.Equal(genericTypeDefinition.Namespace, type.Namespace); + + + bool containsGenericParameters = false; + for (int i = 0; i < genericTypeArguments.Length; i++) + { + containsGenericParameters = containsGenericParameters || genericTypeArguments[i].ContainsGenericParameters; + } + Assert.Equal(containsGenericParameters, type.ContainsGenericParameters); + } + + if (type.IsGenericParameter) + { + Assert.False(categorized); + categorized = true; + + Assert.False(type.HasElementType); + Assert.True(type.ContainsGenericParameters); + Assert.Null(type.Namespace); + + int position = type.GenericParameterPosition; + Assert.True(position >= 0); + + if (type.IsGenericTypeParameter) + { + throw new Exception("Unexpected: There is no mechanism at this time to create Signature Types of generic parameters on types."); + } + else + { + Assert.True(type.IsGenericMethodParameter); + Assert.Equal("!!" + position, type.Name); + } + } + + Assert.True(categorized); + + if (type.HasElementType) + { + TestSignatureTypeInvariants(type.GetElementType()); + Assert.Equal(type.GetElementType().Namespace, type.Namespace); + } + else + { + Assert.Null(type.GetElementType()); + } + + if (!type.IsConstructedGenericType) + { + Assert.Throws(() => type.GetGenericTypeDefinition()); + Assert.Equal(0, type.GetGenericArguments().Length); + Assert.Equal(0, type.GenericTypeArguments.Length); + Assert.False(type.IsGenericType); + Assert.False(type.IsByRefLike); + } + + if (!type.IsArray) + { + Assert.Throws(() => type.GetArrayRank()); + } + + if (!type.IsGenericParameter) + { + Assert.False(type.IsGenericTypeParameter); + Assert.False(type.IsGenericMethodParameter); + Assert.Throws(() => type.GenericParameterPosition); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/SByteTests.cs b/external/corefx/src/System.Runtime/tests/System/SByteTests.cs index 5a5600eb9d..29f2d4656e 100644 --- a/external/corefx/src/System.Runtime/tests/System/SByteTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/SByteTests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class SByteTests + public partial class SByteTests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/SByteTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/SByteTests.netcoreapp.cs new file mode 100644 index 0000000000..8caa325618 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/SByteTests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class SByteTests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, sbyte expected) + { + Assert.Equal(expected, sbyte.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(sbyte.TryParse(value.AsReadOnlySpan(), out sbyte result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => sbyte.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(sbyte.TryParse(value.AsReadOnlySpan(), out sbyte result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/SingleTests.cs b/external/corefx/src/System.Runtime/tests/System/SingleTests.cs index ec48475b66..576b5eb383 100644 --- a/external/corefx/src/System.Runtime/tests/System/SingleTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/SingleTests.cs @@ -9,7 +9,7 @@ using Xunit; namespace System.Tests { - public class SingleTests : RemoteExecutorTestBase + public partial class SingleTests : RemoteExecutorTestBase { [Fact] public static void Ctor_Empty() @@ -47,13 +47,22 @@ namespace System.Tests } [Theory] - [InlineData(float.PositiveInfinity, true)] - [InlineData(float.NegativeInfinity, true)] - [InlineData(float.NaN, false)] - [InlineData(0.0, false)] - public static void IsInfinity(float f, bool expected) + [InlineData(float.NegativeInfinity, true)] // Negative Infinity + [InlineData(float.MinValue, false)] // Min Negative Normal + [InlineData(-1.17549435E-38f, false)] // Max Negative Normal + [InlineData(-1.17549421E-38f, false)] // Min Negative Subnormal + [InlineData(-1.401298E-45, false)] // Max Negative Subnormal + [InlineData(-0.0f, false)] // Negative Zero + [InlineData(float.NaN, false)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, false)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, false)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, false)] // Min Positive Normal + [InlineData(float.MaxValue, false)] // Max Positive Normal + [InlineData(float.PositiveInfinity, true)] // Positive Infinity + public static void IsInfinity(float d, bool expected) { - Assert.Equal(expected, float.IsInfinity(f)); + Assert.Equal(expected, float.IsInfinity(d)); } [Fact] @@ -69,13 +78,22 @@ namespace System.Tests } [Theory] - [InlineData(float.NegativeInfinity, false)] - [InlineData(float.PositiveInfinity, false)] - [InlineData(float.NaN, true)] - [InlineData(0.0, false)] - public static void IsNaN(float f, bool expected) + [InlineData(float.NegativeInfinity, false)] // Negative Infinity + [InlineData(float.MinValue, false)] // Min Negative Normal + [InlineData(-1.17549435E-38f, false)] // Max Negative Normal + [InlineData(-1.17549421E-38f, false)] // Min Negative Subnormal + [InlineData(-1.401298E-45, false)] // Max Negative Subnormal + [InlineData(-0.0f, false)] // Negative Zero + [InlineData(float.NaN, true)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, false)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, false)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, false)] // Min Positive Normal + [InlineData(float.MaxValue, false)] // Max Positive Normal + [InlineData(float.PositiveInfinity, false)] // Positive Infinity + public static void IsNaN(float d, bool expected) { - Assert.Equal(expected, float.IsNaN(f)); + Assert.Equal(expected, float.IsNaN(d)); } [Fact] @@ -85,13 +103,22 @@ namespace System.Tests } [Theory] - [InlineData(float.NegativeInfinity, true)] - [InlineData(float.PositiveInfinity, false)] - [InlineData(float.NaN, false)] - [InlineData(0.0, false)] - public static void IsNegativeInfinity(float f, bool expected) + [InlineData(float.NegativeInfinity, true)] // Negative Infinity + [InlineData(float.MinValue, false)] // Min Negative Normal + [InlineData(-1.17549435E-38f, false)] // Max Negative Normal + [InlineData(-1.17549421E-38f, false)] // Min Negative Subnormal + [InlineData(-1.401298E-45, false)] // Max Negative Subnormal + [InlineData(-0.0f, false)] // Negative Zero + [InlineData(float.NaN, false)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, false)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, false)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, false)] // Min Positive Normal + [InlineData(float.MaxValue, false)] // Max Positive Normal + [InlineData(float.PositiveInfinity, false)] // Positive Infinity + public static void IsNegativeInfinity(float d, bool expected) { - Assert.Equal(expected, float.IsNegativeInfinity(f)); + Assert.Equal(expected, float.IsNegativeInfinity(d)); } [Fact] @@ -101,13 +128,22 @@ namespace System.Tests } [Theory] - [InlineData(float.PositiveInfinity, true)] - [InlineData(float.NegativeInfinity, false)] - [InlineData(float.NaN, false)] - [InlineData(0.0, false)] - public static void IsPositiveInfinity(float f, bool expected) + [InlineData(float.NegativeInfinity, false)] // Negative Infinity + [InlineData(float.MinValue, false)] // Min Negative Normal + [InlineData(-1.17549435E-38f, false)] // Max Negative Normal + [InlineData(-1.17549421E-38f, false)] // Min Negative Subnormal + [InlineData(-1.401298E-45, false)] // Max Negative Subnormal + [InlineData(-0.0f, false)] // Negative Zero + [InlineData(float.NaN, false)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, false)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, false)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, false)] // Min Positive Normal + [InlineData(float.MaxValue, false)] // Max Positive Normal + [InlineData(float.PositiveInfinity, true)] // Positive Infinity + public static void IsPositiveInfinity(float d, bool expected) { - Assert.Equal(expected, float.IsPositiveInfinity(f)); + Assert.Equal(expected, float.IsPositiveInfinity(d)); } [Theory] diff --git a/external/corefx/src/System.Runtime/tests/System/SingleTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/SingleTests.netcoreapp.cs new file mode 100644 index 0000000000..6ee509bb4b --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/SingleTests.netcoreapp.cs @@ -0,0 +1,113 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class SingleTests + { + [Theory] + [InlineData(float.NegativeInfinity, false)] // Negative Infinity + [InlineData(float.MinValue, true)] // Min Negative Normal + [InlineData(-1.17549435E-38f, true)] // Max Negative Normal + [InlineData(-1.17549421E-38f, true)] // Min Negative Subnormal + [InlineData(-1.401298E-45, true)] // Max Negative Subnormal + [InlineData(-0.0f, true)] // Negative Zero + [InlineData(float.NaN, false)] // NaN + [InlineData(0.0f, true)] // Positive Zero + [InlineData(1.401298E-45, true)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, true)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, true)] // Min Positive Normal + [InlineData(float.MaxValue, true)] // Max Positive Normal + [InlineData(float.PositiveInfinity, false)] // Positive Infinity + public static void IsFinite(float d, bool expected) + { + Assert.Equal(expected, float.IsFinite(d)); + } + + [Theory] + [InlineData(float.NegativeInfinity, true)] // Negative Infinity + [InlineData(float.MinValue, true)] // Min Negative Normal + [InlineData(-1.17549435E-38f, true)] // Max Negative Normal + [InlineData(-1.17549421E-38f, true)] // Min Negative Subnormal + [InlineData(-1.401298E-45, true)] // Max Negative Subnormal + [InlineData(-0.0f, true)] // Negative Zero + [InlineData(float.NaN, true)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, false)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, false)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, false)] // Min Positive Normal + [InlineData(float.MaxValue, false)] // Max Positive Normal + [InlineData(float.PositiveInfinity, false)] // Positive Infinity + public static void IsNegative(float d, bool expected) + { + Assert.Equal(expected, float.IsNegative(d)); + } + + [Theory] + [InlineData(float.NegativeInfinity, false)] // Negative Infinity + [InlineData(float.MinValue, true)] // Min Negative Normal + [InlineData(-1.17549435E-38f, true)] // Max Negative Normal + [InlineData(-1.17549421E-38f, false)] // Min Negative Subnormal + [InlineData(-1.401298E-45, false)] // Max Negative Subnormal + [InlineData(-0.0f, false)] // Negative Zero + [InlineData(float.NaN, false)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, false)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, false)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, true)] // Min Positive Normal + [InlineData(float.MaxValue, true)] // Max Positive Normal + [InlineData(float.PositiveInfinity, false)] // Positive Infinity + public static void IsNormal(float d, bool expected) + { + Assert.Equal(expected, float.IsNormal(d)); + } + + [Theory] + [InlineData(float.NegativeInfinity, false)] // Negative Infinity + [InlineData(float.MinValue, false)] // Min Negative Normal + [InlineData(-1.17549435E-38f, false)] // Max Negative Normal + [InlineData(-1.17549421E-38f, true)] // Min Negative Subnormal + [InlineData(-1.401298E-45, true)] // Max Negative Subnormal + [InlineData(-0.0f, false)] // Negative Zero + [InlineData(float.NaN, false)] // NaN + [InlineData(0.0f, false)] // Positive Zero + [InlineData(1.401298E-45, true)] // Min Positive Subnormal + [InlineData(1.17549421E-38f, true)] // Max Positive Subnormal + [InlineData(1.17549435E-38f, false)] // Min Positive Normal + [InlineData(float.MaxValue, false)] // Max Positive Normal + [InlineData(float.PositiveInfinity, false)] // Positive Infinity + public static void IsSubnormal(float d, bool expected) + { + Assert.Equal(expected, float.IsSubnormal(d)); + } + + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, float expected) + { + Assert.Equal(expected, float.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(float.TryParse(value.AsReadOnlySpan(), out float result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => float.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(float.TryParse(value.AsReadOnlySpan(), out float result, style, provider)); + Assert.Equal(0, result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/StringTests.cs.REMOVED.git-id b/external/corefx/src/System.Runtime/tests/System/StringTests.cs.REMOVED.git-id index 78961f010f..86e1ba7bf0 100644 --- a/external/corefx/src/System.Runtime/tests/System/StringTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime/tests/System/StringTests.cs.REMOVED.git-id @@ -1 +1 @@ -963d0a1ae755bd6ba969bc91bc66bfedf55cd6fe \ No newline at end of file +e01112b773871db0e5ce1fffdf840636d9e1fabd \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/tests/System/StringTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/StringTests.netcoreapp.cs index 3344dd6da5..f2a5039afa 100644 --- a/external/corefx/src/System.Runtime/tests/System/StringTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime/tests/System/StringTests.netcoreapp.cs @@ -11,6 +11,85 @@ namespace System.Tests { public partial class StringTests { + [Theory] + [InlineData(0, 0)] + [InlineData(3, 1)] + public static void Ctor_CharSpan_EmptyString(int length, int offset) + { + Assert.Same(string.Empty, new string(new ReadOnlySpan(new char[length], offset, 0))); + } + + [Theory] + [InlineData(new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', '\0' }, 0, 8, "abcdefgh")] + [InlineData(new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', '\0', 'i', 'j', 'k' }, 0, 12, "abcdefgh\0ijk")] + [InlineData(new char[] { 'a', 'b', 'c' }, 0, 0, "")] + [InlineData(new char[] { 'a', 'b', 'c' }, 0, 1, "a")] + [InlineData(new char[] { 'a', 'b', 'c' }, 2, 1, "c")] + [InlineData(new char[] { '\u8001', '\u8002', '\ufffd', '\u1234', '\ud800', '\udfff' }, 0, 6, "\u8001\u8002\ufffd\u1234\ud800\udfff")] + public static void Ctor_CharSpan(char[] valueArray, int startIndex, int length, string expected) + { + var span = new ReadOnlySpan(valueArray, startIndex, length); + Assert.Equal(expected, new string(span)); + } + + [Fact] + public static void Create_InvalidArguments_Throw() + { + AssertExtensions.Throws("action", () => string.Create(-1, 0, null)); + AssertExtensions.Throws("length", () => string.Create(-1, 0, (span, state) => { })); + } + + [Fact] + public static void Create_Length0_ReturnsEmptyString() + { + bool actionInvoked = false; + Assert.Same(string.Empty, string.Create(0, 0, (span, state) => actionInvoked = true)); + Assert.False(actionInvoked); + } + + [Fact] + public static void Create_NullState_Allowed() + { + string result = string.Create(1, (object)null, (span, state) => + { + span[0] = 'a'; + Assert.Null(state); + }); + Assert.Equal("a", result); + } + + [Fact] + public static void Create_ClearsMemory() + { + const int Length = 10; + string result = string.Create(Length, (object)null, (span, state) => + { + for (int i = 0; i < span.Length; i++) + { + Assert.Equal('\0', span[i]); + } + }); + Assert.Equal(new string('\0', Length), result); + } + + [Theory] + [InlineData("a")] + [InlineData("this is a test")] + [InlineData("\0\u8001\u8002\ufffd\u1234\ud800\udfff")] + public static void Create_ReturnsExpectedString(string expected) + { + char[] input = expected.ToCharArray(); + string result = string.Create(input.Length, input, (span, state) => + { + Assert.Same(input, state); + for (int i = 0; i < state.Length; i++) + { + span[i] = state[i]; + } + }); + Assert.Equal(expected, result); + } + [Theory] // CurrentCulture [InlineData("Hello", "ello", StringComparison.CurrentCulture, true)] diff --git a/external/corefx/src/System.Runtime/tests/System/Text/StringBuilderTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/Text/StringBuilderTests.netcoreapp.cs index b17bf3168b..799489568d 100644 --- a/external/corefx/src/System.Runtime/tests/System/Text/StringBuilderTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime/tests/System/Text/StringBuilderTests.netcoreapp.cs @@ -127,5 +127,77 @@ namespace System.Text.Tests AssertExtensions.Throws(s_noCapacityParamName, () => CreateBuilderWithNoSpareCapacity().AppendJoin(separator, enumerable)); AssertExtensions.Throws(s_noCapacityParamName, () => CreateBuilderWithNoSpareCapacity().AppendJoin(separator, stringValues)); } + + [Theory] + [InlineData("Hello", new char[] { 'a' }, "Helloa")] + [InlineData("Hello", new char[] { 'b', 'c', 'd' }, "Hellobcd")] + [InlineData("Hello", new char[] { 'b', '\0', 'd' }, "Hellob\0d")] + [InlineData("", new char[] { 'e', 'f', 'g' }, "efg")] + [InlineData("Hello", new char[0], "Hello")] + public static void Append_CharSpan(string original, char[] value, string expected) + { + var builder = new StringBuilder(original); + builder.Append(new ReadOnlySpan(value)); + Assert.Equal(expected, builder.ToString()); + } + + [Theory] + [InlineData("Hello", 0, new char[] { '\0', '\0', '\0', '\0', '\0' }, 5, new char[] { 'H', 'e', 'l', 'l', 'o' })] + [InlineData("Hello", 0, new char[] { '\0', '\0', '\0', '\0' }, 4, new char[] { 'H', 'e', 'l', 'l' })] + [InlineData("Hello", 1, new char[] { '\0', '\0', '\0', '\0', '\0' }, 4, new char[] { 'e', 'l', 'l', 'o', '\0' })] + public static void CopyTo_CharSpan(string value, int sourceIndex, char[] destination, int count, char[] expected) + { + var builder = new StringBuilder(value); + builder.CopyTo(sourceIndex, new Span(destination), count); + Assert.Equal(expected, destination); + } + + [Fact] + public static void CopyTo_CharSpan_StringBuilderWithMultipleChunks() + { + StringBuilder builder = StringBuilderWithMultipleChunks(); + char[] destination = new char[builder.Length]; + builder.CopyTo(0, new Span(destination), destination.Length); + Assert.Equal(s_chunkSplitSource.ToCharArray(), destination); + } + + [Fact] + public static void CopyTo_CharSpan_Invalid() + { + var builder = new StringBuilder("Hello"); + + AssertExtensions.Throws("sourceIndex", () => builder.CopyTo(-1, new Span(new char[10]), 0)); // Source index < 0 + AssertExtensions.Throws("sourceIndex", () => builder.CopyTo(6, new Span(new char[10]), 0)); // Source index > builder.Length + + AssertExtensions.Throws("count", () => builder.CopyTo(0, new Span(new char[10]), -1)); // Count < 0 + + AssertExtensions.Throws(null, () => builder.CopyTo(5, new Span(new char[10]), 1)); // Source index + count > builder.Length + AssertExtensions.Throws(null, () => builder.CopyTo(4, new Span(new char[10]), 2)); // Source index + count > builder.Length + + AssertExtensions.Throws(null, () => builder.CopyTo(0, new Span(new char[10]), 11)); // count > destinationArray.Length + } + + [Theory] + [InlineData("Hello", 0, new char[] { '\0' }, "\0Hello")] + [InlineData("Hello", 3, new char[] { 'a', 'b', 'c' }, "Helabclo")] + [InlineData("Hello", 5, new char[] { 'd', 'e', 'f' }, "Hellodef")] + [InlineData("Hello", 0, new char[0], "Hello")] + public static void Insert_CharSpan(string original, int index, char[] value, string expected) + { + var builder = new StringBuilder(original); + builder.Insert(index, new ReadOnlySpan(value)); + Assert.Equal(expected, builder.ToString()); + } + + [Fact] + public static void Insert_CharSpan_Invalid() + { + var builder = new StringBuilder(0, 5); + builder.Append("Hello"); + + AssertExtensions.Throws("index", () => builder.Insert(-1, new ReadOnlySpan(new char[0]))); // Index < 0 + AssertExtensions.Throws("index", () => builder.Insert(builder.Length + 1, new ReadOnlySpan(new char[0]))); // Index > builder.Length + AssertExtensions.Throws("requiredLength", () => builder.Insert(builder.Length, new ReadOnlySpan(new char[1]))); // New length > builder.MaxCapacity + } } } diff --git a/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.cs b/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.cs index 61e136eb12..9efe0b0aeb 100644 --- a/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.cs @@ -508,16 +508,71 @@ namespace System.Tests public static IEnumerable Parse_Valid_TestData() { + // Space is trimmed before and after yield return new object[] { " 12:24:02", null, new TimeSpan(0, 12, 24, 2, 0) }; + yield return new object[] { "12:24:02 ", null, new TimeSpan(0, 12, 24, 2, 0) }; + yield return new object[] { " 12:24:02 ", null, new TimeSpan(0, 12, 24, 2, 0) }; + // Positive and negative 0 are both valid + yield return new object[] { "0", null, new TimeSpan(0, 0, 0, 0, 0) }; + + // HH:MM yield return new object[] { "12:24", null, new TimeSpan(0, 12, 24, 0, 0) }; - yield return new object[] { "12:24:02", null, new TimeSpan(0, 12, 24, 2, 0) }; - yield return new object[] { "1.12:24:02", null, new TimeSpan(1, 12, 24, 2, 0) }; - yield return new object[] { "1:12:24:02", null, new TimeSpan(1, 12, 24, 2, 0) }; - yield return new object[] { "1.12:24:02.999", null, new TimeSpan(1, 12, 24, 2, 999) }; - yield return new object[] { "-12:24:02", null, new TimeSpan(0, -12, -24, -2, 0) }; - yield return new object[] { "-1.12:24:02.999", null, new TimeSpan(-1, -12, -24, -2, -999) }; + // HH:MM:SS + yield return new object[] { "12:24:02", null, new TimeSpan(0, 12, 24, 2, 0) }; + + // DD.HH:MM + yield return new object[] { "12.03:04", null, new TimeSpan(12, 3, 4, 0, 0) }; + + // HH:MM:SS.FF + yield return new object[] { "12:24:02.01", CultureInfo.InvariantCulture, new TimeSpan(0, 12, 24, 2, 10) }; + + // HH:MM:SS.FF w/ varying length zero prefixes on the fraction + yield return new object[] { "1:1:1.0", CultureInfo.InvariantCulture, new TimeSpan(1, 1, 1) }; + yield return new object[] { "1:1:1.0000000", CultureInfo.InvariantCulture, new TimeSpan(1, 1, 1) }; + yield return new object[] { "1:1:1.1", CultureInfo.InvariantCulture, new TimeSpan(0, 1, 1, 1, 100) }; + yield return new object[] { "1:1:1.01", CultureInfo.InvariantCulture, new TimeSpan(0, 1, 1, 1, 10) }; + yield return new object[] { "1:1:1.001", CultureInfo.InvariantCulture, new TimeSpan(0, 1, 1, 1, 1) }; + yield return new object[] { "1:1:1.0001", CultureInfo.InvariantCulture, new TimeSpan(36610001000) }; + yield return new object[] { "1:1:1.00001", CultureInfo.InvariantCulture, new TimeSpan(36610000100) }; + yield return new object[] { "1:1:1.000001", CultureInfo.InvariantCulture, new TimeSpan(36610000010) }; + yield return new object[] { "1:1:1.0000001", CultureInfo.InvariantCulture, new TimeSpan(36610000001) }; + yield return new object[] { "1:1:1.00000001", CultureInfo.InvariantCulture, new TimeSpan(36610000001) }; + + // DD.HH:MM:SS + yield return new object[] { "1.12:24:02", null, new TimeSpan(1, 12, 24, 2, 0) }; + + // DD:HH:MM:SS + yield return new object[] { "1:12:24:02", null, new TimeSpan(1, 12, 24, 2, 0) }; + + // DD.HH:MM:.FF + yield return new object[] { "01.23:45:.67", CultureInfo.InvariantCulture, new TimeSpan(1, 23, 45, 0, 670) }; + + // DD.HH.MM:SS.FFF + yield return new object[] { "1.12:24:02.999", CultureInfo.InvariantCulture, new TimeSpan(1, 12, 24, 2, 999) }; + + // HH:MM::.FF w/ varying length zero prefixes on the fraction + yield return new object[] { "1:1:.1", CultureInfo.InvariantCulture, new TimeSpan(36601000000) }; + yield return new object[] { "1:1:.01", CultureInfo.InvariantCulture, new TimeSpan(36600100000) }; + yield return new object[] { "1:1:.001", CultureInfo.InvariantCulture, new TimeSpan(36600010000) }; + yield return new object[] { "1:1:.0001", CultureInfo.InvariantCulture, new TimeSpan(36600001000) }; + yield return new object[] { "1:1:.00001", CultureInfo.InvariantCulture, new TimeSpan(36600000100) }; + yield return new object[] { "1:1:.000001", CultureInfo.InvariantCulture, new TimeSpan(36600000010) }; + yield return new object[] { "1:1:.0000001", CultureInfo.InvariantCulture, new TimeSpan(36600000001) }; + yield return new object[] { "1:1:.00000001", CultureInfo.InvariantCulture, new TimeSpan(36600000001) }; + + // Just below overflow on various components + yield return new object[] { "10675199", null, new TimeSpan(9223371936000000000) }; + yield return new object[] { "10675199:00:00", null, new TimeSpan(9223371936000000000) }; + yield return new object[] { "10675199:02:00:00", null, new TimeSpan(9223372008000000000) }; + yield return new object[] { "10675199:02:48:00", null, new TimeSpan(9223372036800000000) }; + yield return new object[] { "10675199:02:48:05", null, new TimeSpan(9223372036850000000) }; + yield return new object[] { "10675199:02:48:05.4775", CultureInfo.InvariantCulture, new TimeSpan(9223372036854775000) }; + yield return new object[] { "00:00:59", null, new TimeSpan(0, 0, 59) }; + yield return new object[] { "00:59:00", null, new TimeSpan(0, 59, 0) }; + yield return new object[] { "23:00:00", null, new TimeSpan(23, 0, 0) }; + yield return new object[] { "24:00:00", null, new TimeSpan(24, 0, 0, 0) }; // Croatia uses ',' in place of '.' CultureInfo croatianCulture = new CultureInfo("hr-HR"); @@ -540,22 +595,50 @@ namespace System.Tests Assert.Equal(expected, result); Assert.Equal(expected, TimeSpan.Parse(input, provider)); + + // Also negate + if (!char.IsWhiteSpace(input[0])) + { + Assert.Equal(-expected, TimeSpan.Parse("-" + input, provider)); + Assert.True(TimeSpan.TryParse("-" + input, provider, out result)); + Assert.Equal(-expected, result); + } } public static IEnumerable Parse_Invalid_TestData() { - yield return new object[] { null, null, typeof(ArgumentNullException) }; + // FormatExceptions + yield return new object[] { null, null, typeof(ArgumentNullException) }; // null input + yield return new object[] { "", null, typeof(FormatException) }; // empty input + yield return new object[] { "-", null, typeof(FormatException) }; // invalid sole separator + yield return new object[] { "garbage", null, typeof(FormatException) }; // garbage input + yield return new object[] { "12/12/12", null, typeof(FormatException) }; // unexpected separators + yield return new object[] { "00:", null, typeof(FormatException) }; // missing number at end + yield return new object[] { "00:00:-01", null, typeof(FormatException) }; // misplaced negative + yield return new object[] { "\012:34:56", null, typeof(FormatException) }; // null char at front + yield return new object[] { "1\02:34:56", null, typeof(FormatException) }; // null char in HH + yield return new object[] { "12\0:34:56", null, typeof(FormatException) }; // null char at end of component + yield return new object[] { "00:00::00", null, typeof(FormatException) }; // duplicated separator + yield return new object[] { "00:00:00:", null, typeof(FormatException) }; // extra separator at end + yield return new object[] { "00:00:00:00:00:00:00:00", null, typeof(FormatException) }; // too many components + yield return new object[] { "6:12:14:45.3448", new CultureInfo("hr-HR"), typeof(FormatException) }; // culture that uses ',' rather than '.' - yield return new object[] { "", null, typeof(FormatException) }; - yield return new object[] { "-", null, typeof(FormatException) }; - yield return new object[] { "garbage", null, typeof(FormatException) }; - yield return new object[] { "12/12/12", null, typeof(FormatException) }; - - yield return new object[] { "1:1:1.99999999", null, typeof(OverflowException) }; - - // Croatia uses ',' in place of '.' - CultureInfo croatianCulture = new CultureInfo("hr-HR"); - yield return new object[] { "6:12:14:45.3448", croatianCulture, typeof(FormatException) }; + // OverflowExceptions + yield return new object[] { "1:1:1.99999999", null, typeof(OverflowException) }; // overflowing fraction + yield return new object[] { "1:1:1.000000001", null, typeof(OverflowException) }; // too many leading zeroes in fraction + yield return new object[] { "2147483647", null, typeof(OverflowException) }; // overflowing value == int.MaxValue + yield return new object[] { "2147483648", null, typeof(OverflowException) }; // overflowing value == int.MaxValue + 1 + yield return new object[] { "10675200", null, typeof(OverflowException) }; // overflowing number of days + yield return new object[] { "10675200:00:00", null, typeof(OverflowException) }; // overflowing number of hours + yield return new object[] { "10675199:03:00:00", null, typeof(OverflowException) }; // overflowing number of days + hours + yield return new object[] { "10675199:02:49:00", null, typeof(OverflowException) }; // overflowing number of days + hours + minutes + yield return new object[] { "10675199:02:48:06", null, typeof(OverflowException) }; // overflowing number of days + hours + minutes + seconds + yield return new object[] { "-10675199:02:48:06", null, typeof(OverflowException) }; // negative overflowing d + h + m + s + yield return new object[] { "10675199:02:48:05.4776", CultureInfo.InvariantCulture, typeof(OverflowException) }; // overflowing days + hours + minutes + seconds + fraction + yield return new object[] { "-10675199:02:48:05.4776", CultureInfo.InvariantCulture, typeof(OverflowException) }; // negative overflowing d + h + m + s +f + yield return new object[] { "00:00:60", null, typeof(OverflowException) }; // overflowing seconds + yield return new object[] { "00:60:00", null, typeof(OverflowException) }; // overflowing minutes + yield return new object[] { "24:00", null, typeof(OverflowException) }; // overflowing hours } [Theory] @@ -579,20 +662,47 @@ namespace System.Tests public static IEnumerable ParseExact_Valid_TestData() { // Standard timespan formats 'c', 'g', 'G' - yield return new object[] { "12:24:02", "c", new TimeSpan(0, 12, 24, 2) }; - yield return new object[] { "1.12:24:02", "c", new TimeSpan(1, 12, 24, 2) }; - yield return new object[] { "-01.07:45:16.999", "c", new TimeSpan(1, 7, 45, 16, 999).Negate() }; - yield return new object[] { "12:24:02", "g", new TimeSpan(0, 12, 24, 2) }; - yield return new object[] { "1:12:24:02", "g", new TimeSpan(1, 12, 24, 2) }; - yield return new object[] { "-01:07:45:16.999", "g", new TimeSpan(1, 7, 45, 16, 999).Negate() }; - yield return new object[] { "1:12:24:02.243", "G", new TimeSpan(1, 12, 24, 2, 243) }; - yield return new object[] { "-01:07:45:16.999", "G", new TimeSpan(1, 7, 45, 16, 999).Negate() }; + foreach (string constFormat in new[] { "c", "t", "T" }) // "t" and "T" are the same as "c" + { + yield return new object[] { "12:24:02", constFormat, new TimeSpan(0, 12, 24, 2) }; // HH:MM:SS + yield return new object[] { "1.12:24:02", constFormat, new TimeSpan(1, 12, 24, 2) }; // DD.HH:MM:SS + yield return new object[] { "-01.07:45:16.999", constFormat, -new TimeSpan(1, 7, 45, 16, 999) }; // -DD.HH:MM:SS.FFF + } + + // "g" + yield return new object[] { "12", "g", new TimeSpan(12, 0, 0, 0) }; // days + yield return new object[] { "-12", "g", new TimeSpan(-12, 0, 0, 0) }; // negative days + yield return new object[] { "12:34", "g", new TimeSpan(12, 34, 00) }; // HH:MM + yield return new object[] { "-12:34", "g", -new TimeSpan(12, 34, 00) }; // -HH:MM + yield return new object[] { "1:2:.3", "g", new TimeSpan(0, 1, 2, 0, 300) }; // HH:MM:.FF + yield return new object[] { "-1:2:.3", "g", -new TimeSpan(0, 1, 2, 0, 300) }; // -HH:MM:.FF + yield return new object[] { "12:24:02", "g", new TimeSpan(0, 12, 24, 2) }; // HH:MM:SS + yield return new object[] { "12:24:02.123", "g", new TimeSpan(0, 12, 24, 2, 123) }; // HH:MM:SS.FFF + yield return new object[] { "-12:24:02.123", "g", -new TimeSpan(0, 12, 24, 2, 123) }; // -HH:MM:SS.FFF + yield return new object[] { "1:2:3:.4", "g", new TimeSpan(1, 2, 3, 0, 400) }; // DD:HH:MM:.FF + yield return new object[] { "-1:2:3:.4", "g", -new TimeSpan(1, 2, 3, 0, 400) }; // -DD:HH:MM:.FF + yield return new object[] { "1:12:24:02", "g", new TimeSpan(1, 12, 24, 2) }; // DD:HH:MM:SS + yield return new object[] { "-01:07:45:16.999", "g", -new TimeSpan(1, 7, 45, 16, 999) }; // -DD:HH:MM:SS.FFF + + // "G" + yield return new object[] { "1:12:24:02.243", "G", new TimeSpan(1, 12, 24, 2, 243) }; // DD:MM:HH:SS.FFF + yield return new object[] { "-01:07:45:16.999", "G", -new TimeSpan(1, 7, 45, 16, 999) }; // -DD:MM:HH:SS.FFF // Custom timespan formats yield return new object[] { "12.23:32:43", @"dd\.h\:m\:s", new TimeSpan(12, 23, 32, 43) }; yield return new object[] { "012.23:32:43.893", @"ddd\.h\:m\:s\.fff", new TimeSpan(12, 23, 32, 43, 893) }; yield return new object[] { "12.05:02:03", @"d\.hh\:mm\:ss", new TimeSpan(12, 5, 2, 3) }; yield return new object[] { "12:34 minutes", @"mm\:ss\ \m\i\n\u\t\e\s", new TimeSpan(0, 12, 34) }; + yield return new object[] { "12:34 minutes", @"mm\:ss\ ""minutes""", new TimeSpan(0, 12, 34) }; + yield return new object[] { "12:34 minutes", @"mm\:ss\ 'minutes'", new TimeSpan(0, 12, 34) }; + yield return new object[] { "678", "fff", new TimeSpan(0, 0, 0, 0, 678) }; + yield return new object[] { "678", "FFF", new TimeSpan(0, 0, 0, 0, 678) }; + yield return new object[] { "3", "%d", new TimeSpan(3, 0, 0, 0, 0) }; + yield return new object[] { "3", "%h", new TimeSpan(3, 0, 0) }; + yield return new object[] { "3", "%m", new TimeSpan(0, 3, 0) }; + yield return new object[] { "3", "%s", new TimeSpan(0, 0, 3) }; + yield return new object[] { "3", "%f", new TimeSpan(0, 0, 0, 0, 300) }; + yield return new object[] { "3", "%F", new TimeSpan(0, 0, 0, 0, 300) }; } [Theory] @@ -601,30 +711,49 @@ namespace System.Tests { TimeSpan result; Assert.Equal(expected, TimeSpan.ParseExact(input, format, new CultureInfo("en-US"))); + Assert.Equal(expected, TimeSpan.ParseExact(input, new[] { format }, new CultureInfo("en-US"))); Assert.True(TimeSpan.TryParseExact(input, format, new CultureInfo("en-US"), out result)); Assert.Equal(expected, result); - // TimeSpanStyles is interpreted only for custom formats - if (format != "c" && format != "g" && format != "G") + Assert.True(TimeSpan.TryParseExact(input, new[] { format }, new CultureInfo("en-US"), out result)); + Assert.Equal(expected, result); + + if (format != "c" && format != "t" && format != "T" && format != "g" && format != "G") { + // TimeSpanStyles is interpreted only for custom formats Assert.Equal(expected.Negate(), TimeSpan.ParseExact(input, format, new CultureInfo("en-US"), TimeSpanStyles.AssumeNegative)); Assert.True(TimeSpan.TryParseExact(input, format, new CultureInfo("en-US"), TimeSpanStyles.AssumeNegative, out result)); Assert.Equal(expected.Negate(), result); } + else + { + // Inputs that can be parsed in standard formats with ParseExact should also be parsable with Parse + Assert.Equal(expected, TimeSpan.Parse(input, CultureInfo.InvariantCulture)); + + Assert.True(TimeSpan.TryParse(input, CultureInfo.InvariantCulture, out result)); + Assert.Equal(expected, result); + } } public static IEnumerable ParseExact_Invalid_TestData() { yield return new object[] { null, "c", typeof(ArgumentNullException) }; - + yield return new object[] { "00:00:00", null, typeof(ArgumentNullException) }; yield return new object[] { "", "c", typeof(FormatException) }; yield return new object[] { "-", "c", typeof(FormatException) }; yield return new object[] { "garbage", "c", typeof(FormatException) }; // Standard timespan formats 'c', 'g', 'G' yield return new object[] { "24:24:02", "c", typeof(OverflowException) }; + yield return new object[] { "1:60:02", "c", typeof(OverflowException) }; + yield return new object[] { "1:59:60", "c", typeof(OverflowException) }; + yield return new object[] { "1.24:59:02", "c", typeof(OverflowException) }; + yield return new object[] { "1.2:60:02", "c", typeof(OverflowException) }; + yield return new object[] { "1?59:02", "c", typeof(FormatException) }; + yield return new object[] { "1:59?02", "c", typeof(FormatException) }; + yield return new object[] { "1:59:02?123", "c", typeof(FormatException) }; yield return new object[] { "1:12:24:02", "c", typeof(FormatException) }; yield return new object[] { "12:61:02", "g", typeof(OverflowException) }; yield return new object[] { "1.12:24:02", "g", typeof(FormatException) }; @@ -635,6 +764,31 @@ namespace System.Tests yield return new object[] { "12.35:32:43", @"dd\.h\:m\:s", typeof(OverflowException) }; yield return new object[] { "12.5:2:3", @"d\.hh\:mm\:ss", typeof(FormatException) }; yield return new object[] { "12.5:2", @"d\.hh\:mm\:ss", typeof(FormatException) }; + yield return new object[] { "678", @"ffff", typeof(FormatException) }; + yield return new object[] { "00000012", @"FFFFFFFF", typeof(FormatException) }; + yield return new object[] { "12:034:56", @"hh\mm\ss", typeof(FormatException) }; + yield return new object[] { "12:34:056", @"hh\mm\ss", typeof(FormatException) }; + yield return new object[] { "12:34 minutes", @"mm\:ss\ ""minutes", typeof(FormatException) }; + yield return new object[] { "12:34 minutes", @"mm\:ss\ 'minutes", typeof(FormatException) }; + yield return new object[] { "12:34 mints", @"mm\:ss\ ""minutes""", typeof(FormatException) }; + yield return new object[] { "12:34 mints", @"mm\:ss\ 'minutes'", typeof(FormatException) }; + yield return new object[] { "1", @"d%", typeof(FormatException) }; + yield return new object[] { "1", @"%%d", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"hhh\:mm\:ss", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"hh\:hh\:ss", typeof(FormatException) }; + yield return new object[] { "123:34:56", @"hh\:mm\:ss", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"hh\:mmm\:ss", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"hh\:mm\:mm", typeof(FormatException) }; + yield return new object[] { "12:345:56", @"hh\:mm\:ss", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"hh\:mm\:sss", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"hh\:ss\:ss", typeof(FormatException) }; + yield return new object[] { "12:45", @"ff:ff", typeof(FormatException) }; + yield return new object[] { "000000123", @"ddddddddd", typeof(FormatException) }; + yield return new object[] { "12:34:56", @"dd:dd:hh", typeof(FormatException) }; + yield return new object[] { "123:45", @"dd:hh", typeof(FormatException) }; + yield return new object[] { "12:34", @"dd:vv", typeof(FormatException) }; + yield return new object[] { "00:00:00", "", typeof(FormatException) }; + yield return new object[] { "12.5:2", @"V", typeof(FormatException) }; } [Theory] @@ -646,6 +800,21 @@ namespace System.Tests TimeSpan result; Assert.False(TimeSpan.TryParseExact(input, format, new CultureInfo("en-US"), out result)); Assert.Equal(TimeSpan.Zero, result); + + Assert.False(TimeSpan.TryParseExact(input, new[] { format }, new CultureInfo("en-US"), out result)); + Assert.Equal(TimeSpan.Zero, result); + } + + [Fact] + public static void ParseExactMultiple_InvalidNullEmptyFormats() + { + TimeSpan result; + + AssertExtensions.Throws("formats", () => TimeSpan.ParseExact("12:34:56", (string[])null, null)); + Assert.False(TimeSpan.TryParseExact("12:34:56", (string[])null, null, out result)); + + Assert.Throws(() => TimeSpan.ParseExact("12:34:56", new string[0], null)); + Assert.False(TimeSpan.TryParseExact("12:34:56", new string[0], null, out result)); } public static IEnumerable Subtract_TestData() @@ -677,38 +846,42 @@ namespace System.Tests Assert.Throws(() => TimeSpan.MinValue - new TimeSpan(1)); // Result < TimeSpan.MinValue } - [Fact] - public static void ToStringTest() + public static IEnumerable ToString_MemberData() { - var timeSpan1 = new TimeSpan(1, 2, 3); - var timeSpan2 = new TimeSpan(1, 2, 3); - var timeSpan3 = new TimeSpan(1, 2, 4); + var input = new TimeSpan(123456789101112); - var timeSpan4 = new TimeSpan(1, 2, 3, 4); - var timeSpan5 = new TimeSpan(1, 2, 3, 4); - var timeSpan6 = new TimeSpan(1, 2, 3, 5); + yield return new object[] { input, null, "142.21:21:18.9101112" }; + yield return new object[] { input, "c", "142.21:21:18.9101112" }; + yield return new object[] { input, "t", "142.21:21:18.9101112" }; + yield return new object[] { input, "T", "142.21:21:18.9101112" }; + yield return new object[] { input, "g", "142:21:21:18.9101112" }; + yield return new object[] { input, "%d", "142" }; + yield return new object[] { input, "dd", "142" }; + yield return new object[] { input, "%h", "21" }; + yield return new object[] { input, "hh", "21" }; + yield return new object[] { input, "%m", "21" }; + yield return new object[] { input, "mm", "21" }; + yield return new object[] { input, "%s", "18" }; + yield return new object[] { input, "ss", "18" }; + yield return new object[] { input, "%f", "9" }; + yield return new object[] { input, "ff", "91" }; + yield return new object[] { input, "fff", "910" }; + yield return new object[] { input, "ffff", "9101" }; + yield return new object[] { input, "fffff", "91011" }; + yield return new object[] { input, "ffffff", "910111" }; + yield return new object[] { input, "fffffff", "9101112" }; + yield return new object[] { input, "dd\\.ss", "142.18" }; + } - var timeSpan7 = new TimeSpan(1, 2, 3, 4, 5); - var timeSpan8 = new TimeSpan(1, 2, 3, 4, 5); - var timeSpan9 = new TimeSpan(1, 2, 3, 4, 6); - - Assert.Equal(timeSpan1.ToString(), timeSpan2.ToString()); - Assert.Equal(timeSpan1.ToString("c"), timeSpan2.ToString("c")); - Assert.Equal(timeSpan1.ToString("c", null), timeSpan2.ToString("c", null)); - Assert.NotEqual(timeSpan1.ToString(), timeSpan3.ToString()); - Assert.NotEqual(timeSpan1.ToString(), timeSpan4.ToString()); - Assert.NotEqual(timeSpan1.ToString(), timeSpan7.ToString()); - - Assert.Equal(timeSpan4.ToString(), timeSpan5.ToString()); - Assert.Equal(timeSpan4.ToString("c"), timeSpan5.ToString("c")); - Assert.Equal(timeSpan4.ToString("c", null), timeSpan5.ToString("c", null)); - Assert.NotEqual(timeSpan4.ToString(), timeSpan6.ToString()); - Assert.NotEqual(timeSpan4.ToString(), timeSpan7.ToString()); - - Assert.Equal(timeSpan7.ToString(), timeSpan8.ToString()); - Assert.Equal(timeSpan7.ToString("c"), timeSpan8.ToString("c")); - Assert.Equal(timeSpan7.ToString("c", null), timeSpan8.ToString("c", null)); - Assert.NotEqual(timeSpan7.ToString(), timeSpan9.ToString()); + [Theory] + [MemberData(nameof(ToString_MemberData))] + public static void ToString_Valid(TimeSpan input, string format, string expected) + { + Assert.Equal(expected, input.ToString(format, CultureInfo.InvariantCulture)); + if (format == null) + { + Assert.Equal(expected, input.ToString()); + } } [Fact] diff --git a/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.netcoreapp.cs index f4c6ef025f..7afccf4d8e 100644 --- a/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime/tests/System/TimeSpanTests.netcoreapp.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Globalization; using Xunit; namespace System.Tests @@ -109,5 +110,128 @@ namespace System.Tests { AssertExtensions.Throws("divisor", () => TimeSpan.FromDays(1).Divide(double.NaN)); } + + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span(string inputString, IFormatProvider provider, TimeSpan expected) + { + ReadOnlySpan input = inputString.AsReadOnlySpan(); + TimeSpan result; + + Assert.Equal(expected, TimeSpan.Parse(input, provider)); + Assert.True(TimeSpan.TryParse(input, out result, provider)); + Assert.Equal(expected, result); + + // Also negate + if (!char.IsWhiteSpace(input[0])) + { + input = ("-" + inputString).AsReadOnlySpan(); + expected = -expected; + + Assert.Equal(expected, TimeSpan.Parse(input, provider)); + Assert.True(TimeSpan.TryParse(input, out result, provider)); + Assert.Equal(expected, result); + } + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string inputString, IFormatProvider provider, Type exceptionType) + { + if (inputString != null) + { + Assert.Throws(exceptionType, () => TimeSpan.Parse(inputString.AsReadOnlySpan(), provider)); + Assert.False(TimeSpan.TryParse(inputString.AsReadOnlySpan(), out TimeSpan result, provider)); + Assert.Equal(TimeSpan.Zero, result); + } + } + + + + [Theory] + [MemberData(nameof(ParseExact_Valid_TestData))] + public static void ParseExact_Span_Valid(string inputString, string format, TimeSpan expected) + { + ReadOnlySpan input = inputString.AsReadOnlySpan(); + + TimeSpan result; + Assert.Equal(expected, TimeSpan.ParseExact(input, format, new CultureInfo("en-US"))); + Assert.Equal(expected, TimeSpan.ParseExact(input, new[] { format }, new CultureInfo("en-US"))); + + Assert.True(TimeSpan.TryParseExact(input, format, new CultureInfo("en-US"), out result)); + Assert.Equal(expected, result); + + Assert.True(TimeSpan.TryParseExact(input, new[] { format }, new CultureInfo("en-US"), out result)); + Assert.Equal(expected, result); + + if (format != "c" && format != "t" && format != "T" && format != "g" && format != "G") + { + // TimeSpanStyles is interpreted only for custom formats + Assert.Equal(expected.Negate(), TimeSpan.ParseExact(input, format, new CultureInfo("en-US"), TimeSpanStyles.AssumeNegative)); + + Assert.True(TimeSpan.TryParseExact(input, format, new CultureInfo("en-US"), out result, TimeSpanStyles.AssumeNegative)); + Assert.Equal(expected.Negate(), result); + } + else + { + // Inputs that can be parsed in standard formats with ParseExact should also be parsable with Parse + Assert.Equal(expected, TimeSpan.Parse(input, CultureInfo.InvariantCulture)); + + Assert.True(TimeSpan.TryParse(input, out result, CultureInfo.InvariantCulture)); + Assert.Equal(expected, result); + } + } + + [Theory] + [MemberData(nameof(ParseExact_Invalid_TestData))] + public static void ParseExactTest__Span_Invalid(string inputString, string format, Type exceptionType) + { + if (inputString != null) + { + Assert.Throws(exceptionType, () => TimeSpan.ParseExact(inputString.AsReadOnlySpan(), format, new CultureInfo("en-US"))); + + TimeSpan result; + Assert.False(TimeSpan.TryParseExact(inputString.AsReadOnlySpan(), format, new CultureInfo("en-US"), out result)); + Assert.Equal(TimeSpan.Zero, result); + + Assert.False(TimeSpan.TryParseExact(inputString.AsReadOnlySpan(), new[] { format }, new CultureInfo("en-US"), out result)); + Assert.Equal(TimeSpan.Zero, result); + } + } + + [Fact] + public static void ParseExactMultiple_Span_InvalidNullEmptyFormats() + { + TimeSpan result; + + AssertExtensions.Throws("formats", () => TimeSpan.ParseExact("12:34:56".AsReadOnlySpan(), (string[])null, null)); + Assert.False(TimeSpan.TryParseExact("12:34:56".AsReadOnlySpan(), (string[])null, null, out result)); + + Assert.Throws(() => TimeSpan.ParseExact("12:34:56".AsReadOnlySpan(), new string[0], null)); + Assert.False(TimeSpan.TryParseExact("12:34:56".AsReadOnlySpan(), new string[0], null, out result)); + } + + [Theory] + [MemberData(nameof(ToString_MemberData))] + public static void TryFormat_Valid(TimeSpan input, string format, string expected) + { + int charsWritten; + Span dst; + + dst = new char[expected.Length - 1]; + Assert.False(input.TryFormat(dst, out charsWritten, format, CultureInfo.InvariantCulture)); + Assert.Equal(0, charsWritten); + + dst = new char[expected.Length]; + Assert.True(input.TryFormat(dst, out charsWritten, format, CultureInfo.InvariantCulture)); + Assert.Equal(expected.Length, charsWritten); + Assert.Equal(expected, new string(dst)); + + dst = new char[expected.Length + 1]; + Assert.True(input.TryFormat(dst, out charsWritten, format, CultureInfo.InvariantCulture)); + Assert.Equal(expected.Length, charsWritten); + Assert.Equal(expected, new string(dst.Slice(0, dst.Length - 1))); + Assert.Equal(0, dst[dst.Length - 1]); + } } } diff --git a/external/corefx/src/System.Runtime/tests/System/TimeZoneInfoTests.cs.REMOVED.git-id b/external/corefx/src/System.Runtime/tests/System/TimeZoneInfoTests.cs.REMOVED.git-id index 4ecc97068b..4e55412372 100644 --- a/external/corefx/src/System.Runtime/tests/System/TimeZoneInfoTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Runtime/tests/System/TimeZoneInfoTests.cs.REMOVED.git-id @@ -1 +1 @@ -241d0cc137ffe3b3dda5dee5494817abcfb2ec1f \ No newline at end of file +0ff4adc60ccf764da518c02d303602bd5e928c3f \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/tests/System/TypeTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/TypeTests.netcoreapp.cs index 1d2a5ce7aa..c47e6c6fb7 100644 --- a/external/corefx/src/System.Runtime/tests/System/TypeTests.netcoreapp.cs +++ b/external/corefx/src/System.Runtime/tests/System/TypeTests.netcoreapp.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using Xunit; namespace System.Tests @@ -199,5 +200,88 @@ namespace System.Tests yield return new object[] { theT }; } } + + [Theory] + [MemberData(nameof(IsByRefLikeTestData))] + public static void TestIsByRefLike(Type type, bool expected) + { + Assert.Equal(expected, type.IsByRefLike); + } + + public static IEnumerable IsByRefLikeTestData + { + get + { + Type theT = typeof(Outside<>).GetTypeInfo().GenericTypeParameters[0]; + + yield return new object[] { typeof(TypedReference), true }; + yield return new object[] { typeof(Span<>), true }; + yield return new object[] { typeof(Span), true }; + yield return new object[] { typeof(Span<>).MakeGenericType(theT), true }; + yield return new object[] { typeof(ByRefLikeStruct), true }; + yield return new object[] { typeof(RegularStruct), false }; + yield return new object[] { typeof(object), false }; + yield return new object[] { typeof(Span).MakeByRefType(), false }; + yield return new object[] { typeof(Span).MakePointerType(), false }; + yield return new object[] { theT, false }; + yield return new object[] { typeof(int[]), false }; + yield return new object[] { typeof(int[,]), false }; + if (PlatformDetection.IsWindows) // GetTypeFromCLSID is Windows only + { + yield return new object[] { Type.GetTypeFromCLSID(default(Guid)), false }; + } + } + } + + private ref struct ByRefLikeStruct + { + public ByRefLikeStruct(int dummy) + { + S = default(Span); + } + + public Span S; + } + + private struct RegularStruct + { + } + + [Theory] + [MemberData(nameof(IsGenericParameterTestData))] + public static void TestIsGenericParameter(Type type, bool isGenericParameter, bool isGenericTypeParameter, bool isGenericMethodParameter) + { + Assert.Equal(isGenericParameter, type.IsGenericParameter); + Assert.Equal(isGenericTypeParameter, type.IsGenericTypeParameter); + Assert.Equal(isGenericMethodParameter, type.IsGenericMethodParameter); + } + + public static IEnumerable IsGenericParameterTestData + { + get + { + yield return new object[] { typeof(void), false, false, false }; + yield return new object[] { typeof(int), false, false, false }; + yield return new object[] { typeof(int[]), false, false, false }; + yield return new object[] { typeof(int).MakeArrayType(1), false, false, false }; + yield return new object[] { typeof(int[,]), false, false, false }; + yield return new object[] { typeof(int).MakeByRefType(), false, false, false }; + yield return new object[] { typeof(int).MakePointerType(), false, false, false }; + yield return new object[] { typeof(G<>), false, false, false }; + yield return new object[] { typeof(G), false, false, false }; + if (PlatformDetection.IsWindows) // GetTypeFromCLSID is Windows only + { + yield return new object[] { Type.GetTypeFromCLSID(default(Guid)), false, false, false }; + } + + Type theT = typeof(Outside<>).GetTypeInfo().GenericTypeParameters[0]; + yield return new object[] { theT, true, true, false }; + + Type theM = typeof(TypeTestsNetcore).GetMethod(nameof(GenericMethod), BindingFlags.NonPublic | BindingFlags.Static).GetGenericArguments()[0]; + yield return new object[] { theM, true, false, true }; + } + } + + private static void GenericMethod() { } } } diff --git a/external/corefx/src/System.Runtime/tests/System/UInt16Tests.cs b/external/corefx/src/System.Runtime/tests/System/UInt16Tests.cs index c1b3517546..eea5d9fb1a 100644 --- a/external/corefx/src/System.Runtime/tests/System/UInt16Tests.cs +++ b/external/corefx/src/System.Runtime/tests/System/UInt16Tests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class UInt16Tests + public partial class UInt16Tests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/UInt16Tests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/UInt16Tests.netcoreapp.cs new file mode 100644 index 0000000000..5252be020a --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/UInt16Tests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class UInt16Tests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, ushort expected) + { + Assert.Equal(expected, ushort.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(ushort.TryParse(value.AsReadOnlySpan(), out ushort result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => ushort.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(ushort.TryParse(value.AsReadOnlySpan(), out ushort result, style, provider)); + Assert.Equal(0, (short)result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/UInt32Tests.cs b/external/corefx/src/System.Runtime/tests/System/UInt32Tests.cs index 70f32d2bf5..7e1bcc0144 100644 --- a/external/corefx/src/System.Runtime/tests/System/UInt32Tests.cs +++ b/external/corefx/src/System.Runtime/tests/System/UInt32Tests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class UInt32Tests + public partial class UInt32Tests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/UInt32Tests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/UInt32Tests.netcoreapp.cs new file mode 100644 index 0000000000..11ac18b41a --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/UInt32Tests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class UInt32Tests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, uint expected) + { + Assert.Equal(expected, uint.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(uint.TryParse(value.AsReadOnlySpan(), out uint result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => uint.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(uint.TryParse(value.AsReadOnlySpan(), out uint result, style, provider)); + Assert.Equal(0, (int)result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/UInt64Tests.cs b/external/corefx/src/System.Runtime/tests/System/UInt64Tests.cs index bf84ad9488..6202f1156e 100644 --- a/external/corefx/src/System.Runtime/tests/System/UInt64Tests.cs +++ b/external/corefx/src/System.Runtime/tests/System/UInt64Tests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Tests { - public class UInt64Tests + public partial class UInt64Tests { [Fact] public static void Ctor_Empty() diff --git a/external/corefx/src/System.Runtime/tests/System/UInt64Tests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/UInt64Tests.netcoreapp.cs new file mode 100644 index 0000000000..7262572eaa --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/UInt64Tests.netcoreapp.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Globalization; +using Xunit; + +namespace System.Tests +{ + public partial class UInt64Tests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_Valid(string value, NumberStyles style, IFormatProvider provider, ulong expected) + { + Assert.Equal(expected, ulong.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.True(ulong.TryParse(value.AsReadOnlySpan(), out ulong result, style, provider)); + Assert.Equal(expected, result); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType) + { + if (value != null) + { + Assert.Throws(exceptionType, () => ulong.Parse(value.AsReadOnlySpan(), style, provider)); + + Assert.False(ulong.TryParse(value.AsReadOnlySpan(), out ulong result, style, provider)); + Assert.Equal(0, (long)result); + } + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/UnitySerializationHolderTests.cs b/external/corefx/src/System.Runtime/tests/System/UnitySerializationHolderTests.cs new file mode 100644 index 0000000000..ab28b42bad --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/UnitySerializationHolderTests.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization.Formatters.Tests; +using Xunit; + +namespace System.Tests +{ + public class UnitySerializationHolderTests + { + [Fact] + public void UnitySerializationHolderWithAssemblySingleton() + { + const string UnitySerializationHolderAssemblyBase64String = "AAEAAAD/////AQAAAAAAAAAEAQAAAB9TeXN0ZW0uVW5pdHlTZXJpYWxpemF0aW9uSG9sZGVyAwAAAAREYXRhCVVuaXR5VHlwZQxBc3NlbWJseU5hbWUBAAEIBgIAAABLbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BgAAAAkCAAAACw=="; + AssertExtensions.ThrowsIf(!PlatformDetection.IsFullFramework, + () => BinaryFormatterHelpers.FromBase64String(UnitySerializationHolderAssemblyBase64String)); + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/System/ValueTypeTests.cs b/external/corefx/src/System.Runtime/tests/System/ValueTypeTests.cs index d0a6668a14..f4a971fa2c 100644 --- a/external/corefx/src/System.Runtime/tests/System/ValueTypeTests.cs +++ b/external/corefx/src/System.Runtime/tests/System/ValueTypeTests.cs @@ -16,10 +16,372 @@ namespace System.Tests Assert.Equal("System.Tests.ValueTypeTests+S", obj.ToString()); } + [Fact] + public static void StructWithDoubleFieldNotTightlyPackedZeroCompareTest() + { + StructWithDoubleFieldNotTightlyPacked obj1 = new StructWithDoubleFieldNotTightlyPacked(); + obj1.value1 = 1; + obj1.value2 = 0.0; + + StructWithDoubleFieldNotTightlyPacked obj2 = new StructWithDoubleFieldNotTightlyPacked(); + obj2.value1 = 1; + obj2.value2 = -0.0; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithDoubleFieldTightlyPackedZeroCompareTest() + { + StructWithDoubleFieldTightlyPacked obj1 = new StructWithDoubleFieldTightlyPacked(); + obj1.value1 = 1; + obj1.value2 = 0.0; + + StructWithDoubleFieldTightlyPacked obj2 = new StructWithDoubleFieldTightlyPacked(); + obj2.value1 = 1; + obj2.value2 = -0.0; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithDoubleFieldNotTightlyPackedNaNCompareTest() + { + StructWithDoubleFieldNotTightlyPacked obj1 = new StructWithDoubleFieldNotTightlyPacked(); + obj1.value1 = 1; + obj1.value2 = double.NaN; + + StructWithDoubleFieldNotTightlyPacked obj2 = new StructWithDoubleFieldNotTightlyPacked(); + obj2.value1 = 1; + obj2.value2 = -double.NaN; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithDoubleFieldTightlyPackedNaNCompareTest() + { + StructWithDoubleFieldTightlyPacked obj1 = new StructWithDoubleFieldTightlyPacked(); + obj1.value1 = 1; + obj1.value2 = double.NaN; + + StructWithDoubleFieldTightlyPacked obj2 = new StructWithDoubleFieldTightlyPacked(); + obj2.value1 = 1; + obj2.value2 = -double.NaN; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithNestedDoubleFieldNotTightlyPackedZeroCompareTest() + { + StructWithDoubleFieldNestedNotTightlyPacked obj1 = new StructWithDoubleFieldNestedNotTightlyPacked(); + obj1.value1.value1 = 1; + obj1.value2.value2 = 0.0; + + StructWithDoubleFieldNestedNotTightlyPacked obj2 = new StructWithDoubleFieldNestedNotTightlyPacked(); + obj2.value1.value1 = 1; + obj2.value2.value2 = -0.0; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithNestedDoubleFieldTightlyPackedZeroCompareTest() + { + StructWithDoubleFieldNestedTightlyPacked obj1 = new StructWithDoubleFieldNestedTightlyPacked(); + obj1.value1.value1 = 1; + obj1.value2.value2 = 0.0; + + StructWithDoubleFieldNestedTightlyPacked obj2 = new StructWithDoubleFieldNestedTightlyPacked(); + obj2.value1.value1 = 1; + obj2.value2.value2 = -0.0; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithNestedDoubleFieldNotTightlyPackedNaNCompareTest() + { + StructWithDoubleFieldNestedNotTightlyPacked obj1 = new StructWithDoubleFieldNestedNotTightlyPacked(); + obj1.value1.value1 = 1; + obj1.value2.value2 = double.NaN; + + StructWithDoubleFieldNestedNotTightlyPacked obj2 = new StructWithDoubleFieldNestedNotTightlyPacked(); + obj2.value1.value1 = 1; + obj2.value2.value2 = -double.NaN; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithNestedDoubleFieldTightlyPackedNaNCompareTest() + { + StructWithDoubleFieldNestedTightlyPacked obj1 = new StructWithDoubleFieldNestedTightlyPacked(); + obj1.value1.value1 = 1; + obj1.value2.value2 = double.NaN; + + StructWithDoubleFieldNestedTightlyPacked obj2 = new StructWithDoubleFieldNestedTightlyPacked(); + obj2.value1.value1 = 1; + obj2.value2.value2 = -double.NaN; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithFloatFieldNotTightlyPackedZeroCompareTest() + { + StructWithFloatFieldNotTightlyPacked obj1 = new StructWithFloatFieldNotTightlyPacked(); + obj1.value1 = 0.0f; + obj1.value2 = 1; + + StructWithFloatFieldNotTightlyPacked obj2 = new StructWithFloatFieldNotTightlyPacked(); + obj2.value1 = -0.0f; + obj2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithFloatFieldTightlyPackedZeroCompareTest() + { + StructWithFloatFieldTightlyPacked obj1 = new StructWithFloatFieldTightlyPacked(); + obj1.value1 = 0.0f; + obj1.value2 = 1; + + StructWithFloatFieldTightlyPacked obj2 = new StructWithFloatFieldTightlyPacked(); + obj2.value1 = -0.0f; + obj2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithFloatFieldNotTightlyPackedNaNCompareTest() + { + StructWithFloatFieldNotTightlyPacked obj1 = new StructWithFloatFieldNotTightlyPacked(); + obj1.value1 = float.NaN; + obj1.value2 = 1; + + StructWithFloatFieldNotTightlyPacked obj2 = new StructWithFloatFieldNotTightlyPacked(); + obj2.value1 = -float.NaN; + obj2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithFloatFieldTightlyPackedNaNCompareTest() + { + StructWithFloatFieldTightlyPacked obj1 = new StructWithFloatFieldTightlyPacked(); + obj1.value1 = float.NaN; + obj1.value2 = 1; + + StructWithFloatFieldTightlyPacked obj2 = new StructWithFloatFieldTightlyPacked(); + obj2.value1 = -float.NaN; + obj2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithNestedFloatFieldNotTightlyPackedZeroCompareTest() + { + StructWithFloatFieldNestedNotTightlyPacked obj1 = new StructWithFloatFieldNestedNotTightlyPacked(); + obj1.value1.value1 = 0.0f; + obj1.value2.value2 = 1; + + StructWithFloatFieldNestedNotTightlyPacked obj2 = new StructWithFloatFieldNestedNotTightlyPacked(); + obj2.value1.value1 = -0.0f; + obj2.value2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithNestedFloatFieldTightlyPackedZeroCompareTest() + { + StructWithFloatFieldNestedTightlyPacked obj1 = new StructWithFloatFieldNestedTightlyPacked(); + obj1.value1.value1 = 0.0f; + obj1.value2.value2 = 1; + + StructWithFloatFieldNestedTightlyPacked obj2 = new StructWithFloatFieldNestedTightlyPacked(); + obj2.value1.value1 = -0.0f; + obj2.value2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithNestedFloatFieldNotTightlyPackedNaNCompareTest() + { + StructWithFloatFieldNestedNotTightlyPacked obj1 = new StructWithFloatFieldNestedNotTightlyPacked(); + obj1.value1.value1 = float.NaN; + obj1.value2.value2 = 1; + + StructWithFloatFieldNestedNotTightlyPacked obj2 = new StructWithFloatFieldNestedNotTightlyPacked(); + obj2.value1.value1 = -float.NaN; + obj2.value2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithNestedFloatFieldTightlyPackedNaNCompareTest() + { + StructWithFloatFieldNestedTightlyPacked obj1 = new StructWithFloatFieldNestedTightlyPacked(); + obj1.value1.value1 = float.NaN; + obj1.value2.value2 = 1; + + StructWithFloatFieldNestedTightlyPacked obj2 = new StructWithFloatFieldNestedTightlyPacked(); + obj2.value1.value1 = -float.NaN; + obj2.value2.value2 = 1; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + public static void StructWithoutNestedOverriddenEqualsCompareTest() + { + StructWithoutNestedOverriddenEqualsAndGetHashCode obj1 = new StructWithoutNestedOverriddenEqualsAndGetHashCode(); + obj1.value1.value = 1; + obj1.value2.value = 2; + + StructWithoutNestedOverriddenEqualsAndGetHashCode obj2 = new StructWithoutNestedOverriddenEqualsAndGetHashCode(); + obj2.value1.value = 1; + obj2.value2.value = 2; + + Assert.True(obj1.Equals(obj2)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The fix was made in coreclr that is not in netfx. See https://github.com/dotnet/coreclr/issues/11452")] + public static void StructWithNestedOverriddenEqualsCompareTest() + { + StructWithNestedOverriddenEqualsAndGetHashCode obj1 = new StructWithNestedOverriddenEqualsAndGetHashCode(); + obj1.value1.value = 1; + obj1.value2.value = 2; + + StructWithNestedOverriddenEqualsAndGetHashCode obj2 = new StructWithNestedOverriddenEqualsAndGetHashCode(); + obj2.value1.value = 1; + obj2.value2.value = 2; + + Assert.False(obj1.Equals(obj2)); + } + + [Fact] + public static void StructContainsPointerCompareTest() + { + StructContainsPointer obj1 = new StructContainsPointer(); + obj1.value1 = 1; + obj1.value2 = 0.0; + + StructContainsPointer obj2 = new StructContainsPointer(); + obj2.value1 = 1; + obj2.value2 = -0.0; + + Assert.True(obj1.Equals(obj2)); + } + public struct S { public int x; public int y; } + + public struct StructWithDoubleFieldNotTightlyPacked + { + public int value1; + public double value2; + } + + public struct StructWithDoubleFieldTightlyPacked + { + public double value1; + public double value2; + } + + public struct StructWithDoubleFieldNestedNotTightlyPacked + { + public StructWithDoubleFieldNotTightlyPacked value1; + public StructWithDoubleFieldNotTightlyPacked value2; + } + + public struct StructWithDoubleFieldNestedTightlyPacked + { + public StructWithDoubleFieldTightlyPacked value1; + public StructWithDoubleFieldTightlyPacked value2; + } + + public struct StructWithFloatFieldNotTightlyPacked + { + public float value1; + public long value2; + } + + public struct StructWithFloatFieldTightlyPacked + { + public float value1; + public float value2; + } + + public struct StructWithFloatFieldNestedNotTightlyPacked + { + public StructWithFloatFieldNotTightlyPacked value1; + public StructWithFloatFieldNotTightlyPacked value2; + } + + public struct StructWithFloatFieldNestedTightlyPacked + { + public StructWithFloatFieldTightlyPacked value1; + public StructWithFloatFieldTightlyPacked value2; + } + + public struct StructNonOverriddenEqualsOrGetHasCode + { + public byte value; + } + + public struct StructNeverEquals + { + public byte value; + + public override bool Equals(object obj) + { + return false; + } + + public override int GetHashCode() + { + return 0; + } + } + + public struct StructWithoutNestedOverriddenEqualsAndGetHashCode + { + public StructNonOverriddenEqualsOrGetHasCode value1; + public StructNonOverriddenEqualsOrGetHasCode value2; + } + + public struct StructWithNestedOverriddenEqualsAndGetHashCode + { + public StructNeverEquals value1; + public StructNeverEquals value2; + } + + public struct StructContainsPointer + { + public string s; + public double value1; + public double value2; + } } } diff --git a/external/corefx/src/System.Runtime/tests/System/VersionTests.netcoreapp.cs b/external/corefx/src/System.Runtime/tests/System/VersionTests.netcoreapp.cs new file mode 100644 index 0000000000..95dea7888d --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/System/VersionTests.netcoreapp.cs @@ -0,0 +1,82 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Tests +{ + public partial class VersionTests + { + [Theory] + [MemberData(nameof(Parse_Valid_TestData))] + public static void Parse_Span_ValidInput_ReturnsExpected(string input, Version expected) + { + if (input == null) + { + return; + } + + Assert.Equal(expected, Version.Parse(input.AsReadOnlySpan())); + + Assert.True(Version.TryParse(input.AsReadOnlySpan(), out Version version)); + Assert.Equal(expected, version); + } + + [Theory] + [MemberData(nameof(Parse_Invalid_TestData))] + public static void Parse_Span_InvalidInput_ThrowsException(string input, Type exceptionType) + { + if (input == null) + { + return; + } + + Assert.Throws(exceptionType, () => Version.Parse(input.AsReadOnlySpan())); + + Assert.False(Version.TryParse(input.AsReadOnlySpan(), out Version version)); + Assert.Null(version); + } + + [Theory] + [MemberData(nameof(ToString_TestData))] + public static void TryFormat_Invoke_WritesExpected(Version version, string[] expected) + { + char[] dest; + int charsWritten; + + for (int i = 0; i < expected.Length; i++) + { + if (i > 0) + { + // Too small + dest = new char[expected[i].Length - 1]; + Assert.False(version.TryFormat(dest, i, out charsWritten)); + Assert.Equal(0, charsWritten); + } + + // Just right + dest = new char[expected[i].Length]; + Assert.True(version.TryFormat(dest, i, out charsWritten)); + Assert.Equal(expected[i].Length, charsWritten); + Assert.Equal(expected[i], new string(dest, 0, charsWritten)); + + // More than needed + dest = new char[expected[i].Length + 10]; + Assert.True(version.TryFormat(dest, i, out charsWritten)); + Assert.Equal(expected[i].Length, charsWritten); + Assert.Equal(expected[i], new string(dest, 0, charsWritten)); + } + + int maxFieldCount = expected.Length - 1; + dest = new char[expected[maxFieldCount].Length]; + Assert.True(version.TryFormat(dest, out charsWritten)); + Assert.Equal(expected[maxFieldCount].Length, charsWritten); + Assert.Equal(expected[maxFieldCount], new string(dest, 0, charsWritten)); + + dest = new char[0]; + AssertExtensions.Throws("fieldCount", () => version.TryFormat(dest, -1, out charsWritten)); // Index < 0 + AssertExtensions.Throws("fieldCount", () => version.TryFormat(dest, maxFieldCount + 1, out charsWritten)); // Index > version.fieldCount + } + } +} diff --git a/external/corefx/src/System.Runtime/tests/UnloadableAssembly/Configurations.props b/external/corefx/src/System.Runtime/tests/UnloadableAssembly/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/UnloadableAssembly/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Runtime/tests/UnloadableAssembly/UnloadableAssembly.cs b/external/corefx/src/System.Runtime/tests/UnloadableAssembly/UnloadableAssembly.cs new file mode 100644 index 0000000000..fcddc267f0 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/UnloadableAssembly/UnloadableAssembly.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.CompilerServices; + +[assembly:ReferenceAssembly] + +public static class TypeInUnloadableAssembly {} + diff --git a/external/corefx/src/System.Runtime/tests/UnloadableAssembly/UnloadableAssembly.csproj b/external/corefx/src/System.Runtime/tests/UnloadableAssembly/UnloadableAssembly.csproj new file mode 100644 index 0000000000..46624025b6 --- /dev/null +++ b/external/corefx/src/System.Runtime/tests/UnloadableAssembly/UnloadableAssembly.csproj @@ -0,0 +1,20 @@ + + + + + {CA43AAD6-59A6-4BEB-AC9E-52DC9FD04B8B} + true + + + + + + + + + + Common\System\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAssemblyAttribute.cs + + + + diff --git a/external/corefx/src/System.Security.AccessControl/System.Security.AccessControl.sln b/external/corefx/src/System.Security.AccessControl/System.Security.AccessControl.sln index 3529cd0c4d..d314cdf92f 100644 --- a/external/corefx/src/System.Security.AccessControl/System.Security.AccessControl.sln +++ b/external/corefx/src/System.Security.AccessControl/System.Security.AccessControl.sln @@ -30,10 +30,10 @@ Global {70FAC855-CAC6-4523-8477-880548D58A1B}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU {70FAC855-CAC6-4523-8477-880548D58A1B}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU {70FAC855-CAC6-4523-8477-880548D58A1B}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU - {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {D27FFA1F-B446-4D24-B60A-1F88385CDB6D}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {F80C478C-48EE-46A5-89C4-EE0CFB23A14F}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {F80C478C-48EE-46A5-89C4-EE0CFB23A14F}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {F80C478C-48EE-46A5-89C4-EE0CFB23A14F}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU diff --git a/external/corefx/src/System.Security.AccessControl/dir.props b/external/corefx/src/System.Security.AccessControl/dir.props index 0b90c056e3..4bb96edee4 100644 --- a/external/corefx/src/System.Security.AccessControl/dir.props +++ b/external/corefx/src/System.Security.AccessControl/dir.props @@ -6,5 +6,6 @@ MSFT true false + true \ No newline at end of file diff --git a/external/corefx/src/System.Security.AccessControl/pkg/System.Security.AccessControl.pkgproj b/external/corefx/src/System.Security.AccessControl/pkg/System.Security.AccessControl.pkgproj index f05d73f778..634efabebf 100644 --- a/external/corefx/src/System.Security.AccessControl/pkg/System.Security.AccessControl.pkgproj +++ b/external/corefx/src/System.Security.AccessControl/pkg/System.Security.AccessControl.pkgproj @@ -5,16 +5,16 @@ net461;netcoreapp2.0;$(UAPvNextTFM);$(AllXamarinFrameworks) + + runtimes/win/lib/$(UAPvNextTFM) + + netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj b/external/corefx/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj index 8e967b026d..60b67fc31b 100644 --- a/external/corefx/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj +++ b/external/corefx/src/System.Security.AccessControl/ref/System.Security.AccessControl.csproj @@ -3,9 +3,10 @@ {F80C478C-48EE-46A5-89C4-EE0CFB23A14F} - - netstandard2.0;$(UAPvNextTFM) true + + 4.1.1.0 diff --git a/external/corefx/src/System.Security.AccessControl/src/Configurations.props b/external/corefx/src/System.Security.AccessControl/src/Configurations.props index 7a565a5243..e7003b2c30 100644 --- a/external/corefx/src/System.Security.AccessControl/src/Configurations.props +++ b/external/corefx/src/System.Security.AccessControl/src/Configurations.props @@ -1,11 +1,14 @@  - + netfx-Windows_NT; - netcoreapp-Windows_NT; - netcoreapp-Unix; + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; netstandard; + + + $(PackageConfigurations) uap-Windows_NT; diff --git a/external/corefx/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj b/external/corefx/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj index 6da880b8da..157093fb41 100644 --- a/external/corefx/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj +++ b/external/corefx/src/System.Security.AccessControl/src/System.Security.AccessControl.csproj @@ -8,10 +8,10 @@ SR.PlatformNotSupported_AccessControl {D27FFA1F-B446-4D24-B60A-1F88385CDB6D} - - - - + + + + @@ -21,7 +21,7 @@ - + diff --git a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/Claim.cs b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/Claim.cs index c740b20496..b85e6808e6 100644 --- a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/Claim.cs +++ b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/Claim.cs @@ -29,16 +29,13 @@ namespace System.Security.Claims UserData = 128, } - [NonSerialized] private readonly byte[] _userSerializationData; private readonly string _issuer; private readonly string _originalIssuer; private Dictionary _properties; - [NonSerialized] private readonly ClaimsIdentity _subject; - private readonly string _type; private readonly string _value; private readonly string _valueType; @@ -126,6 +123,7 @@ namespace System.Security.Claims if ((mask & SerializationMask.HasProperties) == SerializationMask.HasProperties) { int numProperties = reader.ReadInt32(); + numPropertiesRead++; for (int i = 0; i < numProperties; i++) { Properties.Add(reader.ReadString(), reader.ReadString()); @@ -254,7 +252,7 @@ namespace System.Security.Claims /// The original issuer of this claim. If this parameter is empty or null, then originalIssuer == issuer. /// The subject that this claim describes. /// This allows adding a property when adding a Claim. - /// The value associcated with the property. + /// The value associated with the property. internal Claim(string type, string value, string valueType, string issuer, string originalIssuer, ClaimsIdentity subject, string propertyKey, string propertyValue) { if (type == null) diff --git a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs index 6a08b9121d..6e1f14ed81 100644 --- a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs +++ b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs @@ -36,30 +36,16 @@ namespace System.Security.Claims UserData = 128, } - [NonSerialized] private byte[] _userSerializationData; - private ClaimsIdentity _actor; private string _authenticationType; private object _bootstrapContext; - - [NonSerialized] private List> _externalClaims; - private string _label; - - [NonSerialized] private List _instanceClaims = new List(); - - [NonSerialized] private string _nameClaimType = DefaultNameClaimType; - - [NonSerialized] private string _roleClaimType = DefaultRoleClaimType; - private string _serializedNameType; - private string _serializedRoleType; - public const string DefaultIssuer = @"LOCAL AUTHORITY"; public const string DefaultNameClaimType = ClaimTypes.Name; public const string DefaultRoleClaimType = ClaimTypes.Role; @@ -168,7 +154,7 @@ namespace System.Security.Claims /// All s are copied into this instance in a . Each Claim is examined and if Claim.Subject != this, then Claim.Clone(this) is called before the claim is added. /// Any 'External' claims are ignored. /// - /// if 'identity' is a and results in a circular refrence back to 'this'. + /// if 'identity' is a and results in a circular reference back to 'this'. public ClaimsIdentity(IIdentity identity, IEnumerable claims, string authenticationType, string nameType, string roleType) { ClaimsIdentity claimsIdentity = identity as ClaimsIdentity; @@ -273,12 +259,7 @@ namespace System.Security.Claims [SecurityCritical] protected ClaimsIdentity(SerializationInfo info) { - if (null == info) - { - throw new ArgumentNullException(nameof(info)); - } - - Deserialize(info, new StreamingContext(), false); + throw new PlatformNotSupportedException(); } /// @@ -470,7 +451,7 @@ namespace System.Security.Claims /// Adds a to the internal list. /// /// Enumeration of claims to add. - /// Each claim is examined and if != this, then then Claim.Clone(this) is called before the claim is added. + /// Each claim is examined and if != this, then Claim.Clone(this) is called before the claim is added. /// if 'claims' is null. public virtual void AddClaims(IEnumerable claims) { @@ -1008,43 +989,6 @@ namespace System.Security.Claims return false; } - [OnSerializing] - private void OnSerializingMethod(StreamingContext context) - { - if (this is ISerializable) - { - return; - } - - _serializedNameType = _nameClaimType; - _serializedRoleType = _roleClaimType; - if (_instanceClaims != null && _instanceClaims.Count > 0) - { - throw new PlatformNotSupportedException(SR.PlatformNotSupported_Serialization); // BinaryFormatter would be needed - } - } - - [OnDeserialized] - private void OnDeserializedMethod(StreamingContext context) - { - if (this is ISerializable) - { - return; - } - - _nameClaimType = string.IsNullOrEmpty(_serializedNameType) ? DefaultNameClaimType : _serializedNameType; - _roleClaimType = string.IsNullOrEmpty(_serializedRoleType) ? DefaultRoleClaimType : _serializedRoleType; - } - - [OnDeserializing] - private void OnDeserializingMethod(StreamingContext context) - { - if (this is ISerializable) - return; - - _instanceClaims = new List(); - } - /// /// Populates the specified with the serialization data for the ClaimsIdentity /// @@ -1055,44 +999,5 @@ namespace System.Security.Claims { throw new PlatformNotSupportedException(); } - - private void Deserialize(SerializationInfo info, StreamingContext context, bool useContext) - { - if (null == info) - { - throw new ArgumentNullException(nameof(info)); - } - - SerializationInfoEnumerator enumerator = info.GetEnumerator(); - while (enumerator.MoveNext()) - { - switch (enumerator.Name) - { - case VersionKey: - string version = info.GetString(VersionKey); - break; - - case AuthenticationTypeKey: - _authenticationType = info.GetString(AuthenticationTypeKey); - break; - - case NameClaimTypeKey: - _nameClaimType = info.GetString(NameClaimTypeKey); - break; - - case RoleClaimTypeKey: - _roleClaimType = info.GetString(RoleClaimTypeKey); - break; - - case LabelKey: - _label = info.GetString(LabelKey); - break; - - default: - // Ignore other fields for forward compatability. - break; - } - } - } } } diff --git a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs index 063e15a7ce..d942edcb69 100644 --- a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs +++ b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs @@ -23,10 +23,7 @@ namespace System.Security.Claims UserData = 2 } - [NonSerialized] private readonly List _identities = new List(); - - [NonSerialized] private readonly byte[] _userSerializationData; private static Func, ClaimsIdentity> s_identitySelector = SelectPrimaryIdentity; diff --git a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs index 659c439aa1..dda094a27b 100644 --- a/external/corefx/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs +++ b/external/corefx/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; -using System.Runtime.Serialization; using System.Security.Claims; namespace System.Security.Principal @@ -33,50 +32,7 @@ namespace System.Security.Principal AddIdentityWithRoles(m_identity, m_roles); } - - [OnDeserialized] - private void OnDeserializedMethod(StreamingContext context) - { - // Here it the matrix of possible serializations - // - // Version From | Version To | ClaimsIdentities | Roles - // ============ ========== ================ ======================================================== - // 4.0 4.5 None We always need to add a ClaimsIdentity, if Roles add them - // - // 4.5 4.5 Yes There should be a ClaimsIdentity, DebugAssert if this is not the case - // If there are roles, attach them to the first ClaimsIdentity. - // If there is no non-null ClaimsIdentity, add one. However, this is unusual and may be a - - ClaimsIdentity firstNonNullIdentity = null; - foreach (var identity in base.Identities) - { - if (identity != null) - { - firstNonNullIdentity = identity; - break; - } - } - - if (m_roles != null && m_roles.Length > 0 && firstNonNullIdentity != null) - { - List roleClaims = new List(m_roles.Length); - - foreach (string role in m_roles) - { - if (!string.IsNullOrWhiteSpace(role)) - { - roleClaims.Add(new Claim(firstNonNullIdentity.RoleClaimType, role, ClaimValueTypes.String, ClaimsIdentity.DefaultIssuer, ClaimsIdentity.DefaultIssuer, firstNonNullIdentity)); - } - } - - firstNonNullIdentity.ExternalClaims.Add(roleClaims); - } - else if (firstNonNullIdentity == null) - { - AddIdentityWithRoles(m_identity, m_roles); - } - } - + /// /// helper method to add roles /// diff --git a/external/corefx/src/System.Security.Claims/tests/ClaimTests.cs b/external/corefx/src/System.Security.Claims/tests/ClaimTests.cs index af634b6f95..332577c00b 100644 --- a/external/corefx/src/System.Security.Claims/tests/ClaimTests.cs +++ b/external/corefx/src/System.Security.Claims/tests/ClaimTests.cs @@ -2,7 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Runtime.Serialization.Formatters.Tests; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; using Xunit; namespace System.Security.Claims @@ -16,19 +19,37 @@ namespace System.Security.Claims } [Fact] - public void Claim_SerializeDeserialize_Roundtrip() + [ActiveIssue(22858, framework: TargetFrameworkMonikers.NetFramework)] // Roundtripping claim fails in full framework with EndOfStream exception + public void BinaryWriteReadTest_Success() { - var id = new ClaimsIdentity("someAuthType", "someNameType", "someRoleType"); - var c1 = new Claim("someType", "someValue", "someValueType", "anIssuer", "anOriginalIssuer", id); - Assert.Same(id, c1.Subject); + var claim = new Claim(ClaimTypes.Actor, "value", ClaimValueTypes.String, "issuer", "originalIssuer"); + claim.Properties.Add("key1", "val1"); + claim.Properties.Add("key2", "val2"); - Claim c2 = BinaryFormatterHelpers.Clone(c1); - Assert.Equal(c1.Type, c2.Type); - Assert.Equal(c1.Value, c2.Value); - Assert.Equal(c1.ValueType, c2.ValueType); - Assert.Equal(c1.Issuer, c2.Issuer); - Assert.Equal(c1.OriginalIssuer, c2.OriginalIssuer); - Assert.Null(c2.Subject); + Claim clonedClaim = null; + using (var memoryStream = new MemoryStream()) + { + using (var binaryWriter = new BinaryWriter(memoryStream, Encoding.Default, true)) + { + claim.WriteTo(binaryWriter); + binaryWriter.Flush(); + } + + memoryStream.Position = 0; + using (var binaryReader = new BinaryReader(memoryStream)) + { + clonedClaim = new Claim(binaryReader); + } + } + + Assert.Equal(claim.Type, clonedClaim.Type); + Assert.Equal(claim.Value, clonedClaim.Value); + Assert.Equal(claim.ValueType, clonedClaim.ValueType); + Assert.Equal(claim.Issuer, clonedClaim.Issuer); + Assert.Equal(claim.OriginalIssuer, clonedClaim.OriginalIssuer); + Assert.Equal(claim.Properties.Count, clonedClaim.Properties.Count); + Assert.Equal(claim.Properties.ElementAt(0), clonedClaim.Properties.ElementAt(0)); + Assert.Equal(claim.Properties.ElementAt(1), clonedClaim.Properties.ElementAt(1)); } } } diff --git a/external/corefx/src/System.Security.Claims/tests/System.Security.Claims.Tests.csproj b/external/corefx/src/System.Security.Claims/tests/System.Security.Claims.Tests.csproj index 7a60c9f59b..3e13881c45 100644 --- a/external/corefx/src/System.Security.Claims/tests/System.Security.Claims.Tests.csproj +++ b/external/corefx/src/System.Security.Claims/tests/System.Security.Claims.Tests.csproj @@ -12,9 +12,6 @@ - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/dir.props b/external/corefx/src/System.Security.Cryptography.Algorithms/dir.props index d3194fc7fe..70f807eaef 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/dir.props +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/ref/Configurations.props b/external/corefx/src/System.Security.Cryptography.Algorithms/ref/Configurations.props index 492def5c96..c701755863 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/ref/Configurations.props +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/ref/Configurations.props @@ -3,8 +3,6 @@ netcoreapp; - netfx; - net47; uap; diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj b/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj index a7d4bac7df..bd84f6a4b3 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.csproj @@ -5,18 +5,15 @@ {102247C1-3DB9-4DB5-80B3-EE9F80DD4E8F} true - - - - + diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.netcoreapp.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.netcoreapp.cs new file mode 100644 index 0000000000..bb7b224718 --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.netcoreapp.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the http://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + + +namespace System.Security.Cryptography +{ + public abstract partial class DSA : System.Security.Cryptography.AsymmetricAlgorithm + { + public virtual bool TryCreateSignature(ReadOnlySpan source, Span destination, out int bytesWritten) { throw null; } + protected virtual bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm) { throw null; } + public virtual bool VerifySignature(ReadOnlySpan rgbHash, ReadOnlySpan rgbSignature) { throw null; } + } + public abstract partial class ECDsa : System.Security.Cryptography.AsymmetricAlgorithm + { + protected virtual bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignHash(ReadOnlySpan source, Span destination, out int bytesWritten) { throw null; } + public virtual bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm) { throw null; } + public virtual bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature) { throw null; } + } + public sealed partial class IncrementalHash : System.IDisposable + { + public void AppendData(System.ReadOnlySpan data) { } + public bool TryGetHashAndReset(System.Span destination, out int bytesWritten) { throw null; } + } + public abstract partial class RandomNumberGenerator : System.IDisposable + { + public virtual void GetBytes(System.Span data) { } + public virtual void GetNonZeroBytes(System.Span data) { } + } + public abstract partial class RSA : System.Security.Cryptography.AsymmetricAlgorithm + { + public virtual bool TryDecrypt(System.ReadOnlySpan source, System.Span destination, RSAEncryptionPadding padding, out int bytesWritten) { throw null; } + public virtual bool TryEncrypt(System.ReadOnlySpan source, System.Span destination, RSAEncryptionPadding padding, out int bytesWritten) { throw null; } + protected virtual bool TryHashData(System.ReadOnlySpan source, System.Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) { throw null; } + public virtual bool TrySignData(System.ReadOnlySpan source, System.Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) { throw null; } + public virtual bool TrySignHash(System.ReadOnlySpan source, System.Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) { throw null; } + public virtual bool VerifyData(System.ReadOnlySpan data, System.ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { throw null; } + public virtual bool VerifyHash(System.ReadOnlySpan hash, System.ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { throw null; } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Configurations.props b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Configurations.props index 3c676b5a95..057c22542f 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Configurations.props +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Configurations.props @@ -5,8 +5,6 @@ netcoreapp-Unix; netcoreapp-OSX; netcoreapp-Windows_NT; - netfx-Windows_NT; - net47-Windows_NT; uap-Windows_NT; diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs index a5f5aa6b54..8a6d4006bd 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HMACCommon.cs @@ -4,9 +4,6 @@ using System; using System.Diagnostics; -using System.Security.Cryptography; - -using Internal.Cryptography; namespace Internal.Cryptography { @@ -30,13 +27,7 @@ namespace Internal.Cryptography ChangeKey(key); } - public int HashSizeInBits - { - get - { - return _hMacProvider.HashSizeInBytes * 8; - } - } + public int HashSizeInBits => _hMacProvider.HashSizeInBytes * 8; public void ChangeKey(byte[] key) { @@ -46,15 +37,16 @@ namespace Internal.Cryptography { // Perform RFC 2104, section 2 key adjustment. if (_lazyHashProvider == null) + { _lazyHashProvider = HashProviderDispenser.CreateHashProvider(_hashAlgorithmId); + } _lazyHashProvider.AppendHashData(key, 0, key.Length); key = _lazyHashProvider.FinalizeHashAndReset(); } HashProvider oldHashProvider = _hMacProvider; _hMacProvider = null; - if (oldHashProvider != null) - oldHashProvider.Dispose(true); + oldHashProvider?.Dispose(true); _hMacProvider = HashProviderDispenser.CreateMacProvider(_hashAlgorithmId, key); ActualKey = key; @@ -65,31 +57,31 @@ namespace Internal.Cryptography public byte[] ActualKey { get; private set; } // Adds new data to be hashed. This can be called repeatedly in order to hash data from noncontiguous sources. - public void AppendHashData(byte[] data, int offset, int count) - { + public void AppendHashData(byte[] data, int offset, int count) => _hMacProvider.AppendHashData(data, offset, count); - } + + public void AppendHashData(ReadOnlySpan source) => + _hMacProvider.AppendHashData(source); // Compute the hash based on the appended data and resets the HashProvider for more hashing. - public byte[] FinalizeHashAndReset() - { - return _hMacProvider.FinalizeHashAndReset(); - } + public byte[] FinalizeHashAndReset() => + _hMacProvider.FinalizeHashAndReset(); + + public bool TryFinalizeHashAndReset(Span destination, out int bytesWritten) => + _hMacProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public void Dispose(bool disposing) { - if (disposing) + if (disposing && _hMacProvider != null) { - if (_hMacProvider != null) - _hMacProvider.Dispose(true); + _hMacProvider.Dispose(true); _hMacProvider = null; } } - private readonly String _hashAlgorithmId; + private readonly string _hashAlgorithmId; private HashProvider _hMacProvider; private volatile HashProvider _lazyHashProvider; - private readonly int _blockSize; } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs index ea9fbaa465..b663864fd8 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.OSX.cs @@ -86,43 +86,22 @@ namespace Internal.Cryptography HashSizeInBytes = hashSizeInBytes; } - public override unsafe void AppendHashDataCore(byte[] data, int offset, int count) + public override void AppendHashData(ReadOnlySpan data) { - Debug.Assert(data != null); - Debug.Assert(offset >= 0); - Debug.Assert(offset < data.Length); - Debug.Assert(count >= 0); - Debug.Assert(data.Length - offset > count); - if (!_running) { SetKey(); } - int ret; - - fixed (byte* pData = data) - { - byte* pbData = pData + offset; - ret = Interop.AppleCrypto.HmacUpdate(_ctx, pbData, count); - } - - if (ret != 1) + if (Interop.AppleCrypto.HmacUpdate(_ctx, data, data.Length) != 1) { throw new CryptographicException(); } } - private unsafe void SetKey() + private void SetKey() { - int ret; - - fixed (byte* pbKey = _key) - { - ret = Interop.AppleCrypto.HmacInit(_ctx, pbKey, _key.Length); - } - - if (ret != 1) + if (Interop.AppleCrypto.HmacInit(_ctx, _key, _key.Length) != 1) { throw new CryptographicException(); } @@ -132,26 +111,34 @@ namespace Internal.Cryptography public override unsafe byte[] FinalizeHashAndReset() { + var output = new byte[HashSizeInBytes]; + bool success = TryFinalizeHashAndReset(output, out int bytesWritten); + Debug.Assert(success); + Debug.Assert(bytesWritten == output.Length); + return output; + } + + public override bool TryFinalizeHashAndReset(Span destination, out int bytesWritten) + { + if (destination.Length < HashSizeInBytes) + { + bytesWritten = 0; + return false; + } + if (!_running) { SetKey(); } - byte[] output = new byte[HashSizeInBytes]; - int ret; - - fixed (byte* pbOutput = output) - { - ret = Interop.AppleCrypto.HmacFinal(_ctx, pbOutput, output.Length); - } - - if (ret != 1) + if (Interop.AppleCrypto.HmacFinal(_ctx, destination, destination.Length) != 1) { throw new CryptographicException(); } + bytesWritten = HashSizeInBytes; _running = false; - return output; + return true; } public override void Dispose(bool disposing) @@ -193,22 +180,9 @@ namespace Internal.Cryptography HashSizeInBytes = hashSizeInBytes; } - public override unsafe void AppendHashDataCore(byte[] data, int offset, int count) + public override void AppendHashData(ReadOnlySpan data) { - Debug.Assert(data != null); - Debug.Assert(offset >= 0); - Debug.Assert(offset < data.Length); - Debug.Assert(count >= 0); - Debug.Assert(data.Length - offset > count); - - int ret; - - fixed (byte* pData = data) - { - byte* pbData = pData + offset; - ret = Interop.AppleCrypto.DigestUpdate(_ctx, pbData, count); - } - + int ret = Interop.AppleCrypto.DigestUpdate(_ctx, data, data.Length); if (ret != 1) { Debug.Assert(ret == 0, $"DigestUpdate return value {ret} was not 0 or 1"); @@ -216,23 +190,32 @@ namespace Internal.Cryptography } } - public override unsafe byte[] FinalizeHashAndReset() + public override byte[] FinalizeHashAndReset() { - byte[] hash = new byte[HashSizeInBytes]; - int ret; + var hash = new byte[HashSizeInBytes]; + bool success = TryFinalizeHashAndReset(hash, out int bytesWritten); + Debug.Assert(success); + Debug.Assert(bytesWritten == hash.Length); + return hash; + } - fixed (byte* pHash = hash) + public override bool TryFinalizeHashAndReset(Span destination, out int bytesWritten) + { + if (destination.Length < HashSizeInBytes) { - ret = Interop.AppleCrypto.DigestFinal(_ctx, pHash, hash.Length); + bytesWritten = 0; + return false; } + int ret = Interop.AppleCrypto.DigestFinal(_ctx, destination, destination.Length); if (ret != 1) { Debug.Assert(ret == 0, $"DigestFinal return value {ret} was not 0 or 1"); throw new CryptographicException(); } - return hash; + bytesWritten = HashSizeInBytes; + return true; } public override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs index 24473ee480..01f5b4da0a 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/HashProviderDispenser.Unix.cs @@ -74,35 +74,40 @@ namespace Internal.Cryptography Interop.Crypto.CheckValidOpenSslHandle(_ctx); } - public sealed override unsafe void AppendHashDataCore(byte[] data, int offset, int count) + public override void AppendHashData(ReadOnlySpan data) => + Check(Interop.Crypto.EvpDigestUpdate(_ctx, data, data.Length)); + + public override byte[] FinalizeHashAndReset() { - fixed (byte* md = data) - { - Check(Interop.Crypto.EvpDigestUpdate(_ctx, md + offset, count)); - } + var result = new byte[_hashSize]; + bool success = TryFinalizeHashAndReset(result, out int bytesWritten); + Debug.Assert(success); + Debug.Assert(result.Length == bytesWritten); + return result; } - public sealed override unsafe byte[] FinalizeHashAndReset() + public override bool TryFinalizeHashAndReset(Span destination, out int bytesWritten) { - byte* md = stackalloc byte[Interop.Crypto.EVP_MAX_MD_SIZE]; - uint length = (uint)Interop.Crypto.EVP_MAX_MD_SIZE; - Check(Interop.Crypto.EvpDigestFinalEx(_ctx, md, ref length)); + if (destination.Length < _hashSize) + { + bytesWritten = 0; + return false; + } + + uint length = (uint)destination.Length; + Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref destination.DangerousGetPinnableReference(), ref length)); Debug.Assert(length == _hashSize); + bytesWritten = (int)length; // Reset the algorithm provider. Check(Interop.Crypto.EvpDigestReset(_ctx, _algorithmEvp)); - byte[] result = new byte[(int)length]; - Marshal.Copy((IntPtr)md, result, 0, (int)length); - return result; + return true; } - public sealed override int HashSizeInBytes - { - get { return _hashSize; } - } + public override int HashSizeInBytes => _hashSize; - public sealed override void Dispose(bool disposing) + public override void Dispose(bool disposing) { if (disposing) { @@ -116,7 +121,7 @@ namespace Internal.Cryptography private readonly int _hashSize; private SafeHmacCtxHandle _hmacCtx; - public unsafe HmacHashProvider(IntPtr algorithmEvp, byte[] key) + public HmacHashProvider(IntPtr algorithmEvp, byte[] key) { Debug.Assert(algorithmEvp != IntPtr.Zero); Debug.Assert(key != null); @@ -127,49 +132,47 @@ namespace Internal.Cryptography throw new CryptographicException(); } - fixed (byte* keyPtr = key) - { - _hmacCtx = Interop.Crypto.HmacCreate(keyPtr, key.Length, algorithmEvp); - Interop.Crypto.CheckValidOpenSslHandle(_hmacCtx); - } + _hmacCtx = Interop.Crypto.HmacCreate(ref new Span(key).DangerousGetPinnableReference(), key.Length, algorithmEvp); + Interop.Crypto.CheckValidOpenSslHandle(_hmacCtx); } - public sealed override unsafe void AppendHashDataCore(byte[] data, int offset, int count) + public override void AppendHashData(ReadOnlySpan data) => + Check(Interop.Crypto.HmacUpdate(_hmacCtx, data, data.Length)); + + public override byte[] FinalizeHashAndReset() { - fixed (byte* md = data) - { - Check(Interop.Crypto.HmacUpdate(_hmacCtx, md + offset, count)); - } + var hash = new byte[_hashSize]; + bool success = TryFinalizeHashAndReset(hash, out int bytesWritten); + Debug.Assert(success); + Debug.Assert(hash.Length == bytesWritten); + return hash; } - public sealed override unsafe byte[] FinalizeHashAndReset() + public override unsafe bool TryFinalizeHashAndReset(Span destination, out int bytesWritten) { - byte* md = stackalloc byte[Interop.Crypto.EVP_MAX_MD_SIZE]; - int length = Interop.Crypto.EVP_MAX_MD_SIZE; - Check(Interop.Crypto.HmacFinal(_hmacCtx, md, ref length)); + if (destination.Length < _hashSize) + { + bytesWritten = 0; + return false; + } + + int length = destination.Length; + Check(Interop.Crypto.HmacFinal(_hmacCtx, ref destination.DangerousGetPinnableReference(), ref length)); Debug.Assert(length == _hashSize); + bytesWritten = length; Check(Interop.Crypto.HmacReset(_hmacCtx)); - - byte[] result = new byte[length]; - Marshal.Copy((IntPtr)md, result, 0, length); - return result; + return true; } - public sealed override int HashSizeInBytes - { - get { return _hashSize; } - } + public override int HashSizeInBytes => _hashSize; - public sealed override void Dispose(bool disposing) + public override void Dispose(bool disposing) { - if (disposing) + if (disposing && _hmacCtx != null) { - if (_hmacCtx != null) - { - _hmacCtx.Dispose(); - _hmacCtx = null; - } + _hmacCtx.Dispose(); + _hmacCtx = null; } } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs index cd8a00d1a8..012fba22de 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs @@ -8,12 +8,11 @@ namespace System.Security.Cryptography { partial class RandomNumberGeneratorImplementation { - private unsafe void GetBytes(byte* pbBuffer, int count) + private void GetBytes(ref byte pbBuffer, int count) { - Debug.Assert(pbBuffer != null); Debug.Assert(count > 0); - Interop.AppleCrypto.GetRandomBytes(pbBuffer, count); + Interop.AppleCrypto.GetRandomBytes(ref pbBuffer, count); } } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Unix.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Unix.cs index 445f8ec857..3065b37c5e 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Unix.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Unix.cs @@ -8,12 +8,11 @@ namespace System.Security.Cryptography { partial class RandomNumberGeneratorImplementation { - private unsafe void GetBytes(byte* pbBuffer, int count) + private void GetBytes(ref byte pbBuffer, int count) { - Debug.Assert(pbBuffer != null); Debug.Assert(count > 0); - if (!Interop.Crypto.GetRandomBytes(pbBuffer, count)) + if (!Interop.Crypto.GetRandomBytes(ref pbBuffer, count)) { throw Interop.Crypto.CreateOpenSslCryptographicException(); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs index 3d350b5914..a7a0253e88 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs @@ -8,12 +8,11 @@ namespace System.Security.Cryptography { partial class RandomNumberGeneratorImplementation { - private unsafe void GetBytes(byte* pbBuffer, int count) + private void GetBytes(ref byte pbBuffer, int count) { - Debug.Assert(pbBuffer != null); Debug.Assert(count > 0); - Interop.BCrypt.NTSTATUS status = Interop.BCrypt.BCryptGenRandom(pbBuffer, count); + Interop.BCrypt.NTSTATUS status = Interop.BCrypt.BCryptGenRandom(ref pbBuffer, count); if (status != Interop.BCrypt.NTSTATUS.STATUS_SUCCESS) throw Interop.BCrypt.CreateCryptographicException(status); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.cs index 8919998c15..57e0be7b79 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics; - namespace System.Security.Cryptography { internal sealed partial class RandomNumberGeneratorImplementation : RandomNumberGenerator @@ -11,29 +9,39 @@ namespace System.Security.Cryptography public override void GetBytes(byte[] data) { if (data == null) throw new ArgumentNullException(nameof(data)); - - GetBytesInternal(data, 0, data.Length); + GetBytes(new Span(data)); } public override void GetBytes(byte[] data, int offset, int count) { VerifyGetBytes(data, offset, count); - GetBytesInternal(data, offset, count); + GetBytes(new Span(data, offset, count)); + } + + public override void GetBytes(Span data) + { + if (data.Length > 0) + { + GetBytes(ref data.DangerousGetPinnableReference(), data.Length); + } } public override void GetNonZeroBytes(byte[] data) { if (data == null) throw new ArgumentNullException(nameof(data)); + GetNonZeroBytes(new Span(data)); + } - int offset = 0; - while (offset < data.Length) + public override void GetNonZeroBytes(Span data) + { + while (data.Length > 0) { - // Fill the remaining portion of the array with random bytes. - GetBytesInternal(data, offset, data.Length - offset); + // Fill the remaining portion of the span with random bytes. + GetBytes(data); // Find the first zero in the remaining portion. int indexOfFirst0Byte = data.Length; - for (int i = offset; i < data.Length; i++) + for (int i = 0; i < data.Length; i++) { if (data[i] == 0) { @@ -53,26 +61,7 @@ namespace System.Security.Cryptography // Request new random bytes if necessary; dont re-use // existing bytes since they were shifted down. - offset = indexOfFirst0Byte; - } - } - - private void GetBytesInternal(byte[] data, int offset, int count) - { - Debug.Assert(data != null); - Debug.Assert(offset >= 0); - Debug.Assert(count >= 0); - Debug.Assert(count <= data.Length - offset); - - if (count > 0) - { - unsafe - { - fixed (byte* pb = &data[offset]) - { - GetBytes(pb, count); - } - } + data = data.Slice(indexOfFirst0Byte); } } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs index 5598633632..10ac9a875e 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RijndaelImplementation.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics; using System.Security.Cryptography; namespace Internal.Cryptography @@ -11,7 +12,7 @@ namespace Internal.Cryptography /// Internal implementation of Rijndael. /// This class is returned from Rijndael.Create() instead of the public RijndaelManaged to /// be consistent with the rest of the static Create() methods which return opaque types. - /// They both have have the same implementation. + /// They both have the same implementation. /// internal sealed class RijndaelImplementation : Rijndael { @@ -30,12 +31,15 @@ namespace Internal.Cryptography get { return _impl.BlockSize; } set { + Debug.Assert(BlockSizeValue == 128); + // Values which were legal in desktop RijndaelManaged but not here in this wrapper type if (value == 192 || value == 256) throw new PlatformNotSupportedException(SR.Cryptography_Rijndael_BlockSize); // Any other invalid block size will get the normal "invalid block size" exception. - _impl.BlockSize = value; + if (value != 128) + throw new CryptographicException(SR.Cryptography_Rijndael_BlockSize); } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index e8912ca256..2b1d29be34 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -12,16 +12,12 @@ true true - - - - @@ -480,6 +476,7 @@ + diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs index f4e12670ca..e30085d734 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.IO; namespace System.Security.Cryptography @@ -69,6 +70,10 @@ namespace System.Security.Cryptography public byte[] SignData(byte[] data, HashAlgorithmName hashAlgorithm) { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } return SignData(data, 0, data.Length, hashAlgorithm); } @@ -77,7 +82,7 @@ namespace System.Security.Cryptography if (data == null) { throw new ArgumentNullException(nameof(data)); } if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException(nameof(offset)); } if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException(nameof(count)); } - if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } + if (string.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } byte[] hash = HashData(data, offset, count, hashAlgorithm); return CreateSignature(hash); @@ -86,7 +91,7 @@ namespace System.Security.Cryptography public virtual byte[] SignData(Stream data, HashAlgorithmName hashAlgorithm) { if (data == null) { throw new ArgumentNullException(nameof(data)); } - if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } + if (string.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } byte[] hash = HashData(data, hashAlgorithm); return CreateSignature(hash); @@ -94,6 +99,11 @@ namespace System.Security.Cryptography public bool VerifyData(byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm) { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + return VerifyData(data, 0, data.Length, signature, hashAlgorithm); } @@ -103,7 +113,7 @@ namespace System.Security.Cryptography if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException(nameof(offset)); } if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException(nameof(count)); } if (signature == null) { throw new ArgumentNullException(nameof(signature)); } - if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } + if (string.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } byte[] hash = HashData(data, offset, count, hashAlgorithm); return VerifySignature(hash, signature); @@ -113,20 +123,104 @@ namespace System.Security.Cryptography { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (signature == null) { throw new ArgumentNullException(nameof(signature)); } - if (String.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } + if (string.IsNullOrEmpty(hashAlgorithm.Name)) { throw HashAlgorithmNameNullOrEmpty(); } byte[] hash = HashData(data, hashAlgorithm); return VerifySignature(hash, signature); } - private static Exception DerivedClassMustOverride() + public virtual bool TryCreateSignature(ReadOnlySpan source, Span destination, out int bytesWritten) { - return new NotImplementedException(SR.NotSupported_SubclassOverride); + byte[] sig = CreateSignature(source.ToArray()); + if (sig.Length <= destination.Length) + { + new ReadOnlySpan(sig).CopyTo(destination); + bytesWritten = sig.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } } - internal static Exception HashAlgorithmNameNullOrEmpty() + protected virtual bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) { - return new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); + byte[] array = ArrayPool.Shared.Rent(source.Length); + try + { + source.CopyTo(array); + byte[] hash = HashData(array, 0, source.Length, hashAlgorithm); + if (destination.Length >= hash.Length) + { + new ReadOnlySpan(hash).CopyTo(destination); + bytesWritten = hash.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } + } + finally + { + Array.Clear(array, 0, source.Length); + ArrayPool.Shared.Return(array); + } } + + public virtual bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + + if (TryHashData(source, destination, hashAlgorithm, out int hashLength) && + TryCreateSignature(destination.Slice(0, hashLength), destination, out bytesWritten)) + { + return true; + } + + bytesWritten = 0; + return false; + } + + public virtual bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + + for (int i = 256; ; i = checked(i * 2)) + { + int hashLength = 0; + byte[] hash = ArrayPool.Shared.Rent(i); + try + { + if (TryHashData(data, hash, hashAlgorithm, out hashLength)) + { + return VerifySignature(new ReadOnlySpan(hash, 0, hashLength), signature); + } + } + finally + { + Array.Clear(hash, 0, hashLength); + ArrayPool.Shared.Return(hash); + } + } + } + + public virtual bool VerifySignature(ReadOnlySpan rgbHash, ReadOnlySpan rgbSignature) => + VerifySignature(rgbHash.ToArray(), rgbSignature.ToArray()); + + private static Exception DerivedClassMustOverride() => + new NotImplementedException(SR.NotSupported_SubclassOverride); + + internal static Exception HashAlgorithmNameNullOrEmpty() => + new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs index 5bc00b52d6..b7c2fb4c02 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs @@ -15,7 +15,7 @@ namespace System.Security.Cryptography public byte[] G; public byte[] Y; public byte[] J; - [NonSerialized] public byte[] X; + public byte[] X; public byte[] Seed; public int Counter; } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs index 9cfb08eea8..d17ded3926 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.IO; namespace System.Security.Cryptography @@ -82,6 +83,23 @@ namespace System.Security.Cryptography return SignHash(hash); } + public virtual bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm)); + } + + if (TryHashData(source, destination, hashAlgorithm, out int hashLength) && + TrySignHash(destination.Slice(0, hashLength), destination, out bytesWritten)) + { + return true; + } + + bytesWritten = 0; + return false; + } + public virtual byte[] SignData(Stream data, HashAlgorithmName hashAlgorithm) { if (data == null) @@ -118,6 +136,32 @@ namespace System.Security.Cryptography return VerifyHash(hash, signature); } + public virtual bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm)); + } + + for (int i = 256; ; i = checked(i * 2)) + { + int hashLength = 0; + byte[] hash = ArrayPool.Shared.Rent(i); + try + { + if (TryHashData(data, hash, hashAlgorithm, out hashLength)) + { + return VerifyHash(new ReadOnlySpan(hash, 0, hashLength), signature); + } + } + finally + { + Array.Clear(hash, 0, hashLength); + ArrayPool.Shared.Return(hash); + } + } + } + public bool VerifyData(Stream data, byte[] signature, HashAlgorithmName hashAlgorithm) { if (data == null) @@ -146,5 +190,50 @@ namespace System.Security.Cryptography { throw new NotSupportedException(SR.NotSupported_SubclassOverride); } + + protected virtual bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + byte[] array = ArrayPool.Shared.Rent(source.Length); + try + { + source.CopyTo(array); + byte[] hash = HashData(array, 0, source.Length, hashAlgorithm); + if (hash.Length <= destination.Length) + { + new ReadOnlySpan(hash).CopyTo(destination); + bytesWritten = hash.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } + } + finally + { + Array.Clear(array, 0, source.Length); + ArrayPool.Shared.Return(array); + } + } + + public virtual bool TrySignHash(ReadOnlySpan source, Span destination, out int bytesWritten) + { + byte[] result = SignHash(source.ToArray()); + if (result.Length <= destination.Length) + { + new ReadOnlySpan(result).CopyTo(destination); + bytesWritten = result.Length; + return true; + } + else + { + bytesWritten = 0; + return false; + } + } + + public virtual bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature) => + VerifyHash(hash.ToArray(), signature.ToArray()); } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs index 6e9e633d09..c59156cad9 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACMD5.cs @@ -2,10 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Diagnostics; -using System.Security.Cryptography; - using Internal.Cryptography; namespace System.Security.Cryptography @@ -46,21 +42,22 @@ namespace System.Security.Cryptography } } - protected override void HashCore(byte[] rgb, int ib, int cb) - { + protected override void HashCore(byte[] rgb, int ib, int cb) => _hMacCommon.AppendHashData(rgb, ib, cb); - } - protected override byte[] HashFinal() - { - return _hMacCommon.FinalizeHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _hMacCommon.AppendHashData(source); + + protected override byte[] HashFinal() => + _hMacCommon.FinalizeHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _hMacCommon.TryFinalizeHashAndReset(destination, out bytesWritten); public override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected override void Dispose(bool disposing) @@ -68,9 +65,11 @@ namespace System.Security.Cryptography if (disposing) { HMACCommon hMacCommon = _hMacCommon; - _hMacCommon = null; if (hMacCommon != null) + { + _hMacCommon = null; hMacCommon.Dispose(disposing); + } } base.Dispose(disposing); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs index 3277039ad0..d885c2c2d2 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA1.cs @@ -49,21 +49,22 @@ namespace System.Security.Cryptography } } - protected override void HashCore(byte[] rgb, int ib, int cb) - { + protected override void HashCore(byte[] rgb, int ib, int cb) => _hMacCommon.AppendHashData(rgb, ib, cb); - } - protected override byte[] HashFinal() - { - return _hMacCommon.FinalizeHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _hMacCommon.AppendHashData(source); + + protected override byte[] HashFinal() => + _hMacCommon.FinalizeHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _hMacCommon.TryFinalizeHashAndReset(destination, out bytesWritten); public override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected override void Dispose(bool disposing) @@ -71,9 +72,11 @@ namespace System.Security.Cryptography if (disposing) { HMACCommon hMacCommon = _hMacCommon; - _hMacCommon = null; if (hMacCommon != null) + { + _hMacCommon = null; hMacCommon.Dispose(disposing); + } } base.Dispose(disposing); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs index 268d4b79f1..59f893c7ab 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA256.cs @@ -46,21 +46,22 @@ namespace System.Security.Cryptography } } - protected override void HashCore(byte[] rgb, int ib, int cb) - { + protected override void HashCore(byte[] rgb, int ib, int cb) => _hMacCommon.AppendHashData(rgb, ib, cb); - } - protected override byte[] HashFinal() - { - return _hMacCommon.FinalizeHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _hMacCommon.AppendHashData(source); + + protected override byte[] HashFinal() => + _hMacCommon.FinalizeHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _hMacCommon.TryFinalizeHashAndReset(destination, out bytesWritten); public override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected override void Dispose(bool disposing) @@ -68,9 +69,11 @@ namespace System.Security.Cryptography if (disposing) { HMACCommon hMacCommon = _hMacCommon; - _hMacCommon = null; if (hMacCommon != null) + { + _hMacCommon = null; hMacCommon.Dispose(disposing); + } } base.Dispose(disposing); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs index 64f73980b7..1f9ef0a24a 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA384.cs @@ -62,21 +62,22 @@ namespace System.Security.Cryptography } } - protected override void HashCore(byte[] rgb, int ib, int cb) - { + protected override void HashCore(byte[] rgb, int ib, int cb) => _hMacCommon.AppendHashData(rgb, ib, cb); - } - protected override byte[] HashFinal() - { - return _hMacCommon.FinalizeHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _hMacCommon.AppendHashData(source); + + protected override byte[] HashFinal() => + _hMacCommon.FinalizeHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _hMacCommon.TryFinalizeHashAndReset(destination, out bytesWritten); public override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected override void Dispose(bool disposing) @@ -84,9 +85,11 @@ namespace System.Security.Cryptography if (disposing) { HMACCommon hMacCommon = _hMacCommon; - _hMacCommon = null; if (hMacCommon != null) + { + _hMacCommon = null; hMacCommon.Dispose(disposing); + } } base.Dispose(disposing); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs index f902b5c71e..0ab29f04ca 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/HMACSHA512.cs @@ -60,21 +60,22 @@ namespace System.Security.Cryptography } } - protected override void HashCore(byte[] rgb, int ib, int cb) - { + protected override void HashCore(byte[] rgb, int ib, int cb) => _hMacCommon.AppendHashData(rgb, ib, cb); - } - protected override byte[] HashFinal() - { - return _hMacCommon.FinalizeHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _hMacCommon.AppendHashData(source); + + protected override byte[] HashFinal() => + _hMacCommon.FinalizeHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _hMacCommon.TryFinalizeHashAndReset(destination, out bytesWritten); public override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected override void Dispose(bool disposing) @@ -82,9 +83,11 @@ namespace System.Security.Cryptography if (disposing) { HMACCommon hMacCommon = _hMacCommon; - _hMacCommon = null; if (hMacCommon != null) + { + _hMacCommon = null; hMacCommon.Dispose(disposing); + } } base.Dispose(disposing); } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs index eb46eea65a..13c13280ad 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/IncrementalHash.cs @@ -40,10 +40,7 @@ namespace System.Security.Cryptography /// /// Get the name of the algorithm being performed. /// - public HashAlgorithmName AlgorithmName - { - get { return _algorithmName; } - } + public HashAlgorithmName AlgorithmName => _algorithmName; /// /// Append the entire contents of to the data already processed in the hash or HMAC. @@ -92,14 +89,24 @@ namespace System.Security.Cryptography if (_disposed) throw new ObjectDisposedException(typeof(IncrementalHash).Name); + AppendData(new ReadOnlySpan(data, offset, count)); + } + + public void AppendData(ReadOnlySpan data) + { + if (_disposed) + { + throw new ObjectDisposedException(typeof(IncrementalHash).Name); + } + + Debug.Assert((_hash != null) ^ (_hmac != null)); if (_hash != null) { - _hash.AppendHashDataCore(data, offset, count); + _hash.AppendHashData(data); } else { - Debug.Assert(_hmac != null, "Both _hash and _hmac were null"); - _hmac.AppendHashData(data, offset, count); + _hmac.AppendHashData(data); } } @@ -113,21 +120,27 @@ namespace System.Security.Cryptography public byte[] GetHashAndReset() { if (_disposed) + { throw new ObjectDisposedException(typeof(IncrementalHash).Name); - - byte[] hashValue; - - if (_hash != null) - { - hashValue = _hash.FinalizeHashAndReset(); - } - else - { - Debug.Assert(_hmac != null, "Both _hash and _hmac were null"); - hashValue = _hmac.FinalizeHashAndReset(); } - return hashValue; + Debug.Assert((_hash != null) ^ (_hmac != null)); + return _hash != null ? + _hash.FinalizeHashAndReset() : + _hmac.FinalizeHashAndReset(); + } + + public bool TryGetHashAndReset(Span destination, out int bytesWritten) + { + if (_disposed) + { + throw new ObjectDisposedException(typeof(IncrementalHash).Name); + } + + Debug.Assert((_hash != null) ^ (_hmac != null)); + return _hash != null ? + _hash.TryFinalizeHashAndReset(destination, out bytesWritten) : + _hmac.TryFinalizeHashAndReset(destination, out bytesWritten); } /// diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs index 444ec604c3..0049613885 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/MD5.cs @@ -16,15 +16,9 @@ namespace System.Security.Cryptography { protected MD5() { } - public static new MD5 Create() - { - return new Implementation(); - } + public static new MD5 Create() => new Implementation(); - public static new MD5 Create(String algName) - { - return (MD5)CryptoConfig.CreateFromName(algName); - } + public static new MD5 Create(String algName) => (MD5)CryptoConfig.CreateFromName(algName); private sealed class Implementation : MD5 { @@ -36,21 +30,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs index d14bedea10..c0e34b19c2 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.cs @@ -2,15 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.IO; -using Internal.Cryptography; - namespace System.Security.Cryptography { public abstract partial class RSA : AsymmetricAlgorithm { - public static new RSA Create(String algName) + public static new RSA Create(string algName) { return (RSA)CryptoConfig.CreateFromName(algName); } @@ -49,28 +48,96 @@ namespace System.Security.Cryptography public abstract RSAParameters ExportParameters(bool includePrivateParameters); public abstract void ImportParameters(RSAParameters parameters); - public virtual byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) { throw DerivedClassMustOverride(); } - public virtual byte[] Decrypt(byte[] data, RSAEncryptionPadding padding) { throw DerivedClassMustOverride(); } - public virtual byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { throw DerivedClassMustOverride(); } - public virtual bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { throw DerivedClassMustOverride(); } + public virtual byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) => throw DerivedClassMustOverride(); + public virtual byte[] Decrypt(byte[] data, RSAEncryptionPadding padding) => throw DerivedClassMustOverride(); + public virtual byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => throw DerivedClassMustOverride(); + public virtual bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => throw DerivedClassMustOverride(); - protected virtual byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) { throw DerivedClassMustOverride(); } - protected virtual byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) { throw DerivedClassMustOverride(); } + protected virtual byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => throw DerivedClassMustOverride(); + protected virtual byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => throw DerivedClassMustOverride(); - private static Exception DerivedClassMustOverride() + public virtual bool TryDecrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) { - return new NotImplementedException(SR.NotSupported_SubclassOverride); + byte[] result = Decrypt(source.ToArray(), padding); + + if (destination.Length >= result.Length) + { + new ReadOnlySpan(result).CopyTo(destination); + bytesWritten = result.Length; + return true; + } + + bytesWritten = 0; + return false; } - public virtual byte[] DecryptValue(byte[] rgb) + public virtual bool TryEncrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) { + byte[] result = Encrypt(source.ToArray(), padding); + + if (destination.Length >= result.Length) + { + new ReadOnlySpan(result).CopyTo(destination); + bytesWritten = result.Length; + return true; + } + + bytesWritten = 0; + return false; + } + + protected virtual bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + byte[] result; + byte[] array = ArrayPool.Shared.Rent(source.Length); + try + { + source.CopyTo(array); + result = HashData(array, 0, source.Length, hashAlgorithm); + } + finally + { + Array.Clear(array, 0, source.Length); + ArrayPool.Shared.Return(array); + } + + if (destination.Length >= result.Length) + { + new ReadOnlySpan(result).CopyTo(destination); + bytesWritten = result.Length; + return true; + } + + bytesWritten = 0; + return false; + } + + public virtual bool TrySignHash(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) + { + byte[] result = SignHash(source.ToArray(), hashAlgorithm, padding); + + if (destination.Length >= result.Length) + { + new ReadOnlySpan(result).CopyTo(destination); + bytesWritten = result.Length; + return true; + } + + bytesWritten = 0; + return false; + } + + public virtual bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + VerifyHash(hash.ToArray(), signature.ToArray(), hashAlgorithm, padding); + + private static Exception DerivedClassMustOverride() => + new NotImplementedException(SR.NotSupported_SubclassOverride); + + public virtual byte[] DecryptValue(byte[] rgb) => throw new NotSupportedException(SR.NotSupported_Method); // Same as Desktop - } - public virtual byte[] EncryptValue(byte[] rgb) - { + public virtual byte[] EncryptValue(byte[] rgb) => throw new NotSupportedException(SR.NotSupported_Method); // Same as Desktop - } public byte[] SignData(byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { @@ -117,6 +184,27 @@ namespace System.Security.Cryptography return SignHash(hash, hashAlgorithm, padding); } + public virtual bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + if (TryHashData(source, destination, hashAlgorithm, out int hashLength) && + TrySignHash(destination.Slice(0, hashLength), destination, hashAlgorithm, padding, out bytesWritten)) + { + return true; + } + + bytesWritten = 0; + return false; + } + public bool VerifyData(byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { if (data == null) @@ -165,12 +253,40 @@ namespace System.Security.Cryptography return VerifyHash(hash, signature, hashAlgorithm, padding); } + public virtual bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) + { + if (string.IsNullOrEmpty(hashAlgorithm.Name)) + { + throw HashAlgorithmNameNullOrEmpty(); + } + if (padding == null) + { + throw new ArgumentNullException(nameof(padding)); + } + + for (int i = 256; ; i = checked(i * 2)) + { + int hashLength = 0; + byte[] hash = ArrayPool.Shared.Rent(i); + try + { + if (TryHashData(data, hash, hashAlgorithm, out hashLength)) + { + return VerifyHash(new ReadOnlySpan(hash, 0, hashLength), signature, hashAlgorithm, padding); + } + } + finally + { + Array.Clear(hash, 0, hashLength); + ArrayPool.Shared.Return(hash); + } + } + } + public override string KeyExchangeAlgorithm => "RSA"; public override string SignatureAlgorithm => "RSA"; - private static Exception HashAlgorithmNameNullOrEmpty() - { - return new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); - } + private static Exception HashAlgorithmNameNullOrEmpty() => + new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm"); } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs index bffb39701e..3e0c13f37a 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs @@ -8,18 +8,17 @@ using System.Security.Cryptography; namespace System.Security.Cryptography { - // We allow only the public components of an RSAParameters object, the Modulus and Exponent to be serializable. [Serializable] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct RSAParameters { - [NonSerialized] public byte[] D; - [NonSerialized] public byte[] DP; - [NonSerialized] public byte[] DQ; + public byte[] D; + public byte[] DP; + public byte[] DQ; public byte[] Exponent; - [NonSerialized] public byte[] InverseQ; + public byte[] InverseQ; public byte[] Modulus; - [NonSerialized] public byte[] P; - [NonSerialized] public byte[] Q; + public byte[] P; + public byte[] Q; } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs index 5e1b9f049c..31c88b7739 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RandomNumberGenerator.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; + namespace System.Security.Cryptography { public abstract class RandomNumberGenerator : IDisposable @@ -49,6 +51,21 @@ namespace System.Security.Cryptography } } + public virtual void GetBytes(Span data) + { + byte[] array = ArrayPool.Shared.Rent(data.Length); + try + { + GetBytes(array, 0, data.Length); + new ReadOnlySpan(array, 0, data.Length).CopyTo(data); + } + finally + { + Array.Clear(array, 0, data.Length); + ArrayPool.Shared.Return(array); + } + } + public virtual void GetNonZeroBytes(byte[] data) { // For compatibility we cannot have it be abstract. Since this technically is an abstract method @@ -56,6 +73,24 @@ namespace System.Security.Cryptography throw new NotImplementedException(); } + public virtual void GetNonZeroBytes(Span data) + { + byte[] array = ArrayPool.Shared.Rent(data.Length); + try + { + // NOTE: There is no GetNonZeroBytes(byte[], int, int) overload, so this call + // may end up retrieving more data than was intended, if the array pool + // gives back a larger array than was actually needed. + GetNonZeroBytes(array); + new ReadOnlySpan(array, 0, data.Length).CopyTo(data); + } + finally + { + Array.Clear(array, 0, data.Length); + ArrayPool.Shared.Return(array); + } + } + internal void VerifyGetBytes(byte[] data, int offset, int count) { if (data == null) throw new ArgumentNullException(nameof(data)); diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs index a985095a80..2eecd8579c 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/Rfc2898DeriveBytes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.Text; using System.Diagnostics; @@ -249,7 +250,7 @@ namespace System.Security.Cryptography } // This function is defined as follows: - // Func (S, i) = HMAC(S || i) | HMAC2(S || i) | ... | HMAC(iterations) (S || i) + // Func (S, i) = HMAC(S || i) ^ HMAC2(S || i) ^ ... ^ HMAC(iterations) (S || i) // where i is the block number. private byte[] Func() { @@ -257,22 +258,37 @@ namespace System.Security.Cryptography Buffer.BlockCopy(_salt, 0, temp, 0, _salt.Length); Helpers.WriteInt(_block, temp, _salt.Length); - temp = _hmac.ComputeHash(temp); - - byte[] ret = temp; - for (int i = 2; i <= _iterations; i++) + byte[] ui = ArrayPool.Shared.Rent(_blockSize); + try { - temp = _hmac.ComputeHash(temp); + Span uiSpan = new Span(ui, 0, _blockSize); - for (int j = 0; j < _blockSize; j++) + if (!_hmac.TryComputeHash(temp, uiSpan, out int bytesWritten) || bytesWritten != _blockSize) + throw new CryptographicException(); + + byte[] ret = new byte[_blockSize]; + uiSpan.CopyTo(ret); + + for (int i = 2; i <= _iterations; i++) { - ret[j] ^= temp[j]; - } - } + if (!_hmac.TryComputeHash(uiSpan, uiSpan, out bytesWritten) || bytesWritten != _blockSize) + throw new CryptographicException(); - // increment the block count. - _block++; - return ret; + for (int j = 0; j < _blockSize; j++) + { + ret[j] ^= ui[j]; + } + } + + // increment the block count. + _block++; + return ret; + } + finally + { + Array.Clear(ui, 0, _blockSize); + ArrayPool.Shared.Return(ui); + } } } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs index b3dc2d78ae..40272b158a 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RijndaelManaged.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.ComponentModel; +using System.Diagnostics; namespace System.Security.Cryptography { @@ -24,12 +25,15 @@ namespace System.Security.Cryptography get { return _impl.BlockSize; } set { + Debug.Assert(BlockSizeValue == 128); + // Values which were legal in desktop RijndaelManaged but not here in this wrapper type if (value == 192 || value == 256) throw new PlatformNotSupportedException(SR.Cryptography_Rijndael_BlockSize); // Any other invalid block size will get the normal "invalid block size" exception. - _impl.BlockSize = value; + if (value != 128) + throw new CryptographicException(SR.Cryptography_Rijndael_BlockSize); } } diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1.cs index 1d075f9d88..d9ad3a8b59 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1.cs @@ -17,15 +17,9 @@ namespace System.Security.Cryptography protected SHA1() { } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "This is the implementaton of SHA1")] - public static new SHA1 Create() - { - return new Implementation(); - } + public static new SHA1 Create() => new Implementation(); - public static new SHA1 Create(string hashName) - { - return (SHA1)CryptoConfig.CreateFromName(hashName); - } + public static new SHA1 Create(string hashName) => (SHA1)CryptoConfig.CreateFromName(hashName); private sealed class Implementation : SHA1 { @@ -37,21 +31,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs index 1bd1c7867b..fab9ff8252 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA1Managed.cs @@ -19,21 +19,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256.cs index d8695c40c3..9fe667b55a 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256.cs @@ -16,15 +16,9 @@ namespace System.Security.Cryptography { protected SHA256() { } - public static new SHA256 Create() - { - return new Implementation(); - } + public static new SHA256 Create() => new Implementation(); - public static new SHA256 Create(string hashName) - { - return (SHA256)CryptoConfig.CreateFromName(hashName); - } + public static new SHA256 Create(string hashName) => (SHA256)CryptoConfig.CreateFromName(hashName); private sealed class Implementation : SHA256 { @@ -36,21 +30,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs index 7ea4f77873..77496bed44 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA256Managed.cs @@ -19,21 +19,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384.cs index 2311d7b25e..f5e6b80c52 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384.cs @@ -16,15 +16,9 @@ namespace System.Security.Cryptography { protected SHA384() { } - public static new SHA384 Create() - { - return new Implementation(); - } + public static new SHA384 Create() => new Implementation(); - public static new SHA384 Create(string hashName) - { - return (SHA384)CryptoConfig.CreateFromName(hashName); - } + public static new SHA384 Create(string hashName) => (SHA384)CryptoConfig.CreateFromName(hashName); private sealed class Implementation : SHA384 { @@ -36,21 +30,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs index d9c1aff058..6c7780fce8 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA384Managed.cs @@ -19,21 +19,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512.cs index 584dd0553c..1c62d97cc5 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512.cs @@ -16,15 +16,9 @@ namespace System.Security.Cryptography { protected SHA512() { } - public static new SHA512 Create() - { - return new Implementation(); - } + public static new SHA512 Create() => new Implementation(); - public static new SHA512 Create(string hashName) - { - return (SHA512)CryptoConfig.CreateFromName(hashName); - } + public static new SHA512 Create(string hashName) => (SHA512)CryptoConfig.CreateFromName(hashName); private sealed class Implementation : SHA512 { @@ -36,21 +30,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs index cd88bd422e..95435ebe90 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/SHA512Managed.cs @@ -19,21 +19,22 @@ namespace System.Security.Cryptography HashSizeValue = _hashProvider.HashSizeInBytes * 8; } - protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) => _hashProvider.AppendHashData(array, ibStart, cbSize); - } - protected sealed override byte[] HashFinal() - { - return _hashProvider.FinalizeHashAndReset(); - } + protected sealed override void HashCore(ReadOnlySpan source) => + _hashProvider.AppendHashData(source); + + protected sealed override byte[] HashFinal() => + _hashProvider.FinalizeHashAndReset(); + + protected sealed override bool TryHashFinal(Span destination, out int bytesWritten) => + _hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten); public sealed override void Initialize() { // Nothing to do here. We expect HashAlgorithm to invoke HashFinal() and Initialize() as a pair. This reflects the // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. - return; } protected sealed override void Dispose(bool disposing) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DSATests.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DSATests.cs new file mode 100644 index 0000000000..c3d1251db6 --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DSATests.cs @@ -0,0 +1,194 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Reflection; +using System.Security.Cryptography.Dsa.Tests; +using Xunit; + +namespace System.Security.Cryptography.Algorithms.Tests +{ + public class DSATests + { + public static bool SupportsKeyGeneration => DSAFactory.SupportsKeyGeneration; + + [Fact] + public void BaseVirtualsNotImplementedException() + { + var dsa = new EmptyDSA(); + Assert.Throws(() => dsa.HashData(null, HashAlgorithmName.SHA1)); + Assert.Throws(() => dsa.HashData(null, 0, 0, HashAlgorithmName.SHA1)); + } + + [ConditionalFact(nameof(SupportsKeyGeneration))] + public void TryCreateSignature_UsesCreateSignature() + { + var input = new byte[1024]; + new Random(42).NextBytes(input); + int bytesWritten = 0; + + using (var wrapperDsa = new OverrideAbstractDSA(DSA.Create(1024))) + { + byte[] initialSig = wrapperDsa.CreateSignature(input); + byte[] actualSig = new byte[initialSig.Length]; + + Assert.False(wrapperDsa.TryCreateSignature(input, new Span(actualSig, 0, actualSig.Length - 1), out bytesWritten)); + Assert.Equal(0, bytesWritten); + Assert.All(actualSig, b => Assert.Equal(0, b)); + + Assert.True(wrapperDsa.TryCreateSignature(input, actualSig, out bytesWritten)); + Assert.Equal(initialSig.Length, bytesWritten); + Assert.Contains(actualSig, b => b != 0); + } + } + + [Fact] + public void SignData_InvalidArguments_Throws() + { + using (var wrapperDsa = new OverrideAbstractDSA(DSA.Create(1024))) + { + AssertExtensions.Throws("data", () => wrapperDsa.SignData((byte[])null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => wrapperDsa.SignData((Stream)null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => wrapperDsa.SignData(null, 0, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => wrapperDsa.SignData(new byte[1], -1, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => wrapperDsa.SignData(new byte[1], 2, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => wrapperDsa.SignData(new byte[1], 0, -1, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => wrapperDsa.SignData(new byte[1], 0, 2, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.SignData(new byte[1], new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.SignData(new byte[1], new HashAlgorithmName(""))); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.SignData(new MemoryStream(new byte[1]), new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.SignData(new MemoryStream(new byte[1]), new HashAlgorithmName(""))); + } + } + + [ConditionalFact(nameof(SupportsKeyGeneration))] + public void TrySignData_UsesTryHashDataAndTryCreateSignature() + { + var input = new byte[1024]; + new Random(42).NextBytes(input); + int bytesWritten = 0; + + using (var wrapperDsa = new OverrideAbstractDSA(DSA.Create(1024))) + { + byte[] initialSig = wrapperDsa.SignData(input, HashAlgorithmName.SHA1); + byte[] actualSig = new byte[initialSig.Length]; + + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.TrySignData(new byte[1], new byte[1], new HashAlgorithmName(null), out int _)); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.TrySignData(new byte[1], new byte[1], new HashAlgorithmName(""), out int _)); + + Assert.False(wrapperDsa.TrySignData(input, new Span(actualSig, 0, 1), HashAlgorithmName.SHA1, out bytesWritten)); + Assert.Equal(0, bytesWritten); + Assert.All(actualSig, b => Assert.Equal(0, b)); + + Assert.True(wrapperDsa.TrySignData(input, actualSig, HashAlgorithmName.SHA1, out bytesWritten)); + Assert.Equal(initialSig.Length, bytesWritten); + Assert.Contains(actualSig, b => b != 0); + } + } + + [ConditionalFact(nameof(SupportsKeyGeneration))] + public void VerifyData_Array_UsesHashDataAndVerifySignature() + { + var input = new byte[1024]; + new Random(42).NextBytes(input); + + using (var wrapperDsa = new OverrideAbstractDSA(DSA.Create(1024))) + { + AssertExtensions.Throws("data", () => wrapperDsa.VerifyData((byte[])null, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => wrapperDsa.VerifyData(null, 0, 0, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => wrapperDsa.VerifyData(new byte[1], -1, 0, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => wrapperDsa.VerifyData(new byte[1], 2, 0, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => wrapperDsa.VerifyData(new byte[1], 0, -1, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => wrapperDsa.VerifyData(new byte[1], 0, 2, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("signature", () => wrapperDsa.VerifyData(new byte[1], 0, 1, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.VerifyData(new byte[1], new byte[1], new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.VerifyData(new byte[1], new byte[1], new HashAlgorithmName(""))); + + byte[] signature = wrapperDsa.SignData(input, HashAlgorithmName.SHA1); + Assert.True(wrapperDsa.VerifyData(input.AsSpan(), signature, HashAlgorithmName.SHA1)); + Assert.False(wrapperDsa.VerifyData(input.AsSpan(), signature.AsReadOnlySpan().Slice(0, signature.Length - 1), HashAlgorithmName.SHA1)); + } + } + + [ConditionalFact(nameof(SupportsKeyGeneration))] + public void VerifyData_Stream_UsesHashDataAndVerifySignature() + { + var input = new byte[1024]; + new Random(42).NextBytes(input); + + using (var wrapperDsa = new OverrideAbstractDSA(DSA.Create(1024))) + { + AssertExtensions.Throws("data", () => wrapperDsa.VerifyData((Stream)null, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("signature", () => wrapperDsa.VerifyData(new MemoryStream(new byte[1]), null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.VerifyData(new MemoryStream(new byte[1]), new byte[1], new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.VerifyData(new MemoryStream(new byte[1]), new byte[1], new HashAlgorithmName(""))); + + byte[] signature = wrapperDsa.SignData(new MemoryStream(input), HashAlgorithmName.SHA1); + Assert.True(wrapperDsa.VerifyData(new MemoryStream(input), signature, HashAlgorithmName.SHA1)); + Assert.False(wrapperDsa.VerifyData(new MemoryStream(input), signature.AsReadOnlySpan().Slice(0, signature.Length - 1).ToArray(), HashAlgorithmName.SHA1)); + } + } + + [ConditionalFact(nameof(SupportsKeyGeneration))] + public void VerifyData_Span_UsesTryHashDataAndVerifySignature() + { + var input = new byte[1024]; + new Random(42).NextBytes(input); + + using (var wrapperDsa = new OverrideAbstractDSA(DSA.Create(1024))) + { + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.VerifyData((Span)new byte[1], new byte[1], new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => wrapperDsa.VerifyData((Span)new byte[1], new byte[1], new HashAlgorithmName(""))); + + byte[] signature = wrapperDsa.SignData(input, HashAlgorithmName.SHA1); + Assert.True(wrapperDsa.VerifyData(input.AsSpan(), signature, HashAlgorithmName.SHA1)); + Assert.False(wrapperDsa.VerifyData(input.AsSpan(), signature.AsReadOnlySpan().Slice(0, signature.Length - 1), HashAlgorithmName.SHA1)); + } + } + + private sealed class EmptyDSA : DSA + { + public override byte[] CreateSignature(byte[] rgbHash) => throw new NotImplementedException(); + public override void ImportParameters(DSAParameters parameters) => throw new NotImplementedException(); + public override DSAParameters ExportParameters(bool includePrivateParameters) => throw new NotImplementedException(); + public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) => throw new NotImplementedException(); + + public new byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + base.HashData(data, offset, count, hashAlgorithm); + public new byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + base.HashData(data, hashAlgorithm); + public new bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + base.TryHashData(source, destination, hashAlgorithm, out bytesWritten); + } + + private sealed class OverrideAbstractDSA : DSA + { + private readonly DSA _dsa; + + public OverrideAbstractDSA(DSA dsa) => _dsa = dsa; + protected override void Dispose(bool disposing) => _dsa.Dispose(); + + public override byte[] CreateSignature(byte[] rgbHash) => _dsa.CreateSignature(rgbHash); + public override DSAParameters ExportParameters(bool includePrivateParameters) => _dsa.ExportParameters(includePrivateParameters); + public override void ImportParameters(DSAParameters parameters) => _dsa.ImportParameters(parameters); + public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) => _dsa.VerifySignature(rgbHash, rgbSignature); + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + (byte[])_dsa.GetType().GetMethod( + nameof(HashData), + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + null, + new Type[] { typeof(Stream), typeof(HashAlgorithmName) }, + null) + .Invoke(_dsa, new object[] { data, hashAlgorithm }); + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + (byte[])_dsa.GetType().GetMethod( + nameof(HashData), + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + null, + new Type[] { typeof(byte[]), typeof(int), typeof(int), typeof(HashAlgorithmName) }, + null) + .Invoke(_dsa, new object[] { data, offset, count, hashAlgorithm }); + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DefaultRSAProvider.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DefaultRSAProvider.cs index f778f3400a..f3c3414888 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DefaultRSAProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/DefaultRSAProvider.cs @@ -10,10 +10,7 @@ namespace System.Security.Cryptography.Rsa.Tests { private bool? _supports384PrivateKey; - public RSA Create() - { - return RSA.Create(); - } + public RSA Create() => RSA.Create(); public RSA Create(int keySize) { @@ -53,6 +50,8 @@ namespace System.Security.Cryptography.Rsa.Tests // Currently only RSACng does, which is the default provider on Windows. get { return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !(Create() is RSACryptoServiceProvider); } } + + public bool SupportsDecryptingIntoExactSpaceRequired => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); } public partial class RSAFactory diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs new file mode 100644 index 0000000000..644cf412f7 --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs @@ -0,0 +1,170 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Reflection; +using System.Security.Cryptography.EcDsa.Tests; +using Xunit; + +namespace System.Security.Cryptography.Algorithms.Tests +{ + public class ECDsaTests + { + [Fact] + public void Create_InvalidArgument_Throws() + { + AssertExtensions.Throws("algorithm", () => ECDsa.Create(null)); + Assert.Null(ECDsa.Create(Guid.NewGuid().ToString("N"))); + } + + [Fact] + public void NotSupportedBaseMethods_Throw() + { + using (var ecdsa = new OverrideAbstractECDsa(ECDsaFactory.Create())) + { + Assert.Throws(() => ecdsa.ExportParameters(false)); + Assert.Throws(() => ecdsa.ExportExplicitParameters(false)); + Assert.Throws(() => ecdsa.ImportParameters(default(ECParameters))); + Assert.Throws(() => ecdsa.GenerateKey(default(ECCurve))); + Assert.Throws(() => ecdsa.BaseHashData(null, HashAlgorithmName.SHA256)); + Assert.Throws(() => ecdsa.BaseHashData(null, 0, 0, HashAlgorithmName.SHA256)); + + Assert.Throws(() => ecdsa.FromXmlString(null)); + Assert.Throws(() => ecdsa.ToXmlString(false)); + } + } + + [Fact] + public void BaseProperties_ExpectedValues() + { + using (var ecdsa = new OverrideAbstractECDsa(ECDsaFactory.Create())) + { + Assert.Null(ecdsa.KeyExchangeAlgorithm); + Assert.Equal("ECDsa", ecdsa.SignatureAlgorithm); + } + } + + [Fact] + public void Array_SignData_VerifyData_UsesHashDataAndSignHashAndVerifyHash() + { + using (var ecdsa = new OverrideAbstractECDsa(ECDsaFactory.Create())) + { + AssertExtensions.Throws("data", () => ecdsa.SignData((byte[])null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => ecdsa.SignData(null, 0, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => ecdsa.SignData(new byte[1], -1, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => ecdsa.SignData(new byte[1], 2, 0, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => ecdsa.SignData(new byte[1], 0, -1, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => ecdsa.SignData(new byte[1], 0, 2, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new byte[1], 0, 1, new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new byte[1], 0, 1, new HashAlgorithmName(""))); + + AssertExtensions.Throws("data", () => ecdsa.VerifyData((byte[])null, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("data", () => ecdsa.VerifyData(null, 0, 0, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => ecdsa.VerifyData(new byte[1], -1, 0, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("offset", () => ecdsa.VerifyData(new byte[1], 2, 0, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => ecdsa.VerifyData(new byte[1], 0, -1, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("count", () => ecdsa.VerifyData(new byte[1], 0, 2, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("signature", () => ecdsa.VerifyData(new byte[1], 0, 1, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new byte[1], 0, 1, new byte[1], new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new byte[1], 0, 1, new byte[1], new HashAlgorithmName(""))); + + var input = new byte[1024]; + new Random().NextBytes(input); + + byte[] result = ecdsa.SignData(input, HashAlgorithmName.SHA256); + Assert.NotNull(result); + Assert.NotEmpty(result); + + Assert.False(ecdsa.VerifyData(input.AsSpan().Slice(1).ToArray(), result, HashAlgorithmName.SHA256)); + Assert.True(ecdsa.VerifyData(input, result, HashAlgorithmName.SHA256)); + } + } + + [Fact] + public void Stream_SignData_VerifyData_UsesHashDataAndSignHashAndVerifyHash() + { + using (var ecdsa = new OverrideAbstractECDsa(ECDsaFactory.Create())) + { + AssertExtensions.Throws("data", () => ecdsa.SignData((Stream)null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new MemoryStream(new byte[1]), new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.SignData(new MemoryStream(new byte[1]), new HashAlgorithmName(""))); + + AssertExtensions.Throws("data", () => ecdsa.VerifyData((Stream)null, null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("signature", () => ecdsa.VerifyData(new MemoryStream(new byte[1]), null, HashAlgorithmName.SHA1)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new MemoryStream(new byte[1]), new byte[1], new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData(new MemoryStream(new byte[1]), new byte[1], new HashAlgorithmName(""))); + + var input = new byte[1024]; + new Random().NextBytes(input); + + byte[] result = ecdsa.SignData(new MemoryStream(input), HashAlgorithmName.SHA256); + Assert.NotNull(result); + Assert.NotEmpty(result); + + Assert.False(ecdsa.VerifyData(new MemoryStream(input.AsSpan().Slice(1).ToArray()), result, HashAlgorithmName.SHA256)); + Assert.True(ecdsa.VerifyData(new MemoryStream(input), result, HashAlgorithmName.SHA256)); + } + } + + [Fact] + public void Span_TrySignData_VerifyData_UsesTryHashDataAndTrySignHashAndTryVerifyHash() + { + using (var ecdsa = new OverrideAbstractECDsa(ECDsaFactory.Create())) + { + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.TrySignData(new byte[1], new byte[1], new HashAlgorithmName(null), out int bytesWritten)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.TrySignData(new byte[1], new byte[1], new HashAlgorithmName(""), out int bytesWritten)); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData((ReadOnlySpan)new byte[1], new byte[1], new HashAlgorithmName(""))); + AssertExtensions.Throws("hashAlgorithm", () => ecdsa.VerifyData((ReadOnlySpan)new byte[1], new byte[1], new HashAlgorithmName(null))); + + var input = new byte[1024]; + new Random().NextBytes(input); + + byte[] output = new byte[1]; + int outputLength; + while (!ecdsa.TrySignData(input, output, HashAlgorithmName.SHA256, out outputLength)) + { + output = new byte[output.Length * 2]; + } + + Assert.False(ecdsa.VerifyData((ReadOnlySpan)input, new ReadOnlySpan(output, 0, outputLength - 1), HashAlgorithmName.SHA256)); + Assert.True(ecdsa.VerifyData((ReadOnlySpan)input, new ReadOnlySpan(output, 0, outputLength), HashAlgorithmName.SHA256)); + } + } + + private sealed class OverrideAbstractECDsa : ECDsa + { + private readonly ECDsa _ecdsa; + + public OverrideAbstractECDsa(ECDsa ecdsa) => _ecdsa = ecdsa; + + public override byte[] SignHash(byte[] hash) => _ecdsa.SignHash(hash); + + public override bool VerifyHash(byte[] hash, byte[] signature) => _ecdsa.VerifyHash(hash, signature); + + public byte[] BaseHashData(Stream data, HashAlgorithmName hashAlgorithm) => + base.HashData(data, hashAlgorithm); + + public byte[] BaseHashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + base.HashData(data, offset, count, hashAlgorithm); + + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + (byte[])_ecdsa.GetType().GetMethod( + nameof(HashData), + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + null, + new Type[] { typeof(Stream), typeof(HashAlgorithmName) }, + null) + .Invoke(_ecdsa, new object[] { data, hashAlgorithm }); + + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + (byte[])_ecdsa.GetType().GetMethod( + nameof(HashData), + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + null, + new Type[] { typeof(byte[]), typeof(int), typeof(int), typeof(HashAlgorithmName) }, + null) + .Invoke(_ecdsa, new object[] { data, offset, count, hashAlgorithm }); + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs index e626bd6340..249e6b6c56 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs @@ -9,7 +9,7 @@ using Xunit; namespace System.Security.Cryptography.Hashing.Algorithms.Tests { - public abstract class HashAlgorithmTest + public abstract partial class HashAlgorithmTest { protected abstract HashAlgorithm Create(); @@ -207,6 +207,12 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests } protected void Verify(byte[] input, string output) + { + Verify_Array(input, output); + Verify_Span(input, output); + } + + private void Verify_Array(byte[] input, string output) { byte[] expected = ByteUtils.HexToByteArray(output); byte[] actual; @@ -223,6 +229,8 @@ namespace System.Security.Cryptography.Hashing.Algorithms.Tests } } + partial void Verify_Span(byte[] input, string output); + protected void VerifyRepeating(string input, int repeatCount, string output) { using (Stream stream = new DataRepeatingStream(input, repeatCount)) diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.netcoreapp.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.netcoreapp.cs new file mode 100644 index 0000000000..c76951d8dc --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.netcoreapp.cs @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using Test.Cryptography; +using Xunit; + +namespace System.Security.Cryptography.Hashing.Algorithms.Tests +{ + public abstract partial class HashAlgorithmTest + { + partial void Verify_Span(byte[] input, string output) + { + byte[] expected = ByteUtils.HexToByteArray(output); + byte[] actual; + int bytesWritten; + + using (HashAlgorithm hash = Create()) + { + // Too small + actual = new byte[expected.Length - 1]; + Assert.False(hash.TryComputeHash(input, actual, out bytesWritten)); + Assert.Equal(0, bytesWritten); + + // Just right + actual = new byte[expected.Length]; + Assert.True(hash.TryComputeHash(input, actual, out bytesWritten)); + Assert.Equal(expected.Length, bytesWritten); + Assert.Equal(expected, actual); + + // Bigger than needed + actual = new byte[expected.Length + 1]; + actual[actual.Length - 1] = 42; + Assert.True(hash.TryComputeHash(input, actual, out bytesWritten)); + Assert.Equal(expected.Length, bytesWritten); + Assert.Equal(expected, actual.AsSpan().Slice(0, expected.Length).ToArray()); + Assert.Equal(42, actual[actual.Length - 1]); + } + } + + [Fact] + public void ComputeHash_TryComputeHash_HashSetExplicitlyByBoth() + { + using (HashAlgorithm hash = Create()) + { + byte[] input = Enumerable.Range(0, 100).Select(i => (byte)i).ToArray(); + + byte[] computeHashResult = hash.ComputeHash(input); + Assert.NotNull(computeHashResult); + Assert.NotNull(hash.Hash); + Assert.NotSame(computeHashResult, hash.Hash); + Assert.Equal(computeHashResult, hash.Hash); + + Assert.True(hash.TryComputeHash(input, computeHashResult, out int bytesWritten)); + Assert.Equal(computeHashResult.Length, bytesWritten); + Assert.Null(hash.Hash); + } + } + + [Fact] + public void Dispose_TryComputeHash_ThrowsException() + { + HashAlgorithm hash = Create(); + hash.Dispose(); + Assert.Throws(() => hash.ComputeHash(new byte[1])); + Assert.Throws(() => hash.TryComputeHash(new byte[1], new byte[1], out int bytesWritten)); + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs index e9926220e3..ee0e6cd5d0 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Security.Cryptography.Algorithms.Tests { - public class IncrementalHashTests + public partial class IncrementalHashTests { // Some arbitrarily chosen OID segments private static readonly byte[] s_hmacKey = { 2, 5, 29, 54, 1, 2, 84, 113, 54, 91, 1, 1, 2, 5, 29, 10, }; @@ -38,6 +38,31 @@ namespace System.Security.Cryptography.Algorithms.Tests }; } + [Fact] + public static void InvalidArguments_Throw() + { + AssertExtensions.Throws("hashAlgorithm", () => IncrementalHash.CreateHash(new HashAlgorithmName(null))); + AssertExtensions.Throws("hashAlgorithm", () => IncrementalHash.CreateHash(new HashAlgorithmName(""))); + + AssertExtensions.Throws("hashAlgorithm", () => IncrementalHash.CreateHMAC(new HashAlgorithmName(null), new byte[1])); + AssertExtensions.Throws("hashAlgorithm", () => IncrementalHash.CreateHMAC(new HashAlgorithmName(""), new byte[1])); + + AssertExtensions.Throws("key", () => IncrementalHash.CreateHMAC(HashAlgorithmName.SHA512, null)); + + using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(HashAlgorithmName.SHA512)) + { + AssertExtensions.Throws("data", () => incrementalHash.AppendData(null)); + AssertExtensions.Throws("data", () => incrementalHash.AppendData(null, 0, 0)); + + AssertExtensions.Throws("offset", () => incrementalHash.AppendData(new byte[1], -1, 1)); + + AssertExtensions.Throws("count", () => incrementalHash.AppendData(new byte[1], 0, -1)); + AssertExtensions.Throws("count", () => incrementalHash.AppendData(new byte[1], 0, 2)); + + Assert.Throws(() => incrementalHash.AppendData(new byte[2], 1, 2)); + } + } + [Theory] [MemberData(nameof(GetHashAlgorithms))] public static void VerifyIncrementalHash(HashAlgorithm referenceAlgorithm, HashAlgorithmName hashAlgorithm) @@ -45,6 +70,7 @@ namespace System.Security.Cryptography.Algorithms.Tests using (referenceAlgorithm) using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(hashAlgorithm)) { + Assert.Equal(hashAlgorithm, incrementalHash.AlgorithmName); VerifyIncrementalResult(referenceAlgorithm, incrementalHash); } } @@ -86,8 +112,8 @@ namespace System.Security.Cryptography.Algorithms.Tests while (position < s_inputBytes.Length - StepB) { - incrementalHash.AppendData(s_inputBytes, position, StepA); - position += StepA; + incrementalHash.AppendData(s_inputBytes, position, StepB); + position += StepB; } incrementalHash.AppendData(s_inputBytes, position, s_inputBytes.Length - position); diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.netcoreapp.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.netcoreapp.cs new file mode 100644 index 0000000000..a4372f0846 --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/IncrementalHashTests.netcoreapp.cs @@ -0,0 +1,184 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using Test.Cryptography; +using Xunit; + +namespace System.Security.Cryptography.Algorithms.Tests +{ + public partial class IncrementalHashTests + { + [Theory] + [MemberData(nameof(GetHashAlgorithms))] + public static void VerifyIncrementalHash_Span(HashAlgorithm referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + using (referenceAlgorithm) + using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(hashAlgorithm)) + { + VerifyIncrementalResult_Span(referenceAlgorithm, incrementalHash); + } + } + + [Theory] + [MemberData(nameof(GetHMACs))] + public static void VerifyIncrementalHMAC_Span(HMAC referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + using (referenceAlgorithm) + using (IncrementalHash incrementalHash = IncrementalHash.CreateHMAC(hashAlgorithm, s_hmacKey)) + { + referenceAlgorithm.Key = s_hmacKey; + VerifyIncrementalResult_Span(referenceAlgorithm, incrementalHash); + } + } + + private static void VerifyIncrementalResult_Span(HashAlgorithm referenceAlgorithm, IncrementalHash incrementalHash) + { + int referenceHashLength; + byte[] referenceHash = new byte[1]; + while (!referenceAlgorithm.TryComputeHash(s_inputBytes, referenceHash, out referenceHashLength)) + { + referenceHash = new byte[referenceHash.Length * 2]; + } + + const int StepA = 13; + const int StepB = 7; + int position = 0; + + while (position < s_inputBytes.Length - StepA) + { + incrementalHash.AppendData(new ReadOnlySpan(s_inputBytes, position, StepA)); + position += StepA; + } + + incrementalHash.AppendData(new ReadOnlySpan(s_inputBytes, position, s_inputBytes.Length - position)); + + byte[] incrementalA = new byte[referenceHashLength]; + int bytesWritten; + Assert.True(incrementalHash.TryGetHashAndReset(incrementalA, out bytesWritten)); + Assert.Equal(referenceHashLength, bytesWritten); + Assert.Equal(new Span(referenceHash, 0, referenceHashLength).ToArray(), new Span(incrementalA).Slice(0, bytesWritten).ToArray()); + + // Now try again, verifying both immune to step size behaviors, and that GetHashAndReset resets. + position = 0; + + while (position < s_inputBytes.Length - StepB) + { + incrementalHash.AppendData(new ReadOnlySpan(s_inputBytes, position, StepB)); + position += StepB; + } + + incrementalHash.AppendData(new ReadOnlySpan(s_inputBytes, position, s_inputBytes.Length - position)); + + byte[] incrementalB = new byte[referenceHashLength]; + Assert.True(incrementalHash.TryGetHashAndReset(incrementalB, out bytesWritten)); + Assert.Equal(referenceHashLength, bytesWritten); + Assert.Equal(new Span(referenceHash, 0, referenceHashLength).ToArray(), incrementalB); + } + + [Theory] + [MemberData(nameof(GetHashAlgorithms))] + public static void VerifyEmptyHash_Span(HashAlgorithm referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + using (referenceAlgorithm) + using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(hashAlgorithm)) + { + for (int i = 0; i < 10; i++) + { + incrementalHash.AppendData(ReadOnlySpan.Empty); + } + + byte[] referenceHash = referenceAlgorithm.ComputeHash(Array.Empty()); + byte[] incrementalResult = new byte[referenceHash.Length]; + Assert.True(incrementalHash.TryGetHashAndReset(incrementalResult, out int bytesWritten)); + Assert.Equal(referenceHash.Length, bytesWritten); + Assert.Equal(referenceHash, incrementalResult); + } + } + + [Theory] + [MemberData(nameof(GetHMACs))] + public static void VerifyEmptyHMAC_Span(HMAC referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + using (referenceAlgorithm) + using (IncrementalHash incrementalHash = IncrementalHash.CreateHMAC(hashAlgorithm, s_hmacKey)) + { + referenceAlgorithm.Key = s_hmacKey; + + for (int i = 0; i < 10; i++) + { + incrementalHash.AppendData(ReadOnlySpan.Empty); + } + + byte[] referenceHash = referenceAlgorithm.ComputeHash(Array.Empty()); + byte[] incrementalResult = new byte[referenceHash.Length]; + Assert.True(incrementalHash.TryGetHashAndReset(incrementalResult, out int bytesWritten)); + Assert.Equal(referenceHash.Length, bytesWritten); + Assert.Equal(referenceHash, incrementalResult); + } + } + + [Theory] + [MemberData(nameof(GetHashAlgorithms))] + public static void VerifyTrivialHash_Span(HashAlgorithm referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + using (referenceAlgorithm) + using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(hashAlgorithm)) + { + byte[] referenceHash = referenceAlgorithm.ComputeHash(Array.Empty()); + byte[] incrementalResult = new byte[referenceHash.Length]; + Assert.True(incrementalHash.TryGetHashAndReset(incrementalResult, out int bytesWritten)); + Assert.Equal(referenceHash.Length, bytesWritten); + Assert.Equal(referenceHash, incrementalResult); + } + } + + [Theory] + [MemberData(nameof(GetHMACs))] + public static void VerifyTrivialHMAC_Span(HMAC referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + using (referenceAlgorithm) + using (IncrementalHash incrementalHash = IncrementalHash.CreateHMAC(hashAlgorithm, s_hmacKey)) + { + referenceAlgorithm.Key = s_hmacKey; + + byte[] referenceHash = referenceAlgorithm.ComputeHash(Array.Empty()); + byte[] incrementalResult = new byte[referenceHash.Length]; + Assert.True(incrementalHash.TryGetHashAndReset(incrementalResult, out int bytesWritten)); + Assert.Equal(referenceHash.Length, bytesWritten); + Assert.Equal(referenceHash, incrementalResult); + } + } + + [Theory] + [MemberData(nameof(GetHashAlgorithms))] + public static void Dispose_HashAlgorithm_ThrowsException(HashAlgorithm referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + referenceAlgorithm.Dispose(); + var incrementalHash = IncrementalHash.CreateHash(hashAlgorithm); + incrementalHash.Dispose(); + + Assert.Throws(() => incrementalHash.AppendData(new byte[1])); + Assert.Throws(() => incrementalHash.AppendData(new ReadOnlySpan(new byte[1]))); + + Assert.Throws(() => incrementalHash.GetHashAndReset()); + Assert.Throws(() => incrementalHash.TryGetHashAndReset(new byte[1], out int _)); + } + + [Theory] + [MemberData(nameof(GetHMACs))] + public static void Dispose_HMAC_ThrowsException(HMAC referenceAlgorithm, HashAlgorithmName hashAlgorithm) + { + referenceAlgorithm.Dispose(); + var incrementalHash = IncrementalHash.CreateHMAC(hashAlgorithm, s_hmacKey); + incrementalHash.Dispose(); + + Assert.Throws(() => incrementalHash.AppendData(new byte[1])); + Assert.Throws(() => incrementalHash.AppendData(new ReadOnlySpan(new byte[1]))); + + Assert.Throws(() => incrementalHash.GetHashAndReset()); + Assert.Throws(() => incrementalHash.TryGetHashAndReset(new byte[1], out int _)); + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RSATests.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RSATests.cs new file mode 100644 index 0000000000..018d87a621 --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RSATests.cs @@ -0,0 +1,237 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Linq; +using Xunit; + +namespace System.Security.Cryptography.Algorithms.Tests +{ + public class RSATests + { + [Fact] + public void BaseVirtualsNotImplementedException() + { + var rsa = new EmptyRSA(); + Assert.Throws(() => rsa.Decrypt(null, null)); + Assert.Throws(() => rsa.Encrypt(null, null)); + Assert.Throws(() => rsa.SignHash(null, HashAlgorithmName.SHA256, null)); + Assert.Throws(() => rsa.VerifyHash(null, null, HashAlgorithmName.SHA256, null)); + Assert.Throws(() => rsa.HashData(null, 0, 0, HashAlgorithmName.SHA256)); + Assert.Throws(() => rsa.HashData(null, HashAlgorithmName.SHA256)); + } + + [Fact] + public void TryDecrypt_UsesDecrypt() + { + var rsa = new DelegateRSA { DecryptDelegate = (data, padding) => data }; + int bytesWritten; + byte[] actual, expected; + + Assert.False(rsa.TryDecrypt(new byte[3], new byte[2], RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(0, bytesWritten); + + expected = new byte[2] { 42, 43 }; + actual = new byte[2]; + Assert.True(rsa.TryDecrypt(expected, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + + actual = new byte[3]; + Assert.True(rsa.TryDecrypt(expected, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + Assert.Equal(0, actual[2]); + } + + [Fact] + public void TryEncrypt_UsesEncrypt() + { + var rsa = new DelegateRSA { EncryptDelegate = (data, padding) => data }; + int bytesWritten; + byte[] actual, expected; + + Assert.False(rsa.TryEncrypt(new byte[3], new byte[2], RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(0, bytesWritten); + + expected = new byte[2] { 42, 43 }; + actual = new byte[2]; + Assert.True(rsa.TryEncrypt(expected, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + + actual = new byte[3]; + Assert.True(rsa.TryEncrypt(expected, actual, RSAEncryptionPadding.OaepSHA1, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + Assert.Equal(0, actual[2]); + } + + [Fact] + public void TryHashData_UsesHashData() + { + var rsa = new DelegateRSA { HashDataArrayDelegate = (data, offset, count, name) => new Span(data, offset, count).ToArray() }; + int bytesWritten; + byte[] actual, expected; + + Assert.False(rsa.TryHashData(new byte[3], new byte[2], HashAlgorithmName.SHA256, out bytesWritten)); + Assert.Equal(0, bytesWritten); + + expected = new byte[2] { 42, 43 }; + actual = new byte[2]; + Assert.True(rsa.TryHashData(expected, actual, HashAlgorithmName.SHA256, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + + actual = new byte[3]; + Assert.True(rsa.TryHashData(expected, actual, HashAlgorithmName.SHA256, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + Assert.Equal(0, actual[2]); + } + + [Fact] + public void TrySignHash_UsesSignHash() + { + var rsa = new DelegateRSA { SignHashDelegate = (data, name, padding) => data }; + int bytesWritten; + byte[] actual, expected; + + Assert.False(rsa.TrySignHash(new byte[3], new byte[2], HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1, out bytesWritten)); + Assert.Equal(0, bytesWritten); + + expected = new byte[2] { 42, 43 }; + actual = new byte[2]; + Assert.True(rsa.TrySignHash(expected, actual, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + + actual = new byte[3]; + Assert.True(rsa.TrySignHash(expected, actual, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1, out bytesWritten)); + Assert.Equal(2, bytesWritten); + Assert.Equal(42, actual[0]); + Assert.Equal(43, actual[1]); + Assert.Equal(0, actual[2]); + } + + [Fact] + public void VerifyHashSpan_UsesVerifyHashArray() + { + bool invoked = false; + var rsa = new DelegateRSA { VerifyHashDelegate = delegate { invoked = true; return true; } }; + Assert.True(rsa.VerifyHash(ReadOnlySpan.Empty, ReadOnlySpan.Empty, HashAlgorithmName.SHA256, RSASignaturePadding.Pss)); + Assert.True(invoked); + } + + [Fact] + public void SignDataArray_UsesHashDataAndSignHash() + { + var rsa = new DelegateRSA(); + + AssertExtensions.Throws("data", () => rsa.SignData((byte[])null, HashAlgorithmName.SHA256, null)); + AssertExtensions.Throws("data", () => rsa.SignData(null, 0, 0, HashAlgorithmName.SHA256, null)); + + AssertExtensions.Throws("offset", () => rsa.SignData(new byte[1], -1, 0, HashAlgorithmName.SHA256, null)); + AssertExtensions.Throws("offset", () => rsa.SignData(new byte[1], 2, 0, HashAlgorithmName.SHA256, null)); + + AssertExtensions.Throws("count", () => rsa.SignData(new byte[1], 0, -1, HashAlgorithmName.SHA256, null)); + AssertExtensions.Throws("count", () => rsa.SignData(new byte[1], 0, 2, HashAlgorithmName.SHA256, null)); + + AssertExtensions.Throws("hashAlgorithm", () => rsa.SignData(new byte[1], 0, 1, new HashAlgorithmName(null), null)); + AssertExtensions.Throws("hashAlgorithm", () => rsa.SignData(new byte[1], 0, 1, new HashAlgorithmName(""), null)); + + AssertExtensions.Throws("padding", () => rsa.SignData(new byte[1], 0, 1, new HashAlgorithmName("abc"), null)); + + rsa.HashDataArrayDelegate = (data, offset, count, name) => new Span(data, offset, count).ToArray(); + rsa.SignHashDelegate = (data, name, padding) => data.Select(b => (byte)(b * 2)).ToArray(); + Assert.Equal(new byte[] { 6, 8, 10, 12, 14, 16 }, rsa.SignData(new byte[] { 3, 4, 5, 6, 7, 8 }, HashAlgorithmName.SHA256, RSASignaturePadding.Pss)); + Assert.Equal(new byte[] { 10, 12, 14 }, rsa.SignData(new byte[] { 3, 4, 5, 6, 7, 8 }, 2, 3, HashAlgorithmName.SHA256, RSASignaturePadding.Pss)); + } + + [Fact] + public void SignDataStream_UsesHashDataAndSignHash() + { + var rsa = new DelegateRSA(); + + AssertExtensions.Throws("data", () => rsa.SignData((Stream)null, HashAlgorithmName.SHA256, null)); + + AssertExtensions.Throws("hashAlgorithm", () => rsa.SignData(Stream.Null, new HashAlgorithmName(null), null)); + AssertExtensions.Throws("hashAlgorithm", () => rsa.SignData(Stream.Null, new HashAlgorithmName(""), null)); + + AssertExtensions.Throws("padding", () => rsa.SignData(Stream.Null, new HashAlgorithmName("abc"), null)); + + rsa.HashDataStreamDelegate = (stream, name) => ((MemoryStream)stream).ToArray(); + rsa.SignHashDelegate = (data, name, padding) => data.Select(b => (byte)(b * 2)).ToArray(); + Assert.Equal(new byte[] { 6, 8, 10, 12, 14, 16 }, rsa.SignData(new MemoryStream(new byte[] { 3, 4, 5, 6, 7, 8 }), HashAlgorithmName.SHA256, RSASignaturePadding.Pss)); + } + + [Fact] + public void VerifyDataStream_UsesHashDataAndVerifyHash() + { + var rsa = new DelegateRSA(); + + AssertExtensions.Throws("data", () => rsa.VerifyData((Stream)null, null, HashAlgorithmName.SHA256, null)); + + AssertExtensions.Throws("signature", () => rsa.VerifyData(Stream.Null, null, HashAlgorithmName.SHA256, null)); + + AssertExtensions.Throws("hashAlgorithm", () => rsa.VerifyData(Stream.Null, new byte[1], new HashAlgorithmName(null), null)); + AssertExtensions.Throws("hashAlgorithm", () => rsa.VerifyData(Stream.Null, new byte[1], new HashAlgorithmName(""), null)); + + AssertExtensions.Throws("padding", () => rsa.VerifyData(Stream.Null, new byte[1], new HashAlgorithmName("abc"), null)); + + rsa.HashDataStreamDelegate = (stream, name) => ((MemoryStream)stream).ToArray(); + rsa.VerifyHashDelegate = (hash, signature, name, padding) => hash[0] == 42; + Assert.True(rsa.VerifyData(new MemoryStream(new byte[] { 42 }), new byte[1] { 24 }, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); + } + + private sealed class EmptyRSA : RSA + { + public override RSAParameters ExportParameters(bool includePrivateParameters) => throw new NotImplementedException(); + public override void ImportParameters(RSAParameters parameters) => throw new NotImplementedException(); + public new byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => base.HashData(data, offset, count, hashAlgorithm); + public new byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => base.HashData(data, hashAlgorithm); + } + + private sealed class DelegateRSA : RSA + { + public Func DecryptDelegate; + public Func EncryptDelegate; + public Func SignHashDelegate = null; + public Func VerifyHashDelegate = null; + public Func HashDataArrayDelegate = null; + public Func HashDataStreamDelegate = null; + + public override byte[] Encrypt(byte[] data, RSAEncryptionPadding padding) => + EncryptDelegate(data, padding); + + public override byte[] Decrypt(byte[] data, RSAEncryptionPadding padding) => + DecryptDelegate(data, padding); + + public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + SignHashDelegate(hash, hashAlgorithm, padding); + + public override bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + VerifyHashDelegate(hash, signature, hashAlgorithm, padding); + + protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => + HashDataArrayDelegate(data, offset, count, hashAlgorithm); + + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => + HashDataStreamDelegate(data, hashAlgorithm); + + public new bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + base.TryHashData(source, destination, hashAlgorithm, out bytesWritten); + + public override RSAParameters ExportParameters(bool includePrivateParameters) => throw new NotImplementedException(); + public override void ImportParameters(RSAParameters parameters) => throw new NotImplementedException(); + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs index e458a11e49..54358a1f1f 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.cs @@ -10,44 +10,8 @@ using Xunit; namespace System.Security.Cryptography.RNG.Tests { - public class RandomNumberGeneratorTests + public partial class RandomNumberGeneratorTests { - [Fact] - public static void DifferentSequential_10() - { - DifferentSequential(10); - } - - [Fact] - public static void DifferentSequential_256() - { - DifferentSequential(256); - } - - [Fact] - public static void DifferentSequential_65536() - { - DifferentSequential(65536); - } - - [Fact] - public static void DifferentParallel_10() - { - DifferentParallel(10); - } - - [Fact] - public static void DifferentParallel_256() - { - DifferentParallel(256); - } - - [Fact] - public static void DifferentParallel_65536() - { - DifferentParallel(65536); - } - [Fact] public static void RandomDistribution() { @@ -136,7 +100,7 @@ namespace System.Security.Cryptography.RNG.Tests } [Fact] - public static void GetNonZeroBytes() + public static void GetNonZeroBytes_Array() { using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { @@ -172,7 +136,7 @@ namespace System.Security.Cryptography.RNG.Tests } [Fact] - public static void GetBytes_Offset_ZeroCount() + public static void GetBytes_Array_Offset_ZeroCount() { using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) { @@ -192,7 +156,11 @@ namespace System.Security.Cryptography.RNG.Tests } } - private static void DifferentSequential(int arraySize) + [Theory] + [InlineData(10)] + [InlineData(256)] + [InlineData(65536)] + public static void DifferentSequential_Array(int arraySize) { // Ensure that the RNG doesn't produce a stable set of data. byte[] first = new byte[arraySize]; @@ -214,7 +182,11 @@ namespace System.Security.Cryptography.RNG.Tests Assert.NotEqual(first, second); } - private static void DifferentParallel(int arraySize) + [Theory] + [InlineData(10)] + [InlineData(256)] + [InlineData(65536)] + public static void DifferentParallel(int arraySize) { // Ensure that two RNGs don't produce the same data series (such as being implemented via new Random(1)). byte[] first = new byte[arraySize]; diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.netcoreapp.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.netcoreapp.cs new file mode 100644 index 0000000000..3ca4bbabaf --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RandomNumberGeneratorTests.netcoreapp.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Security.Cryptography.RNG.Tests +{ + public partial class RandomNumberGeneratorTests + { + [Theory] + [InlineData(10)] + [InlineData(256)] + [InlineData(65536)] + public static void DifferentSequential_Span(int arraySize) + { + // Ensure that the RNG doesn't produce a stable set of data. + var first = new byte[arraySize]; + var second = new byte[arraySize]; + + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + rng.GetBytes((Span)first); + rng.GetBytes((Span)second); + } + + // Random being random, there is a chance that it could produce the same sequence. + // The smallest test case that we have is 10 bytes. + // The probability that they are the same, given a Truly Random Number Generator is: + // Pmatch(byte0) * Pmatch(byte1) * Pmatch(byte2) * ... * Pmatch(byte9) + // = 1/256 * 1/256 * ... * 1/256 + // = 1/(256^10) + // = 1/1,208,925,819,614,629,174,706,176 + Assert.NotEqual(first, second); + } + + [Fact] + public static void GetBytes_Span_ZeroCount() + { + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + var rand = new byte[1] { 1 }; + rng.GetBytes(new Span(rand, 0, 0)); + Assert.Equal(1, rand[0]); + } + } + + [Fact] + public static void GetNonZeroBytes_Span() + { + using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + { + var rand = new byte[65536]; + rng.GetNonZeroBytes(new Span(rand)); + Assert.Equal(-1, Array.IndexOf(rand, 0)); + } + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs index 4d91d5667a..d9102da95f 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/RijndaelTests.cs @@ -51,6 +51,42 @@ namespace System.Security.Cryptography.Encryption.Rijndael.Tests Assert.Equal(PaddingMode.PKCS7, alg.Padding); } + [Fact] + public static void VerifyBlocksizeIVNulling() + { + using (var testIVAlg = Rijndael.Create()) + { + using (var alg = Rijndael.Create()) + { + alg.IV = testIVAlg.IV; + alg.BlockSize = 128; + Assert.Equal(testIVAlg.IV, alg.IV); + } + + using (var alg = new RijndaelManaged()) + { + alg.IV = testIVAlg.IV; + alg.BlockSize = 128; + Assert.Equal(testIVAlg.IV, alg.IV); + } + + using (var alg = new RijndaelLegalSizesBreaker()) + { + // This one should set IV to null on setting BlockSize since there is only one valid BlockSize + alg.IV = testIVAlg.IV; + alg.BlockSize = 1; + Assert.Throws(() => alg.IV); + } + + using (var alg = new RijndaelMinimal()) + { + alg.IV = testIVAlg.IV; + alg.BlockSize = 128; + Assert.Equal(testIVAlg.IV, alg.IV); + } + } + } + [Fact] public static void EncryptDecryptKnownECB192() { @@ -177,6 +213,84 @@ namespace System.Security.Cryptography.Encryption.Rijndael.Tests } } + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void EncryptWithLargeOutputBuffer(bool blockAlignedOutput) + { + using (Rijndael alg = Rijndael.Create()) + using (ICryptoTransform xform = alg.CreateEncryptor()) + { + // 8 blocks, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize + outputPadding]; + // 2 blocks of 0x00 + byte[] input = new byte[alg.BlockSize / 4]; + int outputOffset = 0; + + outputOffset += xform.TransformBlock(input, 0, input.Length, output, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, output, outputOffset, overflow.Length); + outputOffset += overflow.Length; + + Assert.Equal(3 * (alg.BlockSize / 8), outputOffset); + string outputAsHex = output.ByteArrayToHex(); + Assert.NotEqual(new string('0', outputOffset * 2), outputAsHex.Substring(0, outputOffset * 2)); + Assert.Equal(new string('0', (output.Length - outputOffset) * 2), outputAsHex.Substring(outputOffset * 2)); + } + } + + [Theory] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] + public static void TransformWithTooShortOutputBuffer(bool encrypt, bool blockAlignedOutput) + { + using (Rijndael alg = Rijndael.Create()) + using (ICryptoTransform xform = encrypt ? alg.CreateEncryptor() : alg.CreateDecryptor()) + { + // 1 block, plus maybe three bytes + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] output = new byte[alg.BlockSize / 8 + outputPadding]; + // 3 blocks of 0x00 + byte[] input = new byte[3 * (alg.BlockSize / 8)]; + + Assert.Throws( + () => xform.TransformBlock(input, 0, input.Length, output, 0)); + + Assert.Equal(new byte[output.Length], output); + } + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void MultipleBlockDecryptTransform(bool blockAlignedOutput) + { + const string ExpectedOutput = "This is a 128-bit block test"; + + int outputPadding = blockAlignedOutput ? 0 : 3; + byte[] key = "0123456789ABCDEFFEDCBA9876543210".HexToByteArray(); + byte[] iv = "0123456789ABCDEF0123456789ABCDEF".HexToByteArray(); + byte[] outputBytes = new byte[iv.Length * 2 + outputPadding]; + byte[] input = "D1BF87C650FCD10B758445BE0E0A99D14652480DF53423A8B727D30C8C010EDE".HexToByteArray(); + int outputOffset = 0; + + using (Rijndael alg = Rijndael.Create()) + using (ICryptoTransform xform = alg.CreateDecryptor(key, iv)) + { + Assert.Equal(2 * alg.BlockSize, (outputBytes.Length - outputPadding) * 8); + outputOffset += xform.TransformBlock(input, 0, input.Length, outputBytes, outputOffset); + byte[] overflow = xform.TransformFinalBlock(Array.Empty(), 0, 0); + Buffer.BlockCopy(overflow, 0, outputBytes, outputOffset, overflow.Length); + outputOffset += overflow.Length; + } + + string decrypted = Encoding.ASCII.GetString(outputBytes, 0, outputOffset); + Assert.Equal(ExpectedOutput, decrypted); + } + private class RijndaelLegalSizesBreaker : RijndaelMinimal { public RijndaelLegalSizesBreaker() diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj index 991afac459..4ecce64cd1 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj @@ -16,9 +16,6 @@ $(DefineConstants);netcoreapp - - CommonTest\System\PlatformDetection.cs - CommonTest\System\IO\PositionValueStream.cs @@ -137,7 +134,6 @@ Common\Interop\Unix\Interop.Libraries.cs - @@ -149,12 +145,18 @@ + + + + + + @@ -199,6 +201,9 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\DSA\DSAXml.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\ECDsa\ECDsaTests.netcoreapp.cs + CommonTest\System\Security\Cryptography\AlgorithmImplementations\ECDsa\ECDsaXml.cs @@ -211,6 +216,9 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\RC2\RC2Tests.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.netcoreapp.cs + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAKeyExchangeFormatter.cs @@ -220,6 +228,9 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAXml.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\SignVerify.netcoreapp.cs + diff --git a/external/corefx/src/System.Security.Cryptography.Cng/dir.props b/external/corefx/src/System.Security.Cryptography.Cng/dir.props index b73ac8f9b8..aa18693275 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/dir.props +++ b/external/corefx/src/System.Security.Cryptography.Cng/dir.props @@ -7,6 +7,5 @@ true false true - false \ No newline at end of file diff --git a/external/corefx/src/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj b/external/corefx/src/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj index 31f887a973..e51943696b 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj +++ b/external/corefx/src/System.Security.Cryptography.Cng/pkg/System.Security.Cryptography.Cng.pkgproj @@ -3,20 +3,19 @@ - net461;netcoreapp2.0;$(UAPvNextTFM);$(AllXamarinFrameworks) + net461;netcoreapp2.1;$(UAPvNextTFM);$(AllXamarinFrameworks) - + + runtimes/win/lib/$(UAPvNextTFM) + + - - - - - lib/netstandard1.6 - - + + + diff --git a/external/corefx/src/System.Security.Cryptography.Cng/ref/Configurations.props b/external/corefx/src/System.Security.Cryptography.Cng/ref/Configurations.props index 4a020c2fa5..5977e79b9a 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/ref/Configurations.props +++ b/external/corefx/src/System.Security.Cryptography.Cng/ref/Configurations.props @@ -1,13 +1,16 @@  - + netcoreapp; netfx; - uap; netstandard; net462; net47; + + + $(PackageConfigurations) + uap; \ No newline at end of file diff --git a/external/corefx/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj b/external/corefx/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj index 5e9e9935ef..2eb01023c3 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj +++ b/external/corefx/src/System.Security.Cryptography.Cng/ref/System.Security.Cryptography.Cng.csproj @@ -6,6 +6,9 @@ {9FD12550-3A7C-49D3-9A1E-C4B7410989DD} $(DefineConstants);FEATURE_HASHDATA true + + 4.3.1.0 diff --git a/external/corefx/src/System.Security.Cryptography.Cng/src/Configurations.props b/external/corefx/src/System.Security.Cryptography.Cng/src/Configurations.props index a42f211267..2eb688563f 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/src/Configurations.props +++ b/external/corefx/src/System.Security.Cryptography.Cng/src/Configurations.props @@ -1,15 +1,18 @@  - + netstandard; netstandard1.3; netstandard1.4; netfx-Windows_NT; netcoreapp-Windows_NT; - uap-Windows_NT; net462-Windows_NT; net47-Windows_NT; + + + $(PackageConfigurations) + uap-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs b/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs index 0a3d5a975a..4ee0b5f6d3 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs +++ b/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs @@ -56,37 +56,33 @@ namespace Internal.Cryptography Debug.Assert(outputOffset >= 0); Debug.Assert(output.Length - outputOffset >= count); - unsafe + int numBytesWritten; + ErrorCode errorCode; + using (SafeNCryptKeyHandle keyHandle = _cngKey.Handle) { - fixed (byte *pInput = input, pOutput = output) + var inputSpan = new ReadOnlySpan(input, inputOffset, count); + var outputSpan = new Span(output, outputOffset, count); + unsafe { - int numBytesWritten; - ErrorCode errorCode; - using (SafeNCryptKeyHandle keyHandle = _cngKey.Handle) - { - if (_encrypting) - { - errorCode = Interop.NCrypt.NCryptEncrypt(keyHandle, pInput + inputOffset, count, null, pOutput + outputOffset, count, out numBytesWritten, AsymmetricPaddingMode.None); - } - else - { - errorCode = Interop.NCrypt.NCryptDecrypt(keyHandle, pInput + inputOffset, count, null, pOutput + outputOffset, count, out numBytesWritten, AsymmetricPaddingMode.None); - } - } - if (errorCode != ErrorCode.ERROR_SUCCESS) - throw errorCode.ToCryptographicException(); - - if (numBytesWritten != count) - { - // CNG gives us no way to tell NCryptDecrypt() that we're decrypting the final block, nor is it performing any padding/depadding for us. - // So there's no excuse for a provider to hold back output for "future calls." Though this isn't technically our problem to detect, we might as well - // detect it now for easier diagnosis. - throw new CryptographicException(SR.Cryptography_UnexpectedTransformTruncation); - } - - return numBytesWritten; + errorCode = _encrypting ? + Interop.NCrypt.NCryptEncrypt(keyHandle, inputSpan, inputSpan.Length, null, outputSpan, outputSpan.Length, out numBytesWritten, AsymmetricPaddingMode.None) : + Interop.NCrypt.NCryptDecrypt(keyHandle, inputSpan, inputSpan.Length, null, outputSpan, outputSpan.Length, out numBytesWritten, AsymmetricPaddingMode.None); } } + if (errorCode != ErrorCode.ERROR_SUCCESS) + { + throw errorCode.ToCryptographicException(); + } + + if (numBytesWritten != count) + { + // CNG gives us no way to tell NCryptDecrypt() that we're decrypting the final block, nor is it performing any padding/depadding for us. + // So there's no excuse for a provider to hold back output for "future calls." Though this isn't technically our problem to detect, we might as well + // detect it now for easier diagnosis. + throw new CryptographicException(SR.Cryptography_UnexpectedTransformTruncation); + } + + return numBytesWritten; } public sealed override byte[] TransformFinal(byte[] input, int inputOffset, int count) diff --git a/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj b/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj index bcb71fae68..3da22dc865 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj +++ b/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj @@ -276,6 +276,7 @@ + diff --git a/external/corefx/src/System.Security.Cryptography.Cng/tests/RSACngProvider.cs b/external/corefx/src/System.Security.Cryptography.Cng/tests/RSACngProvider.cs index 41906c1d0d..17a68f213c 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/tests/RSACngProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Cng/tests/RSACngProvider.cs @@ -10,15 +10,9 @@ namespace System.Security.Cryptography.Rsa.Tests { private bool? _supports384PrivateKey; - public RSA Create() - { - return new RSACng(); - } + public RSA Create() => new RSACng(); - public RSA Create(int keySize) - { - return new RSACng(keySize); - } + public RSA Create(int keySize) => new RSACng(keySize); public bool Supports384PrivateKey { @@ -27,7 +21,8 @@ namespace System.Security.Cryptography.Rsa.Tests if (!_supports384PrivateKey.HasValue) { // For Windows 7 (Microsoft Windows 6.1) and Windows 8 (Microsoft Windows 6.2) this is false for RSACng. - _supports384PrivateKey = !RuntimeInformation.OSDescription.Contains("Windows 6.1") && + _supports384PrivateKey = + !RuntimeInformation.OSDescription.Contains("Windows 6.1") && !RuntimeInformation.OSDescription.Contains("Windows 6.2"); } @@ -35,10 +30,9 @@ namespace System.Security.Cryptography.Rsa.Tests } } - public bool SupportsSha2Oaep - { - get { return true; } - } + public bool SupportsSha2Oaep => true; + + public bool SupportsDecryptingIntoExactSpaceRequired => true; } public partial class RSAFactory diff --git a/external/corefx/src/System.Security.Cryptography.Cng/tests/System.Security.Cryptography.Cng.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Cng/tests/System.Security.Cryptography.Cng.Tests.csproj index 725bc44b6e..a6f8f53639 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/tests/System.Security.Cryptography.Cng.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Cng/tests/System.Security.Cryptography.Cng.Tests.csproj @@ -27,9 +27,6 @@ - - CommonTest\System\PlatformDetection.cs - CommonTest\AlgorithmImplementations\AES\AesCipherTests.Data.cs @@ -130,9 +127,15 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\DSA\DSAXml.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\ECDsa\ECDsaTests.netcoreapp.cs + CommonTest\System\Security\Cryptography\AlgorithmImplementations\ECDsa\ECDsaXml.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.netcoreapp.cs + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAKeyExchangeFormatter.cs @@ -142,6 +145,9 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAXml.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\SignVerify.netcoreapp.cs + diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj b/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj index bd110f5f28..d0f760658a 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj @@ -86,6 +86,7 @@ + diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs index 8b938e1035..09b50c4ac0 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs @@ -931,7 +931,6 @@ namespace Internal.NativeCrypto Debug.Assert(outputCount >= 0); Debug.Assert(outputCount <= output.Length - outputOffset); Debug.Assert((inputCount % 8) == 0); - Debug.Assert((outputCount % 8) == 0); // Figure out how big the encrypted data will be int cbEncryptedData = inputCount; @@ -956,6 +955,16 @@ namespace Internal.NativeCrypto } Debug.Assert(encryptedDataLength == cbEncryptedData); + if (isFinal) + { + Debug.Assert(outputCount == inputCount); + } + else + { + Debug.Assert(outputCount >= encryptedDataLength); + outputCount = encryptedDataLength; + } + // If isFinal, padding was added so ignore it by using outputCount as size Buffer.BlockCopy(encryptedData, 0, output, outputOffset, outputCount); @@ -981,7 +990,6 @@ namespace Internal.NativeCrypto Debug.Assert(outputCount >= 0); Debug.Assert(outputCount <= output.Length - outputOffset); Debug.Assert((inputCount % 8) == 0); - Debug.Assert((outputCount % 8) == 0); byte[] dataTobeDecrypted = new byte[inputCount]; Buffer.BlockCopy(input, inputOffset, dataTobeDecrypted, 0, inputCount); @@ -993,7 +1001,7 @@ namespace Internal.NativeCrypto throw GetErrorCode().ToCryptographicException(); } - Buffer.BlockCopy(dataTobeDecrypted, 0, output, outputOffset, outputCount); + Buffer.BlockCopy(dataTobeDecrypted, 0, output, outputOffset, decryptedDataLength); return decryptedDataLength; } diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs index 0fead97f8c..de89a083f0 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs @@ -50,9 +50,12 @@ namespace System.Security.Cryptography [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "This is the implementation of DSACryptoServiceProvider")] public override byte[] CreateSignature(byte[] rgbHash) => _impl.CreateSignature(rgbHash); + public override bool TryCreateSignature(ReadOnlySpan source, Span destination, out int bytesWritten) => + _impl.TryCreateSignature(source, destination, out bytesWritten); + public CspKeyContainerInfo CspKeyContainerInfo { - get {throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); } + get { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); } } protected override void Dispose(bool disposing) @@ -91,6 +94,14 @@ namespace System.Security.Cryptography return AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); } + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + if (hashAlgorithm != HashAlgorithmName.SHA1) + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); + + return AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); + } + public void ImportCspBlob(byte[] keyBlob) { DSAParameters parameters = keyBlob.ToDSAParameters(!IsPublic(keyBlob), null); @@ -156,7 +167,7 @@ namespace System.Security.Cryptography public override byte[] SignData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) { if (hashAlgorithm != HashAlgorithmName.SHA1) - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm); + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); return _impl.SignData(data, offset, count, hashAlgorithm); } @@ -164,11 +175,19 @@ namespace System.Security.Cryptography public override byte[] SignData(Stream data, HashAlgorithmName hashAlgorithm) { if (hashAlgorithm != HashAlgorithmName.SHA1) - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm); + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); return _impl.SignData(data, hashAlgorithm); } + public override bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) + { + if (hashAlgorithm != HashAlgorithmName.SHA1) + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); + + return _impl.TrySignData(source, destination, hashAlgorithm, out bytesWritten); + } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "This is the implementation of DSACryptoServiceProvider")] public byte[] SignHash(byte[] rgbHash, string str) { @@ -181,7 +200,7 @@ namespace System.Security.Cryptography // Only SHA1 allowed; the default value is SHA1 if (str != null && string.Compare(str, "SHA1", StringComparison.OrdinalIgnoreCase) != 0) - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm); + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, str); return CreateSignature(rgbHash); } @@ -200,7 +219,7 @@ namespace System.Security.Cryptography // Only SHA1 allowed; the default value is SHA1 if (str != null && string.Compare(str, "SHA1", StringComparison.OrdinalIgnoreCase) != 0) - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm); + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, str); return _impl.VerifySignature(rgbHash, rgbSignature); } @@ -208,7 +227,7 @@ namespace System.Security.Cryptography public override bool VerifyData(byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm) { if (hashAlgorithm != HashAlgorithmName.SHA1) - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm); + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); return _impl.VerifyData(data, offset, count, signature, hashAlgorithm); } @@ -216,7 +235,15 @@ namespace System.Security.Cryptography public override bool VerifyData(Stream data, byte[] signature, HashAlgorithmName hashAlgorithm) { if (hashAlgorithm != HashAlgorithmName.SHA1) - throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm); + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); + + return _impl.VerifyData(data, signature, hashAlgorithm); + } + + public override bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm) + { + if (hashAlgorithm != HashAlgorithmName.SHA1) + throw new CryptographicException(SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name); return _impl.VerifyData(data, signature, hashAlgorithm); } @@ -224,6 +251,9 @@ namespace System.Security.Cryptography public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) => _impl.VerifySignature(rgbHash, rgbSignature); + public override bool VerifySignature(ReadOnlySpan rgbHash, ReadOnlySpan rgbSignature) => + _impl.VerifySignature(rgbHash, rgbSignature); + // UseMachineKeyStore has no effect in Unix public static bool UseMachineKeyStore { get; set; } diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs index 5ef0139508..a3517b0a49 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/MD5CryptoServiceProvider.cs @@ -24,19 +24,21 @@ namespace System.Security.Cryptography // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. } - protected override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected override void HashCore(byte[] array, int ibStart, int cbSize) => _incrementalHash.AppendData(array, ibStart, cbSize); - } - protected override byte[] HashFinal() - { - return _incrementalHash.GetHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _incrementalHash.AppendData(source); + + protected override byte[] HashFinal() => + _incrementalHash.GetHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _incrementalHash.TryGetHashAndReset(destination, out bytesWritten); // The Hash and HashSize properties are not overridden since the correct values are returned from base. - protected sealed override void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (disposing) { diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RNGCryptoServiceProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RNGCryptoServiceProvider.cs index 245e660234..f1da5bfe0d 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RNGCryptoServiceProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RNGCryptoServiceProvider.cs @@ -26,7 +26,9 @@ namespace System.Security.Cryptography public override void GetBytes(byte[] data) => _impl.GetBytes(data); public override void GetBytes(byte[] data, int offset, int count) => _impl.GetBytes(data, offset, count); + public override void GetBytes(Span data) => _impl.GetBytes(data); public override void GetNonZeroBytes(byte[] data) => _impl.GetNonZeroBytes(data); + public override void GetNonZeroBytes(Span data) => _impl.GetNonZeroBytes(data); protected override void Dispose(bool disposing) { diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs index e0bd470aa5..0d9a3bb81e 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Unix.cs @@ -27,20 +27,14 @@ namespace System.Security.Cryptography _impl = RSA.Create(dwKeySize); } - public RSACryptoServiceProvider(int dwKeySize, CspParameters parameters) - { + public RSACryptoServiceProvider(int dwKeySize, CspParameters parameters) => throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters))); - } - public RSACryptoServiceProvider(CspParameters parameters) - { + public RSACryptoServiceProvider(CspParameters parameters) => throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspParameters))); - } - public CspKeyContainerInfo CspKeyContainerInfo - { - get { throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); } - } + public CspKeyContainerInfo CspKeyContainerInfo => + throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_CAPI_Required, nameof(CspKeyContainerInfo))); public byte[] Decrypt(byte[] rgb, bool fOAEP) { @@ -61,19 +55,22 @@ namespace System.Security.Cryptography if (padding == null) throw new ArgumentNullException(nameof(padding)); - if (padding == RSAEncryptionPadding.Pkcs1) - { - return Decrypt(data, fOAEP: false); - } - else if (padding == RSAEncryptionPadding.OaepSHA1) - { - // For compat, this prevents OaepSHA2 options as fOAEP==true will cause Decrypt to use OaepSHA1 - return Decrypt(data, fOAEP: true); - } - else - { + return + padding == RSAEncryptionPadding.Pkcs1 ? Decrypt(data, fOAEP: false) : + padding == RSAEncryptionPadding.OaepSHA1 ? Decrypt(data, fOAEP: true) : // For compat, this prevents OaepSHA2 options as fOAEP==true will cause Decrypt to use OaepSHA1 throw PaddingModeNotSupported(); - } + } + + public override bool TryDecrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) + { + if (padding == null) + throw new ArgumentNullException(nameof(padding)); + if (source.Length > (KeySize / 8)) + throw new CryptographicException(SR.Format(SR.Cryptography_Padding_DecDataTooBig, Convert.ToString(KeySize / 8))); + if (padding != RSAEncryptionPadding.Pkcs1 && padding != RSAEncryptionPadding.OaepSHA1) + throw PaddingModeNotSupported(); + + return _impl.TryDecrypt(source, destination, padding, out bytesWritten); } protected override void Dispose(bool disposing) @@ -88,9 +85,7 @@ namespace System.Security.Cryptography public byte[] Encrypt(byte[] rgb, bool fOAEP) { if (rgb == null) - { throw new ArgumentNullException(nameof(rgb)); - } return _impl.Encrypt(rgb, fOAEP ? RSAEncryptionPadding.OaepSHA1 : RSAEncryptionPadding.Pkcs1); } @@ -102,19 +97,20 @@ namespace System.Security.Cryptography if (padding == null) throw new ArgumentNullException(nameof(padding)); - if (padding == RSAEncryptionPadding.Pkcs1) - { - return Encrypt(data, fOAEP: false); - } - else if (padding == RSAEncryptionPadding.OaepSHA1) - { - // For compat, this prevents OaepSHA2 options as fOAEP==true will cause Decrypt to use OaepSHA1 - return Encrypt(data, fOAEP: true); - } - else - { + return + padding == RSAEncryptionPadding.Pkcs1 ? Encrypt(data, fOAEP: false) : + padding == RSAEncryptionPadding.OaepSHA1 ? Encrypt(data, fOAEP: true) : // For compat, this prevents OaepSHA2 options as fOAEP==true will cause Decrypt to use OaepSHA1 throw PaddingModeNotSupported(); - } + } + + public override bool TryEncrypt(ReadOnlySpan source, Span destination, RSAEncryptionPadding padding, out int bytesWritten) + { + if (padding == null) + throw new ArgumentNullException(nameof(padding)); + if (padding != RSAEncryptionPadding.Pkcs1 && padding != RSAEncryptionPadding.OaepSHA1) + throw PaddingModeNotSupported(); + + return _impl.TryEncrypt(source, destination, padding, out bytesWritten); } public byte[] ExportCspBlob(bool includePrivateParameters) @@ -129,6 +125,9 @@ namespace System.Security.Cryptography protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) => AsymmetricAlgorithmHelpers.HashData(data, offset, count, hashAlgorithm); + protected override bool TryHashData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, out int bytesWritten) => + AsymmetricAlgorithmHelpers.TryHashData(source, destination, hashAlgorithm, out bytesWritten); + protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) => AsymmetricAlgorithmHelpers.HashData(data, hashAlgorithm); @@ -166,10 +165,7 @@ namespace System.Security.Cryptography // PersistKeyInCsp has no effect in Unix public bool PersistKeyInCsp { get; set; } - public bool PublicOnly - { - get { return _publicOnly; } - } + public bool PublicOnly => _publicOnly; public override string SignatureAlgorithm => "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; @@ -179,6 +175,9 @@ namespace System.Security.Cryptography public override byte[] SignData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => _impl.SignData(data, offset, count, hashAlgorithm, padding); + public override bool TrySignData(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) => + _impl.TrySignData(source, destination, hashAlgorithm, padding, out bytesWritten); + public byte[] SignData(byte[] buffer, int offset, int count, object halg) => _impl.SignData(buffer, offset, count, HashAlgorithmNames.ObjToHashAlgorithmName(halg), RSASignaturePadding.Pkcs1); @@ -191,6 +190,9 @@ namespace System.Security.Cryptography public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => _impl.SignHash(hash, hashAlgorithm, padding); + public override bool TrySignHash(ReadOnlySpan source, Span destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten) => + _impl.TrySignHash(source, destination, hashAlgorithm, padding, out bytesWritten); + public byte[] SignHash(byte[] rgbHash, string str) { if (rgbHash == null) @@ -210,29 +212,42 @@ namespace System.Security.Cryptography public override bool VerifyData(byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => _impl.VerifyData(data, offset, count, signature, hashAlgorithm, padding); + public override bool VerifyData(ReadOnlySpan data, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + _impl.VerifyData(data, signature, hashAlgorithm, padding); + public override bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) { + if (hash == null) + { + throw new ArgumentNullException(nameof(hash)); + } if (signature == null) + { throw new ArgumentNullException(nameof(signature)); - if (padding != RSASignaturePadding.Pkcs1) - throw PaddingModeNotSupported(); + } - // _impl does remaining parameter validation - - return _impl.VerifyHash(hash, signature, hashAlgorithm, padding); + return VerifyHash((ReadOnlySpan)hash, (ReadOnlySpan)signature, hashAlgorithm, padding); } + public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding) => + padding == null ? throw new ArgumentNullException(nameof(padding)) : + padding != RSASignaturePadding.Pkcs1 ? throw PaddingModeNotSupported() : + _impl.VerifyHash(hash, signature, hashAlgorithm, padding); + public bool VerifyHash(byte[] rgbHash, string str, byte[] rgbSignature) { if (rgbHash == null) + { throw new ArgumentNullException(nameof(rgbHash)); + } if (rgbSignature == null) + { throw new ArgumentNullException(nameof(rgbSignature)); + } - // _impl does remaining parameter validation - - HashAlgorithmName algName = HashAlgorithmNames.NameOrOidToHashAlgorithmName(str); - return _impl.VerifyHash(rgbHash, rgbSignature, algName, RSASignaturePadding.Pkcs1); + return VerifyHash( + (ReadOnlySpan)rgbHash, (ReadOnlySpan)rgbSignature, + HashAlgorithmNames.NameOrOidToHashAlgorithmName(str), RSASignaturePadding.Pkcs1); } // UseMachineKeyStore has no effect in Unix diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs index 1194fc371c..bfee5c9f1a 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA1CryptoServiceProvider.cs @@ -27,19 +27,21 @@ namespace System.Security.Cryptography // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. } - protected override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected override void HashCore(byte[] array, int ibStart, int cbSize) => _incrementalHash.AppendData(array, ibStart, cbSize); - } - protected override byte[] HashFinal() - { - return _incrementalHash.GetHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _incrementalHash.AppendData(source); + + protected override byte[] HashFinal() => + _incrementalHash.GetHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _incrementalHash.TryGetHashAndReset(destination, out bytesWritten); // The Hash and HashSize properties are not overridden since the correct values are returned from base. - protected sealed override void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (disposing) { diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs index 22c8bcc690..cb046dd397 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA256CryptoServiceProvider.cs @@ -27,19 +27,21 @@ namespace System.Security.Cryptography // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. } - protected override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected override void HashCore(byte[] array, int ibStart, int cbSize) => _incrementalHash.AppendData(array, ibStart, cbSize); - } - protected override byte[] HashFinal() - { - return _incrementalHash.GetHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _incrementalHash.AppendData(source); + + protected override byte[] HashFinal() => + _incrementalHash.GetHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _incrementalHash.TryGetHashAndReset(destination, out bytesWritten); // The Hash and HashSize properties are not overridden since the correct values are returned from base. - protected sealed override void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (disposing) { diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs index 859fd7e55c..8cb2fa02ab 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA384CryptoServiceProvider.cs @@ -27,19 +27,21 @@ namespace System.Security.Cryptography // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. } - protected override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected override void HashCore(byte[] array, int ibStart, int cbSize) => _incrementalHash.AppendData(array, ibStart, cbSize); - } - protected override byte[] HashFinal() - { - return _incrementalHash.GetHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _incrementalHash.AppendData(source); + + protected override byte[] HashFinal() => + _incrementalHash.GetHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _incrementalHash.TryGetHashAndReset(destination, out bytesWritten); // The Hash and HashSize properties are not overridden since the correct values are returned from base. - protected sealed override void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (disposing) { diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs index 2ba7a40bc5..220aaf4867 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/SHA512CryptoServiceProvider.cs @@ -27,19 +27,21 @@ namespace System.Security.Cryptography // reality that our native crypto providers (e.g. CNG) expose hash finalization and object reinitialization as an atomic operation. } - protected override void HashCore(byte[] array, int ibStart, int cbSize) - { + protected override void HashCore(byte[] array, int ibStart, int cbSize) => _incrementalHash.AppendData(array, ibStart, cbSize); - } - protected override byte[] HashFinal() - { - return _incrementalHash.GetHashAndReset(); - } + protected override void HashCore(ReadOnlySpan source) => + _incrementalHash.AppendData(source); + + protected override byte[] HashFinal() => + _incrementalHash.GetHashAndReset(); + + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + _incrementalHash.TryGetHashAndReset(destination, out bytesWritten); // The Hash and HashSize properties are not overridden since the correct values are returned from base. - protected sealed override void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (disposing) { diff --git a/external/corefx/src/System.Security.Cryptography.Csp/tests/RNGCryptoServiceProviderTests.cs b/external/corefx/src/System.Security.Cryptography.Csp/tests/RNGCryptoServiceProviderTests.cs index d2a685af1f..acf6a75d5a 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/tests/RNGCryptoServiceProviderTests.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/tests/RNGCryptoServiceProviderTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Linq; using Xunit; @@ -11,10 +10,10 @@ namespace System.Security.Cryptography.RNG.Tests /// /// Since RNGCryptoServiceProviderTests wraps RandomNumberGenerator from Algorithms assembly, we only test minimally here. /// - public class RNGCryptoServiceProviderTests + public partial class RNGCryptoServiceProviderTests { [Fact] - public static void DifferentSequential_10() + public static void DifferentSequential_10_Array() { // Ensure that the RNG doesn't produce a stable set of data. byte[] first = new byte[10]; @@ -37,7 +36,30 @@ namespace System.Security.Cryptography.RNG.Tests } [Fact] - public static void GetNonZeroBytes() + public static void DifferentSequential_10_Span() + { + // Ensure that the RNG doesn't produce a stable set of data. + byte[] first = new byte[10]; + byte[] second = new byte[10]; + + using (var rng = new RNGCryptoServiceProvider()) + { + rng.GetBytes((Span)first); + rng.GetBytes((Span)second); + } + + // Random being random, there is a chance that it could produce the same sequence. + // The smallest test case that we have is 10 bytes. + // The probability that they are the same, given a Truly Random Number Generator is: + // Pmatch(byte0) * Pmatch(byte1) * Pmatch(byte2) * ... * Pmatch(byte9) + // = 1/256 * 1/256 * ... * 1/256 + // = 1/(256^10) + // = 1/1,208,925,819,614,629,174,706,176 + Assert.NotEqual(first, second); + } + + [Fact] + public static void GetNonZeroBytes_Array() { using (var rng = new RNGCryptoServiceProvider()) { @@ -50,10 +72,24 @@ namespace System.Security.Cryptography.RNG.Tests } } + [Fact] + public static void GetNonZeroBytes_Span() + { + using (var rng = new RNGCryptoServiceProvider()) + { + AssertExtensions.Throws("data", () => rng.GetNonZeroBytes(null)); + + // Array should not have any zeros + byte[] rand = new byte[65536]; + rng.GetNonZeroBytes((Span)rand); + Assert.Equal(-1, Array.IndexOf(rand, 0)); + } + } + [Fact] public static void GetBytes_Offset() { - using (RandomNumberGenerator rng = RandomNumberGenerator.Create()) + using (var rng = new RNGCryptoServiceProvider()) { byte[] rand = new byte[400]; diff --git a/external/corefx/src/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs b/external/corefx/src/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs index c04d94114c..f19a756c62 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs @@ -2,29 +2,21 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Runtime.InteropServices; + namespace System.Security.Cryptography.Rsa.Tests { public class RSACryptoServiceProviderProvider : IRSAProvider { - public RSA Create() - { - return new RSACryptoServiceProvider(); - } + public RSA Create() => new RSACryptoServiceProvider(); - public RSA Create(int keySize) - { - return new RSACryptoServiceProvider(keySize); - } - - public bool Supports384PrivateKey - { - get { return true; } - } + public RSA Create(int keySize) => new RSACryptoServiceProvider(keySize); - public bool SupportsSha2Oaep - { - get { return false; } - } + public bool Supports384PrivateKey => true; + + public bool SupportsSha2Oaep => false; + + public bool SupportsDecryptingIntoExactSpaceRequired => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); } public partial class RSAFactory diff --git a/external/corefx/src/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj index ba2852e35a..e631cf012b 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj @@ -20,9 +20,6 @@ - - Common\System\PlatformDetection.cs - CommonTest\System\Security\Cryptography\ByteUtils.cs @@ -106,6 +103,9 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\RC2\RC2Tests.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.netcoreapp.cs + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAKeyExchangeFormatter.cs @@ -115,6 +115,9 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAXml.cs + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\SignVerify.netcoreapp.cs + - \ No newline at end of file + diff --git a/external/corefx/src/System.Security.Cryptography.Encoding/tests/OidCollectionTests.cs b/external/corefx/src/System.Security.Cryptography.Encoding/tests/OidCollectionTests.cs index 81a3562294..08dbff1cdb 100644 --- a/external/corefx/src/System.Security.Cryptography.Encoding/tests/OidCollectionTests.cs +++ b/external/corefx/src/System.Security.Cryptography.Encoding/tests/OidCollectionTests.cs @@ -128,7 +128,7 @@ namespace System.Security.Cryptography.Encoding.Tests additionalValidation?.Invoke(c); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] public void CopyTo_NonZeroLowerBound_ThrowsIndexOutOfRangeException() { Oid item = new Oid(Sha1Oid, Sha1Name); diff --git a/external/corefx/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj index 7e1306e3af..8026270d7c 100644 --- a/external/corefx/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj @@ -23,9 +23,6 @@ Common\System\Security\Cryptography\DerSequenceReader.cs - - Common\System\PlatformDetection.cs - CommonTest\System\Security\Cryptography\ByteUtils.cs diff --git a/external/corefx/src/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj b/external/corefx/src/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj index 91c045506f..d63c390a11 100644 --- a/external/corefx/src/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj +++ b/external/corefx/src/System.Security.Cryptography.OpenSsl/pkg/System.Security.Cryptography.OpenSsl.pkgproj @@ -3,10 +3,11 @@ - net461;netcoreapp2.0;$(AllXamarinFrameworks) + net461;netcoreapp2.1;$(AllXamarinFrameworks) + diff --git a/external/corefx/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj b/external/corefx/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj index fcd0bd6a39..dc98a3b03c 100644 --- a/external/corefx/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj +++ b/external/corefx/src/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj @@ -116,6 +116,7 @@ + diff --git a/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs b/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs index 846e5b175a..e467120954 100644 --- a/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs +++ b/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs @@ -6,25 +6,15 @@ namespace System.Security.Cryptography.Rsa.Tests { public class RSAOpenSslProvider : IRSAProvider { - public RSA Create() - { - return new RSAOpenSsl(); - } + public RSA Create() => new RSAOpenSsl(); - public RSA Create(int keySize) - { - return new RSAOpenSsl(keySize); - } + public RSA Create(int keySize) => new RSAOpenSsl(keySize); - public bool Supports384PrivateKey - { - get { return true; } - } + public bool Supports384PrivateKey => true; - public bool SupportsSha2Oaep - { - get { return false; } - } + public bool SupportsSha2Oaep => false; + + public bool SupportsDecryptingIntoExactSpaceRequired => false; } public partial class RSAFactory diff --git a/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/System.Security.Cryptography.OpenSsl.Tests.csproj b/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/System.Security.Cryptography.OpenSsl.Tests.csproj index b523908332..7d72a33b58 100644 --- a/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/System.Security.Cryptography.OpenSsl.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.OpenSsl/tests/System.Security.Cryptography.OpenSsl.Tests.csproj @@ -16,9 +16,6 @@ Common\Interop\Unix\Interop.Libraries.cs - - CommonTest\System\PlatformDetection.cs - CommonTest\System\Security\Cryptography\ByteUtils.cs @@ -108,5 +105,16 @@ CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\RSAXml.cs + + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\ECDsa\ECDsaTests.netcoreapp.cs + + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.netcoreapp.cs + + + CommonTest\System\Security\Cryptography\AlgorithmImplementations\RSA\SignVerify.netcoreapp.cs + + - \ No newline at end of file + diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj b/external/corefx/src/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj index 1c19fba71a..67f27b2e29 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/pkg/System.Security.Cryptography.Pkcs.pkgproj @@ -8,11 +8,7 @@ - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsPal.cs b/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsPal.cs index b844eaeb7e..069d1ba79a 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsPal.cs +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsPal.cs @@ -70,7 +70,7 @@ namespace Internal.Cryptography public abstract Exception CreateDecryptAfterEncryptException(); /// - /// If you call Decrupt() after a Decrypt(), the framework throws CryptographicException(CRYPT_E_INVALID_MSG_TYPE) on Windows. + /// If you call Decrypt() after a Encrypt(), the framework throws CryptographicException(CRYPT_E_INVALID_MSG_TYPE) on Windows. /// This method encapsulates what other OS's decide to throw in this situation. /// public abstract Exception CreateDecryptTwiceException(); diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj index 11e8cd7f7f..23bdacd0a8 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj @@ -16,9 +16,6 @@ CommonTest\System\Security\Cryptography\ByteUtils.cs - - CommonTest\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.cs b/external/corefx/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.cs index ac668af73c..a0df0ea2fd 100644 --- a/external/corefx/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.cs +++ b/external/corefx/src/System.Security.Cryptography.Primitives/ref/System.Security.Cryptography.Primitives.cs @@ -94,10 +94,13 @@ namespace System.Security.Cryptography public void Dispose() { } protected virtual void Dispose(bool disposing) { } protected abstract void HashCore(byte[] array, int ibStart, int cbSize); + protected virtual void HashCore(ReadOnlySpan source) { throw null; } protected abstract byte[] HashFinal(); public abstract void Initialize(); public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { throw null; } public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) { throw null; } + public bool TryComputeHash(ReadOnlySpan source, Span destination, out int bytesWritten) { throw null; } + protected virtual bool TryHashFinal(Span destination, out int bytesWritten) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct HashAlgorithmName : System.IEquatable diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/src/Resources/Strings.resx b/external/corefx/src/System.Security.Cryptography.Primitives/src/Resources/Strings.resx index c9ae59b879..c6b046c2e2 100644 --- a/external/corefx/src/System.Security.Cryptography.Primitives/src/Resources/Strings.resx +++ b/external/corefx/src/System.Security.Cryptography.Primitives/src/Resources/Strings.resx @@ -115,4 +115,7 @@ Accessing a hash algorithm by manipulating the HashName property is not supported on this platform. Instead, you must instantiate one of the supplied subtypes (such as HMACSHA1.) + + The algorithm's implementation is incorrect. + diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj b/external/corefx/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj index ebc9e5ef3a..68cd0ce6fc 100644 --- a/external/corefx/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj +++ b/external/corefx/src/System.Security.Cryptography.Primitives/src/System.Security.Cryptography.Primitives.csproj @@ -33,6 +33,7 @@ + diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HMAC.cs b/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HMAC.cs index 07b80647c0..7f02b70178 100644 --- a/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HMAC.cs +++ b/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HMAC.cs @@ -6,43 +6,30 @@ namespace System.Security.Cryptography { public abstract class HMAC : KeyedHashAlgorithm { + private string _hashName; private int _blockSizeValue = 64; protected int BlockSizeValue { - get - { - return _blockSizeValue; - } - - set - { - _blockSizeValue = value; - } + get => _blockSizeValue; + set => _blockSizeValue = value; } protected HMAC() { } - public static new HMAC Create() - { - return Create("System.Security.Cryptography.HMAC"); - } + public static new HMAC Create() => Create("System.Security.Cryptography.HMAC"); - public static new HMAC Create(string algorithmName) - { - throw new PlatformNotSupportedException(); - } + public static new HMAC Create(string algorithmName) => throw new PlatformNotSupportedException(); - public String HashName + public string HashName { - get - { - return _hashName; - } + get => _hashName; set { if (value == null) + { throw new ArgumentNullException(nameof(HashName)); + } // On the desktop, setting the HashName selects (or switches over to) a new hashing algorithm via CryptoConfig. // Our intended refactoring turns HMAC back into an abstract class with no algorithm-specific implementation. @@ -52,7 +39,9 @@ namespace System.Security.Cryptography // Since the set is public, ensure that hmac.HashName = hmac.HashName works without throwing. if (_hashName != null && value != _hashName) + { throw new PlatformNotSupportedException(SR.HashNameMultipleSetNotSupported); + } _hashName = value; } @@ -60,38 +49,26 @@ namespace System.Security.Cryptography public override byte[] Key { - get - { - return base.Key; - } - - set - { - base.Key = value; - } + get => base.Key; + set => base.Key = value; } - protected override void Dispose(bool disposing) - { + protected override void Dispose(bool disposing) => base.Dispose(disposing); - } - protected override void HashCore(byte[] rgb, int ib, int cb) - { + protected override void HashCore(byte[] rgb, int ib, int cb) => throw new PlatformNotSupportedException(SR.CryptoConfigNotSupported); - } - protected override byte[] HashFinal() - { + protected override void HashCore(ReadOnlySpan source) => throw new PlatformNotSupportedException(SR.CryptoConfigNotSupported); - } - public override void Initialize() - { + protected override byte[] HashFinal() => throw new PlatformNotSupportedException(SR.CryptoConfigNotSupported); - } - private String _hashName; + protected override bool TryHashFinal(Span destination, out int bytesWritten) => + throw new PlatformNotSupportedException(SR.CryptoConfigNotSupported); + + public override void Initialize() => + throw new PlatformNotSupportedException(SR.CryptoConfigNotSupported); } } - diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HashAlgorithm.cs b/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HashAlgorithm.cs index 50a79aaa3a..8c8daa18c6 100644 --- a/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HashAlgorithm.cs +++ b/external/corefx/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/HashAlgorithm.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Buffers; using System.IO; namespace System.Security.Cryptography @@ -15,15 +16,9 @@ namespace System.Security.Cryptography protected HashAlgorithm() { } - public static HashAlgorithm Create() - { - return Create("System.Security.Cryptography.HashAlgorithm"); - } + public static HashAlgorithm Create() => Create("System.Security.Cryptography.HashAlgorithm"); - public static HashAlgorithm Create(string hashName) - { - throw new PlatformNotSupportedException(); - } + public static HashAlgorithm Create(string hashName) => throw new PlatformNotSupportedException(); public virtual int HashSize => HashSizeValue; @@ -36,7 +31,7 @@ namespace System.Security.Cryptography if (State != 0) throw new CryptographicUnexpectedOperationException(SR.Cryptography_HashNotYetFinalized); - return (byte[])HashValue.Clone(); + return (byte[])HashValue?.Clone(); } } @@ -51,6 +46,32 @@ namespace System.Security.Cryptography return CaptureHashCodeAndReinitialize(); } + public bool TryComputeHash(ReadOnlySpan source, Span destination, out int bytesWritten) + { + if (_disposed) + { + throw new ObjectDisposedException(null); + } + + if (destination.Length < HashSizeValue/8) + { + bytesWritten = 0; + return false; + } + + HashCore(source); + if (!TryHashFinal(destination, out bytesWritten)) + { + // The only reason for failure should be that the destination isn't long enough, + // but we checked the size earlier. + throw new InvalidOperationException(SR.InvalidOperation_IncorrectImplementation); + } + HashValue = null; + + Initialize(); + return true; + } + public byte[] ComputeHash(byte[] buffer, int offset, int count) { if (buffer == null) @@ -121,25 +142,10 @@ namespace System.Security.Cryptography // ICryptoTransform methods // We assume any HashAlgorithm can take input a byte at a time - public virtual int InputBlockSize - { - get { return (1); } - } - - public virtual int OutputBlockSize - { - get { return (1); } - } - - public virtual bool CanTransformMultipleBlocks - { - get { return true; } - } - - public virtual bool CanReuseTransform - { - get { return true; } - } + public virtual int InputBlockSize => 1; + public virtual int OutputBlockSize => 1; + public virtual bool CanTransformMultipleBlocks => true; + public virtual bool CanReuseTransform => true; public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { @@ -198,5 +204,41 @@ namespace System.Security.Cryptography protected abstract void HashCore(byte[] array, int ibStart, int cbSize); protected abstract byte[] HashFinal(); public abstract void Initialize(); + + protected virtual void HashCore(ReadOnlySpan source) + { + byte[] array = ArrayPool.Shared.Rent(source.Length); + try + { + source.CopyTo(array); + HashCore(array, 0, source.Length); + } + finally + { + Array.Clear(array, 0, source.Length); + ArrayPool.Shared.Return(array); + } + } + + protected virtual bool TryHashFinal(Span destination, out int bytesWritten) + { + int hashSizeInBytes = HashSizeValue / 8; + + if (destination.Length >= hashSizeInBytes) + { + byte[] final = HashFinal(); + if (final.Length == hashSizeInBytes) + { + new ReadOnlySpan(final).CopyTo(destination); + bytesWritten = final.Length; + return true; + } + + throw new InvalidOperationException(SR.InvalidOperation_IncorrectImplementation); + } + + bytesWritten = 0; + return false; + } } } diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/tests/HashAlgorithmTest.netcoreapp.cs b/external/corefx/src/System.Security.Cryptography.Primitives/tests/HashAlgorithmTest.netcoreapp.cs new file mode 100644 index 0000000000..d12eab2f8d --- /dev/null +++ b/external/corefx/src/System.Security.Cryptography.Primitives/tests/HashAlgorithmTest.netcoreapp.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Linq; +using Xunit; + +namespace System.Security.Cryptography.Hashing.Tests +{ + public partial class HashAlgorithmTest + { + [Fact] + public void SpanMethodsUsed_NotOverridden_ArrayMethodsInvoked() + { + byte[] input = Enumerable.Range(0, 1024).Select(i => (byte)i).ToArray(); + byte[] output; + int bytesWritten; + + var testAlgorithm = new SummingTestHashAlgorithm(); + + output = new byte[sizeof(long) - 1]; + Assert.False(testAlgorithm.TryComputeHash(input, output, out bytesWritten)); + Assert.Equal(0, bytesWritten); + Assert.Equal(new byte[sizeof(long) - 1], output); + + output = new byte[sizeof(long)]; + Assert.True(testAlgorithm.TryComputeHash(input, output, out bytesWritten)); + Assert.Equal(sizeof(long), bytesWritten); + Assert.Equal(input.Sum(b => (long)b), BitConverter.ToInt64(output, 0)); + } + + private sealed class SummingTestHashAlgorithm : HashAlgorithm + { + private long _sum; + + public SummingTestHashAlgorithm() => HashSizeValue = sizeof(long)*8; + + public override void Initialize() => _sum = 0; + + protected override void HashCore(byte[] array, int ibStart, int cbSize) + { + for (int i = ibStart; i < ibStart + cbSize; i++) _sum += array[i]; + } + + protected override byte[] HashFinal() => BitConverter.GetBytes(_sum); + + // Do not override HashCore(ReadOnlySpan) and TryHashFinal. Consuming + // test verifies that calling the base implementations invokes the array + // implementations by verifying the right value is produced. + } + } +} diff --git a/external/corefx/src/System.Security.Cryptography.Primitives/tests/System.Security.Cryptography.Primitives.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Primitives/tests/System.Security.Cryptography.Primitives.Tests.csproj index 8cb9485960..2159215055 100644 --- a/external/corefx/src/System.Security.Cryptography.Primitives/tests/System.Security.Cryptography.Primitives.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Primitives/tests/System.Security.Cryptography.Primitives.Tests.csproj @@ -24,12 +24,10 @@ CommonTest\System\IO\PositionValueStream.cs - - CommonTest\System\PlatformDetection.cs - + \ No newline at end of file diff --git a/external/corefx/src/System.Security.Cryptography.ProtectedData/pkg/System.Security.Cryptography.ProtectedData.pkgproj b/external/corefx/src/System.Security.Cryptography.ProtectedData/pkg/System.Security.Cryptography.ProtectedData.pkgproj index b88b685c53..51e87f46ab 100644 --- a/external/corefx/src/System.Security.Cryptography.ProtectedData/pkg/System.Security.Cryptography.ProtectedData.pkgproj +++ b/external/corefx/src/System.Security.Cryptography.ProtectedData/pkg/System.Security.Cryptography.ProtectedData.pkgproj @@ -7,11 +7,7 @@ - - - - lib/netstandard1.3 - + diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs index 02c2247668..2cf00f883a 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs @@ -418,6 +418,8 @@ namespace Internal.Cryptography.Pal extraStore, userIntermediateCerts, systemIntermediateCerts, + userRootCerts, + systemRootCerts, }; while (toProcess.Count > 0) diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs index 2e7c30b102..6fd85ccfbc 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/CertificateRequest.cs @@ -204,7 +204,7 @@ namespace System.Security.Cryptography.X509Certificates } /// - /// Create an ASN.1 DER-encoded PKCS#10 CertificationRequest object representating the current state + /// Create an ASN.1 DER-encoded PKCS#10 CertificationRequest object representing the current state /// of this object. /// /// A DER-encoded certificate signing request. @@ -250,7 +250,7 @@ namespace System.Security.Cryptography.X509Certificates } /// - /// Create an ASN.1 DER-encoded PKCS#10 CertificationRequest representating the current state + /// Create an ASN.1 DER-encoded PKCS#10 CertificationRequest representing the current state /// of this object using the provided signature generator. /// /// diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/ECDsaX509SignatureGenerator.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/ECDsaX509SignatureGenerator.cs index 8eb22b365d..c4d07916ad 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/ECDsaX509SignatureGenerator.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/ECDsaX509SignatureGenerator.cs @@ -53,8 +53,8 @@ namespace System.Security.Cryptography.X509Certificates int segmentLength = ieeeFormat.Length / 2; return DerEncoder.ConstructSequence( - DerEncoder.SegmentedEncodeUnsignedInteger(ieeeFormat, 0, segmentLength), - DerEncoder.SegmentedEncodeUnsignedInteger(ieeeFormat, segmentLength, segmentLength)); + DerEncoder.SegmentedEncodeUnsignedInteger(new ReadOnlySpan(ieeeFormat, 0, segmentLength)), + DerEncoder.SegmentedEncodeUnsignedInteger(new ReadOnlySpan(ieeeFormat, segmentLength, segmentLength))); } protected override PublicKey BuildPublicKey() diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs index 6e007f1ca4..46ae557017 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs @@ -116,7 +116,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests // High Sierra fails to build a chain for a self-signed certificate with revocation enabled. // https://github.com/dotnet/corefx/issues/21875 - if (!PlatformDetection.IsMacOsHighSierra) + if (!PlatformDetection.IsMacOsHighSierraOrHigher) { using (var microsoftDotComRoot = new X509Certificate2(TestData.MicrosoftDotComRootBytes)) { diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs index 3d1d44ec5a..95492b5ba3 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading; using Xunit; @@ -14,7 +15,6 @@ namespace System.Security.Cryptography.X509Certificates.Tests public static class ChainTests { internal static bool CanModifyStores { get; } = TestEnvironmentConfiguration.CanModifyStores; - internal static bool CanBuildSelfSignedChainReliably { get; } = !PlatformDetection.IsMacOsHighSierra; private static bool TrustsMicrosoftDotComRoot { @@ -165,7 +165,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests Assert.Equal(IntPtr.Zero, chain.ChainContext); } - [ConditionalFact(nameof(CanBuildSelfSignedChainReliably))] + [Fact] public static void TestResetMethod() { using (var sampleCert = new X509Certificate2(TestData.DssCer)) @@ -630,5 +630,48 @@ namespace System.Security.Cryptography.X509Certificates.Tests using (var chain = X509Chain.Create()) Assert.NotNull(chain); } + + [Fact] + public static void InvalidSelfSignedSignature() + { + X509ChainStatusFlags expectedFlags; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + expectedFlags = X509ChainStatusFlags.NotSignatureValid; + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + expectedFlags = X509ChainStatusFlags.UntrustedRoot; + } + else + { + expectedFlags = + X509ChainStatusFlags.NotSignatureValid | + X509ChainStatusFlags.UntrustedRoot; + } + + byte[] certBytes = (byte[])TestData.MicrosoftDotComRootBytes.Clone(); + // The signature goes up to the very last byte, so flip some bits in it. + certBytes[certBytes.Length - 1] ^= 0xFF; + + using (var cert = new X509Certificate2(certBytes)) + using (ChainHolder holder = new ChainHolder()) + { + X509Chain chain = holder.Chain; + X509ChainPolicy policy = chain.ChainPolicy; + policy.VerificationTime = cert.NotBefore.AddDays(3); + policy.RevocationMode = X509RevocationMode.NoCheck; + + chain.Build(cert); + + X509ChainStatusFlags allFlags = + chain.ChainStatus.Select(cs => cs.Status).Aggregate( + X509ChainStatusFlags.NoError, + (a, b) => a | b); + + Assert.Equal(expectedFlags, allFlags); + } + } } } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj index 8cc4d7f105..e550ad4504 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj @@ -5,7 +5,6 @@ {A28B0064-EFB2-4B77-B97C-DECF5DAB074E} true $(DefineConstants);netcoreapp - chk @@ -55,9 +54,6 @@ CommonTest\System\Security\Cryptography\ByteUtils.cs - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.cs b/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.cs index 19967e36c9..d97dcfc823 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.cs +++ b/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.cs @@ -116,6 +116,8 @@ namespace System.Security.Cryptography.Xml public const string XmlEncTripleDESUrl = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"; public EncryptedXml() { } public EncryptedXml(System.Xml.XmlDocument document) { } + public EncryptedXml(System.Xml.XmlDocument document, System.Security.Policy.Evidence evidence) { } + public System.Security.Policy.Evidence DocumentEvidence { get { throw null; } set { } } public System.Text.Encoding Encoding { get { throw null; } set { } } public System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } } public System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } } diff --git a/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj b/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj index 8193ab2888..47069c0130 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj +++ b/external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj @@ -9,7 +9,10 @@ - + + + + @@ -20,4 +23,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj b/external/corefx/src/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj index e951a362e2..c16b4e66a3 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj +++ b/external/corefx/src/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj @@ -107,6 +107,7 @@ + @@ -117,4 +118,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/EncryptedXml.cs b/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/EncryptedXml.cs index 58eb64c6a7..19202e33b2 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/EncryptedXml.cs +++ b/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/EncryptedXml.cs @@ -2,13 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections; using System.IO; using System.Net; -using System.Security; -using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; +using System.Security.Policy; using System.Text; using System.Xml; @@ -63,6 +61,7 @@ namespace System.Security.Cryptography.Xml // private XmlDocument _document; + private Evidence _evidence; private XmlResolver _xmlResolver; // hash table defining the key name mapping private const int _capacity = 4; // 4 is a reasonable capacity for @@ -80,9 +79,12 @@ namespace System.Security.Cryptography.Xml // public EncryptedXml() : this(new XmlDocument()) { } - public EncryptedXml(XmlDocument document) + public EncryptedXml(XmlDocument document) : this(document, null) { } + + public EncryptedXml(XmlDocument document, Evidence evidence) { _document = document; + _evidence = evidence; _xmlResolver = null; // set the default padding to ISO-10126 _padding = PaddingMode.ISO10126; @@ -95,7 +97,7 @@ namespace System.Security.Cryptography.Xml } /// - /// This mentod validates the _xmlDsigSearchDepthCounter counter + /// This method validates the _xmlDsigSearchDepthCounter counter /// if the counter is over the limit defined by admin or developer. /// /// returns true if the limit has reached otherwise false @@ -123,6 +125,13 @@ namespace System.Security.Cryptography.Xml } } + // The evidence of the document being loaded: will be used to resolve external URIs + public Evidence DocumentEvidence + { + get { return _evidence; } + set { _evidence = value; } + } + // The resolver to use for external entities public XmlResolver Resolver { @@ -207,7 +216,7 @@ namespace System.Security.Cryptography.Xml } else { - throw new CryptographicException(SR.Cryptography_Xml_UriNotResolved, cipherData.CipherReference.Uri); + throw new CryptographicException(SR.Cryptography_Xml_UriNotResolved, cipherData.CipherReference.Uri); } // read the output stream into a memory stream byte[] cipherValue = null; diff --git a/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs b/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs index e04c6566b9..299b8804de 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs +++ b/external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs @@ -70,7 +70,7 @@ namespace System.Security.Cryptography.Xml BeginCanonicalization, /// - /// Verificaiton of the signature format itself is beginning + /// Verification of the signature format itself is beginning /// BeginCheckSignatureFormat, @@ -544,10 +544,10 @@ namespace System.Security.Cryptography.Xml } /// - /// Log namespaces which are being propigated into the singature + /// Log namespaces which are being propagated into the signature /// /// SignedXml doing the signing or verification - /// namespaces being propigated + /// namespaces being propagated internal static void LogNamespacePropagation(SignedXml signedXml, XmlNodeList namespaces) { Debug.Assert(signedXml != null, "signedXml != null"); @@ -903,7 +903,7 @@ namespace System.Security.Cryptography.Xml /// keyed hash algorithm /// /// SignedXml object doing the verification - /// hash algoirthm doing the verification + /// hash algorithm doing the verification /// hash value of the signed info /// raw signature value internal static void LogVerifySignedInfo(SignedXml signedXml, @@ -1030,7 +1030,7 @@ namespace System.Security.Cryptography.Xml } /// - /// Write informaiton when user hits the Signed XML recursion depth limit issue. + /// Write information when user hits the Signed XML recursion depth limit issue. /// This is helpful in debugging this kind of issues. /// /// SignedXml object verifying the signature diff --git a/external/corefx/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs b/external/corefx/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs index 74a1aca6f5..7e9f2ffeca 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs +++ b/external/corefx/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs @@ -10,11 +10,9 @@ // See the LICENSE file in the project root for more information. -using System; using System.Collections; using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Xml; @@ -47,28 +45,47 @@ namespace System.Security.Cryptography.Xml.Tests } } + private static readonly Encoding DefaultEncoding = Encoding.UTF8; + private const CipherMode DefaultCipherMode = CipherMode.CBC; + private const PaddingMode DefaultPaddingMode = PaddingMode.ISO10126; + private const string DefaultRecipient = ""; + private static readonly XmlResolver DefaultXmlResolver = null; + private const int DefaultXmlDSigSearchDepth = 20; + [Fact] public void Constructor_Default() { EncryptedXml encryptedXml = new EncryptedXml(); - Assert.Equal(Encoding.UTF8, encryptedXml.Encoding); - Assert.Equal(CipherMode.CBC, encryptedXml.Mode); - Assert.Equal(PaddingMode.ISO10126, encryptedXml.Padding); - Assert.Equal(string.Empty, encryptedXml.Recipient); - Assert.Equal(null, encryptedXml.Resolver); - Assert.Equal(20, encryptedXml.XmlDSigSearchDepth); + Assert.Equal(DefaultEncoding, encryptedXml.Encoding); + Assert.Equal(DefaultCipherMode, encryptedXml.Mode); + Assert.Equal(DefaultPaddingMode, encryptedXml.Padding); + Assert.Equal(DefaultRecipient, encryptedXml.Recipient); + Assert.Equal(DefaultXmlResolver, encryptedXml.Resolver); + Assert.Equal(DefaultXmlDSigSearchDepth, encryptedXml.XmlDSigSearchDepth); } [Fact] public void Constructor_XmlDocument() { EncryptedXml encryptedXml = new EncryptedXml(null); - Assert.Equal(Encoding.UTF8, encryptedXml.Encoding); - Assert.Equal(CipherMode.CBC, encryptedXml.Mode); - Assert.Equal(PaddingMode.ISO10126, encryptedXml.Padding); - Assert.Equal(string.Empty, encryptedXml.Recipient); - Assert.Equal(null, encryptedXml.Resolver); - Assert.Equal(20, encryptedXml.XmlDSigSearchDepth); + Assert.Equal(DefaultEncoding, encryptedXml.Encoding); + Assert.Equal(DefaultCipherMode, encryptedXml.Mode); + Assert.Equal(DefaultPaddingMode, encryptedXml.Padding); + Assert.Equal(DefaultRecipient, encryptedXml.Recipient); + Assert.Equal(DefaultXmlResolver, encryptedXml.Resolver); + Assert.Equal(DefaultXmlDSigSearchDepth, encryptedXml.XmlDSigSearchDepth); + } + + [Fact] + public void Constructor_XmlDocumentAndEvidence() + { + EncryptedXml encryptedXml = new EncryptedXml(null, null); + Assert.Equal(DefaultEncoding, encryptedXml.Encoding); + Assert.Equal(DefaultCipherMode, encryptedXml.Mode); + Assert.Equal(DefaultPaddingMode, encryptedXml.Padding); + Assert.Equal(DefaultRecipient, encryptedXml.Recipient); + Assert.Equal(DefaultXmlResolver, encryptedXml.Resolver); + Assert.Equal(DefaultXmlDSigSearchDepth, encryptedXml.XmlDSigSearchDepth); } [Theory] diff --git a/external/corefx/src/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj b/external/corefx/src/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj index 0ac3d109cb..3cb9cf6d35 100644 --- a/external/corefx/src/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj +++ b/external/corefx/src/System.Security.Cryptography.Xml/tests/System.Security.Cryptography.Xml.Tests.csproj @@ -54,9 +54,6 @@ - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Security.Permissions/tests/SerializationTests.cs b/external/corefx/src/System.Security.Permissions/tests/SerializationTests.cs deleted file mode 100644 index 0f2448c38c..0000000000 --- a/external/corefx/src/System.Security.Permissions/tests/SerializationTests.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters.Tests; -using Xunit; - -namespace System.Security.Permissions.Tests -{ - public class SerializationTests - { - public static IEnumerable GetAllSerializableObjectsInAssembly() - { - IEnumerable serializableTypes = typeof(CodeAccessPermission).Assembly - .GetTypes() - .Where(t => - { - bool nonAbstractSerializable = !t.IsAbstract && (t.Attributes & TypeAttributes.Serializable) != 0; - ConstructorInfo ctorInfo = t.GetConstructor(BindingFlags.NonPublic | - BindingFlags.Instance, null, Type.EmptyTypes, null); - - return (ctorInfo != null) ? nonAbstractSerializable && !ctorInfo.IsAssembly && !ctorInfo.IsFamily : nonAbstractSerializable; - }); - - foreach (Type serializableType in serializableTypes) - { - // Create an instance of the object, with its default ctor if possible, or worst case uninitialized (we don't - // care about functionality for these types, so an uninitialized object suits our needs). - object obj; - try - { - obj = Activator.CreateInstance(serializableType); - } - catch - { - obj = FormatterServices.GetUninitializedObject(serializableType); - } - yield return new[] { serializableType, obj }; - } - } - - [Theory] - [MemberData(nameof(GetAllSerializableObjectsInAssembly))] - public static void SerializeDeserialize_Succeeds(Type t, object obj) - { - // None of these objects are truly functional, so we don't need to verify equality - // or the like. We simply want to make sure that we're able to serialize and - // deserialize without exceptions being thrown. - Assert.IsType(t, BinaryFormatterHelpers.Clone(obj)); - } - } -} diff --git a/external/corefx/src/System.Security.Permissions/tests/System.Security.Permissions.Tests.csproj b/external/corefx/src/System.Security.Permissions/tests/System.Security.Permissions.Tests.csproj index 2288f2250f..1e875bc523 100644 --- a/external/corefx/src/System.Security.Permissions/tests/System.Security.Permissions.Tests.csproj +++ b/external/corefx/src/System.Security.Permissions/tests/System.Security.Permissions.Tests.csproj @@ -18,7 +18,6 @@ - @@ -27,12 +26,6 @@ - - CommonTest\System\PlatformDetection.cs - - - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs - diff --git a/external/corefx/src/System.Security.Principal.Windows/System.Security.Principal.Windows.sln b/external/corefx/src/System.Security.Principal.Windows/System.Security.Principal.Windows.sln index c1d97cbedb..a22152fb88 100644 --- a/external/corefx/src/System.Security.Principal.Windows/System.Security.Principal.Windows.sln +++ b/external/corefx/src/System.Security.Principal.Windows/System.Security.Principal.Windows.sln @@ -30,10 +30,10 @@ Global {6C36F3AC-54A1-4021-9F5D-CDEFF7347277}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU {6C36F3AC-54A1-4021-9F5D-CDEFF7347277}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU {6C36F3AC-54A1-4021-9F5D-CDEFF7347277}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU - {F9E9894E-2513-4085-9046-311AD49D8AE6}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU - {F9E9894E-2513-4085-9046-311AD49D8AE6}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU - {F9E9894E-2513-4085-9046-311AD49D8AE6}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU - {F9E9894E-2513-4085-9046-311AD49D8AE6}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {F9E9894E-2513-4085-9046-311AD49D8AE6}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {F9E9894E-2513-4085-9046-311AD49D8AE6}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {F9E9894E-2513-4085-9046-311AD49D8AE6}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {F9E9894E-2513-4085-9046-311AD49D8AE6}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {25A02E40-D12C-4184-B599-E4F954D142DB}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {25A02E40-D12C-4184-B599-E4F954D142DB}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {25A02E40-D12C-4184-B599-E4F954D142DB}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU diff --git a/external/corefx/src/System.Security.Principal.Windows/dir.props b/external/corefx/src/System.Security.Principal.Windows/dir.props index 4ca26ef8a3..4bb96edee4 100644 --- a/external/corefx/src/System.Security.Principal.Windows/dir.props +++ b/external/corefx/src/System.Security.Principal.Windows/dir.props @@ -7,6 +7,5 @@ true false true - false \ No newline at end of file diff --git a/external/corefx/src/System.Security.Principal.Windows/pkg/System.Security.Principal.Windows.pkgproj b/external/corefx/src/System.Security.Principal.Windows/pkg/System.Security.Principal.Windows.pkgproj index 7fee70517a..7d1af3b562 100644 --- a/external/corefx/src/System.Security.Principal.Windows/pkg/System.Security.Principal.Windows.pkgproj +++ b/external/corefx/src/System.Security.Principal.Windows/pkg/System.Security.Principal.Windows.pkgproj @@ -6,12 +6,12 @@ net461;netcoreapp2.0;$(UAPvNextTFM);$(AllXamarinFrameworks) + + runtimes/win/lib/$(UAPvNextTFM) + + - - - - lib/netstandard1.3 - + diff --git a/external/corefx/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj b/external/corefx/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj index 9b4a3ef544..f4eb172e09 100644 --- a/external/corefx/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj +++ b/external/corefx/src/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.csproj @@ -3,9 +3,10 @@ {25A02E40-D12C-4184-B599-E4F954D142DB} - - netstandard2.0;$(UAPvNextTFM) true + + 4.1.1.0 diff --git a/external/corefx/src/System.Security.Principal.Windows/src/Configurations.props b/external/corefx/src/System.Security.Principal.Windows/src/Configurations.props index be3142ff24..b16dc428ed 100644 --- a/external/corefx/src/System.Security.Principal.Windows/src/Configurations.props +++ b/external/corefx/src/System.Security.Principal.Windows/src/Configurations.props @@ -1,12 +1,15 @@  - - uap-Windows_NT; - netcoreapp-Windows_NT; - netcoreapp-Unix; + + netcoreapp2.0-Windows_NT; + netcoreapp2.0-Unix; netstandard; netfx-Windows_NT; + + + $(PackageConfigurations) + uap-Windows_NT; \ No newline at end of file diff --git a/external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp b/external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp2.0 similarity index 100% rename from external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp rename to external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.netcoreapp2.0 diff --git a/external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.uap b/external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.uap deleted file mode 100644 index ec8e375857..0000000000 --- a/external/corefx/src/System.Security.Principal.Windows/src/PinvokeAnalyzerExceptionList.analyzerdata.uap +++ /dev/null @@ -1 +0,0 @@ -kernel32.dll!CheckTokenMembershipEx diff --git a/external/corefx/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj b/external/corefx/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj index c52b0d4dfd..ae96f2e72f 100644 --- a/external/corefx/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj +++ b/external/corefx/src/System.Security.Principal.Windows/src/System.Security.Principal.Windows.csproj @@ -13,17 +13,17 @@ $(DefineConstants);uap - - - - + + + + - + @@ -183,7 +183,7 @@ Common\Microsoft\Win32\SafeHandles\SafeLsaHandle.cs - + Common\Interop\Interop.CheckTokenMembership.cs diff --git a/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs b/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs index 22ad4cb35f..afa5ddeca7 100644 --- a/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs +++ b/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs @@ -39,15 +39,10 @@ namespace System.Security.Principal private volatile bool _impersonationLevelInitialized; public new const string DefaultIssuer = @"AD AUTHORITY"; - [NonSerialized] private string _issuerName = DefaultIssuer; - [NonSerialized] private object _claimsIntiailizedLock = new object(); - [NonSerialized] private volatile bool _claimsInitialized; - [NonSerialized] private List _deviceClaims; - [NonSerialized] private List _userClaims; // @@ -62,7 +57,7 @@ namespace System.Security.Principal /// Initializes a new instance of the WindowsIdentity class for the user represented by the specified User Principal Name (UPN). /// /// - /// Unlike the desktop version, we connect to Lsa only as an untrusted caller. We do not attempt to explot Tcb privilege or adjust the current + /// Unlike the desktop version, we connect to Lsa only as an untrusted caller. We do not attempt to exploit Tcb privilege or adjust the current /// thread privilege to include Tcb. /// public WindowsIdentity(string sUserPrincipalName) @@ -921,8 +916,8 @@ namespace System.Security.Principal } /// - /// Intenal method to initialize the claim collection. - /// Lazy init is used so claims are not initialzed until needed + /// Internal method to initialize the claim collection. + /// Lazy init is used so claims are not initialized until needed /// private void InitializeClaims() { diff --git a/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs b/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs index 06202b5ac1..1181e4dcd7 100644 --- a/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs +++ b/external/corefx/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs @@ -6,7 +6,6 @@ using Microsoft.Win32.SafeHandles; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; -using System.Runtime.Serialization; using System.Security.Claims; namespace System.Security.Principal @@ -44,27 +43,7 @@ namespace System.Security.Principal _identity = ntIdentity; } - - [OnDeserialized] - private void OnDeserializedMethod(StreamingContext context) - { - ClaimsIdentity firstNonNullIdentity = null; - - foreach (ClaimsIdentity identity in base.Identities) - { - if (identity != null) - { - firstNonNullIdentity = identity; - break; - } - } - - if (firstNonNullIdentity == null) - { - base.AddIdentity(_identity); - } - } - + // // Properties. // diff --git a/external/corefx/src/System.Security.Principal.Windows/tests/System.Security.Principal.Windows.Tests.csproj b/external/corefx/src/System.Security.Principal.Windows/tests/System.Security.Principal.Windows.Tests.csproj index 91f6f07fcf..f0daf2c1b9 100644 --- a/external/corefx/src/System.Security.Principal.Windows/tests/System.Security.Principal.Windows.Tests.csproj +++ b/external/corefx/src/System.Security.Principal.Windows/tests/System.Security.Principal.Windows.Tests.csproj @@ -10,9 +10,6 @@ - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Security.SecureString/dir.props b/external/corefx/src/System.Security.SecureString/dir.props index e09fa64586..e063359772 100644 --- a/external/corefx/src/System.Security.SecureString/dir.props +++ b/external/corefx/src/System.Security.SecureString/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Security.SecureString/ref/Configurations.props b/external/corefx/src/System.Security.SecureString/ref/Configurations.props index 192309fce5..c701755863 100644 --- a/external/corefx/src/System.Security.SecureString/ref/Configurations.props +++ b/external/corefx/src/System.Security.SecureString/ref/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap; diff --git a/external/corefx/src/System.Security.SecureString/ref/System.Security.SecureString.csproj b/external/corefx/src/System.Security.SecureString/ref/System.Security.SecureString.csproj index dc9dd01920..a31ff03e99 100644 --- a/external/corefx/src/System.Security.SecureString/ref/System.Security.SecureString.csproj +++ b/external/corefx/src/System.Security.SecureString/ref/System.Security.SecureString.csproj @@ -8,8 +8,6 @@ - - diff --git a/external/corefx/src/System.Security.SecureString/src/Configurations.props b/external/corefx/src/System.Security.SecureString/src/Configurations.props index dec427aa16..a8910ef718 100644 --- a/external/corefx/src/System.Security.SecureString/src/Configurations.props +++ b/external/corefx/src/System.Security.SecureString/src/Configurations.props @@ -4,7 +4,6 @@ uap-Windows_NT; netcoreapp; - netfx; \ No newline at end of file diff --git a/external/corefx/src/System.Security.SecureString/src/System.Security.SecureString.csproj b/external/corefx/src/System.Security.SecureString/src/System.Security.SecureString.csproj index 9698c58770..5b0ed79c97 100644 --- a/external/corefx/src/System.Security.SecureString/src/System.Security.SecureString.csproj +++ b/external/corefx/src/System.Security.SecureString/src/System.Security.SecureString.csproj @@ -9,8 +9,6 @@ - - diff --git a/external/corefx/src/System.ServiceModel.Syndication/System.ServiceModel.Syndication.sln b/external/corefx/src/System.ServiceModel.Syndication/System.ServiceModel.Syndication.sln new file mode 100644 index 0000000000..7a9b5eb4a8 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/System.ServiceModel.Syndication.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26906.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.ServiceModel.Syndication", "src\System.ServiceModel.Syndication.csproj", "{C2AB129B-E3EC-465B-B1B7-0F7D414B1E74}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.ServiceModel.Syndication.Tests", "tests\System.ServiceModel.Syndication.Tests.csproj", "{A622B2C0-DD74-4218-9CF0-F9B2E52F4E91}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + netstandard-Debug|Any CPU = netstandard-Debug|Any CPU + netstandard-Release|Any CPU = netstandard-Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C2AB129B-E3EC-465B-B1B7-0F7D414B1E74}.netstandard-Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {C2AB129B-E3EC-465B-B1B7-0F7D414B1E74}.netstandard-Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {C2AB129B-E3EC-465B-B1B7-0F7D414B1E74}.netstandard-Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {C2AB129B-E3EC-465B-B1B7-0F7D414B1E74}.netstandard-Release|Any CPU.Build.0 = netstandard-Release|Any CPU + {A622B2C0-DD74-4218-9CF0-F9B2E52F4E91}.netstandard-Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {A622B2C0-DD74-4218-9CF0-F9B2E52F4E91}.netstandard-Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {A622B2C0-DD74-4218-9CF0-F9B2E52F4E91}.netstandard-Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {A622B2C0-DD74-4218-9CF0-F9B2E52F4E91}.netstandard-Release|Any CPU.Build.0 = netstandard-Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C509160C-D427-4B6F-A515-169B6BB2B210} + EndGlobalSection +EndGlobal diff --git a/external/corefx/src/System.ServiceModel.Syndication/dir.props b/external/corefx/src/System.ServiceModel.Syndication/dir.props new file mode 100644 index 0000000000..4356decc45 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/dir.props @@ -0,0 +1,8 @@ + + + + + 4.0.0.0 + Open + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/pkg/System.ServiceModel.Syndication.pkgproj b/external/corefx/src/System.ServiceModel.Syndication/pkg/System.ServiceModel.Syndication.pkgproj new file mode 100644 index 0000000000..65f155b7f9 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/pkg/System.ServiceModel.Syndication.pkgproj @@ -0,0 +1,11 @@ + + + + + + net461;netcoreapp2.0;$(AllXamarinFrameworks) + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/ref/Configurations.props b/external/corefx/src/System.ServiceModel.Syndication/ref/Configurations.props new file mode 100644 index 0000000000..934f7517ba --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/ref/Configurations.props @@ -0,0 +1,9 @@ + + + + + netfx; + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.cs b/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.cs new file mode 100644 index 0000000000..0ab8cc4152 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.cs @@ -0,0 +1,670 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the http://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +namespace System.ServiceModel.Syndication +{ + public static partial class Atom10Constants + { + public const string AlternateTag = "alternate"; + public const string Atom10Namespace = "http://www.w3.org/2005/Atom"; + public const string Atom10Prefix = "a10"; + public const string AtomMediaType = "application/atom+xml"; + public const string AuthorTag = "author"; + public const string CategoryTag = "category"; + public const string ContentTag = "content"; + public const string ContributorTag = "contributor"; + public const string EmailTag = "email"; + public const string EntryTag = "entry"; + public const string FeedTag = "feed"; + public const string GeneratorTag = "generator"; + public const string HrefTag = "href"; + public const string HtmlMediaType = "text/html"; + public const string HtmlType = "html"; + public const string IconTag = "icon"; + public const string IdTag = "id"; + public const string LabelTag = "label"; + public const string LengthTag = "length"; + public const string LinkTag = "link"; + public const string LogoTag = "logo"; + public const string NameTag = "name"; + public const string PlaintextType = "text"; + public const string PublishedTag = "published"; + public const string RelativeTag = "rel"; + public const string RightsTag = "rights"; + public const string SchemeTag = "scheme"; + public const string SelfTag = "self"; + public const string SourceFeedTag = "source"; + public const string SourceTag = "src"; + public const string SpecificationLink = "http://atompub.org/2005/08/17/draft-ietf-atompub-format-11.html"; + public const string SubtitleTag = "subtitle"; + public const string SummaryTag = "summary"; + public const string TermTag = "term"; + public const string TitleTag = "title"; + public const string TypeTag = "type"; + public const string UpdatedTag = "updated"; + public const string UriTag = "uri"; + public const string XHtmlMediaType = "application/xhtml+xml"; + public const string XHtmlType = "xhtml"; + public const string XmlMediaType = "text/xml"; + } + public partial class Atom10FeedFormatter : System.ServiceModel.Syndication.SyndicationFeedFormatter + { + public System.Func dateParser; + public System.Func stringParser; + public System.Func uriParser; + public Atom10FeedFormatter() { } + public Atom10FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite) { } + public Atom10FeedFormatter(System.Type feedTypeToCreate) { } + protected System.Type FeedType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + public override System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader, System.Threading.CancellationToken ct) { throw null; } + protected virtual System.Threading.Tasks.Task ReadItemAsync(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected virtual System.Threading.Tasks.Task> ReadItemsAsync(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected virtual System.Threading.Tasks.Task WriteItemAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, System.Uri feedBaseUri) { throw null; } + protected virtual System.Threading.Tasks.Task WriteItemsAsync(System.Xml.XmlWriter writer, System.Collections.Generic.IEnumerable items, System.Uri feedBaseUri) { throw null; } + public override System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer, System.Threading.CancellationToken ct) { throw null; } + } + public partial class Atom10FeedFormatter : System.ServiceModel.Syndication.Atom10FeedFormatter where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() + { + public Atom10FeedFormatter() { } + public Atom10FeedFormatter(TSyndicationFeed feedToWrite) { } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + } + public partial class Atom10ItemFormatter : System.ServiceModel.Syndication.SyndicationItemFormatter + { + public Atom10ItemFormatter() { } + public Atom10ItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite) { } + public Atom10ItemFormatter(System.Type itemTypeToCreate) { } + protected System.Type ItemType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + public override System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader) { throw null; } + public override System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer) { throw null; } + } + public partial class Atom10ItemFormatter : System.ServiceModel.Syndication.Atom10ItemFormatter where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new() + { + public Atom10ItemFormatter() { } + public Atom10ItemFormatter(TSyndicationItem itemToWrite) { } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + } + public partial class AtomPub10CategoriesDocumentFormatter : System.ServiceModel.Syndication.CategoriesDocumentFormatter + { + public AtomPub10CategoriesDocumentFormatter() { } + public AtomPub10CategoriesDocumentFormatter(System.ServiceModel.Syndication.CategoriesDocument documentToWrite) { } + public AtomPub10CategoriesDocumentFormatter(System.Type inlineDocumentType, System.Type referencedDocumentType) { } + public override string Version { get { throw null; } } + public override System.Threading.Tasks.Task CanReadAsync(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategoriesDocument() { throw null; } + protected override System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategoriesDocument() { throw null; } + public override System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader) { throw null; } + public override System.Threading.Tasks.Task WriteTo(System.Xml.XmlWriter writer) { throw null; } + } + public partial class AtomPub10ServiceDocumentFormatter : System.ServiceModel.Syndication.ServiceDocumentFormatter + { + public AtomPub10ServiceDocumentFormatter() { } + public AtomPub10ServiceDocumentFormatter(System.ServiceModel.Syndication.ServiceDocument documentToWrite) { } + public AtomPub10ServiceDocumentFormatter(System.Type documentTypeToCreate) { } + public override string Version { get { throw null; } } + public override System.Threading.Tasks.Task CanReadAsync(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.ServiceDocument CreateDocumentInstance() { throw null; } + public override System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader) { throw null; } + public override System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer) { throw null; } + } + public partial class AtomPub10ServiceDocumentFormatter : System.ServiceModel.Syndication.AtomPub10ServiceDocumentFormatter where TServiceDocument : System.ServiceModel.Syndication.ServiceDocument, new() + { + public AtomPub10ServiceDocumentFormatter() { } + public AtomPub10ServiceDocumentFormatter(TServiceDocument documentToWrite) { } + protected override System.ServiceModel.Syndication.ServiceDocument CreateDocumentInstance() { throw null; } + } + public abstract partial class CategoriesDocument + { + internal CategoriesDocument() { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Language { get { throw null; } set { } } + public static System.ServiceModel.Syndication.InlineCategoriesDocument Create(System.Collections.ObjectModel.Collection categories) { throw null; } + public static System.ServiceModel.Syndication.InlineCategoriesDocument Create(System.Collections.ObjectModel.Collection categories, bool isFixed, string scheme) { throw null; } + public static System.ServiceModel.Syndication.ReferencedCategoriesDocument Create(System.Uri linkToCategoriesDocument) { throw null; } + public System.ServiceModel.Syndication.CategoriesDocumentFormatter GetFormatter() { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader) { throw null; } + public void Save(System.Xml.XmlWriter writer) { } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + public abstract partial class CategoriesDocumentFormatter + { + protected CategoriesDocumentFormatter() { } + protected CategoriesDocumentFormatter(System.ServiceModel.Syndication.CategoriesDocument documentToWrite) { } + public System.ServiceModel.Syndication.CategoriesDocument Document { get { throw null; } } + public abstract string Version { get; } + public abstract System.Threading.Tasks.Task CanReadAsync(System.Xml.XmlReader reader); + protected virtual System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategoriesDocument() { throw null; } + protected virtual System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategoriesDocument() { throw null; } + public abstract System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader); + protected virtual void SetDocument(System.ServiceModel.Syndication.CategoriesDocument document) { } + public abstract System.Threading.Tasks.Task WriteTo(System.Xml.XmlWriter writer); + } + public partial class InlineCategoriesDocument : System.ServiceModel.Syndication.CategoriesDocument + { + public InlineCategoriesDocument() { } + public InlineCategoriesDocument(System.Collections.Generic.IEnumerable categories) { } + public InlineCategoriesDocument(System.Collections.Generic.IEnumerable categories, bool isFixed, string scheme) { } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public bool IsFixed { get { throw null; } set { } } + public string Scheme { get { throw null; } set { } } + protected internal virtual System.ServiceModel.Syndication.SyndicationCategory CreateCategory() { throw null; } + } + public partial class ReferencedCategoriesDocument : System.ServiceModel.Syndication.CategoriesDocument + { + public ReferencedCategoriesDocument() { } + public ReferencedCategoriesDocument(System.Uri link) { } + public System.Uri Link { get { throw null; } set { } } + } + public partial class ResourceCollectionInfo + { + public ResourceCollectionInfo() { } + public ResourceCollectionInfo(System.ServiceModel.Syndication.TextSyndicationContent title, System.Uri link) { } + public ResourceCollectionInfo(System.ServiceModel.Syndication.TextSyndicationContent title, System.Uri link, System.Collections.Generic.IEnumerable categories, bool allowsNewEntries) { } + public ResourceCollectionInfo(System.ServiceModel.Syndication.TextSyndicationContent title, System.Uri link, System.Collections.Generic.IEnumerable categories, System.Collections.Generic.IEnumerable accepts) { } + public ResourceCollectionInfo(string title, System.Uri link) { } + public System.Collections.ObjectModel.Collection Accepts { get { throw null; } } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public System.Uri Link { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + protected internal virtual System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategoriesDocument() { throw null; } + protected internal virtual System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategoriesDocument() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + public partial class Rss20FeedFormatter : System.ServiceModel.Syndication.SyndicationFeedFormatter + { + public Rss20FeedFormatter() { } + public Rss20FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite) { } + public Rss20FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) { } + public Rss20FeedFormatter(System.Type feedTypeToCreate) { } + public System.Func DateParser { get { throw null; } set { } } + protected System.Type FeedType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public bool SerializeExtensionsAsAtom { get { throw null; } set { } } + public System.Func StringParser { get { throw null; } set { } } + public System.Func UriParser { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + public static System.DateTimeOffset DefaultDateParser(string dateTimeString, string localName, string ns) { throw null; } + public override System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader, System.Threading.CancellationToken ct) { throw null; } + protected virtual System.Threading.Tasks.Task ReadItemAsync(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal override void SetFeed(System.ServiceModel.Syndication.SyndicationFeed feed) { } + protected virtual System.Threading.Tasks.Task WriteItemAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, System.Uri feedBaseUri) { throw null; } + protected virtual System.Threading.Tasks.Task WriteItemsAsync(System.Xml.XmlWriter writer, System.Collections.Generic.IEnumerable items, System.Uri feedBaseUri) { throw null; } + public override System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer, System.Threading.CancellationToken ct) { throw null; } + } + public partial class Rss20FeedFormatter : System.ServiceModel.Syndication.Rss20FeedFormatter where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() + { + public Rss20FeedFormatter() { } + public Rss20FeedFormatter(TSyndicationFeed feedToWrite) { } + public Rss20FeedFormatter(TSyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) { } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + } + public partial class Rss20ItemFormatter : System.ServiceModel.Syndication.SyndicationItemFormatter + { + public Rss20ItemFormatter() { } + public Rss20ItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite) { } + public Rss20ItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite, bool serializeExtensionsAsAtom) { } + public Rss20ItemFormatter(System.Type itemTypeToCreate) { } + protected System.Type ItemType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public bool SerializeExtensionsAsAtom { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + public override System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader) { throw null; } + public override System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer) { throw null; } + } + public partial class Rss20ItemFormatter : System.ServiceModel.Syndication.Rss20ItemFormatter where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new() + { + public Rss20ItemFormatter() { } + public Rss20ItemFormatter(TSyndicationItem itemToWrite) { } + public Rss20ItemFormatter(TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom) { } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + } + public partial class ServiceDocument + { + public ServiceDocument() { } + public ServiceDocument(System.Collections.Generic.IEnumerable workspaces) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Language { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Workspaces { get { throw null; } } + protected internal virtual System.ServiceModel.Syndication.Workspace CreateWorkspace() { throw null; } + public System.ServiceModel.Syndication.ServiceDocumentFormatter GetFormatter() { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader) where TServiceDocument : System.ServiceModel.Syndication.ServiceDocument, new() { throw null; } + public System.Threading.Tasks.Task Save(System.Xml.XmlWriter writer) { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class ServiceDocumentFormatter + { + protected ServiceDocumentFormatter() { } + protected ServiceDocumentFormatter(System.ServiceModel.Syndication.ServiceDocument documentToWrite) { } + public System.ServiceModel.Syndication.ServiceDocument Document { get { throw null; } } + public abstract string Version { get; } + public abstract System.Threading.Tasks.Task CanReadAsync(System.Xml.XmlReader reader); + protected static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.InlineCategoriesDocument inlineCategories) { throw null; } + protected static System.ServiceModel.Syndication.ResourceCollectionInfo CreateCollection(System.ServiceModel.Syndication.Workspace workspace) { throw null; } + protected virtual System.ServiceModel.Syndication.ServiceDocument CreateDocumentInstance() { throw null; } + protected static System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategories(System.ServiceModel.Syndication.ResourceCollectionInfo collection) { throw null; } + protected static System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategories(System.ServiceModel.Syndication.ResourceCollectionInfo collection) { throw null; } + protected static System.ServiceModel.Syndication.Workspace CreateWorkspace(System.ServiceModel.Syndication.ServiceDocument document) { throw null; } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.CategoriesDocument categories, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ResourceCollectionInfo collection, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ServiceDocument document, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Workspace workspace, int maxExtensionSize) { } + public abstract System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader); + protected virtual void SetDocument(System.ServiceModel.Syndication.ServiceDocument document) { } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.ServiceDocument document, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.Workspace workspace, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ServiceDocument document, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Workspace workspace, string version) { throw null; } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ServiceDocument document, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.Workspace workspace, string version) { } + protected static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ServiceDocument document, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.Workspace workspace, string version) { throw null; } + public abstract System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer); + } + public partial class SyndicationCategory + { + public SyndicationCategory() { } + protected SyndicationCategory(System.ServiceModel.Syndication.SyndicationCategory source) { } + public SyndicationCategory(string name) { } + public SyndicationCategory(string name, string scheme, string label) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Label { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Scheme { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationCategory Clone() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + public abstract partial class SyndicationContent + { + protected SyndicationContent() { } + protected SyndicationContent(System.ServiceModel.Syndication.SyndicationContent source) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public abstract string Type { get; } + public abstract System.ServiceModel.Syndication.SyndicationContent Clone(); + public static System.ServiceModel.Syndication.TextSyndicationContent CreateHtmlContent(string content) { throw null; } + public static System.ServiceModel.Syndication.TextSyndicationContent CreatePlaintextContent(string content) { throw null; } + public static System.ServiceModel.Syndication.UrlSyndicationContent CreateUrlContent(System.Uri url, string mediaType) { throw null; } + public static System.ServiceModel.Syndication.TextSyndicationContent CreateXhtmlContent(string content) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(object dataContractObject) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(object dataContractObject, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(object xmlSerializerObject, System.Xml.Serialization.XmlSerializer serializer) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(System.Xml.XmlReader XmlReaderWrapper) { throw null; } + protected abstract void WriteContentsTo(System.Xml.XmlWriter writer); + public System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer, string outerElementName, string outerElementNamespace) { throw null; } + } + public partial class SyndicationElementExtension + { + public SyndicationElementExtension(object dataContractExtension) { } + public SyndicationElementExtension(object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public SyndicationElementExtension(object xmlSerializerExtension, System.Xml.Serialization.XmlSerializer serializer) { } + public SyndicationElementExtension(string outerName, string outerNamespace, object dataContractExtension) { } + public SyndicationElementExtension(string outerName, string outerNamespace, object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public SyndicationElementExtension(System.Xml.XmlReader reader) { } + public string OuterName { get { throw null; } } + public string OuterNamespace { get { throw null; } } + public System.Threading.Tasks.Task GetObject() { throw null; } + public System.Threading.Tasks.Task GetObject(System.Runtime.Serialization.XmlObjectSerializer serializer) { throw null; } + public System.Threading.Tasks.Task GetObject(System.Xml.Serialization.XmlSerializer serializer) { throw null; } + public System.Threading.Tasks.Task GetReaderAsync() { throw null; } + public System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer) { throw null; } + } + public sealed partial class SyndicationElementExtensionCollection : System.Collections.ObjectModel.Collection + { + internal SyndicationElementExtensionCollection() { } + public void Add(object extension) { } + public void Add(object dataContractExtension, System.Runtime.Serialization.DataContractSerializer serializer) { } + public void Add(object xmlSerializerExtension, System.Xml.Serialization.XmlSerializer serializer) { } + public void Add(string outerName, string outerNamespace, object dataContractExtension) { } + public void Add(string outerName, string outerNamespace, object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public void Add(System.Xml.XmlReader reader) { } + protected override void ClearItems() { } + public System.Threading.Tasks.Task GetReaderAtElementExtensions() { throw null; } + protected override void InsertItem(int index, System.ServiceModel.Syndication.SyndicationElementExtension item) { } + public System.Threading.Tasks.Task> ReadElementExtensions(string extensionName, string extensionNamespace) { throw null; } + public System.Threading.Tasks.Task> ReadElementExtensions(string extensionName, string extensionNamespace, System.Runtime.Serialization.XmlObjectSerializer serializer) { throw null; } + public System.Threading.Tasks.Task> ReadElementExtensions(string extensionName, string extensionNamespace, System.Xml.Serialization.XmlSerializer serializer) { throw null; } + protected override void RemoveItem(int index) { } + protected override void SetItem(int index, System.ServiceModel.Syndication.SyndicationElementExtension item) { } + } + public partial class SyndicationFeed + { + public SyndicationFeed() { } + public SyndicationFeed(System.Collections.Generic.IEnumerable items) { } + protected SyndicationFeed(System.ServiceModel.Syndication.SyndicationFeed source, bool cloneItems) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink, System.Collections.Generic.IEnumerable items) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink, string id, System.DateTimeOffset lastUpdatedTime) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink, string id, System.DateTimeOffset lastUpdatedTime, System.Collections.Generic.IEnumerable items) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Collections.ObjectModel.Collection Authors { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public System.Collections.ObjectModel.Collection Contributors { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Copyright { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Description { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationLink Documentation { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Generator { get { throw null; } set { } } + public System.Uri IconImage { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public System.Uri ImageLink { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent ImageTitle { get { throw null; } set { } } + public System.Uri ImageUrl { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable Items { get { throw null; } set { } } + public string Language { get { throw null; } set { } } + public System.DateTimeOffset LastUpdatedTime { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Links { get { throw null; } } + public System.Collections.ObjectModel.Collection SkipDays { get { throw null; } } + public System.Collections.ObjectModel.Collection SkipHours { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationTextInput TextInput { get { throw null; } set { } } + public int TimeToLive { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationFeed Clone(bool cloneItems) { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationCategory CreateCategory() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationItem CreateItem() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationLink CreateLink() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationPerson CreatePerson() { throw null; } + public System.ServiceModel.Syndication.Atom10FeedFormatter GetAtom10Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20FeedFormatter GetRss20Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20FeedFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) { throw null; } + public static System.ServiceModel.Syndication.SyndicationFeed Load(System.Xml.XmlReader reader) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Atom10FeedFormatter formatter, System.Threading.CancellationToken ct) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Rss20FeedFormatter Rssformatter, System.ServiceModel.Syndication.Atom10FeedFormatter Atomformatter, System.Threading.CancellationToken ct) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Rss20FeedFormatter formatter, System.Threading.CancellationToken ct) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader, System.Threading.CancellationToken ct) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader, System.Threading.CancellationToken ct) where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() { throw null; } + public static TSyndicationFeed Load(System.Xml.XmlReader reader) where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() { throw null; } + public System.Threading.Tasks.Task SaveAsAtom10Async(System.Xml.XmlWriter writer, System.Threading.CancellationToken ct) { throw null; } + public System.Threading.Tasks.Task SaveAsRss20Async(System.Xml.XmlWriter writer, System.Threading.CancellationToken ct) { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class SyndicationFeedFormatter + { + protected SyndicationFeedFormatter() { } + protected SyndicationFeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite) { } + public System.ServiceModel.Syndication.SyndicationFeed Feed { get { throw null; } } + public abstract string Version { get; } + public abstract bool CanRead(System.Xml.XmlReader reader); + protected internal static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected abstract System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance(); + protected internal static System.ServiceModel.Syndication.SyndicationItem CreateItem(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationLink CreateLink(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationLink CreateLink(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationPerson CreatePerson(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationPerson CreatePerson(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, int maxExtensionSize) { } + public abstract System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader, System.Threading.CancellationToken ct); + protected internal virtual void SetFeed(System.ServiceModel.Syndication.SyndicationFeed feed) { } + public override string ToString() { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected internal static bool TryParseContent(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string contentType, string version, out System.ServiceModel.Syndication.SyndicationContent content) { content = default(System.ServiceModel.Syndication.SyndicationContent); throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected internal static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + public abstract System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer, System.Threading.CancellationToken ct); + } + public partial class SyndicationItem + { + public SyndicationItem() { } + protected SyndicationItem(System.ServiceModel.Syndication.SyndicationItem source) { } + public SyndicationItem(string title, System.ServiceModel.Syndication.SyndicationContent content, System.Uri itemAlternateLink, string id, System.DateTimeOffset lastUpdatedTime) { } + public SyndicationItem(string title, string content, System.Uri itemAlternateLink) { } + public SyndicationItem(string title, string content, System.Uri itemAlternateLink, string id, System.DateTimeOffset lastUpdatedTime) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Collections.ObjectModel.Collection Authors { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationContent Content { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Contributors { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Copyright { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Id { get { throw null; } set { } } + public System.DateTimeOffset LastUpdatedTime { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Links { get { throw null; } } + public System.DateTimeOffset PublishDate { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationFeed SourceFeed { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Summary { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + public void AddPermalink(System.Uri permalink) { } + public virtual System.ServiceModel.Syndication.SyndicationItem Clone() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationCategory CreateCategory() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationLink CreateLink() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationPerson CreatePerson() { throw null; } + public System.ServiceModel.Syndication.Atom10ItemFormatter GetAtom10Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20ItemFormatter GetRss20Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20ItemFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader) { throw null; } + public static System.Threading.Tasks.Task LoadAsync(System.Xml.XmlReader reader) where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new() { throw null; } + public System.Threading.Tasks.Task SaveAsAtom10(System.Xml.XmlWriter writer) { throw null; } + public System.Threading.Tasks.Task SaveAsRss20(System.Xml.XmlWriter writer) { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseContent(System.Xml.XmlReader reader, string contentType, string version, out System.ServiceModel.Syndication.SyndicationContent content) { content = default(System.ServiceModel.Syndication.SyndicationContent); throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class SyndicationItemFormatter + { + protected SyndicationItemFormatter() { } + protected SyndicationItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite) { } + public System.ServiceModel.Syndication.SyndicationItem Item { get { throw null; } } + public abstract string Version { get; } + public abstract bool CanRead(System.Xml.XmlReader reader); + protected static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected abstract System.ServiceModel.Syndication.SyndicationItem CreateItemInstance(); + protected static System.ServiceModel.Syndication.SyndicationLink CreateLink(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected static System.ServiceModel.Syndication.SyndicationPerson CreatePerson(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, int maxExtensionSize) { } + public abstract System.Threading.Tasks.Task ReadFromAsync(System.Xml.XmlReader reader); + protected internal virtual void SetItem(System.ServiceModel.Syndication.SyndicationItem item) { } + public override string ToString() { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected static bool TryParseContent(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string contentType, string version, out System.ServiceModel.Syndication.SyndicationContent content) { content = default(System.ServiceModel.Syndication.SyndicationContent); throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected static System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + public abstract System.Threading.Tasks.Task WriteToAsync(System.Xml.XmlWriter writer); + } + public partial class SyndicationLink + { + public SyndicationLink() { } + protected SyndicationLink(System.ServiceModel.Syndication.SyndicationLink source) { } + public SyndicationLink(System.Uri uri) { } + public SyndicationLink(System.Uri uri, string relationshipType, string title, string mediaType, long length) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public long Length { get { throw null; } set { } } + public string MediaType { get { throw null; } set { } } + public string RelationshipType { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + public System.Uri Uri { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationLink Clone() { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateAlternateLink(System.Uri uri) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateAlternateLink(System.Uri uri, string mediaType) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateMediaEnclosureLink(System.Uri uri, string mediaType, long length) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateSelfLink(System.Uri uri) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateSelfLink(System.Uri uri, string mediaType) { throw null; } + public System.Uri GetAbsoluteUri() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + public partial class SyndicationPerson + { + public SyndicationPerson() { } + protected SyndicationPerson(System.ServiceModel.Syndication.SyndicationPerson source) { } + public SyndicationPerson(string email) { } + public SyndicationPerson(string email, string name, string uri) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Email { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationPerson Clone() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + public partial class SyndicationTextInput + { + public string Description; + public System.ServiceModel.Syndication.SyndicationLink link; + public string name; + public string title; + public SyndicationTextInput() { } + } + public static partial class SyndicationVersions + { + public const string Atom10 = "Atom10"; + public const string Rss20 = "Rss20"; + } + public partial class TextSyndicationContent : System.ServiceModel.Syndication.SyndicationContent + { + protected TextSyndicationContent(System.ServiceModel.Syndication.TextSyndicationContent source) { } + public TextSyndicationContent(string text) { } + public TextSyndicationContent(string text, System.ServiceModel.Syndication.TextSyndicationContentKind textKind) { } + public string Text { get { throw null; } } + public override string Type { get { throw null; } } + public override System.ServiceModel.Syndication.SyndicationContent Clone() { throw null; } + protected override void WriteContentsTo(System.Xml.XmlWriter writer) { } + } + public enum TextSyndicationContentKind + { + Html = 1, + Plaintext = 0, + XHtml = 2, + } + public partial class UrlSyndicationContent : System.ServiceModel.Syndication.SyndicationContent + { + protected UrlSyndicationContent(System.ServiceModel.Syndication.UrlSyndicationContent source) { } + public UrlSyndicationContent(System.Uri url, string mediaType) { } + public override string Type { get { throw null; } } + public System.Uri Url { get { throw null; } } + public override System.ServiceModel.Syndication.SyndicationContent Clone() { throw null; } + protected override void WriteContentsTo(System.Xml.XmlWriter writer) { } + } + public partial class Workspace + { + public Workspace() { } + public Workspace(System.ServiceModel.Syndication.TextSyndicationContent title, System.Collections.Generic.IEnumerable collections) { } + public Workspace(string title, System.Collections.Generic.IEnumerable collections) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Collections { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + protected internal virtual System.ServiceModel.Syndication.ResourceCollectionInfo CreateResourceCollection() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { throw null; } + protected internal virtual System.Threading.Tasks.Task WriteElementExtensionsAsync(System.Xml.XmlWriter writer, string version) { throw null; } + } + public partial class XmlSyndicationContent : System.ServiceModel.Syndication.SyndicationContent + { + protected XmlSyndicationContent(System.ServiceModel.Syndication.XmlSyndicationContent source) { } + public XmlSyndicationContent(string type, object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public XmlSyndicationContent(string type, object xmlSerializerExtension, System.Xml.Serialization.XmlSerializer serializer) { } + public XmlSyndicationContent(string type, System.ServiceModel.Syndication.SyndicationElementExtension extension) { } + public XmlSyndicationContent(System.Xml.XmlReader reader) { } + public System.ServiceModel.Syndication.SyndicationElementExtension Extension { get { throw null; } } + public override string Type { get { throw null; } } + public override System.ServiceModel.Syndication.SyndicationContent Clone() { throw null; } + public System.Threading.Tasks.Task GetReaderAtContent() { throw null; } + public System.Threading.Tasks.Task ReadContent() { throw null; } + public System.Threading.Tasks.Task ReadContent(System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { throw null; } + public System.Threading.Tasks.Task ReadContent(System.Xml.Serialization.XmlSerializer serializer) { throw null; } + protected override void WriteContentsTo(System.Xml.XmlWriter writer) { } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj b/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj new file mode 100644 index 0000000000..4b651d43f7 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.csproj @@ -0,0 +1,26 @@ + + + + + {E81F4C7C-2000-4449-BEE6-B2E84DE218F7} + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.netfx.cs b/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.netfx.cs new file mode 100644 index 0000000000..e463c141e8 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/ref/System.ServiceModel.Syndication.netfx.cs @@ -0,0 +1,619 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// ------------------------------------------------------------------------------ +// Changes to this file must follow the http://aka.ms/api-review process. +// ------------------------------------------------------------------------------ + +namespace System.ServiceModel.Syndication +{ + public partial class Atom10FeedFormatter : System.ServiceModel.Syndication.SyndicationFeedFormatter, System.Xml.Serialization.IXmlSerializable + { + public Atom10FeedFormatter() { } + public Atom10FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite) { } + public Atom10FeedFormatter(System.Type feedTypeToCreate) { } + protected System.Type FeedType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + public override void ReadFrom(System.Xml.XmlReader reader) { } + protected virtual System.ServiceModel.Syndication.SyndicationItem ReadItem(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected virtual System.Collections.Generic.IEnumerable ReadItems(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed, out bool areAllItemsRead) { areAllItemsRead = default(bool); throw null; } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + protected virtual void WriteItem(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, System.Uri feedBaseUri) { } + protected virtual void WriteItems(System.Xml.XmlWriter writer, System.Collections.Generic.IEnumerable items, System.Uri feedBaseUri) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class Atom10FeedFormatter : System.ServiceModel.Syndication.Atom10FeedFormatter where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() + { + public Atom10FeedFormatter() { } + public Atom10FeedFormatter(TSyndicationFeed feedToWrite) { } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + } + public partial class Atom10ItemFormatter : System.ServiceModel.Syndication.SyndicationItemFormatter, System.Xml.Serialization.IXmlSerializable + { + public Atom10ItemFormatter() { } + public Atom10ItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite) { } + public Atom10ItemFormatter(System.Type itemTypeToCreate) { } + protected System.Type ItemType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + public override void ReadFrom(System.Xml.XmlReader reader) { } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class Atom10ItemFormatter : System.ServiceModel.Syndication.Atom10ItemFormatter where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new() + { + public Atom10ItemFormatter() { } + public Atom10ItemFormatter(TSyndicationItem itemToWrite) { } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + } + public partial class AtomPub10CategoriesDocumentFormatter : System.ServiceModel.Syndication.CategoriesDocumentFormatter, System.Xml.Serialization.IXmlSerializable + { + public AtomPub10CategoriesDocumentFormatter() { } + public AtomPub10CategoriesDocumentFormatter(System.ServiceModel.Syndication.CategoriesDocument documentToWrite) { } + public AtomPub10CategoriesDocumentFormatter(System.Type inlineDocumentType, System.Type referencedDocumentType) { } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategoriesDocument() { throw null; } + protected override System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategoriesDocument() { throw null; } + public override void ReadFrom(System.Xml.XmlReader reader) { } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class AtomPub10ServiceDocumentFormatter : System.ServiceModel.Syndication.ServiceDocumentFormatter, System.Xml.Serialization.IXmlSerializable + { + public AtomPub10ServiceDocumentFormatter() { } + public AtomPub10ServiceDocumentFormatter(System.ServiceModel.Syndication.ServiceDocument documentToWrite) { } + public AtomPub10ServiceDocumentFormatter(System.Type documentTypeToCreate) { } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.ServiceDocument CreateDocumentInstance() { throw null; } + public override void ReadFrom(System.Xml.XmlReader reader) { } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class AtomPub10ServiceDocumentFormatter : System.ServiceModel.Syndication.AtomPub10ServiceDocumentFormatter where TServiceDocument : System.ServiceModel.Syndication.ServiceDocument, new() + { + public AtomPub10ServiceDocumentFormatter() { } + public AtomPub10ServiceDocumentFormatter(TServiceDocument documentToWrite) { } + protected override System.ServiceModel.Syndication.ServiceDocument CreateDocumentInstance() { throw null; } + } + public abstract partial class CategoriesDocument + { + internal CategoriesDocument() { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Language { get { throw null; } set { } } + public static System.ServiceModel.Syndication.InlineCategoriesDocument Create(System.Collections.ObjectModel.Collection categories) { throw null; } + public static System.ServiceModel.Syndication.InlineCategoriesDocument Create(System.Collections.ObjectModel.Collection categories, bool isFixed, string scheme) { throw null; } + public static System.ServiceModel.Syndication.ReferencedCategoriesDocument Create(System.Uri linkToCategoriesDocument) { throw null; } + public System.ServiceModel.Syndication.CategoriesDocumentFormatter GetFormatter() { throw null; } + public static System.ServiceModel.Syndication.CategoriesDocument Load(System.Xml.XmlReader reader) { throw null; } + public void Save(System.Xml.XmlWriter writer) { } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class CategoriesDocumentFormatter + { + protected CategoriesDocumentFormatter() { } + protected CategoriesDocumentFormatter(System.ServiceModel.Syndication.CategoriesDocument documentToWrite) { } + public System.ServiceModel.Syndication.CategoriesDocument Document { get { throw null; } } + public abstract string Version { get; } + public abstract bool CanRead(System.Xml.XmlReader reader); + protected virtual System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategoriesDocument() { throw null; } + protected virtual System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategoriesDocument() { throw null; } + public abstract void ReadFrom(System.Xml.XmlReader reader); + protected virtual void SetDocument(System.ServiceModel.Syndication.CategoriesDocument document) { } + public abstract void WriteTo(System.Xml.XmlWriter writer); + } + public partial class InlineCategoriesDocument : System.ServiceModel.Syndication.CategoriesDocument + { + public InlineCategoriesDocument() { } + public InlineCategoriesDocument(System.Collections.Generic.IEnumerable categories) { } + public InlineCategoriesDocument(System.Collections.Generic.IEnumerable categories, bool isFixed, string scheme) { } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public bool IsFixed { get { throw null; } set { } } + public string Scheme { get { throw null; } set { } } + protected internal virtual System.ServiceModel.Syndication.SyndicationCategory CreateCategory() { throw null; } + } + public partial class ReferencedCategoriesDocument : System.ServiceModel.Syndication.CategoriesDocument + { + public ReferencedCategoriesDocument() { } + public ReferencedCategoriesDocument(System.Uri link) { } + public System.Uri Link { get { throw null; } set { } } + } + public partial class ResourceCollectionInfo + { + public ResourceCollectionInfo() { } + public ResourceCollectionInfo(System.ServiceModel.Syndication.TextSyndicationContent title, System.Uri link) { } + public ResourceCollectionInfo(System.ServiceModel.Syndication.TextSyndicationContent title, System.Uri link, System.Collections.Generic.IEnumerable categories, bool allowsNewEntries) { } + public ResourceCollectionInfo(System.ServiceModel.Syndication.TextSyndicationContent title, System.Uri link, System.Collections.Generic.IEnumerable categories, System.Collections.Generic.IEnumerable accepts) { } + public ResourceCollectionInfo(string title, System.Uri link) { } + public System.Collections.ObjectModel.Collection Accepts { get { throw null; } } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public System.Uri Link { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + protected internal virtual System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategoriesDocument() { throw null; } + protected internal virtual System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategoriesDocument() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + public partial class Rss20FeedFormatter : System.ServiceModel.Syndication.SyndicationFeedFormatter, System.Xml.Serialization.IXmlSerializable + { + public Rss20FeedFormatter() { } + public Rss20FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite) { } + public Rss20FeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) { } + public Rss20FeedFormatter(System.Type feedTypeToCreate) { } + protected System.Type FeedType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public bool SerializeExtensionsAsAtom { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + public override void ReadFrom(System.Xml.XmlReader reader) { } + protected virtual System.ServiceModel.Syndication.SyndicationItem ReadItem(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected virtual System.Collections.Generic.IEnumerable ReadItems(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed, out bool areAllItemsRead) { areAllItemsRead = default(bool); throw null; } + protected internal override void SetFeed(System.ServiceModel.Syndication.SyndicationFeed feed) { } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + protected virtual void WriteItem(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, System.Uri feedBaseUri) { } + protected virtual void WriteItems(System.Xml.XmlWriter writer, System.Collections.Generic.IEnumerable items, System.Uri feedBaseUri) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class Rss20FeedFormatter : System.ServiceModel.Syndication.Rss20FeedFormatter where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() + { + public Rss20FeedFormatter() { } + public Rss20FeedFormatter(TSyndicationFeed feedToWrite) { } + public Rss20FeedFormatter(TSyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) { } + protected override System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance() { throw null; } + } + public partial class Rss20ItemFormatter : System.ServiceModel.Syndication.SyndicationItemFormatter, System.Xml.Serialization.IXmlSerializable + { + public Rss20ItemFormatter() { } + public Rss20ItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite) { } + public Rss20ItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite, bool serializeExtensionsAsAtom) { } + public Rss20ItemFormatter(System.Type itemTypeToCreate) { } + protected System.Type ItemType { get { throw null; } } + public bool PreserveAttributeExtensions { get { throw null; } set { } } + public bool PreserveElementExtensions { get { throw null; } set { } } + public bool SerializeExtensionsAsAtom { get { throw null; } set { } } + public override string Version { get { throw null; } } + public override bool CanRead(System.Xml.XmlReader reader) { throw null; } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + public override void ReadFrom(System.Xml.XmlReader reader) { } + System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() { throw null; } + void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { } + void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { } + public override void WriteTo(System.Xml.XmlWriter writer) { } + } + public partial class Rss20ItemFormatter : System.ServiceModel.Syndication.Rss20ItemFormatter, System.Xml.Serialization.IXmlSerializable where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new() + { + public Rss20ItemFormatter() { } + public Rss20ItemFormatter(TSyndicationItem itemToWrite) { } + public Rss20ItemFormatter(TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom) { } + protected override System.ServiceModel.Syndication.SyndicationItem CreateItemInstance() { throw null; } + } + public partial class ServiceDocument + { + public ServiceDocument() { } + public ServiceDocument(System.Collections.Generic.IEnumerable workspaces) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Language { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Workspaces { get { throw null; } } + protected internal virtual System.ServiceModel.Syndication.Workspace CreateWorkspace() { throw null; } + public System.ServiceModel.Syndication.ServiceDocumentFormatter GetFormatter() { throw null; } + public static System.ServiceModel.Syndication.ServiceDocument Load(System.Xml.XmlReader reader) { throw null; } + public static TServiceDocument Load(System.Xml.XmlReader reader) where TServiceDocument : System.ServiceModel.Syndication.ServiceDocument, new() { throw null; } + public void Save(System.Xml.XmlWriter writer) { } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class ServiceDocumentFormatter + { + protected ServiceDocumentFormatter() { } + protected ServiceDocumentFormatter(System.ServiceModel.Syndication.ServiceDocument documentToWrite) { } + public System.ServiceModel.Syndication.ServiceDocument Document { get { throw null; } } + public abstract string Version { get; } + public abstract bool CanRead(System.Xml.XmlReader reader); + protected static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.InlineCategoriesDocument inlineCategories) { throw null; } + protected static System.ServiceModel.Syndication.ResourceCollectionInfo CreateCollection(System.ServiceModel.Syndication.Workspace workspace) { throw null; } + protected virtual System.ServiceModel.Syndication.ServiceDocument CreateDocumentInstance() { throw null; } + protected static System.ServiceModel.Syndication.InlineCategoriesDocument CreateInlineCategories(System.ServiceModel.Syndication.ResourceCollectionInfo collection) { throw null; } + protected static System.ServiceModel.Syndication.ReferencedCategoriesDocument CreateReferencedCategories(System.ServiceModel.Syndication.ResourceCollectionInfo collection) { throw null; } + protected static System.ServiceModel.Syndication.Workspace CreateWorkspace(System.ServiceModel.Syndication.ServiceDocument document) { throw null; } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.CategoriesDocument categories, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ResourceCollectionInfo collection, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ServiceDocument document, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Workspace workspace, int maxExtensionSize) { } + public abstract void ReadFrom(System.Xml.XmlReader reader); + protected virtual void SetDocument(System.ServiceModel.Syndication.ServiceDocument document) { } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.ServiceDocument document, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.Workspace workspace, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.ServiceDocument document, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.Workspace workspace, string version) { throw null; } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ServiceDocument document, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.Workspace workspace, string version) { } + protected static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.CategoriesDocument categories, string version) { } + protected static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ResourceCollectionInfo collection, string version) { } + protected static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.ServiceDocument document, string version) { } + protected static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.Workspace workspace, string version) { } + public abstract void WriteTo(System.Xml.XmlWriter writer); + } + public partial class SyndicationCategory + { + public SyndicationCategory() { } + protected SyndicationCategory(System.ServiceModel.Syndication.SyndicationCategory source) { } + public SyndicationCategory(string name) { } + public SyndicationCategory(string name, string scheme, string label) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Label { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Scheme { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationCategory Clone() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + public abstract partial class SyndicationContent + { + protected SyndicationContent() { } + protected SyndicationContent(System.ServiceModel.Syndication.SyndicationContent source) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public abstract string Type { get; } + public abstract System.ServiceModel.Syndication.SyndicationContent Clone(); + public static System.ServiceModel.Syndication.TextSyndicationContent CreateHtmlContent(string content) { throw null; } + public static System.ServiceModel.Syndication.TextSyndicationContent CreatePlaintextContent(string content) { throw null; } + public static System.ServiceModel.Syndication.UrlSyndicationContent CreateUrlContent(System.Uri url, string mediaType) { throw null; } + public static System.ServiceModel.Syndication.TextSyndicationContent CreateXhtmlContent(string content) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(object dataContractObject) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(object dataContractObject, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(object xmlSerializerObject, System.Xml.Serialization.XmlSerializer serializer) { throw null; } + public static System.ServiceModel.Syndication.XmlSyndicationContent CreateXmlContent(System.Xml.XmlReader xmlReader) { throw null; } + protected abstract void WriteContentsTo(System.Xml.XmlWriter writer); + public void WriteTo(System.Xml.XmlWriter writer, string outerElementName, string outerElementNamespace) { } + } + public partial class SyndicationElementExtension + { + public SyndicationElementExtension(object dataContractExtension) { } + public SyndicationElementExtension(object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public SyndicationElementExtension(object xmlSerializerExtension, System.Xml.Serialization.XmlSerializer serializer) { } + public SyndicationElementExtension(string outerName, string outerNamespace, object dataContractExtension) { } + public SyndicationElementExtension(string outerName, string outerNamespace, object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public SyndicationElementExtension(System.Xml.XmlReader xmlReader) { } + public string OuterName { get { throw null; } } + public string OuterNamespace { get { throw null; } } + public TExtension GetObject() { throw null; } + public TExtension GetObject(System.Runtime.Serialization.XmlObjectSerializer serializer) { throw null; } + public TExtension GetObject(System.Xml.Serialization.XmlSerializer serializer) { throw null; } + public System.Xml.XmlReader GetReader() { throw null; } + public void WriteTo(System.Xml.XmlWriter writer) { } + } + public sealed partial class SyndicationElementExtensionCollection : System.Collections.ObjectModel.Collection + { + internal SyndicationElementExtensionCollection() { } + public void Add(object extension) { } + public void Add(object dataContractExtension, System.Runtime.Serialization.DataContractSerializer serializer) { } + public void Add(object xmlSerializerExtension, System.Xml.Serialization.XmlSerializer serializer) { } + public void Add(string outerName, string outerNamespace, object dataContractExtension) { } + public void Add(string outerName, string outerNamespace, object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public void Add(System.Xml.XmlReader xmlReader) { } + protected override void ClearItems() { } + public System.Xml.XmlReader GetReaderAtElementExtensions() { throw null; } + protected override void InsertItem(int index, System.ServiceModel.Syndication.SyndicationElementExtension item) { } + public System.Collections.ObjectModel.Collection ReadElementExtensions(string extensionName, string extensionNamespace) { throw null; } + public System.Collections.ObjectModel.Collection ReadElementExtensions(string extensionName, string extensionNamespace, System.Runtime.Serialization.XmlObjectSerializer serializer) { throw null; } + public System.Collections.ObjectModel.Collection ReadElementExtensions(string extensionName, string extensionNamespace, System.Xml.Serialization.XmlSerializer serializer) { throw null; } + protected override void RemoveItem(int index) { } + protected override void SetItem(int index, System.ServiceModel.Syndication.SyndicationElementExtension item) { } + } + public partial class SyndicationFeed + { + public SyndicationFeed() { } + public SyndicationFeed(System.Collections.Generic.IEnumerable items) { } + protected SyndicationFeed(System.ServiceModel.Syndication.SyndicationFeed source, bool cloneItems) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink, System.Collections.Generic.IEnumerable items) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink, string id, System.DateTimeOffset lastUpdatedTime) { } + public SyndicationFeed(string title, string description, System.Uri feedAlternateLink, string id, System.DateTimeOffset lastUpdatedTime, System.Collections.Generic.IEnumerable items) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Collections.ObjectModel.Collection Authors { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public System.Collections.ObjectModel.Collection Contributors { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Copyright { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Description { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Generator { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public System.Uri ImageUrl { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable Items { get { throw null; } set { } } + public string Language { get { throw null; } set { } } + public System.DateTimeOffset LastUpdatedTime { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Links { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationFeed Clone(bool cloneItems) { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationCategory CreateCategory() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationItem CreateItem() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationLink CreateLink() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationPerson CreatePerson() { throw null; } + public System.ServiceModel.Syndication.Atom10FeedFormatter GetAtom10Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20FeedFormatter GetRss20Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20FeedFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) { throw null; } + public static System.ServiceModel.Syndication.SyndicationFeed Load(System.Xml.XmlReader reader) { throw null; } + public static TSyndicationFeed Load(System.Xml.XmlReader reader) where TSyndicationFeed : System.ServiceModel.Syndication.SyndicationFeed, new() { throw null; } + public void SaveAsAtom10(System.Xml.XmlWriter writer) { } + public void SaveAsRss20(System.Xml.XmlWriter writer) { } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class SyndicationFeedFormatter + { + protected SyndicationFeedFormatter() { } + protected SyndicationFeedFormatter(System.ServiceModel.Syndication.SyndicationFeed feedToWrite) { } + public System.ServiceModel.Syndication.SyndicationFeed Feed { get { throw null; } } + public abstract string Version { get; } + public abstract bool CanRead(System.Xml.XmlReader reader); + protected internal static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected abstract System.ServiceModel.Syndication.SyndicationFeed CreateFeedInstance(); + protected internal static System.ServiceModel.Syndication.SyndicationItem CreateItem(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationLink CreateLink(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationLink CreateLink(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationPerson CreatePerson(System.ServiceModel.Syndication.SyndicationFeed feed) { throw null; } + protected internal static System.ServiceModel.Syndication.SyndicationPerson CreatePerson(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, int maxExtensionSize) { } + protected internal static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, int maxExtensionSize) { } + public abstract void ReadFrom(System.Xml.XmlReader reader); + protected internal virtual void SetFeed(System.ServiceModel.Syndication.SyndicationFeed feed) { } + public override string ToString() { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected internal static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected internal static bool TryParseContent(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string contentType, string version, out System.ServiceModel.Syndication.SyndicationContent content) { content = default(System.ServiceModel.Syndication.SyndicationContent); throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected internal static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected internal static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { } + protected internal static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { } + protected internal static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { } + protected internal static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { } + protected internal static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { } + protected internal static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { } + protected internal static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationFeed feed, string version) { } + protected internal static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { } + protected internal static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { } + protected internal static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { } + public abstract void WriteTo(System.Xml.XmlWriter writer); + } + public partial class SyndicationItem + { + public SyndicationItem() { } + protected SyndicationItem(System.ServiceModel.Syndication.SyndicationItem source) { } + public SyndicationItem(string title, System.ServiceModel.Syndication.SyndicationContent content, System.Uri itemAlternateLink, string id, System.DateTimeOffset lastUpdatedTime) { } + public SyndicationItem(string title, string content, System.Uri itemAlternateLink) { } + public SyndicationItem(string title, string content, System.Uri itemAlternateLink, string id, System.DateTimeOffset lastUpdatedTime) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Collections.ObjectModel.Collection Authors { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Categories { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationContent Content { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Contributors { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Copyright { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Id { get { throw null; } set { } } + public System.DateTimeOffset LastUpdatedTime { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Links { get { throw null; } } + public System.DateTimeOffset PublishDate { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationFeed SourceFeed { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Summary { get { throw null; } set { } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + public void AddPermalink(System.Uri permalink) { } + public virtual System.ServiceModel.Syndication.SyndicationItem Clone() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationCategory CreateCategory() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationLink CreateLink() { throw null; } + protected internal virtual System.ServiceModel.Syndication.SyndicationPerson CreatePerson() { throw null; } + public System.ServiceModel.Syndication.Atom10ItemFormatter GetAtom10Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20ItemFormatter GetRss20Formatter() { throw null; } + public System.ServiceModel.Syndication.Rss20ItemFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) { throw null; } + public static System.ServiceModel.Syndication.SyndicationItem Load(System.Xml.XmlReader reader) { throw null; } + public static TSyndicationItem Load(System.Xml.XmlReader reader) where TSyndicationItem : System.ServiceModel.Syndication.SyndicationItem, new() { throw null; } + public void SaveAsAtom10(System.Xml.XmlWriter writer) { } + public void SaveAsRss20(System.Xml.XmlWriter writer) { } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseContent(System.Xml.XmlReader reader, string contentType, string version, out System.ServiceModel.Syndication.SyndicationContent content) { content = default(System.ServiceModel.Syndication.SyndicationContent); throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + [System.Runtime.Serialization.DataContractAttribute] + public abstract partial class SyndicationItemFormatter + { + protected SyndicationItemFormatter() { } + protected SyndicationItemFormatter(System.ServiceModel.Syndication.SyndicationItem itemToWrite) { } + public System.ServiceModel.Syndication.SyndicationItem Item { get { throw null; } } + public abstract string Version { get; } + public abstract bool CanRead(System.Xml.XmlReader reader); + protected static System.ServiceModel.Syndication.SyndicationCategory CreateCategory(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected abstract System.ServiceModel.Syndication.SyndicationItem CreateItemInstance(); + protected static System.ServiceModel.Syndication.SyndicationLink CreateLink(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected static System.ServiceModel.Syndication.SyndicationPerson CreatePerson(System.ServiceModel.Syndication.SyndicationItem item) { throw null; } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, int maxExtensionSize) { } + protected static void LoadElementExtensions(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, int maxExtensionSize) { } + public abstract void ReadFrom(System.Xml.XmlReader reader); + protected internal virtual void SetItem(System.ServiceModel.Syndication.SyndicationItem item) { } + public override string ToString() { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected static bool TryParseAttribute(string name, string ns, string value, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected static bool TryParseContent(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string contentType, string version, out System.ServiceModel.Syndication.SyndicationContent content) { content = default(System.ServiceModel.Syndication.SyndicationContent); throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationCategory category, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationItem item, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationLink link, string version) { throw null; } + protected static bool TryParseElement(System.Xml.XmlReader reader, System.ServiceModel.Syndication.SyndicationPerson person, string version) { throw null; } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { } + protected static void WriteAttributeExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { } + protected void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationCategory category, string version) { } + protected static void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationItem item, string version) { } + protected void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationLink link, string version) { } + protected void WriteElementExtensions(System.Xml.XmlWriter writer, System.ServiceModel.Syndication.SyndicationPerson person, string version) { } + public abstract void WriteTo(System.Xml.XmlWriter writer); + } + public partial class SyndicationLink + { + public SyndicationLink() { } + protected SyndicationLink(System.ServiceModel.Syndication.SyndicationLink source) { } + public SyndicationLink(System.Uri uri) { } + public SyndicationLink(System.Uri uri, string relationshipType, string title, string mediaType, long length) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public long Length { get { throw null; } set { } } + public string MediaType { get { throw null; } set { } } + public string RelationshipType { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + public System.Uri Uri { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationLink Clone() { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateAlternateLink(System.Uri uri) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateAlternateLink(System.Uri uri, string mediaType) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateMediaEnclosureLink(System.Uri uri, string mediaType, long length) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateSelfLink(System.Uri uri) { throw null; } + public static System.ServiceModel.Syndication.SyndicationLink CreateSelfLink(System.Uri uri, string mediaType) { throw null; } + public System.Uri GetAbsoluteUri() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + public partial class SyndicationPerson + { + public SyndicationPerson() { } + protected SyndicationPerson(System.ServiceModel.Syndication.SyndicationPerson source) { } + public SyndicationPerson(string email) { } + public SyndicationPerson(string email, string name, string uri) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public string Email { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + public virtual System.ServiceModel.Syndication.SyndicationPerson Clone() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + public static partial class SyndicationVersions + { + public const string Atom10 = "Atom10"; + public const string Rss20 = "Rss20"; + } + public partial class TextSyndicationContent : System.ServiceModel.Syndication.SyndicationContent + { + protected TextSyndicationContent(System.ServiceModel.Syndication.TextSyndicationContent source) { } + public TextSyndicationContent(string text) { } + public TextSyndicationContent(string text, System.ServiceModel.Syndication.TextSyndicationContentKind textKind) { } + public string Text { get { throw null; } } + public override string Type { get { throw null; } } + public override System.ServiceModel.Syndication.SyndicationContent Clone() { throw null; } + protected override void WriteContentsTo(System.Xml.XmlWriter writer) { } + } + public enum TextSyndicationContentKind + { + Html = 1, + Plaintext = 0, + XHtml = 2, + } + public partial class UrlSyndicationContent : System.ServiceModel.Syndication.SyndicationContent + { + protected UrlSyndicationContent(System.ServiceModel.Syndication.UrlSyndicationContent source) { } + public UrlSyndicationContent(System.Uri url, string mediaType) { } + public override string Type { get { throw null; } } + public System.Uri Url { get { throw null; } } + public override System.ServiceModel.Syndication.SyndicationContent Clone() { throw null; } + protected override void WriteContentsTo(System.Xml.XmlWriter writer) { } + } + public partial class Workspace + { + public Workspace() { } + public Workspace(System.ServiceModel.Syndication.TextSyndicationContent title, System.Collections.Generic.IEnumerable collections) { } + public Workspace(string title, System.Collections.Generic.IEnumerable collections) { } + public System.Collections.Generic.Dictionary AttributeExtensions { get { throw null; } } + public System.Uri BaseUri { get { throw null; } set { } } + public System.Collections.ObjectModel.Collection Collections { get { throw null; } } + public System.ServiceModel.Syndication.SyndicationElementExtensionCollection ElementExtensions { get { throw null; } } + public System.ServiceModel.Syndication.TextSyndicationContent Title { get { throw null; } set { } } + protected internal virtual System.ServiceModel.Syndication.ResourceCollectionInfo CreateResourceCollection() { throw null; } + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) { throw null; } + protected internal virtual bool TryParseElement(System.Xml.XmlReader reader, string version) { throw null; } + protected internal virtual void WriteAttributeExtensions(System.Xml.XmlWriter writer, string version) { } + protected internal virtual void WriteElementExtensions(System.Xml.XmlWriter writer, string version) { } + } + public partial class XmlSyndicationContent : System.ServiceModel.Syndication.SyndicationContent + { + protected XmlSyndicationContent(System.ServiceModel.Syndication.XmlSyndicationContent source) { } + public XmlSyndicationContent(string type, object dataContractExtension, System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { } + public XmlSyndicationContent(string type, object xmlSerializerExtension, System.Xml.Serialization.XmlSerializer serializer) { } + public XmlSyndicationContent(string type, System.ServiceModel.Syndication.SyndicationElementExtension extension) { } + public XmlSyndicationContent(System.Xml.XmlReader reader) { } + public System.ServiceModel.Syndication.SyndicationElementExtension Extension { get { throw null; } } + public override string Type { get { throw null; } } + public override System.ServiceModel.Syndication.SyndicationContent Clone() { throw null; } + public System.Xml.XmlDictionaryReader GetReaderAtContent() { throw null; } + public TContent ReadContent() { throw null; } + public TContent ReadContent(System.Runtime.Serialization.XmlObjectSerializer dataContractSerializer) { throw null; } + public TContent ReadContent(System.Xml.Serialization.XmlSerializer serializer) { throw null; } + protected override void WriteContentsTo(System.Xml.XmlWriter writer) { } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/Configurations.props b/external/corefx/src/System.ServiceModel.Syndication/src/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/Resources/Strings.resx.REMOVED.git-id b/external/corefx/src/System.ServiceModel.Syndication/src/Resources/Strings.resx.REMOVED.git-id new file mode 100644 index 0000000000..f3c6ad29e0 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/Resources/Strings.resx.REMOVED.git-id @@ -0,0 +1 @@ +5534250e892af7b6d8156f5b934427eb38bf7d79 \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj b/external/corefx/src/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj new file mode 100644 index 0000000000..b580434a36 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System.ServiceModel.Syndication.csproj @@ -0,0 +1,15 @@ + + + + + System.ServiceModel.Syndication + {C2AB129B-E3EC-465B-B1B7-0F7D414B1E74} + $(NoWarn);1634;1691;649 + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs new file mode 100644 index 0000000000..5e9bec3aaf --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Channels/UriGenerator.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Channels +{ + using System.Threading; + using System.Globalization; + using System.ServiceModel; + + internal class UriGenerator + { + private long _id; + private string _prefix; + + public UriGenerator() + : this("uuid") + { + } + + public UriGenerator(string scheme) + : this(scheme, ";") + { + } + + public UriGenerator(string scheme, string delimiter) + { + if (scheme == null) + throw new ArgumentException("scheme"); + //throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("scheme")); + + if (scheme.Length == 0) + throw new ArgumentException(string.Format(SR.UriGeneratorSchemeMustNotBeEmpty, "scheme")); + + _prefix = string.Concat(scheme, ":", Guid.NewGuid().ToString(), delimiter, "id="); + } + + public string Next() + { + long nextId = Interlocked.Increment(ref _id); + return _prefix + nextId.ToString(CultureInfo.InvariantCulture); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/App10Constants.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/App10Constants.cs new file mode 100644 index 0000000000..c1e8663b49 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/App10Constants.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +namespace System.ServiceModel.Syndication +{ + internal static class App10Constants + { + public const string Accept = "accept"; + public const string Categories = "categories"; + public const string Collection = "collection"; + public const string Fixed = "fixed"; + public const string Href = "href"; + public const string Namespace = "http://www.w3.org/2007/app"; + public const string Prefix = "app"; + public const string Service = "service"; + public const string Workspace = "workspace"; + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10Constants.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10Constants.cs new file mode 100644 index 0000000000..55f12e230f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10Constants.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + + +namespace System.ServiceModel.Syndication +{ + public static class Atom10Constants + { + public const string AlternateTag = "alternate"; + public const string Atom10Namespace = "http://www.w3.org/2005/Atom"; + public const string Atom10Prefix = "a10"; + public const string AtomMediaType = "application/atom+xml"; + public const string AuthorTag = "author"; + public const string CategoryTag = "category"; + public const string ContentTag = "content"; + public const string ContributorTag = "contributor"; + public const string EmailTag = "email"; + public const string EntryTag = "entry"; + public const string FeedTag = "feed"; + public const string GeneratorTag = "generator"; + public const string HrefTag = "href"; + public const string HtmlMediaType = "text/html"; + public const string HtmlType = "html"; + public const string IdTag = "id"; + public const string LabelTag = "label"; + public const string LengthTag = "length"; + public const string LinkTag = "link"; + public const string LogoTag = "logo"; + public const string NameTag = "name"; + public const string PlaintextType = "text"; + public const string PublishedTag = "published"; + public const string RelativeTag = "rel"; + public const string RightsTag = "rights"; + public const string SchemeTag = "scheme"; + public const string SelfTag = "self"; + public const string SourceFeedTag = "source"; + public const string SourceTag = "src"; + public const string SpecificationLink = "http://atompub.org/2005/08/17/draft-ietf-atompub-format-11.html"; + public const string SubtitleTag = "subtitle"; + public const string SummaryTag = "summary"; + public const string TermTag = "term"; + public const string TitleTag = "title"; + public const string TypeTag = "type"; + public const string UpdatedTag = "updated"; + public const string UriTag = "uri"; + public const string XHtmlMediaType = "application/xhtml+xml"; + public const string XHtmlType = "xhtml"; + public const string XmlMediaType = "text/xml"; + public const string IconTag = "icon"; + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs new file mode 100644 index 0000000000..177f84ba53 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10FeedFormatter.cs @@ -0,0 +1,1401 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Globalization; + using System.Runtime.CompilerServices; + using System.ServiceModel.Channels; + using System.Threading; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Serialization; + + [XmlRoot(ElementName = Atom10Constants.FeedTag, Namespace = Atom10Constants.Atom10Namespace)] + public class Atom10FeedFormatter : SyndicationFeedFormatter + { + internal static readonly TimeSpan zeroOffset = new TimeSpan(0, 0, 0); + internal const string XmlNs = "http://www.w3.org/XML/1998/namespace"; + internal const string XmlNsNs = "http://www.w3.org/2000/xmlns/"; + private static readonly XmlQualifiedName s_atom10Href = new XmlQualifiedName(Atom10Constants.HrefTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Label = new XmlQualifiedName(Atom10Constants.LabelTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Length = new XmlQualifiedName(Atom10Constants.LengthTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Relative = new XmlQualifiedName(Atom10Constants.RelativeTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Scheme = new XmlQualifiedName(Atom10Constants.SchemeTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Term = new XmlQualifiedName(Atom10Constants.TermTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Title = new XmlQualifiedName(Atom10Constants.TitleTag, string.Empty); + private static readonly XmlQualifiedName s_atom10Type = new XmlQualifiedName(Atom10Constants.TypeTag, string.Empty); + private static readonly UriGenerator s_idGenerator = new UriGenerator(); + private const string Rfc3339LocalDateTimeFormat = "yyyy-MM-ddTHH:mm:sszzz"; + private const string Rfc3339UTCDateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ"; + private Type _feedType; + private int _maxExtensionSize; + private bool _preserveAttributeExtensions; + private bool _preserveElementExtensions; + + //Custom parsing + // value, localname , ns , result + public Func stringParser = DefaultStringParser; + public Func dateParser = DefaultDateFromString; + public Func uriParser = DefaultUriParser; + + private static string DefaultStringParser(string value, string localName, string ns) + { + return value; + } + + private static Uri DefaultUriParser(string value, UriKind kind, string localName, string ns) + { + return new Uri(value, kind); + } + + public Atom10FeedFormatter() + : this(typeof(SyndicationFeed)) + { + } + + public Atom10FeedFormatter(Type feedTypeToCreate) + : base() + { + if (feedTypeToCreate == null) + { + throw new ArgumentException(nameof(feedTypeToCreate)); + } + if (!typeof(SyndicationFeed).IsAssignableFrom(feedTypeToCreate)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(feedTypeToCreate), nameof(SyndicationFeed))); + } + _maxExtensionSize = int.MaxValue; + _preserveAttributeExtensions = _preserveElementExtensions = true; + _feedType = feedTypeToCreate; + } + + public Atom10FeedFormatter(SyndicationFeed feedToWrite) + : base(feedToWrite) + { + // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class + _maxExtensionSize = int.MaxValue; + _preserveAttributeExtensions = _preserveElementExtensions = true; + _feedType = feedToWrite.GetType(); + } + + public bool PreserveAttributeExtensions + { + get { return _preserveAttributeExtensions; } + set { _preserveAttributeExtensions = value; } + } + + public bool PreserveElementExtensions + { + get { return _preserveElementExtensions; } + set { _preserveElementExtensions = value; } + } + + public override string Version + { + get { return SyndicationVersions.Atom10; } + } + + protected Type FeedType + { + get + { + return _feedType; + } + } + + public override bool CanRead(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + return reader.IsStartElement(Atom10Constants.FeedTag, Atom10Constants.Atom10Namespace); + } + + public override async Task ReadFromAsync(XmlReader reader, CancellationToken ct) + { + if (!CanRead(reader)) + { + throw new XmlException(string.Format(SR.UnknownFeedXml, reader.LocalName, reader.NamespaceURI)); + } + + SetFeed(CreateFeedInstance()); + await ReadFeedFromAsync(XmlReaderWrapper.CreateFromReader(reader), this.Feed, false); + } + + public override async Task WriteToAsync(XmlWriter writer, CancellationToken ct) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(Atom10Constants.FeedTag, Atom10Constants.Atom10Namespace); + await WriteFeedAsync(writer); + await writer.WriteEndElementAsync(); + } + + internal static async Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category, string version, bool preserveAttributeExtensions, bool preserveElementExtensions, int _maxExtensionSize) + { + await MoveToStartElementAsync(reader); + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string value = await reader.GetValueAsync(); + bool notHandled = false; + + if (reader.NamespaceURI == string.Empty) + { + switch (reader.LocalName) + { + case Atom10Constants.TermTag: + category.Name = value; + break; + + case Atom10Constants.SchemeTag: + category.Scheme = value; + break; + + case Atom10Constants.LabelTag: + category.Label = value; + break; + + default: + notHandled = true; + break; + } + } + else + { + notHandled = true; + } + + if (notHandled) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + + if (!TryParseAttribute(name, ns, value, category, version)) + { + if (preserveAttributeExtensions) + { + category.AttributeExtensions.Add(new XmlQualifiedName(name, ns), value); + } + } + } + } + } + + if (!isEmpty) + { + await reader.ReadStartElementAsync(); + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + try + { + while (await reader.IsStartElementAsync()) + { + if (TryParseElement(reader, category, version)) + { + continue; + } + else if (!preserveElementExtensions) + { + await reader.SkipAsync(); + } + else + { + var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize); + buffer = tuple.Item1; + extWriter = tuple.Item2; + } + } + + LoadElementExtensions(buffer, extWriter, category); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + + await reader.ReadEndElementAsync(); + } + else + { + await reader.ReadStartElementAsync(); + } + + return category; + } + + internal Task ReadTextContentFromAsync(XmlReaderWrapper reader, string context, bool preserveAttributeExtensions) + { + string type = reader.GetAttribute(Atom10Constants.TypeTag); + return ReadTextContentFromHelperAsync(reader, type, context, preserveAttributeExtensions); + } + + internal static async Task WriteCategoryAsync(XmlWriter writer, SyndicationCategory category, string version) + { + await writer.WriteStartElementAsync(Atom10Constants.CategoryTag, Atom10Constants.Atom10Namespace); + await WriteAttributeExtensionsAsync(writer, category, version); + string categoryName = category.Name ?? string.Empty; + if (!category.AttributeExtensions.ContainsKey(s_atom10Term)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.TermTag, categoryName); + } + + if (!string.IsNullOrEmpty(category.Label) && !category.AttributeExtensions.ContainsKey(s_atom10Label)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.LabelTag, category.Label); + } + + if (!string.IsNullOrEmpty(category.Scheme) && !category.AttributeExtensions.ContainsKey(s_atom10Scheme)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.SchemeTag, category.Scheme); + } + + await WriteElementExtensionsAsync(writer, category, version); + await writer.WriteEndElementAsync(); + } + + internal async Task ReadItemFromAsync(XmlReaderWrapper reader, SyndicationItem result) + { + await ReadItemFromAsync(reader, result, null); + } + + internal async Task TryParseFeedElementFromAsync(XmlReaderWrapper reader, SyndicationFeed result) + { + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + return false; + } + + string name = reader.LocalName; + string ns = reader.NamespaceURI; + + if (ns == Atom10Constants.Atom10Namespace) + { + switch (name) + { + case Atom10Constants.AuthorTag: + result.Authors.Add(await ReadPersonFromAsync(reader, result)); + break; + case Atom10Constants.CategoryTag: + result.Categories.Add(await ReadCategoryFromAsync(reader, result)); + break; + case Atom10Constants.ContributorTag: + result.Contributors.Add(await ReadPersonFromAsync(reader, result)); + break; + case Atom10Constants.GeneratorTag: + result.Generator = stringParser(await reader.ReadElementStringAsync(), Atom10Constants.GeneratorTag, ns); + break; + case Atom10Constants.IdTag: + result.Id = stringParser(await reader.ReadElementStringAsync(), Atom10Constants.IdTag, ns); + break; + case Atom10Constants.LinkTag: + result.Links.Add(await ReadLinkFromAsync(reader, result)); + break; + case Atom10Constants.LogoTag: + result.ImageUrl = uriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, Atom10Constants.LogoTag, ns); //new Uri(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute); + break; + case Atom10Constants.RightsTag: + result.Copyright = await ReadTextContentFromAsync(reader, "//atom:feed/atom:rights[@type]"); + break; + case Atom10Constants.SubtitleTag: + result.Description = await ReadTextContentFromAsync(reader, "//atom:feed/atom:subtitle[@type]"); + break; + case Atom10Constants.TitleTag: + result.Title = await ReadTextContentFromAsync(reader, "//atom:feed/atom:title[@type]"); + break; + case Atom10Constants.UpdatedTag: + await reader.ReadStartElementAsync(); + result.LastUpdatedTime = dateParser(await reader.ReadStringAsync(), Atom10Constants.UpdatedTag, ns); + await reader.ReadEndElementAsync(); + break; + case Atom10Constants.IconTag: + result.IconImage = uriParser(await reader.ReadElementStringAsync(), UriKind.RelativeOrAbsolute, Atom10Constants.IconTag, ns); + break; + default: + return false; + } + + return true; + } + + return false; + } + + internal async Task TryParseItemElementFromAsync(XmlReaderWrapper reader, SyndicationItem result) + { + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + return false; + } + + string name = reader.LocalName; + string ns = reader.NamespaceURI; + + if (ns == Atom10Constants.Atom10Namespace) + { + switch (name) + { + case Atom10Constants.AuthorTag: + result.Authors.Add(await ReadPersonFromAsync(reader, result)); + break; + case Atom10Constants.CategoryTag: + result.Categories.Add(await ReadCategoryFromAsync(reader, result)); + break; + case Atom10Constants.ContentTag: + result.Content = await ReadContentFromAsync(reader, result); + break; + case Atom10Constants.ContributorTag: + result.Contributors.Add(await ReadPersonFromAsync(reader, result)); + break; + case Atom10Constants.IdTag: + result.Id = stringParser(await reader.ReadElementStringAsync(), Atom10Constants.IdTag, ns); + break; + case Atom10Constants.LinkTag: + result.Links.Add(await ReadLinkFromAsync(reader, result)); + break; + case Atom10Constants.PublishedTag: + await reader.ReadStartElementAsync(); + result.PublishDate = dateParser(await reader.ReadStringAsync(), Atom10Constants.UpdatedTag, ns); + await reader.ReadEndElementAsync(); + break; + case Atom10Constants.RightsTag: + result.Copyright = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:rights[@type]"); + break; + case Atom10Constants.SourceFeedTag: + await reader.ReadStartElementAsync(); + result.SourceFeed = await ReadFeedFromAsync(reader, new SyndicationFeed(), true); // isSourceFeed + await reader.ReadEndElementAsync(); + break; + case Atom10Constants.SummaryTag: + result.Summary = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:summary[@type]"); + break; + case Atom10Constants.TitleTag: + result.Title = await ReadTextContentFromAsync(reader, "//atom:feed/atom:entry/atom:title[@type]"); + break; + case Atom10Constants.UpdatedTag: + await reader.ReadStartElementAsync(); + result.LastUpdatedTime = dateParser(await reader.ReadStringAsync(), Atom10Constants.UpdatedTag, ns); + await reader.ReadEndElementAsync(); + break; + default: + return false; + } + + return true; + } + + return false; + } + + internal Task WriteContentToAsync(XmlWriter writer, string elementName, SyndicationContent content) + { + if (content != null) + { + return content.WriteToAsync(writer, elementName, Atom10Constants.Atom10Namespace); + } + return Task.CompletedTask; + } + + internal async Task WriteElementAsync(XmlWriter writer, string elementName, string value) + { + if (value != null) + { + await writer.WriteElementStringAsync(elementName, Atom10Constants.Atom10Namespace, value); + } + } + + internal async Task WriteFeedAuthorsToAsync(XmlWriter writer, Collection authors) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + for (int i = 0; i < authors.Count; ++i) + { + SyndicationPerson p = authors[i]; + await WritePersonToAsync(writer, p, Atom10Constants.AuthorTag); + } + } + + internal async Task WriteFeedContributorsToAsync(XmlWriter writer, Collection contributors) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + for (int i = 0; i < contributors.Count; ++i) + { + SyndicationPerson p = contributors[i]; + await WritePersonToAsync(writer, p, Atom10Constants.ContributorTag); + } + } + + internal Task WriteFeedLastUpdatedTimeToAsync(XmlWriter writer, DateTimeOffset lastUpdatedTime, bool isRequired) + { + if (lastUpdatedTime == DateTimeOffset.MinValue && isRequired) + { + lastUpdatedTime = DateTimeOffset.UtcNow; + } + + if (lastUpdatedTime != DateTimeOffset.MinValue) + { + return WriteElementAsync(writer, Atom10Constants.UpdatedTag, AsString(lastUpdatedTime)); + } + + return Task.CompletedTask; + } + + internal async Task WriteItemAuthorsToAsync(XmlWriter writer, Collection authors) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + for (int i = 0; i < authors.Count; ++i) + { + SyndicationPerson p = authors[i]; + await WritePersonToAsync(writer, p, Atom10Constants.AuthorTag); + } + } + + internal Task WriteItemContentsAsync(XmlWriter dictWriter, SyndicationItem item) + { + return WriteItemContentsAsync(dictWriter, item, null); + } + + internal async Task WriteItemContributorsToAsync(XmlWriter writer, Collection contributors) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + + for (int i = 0; i < contributors.Count; ++i) + { + SyndicationPerson p = contributors[i]; + await WritePersonToAsync(writer, p, Atom10Constants.ContributorTag); + } + } + + internal Task WriteItemLastUpdatedTimeToAsync(XmlWriter writer, DateTimeOffset lastUpdatedTime) + { + if (lastUpdatedTime == DateTimeOffset.MinValue) + { + lastUpdatedTime = DateTimeOffset.UtcNow; + } + + return writer.WriteElementStringAsync(Atom10Constants.UpdatedTag, + Atom10Constants.Atom10Namespace, + AsString(lastUpdatedTime)); + } + + internal async Task WriteLinkAsync(XmlWriter writer, SyndicationLink link, Uri baseUri) + { + await writer.WriteStartElementAsync(Atom10Constants.LinkTag, Atom10Constants.Atom10Namespace); + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, link.BaseUri); + if (baseUriToWrite != null) + { + await writer.WriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(baseUriToWrite)); + } + + await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Atom10); + if (!string.IsNullOrEmpty(link.RelationshipType) && !link.AttributeExtensions.ContainsKey(s_atom10Relative)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.RelativeTag, link.RelationshipType); + } + + if (!string.IsNullOrEmpty(link.MediaType) && !link.AttributeExtensions.ContainsKey(s_atom10Type)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.TypeTag, link.MediaType); + } + + if (!string.IsNullOrEmpty(link.Title) && !link.AttributeExtensions.ContainsKey(s_atom10Title)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.TitleTag, link.Title); + } + + if (link.Length != 0 && !link.AttributeExtensions.ContainsKey(s_atom10Length)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.LengthTag, Convert.ToString(link.Length, CultureInfo.InvariantCulture)); + } + + if (!link.AttributeExtensions.ContainsKey(s_atom10Href)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.HrefTag, FeedUtils.GetUriString(link.Uri)); + } + + await link.WriteElementExtensionsAsync(writer, SyndicationVersions.Atom10); + await writer.WriteEndElementAsync(); + } + + protected override SyndicationFeed CreateFeedInstance() + { + return SyndicationFeedFormatter.CreateFeedInstance(_feedType); + } + + protected virtual async Task ReadItemAsync(XmlReader reader, SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + SyndicationItem item = CreateItem(feed); + XmlReaderWrapper readerWrapper = XmlReaderWrapper.CreateFromReader(reader); + await ReadItemFromAsync(readerWrapper, item, feed.BaseUri); + return item; + } + + //not referenced anymore + protected virtual async Task> ReadItemsAsync(XmlReader reader, SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + NullNotAllowedCollection items = new NullNotAllowedCollection(); + XmlReaderWrapper readerWrapper = XmlReaderWrapper.CreateFromReader(reader); + + while (await readerWrapper.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace)) + { + items.Add(await ReadItemAsync(reader, feed)); + } + + return items; + } + + protected virtual async Task WriteItemAsync(XmlWriter writer, SyndicationItem item, Uri feedBaseUri) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + await writer.WriteStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace); + await WriteItemContentsAsync(writer, item, feedBaseUri); + await writer.WriteEndElementAsync(); + } + + protected virtual async Task WriteItemsAsync(XmlWriter writer, IEnumerable items, Uri feedBaseUri) + { + if (items == null) + { + return; + } + + foreach (SyndicationItem item in items) + { + await this.WriteItemAsync(writer, item, feedBaseUri); + } + } + + private async Task ReadTextContentFromHelperAsync(XmlReaderWrapper reader, string type, string context, bool preserveAttributeExtensions) + { + if (string.IsNullOrEmpty(type)) + { + type = Atom10Constants.PlaintextType; + } + + TextSyndicationContentKind kind = new TextSyndicationContentKind(); + switch (type) + { + case Atom10Constants.PlaintextType: + kind = TextSyndicationContentKind.Plaintext; + break; + case Atom10Constants.HtmlType: + kind = TextSyndicationContentKind.Html; + break; + case Atom10Constants.XHtmlType: + kind = TextSyndicationContentKind.XHtml; + break; + + throw new XmlException(string.Format(SR.Atom10SpecRequiresTextConstruct, context, type)); + } + + Dictionary attrs = null; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == Atom10Constants.TypeTag && reader.NamespaceURI == string.Empty) + { + continue; + } + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + if (preserveAttributeExtensions) + { + string value = await reader.GetValueAsync(); + if (attrs == null) + { + attrs = new Dictionary(); + } + attrs.Add(new XmlQualifiedName(name, ns), value); + } + } + } + reader.MoveToElement(); + string localName = reader.LocalName; + string nameSpace = reader.NamespaceURI; + string val = (kind == TextSyndicationContentKind.XHtml) ? await reader.ReadInnerXmlAsync() : stringParser(await reader.ReadElementStringAsync(), localName, nameSpace); // cant custom parse because its static + TextSyndicationContent result = new TextSyndicationContent(val, kind); + if (attrs != null) + { + foreach (XmlQualifiedName attr in attrs.Keys) + { + if (!FeedUtils.IsXmlns(attr.Name, attr.Namespace)) + { + result.AttributeExtensions.Add(attr, attrs[attr]); + } + } + } + return result; + } + + private string AsString(DateTimeOffset dateTime) + { + if (dateTime.Offset == zeroOffset) + { + return dateTime.ToUniversalTime().ToString(Rfc3339UTCDateTimeFormat, CultureInfo.InvariantCulture); + } + else + { + return dateTime.ToString(Rfc3339LocalDateTimeFormat, CultureInfo.InvariantCulture); + } + } + + private static DateTimeOffset DefaultDateFromString(string dateTimeString, string localName, string ns) + { + dateTimeString = dateTimeString.Trim(); + if (dateTimeString.Length < 20) + { + throw new XmlException(SR.ErrorParsingDateTime); + } + if (dateTimeString[19] == '.') + { + // remove any fractional seconds, we choose to ignore them + int i = 20; + while (dateTimeString.Length > i && char.IsDigit(dateTimeString[i])) + { + ++i; + } + dateTimeString = dateTimeString.Substring(0, 19) + dateTimeString.Substring(i); + } + DateTimeOffset localTime; + if (DateTimeOffset.TryParseExact(dateTimeString, Rfc3339LocalDateTimeFormat, + CultureInfo.InvariantCulture.DateTimeFormat, + DateTimeStyles.None, out localTime)) + { + return localTime; + } + DateTimeOffset utcTime; + if (DateTimeOffset.TryParseExact(dateTimeString, Rfc3339UTCDateTimeFormat, + CultureInfo.InvariantCulture.DateTimeFormat, + DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out utcTime)) + { + return utcTime; + } + + //throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDateTime)); + + //if imposible to parse, return default date + return new DateTimeOffset(); + } + + private Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category) + { + return ReadCategoryAsync(reader, category, this.Version, this.PreserveAttributeExtensions, this.PreserveElementExtensions, _maxExtensionSize); + } + + private Task ReadCategoryFromAsync(XmlReaderWrapper reader, SyndicationFeed feed) + + { + SyndicationCategory result = CreateCategory(feed); + return ReadCategoryAsync(reader, result); + } + + private async Task ReadCategoryFromAsync(XmlReaderWrapper reader, SyndicationItem item) + { + SyndicationCategory result = CreateCategory(item); + await ReadCategoryAsync(reader, result); + return result; + } + + private async Task ReadContentFromAsync(XmlReaderWrapper reader, SyndicationItem item) + { + await MoveToStartElementAsync(reader); + string type = reader.GetAttribute(Atom10Constants.TypeTag, string.Empty); + + SyndicationContent result; + if (TryParseContent(reader, item, type, this.Version, out result)) + { + return result; + } + + if (string.IsNullOrEmpty(type)) + { + type = Atom10Constants.PlaintextType; + } + string src = reader.GetAttribute(Atom10Constants.SourceTag, string.Empty); + + if (string.IsNullOrEmpty(src) && type != Atom10Constants.PlaintextType && type != Atom10Constants.HtmlType && type != Atom10Constants.XHtmlType) + { + return new XmlSyndicationContent(reader); + } + + if (!string.IsNullOrEmpty(src)) + { + result = new UrlSyndicationContent(new Uri(src, UriKind.RelativeOrAbsolute), type); + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == Atom10Constants.TypeTag && reader.NamespaceURI == string.Empty) + { + continue; + } + else if (reader.LocalName == Atom10Constants.SourceTag && reader.NamespaceURI == string.Empty) + { + continue; + } + else if (!FeedUtils.IsXmlns(reader.LocalName, reader.NamespaceURI)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + else + { + //result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + } + } + } + + await reader.ReadStartElementAsync(); + if (!isEmpty) + { + await reader.ReadEndElementAsync(); + } + + return result; + } + else + { + return await ReadTextContentFromHelperAsync(reader, type, "//atom:feed/atom:entry/atom:content[@type]", _preserveAttributeExtensions); + } + } + + private async Task ReadFeedFromAsync(XmlReaderWrapper reader, SyndicationFeed result, bool isSourceFeed) + { + await reader.MoveToContentAsync(); + //fix to accept non contiguous items + NullNotAllowedCollection feedItems = new NullNotAllowedCollection(); + + bool elementIsEmpty = false; + if (!isSourceFeed) + { + await MoveToStartElementAsync(reader); + elementIsEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "lang" && reader.NamespaceURI == XmlNs) + { + result.Language = await reader.GetValueAsync(); + } + else if (reader.LocalName == "base" && reader.NamespaceURI == XmlNs) + { + result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync()); + } + else + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), val); + } + } + } + } + } + await reader.ReadStartElementAsync(); + } + + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + + if (!elementIsEmpty) + { + try + { + while (await reader.IsStartElementAsync()) + { + if (await TryParseFeedElementFromAsync(reader, result)) + { + // nothing, we parsed something, great + } + else if (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace) && !isSourceFeed) + { + while (await reader.IsStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace)) + { + feedItems.Add(await ReadItemAsync(reader, result)); + } + } + else + { + if (!TryParseElement(reader, result, this.Version)) + { + if (_preserveElementExtensions) + { + if (buffer == null) + { + buffer = new XmlBuffer(_maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false); + } + else + { + await reader.SkipAsync(); + } + } + } + } + //Add all read items to the feed + result.Items = feedItems; + LoadElementExtensions(buffer, extWriter, result); + } + catch (FormatException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingFeed), e); + } + catch (ArgumentException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingFeed), e); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + } + if (!isSourceFeed) + { + await reader.ReadEndElementAsync(); // feed + } + + return result; + } + + private async Task ReadItemFromAsync(XmlReaderWrapper reader, SyndicationItem result, Uri feedBaseUri) + { + try + { + result.BaseUri = feedBaseUri; + await MoveToStartElementAsync(reader); + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (name == "base" && ns == XmlNs) + { + result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync()); + continue; + } + + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), reader.Value); + } + } + } + } + await reader.ReadStartElementAsync(); + + if (!isEmpty) + { + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + try + { + while (await reader.IsStartElementAsync()) + { + if (await TryParseItemElementFromAsync(reader, result)) + { + // nothing, we parsed something, great + } + else + { + if (!TryParseElement(reader, result, this.Version)) + { + if (_preserveElementExtensions) + { + var tuple = await CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize); + buffer = tuple.Item1; + extWriter = tuple.Item2; + } + else + { + await reader.SkipAsync(); + } + } + } + } + LoadElementExtensions(buffer, extWriter, result); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + await reader.ReadEndElementAsync(); // item + } + } + catch (FormatException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingItem), e); + } + catch (ArgumentException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingItem), e); + } + } + + private async Task ReadLinkAsync(XmlReaderWrapper reader, SyndicationLink link, Uri baseUri) + { + bool isEmpty = reader.IsEmptyElement; + string mediaType = null; + string relationship = null; + string title = null; + string lengthStr = null; + string val = null; + string ns = null; + link.BaseUri = baseUri; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + bool notHandled = false; + if (reader.LocalName == "base" && reader.NamespaceURI == XmlNs) + { + link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync()); + } + else if (reader.NamespaceURI == string.Empty) + { + switch (reader.LocalName) + { + case Atom10Constants.TypeTag: + mediaType = await reader.GetValueAsync(); + break; + case Atom10Constants.RelativeTag: + relationship = await reader.GetValueAsync(); + break; + case Atom10Constants.TitleTag: + title = await reader.GetValueAsync(); + break; + case Atom10Constants.LengthTag: + lengthStr = await reader.GetValueAsync(); + break; + case Atom10Constants.HrefTag: + val = await reader.GetValueAsync(); + ns = reader.NamespaceURI; + break; + default: + notHandled = true; + break; + } + } + else + { + notHandled = true; + } + + if (notHandled && !FeedUtils.IsXmlns(reader.LocalName, reader.NamespaceURI)) + { + if (_preserveAttributeExtensions) + { + link.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + } + } + } + + long length = 0; + if (!string.IsNullOrEmpty(lengthStr)) + { + length = Convert.ToInt64(lengthStr, CultureInfo.InvariantCulture.NumberFormat); + } + + await reader.ReadStartElementAsync(); + if (!isEmpty) + { + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + try + { + while (await reader.IsStartElementAsync()) + { + if (TryParseElement(reader, link, this.Version)) + { + continue; + } + else if (!_preserveElementExtensions) + { + await reader.SkipAsync(); + } + else + { + if (buffer == null) + { + buffer = new XmlBuffer(_maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false); + } + } + + LoadElementExtensions(buffer, extWriter, link); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + + await reader.ReadEndElementAsync(); + } + + link.Length = length; + link.MediaType = mediaType; + link.RelationshipType = relationship; + link.Title = title; + link.Uri = (val != null) ? uriParser(val, UriKind.RelativeOrAbsolute, Atom10Constants.LinkTag, ns) /*new Uri(val, UriKind.RelativeOrAbsolute)*/ : null; + } + + private async Task ReadLinkFromAsync(XmlReaderWrapper reader, SyndicationFeed feed) + { + SyndicationLink result = CreateLink(feed); + await ReadLinkAsync(reader, result, feed.BaseUri); + return result; + } + + private async Task ReadLinkFromAsync(XmlReaderWrapper reader, SyndicationItem item) + { + SyndicationLink result = CreateLink(item); + await ReadLinkAsync(reader, result, item.BaseUri); + return result; + } + + private async Task ReadPersonFromAsync(XmlReaderWrapper reader, SyndicationFeed feed) + { + SyndicationPerson result = CreatePerson(feed); + await ReadPersonFromAsync(reader, result); + return result; + } + + private async Task ReadPersonFromAsync(XmlReaderWrapper reader, SyndicationItem item) + { + SyndicationPerson result = CreatePerson(item); + await ReadPersonFromAsync(reader, result); + return result; + } + + private async Task ReadPersonFromAsync(XmlReaderWrapper reader, SyndicationPerson result) + { + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + } + } + } + + await reader.ReadStartElementAsync(); + if (!isEmpty) + { + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + try + { + while (await reader.IsStartElementAsync()) + { + string name = reader.LocalName; + string ns = reader.NamespaceURI; + bool notHandled = false; + + switch (name) + { + case Atom10Constants.NameTag: + result.Name = stringParser(await reader.ReadElementStringAsync(), Atom10Constants.NameTag, ns); + break; + case Atom10Constants.UriTag: + result.Uri = stringParser(await reader.ReadElementStringAsync(), Atom10Constants.UriTag, ns); + break; + case Atom10Constants.EmailTag: + result.Email = stringParser(await reader.ReadElementStringAsync(), Atom10Constants.EmailTag, ns); + break; + default: + notHandled = true; + break; + } + + if (notHandled && !TryParseElement(reader, result, this.Version)) + { + if (_preserveElementExtensions) + { + if (buffer == null) + { + buffer = new XmlBuffer(_maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false); + } + else + { + await reader.SkipAsync(); + } + } + } + + LoadElementExtensions(buffer, extWriter, result); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + + await reader.ReadEndElementAsync(); + } + } + + private Task ReadTextContentFromAsync(XmlReaderWrapper reader, string context) + { + return ReadTextContentFromAsync(reader, context, this.PreserveAttributeExtensions); + } + + private async Task WriteCategoriesToAsync(XmlWriter writer, Collection categories) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + for (int i = 0; i < categories.Count; ++i) + { + await WriteCategoryAsync(writer, categories[i], this.Version); + } + } + + private Task WriteFeedAsync(XmlWriter writer) + { + if (this.Feed == null) + { + throw new InvalidOperationException(SR.FeedFormatterDoesNotHaveFeed); + } + return WriteFeedToAsync(writer, this.Feed, false); // isSourceFeed + } + + private async Task WriteFeedToAsync(XmlWriter writer, SyndicationFeed feed, bool isSourceFeed) + { + if (!isSourceFeed) + { + if (!string.IsNullOrEmpty(feed.Language)) + { + await writer.WriteAttributeStringAsync("xml", "lang", XmlNs, feed.Language); + } + if (feed.BaseUri != null) + { + await writer.InternalWriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(feed.BaseUri)); + } + await WriteAttributeExtensionsAsync(writer, feed, this.Version); + } + bool isElementRequired = !isSourceFeed; + TextSyndicationContent title = feed.Title; + if (isElementRequired) + { + title = title ?? new TextSyndicationContent(string.Empty); + } + await WriteContentToAsync(writer, Atom10Constants.TitleTag, title); + await WriteContentToAsync(writer, Atom10Constants.SubtitleTag, feed.Description); + string id = feed.Id; + if (isElementRequired) + { + id = id ?? s_idGenerator.Next(); + } + await WriteElementAsync(writer, Atom10Constants.IdTag, id); + await WriteContentToAsync(writer, Atom10Constants.RightsTag, feed.Copyright); + await WriteFeedLastUpdatedTimeToAsync(writer, feed.LastUpdatedTime, isElementRequired); + await WriteCategoriesToAsync(writer, feed.Categories); + if (feed.ImageUrl != null) + { + await WriteElementAsync(writer, Atom10Constants.LogoTag, feed.ImageUrl.ToString()); + } + await WriteFeedAuthorsToAsync(writer, feed.Authors); + await WriteFeedContributorsToAsync(writer, feed.Contributors); + await WriteElementAsync(writer, Atom10Constants.GeneratorTag, feed.Generator); + + if (feed.IconImage != null) + { + await WriteElementAsync(writer, Atom10Constants.IconTag, feed.IconImage.AbsoluteUri); + } + + for (int i = 0; i < feed.Links.Count; ++i) + { + await WriteLinkAsync(writer, feed.Links[i], feed.BaseUri); + } + + await WriteElementExtensionsAsync(writer, feed, this.Version); + + if (!isSourceFeed) + { + await WriteItemsAsync(writer, feed.Items, feed.BaseUri); + } + } + + private async Task WriteItemContentsAsync(XmlWriter dictWriter, SyndicationItem item, Uri feedBaseUri) + { + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(feedBaseUri, item.BaseUri); + if (baseUriToWrite != null) + { + await dictWriter.InternalWriteAttributeStringAsync("xml", "base", XmlNs, FeedUtils.GetUriString(baseUriToWrite)); + } + await WriteAttributeExtensionsAsync(dictWriter, item, this.Version); + + string id = item.Id ?? s_idGenerator.Next(); + await WriteElementAsync(dictWriter, Atom10Constants.IdTag, id); + + TextSyndicationContent title = item.Title ?? new TextSyndicationContent(string.Empty); + await WriteContentToAsync(dictWriter, Atom10Constants.TitleTag, title); + await WriteContentToAsync(dictWriter, Atom10Constants.SummaryTag, item.Summary); + if (item.PublishDate != DateTimeOffset.MinValue) + { + await dictWriter.WriteElementStringAsync(Atom10Constants.PublishedTag, + Atom10Constants.Atom10Namespace, + AsString(item.PublishDate)); + } + await WriteItemLastUpdatedTimeToAsync(dictWriter, item.LastUpdatedTime); + await WriteItemAuthorsToAsync(dictWriter, item.Authors); + await WriteItemContributorsToAsync(dictWriter, item.Contributors); + for (int i = 0; i < item.Links.Count; ++i) + { + await WriteLinkAsync(dictWriter, item.Links[i], item.BaseUri); + } + await WriteCategoriesToAsync(dictWriter, item.Categories); + await WriteContentToAsync(dictWriter, Atom10Constants.ContentTag, item.Content); + await WriteContentToAsync(dictWriter, Atom10Constants.RightsTag, item.Copyright); + if (item.SourceFeed != null) + { + await dictWriter.WriteStartElementAsync(Atom10Constants.SourceFeedTag, Atom10Constants.Atom10Namespace); + await WriteFeedToAsync(dictWriter, item.SourceFeed, true); // isSourceFeed + await dictWriter.WriteEndElementAsync(); + } + await WriteElementExtensionsAsync(dictWriter, item, this.Version); + } + + private async Task WritePersonToAsync(XmlWriter writer, SyndicationPerson p, string elementName) + { + await writer.WriteStartElementAsync(elementName, Atom10Constants.Atom10Namespace); + await WriteAttributeExtensionsAsync(writer, p, this.Version); + await WriteElementAsync(writer, Atom10Constants.NameTag, p.Name); + if (!string.IsNullOrEmpty(p.Uri)) + { + await writer.WriteElementStringAsync(Atom10Constants.UriTag, Atom10Constants.Atom10Namespace, p.Uri); + } + if (!string.IsNullOrEmpty(p.Email)) + { + await writer.WriteElementStringAsync(Atom10Constants.EmailTag, Atom10Constants.Atom10Namespace, p.Email); + } + await WriteElementExtensionsAsync(writer, p, this.Version); + await writer.WriteEndElementAsync(); + } + } + + [XmlRoot(ElementName = Atom10Constants.FeedTag, Namespace = Atom10Constants.Atom10Namespace)] + public class Atom10FeedFormatter : Atom10FeedFormatter + where TSyndicationFeed : SyndicationFeed, new() + { + // constructors + public Atom10FeedFormatter() + : base(typeof(TSyndicationFeed)) + { + } + public Atom10FeedFormatter(TSyndicationFeed feedToWrite) + : base(feedToWrite) + { + } + + protected override SyndicationFeed CreateFeedInstance() + { + return new TSyndicationFeed(); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs new file mode 100644 index 0000000000..2e6774cc1f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Atom10ItemFormatter.cs @@ -0,0 +1,168 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +/* + * Some diagnostic lines have been commented + * + * */ + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Schema; + using System.Xml.Serialization; + + [XmlRoot(ElementName = Atom10Constants.EntryTag, Namespace = Atom10Constants.Atom10Namespace)] + public class Atom10ItemFormatter : SyndicationItemFormatter + { + private Atom10FeedFormatter _feedSerializer; + private Type _itemType; + private bool _preserveAttributeExtensions; + private bool _preserveElementExtensions; + + public Atom10ItemFormatter() + : this(typeof(SyndicationItem)) + { + } + + public Atom10ItemFormatter(Type itemTypeToCreate) + : base() + { + if (itemTypeToCreate == null) + { + throw new ArgumentNullException(nameof(itemTypeToCreate)); + } + if (!typeof(SyndicationItem).IsAssignableFrom(itemTypeToCreate)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(itemTypeToCreate), nameof(SyndicationItem))); + } + _feedSerializer = new Atom10FeedFormatter(); + _feedSerializer.PreserveAttributeExtensions = _preserveAttributeExtensions = true; + _feedSerializer.PreserveElementExtensions = _preserveElementExtensions = true; + _itemType = itemTypeToCreate; + } + + public Atom10ItemFormatter(SyndicationItem itemToWrite) + : base(itemToWrite) + { + // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class + _feedSerializer = new Atom10FeedFormatter(); + _feedSerializer.PreserveAttributeExtensions = _preserveAttributeExtensions = true; + _feedSerializer.PreserveElementExtensions = _preserveElementExtensions = true; + _itemType = itemToWrite.GetType(); + } + + public bool PreserveAttributeExtensions + { + get { return _preserveAttributeExtensions; } + set + { + _preserveAttributeExtensions = value; + _feedSerializer.PreserveAttributeExtensions = value; + } + } + + public bool PreserveElementExtensions + { + get { return _preserveElementExtensions; } + set + { + _preserveElementExtensions = value; + _feedSerializer.PreserveElementExtensions = value; + } + } + + public override string Version + { + get { return SyndicationVersions.Atom10; } + } + + protected Type ItemType + { + get + { + return _itemType; + } + } + + public override bool CanRead(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + return reader.IsStartElement(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace); + } + + public override Task ReadFromAsync(XmlReader reader) + { + if (!CanRead(reader)) + { + throw new XmlException(string.Format(SR.UnknownItemXml, reader.LocalName, reader.NamespaceURI)); + } + + return ReadItemAsync(reader); + } + + public override async Task WriteToAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(Atom10Constants.EntryTag, Atom10Constants.Atom10Namespace); + await WriteItemAsync(writer); + await writer.WriteEndElementAsync(); + } + + protected override SyndicationItem CreateItemInstance() + { + return SyndicationItemFormatter.CreateItemInstance(_itemType); + } + + private Task ReadItemAsync(XmlReader reader) + { + SetItem(CreateItemInstance()); + return _feedSerializer.ReadItemFromAsync(XmlReaderWrapper.CreateFromReader(XmlDictionaryReader.CreateDictionaryReader(reader)), this.Item); + } + + private Task WriteItemAsync(XmlWriter writer) + { + if (this.Item == null) + { + throw new InvalidOperationException(SR.ItemFormatterDoesNotHaveItem); + } + XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter(writer); + return _feedSerializer.WriteItemContentsAsync(w, this.Item); + } + } + + [XmlRoot(ElementName = Atom10Constants.EntryTag, Namespace = Atom10Constants.Atom10Namespace)] + public class Atom10ItemFormatter : Atom10ItemFormatter + where TSyndicationItem : SyndicationItem, new() + { + // constructors + public Atom10ItemFormatter() + : base(typeof(TSyndicationItem)) + { + } + public Atom10ItemFormatter(TSyndicationItem itemToWrite) + : base(itemToWrite) + { + } + + protected override SyndicationItem CreateItemInstance() + { + return new TSyndicationItem(); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs new file mode 100644 index 0000000000..a1f12f3568 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10CategoriesDocumentFormatter.cs @@ -0,0 +1,213 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Serialization; + + [XmlRoot(ElementName = App10Constants.Categories, Namespace = App10Constants.Namespace)] + public class AtomPub10CategoriesDocumentFormatter : CategoriesDocumentFormatter + { + private Type _inlineDocumentType; + private int _maxExtensionSize; + private bool _preserveAttributeExtensions; + private bool _preserveElementExtensions; + private Type _referencedDocumentType; + + public AtomPub10CategoriesDocumentFormatter() + : this(typeof(InlineCategoriesDocument), typeof(ReferencedCategoriesDocument)) + { + } + + public AtomPub10CategoriesDocumentFormatter(Type inlineDocumentType, Type referencedDocumentType) + : base() + { + if (inlineDocumentType == null) + { + throw new ArgumentNullException(nameof(inlineDocumentType)); + } + + if (!typeof(InlineCategoriesDocument).IsAssignableFrom(inlineDocumentType)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(inlineDocumentType), nameof(InlineCategoriesDocument))); + } + + if (referencedDocumentType == null) + { + throw new ArgumentNullException(nameof(referencedDocumentType)); + } + + if (!typeof(ReferencedCategoriesDocument).IsAssignableFrom(referencedDocumentType)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(referencedDocumentType), nameof(ReferencedCategoriesDocument))); + } + + _maxExtensionSize = int.MaxValue; + _preserveAttributeExtensions = true; + _preserveElementExtensions = true; + _inlineDocumentType = inlineDocumentType; + _referencedDocumentType = referencedDocumentType; + } + + public AtomPub10CategoriesDocumentFormatter(CategoriesDocument documentToWrite) + : base(documentToWrite) + { + // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class + _maxExtensionSize = int.MaxValue; + _preserveAttributeExtensions = true; + _preserveElementExtensions = true; + if (documentToWrite.IsInline) + { + _inlineDocumentType = documentToWrite.GetType(); + _referencedDocumentType = typeof(ReferencedCategoriesDocument); + } + else + { + _referencedDocumentType = documentToWrite.GetType(); + _inlineDocumentType = typeof(InlineCategoriesDocument); + } + } + + public override string Version + { + get { return App10Constants.Namespace; } + } + + public override Task CanReadAsync(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + XmlReaderWrapper wrappedReader = XmlReaderWrapper.CreateFromReader(reader); + return wrappedReader.IsStartElementAsync(App10Constants.Categories, App10Constants.Namespace); + } + + + + private Task ReadXmlAsync(XmlReaderWrapper reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + return ReadDocumentAsync(reader); + } + + private Task WriteXmlAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + if (this.Document == null) + { + throw new InvalidOperationException(SR.DocumentFormatterDoesNotHaveDocument); + } + + return WriteDocumentAsync(writer); + } + + public override async Task ReadFromAsync(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + if (!await CanReadAsync(reader)) + { + throw new XmlException(string.Format(SR.UnknownDocumentXml, reader.LocalName, reader.NamespaceURI)); + } + + await ReadDocumentAsync(XmlReaderWrapper.CreateFromReader(reader)); + } + + public override async Task WriteTo(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + if (this.Document == null) + { + throw new InvalidOperationException(SR.DocumentFormatterDoesNotHaveDocument); + } + + writer.WriteStartElement(App10Constants.Prefix, App10Constants.Categories, App10Constants.Namespace); + await WriteDocumentAsync(writer); + writer.WriteEndElement(); + } + + protected override InlineCategoriesDocument CreateInlineCategoriesDocument() + { + if (_inlineDocumentType == typeof(InlineCategoriesDocument)) + { + return new InlineCategoriesDocument(); + } + else + { + return (InlineCategoriesDocument)Activator.CreateInstance(_inlineDocumentType); + } + } + + protected override ReferencedCategoriesDocument CreateReferencedCategoriesDocument() + { + if (_referencedDocumentType == typeof(ReferencedCategoriesDocument)) + { + return new ReferencedCategoriesDocument(); + } + else + { + return (ReferencedCategoriesDocument)Activator.CreateInstance(_referencedDocumentType); + } + } + + private async Task ReadDocumentAsync(XmlReaderWrapper reader) + { + try + { + await SyndicationFeedFormatter.MoveToStartElementAsync(reader); + SetDocument(await AtomPub10ServiceDocumentFormatter.ReadCategories(reader, null, + delegate () + { + return this.CreateInlineCategoriesDocument(); + }, + + delegate () + { + return this.CreateReferencedCategoriesDocument(); + }, + this.Version, + _preserveElementExtensions, + _preserveAttributeExtensions, + _maxExtensionSize)); + } + catch (FormatException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e); + } + catch (ArgumentException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e); + } + } + + private Task WriteDocumentAsync(XmlWriter writer) + { + // declare the atom10 namespace upfront for compactness + writer.WriteAttributeString(Atom10Constants.Atom10Prefix, Atom10FeedFormatter.XmlNsNs, Atom10Constants.Atom10Namespace); + return AtomPub10ServiceDocumentFormatter.WriteCategoriesInnerXml(writer, this.Document, null, this.Version); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs new file mode 100644 index 0000000000..d114695ef2 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/AtomPub10ServiceDocumentFormatter.cs @@ -0,0 +1,791 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Schema; + using System.Xml.Serialization; + + internal delegate InlineCategoriesDocument CreateInlineCategoriesDelegate(); + internal delegate ReferencedCategoriesDocument CreateReferencedCategoriesDelegate(); + + [XmlRoot(ElementName = App10Constants.Service, Namespace = App10Constants.Namespace)] + public class AtomPub10ServiceDocumentFormatter : ServiceDocumentFormatter + { + private Type _documentType; + private int _maxExtensionSize; + private bool _preserveAttributeExtensions; + private bool _preserveElementExtensions; + + public AtomPub10ServiceDocumentFormatter() + : this(typeof(ServiceDocument)) + { + } + + public AtomPub10ServiceDocumentFormatter(Type documentTypeToCreate) + : base() + { + if (documentTypeToCreate == null) + { + throw new ArgumentNullException(nameof(documentTypeToCreate)); + } + if (!typeof(ServiceDocument).IsAssignableFrom(documentTypeToCreate)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(documentTypeToCreate), nameof(ServiceDocument))); + } + _maxExtensionSize = int.MaxValue; + _preserveAttributeExtensions = true; + _preserveElementExtensions = true; + _documentType = documentTypeToCreate; + } + + public AtomPub10ServiceDocumentFormatter(ServiceDocument documentToWrite) + : base(documentToWrite) + { + // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class + _maxExtensionSize = int.MaxValue; + _preserveAttributeExtensions = true; + _preserveElementExtensions = true; + _documentType = documentToWrite.GetType(); + } + + public override string Version + { + get { return App10Constants.Namespace; } + } + + public override Task CanReadAsync(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + XmlReaderWrapper readerWrapper = XmlReaderWrapper.CreateFromReader(reader); + return readerWrapper.IsStartElementAsync(App10Constants.Service, App10Constants.Namespace); + } + + private Task ReadXml(XmlReaderWrapper reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + return ReadDocumentAsync(reader); + } + + private Task WriteXml(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + if (this.Document == null) + { + throw new InvalidOperationException(SR.DocumentFormatterDoesNotHaveDocument); + } + + return WriteDocumentAsync(XmlWriterWrapper.CreateFromWriter(writer)); + } + + public override async Task ReadFromAsync(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + XmlReaderWrapper wrappedReader = XmlReaderWrapper.CreateFromReader(reader); + await wrappedReader.MoveToContentAsync(); + + if (!await CanReadAsync(reader)) + { + throw new XmlException(string.Format(SR.UnknownDocumentXml, reader.LocalName, reader.NamespaceURI)); + } + + await ReadDocumentAsync(wrappedReader); + } + + public override async Task WriteToAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + if (this.Document == null) + { + throw new InvalidOperationException(SR.DocumentFormatterDoesNotHaveDocument); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Service, App10Constants.Namespace); + await WriteDocumentAsync(writer); + await writer.WriteEndElementAsync(); + } + + internal static async Task ReadCategories(XmlReaderWrapper reader, Uri baseUri, CreateInlineCategoriesDelegate inlineCategoriesFactory, CreateReferencedCategoriesDelegate referencedCategoriesFactory, string version, bool preserveElementExtensions, bool preserveAttributeExtensions, int maxExtensionSize) + { + string link = reader.GetAttribute(App10Constants.Href, string.Empty); + if (string.IsNullOrEmpty(link)) + { + InlineCategoriesDocument inlineCategories = inlineCategoriesFactory(); + await ReadInlineCategoriesAsync(reader, inlineCategories, baseUri, version, preserveElementExtensions, preserveAttributeExtensions, maxExtensionSize); + return inlineCategories; + } + else + { + ReferencedCategoriesDocument referencedCategories = referencedCategoriesFactory(); + await ReadReferencedCategoriesAsync(reader, referencedCategories, baseUri, new Uri(link, UriKind.RelativeOrAbsolute), version, preserveElementExtensions, preserveAttributeExtensions, maxExtensionSize); + return referencedCategories; + } + } + + + + internal static async Task WriteCategoriesInnerXml(XmlWriter writer, CategoriesDocument categories, Uri baseUri, string version) + { + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, categories.BaseUri); + if (baseUriToWrite != null) + { + WriteXmlBase(writer, baseUriToWrite); + } + + if (!string.IsNullOrEmpty(categories.Language)) + { + WriteXmlLang(writer, categories.Language); + } + + if (categories.IsInline) + { + await WriteInlineCategoriesContentAsync(XmlWriterWrapper.CreateFromWriter(writer), (InlineCategoriesDocument)categories, version); + } + else + { + WriteReferencedCategoriesContent(writer, (ReferencedCategoriesDocument)categories, version); + } + } + + protected override ServiceDocument CreateDocumentInstance() + { + if (_documentType == typeof(ServiceDocument)) + { + return new ServiceDocument(); + } + else + { + return (ServiceDocument)Activator.CreateInstance(_documentType); + } + } + + private static async Task ReadInlineCategoriesAsync(XmlReaderWrapper reader, InlineCategoriesDocument inlineCategories, Uri baseUri, string version, bool preserveElementExtensions, bool preserveAttributeExtensions, int _maxExtensionSize) + { + inlineCategories.BaseUri = baseUri; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + inlineCategories.BaseUri = FeedUtils.CombineXmlBase(inlineCategories.BaseUri, await reader.GetValueAsync()); + } + else if (reader.LocalName == "lang" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + inlineCategories.Language = await reader.GetValueAsync(); + } + else if (reader.LocalName == App10Constants.Fixed && reader.NamespaceURI == string.Empty) + { + inlineCategories.IsFixed = (reader.Value == "yes"); + } + else if (reader.LocalName == Atom10Constants.SchemeTag && reader.NamespaceURI == string.Empty) + { + inlineCategories.Scheme = await reader.GetValueAsync(); + } + else + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, inlineCategories, version)) + { + if (preserveAttributeExtensions) + { + inlineCategories.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + } + } + } + } + + await SyndicationFeedFormatter.MoveToStartElementAsync(reader); + bool isEmptyElement = reader.IsEmptyElement; + await reader.ReadStartElementAsync(); + if (!isEmptyElement) + { + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + try + { + while (await reader.IsStartElementAsync()) + { + if (await reader.IsStartElementAsync(Atom10Constants.CategoryTag, Atom10Constants.Atom10Namespace)) + { + SyndicationCategory category = CreateCategory(inlineCategories); + await Atom10FeedFormatter.ReadCategoryAsync(reader, category, version, preserveAttributeExtensions, preserveElementExtensions, _maxExtensionSize); + if (category.Scheme == null) + { + category.Scheme = inlineCategories.Scheme; + } + + inlineCategories.Categories.Add(category); + } + else if (!TryParseElement(reader, inlineCategories, version)) + { + if (preserveElementExtensions) + { + var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize); + buffer = tuple.Item1; + extWriter = tuple.Item2; + } + else + { + await reader.SkipAsync(); + } + } + } + LoadElementExtensions(buffer, extWriter, inlineCategories); + } + finally + { + if (extWriter != null) + { + extWriter.Close(); + } + } + + await reader.ReadEndElementAsync(); + } + } + + private static async Task ReadReferencedCategoriesAsync(XmlReaderWrapper reader, ReferencedCategoriesDocument referencedCategories, Uri baseUri, Uri link, string version, bool preserveElementExtensions, bool preserveAttributeExtensions, int maxExtensionSize) + { + referencedCategories.BaseUri = baseUri; + referencedCategories.Link = link; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + referencedCategories.BaseUri = FeedUtils.CombineXmlBase(referencedCategories.BaseUri, await reader.GetValueAsync()); + } + else if (reader.LocalName == "lang" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + referencedCategories.Language = await reader.GetValueAsync(); + } + else if (reader.LocalName == App10Constants.Href && reader.NamespaceURI == string.Empty) + { + continue; + } + else + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, referencedCategories, version)) + { + if (preserveAttributeExtensions) + { + referencedCategories.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + } + } + } + } + + reader.MoveToElement(); + bool isEmptyElement = reader.IsEmptyElement; + await reader.ReadStartElementAsync(); + if (!isEmptyElement) + { + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + try + { + while (await reader.IsStartElementAsync()) + { + if (!TryParseElement(reader, referencedCategories, version)) + { + if (preserveElementExtensions) + { + var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, maxExtensionSize); + buffer = tuple.Item1; + extWriter = tuple.Item2; + } + } + } + + LoadElementExtensions(buffer, extWriter, referencedCategories); + } + finally + { + if (extWriter != null) + { + extWriter.Close(); + } + } + + await reader.ReadEndElementAsync(); + } + } + + private static async Task WriteCategoriesAsync(XmlWriter writer, CategoriesDocument categories, Uri baseUri, string version) + { + await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Categories, App10Constants.Namespace); + await WriteCategoriesInnerXml(writer, categories, baseUri, version); + await writer.WriteEndElementAsync(); + } + + private static async Task WriteInlineCategoriesContentAsync(XmlWriter writer, InlineCategoriesDocument categories, string version) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + if (!string.IsNullOrEmpty(categories.Scheme)) + { + await writer.WriteAttributeStringAsync(Atom10Constants.SchemeTag, categories.Scheme); + } + // by default, categories are not fixed + if (categories.IsFixed) + { + await writer.WriteAttributeStringAsync(App10Constants.Fixed, "yes"); + } + + await WriteAttributeExtensionsAsync(writer, categories, version); + + for (int i = 0; i < categories.Categories.Count; ++i) + { + await Atom10FeedFormatter.WriteCategoryAsync(writer, categories.Categories[i], version); + } + + await WriteElementExtensionsAsync(writer, categories, version); + } + + private static void WriteReferencedCategoriesContent(XmlWriter writer, ReferencedCategoriesDocument categories, string version) + { + if (categories.Link != null) + { + writer.WriteAttributeString(App10Constants.Href, FeedUtils.GetUriString(categories.Link)); + } + + WriteAttributeExtensionsAsync(writer, categories, version); + WriteElementExtensionsAsync(writer, categories, version); + } + + private static void WriteXmlBase(XmlWriter writer, Uri baseUri) + { + writer.WriteAttributeString("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUri)); + } + + private static void WriteXmlLang(XmlWriter writer, string lang) + { + writer.WriteAttributeString("xml", "lang", Atom10FeedFormatter.XmlNs, lang); + } + + private async Task ReadCollection(XmlReaderWrapper reader, Workspace workspace) + { + ResourceCollectionInfo result = CreateCollection(workspace); + result.BaseUri = workspace.BaseUri; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync()); + } + else if (reader.LocalName == App10Constants.Href && reader.NamespaceURI == string.Empty) + { + result.Link = new Uri(await reader.GetValueAsync(), UriKind.RelativeOrAbsolute); + } + else + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), val); + } + } + } + } + } + + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + + reader.ReadStartElement(); + try + { + while (await reader.IsStartElementAsync()) + { + if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace)) + { + result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/app:collection/atom:title[@type]", _preserveAttributeExtensions); + } + else if (await reader.IsStartElementAsync(App10Constants.Categories, App10Constants.Namespace)) + { + result.Categories.Add(await ReadCategories(reader, + result.BaseUri, + delegate () + { + return CreateInlineCategories(result); + }, + + delegate () + { + return CreateReferencedCategories(result); + }, + this.Version, + _preserveElementExtensions, + _preserveAttributeExtensions, + _maxExtensionSize)); + } + else if (await reader.IsStartElementAsync(App10Constants.Accept, App10Constants.Namespace)) + { + result.Accepts.Add(reader.ReadElementString()); + } + else if (!TryParseElement(reader, result, this.Version)) + { + if (_preserveElementExtensions) + { + if (buffer == null) + { + buffer = new XmlBuffer(_maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false); + } + else + { + reader.Skip(); + } + } + } + + LoadElementExtensions(buffer, extWriter, result); + } + finally + { + if (extWriter != null) + { + extWriter.Close(); + } + } + + reader.ReadEndElement(); + return result; + } + + private async Task ReadDocumentAsync(XmlReaderWrapper reader) + { + ServiceDocument result = CreateDocumentInstance(); + try + { + await SyndicationFeedFormatter.MoveToStartElementAsync(reader); + bool elementIsEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "lang" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + result.Language = await reader.GetValueAsync(); + } + else if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + result.BaseUri = new Uri(await reader.GetValueAsync(), UriKind.RelativeOrAbsolute); + } + else + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), val); + } + } + } + } + } + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + + await reader.ReadStartElementAsync(); + if (!elementIsEmpty) + { + try + { + while (await reader.IsStartElementAsync()) + { + if (await reader.IsStartElementAsync(App10Constants.Workspace, App10Constants.Namespace)) + { + result.Workspaces.Add(ReadWorkspace(reader, result).Result); + } + else if (!TryParseElement(reader, result, this.Version)) + { + if (_preserveElementExtensions) + { + var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize); + buffer = tuple.Item1; + extWriter = tuple.Item2; + } + else + { + await reader.SkipAsync(); + } + } + } + + LoadElementExtensions(buffer, extWriter, result); + } + finally + { + if (extWriter != null) + { + extWriter.Close(); + } + } + } + + await reader.ReadEndElementAsync(); + } + catch (FormatException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e); + } + catch (ArgumentException e) + { + new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingDocument), e); + } + + SetDocument(result); + } + + private async Task ReadWorkspace(XmlReaderWrapper reader, ServiceDocument document) + { + Workspace result = CreateWorkspace(document); + result.BaseUri = document.BaseUri; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync()); + } + else + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), val); + } + } + } + } + } + + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + await reader.ReadStartElementAsync(); + try + { + while (await reader.IsStartElementAsync()) + { + if (await reader.IsStartElementAsync(Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace)) + { + result.Title = await new Atom10FeedFormatter().ReadTextContentFromAsync(reader, "//app:service/app:workspace/atom:title[@type]", _preserveAttributeExtensions); + } + else if (await reader.IsStartElementAsync(App10Constants.Collection, App10Constants.Namespace)) + { + result.Collections.Add(ReadCollection(reader, result).Result); + } + else if (!TryParseElement(reader, result, this.Version)) + { + if (_preserveElementExtensions) + { + var tuple = await SyndicationFeedFormatter.CreateBufferIfRequiredAndWriteNodeAsync(buffer, extWriter, reader, _maxExtensionSize); + buffer = tuple.Item1; + extWriter = tuple.Item2; + } + else + { + await reader.SkipAsync(); + } + } + } + + LoadElementExtensions(buffer, extWriter, result); + } + finally + { + if (extWriter != null) + { + extWriter.Close(); + } + } + + await reader.ReadEndElementAsync(); + return result; + } + + private async Task WriteCollectionAsync(XmlWriter writer, ResourceCollectionInfo collection, Uri baseUri) + { + await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Collection, App10Constants.Namespace); + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, collection.BaseUri); + if (baseUriToWrite != null) + { + baseUri = collection.BaseUri; + WriteXmlBase(writer, baseUriToWrite); + } + + if (collection.Link != null) + { + await writer.WriteAttributeStringAsync(App10Constants.Href, FeedUtils.GetUriString(collection.Link)); + } + + await WriteAttributeExtensionsAsync(writer, collection, this.Version); + if (collection.Title != null) + { + await collection.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace); + } + + for (int i = 0; i < collection.Accepts.Count; ++i) + { + await writer.WriteElementStringAsync(App10Constants.Prefix, App10Constants.Accept, App10Constants.Namespace, collection.Accepts[i]); + } + + for (int i = 0; i < collection.Categories.Count; ++i) + { + await WriteCategoriesAsync(writer, collection.Categories[i], baseUri, this.Version); + } + + await WriteElementExtensionsAsync(writer, collection, this.Version); + await writer.WriteEndElementAsync(); + } + + private async Task WriteDocumentAsync(XmlWriter writer) + { + // declare the atom10 namespace upfront for compactness + await writer.WriteAttributeStringAsync(Atom10Constants.Atom10Prefix, Atom10FeedFormatter.XmlNsNs, Atom10Constants.Atom10Namespace); + if (!string.IsNullOrEmpty(this.Document.Language)) + { + WriteXmlLang(writer, this.Document.Language); + } + + Uri baseUri = this.Document.BaseUri; + if (baseUri != null) + { + WriteXmlBase(writer, baseUri); + } + + WriteAttributeExtensions(writer, this.Document, this.Version); + + for (int i = 0; i < this.Document.Workspaces.Count; ++i) + { + await WriteWorkspaceAsync(writer, this.Document.Workspaces[i], baseUri); + } + + await WriteElementExtensionsAsync(writer, this.Document, this.Version); + } + + private async Task WriteWorkspaceAsync(XmlWriter writer, Workspace workspace, Uri baseUri) + { + await writer.WriteStartElementAsync(App10Constants.Prefix, App10Constants.Workspace, App10Constants.Namespace); + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, workspace.BaseUri); + if (baseUriToWrite != null) + { + baseUri = workspace.BaseUri; + WriteXmlBase(writer, baseUriToWrite); + } + + WriteAttributeExtensions(writer, workspace, this.Version); + if (workspace.Title != null) + { + await workspace.Title.WriteToAsync(writer, Atom10Constants.TitleTag, Atom10Constants.Atom10Namespace); + } + + for (int i = 0; i < workspace.Collections.Count; ++i) + { + await WriteCollectionAsync(writer, workspace.Collections[i], baseUri); + } + + await WriteElementExtensionsAsync(writer, workspace, this.Version); + await writer.WriteEndElementAsync(); + } + } + + [XmlRoot(ElementName = App10Constants.Service, Namespace = App10Constants.Namespace)] + public class AtomPub10ServiceDocumentFormatter : AtomPub10ServiceDocumentFormatter + where TServiceDocument : ServiceDocument, new() + { + public AtomPub10ServiceDocumentFormatter() : + base(typeof(TServiceDocument)) + { + } + + public AtomPub10ServiceDocumentFormatter(TServiceDocument documentToWrite) + : base(documentToWrite) + { + } + + protected override ServiceDocument CreateDocumentInstance() + { + return new TServiceDocument(); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs new file mode 100644 index 0000000000..e9f74202d9 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocument.cs @@ -0,0 +1,119 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + public abstract class CategoriesDocument : IExtensibleSyndicationObject + { + private Uri _baseUri; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private string _language; + + internal CategoriesDocument() + { + } + + public Dictionary AttributeExtensions + { + get + { + return _extensions.AttributeExtensions; + } + } + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get + { + return _extensions.ElementExtensions; + } + } + + public string Language + { + get { return _language; } + set { _language = value; } + } + + internal abstract bool IsInline + { + get; + } + + public static InlineCategoriesDocument Create(Collection categories) + { + return new InlineCategoriesDocument(categories); + } + + public static InlineCategoriesDocument Create(Collection categories, bool isFixed, string scheme) + { + return new InlineCategoriesDocument(categories, isFixed, scheme); + } + + public static ReferencedCategoriesDocument Create(Uri linkToCategoriesDocument) + { + return new ReferencedCategoriesDocument(linkToCategoriesDocument); + } + + public static async Task LoadAsync(XmlReader reader) + { + AtomPub10CategoriesDocumentFormatter formatter = new AtomPub10CategoriesDocumentFormatter(); + await formatter.ReadFromAsync(reader); + return formatter.Document; + } + + public CategoriesDocumentFormatter GetFormatter() + { + return new AtomPub10CategoriesDocumentFormatter(this); + } + + public void Save(XmlWriter writer) + { + this.GetFormatter().WriteTo(writer); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReaderWrapper readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs new file mode 100644 index 0000000000..c3883c2a14 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/CategoriesDocumentFormatter.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + + public abstract class CategoriesDocumentFormatter + { + private CategoriesDocument _document; + + protected CategoriesDocumentFormatter() + { + } + protected CategoriesDocumentFormatter(CategoriesDocument documentToWrite) + { + if (documentToWrite == null) + { + throw new ArgumentNullException(nameof(documentToWrite)); + } + _document = documentToWrite; + } + + public CategoriesDocument Document + { + get { return _document; } + } + + public abstract string Version + { get; } + + public abstract Task CanReadAsync(XmlReader reader); + public abstract Task ReadFromAsync(XmlReader reader); + public abstract Task WriteTo(XmlWriter writer); + + protected virtual InlineCategoriesDocument CreateInlineCategoriesDocument() + { + return new InlineCategoriesDocument(); + } + + protected virtual ReferencedCategoriesDocument CreateReferencedCategoriesDocument() + { + return new ReferencedCategoriesDocument(); + } + + protected virtual void SetDocument(CategoriesDocument document) + { + _document = document; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs new file mode 100644 index 0000000000..c3ad0d3f41 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ExtensibleSyndicationObject.cs @@ -0,0 +1,142 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.ObjectModel; + using System.Collections.Generic; + using System.Xml; + using System.Threading.Tasks; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + internal struct ExtensibleSyndicationObject : IExtensibleSyndicationObject + { + private Dictionary _attributeExtensions; + private SyndicationElementExtensionCollection _elementExtensions; + + private ExtensibleSyndicationObject(ExtensibleSyndicationObject source) + { + if (source._attributeExtensions != null) + { + _attributeExtensions = new Dictionary(); + foreach (XmlQualifiedName key in source._attributeExtensions.Keys) + { + _attributeExtensions.Add(key, source._attributeExtensions[key]); + } + } + else + { + _attributeExtensions = null; + } + if (source._elementExtensions != null) + { + _elementExtensions = new SyndicationElementExtensionCollection(source._elementExtensions); + } + else + { + _elementExtensions = null; + } + } + + public Dictionary AttributeExtensions + { + get + { + if (_attributeExtensions == null) + { + _attributeExtensions = new Dictionary(); + } + return _attributeExtensions; + } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get + { + if (_elementExtensions == null) + { + _elementExtensions = new SyndicationElementExtensionCollection(); + } + return _elementExtensions; + } + } + + private static XmlBuffer CreateXmlBuffer(XmlDictionaryReader unparsedExtensionsReader, int maxExtensionSize) + { + XmlBuffer buffer = new XmlBuffer(maxExtensionSize); + using (XmlDictionaryWriter writer = buffer.OpenSection(unparsedExtensionsReader.Quotas)) + { + writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + while (unparsedExtensionsReader.IsStartElement()) + { + writer.WriteNode(unparsedExtensionsReader, false); + } + writer.WriteEndElement(); + } + buffer.CloseSection(); + buffer.Close(); + return buffer; + } + + internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) + { + if (readerOverUnparsedExtensions == null) + { + throw new ArgumentNullException(nameof(readerOverUnparsedExtensions)); + } + + if (maxExtensionSize < 0) + { + throw new ArgumentOutOfRangeException(nameof(maxExtensionSize)); + } + XmlDictionaryReader r = XmlDictionaryReader.CreateDictionaryReader(readerOverUnparsedExtensions); + _elementExtensions = new SyndicationElementExtensionCollection(CreateXmlBuffer(r, maxExtensionSize)); + } + + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _elementExtensions = new SyndicationElementExtensionCollection(buffer); + } + + internal async Task WriteAttributeExtensionsAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + if (_attributeExtensions != null) + { + foreach (XmlQualifiedName qname in _attributeExtensions.Keys) + { + string value = _attributeExtensions[qname]; + await writer.WriteAttributeStringAsync(qname.Name, qname.Namespace, value); + } + } + } + + internal async Task WriteElementExtensionsAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + if (_elementExtensions != null) + { + await _elementExtensions.WriteToAsync(writer); + } + } + + public ExtensibleSyndicationObject Clone() + { + return new ExtensibleSyndicationObject(this); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/FeedUtils.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/FeedUtils.cs new file mode 100644 index 0000000000..51ac061848 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/FeedUtils.cs @@ -0,0 +1,144 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.ObjectModel; + using System.Globalization; + using System.Xml; + + internal static class FeedUtils + { + public static string AddLineInfo(XmlReader reader, string error) + { + IXmlLineInfo lineInfo = reader as IXmlLineInfo; + if (lineInfo != null && lineInfo.HasLineInfo()) + { + error = string.Format(CultureInfo.InvariantCulture, "{0} {1}", string.Format(SR.ErrorInLine, lineInfo.LineNumber, lineInfo.LinePosition), error); + } + return error; + } + + static internal Collection CloneCategories(Collection categories) + { + if (categories == null) + { + return null; + } + Collection result = new NullNotAllowedCollection(); + for (int i = 0; i < categories.Count; ++i) + { + result.Add(categories[i].Clone()); + } + return result; + } + + static internal Collection CloneLinks(Collection links) + { + if (links == null) + { + return null; + } + Collection result = new NullNotAllowedCollection(); + for (int i = 0; i < links.Count; ++i) + { + result.Add(links[i].Clone()); + } + return result; + } + + static internal Collection ClonePersons(Collection persons) + { + if (persons == null) + { + return null; + } + Collection result = new NullNotAllowedCollection(); + for (int i = 0; i < persons.Count; ++i) + { + result.Add(persons[i].Clone()); + } + return result; + } + + static internal TextSyndicationContent CloneTextContent(TextSyndicationContent content) + { + if (content == null) + { + return null; + } + return (TextSyndicationContent)(content.Clone()); + } + + internal static Uri CombineXmlBase(Uri rootBase, string newBase) + { + if (string.IsNullOrEmpty(newBase)) + { + return rootBase; + } + + Uri newBaseUri = new Uri(newBase, UriKind.RelativeOrAbsolute); + if (rootBase == null || newBaseUri.IsAbsoluteUri) + { + return newBaseUri; + } + + return new Uri(rootBase, newBase); + } + + internal static Uri GetBaseUriToWrite(Uri rootBase, Uri currentBase) + { + Uri uriToWrite; + if (rootBase == currentBase || currentBase == null) + { + uriToWrite = null; + } + else if (rootBase == null) + { + uriToWrite = currentBase; + } + else + { + // rootBase != currentBase and both are not null + // Write the relative base if possible + if (rootBase.IsAbsoluteUri && currentBase.IsAbsoluteUri && rootBase.IsBaseOf(currentBase)) + { + uriToWrite = rootBase.MakeRelativeUri(currentBase); + } + else + { + uriToWrite = currentBase; + } + } + return uriToWrite; + } + + static internal string GetUriString(Uri uri) + { + if (uri == null) + { + return null; + } + if (uri.IsAbsoluteUri) + { + return uri.AbsoluteUri; + } + else + { + return uri.ToString(); + } + } + + static internal bool IsXmlns(string name, string ns) + { + return name == "xmlns" || ns == "http://www.w3.org/2000/xmlns/"; + } + + internal static bool IsXmlSchemaType(string name, string ns) + { + return name == "type" && ns == "http://www.w3.org/2001/XMLSchema-instance"; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/IExtensibleSyndicationObject.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/IExtensibleSyndicationObject.cs new file mode 100644 index 0000000000..cc1f32f82f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/IExtensibleSyndicationObject.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System.Collections.Generic; + using System.Xml; + + internal interface IExtensibleSyndicationObject + { + Dictionary AttributeExtensions + { get; } + SyndicationElementExtensionCollection ElementExtensions + { get; } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs new file mode 100644 index 0000000000..48cbb9ce60 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/InlineCategoriesDocument.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.CompilerServices; + + public class InlineCategoriesDocument : CategoriesDocument + { + private Collection _categories; + private bool _isFixed; + private string _scheme; + + public InlineCategoriesDocument() + { + } + + public InlineCategoriesDocument(IEnumerable categories) + : this(categories, false, null) + { + } + + public InlineCategoriesDocument(IEnumerable categories, bool isFixed, string scheme) + { + if (categories != null) + { + _categories = new NullNotAllowedCollection(); + foreach (SyndicationCategory category in categories) + { + _categories.Add(category); + } + } + _isFixed = isFixed; + _scheme = scheme; + } + + public Collection Categories + { + get + { + if (_categories == null) + { + _categories = new NullNotAllowedCollection(); + } + return _categories; + } + } + + public bool IsFixed + { + get { return _isFixed; } + set { _isFixed = value; } + } + + public string Scheme + { + get { return _scheme; } + set { _scheme = value; } + } + + internal override bool IsInline + { + get { return true; } + } + + internal protected virtual SyndicationCategory CreateCategory() + { + return new SyndicationCategory(); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/NullNotAllowedCollection.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/NullNotAllowedCollection.cs new file mode 100644 index 0000000000..420d089816 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/NullNotAllowedCollection.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.ObjectModel; + + internal class NullNotAllowedCollection : Collection + where TCollectionItem : class + { + public NullNotAllowedCollection() + : base() + { + } + + protected override void InsertItem(int index, TCollectionItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + base.InsertItem(index, item); + } + + protected override void SetItem(int index, TCollectionItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + base.SetItem(index, item); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs new file mode 100644 index 0000000000..75686a2f30 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ReferencedCategoriesDocument.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Runtime.CompilerServices; + + public class ReferencedCategoriesDocument : CategoriesDocument + { + private Uri _link; + + public ReferencedCategoriesDocument() + { + } + + public ReferencedCategoriesDocument(Uri link) + : base() + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + _link = link; + } + + public Uri Link + { + get { return _link; } + set { _link = value; } + } + + internal override bool IsInline + { + get { return false; } + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs new file mode 100644 index 0000000000..33605efe0a --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ResourceCollectionInfo.cs @@ -0,0 +1,182 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + public class ResourceCollectionInfo : IExtensibleSyndicationObject + { + private static IEnumerable s_singleEmptyAccept; + private Collection _accepts; + private Uri _baseUri; + private Collection _categories; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private Uri _link; + private TextSyndicationContent _title; + + public ResourceCollectionInfo() + { + } + + public ResourceCollectionInfo(string title, Uri link) + : this((title == null) ? null : new TextSyndicationContent(title), link) + { + } + + public ResourceCollectionInfo(TextSyndicationContent title, Uri link) + : this(title, link, null, null) + { + } + + public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable categories, bool allowsNewEntries) + : this(title, link, categories, (allowsNewEntries) ? null : CreateSingleEmptyAccept()) + { + } + + public ResourceCollectionInfo(TextSyndicationContent title, Uri link, IEnumerable categories, IEnumerable accepts) + { + if (title == null) + { + throw new ArgumentNullException(nameof(title)); + } + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + _title = title; + _link = link; + if (categories != null) + { + _categories = new NullNotAllowedCollection(); + foreach (CategoriesDocument category in categories) + { + _categories.Add(category); + } + } + if (accepts != null) + { + _accepts = new NullNotAllowedCollection(); + foreach (string accept in accepts) + { + _accepts.Add(accept); + } + } + } + + public Collection Accepts + { + get + { + if (_accepts == null) + { + _accepts = new NullNotAllowedCollection(); + } + return _accepts; + } + } + + public Dictionary AttributeExtensions + { + get + { + return _extensions.AttributeExtensions; + } + } + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public Collection Categories + { + get + { + if (_categories == null) + { + _categories = new NullNotAllowedCollection(); + } + return _categories; + } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get + { + return _extensions.ElementExtensions; + } + } + + public Uri Link + { + get { return _link; } + set { _link = value; } + } + + public TextSyndicationContent Title + { + get { return _title; } + set { _title = value; } + } + + protected internal virtual InlineCategoriesDocument CreateInlineCategoriesDocument() + { + return new InlineCategoriesDocument(); + } + + protected internal virtual ReferencedCategoriesDocument CreateReferencedCategoriesDocument() + { + return new ReferencedCategoriesDocument(); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReaderWrapper readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + + private static IEnumerable CreateSingleEmptyAccept() + { + if (s_singleEmptyAccept == null) + { + List tmp = new List(1); + tmp.Add(string.Empty); + s_singleEmptyAccept = tmp.AsReadOnly(); + } + return s_singleEmptyAccept; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20Constants.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20Constants.cs new file mode 100644 index 0000000000..a811e7ec76 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20Constants.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + internal static class Rss20Constants + { + public const string AuthorTag = "author"; + public const string CategoryTag = "category"; + public const string ChannelTag = "channel"; + public const string CopyrightTag = "copyright"; + public const string DescriptionTag = "description"; + public const string DomainTag = "domain"; + public const string EnclosureTag = "enclosure"; + public const string ExtensionWrapperTag = "extensionWrapper"; + public const string GeneratorTag = "generator"; + public const string GuidTag = "guid"; + public const string ImageTag = "image"; + public const string IsPermaLinkTag = "isPermaLink"; + public const string ItemTag = "item"; + public const string LanguageTag = "language"; + public const string LastBuildDateTag = "lastBuildDate"; + public const string LengthTag = "length"; + public const string LinkTag = "link"; + public const string ManagingEditorTag = "managingEditor"; + public const string PubDateTag = "pubDate"; + public const string Rss20Namespace = ""; + public const string RssTag = "rss"; + public const string SourceTag = "source"; + public const string SpecificationLink = "http://blogs.law.harvard.edu/tech/rss"; + public const string TitleTag = "title"; + public const string TypeTag = "type"; + public const string UrlTag = "url"; + public const string Version = "2.0"; + public const string VersionTag = "version"; + public const string DocumentationTag = "docs"; + public const string TimeToLiveTag = "ttl"; + public const string TextInputTag = "textInput"; + public const string SkipHoursTag = "skipHours"; + public const string SkipDaysTag = "skipDays"; + public const string HourTag = "hour"; + public const string DayTag = "day"; + public const string NameTag = "name"; + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs new file mode 100644 index 0000000000..c5fdcb189b --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20FeedFormatter.cs @@ -0,0 +1,1659 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; + using System.Globalization; + using System.Text; + using System.Threading; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Schema; + using System.Xml.Serialization; + + + [XmlRoot(ElementName = Rss20Constants.RssTag, Namespace = Rss20Constants.Rss20Namespace)] + public class Rss20FeedFormatter : SyndicationFeedFormatter + { + private static readonly XmlQualifiedName s_rss20Domain = new XmlQualifiedName(Rss20Constants.DomainTag, string.Empty); + private static readonly XmlQualifiedName s_rss20Length = new XmlQualifiedName(Rss20Constants.LengthTag, string.Empty); + private static readonly XmlQualifiedName s_rss20Type = new XmlQualifiedName(Rss20Constants.TypeTag, string.Empty); + private static readonly XmlQualifiedName s_rss20Url = new XmlQualifiedName(Rss20Constants.UrlTag, string.Empty); + private static List s_acceptedDays = new List { "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" }; + private const string Rfc822OutputLocalDateTimeFormat = "ddd, dd MMM yyyy HH:mm:ss zzz"; + private const string Rfc822OutputUtcDateTimeFormat = "ddd, dd MMM yyyy HH:mm:ss Z"; + + private Atom10FeedFormatter _atomSerializer; + private Type _feedType; + private int _maxExtensionSize; + private bool _preserveAttributeExtensions; + private bool _preserveElementExtensions; + private bool _serializeExtensionsAsAtom; + + //Custom Parsers + // value, localname , ns , result + public Func StringParser { get; set; } = DefaultStringParser; + public Func DateParser { get; set; } = DefaultDateParser; + public Func UriParser { get; set; } = DefaultUriParser; + + static private string DefaultStringParser(string value, string localName, string ns) + { + return value; + } + + static private Uri DefaultUriParser(string value, string localName, string ns) + { + return new Uri(value, UriKind.RelativeOrAbsolute); + } + + private async Task OnReadImage(XmlReaderWrapper reader, SyndicationFeed result) + { + await reader.ReadStartElementAsync(); + string localName = string.Empty; + + while (await reader.IsStartElementAsync()) + { + if (await reader.IsStartElementAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace)) + { + result.ImageUrl = UriParser(await reader.ReadElementStringAsync(), Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace); + } + else if (await reader.IsStartElementAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace)) + { + result.ImageLink = UriParser(await reader.ReadElementStringAsync(), Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace); + } + else if (await reader.IsStartElementAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace)) + { + result.ImageTitle = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace)); + } + } + await reader.ReadEndElementAsync(); // image + return true; + } + + public Rss20FeedFormatter() + : this(typeof(SyndicationFeed)) + { + } + + public Rss20FeedFormatter(Type feedTypeToCreate) + : base() + { + if (feedTypeToCreate == null) + { + throw new ArgumentNullException(nameof(feedTypeToCreate)); + } + if (!typeof(SyndicationFeed).IsAssignableFrom(feedTypeToCreate)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(feedTypeToCreate), nameof(SyndicationFeed))); + } + _serializeExtensionsAsAtom = true; + _maxExtensionSize = int.MaxValue; + _preserveElementExtensions = true; + _preserveAttributeExtensions = true; + _atomSerializer = new Atom10FeedFormatter(feedTypeToCreate); + _feedType = feedTypeToCreate; + } + + public Rss20FeedFormatter(SyndicationFeed feedToWrite) + : this(feedToWrite, true) + { + } + + public Rss20FeedFormatter(SyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) + : base(feedToWrite) + { + // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class + _serializeExtensionsAsAtom = serializeExtensionsAsAtom; + _maxExtensionSize = int.MaxValue; + _preserveElementExtensions = true; + _preserveAttributeExtensions = true; + _atomSerializer = new Atom10FeedFormatter(this.Feed); + _feedType = feedToWrite.GetType(); + } + + public bool PreserveAttributeExtensions + { + get { return _preserveAttributeExtensions; } + set { _preserveAttributeExtensions = value; } + } + + public bool PreserveElementExtensions + { + get { return _preserveElementExtensions; } + set { _preserveElementExtensions = value; } + } + + public bool SerializeExtensionsAsAtom + { + get { return _serializeExtensionsAsAtom; } + set { _serializeExtensionsAsAtom = value; } + } + + public override string Version + { + get { return SyndicationVersions.Rss20; } + } + + protected Type FeedType + { + get + { + return _feedType; + } + } + + public override bool CanRead(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + return reader.IsStartElement(Rss20Constants.RssTag, Rss20Constants.Rss20Namespace); + } + + public override Task ReadFromAsync(XmlReader reader, CancellationToken ct) + { + if (!CanRead(reader)) + { + throw new XmlException(string.Format(SR.UnknownFeedXml, reader.LocalName, reader.NamespaceURI)); + } + + SetFeed(CreateFeedInstance()); + return ReadXmlAsync(XmlReaderWrapper.CreateFromReader(reader), this.Feed); + } + + private Task WriteXmlAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + return WriteFeedAsync(writer); + } + + public override async Task WriteToAsync(XmlWriter writer, CancellationToken ct) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(Rss20Constants.RssTag, Rss20Constants.Rss20Namespace); + await WriteFeedAsync(writer); + await writer.WriteEndElementAsync(); + } + + protected internal override void SetFeed(SyndicationFeed feed) + { + base.SetFeed(feed); + _atomSerializer.SetFeed(this.Feed); + } + + private async Task ReadItemFromAsync(XmlReaderWrapper reader, SyndicationItem result, Uri feedBaseUri) + { + result.BaseUri = feedBaseUri; + await reader.MoveToContentAsync(); + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (name == "base" && ns == Atom10FeedFormatter.XmlNs) + { + result.BaseUri = FeedUtils.CombineXmlBase(result.BaseUri, await reader.GetValueAsync()); + continue; + } + + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val); + } + } + } + } + + await reader.ReadStartElementAsync(); + + if (!isEmpty) + { + string fallbackAlternateLink = null; + XmlDictionaryWriter extWriter = null; + bool readAlternateLink = false; + try + { + XmlBuffer buffer = null; + while (await reader.IsStartElementAsync()) + { + bool notHandled = false; + if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.NamespaceURI == Rss20Constants.Rss20Namespace) + { + switch (reader.LocalName) + { + case Rss20Constants.TitleTag: + result.Title = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace)); + break; + + case Rss20Constants.LinkTag: + result.Links.Add(await ReadAlternateLinkAsync(reader, result.BaseUri)); + readAlternateLink = true; + break; + + case Rss20Constants.DescriptionTag: + result.Summary = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace)); + break; + + case Rss20Constants.AuthorTag: + result.Authors.Add(await ReadPersonAsync(reader, result)); + break; + + case Rss20Constants.CategoryTag: + result.Categories.Add(await ReadCategoryAsync(reader, result)); + break; + + case Rss20Constants.EnclosureTag: + result.Links.Add(await ReadMediaEnclosureAsync(reader, result.BaseUri)); + break; + + case Rss20Constants.GuidTag: + { + bool isPermalink = true; + string permalinkString = reader.GetAttribute(Rss20Constants.IsPermaLinkTag, Rss20Constants.Rss20Namespace); + if (permalinkString != null && permalinkString.Equals("false", StringComparison.OrdinalIgnoreCase)) + { + isPermalink = false; + } + string localName = reader.LocalName; + string namespaceUri = reader.NamespaceURI; + result.Id = StringParser(await reader.ReadElementStringAsync(), localName, namespaceUri); + if (isPermalink) + { + fallbackAlternateLink = result.Id; + } + + break; + } + + case Rss20Constants.PubDateTag: + { + bool canReadContent = !reader.IsEmptyElement; + await reader.ReadStartElementAsync(); + if (canReadContent) + { + string str = await reader.ReadStringAsync(); + if (!string.IsNullOrEmpty(str)) + { + result.PublishDate = DateParser(str, reader.LocalName, reader.NamespaceURI); + } + + await reader.ReadEndElementAsync(); + } + + break; + } + + case Rss20Constants.SourceTag: + { + SyndicationFeed feed = new SyndicationFeed(); + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + string val = await reader.GetValueAsync(); + if (name == Rss20Constants.UrlTag && ns == Rss20Constants.Rss20Namespace) + { + feed.Links.Add(SyndicationLink.CreateSelfLink(UriParser(val, Rss20Constants.UrlTag, ns))); + } + else if (!FeedUtils.IsXmlns(name, ns)) + { + if (_preserveAttributeExtensions) + { + feed.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val); + } + } + } + } + string localName = reader.LocalName; + string namespaceUri = reader.NamespaceURI; + string feedTitle = StringParser(await reader.ReadElementStringAsync(), localName, namespaceUri); + feed.Title = new TextSyndicationContent(feedTitle); + result.SourceFeed = feed; + + break; + } + + default: + notHandled = true; + break; + } + } + else + { + notHandled = true; + } + + if (notHandled) + { + bool parsedExtension = _serializeExtensionsAsAtom && _atomSerializer.TryParseItemElementFromAsync(reader, result).Result; + + if (!parsedExtension) + { + parsedExtension = TryParseElement(reader, result, this.Version); + } + + if (!parsedExtension) + { + if (_preserveElementExtensions) + { + if (buffer == null) + { + buffer = new XmlBuffer(_maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false); + } + else + { + await reader.SkipAsync(); + } + } + } + } + + LoadElementExtensions(buffer, extWriter, result); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + + await reader.ReadEndElementAsync(); // item + + if (!readAlternateLink && fallbackAlternateLink != null) + { + result.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(fallbackAlternateLink, UriKind.RelativeOrAbsolute))); + readAlternateLink = true; + } + + // if there's no content and no alternate link set the summary as the item content + if (result.Content == null && !readAlternateLink) + { + result.Content = result.Summary; + result.Summary = null; + } + } + } + + internal Task ReadItemFromAsync(XmlReaderWrapper reader, SyndicationItem result) + { + return ReadItemFromAsync(reader, result, null); + } + + internal Task WriteItemContentsAsync(XmlWriter writer, SyndicationItem item) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + return WriteItemContentsAsync(writer, item, null); + } + + protected override SyndicationFeed CreateFeedInstance() + { + return SyndicationFeedFormatter.CreateFeedInstance(_feedType); + } + + protected virtual async Task ReadItemAsync(XmlReader reader, SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + SyndicationItem item = CreateItem(feed); + XmlReaderWrapper readerWrapper = XmlReaderWrapper.CreateFromReader(reader); + await ReadItemFromAsync(readerWrapper, item, feed.BaseUri); // delegate => ItemParser(reader,item,feed.BaseUri);// + return item; + } + + protected virtual async Task WriteItemAsync(XmlWriter writer, SyndicationItem item, Uri feedBaseUri) + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace); + await WriteItemContentsAsync(writer, item, feedBaseUri); + await writer.WriteEndElementAsync(); + } + + protected virtual async Task WriteItemsAsync(XmlWriter writer, IEnumerable items, Uri feedBaseUri) + { + if (items == null) + { + return; + } + + foreach (SyndicationItem item in items) + { + await this.WriteItemAsync(writer, item, feedBaseUri); + } + } + + private static string NormalizeTimeZone(string rfc822TimeZone, out bool isUtc) + { + isUtc = false; + // return a string in "-08:00" format + if (rfc822TimeZone[0] == '+' || rfc822TimeZone[0] == '-') + { + // the time zone is supposed to be 4 digits but some feeds omit the initial 0 + StringBuilder result = new StringBuilder(rfc822TimeZone); + if (result.Length == 4) + { + // the timezone is +/-HMM. Convert to +/-HHMM + result.Insert(1, '0'); + } + result.Insert(3, ':'); + return result.ToString(); + } + switch (rfc822TimeZone) + { + case "UT": + case "Z": + isUtc = true; + return "-00:00"; + case "GMT": + return "-00:00"; + case "A": + return "-01:00"; + case "B": + return "-02:00"; + case "C": + return "-03:00"; + case "D": + case "EDT": + return "-04:00"; + case "E": + case "EST": + case "CDT": + return "-05:00"; + case "F": + case "CST": + case "MDT": + return "-06:00"; + case "G": + case "MST": + case "PDT": + return "-07:00"; + case "H": + case "PST": + return "-08:00"; + case "I": + return "-09:00"; + case "K": + return "-10:00"; + case "L": + return "-11:00"; + case "M": + return "-12:00"; + case "N": + return "+01:00"; + case "O": + return "+02:00"; + case "P": + return "+03:00"; + case "Q": + return "+04:00"; + case "R": + return "+05:00"; + case "S": + return "+06:00"; + case "T": + return "+07:00"; + case "U": + return "+08:00"; + case "V": + return "+09:00"; + case "W": + return "+10:00"; + case "X": + return "+11:00"; + case "Y": + return "+12:00"; + default: + return ""; + } + } + + private async Task ReadSkipHoursAsync(XmlReaderWrapper reader, SyndicationFeed result) + { + await reader.ReadStartElementAsync(); + + while (await reader.IsStartElementAsync()) + { + if (reader.LocalName == Rss20Constants.HourTag) + { + string val = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.HourTag, Rss20Constants.Rss20Namespace); + int hour = int.Parse(val); + bool parsed = false; + parsed = int.TryParse(val, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out hour); + + if (parsed == false) + { + throw new ArgumentException("The number on skip hours must be an integer betwen 0 and 23."); + } + + if (hour < 0 || hour > 23) + { + throw new ArgumentException("The hour can't be lower than 0 or greater than 23."); + } + + result.SkipHours.Add(hour); + } + else + { + await reader.SkipAsync(); + } + } + + await reader.ReadEndElementAsync(); + } + + + private bool checkDay(string day) + { + if (s_acceptedDays.Contains(day.ToLower())) + { + return true; + } + + return false; + } + + private async Task ReadSkipDaysAsync(XmlReaderWrapper reader, SyndicationFeed result) + { + await reader.ReadStartElementAsync(); + + while (await reader.IsStartElementAsync()) + { + if (reader.LocalName == Rss20Constants.DayTag) + { + string day = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.DayTag, Rss20Constants.Rss20Namespace); + + //Check if the day is actually an accepted day. + if (checkDay(day)) + { + result.SkipDays.Add(day); + } + } + else + { + await reader.SkipAsync(); + } + } + + await reader.ReadEndElementAsync(); + } + + internal static void RemoveExtraWhiteSpaceAtStart(StringBuilder stringBuilder) + { + int i = 0; + while (i < stringBuilder.Length) + { + if (!char.IsWhiteSpace(stringBuilder[i])) + { + break; + } + ++i; + } + if (i > 0) + { + stringBuilder.Remove(0, i); + } + } + + private static void ReplaceMultipleWhiteSpaceWithSingleWhiteSpace(StringBuilder builder) + { + int index = 0; + int whiteSpaceStart = -1; + while (index < builder.Length) + { + if (char.IsWhiteSpace(builder[index])) + { + if (whiteSpaceStart < 0) + { + whiteSpaceStart = index; + // normalize all white spaces to be ' ' so that the date time parsing works + builder[index] = ' '; + } + } + else if (whiteSpaceStart >= 0) + { + if (index > whiteSpaceStart + 1) + { + // there are at least 2 spaces... replace by 1 + builder.Remove(whiteSpaceStart, index - whiteSpaceStart - 1); + index = whiteSpaceStart + 1; + } + whiteSpaceStart = -1; + } + ++index; + } + // we have already trimmed the start and end so there cannot be a trail of white spaces in the end + Debug.Assert(builder.Length == 0 || builder[builder.Length - 1] != ' ', "The string builder doesnt end in a white space"); + } + + private string AsString(DateTimeOffset dateTime) + { + if (dateTime.Offset == Atom10FeedFormatter.zeroOffset) + { + return dateTime.ToUniversalTime().ToString(Rfc822OutputUtcDateTimeFormat, CultureInfo.InvariantCulture); + } + else + { + StringBuilder sb = new StringBuilder(dateTime.ToString(Rfc822OutputLocalDateTimeFormat, CultureInfo.InvariantCulture)); + // the zzz in Rfc822OutputLocalDateTimeFormat makes the timezone e.g. "-08:00" but we require e.g. "-0800" without the ':' + sb.Remove(sb.Length - 3, 1); + return sb.ToString(); + } + } + + private async Task ReadAlternateLinkAsync(XmlReaderWrapper reader, Uri baseUri) + { + SyndicationLink link = new SyndicationLink(); + link.BaseUri = baseUri; + link.RelationshipType = Atom10Constants.AlternateTag; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + if (reader.LocalName == "base" && reader.NamespaceURI == Atom10FeedFormatter.XmlNs) + { + link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync()); + } + else if (!FeedUtils.IsXmlns(reader.LocalName, reader.NamespaceURI)) + { + if (this.PreserveAttributeExtensions) + { + link.AttributeExtensions.Add(new XmlQualifiedName(reader.LocalName, reader.NamespaceURI), await reader.GetValueAsync()); + } + } + } + } + string localName = reader.LocalName; + string namespaceUri = reader.NamespaceURI; + link.Uri = UriParser(await reader.ReadElementStringAsync(), localName, namespaceUri);//new Uri(uri, UriKind.RelativeOrAbsolute); + return link; + } + + private async Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationFeed feed) + { + SyndicationCategory result = CreateCategory(feed); + await ReadCategoryAsync(reader, result); + return result; + } + + private async Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationCategory category) + { + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + string val = await reader.GetValueAsync(); + if (name == Rss20Constants.DomainTag && ns == Rss20Constants.Rss20Namespace) + { + category.Scheme = val; + } + else if (!TryParseAttribute(name, ns, val, category, this.Version)) + { + if (_preserveAttributeExtensions) + { + category.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val); + } + } + } + } + + await reader.ReadStartElementAsync(Rss20Constants.CategoryTag, Rss20Constants.Rss20Namespace); + + if (!isEmpty) + { + category.Name = StringParser(await reader.ReadStringAsync(), reader.LocalName, Rss20Constants.Rss20Namespace); + await reader.ReadEndElementAsync(); + } + } + + private async Task ReadCategoryAsync(XmlReaderWrapper reader, SyndicationItem item) + { + SyndicationCategory result = CreateCategory(item); + await ReadCategoryAsync(reader, result); + return result; + } + + + private async Task ReadMediaEnclosureAsync(XmlReaderWrapper reader, Uri baseUri) + { + SyndicationLink link = new SyndicationLink(); + link.BaseUri = baseUri; + link.RelationshipType = Rss20Constants.EnclosureTag; + bool isEmptyElement = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (name == "base" && ns == Atom10FeedFormatter.XmlNs) + { + link.BaseUri = FeedUtils.CombineXmlBase(link.BaseUri, await reader.GetValueAsync()); + continue; + } + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + string val = await reader.GetValueAsync(); + if (name == Rss20Constants.UrlTag && ns == Rss20Constants.Rss20Namespace) + { + link.Uri = new Uri(val, UriKind.RelativeOrAbsolute); + } + else if (name == Rss20Constants.TypeTag && ns == Rss20Constants.Rss20Namespace) + { + link.MediaType = val; + } + else if (name == Rss20Constants.LengthTag && ns == Rss20Constants.Rss20Namespace) + { + link.Length = !string.IsNullOrEmpty(val) ? Convert.ToInt64(val, CultureInfo.InvariantCulture.NumberFormat) : 0; + } + else if (!FeedUtils.IsXmlns(name, ns)) + { + if (_preserveAttributeExtensions) + { + link.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val); + } + } + } + } + + await reader.ReadStartElementAsync(Rss20Constants.EnclosureTag, Rss20Constants.Rss20Namespace); + + if (!isEmptyElement) + { + await reader.ReadEndElementAsync(); + } + + return link; + } + + private async Task ReadPersonAsync(XmlReaderWrapper reader, SyndicationFeed feed) + { + SyndicationPerson result = CreatePerson(feed); + await ReadPersonAsync(reader, result); + return result; + } + + private async Task ReadPersonAsync(XmlReaderWrapper reader, SyndicationPerson person) + { + bool isEmpty = reader.IsEmptyElement; + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + if (FeedUtils.IsXmlns(name, ns)) + { + continue; + } + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, person, this.Version)) + { + if (_preserveAttributeExtensions) + { + person.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val); + } + } + } + } + + await reader.ReadStartElementAsync(); + if (!isEmpty) + { + string email = StringParser(await reader.ReadStringAsync(), reader.LocalName, reader.NamespaceURI); + await reader.ReadEndElementAsync(); + person.Email = email; + } + } + + private async Task ReadPersonAsync(XmlReaderWrapper reader, SyndicationItem item) + { + SyndicationPerson result = CreatePerson(item); + await ReadPersonAsync(reader, result); + return result; + } + + private bool checkTextInput(SyndicationTextInput textInput) + { + //All textInput items are required, we check if all items were instantiated. + return (textInput.Description != null && textInput.title != null && textInput.name != null && textInput.link != null); + } + + private async Task readTextInputTag(XmlReaderWrapper reader, SyndicationFeed result) + { + await reader.ReadStartElementAsync(); + + SyndicationTextInput textInput = new SyndicationTextInput(); + string val = String.Empty; + + while (await reader.IsStartElementAsync()) + { + string name = reader.LocalName; + string namespaceUri = reader.NamespaceURI; + val = StringParser(await reader.ReadElementStringAsync(), name, Rss20Constants.Rss20Namespace); + + switch (name) + { + case Rss20Constants.DescriptionTag: + textInput.Description = val; + break; + + case Rss20Constants.TitleTag: + textInput.title = val; + break; + + case Rss20Constants.LinkTag: + textInput.link = new SyndicationLink(UriParser(val, name, namespaceUri)); + break; + + case Rss20Constants.NameTag: + textInput.name = val; + break; + + default: + //ignore! + break; + } + } + + if (checkTextInput(textInput) == true) + { + result.TextInput = textInput; + } + + await reader.ReadEndElementAsync(); + } + + private async Task ReadXmlAsync(XmlReaderWrapper reader, SyndicationFeed result) + { + string baseUri = null; + await reader.MoveToContentAsync(); + + string version = reader.GetAttribute(Rss20Constants.VersionTag, Rss20Constants.Rss20Namespace); + if (version != Rss20Constants.Version) + { + throw new NotSupportedException(FeedUtils.AddLineInfo(reader, (string.Format(SR.UnsupportedRssVersion, version)))); + } + + if (reader.AttributeCount > 1) + { + string tmp = reader.GetAttribute("base", Atom10FeedFormatter.XmlNs); + if (!string.IsNullOrEmpty(tmp)) + { + baseUri = tmp; + } + } + + await reader.ReadStartElementAsync(); + await reader.MoveToContentAsync(); + + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string ns = reader.NamespaceURI; + string name = reader.LocalName; + + if (name == "base" && ns == Atom10FeedFormatter.XmlNs) + { + baseUri = await reader.GetValueAsync(); + continue; + } + + if (FeedUtils.IsXmlns(name, ns) || FeedUtils.IsXmlSchemaType(name, ns)) + { + continue; + } + + string val = await reader.GetValueAsync(); + if (!TryParseAttribute(name, ns, val, result, this.Version)) + { + if (_preserveAttributeExtensions) + { + result.AttributeExtensions.Add(new XmlQualifiedName(name, ns), val); + } + } + } + } + + if (!string.IsNullOrEmpty(baseUri)) + { + result.BaseUri = new Uri(baseUri, UriKind.RelativeOrAbsolute); + } + + bool areAllItemsRead = true; + await reader.ReadStartElementAsync(Rss20Constants.ChannelTag, Rss20Constants.Rss20Namespace); + + XmlBuffer buffer = null; + XmlDictionaryWriter extWriter = null; + NullNotAllowedCollection feedItems = new NullNotAllowedCollection(); + + try + { + while (await reader.IsStartElementAsync()) + { + bool notHandled = false; + if (await reader.MoveToContentAsync() == XmlNodeType.Element && reader.NamespaceURI == Rss20Constants.Rss20Namespace) + { + switch (reader.LocalName) + { + case Rss20Constants.TitleTag: + result.Title = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace)); + break; + + case Rss20Constants.LinkTag: + result.Links.Add(await ReadAlternateLinkAsync(reader, result.BaseUri)); + break; + + case Rss20Constants.DescriptionTag: + result.Description = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace)); + break; + + case Rss20Constants.LanguageTag: + + result.Language = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.LanguageTag, Rss20Constants.Rss20Namespace); + break; + + case Rss20Constants.CopyrightTag: + result.Copyright = new TextSyndicationContent(StringParser(await reader.ReadElementStringAsync(), Rss20Constants.CopyrightTag, Rss20Constants.Rss20Namespace)); + break; + + case Rss20Constants.ManagingEditorTag: + result.Authors.Add(await ReadPersonAsync(reader, result)); + break; + + case Rss20Constants.LastBuildDateTag: + { + bool canReadContent = !reader.IsEmptyElement; + await reader.ReadStartElementAsync(); + if (canReadContent) + { + string str = await reader.ReadStringAsync(); + + if (!string.IsNullOrEmpty(str)) + { + result.LastUpdatedTime = DateParser(str, Rss20Constants.LastBuildDateTag, reader.NamespaceURI); + } + + await reader.ReadEndElementAsync(); + } + + break; + } + + case Rss20Constants.CategoryTag: + result.Categories.Add(await ReadCategoryAsync(reader, result)); + break; + + case Rss20Constants.GeneratorTag: + result.Generator = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.GeneratorTag, Rss20Constants.Rss20Namespace); + break; + + case Rss20Constants.ImageTag: + { + await OnReadImage(reader, result); + break; + } + + case Rss20Constants.ItemTag: + { + NullNotAllowedCollection items = new NullNotAllowedCollection(); + while (await reader.IsStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace)) + { + feedItems.Add(await ReadItemAsync(reader, result)); + } + + + areAllItemsRead = true; + break; + } + + //Optional tags + case Rss20Constants.DocumentationTag: + result.Documentation = await ReadAlternateLinkAsync(reader, result.BaseUri); + break; + + case Rss20Constants.TimeToLiveTag: + string value = StringParser(await reader.ReadElementStringAsync(), Rss20Constants.TimeToLiveTag, Rss20Constants.Rss20Namespace); + int timeToLive = int.Parse(value); + result.TimeToLive = timeToLive; + break; + + case Rss20Constants.TextInputTag: + await readTextInputTag(reader, result); + break; + + case Rss20Constants.SkipHoursTag: + await ReadSkipHoursAsync(reader, result); + break; + + case Rss20Constants.SkipDaysTag: + await ReadSkipDaysAsync(reader, result); + break; + + default: + notHandled = true; + break; + } + } + else + { + notHandled = true; + } + + if (notHandled) + { + bool parsedExtension = _serializeExtensionsAsAtom && await _atomSerializer.TryParseFeedElementFromAsync(reader, result); + + if (!parsedExtension) + { + parsedExtension = TryParseElement(reader, result, this.Version); + } + + if (!parsedExtension) + { + if (_preserveElementExtensions) + { + if (buffer == null) + { + buffer = new XmlBuffer(_maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + await XmlReaderWrapper.WriteNodeAsync(extWriter, reader, false); + } + else + { + await reader.SkipAsync(); + } + } + } + + if (!areAllItemsRead) + { + break; + } + } + + //asign all read items to feed items. + result.Items = feedItems; + LoadElementExtensions(buffer, extWriter, result); + } + catch (FormatException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingFeed), e); + } + catch (ArgumentException e) + { + throw new XmlException(FeedUtils.AddLineInfo(reader, SR.ErrorParsingFeed), e); + } + finally + { + if (extWriter != null) + { + ((IDisposable)extWriter).Dispose(); + } + } + if (areAllItemsRead) + { + await reader.ReadEndElementAsync(); // channel + await reader.ReadEndElementAsync(); // rss + } + } + + private async Task WriteAlternateLinkAsync(XmlWriter writer, SyndicationLink link, Uri baseUri) + { + await writer.WriteStartElementAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace); + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, link.BaseUri); + if (baseUriToWrite != null) + { + await writer.WriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite)); + } + await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Rss20); + await writer.WriteStringAsync(FeedUtils.GetUriString(link.Uri)); + await writer.WriteEndElementAsync(); + } + + private async Task WriteCategoryAsync(XmlWriter writer, SyndicationCategory category) + { + if (category == null) + { + return; + } + await writer.WriteStartElementAsync(Rss20Constants.CategoryTag, Rss20Constants.Rss20Namespace); + await WriteAttributeExtensionsAsync(writer, category, this.Version); + if (!string.IsNullOrEmpty(category.Scheme) && !category.AttributeExtensions.ContainsKey(s_rss20Domain)) + { + await writer.WriteAttributeStringAsync(Rss20Constants.DomainTag, Rss20Constants.Rss20Namespace, category.Scheme); + } + await writer.WriteStringAsync(category.Name); + await writer.WriteEndElementAsync(); + } + + private async Task WriteFeedAsync(XmlWriter writer) + { + if (this.Feed == null) + { + throw new InvalidOperationException(SR.FeedFormatterDoesNotHaveFeed); + } + if (_serializeExtensionsAsAtom) + { + await writer.InternalWriteAttributeStringAsync("xmlns", Atom10Constants.Atom10Prefix, null, Atom10Constants.Atom10Namespace); + } + await writer.WriteAttributeStringAsync(Rss20Constants.VersionTag, Rss20Constants.Version); + await writer.WriteStartElementAsync(Rss20Constants.ChannelTag, Rss20Constants.Rss20Namespace); + if (this.Feed.BaseUri != null) + { + await writer.InternalWriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(this.Feed.BaseUri)); + } + await WriteAttributeExtensionsAsync(writer, this.Feed, this.Version); + string title = this.Feed.Title != null ? this.Feed.Title.Text : string.Empty; + await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace, title); + + SyndicationLink alternateLink = null; + for (int i = 0; i < this.Feed.Links.Count; ++i) + { + if (this.Feed.Links[i].RelationshipType == Atom10Constants.AlternateTag) + { + alternateLink = this.Feed.Links[i]; + await WriteAlternateLinkAsync(writer, alternateLink, this.Feed.BaseUri); + break; + } + } + + string description = this.Feed.Description != null ? this.Feed.Description.Text : string.Empty; + await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, description); + + if (this.Feed.Language != null) + { + await writer.WriteElementStringAsync(Rss20Constants.LanguageTag, this.Feed.Language); + } + + if (this.Feed.Copyright != null) + { + await writer.WriteElementStringAsync(Rss20Constants.CopyrightTag, Rss20Constants.Rss20Namespace, this.Feed.Copyright.Text); + } + + // if there's a single author with an email address, then serialize as the managingEditor + // else serialize the authors as Atom extensions + if ((this.Feed.Authors.Count == 1) && (this.Feed.Authors[0].Email != null)) + { + await WritePersonAsync(writer, Rss20Constants.ManagingEditorTag, this.Feed.Authors[0]); + } + else + { + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteFeedAuthorsToAsync(writer, this.Feed.Authors); + } + } + + if (this.Feed.LastUpdatedTime > DateTimeOffset.MinValue) + { + await writer.WriteStartElementAsync(Rss20Constants.LastBuildDateTag); + await writer.WriteStringAsync(AsString(this.Feed.LastUpdatedTime)); + await writer.WriteEndElementAsync(); + } + + for (int i = 0; i < this.Feed.Categories.Count; ++i) + { + await WriteCategoryAsync(writer, this.Feed.Categories[i]); + } + + if (!string.IsNullOrEmpty(this.Feed.Generator)) + { + await writer.WriteElementStringAsync(Rss20Constants.GeneratorTag, this.Feed.Generator); + } + + if (this.Feed.Contributors.Count > 0) + { + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteFeedContributorsToAsync(writer, this.Feed.Contributors); + } + } + + if (this.Feed.ImageUrl != null) + { + await writer.WriteStartElementAsync(Rss20Constants.ImageTag); + await writer.WriteElementStringAsync(Rss20Constants.UrlTag, FeedUtils.GetUriString(this.Feed.ImageUrl)); + + string imageTitle = Feed.ImageTitle == null ? title : Feed.ImageTitle.Text; + await writer.WriteElementStringAsync(Rss20Constants.TitleTag, Rss20Constants.Rss20Namespace, imageTitle); + + string imgAlternateLink = alternateLink != null ? FeedUtils.GetUriString(alternateLink.Uri) : string.Empty; + + string imageLink = Feed.ImageLink == null ? imgAlternateLink : FeedUtils.GetUriString(Feed.ImageLink); + await writer.WriteElementStringAsync(Rss20Constants.LinkTag, Rss20Constants.Rss20Namespace, imageLink); + await writer.WriteEndElementAsync(); // image + } + + //Optional spec items + //time to live + if (this.Feed.TimeToLive != 0) + { + await writer.WriteElementStringAsync(Rss20Constants.TimeToLiveTag, this.Feed.TimeToLive.ToString()); + } + + //skiphours + if (this.Feed.SkipHours.Count > 0) + { + await writer.WriteStartElementAsync(Rss20Constants.SkipHoursTag); + + foreach (int hour in this.Feed.SkipHours) + { + writer.WriteElementString(Rss20Constants.HourTag, hour.ToString()); + } + + await writer.WriteEndElementAsync(); + } + + //skipDays + if (this.Feed.SkipDays.Count > 0) + { + await writer.WriteStartElementAsync(Rss20Constants.SkipDaysTag); + + foreach (string day in this.Feed.SkipDays) + { + await writer.WriteElementStringAsync(Rss20Constants.DayTag, day); + } + + await writer.WriteEndElementAsync(); + } + + //textinput + if (this.Feed.TextInput != null) + { + await writer.WriteStartElementAsync(Rss20Constants.TextInputTag); + + await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, this.Feed.TextInput.Description); + await writer.WriteElementStringAsync(Rss20Constants.TitleTag, this.Feed.TextInput.title); + await writer.WriteElementStringAsync(Rss20Constants.LinkTag, this.Feed.TextInput.link.GetAbsoluteUri().ToString()); + await writer.WriteElementStringAsync(Rss20Constants.NameTag, this.Feed.TextInput.name); + + await writer.WriteEndElementAsync(); + } + + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteElementAsync(writer, Atom10Constants.IdTag, this.Feed.Id); + + // dont write out the 1st alternate link since that would have been written out anyway + bool isFirstAlternateLink = true; + for (int i = 0; i < this.Feed.Links.Count; ++i) + { + if (this.Feed.Links[i].RelationshipType == Atom10Constants.AlternateTag && isFirstAlternateLink) + { + isFirstAlternateLink = false; + continue; + } + await _atomSerializer.WriteLinkAsync(writer, this.Feed.Links[i], this.Feed.BaseUri); + } + } + + await WriteElementExtensionsAsync(writer, this.Feed, this.Version); + await WriteItemsAsync(writer, this.Feed.Items, this.Feed.BaseUri); + await writer.WriteEndElementAsync(); // channel + } + + private async Task WriteItemContentsAsync(XmlWriter writer, SyndicationItem item, Uri feedBaseUri) + { + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(feedBaseUri, item.BaseUri); + if (baseUriToWrite != null) + { + await writer.InternalWriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite)); + } + await WriteAttributeExtensionsAsync(writer, item, this.Version); + string guid = item.Id ?? string.Empty; + bool isPermalink = false; + SyndicationLink firstAlternateLink = null; + for (int i = 0; i < item.Links.Count; ++i) + { + if (item.Links[i].RelationshipType == Atom10Constants.AlternateTag) + { + if (firstAlternateLink == null) + { + firstAlternateLink = item.Links[i]; + } + if (guid == FeedUtils.GetUriString(item.Links[i].Uri)) + { + isPermalink = true; + break; + } + } + } + if (!string.IsNullOrEmpty(guid)) + { + await writer.WriteStartElementAsync(Rss20Constants.GuidTag); + if (isPermalink) + { + await writer.WriteAttributeStringAsync(Rss20Constants.IsPermaLinkTag, "true"); + } + else + { + await writer.WriteAttributeStringAsync(Rss20Constants.IsPermaLinkTag, "false"); + } + await writer.WriteStringAsync(guid); + await writer.WriteEndElementAsync(); + } + if (firstAlternateLink != null) + { + await WriteAlternateLinkAsync(writer, firstAlternateLink, (item.BaseUri != null ? item.BaseUri : feedBaseUri)); + } + + if (item.Authors.Count == 1 && !string.IsNullOrEmpty(item.Authors[0].Email)) + { + await WritePersonAsync(writer, Rss20Constants.AuthorTag, item.Authors[0]); + } + else + { + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteItemAuthorsToAsync(writer, item.Authors); + } + } + + for (int i = 0; i < item.Categories.Count; ++i) + { + await WriteCategoryAsync(writer, item.Categories[i]); + } + + bool serializedTitle = false; + if (item.Title != null) + { + await writer.WriteElementStringAsync(Rss20Constants.TitleTag, item.Title.Text); + serializedTitle = true; + } + + bool serializedContentAsDescription = false; + TextSyndicationContent summary = item.Summary; + if (summary == null) + { + summary = (item.Content as TextSyndicationContent); + serializedContentAsDescription = (summary != null); + } + // the spec requires the wire to have a title or a description + if (!serializedTitle && summary == null) + { + summary = new TextSyndicationContent(string.Empty); + } + if (summary != null) + { + await writer.WriteElementStringAsync(Rss20Constants.DescriptionTag, Rss20Constants.Rss20Namespace, summary.Text); + } + + if (item.SourceFeed != null) + { + await writer.WriteStartElementAsync(Rss20Constants.SourceTag, Rss20Constants.Rss20Namespace); + await WriteAttributeExtensionsAsync(writer, item.SourceFeed, this.Version); + SyndicationLink selfLink = null; + for (int i = 0; i < item.SourceFeed.Links.Count; ++i) + { + if (item.SourceFeed.Links[i].RelationshipType == Atom10Constants.SelfTag) + { + selfLink = item.SourceFeed.Links[i]; + break; + } + } + if (selfLink != null && !item.SourceFeed.AttributeExtensions.ContainsKey(s_rss20Url)) + { + await writer.WriteAttributeStringAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(selfLink.Uri)); + } + string title = (item.SourceFeed.Title != null) ? item.SourceFeed.Title.Text : string.Empty; + await writer.WriteStringAsync(title); + await writer.WriteEndElementAsync(); + } + + if (item.PublishDate > DateTimeOffset.MinValue) + { + await writer.WriteElementStringAsync(Rss20Constants.PubDateTag, Rss20Constants.Rss20Namespace, AsString(item.PublishDate)); + } + + // serialize the enclosures + SyndicationLink firstEnclosureLink = null; + bool passedFirstAlternateLink = false; + + for (int i = 0; i < item.Links.Count; ++i) + { + if (item.Links[i].RelationshipType == Rss20Constants.EnclosureTag) + { + if (firstEnclosureLink == null) + { + firstEnclosureLink = item.Links[i]; + await WriteMediaEnclosureAsync(writer, item.Links[i], item.BaseUri); + continue; + } + } + else if (item.Links[i].RelationshipType == Atom10Constants.AlternateTag) + { + if (!passedFirstAlternateLink) + { + passedFirstAlternateLink = true; + continue; + } + } + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteLinkAsync(writer, item.Links[i], item.BaseUri); + } + } + + + if (item.LastUpdatedTime > DateTimeOffset.MinValue) + { + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteItemLastUpdatedTimeToAsync(writer, item.LastUpdatedTime); + } + } + + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteContentToAsync(writer, Atom10Constants.RightsTag, item.Copyright); + } + + if (!serializedContentAsDescription) + { + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteContentToAsync(writer, Atom10Constants.ContentTag, item.Content); + } + } + + if (item.Contributors.Count > 0) + { + if (_serializeExtensionsAsAtom) + { + await _atomSerializer.WriteItemContributorsToAsync(writer, item.Contributors); + } + } + + await WriteElementExtensionsAsync(writer, item, this.Version); + } + + private async Task WriteMediaEnclosureAsync(XmlWriter writer, SyndicationLink link, Uri baseUri) + { + await writer.WriteStartElementAsync(Rss20Constants.EnclosureTag, Rss20Constants.Rss20Namespace); + Uri baseUriToWrite = FeedUtils.GetBaseUriToWrite(baseUri, link.BaseUri); + if (baseUriToWrite != null) + { + await writer.InternalWriteAttributeStringAsync("xml", "base", Atom10FeedFormatter.XmlNs, FeedUtils.GetUriString(baseUriToWrite)); + } + await link.WriteAttributeExtensionsAsync(writer, SyndicationVersions.Rss20); + if (!link.AttributeExtensions.ContainsKey(s_rss20Url)) + { + await writer.WriteAttributeStringAsync(Rss20Constants.UrlTag, Rss20Constants.Rss20Namespace, FeedUtils.GetUriString(link.Uri)); + } + if (link.MediaType != null && !link.AttributeExtensions.ContainsKey(s_rss20Type)) + { + await writer.WriteAttributeStringAsync(Rss20Constants.TypeTag, Rss20Constants.Rss20Namespace, link.MediaType); + } + if (link.Length != 0 && !link.AttributeExtensions.ContainsKey(s_rss20Length)) + { + await writer.WriteAttributeStringAsync(Rss20Constants.LengthTag, Rss20Constants.Rss20Namespace, Convert.ToString(link.Length, CultureInfo.InvariantCulture)); + } + await writer.WriteEndElementAsync(); + } + + private async Task WritePersonAsync(XmlWriter writer, string elementTag, SyndicationPerson person) + { + await writer.WriteStartElementAsync(elementTag, Rss20Constants.Rss20Namespace); + await WriteAttributeExtensionsAsync(writer, person, this.Version); + await writer.WriteStringAsync(person.Email); + await writer.WriteEndElementAsync(); + } + + private static bool OriginalDateParser(string dateTimeString, out DateTimeOffset dto) + { + StringBuilder dateTimeStringBuilder = new StringBuilder(dateTimeString.Trim()); + if (dateTimeStringBuilder.Length < 18) + { + return false; + } + + int timeZoneStartIndex; + for (timeZoneStartIndex = dateTimeStringBuilder.Length - 1; dateTimeStringBuilder[timeZoneStartIndex] != ' '; timeZoneStartIndex--) ; + timeZoneStartIndex++; + + string timeZoneSuffix = dateTimeStringBuilder.ToString().Substring(timeZoneStartIndex); + dateTimeStringBuilder.Remove(timeZoneStartIndex, dateTimeStringBuilder.Length - timeZoneStartIndex); + bool isUtc; + dateTimeStringBuilder.Append(NormalizeTimeZone(timeZoneSuffix, out isUtc)); + string wellFormattedString = dateTimeStringBuilder.ToString(); + + DateTimeOffset theTime; + string[] parseFormat = + { + "ddd, dd MMMM yyyy HH:mm:ss zzz", + "dd MMMM yyyy HH:mm:ss zzz", + "ddd, dd MMM yyyy HH:mm:ss zzz", + "dd MMM yyyy HH:mm:ss zzz", + + "ddd, dd MMMM yyyy HH:mm zzz", + "dd MMMM yyyy HH:mm zzz", + "ddd, dd MMM yyyy HH:mm zzz", + "dd MMM yyyy HH:mm zzz" + }; + + if (DateTimeOffset.TryParseExact(wellFormattedString, parseFormat, + CultureInfo.InvariantCulture.DateTimeFormat, + (isUtc ? DateTimeStyles.AdjustToUniversal : DateTimeStyles.None), out theTime)) + { + dto = theTime; + return true; + } + + return false; + } + + // Custom parsers + public static DateTimeOffset DefaultDateParser(string dateTimeString, string localName, string ns) + { + bool parsed = false; + DateTimeOffset dto; + parsed = DateTimeOffset.TryParse(dateTimeString, out dto); + if (parsed) + return dto; + + + //original parser here + parsed = OriginalDateParser(dateTimeString, out dto); + if (parsed) + return dto; + + //Impossible to parse - using a default date; + return new DateTimeOffset(); + } + } + + [XmlRoot(ElementName = Rss20Constants.RssTag, Namespace = Rss20Constants.Rss20Namespace)] + public class Rss20FeedFormatter : Rss20FeedFormatter + where TSyndicationFeed : SyndicationFeed, new() + { + // constructors + public Rss20FeedFormatter() + : base(typeof(TSyndicationFeed)) + { + } + public Rss20FeedFormatter(TSyndicationFeed feedToWrite) + : base(feedToWrite) + { + } + public Rss20FeedFormatter(TSyndicationFeed feedToWrite, bool serializeExtensionsAsAtom) + : base(feedToWrite, serializeExtensionsAsAtom) + { + } + + protected override SyndicationFeed CreateFeedInstance() + { + return new TSyndicationFeed(); + } + } + + + internal class ItemParseOptions + { + public bool readItemsAtLeastOnce; + public bool areAllItemsRead; + + public ItemParseOptions(bool readItemsAtLeastOnce, bool areAllItemsRead) + { + this.readItemsAtLeastOnce = readItemsAtLeastOnce; + this.areAllItemsRead = areAllItemsRead; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs new file mode 100644 index 0000000000..a432f7a496 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Rss20ItemFormatter.cs @@ -0,0 +1,195 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Schema; + using System.Xml.Serialization; + + + [XmlRoot(ElementName = Rss20Constants.ItemTag, Namespace = Rss20Constants.Rss20Namespace)] + public class Rss20ItemFormatter : SyndicationItemFormatter + { + private Rss20FeedFormatter _feedSerializer; + private Type _itemType; + private bool _preserveAttributeExtensions; + private bool _preserveElementExtensions; + private bool _serializeExtensionsAsAtom; + + public Rss20ItemFormatter() + : this(typeof(SyndicationItem)) + { + } + + public Rss20ItemFormatter(Type itemTypeToCreate) + : base() + { + if (itemTypeToCreate == null) + { + throw new ArgumentNullException(nameof(itemTypeToCreate)); + } + if (!typeof(SyndicationItem).IsAssignableFrom(itemTypeToCreate)) + { + throw new ArgumentException(string.Format(SR.InvalidObjectTypePassed, nameof(itemTypeToCreate), nameof(SyndicationItem))); + } + _feedSerializer = new Rss20FeedFormatter(); + _feedSerializer.PreserveAttributeExtensions = _preserveAttributeExtensions = true; + _feedSerializer.PreserveElementExtensions = _preserveElementExtensions = true; + _feedSerializer.SerializeExtensionsAsAtom = _serializeExtensionsAsAtom = true; + _itemType = itemTypeToCreate; + } + + public Rss20ItemFormatter(SyndicationItem itemToWrite) + : this(itemToWrite, true) + { + } + + public Rss20ItemFormatter(SyndicationItem itemToWrite, bool serializeExtensionsAsAtom) + : base(itemToWrite) + { + // No need to check that the parameter passed is valid - it is checked by the c'tor of the base class + _feedSerializer = new Rss20FeedFormatter(); + _feedSerializer.PreserveAttributeExtensions = _preserveAttributeExtensions = true; + _feedSerializer.PreserveElementExtensions = _preserveElementExtensions = true; + _feedSerializer.SerializeExtensionsAsAtom = _serializeExtensionsAsAtom = serializeExtensionsAsAtom; + _itemType = itemToWrite.GetType(); + } + + public bool PreserveAttributeExtensions + { + get { return _preserveAttributeExtensions; } + set + { + _preserveAttributeExtensions = value; + _feedSerializer.PreserveAttributeExtensions = value; + } + } + + public bool PreserveElementExtensions + { + get { return _preserveElementExtensions; } + set + { + _preserveElementExtensions = value; + _feedSerializer.PreserveElementExtensions = value; + } + } + + public bool SerializeExtensionsAsAtom + { + get { return _serializeExtensionsAsAtom; } + set + { + _serializeExtensionsAsAtom = value; + _feedSerializer.SerializeExtensionsAsAtom = value; + } + } + + public override string Version + { + get { return SyndicationVersions.Rss20; } + } + + protected Type ItemType + { + get + { + return _itemType; + } + } + + public override bool CanRead(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + return reader.IsStartElement(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace); + } + + + private async Task WriteXml(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + await WriteItem(writer); + } + + public override Task ReadFromAsync(XmlReader reader) + { + if (!CanRead(reader)) + { + throw new XmlException(string.Format(SR.UnknownItemXml, reader.LocalName, reader.NamespaceURI)); + } + + return ReadItemAsync(XmlReaderWrapper.CreateFromReader(reader)); + } + + public override async Task WriteToAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(Rss20Constants.ItemTag, Rss20Constants.Rss20Namespace); + await WriteItem(writer); + await writer.WriteEndElementAsync(); + } + + protected override SyndicationItem CreateItemInstance() + { + return SyndicationItemFormatter.CreateItemInstance(_itemType); + } + + private Task ReadItemAsync(XmlReaderWrapper reader) + { + SetItem(CreateItemInstance()); + return _feedSerializer.ReadItemFromAsync(XmlReaderWrapper.CreateFromReader(XmlDictionaryReader.CreateDictionaryReader(reader)), this.Item); + } + + private Task WriteItem(XmlWriter writer) + { + if (this.Item == null) + { + throw new InvalidOperationException(SR.ItemFormatterDoesNotHaveItem); + } + XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter(writer); + return _feedSerializer.WriteItemContentsAsync(w, this.Item); + } + } + + [XmlRoot(ElementName = Rss20Constants.ItemTag, Namespace = Rss20Constants.Rss20Namespace)] + public class Rss20ItemFormatter : Rss20ItemFormatter + where TSyndicationItem : SyndicationItem, new() + { + public Rss20ItemFormatter() + : base(typeof(TSyndicationItem)) + { + } + public Rss20ItemFormatter(TSyndicationItem itemToWrite) + : base(itemToWrite) + { + } + public Rss20ItemFormatter(TSyndicationItem itemToWrite, bool serializeExtensionsAsAtom) + : base(itemToWrite, serializeExtensionsAsAtom) + { + } + + protected override SyndicationItem CreateItemInstance() + { + return new TSyndicationItem(); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs new file mode 100644 index 0000000000..140800a71b --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocument.cs @@ -0,0 +1,124 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + public class ServiceDocument : IExtensibleSyndicationObject + { + private Uri _baseUri; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private string _language; + private Collection _workspaces; + + public ServiceDocument() : this(null) + { + } + + public ServiceDocument(IEnumerable workspaces) + { + if (workspaces != null) + { + _workspaces = new NullNotAllowedCollection(); + foreach (Workspace workspace in workspaces) + { + _workspaces.Add(workspace); + } + } + } + + public Dictionary AttributeExtensions + { + get { return _extensions.AttributeExtensions; } + } + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get { return _extensions.ElementExtensions; } + } + + public string Language + { + get { return _language; } + set { _language = value; } + } + + public Collection Workspaces + { + get + { + if (_workspaces == null) + { + _workspaces = new NullNotAllowedCollection(); + } + return _workspaces; + } + } + + public static async Task LoadAsync(XmlReader reader) + where TServiceDocument : ServiceDocument, new() + { + AtomPub10ServiceDocumentFormatter formatter = new AtomPub10ServiceDocumentFormatter(); + await formatter.ReadFromAsync(reader); + return (TServiceDocument)(object)formatter.Document; + } + + public ServiceDocumentFormatter GetFormatter() + { + return new AtomPub10ServiceDocumentFormatter(this); + } + + public Task Save(XmlWriter writer) + { + return new AtomPub10ServiceDocumentFormatter(this).WriteToAsync(writer); + } + + protected internal virtual Workspace CreateWorkspace() + { + return new Workspace(); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReaderWrapper readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs new file mode 100644 index 0000000000..1dcfd04bc4 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/ServiceDocumentFormatter.cs @@ -0,0 +1,329 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + + [DataContract] + public abstract class ServiceDocumentFormatter + { + private ServiceDocument _document; + + protected ServiceDocumentFormatter() + { + } + protected ServiceDocumentFormatter(ServiceDocument documentToWrite) + { + if (documentToWrite == null) + { + throw new ArgumentNullException(nameof(documentToWrite)); + } + _document = documentToWrite; + } + + public ServiceDocument Document + { + get { return _document; } + } + + public abstract string Version + { get; } + + public abstract Task CanReadAsync(XmlReader reader); + public abstract Task ReadFromAsync(XmlReader reader); + public abstract Task WriteToAsync(XmlWriter writer); + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, CategoriesDocument categories) + { + if (categories == null) + { + throw new ArgumentNullException(nameof(categories)); + } + Atom10FeedFormatter.CloseBuffer(buffer, writer); + categories.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, ResourceCollectionInfo collection) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + Atom10FeedFormatter.CloseBuffer(buffer, writer); + collection.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, Workspace workspace) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + Atom10FeedFormatter.CloseBuffer(buffer, writer); + workspace.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, ServiceDocument document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + Atom10FeedFormatter.CloseBuffer(buffer, writer); + document.LoadElementExtensions(buffer); + } + + protected static SyndicationCategory CreateCategory(InlineCategoriesDocument inlineCategories) + { + if (inlineCategories == null) + { + throw new ArgumentNullException(nameof(inlineCategories)); + } + return inlineCategories.CreateCategory(); + } + + protected static ResourceCollectionInfo CreateCollection(Workspace workspace) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + return workspace.CreateResourceCollection(); + } + + protected static InlineCategoriesDocument CreateInlineCategories(ResourceCollectionInfo collection) + { + return collection.CreateInlineCategoriesDocument(); + } + + protected static ReferencedCategoriesDocument CreateReferencedCategories(ResourceCollectionInfo collection) + { + return collection.CreateReferencedCategoriesDocument(); + } + + protected static Workspace CreateWorkspace(ServiceDocument document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + return document.CreateWorkspace(); + } + + protected static void LoadElementExtensions(XmlReader reader, CategoriesDocument categories, int maxExtensionSize) + { + if (categories == null) + { + throw new ArgumentNullException(nameof(categories)); + } + + categories.LoadElementExtensions(XmlReaderWrapper.CreateFromReader(reader), maxExtensionSize); + } + + protected static void LoadElementExtensions(XmlReader reader, ResourceCollectionInfo collection, int maxExtensionSize) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + collection.LoadElementExtensions(XmlReaderWrapper.CreateFromReader(reader), maxExtensionSize); + } + + protected static void LoadElementExtensions(XmlReader reader, Workspace workspace, int maxExtensionSize) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + + workspace.LoadElementExtensions(XmlReaderWrapper.CreateFromReader(reader), maxExtensionSize); + } + + protected static void LoadElementExtensions(XmlReader reader, ServiceDocument document, int maxExtensionSize) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + document.LoadElementExtensions(XmlReaderWrapper.CreateFromReader(reader), maxExtensionSize); + } + + protected static bool TryParseAttribute(string name, string ns, string value, ServiceDocument document, string version) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return document.TryParseAttribute(name, ns, value, version); + } + + protected static bool TryParseAttribute(string name, string ns, string value, ResourceCollectionInfo collection, string version) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + return collection.TryParseAttribute(name, ns, value, version); + } + + protected static bool TryParseAttribute(string name, string ns, string value, CategoriesDocument categories, string version) + { + if (categories == null) + { + throw new ArgumentNullException(nameof(categories)); + } + + return categories.TryParseAttribute(name, ns, value, version); + } + + protected static bool TryParseAttribute(string name, string ns, string value, Workspace workspace, string version) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + + return workspace.TryParseAttribute(name, ns, value, version); + } + + protected static bool TryParseElement(XmlReader reader, ResourceCollectionInfo collection, string version) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + return collection.TryParseElement(XmlReaderWrapper.CreateFromReader(reader), version); + } + + protected static bool TryParseElement(XmlReader reader, ServiceDocument document, string version) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return document.TryParseElement(XmlReaderWrapper.CreateFromReader(reader), version); + } + + protected static bool TryParseElement(XmlReader reader, Workspace workspace, string version) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + + return workspace.TryParseElement(XmlReaderWrapper.CreateFromReader(reader), version); + } + + protected static bool TryParseElement(XmlReader reader, CategoriesDocument categories, string version) + { + if (categories == null) + { + throw new ArgumentNullException(nameof(categories)); + } + + return categories.TryParseElement(XmlReaderWrapper.CreateFromReader(reader), version); + } + + protected static void WriteAttributeExtensions(XmlWriter writer, ServiceDocument document, string version) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + document.WriteAttributeExtensionsAsync(writer, version); + } + + protected static void WriteAttributeExtensions(XmlWriter writer, Workspace workspace, string version) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + + workspace.WriteAttributeExtensions(writer, version); + } + + protected static Task WriteAttributeExtensionsAsync(XmlWriter writer, ResourceCollectionInfo collection, string version) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + return collection.WriteAttributeExtensionsAsync(writer, version); + } + + protected static Task WriteAttributeExtensionsAsync(XmlWriter writer, CategoriesDocument categories, string version) + { + if (categories == null) + { + throw new ArgumentNullException(nameof(categories)); + } + + return categories.WriteAttributeExtensionsAsync(writer, version); + } + + protected static Task WriteElementExtensionsAsync(XmlWriter writer, ServiceDocument document, string version) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return document.WriteElementExtensionsAsync(writer, version); + } + + protected static Task WriteElementExtensionsAsync(XmlWriter writer, Workspace workspace, string version) + { + if (workspace == null) + { + throw new ArgumentNullException(nameof(workspace)); + } + + return workspace.WriteElementExtensionsAsync(writer, version); + } + + protected static Task WriteElementExtensionsAsync(XmlWriter writer, ResourceCollectionInfo collection, string version) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + return collection.WriteElementExtensionsAsync(writer, version); + } + + protected static Task WriteElementExtensionsAsync(XmlWriter writer, CategoriesDocument categories, string version) + { + if (categories == null) + { + throw new ArgumentNullException(nameof(categories)); + } + + return categories.WriteElementExtensionsAsync(writer, version); + } + + protected virtual ServiceDocument CreateDocumentInstance() + { + return new ServiceDocument(); + } + + protected virtual void SetDocument(ServiceDocument document) + { + _document = document; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs new file mode 100644 index 0000000000..77660de24f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationCategory.cs @@ -0,0 +1,113 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class SyndicationCategory : IExtensibleSyndicationObject + { + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private string _label; + private string _name; + private string _scheme; + + public SyndicationCategory() + : this((string)null) + { + } + + public SyndicationCategory(string name) + : this(name, null, null) + { + } + + public SyndicationCategory(string name, string scheme, string label) + { + _name = name; + _scheme = scheme; + _label = label; + } + + protected SyndicationCategory(SyndicationCategory source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _label = source._label; + _name = source._name; + _scheme = source._scheme; + _extensions = source._extensions.Clone(); + } + + public Dictionary AttributeExtensions + { + get { return _extensions.AttributeExtensions; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get { return _extensions.ElementExtensions; } + } + + public string Label + { + get { return _label; } + set { _label = value; } + } + + public string Name + { + get { return _name; } + set { _name = value; } + } + + public string Scheme + { + get { return _scheme; } + set { _scheme = value; } + } + + public virtual SyndicationCategory Clone() + { + return new SyndicationCategory(this); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs new file mode 100644 index 0000000000..7465df37a5 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationContent.cs @@ -0,0 +1,138 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Serialization; + + public abstract class SyndicationContent + { + private Dictionary _attributeExtensions; + + protected SyndicationContent() + { + } + + protected SyndicationContent(SyndicationContent source) + { + CopyAttributeExtensions(source); + } + + public Dictionary AttributeExtensions + { + get + { + if (_attributeExtensions == null) + { + _attributeExtensions = new Dictionary(); + } + return _attributeExtensions; + } + } + + public abstract string Type + { + get; + } + + public static TextSyndicationContent CreateHtmlContent(string content) + { + return new TextSyndicationContent(content, TextSyndicationContentKind.Html); + } + + public static TextSyndicationContent CreatePlaintextContent(string content) + { + return new TextSyndicationContent(content); + } + + public static UrlSyndicationContent CreateUrlContent(Uri url, string mediaType) + { + return new UrlSyndicationContent(url, mediaType); + } + + public static TextSyndicationContent CreateXhtmlContent(string content) + { + return new TextSyndicationContent(content, TextSyndicationContentKind.XHtml); + } + + public static XmlSyndicationContent CreateXmlContent(object dataContractObject) + { + return new XmlSyndicationContent(Atom10Constants.XmlMediaType, dataContractObject, (DataContractSerializer)null); + } + + public static XmlSyndicationContent CreateXmlContent(object dataContractObject, XmlObjectSerializer dataContractSerializer) + { + return new XmlSyndicationContent(Atom10Constants.XmlMediaType, dataContractObject, dataContractSerializer); + } + + public static XmlSyndicationContent CreateXmlContent(XmlReader XmlReaderWrapper) + { + return new XmlSyndicationContent(XmlReaderWrapper); + } + + public static XmlSyndicationContent CreateXmlContent(object xmlSerializerObject, XmlSerializer serializer) + { + return new XmlSyndicationContent(Atom10Constants.XmlMediaType, xmlSerializerObject, serializer); + } + + public abstract SyndicationContent Clone(); + + public async Task WriteToAsync(XmlWriter writer, string outerElementName, string outerElementNamespace) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + if (string.IsNullOrEmpty(outerElementName)) + { + throw new ArgumentException(SR.OuterElementNameNotSpecified); + } + + writer = XmlWriterWrapper.CreateFromWriter(writer); + + await writer.WriteStartElementAsync(outerElementName, outerElementNamespace); + await writer.WriteAttributeStringAsync(Atom10Constants.TypeTag, string.Empty, this.Type); + if (_attributeExtensions != null) + { + foreach (XmlQualifiedName key in _attributeExtensions.Keys) + { + if (key.Name == Atom10Constants.TypeTag && key.Namespace == string.Empty) + { + continue; + } + string attrValue; + if (_attributeExtensions.TryGetValue(key, out attrValue)) + { + await writer.WriteAttributeStringAsync(key.Name, key.Namespace, attrValue); + } + } + } + WriteContentsTo(writer); + await writer.WriteEndElementAsync(); + } + + internal void CopyAttributeExtensions(SyndicationContent source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + if (source._attributeExtensions != null) + { + foreach (XmlQualifiedName key in source._attributeExtensions.Keys) + { + this.AttributeExtensions.Add(key, source._attributeExtensions[key]); + } + } + } + + protected abstract void WriteContentsTo(XmlWriter writer); + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs new file mode 100644 index 0000000000..e62e626424 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtension.cs @@ -0,0 +1,348 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Diagnostics; + using System.IO; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Serialization; + + public class SyndicationElementExtension + { + private XmlBuffer _buffer; + private int _bufferElementIndex; + // extensionData and extensionDataWriter are only present on the send side + private object _extensionData; + private ExtensionDataWriter _extensionDataWriter; + private string _outerName; + private string _outerNamespace; + + public SyndicationElementExtension(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + SyndicationFeedFormatter.MoveToStartElement(reader); + _outerName = reader.LocalName; + _outerNamespace = reader.NamespaceURI; + _buffer = new XmlBuffer(int.MaxValue); + using (XmlDictionaryWriter writer = _buffer.OpenSection(XmlDictionaryReaderQuotas.Max)) + { + writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + writer.WriteNode(reader, false); + writer.WriteEndElement(); + } + _buffer.CloseSection(); + _buffer.Close(); + _bufferElementIndex = 0; + } + + public SyndicationElementExtension(object dataContractExtension) + : this(dataContractExtension, (XmlObjectSerializer)null) + { + } + + public SyndicationElementExtension(object dataContractExtension, XmlObjectSerializer dataContractSerializer) + : this(null, null, dataContractExtension, dataContractSerializer) + { + } + + public SyndicationElementExtension(string outerName, string outerNamespace, object dataContractExtension) + : this(outerName, outerNamespace, dataContractExtension, null) + { + } + + public SyndicationElementExtension(string outerName, string outerNamespace, object dataContractExtension, XmlObjectSerializer dataContractSerializer) + { + if (dataContractExtension == null) + { + throw new ArgumentNullException(nameof(dataContractExtension)); + } + if (outerName == string.Empty) + { + throw new ArgumentNullException(SR.OuterNameOfElementExtensionEmpty); + } + if (dataContractSerializer == null) + { + dataContractSerializer = new DataContractSerializer(dataContractExtension.GetType()); + } + _outerName = outerName; + _outerNamespace = outerNamespace; + _extensionData = dataContractExtension; + _extensionDataWriter = new ExtensionDataWriter(_extensionData, dataContractSerializer, _outerName, _outerNamespace); + } + + public SyndicationElementExtension(object xmlSerializerExtension, XmlSerializer serializer) + { + if (xmlSerializerExtension == null) + { + throw new ArgumentNullException(nameof(xmlSerializerExtension)); + } + if (serializer == null) + { + serializer = new XmlSerializer(xmlSerializerExtension.GetType()); + } + _extensionData = xmlSerializerExtension; + _extensionDataWriter = new ExtensionDataWriter(_extensionData, serializer); + } + + internal SyndicationElementExtension(XmlBuffer buffer, int bufferElementIndex, string outerName, string outerNamespace) + { + _buffer = buffer; + _bufferElementIndex = bufferElementIndex; + _outerName = outerName; + _outerNamespace = outerNamespace; + } + + public string OuterName + { + get + { + if (_outerName == null) + { + EnsureOuterNameAndNs(); + } + return _outerName; + } + } + + public string OuterNamespace + { + get + { + if (_outerName == null) + { + EnsureOuterNameAndNs(); + } + return _outerNamespace; + } + } + + public Task GetObject() + { + return GetObject(new DataContractSerializer(typeof(TExtension))); + } + + public async Task GetObject(XmlObjectSerializer serializer) + { + if (serializer == null) + { + throw new ArgumentNullException(nameof(serializer)); + } + if (_extensionData != null && typeof(TExtension).IsAssignableFrom(_extensionData.GetType())) + { + return (TExtension)_extensionData; + } + + using (XmlReader reader = await GetReaderAsync()) + { + return (TExtension)serializer.ReadObject(reader, false); + } + } + + public async Task GetObject(XmlSerializer serializer) + { + if (serializer == null) + { + throw new ArgumentNullException(nameof(serializer)); + } + if (_extensionData != null && typeof(TExtension).IsAssignableFrom(_extensionData.GetType())) + { + return (TExtension)_extensionData; + } + + using (XmlReader reader = await GetReaderAsync()) + { + return (TExtension)serializer.Deserialize(reader); + } + } + + public async Task GetReaderAsync() + { + await this.EnsureBuffer(); + XmlReaderWrapper reader = XmlReaderWrapper.CreateFromReader(_buffer.GetReader(0)); + int index = 0; + reader.ReadStartElement(Rss20Constants.ExtensionWrapperTag); + while (reader.IsStartElement()) + { + if (index == _bufferElementIndex) + { + break; + } + ++index; + + await reader.SkipAsync(); + } + + return reader; + } + + //public Task GetReader() + //{ + // return GetReaderAsync(); + //} + + public async Task WriteToAsync(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + if (_extensionDataWriter != null) + { + _extensionDataWriter.WriteToAsync(writer); + } + else + { + writer = XmlWriterWrapper.CreateFromWriter(writer); + using (XmlReader reader = await GetReaderAsync()) + { + await writer.WriteNodeAsync(reader, false); + } + } + } + + private async Task EnsureBuffer() + { + if (_buffer == null) + { + _buffer = new XmlBuffer(int.MaxValue); + using (XmlDictionaryWriter writer = _buffer.OpenSection(XmlDictionaryReaderQuotas.Max)) + { + writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + await this.WriteToAsync(writer); + writer.WriteEndElement(); + } + _buffer.CloseSection(); + _buffer.Close(); + _bufferElementIndex = 0; + } + } + + private void EnsureOuterNameAndNs() + { + Debug.Assert(_extensionDataWriter != null, "outer name is null only for datacontract and xmlserializer cases"); + _extensionDataWriter.ComputeOuterNameAndNs(out _outerName, out _outerNamespace); + } + + // this class holds the extension data and the associated serializer (either DataContractSerializer or XmlSerializer but not both) + private class ExtensionDataWriter + { + private readonly XmlObjectSerializer _dataContractSerializer; + private readonly object _extensionData; + private readonly string _outerName; + private readonly string _outerNamespace; + private readonly XmlSerializer _xmlSerializer; + + public ExtensionDataWriter(object extensionData, XmlObjectSerializer dataContractSerializer, string outerName, string outerNamespace) + { + Debug.Assert(extensionData != null && dataContractSerializer != null, "null check"); + + _dataContractSerializer = dataContractSerializer; + _extensionData = extensionData; + _outerName = outerName; + _outerNamespace = outerNamespace; + } + + public ExtensionDataWriter(object extensionData, XmlSerializer serializer) + { + Debug.Assert(extensionData != null && serializer != null, "null check"); + _xmlSerializer = serializer; + _extensionData = extensionData; + } + + public void WriteToAsync(XmlWriter writer) + { + if (_xmlSerializer != null) + { + Debug.Assert((_dataContractSerializer == null && _outerName == null && _outerNamespace == null), "Xml serializer cannot have outer name, ns"); + _xmlSerializer.Serialize(writer, _extensionData); + } + else + { + Debug.Assert(_xmlSerializer == null, "Xml serializer cannot be configured"); + writer = XmlWriterWrapper.CreateFromWriter(writer); + if (_outerName != null) + { + writer.WriteStartElementAsync(_outerName, _outerNamespace); + _dataContractSerializer.WriteObjectContent(writer, _extensionData); + writer.WriteEndElementAsync(); + } + else + { + _dataContractSerializer.WriteObject(writer, _extensionData); + } + } + } + + internal void ComputeOuterNameAndNs(out string name, out string ns) + { + if (_outerName != null) + { + Debug.Assert(_xmlSerializer == null, "outer name is not null for data contract extension only"); + name = _outerName; + ns = _outerNamespace; + } + else if (_dataContractSerializer != null) + { + Debug.Assert(_xmlSerializer == null, "only one of xmlserializer or datacontract serializer can be present"); + XsdDataContractExporter dcExporter = new XsdDataContractExporter(); + XmlQualifiedName qName = dcExporter.GetRootElementName(_extensionData.GetType()); + if (qName != null) + { + name = qName.Name; + ns = qName.Namespace; + } + else + { + // this can happen if an IXmlSerializable type is specified with IsAny=true + ReadOuterNameAndNs(out name, out ns); + } + } + else + { + Debug.Assert(_dataContractSerializer == null, "only one of xmlserializer or datacontract serializer can be present"); + XmlReflectionImporter importer = new XmlReflectionImporter(); + XmlTypeMapping typeMapping = importer.ImportTypeMapping(_extensionData.GetType()); + if (typeMapping != null && !string.IsNullOrEmpty(typeMapping.ElementName)) + { + name = typeMapping.ElementName; + ns = typeMapping.Namespace; + } + else + { + // this can happen if an IXmlSerializable type is specified with IsAny=true + ReadOuterNameAndNs(out name, out ns); + } + } + } + + internal void ReadOuterNameAndNs(out string name, out string ns) + { + using (MemoryStream stream = new MemoryStream()) + { + using (XmlWriter writer = XmlWriter.Create(stream)) + { + this.WriteToAsync(writer); + } + + stream.Seek(0, SeekOrigin.Begin); + + using (XmlReader reader = XmlReader.Create(stream)) + { + SyndicationFeedFormatter.MoveToStartElement(reader); + name = reader.LocalName; + ns = reader.NamespaceURI; + } + } + } + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs new file mode 100644 index 0000000000..cb09d65b1f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionCollection.cs @@ -0,0 +1,277 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.ObjectModel; + using System.Diagnostics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Serialization; + + // sealed because the ctor results in a call to the virtual InsertItem method + public sealed class SyndicationElementExtensionCollection : Collection + { + private XmlBuffer _buffer; + private bool _initialized; + + internal SyndicationElementExtensionCollection() + : this((XmlBuffer)null) + { + } + + internal SyndicationElementExtensionCollection(XmlBuffer buffer) + : base() + { + _buffer = buffer; + if (_buffer != null) + { + PopulateElements(); + } + _initialized = true; + } + + internal SyndicationElementExtensionCollection(SyndicationElementExtensionCollection source) + : base() + { + _buffer = source._buffer; + for (int i = 0; i < source.Items.Count; ++i) + { + base.Add(source.Items[i]); + } + _initialized = true; + } + + public void Add(object extension) + { + if (extension is SyndicationElementExtension) + { + base.Add((SyndicationElementExtension)extension); + } + else + { + this.Add(extension, (DataContractSerializer)null); + } + } + + public void Add(string outerName, string outerNamespace, object dataContractExtension) + { + this.Add(outerName, outerNamespace, dataContractExtension, null); + } + + public void Add(object dataContractExtension, DataContractSerializer serializer) + { + this.Add(null, null, dataContractExtension, serializer); + } + + public void Add(string outerName, string outerNamespace, object dataContractExtension, XmlObjectSerializer dataContractSerializer) + { + if (dataContractExtension == null) + { + throw new ArgumentNullException(nameof(dataContractExtension)); + } + if (dataContractSerializer == null) + { + dataContractSerializer = new DataContractSerializer(dataContractExtension.GetType()); + } + base.Add(new SyndicationElementExtension(outerName, outerNamespace, dataContractExtension, dataContractSerializer)); + } + + public void Add(object xmlSerializerExtension, XmlSerializer serializer) + { + if (xmlSerializerExtension == null) + { + throw new ArgumentNullException(nameof(xmlSerializerExtension)); + } + if (serializer == null) + { + serializer = new XmlSerializer(xmlSerializerExtension.GetType()); + } + base.Add(new SyndicationElementExtension(xmlSerializerExtension, serializer)); + } + + public void Add(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + base.Add(new SyndicationElementExtension(reader)); + } + + public async Task GetReaderAtElementExtensions() + { + XmlBuffer extensionsBuffer = await GetOrCreateBufferOverExtensions(); + XmlReader reader = extensionsBuffer.GetReader(0); + reader.ReadStartElement(); + return reader; + } + + public Task> ReadElementExtensions(string extensionName, string extensionNamespace) + { + return ReadElementExtensions(extensionName, extensionNamespace, new DataContractSerializer(typeof(TExtension))); + } + + public Task> ReadElementExtensions(string extensionName, string extensionNamespace, XmlObjectSerializer serializer) + { + if (serializer == null) + { + throw new ArgumentNullException(nameof(serializer)); + } + return ReadExtensions(extensionName, extensionNamespace, serializer, null); + } + + public Task> ReadElementExtensions(string extensionName, string extensionNamespace, XmlSerializer serializer) + { + if (serializer == null) + { + throw new ArgumentNullException(nameof(serializer)); + } + return ReadExtensions(extensionName, extensionNamespace, null, serializer); + } + + internal async Task WriteToAsync(XmlWriter writer) + { + if (_buffer != null) + { + using (XmlDictionaryReader reader = _buffer.GetReader(0)) + { + reader.ReadStartElement(); + while (reader.IsStartElement()) + { + await writer.WriteNodeAsync(reader, false); + } + } + } + else + { + for (int i = 0; i < this.Items.Count; ++i) + { + await this.Items[i].WriteToAsync(writer); + } + } + } + + protected override void ClearItems() + { + base.ClearItems(); + // clear the cached buffer if the operation is happening outside the constructor + if (_initialized) + { + _buffer = null; + } + } + + protected override void InsertItem(int index, SyndicationElementExtension item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + base.InsertItem(index, item); + // clear the cached buffer if the operation is happening outside the constructor + if (_initialized) + { + _buffer = null; + } + } + + protected override void RemoveItem(int index) + { + base.RemoveItem(index); + // clear the cached buffer if the operation is happening outside the constructor + if (_initialized) + { + _buffer = null; + } + } + + protected override void SetItem(int index, SyndicationElementExtension item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + base.SetItem(index, item); + // clear the cached buffer if the operation is happening outside the constructor + if (_initialized) + { + _buffer = null; + } + } + + private async Task GetOrCreateBufferOverExtensions() + { + if (_buffer != null) + { + return _buffer; + } + XmlBuffer newBuffer = new XmlBuffer(int.MaxValue); + using (XmlWriter writer = newBuffer.OpenSection(XmlDictionaryReaderQuotas.Max)) + { + writer.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + for (int i = 0; i < this.Count; ++i) + { + await this[i].WriteToAsync(writer); + } + writer.WriteEndElement(); + } + newBuffer.CloseSection(); + newBuffer.Close(); + _buffer = newBuffer; + return newBuffer; + } + + private void PopulateElements() + { + using (XmlDictionaryReader reader = _buffer.GetReader(0)) + { + reader.ReadStartElement(); + int index = 0; + while (reader.IsStartElement()) + { + base.Add(new SyndicationElementExtension(_buffer, index, reader.LocalName, reader.NamespaceURI)); + reader.Skip(); + ++index; + } + } + } + + private async Task> ReadExtensions(string extensionName, string extensionNamespace, XmlObjectSerializer dcSerializer, XmlSerializer xmlSerializer) + { + if (string.IsNullOrEmpty(extensionName)) + { + throw new ArgumentNullException(SR.ExtensionNameNotSpecified); + } + Debug.Assert((dcSerializer == null) != (xmlSerializer == null), "exactly one serializer should be supplied"); + // normalize the null and empty namespace + if (extensionNamespace == null) + { + extensionNamespace = string.Empty; + } + + Collection results = new Collection(); + for (int i = 0; i < this.Count; ++i) + { + if (extensionName != this[i].OuterName || extensionNamespace != this[i].OuterNamespace) + { + continue; + } + + if (dcSerializer != null) + { + results.Add(await this[i].GetObject(dcSerializer)); + } + else + { + results.Add(await this[i].GetObject(xmlSerializer)); + } + } + return results; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionKindHelper.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionKindHelper.cs new file mode 100644 index 0000000000..f1ebc22e56 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationElementExtensionKindHelper.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + internal static class SyndicationElementExtensionKindHelper + { + internal static bool IsDefined(SyndicationElementExtensionKind value) + { + return (value == SyndicationElementExtensionKind.DataContract || + value == SyndicationElementExtensionKind.XmlElement || + value == SyndicationElementExtensionKind.XmlSerializer); + } + + internal enum SyndicationElementExtensionKind + { + DataContract, + XmlElement, + XmlSerializer + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs new file mode 100644 index 0000000000..e6530c817c --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeed.cs @@ -0,0 +1,505 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System.ServiceModel; + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.CompilerServices; + using System.Threading; + using System.Threading.Tasks; + using System.Xml; + + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class SyndicationFeed : IExtensibleSyndicationObject + { + private Collection _authors; + private Uri _baseUri; + private Collection _categories; + private Collection _contributors; + private TextSyndicationContent _copyright; + private TextSyndicationContent _description; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private string _generator; + private string _id; + + private Uri _imageUrl; + private TextSyndicationContent _imageTitle; + private Uri _imageLink; + + private IEnumerable _items; + private string _language; + private DateTimeOffset _lastUpdatedTime; + private Collection _links; + private TextSyndicationContent _title; + + // optional RSS tags + private SyndicationLink _documentation; + private int _timeToLive; + private Collection _skipHours; + private Collection _skipDays; + private SyndicationTextInput _textInput; + private Uri _iconImage; + + public Uri IconImage + { + get + { + return _iconImage; + } + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + _iconImage = value; + } + } + + public SyndicationTextInput TextInput + { + get + { + return _textInput; + } + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + _textInput = value; + } + } + + public SyndicationLink Documentation + { + get + { + return _documentation; + } + set + { + _documentation = value; + } + } + + public int TimeToLive + { + get + { + return _timeToLive; + } + set + { + _timeToLive = value; + } + } + + public Collection SkipHours + { + get + { + if (_skipHours == null) + _skipHours = new Collection(); + return _skipHours; + } + } + + public Collection SkipDays + { + get + { + if (_skipDays == null) + _skipDays = new Collection(); + return _skipDays; + } + } + + //====================================== + + public SyndicationFeed() + : this((IEnumerable)null) + { + } + + public SyndicationFeed(IEnumerable items) + : this(null, null, null, items) + { + } + + public SyndicationFeed(string title, string description, Uri feedAlternateLink) + : this(title, description, feedAlternateLink, null) + { + } + + public SyndicationFeed(string title, string description, Uri feedAlternateLink, IEnumerable items) + : this(title, description, feedAlternateLink, null, DateTimeOffset.MinValue, items) + { + } + + public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime) + : this(title, description, feedAlternateLink, id, lastUpdatedTime, null) + { + } + + public SyndicationFeed(string title, string description, Uri feedAlternateLink, string id, DateTimeOffset lastUpdatedTime, IEnumerable items) + { + if (title != null) + { + _title = new TextSyndicationContent(title); + } + if (description != null) + { + _description = new TextSyndicationContent(description); + } + if (feedAlternateLink != null) + { + this.Links.Add(SyndicationLink.CreateAlternateLink(feedAlternateLink)); + } + _id = id; + _lastUpdatedTime = lastUpdatedTime; + _items = items; + } + + protected SyndicationFeed(SyndicationFeed source, bool cloneItems) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _authors = FeedUtils.ClonePersons(source._authors); + _categories = FeedUtils.CloneCategories(source._categories); + _contributors = FeedUtils.ClonePersons(source._contributors); + _copyright = FeedUtils.CloneTextContent(source._copyright); + _description = FeedUtils.CloneTextContent(source._description); + _extensions = source._extensions.Clone(); + _generator = source._generator; + _id = source._id; + _imageUrl = source._imageUrl; + _language = source._language; + _lastUpdatedTime = source._lastUpdatedTime; + _links = FeedUtils.CloneLinks(source._links); + _title = FeedUtils.CloneTextContent(source._title); + _baseUri = source._baseUri; + IList srcList = source._items as IList; + if (srcList != null) + { + Collection tmp = new NullNotAllowedCollection(); + for (int i = 0; i < srcList.Count; ++i) + { + tmp.Add((cloneItems) ? srcList[i].Clone() : srcList[i]); + } + _items = tmp; + } + else + { + if (cloneItems) + { + throw new InvalidOperationException(SR.UnbufferedItemsCannotBeCloned); + } + _items = source._items; + } + } + + public Dictionary AttributeExtensions + { + get { return _extensions.AttributeExtensions; } + } + + public Collection Authors + { + get + { + if (_authors == null) + { + _authors = new NullNotAllowedCollection(); + } + return _authors; + } + } + + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public Collection Categories + { + get + { + if (_categories == null) + { + _categories = new NullNotAllowedCollection(); + } + return _categories; + } + } + + public Collection Contributors + { + get + { + if (_contributors == null) + { + _contributors = new NullNotAllowedCollection(); + } + return _contributors; + } + } + + public TextSyndicationContent Copyright + { + get { return _copyright; } + set { _copyright = value; } + } + + public TextSyndicationContent Description + { + get { return _description; } + set { _description = value; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get { return _extensions.ElementExtensions; } + } + + public string Generator + { + get { return _generator; } + set { _generator = value; } + } + + public string Id + { + get { return _id; } + set { _id = value; } + } + + public Uri ImageUrl + { + get { return _imageUrl; } + set { _imageUrl = value; } + } + + public TextSyndicationContent ImageTitle + { + get { return _imageTitle; } + set { _imageTitle = value; } + } + + public Uri ImageLink + { + get { return _imageLink; } + set { _imageLink = value; } + } + + public IEnumerable Items + { + get + { + if (_items == null) + { + _items = new NullNotAllowedCollection(); + } + return _items; + } + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + _items = value; + } + } + + public string Language + { + get { return _language; } + set { _language = value; } + } + + public DateTimeOffset LastUpdatedTime + { + get { return _lastUpdatedTime; } + set { _lastUpdatedTime = value; } + } + + public Collection Links + { + get + { + if (_links == null) + { + _links = new NullNotAllowedCollection(); + } + return _links; + } + } + + public TextSyndicationContent Title + { + get { return _title; } + set { _title = value; } + } + + //// Custom Parsing + public static async Task LoadAsync(XmlReader reader, Rss20FeedFormatter formatter, CancellationToken ct) + { + return await LoadAsync(reader, formatter, new Atom10FeedFormatter(), ct); + } + + public static async Task LoadAsync(XmlReader reader, Atom10FeedFormatter formatter, CancellationToken ct) + { + return await LoadAsync(reader, new Rss20FeedFormatter(), formatter, ct); + } + + public static async Task LoadAsync(XmlReader reader, Rss20FeedFormatter Rssformatter, Atom10FeedFormatter Atomformatter, CancellationToken ct) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + XmlReaderWrapper wrappedReader = XmlReaderWrapper.CreateFromReader(reader); + + Atom10FeedFormatter atomSerializer = Atomformatter; + if (atomSerializer.CanRead(wrappedReader)) + { + await atomSerializer.ReadFromAsync(wrappedReader, new CancellationToken()); + return atomSerializer.Feed; + } + Rss20FeedFormatter rssSerializer = Rssformatter; + if (rssSerializer.CanRead(wrappedReader)) + { + await rssSerializer.ReadFromAsync(wrappedReader, new CancellationToken()); + return rssSerializer.Feed; + } + throw new XmlException(string.Format(SR.UnknownFeedXml, wrappedReader.LocalName, wrappedReader.NamespaceURI)); + } + + //================================= + + public static SyndicationFeed Load(XmlReader reader) + { + return Load(reader); + } + + public static TSyndicationFeed Load(XmlReader reader) + where TSyndicationFeed : SyndicationFeed, new() + { + CancellationToken ct = new CancellationToken(); + return LoadAsync(reader, ct).GetAwaiter().GetResult(); + } + + public static async Task LoadAsync(XmlReader reader, CancellationToken ct) + { + return await LoadAsync(reader, ct); + } + + public static async Task LoadAsync(XmlReader reader, CancellationToken ct) + where TSyndicationFeed : SyndicationFeed, new() + { + Atom10FeedFormatter atomSerializer = new Atom10FeedFormatter(); + if (atomSerializer.CanRead(reader)) + { + await atomSerializer.ReadFromAsync(reader, ct); + return atomSerializer.Feed as TSyndicationFeed; + } + + Rss20FeedFormatter rssSerializer = new Rss20FeedFormatter(); + if (rssSerializer.CanRead(reader)) + { + await rssSerializer.ReadFromAsync(reader, ct); + return rssSerializer.Feed as TSyndicationFeed; + } + + throw new XmlException(string.Format(SR.UnknownFeedXml, reader.LocalName, reader.NamespaceURI)); + } + + public virtual SyndicationFeed Clone(bool cloneItems) + { + return new SyndicationFeed(this, cloneItems); + } + + public Atom10FeedFormatter GetAtom10Formatter() + { + return new Atom10FeedFormatter(this); + } + + public Rss20FeedFormatter GetRss20Formatter() + { + return GetRss20Formatter(true); + } + + public Rss20FeedFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) + { + return new Rss20FeedFormatter(this, serializeExtensionsAsAtom); + } + + public Task SaveAsAtom10Async(XmlWriter writer, CancellationToken ct) + { + return GetAtom10Formatter().WriteToAsync(writer, ct); + } + + public Task SaveAsRss20Async(XmlWriter writer, CancellationToken ct) + { + return GetRss20Formatter().WriteToAsync(writer, ct); + } + + protected internal virtual SyndicationCategory CreateCategory() + { + return new SyndicationCategory(); + } + + protected internal virtual SyndicationItem CreateItem() + { + return new SyndicationItem(); + } + + protected internal virtual SyndicationLink CreateLink() + { + return new SyndicationLink(); + } + + protected internal virtual SyndicationPerson CreatePerson() + { + return new SyndicationPerson(); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs new file mode 100644 index 0000000000..1fc464787b --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationFeedFormatter.cs @@ -0,0 +1,554 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// DEBUG!!! #if disabled statements + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Globalization; + using System.Runtime.Serialization; + using System.Threading; + using System.Threading.Tasks; + using System.Xml; + + [DataContract] + public abstract class SyndicationFeedFormatter + { + private SyndicationFeed _feed; + + protected SyndicationFeedFormatter() + { + _feed = null; + } + + protected SyndicationFeedFormatter(SyndicationFeed feedToWrite) + { + if (feedToWrite == null) + { + throw new ArgumentNullException(nameof(feedToWrite)); + } + _feed = feedToWrite; + } + + public SyndicationFeed Feed + { + get + { + return _feed; + } + } + + public abstract string Version { get; } + + public abstract bool CanRead(XmlReader reader); + + public abstract Task ReadFromAsync(XmlReader reader, CancellationToken ct); + + public override string ToString() + { + return string.Format(CultureInfo.CurrentCulture, "{0}, SyndicationVersion={1}", this.GetType(), this.Version); + } + + public abstract Task WriteToAsync(XmlWriter writer, CancellationToken ct); + + internal static protected SyndicationCategory CreateCategory(SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + return GetNonNullValue(feed.CreateCategory(), SR.FeedCreatedNullCategory); + } + + internal static protected SyndicationCategory CreateCategory(SyndicationItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + return GetNonNullValue(item.CreateCategory(), SR.ItemCreatedNullCategory); + } + + internal static protected SyndicationItem CreateItem(SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + return GetNonNullValue(feed.CreateItem(), SR.FeedCreatedNullItem); + } + + internal static protected SyndicationLink CreateLink(SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + return GetNonNullValue(feed.CreateLink(), SR.FeedCreatedNullPerson); + } + + internal static protected SyndicationLink CreateLink(SyndicationItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + return GetNonNullValue(item.CreateLink(), SR.ItemCreatedNullPerson); + } + + internal static protected SyndicationPerson CreatePerson(SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + return GetNonNullValue(feed.CreatePerson(), SR.FeedCreatedNullPerson); + } + + internal static protected SyndicationPerson CreatePerson(SyndicationItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + return GetNonNullValue(item.CreatePerson(), SR.ItemCreatedNullPerson); + } + + internal static protected void LoadElementExtensions(XmlReader reader, SyndicationFeed feed, int maxExtensionSize) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + feed.LoadElementExtensions(reader, maxExtensionSize); + } + + internal static protected void LoadElementExtensions(XmlReader reader, SyndicationItem item, int maxExtensionSize) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + item.LoadElementExtensions(reader, maxExtensionSize); + } + + internal static protected void LoadElementExtensions(XmlReader reader, SyndicationCategory category, int maxExtensionSize) + { + if (category == null) + { + throw new ArgumentNullException(nameof(category)); + } + category.LoadElementExtensions(reader, maxExtensionSize); + } + + internal static protected void LoadElementExtensions(XmlReader reader, SyndicationLink link, int maxExtensionSize) + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + link.LoadElementExtensions(reader, maxExtensionSize); + } + + internal static protected void LoadElementExtensions(XmlReader reader, SyndicationPerson person, int maxExtensionSize) + { + if (person == null) + { + throw new ArgumentNullException(nameof(person)); + } + person.LoadElementExtensions(reader, maxExtensionSize); + } + + internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationFeed feed, string version) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + + if (FeedUtils.IsXmlns(name, ns)) + { + return true; + } + + return feed.TryParseAttribute(name, ns, value, version); + } + + internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationItem item, string version) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + if (FeedUtils.IsXmlns(name, ns)) + { + return true; + } + return item.TryParseAttribute(name, ns, value, version); + } + + internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationCategory category, string version) + { + if (category == null) + { + throw new ArgumentNullException(nameof(category)); + } + if (FeedUtils.IsXmlns(name, ns)) + { + return true; + } + return category.TryParseAttribute(name, ns, value, version); + } + + internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationLink link, string version) + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + if (FeedUtils.IsXmlns(name, ns)) + { + return true; + } + return link.TryParseAttribute(name, ns, value, version); + } + + internal static protected bool TryParseAttribute(string name, string ns, string value, SyndicationPerson person, string version) + { + if (person == null) + { + throw new ArgumentNullException(nameof(person)); + } + if (FeedUtils.IsXmlns(name, ns)) + { + return true; + } + return person.TryParseAttribute(name, ns, value, version); + } + + internal static protected bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content) + { + return item.TryParseContent(reader, contentType, version, out content); + } + + internal static protected bool TryParseElement(XmlReader reader, SyndicationFeed feed, string version) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + + return feed.TryParseElement(reader, version); + } + + internal static protected bool TryParseElement(XmlReader reader, SyndicationItem item, string version) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + return item.TryParseElement(reader, version); + } + + internal static protected bool TryParseElement(XmlReader reader, SyndicationCategory category, string version) + { + if (category == null) + { + throw new ArgumentNullException(nameof(category)); + } + return category.TryParseElement(reader, version); + } + + internal static protected bool TryParseElement(XmlReader reader, SyndicationLink link, string version) + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + return link.TryParseElement(reader, version); + } + + internal static protected bool TryParseElement(XmlReader reader, SyndicationPerson person, string version) + { + if (person == null) + { + throw new ArgumentNullException(nameof(person)); + } + return person.TryParseElement(reader, version); + } + + internal static protected async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationFeed feed, string version) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + await feed.WriteAttributeExtensionsAsync(writer, version); + } + + internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationItem item, string version) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + return item.WriteAttributeExtensionsAsync(writer, version); + } + + internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version) + { + if (category == null) + { + throw new ArgumentNullException(nameof(category)); + } + return category.WriteAttributeExtensionsAsync(writer, version); + } + + internal static protected Task WriteAttributeExtensions(XmlWriter writer, SyndicationLink link, string version) + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + return link.WriteAttributeExtensionsAsync(writer, version); + } + + internal static protected Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version) + { + if (person == null) + { + throw new ArgumentNullException(nameof(person)); + } + return person.WriteAttributeExtensionsAsync(writer, version); + } + + internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationFeed feed, string version) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + return feed.WriteElementExtensionsAsync(writer, version); + } + + internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationItem item, string version) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + return item.WriteElementExtensionsAsync(writer, version); + } + + internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version) + { + if (category == null) + { + throw new ArgumentNullException(nameof(category)); + } + return category.WriteElementExtensionsAsync(writer, version); + } + + internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationLink link, string version) + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + return link.WriteElementExtensionsAsync(writer, version); + } + + internal static protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version) + { + if (person == null) + { + throw new ArgumentNullException(nameof(person)); + } + + return person.WriteElementExtensionsAsync(writer, version); + } + + internal protected virtual void SetFeed(SyndicationFeed feed) + { + _feed = feed ?? throw new ArgumentNullException(nameof(feed)); + } + + internal static void CloseBuffer(XmlBuffer buffer, XmlDictionaryWriter extWriter) + { + if (buffer == null) + { + return; + } + extWriter.WriteEndElement(); + buffer.CloseSection(); + buffer.Close(); + } + + internal static async Task> CreateBufferIfRequiredAndWriteNodeAsync(XmlBuffer buffer, XmlDictionaryWriter extWriter, XmlReader reader, int maxExtensionSize) + { + if (buffer == null) + { + buffer = new XmlBuffer(maxExtensionSize); + extWriter = buffer.OpenSection(XmlDictionaryReaderQuotas.Max); + extWriter.WriteStartElement(Rss20Constants.ExtensionWrapperTag); + } + + XmlDictionaryReader dictionaryReader = reader as XmlDictionaryReader; + if (dictionaryReader != null) + { + // Reimplementing WriteNode for XmlDictionaryWriter asynchronously depends on multiple internal methods + // so isn't feasible to reimplement here. As the primary scenario will be usage with an XmlReader which + // isn't an XmlDictionaryReader, deferring to the synchronous implementation is a reasonable fallback. + extWriter.WriteNode(reader, false); + } + else + { + await extWriter.WriteNodeAsync(reader, false); + } + + return Tuple.Create(buffer, extWriter); + } + + internal static SyndicationFeed CreateFeedInstance(Type feedType) + { + if (feedType.Equals(typeof(SyndicationFeed))) + { + return new SyndicationFeed(); + } + else + { + return (SyndicationFeed)Activator.CreateInstance(feedType); + } + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationFeed feed) + { + if (feed == null) + { + throw new ArgumentNullException(nameof(feed)); + } + + CloseBuffer(buffer, writer); + feed.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + CloseBuffer(buffer, writer); + item.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationCategory category) + { + if (category == null) + { + throw new ArgumentNullException(nameof(category)); + } + + CloseBuffer(buffer, writer); + category.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationLink link) + { + if (link == null) + { + throw new ArgumentNullException(nameof(link)); + } + + CloseBuffer(buffer, writer); + link.LoadElementExtensions(buffer); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationPerson person) + { + if (person == null) + { + throw new ArgumentNullException(nameof(person)); + } + + CloseBuffer(buffer, writer); + person.LoadElementExtensions(buffer); + } + + internal static async Task MoveToStartElementAsync(XmlReaderWrapper reader) + { + if (!await reader.IsStartElementAsync()) + { + XmlExceptionHelper.ThrowStartElementExpected(XmlDictionaryReader.CreateDictionaryReader(reader)); + } + } + + internal static void MoveToStartElement(XmlReader reader) + { + if (!reader.IsStartElement()) + { + XmlExceptionHelper.ThrowStartElementExpected(XmlDictionaryReader.CreateDictionaryReader(reader)); + } + } + + + protected abstract SyndicationFeed CreateFeedInstance(); + + private static T GetNonNullValue(T value, string errorMsg) + { + return value; + } + + private static class XmlExceptionHelper + { + private static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1) + { + string s = string.Format(res, arg1); + IXmlLineInfo lineInfo = reader as IXmlLineInfo; + if (lineInfo != null && lineInfo.HasLineInfo()) + { + s += " " + string.Format(SR.XmlLineInfo, lineInfo.LineNumber, lineInfo.LinePosition); + } + + throw new XmlException(s); + } + + private static string GetName(string prefix, string localName) + { + if (prefix.Length == 0) + return localName; + else + return string.Concat(prefix, ":", localName); + } + + private static string GetWhatWasFound(XmlDictionaryReader reader) + { + if (reader.EOF) + return SR.XmlFoundEndOfFile; + switch (reader.NodeType) + { + case XmlNodeType.Element: + return string.Format(SR.XmlFoundElement, GetName(reader.Prefix, reader.LocalName), reader.NamespaceURI); + case XmlNodeType.EndElement: + return string.Format(SR.XmlFoundEndElement, GetName(reader.Prefix, reader.LocalName), reader.NamespaceURI); + case XmlNodeType.Text: + case XmlNodeType.Whitespace: + case XmlNodeType.SignificantWhitespace: + return string.Format(SR.XmlFoundText, reader.Value); + case XmlNodeType.Comment: + return string.Format(SR.XmlFoundComment, reader.Value); + case XmlNodeType.CDATA: + return string.Format(SR.XmlFoundCData, reader.Value); + } + return string.Format(SR.XmlFoundNodeType, reader.NodeType); + } + + static public void ThrowStartElementExpected(XmlDictionaryReader reader) + { + ThrowXmlException(reader, SR.XmlStartElementExpected, GetWhatWasFound(reader)); + } + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs new file mode 100644 index 0000000000..ca308a4522 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItem.cs @@ -0,0 +1,318 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Threading.Tasks; + using System.Xml; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class SyndicationItem : IExtensibleSyndicationObject + { + private Collection _authors; + private Uri _baseUri; + private Collection _categories; + private SyndicationContent _content; + private Collection _contributors; + private TextSyndicationContent _copyright; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private string _id; + private DateTimeOffset _lastUpdatedTime; + private Collection _links; + private DateTimeOffset _publishDate; + private SyndicationFeed _sourceFeed; + private TextSyndicationContent _summary; + private TextSyndicationContent _title; + + public SyndicationItem() + : this(null, null, null) + { + } + + public SyndicationItem(string title, string content, Uri itemAlternateLink) + : this(title, content, itemAlternateLink, null, DateTimeOffset.MinValue) + { + } + + public SyndicationItem(string title, string content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime) + : this(title, (content != null) ? new TextSyndicationContent(content) : null, itemAlternateLink, id, lastUpdatedTime) + { + } + + public SyndicationItem(string title, SyndicationContent content, Uri itemAlternateLink, string id, DateTimeOffset lastUpdatedTime) + { + if (title != null) + { + this.Title = new TextSyndicationContent(title); + } + + _content = content; + if (itemAlternateLink != null) + { + this.Links.Add(SyndicationLink.CreateAlternateLink(itemAlternateLink)); + } + _id = id; + _lastUpdatedTime = lastUpdatedTime; + } + + protected SyndicationItem(SyndicationItem source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _extensions = source._extensions.Clone(); + _authors = FeedUtils.ClonePersons(source._authors); + _categories = FeedUtils.CloneCategories(source._categories); + _content = (source._content != null) ? source._content.Clone() : null; + _contributors = FeedUtils.ClonePersons(source._contributors); + _copyright = FeedUtils.CloneTextContent(source._copyright); + _id = source._id; + _lastUpdatedTime = source._lastUpdatedTime; + _links = FeedUtils.CloneLinks(source._links); + _publishDate = source._publishDate; + if (source.SourceFeed != null) + { + _sourceFeed = source._sourceFeed.Clone(false); + _sourceFeed.Items = new Collection(); + } + _summary = FeedUtils.CloneTextContent(source._summary); + _baseUri = source._baseUri; + _title = FeedUtils.CloneTextContent(source._title); + } + + public Dictionary AttributeExtensions + { + get { return _extensions.AttributeExtensions; } + } + + public Collection Authors + { + get + { + if (_authors == null) + { + _authors = new NullNotAllowedCollection(); + } + return _authors; + } + } + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public Collection Categories + { + get + { + if (_categories == null) + { + _categories = new NullNotAllowedCollection(); + } + return _categories; + } + } + + public SyndicationContent Content + { + get { return _content; } + set { _content = value; } + } + + public Collection Contributors + { + get + { + if (_contributors == null) + { + _contributors = new NullNotAllowedCollection(); + } + return _contributors; + } + } + + public TextSyndicationContent Copyright + { + get { return _copyright; } + set { _copyright = value; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get { return _extensions.ElementExtensions; } + } + + public string Id + { + get { return _id; } + set { _id = value; } + } + + public DateTimeOffset LastUpdatedTime + { + get { return _lastUpdatedTime; } + set { _lastUpdatedTime = value; } + } + + public Collection Links + { + get + { + if (_links == null) + { + _links = new NullNotAllowedCollection(); + } + return _links; + } + } + + public DateTimeOffset PublishDate + { + get { return _publishDate; } + set { _publishDate = value; } + } + + public SyndicationFeed SourceFeed + { + get { return _sourceFeed; } + set { _sourceFeed = value; } + } + + public TextSyndicationContent Summary + { + get { return _summary; } + set { _summary = value; } + } + + public TextSyndicationContent Title + { + get { return _title; } + set { _title = value; } + } + + public static Task LoadAsync(XmlReader reader) + { + return LoadAsync(reader); + } + + public static async Task LoadAsync(XmlReader reader) + where TSyndicationItem : SyndicationItem, new() + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + Rss20ItemFormatter rssSerializer = new Rss20ItemFormatter(); + + if (rssSerializer.CanRead(reader)) + { + await rssSerializer.ReadFromAsync(reader); + return rssSerializer.Item as TSyndicationItem; + } + + throw new XmlException(string.Format(SR.UnknownItemXml, reader.LocalName, reader.NamespaceURI)); + } + + + public void AddPermalink(Uri permalink) + { + if (permalink == null) + { + throw new ArgumentNullException(nameof(permalink)); + } + this.Id = permalink.AbsoluteUri; + this.Links.Add(SyndicationLink.CreateAlternateLink(permalink)); + } + + public virtual SyndicationItem Clone() + { + return new SyndicationItem(this); + } + + public Atom10ItemFormatter GetAtom10Formatter() + { + return new Atom10ItemFormatter(this); + } + + public Rss20ItemFormatter GetRss20Formatter() + { + return GetRss20Formatter(true); + } + + public Rss20ItemFormatter GetRss20Formatter(bool serializeExtensionsAsAtom) + { + return new Rss20ItemFormatter(this, serializeExtensionsAsAtom); + } + + public Task SaveAsAtom10(XmlWriter writer) + { + return GetAtom10Formatter().WriteToAsync(writer); + } + + public Task SaveAsRss20(XmlWriter writer) + { + return GetRss20Formatter().WriteToAsync(writer); + } + + protected internal virtual SyndicationCategory CreateCategory() + { + return new SyndicationCategory(); + } + + protected internal virtual SyndicationLink CreateLink() + { + return new SyndicationLink(); + } + + protected internal virtual SyndicationPerson CreatePerson() + { + return new SyndicationPerson(); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseContent(XmlReader reader, string contentType, string version, out SyndicationContent content) + { + content = null; + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} + + diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs new file mode 100644 index 0000000000..4483f94ba0 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationItemFormatter.cs @@ -0,0 +1,220 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Globalization; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + + [DataContract] + public abstract class SyndicationItemFormatter + { + private SyndicationItem _item; + + protected SyndicationItemFormatter() + { + _item = null; + } + + protected SyndicationItemFormatter(SyndicationItem itemToWrite) + { + if (itemToWrite == null) + { + throw new ArgumentNullException(nameof(itemToWrite)); + } + _item = itemToWrite; + } + + public SyndicationItem Item + { + get + { + return _item; + } + } + + public abstract String Version + { get; } + + public abstract bool CanRead(XmlReader reader); + + public abstract Task ReadFromAsync(XmlReader reader); + + public override string ToString() + { + return string.Format(CultureInfo.CurrentCulture, "{0}, SyndicationVersion={1}", this.GetType(), this.Version); + } + + public abstract Task WriteToAsync(XmlWriter writer); + + internal protected virtual void SetItem(SyndicationItem item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + _item = item; + } + + internal static SyndicationItem CreateItemInstance(Type itemType) + { + if (itemType.Equals(typeof(SyndicationItem))) + { + return new SyndicationItem(); + } + else + { + return (SyndicationItem)Activator.CreateInstance(itemType); + } + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationItem item) + { + SyndicationFeedFormatter.LoadElementExtensions(buffer, writer, item); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationCategory category) + { + SyndicationFeedFormatter.LoadElementExtensions(buffer, writer, category); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationLink link) + { + SyndicationFeedFormatter.LoadElementExtensions(buffer, writer, link); + } + + internal static void LoadElementExtensions(XmlBuffer buffer, XmlDictionaryWriter writer, SyndicationPerson person) + { + SyndicationFeedFormatter.LoadElementExtensions(buffer, writer, person); + } + + protected static SyndicationCategory CreateCategory(SyndicationItem item) + { + return SyndicationFeedFormatter.CreateCategory(item); + } + + protected static SyndicationLink CreateLink(SyndicationItem item) + { + return SyndicationFeedFormatter.CreateLink(item); + } + + protected static SyndicationPerson CreatePerson(SyndicationItem item) + { + return SyndicationFeedFormatter.CreatePerson(item); + } + + protected static void LoadElementExtensions(XmlReader reader, SyndicationItem item, int maxExtensionSize) + { + SyndicationFeedFormatter.LoadElementExtensions(reader, item, maxExtensionSize); + } + + protected static void LoadElementExtensions(XmlReader reader, SyndicationCategory category, int maxExtensionSize) + { + SyndicationFeedFormatter.LoadElementExtensions(reader, category, maxExtensionSize); + } + + protected static void LoadElementExtensions(XmlReader reader, SyndicationLink link, int maxExtensionSize) + { + SyndicationFeedFormatter.LoadElementExtensions(reader, link, maxExtensionSize); + } + + protected static void LoadElementExtensions(XmlReader reader, SyndicationPerson person, int maxExtensionSize) + { + SyndicationFeedFormatter.LoadElementExtensions(reader, person, maxExtensionSize); + } + + protected static bool TryParseAttribute(string name, string ns, string value, SyndicationItem item, string version) + { + return SyndicationFeedFormatter.TryParseAttribute(name, ns, value, item, version); + } + + protected static bool TryParseAttribute(string name, string ns, string value, SyndicationCategory category, string version) + { + return SyndicationFeedFormatter.TryParseAttribute(name, ns, value, category, version); + } + + protected static bool TryParseAttribute(string name, string ns, string value, SyndicationLink link, string version) + { + return SyndicationFeedFormatter.TryParseAttribute(name, ns, value, link, version); + } + + protected static bool TryParseAttribute(string name, string ns, string value, SyndicationPerson person, string version) + { + return SyndicationFeedFormatter.TryParseAttribute(name, ns, value, person, version); + } + + + protected static bool TryParseContent(XmlReader reader, SyndicationItem item, string contentType, string version, out SyndicationContent content) + { + return SyndicationFeedFormatter.TryParseContent(reader, item, contentType, version, out content); + } + + + protected static bool TryParseElement(XmlReader reader, SyndicationItem item, string version) + { + return SyndicationFeedFormatter.TryParseElement(reader, item, version); + } + + protected static bool TryParseElement(XmlReader reader, SyndicationCategory category, string version) + { + return SyndicationFeedFormatter.TryParseElement(reader, category, version); + } + + protected static bool TryParseElement(XmlReader reader, SyndicationLink link, string version) + { + return SyndicationFeedFormatter.TryParseElement(reader, link, version); + } + + protected static bool TryParseElement(XmlReader reader, SyndicationPerson person, string version) + { + return SyndicationFeedFormatter.TryParseElement(reader, person, version); + } + + protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationItem item, string version) + { + await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, item, version); + } + + protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version) + { + await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, category, version); + } + + protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationLink link, string version) + { + await SyndicationFeedFormatter.WriteAttributeExtensions(writer, link, version); + } + + protected static async Task WriteAttributeExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version) + { + await SyndicationFeedFormatter.WriteAttributeExtensionsAsync(writer, person, version); + } + + protected static async Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationItem item, string version) + { + await SyndicationFeedFormatter.WriteElementExtensionsAsync(writer, item, version); + } + + protected abstract SyndicationItem CreateItemInstance(); + + protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationCategory category, string version) + { + return SyndicationFeedFormatter.WriteElementExtensionsAsync(writer, category, version); + } + + protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationLink link, string version) + { + return SyndicationFeedFormatter.WriteElementExtensionsAsync(writer, link, version); + } + + protected Task WriteElementExtensionsAsync(XmlWriter writer, SyndicationPerson person, string version) + { + return SyndicationFeedFormatter.WriteElementExtensionsAsync(writer, person, version); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs new file mode 100644 index 0000000000..9743cb0cb9 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationLink.cs @@ -0,0 +1,199 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class SyndicationLink : IExtensibleSyndicationObject + { + private Uri _baseUri; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private long _length; + private string _mediaType; + private string _relationshipType; + private string _title; + private Uri _uri; + + public SyndicationLink(Uri uri) + : this(uri, null, null, null, 0) + { + } + + public SyndicationLink(Uri uri, string relationshipType, string title, string mediaType, long length) + { + if (length < 0) + { + throw new ArgumentOutOfRangeException(nameof(length)); + } + _baseUri = null; + _uri = uri; + _title = title; + _relationshipType = relationshipType; + _mediaType = mediaType; + _length = length; + } + + public SyndicationLink() + : this(null, null, null, null, 0) + { + } + + protected SyndicationLink(SyndicationLink source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _length = source._length; + _mediaType = source._mediaType; + _relationshipType = source._relationshipType; + _title = source._title; + _baseUri = source._baseUri; + _uri = source._uri; + _extensions = source._extensions.Clone(); + } + + public Dictionary AttributeExtensions + { + get { return _extensions.AttributeExtensions; } + } + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get { return _extensions.ElementExtensions; } + } + + public long Length + { + get { return _length; } + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(value)); + } + _length = value; + } + } + + public string MediaType + { + get { return _mediaType; } + set { _mediaType = value; } + } + + public string RelationshipType + { + get { return _relationshipType; } + set { _relationshipType = value; } + } + + public string Title + { + get { return _title; } + set { _title = value; } + } + + public Uri Uri + { + get { return _uri; } + set { _uri = value; } + } + + public static SyndicationLink CreateAlternateLink(Uri uri) + { + return CreateAlternateLink(uri, null); + } + + public static SyndicationLink CreateAlternateLink(Uri uri, string mediaType) + { + return new SyndicationLink(uri, Atom10Constants.AlternateTag, null, mediaType, 0); + } + + public static SyndicationLink CreateMediaEnclosureLink(Uri uri, string mediaType, long length) + { + return new SyndicationLink(uri, Rss20Constants.EnclosureTag, null, mediaType, length); + } + + public static SyndicationLink CreateSelfLink(Uri uri) + { + return CreateSelfLink(uri, null); + } + + public static SyndicationLink CreateSelfLink(Uri uri, string mediaType) + { + return new SyndicationLink(uri, Atom10Constants.SelfTag, null, mediaType, 0); + } + + public virtual SyndicationLink Clone() + { + return new SyndicationLink(this); + } + + public Uri GetAbsoluteUri() + { + if (_uri != null) + { + if (_uri.IsAbsoluteUri) + { + return _uri; + } + else if (_baseUri != null) + { + return new Uri(_baseUri, _uri); + } + else + { + return null; + } + } + else + { + return null; + } + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs new file mode 100644 index 0000000000..e69a76f300 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationPerson.cs @@ -0,0 +1,116 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class SyndicationPerson : IExtensibleSyndicationObject + { + private string _email; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private string _name; + private string _uri; + + public SyndicationPerson() + : this((string)null) + { + } + + public SyndicationPerson(string email) + : this(email, null, null) + { + } + + [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "2#", Justification = "The Uri represents a unique category and not a network location")] + public SyndicationPerson(string email, string name, string uri) + { + _name = name; + _email = email; + _uri = uri; + } + + protected SyndicationPerson(SyndicationPerson source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _email = source._email; + _name = source._name; + _uri = source._uri; + _extensions = source._extensions.Clone(); + } + + public Dictionary AttributeExtensions + { + get { return _extensions.AttributeExtensions; } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get { return _extensions.ElementExtensions; } + } + + public string Email + { + get { return _email; } + set { _email = value; } + } + + public string Name + { + get { return _name; } + set { _name = value; } + } + + [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Scope = "property", Justification = "The Uri represents a unique category and not a network location")] + public string Uri + { + get { return _uri; } + set { _uri = value; } + } + + public virtual SyndicationPerson Clone() + { + return new SyndicationPerson(this); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReader readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationTextInput.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationTextInput.cs new file mode 100644 index 0000000000..d0c8d2f34a --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationTextInput.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + public class SyndicationTextInput + { + public string Description; + public string title; + public SyndicationLink link; + public string name; + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs new file mode 100644 index 0000000000..cca8ac3133 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/SyndicationVersions.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System.Runtime.CompilerServices; + + public static class SyndicationVersions + { + public const string Atom10 = "Atom10"; + public const string Rss20 = "Rss20"; + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs new file mode 100644 index 0000000000..7953f66636 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContent.cs @@ -0,0 +1,81 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Runtime.CompilerServices; + using System.Xml; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class TextSyndicationContent : SyndicationContent + { + private string _text; + private TextSyndicationContentKind _textKind; + + public TextSyndicationContent(string text) : this(text, TextSyndicationContentKind.Plaintext) + { + } + + public TextSyndicationContent(string text, TextSyndicationContentKind textKind) + { + if (!TextSyndicationContentKindHelper.IsDefined(textKind)) + { + throw new ArgumentOutOfRangeException(nameof(textKind)); + } + _text = text; + _textKind = textKind; + } + + protected TextSyndicationContent(TextSyndicationContent source) + : base(source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _text = source._text; + _textKind = source._textKind; + } + + public string Text + { + get { return _text; } + } + + public override string Type + { + get + { + switch (_textKind) + { + case TextSyndicationContentKind.Html: + return Atom10Constants.HtmlType; + case TextSyndicationContentKind.XHtml: + return Atom10Constants.XHtmlType; + default: + return Atom10Constants.PlaintextType; + } + } + } + + public override SyndicationContent Clone() + { + return new TextSyndicationContent(this); + } + + protected override void WriteContentsTo(XmlWriter writer) + { + string val = _text ?? string.Empty; + if (_textKind == TextSyndicationContentKind.XHtml) + { + writer.WriteRaw(val); + } + else + { + writer.WriteString(val); + } + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs new file mode 100644 index 0000000000..1dda2a2e36 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKind.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System.Runtime.CompilerServices; + + public enum TextSyndicationContentKind + { + Plaintext, + Html, + XHtml + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKindHelper.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKindHelper.cs new file mode 100644 index 0000000000..2fdb263005 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/TextSyndicationContentKindHelper.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + internal static class TextSyndicationContentKindHelper + { + public static bool IsDefined(TextSyndicationContentKind kind) + { + return (kind == TextSyndicationContentKind.Plaintext + || kind == TextSyndicationContentKind.Html + || kind == TextSyndicationContentKind.XHtml); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs new file mode 100644 index 0000000000..86bce8777f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/UrlSyndicationContent.cs @@ -0,0 +1,58 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Runtime.CompilerServices; + using System.Xml; + + // NOTE: This class implements Clone so if you add any members, please update the copy ctor + public class UrlSyndicationContent : SyndicationContent + { + private string _mediaType; + private Uri _url; + + public UrlSyndicationContent(Uri url, string mediaType) : base() + { + if (url == null) + { + throw new ArgumentNullException(nameof(url)); + } + _url = url; + _mediaType = mediaType; + } + + protected UrlSyndicationContent(UrlSyndicationContent source) + : base(source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _url = source._url; + _mediaType = source._mediaType; + } + + public override string Type + { + get { return _mediaType; } + } + + public Uri Url + { + get { return _url; } + } + + public override SyndicationContent Clone() + { + return new UrlSyndicationContent(this); + } + + protected override void WriteContentsTo(XmlWriter writer) + { + writer.WriteAttributeString(Atom10Constants.SourceTag, string.Empty, FeedUtils.GetUriString(_url)); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs new file mode 100644 index 0000000000..b8d2641343 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/Workspace.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Runtime.CompilerServices; + using System.Threading.Tasks; + using System.Xml; + + public class Workspace : IExtensibleSyndicationObject + { + private Uri _baseUri; + private Collection _collections; + private ExtensibleSyndicationObject _extensions = new ExtensibleSyndicationObject(); + private TextSyndicationContent _title; + + public Workspace() + { + } + + public Workspace(string title, IEnumerable collections) + : this((title != null) ? new TextSyndicationContent(title) : null, collections) + { + } + + public Workspace(TextSyndicationContent title, IEnumerable collections) + { + _title = title; + if (collections != null) + { + _collections = new NullNotAllowedCollection(); + foreach (ResourceCollectionInfo collection in collections) + { + _collections.Add(collection); + } + } + } + + public Dictionary AttributeExtensions + { + get + { + return _extensions.AttributeExtensions; + } + } + + public Uri BaseUri + { + get { return _baseUri; } + set { _baseUri = value; } + } + + public Collection Collections + { + get + { + if (_collections == null) + { + _collections = new NullNotAllowedCollection(); + } + return _collections; + } + } + + public SyndicationElementExtensionCollection ElementExtensions + { + get + { + return _extensions.ElementExtensions; + } + } + + public TextSyndicationContent Title + { + get { return _title; } + set { _title = value; } + } + + protected internal virtual ResourceCollectionInfo CreateResourceCollection() + { + return new ResourceCollectionInfo(); + } + + protected internal virtual bool TryParseAttribute(string name, string ns, string value, string version) + { + return false; + } + + protected internal virtual bool TryParseElement(XmlReader reader, string version) + { + return false; + } + + protected internal virtual Task WriteAttributeExtensions(XmlWriter writer, string version) + { + return _extensions.WriteAttributeExtensionsAsync(writer); + } + + protected internal virtual Task WriteElementExtensionsAsync(XmlWriter writer, string version) + { + return _extensions.WriteElementExtensionsAsync(writer); + } + + internal void LoadElementExtensions(XmlReaderWrapper readerOverUnparsedExtensions, int maxExtensionSize) + { + _extensions.LoadElementExtensions(readerOverUnparsedExtensions, maxExtensionSize); + } + + internal void LoadElementExtensions(XmlBuffer buffer) + { + _extensions.LoadElementExtensions(buffer); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs new file mode 100644 index 0000000000..f7c66af2ed --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlReaderWrapper.cs @@ -0,0 +1,548 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Xml; + +namespace System.ServiceModel.Syndication +{ + internal class XmlReaderWrapper : XmlReader + { + private XmlReader _reader; + + private Func> _getValueFunc; + private Func> _moveToContentFunc; + private Func _skipFunc; + private Func> _readFunc; + private Func> _readInnerXmlFunc; + + private XmlReaderWrapper(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + + _reader = reader; + + if (_reader.Settings.Async) + { + InitAsync(); + } + else + { + Init(); + } + } + + public static XmlReaderWrapper CreateFromReader(XmlReader reader) + { + XmlReaderWrapper wrappedReader = reader as XmlReaderWrapper; + return wrappedReader != null ? wrappedReader : new XmlReaderWrapper(reader); + } + + private void InitAsync() + { + _getValueFunc = new Func>((thisPtr) => { return thisPtr._reader.GetValueAsync(); }); + _moveToContentFunc = new Func>((thisPtr) => { return thisPtr._reader.MoveToContentAsync(); }); + _skipFunc = new Func((thisPtr) => { return thisPtr._reader.SkipAsync(); }); + _readFunc = new Func>((thisPtr) => { return thisPtr._reader.ReadAsync(); }); + _readInnerXmlFunc = new Func>((thisPtr) => { return thisPtr._reader.ReadInnerXmlAsync(); }); + } + + private void Init() + { + _getValueFunc = new Func>((thisPtr) => { return Task.FromResult(thisPtr._reader.Value); }); + _moveToContentFunc = new Func>((thisPtr) => { return Task.FromResult(_reader.MoveToContent()); }); + _skipFunc = new Func((thisPtr) => { _reader.Skip(); return Task.CompletedTask; }); + _readFunc = new Func>((thisPtr) => { return Task.FromResult(_reader.Read()); }); + _readInnerXmlFunc = new Func>((thisPtr) => { return Task.FromResult(_reader.ReadInnerXml()); }); + } + + public override XmlNodeType NodeType + { + get + { + return _reader.NodeType; + } + } + + public override string LocalName + { + get + { + return _reader.LocalName; + } + } + + public override string NamespaceURI + { + get + { + return _reader.NamespaceURI; + } + } + + public override string Prefix + { + get + { + return _reader.Prefix; + } + } + + public override string Value + { + get + { + return _reader.Value; + } + } + + public override int Depth + { + get + { + return _reader.Depth; + } + } + + public override string BaseURI + { + get + { + return _reader.BaseURI; + } + } + + public override bool IsEmptyElement + { + get + { + return _reader.IsEmptyElement; + } + } + + public override int AttributeCount + { + get + { + return _reader.AttributeCount; + } + } + + public override bool EOF + { + get + { + return _reader.EOF; + } + } + + public override ReadState ReadState + { + get + { + return _reader.ReadState; + } + } + + public override XmlNameTable NameTable + { + get + { + return _reader.NameTable; + } + } + + public override string GetAttribute(string name) + { + return _reader.GetAttribute(name); + } + + public override string GetAttribute(string name, string namespaceURI) + { + return _reader.GetAttribute(name, namespaceURI); + } + + public override string GetAttribute(int i) + { + return _reader.GetAttribute(i); + } + + public override string LookupNamespace(string prefix) + { + return _reader.LookupNamespace(prefix); + } + + public override bool MoveToAttribute(string name) + { + return _reader.MoveToAttribute(name); + } + + public override bool MoveToAttribute(string name, string ns) + { + return _reader.MoveToAttribute(name, ns); + } + + public override bool MoveToElement() + { + return _reader.MoveToElement(); + } + + public override bool MoveToFirstAttribute() + { + return _reader.MoveToFirstAttribute(); + } + + public override bool MoveToNextAttribute() + { + return _reader.MoveToNextAttribute(); + } + + public override bool Read() + { + return _reader.Read(); + } + + public override bool ReadAttributeValue() + { + return _reader.ReadAttributeValue(); + } + + public override void ResolveEntity() + { + _reader.ResolveEntity(); + } + + public override Task GetValueAsync() + { + return _getValueFunc(this); + } + + public override Task MoveToContentAsync() + { + return _moveToContentFunc(this); + } + + public override Task SkipAsync() + { + return _skipFunc(this); + } + + public override Task ReadAsync() + { + return _readFunc(this); + } + + public override Task ReadInnerXmlAsync() + { + return _readInnerXmlFunc(this); + } + + public static async Task WriteNodeAsync(XmlDictionaryWriter writer, XmlReader reader, bool defattr) + { + char[] writeNodeBuffer = null; + const int WriteNodeBufferSize = 1024; + + if (null == reader) + { + throw new ArgumentNullException(nameof(reader)); + } + + bool canReadChunk = reader.CanReadValueChunk; + int d = reader.NodeType == XmlNodeType.None ? -1 : reader.Depth; + do + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI); + writer.WriteAttributes(reader, defattr); + if (reader.IsEmptyElement) + { + writer.WriteEndElement(); + break; + } + break; + case XmlNodeType.Text: + if (canReadChunk) + { + if (writeNodeBuffer == null) + { + writeNodeBuffer = new char[WriteNodeBufferSize]; + } + int read; + while ((read = reader.ReadValueChunk(writeNodeBuffer, 0, WriteNodeBufferSize)) > 0) + { + writer.WriteChars(writeNodeBuffer, 0, read); + } + } + else + { + writer.WriteString(await reader.GetValueAsync()); + } + break; + + case XmlNodeType.Whitespace: + case XmlNodeType.SignificantWhitespace: + writer.WriteWhitespace(await reader.GetValueAsync()); + break; + + case XmlNodeType.CDATA: + writer.WriteCData(await reader.GetValueAsync()); + break; + + case XmlNodeType.EntityReference: + writer.WriteEntityRef(reader.Name); + break; + + case XmlNodeType.XmlDeclaration: + case XmlNodeType.ProcessingInstruction: + writer.WriteProcessingInstruction(reader.Name, await reader.GetValueAsync()); + break; + + case XmlNodeType.DocumentType: + writer.WriteDocType(reader.Name, reader.GetAttribute("PUBLIC"), reader.GetAttribute("SYSTEM"), await reader.GetValueAsync()); + break; + + case XmlNodeType.Comment: + writer.WriteComment(await reader.GetValueAsync()); + break; + + case XmlNodeType.EndElement: + writer.WriteFullEndElement(); + break; + } + } while (await reader.ReadAsync() && (d < reader.Depth || (d == reader.Depth && reader.NodeType == XmlNodeType.EndElement))); + } + } + + internal static class XmlReaderExtensions + { + private const uint IsTextualNodeBitmap = 0x6018; // 00 0110 0000 0001 1000 + + public static async Task ReadStartElementAsync(this XmlReader reader) + { + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + throw new InvalidOperationException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + } + + await reader.ReadAsync(); + } + + public static async Task ReadElementStringAsync(this XmlReader reader) + { + string result = string.Empty; + + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + //throw new XmlException(Res.Xml_InvalidNodeType, this.NodeType.ToString(), this as IXmlLineInfo); + throw new InvalidOperationException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + } + if (!reader.IsEmptyElement) + { + await reader.ReadAsync(); + result = reader.ReadString(); + if (reader.NodeType != XmlNodeType.EndElement) + { + throw new XmlException(); + throw new XmlException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + //throw new XmlException(Res.Xml_UnexpectedNodeInSimpleContent, new string[] { this.NodeType.ToString(), "ReadElementString" }, this as IXmlLineInfo); + } + await reader.ReadAsync(); + } + else + { + await reader.ReadAsync(); + } + return result; + } + + public static async Task ReadStringAsync(this XmlReader reader) + { + if (reader.ReadState != ReadState.Interactive) + { + return string.Empty; + } + reader.MoveToElement(); + if (reader.NodeType == XmlNodeType.Element) + { + if (reader.IsEmptyElement) + { + return string.Empty; + } + else if (!await reader.ReadAsync()) + { + throw new XmlException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + //throw new InvalidOperationException(Res.GetString(Res.Xml_InvalidOperation)); + } + if (reader.NodeType == XmlNodeType.EndElement) + { + return string.Empty; + } + } + string result = string.Empty; + while (IsTextualNode(reader.NodeType)) + { + result += await reader.GetValueAsync(); + if (!await reader.ReadAsync()) + { + break; + } + } + return result; + } + + static internal bool IsTextualNode(XmlNodeType nodeType) + { +#if DEBUG + // This code verifies IsTextualNodeBitmap mapping of XmlNodeType to a bool specifying + // whether the node is 'textual' = Text, CDATA, Whitespace or SignificantWhitespace. + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.None))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Element))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Attribute))); + Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Text))); + Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.CDATA))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.EntityReference))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Entity))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Comment))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Document))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentType))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentFragment))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Notation))); + Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.Whitespace))); + Debug.Assert(0 != (IsTextualNodeBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.EndElement))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.EndEntity))); + Debug.Assert(0 == (IsTextualNodeBitmap & (1 << (int)XmlNodeType.XmlDeclaration))); +#endif + return 0 != (IsTextualNodeBitmap & (1 << (int)nodeType)); + } + + public static async Task ReadEndElementAsync(this XmlReader reader) + { + if (await reader.MoveToContentAsync() != XmlNodeType.EndElement) + { + throw new XmlException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + //throw new XmlException(Res.Xml_InvalidNodeType, this.NodeType.ToString(), this as IXmlLineInfo); + } + await reader.ReadAsync(); + } + + public static async Task ReadStartElementAsync(this XmlReader reader, string localname, string ns) + { + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + //throw new XmlException(Res.Xml_InvalidNodeType, this.NodeType.ToString(), this as IXmlLineInfo); + throw new XmlException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + } + if (reader.LocalName == localname && reader.NamespaceURI == ns) + { + await reader.ReadAsync(); + } + else + { + throw new XmlException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + //throw new XmlException(Res.Xml_ElementNotFoundNs, new string[2] { localname, ns }, this as IXmlLineInfo); + } + } + + public static async Task IsStartElementAsync(this XmlReader reader) + { + return await reader.MoveToContentAsync() == XmlNodeType.Element; + } + + public static async Task IsStartElementAsync(this XmlReader reader, string localname, string ns) + { + return (await reader.MoveToContentAsync() == XmlNodeType.Element) && (reader.LocalName == localname && reader.NamespaceURI == ns); + } + + private static async Task ReadStartElementAsync(this XmlReader reader, string name) + { + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + throw new InvalidOperationException(reader.NodeType.ToString() + " is an invalid XmlNodeType"); + } + if (reader.Name == name) + { + await reader.ReadAsync(); + } + else + { + throw new InvalidOperationException("name doesn\u2019t match"); + } + } + + private static async Task IsStartElementAsync(this XmlReader reader, string name) + { + return await reader.MoveToContentAsync() == XmlNodeType.Element && reader.Name == name; + } + + private static async Task ReadElementStringAsync(this XmlReader reader, string name) + { + string result = string.Empty; + + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + throw new XmlException("InvalidNodeType"); + } + if (reader.Name != name) + { + throw new XmlException("ElementNotFound"); + } + + if (!reader.IsEmptyElement) + { + result = await ReadStringAsync(reader); + + if (reader.NodeType != XmlNodeType.EndElement) + { + throw new XmlException("InvalidNodeType"); + } + await reader.ReadAsync(); + } + else + { + await reader.ReadAsync(); + } + return result; + } + + private static async Task ReadElementStringAsync(XmlReader reader, string localname, string ns) + { + string result = string.Empty; + + if (await reader.MoveToContentAsync() != XmlNodeType.Element) + { + throw new XmlException("InvalidNodeType"); + } + + if (reader.LocalName != localname || reader.NamespaceURI != ns) + { + throw new XmlException("ElementNotFound"); + } + + if (!reader.IsEmptyElement) + { + result = await ReadStringAsync(reader); + + if (reader.NodeType != XmlNodeType.EndElement) + { + throw new XmlException("InvalidNodeType"); + } + await reader.ReadAsync(); + } + else + { + await reader.ReadAsync(); + } + return result; + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs new file mode 100644 index 0000000000..a50234921a --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlSyndicationContent.cs @@ -0,0 +1,210 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel.Syndication +{ + using System; + using System.Diagnostics; + using System.Runtime.CompilerServices; + using System.Runtime.Serialization; + using System.Threading.Tasks; + using System.Xml; + using System.Xml.Serialization; + + public class XmlSyndicationContent : SyndicationContent + { + private XmlBuffer _contentBuffer; + private SyndicationElementExtension _extension; + private string _type; + + // Saves the element in the reader to the buffer (attributes preserved) + // Type is populated from type attribute on reader + // Reader must be positioned at an element + public XmlSyndicationContent(XmlReader reader) + { + if (reader == null) + { + throw new ArgumentNullException(nameof(reader)); + } + SyndicationFeedFormatter.MoveToStartElement(reader); + if (reader.HasAttributes) + { + while (reader.MoveToNextAttribute()) + { + string name = reader.LocalName; + string ns = reader.NamespaceURI; + string value = reader.Value; + if (name == Atom10Constants.TypeTag && ns == string.Empty) + { + _type = value; + } + else if (!FeedUtils.IsXmlns(name, ns)) + { + base.AttributeExtensions.Add(new XmlQualifiedName(name, ns), value); + } + } + reader.MoveToElement(); + } + _type = string.IsNullOrEmpty(_type) ? Atom10Constants.XmlMediaType : _type; + _contentBuffer = new XmlBuffer(int.MaxValue); + using (XmlDictionaryWriter writer = _contentBuffer.OpenSection(XmlDictionaryReaderQuotas.Max)) + { + writer.WriteNode(reader, false); + } + _contentBuffer.CloseSection(); + _contentBuffer.Close(); + } + + public XmlSyndicationContent(string type, object dataContractExtension, XmlObjectSerializer dataContractSerializer) + { + _type = string.IsNullOrEmpty(type) ? Atom10Constants.XmlMediaType : type; + _extension = new SyndicationElementExtension(dataContractExtension, dataContractSerializer); + } + + public XmlSyndicationContent(string type, object xmlSerializerExtension, XmlSerializer serializer) + { + _type = string.IsNullOrEmpty(type) ? Atom10Constants.XmlMediaType : type; + _extension = new SyndicationElementExtension(xmlSerializerExtension, serializer); + } + + public XmlSyndicationContent(string type, SyndicationElementExtension extension) + { + if (extension == null) + { + throw new ArgumentNullException(nameof(extension)); + } + _type = string.IsNullOrEmpty(type) ? Atom10Constants.XmlMediaType : type; + _extension = extension; + } + + protected XmlSyndicationContent(XmlSyndicationContent source) + : base(source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + _contentBuffer = source._contentBuffer; + _extension = source._extension; + _type = source._type; + } + + public SyndicationElementExtension Extension + { + get + { + return _extension; + } + } + + public override string Type + { + get { return _type; } + } + + public override SyndicationContent Clone() + { + return new XmlSyndicationContent(this); + } + + public async Task GetReaderAtContent() + { + await EnsureContentBufferAsync(); + return _contentBuffer.GetReader(0); + } + + public Task ReadContent() + { + return ReadContent((DataContractSerializer)null); + } + + public async Task ReadContent(XmlObjectSerializer dataContractSerializer) + { + if (dataContractSerializer == null) + { + dataContractSerializer = new DataContractSerializer(typeof(TContent)); + } + if (_extension != null) + { + return await _extension.GetObject(dataContractSerializer); + } + else + { + Debug.Assert(_contentBuffer != null, "contentBuffer cannot be null"); + using (XmlDictionaryReader reader = _contentBuffer.GetReader(0)) + { + // skip past the content element + reader.ReadStartElement(); + return (TContent)dataContractSerializer.ReadObject(reader, false); + } + } + } + + public Task ReadContent(XmlSerializer serializer) + { + if (serializer == null) + { + serializer = new XmlSerializer(typeof(TContent)); + } + if (_extension != null) + { + return _extension.GetObject(serializer); + } + else + { + Debug.Assert(_contentBuffer != null, "contentBuffer cannot be null"); + using (XmlDictionaryReader reader = _contentBuffer.GetReader(0)) + { + // skip past the content element + reader.ReadStartElement(); + return Task.FromResult((TContent)serializer.Deserialize(reader)); + //return (TContent)serializer.Deserialize(reader); + } + } + } + + // does not write start element or type attribute, writes other attributes and rest of content + protected override void WriteContentsTo(XmlWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + if (_extension != null) + { + _extension.WriteToAsync(writer).GetAwaiter().GetResult(); + } + else if (_contentBuffer != null) + { + using (XmlDictionaryReader reader = _contentBuffer.GetReader(0)) + { + reader.MoveToStartElement(); + if (!reader.IsEmptyElement) + { + reader.ReadStartElement(); + while (reader.Depth >= 1 && reader.ReadState == ReadState.Interactive) + { + writer.WriteNode(reader, false); + } + } + } + } + } + + private async Task EnsureContentBufferAsync() + { + if (_contentBuffer == null) + { + XmlBuffer tmp = new XmlBuffer(int.MaxValue); + using (XmlDictionaryWriter writer = tmp.OpenSection(XmlDictionaryReaderQuotas.Max)) + { + await this.WriteToAsync(writer, Atom10Constants.ContentTag, Atom10Constants.Atom10Namespace); + } + tmp.CloseSection(); + tmp.Close(); + _contentBuffer = tmp; + } + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs new file mode 100644 index 0000000000..232d25161e --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/XmlWriterWrapper.cs @@ -0,0 +1,271 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading.Tasks; +using System.Xml; + +namespace System.ServiceModel.Syndication +{ + internal class XmlWriterWrapper : XmlWriter + { + private XmlWriter _writer; + + private Func _writeStringFunc; + private Func _writeStartElementFunc2; + private Func _writeEndElementFunc; + private Func _writeAttributeStringFunc2; + private Func _writeAttributeStringFunc3; + private Func _writeAttributeStringFunc4; + private Func _writeNodeFunc; + + + private void InitAsync() + { + _writeStringFunc = new Func((thisPtr, text) => { return thisPtr._writer.WriteStringAsync(text); }); + _writeStartElementFunc2 = new Func((thisPtr, localName, ns) => { return _writer.WriteStartElementAsync("", localName, ns); }); + _writeEndElementFunc = new Func((thisPtr) => { return thisPtr._writer.WriteEndElementAsync(); }); + _writeAttributeStringFunc2 = new Func((thisPtr, localname, value) => { return thisPtr._writer.WriteAttributeStringAsync("", localname, "", value); }); + _writeAttributeStringFunc3 = new Func((thisPtr, localName, ns, value) => { return thisPtr._writer.WriteAttributeStringAsync("", localName, ns, value); }); + _writeAttributeStringFunc4 = new Func((thisPtr, prefix, localName, ns, value) => { return thisPtr._writer.WriteAttributeStringAsync(prefix, localName, ns, value); }); + _writeNodeFunc = new Func((thisPtr, reader, defattr) => { return thisPtr._writer.WriteNodeAsync(reader, defattr); }); + } + + private void Init() + { + _writeStringFunc = new Func((thisPtr, text) => { thisPtr._writer.WriteString(text); return Task.CompletedTask; }); + _writeStartElementFunc2 = new Func((thisPtr, localName, ns) => { _writer.WriteStartElement(localName, ns); return Task.CompletedTask; }); + _writeEndElementFunc = new Func((thisPtr) => { thisPtr._writer.WriteEndElement(); return Task.CompletedTask; }); + _writeAttributeStringFunc2 = new Func((thisPtr, localname, value) => { thisPtr._writer.WriteAttributeString("", localname, "", value); return Task.CompletedTask; }); + _writeAttributeStringFunc3 = new Func((thisPtr, localName, ns, value) => { thisPtr._writer.WriteAttributeString(localName, ns, value); return Task.CompletedTask; }); + _writeAttributeStringFunc4 = new Func((thisPtr, prefix, localName, ns, value) => { thisPtr._writer.WriteAttributeString(prefix, localName, ns, value); return Task.CompletedTask; }); + _writeNodeFunc = new Func((thisPtr, reader, defattr) => { thisPtr._writer.WriteNode(reader, defattr); return Task.CompletedTask; }); + } + + public static XmlWriter CreateFromWriter(XmlWriter writer) + { + if (writer is XmlWriterWrapper || writer.Settings.Async) + { + return writer; + } + + return new XmlWriterWrapper(writer); + } + + + public XmlWriterWrapper(XmlWriter writer) + { + if (writer == null) + throw new ArgumentNullException(nameof(writer)); + + _writer = writer; + + if (_writer.Settings.Async) + { + InitAsync(); + } + else + { + Init(); + } + } + + // wrapper methods + + public override Task WriteNodeAsync(XmlReader reader, bool defattr) + { + return _writeNodeFunc(this, reader, defattr); + } + + public override Task WriteStringAsync(string text) + { + return _writeStringFunc(this, text); + } + + public override Task WriteStartElementAsync(string prefix, string localName, string ns) + { + _writer.WriteStartElement(prefix, localName, ns); + return Task.CompletedTask; + } + + public override Task WriteEndElementAsync() + { + return _writeEndElementFunc(this); + } + + public override Task WriteAttributesAsync(XmlReader reader, bool defattr) + { + _writer.WriteAttributes(reader, defattr); + return Task.CompletedTask; + } + + // inherited methods + public override WriteState WriteState + { + get + { + return _writer.WriteState; + } + } + + public override void Flush() + { + _writer.Flush(); + } + + public override string LookupPrefix(string ns) + { + return _writer.LookupPrefix(ns); + } + + public override void WriteBase64(byte[] buffer, int index, int count) + { + _writer.WriteBase64(buffer, index, count); + } + + public override void WriteCData(string text) + { + _writer.WriteCData(text); + } + + public override void WriteCharEntity(char ch) + { + _writer.WriteCharEntity(ch); + } + + public override void WriteChars(char[] buffer, int index, int count) + { + _writer.WriteChars(buffer, index, count); + } + + public override void WriteComment(string text) + { + _writer.WriteComment(text); + } + + public override void WriteDocType(string name, string pubid, string sysid, string subset) + { + _writer.WriteDocType(name, pubid, sysid, subset); + } + + public override void WriteEndAttribute() + { + _writer.WriteEndAttribute(); + } + + public override void WriteEndDocument() + { + _writer.WriteEndDocument(); + } + + public override void WriteEndElement() + { + _writer.WriteEndElement(); + } + + public override void WriteEntityRef(string name) + { + _writer.WriteEntityRef(name); + } + + public override void WriteFullEndElement() + { + _writer.WriteFullEndElement(); + } + + public override void WriteProcessingInstruction(string name, string text) + { + _writer.WriteProcessingInstruction(name, text); + } + + public override void WriteRaw(char[] buffer, int index, int count) + { + _writer.WriteRaw(buffer, index, count); + } + + public override void WriteRaw(string data) + { + _writer.WriteRaw(data); + } + + public override void WriteStartAttribute(string prefix, string localName, string ns) + { + _writer.WriteStartAttribute(prefix, localName, ns); + } + + public override void WriteStartDocument() + { + _writer.WriteStartDocument(); + } + + public override void WriteStartDocument(bool standalone) + { + _writer.WriteStartDocument(standalone); + } + + public override void WriteStartElement(string prefix, string localName, string ns) + { + _writer.WriteStartElement(prefix, localName, ns); + } + + public override void WriteString(string text) + { + _writer.WriteString(text); + } + + public override void WriteSurrogateCharEntity(char lowChar, char highChar) + { + _writer.WriteSurrogateCharEntity(lowChar, highChar); + } + + public override void WriteWhitespace(string ws) + { + _writer.WriteWhitespace(ws); + } + } + + internal static class XmlWriterExtensions + { + public static Task WriteStartElementAsync(this XmlWriter writer, string localName) + { + return writer.WriteStartElementAsync(null, localName, (string)null); + } + + public static Task WriteStartElementAsync(this XmlWriter writer, string localName, string ns) + { + return writer.WriteStartElementAsync(null, localName, ns); + } + + public static Task WriteElementStringAsync(this XmlWriter writer, string localName, string value) + { + return writer.WriteElementStringAsync(null, localName, null, value); + } + + public static Task WriteElementStringAsync(this XmlWriter writer, string localName, string ns, string value) + { + return writer.WriteElementStringAsync(null, localName, ns, value); + } + + public static Task WriteAttributeStringAsync(this XmlWriter writer, string localName, string ns, string value) + { + return writer.InternalWriteAttributeStringAsync(null, localName, ns, value); + } + + public static Task WriteAttributeStringAsync(this XmlWriter writer, string localName, string value) + { + return writer.InternalWriteAttributeStringAsync(null, localName, null, value); + } + + public static Task InternalWriteAttributeStringAsync(this XmlWriter writer, string prefix, string localName, string ns, string value) + { + if (writer is XmlWriterWrapper) + { + writer.WriteAttributeString(prefix, localName, ns, value); + return Task.CompletedTask; + } + + return writer.WriteAttributeStringAsync(prefix, localName, ns, value); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/XmlBuffer.cs b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/XmlBuffer.cs new file mode 100644 index 0000000000..6fee3f374b --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/src/System/ServiceModel/XmlBuffer.cs @@ -0,0 +1,151 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceModel +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Xml; + + internal class XmlBuffer + { + private List
_sections; + private byte[] _buffer; + private int _offset; + private BufferedStream _stream; + private BufferState _bufferState; + private XmlDictionaryWriter _writer; + private XmlDictionaryReaderQuotas _quotas; + + private enum BufferState + { + Created, + Writing, + Reading, + } + + private struct Section + { + private int _offset; + private int _size; + private XmlDictionaryReaderQuotas _quotas; + + public Section(int offset, int size, XmlDictionaryReaderQuotas quotas) + { + _offset = offset; + _size = size; + _quotas = quotas; + } + + public int Offset + { + get { return _offset; } + } + + public int Size + { + get { return _size; } + } + + public XmlDictionaryReaderQuotas Quotas + { + get { return _quotas; } + } + } + + public XmlBuffer(int maxBufferSize) + { + if (maxBufferSize < 0) + throw new ArgumentOutOfRangeException(nameof(maxBufferSize), maxBufferSize, SR.ValueMustBeNonNegative); + + int initialBufferSize = Math.Min(512, maxBufferSize); + _stream = new BufferedStream(new MemoryStream(), initialBufferSize); + _sections = new List
(1); + } + + public int BufferSize + { + get + { + return _buffer.Length; + } + } + + public int SectionCount + { + get { return _sections.Count; } + } + + public XmlDictionaryWriter OpenSection(XmlDictionaryReaderQuotas quotas) + { + if (_bufferState != BufferState.Created) + throw CreateInvalidStateException(); + _bufferState = BufferState.Writing; + _quotas = new XmlDictionaryReaderQuotas(); + quotas.CopyTo(_quotas); + + _writer = XmlDictionaryWriter.CreateBinaryWriter(_stream, null, null, false); + + return _writer; + } + + public void CloseSection() + { + if (_bufferState != BufferState.Writing) + throw CreateInvalidStateException(); + _writer.Close(); + _bufferState = BufferState.Created; + + int size = (int)_stream.Length - _offset; + _sections.Add(new Section(_offset, size, _quotas)); + _offset += size; + } + + public void Close() + { + if (_bufferState != BufferState.Created) + throw CreateInvalidStateException(); + _bufferState = BufferState.Reading; + _buffer = new byte[_stream.Length]; + _stream.Position = 0; + _stream.Read(_buffer, 0, _buffer.Length); + + _writer = null; + _stream = null; + } + + private Exception CreateInvalidStateException() + { + return new InvalidOperationException(SR.XmlBufferInInvalidState); + } + + + public XmlDictionaryReader GetReader(int sectionIndex) + { + if (_bufferState != BufferState.Reading) + throw CreateInvalidStateException(); + Section section = _sections[sectionIndex]; + XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(_buffer, section.Offset, section.Size, null, section.Quotas, null, null); + + reader.MoveToContent(); + return reader; + } + + public void WriteTo(int sectionIndex, XmlWriter writer) + { + if (_bufferState != BufferState.Reading) + throw CreateInvalidStateException(); + XmlDictionaryReader reader = GetReader(sectionIndex); + try + { + writer.WriteNode(reader, false); + } + finally + { + reader.Close(); + } + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/BasicScenarioTests.cs b/external/corefx/src/System.ServiceModel.Syndication/tests/BasicScenarioTests.cs new file mode 100644 index 0000000000..c4c6a918f5 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/BasicScenarioTests.cs @@ -0,0 +1,696 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Text; +using System.ServiceModel.Syndication; +using System.Xml; +using System.IO; +using System.Threading.Tasks; +using System.Threading; +using Xunit; + +namespace System.ServiceModel.Syndication.Tests +{ + public static class BasicScenarioTests + { + [Fact] + public static void SyndicationFeed_CreateNewFeed() + { + string filePath = Path.GetTempFileName(); + + try + { + // *** SETUP *** \\ + SyndicationFeed sf = new SyndicationFeed("First feed on .net core ever!!", "This is the first feed on .net core ever!", new Uri("https://github.com/dotnet/wcf")); + Assert.True(sf != null); + + XmlWriter xmlw = XmlWriter.Create(filePath); + Rss20FeedFormatter rssf = new Rss20FeedFormatter(sf); + + // *** EXECUTE *** \\ + CancellationToken ct = new CancellationToken(); + rssf.WriteToAsync(xmlw, ct).GetAwaiter().GetResult(); + xmlw.Close(); + + // *** VALIDATE *** \\ + Assert.True(File.Exists(filePath)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(filePath); + } + } + + [Fact] + public static void SyndicationFeed_Load_Write_RSS_Feed() + { + string path = Path.GetTempFileName(); + + try + { + // *** SETUP *** \\\ + XmlReader xmlr = XmlReader.Create(@"SimpleRssFeed.xml"); + SyndicationFeed sf = SyndicationFeed.Load(xmlr); + Assert.True(sf != null); + CancellationToken ct = new CancellationToken(); + + // *** EXECUTE *** \\ + //Write the same feed that was read. + XmlWriter xmlw = XmlWriter.Create(path); + Rss20FeedFormatter atomFeed = new Rss20FeedFormatter(sf); + atomFeed.WriteToAsync(xmlw, ct).GetAwaiter().GetResult(); + xmlw.Close(); + + // *** VALIDATE *** \\ + Assert.True(File.Exists(path)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(path); + } + } + + [Fact] + public static void SyndicationFeed_Load_Write_RSS_Feed_Async() + { + string path = Path.GetTempFileName(); + + try + { + // *** SETUP *** \\\ + XmlReaderSettings settingsReader = new XmlReaderSettings(); + settingsReader.Async = true; + XmlReader xmlr = XmlReader.Create(@"rssSpecExample.xml", settingsReader); + SyndicationFeed sf; + Task rss = null; + CancellationToken ct = new CancellationToken(); + rss = SyndicationFeed.LoadAsync(xmlr, ct); + + Task.WhenAll(rss); + sf = rss.Result; + Assert.True(sf != null); + + // *** EXECUTE *** \\ + //Write the same feed that was read. + XmlWriterSettings settingsWriter = new XmlWriterSettings(); + settingsWriter.Async = true; + XmlWriter xmlw = XmlWriter.Create(path, settingsWriter); + Rss20FeedFormatter atomFeed = new Rss20FeedFormatter(sf); + Task write = atomFeed.WriteToAsync(xmlw, ct); + + Task.WhenAll(write); + + xmlw.Close(); + + // *** VALIDATE *** \\ + Assert.True(File.Exists(path)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(path); + } + } + + [Fact] + public static void SyndicationFeed_Load_Write_Atom_Feed() + { + string path = Path.GetTempFileName(); + + try + { + // *** SETUP *** \\\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader xmlr = XmlReader.Create(@"SimpleAtomFeed.xml", setting); + SyndicationFeed sf = SyndicationFeed.Load(xmlr); + Assert.True(sf != null); + CancellationToken ct = new CancellationToken(); + + // *** EXECUTE *** \\ + //Write the same feed that was read. + XmlWriter xmlw = XmlWriter.Create(path); + Atom10FeedFormatter atomFeed = new Atom10FeedFormatter(sf); + atomFeed.WriteToAsync(xmlw, ct).GetAwaiter().GetResult(); + xmlw.Close(); + + // *** VALIDATE *** \\ + Assert.True(File.Exists(path)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(path); + } + } + + [Fact] + public static void SyndicationFeed_Load_Write_Atom_Feed_Async() + { + string path = Path.GetTempFileName(); + + try + { + // *** SETUP *** \\\ + XmlReaderSettings readerSettings = new XmlReaderSettings(); + readerSettings.Async = true; + XmlReader xmlr = XmlReader.Create(@"atom_spec_example.xml", readerSettings); + CancellationToken ct = new CancellationToken(); + Task rss = SyndicationFeed.LoadAsync(xmlr, ct); + SyndicationFeed sf = rss.Result; + Assert.True(sf != null); + + // *** EXECUTE *** \\ + //Write the same feed that was read. + XmlWriterSettings writerSettings = new XmlWriterSettings(); + writerSettings.Async = true; + + XmlWriter xmlw = XmlWriter.Create(path, writerSettings); + Atom10FeedFormatter atomFeed = new Atom10FeedFormatter(sf); + Task write = atomFeed.WriteToAsync(xmlw, ct); + + Task.WhenAll(write); + xmlw.Close(); + + // *** VALIDATE *** \\ + Assert.True(File.Exists(path)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(path); + } + } + + [Fact] + public static void SyndicationFeed_Write_RSS_Atom() + { + string RssPath = Path.GetTempFileName(); + string AtomPath = Path.GetTempFileName(); + + try + { + // *** SETUP *** \\ + SyndicationFeed feed = new SyndicationFeed("Contoso News", "
Most recent news from Contoso
", new Uri("http://www.Contoso.com/news"), "123FeedID", DateTime.Now); + CancellationToken ct = new CancellationToken(); + + //Add an author + SyndicationPerson author = new SyndicationPerson("jerry@Contoso.com"); + feed.Authors.Add(author); + + //Create item + SyndicationItem item1 = new SyndicationItem("SyndicationFeed released for .net Core", "A lot of text describing the release of .net core feature", new Uri("http://Contoso.com/news/path")); + + //Add item to feed + List feedList = new List { item1 }; + feed.Items = feedList; + feed.ElementExtensions.Add("CustomElement", "", "asd"); + + //add an image + feed.ImageUrl = new Uri("http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg"); + //feed.ImageTitle = new TextSyndicationContent("Titulo loco"); + + feed.BaseUri = new Uri("http://mypage.com"); + + // Write to XML > rss + + XmlWriterSettings settings = new XmlWriterSettings(); + settings.Async = true; + + XmlWriter xmlwRss = XmlWriter.Create(RssPath, settings); + Rss20FeedFormatter rssff = new Rss20FeedFormatter(feed); + + // Write to XML > atom + + XmlWriter xmlwAtom = XmlWriter.Create(AtomPath); + Atom10FeedFormatter atomf = new Atom10FeedFormatter(feed); + + + // *** EXECUTE *** \\ + Task rss = rssff.WriteToAsync(xmlwRss, ct); + Task.WaitAll(rss); + + xmlwRss.Close(); + + atomf.WriteToAsync(xmlwAtom, ct).GetAwaiter().GetResult(); ; + xmlwAtom.Close(); + + // *** ASSERT *** \\ + Assert.True(File.Exists(RssPath)); + Assert.True(File.Exists(AtomPath)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(RssPath); + File.Delete(AtomPath); + } + } + + [Fact] + public static void SyndicationFeed_RSS20_Load_customImageDataInFeed() + { + // *** SETUP *** \\ + XmlReader reader = XmlReader.Create(@"RssFeedWithCustomImageName.xml"); + + // *** EXECUTE *** \\ + SyndicationFeed sf = SyndicationFeed.Load(reader); + + // *** ASSERT *** \\ + Assert.True("The title is not the same to the original one" == sf.ImageTitle.Text); + Assert.True(sf.ImageLink.AbsoluteUri != sf.Links[0].GetAbsoluteUri().AbsoluteUri); + + // *** CLEANUP *** \\ + reader.Close(); + } + + [Fact] + public static void SyndicationFeed_RSS20_Write_customImageDataInFeed() + { + // *** SETUP *** \\ + SyndicationFeed sf = new SyndicationFeed(); + string feedTitle = "Feed title"; + string imageTitle = "Image title"; + string resultPath = Path.GetTempFileName(); + + sf.Title = new TextSyndicationContent(feedTitle); + sf.ImageTitle = new TextSyndicationContent(imageTitle); + sf.ImageLink = new Uri("http://myimage.com"); + sf.ImageUrl = new Uri("http://www.myownimagesrc.com"); + XmlWriter writer = XmlWriter.Create(resultPath); + Rss20FeedFormatter rssff = sf.GetRss20Formatter(); + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + rssff.WriteToAsync(writer, ct).GetAwaiter().GetResult(); ; + writer.Close(); + + // *** ASSERT *** \\ + Assert.True(File.Exists(resultPath)); + } + finally + { + // *** CLEANUP *** \\ + File.Delete(resultPath); + } + } + + [Fact] + public static async Task SyndicationFeed_LoadAsync_Rss() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + Task rss = null; + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + reader = XmlReader.Create(@"rssSpecExample.xml", setting); + rss = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(rss); + + // *** ASSERT *** \\ + } + finally + { + // *** CLEANUP *** \\ + Assert.True(rss.Result.Items != null); + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed_LoadAsync_Atom() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + CancellationToken ct = new CancellationToken(); + + try + { + reader = XmlReader.Create(@"atom_spec_example.xml", setting); + // *** EXECUTE *** \\ + Task atom = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(atom); + // *** ASSERT *** \\ + Assert.True(atom.Result.Items != null); + } + finally + { + // *** CLEANUP *** \\ + reader.Close(); + } + } + + [Fact] + public static void SyndicationFeed_Rss_TestDisjointItems() + { + // *** SETUP *** \\ + XmlReader reader = XmlReader.Create(@"RssDisjointItems.xml"); + + try + { + // *** EXECUTE *** \\ + SyndicationFeed sf = SyndicationFeed.Load(reader); + + // *** ASSERT *** \\ + int count = 0; + foreach (var item in sf.Items) + { + count++; + } + + Assert.True(count == 2); + } + catch + { + // *** CLEANUP *** \\ + reader.Close(); + } + } + + + [Fact] + public static void SyndicationFeed_Atom_TestDisjointItems() + { + // *** SETUP *** \\ + XmlReader reader = XmlReader.Create(@"AtomDisjointItems.xml"); + + try + { + // *** EXECUTE *** \\ + SyndicationFeed sf = SyndicationFeed.Load(reader); + + // *** ASSERT *** \\ + int count = 0; + foreach (var item in sf.Items) + { + count++; + } + + Assert.True(count == 2); + } + finally + { + // *** CLEANUP *** \\ + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed_RSS_Optional_Documentation() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + Task rss = null; + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + reader = XmlReader.Create(@"rssSpecExample.xml", setting); + rss = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(rss); + + // *** ASSERT *** \\ + Assert.True(rss.Result.Documentation.GetAbsoluteUri().ToString() == "http://blogs.law.harvard.edu/tech/rss"); + } + finally + { + // *** CLEANUP *** \\ + Assert.True(rss.Result.Items != null); + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed_RSS_Optional_TimeToLiveTag() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + Task rss = null; + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + reader = XmlReader.Create(@"rssSpecExample.xml", setting); + rss = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(rss); + + // *** ASSERT *** \\ + Assert.True(rss.Result.TimeToLive == 60); + } + finally + { + // *** CLEANUP *** \\ + Assert.True(rss.Result.Items != null); + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed_RSS_Optional_SkipHours() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + Task rss = null; + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + reader = XmlReader.Create(@"rssSpecExample.xml", setting); + rss = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(rss); + + // *** ASSERT *** \\ + Assert.True(rss.Result.SkipHours.Count == 3); + } + finally + { + // *** CLEANUP *** \\ + Assert.True(rss.Result.Items != null); + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed_RSS_Optional_SkipDays() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + Task rss = null; + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + reader = XmlReader.Create(@"rssSpecExample.xml", setting); + rss = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(rss); + + // *** ASSERT *** \\ + Assert.True(rss.Result.SkipDays.Count == 2); + Assert.True(rss.Result.SkipDays[0] == "Saturday"); + Assert.True(rss.Result.SkipDays[1] == "Sunday"); + } + finally + { + // *** CLEANUP *** \\ + Assert.True(rss.Result.Items != null); + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed_RSS_Optional_TextInput() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + Task rss = null; + CancellationToken ct = new CancellationToken(); + + try + { + // *** EXECUTE *** \\ + reader = XmlReader.Create(@"rssSpecExample.xml", setting); + rss = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(rss); + + // *** ASSERT *** \\ + Assert.True(rss.Result.TextInput.Description == "Search Online"); + Assert.True(rss.Result.TextInput.title == "Search"); + Assert.True(rss.Result.TextInput.name == "input Name"); + Assert.True(rss.Result.TextInput.link.GetAbsoluteUri().ToString() == "http://www.contoso.no/search?"); + } + finally + { + // *** CLEANUP *** \\ + Assert.True(rss.Result.Items != null); + reader.Close(); + } + } + + [Fact] + public static async Task SyndicationFeed__Atom_Optional_Icon() + { + // *** SETUP *** \\ + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + XmlReader reader = null; + CancellationToken ct = new CancellationToken(); + + try + { + reader = XmlReader.Create(@"atom_spec_example.xml", setting); + // *** EXECUTE *** \\ + Task atom = SyndicationFeed.LoadAsync(reader, ct); + await Task.WhenAll(atom); + // *** ASSERT *** \\ + Assert.True(atom.Result.IconImage.AbsoluteUri == "https://avatars0.githubusercontent.com/u/9141961"); + } + finally + { + // *** CLEANUP *** \\ + reader.Close(); + } + } + + [Fact] + public static void SyndicationFeed_Rss_TestCustomParsing() + { + // *** SETUP *** \\ + Rss20FeedFormatter rssformatter = new Rss20FeedFormatter(); + + rssformatter.StringParser = (val, name, ns) => + { + Assert.False(string.IsNullOrEmpty(name)); + switch (name) + { + case "ttl": + case "hour": + return "5"; + case "link": + case "image": + case "url": + return "http://customparsedlink.com"; + case "title": + return "new title"; + default: + return "Custom Text"; + } + }; + + XmlReader reader = XmlReader.Create(@"rssSpecExample.xml"); + CancellationToken ct = new CancellationToken(); + + // *** EXECUTE *** \\ + Task task = SyndicationFeed.LoadAsync(reader, rssformatter, ct); + Task.WhenAll(task); + SyndicationFeed res = task.Result; + + // *** ASSERT *** \\ + Assert.True(res.Title.Text == "new title"); + foreach (int hour in res.SkipHours) + { + Assert.True(hour == 5); + } + } + + [Fact] + public static void SyndicationFeed_Atom_TestCustomParsing() + { + // *** SETUP *** \\ + Atom10FeedFormatter atomformatter = new Atom10FeedFormatter(); + + atomformatter.stringParser = (val, name, ns) => + { + Assert.False(string.IsNullOrEmpty(name)); + switch (name) + { + case Atom10Constants.IdTag: + return "No id!"; + case Atom10Constants.NameTag: + return "new name"; + case Atom10Constants.TitleTag: + return "new title"; + default: + return "Custom Text"; + } + }; + + XmlReader reader = XmlReader.Create(@"atom_spec_example.xml"); + CancellationToken ct = new CancellationToken(); + + // *** EXECUTE *** \\ + Task task = SyndicationFeed.LoadAsync(reader, atomformatter, ct); + Task.WhenAll(task); + SyndicationFeed res = task.Result; + + // *** ASSERT *** \\ + Assert.True(res.Id == "No id!"); + Assert.True(res.Title.Text == "new title"); + } + + [Fact] + public static void SyndicationFeed_Rss_TestWrongSkipDays() + { + // *** SETUP *** \\ + Rss20FeedFormatter rssformatter = new Rss20FeedFormatter(); + + XmlReader reader = XmlReader.Create(@"rssSpecExampleWrongSkipDays.xml"); + CancellationToken ct = new CancellationToken(); + + // *** EXECUTE *** \\ + Task task = SyndicationFeed.LoadAsync(reader, ct); + Task.WhenAll(task); + SyndicationFeed res = task.Result; + + // *** ASSERT *** \\ + Assert.True(res.SkipDays.Count == 2); + Assert.True(res.SkipDays[0] == "Saturday"); + Assert.True(res.SkipDays[1] == "Sunday"); + } + + [Fact] + public static void SyndicationFeed_Rss_WrongDateFormat() + { + // *** SETUP *** \\ + Rss20FeedFormatter rssformatter = new Rss20FeedFormatter(); + + XmlReader reader = XmlReader.Create(@"rssSpecExampleWrongDateFormat.xml"); + CancellationToken ct = new CancellationToken(); + + // *** EXECUTE *** \\ + Task task = SyndicationFeed.LoadAsync(reader, ct); + Task.WhenAll(task); + SyndicationFeed res = task.Result; + + // *** ASSERT *** \\ + Assert.True(!res.LastUpdatedTime.Equals(new DateTimeOffset())); + } + } +} diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/Configurations.props b/external/corefx/src/System.ServiceModel.Syndication/tests/Configurations.props new file mode 100644 index 0000000000..c398e42e89 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/Configurations.props @@ -0,0 +1,8 @@ + + + + + netstandard; + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj b/external/corefx/src/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj new file mode 100644 index 0000000000..66230d199f --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/System.ServiceModel.Syndication.Tests.csproj @@ -0,0 +1,25 @@ + + + + + {A622B2C0-DD74-4218-9CF0-F9B2E52F4E91} + + + + + + + + + Always + + + + + + true + + + + diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/AtomDisjointItems.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/AtomDisjointItems.xml new file mode 100644 index 0000000000..00c432b730 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/AtomDisjointItems.xml @@ -0,0 +1,81 @@ + + + dive into mark + + A <em>lot</em> of effort + went into making this effortless + + 2005-07-31T12:29:29Z + tag:example.org,2003:3 + + + Copyright (c) 2003, Mark Pilgrim + + Example Toolkit + + + Atom draft-07 snapshot + + + tag:example.org,2003:3.2397 + 2005-07-31T12:29:29Z + 2003-12-13T08:29:29-04:00 + + Mark Pilgrim + http://example.org/ + f8dy@example.com + + + Sam Ruby + + + Joe Gregorio + + +
+

+ [Update: The Atom draft is finished.] +

+
+
+
+ + + Jerry + + + + Atom draft-07 snapshot + + + tag:example.org,2003:3.2397 + 2005-07-31T12:29:29Z + 2003-12-13T08:29:29-04:00 + + Mark Pilgrim + http://example.org/ + f8dy@example.com + + + Sam Ruby + + + Joe Gregorio + + +
+

+ [Update: The Atom draft is finished.] +

+
+
+
+
diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/RssDisjointItems.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/RssDisjointItems.xml new file mode 100644 index 0000000000..ae78e43fa4 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/RssDisjointItems.xml @@ -0,0 +1,38 @@ + + + + Contoso News + http://www.Contoso.com/news + <div>Most recent news from Contoso</div> + en-us + Mon, 19 Jun 2017 11:52:39 -0700 + jerry@Contoso.com + Newspaperts + SyndicationFeed Feature + + Mon, 19 Jun 2017 11:52:39 -0700 + + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + The title is not the same to the original one + http://www.contoso.com/notnews + + 123FeedID + + http://Contoso.com/news/path + SyndicationFeed released for .net Core + A lot of text describing the release of .net core feature + Contoso Item author + Item Category + Mon, 19 Jun 2017 11:52:39 -0700 + + asd + + http://Contoso.com/news/path + SyndicationFeed released for .net Core + A lot of text describing the release of .net core feature + Contoso Item author + Item Category + Mon, 19 Jun 2017 11:52:39 -0700 + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/RssFeedWithCustomImageName.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/RssFeedWithCustomImageName.xml new file mode 100644 index 0000000000..4b5b96f529 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/RssFeedWithCustomImageName.xml @@ -0,0 +1,30 @@ + + + + Contoso News + http://www.Contoso.com/news + <div>Most recent news from Contoso</div> + en-us + Mon, 19 Jun 2017 11:52:39 -0700 + jerry@Contoso.com + Newspaperts + SyndicationFeed Feature + + Mon, 19 Jun 2017 11:52:39 -0700 + + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + The title is not the same to the original one + http://www.contoso.com/notnews + + 123FeedID + asd + + http://Contoso.com/news/path + SyndicationFeed released for .net Core + A lot of text describing the release of .net core feature + Contoso Item author + Item Category + Mon, 19 Jun 2017 11:52:39 -0700 + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/SimpleAtomFeed.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/SimpleAtomFeed.xml new file mode 100644 index 0000000000..824f2ba47b --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/SimpleAtomFeed.xml @@ -0,0 +1,20 @@ + + + Contoso News + <div>Most recent news from Contoso</div> + 123FeedID + 2017-06-26T14:41:43-07:00 + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + + jerry@Contoso.com + + + asd + + uuid:71d91f91-f5f9-4175-9065-4b7cb357fc4d;id=1 + SyndicationFeed released for .net Core + 2017-06-26T21:41:43Z + + A lot of text describing the release of .net core feature + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/SimpleRssFeed.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/SimpleRssFeed.xml new file mode 100644 index 0000000000..1b69a3fd7b --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/SimpleRssFeed.xml @@ -0,0 +1,29 @@ + + + + Contoso News + http://www.Contoso.com/news + <div>Most recent news from Contoso</div> + en-us + Mon, 19 Jun 2017 11:52:39 -0700 + jerry@Contoso.com + Newspaperts + SyndicationFeed Feature + Mon, 19 Jun 2017 11:52:39 -0700 + + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + The title is not the same to the original one + http://www.contoso.com/notnews + + 123FeedID + asd + + http://Contoso.com/news/path + SyndicationFeed released for .net Core + A lot of text describing the release of .net core feature + Contoso Item author + Item Category + Mon, 19 Jun 2017 11:52:39 -0700 + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/atom_spec_example.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/atom_spec_example.xml new file mode 100644 index 0000000000..4efadc6568 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/atom_spec_example.xml @@ -0,0 +1,48 @@ + + + dive into mark + https://avatars0.githubusercontent.com/u/9141961 + + A <em>lot</em> of effort + went into making this effortless + + 2005-07-31T12:29:29Z + tag:example.org,2003:3 + + + Copyright (c) 2003, Mark Pilgrim + + Example Toolkit + + + Atom draft-07 snapshot + + + tag:example.org,2003:3.2397 + 2005-07-31T12:29:29Z + 2003-12-13T08:29:29-04:00 + + Mark Pilgrim + http://example.org/ + f8dy@example.com + + + Sam Ruby + + + Joe Gregorio + + +
+

+ [Update: The Atom draft is finished.] +

+
+
+
+
diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/example_feed_xml_atom.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/example_feed_xml_atom.xml new file mode 100644 index 0000000000..8c412bf2d8 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/example_feed_xml_atom.xml @@ -0,0 +1,187 @@ + + + Example - Online Store + + 2011-07-11T12:00:00Z + + + + + TV_123456 + LG 22LB4510 - 22" LED TV - 1080p (FullHD) + Attractively styled and boasting stunning picture quality, the LG 22LB4510 - 22" LED TV - 1080p (FullHD) is an excellent television/monitor. The LG 22LB4510 - 22" LED TV - 1080p (FullHD) sports a widescreen 1080p panel, perfect for watching movies in their original format, whilst also providing plenty of working space for your other applications. + http://www.example.com/electronics/tv/22LB4510.html + http://images.example.com/TV_123456.png + used + in stock + 159.00 USD + + US + Standard + 14.95 USD + + + + 71919219405200 + LG + 22LB4510/US + + + Electronics > Video > Televisions > Flat Panel Televisions + Consumer Electronics > TVs > Flat Panel TVs + + + + + + DVD-0564738 + + + + + new + in stock + 11.99 USD + + US + Express Mail + 3.80 USD + + + + 88392916560500 + BBC + + + DVDs & Videos]]> + + + TV Series > Fantasy Drama]]> + + + + + + PFM654321 + Dior Capture XP Ultimate Wrinkle Correction Creme 1.7 oz + Dior Capture XP Ultimate Wrinkle Correction Creme 1.7 oz reinvents anti-wrinkle care by protecting and relaunching skin cell activity to encourage faster, healthier regeneration. + http://www.example.com/perfumes/product?Dior%20Capture%20R6080%20XP + http://images.example.com/PFM654321_1.jpg + new + in stock + 99 USD + + US + Standard Rate + 4.95 USD + + + US + Next Day + 8.50 USD + + + + 3348901056069 + Dior + + + Health & Beauty > Personal Care > Cosmetics > Skin Care > Lotion + Health & Beauty > Personal Care > Cosmetics > Skin Care > Anti-Aging Skin Care Kits + http://images.example.com/PFM654321_2.jpg + http://images.example.com/PFM654321_3.jpg + + + + + + CLO-29473856-1 + Roma Cotton Rich Bootcut Jeans - Size 8 Standard + A smart pair of bootcut jeans in stretch cotton. + http://www.example.com/clothing/women/Roma-Cotton-Bootcut-Jeans/?extid=CLO-29473856 + http://images.example.com/CLO-29473856-front.jpg + new + out of stock + 29.50 USD + + + Apparel & Accessories > Clothing > Pants > Jeans + M&S + Female + Adult + Navy + 8 Standard + + + CLO-29473856 + + + B003J5F5EY + Women's Clothing > Jeans > Bootcut Jeans + http://images.example.com/CLO-29473856-side.jpg + http://images.example.com/CLO-29473856-back.jpg + + + + + + CLO-29473856-2 + Roma Cotton Rich Bootcut Jeans - Size 8 Tall + A smart pair of bootcut jeans in stretch cotton. + http://www.example.com/clothing/women/Roma-Cotton-Bootcut-Jeans/?extid=CLO-29473856 + http://images.example.com/CLO-29473856-front.jpg + new + in stock + 29.50 USD + + + Apparel & Accessories > Clothing > Pants > Jeans + M&S + Female + Adult + Navy + 8 Tall + + + CLO-29473856 + + + B003J5F5EY + Women's Clothing > Jeans > Bootcut Jeans + http://images.example.com/CLO-29473856-side.jpg + http://images.example.com/CLO-29473856-back.jpg + + + + + + CLO-1029384 + Tenn Cool Flow Ladies Long Sleeved Cycle Jersey + A ladies' cycling jersey designed for the serious cyclist, tailored to fit a feminine frame. This sporty, vibrant red, black and white jersey is constructed of a special polyester weave that is extremely effective at drawing moisture away from your body, helping to keep you dry. With an elasticised, gripping waist, it will stay in place for the duration of your cycle, and won't creep up like many other products. It has two elasticised rear pockets and the sleeves are elasticated to prevent creep-up. + http://www.example.com/clothing/sports/product?id=CLO1029384&src=gshopping&popup=false + http://images.example.com/CLO-1029384.jpg + new + in stock + 33.99 USD + + US + Standard Free Shipping + 0 USD + + + + Tenn Cool + Apparel & Accessories > Clothing > Activewear > Bicycle Activewear > Bicycle Jerseys + Female + Adult + Black/Red/White + M + + + 25.49 USD + 2011-09-01T16:00-08:00/2011-09-03T16:00-08:00 + + + 5060155240282 + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExample.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExample.xml new file mode 100644 index 0000000000..8be629d90d --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExample.xml @@ -0,0 +1,69 @@ + + + + Liftoff News + http://liftoff.msfc.nasa.gov/ + Liftoff to Space Exploration. + en-us + Tue, 10 Jun 2003 09:41:01 GMT + http://blogs.law.harvard.edu/tech/rss + Weblog Editor 2.0 + editor@example.com + TestingFeeds + Contoso Rights. + 60 + + 1 + 2 + 3 + + + Saturday + Sunday + + + + Search Online + Search + asdasdasdasdasd + http://www.contoso.no/search? + input Name + + + + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + The title is not the same to the original one + http://www.contoso.com/notnews + + + Star City + http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp + + How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's Star City. + + Tue, 03 Jun 2003 09:39:21 GMT + http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 + + + + Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a partial eclipse of the Sun on Saturday, May 31st. + + Fri, 30 May 2003 11:06:42 GMT + http://liftoff.msfc.nasa.gov/2003/05/30.html#item572 + + + The Engine That Does More + http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp + Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. + Tue, 27 May 2003 08:37:32 GMT + http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 + + + Astronauts' Dirty Laundry + http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp + Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options. + Tue, 20 May 2003 08:56:02 GMT + http://liftoff.msfc.nasa.gov/2003/05/20.html#item570 + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExampleWrongDateFormat.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExampleWrongDateFormat.xml new file mode 100644 index 0000000000..5a0febe7c4 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExampleWrongDateFormat.xml @@ -0,0 +1,69 @@ + + + + Liftoff News + http://liftoff.msfc.nasa.gov/ + Liftoff to Space Exploration. + en-us + Tue, 23 August 2016 16:08:00 EDT + http://blogs.law.harvard.edu/tech/rss + Weblog Editor 2.0 + editor@example.com + TestingFeeds + Contoso Rights. + 60 + + 1 + 2 + 3 + + + Saturday + Sunday + + + + Search Online + Search + asdasdasdasdasd + http://www.contoso.no/search? + input Name + + + + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + The title is not the same to the original one + http://www.contoso.com/notnews + + + Star City + http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp + + How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's Star City. + + Tue, 03 Jun 2003 09:39:21 GMT + http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 + + + + Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a partial eclipse of the Sun on Saturday, May 31st. + + Thu, 16 Oct 08 14:23:26 -0700 + http://liftoff.msfc.nasa.gov/2003/05/30.html#item572 + + + The Engine That Does More + http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp + Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. + Tue, 27 May 2003 08:37:32 GMTtttt + http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 + + + Astronauts' Dirty Laundry + http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp + Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options. + Tue, 20 May 2003 08:56:02 GMT + http://liftoff.msfc.nasa.gov/2003/05/20.html#item570 + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExampleWrongSkipDays.xml b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExampleWrongSkipDays.xml new file mode 100644 index 0000000000..bbfd75b673 --- /dev/null +++ b/external/corefx/src/System.ServiceModel.Syndication/tests/TestFeeds/rssSpecExampleWrongSkipDays.xml @@ -0,0 +1,70 @@ + + + + Liftoff News + http://liftoff.msfc.nasa.gov/ + Liftoff to Space Exploration. + en-us + Tue, 10 Jun 2003 09:41:01 GMT + http://blogs.law.harvard.edu/tech/rss + Weblog Editor 2.0 + editor@example.com + TestingFeeds + Contoso Rights. + 60 + + 1 + 2 + 3 + + + Saturday + Sunday + tomorrow + + + + Search Online + Search + asdasdasdasdasd + http://www.contoso.no/search? + input Name + + + + http://2.bp.blogspot.com/-NA5Jb-64eUg/URx8CSdcj_I/AAAAAAAAAUo/eCx0irI0rq0/s1600/bg_Contoso_logo3-20120824073001907469-620x349.jpg + The title is not the same to the original one + http://www.contoso.com/notnews + + + Star City + http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp + + How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's Star City. + + Tue, 03 Jun 2003 09:39:21 GMT + http://liftoff.msfc.nasa.gov/2003/06/03.html#item573 + + + + Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a partial eclipse of the Sun on Saturday, May 31st. + + Fri, 30 May 2003 11:06:42 GMT + http://liftoff.msfc.nasa.gov/2003/05/30.html#item572 + + + The Engine That Does More + http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp + Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that. + Tue, 27 May 2003 08:37:32 GMT + http://liftoff.msfc.nasa.gov/2003/05/27.html#item571 + + + Astronauts' Dirty Laundry + http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp + Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options. + Tue, 20 May 2003 08:56:02 GMT + http://liftoff.msfc.nasa.gov/2003/05/20.html#item570 + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController.sln b/external/corefx/src/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController.sln index ac2c5a484e..a5261436bb 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController.sln +++ b/external/corefx/src/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController.sln @@ -2,7 +2,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.ServiceProcess.ServiceController.Tests", "tests\System.ServiceProcess.ServiceController.Tests\System.ServiceProcess.ServiceController.Tests.csproj", "{F7D9984B-02EB-4573-84EF-00FFFBFB872C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.ServiceProcess.ServiceController.TestService", "tests\System.ServiceProcess.ServiceController.TestService\System.ServiceProcess.ServiceController.TestService.csproj", "{E62B874D-1A0D-41BC-8CFC-9E09D0860A77}" + ProjectSection(ProjectDependencies) = postProject + {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05} = {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.ServiceProcess.ServiceController.Tests", "tests\System.ServiceProcess.ServiceController.Tests.csproj", "{F7D9984B-02EB-4573-84EF-00FFFBFB872C}" ProjectSection(ProjectDependencies) = postProject {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05} = {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05} EndProjectSection @@ -26,14 +31,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU - {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU - {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU - {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU - {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU - {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU - {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU - {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU + {E62B874D-1A0D-41BC-8CFC-9E09D0860A77}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU + {E62B874D-1A0D-41BC-8CFC-9E09D0860A77}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU + {E62B874D-1A0D-41BC-8CFC-9E09D0860A77}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU + {E62B874D-1A0D-41BC-8CFC-9E09D0860A77}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {F7D9984B-02EB-4573-84EF-00FFFBFB872C}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU + {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU + {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU + {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU + {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU {8479566D-6FA5-4241-9D66-524BEC4C19BD}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU {8479566D-6FA5-4241-9D66-524BEC4C19BD}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU {8479566D-6FA5-4241-9D66-524BEC4C19BD}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU @@ -43,6 +52,7 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {E62B874D-1A0D-41BC-8CFC-9E09D0860A77} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {F7D9984B-02EB-4573-84EF-00FFFBFB872C} = {1A2F9F4A-A032-433E-B914-ADD5992BB178} {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD} {8479566D-6FA5-4241-9D66-524BEC4C19BD} = {2E666815-2EDB-464B-9DF6-380BF4789AD4} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/pkg/System.ServiceProcess.ServiceController.pkgproj b/external/corefx/src/System.ServiceProcess.ServiceController/pkg/System.ServiceProcess.ServiceController.pkgproj index c11193a88b..7887c3add7 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/pkg/System.ServiceProcess.ServiceController.pkgproj +++ b/external/corefx/src/System.ServiceProcess.ServiceController/pkg/System.ServiceProcess.ServiceController.pkgproj @@ -9,12 +9,7 @@ netcore50 - - - - - lib/netstandard1.4 - + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.cs b/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.cs index 5bc0811eac..e10f43db51 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.cs +++ b/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.cs @@ -5,28 +5,75 @@ // Changes to this file must follow the http://aka.ms/api-review process. // ------------------------------------------------------------------------------ - namespace System.ServiceProcess { - public partial class ServiceController : System.IDisposable + public enum PowerBroadcastStatus { + BatteryLow = 9, + OemEvent = 11, + PowerStatusChange = 10, + QuerySuspend = 0, + QuerySuspendFailed = 2, + ResumeAutomatic = 18, + ResumeCritical = 6, + ResumeSuspend = 7, + Suspend = 4, + } + public partial class ServiceBase : System.ComponentModel.Component + { + public const int MaxNameLength = 80; + public ServiceBase() { } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanHandlePowerEvent { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanHandleSessionChangeEvent { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanPauseAndContinue { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(false)] + public bool CanShutdown { get { throw null; } set { } } + [System.ComponentModel.DefaultValueAttribute(true)] + public bool CanStop { get { throw null; } set { } } + public int ExitCode { get { throw null; } set { } } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(2))] + protected System.IntPtr ServiceHandle { get { throw null; } } + public string ServiceName { get { throw null; } set { } } + protected override void Dispose(bool disposing) { } + protected virtual void OnContinue() { } + protected virtual void OnCustomCommand(int command) { } + protected virtual void OnPause() { } + protected virtual bool OnPowerEvent(System.ServiceProcess.PowerBroadcastStatus powerStatus) { throw null; } + protected virtual void OnSessionChange(System.ServiceProcess.SessionChangeDescription changeDescription) { } + protected virtual void OnShutdown() { } + protected virtual void OnStart(string[] args) { } + protected virtual void OnStop() { } + public void RequestAdditionalTime(int milliseconds) { } + public static void Run(System.ServiceProcess.ServiceBase service) { } + public static void Run(System.ServiceProcess.ServiceBase[] services) { } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] + public void ServiceMainCallback(int argCount, System.IntPtr argPointer) { } + public void Stop() { } + } + public partial class ServiceController : System.ComponentModel.Component + { + public ServiceController() { } public ServiceController(string name) { } public ServiceController(string name, string machineName) { } public bool CanPauseAndContinue { get { throw null; } } public bool CanShutdown { get { throw null; } } public bool CanStop { get { throw null; } } public System.ServiceProcess.ServiceController[] DependentServices { get { throw null; } } - public string DisplayName { get { throw null; } } - public string MachineName { get { throw null; } } + public string DisplayName { get { throw null; } set { } } + public string MachineName { get { throw null; } set { } } public System.Runtime.InteropServices.SafeHandle ServiceHandle { get { throw null; } } - public string ServiceName { get { throw null; } } + public string ServiceName { get { throw null; } set { } } public System.ServiceProcess.ServiceController[] ServicesDependedOn { get { throw null; } } public System.ServiceProcess.ServiceType ServiceType { get { throw null; } } public System.ServiceProcess.ServiceStartMode StartType { get { throw null; } } public System.ServiceProcess.ServiceControllerStatus Status { get { throw null; } } + public void Close() { } public void Continue() { } - public void Dispose() { } - protected virtual void Dispose(bool disposing) { } + protected override void Dispose(bool disposing) { } + public void ExecuteCommand(int command) { } public static System.ServiceProcess.ServiceController[] GetDevices() { throw null; } public static System.ServiceProcess.ServiceController[] GetDevices(string machineName) { throw null; } public static System.ServiceProcess.ServiceController[] GetServices() { throw null; } @@ -68,11 +115,34 @@ namespace System.ServiceProcess Win32OwnProcess = 16, Win32ShareProcess = 32, } - public partial class TimeoutException : System.Exception + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct SessionChangeDescription + { + public System.ServiceProcess.SessionChangeReason Reason { get { throw null; } } + public int SessionId { get { throw null; } } + public override bool Equals(object obj) { throw null; } + public bool Equals(System.ServiceProcess.SessionChangeDescription changeDescription) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(System.ServiceProcess.SessionChangeDescription a, System.ServiceProcess.SessionChangeDescription b) { throw null; } + public static bool operator !=(System.ServiceProcess.SessionChangeDescription a, System.ServiceProcess.SessionChangeDescription b) { throw null; } + } + public enum SessionChangeReason + { + ConsoleConnect = 1, + ConsoleDisconnect = 2, + RemoteConnect = 3, + RemoteDisconnect = 4, + SessionLock = 7, + SessionLogoff = 6, + SessionLogon = 5, + SessionRemoteControl = 9, + SessionUnlock = 8, + } + public partial class TimeoutException : System.SystemException { public TimeoutException() { } + protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public TimeoutException(string message) { } public TimeoutException(string message, System.Exception innerException) { } - protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } } } diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj b/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj index 5d6d29f3cd..dc2cae1910 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj +++ b/external/corefx/src/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj @@ -14,7 +14,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/Configurations.props b/external/corefx/src/System.ServiceProcess.ServiceController/src/Configurations.props index 4e5de27086..02a949d632 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/src/Configurations.props +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/Configurations.props @@ -2,7 +2,7 @@ - netstandard-Windows_NT; + netcoreapp2.0-Windows_NT; netstandard; netfx-Windows_NT; diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/Resources/Strings.resx b/external/corefx/src/System.ServiceProcess.ServiceController/src/Resources/Strings.resx index 7111ac4072..270edcd771 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/src/Resources/Strings.resx +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/Resources/Strings.resx @@ -100,4 +100,97 @@ ServiceController enables manipulating and accessing Windows services and it is not applicable for other operating systems. + + Cannot change CanStop, CanPauseAndContinue, CanShutdown, CanHandlePowerEvent, or CanHandleSessionChangeEvent property values after the service has been started. + + + Cannot change service name when the service is running. + + + Service name {0} contains invalid characters, is empty, or is too long (max length = {1}). + + + Service has not been supplied. At least one object derived from ServiceBase is required in order to run. + + + Cannot start service from the command line or a debugger. A Windows Service must first be installed and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command. + + + UpdatePendingStatus can only be called during the handling of Start, Stop, Pause and Continue commands. + + + Service started successfully. + + + Service stopped successfully. + + + Service paused successfully. + + + Service continued successfully. + + + Service was installed successfully. + + + Service was uninstalled successfully. + + + Service command was processed successfully. + + + Service cannot be started. {0} + + + Failed to stop service. {0} + + + Failed to pause service. {0} + + + Failed to continue service. {0} + + + Failed to process session change. {0} + + + Failed to install service. Service may have been installed already. + + + Failed to uninstall service. Service may be running. + + + Failed to process service command. {0} + + + Windows Error number: {0}. + + + Service has been successfully shut down. + + + Failed to shut down service. The error that occurred was: {0}. + + + PowerEvent handled successfully by the service. + + + Failed in handling the PowerEvent. The error that occurred was: {0}. + + + Service {0} has been successfully installed. + + + Attempt to stop service {0}. + + + Service {0} is being removed from the system... + + + Service {0} was successfully removed from the system. + + + Cannot control {0} service on computer '{1}'. + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj b/external/corefx/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj index 1545cef32a..fca6f12460 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System.ServiceProcess.ServiceController.csproj @@ -8,17 +8,17 @@ {F4821CB6-91A3-4546-BC4F-E00DBFBDAA05} true None - SR.PlatformNotSupported_ServiceController + SR.PlatformNotSupported_ServiceController false + + - - - + Common\Interop\Windows\Interop.Libraries.cs @@ -67,25 +67,54 @@ Common\Interop\Windows\Interop.SERVICE_STATUS.cs + + Common\Interop\Windows\Interop.SERVICE_TABLE_ENTRY.cs + + + Common\Interop\Windows\Interop.ServiceControlDelegates.cs + + + Common\Interop\Windows\Interop.SetServiceStatus.cs + + + Common\Interop\Windows\Interop.WTSSESSION_NOTIFICATION.cs + + + Common\Interop\Windows\Interop.RegisterServiceCtrlHandler.cs + + + Common\Interop\Windows\Interop.RegisterServiceCtrlHandlerEx.cs + + + Common\Interop\Windows\Interop.StartServiceCtrlDispatcher.cs + + + + + - + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/PowerBroadcastStatus.cs b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/PowerBroadcastStatus.cs new file mode 100644 index 0000000000..5d4b09b9a2 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/PowerBroadcastStatus.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceProcess +{ + public enum PowerBroadcastStatus + { + BatteryLow = Interop.Advapi32.PowerBroadcastStatus.PBT_APMBATTERYLOW, + OemEvent = Interop.Advapi32.PowerBroadcastStatus.PBT_APMOEMEVENT, + PowerStatusChange = Interop.Advapi32.PowerBroadcastStatus.PBT_APMPOWERSTATUSCHANGE, + QuerySuspend = Interop.Advapi32.PowerBroadcastStatus.PBT_APMQUERYSUSPEND, + QuerySuspendFailed = Interop.Advapi32.PowerBroadcastStatus.PBT_APMQUERYSUSPENDFAILED, + ResumeAutomatic = Interop.Advapi32.PowerBroadcastStatus.PBT_APMRESUMEAUTOMATIC, + ResumeCritical = Interop.Advapi32.PowerBroadcastStatus.PBT_APMRESUMECRITICAL, + ResumeSuspend = Interop.Advapi32.PowerBroadcastStatus.PBT_APMRESUMESUSPEND, + Suspend = Interop.Advapi32.PowerBroadcastStatus.PBT_APMSUSPEND, + } +} + diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs new file mode 100644 index 0000000000..d4be605cd8 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs @@ -0,0 +1,898 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security; +using System.Threading; + +using static Interop.Advapi32; + +namespace System.ServiceProcess +{ + /// + /// Provides a base class for a service that will exist as part of a service application. + /// must be derived when creating a new service class. + /// + public class ServiceBase : Component + { + private SERVICE_STATUS _status = new SERVICE_STATUS(); + private IntPtr _statusHandle; + private ServiceControlCallback _commandCallback; + private ServiceControlCallbackEx _commandCallbackEx; + private ServiceMainCallback _mainCallback; + private IntPtr _handleName; + private ManualResetEvent _startCompletedSignal; + private int _acceptedCommands; + private string _serviceName; + private bool _nameFrozen; // set to true once we've started running and ServiceName can't be changed any more. + private bool _commandPropsFrozen; // set to true once we've use the Can... properties. + private bool _disposed; + private bool _initialized; + + /// + /// + /// Indicates the maximum size for a service name. + /// + /// + public const int MaxNameLength = 80; + + /// + /// Creates a new instance of the class. + /// + public ServiceBase() + { + _acceptedCommands = AcceptOptions.ACCEPT_STOP; + ServiceName = ""; + } + + /// + /// When this method is called from OnStart, OnStop, OnPause or OnContinue, + /// the specified wait hint is passed to the + /// Service Control Manager to avoid having the service marked as hung. + /// + public unsafe void RequestAdditionalTime(int milliseconds) + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + if (_status.currentState != ServiceControlStatus.STATE_CONTINUE_PENDING && + _status.currentState != ServiceControlStatus.STATE_START_PENDING && + _status.currentState != ServiceControlStatus.STATE_STOP_PENDING && + _status.currentState != ServiceControlStatus.STATE_PAUSE_PENDING) + { + throw new InvalidOperationException(SR.NotInPendingState); + } + + _status.waitHint = milliseconds; + _status.checkPoint++; + SetServiceStatus(_statusHandle, pStatus); + } + } + + /// + /// The termination code for the service. Set this to a non-zero value before + /// stopping to indicate an error to the Service Control Manager. + /// + public int ExitCode + { + get + { + return _status.win32ExitCode; + } + set + { + _status.win32ExitCode = value; + } + } + + /// + /// Indicates whether the service can be handle notifications on + /// computer power status changes. + /// + [DefaultValue(false)] + public bool CanHandlePowerEvent + { + get + { + return (_acceptedCommands & AcceptOptions.ACCEPT_POWEREVENT) != 0; + } + set + { + if (_commandPropsFrozen) + throw new InvalidOperationException(SR.CannotChangeProperties); + + if (value) + { + _acceptedCommands |= AcceptOptions.ACCEPT_POWEREVENT; + } + else + { + _acceptedCommands &= ~AcceptOptions.ACCEPT_POWEREVENT; + } + } + } + + /// + /// Indicates whether the service can handle Terminal Server session change events. + /// + [DefaultValue(false)] + public bool CanHandleSessionChangeEvent + { + get + { + return (_acceptedCommands & AcceptOptions.ACCEPT_SESSIONCHANGE) != 0; + } + set + { + if (_commandPropsFrozen) + throw new InvalidOperationException(SR.CannotChangeProperties); + + if (value) + { + _acceptedCommands |= AcceptOptions.ACCEPT_SESSIONCHANGE; + } + else + { + _acceptedCommands &= ~AcceptOptions.ACCEPT_SESSIONCHANGE; + } + } + } + + /// + /// Indicates whether the service can be paused + /// and resumed. + /// + [DefaultValue(false)] + public bool CanPauseAndContinue + { + get + { + return (_acceptedCommands & AcceptOptions.ACCEPT_PAUSE_CONTINUE) != 0; + } + set + { + if (_commandPropsFrozen) + throw new InvalidOperationException(SR.CannotChangeProperties); + + if (value) + { + _acceptedCommands |= AcceptOptions.ACCEPT_PAUSE_CONTINUE; + } + else + { + _acceptedCommands &= ~AcceptOptions.ACCEPT_PAUSE_CONTINUE; + } + } + } + + /// + /// Indicates whether the service should be notified when + /// the system is shutting down. + /// + [DefaultValue(false)] + public bool CanShutdown + { + get + { + return (_acceptedCommands & AcceptOptions.ACCEPT_SHUTDOWN) != 0; + } + set + { + if (_commandPropsFrozen) + throw new InvalidOperationException(SR.CannotChangeProperties); + + if (value) + { + _acceptedCommands |= AcceptOptions.ACCEPT_SHUTDOWN; + } + else + { + _acceptedCommands &= ~AcceptOptions.ACCEPT_SHUTDOWN; + } + } + } + + /// + /// Indicates whether the service can be + /// stopped once it has started. + /// + [DefaultValue(true)] + public bool CanStop + { + get + { + return (_acceptedCommands & AcceptOptions.ACCEPT_STOP) != 0; + } + set + { + if (_commandPropsFrozen) + throw new InvalidOperationException(SR.CannotChangeProperties); + + if (value) + { + _acceptedCommands |= AcceptOptions.ACCEPT_STOP; + } + else + { + _acceptedCommands &= ~AcceptOptions.ACCEPT_STOP; + } + } + } + + [EditorBrowsable(EditorBrowsableState.Advanced)] + protected IntPtr ServiceHandle + { + get + { + return _statusHandle; + } + } + + /// + /// Indicates the short name used to identify the service to the system. + /// + public string ServiceName + { + get + { + return _serviceName; + } + set + { + if (_nameFrozen) + throw new InvalidOperationException(SR.CannotChangeName); + + // For component properties, "" is a special case. + if (value != "" && !ValidServiceName(value)) + throw new ArgumentException(SR.Format(SR.ServiceName, value, ServiceBase.MaxNameLength.ToString(CultureInfo.CurrentCulture))); + + _serviceName = value; + } + } + + internal static bool ValidServiceName(string serviceName) + { + if (serviceName == null) + return false; + + // not too long and check for empty name as well. + if (serviceName.Length > ServiceBase.MaxNameLength || serviceName.Length == 0) + return false; + + // no slashes or backslash allowed + foreach (char c in serviceName) + { + if ((c == '\\') || (c == '/')) + return false; + } + + return true; + } + + /// + /// Disposes of the resources (other than memory ) used by + /// the . + /// + protected override void Dispose(bool disposing) + { + if (_handleName != (IntPtr)0) + { + Marshal.FreeHGlobal(_handleName); + _handleName = (IntPtr)0; + } + + _nameFrozen = false; + _commandPropsFrozen = false; + _disposed = true; + base.Dispose(disposing); + } + + /// + /// When implemented in a + /// derived class, + /// executes when a Continue command is sent to the service + /// by the + /// Service Control Manager. Specifies the actions to take when a + /// service resumes normal functioning after being paused. + /// + protected virtual void OnContinue() + { + } + + /// + /// When implemented in a + /// derived class, executes when a Pause command is sent + /// to + /// the service by the Service Control Manager. Specifies the + /// actions to take when a service pauses. + /// + protected virtual void OnPause() + { + } + + /// + /// + /// When implemented in a derived class, executes when the computer's + /// power status has changed. + /// + /// + protected virtual bool OnPowerEvent(PowerBroadcastStatus powerStatus) + { + return true; + } + + /// + /// When implemented in a derived class, + /// executes when a Terminal Server session change event is received. + /// + protected virtual void OnSessionChange(SessionChangeDescription changeDescription) + { + } + + /// + /// When implemented in a derived class, + /// executes when the system is shutting down. + /// Specifies what should + /// happen just prior + /// to the system shutting down. + /// + protected virtual void OnShutdown() + { + } + + /// + /// When implemented in a + /// derived class, executes when a Start command is sent + /// to the service by the Service + /// Control Manager. Specifies the actions to take when the service starts. + /// + /// Tech review note: + /// except that the SCM does not allow passing arguments, so this overload will + /// never be called by the SCM in the current version. Question: Is this true even + /// when the string array is empty? What should we say, then. Can + /// a ServiceBase derived class only be called programmatically? Will + /// OnStart never be called if you use the SCM to start the service? What about + /// services that start automatically at boot-up? + /// + /// + protected virtual void OnStart(string[] args) + { + } + + /// + /// When implemented in a + /// derived class, executes when a Stop command is sent to the + /// service by the Service Control Manager. Specifies the actions to take when a + /// service stops + /// running. + /// + protected virtual void OnStop() + { + } + + private unsafe void DeferredContinue() + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + try + { + OnContinue(); + WriteLogEntry(SR.ContinueSuccessful); + _status.currentState = ServiceControlStatus.STATE_RUNNING; + } + catch (Exception e) + { + _status.currentState = ServiceControlStatus.STATE_PAUSED; + WriteLogEntry(SR.Format(SR.ContinueFailed, e.ToString()), true); + + // We re-throw the exception so that the advapi32 code can report + // ERROR_EXCEPTION_IN_SERVICE as it would for native services. + throw; + } + finally + { + SetServiceStatus(_statusHandle, pStatus); + } + } + } + + private void DeferredCustomCommand(int command) + { + try + { + OnCustomCommand(command); + WriteLogEntry(SR.CommandSuccessful); + } + catch (Exception e) + { + WriteLogEntry(SR.Format(SR.CommandFailed, e.ToString()), true); + + // We should re-throw the exception so that the advapi32 code can report + // ERROR_EXCEPTION_IN_SERVICE as it would for native services. + throw; + } + } + + private unsafe void DeferredPause() + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + try + { + OnPause(); + WriteLogEntry(SR.PauseSuccessful); + _status.currentState = ServiceControlStatus.STATE_PAUSED; + } + catch (Exception e) + { + _status.currentState = ServiceControlStatus.STATE_RUNNING; + WriteLogEntry(SR.Format(SR.PauseFailed, e.ToString()), true); + + // We re-throw the exception so that the advapi32 code can report + // ERROR_EXCEPTION_IN_SERVICE as it would for native services. + throw; + } + finally + { + SetServiceStatus(_statusHandle, pStatus); + } + } + } + + private void DeferredPowerEvent(int eventType, IntPtr eventData) + { + // Note: The eventData pointer might point to an invalid location + // This might happen because, between the time the eventData ptr was + // captured and the time this deferred code runs, the ptr might have + // already been freed. + try + { + PowerBroadcastStatus status = (PowerBroadcastStatus)eventType; + bool statusResult = OnPowerEvent(status); + + WriteLogEntry(SR.PowerEventOK); + } + catch (Exception e) + { + WriteLogEntry(SR.Format(SR.PowerEventFailed, e.ToString()), true); + + // We rethrow the exception so that advapi32 code can report + // ERROR_EXCEPTION_IN_SERVICE as it would for native services. + throw; + } + } + + private void DeferredSessionChange(int eventType, int sessionId) + { + try + { + OnSessionChange(new SessionChangeDescription((SessionChangeReason)eventType, sessionId)); + } + catch (Exception e) + { + WriteLogEntry(SR.Format(SR.SessionChangeFailed, e.ToString()), true); + + // We rethrow the exception so that advapi32 code can report + // ERROR_EXCEPTION_IN_SERVICE as it would for native services. + throw; + } + } + + // We mustn't call OnStop directly from the command callback, as this will + // tie up the command thread for the duration of the OnStop, which can be lengthy. + // This is a problem when multiple services are hosted in a single process. + private unsafe void DeferredStop() + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + int previousState = _status.currentState; + + _status.checkPoint = 0; + _status.waitHint = 0; + _status.currentState = ServiceControlStatus.STATE_STOP_PENDING; + SetServiceStatus(_statusHandle, pStatus); + try + { + OnStop(); + WriteLogEntry(SR.StopSuccessful); + _status.currentState = ServiceControlStatus.STATE_STOPPED; + SetServiceStatus(_statusHandle, pStatus); + } + catch (Exception e) + { + _status.currentState = previousState; + SetServiceStatus(_statusHandle, pStatus); + WriteLogEntry(SR.Format(SR.StopFailed, e.ToString()), true); + throw; + } + } + } + + private unsafe void DeferredShutdown() + { + try + { + OnShutdown(); + WriteLogEntry(SR.Format(SR.ShutdownOK)); + + if (_status.currentState == ServiceControlStatus.STATE_PAUSED || _status.currentState == ServiceControlStatus.STATE_RUNNING) + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + _status.checkPoint = 0; + _status.waitHint = 0; + _status.currentState = ServiceControlStatus.STATE_STOPPED; + SetServiceStatus(_statusHandle, pStatus); + } + } + } + catch (Exception e) + { + WriteLogEntry(SR.Format(SR.ShutdownFailed, e.ToString()), true); + throw; + } + } + + /// + /// When implemented in a derived class, + /// executes when a custom command is passed to + /// the service. Specifies the actions to take when + /// a command with the specified parameter value occurs. + /// + /// Previously had "Passed to the + /// service by + /// the SCM", but the SCM doesn't pass custom commands. Do we want to indicate an + /// agent here? Would it be the ServiceController, or is there another way to pass + /// the int into the service? I thought that the SCM did pass it in, but + /// otherwise ignored it since it was an int it doesn't recognize. I was under the + /// impression that the difference was that the SCM didn't have default processing, so + /// it transmitted it without examining it or trying to performs its own + /// default behavior on it. Please correct where my understanding is wrong in the + /// second paragraph below--what, if any, contact does the SCM have with a + /// custom command? + /// + /// + protected virtual void OnCustomCommand(int command) + { + } + + /// + /// Provides the main entry point for an executable that + /// contains multiple associated services. Loads the specified services into memory so they can be + /// started. + /// + public static void Run(ServiceBase[] services) + { + if (services == null || services.Length == 0) + throw new ArgumentException(SR.NoServices); + + IntPtr entriesPointer = Marshal.AllocHGlobal((IntPtr)((services.Length + 1) * Marshal.SizeOf(typeof(SERVICE_TABLE_ENTRY)))); + SERVICE_TABLE_ENTRY[] entries = new SERVICE_TABLE_ENTRY[services.Length]; + bool multipleServices = services.Length > 1; + IntPtr structPtr = (IntPtr)0; + + for (int index = 0; index < services.Length; ++index) + { + services[index].Initialize(multipleServices); + entries[index] = services[index].GetEntry(); + structPtr = (IntPtr)((long)entriesPointer + Marshal.SizeOf(typeof(SERVICE_TABLE_ENTRY)) * index); + Marshal.StructureToPtr(entries[index], structPtr, true); + } + + SERVICE_TABLE_ENTRY lastEntry = new SERVICE_TABLE_ENTRY(); + + lastEntry.callback = null; + lastEntry.name = (IntPtr)0; + structPtr = (IntPtr)((long)entriesPointer + Marshal.SizeOf(typeof(SERVICE_TABLE_ENTRY)) * services.Length); + Marshal.StructureToPtr(lastEntry, structPtr, true); + + // While the service is running, this function will never return. It will return when the service + // is stopped. + bool res = StartServiceCtrlDispatcher(entriesPointer); + string errorMessage = ""; + + if (!res) + { + errorMessage = new Win32Exception().Message; + Console.WriteLine(SR.CantStartFromCommandLine); + } + + foreach (ServiceBase service in services) + { + service.Dispose(); + if (!res) + { + service.WriteLogEntry(SR.Format(SR.StartFailed, errorMessage), true); + } + } + } + + /// + /// Provides the main + /// entry point for an executable that contains a single + /// service. Loads the service into memory so it can be + /// started. + /// + public static void Run(ServiceBase service) + { + if (service == null) + throw new ArgumentException(SR.NoServices); + + Run(new ServiceBase[] { service }); + } + + public void Stop() + { + DeferredStop(); + } + + private void Initialize(bool multipleServices) + { + if (!_initialized) + { + //Cannot register the service with NT service manatger if the object has been disposed, since finalization has been suppressed. + if (_disposed) + throw new ObjectDisposedException(GetType().Name); + + if (!multipleServices) + { + _status.serviceType = ServiceTypeOptions.SERVICE_TYPE_WIN32_OWN_PROCESS; + } + else + { + _status.serviceType = ServiceTypeOptions.SERVICE_TYPE_WIN32_SHARE_PROCESS; + } + + _status.currentState = ServiceControlStatus.STATE_START_PENDING; + _status.controlsAccepted = 0; + _status.win32ExitCode = 0; + _status.serviceSpecificExitCode = 0; + _status.checkPoint = 0; + _status.waitHint = 0; + + _mainCallback = new ServiceMainCallback(this.ServiceMainCallback); + _commandCallback = new ServiceControlCallback(this.ServiceCommandCallback); + _commandCallbackEx = new ServiceControlCallbackEx(this.ServiceCommandCallbackEx); + _handleName = Marshal.StringToHGlobalUni(this.ServiceName); + + _initialized = true; + } + } + + private SERVICE_TABLE_ENTRY GetEntry() + { + SERVICE_TABLE_ENTRY entry = new SERVICE_TABLE_ENTRY(); + + _nameFrozen = true; + entry.callback = (Delegate)_mainCallback; + entry.name = _handleName; + return entry; + } + + private int ServiceCommandCallbackEx(int command, int eventType, IntPtr eventData, IntPtr eventContext) + { + switch (command) + { + case ControlOptions.CONTROL_POWEREVENT: + { + ThreadPool.QueueUserWorkItem(_ => DeferredPowerEvent(eventType, eventData)); + break; + } + + case ControlOptions.CONTROL_SESSIONCHANGE: + { + // The eventData pointer can be released between now and when the DeferredDelegate gets called. + // So we capture the session id at this point + WTSSESSION_NOTIFICATION sessionNotification = new WTSSESSION_NOTIFICATION(); + Marshal.PtrToStructure(eventData, sessionNotification); + ThreadPool.QueueUserWorkItem(_ => DeferredSessionChange(eventType, sessionNotification.sessionId)); + break; + } + + default: + { + ServiceCommandCallback(command); + break; + } + } + + return 0; + } + + /// + /// Command Handler callback is called by NT . + /// Need to take specific action in response to each + /// command message. There is usually no need to override this method. + /// Instead, override OnStart, OnStop, OnCustomCommand, etc. + /// + /// + private unsafe void ServiceCommandCallback(int command) + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + if (command == ControlOptions.CONTROL_INTERROGATE) + SetServiceStatus(_statusHandle, pStatus); + else if (_status.currentState != ServiceControlStatus.STATE_CONTINUE_PENDING && + _status.currentState != ServiceControlStatus.STATE_START_PENDING && + _status.currentState != ServiceControlStatus.STATE_STOP_PENDING && + _status.currentState != ServiceControlStatus.STATE_PAUSE_PENDING) + { + switch (command) + { + case ControlOptions.CONTROL_CONTINUE: + if (_status.currentState == ServiceControlStatus.STATE_PAUSED) + { + _status.currentState = ServiceControlStatus.STATE_CONTINUE_PENDING; + SetServiceStatus(_statusHandle, pStatus); + + ThreadPool.QueueUserWorkItem(_ => DeferredContinue()); + } + + break; + + case ControlOptions.CONTROL_PAUSE: + if (_status.currentState == ServiceControlStatus.STATE_RUNNING) + { + _status.currentState = ServiceControlStatus.STATE_PAUSE_PENDING; + SetServiceStatus(_statusHandle, pStatus); + + ThreadPool.QueueUserWorkItem(_ => DeferredPause()); + } + + break; + + case ControlOptions.CONTROL_STOP: + int previousState = _status.currentState; + // + // Can't perform all of the service shutdown logic from within the command callback. + // This is because there is a single ScDispatcherLoop for the entire process. Instead, we queue up an + // asynchronous call to "DeferredStop", and return immediately. This is crucial for the multiple service + // per process scenario, such as the new managed service host model. + // + if (_status.currentState == ServiceControlStatus.STATE_PAUSED || _status.currentState == ServiceControlStatus.STATE_RUNNING) + { + _status.currentState = ServiceControlStatus.STATE_STOP_PENDING; + SetServiceStatus(_statusHandle, pStatus); + // Set our copy of the state back to the previous so that the deferred stop routine + // can also save the previous state. + _status.currentState = previousState; + + ThreadPool.QueueUserWorkItem(_ => DeferredStop()); + } + + break; + + case ControlOptions.CONTROL_SHUTDOWN: + // + // Same goes for shutdown -- this needs to be very responsive, so we can't have one service tying up the + // dispatcher loop. + // + ThreadPool.QueueUserWorkItem(_ => DeferredShutdown()); + break; + + default: + ThreadPool.QueueUserWorkItem(_ => DeferredCustomCommand(command)); + break; + } + } + } + } + + // Need to execute the start method on a thread pool thread. + // Most applications will start asynchronous operations in the + // OnStart method. If such a method is executed in MainCallback + // thread, the async operations might get canceled immediately. + private void ServiceQueuedMainCallback(object state) + { + string[] args = (string[])state; + + try + { + OnStart(args); + WriteLogEntry(SR.StartSuccessful); + _status.checkPoint = 0; + _status.waitHint = 0; + _status.currentState = ServiceControlStatus.STATE_RUNNING; + } + catch (Exception e) + { + WriteLogEntry(SR.Format(SR.StartFailed, e.ToString()), true); + _status.currentState = ServiceControlStatus.STATE_STOPPED; + } + _startCompletedSignal.Set(); + } + + /// + /// ServiceMain callback is called by NT . + /// It is expected that we register the command handler, + /// and start the service at this point. + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public unsafe void ServiceMainCallback(int argCount, IntPtr argPointer) + { + fixed (SERVICE_STATUS* pStatus = &_status) + { + string[] args = null; + + if (argCount > 0) + { + char** argsAsPtr = (char**)argPointer.ToPointer(); + + //Lets read the arguments + // the first arg is always the service name. We don't want to pass that in. + args = new string[argCount - 1]; + + for (int index = 0; index < args.Length; ++index) + { + // we increment the pointer first so we skip over the first argument. + argsAsPtr++; + args[index] = Marshal.PtrToStringUni((IntPtr)(*argsAsPtr)); + } + } + + // If we are being hosted, then Run will not have been called, since the EXE's Main entrypoint is not called. + if (!_initialized) + { + Initialize(true); + } + + _statusHandle = RegisterServiceCtrlHandlerEx(ServiceName, (Delegate)_commandCallbackEx, (IntPtr)0); + + _nameFrozen = true; + if (_statusHandle == (IntPtr)0) + { + string errorMessage = new Win32Exception().Message; + WriteLogEntry(SR.Format(SR.StartFailed, errorMessage), true); + } + + _status.controlsAccepted = _acceptedCommands; + _commandPropsFrozen = true; + if ((_status.controlsAccepted & AcceptOptions.ACCEPT_STOP) != 0) + { + _status.controlsAccepted = _status.controlsAccepted | AcceptOptions.ACCEPT_SHUTDOWN; + } + + _status.currentState = ServiceControlStatus.STATE_START_PENDING; + + bool statusOK = SetServiceStatus(_statusHandle, pStatus); + + if (!statusOK) + { + return; + } + + // Need to execute the start method on a thread pool thread. + // Most applications will start asynchronous operations in the + // OnStart method. If such a method is executed in the current + // thread, the async operations might get canceled immediately + // since NT will terminate this thread right after this function + // finishes. + _startCompletedSignal = new ManualResetEvent(false); + ThreadPool.QueueUserWorkItem(new WaitCallback(this.ServiceQueuedMainCallback), args); + _startCompletedSignal.WaitOne(); + statusOK = SetServiceStatus(_statusHandle, pStatus); + if (!statusOK) + { + WriteLogEntry(SR.Format(SR.StartFailed, new Win32Exception().Message), true); + _status.currentState = ServiceControlStatus.STATE_STOPPED; + SetServiceStatus(_statusHandle, pStatus); + } + } + } + + private void WriteLogEntry(string message, bool error = false) + { + // Used to write to EventLog but for now just logging to debug output stream + // might want to plumb other logging in the future. + + Debug.WriteLine((error ? "Error: " : "") + message); + } + } +} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs index dace4866a0..0dabc4e9cc 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceController.cs @@ -3,23 +3,23 @@ // See the LICENSE file in the project root for more information. using Microsoft.Win32.SafeHandles; -using System.Text; -using System.Runtime.InteropServices; -using System.ComponentModel; -using System.Diagnostics; using System; using System.Collections.Generic; -using System.Threading; +using System.ComponentModel; +using System.Diagnostics; using System.Globalization; +using System.Runtime.InteropServices; using System.Security; +using System.Text; +using System.Threading; namespace System.ServiceProcess { /// This class represents an NT service. It allows you to connect to a running or stopped service /// and manipulate it or get information about it. - public class ServiceController : IDisposable + public class ServiceController : Component { - private readonly string _machineName; + private string _machineName; private readonly ManualResetEvent _waitForStatusSignal = new ManualResetEvent(false); private const string DefaultMachineName = "."; @@ -40,6 +40,11 @@ namespace System.ServiceProcess private const int SERVICENAMEMAXLENGTH = 80; private const int DISPLAYNAMEBUFFERSIZE = 256; + public ServiceController() + { + _type = Interop.Advapi32.ServiceTypeOptions.SERVICE_TYPE_ALL; + } + /// Creates a ServiceController object, based on service name. public ServiceController(string name) : this(name, DefaultMachineName) @@ -132,6 +137,22 @@ namespace System.ServiceProcess GenerateNames(); return _displayName; } + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + + if (string.Equals(value, _displayName, StringComparison.OrdinalIgnoreCase)) + { + // they're just changing the casing. No need to close. + _displayName = value; + return; + } + + Close(); + _displayName = value; + _name = ""; + } } /// The set of services that depend on this service. These are the services that will be stopped if @@ -203,6 +224,22 @@ namespace System.ServiceProcess { return _machineName; } + set + { + if (!CheckMachineName(value)) + throw new ArgumentException(SR.Format(SR.BadMachineName, value)); + + if (string.Equals(_machineName, value, StringComparison.OrdinalIgnoreCase)) + { + // no need to close, because the most they're changing is the + // casing. + _machineName = value; + return; + } + + Close(); + _machineName = value; + } } /// Returns the short name of the service referenced by this object. @@ -214,6 +251,26 @@ namespace System.ServiceProcess GenerateNames(); return _name; } + set + { + if (value == null) + throw new ArgumentNullException(nameof(value)); + + if (string.Equals(value, _name, StringComparison.OrdinalIgnoreCase)) + { + // they might be changing the casing, but the service we refer to + // is the same. No need to close. + _name = value; + return; + } + + if (!ServiceBase.ValidServiceName(value)) + throw new ArgumentException(SR.Format(SR.ServiceName, value, ServiceBase.MaxNameLength.ToString(CultureInfo.CurrentCulture))); + + Close(); + _name = value; + _displayName = ""; + } } public unsafe ServiceController[] ServicesDependedOn @@ -254,7 +311,7 @@ namespace System.ServiceProcess if (dependencyChar != null) { // lpDependencies points to the start of multiple null-terminated strings. The list is - // double-null terminated. + // double-null terminated. int length = 0; dependencyHash = new Dictionary(); while (*(dependencyChar + length) != '\0') @@ -391,17 +448,13 @@ namespace System.ServiceProcess return !string.IsNullOrWhiteSpace(value) && value.IndexOf('\\') == -1; } - private void Close() + public void Close() { - } - - public void Dispose() - { - Dispose(true); + Dispose(); } /// Disconnects this object from the service and frees any allocated resources. - protected virtual void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (_serviceManagerHandle != null) { @@ -723,6 +776,25 @@ namespace System.ServiceProcess } } + public unsafe void ExecuteCommand(int command) + { + IntPtr serviceHandle = GetServiceHandle(Interop.Advapi32.ServiceOptions.SERVICE_USER_DEFINED_CONTROL); + try + { + Interop.Advapi32.SERVICE_STATUS status = new Interop.Advapi32.SERVICE_STATUS(); + bool result = Interop.Advapi32.ControlService(serviceHandle, command, &status); + if (!result) + { + Exception inner = new Win32Exception(Marshal.GetLastWin32Error()); + throw new InvalidOperationException(SR.Format(SR.ControlService, ServiceName, MachineName), inner); + } + } + finally + { + Interop.Advapi32.CloseServiceHandle(serviceHandle); + } + } + /// Refreshes all property values. public void Refresh() { diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/SessionChangeDescription.cs b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/SessionChangeDescription.cs new file mode 100644 index 0000000000..8889f18031 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/SessionChangeDescription.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceProcess +{ + public struct SessionChangeDescription + { + private readonly SessionChangeReason _reason; + private readonly int _id; + + internal SessionChangeDescription(SessionChangeReason reason, int id) + { + _reason = reason; + _id = id; + } + + public SessionChangeReason Reason + { + get + { + return _reason; + } + } + + public int SessionId + { + get + { + return _id; + } + } + + public override bool Equals(object obj) + { + if (obj == null || !(obj is SessionChangeDescription)) + { + return false; + } + else + { + return Equals((SessionChangeDescription)obj); + } + } + + public override int GetHashCode() + { + return (int)_reason ^ _id; + } + + public bool Equals(SessionChangeDescription changeDescription) + { + return (_reason == changeDescription._reason) && (_id == changeDescription._id); + } + + public static bool operator ==(SessionChangeDescription a, SessionChangeDescription b) + { + return a.Equals(b); + } + + public static bool operator !=(SessionChangeDescription a, SessionChangeDescription b) + { + return !a.Equals(b); + } + } +} + diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/SessionChangeReason.cs b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/SessionChangeReason.cs new file mode 100644 index 0000000000..b3c3ee1026 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/SessionChangeReason.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.ServiceProcess +{ + public enum SessionChangeReason + { + /// + /// A session was connected to the console session. + /// + ConsoleConnect = Interop.Advapi32.SessionStateChange.WTS_CONSOLE_CONNECT, + /// + /// A session was disconnected from the console session. + /// + ConsoleDisconnect = Interop.Advapi32.SessionStateChange.WTS_CONSOLE_DISCONNECT, + /// + /// A session was connected to the remote session. + /// + RemoteConnect = Interop.Advapi32.SessionStateChange.WTS_REMOTE_CONNECT, + /// + /// A session was disconnected from the remote session. + /// + RemoteDisconnect = Interop.Advapi32.SessionStateChange.WTS_REMOTE_DISCONNECT, + /// + /// A user has logged on to the session. + /// + SessionLogon = Interop.Advapi32.SessionStateChange.WTS_SESSION_LOGON, + /// + /// A user has logged off the session. + /// + SessionLogoff = Interop.Advapi32.SessionStateChange.WTS_SESSION_LOGOFF, + /// + /// A session has been locked. + /// + SessionLock = Interop.Advapi32.SessionStateChange.WTS_SESSION_LOCK, + /// + /// A session has been unlocked. + /// + SessionUnlock = Interop.Advapi32.SessionStateChange.WTS_SESSION_UNLOCK, + /// + /// A session has changed its remote controlled status. + /// + SessionRemoteControl = Interop.Advapi32.SessionStateChange.WTS_SESSION_REMOTE_CONTROL + } +} + diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs index 7c4c909d4d..e64d5606cd 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs +++ b/external/corefx/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs @@ -8,7 +8,7 @@ using System.Runtime.Serialization; namespace System.ServiceProcess { [Serializable] - public class TimeoutException : Exception + public class TimeoutException : SystemException { private const int ServiceControllerTimeout = unchecked((int)0x80131906); diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/Configurations.props b/external/corefx/src/System.ServiceProcess.ServiceController/tests/Configurations.props new file mode 100644 index 0000000000..552f5e92bc --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/Configurations.props @@ -0,0 +1,9 @@ + + + + + netcoreapp-Windows_NT; + netfx-Windows_NT; + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/SafeServiceControllerTests.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/SafeServiceControllerTests.cs similarity index 94% rename from external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/SafeServiceControllerTests.cs rename to external/corefx/src/System.ServiceProcess.ServiceController/tests/SafeServiceControllerTests.cs index 1cb0515ef8..b5d747c7cf 100644 --- a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/SafeServiceControllerTests.cs +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/SafeServiceControllerTests.cs @@ -6,18 +6,17 @@ using Xunit; namespace System.ServiceProcess.Tests { - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Appx doesn't allow to access ServiceController")] public static class SafeServiceControllerTests { private const string KeyIsoSvcName = "KEYISO"; - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/19223 + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/19223 public static void GetServices() { bool foundKeyIsoSvc = false; bool foundSamSvc = false; bool foundOtherSvc = false; - + foreach (var service in ServiceController.GetServices()) { // The CNG Key Isolation service (KeyIso) and Security Accounts Manager (SAM) service (SamSs) diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs new file mode 100644 index 0000000000..96fd003295 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs @@ -0,0 +1,186 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32; +using System; +using System.Diagnostics; +using System.Security.Principal; +using Xunit; + +/// +/// NOTE: All tests checking the output file should always call Stop before checking because Stop will flush the file to disk. +/// +namespace System.ServiceProcess.Tests +{ + [OuterLoop(/* Modifies machine state */)] + public class ServiceBaseTests : IDisposable + { + private readonly TestServiceProvider _testService; + + private static readonly Lazy s_isElevated = new Lazy(() => AdminHelpers.IsProcessElevated()); + protected static bool IsProcessElevated => s_isElevated.Value; + + private bool _disposed; + + public ServiceBaseTests() + { + _testService = new TestServiceProvider(); + } + + private void AssertExpectedProperties(ServiceController testServiceController) + { + var comparer = PlatformDetection.IsFullFramework ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; // Full framework upper cases the name + Assert.Equal(_testService.TestServiceName, testServiceController.ServiceName, comparer); + Assert.Equal(_testService.TestServiceDisplayName, testServiceController.DisplayName); + Assert.Equal(_testService.TestMachineName, testServiceController.MachineName); + Assert.Equal(ServiceType.Win32OwnProcess, testServiceController.ServiceType); + Assert.True(testServiceController.CanPauseAndContinue); + Assert.True(testServiceController.CanStop); + Assert.True(testServiceController.CanShutdown); + } + + //[Fact] + // To cleanup lingering Test Services uncomment the Fact attribute and run the following command + // msbuild /t:rebuildandtest /p:XunitMethodName=System.ServiceProcess.Tests.ServiceBaseTests.Cleanup + // Remember to comment out the Fact again before running tests otherwise it will cleanup tests running in parallel + // and casue them to fail. + public void Cleanup() + { + string currentService = ""; + foreach (ServiceController controller in ServiceController.GetServices()) + { + try + { + currentService = controller.DisplayName; + if (controller.DisplayName.StartsWith("Test Service")) + { + Console.WriteLine("Trying to clean-up " + currentService); + TestServiceInstaller deleteService = new TestServiceInstaller() + { + ServiceName = controller.ServiceName + }; + deleteService.RemoveService(); + Console.WriteLine("Cleaned up " + currentService); + } + } + catch (Exception ex) + { + Console.WriteLine("Failed " + ex.Message); + } + } + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void TestOnStartThenStop() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + string expected = +@"OnStart args= +OnStop +"; + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + Assert.Equal(expected, _testService.GetServiceOutput()); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void TestOnStartWithArgsThenStop() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + + string expected = +@"OnStart args=a,b,c +OnStop +"; + controller.Start(new string[] { "a", "b", "c" }); + controller.WaitForStatus(ServiceControllerStatus.Running); + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + Assert.Equal(expected, _testService.GetServiceOutput()); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void TestOnPauseThenStop() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + string expected = +@"OnStart args= +OnPause +OnStop +"; + controller.Pause(); + controller.WaitForStatus(ServiceControllerStatus.Paused); + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + Assert.Equal(expected, _testService.GetServiceOutput()); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void TestOnPauseAndContinueThenStop() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + string expected = +@"OnStart args= +OnPause +OnContinue +OnStop +"; + controller.Pause(); + controller.WaitForStatus(ServiceControllerStatus.Paused); + controller.Continue(); + controller.WaitForStatus(ServiceControllerStatus.Running); + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + Assert.Equal(expected, _testService.GetServiceOutput()); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void TestOnExecuteCustomCommand() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + string expected = +@"OnStart args= +OnCustomCommand command=128 +OnStop +"; + controller.ExecuteCommand(128); + controller.WaitForStatus(ServiceControllerStatus.Running); + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + Assert.Equal(expected, _testService.GetServiceOutput()); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void TestOnContinueBeforePause() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + string expected = +@"OnStart args= +OnStop +"; + controller.Continue(); + controller.WaitForStatus(ServiceControllerStatus.Running); + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped); + Assert.Equal(expected, _testService.GetServiceOutput()); + } + + public void Dispose() + { + if (!_disposed) + { + _testService.DeleteTestServices(); + _disposed = true; + } + } + } +} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/ServiceControllerTests.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/ServiceControllerTests.cs new file mode 100644 index 0000000000..11978dfe06 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/ServiceControllerTests.cs @@ -0,0 +1,230 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32; +using System; +using System.Diagnostics; +using System.Security.Principal; +using Xunit; + +namespace System.ServiceProcess.Tests +{ + [OuterLoop(/* Modifies machine state */)] + public class ServiceControllerTests : IDisposable + { + private readonly TestServiceProvider _testService; + + private static readonly Lazy s_isElevated = new Lazy(() => AdminHelpers.IsProcessElevated()); + protected static bool IsProcessElevated => s_isElevated.Value; + + private const int ExpectedDependentServiceCount = 3; + private bool _disposed; + + public ServiceControllerTests() + { + _testService = new TestServiceProvider(); + } + + private void AssertExpectedProperties(ServiceController testServiceController) + { + var comparer = PlatformDetection.IsFullFramework ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; // Full framework upper cases the name + Assert.Equal(_testService.TestServiceName, testServiceController.ServiceName, comparer); + Assert.Equal(_testService.TestServiceDisplayName, testServiceController.DisplayName); + Assert.Equal(_testService.TestMachineName, testServiceController.MachineName); + Assert.Equal(ServiceType.Win32OwnProcess, testServiceController.ServiceType); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void ConstructWithServiceName() + { + var controller = new ServiceController(_testService.TestServiceName); + AssertExpectedProperties(controller); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void ConstructWithServiceName_ToUpper() + { + var controller = new ServiceController(_testService.TestServiceName.ToUpperInvariant()); + AssertExpectedProperties(controller); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void ConstructWithDisplayName() + { + var controller = new ServiceController(_testService.TestServiceDisplayName); + AssertExpectedProperties(controller); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void ConstructWithMachineName() + { + var controller = new ServiceController(_testService.TestServiceName, _testService.TestMachineName); + AssertExpectedProperties(controller); + + AssertExtensions.Throws(null, () => { var c = new ServiceController(_testService.TestServiceName, ""); }); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void ControlCapabilities() + { + var controller = new ServiceController(_testService.TestServiceName); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + + Assert.True(controller.CanStop); + Assert.True(controller.CanPauseAndContinue); + Assert.True(controller.CanShutdown); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void StartWithArguments() + { + var controller = new ServiceController(_testService.TestServiceName); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Running, controller.Status); + + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Stopped, controller.Status); + + var args = new[] { "a", "b", "c", "d", "e" }; + controller.Start(args); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Running, controller.Status); + + string argsOutput = _testService.GetServiceOutput().Trim(); + string argsInput = "OnStart args=" + string.Join(",", args); + Assert.Equal(argsInput, argsOutput); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void Start_NullArg_ThrowsArgumentNullException() + { + var controller = new ServiceController(_testService.TestServiceName); + Assert.Throws(() => controller.Start(new string[] { null } )); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void StopAndStart() + { + var controller = new ServiceController(_testService.TestServiceName); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Running, controller.Status); + + for (int i = 0; i < 2; i++) + { + controller.Stop(); + controller.WaitForStatus(ServiceControllerStatus.Stopped, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Stopped, controller.Status); + + controller.Start(); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Running, controller.Status); + } + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void PauseAndContinue() + { + var controller = new ServiceController(_testService.TestServiceName); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Running, controller.Status); + + for (int i = 0; i < 2; i++) + { + controller.Pause(); + controller.WaitForStatus(ServiceControllerStatus.Paused, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Paused, controller.Status); + + controller.Continue(); + controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); + Assert.Equal(ServiceControllerStatus.Running, controller.Status); + } + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void GetServices_FindSelf() + { + bool foundTestService = false; + + foreach (var service in ServiceController.GetServices()) + { + if (service.ServiceName == _testService.TestServiceName) + { + foundTestService = true; + AssertExpectedProperties(service); + } + } + + Assert.True(foundTestService, "Test service was not enumerated with all services"); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void Dependencies() + { + // The test service creates a number of dependent services, each of which is depended on + // by all the services created after it. + var controller = new ServiceController(_testService.TestServiceName); + Assert.Equal(0, controller.DependentServices.Length); + Assert.Equal(1, controller.ServicesDependedOn.Length); + + var dependentController = new ServiceController(_testService.TestServiceName + ".Dependent"); + Assert.Equal(1, dependentController.DependentServices.Length); + Assert.Equal(0, dependentController.ServicesDependedOn.Length); + + Assert.Equal(controller.ServicesDependedOn[0].ServiceName, dependentController.ServiceName); + Assert.Equal(dependentController.DependentServices[0].ServiceName, controller.ServiceName); + } + + [ConditionalFact(nameof(IsProcessElevated))] + public void ServicesStartMode() + { + var controller = new ServiceController(_testService.TestServiceName); + Assert.Equal(ServiceStartMode.Manual, controller.StartType); + + // Check for the startType of the dependent services. + for (int i = 0; i < controller.DependentServices.Length; i++) + { + Assert.Equal(ServiceStartMode.Disabled, controller.DependentServices[i].StartType); + } + } + + public void Dispose() + { + if (!_disposed) + { + _testService.DeleteTestServices(); + _disposed = true; + } + } + + private static ServiceController AssertHasDependent(ServiceController controller, string serviceName, string displayName) + { + var dependent = FindService(controller.DependentServices, serviceName, displayName); + Assert.NotNull(dependent); + + return dependent; + } + + private static ServiceController AssertDependsOn(ServiceController controller, string serviceName, string displayName) + { + var dependency = FindService(controller.ServicesDependedOn, serviceName, displayName); + Assert.NotNull(dependency); + + return dependency; + } + + private static ServiceController FindService(ServiceController[] services, string serviceName, string displayName) + { + foreach (ServiceController service in services) + { + if (service.ServiceName == serviceName && service.DisplayName == displayName) + { + return service; + } + } + + return null; + } + } +} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/NativeTestService.cpp b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/NativeTestService.cpp deleted file mode 100644 index 02cd760faa..0000000000 --- a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/NativeTestService.cpp +++ /dev/null @@ -1,664 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#include -#include -#include -#include -#include - -#define DEPENDENT_SERVICES 3 - -// The path to this executable -TCHAR gModulePath[MAX_PATH]; - -// Log file handle -HANDLE ghLogFile; -std::wstring gLogFilePath; - -// Main Test Service State -SERVICE_STATUS gServiceStatus; -SERVICE_STATUS_HANDLE gServiceStatusHandle; -HANDLE ghServiceStopEvent; -LPTSTR gServiceName; -LPTSTR gServiceDisplayName; - -// Dependent Service State -std::wstring gDependentServiceNames[DEPENDENT_SERVICES]; -std::wstring gDependentServiceDisplayNames[DEPENDENT_SERVICES]; - -// Service Management Methods -VOID GenerateDependentServiceNames(); -BOOL CreateTestServices(); -SC_HANDLE CreateTestService(SC_HANDLE, LPCTSTR, LPCTSTR, LPCTSTR, int, LPCTSTR dependencies = NULL); -BOOL DeleteTestServices(); -BOOL DeleteTestService(SC_HANDLE, LPCTSTR); - -// Service Methods -VOID WINAPI ServiceMain(DWORD, LPTSTR*); -VOID WINAPI ServiceCtrlHandler(DWORD); -VOID ServiceReportStatus(DWORD, DWORD, DWORD); -VOID ServiceInit(DWORD, LPTSTR*); -BOOL InitModulePath(); -VOID CreateLogFile(); -DWORD DeleteLogFile(); -VOID LogMessage(LPCTSTR format, ...); - -int _tmain(int argc, _TCHAR* argv []) -{ - if (argc < 3 || argc > 4) - { - puts("usage: System.ServiceProcess.ServiceController.TestNativeService.exe [create|delete]"); - return 1; - } - - gServiceName = argv[1]; - gServiceDisplayName = argv[2]; - - if (argc == 3) - { - // When run with just a service name, just run as a service - SERVICE_TABLE_ENTRY DispatchTable [] = - { - { gServiceName, (LPSERVICE_MAIN_FUNCTION) ServiceMain }, - { NULL, NULL } - }; - - // This call returns when the service has stopped. - // The process should simply terminate when the call returns. - if (!StartServiceCtrlDispatcher(DispatchTable)) - { - LogMessage(L"error: StartServiceCtrlDispatcher failed (%d)\n", GetLastError()); - } - } - else if (argc == 4) - { - if (!InitModulePath()) - { - return -1; - } - - GenerateDependentServiceNames(); - - std::wstring action = argv[3]; - if (action == L"create") - { - if (!CreateTestServices()) - { - wprintf(L"error: Creating the test services failed\n"); - DeleteTestServices(); - return -1; - } - } - else if (action == L"delete") - { - if (!DeleteTestServices()) - { - wprintf(L"error: Deleting the test services failed\n"); - return -1; - } - } - else - { - wprintf(L"error: Invalid action '%s'\n", action.c_str()); - return -1; - } - } - - return 0; -} - -VOID GenerateDependentServiceNames() -{ - LPCTSTR nameSuffix = L".Dependent"; - - for (int i = 0; i < DEPENDENT_SERVICES; i++) - { - std::wstring& name = gDependentServiceNames[i]; - name = gServiceName; - name = name + nameSuffix; - name += '0' + i; - - std::wstring& displayName = gDependentServiceDisplayNames[i]; - displayName = gServiceDisplayName; - displayName += nameSuffix; - displayName += '0' + i; - } -} - -BOOL CreateTestServices() -{ - // Get a handle to the SCM database. - - SC_HANDLE hScManager = OpenSCManager( - NULL, // local computer - NULL, // ServicesActive database - SC_MANAGER_ALL_ACCESS); // full access rights - - if (hScManager == NULL) - { - wprintf(L"error: OpenSCManager failed (%d)\n", GetLastError()); - return false; - } - - // Create the main test service - - std::wstring serviceCommand = gModulePath; - serviceCommand += L" \""; - serviceCommand += gServiceName; - serviceCommand += L"\" \""; - serviceCommand += gServiceDisplayName; - serviceCommand += L"\""; - - SC_HANDLE hService = CreateTestService( - hScManager, - gServiceName, - gServiceDisplayName, - serviceCommand.c_str(), - SERVICE_DEMAND_START - ); - - if (hService == NULL) - { - CloseServiceHandle(hScManager); - return false; - } - - // Create dependent services - - std::wstring dependencies = gServiceName; - dependencies += (TCHAR)0; - - for (int i = 0; i < DEPENDENT_SERVICES; i++) - { - SC_HANDLE hDependentService = CreateTestService( - hScManager, - gDependentServiceNames[i].c_str(), - gDependentServiceDisplayNames[i].c_str(), - serviceCommand.c_str(), - SERVICE_DISABLED, - dependencies.c_str()); - - if (hDependentService == NULL) - { - CloseServiceHandle(hScManager); - return false; - } - - // Make each dependent service depend on all of the services before it - // for the sake of testing ServiceController.DependentServices and - // ServiceController.ServicesDepended on. We do this by inserting the name - // of the last dependent service created into the next dependent service's - // dependency list before the double null. - - dependencies.insert(dependencies.end() - 1, (TCHAR)0); - dependencies.insert(dependencies.length() - 1, gDependentServiceNames[i]); - } - - // Attempt to start the main test service - - BOOL result = StartService(hService, 0, NULL); - if (!result) - { - int error = GetLastError(); - if (error == ERROR_SERVICE_ALREADY_RUNNING) - { - wprintf(L"warning: Service '%s' is already running\n", gServiceName); - result = true; - } - else - { - wprintf(L"error: StartService failed (%d)\n", error); - } - } - - CloseServiceHandle(hService); - CloseServiceHandle(hScManager); - return result; -} - -SC_HANDLE CreateTestService(SC_HANDLE hScManager, LPCTSTR name, LPCTSTR displayName, LPCTSTR command, int startType, LPCTSTR dependencies) -{ - SC_HANDLE hService = CreateService( - hScManager, // SCM database - name, // name of service - displayName, // service name to display - SERVICE_ALL_ACCESS, // desired access - SERVICE_WIN32_OWN_PROCESS, // service type - startType, // start type - SERVICE_ERROR_NORMAL, // error control type - command, // path to service's binary + arguments - NULL, // no load ordering group - NULL, // no tag identifier - dependencies, // dependencies (optional) - NULL, // LocalSystem account - NULL); // no password - - if (!hService) - { - BOOL result = false; - int error = GetLastError(); - - switch (error) - { - case ERROR_SERVICE_EXISTS: - wprintf(L"warning: Service '%s' already exists.\n", name); - - hService = OpenService(hScManager, name, SERVICE_ALL_ACCESS); - if (hService == NULL) - { - wprintf(L"error: Failed to open service '%s' (%d)\n", name, GetLastError()); - return NULL; - } - break; - - case ERROR_SERVICE_MARKED_FOR_DELETE: - wprintf(L"error: Service '%s' exists and has been marked for deletion.\n", name); - return NULL; - - default: - wprintf(L"error: Failed to create service '%s' (%d)\n", name, error); - return NULL; - } - } - - return hService; -} - -BOOL DeleteTestServices() -{ - SC_HANDLE hScManager = OpenSCManager( - NULL, // local computer - NULL, // ServicesActive database - SC_MANAGER_ALL_ACCESS); // full access rights - - if (hScManager == NULL) - { - wprintf(L"error: OpenSCManager failed (%d)\n", GetLastError()); - return false; - } - - // Delete dependent services - - for (int i = 0; i < DEPENDENT_SERVICES; i++) - { - LPCTSTR name = gDependentServiceNames[i].c_str(); - - SC_HANDLE hDependentService = OpenService( - hScManager, - name, - SERVICE_ALL_ACCESS); - - if (hDependentService == NULL) - { - wprintf(L"warning: Failed to open service '%s' (%d)\n", name, GetLastError()); - continue; - } - - DeleteTestService(hDependentService, name); - CloseServiceHandle(hDependentService); - } - - // Stop and delete the main test service - - SC_HANDLE hService = OpenService( - hScManager, // SCM database - gServiceName, // name of service - SERVICE_ALL_ACCESS); // desired access - - if (hService == NULL) - { - wprintf(L"error: Failed to open service '%s' (%d)\n", gServiceName, GetLastError()); - CloseServiceHandle(hScManager); - return false; - } - - SERVICE_CONTROL_STATUS_REASON_PARAMS reasonParams = - { - SERVICE_STOP_REASON_FLAG_PLANNED | SERVICE_STOP_REASON_MAJOR_NONE | SERVICE_STOP_REASON_MINOR_INSTALLATION, - L"Stopping service for delete", - { 0 } - }; - - if (!ControlServiceEx(hService, SERVICE_CONTROL_STOP, SERVICE_CONTROL_STATUS_REASON_INFO, &reasonParams)) - { - int error = GetLastError(); - if (error == ERROR_SERVICE_NOT_ACTIVE) - { - wprintf(L"warning: Service '%s' is already stopped\n", gServiceName); - } - else - { - wprintf(L"warning: Failed to stop service (%d). Will still delete, but recreating may fail if the service is still running.\n", error); - } - } - - BOOL result = DeleteTestService(hService, gServiceName); - - CloseServiceHandle(hService); - CloseServiceHandle(hScManager); - return result; -} - -BOOL DeleteTestService(SC_HANDLE hService, LPCTSTR name) -{ - BOOL result = DeleteService(hService); - - if (!result) - { - wprintf(L"error: Failed to delete service '%s' (%d)\n", name, GetLastError()); - } - - return result; -} - -// -// Purpose: -// Entry point for the service -// -// Parameters: -// dwArgc - Number of arguments in the lpszArgv array -// lpszArgv - Array of strings. The first string is the name of -// the service and subsequent strings are passed by the process -// that called the StartService function to start the service. -// -// Return value: -// None. -// -VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR* lpszArgv) -{ - // Register the handler function for the service - - gServiceStatusHandle = RegisterServiceCtrlHandler(gServiceName, ServiceCtrlHandler); - - if (!gServiceStatusHandle) - { - LogMessage(L"error: RegisterServiceCtrlHandler failed (%d)\n", GetLastError()); - return; - } - - // These SERVICE_STATUS members remain as set here - - gServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - gServiceStatus.dwServiceSpecificExitCode = 0; - - // Report initial status to the SCM - - ServiceReportStatus(SERVICE_START_PENDING, NO_ERROR, 3000); - - // Perform service-specific initialization and work. - - ServiceInit(dwArgc, lpszArgv); -} - -// -// Purpose: -// The service code -// -// Parameters: -// dwArgc - Number of arguments in the lpszArgv array -// lpszArgv - Array of strings. The first string is the name of -// the service and subsequent strings are passed by the process -// that called the StartService function to start the service. -// -// Return value: -// None -// -VOID ServiceInit(DWORD dwArgc, LPTSTR* lpszArgv) -{ - // Create an event. The control handler function, ServiceCtrlHandler, - // signals this event when it receives the stop control code. - - ghServiceStopEvent = CreateEvent( - NULL, // default security attributes - TRUE, // manual reset event - FALSE, // not signaled - NULL); // no name - - if (ghServiceStopEvent == NULL) - { - ServiceReportStatus(SERVICE_STOPPED, NO_ERROR, 0); - return; - } - - InitModulePath(); - CreateLogFile(); - - // Write the service arguments to the registry key: - // HKEY_USERS\.DEFAULT\dotnetTests\ServiceController\\ServiceArguments - // to verify that they were correctly passed through. - - std::wstring keyPath = L".DEFAULT\\dotnetTests\\ServiceController\\"; - keyPath += gServiceName; - - HKEY hKey; - LONG result = RegCreateKeyEx( - HKEY_USERS, - keyPath.c_str(), - 0, - NULL, - REG_OPTION_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hKey, - NULL); - - if (result != ERROR_SUCCESS) - { - LogMessage(L"warning: failed to open or create registry key 'HKEY_USERS\\%s' (%d)\n", keyPath.c_str(), result); - } - else - { - // Join the arguments array, separating each argument with a comma - - std::wstring argsString; - DWORD i = 1; - - for (; i < dwArgc - 1; i++) - { - argsString += lpszArgv[i]; - argsString += L','; - } - - if (i < dwArgc) - { - argsString += lpszArgv[i]; - } - - // Write the result to the value "ServiceArguments" - - LPCTSTR valueName = L"ServiceArguments"; - result = RegSetValueEx( - hKey, - valueName, - 0, - REG_SZ, - (const BYTE*) argsString.c_str(), - (DWORD) ((argsString.length() + 1) * sizeof(wchar_t))); - - if (result != ERROR_SUCCESS) - { - LogMessage(L"warning: failed to set value '%s' = '%s' in registry key 'HKEY_USERS\\%s' (%d)\n", valueName, argsString.c_str(), keyPath.c_str(), result); - } - - RegCloseKey(hKey); - } - - // Report running status when initialization is complete. - - ServiceReportStatus(SERVICE_RUNNING, NO_ERROR, 0); - - while (1) - { - // Check whether to stop the service. - - // If the tests haven't finished within 90 seconds, just end the program anyways. - DWORD error = WaitForSingleObject(ghServiceStopEvent, 90000); - - // We're stopping, delete the log file - DWORD logError = DeleteLogFile(); - - // If WaitForSingleObject fails, use that code. - // Otherwise use the result of DeleteLogFile. - if (error == ERROR_SUCCESS) - { - error = logError; - } - - ServiceReportStatus(SERVICE_STOPPED, error, 0); - return; - } -} - -// -// Purpose: -// Sets the current service status and reports it to the SCM. -// -// Parameters: -// dwCurrentState - The current state (see SERVICE_STATUS) -// dwWin32ExitCode - The system error code -// dwWaitHint - Estimated time for pending operation, -// in milliseconds -// -// Return value: -// None -// -VOID ServiceReportStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint) -{ - static DWORD dwCheckPoint = 1; - - // Fill in the SERVICE_STATUS structure. - - gServiceStatus.dwCurrentState = dwCurrentState; - gServiceStatus.dwWin32ExitCode = dwWin32ExitCode; - gServiceStatus.dwWaitHint = dwWaitHint; - - if (dwCurrentState == SERVICE_START_PENDING) - gServiceStatus.dwControlsAccepted = 0; - else gServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE; - - if ((dwCurrentState == SERVICE_RUNNING) || - (dwCurrentState == SERVICE_STOPPED)) - gServiceStatus.dwCheckPoint = 0; - else gServiceStatus.dwCheckPoint = dwCheckPoint++; - - // Report the status of the service to the SCM. - - SetServiceStatus(gServiceStatusHandle, &gServiceStatus); -} - -// -// Purpose: -// Called by SCM whenever a control code is sent to the service -// using the ControlService function. -// -// Parameters: -// dwCtrl - control code -// -// Return value: -// None -// -VOID WINAPI ServiceCtrlHandler(DWORD dwCtrl) -{ - // Handle the requested control code. - - switch (dwCtrl) - { - case SERVICE_CONTROL_STOP: - ServiceReportStatus(SERVICE_STOP_PENDING, NO_ERROR, 0); - - // Signal the service to stop. - - SetEvent(ghServiceStopEvent); - ServiceReportStatus(gServiceStatus.dwCurrentState, NO_ERROR, 0); - break; - - case SERVICE_CONTROL_PAUSE: - ServiceReportStatus(SERVICE_PAUSED, NO_ERROR, 0); - break; - - case SERVICE_CONTROL_CONTINUE: - ServiceReportStatus(SERVICE_RUNNING, NO_ERROR, 0); - break; - - case SERVICE_CONTROL_INTERROGATE: - break; - - default: - break; - } -} - -BOOL InitModulePath() -{ - if (!GetModuleFileName(NULL, gModulePath, MAX_PATH)) - { - wprintf(L"error: Failed to get module file name (%d)\n", GetLastError()); - return FALSE; - } - - return TRUE; -} - -VOID CreateLogFile() -{ - gLogFilePath = gModulePath; - gLogFilePath += L'.'; - gLogFilePath += gServiceName; - gLogFilePath += L".txt"; - - ghLogFile = CreateFile( - gLogFilePath.c_str(), - GENERIC_WRITE, - FILE_SHARE_READ, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (ghLogFile == INVALID_HANDLE_VALUE) - { - wprintf(L"warning: Failed to create log file '%s'\n", gLogFilePath.c_str()); - } -} - -DWORD DeleteLogFile() -{ - CloseHandle(ghLogFile); - - if (!DeleteFile(gLogFilePath.c_str())) - { - DWORD error = GetLastError(); - return error; - } - - return NO_ERROR; -} - -VOID LogMessage(LPCTSTR format, ...) -{ - TCHAR buffer[256]; - va_list args; - va_start(args, format); - - int numChars = _vstprintf_s(buffer, 256, format, args); - - BOOL result = WriteFile( - ghLogFile, - buffer, - numChars * sizeof(TCHAR), - NULL, - NULL); - - if (!result) - { - wprintf(L"warning: Failed to write to the log file (%d): %s", GetLastError(), buffer); - } - - va_end(args); -} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/System.ServiceProcess.ServiceController.TestNativeService.vcxproj b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/System.ServiceProcess.ServiceController.TestNativeService.vcxproj deleted file mode 100644 index c051214af8..0000000000 --- a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestNativeService/System.ServiceProcess.ServiceController.TestNativeService.vcxproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - Release - x64 - - - - {CEB0775C-4273-4AC4-B50E-4492718051AE} - Win32Proj - Release - x64 - NativeTestService - $(OutputPath) - - v120 - - - - Application - false - $(DefaultPlatformToolset) - true - Unicode - - - - - - - - - - false - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - PreserveNewest - - - - - - - \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/Configurations.props b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/Configurations.props new file mode 100644 index 0000000000..5e52d60de3 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/Configurations.props @@ -0,0 +1,9 @@ + + + + + netcoreapp; + netfx; + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/Program.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/Program.cs new file mode 100644 index 0000000000..e085b6a0c5 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/Program.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace System.ServiceProcess.Tests +{ + public class Program + { + static int Main(string[] args) + { + if (args.Length == 1 || args.Length == 2) + { + TestService testService = new TestService(args[0]); + ServiceBase.Run(testService); + return 0; + } + else if (args.Length == 3) + { + TestServiceInstaller testServiceInstaller = new TestServiceInstaller(); + + testServiceInstaller.ServiceName = args[0]; + testServiceInstaller.DisplayName = args[1]; + + if (args[2] == "create") + { + testServiceInstaller.Install(); + return 0; + } + else if (args[2] == "delete") + { + testServiceInstaller.RemoveService(); + return 0; + } + else + { + Console.WriteLine("EROOR: Invalid Service verb. Only suppot create or delete."); + return 2; + } + } + + Console.WriteLine($"usage: [create|delete]"); + return 1; + } + } +} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj new file mode 100644 index 0000000000..f9a346b6d3 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.csproj @@ -0,0 +1,56 @@ + + + + + {E62B874D-1A0D-41BC-8CFC-9E09D0860A77} + true + exe + + + + + + + + + + Component + + + Common\Interop\Windows\Interop.Libraries.cs + + + Common\Interop\Windows\Interop.ServiceProcessOptions.cs + + + Common\Interop\Windows\Interop.CloseServiceHandle.cs + + + Common\Interop\Windows\Interop.OpenSCManager.cs + + + Common\Interop\Windows\Interop.OpenService.cs + + + Common\Interop\Windows\Interop.CreateService.cs + + + Common\Interop\Windows\Interop.SERVICE_DESCRIPTION.cs + + + Common\Interop\Windows\Interop.ChangeServiceConfig2.cs + + + Common\Interop\Windows\Interop.SERVICE_DELAYED_AUTOSTART_INFO.cs + + + Common\Interop\Windows\Interop.DeleteService.cs + + + + + PreserveNewest + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.runtimeconfig.json b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.runtimeconfig.json new file mode 100644 index 0000000000..573682438b --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/System.ServiceProcess.ServiceController.TestService.runtimeconfig.json @@ -0,0 +1,8 @@ +{ + "runtimeOptions": { + "framework": { + "name": "Microsoft.NETCore.App", + "version": "9.9.9" + } + } +} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/TestService.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/TestService.cs new file mode 100644 index 0000000000..24a8467e3b --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/TestService.cs @@ -0,0 +1,101 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System; +using System.Collections; +using System.IO; +using System.Threading; +using System.Text; +using System.Runtime.InteropServices; +using System.Globalization; + +namespace System.ServiceProcess.Tests +{ + public class TestService : ServiceBase + { + public TestService(string serviceName) + { + this.ServiceName = serviceName; + + // Enable all the events + this.CanPauseAndContinue = true; + this.CanStop = true; + this.CanShutdown = true; + + // We cannot easily test these so disable the events + this.CanHandleSessionChangeEvent = false; + this.CanHandlePowerEvent = false; + } + + protected override void OnContinue() + { + WriteLog(nameof(OnContinue)); + base.OnContinue(); + } + + protected override void OnCustomCommand(int command) + { + WriteLog(nameof(OnCustomCommand) + " command=" + command); + base.OnCustomCommand(command); + } + + protected override void OnPause() + { + WriteLog(nameof(OnPause)); + base.OnPause(); + } + + protected override void OnSessionChange(SessionChangeDescription changeDescription) + { + WriteLog(nameof(OnSessionChange) + " change=" + changeDescription.ToString()); + base.OnSessionChange(changeDescription); + } + + protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus) + { + WriteLog(nameof(OnPowerEvent) + " status=" + powerStatus.ToString()); + return base.OnPowerEvent(powerStatus); + } + + protected override void OnShutdown() + { + WriteLog(nameof(OnShutdown)); + base.OnShutdown(); + } + + protected override void OnStart(string[] args) + { + WriteLog(nameof(OnStart) + " args=" + string.Join(",", args)); + base.OnStart(args); + } + + protected override void OnStop() + { + WriteLog(nameof(OnStop)); + base.OnStop(); + + if (_log != null) + { + _log.Dispose(); + _log = null; + } + } + + private StreamWriter _log; + + private void WriteLog(string msg) + { + if (_log == null) + { + string path = System.Reflection.Assembly.GetEntryAssembly().Location + "." + ServiceName + ".log"; + _log = new StreamWriter(path); + _log.AutoFlush = true; +; } + + _log.WriteLine(msg); + } + } +} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/TestServiceInstaller.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/TestServiceInstaller.cs new file mode 100644 index 0000000000..878f560386 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.TestService/TestServiceInstaller.cs @@ -0,0 +1,183 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Text; +using System.Runtime.InteropServices; + +namespace System.ServiceProcess.Tests +{ + public class TestServiceInstaller + { + public const string LocalServiceName = "NT AUTHORITY\\LocalService"; + + private string _removalStack; + + public TestServiceInstaller() + { + } + + public string DisplayName { get; set; } = string.Empty; + + public string Description { get; set; } = string.Empty; + + public string[] ServicesDependedOn { get; set; } = Array.Empty(); + + public string ServiceName { get; set; } = string.Empty; + + public ServiceStartMode StartType { get; set; } = ServiceStartMode.Manual; + + public string Username { get; set; } + + public string Password { get; set; } + + public string ServiceCommandLine { get; set; } + + public unsafe void Install() + { + string username = Username; + string password = Password; + + if (string.IsNullOrEmpty(username)) + { + username = LocalServiceName; + } + + if (ServiceCommandLine == null) + { + string processName = Process.GetCurrentProcess().MainModule.FileName; + string entryPointName = System.Reflection.Assembly.GetEntryAssembly().Location; + string arguments = ServiceName; + + // if process and entry point aren't the same then we are running hosted so pass + // in the entrypoint as the first argument + if (!string.Equals(processName, entryPointName, StringComparison.OrdinalIgnoreCase)) + { + arguments = $"\"{entryPointName}\" {arguments}"; + } + + ServiceCommandLine = $"\"{processName}\" {arguments}"; + } + + //Build servicesDependedOn string + string servicesDependedOn = null; + if (ServicesDependedOn.Length > 0) + { + StringBuilder buff = new StringBuilder(); + for (int i = 0; i < ServicesDependedOn.Length; ++i) + { + //The servicesDependedOn need to be separated by a null + buff.Append(ServicesDependedOn[i]); + buff.Append('\0'); + } + // an extra null at the end indicates end of list. + buff.Append('\0'); + + servicesDependedOn = buff.ToString(); + } + + // Open the service manager + IntPtr serviceManagerHandle = Interop.Advapi32.OpenSCManager(null, null, Interop.Advapi32.ServiceControllerOptions.SC_MANAGER_ALL); + IntPtr serviceHandle = IntPtr.Zero; + if (serviceManagerHandle == IntPtr.Zero) + throw new InvalidOperationException("Cannot open Service Control Manager"); + + try + { + // Install the service + serviceHandle = Interop.Advapi32.CreateService(serviceManagerHandle, ServiceName, + DisplayName, Interop.Advapi32.ServiceAccessOptions.ACCESS_TYPE_ALL, Interop.Advapi32.ServiceTypeOptions.SERVICE_TYPE_WIN32_OWN_PROCESS, + (int)StartType, Interop.Advapi32.ServiceStartErrorModes.ERROR_CONTROL_NORMAL, + ServiceCommandLine, null, IntPtr.Zero, servicesDependedOn, username, password); + + if (serviceHandle == IntPtr.Zero) + throw new Win32Exception(); + + // A local variable in an unsafe method is already fixed -- so we don't need a "fixed { }" blocks to protect + // across the p/invoke calls below. + + if (Description.Length != 0) + { + Interop.Advapi32.SERVICE_DESCRIPTION serviceDesc = new Interop.Advapi32.SERVICE_DESCRIPTION(); + serviceDesc.description = Marshal.StringToHGlobalUni(Description); + bool success = Interop.Advapi32.ChangeServiceConfig2(serviceHandle, Interop.Advapi32.ServiceConfigOptions.SERVICE_CONFIG_DESCRIPTION, ref serviceDesc); + Marshal.FreeHGlobal(serviceDesc.description); + if (!success) + throw new Win32Exception(); + } + + // Start the service after creating it + using (ServiceController svc = new ServiceController(ServiceName)) + { + if (svc.Status != ServiceControllerStatus.Running) + { + svc.Start(); + svc.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(30)); + } + } + } + finally + { + if (serviceHandle != IntPtr.Zero) + Interop.Advapi32.CloseServiceHandle(serviceHandle); + + Interop.Advapi32.CloseServiceHandle(serviceManagerHandle); + } + } + + public void RemoveService() + { + if (ServiceName == null) + throw new InvalidOperationException($"Already removed service at stack ${_removalStack}"); + + // Store the stack for logging in case we're called twice + try + { + throw new Exception(); + } + catch (Exception e) + { + _removalStack = e.StackTrace; + } + + // Stop the service + using (ServiceController svc = new ServiceController(ServiceName)) + { + if (svc.Status != ServiceControllerStatus.Stopped) + { + svc.Stop(); + svc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(30)); + } + } + + IntPtr serviceManagerHandle = Interop.Advapi32.OpenSCManager(null, null, Interop.Advapi32.ServiceControllerOptions.SC_MANAGER_ALL); + if (serviceManagerHandle == IntPtr.Zero) + throw new Win32Exception(); + + IntPtr serviceHandle = IntPtr.Zero; + try + { + serviceHandle = Interop.Advapi32.OpenService(serviceManagerHandle, + ServiceName, Interop.Advapi32.ServiceOptions.STANDARD_RIGHTS_DELETE); + + if (serviceHandle == IntPtr.Zero) + throw new Win32Exception(); + + if (!Interop.Advapi32.DeleteService(serviceHandle)) + throw new Win32Exception(); + } + finally + { + if (serviceHandle != IntPtr.Zero) + Interop.Advapi32.CloseServiceHandle(serviceHandle); + + Interop.Advapi32.CloseServiceHandle(serviceManagerHandle); + } + + ServiceName = null; + } + } +} \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests.csproj b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests.csproj new file mode 100644 index 0000000000..52c5fd1475 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests.csproj @@ -0,0 +1,21 @@ + + + + + {F7D9984B-02EB-4573-84EF-00FFFBFB872C} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/Configurations.props b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/Configurations.props deleted file mode 100644 index 249c8c18b4..0000000000 --- a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/Configurations.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - netstandard-Windows_NT; - - - \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs deleted file mode 100644 index 405f20c447..0000000000 --- a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/ServiceControllerTests.cs +++ /dev/null @@ -1,306 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Win32; -using System; -using System.Diagnostics; -using System.Security.Principal; -using Xunit; - -namespace System.ServiceProcess.Tests -{ - internal sealed class ServiceProvider - { - public readonly string TestMachineName; - public readonly TimeSpan ControlTimeout; - public readonly string TestServiceName; - public readonly string TestServiceDisplayName; - public readonly string DependentTestServiceNamePrefix; - public readonly string DependentTestServiceDisplayNamePrefix; - public readonly string TestServiceRegistryKey; - - public ServiceProvider() - { - TestMachineName = "."; - ControlTimeout = TimeSpan.FromSeconds(120); - TestServiceName = Guid.NewGuid().ToString(); - TestServiceDisplayName = "Test Service " + TestServiceName; - DependentTestServiceNamePrefix = TestServiceName + ".Dependent"; - DependentTestServiceDisplayNamePrefix = TestServiceDisplayName + ".Dependent"; - TestServiceRegistryKey = @"HKEY_USERS\.DEFAULT\dotnetTests\ServiceController\" + TestServiceName; - - // Create the service - CreateTestServices(); - } - - private void CreateTestServices() - { - // Create the test service and its dependent services. Then, start the test service. - // All control tests assume that the test service is running when they are executed. - // So all tests should make sure to restart the service if they stop, pause, or shut - // it down. - RunServiceExecutable("create"); - } - - public void DeleteTestServices() - { - RunServiceExecutable("delete"); - RegistryKey users = Registry.Users; - if (users.OpenSubKey(".DEFAULT\\dotnetTests") != null) - users.DeleteSubKeyTree(".DEFAULT\\dotnetTests"); - } - - private void RunServiceExecutable(string action) - { - const string serviceExecutable = "System.ServiceProcess.ServiceController.TestNativeService.exe"; - var process = new Process(); - process.StartInfo.FileName = serviceExecutable; - process.StartInfo.Arguments = string.Format("\"{0}\" \"{1}\" {2}", TestServiceName, TestServiceDisplayName, action); - process.Start(); - process.WaitForExit(); - - if (process.ExitCode != 0) - { - throw new Exception("error: " + serviceExecutable + " failed with exit code " + process.ExitCode.ToString()); - } - } - } - - [OuterLoop(/* Modifies machine state */)] - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Appx doesn't allow to access ServiceController")] - public class ServiceControllerTests : IDisposable - { - private const int ExpectedDependentServiceCount = 3; - - private static readonly Lazy s_runningWithElevatedPrivileges = new Lazy( - () => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)); - - private readonly ServiceProvider _testService; - - public ServiceControllerTests() - { - _testService = new ServiceProvider(); - } - - private static bool RunningWithElevatedPrivileges - { - get { return s_runningWithElevatedPrivileges.Value; } - } - - private void AssertExpectedProperties(ServiceController testServiceController) - { - var comparer = PlatformDetection.IsFullFramework ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; // Full framework upper cases the name - Assert.Equal(_testService.TestServiceName, testServiceController.ServiceName, comparer); - Assert.Equal(_testService.TestServiceDisplayName, testServiceController.DisplayName); - Assert.Equal(_testService.TestMachineName, testServiceController.MachineName); - Assert.Equal(ServiceType.Win32OwnProcess, testServiceController.ServiceType); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void ConstructWithServiceName() - { - var controller = new ServiceController(_testService.TestServiceName); - AssertExpectedProperties(controller); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void ConstructWithServiceName_ToUpper() - { - var controller = new ServiceController(_testService.TestServiceName.ToUpperInvariant()); - AssertExpectedProperties(controller); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void ConstructWithDisplayName() - { - var controller = new ServiceController(_testService.TestServiceDisplayName); - AssertExpectedProperties(controller); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void ConstructWithMachineName() - { - var controller = new ServiceController(_testService.TestServiceName, _testService.TestMachineName); - AssertExpectedProperties(controller); - - AssertExtensions.Throws(null, () => { var c = new ServiceController(_testService.TestServiceName, ""); }); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void ControlCapabilities() - { - var controller = new ServiceController(_testService.TestServiceName); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - - Assert.True(controller.CanStop); - Assert.True(controller.CanPauseAndContinue); - Assert.False(controller.CanShutdown); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void StartWithArguments() - { - var controller = new ServiceController(_testService.TestServiceName); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Running, controller.Status); - - controller.Stop(); - controller.WaitForStatus(ServiceControllerStatus.Stopped, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Stopped, controller.Status); - - var args = new[] { "a", "b", "c", "d", "e" }; - controller.Start(args); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Running, controller.Status); - - // The test service writes the arguments that it was started with to the _testService.TestServiceRegistryKey. - // Read this key to verify that the arguments were properly passed to the service. - string argsString = Registry.GetValue(_testService.TestServiceRegistryKey, "ServiceArguments", null) as string; - Assert.Equal(string.Join(",", args), argsString); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void Start_NullArg_ThrowsArgumentNullException() - { - var controller = new ServiceController(_testService.TestServiceName); - Assert.Throws(() => controller.Start(new string[] { null } )); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void StopAndStart() - { - var controller = new ServiceController(_testService.TestServiceName); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Running, controller.Status); - - for (int i = 0; i < 2; i++) - { - controller.Stop(); - controller.WaitForStatus(ServiceControllerStatus.Stopped, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Stopped, controller.Status); - - controller.Start(); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Running, controller.Status); - } - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void PauseAndContinue() - { - var controller = new ServiceController(_testService.TestServiceName); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Running, controller.Status); - - for (int i = 0; i < 2; i++) - { - controller.Pause(); - controller.WaitForStatus(ServiceControllerStatus.Paused, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Paused, controller.Status); - - controller.Continue(); - controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); - Assert.Equal(ServiceControllerStatus.Running, controller.Status); - } - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void GetServices_FindSelf() - { - bool foundTestService = false; - - foreach (var service in ServiceController.GetServices()) - { - if (service.ServiceName == _testService.TestServiceName) - { - foundTestService = true; - AssertExpectedProperties(service); - } - } - - Assert.True(foundTestService, "Test service was not enumerated with all services"); - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void Dependencies() - { - // The test service creates a number of dependent services, each of which is depended on - // by all the services created after it. - var controller = new ServiceController(_testService.TestServiceName); - Assert.Equal(ExpectedDependentServiceCount, controller.DependentServices.Length); - - for (int i = 0; i < controller.DependentServices.Length; i++) - { - var dependent = AssertHasDependent(controller, _testService.DependentTestServiceNamePrefix + i, _testService.DependentTestServiceDisplayNamePrefix + i); - Assert.Equal(ServiceType.Win32OwnProcess, dependent.ServiceType); - - // Assert that this dependent service is depended on by all the test services created after it - Assert.Equal(ExpectedDependentServiceCount - i - 1, dependent.DependentServices.Length); - - for (int j = i + 1; j < ExpectedDependentServiceCount; j++) - { - AssertHasDependent(dependent, _testService.DependentTestServiceNamePrefix + j, _testService.DependentTestServiceDisplayNamePrefix + j); - } - - // Assert that the dependent service depends on the main test service - AssertDependsOn(dependent, _testService.TestServiceName, _testService.TestServiceDisplayName); - - // Assert that this dependent service depends on all the test services created before it - Assert.Equal(i + 1, dependent.ServicesDependedOn.Length); - - for (int j = i - 1; j >= 0; j--) - { - AssertDependsOn(dependent, _testService.DependentTestServiceNamePrefix + j, _testService.DependentTestServiceDisplayNamePrefix + j); - } - } - } - - [ConditionalFact(nameof(RunningWithElevatedPrivileges))] - public void ServicesStartMode() - { - var controller = new ServiceController(_testService.TestServiceName); - Assert.Equal(ServiceStartMode.Manual, controller.StartType); - - // Check for the startType of the dependent services. - for (int i = 0; i < controller.DependentServices.Length; i++) - { - Assert.Equal(ServiceStartMode.Disabled, controller.DependentServices[i].StartType); - } - } - - public void Dispose() - { - _testService.DeleteTestServices(); - } - - private static ServiceController AssertHasDependent(ServiceController controller, string serviceName, string displayName) - { - var dependent = FindService(controller.DependentServices, serviceName, displayName); - Assert.NotNull(dependent); - - return dependent; - } - - private static ServiceController AssertDependsOn(ServiceController controller, string serviceName, string displayName) - { - var dependency = FindService(controller.ServicesDependedOn, serviceName, displayName); - Assert.NotNull(dependency); - - return dependency; - } - - private static ServiceController FindService(ServiceController[] services, string serviceName, string displayName) - { - foreach (ServiceController service in services) - { - if (service.ServiceName == serviceName && service.DisplayName == displayName) - { - return service; - } - } - - return null; - } - } -} diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/System.ServiceProcess.ServiceController.Tests.csproj b/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/System.ServiceProcess.ServiceController.Tests.csproj deleted file mode 100644 index 0e9d264310..0000000000 --- a/external/corefx/src/System.ServiceProcess.ServiceController/tests/System.ServiceProcess.ServiceController.Tests/System.ServiceProcess.ServiceController.Tests.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - {F7D9984B-02EB-4573-84EF-00FFFBFB872C} - - - - - - - - - CommonTest\System\PlatformDetection.cs - - - - - {ceb0775c-4273-4ac4-b50e-4492718051ae} - System.ServiceProcess.ServiceController.TestNativeService - OSGroup;TargetGroup;Configuration - Configuration=Release - Platform=x64 - - - - \ No newline at end of file diff --git a/external/corefx/src/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs b/external/corefx/src/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs new file mode 100644 index 0000000000..30b499a324 --- /dev/null +++ b/external/corefx/src/System.ServiceProcess.ServiceController/tests/TestServiceProvider.cs @@ -0,0 +1,124 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32; +using System; +using System.Diagnostics; +using System.Security.Principal; +using Xunit; +using System.IO; +using System.Threading; + +namespace System.ServiceProcess.Tests +{ + internal sealed class TestServiceProvider + { + private static readonly Lazy s_runningWithElevatedPrivileges = new Lazy( + () => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)); + + public static bool RunningWithElevatedPrivileges + { + get { return s_runningWithElevatedPrivileges.Value; } + } + + public readonly string TestServiceAssembly = typeof(TestService).Assembly.Location; + public readonly string TestMachineName; + public readonly TimeSpan ControlTimeout; + public readonly string TestServiceName; + public readonly string TestServiceDisplayName; + + private readonly TestServiceProvider _dependentServices; + public TestServiceProvider() + { + TestMachineName = "."; + ControlTimeout = TimeSpan.FromSeconds(120); + TestServiceName = Guid.NewGuid().ToString(); + TestServiceDisplayName = "Test Service " + TestServiceName; + + _dependentServices = new TestServiceProvider(TestServiceName + ".Dependent"); + + // Create the service + CreateTestServices(); + } + + public TestServiceProvider(string serviceName) + { + TestMachineName = "."; + ControlTimeout = TimeSpan.FromSeconds(120); + TestServiceName = serviceName; + TestServiceDisplayName = "Test Service " + TestServiceName; + + // Create the service + CreateTestServices(); + } + + private void CreateTestServices() + { + TestServiceInstaller testServiceInstaller = new TestServiceInstaller(); + + testServiceInstaller.ServiceName = TestServiceName; + testServiceInstaller.DisplayName = TestServiceDisplayName; + + if (_dependentServices != null) + { + testServiceInstaller.ServicesDependedOn = new string[] { _dependentServices.TestServiceName }; + } + + var comparer = PlatformDetection.IsFullFramework ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; // Full framework upper cases the name + string processName = Process.GetCurrentProcess().MainModule.FileName; + string entryPointName = typeof(TestService).Assembly.Location; + string arguments = TestServiceName; + + // if process and entry point aren't the same then we are running hosted so pass + // in the entrypoint as the first argument + if (!PlatformDetection.IsFullFramework) + { + arguments = $"\"{entryPointName}\" {arguments}"; + } + else + { + processName = entryPointName; + } + + testServiceInstaller.ServiceCommandLine = $"\"{processName}\" {arguments}"; + + testServiceInstaller.Install(); + } + + public void DeleteTestServices() + { + try + { + TestServiceInstaller testServiceInstaller = new TestServiceInstaller(); + testServiceInstaller.ServiceName = TestServiceName; + testServiceInstaller.RemoveService(); + + if (File.Exists(LogPath)) + { + File.Delete(LogPath); + } + } + finally + { + // Lets be sure to try and clean up dependenct services even if something goes + // wrong with the full removal of the other service. + if (_dependentServices != null) + { + _dependentServices.DeleteTestServices(); + } + } + } + + private string LogPath => typeof(TestService).Assembly.Location + "." + TestServiceName + ".log"; + + public string GetServiceOutput() + { + // Need to open with FileShare.ReadWrite because we expect the service still has it open for write + using (StreamReader reader = new StreamReader(File.Open(LogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) + { + return reader.ReadToEnd(); + } + } + } +} diff --git a/external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.pkgproj b/external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.pkgproj index a61018ac85..a798cf4fe1 100644 --- a/external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.pkgproj +++ b/external/corefx/src/System.Text.Encoding.CodePages/pkg/System.Text.Encoding.CodePages.pkgproj @@ -7,22 +7,24 @@ - - - - lib/netstandard1.3 - + - - win - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Text.Encoding.CodePages/tests/System.Text.Encoding.CodePages.Tests.csproj b/external/corefx/src/System.Text.Encoding.CodePages/tests/System.Text.Encoding.CodePages.Tests.csproj index 94457ad1d3..4624105c12 100644 --- a/external/corefx/src/System.Text.Encoding.CodePages/tests/System.Text.Encoding.CodePages.Tests.csproj +++ b/external/corefx/src/System.Text.Encoding.CodePages/tests/System.Text.Encoding.CodePages.Tests.csproj @@ -9,9 +9,6 @@ - - CommonTest\System\PlatformDetection.cs - Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs b/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs index 567eb371ed..6bc7546f9d 100644 --- a/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs +++ b/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderConvert2.cs @@ -37,7 +37,7 @@ namespace System.Text.Tests private const int c_SIZE_OF_ARRAY = 127; private readonly RandomDataGenerator _generator = new RandomDataGenerator(); - // PosTest1: Call Convert to convert a arbitrary byte array to character array by using ASCII decoder + // PosTest1: Call Convert to convert an arbitrary byte array to character array by using ASCII decoder [Fact] public void PosTest1() { @@ -59,7 +59,7 @@ namespace System.Text.Tests decoder.Reset(); } - // PosTest2: Call Convert to convert a arbitrary byte array to character array by using Unicode decoder" + // PosTest2: Call Convert to convert an arbitrary byte array to character array by using Unicode decoder" [Fact] public void PosTest2() { diff --git a/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderSpanTests.netcoreapp.cs b/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderSpanTests.netcoreapp.cs new file mode 100644 index 0000000000..1f51d02a57 --- /dev/null +++ b/external/corefx/src/System.Text.Encoding/tests/Decoder/DecoderSpanTests.netcoreapp.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Text.Encodings.Tests +{ + public partial class DecoderTests + { + [Fact] + public static void GetCharCount_Span_MatchesEncodingCharCount() + { + const string TextString = "hello world"; + Encoding e = Encoding.UTF8; + byte[] textBytes = e.GetBytes(TextString); + + Assert.Equal(TextString.Length, e.GetDecoder().GetCharCount(textBytes.AsSpan(), flush: true)); + } + + [Fact] + public static void GetChars_Span_MatchesEncodingGetChars() + { + const string TextString = "hello world"; + Encoding e = Encoding.UTF8; + byte[] textBytes = e.GetBytes(TextString); + + char[] chars = new char[TextString.Length]; + Assert.Equal(chars.Length, e.GetDecoder().GetChars(textBytes.AsReadOnlySpan(), chars.AsSpan(), flush: true)); + Assert.Equal(TextString, new string(chars)); + } + + [Fact] + public static void Convert_Span_MatchesGetChars() + { + const string TextString = "hello world"; + Encoding e = Encoding.UTF8; + Decoder decoder = e.GetDecoder(); + byte[] textBytes = e.GetBytes(TextString); + char[] chars; + + chars = new char[TextString.Length]; + decoder.Convert(textBytes.AsSpan(), chars.AsSpan().Slice(0, 2), true, out int bytesUsed, out int charsUsed, out bool completed); + Assert.Equal("he", new string(chars, 0, 2)); + Assert.Equal(2, bytesUsed); + Assert.Equal(2, charsUsed); + Assert.False(completed); + + chars = new char[TextString.Length]; + decoder.Convert(textBytes.AsSpan(), chars.AsSpan(), true, out bytesUsed, out charsUsed, out completed); + Assert.Equal(TextString, new string(chars)); + Assert.Equal(textBytes.Length, bytesUsed); + Assert.Equal(TextString.Length, charsUsed); + Assert.True(completed); + } + } +} diff --git a/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderConvert2.cs b/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderConvert2.cs index f693c87a7c..e6e0a81945 100644 --- a/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderConvert2.cs +++ b/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderConvert2.cs @@ -50,7 +50,7 @@ namespace System.Text.Tests yield return new object[] { Encoding.Unicode.GetEncoder(), 2 }; } - // Call Convert to convert a arbitrary character array encoders + // Call Convert to convert an arbitrary character array encoders [Theory] [MemberData(nameof(Encoders_RandomInput))] public void EncoderConvertRandomCharArray(Encoder encoder) diff --git a/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderSpanTests.netcoreapp.cs b/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderSpanTests.netcoreapp.cs new file mode 100644 index 0000000000..e6c81c47fc --- /dev/null +++ b/external/corefx/src/System.Text.Encoding/tests/Encoder/EncoderSpanTests.netcoreapp.cs @@ -0,0 +1,53 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Text.Encodings.Tests +{ + public partial class EncoderTests + { + [Fact] + public static void GetByteCount_Span_MatchesEncodingByteCount() + { + const string TextString = "hello world"; + Encoding e = Encoding.UTF8; + Assert.Equal(e.GetByteCount(TextString), e.GetEncoder().GetByteCount(TextString.AsReadOnlySpan(), flush: true)); + } + + [Fact] + public static void GetBytes_Span_MatchesEncodingGetBytes() + { + const string TextString = "hello world"; + Encoding e = Encoding.UTF8; + + byte[] bytes = new byte[e.GetByteCount(TextString)]; + Assert.Equal(bytes.Length, e.GetEncoder().GetBytes(TextString.AsReadOnlySpan(), bytes, flush: true)); + Assert.Equal(e.GetBytes(TextString), bytes); + } + + [Fact] + public static void Convert_Span_MatchesGetBytes() + { + const string TextString = "hello world"; + Encoding encoding = Encoding.UTF8; + Encoder encoder = encoding.GetEncoder(); + byte[] bytes; + + bytes = new byte[encoding.GetByteCount(TextString)]; + encoder.Convert(TextString.AsReadOnlySpan(), bytes.AsSpan().Slice(0, 2), true, out int charsUsed, out int bytesUsed, out bool completed); + Assert.Equal(encoding.GetBytes(TextString).AsSpan().Slice(0, 2).ToArray(), bytes.AsSpan().Slice(0, 2).ToArray()); + Assert.Equal(2, charsUsed); + Assert.Equal(2, bytesUsed); + Assert.False(completed); + + bytes = new byte[encoding.GetByteCount(TextString)]; + encoder.Convert(TextString.AsReadOnlySpan(), bytes, true, out charsUsed, out bytesUsed, out completed); + Assert.Equal(encoding.GetBytes(TextString), bytes); + Assert.Equal(TextString.Length, charsUsed); + Assert.Equal(bytes.Length, bytesUsed); + Assert.True(completed); + } + } +} diff --git a/external/corefx/src/System.Text.Encoding/tests/Encoding/Encoding.cs b/external/corefx/src/System.Text.Encoding/tests/Encoding/Encoding.cs index f34e48e65d..12b149f40a 100644 --- a/external/corefx/src/System.Text.Encoding/tests/Encoding/Encoding.cs +++ b/external/corefx/src/System.Text.Encoding/tests/Encoding/Encoding.cs @@ -45,7 +45,7 @@ namespace System.Text.Encodings.Tests } [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full framework uses system ACP and not UTF8")] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework | TargetFrameworkMonikers.Mono, "Full framework uses system ACP and not UTF8")] public static void DefaultEncodingBOMTest() { UTF8Encoding defaultEncoding = Encoding.Default as UTF8Encoding; @@ -61,7 +61,9 @@ namespace System.Text.Encodings.Tests { Encoding encoding = Encoding.GetEncoding(info.CodePage); Assert.Equal(encoding, info.GetEncoding()); +#if !MONO // https://bugzilla.xamarin.com/show_bug.cgi?id=60202 Assert.Equal(encoding.WebName, info.Name); +#endif Assert.False(String.IsNullOrEmpty(info.DisplayName)); } } diff --git a/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.cs b/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.cs index b179f1f22a..a819f79fe4 100644 --- a/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.cs +++ b/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.cs @@ -123,6 +123,9 @@ namespace System.Text.Tests GetCharCount(encoding, bytes, index, count, expected.Length); GetChars(encoding, bytes, index, count, expected.ToCharArray()); GetString(encoding, bytes, index, count, expected); + + GetCharCount_NetCoreApp(encoding, bytes, index, count, expected.Length); + GetString_NetCoreApp(encoding, bytes, index, count, expected); } private static unsafe void GetCharCount(Encoding encoding, byte[] bytes, int index, int count, int expected) @@ -145,8 +148,7 @@ namespace System.Text.Tests } } - private static void GetChars(Encoding encoding, byte[] bytes, int index, int count, char[] - expectedChars) + private static void GetChars(Encoding encoding, byte[] bytes, int index, int count, char[] expectedChars) { char[] fullArray = new char[expectedChars.Length + 4]; for (int i = 0; i < fullArray.Length; i++) @@ -197,6 +199,8 @@ namespace System.Text.Tests } VerifyGetChars(bytePointerChars, charIndex, charCount, originalChars, expectedChars); } + + VerifyGetChars_NetCoreApp(encoding, bytes, byteIndex, byteCount, chars, charIndex, expectedChars); } private static void VerifyGetChars(char[] chars, int charIndex, int charCount, char[] originalChars, char[] expectedChars) @@ -228,12 +232,11 @@ namespace System.Text.Tests Assert.Equal(expected, encoding.GetString(bytes, index, count)); } -#if !netcoreapp - // Netcoreapp adds GetByteCount(string, int, int) and GetBytes(string, int, int) APIs. - // To use the common data from the Encode(...) entry point to these tests, we can define stubs that - // do nothing with netfx or netstandard. However, these are defined (they test the new APIs) with netcoreapp. - private static void GetByteCount_NetCoreApp(Encoding encoding, string chars, int index, int count, int expected) {} - private static void GetBytes_NetCoreApp(Encoding encoding, string chars, int index, int count, byte[] expected) {} -#endif + // Netcoreapp adds several Encoding members. + static partial void GetByteCount_NetCoreApp(Encoding encoding, string chars, int index, int count, int expected); + static partial void GetBytes_NetCoreApp(Encoding encoding, string chars, int index, int count, byte[] expected); + static partial void GetCharCount_NetCoreApp(Encoding encoding, byte[] bytes, int index, int count, int expected); + static partial void VerifyGetChars_NetCoreApp(Encoding encoding, byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, char[] expectedChars); + static partial void GetString_NetCoreApp(Encoding encoding, byte[] bytes, int index, int count, string expected); } } diff --git a/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.netcoreapp.cs b/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.netcoreapp.cs index 6811e74eb4..f82e81ae46 100644 --- a/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.netcoreapp.cs +++ b/external/corefx/src/System.Text.Encoding/tests/EncodingTestHelpers.netcoreapp.cs @@ -8,17 +8,46 @@ namespace System.Text.Tests { public static partial class EncodingHelpers { - private static void GetByteCount_NetCoreApp(Encoding encoding, string chars, int index, int count, int expected) + static partial void GetByteCount_NetCoreApp(Encoding encoding, string chars, int index, int count, int expected) { // Use GetByteCount(string, int, int) Assert.Equal(expected, encoding.GetByteCount(chars, index, count)); + + // Use GetByteCount(ReadOnlySpan chars) + Assert.Equal(expected, encoding.GetByteCount(chars.AsReadOnlySpan().Slice(index, count))); } - private static void GetBytes_NetCoreApp(Encoding encoding, string chars, int index, int count, byte[] expected) + static partial void GetBytes_NetCoreApp(Encoding encoding, string chars, int index, int count, byte[] expected) { // Use GetBytes(string, int, int) byte[] stringResultAdvanced = encoding.GetBytes(chars, index, count); VerifyGetBytes(stringResultAdvanced, 0, stringResultAdvanced.Length, new byte[expected.Length], expected); + + // Use GetBytes(ReadOnlySpan, Span) + Array.Clear(stringResultAdvanced, 0, stringResultAdvanced.Length); + Assert.Equal(expected.Length, encoding.GetBytes(chars.AsReadOnlySpan().Slice(index, count), (Span)stringResultAdvanced)); + VerifyGetBytes(stringResultAdvanced, 0, stringResultAdvanced.Length, new byte[expected.Length], expected); + } + + static partial void GetCharCount_NetCoreApp(Encoding encoding, byte[] bytes, int index, int count, int expected) + { + // Use GetCharCount(ReadOnlySpan) + Assert.Equal(expected, encoding.GetCharCount(new ReadOnlySpan(bytes, index, count))); + } + + static partial void VerifyGetChars_NetCoreApp(Encoding encoding, byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, char[] expectedChars) + { + // Use GetChars(ReadOnlySpan, Span) + char[] byteChars = (char[])chars.Clone(); + int charCount = encoding.GetChars(new ReadOnlySpan(bytes, byteIndex, byteCount), new Span(byteChars).Slice(charIndex)); + VerifyGetChars(byteChars, charIndex, charCount, (char[])chars.Clone(), expectedChars); + Assert.Equal(expectedChars.Length, charCount); + } + + static partial void GetString_NetCoreApp(Encoding encoding, byte[] bytes, int index, int count, string expected) + { + // Use GetString(ReadOnlySpan) + Assert.Equal(expected, encoding.GetString(new ReadOnlySpan(bytes, index, count))); } } } diff --git a/external/corefx/src/System.Text.Encoding/tests/Performance/Configurations.props b/external/corefx/src/System.Text.Encoding/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Text.Encoding/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Text.Encoding/tests/System.Text.Encoding.Tests.csproj b/external/corefx/src/System.Text.Encoding/tests/System.Text.Encoding.Tests.csproj index 38004a0195..d016ca2f63 100644 --- a/external/corefx/src/System.Text.Encoding/tests/System.Text.Encoding.Tests.csproj +++ b/external/corefx/src/System.Text.Encoding/tests/System.Text.Encoding.Tests.csproj @@ -19,6 +19,7 @@ + @@ -28,6 +29,7 @@ + diff --git a/external/corefx/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs b/external/corefx/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs index 39a3c4a9b4..cbded91274 100644 --- a/external/corefx/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs +++ b/external/corefx/src/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingDecode.cs @@ -99,7 +99,9 @@ namespace System.Text.Tests yield return new object[] { new byte[] { 84, 0, 101, 0, 115, 0, 116, 0, 84, 0, 101, 0, 115, 0, 116, 0, 3, 216 }, 0, 17, "TestTest\uFFFD" }; yield return new object[] { new byte[] { 84, 0, 0, 0, 84, 0, 101, 0, 10, 0, 115, 0, 116, 0, 0, 0, 9, 0, 0, 0, 84, 0, 15, 0, 101, 0, 115, 0, 116, 0, 0, 0, 0 }, 0, 33, "T\0Te\nst\0\t\0T\u000Fest\0\uFFFD" }; - + + yield return new object[] { new byte[] { 0, 0, 84, 0, 101, 0, 10, 0, 115, 0, 116, 0, 0, 0, 9, 0, 0, 0, 84, 0, 15, 0, 101, 0, 115, 0, 116, 0, 0, 0, 0 }, 0, 31, "\0Te\nst\0\t\0T\u000Fest\0\uFFFD" }; + yield return new object[] { new byte[] { 3, 216, 84 }, 0, 3, "\uFFFD\uFFFD" }; // Invalid surrogate bytes diff --git a/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/HtmlEncoder.cs b/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/HtmlEncoder.cs index 47aaeada12..46374faeaf 100644 --- a/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/HtmlEncoder.cs +++ b/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/HtmlEncoder.cs @@ -50,14 +50,14 @@ namespace System.Text.Encodings.Web private AllowedCharactersBitmap _allowedCharacters; internal static readonly DefaultHtmlEncoder Singleton = new DefaultHtmlEncoder(new TextEncoderSettings(UnicodeRanges.BasicLatin)); - public DefaultHtmlEncoder(TextEncoderSettings filter) + public DefaultHtmlEncoder(TextEncoderSettings settings) { - if (filter == null) + if (settings == null) { - throw new ArgumentNullException(nameof(filter)); + throw new ArgumentNullException(nameof(settings)); } - _allowedCharacters = filter.GetAllowedCharacters(); + _allowedCharacters = settings.GetAllowedCharacters(); // Forbid codepoints which aren't mapped to characters or which are otherwise always disallowed // (includes categories Cc, Cs, Co, Cn, Zs [except U+0020 SPACE], Zl, Zp) diff --git a/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoder.cs b/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoder.cs index c71eec9bd0..2b4923bc7f 100644 --- a/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoder.cs +++ b/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoder.cs @@ -146,7 +146,8 @@ namespace System.Text.Encodings.Web // this loop processes character pairs (in case they are surrogates). // there is an if block below to process single last character. - for (int secondCharIndex = valueIndex + 1; secondCharIndex < valueLength; secondCharIndex++) + int secondCharIndex; + for (secondCharIndex = valueIndex + 1; secondCharIndex < valueLength; secondCharIndex++) { if (!wasSurrogatePair) { @@ -184,7 +185,7 @@ namespace System.Text.Encodings.Web } } - if (!wasSurrogatePair) + if (secondCharIndex == valueLength) { firstChar = value[valueLength - 1]; int nextScalar = UnicodeHelpers.GetScalarValueFromUtf16(firstChar, null, out wasSurrogatePair); diff --git a/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoderSettings.cs b/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoderSettings.cs index e23ac0b8d3..68df671a52 100644 --- a/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoderSettings.cs +++ b/external/corefx/src/System.Text.Encodings.Web/src/System/Text/Encodings/Web/TextEncoderSettings.cs @@ -28,6 +28,11 @@ namespace System.Text.Encodings.Web /// public TextEncoderSettings(TextEncoderSettings other) { + if (other == null) + { + throw new ArgumentNullException(nameof(other)); + } + _allowedCharactersBitmap = AllowedCharactersBitmap.CreateNew(); AllowCodePoints(other.GetAllowedCodePoints()); } diff --git a/external/corefx/src/System.Text.Encodings.Web/tests/EncoderExtensionsTests.cs b/external/corefx/src/System.Text.Encodings.Web/tests/EncoderExtensionsTests.cs index 7fe79c5424..07b30bb52a 100644 --- a/external/corefx/src/System.Text.Encodings.Web/tests/EncoderExtensionsTests.cs +++ b/external/corefx/src/System.Text.Encodings.Web/tests/EncoderExtensionsTests.cs @@ -32,6 +32,49 @@ namespace System.Text.Encodings.Web Assert.Equal("Hello+there!", writer.ToString()); } + [Fact] + public void HtmlEncode_PositiveTestCase_CreateWithSettings() + { + // Arrange + TextEncoderSettings settings = new TextEncoderSettings(UnicodeRanges.All); + HtmlEncoder encoder = HtmlEncoder.Create(settings); + StringWriter writer = new StringWriter(); + + // Act + encoder.Encode(writer, "Hello+there!"); + + // Assert + Assert.Equal("Hello+there!", writer.ToString()); + } + + [Fact] + public void HtmlEncode_CreateNullRanges() + { + Assert.Throws("allowedRanges", () => HtmlEncoder.Create(default(UnicodeRange[]))); + } + + [Fact] + public void HtmlEncode_CreateNullSettings() + { + Assert.Throws("settings", () => HtmlEncoder.Create(default(TextEncoderSettings))); + } + + + [Fact] + public unsafe void TryEncodeUnicodeScalar_Null_Buffer() + { + Assert.Throws("buffer", () => HtmlEncoder.Default.TryEncodeUnicodeScalar(2, null, 1, out int _)); + } + + [Fact] + public unsafe void TryEncodeUnicodeScalar_InsufficientRoom() + { + char* buffer = stackalloc char[1]; + int numberWritten; + Assert.False(HtmlEncoder.Default.TryEncodeUnicodeScalar(0x10000, buffer, 1, out numberWritten)); + Assert.Equal(0, numberWritten); + } + [Fact] public void JavaScriptStringEncode_ParameterChecks() { diff --git a/external/corefx/src/System.Text.Encodings.Web/tests/ScalarTestEncoder.cs b/external/corefx/src/System.Text.Encodings.Web/tests/ScalarTestEncoder.cs new file mode 100644 index 0000000000..b030676bb3 --- /dev/null +++ b/external/corefx/src/System.Text.Encodings.Web/tests/ScalarTestEncoder.cs @@ -0,0 +1,57 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Globalization; +using System.IO; +using System.Runtime.CompilerServices; +using System.Text.Encodings.Web; + +namespace Microsoft.Framework.WebEncoders +{ + /// + /// Dummy encoder used for unit testing. + /// + public sealed class ScalarTestEncoder : TextEncoder + { + private const int Int32Length = 8; + + /// + /// Returns 0. + /// + public override unsafe int FindFirstCharacterToEncode(char* text, int textLength) + { + return text == null ? -1 : 0; + } + + /// + /// Returns true. + /// + public override bool WillEncode(int unicodeScalar) + { + return true; + } + + /// + /// Returns 8. + /// + public override int MaxOutputCharactersPerInputCharacter + { + get { return Int32Length; } + } + + /// + /// Encodes scalar as a hexadecimal number. + /// + public override unsafe bool TryEncodeUnicodeScalar(int unicodeScalar, char* buffer, int bufferLength, out int numberOfCharactersWritten) + { + fixed (char* chars = unicodeScalar.ToString("X8")) + for (int i = 0; i < Int32Length; i++) + buffer[i] = chars[i]; + + numberOfCharactersWritten = Int32Length; + return true; + } + } +} diff --git a/external/corefx/src/System.Text.Encodings.Web/tests/System.Text.Encodings.Web.Tests.csproj b/external/corefx/src/System.Text.Encodings.Web/tests/System.Text.Encodings.Web.Tests.csproj index ca3abfafba..09ef643e7b 100644 --- a/external/corefx/src/System.Text.Encodings.Web/tests/System.Text.Encodings.Web.Tests.csproj +++ b/external/corefx/src/System.Text.Encodings.Web/tests/System.Text.Encodings.Web.Tests.csproj @@ -20,6 +20,8 @@ + + @@ -43,11 +45,6 @@ - - - Common\System\PlatformDetection.cs - - UnicodeData.8.0.txt @@ -55,4 +52,4 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderSettingsTests.cs b/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderSettingsTests.cs index abe9460f74..558e901593 100644 --- a/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderSettingsTests.cs +++ b/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderSettingsTests.cs @@ -92,6 +92,19 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void Ctor_Null_UnicodeRanges() + { + Assert.Throws("allowedRanges", () => new TextEncoderSettings(default(UnicodeRange[]))); + } + + + [Fact] + public void Ctor_Null_TextEncoderSettings() + { + Assert.Throws("other", () => new TextEncoderSettings(default(TextEncoderSettings))); + } + [Fact] public void AllowChar() { @@ -132,6 +145,14 @@ namespace Microsoft.Framework.WebEncoders Assert.False(filter.IsCharacterAllowed('\u0103')); } + + [Fact] + public void AllowChars_Null() + { + TextEncoderSettings filter = new TextEncoderSettings(); + Assert.Throws("characters", () => filter.AllowCharacters(null)); + } + [Fact] public void AllowFilter() { @@ -150,6 +171,21 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void AllowFilter_NullCodePoints() + { + TextEncoderSettings filter = new TextEncoderSettings(UnicodeRanges.BasicLatin); + Assert.Throws("codePoints", () => filter.AllowCodePoints(null)); + } + + [Fact] + public void AllowFilter_NonBMP() + { + TextEncoderSettings filter = new TextEncoderSettings(); + filter.AllowCodePoints(Enumerable.Range(0x10000, 20)); + Assert.Empty(filter.GetAllowedCodePoints()); + } + [Fact] public void AllowRange() { @@ -172,6 +208,13 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void AllowRange_NullRange() + { + TextEncoderSettings filter = new TextEncoderSettings(); + Assert.Throws("range", () => filter.AllowRange(null)); + } + [Fact] public void AllowRanges() { @@ -202,6 +245,13 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void AllowRanges_NullRange() + { + TextEncoderSettings filter = new TextEncoderSettings(); + Assert.Throws("ranges", () => filter.AllowRanges(null)); + } + [Fact] public void Clear() { @@ -264,6 +314,14 @@ namespace Microsoft.Framework.WebEncoders Assert.False(filter.IsCharacterAllowed('z')); } + + [Fact] + public void ForbidChars_Null() + { + TextEncoderSettings filter = new TextEncoderSettings(UnicodeRanges.BasicLatin); + Assert.Throws("characters", () => filter.ForbidCharacters(null)); + } + [Fact] public void ForbidRange() { @@ -282,6 +340,13 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void ForbidRange_Null() + { + TextEncoderSettings filter = new TextEncoderSettings(); + Assert.Throws("range", () => filter.ForbidRange(null)); + } + [Fact] public void ForbidRanges() { @@ -304,6 +369,13 @@ namespace Microsoft.Framework.WebEncoders } } + [Fact] + public void ForbidRanges_Null() + { + TextEncoderSettings filter = new TextEncoderSettings(new OddTextEncoderSettings()); + Assert.Throws("ranges", () => filter.ForbidRanges(null)); + } + [Fact] public void GetAllowedCodePoints() { diff --git a/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderTests.cs b/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderTests.cs new file mode 100644 index 0000000000..ec4725e97d --- /dev/null +++ b/external/corefx/src/System.Text.Encodings.Web/tests/TextEncoderTests.cs @@ -0,0 +1,45 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Globalization; +using System.IO; +using System.Text.Encodings.Web; +using System.Text.Unicode; +using Xunit; + +namespace Microsoft.Framework.WebEncoders +{ + public class TextEncoderTests + { + [Fact] + public void EncodeIntoBuffer_SurrogatePairs() + { + // Arange + ScalarTestEncoder encoder = new ScalarTestEncoder(); + + const string X = "\U00000058"; // LATIN CAPITAL LETTER X (ascii) + const string Pair = "\U0001033A"; // GOTHIC LETTER KUSMA (surrogate pair) + + const string eX = "00000058"; + const string ePair = "0001033A"; + + // Act & assert + Assert.Equal("", encoder.Encode("")); + + Assert.Equal(eX, encoder.Encode(X)); // no iteration, block + Assert.Equal(eX + eX, encoder.Encode(X + X)); // two iterations, no block + Assert.Equal(eX + eX + eX, encoder.Encode(X + X + X)); // two iterations, block + + Assert.Equal(ePair, encoder.Encode(Pair)); // one iteration, no block + Assert.Equal(ePair + ePair, encoder.Encode(Pair + Pair)); // two iterations, no block + + Assert.Equal(eX + ePair, encoder.Encode(X + Pair)); // two iterations, no block + Assert.Equal(ePair + eX, encoder.Encode(Pair + X)); // one iteration, block + + Assert.Equal(eX + ePair + eX, encoder.Encode(X + Pair + X)); // two iterations, block, even length + Assert.Equal(ePair + eX + ePair, encoder.Encode(Pair + X + Pair)); // three iterations, no block, odd length + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs b/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs index 4d6197c018..b87202e46b 100644 --- a/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs +++ b/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs @@ -6,6 +6,8 @@ // ------------------------------------------------------------------------------ +using System.Reflection; + namespace System.Text.RegularExpressions { public partial class Capture @@ -16,7 +18,7 @@ namespace System.Text.RegularExpressions public string Value { get { throw null; } } public override string ToString() { throw null; } } - public partial class CaptureCollection : System.Collections.ICollection, System.Collections.IEnumerable + public partial class CaptureCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList { internal CaptureCollection() { } public int Count { get { throw null; } } @@ -25,16 +27,36 @@ namespace System.Text.RegularExpressions public System.Text.RegularExpressions.Capture this[int i] { get { throw null; } } public object SyncRoot { get { throw null; } } public void CopyTo(System.Array array, int arrayIndex) { } + public void CopyTo(System.Text.RegularExpressions.Capture[] array, int arrayIndex) { } public System.Collections.IEnumerator GetEnumerator() { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + int System.Collections.Generic.IList.IndexOf(System.Text.RegularExpressions.Capture item) { throw null; } + void System.Collections.Generic.IList.Insert(int index, System.Text.RegularExpressions.Capture item) { } + void System.Collections.Generic.IList.RemoveAt(int index) { } + System.Text.RegularExpressions.Capture System.Collections.Generic.IList.this[int index] { get { throw null; } set { } } + void System.Collections.Generic.ICollection.Add(System.Text.RegularExpressions.Capture item) { } + void System.Collections.Generic.ICollection.Clear() { } + bool System.Collections.Generic.ICollection.Contains(System.Text.RegularExpressions.Capture item) { throw null; } + bool System.Collections.Generic.ICollection.Remove(System.Text.RegularExpressions.Capture item) { throw null; } + int System.Collections.IList.Add(object value) { throw null; } + void System.Collections.IList.Clear() { } + bool System.Collections.IList.Contains(object value) { throw null; } + int System.Collections.IList.IndexOf(object value) { throw null; } + void System.Collections.IList.Insert(int index, object value) { } + bool System.Collections.IList.IsFixedSize { get { throw null; } } + void System.Collections.IList.Remove(object value) { } + void System.Collections.IList.RemoveAt(int index) { } + object System.Collections.IList.this[int index] { get { throw null; } set { } } } public partial class Group : System.Text.RegularExpressions.Capture { internal Group() { } public System.Text.RegularExpressions.CaptureCollection Captures { get { throw null; } } + public string Name { get { throw null; } } public bool Success { get { throw null; } } public static System.Text.RegularExpressions.Group Synchronized(System.Text.RegularExpressions.Group inner) { throw null; } } - public partial class GroupCollection : System.Collections.ICollection, System.Collections.IEnumerable + public partial class GroupCollection : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IList { internal GroupCollection() { } public int Count { get { throw null; } } @@ -44,7 +66,26 @@ namespace System.Text.RegularExpressions public System.Text.RegularExpressions.Group this[string groupname] { get { throw null; } } public object SyncRoot { get { throw null; } } public void CopyTo(System.Array array, int arrayIndex) { } + public void CopyTo(System.Text.RegularExpressions.Group[] array, int arrayIndex) { } public System.Collections.IEnumerator GetEnumerator() { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + int System.Collections.Generic.IList.IndexOf(System.Text.RegularExpressions.Group item) { throw null; } + void System.Collections.Generic.IList.Insert(int index, System.Text.RegularExpressions.Group item) { } + void System.Collections.Generic.IList.RemoveAt(int index) { } + System.Text.RegularExpressions.Group System.Collections.Generic.IList.this[int index] { get { throw null; } set { } } + void System.Collections.Generic.ICollection.Add(System.Text.RegularExpressions.Group item) { } + void System.Collections.Generic.ICollection.Clear() { } + bool System.Collections.Generic.ICollection.Contains(System.Text.RegularExpressions.Group item) { throw null; } + bool System.Collections.Generic.ICollection.Remove(System.Text.RegularExpressions.Group item) { throw null; } + int System.Collections.IList.Add(object value) { throw null; } + void System.Collections.IList.Clear() { } + bool System.Collections.IList.Contains(object value) { throw null; } + int System.Collections.IList.IndexOf(object value) { throw null; } + void System.Collections.IList.Insert(int index, object value) { } + bool System.Collections.IList.IsFixedSize { get { throw null; } } + void System.Collections.IList.Remove(object value) { } + void System.Collections.IList.RemoveAt(int index) { } + object System.Collections.IList.this[int index] { get { throw null; } set { } } } public partial class Match : System.Text.RegularExpressions.Group { @@ -55,7 +96,7 @@ namespace System.Text.RegularExpressions public virtual string Result(string replacement) { throw null; } public static System.Text.RegularExpressions.Match Synchronized(System.Text.RegularExpressions.Match inner) { throw null; } } - public partial class MatchCollection : System.Collections.ICollection, System.Collections.IEnumerable + public partial class MatchCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList { internal MatchCollection() { } public int Count { get { throw null; } } @@ -64,7 +105,26 @@ namespace System.Text.RegularExpressions public virtual System.Text.RegularExpressions.Match this[int i] { get { throw null; } } public object SyncRoot { get { throw null; } } public void CopyTo(System.Array array, int arrayIndex) { } + public void CopyTo(System.Text.RegularExpressions.Match[] array, int arrayIndex) { } public System.Collections.IEnumerator GetEnumerator() { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + int System.Collections.Generic.IList.IndexOf(System.Text.RegularExpressions.Match item) { throw null; } + void System.Collections.Generic.IList.Insert(int index, System.Text.RegularExpressions.Match item) { } + void System.Collections.Generic.IList.RemoveAt(int index) { } + System.Text.RegularExpressions.Match System.Collections.Generic.IList.this[int index] { get { throw null; } set { } } + void System.Collections.Generic.ICollection.Add(System.Text.RegularExpressions.Match item) { } + void System.Collections.Generic.ICollection.Clear() { } + bool System.Collections.Generic.ICollection.Contains(System.Text.RegularExpressions.Match item) { throw null; } + bool System.Collections.Generic.ICollection.Remove(System.Text.RegularExpressions.Match item) { throw null; } + int System.Collections.IList.Add(object value) { throw null; } + void System.Collections.IList.Clear() { } + bool System.Collections.IList.Contains(object value) { throw null; } + int System.Collections.IList.IndexOf(object value) { throw null; } + void System.Collections.IList.Insert(int index, object value) { } + bool System.Collections.IList.IsFixedSize { get { throw null; } } + void System.Collections.IList.Remove(object value) { } + void System.Collections.IList.RemoveAt(int index) { } + object System.Collections.IList.this[int index] { get { throw null; } set { } } } public delegate string MatchEvaluator(System.Text.RegularExpressions.Match match); public partial class Regex : System.Runtime.Serialization.ISerializable @@ -84,6 +144,10 @@ namespace System.Text.RegularExpressions public Regex(string pattern, System.Text.RegularExpressions.RegexOptions options) { } public Regex(string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { } public static int CacheSize { get { throw null; } set { } } + [System.CLSCompliant(false)] + protected System.Collections.IDictionary Caps { get { throw null; } set { } } + [System.CLSCompliant(false)] + protected System.Collections.IDictionary CapNames { get { throw null; } set { } } public System.TimeSpan MatchTimeout { get { throw null; } } public System.Text.RegularExpressions.RegexOptions Options { get { throw null; } } public bool RightToLeft { get { throw null; } } @@ -134,6 +198,17 @@ namespace System.Text.RegularExpressions protected bool UseOptionR() { throw null; } protected internal static void ValidateMatchTimeout(System.TimeSpan matchTimeout) { } } + public partial class RegexCompilationInfo + { + public RegexCompilationInfo(string pattern, RegexOptions options, string name, string fullnamespace, bool ispublic) { } + public RegexCompilationInfo(string pattern, RegexOptions options, string name, string fullnamespace, bool ispublic, TimeSpan matchTimeout) { } + public bool IsPublic { get; set; } + public TimeSpan MatchTimeout { get; set; } + public string Name { get; set; } + public string Namespace { get; set; } + public RegexOptions Options { get; set; } + public string Pattern { get; set; } + } public partial class RegexMatchTimeoutException : System.TimeoutException, System.Runtime.Serialization.ISerializable { public RegexMatchTimeoutException() { } diff --git a/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj b/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj index 7cbdb75d2c..ae39f4e450 100644 --- a/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj +++ b/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj @@ -10,6 +10,9 @@ + + + @@ -17,5 +20,9 @@ + + + + \ No newline at end of file diff --git a/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.netcoreapp.cs b/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.netcoreapp.cs index 5f05f9f850..d52614b990 100644 --- a/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.netcoreapp.cs +++ b/external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.netcoreapp.cs @@ -8,81 +8,10 @@ namespace System.Text.RegularExpressions { - public partial class Group - { - public string Name { get { throw null; } } - } public partial class Regex { - [System.CLSCompliant(false)] - protected System.Collections.IDictionary Caps { get { throw null; } set { } } - [System.CLSCompliant(false)] - protected System.Collections.IDictionary CapNames { get { throw null; } set { } } - } - public partial class CaptureCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList - { - public void CopyTo(System.Text.RegularExpressions.Capture[] array, int arrayIndex) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - int System.Collections.Generic.IList.IndexOf(System.Text.RegularExpressions.Capture item) { throw null; } - void System.Collections.Generic.IList.Insert(int index, System.Text.RegularExpressions.Capture item) { } - void System.Collections.Generic.IList.RemoveAt(int index) { } - System.Text.RegularExpressions.Capture System.Collections.Generic.IList.this[int index] { get { throw null; } set { } } - void System.Collections.Generic.ICollection.Add(System.Text.RegularExpressions.Capture item) { } - void System.Collections.Generic.ICollection.Clear() { } - bool System.Collections.Generic.ICollection.Contains(System.Text.RegularExpressions.Capture item) { throw null; } - bool System.Collections.Generic.ICollection.Remove(System.Text.RegularExpressions.Capture item) { throw null; } - int System.Collections.IList.Add(object value) { throw null; } - void System.Collections.IList.Clear() { } - bool System.Collections.IList.Contains(object value) { throw null; } - int System.Collections.IList.IndexOf(object value) { throw null; } - void System.Collections.IList.Insert(int index, object value) { } - bool System.Collections.IList.IsFixedSize { get { throw null; } } - void System.Collections.IList.Remove(object value) { } - void System.Collections.IList.RemoveAt(int index) { } - object System.Collections.IList.this[int index] { get { throw null; } set { } } - } - public partial class GroupCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList - { - public void CopyTo(System.Text.RegularExpressions.Group[] array, int arrayIndex) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - int System.Collections.Generic.IList.IndexOf(System.Text.RegularExpressions.Group item) { throw null; } - void System.Collections.Generic.IList.Insert(int index, System.Text.RegularExpressions.Group item) { } - void System.Collections.Generic.IList.RemoveAt(int index) { } - System.Text.RegularExpressions.Group System.Collections.Generic.IList.this[int index] { get { throw null; } set { } } - void System.Collections.Generic.ICollection.Add(System.Text.RegularExpressions.Group item) { } - void System.Collections.Generic.ICollection.Clear() { } - bool System.Collections.Generic.ICollection.Contains(System.Text.RegularExpressions.Group item) { throw null; } - bool System.Collections.Generic.ICollection.Remove(System.Text.RegularExpressions.Group item) { throw null; } - int System.Collections.IList.Add(object value) { throw null; } - void System.Collections.IList.Clear() { } - bool System.Collections.IList.Contains(object value) { throw null; } - int System.Collections.IList.IndexOf(object value) { throw null; } - void System.Collections.IList.Insert(int index, object value) { } - bool System.Collections.IList.IsFixedSize { get { throw null; } } - void System.Collections.IList.Remove(object value) { } - void System.Collections.IList.RemoveAt(int index) { } - object System.Collections.IList.this[int index] { get { throw null; } set { } } - } - public partial class MatchCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList - { - public void CopyTo(System.Text.RegularExpressions.Match[] array, int arrayIndex) { } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - int System.Collections.Generic.IList.IndexOf(System.Text.RegularExpressions.Match item) { throw null; } - void System.Collections.Generic.IList.Insert(int index, System.Text.RegularExpressions.Match item) { } - void System.Collections.Generic.IList.RemoveAt(int index) { } - System.Text.RegularExpressions.Match System.Collections.Generic.IList.this[int index] { get { throw null; } set { } } - void System.Collections.Generic.ICollection.Add(System.Text.RegularExpressions.Match item) { } - void System.Collections.Generic.ICollection.Clear() { } - bool System.Collections.Generic.ICollection.Contains(System.Text.RegularExpressions.Match item) { throw null; } - bool System.Collections.Generic.ICollection.Remove(System.Text.RegularExpressions.Match item) { throw null; } - int System.Collections.IList.Add(object value) { throw null; } - void System.Collections.IList.Clear() { } - bool System.Collections.IList.Contains(object value) { throw null; } - int System.Collections.IList.IndexOf(object value) { throw null; } - void System.Collections.IList.Insert(int index, object value) { } - bool System.Collections.IList.IsFixedSize { get { throw null; } } - void System.Collections.IList.Remove(object value) { } - void System.Collections.IList.RemoveAt(int index) { } - object System.Collections.IList.this[int index] { get { throw null; } set { } } + public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname) { } + public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname, System.Reflection.Emit.CustomAttributeBuilder[] attributes) { } + public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, System.Reflection.AssemblyName assemblyname, System.Reflection.Emit.CustomAttributeBuilder[] attributes, string resourceFile) { } } } diff --git a/external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx b/external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx index e2bb24a50f..dea3a7fe4a 100644 --- a/external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx +++ b/external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx @@ -67,6 +67,9 @@ Destination array is not long enough to copy all the items in the collection. Check array index and length. + + The array cannot contain null elements. + Cannot include class \\{0} in character range. @@ -88,6 +91,9 @@ Illegal conditional (?(...)) expression. + + AppDomain data '{0}' contains the invalid value or object '{1}' for specifying a default matching timeout for System.Text.RegularExpressions.Regex. + Illegal \\ at end of pattern. @@ -103,6 +109,9 @@ Invalid group name: Group names must begin with a word character. + + Argument {0} cannot be zero-length. + Length cannot be less than 0 or exceed input length. @@ -136,6 +145,9 @@ This operation is only allowed once per object. + + This platform does not support writing compiled regular expressions to an assembly. + Quantifier {x,y} following nothing. @@ -193,4 +205,4 @@ Unterminated (?#...) comment. - \ No newline at end of file + diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj b/external/corefx/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj index a46adb1e42..7ccb1589a4 100644 --- a/external/corefx/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj +++ b/external/corefx/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj @@ -4,6 +4,7 @@ {2C58640B-5BED-4E83-9554-CD2B9762643F} System.Text.RegularExpressions + $(DefineConstants);FEATURE_COMPILED @@ -19,6 +20,7 @@ + @@ -42,6 +44,13 @@ Common\System\IO\StringBuilderCache.cs + + + + + + + @@ -51,5 +60,11 @@ + + + + + + - \ No newline at end of file + diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunner.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunner.cs new file mode 100644 index 0000000000..2ae5caf18d --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunner.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Text.RegularExpressions +{ + internal sealed class CompiledRegexRunner : RegexRunner + { + private Action _goMethod; + private Func _findFirstCharMethod; + private Action _initTrackCountMethod; + + internal CompiledRegexRunner() { } + + internal void SetDelegates(Action go, Func firstChar, Action trackCount) + { + _goMethod = go; + _findFirstCharMethod = firstChar; + _initTrackCountMethod = trackCount; + } + + protected override void Go() + { + _goMethod(this); + } + + protected override bool FindFirstChar() + { + return _findFirstCharMethod(this); + } + + protected override void InitTrackCount() + { + _initTrackCountMethod(this); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunnerFactory.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunnerFactory.cs new file mode 100644 index 0000000000..1f81283199 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunnerFactory.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Reflection.Emit; + +namespace System.Text.RegularExpressions +{ + internal sealed class CompiledRegexRunnerFactory : RegexRunnerFactory + { + private readonly DynamicMethod _goMethod; + private readonly DynamicMethod _findFirstCharMethod; + private readonly DynamicMethod _initTrackCountMethod; + + internal CompiledRegexRunnerFactory(DynamicMethod go, DynamicMethod firstChar, DynamicMethod trackCount) + { + _goMethod = go; + _findFirstCharMethod = firstChar; + _initTrackCountMethod = trackCount; + } + + protected internal override RegexRunner CreateInstance() + { + CompiledRegexRunner runner = new CompiledRegexRunner(); + runner.SetDelegates((Action)_goMethod.CreateDelegate(typeof(Action)), + (Func)_findFirstCharMethod.CreateDelegate(typeof(Func)), + (Action)_initTrackCountMethod.CreateDelegate(typeof(Action))); + + return runner; + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs index 70d494f623..ce8c5dd81e 100644 --- a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs @@ -9,6 +9,11 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Reflection; +using System.Reflection.Emit; +#if FEATURE_COMPILED +using System.Runtime.CompilerServices; +#endif using System.Runtime.Serialization; using System.Threading; @@ -43,9 +48,12 @@ namespace System.Text.RegularExpressions protected internal TimeSpan internalMatchTimeout; // timeout for the execution of this regex + // During static initialisation of Regex we check + private const string DefaultMatchTimeout_ConfigKeyName = "REGEX_DEFAULT_MATCH_TIMEOUT"; + // DefaultMatchTimeout specifies the match timeout to use if no other timeout was specified // by one means or another. Typically, it is set to InfiniteMatchTimeout. - internal static readonly TimeSpan DefaultMatchTimeout = InfiniteMatchTimeout; + internal static readonly TimeSpan DefaultMatchTimeout = InitDefaultMatchTimeout(); // *********** } match timeout fields *********** @@ -147,16 +155,18 @@ namespace System.Text.RegularExpressions throw new PlatformNotSupportedException(); } - private Regex(string pattern, RegexOptions options, TimeSpan matchTimeout, bool useCache) + private Regex(string pattern, RegexOptions options, TimeSpan matchTimeout, bool addToCache) { - RegexTree tree; - CachedCodeEntry cached = null; - string cultureKey = null; - if (pattern == null) + { throw new ArgumentNullException(nameof(pattern)); + } + if (options < RegexOptions.None || (((int)options) >> MaxOptionShift) != 0) + { throw new ArgumentOutOfRangeException(nameof(options)); + } + if ((options & RegexOptions.ECMAScript) != 0 && (options & ~(RegexOptions.ECMAScript | RegexOptions.IgnoreCase | @@ -167,29 +177,30 @@ namespace System.Text.RegularExpressions | RegexOptions.Debug #endif )) != 0) + { throw new ArgumentOutOfRangeException(nameof(options)); + } ValidateMatchTimeout(matchTimeout); - // Try to look up this regex in the cache. We do this regardless of whether useCache is true since there's - // really no reason not to. + string cultureKey; if ((options & RegexOptions.CultureInvariant) != 0) - cultureKey = CultureInfo.InvariantCulture.ToString(); // "English (United States)" + cultureKey = CultureInfo.InvariantCulture.ToString(); else cultureKey = CultureInfo.CurrentCulture.ToString(); + // Try to look up this regex in the cache. var key = new CachedCodeEntryKey(options, cultureKey, pattern); - cached = LookupCachedAndUpdate(key); + CachedCodeEntry cached = LookupCachedAndUpdate(key); this.pattern = pattern; roptions = options; - internalMatchTimeout = matchTimeout; if (cached == null) { // Parse the input - tree = RegexParser.Parse(pattern, roptions); + RegexTree tree = RegexParser.Parse(pattern, roptions); // Extract the relevant information capnames = tree._capnames; @@ -201,7 +212,7 @@ namespace System.Text.RegularExpressions InitializeReferences(); tree = null; - if (useCache) + if (addToCache) cached = CacheCode(key); } else @@ -211,10 +222,28 @@ namespace System.Text.RegularExpressions capslist = cached._capslist; capsize = cached._capsize; _code = cached._code; +#if FEATURE_COMPILED + factory = cached._factory; +#endif _runnerref = cached._runnerref; _replref = cached._replref; _refsInitialized = true; } + +#if FEATURE_COMPILED + // if the compile option is set, then compile the code if it's not already + if (UseOptionC() && factory == null) + { + factory = Compile(_code, roptions); + + if (addToCache && cached != null) + { + cached.AddCompiled(factory); + } + + _code = null; + } +#endif } // Note: "<" is the XML entity for smaller ("<"). @@ -237,6 +266,58 @@ namespace System.Text.RegularExpressions throw new ArgumentOutOfRangeException(nameof(matchTimeout)); } + /// + /// Specifies the default RegEx matching timeout value (i.e. the timeout that will be used if no + /// explicit timeout is specified). + /// The default is queried from the current AppDomain. + /// If the AddDomain's data value for that key is not a TimeSpan value or if it is outside the + /// valid range, an exception is thrown. + /// If the AddDomain's data value for that key is null, a fallback value is returned. + /// + /// The default RegEx matching timeout for this AppDomain + private static TimeSpan InitDefaultMatchTimeout() + { + // Query AppDomain + AppDomain ad = AppDomain.CurrentDomain; + object defaultMatchTimeoutObj = ad.GetData(DefaultMatchTimeout_ConfigKeyName); + + // If no default is specified, use fallback + if (defaultMatchTimeoutObj == null) + { + return InfiniteMatchTimeout; + } + + if (defaultMatchTimeoutObj is TimeSpan defaultMatchTimeOut) + { + // If default timeout is outside the valid range, throw. It will result in a TypeInitializationException: + try + { + ValidateMatchTimeout(defaultMatchTimeOut); + } + catch (ArgumentOutOfRangeException) + { + throw new ArgumentOutOfRangeException(SR.Format(SR.IllegalDefaultRegexMatchTimeoutInAppDomain, DefaultMatchTimeout_ConfigKeyName, defaultMatchTimeOut)); + } + + return defaultMatchTimeOut; + } + + throw new InvalidCastException(SR.Format(SR.IllegalDefaultRegexMatchTimeoutInAppDomain, DefaultMatchTimeout_ConfigKeyName, defaultMatchTimeoutObj)); + } + +#if FEATURE_COMPILED + /// + /// This method is here for perf reasons: if the call to RegexCompiler is NOT in the + /// Regex constructor, we don't load RegexCompiler and its reflection classes when + /// instantiating a non-compiled regex. + /// + [MethodImplAttribute(MethodImplOptions.NoInlining)] + private RegexRunnerFactory Compile(RegexCode code, RegexOptions roptions) + { + return RegexCompiler.Compile(code, roptions); + } +#endif + /// /// Escapes a minimal set of metacharacters (\, *, +, ?, |, {, [, (, ), ^, $, ., #, and /// whitespace) by replacing them with their \ codes. This converts a string so that @@ -854,8 +935,7 @@ namespace System.Text.RegularExpressions } /// - /// Splits the string at the position defined by a - /// previous pattern. + /// Splits the string at the position defined by a previous pattern. /// public string[] Split(string input, int count, int startat) { @@ -865,6 +945,26 @@ namespace System.Text.RegularExpressions return RegexReplacement.Split(this, input, count, startat); } +#if FEATURE_COMPILED + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "assemblyname", Justification = "Microsoft: already shipped since v1 - can't fix without causing a breaking change")] + public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname) + { + throw new PlatformNotSupportedException(SR.PlatformNotSupported_CompileToAssembly); + } + + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "assemblyname", Justification = "Microsoft: already shipped since v1 - can't fix without causing a breaking change")] + public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname, CustomAttributeBuilder[] attributes) + { + throw new PlatformNotSupportedException(SR.PlatformNotSupported_CompileToAssembly); + } + + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "assemblyname", Justification = "Microsoft: already shipped since v1 - can't fix without causing a breaking change")] + public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname, CustomAttributeBuilder[] attributes, string resourceFile) + { + throw new PlatformNotSupportedException(SR.PlatformNotSupported_CompileToAssembly); + } +#endif + protected void InitializeReferences() { if (_refsInitialized) @@ -898,6 +998,8 @@ namespace System.Text.RegularExpressions if (runner == null) { + // Use the compiled RegexRunner factory if the code was compiled to MSIL + if (factory != null) runner = factory.CreateInstance(); else @@ -1067,6 +1169,9 @@ namespace System.Text.RegularExpressions internal Hashtable _caps; internal Hashtable _capnames; internal string[] _capslist; +#if FEATURE_COMPILED + internal RegexRunnerFactory _factory; +#endif internal int _capsize; internal ExclusiveReference _runnerref; internal SharedReference _replref; @@ -1084,6 +1189,14 @@ namespace System.Text.RegularExpressions _runnerref = runner; _replref = repl; } + +#if FEATURE_COMPILED + internal void AddCompiled(RegexRunnerFactory factory) + { + _factory = factory; + _code = null; + } +#endif } /* diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexBoyerMoore.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexBoyerMoore.cs index 894a6875f1..d70e2d906b 100644 --- a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexBoyerMoore.cs +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexBoyerMoore.cs @@ -19,14 +19,14 @@ namespace System.Text.RegularExpressions { internal sealed class RegexBoyerMoore { - private readonly int[] _positive; - private readonly int[] _negativeASCII; - private readonly int[][] _negativeUnicode; - private readonly string _pattern; - private readonly int _lowASCII; - private readonly int _highASCII; + internal readonly int[] _positive; + internal readonly int[] _negativeASCII; + internal readonly int[][] _negativeUnicode; + internal readonly string _pattern; + internal readonly int _lowASCII; + internal readonly int _highASCII; private readonly bool _rightToLeft; - private readonly bool _caseInsensitive; + internal readonly bool _caseInsensitive; private readonly CultureInfo _culture; /// diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs index 545a5292af..b500772081 100644 --- a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs @@ -151,7 +151,6 @@ namespace System.Text.RegularExpressions } } -#if DEBUG internal static int OpcodeSize(int opcode) { opcode &= Mask; @@ -212,6 +211,7 @@ namespace System.Text.RegularExpressions } } +#if DEBUG private static readonly string[] CodeStr = new string[] { "Onerep", "Notonerep", "Setrep", diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs new file mode 100644 index 0000000000..1c4106b870 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs @@ -0,0 +1,77 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Text.RegularExpressions +{ + public class RegexCompilationInfo + { + private string _pattern; + private string _name; + private string _nspace; + private TimeSpan _matchTimeout; + + public RegexCompilationInfo(string pattern, RegexOptions options, string name, string fullnamespace, bool ispublic) + : this(pattern, options, name, fullnamespace, ispublic, Regex.DefaultMatchTimeout) + { + } + + public RegexCompilationInfo(string pattern, RegexOptions options, string name, string fullnamespace, bool ispublic, TimeSpan matchTimeout) + { + Pattern = pattern; + Name = name; + Namespace = fullnamespace; + Options = options; + IsPublic = ispublic; + MatchTimeout = matchTimeout; + } + + public bool IsPublic { get; set; } + + public TimeSpan MatchTimeout + { + get => _matchTimeout; + set + { + Regex.ValidateMatchTimeout(value); + _matchTimeout = value; + } + } + + public string Name + { + get => _name; + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(Name)); + } + + if (value.Length == 0) + { + throw new ArgumentException(SR.Format(SR.InvalidEmptyArgument, nameof(Name)), nameof(Name)); + } + + _name = value; + } + } + + public string Namespace + { + get => _nspace; + set + { + _nspace = value ?? throw new ArgumentNullException(nameof(Namespace)); + } + } + + public RegexOptions Options { get; set; } + + public string Pattern + { + get => _pattern; + set => _pattern = value ?? throw new ArgumentNullException(nameof(Pattern)); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs.REMOVED.git-id b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs.REMOVED.git-id new file mode 100644 index 0000000000..efdae86207 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs.REMOVED.git-id @@ -0,0 +1 @@ +fac86269ec4ab0f16a400c531f4934efa4435b11 \ No newline at end of file diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexLWCGCompiler.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexLWCGCompiler.cs new file mode 100644 index 0000000000..d37ab1a0bd --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexLWCGCompiler.cs @@ -0,0 +1,68 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading; +using System.Reflection; +using System.Reflection.Emit; +using System.Globalization; + +namespace System.Text.RegularExpressions +{ + internal class RegexLWCGCompiler : RegexCompiler + { + private static int s_regexCount = 0; + private static Type[] s_paramTypes = new Type[] { typeof(RegexRunner) }; + + internal RegexLWCGCompiler() + { + } + + /* + * The top-level driver. Initializes everything then calls the Generate* methods. + */ + internal RegexRunnerFactory FactoryInstanceFromCode(RegexCode code, RegexOptions options) + { + _code = code; + _codes = code._codes; + _strings = code._strings; + _fcPrefix = code._fcPrefix; + _bmPrefix = code._bmPrefix; + _anchors = code._anchors; + _trackcount = code._trackcount; + _options = options; + + // pick a unique number for the methods we generate + int regexnum = Interlocked.Increment(ref s_regexCount); + string regexnumString = regexnum.ToString(CultureInfo.InvariantCulture); + + DynamicMethod goMethod = DefineDynamicMethod("Go" + regexnumString, null, typeof(CompiledRegexRunner)); + GenerateGo(); + + DynamicMethod firstCharMethod = DefineDynamicMethod("FindFirstChar" + regexnumString, typeof(bool), typeof(CompiledRegexRunner)); + GenerateFindFirstChar(); + + DynamicMethod trackCountMethod = DefineDynamicMethod("InitTrackCount" + regexnumString, null, typeof(CompiledRegexRunner)); + GenerateInitTrackCount(); + + return new CompiledRegexRunnerFactory(goMethod, firstCharMethod, trackCountMethod); + } + + /* + * Begins the definition of a new method (no args) with a specified return value + */ + internal DynamicMethod DefineDynamicMethod(string methname, Type returntype, Type hostType) + { + // We're claiming that these are static methods, but really they are instance methods. + // By giving them a parameter which represents "this", we're tricking them into + // being instance methods. + + MethodAttributes attribs = MethodAttributes.Public | MethodAttributes.Static; + CallingConventions conventions = CallingConventions.Standard; + + DynamicMethod dm = new DynamicMethod(methname, attribs, conventions, returntype, s_paramTypes, hostType, false /*skipVisibility*/); + _ilg = dm.GetILGenerator(); + return dm; + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs b/external/corefx/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs deleted file mode 100644 index 045f25d346..0000000000 --- a/external/corefx/src/System.Text.RegularExpressions/tests/CaptureCollectionTests.netcoreapp.cs +++ /dev/null @@ -1,172 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Xunit; - -namespace System.Text.RegularExpressions.Tests -{ - public static partial class CaptureCollectionTests - { - [Fact] - public static void IListOfT_Item_Get() - { - IList collection = CreateCollection(); - Assert.Equal("This ", collection[0].ToString()); - Assert.Equal("is ", collection[1].ToString()); - Assert.Equal("a ", collection[2].ToString()); - Assert.Equal("sentence", collection[3].ToString()); - } - - [Fact] - public static void IReadOnlyListOfT_Item_Get() - { - IReadOnlyList collection = CreateCollection(); - Assert.Equal("This ", collection[0].ToString()); - Assert.Equal("is ", collection[1].ToString()); - Assert.Equal("a ", collection[2].ToString()); - Assert.Equal("sentence", collection[3].ToString()); - } - - [Fact] - public static void IList_Item_Get() - { - IList collection = CreateCollection(); - Assert.Equal("This ", collection[0].ToString()); - Assert.Equal("is ", collection[1].ToString()); - Assert.Equal("a ", collection[2].ToString()); - Assert.Equal("sentence", collection[3].ToString()); - } - - [Fact] - public static void ICollectionOfT_Contains() - { - ICollection collection = CreateCollection(); - foreach (Capture item in collection) - { - Assert.True(collection.Contains(item)); - } - - foreach (Capture item in CreateCollection()) - { - Assert.False(collection.Contains(item)); - } - } - - [Fact] - public static void IList_Contains() - { - IList collection = CreateCollection(); - foreach (object item in collection) - { - Assert.True(collection.Contains(item)); - } - - foreach (object item in CreateCollection()) - { - Assert.False(collection.Contains(item)); - } - - Assert.False(collection.Contains(new object())); - } - - [Fact] - public static void IListOfT_IndexOf() - { - IList collection = CreateCollection(); - - int i = 0; - foreach (Capture item in collection) - { - Assert.Equal(i, collection.IndexOf(item)); - i++; - } - - foreach (Capture item in CreateCollection()) - { - Assert.Equal(-1, collection.IndexOf(item)); - } - } - - [Fact] - public static void IList_IndexOf() - { - IList collection = CreateCollection(); - - int i = 0; - foreach (object item in collection) - { - Assert.Equal(i, collection.IndexOf(item)); - i++; - } - - foreach (object item in CreateCollection()) - { - Assert.Equal(-1, collection.IndexOf(item)); - } - - Assert.Equal(-1, collection.IndexOf(new object())); - } - - [Fact] - public static void ICollectionOfT_CopyTo() - { - string[] expected = new[] { "This ", "is ", "a ", "sentence" }; - ICollection collection = CreateCollection(); - - Capture[] array = new Capture[collection.Count]; - collection.CopyTo(array, 0); - - Assert.Equal(expected, array.Select(c => c.ToString())); - } - - [Fact] - public static void ICollectionOfT_CopyTo_Invalid() - { - ICollection collection = CreateCollection(); - AssertExtensions.Throws("array", () => collection.CopyTo((Capture[])null, 0)); - AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Capture[1], -1)); - AssertExtensions.Throws(null, () => collection.CopyTo(new Capture[1], 0)); - AssertExtensions.Throws(null, () => collection.CopyTo(new Capture[1], 1)); - AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Capture[1], 2)); - } - - [Fact] - public static void IListOfT_IsReadOnly() - { - IList list = CreateCollection(); - Assert.True(list.IsReadOnly); - Assert.Throws(() => list.Add(default(Capture))); - Assert.Throws(() => list.Clear()); - Assert.Throws(() => list.Insert(0, default(Capture))); - Assert.Throws(() => list.Remove(default(Capture))); - Assert.Throws(() => list.RemoveAt(0)); - Assert.Throws(() => list[0] = default(Capture)); - } - - [Fact] - public static void IList_IsReadOnly() - { - IList list = CreateCollection(); - Assert.True(list.IsReadOnly); - Assert.True(list.IsFixedSize); - Assert.Throws(() => list.Add(default(Capture))); - Assert.Throws(() => list.Clear()); - Assert.Throws(() => list.Insert(0, default(Capture))); - Assert.Throws(() => list.Remove(default(Capture))); - Assert.Throws(() => list.RemoveAt(0)); - Assert.Throws(() => list[0] = default(Capture)); - } - - [Fact] - public static void DebuggerAttributeTests() - { - DebuggerAttributes.ValidateDebuggerDisplayReferences(CreateCollection()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(CreateCollection()); - } - } -} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/CaptureCollectionTests2.cs b/external/corefx/src/System.Text.RegularExpressions/tests/CaptureCollectionTests2.cs new file mode 100644 index 0000000000..5348e1af12 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/tests/CaptureCollectionTests2.cs @@ -0,0 +1,186 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using Xunit; + +namespace System.Text.RegularExpressions.Tests +{ + public static partial class CaptureCollectionTests + { + [Fact] + public static void IListOfT_Item_Get() + { + IList collection = CreateCollection(); + Assert.Equal("This ", collection[0].ToString()); + Assert.Equal("is ", collection[1].ToString()); + Assert.Equal("a ", collection[2].ToString()); + Assert.Equal("sentence", collection[3].ToString()); + } + + [Fact] + public static void IReadOnlyListOfT_Item_Get() + { + IReadOnlyList collection = CreateCollection(); + Assert.Equal("This ", collection[0].ToString()); + Assert.Equal("is ", collection[1].ToString()); + Assert.Equal("a ", collection[2].ToString()); + Assert.Equal("sentence", collection[3].ToString()); + } + + [Fact] + public static void IList_Item_Get() + { + IList collection = CreateCollection(); + Assert.Equal("This ", collection[0].ToString()); + Assert.Equal("is ", collection[1].ToString()); + Assert.Equal("a ", collection[2].ToString()); + Assert.Equal("sentence", collection[3].ToString()); + } + + [Fact] + public static void ICollectionOfT_Contains() + { + ICollection collection = CreateCollection(); + foreach (Capture item in collection) + { + Assert.True(collection.Contains(item)); + } + + foreach (Capture item in CreateCollection()) + { + Assert.False(collection.Contains(item)); + } + } + + [Fact] + public static void IList_Contains() + { + IList collection = CreateCollection(); + foreach (object item in collection) + { + Assert.True(collection.Contains(item)); + } + + foreach (object item in CreateCollection()) + { + Assert.False(collection.Contains(item)); + } + + Assert.False(collection.Contains(new object())); + } + + [Fact] + public static void IListOfT_IndexOf() + { + IList collection = CreateCollection(); + + int i = 0; + foreach (Capture item in collection) + { + Assert.Equal(i, collection.IndexOf(item)); + i++; + } + + foreach (Capture item in CreateCollection()) + { + Assert.Equal(-1, collection.IndexOf(item)); + } + } + + [Fact] + public static void IList_IndexOf() + { + IList collection = CreateCollection(); + + int i = 0; + foreach (object item in collection) + { + Assert.Equal(i, collection.IndexOf(item)); + i++; + } + + foreach (object item in CreateCollection()) + { + Assert.Equal(-1, collection.IndexOf(item)); + } + + Assert.Equal(-1, collection.IndexOf(new object())); + } + + [Fact] + public static void ICollectionOfT_CopyTo() + { + string[] expected = new[] { "This ", "is ", "a ", "sentence" }; + ICollection collection = CreateCollection(); + + Capture[] array = new Capture[collection.Count]; + collection.CopyTo(array, 0); + + Assert.Equal(expected, array.Select(c => c.ToString())); + } + + [Fact] + public static void ICollectionOfT_CopyTo_Invalid() + { + ICollection collection = CreateCollection(); + AssertExtensions.Throws("array", () => collection.CopyTo((Capture[])null, 0)); + AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Capture[1], -1)); + AssertExtensions.Throws(null, () => collection.CopyTo(new Capture[1], 0)); + AssertExtensions.Throws(null, () => collection.CopyTo(new Capture[1], 1)); + AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Capture[1], 2)); + } + + [Fact] + public static void IListOfT_IsReadOnly() + { + IList list = CreateCollection(); + Assert.True(list.IsReadOnly); + Assert.Throws(() => list.Add(default(Capture))); + Assert.Throws(() => list.Clear()); + Assert.Throws(() => list.Insert(0, default(Capture))); + Assert.Throws(() => list.Remove(default(Capture))); + Assert.Throws(() => list.RemoveAt(0)); + Assert.Throws(() => list[0] = default(Capture)); + } + + [Fact] + public static void IList_IsReadOnly() + { + IList list = CreateCollection(); + Assert.True(list.IsReadOnly); + Assert.True(list.IsFixedSize); + Assert.Throws(() => list.Add(default(Capture))); + Assert.Throws(() => list.Clear()); + Assert.Throws(() => list.Insert(0, default(Capture))); + Assert.Throws(() => list.Remove(default(Capture))); + Assert.Throws(() => list.RemoveAt(0)); + Assert.Throws(() => list[0] = default(Capture)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] + public static void DebuggerAttributeTests() + { + CaptureCollection col = CreateCollection(); + DebuggerAttributes.ValidateDebuggerDisplayReferences(col); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + Capture[] items = itemProperty.GetValue(info.Instance) as Capture[]; + Assert.Equal(col, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] + public static void DebuggerAttributeTests_Null() + { + TargetInvocationException ex = Assert.Throws(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(CaptureCollection), null)); + Assert.IsType(ex.InnerException); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs b/external/corefx/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs deleted file mode 100644 index 2b1f06a867..0000000000 --- a/external/corefx/src/System.Text.RegularExpressions/tests/GroupCollectionTests.netcoreapp.cs +++ /dev/null @@ -1,169 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Xunit; - -namespace System.Text.RegularExpressions.Tests -{ - public static partial class GroupCollectionTests - { - [Fact] - public static void IListOfT_Item_Get() - { - IList collection = CreateCollection(); - Assert.Equal("212-555-6666", collection[0].ToString()); - Assert.Equal("212", collection[1].ToString()); - Assert.Equal("555-6666", collection[2].ToString()); - } - - [Fact] - public static void IReadOnlyListOfT_Item_Get() - { - IReadOnlyList collection = CreateCollection(); - Assert.Equal("212-555-6666", collection[0].ToString()); - Assert.Equal("212", collection[1].ToString()); - Assert.Equal("555-6666", collection[2].ToString()); - } - - [Fact] - public static void IList_Item_Get() - { - IList collection = CreateCollection(); - Assert.Equal("212-555-6666", collection[0].ToString()); - Assert.Equal("212", collection[1].ToString()); - Assert.Equal("555-6666", collection[2].ToString()); - } - - [Fact] - public static void ICollectionOfT_Contains() - { - ICollection collection = CreateCollection(); - foreach (Group item in collection) - { - Assert.True(collection.Contains(item)); - } - - foreach (Group item in CreateCollection()) - { - Assert.False(collection.Contains(item)); - } - } - - [Fact] - public static void IList_Contains() - { - IList collection = CreateCollection(); - foreach (object item in collection) - { - Assert.True(collection.Contains(item)); - } - - foreach (object item in CreateCollection()) - { - Assert.False(collection.Contains(item)); - } - - Assert.False(collection.Contains(new object())); - } - - [Fact] - public static void IListOfT_IndexOf() - { - IList collection = CreateCollection(); - - int i = 0; - foreach (Group item in collection) - { - Assert.Equal(i, collection.IndexOf(item)); - i++; - } - - foreach (Group item in CreateCollection()) - { - Assert.Equal(-1, collection.IndexOf(item)); - } - } - - [Fact] - public static void IList_IndexOf() - { - IList collection = CreateCollection(); - - int i = 0; - foreach (object item in collection) - { - Assert.Equal(i, collection.IndexOf(item)); - i++; - } - - foreach (object item in CreateCollection()) - { - Assert.Equal(-1, collection.IndexOf(item)); - } - - Assert.Equal(-1, collection.IndexOf(new object())); - } - - [Fact] - public static void ICollectionOfT_CopyTo() - { - string[] expected = new[] { "212-555-6666", "212", "555-6666" }; - ICollection collection = CreateCollection(); - - Group[] array = new Group[collection.Count]; - collection.CopyTo(array, 0); - - Assert.Equal(expected, array.Select(c => c.ToString())); - } - - [Fact] - public static void ICollectionOfT_CopyTo_Invalid() - { - ICollection collection = CreateCollection(); - AssertExtensions.Throws("array", () => collection.CopyTo(null, 0)); - AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Group[1], -1)); - AssertExtensions.Throws(null, () => collection.CopyTo(new Group[1], 0)); - AssertExtensions.Throws(null, () => collection.CopyTo(new Group[1], 1)); - AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Group[1], 2)); - } - - [Fact] - public static void IListOfT_IsReadOnly() - { - IList list = CreateCollection(); - Assert.True(list.IsReadOnly); - Assert.Throws(() => list.Add(default(Group))); - Assert.Throws(() => list.Clear()); - Assert.Throws(() => list.Insert(0, default(Group))); - Assert.Throws(() => list.Remove(default(Group))); - Assert.Throws(() => list.RemoveAt(0)); - Assert.Throws(() => list[0] = default(Group)); - } - - [Fact] - public static void IList_IsReadOnly() - { - IList list = CreateCollection(); - Assert.True(list.IsReadOnly); - Assert.True(list.IsFixedSize); - Assert.Throws(() => list.Add(default(Group))); - Assert.Throws(() => list.Clear()); - Assert.Throws(() => list.Insert(0, default(Group))); - Assert.Throws(() => list.Remove(default(Group))); - Assert.Throws(() => list.RemoveAt(0)); - Assert.Throws(() => list[0] = default(Group)); - } - - [Fact] - public static void DebuggerAttributeTests() - { - DebuggerAttributes.ValidateDebuggerDisplayReferences(CreateCollection()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(CreateCollection()); - } - } -} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/GroupCollectionTests2.cs b/external/corefx/src/System.Text.RegularExpressions/tests/GroupCollectionTests2.cs new file mode 100644 index 0000000000..0f5d46cb17 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/tests/GroupCollectionTests2.cs @@ -0,0 +1,183 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using Xunit; + +namespace System.Text.RegularExpressions.Tests +{ + public static partial class GroupCollectionTests + { + [Fact] + public static void IListOfT_Item_Get() + { + IList collection = CreateCollection(); + Assert.Equal("212-555-6666", collection[0].ToString()); + Assert.Equal("212", collection[1].ToString()); + Assert.Equal("555-6666", collection[2].ToString()); + } + + [Fact] + public static void IReadOnlyListOfT_Item_Get() + { + IReadOnlyList collection = CreateCollection(); + Assert.Equal("212-555-6666", collection[0].ToString()); + Assert.Equal("212", collection[1].ToString()); + Assert.Equal("555-6666", collection[2].ToString()); + } + + [Fact] + public static void IList_Item_Get() + { + IList collection = CreateCollection(); + Assert.Equal("212-555-6666", collection[0].ToString()); + Assert.Equal("212", collection[1].ToString()); + Assert.Equal("555-6666", collection[2].ToString()); + } + + [Fact] + public static void ICollectionOfT_Contains() + { + ICollection collection = CreateCollection(); + foreach (Group item in collection) + { + Assert.True(collection.Contains(item)); + } + + foreach (Group item in CreateCollection()) + { + Assert.False(collection.Contains(item)); + } + } + + [Fact] + public static void IList_Contains() + { + IList collection = CreateCollection(); + foreach (object item in collection) + { + Assert.True(collection.Contains(item)); + } + + foreach (object item in CreateCollection()) + { + Assert.False(collection.Contains(item)); + } + + Assert.False(collection.Contains(new object())); + } + + [Fact] + public static void IListOfT_IndexOf() + { + IList collection = CreateCollection(); + + int i = 0; + foreach (Group item in collection) + { + Assert.Equal(i, collection.IndexOf(item)); + i++; + } + + foreach (Group item in CreateCollection()) + { + Assert.Equal(-1, collection.IndexOf(item)); + } + } + + [Fact] + public static void IList_IndexOf() + { + IList collection = CreateCollection(); + + int i = 0; + foreach (object item in collection) + { + Assert.Equal(i, collection.IndexOf(item)); + i++; + } + + foreach (object item in CreateCollection()) + { + Assert.Equal(-1, collection.IndexOf(item)); + } + + Assert.Equal(-1, collection.IndexOf(new object())); + } + + [Fact] + public static void ICollectionOfT_CopyTo() + { + string[] expected = new[] { "212-555-6666", "212", "555-6666" }; + ICollection collection = CreateCollection(); + + Group[] array = new Group[collection.Count]; + collection.CopyTo(array, 0); + + Assert.Equal(expected, array.Select(c => c.ToString())); + } + + [Fact] + public static void ICollectionOfT_CopyTo_Invalid() + { + ICollection collection = CreateCollection(); + AssertExtensions.Throws("array", () => collection.CopyTo(null, 0)); + AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Group[1], -1)); + AssertExtensions.Throws(null, () => collection.CopyTo(new Group[1], 0)); + AssertExtensions.Throws(null, () => collection.CopyTo(new Group[1], 1)); + AssertExtensions.Throws("arrayIndex", () => collection.CopyTo(new Group[1], 2)); + } + + [Fact] + public static void IListOfT_IsReadOnly() + { + IList list = CreateCollection(); + Assert.True(list.IsReadOnly); + Assert.Throws(() => list.Add(default(Group))); + Assert.Throws(() => list.Clear()); + Assert.Throws(() => list.Insert(0, default(Group))); + Assert.Throws(() => list.Remove(default(Group))); + Assert.Throws(() => list.RemoveAt(0)); + Assert.Throws(() => list[0] = default(Group)); + } + + [Fact] + public static void IList_IsReadOnly() + { + IList list = CreateCollection(); + Assert.True(list.IsReadOnly); + Assert.True(list.IsFixedSize); + Assert.Throws(() => list.Add(default(Group))); + Assert.Throws(() => list.Clear()); + Assert.Throws(() => list.Insert(0, default(Group))); + Assert.Throws(() => list.Remove(default(Group))); + Assert.Throws(() => list.RemoveAt(0)); + Assert.Throws(() => list[0] = default(Group)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] + public static void DebuggerAttributeTests() + { + GroupCollection col = CreateCollection(); + DebuggerAttributes.ValidateDebuggerDisplayReferences(col); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + Group[] items = itemProperty.GetValue(info.Instance) as Group[]; + Assert.Equal(col, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] + public static void DebuggerAttributeTests_Null() + { + TargetInvocationException ex = Assert.Throws(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(GroupCollection), null)); + Assert.IsType(ex.InnerException); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs b/external/corefx/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs deleted file mode 100644 index 08a9c90b89..0000000000 --- a/external/corefx/src/System.Text.RegularExpressions/tests/MatchCollectionTests.netcoreapp.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Xunit; - -namespace System.Text.RegularExpressions.Tests -{ - public static partial class MatchCollectionTests - { - [Fact] - public static void IListOfT_Item_Get() - { - IList collection = CreateCollection(); - Assert.Equal("t", collection[0].ToString()); - Assert.Equal("t", collection[1].ToString()); - } - - [Fact] - public static void IReadOnlyListOfT_Item_Get() - { - IReadOnlyList collection = CreateCollection(); - Assert.Equal("t", collection[0].ToString()); - Assert.Equal("t", collection[1].ToString()); - } - - [Fact] - public static void IList_Item_Get() - { - IList collection = CreateCollection(); - Assert.Equal("t", collection[0].ToString()); - Assert.Equal("t", collection[1].ToString()); - } - - [Fact] - public static void ICollectionOfT_Contains() - { - ICollection collection = CreateCollection(); - foreach (Match item in collection) - { - Assert.True(collection.Contains(item)); - } - - foreach (Match item in CreateCollection()) - { - Assert.False(collection.Contains(item)); - } - } - - [Fact] - public static void IList_Contains() - { - IList collection = CreateCollection(); - foreach (object item in collection) - { - Assert.True(collection.Contains(item)); - } - - foreach (object item in CreateCollection()) - { - Assert.False(collection.Contains(item)); - } - - Assert.False(collection.Contains(new object())); - } - - [Fact] - public static void IListOfT_IndexOf() - { - IList collection = CreateCollection(); - - int i = 0; - foreach (Match item in collection) - { - Assert.Equal(i, collection.IndexOf(item)); - i++; - } - - foreach (Match item in CreateCollection()) - { - Assert.Equal(-1, collection.IndexOf(item)); - } - } - - [Fact] - public static void IList_IndexOf() - { - IList collection = CreateCollection(); - - int i = 0; - foreach (object item in collection) - { - Assert.Equal(i, collection.IndexOf(item)); - i++; - } - - foreach (object item in CreateCollection()) - { - Assert.Equal(-1, collection.IndexOf(item)); - } - - Assert.Equal(-1, collection.IndexOf(new object())); - } - - [Fact] - public static void ICollectionOfT_CopyTo() - { - string[] expected = new[] { "t", "t" }; - ICollection collection = CreateCollection(); - - Match[] array = new Match[collection.Count]; - collection.CopyTo(array, 0); - - Assert.Equal(expected, array.Select(c => c.ToString())); - } - - [Fact] - public static void ICollectionOfT_CopyTo_Invalid() - { - ICollection collection = CreateCollection(); - Assert.Throws(() => collection.CopyTo(null, 0)); - Assert.Throws(() => collection.CopyTo(new Match[1], -1)); - AssertExtensions.Throws("destinationArray", () => collection.CopyTo(new Match[1], 0)); - AssertExtensions.Throws("destinationArray", () => collection.CopyTo(new Match[1], 1)); - AssertExtensions.Throws("destinationArray", () => collection.CopyTo(new Match[1], 2)); - } - - [Fact] - public static void IListOfT_IsReadOnly() - { - IList list = CreateCollection(); - Assert.True(list.IsReadOnly); - Assert.Throws(() => list.Add(default(Match))); - Assert.Throws(() => list.Clear()); - Assert.Throws(() => list.Insert(0, default(Match))); - Assert.Throws(() => list.Remove(default(Match))); - Assert.Throws(() => list.RemoveAt(0)); - Assert.Throws(() => list[0] = default(Match)); - } - - [Fact] - public static void IList_IsReadOnly() - { - IList list = CreateCollection(); - Assert.True(list.IsReadOnly); - Assert.True(list.IsFixedSize); - Assert.Throws(() => list.Add(default(Match))); - Assert.Throws(() => list.Clear()); - Assert.Throws(() => list.Insert(0, default(Match))); - Assert.Throws(() => list.Remove(default(Match))); - Assert.Throws(() => list.RemoveAt(0)); - Assert.Throws(() => list[0] = default(Match)); - } - - [Fact] - public static void DebuggerAttributeTests() - { - DebuggerAttributes.ValidateDebuggerDisplayReferences(CreateCollection()); - DebuggerAttributes.ValidateDebuggerTypeProxyProperties(CreateCollection()); - } - } -} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/MatchCollectionTests2.cs b/external/corefx/src/System.Text.RegularExpressions/tests/MatchCollectionTests2.cs new file mode 100644 index 0000000000..02f118f575 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/tests/MatchCollectionTests2.cs @@ -0,0 +1,180 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using Xunit; + +namespace System.Text.RegularExpressions.Tests +{ + public static partial class MatchCollectionTests + { + [Fact] + public static void IListOfT_Item_Get() + { + IList collection = CreateCollection(); + Assert.Equal("t", collection[0].ToString()); + Assert.Equal("t", collection[1].ToString()); + } + + [Fact] + public static void IReadOnlyListOfT_Item_Get() + { + IReadOnlyList collection = CreateCollection(); + Assert.Equal("t", collection[0].ToString()); + Assert.Equal("t", collection[1].ToString()); + } + + [Fact] + public static void IList_Item_Get() + { + IList collection = CreateCollection(); + Assert.Equal("t", collection[0].ToString()); + Assert.Equal("t", collection[1].ToString()); + } + + [Fact] + public static void ICollectionOfT_Contains() + { + ICollection collection = CreateCollection(); + foreach (Match item in collection) + { + Assert.True(collection.Contains(item)); + } + + foreach (Match item in CreateCollection()) + { + Assert.False(collection.Contains(item)); + } + } + + [Fact] + public static void IList_Contains() + { + IList collection = CreateCollection(); + foreach (object item in collection) + { + Assert.True(collection.Contains(item)); + } + + foreach (object item in CreateCollection()) + { + Assert.False(collection.Contains(item)); + } + + Assert.False(collection.Contains(new object())); + } + + [Fact] + public static void IListOfT_IndexOf() + { + IList collection = CreateCollection(); + + int i = 0; + foreach (Match item in collection) + { + Assert.Equal(i, collection.IndexOf(item)); + i++; + } + + foreach (Match item in CreateCollection()) + { + Assert.Equal(-1, collection.IndexOf(item)); + } + } + + [Fact] + public static void IList_IndexOf() + { + IList collection = CreateCollection(); + + int i = 0; + foreach (object item in collection) + { + Assert.Equal(i, collection.IndexOf(item)); + i++; + } + + foreach (object item in CreateCollection()) + { + Assert.Equal(-1, collection.IndexOf(item)); + } + + Assert.Equal(-1, collection.IndexOf(new object())); + } + + [Fact] + public static void ICollectionOfT_CopyTo() + { + string[] expected = new[] { "t", "t" }; + ICollection collection = CreateCollection(); + + Match[] array = new Match[collection.Count]; + collection.CopyTo(array, 0); + + Assert.Equal(expected, array.Select(c => c.ToString())); + } + + [Fact] + public static void ICollectionOfT_CopyTo_Invalid() + { + ICollection collection = CreateCollection(); + Assert.Throws(() => collection.CopyTo(null, 0)); + Assert.Throws(() => collection.CopyTo(new Match[1], -1)); + AssertExtensions.Throws("destinationArray", () => collection.CopyTo(new Match[1], 0)); + AssertExtensions.Throws("destinationArray", () => collection.CopyTo(new Match[1], 1)); + AssertExtensions.Throws("destinationArray", () => collection.CopyTo(new Match[1], 2)); + } + + [Fact] + public static void IListOfT_IsReadOnly() + { + IList list = CreateCollection(); + Assert.True(list.IsReadOnly); + Assert.Throws(() => list.Add(default(Match))); + Assert.Throws(() => list.Clear()); + Assert.Throws(() => list.Insert(0, default(Match))); + Assert.Throws(() => list.Remove(default(Match))); + Assert.Throws(() => list.RemoveAt(0)); + Assert.Throws(() => list[0] = default(Match)); + } + + [Fact] + public static void IList_IsReadOnly() + { + IList list = CreateCollection(); + Assert.True(list.IsReadOnly); + Assert.True(list.IsFixedSize); + Assert.Throws(() => list.Add(default(Match))); + Assert.Throws(() => list.Clear()); + Assert.Throws(() => list.Insert(0, default(Match))); + Assert.Throws(() => list.Remove(default(Match))); + Assert.Throws(() => list.RemoveAt(0)); + Assert.Throws(() => list[0] = default(Match)); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] + public static void DebuggerAttributeTests() + { + MatchCollection col = CreateCollection(); + DebuggerAttributes.ValidateDebuggerDisplayReferences(col); + DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(col); + PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute().State == DebuggerBrowsableState.RootHidden); + Match[] items = itemProperty.GetValue(info.Instance) as Match[]; + Assert.Equal(col, items); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot)] + public static void DebuggerAttributeTests_Null() + { + TargetInvocationException ex = Assert.Throws(() => DebuggerAttributes.ValidateDebuggerTypeProxyProperties(typeof(MatchCollection), null)); + Assert.IsType(ex.InnerException); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs index 16d121ee7d..fc63daef93 100644 --- a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs +++ b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; using Xunit; namespace System.Text.RegularExpressions.Tests { - public class RegexConstructorTests + public class RegexConstructorTests : RemoteExecutorTestBase { public static IEnumerable Ctor_TestData() { @@ -75,6 +76,30 @@ namespace System.Text.RegularExpressions.Tests AssertExtensions.Throws("matchTimeout", () => new Regex("foo", RegexOptions.None, TimeSpan.FromMilliseconds(int.MaxValue))); } + [Fact] + public static void StaticCtor_InvalidTimeoutObject_ExceptionThrown() + { + RemoteInvoke(() => + { + AppDomain.CurrentDomain.SetData(RegexHelpers.DefaultMatchTimeout_ConfigKeyName, true); + Assert.Throws(() => Regex.InfiniteMatchTimeout); + + return SuccessExitCode; + }); + } + + [Fact] + public static void StaticCtor_InvalidTimeoutRange_ExceptionThrown() + { + RemoteInvoke(() => + { + AppDomain.CurrentDomain.SetData(RegexHelpers.DefaultMatchTimeout_ConfigKeyName, TimeSpan.Zero); + Assert.Throws(() => Regex.InfiniteMatchTimeout); + + return SuccessExitCode; + }); + } + [Fact] public void CacheSize_Get() { diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 43d51f009b..672f29ce88 100644 --- a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Linq; using Xunit; namespace System.Text.RegularExpressions.Tests @@ -266,6 +267,7 @@ namespace System.Text.RegularExpressions.Tests [Theory] [MemberData(nameof(Match_Basic_TestData))] + [MemberData(nameof(RegexCompilationHelper.TransformRegexOptions), nameof(Match_Basic_TestData), 2, MemberType = typeof(RegexCompilationHelper))] public void Match(string pattern, string input, RegexOptions options, int beginning, int length, bool expectedSuccess, string expectedValue) { bool isDefaultStart = RegexHelpers.IsDefaultStart(input, options, beginning); @@ -328,6 +330,21 @@ namespace System.Text.RegularExpressions.Tests Assert.Equal("a", match.Value); } + [Fact] + public void Match_Timeout_Throws() + { + RemoteInvoke(() => + { + const string Pattern = @"^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$"; + string input = new string('a', 50) + "@a.a"; + + AppDomain.CurrentDomain.SetData(RegexHelpers.DefaultMatchTimeout_ConfigKeyName, TimeSpan.FromMilliseconds(100)); + Assert.Throws(() => new Regex(Pattern).Match(input)); + + return SuccessExitCode; + }); + } + public static IEnumerable Match_Advanced_TestData() { // \B special character escape: ".*\\B(SUCCESS)\\B.*" @@ -596,7 +613,7 @@ namespace System.Text.RegularExpressions.Tests bool isDefaultCount = RegexHelpers.IsDefaultStart(input, options, length); if (options == RegexOptions.None) { - if (isDefaultStart && isDefaultCount) + if (isDefaultStart && isDefaultCount) { // Use Match(string) or Match(string, string) VerifyMatch(new Regex(pattern).Match(input), true, expected); diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Replace.Tests.cs b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Replace.Tests.cs index 44f4d94573..0cbf545bd7 100644 --- a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Replace.Tests.cs +++ b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Replace.Tests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Linq; using Xunit; namespace System.Text.RegularExpressions.Tests @@ -109,6 +110,7 @@ namespace System.Text.RegularExpressions.Tests [Theory] [MemberData(nameof(Replace_String_TestData))] + [MemberData(nameof(RegexCompilationHelper.TransformRegexOptions), nameof(Replace_String_TestData), 3, MemberType = typeof(RegexCompilationHelper))] public void Replace(string pattern, string input, string replacement, RegexOptions options, int count, int start, string expected) { bool isDefaultStart = RegexHelpers.IsDefaultStart(input, options, start); @@ -178,6 +180,7 @@ namespace System.Text.RegularExpressions.Tests [Theory] [MemberData(nameof(Replace_MatchEvaluator_TestData))] + [MemberData(nameof(RegexCompilationHelper.TransformRegexOptions), nameof(Replace_MatchEvaluator_TestData), 3, MemberType = typeof(RegexCompilationHelper))] public void Replace(string pattern, string input, MatchEvaluator evaluator, RegexOptions options, int count, int start, string expected) { bool isDefaultStart = RegexHelpers.IsDefaultStart(input, options, start); diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Split.Tests.cs b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Split.Tests.cs index 5d90f21871..00df350bf5 100644 --- a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Split.Tests.cs +++ b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Split.Tests.cs @@ -9,7 +9,7 @@ namespace System.Text.RegularExpressions.Tests { public class RegexSplitTests { - public static IEnumerable Split_TestData() + public static IEnumerable Split_NonCompiled_TestData() { yield return new object[] { " ", "word0 word1 word2 word3", RegexOptions.None, 32, 0, new string[] { "word0", "word1", "word2", "word3" } }; @@ -50,7 +50,8 @@ namespace System.Text.RegularExpressions.Tests } [Theory] - [MemberData(nameof(Split_TestData))] + [MemberData(nameof(Split_NonCompiled_TestData))] + [MemberData(nameof(RegexCompilationHelper.TransformRegexOptions), nameof(Split_NonCompiled_TestData), 2, MemberType = typeof(RegexCompilationHelper))] public void Split(string pattern, string input, RegexOptions options, int count, int start, string[] expected) { bool isDefaultStart = RegexHelpers.IsDefaultStart(input, options, start); diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Tests.Common.cs b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Tests.Common.cs index 0ec9c4462f..45d87187dd 100644 --- a/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Tests.Common.cs +++ b/external/corefx/src/System.Text.RegularExpressions/tests/Regex.Tests.Common.cs @@ -6,6 +6,8 @@ namespace System.Text.RegularExpressions.Tests { public static class RegexHelpers { + public const string DefaultMatchTimeout_ConfigKeyName = "REGEX_DEFAULT_MATCH_TIMEOUT"; + public static bool IsDefaultCount(string input, RegexOptions options, int count) { if ((options & RegexOptions.RightToLeft) != 0) diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/RegexCompilationHelper.cs b/external/corefx/src/System.Text.RegularExpressions/tests/RegexCompilationHelper.cs new file mode 100644 index 0000000000..5a20e154f2 --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/tests/RegexCompilationHelper.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace System.Text.RegularExpressions.Tests +{ + public class RegexCompilationHelper + { + /// + /// Adds RegexOptions.Compiled to the RegexOptions of each item in a given array of test data. + /// + /// The index in the object array of the CompilationOptions enum. + /// + public static IEnumerable TransformRegexOptions(string testDataMethodName, int regexOptionsArrayIndex) + { + // On Uap or NetNative the compiled feature isn't currently enabled, + // therefore we don't need the additional test data. + if (PlatformDetection.IsUap) + { + return Enumerable.Empty(); + } + + IEnumerable types = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.Namespace == typeof(RegexCompilationHelper).Namespace); + foreach (Type type in types) + { + IEnumerable result = InvokeTransform(type, testDataMethodName, regexOptionsArrayIndex); + if (result != null) + { + return result; + } + } + + throw new Exception($"Test method '{testDataMethodName}' not found"); + } + + private static IEnumerable InvokeTransform(Type type, string methodName, int regexOptionsArrayIndex) + { + MethodInfo methodInfo = type.GetMethod(methodName, BindingFlags.Public | BindingFlags.Static); + var data = methodInfo?.Invoke(null, null) as IEnumerable; + + return data?.Select(obj => + { + obj[regexOptionsArrayIndex] = (RegexOptions)obj[regexOptionsArrayIndex] | RegexOptions.Compiled; + return obj; + }); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/RegexCompilationInfoTests.cs b/external/corefx/src/System.Text.RegularExpressions/tests/RegexCompilationInfoTests.cs new file mode 100644 index 0000000000..ab7d512b9a --- /dev/null +++ b/external/corefx/src/System.Text.RegularExpressions/tests/RegexCompilationInfoTests.cs @@ -0,0 +1,119 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using Xunit; + +namespace System.Text.RegularExpressions.Tests +{ + public class RegexCompilationInfoTests + { + private RegexCompilationInfo Instance + { + get => new RegexCompilationInfo("pattern", RegexOptions.None, "name", "fullnamespace", true, TimeSpan.FromSeconds(60)); + } + + public static IEnumerable Ctor_MemberData() + { + yield return new object[] { string.Empty, RegexOptions.None, "name", string.Empty, false, TimeSpan.FromSeconds(60) }; + yield return new object[] { "pattern", RegexOptions.Compiled, "name", "fullnamespace", true, TimeSpan.FromSeconds(60) }; + } + + [Theory] + [MemberData(nameof(Ctor_MemberData))] + public void Ctor_ValidArguments_CheckProperties(string pattern, RegexOptions options, string name, string fullnamespace, bool ispublic, TimeSpan matchTimeout) + { + var regexCompilationInfo = new RegexCompilationInfo(pattern, options, name, fullnamespace, ispublic, matchTimeout); + Assert.Equal(pattern, regexCompilationInfo.Pattern); + Assert.Equal(options, regexCompilationInfo.Options); + Assert.Equal(name, regexCompilationInfo.Name); + Assert.Equal(fullnamespace, regexCompilationInfo.Namespace); + Assert.Equal(ispublic, regexCompilationInfo.IsPublic); + Assert.Equal(matchTimeout, regexCompilationInfo.MatchTimeout); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public void IsPublic_GetSet(bool isPublic) + { + RegexCompilationInfo regexCompilationInfo = Instance; + regexCompilationInfo.IsPublic = isPublic; + Assert.Equal(isPublic, regexCompilationInfo.IsPublic); + } + + public static IEnumerable MatchTimeout_GetSet_Throws_MemberData() + { + yield return new object[] { TimeSpan.Zero }; + yield return new object[] { TimeSpan.FromMilliseconds(int.MaxValue) }; + yield return new object[] { TimeSpan.MinValue }; + } + + public static IEnumerable MatchTimeout_GetSet_Success_MemberData() + { + yield return new object[] { TimeSpan.Zero.Add(TimeSpan.FromMilliseconds(1)) }; + yield return new object[] { TimeSpan.FromMilliseconds(int.MaxValue - 1) }; + } + + [Theory] + [MemberData(nameof(MatchTimeout_GetSet_Throws_MemberData))] + public void MatchTimeout_GetSet_Throws(TimeSpan matchTimeout) + { + RegexCompilationInfo regexCompilationInfo = Instance; + AssertExtensions.Throws("matchTimeout", () => + regexCompilationInfo.MatchTimeout = matchTimeout); + } + + [Theory] + [MemberData(nameof(MatchTimeout_GetSet_Success_MemberData))] + public void MatchTimeout_GetSet_Success(TimeSpan matchTimeout) + { + RegexCompilationInfo regexCompilationInfo = Instance; + regexCompilationInfo.MatchTimeout = matchTimeout; + Assert.Equal(matchTimeout, regexCompilationInfo.MatchTimeout); + } + + [Fact] + public void Name_GetSet() + { + RegexCompilationInfo regexCompilationInfo = Instance; + AssertExtensions.Throws("Name", "value", () => regexCompilationInfo.Name = null); + AssertExtensions.Throws("Name", "value", () => regexCompilationInfo.Name = string.Empty); + regexCompilationInfo.Name = "Name"; + Assert.Equal("Name", regexCompilationInfo.Name); + } + + [Fact] + public void Namespace_GetSet() + { + RegexCompilationInfo regexCompilationInfo = Instance; + AssertExtensions.Throws("Namespace", "value", () => regexCompilationInfo.Namespace = null); + regexCompilationInfo.Namespace = string.Empty; + Assert.Equal(string.Empty, regexCompilationInfo.Namespace); + regexCompilationInfo.Namespace = "Namespace"; + Assert.Equal("Namespace", regexCompilationInfo.Namespace); + } + + [Fact] + public void Options_GetSet() + { + RegexCompilationInfo regexCompilationInfo = Instance; + regexCompilationInfo.Options = RegexOptions.None; + Assert.Equal(RegexOptions.None, regexCompilationInfo.Options); + regexCompilationInfo.Options = RegexOptions.Compiled | RegexOptions.CultureInvariant; + Assert.Equal(RegexOptions.Compiled | RegexOptions.CultureInvariant, regexCompilationInfo.Options); + } + + [Fact] + public void Pattern_GetSet() + { + RegexCompilationInfo regexCompilationInfo = Instance; + AssertExtensions.Throws("Pattern", "value", () => regexCompilationInfo.Pattern = null); + regexCompilationInfo.Pattern = string.Empty; + Assert.Equal(string.Empty, regexCompilationInfo.Pattern); + regexCompilationInfo.Pattern = "Pattern"; + Assert.Equal("Pattern", regexCompilationInfo.Pattern); + } + } +} diff --git a/external/corefx/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj b/external/corefx/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj index 2c54d8de6e..aca9ba82ba 100644 --- a/external/corefx/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj +++ b/external/corefx/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj @@ -12,9 +12,6 @@ - - Common\tests\System\PlatformDetection.cs - @@ -29,23 +26,22 @@ - - System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs - + RemoteExecutorConsoleApp - + + + + + - - - Common\System\Diagnostics\DebuggerAttributes.cs - \ No newline at end of file + diff --git a/external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.pkgproj b/external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.pkgproj index eb83751e63..5c15d6245e 100644 --- a/external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.pkgproj +++ b/external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.pkgproj @@ -10,11 +10,7 @@ netcore50 - - - - lib/netstandard1.3 - + \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Overlapped/dir.props b/external/corefx/src/System.Threading.Overlapped/dir.props index e09fa64586..e063359772 100644 --- a/external/corefx/src/System.Threading.Overlapped/dir.props +++ b/external/corefx/src/System.Threading.Overlapped/dir.props @@ -6,6 +6,5 @@ MSFT true true - true \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Overlapped/ref/Configurations.props b/external/corefx/src/System.Threading.Overlapped/ref/Configurations.props index 192309fce5..c701755863 100644 --- a/external/corefx/src/System.Threading.Overlapped/ref/Configurations.props +++ b/external/corefx/src/System.Threading.Overlapped/ref/Configurations.props @@ -3,7 +3,6 @@ netcoreapp; - netfx; uap; diff --git a/external/corefx/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj b/external/corefx/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj index 8d4a6f7e8b..09ae078a18 100644 --- a/external/corefx/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj +++ b/external/corefx/src/System.Threading.Overlapped/ref/System.Threading.Overlapped.csproj @@ -8,8 +8,6 @@ - - diff --git a/external/corefx/src/System.Threading.Overlapped/src/Configurations.props b/external/corefx/src/System.Threading.Overlapped/src/Configurations.props index 2f43c22f78..aed58fb42e 100644 --- a/external/corefx/src/System.Threading.Overlapped/src/Configurations.props +++ b/external/corefx/src/System.Threading.Overlapped/src/Configurations.props @@ -4,7 +4,6 @@ uap-Windows_NT; uapaot-Windows_NT; - netfx-Windows_NT; netcoreapp-Windows_NT; netcoreapp-Unix; diff --git a/external/corefx/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj b/external/corefx/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj index a5863606d1..d689c80781 100644 --- a/external/corefx/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj +++ b/external/corefx/src/System.Threading.Overlapped/src/System.Threading.Overlapped.csproj @@ -12,8 +12,6 @@ - - @@ -33,4 +31,4 @@ - + \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Overlapped/src/System/Threading/ClrThreadPoolBoundHandle.cs b/external/corefx/src/System.Threading.Overlapped/src/System/Threading/ClrThreadPoolBoundHandle.cs index 3242835b81..ce17815ae7 100644 --- a/external/corefx/src/System.Threading.Overlapped/src/System/Threading/ClrThreadPoolBoundHandle.cs +++ b/external/corefx/src/System.Threading.Overlapped/src/System/Threading/ClrThreadPoolBoundHandle.cs @@ -264,7 +264,7 @@ namespace System.Threading /// /// /// An unmanaged pointer to the structure from which to return the - /// asscociated user-provided object. + /// associated user-provided object. /// /// /// A user-provided object that distinguishes this diff --git a/external/corefx/src/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs b/external/corefx/src/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs index 89380fee60..e2b1eb983b 100644 --- a/external/corefx/src/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs +++ b/external/corefx/src/System.Threading.Overlapped/src/System/Threading/DeferredDisposableLifetime.cs @@ -18,7 +18,7 @@ namespace System.Threading /// Indicates whether the object has been disposed. /// /// - /// If the refount reaches zero before the object is disposed, this method will be called with + /// If the refcount reaches zero before the object is disposed, this method will be called with /// set to false. If the object is then disposed, this method will be /// called again, with set to true. If the refcount reaches zero /// after the object has already been disposed, this will be called a single time, with diff --git a/external/corefx/src/System.Threading.Tasks.Dataflow/pkg/System.Threading.Tasks.Dataflow.pkgproj b/external/corefx/src/System.Threading.Tasks.Dataflow/pkg/System.Threading.Tasks.Dataflow.pkgproj index c8942a024b..2c1ebf5fd4 100644 --- a/external/corefx/src/System.Threading.Tasks.Dataflow/pkg/System.Threading.Tasks.Dataflow.pkgproj +++ b/external/corefx/src/System.Threading.Tasks.Dataflow/pkg/System.Threading.Tasks.Dataflow.pkgproj @@ -9,8 +9,15 @@ net45;netcore45;wp8;wpa81;netcoreapp1.0;$(AllXamarinFrameworks) - - + + + + .NETCoreApp;UAP + \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ConcurrentQueue.cs b/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ConcurrentQueue.cs index 9eb6536918..8db9d7ab26 100644 --- a/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ConcurrentQueue.cs +++ b/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ConcurrentQueue.cs @@ -18,7 +18,6 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using System.Security; using System.Threading; @@ -36,15 +35,9 @@ namespace System.Threading.Tasks.Dataflow.Internal.Collections [DebuggerTypeProxy(typeof(SystemCollectionsConcurrent_ProducerConsumerCollectionDebugView<>))] internal class ConcurrentQueue : IProducerConsumerCollection { - //fields of ConcurrentQueue private volatile Segment _head; - private volatile Segment _tail; - - private T[] _serializationArray; // Used for custom serialization. - private const int SEGMENT_SIZE = 32; - //number of snapshot takers, GetEnumerator(), ToList() and ToArray() operations take snapshot. internal volatile int _numSnapshotTakers = 0; @@ -100,27 +93,6 @@ namespace System.Threading.Tasks.Dataflow.Internal.Collections InitializeFromCollection(collection); } - /// - /// Get the data array to be serialized - /// - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - // save the data into the serialization array to be saved - _serializationArray = ToArray(); - } - - /// - /// Construct the queue from a previously serialized one - /// - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - Debug.Assert(_serializationArray != null); - InitializeFromCollection(_serializationArray); - _serializationArray = null; - } - /// /// Copies the elements of the to an , starting at a particular diff --git a/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs b/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs index d14fd60cec..44b10b3dc8 100644 --- a/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs +++ b/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs @@ -551,7 +551,7 @@ namespace System.Threading.Tasks } /// Padding structure used to minimize false sharing in SingleProducerSingleConsumerQueue{T}. - [StructLayout(LayoutKind.Explicit, Size = PaddingHelpers.CACHE_LINE_SIZE - sizeof(Int32))] // Based on common case of 64-byte cache lines + [StructLayout(LayoutKind.Explicit, Size = PaddingHelpers.CACHE_LINE_SIZE - sizeof(Int32))] struct PaddingFor32 { } diff --git a/external/corefx/src/System.Threading.Tasks.Dataflow/src/XmlDocs/System.Threading.Tasks.Dataflow.xml.REMOVED.git-id b/external/corefx/src/System.Threading.Tasks.Dataflow/src/XmlDocs/System.Threading.Tasks.Dataflow.xml.REMOVED.git-id index 60cde99dc7..13a4463898 100644 --- a/external/corefx/src/System.Threading.Tasks.Dataflow/src/XmlDocs/System.Threading.Tasks.Dataflow.xml.REMOVED.git-id +++ b/external/corefx/src/System.Threading.Tasks.Dataflow/src/XmlDocs/System.Threading.Tasks.Dataflow.xml.REMOVED.git-id @@ -1 +1 @@ -9cafa9e8d6e3299259a358dba800348c9b4a2161 \ No newline at end of file +04d59b871d9d7b349e5a4a32aaf4e138a127087d \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.sln b/external/corefx/src/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.sln index f45b1bc39a..a16e156cad 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.sln +++ b/external/corefx/src/System.Threading.Tasks.Extensions/System.Threading.Tasks.Extensions.sln @@ -30,10 +30,10 @@ Global {275B161B-D525-48A0-B1DE-344273AB9A99}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU {275B161B-D525-48A0-B1DE-344273AB9A99}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU {275B161B-D525-48A0-B1DE-344273AB9A99}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU - {DE90AD0B-649D-4062-B8D9-9658DE140532}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU - {DE90AD0B-649D-4062-B8D9-9658DE140532}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU - {DE90AD0B-649D-4062-B8D9-9658DE140532}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU - {DE90AD0B-649D-4062-B8D9-9658DE140532}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU + {DE90AD0B-649D-4062-B8D9-9658DE140532}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU + {DE90AD0B-649D-4062-B8D9-9658DE140532}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU + {DE90AD0B-649D-4062-B8D9-9658DE140532}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU + {DE90AD0B-649D-4062-B8D9-9658DE140532}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU {0DF7FA9A-E7D3-4CEF-862B-A37F5BBBB54C}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU {0DF7FA9A-E7D3-4CEF-862B-A37F5BBBB54C}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU {0DF7FA9A-E7D3-4CEF-862B-A37F5BBBB54C}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/pkg/System.Threading.Tasks.Extensions.pkgproj b/external/corefx/src/System.Threading.Tasks.Extensions/pkg/System.Threading.Tasks.Extensions.pkgproj index 62b45af567..1020a4bb8b 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/pkg/System.Threading.Tasks.Extensions.pkgproj +++ b/external/corefx/src/System.Threading.Tasks.Extensions/pkg/System.Threading.Tasks.Extensions.pkgproj @@ -9,7 +9,15 @@ net45;netcore45;netcoreapp1.0;wpa81;wp8;$(AllXamarinFrameworks) - + + + + .NETCoreApp;UAP + diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/ref/System.Threading.Tasks.Extensions.csproj b/external/corefx/src/System.Threading.Tasks.Extensions/ref/System.Threading.Tasks.Extensions.csproj index 2f643ae328..7c691fde62 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/ref/System.Threading.Tasks.Extensions.csproj +++ b/external/corefx/src/System.Threading.Tasks.Extensions/ref/System.Threading.Tasks.Extensions.csproj @@ -3,6 +3,7 @@ {0DF7FA9A-E7D3-4CEF-862B-A37F5BBBB54C} + true @@ -25,4 +26,4 @@ - \ No newline at end of file + diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/src/Configurations.props b/external/corefx/src/System.Threading.Tasks.Extensions/src/Configurations.props index 4d2a1e0f0d..e4522e47fe 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/src/Configurations.props +++ b/external/corefx/src/System.Threading.Tasks.Extensions/src/Configurations.props @@ -7,7 +7,8 @@ $(PackageConfigurations); - netcoreapp; + netcoreapp-Windows_NT; + netcoreapp-Unix; uap-Windows_NT; diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj b/external/corefx/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj index a9e743f556..28a03703df 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj +++ b/external/corefx/src/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj @@ -5,24 +5,29 @@ {DE90AD0B-649D-4062-B8D9-9658DE140532} $(OutputPath)$(MSBuildProjectName).xml netstandard1.0;portable-net45+win8+wp8+wpa81 + true + true - - + + + + - + + + + - - diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs b/external/corefx/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs index 452424a91a..d2d4997124 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs +++ b/external/corefx/src/System.Threading.Tasks.Extensions/src/System/Threading/Tasks/ValueTask.cs @@ -3,7 +3,9 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +#if !MONO using System.ComponentModel; +#endif using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -157,7 +159,9 @@ namespace System.Threading.Tasks /// Creates a method builder for use with an async method. /// The created builder. +#if !MONO [EditorBrowsable(EditorBrowsableState.Never)] // intended only for compiler consumption +#endif public static AsyncValueTaskMethodBuilder CreateAsyncMethodBuilder() => AsyncValueTaskMethodBuilder.Create(); } } diff --git a/external/corefx/src/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs b/external/corefx/src/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs index 997e8ca83e..94827c91b5 100644 --- a/external/corefx/src/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs +++ b/external/corefx/src/System.Threading.Tasks.Extensions/tests/AsyncValueTaskMethodBuilderTests.cs @@ -82,36 +82,6 @@ namespace System.Threading.Tasks.Tests Assert.Equal(1, invokes); } - [Theory] - [InlineData(false)] - [InlineData(true)] - public async Task AwaitOnCompleted_InvokesStateMachineMethods(bool awaitUnsafe) - { - AsyncValueTaskMethodBuilder b = ValueTask.CreateAsyncMethodBuilder(); - var ignored = b.Task; - - var callbackCompleted = new TaskCompletionSource(); - IAsyncStateMachine foundSm = null; - var dsm = new DelegateStateMachine - { - MoveNextDelegate = () => callbackCompleted.SetResult(true), - SetStateMachineDelegate = sm => foundSm = sm - }; - - TaskAwaiter t = Task.CompletedTask.GetAwaiter(); - if (awaitUnsafe) - { - b.AwaitUnsafeOnCompleted(ref t, ref dsm); - } - else - { - b.AwaitOnCompleted(ref t, ref dsm); - } - - await callbackCompleted.Task; - Assert.Equal(dsm, foundSm); - } - [Theory] [InlineData(1, false)] [InlineData(2, false)] @@ -149,7 +119,6 @@ namespace System.Threading.Tasks.Tests { AsyncValueTaskMethodBuilder b = ValueTask.CreateAsyncMethodBuilder(); AssertExtensions.Throws("stateMachine", () => b.SetStateMachine(null)); - b.SetStateMachine(new DelegateStateMachine()); } [Fact] @@ -214,8 +183,7 @@ namespace System.Threading.Tasks.Tests internal Action MoveNextDelegate; public void MoveNext() => MoveNextDelegate?.Invoke(); - internal Action SetStateMachineDelegate; - public void SetStateMachine(IAsyncStateMachine stateMachine) => SetStateMachineDelegate?.Invoke(stateMachine); + public void SetStateMachine(IAsyncStateMachine stateMachine) { } } } } diff --git a/external/corefx/src/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs b/external/corefx/src/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs index 70ad76ee4d..3e158d6b8a 100644 --- a/external/corefx/src/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs +++ b/external/corefx/src/System.Threading.Tasks.Parallel/tests/RangePartitioner1Chunk.cs @@ -97,7 +97,7 @@ namespace System.Threading.Tasks.Tests } /// - /// Test that in a parallel Foreach loop can be dependecies between iterations if a partitioner of chunk size 1 is used + /// Test that in a parallel Foreach loop can be dependencies between iterations if a partitioner of chunk size 1 is used /// /// [Fact] diff --git a/external/corefx/src/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj b/external/corefx/src/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj index 3289100ab1..1aa0937013 100644 --- a/external/corefx/src/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj +++ b/external/corefx/src/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj @@ -14,9 +14,6 @@ Common\System\Diagnostics\Tracing\TestEventListener.cs - - Common\System\PlatformDetection.cs - diff --git a/external/corefx/src/System.Threading.Tasks/ref/System.Threading.Tasks.cs b/external/corefx/src/System.Threading.Tasks/ref/System.Threading.Tasks.cs index 887a4fb1f3..48cf5dbff7 100644 --- a/external/corefx/src/System.Threading.Tasks/ref/System.Threading.Tasks.cs +++ b/external/corefx/src/System.Threading.Tasks/ref/System.Threading.Tasks.cs @@ -9,6 +9,7 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.AggregateException))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.ConfiguredTaskAwaitable))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IAsyncStateMachine))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.ICriticalNotifyCompletion))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.INotifyCompletion))] [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.TaskAwaiter))] @@ -77,11 +78,6 @@ namespace System.Runtime.CompilerServices public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { } public void Start(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { } } - public partial interface IAsyncStateMachine - { - void MoveNext(); - void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine); - } } namespace System.Threading { diff --git a/external/corefx/src/System.Threading.Tasks/tests/CESchedulerPairTests.cs b/external/corefx/src/System.Threading.Tasks/tests/CESchedulerPairTests.cs index cd1eb50622..ef8ec6a94f 100644 --- a/external/corefx/src/System.Threading.Tasks/tests/CESchedulerPairTests.cs +++ b/external/corefx/src/System.Threading.Tasks/tests/CESchedulerPairTests.cs @@ -317,7 +317,7 @@ namespace System.Threading.Tasks.Tests conTask.Wait(); Assert.True(conTask.Result, "The concurrenttask when executed successfully should have returned true"); - //Now scehdule a exclusive task that is blocked(thereby preventing other concurrent tasks to finish) + //Now scehdule an exclusive task that is blocked(thereby preventing other concurrent tasks to finish) Task exclusiveTask = writers.StartNew(() => { blockMainThreadEvent.Set(); blockExclusiveTaskEvent.WaitOne(); return true; }); //With exclusive task in execution mode, schedule a number of concurrent tasks and ensure they are not executed @@ -328,7 +328,7 @@ namespace System.Threading.Tasks.Tests foreach (Task task in taskList) { bool wasTaskStarted = (task.Status != TaskStatus.Running) && (task.Status != TaskStatus.RanToCompletion); - Assert.True(wasTaskStarted, "Concurrent tasks should not be executed when a exclusive task is getting executed"); + Assert.True(wasTaskStarted, "Concurrent tasks should not be executed when an exclusive task is getting executed"); } blockExclusiveTaskEvent.Set(); diff --git a/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.cs b/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.cs index 5b69490ed0..5caf5efb25 100644 --- a/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.cs +++ b/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.cs @@ -11,7 +11,7 @@ using Xunit; namespace System.Threading.Tasks.Tests { - public static class CancellationTokenTests + public static partial class CancellationTokenTests { [Fact] public static void CancellationTokenRegister_Exceptions() diff --git a/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.netcoreapp.cs b/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.netcoreapp.cs new file mode 100644 index 0000000000..fdb7e19770 --- /dev/null +++ b/external/corefx/src/System.Threading.Tasks/tests/CancellationTokenTests.netcoreapp.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.Threading.Tasks.Tests +{ + public static partial class CancellationTokenTests + { + [Fact] + public static void CancellationTokenRegistration_Token_MatchesExpectedValue() + { + Assert.Equal(default(CancellationToken), default(CancellationTokenRegistration).Token); + + var cts = new CancellationTokenSource(); + Assert.NotEqual(default(CancellationToken), cts.Token); + + using (var ctr = cts.Token.Register(() => { })) + { + Assert.Equal(cts.Token, ctr.Token); + } + } + } +} diff --git a/external/corefx/src/System.Threading.Tasks/tests/System.Threading.Tasks.Tests.csproj b/external/corefx/src/System.Threading.Tasks/tests/System.Threading.Tasks.Tests.csproj index 309bc20112..be16c23396 100644 --- a/external/corefx/src/System.Threading.Tasks/tests/System.Threading.Tasks.Tests.csproj +++ b/external/corefx/src/System.Threading.Tasks/tests/System.Threading.Tasks.Tests.csproj @@ -54,6 +54,7 @@ + diff --git a/external/corefx/src/System.Threading.Tasks/tests/Task/TaskAPMTest.cs b/external/corefx/src/System.Threading.Tasks/tests/Task/TaskAPMTest.cs index 7fe3ed82b9..99e598c291 100644 --- a/external/corefx/src/System.Threading.Tasks/tests/Task/TaskAPMTest.cs +++ b/external/corefx/src/System.Threading.Tasks/tests/Task/TaskAPMTest.cs @@ -28,7 +28,7 @@ namespace System.Threading.Tasks.Tests private bool _hasReturnType; /// - /// Used to synchornize between Main thread and async thread, by blocking the main thread until + /// Used to synchronize between Main thread and async thread, by blocking the main thread until /// the thread that invokes the TaskCompleted method via AsyncCallback finishes /// private ManualResetEvent _mre = new ManualResetEvent(false); diff --git a/external/corefx/src/System.Threading.Tasks/tests/Task/TaskRunSyncTests.cs b/external/corefx/src/System.Threading.Tasks/tests/Task/TaskRunSyncTests.cs index b9bbe59bf2..37e3d023bd 100644 --- a/external/corefx/src/System.Threading.Tasks/tests/Task/TaskRunSyncTests.cs +++ b/external/corefx/src/System.Threading.Tasks/tests/Task/TaskRunSyncTests.cs @@ -41,7 +41,7 @@ namespace System.Threading.Tasks.Tests public enum WorkloadType { - CreateChildTask, //Start a attached childTask in the workload + CreateChildTask, //Start an attached childTask in the workload CreateDetachedChildTask, //start a detached childTask in the workload ContinueInside, //Invoke continuewith as the workload inside the task RunWithUserScheduler, //create a task with custom task scheduler that runs that task inline diff --git a/external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj b/external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj index 45a5c81583..273901b62c 100644 --- a/external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj +++ b/external/corefx/src/System.Threading.Thread/tests/System.Threading.Thread.Tests.csproj @@ -15,9 +15,6 @@ - - Common\System\PlatformDetection.cs - CommonTest\System\Threading\ThreadPoolHelpers.cs diff --git a/external/corefx/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs b/external/corefx/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs index e74a38807e..b22f1c0f1f 100644 --- a/external/corefx/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs +++ b/external/corefx/src/System.Threading.ThreadPool/ref/System.Threading.ThreadPool.cs @@ -24,6 +24,7 @@ namespace System.Threading public static void GetMinThreads(out int workerThreads, out int completionPortThreads) { throw null; } public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack) { throw null; } public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack, object state) { throw null; } + public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack, object state, bool preferLocal) { throw null; } public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; } public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, System.TimeSpan timeout, bool executeOnlyOnce) { throw null; } diff --git a/external/corefx/src/System.Threading.ThreadPool/tests/Configurations.props b/external/corefx/src/System.Threading.ThreadPool/tests/Configurations.props index c398e42e89..8b803e0772 100644 --- a/external/corefx/src/System.Threading.ThreadPool/tests/Configurations.props +++ b/external/corefx/src/System.Threading.ThreadPool/tests/Configurations.props @@ -2,6 +2,7 @@ + netcoreapp; netstandard; diff --git a/external/corefx/src/System.Threading.ThreadPool/tests/System.Threading.ThreadPool.Tests.csproj b/external/corefx/src/System.Threading.ThreadPool/tests/System.Threading.ThreadPool.Tests.csproj index 7af5a70b52..1d781c04d9 100644 --- a/external/corefx/src/System.Threading.ThreadPool/tests/System.Threading.ThreadPool.Tests.csproj +++ b/external/corefx/src/System.Threading.ThreadPool/tests/System.Threading.ThreadPool.Tests.csproj @@ -7,13 +7,13 @@ + + + - - CommonTest\System\PlatformDetection.cs - CommonTest\System\Threading\ThreadTestHelpers.cs diff --git a/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.cs b/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.cs index f6a2fe8f17..e86ff390cf 100644 --- a/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.cs +++ b/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.cs @@ -8,7 +8,7 @@ using Xunit; namespace System.Threading.ThreadPools.Tests { - public static class ThreadPoolTests + public partial class ThreadPoolTests { private const int UnexpectedTimeoutMilliseconds = ThreadTestHelpers.UnexpectedTimeoutMilliseconds; private const int ExpectedTimeoutMilliseconds = ThreadTestHelpers.ExpectedTimeoutMilliseconds; diff --git a/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.netcoreapp.cs b/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.netcoreapp.cs new file mode 100644 index 0000000000..c3b9a92c3a --- /dev/null +++ b/external/corefx/src/System.Threading.ThreadPool/tests/ThreadPoolTests.netcoreapp.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Threading.Tasks; +using Xunit; + +namespace System.Threading.ThreadPools.Tests +{ + public partial class ThreadPoolTests + { + [Theory] + [InlineData(false)] + [InlineData(true)] + public void QueueUserWorkItem_PreferLocal_InvalidArguments_Throws(bool preferLocal) + { + Assert.Throws(() => ThreadPool.QueueUserWorkItem(null, new object(), preferLocal)); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task QueueUserWorkItem_PreferLocal_NullValidForState(bool preferLocal) + { + var tcs = new TaskCompletionSource(); + ThreadPool.QueueUserWorkItem(s => + { + tcs.SetResult(84); + }, null, preferLocal); + Assert.Equal(84, await tcs.Task); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public async Task QueueUserWorkItem_PreferLocal_StateObjectPassedThrough(bool preferLocal) + { + var tcs = new TaskCompletionSource(); + ThreadPool.QueueUserWorkItem(s => + { + ((TaskCompletionSource)s).SetResult(84); + }, tcs, preferLocal); + Assert.Equal(84, await tcs.Task); + } + } +} diff --git a/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs b/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs index ede5296552..6259d05353 100644 --- a/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs +++ b/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs @@ -375,7 +375,7 @@ namespace System.Threading /// thread-safe and may not be used concurrently with other members of this instance. /// /// The current instance has already been - /// disposed.. + /// disposed. public void Reset() { Reset(_initialCount); diff --git a/external/corefx/src/System.Threading/src/System/Threading/HostExecutionContextManager.cs b/external/corefx/src/System.Threading/src/System/Threading/HostExecutionContextManager.cs index fb65109158..60a58fd92b 100644 --- a/external/corefx/src/System.Threading/src/System/Threading/HostExecutionContextManager.cs +++ b/external/corefx/src/System.Threading/src/System/Threading/HostExecutionContextManager.cs @@ -8,7 +8,7 @@ namespace System.Threading { /// /// Normally, the current would be stored on the . - /// Since this feature is not fully hooked up, this class just immitates the behavior of the desktop framework, while + /// Since this feature is not fully hooked up, this class just imitates the behavior of the desktop framework, while /// separating itself from the to minimize unnecessary additions there. /// [ThreadStatic] diff --git a/external/corefx/src/System.Threading/src/System/Threading/ReaderWriterLock.cs b/external/corefx/src/System.Threading/src/System/Threading/ReaderWriterLock.cs index 21cd141c02..d181b0ed94 100644 --- a/external/corefx/src/System.Threading/src/System/Threading/ReaderWriterLock.cs +++ b/external/corefx/src/System.Threading/src/System/Threading/ReaderWriterLock.cs @@ -21,7 +21,7 @@ namespace System.Threading /// whether there were any intermediate writes. Downgrading from a writer lock restores the state of the lock. /// 7. Supports functionality to release all locks owned by a thread (see ). /// restores the lock state. - /// 8. Recovers from most common failures such as creation of events. In other words, the lock mainitains consistent + /// 8. Recovers from most common failures such as creation of events. In other words, the lock maintains consistent /// internal state and remains usable /// public sealed class ReaderWriterLock : CriticalFinalizerObject diff --git a/external/corefx/src/System.Threading/tests/MutexTests.cs b/external/corefx/src/System.Threading/tests/MutexTests.cs index e312522e63..88f6a3a121 100644 --- a/external/corefx/src/System.Threading/tests/MutexTests.cs +++ b/external/corefx/src/System.Threading/tests/MutexTests.cs @@ -71,7 +71,7 @@ namespace System.Threading.Tests } [PlatformSpecific(TestPlatforms.Windows)] - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWinRT))] // Can't create global objects in appcontainer + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInAppContainer))] // Can't create global objects in appcontainer [SkipOnTargetFramework( TargetFrameworkMonikers.NetFramework, "The fix necessary for this test (PR https://github.com/dotnet/coreclr/pull/12381) is not in the .NET Framework.")] @@ -90,7 +90,7 @@ namespace System.Threading.Tests }); } - [ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsWinRT))] // Can't create global objects in appcontainer + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsInAppContainer))] // Can't create global objects in appcontainer [PlatformSpecific(TestPlatforms.Windows)] public void Ctor_TryCreateGlobalMutexTest_Uwp() { diff --git a/external/corefx/src/System.Threading/tests/Performance/Configurations.props b/external/corefx/src/System.Threading/tests/Performance/Configurations.props new file mode 100644 index 0000000000..2845c11c54 --- /dev/null +++ b/external/corefx/src/System.Threading/tests/Performance/Configurations.props @@ -0,0 +1,8 @@ + + + + + netcoreapp; + + + \ No newline at end of file diff --git a/external/corefx/src/System.Threading/tests/Performance/Perf.Monitor.cs b/external/corefx/src/System.Threading/tests/Performance/Perf.Monitor.cs index 99a1ddb211..33159ec365 100644 --- a/external/corefx/src/System.Threading/tests/Performance/Perf.Monitor.cs +++ b/external/corefx/src/System.Threading/tests/Performance/Perf.Monitor.cs @@ -37,7 +37,6 @@ namespace System.Threading.Tests { for (int i = 0; i < Benchmark.InnerIterationCount; i++) { - Monitor.TryEnter(sync, 0); Monitor.TryEnter(sync, 0); Monitor.Exit(sync); } diff --git a/external/corefx/src/System.Threading/tests/System.Threading.Tests.csproj b/external/corefx/src/System.Threading/tests/System.Threading.Tests.csproj index 173ba92d48..3818ce2204 100644 --- a/external/corefx/src/System.Threading/tests/System.Threading.Tests.csproj +++ b/external/corefx/src/System.Threading/tests/System.Threading.Tests.csproj @@ -40,9 +40,6 @@ CommonTest\System\Diagnostics\Tracing\TestEventListener.cs - - CommonTest\System\PlatformDetection.cs - CommonTest\System\Threading\ThreadTestHelpers.cs diff --git a/external/corefx/src/System.Transactions.Local/src/System/Transactions/DistributedTransaction.cs b/external/corefx/src/System.Transactions.Local/src/System/Transactions/DistributedTransaction.cs index aea39d1c77..0f1c0776a5 100644 --- a/external/corefx/src/System.Transactions.Local/src/System/Transactions/DistributedTransaction.cs +++ b/external/corefx/src/System.Transactions.Local/src/System/Transactions/DistributedTransaction.cs @@ -49,7 +49,7 @@ namespace System.Transactions.Distributed /// /// A Transaction object represents a single transaction. It is created by TransactionManager /// objects through CreateTransaction or through deserialization. Alternatively, the static Create - /// methodis provided, which creates a "default" TransactionManager and requests that it create + /// methods provided, which creates a "default" TransactionManager and requests that it create /// a new transaction with default values. A transaction can only be committed by /// the client application that created the transaction. If a client application wishes to allow /// access to the transaction by multiple threads, but wants to prevent those other threads from diff --git a/external/corefx/src/System.Transactions.Local/src/System/Transactions/EnlistmentTraceIdentifier.cs b/external/corefx/src/System.Transactions.Local/src/System/Transactions/EnlistmentTraceIdentifier.cs index 943bd35705..612214bcf8 100644 --- a/external/corefx/src/System.Transactions.Local/src/System/Transactions/EnlistmentTraceIdentifier.cs +++ b/external/corefx/src/System.Transactions.Local/src/System/Transactions/EnlistmentTraceIdentifier.cs @@ -5,7 +5,7 @@ namespace System.Transactions { /// - /// This identifier is used in tracing to distiguish transaction + /// This identifier is used in tracing to distinguish transaction /// enlistments. This identifier is only unique within /// a given AppDomain. /// @@ -40,7 +40,7 @@ namespace System.Transactions private readonly int _enlistmentIdentifier; /// - /// A value that distiguishes between multiple enlistments on the same + /// A value that distinguishes between multiple enlistments on the same /// transaction instance by the same resource manager. /// public int EnlistmentIdentifier => _enlistmentIdentifier; diff --git a/external/corefx/src/System.Transactions.Local/src/System/Transactions/Transaction.cs b/external/corefx/src/System.Transactions.Local/src/System/Transactions/Transaction.cs index 0454614b84..285489ae5a 100644 --- a/external/corefx/src/System.Transactions.Local/src/System/Transactions/Transaction.cs +++ b/external/corefx/src/System.Transactions.Local/src/System/Transactions/Transaction.cs @@ -453,7 +453,7 @@ namespace System.Transactions /// /// If the transaction has not already been promoted, retrieving this value will cause promotion. Before retrieving the /// PromotedToken, the Transaction.PromoterType value should be checked to see if it is a promoter type (Guid) that the - /// caller understands. If the caller does not recognize the PromoterType value, retreiving the PromotedToken doesn't + /// caller understands. If the caller does not recognize the PromoterType value, retrieving the PromotedToken doesn't /// have much value because the caller doesn't know how to utilize it. But if the PromoterType is recognized, the /// caller should know how to utilize the PromotedToken to communicate with the promoting distributed transaction /// coordinator to enlist on the distributed transaction. @@ -952,7 +952,7 @@ namespace System.Transactions /// /// False if the transaction already has a durable enlistment or promotable single phase enlistment or /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other - /// means, such as Transaction.EnlistDurable or retreive the MSDTC export cookie or propagation token to enlist with MSDTC. + /// means, such as Transaction.EnlistDurable or retrieve the MSDTC export cookie or propagation token to enlist with MSDTC. /// // We apparently didn't spell Promotable like FXCop thinks it should be spelled. public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification) diff --git a/external/corefx/src/System.Transactions.Local/src/System/Transactions/TransactionTraceIdentifier.cs b/external/corefx/src/System.Transactions.Local/src/System/Transactions/TransactionTraceIdentifier.cs index 0208c36fff..ccc1456356 100644 --- a/external/corefx/src/System.Transactions.Local/src/System/Transactions/TransactionTraceIdentifier.cs +++ b/external/corefx/src/System.Transactions.Local/src/System/Transactions/TransactionTraceIdentifier.cs @@ -5,7 +5,7 @@ namespace System.Transactions { /// - /// This identifier is used in tracing to distiguish instances + /// This identifier is used in tracing to distinguish instances /// of transaction objects. This identifier is only unique within /// a given AppDomain. /// @@ -28,7 +28,7 @@ namespace System.Transactions private readonly int _cloneIdentifier; /// /// An integer value that allows different clones of the same - /// transaction to be distiguished in the tracing. + /// transaction to be distinguished in the tracing. /// public int CloneIdentifier => _cloneIdentifier; diff --git a/external/corefx/src/System.Transactions.Local/tests/TransactionScopeTest.cs b/external/corefx/src/System.Transactions.Local/tests/TransactionScopeTest.cs index 1838ba4961..e96ec2ef2a 100644 --- a/external/corefx/src/System.Transactions.Local/tests/TransactionScopeTest.cs +++ b/external/corefx/src/System.Transactions.Local/tests/TransactionScopeTest.cs @@ -761,7 +761,7 @@ namespace System.Transactions.Tests irm.Value = 2; ct.Commit(); - /* Using a already committed transaction in a new + /* Using an already committed transaction in a new * TransactionScope */ TransactionScope scope = new TransactionScope(ct); diff --git a/external/corefx/src/System.ValueTuple/dir.props b/external/corefx/src/System.ValueTuple/dir.props index 3c0e06e0cc..637f027bee 100644 --- a/external/corefx/src/System.ValueTuple/dir.props +++ b/external/corefx/src/System.ValueTuple/dir.props @@ -6,6 +6,5 @@ Open true true - true \ No newline at end of file diff --git a/external/corefx/src/System.ValueTuple/pkg/System.ValueTuple.pkgproj b/external/corefx/src/System.ValueTuple/pkg/System.ValueTuple.pkgproj index 82167fa9be..9965ac4782 100644 --- a/external/corefx/src/System.ValueTuple/pkg/System.ValueTuple.pkgproj +++ b/external/corefx/src/System.ValueTuple/pkg/System.ValueTuple.pkgproj @@ -3,7 +3,7 @@ - net45;netcore45;netcoreapp1.0;wp8;wpa81;$(AllXamarinFrameworks) + net45;netcore45;netcoreapp2.1;wp8;wpa81;$(AllXamarinFrameworks) diff --git a/external/corefx/src/System.ValueTuple/ref/System.ValueTuple.csproj b/external/corefx/src/System.ValueTuple/ref/System.ValueTuple.csproj index fd405598a5..888a39f5a0 100644 --- a/external/corefx/src/System.ValueTuple/ref/System.ValueTuple.csproj +++ b/external/corefx/src/System.ValueTuple/ref/System.ValueTuple.csproj @@ -4,6 +4,9 @@ {11AE73F7-3532-47B9-8FF6-B4F22D76456D} System + + 4.0.3.0 diff --git a/external/corefx/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj b/external/corefx/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj index b0fb644dc2..8d5ecfa529 100644 --- a/external/corefx/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj +++ b/external/corefx/src/System.ValueTuple/tests/System.ValueTuple.Tests.csproj @@ -17,9 +17,6 @@ - - CommonTest\System\PlatformDetection.cs - System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs diff --git a/external/corefx/src/System.Web.HttpUtility/src/System/Web/HttpUtility.cs b/external/corefx/src/System.Web.HttpUtility/src/System/Web/HttpUtility.cs index d906040649..ea585a1cd6 100644 --- a/external/corefx/src/System.Web.HttpUtility/src/System/Web/HttpUtility.cs +++ b/external/corefx/src/System.Web.HttpUtility/src/System/Web/HttpUtility.cs @@ -2,6 +2,34 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +// Authors: +// Patrik Torstensson (Patrik.Torstensson@labs2.com) +// Wictor Wilén (decode/encode functions) (wictor@ibizkit.se) +// Tim Coleman (tim@timcoleman.com) +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// Copyright (C) 2005-2010 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.Collections.Specialized; using System.Globalization; using System.IO; @@ -44,47 +72,37 @@ namespace System.Web public static NameValueCollection ParseQueryString(string query, Encoding encoding) { if (query == null) + { throw new ArgumentNullException(nameof(query)); + } if (encoding == null) + { throw new ArgumentNullException(nameof(encoding)); + } - if ((query.Length > 0) && (query[0] == '?')) - query = query.Substring(1); + HttpQSCollection result = new HttpQSCollection(); + int queryLength = query.Length; + int namePos = queryLength > 0 && query[0] == '?' ? 1 : 0; + if (queryLength == namePos) + { + return result; + } - var result = new HttpQSCollection(); - ParseQueryString(query, encoding, result); - return result; - } - - private static void ParseQueryString(string query, Encoding encoding, NameValueCollection result) - { - if (query.Length == 0) - return; - - var decoded = HtmlDecode(query); - var decodedLength = decoded.Length; - var namePos = 0; - var first = true; - while (namePos <= decodedLength) + while (namePos <= queryLength) { int valuePos = -1, valueEnd = -1; - for (var q = namePos; q < decodedLength; q++) - if ((valuePos == -1) && (decoded[q] == '=')) + for (int q = namePos; q < queryLength; q++) + { + if (valuePos == -1 && query[q] == '=') { valuePos = q + 1; } - else if (decoded[q] == '&') + else if (query[q] == '&') { valueEnd = q; break; } - - if (first) - { - first = false; - if (decoded[namePos] == '?') - namePos++; } string name; @@ -95,23 +113,20 @@ namespace System.Web } else { - name = UrlDecode(decoded.Substring(namePos, valuePos - namePos - 1), encoding); + name = UrlDecode(query.Substring(namePos, valuePos - namePos - 1), encoding); } + if (valueEnd < 0) { - namePos = -1; - valueEnd = decoded.Length; + valueEnd = query.Length; } - else - { - namePos = valueEnd + 1; - } - var value = UrlDecode(decoded.Substring(valuePos, valueEnd - valuePos), encoding); + namePos = valueEnd + 1; + string value = UrlDecode(query.Substring(valuePos, valueEnd - valuePos), encoding); result.Add(name, value); - if (namePos == -1) - break; } + + return result; } public static string HtmlDecode(string s) @@ -298,4 +313,4 @@ namespace System.Web return addDoubleQuotes ? "\"" + encoded + "\"" : encoded; } } -} \ No newline at end of file +} diff --git a/external/corefx/src/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs b/external/corefx/src/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs index 357f526408..aabfd4fd9b 100644 --- a/external/corefx/src/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs +++ b/external/corefx/src/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs @@ -33,7 +33,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using System.Web; using Xunit; namespace System.Web.Tests @@ -51,6 +50,8 @@ namespace System.Web.Tests new object[] {"<script>", "